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,292 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@deepseek-ai/dsh-client-ui-sidebar",
|
|
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_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
//#region ../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
11
|
+
function r(e) {
|
|
12
|
+
var t, f, n = "";
|
|
13
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
14
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
15
|
+
var o = e.length;
|
|
16
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
17
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
function clsx() {
|
|
21
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region \0dsh-css:/private/var/folders/nm/n5smty9962gf5rhjc5855kt80000gn/T/dsh-edge-release-worktree.XXXXXX.RcJjogaGt4/repo/packages/client/ui-sidebar/src/client/SidebarRoot.module.css.mjs
|
|
26
|
+
const css = "._1IXjqa_root{--dsh-sidebar-inline-padding:12px;height:100%;padding:6px var(--dsh-sidebar-inline-padding);box-sizing:border-box;background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);flex-direction:column;font-size:14px;display:flex}._1IXjqa_root._1IXjqa_collapsed{padding:18px 10px 6px}._1IXjqa_root._1IXjqa_quietBars{--dsh-scrollbar-thumb:transparent;--dsh-scrollbar-thumb-hover:transparent}._1IXjqa_fading>*{opacity:0;transition:opacity .15s var(--ds-ease-in-out)}._1IXjqa_wide{animation:_1IXjqa_wide-in .2s var(--ds-ease-in-out)}@keyframes _1IXjqa_wide-in{0%{opacity:0}}._1IXjqa_railIn ._1IXjqa_iconButton,._1IXjqa_railIn ._1IXjqa_newSession,._1IXjqa_railIn ._1IXjqa_regionArea{animation:_1IXjqa_rail-in .15s var(--ds-ease-in-out) backwards}._1IXjqa_railIn ._1IXjqa_footArea{animation:_1IXjqa_rail-fade-in .15s var(--ds-ease-in-out) backwards}@keyframes _1IXjqa_rail-in{0%{opacity:0;transform:translate(49px)}}@keyframes _1IXjqa_rail-fade-in{0%{opacity:0}}._1IXjqa_logoRow{box-sizing:border-box;flex:none;justify-content:flex-end;align-items:center;gap:8px;height:60px;margin-bottom:8px;padding:8px 0 8px 4px;display:flex;overflow:hidden}._1IXjqa_collapsed ._1IXjqa_logoRow{justify-content:flex-start;height:36px;margin-bottom:12px;padding:0}._1IXjqa_brand{min-width:0;color:inherit;cursor:pointer;background:0 0;border:none;flex:1;align-items:center;padding:0;display:inline-flex;overflow:hidden}._1IXjqa_iconButton{cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}._1IXjqa_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._1IXjqa_collapsed ._1IXjqa_iconButton{width:36px;height:36px}._1IXjqa_collapsed ._1IXjqa_toggle ._1IXjqa_panelIcon{display:none}._1IXjqa_collapsed ._1IXjqa_toggle:hover ._1IXjqa_panelIcon{display:inline}._1IXjqa_collapsed ._1IXjqa_toggle:hover ._1IXjqa_railFish{display:none}._1IXjqa_collapsed ._1IXjqa_iconButton{color:var(--dsw-alias-label-primary)}._1IXjqa_newSession{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-button-elevated-fill);height:38px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:12px;flex:none;justify-content:center;align-items:center;gap:6px;margin:0 2px 8px;padding:8px 16px;font-size:14px;font-weight:500;line-height:22px;display:flex;overflow:hidden}._1IXjqa_newSession:hover{background:var(--dsw-alias-button-floating-hover)}._1IXjqa_collapsed ._1IXjqa_newSession{background:0 0;border-color:#0000;align-self:flex-start;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}._1IXjqa_collapsed ._1IXjqa_newSession:hover{background:var(--dsw-alias-interactive-bg-hover)}._1IXjqa_newSessionLabel{white-space:nowrap;max-width:200px;overflow:hidden}._1IXjqa_collapsed ._1IXjqa_newSessionLabel{max-width:0}._1IXjqa_regionArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-sidebar-inline-padding));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:hidden}._1IXjqa_collapsed ._1IXjqa_regionArea{margin-left:0;margin-right:0;padding-left:0}._1IXjqa_footArea{flex-direction:column;flex:none;display:flex}._1IXjqa_settingsArea,._1IXjqa_footerActions{flex:none;width:100%;min-width:0}._1IXjqa_footerActions{display:flex}._1IXjqa_collapsed ._1IXjqa_footArea{align-items:center}._1IXjqa_collapsed ._1IXjqa_settingsArea,._1IXjqa_collapsed ._1IXjqa_footerActions{justify-content:center;width:auto;display:flex}@media (prefers-reduced-motion:reduce){._1IXjqa_wide,._1IXjqa_fading>*,._1IXjqa_railIn ._1IXjqa_iconButton,._1IXjqa_railIn ._1IXjqa_newSession,._1IXjqa_railIn ._1IXjqa_footArea,._1IXjqa_railIn ._1IXjqa_regionArea{transition:none;animation:none}}";
|
|
27
|
+
const tagId = "@deepseek-ai/dsh-client-ui-sidebar/SidebarRoot.module.css";
|
|
28
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
29
|
+
const tag = document.createElement("style");
|
|
30
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-sidebar";
|
|
31
|
+
tag.dataset.pluginCss = tagId;
|
|
32
|
+
tag.textContent = css;
|
|
33
|
+
document.head.appendChild(tag);
|
|
34
|
+
}
|
|
35
|
+
var SidebarRoot_module_css_default = {
|
|
36
|
+
"fading": "_1IXjqa_fading",
|
|
37
|
+
"logoRow": "_1IXjqa_logoRow",
|
|
38
|
+
"wide-in": "_1IXjqa_wide-in",
|
|
39
|
+
"regionArea": "_1IXjqa_regionArea",
|
|
40
|
+
"toggle": "_1IXjqa_toggle",
|
|
41
|
+
"root": "_1IXjqa_root",
|
|
42
|
+
"settingsArea": "_1IXjqa_settingsArea",
|
|
43
|
+
"footerActions": "_1IXjqa_footerActions",
|
|
44
|
+
"quietBars": "_1IXjqa_quietBars",
|
|
45
|
+
"iconButton": "_1IXjqa_iconButton",
|
|
46
|
+
"collapsed": "_1IXjqa_collapsed",
|
|
47
|
+
"newSession": "_1IXjqa_newSession",
|
|
48
|
+
"rail-fade-in": "_1IXjqa_rail-fade-in",
|
|
49
|
+
"rail-in": "_1IXjqa_rail-in",
|
|
50
|
+
"panelIcon": "_1IXjqa_panelIcon",
|
|
51
|
+
"railIn": "_1IXjqa_railIn",
|
|
52
|
+
"footArea": "_1IXjqa_footArea",
|
|
53
|
+
"newSessionLabel": "_1IXjqa_newSessionLabel",
|
|
54
|
+
"brand": "_1IXjqa_brand",
|
|
55
|
+
"wide": "_1IXjqa_wide",
|
|
56
|
+
"railFish": "_1IXjqa_railFish"
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region lib/types/client/SidebarRoot.js
|
|
60
|
+
/**
|
|
61
|
+
* Sidebar shell: column geometry only. Collapse is a slide plus crossfade:
|
|
62
|
+
* content freezes at its expanded width (inline style) and fades out in place
|
|
63
|
+
* while the sliding column (AppFrame grid tracks) clips it — nothing reflows
|
|
64
|
+
* mid-slide. At settle the wide-only content unmounts and the four upper
|
|
65
|
+
* controls enter the 56px rail from the same horizontal offset (one icon each,
|
|
66
|
+
* same top-down order) on one fade that ends with the slide. The bottom-pinned
|
|
67
|
+
* settings control only fades. The workspace/session browsing region between
|
|
68
|
+
* the New Session button and the foot is the `sidebar.workspaces` registrant's,
|
|
69
|
+
* and the foot holds `sidebar.settings` plus `sidebar.footer.action`; the shell
|
|
70
|
+
* hands them the wide flag (plus an expand request callback for the browser).
|
|
71
|
+
*
|
|
72
|
+
* The column also owns whether the scroll regions nested in it draw a
|
|
73
|
+
* scrollbar at all: the shell tracks the pointer and rebinds ui-theme's
|
|
74
|
+
* scrollbar indirection away while it is elsewhere, so a list the user is not
|
|
75
|
+
* pointing at carries no bar.
|
|
76
|
+
*/
|
|
77
|
+
/** Wide-content unmount delay; matches the 150ms wide-content fade-out. */
|
|
78
|
+
const COLLAPSE_SETTLE_MS = 150;
|
|
79
|
+
/**
|
|
80
|
+
* How long the column's scrollbars stay drawn after the pointer leaves it.
|
|
81
|
+
* The bar is a pointer affordance here, and hiding it on the leave event
|
|
82
|
+
* itself makes it blink out while the pointer is only crossing the column's
|
|
83
|
+
* edge — on the way to the conversation, or around a portalled menu.
|
|
84
|
+
*/
|
|
85
|
+
const SCROLLBAR_LINGER_MS = 2e3;
|
|
86
|
+
/**
|
|
87
|
+
* Render the sidebar column shell.
|
|
88
|
+
* @param props - composed slot props (runtime share + injected callbacks, contract/slots.ts).
|
|
89
|
+
* @returns the sidebar element tree.
|
|
90
|
+
*/
|
|
91
|
+
function SidebarRoot({ collapsed, width, startSession, toggleSidebar, t, renderSlot }) {
|
|
92
|
+
const [settled, setSettled] = (0, react.useState)(collapsed);
|
|
93
|
+
(0, react.useEffect)(() => {
|
|
94
|
+
if (!collapsed) {
|
|
95
|
+
setSettled(false);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const timer = window.setTimeout(() => {
|
|
99
|
+
setSettled(true);
|
|
100
|
+
}, COLLAPSE_SETTLE_MS);
|
|
101
|
+
return () => {
|
|
102
|
+
window.clearTimeout(timer);
|
|
103
|
+
};
|
|
104
|
+
}, [collapsed]);
|
|
105
|
+
const wide = !collapsed || !settled;
|
|
106
|
+
const lastWideWidth = (0, react.useRef)(width);
|
|
107
|
+
if (!collapsed) lastWideWidth.current = width;
|
|
108
|
+
const everWide = (0, react.useRef)(!collapsed);
|
|
109
|
+
if (!collapsed) everWide.current = true;
|
|
110
|
+
const column = (0, react.useRef)(null);
|
|
111
|
+
const [pointerInside, setPointerInside] = (0, react.useState)(false);
|
|
112
|
+
const lingerTimer = (0, react.useRef)(void 0);
|
|
113
|
+
const armLinger = () => {
|
|
114
|
+
if (lingerTimer.current !== void 0) return;
|
|
115
|
+
lingerTimer.current = window.setTimeout(() => {
|
|
116
|
+
lingerTimer.current = void 0;
|
|
117
|
+
setPointerInside(false);
|
|
118
|
+
}, SCROLLBAR_LINGER_MS);
|
|
119
|
+
};
|
|
120
|
+
const cancelLinger = () => {
|
|
121
|
+
window.clearTimeout(lingerTimer.current);
|
|
122
|
+
lingerTimer.current = void 0;
|
|
123
|
+
};
|
|
124
|
+
(0, react.useEffect)(() => {
|
|
125
|
+
if (!pointerInside) return;
|
|
126
|
+
const onMove = (event) => {
|
|
127
|
+
const rect = column.current?.getBoundingClientRect();
|
|
128
|
+
/* v8 ignore next -- the listener only exists while the column is mounted and revealed. */
|
|
129
|
+
if (rect === void 0) return;
|
|
130
|
+
if (event.clientX >= rect.left && event.clientX < rect.right && event.clientY >= rect.top && event.clientY < rect.bottom) cancelLinger();
|
|
131
|
+
else armLinger();
|
|
132
|
+
};
|
|
133
|
+
document.addEventListener("pointermove", onMove);
|
|
134
|
+
return () => {
|
|
135
|
+
document.removeEventListener("pointermove", onMove);
|
|
136
|
+
cancelLinger();
|
|
137
|
+
};
|
|
138
|
+
}, [pointerInside]);
|
|
139
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
140
|
+
ref: column,
|
|
141
|
+
className: clsx(SidebarRoot_module_css_default.root, !wide && SidebarRoot_module_css_default.collapsed, !wide && everWide.current && SidebarRoot_module_css_default.railIn, collapsed && wide && SidebarRoot_module_css_default.fading, !pointerInside && SidebarRoot_module_css_default.quietBars),
|
|
142
|
+
style: wide ? { width: collapsed ? lastWideWidth.current : width } : void 0,
|
|
143
|
+
onPointerEnter: () => {
|
|
144
|
+
cancelLinger();
|
|
145
|
+
setPointerInside(true);
|
|
146
|
+
},
|
|
147
|
+
onPointerLeave: () => {
|
|
148
|
+
armLinger();
|
|
149
|
+
},
|
|
150
|
+
children: [
|
|
151
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
152
|
+
className: SidebarRoot_module_css_default.logoRow,
|
|
153
|
+
children: [wide && (0, react_jsx_runtime.jsx)("button", {
|
|
154
|
+
type: "button",
|
|
155
|
+
className: clsx(SidebarRoot_module_css_default.brand, SidebarRoot_module_css_default.wide),
|
|
156
|
+
"aria-label": t("session.new.label"),
|
|
157
|
+
onClick: () => {
|
|
158
|
+
startSession();
|
|
159
|
+
},
|
|
160
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.BrandWordmark, {})
|
|
161
|
+
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
162
|
+
label: collapsed ? t("toggle.open") : t("toggle.collapse"),
|
|
163
|
+
delayMs: 500,
|
|
164
|
+
children: (0, react_jsx_runtime.jsxs)("button", {
|
|
165
|
+
type: "button",
|
|
166
|
+
className: clsx(SidebarRoot_module_css_default.iconButton, SidebarRoot_module_css_default.toggle),
|
|
167
|
+
"aria-label": collapsed ? t("toggle.open") : t("toggle.collapse"),
|
|
168
|
+
onClick: () => {
|
|
169
|
+
toggleSidebar();
|
|
170
|
+
},
|
|
171
|
+
children: [!wide && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FishLogo, {
|
|
172
|
+
className: SidebarRoot_module_css_default.railFish,
|
|
173
|
+
size: 24
|
|
174
|
+
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPanelLeftOutline16, {
|
|
175
|
+
className: SidebarRoot_module_css_default.panelIcon,
|
|
176
|
+
size: wide ? 16 : 18
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
})]
|
|
180
|
+
}),
|
|
181
|
+
(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
182
|
+
label: t("session.new.label"),
|
|
183
|
+
delayMs: 500,
|
|
184
|
+
disabled: wide,
|
|
185
|
+
children: (0, react_jsx_runtime.jsxs)("button", {
|
|
186
|
+
type: "button",
|
|
187
|
+
className: SidebarRoot_module_css_default.newSession,
|
|
188
|
+
"aria-label": t("session.new.label"),
|
|
189
|
+
onClick: () => {
|
|
190
|
+
startSession();
|
|
191
|
+
},
|
|
192
|
+
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconNewChatOutline16, { size: wide ? 14 : 18 }), wide && (0, react_jsx_runtime.jsx)("span", {
|
|
193
|
+
className: clsx(SidebarRoot_module_css_default.newSessionLabel, SidebarRoot_module_css_default.wide),
|
|
194
|
+
children: t("session.new")
|
|
195
|
+
})]
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
199
|
+
className: SidebarRoot_module_css_default.regionArea,
|
|
200
|
+
children: renderSlot("sidebar.workspaces", {
|
|
201
|
+
wide,
|
|
202
|
+
expandSidebar: () => {
|
|
203
|
+
if (collapsed) toggleSidebar();
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
}),
|
|
207
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
208
|
+
className: SidebarRoot_module_css_default.footArea,
|
|
209
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
210
|
+
className: SidebarRoot_module_css_default.footerActions,
|
|
211
|
+
children: renderSlot("sidebar.footer.action", { wide })
|
|
212
|
+
}), (0, react_jsx_runtime.jsx)("div", {
|
|
213
|
+
className: SidebarRoot_module_css_default.settingsArea,
|
|
214
|
+
children: renderSlot("sidebar.settings", { wide })
|
|
215
|
+
})]
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region lib/types/client/locales.js
|
|
222
|
+
/** `sidebar` namespace dictionaries: shell controls (brand row, New Session, fold toggle). */
|
|
223
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
224
|
+
const zh = {
|
|
225
|
+
"session.new": "新会话",
|
|
226
|
+
"session.new.label": "新建会话",
|
|
227
|
+
"toggle.open": "打开侧边栏",
|
|
228
|
+
"toggle.collapse": "收起侧边栏"
|
|
229
|
+
};
|
|
230
|
+
/** English dictionary, checked complete against the zh key set. */
|
|
231
|
+
const en = {
|
|
232
|
+
"session.new": "New Session",
|
|
233
|
+
"session.new.label": "New session",
|
|
234
|
+
"toggle.open": "Open sidebar",
|
|
235
|
+
"toggle.collapse": "Collapse sidebar"
|
|
236
|
+
};
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region lib/types/client/index.js
|
|
239
|
+
/** Dictionary namespace owned by this plugin (shell controls copy). */
|
|
240
|
+
const NS = "sidebar";
|
|
241
|
+
/** Services required by the sidebar plugin. */
|
|
242
|
+
const inject = [
|
|
243
|
+
"slots",
|
|
244
|
+
"layout",
|
|
245
|
+
"sessions",
|
|
246
|
+
"workspaces",
|
|
247
|
+
"locale"
|
|
248
|
+
];
|
|
249
|
+
/** Registers the sidebar shell and its service callbacks.
|
|
250
|
+
* @param ctx - Client root context.
|
|
251
|
+
*/
|
|
252
|
+
function apply(ctx) {
|
|
253
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
254
|
+
zh,
|
|
255
|
+
en
|
|
256
|
+
}), "ui-sidebar: dictionaries");
|
|
257
|
+
const injectProps = () => ({
|
|
258
|
+
startSession: (workspaceId) => {
|
|
259
|
+
ctx.workspaces.startSession(workspaceId);
|
|
260
|
+
},
|
|
261
|
+
toggleSidebar: () => {
|
|
262
|
+
ctx.layout.toggleSidebar();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
ctx.effect(() => ctx.slots.register({
|
|
266
|
+
name: "sidebar",
|
|
267
|
+
locale: NS,
|
|
268
|
+
children: {
|
|
269
|
+
"sidebar.workspaces": {
|
|
270
|
+
kind: "single",
|
|
271
|
+
scope: "root"
|
|
272
|
+
},
|
|
273
|
+
"sidebar.settings": {
|
|
274
|
+
kind: "single",
|
|
275
|
+
scope: "root"
|
|
276
|
+
},
|
|
277
|
+
"sidebar.footer.action": {
|
|
278
|
+
kind: "list",
|
|
279
|
+
scope: "root"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
inject: injectProps
|
|
283
|
+
}, SidebarRoot), "ui-sidebar: slot registration");
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
exports.apply = apply;
|
|
287
|
+
exports.inject = inject;
|
|
288
|
+
return module.exports;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@deepseek-ai/dsh-client-ui-skill",
|
|
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_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
//#region \0dsh-css:/private/var/folders/nm/n5smty9962gf5rhjc5855kt80000gn/T/dsh-edge-release-worktree.XXXXXX.RcJjogaGt4/repo/packages/client/ui-skill/src/client/SkillRow.module.css.mjs
|
|
11
|
+
const css = ".cYSfkG_card{flex-direction:column;display:flex}.cYSfkG_row{align-items:center;min-width:0;height:24px;display:flex;position:relative;overflow:hidden}.cYSfkG_row[data-expandable]{cursor:pointer}.cYSfkG_card[data-state=running] .cYSfkG_row:after{content:\"\";background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite cYSfkG_dsh-skill-row-sweep;position:absolute;inset:0 auto 0 0}@keyframes cYSfkG_dsh-skill-row-sweep{0%{left:-300px}90%,to{left:100%}}.cYSfkG_leading{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;margin-right:6px;display:inline-flex;position:relative}.cYSfkG_chevron{color:var(--dsw-alias-label-secondary)}.cYSfkG_iconIdle{opacity:1;transition:opacity .1s;display:inline-flex}.cYSfkG_chevronHover{opacity:0;margin:auto;transition:opacity .1s;position:absolute;inset:0}.cYSfkG_row:hover .cYSfkG_iconIdle{opacity:0}.cYSfkG_row:hover .cYSfkG_chevronHover{opacity:1}.cYSfkG_title{color:var(--dsw-alias-label-secondary);flex:none;font-size:14px;line-height:24px}.cYSfkG_separator{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.cYSfkG_summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-tertiary);flex:auto;font-size:14px;line-height:24px;overflow:hidden}.cYSfkG_errorSummary{color:var(--dsw-alias-state-error-primary)}.cYSfkG_bodyWrap{flex-direction:column;display:flex}.cYSfkG_instructionsCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-markdown-code-block);border-radius:12px;flex-direction:column;max-height:260px;margin:4px 0 4px 4px;display:flex;overflow:hidden}.cYSfkG_instructionsHeader{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-markdown-code-block-banner);color:var(--dsw-alias-label-caption);text-transform:uppercase;letter-spacing:.04em;flex:none;padding:8px 12px;font-size:11px;font-weight:500;line-height:16px}.cYSfkG_instructions{white-space:pre-wrap;overflow-wrap:anywhere;min-height:0;font:var(--dsw-font-markdown-code-block-small);color:var(--dsw-alias-label-secondary);margin:0;padding:10px 12px 12px;overflow:auto}.cYSfkG_instructions[data-error]{color:var(--dsw-alias-state-error-primary)}.cYSfkG_instructions::-webkit-scrollbar-thumb{background-clip:padding-box;border:2px solid #0000;border-radius:6px}.cYSfkG_instructions::-webkit-scrollbar-track{margin:6px 0}.cYSfkG_inspectButton{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);cursor:pointer;opacity:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin:4px 0 2px 4px;padding:2px 8px;font-size:11px;line-height:16px;transition:opacity .1s;display:inline-flex}.cYSfkG_card:hover .cYSfkG_inspectButton,.cYSfkG_inspectButton:focus-visible{opacity:1}.cYSfkG_inspectButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.cYSfkG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.cYSfkG_card[data-state=running] .cYSfkG_row:after{animation:none;display:none}.cYSfkG_iconIdle,.cYSfkG_chevronHover,.cYSfkG_inspectButton{transition:none}}";
|
|
12
|
+
const tagId = "@deepseek-ai/dsh-client-ui-skill/SkillRow.module.css";
|
|
13
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
14
|
+
const tag = document.createElement("style");
|
|
15
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-skill";
|
|
16
|
+
tag.dataset.pluginCss = tagId;
|
|
17
|
+
tag.textContent = css;
|
|
18
|
+
document.head.appendChild(tag);
|
|
19
|
+
}
|
|
20
|
+
var SkillRow_module_css_default = {
|
|
21
|
+
"summary": "cYSfkG_summary",
|
|
22
|
+
"bodyWrap": "cYSfkG_bodyWrap",
|
|
23
|
+
"iconIdle": "cYSfkG_iconIdle",
|
|
24
|
+
"inspectButton": "cYSfkG_inspectButton",
|
|
25
|
+
"instructionsCard": "cYSfkG_instructionsCard",
|
|
26
|
+
"instructionsHeader": "cYSfkG_instructionsHeader",
|
|
27
|
+
"leading": "cYSfkG_leading",
|
|
28
|
+
"separator": "cYSfkG_separator",
|
|
29
|
+
"title": "cYSfkG_title",
|
|
30
|
+
"row": "cYSfkG_row",
|
|
31
|
+
"dsh-skill-row-sweep": "cYSfkG_dsh-skill-row-sweep",
|
|
32
|
+
"instructions": "cYSfkG_instructions",
|
|
33
|
+
"visuallyHidden": "cYSfkG_visuallyHidden",
|
|
34
|
+
"card": "cYSfkG_card",
|
|
35
|
+
"chevron": "cYSfkG_chevron",
|
|
36
|
+
"chevronHover": "cYSfkG_chevronHover",
|
|
37
|
+
"errorSummary": "cYSfkG_errorSummary"
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region lib/types/client/SkillRow.js
|
|
41
|
+
/** First physical line for the collapsed error summary and malformed-args fallback. */
|
|
42
|
+
function firstLine(text) {
|
|
43
|
+
const newline = text.indexOf("\n");
|
|
44
|
+
return newline === -1 ? text : text.slice(0, newline);
|
|
45
|
+
}
|
|
46
|
+
/** Skill names are the only call argument the compact row presents. */
|
|
47
|
+
function skillName(argsRaw, callId) {
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(argsRaw);
|
|
50
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
51
|
+
const name = parsed.name;
|
|
52
|
+
if (typeof name === "string" && name !== "") return firstLine(name);
|
|
53
|
+
}
|
|
54
|
+
} catch {}
|
|
55
|
+
return argsRaw === "" ? callId : firstLine(argsRaw);
|
|
56
|
+
}
|
|
57
|
+
/** Flatten durable result blocks under the generic Tool-row text contract.
|
|
58
|
+
* Keep aligned with ui-tool's models/tool-call-model.ts `resultText`. */
|
|
59
|
+
function resultText(block) {
|
|
60
|
+
if (!("kind" in block)) return null;
|
|
61
|
+
const parts = [];
|
|
62
|
+
for (const item of block.content) parts.push(item.type === "text" ? item.text : JSON.stringify(item, null, 2));
|
|
63
|
+
if (parts.length === 0 && block.error !== void 0) parts.push(`${block.error.name}: ${block.error.code}`);
|
|
64
|
+
return parts.join("\n") || null;
|
|
65
|
+
}
|
|
66
|
+
/** Derive display state without consulting the live skill catalog. */
|
|
67
|
+
function skillRowModel(block) {
|
|
68
|
+
const settled = "kind" in block;
|
|
69
|
+
const argsRaw = (settled ? block.call?.argsRaw : block.argsRaw) ?? "";
|
|
70
|
+
const state = !settled ? "running" : block.error?.code === "interrupted" ? "stopped" : block.isError ? "error" : "ok";
|
|
71
|
+
const output = resultText(block);
|
|
72
|
+
return {
|
|
73
|
+
name: skillName(argsRaw, block.callId),
|
|
74
|
+
output,
|
|
75
|
+
errorSummary: state === "error" && output !== null ? firstLine(output) : null,
|
|
76
|
+
state
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** State substitution for the collapsed leading slot. */
|
|
80
|
+
function leadingFor(state) {
|
|
81
|
+
switch (state) {
|
|
82
|
+
case "error": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" });
|
|
83
|
+
case "stopped": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "warning" });
|
|
84
|
+
default: return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSkillOutline16, { size: 14 });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Leading disclosure slot: state icon at rest, chevron on hover or while open. */
|
|
88
|
+
function disclosureLeading(state, open, expandable) {
|
|
89
|
+
if (open) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: SkillRow_module_css_default.chevron });
|
|
90
|
+
const icon = leadingFor(state);
|
|
91
|
+
if (!expandable) return icon;
|
|
92
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
|
|
93
|
+
className: SkillRow_module_css_default.iconIdle,
|
|
94
|
+
children: icon
|
|
95
|
+
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: `${SkillRow_module_css_default.chevron} ${SkillRow_module_css_default.chevronHover}` })] });
|
|
96
|
+
}
|
|
97
|
+
/** Visually hidden state copy for the colour-only lifecycle cues. */
|
|
98
|
+
function stateStatus(state, t) {
|
|
99
|
+
switch (state) {
|
|
100
|
+
case "running": return t("row.running");
|
|
101
|
+
case "error": return t("row.failed");
|
|
102
|
+
case "stopped": return t("row.stopped");
|
|
103
|
+
default: return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Render one `skill` tool call as an accent summary and instructions disclosure.
|
|
108
|
+
* @param props - keyed toolview payload plus the skill locale seat.
|
|
109
|
+
* @returns the dedicated skill row.
|
|
110
|
+
*/
|
|
111
|
+
function SkillRow({ block, inspect, t }) {
|
|
112
|
+
const model = skillRowModel(block);
|
|
113
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
114
|
+
const expandable = model.output !== null;
|
|
115
|
+
const open = expanded && expandable;
|
|
116
|
+
const status = stateStatus(model.state, t);
|
|
117
|
+
const summary = model.errorSummary ?? model.name;
|
|
118
|
+
const toggleExpand = () => {
|
|
119
|
+
setExpanded((value) => !value);
|
|
120
|
+
};
|
|
121
|
+
const toggleFromKeyboard = (event) => {
|
|
122
|
+
if (!expandable || event.key !== "Enter" && event.key !== " ") return;
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
toggleExpand();
|
|
125
|
+
};
|
|
126
|
+
const disclosureProps = expandable ? {
|
|
127
|
+
role: "button",
|
|
128
|
+
tabIndex: 0,
|
|
129
|
+
"aria-expanded": open,
|
|
130
|
+
onClick: toggleExpand,
|
|
131
|
+
onKeyDown: toggleFromKeyboard
|
|
132
|
+
} : {};
|
|
133
|
+
const leading = disclosureLeading(model.state, open, expandable);
|
|
134
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
135
|
+
className: SkillRow_module_css_default.card,
|
|
136
|
+
"data-tool": "skill",
|
|
137
|
+
"data-state": model.state,
|
|
138
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
139
|
+
className: SkillRow_module_css_default.row,
|
|
140
|
+
"data-expandable": expandable || void 0,
|
|
141
|
+
...disclosureProps,
|
|
142
|
+
children: [
|
|
143
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
144
|
+
className: SkillRow_module_css_default.leading,
|
|
145
|
+
children: leading
|
|
146
|
+
}),
|
|
147
|
+
status !== null ? (0, react_jsx_runtime.jsx)("span", {
|
|
148
|
+
className: SkillRow_module_css_default.visuallyHidden,
|
|
149
|
+
children: status
|
|
150
|
+
}) : null,
|
|
151
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
152
|
+
className: SkillRow_module_css_default.title,
|
|
153
|
+
children: "Skill"
|
|
154
|
+
}),
|
|
155
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
156
|
+
className: SkillRow_module_css_default.separator,
|
|
157
|
+
"aria-hidden": true
|
|
158
|
+
}),
|
|
159
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
160
|
+
className: model.errorSummary === null ? SkillRow_module_css_default.summary : `${SkillRow_module_css_default.summary} ${SkillRow_module_css_default.errorSummary}`,
|
|
161
|
+
children: summary
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}), open ? (0, react_jsx_runtime.jsxs)("div", {
|
|
165
|
+
className: SkillRow_module_css_default.bodyWrap,
|
|
166
|
+
children: [(0, react_jsx_runtime.jsxs)("section", {
|
|
167
|
+
className: SkillRow_module_css_default.instructionsCard,
|
|
168
|
+
"aria-label": t("row.instructions"),
|
|
169
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
170
|
+
className: SkillRow_module_css_default.instructionsHeader,
|
|
171
|
+
children: t("row.instructions")
|
|
172
|
+
}), (0, react_jsx_runtime.jsx)("pre", {
|
|
173
|
+
className: SkillRow_module_css_default.instructions,
|
|
174
|
+
"data-error": model.state === "error" || void 0,
|
|
175
|
+
children: model.output
|
|
176
|
+
})]
|
|
177
|
+
}), inspect !== void 0 ? (0, react_jsx_runtime.jsxs)("button", {
|
|
178
|
+
type: "button",
|
|
179
|
+
className: SkillRow_module_css_default.inspectButton,
|
|
180
|
+
onClick: inspect,
|
|
181
|
+
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutline12, {}), "Inspect"]
|
|
182
|
+
}) : null]
|
|
183
|
+
}) : null]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region lib/types/client/locales.js
|
|
188
|
+
/** `skill` namespace dictionaries for the dedicated tool row. */
|
|
189
|
+
/** Dictionary namespace owned by this plugin. */
|
|
190
|
+
const NS = "skill";
|
|
191
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
192
|
+
const zh = {
|
|
193
|
+
"row.running": "正在加载 skill",
|
|
194
|
+
"row.failed": "skill 加载失败",
|
|
195
|
+
"row.stopped": "skill 加载已中止",
|
|
196
|
+
"row.instructions": "说明",
|
|
197
|
+
"menu.userOnly": "仅用户"
|
|
198
|
+
};
|
|
199
|
+
/** English dictionary, checked complete against the zh key set. */
|
|
200
|
+
const en = {
|
|
201
|
+
"row.running": "Loading skill",
|
|
202
|
+
"row.failed": "Skill load failed",
|
|
203
|
+
"row.stopped": "Skill load stopped",
|
|
204
|
+
"row.instructions": "Instructions",
|
|
205
|
+
"menu.userOnly": "user-only"
|
|
206
|
+
};
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region lib/types/client/index.js
|
|
209
|
+
/** Required services: reference source faces plus the tool-row and locale registries. */
|
|
210
|
+
const inject = [
|
|
211
|
+
"inputTriggers",
|
|
212
|
+
"connection",
|
|
213
|
+
"sessions",
|
|
214
|
+
"slots",
|
|
215
|
+
"locale",
|
|
216
|
+
"remote"
|
|
217
|
+
];
|
|
218
|
+
/**
|
|
219
|
+
* Client plugin body: register the '/' source, dictionaries, and keyed tool row.
|
|
220
|
+
* @param ctx - client root context.
|
|
221
|
+
*/
|
|
222
|
+
function apply(ctx) {
|
|
223
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
224
|
+
zh,
|
|
225
|
+
en
|
|
226
|
+
}), "ui-skill: dictionaries");
|
|
227
|
+
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
228
|
+
name: "tool.call.toolview",
|
|
229
|
+
key: "skill",
|
|
230
|
+
locale: NS
|
|
231
|
+
}, SkillRow));
|
|
232
|
+
const skills = ctx.get("connection").api.skills;
|
|
233
|
+
const sessions = ctx.get("sessions");
|
|
234
|
+
const fetches = /* @__PURE__ */ new Map();
|
|
235
|
+
const lexiconListeners = /* @__PURE__ */ new Map();
|
|
236
|
+
const notifyLexicon = (sessionId) => {
|
|
237
|
+
for (const listener of [...lexiconListeners.get(sessionId) ?? []]) try {
|
|
238
|
+
listener();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error("[ui-skill] lexicon listener failed:", error);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const fetchCatalog = (sessionId) => {
|
|
244
|
+
if (sessions.subagentAddress(sessionId) !== void 0) return Promise.resolve([]);
|
|
245
|
+
const existing = fetches.get(sessionId);
|
|
246
|
+
if (existing !== void 0) return existing.promise;
|
|
247
|
+
const abort = new AbortController();
|
|
248
|
+
const promise = (async () => {
|
|
249
|
+
const { result } = await skills.list({ sessionId }, abort.signal);
|
|
250
|
+
if (!result.ok) throw new Error(`skill.list failed: ${result.error.code}: ${result.error.message}`);
|
|
251
|
+
return result.value.skills;
|
|
252
|
+
})();
|
|
253
|
+
const entry = {
|
|
254
|
+
promise,
|
|
255
|
+
abort
|
|
256
|
+
};
|
|
257
|
+
fetches.set(sessionId, entry);
|
|
258
|
+
promise.then((skills) => {
|
|
259
|
+
entry.settled = skills;
|
|
260
|
+
notifyLexicon(sessionId);
|
|
261
|
+
}, () => {
|
|
262
|
+
if (fetches.get(sessionId) === entry) fetches.delete(sessionId);
|
|
263
|
+
});
|
|
264
|
+
return promise;
|
|
265
|
+
};
|
|
266
|
+
const invalidate = (key) => {
|
|
267
|
+
const entry = fetches.get(key);
|
|
268
|
+
if (entry === void 0) return;
|
|
269
|
+
fetches.delete(key);
|
|
270
|
+
entry.abort.abort();
|
|
271
|
+
notifyLexicon(key);
|
|
272
|
+
};
|
|
273
|
+
const clearAll = () => {
|
|
274
|
+
for (const key of [...fetches.keys()]) invalidate(key);
|
|
275
|
+
};
|
|
276
|
+
const t = ctx.locale.bind(NS);
|
|
277
|
+
const source = {
|
|
278
|
+
trigger: "/",
|
|
279
|
+
name: "skill",
|
|
280
|
+
order: 2,
|
|
281
|
+
async candidates(session, { query, signal }) {
|
|
282
|
+
const skills = await fetchCatalog(session.sessionId);
|
|
283
|
+
if (signal.aborted) return [];
|
|
284
|
+
return skills.filter((skill) => skill.name.startsWith(query)).map((skill) => ({
|
|
285
|
+
name: skill.name,
|
|
286
|
+
description: skill.modelInvocable ? skill.description : `${t("menu.userOnly")} · ${skill.description}`
|
|
287
|
+
}));
|
|
288
|
+
},
|
|
289
|
+
warm(session) {
|
|
290
|
+
fetchCatalog(session.sessionId).catch(() => {});
|
|
291
|
+
},
|
|
292
|
+
lexicon(session) {
|
|
293
|
+
return fetches.get(session.sessionId)?.settled?.map((skill) => skill.name);
|
|
294
|
+
},
|
|
295
|
+
subscribeLexicon(session, listener) {
|
|
296
|
+
const key = session.sessionId;
|
|
297
|
+
const listeners = lexiconListeners.get(key) ?? /* @__PURE__ */ new Set();
|
|
298
|
+
listeners.add(listener);
|
|
299
|
+
lexiconListeners.set(key, listeners);
|
|
300
|
+
return () => {
|
|
301
|
+
listeners.delete(listener);
|
|
302
|
+
if (listeners.size === 0) lexiconListeners.delete(key);
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
onPick({ candidate }) {
|
|
306
|
+
return { text: `/${candidate.name} ` };
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const inputTriggers = ctx.get("inputTriggers");
|
|
310
|
+
ctx.remote.$on("agent-preset/selected", invalidate);
|
|
311
|
+
ctx.on("connection/reset", clearAll);
|
|
312
|
+
ctx.effect(() => {
|
|
313
|
+
const unregister = inputTriggers.registerSource(source);
|
|
314
|
+
return () => {
|
|
315
|
+
unregister();
|
|
316
|
+
clearAll();
|
|
317
|
+
};
|
|
318
|
+
}, "ui-skill: source");
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
exports.apply = apply;
|
|
322
|
+
exports.inject = inject;
|
|
323
|
+
return module.exports;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
//# sourceMappingURL=client.js.map
|