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,137 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ToolProgressLine = ToolProgressLine;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const types_1 = require("./types");
8
+ const ThinkingSection_1 = require("./ThinkingSection");
9
+ const MONO = '"JetBrains Mono", "Cascadia Code", "Fira Code", "Consolas", monospace';
10
+ // ── Status icon ──────────────────────────────────────────────────────────────
11
+ function ProgressIcon({ tool }) {
12
+ if (!tool.isComplete) {
13
+ return ((0, jsx_runtime_1.jsx)("span", { style: { display: 'inline-flex', width: 12, height: 12, alignItems: 'center', justifyContent: 'center', flexShrink: 0 }, children: (0, jsx_runtime_1.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", style: { animation: 'spin 1s linear infinite' }, children: (0, jsx_runtime_1.jsx)("circle", { cx: "6", cy: "6", r: "4.5", fill: "none", stroke: "#60a5fa", strokeWidth: "1.5", strokeDasharray: "20 8" }) }) }));
14
+ }
15
+ if (tool.isError) {
16
+ return (0, jsx_runtime_1.jsx)("span", { style: { color: '#f87171', fontSize: 12, lineHeight: 1, flexShrink: 0 }, children: "\u2717" });
17
+ }
18
+ return (0, jsx_runtime_1.jsx)("span", { style: { color: '#4ade80', fontSize: 12, lineHeight: 1, flexShrink: 0 }, children: "\u2713" });
19
+ }
20
+ // ── Code badge ───────────────────────────────────────────────────────────────
21
+ function CodeBadge({ text }) {
22
+ return ((0, jsx_runtime_1.jsx)("code", { style: {
23
+ fontFamily: MONO,
24
+ fontSize: 11,
25
+ padding: '1px 4px',
26
+ borderRadius: 4,
27
+ background: '#2b2a27',
28
+ border: '1px solid #3d3a36',
29
+ color: '#b1ada1',
30
+ }, children: text }));
31
+ }
32
+ /**
33
+ * Flat progress line for standalone (non-pinned) tools.
34
+ * Pattern 1 from VS Code: icon + message, single line.
35
+ *
36
+ * MCP format: "✓ Ran `tool_name` – server (MCP Server)"
37
+ * Default: "✓ Read src/app/page.tsx"
38
+ */
39
+ function ToolProgressLine({ tool, className, style }) {
40
+ (0, ThinkingSection_1.ensureAnimations)();
41
+ const [expanded, setExpanded] = (0, react_1.useState)(false);
42
+ const [hovered, setHovered] = (0, react_1.useState)(false);
43
+ const hasDetails = tool.isComplete && !!tool.toolSpecificData;
44
+ // Running verb: when not complete, show active verb
45
+ const isMcp = tool.category === 'mcp' || !!tool.serverName;
46
+ let message;
47
+ if (!tool.isComplete) {
48
+ if (isMcp) {
49
+ message = `Calling \`${tool.toolName}\`...`;
50
+ }
51
+ else {
52
+ message = tool.invocationMessage;
53
+ }
54
+ }
55
+ else {
56
+ message = tool.pastTenseMessage ?? tool.invocationMessage;
57
+ }
58
+ // Resolve the tool result text for expanded view
59
+ function getResultText() {
60
+ if (!tool.toolSpecificData) {
61
+ return tool.output.join('\n');
62
+ }
63
+ if ((0, types_1.isSimpleData)(tool.toolSpecificData)) {
64
+ return tool.toolSpecificData.output;
65
+ }
66
+ if ((0, types_1.isTerminalData)(tool.toolSpecificData)) {
67
+ return tool.toolSpecificData.output?.text ?? '';
68
+ }
69
+ return tool.output.join('\n');
70
+ }
71
+ const chevronChar = expanded ? '\u25BE' : '\u25B8'; // ▾ / ▸
72
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className, style: {
73
+ fontFamily: MONO,
74
+ margin: '0 0 6px',
75
+ ...style,
76
+ }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: hasDetails ? () => setExpanded(e => !e) : undefined, style: {
77
+ display: 'flex',
78
+ alignItems: 'center',
79
+ gap: 4,
80
+ fontSize: 13,
81
+ paddingTop: 2,
82
+ paddingLeft: 8,
83
+ cursor: hasDetails ? 'pointer' : 'default',
84
+ }, children: [(0, jsx_runtime_1.jsx)(ProgressIcon, { tool: tool }), (0, jsx_runtime_1.jsx)("span", { style: { color: '#8a8578', fontSize: 12, flex: 1 }, children: isMcp && tool.isComplete ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [tool.verb, ' ', (0, jsx_runtime_1.jsx)(CodeBadge, { text: tool.toolName }), tool.serverName && ((0, jsx_runtime_1.jsxs)("span", { style: { opacity: 0.7 }, children: [" \u2013 ", tool.serverName, " (MCP Server)"] }))] })) : isMcp && !tool.isComplete ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Calling ", (0, jsx_runtime_1.jsx)(CodeBadge, { text: tool.toolName }), tool.serverName && ((0, jsx_runtime_1.jsxs)("span", { style: { opacity: 0.7 }, children: [" \u2013 ", tool.serverName, " (MCP Server)"] })), (0, jsx_runtime_1.jsx)("span", { style: { opacity: 0.7 }, children: "..." })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [tool.friendlyName, message && message !== tool.friendlyName && ((0, jsx_runtime_1.jsxs)("span", { style: { opacity: 0.7 }, children: [": ", message] }))] })) }), hasDetails && ((0, jsx_runtime_1.jsx)("span", { style: {
85
+ color: '#6b6660',
86
+ fontSize: 11,
87
+ opacity: hovered || expanded ? 1 : 0,
88
+ transition: 'opacity 150ms',
89
+ flexShrink: 0,
90
+ }, children: chevronChar }))] }), expanded && hasDetails && ((0, jsx_runtime_1.jsxs)("div", { style: {
91
+ border: '1px solid #3d3a36',
92
+ borderRadius: 8,
93
+ margin: '4px 0 4px 20px',
94
+ overflow: 'hidden',
95
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { padding: '8px 12px' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
96
+ color: '#6b6660',
97
+ fontSize: 11,
98
+ fontWeight: 500,
99
+ textTransform: 'uppercase',
100
+ letterSpacing: '0.08em',
101
+ marginBottom: 4,
102
+ }, children: "Input" }), (0, jsx_runtime_1.jsx)("pre", { style: {
103
+ fontFamily: MONO,
104
+ background: '#161411',
105
+ border: '1px solid #302e2b',
106
+ borderRadius: 6,
107
+ padding: '8px 12px',
108
+ fontSize: 11,
109
+ color: '#b1ada1',
110
+ maxHeight: 300,
111
+ overflowY: 'auto',
112
+ margin: 0,
113
+ whiteSpace: 'pre-wrap',
114
+ wordBreak: 'break-word',
115
+ }, children: tool.invocationMessage })] }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: '4px 12px 8px' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
116
+ color: '#6b6660',
117
+ fontSize: 11,
118
+ fontWeight: 500,
119
+ textTransform: 'uppercase',
120
+ letterSpacing: '0.08em',
121
+ marginBottom: 4,
122
+ }, children: "Output" }), (0, jsx_runtime_1.jsx)("pre", { style: {
123
+ fontFamily: MONO,
124
+ background: '#161411',
125
+ border: '1px solid #302e2b',
126
+ borderRadius: 6,
127
+ padding: '8px 12px',
128
+ fontSize: 11,
129
+ color: '#b1ada1',
130
+ maxHeight: 300,
131
+ overflowY: 'auto',
132
+ margin: 0,
133
+ whiteSpace: 'pre-wrap',
134
+ wordBreak: 'break-word',
135
+ }, children: getResultText() })] })] }))] }));
136
+ }
137
+ //# sourceMappingURL=ToolProgressLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolProgressLine.js","sourceRoot":"","sources":["../../../ui/tool-display/ToolProgressLine.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA4Db,4CA2KC;;AArOD,iCAAwC;AAExC,mCAAuD;AACvD,uDAAqD;AAErD,MAAM,IAAI,GAAG,uEAAuE,CAAC;AAErF,gFAAgF;AAEhF,SAAS,YAAY,CAAC,EAAE,IAAI,EAA4B;IACtD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QACrB,OAAO,CACL,iC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;oCACvB,YAAY,EAAE,CAAC;iCAChB,sBAEK,EACN,gCAAK,KAAK,EAAE;oCACV,UAAU,EAAE,IAAI;oCAChB,UAAU,EAAE,SAAS;oCACrB,MAAM,EAAE,mBAAmB;oCAC3B,YAAY,EAAE,CAAC;oCACf,OAAO,EAAE,UAAU;oCACnB,QAAQ,EAAE,EAAE;oCACZ,KAAK,EAAE,SAAS;oCAChB,SAAS,EAAE,GAAG;oCACd,SAAS,EAAE,MAAe;oCAC1B,MAAM,EAAE,CAAC;oCACT,UAAU,EAAE,UAAU;oCACtB,SAAS,EAAE,YAAY;iCACxB,YACE,IAAI,CAAC,iBAAiB,GACnB,IACF,EAGN,iCAAK,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,aACrC,gCAAK,KAAK,EAAE;oCACV,KAAK,EAAE,SAAS;oCAChB,QAAQ,EAAE,EAAE;oCACZ,UAAU,EAAE,GAAG;oCACf,aAAa,EAAE,WAAoB;oCACnC,aAAa,EAAE,QAAQ;oCACvB,YAAY,EAAE,CAAC;iCAChB,uBAEK,EACN,gCAAK,KAAK,EAAE;oCACV,UAAU,EAAE,IAAI;oCAChB,UAAU,EAAE,SAAS;oCACrB,MAAM,EAAE,mBAAmB;oCAC3B,YAAY,EAAE,CAAC;oCACf,OAAO,EAAE,UAAU;oCACnB,QAAQ,EAAE,EAAE;oCACZ,KAAK,EAAE,SAAS;oCAChB,SAAS,EAAE,GAAG;oCACd,SAAS,EAAE,MAAe;oCAC1B,MAAM,EAAE,CAAC;oCACT,UAAU,EAAE,UAAU;oCACtB,SAAS,EAAE,YAAY;iCACxB,YACE,aAAa,EAAE,GACZ,IACF,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Agent debug event types — fully serializable, zero framework dependencies.
3
+ *
4
+ * Adapted from VS Code Copilot Chat agentDebugTypes.ts (MIT).
5
+ * const enum → string union (enums don't survive cross-package boundaries).
6
+ */
7
+ export type AgentDebugEventCategory = 'discovery' | 'toolCall' | 'llmRequest' | 'error' | 'loopControl';
8
+ export interface IAgentDebugEvent {
9
+ readonly id: string;
10
+ readonly timestamp: number;
11
+ readonly category: AgentDebugEventCategory;
12
+ readonly sessionId: string;
13
+ readonly summary: string;
14
+ readonly details: Record<string, unknown>;
15
+ /** When set, this event is a child of the event with the given id. */
16
+ readonly parentEventId?: string;
17
+ }
18
+ export type DiscoveryResourceType = 'instruction' | 'skill' | 'agent' | 'prompt';
19
+ export type DiscoverySource = 'workspace' | 'user' | 'org' | 'extension';
20
+ export interface IDiscoveryEvent extends IAgentDebugEvent {
21
+ readonly category: 'discovery';
22
+ readonly resourceType: DiscoveryResourceType;
23
+ readonly source: DiscoverySource;
24
+ readonly resourcePath: string;
25
+ readonly matched: boolean;
26
+ readonly applyToPattern?: string;
27
+ readonly discoveryDurationMs?: number;
28
+ }
29
+ export type ToolCallStatus = 'pending' | 'success' | 'failure';
30
+ export interface IToolCallEvent extends IAgentDebugEvent {
31
+ readonly category: 'toolCall';
32
+ readonly toolName: string;
33
+ readonly argsSummary: string;
34
+ readonly status: ToolCallStatus;
35
+ readonly durationMs?: number;
36
+ readonly resultSummary?: string;
37
+ readonly errorMessage?: string;
38
+ readonly isSubAgent?: boolean;
39
+ readonly childCount?: number;
40
+ readonly subAgentName?: string;
41
+ readonly requestLogEntryId?: string;
42
+ }
43
+ export interface ILLMRequestEvent extends IAgentDebugEvent {
44
+ readonly category: 'llmRequest';
45
+ readonly requestName: string;
46
+ readonly durationMs: number;
47
+ readonly promptTokens: number;
48
+ readonly completionTokens: number;
49
+ readonly cachedTokens: number;
50
+ readonly totalTokens: number;
51
+ readonly status: 'success' | 'failure' | 'canceled';
52
+ readonly errorMessage?: string;
53
+ readonly model?: string;
54
+ readonly timeToFirstTokenMs?: number;
55
+ readonly maxInputTokens?: number;
56
+ readonly maxOutputTokens?: number;
57
+ readonly requestLogEntryId?: string;
58
+ }
59
+ export type ErrorType = 'toolFailure' | 'rateLimit' | 'contextOverflow' | 'timeout' | 'networkError' | 'redundancy';
60
+ export interface IErrorEvent extends IAgentDebugEvent {
61
+ readonly category: 'error';
62
+ readonly errorType: ErrorType;
63
+ readonly originalError?: string;
64
+ readonly toolName?: string;
65
+ }
66
+ export type LoopAction = 'start' | 'iteration' | 'yield' | 'stop';
67
+ export interface ILoopControlEvent extends IAgentDebugEvent {
68
+ readonly category: 'loopControl';
69
+ readonly loopAction: LoopAction;
70
+ readonly iterationIndex?: number;
71
+ readonly reason?: string;
72
+ }
73
+ export type AgentDebugEvent = IDiscoveryEvent | IToolCallEvent | ILLMRequestEvent | IErrorEvent | ILoopControlEvent;
74
+ export interface IAgentDebugEventFilter {
75
+ readonly categories?: readonly AgentDebugEventCategory[];
76
+ readonly sessionId?: string;
77
+ readonly timeRange?: {
78
+ readonly start: number;
79
+ readonly end: number;
80
+ };
81
+ readonly statusFilter?: string;
82
+ }
83
+ export interface ISessionSummary {
84
+ readonly toolCount: number;
85
+ readonly totalTokens: number;
86
+ readonly durationMs: number;
87
+ readonly errorCount: number;
88
+ readonly cachedTokenRatio: number;
89
+ }
90
+ //# sourceMappingURL=debug-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-types.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/debug-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,uBAAuB,GAC/B,WAAW,GACX,UAAU,GACV,YAAY,GACZ,OAAO,GACP,aAAa,CAAC;AAIlB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EA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AQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,MAAM,MAAM,eAAe,GACvB,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,iBAAiB,CAAC;AAItB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAID,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Agent debug event types — fully serializable, zero framework dependencies.
4
+ *
5
+ * Adapted from VS Code Copilot Chat agentDebugTypes.ts (MIT).
6
+ * const enum → string union (enums don't survive cross-package boundaries).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=debug-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-types.js","sourceRoot":"","sources":["../../../ui/tool-display/debug-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Pure utility functions for tool output processing.
3
+ *
4
+ * Adapted from VS Code Copilot Chat (MIT). Zero framework dependencies.
5
+ */
6
+ import type { TodoItem } from './types';
7
+ /**
8
+ * Extract text from tool result content blocks.
9
+ * Handles: string, array of `{ type: 'text', text }` blocks, or undefined.
10
+ */
11
+ export declare function extractToolResultContent(content: string | ReadonlyArray<{
12
+ type: string;
13
+ text?: string;
14
+ }> | undefined): string;
15
+ /**
16
+ * Remove injected XML blocks from model output:
17
+ * `<reminder>`, `<attachments>`, `<context>`, `<system-reminder>`,
18
+ * `<current_datetime>`, `<pr_metadata …/>`, `<user_query …/>`.
19
+ */
20
+ export declare function stripReminders(text: string): string;
21
+ export interface CdPrefix {
22
+ directory: string;
23
+ command: string;
24
+ }
25
+ /**
26
+ * Split `cd <dir> && <command>` into directory + remaining command.
27
+ * Supports both bash (`cd dir && cmd`) and powershell (`Set-Location -Path dir; cmd`).
28
+ */
29
+ export declare function extractCdPrefix(commandLine: string, isPowershell?: boolean): CdPrefix | undefined;
30
+ /**
31
+ * Extract exit code from tool result text.
32
+ * Recognises patterns like `exit code: 1`, `exited with exit code 0`,
33
+ * and `<exited with exit code 127>`.
34
+ */
35
+ export declare function parseExitCode(output: string): number | undefined;
36
+ /**
37
+ * Remove the exit code trailer from tool output for cleaner display.
38
+ */
39
+ export declare function stripExitCodeTrailer(output: string): string;
40
+ export interface ParsedTodo {
41
+ title: string;
42
+ todoList: TodoItem[];
43
+ }
44
+ /**
45
+ * Parse a markdown checklist into a structured todo list.
46
+ *
47
+ * Supports:
48
+ * - `- [x]` / `- [X]` → completed
49
+ * - `- [>]` / `- [~]` → in-progress
50
+ * - `- [ ]` → not-started
51
+ * - Ordered lists (`1. [x]`)
52
+ * - Code-fence-aware (ignores items inside fences)
53
+ * - Multi-line items (continuation lines indented with 2+ spaces or tab)
54
+ */
55
+ export declare function parseTodoMarkdown(markdown: string): ParsedTodo;
56
+ /**
57
+ * Shorten an absolute file path to the last 2 segments for display.
58
+ * `Q:\Software\investigation\taco-helper\.flow-data\icm\projection.json`
59
+ * → `icm/projection.json`
60
+ */
61
+ export declare function shortenPath(p: string): string;
62
+ /**
63
+ * Shorten a tool invocation message that may contain comma-separated paths.
64
+ * Each path-like segment is shortened via `shortenPath`.
65
+ * Non-path segments pass through unchanged.
66
+ */
67
+ export declare function shortenToolMessage(msg: string): string;
68
+ //# sourceMappingURL=format-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-utils.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/format-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,SAAS,CAAC;AAIpD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,GAC3E,MAAM,CAOR;AAID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWnD;AAID,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,QAAQ,GAAG,SAAS,CAkB/F;AAID;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK3D;AAID,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAuD9D;AAID;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUtD"}
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ /**
3
+ * Pure utility functions for tool output processing.
4
+ *
5
+ * Adapted from VS Code Copilot Chat (MIT). Zero framework dependencies.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.extractToolResultContent = extractToolResultContent;
9
+ exports.stripReminders = stripReminders;
10
+ exports.extractCdPrefix = extractCdPrefix;
11
+ exports.parseExitCode = parseExitCode;
12
+ exports.stripExitCodeTrailer = stripExitCodeTrailer;
13
+ exports.parseTodoMarkdown = parseTodoMarkdown;
14
+ exports.shortenPath = shortenPath;
15
+ exports.shortenToolMessage = shortenToolMessage;
16
+ // ── Tool result extraction ───────────────────────────────────────────────────
17
+ /**
18
+ * Extract text from tool result content blocks.
19
+ * Handles: string, array of `{ type: 'text', text }` blocks, or undefined.
20
+ */
21
+ function extractToolResultContent(content) {
22
+ if (!content) {
23
+ return '';
24
+ }
25
+ if (typeof content === 'string') {
26
+ return content;
27
+ }
28
+ return content
29
+ .filter((block) => block.type === 'text' && typeof block.text === 'string')
30
+ .map(block => block.text)
31
+ .join('\n');
32
+ }
33
+ // ── Reminder / XML tag stripping ─────────────────────────────────────────────
34
+ /**
35
+ * Remove injected XML blocks from model output:
36
+ * `<reminder>`, `<attachments>`, `<context>`, `<system-reminder>`,
37
+ * `<current_datetime>`, `<pr_metadata …/>`, `<user_query …/>`.
38
+ */
39
+ function stripReminders(text) {
40
+ return text
41
+ .replace(/<reminder>[\s\S]*?<\/reminder>\s*/g, '')
42
+ .replace(/<attachments>[\s\S]*?<\/attachments>\s*/g, '')
43
+ .replace(/<userRequest>[\s\S]*?<\/userRequest>\s*/g, '')
44
+ .replace(/<context>[\s\S]*?<\/context>\s*/g, '')
45
+ .replace(/<system-reminder>[\s\S]*?<\/system-reminder>\s*/g, '')
46
+ .replace(/<current_datetime>[\s\S]*?<\/current_datetime>\s*/g, '')
47
+ .replace(/<pr_metadata[^>]*\/?>\s*/g, '')
48
+ .replace(/<user_query[^>]*\/?>\s*/g, '')
49
+ .trim();
50
+ }
51
+ /**
52
+ * Split `cd <dir> && <command>` into directory + remaining command.
53
+ * Supports both bash (`cd dir && cmd`) and powershell (`Set-Location -Path dir; cmd`).
54
+ */
55
+ function extractCdPrefix(commandLine, isPowershell = false) {
56
+ const cdPrefixMatch = commandLine.match(isPowershell
57
+ ? /^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>"[^"]*"|[^\s]+) ?(?:&&|;)\s+(?<suffix>.+)$/i
58
+ : /^cd (?<dir>"[^"]*"|[^\s]+) &&\s+(?<suffix>.+)$/);
59
+ const cdDir = cdPrefixMatch?.groups?.dir;
60
+ const cdSuffix = cdPrefixMatch?.groups?.suffix;
61
+ if (cdDir && cdSuffix) {
62
+ let directory = cdDir;
63
+ if (directory.startsWith('"') && directory.endsWith('"')) {
64
+ directory = directory.slice(1, -1);
65
+ }
66
+ return { directory, command: cdSuffix };
67
+ }
68
+ return undefined;
69
+ }
70
+ // ── Exit code parsing ────────────────────────────────────────────────────────
71
+ /**
72
+ * Extract exit code from tool result text.
73
+ * Recognises patterns like `exit code: 1`, `exited with exit code 0`,
74
+ * and `<exited with exit code 127>`.
75
+ */
76
+ function parseExitCode(output) {
77
+ const match = /(?:exit code|exited with(?:\s+exit\s+code)?)[:=\s]*(\d+)/i.exec(output);
78
+ return match ? parseInt(match[1], 10) : undefined;
79
+ }
80
+ /**
81
+ * Remove the exit code trailer from tool output for cleaner display.
82
+ */
83
+ function stripExitCodeTrailer(output) {
84
+ return output
85
+ .replace(/<exited with exit code \d+>\s*$/, '')
86
+ .replace(/(?:exit code|exited with)[:=\s]*\d+\s*$/i, '')
87
+ .trimEnd();
88
+ }
89
+ /**
90
+ * Parse a markdown checklist into a structured todo list.
91
+ *
92
+ * Supports:
93
+ * - `- [x]` / `- [X]` → completed
94
+ * - `- [>]` / `- [~]` → in-progress
95
+ * - `- [ ]` → not-started
96
+ * - Ordered lists (`1. [x]`)
97
+ * - Code-fence-aware (ignores items inside fences)
98
+ * - Multi-line items (continuation lines indented with 2+ spaces or tab)
99
+ */
100
+ function parseTodoMarkdown(markdown) {
101
+ const lines = markdown.split('\n');
102
+ const todoList = [];
103
+ let title = 'Updated todo list';
104
+ let inCodeBlock = false;
105
+ let currentItem = null;
106
+ for (const line of lines) {
107
+ if (line.trim().startsWith('```') || line.trim().startsWith('~~~')) {
108
+ inCodeBlock = !inCodeBlock;
109
+ continue;
110
+ }
111
+ if (inCodeBlock) {
112
+ continue;
113
+ }
114
+ // Extract title from first non-empty, non-checklist line
115
+ if (title === 'Updated todo list' && line.trim()) {
116
+ const trimmed = line.trim();
117
+ if (!trimmed.match(/^[-*+]\s+\[.\]/) && !trimmed.match(/^\d+[.)]\s+\[.\]/)) {
118
+ title = trimmed.replace(/^#+\s*/, '');
119
+ }
120
+ }
121
+ // Parse checklist items
122
+ const unorderedMatch = line.match(/^\s*[-*+]\s+\[(.?)\]\s*(.*)$/);
123
+ const orderedMatch = line.match(/^\s*\d+[.)]\s+\[(.?)\]\s*(.*)$/);
124
+ const match = unorderedMatch || orderedMatch;
125
+ if (match) {
126
+ if (currentItem && currentItem.title.trim()) {
127
+ todoList.push({ id: todoList.length + 1, title: currentItem.title.trim(), status: currentItem.status });
128
+ }
129
+ const checkboxChar = match[1];
130
+ const itemTitle = match[2];
131
+ let status;
132
+ if (checkboxChar === 'x' || checkboxChar === 'X') {
133
+ status = 'completed';
134
+ }
135
+ else if (checkboxChar === '>' || checkboxChar === '~') {
136
+ status = 'in-progress';
137
+ }
138
+ else {
139
+ status = 'not-started';
140
+ }
141
+ currentItem = { title: itemTitle, status };
142
+ }
143
+ else if (currentItem && line.trim() && (line.startsWith(' ') || line.startsWith('\t'))) {
144
+ currentItem.title += ' ' + line.trim();
145
+ }
146
+ }
147
+ if (currentItem && currentItem.title.trim()) {
148
+ todoList.push({ id: todoList.length + 1, title: currentItem.title.trim(), status: currentItem.status });
149
+ }
150
+ return { title, todoList };
151
+ }
152
+ // ── Path shortening ──────────────────────────────────────────────────────────
153
+ /**
154
+ * Shorten an absolute file path to the last 2 segments for display.
155
+ * `Q:\Software\investigation\taco-helper\.flow-data\icm\projection.json`
156
+ * → `icm/projection.json`
157
+ */
158
+ function shortenPath(p) {
159
+ const normalized = p.replace(/\\/g, '/');
160
+ const segments = normalized.split('/').filter(Boolean);
161
+ if (segments.length <= 2)
162
+ return p;
163
+ return segments.slice(-2).join('/');
164
+ }
165
+ /**
166
+ * Shorten a tool invocation message that may contain comma-separated paths.
167
+ * Each path-like segment is shortened via `shortenPath`.
168
+ * Non-path segments pass through unchanged.
169
+ */
170
+ function shortenToolMessage(msg) {
171
+ if (!msg)
172
+ return msg;
173
+ return msg.split(/,\s*/).map(part => {
174
+ const trimmed = part.trim();
175
+ // Detect absolute paths: Windows drive letter or Unix root
176
+ if (/^[A-Z]:[\\\/]/i.test(trimmed) || /^\/[a-z]/i.test(trimmed)) {
177
+ return shortenPath(trimmed);
178
+ }
179
+ return trimmed;
180
+ }).join(', ');
181
+ }
182
+ //# sourceMappingURL=format-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../../ui/tool-display/format-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAUH,4DASC;AASD,wCAWC;AAaD,0CAkBC;AASD,sCAGC;AAKD,oDAKC;AAoBD,8CAuDC;AASD,kCAKC;AAOD,gDAUC;AAlMD,gFAAgF;AAEhF;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,OAA4E;IAE5E,IAAI,CAAC,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;IAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC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C;IACrB,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,2DAA2D;QAC3D,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAChE,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Extensible tool formatting registry.
3
+ *
4
+ * Provides default formatters for common tool types (shell, file, search,
5
+ * subagent, task, etc.) and allows consumers to register custom formatters
6
+ * for domain-specific tools (Kusto, ICM, ADO, …).
7
+ *
8
+ * Adapted from VS Code Copilot Chat toolInvocationFormatter.ts +
9
+ * copilotCLITools.ts (MIT). All VS Code specifics removed.
10
+ */
11
+ import type { ToolCategory, ToolInvocation, ToolSpecificData } from './types';
12
+ export interface ToolFormatter {
13
+ friendlyName: string;
14
+ category: ToolCategory;
15
+ /** Human-readable message when tool starts. Receives raw tool args. */
16
+ formatStart: (toolName: string, args: Record<string, unknown>) => string;
17
+ /** Build tool-specific data when tool completes. Return undefined to skip. */
18
+ formatComplete: (toolName: string, result: string, args: Record<string, unknown>) => ToolSpecificData | undefined;
19
+ }
20
+ export type ToolFormatterRegistry = Record<string, ToolFormatter>;
21
+ /**
22
+ * Returns true if a tool should be absorbed into the active thinking section
23
+ * (pinned), matching VS Code's `shouldPinPart()` logic.
24
+ *
25
+ * Pinnable: file, search, edit, shell tools.
26
+ * NOT pinnable: MCP tools, subagent/task tools, ask_user, Skill, meta tools.
27
+ */
28
+ export declare function isPinnable(toolName: string): boolean;
29
+ export declare function computeVerb(category: ToolCategory): string;
30
+ /**
31
+ * Create a tool formatter registry by merging builtins with optional custom formatters.
32
+ * Custom formatters override builtins for the same tool name.
33
+ */
34
+ export declare function createToolFormatterRegistry(customFormatters?: ToolFormatterRegistry): ToolFormatterRegistry;
35
+ /**
36
+ * Resolve a formatter for a given tool name.
37
+ * Falls back to default formatter if no specific one is registered.
38
+ *
39
+ * Also handles MCP server tool names (e.g. `kusto-mcp-server-executeQuery`)
40
+ * by checking for both the full name and the base name after stripping the
41
+ * server prefix.
42
+ */
43
+ export declare function resolveFormatter(registry: ToolFormatterRegistry, toolName: string): ToolFormatter;
44
+ /**
45
+ * Classify a tool name into a category using the formatter registry.
46
+ * Falls back to arg-based heuristic classification when no formatter is found.
47
+ */
48
+ export declare function classifyTool(registry: ToolFormatterRegistry, toolName: string, args?: Record<string, unknown>): ToolCategory;
49
+ /**
50
+ * Create a ToolInvocation for a tool start event.
51
+ */
52
+ export declare function createToolInvocation(registry: ToolFormatterRegistry, toolName: string, toolCallId: string, args: Record<string, unknown>): ToolInvocation;
53
+ /**
54
+ * Complete a ToolInvocation with result data.
55
+ * Mutates the invocation in-place for streaming compatibility.
56
+ */
57
+ export declare function completeToolInvocation(registry: ToolFormatterRegistry, invocation: ToolInvocation, result: string, args: Record<string, unknown>, isError?: boolean): void;
58
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../ui/tool-display/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAoE,MAAM,SAAS,CAAC;AAKhJ,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,uEAAuE;IACvE,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;IACzE,8EAA8E;I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