dsh-edge 0.1.0
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 +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +183 -0
- package/README.zh.md +183 -0
- package/THIRD_PARTY_NOTICES.md +199 -0
- package/dist/_headers +3 -0
- package/dist/assets/fonts/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/fonts/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/fonts/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/fonts/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/fonts/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/fonts/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/fonts/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/fonts/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/fonts/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/fonts/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/fonts/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/fonts/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/fonts/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/fonts/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/fonts/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/fonts/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/fonts/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/fonts/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/index-C-1AiF3k.js +112 -0
- package/dist/assets/index-CSGf6Qzd.css +1 -0
- package/dist/assets/langs/c-BIGW1oBm.js +2 -0
- package/dist/assets/langs/cpp-DIPi6g--.js +2 -0
- package/dist/assets/langs/csharp-DSvCPggb.js +2 -0
- package/dist/assets/langs/css-CLj8gQPS.js +2 -0
- package/dist/assets/langs/go-C27-OAKa.js +2 -0
- package/dist/assets/langs/html-CfGypltT.js +2 -0
- package/dist/assets/langs/ini-BEwlwnbL.js +2 -0
- package/dist/assets/langs/java-CylS5w8V.js +2 -0
- package/dist/assets/langs/kotlin-BdnUsdx6.js +2 -0
- package/dist/assets/langs/less-B1dDrJ26.js +2 -0
- package/dist/assets/langs/lua-BaeVxFsk.js +2 -0
- package/dist/assets/langs/markdown-Cvjx9yec.js +2 -0
- package/dist/assets/langs/mdx-Cmh6b_Ma.js +2 -0
- package/dist/assets/langs/php-D-uCvoST.js +2 -0
- package/dist/assets/langs/python-B6aJPvgy.js +2 -0
- package/dist/assets/langs/ruby-DEItuUFs.js +2 -0
- package/dist/assets/langs/rust-B1yitclQ.js +2 -0
- package/dist/assets/langs/scss-D5BDwBP9.js +2 -0
- package/dist/assets/langs/sql-CRqJ_cUM.js +2 -0
- package/dist/assets/langs/swift-D82vCrfD.js +2 -0
- package/dist/assets/langs/toml-vGWfd6FD.js +2 -0
- package/dist/assets/langs/xml-sdJ4AIDG.js +2 -0
- package/dist/assets/langs/yaml-Buea-lGh.js +2 -0
- package/dist/assets/vendor-Cjbwl5VI.js +411 -0
- package/dist/assets/vendor-CjyC-hUb.css +1 -0
- package/dist/favicon.svg +8 -0
- package/dist/index.html +35 -0
- package/dist/manifest.webmanifest +16 -0
- package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +420 -0
- package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +5937 -0
- package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +10207 -0
- package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +1231 -0
- package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +259 -0
- package/dist/plugins/@deepseek-ai/dsh-client-runtime/client.js +10539 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1725 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +1116 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +9832 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +373 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-edge/client.js +549 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +859 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +280 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +456 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +804 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +461 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +254 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +609 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +292 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +327 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +710 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +1312 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +1630 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +7370 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +700 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +474 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2426 -0
- package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +1372 -0
- package/package.json +97 -0
- package/scripts/assemble-web.mjs +230 -0
- package/scripts/bundle-size.d.mts +2 -0
- package/scripts/bundle-size.mjs +26 -0
- package/scripts/bundle.mjs +53 -0
- package/scripts/cli.d.mts +39 -0
- package/scripts/cli.mjs +496 -0
- package/scripts/install.d.mts +149 -0
- package/scripts/install.mjs +989 -0
- package/scripts/legal-files.mjs +24 -0
- package/scripts/verify-packed.mjs +32 -0
- package/scripts/wrangler-config.d.mts +18 -0
- package/scripts/wrangler-config.mjs +84 -0
- package/src/agent.ts +119 -0
- package/src/auth.ts +352 -0
- package/src/deepseek.ts +231 -0
- package/src/deployment.ts +147 -0
- package/src/direct-shell-core-empty.ts +10 -0
- package/src/direct-shell-protocol.ts +5 -0
- package/src/direct-shell.ts +341 -0
- package/src/do-session-persistence.ts +1064 -0
- package/src/edge-api.ts +796 -0
- package/src/edge-credentials.ts +56 -0
- package/src/edge-remotes.ts +41 -0
- package/src/edge-workspace-store.ts +339 -0
- package/src/http.ts +212 -0
- package/src/index.ts +196 -0
- package/src/instance.ts +1007 -0
- package/src/isolated-direct-shell-unavailable.ts +11 -0
- package/src/protocol.ts +39 -0
- package/src/release.ts +9 -0
- package/src/session-store.ts +1110 -0
- package/src/sse.ts +86 -0
- package/src/web-search.ts +38 -0
- package/src/workspace.ts +270 -0
- package/wrangler.jsonc +56 -0
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@deepseek-ai/dsh-client-ui-subagent",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
10
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
+
//#region \0dsh-css:/private/var/folders/nm/n5smty9962gf5rhjc5855kt80000gn/T/dsh-edge-release-worktree.XXXXXX.RcJjogaGt4/repo/packages/client/ui-subagent/src/client/SubagentCatalogAction.module.css.mjs
|
|
12
|
+
const css$1 = ".tJiq6W_root{position:relative}.tJiq6W_trigger{min-height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:3px;padding:3px 2px;font-size:12px;line-height:18px;display:inline-flex}.tJiq6W_count{margin:0 5px}.tJiq6W_activitySlot{flex:none;width:10px;height:10px;display:inline-flex}.tJiq6W_trigger:hover,.tJiq6W_trigger:focus-visible{color:var(--dsw-alias-label-secondary)}.tJiq6W_trigger svg{transition:transform .12s}.tJiq6W_triggerOpen{transform:rotate(180deg)}.tJiq6W_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:absolute;top:calc(100% + 5px);left:0;overflow:auto}.tJiq6W_node{min-width:0;position:relative}.tJiq6W_menu>.tJiq6W_node{margin-left:-3px}.tJiq6W_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}.tJiq6W_row:hover>.tJiq6W_clickarea,.tJiq6W_row:focus-visible>.tJiq6W_clickarea{background:var(--dsw-alias-interactive-bg-hover)}.tJiq6W_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}.tJiq6W_row>[data-state],.tJiq6W_clickarea>[data-state]{margin-top:4px}.tJiq6W_disabled{color:var(--dsw-alias-label-dimmed);cursor:not-allowed}.tJiq6W_disabled:hover{background:0 0}.tJiq6W_loadingRow{cursor:default}.tJiq6W_disclosure,.tJiq6W_disclosureSpace{flex:none;width:14px;height:18px}.tJiq6W_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}.tJiq6W_disclosure:hover{color:var(--dsw-alias-label-primary)}.tJiq6W_disclosureOpen{transform:rotate(90deg)}.tJiq6W_content{flex-direction:column;flex:1;min-width:0;display:flex}.tJiq6W_label,.tJiq6W_summary{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.tJiq6W_label{color:inherit;font-weight:400}.tJiq6W_summary,.tJiq6W_metrics{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.tJiq6W_metrics{font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;flex:none;grid-template-rows:18px 16px;display:grid}.tJiq6W_metricToken{grid-row:1;line-height:18px}.tJiq6W_metricDuration{grid-row:2}.tJiq6W_children{margin-left:18px;padding-left:4px;position:relative}.tJiq6W_children:before,.tJiq6W_children>.tJiq6W_node:before{content:\"\";border-left:1px solid var(--dsw-alias-border-l2);position:absolute;left:0}.tJiq6W_children:before{height:26px;top:-26px}.tJiq6W_children[aria-busy=true]:before{content:none}.tJiq6W_children>.tJiq6W_node:before{top:0;bottom:0;left:-4px}.tJiq6W_children>.tJiq6W_node:last-child:before{height:17px;bottom:auto}.tJiq6W_children>.tJiq6W_node>.tJiq6W_row:before{content:\"\";border-top:1px solid var(--dsw-alias-border-l2);width:14px;position:absolute;top:16px;left:-4px}.tJiq6W_notice,.tJiq6W_error{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.tJiq6W_error{color:var(--dsw-alias-state-error-primary);justify-content:space-between;align-items:center;gap:12px;display:flex}.tJiq6W_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}.tJiq6W_refresh:hover{background:var(--dsw-alias-interactive-bg-hover)}";
|
|
13
|
+
const tagId$1 = "@deepseek-ai/dsh-client-ui-subagent/SubagentCatalogAction.module.css";
|
|
14
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
15
|
+
const tag = document.createElement("style");
|
|
16
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-subagent";
|
|
17
|
+
tag.dataset.pluginCss = tagId$1;
|
|
18
|
+
tag.textContent = css$1;
|
|
19
|
+
document.head.appendChild(tag);
|
|
20
|
+
}
|
|
21
|
+
var SubagentCatalogAction_module_css_default = {
|
|
22
|
+
"count": "tJiq6W_count",
|
|
23
|
+
"activitySlot": "tJiq6W_activitySlot",
|
|
24
|
+
"label": "tJiq6W_label",
|
|
25
|
+
"metrics": "tJiq6W_metrics",
|
|
26
|
+
"notice": "tJiq6W_notice",
|
|
27
|
+
"content": "tJiq6W_content",
|
|
28
|
+
"root": "tJiq6W_root",
|
|
29
|
+
"metricDuration": "tJiq6W_metricDuration",
|
|
30
|
+
"children": "tJiq6W_children",
|
|
31
|
+
"summary": "tJiq6W_summary",
|
|
32
|
+
"disclosureOpen": "tJiq6W_disclosureOpen",
|
|
33
|
+
"triggerOpen": "tJiq6W_triggerOpen",
|
|
34
|
+
"disabled": "tJiq6W_disabled",
|
|
35
|
+
"error": "tJiq6W_error",
|
|
36
|
+
"loadingRow": "tJiq6W_loadingRow",
|
|
37
|
+
"disclosure": "tJiq6W_disclosure",
|
|
38
|
+
"refresh": "tJiq6W_refresh",
|
|
39
|
+
"metricToken": "tJiq6W_metricToken",
|
|
40
|
+
"trigger": "tJiq6W_trigger",
|
|
41
|
+
"menu": "tJiq6W_menu",
|
|
42
|
+
"clickarea": "tJiq6W_clickarea",
|
|
43
|
+
"node": "tJiq6W_node",
|
|
44
|
+
"row": "tJiq6W_row",
|
|
45
|
+
"disclosureSpace": "tJiq6W_disclosureSpace"
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region lib/types/client/SubagentCatalogAction.js
|
|
49
|
+
function diagnosticReason(entry, t) {
|
|
50
|
+
switch (entry.reason) {
|
|
51
|
+
case "corrupt": return t("diagnostic.corrupt");
|
|
52
|
+
case "unsupported": return t("diagnostic.unsupported");
|
|
53
|
+
case "unavailable": return t("diagnostic.unavailable");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function treeItems(root) {
|
|
57
|
+
return root === null ? [] : Array.from(root.querySelectorAll("[role=\"treeitem\"]:not([aria-disabled=\"true\"])"));
|
|
58
|
+
}
|
|
59
|
+
/** Compact token count shared in shape with the conversation stats strip. */
|
|
60
|
+
function formatTokens(value) {
|
|
61
|
+
const scaled = (next) => next >= 100 ? String(Math.round(next)) : String(Math.round(next * 10) / 10);
|
|
62
|
+
if (value < 1e3) return String(value);
|
|
63
|
+
if (value < 1e6) return `${scaled(value / 1e3)}K`;
|
|
64
|
+
return `${scaled(value / 1e6)}M`;
|
|
65
|
+
}
|
|
66
|
+
/** Sum the four disjoint durable provider-usage buckets. */
|
|
67
|
+
function tokenTotal(usage) {
|
|
68
|
+
return usage === void 0 ? void 0 : usage.uncachedInputTokens + usage.outputTokens + usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
69
|
+
}
|
|
70
|
+
/** Exact whole-second active-turn duration for one catalog row. */
|
|
71
|
+
function activityDuration(summary, activity, now) {
|
|
72
|
+
if (summary === void 0) return void 0;
|
|
73
|
+
const timing = summary.projectionValues?.subagentTiming;
|
|
74
|
+
if (timing === void 0) return void 0;
|
|
75
|
+
if (timing.active === void 0) return timing.settledMs;
|
|
76
|
+
const end = activity === "running" ? now : timing.active.through;
|
|
77
|
+
return timing.settledMs + Math.max(0, end - timing.active.since);
|
|
78
|
+
}
|
|
79
|
+
function splitDuration(ms) {
|
|
80
|
+
const totalSeconds = Math.floor(Math.max(0, ms) / 1e3);
|
|
81
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
82
|
+
const totalHours = Math.floor(totalMinutes / 60);
|
|
83
|
+
return {
|
|
84
|
+
seconds: totalSeconds % 60,
|
|
85
|
+
minutes: totalMinutes % 60,
|
|
86
|
+
hours: totalHours % 24,
|
|
87
|
+
days: Math.floor(totalHours / 24),
|
|
88
|
+
totalMinutes,
|
|
89
|
+
totalHours
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Format a duration with decreasing visual precision at larger scales. */
|
|
93
|
+
function formatDuration(ms, t) {
|
|
94
|
+
const { seconds, minutes, hours, days, totalMinutes, totalHours } = splitDuration(ms);
|
|
95
|
+
if (days >= 365) {
|
|
96
|
+
const years = Math.floor(days / 365);
|
|
97
|
+
const months = Math.floor(days % 365 / 30);
|
|
98
|
+
return months === 0 ? t("duration.years", { years }) : t("duration.yearsMonths", {
|
|
99
|
+
years,
|
|
100
|
+
months
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (days >= 30) {
|
|
104
|
+
const months = Math.floor(days / 30);
|
|
105
|
+
const remainingDays = days % 30;
|
|
106
|
+
return remainingDays === 0 ? t("duration.months", { months }) : t("duration.monthsDays", {
|
|
107
|
+
months,
|
|
108
|
+
days: remainingDays
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (days > 0) return hours === 0 ? t("duration.days", { days }) : t("duration.daysHours", {
|
|
112
|
+
days,
|
|
113
|
+
hours
|
|
114
|
+
});
|
|
115
|
+
if (totalHours > 0) return t("duration.hours", {
|
|
116
|
+
hours: totalHours,
|
|
117
|
+
minutes: String(minutes).padStart(2, "0"),
|
|
118
|
+
seconds: String(seconds).padStart(2, "0")
|
|
119
|
+
});
|
|
120
|
+
if (totalMinutes > 0) return t("duration.minutes", {
|
|
121
|
+
minutes: totalMinutes,
|
|
122
|
+
seconds: String(seconds).padStart(2, "0")
|
|
123
|
+
});
|
|
124
|
+
return t("duration.seconds", { seconds });
|
|
125
|
+
}
|
|
126
|
+
/** Preserve exact whole seconds for hover and accessible naming. */
|
|
127
|
+
function formatExactDuration(ms, t) {
|
|
128
|
+
const { seconds, minutes, hours, days } = splitDuration(ms);
|
|
129
|
+
return days === 0 ? formatDuration(ms, t) : t("duration.exactDays", {
|
|
130
|
+
days,
|
|
131
|
+
hours: String(hours).padStart(2, "0"),
|
|
132
|
+
minutes: String(minutes).padStart(2, "0"),
|
|
133
|
+
seconds: String(seconds).padStart(2, "0")
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const NO_DESCENDANTS = {
|
|
137
|
+
count: 0,
|
|
138
|
+
runningCount: 0
|
|
139
|
+
};
|
|
140
|
+
/** Render the known direct-child shape while its authoritative catalog hydrates. */
|
|
141
|
+
function CatalogLoadingRows({ parentSessionId, summaries, level, t }) {
|
|
142
|
+
const children = Object.values(summaries).filter((summary) => summary.origin === "subagent" && summary.parentId === parentSessionId);
|
|
143
|
+
if (children.length === 0) return (0, react_jsx_runtime.jsx)("div", {
|
|
144
|
+
className: SubagentCatalogAction_module_css_default.notice,
|
|
145
|
+
children: t("loading.label")
|
|
146
|
+
});
|
|
147
|
+
return children.map((summary) => (0, react_jsx_runtime.jsx)("div", {
|
|
148
|
+
className: SubagentCatalogAction_module_css_default.node,
|
|
149
|
+
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
150
|
+
role: "treeitem",
|
|
151
|
+
"aria-disabled": "true",
|
|
152
|
+
"aria-level": level,
|
|
153
|
+
"aria-label": t("loading.aria"),
|
|
154
|
+
className: `${SubagentCatalogAction_module_css_default.row} ${SubagentCatalogAction_module_css_default.disabled} ${SubagentCatalogAction_module_css_default.loadingRow}`,
|
|
155
|
+
children: [
|
|
156
|
+
(0, react_jsx_runtime.jsx)("span", { className: SubagentCatalogAction_module_css_default.disclosureSpace }),
|
|
157
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: summary.running ? "ongoing" : "done" }),
|
|
158
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
159
|
+
className: SubagentCatalogAction_module_css_default.content,
|
|
160
|
+
children: (0, react_jsx_runtime.jsx)("span", {
|
|
161
|
+
className: SubagentCatalogAction_module_css_default.label,
|
|
162
|
+
children: t("loading.label")
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
}, summary.id));
|
|
168
|
+
}
|
|
169
|
+
/** 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 }) {
|
|
171
|
+
const emptyLoading = catalog.state === "loading" && catalog.entries.length === 0;
|
|
172
|
+
const reserveDisclosure = catalog.entries.some((entry) => entry.kind === "child" && entry.hasChildren);
|
|
173
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
174
|
+
emptyLoading && (0, react_jsx_runtime.jsx)(CatalogLoadingRows, {
|
|
175
|
+
parentSessionId,
|
|
176
|
+
summaries,
|
|
177
|
+
level,
|
|
178
|
+
t
|
|
179
|
+
}),
|
|
180
|
+
catalog.state === "error" && (0, react_jsx_runtime.jsxs)("div", {
|
|
181
|
+
className: SubagentCatalogAction_module_css_default.error,
|
|
182
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: catalog.error?.message ?? t("load.error") }), (0, react_jsx_runtime.jsxs)("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
className: SubagentCatalogAction_module_css_default.refresh,
|
|
185
|
+
onClick: () => {
|
|
186
|
+
refresh(parentSessionId);
|
|
187
|
+
},
|
|
188
|
+
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, {}), t("retry")]
|
|
189
|
+
})]
|
|
190
|
+
}),
|
|
191
|
+
catalog.entries.map((entry) => {
|
|
192
|
+
if (entry.kind === "diagnostic") {
|
|
193
|
+
const reason = diagnosticReason(entry, t);
|
|
194
|
+
return (0, react_jsx_runtime.jsx)("div", {
|
|
195
|
+
className: SubagentCatalogAction_module_css_default.node,
|
|
196
|
+
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
197
|
+
role: "treeitem",
|
|
198
|
+
"aria-disabled": "true",
|
|
199
|
+
"aria-level": level,
|
|
200
|
+
"aria-label": `${entry.id} ${reason}`,
|
|
201
|
+
className: `${SubagentCatalogAction_module_css_default.row} ${SubagentCatalogAction_module_css_default.disabled}`,
|
|
202
|
+
title: reason,
|
|
203
|
+
children: [
|
|
204
|
+
reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className: SubagentCatalogAction_module_css_default.disclosureSpace }),
|
|
205
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" }),
|
|
206
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
207
|
+
className: SubagentCatalogAction_module_css_default.content,
|
|
208
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
209
|
+
className: SubagentCatalogAction_module_css_default.label,
|
|
210
|
+
children: entry.id
|
|
211
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
212
|
+
className: SubagentCatalogAction_module_css_default.summary,
|
|
213
|
+
children: reason
|
|
214
|
+
})]
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
}, entry.id);
|
|
219
|
+
}
|
|
220
|
+
const childCatalog = catalogs[entry.id];
|
|
221
|
+
const isExpanded = expanded.has(entry.id);
|
|
222
|
+
const knownLeaf = !entry.hasChildren;
|
|
223
|
+
const childLoading = childCatalog === void 0 || childCatalog.state === "loading" && childCatalog.entries.length === 0;
|
|
224
|
+
const summary = summaries[entry.id];
|
|
225
|
+
const label = entry.label ?? entry.id;
|
|
226
|
+
const mode = entry.mode === "one-shot" ? t("mode.oneShot") : t("mode.continuable");
|
|
227
|
+
const activity = entry.activity === "running" ? t("activity.running") : t("activity.inactive");
|
|
228
|
+
const secondary = [
|
|
229
|
+
summary?.title,
|
|
230
|
+
mode,
|
|
231
|
+
activity
|
|
232
|
+
].filter((value) => value !== void 0).join(" · ");
|
|
233
|
+
const totalTokens = tokenTotal(summary?.projectionValues?.tokenUsage);
|
|
234
|
+
const durationMs = activityDuration(summary, entry.activity, now);
|
|
235
|
+
const tokenMetric = totalTokens === void 0 ? void 0 : `${formatTokens(totalTokens)} tok`;
|
|
236
|
+
const durationMetric = durationMs === void 0 ? void 0 : {
|
|
237
|
+
compact: formatDuration(durationMs, t),
|
|
238
|
+
exact: formatExactDuration(durationMs, t)
|
|
239
|
+
};
|
|
240
|
+
const metrics = [tokenMetric, durationMetric?.exact].filter((value) => value !== void 0).join(" · ");
|
|
241
|
+
const open = () => {
|
|
242
|
+
openChild({
|
|
243
|
+
parentSessionId,
|
|
244
|
+
childSessionId: entry.id,
|
|
245
|
+
mode: entry.mode
|
|
246
|
+
});
|
|
247
|
+
closeCatalog();
|
|
248
|
+
};
|
|
249
|
+
const handleKey = (event) => {
|
|
250
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
event.stopPropagation();
|
|
253
|
+
open();
|
|
254
|
+
} else if (event.key === "ArrowRight" && !knownLeaf && !isExpanded || event.key === "ArrowLeft" && isExpanded) {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
event.stopPropagation();
|
|
257
|
+
toggleBranch(entry.id);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const toggle = (event) => {
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
event.stopPropagation();
|
|
263
|
+
toggleBranch(entry.id);
|
|
264
|
+
};
|
|
265
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
266
|
+
className: SubagentCatalogAction_module_css_default.node,
|
|
267
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
268
|
+
role: "treeitem",
|
|
269
|
+
tabIndex: 0,
|
|
270
|
+
"aria-level": level,
|
|
271
|
+
"aria-label": [
|
|
272
|
+
label,
|
|
273
|
+
secondary,
|
|
274
|
+
metrics
|
|
275
|
+
].filter((value) => value !== "").join(" "),
|
|
276
|
+
...knownLeaf ? {} : { "aria-expanded": isExpanded },
|
|
277
|
+
className: SubagentCatalogAction_module_css_default.row,
|
|
278
|
+
onClick: open,
|
|
279
|
+
onKeyDown: handleKey,
|
|
280
|
+
children: [knownLeaf ? reserveDisclosure && (0, react_jsx_runtime.jsx)("span", { className: SubagentCatalogAction_module_css_default.disclosureSpace }) : (0, react_jsx_runtime.jsx)("button", {
|
|
281
|
+
type: "button",
|
|
282
|
+
tabIndex: -1,
|
|
283
|
+
className: `${SubagentCatalogAction_module_css_default.disclosure} ${isExpanded ? SubagentCatalogAction_module_css_default.disclosureOpen : ""}`,
|
|
284
|
+
"aria-label": t(isExpanded ? "branch.collapse" : "branch.expand", { label }),
|
|
285
|
+
onClick: toggle,
|
|
286
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, {})
|
|
287
|
+
}), (0, react_jsx_runtime.jsxs)("div", {
|
|
288
|
+
className: SubagentCatalogAction_module_css_default.clickarea,
|
|
289
|
+
children: [
|
|
290
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: entry.activity === "running" ? "ongoing" : "done" }),
|
|
291
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
292
|
+
className: SubagentCatalogAction_module_css_default.content,
|
|
293
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
294
|
+
className: SubagentCatalogAction_module_css_default.label,
|
|
295
|
+
children: label
|
|
296
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
297
|
+
className: SubagentCatalogAction_module_css_default.summary,
|
|
298
|
+
children: secondary
|
|
299
|
+
})]
|
|
300
|
+
}),
|
|
301
|
+
metrics !== "" && (0, react_jsx_runtime.jsxs)("span", {
|
|
302
|
+
className: SubagentCatalogAction_module_css_default.metrics,
|
|
303
|
+
children: [tokenMetric !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
304
|
+
className: SubagentCatalogAction_module_css_default.metricToken,
|
|
305
|
+
children: tokenMetric
|
|
306
|
+
}), durationMetric !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
307
|
+
className: SubagentCatalogAction_module_css_default.metricDuration,
|
|
308
|
+
title: t("duration.exactTitle", { duration: durationMetric.exact }),
|
|
309
|
+
children: durationMetric.compact
|
|
310
|
+
})]
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
})]
|
|
314
|
+
}), isExpanded && !knownLeaf && (0, react_jsx_runtime.jsx)("div", {
|
|
315
|
+
role: "group",
|
|
316
|
+
className: SubagentCatalogAction_module_css_default.children,
|
|
317
|
+
"aria-busy": childLoading || void 0,
|
|
318
|
+
children: childCatalog === void 0 ? (0, react_jsx_runtime.jsx)(CatalogLoadingRows, {
|
|
319
|
+
parentSessionId: entry.id,
|
|
320
|
+
summaries,
|
|
321
|
+
level: level + 1,
|
|
322
|
+
t
|
|
323
|
+
}) : (0, react_jsx_runtime.jsx)(CatalogRows, {
|
|
324
|
+
parentSessionId: entry.id,
|
|
325
|
+
catalog: childCatalog,
|
|
326
|
+
catalogs,
|
|
327
|
+
summaries,
|
|
328
|
+
expanded,
|
|
329
|
+
level: level + 1,
|
|
330
|
+
now,
|
|
331
|
+
openChild,
|
|
332
|
+
refresh,
|
|
333
|
+
toggleBranch,
|
|
334
|
+
closeCatalog,
|
|
335
|
+
t
|
|
336
|
+
})
|
|
337
|
+
})]
|
|
338
|
+
}, entry.id);
|
|
339
|
+
})
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Render the current session's direct catalog and lazily expanded descendants.
|
|
344
|
+
* @param props - session standard props plus catalog navigation actions.
|
|
345
|
+
* @returns The action while the catalog is pending or summaries establish descendants.
|
|
346
|
+
*/
|
|
347
|
+
function SubagentCatalogAction({ sessionId, useSessions, openChild, refresh, setCatalogOpen, t }) {
|
|
348
|
+
const catalogs = useSessions((state) => state.subagentsByParent);
|
|
349
|
+
const summaries = useSessions((state) => state.byId);
|
|
350
|
+
const catalog = catalogs[sessionId];
|
|
351
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
352
|
+
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
353
|
+
const [expanded, setExpanded] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
354
|
+
const rootRef = (0, react.useRef)(null);
|
|
355
|
+
const triggerRef = (0, react.useRef)(null);
|
|
356
|
+
const observedCatalogs = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
357
|
+
const setCatalogOpenRef = (0, react.useRef)(setCatalogOpen);
|
|
358
|
+
setCatalogOpenRef.current = setCatalogOpen;
|
|
359
|
+
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(sessionId) ?? NO_DESCENDANTS, [sessionId, summaries]);
|
|
361
|
+
const descendantCount = Math.max(healthy.length, descendants.count);
|
|
362
|
+
const totalCountKey = descendantCount === 1 ? "count.total.one" : "count.total.other";
|
|
363
|
+
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) ? {
|
|
365
|
+
entries: [],
|
|
366
|
+
parentAvailable: catalog?.parentAvailable ?? false,
|
|
367
|
+
state: "loading",
|
|
368
|
+
error: null
|
|
369
|
+
} : catalog;
|
|
370
|
+
const observeCatalog = (parentSessionId, next) => {
|
|
371
|
+
if (next) observedCatalogs.current.add(parentSessionId);
|
|
372
|
+
else observedCatalogs.current.delete(parentSessionId);
|
|
373
|
+
setCatalogOpen(parentSessionId, next);
|
|
374
|
+
};
|
|
375
|
+
const closeAllCatalogs = () => {
|
|
376
|
+
for (const parentSessionId of observedCatalogs.current) setCatalogOpen(parentSessionId, false);
|
|
377
|
+
observedCatalogs.current.clear();
|
|
378
|
+
setExpanded(/* @__PURE__ */ new Set());
|
|
379
|
+
};
|
|
380
|
+
const changeOpen = (next, restoreFocus = false) => {
|
|
381
|
+
setOpen(next);
|
|
382
|
+
if (next) {
|
|
383
|
+
setNow(Date.now());
|
|
384
|
+
observeCatalog(sessionId, true);
|
|
385
|
+
} else closeAllCatalogs();
|
|
386
|
+
if (restoreFocus) queueMicrotask(() => {
|
|
387
|
+
triggerRef.current?.focus();
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
const closeBranch = (root) => {
|
|
391
|
+
const closing = /* @__PURE__ */ new Set();
|
|
392
|
+
const visit = (parentSessionId) => {
|
|
393
|
+
if (closing.has(parentSessionId) || !expanded.has(parentSessionId)) return;
|
|
394
|
+
closing.add(parentSessionId);
|
|
395
|
+
const branch = catalogs[parentSessionId];
|
|
396
|
+
for (const entry of branch?.entries ?? []) if (entry.kind === "child") visit(entry.id);
|
|
397
|
+
};
|
|
398
|
+
visit(root);
|
|
399
|
+
for (const parentSessionId of closing) observeCatalog(parentSessionId, false);
|
|
400
|
+
setExpanded((current) => new Set([...current].filter((id) => !closing.has(id))));
|
|
401
|
+
};
|
|
402
|
+
const toggleBranch = (childSessionId) => {
|
|
403
|
+
if (expanded.has(childSessionId)) {
|
|
404
|
+
closeBranch(childSessionId);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
setExpanded((current) => new Set(current).add(childSessionId));
|
|
408
|
+
observeCatalog(childSessionId, true);
|
|
409
|
+
};
|
|
410
|
+
(0, react.useEffect)(() => {
|
|
411
|
+
if (!open) return;
|
|
412
|
+
const closeOutside = (event) => {
|
|
413
|
+
if (event.target instanceof Node && !rootRef.current?.contains(event.target)) changeOpen(false);
|
|
414
|
+
};
|
|
415
|
+
document.addEventListener("pointerdown", closeOutside);
|
|
416
|
+
return () => {
|
|
417
|
+
document.removeEventListener("pointerdown", closeOutside);
|
|
418
|
+
};
|
|
419
|
+
}, [open]);
|
|
420
|
+
(0, react.useEffect)(() => {
|
|
421
|
+
if (!open || descendants.runningCount === 0) return;
|
|
422
|
+
const timer = setInterval(() => {
|
|
423
|
+
setNow(Date.now());
|
|
424
|
+
}, 1e3);
|
|
425
|
+
return () => {
|
|
426
|
+
clearInterval(timer);
|
|
427
|
+
};
|
|
428
|
+
}, [open, descendants.runningCount]);
|
|
429
|
+
(0, react.useEffect)(() => () => {
|
|
430
|
+
for (const parentSessionId of observedCatalogs.current) setCatalogOpenRef.current(parentSessionId, false);
|
|
431
|
+
observedCatalogs.current.clear();
|
|
432
|
+
}, []);
|
|
433
|
+
const visible = presentedCatalog !== void 0 && (presentedCatalog.state === "error" || presentedCatalog.entries.length > 0 || descendantCount > 0);
|
|
434
|
+
(0, react.useEffect)(() => {
|
|
435
|
+
if (visible || !open) return;
|
|
436
|
+
setOpen(false);
|
|
437
|
+
closeAllCatalogs();
|
|
438
|
+
}, [visible, open]);
|
|
439
|
+
if (!visible) return null;
|
|
440
|
+
const focusAt = (index) => {
|
|
441
|
+
const items = treeItems(rootRef.current);
|
|
442
|
+
if (items.length === 0) return;
|
|
443
|
+
items[(index + items.length) % items.length]?.focus();
|
|
444
|
+
};
|
|
445
|
+
const navigate = (event) => {
|
|
446
|
+
const items = treeItems(rootRef.current);
|
|
447
|
+
const index = items.indexOf(document.activeElement);
|
|
448
|
+
if (event.key === "Escape") {
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
changeOpen(false, true);
|
|
451
|
+
} else if (event.key === "Home") {
|
|
452
|
+
event.preventDefault();
|
|
453
|
+
focusAt(0);
|
|
454
|
+
} else if (event.key === "End") {
|
|
455
|
+
event.preventDefault();
|
|
456
|
+
focusAt(items.length - 1);
|
|
457
|
+
} else if (event.key === "ArrowDown") {
|
|
458
|
+
event.preventDefault();
|
|
459
|
+
focusAt(index + 1);
|
|
460
|
+
} else if (event.key === "ArrowUp") {
|
|
461
|
+
event.preventDefault();
|
|
462
|
+
focusAt(index < 0 ? items.length - 1 : index - 1);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
466
|
+
className: SubagentCatalogAction_module_css_default.root,
|
|
467
|
+
ref: rootRef,
|
|
468
|
+
onKeyDown: navigate,
|
|
469
|
+
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
470
|
+
ref: triggerRef,
|
|
471
|
+
type: "button",
|
|
472
|
+
className: SubagentCatalogAction_module_css_default.trigger,
|
|
473
|
+
"aria-haspopup": "tree",
|
|
474
|
+
"aria-expanded": open,
|
|
475
|
+
"aria-label": t(descendants.runningCount > 0 ? runningCountKey : totalCountKey, { count: descendants.runningCount > 0 ? descendants.runningCount : descendantCount }),
|
|
476
|
+
onClick: () => {
|
|
477
|
+
changeOpen(!open);
|
|
478
|
+
},
|
|
479
|
+
onKeyDown: (event) => {
|
|
480
|
+
if (event.key !== "ArrowDown") return;
|
|
481
|
+
event.preventDefault();
|
|
482
|
+
if (!open) changeOpen(true);
|
|
483
|
+
queueMicrotask(() => {
|
|
484
|
+
focusAt(0);
|
|
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);
|
|
515
|
+
},
|
|
516
|
+
t
|
|
517
|
+
})
|
|
518
|
+
})]
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region \0dsh-css:/private/var/folders/nm/n5smty9962gf5rhjc5855kt80000gn/T/dsh-edge-release-worktree.XXXXXX.RcJjogaGt4/repo/packages/client/ui-subagent/src/client/SubagentReadOnlyComposer.module.css.mjs
|
|
523
|
+
const css = ".DQ7elq_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}.DQ7elq_frame strong{color:var(--dsw-alias-label-primary);font-weight:510}";
|
|
524
|
+
const tagId = "@deepseek-ai/dsh-client-ui-subagent/SubagentReadOnlyComposer.module.css";
|
|
525
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
526
|
+
const tag = document.createElement("style");
|
|
527
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-subagent";
|
|
528
|
+
tag.dataset.pluginCss = tagId;
|
|
529
|
+
tag.textContent = css;
|
|
530
|
+
document.head.appendChild(tag);
|
|
531
|
+
}
|
|
532
|
+
var SubagentReadOnlyComposer_module_css_default = { "frame": "DQ7elq_frame" };
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region lib/types/client/SubagentReadOnlyComposer.js
|
|
535
|
+
/**
|
|
536
|
+
* Explain why the normal composer is unavailable for an addressed child.
|
|
537
|
+
* @param props - selector-owned read-only reason plus standard slot props.
|
|
538
|
+
* @returns A read-only composer replacement.
|
|
539
|
+
*/
|
|
540
|
+
function SubagentReadOnlyComposer({ matched, t }) {
|
|
541
|
+
const oneShot = matched.reason === "one-shot";
|
|
542
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
543
|
+
className: SubagentReadOnlyComposer_module_css_default.frame,
|
|
544
|
+
role: "status",
|
|
545
|
+
children: [(0, react_jsx_runtime.jsx)("strong", { children: t(oneShot ? "readonly.oneShot.title" : "readonly.title") }), (0, react_jsx_runtime.jsx)("span", { children: t(oneShot ? "readonly.oneShot.body" : "readonly.body") })]
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region lib/types/client/locales.js
|
|
550
|
+
/** `subagent` namespace dictionaries. */
|
|
551
|
+
/** Dictionary namespace owned by this plugin. */
|
|
552
|
+
const NS = "subagent";
|
|
553
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
554
|
+
const zh = {
|
|
555
|
+
"diagnostic.corrupt": "会话记录损坏",
|
|
556
|
+
"diagnostic.unsupported": "子代理记录版本不受支持",
|
|
557
|
+
"diagnostic.unavailable": "会话记录暂不可用",
|
|
558
|
+
"duration.seconds": "{seconds}秒",
|
|
559
|
+
"duration.minutes": "{minutes}分{seconds}秒",
|
|
560
|
+
"duration.hours": "{hours}小时{minutes}分{seconds}秒",
|
|
561
|
+
"duration.days": "{days}天",
|
|
562
|
+
"duration.daysHours": "{days}天{hours}小时",
|
|
563
|
+
"duration.months": "约{months}个月",
|
|
564
|
+
"duration.monthsDays": "约{months}个月{days}天",
|
|
565
|
+
"duration.years": "约{years}年",
|
|
566
|
+
"duration.yearsMonths": "约{years}年{months}个月",
|
|
567
|
+
"duration.exactDays": "{days}天{hours}小时{minutes}分{seconds}秒",
|
|
568
|
+
"duration.exactTitle": "总活跃耗时:{duration}",
|
|
569
|
+
"loading.label": "正在加载子代理…",
|
|
570
|
+
"loading.aria": "正在加载子代理",
|
|
571
|
+
"load.error": "无法加载子代理",
|
|
572
|
+
"retry": "重试",
|
|
573
|
+
"mode.oneShot": "一次性",
|
|
574
|
+
"mode.continuable": "可继续",
|
|
575
|
+
"activity.running": "正在运行",
|
|
576
|
+
"activity.inactive": "当前未运行",
|
|
577
|
+
"branch.collapse": "收起 {label} 的下级子代理",
|
|
578
|
+
"branch.expand": "展开 {label} 的下级子代理",
|
|
579
|
+
"count.total.one": "{count} 个子代理",
|
|
580
|
+
"count.total.other": "{count} 个子代理",
|
|
581
|
+
"count.running.one": "{count} 个子代理,正在运行",
|
|
582
|
+
"count.running.other": "{count} 个子代理,正在运行",
|
|
583
|
+
"tree.aria": "子代理会话",
|
|
584
|
+
"readonly.oneShot.title": "一次性子代理记录",
|
|
585
|
+
"readonly.title": "此子代理暂时只读",
|
|
586
|
+
"readonly.oneShot.body": "一次性任务不支持后续消息,可在这里查看完整执行记录。",
|
|
587
|
+
"readonly.body": "父会话当前不在线,重新打开父会话后即可继续发送消息。"
|
|
588
|
+
};
|
|
589
|
+
/** English dictionary, key-identical to the Chinese source of truth. */
|
|
590
|
+
const en = {
|
|
591
|
+
"diagnostic.corrupt": "corrupted session record",
|
|
592
|
+
"diagnostic.unsupported": "unsupported subagent record version",
|
|
593
|
+
"diagnostic.unavailable": "session record temporarily unavailable",
|
|
594
|
+
"duration.seconds": "{seconds}s",
|
|
595
|
+
"duration.minutes": "{minutes}m {seconds}s",
|
|
596
|
+
"duration.hours": "{hours}h {minutes}m {seconds}s",
|
|
597
|
+
"duration.days": "{days}d",
|
|
598
|
+
"duration.daysHours": "{days}d {hours}h",
|
|
599
|
+
"duration.months": "~{months}mo",
|
|
600
|
+
"duration.monthsDays": "~{months}mo {days}d",
|
|
601
|
+
"duration.years": "~{years}y",
|
|
602
|
+
"duration.yearsMonths": "~{years}y {months}mo",
|
|
603
|
+
"duration.exactDays": "{days}d {hours}h {minutes}m {seconds}s",
|
|
604
|
+
"duration.exactTitle": "Total active duration: {duration}",
|
|
605
|
+
"loading.label": "Loading subagents…",
|
|
606
|
+
"loading.aria": "Loading subagents",
|
|
607
|
+
"load.error": "Unable to load subagents",
|
|
608
|
+
"retry": "Retry",
|
|
609
|
+
"mode.oneShot": "one-shot",
|
|
610
|
+
"mode.continuable": "continuable",
|
|
611
|
+
"activity.running": "running",
|
|
612
|
+
"activity.inactive": "not running",
|
|
613
|
+
"branch.collapse": "Collapse {label} descendants",
|
|
614
|
+
"branch.expand": "Expand {label} descendants",
|
|
615
|
+
"count.total.one": "{count} subagent",
|
|
616
|
+
"count.total.other": "{count} subagents",
|
|
617
|
+
"count.running.one": "{count} subagent running",
|
|
618
|
+
"count.running.other": "{count} subagents running",
|
|
619
|
+
"tree.aria": "Subagent sessions",
|
|
620
|
+
"readonly.oneShot.title": "One-shot subagent record",
|
|
621
|
+
"readonly.title": "This subagent is read-only for now",
|
|
622
|
+
"readonly.oneShot.body": "One-shot tasks do not accept follow-ups; review the full execution record here.",
|
|
623
|
+
"readonly.body": "The parent session is offline; reopen it to continue sending messages."
|
|
624
|
+
};
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region lib/types/client/index.js
|
|
627
|
+
/** Required services for references, conversation slots, and session navigation. */
|
|
628
|
+
const inject = [
|
|
629
|
+
"inputTriggers",
|
|
630
|
+
"sessions",
|
|
631
|
+
"slots",
|
|
632
|
+
"locale"
|
|
633
|
+
];
|
|
634
|
+
/** Claim the composer for one-shot history or an unavailable continuation owner. */
|
|
635
|
+
function selectReadOnlySubagent(owner) {
|
|
636
|
+
const subagent = owner.session?.subagent;
|
|
637
|
+
if (subagent === void 0 || subagent === null) return null;
|
|
638
|
+
if (subagent.address.mode === "one-shot") return { reason: "one-shot" };
|
|
639
|
+
if (subagent.parentAvailable) return null;
|
|
640
|
+
return owner.session?.running === true ? null : { reason: "parent-unavailable" };
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Client plugin body: register the '@' subagent source over the root session list.
|
|
644
|
+
* @param ctx - client root context.
|
|
645
|
+
*/
|
|
646
|
+
function apply(ctx) {
|
|
647
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
648
|
+
zh,
|
|
649
|
+
en
|
|
650
|
+
}), "ui-subagent: dictionaries");
|
|
651
|
+
const sessions = ctx.sessions;
|
|
652
|
+
const childLabels = (session, query) => {
|
|
653
|
+
const { byId } = sessions.list.getSnapshot();
|
|
654
|
+
return Object.values(byId).filter((child) => child.parentId === session.sessionId && child.running && child.displayTitle.includes(query)).map((child) => child.displayTitle);
|
|
655
|
+
};
|
|
656
|
+
const source = {
|
|
657
|
+
trigger: "@",
|
|
658
|
+
name: "subagent",
|
|
659
|
+
candidates(session, { query }) {
|
|
660
|
+
return Promise.resolve(childLabels(session, query).map((name) => ({ name })));
|
|
661
|
+
},
|
|
662
|
+
lexicon(session) {
|
|
663
|
+
return childLabels(session, "");
|
|
664
|
+
},
|
|
665
|
+
subscribeLexicon(_session, listener) {
|
|
666
|
+
return sessions.list.subscribe(listener);
|
|
667
|
+
},
|
|
668
|
+
onPick({ candidate }) {
|
|
669
|
+
return { text: `@${candidate.name} ` };
|
|
670
|
+
},
|
|
671
|
+
codec: {
|
|
672
|
+
clipboardText: (ref) => `@${ref}`,
|
|
673
|
+
serialize: (ref) => Promise.resolve(`@${ref}`)
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
const inputTriggers = ctx.get("inputTriggers");
|
|
677
|
+
ctx.effect(() => inputTriggers.registerSource(source), "ui-subagent: @ source");
|
|
678
|
+
const catalogActions = (_parentSessionId) => ({
|
|
679
|
+
openChild(address) {
|
|
680
|
+
sessions.openSubagent(address);
|
|
681
|
+
},
|
|
682
|
+
refresh(parentSessionId) {
|
|
683
|
+
sessions.refreshSubagents(parentSessionId);
|
|
684
|
+
},
|
|
685
|
+
setCatalogOpen(parentSessionId, open) {
|
|
686
|
+
sessions.setSubagentCatalogOpen(parentSessionId, open);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
ctx.slots.inject("conversation.session.header.actions", () => ctx.slots.register({
|
|
690
|
+
name: "conversation.session.header.actions",
|
|
691
|
+
id: "subagent-catalog",
|
|
692
|
+
order: 10,
|
|
693
|
+
locale: NS,
|
|
694
|
+
inject: catalogActions
|
|
695
|
+
}, SubagentCatalogAction));
|
|
696
|
+
ctx.slots.inject("conversation.composer", () => ctx.slots.register({
|
|
697
|
+
name: "conversation.composer",
|
|
698
|
+
priority: -10,
|
|
699
|
+
locale: NS,
|
|
700
|
+
select: selectReadOnlySubagent
|
|
701
|
+
}, SubagentReadOnlyComposer));
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
exports.apply = apply;
|
|
705
|
+
exports.inject = inject;
|
|
706
|
+
return module.exports;
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
//# sourceMappingURL=client.js.map
|