@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
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
} from "./agent-types.js"
|
|
35
35
|
import { runInChildSessionContext } from "./child-context.js"
|
|
36
36
|
import { buildParentContext, extractText } from "./context.js"
|
|
37
|
+
import { deniedToolNames } from "./custom-agents.js"
|
|
37
38
|
import { DEFAULT_AGENTS } from "./default-agents.js"
|
|
38
39
|
import { detectEnv } from "./env.js"
|
|
39
40
|
import { buildMemoryBlock, buildReadOnlyMemoryBlock } from "./memory.js"
|
|
@@ -673,6 +674,11 @@ export interface RunOptions {
|
|
|
673
674
|
* fails at the call that wrote it rather than inside the child.
|
|
674
675
|
*/
|
|
675
676
|
structuredOutput?: CompiledSchema
|
|
677
|
+
/**
|
|
678
|
+
* Tools to deny this one spawn, on top of the agent definition's own
|
|
679
|
+
* `disallowedTools`. Set by the workflow host, for `agent({ disallowedTools })`.
|
|
680
|
+
*/
|
|
681
|
+
disallowedTools?: string[]
|
|
676
682
|
/** Runtime bridge for opt-in child-safe nested delegation. */
|
|
677
683
|
nestedRuntime?: {
|
|
678
684
|
manager: NestedAgentManager
|
|
@@ -973,15 +979,21 @@ export async function runAgent(
|
|
|
973
979
|
|
|
974
980
|
let toolNames = getToolNamesForType(type)
|
|
975
981
|
|
|
982
|
+
// The definition's deny list plus this spawn's. Built once: the memory check
|
|
983
|
+
// below and the tool scoping after it must agree on what is denied.
|
|
984
|
+
const deniedNames = [
|
|
985
|
+
...(agentConfig?.disallowedTools ?? []),
|
|
986
|
+
...(deniedToolNames(options.disallowedTools) ?? []),
|
|
987
|
+
]
|
|
988
|
+
const disallowedSet =
|
|
989
|
+
deniedNames.length > 0 ? new Set(deniedNames) : undefined
|
|
990
|
+
|
|
976
991
|
// Persistent memory: detect write capability and branch accordingly.
|
|
977
992
|
// Account for disallowedTools — a tool in the base set but on the denylist is not truly available.
|
|
978
993
|
if (agentConfig?.memory) {
|
|
979
994
|
const existingNames = new Set(toolNames)
|
|
980
|
-
const denied = agentConfig.disallowedTools
|
|
981
|
-
? new Set(agentConfig.disallowedTools)
|
|
982
|
-
: undefined
|
|
983
995
|
const effectivelyHas = (name: string) =>
|
|
984
|
-
existingNames.has(name) && !
|
|
996
|
+
existingNames.has(name) && !disallowedSet?.has(name)
|
|
985
997
|
const hasWriteTools = effectivelyHas("write") || effectivelyHas("edit")
|
|
986
998
|
|
|
987
999
|
if (hasWriteTools) {
|
|
@@ -1005,10 +1017,6 @@ export async function runAgent(
|
|
|
1005
1017
|
}
|
|
1006
1018
|
}
|
|
1007
1019
|
|
|
1008
|
-
const disallowedSet = agentConfig?.disallowedTools
|
|
1009
|
-
? new Set(agentConfig.disallowedTools)
|
|
1010
|
-
: undefined
|
|
1011
|
-
|
|
1012
1020
|
// Nested delegation tools (opt-in, ownership-scoped). Empty unless the agent
|
|
1013
1021
|
// set `allowed_subagents` and a nestedRuntime was provided — and never when
|
|
1014
1022
|
// isolated. Their names collide with EXCLUDED_TOOL_NAMES by design, so the
|
|
@@ -1306,17 +1314,26 @@ export async function runAgent(
|
|
|
1306
1314
|
}
|
|
1307
1315
|
}
|
|
1308
1316
|
|
|
1309
|
-
//
|
|
1317
|
+
// A reopened conversation carries the model and thinking level it ran with,
|
|
1318
|
+
// and createAgentSession restores both when none is passed — so a reopen keeps
|
|
1319
|
+
// them, as a live resume keeps its session's (#462). Only an explicit option
|
|
1320
|
+
// outranks them; the agent file and the parent do not.
|
|
1321
|
+
const reopening = options.resumeSessionFile !== undefined
|
|
1322
|
+
|
|
1323
|
+
// Resolve model: explicit option > (reopen: the session's own) > config.model > parent model
|
|
1310
1324
|
const model =
|
|
1311
1325
|
options.model ??
|
|
1312
|
-
|
|
1326
|
+
(reopening
|
|
1327
|
+
? undefined
|
|
1328
|
+
: resolveDefaultModel(ctx.model, ctx.modelRegistry, agentConfig?.model))
|
|
1313
1329
|
|
|
1314
|
-
// Resolve thinking level: explicit option > agent config > parent session level.
|
|
1330
|
+
// Resolve thinking level: explicit option > (reopen: the session's own) > agent config > parent session level.
|
|
1315
1331
|
// Without the parent step, an unset level falls through to pi's
|
|
1316
1332
|
// defaultThinkingLevel (e.g. "max") instead of matching the spawning session.
|
|
1317
1333
|
// Same idiom as mention-clone.ts.
|
|
1318
1334
|
const thinkingLevel =
|
|
1319
|
-
options.thinkingLevel ??
|
|
1335
|
+
options.thinkingLevel ??
|
|
1336
|
+
(reopening ? undefined : (agentConfig?.thinking ?? ctx.thinkingLevel))
|
|
1320
1337
|
|
|
1321
1338
|
// The `agent({ schema })` contract: this child reports its answer by calling
|
|
1322
1339
|
// StructuredOutput, and `structuredJson` below is what the caller reads. The
|
|
@@ -1528,9 +1545,13 @@ export async function runAgent(
|
|
|
1528
1545
|
sessionOpts.thinkingLevel = thinkingLevel
|
|
1529
1546
|
}
|
|
1530
1547
|
|
|
1531
|
-
const { session } = await runInChildSessionContext(() =>
|
|
1548
|
+
const { session, modelFallbackMessage } = await runInChildSessionContext(() =>
|
|
1532
1549
|
createAgentSession(sessionOpts),
|
|
1533
1550
|
)
|
|
1551
|
+
// Pi could not use the model the reopened conversation recorded and fell back
|
|
1552
|
+
// to its default. Warned the way pi warns at its own session start, and the
|
|
1553
|
+
// way an out-of-scope model is warned: to the user, not the model.
|
|
1554
|
+
if (modelFallbackMessage) ctx.ui.notify(modelFallbackMessage, "warning")
|
|
1534
1555
|
|
|
1535
1556
|
const baseSessionName = agentConfig?.name ?? type
|
|
1536
1557
|
session.setSessionName(
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
createReadOnlyTools,
|
|
11
11
|
} from "@earendil-works/pi-coding-agent"
|
|
12
12
|
import { DEFAULT_AGENTS } from "./default-agents.js"
|
|
13
|
+
import type { ToolDescriptionMode } from "./settings.js"
|
|
13
14
|
import type { AgentConfig } from "./types.js"
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -387,3 +388,90 @@ export function getConfig(type: string): {
|
|
|
387
388
|
promptMode: "append",
|
|
388
389
|
}
|
|
389
390
|
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Which Agent tool description the LLM sees (#91). Module state rather than an
|
|
394
|
+
* index.ts closure because nested `Agent` tools, built per subagent session,
|
|
395
|
+
* follow it too. Read when a tool is built.
|
|
396
|
+
*/
|
|
397
|
+
let toolDescriptionMode: ToolDescriptionMode = "full"
|
|
398
|
+
|
|
399
|
+
export function getToolDescriptionMode(): ToolDescriptionMode {
|
|
400
|
+
return toolDescriptionMode
|
|
401
|
+
}
|
|
402
|
+
export function setToolDescriptionMode(mode: ToolDescriptionMode): void {
|
|
403
|
+
toolDescriptionMode = mode
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Derive a short model label from a model string. */
|
|
407
|
+
export function getModelLabelFromConfig(model: string): string {
|
|
408
|
+
// Strip provider prefix (e.g. "anthropic/claude-sonnet-4-6" → "claude-sonnet-4-6")
|
|
409
|
+
const name = model.includes("/") ? model.split("/").pop()! : model
|
|
410
|
+
// Strip trailing date suffix (e.g. "claude-haiku-4-5-20251001" → "claude-haiku-4-5")
|
|
411
|
+
return name.replace(/-\d{8}$/, "")
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** First sentence of an agent description — for the compact type list. */
|
|
415
|
+
function firstSentence(text: string): string {
|
|
416
|
+
const match = text.match(/^.*?[.!?](?=\s|$)/s)
|
|
417
|
+
return (match ? match[0] : text).replace(/\s+/g, " ").trim()
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* The "Available agent types" list in an Agent tool description, one line per
|
|
422
|
+
* name. Full lines carry the description, the model label and the tool scope;
|
|
423
|
+
* compact lines the description's first sentence and the tool scope.
|
|
424
|
+
*/
|
|
425
|
+
export function formatAgentTypeList(
|
|
426
|
+
names: string[],
|
|
427
|
+
lookup: (name: string) => AgentConfig | undefined,
|
|
428
|
+
compact: boolean,
|
|
429
|
+
): string {
|
|
430
|
+
return names
|
|
431
|
+
.map((name) => {
|
|
432
|
+
const cfg = lookup(name)
|
|
433
|
+
const tools = ` (Tools: ${formatToolsSuffix(cfg)})`
|
|
434
|
+
if (compact)
|
|
435
|
+
return `- ${name}: ${firstSentence(cfg?.description ?? name)}${tools}`
|
|
436
|
+
const model = cfg?.model ? ` (${getModelLabelFromConfig(cfg.model)})` : ""
|
|
437
|
+
return `- ${name}: ${cfg?.description ?? name}${model}${tools}`
|
|
438
|
+
})
|
|
439
|
+
.join("\n")
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Format an agent's tool scope for the Agent tool description.
|
|
444
|
+
*
|
|
445
|
+
* This suffix describes BUILT-IN scope only — extension tools are resolved when
|
|
446
|
+
* the agent runs (extensions can register asynchronously), so they cannot be
|
|
447
|
+
* enumerated while the description is being built. That is why an agent with
|
|
448
|
+
* `tools: "*, ext:mcp/search"` renders "*" and always has.
|
|
449
|
+
*
|
|
450
|
+
* Two distinctions matter, both of them capability claims the orchestrator acts on:
|
|
451
|
+
*
|
|
452
|
+
* - absent vs empty. `builtinToolNames: undefined` means the agent never narrowed
|
|
453
|
+
* its tools (the shipped defaults); `[]` is what `tools: none` and an `ext:`-only
|
|
454
|
+
* `tools:` parse to, and the runtime really does hand those agents no built-ins.
|
|
455
|
+
* Rendering both "*" tells the orchestrator a tool-less agent can run `bash`.
|
|
456
|
+
* - empty-with-extensions vs empty-without. Zero built-ins does NOT imply zero
|
|
457
|
+
* tools: `tools: none` alongside `extensions:` still surfaces every extension
|
|
458
|
+
* tool (see test/fixtures/.pi/agents/tools-none.md, which expects three). Calling
|
|
459
|
+
* that "none" understates the agent instead of overstating it — better, but still
|
|
460
|
+
* wrong, and it would route work away from the only agent able to do it. "none"
|
|
461
|
+
* is therefore reserved for agents that genuinely can call nothing: `isolated`
|
|
462
|
+
* agents and those with `extensions: false`.
|
|
463
|
+
*/
|
|
464
|
+
export function formatToolsSuffix(cfg: AgentConfig | undefined): string {
|
|
465
|
+
const tools = cfg?.builtinToolNames
|
|
466
|
+
if (!tools) return "*"
|
|
467
|
+
if (tools.length === 0) {
|
|
468
|
+
// `isolated` overrides extensions to false in the runner, so both mean the
|
|
469
|
+
// agent has no extension tools either — and then it truly has nothing.
|
|
470
|
+
const noExtensionTools = cfg?.isolated === true || cfg?.extensions === false
|
|
471
|
+
return noExtensionTools ? "none" : "no built-ins, extension tools only"
|
|
472
|
+
}
|
|
473
|
+
const isFullSet =
|
|
474
|
+
tools.length === BUILTIN_TOOL_NAMES.length &&
|
|
475
|
+
BUILTIN_TOOL_NAMES.every((t) => tools.includes(t))
|
|
476
|
+
return isFullSet ? "*" : tools.join(", ")
|
|
477
|
+
}
|
|
@@ -210,12 +210,10 @@ function loadOneFile(
|
|
|
210
210
|
builtinToolNames,
|
|
211
211
|
extSelectors,
|
|
212
212
|
mcpToolPatterns,
|
|
213
|
-
// `disallowedTools` is Claude Code's spelling of the key.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
fm.disallowed_tools ?? fm.disallowedTools,
|
|
218
|
-
)?.flatMap((n) => [...new Set([n, normalizeToolName(n)])]),
|
|
213
|
+
// `disallowedTools` is Claude Code's spelling of the key.
|
|
214
|
+
disallowedTools: deniedToolNames(
|
|
215
|
+
csvListOptional(fm.disallowed_tools ?? fm.disallowedTools),
|
|
216
|
+
),
|
|
219
217
|
extensions: inheritField(fm.extensions ?? fm.inherit_extensions),
|
|
220
218
|
excludeExtensions: csvListOptional(fm.exclude_extensions),
|
|
221
219
|
skills: inheritField(fm.skills ?? fm.inherit_skills),
|
|
@@ -416,6 +414,18 @@ function normalizeToolName(name: string): string {
|
|
|
416
414
|
)
|
|
417
415
|
}
|
|
418
416
|
|
|
417
|
+
/**
|
|
418
|
+
* A deny list as the runner applies it. Each entry denies the tool with exactly
|
|
419
|
+
* that name and the pi built-in it maps to, so an extension
|
|
420
|
+
* tool named `glob` stays denied rather than becoming `find`. Shared by an agent
|
|
421
|
+
* file's `disallowed_tools` and a workflow `agent({ disallowedTools })`.
|
|
422
|
+
*/
|
|
423
|
+
export function deniedToolNames(
|
|
424
|
+
names: string[] | undefined,
|
|
425
|
+
): string[] | undefined {
|
|
426
|
+
return names?.flatMap((n) => [...new Set([n, normalizeToolName(n)])])
|
|
427
|
+
}
|
|
428
|
+
|
|
419
429
|
/**
|
|
420
430
|
* Partition the `tools:` CSV into the built-in tool allowlist, raw `ext:` selectors
|
|
421
431
|
* and bare `mcp__` entries. `*` (and the case-insensitive alias `all`, for
|
|
@@ -54,11 +54,13 @@ import {
|
|
|
54
54
|
steerAgent,
|
|
55
55
|
} from "./agent-runner.js"
|
|
56
56
|
import {
|
|
57
|
-
|
|
57
|
+
formatAgentTypeList,
|
|
58
58
|
getAgentConfig,
|
|
59
59
|
getAvailableTypes,
|
|
60
60
|
getConfig,
|
|
61
61
|
getFallbackSubagent,
|
|
62
|
+
getModelLabelFromConfig,
|
|
63
|
+
getToolDescriptionMode,
|
|
62
64
|
isDefaultsDisabled,
|
|
63
65
|
NO_FALLBACK,
|
|
64
66
|
registerAgents,
|
|
@@ -66,6 +68,7 @@ import {
|
|
|
66
68
|
resolveType,
|
|
67
69
|
setDefaultsDisabled,
|
|
68
70
|
setFallbackSubagent,
|
|
71
|
+
setToolDescriptionMode,
|
|
69
72
|
} from "./agent-types.js"
|
|
70
73
|
import { inChildSessionContext } from "./child-context.js"
|
|
71
74
|
import { CompletionOutbox, NOTIFICATION_HOLD_MS } from "./completion-outbox.js"
|
|
@@ -132,6 +135,7 @@ import {
|
|
|
132
135
|
settingSources,
|
|
133
136
|
settingsFilePath,
|
|
134
137
|
type ToolDescriptionMode,
|
|
138
|
+
type WorkflowToolExposureMode,
|
|
135
139
|
} from "./settings.js"
|
|
136
140
|
import {
|
|
137
141
|
getForegroundOutcomeNote,
|
|
@@ -139,7 +143,6 @@ import {
|
|
|
139
143
|
partialOutputSuffix,
|
|
140
144
|
} from "./status-note.js"
|
|
141
145
|
import {
|
|
142
|
-
type AgentConfig,
|
|
143
146
|
type AgentInvocation,
|
|
144
147
|
type AgentMentionMode,
|
|
145
148
|
type AgentRecord,
|
|
@@ -193,6 +196,7 @@ import {
|
|
|
193
196
|
renderWorkflowCard,
|
|
194
197
|
renderWorkflowEntryCard,
|
|
195
198
|
} from "./ui/workflow-card.js"
|
|
199
|
+
import { WorkflowCardRedraws } from "./ui/workflow-card-redraw.js"
|
|
196
200
|
import {
|
|
197
201
|
openWorkflowFromFleet,
|
|
198
202
|
type WorkflowMenuDeps,
|
|
@@ -239,7 +243,7 @@ import {
|
|
|
239
243
|
workflowResultText,
|
|
240
244
|
workflowRunId,
|
|
241
245
|
} from "./workflow/task.js"
|
|
242
|
-
import {
|
|
246
|
+
import { workflowToolDescription } from "./workflow/tool-description.js"
|
|
243
247
|
import {
|
|
244
248
|
isWorktreeIsolationEnabled,
|
|
245
249
|
setWorktreeIsolationEnabled,
|
|
@@ -473,43 +477,6 @@ function buildNotificationDetails(
|
|
|
473
477
|
}
|
|
474
478
|
}
|
|
475
479
|
|
|
476
|
-
/**
|
|
477
|
-
* Format an agent's tool scope for the Agent tool description.
|
|
478
|
-
*
|
|
479
|
-
* This suffix describes BUILT-IN scope only — extension tools are resolved when
|
|
480
|
-
* the agent runs (extensions can register asynchronously), so they cannot be
|
|
481
|
-
* enumerated while the description is being built. That is why an agent with
|
|
482
|
-
* `tools: "*, ext:mcp/search"` renders "*" and always has.
|
|
483
|
-
*
|
|
484
|
-
* Two distinctions matter, both of them capability claims the orchestrator acts on:
|
|
485
|
-
*
|
|
486
|
-
* - absent vs empty. `builtinToolNames: undefined` means the agent never narrowed
|
|
487
|
-
* its tools (the shipped defaults); `[]` is what `tools: none` and an `ext:`-only
|
|
488
|
-
* `tools:` parse to, and the runtime really does hand those agents no built-ins.
|
|
489
|
-
* Rendering both "*" tells the orchestrator a tool-less agent can run `bash`.
|
|
490
|
-
* - empty-with-extensions vs empty-without. Zero built-ins does NOT imply zero
|
|
491
|
-
* tools: `tools: none` alongside `extensions:` still surfaces every extension
|
|
492
|
-
* tool (see test/fixtures/.pi/agents/tools-none.md, which expects three). Calling
|
|
493
|
-
* that "none" understates the agent instead of overstating it — better, but still
|
|
494
|
-
* wrong, and it would route work away from the only agent able to do it. "none"
|
|
495
|
-
* is therefore reserved for agents that genuinely can call nothing: `isolated`
|
|
496
|
-
* agents and those with `extensions: false`.
|
|
497
|
-
*/
|
|
498
|
-
export function formatToolsSuffix(cfg: AgentConfig | undefined): string {
|
|
499
|
-
const tools = cfg?.builtinToolNames
|
|
500
|
-
if (!tools) return "*"
|
|
501
|
-
if (tools.length === 0) {
|
|
502
|
-
// `isolated` overrides extensions to false in the runner, so both mean the
|
|
503
|
-
// agent has no extension tools either — and then it truly has nothing.
|
|
504
|
-
const noExtensionTools = cfg?.isolated === true || cfg?.extensions === false
|
|
505
|
-
return noExtensionTools ? "none" : "no built-ins, extension tools only"
|
|
506
|
-
}
|
|
507
|
-
const isFullSet =
|
|
508
|
-
tools.length === BUILTIN_TOOL_NAMES.length &&
|
|
509
|
-
BUILTIN_TOOL_NAMES.every((t) => tools.includes(t))
|
|
510
|
-
return isFullSet ? "*" : tools.join(", ")
|
|
511
|
-
}
|
|
512
|
-
|
|
513
480
|
/** CLI flag that runs a workflow script at session start. */
|
|
514
481
|
export const WORKFLOW_FILE_FLAG = "subagents-workflow-file"
|
|
515
482
|
|
|
@@ -1815,16 +1782,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1815
1782
|
reloadCustomAgents() // re-register with new setting
|
|
1816
1783
|
}
|
|
1817
1784
|
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
// tool registration — flipping it applies on the next pi session.
|
|
1822
|
-
let toolDescriptionMode: ToolDescriptionMode = "full"
|
|
1823
|
-
function getToolDescriptionMode(): ToolDescriptionMode {
|
|
1824
|
-
return toolDescriptionMode
|
|
1825
|
-
}
|
|
1826
|
-
function setToolDescriptionMode(mode: ToolDescriptionMode): void {
|
|
1827
|
-
toolDescriptionMode = mode
|
|
1785
|
+
let workflowToolExposure: WorkflowToolExposureMode = "inline"
|
|
1786
|
+
function getWorkflowToolExposure(): WorkflowToolExposureMode {
|
|
1787
|
+
return workflowToolExposure
|
|
1828
1788
|
}
|
|
1829
1789
|
|
|
1830
1790
|
// ---- Turn batches for `group` join mode ----
|
|
@@ -2012,44 +1972,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
2012
1972
|
pi.on("agent_end", () => outbox.onAgentEnd())
|
|
2013
1973
|
pi.on("agent_settled", () => outbox.onAgentEnd())
|
|
2014
1974
|
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
const available = getAvailableTypes()
|
|
2018
|
-
|
|
2019
|
-
return available
|
|
2020
|
-
.map((name) => {
|
|
2021
|
-
const cfg = getAgentConfig(name)
|
|
2022
|
-
const modelSuffix = cfg?.model
|
|
2023
|
-
? ` (${getModelLabelFromConfig(cfg.model)})`
|
|
2024
|
-
: ""
|
|
2025
|
-
const toolsSuffix = ` (Tools: ${formatToolsSuffix(cfg)})`
|
|
2026
|
-
return `- ${name}: ${cfg?.description ?? name}${modelSuffix}${toolsSuffix}`
|
|
2027
|
-
})
|
|
2028
|
-
.join("\n")
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
/** First sentence of an agent description — for the compact type list. */
|
|
2032
|
-
const firstSentence = (text: string): string => {
|
|
2033
|
-
const match = text.match(/^.*?[.!?](?=\s|$)/s)
|
|
2034
|
-
return (match ? match[0] : text).replace(/\s+/g, " ").trim()
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
/** Compact type list: one line per agent, first sentence only. */
|
|
1975
|
+
const buildTypeListText = () =>
|
|
1976
|
+
formatAgentTypeList(getAvailableTypes(), getAgentConfig, false)
|
|
2038
1977
|
const buildCompactTypeListText = () =>
|
|
2039
|
-
getAvailableTypes()
|
|
2040
|
-
.map((name) => {
|
|
2041
|
-
const cfg = getAgentConfig(name)
|
|
2042
|
-
return `- ${name}: ${firstSentence(cfg?.description ?? name)} (Tools: ${formatToolsSuffix(cfg)})`
|
|
2043
|
-
})
|
|
2044
|
-
.join("\n")
|
|
2045
|
-
|
|
2046
|
-
/** Derive a short model label from a model string. */
|
|
2047
|
-
function getModelLabelFromConfig(model: string): string {
|
|
2048
|
-
// Strip provider prefix (e.g. "anthropic/claude-sonnet-4-6" → "claude-sonnet-4-6")
|
|
2049
|
-
const name = model.includes("/") ? model.split("/").pop()! : model
|
|
2050
|
-
// Strip trailing date suffix (e.g. "claude-haiku-4-5-20251001" → "claude-haiku-4-5")
|
|
2051
|
-
return name.replace(/-\d{8}$/, "")
|
|
2052
|
-
}
|
|
1978
|
+
formatAgentTypeList(getAvailableTypes(), getAgentConfig, true)
|
|
2053
1979
|
|
|
2054
1980
|
// Apply persisted settings on startup and emit `subagents:settings_loaded`.
|
|
2055
1981
|
// Global + project merged; missing → defaults; corrupt file emits a warning
|
|
@@ -2070,6 +1996,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
2070
1996
|
},
|
|
2071
1997
|
setDisableDefaultAgents: setDisableDefaultAgents,
|
|
2072
1998
|
setToolDescriptionMode: setToolDescriptionMode,
|
|
1999
|
+
setWorkflowToolExposure: (mode) => {
|
|
2000
|
+
workflowToolExposure = mode
|
|
2001
|
+
},
|
|
2073
2002
|
setFleetView: setFleetViewEnabled,
|
|
2074
2003
|
setAgentMentions: setAgentMentionMode,
|
|
2075
2004
|
setRememberAgents,
|
|
@@ -2511,8 +2440,9 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
2511
2440
|
// and picks up the widget, fleet row, transcript, join batching and
|
|
2512
2441
|
// completion notification unchanged. Only the prompt, the turn budget and
|
|
2513
2442
|
// run_in_background carry over from the call: like a live resume, it
|
|
2514
|
-
// ignores `subagent_type`, model and the rest
|
|
2515
|
-
// type's current
|
|
2443
|
+
// ignores `subagent_type`, model, thinking and the rest. It runs under the
|
|
2444
|
+
// agent type's current prompt and tools, on the model and thinking level
|
|
2445
|
+
// its own session recorded (#462) — see the model resolution below.
|
|
2516
2446
|
// `schedule` is left to its own branch, which refuses the combination.
|
|
2517
2447
|
const saved =
|
|
2518
2448
|
callParams.resume !== undefined &&
|
|
@@ -2597,8 +2527,11 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
2597
2527
|
)
|
|
2598
2528
|
|
|
2599
2529
|
// Resolve model from agent config first; tool-call params only fill gaps.
|
|
2600
|
-
|
|
2601
|
-
|
|
2530
|
+
// A reopen resolves none: runAgent leaves the model and thinking level to
|
|
2531
|
+
// the reopened session, which restores the ones the agent ran with. The
|
|
2532
|
+
// agent file and the parent would both override them (#462).
|
|
2533
|
+
let model = reopenOptions ? undefined : ctx.model
|
|
2534
|
+
if (resolvedConfig.modelInput && !reopenOptions) {
|
|
2602
2535
|
const resolved = resolveModel(
|
|
2603
2536
|
resolvedConfig.modelInput,
|
|
2604
2537
|
ctx.modelRegistry,
|
|
@@ -2626,7 +2559,7 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
2626
2559
|
if (scopeVerdict.kind === "warn")
|
|
2627
2560
|
ctx.ui.notify(scopeVerdict.message, "warning")
|
|
2628
2561
|
|
|
2629
|
-
const thinking = resolvedConfig.thinking
|
|
2562
|
+
const thinking = reopenOptions ? undefined : resolvedConfig.thinking
|
|
2630
2563
|
const inheritContext = resolvedConfig.inheritContext
|
|
2631
2564
|
const runInBackground = resolvedConfig.runInBackground
|
|
2632
2565
|
const isolated = resolvedConfig.isolated
|
|
@@ -3290,6 +3223,21 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3290
3223
|
*/
|
|
3291
3224
|
const workflowTasks = new Map<string, WorkflowTask>()
|
|
3292
3225
|
|
|
3226
|
+
/**
|
|
3227
|
+
* pi's renderer mode, as last seen on a TUI the fleet list was drawn into.
|
|
3228
|
+
* Remembered rather than read off the list's live handle, which pi clears on
|
|
3229
|
+
* every theme change and mode switch until the list registers again. Before
|
|
3230
|
+
* any draw, pi's own setting, normalized as its `getTuiMode()` does; that
|
|
3231
|
+
* misses a `--tui-mode` flag, which no extension API exposes.
|
|
3232
|
+
*/
|
|
3233
|
+
let seenTuiMode: string | undefined
|
|
3234
|
+
const tuiMode = () =>
|
|
3235
|
+
seenTuiMode ??
|
|
3236
|
+
(pi.getSettings().tuiMode === "regular" ? "regular" : "fullscreen")
|
|
3237
|
+
const workflowCards = new WorkflowCardRedraws(
|
|
3238
|
+
() => tuiMode() === "fullscreen",
|
|
3239
|
+
)
|
|
3240
|
+
|
|
3293
3241
|
/**
|
|
3294
3242
|
* Workflow runs as the fleet list wants them.
|
|
3295
3243
|
*
|
|
@@ -3308,6 +3256,11 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3308
3256
|
status: task.status,
|
|
3309
3257
|
doneCount: task.doneCount,
|
|
3310
3258
|
totalCount: task.agentCount,
|
|
3259
|
+
// A settled run has no phase in progress; a paused one is still in its.
|
|
3260
|
+
phase:
|
|
3261
|
+
task.status === "running" || task.status === "paused"
|
|
3262
|
+
? task.phaseLabel
|
|
3263
|
+
: "",
|
|
3311
3264
|
startedAt: task.startTime,
|
|
3312
3265
|
...(task.endTime !== undefined ? { completedAt: task.endTime } : {}),
|
|
3313
3266
|
tokens: task.totalTokens,
|
|
@@ -3337,7 +3290,11 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3337
3290
|
rootSessionId: ctx.sessionManager.getSessionId(),
|
|
3338
3291
|
workflowId: task.id,
|
|
3339
3292
|
}),
|
|
3340
|
-
onProgress: (entries) =>
|
|
3293
|
+
onProgress: (entries) => {
|
|
3294
|
+
if (entries.length === 0) return
|
|
3295
|
+
updateWorkflowProgressBatch(task, entries)
|
|
3296
|
+
workflowCards.request(task.id)
|
|
3297
|
+
},
|
|
3341
3298
|
// The dialog's pause / skip / retry keys run through this; it is dropped
|
|
3342
3299
|
// again when the task settles.
|
|
3343
3300
|
onControl: (control) => {
|
|
@@ -3367,6 +3324,7 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3367
3324
|
function notifyWorkflowFinished(task: WorkflowTask) {
|
|
3368
3325
|
widget.update()
|
|
3369
3326
|
fleet.update()
|
|
3327
|
+
workflowCards.flush(task.id)
|
|
3370
3328
|
const result = workflowResultText(task)
|
|
3371
3329
|
const message = {
|
|
3372
3330
|
content: formatWorkflowNotification(task),
|
|
@@ -3398,11 +3356,16 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3398
3356
|
const workflowTool = defineTool({
|
|
3399
3357
|
name: SUBAGENT_TOOL_NAMES.WORKFLOW,
|
|
3400
3358
|
label: "SubagentWorkflow",
|
|
3401
|
-
|
|
3359
|
+
// `deferred`: not declared to the model until pi's `tool_search` loads it.
|
|
3360
|
+
...(getWorkflowToolExposure() === "deferred"
|
|
3361
|
+
? { exposure: "deferred" as const }
|
|
3362
|
+
: {}),
|
|
3363
|
+
description: renderToolDescriptionTemplate(
|
|
3364
|
+
workflowToolDescription(getWorkflowToolExposure()),
|
|
3365
|
+
),
|
|
3402
3366
|
promptSnippet:
|
|
3403
3367
|
"Run a deterministic script that orchestrates many subagents",
|
|
3404
3368
|
promptGuidelines: [
|
|
3405
|
-
"Use SubagentWorkflow when the number of agents depends on something discovered at runtime, when work flows through stages, or when findings should be independently verified. Use Agent for one delegated task or a handful you can name up front.",
|
|
3406
3369
|
"Prefer `pipeline` over `parallel` — a barrier costs wall-clock whenever the stages are unevenly sized.",
|
|
3407
3370
|
"A workflow runs in the background and notifies you when it finishes — do not poll or sleep waiting for it.",
|
|
3408
3371
|
],
|
|
@@ -3473,6 +3436,21 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3473
3436
|
// No task means the run predates this session (a reloaded transcript) or
|
|
3474
3437
|
// the call never started one — show what `execute` said instead.
|
|
3475
3438
|
if (renderContext.isError || !task) return new Text(text, 0, 0)
|
|
3439
|
+
if (task.status === "running" || task.status === "paused") {
|
|
3440
|
+
workflowCards.track(task.id, renderContext.invalidate)
|
|
3441
|
+
// A card that cannot follow the run says where to watch it instead of
|
|
3442
|
+
// showing a launch-time snapshot that reads as live.
|
|
3443
|
+
if (tuiMode() !== "fullscreen") {
|
|
3444
|
+
return new Text(
|
|
3445
|
+
theme.fg(
|
|
3446
|
+
"dim",
|
|
3447
|
+
` ⎿ Running in background (ID: ${task.id}) · /agents → Workflows`,
|
|
3448
|
+
),
|
|
3449
|
+
0,
|
|
3450
|
+
0,
|
|
3451
|
+
)
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3476
3454
|
return renderWorkflowCard(
|
|
3477
3455
|
{
|
|
3478
3456
|
progress: task.workflowProgress,
|
|
@@ -3639,9 +3617,18 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3639
3617
|
ownDescription: workflowTool.description,
|
|
3640
3618
|
pinned: isWorkflowsPinned(),
|
|
3641
3619
|
})
|
|
3642
|
-
if (verdict.kind === "none")
|
|
3643
|
-
|
|
3644
|
-
|
|
3620
|
+
if (verdict.kind === "none" || verdict.kind === "report") {
|
|
3621
|
+
if (verdict.kind === "report") warn(verdict.message)
|
|
3622
|
+
// pi's own warning for unreachable deferred tools covers MCP servers only.
|
|
3623
|
+
if (
|
|
3624
|
+
workflowTool.exposure === "deferred" &&
|
|
3625
|
+
!pi.getActiveTools().includes("tool_search")
|
|
3626
|
+
) {
|
|
3627
|
+
warn(
|
|
3628
|
+
'workflowToolExposure is "deferred" but tool_search is inactive, so the model cannot load SubagentWorkflow. ' +
|
|
3629
|
+
'Add "+tool_search" to defaultTools in .pi/settings.json, or set workflowToolExposure to "skill".',
|
|
3630
|
+
)
|
|
3631
|
+
}
|
|
3645
3632
|
return
|
|
3646
3633
|
}
|
|
3647
3634
|
|
|
@@ -3651,6 +3638,10 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3651
3638
|
warn(verdict.message)
|
|
3652
3639
|
|
|
3653
3640
|
if (!verdict.withdraw) return
|
|
3641
|
+
// An inactive deferred tool stays searchable and callable; only `hidden`
|
|
3642
|
+
// exposure takes it out of reach, and tools cannot be unregistered.
|
|
3643
|
+
if (workflowTool.exposure === "deferred")
|
|
3644
|
+
pi.registerTool({ ...workflowTool, exposure: "hidden" })
|
|
3654
3645
|
const active = pi.getActiveTools()
|
|
3655
3646
|
if (active.includes(SUBAGENT_TOOL_NAMES.WORKFLOW)) {
|
|
3656
3647
|
pi.setActiveTools(
|
|
@@ -4074,6 +4065,7 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
4074
4065
|
strictAgentFiles,
|
|
4075
4066
|
disableDefaultAgents: isDefaultsDisabled(),
|
|
4076
4067
|
toolDescriptionMode: getToolDescriptionMode(),
|
|
4068
|
+
workflowToolExposure: getWorkflowToolExposure(),
|
|
4077
4069
|
fleetView: isFleetViewEnabled(),
|
|
4078
4070
|
agentMentions: getAgentMentionMode(),
|
|
4079
4071
|
rememberAgents: getRememberAgents(),
|
|
@@ -4337,6 +4329,17 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
4337
4329
|
currentValue: isWorkflowsEnabled() ? "on" : "off",
|
|
4338
4330
|
values: ["on", "off"],
|
|
4339
4331
|
},
|
|
4332
|
+
{
|
|
4333
|
+
id: "workflowToolExposure",
|
|
4334
|
+
label: "Workflow tool exposure",
|
|
4335
|
+
description:
|
|
4336
|
+
"Where the SubagentWorkflow script reference reaches the model: inline (default — in the tool description, " +
|
|
4337
|
+
"always read) or skill (~4k fewer tokens per session; the description points at the bundled skill file, " +
|
|
4338
|
+
"which the model must choose to read before writing a script) or deferred (not in the tool spec until " +
|
|
4339
|
+
"pi's tool_search loads it, then inline; requires tool_search). Applies on next pi session",
|
|
4340
|
+
currentValue: getWorkflowToolExposure(),
|
|
4341
|
+
values: ["inline", "skill", "deferred"],
|
|
4342
|
+
},
|
|
4340
4343
|
{
|
|
4341
4344
|
id: "worktreeIsolation",
|
|
4342
4345
|
label: "Worktree isolation",
|
|
@@ -4651,6 +4654,13 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
4651
4654
|
target,
|
|
4652
4655
|
`Tool description set to ${value}. Takes effect on next pi session.`,
|
|
4653
4656
|
)
|
|
4657
|
+
} else if (id === "workflowToolExposure") {
|
|
4658
|
+
workflowToolExposure = value as WorkflowToolExposureMode
|
|
4659
|
+
notifyApplied(
|
|
4660
|
+
ctx,
|
|
4661
|
+
target,
|
|
4662
|
+
`Workflow tool exposure set to ${value}. Takes effect on next pi session.`,
|
|
4663
|
+
)
|
|
4654
4664
|
} else if (id === "reportUsage") {
|
|
4655
4665
|
const enabled = value === "on"
|
|
4656
4666
|
setReportUsage(enabled)
|
|
@@ -4829,11 +4839,17 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
4829
4839
|
// SAFETY: ExtensionContext and ExtensionCommandContext share the runtime
|
|
4830
4840
|
// UI/session fields used by persistSettings; the value can also be absent.
|
|
4831
4841
|
getCtx: () => currentCtx as unknown as ExtensionCommandContext | undefined,
|
|
4842
|
+
onTaskChange: (task) => workflowCards.request(task.id),
|
|
4832
4843
|
}
|
|
4833
4844
|
|
|
4834
4845
|
fleet.setWorkflowSource(fleetWorkflows, (id) =>
|
|
4835
4846
|
openWorkflowFromFleet(id, workflowMenuDeps),
|
|
4836
4847
|
)
|
|
4848
|
+
fleet.setTuiModeObserver((mode) => {
|
|
4849
|
+
const was = tuiMode()
|
|
4850
|
+
seenTuiMode = mode
|
|
4851
|
+
if (mode !== was) workflowCards.redrawAll()
|
|
4852
|
+
})
|
|
4837
4853
|
|
|
4838
4854
|
const { showAgentsMenu } = createAgentsMenu({
|
|
4839
4855
|
pi,
|
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
} from "@earendil-works/pi-coding-agent"
|
|
65
65
|
import { runInChildSessionContext } from "./child-context.js"
|
|
66
66
|
import { agentMentionReminder } from "./mention.js"
|
|
67
|
+
import { withoutCwdSection } from "./prompts.js"
|
|
67
68
|
import type { SubagentType } from "./types.js"
|
|
68
69
|
|
|
69
70
|
export interface MentionCloneOptions {
|
|
@@ -152,8 +153,11 @@ export async function runMentionClone(
|
|
|
152
153
|
// The live system prompt, not the one the clone would build from cwd and
|
|
153
154
|
// agentDir — extensions contribute to it per turn. Everything the loader
|
|
154
155
|
// would add on top (AGENTS.md, skills, APPEND_SYSTEM.md) is already in the
|
|
155
|
-
// rendered prompt, so it is suppressed, as agent-runner does.
|
|
156
|
-
|
|
156
|
+
// rendered prompt, so it is suppressed, as agent-runner does. The `cwd`
|
|
157
|
+
// section cannot be suppressed — pi renders it after any prompt — so the
|
|
158
|
+
// parent's copy is removed instead. Extension sections stay: the clone
|
|
159
|
+
// loads no extensions to render them again.
|
|
160
|
+
const systemPrompt = withoutCwdSection(ctx.getSystemPrompt(), ctx.cwd)
|
|
157
161
|
const loader = new DefaultResourceLoader({
|
|
158
162
|
cwd: ctx.cwd,
|
|
159
163
|
agentDir: getAgentDir(),
|