gsd-pi 2.80.0-dev.710c06e97 → 2.80.0-dev.8b3a59f5c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/gsd/auto-recovery.js +131 -9
- package/dist/resources/extensions/gsd/commands-extract-learnings.js +17 -12
- package/dist/resources/extensions/gsd/db-base-schema.js +14 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +16 -0
- package/dist/resources/extensions/gsd/gsd-db.js +102 -2
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +27 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +51 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +57 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +51 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +45 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +55 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +72 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +131 -7
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +17 -12
- package/src/resources/extensions/gsd/db-base-schema.ts +15 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +17 -0
- package/src/resources/extensions/gsd/gsd-db.ts +119 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +125 -1
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -0
- /package/dist/web/standalone/.next/static/{CaMwumvGbBPZrJicfsCzV → k-MDjzPMF62Rg1-FR437h}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{CaMwumvGbBPZrJicfsCzV → k-MDjzPMF62Rg1-FR437h}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.test.js","sourceRoot":"","sources":["../../../../../src/modes/interactive/components/__tests__/tool-execution.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzB,SAAS,UAAU,CAClB,QAAgB,EAChB,IAA6B,EAC7B,MAIC,EACD,cAAiH;IAE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,CAAC,KAAK,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC3C,+CAA+C;QAC/C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, test } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport stripAnsi from \"strip-ansi\";\nimport { ToolExecutionComponent } from \"../tool-execution.js\";\nimport { initTheme } from \"../../theme/theme.js\";\n\ninitTheme(\"dark\", false);\n\nfunction renderTool(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tcomponent.setExpanded(true);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\nfunction renderToolCollapsed(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\ndescribe(\"ToolExecutionComponent\", () => {\n\ttest(\"renders framed header with Running status while tool is partial\", () => {\n\t\tconst rendered = renderToolCollapsed(\"mcp__demo__do_thing\", { ok: true });\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Running/);\n\t\tassert.match(rendered, /Running · \\d+(ms|s)/);\n\t});\n\n\ttest(\"renders framed header with Error status for failed tool result\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: \"boom\" }], isError: true },\n\t\t);\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /Error · \\d+(ms|s)/);\n\t\tassert.match(rendered, /boom/);\n\t});\n\n\ttest(\"collapses successful low-signal tool cards by default\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__noop\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /Done · \\d+(ms|s)/);\n\t\tassert.match(rendered, /Completed/);\n\t\tassert.doesNotMatch(rendered, /ok=true/);\n\t});\n\n\ttest(\"passes failed result status to custom result renderers\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"gsd_requirement_save\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{ content: [{ type: \"text\", text: \"saved\" }], isError: true },\n\t\t\t{\n\t\t\t\tlabel: \"Save Requirement\",\n\t\t\t\trenderResult(result: { isError?: boolean }) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trender: () => [result.isError ? \"custom saw error\" : \"custom saw success\"],\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /custom saw error/);\n\t\tassert.doesNotMatch(rendered, /custom saw success/);\n\t});\n\n\ttest(\"renders capitalized Claude Code Bash tool names with bash output instead of generic args JSON\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Bash\",\n\t\t\t{ command: \"pwd\" },\n\t\t\t{ content: [{ type: \"text\", text: \"/tmp/gsd-pr-fix\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /\\$ pwd/);\n\t\tassert.match(rendered, /\\/tmp\\/gsd-pr-fix/);\n\t\tassert.doesNotMatch(rendered, /^\\{\\s*\\}$/m);\n\t});\n\n\ttest(\"renders capitalized Claude Code Read tool names with read output\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Read\",\n\t\t\t{ path: \"/tmp/demo.txt\" },\n\t\t\t{ content: [{ type: \"text\", text: \"hello\\nworld\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /read .*demo\\.txt/);\n\t\tassert.match(rendered, /hello/);\n\t\tassert.match(rendered, /world/);\n\t});\n\n\ttest(\"generic fallback strips mcp__<server>__ prefix and shows server·tool title\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__context7__resolve_library_id\",\n\t\t\t{ name: \"react\" },\n\t\t\t{ content: [{ type: \"text\", text: \"react@18.3.1\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /context7\\u00b7resolve_library_id/);\n\t\tassert.doesNotMatch(rendered, /mcp__/);\n\t\tassert.match(rendered, /name=\"react\"/);\n\t\tassert.match(rendered, /react@18\\.3\\.1/);\n\t});\n\n\ttest(\"generic fallback renders compact key=value args for primitive args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"some_unknown_tool\",\n\t\t\t{ count: 3, enabled: true, label: \"hello\" },\n\t\t);\n\n\t\tassert.match(rendered, /Some Unknown Tool/);\n\t\tassert.match(rendered, /count=3/);\n\t\tassert.match(rendered, /enabled=true/);\n\t\tassert.match(rendered, /label=\"hello\"/);\n\t\tassert.doesNotMatch(rendered, /^\\{$/m);\n\t});\n\n\ttest(\"frame header prefers toolDefinition.label over raw tool name\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"gsd_slice_complete\",\n\t\t\t{ sliceId: \"S03\" },\n\t\t\tundefined,\n\t\t\t{ label: \"Complete Slice\" },\n\t\t);\n\n\t\tassert.match(rendered, /Tool Complete Slice/);\n\t\tassert.doesNotMatch(rendered, /gsd_slice_complete/);\n\t});\n\n\ttest(\"frame header strips gsd_ prefix and title-cases when no label is registered\", () => {\n\t\tconst rendered = renderToolCollapsed(\"gsd_requirement_update\", { id: \"R005\" });\n\n\t\tassert.match(rendered, /Tool Requirement Update/);\n\t\tassert.doesNotMatch(rendered, /gsd_requirement_update/);\n\t});\n\n\ttest(\"formatCompactArgs truncates long string values inline instead of dumping JSON\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderToolCollapsed(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tmilestoneId: \"M001\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, /sliceId=\"S03\"/);\n\t\tassert.match(rendered, /milestoneId=\"M001\"/);\n\t\tassert.match(rendered, /worktree=\".*…\"/);\n\t\tassert.doesNotMatch(rendered, /\"sliceId\":\\s*\"S03\"/);\n\t});\n\n\ttest(\"formatCompactArgs shows full string values when expanded\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderTool(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, new RegExp(longPath.replace(/\\//g, \"\\\\/\")));\n\t\tassert.doesNotMatch(rendered, /…/);\n\t});\n\n\ttest(\"generic fallback truncates long output when collapsed\", () => {\n\t\tconst longOutput = Array.from({ length: 25 }, (_, i) => `line ${i + 1}`).join(\"\\n\");\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: longOutput }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /line 1\\b/);\n\t\tassert.match(rendered, /line 10\\b/);\n\t\tassert.doesNotMatch(rendered, /line 20\\b/);\n\t\tassert.match(rendered, /\\(15 more lines/);\n\t});\n\n\ttest(\"generic fallback falls back to truncated JSON for complex args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__nested\",\n\t\t\t{ payload: { nested: { deeply: [\"a\", \"b\", \"c\"] } }, name: \"x\" },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7nested/);\n\t\t// Multi-line JSON dump for the complex payload\n\t\tassert.match(rendered, /\"payload\"/);\n\t\tassert.match(rendered, /\"nested\"/);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"tool-execution.test.js","sourceRoot":"","sources":["../../../../../src/modes/interactive/components/__tests__/tool-execution.test.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAA2B,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzB,SAAS,UAAU,CAClB,QAAgB,EAChB,IAA6B,EAC7B,MAIC,EACD,cAAiH;IAEjH,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAC3C,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,cAAqB,EACrB,EAAE,aAAa,KAAI,CAAC,EAAS,CAC7B,CAAC;IACF,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,MAAM;QAAE,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,SAAS,CAAC,SAAS,CAA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AAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gEAAgE,EAAE,GAAG,EAAE;QAC3E,MAAM,QAAQ,GAAG,UAAU,CAC1B,mBAAmB,EACnB,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAC/D,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC3C,+CAA+C;QAC/C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// GSD-2 Interactive Tool Execution Rendering Tests\nimport { describe, test } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport stripAnsi from \"strip-ansi\";\nimport { ToolExecutionComponent, ToolPhaseSummaryComponent, type ToolExecutionPhase } from \"../tool-execution.js\";\nimport { initTheme } from \"../../theme/theme.js\";\n\ninitTheme(\"dark\", false);\n\nfunction renderTool(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tcomponent.setExpanded(true);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\nfunction renderToolCollapsed(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\ndescribe(\"ToolExecutionComponent\", () => {\n\ttest(\"renders framed header with Running status while tool is partial\", () => {\n\t\tconst rendered = renderToolCollapsed(\"mcp__demo__do_thing\", { ok: true });\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Running/);\n\t\tassert.match(rendered, /Running · \\d+(ms|s)/);\n\t});\n\n\ttest(\"renders framed header with Error status for failed tool result\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: \"boom\" }], isError: true },\n\t\t);\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /Error · \\d+(ms|s)/);\n\t\tassert.match(rendered, /boom/);\n\t});\n\n\ttest(\"collapses successful low-signal tool cards by default\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__noop\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /Done · \\d+(ms|s)/);\n\t\tassert.match(rendered, /Completed/);\n\t\tassert.doesNotMatch(rendered, /ok=true/);\n\t});\n\n\ttest(\"exposes phase metadata for successful low-signal tool rows\", () => {\n\t\tconst component = new ToolExecutionComponent(\n\t\t\t\"gsd_requirement_update\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{},\n\t\t\t{ label: \"Update Requirement\" } as any,\n\t\t\t{ requestRender() {} } as any,\n\t\t);\n\t\tcomponent.updateResult({ content: [], isError: false });\n\n\t\tassert.deepEqual(component.getRollupPhase()?.label, \"Requirement writes\");\n\t});\n\n\ttest(\"does not expose phase metadata for output-bearing tools\", () => {\n\t\tconst component = new ToolExecutionComponent(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\t{ requestRender() {} } as any,\n\t\t);\n\t\tcomponent.updateResult({ content: [{ type: \"text\", text: \"important output\" }], isError: false });\n\n\t\tassert.equal(component.getRollupPhase(), null);\n\t});\n\n\ttest(\"renders phase-based summaries for rolled-up tool executions\", () => {\n\t\tconst phases: ToolExecutionPhase[] = [\n\t\t\t{ label: \"Setup / shell\", count: 6, durationMs: 12 },\n\t\t\t{ label: \"Context reads\", count: 4, durationMs: 6 },\n\t\t\t{ label: \"Requirement writes\", count: 4, durationMs: 4 },\n\t\t\t{ label: \"Memory lookups\", count: 4, durationMs: 4 },\n\t\t\t{ label: \"Finalization\", count: 1, durationMs: 1 },\n\t\t];\n\t\tconst rendered = stripAnsi(new ToolPhaseSummaryComponent(phases).render(120).join(\"\\n\"));\n\n\t\tassert.match(rendered, /Setup \\/ shell 6 actions\\s+success · 12ms/);\n\t\tassert.match(rendered, /Context reads 4 actions\\s+success · 6ms/);\n\t\tassert.match(rendered, /Requirement writes 4 actions\\s+success · 4ms/);\n\t\tassert.match(rendered, /Memory lookups 4 actions\\s+success · 4ms/);\n\t\tassert.match(rendered, /Finalization 1 action\\s+success · 1ms/);\n\t});\n\n\ttest(\"passes failed result status to custom result renderers\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"gsd_requirement_save\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{ content: [{ type: \"text\", text: \"saved\" }], isError: true },\n\t\t\t{\n\t\t\t\tlabel: \"Save Requirement\",\n\t\t\t\trenderResult(result: { isError?: boolean }) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trender: () => [result.isError ? \"custom saw error\" : \"custom saw success\"],\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /custom saw error/);\n\t\tassert.doesNotMatch(rendered, /custom saw success/);\n\t});\n\n\ttest(\"renders capitalized Claude Code Bash tool names with bash output instead of generic args JSON\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Bash\",\n\t\t\t{ command: \"pwd\" },\n\t\t\t{ content: [{ type: \"text\", text: \"/tmp/gsd-pr-fix\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /\\$ pwd/);\n\t\tassert.match(rendered, /\\/tmp\\/gsd-pr-fix/);\n\t\tassert.doesNotMatch(rendered, /^\\{\\s*\\}$/m);\n\t});\n\n\ttest(\"renders capitalized Claude Code Read tool names with read output\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Read\",\n\t\t\t{ path: \"/tmp/demo.txt\" },\n\t\t\t{ content: [{ type: \"text\", text: \"hello\\nworld\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /read .*demo\\.txt/);\n\t\tassert.match(rendered, /hello/);\n\t\tassert.match(rendered, /world/);\n\t});\n\n\ttest(\"generic fallback strips mcp__<server>__ prefix and shows server·tool title\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__context7__resolve_library_id\",\n\t\t\t{ name: \"react\" },\n\t\t\t{ content: [{ type: \"text\", text: \"react@18.3.1\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /context7\\u00b7resolve_library_id/);\n\t\tassert.doesNotMatch(rendered, /mcp__/);\n\t\tassert.match(rendered, /name=\"react\"/);\n\t\tassert.match(rendered, /react@18\\.3\\.1/);\n\t});\n\n\ttest(\"generic fallback renders compact key=value args for primitive args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"some_unknown_tool\",\n\t\t\t{ count: 3, enabled: true, label: \"hello\" },\n\t\t);\n\n\t\tassert.match(rendered, /Some Unknown Tool/);\n\t\tassert.match(rendered, /count=3/);\n\t\tassert.match(rendered, /enabled=true/);\n\t\tassert.match(rendered, /label=\"hello\"/);\n\t\tassert.doesNotMatch(rendered, /^\\{$/m);\n\t});\n\n\ttest(\"frame header prefers toolDefinition.label over raw tool name\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"gsd_slice_complete\",\n\t\t\t{ sliceId: \"S03\" },\n\t\t\tundefined,\n\t\t\t{ label: \"Complete Slice\" },\n\t\t);\n\n\t\tassert.match(rendered, /Tool Complete Slice/);\n\t\tassert.doesNotMatch(rendered, /gsd_slice_complete/);\n\t});\n\n\ttest(\"frame header strips gsd_ prefix and title-cases when no label is registered\", () => {\n\t\tconst rendered = renderToolCollapsed(\"gsd_requirement_update\", { id: \"R005\" });\n\n\t\tassert.match(rendered, /Tool Requirement Update/);\n\t\tassert.doesNotMatch(rendered, /gsd_requirement_update/);\n\t});\n\n\ttest(\"formatCompactArgs truncates long string values inline instead of dumping JSON\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderToolCollapsed(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tmilestoneId: \"M001\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, /sliceId=\"S03\"/);\n\t\tassert.match(rendered, /milestoneId=\"M001\"/);\n\t\tassert.match(rendered, /worktree=\".*…\"/);\n\t\tassert.doesNotMatch(rendered, /\"sliceId\":\\s*\"S03\"/);\n\t});\n\n\ttest(\"formatCompactArgs shows full string values when expanded\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderTool(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, new RegExp(longPath.replace(/\\//g, \"\\\\/\")));\n\t\tassert.doesNotMatch(rendered, /…/);\n\t});\n\n\ttest(\"generic fallback truncates long output when collapsed\", () => {\n\t\tconst longOutput = Array.from({ length: 25 }, (_, i) => `line ${i + 1}`).join(\"\\n\");\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: longOutput }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /line 1\\b/);\n\t\tassert.match(rendered, /line 10\\b/);\n\t\tassert.doesNotMatch(rendered, /line 20\\b/);\n\t\tassert.match(rendered, /\\(15 more lines/);\n\t});\n\n\ttest(\"generic fallback falls back to truncated JSON for complex args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__nested\",\n\t\t\t{ payload: { nested: { deeply: [\"a\", \"b\", \"c\"] } }, name: \"x\" },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7nested/);\n\t\t// Multi-line JSON dump for the complex payload\n\t\tassert.match(rendered, /\"payload\"/);\n\t\tassert.match(rendered, /\"nested\"/);\n\t});\n});\n"]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Container, type TUI } from "@gsd/pi-tui";
|
|
2
2
|
import type { ToolDefinition } from "../../../core/extensions/types.js";
|
|
3
|
+
export type ToolExecutionPhase = {
|
|
4
|
+
label: string;
|
|
5
|
+
count: number;
|
|
6
|
+
durationMs: number;
|
|
7
|
+
};
|
|
3
8
|
export interface ToolExecutionOptions {
|
|
4
9
|
showImages?: boolean;
|
|
5
10
|
}
|
|
@@ -84,6 +89,8 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
84
89
|
invalidate(): void;
|
|
85
90
|
render(width: number): string[];
|
|
86
91
|
private shouldRenderCompactSuccess;
|
|
92
|
+
getRollupPhase(): ToolExecutionPhase | null;
|
|
93
|
+
private getPhaseLabel;
|
|
87
94
|
private getCompactSummary;
|
|
88
95
|
private updateDisplay;
|
|
89
96
|
/**
|
|
@@ -93,4 +100,9 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
93
100
|
private getTextOutput;
|
|
94
101
|
private formatToolExecution;
|
|
95
102
|
}
|
|
103
|
+
export declare class ToolPhaseSummaryComponent extends Container {
|
|
104
|
+
private readonly phases;
|
|
105
|
+
constructor(phases: ToolExecutionPhase[]);
|
|
106
|
+
render(width: number): string[];
|
|
107
|
+
}
|
|
96
108
|
//# sourceMappingURL=tool-execution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,SAAS,EAQT,KAAK,GAAG,EAGR,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAsHxE,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AA+CF,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAUD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAA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AAO,EAAE,OAAO,CAAC;KACjB,EACD,SAAS,UAAQ,GACf,IAAI;IAkBP;;;;;;OAMG;IACH,sBAAsB,IAAI,IAAI;IAW9B;;OAEG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAqBzC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA2BlC,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAKpC,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAKzB,UAAU,IAAI,IAAI;IAKlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA+BxC,OAAO,CAAC,0BAA0B;IAMlC,cAAc,IAAI,kBAAkB,GAAG,IAAI;IAW3C,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,aAAa;IAoKrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA+EzB,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,mBAAmB;CAsX3B;AAED,qBAAa,yBAA0B,SAAQ,SAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,kBAAkB,EAAE;IAIhD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAcxC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// GSD-2 Interactive Tool Execution Rendering
|
|
1
2
|
import { Box, Container, getCapabilities, Image, imageFallback, Spacer, style, Text, truncateToWidth, visibleWidth, } from "@gsd/pi-tui";
|
|
2
3
|
import stripAnsi from "strip-ansi";
|
|
3
4
|
import { computeEditDiff } from "../../../core/tools/edit-diff.js";
|
|
@@ -471,6 +472,37 @@ export class ToolExecutionComponent extends Container {
|
|
|
471
472
|
const hasImages = this.result.content?.some((block) => block.type === "image") ?? false;
|
|
472
473
|
return !hasImages && this.getTextOutput().trim().length === 0;
|
|
473
474
|
}
|
|
475
|
+
getRollupPhase() {
|
|
476
|
+
if (!this.shouldRenderCompactSuccess())
|
|
477
|
+
return null;
|
|
478
|
+
const label = this.getPhaseLabel();
|
|
479
|
+
const endedAt = this.endedAt ?? Date.now();
|
|
480
|
+
return {
|
|
481
|
+
label,
|
|
482
|
+
count: 1,
|
|
483
|
+
durationMs: Math.max(0, endedAt - this.startedAt),
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
getPhaseLabel() {
|
|
487
|
+
const name = this.normalizedToolName;
|
|
488
|
+
const displayName = prettifyToolName(this.toolName, this.toolDefinition?.label);
|
|
489
|
+
if (name === "bash")
|
|
490
|
+
return "Setup / shell";
|
|
491
|
+
if (name === "read" || name === "ls" || name === "find" || name === "grep")
|
|
492
|
+
return "Context reads";
|
|
493
|
+
if (name === "write" || name === "edit")
|
|
494
|
+
return "File changes";
|
|
495
|
+
if (name === "web_search" || displayName === "ToolSearch")
|
|
496
|
+
return "Discovery";
|
|
497
|
+
if (displayName === "Memory Query" || displayName === "Memory Capture" || displayName === "Gsd Graph") {
|
|
498
|
+
return "Memory lookups";
|
|
499
|
+
}
|
|
500
|
+
if (displayName === "Update Requirement" || displayName === "Save Requirement")
|
|
501
|
+
return "Requirement writes";
|
|
502
|
+
if (displayName.startsWith("Complete "))
|
|
503
|
+
return "Finalization";
|
|
504
|
+
return "Other tool actions";
|
|
505
|
+
}
|
|
474
506
|
getCompactSummary(frameLabel) {
|
|
475
507
|
return `${frameLabel} Completed`;
|
|
476
508
|
}
|
|
@@ -1045,4 +1077,23 @@ export class ToolExecutionComponent extends Container {
|
|
|
1045
1077
|
return text;
|
|
1046
1078
|
}
|
|
1047
1079
|
}
|
|
1080
|
+
export class ToolPhaseSummaryComponent extends Container {
|
|
1081
|
+
constructor(phases) {
|
|
1082
|
+
super();
|
|
1083
|
+
this.phases = phases;
|
|
1084
|
+
}
|
|
1085
|
+
render(width) {
|
|
1086
|
+
const frameWidth = Math.max(20, width);
|
|
1087
|
+
const rows = this.phases.map((phase) => {
|
|
1088
|
+
const left = `${phase.label} ${phase.count} ${phase.count === 1 ? "action" : "actions"}`;
|
|
1089
|
+
const right = `success · ${formatElapsed(phase.durationMs)}`;
|
|
1090
|
+
const contentWidth = Math.max(1, frameWidth - 2);
|
|
1091
|
+
const leftWidth = Math.max(1, contentWidth - visibleWidth(right) - 1);
|
|
1092
|
+
const leftText = truncateToWidth(left, leftWidth, "");
|
|
1093
|
+
const gap = Math.max(1, contentWidth - visibleWidth(leftText) - visibleWidth(right));
|
|
1094
|
+
return `${theme.fg("toolSuccess", leftText)}${" ".repeat(gap)}${theme.fg("toolSuccess", right)}`;
|
|
1095
|
+
});
|
|
1096
|
+
return ["", ...style().border("minimal").borderColor((text) => theme.fg("toolSuccess", text)).render(rows, frameWidth)];
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1048
1099
|
//# sourceMappingURL=tool-execution.js.map
|