@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
|
@@ -13,6 +13,17 @@ export function isLazyProxyTui(tui: any): boolean {
|
|
|
13
13
|
return typeof probe === "function" && probe !== tui.requestRender;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** The actual screen mode, independent of whether the host exposes a lazy Proxy. */
|
|
17
|
+
export function isFullscreenTui(tui: unknown): boolean {
|
|
18
|
+
if (tui === null || typeof tui !== "object") return false;
|
|
19
|
+
try {
|
|
20
|
+
return (tui as { mode?: unknown }).mode === "fullscreen";
|
|
21
|
+
} catch {
|
|
22
|
+
// A renderer-switching or disposed host reference is not an active screen.
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
type MainScreenDoRenderPatch = {
|
|
17
28
|
active: boolean;
|
|
18
29
|
original: (lines: string[]) => string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-cc-extensions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21-local.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A Pi productivity suite with Claude Code-style UI, context inspection, and agent/session references",
|
|
6
6
|
"type": "module",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
},
|
|
75
75
|
"x-upstream": {
|
|
76
76
|
"package": "pi-cc-extensions",
|
|
77
|
-
"version": "1.0.
|
|
78
|
-
"reviewedVersion": "1.0.
|
|
77
|
+
"version": "1.0.21",
|
|
78
|
+
"reviewedVersion": "1.0.21",
|
|
79
79
|
"repository": "https://github.com/minuque/pi-cc-extensions",
|
|
80
|
-
"commit": "
|
|
80
|
+
"commit": "9a0ecdd29f9cecca9c34ae591b0de85896f2c07e",
|
|
81
81
|
"trackVersion": true
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# @herbertgao/pi-inline-skill-commands
|
|
2
2
|
|
|
3
|
-
Use Pi's native `/skill:name` commands within a larger prompt. At token boundaries, autocomplete lists only skills and completion preserves the surrounding text. Submitting expands the skill
|
|
3
|
+
Use Pi's native `/skill:name` commands within a larger prompt. At token boundaries, autocomplete lists only skills and completion preserves the surrounding text. Submitting expands the skill as the same collapsed invocation block a start-of-prompt command produces, and keeps your original sentence, command included, as the request below it.
|
|
4
4
|
|
|
5
5
|
```text
|
|
6
6
|
Please use /skill:pdf-tools to extract report.pdf
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
That prompt renders as the collapsed skill block followed by `Please use /skill:pdf-tools to extract report.pdf`, so the sentence stays readable and the skill still loads.
|
|
10
|
+
|
|
9
11
|
Commands at the start of the prompt remain entirely native. This package does not add `/<name>` aliases or a second skill list, so it does not duplicate Pi's native skill entries. Ordinary commands such as `/model` remain start-only. URL and path slashes do not trigger skill completion.
|
|
10
12
|
|
|
11
13
|
## Install
|
|
@@ -20,7 +22,7 @@ For a local checkout:
|
|
|
20
22
|
pi install /absolute/path/to/pi-extensions/packages/pi-inline-skill-commands
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
Restart Pi or run `/reload` after installation.
|
|
25
|
+
Restart Pi or run `/reload` after installation. If `@herbertgao/pi-extensions` already provides this extension, do not install the standalone package as well.
|
|
24
26
|
|
|
25
27
|
## Compatibility
|
|
26
28
|
|
|
@@ -28,6 +30,8 @@ Pi currently filters `/` out of extension-provided autocomplete trigger characte
|
|
|
28
30
|
|
|
29
31
|
Skill discovery and the native start-of-prompt behavior use Pi's public APIs. Submission expansion reconstructs a snapshot of configured, default-directory, and package skills. Pi does not expose the active resource loader to extensions, so CLI-only `--skill` paths and skill paths injected dynamically by other extensions are not expanded by this package. Use the same `/reload` workflow after changing skills as with native skill commands.
|
|
30
32
|
|
|
33
|
+
Only a command after other text is expanded here. A prompt that starts with `/skill:name` goes to Pi's native path, which expands just that first command, so a second command later in the same message stays literal. Expansion also matches only names Pi actually loaded, longest first: an unknown longer token such as `/skill:test_x` is left alone rather than expanding a shorter `test`.
|
|
34
|
+
|
|
31
35
|
## License
|
|
32
36
|
|
|
33
37
|
[MIT](LICENSE)
|
|
@@ -14,12 +14,29 @@ import type {
|
|
|
14
14
|
EditorComponent,
|
|
15
15
|
} from "@earendil-works/pi-tui"
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
17
|
+
const MID_SKILL_BOUNDARY =
|
|
18
|
+
"[\\s\\u3000\\u00a0\\u2007\\u202f\\u203f\\u2060\\ufeff,。!?;:、()【】《》「」『』([{<`]"
|
|
19
|
+
const MID_SKILL_TOKEN = new RegExp(`(?:^|${MID_SKILL_BOUNDARY})(\\/[^\\s/]*)$`)
|
|
20
|
+
const MID_SKILL_COMMAND = new RegExp(`(^|${MID_SKILL_BOUNDARY})\\/skill:`)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
function escapeRegExp(value: string): string {
|
|
23
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Match only names Pi actually loaded, longest first, so `/skill:test_x` never falls back
|
|
28
|
+
* to a shorter `test`. The lookahead still allows sentence punctuation (`.`, `,`, `,`).
|
|
29
|
+
*/
|
|
30
|
+
function buildSkillCommandPattern(skills: SkillMap): RegExp {
|
|
31
|
+
const names = [...skills.keys()]
|
|
32
|
+
.toSorted((a, b) => b.length - a.length)
|
|
33
|
+
.map(escapeRegExp)
|
|
34
|
+
return new RegExp(
|
|
35
|
+
`(^|${MID_SKILL_BOUNDARY})(\\/skill:(${names.join("|")}))(?!\\.?[A-Za-z0-9_-])`,
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type SkillDefinition = Pick<Skill, "name" | "filePath" | "baseDir">
|
|
23
40
|
type SkillMap = ReadonlyMap<string, SkillDefinition>
|
|
24
41
|
|
|
25
42
|
interface TriggerableEditor extends EditorComponent {
|
|
@@ -115,23 +132,24 @@ export function expandMidSkillCommand(
|
|
|
115
132
|
text: string,
|
|
116
133
|
skills: SkillMap,
|
|
117
134
|
): string | undefined {
|
|
118
|
-
|
|
135
|
+
// Idempotent: a second copy of this handler must not nest another skill block.
|
|
136
|
+
if (text.startsWith("<skill ") || skills.size === 0) return undefined
|
|
137
|
+
const match = buildSkillCommandPattern(skills).exec(text)
|
|
119
138
|
if (!match) return undefined
|
|
120
139
|
|
|
121
140
|
const boundary = match[1] ?? ""
|
|
122
|
-
const
|
|
123
|
-
const commandIndex = match.index + boundary.length
|
|
124
|
-
const prefix = text.slice(0, commandIndex)
|
|
141
|
+
const prefix = text.slice(0, match.index + boundary.length)
|
|
125
142
|
if (!prefix.trim()) return undefined
|
|
126
143
|
|
|
127
144
|
const skill = skills.get(match[3] ?? "")
|
|
128
145
|
if (!skill) return undefined
|
|
129
146
|
|
|
130
147
|
const content = stripFrontmatter(readFileSync(skill.filePath, "utf-8")).trim()
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
148
|
+
// Pi collapses a skill invocation only when the block starts the message. Keep the block
|
|
149
|
+
// first and the original sentence, command included, as the user message. The references
|
|
150
|
+
// line matches Pi's own expansion so both paths feed the model the same skill text.
|
|
151
|
+
const block = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${content}\n</skill>`
|
|
152
|
+
return `${block}\n\n${text.trim()}`
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
export function wrapMidSkillTrigger<T extends EditorComponent>(editor: T): T {
|
|
@@ -157,7 +175,8 @@ export function wrapMidSkillTrigger<T extends EditorComponent>(editor: T): T {
|
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
function installMidSkillTrigger(): void {
|
|
160
|
-
// SAFETY:
|
|
178
|
+
// SAFETY: `handleInput` is an own property of CustomEditor.prototype and is replaced here;
|
|
179
|
+
// the trigger members come from Editor.prototype and are feature-checked before use.
|
|
161
180
|
const prototype = CustomEditor.prototype as unknown as TriggerableEditor
|
|
162
181
|
if (prototype.inlineSkillCommandsTriggerInstalled) return
|
|
163
182
|
wrapMidSkillTrigger(prototype)
|
|
@@ -179,7 +198,14 @@ async function loadSessionSkills(ctx: ExtensionContext): Promise<SkillMap> {
|
|
|
179
198
|
noContextFiles: true,
|
|
180
199
|
})
|
|
181
200
|
await loader.reload()
|
|
182
|
-
return new Map(
|
|
201
|
+
return new Map(
|
|
202
|
+
loader
|
|
203
|
+
.getSkills()
|
|
204
|
+
.skills.map((skill) => [
|
|
205
|
+
skill.name,
|
|
206
|
+
{ name: skill.name, filePath: skill.filePath, baseDir: skill.baseDir },
|
|
207
|
+
]),
|
|
208
|
+
)
|
|
183
209
|
}
|
|
184
210
|
|
|
185
211
|
export default function piInlineSkillCommands(pi: ExtensionAPI): void {
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.1-local.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#392](https://github.com/HerbertGao/pi-extensions/pull/392) [`e233ef6`](https://github.com/HerbertGao/pi-extensions/commit/e233ef6cee8184ff322521eae67bfa2b57bf483d) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Replay upstream pi-subagents 0.26.1. Reopening an agent keeps the model and thinking level from its session, and warns if Pi has to fall back. A mention clone shows the working directory once. The nested Agent tool lists the allowed agent types. A failed worktree cleanup and an unread result still stay recoverable.
|
|
8
|
+
|
|
9
|
+
## 0.26.0-local.1
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#390](https://github.com/HerbertGao/pi-extensions/pull/390) [`41ed7b5`](https://github.com/HerbertGao/pi-extensions/commit/41ed7b581cf97b537939972049182036fbd9ee3b) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Replay upstream pi-subagents 0.26.0. Asking for a number of agents runs those agents in parallel unless you ask for a workflow. A workflow schema is checked before the agent starts, a failed call can explain why, and the script reference can move into a skill. Unconsumed results and a failed worktree cleanup still stay recoverable.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#390](https://github.com/HerbertGao/pi-extensions/pull/390) [`41ed7b5`](https://github.com/HerbertGao/pi-extensions/commit/41ed7b581cf97b537939972049182036fbd9ee3b) Thanks [@HerbertGao](https://github.com/HerbertGao)! - A background workflow card scheduled while fullscreen does not redraw again after the session leaves fullscreen. That extra redraw was clearing scrollback.
|
|
18
|
+
|
|
3
19
|
## 0.25.0-local.1
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @herbertgao/pi-subagents
|
|
2
2
|
|
|
3
|
-
A [pi](https://pi.dev) extension that brings **Claude Code-style autonomous sub-agents and workflow orchestration** to pi. Spawn specialized agents that run in isolated sessions — each with its own tools, system prompt, model, and thinking level. Run them in the background (the default) or block on them, steer them mid-run, resume completed sessions, and define your own custom agent types. When the orchestration shouldn't be improvised, hand a deterministic JavaScript script to the `SubagentWorkflow` tool — `agent()`, `parallel()`, `pipeline()` — and scripts written for Claude Code's `Workflow` tool run here
|
|
3
|
+
A [pi](https://pi.dev) extension that brings **Claude Code-style autonomous sub-agents and workflow orchestration** to pi. Spawn specialized agents that run in isolated sessions — each with its own tools, system prompt, model, and thinking level. Run them in the background (the default) or block on them, steer them mid-run, resume completed sessions, and define your own custom agent types. When the orchestration shouldn't be improvised, hand a deterministic JavaScript script to the `SubagentWorkflow` tool — `agent()`, `parallel()`, `pipeline()` — and scripts written for Claude Code's `Workflow` tool run here, with a short list of [differences](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/workflows.md#coming-from-claude-code).
|
|
4
4
|
|
|
5
5
|
<img width="600" alt="pi-subagents screenshot" src="https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-subagents/media/screenshot.png" />
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ https://github.com/user-attachments/assets/8685261b-9338-4fea-8dfe-1c590d5df543
|
|
|
19
19
|
- **Package-shipped agents** — a pi package can declare its own subagents (and workflow scripts) with `"pi": { "subagents": { "agents": ["./agents"] } }` in its `package.json`, so `pi install` is the whole setup: no copying files into `.pi/agents/` on every machine or container start. Only packages pi has actually installed are read (never `node_modules`), package definitions rank below every agent you wrote, and `/agents` shows them read-only with Eject and Disable. Narrow or switch it off with `packageAgents` / `packageWorkflows`. **[Full guide](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/packages.md)**
|
|
20
20
|
- **Nested subagents** — the built-in `general-purpose` agent can delegate to subagents of its own, as in Claude Code; `Explore` and `Plan` cannot, and a custom agent opts in by setting `allowed_subagents`. A delegating agent gets its own ownership-scoped `Agent`, `get_subagent_result`, and `steer_subagent` tools, depth-capped from the main session (default 2). It can control only its own children, they are stopped when it finishes, and their transcripts and token spend roll up to it. The allowlist is a privilege boundary — a child runs with its own tools, so pick it as carefully as `tools:` itself
|
|
21
21
|
- **Agent mentions** — subagents are first-class: type `@explore also check the RPC path` at the prompt and it goes to that agent instead of the main model, without a word of it entering the chat. One syntax covers the whole lifecycle — message it while it runs, resume it once it has finished, reopen its session from disk long after that, or start it if it never ran. Mentioning an agent that isn't running spawns it through an off-screen clone of the conversation, so it gets Claude Code's context-written prompt and a real `Agent` tool call without a word of it reaching the chat; `direct` mode starts it here from your text instead, with no model call at all. The orchestrator can `name` an agent so you address it as `@auth-audit`, and handles work in `steer_subagent`/`get_subagent_result` too. `@` completes live agents, resumable ones, and startable types alongside pi's file completion; `@main` forces text back to the main model. Toggle via `/agents → Settings → Agent mentions`
|
|
22
|
-
- **Scripted workflows** — a `SubagentWorkflow` tool that runs a deterministic JavaScript script orchestrating many subagents: `agent()`, `parallel()`, `pipeline()`, `phase()`, `log()` and `args`, with a pure-literal `meta` block declaring the phases. `pipeline()` has no barrier between stages, so one item can be in a later stage while another is still in the first — unlike `parallel()`, which idles every fast agent until the slowest finishes. Runs in the background with a live card, inspectable via `/agents → Workflows` or by selecting the run in FleetView. `agent()` also takes `gate: "npm test"` to verify a child by running a command (inside its worktree, when isolated) rather than asking another model, and `resume: "<label>"` to continue a child instead of re-paying its context. Scripts run in a `node:vm` sandbox on a worker thread where `Date.now()`, `Math.random()` and `eval` throw. On by default, but it stands down for company: if another extension already provides a `Workflow` or `SubagentWorkflow` tool, this one warns and disables itself for the session rather than offering the model two orchestrators. Pin it either way with `"workflowsEnabled"` in `subagents.json` or `/agents → Settings → Workflows`. A script written for Claude Code's `Workflow` tool runs here
|
|
22
|
+
- **Scripted workflows** — a `SubagentWorkflow` tool that runs a deterministic JavaScript script orchestrating many subagents: `agent()`, `parallel()`, `pipeline()`, `phase()`, `log()` and `args`, with a pure-literal `meta` block declaring the phases. `pipeline()` has no barrier between stages, so one item can be in a later stage while another is still in the first — unlike `parallel()`, which idles every fast agent until the slowest finishes. Runs in the background with a live card, inspectable via `/agents → Workflows` or by selecting the run in FleetView. `agent()` also takes `gate: "npm test"` to verify a child by running a command (inside its worktree, when isolated) rather than asking another model, and `resume: "<label>"` to continue a child instead of re-paying its context. Scripts run in a `node:vm` sandbox on a worker thread where `Date.now()`, `Math.random()` and `eval` throw. On by default, but it stands down for company: if another extension already provides a `Workflow` or `SubagentWorkflow` tool, this one warns and disables itself for the session rather than offering the model two orchestrators. Pin it either way with `"workflowsEnabled"` in `subagents.json` or `/agents → Settings → Workflows`. A script written for Claude Code's `Workflow` tool runs here, with the [listed differences](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/workflows.md#coming-from-claude-code): same globals and strict mode, the return value copied the same way, `disallowedTools`, `schema` returns a validated object exactly as it does there, `budget` is present and always reports no token target (pi has no such directive) so its `budget.total`-guarded patterns still take the branch they were written for, and nested `workflow()` composes saved workflows one level deep. The script-writing reference ships as the `workflow-authoring` skill (`/skill:workflow-authoring`) and is part of the tool description by default; [`workflowToolExposure: "skill"`](#persistent-settings) swaps it for a pointer to the skill, about 4k tokens lighter per session, and `"deferred"` leaves the tool out of the spec until pi's `tool_search` loads it. **[Full guide](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/workflows.md)**
|
|
23
23
|
- **Mid-run steering** — inject messages into running agents to redirect their work without restarting
|
|
24
24
|
- **Session resume** — pick up where an agent left off, preserving full conversation context. Resumes detached by default and notifies you on completion, just like a fresh spawn; pass `run_in_background: false` to block and get the result inline
|
|
25
25
|
- **Graceful turn limits** — agents get a "wrap up" warning before hard abort, producing clean partial results instead of cut-off output
|
|
@@ -146,7 +146,7 @@ While subagents are running, a Claude Code-style navigable list renders **below*
|
|
|
146
146
|
esc to interrupt · ← for agents · ↓ to manage
|
|
147
147
|
|
|
148
148
|
● main
|
|
149
|
-
○ workflow
|
|
149
|
+
○ workflow audit ▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱▱▱▱ 3/9 agents · Fixing (1/2) 32s · ↓ 26.4k tokens
|
|
150
150
|
❯ ○ general-purpose Review the auth module 41s · ↓ 13.1k tokens
|
|
151
151
|
├ ○ Explore Find session handling 28s · ↓ 22.7k tokens
|
|
152
152
|
└ ○ Explore Find token refresh 27s · ↓ 19.4k tokens
|
|
@@ -155,7 +155,7 @@ While subagents are running, a Claude Code-style navigable list renders **below*
|
|
|
155
155
|
|
|
156
156
|
Subagents spawned by a subagent (nested delegation) are listed indented under their parent with `├`/`└`, and can be opened, steered and stopped like any other row. Each row's tokens and cost are that agent's own; a parent's figure excludes its children, which have rows of their own. Outside FleetView a parent still reports the rolled-up total, since nested children appear nowhere else.
|
|
157
157
|
|
|
158
|
-
Running [workflows](#subagentworkflow) appear as a single `workflow`
|
|
158
|
+
Running [workflows](#subagentworkflow) appear as a single row above the agents: a `workflow` label where an agent has its type, the run's name, then a twenty-cell progress bar of finished agents, the `done/total agents` count, and the phases with work outstanding (`Fixing (1/2)`, or `Fixing & Testing` when a pipeline has two in flight) in place of a description. `Enter` on one opens the same two-pane inspector `/agents → Workflows` does, rather than a conversation overlay. A run's own agents are _not_ listed separately — they belong to the run, which reports for them, so they are filtered out of the fleet list, the above-editor widget, the `/agents` menus and `@handle` resolution (nested children are filtered from all of those but the fleet list). They are also outside the `maxConcurrent` pool: the run has its own concurrency cap, and routing a fan-out through the session pool as well would let one workflow starve everything else. The agents are ordered earliest-launched first, and only agents you can actually open are shown (pending/queued agents with no session yet appear once they start). At an **empty prompt**, press `↓` (or `←`) to move focus from the prompt into the list — the selected row is marked with the `❯` cursor. `●` marks the view in front (`main`, or the agent whose overlay is open), `○` the rest. The selected row renders in the theme's primary text color rather than the muted/dim treatment of the others; an agent with a configured `color` shows its badge there too, bolded. `↑`/`↓` move the selection, `Enter` opens the selected agent's live conversation overlay (it auto-updates as the agent works), and `Esc` (or `↑` above `main`) returns to the prompt. Selecting `main` returns to the normal view. Inside the overlay, press `Enter` to steer the running agent — type a message and `Enter` to send it (`Esc` or an empty submit returns), and it redirects the agent the same way the `steer_subagent` tool does. On a running foreground `Agent` call, press `b` to hand that run to the background; the hint only shows where the handoff is available. A viewer stays open when its agent finishes so you can read the final output, and finished agents linger in the list for a few seconds before dropping out. Typing anything at a non-empty prompt behaves normally — the list only captures arrow keys when the prompt is empty. In fullscreen mode the mouse works too: hovering a row moves the `❯` cursor to it, and clicking a row opens it as `Enter` would (under tmux or screen, pi tracks clicks but not hover; regular mode has no mouse). Disable it entirely via `/agents → Settings → Fleet view`.
|
|
159
159
|
|
|
160
160
|
### Fullscreen conversation observer
|
|
161
161
|
|
|
@@ -228,7 +228,7 @@ Two things to weigh against `direct`: the clone re-sends the whole conversation,
|
|
|
228
228
|
|
|
229
229
|
**Named agents.** The `Agent` tool takes an optional `name`, so the orchestrator can call one `auth-audit` instead of leaving you to tell `@explore-2` from `@explore-3`. A name is _additive_: the type-derived handle is still assigned, so `@explore` keeps reaching that agent rather than starting a second one beside it. Both names share one namespace — an alias can never shadow a live handle or the reverse — and the popup shows one row per agent, under its alias, with the type moved into the description. `steer_subagent` and `get_subagent_result` accept a handle too, so you and the model address agents the same way.
|
|
230
230
|
|
|
231
|
-
**Resuming much later.** Because subagent sessions are persisted by default ([`rememberAgents`](#persistent-settings)), a handle keeps working after the agent's in-memory record is evicted: `@explore anything else?` reopens the conversation from disk. Only the _definition_ is re-resolved, so a continuation runs under the agent type's current
|
|
231
|
+
**Resuming much later.** Because subagent sessions are persisted by default ([`rememberAgents`](#persistent-settings)), a handle keeps working after the agent's in-memory record is evicted: `@explore anything else?` reopens the conversation from disk. Only the _definition_ is re-resolved, so a continuation runs under the agent type's current prompt and tools, not the ones the first run used. The model and thinking level are the ones the session recorded; if that model can no longer be used, pi falls back to its default and warns. If the type has since been deleted or disabled, the resume is refused rather than falling back to another agent — re-enable it and the handle works again. Names from an evicted agent stay reserved, so a later Explore becomes `explore-2` rather than shadowing something you can still reach; the 100 most recent are kept, and all of them are forgotten on `/new` and session switch. A resumed agent takes those names back, so `@explore` keeps meaning the same conversation. An agent whose session was only ever in memory leaves nothing to reopen, and the mention starts a fresh one instead; if the session file has since been deleted, the mention says so and frees the handle rather than silently sending your message to a new agent.
|
|
232
232
|
|
|
233
233
|
The grammar mirrors Claude Code's, and is deliberately narrow so nothing gets swallowed by accident:
|
|
234
234
|
|
|
@@ -379,6 +379,8 @@ allowed_subagents: support-file-finder, support-callsite-tracer # or `all`
|
|
|
379
379
|
|
|
380
380
|
**The allowlist is a privilege boundary, not just a routing hint.** A child runs with _its own_ `tools:`, `extensions:`, and `isolated:` — the parent's restrictions are not inherited — so delegation grants the parent the union of what the listed agents can do. The read-only agent above can write and run commands through any listed agent that can, and `all` reaches every enabled agent including `general-purpose`. Choose the list as carefully as you would choose `tools:` itself; that is the main reason this is default-off.
|
|
381
381
|
|
|
382
|
+
The nested `Agent` tool lists the allowed agent types with their descriptions and tools, as the main session's does, and follows [`toolDescriptionMode`](#persistent-settings) `"compact"`.
|
|
383
|
+
|
|
382
384
|
`allowed_subagents` is runtime-enforced. A comma-separated list restricts nesting to those types; `all` (or `"*"` / `true`, matching how `extensions:` and `skills:` take booleans) allows any enabled agent; omitted, empty, `none`, or `false` means no nested tools are injected at all. Unknown, disabled, and out-of-list types are rejected rather than falling back — regardless of the project's [fallback agent](#persistent-settings) setting, so a configured fallback can never hand a nested caller an agent outside its allowlist — and a nested `model:` is validated against [Model Scope](#model-scope) exactly like a top-level spawn. Result, resume, and steering operations are ownership-scoped, so a parent can control only its own children. Nested records remain internal to that parent and do not appear in top-level tools, lifecycle events, or agent UI other than [FleetView](#fleetview) (which lists them under their parent with their own usage) and `/agents → Running agents` — so when a parent finishes, is stopped, or ends a resumed turn, its nested children are stopped with it. They do write their own `.output` transcript (subject to the same `output_transcript` gate), filed under the root session's directory alongside their ancestors', so a nested run can still be inspected after the fact. Their token usage is folded into every ancestor's totals up to the top-level agent (lifecycle events, completion notifications, `/agents`), so nested spend stays attributable at any depth on surfaces where the children themselves stay hidden. A nested result that ends `stopped`, `aborted`, or `steered` is labelled as partial, the same guarantee top-level results carry.
|
|
383
385
|
|
|
384
386
|
`maxSubagentDepth` (default `2`) is the deepest level an agent may run at, counted from the main session (0). An agent can spawn only while its own depth is below it:
|
|
@@ -493,20 +495,20 @@ Four rules define the feature:
|
|
|
493
495
|
|
|
494
496
|
Launch a sub-agent.
|
|
495
497
|
|
|
496
|
-
| Parameter | Type | Required | Description
|
|
497
|
-
| ------------------- | ----------------------- | -------- |
|
|
498
|
-
| `prompt` | string | yes | The task for the agent
|
|
499
|
-
| `description` | string | yes | Short 3-5 word summary (shown in UI)
|
|
500
|
-
| `name` | string | no | Memorable name for this agent (`auth-audit`), addressable as `@name` and accepted by `steer_subagent`/`get_subagent_result`. Additive — the type-derived handle is still assigned
|
|
501
|
-
| `subagent_type` | string | yes | Agent type (built-in or custom)
|
|
502
|
-
| `model` | string | no | Model — `provider/modelId` or fuzzy name (`"haiku"`, `"sonnet"`). Resolved tolerantly (`.`/`-` and a trailing date stamp interchangeable) with provider fallback
|
|
503
|
-
| `thinking` | string | no | Thinking level: off, minimal, low, medium, high, xhigh, max (availability depends on pi version and model)
|
|
504
|
-
| `max_turns` | number | no | Max agentic turns. Omit for unlimited (default)
|
|
505
|
-
| `run_in_background` | boolean | no | Defaults to `true`; `false` blocks and returns the result inline, until [`ctrl+b`](#sending-a-foreground-agent-to-the-background) hands it to the background
|
|
506
|
-
| `resume` | string | no | Agent ID to resume a previous session. The resumed run gets a fresh `max_turns` budget. Works after the agent's record is evicted (about ten minutes after it finishes) or lost to a reload: the agent is reopened from its saved session under the same id,
|
|
507
|
-
| `isolated` | boolean | no | No extension/MCP tools
|
|
508
|
-
| `isolation` | `"off"` \| `"worktree"` | no | `worktree` runs in an isolated git worktree; `off` (the default) does not. Absent from the schema entirely when `worktreeIsolation: false`
|
|
509
|
-
| `inherit_context` | boolean | no | Fork parent conversation into agent
|
|
498
|
+
| Parameter | Type | Required | Description |
|
|
499
|
+
| ------------------- | ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
500
|
+
| `prompt` | string | yes | The task for the agent |
|
|
501
|
+
| `description` | string | yes | Short 3-5 word summary (shown in UI) |
|
|
502
|
+
| `name` | string | no | Memorable name for this agent (`auth-audit`), addressable as `@name` and accepted by `steer_subagent`/`get_subagent_result`. Additive — the type-derived handle is still assigned |
|
|
503
|
+
| `subagent_type` | string | yes | Agent type (built-in or custom) |
|
|
504
|
+
| `model` | string | no | Model — `provider/modelId` or fuzzy name (`"haiku"`, `"sonnet"`). Resolved tolerantly (`.`/`-` and a trailing date stamp interchangeable) with provider fallback |
|
|
505
|
+
| `thinking` | string | no | Thinking level: off, minimal, low, medium, high, xhigh, max (availability depends on pi version and model) |
|
|
506
|
+
| `max_turns` | number | no | Max agentic turns. Omit for unlimited (default) |
|
|
507
|
+
| `run_in_background` | boolean | no | Defaults to `true`; `false` blocks and returns the result inline, until [`ctrl+b`](#sending-a-foreground-agent-to-the-background) hands it to the background |
|
|
508
|
+
| `resume` | string | no | Agent ID to resume a previous session. The resumed run gets a fresh `max_turns` budget. The agent keeps its own type, model and thinking level; only `prompt`, `max_turns` and `run_in_background` apply. Works after the agent's record is evicted (about ten minutes after it finishes) or lost to a reload: the agent is reopened from its saved session under the same id, with its type's current prompt and tools, on the model and thinking level that session recorded, and never in a new worktree. If that model can no longer be used, pi falls back to its default model and warns. Refused, with the reason, when the session was never saved, its file is gone, or it ran in a worktree that held changes (the worktree was removed when the agent finished, and its changes are on the branch named in the result) |
|
|
509
|
+
| `isolated` | boolean | no | No extension/MCP tools |
|
|
510
|
+
| `isolation` | `"off"` \| `"worktree"` | no | `worktree` runs in an isolated git worktree; `off` (the default) does not. Absent from the schema entirely when `worktreeIsolation: false` |
|
|
511
|
+
| `inherit_context` | boolean | no | Fork parent conversation into agent |
|
|
510
512
|
|
|
511
513
|
### `SubagentWorkflow`
|
|
512
514
|
|
|
@@ -554,6 +556,8 @@ return await pipeline(
|
|
|
554
556
|
|
|
555
557
|
Concurrency is capped at `max(1, min(16, cpus - 2))` — the run's own limit, independent of the session's `maxConcurrent` pool, which its agents do not enter. There are 1000 agents per run and 4096 items per `parallel`/`pipeline` call.
|
|
556
558
|
|
|
559
|
+
A failed `agent()` call returns `null`. The completion notification lists every failure in `<failures>`, as Claude Code's does, and a script can read the reason itself with [`agentError(label)`](docs/workflows.md#agenterrorlabel), a pi addition.
|
|
560
|
+
|
|
557
561
|
**Full guide:** [`docs/workflows.md`](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/workflows.md) — how the model writes the script for you, how to edit and re-run it, how to save one as a reusable named workflow, plus the complete `agent()` option reference, recipes and troubleshooting.
|
|
558
562
|
|
|
559
563
|
### `get_subagent_result`
|
|
@@ -600,7 +604,29 @@ Send a steering message to a running agent. The message interrupts after the cur
|
|
|
600
604
|
↑↓ select · ⏎ open · f filter · x stop · esc close · c convo
|
|
601
605
|
```
|
|
602
606
|
|
|
603
|
-
The overview puts the phases on the left (a phase shows its number until it finishes, then `✔`/`✘`) and the selected phase's agents on the right. `⏎` opens one: the agents move to the left pane and the right becomes that agent's **Prompt**, **Activity** and **Outcome**,
|
|
607
|
+
The overview puts the phases on the left (a phase shows its number until it finishes, then `✔`/`✘`) and the selected phase's agents on the right. `⏎` opens one: the agents move to the left pane and the right becomes that agent's **Prompt**, **Activity** and **Outcome**, and `esc` goes back a level rather than closing. At the overview `↑↓` (or `j`/`k`) move and `f` cycles the state filter, naming it in the pane title. In the agent view `↑↓` (or `j`/`k`) move between agents. `→` expands the detail and moves focus into it, its title turning the accent colour; `↑↓` then scroll it, and the bottom edge reads `1–12 of 26 ↓` when it runs on. `PgUp`/`PgDn` (or `shift+↑`/`shift+↓`) page it and `Home`/`End` jump to either end, the conversation viewer's keys, with or without focus. `←` or `esc` hand focus back to the agent list and fold the detail back to its compact view:
|
|
608
|
+
|
|
609
|
+
```
|
|
610
|
+
╭ Audit · 2 agents ┬ audit:src/a.ts ────────────────────────────────────────────────╮
|
|
611
|
+
│ ❯ ✔ audit:src/a.…│ ✔ Completed · anthropic/claude-opus-5 │
|
|
612
|
+
│ ⠋ audit:src/b.…│ 18.4k tok · 3 tool calls · 42s │
|
|
613
|
+
│ │ │
|
|
614
|
+
│ │ Prompt · 19 lines · ⏎ expand │
|
|
615
|
+
│ │ Audit src/a.ts for routes missing auth checks. │
|
|
616
|
+
│ │ step 0 │
|
|
617
|
+
│ │ step 1 │
|
|
618
|
+
│ │ step 2 │
|
|
619
|
+
│ │ … 15 more lines │
|
|
620
|
+
│ │ │
|
|
621
|
+
│ │ Activity · 3 tool calls · ⏎ expand │
|
|
622
|
+
│ │ ⏺ Read(src/a.ts) │
|
|
623
|
+
╰──────────────────┴───────────────────────────────────────────────── 1–12 of 26 ↓ ─╯
|
|
624
|
+
↑↓ agent · → scroll · ⏎ expand · p pause · x stop · esc back · c convo
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
Collapsed, Activity lists the agent's most recent tool calls, one row each, with the glyph turning green or red as each result arrives. `⏎` (or `e`) expands all three sections at once: the full prompt, the transcript (assistant text, each call, and the first lines of its result), and the full outcome, pretty-printed when the agent returned structured output. These come from the child's session, so they are complete rather than the 200-character previews the progress log carries. Once a record is swept, ten minutes after it finishes, the sections fall back to those previews. The dialog opens as a centered overlay, like the conversation viewer in regular mode. It takes 85% of the terminal's height and keeps that height whatever it holds, so moving the selection or expanding the detail never makes it jump; resizing the terminal resizes it, and a two-hundred-agent run scrolls inside the pane. Long titles truncate with `…` rather than tearing it. With more than one workflow in the session it asks which, newest first.
|
|
628
|
+
|
|
629
|
+
A running agent's tool-call and token counts update as it works: tool calls on completion, tokens when each assistant message ends. **Activity** is plain text; `c` opens the conversation viewer, which renders each tool call the way pi's own transcript does.
|
|
604
630
|
|
|
605
631
|
The run itself takes five keys, and the footer offers each only while it can actually do something:
|
|
606
632
|
|
|
@@ -719,7 +745,7 @@ When on, each subagent spawn's effective model is validated against pi's own `en
|
|
|
719
745
|
|
|
720
746
|
## Persistent Settings
|
|
721
747
|
|
|
722
|
-
Runtime tuning values set via `/agents` → Settings (max background concurrency, max foreground concurrency, max nested concurrency, nested depth, default max turns, grace turns, fallback agent, default join mode, scheduling on/off, scope models on/off, disable defaults on/off, strict agent files on/off, package agents on/off, package workflows on/off, agent mentions on/off, output transcript on/off, tool description full/compact/custom, widget all/background/off, usage reporting on/off, cost display on/off, model display on/off, viewer markdown off/assistant/all) persist across pi restarts. Two files, merged on load:
|
|
748
|
+
Runtime tuning values set via `/agents` → Settings (max background concurrency, max foreground concurrency, max nested concurrency, nested depth, default max turns, grace turns, fallback agent, default join mode, scheduling on/off, scope models on/off, disable defaults on/off, strict agent files on/off, package agents on/off, package workflows on/off, agent mentions on/off, output transcript on/off, tool description full/compact/custom, workflow tool exposure skill/inline/deferred, widget all/background/off, usage reporting on/off, cost display on/off, model display on/off, viewer markdown off/assistant/all) persist across pi restarts. Two files, merged on load:
|
|
723
749
|
|
|
724
750
|
- **Global:** `~/.pi/agent/subagents.json` — your machine-wide defaults.
|
|
725
751
|
- **Project:** `<cwd>/.pi/subagents.json` — per-project overrides.
|
|
@@ -810,7 +836,7 @@ Leaving it unset is not quite the same as `true`. Unset means _auto_: on, unless
|
|
|
810
836
|
|
|
811
837
|
The match is on the exact tool names `Workflow` (Claude Code's) and `SubagentWorkflow` (ours), never a substring, so a `list_workflows` or `github_workflow_run` from some CI integration does not silently take the feature down. The check runs at `session_start` and nowhere earlier, because `getAllTools` throws during extension loading and load order means a check at registration time could not see an extension that has not loaded yet — so the tool is registered first and withdrawn from the active set through `setActiveTools`, which rebuilds the system prompt before any turn runs. When the other extension took the `SubagentWorkflow` name itself, pi's first-registration-wins rule already dropped ours, so there is nothing to withdraw and only the menu and the CLI flag come down.
|
|
812
838
|
|
|
813
|
-
**Tool description** (`toolDescriptionMode`, default `"full"`): which Agent tool description the LLM sees. `"full"` is the rich Claude Code-style prompt (~1,400 tokens with the default agents); `"compact"` is ~75% smaller — one-line agent type list, terse usage notes — for small/local models where tool-spec tokens are expensive. Per-option details stay in the parameter descriptions in every mode (the parameter schema is never customizable). Applies on the next pi session.
|
|
839
|
+
**Tool description** (`toolDescriptionMode`, default `"full"`): which Agent tool description the LLM sees. `"full"` is the rich Claude Code-style prompt (~1,400 tokens with the default agents); `"compact"` is ~75% smaller — one-line agent type list, terse usage notes — for small/local models where tool-spec tokens are expensive. Per-option details stay in the parameter descriptions in every mode (the parameter schema is never customizable). Applies on the next pi session (to nested `Agent` tools, on the next subagent started). For the `SubagentWorkflow` tool, the token saving is [`workflowToolExposure`](#persistent-settings) `"skill"` or `"deferred"`, below.
|
|
814
840
|
|
|
815
841
|
`"custom"` registers your own description from `<cwd>/.pi/agent-tool-description.md` (project) or `<agentDir>/agent-tool-description.md` (global; project wins). The file is read once at tool registration, so edits also apply on the next pi session. Dynamic parts stay live via placeholders — a static agent list would go stale the moment you add a custom agent:
|
|
816
842
|
|
|
@@ -825,6 +851,8 @@ Placeholders: `{{typeList}}` (full per-agent descriptions), `{{compactTypeList}}
|
|
|
825
851
|
|
|
826
852
|
**Starting point:** copy [`examples/agent-tool-description.md`](examples/agent-tool-description.md) — it reproduces the default full description exactly (a CI test keeps it in sync), so you can trim from a known-good baseline instead of writing from scratch.
|
|
827
853
|
|
|
854
|
+
**Workflow tool exposure** (`workflowToolExposure`, default `"inline"`): where the [`SubagentWorkflow`](#subagentworkflow) script reference reaches the model. `"inline"` puts it in the tool description, so the model has it whenever it writes a script. `"skill"` saves about 4k tokens every session: the description carries one line pointing at the bundled `skills/workflow-authoring/SKILL.md` by its path in the installed package instead, and the model has to choose to read it — a model that skips it writes the script without the reference, and it needs a `read` tool. `"deferred"` keeps the tool out of the tool spec entirely until pi's `tool_search` loads it, then carries the inline reference. It needs `tool_search` active (`"defaultTools": ["+tool_search"]` in pi's settings; pi ships it off), and the model only finds the tool by searching for it, so it also cannot see the opt-in rule until then. An explicit `--tools` list must name `SubagentWorkflow` as well as `tool_search`, or pi leaves the tool out entirely (`--tools +tool_search` keeps the default set). Applies on the next pi session.
|
|
855
|
+
|
|
828
856
|
**Example — global defaults for a beefy machine:**
|
|
829
857
|
|
|
830
858
|
```bash
|
|
@@ -1080,6 +1108,8 @@ This is useful for creating agents that inherit extension tools but should not h
|
|
|
1080
1108
|
docs/ # Long-form guides (shipped to npm; README links out to them)
|
|
1081
1109
|
workflows.md # SubagentWorkflow: writing, editing, saving and re-running scripts
|
|
1082
1110
|
rpc.md # Cross-extension integration: pi.events, subagents:rpc:*, manager registry
|
|
1111
|
+
skills/
|
|
1112
|
+
workflow-authoring/ # SKILL.md: the SubagentWorkflow script reference, pointed at by the tool description
|
|
1083
1113
|
examples/
|
|
1084
1114
|
workflows/ # Runnable examples, executed by test/workflow-examples.test.ts
|
|
1085
1115
|
agent-tool-description.md
|
|
@@ -1136,6 +1166,7 @@ src/
|
|
|
1136
1166
|
worker-source.ts # The sandbox: vm context, determinism prelude, script globals
|
|
1137
1167
|
runtime.ts # Worker lifecycle, RPC bridge, semaphore, caps, gate/resume
|
|
1138
1168
|
progress.ts # Progress event log and every derived view of it (pure)
|
|
1169
|
+
agent-detail.ts # A child's transcript folded into the inspector's Prompt/Activity/Outcome (pure)
|
|
1139
1170
|
host.ts # WorkflowHost adapter over AgentManager
|
|
1140
1171
|
task.ts # local_workflow task record and batched progress updates
|
|
1141
1172
|
tool-description.ts # Model-facing description carrying the orchestration patterns
|
|
@@ -1151,6 +1182,7 @@ src/
|
|
|
1151
1182
|
settings-menu.ts # /agents → Settings page: filter, focus, number editor, terminal-sized list
|
|
1152
1183
|
select-item.ts # Collision-safe ctx.ui.select wrapper (numbered rows)
|
|
1153
1184
|
workflow-card.ts # Inline workflow card (tool result and session entry)
|
|
1185
|
+
workflow-card-redraw.ts # When a background run's inline card redraws (per renderer mode)
|
|
1154
1186
|
workflow-dialog.ts # /agents → Workflows two-pane inspector
|
|
1155
1187
|
```
|
|
1156
1188
|
|