@deepseek-ai/dsh-client-ui-subagent 0.1.0-rc.8 → 0.1.1-rc.2
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/README.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +3 -3
- package/lib/client.js +287 -128
- package/lib/types/client/SubagentHeaderLineage.d.ts +18 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +1 -0
- package/package.json +22 -20
- package/lib/types/client/SubagentCatalogAction.d.ts +0 -18
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/ui-subagent/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: d4a804a94b0f2cb295fd29c09c7f32385e423495
|
|
6
|
+
README.zh.md: 3cec2109cbb5f85617cf69155c5582ee43496f09
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Web subagent feature owner: contributes
|
|
5
|
+
Web subagent feature owner: contributes current-title lineage navigation to `conversation.session.header.lineage`, reason-specific read-only replacements to the conversation composer chain, and the existing `@` reference source to `ctx.inputTriggers`.
|
|
6
6
|
|
|
7
|
-
The header
|
|
7
|
+
The header lineage renderer reads `subagentsByParent` and session summaries through the standard `useSessions` hook. On an ordinary session it preserves the current title and, when descendants exist, appends `/` plus the descendant-count dropdown before the header action row. Every subagent breadcrumb uses the count trigger's 12px type scale and combines its title with a fixed double chevron; the current breadcrumb keeps primary color and weight 500, while ancestors use tertiary color and weight 400. Hovering a combined control for 150ms opens its direct-parent catalog, ArrowDown remains the keyboard entry path, and clicking an ancestor cancels a pending menu and navigates upward without opening it. Each catalog enables sibling switching and bolds its selected row; a catalog label overrides the session-summary title, and every switcher whose catalog has not loaded requests it automatically. Only the current subagent appends its own descendant-count dropdown. Long breadcrumb titles truncate while the chevron remains visible. The count trigger covers the complete subagent-only descendant lineage, stops at ordinary forks, and shows ongoing activity when any counted descendant is running. The compact tree remains direct-catalog authoritative: continuable and one-shot rows display mode plus `running`/`inactive` activity and an optional log-backed title, while the trailing column stacks total durable provider usage above active-turn duration. Token totals sum the four disjoint `tokenUsage` buckets. Visual duration stays exact to the second below one day, then uses at most two adjacent units—days/hours, approximate months/days, or approximate years/months—while hover and the accessible name retain the exact day/hour/minute/second value. 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. An unlabeled one-shot row falls back to its session id, while corrupt, unsupported, or unavailable rows remain readable but disabled. Each healthy row's `hasChildren` hint determines disclosure before interaction, so known leaves never show an arrow; a catalog level reserves the disclosure column only when at least one healthy row is a branch, allowing branchless levels to start at the leading status marker. Expanding a branch immediately reserves one disabled loading row per known direct descendant, then lazily replaces 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. Selecting any depth calls `SessionRuntime.openSubagent()` with the row's exact `{parentSessionId, childSessionId, mode}` address. Component-local state owns tree visibility, expanded branches, keyboard focus, and the running-duration clock. ArrowRight/ArrowLeft expand and collapse branches; ArrowUp/ArrowDown, Home, End, and Escape navigate or close the tree; closing returns focus to the trigger. Styling uses tokens only.
|
|
8
8
|
|
|
9
9
|
A one-shot child always elects a read-only composer that identifies the transcript as a completed execution record. A continuable child does so only when its exact parent is unavailable and the child is not running, with copy explaining the recovery path; while such a child still runs, the selector yields to the ordinary composer, whose input and Send action are disabled but whose independent Stop stays usable, and the takeover returns once it stops. A continuable child with a live parent keeps the ordinary input chrome, whose Session routes prompts through `subagent.prompt`: typing and Send stay available while the child runs because every follow-up joins the child's FIFO inbox, while an independent Stop routes through `subagent.interrupt`. This package never receives host context or calls a model-facing tool. The catalog and composer behavior are specified by the [Web subagent conversations Agent Note](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.md) and the [current-turn interrupt Agent Note](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.md).
|
|
10
10
|
|
package/README.zh.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
Web subagent 功能 owner:向 `conversation.session.header.
|
|
5
|
+
Web subagent 功能 owner:向 `conversation.session.header.lineage` 贡献当前 title 谱系导航,向会话编辑器链贡献按原因区分的只读替代呈现,并保留注册到 `ctx.inputTriggers` 的既有 `@` 引用 source。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
页头谱系 renderer 通过标准 `useSessions` 钩子读取 `subagentsByParent` 与会话摘要。普通会话保留当前 title,并在存在后代时,于页头操作行之前追加 `/` 和后代数量下拉菜单。每一级 subagent 面包屑都使用数量触发器的 12px 字号,并将 title 与固定显示的双向箭头组合成一个控件;当前面包屑保留主标签颜色和 500 字重,祖先面包屑则使用三级标签颜色和 400 字重。悬停组合控件 150ms 后会打开其直接 parent 目录,ArrowDown 保留为键盘入口;点击祖先面包屑会取消待打开的菜单并仅向上导航。每个目录都可切换 sibling,并会加粗选中行;目录 label 优先于会话摘要 title,尚未加载目录的每个切换器都会自动请求该目录。只有当前 subagent 会追加自己的后代数量下拉菜单。过长的面包屑 title 会截断,而双向箭头始终保留。数量触发器会统计仅含 subagent 的完整后代谱系,在普通 fork 处停止,并在任一计入统计的后代处于 `running` 时显示活动仍在进行。紧凑树仍以直接目录为权威依据:可继续和 one-shot 行会显示 mode、`running`/`inactive` 活动状态和由日志支撑的可选 title,尾随列则在上行显示提供方的持久化 token 用量总计,在下行显示活跃轮次耗时。token 用量总计为四个互不重叠的 `tokenUsage` 桶之和。视觉耗时在不足一天时精确到秒,达到一天后则最多使用两个相邻单位——天/小时、近似月份/天或近似年份/月份——而悬停信息与无障碍名称会保留精确的天/小时/分钟/秒数值。耗时会累加已完成的 `subagentTiming` 轮次,仅在运行中 child 存在未结束轮次时每秒递增一次,并在 child 变为 inactive 后冻结;被中断的未结束轮次以其同一切面的 `active.through` 为上界,绝不使用更新的会话元数据。没有 label 的 one-shot 行会回退到其会话 id,而损坏、不受支持或不可用的行仍保持可读但禁用。每个健康行的 `hasChildren` 提示会在交互前决定是否显示展开控件,因此已知叶子节点从不显示箭头;每层目录仅在其中至少一个健康行是分支时才预留展开列,使完全不含分支的层级能从最前面的状态标记开始。展开分支时,会立即为每个已知直接后代预留一行禁用的加载行,随后再用该 child 的权威目录懒加载结果替换这些占位行。每个可见分支都会上报给运行时,使成员帧只在树正被消费的位置触发去抖动刷新。选择任意深度的条目都会使用该行的确切地址 `{parentSessionId, childSessionId, mode}` 调用 `SessionRuntime.openSubagent()`。组件局部状态负责树的可见性、已展开分支、键盘焦点与运行中耗时时钟。ArrowRight/ArrowLeft 展开和折叠分支;ArrowUp/ArrowDown、Home、End 与 Escape 用于导航或关闭树;关闭后焦点返回触发器。样式只使用 token。
|
|
8
8
|
|
|
9
|
-
one-shot child 始终选用只读编辑器,并将 transcript(文本记录)说明为已完成的执行记录。可继续 child 仅在其确切 parent 不可用且 child 未在运行时选用只读编辑器,并以文案说明恢复路径;此类 child 仍在运行期间,selector 会让位给普通编辑器——其输入区与 Send 操作被禁用,但独立的 Stop 保持可用,停止后只读替代恢复。确切 parent 存活时,可继续 child 保留普通输入 chrome,其会话通过 `subagent.prompt` 路由提示词:child 运行期间输入和 Send 保持可用,因为每条后续消息都会进入 child 的 FIFO inbox,而独立的 Stop 经由 `subagent.interrupt` 路由。本包绝不接收宿主上下文,也不调用面向模型的工具。目录与编辑器行为由 [Web subagent 对话 Agent Note](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.md) 与[当前轮次中断 Agent Note](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.md) 规定。
|
|
9
|
+
one-shot child 始终选用只读编辑器,并将 transcript(文本记录)说明为已完成的执行记录。可继续 child 仅在其确切 parent 不可用且 child 未在运行时选用只读编辑器,并以文案说明恢复路径;此类 child 仍在运行期间,selector 会让位给普通编辑器——其输入区与 Send 操作被禁用,但独立的 Stop 保持可用,停止后只读替代恢复。确切 parent 存活时,可继续 child 保留普通输入 chrome,其会话通过 `subagent.prompt` 路由提示词:child 运行期间输入和 Send 保持可用,因为每条后续消息都会进入 child 的 FIFO inbox,而独立的 Stop 经由 `subagent.interrupt` 路由。本包绝不接收宿主上下文,也不调用面向模型的工具。目录与编辑器行为由 [Web subagent 对话 Agent Note](../../../.agents/notes/implemented/feature/2026-07-27-web-subagent-conversations.zh.md) 与[当前轮次中断 Agent Note](../../../.agents/notes/implemented/feature/2026-08-06-continuable-subagent-interrupt.zh.md) 规定。
|
|
10
10
|
|
|
11
11
|
普通侧边栏会省略带 subagent origin 的会话行,因此 parent 页头目录是它们的导航入口。普通 fork 仍保留在侧边栏中。
|
|
12
12
|
|
package/lib/client.js
CHANGED
|
@@ -6,11 +6,12 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let react = require("react");
|
|
9
|
+
let react_dom = require("react-dom");
|
|
9
10
|
let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
10
11
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
-
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-subagent/src/client/
|
|
12
|
-
const css$1 = ".
|
|
13
|
-
const tagId$1 = "@deepseek-ai/dsh-client-ui-subagent/
|
|
12
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-subagent/src/client/SubagentHeaderLineage.module.css.mjs
|
|
13
|
+
const css$1 = ".ZKlsPq_root{align-items:center;gap:10px;min-width:0;display:inline-flex;position:relative}.ZKlsPq_switcherRoot{min-width:0;margin-left:6px}.ZKlsPq_trigger,.ZKlsPq_switcherTrigger{min-height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;padding:3px 2px;font-size:12px;line-height:18px;display:inline-flex}.ZKlsPq_trigger{gap:4px}.ZKlsPq_switcherTrigger{min-width:0;max-width:244px;color:var(--dsw-alias-label-primary);gap:4px;font-weight:500}.ZKlsPq_ancestorSwitcherTrigger{color:var(--dsw-alias-label-tertiary);font-weight:400}.ZKlsPq_switcherTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.ZKlsPq_switcherTrigger svg{flex:none}.ZKlsPq_separator{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.ZKlsPq_activitySlot{flex:none;width:10px;height:10px;display:inline-flex}.ZKlsPq_trigger:hover,.ZKlsPq_trigger:focus-visible{color:var(--dsw-alias-label-secondary)}.ZKlsPq_switcherTrigger:hover,.ZKlsPq_switcherTrigger:focus-visible{color:var(--dsw-alias-label-primary)}.ZKlsPq_ancestorSwitcherTrigger:hover,.ZKlsPq_ancestorSwitcherTrigger:focus-visible{color:var(--dsw-alias-label-tertiary)}.ZKlsPq_trigger svg,.ZKlsPq_switcherTrigger svg{transition:transform .12s}.ZKlsPq_triggerOpen{transform:rotate(180deg)}.ZKlsPq_menu{z-index:100;box-sizing:border-box;background:var(--dsw-specific-menu);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:336px;max-width:min(400px,100vw - 32px);max-height:min(560px,100vh - 140px);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;flex-direction:column;padding:4px;display:flex;position:fixed;overflow:auto}.ZKlsPq_node{min-width:0;position:relative}.ZKlsPq_menu>.ZKlsPq_node{margin-left:-3px}.ZKlsPq_row{box-sizing:border-box;width:100%;min-height:50px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:0;border-radius:8px;outline:none;align-items:flex-start;gap:8px;padding:7px 8px 7px 11px;font-size:13px;line-height:18px;display:flex;position:relative}.ZKlsPq_row:hover>.ZKlsPq_clickarea,.ZKlsPq_row:focus-visible>.ZKlsPq_clickarea{background:var(--dsw-alias-interactive-bg-hover)}.ZKlsPq_clickarea{box-sizing:border-box;border-radius:8px;flex:1;align-self:stretch;align-items:flex-start;gap:8px;min-width:0;margin:-7px -8px;padding:7px 8px;display:flex}.ZKlsPq_row>[data-state],.ZKlsPq_clickarea>[data-state]{margin-top:4px}.ZKlsPq_disabled{color:var(--dsw-alias-label-dimmed);cursor:not-allowed}.ZKlsPq_disabled:hover{background:0 0}.ZKlsPq_loadingRow{cursor:default}.ZKlsPq_disclosure,.ZKlsPq_disclosureSpace{flex:none;width:14px;height:18px}.ZKlsPq_disclosure{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0;transition:transform .12s;display:inline-flex}.ZKlsPq_disclosure:hover{color:var(--dsw-alias-label-primary)}.ZKlsPq_disclosureOpen{transform:rotate(90deg)}.ZKlsPq_content{flex-direction:column;flex:1;min-width:0;display:flex}.ZKlsPq_label,.ZKlsPq_summary{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ZKlsPq_label{color:inherit;font-weight:400}.ZKlsPq_currentLabel{font-weight:600}.ZKlsPq_summary,.ZKlsPq_metrics{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.ZKlsPq_metrics{font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;flex:none;grid-template-rows:18px 16px;display:grid}.ZKlsPq_metricToken{grid-row:1;line-height:18px}.ZKlsPq_metricDuration{grid-row:2}.ZKlsPq_children{margin-left:18px;padding-left:4px;position:relative}.ZKlsPq_children:before,.ZKlsPq_children>.ZKlsPq_node:before{content:\"\";border-left:1px solid var(--dsw-alias-border-l2);position:absolute;left:0}.ZKlsPq_children:before{height:26px;top:-26px}.ZKlsPq_children[aria-busy=true]:before{content:none}.ZKlsPq_children>.ZKlsPq_node:before{top:0;bottom:0;left:-4px}.ZKlsPq_children>.ZKlsPq_node:last-child:before{height:17px;bottom:auto}.ZKlsPq_children>.ZKlsPq_node>.ZKlsPq_row:before{content:\"\";border-top:1px solid var(--dsw-alias-border-l2);width:14px;position:absolute;top:16px;left:-4px}.ZKlsPq_notice,.ZKlsPq_error{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.ZKlsPq_error{color:var(--dsw-alias-state-error-primary);justify-content:space-between;align-items:center;gap:12px;display:flex}.ZKlsPq_refresh{color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:4px;padding:4px 6px;display:inline-flex}.ZKlsPq_refresh:hover{background:var(--dsw-alias-interactive-bg-hover)}";
|
|
14
|
+
const tagId$1 = "@deepseek-ai/dsh-client-ui-subagent/SubagentHeaderLineage.module.css";
|
|
14
15
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
15
16
|
const tag = document.createElement("style");
|
|
16
17
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-subagent";
|
|
@@ -18,34 +19,39 @@ window.__ModuleLoader__.load({
|
|
|
18
19
|
tag.textContent = css$1;
|
|
19
20
|
document.head.appendChild(tag);
|
|
20
21
|
}
|
|
21
|
-
var
|
|
22
|
-
"activitySlot": "
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
22
|
+
var SubagentHeaderLineage_module_css_default = {
|
|
23
|
+
"activitySlot": "ZKlsPq_activitySlot",
|
|
24
|
+
"ancestorSwitcherTrigger": "ZKlsPq_ancestorSwitcherTrigger",
|
|
25
|
+
"children": "ZKlsPq_children",
|
|
26
|
+
"clickarea": "ZKlsPq_clickarea",
|
|
27
|
+
"content": "ZKlsPq_content",
|
|
28
|
+
"currentLabel": "ZKlsPq_currentLabel",
|
|
29
|
+
"disabled": "ZKlsPq_disabled",
|
|
30
|
+
"disclosure": "ZKlsPq_disclosure",
|
|
31
|
+
"disclosureOpen": "ZKlsPq_disclosureOpen",
|
|
32
|
+
"disclosureSpace": "ZKlsPq_disclosureSpace",
|
|
33
|
+
"error": "ZKlsPq_error",
|
|
34
|
+
"label": "ZKlsPq_label",
|
|
35
|
+
"loadingRow": "ZKlsPq_loadingRow",
|
|
36
|
+
"menu": "ZKlsPq_menu",
|
|
37
|
+
"metricDuration": "ZKlsPq_metricDuration",
|
|
38
|
+
"metricToken": "ZKlsPq_metricToken",
|
|
39
|
+
"metrics": "ZKlsPq_metrics",
|
|
40
|
+
"node": "ZKlsPq_node",
|
|
41
|
+
"notice": "ZKlsPq_notice",
|
|
42
|
+
"refresh": "ZKlsPq_refresh",
|
|
43
|
+
"root": "ZKlsPq_root",
|
|
44
|
+
"row": "ZKlsPq_row",
|
|
45
|
+
"separator": "ZKlsPq_separator",
|
|
46
|
+
"summary": "ZKlsPq_summary",
|
|
47
|
+
"switcherRoot": "ZKlsPq_switcherRoot",
|
|
48
|
+
"switcherTitle": "ZKlsPq_switcherTitle",
|
|
49
|
+
"switcherTrigger": "ZKlsPq_switcherTrigger",
|
|
50
|
+
"trigger": "ZKlsPq_trigger",
|
|
51
|
+
"triggerOpen": "ZKlsPq_triggerOpen"
|
|
46
52
|
};
|
|
47
53
|
//#endregion
|
|
48
|
-
//#region lib/types/client/
|
|
54
|
+
//#region lib/types/client/SubagentHeaderLineage.js
|
|
49
55
|
function diagnosticReason(entry, t) {
|
|
50
56
|
switch (entry.reason) {
|
|
51
57
|
case "corrupt": return t("diagnostic.corrupt");
|
|
@@ -137,28 +143,46 @@ window.__ModuleLoader__.load({
|
|
|
137
143
|
count: 0,
|
|
138
144
|
runningCount: 0
|
|
139
145
|
};
|
|
146
|
+
function SubagentSwitcherIcon() {
|
|
147
|
+
return (0, react_jsx_runtime.jsxs)("svg", {
|
|
148
|
+
width: "16",
|
|
149
|
+
height: "16",
|
|
150
|
+
viewBox: "0 0 20 20",
|
|
151
|
+
fill: "none",
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
children: [(0, react_jsx_runtime.jsx)("path", {
|
|
154
|
+
d: "M5.99951 12.7L8.95546 14.9478C9.40011 15.2859 9.62244 15.455 9.87526 15.488C9.95774 15.4988 10.0413 15.4988 10.1238 15.488C10.3766 15.455 10.5989 15.2859 11.0436 14.9478L13.9995 12.7",
|
|
155
|
+
stroke: "currentColor",
|
|
156
|
+
strokeWidth: "1.5"
|
|
157
|
+
}), (0, react_jsx_runtime.jsx)("path", {
|
|
158
|
+
d: "M13.9995 7.7417L11.0436 5.49387C10.5989 5.15574 10.3766 4.98668 10.1238 4.95362C10.0413 4.94283 9.95775 4.94283 9.87527 4.95362C9.62245 4.98668 9.40012 5.15574 8.95547 5.49387L5.99952 7.7417",
|
|
159
|
+
stroke: "currentColor",
|
|
160
|
+
strokeWidth: "1.5"
|
|
161
|
+
})]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
140
164
|
/** Render the known direct-child shape while its authoritative catalog hydrates. */
|
|
141
165
|
function CatalogLoadingRows({ parentSessionId, summaries, level, t }) {
|
|
142
166
|
const children = Object.values(summaries).filter((summary) => summary.origin === "subagent" && summary.parentId === parentSessionId);
|
|
143
167
|
if (children.length === 0) return (0, react_jsx_runtime.jsx)("div", {
|
|
144
|
-
className:
|
|
168
|
+
className: SubagentHeaderLineage_module_css_default.notice,
|
|
145
169
|
children: t("loading.label")
|
|
146
170
|
});
|
|
147
171
|
return children.map((summary) => (0, react_jsx_runtime.jsx)("div", {
|
|
148
|
-
className:
|
|
172
|
+
className: SubagentHeaderLineage_module_css_default.node,
|
|
149
173
|
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
150
174
|
role: "treeitem",
|
|
151
175
|
"aria-disabled": "true",
|
|
152
176
|
"aria-level": level,
|
|
153
177
|
"aria-label": t("loading.aria"),
|
|
154
|
-
className: `${
|
|
178
|
+
className: `${SubagentHeaderLineage_module_css_default.row} ${SubagentHeaderLineage_module_css_default.disabled} ${SubagentHeaderLineage_module_css_default.loadingRow}`,
|
|
155
179
|
children: [
|
|
156
|
-
(0, react_jsx_runtime.jsx)("span", { className:
|
|
180
|
+
(0, react_jsx_runtime.jsx)("span", { className: SubagentHeaderLineage_module_css_default.disclosureSpace }),
|
|
157
181
|
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: summary.running ? "ongoing" : "done" }),
|
|
158
182
|
(0, react_jsx_runtime.jsx)("span", {
|
|
159
|
-
className:
|
|
183
|
+
className: SubagentHeaderLineage_module_css_default.content,
|
|
160
184
|
children: (0, react_jsx_runtime.jsx)("span", {
|
|
161
|
-
className:
|
|
185
|
+
className: SubagentHeaderLineage_module_css_default.label,
|
|
162
186
|
children: t("loading.label")
|
|
163
187
|
})
|
|
164
188
|
})
|
|
@@ -167,7 +191,7 @@ window.__ModuleLoader__.load({
|
|
|
167
191
|
}, summary.id));
|
|
168
192
|
}
|
|
169
193
|
/** Render one catalog level and recurse only through explicitly expanded rows. */
|
|
170
|
-
function CatalogRows({ parentSessionId, catalog, catalogs, summaries, expanded, level, now, openChild, refresh, toggleBranch, closeCatalog, t }) {
|
|
194
|
+
function CatalogRows({ parentSessionId, currentSessionId, catalog, catalogs, summaries, expanded, level, now, openChild, refresh, toggleBranch, closeCatalog, t }) {
|
|
171
195
|
const emptyLoading = catalog.state === "loading" && catalog.entries.length === 0;
|
|
172
196
|
const reserveDisclosure = catalog.entries.some((entry) => entry.kind === "child" && entry.hasChildren);
|
|
173
197
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -178,10 +202,10 @@ window.__ModuleLoader__.load({
|
|
|
178
202
|
t
|
|
179
203
|
}),
|
|
180
204
|
catalog.state === "error" && (0, react_jsx_runtime.jsxs)("div", {
|
|
181
|
-
className:
|
|
205
|
+
className: SubagentHeaderLineage_module_css_default.error,
|
|
182
206
|
children: [(0, react_jsx_runtime.jsx)("span", { children: catalog.error?.message ?? t("load.error") }), (0, react_jsx_runtime.jsxs)("button", {
|
|
183
207
|
type: "button",
|
|
184
|
-
className:
|
|
208
|
+
className: SubagentHeaderLineage_module_css_default.refresh,
|
|
185
209
|
onClick: () => {
|
|
186
210
|
refresh(parentSessionId);
|
|
187
211
|
},
|
|
@@ -192,24 +216,24 @@ window.__ModuleLoader__.load({
|
|
|
192
216
|
if (entry.kind === "diagnostic") {
|
|
193
217
|
const reason = diagnosticReason(entry, t);
|
|
194
218
|
return (0, react_jsx_runtime.jsx)("div", {
|
|
195
|
-
className:
|
|
219
|
+
className: SubagentHeaderLineage_module_css_default.node,
|
|
196
220
|
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
197
221
|
role: "treeitem",
|
|
198
222
|
"aria-disabled": "true",
|
|
199
223
|
"aria-level": level,
|
|
200
224
|
"aria-label": `${entry.id} ${reason}`,
|
|
201
|
-
className: `${
|
|
225
|
+
className: `${SubagentHeaderLineage_module_css_default.row} ${SubagentHeaderLineage_module_css_default.disabled}`,
|
|
202
226
|
title: reason,
|
|
203
227
|
children: [
|
|
204
|
-
reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className:
|
|
228
|
+
reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className: SubagentHeaderLineage_module_css_default.disclosureSpace }),
|
|
205
229
|
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" }),
|
|
206
230
|
(0, react_jsx_runtime.jsxs)("span", {
|
|
207
|
-
className:
|
|
231
|
+
className: SubagentHeaderLineage_module_css_default.content,
|
|
208
232
|
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
209
|
-
className:
|
|
233
|
+
className: SubagentHeaderLineage_module_css_default.label,
|
|
210
234
|
children: entry.id
|
|
211
235
|
}), (0, react_jsx_runtime.jsx)("span", {
|
|
212
|
-
className:
|
|
236
|
+
className: SubagentHeaderLineage_module_css_default.summary,
|
|
213
237
|
children: reason
|
|
214
238
|
})]
|
|
215
239
|
})
|
|
@@ -218,6 +242,7 @@ window.__ModuleLoader__.load({
|
|
|
218
242
|
}, entry.id);
|
|
219
243
|
}
|
|
220
244
|
const childCatalog = catalogs[entry.id];
|
|
245
|
+
const isCurrent = entry.id === currentSessionId;
|
|
221
246
|
const isExpanded = expanded.has(entry.id);
|
|
222
247
|
const knownLeaf = !entry.hasChildren;
|
|
223
248
|
const childLoading = childCatalog === void 0 || childCatalog.state === "loading" && childCatalog.entries.length === 0;
|
|
@@ -263,48 +288,49 @@ window.__ModuleLoader__.load({
|
|
|
263
288
|
toggleBranch(entry.id);
|
|
264
289
|
};
|
|
265
290
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
266
|
-
className:
|
|
291
|
+
className: SubagentHeaderLineage_module_css_default.node,
|
|
267
292
|
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
268
293
|
role: "treeitem",
|
|
269
294
|
tabIndex: 0,
|
|
270
295
|
"aria-level": level,
|
|
296
|
+
"aria-current": isCurrent || void 0,
|
|
271
297
|
"aria-label": [
|
|
272
298
|
label,
|
|
273
299
|
secondary,
|
|
274
300
|
metrics
|
|
275
301
|
].filter((value) => value !== "").join(" "),
|
|
276
302
|
...knownLeaf ? {} : { "aria-expanded": isExpanded },
|
|
277
|
-
className:
|
|
303
|
+
className: SubagentHeaderLineage_module_css_default.row,
|
|
278
304
|
onClick: open,
|
|
279
305
|
onKeyDown: handleKey,
|
|
280
|
-
children: [knownLeaf ? reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className:
|
|
306
|
+
children: [knownLeaf ? reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className: SubagentHeaderLineage_module_css_default.disclosureSpace }) : (0, react_jsx_runtime.jsx)("button", {
|
|
281
307
|
type: "button",
|
|
282
308
|
tabIndex: -1,
|
|
283
|
-
className: `${
|
|
309
|
+
className: `${SubagentHeaderLineage_module_css_default.disclosure} ${isExpanded ? SubagentHeaderLineage_module_css_default.disclosureOpen : ""}`,
|
|
284
310
|
"aria-label": t(isExpanded ? "branch.collapse" : "branch.expand", { label }),
|
|
285
311
|
onClick: toggle,
|
|
286
312
|
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, {})
|
|
287
313
|
}), (0, react_jsx_runtime.jsxs)("div", {
|
|
288
|
-
className:
|
|
314
|
+
className: SubagentHeaderLineage_module_css_default.clickarea,
|
|
289
315
|
children: [
|
|
290
316
|
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: entry.activity === "running" ? "ongoing" : "done" }),
|
|
291
317
|
(0, react_jsx_runtime.jsxs)("span", {
|
|
292
|
-
className:
|
|
318
|
+
className: SubagentHeaderLineage_module_css_default.content,
|
|
293
319
|
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
294
|
-
className:
|
|
320
|
+
className: `${SubagentHeaderLineage_module_css_default.label} ${isCurrent ? SubagentHeaderLineage_module_css_default.currentLabel : ""}`,
|
|
295
321
|
children: label
|
|
296
322
|
}), (0, react_jsx_runtime.jsx)("span", {
|
|
297
|
-
className:
|
|
323
|
+
className: SubagentHeaderLineage_module_css_default.summary,
|
|
298
324
|
children: secondary
|
|
299
325
|
})]
|
|
300
326
|
}),
|
|
301
327
|
metrics !== "" && (0, react_jsx_runtime.jsxs)("span", {
|
|
302
|
-
className:
|
|
328
|
+
className: SubagentHeaderLineage_module_css_default.metrics,
|
|
303
329
|
children: [tokenMetric !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
304
|
-
className:
|
|
330
|
+
className: SubagentHeaderLineage_module_css_default.metricToken,
|
|
305
331
|
children: tokenMetric
|
|
306
332
|
}), durationMetric !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
307
|
-
className:
|
|
333
|
+
className: SubagentHeaderLineage_module_css_default.metricDuration,
|
|
308
334
|
title: t("duration.exactTitle", { duration: durationMetric.exact }),
|
|
309
335
|
children: durationMetric.compact
|
|
310
336
|
})]
|
|
@@ -313,7 +339,7 @@ window.__ModuleLoader__.load({
|
|
|
313
339
|
})]
|
|
314
340
|
}), isExpanded && !knownLeaf && (0, react_jsx_runtime.jsx)("div", {
|
|
315
341
|
role: "group",
|
|
316
|
-
className:
|
|
342
|
+
className: SubagentHeaderLineage_module_css_default.children,
|
|
317
343
|
"aria-busy": childLoading || void 0,
|
|
318
344
|
children: childCatalog === void 0 ? (0, react_jsx_runtime.jsx)(CatalogLoadingRows, {
|
|
319
345
|
parentSessionId: entry.id,
|
|
@@ -322,6 +348,7 @@ window.__ModuleLoader__.load({
|
|
|
322
348
|
t
|
|
323
349
|
}) : (0, react_jsx_runtime.jsx)(CatalogRows, {
|
|
324
350
|
parentSessionId: entry.id,
|
|
351
|
+
currentSessionId,
|
|
325
352
|
catalog: childCatalog,
|
|
326
353
|
catalogs,
|
|
327
354
|
summaries,
|
|
@@ -339,34 +366,58 @@ window.__ModuleLoader__.load({
|
|
|
339
366
|
})
|
|
340
367
|
] });
|
|
341
368
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
369
|
+
const MENU_VIEWPORT_MARGIN = 16;
|
|
370
|
+
/** Place a portaled catalog below its trigger without crossing the viewport edge. */
|
|
371
|
+
function catalogMenuPosition(trigger) {
|
|
372
|
+
const rect = trigger.getBoundingClientRect();
|
|
373
|
+
const width = Math.min(336, window.innerWidth - MENU_VIEWPORT_MARGIN * 2);
|
|
374
|
+
return {
|
|
375
|
+
top: rect.bottom + 5,
|
|
376
|
+
left: Math.min(Math.max(MENU_VIEWPORT_MARGIN, rect.left), window.innerWidth - width - MENU_VIEWPORT_MARGIN)
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/** One trigger-plus-tree dropdown over the catalog rooted at `rootSessionId`. */
|
|
380
|
+
function CatalogDropdown({ rootSessionId, currentSessionId, displayTitle, openTitle, variant, separator = false, useSessions, openChild, refresh, setCatalogOpen, t }) {
|
|
381
|
+
const ancestorSwitcher = variant === "switcher" && openTitle !== void 0;
|
|
348
382
|
const catalogs = useSessions((state) => state.subagentsByParent);
|
|
349
383
|
const summaries = useSessions((state) => state.byId);
|
|
350
|
-
const catalog = catalogs[
|
|
384
|
+
const catalog = catalogs[rootSessionId];
|
|
351
385
|
const [open, setOpen] = (0, react.useState)(false);
|
|
386
|
+
const [menuPosition, setMenuPosition] = (0, react.useState)();
|
|
352
387
|
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
353
388
|
const [expanded, setExpanded] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
354
389
|
const rootRef = (0, react.useRef)(null);
|
|
355
390
|
const triggerRef = (0, react.useRef)(null);
|
|
391
|
+
const menuRef = (0, react.useRef)(null);
|
|
392
|
+
const hoverOpenTimer = (0, react.useRef)(void 0);
|
|
393
|
+
const hoverCloseTimer = (0, react.useRef)(void 0);
|
|
356
394
|
const observedCatalogs = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
395
|
+
const requestedInitialCatalog = (0, react.useRef)();
|
|
357
396
|
const setCatalogOpenRef = (0, react.useRef)(setCatalogOpen);
|
|
358
397
|
setCatalogOpenRef.current = setCatalogOpen;
|
|
398
|
+
const currentEntry = currentSessionId === void 0 ? void 0 : catalog?.entries.find((entry) => entry.kind === "child" && entry.id === currentSessionId);
|
|
399
|
+
const switcherDisplayTitle = currentEntry?.kind === "child" ? currentEntry.label ?? currentEntry.id : displayTitle;
|
|
359
400
|
const healthy = catalog?.entries.filter((entry) => entry.kind === "child") ?? [];
|
|
360
|
-
const descendants = (0, react.useMemo)(() => (0, _deepseek_ai_dsh_client_runtime_client.indexSubagentDescendants)(summaries).get(
|
|
401
|
+
const descendants = (0, react.useMemo)(() => (0, _deepseek_ai_dsh_client_runtime_client.indexSubagentDescendants)(summaries).get(rootSessionId) ?? NO_DESCENDANTS, [rootSessionId, summaries]);
|
|
361
402
|
const descendantCount = Math.max(healthy.length, descendants.count);
|
|
362
403
|
const totalCountKey = descendantCount === 1 ? "count.total.one" : "count.total.other";
|
|
363
404
|
const runningCountKey = descendants.runningCount === 1 ? "count.running.one" : "count.running.other";
|
|
364
|
-
const presentedCatalog = descendants.count > 0 && (catalog === void 0 || catalog.state === "ready" && catalog.entries.length === 0) ? {
|
|
405
|
+
const presentedCatalog = (descendants.count > 0 || variant === "switcher") && (catalog === void 0 || catalog.state === "ready" && catalog.entries.length === 0) ? {
|
|
365
406
|
entries: [],
|
|
366
407
|
parentAvailable: catalog?.parentAvailable ?? false,
|
|
367
408
|
state: "loading",
|
|
368
409
|
error: null
|
|
369
410
|
} : catalog;
|
|
411
|
+
(0, react.useEffect)(() => {
|
|
412
|
+
if (variant !== "switcher" || catalog !== void 0 || requestedInitialCatalog.current === rootSessionId) return;
|
|
413
|
+
requestedInitialCatalog.current = rootSessionId;
|
|
414
|
+
refresh(rootSessionId);
|
|
415
|
+
}, [
|
|
416
|
+
catalog,
|
|
417
|
+
refresh,
|
|
418
|
+
rootSessionId,
|
|
419
|
+
variant
|
|
420
|
+
]);
|
|
370
421
|
const observeCatalog = (parentSessionId, next) => {
|
|
371
422
|
if (next) observedCatalogs.current.add(parentSessionId);
|
|
372
423
|
else observedCatalogs.current.delete(parentSessionId);
|
|
@@ -377,16 +428,53 @@ window.__ModuleLoader__.load({
|
|
|
377
428
|
observedCatalogs.current.clear();
|
|
378
429
|
setExpanded(/* @__PURE__ */ new Set());
|
|
379
430
|
};
|
|
431
|
+
const cancelHoverClose = () => {
|
|
432
|
+
if (hoverCloseTimer.current === void 0) return;
|
|
433
|
+
clearTimeout(hoverCloseTimer.current);
|
|
434
|
+
hoverCloseTimer.current = void 0;
|
|
435
|
+
};
|
|
436
|
+
const cancelHoverOpen = () => {
|
|
437
|
+
if (hoverOpenTimer.current === void 0) return;
|
|
438
|
+
clearTimeout(hoverOpenTimer.current);
|
|
439
|
+
hoverOpenTimer.current = void 0;
|
|
440
|
+
};
|
|
380
441
|
const changeOpen = (next, restoreFocus = false) => {
|
|
381
|
-
|
|
442
|
+
cancelHoverOpen();
|
|
443
|
+
cancelHoverClose();
|
|
382
444
|
if (next) {
|
|
445
|
+
const trigger = triggerRef.current;
|
|
446
|
+
/* v8 ignore next -- a queued callback can outlive the trigger */
|
|
447
|
+
if (trigger === null) return;
|
|
448
|
+
setOpen(true);
|
|
449
|
+
setMenuPosition(catalogMenuPosition(trigger));
|
|
383
450
|
setNow(Date.now());
|
|
384
|
-
observeCatalog(
|
|
385
|
-
} else
|
|
451
|
+
observeCatalog(rootSessionId, true);
|
|
452
|
+
} else {
|
|
453
|
+
setOpen(false);
|
|
454
|
+
setMenuPosition(void 0);
|
|
455
|
+
closeAllCatalogs();
|
|
456
|
+
}
|
|
386
457
|
if (restoreFocus) queueMicrotask(() => {
|
|
387
458
|
triggerRef.current?.focus();
|
|
388
459
|
});
|
|
389
460
|
};
|
|
461
|
+
const scheduleHoverOpen = () => {
|
|
462
|
+
cancelHoverOpen();
|
|
463
|
+
cancelHoverClose();
|
|
464
|
+
if (open) return;
|
|
465
|
+
hoverOpenTimer.current = setTimeout(() => {
|
|
466
|
+
hoverOpenTimer.current = void 0;
|
|
467
|
+
changeOpen(true);
|
|
468
|
+
}, 150);
|
|
469
|
+
};
|
|
470
|
+
const scheduleHoverClose = () => {
|
|
471
|
+
cancelHoverOpen();
|
|
472
|
+
cancelHoverClose();
|
|
473
|
+
hoverCloseTimer.current = setTimeout(() => {
|
|
474
|
+
hoverCloseTimer.current = void 0;
|
|
475
|
+
changeOpen(false);
|
|
476
|
+
}, 120);
|
|
477
|
+
};
|
|
390
478
|
const closeBranch = (root) => {
|
|
391
479
|
const closing = /* @__PURE__ */ new Set();
|
|
392
480
|
const visit = (parentSessionId) => {
|
|
@@ -410,13 +498,28 @@ window.__ModuleLoader__.load({
|
|
|
410
498
|
(0, react.useEffect)(() => {
|
|
411
499
|
if (!open) return;
|
|
412
500
|
const closeOutside = (event) => {
|
|
413
|
-
if (event.target instanceof Node && !rootRef.current?.contains(event.target)) changeOpen(false);
|
|
501
|
+
if (event.target instanceof Node && !rootRef.current?.contains(event.target) && !menuRef.current?.contains(event.target)) changeOpen(false);
|
|
414
502
|
};
|
|
415
503
|
document.addEventListener("pointerdown", closeOutside);
|
|
416
504
|
return () => {
|
|
417
505
|
document.removeEventListener("pointerdown", closeOutside);
|
|
418
506
|
};
|
|
419
507
|
}, [open]);
|
|
508
|
+
(0, react.useEffect)(() => {
|
|
509
|
+
if (!open) return;
|
|
510
|
+
const placeMenu = () => {
|
|
511
|
+
const trigger = triggerRef.current;
|
|
512
|
+
/* v8 ignore next -- native resize or scroll can outlive the trigger */
|
|
513
|
+
if (trigger === null) return;
|
|
514
|
+
setMenuPosition(catalogMenuPosition(trigger));
|
|
515
|
+
};
|
|
516
|
+
window.addEventListener("resize", placeMenu);
|
|
517
|
+
document.addEventListener("scroll", placeMenu, true);
|
|
518
|
+
return () => {
|
|
519
|
+
window.removeEventListener("resize", placeMenu);
|
|
520
|
+
document.removeEventListener("scroll", placeMenu, true);
|
|
521
|
+
};
|
|
522
|
+
}, [open]);
|
|
420
523
|
(0, react.useEffect)(() => {
|
|
421
524
|
if (!open || descendants.runningCount === 0) return;
|
|
422
525
|
const timer = setInterval(() => {
|
|
@@ -427,23 +530,28 @@ window.__ModuleLoader__.load({
|
|
|
427
530
|
};
|
|
428
531
|
}, [open, descendants.runningCount]);
|
|
429
532
|
(0, react.useEffect)(() => () => {
|
|
533
|
+
cancelHoverOpen();
|
|
534
|
+
cancelHoverClose();
|
|
430
535
|
for (const parentSessionId of observedCatalogs.current) setCatalogOpenRef.current(parentSessionId, false);
|
|
431
536
|
observedCatalogs.current.clear();
|
|
432
537
|
}, []);
|
|
433
|
-
const visible = presentedCatalog !== void 0 && (presentedCatalog.state === "error" || presentedCatalog.entries.length > 0 || descendantCount > 0);
|
|
538
|
+
const visible = presentedCatalog !== void 0 && (variant === "switcher" || presentedCatalog.state === "error" || presentedCatalog.entries.length > 0 || descendantCount > 0);
|
|
434
539
|
(0, react.useEffect)(() => {
|
|
435
|
-
if (visible
|
|
540
|
+
if (visible) return;
|
|
541
|
+
cancelHoverOpen();
|
|
542
|
+
cancelHoverClose();
|
|
543
|
+
if (!open) return;
|
|
436
544
|
setOpen(false);
|
|
437
545
|
closeAllCatalogs();
|
|
438
546
|
}, [visible, open]);
|
|
439
547
|
if (!visible) return null;
|
|
440
548
|
const focusAt = (index) => {
|
|
441
|
-
const items = treeItems(
|
|
549
|
+
const items = treeItems(menuRef.current);
|
|
442
550
|
if (items.length === 0) return;
|
|
443
551
|
items[(index + items.length) % items.length]?.focus();
|
|
444
552
|
};
|
|
445
553
|
const navigate = (event) => {
|
|
446
|
-
const items = treeItems(
|
|
554
|
+
const items = treeItems(menuRef.current);
|
|
447
555
|
const index = items.indexOf(document.activeElement);
|
|
448
556
|
if (event.key === "Escape") {
|
|
449
557
|
event.preventDefault();
|
|
@@ -463,61 +571,112 @@ window.__ModuleLoader__.load({
|
|
|
463
571
|
}
|
|
464
572
|
};
|
|
465
573
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
466
|
-
className:
|
|
574
|
+
className: `${SubagentHeaderLineage_module_css_default.root} ${variant === "switcher" ? SubagentHeaderLineage_module_css_default.switcherRoot : ""}`,
|
|
467
575
|
ref: rootRef,
|
|
468
576
|
onKeyDown: navigate,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
children: [
|
|
488
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
489
|
-
className: SubagentCatalogAction_module_css_default.activitySlot,
|
|
490
|
-
children: descendants.runningCount > 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "ongoing" })
|
|
491
|
-
}),
|
|
492
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
493
|
-
className: SubagentCatalogAction_module_css_default.count,
|
|
494
|
-
children: t(totalCountKey, { count: descendantCount })
|
|
495
|
-
}),
|
|
496
|
-
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? SubagentCatalogAction_module_css_default.triggerOpen : void 0 })
|
|
497
|
-
]
|
|
498
|
-
}), open && (0, react_jsx_runtime.jsx)("div", {
|
|
499
|
-
className: SubagentCatalogAction_module_css_default.menu,
|
|
500
|
-
role: "tree",
|
|
501
|
-
"aria-label": t("tree.aria"),
|
|
502
|
-
children: (0, react_jsx_runtime.jsx)(CatalogRows, {
|
|
503
|
-
parentSessionId: sessionId,
|
|
504
|
-
catalog: presentedCatalog,
|
|
505
|
-
catalogs,
|
|
506
|
-
summaries,
|
|
507
|
-
expanded,
|
|
508
|
-
level: 1,
|
|
509
|
-
now,
|
|
510
|
-
openChild,
|
|
511
|
-
refresh,
|
|
512
|
-
toggleBranch,
|
|
513
|
-
closeCatalog: () => {
|
|
514
|
-
changeOpen(false);
|
|
577
|
+
onMouseEnter: scheduleHoverOpen,
|
|
578
|
+
onMouseLeave: scheduleHoverClose,
|
|
579
|
+
children: [
|
|
580
|
+
separator && (0, react_jsx_runtime.jsx)("span", {
|
|
581
|
+
className: SubagentHeaderLineage_module_css_default.separator,
|
|
582
|
+
children: "/"
|
|
583
|
+
}),
|
|
584
|
+
(0, react_jsx_runtime.jsxs)("button", {
|
|
585
|
+
ref: triggerRef,
|
|
586
|
+
type: "button",
|
|
587
|
+
className: variant === "switcher" ? `${SubagentHeaderLineage_module_css_default.switcherTrigger} ${ancestorSwitcher ? SubagentHeaderLineage_module_css_default.ancestorSwitcherTrigger : ""}` : SubagentHeaderLineage_module_css_default.trigger,
|
|
588
|
+
"aria-haspopup": "tree",
|
|
589
|
+
"aria-expanded": open,
|
|
590
|
+
"aria-label": variant === "switcher" ? t("switcher.aria", { title: switcherDisplayTitle }) : t(descendants.runningCount > 0 ? runningCountKey : totalCountKey, { count: descendants.runningCount > 0 ? descendants.runningCount : descendantCount }),
|
|
591
|
+
onClick: openTitle === void 0 ? void 0 : () => {
|
|
592
|
+
cancelHoverOpen();
|
|
593
|
+
if (open) changeOpen(false);
|
|
594
|
+
openTitle();
|
|
515
595
|
},
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
596
|
+
onKeyDown: (event) => {
|
|
597
|
+
if (event.key !== "ArrowDown") return;
|
|
598
|
+
event.preventDefault();
|
|
599
|
+
if (!open) changeOpen(true);
|
|
600
|
+
queueMicrotask(() => {
|
|
601
|
+
focusAt(0);
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
children: [variant === "switcher" ? (0, react_jsx_runtime.jsx)("span", {
|
|
605
|
+
className: SubagentHeaderLineage_module_css_default.switcherTitle,
|
|
606
|
+
children: switcherDisplayTitle
|
|
607
|
+
}) : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [descendants.runningCount > 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
608
|
+
className: SubagentHeaderLineage_module_css_default.activitySlot,
|
|
609
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "ongoing" })
|
|
610
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
611
|
+
className: SubagentHeaderLineage_module_css_default.count,
|
|
612
|
+
children: t(totalCountKey, { count: descendantCount })
|
|
613
|
+
})] }), variant === "switcher" ? (0, react_jsx_runtime.jsx)(SubagentSwitcherIcon, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? SubagentHeaderLineage_module_css_default.triggerOpen : void 0 })]
|
|
614
|
+
}),
|
|
615
|
+
open && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)("div", {
|
|
616
|
+
ref: menuRef,
|
|
617
|
+
className: SubagentHeaderLineage_module_css_default.menu,
|
|
618
|
+
style: menuPosition,
|
|
619
|
+
role: "tree",
|
|
620
|
+
"aria-label": t("tree.aria"),
|
|
621
|
+
onMouseEnter: cancelHoverClose,
|
|
622
|
+
onMouseLeave: scheduleHoverClose,
|
|
623
|
+
children: (0, react_jsx_runtime.jsx)(CatalogRows, {
|
|
624
|
+
parentSessionId: rootSessionId,
|
|
625
|
+
currentSessionId,
|
|
626
|
+
catalog: presentedCatalog,
|
|
627
|
+
catalogs,
|
|
628
|
+
summaries,
|
|
629
|
+
expanded,
|
|
630
|
+
level: 1,
|
|
631
|
+
now,
|
|
632
|
+
openChild,
|
|
633
|
+
refresh,
|
|
634
|
+
toggleBranch,
|
|
635
|
+
closeCatalog: () => {
|
|
636
|
+
changeOpen(false);
|
|
637
|
+
},
|
|
638
|
+
t
|
|
639
|
+
})
|
|
640
|
+
}), document.body)
|
|
641
|
+
]
|
|
519
642
|
});
|
|
520
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Render one breadcrumb title together with its subagent navigation.
|
|
646
|
+
* @param props - Breadcrumb title, session standard props, and catalog actions.
|
|
647
|
+
* @returns An ordinary-title descendant count, or a title-and-chevron sibling switcher.
|
|
648
|
+
*/
|
|
649
|
+
function SubagentHeaderLineage({ lineageSessionId, displayTitle, openTitle, useSessions, openChild, refresh, setCatalogOpen, t }) {
|
|
650
|
+
const parentId = useSessions((state) => {
|
|
651
|
+
const summary = state.byId[lineageSessionId];
|
|
652
|
+
return summary?.origin === "subagent" ? summary.parentId : void 0;
|
|
653
|
+
});
|
|
654
|
+
const shared = {
|
|
655
|
+
useSessions,
|
|
656
|
+
openChild,
|
|
657
|
+
refresh,
|
|
658
|
+
setCatalogOpen,
|
|
659
|
+
t
|
|
660
|
+
};
|
|
661
|
+
if (parentId === void 0) return (0, react_jsx_runtime.jsx)(CatalogDropdown, {
|
|
662
|
+
rootSessionId: lineageSessionId,
|
|
663
|
+
variant: "count",
|
|
664
|
+
separator: true,
|
|
665
|
+
...shared
|
|
666
|
+
}, lineageSessionId);
|
|
667
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(CatalogDropdown, {
|
|
668
|
+
rootSessionId: parentId,
|
|
669
|
+
currentSessionId: lineageSessionId,
|
|
670
|
+
variant: "switcher",
|
|
671
|
+
displayTitle,
|
|
672
|
+
...openTitle === void 0 ? {} : { openTitle },
|
|
673
|
+
...shared
|
|
674
|
+
}, lineageSessionId), openTitle === void 0 && (0, react_jsx_runtime.jsx)(CatalogDropdown, {
|
|
675
|
+
rootSessionId: lineageSessionId,
|
|
676
|
+
variant: "count",
|
|
677
|
+
...shared
|
|
678
|
+
}, lineageSessionId)] });
|
|
679
|
+
}
|
|
521
680
|
//#endregion
|
|
522
681
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-subagent/src/client/SubagentReadOnlyComposer.module.css.mjs
|
|
523
682
|
const css = ".XJ7liG_frame{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);min-height:54px;color:var(--dsw-alias-label-tertiary);border-radius:14px;justify-content:center;align-items:center;gap:8px;margin:0 24px 20px;padding:10px 16px;font-size:13px;line-height:20px;display:flex}.XJ7liG_frame strong{color:var(--dsw-alias-label-primary);font-weight:510}";
|
|
@@ -580,6 +739,7 @@ window.__ModuleLoader__.load({
|
|
|
580
739
|
"count.total.other": "{count} 个子代理",
|
|
581
740
|
"count.running.one": "{count} 个子代理,正在运行",
|
|
582
741
|
"count.running.other": "{count} 个子代理,正在运行",
|
|
742
|
+
"switcher.aria": "切换子代理:{title}",
|
|
583
743
|
"tree.aria": "子代理会话",
|
|
584
744
|
"readonly.oneShot.title": "一次性子代理记录",
|
|
585
745
|
"readonly.title": "此子代理暂时只读",
|
|
@@ -616,6 +776,7 @@ window.__ModuleLoader__.load({
|
|
|
616
776
|
"count.total.other": "{count} subagents",
|
|
617
777
|
"count.running.one": "{count} subagent running",
|
|
618
778
|
"count.running.other": "{count} subagents running",
|
|
779
|
+
"switcher.aria": "Switch subagent: {title}",
|
|
619
780
|
"tree.aria": "Subagent sessions",
|
|
620
781
|
"readonly.oneShot.title": "One-shot subagent record",
|
|
621
782
|
"readonly.title": "This subagent is read-only for now",
|
|
@@ -659,13 +820,11 @@ window.__ModuleLoader__.load({
|
|
|
659
820
|
sessions.setSubagentCatalogOpen(parentSessionId, open);
|
|
660
821
|
}
|
|
661
822
|
});
|
|
662
|
-
ctx.slots.inject("conversation.session.header.
|
|
663
|
-
name: "conversation.session.header.
|
|
664
|
-
id: "subagent-catalog",
|
|
665
|
-
order: 10,
|
|
823
|
+
ctx.slots.inject("conversation.session.header.lineage", () => ctx.slots.register({
|
|
824
|
+
name: "conversation.session.header.lineage",
|
|
666
825
|
locale: NS,
|
|
667
826
|
inject: catalogActions
|
|
668
|
-
},
|
|
827
|
+
}, SubagentHeaderLineage));
|
|
669
828
|
ctx.slots.inject("conversation.composer", () => ctx.slots.register({
|
|
670
829
|
name: "conversation.composer",
|
|
671
830
|
priority: -10,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SessionId, type SubagentAddress } from '@deepseek-ai/dsh-client-runtime/client';
|
|
2
|
+
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import { NS } from './locales.ts';
|
|
4
|
+
/** Business actions supplied by the slot registration. */
|
|
5
|
+
export interface SubagentCatalogInjected {
|
|
6
|
+
openChild: (address: SubagentAddress) => void;
|
|
7
|
+
refresh: (parentSessionId: SessionId) => void;
|
|
8
|
+
setCatalogOpen: (parentSessionId: SessionId, open: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Full props for the session-header lineage renderer. */
|
|
11
|
+
export type SubagentHeaderLineageProps = PropsRuntime<'conversation.session.header.lineage'> & SubagentCatalogInjected & PropsLocale<typeof NS>;
|
|
12
|
+
/**
|
|
13
|
+
* Render one breadcrumb title together with its subagent navigation.
|
|
14
|
+
* @param props - Breadcrumb title, session standard props, and catalog actions.
|
|
15
|
+
* @returns An ordinary-title descendant count, or a title-and-chevron sibling switcher.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SubagentHeaderLineage({ lineageSessionId, displayTitle, openTitle, useSessions, openChild, refresh, setCatalogOpen, t, }: SubagentHeaderLineageProps): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=SubagentHeaderLineage.d.ts.map
|
|
@@ -7,7 +7,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
7
7
|
'subagent': SubagentKey;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export type {
|
|
10
|
+
export type { SubagentCatalogInjected, SubagentHeaderLineageProps, } from './SubagentHeaderLineage.tsx';
|
|
11
11
|
export type { SubagentReadOnlyComposerProps, SubagentReadOnlyMatch, } from './SubagentReadOnlyComposer.tsx';
|
|
12
12
|
/** Required services for conversation slots and session navigation. */
|
|
13
13
|
export declare const inject: string[];
|
|
@@ -31,6 +31,7 @@ export declare const zh: {
|
|
|
31
31
|
readonly 'count.total.other': "{count} 个子代理";
|
|
32
32
|
readonly 'count.running.one': "{count} 个子代理,正在运行";
|
|
33
33
|
readonly 'count.running.other': "{count} 个子代理,正在运行";
|
|
34
|
+
readonly 'switcher.aria': "切换子代理:{title}";
|
|
34
35
|
readonly 'tree.aria': "子代理会话";
|
|
35
36
|
readonly 'readonly.oneShot.title': "一次性子代理记录";
|
|
36
37
|
readonly 'readonly.title': "此子代理暂时只读";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-ui-subagent",
|
|
3
3
|
"description": "Subagent conversation catalog, continuation routing UI, and '@' reference source",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -43,29 +43,31 @@
|
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@deepseek-ai/dsh-client-
|
|
47
|
-
"@deepseek-ai/dsh-client-
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/
|
|
46
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "^0.1.1-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-subagent": "^0.1.1-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-token-meter": "^0.1.1-rc.2",
|
|
53
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "~18.3.1",
|
|
57
|
+
"@types/react-dom": "~18.3.0",
|
|
57
58
|
"react": "^18.2.0",
|
|
58
|
-
"
|
|
59
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
60
|
-
"@deepseek-ai/dsh-client-
|
|
61
|
-
"@deepseek-ai/dsh-client-
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": "^0.1.
|
|
63
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
67
|
-
"@deepseek-ai/
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
59
|
+
"react-dom": "^18.2.0",
|
|
60
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-client-test-runtime": "^0.1.1-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "^0.1.1-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.1-rc.2",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
|
|
67
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
68
|
+
"@deepseek-ai/dsh-subagent": "^0.1.1-rc.2",
|
|
69
|
+
"@deepseek-ai/dsh-token-meter": "^0.1.1-rc.2",
|
|
70
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
69
71
|
},
|
|
70
72
|
"files": [
|
|
71
73
|
"lib/index.js",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type SessionId, type SubagentAddress } from '@deepseek-ai/dsh-client-runtime/client';
|
|
2
|
-
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
-
import { NS } from './locales.ts';
|
|
4
|
-
/** Business actions supplied by the slot registration. */
|
|
5
|
-
export interface SubagentCatalogInjected {
|
|
6
|
-
openChild: (address: SubagentAddress) => void;
|
|
7
|
-
refresh: (parentSessionId: SessionId) => void;
|
|
8
|
-
setCatalogOpen: (parentSessionId: SessionId, open: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
/** Full props for the session-header catalog action. */
|
|
11
|
-
export type SubagentCatalogActionProps = PropsRuntime<'conversation.session.header.actions'> & SubagentCatalogInjected & PropsLocale<typeof NS>;
|
|
12
|
-
/**
|
|
13
|
-
* Render the current session's direct catalog and lazily expanded descendants.
|
|
14
|
-
* @param props - session standard props plus catalog navigation actions.
|
|
15
|
-
* @returns The action while the catalog is pending or summaries establish descendants.
|
|
16
|
-
*/
|
|
17
|
-
export declare function SubagentCatalogAction({ sessionId, useSessions, openChild, refresh, setCatalogOpen, t, }: SubagentCatalogActionProps): import("react").JSX.Element | null;
|
|
18
|
-
//# sourceMappingURL=SubagentCatalogAction.d.ts.map
|