From 807c9ec5bf08bb0377f111e13ff7e91ca46b89ef Mon Sep 17 00:00:00 2001 From: Reef Date: Fri, 20 Nov 2026 07:10:30 +0000 Subject: [PATCH 1/4] feat(members): link App bot profile From and Managed by app to App details (slock #14286) --- .../changesets/app-bot-profile-app-link.md | 19 ++ .../composeResources/values-es/strings.xml | 1 + .../composeResources/values-ja/strings.xml | 1 + .../composeResources/values-ko/strings.xml | 1 + .../values-pt-rBR/strings.xml | 1 + .../composeResources/values-ru/strings.xml | 1 + .../values-zh-rCN/strings.xml | 1 + .../values-zh-rTW/strings.xml | 1 + .../composeResources/values/strings.xml | 1 + .../build/raft/app/data/AgentDetailOffline.kt | 20 +- .../kotlin/build/raft/app/data/AgentsApi.kt | 39 +++ .../build/raft/app/data/DataSnapshots.kt | 12 + .../build/raft/app/data/MemberAgentParser.kt | 8 + .../raft/app/members/MembersAgentProfile.kt | 127 ++++---- .../app/members/MembersAgentRuntimeConfig.kt | 164 +++++++---- .../raft/app/members/MembersDetailContent.kt | 3 + .../raft/app/members/MembersDetailPage.kt | 18 ++ .../app/members/MembersStatusFormatting.kt | 14 +- .../build/raft/app/members/RaftAppBot.kt | 276 ++++++++++++++++++ .../kotlin/build/raft/app/model/RaftModels.kt | 14 + .../app/settings/SettingsMarketplacePage.kt | 33 ++- .../settings/SettingsStandaloneWebViewHost.kt | 21 +- .../raft/app/ManagedAppDetailLinkTest.kt | 212 ++++++++++++++ .../app/SettingsMarketplaceWebViewTest.kt | 40 +++ .../build/raft/app/data/AgentsApiTest.kt | 17 ++ 25 files changed, 914 insertions(+), 131 deletions(-) create mode 100644 change-logs/1.28.0/changesets/app-bot-profile-app-link.md create mode 100644 compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt diff --git a/change-logs/1.28.0/changesets/app-bot-profile-app-link.md b/change-logs/1.28.0/changesets/app-bot-profile-app-link.md new file mode 100644 index 0000000000..7ce2d51097 --- /dev/null +++ b/change-logs/1.28.0/changesets/app-bot-profile-app-link.md @@ -0,0 +1,19 @@ +--- +type: improved +area: members +platforms: + - android + - ios + - desktop +pull_request: null +rollout: full +--- + +## zh-CN +- 在应用机器人的资料页中,「来自」和「所属应用」现在会显示应用图标,点击后可直接打开该应用的详情页。 + +## en +- On an App bot's profile, "From" and "Managed by app" now show the App's icon and open the App's details when tapped. + +## ja +- アプリボットのプロフィールで「提供元」と「管理元アプリ」にアプリアイコンが表示され、タップするとアプリの詳細を開けるようになりました。 diff --git a/compose/shared/src/commonMain/composeResources/values-es/strings.xml b/compose/shared/src/commonMain/composeResources/values-es/strings.xml index 993752b092..40d3f89a9e 100644 --- a/compose/shared/src/commonMain/composeResources/values-es/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-es/strings.xml @@ -1771,6 +1771,7 @@ App · %1$s Creado por la app %1$s De %1$s + Abrir los detalles de la app %1$s Perfil no disponible Ver perfil Administrado por la app diff --git a/compose/shared/src/commonMain/composeResources/values-ja/strings.xml b/compose/shared/src/commonMain/composeResources/values-ja/strings.xml index e8c0f4c7b3..16b6a9e4ed 100644 --- a/compose/shared/src/commonMain/composeResources/values-ja/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-ja/strings.xml @@ -1774,6 +1774,7 @@ アプリ · %1$s %1$s アプリが作成 提供元: %1$s + %1$s アプリの詳細を開く プロフィールを表示できません プロフィールを表示 管理元アプリ diff --git a/compose/shared/src/commonMain/composeResources/values-ko/strings.xml b/compose/shared/src/commonMain/composeResources/values-ko/strings.xml index c96dd550c6..7cc013c74f 100644 --- a/compose/shared/src/commonMain/composeResources/values-ko/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-ko/strings.xml @@ -1771,6 +1771,7 @@ 앱 · %1$s %1$s 앱이 만듦 제공: %1$s + %1$s 앱 세부 정보 열기 프로필을 볼 수 없어요 프로필 보기 관리 앱 diff --git a/compose/shared/src/commonMain/composeResources/values-pt-rBR/strings.xml b/compose/shared/src/commonMain/composeResources/values-pt-rBR/strings.xml index e4981ed94d..c7e9c60cda 100644 --- a/compose/shared/src/commonMain/composeResources/values-pt-rBR/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-pt-rBR/strings.xml @@ -1771,6 +1771,7 @@ App · %1$s Criado pelo app %1$s De %1$s + Abrir os detalhes do app %1$s Perfil indisponível Ver perfil Gerenciado pelo app diff --git a/compose/shared/src/commonMain/composeResources/values-ru/strings.xml b/compose/shared/src/commonMain/composeResources/values-ru/strings.xml index c590d664fb..a7888df878 100644 --- a/compose/shared/src/commonMain/composeResources/values-ru/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-ru/strings.xml @@ -1771,6 +1771,7 @@ Приложение · %1$s Создан приложением %1$s Из приложения %1$s + Открыть сведения о приложении %1$s Профиль недоступен Открыть профиль Управляется приложением diff --git a/compose/shared/src/commonMain/composeResources/values-zh-rCN/strings.xml b/compose/shared/src/commonMain/composeResources/values-zh-rCN/strings.xml index 34577c7346..5ffbb7544a 100644 --- a/compose/shared/src/commonMain/composeResources/values-zh-rCN/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-zh-rCN/strings.xml @@ -1772,6 +1772,7 @@ 应用 · %1$s 由 %1$s 应用创建 来自 %1$s + 打开 %1$s 应用详情 资料不可用 查看资料 所属应用 diff --git a/compose/shared/src/commonMain/composeResources/values-zh-rTW/strings.xml b/compose/shared/src/commonMain/composeResources/values-zh-rTW/strings.xml index cab8bd0efa..1899427ab2 100644 --- a/compose/shared/src/commonMain/composeResources/values-zh-rTW/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values-zh-rTW/strings.xml @@ -1771,6 +1771,7 @@ 應用程式 · %1$s 由 %1$s 應用程式建立 來自 %1$s + 開啟 %1$s 應用程式詳細資料 無法顯示個人檔案 查看資料 所屬應用程式 diff --git a/compose/shared/src/commonMain/composeResources/values/strings.xml b/compose/shared/src/commonMain/composeResources/values/strings.xml index 028009d48f..defd234cd6 100644 --- a/compose/shared/src/commonMain/composeResources/values/strings.xml +++ b/compose/shared/src/commonMain/composeResources/values/strings.xml @@ -1775,6 +1775,7 @@ App · %1$s Created by the %1$s app From %1$s + Open %1$s app details Profile unavailable View Profile Managed by app diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentDetailOffline.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentDetailOffline.kt index 4854f09784..fd53216102 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentDetailOffline.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentDetailOffline.kt @@ -102,7 +102,13 @@ internal data class StoredAgentSummary( val createdAgents: List = emptyList(), val deletedAt: String? = null, val lastSeenAt: String? = null, - val hostedRuntime: AgentHostedRuntimeSnapshot? = null + val hostedRuntime: AgentHostedRuntimeSnapshot? = null, + val managedByAppInstallId: String? = null, + val managedByAppClientId: String? = null, + val managedByAppName: String? = null, + val managedByAppLogoUrl: String? = null, + val managedByAppBotStatusText: String? = null, + val profileProjection: String? = null ) @Serializable @@ -292,6 +298,12 @@ private fun AgentDetailSummary.toStored(): StoredAgentSummary = createdAgents.map { StoredAgentCreated(it.id, it.name, it.displayName, it.avatarUrl, it.runtime, it.status, it.isExternal) }, deletedAt = deletedAt, lastSeenAt = lastSeenAt, + managedByAppInstallId = managedByAppInstallId, + managedByAppClientId = managedByAppClientId, + managedByAppName = managedByAppName, + managedByAppLogoUrl = managedByAppLogoUrl, + managedByAppBotStatusText = managedByAppBotStatusText, + profileProjection = profileProjection, ) /** The stored record as a cached detail (a read-only stand-in: the page grants no edits from the cache). */ @@ -334,6 +346,12 @@ internal fun StoredAgentDetail.toCachedAgentDetail(): RaftCachedAgentDetail { }, deletedAt = it.deletedAt, lastSeenAt = it.lastSeenAt, + managedByAppInstallId = it.managedByAppInstallId, + managedByAppClientId = it.managedByAppClientId, + managedByAppName = it.managedByAppName, + managedByAppLogoUrl = it.managedByAppLogoUrl, + managedByAppBotStatusText = it.managedByAppBotStatusText, + profileProjection = it.profileProjection, ) }, directMessages = diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentsApi.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentsApi.kt index 0b54938a4c..98483c9ad0 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentsApi.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/data/AgentsApi.kt @@ -800,6 +800,18 @@ internal data class AgentSummary( val deletedAt: String?, /** A personal assistant's owner (`assistantOwnerUserId`); null for a shared agent. */ val assistantOwnerUserId: String? = null, + /** App Bots only (`agents.managedByAppInstallId`); null for ordinary agents and guest projections. */ + val managedByAppInstallId: String? = null, + /** App Bots only: owning App row id (`managedByApp.clientId` = `oauth_clients.id`, slock #14286). */ + val managedByAppClientId: String? = null, + /** App Bots only: owning App display name (`managedByApp.name`). */ + val managedByAppName: String? = null, + /** App Bots only: owning App logo URL (`managedByApp.logoUrl`). */ + val managedByAppLogoUrl: String? = null, + /** App Bots only: app-published status line (`managedByApp.botStatusText`). */ + val managedByAppBotStatusText: String? = null, + /** Bounded public profile projection marker (`"channel_summary"`, `routes/agents.ts`). */ + val profileProjection: String? = null, /** Web parity: `agent.external === true || runtime === "external"`. */ val isExternal: Boolean = false, /** External agents only: `lastSeenAt` from `GET /agents*` (`agent:seen` updates it in the store). */ @@ -867,6 +879,12 @@ internal fun AgentSummary.toAgentDetailSummary(): AgentDetailSummary = activityDetail = activityDetail, deletedAt = deletedAt, assistantOwnerUserId = assistantOwnerUserId, + managedByAppInstallId = managedByAppInstallId, + managedByAppClientId = managedByAppClientId, + managedByAppName = managedByAppName, + managedByAppLogoUrl = managedByAppLogoUrl, + managedByAppBotStatusText = managedByAppBotStatusText, + profileProjection = profileProjection, lastSeenAt = lastSeenAt, activityDetailKind = activityDetailKind, wakeCrashLoop = wakeCrashLoop, @@ -1106,6 +1124,12 @@ private data class AgentWireDto( val deletedAt: String? = null, /** Personal assistant (botiverse/slock packages/shared agent `assistantOwnerUserId`): its owner, else null. */ val assistantOwnerUserId: String? = null, + /** App Bots only (`routes/agents.ts` `managedByAppInstallId`). */ + val managedByAppInstallId: String? = null, + /** App Bots only (`routes/agents.ts` `managedByApp`: `{ clientId, name, logoUrl, description, botStatusText }`). */ + val managedByApp: AgentManagedByAppWireDto? = null, + /** Bounded public projection marker (`routes/agents.ts` `"channel_summary"`). */ + val profileProjection: String? = null, /** * External agents only: ISO-8601 `lastSeenAt` from `GET /agents*` — last * credential use; presence derives from it (`agent:seen` supersedes). @@ -1138,6 +1162,15 @@ private data class AgentWireDto( val hostedRuntime: AgentHostedRuntimeWireDto? = null ) +@Serializable +private data class AgentManagedByAppWireDto( + val clientId: String? = null, + val name: String? = null, + val logoUrl: String? = null, + val description: String? = null, + val botStatusText: String? = null, +) + @Serializable private data class AgentModelLimitsWireDto( val defaultsReported: Boolean? = null, @@ -1216,6 +1249,12 @@ private fun AgentWireDto.toSummary(): AgentSummary? { activityDetail = activityDetail, deletedAt = deletedAt, assistantOwnerUserId = assistantOwnerUserId?.takeIf { it.isNotBlank() }, + managedByAppInstallId = managedByAppInstallId?.trim()?.takeIf { it.isNotBlank() }, + managedByAppClientId = managedByApp?.clientId?.trim()?.takeIf { it.isNotBlank() }, + managedByAppName = managedByApp?.name?.trim()?.takeIf { it.isNotBlank() }, + managedByAppLogoUrl = managedByApp?.logoUrl?.trim()?.takeIf { it.isNotBlank() }, + managedByAppBotStatusText = managedByApp?.botStatusText?.trim()?.takeIf { it.isNotBlank() }, + profileProjection = profileProjection?.trim()?.takeIf { it.isNotBlank() }, lastSeenAt = lastSeenAt?.takeIf { it.isNotBlank() }, activityDetailKind = activityDetailKind?.trim()?.takeIf { it.isNotEmpty() }, wakeCrashLoop = wakeCrashLoop.toAgentWakeCrashLoop(activityDetailKind), diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/data/DataSnapshots.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/data/DataSnapshots.kt index 286105a46b..e652f0df53 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/data/DataSnapshots.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/data/DataSnapshots.kt @@ -1017,6 +1017,18 @@ data class AgentDetailSummary( val deletedAt: String? = null, /** A personal assistant's owner; null for a shared agent (Agent Lounge v0 hides the Lounge for it). */ val assistantOwnerUserId: String? = null, + /** App Bots only (`agents.managedByAppInstallId`); null for ordinary agents and guest projections. */ + val managedByAppInstallId: String? = null, + /** App Bots only: owning App row id (`managedByApp.clientId` = `oauth_clients.id`, slock #14286). */ + val managedByAppClientId: String? = null, + /** App Bots only: owning App display name (`managedByApp.name`). */ + val managedByAppName: String? = null, + /** App Bots only: owning App logo URL (`managedByApp.logoUrl`). */ + val managedByAppLogoUrl: String? = null, + /** App Bots only: app-published status line (`managedByApp.botStatusText`). */ + val managedByAppBotStatusText: String? = null, + /** Bounded public profile projection marker (`"channel_summary"`, `routes/agents.ts`). */ + val profileProjection: String? = null, /** External agents only: `lastSeenAt` — credential last-use; realtime `agent:seen` advances it (task #410). */ val lastSeenAt: String? = null, /** The typed kind behind [activityDetail] (`activityDetailKind`); null from older servers. */ diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/data/MemberAgentParser.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/data/MemberAgentParser.kt index a120c33325..a3b37a0e43 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/data/MemberAgentParser.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/data/MemberAgentParser.kt @@ -195,6 +195,8 @@ private data class WireAgent( * `computer_version_unsupported`; null otherwise. Additive: an unknown value is kept raw. */ val blockedReason: String? = null, + /** Bounded public projection marker (`"channel_summary"`, `routes/agents.ts`). */ + val profileProjection: String? = null, ) /** slock `projectAssistantPause` `assistantPausedBy`: `{ id, name }`. */ @@ -210,6 +212,8 @@ private data class WireManagedByApp( val clientId: String? = null, val name: String? = null, val logoUrl: String? = null, + val description: String? = null, + val botStatusText: String? = null, ) @Serializable @@ -1034,7 +1038,11 @@ private fun WireAgent.toMemberProfile(): MemberProfile { assistantOwnerUserId = assistantOwnerUserId?.trim()?.takeIf { it.isNotEmpty() }, managedByAppInstallId = managedByAppInstallId?.takeIf { it.isNotBlank() }, agentCreatorUserId = creatorId?.trim()?.takeIf { it.isNotEmpty() && creatorType == "user" }, + managedByAppClientId = managedByApp?.clientId?.trim()?.takeIf { it.isNotBlank() }, managedByAppName = managedByApp?.name?.takeIf { it.isNotBlank() }, + managedByAppLogoUrl = managedByApp?.logoUrl?.trim()?.takeIf { it.isNotBlank() }, + managedByAppBotStatusText = managedByApp?.botStatusText?.trim()?.takeIf { it.isNotBlank() }, + profileProjection = profileProjection?.trim()?.takeIf { it.isNotBlank() }, inMemberLists = inMemberLists, model = firstNonBlank(model, runtimeProfile?.current?.model), permissionBadges = listOfNotNull( diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentProfile.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentProfile.kt index 3c21c8f11f..d4a6604e00 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentProfile.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentProfile.kt @@ -442,6 +442,8 @@ internal fun MembersAgentProfileHeader( * identity-and-presence, the step links to the computer); null when there is none to open. */ onOpenComputer: (() -> Unit)? = null, + /** Opens an App bot's owning App installed detail (`?installed_app=`, slock #14286); null when unavailable. */ + onOpenManagedApp: (() -> Unit)? = null, /** * Web AgentDetailPanel: the status sits under the tags unless the profile shows the Recent * activity card, whose first line it is then ([MembersAgentProfileStatus]). @@ -523,16 +525,14 @@ internal fun MembersAgentProfileHeader( ) { val appBot = member.appBotIdentityOrNull() if (appBot != null) { - // botiverse/slock #11273 profile hero: an App Bot is a Bot from its App, - // not an "Agent", and runs on no runtime. + // botiverse/slock #11273 / #14286 profile hero: an App Bot is a Bot from its App, + // not an "Agent", and runs on no runtime; "From " links to App details. RaftAppBotBadge(identity = appBot, botName = appBot.appName) appBot.appName?.let { appName -> - RaftText( - text = stringResource(Res.string.member_label_app_from_app, appName), - style = typography.footnote, - color = colors.foregroundMuted, - maxLines = 1, - overflow = TextOverflow.Ellipsis, + RaftAppBotFromAppLine( + appName = appName, + logoUrl = appBot.appLogoUrl ?: summary?.managedByAppLogoUrl, + onOpenManagedApp = onOpenManagedApp, ) } } else { @@ -819,6 +819,8 @@ internal class MembersAgentLifecycleInputs( val onCopyText: (String) -> Unit = {}, val onReportIssue: () -> Unit = {}, val onOpenComputer: (() -> Unit)? = null, + /** Opens an App bot's owning App installed detail (`?installed_app=`, slock #14286); null when unavailable. */ + val onOpenManagedApp: (() -> Unit)? = null, /** Stop Current Turn on the "stuck on a tool call" notice; null when the viewer may not. */ val onStopTurn: (() -> Unit)? = null, val stopTurnInProgress: Boolean = false, @@ -1387,6 +1389,7 @@ private fun MembersAgentInfoSection( edit: MembersAgentProfileEditInputs, machineStatusRow: (machineId: String?) -> MembersMachineStatusRow, onOpenComputer: (() -> Unit)?, + onOpenManagedApp: (() -> Unit)? = null, timeContext: RaftTimeContext, memberAvatarResolver: RaftMemberAvatarResolver ) { @@ -1506,69 +1509,75 @@ private fun MembersAgentInfoSection( // stacks: one item per row, the label above its value. Order: Role, Computer, Computer // status, Computer Version, Created, Creator. MembersProfileSection(title = stringResource(Res.string.member_section_info)) { - // Role: the label carries the "Agent roles" help and, for whoever may change it, the pencil; - // the value is the plain role word (hidden role = empty value, web parity #261). - MembersAgentInfoField( - label = stringResource(Res.string.member_label_role), - labelActions = { - MembersProfileIconAction( - iconName = RaftLucideIconName.CircleQuestionMark, - contentDescription = stringResource(Res.string.member_title_agent_roles), - onClick = { roleHelpOpen = true } - ) - if (canEditServerRole && !editingServerRole) { - MembersProfilePencilButton( - contentDescription = stringResource(Res.string.member_action_edit_role), - onClick = { - serverRoleEditorAuthority = agentProfileEditAuthority + val isAppBot = !member.managedByAppInstallId.isNullOrBlank() || !summary?.managedByAppInstallId.isNullOrBlank() + // Role: web AgentProfileInfo hides server-role editing for an App bot (its authority is + // the App's grant, not a server role). + if (!isAppBot) { + // Role: the label carries the "Agent roles" help and, for whoever may change it, the pencil; + // the value is the plain role word (hidden role = empty value, web parity #261). + MembersAgentInfoField( + label = stringResource(Res.string.member_label_role), + labelActions = { + MembersProfileIconAction( + iconName = RaftLucideIconName.CircleQuestionMark, + contentDescription = stringResource(Res.string.member_title_agent_roles), + onClick = { roleHelpOpen = true } + ) + if (canEditServerRole && !editingServerRole) { + MembersProfilePencilButton( + contentDescription = stringResource(Res.string.member_action_edit_role), + onClick = { + serverRoleEditorAuthority = agentProfileEditAuthority + draftServerRole = currentServerRole ?: MembersAgentServerRole.Member + serverRoleError = null + serverRoleMenuExpanded = true + editingServerRole = true + } + ) + } + } + ) { + if (editingServerRole) { + val serverRoleLabels = MembersAgentServerRole.entries.associateWith { it.localizedLabel() } + MembersServerRoleEditor( + displayValue = draftServerRole.localizedLabel(), + expanded = serverRoleMenuExpanded, + enabled = !savingServerRole, + saving = savingServerRole, + saveEnabled = draftServerRole != currentServerRole, + options = membersAgentServerRoleOptions(draftServerRole) { serverRoleLabels.getValue(it) }, + selectedId = draftServerRole.wireValue, + error = serverRoleError, + onToggle = { serverRoleMenuExpanded = !serverRoleMenuExpanded }, + onSelect = { roleId -> + roleId.toMembersAgentServerRoleOrNull()?.let { nextRole -> + draftServerRole = nextRole + serverRoleMenuExpanded = false + serverRoleError = null + } + }, + onSave = { saveServerRole() }, + onCancel = { draftServerRole = currentServerRole ?: MembersAgentServerRole.Member serverRoleError = null - serverRoleMenuExpanded = true - editingServerRole = true + serverRoleMenuExpanded = false + editingServerRole = false } ) + } else { + MembersAgentServerRoleChip(serverRoleDisplay) } } - ) { - if (editingServerRole) { - val serverRoleLabels = MembersAgentServerRole.entries.associateWith { it.localizedLabel() } - MembersServerRoleEditor( - displayValue = draftServerRole.localizedLabel(), - expanded = serverRoleMenuExpanded, - enabled = !savingServerRole, - saving = savingServerRole, - saveEnabled = draftServerRole != currentServerRole, - options = membersAgentServerRoleOptions(draftServerRole) { serverRoleLabels.getValue(it) }, - selectedId = draftServerRole.wireValue, - error = serverRoleError, - onToggle = { serverRoleMenuExpanded = !serverRoleMenuExpanded }, - onSelect = { roleId -> - roleId.toMembersAgentServerRoleOrNull()?.let { nextRole -> - draftServerRole = nextRole - serverRoleMenuExpanded = false - serverRoleError = null - } - }, - onSave = { saveServerRole() }, - onCancel = { - draftServerRole = currentServerRole ?: MembersAgentServerRole.Member - serverRoleError = null - serverRoleMenuExpanded = false - editingServerRole = false - } - ) - } else { - MembersAgentServerRoleChip(serverRoleDisplay) + if (roleHelpOpen) { + MembersAgentRoleHelpDialog(onDismiss = { roleHelpOpen = false }) } } - if (roleHelpOpen) { - MembersAgentRoleHelpDialog(onDismiss = { roleHelpOpen = false }) - } MembersAgentComputerInfoRows( member = member, summary = summary, machineStatusRow = machineStatusRow, onOpenComputer = onOpenComputer, + onOpenManagedApp = onOpenManagedApp, timeContext = timeContext, memberAvatarResolver = memberAvatarResolver ) @@ -1703,6 +1712,7 @@ internal fun MembersAgentProfileTab( edit = edit, machineStatusRow = machineStatusRow, onOpenComputer = onOpenComputer, + onOpenManagedApp = lifecycle.onOpenManagedApp, timeContext = timeContext, memberAvatarResolver = memberAvatarResolver ) @@ -1824,6 +1834,7 @@ private fun MembersAgentProfileIdentity( onRetry = lifecycle.onRetryRestart, retryInProgress = lifecycle.retryRestartInProgress, onOpenComputer = lifecycle.onOpenComputer, + onOpenManagedApp = lifecycle.onOpenManagedApp, // With Recent activity the status is the card's first line (web). showStatus = recentActivity == null ) diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentRuntimeConfig.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentRuntimeConfig.kt index ef27b13646..dd6042d86e 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentRuntimeConfig.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersAgentRuntimeConfig.kt @@ -99,80 +99,94 @@ internal fun MembersAgentComputerInfoRows( machineStatusRow: (machineId: String?) -> MembersMachineStatusRow, onOpenComputer: (() -> Unit)?, timeContext: RaftTimeContext, - memberAvatarResolver: RaftMemberAvatarResolver + memberAvatarResolver: RaftMemberAvatarResolver, + onOpenManagedApp: (() -> Unit)? = null, ) { - // Truth source is the computers store, not `machineId != null` (task #259). - val statusRow = machineStatusRow(summary?.machineId) - val machineName = summary?.machineName?.takeIf { it.isNotBlank() } ?: member.membersComputerName - MembersAgentInfoField(label = stringResource(Res.string.member_label_computer)) { - when (statusRow) { - // artin: 甲 -- until the store has answered, the row has no value (web - // `agentMachineRow.kind === "pending" ? null`), so it cannot flash - // "No computer assigned" before flipping to the machine. - MembersMachineStatusRow.Loading -> Unit - // Web `text-foreground-hint` on the callout. - MembersMachineStatusRow.NoComputer -> - RaftText( - text = stringResource(Res.string.member_machine_no_computer_assigned), - style = membersInfoValueStyle(), - color = RaftTheme.colors.foregroundHint - ) - is MembersMachineStatusRow.Machine -> { - // Web: a `font-mono text-foreground` button that opens the computer, underlined on - // hover. Android has no hover, so the underline shows whenever it is tappable. - val machineNameStyle = - membersInfoValueStyle(mono = true).let { base -> - if (onOpenComputer != null) base.copy(textDecoration = TextDecoration.Underline) else base - } - RaftText( - text = machineName.orDash(), - style = machineNameStyle, - color = RaftTheme.colors.foreground, - // No maxLines/ellipsis on purpose: truncating a machine name hides exactly - // the part that distinguishes two similar hosts; it wraps instead. - softWrap = true, - // Long press copies the name; a tap still opens the computer. - modifier = Modifier - .raftCopyable(machineName?.takeIf { it.isNotBlank() }, onClick = onOpenComputer) - .fillMaxWidth() + val appBotIdentity = + member.appBotIdentityOrNull() + ?: summary?.managedByAppInstallId?.trim()?.takeIf { it.isNotEmpty() }?.let { + RaftAppBotIdentity( + handle = member.handle, + appName = summary.managedByAppName?.trim()?.takeIf { name -> name.isNotEmpty() }, + removed = !summary.deletedAt.isNullOrBlank() || member.inMemberLists == false, + appClientId = summary.managedByAppClientId?.trim()?.takeIf { id -> id.isNotEmpty() }, + appLogoUrl = summary.managedByAppLogoUrl?.trim()?.takeIf { url -> url.isNotEmpty() }, ) } + if (appBotIdentity == null) { + // Truth source is the computers store, not `machineId != null` (task #259). + val statusRow = machineStatusRow(summary?.machineId) + val machineName = summary?.machineName?.takeIf { it.isNotBlank() } ?: member.membersComputerName + MembersAgentInfoField(label = stringResource(Res.string.member_label_computer)) { + when (statusRow) { + // artin: 甲 -- until the store has answered, the row has no value (web + // `agentMachineRow.kind === "pending" ? null`), so it cannot flash + // "No computer assigned" before flipping to the machine. + MembersMachineStatusRow.Loading -> Unit + // Web `text-foreground-hint` on the callout. + MembersMachineStatusRow.NoComputer -> + RaftText( + text = stringResource(Res.string.member_machine_no_computer_assigned), + style = membersInfoValueStyle(), + color = RaftTheme.colors.foregroundHint + ) + is MembersMachineStatusRow.Machine -> { + // Web: a `font-mono text-foreground` button that opens the computer, underlined on + // hover. Android has no hover, so the underline shows whenever it is tappable. + val machineNameStyle = + membersInfoValueStyle(mono = true).let { base -> + if (onOpenComputer != null) base.copy(textDecoration = TextDecoration.Underline) else base + } + RaftText( + text = machineName.orDash(), + style = machineNameStyle, + color = RaftTheme.colors.foreground, + // No maxLines/ellipsis on purpose: truncating a machine name hides exactly + // the part that distinguishes two similar hosts; it wraps instead. + softWrap = true, + // Long press copies the name; a tap still opens the computer. + modifier = Modifier + .raftCopyable(machineName?.takeIf { it.isNotBlank() }, onClick = onOpenComputer) + .fillMaxWidth() + ) + } + } } - } - if (statusRow is MembersMachineStatusRow.Machine) { - // web `agent-computer-connection`: "Computer status", not "Status" -- the hero already - // shows the agent's own activity. (Status md, 10px) then the word. - MembersAgentInfoField(label = stringResource(Res.string.member_label_computer_status)) { - Row( - horizontalArrangement = Arrangement.spacedBy(MembersInfoStatusGapX), - verticalAlignment = Alignment.CenterVertically + if (statusRow is MembersMachineStatusRow.Machine) { + // web `agent-computer-connection`: "Computer status", not "Status" -- the hero already + // shows the agent's own activity. (Status md, 10px) then the word. + MembersAgentInfoField(label = stringResource(Res.string.member_label_computer_status)) { + Row( + horizontalArrangement = Arrangement.spacedBy(MembersInfoStatusGapX), + verticalAlignment = Alignment.CenterVertically + ) { + RaftStatusDot( + presence = if (statusRow.online) RaftPresence.Online else RaftPresence.Offline, + size = RaftStatusSize.Md + ) + RaftText( + text = stringResource( + if (statusRow.online) Res.string.member_label_connected else Res.string.member_label_offline + ), + style = membersInfoValueStyle(), + color = RaftTheme.colors.foreground + ) + } + } + // web `agent-computer-version` (#14585): the version only, "v1.0.53"; "—" while the + // Computer is offline or reports none. Whether it is online is the row above. + val runLabel = membersAgentComputerVersionText(statusRow.runLabel) + MembersAgentInfoField( + label = stringResource(Res.string.settings_computers_label_version), + copyText = runLabel ) { - RaftStatusDot( - presence = if (statusRow.online) RaftPresence.Online else RaftPresence.Offline, - size = RaftStatusSize.Md - ) RaftText( - text = stringResource( - if (statusRow.online) Res.string.member_label_connected else Res.string.member_label_offline - ), - style = membersInfoValueStyle(), + text = runLabel, + style = membersInfoValueStyle(mono = true), color = RaftTheme.colors.foreground ) } } - // web `agent-computer-version` (#14585): the version only, "v1.0.53"; "—" while the - // Computer is offline or reports none. Whether it is online is the row above. - val runLabel = membersAgentComputerVersionText(statusRow.runLabel) - MembersAgentInfoField( - label = stringResource(Res.string.settings_computers_label_version), - copyText = runLabel - ) { - RaftText( - text = runLabel, - style = membersInfoValueStyle(mono = true), - color = RaftTheme.colors.foreground - ) - } } summary?.createdAt.membersLocalizedCreatedDateOrNull(timeContext)?.let { createdDate -> MembersAgentInfoField(label = stringResource(Res.string.member_label_created), copyText = createdDate) { @@ -186,6 +200,28 @@ internal fun MembersAgentComputerInfoRows( ) } } + if (appBotIdentity != null) { + // Web AgentProfileInfo (botiverse/slock #14286): an App bot's owning App IS its identity + // (logo + App badge + name, linking to App details when eligible), followed by any + // app-published status line. + val botStatusText = + (summary?.managedByAppBotStatusText ?: member.managedByAppBotStatusText)?.trim()?.takeIf { it.isNotEmpty() } + MembersAgentInfoField(label = stringResource(Res.string.profile_preview_managed_by_app)) { + RaftManagedByAppRowValue( + identity = appBotIdentity, + onOpenManagedApp = onOpenManagedApp, + ) + if (botStatusText != null) { + RaftText( + text = botStatusText, + style = RaftTheme.typography.caption, + color = RaftTheme.colors.foregroundMuted, + modifier = Modifier.padding(top = 4.dp), + ) + } + } + return + } // Creator value stays a clickable identity chip (web opens the profile). val creatorProfile = summary?.creator?.toStrictMemberProfile() MembersAgentInfoField(label = stringResource(Res.string.member_label_creator), copyText = creatorProfile?.displayName) { diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailContent.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailContent.kt index c6d2ad7e4b..939794742c 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailContent.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailContent.kt @@ -267,6 +267,8 @@ internal class MembersDetailActions( /** A Message tap waits on the server: the button shows its loading state. */ val directMessageOpening: Boolean = false, val onOpenComputer: (() -> Unit)? = null, + /** Opens an App bot's owning App installed detail (`?installed_app=`, slock #14286); null when unavailable. */ + val onOpenManagedApp: (() -> Unit)? = null, val onCopyMemberId: () -> Unit, val onRemoveMember: (() -> Unit)? = null, /** Promote to server member, for a Guest an owner/admin may make a member (web HumanProfileActions). */ @@ -1257,6 +1259,7 @@ internal fun MembersDetailContent( onCopyText = { text -> agentDetailActions?.copyDiagnostics(text) ?: Unit }, onReportIssue = { openReportIssue() }, onOpenComputer = onOpenComputer, + onOpenManagedApp = actions.onOpenManagedApp, onStopTurn = profileStopTurn, stopTurnInProgress = turnStopState.inFlightAgentId != null, showActivityDetail = canViewPrivate, diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailPage.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailPage.kt index 5fe01e8056..648c78cbf2 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailPage.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersDetailPage.kt @@ -937,6 +937,23 @@ internal fun MemberDetailPageContent( ) } } + val managedAppDetailTarget = + membersManagedAppDetailTarget( + member = member, + summary = selectedAgentDetail.summary, + viewerServerRole = current.server.role, + currentServerId = activeServerId ?: current.server.id.value, + accessMode = current.accessMode, + ) + val onOpenManagedApp: (() -> Unit)? = + managedAppDetailTarget?.let { target -> + { + pager.openSettingsMarketplacePage( + storeScope = provider.storeScope, + installedAppId = target.appId, + ) + } + } val agentRuntimeModelsByRuntime = agentMachineId ?.let { machineId -> @@ -1226,6 +1243,7 @@ internal fun MemberDetailPageContent( } }, onOpenComputer = onOpenComputer, + onOpenManagedApp = onOpenManagedApp, onCopyMemberId = { provider.copyMemberId(member, memberIdCopied) }, diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersStatusFormatting.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersStatusFormatting.kt index f6e53fb326..797ceaa0ab 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersStatusFormatting.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/MembersStatusFormatting.kt @@ -411,6 +411,12 @@ internal fun AgentDetailSnapshot.toStaticMembersProfile(server: ServerSummary): agentStatus = null, // Detail summaries carry the runtime sentinel only (no projected boolean). isExternal = isExternalAgentRuntime(summary?.runtime), + managedByAppInstallId = summary?.managedByAppInstallId?.takeIf { it.isNotBlank() }, + managedByAppClientId = summary?.managedByAppClientId?.takeIf { it.isNotBlank() }, + managedByAppName = summary?.managedByAppName?.takeIf { it.isNotBlank() }, + managedByAppLogoUrl = summary?.managedByAppLogoUrl?.takeIf { it.isNotBlank() }, + managedByAppBotStatusText = summary?.managedByAppBotStatusText?.takeIf { it.isNotBlank() }, + profileProjection = summary?.profileProjection?.takeIf { it.isNotBlank() }, permissionBadges = listOfNotNull( summary?.runtime?.takeIf { it.isNotBlank() }, summary?.machineName?.takeIf { it.isNotBlank() }?.let { "computer:$it" }, @@ -430,7 +436,13 @@ internal fun AgentDetailSnapshot.withMemberProfileProjection(member: MemberProfi displayName = member.displayName.ifBlank { fallbackName }, description = member.description?.takeIf { it.isNotBlank() }, runtime = member.roleDescription ?: summary?.runtime, - avatarUrl = member.avatar?.wireValue ?: summary?.avatarUrl + avatarUrl = member.avatar?.wireValue ?: summary?.avatarUrl, + managedByAppInstallId = member.managedByAppInstallId ?: summary?.managedByAppInstallId, + managedByAppClientId = member.managedByAppClientId ?: summary?.managedByAppClientId, + managedByAppName = member.managedByAppName ?: summary?.managedByAppName, + managedByAppLogoUrl = member.managedByAppLogoUrl ?: summary?.managedByAppLogoUrl, + managedByAppBotStatusText = member.managedByAppBotStatusText ?: summary?.managedByAppBotStatusText, + profileProjection = member.profileProjection ?: summary?.profileProjection, ) return copy(summary = nextSummary) } diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/members/RaftAppBot.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/members/RaftAppBot.kt index 0bb1145196..f9afb36aab 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/members/RaftAppBot.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/members/RaftAppBot.kt @@ -1,15 +1,39 @@ package build.raft.app import build.raft.app.resources.* +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.interaction.collectIsHoveredAsState +import androidx.compose.foundation.interaction.collectIsPressedAsState +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import build.raft.app.data.AgentDetailSummary import build.raft.app.data.SharedServerMembersStore import build.raft.app.model.MemberKind import build.raft.app.model.MemberProfile @@ -17,6 +41,11 @@ import build.raft.app.model.ServerId import build.raft.designsystem.components.RaftBadge import build.raft.designsystem.components.RaftBadgeAppearance import build.raft.designsystem.components.RaftBadgeVariant +import build.raft.designsystem.components.RaftHoverTier +import build.raft.designsystem.components.raftClickable +import build.raft.designsystem.text.RaftText +import build.raft.designsystem.theme.RaftTheme +import coil3.compose.AsyncImagePainter import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flowOf @@ -40,6 +69,10 @@ internal data class RaftAppBotIdentity( val appName: String?, /** Web `isRemovedAppBot`: removed from the server (or deleted), so it cannot answer. */ val removed: Boolean, + /** The owning App's row id (`managedByApp.clientId` = `oauth_clients.id`, slock #14286). */ + val appClientId: String? = null, + /** The owning App's logo URL (`managedByApp.logoUrl`, slock #14286). */ + val appLogoUrl: String? = null, ) /** The App Bot identity of a directory profile; null for humans and ordinary agents. */ @@ -49,9 +82,252 @@ internal fun MemberProfile.appBotIdentityOrNull(): RaftAppBotIdentity? { handle = handle, appName = managedByAppName?.trim()?.takeIf { it.isNotBlank() }, removed = !agentDeletedAt.isNullOrBlank() || inMemberLists == false, + appClientId = managedByAppClientId?.trim()?.takeIf { it.isNotBlank() }, + appLogoUrl = managedByAppLogoUrl?.trim()?.takeIf { it.isNotBlank() }, ) } +/** + * An App bot profile's link target to its owning App's installed detail on the Apps page + * (`?installed_app=`, botiverse/slock #14286 `useManagedAppDetailLink`). + */ +@Immutable +internal data class MembersManagedAppDetailTarget( + /** The App's row id (`managedByApp.clientId` = `oauth_clients.id`), never its public `client_id`. */ + val appId: String, + val appName: String, +) + +/** + * Web `useManagedAppDetailLink` (botiverse/slock #14286): returns the App detail target when the + * viewer can open this server's installed App detail; null for guests, another server's bot in a + * joint channel, bounded public projections (`channel_summary`), or missing App row id/name. + */ +internal fun membersManagedAppDetailTarget( + member: MemberProfile, + summary: AgentDetailSummary? = null, + viewerServerRole: String?, + currentServerId: String?, + accessMode: MemberDetailAccessMode = MemberDetailAccessMode.LocalFull, +): MembersManagedAppDetailTarget? { + if (accessMode != MemberDetailAccessMode.LocalFull) return null + val installId = + (summary?.managedByAppInstallId ?: member.managedByAppInstallId)?.trim()?.takeIf { it.isNotEmpty() } + ?: return null + if (installId.isEmpty()) return null + val appId = + (summary?.managedByAppClientId ?: member.managedByAppClientId)?.trim()?.takeIf { it.isNotEmpty() } + ?: return null + val appName = + (summary?.managedByAppName ?: member.managedByAppName)?.trim()?.takeIf { it.isNotEmpty() } + ?: return null + val role = viewerServerRole?.trim()?.lowercase()?.takeIf { it.isNotEmpty() } ?: return null + if (role == "guest") return null + val activeServer = currentServerId?.trim()?.takeIf { it.isNotEmpty() } + val agentServer = member.serverId?.value?.trim()?.takeIf { it.isNotEmpty() } + if (activeServer != null && agentServer != null && agentServer != activeServer) return null + val projection = (summary?.profileProjection ?: member.profileProjection)?.trim()?.lowercase() + if (projection == "channel_summary") return null + return MembersManagedAppDetailTarget(appId = appId, appName = appName) +} + +private const val ManagedAppFromPlaceholder = "\u0000" + +/** Splits a formatted `"From "` template into `(before, after)` text fragments. */ +internal fun membersManagedAppFromParts( + formatted: String, + placeholder: String = ManagedAppFromPlaceholder, +): Pair { + val index = formatted.indexOf(placeholder) + if (index < 0) return formatted.trim() to "" + val before = formatted.substring(0, index).trimEnd() + val after = formatted.substring(index + placeholder.length).trimStart() + return before to after +} + +/** Web `ManagedAppIdentity` `AppLogo`: 16dp rounded-sm logo, omitted when absent or broken. */ +@Composable +internal fun RaftManagedAppLogo(logoUrl: String?) { + val cleanUrl = logoUrl?.trim()?.takeIf { it.isNotEmpty() } ?: return + var broken by remember(cleanUrl) { mutableStateOf(false) } + if (broken) return + Box( + modifier = Modifier.size(16.dp).clip(RoundedCornerShape(2.dp)), + contentAlignment = Alignment.Center, + ) { + RaftCachedImage( + source = cleanUrl, + contentDescription = null, + modifier = Modifier.fillMaxSize(), + contentScale = ContentScale.Crop, + onImageStateChange = { state -> if (state is AsyncImagePainter.State.Error) broken = true }, + ) + } +} + +@Composable +private fun RaftManagedAppIdentityRow( + openAppDetailsLabel: String?, + onOpenManagedApp: (() -> Unit)?, + testTag: String, + spacing: Dp, + modifier: Modifier = Modifier, + content: @Composable RowScope.(linked: Boolean, active: Boolean) -> Unit, +) { + val click = onOpenManagedApp + val label = openAppDetailsLabel?.takeIf { it.isNotBlank() } + if (click == null || label == null) { + Row( + modifier = modifier, + horizontalArrangement = Arrangement.spacedBy(spacing), + verticalAlignment = Alignment.CenterVertically, + ) { + content(false, false) + } + return + } + val interactionSource = remember { MutableInteractionSource() } + val pressed by interactionSource.collectIsPressedAsState() + val hovered by interactionSource.collectIsHoveredAsState() + val active = pressed || hovered + Row( + modifier = + modifier + .testTag(testTag) + .raftClickable( + onClick = click, + role = Role.Button, + shape = RoundedCornerShape(RaftAppRadius.Chip), + tier = RaftHoverTier.None, + interactionSource = interactionSource, + ) + .semantics(mergeDescendants = true) { + contentDescription = label + }, + horizontalArrangement = Arrangement.spacedBy(spacing), + verticalAlignment = Alignment.CenterVertically, + ) { + content(true, active) + } +} + +/** + * Web `AppBotFromApp` (botiverse/slock #14286): the profile hero's `"From "` after the + * App badge, linking to the App's installed detail when [onOpenManagedApp] is provided. + */ +@Composable +internal fun RaftAppBotFromAppLine( + appName: String, + logoUrl: String?, + onOpenManagedApp: (() -> Unit)?, + modifier: Modifier = Modifier, +) { + val colors = RaftTheme.colors + val typography = RaftTheme.typography + val formatted = stringResource(Res.string.member_label_app_from_app, ManagedAppFromPlaceholder) + val (before, after) = remember(formatted) { membersManagedAppFromParts(formatted) } + val openLabel = + if (onOpenManagedApp != null) { + stringResource(Res.string.member_detail_open_app_details, appName) + } else { + null + } + Row( + modifier = modifier.testTag("agent-profile-bot-from-app"), + horizontalArrangement = Arrangement.spacedBy(4.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + if (before.isNotEmpty()) { + RaftText( + text = before, + style = typography.footnote, + color = colors.foregroundMuted, + maxLines = 1, + ) + } + RaftManagedAppIdentityRow( + openAppDetailsLabel = openLabel, + onOpenManagedApp = onOpenManagedApp, + testTag = "agent-profile-bot-from-app-link", + spacing = 4.dp, + ) { linked, active -> + RaftManagedAppLogo(logoUrl) + RaftText( + text = appName, + style = + typography.footnote.let { base -> + if (linked) { + base.copy( + fontWeight = FontWeight.SemiBold, + textDecoration = if (active) TextDecoration.Underline else TextDecoration.None, + ) + } else { + base + } + }, + color = colors.foreground, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + } + if (after.isNotEmpty()) { + RaftText( + text = after, + style = typography.footnote, + color = colors.foregroundMuted, + maxLines = 1, + ) + } + } +} + +/** + * Web `ManagedByAppValue` (botiverse/slock #14286): the `"Managed by app"` row's value + * (`logo + App badge + name`), as one link to the App's detail when [onOpenManagedApp] is set. + */ +@Composable +internal fun RaftManagedByAppRowValue( + identity: RaftAppBotIdentity, + onOpenManagedApp: (() -> Unit)?, + modifier: Modifier = Modifier, +) { + val appName = identity.appName + val openLabel = + if (onOpenManagedApp != null && !appName.isNullOrBlank()) { + stringResource(Res.string.member_detail_open_app_details, appName) + } else { + null + } + RaftManagedAppIdentityRow( + openAppDetailsLabel = openLabel, + onOpenManagedApp = onOpenManagedApp?.takeIf { !appName.isNullOrBlank() }, + testTag = "agent-profile-managed-by-app-link", + spacing = 6.dp, + modifier = modifier, + ) { linked, active -> + RaftManagedAppLogo(identity.appLogoUrl) + RaftAppBotBadge(identity = identity, botName = appName) + RaftText( + text = appName ?: stringResource(Res.string.profile_preview_unknown_app), + style = + membersInfoValueStyle().let { base -> + if (linked) { + base.copy( + fontWeight = FontWeight.SemiBold, + textDecoration = if (active) TextDecoration.Underline else TextDecoration.None, + ) + } else { + base + } + }, + color = RaftTheme.colors.foreground, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f, fill = false), + ) + } +} + /** * Whether the Members page lists this profile (web `isAgentInMemberLists` for #11295): an App Bot * the server marks `inMemberLists: false` is left out. Everything else keeps today's behaviour. diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/model/RaftModels.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/model/RaftModels.kt index 1e077d310c..0ef9620b51 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/model/RaftModels.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/model/RaftModels.kt @@ -536,11 +536,25 @@ data class MemberProfile( * row menu reads it for the creator's rights (web `canViewAgentPrivateSurfaces`). */ val agentCreatorUserId: String? = null, + /** + * App Bots only: the owning App's row id (`managedByApp.clientId`, which is `oauth_clients.id`, + * NOT public `client_id`; botiverse/slock #14286). Used for `?installed_app=` links. + */ + val managedByAppClientId: String? = null, /** * App Bots only: the owning App's name (`managedByApp.name` on `GET /agents` and * `GET /agents/:id`, botiverse/slock #11273). Web `AppBadge` reads it for "App · ". */ val managedByAppName: String? = null, + /** App Bots only: the owning App's logo URL (`managedByApp.logoUrl`, botiverse/slock #14286). */ + val managedByAppLogoUrl: String? = null, + /** App Bots only: the app-published status line (`managedByApp.botStatusText`). */ + val managedByAppBotStatusText: String? = null, + /** + * Bounded public profile projection marker (`profileProjection`, e.g. `"channel_summary"` on + * server `routes/agents.ts`); null for full profiles. + */ + val profileProjection: String? = null, /** * App Bots only: `inMemberLists` from the agent directory (botiverse/slock #11295). `false` * while the Bot is removed from this server: member lists leave it out and its DM is diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsMarketplacePage.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsMarketplacePage.kt index b734607158..42b25ade80 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsMarketplacePage.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsMarketplacePage.kt @@ -1,10 +1,19 @@ package build.raft.app import build.raft.app.data.StoredAuthSession +import build.raft.app.data.percentEncode import build.raft.app.compat.pager.Pager -internal fun Pager.openSettingsMarketplacePage(storeScope: build.raft.app.data.RaftShellStoreScope) { - openSettingsWebViewPage(SettingsWebViewSurface.Marketplace, storeScope) +internal fun Pager.openSettingsMarketplacePage( + storeScope: build.raft.app.data.RaftShellStoreScope, + /** An App bot's owning App row id (`?installed_app=`, botiverse/slock #14286). */ + installedAppId: String? = null, +) { + openSettingsWebViewPage( + surface = SettingsWebViewSurface.Marketplace, + storeScope = storeScope, + installedAppId = installedAppId, + ) } internal val settingsMarketplaceWebViewSpec = @@ -13,9 +22,19 @@ internal val settingsMarketplaceWebViewSpec = buildWebUrl = { webBaseUrl, session, _ -> settingsMarketplaceWebViewUrl(webBaseUrl, session) }, ) +internal fun settingsMarketplaceWebViewSpec(installedAppId: String? = null): StandaloneSettingsWebViewSpec { + val cleanId = installedAppId?.trim()?.takeIf { it.isNotEmpty() } ?: return settingsMarketplaceWebViewSpec + return settingsMarketplaceWebViewSpec.copy( + buildWebUrl = { webBaseUrl, session, _ -> + settingsMarketplaceWebViewUrl(webBaseUrl, session, installedAppId = cleanId) + }, + ) +} + internal fun settingsMarketplaceWebViewUrl( webBaseUrl: String?, - session: StoredAuthSession? + session: StoredAuthSession?, + installedAppId: String? = null, ): String { val serverSlug = standaloneSettingsServerSlug(session) val path = @@ -23,5 +42,11 @@ internal fun settingsMarketplaceWebViewUrl( ?.takeIf { it.isNotBlank() } ?.let { "s/$it/settings/integrations" } ?: "settings/integrations" - return sharedSettingsHostShellWebUrl(webBaseUrl, path) + val extraQueryParameters = + installedAppId + ?.trim() + ?.takeIf { it.isNotEmpty() } + ?.let { listOf("installed_app" to it.percentEncode()) } + ?: emptyList() + return sharedSettingsHostShellWebUrl(webBaseUrl, path, extraQueryParameters) } diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsStandaloneWebViewHost.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsStandaloneWebViewHost.kt index 10982cc580..3869772b16 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsStandaloneWebViewHost.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/settings/SettingsStandaloneWebViewHost.kt @@ -53,6 +53,7 @@ import build.raft.app.compat.pager.Pager const val SETTINGS_WEB_VIEW_PAGE = "compose_settings_webview" internal const val SETTINGS_WEB_VIEW_SURFACE = "settingsWebViewSurface" internal const val SETTINGS_WEB_VIEW_VERSION_CODE = "versionCode" +internal const val SETTINGS_WEB_VIEW_INSTALLED_APP_ID = "installedAppId" @Page(SETTINGS_WEB_VIEW_PAGE, supportInLocal = true) internal class ComposeSettingsWebViewPage : AuthenticatedProductPager(AuthenticatedProductRoute.SettingsWebView) { @@ -68,6 +69,8 @@ internal fun settingsWebViewPageData( versionCode: String = "", /** A search result's setting: the web page opens at `#` (Billing, Administration). */ anchor: SettingsSearchAnchorRequest? = null, + /** An App bot's owning App row id (`?installed_app=`, botiverse/slock #14286). */ + installedAppId: String? = null, ): JSONObject = JSONObject().apply { put("pageName", SETTINGS_WEB_VIEW_PAGE) @@ -80,8 +83,16 @@ internal fun settingsWebViewPageData( put(SETTINGS_WEB_VIEW_VERSION_CODE, it) } } + if (surface == SettingsWebViewSurface.Marketplace) { + installedAppId?.trim()?.takeIf { it.isNotEmpty() }?.let { + put(SETTINGS_WEB_VIEW_INSTALLED_APP_ID, it) + } + } } +internal fun settingsInstalledAppIdFromPageData(params: JSONObject): String? = + params.optString(SETTINGS_WEB_VIEW_INSTALLED_APP_ID).trim().takeIf { it.isNotEmpty() } + internal fun settingsWebViewSurfaceFromPageData(params: JSONObject): SettingsWebViewSurface? { val surfaceName = params.optString(SETTINGS_WEB_VIEW_SURFACE).trim() return SettingsWebViewSurface.entries.firstOrNull { it.diagnosticsName == surfaceName } @@ -92,10 +103,11 @@ internal fun Pager.openSettingsWebViewPage( storeScope: build.raft.app.data.RaftShellStoreScope, versionCode: String = "", anchor: SettingsSearchAnchorRequest? = null, + installedAppId: String? = null, ) { acquireModule(RouterModule.MODULE_NAME).openPage( SETTINGS_WEB_VIEW_PAGE, - settingsWebViewPageData(surface, storeScope, versionCode, anchor), + settingsWebViewPageData(surface, storeScope, versionCode, anchor, installedAppId), ) } @@ -183,13 +195,16 @@ private fun SettingsWebViewScreen() { ) SettingsBillingOpenTarget.ViewOnly -> SettingsBillingViewOnlyPage(pager) } - SettingsWebViewSurface.Marketplace -> + SettingsWebViewSurface.Marketplace -> { + val installedAppId = + remember(pager.pageData.params) { settingsInstalledAppIdFromPageData(pager.pageData.params) } StandaloneSettingsWebViewPage( pager = pager, title = stringResource(Res.string.settings_connected_apps_title), iconName = RaftLucideIconName.Link2, - spec = settingsMarketplaceWebViewSpec, + spec = remember(installedAppId) { settingsMarketplaceWebViewSpec(installedAppId) }, ) + } SettingsWebViewSurface.Administration -> StandaloneSettingsWebViewPage( pager = pager, diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt new file mode 100644 index 0000000000..4a1af5af97 --- /dev/null +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt @@ -0,0 +1,212 @@ +package build.raft.app + +import build.raft.app.data.AgentDetailSnapshot +import build.raft.app.data.AgentDetailSummary +import build.raft.app.data.parseSharedSettingsAgentsAsMembers +import build.raft.app.model.MemberId +import build.raft.app.model.MemberKind +import build.raft.app.model.MemberProfile +import build.raft.app.model.ServerId +import build.raft.app.model.ServerSummary +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +/** + * Contract tests for App bot profile App-detail links (botiverse/slock #14286): + * - Wire decoding carries `managedByApp.clientId` (the App row id `oauth_clients.id`, NOT public + * `client_id`), `logoUrl`, `botStatusText`, and `profileProjection`. + * - [membersManagedAppDetailTarget] matches web `useManagedAppDetailLink`: enabled for non-guest + * viewers on the bot's own server with a full profile; null for guests, another server's bot in + * a joint channel, bounded `channel_summary` projections, or missing App attribution. + * - [membersManagedAppFromParts] splits localized `"From %1$s"` templates cleanly. + */ +class ManagedAppDetailLinkTest { + @Test + fun agentsDirectoryParserExtractsManagedAppRowIdLogoStatusAndProjection() { + val members = + parseSharedSettingsAgentsAsMembers( + """ + [ + { + "id":"agent-stamp", + "serverId":"srv-1", + "name":"stamp", + "displayName":"Stamp", + "status":"active", + "runtime":"external", + "managedByAppInstallId":"install-1", + "managedByApp":{ + "clientId":"stamp-row-id", + "name":"Stamp", + "logoUrl":"https://cdn.example.test/stamp.png", + "description":"Code review", + "botStatusText":"Watching 3 repos" + } + }, + { + "id":"agent-bounded", + "serverId":"srv-1", + "name":"bounded-bot", + "status":"active", + "runtime":"external", + "managedByAppInstallId":"install-2", + "profileProjection":"channel_summary", + "managedByApp":{ + "clientId":"app-row-2", + "name":"Vault", + "logoUrl":null + } + } + ] + """.trimIndent(), + ) + + assertNotNull(members) + val stamp = members.single { it.id.value == "agent-stamp" } + assertEquals("install-1", stamp.managedByAppInstallId) + assertEquals("stamp-row-id", stamp.managedByAppClientId) + assertEquals("Stamp", stamp.managedByAppName) + assertEquals("https://cdn.example.test/stamp.png", stamp.managedByAppLogoUrl) + assertEquals("Watching 3 repos", stamp.managedByAppBotStatusText) + assertNull(stamp.profileProjection) + + val identity = stamp.appBotIdentityOrNull() + assertNotNull(identity) + assertEquals("stamp-row-id", identity.appClientId) + assertEquals("https://cdn.example.test/stamp.png", identity.appLogoUrl) + + val bounded = members.single { it.id.value == "agent-bounded" } + assertEquals("channel_summary", bounded.profileProjection) + assertNull(bounded.managedByAppLogoUrl) + } + + @Test + fun detailSnapshotToStaticMembersProfilePreservesManagedAppAttribution() { + val snapshot = + AgentDetailSnapshot( + agentId = MemberId("agent-stamp"), + summary = + AgentDetailSummary( + id = "agent-stamp", + name = "stamp", + displayName = "Stamp", + runtime = "external", + managedByAppInstallId = "install-1", + managedByAppClientId = "stamp-row-id", + managedByAppName = "Stamp", + managedByAppLogoUrl = "https://cdn.example.test/stamp.png", + managedByAppBotStatusText = "Ready", + profileProjection = null, + ), + ) + val profile = snapshot.toStaticMembersProfile(ServerSummary(id = ServerId("srv-1"), name = "Launch", slug = "launch")) + + assertEquals("install-1", profile.managedByAppInstallId) + assertEquals("stamp-row-id", profile.managedByAppClientId) + assertEquals("Stamp", profile.managedByAppName) + assertEquals("https://cdn.example.test/stamp.png", profile.managedByAppLogoUrl) + assertEquals("Ready", profile.managedByAppBotStatusText) + } + + @Test + fun linkTargetEnabledForNonGuestOnOwnServerFullProfile() { + val bot = appBotMember(serverId = "srv-1") + + for (role in listOf("owner", "admin", "member")) { + val target = + membersManagedAppDetailTarget( + member = bot, + viewerServerRole = role, + currentServerId = "srv-1", + accessMode = MemberDetailAccessMode.LocalFull, + ) + assertEquals(MembersManagedAppDetailTarget(appId = "stamp-row-id", appName = "Stamp"), target, role) + } + } + + @Test + fun linkTargetNullForGuestUnknownRoleRemoteJointOrBoundedProjection() { + val bot = appBotMember(serverId = "srv-1") + + assertNull( + membersManagedAppDetailTarget( + member = bot, + viewerServerRole = "guest", + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot, + viewerServerRole = null, + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot, + viewerServerRole = "member", + currentServerId = "srv-1", + accessMode = MemberDetailAccessMode.RemoteProfileOnly, + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = appBotMember(serverId = "srv-other"), + viewerServerRole = "member", + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot.copy(profileProjection = "channel_summary"), + viewerServerRole = "member", + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot.copy(managedByAppClientId = null), + viewerServerRole = "member", + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot.copy(managedByAppName = null), + viewerServerRole = "member", + currentServerId = "srv-1", + ), + ) + assertNull( + membersManagedAppDetailTarget( + member = bot.copy(managedByAppInstallId = null), + viewerServerRole = "member", + currentServerId = "srv-1", + ), + ) + } + + @Test + fun fromAppTemplateSplitsCleanlyAroundPlaceholder() { + assertEquals("From" to "", membersManagedAppFromParts("From \u0000")) + assertEquals("来自" to "", membersManagedAppFromParts("来自 \u0000")) + assertEquals("提供元:" to "", membersManagedAppFromParts("提供元: \u0000")) + assertEquals("By" to "app", membersManagedAppFromParts("By \u0000 app")) + } + + private fun appBotMember(serverId: String) = + MemberProfile( + id = MemberId("agent-stamp"), + displayName = "Stamp", + handle = "stamp", + kind = MemberKind.Agent, + serverId = ServerId(serverId), + managedByAppInstallId = "install-1", + managedByAppClientId = "stamp-row-id", + managedByAppName = "Stamp", + managedByAppLogoUrl = "https://cdn.example.test/stamp.png", + ) +} diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/SettingsMarketplaceWebViewTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/SettingsMarketplaceWebViewTest.kt index 87f6a4d228..b4768475b1 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/SettingsMarketplaceWebViewTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/SettingsMarketplaceWebViewTest.kt @@ -1,5 +1,6 @@ package build.raft.app +import build.raft.app.data.RaftShellStoreScope import build.raft.app.data.StoredAuthServer import build.raft.app.data.StoredAuthSession import build.raft.app.data.StoredAuthUser @@ -7,6 +8,7 @@ import kotlin.test.Test import kotlin.test.assertContains import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertNull class SettingsMarketplaceWebViewTest { @Test @@ -19,6 +21,44 @@ class SettingsMarketplaceWebViewTest { ) } + @Test + fun marketplaceUrlCarriesInstalledAppQueryWhenProvided() { + val session = marketplaceSession() + + assertEquals( + "https://app.raft.build/s/workspace/settings/integrations?embed=raft-settings-v1&shell=host&installed_app=stamp-app", + settingsMarketplaceWebViewUrl("https://app.raft.build/", session, installedAppId = "stamp-app") + ) + assertEquals( + "https://app.raft.build/s/workspace/settings/integrations?embed=raft-settings-v1&shell=host&installed_app=app%2F1%26b%3D2", + settingsMarketplaceWebViewUrl("https://app.raft.build/", session, installedAppId = " app/1&b=2 ") + ) + assertEquals( + "https://app.raft.build/s/workspace/settings/integrations?embed=raft-settings-v1&shell=host", + settingsMarketplaceWebViewUrl("https://app.raft.build/", session, installedAppId = " ") + ) + } + + @Test + fun marketplacePageDataRoundTripsInstalledAppIdOnlyOnMarketplaceSurface() { + val scope = RaftShellStoreScope.create(shellInstanceId = "shell-apps", initialServerId = "server-1") + val marketplaceData = + settingsWebViewPageData( + surface = SettingsWebViewSurface.Marketplace, + storeScope = scope, + installedAppId = " stamp-row-id ", + ) + assertEquals("stamp-row-id", settingsInstalledAppIdFromPageData(marketplaceData)) + + val billingData = + settingsWebViewPageData( + surface = SettingsWebViewSurface.Billing, + storeScope = scope, + installedAppId = "stamp-row-id", + ) + assertNull(settingsInstalledAppIdFromPageData(billingData)) + } + @Test fun marketplaceUrlFallsBackToUnscopedIntegrationsRouteWithoutServerSlug() { assertEquals( diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/data/AgentsApiTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/data/AgentsApiTest.kt index 96f13f2210..7025b74f52 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/data/AgentsApiTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/data/AgentsApiTest.kt @@ -562,6 +562,23 @@ class AgentsApiTest { assertEquals(listOf(true, false), list.map { it.modelLimitsDefaultsReported }) } + @Test + fun agentDetailDecodesManagedByAppAttributionAndProfileProjection() = runPortableCoroutineTest { + val body = + """{"id":"agent-bot","name":"stamp","displayName":"Stamp","runtime":"external","status":"active","managedByAppInstallId":"install-1","managedByApp":{"clientId":"stamp-row-id","name":"Stamp","logoUrl":"https://cdn.example.test/stamp.png","description":"Code review","botStatusText":"Watching PRs"},"profileProjection":"channel_summary"}""" + val summary = + assertIs>( + RaftAgentsApiClient(RecordingAgentsApi(agentBody = body)).agent(MemberId("agent-bot")) + ).data.toAgentDetailSummary() + + assertEquals("install-1", summary.managedByAppInstallId) + assertEquals("stamp-row-id", summary.managedByAppClientId) + assertEquals("Stamp", summary.managedByAppName) + assertEquals("https://cdn.example.test/stamp.png", summary.managedByAppLogoUrl) + assertEquals("Watching PRs", summary.managedByAppBotStatusText) + assertEquals("channel_summary", summary.profileProjection) + } + @Test fun typedAgentsApiPreservesCustomRuntimeModelKind() = runPortableCoroutineTest { val client = From 1f56963373712cede5b1e49f9400983d5b41bbd7 Mon Sep 17 00:00:00 2001 From: Reef Date: Fri, 20 Nov 2026 07:11:10 +0000 Subject: [PATCH 2/4] chore(changelog): set pull_request 5134 in changeset --- change-logs/1.28.0/changesets/app-bot-profile-app-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change-logs/1.28.0/changesets/app-bot-profile-app-link.md b/change-logs/1.28.0/changesets/app-bot-profile-app-link.md index 7ce2d51097..c92a860a2a 100644 --- a/change-logs/1.28.0/changesets/app-bot-profile-app-link.md +++ b/change-logs/1.28.0/changesets/app-bot-profile-app-link.md @@ -5,7 +5,7 @@ platforms: - android - ios - desktop -pull_request: null +pull_request: 5134 rollout: full --- From aee8e5579ae6fd62fbb84c09f5875da42e38a657 Mon Sep 17 00:00:00 2001 From: Reef Date: Fri, 20 Nov 2026 07:27:00 +0000 Subject: [PATCH 3/4] test(members): pass required AgentDetailSnapshot fields in ManagedAppDetailLinkTest --- .../kotlin/build/raft/app/ManagedAppDetailLinkTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt index 4a1af5af97..8dca1bd59d 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/ManagedAppDetailLinkTest.kt @@ -100,6 +100,9 @@ class ManagedAppDetailLinkTest { managedByAppBotStatusText = "Ready", profileProjection = null, ), + directMessages = emptyList(), + reminders = emptyList(), + activity = emptyList(), ) val profile = snapshot.toStaticMembersProfile(ServerSummary(id = ServerId("srv-1"), name = "Launch", slug = "launch")) From b0646ddf9b43aa4036055206b62d392b2177cd6f Mon Sep 17 00:00:00 2001 From: Reef Date: Fri, 20 Nov 2026 07:54:10 +0000 Subject: [PATCH 4/4] test(members): expect managedByApp clientId and logoUrl in RaftAppBotTest --- .../kotlin/build/raft/app/RaftAppBotTest.kt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/RaftAppBotTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/RaftAppBotTest.kt index 865ccfc67a..c0bb38674e 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/RaftAppBotTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/RaftAppBotTest.kt @@ -71,9 +71,24 @@ class RaftAppBotTest { @Test fun appBotIdentityIsOnlyForManagedAgents() { val members = members() - assertEquals(RaftAppBotIdentity("stamp", "Stamp", removed = false), members.getValue("agent-bot").appBotIdentityOrNull()) assertEquals( - RaftAppBotIdentity("listing-bot", "Listing Bot App", removed = true), + RaftAppBotIdentity( + handle = "stamp", + appName = "Stamp", + removed = false, + appClientId = "client-1", + appLogoUrl = "https://cdn.example/stamp.png", + ), + members.getValue("agent-bot").appBotIdentityOrNull(), + ) + assertEquals( + RaftAppBotIdentity( + handle = "listing-bot", + appName = "Listing Bot App", + removed = true, + appClientId = "client-2", + appLogoUrl = null, + ), members.getValue("agent-removed").appBotIdentityOrNull(), ) assertNull(members.getValue("agent-plain").appBotIdentityOrNull())