@herbertgao/pi-extensions 2026.11.13 → 2026.11.15
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 +22 -0
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +5 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +9 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +26 -21
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/table-copy.ts +753 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +11 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +6 -2
- package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +1 -1
- package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +41 -15
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +16 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +54 -22
- package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +114 -35
- package/node_modules/@herbertgao/pi-subagents/package.json +9 -4
- package/node_modules/@herbertgao/pi-subagents/skills/workflow-authoring/SKILL.md +147 -0
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +48 -32
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +34 -13
- package/node_modules/@herbertgao/pi-subagents/src/agent-types.ts +88 -0
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +16 -6
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +114 -98
- package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +6 -2
- package/node_modules/@herbertgao/pi-subagents/src/mention.ts +5 -7
- package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +18 -2
- package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +25 -3
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +26 -0
- package/node_modules/@herbertgao/pi-subagents/src/structured-output.ts +13 -5
- package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +55 -8
- package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-card-redraw.ts +86 -0
- package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-card.ts +5 -5
- package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-dialog.ts +478 -115
- package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-menu.ts +77 -6
- package/node_modules/@herbertgao/pi-subagents/src/workflow/agent-detail.ts +148 -0
- package/node_modules/@herbertgao/pi-subagents/src/workflow/host.ts +88 -14
- package/node_modules/@herbertgao/pi-subagents/src/workflow/journal.ts +8 -0
- package/node_modules/@herbertgao/pi-subagents/src/workflow/json-schema.ts +507 -57
- package/node_modules/@herbertgao/pi-subagents/src/workflow/progress.ts +41 -11
- package/node_modules/@herbertgao/pi-subagents/src/workflow/runtime.ts +106 -34
- package/node_modules/@herbertgao/pi-subagents/src/workflow/task.ts +43 -5
- package/node_modules/@herbertgao/pi-subagents/src/workflow/tool-description.ts +93 -153
- package/node_modules/@herbertgao/pi-subagents/src/workflow/worker-source.ts +283 -71
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +288 -177
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +7 -7
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +20 -0
- package/node_modules/pi-commandcode-provider/README.md +1 -1
- package/node_modules/pi-commandcode-provider/index.ts +2 -1
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +9 -2
- package/node_modules/pi-commandcode-provider/src/pricing.ts +5 -1
- package/node_modules/pi-commandcode-provider/src/responses-compat.ts +24 -1
- package/node_modules/pi-commandcode-provider/src/responses-stream.ts +99 -6
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +132 -0
- package/node_modules/pi-lens/README.md +2 -0
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/node_modules/pi-lens/dist/{chunk-LGH2HHZG.js → chunk-25CAONWT.js} +36 -25
- package/node_modules/pi-lens/dist/{chunk-ZQSSO7LO.js → chunk-2DWNYVUN.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-YCR6ZYTE.js → chunk-2RQREVGO.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VWEBZ2JV.js → chunk-2XALJI2K.js} +40 -40
- package/node_modules/pi-lens/dist/{chunk-PQXUZYTQ.js → chunk-2YQ5LI7R.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-VSQT6IHZ.js → chunk-35UJUF27.js} +18 -4
- package/node_modules/pi-lens/dist/{chunk-OLWGYBYT.js → chunk-3IWMNN2S.js} +17 -17
- package/node_modules/pi-lens/dist/chunk-3UTDLQWO.js +88 -0
- package/node_modules/pi-lens/dist/chunk-3Z7Z3B7V.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-UNP6Y4JV.js → chunk-4E4OCW3L.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-37IDWT6O.js → chunk-4GLSO2EM.js} +13 -11
- package/node_modules/pi-lens/dist/{chunk-QV3JPCMK.js → chunk-5HVDD7IA.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZRQMENT4.js → chunk-62PIU4TO.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3TSMQZG6.js → chunk-6MDWNZ7E.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-WLD6BGON.js → chunk-6MWX2J5H.js} +4 -0
- package/node_modules/pi-lens/dist/{chunk-SCU62JLX.js → chunk-6MZLS6CK.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-B42AIWPJ.js → chunk-7BWPQZHE.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-I3NZVAMN.js → chunk-7JMEPY6P.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-7DPXUPRF.js → chunk-7ORBRDFY.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6E5QLMWI.js → chunk-7WAQ3K26.js} +23 -23
- package/node_modules/pi-lens/dist/{chunk-2H5GHZKC.js → chunk-AB26NAHA.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-BBSDJTOV.js → chunk-AFSG6YUB.js} +13 -13
- package/node_modules/pi-lens/dist/{chunk-XDNWR7SG.js → chunk-ALTHJUZO.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-UN72ZAJ5.js → chunk-AOEVZXR6.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-HRLF35WL.js → chunk-ARTCVE6I.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-LQQNFCQJ.js → chunk-B2QO7GHY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-I2FYOZNW.js → chunk-BJGWP4UX.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-G53LBDNU.js → chunk-BKJ6WZKP.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-P5MSLVUW.js → chunk-BQ72NQQM.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-K7O6AHSJ.js → chunk-BWGNVM33.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-ADYQRETD.js → chunk-BYIEU4E4.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7ZVTFLCC.js → chunk-CDAJQBKJ.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-BKWFDWYM.js → chunk-D3UQWOCB.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-3PAS2ERX.js → chunk-DHFJS2I4.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-KNSOA43J.js → chunk-DKXIUGNA.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-LOEJFTF2.js → chunk-DLGJYQML.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-VGRGW4UL.js → chunk-DNJJVKJZ.js} +31 -31
- package/node_modules/pi-lens/dist/{chunk-5HBQL7DH.js → chunk-EBXCYEII.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-EH6EHFW2.js +73 -0
- package/node_modules/pi-lens/dist/{chunk-W26QZ3OM.js → chunk-EKQDQPX6.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-TWEOJE3D.js → chunk-EXHSWN3P.js} +844 -377
- package/node_modules/pi-lens/dist/{chunk-4IZZEN63.js → chunk-F7BFIENK.js} +33 -33
- package/node_modules/pi-lens/dist/{chunk-ZI7YHV6I.js → chunk-FD4LJQ6Y.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-RIH3UBK4.js → chunk-GFCPPCNR.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-5JB4WENL.js → chunk-GIK6VUCY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-PPQHMSPH.js → chunk-GNK2IHVG.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-CXQYK4YT.js → chunk-H6DNTQ4V.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-NGNBJIUO.js → chunk-HERQPNY6.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-INBK3HIT.js → chunk-HFIFEH46.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-J2ZB5MDS.js → chunk-HKRESBMC.js} +20 -20
- package/node_modules/pi-lens/dist/{chunk-AZG5UJYY.js → chunk-HMXWZUQW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-XSC3BCN3.js → chunk-HOWHAKXO.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-7CLWC2UH.js → chunk-HUWW77QY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-KZ732ZVW.js → chunk-IO6P3NBP.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-7WKVCZI4.js → chunk-J7VNGHLN.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-QE7BJQ6K.js → chunk-JGCBMCCS.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-PFJLYRO3.js → chunk-KIQSNH3F.js} +34 -34
- package/node_modules/pi-lens/dist/{chunk-JGUDT5KD.js → chunk-KSQJBGRO.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-RJ3APNIP.js → chunk-KXKM2DFP.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-L3Q72QGQ.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-6GLMMGCX.js → chunk-LDPY22FS.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3PO4YYOX.js → chunk-M3QGXGY4.js} +3793 -3814
- package/node_modules/pi-lens/dist/{chunk-NNEQOC3U.js → chunk-MET776XM.js} +9 -7
- package/node_modules/pi-lens/dist/{chunk-X33QECRJ.js → chunk-MKQFSW2Q.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7U36VQL6.js → chunk-MKW7ZUTT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-PQF6YGYB.js → chunk-N2U644ZW.js} +4 -18
- package/node_modules/pi-lens/dist/{chunk-DI4AZZNY.js → chunk-NAACKIKT.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-O6LCSHHI.js → chunk-NHHS5T52.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-DCA2MXVQ.js → chunk-NIZKGBOU.js} +51 -27
- package/node_modules/pi-lens/dist/{chunk-PKWEBMCA.js → chunk-NNDZ7DOP.js} +194 -111
- package/node_modules/pi-lens/dist/{chunk-Q7J3JYJ2.js → chunk-NZ7NSKIW.js} +13 -13
- package/node_modules/pi-lens/dist/{chunk-S6MCMD27.js → chunk-OG3UCAHV.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-3QXFUP6T.js → chunk-OHTHVILU.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-NHA5K226.js → chunk-P7EV5ISR.js} +17 -2
- package/node_modules/pi-lens/dist/{chunk-L6BDRYUK.js → chunk-PVV27TOX.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-HIRBC72R.js → chunk-Q32RJDYC.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QE5DJ7MX.js → chunk-Q4UQNTLB.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-SDYLT45T.js → chunk-QQGZY2BR.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-QMWKSYWB.js → chunk-S247BOH2.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-ARTYCUGF.js → chunk-S7KUDW73.js} +121 -18
- package/node_modules/pi-lens/dist/{chunk-6CFSDLHE.js → chunk-SJ2SR432.js} +17 -17
- package/node_modules/pi-lens/dist/{chunk-CQY2HEH7.js → chunk-SL4G67AP.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-LVLPA32Q.js → chunk-T2D2WWP6.js} +48 -11
- package/node_modules/pi-lens/dist/{chunk-HIJ4CHFF.js → chunk-T7KHGEJ5.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-74AMPWNC.js → chunk-TABDCX35.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-TFSBHRL2.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-KNJH6WJQ.js → chunk-TQKWR5AZ.js} +7 -7
- package/node_modules/pi-lens/dist/chunk-TWAQFMLW.js +110 -0
- package/node_modules/pi-lens/dist/{chunk-TKOFTLGB.js → chunk-UARVPNAU.js} +33 -33
- package/node_modules/pi-lens/dist/chunk-UWBD3JMH.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-K4Z7MK6T.js → chunk-VEF3GFOL.js} +15 -15
- package/node_modules/pi-lens/dist/{chunk-4DAHGU3V.js → chunk-W2JPGW7Q.js} +27 -25
- package/node_modules/pi-lens/dist/{chunk-CZJGAOKL.js → chunk-W2YHHNY3.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-R4L7KZ7R.js → chunk-WA6U2URH.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-OZQQ3AIR.js → chunk-WAK2AXQQ.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-DFKOA74L.js → chunk-WH6O4IFD.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-27JQHK7Y.js → chunk-WJ7GY5WJ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-KXGTLAUW.js → chunk-WWZLT6AM.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-O2MHF7QM.js → chunk-XRLZ75YY.js} +38 -38
- package/node_modules/pi-lens/dist/chunk-XWWFESYZ.js +27 -0
- package/node_modules/pi-lens/dist/chunk-XZSXSM4K.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-C5PLBTNR.js → chunk-Y2LIOCA7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-AXAR5ZW2.js → chunk-YIEHUKX2.js} +84 -169
- package/node_modules/pi-lens/dist/{chunk-B2OXE4AH.js → chunk-YOMLAKU6.js} +182 -180
- package/node_modules/pi-lens/dist/{chunk-MOAVEPC4.js → chunk-YV7XVYSJ.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-ZULZS2I6.js → chunk-ZVQUYCBU.js} +996 -365
- package/node_modules/pi-lens/dist/index.js +4911 -2376
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +8 -8
- package/node_modules/pi-lens/dist/mcp/cli.js +40 -40
- package/node_modules/pi-lens/dist/mcp/server.js +321 -234
- package/node_modules/pi-lens/dist/mcp/worker.js +58 -58
- package/node_modules/pi-lens/dist/probes/installer.js +21 -21
- package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +18 -9
- package/node_modules/pi-lens/docs/ci.md +7 -0
- package/node_modules/pi-lens/docs/defect-shapes.md +43 -28
- package/node_modules/pi-lens/docs/globalconfig.md +1 -0
- package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +15 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +3 -3
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +3 -2
- package/node_modules/pi-lens/docs/module-report-read-symbol.md +6 -2
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +3 -2
- package/node_modules/pi-lens/docs/pi-lens-orchestration.md +2 -1
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +2 -1
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/settings.md +1 -0
- package/node_modules/pi-lens/docs/usage.md +1 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/package.json +9 -7
- package/node_modules/pi-lens/dist/chunk-2H7NFZ4Q.js +0 -25
- package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +0 -56
- package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +0 -27
- package/node_modules/pi-lens/dist/chunk-H5API74E.js +0 -67
- package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +0 -27
- package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +0 -88
- package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +0 -73
- package/node_modules/pi-lens/dist/chunk-MJRGPEQ5.js +0 -25
- package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +0 -27
|
@@ -16,12 +16,21 @@
|
|
|
16
16
|
|
|
17
17
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent"
|
|
18
18
|
import type { AgentRecord } from "../types.js"
|
|
19
|
+
import {
|
|
20
|
+
type AgentDetail,
|
|
21
|
+
agentDetailFromMessages,
|
|
22
|
+
displayText,
|
|
23
|
+
} from "../workflow/agent-detail.js"
|
|
19
24
|
import {
|
|
20
25
|
pauseWorkflowTask,
|
|
21
26
|
resumeWorkflowTask,
|
|
22
27
|
type WorkflowTask,
|
|
23
28
|
} from "../workflow/task.js"
|
|
24
|
-
import {
|
|
29
|
+
import { createViewerKeys } from "./viewer-keys.js"
|
|
30
|
+
import {
|
|
31
|
+
WORKFLOW_DIALOG_HEIGHT_PCT,
|
|
32
|
+
WorkflowDialog,
|
|
33
|
+
} from "./workflow-dialog.js"
|
|
25
34
|
|
|
26
35
|
/** Everything the menu and the inspector need from the extension around them. */
|
|
27
36
|
export interface WorkflowMenuDeps {
|
|
@@ -44,6 +53,58 @@ export interface WorkflowMenuDeps {
|
|
|
44
53
|
* sessions, which is a no-op rather than an error.
|
|
45
54
|
*/
|
|
46
55
|
getCtx(): ExtensionCommandContext | undefined
|
|
56
|
+
/** A run's status changed from here (pause, resume), so its inline card is stale. */
|
|
57
|
+
onTaskChange(task: WorkflowTask): void
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* What the child answered, as the script received it: the structured JSON
|
|
62
|
+
* (pretty-printed, so the Outcome reads as an object rather than one long
|
|
63
|
+
* line) or the final text.
|
|
64
|
+
*/
|
|
65
|
+
function recordOutcome(record: AgentRecord): string | undefined {
|
|
66
|
+
if (record.structuredJson !== undefined) {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.stringify(JSON.parse(record.structuredJson), null, 2)
|
|
69
|
+
} catch {
|
|
70
|
+
return displayText(record.structuredJson)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return record.result === undefined ? undefined : displayText(record.result)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A `detail` lookup over the manager's records. The transcript fold is
|
|
78
|
+
* memoised per record on its message count and status — the dialog re-reads
|
|
79
|
+
* its source on every 80ms spinner frame, and re-folding a long transcript
|
|
80
|
+
* that often would be waste. The outcome is read every time: the manager
|
|
81
|
+
* appends a worktree's merge note to `result` after both have settled.
|
|
82
|
+
*/
|
|
83
|
+
export function createAgentDetailSource(
|
|
84
|
+
getRecord: (id: string) => AgentRecord | undefined,
|
|
85
|
+
): (id: string) => AgentDetail | undefined {
|
|
86
|
+
const cache = new Map<
|
|
87
|
+
string,
|
|
88
|
+
{ key: string; folded: AgentDetail; detail: AgentDetail }
|
|
89
|
+
>()
|
|
90
|
+
return (id) => {
|
|
91
|
+
const record = getRecord(id)
|
|
92
|
+
const messages = record?.session?.messages
|
|
93
|
+
if (record === undefined || messages === undefined) return undefined
|
|
94
|
+
const key = `${messages.length}:${record.status}`
|
|
95
|
+
const hit = cache.get(id)
|
|
96
|
+
const folded =
|
|
97
|
+
hit?.key === key ? hit.folded : agentDetailFromMessages(messages)
|
|
98
|
+
const outcome = recordOutcome(record) ?? folded.outcome
|
|
99
|
+
if (hit?.folded === folded && hit.detail.outcome === outcome)
|
|
100
|
+
return hit.detail
|
|
101
|
+
const detail: AgentDetail = {
|
|
102
|
+
...folded,
|
|
103
|
+
...(outcome !== undefined ? { outcome } : {}),
|
|
104
|
+
}
|
|
105
|
+
cache.set(id, { key, folded, detail })
|
|
106
|
+
return detail
|
|
107
|
+
}
|
|
47
108
|
}
|
|
48
109
|
|
|
49
110
|
/**
|
|
@@ -64,8 +125,9 @@ export async function showWorkflowDialog(
|
|
|
64
125
|
// Overlaid on the same terms as the conversation viewer, because they are
|
|
65
126
|
// reached the same way: both are rows of the fleet list, and opening one
|
|
66
127
|
// must not behave unlike opening the other. Inline, the frame would render
|
|
67
|
-
// into the conversation and stay in the scrollback after it closed.
|
|
68
|
-
|
|
128
|
+
// into the conversation and stay in the scrollback after it closed. Taller
|
|
129
|
+
// than the viewer's share: the frame is drawn at a fixed height, and two
|
|
130
|
+
// panes need the rows more than one transcript does.
|
|
69
131
|
/**
|
|
70
132
|
* This dialog's own overlay, so `c` can hide it while the conversation is
|
|
71
133
|
* up. Overlays stack, so the viewer would render *over* it either way —
|
|
@@ -75,8 +137,9 @@ export async function showWorkflowDialog(
|
|
|
75
137
|
* closes.
|
|
76
138
|
*/
|
|
77
139
|
let overlay: { setHidden(hidden: boolean): void } | undefined
|
|
140
|
+
const detail = createAgentDetailSource(deps.getRecord)
|
|
78
141
|
await ctx.ui.custom<undefined>(
|
|
79
|
-
(tui, theme,
|
|
142
|
+
(tui, theme, keybindings, done) =>
|
|
80
143
|
new WorkflowDialog(
|
|
81
144
|
tui,
|
|
82
145
|
// Re-read on every render: the run is in the background, so the
|
|
@@ -92,6 +155,7 @@ export async function showWorkflowDialog(
|
|
|
92
155
|
},
|
|
93
156
|
meta: task.meta,
|
|
94
157
|
agentCount: task.agentCount,
|
|
158
|
+
detail,
|
|
95
159
|
}),
|
|
96
160
|
theme,
|
|
97
161
|
done,
|
|
@@ -106,6 +170,7 @@ export async function showWorkflowDialog(
|
|
|
106
170
|
},
|
|
107
171
|
onPause: () => {
|
|
108
172
|
if (pauseWorkflowTask(task)) {
|
|
173
|
+
deps.onTaskChange(task)
|
|
109
174
|
// Named rather than implied: "paused" on a run whose agents are
|
|
110
175
|
// still finishing reads as a stronger promise than it is.
|
|
111
176
|
ctx.ui.notify(
|
|
@@ -115,7 +180,10 @@ export async function showWorkflowDialog(
|
|
|
115
180
|
}
|
|
116
181
|
},
|
|
117
182
|
onResume: () => {
|
|
118
|
-
if (resumeWorkflowTask(task))
|
|
183
|
+
if (resumeWorkflowTask(task)) {
|
|
184
|
+
deps.onTaskChange(task)
|
|
185
|
+
ctx.ui.notify("Resumed.", "info")
|
|
186
|
+
}
|
|
119
187
|
},
|
|
120
188
|
onSkipAgent: (index) => {
|
|
121
189
|
if (task.control?.skip(index) !== true) {
|
|
@@ -160,13 +228,16 @@ export async function showWorkflowDialog(
|
|
|
160
228
|
.finally(() => overlay?.setHidden(false))
|
|
161
229
|
},
|
|
162
230
|
},
|
|
231
|
+
undefined,
|
|
232
|
+
// The conversation viewer's page and jump keys, so the two scroll alike.
|
|
233
|
+
createViewerKeys(keybindings),
|
|
163
234
|
),
|
|
164
235
|
{
|
|
165
236
|
overlay: true,
|
|
166
237
|
overlayOptions: {
|
|
167
238
|
anchor: "center",
|
|
168
239
|
width: "90%",
|
|
169
|
-
maxHeight: `${
|
|
240
|
+
maxHeight: `${WORKFLOW_DIALOG_HEIGHT_PCT}%`,
|
|
170
241
|
},
|
|
171
242
|
onHandle: (handle) => {
|
|
172
243
|
overlay = handle
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-detail.ts — a workflow child's transcript, flattened for the inspector.
|
|
3
|
+
*
|
|
4
|
+
* The progress log carries only a tool-call count and 200-character previews;
|
|
5
|
+
* the child's session holds the full prompt, every call and result, and the
|
|
6
|
+
* final answer. This folds that session into plain text the dialog's pure
|
|
7
|
+
* layout can arrange, so the Activity section can list calls (`Bash(ls -la)`)
|
|
8
|
+
* and expand into a transcript without the dialog knowing about sessions.
|
|
9
|
+
*
|
|
10
|
+
* Plain text on purpose: pi's tool renderers produce styled rows that the
|
|
11
|
+
* dialog's segment layout cannot clamp or scroll. The conversation viewer
|
|
12
|
+
* (`c` in the dialog) remains the place for those.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { AgentSession } from "@earendil-works/pi-coding-agent"
|
|
16
|
+
import { stripTerminalSequences } from "@earendil-works/pi-tui"
|
|
17
|
+
import { extractText } from "../context.js"
|
|
18
|
+
|
|
19
|
+
type AgentMessage = AgentSession["messages"][number]
|
|
20
|
+
|
|
21
|
+
export interface AgentDetailItem {
|
|
22
|
+
kind: "text" | "tool"
|
|
23
|
+
/** A text block's first line, or a call's `Name(summary)`. */
|
|
24
|
+
head: string
|
|
25
|
+
/** The rest of a text block, or the call's result lines. */
|
|
26
|
+
body: string[]
|
|
27
|
+
/** Tool items only: whether a result has arrived, and whether it failed. */
|
|
28
|
+
settled?: boolean
|
|
29
|
+
isError?: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface AgentDetail {
|
|
33
|
+
prompt?: string
|
|
34
|
+
outcome?: string
|
|
35
|
+
items: AgentDetailItem[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Argument keys whose value names what a call is doing, most telling first. A
|
|
40
|
+
* search's pattern outranks its path: `Grep(foo)` says what it looked for,
|
|
41
|
+
* `Grep(src)` only where.
|
|
42
|
+
*/
|
|
43
|
+
const SUMMARY_KEYS = [
|
|
44
|
+
"command",
|
|
45
|
+
"pattern",
|
|
46
|
+
"query",
|
|
47
|
+
"url",
|
|
48
|
+
"file_path",
|
|
49
|
+
"path",
|
|
50
|
+
"description",
|
|
51
|
+
"prompt",
|
|
52
|
+
] as const
|
|
53
|
+
|
|
54
|
+
/** `Name(summary)` — the argument that says what the call does, on one line. */
|
|
55
|
+
export function toolCallHead(name: string, args: unknown): string {
|
|
56
|
+
const record =
|
|
57
|
+
args !== null && typeof args === "object"
|
|
58
|
+
? (args as Record<string, unknown>)
|
|
59
|
+
: {}
|
|
60
|
+
const value =
|
|
61
|
+
SUMMARY_KEYS.map((key) => record[key]).find(
|
|
62
|
+
(v): v is string => typeof v === "string" && v.trim() !== "",
|
|
63
|
+
) ??
|
|
64
|
+
Object.values(record).find(
|
|
65
|
+
(v): v is string => typeof v === "string" && v.trim() !== "",
|
|
66
|
+
)
|
|
67
|
+
// `cat a && cat b` from a multi-line argument: whitespace collapsed to one line.
|
|
68
|
+
return value === undefined
|
|
69
|
+
? name
|
|
70
|
+
: `${name}(${displayText(value).replace(/\s+/g, " ").trim()})`
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Text made safe to place in a layout, as pi's tool renderers make it: tool
|
|
75
|
+
* output is stored raw, so a coloured test run or a `\r` progress line would
|
|
76
|
+
* otherwise reach the terminal — a reset cancels the row's dim, a carriage
|
|
77
|
+
* return draws over the left pane, a tab overruns the width the layout
|
|
78
|
+
* measured (pi-tui counts it as three cells).
|
|
79
|
+
*/
|
|
80
|
+
export function displayText(text: string): string {
|
|
81
|
+
return stripTerminalSequences(text)
|
|
82
|
+
.replace(/\r/g, "")
|
|
83
|
+
.replace(/\t/g, " ")
|
|
84
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "")
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Fold a session's messages into prompt, transcript items and outcome.
|
|
89
|
+
*
|
|
90
|
+
* `prompt` is the first user message; `outcome` is the last assistant text,
|
|
91
|
+
* which is what the child answered. A result is paired to its call by id, as
|
|
92
|
+
* the conversation viewer pairs them; one whose call is not in the
|
|
93
|
+
* transcript (a compacted prefix) is dropped, since there is no row to hang
|
|
94
|
+
* it from.
|
|
95
|
+
*/
|
|
96
|
+
export function agentDetailFromMessages(
|
|
97
|
+
messages: readonly AgentMessage[],
|
|
98
|
+
): AgentDetail {
|
|
99
|
+
const results = new Map<
|
|
100
|
+
string,
|
|
101
|
+
Extract<AgentMessage, { role: "toolResult" }>
|
|
102
|
+
>()
|
|
103
|
+
for (const msg of messages) {
|
|
104
|
+
if (msg.role === "toolResult") results.set(msg.toolCallId, msg)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let prompt: string | undefined
|
|
108
|
+
let outcome: string | undefined
|
|
109
|
+
const items: AgentDetailItem[] = []
|
|
110
|
+
for (const msg of messages) {
|
|
111
|
+
if (msg.role === "user") {
|
|
112
|
+
if (prompt !== undefined) continue
|
|
113
|
+
const text = displayText(
|
|
114
|
+
typeof msg.content === "string"
|
|
115
|
+
? msg.content
|
|
116
|
+
: extractText(msg.content),
|
|
117
|
+
).trim()
|
|
118
|
+
if (text) prompt = text
|
|
119
|
+
} else if (msg.role === "assistant") {
|
|
120
|
+
for (const part of msg.content) {
|
|
121
|
+
if (part.type === "text") {
|
|
122
|
+
const text = displayText(part.text).trim()
|
|
123
|
+
if (!text) continue
|
|
124
|
+
const [head, ...body] = text.split("\n")
|
|
125
|
+
items.push({ kind: "text", head, body })
|
|
126
|
+
outcome = text
|
|
127
|
+
} else if (part.type === "toolCall") {
|
|
128
|
+
const result = results.get(part.id)
|
|
129
|
+
const resultText = result
|
|
130
|
+
? displayText(extractText(result.content)).trimEnd()
|
|
131
|
+
: ""
|
|
132
|
+
items.push({
|
|
133
|
+
kind: "tool",
|
|
134
|
+
head: toolCallHead(part.name, part.arguments),
|
|
135
|
+
body: resultText ? resultText.split("\n") : [],
|
|
136
|
+
settled: result !== undefined,
|
|
137
|
+
...(result?.isError ? { isError: true } : {}),
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...(prompt !== undefined ? { prompt } : {}),
|
|
145
|
+
...(outcome !== undefined ? { outcome } : {}),
|
|
146
|
+
items,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
} from "@earendil-works/pi-coding-agent"
|
|
40
40
|
import type { AgentManager } from "../agent-manager.js"
|
|
41
41
|
import { reopenTarget, worktreeLost } from "../agent-record-entry.js"
|
|
42
|
+
import type { ToolActivity } from "../agent-runner.js"
|
|
42
43
|
import { getAgentConfig, resolveSpawnType } from "../agent-types.js"
|
|
43
44
|
import { resolveModel } from "../model-resolver.js"
|
|
44
45
|
import { checkModelScope } from "../model-scope.js"
|
|
@@ -47,6 +48,7 @@ import { getLifetimeTotal } from "../usage.js"
|
|
|
47
48
|
import type {
|
|
48
49
|
WorkflowGateResult,
|
|
49
50
|
WorkflowHost,
|
|
51
|
+
WorkflowSpawnRequest,
|
|
50
52
|
WorkflowSpawnResult,
|
|
51
53
|
} from "./runtime.js"
|
|
52
54
|
import { resolveWorkflowSource } from "./saved.js"
|
|
@@ -125,18 +127,55 @@ function resolvedInfo(record: AgentRecord | undefined) {
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
type InvocationUsage = Required<
|
|
131
|
+
Pick<WorkflowSpawnResult, "tokens" | "outputTokens" | "toolCalls">
|
|
132
|
+
>
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* This invocation's counters: the record's lifetime totals minus `baseline`,
|
|
136
|
+
* which a resume of a still-live record takes before it starts so the resumed
|
|
137
|
+
* row counts only its continuation.
|
|
138
|
+
*/
|
|
139
|
+
function usageSince(
|
|
140
|
+
record: AgentRecord,
|
|
141
|
+
baseline?: InvocationUsage,
|
|
142
|
+
): InvocationUsage {
|
|
143
|
+
return {
|
|
144
|
+
tokens: getLifetimeTotal(record.lifetimeUsage) - (baseline?.tokens ?? 0),
|
|
145
|
+
// Reported separately from `tokens`. The script's `budget` counts *output*
|
|
146
|
+
// tokens, as Claude Code's does — billing the input and cache reads a
|
|
147
|
+
// fan-out re-sends would over-report it by an order of magnitude and make
|
|
148
|
+
// the documented guards useless.
|
|
149
|
+
outputTokens:
|
|
150
|
+
(record.lifetimeUsage?.output ?? 0) - (baseline?.outputTokens ?? 0),
|
|
151
|
+
toolCalls: record.toolUses - (baseline?.toolCalls ?? 0),
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The manager hooks that forward a running child's counters to its row. Tools
|
|
157
|
+
* count on completion, and tokens on finalized `message_end` usage — never on
|
|
158
|
+
* streaming estimates.
|
|
159
|
+
*/
|
|
160
|
+
function progressHooks(report: () => void) {
|
|
161
|
+
return {
|
|
162
|
+
onToolActivity: (activity: ToolActivity) => {
|
|
163
|
+
if (activity.type === "end") report()
|
|
164
|
+
},
|
|
165
|
+
onAssistantUsage: report,
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function toSpawnResult(
|
|
170
|
+
record: AgentRecord,
|
|
171
|
+
baseline?: InvocationUsage,
|
|
172
|
+
): WorkflowSpawnResult {
|
|
173
|
+
const { tokens, outputTokens, toolCalls } = usageSince(record, baseline)
|
|
135
174
|
const cwd = childCwd(record)
|
|
136
175
|
const common = {
|
|
137
176
|
...(tokens > 0 ? { tokens } : {}),
|
|
138
177
|
...(outputTokens > 0 ? { outputTokens } : {}),
|
|
139
|
-
...(
|
|
178
|
+
...(toolCalls > 0 ? { toolCalls } : {}),
|
|
140
179
|
...(cwd !== undefined ? { cwd } : {}),
|
|
141
180
|
}
|
|
142
181
|
|
|
@@ -246,7 +285,8 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
246
285
|
async function reopenAgent(
|
|
247
286
|
id: string,
|
|
248
287
|
prompt: string,
|
|
249
|
-
onResolved:
|
|
288
|
+
onResolved: WorkflowSpawnRequest["onResolved"],
|
|
289
|
+
onProgress: WorkflowSpawnRequest["onProgress"],
|
|
250
290
|
): Promise<WorkflowSpawnResult> {
|
|
251
291
|
const kept = settled.get(id)
|
|
252
292
|
if (kept === undefined)
|
|
@@ -261,6 +301,12 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
261
301
|
error: `Agent ${id} cannot be resumed — ${reopen.reason}.`,
|
|
262
302
|
}
|
|
263
303
|
const config = getAgentConfig(reopen.type)
|
|
304
|
+
// A reclaimed record starts from zero, so its lifetime totals already are
|
|
305
|
+
// this continuation's — no baseline, unlike a resume of a live record.
|
|
306
|
+
const reportProgress = () => {
|
|
307
|
+
const record = manager.getRecord(id)
|
|
308
|
+
if (record !== undefined) onProgress?.(usageSince(record))
|
|
309
|
+
}
|
|
264
310
|
try {
|
|
265
311
|
const { record } = await manager.spawnAndWait(
|
|
266
312
|
pi,
|
|
@@ -281,8 +327,12 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
281
327
|
...(deps.rootSessionId !== undefined
|
|
282
328
|
? { rootSessionId: deps.rootSessionId }
|
|
283
329
|
: {}),
|
|
330
|
+
...progressHooks(reportProgress),
|
|
331
|
+
},
|
|
332
|
+
() => {
|
|
333
|
+
onResolved?.({ recordId: id })
|
|
334
|
+
reportProgress()
|
|
284
335
|
},
|
|
285
|
-
() => onResolved?.({ recordId: id }),
|
|
286
336
|
)
|
|
287
337
|
remember(record)
|
|
288
338
|
const info = resolvedInfo(record)
|
|
@@ -376,6 +426,11 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
376
426
|
const info = resolvedInfo(manager.getRecord(spawnedId))
|
|
377
427
|
if (info !== undefined) request.onResolved?.(info)
|
|
378
428
|
}
|
|
429
|
+
const reportProgress = () => {
|
|
430
|
+
const record =
|
|
431
|
+
spawnedId === undefined ? undefined : manager.getRecord(spawnedId)
|
|
432
|
+
if (record !== undefined) request.onProgress?.(usageSince(record))
|
|
433
|
+
}
|
|
379
434
|
const command = request.gate
|
|
380
435
|
/**
|
|
381
436
|
* Verify the child's work while its worktree still exists.
|
|
@@ -458,9 +513,13 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
458
513
|
sessionReady = true
|
|
459
514
|
reportResolved()
|
|
460
515
|
},
|
|
516
|
+
...progressHooks(reportProgress),
|
|
461
517
|
...(request.schema !== undefined
|
|
462
518
|
? { structuredOutput: request.schema }
|
|
463
519
|
: {}),
|
|
520
|
+
...(request.disallowedTools !== undefined
|
|
521
|
+
? { disallowedTools: request.disallowedTools }
|
|
522
|
+
: {}),
|
|
464
523
|
...(request.isolation !== undefined
|
|
465
524
|
? { isolation: request.isolation }
|
|
466
525
|
: {}),
|
|
@@ -482,6 +541,8 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
482
541
|
// would otherwise never be openable at all.
|
|
483
542
|
request.onResolved?.({ recordId: id })
|
|
484
543
|
reportResolved()
|
|
544
|
+
// Counters a stub reported synchronously, before the id existed.
|
|
545
|
+
reportProgress()
|
|
485
546
|
},
|
|
486
547
|
)
|
|
487
548
|
remember(record)
|
|
@@ -507,7 +568,7 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
507
568
|
if (id !== undefined) manager.abort(id)
|
|
508
569
|
},
|
|
509
570
|
|
|
510
|
-
async resumeAgent(agentId, prompt, onResolved) {
|
|
571
|
+
async resumeAgent(agentId, prompt, onResolved, onProgress) {
|
|
511
572
|
const id = records.get(agentId)
|
|
512
573
|
if (id === undefined) {
|
|
513
574
|
return {
|
|
@@ -515,12 +576,25 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
515
576
|
error: `Cannot resume "${agentId}" — it never started.`,
|
|
516
577
|
}
|
|
517
578
|
}
|
|
518
|
-
|
|
579
|
+
// A live record carries the earlier runs' totals; the resumed row counts
|
|
580
|
+
// only what this continuation adds.
|
|
581
|
+
const previous = manager.getRecord(id)
|
|
582
|
+
const baseline = previous === undefined ? undefined : usageSince(previous)
|
|
583
|
+
const record = await manager.resume(
|
|
584
|
+
id,
|
|
585
|
+
prompt,
|
|
586
|
+
deps.signal,
|
|
587
|
+
progressHooks(() => {
|
|
588
|
+
const current = manager.getRecord(id)
|
|
589
|
+
if (current !== undefined) onProgress?.(usageSince(current, baseline))
|
|
590
|
+
}),
|
|
591
|
+
)
|
|
519
592
|
// No live session: the manager evicted the child, or it never got as far
|
|
520
593
|
// as having one. `reopenAgent` refuses the second with the reason — and a
|
|
521
594
|
// record still in memory without a session is refused by the manager,
|
|
522
595
|
// which never reopens an id that is still live.
|
|
523
|
-
if (record === undefined)
|
|
596
|
+
if (record === undefined)
|
|
597
|
+
return reopenAgent(id, prompt, onResolved, onProgress)
|
|
524
598
|
// The resumed row is built from scratch, so it has to be told the same
|
|
525
599
|
// thing the first one was — the child's session already exists, so this is
|
|
526
600
|
// simply read back rather than waited for. The id goes first for the same
|
|
@@ -529,7 +603,7 @@ export function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost {
|
|
|
529
603
|
onResolved?.({ recordId: id })
|
|
530
604
|
const info = resolvedInfo(record)
|
|
531
605
|
if (info !== undefined) onResolved?.(info)
|
|
532
|
-
return toSpawnResult(record)
|
|
606
|
+
return toSpawnResult(record, baseline)
|
|
533
607
|
},
|
|
534
608
|
|
|
535
609
|
/**
|
|
@@ -57,6 +57,8 @@ export interface WorkflowJournalEntry {
|
|
|
57
57
|
ok: boolean
|
|
58
58
|
/** The agent's answer, when it had one. */
|
|
59
59
|
text?: string
|
|
60
|
+
/** Why the call failed, capped. Diagnostic only: never part of a replay match. */
|
|
61
|
+
error?: string
|
|
60
62
|
/**
|
|
61
63
|
* Whether the call continued an earlier child (`agent({ resume })`).
|
|
62
64
|
*
|
|
@@ -87,6 +89,8 @@ export interface JournalKeyInput {
|
|
|
87
89
|
resume?: string
|
|
88
90
|
/** Serialized `agent({ schema })`, when the call asked for one. */
|
|
89
91
|
schema?: string
|
|
92
|
+
/** `agent({ disallowedTools })`, already deduped and sorted worker-side. */
|
|
93
|
+
disallowedTools?: string[]
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
/** Stable hash of a call's payload. Field order is fixed here, not by the caller. */
|
|
@@ -106,6 +110,9 @@ export function journalKey(input: JournalKeyInput): string {
|
|
|
106
110
|
// call keys exactly as it always did, and adding or changing a schema still
|
|
107
111
|
// produces a different key.
|
|
108
112
|
...(input.schema !== undefined ? [input.schema] : []),
|
|
113
|
+
// Same reasoning. An array never equals the string a schema slot holds, so
|
|
114
|
+
// the two cannot be confused by position.
|
|
115
|
+
...(input.disallowedTools !== undefined ? [input.disallowedTools] : []),
|
|
109
116
|
])
|
|
110
117
|
return createHash("sha256").update(canonical).digest("hex").slice(0, 32)
|
|
111
118
|
}
|
|
@@ -159,6 +166,7 @@ function isEntry(value: unknown): value is WorkflowJournalEntry {
|
|
|
159
166
|
typeof entry.key === "string" &&
|
|
160
167
|
typeof entry.ok === "boolean" &&
|
|
161
168
|
(entry.text === undefined || typeof entry.text === "string") &&
|
|
169
|
+
(entry.error === undefined || typeof entry.error === "string") &&
|
|
162
170
|
(entry.resumed === undefined || entry.resumed === true)
|
|
163
171
|
)
|
|
164
172
|
}
|