@qilin-agent/client-ui-subagent 0.0.0-stage → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kkutysllb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/client/ui-subagent/README.md
5
+ /:
6
+ en: 67e2b5feabe78d35
7
+ zh: e8c601916bda6e07
8
+ /qilin-agent-client-ui-subagent:
9
+ en: 3887daac0c7e00f6
10
+ zh: 6a14f6dc8bc85983
11
+ /qilin-agent-client-ui-subagent/summary:
12
+ en: 50f267d55833a683
13
+ zh: 89d6b827576baa8b
14
+ /qilin-agent-client-ui-subagent/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 09388d293f9be9cb
17
+ /qilin-agent-client-ui-subagent/use-this-package:
18
+ en: 436f225edd4aa88a
19
+ zh: 9afc2df3d2d4bddb
20
+ /qilin-agent-client-ui-subagent/use-this-package/browsing-the-tree:
21
+ en: f2b7594eb9cd21ef
22
+ zh: 0179331fbb5fabde
23
+ /qilin-agent-client-ui-subagent/use-this-package/continuing-a-conversation:
24
+ en: 876e7152c8b9c4a6
25
+ zh: f89f5e2a812e8451
26
+ /qilin-agent-client-ui-subagent/use-this-package/the-reference-source:
27
+ en: 6a5f91b7dfcefafe
28
+ zh: 2d11441952cfea53
29
+ /qilin-agent-client-ui-subagent/understand-the-implementation:
30
+ en: 960398c71dbeb17c
31
+ zh: e9280da273ef273e
32
+ /qilin-agent-client-ui-subagent/understand-the-implementation/catalog-derivation:
33
+ en: 36a4661e42b56cd8
34
+ zh: bbd5d7e180b13bbd
35
+ /qilin-agent-client-ui-subagent/understand-the-implementation/duration-and-tokens:
36
+ en: 2bb75ca6f8e20877
37
+ zh: 0c3a746e4ee3aee2
38
+ /qilin-agent-client-ui-subagent/understand-the-implementation/composer-election:
39
+ en: d78980222a595824
40
+ zh: a612b389e5d6bd63
41
+ /qilin-agent-client-ui-subagent/further-exploration:
42
+ en: 9b13a724ba7d0954
43
+ zh: 65209b8347715680
44
+ /qilin-agent-client-ui-subagent/model-experience:
45
+ en: 215e7ba838619b7b
46
+ zh: a311da3843709f90
47
+ /qilin-agent-client-ui-subagent/model-experience/subagent-label-text-in-the-user-prompt:
48
+ en: 7207881f1c032278
49
+ zh: 911d6e8b319da21a
50
+ /qilin-agent-client-ui-subagent/model-experience/subagent-label-text-in-the-user-prompt/what-the-model-sees:
51
+ en: 5688696ee061a0e1
52
+ zh: 7199ef8cb8697960
53
+ /qilin-agent-client-ui-subagent/model-experience/subagent-label-text-in-the-user-prompt/token-effect:
54
+ en: bf3c483598710d54
55
+ zh: 32742fbb880db1b2
56
+ /qilin-agent-client-ui-subagent/model-experience/subagent-label-text-in-the-user-prompt/kv-cache-effect:
57
+ en: de2762a99572475f
58
+ zh: 9b41107ad14ebf8a
59
+ /qilin-agent-client-ui-subagent/known-limitations-and-deferred-work:
60
+ en: bc97468f56e09997
61
+ zh: 36c5b1c504722447
62
+ /qilin-agent-client-ui-subagent/known-limitations-and-deferred-work/dev-note:
63
+ en: e67f633dc6fe7773
64
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -1,3 +1,118 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Subagent conversation catalog, continuation routing UI, and '@' reference source for the qilin web client."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @qilin-agent/client-ui-subagent
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Use this package to browse every subagent conversation beneath a parent session, open any descendant, and see whether it is running together with its token usage and active-turn duration. Completed one-shot conversations open as read-only execution records. Continuable conversations accept follow-up prompts in submission order while they run and provide Stop independently. The ordinary session sidebar omits subagent conversations, so the parent header catalog is their navigation entry point. The separate `@` source inserts a running child's label into a user message without resolving it into a continuation address.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ The session header keeps the current session title as the lineage breadcrumb and, when the session has subagent descendants, appends a `/` count trigger before the header's action row; the trigger opens the descendant catalog, counts the complete subagent-only lineage, stops at ordinary forks, and shows ongoing activity when any counted descendant is running. Select any depth to open that child's conversation with its exact `{parentSessionId, childSessionId, mode}` address, or use the row's trailing arrow to open the same address in the right Sidebar, preferring a separate pane when room permits.
29
+
30
+ This package registers the `qilin-resource://subagentchat/session/<child>?parent=<parent>&mode=<mode>` resource and builtin Sidebar tab type. The resource refreshes the direct-parent catalog before it retains the child `SessionReference`, and releases the reference when the tab record closes. The tab renders the shared `conversation.content` Factory through `sidebar.chat.conversation`, fixes the local View to Chat, and omits the main Conversation header and width controls.
31
+
32
+ ### Browsing the tree
33
+
34
+ Rows display mode plus `running`/`inactive` activity and an optional log-backed title; the trailing column stacks total durable provider usage above active-turn duration. Keyboard navigation works with ArrowRight/ArrowLeft to expand and collapse branches and ArrowUp/ArrowDown, Home, End, and Escape to navigate or close the tree. An unlabeled one-shot row falls back to its session id; corrupt, unsupported, or unavailable rows remain readable but disabled.
35
+
36
+ ### Continuing a conversation
37
+
38
+ A continuable child with a live parent keeps the ordinary input chrome: typing and Send stay available while the child runs because every follow-up joins the child's FIFO inbox, and an independent Stop routes through `subagents/interruptByParent`. A continuable child whose exact parent is unavailable and which is not running elects a read-only composer explaining the recovery path; while such a child still runs, the selector yields to the ordinary composer with input and Send disabled but its independent Stop usable.
39
+
40
+ ### The `@` reference source
41
+
42
+ The `@` source remains deliberately separate and inert: candidates are zero-RPC running children from `ctx.sessions.list`, picking one inserts literal `@label ` text, and the codec projects `@label`. It has no command-adjudication hooks and does not resolve labels into continuation addresses.
43
+
44
+ -----
45
+
46
+ <a id="understand-the-implementation"></a>
47
+ ## Understand the implementation
48
+
49
+ <details>
50
+ <summary>Implementation internals — click to expand</summary>
51
+
52
+ The catalog and composer behavior are specified by the [Web subagent conversations note](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.md) and the [current-turn interrupt note](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.md).
53
+
54
+ ### Catalog derivation
55
+
56
+ The header lineage renderer reads `subagentsByParent` and session summaries through the standard `useSessions` hook. The compact tree remains direct-catalog authoritative: each healthy row's `hasChildren` hint determines disclosure before interaction, a catalog level reserves the disclosure column only when at least one healthy row is a branch, and expanding a branch immediately reserves one disabled loading row per known direct descendant before lazily replacing them with that child's authoritative catalog. Every visible branch is reported to the runtime so membership frames cause a debounced refresh only where the tree is being consumed.
57
+
58
+ ### Duration and tokens
59
+
60
+ Token totals sum the four disjoint `tokenUsage` buckets. Duration sums completed `subagentTiming` turns, advances once per second only for an open turn on a running child, and freezes after the child becomes inactive; an interrupted open turn is bounded by its same-cut `active.through`, never by newer session metadata.
61
+
62
+ ### Composer election
63
+
64
+ One-shot children always elect a read-only composer. A continuable child elects one only when its exact parent is unavailable and the child is not running; otherwise the ordinary composer's Session routes prompts through `subagents/prompt`. This package never receives host context or calls a model-facing tool.
65
+
66
+ </details>
67
+
68
+ -----
69
+
70
+ <a id="further-exploration"></a>
71
+ ## Further Exploration
72
+
73
+ These pages cover the conversation surface, the host seam, and the design notes.
74
+
75
+ - [ui-conversation](../ui-conversation/README.md) — the chat surface hosting the header action and composer chain.
76
+ - [ui-input-trigger](../ui-input-trigger/README.md) — the suggestion machinery hosting the `@` source.
77
+ - [subagent](../../subagent/subagent/README.md) — the host-side capability seam behind continuable children.
78
+ - [Web subagent conversations](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.md) — the catalog and composer specification.
79
+ - [Current-turn interrupt](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.md) — the independent Stop semantics.
80
+
81
+ -----
82
+
83
+ <a id="model-experience"></a>
84
+ ## Model Experience
85
+
86
+ ### Subagent label text in the user prompt
87
+
88
+ #### What the model sees
89
+
90
+ Only the `@` reference source affects model input: a picked candidate reaches the ordinary user message as literal `@label`, without a dedicated block or host-side resolution. Catalog browsing, child navigation, and persisted transcript viewing add no prompt section; accepted continuation content becomes a normal FIFO user message through the host subagent adapter.
91
+
92
+ #### Token effect
93
+
94
+ Conditional and append-only: the literal `@label` or a human follow-up adds tokens only to its new user message. Catalog and transcript operations add zero model tokens.
95
+
96
+ #### KV Cache effect
97
+
98
+ Append-only. This package never edits earlier request tokens.
99
+
100
+ ## Known Limitations and Deferred Work
101
+
102
+ <a id="known-limitations-and-deferred-work"></a>
103
+
104
+
105
+ These limits define what the catalog can show and what `@` references mean; they are current package constraints.
106
+
107
+ - **The catalog has no durable outcome** — activity and timing do not distinguish completion, failure, or cancellation, and the UI exposes no Activation identity; stopping is limited to the composer's current-turn Stop for a running continuable child.
108
+ - **`@` references remain display-title text** — duplicate or renamed labels are ambiguous, so they intentionally do not acquire continuation semantics.
109
+
110
+ <a id="dev-note"></a>
111
+ ### Dev Note
112
+
113
+ <details>
114
+ <summary>Working context for maintainers — click to expand</summary>
115
+
116
+ None.
117
+
118
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,118 @@
1
+ ---
2
+ description: "qilin Web 客户端的 subagent 对话目录、续接路由 UI 与 '@' 引用 source。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @qilin-agent/client-ui-subagent
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 使用本包可浏览父会话下的每个 subagent 对话、打开任意后代,并查看其是否正在运行以及 token 用量和活跃轮次耗时。已完成的 one-shot 对话会作为只读执行记录打开。可继续对话在运行期间按提交顺序接收后续提示词,并独立提供 Stop。普通会话侧边栏会省略 subagent 对话,因此父会话页头目录是它们的导航入口。独立的 `@` source 会把运行中 child 的 label 插入用户消息,但不会把它解析成继续执行地址。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [进一步探索](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延期工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
27
+
28
+ 会话页头保留当前会话 title 作为谱系面包屑,并在会话存在 subagent 后代时,于页头操作行之前追加 `/` 数量触发器;触发器打开后代目录,统计仅含 subagent 的完整谱系、在普通 fork 处停止,并在任一计入统计的后代处于 `running` 时显示活动仍在进行。选择任意深度,即可用该子会话的确切 `{parentSessionId, childSessionId, mode}` 地址打开其对话;也可以使用行尾箭头在右侧 Sidebar 打开同一地址,并在空间允许时优先使用独立分栏。
29
+
30
+ 本包注册 `qilin-resource://subagentchat/session/<child>?parent=<parent>&mode=<mode>` 资源与 builtin Sidebar tab 类型。资源先刷新直接 parent 目录,再保留 child 的 `SessionReference`,并在 tab 记录关闭时释放 reference。tab 通过 `sidebar.chat.conversation` 渲染共享 `conversation.content` Factory,把局部 View 固定为 Chat,并省略主 Conversation 的 Header 与宽度控制。
31
+
32
+ ### 浏览目录
33
+
34
+ 行显示 mode、`running`/`inactive` 活动状态与由日志支撑的可选 title;尾随列在上行显示提供方的持久化 token 用量总计,在下行显示活跃轮次耗时。键盘导航:ArrowRight/ArrowLeft 展开和折叠分支;ArrowUp/ArrowDown、Home、End 与 Escape 用于导航或关闭树。没有 label 的 one-shot 行回退到其会话 id;损坏、不受支持或不可用的行仍保持可读但禁用。
35
+
36
+ ### 续接对话
37
+
38
+ 确切 parent 存活时,可继续 child 保留普通输入 chrome:child 运行期间输入和 Send 保持可用,因为每条后续消息都会进入 child 的 FIFO inbox,而独立的 Stop 经由 `subagents/interruptByParent` 路由。确切 parent 不可用且 child 未在运行的可继续 child 会选用说明恢复路径的只读编辑器;此类 child 仍在运行期间,selector 会让位给普通编辑器——输入区与 Send 被禁用,但独立的 Stop 保持可用。
39
+
40
+ ### `@` 引用 source
41
+
42
+ `@` source 仍然刻意保持独立且惰性:候选是从 `ctx.sessions.list` 零 RPC 得到的运行中 child;pick 会插入字面文本 `@label `,codec 投影为 `@label`。它不参与命令裁决,也不会把 label 解析成继续执行地址。
43
+
44
+ -----
45
+
46
+ <a id="understand-the-implementation"></a>
47
+ ## 理解实现
48
+
49
+ <details>
50
+ <summary>实现细节——点击展开</summary>
51
+
52
+ 目录与编辑器行为由 [Web subagent 对话笔记](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.zh.md) 与[当前轮次中断笔记](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.zh.md) 规定。
53
+
54
+ ### 目录派生
55
+
56
+ 页头谱系 renderer 通过标准 `useSessions` 钩子读取 `subagentsByParent` 与会话摘要。紧凑树仍以直接目录为权威依据:每个健康行的 `hasChildren` 提示在交互前决定是否显示展开控件;每层目录仅在其中至少一个健康行是分支时才预留展开列;展开分支时会立即为每个已知直接后代预留一行禁用的加载行,随后再用该 child 的权威目录懒加载结果替换。每个可见分支都会上报给运行时,使成员帧只在树正被消费的位置触发去抖动刷新。
57
+
58
+ ### 耗时与 token
59
+
60
+ token 用量总计为四个互不重叠的 `tokenUsage` 桶之和。耗时会累加已完成的 `subagentTiming` 轮次,仅在运行中 child 存在未结束轮次时每秒递增一次,并在 child 变为 inactive 后冻结;被中断的未结束轮次以其同一切面的 `active.through` 为上界,绝不使用更新的会话元数据。
61
+
62
+ ### 编辑器选举
63
+
64
+ one-shot child 始终选用只读编辑器。可继续 child 仅在其确切 parent 不可用且 child 未在运行时选用只读编辑器;否则普通编辑器的会话会经 `subagents/prompt` 路由提示词。本包绝不接收宿主上下文,也不调用面向模型的工具。
65
+
66
+ </details>
67
+
68
+ -----
69
+
70
+ <a id="further-exploration"></a>
71
+ ## 进一步探索
72
+
73
+ 以下页面覆盖对话界面、宿主 seam 与设计笔记。
74
+
75
+ - [ui-conversation](../ui-conversation/README.zh.md)——承载页头操作与编辑器链的聊天界面。
76
+ - [ui-input-trigger](../ui-input-trigger/README.zh.md)——承载 `@` source 的建议机制。
77
+ - [subagent](../../subagent/subagent/README.zh.md)——可继续 child 背后的宿主能力 seam。
78
+ - [Web subagent 对话](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.zh.md)——目录与编辑器规范。
79
+ - [当前轮次中断](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.zh.md)——独立 Stop 的语义。
80
+
81
+ -----
82
+
83
+ <a id="model-experience"></a>
84
+ ## 模型体验
85
+
86
+ ### 用户提示词中的 subagent label 文本
87
+
88
+ #### 模型看到的内容
89
+
90
+ 只有 `@` 引用 source 会影响模型输入:pick 的候选以字面文本 `@label` 进入普通用户消息,没有专用内容块或宿主侧解析。浏览目录、导航 child 与查看持久化 transcript(文本记录)都不会添加提示词 section;已接收的继续交互内容会经宿主 subagent 适配器成为普通 FIFO 用户消息。
91
+
92
+ #### Token 影响
93
+
94
+ 有条件且仅追加:字面 `@label` 或用户后续消息只会向对应的新用户消息增加 token。目录与 transcript 操作增加零模型 token。
95
+
96
+ #### KV Cache 影响
97
+
98
+ 仅追加。本包绝不改写更早的请求 token。
99
+
100
+ ## 已知限制与延期工作
101
+
102
+ <a id="known-limitations-and-deferred-work"></a>
103
+
104
+
105
+ 这些限制定义目录能显示什么、`@` 引用意味着什么;它们是当前包约束。
106
+
107
+ - **目录没有持久化结果**:活动状态与计时无法区分完成、失败或取消,且 UI 不公开 Activation 身份;停止能力仅限编辑器上针对运行中可继续 child 的当前轮次 Stop。
108
+ - **`@` 引用仍是显示标题文本**:重复或改名后的 label 会有歧义,因此它们刻意不获得继续执行语义。
109
+
110
+ <a id="dev-note"></a>
111
+ ### 开发备注
112
+
113
+ <details>
114
+ <summary>维护者的工作上下文——点击展开</summary>
115
+
116
+ 无。
117
+
118
+ </details>