The host's own catalog puts an "open beside" action on every non-current
child row; this port had never wired it. Add it: the row grows a hover
button that opens the child's chat as a `subagentchat` resource in the
native right Sidebar, so a user can watch a child work without giving up
the pane he is in (the in-pane jump stays the plain row click).
- src/client/native/subagent-chat.ts: the resource-address codec, copied
from @deepseek-ai/dsh-client-ui-subagent rather than imported (the
package exports no helpers and the plugin must not reach into it).
- native/surface.ts: carry `kind` / `preferNewPane` on an open.
- SubagentView: `openChildAside` via `ctx.get?.('sidebarRight')` — an
optional probe, since a fake ctx without `get` otherwise crashes the
whole render (9 specs caught it) — threaded through all three
CatalogRows call sites.
- locales: `subagentOpenAside` in zh/en plus all 20 third-language
dictionaries (tests/locales.spec.ts enforces key-set parity).
- docs: the conventions page now documents the resource-open recipe.
Gates: typecheck / lint / build / test 132 files 1390 passed /
check:consumer-types, plus the repo's runtime-contract symbol check.
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
/**
|
|
* Resource-address codec for an embedded subagent Session chat.
|
|
*
|
|
* Mirrors `@deepseek-ai/dsh-client-ui-subagent`'s own `subagentChatAddress`
|
|
* (the `dsh-resource://subagentchat/session/<childId>?parent&mode` form the
|
|
* native right Sidebar roots its `subagentchat` pages under). Copied rather
|
|
* than imported: the package exports no helpers and the plugin must not depend
|
|
* on its internals. Kept dependency-free so it is unit-testable in node.
|
|
*
|
|
* @module
|
|
*/
|
|
import type { SidebarSubagentAddress } from '../../context-types.ts'
|
|
|
|
/** Resource-address prefix for an embedded Session chat. */
|
|
export const SUBAGENT_CHAT_ADDRESS = 'dsh-resource://subagentchat/session/'
|
|
|
|
/** The native right Sidebar page kind an embedded Session chat opens as. */
|
|
export const SUBAGENT_CHAT_KIND = 'subagentchat'
|
|
|
|
/**
|
|
* Address one subagent Session together with the routing facts needed to
|
|
* restore it.
|
|
* @param address - durable direct-parent subagent address.
|
|
* @returns canonical Sidebar resource address.
|
|
*/
|
|
export function subagentChatAddress(address: SidebarSubagentAddress): string {
|
|
const query = new URLSearchParams({
|
|
parent: address.parentSessionId,
|
|
mode: address.mode,
|
|
})
|
|
return `${SUBAGENT_CHAT_ADDRESS}${encodeURIComponent(address.childSessionId)}?${query.toString()}`
|
|
}
|