@code-yeongyu/senpi 2026.9.23-3 → 2026.9.23-4
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 +21 -0
- package/dist/bundle/chunks/{app-server-command-U5Y46LHO.js → app-server-command-QRBQLEXY.js} +1 -1
- package/dist/bundle/chunks/{chunk-UCTYTLP3.js → chunk-3RN6BFG2.js} +2 -2
- package/dist/bundle/chunks/{chunk-XTXBPXZZ.js → chunk-EN6KDFY2.js} +1 -1
- package/dist/bundle/chunks/{chunk-2NFHX2FJ.js → chunk-J3QXPP4T.js} +1 -1
- package/dist/bundle/chunks/chunk-KBG7BJIL.js +8 -0
- package/dist/bundle/chunks/{chunk-TH4PERSI.js → chunk-N46LNXHU.js} +35 -53
- package/dist/bundle/chunks/{chunk-67Z5WNA4.js → chunk-PSMTQDII.js} +1 -1
- package/dist/bundle/chunks/{chunk-Y4AJLTFT.js → chunk-WUYBEF7C.js} +1 -1
- package/dist/bundle/chunks/{chunk-IDSOMHWS.js → chunk-WXIRFRXY.js} +1 -1
- package/dist/bundle/chunks/{chunk-R6F525XB.js → chunk-XDSQYM4F.js} +1 -1
- package/dist/bundle/chunks/{chunk-TUVSARCZ.js → chunk-ZEFQYQOU.js} +1 -1
- package/dist/bundle/chunks/{cli-main-65WMMIRT.js → cli-main-ROBDBYAB.js} +1 -1
- package/dist/bundle/chunks/cursor-agent.js +1 -1
- package/dist/bundle/chunks/{help-fast-path-VXAZDQ3Z.js → help-fast-path-QXVCHTP3.js} +1 -1
- package/dist/bundle/chunks/{host-command-5PEFD4N6.js → host-command-3PUZYQOK.js} +1 -1
- package/dist/bundle/chunks/{host-lifecycle-BXW5C4JT.js → host-lifecycle-OHPSU5VU.js} +1 -1
- package/dist/bundle/chunks/{interactive-host-runtime-DUNYT24Q.js → interactive-host-runtime-57LEAJPU.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-SCG5PQZ6.js → interactive-mode-SLPAGRHH.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-QC6BZZNH.js → multi-session-host-3PACMEHC.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-23GULCVL.js → package-manager-cli-6UIUSRQO.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-B6RSUQKL.js → pi-messages-CAS467IY.js} +1 -1
- package/dist/bundle/chunks/{rotation-stream-ZIYWOB2N.js → rotation-stream-CZT4TRPD.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-ZQ4E6FFA.js → rpc-mode-47EVLL6X.js} +1 -1
- package/dist/bundle/chunks/{session-picker-CO2ZK3EC.js → session-picker-ZIBANFBQ.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +40 -58
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +43 -26
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
- package/dist/core/extensions/builtin/nested-agents-md/index.js +1 -1
- package/dist/core/extensions/builtin/nested-agents-md/index.js.map +1 -1
- package/dist/core/extensions/builtin/rule-activation/types.d.ts +2 -0
- package/dist/core/extensions/builtin/rule-activation/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rule-activation/types.js +7 -1
- package/dist/core/extensions/builtin/rule-activation/types.js.map +1 -1
- package/dist/core/extensions/builtin/rules/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/index.js +2 -1
- package/dist/core/extensions/builtin/rules/index.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts +3 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js +9 -3
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +87 -14
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +12 -7
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +9 -6
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep/format.d.ts +3 -2
- package/dist/core/tools/grep/format.d.ts.map +1 -1
- package/dist/core/tools/grep/format.js +5 -3
- package/dist/core/tools/grep/format.js.map +1 -1
- package/dist/core/tools/grep/index.js +2 -2
- package/dist/core/tools/grep/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +5 -3
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/model-only-text.d.ts +4 -0
- package/dist/core/tools/model-only-text.d.ts.map +1 -0
- package/dist/core/tools/model-only-text.js +12 -0
- package/dist/core/tools/model-only-text.js.map +1 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +15 -5
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +2 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +1 -25
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/grep.d.ts.map +1 -1
- package/dist/core/tools/renderers/grep.js +0 -25
- package/dist/core/tools/renderers/grep.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts +8 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +2 -14
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/modes/interactive/components/exploration-call.d.ts +4 -1
- package/dist/modes/interactive/components/exploration-call.d.ts.map +1 -1
- package/dist/modes/interactive/components/exploration-call.js +17 -2
- package/dist/modes/interactive/components/exploration-call.js.map +1 -1
- package/dist/modes/interactive/components/exploration-group.d.ts +3 -1
- package/dist/modes/interactive/components/exploration-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/exploration-group.js +7 -1
- package/dist/modes/interactive/components/exploration-group.js.map +1 -1
- package/dist/modes/interactive/components/exploration-rules.d.ts +5 -0
- package/dist/modes/interactive/components/exploration-rules.d.ts.map +1 -0
- package/dist/modes/interactive/components/exploration-rules.js +15 -0
- package/dist/modes/interactive/components/exploration-rules.js.map +1 -0
- package/dist/modes/interactive/components/exploration-transcript-container.d.ts.map +1 -1
- package/dist/modes/interactive/components/exploration-transcript-container.js +10 -1
- package/dist/modes/interactive/components/exploration-transcript-container.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +4 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +14 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +4 -19
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +17 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.d.ts +18 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.js +103 -3
- package/node_modules/@earendil-works/pi-ai/dist/cursor/catalog-grouping.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.js +15 -3
- package/node_modules/@earendil-works/pi-ai/dist/cursor/selection-descriptor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts +7 -2
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js +92 -20
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +9 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +5 -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/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
- package/dist/bundle/chunks/chunk-XPDV6SIX.js +0 -8
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { basename } from "node:path";
|
|
2
2
|
import { resolveToCwd } from "../../../core/tools/path-utils.js";
|
|
3
3
|
import { findRenderers, grepRenderers, lsRenderers, readRenderers } from "../../../core/tools/renderers/index.js";
|
|
4
|
+
import { getCompactReadClassification } from "../../../core/tools/renderers/read.js";
|
|
4
5
|
import { formatPathRelativeToCwdOrAbsolute } from "../../../utils/paths.js";
|
|
5
6
|
const BUILT_IN_RENDERERS = { read: readRenderers, grep: grepRenderers, find: findRenderers, ls: lsRenderers };
|
|
6
7
|
function stringArg(args, ...keys) {
|
|
@@ -13,7 +14,18 @@ function stringArg(args, ...keys) {
|
|
|
13
14
|
}
|
|
14
15
|
return undefined;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
function isReadRenderArgs(args) {
|
|
18
|
+
return args !== null && typeof args === "object";
|
|
19
|
+
}
|
|
20
|
+
/** A skill load or a memory recall is a semantic card, not file exploration; it keeps its own line. */
|
|
21
|
+
function isSemanticRead(args, cwd) {
|
|
22
|
+
const kind = getCompactReadClassification(isReadRenderArgs(args) ? args : undefined, cwd)?.kind;
|
|
23
|
+
return kind === "skill" || kind === "memory";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Group only the built-in read/grep/find/ls presentation; custom renderers, semantic reads, and other
|
|
27
|
+
* tools stay cards.
|
|
28
|
+
*/
|
|
17
29
|
export function explorationCall(component) {
|
|
18
30
|
const { identity, state, presentation } = component.presentationSnapshot;
|
|
19
31
|
if (presentation !== "classic")
|
|
@@ -29,8 +41,11 @@ export function explorationCall(component) {
|
|
|
29
41
|
const pending = state.isPartial;
|
|
30
42
|
const failed = state.result?.isError ?? false;
|
|
31
43
|
const path = stringArg(state.args, "file_path", "path");
|
|
32
|
-
if (toolName === "read")
|
|
44
|
+
if (toolName === "read") {
|
|
45
|
+
if (isSemanticRead(state.args, identity.cwd))
|
|
46
|
+
return undefined;
|
|
33
47
|
return { action: "Read", label: path ? basename(path) : "", pending, failed };
|
|
48
|
+
}
|
|
34
49
|
if (toolName === "grep") {
|
|
35
50
|
const pattern = stringArg(state.args, "pattern") ?? "";
|
|
36
51
|
const dir = path ? formatPathRelativeToCwdOrAbsolute(resolveToCwd(path, identity.cwd), identity.cwd) : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploration-call.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAClH,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAY5E,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;AAE9G,SAAS,SAAS,CAAC,IAAa,EAAE,GAAG,IAAc;IAClD,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"exploration-call.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAuB,MAAM,uCAAuC,CAAC;AAC1G,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAY5E,MAAM,kBAAkB,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,GAAG,OAAO,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC7F,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC5F,CAAC","sourcesContent":["import { basename } from \"node:path\";\nimport { resolveToCwd } from \"../../../core/tools/path-utils.ts\";\nimport { findRenderers, grepRenderers, lsRenderers, readRenderers } from \"../../../core/tools/renderers/index.ts\";\nimport { getCompactReadClassification, type ReadRenderArgs } from \"../../../core/tools/renderers/read.ts\";\nimport { formatPathRelativeToCwdOrAbsolute } from \"../../../utils/paths.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\n/** One exploration call as the collapsed group shows it: an action plus a label, never output. */\nexport type ExplorationCall = {\n\treadonly action: \"Read\" | \"Search\" | \"List\";\n\t/** Read: file basename. Search: the pattern plus ` in <dir>` for an explicit path. List: directory basename. */\n\treadonly label: string;\n\treadonly pending: boolean;\n\treadonly failed: boolean;\n};\n\nconst BUILT_IN_RENDERERS = { read: readRenderers, grep: grepRenderers, find: findRenderers, ls: lsRenderers };\n\nfunction stringArg(args: unknown, ...keys: string[]): string | undefined {\n\tif (args === null || typeof args !== \"object\") return undefined;\n\tfor (const key of keys) {\n\t\tconst value: unknown = Reflect.get(args, key);\n\t\tif (typeof value === \"string\" && value) return value;\n\t}\n\treturn undefined;\n}\n\nfunction isReadRenderArgs(args: unknown): args is ReadRenderArgs {\n\treturn args !== null && typeof args === \"object\";\n}\n\n/** A skill load or a memory recall is a semantic card, not file exploration; it keeps its own line. */\nfunction isSemanticRead(args: unknown, cwd: string): boolean {\n\tconst kind = getCompactReadClassification(isReadRenderArgs(args) ? args : undefined, cwd)?.kind;\n\treturn kind === \"skill\" || kind === \"memory\";\n}\n\n/**\n * Group only the built-in read/grep/find/ls presentation; custom renderers, semantic reads, and other\n * tools stay cards.\n */\nexport function explorationCall(component: ToolExecutionComponent): ExplorationCall | undefined {\n\tconst { identity, state, presentation } = component.presentationSnapshot;\n\tif (presentation !== \"classic\") return undefined;\n\tconst toolName = identity.toolName;\n\tif (toolName !== \"read\" && toolName !== \"grep\" && toolName !== \"find\" && toolName !== \"ls\") return undefined;\n\tconst expected = BUILT_IN_RENDERERS[toolName];\n\tconst actual = identity.toolDefinition;\n\tif (actual && (actual.renderCall !== expected.renderCall || actual.renderResult !== expected.renderResult)) {\n\t\treturn undefined;\n\t}\n\tconst pending = state.isPartial;\n\tconst failed = state.result?.isError ?? false;\n\tconst path = stringArg(state.args, \"file_path\", \"path\");\n\tif (toolName === \"read\") {\n\t\tif (isSemanticRead(state.args, identity.cwd)) return undefined;\n\t\treturn { action: \"Read\", label: path ? basename(path) : \"\", pending, failed };\n\t}\n\tif (toolName === \"grep\") {\n\t\tconst pattern = stringArg(state.args, \"pattern\") ?? \"\";\n\t\tconst dir = path ? formatPathRelativeToCwdOrAbsolute(resolveToCwd(path, identity.cwd), identity.cwd) : \"\";\n\t\treturn { action: \"Search\", label: dir ? `${pattern} in ${dir}` : pattern, pending, failed };\n\t}\n\treturn { action: \"List\", label: (path && basename(path)) || path || \".\", pending, failed };\n}\n"]}
|
|
@@ -10,10 +10,12 @@ export declare class ExplorationGroup extends Container {
|
|
|
10
10
|
readonly component: ToolExecutionComponent;
|
|
11
11
|
readonly call: ExplorationCall;
|
|
12
12
|
}[];
|
|
13
|
+
/** Rule paths injected into this group's calls; repeated paths count once. */
|
|
14
|
+
private rules;
|
|
13
15
|
private get expanded();
|
|
14
16
|
render(width: number): string[];
|
|
15
17
|
handleMouse(event: TuiMouseEvent): ReturnType<Container["handleMouse"]>;
|
|
16
18
|
/** References are replaced on each projection, never disposed by this view. */
|
|
17
|
-
setMembers(members: Component[], calls: ExplorationGroup["calls"]): void;
|
|
19
|
+
setMembers(members: Component[], calls: ExplorationGroup["calls"], rules?: readonly string[]): void;
|
|
18
20
|
}
|
|
19
21
|
//# sourceMappingURL=exploration-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploration-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,KAAK,aAAa,EAAmB,MAAM,wBAAwB,CAAC;AAGxG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA2BlE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;KAAE,EAAE,CAAM;
|
|
1
|
+
{"version":3,"file":"exploration-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,KAAK,aAAa,EAAmB,MAAM,wBAAwB,CAAC;AAGxG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA2BlE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;KAAE,EAAE,CAAM;IAC7F,8EAA8E;IAC9E,OAAO,CAAC,KAAK,CAAyB;IAEtC,OAAO,KAAK,QAAQ,GAEnB;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBvC;IAEQ,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAwB/E;IAED,+EAA+E;IAC/E,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,IAAI,CAItG;CACD"}
|
|
@@ -32,6 +32,8 @@ export class ExplorationGroup extends Container {
|
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.calls = [];
|
|
35
|
+
/** Rule paths injected into this group's calls; repeated paths count once. */
|
|
36
|
+
this.rules = [];
|
|
35
37
|
}
|
|
36
38
|
get expanded() {
|
|
37
39
|
return this.calls.some(({ component }) => component.presentationSnapshot.state.expanded);
|
|
@@ -48,6 +50,9 @@ export class ExplorationGroup extends Container {
|
|
|
48
50
|
if (this.expanded)
|
|
49
51
|
return [...lines, ...super.render(width)];
|
|
50
52
|
const body = bodyLines(this.calls.map(({ call }) => call));
|
|
53
|
+
const ruleCount = new Set(this.rules).size;
|
|
54
|
+
if (ruleCount > 0)
|
|
55
|
+
body.push(`${theme.fg("accent", "Applied")} ${ruleCount} project ${ruleCount === 1 ? "rule" : "rules"}`);
|
|
51
56
|
const shown = body.length > MAX_BODY_LINES ? body.slice(0, MAX_BODY_LINES) : body;
|
|
52
57
|
if (body.length > shown.length)
|
|
53
58
|
shown.push(theme.fg("dim", `… +${body.length - shown.length} more`));
|
|
@@ -81,9 +86,10 @@ export class ExplorationGroup extends Container {
|
|
|
81
86
|
return undefined;
|
|
82
87
|
}
|
|
83
88
|
/** References are replaced on each projection, never disposed by this view. */
|
|
84
|
-
setMembers(members, calls) {
|
|
89
|
+
setMembers(members, calls, rules = []) {
|
|
85
90
|
this.children = members;
|
|
86
91
|
this.calls = calls;
|
|
92
|
+
this.rules = rules;
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
//# sourceMappingURL=exploration-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploration-group.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAsB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,mGAAmG;AACnG,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,SAAS,CAAC,KAAiC;IACnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,GAAI,CAAC;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;gBACvF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;gBAC/B,KAAK,EAAE,CAAC;YACT,CAAC;YACD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5F,SAAS;QACV,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAA/C;;QACC,UAAK,GAAqF,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"exploration-group.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAsB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,mGAAmG;AACnG,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,SAAS,CAAC,KAAiC;IACnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,GAAI,CAAC;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC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vB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAChC,CAAC;YACF,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAChC,KAAK,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK;oBAAE,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACzE,CAAC;YACD,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACP,SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;oBAChC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;oBAChC,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;iBACpB;aACD,CAAC;QACH,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC;YAChC,OAAO,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;QAClF,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,+EAA+E;IAC/E,UAAU,CAAC,OAAoB,EAAE,KAAgC,EAAE,KAAK,GAAsB,EAAE;QAC/F,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD","sourcesContent":["import { type Component, Container, type TuiMouseEvent, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { theme } from \"../theme/theme.ts\";\nimport { toolSpinnerGlyph } from \"../tool-progress.ts\";\nimport type { ExplorationCall } from \"./exploration-call.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\n/** Body lines past this many collapse into one `… +K more` line, as codex caps exploring cells. */\nconst MAX_BODY_LINES = 8;\nconst SPINNER_FRAME_MS = 80;\n\nfunction bodyLines(calls: readonly ExplorationCall[]): string[] {\n\tconst lines: string[] = [];\n\tfor (let index = 0; index < calls.length; ) {\n\t\tconst first = calls[index];\n\t\tindex++;\n\t\tif (first.action === \"Read\" && !first.failed) {\n\t\t\tconst names = [first.label];\n\t\t\twhile (index < calls.length && calls[index].action === \"Read\" && !calls[index].failed) {\n\t\t\t\tnames.push(calls[index].label);\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tconst unique = [...new Set(names.filter(Boolean))];\n\t\t\tlines.push(`${theme.fg(\"accent\", \"Read\")} ${unique.join(theme.fg(\"dim\", \", \"))}`.trimEnd());\n\t\t\tcontinue;\n\t\t}\n\t\tconst failed = first.failed ? theme.fg(\"error\", \" (failed)\") : \"\";\n\t\tlines.push(`${theme.fg(\"accent\", first.action)} ${first.label}`.trimEnd() + failed);\n\t}\n\treturn lines;\n}\n\n/**\n * Codex-style exploring cell over the original tool cards. It is a non-owning view: the transcript\n * owns and disposes the cards, and result routing keeps addressing them by tool call id.\n */\nexport class ExplorationGroup extends Container {\n\tcalls: { readonly component: ToolExecutionComponent; readonly call: ExplorationCall }[] = [];\n\t/** Rule paths injected into this group's calls; repeated paths count once. */\n\tprivate rules: readonly string[] = [];\n\n\tprivate get expanded(): boolean {\n\t\treturn this.calls.some(({ component }) => component.presentationSnapshot.state.expanded);\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst pending = this.calls.some(({ call }) => call.pending);\n\t\tconst failed = this.calls.filter(({ call }) => call.failed).length;\n\t\tconst marker = pending\n\t\t\t? theme.fg(\"accent\", toolSpinnerGlyph(Math.floor(Date.now() / SPINNER_FRAME_MS)))\n\t\t\t: theme.fg(\"dim\", \"•\");\n\t\tconst header =\n\t\t\t`${marker} ${theme.bold(pending ? \"Exploring\" : \"Explored\")}` +\n\t\t\t(failed ? theme.fg(\"error\", ` · ${failed} failed`) : \"\");\n\t\tconst lines = [\"\", truncateToWidth(header, width)];\n\t\tif (this.expanded) return [...lines, ...super.render(width)];\n\t\tconst body = bodyLines(this.calls.map(({ call }) => call));\n\t\tconst ruleCount = new Set(this.rules).size;\n\t\tif (ruleCount > 0)\n\t\t\tbody.push(`${theme.fg(\"accent\", \"Applied\")} ${ruleCount} project ${ruleCount === 1 ? \"rule\" : \"rules\"}`);\n\t\tconst shown = body.length > MAX_BODY_LINES ? body.slice(0, MAX_BODY_LINES) : body;\n\t\tif (body.length > shown.length) shown.push(theme.fg(\"dim\", `… +${body.length - shown.length} more`));\n\t\tfor (const [index, line] of shown.entries()) {\n\t\t\tlines.push(truncateToWidth(`${index === 0 ? theme.fg(\"dim\", \" └ \") : \" \"}${line}`, width));\n\t\t}\n\t\treturn lines;\n\t}\n\n\toverride handleMouse(event: TuiMouseEvent): ReturnType<Container[\"handleMouse\"]> {\n\t\tif (\n\t\t\t(event.type === \"press\" || event.type === \"click\") &&\n\t\t\tevent.button === \"left\" &&\n\t\t\t(event.y === 1 || !this.expanded)\n\t\t) {\n\t\t\tif (event.type === \"click\") {\n\t\t\t\tconst expanded = !this.expanded;\n\t\t\t\tfor (const { component } of this.calls) component.setExpanded(expanded);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\thandled: true,\n\t\t\t\ttarget: {\n\t\t\t\t\tcomponent: this,\n\t\t\t\t\toriginX: event.screenX - event.x,\n\t\t\t\t\toriginY: event.screenY - event.y,\n\t\t\t\t\twidth: event.width,\n\t\t\t\t\theight: event.height,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (this.expanded && event.y >= 2)\n\t\t\treturn super.handleMouse({ ...event, y: event.y - 2, height: event.height - 2 });\n\t\treturn undefined;\n\t}\n\n\t/** References are replaced on each projection, never disposed by this view. */\n\tsetMembers(members: Component[], calls: ExplorationGroup[\"calls\"], rules: readonly string[] = []): void {\n\t\tthis.children = members;\n\t\tthis.calls = calls;\n\t\tthis.rules = rules;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CustomEntryComponent } from "./custom-entry.ts";
|
|
2
|
+
import type { ExplorationGroup } from "./exploration-group.ts";
|
|
3
|
+
/** Undefined for stream rules, legacy notices without a tool call id, and calls outside the group. */
|
|
4
|
+
export declare function projectRulesOfCall(card: CustomEntryComponent, calls: ExplorationGroup["calls"]): readonly string[] | undefined;
|
|
5
|
+
//# sourceMappingURL=exploration-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exploration-rules.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-rules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,sGAAsG;AACtG,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAC9B,SAAS,MAAM,EAAE,GAAG,SAAS,CAS/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { parseRuleActivationDetails, RULE_ACTIVATION_ENTRY_TYPE, } from "../../../core/extensions/builtin/rule-activation/types.js";
|
|
2
|
+
/** Undefined for stream rules, legacy notices without a tool call id, and calls outside the group. */
|
|
3
|
+
export function projectRulesOfCall(card, calls) {
|
|
4
|
+
const entry = card.customEntry;
|
|
5
|
+
if (entry.customType !== RULE_ACTIVATION_ENTRY_TYPE)
|
|
6
|
+
return undefined;
|
|
7
|
+
const details = parseRuleActivationDetails(entry.data);
|
|
8
|
+
if (details?.kind !== "project-rules" || details.toolCallId === undefined)
|
|
9
|
+
return undefined;
|
|
10
|
+
const toolCallId = details.toolCallId;
|
|
11
|
+
return calls.some(({ component }) => component.presentationSnapshot.identity.toolCallId === toolCallId)
|
|
12
|
+
? details.rules
|
|
13
|
+
: undefined;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=exploration-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exploration-rules.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,2DAA2D,CAAC;AAInE,sGAAsG;AACtG,MAAM,UAAU,kBAAkB,CACjC,IAA0B,EAC1B,KAAgC;IAEhC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC;IAC/B,IAAI,KAAK,CAAC,UAAU,KAAK,0BAA0B;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,OAAO,GAAG,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,OAAO,EAAE,IAAI,KAAK,eAAe,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5F,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,QAAQ,CAAC,UAAU,KAAK,UAAU,CAAC;QACtG,CAAC,CAAC,OAAO,CAAC,KAAK;QACf,CAAC,CAAC,SAAS,CAAC;AACd,CAAC","sourcesContent":["import {\n\tparseRuleActivationDetails,\n\tRULE_ACTIVATION_ENTRY_TYPE,\n} from \"../../../core/extensions/builtin/rule-activation/types.ts\";\nimport type { CustomEntryComponent } from \"./custom-entry.ts\";\nimport type { ExplorationGroup } from \"./exploration-group.ts\";\n\n/** Undefined for stream rules, legacy notices without a tool call id, and calls outside the group. */\nexport function projectRulesOfCall(\n\tcard: CustomEntryComponent,\n\tcalls: ExplorationGroup[\"calls\"],\n): readonly string[] | undefined {\n\tconst entry = card.customEntry;\n\tif (entry.customType !== RULE_ACTIVATION_ENTRY_TYPE) return undefined;\n\tconst details = parseRuleActivationDetails(entry.data);\n\tif (details?.kind !== \"project-rules\" || details.toolCallId === undefined) return undefined;\n\tconst toolCallId = details.toolCallId;\n\treturn calls.some(({ component }) => component.presentationSnapshot.identity.toolCallId === toolCallId)\n\t\t? details.rules\n\t\t: undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploration-transcript-container.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-transcript-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"exploration-transcript-container.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-transcript-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvF,OAAO,EAEN,KAAK,4BAA4B,EACjC,MAAM,uCAAuC,CAAC;AAG/C;;;;GAIG;AACH,qBAAa,8BAA+B,SAAQ,SAAS;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,MAAM,CAA2D;IAEzE,YAAY,OAAO,EAAE,4BAA4B,EAGhD;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiCvC;IAEQ,WAAW,CAAC,KAAK,EAAE,aAAa,2EAExC;IAEQ,KAAK,IAAI,IAAI,CAIrB;IAEQ,SAAS,IAAI,IAAI,CAIzB;IAEQ,OAAO,IAAI,IAAI,CAIvB;CACD"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Container } from "@earendil-works/pi-tui";
|
|
2
2
|
import { AssistantMessageComponent } from "./assistant-message.js";
|
|
3
|
+
import { CustomEntryComponent } from "./custom-entry.js";
|
|
3
4
|
import { explorationCall } from "./exploration-call.js";
|
|
4
5
|
import { ExplorationGroup } from "./exploration-group.js";
|
|
6
|
+
import { projectRulesOfCall } from "./exploration-rules.js";
|
|
5
7
|
import { ProgressiveTranscriptContainer, } from "./progressive-transcript-container.js";
|
|
6
8
|
import { ToolExecutionComponent } from "./tool-execution.js";
|
|
7
9
|
/**
|
|
@@ -20,6 +22,7 @@ export class ExplorationTranscriptContainer extends Container {
|
|
|
20
22
|
let group;
|
|
21
23
|
let members = [];
|
|
22
24
|
let calls = [];
|
|
25
|
+
let rules = [];
|
|
23
26
|
for (const child of this.children) {
|
|
24
27
|
const call = child instanceof ToolExecutionComponent ? explorationCall(child) : undefined;
|
|
25
28
|
if (child instanceof ToolExecutionComponent && call) {
|
|
@@ -29,14 +32,20 @@ export class ExplorationTranscriptContainer extends Container {
|
|
|
29
32
|
projected.push(group);
|
|
30
33
|
members = [];
|
|
31
34
|
calls = [];
|
|
35
|
+
rules = [];
|
|
32
36
|
}
|
|
33
37
|
members.push(child);
|
|
34
38
|
calls.push({ component: child, call });
|
|
35
|
-
group.setMembers(members, calls);
|
|
39
|
+
group.setMembers(members, calls, rules);
|
|
36
40
|
}
|
|
37
41
|
else if (group && child instanceof AssistantMessageComponent && child.isExplorationDetail) {
|
|
38
42
|
members.push(child);
|
|
39
43
|
}
|
|
44
|
+
else if (group && child instanceof CustomEntryComponent && projectRulesOfCall(child, calls)) {
|
|
45
|
+
members.push(child);
|
|
46
|
+
rules = [...rules, ...(projectRulesOfCall(child, calls) ?? [])];
|
|
47
|
+
group.setMembers(members, calls, rules);
|
|
48
|
+
}
|
|
40
49
|
else {
|
|
41
50
|
group = undefined;
|
|
42
51
|
projected.push(child);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploration-transcript-container.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-transcript-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAA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,EAAE,CAAC;gBACZ,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACpB,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"exploration-transcript-container.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/exploration-transcript-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAsB,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACN,8BAA8B,GAE9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,8BAA+B,SAAQ,SAAS;IAI5D,YAAY,OAAqC;QAChD,KAAK,EAAE,CAAC;QAHD,WAAM,GAAG,IAAI,OAAO,EAA4C,CAAC;QAIxE,IAAI,CAAC,OAAO,GAAG,IAAI,8BAA8B,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,MAAM,SAAS,GAAgB,EAAE,CAAC;QAClC,IAAI,KAAmC,CAAC;QACxC,IAAI,OAAO,GAAgB,EAAE,CAAC;QAC9B,IAAI,KAAK,GAA8B,EAAE,CAAC;QAC1C,IAAI,KAAK,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE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,KAAK,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACP,KAAK,GAAG,SAAS,CAAC;gBAClB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACF,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEQ,WAAW,CAAC,KAAoB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAEQ,KAAK;QACb,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEQ,SAAS;QACjB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAEQ,OAAO;QACf,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;CACD","sourcesContent":["import { type Component, Container, type TuiMouseEvent } from \"@earendil-works/pi-tui\";\nimport { AssistantMessageComponent } from \"./assistant-message.ts\";\nimport { CustomEntryComponent } from \"./custom-entry.ts\";\nimport { explorationCall } from \"./exploration-call.ts\";\nimport { ExplorationGroup } from \"./exploration-group.ts\";\nimport { projectRulesOfCall } from \"./exploration-rules.ts\";\nimport {\n\tProgressiveTranscriptContainer,\n\ttype ProgressiveTranscriptOptions,\n} from \"./progressive-transcript-container.ts\";\nimport { ToolExecutionComponent } from \"./tool-execution.ts\";\n\n/**\n * Original children remain the lifecycle/ID/anchor model. A non-owning projection groups their\n * presentation before progressive hydration, so compact frames never render hidden tool results.\n * Re-projecting also handles partial args, late text, and visibility changes without moving cards.\n */\nexport class ExplorationTranscriptContainer extends Container {\n\tprivate readonly display: ProgressiveTranscriptContainer;\n\tprivate groups = new WeakMap<ToolExecutionComponent, ExplorationGroup>();\n\n\tconstructor(options: ProgressiveTranscriptOptions) {\n\t\tsuper();\n\t\tthis.display = new ProgressiveTranscriptContainer(options);\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst projected: Component[] = [];\n\t\tlet group: ExplorationGroup | undefined;\n\t\tlet members: Component[] = [];\n\t\tlet calls: ExplorationGroup[\"calls\"] = [];\n\t\tlet rules: string[] = [];\n\t\tfor (const child of this.children) {\n\t\t\tconst call = child instanceof ToolExecutionComponent ? explorationCall(child) : undefined;\n\t\t\tif (child instanceof ToolExecutionComponent && call) {\n\t\t\t\tif (!group) {\n\t\t\t\t\tgroup = this.groups.get(child) ?? new ExplorationGroup();\n\t\t\t\t\tthis.groups.set(child, group);\n\t\t\t\t\tprojected.push(group);\n\t\t\t\t\tmembers = [];\n\t\t\t\t\tcalls = [];\n\t\t\t\t\trules = [];\n\t\t\t\t}\n\t\t\t\tmembers.push(child);\n\t\t\t\tcalls.push({ component: child, call });\n\t\t\t\tgroup.setMembers(members, calls, rules);\n\t\t\t} else if (group && child instanceof AssistantMessageComponent && child.isExplorationDetail) {\n\t\t\t\tmembers.push(child);\n\t\t\t} else if (group && child instanceof CustomEntryComponent && projectRulesOfCall(child, calls)) {\n\t\t\t\tmembers.push(child);\n\t\t\t\trules = [...rules, ...(projectRulesOfCall(child, calls) ?? [])];\n\t\t\t\tgroup.setMembers(members, calls, rules);\n\t\t\t} else {\n\t\t\t\tgroup = undefined;\n\t\t\t\tprojected.push(child);\n\t\t\t}\n\t\t}\n\t\tthis.display.children = projected;\n\t\treturn this.display.render(width);\n\t}\n\n\toverride handleMouse(event: TuiMouseEvent) {\n\t\treturn this.display.handleMouse(event);\n\t}\n\n\toverride clear(): void {\n\t\tthis.display.detachAll();\n\t\tthis.groups = new WeakMap();\n\t\tsuper.clear();\n\t}\n\n\toverride detachAll(): void {\n\t\tthis.display.detachAll();\n\t\tthis.groups = new WeakMap();\n\t\tsuper.detachAll();\n\t}\n\n\toverride dispose(): void {\n\t\tthis.display.detachAll();\n\t\tthis.display.dispose();\n\t\tsuper.dispose();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAWrE,OAAO,KAAK,EACX,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,MAAM,CAAC;AAuB3D,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAM;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC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,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtC;IAEQ,UAAU,IAAI,IAAI,CAK1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAwBvC;IAED,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,yBAAyB;IA6BjC,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,qBAAqB;CAK7B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Container, Spacer } from "@earendil-works/pi-tui";
|
|
2
|
+
import { isModelOnlyText } from "../../../core/tools/model-only-text.js";
|
|
2
3
|
import { getTextOutput as getRenderedTextOutput } from "../../../core/tools/render-utils.js";
|
|
3
4
|
import { GrokToolRow } from "../grok/tool-row.js";
|
|
4
5
|
import { theme } from "../theme/theme.js";
|
|
@@ -188,7 +189,9 @@ export class ToolExecutionComponent extends Container {
|
|
|
188
189
|
expanded: this.expanded,
|
|
189
190
|
showImages: this.showImages,
|
|
190
191
|
spinnerFrame: this.spinnerFrame,
|
|
191
|
-
result: this.result
|
|
192
|
+
result: this.result
|
|
193
|
+
? { ...this.result, content: this.result.content.filter((part) => !isModelOnlyText(part)) }
|
|
194
|
+
: undefined,
|
|
192
195
|
};
|
|
193
196
|
}
|
|
194
197
|
createRenderSignature() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAY,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAq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AAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,CAAC;CACD","sourcesContent":["import { Container, Spacer, type TUI } from \"@earendil-works/pi-tui\";\nimport { getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport { GrokToolRow } from \"../grok/tool-row.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { readToolProgress } from \"../tool-progress.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\nimport { createBoundedRenderSignature } from \"./render-signature.ts\";\nimport { hasCompletedTodoTasks, TODO_STRIKE_FRAME_INTERVAL_MS, TODO_STRIKE_TOTAL_FRAMES } from \"./todo-strike.ts\";\nimport { ToolExecutionImages } from \"./tool-execution-images.ts\";\nimport { ToolExecutionRenderer } from \"./tool-execution-renderer.ts\";\nimport type {\n\tToolExecutionIdentity,\n\tToolExecutionRenderState,\n\tToolExecutionResult,\n\tToolRenderers,\n} from \"./tool-execution-types.ts\";\n\nexport type { ToolRenderers } from \"./tool-execution-types.ts\";\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n}\n\n/** Visual shell chosen by interactive chrome; classic remains the default. */\nexport type ToolExecutionPresentation = \"classic\" | \"grok\";\n\nconst PENDING_RENDER_FRAME_INTERVAL_MS = 80;\nconst FALLBACK_PREVIEW_LINES = 10;\n\nfunction collapseFallbackResult(\n\tresult: ToolExecutionResult | undefined,\n\tshowImages: boolean,\n\texpanded: boolean,\n): ToolExecutionResult | undefined {\n\tif (!result || expanded) return result;\n\tconst output = getRenderedTextOutput(result, showImages);\n\tif (!output) return result;\n\tconst lines = output.split(\"\\n\");\n\tif (lines.length <= FALLBACK_PREVIEW_LINES) return result;\n\n\tconst remaining = lines.length - FALLBACK_PREVIEW_LINES;\n\tconst text =\n\t\tlines.slice(0, FALLBACK_PREVIEW_LINES).join(\"\\n\") +\n\t\t`${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\treturn { ...result, content: [{ type: \"text\", text }] };\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate readonly identity: ToolExecutionIdentity;\n\tprivate readonly ui: TUI;\n\tprivate readonly renderer: ToolExecutionRenderer | undefined;\n\tprivate readonly images: ToolExecutionImages | undefined;\n\tprivate readonly grokRow: GrokToolRow | undefined;\n\tprivate readonly presentation: ToolExecutionPresentation;\n\tprivate args: unknown;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate spinnerFrame?: number;\n\tprivate spinnerInterval?: NodeJS.Timeout;\n\tprivate todoStrikeInterval?: NodeJS.Timeout;\n\tprivate result?: ToolExecutionResult;\n\tprivate cachedLines?: string[];\n\tprivate cachedSignature?: string;\n\tprivate cachedWidth?: number;\n\tprivate lastDisplaySignature?: string;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: unknown,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t\tpresentation: ToolExecutionPresentation = \"classic\",\n\t) {\n\t\tsuper();\n\t\tthis.identity = { toolName, toolCallId, cwd, toolDefinition };\n\t\tthis.args = args;\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.ui = ui;\n\t\tthis.presentation = presentation;\n\t\tconst initialState = this.createRenderState();\n\t\tif (this.presentation === \"grok\") {\n\t\t\tthis.grokRow = new GrokToolRow({\n\t\t\t\ttoolName: this.identity.toolName,\n\t\t\t\tisPartial: initialState.isPartial,\n\t\t\t\tresult: initialState.result,\n\t\t\t});\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(this.grokRow);\n\t\t} else {\n\t\t\tthis.renderer = new ToolExecutionRenderer(\n\t\t\t\tthis.identity,\n\t\t\t\tinitialState,\n\t\t\t\t() => {\n\t\t\t\t\tthis.invalidate();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t// Left-clicking a finished tool card toggles it like the expand keybinding does.\n\t\t\t\t() => {\n\t\t\t\t\tthis.setExpanded(!this.expanded);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.images = new ToolExecutionImages(() => {\n\t\t\t\tthis.invalidateRenderCache();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(this.renderer);\n\t\t\tthis.addChild(this.images);\n\t\t}\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t}\n\n\tupdateArgs(args: unknown): void {\n\t\tthis.args = args;\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t}\n\n\t/** Read-only presentation state; execution routing continues to own this original card. */\n\tget presentationSnapshot() {\n\t\treturn { identity: this.identity, state: this.createRenderState(), presentation: this.presentation };\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(result: ToolExecutionResult, isPartial = false): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tif (!isPartial) this.argsComplete = true;\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateTodoStrikeAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.images?.updateResult(result);\n\t\tthis.invalidateRenderCache();\n\t}\n\n\tstopAnimation(): void {\n\t\tthis.stopSpinnerAnimation();\n\t\tthis.stopTodoStrikeAnimation();\n\t}\n\n\toverride dispose(): void {\n\t\tthis.stopAnimation();\n\t\tsuper.dispose();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tthis.invalidateRenderCache();\n\t\tsuper.invalidate();\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.presentation === \"grok\") return super.render(width);\n\n\t\tconst signature = this.createRenderSignature();\n\t\tif (this.cachedLines && this.cachedWidth === width && this.cachedSignature === signature) {\n\t\t\treturn [...this.cachedLines];\n\t\t}\n\n\t\tlet lines: string[];\n\t\tconst renderer = this.renderer!;\n\t\tconst images = this.images!;\n\t\tif (renderer.hasRendererDefinition && renderer.renderShell === \"self\") {\n\t\t\tconst contentLines = renderer.render(width);\n\t\t\tconst imageLines = images.render(width);\n\t\t\tif (contentLines.length === 0 && imageLines.length === 0) return [];\n\t\t\tlines = contentLines.length > 0 ? [\"\", ...contentLines, ...imageLines] : imageLines;\n\t\t} else {\n\t\t\tlines = super.render(width);\n\t\t}\n\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedSignature = signature;\n\t\tthis.cachedLines = [...lines];\n\t\treturn lines;\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst displaySignature = this.createRenderSignature();\n\t\tif (this.lastDisplaySignature === displaySignature) return;\n\t\tthis.lastDisplaySignature = displaySignature;\n\t\tthis.invalidateRenderCache();\n\t\tconst state = this.createRenderState();\n\t\tif (this.grokRow) {\n\t\t\tthis.grokRow.update({\n\t\t\t\ttoolName: this.identity.toolName,\n\t\t\t\tisPartial: state.isPartial,\n\t\t\t\tresult: state.result,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst renderer = this.renderer!;\n\t\tconst renderState =\n\t\t\trenderer.hasRendererDefinition && !renderer.hasResultRenderer\n\t\t\t\t? { ...state, result: collapseFallbackResult(state.result, state.showImages, state.expanded) }\n\t\t\t\t: state;\n\t\trenderer.update(renderState);\n\t\tthis.images!.updateOptions({\n\t\t\tshowImages: state.showImages,\n\t\t\tmaxWidthCells: this.imageWidthCells,\n\t\t\tshowRendererFallback: renderer.hasResultRenderer,\n\t\t});\n\t}\n\n\tprivate createRenderState(): ToolExecutionRenderState {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tspinnerFrame: this.spinnerFrame,\n\t\t\tresult: this.result,\n\t\t};\n\t}\n\n\tprivate createRenderSignature(): string {\n\t\treturn createBoundedRenderSignature({\n\t\t\t...this.createRenderState(),\n\t\t\timageWidthCells: this.imageWidthCells,\n\t\t\ttoolCallId: this.identity.toolCallId,\n\t\t\ttoolName: this.identity.toolName,\n\t\t});\n\t}\n\n\tprivate updateSpinnerAnimation(): void {\n\t\tconst isStreamingArgs = !this.argsComplete && [\"edit\", \"write\", \"apply_patch\"].includes(this.identity.toolName);\n\t\tconst isPartialTask = this.isPartial && this.identity.toolName === \"task\" && this.result !== undefined;\n\t\tconst isPartialProgress =\n\t\t\tthis.isPartial && this.result !== undefined && readToolProgress(this.result.details) !== undefined;\n\t\tif (isStreamingArgs || isPartialTask || isPartialProgress) this.startSpinnerAnimation();\n\t\telse this.stopSpinnerAnimation();\n\t}\n\n\tprivate updateTodoStrikeAnimation(): void {\n\t\tconst shouldAnimate =\n\t\t\tthis.identity.toolName === \"todo\" &&\n\t\t\tthis.executionStarted &&\n\t\t\t!this.isPartial &&\n\t\t\tthis.result !== undefined &&\n\t\t\t!this.result.isError &&\n\t\t\thasCompletedTodoTasks(this.result.details);\n\t\tif (!shouldAnimate) {\n\t\t\tthis.stopTodoStrikeAnimation();\n\t\t\treturn;\n\t\t}\n\t\tif (this.todoStrikeInterval) return;\n\n\t\tthis.spinnerFrame = 0;\n\t\tthis.todoStrikeInterval = setInterval(() => {\n\t\t\tconst next = (this.spinnerFrame ?? 0) + 1;\n\t\t\tif (next > TODO_STRIKE_TOTAL_FRAMES) {\n\t\t\t\tthis.stopTodoStrikeAnimation();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.spinnerFrame = next;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}, TODO_STRIKE_FRAME_INTERVAL_MS);\n\t\tthis.todoStrikeInterval.unref?.();\n\t}\n\n\tprivate stopTodoStrikeAnimation(): void {\n\t\tif (this.todoStrikeInterval) {\n\t\t\tclearInterval(this.todoStrikeInterval);\n\t\t\tthis.todoStrikeInterval = undefined;\n\t\t}\n\t\tif (!this.spinnerInterval && this.spinnerFrame !== undefined) {\n\t\t\tthis.spinnerFrame = undefined;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}\n\t}\n\n\tprivate startSpinnerAnimation(): void {\n\t\tif (this.spinnerInterval) return;\n\t\tthis.spinnerInterval = setInterval(() => {\n\t\t\tthis.spinnerFrame = ((this.spinnerFrame ?? -1) + 1) % 10;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}, PENDING_RENDER_FRAME_INTERVAL_MS);\n\t\tthis.spinnerInterval.unref?.();\n\t}\n\n\tprivate stopSpinnerAnimation(): void {\n\t\tif (!this.spinnerInterval) return;\n\t\tclearInterval(this.spinnerInterval);\n\t\tthis.spinnerInterval = undefined;\n\t\tif (!this.todoStrikeInterval) this.spinnerFrame = undefined;\n\t\tthis.invalidateRenderCache();\n\t}\n\n\tprivate invalidateRenderCache(): void {\n\t\tthis.cachedLines = undefined;\n\t\tthis.cachedSignature = undefined;\n\t\tthis.cachedWidth = undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAY,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAkBrE,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAC5C,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,SAAS,sBAAsB,CAC9B,MAAuC,EACvC,UAAmB,EACnB,QAAiB;IAEjB,IAAI,CAAC,MAAM,IAAI,QAAQ;QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,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,CAAC,eAAe;YAAE,OAAO;QACjC,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;YACvC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACzD,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,EAAE,gCAAgC,CAAC,CAAC;QACrC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC;IAChC,CAAC;IAEO,oBAAoB;QAC3B,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE,OAAO;QAClC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAAE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC5D,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC9B,CAAC;IAEO,qBAAqB;QAC5B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,CAAC;CACD","sourcesContent":["import { Container, Spacer, type TUI } from \"@earendil-works/pi-tui\";\nimport { isModelOnlyText } from \"../../../core/tools/model-only-text.ts\";\nimport { getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport { GrokToolRow } from \"../grok/tool-row.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { readToolProgress } from \"../tool-progress.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\nimport { createBoundedRenderSignature } from \"./render-signature.ts\";\nimport { hasCompletedTodoTasks, TODO_STRIKE_FRAME_INTERVAL_MS, TODO_STRIKE_TOTAL_FRAMES } from \"./todo-strike.ts\";\nimport { ToolExecutionImages } from \"./tool-execution-images.ts\";\nimport { ToolExecutionRenderer } from \"./tool-execution-renderer.ts\";\nimport type {\n\tToolExecutionIdentity,\n\tToolExecutionRenderState,\n\tToolExecutionResult,\n\tToolRenderers,\n} from \"./tool-execution-types.ts\";\n\nexport type { ToolRenderers } from \"./tool-execution-types.ts\";\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n}\n\n/** Visual shell chosen by interactive chrome; classic remains the default. */\nexport type ToolExecutionPresentation = \"classic\" | \"grok\";\n\nconst PENDING_RENDER_FRAME_INTERVAL_MS = 80;\nconst FALLBACK_PREVIEW_LINES = 10;\n\nfunction collapseFallbackResult(\n\tresult: ToolExecutionResult | undefined,\n\tshowImages: boolean,\n\texpanded: boolean,\n): ToolExecutionResult | undefined {\n\tif (!result || expanded) return result;\n\tconst output = getRenderedTextOutput(result, showImages);\n\tif (!output) return result;\n\tconst lines = output.split(\"\\n\");\n\tif (lines.length <= FALLBACK_PREVIEW_LINES) return result;\n\n\tconst remaining = lines.length - FALLBACK_PREVIEW_LINES;\n\tconst text =\n\t\tlines.slice(0, FALLBACK_PREVIEW_LINES).join(\"\\n\") +\n\t\t`${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\treturn { ...result, content: [{ type: \"text\", text }] };\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate readonly identity: ToolExecutionIdentity;\n\tprivate readonly ui: TUI;\n\tprivate readonly renderer: ToolExecutionRenderer | undefined;\n\tprivate readonly images: ToolExecutionImages | undefined;\n\tprivate readonly grokRow: GrokToolRow | undefined;\n\tprivate readonly presentation: ToolExecutionPresentation;\n\tprivate args: unknown;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate spinnerFrame?: number;\n\tprivate spinnerInterval?: NodeJS.Timeout;\n\tprivate todoStrikeInterval?: NodeJS.Timeout;\n\tprivate result?: ToolExecutionResult;\n\tprivate cachedLines?: string[];\n\tprivate cachedSignature?: string;\n\tprivate cachedWidth?: number;\n\tprivate lastDisplaySignature?: string;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: unknown,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t\tpresentation: ToolExecutionPresentation = \"classic\",\n\t) {\n\t\tsuper();\n\t\tthis.identity = { toolName, toolCallId, cwd, toolDefinition };\n\t\tthis.args = args;\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.ui = ui;\n\t\tthis.presentation = presentation;\n\t\tconst initialState = this.createRenderState();\n\t\tif (this.presentation === \"grok\") {\n\t\t\tthis.grokRow = new GrokToolRow({\n\t\t\t\ttoolName: this.identity.toolName,\n\t\t\t\tisPartial: initialState.isPartial,\n\t\t\t\tresult: initialState.result,\n\t\t\t});\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(this.grokRow);\n\t\t} else {\n\t\t\tthis.renderer = new ToolExecutionRenderer(\n\t\t\t\tthis.identity,\n\t\t\t\tinitialState,\n\t\t\t\t() => {\n\t\t\t\t\tthis.invalidate();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t// Left-clicking a finished tool card toggles it like the expand keybinding does.\n\t\t\t\t() => {\n\t\t\t\t\tthis.setExpanded(!this.expanded);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.images = new ToolExecutionImages(() => {\n\t\t\t\tthis.invalidateRenderCache();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(this.renderer);\n\t\t\tthis.addChild(this.images);\n\t\t}\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t}\n\n\tupdateArgs(args: unknown): void {\n\t\tthis.args = args;\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t}\n\n\t/** Read-only presentation state; execution routing continues to own this original card. */\n\tget presentationSnapshot() {\n\t\treturn { identity: this.identity, state: this.createRenderState(), presentation: this.presentation };\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(result: ToolExecutionResult, isPartial = false): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tif (!isPartial) this.argsComplete = true;\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateSpinnerAnimation();\n\t\tthis.updateTodoStrikeAnimation();\n\t\tthis.updateDisplay();\n\t\tthis.images?.updateResult(result);\n\t\tthis.invalidateRenderCache();\n\t}\n\n\tstopAnimation(): void {\n\t\tthis.stopSpinnerAnimation();\n\t\tthis.stopTodoStrikeAnimation();\n\t}\n\n\toverride dispose(): void {\n\t\tthis.stopAnimation();\n\t\tsuper.dispose();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tthis.invalidateRenderCache();\n\t\tsuper.invalidate();\n\t\tthis.lastDisplaySignature = undefined;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.presentation === \"grok\") return super.render(width);\n\n\t\tconst signature = this.createRenderSignature();\n\t\tif (this.cachedLines && this.cachedWidth === width && this.cachedSignature === signature) {\n\t\t\treturn [...this.cachedLines];\n\t\t}\n\n\t\tlet lines: string[];\n\t\tconst renderer = this.renderer!;\n\t\tconst images = this.images!;\n\t\tif (renderer.hasRendererDefinition && renderer.renderShell === \"self\") {\n\t\t\tconst contentLines = renderer.render(width);\n\t\t\tconst imageLines = images.render(width);\n\t\t\tif (contentLines.length === 0 && imageLines.length === 0) return [];\n\t\t\tlines = contentLines.length > 0 ? [\"\", ...contentLines, ...imageLines] : imageLines;\n\t\t} else {\n\t\t\tlines = super.render(width);\n\t\t}\n\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedSignature = signature;\n\t\tthis.cachedLines = [...lines];\n\t\treturn lines;\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst displaySignature = this.createRenderSignature();\n\t\tif (this.lastDisplaySignature === displaySignature) return;\n\t\tthis.lastDisplaySignature = displaySignature;\n\t\tthis.invalidateRenderCache();\n\t\tconst state = this.createRenderState();\n\t\tif (this.grokRow) {\n\t\t\tthis.grokRow.update({\n\t\t\t\ttoolName: this.identity.toolName,\n\t\t\t\tisPartial: state.isPartial,\n\t\t\t\tresult: state.result,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst renderer = this.renderer!;\n\t\tconst renderState =\n\t\t\trenderer.hasRendererDefinition && !renderer.hasResultRenderer\n\t\t\t\t? { ...state, result: collapseFallbackResult(state.result, state.showImages, state.expanded) }\n\t\t\t\t: state;\n\t\trenderer.update(renderState);\n\t\tthis.images!.updateOptions({\n\t\t\tshowImages: state.showImages,\n\t\t\tmaxWidthCells: this.imageWidthCells,\n\t\t\tshowRendererFallback: renderer.hasResultRenderer,\n\t\t});\n\t}\n\n\tprivate createRenderState(): ToolExecutionRenderState {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tspinnerFrame: this.spinnerFrame,\n\t\t\tresult: this.result\n\t\t\t\t? { ...this.result, content: this.result.content.filter((part) => !isModelOnlyText(part)) }\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\n\tprivate createRenderSignature(): string {\n\t\treturn createBoundedRenderSignature({\n\t\t\t...this.createRenderState(),\n\t\t\timageWidthCells: this.imageWidthCells,\n\t\t\ttoolCallId: this.identity.toolCallId,\n\t\t\ttoolName: this.identity.toolName,\n\t\t});\n\t}\n\n\tprivate updateSpinnerAnimation(): void {\n\t\tconst isStreamingArgs = !this.argsComplete && [\"edit\", \"write\", \"apply_patch\"].includes(this.identity.toolName);\n\t\tconst isPartialTask = this.isPartial && this.identity.toolName === \"task\" && this.result !== undefined;\n\t\tconst isPartialProgress =\n\t\t\tthis.isPartial && this.result !== undefined && readToolProgress(this.result.details) !== undefined;\n\t\tif (isStreamingArgs || isPartialTask || isPartialProgress) this.startSpinnerAnimation();\n\t\telse this.stopSpinnerAnimation();\n\t}\n\n\tprivate updateTodoStrikeAnimation(): void {\n\t\tconst shouldAnimate =\n\t\t\tthis.identity.toolName === \"todo\" &&\n\t\t\tthis.executionStarted &&\n\t\t\t!this.isPartial &&\n\t\t\tthis.result !== undefined &&\n\t\t\t!this.result.isError &&\n\t\t\thasCompletedTodoTasks(this.result.details);\n\t\tif (!shouldAnimate) {\n\t\t\tthis.stopTodoStrikeAnimation();\n\t\t\treturn;\n\t\t}\n\t\tif (this.todoStrikeInterval) return;\n\n\t\tthis.spinnerFrame = 0;\n\t\tthis.todoStrikeInterval = setInterval(() => {\n\t\t\tconst next = (this.spinnerFrame ?? 0) + 1;\n\t\t\tif (next > TODO_STRIKE_TOTAL_FRAMES) {\n\t\t\t\tthis.stopTodoStrikeAnimation();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.spinnerFrame = next;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}, TODO_STRIKE_FRAME_INTERVAL_MS);\n\t\tthis.todoStrikeInterval.unref?.();\n\t}\n\n\tprivate stopTodoStrikeAnimation(): void {\n\t\tif (this.todoStrikeInterval) {\n\t\t\tclearInterval(this.todoStrikeInterval);\n\t\t\tthis.todoStrikeInterval = undefined;\n\t\t}\n\t\tif (!this.spinnerInterval && this.spinnerFrame !== undefined) {\n\t\t\tthis.spinnerFrame = undefined;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}\n\t}\n\n\tprivate startSpinnerAnimation(): void {\n\t\tif (this.spinnerInterval) return;\n\t\tthis.spinnerInterval = setInterval(() => {\n\t\t\tthis.spinnerFrame = ((this.spinnerFrame ?? -1) + 1) % 10;\n\t\t\tthis.invalidateRenderCache();\n\t\t\tthis.updateDisplay();\n\t\t\tthis.ui.requestRender();\n\t\t}, PENDING_RENDER_FRAME_INTERVAL_MS);\n\t\tthis.spinnerInterval.unref?.();\n\t}\n\n\tprivate stopSpinnerAnimation(): void {\n\t\tif (!this.spinnerInterval) return;\n\t\tclearInterval(this.spinnerInterval);\n\t\tthis.spinnerInterval = undefined;\n\t\tif (!this.todoStrikeInterval) this.spinnerFrame = undefined;\n\t\tthis.invalidateRenderCache();\n\t}\n\n\tprivate invalidateRenderCache(): void {\n\t\tthis.cachedLines = undefined;\n\t\tthis.cachedSignature = undefined;\n\t\tthis.cachedWidth = undefined;\n\t}\n}\n"]}
|
|
@@ -12,6 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
### Removed
|
|
14
14
|
|
|
15
|
+
## [2026.9.23-4] - 2026-09-23
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Eval cards no longer display truncation or full-output artifact footer warnings. Model-facing eval text and grouping are unchanged; content explicitly addressed only to the model is omitted from the text fallback. ([#2041](https://github.com/code-yeongyu/senpi/issues/2041))
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
|
|
15
29
|
## [2026.9.23-3] - 2026-09-23
|
|
16
30
|
|
|
17
31
|
### Breaking Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.9.23-
|
|
3
|
+
"version": "2026.9.23-4",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
6
6
|
"type": "module",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/parser": "8.0.4",
|
|
34
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.23-
|
|
34
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.23-4",
|
|
35
35
|
"typebox": "1.3.34"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@code-yeongyu/senpi": "2026.9.23-
|
|
38
|
+
"@code-yeongyu/senpi": "2026.9.23-4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@code-yeongyu/senpi": "2026.9.23-
|
|
41
|
+
"@code-yeongyu/senpi": "2026.9.23-4"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"senpi",
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type ToolRenderResultOptions,
|
|
10
10
|
truncateToVisualLines,
|
|
11
11
|
} from "@code-yeongyu/senpi";
|
|
12
|
-
import {
|
|
12
|
+
import type { TruncationMeta } from "../output/output-meta.ts";
|
|
13
13
|
import { displayCode } from "./display-code.ts";
|
|
14
14
|
import { normalizeEvalSummary } from "./eval-request.ts";
|
|
15
15
|
import {
|
|
@@ -661,7 +661,7 @@ function renderCell(cell: EvalCellResult, environment: RenderEnvironment, badges
|
|
|
661
661
|
for (const line of codePreview.lines) {
|
|
662
662
|
appendLines(lines, renderPrefixed(line, environment, { prefix: "│ ", continuation: "│ ", color: "borderMuted" }));
|
|
663
663
|
}
|
|
664
|
-
const output =
|
|
664
|
+
const output = cell.output.trimEnd();
|
|
665
665
|
if (output.length > 0) {
|
|
666
666
|
appendLines(lines, renderPrefixed("output", environment, { prefix: "├─ ", continuation: "│ ", color: "dim" }));
|
|
667
667
|
const outputColor: ThemeColor = cell.status === "error" ? "error" : "toolOutput";
|
|
@@ -773,24 +773,13 @@ function renderDetailedLines(
|
|
|
773
773
|
context.environment.width,
|
|
774
774
|
),
|
|
775
775
|
);
|
|
776
|
-
if (details.notice !== undefined)
|
|
777
|
-
appendLines(
|
|
778
|
-
lines,
|
|
779
|
-
renderAllVisualLines(style(context.environment.theme, "dim", details.notice), context.environment.width),
|
|
780
|
-
);
|
|
781
|
-
const warning = formatTruncationWarning(details.meta) ?? (details.truncated ? "[eval output truncated]" : null);
|
|
782
|
-
if (warning !== null)
|
|
783
|
-
appendLines(
|
|
784
|
-
lines,
|
|
785
|
-
renderAllVisualLines(style(context.environment.theme, "warning", warning), context.environment.width),
|
|
786
|
-
);
|
|
787
776
|
return lines;
|
|
788
777
|
}
|
|
789
778
|
|
|
790
779
|
function textOutput(result: AgentToolResult<EvalResultDetails>, showImageFallback: boolean): string {
|
|
791
780
|
const lines: string[] = [];
|
|
792
781
|
for (const part of result.content) {
|
|
793
|
-
if (part.type === "text") lines.push(part.text);
|
|
782
|
+
if (part.type === "text" && part.audience !== "model") lines.push(part.text);
|
|
794
783
|
else if (showImageFallback && part.type === "image") {
|
|
795
784
|
lines.push(`[image: ${sanitizeTerminalLabel(part.mimeType)}]`);
|
|
796
785
|
}
|
|
@@ -1031,7 +1020,7 @@ export function renderEvalResult(
|
|
|
1031
1020
|
{ kind: "blank" },
|
|
1032
1021
|
];
|
|
1033
1022
|
const rawOutput = textOutput(result, context.showImages && imageProtocol === null);
|
|
1034
|
-
const output =
|
|
1023
|
+
const output = rawOutput.trimEnd();
|
|
1035
1024
|
const hasRenderedImage =
|
|
1036
1025
|
context.showImages && imageProtocol !== null && result.content.some((part) => part.type === "image");
|
|
1037
1026
|
if (output.length > 0) {
|
|
@@ -1088,10 +1077,6 @@ export function renderEvalResult(
|
|
|
1088
1077
|
const calls = toolCallRows(details);
|
|
1089
1078
|
const nestedCalls = nestedToolCallBlock(details, theme, context.cwd, expanded);
|
|
1090
1079
|
if (calls.length > 0) blocks.push({ kind: "blank" }, nestedCalls ?? { kind: "toolCalls", calls, expanded, theme });
|
|
1091
|
-
if (details?.notice !== undefined)
|
|
1092
|
-
blocks.push({ kind: "blank" }, { kind: "text", text: style(theme, "dim", details.notice) });
|
|
1093
|
-
const warning = formatTruncationWarning(details?.meta) ?? (details?.truncated ? "[eval output truncated]" : null);
|
|
1094
|
-
if (warning !== null) blocks.push({ kind: "blank" }, { kind: "text", text: style(theme, "warning", warning) });
|
|
1095
1080
|
component.setBlocks(blocks);
|
|
1096
1081
|
return component;
|
|
1097
1082
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-agent-core",
|
|
3
|
-
"version": "2026.9.23-
|
|
3
|
+
"version": "2026.9.23-4",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@earendil-works/chord": "0.85.1",
|
|
60
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.23-
|
|
61
|
-
"@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.9.23-
|
|
60
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.23-4",
|
|
61
|
+
"@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.9.23-4",
|
|
62
62
|
"diff": "9.0.0",
|
|
63
63
|
"ignore": "7.0.9",
|
|
64
64
|
"typebox": "1.3.34",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-messages.d.ts","sourceRoot":"","sources":["../../src/api/pi-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAMhB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACvD,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC7F,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,eAAe,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACjD,KAAK,oBAAoB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAE3D,+EAA+E;AAC/E,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MA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AO,MAAM,YAAY,EAAE,cAAc,CAAC,aAAa,EAAE,mBAAmB,CAY3E,CAAC"}
|
|
@@ -251,7 +251,23 @@ export const stream = (model, context, options) => {
|
|
|
251
251
|
}
|
|
252
252
|
let payload = {
|
|
253
253
|
model: model.id,
|
|
254
|
-
context
|
|
254
|
+
context: {
|
|
255
|
+
...context,
|
|
256
|
+
messages: context.messages.map((message) => message.role === "toolResult"
|
|
257
|
+
? {
|
|
258
|
+
...message,
|
|
259
|
+
content: message.content.map((part) => part.type === "text"
|
|
260
|
+
? {
|
|
261
|
+
type: part.type,
|
|
262
|
+
text: part.text,
|
|
263
|
+
...(part.textSignature === undefined
|
|
264
|
+
? {}
|
|
265
|
+
: { textSignature: part.textSignature }),
|
|
266
|
+
}
|
|
267
|
+
: part),
|
|
268
|
+
}
|
|
269
|
+
: message),
|
|
270
|
+
},
|
|
255
271
|
options: {
|
|
256
272
|
temperature: options?.temperature,
|
|
257
273
|
maxTokens: options?.maxTokens,
|