@code-yeongyu/senpi 2026.7.16 → 2026.7.17-2
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/CHANGELOG.md +65 -0
- package/dist/core/dynamic-prompt/build.d.ts +7 -0
- package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/build.js +5 -0
- package/dist/core/dynamic-prompt/build.js.map +1 -1
- package/dist/core/dynamic-prompt/workstation.d.ts +35 -0
- package/dist/core/dynamic-prompt/workstation.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/workstation.js +81 -0
- package/dist/core/dynamic-prompt/workstation.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts +6 -2
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/anthropic-web-search/index.js +73 -5
- package/dist/core/extensions/builtin/anthropic-web-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/command-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.js +4 -5
- package/dist/core/extensions/builtin/goal/command-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/elapsed-ticker.d.ts +43 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.js +58 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.js.map +1 -0
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +39 -14
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +3 -4
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.d.ts +2 -2
- package/dist/core/extensions/builtin/goal/ui.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.js +8 -4
- package/dist/core/extensions/builtin/goal/ui.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +14 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +13 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.js +2 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts +27 -0
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js +60 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +1 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.js +1 -0
- package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -1
- package/docs/settings.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +37 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +59 -19
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +68 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +58 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +6 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +70 -110
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +44 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +20 -20
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +0 -110
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +0 -90
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.js +171 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution-renderer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAA+B,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,GAC3B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAKhF,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAYnD,YAAY,QAA+B,EAAE,KAA+B,EAAE,YAAwB;QACrG,KAAK,EAAE,CAAC;QARQ,wBAAmB,GAAG,IAAI,SAAS,EAAE,CAAC;QACtC,kBAAa,GAA4B,EAAE,CAAC;QAQ5D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG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SAA0B,EAC1B,IAAkB,EAClB,KAAc,EACd,QAA+B;QAE/B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3C,IAAI,QAAQ;gBAAE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC3C,OAAO;QACR,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvC,SAAS,CAAC,QAAQ,CACjB,IAAI,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;YAC9C,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,KAAK;gBAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3F,CAAC,CAAC,CACF,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,IAAkB;QAC9C,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC;IACpF,CAAC;IAEO,oBAAoB,CAAC,IAAkB,EAAE,SAAgC;QAChF,IAAI,IAAI,KAAK,MAAM;YAAE,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;;YACvD,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAC/C,CAAC;CACD","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport { Box, type Component, Container, getCapabilities, Text } from \"@earendil-works/pi-tui\";\nimport type { ToolRenderContext } from \"../../../core/extensions/types.ts\";\nimport { createAllToolDefinitions, type ToolDef, type ToolName } from \"../../../core/tools/index.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport {\n\tcreateToolCallFallback,\n\tcreateToolResultFallback,\n\tformatToolExecutionFallback,\n} from \"./tool-execution-fallback.ts\";\nimport type { ToolExecutionIdentity, ToolExecutionRenderState, ToolExecutionResult } from \"./tool-execution-types.ts\";\nimport { isComponent, ToolRendererBoundary } from \"./tool-renderer-boundary.ts\";\n\ntype RenderContainer = Box | Container;\ntype RendererSlot = \"call\" | \"result\";\n\nexport class ToolExecutionRenderer extends Container {\n\tprivate readonly identity: ToolExecutionIdentity;\n\tprivate readonly builtInDefinition: ToolDef | undefined;\n\tprivate readonly contentBox: Box;\n\tprivate readonly contentText: Text;\n\tprivate readonly selfRenderContainer = new Container();\n\tprivate readonly rendererState: Record<string, unknown> = {};\n\tprivate readonly onInvalidate: () => void;\n\tprivate state: ToolExecutionRenderState;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\n\tconstructor(identity: ToolExecutionIdentity, state: ToolExecutionRenderState, onInvalidate: () => void) {\n\t\tsuper();\n\t\tthis.identity = identity;\n\t\tthis.state = state;\n\t\tthis.onInvalidate = onInvalidate;\n\t\tthis.builtInDefinition = createAllToolDefinitions(identity.cwd)[identity.toolName as ToolName];\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.addChild(\n\t\t\tthis.hasRendererDefinition\n\t\t\t\t? this.renderShell === \"self\"\n\t\t\t\t\t? this.selfRenderContainer\n\t\t\t\t\t: this.contentBox\n\t\t\t\t: this.contentText,\n\t\t);\n\t}\n\n\tget hasRendererDefinition(): boolean {\n\t\treturn this.builtInDefinition !== undefined || this.identity.toolDefinition !== undefined;\n\t}\n\n\tget hasResultRenderer(): boolean {\n\t\treturn this.getResultRenderer() !== undefined;\n\t}\n\n\tget renderShell(): \"default\" | \"self\" {\n\t\tconst customShell = this.identity.toolDefinition?.renderShell;\n\t\treturn customShell ?? this.builtInDefinition?.renderShell ?? \"default\";\n\t}\n\n\tupdate(state: ToolExecutionRenderState): void {\n\t\tthis.state = state;\n\t\tconst background = state.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: state.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tif (!this.hasRendererDefinition) {\n\t\t\tthis.contentText.setCustomBgFn(background);\n\t\t\tthis.contentText.setText(\n\t\t\t\tformatToolExecutionFallback(this.identity.toolName, state.args, state.result, state.showImages),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this.renderShell === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\tif (container instanceof Box) container.setBgFn(background);\n\t\tcontainer.detachAll();\n\t\tthis.renderCall(container);\n\t\tif (state.result) this.renderResult(container, state.result);\n\t}\n\n\tprivate getCallRenderer(): ToolDef[\"renderCall\"] | undefined {\n\t\treturn this.identity.toolDefinition?.renderCall ?? this.builtInDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDef[\"renderResult\"] | undefined {\n\t\treturn this.identity.toolDefinition?.renderResult ?? this.builtInDefinition?.renderResult;\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext<Record<string, unknown>, unknown> {\n\t\treturn {\n\t\t\targs: this.state.args,\n\t\t\ttoolCallId: this.identity.toolCallId,\n\t\t\tinvalidate: this.onInvalidate,\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.identity.cwd,\n\t\t\texecutionStarted: this.state.executionStarted,\n\t\t\targsComplete: this.state.argsComplete,\n\t\t\tisPartial: this.state.isPartial,\n\t\t\texpanded: this.state.expanded,\n\t\t\tshowImages: this.state.showImages,\n\t\t\timageProtocol: getCapabilities().images,\n\t\t\tisError: this.state.result?.isError ?? false,\n\t\t\tspinnerFrame: this.state.spinnerFrame,\n\t\t};\n\t}\n\n\tprivate renderCall(container: RenderContainer): void {\n\t\tconst fallback = createToolCallFallback(this.identity.toolName);\n\t\tconst renderer = this.getCallRenderer();\n\t\tif (!renderer) {\n\t\t\tcontainer.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst component = renderer(this.state.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\tthis.addRendererComponent(container, \"call\", component, fallback);\n\t\t} catch {\n\t\t\tthis.callRendererComponent = undefined;\n\t\t\tcontainer.addChild(fallback);\n\t\t}\n\t}\n\n\tprivate renderResult(container: RenderContainer, result: ToolExecutionResult): void {\n\t\tconst fallback = createToolResultFallback(result, this.state.showImages);\n\t\tconst renderer = this.getResultRenderer();\n\t\tif (!renderer) {\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst agentResult = { content: result.content, details: result.details } satisfies AgentToolResult<unknown>;\n\t\t\tconst component = renderer(\n\t\t\t\tagentResult,\n\t\t\t\t{ expanded: this.state.expanded, isPartial: this.state.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t);\n\t\t\tthis.addRendererComponent(container, \"result\", component, fallback);\n\t\t} catch {\n\t\t\tthis.resultRendererComponent = undefined;\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t}\n\t}\n\n\tprivate addRendererComponent(\n\t\tcontainer: RenderContainer,\n\t\tslot: RendererSlot,\n\t\tvalue: unknown,\n\t\tfallback: Component | undefined,\n\t): void {\n\t\tif (!isComponent(value)) {\n\t\t\tthis.setRendererComponent(slot, undefined);\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\tthis.setRendererComponent(slot, value);\n\t\tcontainer.addChild(\n\t\t\tnew ToolRendererBoundary(value, fallback, () => {\n\t\t\t\tif (this.getRendererComponent(slot) === value) this.setRendererComponent(slot, undefined);\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate getRendererComponent(slot: RendererSlot): Component | undefined {\n\t\treturn slot === \"call\" ? this.callRendererComponent : this.resultRendererComponent;\n\t}\n\n\tprivate setRendererComponent(slot: RendererSlot, component: Component | undefined): void {\n\t\tif (slot === \"call\") this.callRendererComponent = component;\n\t\telse this.resultRendererComponent = component;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-execution-renderer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAA+B,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,GAC3B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAKhF,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAYnD,YAAY,QAA+B,EAAE,KAA+B,EAAE,YAAwB;QACrG,KAAK,EAAE,CAAC;QARQ,wBAAmB,GAAG,IAAI,SAAS,EAAE,CAAC;QACtC,kBAAa,GAA4B,EAAE,CAAC;QAQ5D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAoB,CAAC,CAAC;QAC/F,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;QACnF,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE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,IAAI,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;YAC9C,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,KAAK;gBAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3F,CAAC,CAAC,CACF,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,IAAkB;QAC9C,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC;IACpF,CAAC;IAEO,oBAAoB,CAAC,IAAkB,EAAE,SAAgC;QAChF,IAAI,IAAI,KAAK,MAAM;YAAE,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;;YACvD,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAC/C,CAAC;CACD","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport { Box, type Component, Container, getCapabilities, Text } from \"@earendil-works/pi-tui\";\nimport type { ToolRenderContext } from \"../../../core/extensions/types.ts\";\nimport { createAllToolDefinitions, type ToolDef, type ToolName } from \"../../../core/tools/index.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport {\n\tcreateToolCallFallback,\n\tcreateToolResultFallback,\n\tformatToolExecutionFallback,\n} from \"./tool-execution-fallback.ts\";\nimport type { ToolExecutionIdentity, ToolExecutionRenderState, ToolExecutionResult } from \"./tool-execution-types.ts\";\nimport { isComponent, ToolRendererBoundary } from \"./tool-renderer-boundary.ts\";\n\ntype RenderContainer = Box | Container;\ntype RendererSlot = \"call\" | \"result\";\n\nexport class ToolExecutionRenderer extends Container {\n\tprivate readonly identity: ToolExecutionIdentity;\n\tprivate readonly builtInDefinition: ToolDef | undefined;\n\tprivate readonly contentBox: Box;\n\tprivate readonly contentText: Text;\n\tprivate readonly selfRenderContainer = new Container();\n\tprivate readonly rendererState: Record<string, unknown> = {};\n\tprivate readonly onInvalidate: () => void;\n\tprivate state: ToolExecutionRenderState;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\n\tconstructor(identity: ToolExecutionIdentity, state: ToolExecutionRenderState, onInvalidate: () => void) {\n\t\tsuper();\n\t\tthis.identity = identity;\n\t\tthis.state = state;\n\t\tthis.onInvalidate = onInvalidate;\n\t\tthis.builtInDefinition = createAllToolDefinitions(identity.cwd)[identity.toolName as ToolName];\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.addChild(\n\t\t\tthis.hasRendererDefinition\n\t\t\t\t? this.renderShell === \"self\"\n\t\t\t\t\t? this.selfRenderContainer\n\t\t\t\t\t: this.contentBox\n\t\t\t\t: this.contentText,\n\t\t);\n\t}\n\n\tget hasRendererDefinition(): boolean {\n\t\treturn this.builtInDefinition !== undefined || this.identity.toolDefinition !== undefined;\n\t}\n\n\tget hasResultRenderer(): boolean {\n\t\treturn this.getResultRenderer() !== undefined;\n\t}\n\n\tget renderShell(): \"default\" | \"self\" {\n\t\tconst customShell = this.identity.toolDefinition?.renderShell;\n\t\treturn customShell ?? this.builtInDefinition?.renderShell ?? \"default\";\n\t}\n\n\tupdate(state: ToolExecutionRenderState): void {\n\t\tthis.state = state;\n\t\tconst background = state.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: state.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tif (!this.hasRendererDefinition) {\n\t\t\tthis.contentText.setCustomBgFn(background);\n\t\t\tthis.contentText.setText(\n\t\t\t\tformatToolExecutionFallback(this.identity.toolName, state.args, state.result, state.showImages),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this.renderShell === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\tif (container instanceof Box) container.setBgFn(background);\n\t\tcontainer.detachAll();\n\t\tthis.renderCall(container);\n\t\tif (state.result) this.renderResult(container, state.result);\n\t}\n\n\tprivate getCallRenderer(): ToolDef[\"renderCall\"] | undefined {\n\t\treturn this.identity.toolDefinition?.renderCall ?? this.builtInDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDef[\"renderResult\"] | undefined {\n\t\treturn this.identity.toolDefinition?.renderResult ?? this.builtInDefinition?.renderResult;\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext<Record<string, unknown>, unknown> {\n\t\treturn {\n\t\t\targs: this.state.args,\n\t\t\ttoolCallId: this.identity.toolCallId,\n\t\t\tinvalidate: this.onInvalidate,\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.identity.cwd,\n\t\t\texecutionStarted: this.state.executionStarted,\n\t\t\targsComplete: this.state.argsComplete,\n\t\t\tisPartial: this.state.isPartial,\n\t\t\texpanded: this.state.expanded,\n\t\t\tshowImages: this.state.showImages,\n\t\t\timageProtocol: getCapabilities().images,\n\t\t\tisError: this.state.result?.isError ?? false,\n\t\t\thasResult: this.state.result !== undefined,\n\t\t\tspinnerFrame: this.state.spinnerFrame,\n\t\t};\n\t}\n\n\tprivate renderCall(container: RenderContainer): void {\n\t\tconst fallback = createToolCallFallback(this.identity.toolName);\n\t\tconst renderer = this.getCallRenderer();\n\t\tif (!renderer) {\n\t\t\tcontainer.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst component = renderer(this.state.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\tthis.addRendererComponent(container, \"call\", component, fallback);\n\t\t} catch {\n\t\t\tthis.callRendererComponent = undefined;\n\t\t\tcontainer.addChild(fallback);\n\t\t}\n\t}\n\n\tprivate renderResult(container: RenderContainer, result: ToolExecutionResult): void {\n\t\tconst fallback = createToolResultFallback(result, this.state.showImages);\n\t\tconst renderer = this.getResultRenderer();\n\t\tif (!renderer) {\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst agentResult = { content: result.content, details: result.details } satisfies AgentToolResult<unknown>;\n\t\t\tconst component = renderer(\n\t\t\t\tagentResult,\n\t\t\t\t{ expanded: this.state.expanded, isPartial: this.state.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t);\n\t\t\tthis.addRendererComponent(container, \"result\", component, fallback);\n\t\t} catch {\n\t\t\tthis.resultRendererComponent = undefined;\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t}\n\t}\n\n\tprivate addRendererComponent(\n\t\tcontainer: RenderContainer,\n\t\tslot: RendererSlot,\n\t\tvalue: unknown,\n\t\tfallback: Component | undefined,\n\t): void {\n\t\tif (!isComponent(value)) {\n\t\t\tthis.setRendererComponent(slot, undefined);\n\t\t\tif (fallback) container.addChild(fallback);\n\t\t\treturn;\n\t\t}\n\t\tthis.setRendererComponent(slot, value);\n\t\tcontainer.addChild(\n\t\t\tnew ToolRendererBoundary(value, fallback, () => {\n\t\t\t\tif (this.getRendererComponent(slot) === value) this.setRendererComponent(slot, undefined);\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate getRendererComponent(slot: RendererSlot): Component | undefined {\n\t\treturn slot === \"call\" ? this.callRendererComponent : this.resultRendererComponent;\n\t}\n\n\tprivate setRendererComponent(slot: RendererSlot, component: Component | undefined): void {\n\t\tif (slot === \"call\") this.callRendererComponent = component;\n\t\telse this.resultRendererComponent = component;\n\t}\n}\n"]}
|
package/docs/settings.md
CHANGED
|
@@ -84,7 +84,7 @@ Permission rules are a confirmation policy, not a sandbox. Senpi, extensions, pa
|
|
|
84
84
|
| `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) |
|
|
85
85
|
| `defaultModel` | string | - | Default model ID |
|
|
86
86
|
| `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` |
|
|
87
|
-
| `promptPreset` | string | `"auto"` | Force a system prompt preset: `"auto"`, `"kimi-k2-6"`, `"kimi-k2-7"`, `"glm-5.2"`, `"claude-fable-5"`, `"claude-opus-4-5"`, `"claude-opus-4-6"`, `"claude-opus-4-7"`, `"claude-opus-4-8"`, `"gpt-5"`, `"gpt-5.2"`, `"gpt-5.3-codex"`, `"gpt-5.4"`, `"gpt-5.5"`, or `"gpt-5.6"` |
|
|
87
|
+
| `promptPreset` | string | `"auto"` | Force a system prompt preset: `"auto"`, `"kimi-k2-6"`, `"kimi-k2-7"`, `"kimi-k3"`, `"glm-5.2"`, `"claude-fable-5"`, `"claude-opus-4-5"`, `"claude-opus-4-6"`, `"claude-opus-4-7"`, `"claude-opus-4-8"`, `"gpt-5"`, `"gpt-5.2"`, `"gpt-5.3-codex"`, `"gpt-5.4"`, `"gpt-5.5"`, or `"gpt-5.6"` |
|
|
88
88
|
| `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
|
|
89
89
|
| `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses |
|
|
90
90
|
| `thinkingBudgets` | object | - | Custom token budgets per thinking level |
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.10",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.10",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-gondolin",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.10",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-gondolin",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.10",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.10",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "1.10.
|
|
9
|
+
"version": "1.10.10",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.10",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.10",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2026.7.17-2] - 2026-07-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added a host-sizing note to the `eval` prompt: the extension now passes a preformatted host line (platform, arch, CPU model, core count) at registration so the prompt tells the model to size `parallel(thunks)` pools to the local cores and keep shell commands platform-appropriate.
|
|
8
|
+
- Added model-aware eval-first batching emphasis: the `eval` tool description and its system-prompt guideline now render in a dialect selected by the active model id (Claude/GLM, OpenAI, Kimi, and a maximum-emphasis default fallback), re-registering on `model_select` so mid-session model switches pick up the matching dialect.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
## [2026.7.17] - 2026-07-17
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Fixed `eval` tool calls rendering duplicate stacked boxes after a result arrived; the pending, running, and completed states now update in one in-place frame ([#223](https://github.com/code-yeongyu/senpi/pull/223)).
|
|
23
|
+
|
|
24
|
+
## [2026.7.16-3] - 2026-07-16
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
## [2026.7.16-2] - 2026-07-16
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
3
40
|
## [2026.7.16] - 2026-07-16
|
|
4
41
|
|
|
5
42
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.17-2",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/parser": "7.29.7",
|
|
33
|
-
"@earendil-works/pi-ai": "^2026.7.
|
|
33
|
+
"@earendil-works/pi-ai": "^2026.7.17-2",
|
|
34
34
|
"typebox": "1.1.38"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@code-yeongyu/senpi": "*"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@code-yeongyu/senpi": "2026.7.
|
|
40
|
+
"@code-yeongyu/senpi": "2026.7.17-2"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"senpi",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as os from "node:os";
|
|
1
2
|
import type { ExtensionContext } from "@code-yeongyu/senpi";
|
|
2
3
|
import type { KernelToHostMessage } from "./bridge/protocol.ts";
|
|
3
4
|
import type { AgentExecuteTool } from "./bridges/agent-bridge.ts";
|
|
@@ -35,6 +36,8 @@ const SESSION_LIFECYCLE_EVENTS = [
|
|
|
35
36
|
|
|
36
37
|
type SessionLifecycleEvent = (typeof SESSION_LIFECYCLE_EVENTS)[number];
|
|
37
38
|
|
|
39
|
+
type CodemodeEvent = SessionLifecycleEvent | "model_select";
|
|
40
|
+
|
|
38
41
|
type TrackedExecution = {
|
|
39
42
|
readonly promise: Promise<unknown>;
|
|
40
43
|
readonly controller: AbortController;
|
|
@@ -51,7 +54,7 @@ type SessionRuntime = {
|
|
|
51
54
|
|
|
52
55
|
export interface CodemodeExtensionAPI {
|
|
53
56
|
registerTool(tool: ReturnType<typeof createEvalTool>): void;
|
|
54
|
-
on(event:
|
|
57
|
+
on(event: CodemodeEvent, handler: (event: unknown, ctx: ExtensionContext) => Promise<void> | void): void;
|
|
55
58
|
executeTool: AgentExecuteTool;
|
|
56
59
|
getActiveTools(): string[];
|
|
57
60
|
}
|
|
@@ -75,6 +78,32 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
75
78
|
const manager = new SessionManagerProxy();
|
|
76
79
|
const complete = options.complete ?? ((request, ctx) => createCompletionHandler()(ctx)(request));
|
|
77
80
|
const renderers = { renderCall: renderEvalCall, renderResult: renderEvalResult };
|
|
81
|
+
let activeRuntime: SessionRuntime | undefined;
|
|
82
|
+
let activeModelId: string | undefined;
|
|
83
|
+
const registerEvalForRuntime = (runtime: SessionRuntime, modelId: string | undefined): void => {
|
|
84
|
+
pi.registerTool(
|
|
85
|
+
createEvalTool({
|
|
86
|
+
enabledLanguages: runtime.enabledLanguages,
|
|
87
|
+
kernelManager: manager,
|
|
88
|
+
cellTimeoutSeconds: runtime.settings.cellTimeoutSeconds,
|
|
89
|
+
executeTool: runtime.executeTool,
|
|
90
|
+
complete,
|
|
91
|
+
settings: runtime.settings,
|
|
92
|
+
artifactsDir: runtime.artifactsDir,
|
|
93
|
+
executionTracker: manager,
|
|
94
|
+
renderers,
|
|
95
|
+
spawns: runtime.spawns,
|
|
96
|
+
spawnDefaultAgent: runtime.settings.taskTools.task,
|
|
97
|
+
hostLine: hostLine(),
|
|
98
|
+
...(modelId === undefined ? {} : { modelId }),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
const dropRuntime = async (): Promise<void> => {
|
|
103
|
+
activeRuntime = undefined;
|
|
104
|
+
activeModelId = undefined;
|
|
105
|
+
await manager.dispose();
|
|
106
|
+
};
|
|
78
107
|
pi.registerTool(
|
|
79
108
|
createEvalTool({
|
|
80
109
|
enabledLanguages: { py: true, js: true, rb: true, jl: true },
|
|
@@ -85,6 +114,7 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
85
114
|
settings: defaultCodemodeSettings,
|
|
86
115
|
executionTracker: manager,
|
|
87
116
|
renderers,
|
|
117
|
+
hostLine: hostLine(),
|
|
88
118
|
}),
|
|
89
119
|
);
|
|
90
120
|
|
|
@@ -92,25 +122,35 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
92
122
|
const generation = manager.beginReplacement();
|
|
93
123
|
const runtime = await createRuntime(pi, ctx, event, complete, options);
|
|
94
124
|
if (!(await manager.replace(generation, runtime.manager))) return;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
);
|
|
125
|
+
activeRuntime = runtime;
|
|
126
|
+
activeModelId = ctx.model?.id;
|
|
127
|
+
registerEvalForRuntime(runtime, activeModelId);
|
|
128
|
+
});
|
|
129
|
+
pi.on("session_shutdown", async () => dropRuntime());
|
|
130
|
+
pi.on("session_before_switch", async () => dropRuntime());
|
|
131
|
+
pi.on("session_before_fork", async () => dropRuntime());
|
|
132
|
+
pi.on("model_select", async (event) => {
|
|
133
|
+
const runtime = activeRuntime;
|
|
134
|
+
if (runtime === undefined) return;
|
|
135
|
+
const modelId = modelIdFrom(event);
|
|
136
|
+
if (modelId === undefined || modelId === activeModelId) return;
|
|
137
|
+
activeModelId = modelId;
|
|
138
|
+
registerEvalForRuntime(runtime, modelId);
|
|
110
139
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hostLine(): string {
|
|
143
|
+
const cpu = os.cpus()[0]?.model?.trim();
|
|
144
|
+
return [`${os.platform()} ${os.arch()}`, cpu, `${os.availableParallelism()} cores`]
|
|
145
|
+
.filter((part): part is string => !!part)
|
|
146
|
+
.join(" \u00b7 ");
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function modelIdFrom(event: unknown): string | undefined {
|
|
150
|
+
if (typeof event !== "object" || event === null || !("model" in event)) return undefined;
|
|
151
|
+
const model = event.model;
|
|
152
|
+
if (typeof model !== "object" || model === null || !("id" in model)) return undefined;
|
|
153
|
+
return typeof model.id === "string" ? model.id : undefined;
|
|
114
154
|
}
|
|
115
155
|
|
|
116
156
|
class SessionManagerProxy implements CodemodeSessionManager, EvalExecutionTracker {
|
|
@@ -14,6 +14,35 @@ export interface EvalPromptParts {
|
|
|
14
14
|
export interface EvalPromptOptions {
|
|
15
15
|
readonly spawns: boolean;
|
|
16
16
|
readonly spawnDefaultAgent?: string;
|
|
17
|
+
/** Active model id; selects the emphasis dialect of the batching guidance. */
|
|
18
|
+
readonly modelId?: string;
|
|
19
|
+
/** Preformatted host line (e.g. "darwin arm64 · Apple M5 Max · 18 cores"); enables the host-sizing note. */
|
|
20
|
+
readonly hostLine?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Prompt dialect for the eval-first batching emphasis. */
|
|
24
|
+
export type EvalEmphasisStyle = "default" | "claude" | "codex" | "kimi";
|
|
25
|
+
|
|
26
|
+
const CLAUDE_MODEL_RE = /(^|[/.:])claude[-.]/i;
|
|
27
|
+
const GLM_MODEL_RE = /(^|[/.:@-])glm[-.]?\d/i;
|
|
28
|
+
const KIMI_MODEL_RE = /(^|[/.:])kimi[-.]/i;
|
|
29
|
+
const OPENAI_MODEL_RE = /(^|[/.:])(gpt|chatgpt|codex)[-.]|(^|[/.:])o[134](?:[-.]|$)/i;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Selects the eval-first batching dialect for a model id:
|
|
33
|
+
* - `claude`: Claude/GLM — direct imperatives; both are steered most reliably
|
|
34
|
+
* by explicit tagged directives (GLM prompting guidance routes to Claude's).
|
|
35
|
+
* - `codex`: OpenAI reasoning families — terse bounded rules, no emphasis spam.
|
|
36
|
+
* - `kimi`: Kimi K-series — positive operational constraints; all-caps NEVER
|
|
37
|
+
* directives make K2.x overthink instead of comply.
|
|
38
|
+
* - `default`: everything else (and no model) — maximum-emphasis fallback.
|
|
39
|
+
*/
|
|
40
|
+
export function evalEmphasisStyle(modelId: string | undefined): EvalEmphasisStyle {
|
|
41
|
+
if (!modelId) return "default";
|
|
42
|
+
if (CLAUDE_MODEL_RE.test(modelId) || GLM_MODEL_RE.test(modelId)) return "claude";
|
|
43
|
+
if (KIMI_MODEL_RE.test(modelId)) return "kimi";
|
|
44
|
+
if (OPENAI_MODEL_RE.test(modelId)) return "codex";
|
|
45
|
+
return "default";
|
|
17
46
|
}
|
|
18
47
|
|
|
19
48
|
type ContextValue = string | boolean;
|
|
@@ -57,7 +86,24 @@ const EVAL_PROMPT_TEMPLATE = `Run one step of code in a persistent kernel.
|
|
|
57
86
|
|
|
58
87
|
Work incrementally: imports in one call, define in the next, test, then use — each its own eval call. Re-run setup ONLY after \`reset\`, a kernel crash, or a \`NameError\`/\`ReferenceError\` proving the state is gone.
|
|
59
88
|
|
|
60
|
-
|
|
89
|
+
{{#if styleClaude}}<eval_first_batching>
|
|
90
|
+
\`eval\` is your default execution surface: if a step needs more than one tool call, write ONE cell that performs the whole step — never issue the calls one at a time.
|
|
91
|
+
- Enumerate every lookup the step needs, then run all independent ones simultaneously with \`parallel(thunks)\` inside the cell; keep calls sequential only when one result feeds the next.
|
|
92
|
+
- Write real code around the calls: loop or comprehend over file sets with \`read()\`/stdlib, branch per case, and wrap risky calls in try/except so one failure degrades only its item — recover or retry inside the cell, keep the batch alive.
|
|
93
|
+
- Post-process \`tool.<name>()\` results programmatically and return distilled facts, not raw dumps.
|
|
94
|
+
</eval_first_batching>{{/if}}{{#if styleCodex}}Route multi-call steps through eval: one cell per step, independent lookups dispatched together via \`parallel(thunks)\`; keep work sequential only when one result determines the next action.
|
|
95
|
+
- Loop or comprehend over file sets with \`read()\`/stdlib instead of reading files one call at a time; post-process \`tool.<name>()\` results programmatically.
|
|
96
|
+
- Wrap failable calls in try/except inside the cell; a failed item degrades only itself. After two distinct failed strategies for the same fact, fall back to direct tool calls.
|
|
97
|
+
- Reduce large results in-kernel to the facts the task needs before returning.{{/if}}{{#if styleKimi}}Treat eval as the standard way to execute any step involving several tool calls: write one cell that performs the whole step.
|
|
98
|
+
- When lookups are independent, run them together with \`parallel(thunks)\` in that cell; when one result feeds the next, keep them sequential inside the same cell.
|
|
99
|
+
- Loop or comprehend over file sets with \`read()\`/stdlib, post-process \`tool.<name>()\` results programmatically, and put try/except around each risky call so the rest of the batch completes.
|
|
100
|
+
- Filter and aggregate results in the kernel, then return the distilled facts.{{/if}}{{#if styleDefault}}**EVAL IS YOUR PRIMARY EXECUTION SURFACE.** Any step that needs MORE THAN ONE tool call MUST be written as ONE cell — NEVER as a chain of single tool calls.
|
|
101
|
+
- **PLAN THE WHOLE STEP, THEN BATCH IT.** Enumerate every read/search/lookup the step needs and dispatch ALL independent ones through \`parallel(thunks)\` in one cell.
|
|
102
|
+
- **WRITE REAL CODE, NOT CALL LISTS.** Loop or comprehend over file sets with \`read()\`/stdlib, branch \`if\`/\`else\` per case, post-process \`tool.<name>()\` results programmatically, and wrap EVERY risky call in try/except so ONE failure NEVER kills the batch.
|
|
103
|
+
- **DISTILL IN-KERNEL.** Filter, diff, and aggregate in code before returning; return facts, NOT dumps.{{/if}}
|
|
104
|
+
{{#if hostLine}}
|
|
105
|
+
Host: {{hostLine}} — cells execute here. Size \`parallel(thunks)\` pools to its cores; \`tool.<name>()\` shell commands must fit this platform, even when the code you are writing targets another machine.
|
|
106
|
+
{{/if}}
|
|
61
107
|
|
|
62
108
|
Fields:
|
|
63
109
|
|
|
@@ -129,6 +175,7 @@ export function buildEvalPrompt(
|
|
|
129
175
|
throw new Error("no kernels enabled for eval prompt");
|
|
130
176
|
}
|
|
131
177
|
const spawnDefaultAgent = options.spawnDefaultAgent ?? "task";
|
|
178
|
+
const style = evalEmphasisStyle(options.modelId);
|
|
132
179
|
const context: Context = {
|
|
133
180
|
py: enabled.py,
|
|
134
181
|
js: enabled.js,
|
|
@@ -136,6 +183,11 @@ export function buildEvalPrompt(
|
|
|
136
183
|
jl: enabled.jl,
|
|
137
184
|
spawns: options.spawns,
|
|
138
185
|
spawnDefaultAgent,
|
|
186
|
+
styleClaude: style === "claude",
|
|
187
|
+
styleCodex: style === "codex",
|
|
188
|
+
styleKimi: style === "kimi",
|
|
189
|
+
styleDefault: style === "default",
|
|
190
|
+
hostLine: options.hostLine ?? "",
|
|
139
191
|
};
|
|
140
192
|
const examples = REUSE_CHAIN_EXAMPLES.filter((example) => enabled[example.language])
|
|
141
193
|
.map((example) => {
|
|
@@ -155,12 +207,26 @@ export function buildEvalPrompt(
|
|
|
155
207
|
description,
|
|
156
208
|
promptSnippet: "Run one incremental code cell in a persistent language kernel.",
|
|
157
209
|
promptGuidelines: [
|
|
158
|
-
|
|
210
|
+
BATCHING_GUIDELINES[style],
|
|
159
211
|
"Use eval reset only when a language kernel must be wiped; reset is scoped to the selected language.",
|
|
160
212
|
],
|
|
161
213
|
};
|
|
162
214
|
}
|
|
163
215
|
|
|
216
|
+
/**
|
|
217
|
+
* System-prompt guideline per emphasis dialect. The default dialect carries
|
|
218
|
+
* maximum emphasis so unmapped models still batch through eval; the others are
|
|
219
|
+
* tuned to what steers that family reliably.
|
|
220
|
+
*/
|
|
221
|
+
const BATCHING_GUIDELINES: Record<EvalEmphasisStyle, string> = {
|
|
222
|
+
default:
|
|
223
|
+
"**EVAL FIRST.** Any step needing MORE THAN ONE tool call MUST be ONE eval cell: run independent calls in parallel, wrap risky calls in try/except, and return distilled facts — NEVER a chain of single tool calls.",
|
|
224
|
+
claude:
|
|
225
|
+
"Prefer eval for any step needing more than one tool call: one cell that runs independent calls in parallel, handles per-call failures in code, and returns distilled facts.",
|
|
226
|
+
codex: "Route multi-call steps through eval: one cell per step, independent calls dispatched in parallel; fall back to direct tool calls when one call is sufficient or each result changes the next decision.",
|
|
227
|
+
kimi: "Treat eval as the standard way to execute multi-call steps: one cell that runs independent calls in parallel, handles failures per item, and returns distilled facts.",
|
|
228
|
+
};
|
|
229
|
+
|
|
164
230
|
function renderTemplate(template: string, context: Context): string {
|
|
165
231
|
let index = 0;
|
|
166
232
|
const [rendered, nextIndex] = renderUntil(template, context, index, []);
|
|
@@ -39,6 +39,10 @@ export interface CreateEvalToolOptions {
|
|
|
39
39
|
readonly spawns?: boolean;
|
|
40
40
|
/** Default agent name surfaced in the agent() helper docs when spawns are enabled. */
|
|
41
41
|
readonly spawnDefaultAgent?: string;
|
|
42
|
+
/** Active model id; selects the emphasis dialect of the eval prompt. */
|
|
43
|
+
readonly modelId?: string;
|
|
44
|
+
/** Preformatted host line rendered into the prompt's host-sizing note. */
|
|
45
|
+
readonly hostLine?: string;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
interface EvalCellInvocation {
|
|
@@ -152,6 +156,8 @@ export function createEvalTool(options: CreateEvalToolOptions): ToolDefinition<E
|
|
|
152
156
|
const prompt = buildEvalPrompt(options.enabledLanguages, {
|
|
153
157
|
spawns: options.spawns ?? false,
|
|
154
158
|
...(options.spawnDefaultAgent === undefined ? {} : { spawnDefaultAgent: options.spawnDefaultAgent }),
|
|
159
|
+
...(options.modelId === undefined ? {} : { modelId: options.modelId }),
|
|
160
|
+
...(options.hostLine === undefined ? {} : { hostLine: options.hostLine }),
|
|
155
161
|
});
|
|
156
162
|
const languages = enabledLanguageList(options.enabledLanguages);
|
|
157
163
|
return {
|
|
@@ -725,6 +725,12 @@ export function renderEvalCall(
|
|
|
725
725
|
context: RenderContext,
|
|
726
726
|
): EvalRenderComponent {
|
|
727
727
|
const component = componentFor(context);
|
|
728
|
+
if (context.hasResult === true) {
|
|
729
|
+
// The result renderer owns the full pending -> running -> done frame once a result exists.
|
|
730
|
+
// Rendering the call frame too would stack a duplicate box, so yield to it here.
|
|
731
|
+
component.setBlocks([]);
|
|
732
|
+
return component;
|
|
733
|
+
}
|
|
728
734
|
if (theme === undefined && context.spinnerFrame === undefined) {
|
|
729
735
|
const title = args.title === undefined ? "" : ` ${args.title}`;
|
|
730
736
|
const reset = args.reset === true ? " reset" : "";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-agent-core",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2026.7.
|
|
4
|
+
"version": "2026.7.17-2",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "npm run clean && npm run build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@earendil-works/pi-ai": "^2026.7.
|
|
33
|
+
"@earendil-works/pi-ai": "^2026.7.17-2",
|
|
34
34
|
"ignore": "7.0.5",
|
|
35
35
|
"typebox": "1.1.38",
|
|
36
36
|
"yaml": "2.9.0"
|
|
@@ -747,7 +747,7 @@ Many models support thinking/reasoning capabilities where they can show their in
|
|
|
747
747
|
const model = models.getModel('anthropic', 'claude-sonnet-4-5')!;
|
|
748
748
|
// or models.getModel('openai', 'gpt-5-mini');
|
|
749
749
|
// or models.getModel('google', 'gemini-2.5-flash');
|
|
750
|
-
// or models.getModel('xai', 'grok-
|
|
750
|
+
// or models.getModel('xai', 'grok-4.5');
|
|
751
751
|
|
|
752
752
|
// Check if model supports reasoning
|
|
753
753
|
if (model.reasoning) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAU1C,OAAO,KAAK,EAWX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAgKrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAU1C,OAAO,KAAK,EAWX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAgKrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,M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