dsh-edge 0.18.0 → 0.19.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/THIRD_PARTY_NOTICES.md +2011 -449
  5. package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
  6. package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
  7. package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
  8. package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
  9. package/dist/assets/index-Cq6ljTv2.css +1 -0
  10. package/dist/assets/index-Dy0OhsZ5.js +127 -0
  11. package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
  12. package/dist/assets/langs/bat-BkioyH1T.js +2 -0
  13. package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
  14. package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
  15. package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
  16. package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
  17. package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
  18. package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
  19. package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
  20. package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
  21. package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
  22. package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
  23. package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
  24. package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
  25. package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
  26. package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
  27. package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
  28. package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
  29. package/dist/assets/langs/html-fwsONPVS.js +2 -0
  30. package/dist/assets/langs/http-DcV90OkR.js +2 -0
  31. package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
  32. package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
  33. package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
  34. package/dist/assets/langs/log-2UxHyX5q.js +2 -0
  35. package/dist/assets/langs/make-CHLpvVh8.js +2 -0
  36. package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
  37. package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
  38. package/dist/assets/langs/php-LEPfNACG.js +2 -0
  39. package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
  40. package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
  41. package/dist/assets/langs/r-Dspwwk_N.js +2 -0
  42. package/dist/assets/langs/rst-BbocfKWr.js +2 -0
  43. package/dist/assets/langs/ruby-R292Iif0.js +2 -0
  44. package/dist/assets/langs/scala-C151Ov-r.js +2 -0
  45. package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
  46. package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
  47. package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
  48. package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
  49. package/dist/assets/langs/vue-Dq2x6432.js +2 -0
  50. package/dist/favicon-dark.svg +3 -0
  51. package/dist/favicon.svg +0 -5
  52. package/dist/index.html +5 -4
  53. package/dist/manifest.webmanifest +3 -4
  54. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
  55. package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
  56. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
  57. package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
  58. package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
  59. package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
  60. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
  61. package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
  62. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
  63. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
  64. package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
  65. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
  66. package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
  67. package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
  68. package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
  69. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
  70. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
  71. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
  72. package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
  73. package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
  74. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
  75. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
  76. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
  77. package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
  78. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
  79. package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
  80. package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
  81. package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
  82. package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
  83. package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
  84. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
  85. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
  86. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
  87. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
  88. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
  89. package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
  90. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
  91. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
  92. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
  93. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
  94. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
  95. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
  96. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
  97. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
  98. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
  99. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
  100. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
  101. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
  103. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
  104. package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
  105. package/package.json +96 -86
  106. package/scripts/cli.mjs +16 -4
  107. package/scripts/install.d.mts +12 -2
  108. package/scripts/install.mjs +36 -9
  109. package/scripts/legal-files.mjs +15 -0
  110. package/worker/direct/index.js +2564 -1822
  111. package/worker/isolated/index.js +2144 -1402
  112. package/dist/assets/index-BKQ_L1z6.js +0 -117
  113. package/dist/assets/index-DPX2bQLO.css +0 -1
  114. package/dist/assets/langs/html-CfGypltT.js +0 -2
  115. package/dist/assets/langs/php-DJl5gRdb.js +0 -2
  116. package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
  118. package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
@@ -4,11 +4,479 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
7
8
  let react_jsx_runtime = require("react/jsx-runtime");
8
9
  let react = require("react");
9
- let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
+ require("@deepseek-ai/cordis");
11
+ let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
12
+ //#region ../../util/crypto/src/index.ts
13
+ /**
14
+ * Random v4 UUID, minted from `crypto.getRandomValues`.
15
+ * @returns the UUID string.
16
+ */
17
+ function randomUUID() {
18
+ const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
19
+ const hex = Array.from(bytes, (byte, index) => {
20
+ return (index === 6 ? byte & 15 | 64 : index === 8 ? byte & 63 | 128 : byte).toString(16).padStart(2, "0");
21
+ }).join("");
22
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
23
+ }
24
+ //#endregion
25
+ //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-plan/src/client/PlanPreview.module.css.mjs
26
+ const css$1 = ".k74WwW_cards{flex-direction:column;gap:10px;display:flex}.k74WwW_card{--plan-card-fill:var(--dsw-static-neutral-50);--plan-card-hover:var(--dsw-static-neutral-100);box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xl);background:var(--plan-card-fill);width:100%;min-width:0;height:60px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;align-items:center;gap:10px;margin:0;padding:8px 10px;transition:background-color .12s;display:flex}body[data-ds-dark-theme] .k74WwW_card{--plan-card-fill:var(--dsw-static-neutral-850);--plan-card-hover:var(--dsw-static-neutral-800)}.k74WwW_card:hover{background:var(--plan-card-hover)}.k74WwW_card:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.k74WwW_cardIcon{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-md);background:var(--plan-card-fill);flex:none;place-items:center;width:40px;height:40px;display:grid}.k74WwW_cardDetails{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.k74WwW_cardTitle{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.k74WwW_cardDescription{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:16px;overflow:hidden}.k74WwW_cardOpen{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-floating-fill);flex:none;align-items:center;height:28px;padding:4px 8px;font-size:12px;line-height:18px;display:inline-flex}.k74WwW_reviewLink{color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:4px;padding:0;display:inline-flex}.k74WwW_reviewLink:hover{color:var(--dsw-alias-label-primary)}.k74WwW_reviewLink:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.k74WwW_preview{box-sizing:border-box;height:100%;padding:20px 24px 40px;position:relative;overflow:auto}.k74WwW_document{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;font-size:14px;line-height:1.75}.k74WwW_message{color:var(--dsw-alias-label-secondary);padding:24px;font-size:14px}.k74WwW_titleIcon{flex:none}@media (width<=767px){.k74WwW_preview{padding:16px 18px 32px}}";
27
+ const tagId$1 = "@deepseek-ai/dsh-client-ui-plan/PlanPreview.module.css";
28
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
29
+ const tag = document.createElement("style");
30
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-plan";
31
+ tag.dataset.pluginCss = tagId$1;
32
+ tag.textContent = css$1;
33
+ document.head.appendChild(tag);
34
+ }
35
+ var PlanPreview_module_css_default = {
36
+ "card": "k74WwW_card",
37
+ "cardDescription": "k74WwW_cardDescription",
38
+ "cardDetails": "k74WwW_cardDetails",
39
+ "cardIcon": "k74WwW_cardIcon",
40
+ "cardOpen": "k74WwW_cardOpen",
41
+ "cardTitle": "k74WwW_cardTitle",
42
+ "cards": "k74WwW_cards",
43
+ "document": "k74WwW_document",
44
+ "message": "k74WwW_message",
45
+ "preview": "k74WwW_preview",
46
+ "reviewLink": "k74WwW_reviewLink",
47
+ "titleIcon": "k74WwW_titleIcon"
48
+ };
49
+ //#endregion
50
+ //#region lib/types/client/PlanCard.js
51
+ /** Persistent transcript cards and pending-review sidebar navigation. */
52
+ /**
53
+ * Render the completed Turn's submitted plans in invocation order.
54
+ * @param props - Logged plan, localized copy, and Session-bound navigation.
55
+ * @returns keyboard-accessible plan cards, or null for a Turn without plans.
56
+ */
57
+ function PlanCards({ turn, usePlans, openPlan, t }) {
58
+ const plans = usePlans(String(turn.turn));
59
+ if (plans === void 0 || plans.length === 0) return null;
60
+ return (0, react_jsx_runtime.jsx)("div", {
61
+ className: PlanPreview_module_css_default.cards,
62
+ "data-plan-artifacts": true,
63
+ children: plans.map((plan) => (0, react_jsx_runtime.jsxs)("button", {
64
+ type: "button",
65
+ className: PlanPreview_module_css_default.card,
66
+ "data-plan-card": plan.callId,
67
+ "aria-label": t("preview.openNamed", { title: plan.title }),
68
+ onClick: () => {
69
+ openPlan(plan.callId);
70
+ },
71
+ children: [
72
+ (0, react_jsx_runtime.jsx)("span", {
73
+ className: PlanPreview_module_css_default.cardIcon,
74
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FileTypeIcon, {
75
+ kind: "markdown",
76
+ size: 20
77
+ })
78
+ }),
79
+ (0, react_jsx_runtime.jsxs)("span", {
80
+ className: PlanPreview_module_css_default.cardDetails,
81
+ children: [(0, react_jsx_runtime.jsx)("span", {
82
+ className: PlanPreview_module_css_default.cardTitle,
83
+ children: plan.title
84
+ }), (0, react_jsx_runtime.jsx)("span", {
85
+ className: PlanPreview_module_css_default.cardDescription,
86
+ children: t("preview.document")
87
+ })]
88
+ }),
89
+ (0, react_jsx_runtime.jsx)("span", {
90
+ className: PlanPreview_module_css_default.cardOpen,
91
+ children: t("preview.action")
92
+ })
93
+ ]
94
+ }, plan.callId))
95
+ });
96
+ }
97
+ /**
98
+ * Open each pending plan automatically and retain a manual opener without answering it.
99
+ *
100
+ * The automatic open waits for a mounted Sidebar seat: a review that arrives
101
+ * while the Conversation is off screen mounts in the same commit as the seat,
102
+ * ahead of it, and the seat binds from its own effect. Reading the bound
103
+ * session through the hook opens once that binding exists.
104
+ * @param props - Review identity, Session store, localized copy, and navigation.
105
+ * @returns an opener for either logged or temporary plan text.
106
+ */
107
+ function PlanReviewOpen({ review, requestKey, openReview, useSidebarMounted, t, useStore, actions }) {
108
+ const identity = review.callId === void 0 ? `review:${requestKey}` : `call:${review.callId}`;
109
+ const opened = useStore((state) => state.opened[identity] === true);
110
+ const mounted = useSidebarMounted((session) => session !== void 0);
111
+ (0, react.useEffect)(() => {
112
+ if (opened || !mounted) return;
113
+ openReview(review, requestKey);
114
+ actions.markOpened(identity);
115
+ }, [
116
+ identity,
117
+ opened,
118
+ mounted,
119
+ openReview,
120
+ review,
121
+ requestKey,
122
+ actions
123
+ ]);
124
+ return (0, react_jsx_runtime.jsxs)("button", {
125
+ type: "button",
126
+ className: PlanPreview_module_css_default.reviewLink,
127
+ title: t("preview.open"),
128
+ "aria-label": t("preview.open"),
129
+ onClick: () => {
130
+ openReview(review, requestKey);
131
+ },
132
+ children: [t("preview.full"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 14 })]
133
+ });
134
+ }
135
+ //#endregion
136
+ //#region lib/types/client/review-preview.js
137
+ /**
138
+ * Name one temporary review within its browser lifetime and Session.
139
+ * @param sessionId - Session displaying the review.
140
+ * @param requestKey - Browser-unique pending request identity.
141
+ * @returns the address used to focus or reopen its preview.
142
+ */
143
+ function reviewPreviewAddress(sessionId, requestKey) {
144
+ return `dsh-resource://plan-review/${encodeURIComponent(sessionId)}/${encodeURIComponent(requestKey)}`;
145
+ }
146
+ /**
147
+ * Recognize temporary plan navigation without interpreting it as logged history.
148
+ * @param address - Saved or caller-supplied navigation address.
149
+ * @returns whether the address identifies a temporary review preview.
150
+ */
151
+ function isReviewPreviewAddress(address) {
152
+ return /^dsh-resource:\/\/plan-review\/[^/?#]+\/[^/?#]+$/.test(address);
153
+ }
154
+ //#endregion
155
+ //#region lib/types/client/failure-line.js
156
+ /**
157
+ * Explain a failed plan read in the current locale.
158
+ * @param t - Plan namespace translator.
159
+ * @param failure - Failure reported by the resource provider.
160
+ * @returns localized plan copy, or the external failure's diagnostic.
161
+ */
162
+ function planFailureLine(t, failure) {
163
+ switch (failure.code) {
164
+ case "plan/invalid-address": return t("preview.invalidAddress");
165
+ case "plan/unavailable": return t("preview.historyUnavailable");
166
+ case "plan/not-found": return t("preview.notFound");
167
+ default: return failure.message;
168
+ }
169
+ }
170
+ //#endregion
171
+ //#region lib/types/client/PlanPreview.js
172
+ /** Read-only Markdown viewer for logged plans and temporary review documents. */
173
+ /**
174
+ * Render the submitted plan with its complete Markdown.
175
+ * @param props - Framework-bound tab identity, resource, and copy.
176
+ * @returns the plan document or a localized loading/failure state.
177
+ */
178
+ function PlanPreview({ useTabInfo, useResource, t }) {
179
+ const tab = useTabInfo();
180
+ const resource = useResource(tab.tab.navigation.address);
181
+ const temporary = isReviewPreviewAddress(tab.tab.navigation.address);
182
+ const params = tab.tab.navigation.params;
183
+ const plan = temporary ? params !== void 0 && "planReview" in params ? params.planReview : void 0 : resource.value;
184
+ const labels = (0, react.useMemo)(() => ({
185
+ code: {
186
+ copyLabel: t("copy"),
187
+ copiedLabel: t("copied"),
188
+ toolbarLabels: {
189
+ codeLabel: t("codeBlock.title"),
190
+ wrapLabel: t("codeBlock.wrap"),
191
+ unwrapLabel: t("codeBlock.unwrap")
192
+ }
193
+ },
194
+ footnotes: t("markdown.footnotes")
195
+ }), [t]);
196
+ if (plan === void 0) return (0, react_jsx_runtime.jsxs)("div", {
197
+ className: PlanPreview_module_css_default.message,
198
+ role: "status",
199
+ children: [temporary ? t("preview.expired") : resource.status === "none" ? t("preview.unavailable") : resource.status === "failed" ? t("preview.failed") : t("preview.loading"), !temporary && resource.failure !== void 0 && (0, react_jsx_runtime.jsx)("p", { children: planFailureLine(t, resource.failure) })]
200
+ });
201
+ return (0, react_jsx_runtime.jsx)("section", {
202
+ className: PlanPreview_module_css_default.preview,
203
+ "data-plan-preview": "callId" in plan ? plan.callId : tab.tab.navigation.address,
204
+ "aria-label": plan.title,
205
+ children: (0, react_jsx_runtime.jsx)("div", {
206
+ className: PlanPreview_module_css_default.document,
207
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
208
+ text: plan.markdown,
209
+ labels
210
+ })
211
+ })
212
+ });
213
+ }
214
+ /**
215
+ * Display a plain file icon and the heading in its tab after resource recovery.
216
+ * @param props - Framework-bound tab identity and resource reader.
217
+ * @returns a decorative file icon followed by the recovered title or initial localized label.
218
+ */
219
+ function PlanTitle({ useTabInfo, useResource }) {
220
+ const tab = useTabInfo();
221
+ const resource = useResource(tab.tab.navigation.address);
222
+ const params = tab.tab.navigation.params;
223
+ const plan = isReviewPreviewAddress(tab.tab.navigation.address) ? params !== void 0 && "planReview" in params ? params.planReview : void 0 : resource.value;
224
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.FileTypeIcon, {
225
+ kind: "other",
226
+ size: 16,
227
+ className: PlanPreview_module_css_default.titleIcon
228
+ }), plan?.title ?? tab.tab.title] });
229
+ }
230
+ //#endregion
231
+ //#region lib/types/client/plan.js
232
+ function record(value) {
233
+ return typeof value === "object" && value !== null && !Array.isArray(value);
234
+ }
235
+ /**
236
+ * Read a complete plan from untrusted logged arguments.
237
+ * @param event - Native call or PTC dispatch event from Session history.
238
+ * @returns the submitted plan, or undefined for unrelated or malformed data.
239
+ */
240
+ function submittedPlan(event) {
241
+ if (event.type !== "tool/call" && event.type !== "tool/ptc-dispatch-start" && event.type !== "tool/ptc-dispatch") return void 0;
242
+ const data = event.data;
243
+ if (!record(data) || data.name !== "exit_plan_mode") return void 0;
244
+ const callId = event.type === "tool/call" ? data.callId : data.subCallId;
245
+ if (typeof callId !== "string" || callId === "") return void 0;
246
+ let args = data.arguments;
247
+ if (event.type === "tool/call") {
248
+ if (typeof args !== "string") return void 0;
249
+ try {
250
+ args = JSON.parse(args);
251
+ } catch (_error) {
252
+ return;
253
+ }
254
+ }
255
+ if (!record(args) || typeof args.plan !== "string") return void 0;
256
+ const markdown = args.plan;
257
+ const title = /^#\s+(\S[^\r\n]*)/.exec(markdown.trim())?.[1];
258
+ return title === void 0 ? void 0 : {
259
+ callId,
260
+ markdown,
261
+ title
262
+ };
263
+ }
264
+ /**
265
+ * Encode the durable identity of a plan without retaining its text in layout storage.
266
+ * @param target - Session and tool-call identity.
267
+ * @returns the plan resource address.
268
+ */
269
+ function planAddress(target) {
270
+ const { session, callId } = target;
271
+ return `dsh-resource://plan/${(session.kind === "session" ? [session.sessionId, callId] : [
272
+ "subagent",
273
+ session.parentSessionId,
274
+ session.childSessionId,
275
+ session.mode,
276
+ callId
277
+ ]).map(encodeURIComponent).join("/")}`;
278
+ }
279
+ /**
280
+ * Validate a saved or caller-supplied plan resource address.
281
+ * @param address - Address submitted to the sidebar or resource provider.
282
+ * @returns the decoded identity, or undefined for an unsupported address.
283
+ */
284
+ function parsePlanAddress(address) {
285
+ const match = /^dsh-resource:\/\/plan\/([^?#]+)$/.exec(address);
286
+ if (match === null) return void 0;
287
+ try {
288
+ const parts = match[1].split("/").map(decodeURIComponent);
289
+ if (parts.some((part) => part === "")) return void 0;
290
+ if (parts.length === 2) return {
291
+ session: {
292
+ kind: "session",
293
+ sessionId: parts[0]
294
+ },
295
+ callId: parts[1]
296
+ };
297
+ if (parts.length === 5 && parts[0] === "subagent" && (parts[3] === "one-shot" || parts[3] === "continuable" || parts[3] === "unknown")) return {
298
+ session: {
299
+ kind: "subagent",
300
+ parentSessionId: parts[1],
301
+ childSessionId: parts[2],
302
+ mode: parts[3]
303
+ },
304
+ callId: parts[4]
305
+ };
306
+ return;
307
+ } catch (_error) {
308
+ return;
309
+ }
310
+ }
311
+ //#endregion
312
+ //#region lib/types/client/plan-definition.js
313
+ /** One card per invocation; a later PTC settlement retains the original card position. */
314
+ const planDefinition = {
315
+ kind: "submitted-plan",
316
+ target: "chat",
317
+ match: (event) => {
318
+ const plan = submittedPlan(event);
319
+ return plan === void 0 ? null : {
320
+ id: plan.callId,
321
+ role: event.type === "tool/ptc-dispatch" ? "update" : "start"
322
+ };
323
+ },
324
+ start: (_context, match) => submittedPlan(match.event),
325
+ update: (context) => context.state,
326
+ buildViewNode: (context) => {
327
+ const start = context.start ?? context.matches[0];
328
+ const data = context.state ?? (start === void 0 ? void 0 : submittedPlan(start.event));
329
+ if (data === void 0 || start === void 0) return null;
330
+ return {
331
+ key: context.key,
332
+ kind: "submitted-plan",
333
+ id: context.id,
334
+ target: "chat",
335
+ anchorSeq: start.event.seq,
336
+ location: start.location,
337
+ visibility: "hidden",
338
+ data
339
+ };
340
+ }
341
+ };
342
+ //#endregion
343
+ //#region ../../typert/protocol/src/remote-error.ts
344
+ /**
345
+ * One Remote call failure: a real Error carrying its stable code and typed
346
+ * details. Owners throw it at the failure point; the Host Gateway encodes it
347
+ * onto the wire unchanged; the Client face rebuilds an instance for the
348
+ * `RemoteResult` error branch, so `throw result.error` keeps throw semantics.
349
+ * Discrimination is always by `code`, never by instanceof.
350
+ */
351
+ var RemoteError = class extends Error {
352
+ code;
353
+ details;
354
+ /** Structural marker: cross-realm/bundle identification never uses instanceof. */
355
+ isDSHRemoteError = true;
356
+ /**
357
+ * @param code - stable failure code declared in {@link RemoteErrorDetailsMap}.
358
+ * @param message - human diagnostic carried across the wire.
359
+ * @param details - structured payload typed by the code.
360
+ * @param options - standard Error options (`cause` survives in-process only).
361
+ */
362
+ constructor(code, message, details, options) {
363
+ super(message, options);
364
+ this.code = code;
365
+ this.details = details;
366
+ this.name = "RemoteError";
367
+ }
368
+ };
369
+ /**
370
+ * Structurally identify a RemoteError thrown across module or realm copies of
371
+ * this class. Mechanism-internal: the Gateway and test assertions use it;
372
+ * business code receives typed failures and never needs it.
373
+ * @param value - a caught value.
374
+ * @returns the failure when the marker matches, otherwise undefined.
375
+ */
376
+ function remoteErrorOf(value) {
377
+ if (typeof value === "object" && value !== null && value.isDSHRemoteError === true && typeof value.code === "string") return value;
378
+ }
379
+ //#endregion
380
+ //#region ../../typert/protocol/src/index.ts
381
+ /**
382
+ * Remote decorators and explicit Gateway bindings backed by versioned
383
+ * descriptors carried on decorated class prototypes. Strict reflection
384
+ * remains a Typert compiler responsibility.
385
+ * @module @deepseek-ai/dsh-typert-protocol
386
+ */
387
+ //#endregion
388
+ //#region lib/types/client/plan-resource.js
389
+ /**
390
+ * Bind plan reads to the generated Session Remote face.
391
+ * Opening a follow reads projections and may activate a prepared Session on the Host.
392
+ * Generated Remote streams can throw carrier failures; the provider reports failed
393
+ * reads as resource failure frames and preserves Remote error codes.
394
+ * @param remote - Existing Session history API.
395
+ * @returns a provider whose reads stop after finding the exact invocation.
396
+ */
397
+ function planResourceProvider(remote) {
398
+ return {
399
+ protocol: "plan",
400
+ async *open(address, { signal }) {
401
+ const aborted = () => signal.aborted;
402
+ if (aborted()) return;
403
+ const target = parsePlanAddress(address);
404
+ if (target === void 0) {
405
+ yield {
406
+ ok: false,
407
+ error: new RemoteError("plan/invalid-address", "Invalid plan resource address.", {})
408
+ };
409
+ return;
410
+ }
411
+ const sessionAddress = target.session;
412
+ try {
413
+ let snapshot;
414
+ for await (const frame of remote.follow({ address: sessionAddress }, signal)) if (frame.type === "snapshot") {
415
+ snapshot = frame;
416
+ break;
417
+ }
418
+ if (aborted()) return;
419
+ if (snapshot === void 0) throw new RemoteError("plan/unavailable", "Session history ended before the plan could be read.", {});
420
+ let page = {
421
+ records: snapshot.records,
422
+ hasMore: snapshot.hasMore
423
+ };
424
+ while (true) {
425
+ for (const entry of page.records) {
426
+ const plan = submittedPlan(entry.event);
427
+ if (plan?.callId === target.callId) {
428
+ yield {
429
+ ok: true,
430
+ value: plan
431
+ };
432
+ return;
433
+ }
434
+ }
435
+ const beforeSeq = page.records[0]?.event.seq;
436
+ if (!page.hasMore || beforeSeq === void 0) break;
437
+ const next = await remote.page({
438
+ address: sessionAddress,
439
+ throughSeq: snapshot.cursor,
440
+ beforeSeq
441
+ }, signal);
442
+ if (aborted()) return;
443
+ if (!next.ok) {
444
+ yield next;
445
+ return;
446
+ }
447
+ page = next.value;
448
+ }
449
+ yield {
450
+ ok: false,
451
+ error: new RemoteError("plan/not-found", "The submitted plan was not found in this Session.", {})
452
+ };
453
+ } catch (error) {
454
+ if (!aborted()) yield {
455
+ ok: false,
456
+ error: remoteErrorOf(error) ?? new RemoteError("plan/read-failed", error instanceof Error ? error.message : String(error), {})
457
+ };
458
+ }
459
+ }
460
+ };
461
+ }
462
+ //#endregion
463
+ //#region lib/types/client/review-store.js
464
+ /** Session-owned memory of pending plans already opened automatically. */
465
+ /**
466
+ * Keep manual sidebar closure effective across review component remounts.
467
+ * @returns a transient store handle whose instances belong to Session scopes.
468
+ */
469
+ function createPlanReviewStore() {
470
+ return (0, _deepseek_ai_dsh_client_store.defineStore)({
471
+ init: () => ({ opened: {} }),
472
+ actions: { markOpened: (draft, reviewKey) => {
473
+ draft.opened[reviewKey] = true;
474
+ } }
475
+ });
476
+ }
477
+ //#endregion
10
478
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-plan/src/client/PlanModeControl.module.css.mjs
11
- const css = ".rS3zOq_wrap{align-items:center;gap:6px;display:inline-flex}.rS3zOq_chip{corner-shape:round;background:var(--dsw-alias-state-warn-tertiary);min-width:34px;color:var(--dsw-alias-state-warn-label);cursor:pointer;border:none;border-radius:999px;align-items:center;gap:4px;padding:2px 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.rS3zOq_chip:hover:not(:disabled){color:var(--dsw-alias-state-warn-primary)}.rS3zOq_chip:focus-visible{outline:2px solid var(--dsw-alias-state-warn-label);outline-offset:2px}.rS3zOq_chip:disabled{opacity:.6;cursor:default}.rS3zOq_close{color:currentColor;align-items:center;display:inline-flex}.rS3zOq_error{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}";
479
+ const css = ".rS3zOq_wrap{align-items:center;gap:6px;display:inline-flex}.rS3zOq_chip{border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-state-business-tertiary);min-width:34px;height:28px;color:var(--dsw-alias-state-business-primary);cursor:pointer;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.rS3zOq_chip:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-tertiary), var(--dsw-alias-state-business-primary) 6%)}.rS3zOq_chip:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.rS3zOq_chip:disabled{opacity:.6;cursor:default}.rS3zOq_glyph{color:currentColor;flex:none;width:14px;height:14px;display:inline-flex}.rS3zOq_hoverGlyph,.rS3zOq_chip:hover:not(:disabled) .rS3zOq_restGlyph,.rS3zOq_chip:focus-visible .rS3zOq_restGlyph{display:none}.rS3zOq_chip:hover:not(:disabled) .rS3zOq_hoverGlyph,.rS3zOq_chip:focus-visible .rS3zOq_hoverGlyph{display:block}.rS3zOq_error{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}";
12
480
  const tagId = "@deepseek-ai/dsh-client-ui-plan/PlanModeControl.module.css";
13
481
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
14
482
  const tag = document.createElement("style");
@@ -19,8 +487,10 @@ window.__ModuleLoader__.load({
19
487
  }
20
488
  var PlanModeControl_module_css_default = {
21
489
  "chip": "rS3zOq_chip",
22
- "close": "rS3zOq_close",
23
490
  "error": "rS3zOq_error",
491
+ "glyph": "rS3zOq_glyph",
492
+ "hoverGlyph": "rS3zOq_hoverGlyph",
493
+ "restGlyph": "rS3zOq_restGlyph",
24
494
  "wrap": "rS3zOq_wrap"
25
495
  };
26
496
  //#endregion
@@ -65,11 +535,17 @@ window.__ModuleLoader__.load({
65
535
  title: t("chip.on.title"),
66
536
  disabled: locked || leaving,
67
537
  onClick: off,
68
- children: [t("chip.label"), (0, react_jsx_runtime.jsx)("span", {
69
- className: PlanModeControl_module_css_default.close,
538
+ children: [(0, react_jsx_runtime.jsxs)("span", {
539
+ className: PlanModeControl_module_css_default.glyph,
70
540
  "aria-hidden": true,
71
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseFill14, { size: 12 })
72
- })]
541
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlanOutlineRegular, {
542
+ className: PlanModeControl_module_css_default.restGlyph,
543
+ size: 14
544
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseCircleFillRegular, {
545
+ className: PlanModeControl_module_css_default.hoverGlyph,
546
+ size: 14
547
+ })]
548
+ }), t("chip.label")]
73
549
  }), error !== null && (0, react_jsx_runtime.jsx)("span", {
74
550
  className: PlanModeControl_module_css_default.error,
75
551
  role: "status",
@@ -83,35 +559,63 @@ window.__ModuleLoader__.load({
83
559
  /** `plan` namespace dictionaries (the composer plan chip's copy). */
84
560
  /** Simplified Chinese dictionary (the key-set source of truth). */
85
561
  const zh = {
86
- "chip.label": "Plan",
87
- "chip.on.aria": "plan mode 已开启,按下关闭",
88
- "chip.on.title": "plan mode 已开启 — 点击关闭(/plan off)",
89
- "chip.off.aria": "plan mode 已关闭,按下开启",
90
- "chip.off.title": "plan mode 已关闭 — 点击开启(/plan)",
91
- "chip.exitFailed": "退出 plan mode 失败"
562
+ "chip.label": "计划",
563
+ "preview.title": "计划",
564
+ "preview.document": "计划 · Markdown",
565
+ "preview.action": "打开",
566
+ "preview.open": "在侧边栏打开计划",
567
+ "preview.full": "查看全文",
568
+ "preview.openNamed": "打开计划:{title}",
569
+ "preview.loading": "正在读取计划…",
570
+ "preview.failed": "无法读取计划",
571
+ "preview.invalidAddress": "计划地址无效",
572
+ "preview.historyUnavailable": "无法读取会话历史",
573
+ "preview.notFound": "未找到这份计划",
574
+ "preview.unavailable": "计划预览不可用",
575
+ "preview.expired": "临时计划预览已失效,请从仍在等待审批的卡片重新打开。",
576
+ "chip.on.aria": "计划模式已开启,按下关闭",
577
+ "chip.on.title": "计划模式已开启 — 点击关闭(/plan off)",
578
+ "chip.exitFailed": "退出计划模式失败"
92
579
  };
93
580
  /** English dictionary, checked complete against the zh key set. */
94
581
  const en = {
95
582
  "chip.label": "Plan",
583
+ "preview.title": "Plan",
584
+ "preview.document": "Plan · Markdown",
585
+ "preview.action": "Open",
586
+ "preview.open": "Open plan in sidebar",
587
+ "preview.full": "View full plan",
588
+ "preview.openNamed": "Open plan: {title}",
589
+ "preview.loading": "Loading plan…",
590
+ "preview.failed": "Could not load plan",
591
+ "preview.invalidAddress": "Invalid plan address",
592
+ "preview.historyUnavailable": "Session history is unavailable",
593
+ "preview.notFound": "This plan was not found",
594
+ "preview.unavailable": "Plan preview is unavailable",
595
+ "preview.expired": "This temporary plan preview has expired. Reopen it from the pending review card.",
96
596
  "chip.on.aria": "Plan mode on, press to turn off",
97
597
  "chip.on.title": "Plan mode on — click to turn off (/plan off)",
98
- "chip.off.aria": "Plan mode off, press to turn on",
99
- "chip.off.title": "Plan mode off — click to turn on (/plan)",
100
598
  "chip.exitFailed": "Failed to exit plan mode"
101
599
  };
102
600
  //#endregion
103
601
  //#region lib/types/client/index.js
104
602
  /** Dictionary namespace owned by this plugin. */
105
603
  const NS = "plan";
106
- /** Required services: the seat's slot registry, commands Remote, and locale registry. */
604
+ /** Services for plan controls, Conversation projection, and resource navigation. */
107
605
  const inject = [
108
606
  "slots",
109
607
  "remote",
110
608
  "remote.commands",
111
- "locale"
609
+ "remote.session",
610
+ "sessions",
611
+ "locale",
612
+ "uiConversation",
613
+ "resources",
614
+ "sidebarRight",
615
+ "sidebarRightTabs"
112
616
  ];
113
617
  /**
114
- * Client plugin body: register the plan chip over the command channel.
618
+ * Register plan controls, permanent Chat cards, and sidebar document reading.
115
619
  * @param ctx - client root context.
116
620
  */
117
621
  function apply(ctx) {
@@ -119,6 +623,80 @@ window.__ModuleLoader__.load({
119
623
  zh,
120
624
  en
121
625
  }), "ui-plan: dictionaries");
626
+ const previewId = "@deepseek-ai/dsh-client-ui-plan";
627
+ const t = ctx.locale.bind(NS);
628
+ ctx.effect(() => ctx.uiConversation.events.register(planDefinition), "ui-plan: conversation definition");
629
+ ctx.effect(() => ctx.resources.register(planResourceProvider(ctx.remote.session)), "ui-plan: resources");
630
+ ctx.effect(() => ctx.sidebarRightTabs.register({
631
+ id: previewId,
632
+ kind: "plan",
633
+ patterns: ["dsh-resource://plan/**", "dsh-resource://plan-review/**"],
634
+ priority: "builtin",
635
+ canOpen: (address) => parsePlanAddress(address) !== void 0 || isReviewPreviewAddress(address),
636
+ title: () => t("preview.title")
637
+ }), "ui-plan: sidebar type");
638
+ const open = (sessionId) => ({ openPlan: (callId) => {
639
+ const child = ctx.sessions.subagentAddress(sessionId);
640
+ const session = child === void 0 ? {
641
+ kind: "session",
642
+ sessionId
643
+ } : {
644
+ kind: "subagent",
645
+ ...child
646
+ };
647
+ ctx.sidebarRight.openResource(planAddress({
648
+ session,
649
+ callId
650
+ }));
651
+ } });
652
+ const reviewWindow = randomUUID();
653
+ const reviewStore = createPlanReviewStore();
654
+ ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
655
+ name: "conversation.chat.turnTail",
656
+ id: previewId,
657
+ locale: NS,
658
+ inject: (sessionId) => {
659
+ const binding = ctx.sessions.binding(sessionId);
660
+ if (binding === void 0) throw new Error(`ui-plan: unknown session "${sessionId}"`);
661
+ const chat = ctx.uiConversation.binding(binding).target("chat");
662
+ return {
663
+ ...open(sessionId),
664
+ keyedHooks: { plans: (turn) => {
665
+ const snapshot = chat.getSnapshot();
666
+ if (snapshot === void 0) throw new Error("ui-plan: Chat target is unavailable");
667
+ return snapshot.nodes.turnDataSource(Number(turn), "submitted-plan");
668
+ } }
669
+ };
670
+ }
671
+ }, PlanCards));
672
+ ctx.slots.inject("conversation.plan-review.actions", () => ctx.slots.register({
673
+ name: "conversation.plan-review.actions",
674
+ id: previewId,
675
+ locale: NS,
676
+ store: reviewStore,
677
+ inject: (sessionId) => ({
678
+ openReview: (review, requestKey) => {
679
+ if (review.callId !== void 0) {
680
+ open(sessionId).openPlan(review.callId);
681
+ return;
682
+ }
683
+ ctx.sidebarRight.openResource(reviewPreviewAddress(sessionId, `${reviewWindow}:${requestKey}`), { params: { planReview: {
684
+ markdown: review.plan,
685
+ title: (0, _deepseek_ai_dsh_client_ui_primitives.extractMarkdownPlainText)(review.plan, { mode: "first-line" })
686
+ } } });
687
+ },
688
+ hooks: { sidebarMounted: ctx.sidebarRight.mounted }
689
+ })
690
+ }, PlanReviewOpen));
691
+ ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
692
+ name: "sidebar.right.pane.tab",
693
+ key: previewId,
694
+ locale: NS
695
+ }, PlanPreview));
696
+ ctx.slots.inject("sidebar.right.pane.tab.title", () => ctx.slots.register({
697
+ name: "sidebar.right.pane.tab.title",
698
+ key: previewId
699
+ }, PlanTitle));
122
700
  ctx.slots.inject("conversation.input.plan", () => ctx.slots.register({
123
701
  name: "conversation.input.plan",
124
702
  locale: NS,