condukt 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/bridge/sse.d.ts.map +1 -1
  2. package/dist/bridge/sse.js +27 -4
  3. package/dist/bridge/sse.js.map +1 -1
  4. package/dist/runtimes/copilot/copilot-backend.d.ts +3 -1
  5. package/dist/runtimes/copilot/copilot-backend.d.ts.map +1 -1
  6. package/dist/runtimes/copilot/subprocess-backend.js +66 -13
  7. package/dist/runtimes/copilot/subprocess-backend.js.map +1 -1
  8. package/dist/runtimes/mock/mock-runtime.d.ts.map +1 -1
  9. package/dist/runtimes/mock/mock-runtime.js +1 -1
  10. package/dist/runtimes/mock/mock-runtime.js.map +1 -1
  11. package/dist/src/agent.d.ts.map +1 -1
  12. package/dist/src/agent.js +15 -3
  13. package/dist/src/agent.js.map +1 -1
  14. package/dist/src/events.d.ts +4 -0
  15. package/dist/src/events.d.ts.map +1 -1
  16. package/dist/src/types.d.ts +2 -1
  17. package/dist/src/types.d.ts.map +1 -1
  18. package/dist/src/types.js.map +1 -1
  19. package/dist/state/state-runtime.d.ts.map +1 -1
  20. package/dist/state/state-runtime.js +15 -3
  21. package/dist/state/state-runtime.js.map +1 -1
  22. package/dist/ui/core/index.d.ts +2 -0
  23. package/dist/ui/core/index.d.ts.map +1 -1
  24. package/dist/ui/core/index.js +5 -1
  25. package/dist/ui/core/index.js.map +1 -1
  26. package/dist/ui/index.d.ts +2 -0
  27. package/dist/ui/index.d.ts.map +1 -1
  28. package/dist/ui/index.js +5 -1
  29. package/dist/ui/index.js.map +1 -1
  30. package/dist/ui/tool-display/ResponsePartRenderer.d.ts +22 -0
  31. package/dist/ui/tool-display/ResponsePartRenderer.d.ts.map +1 -0
  32. package/dist/ui/tool-display/ResponsePartRenderer.js +53 -0
  33. package/dist/ui/tool-display/ResponsePartRenderer.js.map +1 -0
  34. package/dist/ui/tool-display/StatusLine.d.ts +12 -0
  35. package/dist/ui/tool-display/StatusLine.d.ts.map +1 -0
  36. package/dist/ui/tool-display/StatusLine.js +24 -0
  37. package/dist/ui/tool-display/StatusLine.js.map +1 -0
  38. package/dist/ui/tool-display/ThinkingSection.d.ts +21 -0
  39. package/dist/ui/tool-display/ThinkingSection.d.ts.map +1 -0
  40. package/dist/ui/tool-display/ThinkingSection.js +186 -0
  41. package/dist/ui/tool-display/ThinkingSection.js.map +1 -0
  42. package/dist/ui/tool-display/ToolProgressLine.d.ts +16 -0
  43. package/dist/ui/tool-display/ToolProgressLine.d.ts.map +1 -0
  44. package/dist/ui/tool-display/ToolProgressLine.js +137 -0
  45. package/dist/ui/tool-display/ToolProgressLine.js.map +1 -0
  46. package/dist/ui/tool-display/debug-types.d.ts +90 -0
  47. package/dist/ui/tool-display/debug-types.d.ts.map +1 -0
  48. package/dist/ui/tool-display/debug-types.js +9 -0
  49. package/dist/ui/tool-display/debug-types.js.map +1 -0
  50. package/dist/ui/tool-display/format-utils.d.ts +68 -0
  51. package/dist/ui/tool-display/format-utils.d.ts.map +1 -0
  52. package/dist/ui/tool-display/format-utils.js +182 -0
  53. package/dist/ui/tool-display/format-utils.js.map +1 -0
  54. package/dist/ui/tool-display/formatter.d.ts +58 -0
  55. package/dist/ui/tool-display/formatter.d.ts.map +1 -0
  56. package/dist/ui/tool-display/formatter.js +430 -0
  57. package/dist/ui/tool-display/formatter.js.map +1 -0
  58. package/dist/ui/tool-display/index.d.ts +28 -0
  59. package/dist/ui/tool-display/index.d.ts.map +1 -0
  60. package/dist/ui/tool-display/index.js +57 -0
  61. package/dist/ui/tool-display/index.js.map +1 -0
  62. package/dist/ui/tool-display/response-parts.d.ts +120 -0
  63. package/dist/ui/tool-display/response-parts.d.ts.map +1 -0
  64. package/dist/ui/tool-display/response-parts.js +264 -0
  65. package/dist/ui/tool-display/response-parts.js.map +1 -0
  66. package/dist/ui/tool-display/types.d.ts +72 -0
  67. package/dist/ui/tool-display/types.d.ts.map +1 -0
  68. package/dist/ui/tool-display/types.js +28 -0
  69. package/dist/ui/tool-display/types.js.map +1 -0
  70. package/dist/ui/tool-display/view-logic.d.ts +28 -0
  71. package/dist/ui/tool-display/view-logic.d.ts.map +1 -0
  72. package/dist/ui/tool-display/view-logic.js +257 -0
  73. package/dist/ui/tool-display/view-logic.js.map +1 -0
  74. package/package.json +7 -1
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Typed response part model + builder for structured agent output rendering.
3
+ *
4
+ * Implements VS Code Copilot Chat's "pin to thinking" model:
5
+ * - Pinnable tools (file, search, edit, shell) are absorbed into collapsible
6
+ * thinking sections — only the progress line (icon + message), never output.
7
+ * - Standalone tools (MCP, subagent, task) render as flat progress lines.
8
+ * - Markdown (agent speech) ALWAYS renders full-size, never absorbed into thinking.
9
+ * - Tool output goes to onToolOutput() and is invisible in thinking blocks.
10
+ */
11
+ import type { ToolInvocation } from './types';
12
+ import type { ToolFormatterRegistry } from './formatter';
13
+ export interface ThinkingTextItem {
14
+ readonly kind: 'thinking-text';
15
+ content: string;
16
+ }
17
+ export interface PinnedToolItem {
18
+ readonly kind: 'pinned-tool';
19
+ tool: ToolInvocation;
20
+ }
21
+ export type ThinkingSectionItem = ThinkingTextItem | PinnedToolItem;
22
+ export interface MarkdownPart {
23
+ readonly kind: 'markdown';
24
+ readonly id: string;
25
+ content: string;
26
+ }
27
+ export interface ToolProgressPart {
28
+ readonly kind: 'tool-progress';
29
+ readonly id: string;
30
+ tool: ToolInvocation;
31
+ }
32
+ export interface ThinkingSectionPart {
33
+ readonly kind: 'thinking-section';
34
+ readonly id: string;
35
+ items: ThinkingSectionItem[];
36
+ title: string;
37
+ verb: string;
38
+ collapsed: boolean;
39
+ active: boolean;
40
+ }
41
+ export interface StatusPart {
42
+ readonly kind: 'status';
43
+ readonly id: string;
44
+ text: string;
45
+ }
46
+ export type ResponsePart = MarkdownPart | ToolProgressPart | ThinkingSectionPart | StatusPart;
47
+ export interface ResponsePartBuilderOptions {
48
+ /** Tool formatter registry. If not provided, uses builtins only. */
49
+ formatters?: ToolFormatterRegistry;
50
+ /** Treat these tool names as metadata (dim status lines). */
51
+ metadataTools?: Set<string>;
52
+ }
53
+ /**
54
+ * State machine that accumulates streaming agent events into typed
55
+ * ResponseParts using VS Code's pin-to-thinking model.
56
+ *
57
+ * Key rules (matching VS Code exactly):
58
+ * - Tool output is NEVER shown inside thinking blocks — only progress lines
59
+ * - Agent speech (onOutput) ALWAYS finalizes thinking and renders standalone
60
+ * - Reasoning (onReasoning) is always pinned to the thinking section
61
+ * - Tool streaming output goes to onToolOutput (invisible in UI)
62
+ */
63
+ export declare class ResponsePartBuilder {
64
+ private _parts;
65
+ private _pendingTools;
66
+ private _pendingArgs;
67
+ private _activeThinking;
68
+ private _formatters;
69
+ private _metadataTools;
70
+ constructor(opts?: ResponsePartBuilderOptions);
71
+ /** Current parts snapshot. */
72
+ get parts(): readonly ResponsePart[];
73
+ /** Number of tools currently pending (started but not completed). */
74
+ get pendingToolCount(): number;
75
+ /**
76
+ * Append agent speech / markdown content.
77
+ * ALWAYS finalizes any active thinking section and renders standalone.
78
+ * VS Code rule: output text is never absorbed into thinking blocks.
79
+ */
80
+ onOutput(content: string): void;
81
+ /**
82
+ * Called when a tool invocation starts.
83
+ * Routes to: silently ignored (metadata), thinking section (pinnable), or progress line (standalone).
84
+ */
85
+ onToolStart(toolName: string, toolCallId: string, args: Record<string, unknown>): void;
86
+ /**
87
+ * Start a tool with a pre-formatted invocation message from the backend.
88
+ * Bypasses formatter args parsing — useful when the backend provides
89
+ * a human-readable summary instead of raw JSON args.
90
+ */
91
+ onToolStartRaw(toolName: string, toolCallId: string, message: string): void;
92
+ /**
93
+ * Called when a tool invocation completes.
94
+ */
95
+ onToolComplete(toolCallId: string, result: string, isError?: boolean): void;
96
+ /**
97
+ * Append streaming output to a pending tool invocation.
98
+ * This output is NOT visible in thinking blocks — it's stored on the
99
+ * tool's output[] array for tools that want to display it elsewhere.
100
+ */
101
+ onToolOutput(toolCallId: string, line: string): void;
102
+ /**
103
+ * Append reasoning / thinking content.
104
+ * Always pins to the active thinking section (creating one if needed).
105
+ */
106
+ onReasoning(content: string): void;
107
+ /** Append a dim metadata / status line. Does not interrupt thinking flow. */
108
+ onStatus(text: string): void;
109
+ /** Finalize any open thinking section. Call when stream ends. */
110
+ flush(): void;
111
+ /** Clear all state. */
112
+ reset(): void;
113
+ /** Route a tool invocation to thinking section (pinnable) or progress line (standalone). */
114
+ private _routeInvocation;
115
+ /** Ensure a thinking section exists. Creates one if needed. */
116
+ private _ensureThinkingSection;
117
+ /** Finalize the active thinking section: generate title, collapse, deactivate. */
118
+ private _finalizeThinking;
119
+ }
120
+ //# sourceMappingURL=response-parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-parts.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/response-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAMzD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAIpE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,cAAc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,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAatF;;;;OAIG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA4B3E;;OAEG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,IAAI;IAoBzE;;;;OAIG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IASpD;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAiBlC,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM5B,iEAAiE;IACjE,KAAK,IAAI,IAAI;IAIb,uBAAuB;IACvB,KAAK,IAAI,IAAI;IASb,4FAA4F;IAC5F,OAAO,CAAC,gBAAgB;IAaxB,+DAA+D;IAC/D,OAAO,CAAC,sBAAsB;IAgB9B,kFAAkF;IAClF,OAAO,CAAC,iBAAiB;CA4D1B"}
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ /**
3
+ * Typed response part model + builder for structured agent output rendering.
4
+ *
5
+ * Implements VS Code Copilot Chat's "pin to thinking" model:
6
+ * - Pinnable tools (file, search, edit, shell) are absorbed into collapsible
7
+ * thinking sections — only the progress line (icon + message), never output.
8
+ * - Standalone tools (MCP, subagent, task) render as flat progress lines.
9
+ * - Markdown (agent speech) ALWAYS renders full-size, never absorbed into thinking.
10
+ * - Tool output goes to onToolOutput() and is invisible in thinking blocks.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ResponsePartBuilder = void 0;
14
+ const formatter_1 = require("./formatter");
15
+ const format_utils_1 = require("./format-utils");
16
+ // ── Metadata tools that render as status lines ───────────────────────────────
17
+ const METADATA_TOOLS = new Set([
18
+ 'report_intent', 'think', 'report_progress', 'skill', 'Skill',
19
+ 'EnterPlanMode', 'AskUserQuestion', 'ask_user',
20
+ ]);
21
+ // ── ResponsePartBuilder ──────────────────────────────────────────────────────
22
+ let nextId = 0;
23
+ function uid() { return `rp-${++nextId}`; }
24
+ /**
25
+ * State machine that accumulates streaming agent events into typed
26
+ * ResponseParts using VS Code's pin-to-thinking model.
27
+ *
28
+ * Key rules (matching VS Code exactly):
29
+ * - Tool output is NEVER shown inside thinking blocks — only progress lines
30
+ * - Agent speech (onOutput) ALWAYS finalizes thinking and renders standalone
31
+ * - Reasoning (onReasoning) is always pinned to the thinking section
32
+ * - Tool streaming output goes to onToolOutput (invisible in UI)
33
+ */
34
+ class ResponsePartBuilder {
35
+ _parts = [];
36
+ _pendingTools = new Map();
37
+ _pendingArgs = new Map();
38
+ _activeThinking = null;
39
+ _formatters;
40
+ _metadataTools;
41
+ constructor(opts) {
42
+ this._formatters = opts?.formatters ?? {};
43
+ this._metadataTools = opts?.metadataTools ?? METADATA_TOOLS;
44
+ }
45
+ /** Current parts snapshot. */
46
+ get parts() { return this._parts; }
47
+ /** Number of tools currently pending (started but not completed). */
48
+ get pendingToolCount() { return this._pendingTools.size; }
49
+ // ── Markdown output ──────────────────────────────────────────────────────
50
+ /**
51
+ * Append agent speech / markdown content.
52
+ * ALWAYS finalizes any active thinking section and renders standalone.
53
+ * VS Code rule: output text is never absorbed into thinking blocks.
54
+ */
55
+ onOutput(content) {
56
+ this._finalizeThinking();
57
+ const last = this._parts[this._parts.length - 1];
58
+ if (last?.kind === 'markdown') {
59
+ last.content += content;
60
+ return;
61
+ }
62
+ this._parts.push({ kind: 'markdown', id: uid(), content });
63
+ }
64
+ // ── Tool lifecycle ───────────────────────────────────────────────────────
65
+ /**
66
+ * Called when a tool invocation starts.
67
+ * Routes to: silently ignored (metadata), thinking section (pinnable), or progress line (standalone).
68
+ */
69
+ onToolStart(toolName, toolCallId, args) {
70
+ // Metadata tools → silently ignored (ephemeral progress, VS Code hides them)
71
+ if (this._metadataTools.has(toolName)) {
72
+ return;
73
+ }
74
+ const invocation = (0, formatter_1.createToolInvocation)(this._formatters, toolName, toolCallId, args);
75
+ this._pendingTools.set(toolCallId, invocation);
76
+ this._pendingArgs.set(toolCallId, args);
77
+ this._routeInvocation(invocation);
78
+ }
79
+ /**
80
+ * Start a tool with a pre-formatted invocation message from the backend.
81
+ * Bypasses formatter args parsing — useful when the backend provides
82
+ * a human-readable summary instead of raw JSON args.
83
+ */
84
+ onToolStartRaw(toolName, toolCallId, message) {
85
+ // Metadata tools → silently ignored (ephemeral progress, VS Code hides them)
86
+ if (this._metadataTools.has(toolName)) {
87
+ return;
88
+ }
89
+ const fmt = (0, formatter_1.resolveFormatter)(this._formatters, toolName);
90
+ const category = fmt.category;
91
+ const invocation = {
92
+ toolName,
93
+ toolCallId,
94
+ category,
95
+ friendlyName: fmt.friendlyName,
96
+ verb: (0, formatter_1.computeVerb)(category),
97
+ serverName: undefined,
98
+ isPinnable: (0, formatter_1.isPinnable)(toolName),
99
+ invocationMessage: (0, format_utils_1.shortenToolMessage)(message) || fmt.friendlyName,
100
+ isComplete: false,
101
+ isError: false,
102
+ output: [],
103
+ };
104
+ this._pendingTools.set(toolCallId, invocation);
105
+ this._pendingArgs.set(toolCallId, {});
106
+ this._routeInvocation(invocation);
107
+ }
108
+ /**
109
+ * Called when a tool invocation completes.
110
+ */
111
+ onToolComplete(toolCallId, result, isError = false) {
112
+ const invocation = this._pendingTools.get(toolCallId);
113
+ if (!invocation) {
114
+ return;
115
+ }
116
+ const args = this._pendingArgs.get(toolCallId) ?? {};
117
+ (0, formatter_1.completeToolInvocation)(this._formatters, invocation, result, args, isError);
118
+ this._pendingTools.delete(toolCallId);
119
+ this._pendingArgs.delete(toolCallId);
120
+ // If this was a pinned tool, check if all pinned tools in the section are done
121
+ if (this._activeThinking && invocation.isPinnable) {
122
+ const allPinnedDone = this._activeThinking.items.every(item => item.kind !== 'pinned-tool' || item.tool.isComplete);
123
+ if (allPinnedDone) {
124
+ this._finalizeThinking();
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Append streaming output to a pending tool invocation.
130
+ * This output is NOT visible in thinking blocks — it's stored on the
131
+ * tool's output[] array for tools that want to display it elsewhere.
132
+ */
133
+ onToolOutput(toolCallId, line) {
134
+ const invocation = this._pendingTools.get(toolCallId);
135
+ if (invocation) {
136
+ invocation.output.push(line);
137
+ }
138
+ }
139
+ // ── Reasoning / thinking ─────────────────────────────────────────────────
140
+ /**
141
+ * Append reasoning / thinking content.
142
+ * Always pins to the active thinking section (creating one if needed).
143
+ */
144
+ onReasoning(content) {
145
+ if (!content)
146
+ return;
147
+ this._ensureThinkingSection();
148
+ // Merge with last thinking-text item if possible
149
+ const items = this._activeThinking.items;
150
+ const last = items[items.length - 1];
151
+ if (last?.kind === 'thinking-text') {
152
+ last.content += '\n' + content;
153
+ }
154
+ else {
155
+ items.push({ kind: 'thinking-text', content });
156
+ }
157
+ }
158
+ // ── Status lines ─────────────────────────────────────────────────────────
159
+ /** Append a dim metadata / status line. Does not interrupt thinking flow. */
160
+ onStatus(text) {
161
+ this._parts.push({ kind: 'status', id: uid(), text });
162
+ }
163
+ // ── Reset ────────────────────────────────────────────────────────────────
164
+ /** Finalize any open thinking section. Call when stream ends. */
165
+ flush() {
166
+ this._finalizeThinking();
167
+ }
168
+ /** Clear all state. */
169
+ reset() {
170
+ this._parts = [];
171
+ this._pendingTools.clear();
172
+ this._pendingArgs.clear();
173
+ this._activeThinking = null;
174
+ }
175
+ // ── Internal ─────────────────────────────────────────────────────────────
176
+ /** Route a tool invocation to thinking section (pinnable) or progress line (standalone). */
177
+ _routeInvocation(invocation) {
178
+ if (invocation.isPinnable) {
179
+ // Pin to active thinking section (create one if needed)
180
+ this._ensureThinkingSection();
181
+ this._activeThinking.items.push({ kind: 'pinned-tool', tool: invocation });
182
+ }
183
+ else {
184
+ // Standalone tool → flat progress line (does NOT finalize thinking)
185
+ // VS Code: standalone tools render alongside thinking section, don't interrupt it.
186
+ // Thinking is only finalized by agent speech (onOutput) or stream end (flush).
187
+ this._parts.push({ kind: 'tool-progress', id: uid(), tool: invocation });
188
+ }
189
+ }
190
+ /** Ensure a thinking section exists. Creates one if needed. */
191
+ _ensureThinkingSection() {
192
+ if (this._activeThinking) {
193
+ return;
194
+ }
195
+ const section = {
196
+ kind: 'thinking-section',
197
+ id: uid(),
198
+ items: [],
199
+ title: 'Working',
200
+ verb: 'Working',
201
+ collapsed: false,
202
+ active: true,
203
+ };
204
+ this._activeThinking = section;
205
+ this._parts.push(section);
206
+ }
207
+ /** Finalize the active thinking section: generate title, collapse, deactivate. */
208
+ _finalizeThinking() {
209
+ if (!this._activeThinking) {
210
+ return;
211
+ }
212
+ const section = this._activeThinking;
213
+ section.active = false;
214
+ section.collapsed = true;
215
+ // Generate summary title from pinned tools
216
+ const pinnedTools = section.items.filter((item) => item.kind === 'pinned-tool');
217
+ if (pinnedTools.length > 0) {
218
+ if (pinnedTools.length <= 3) {
219
+ const summaries = pinnedTools.map(item => {
220
+ const t = item.tool;
221
+ return t.pastTenseMessage ?? t.invocationMessage;
222
+ }).filter(s => s.length > 0);
223
+ section.title = summaries.join(', ') || `${pinnedTools.length} tools`;
224
+ }
225
+ else {
226
+ // 4+ tools: "Read file.ts, Searched for pattern + 3 more"
227
+ const first2 = pinnedTools.slice(0, 2).map(item => {
228
+ const t = item.tool;
229
+ return t.pastTenseMessage ?? t.invocationMessage;
230
+ }).filter(s => s.length > 0);
231
+ section.title = first2.length > 0
232
+ ? `${first2.join(', ')} + ${pinnedTools.length - 2} more`
233
+ : `Finished with ${pinnedTools.length} steps`;
234
+ }
235
+ section.verb = pinnedTools[0].tool.verb;
236
+ }
237
+ else {
238
+ // Thinking-only section
239
+ const thinkingItems = section.items.filter(item => item.kind === 'thinking-text');
240
+ if (thinkingItems.length > 0) {
241
+ const firstLine = thinkingItems[0].content.split('\n')[0];
242
+ section.title = firstLine.length > 60 ? firstLine.slice(0, 57) + '...' : firstLine;
243
+ section.verb = 'Thought about';
244
+ }
245
+ }
246
+ // G5: Single-item restoration — if finalized section has 1 pinned tool and no text,
247
+ // restore it as a standalone tool-progress line (VS Code behavior).
248
+ const pinnedToolItems = section.items.filter((item) => item.kind === 'pinned-tool');
249
+ const thinkingTextItems = section.items.filter(item => item.kind === 'thinking-text');
250
+ if (pinnedToolItems.length === 1 && thinkingTextItems.length === 0) {
251
+ const idx = this._parts.indexOf(section);
252
+ if (idx >= 0) {
253
+ this._parts[idx] = {
254
+ kind: 'tool-progress',
255
+ id: section.id,
256
+ tool: pinnedToolItems[0].tool,
257
+ };
258
+ }
259
+ }
260
+ this._activeThinking = null;
261
+ }
262
+ }
263
+ exports.ResponsePartBuilder = ResponsePartBuilder;
264
+ //# sourceMappingURL=response-parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-parts.js","sourceRoot":"","sources":["../../../ui/tool-display/response-parts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAIH,2CAAsH;AACtH,iDAAoD;AAgDpD,gFAAgF;AAEhF,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO;IAC7D,eAAe,EAAE,iBAAiB,EAAE,UAAU;CAC/C,CAAC,CAAC;AAEH,gFAAgF;AAEhF,IAAI,MAAM,GAAG,CAAC,CAAC;AACf,SAAS,GAAG,KAAa,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AASnD;;;;;;;;;GASG;AACH,MAAa,mBAAmB;IACtB,MAAM,GAAmB,EAAE,CAAC;IAC5B,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;IAClD,YAAY,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC1D,eAAe,GAA+B,IAAI,CAAC;IACnD,WAAW,CAAwB;IACnC,cAAc,CAAc;IAEpC,YAAY,IAAiC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,C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pE,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAC1C,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAC9D,CAAC;QACF,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;QAEtF,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG;oBACjB,IAAI,EAAE,eAAe;oBACrB,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC9B,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AAtQD,kDAsQC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Tool invocation data contracts for structured agent output rendering.
3
+ *
4
+ * Adapted from VS Code Copilot Chat (MIT). All VS Code specifics removed:
5
+ * - MarkdownString → string
6
+ * - Uri → string
7
+ * - Classes → plain interfaces
8
+ */
9
+ export interface TerminalToolData {
10
+ commandLine: {
11
+ original: string;
12
+ };
13
+ language: string;
14
+ presentationOverrides?: {
15
+ commandLine: string;
16
+ };
17
+ output?: {
18
+ text: string;
19
+ };
20
+ state?: {
21
+ exitCode?: number;
22
+ duration?: number;
23
+ };
24
+ }
25
+ export interface SimpleToolData {
26
+ input: string;
27
+ output: string;
28
+ }
29
+ export interface SubagentToolData {
30
+ description?: string;
31
+ agentName?: string;
32
+ prompt?: string;
33
+ result?: string;
34
+ }
35
+ export type TodoStatus = 'not-started' | 'in-progress' | 'completed';
36
+ export interface TodoItem {
37
+ id: number;
38
+ title: string;
39
+ status: TodoStatus;
40
+ }
41
+ export interface TodoToolData {
42
+ title: string;
43
+ todoList: TodoItem[];
44
+ }
45
+ export type ToolSpecificData = TerminalToolData | SimpleToolData | SubagentToolData | TodoToolData;
46
+ export type ToolCategory = 'shell' | 'file' | 'search' | 'edit' | 'subagent' | 'task' | 'mcp' | 'default';
47
+ export interface ToolInvocation {
48
+ toolName: string;
49
+ toolCallId: string;
50
+ category: ToolCategory;
51
+ /** Human-readable display name: "Shell", "Read", "Kusto Query" */
52
+ friendlyName: string;
53
+ /** Past-tense verb for completed state: "Ran", "Read", "Searched" */
54
+ verb: string;
55
+ /** MCP server name when tool is server-prefixed, e.g. "icm-mcp" */
56
+ serverName?: string;
57
+ /** Whether this tool should be absorbed into a thinking section. */
58
+ isPinnable: boolean;
59
+ /** Human-readable action: "Read src/app/page.tsx", "Searched for `pattern`" */
60
+ invocationMessage: string;
61
+ pastTenseMessage?: string;
62
+ isComplete: boolean;
63
+ isError: boolean;
64
+ toolSpecificData?: ToolSpecificData;
65
+ /** Partial result lines accumulated during streaming. */
66
+ output: string[];
67
+ }
68
+ export declare function isTerminalData(data: ToolSpecificData): data is TerminalToolData;
69
+ export declare function isSimpleData(data: ToolSpecificData): data is SimpleToolData;
70
+ export declare function isSubagentData(data: ToolSpecificData): data is SubagentToolData;
71
+ export declare function isTodoData(data: ToolSpecificData): data is TodoToolData;
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE;QAAE,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oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,yDAAyD;IACzD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,gBAAgB,CAE/E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,cAAc,CAE3E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,gBAAgB,CAE/E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,YAAY,CAEvE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Tool invocation data contracts for structured agent output rendering.
4
+ *
5
+ * Adapted from VS Code Copilot Chat (MIT). All VS Code specifics removed:
6
+ * - MarkdownString → string
7
+ * - Uri → string
8
+ * - Classes → plain interfaces
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.isTerminalData = isTerminalData;
12
+ exports.isSimpleData = isSimpleData;
13
+ exports.isSubagentData = isSubagentData;
14
+ exports.isTodoData = isTodoData;
15
+ // ── Type guards ──────────────────────────────────────────────────────────────
16
+ function isTerminalData(data) {
17
+ return 'commandLine' in data && 'language' in data;
18
+ }
19
+ function isSimpleData(data) {
20
+ return 'input' in data && 'output' in data && !('commandLine' in data);
21
+ }
22
+ function isSubagentData(data) {
23
+ return ('agentName' in data || 'prompt' in data) && !('todoList' in data);
24
+ }
25
+ function isTodoData(data) {
26
+ return 'todoList' in data;
27
+ }
28
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ui/tool-display/types.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAyFH,wCAEC;AAED,oCAEC;AAED,wCAEC;AAED,gCAEC;AAhBD,gFAAgF;AAEhF,SAAgB,cAAc,CAAC,IAAsB;IACnD,OAAO,aAAa,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;AACrD,CAAC;AAED,SAAgB,YAAY,CAAC,IAAsB;IACjD,OAAO,OAAO,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,cAAc,CAAC,IAAsB;IACnD,OAAO,CAAC,WAAW,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAgB,UAAU,CAAC,IAAsB;IAC/C,OAAO,UAAU,IAAI,IAAI,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Pure view logic for agent debug events.
3
+ * Zero framework imports — works in any JS environment.
4
+ *
5
+ * Adapted from VS Code Copilot Chat agentDebugViewLogic.ts (MIT).
6
+ */
7
+ import type { AgentDebugEventCategory, IAgentDebugEvent, IAgentDebugEventFilter, ISessionSummary } from './debug-types';
8
+ export interface IEventTreeNode {
9
+ readonly event: IAgentDebugEvent;
10
+ readonly children: IEventTreeNode[];
11
+ }
12
+ /**
13
+ * Build a parent-child tree from a flat chronological event list.
14
+ * Events with `parentEventId` become children of the matching parent;
15
+ * all others become top-level nodes.
16
+ */
17
+ export declare function buildEventTree(events: readonly IAgentDebugEvent[]): IEventTreeNode[];
18
+ export declare function groupEventsBySession(events: readonly IAgentDebugEvent[]): Map<string, IAgentDebugEvent[]>;
19
+ export declare function filterEvents(events: readonly IAgentDebugEvent[], filter: IAgentDebugEventFilter): IAgentDebugEvent[];
20
+ export declare function sortEventsChronologically(events: readonly IAgentDebugEvent[]): IAgentDebugEvent[];
21
+ export declare function getEventIcon(event: IAgentDebugEvent): string;
22
+ export declare function getEventStatusClass(event: IAgentDebugEvent): string;
23
+ export declare function formatEventDetail(event: IAgentDebugEvent): Record<string, string>;
24
+ export declare function computeSessionSummary(events: readonly IAgentDebugEvent[]): ISessionSummary;
25
+ export declare function formatCategoryLabel(category: AgentDebugEventCategory): string;
26
+ export declare function formatDuration(ms: number): string;
27
+ export declare function formatTimestamp(ts: number): string;
28
+ //# sourceMappingURL=view-logic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-logic.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/view-logic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EAItB,eAAe,EAEhB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,cAAc,EAAE,CAsBpF;AAID,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAWzG;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EAAE,MAAM,EAAE,sBAAsB,GAAG,gBAAgB,EAAE,CAiBpH;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAEjG;AAYD,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAE5D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAA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