@ahggg/dsh-side-chat 0.7.2 → 0.7.3

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 (173) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/lib/client/apply.d.ts +0 -1
  4. package/lib/client/apply.js +0 -1
  5. package/lib/client/contracts.d.ts +0 -1
  6. package/lib/client/contracts.js +0 -1
  7. package/lib/client/index.d.ts +0 -1
  8. package/lib/client/index.js +0 -1
  9. package/lib/client/model-preference.d.ts +0 -1
  10. package/lib/client/model-preference.js +0 -1
  11. package/lib/client/panel/SelectionQuote.d.ts +0 -1
  12. package/lib/client/panel/SelectionQuote.js +0 -1
  13. package/lib/client/panel/SendIcon.d.ts +0 -1
  14. package/lib/client/panel/SendIcon.js +0 -1
  15. package/lib/client/panel/SideChatBody.d.ts +0 -1
  16. package/lib/client/panel/SideChatBody.js +0 -1
  17. package/lib/client/panel/SideChatErrorState.d.ts +0 -1
  18. package/lib/client/panel/SideChatErrorState.js +0 -1
  19. package/lib/client/panel/SideChatHeader.d.ts +0 -1
  20. package/lib/client/panel/SideChatHeader.js +0 -1
  21. package/lib/client/panel/SideChatModelSelect.d.ts +0 -1
  22. package/lib/client/panel/SideChatModelSelect.js +0 -1
  23. package/lib/client/panel/SideChatPanel.d.ts +0 -1
  24. package/lib/client/panel/SideChatPanel.js +0 -1
  25. package/lib/client/panel/StopIcon.d.ts +0 -1
  26. package/lib/client/panel/StopIcon.js +0 -1
  27. package/lib/client/panel/messages.d.ts +0 -1
  28. package/lib/client/panel/messages.js +0 -1
  29. package/lib/client/panel/use-auto-growing-textarea.d.ts +0 -1
  30. package/lib/client/panel/use-auto-growing-textarea.js +0 -1
  31. package/lib/client/parent-composer/ParentConversationAnnotations.d.ts +0 -1
  32. package/lib/client/parent-composer/ParentConversationAnnotations.js +26 -3
  33. package/lib/client/parent-composer/add-to-conversation.d.ts +0 -1
  34. package/lib/client/parent-composer/add-to-conversation.js +99 -8
  35. package/lib/client/parent-composer/annotation-persistence.d.ts +0 -1
  36. package/lib/client/parent-composer/annotation-persistence.js +0 -1
  37. package/lib/client/parent-composer/composer-reference.d.ts +16 -7
  38. package/lib/client/parent-composer/composer-reference.js +34 -2
  39. package/lib/client/parent-composer/referenced-conversation.d.ts +1 -2
  40. package/lib/client/parent-composer/referenced-conversation.js +26 -8
  41. package/lib/client/rc6/ArchivedConversation.d.ts +2 -3
  42. package/lib/client/rc6/ArchivedConversation.js +6 -5
  43. package/lib/client/rc6/Rc6SideChatOverlay.d.ts +0 -1
  44. package/lib/client/rc6/Rc6SideChatOverlay.js +0 -1
  45. package/lib/client/rc6/SideChatTool.d.ts +1 -2
  46. package/lib/client/rc6/SideChatTool.js +18 -9
  47. package/lib/client/rc6/context.d.ts +9 -3
  48. package/lib/client/rc6/context.js +0 -1
  49. package/lib/client/rc6/primitive-labels.d.ts +7 -0
  50. package/lib/client/rc6/primitive-labels.js +60 -0
  51. package/lib/client/rc6/remote-adapter.d.ts +0 -1
  52. package/lib/client/rc6/remote-adapter.js +4 -3
  53. package/lib/client/rc6/runtime-compat.d.ts +120 -0
  54. package/lib/client/rc6/runtime-compat.js +187 -0
  55. package/lib/client/rc6/sessions-adapter.d.ts +7 -4
  56. package/lib/client/rc6/sessions-adapter.js +62 -45
  57. package/lib/client/selection/ConversationAnnotationMarkers.d.ts +0 -1
  58. package/lib/client/selection/ConversationAnnotationMarkers.js +0 -1
  59. package/lib/client/selection/SelectionActions.d.ts +0 -1
  60. package/lib/client/selection/SelectionActions.js +0 -1
  61. package/lib/client/selection/selection-controller.d.ts +0 -1
  62. package/lib/client/selection/selection-controller.js +0 -1
  63. package/lib/client/selection/selection-limits.d.ts +0 -1
  64. package/lib/client/selection/selection-limits.js +0 -1
  65. package/lib/client/selection/selection-normalizer.d.ts +0 -1
  66. package/lib/client/selection/selection-normalizer.js +0 -1
  67. package/lib/client/side-chat-controller.d.ts +0 -1
  68. package/lib/client/side-chat-controller.js +0 -1
  69. package/lib/client.js +1173 -8951
  70. package/lib/host/archived-fork-service.d.ts +0 -1
  71. package/lib/host/archived-fork-service.js +71 -26
  72. package/lib/host/index.d.ts +0 -1
  73. package/lib/host/index.js +0 -1
  74. package/lib/index.d.ts +0 -1
  75. package/lib/index.js +0 -1
  76. package/lib/remote.d.ts +0 -1
  77. package/lib/remote.js +0 -1
  78. package/lib/shared/archived-wire.d.ts +0 -1
  79. package/lib/shared/archived-wire.js +0 -1
  80. package/lib/shared/constants.d.ts +0 -1
  81. package/lib/shared/constants.js +0 -1
  82. package/lib/shared/contracts.d.ts +0 -1
  83. package/lib/shared/contracts.js +0 -1
  84. package/lib/shared/error-codes.d.ts +0 -1
  85. package/lib/shared/error-codes.js +0 -1
  86. package/lib/shared/observable.d.ts +0 -1
  87. package/lib/shared/observable.js +0 -1
  88. package/lib/typert.d.ts +0 -1
  89. package/lib/typert.js +64 -51
  90. package/package.json +60 -38
  91. package/lib/client/apply.d.ts.map +0 -1
  92. package/lib/client/apply.js.map +0 -1
  93. package/lib/client/contracts.d.ts.map +0 -1
  94. package/lib/client/contracts.js.map +0 -1
  95. package/lib/client/index.d.ts.map +0 -1
  96. package/lib/client/index.js.map +0 -1
  97. package/lib/client/model-preference.d.ts.map +0 -1
  98. package/lib/client/model-preference.js.map +0 -1
  99. package/lib/client/panel/SelectionQuote.d.ts.map +0 -1
  100. package/lib/client/panel/SelectionQuote.js.map +0 -1
  101. package/lib/client/panel/SendIcon.d.ts.map +0 -1
  102. package/lib/client/panel/SendIcon.js.map +0 -1
  103. package/lib/client/panel/SideChatBody.d.ts.map +0 -1
  104. package/lib/client/panel/SideChatBody.js.map +0 -1
  105. package/lib/client/panel/SideChatErrorState.d.ts.map +0 -1
  106. package/lib/client/panel/SideChatErrorState.js.map +0 -1
  107. package/lib/client/panel/SideChatHeader.d.ts.map +0 -1
  108. package/lib/client/panel/SideChatHeader.js.map +0 -1
  109. package/lib/client/panel/SideChatModelSelect.d.ts.map +0 -1
  110. package/lib/client/panel/SideChatModelSelect.js.map +0 -1
  111. package/lib/client/panel/SideChatPanel.d.ts.map +0 -1
  112. package/lib/client/panel/SideChatPanel.js.map +0 -1
  113. package/lib/client/panel/StopIcon.d.ts.map +0 -1
  114. package/lib/client/panel/StopIcon.js.map +0 -1
  115. package/lib/client/panel/messages.d.ts.map +0 -1
  116. package/lib/client/panel/messages.js.map +0 -1
  117. package/lib/client/panel/use-auto-growing-textarea.d.ts.map +0 -1
  118. package/lib/client/panel/use-auto-growing-textarea.js.map +0 -1
  119. package/lib/client/parent-composer/ParentConversationAnnotations.d.ts.map +0 -1
  120. package/lib/client/parent-composer/ParentConversationAnnotations.js.map +0 -1
  121. package/lib/client/parent-composer/add-to-conversation.d.ts.map +0 -1
  122. package/lib/client/parent-composer/add-to-conversation.js.map +0 -1
  123. package/lib/client/parent-composer/annotation-persistence.d.ts.map +0 -1
  124. package/lib/client/parent-composer/annotation-persistence.js.map +0 -1
  125. package/lib/client/parent-composer/composer-reference.d.ts.map +0 -1
  126. package/lib/client/parent-composer/composer-reference.js.map +0 -1
  127. package/lib/client/parent-composer/referenced-conversation.d.ts.map +0 -1
  128. package/lib/client/parent-composer/referenced-conversation.js.map +0 -1
  129. package/lib/client/rc6/ArchivedConversation.d.ts.map +0 -1
  130. package/lib/client/rc6/ArchivedConversation.js.map +0 -1
  131. package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +0 -1
  132. package/lib/client/rc6/Rc6SideChatOverlay.js.map +0 -1
  133. package/lib/client/rc6/SideChatTool.d.ts.map +0 -1
  134. package/lib/client/rc6/SideChatTool.js.map +0 -1
  135. package/lib/client/rc6/context.d.ts.map +0 -1
  136. package/lib/client/rc6/context.js.map +0 -1
  137. package/lib/client/rc6/remote-adapter.d.ts.map +0 -1
  138. package/lib/client/rc6/remote-adapter.js.map +0 -1
  139. package/lib/client/rc6/sessions-adapter.d.ts.map +0 -1
  140. package/lib/client/rc6/sessions-adapter.js.map +0 -1
  141. package/lib/client/selection/ConversationAnnotationMarkers.d.ts.map +0 -1
  142. package/lib/client/selection/ConversationAnnotationMarkers.js.map +0 -1
  143. package/lib/client/selection/SelectionActions.d.ts.map +0 -1
  144. package/lib/client/selection/SelectionActions.js.map +0 -1
  145. package/lib/client/selection/selection-controller.d.ts.map +0 -1
  146. package/lib/client/selection/selection-controller.js.map +0 -1
  147. package/lib/client/selection/selection-limits.d.ts.map +0 -1
  148. package/lib/client/selection/selection-limits.js.map +0 -1
  149. package/lib/client/selection/selection-normalizer.d.ts.map +0 -1
  150. package/lib/client/selection/selection-normalizer.js.map +0 -1
  151. package/lib/client/side-chat-controller.d.ts.map +0 -1
  152. package/lib/client/side-chat-controller.js.map +0 -1
  153. package/lib/client.js.map +0 -1
  154. package/lib/host/archived-fork-service.d.ts.map +0 -1
  155. package/lib/host/archived-fork-service.js.map +0 -1
  156. package/lib/host/index.d.ts.map +0 -1
  157. package/lib/host/index.js.map +0 -1
  158. package/lib/index.d.ts.map +0 -1
  159. package/lib/index.js.map +0 -1
  160. package/lib/remote.d.ts.map +0 -1
  161. package/lib/remote.js.map +0 -1
  162. package/lib/shared/archived-wire.d.ts.map +0 -1
  163. package/lib/shared/archived-wire.js.map +0 -1
  164. package/lib/shared/constants.d.ts.map +0 -1
  165. package/lib/shared/constants.js.map +0 -1
  166. package/lib/shared/contracts.d.ts.map +0 -1
  167. package/lib/shared/contracts.js.map +0 -1
  168. package/lib/shared/error-codes.d.ts.map +0 -1
  169. package/lib/shared/error-codes.js.map +0 -1
  170. package/lib/shared/observable.d.ts.map +0 -1
  171. package/lib/shared/observable.js.map +0 -1
  172. package/lib/typert.d.ts.map +0 -1
  173. package/lib/typert.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { draftWithoutOccurrence } from './composer-reference.js';
1
+ import { draftWithoutOccurrence, newlyInsertedOccurrence, occurrenceEditSpan, } from './composer-reference.js';
2
2
  export const SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE = 'dsh-side-chat-conversation';
3
3
  const OPEN_TAG = '<referenced_conversation>';
4
4
  const CLOSE_TAG = '</referenced_conversation>';
@@ -20,7 +20,7 @@ function visibleContentText(content) {
20
20
  }
21
21
  function assistantText(node) {
22
22
  return node.blocks
23
- .flatMap(block => block.kind === 'text' ? [block.text] : [])
23
+ .flatMap((block) => block.kind === 'text' ? [block.text] : [])
24
24
  .join('\n')
25
25
  .trim();
26
26
  }
@@ -151,6 +151,14 @@ function removeOccurrence(input, occurrenceId) {
151
151
  catch {
152
152
  return;
153
153
  }
154
+ if (input.referenceMode === 'lexical' && input.replaceText !== undefined) {
155
+ const span = occurrenceEditSpan(input, snapshot, occurrence, {
156
+ consumeFollowingSeparator: true,
157
+ });
158
+ if (span !== undefined)
159
+ input.replaceText('', span);
160
+ return;
161
+ }
154
162
  const draft = draftWithoutOccurrence(snapshot, occurrence, title, { consumeAdjacentSpace: true });
155
163
  if (draft !== undefined)
156
164
  input.setDraft(draft);
@@ -164,19 +172,30 @@ export function addReferencedSideChatToConversation(input, reference) {
164
172
  const encoded = encodeReferencedConversation(reference);
165
173
  if (existing.some(occurrence => occurrence.ref === encoded))
166
174
  return true;
175
+ const target = input.referenceMode === 'lexical' ? existing[0] : undefined;
176
+ const span = target === undefined
177
+ ? { start: 0, end: 0, draftRev: before.draftRev }
178
+ : occurrenceEditSpan(input, before, target);
179
+ if (span === undefined)
180
+ return false;
167
181
  const inserted = input.insertReference({
168
182
  source: SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE,
169
183
  ref: encoded,
170
184
  label: reference.title,
171
185
  appearance: 'session',
172
186
  clipboardText: `@${reference.title}`,
173
- }, {
174
- start: 0,
175
- end: 0,
176
- draftRev: before.draftRev,
177
- });
187
+ }, span);
178
188
  if (!inserted)
179
189
  return false;
190
+ if (input.referenceMode === 'lexical') {
191
+ const after = input.state.getSnapshot();
192
+ const occurrence = newlyInsertedOccurrence(before, after, SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE, encoded);
193
+ if (occurrence === undefined)
194
+ return false;
195
+ for (const duplicate of existing.slice(1))
196
+ removeOccurrence(input, duplicate.occurrenceId);
197
+ return matchingOccurrences(input.state.getSnapshot(), reference).length === 1;
198
+ }
180
199
  for (const occurrence of existing)
181
200
  removeOccurrence(input, occurrence.occurrenceId);
182
201
  return true;
@@ -197,4 +216,3 @@ export const sideChatConversationReferenceSource = {
197
216
  },
198
217
  },
199
218
  };
200
- //# sourceMappingURL=referenced-conversation.js.map
@@ -1,10 +1,10 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { SessionFace } from '@deepseek-ai/dsh-client-runtime/client';
3
2
  import type { ConversationSelection } from '../../shared/contracts.js';
4
3
  import type { SideChatController } from '../side-chat-controller.js';
4
+ import type { SideChatConversationFace } from './runtime-compat.js';
5
5
  /** Functional rc.6 conversation surface bound to a non-current child Session. */
6
6
  export declare function ArchivedConversation({ face, inheritedThroughSeq, controller, selection, locale, cwd, modelControl, }: {
7
- readonly face: SessionFace;
7
+ readonly face: SideChatConversationFace;
8
8
  readonly inheritedThroughSeq: number;
9
9
  readonly controller: SideChatController;
10
10
  readonly selection?: ConversationSelection;
@@ -12,4 +12,3 @@ export declare function ArchivedConversation({ face, inheritedThroughSeq, contro
12
12
  readonly cwd?: string | undefined;
13
13
  readonly modelControl?: ReactNode;
14
14
  }): import("react/jsx-runtime").JSX.Element;
15
- //# sourceMappingURL=ArchivedConversation.d.ts.map
@@ -7,6 +7,7 @@ import { SendIcon } from '../panel/SendIcon.js';
7
7
  import { StopIcon } from '../panel/StopIcon.js';
8
8
  import { useAutoGrowingTextarea } from '../panel/use-auto-growing-textarea.js';
9
9
  import { RunningToolCard, ToolBlockCard, ToolCard, } from './SideChatTool.js';
10
+ import { MARKDOWN_LABELS } from './primitive-labels.js';
10
11
  function stringify(value) {
11
12
  if (typeof value === 'string')
12
13
  return value;
@@ -87,8 +88,9 @@ function ReasoningRow({ text, running, locale }) {
87
88
  function AssistantBlocks({ blocks, streaming = false, projectedToolCallIds, unprojectedToolState = 'pending', cwd, locale }) {
88
89
  return _jsx(_Fragment, { children: blocks.map((block, index) => {
89
90
  const key = `${block.kind}-${String(index)}`;
90
- if (block.kind === 'text')
91
- return _jsx(MarkdownText, { text: block.text, streaming: streaming }, key);
91
+ if (block.kind === 'text') {
92
+ return _jsx(MarkdownText, { text: block.text, streaming: streaming, labels: MARKDOWN_LABELS }, key);
93
+ }
92
94
  if (block.kind === 'reasoning') {
93
95
  return (_jsx(ReasoningRow, { text: block.text, running: streaming && index === blocks.length - 1, locale: locale }, key));
94
96
  }
@@ -133,10 +135,10 @@ function MessageRow({ node, projectedToolCallIds, cwd, locale }) {
133
135
  return _jsxs("details", { className: "dsh-side-chat-turn-notice", children: [_jsx("summary", { children: node.type }), _jsx("pre", { children: stringify(node.data) })] });
134
136
  }
135
137
  function ApprovalCard({ wait, onRespond, }) {
136
- return (_jsxs("section", { className: "dsh-side-chat-interaction", "aria-label": "Tool approval required", children: [_jsxs("strong", { children: ["Allow tool: ", wait.payload.toolName, "?"] }), wait.payload.reason !== undefined && _jsx("p", { children: wait.payload.reason }), _jsxs("div", { className: "dsh-side-chat-interaction-actions", children: [_jsx("button", { type: "button", onClick: () => { onRespond('decline'); }, children: "Decline" }), _jsx("button", { type: "button", onClick: () => { onRespond('approve'); }, children: "Allow once" })] })] }));
138
+ return (_jsxs("section", { className: "dsh-side-chat-interaction", "aria-label": "Tool approval required", children: [_jsxs("strong", { children: ["Allow tool: ", wait.toolName, "?"] }), wait.reason !== undefined && _jsx("p", { children: wait.reason }), _jsxs("div", { className: "dsh-side-chat-interaction-actions", children: [_jsx("button", { type: "button", onClick: () => { onRespond('decline'); }, children: "Decline" }), _jsx("button", { type: "button", onClick: () => { onRespond('approve'); }, children: "Allow once" })] })] }));
137
139
  }
138
140
  function QuestionCard({ wait, onRespond, }) {
139
- const questions = wait.payload.questions;
141
+ const questions = wait.questions;
140
142
  const [answers, setAnswers] = useState(() => Object.fromEntries(questions.map(question => [question.id, { selected: [], custom: '' }])));
141
143
  const update = (id, answer) => {
142
144
  setAnswers(current => ({ ...current, [id]: answer }));
@@ -227,4 +229,3 @@ export function ArchivedConversation({ face, inheritedThroughSeq, controller, se
227
229
  }
228
230
  } }), _jsxs("div", { className: "dsh-side-chat-composer-actions", children: [modelControl, snapshot.running ? (_jsx("button", { type: "button", className: "dsh-side-chat-stop-button", "aria-label": "Stop generating", title: "Stop generating", onClick: () => { void controller.cancel(); }, children: _jsx(StopIcon, {}) })) : (_jsx("button", { type: "submit", className: "dsh-side-chat-send-button", "aria-label": "Send", disabled: sending || draft.trim().length === 0, children: _jsx(SendIcon, {}) }))] })] })] }));
229
231
  }
230
- //# sourceMappingURL=ArchivedConversation.js.map
@@ -5,4 +5,3 @@ export declare function Rc6SideChatOverlay({ controller, sessions, }: {
5
5
  readonly controller: SideChatController;
6
6
  readonly sessions: Rc6SideChatSessions;
7
7
  }): import("react/jsx-runtime").JSX.Element;
8
- //# sourceMappingURL=Rc6SideChatOverlay.d.ts.map
@@ -382,4 +382,3 @@ export function Rc6SideChatOverlay({ controller, sessions, }) {
382
382
  void sessions.openSession(state.parentSessionId);
383
383
  }, onAddToConversation: addToConversation, addToConversationDisabled: addToConversationDisabled, onRemoveSelection: () => { controller.clearSelection(); } }))] }));
384
384
  }
385
- //# sourceMappingURL=Rc6SideChatOverlay.js.map
@@ -1,5 +1,5 @@
1
- import type { RunningToolCall, ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client';
2
1
  import type { ContentBlock } from '@deepseek-ai/dsh-api-remotes/client';
2
+ import type { RunningToolCall, ToolCallBlock } from './runtime-compat.js';
3
3
  export type ToolState = 'pending' | 'running' | 'success' | 'error' | 'interrupted';
4
4
  export declare function toolOutputText(content: readonly ContentBlock[]): string;
5
5
  export declare function ToolCard({ callId, name, argsRaw, state, output, callView, resultView, cwd, }: {
@@ -20,4 +20,3 @@ export declare function RunningToolCard({ call, cwd }: {
20
20
  readonly call: RunningToolCall;
21
21
  readonly cwd?: string | undefined;
22
22
  }): import("react/jsx-runtime").JSX.Element;
23
- //# sourceMappingURL=SideChatTool.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { CodeBlock, DiffBlock, DisclosureRow, IconApiOutline14, IconBrowseOutline16, IconCodeOutline16, IconEditOutline16, IconSearchOutline16, IconSparkle16, ReadBlock, SearchBlock, StateDot, TerminalBlock, WebBlock, } from '@deepseek-ai/dsh-client-ui-primitives';
4
+ import { DIFF_LABELS, READ_LABELS, SEARCH_LABELS, TERMINAL_LABELS, WEB_LABELS, } from './primitive-labels.js';
4
5
  const TOOL_VARIANTS = {
5
6
  bash: 'bash',
6
7
  pwsh: 'bash',
@@ -238,7 +239,7 @@ function validSearchCard(resultView) {
238
239
  if (result['shape'] === 'paths') {
239
240
  const paths = result['paths'];
240
241
  return Array.isArray(paths) && paths.every((path) => typeof path === 'string')
241
- ? { kind: 'paths', paths, truncated, total }
242
+ ? { kind: 'paths', paths, truncated, total, labels: SEARCH_LABELS }
242
243
  : null;
243
244
  }
244
245
  if (result['shape'] !== 'matches' || !Array.isArray(result['files']))
@@ -261,7 +262,7 @@ function validSearchCard(resultView) {
261
262
  }
262
263
  files.push({ path, matches });
263
264
  }
264
- return { kind: 'matches', files, truncated, total };
265
+ return { kind: 'matches', files, truncated, total, labels: SEARCH_LABELS };
265
266
  }
266
267
  function validDiffs(view) {
267
268
  const value = record(view);
@@ -289,7 +290,9 @@ function validWebCard(view) {
289
290
  if (result['kind'] === 'fetch') {
290
291
  const url = stringValue(result['url']);
291
292
  const statusCode = numberValue(result['statusCode']);
292
- return url === undefined || statusCode === undefined ? null : { kind: 'fetch', url, statusCode, truncated };
293
+ return url === undefined || statusCode === undefined
294
+ ? null
295
+ : { kind: 'fetch', url, statusCode, truncated, labels: WEB_LABELS };
293
296
  }
294
297
  if (result['kind'] !== 'search' || !Array.isArray(result['sources']))
295
298
  return null;
@@ -310,7 +313,13 @@ function validWebCard(view) {
310
313
  });
311
314
  }
312
315
  const answer = stringValue(result['answer']);
313
- return { kind: 'search', sources, truncated, ...(answer === undefined ? {} : { answer }) };
316
+ return {
317
+ kind: 'search',
318
+ sources,
319
+ truncated,
320
+ labels: WEB_LABELS,
321
+ ...(answer === undefined ? {} : { answer }),
322
+ };
314
323
  }
315
324
  function genericBody(variant, argsRaw) {
316
325
  if (argsRaw === '' || argsRaw === '{}')
@@ -362,13 +371,13 @@ export function ToolCard({ callId, name, argsRaw, state, output, callView, resul
362
371
  return (_jsxs("section", { className: "dsh-side-chat-tool", "data-call-id": callId, "data-state": visualState, "data-expanded": open || undefined, children: [status !== null && _jsx("span", { className: "dsh-side-chat-tool-visually-hidden", children: status }), _jsx(DisclosureRow, { rowClassName: "dsh-side-chat-tool-row", leadingClassName: "dsh-side-chat-tool-leading", titleClassName: "dsh-side-chat-tool-title", chevronClassName: "dsh-side-chat-tool-chevron", icon: leadingFor(visualState, variantIcon(variant)), title: toolTitle(name, variant), open: open, expandable: expandable, expandOnRowClick: true, keepContentWhenOpen: true, onToggle: () => { setExpanded(current => !current); }, collapsedContent: summaryText !== '' && (_jsxs(_Fragment, { children: [_jsx("span", { className: "dsh-side-chat-tool-separator", "aria-hidden": "true" }), _jsx("span", { className: failureLine === null
363
372
  ? 'dsh-side-chat-tool-summary'
364
373
  : 'dsh-side-chat-tool-summary dsh-side-chat-tool-error-summary', children: summaryText })] })), children: _jsx("div", { className: "dsh-side-chat-tool-body-wrap", children: terminal !== null
365
- ? (_jsx(TerminalBlock, { command: terminal.command, cwd: terminal.cwd, output: terminal.output, exitCode: terminal.exitCode, signal: terminal.signal, running: terminal.running, maxLines: Infinity, className: "dsh-side-chat-tool-terminal" }))
374
+ ? (_jsx(TerminalBlock, { command: terminal.command, cwd: terminal.cwd, output: terminal.output, exitCode: terminal.exitCode, signal: terminal.signal, running: terminal.running, maxLines: Infinity, className: "dsh-side-chat-tool-terminal", labels: TERMINAL_LABELS }))
366
375
  : read !== null
367
- ? _jsx(ReadBlock, { ...read, maxLines: 8, className: "dsh-side-chat-tool-read" })
376
+ ? _jsx(ReadBlock, { ...read, labels: READ_LABELS, maxLines: 8, className: "dsh-side-chat-tool-read" })
368
377
  : search !== null
369
378
  ? _jsx(SearchBlock, { ...search, maxLines: 8, className: "dsh-side-chat-tool-search" })
370
379
  : diffs !== null
371
- ? _jsx(DiffBlock, { diffs: diffs, maxLines: 8, className: "dsh-side-chat-tool-diff" })
380
+ ? _jsx(DiffBlock, { diffs: diffs, labels: DIFF_LABELS, maxLines: 8, className: "dsh-side-chat-tool-diff" })
372
381
  : web !== null
373
382
  ? _jsx(WebBlock, { ...web, className: "dsh-side-chat-tool-web" })
374
383
  : code !== undefined
@@ -382,14 +391,14 @@ function resultState(node, output) {
382
391
  return /\b(?:aborted|cancelled|canceled)\b/iu.test(identity) ? 'interrupted' : 'error';
383
392
  }
384
393
  export function ToolBlockCard({ block, cwd }) {
394
+ const presentation = block;
385
395
  const settled = 'kind' in block;
386
396
  const output = settled ? toolOutputText(block.content) : undefined;
387
397
  const state = settled ? resultState(block, output ?? '') : 'running';
388
398
  const name = settled ? block.call?.name ?? block.callId : block.name;
389
399
  const argsRaw = settled ? block.call?.argsRaw ?? '{}' : block.argsRaw;
390
- return (_jsxs("div", { className: "dsh-side-chat-tool-branch", children: [_jsx(ToolCard, { callId: block.callId, name: name, argsRaw: argsRaw, state: state, output: output, callView: block.callView, resultView: settled ? block.resultView : null, cwd: cwd }), block.subCalls.length > 0 && (_jsx("div", { className: "dsh-side-chat-tool-subcalls", "data-subcalls": true, children: block.subCalls.map(child => _jsx(ToolBlockCard, { block: child, cwd: cwd }, child.callId)) }))] }));
400
+ return (_jsxs("div", { className: "dsh-side-chat-tool-branch", children: [_jsx(ToolCard, { callId: block.callId, name: name, argsRaw: argsRaw, state: state, output: output, callView: presentation.callView, resultView: settled ? presentation.resultView : null, cwd: cwd }), block.subCalls.length > 0 && (_jsx("div", { className: "dsh-side-chat-tool-subcalls", "data-subcalls": true, children: block.subCalls.map(child => _jsx(ToolBlockCard, { block: child, cwd: cwd }, child.callId)) }))] }));
391
401
  }
392
402
  export function RunningToolCard({ call, cwd }) {
393
403
  return _jsx(ToolBlockCard, { block: call, cwd: cwd });
394
404
  }
395
- //# sourceMappingURL=SideChatTool.js.map
@@ -1,10 +1,13 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client';
3
- import type { ISessions, SlotRegistry } from '@deepseek-ai/dsh-client-runtime/client';
3
+ import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client';
4
+ import type { UiConversation } from '@deepseek-ai/dsh-client-ui-conversation/client';
4
5
  import type { ModelDirectoryResolver } from '@deepseek-ai/dsh-client-ui-model-selection/client';
6
+ import type { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client';
7
+ import type { UiSession } from '@deepseek-ai/dsh-client-ui-session/client';
5
8
  import type { ParentConversationService, SelectionReferenceSource } from '../parent-composer/add-to-conversation.js';
6
9
  /** Browser-only Cordis view for a package that also compiles the Host half. */
7
- export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' | 'modelDirectories' | 'remote' | 'sessions' | 'slots'> & {
10
+ export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' | 'modelDirectories' | 'remote' | 'sessions' | 'slots' | 'uiConversation' | 'uiSession'> & {
8
11
  readonly conversation: ParentConversationService;
9
12
  readonly inputTriggers: {
10
13
  registerSource(source: SelectionReferenceSource): () => void;
@@ -13,5 +16,8 @@ export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' |
13
16
  readonly remote: ClientRemote;
14
17
  readonly sessions: ISessions;
15
18
  readonly slots: SlotRegistry;
19
+ /** Added by DSH 0.1.2; absent on the monolithic 0.1.0/0.1.1 runtime. */
20
+ readonly uiConversation?: Pick<UiConversation, 'binding'>;
21
+ /** Added by DSH 0.1.2; absent on the monolithic 0.1.0/0.1.1 runtime. */
22
+ readonly uiSession?: Pick<UiSession, 'pendingInteractions'>;
16
23
  };
17
- //# sourceMappingURL=context.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=context.js.map
@@ -0,0 +1,7 @@
1
+ import type { DiffBlockLabels, MarkdownLabels, ReadBlockLabels, SearchBlockLabels, TerminalBlockLabels, WebBlockLabels } from '@deepseek-ai/dsh-client-ui-primitives';
2
+ export declare const MARKDOWN_LABELS: MarkdownLabels;
3
+ export declare const TERMINAL_LABELS: TerminalBlockLabels;
4
+ export declare const READ_LABELS: ReadBlockLabels;
5
+ export declare const DIFF_LABELS: DiffBlockLabels;
6
+ export declare const SEARCH_LABELS: SearchBlockLabels;
7
+ export declare const WEB_LABELS: WebBlockLabels;
@@ -0,0 +1,60 @@
1
+ const hiddenLines = (hidden) => `Show ${String(hidden)} hidden line${hidden === 1 ? '' : 's'}`;
2
+ export const MARKDOWN_LABELS = {
3
+ code: { copyLabel: 'Copy', copiedLabel: 'Copied' },
4
+ footnotes: 'Footnotes',
5
+ };
6
+ export const TERMINAL_LABELS = {
7
+ signal: signal => `Signal ${signal}`,
8
+ exitCode: code => `Exit ${String(code)}`,
9
+ running: 'Running',
10
+ failed: 'Failed',
11
+ done: 'Done',
12
+ copy: 'Copy',
13
+ copied: 'Copied',
14
+ noOutput: 'No output',
15
+ collapseAria: 'Collapse command output',
16
+ collapse: 'Collapse',
17
+ expandAria: hiddenLines,
18
+ expand: hiddenLines,
19
+ };
20
+ export const READ_LABELS = {
21
+ window: (shown, total) => `Showing ${String(shown)} of ${String(total)} lines`,
22
+ copy: 'Copy',
23
+ copied: 'Copied',
24
+ collapseAria: 'Collapse file content',
25
+ expandAria: hiddenLines,
26
+ collapse: 'Collapse',
27
+ expand: hiddenLines,
28
+ };
29
+ export const DIFF_LABELS = {
30
+ copy: 'Copy',
31
+ copied: 'Copied',
32
+ collapseAria: 'Collapse diff',
33
+ expandAria: hiddenLines,
34
+ collapse: 'Collapse',
35
+ expand: hiddenLines,
36
+ files: count => `${String(count)} file${count === 1 ? '' : 's'}`,
37
+ };
38
+ export const SEARCH_LABELS = {
39
+ pathsSummary: (shown, total, truncated) => truncated
40
+ ? `Showing ${String(shown)} of ${String(total)} paths`
41
+ : `${String(total)} path${total === 1 ? '' : 's'}`,
42
+ matchesSummary: (shown, total, files, truncated) => {
43
+ const summary = `${String(shown)} match${shown === 1 ? '' : 'es'} in ${String(files)} file${files === 1 ? '' : 's'}`;
44
+ return truncated ? `${summary} (${String(total)} total)` : summary;
45
+ },
46
+ copy: 'Copy',
47
+ copied: 'Copied',
48
+ noResults: 'No results',
49
+ collapseAria: 'Collapse search results',
50
+ expandAria: hiddenLines,
51
+ collapse: 'Collapse',
52
+ expand: hiddenLines,
53
+ };
54
+ export const WEB_LABELS = {
55
+ noResults: 'No results',
56
+ sourcesTruncated: 'Sources truncated',
57
+ http: 'HTTP',
58
+ contentTruncated: 'Content truncated',
59
+ markdown: MARKDOWN_LABELS,
60
+ };
@@ -4,4 +4,3 @@ export declare function mountArchivedRemote(ctx: Rc6ClientContext): Promise<{
4
4
  readonly remote: SideChatRemote;
5
5
  readonly dispose: () => Promise<void>;
6
6
  }>;
7
- //# sourceMappingURL=remote-adapter.d.ts.map
@@ -1,9 +1,11 @@
1
1
  import TYPERT_REMOTE from '../../remote.js';
2
2
  function remoteFailure(error) {
3
+ const code = error.code;
4
+ const badRequest = code === 'bad-request' || code === 'gateway/bad-request';
3
5
  return {
4
- code: error.code === 'bad-request' ? 'invalid_request' : 'transport_error',
6
+ code: badRequest ? 'invalid_request' : 'transport_error',
5
7
  message: error.message || 'The Side Chat RPC failed.',
6
- recoverable: error.code !== 'bad-request',
8
+ recoverable: !badRequest,
7
9
  };
8
10
  }
9
11
  export async function mountArchivedRemote(ctx) {
@@ -30,4 +32,3 @@ export async function mountArchivedRemote(ctx) {
30
32
  dispose,
31
33
  };
32
34
  }
33
- //# sourceMappingURL=remote-adapter.js.map
@@ -0,0 +1,120 @@
1
+ import type { SessionFace as CurrentSessionFace } from '@deepseek-ai/dsh-api-session-controller/client';
2
+ import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
3
+ import type { AssistantBlock, ConversationNode, PartialAssistant, RunningToolCall, ToolCallBlock } from '@deepseek-ai/dsh-client-ui-conversation/client';
4
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
5
+ import type { AskUserQuestionAnswer, AskUserQuestionItem } from '@deepseek-ai/dsh-user-questions/types';
6
+ export type { AssistantBlock, ConversationNode, RunningToolCall, ToolCallBlock, };
7
+ interface RuntimeFailure {
8
+ readonly code: string;
9
+ readonly message: string;
10
+ }
11
+ export type RuntimeResult<T = unknown> = {
12
+ readonly ok: true;
13
+ readonly value: T;
14
+ } | {
15
+ readonly ok: false;
16
+ readonly error: RuntimeFailure;
17
+ };
18
+ interface ObservableSnapshot<T> {
19
+ readonly getSnapshot: () => T;
20
+ readonly subscribe: (listener: () => void) => () => void;
21
+ }
22
+ export interface SideChatNodeStore {
23
+ get(key: string): {
24
+ readonly key: string;
25
+ readonly kind: string;
26
+ readonly anchorSeq: number;
27
+ readonly visibility: 'visible' | 'hidden';
28
+ readonly location: {
29
+ readonly kind: 'session' | 'unresolved';
30
+ } | {
31
+ readonly kind: 'turn';
32
+ readonly turn: {
33
+ readonly turn: number;
34
+ readonly status: 'open' | 'closed' | 'unknown';
35
+ };
36
+ } | {
37
+ readonly kind: 'step';
38
+ readonly turn: {
39
+ readonly turn: number;
40
+ readonly status: 'open' | 'closed' | 'unknown';
41
+ };
42
+ readonly step: {
43
+ readonly status: 'open' | 'closed' | 'unknown';
44
+ };
45
+ };
46
+ } | undefined;
47
+ }
48
+ export interface SideChatApprovalInteraction {
49
+ readonly kind: 'approval';
50
+ readonly key: string;
51
+ readonly toolName: string;
52
+ readonly reason?: string;
53
+ respond(decision: 'approve' | 'decline'): Promise<boolean>;
54
+ }
55
+ export interface SideChatQuestionInteraction {
56
+ readonly kind: 'question';
57
+ readonly key: string;
58
+ readonly questions: readonly AskUserQuestionItem[];
59
+ respond(answer: AskUserQuestionAnswer | null): Promise<boolean>;
60
+ }
61
+ export type SideChatPendingInteraction = SideChatApprovalInteraction | SideChatQuestionInteraction;
62
+ export interface SideChatQueuedMessage {
63
+ readonly id: string;
64
+ readonly placement: 'queued' | 'steering' | 'context';
65
+ readonly preview: string;
66
+ }
67
+ export interface SideChatConversationSnapshot {
68
+ readonly nodes: readonly ConversationNode[];
69
+ readonly turnEnds: ReadonlyMap<number, number>;
70
+ readonly partial: PartialAssistant | null;
71
+ readonly runningCalls: readonly RunningToolCall[];
72
+ readonly pending: readonly SideChatPendingInteraction[];
73
+ readonly queue: readonly SideChatQueuedMessage[];
74
+ readonly running: boolean;
75
+ readonly openState: 'cold' | 'loading' | 'open' | 'error';
76
+ readonly promptError: {
77
+ readonly error: RuntimeFailure;
78
+ } | null;
79
+ readonly lastAgentError: string | null;
80
+ readonly chatNodes: SideChatNodeStore;
81
+ }
82
+ /** Stable surface consumed by Side Chat on both the monolithic and split DSH clients. */
83
+ export interface SideChatConversationFace extends ObservableSnapshot<SideChatConversationSnapshot> {
84
+ readonly sessionId: SessionId;
85
+ prompt(content: unknown[], mode: 'queue' | 'steer'): Promise<RuntimeResult>;
86
+ updateQueue(itemId: string, action: unknown): Promise<RuntimeResult>;
87
+ cancel(): Promise<RuntimeResult>;
88
+ rename(title: string): Promise<RuntimeResult>;
89
+ open(): Promise<void>;
90
+ }
91
+ interface RuntimeSessionFace {
92
+ readonly sessionId: SessionId;
93
+ getSnapshot(): unknown;
94
+ subscribe(listener: () => void): () => void;
95
+ prompt(content: unknown[], mode: 'queue' | 'steer'): Promise<RuntimeResult>;
96
+ updateQueue(itemId: string, action: unknown): Promise<RuntimeResult>;
97
+ cancel(): Promise<RuntimeResult>;
98
+ rename(title: string): Promise<RuntimeResult>;
99
+ open?: () => Promise<void>;
100
+ }
101
+ /** Bridge DSH <=0.1.1's combined Session snapshot and 0.1.2's split stores. */
102
+ export declare class CompatibleConversationFace implements SideChatConversationFace {
103
+ private readonly session;
104
+ private readonly chat?;
105
+ private readonly pending?;
106
+ readonly sessionId: SessionId;
107
+ private cache;
108
+ constructor(session: RuntimeSessionFace, chat?: ObservableSnapshot<ChatSnapshot | undefined> | undefined, pending?: ObservableSnapshot<ReadonlyMap<SessionId, unknown>> | undefined);
109
+ readonly subscribe: (listener: () => void) => (() => void);
110
+ readonly getSnapshot: () => SideChatConversationSnapshot;
111
+ prompt(content: unknown[], mode: 'queue' | 'steer'): Promise<RuntimeResult>;
112
+ updateQueue(itemId: string, action: unknown): Promise<RuntimeResult>;
113
+ cancel(): Promise<RuntimeResult>;
114
+ rename(title: string): Promise<RuntimeResult>;
115
+ open(): Promise<void>;
116
+ }
117
+ export declare function compatibleConversationFace(session: CurrentSessionFace, sources?: {
118
+ readonly chat?: ObservableSnapshot<ChatSnapshot | undefined>;
119
+ readonly pending?: ObservableSnapshot<ReadonlyMap<SessionId, unknown>>;
120
+ }): CompatibleConversationFace;