@songtonyli/dsh-cli 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +3 -2
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/session.js +3 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +336 -325
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +22 -7
- package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +15 -12
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +15 -12
- package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +959 -659
- package/package.json +1 -1
|
@@ -166,26 +166,9 @@ window.__ModuleLoader__.load({
|
|
|
166
166
|
}) ?? null;
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
|
-
//#region
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
* Build the complete Markdown chrome copy for one locale revision.
|
|
173
|
-
* @param t - Chat locale seat.
|
|
174
|
-
* @returns Labels for code fences and footnotes.
|
|
175
|
-
*/
|
|
176
|
-
function markdownLabels(t) {
|
|
177
|
-
return {
|
|
178
|
-
code: {
|
|
179
|
-
copyLabel: t("copy"),
|
|
180
|
-
copiedLabel: t("copied")
|
|
181
|
-
},
|
|
182
|
-
footnotes: t("markdown.footnotes")
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-chat/src/client/chat/MessageItem.module.css.mjs
|
|
187
|
-
const css$17 = "._1feDfq_userRow{flex-direction:column;align-items:flex-end;gap:6px;display:flex}._1feDfq_userStack{min-width:0;max-width:min(calc(var(--dsh-chat-content-width,748px) * .702), 82%);flex-direction:column;align-items:flex-end;gap:8px;display:flex}._1feDfq_bubble{background:var(--dsw-specific-bubble);max-width:100%;font-size:var(--dsh-content-font-size,14px);line-height:calc(22px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-word;border-radius:22px;padding:10px 16px}._1feDfq_referenceSummary{color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px))}._1feDfq_contextRow{padding:2px 0}._1feDfq_compactionRow{--dsh-compaction-header-height:calc(24px + var(--dsh-content-font-delta,0px));padding:2px 0}._1feDfq_compactionButton{width:100%;height:var(--dsh-compaction-header-height);min-width:0;color:inherit;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;padding:0;display:flex}._1feDfq_compactionRow:has(._1feDfq_compactionBody) ._1feDfq_compactionButton{z-index:7;background:var(--dsw-alias-bg-base);border-radius:0;position:sticky;top:0}._1feDfq_compactionBody :has(>[data-code-block-banner]){top:var(--dsh-compaction-header-height)}._1feDfq_compactionRow:has(._1feDfq_compactionBody) ._1feDfq_compactionButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._1feDfq_compactionButton:not(:disabled){cursor:pointer}._1feDfq_compactionButton:not(:disabled):hover{background:var(--dsw-alias-interactive-bg-hover)}._1feDfq_compactionLeading{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);flex:none;place-items:center;margin-right:6px;display:inline-grid}._1feDfq_compactionLeading svg{width:calc(14px + var(--dsh-content-font-delta,0px));height:calc(14px + var(--dsh-content-font-delta,0px))}._1feDfq_compactionContextIcon,._1feDfq_compactionDisclosureIcon{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}._1feDfq_compactionDisclosureIcon,._1feDfq_compactionButton:not(:disabled):hover ._1feDfq_compactionContextIcon,._1feDfq_compactionButton:not(:disabled):focus-visible ._1feDfq_compactionContextIcon{opacity:0}._1feDfq_compactionButton:not(:disabled):hover ._1feDfq_compactionDisclosureIcon,._1feDfq_compactionButton:not(:disabled):focus-visible ._1feDfq_compactionDisclosureIcon{opacity:1}._1feDfq_compactionTitle{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-primary-dimmed);flex:none}._1feDfq_compactionSep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}._1feDfq_compactionSummary{min-width:0;color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}._1feDfq_compactionBody{padding:4px 0 4px calc(22px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px))}._1feDfq_retryRow{color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px))}._1feDfq_retrySummary{width:fit-content;color:inherit;cursor:pointer;user-select:none;border-radius:3px;align-items:center;gap:7px;padding:2px 0;list-style:none;display:inline-flex}._1feDfq_retrySummary::-webkit-details-marker{display:none}._1feDfq_retrySummary:after{content:\"\";opacity:.8;border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transition:transform .12s;transform:rotate(-45deg)}._1feDfq_retrySummary:hover{color:var(--dsw-alias-label-secondary)}._1feDfq_retrySummary:focus-visible{outline:1.5px solid var(--dsw-alias-button-info-fill);outline-offset:2px}._1feDfq_retryText{color:inherit}._1feDfq_retryRow[data-active] ._1feDfq_retryText{background:linear-gradient(90deg, var(--dsw-alias-label-tertiary) 0%, var(--dsw-alias-label-tertiary) 40%, var(--dsw-alias-label-secondary) 50%, var(--dsw-alias-label-tertiary) 60%, var(--dsw-alias-label-tertiary) 100%);color:#0000;background-position:100%;background-size:200% 100%;background-clip:text;animation:1.6s ease-in-out infinite _1feDfq_retry-shimmer}._1feDfq_retryRow[open] ._1feDfq_retrySummary:after{transform:rotate(45deg)}._1feDfq_retryDetails{overflow-wrap:anywhere;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px));gap:2px;margin-top:3px;padding-left:14px;display:grid}._1feDfq_retryDetailLabel{color:var(--dsw-alias-label-secondary)}._1feDfq_turnErrorRow{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));grid-template-columns:10px minmax(0,1fr) auto;align-items:start;gap:8px;padding:2px 0;display:grid}._1feDfq_turnErrorDot{margin-top:5px}._1feDfq_turnErrorCopy{overflow-wrap:anywhere;min-width:0}._1feDfq_turnErrorTitle{color:var(--dsw-alias-state-error-primary);margin-right:6px;font-weight:600}._1feDfq_turnErrorMessage{color:var(--dsw-alias-label-secondary)}._1feDfq_turnErrorCode{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-markdown-code-block-small)}._1feDfq_maxTokensTitle{color:var(--dsw-alias-state-warn-primary);margin-right:6px;font-weight:600}@keyframes _1feDfq_retry-shimmer{0%{background-position:100%}to{background-position:0}}@media (prefers-reduced-motion:reduce){._1feDfq_retryRow[data-active] ._1feDfq_retryText{color:inherit;background:0 0;animation:none}}._1feDfq_attachmentRow{flex-wrap:wrap;justify-content:flex-end;gap:8px;max-width:100%;display:flex}._1feDfq_fileCard{border:.5px solid var(--dsw-alias-border-l2,#0000001f);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;border-radius:16px;flex:0 0 240px;align-items:center;gap:10px;width:240px;min-height:64px;padding:8px 12px;display:inline-flex}._1feDfq_fileIcon{flex:none;width:28px;height:28px}._1feDfq_fileContent{flex-direction:column;flex:1;min-width:0;display:flex}._1feDfq_fileName{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}._1feDfq_fileMeta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}";
|
|
188
|
-
const tagId$17 = "@deepseek-ai/dsh-client-ui-chat/MessageItem.module.css";
|
|
169
|
+
//#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-chat/src/client/chat/ContextBody.module.css.mjs
|
|
170
|
+
const css$17 = ".tWRmZG_text{color:var(--dsw-alias-label-secondary);font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWRmZG_fields{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:2px;margin:8px 0 0;padding-top:8px;display:flex}.tWRmZG_field{gap:8px;min-width:0;display:flex}.tWRmZG_fieldKey{min-width:96px;color:var(--dsw-alias-label-caption);flex:none}.tWRmZG_fieldValue{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;flex:auto;margin:0}.tWRmZG_files{flex-wrap:wrap;gap:4px 12px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWRmZG_file{align-items:baseline;gap:6px;min-width:0;display:flex}.tWRmZG_filePath{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWRmZG_fileAction{color:var(--dsw-alias-label-caption)}.tWRmZG_catalogNotice{color:var(--dsw-alias-label-caption);margin:0 0 6px}.tWRmZG_entries{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.tWRmZG_entry{gap:8px;min-width:0;display:flex}.tWRmZG_entryName{color:var(--dsw-alias-label-secondary);flex:none}.tWRmZG_entryDescription{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}.tWRmZG_sections{flex-direction:column;gap:8px;margin:0;display:flex}.tWRmZG_section{flex-direction:column;gap:2px;min-width:0;display:flex}.tWRmZG_sectionName{color:var(--dsw-alias-label-caption)}.tWRmZG_sectionText{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWRmZG_relaySender{color:var(--dsw-alias-label-caption);overflow-wrap:anywhere;margin:0 0 6px}.tWRmZG_recalls{flex-direction:column;gap:2px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWRmZG_recall{gap:8px;min-width:0;display:flex}.tWRmZG_recallLabel{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWRmZG_recallCounts{color:var(--dsw-alias-label-caption);flex:none}";
|
|
171
|
+
const tagId$17 = "@deepseek-ai/dsh-client-ui-chat/ContextBody.module.css";
|
|
189
172
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$17) + "]") === null) {
|
|
190
173
|
const tag = document.createElement("style");
|
|
191
174
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-chat";
|
|
@@ -193,114 +176,6 @@ window.__ModuleLoader__.load({
|
|
|
193
176
|
tag.textContent = css$17;
|
|
194
177
|
document.head.appendChild(tag);
|
|
195
178
|
}
|
|
196
|
-
var MessageItem_module_css_default = {
|
|
197
|
-
"attachmentRow": "_1feDfq_attachmentRow",
|
|
198
|
-
"bubble": "_1feDfq_bubble",
|
|
199
|
-
"compactionBody": "_1feDfq_compactionBody",
|
|
200
|
-
"compactionButton": "_1feDfq_compactionButton",
|
|
201
|
-
"compactionContextIcon": "_1feDfq_compactionContextIcon",
|
|
202
|
-
"compactionDisclosureIcon": "_1feDfq_compactionDisclosureIcon",
|
|
203
|
-
"compactionLeading": "_1feDfq_compactionLeading",
|
|
204
|
-
"compactionRow": "_1feDfq_compactionRow",
|
|
205
|
-
"compactionSep": "_1feDfq_compactionSep",
|
|
206
|
-
"compactionSummary": "_1feDfq_compactionSummary",
|
|
207
|
-
"compactionTitle": "_1feDfq_compactionTitle",
|
|
208
|
-
"contextRow": "_1feDfq_contextRow",
|
|
209
|
-
"fileCard": "_1feDfq_fileCard",
|
|
210
|
-
"fileContent": "_1feDfq_fileContent",
|
|
211
|
-
"fileIcon": "_1feDfq_fileIcon",
|
|
212
|
-
"fileMeta": "_1feDfq_fileMeta",
|
|
213
|
-
"fileName": "_1feDfq_fileName",
|
|
214
|
-
"maxTokensTitle": "_1feDfq_maxTokensTitle",
|
|
215
|
-
"referenceSummary": "_1feDfq_referenceSummary",
|
|
216
|
-
"retry-shimmer": "_1feDfq_retry-shimmer",
|
|
217
|
-
"retryDetailLabel": "_1feDfq_retryDetailLabel",
|
|
218
|
-
"retryDetails": "_1feDfq_retryDetails",
|
|
219
|
-
"retryRow": "_1feDfq_retryRow",
|
|
220
|
-
"retrySummary": "_1feDfq_retrySummary",
|
|
221
|
-
"retryText": "_1feDfq_retryText",
|
|
222
|
-
"turnErrorCode": "_1feDfq_turnErrorCode",
|
|
223
|
-
"turnErrorCopy": "_1feDfq_turnErrorCopy",
|
|
224
|
-
"turnErrorDot": "_1feDfq_turnErrorDot",
|
|
225
|
-
"turnErrorMessage": "_1feDfq_turnErrorMessage",
|
|
226
|
-
"turnErrorRow": "_1feDfq_turnErrorRow",
|
|
227
|
-
"turnErrorTitle": "_1feDfq_turnErrorTitle",
|
|
228
|
-
"userRow": "_1feDfq_userRow",
|
|
229
|
-
"userStack": "_1feDfq_userStack"
|
|
230
|
-
};
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region lib/types/client/chat/CompactionItem.js
|
|
233
|
-
/**
|
|
234
|
-
* Renders the model-history compaction marker.
|
|
235
|
-
* @param props - the marker node off the snapshot cache.
|
|
236
|
-
* @returns the marker row, with the summary disclosure when one is available.
|
|
237
|
-
*/
|
|
238
|
-
const CompactionItem = (0, react.memo)(function CompactionItem({ node, title, fallbackSummary, t }) {
|
|
239
|
-
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
240
|
-
const labels = (0, react.useMemo)(() => markdownLabels(t), [t]);
|
|
241
|
-
const expandable = node.summary !== null;
|
|
242
|
-
const open = expandable && expanded;
|
|
243
|
-
const summary = node.shadowedItemCount !== null && node.shadowedTokenCount !== null ? t("message.compaction.completed", {
|
|
244
|
-
items: node.shadowedItemCount,
|
|
245
|
-
tokens: node.shadowedTokenCount
|
|
246
|
-
}) : fallbackSummary ?? (expandable ? t("message.compaction.expand") : t("message.compaction.unavailable"));
|
|
247
|
-
return (0, react_jsx_runtime.jsxs)("div", {
|
|
248
|
-
className: MessageItem_module_css_default.compactionRow,
|
|
249
|
-
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
250
|
-
type: "button",
|
|
251
|
-
className: MessageItem_module_css_default.compactionButton,
|
|
252
|
-
disabled: !expandable,
|
|
253
|
-
"aria-expanded": expandable ? open : void 0,
|
|
254
|
-
onClick: () => {
|
|
255
|
-
setExpanded((value) => !value);
|
|
256
|
-
},
|
|
257
|
-
children: [
|
|
258
|
-
(0, react_jsx_runtime.jsxs)("span", {
|
|
259
|
-
className: MessageItem_module_css_default.compactionLeading,
|
|
260
|
-
"aria-hidden": true,
|
|
261
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
262
|
-
className: MessageItem_module_css_default.compactionContextIcon,
|
|
263
|
-
"data-compaction-icon": "context",
|
|
264
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutlineRegular, {})
|
|
265
|
-
}), (0, react_jsx_runtime.jsx)("span", {
|
|
266
|
-
className: MessageItem_module_css_default.compactionDisclosureIcon,
|
|
267
|
-
"data-compaction-disclosure": open ? "expanded" : "collapsed",
|
|
268
|
-
children: open ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, {})
|
|
269
|
-
})]
|
|
270
|
-
}),
|
|
271
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
272
|
-
className: MessageItem_module_css_default.compactionTitle,
|
|
273
|
-
children: title ?? t("message.compaction")
|
|
274
|
-
}),
|
|
275
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
276
|
-
className: MessageItem_module_css_default.compactionSep,
|
|
277
|
-
"aria-hidden": true
|
|
278
|
-
}),
|
|
279
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
280
|
-
className: MessageItem_module_css_default.compactionSummary,
|
|
281
|
-
children: summary
|
|
282
|
-
})
|
|
283
|
-
]
|
|
284
|
-
}), open && node.summary !== null && (0, react_jsx_runtime.jsx)("div", {
|
|
285
|
-
className: MessageItem_module_css_default.compactionBody,
|
|
286
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
287
|
-
text: node.summary,
|
|
288
|
-
labels
|
|
289
|
-
})
|
|
290
|
-
})]
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-chat/src/client/chat/ContextBody.module.css.mjs
|
|
295
|
-
const css$16 = ".tWRmZG_text{color:var(--dsw-alias-label-secondary);font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWRmZG_fields{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:2px;margin:8px 0 0;padding-top:8px;display:flex}.tWRmZG_field{gap:8px;min-width:0;display:flex}.tWRmZG_fieldKey{min-width:96px;color:var(--dsw-alias-label-caption);flex:none}.tWRmZG_fieldValue{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;flex:auto;margin:0}.tWRmZG_files{flex-wrap:wrap;gap:4px 12px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWRmZG_file{align-items:baseline;gap:6px;min-width:0;display:flex}.tWRmZG_filePath{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWRmZG_fileAction{color:var(--dsw-alias-label-caption)}.tWRmZG_catalogNotice{color:var(--dsw-alias-label-caption);margin:0 0 6px}.tWRmZG_entries{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.tWRmZG_entry{gap:8px;min-width:0;display:flex}.tWRmZG_entryName{color:var(--dsw-alias-label-secondary);flex:none}.tWRmZG_entryDescription{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}.tWRmZG_sections{flex-direction:column;gap:8px;margin:0;display:flex}.tWRmZG_section{flex-direction:column;gap:2px;min-width:0;display:flex}.tWRmZG_sectionName{color:var(--dsw-alias-label-caption)}.tWRmZG_sectionText{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWRmZG_relaySender{color:var(--dsw-alias-label-caption);overflow-wrap:anywhere;margin:0 0 6px}.tWRmZG_recalls{flex-direction:column;gap:2px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWRmZG_recall{gap:8px;min-width:0;display:flex}.tWRmZG_recallLabel{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWRmZG_recallCounts{color:var(--dsw-alias-label-caption);flex:none}";
|
|
296
|
-
const tagId$16 = "@deepseek-ai/dsh-client-ui-chat/ContextBody.module.css";
|
|
297
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$16) + "]") === null) {
|
|
298
|
-
const tag = document.createElement("style");
|
|
299
|
-
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-chat";
|
|
300
|
-
tag.dataset.pluginCss = tagId$16;
|
|
301
|
-
tag.textContent = css$16;
|
|
302
|
-
document.head.appendChild(tag);
|
|
303
|
-
}
|
|
304
179
|
var ContextBody_module_css_default = {
|
|
305
180
|
"catalogNotice": "tWRmZG_catalogNotice",
|
|
306
181
|
"entries": "tWRmZG_entries",
|
|
@@ -849,13 +724,13 @@ window.__ModuleLoader__.load({
|
|
|
849
724
|
}
|
|
850
725
|
//#endregion
|
|
851
726
|
//#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-chat/src/client/chat/ContextInjectionRow.module.css.mjs
|
|
852
|
-
const css$
|
|
853
|
-
const tagId$
|
|
854
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
727
|
+
const css$16 = ".bt4xOW_root{min-width:0}.bt4xOW_root[data-open]{padding-bottom:4px}.bt4xOW_chevron{color:var(--dsw-alias-label-secondary)}.bt4xOW_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.bt4xOW_source{min-width:0;color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));text-overflow:ellipsis;white-space:nowrap;flex:none;overflow:hidden}.bt4xOW_summary{min-width:0;color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}.bt4xOW_body{box-sizing:border-box;width:calc(100% - 22px - var(--dsh-content-font-delta,0px));max-height:141px;margin:4px 0 0 calc(22px + var(--dsh-content-font-delta,0px));background:var(--dsw-alias-markdown-code-block);color:var(--dsw-alias-label-tertiary);font:400 11px/16px var(--ds-font-family-code);border:none;border-radius:8px;padding:10px 16px 12px 12px;overflow:auto}";
|
|
728
|
+
const tagId$16 = "@deepseek-ai/dsh-client-ui-chat/ContextInjectionRow.module.css";
|
|
729
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$16) + "]") === null) {
|
|
855
730
|
const tag = document.createElement("style");
|
|
856
731
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-chat";
|
|
857
|
-
tag.dataset.pluginCss = tagId$
|
|
858
|
-
tag.textContent = css$
|
|
732
|
+
tag.dataset.pluginCss = tagId$16;
|
|
733
|
+
tag.textContent = css$16;
|
|
859
734
|
document.head.appendChild(tag);
|
|
860
735
|
}
|
|
861
736
|
var ContextInjectionRow_module_css_default = {
|
|
@@ -927,7 +802,323 @@ window.__ModuleLoader__.load({
|
|
|
927
802
|
children: body
|
|
928
803
|
})
|
|
929
804
|
});
|
|
930
|
-
}
|
|
805
|
+
}
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region lib/types/client/conversation-nodes/event-projection.js
|
|
808
|
+
/** Chat-owned conversion from durable Session events to Chat view data. */
|
|
809
|
+
function asRecord(value) {
|
|
810
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
811
|
+
}
|
|
812
|
+
function readString(record, key) {
|
|
813
|
+
const value = record[key];
|
|
814
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
815
|
+
}
|
|
816
|
+
function collect(source, member, field) {
|
|
817
|
+
const list = source[member];
|
|
818
|
+
if (!Array.isArray(list)) return [];
|
|
819
|
+
const seen = [];
|
|
820
|
+
for (const entry of list) {
|
|
821
|
+
const record = asRecord(entry);
|
|
822
|
+
const value = record === null ? null : readString(record, field);
|
|
823
|
+
if (value !== null && !seen.includes(value)) seen.push(value);
|
|
824
|
+
}
|
|
825
|
+
return seen;
|
|
826
|
+
}
|
|
827
|
+
function joined(names) {
|
|
828
|
+
return names.length > 0 ? names.join(", ") : null;
|
|
829
|
+
}
|
|
830
|
+
/** Forms Chat presents structurally; unknown merge-extensible values remain opaque. */
|
|
831
|
+
const KNOWN_FORMS = [
|
|
832
|
+
"instructions",
|
|
833
|
+
"catalog",
|
|
834
|
+
"snapshot",
|
|
835
|
+
"notice",
|
|
836
|
+
"relay",
|
|
837
|
+
"recall"
|
|
838
|
+
];
|
|
839
|
+
/**
|
|
840
|
+
* Read the target-supported presentation form from a durable message source.
|
|
841
|
+
* @param source - Logged `user/message` source.
|
|
842
|
+
* @returns Supported form, or null for the opaque presentation.
|
|
843
|
+
*/
|
|
844
|
+
function contextForm(source) {
|
|
845
|
+
const record = asRecord(source);
|
|
846
|
+
const form = record === null ? null : readString(record, "form");
|
|
847
|
+
return form !== null && KNOWN_FORMS.includes(form) ? form : null;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Project a durable message source to the Chat row's role and producer label.
|
|
851
|
+
* @param source - Logged `user/message` source.
|
|
852
|
+
* @returns Role and label rendered by Chat.
|
|
853
|
+
*/
|
|
854
|
+
function contextProducer(source) {
|
|
855
|
+
const record = asRecord(source);
|
|
856
|
+
const kind = record === null ? null : readString(record, "kind");
|
|
857
|
+
if (record === null || kind === null) return {
|
|
858
|
+
role: "inject",
|
|
859
|
+
label: null
|
|
860
|
+
};
|
|
861
|
+
switch (kind) {
|
|
862
|
+
case "session-reference": return {
|
|
863
|
+
role: "recall",
|
|
864
|
+
label: joined(collect(record, "references", "label")) ?? kind
|
|
865
|
+
};
|
|
866
|
+
case "agent-instructions": return {
|
|
867
|
+
role: "inject",
|
|
868
|
+
label: joined(collect(record, "changes", "path")) ?? kind
|
|
869
|
+
};
|
|
870
|
+
case "skill-invocation": return {
|
|
871
|
+
role: "inject",
|
|
872
|
+
label: readString(record, "name") ?? kind
|
|
873
|
+
};
|
|
874
|
+
default: return {
|
|
875
|
+
role: "inject",
|
|
876
|
+
label: kind
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Read distinct labels cited by a durable cross-session recall source.
|
|
882
|
+
* @param source - Logged `user/message` source.
|
|
883
|
+
* @returns Labels in first-seen order.
|
|
884
|
+
*/
|
|
885
|
+
function sessionRecallLabels(source) {
|
|
886
|
+
const record = asRecord(source);
|
|
887
|
+
if (record === null || readString(record, "kind") !== "session-reference") return [];
|
|
888
|
+
return collect(record, "references", "label");
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Read the skill name a durable skill-invocation injection loaded.
|
|
892
|
+
* @param source - Logged `user/message` source.
|
|
893
|
+
* @returns The skill name, or null for every other source.
|
|
894
|
+
*/
|
|
895
|
+
function skillInvocationName(source) {
|
|
896
|
+
const record = asRecord(source);
|
|
897
|
+
if (record === null || readString(record, "kind") !== "skill-invocation") return null;
|
|
898
|
+
return readString(record, "name");
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Classify finalized Assistant content for Chat rendering.
|
|
902
|
+
* @param content - Core content blocks.
|
|
903
|
+
* @returns Chat blocks in source order.
|
|
904
|
+
*/
|
|
905
|
+
function toAssistantBlocks(content) {
|
|
906
|
+
return content.map(toAssistantBlock);
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Classify one finalized Assistant block for Chat rendering.
|
|
910
|
+
* @param block - Core content block.
|
|
911
|
+
* @returns Chat block.
|
|
912
|
+
*/
|
|
913
|
+
function toAssistantBlock(block) {
|
|
914
|
+
switch (block.type) {
|
|
915
|
+
case "text": return {
|
|
916
|
+
kind: "text",
|
|
917
|
+
text: block.text
|
|
918
|
+
};
|
|
919
|
+
case "reasoning": return {
|
|
920
|
+
kind: "reasoning",
|
|
921
|
+
text: block.text
|
|
922
|
+
};
|
|
923
|
+
case "image": return {
|
|
924
|
+
kind: "image",
|
|
925
|
+
attachment: block.attachment
|
|
926
|
+
};
|
|
927
|
+
case "tool-call": return {
|
|
928
|
+
kind: "tool-call",
|
|
929
|
+
callId: String(block.id),
|
|
930
|
+
name: block.name,
|
|
931
|
+
argsRaw: block.arguments
|
|
932
|
+
};
|
|
933
|
+
default: return {
|
|
934
|
+
kind: "other",
|
|
935
|
+
block
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Create the initial Chat block for one streamed Assistant block kind.
|
|
941
|
+
* @param blockType - Wire block kind.
|
|
942
|
+
* @returns Empty block ready to receive deltas.
|
|
943
|
+
*/
|
|
944
|
+
function emptyAssistantBlock(blockType) {
|
|
945
|
+
switch (blockType) {
|
|
946
|
+
case "text": return {
|
|
947
|
+
kind: "text",
|
|
948
|
+
text: ""
|
|
949
|
+
};
|
|
950
|
+
case "reasoning": return {
|
|
951
|
+
kind: "reasoning",
|
|
952
|
+
text: ""
|
|
953
|
+
};
|
|
954
|
+
case "tool-call": return {
|
|
955
|
+
kind: "tool-call",
|
|
956
|
+
callId: "",
|
|
957
|
+
name: "",
|
|
958
|
+
argsRaw: ""
|
|
959
|
+
};
|
|
960
|
+
default: return {
|
|
961
|
+
kind: "other",
|
|
962
|
+
block: null
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Convert a durable failure to locale-independent fields safe for Chat.
|
|
968
|
+
* @param failure - Failure preserved by a Session event.
|
|
969
|
+
* @returns Sanitized message and optional stable provider code.
|
|
970
|
+
*/
|
|
971
|
+
function displayFailure(failure) {
|
|
972
|
+
if (failure === null || typeof failure !== "object") return { message: String(failure) };
|
|
973
|
+
const record = failure;
|
|
974
|
+
const code = typeof record.code === "string" ? record.code : void 0;
|
|
975
|
+
if (code === "AUTH") return {
|
|
976
|
+
code,
|
|
977
|
+
message: ""
|
|
978
|
+
};
|
|
979
|
+
return {
|
|
980
|
+
...code === void 0 ? {} : { code },
|
|
981
|
+
message: typeof record.message === "string" ? record.message : JSON.stringify(failure)
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Whether a stream chunk carries visible model output for Chat timing.
|
|
986
|
+
* @param chunk - Stream chunk to inspect.
|
|
987
|
+
* @returns true for a non-empty text, reasoning, or Tool-call delta.
|
|
988
|
+
*/
|
|
989
|
+
function isTokenDelta(chunk) {
|
|
990
|
+
switch (chunk.type) {
|
|
991
|
+
case "text-delta":
|
|
992
|
+
case "reasoning-delta": return chunk.text !== "";
|
|
993
|
+
case "tool-call-delta": return chunk.argumentsDelta !== "" || chunk.name !== void 0;
|
|
994
|
+
default: return false;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region lib/types/client/markdown-labels.js
|
|
999
|
+
/** Localized copy adapters for Cordis-free Markdown primitives. */
|
|
1000
|
+
/**
|
|
1001
|
+
* Build the complete Markdown chrome copy for one locale revision.
|
|
1002
|
+
* @param t - Chat locale seat.
|
|
1003
|
+
* @returns Labels for code fences and footnotes.
|
|
1004
|
+
*/
|
|
1005
|
+
function markdownLabels(t) {
|
|
1006
|
+
return {
|
|
1007
|
+
code: {
|
|
1008
|
+
copyLabel: t("copy"),
|
|
1009
|
+
copiedLabel: t("copied")
|
|
1010
|
+
},
|
|
1011
|
+
footnotes: t("markdown.footnotes")
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
//#endregion
|
|
1015
|
+
//#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-chat/src/client/chat/MessageItem.module.css.mjs
|
|
1016
|
+
const css$15 = "._1feDfq_userRow{flex-direction:column;align-items:flex-end;gap:6px;display:flex}._1feDfq_userStack{min-width:0;max-width:min(calc(var(--dsh-chat-content-width,748px) * .702), 82%);flex-direction:column;align-items:flex-end;gap:8px;display:flex}._1feDfq_bubble{background:var(--dsw-specific-bubble);max-width:100%;font-size:var(--dsh-content-font-size,14px);line-height:calc(22px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-word;border-radius:22px;padding:10px 16px}._1feDfq_referenceSummary{color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px))}._1feDfq_contextRow{padding:2px 0}._1feDfq_compactionRow{--dsh-compaction-header-height:calc(24px + var(--dsh-content-font-delta,0px));padding:2px 0}._1feDfq_compactionButton{width:100%;height:var(--dsh-compaction-header-height);min-width:0;color:inherit;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;padding:0;display:flex}._1feDfq_compactionRow:has(._1feDfq_compactionBody) ._1feDfq_compactionButton{z-index:7;background:var(--dsw-alias-bg-base);border-radius:0;position:sticky;top:0}._1feDfq_compactionBody :has(>[data-code-block-banner]){top:var(--dsh-compaction-header-height)}._1feDfq_compactionRow:has(._1feDfq_compactionBody) ._1feDfq_compactionButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._1feDfq_compactionButton:not(:disabled){cursor:pointer}._1feDfq_compactionButton:not(:disabled):hover{background:var(--dsw-alias-interactive-bg-hover)}._1feDfq_compactionLeading{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);flex:none;place-items:center;margin-right:6px;display:inline-grid}._1feDfq_compactionLeading svg{width:calc(14px + var(--dsh-content-font-delta,0px));height:calc(14px + var(--dsh-content-font-delta,0px))}._1feDfq_compactionContextIcon,._1feDfq_compactionDisclosureIcon{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}._1feDfq_compactionDisclosureIcon,._1feDfq_compactionButton:not(:disabled):hover ._1feDfq_compactionContextIcon,._1feDfq_compactionButton:not(:disabled):focus-visible ._1feDfq_compactionContextIcon{opacity:0}._1feDfq_compactionButton:not(:disabled):hover ._1feDfq_compactionDisclosureIcon,._1feDfq_compactionButton:not(:disabled):focus-visible ._1feDfq_compactionDisclosureIcon{opacity:1}._1feDfq_compactionTitle{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-primary-dimmed);flex:none}._1feDfq_compactionSep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}._1feDfq_compactionSummary{min-width:0;color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}._1feDfq_compactionBody{padding:4px 0 4px calc(22px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px))}._1feDfq_retryRow{color:var(--dsw-alias-label-tertiary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px))}._1feDfq_retrySummary{width:fit-content;color:inherit;cursor:pointer;user-select:none;border-radius:3px;align-items:center;gap:7px;padding:2px 0;list-style:none;display:inline-flex}._1feDfq_retrySummary::-webkit-details-marker{display:none}._1feDfq_retrySummary:after{content:\"\";opacity:.8;border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transition:transform .12s;transform:rotate(-45deg)}._1feDfq_retrySummary:hover{color:var(--dsw-alias-label-secondary)}._1feDfq_retrySummary:focus-visible{outline:1.5px solid var(--dsw-alias-button-info-fill);outline-offset:2px}._1feDfq_retryText{color:inherit}._1feDfq_retryRow[data-active] ._1feDfq_retryText{background:linear-gradient(90deg, var(--dsw-alias-label-tertiary) 0%, var(--dsw-alias-label-tertiary) 40%, var(--dsw-alias-label-secondary) 50%, var(--dsw-alias-label-tertiary) 60%, var(--dsw-alias-label-tertiary) 100%);color:#0000;background-position:100%;background-size:200% 100%;background-clip:text;animation:1.6s ease-in-out infinite _1feDfq_retry-shimmer}._1feDfq_retryRow[open] ._1feDfq_retrySummary:after{transform:rotate(45deg)}._1feDfq_retryDetails{overflow-wrap:anywhere;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px));gap:2px;margin-top:3px;padding-left:14px;display:grid}._1feDfq_retryDetailLabel{color:var(--dsw-alias-label-secondary)}._1feDfq_turnErrorRow{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));grid-template-columns:10px minmax(0,1fr) auto;align-items:start;gap:8px;padding:2px 0;display:grid}._1feDfq_turnErrorDot{margin-top:5px}._1feDfq_turnErrorCopy{overflow-wrap:anywhere;min-width:0}._1feDfq_turnErrorTitle{color:var(--dsw-alias-state-error-primary);margin-right:6px;font-weight:600}._1feDfq_turnErrorMessage{color:var(--dsw-alias-label-secondary)}._1feDfq_turnErrorCode{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-markdown-code-block-small)}._1feDfq_maxTokensTitle{color:var(--dsw-alias-state-warn-primary);margin-right:6px;font-weight:600}@keyframes _1feDfq_retry-shimmer{0%{background-position:100%}to{background-position:0}}@media (prefers-reduced-motion:reduce){._1feDfq_retryRow[data-active] ._1feDfq_retryText{color:inherit;background:0 0;animation:none}}._1feDfq_attachmentRow{flex-wrap:wrap;justify-content:flex-end;gap:8px;max-width:100%;display:flex}._1feDfq_fileCard{border:.5px solid var(--dsw-alias-border-l2,#0000001f);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;border-radius:16px;flex:0 0 240px;align-items:center;gap:10px;width:240px;min-height:64px;padding:8px 12px;display:inline-flex}._1feDfq_fileIcon{flex:none;width:28px;height:28px}._1feDfq_fileContent{flex-direction:column;flex:1;min-width:0;display:flex}._1feDfq_fileName{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}._1feDfq_fileMeta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}";
|
|
1017
|
+
const tagId$15 = "@deepseek-ai/dsh-client-ui-chat/MessageItem.module.css";
|
|
1018
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$15) + "]") === null) {
|
|
1019
|
+
const tag = document.createElement("style");
|
|
1020
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-chat";
|
|
1021
|
+
tag.dataset.pluginCss = tagId$15;
|
|
1022
|
+
tag.textContent = css$15;
|
|
1023
|
+
document.head.appendChild(tag);
|
|
1024
|
+
}
|
|
1025
|
+
var MessageItem_module_css_default = {
|
|
1026
|
+
"attachmentRow": "_1feDfq_attachmentRow",
|
|
1027
|
+
"bubble": "_1feDfq_bubble",
|
|
1028
|
+
"compactionBody": "_1feDfq_compactionBody",
|
|
1029
|
+
"compactionButton": "_1feDfq_compactionButton",
|
|
1030
|
+
"compactionContextIcon": "_1feDfq_compactionContextIcon",
|
|
1031
|
+
"compactionDisclosureIcon": "_1feDfq_compactionDisclosureIcon",
|
|
1032
|
+
"compactionLeading": "_1feDfq_compactionLeading",
|
|
1033
|
+
"compactionRow": "_1feDfq_compactionRow",
|
|
1034
|
+
"compactionSep": "_1feDfq_compactionSep",
|
|
1035
|
+
"compactionSummary": "_1feDfq_compactionSummary",
|
|
1036
|
+
"compactionTitle": "_1feDfq_compactionTitle",
|
|
1037
|
+
"contextRow": "_1feDfq_contextRow",
|
|
1038
|
+
"fileCard": "_1feDfq_fileCard",
|
|
1039
|
+
"fileContent": "_1feDfq_fileContent",
|
|
1040
|
+
"fileIcon": "_1feDfq_fileIcon",
|
|
1041
|
+
"fileMeta": "_1feDfq_fileMeta",
|
|
1042
|
+
"fileName": "_1feDfq_fileName",
|
|
1043
|
+
"maxTokensTitle": "_1feDfq_maxTokensTitle",
|
|
1044
|
+
"referenceSummary": "_1feDfq_referenceSummary",
|
|
1045
|
+
"retry-shimmer": "_1feDfq_retry-shimmer",
|
|
1046
|
+
"retryDetailLabel": "_1feDfq_retryDetailLabel",
|
|
1047
|
+
"retryDetails": "_1feDfq_retryDetails",
|
|
1048
|
+
"retryRow": "_1feDfq_retryRow",
|
|
1049
|
+
"retrySummary": "_1feDfq_retrySummary",
|
|
1050
|
+
"retryText": "_1feDfq_retryText",
|
|
1051
|
+
"turnErrorCode": "_1feDfq_turnErrorCode",
|
|
1052
|
+
"turnErrorCopy": "_1feDfq_turnErrorCopy",
|
|
1053
|
+
"turnErrorDot": "_1feDfq_turnErrorDot",
|
|
1054
|
+
"turnErrorMessage": "_1feDfq_turnErrorMessage",
|
|
1055
|
+
"turnErrorRow": "_1feDfq_turnErrorRow",
|
|
1056
|
+
"turnErrorTitle": "_1feDfq_turnErrorTitle",
|
|
1057
|
+
"userRow": "_1feDfq_userRow",
|
|
1058
|
+
"userStack": "_1feDfq_userStack"
|
|
1059
|
+
};
|
|
1060
|
+
//#endregion
|
|
1061
|
+
//#region lib/types/client/chat/CompactionItem.js
|
|
1062
|
+
/**
|
|
1063
|
+
* Renders the model-history compaction marker.
|
|
1064
|
+
* @param props - the marker node off the snapshot cache.
|
|
1065
|
+
* @returns the marker row, with the summary disclosure when one is available.
|
|
1066
|
+
*/
|
|
1067
|
+
const CompactionItem = (0, react.memo)(function CompactionItem({ node, title, fallbackSummary, t }) {
|
|
1068
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
1069
|
+
const labels = (0, react.useMemo)(() => markdownLabels(t), [t]);
|
|
1070
|
+
const expandable = node.summary !== null;
|
|
1071
|
+
const open = expandable && expanded;
|
|
1072
|
+
const summary = node.shadowedItemCount !== null && node.shadowedTokenCount !== null ? t("message.compaction.completed", {
|
|
1073
|
+
items: node.shadowedItemCount,
|
|
1074
|
+
tokens: node.shadowedTokenCount
|
|
1075
|
+
}) : fallbackSummary ?? (expandable ? t("message.compaction.expand") : t("message.compaction.unavailable"));
|
|
1076
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
1077
|
+
className: MessageItem_module_css_default.compactionRow,
|
|
1078
|
+
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
1079
|
+
type: "button",
|
|
1080
|
+
className: MessageItem_module_css_default.compactionButton,
|
|
1081
|
+
disabled: !expandable,
|
|
1082
|
+
"aria-expanded": expandable ? open : void 0,
|
|
1083
|
+
onClick: () => {
|
|
1084
|
+
setExpanded((value) => !value);
|
|
1085
|
+
},
|
|
1086
|
+
children: [
|
|
1087
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
1088
|
+
className: MessageItem_module_css_default.compactionLeading,
|
|
1089
|
+
"aria-hidden": true,
|
|
1090
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
1091
|
+
className: MessageItem_module_css_default.compactionContextIcon,
|
|
1092
|
+
"data-compaction-icon": "context",
|
|
1093
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutlineRegular, {})
|
|
1094
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
1095
|
+
className: MessageItem_module_css_default.compactionDisclosureIcon,
|
|
1096
|
+
"data-compaction-disclosure": open ? "expanded" : "collapsed",
|
|
1097
|
+
children: open ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, {})
|
|
1098
|
+
})]
|
|
1099
|
+
}),
|
|
1100
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1101
|
+
className: MessageItem_module_css_default.compactionTitle,
|
|
1102
|
+
children: title ?? t("message.compaction")
|
|
1103
|
+
}),
|
|
1104
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1105
|
+
className: MessageItem_module_css_default.compactionSep,
|
|
1106
|
+
"aria-hidden": true
|
|
1107
|
+
}),
|
|
1108
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
1109
|
+
className: MessageItem_module_css_default.compactionSummary,
|
|
1110
|
+
children: summary
|
|
1111
|
+
})
|
|
1112
|
+
]
|
|
1113
|
+
}), open && node.summary !== null && (0, react_jsx_runtime.jsx)("div", {
|
|
1114
|
+
className: MessageItem_module_css_default.compactionBody,
|
|
1115
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
1116
|
+
text: node.summary,
|
|
1117
|
+
labels
|
|
1118
|
+
})
|
|
1119
|
+
})]
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
931
1122
|
//#endregion
|
|
932
1123
|
//#region lib/types/client/chat/message-chrome.js
|
|
933
1124
|
/** Refresh interval for whole-second live run clocks. */
|
|
@@ -4733,6 +4924,7 @@ window.__ModuleLoader__.load({
|
|
|
4733
4924
|
setFileOpenBusy(false);
|
|
4734
4925
|
}, []);
|
|
4735
4926
|
const inboxSteering = (0, react.useMemo)(() => inbox?.["next-step"].filter((message) => message.source.kind === "user") ?? [], [inbox]);
|
|
4927
|
+
const inboxInjections = (0, react.useMemo)(() => inbox?.["next-step"].filter((message) => message.source.kind !== "user") ?? [], [inbox]);
|
|
4736
4928
|
const pendingSubmissions = useSession((s) => s.pendingSubmissions);
|
|
4737
4929
|
const visibleSubmissions = (0, react.useMemo)(() => {
|
|
4738
4930
|
if (pendingSubmissions.length === 0) return pendingSubmissions;
|
|
@@ -4851,6 +5043,16 @@ window.__ModuleLoader__.load({
|
|
|
4851
5043
|
content: item.content,
|
|
4852
5044
|
renderMessageImages,
|
|
4853
5045
|
t
|
|
5046
|
+
}, item.id)),
|
|
5047
|
+
inboxInjections.map((item) => (0, react_jsx_runtime.jsx)("div", {
|
|
5048
|
+
"data-pending-injection": "",
|
|
5049
|
+
children: (0, react_jsx_runtime.jsx)(ContextInjectionRow, {
|
|
5050
|
+
content: item.content,
|
|
5051
|
+
source: item.source,
|
|
5052
|
+
producer: contextProducer(item.source),
|
|
5053
|
+
form: contextForm(item.source),
|
|
5054
|
+
t
|
|
5055
|
+
})
|
|
4854
5056
|
}, item.id))
|
|
4855
5057
|
]
|
|
4856
5058
|
}),
|
|
@@ -6714,197 +6916,6 @@ window.__ModuleLoader__.load({
|
|
|
6714
6916
|
};
|
|
6715
6917
|
}
|
|
6716
6918
|
//#endregion
|
|
6717
|
-
//#region lib/types/client/conversation-nodes/event-projection.js
|
|
6718
|
-
/** Chat-owned conversion from durable Session events to Chat view data. */
|
|
6719
|
-
function asRecord(value) {
|
|
6720
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
6721
|
-
}
|
|
6722
|
-
function readString(record, key) {
|
|
6723
|
-
const value = record[key];
|
|
6724
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
6725
|
-
}
|
|
6726
|
-
function collect(source, member, field) {
|
|
6727
|
-
const list = source[member];
|
|
6728
|
-
if (!Array.isArray(list)) return [];
|
|
6729
|
-
const seen = [];
|
|
6730
|
-
for (const entry of list) {
|
|
6731
|
-
const record = asRecord(entry);
|
|
6732
|
-
const value = record === null ? null : readString(record, field);
|
|
6733
|
-
if (value !== null && !seen.includes(value)) seen.push(value);
|
|
6734
|
-
}
|
|
6735
|
-
return seen;
|
|
6736
|
-
}
|
|
6737
|
-
function joined(names) {
|
|
6738
|
-
return names.length > 0 ? names.join(", ") : null;
|
|
6739
|
-
}
|
|
6740
|
-
/** Forms Chat presents structurally; unknown merge-extensible values remain opaque. */
|
|
6741
|
-
const KNOWN_FORMS = [
|
|
6742
|
-
"instructions",
|
|
6743
|
-
"catalog",
|
|
6744
|
-
"snapshot",
|
|
6745
|
-
"notice",
|
|
6746
|
-
"relay",
|
|
6747
|
-
"recall"
|
|
6748
|
-
];
|
|
6749
|
-
/**
|
|
6750
|
-
* Read the target-supported presentation form from a durable message source.
|
|
6751
|
-
* @param source - Logged `user/message` source.
|
|
6752
|
-
* @returns Supported form, or null for the opaque presentation.
|
|
6753
|
-
*/
|
|
6754
|
-
function contextForm(source) {
|
|
6755
|
-
const record = asRecord(source);
|
|
6756
|
-
const form = record === null ? null : readString(record, "form");
|
|
6757
|
-
return form !== null && KNOWN_FORMS.includes(form) ? form : null;
|
|
6758
|
-
}
|
|
6759
|
-
/**
|
|
6760
|
-
* Project a durable message source to the Chat row's role and producer label.
|
|
6761
|
-
* @param source - Logged `user/message` source.
|
|
6762
|
-
* @returns Role and label rendered by Chat.
|
|
6763
|
-
*/
|
|
6764
|
-
function contextProducer(source) {
|
|
6765
|
-
const record = asRecord(source);
|
|
6766
|
-
const kind = record === null ? null : readString(record, "kind");
|
|
6767
|
-
if (record === null || kind === null) return {
|
|
6768
|
-
role: "inject",
|
|
6769
|
-
label: null
|
|
6770
|
-
};
|
|
6771
|
-
switch (kind) {
|
|
6772
|
-
case "session-reference": return {
|
|
6773
|
-
role: "recall",
|
|
6774
|
-
label: joined(collect(record, "references", "label")) ?? kind
|
|
6775
|
-
};
|
|
6776
|
-
case "agent-instructions": return {
|
|
6777
|
-
role: "inject",
|
|
6778
|
-
label: joined(collect(record, "changes", "path")) ?? kind
|
|
6779
|
-
};
|
|
6780
|
-
case "skill-invocation": return {
|
|
6781
|
-
role: "inject",
|
|
6782
|
-
label: readString(record, "name") ?? kind
|
|
6783
|
-
};
|
|
6784
|
-
default: return {
|
|
6785
|
-
role: "inject",
|
|
6786
|
-
label: kind
|
|
6787
|
-
};
|
|
6788
|
-
}
|
|
6789
|
-
}
|
|
6790
|
-
/**
|
|
6791
|
-
* Read distinct labels cited by a durable cross-session recall source.
|
|
6792
|
-
* @param source - Logged `user/message` source.
|
|
6793
|
-
* @returns Labels in first-seen order.
|
|
6794
|
-
*/
|
|
6795
|
-
function sessionRecallLabels(source) {
|
|
6796
|
-
const record = asRecord(source);
|
|
6797
|
-
if (record === null || readString(record, "kind") !== "session-reference") return [];
|
|
6798
|
-
return collect(record, "references", "label");
|
|
6799
|
-
}
|
|
6800
|
-
/**
|
|
6801
|
-
* Read the skill name a durable skill-invocation injection loaded.
|
|
6802
|
-
* @param source - Logged `user/message` source.
|
|
6803
|
-
* @returns The skill name, or null for every other source.
|
|
6804
|
-
*/
|
|
6805
|
-
function skillInvocationName(source) {
|
|
6806
|
-
const record = asRecord(source);
|
|
6807
|
-
if (record === null || readString(record, "kind") !== "skill-invocation") return null;
|
|
6808
|
-
return readString(record, "name");
|
|
6809
|
-
}
|
|
6810
|
-
/**
|
|
6811
|
-
* Classify finalized Assistant content for Chat rendering.
|
|
6812
|
-
* @param content - Core content blocks.
|
|
6813
|
-
* @returns Chat blocks in source order.
|
|
6814
|
-
*/
|
|
6815
|
-
function toAssistantBlocks(content) {
|
|
6816
|
-
return content.map(toAssistantBlock);
|
|
6817
|
-
}
|
|
6818
|
-
/**
|
|
6819
|
-
* Classify one finalized Assistant block for Chat rendering.
|
|
6820
|
-
* @param block - Core content block.
|
|
6821
|
-
* @returns Chat block.
|
|
6822
|
-
*/
|
|
6823
|
-
function toAssistantBlock(block) {
|
|
6824
|
-
switch (block.type) {
|
|
6825
|
-
case "text": return {
|
|
6826
|
-
kind: "text",
|
|
6827
|
-
text: block.text
|
|
6828
|
-
};
|
|
6829
|
-
case "reasoning": return {
|
|
6830
|
-
kind: "reasoning",
|
|
6831
|
-
text: block.text
|
|
6832
|
-
};
|
|
6833
|
-
case "image": return {
|
|
6834
|
-
kind: "image",
|
|
6835
|
-
attachment: block.attachment
|
|
6836
|
-
};
|
|
6837
|
-
case "tool-call": return {
|
|
6838
|
-
kind: "tool-call",
|
|
6839
|
-
callId: String(block.id),
|
|
6840
|
-
name: block.name,
|
|
6841
|
-
argsRaw: block.arguments
|
|
6842
|
-
};
|
|
6843
|
-
default: return {
|
|
6844
|
-
kind: "other",
|
|
6845
|
-
block
|
|
6846
|
-
};
|
|
6847
|
-
}
|
|
6848
|
-
}
|
|
6849
|
-
/**
|
|
6850
|
-
* Create the initial Chat block for one streamed Assistant block kind.
|
|
6851
|
-
* @param blockType - Wire block kind.
|
|
6852
|
-
* @returns Empty block ready to receive deltas.
|
|
6853
|
-
*/
|
|
6854
|
-
function emptyAssistantBlock(blockType) {
|
|
6855
|
-
switch (blockType) {
|
|
6856
|
-
case "text": return {
|
|
6857
|
-
kind: "text",
|
|
6858
|
-
text: ""
|
|
6859
|
-
};
|
|
6860
|
-
case "reasoning": return {
|
|
6861
|
-
kind: "reasoning",
|
|
6862
|
-
text: ""
|
|
6863
|
-
};
|
|
6864
|
-
case "tool-call": return {
|
|
6865
|
-
kind: "tool-call",
|
|
6866
|
-
callId: "",
|
|
6867
|
-
name: "",
|
|
6868
|
-
argsRaw: ""
|
|
6869
|
-
};
|
|
6870
|
-
default: return {
|
|
6871
|
-
kind: "other",
|
|
6872
|
-
block: null
|
|
6873
|
-
};
|
|
6874
|
-
}
|
|
6875
|
-
}
|
|
6876
|
-
/**
|
|
6877
|
-
* Convert a durable failure to locale-independent fields safe for Chat.
|
|
6878
|
-
* @param failure - Failure preserved by a Session event.
|
|
6879
|
-
* @returns Sanitized message and optional stable provider code.
|
|
6880
|
-
*/
|
|
6881
|
-
function displayFailure(failure) {
|
|
6882
|
-
if (failure === null || typeof failure !== "object") return { message: String(failure) };
|
|
6883
|
-
const record = failure;
|
|
6884
|
-
const code = typeof record.code === "string" ? record.code : void 0;
|
|
6885
|
-
if (code === "AUTH") return {
|
|
6886
|
-
code,
|
|
6887
|
-
message: ""
|
|
6888
|
-
};
|
|
6889
|
-
return {
|
|
6890
|
-
...code === void 0 ? {} : { code },
|
|
6891
|
-
message: typeof record.message === "string" ? record.message : JSON.stringify(failure)
|
|
6892
|
-
};
|
|
6893
|
-
}
|
|
6894
|
-
/**
|
|
6895
|
-
* Whether a stream chunk carries visible model output for Chat timing.
|
|
6896
|
-
* @param chunk - Stream chunk to inspect.
|
|
6897
|
-
* @returns true for a non-empty text, reasoning, or Tool-call delta.
|
|
6898
|
-
*/
|
|
6899
|
-
function isTokenDelta(chunk) {
|
|
6900
|
-
switch (chunk.type) {
|
|
6901
|
-
case "text-delta":
|
|
6902
|
-
case "reasoning-delta": return chunk.text !== "";
|
|
6903
|
-
case "tool-call-delta": return chunk.argumentsDelta !== "" || chunk.name !== void 0;
|
|
6904
|
-
default: return false;
|
|
6905
|
-
}
|
|
6906
|
-
}
|
|
6907
|
-
//#endregion
|
|
6908
6919
|
//#region lib/types/client/conversation-nodes/assistant.js
|
|
6909
6920
|
function initialState(turn, step) {
|
|
6910
6921
|
return {
|