@herbertgao/pi-extensions 2026.11.12 → 2026.11.14

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +6 -4
  3. package/node_modules/@herbertgao/pi-inline-skill-commands/LICENSE +21 -0
  4. package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +37 -0
  5. package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +53 -0
  6. package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +239 -0
  7. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +10 -0
  8. package/node_modules/@herbertgao/pi-subagents/README.md +37 -7
  9. package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +113 -34
  10. package/node_modules/@herbertgao/pi-subagents/package.json +9 -4
  11. package/node_modules/@herbertgao/pi-subagents/skills/workflow-authoring/SKILL.md +147 -0
  12. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +48 -32
  13. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +16 -8
  14. package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +16 -6
  15. package/node_modules/@herbertgao/pi-subagents/src/index.ts +99 -7
  16. package/node_modules/@herbertgao/pi-subagents/src/mention.ts +5 -7
  17. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +26 -0
  18. package/node_modules/@herbertgao/pi-subagents/src/structured-output.ts +13 -5
  19. package/node_modules/@herbertgao/pi-subagents/src/ui/fleet-list.ts +55 -8
  20. package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-card-redraw.ts +86 -0
  21. package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-card.ts +5 -5
  22. package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-dialog.ts +478 -115
  23. package/node_modules/@herbertgao/pi-subagents/src/ui/workflow-menu.ts +77 -6
  24. package/node_modules/@herbertgao/pi-subagents/src/workflow/agent-detail.ts +148 -0
  25. package/node_modules/@herbertgao/pi-subagents/src/workflow/host.ts +88 -14
  26. package/node_modules/@herbertgao/pi-subagents/src/workflow/journal.ts +8 -0
  27. package/node_modules/@herbertgao/pi-subagents/src/workflow/json-schema.ts +507 -57
  28. package/node_modules/@herbertgao/pi-subagents/src/workflow/progress.ts +41 -11
  29. package/node_modules/@herbertgao/pi-subagents/src/workflow/runtime.ts +106 -34
  30. package/node_modules/@herbertgao/pi-subagents/src/workflow/task.ts +43 -5
  31. package/node_modules/@herbertgao/pi-subagents/src/workflow/tool-description.ts +93 -153
  32. package/node_modules/@herbertgao/pi-subagents/src/workflow/worker-source.ts +283 -71
  33. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +288 -177
  34. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  35. package/node_modules/@pi-plugins/fast-mode/package.json +7 -7
  36. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  37. package/node_modules/pi-lens/CHANGELOG.md +132 -0
  38. package/node_modules/pi-lens/README.md +2 -0
  39. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
  40. package/node_modules/pi-lens/dist/{chunk-LGH2HHZG.js → chunk-25CAONWT.js} +36 -25
  41. package/node_modules/pi-lens/dist/{chunk-ZQSSO7LO.js → chunk-2DWNYVUN.js} +3 -3
  42. package/node_modules/pi-lens/dist/{chunk-YCR6ZYTE.js → chunk-2RQREVGO.js} +1 -1
  43. package/node_modules/pi-lens/dist/{chunk-VWEBZ2JV.js → chunk-2XALJI2K.js} +40 -40
  44. package/node_modules/pi-lens/dist/{chunk-PQXUZYTQ.js → chunk-2YQ5LI7R.js} +4 -4
  45. package/node_modules/pi-lens/dist/{chunk-VSQT6IHZ.js → chunk-35UJUF27.js} +18 -4
  46. package/node_modules/pi-lens/dist/{chunk-OLWGYBYT.js → chunk-3IWMNN2S.js} +17 -17
  47. package/node_modules/pi-lens/dist/chunk-3UTDLQWO.js +88 -0
  48. package/node_modules/pi-lens/dist/chunk-3Z7Z3B7V.js +27 -0
  49. package/node_modules/pi-lens/dist/{chunk-UNP6Y4JV.js → chunk-4E4OCW3L.js} +16 -16
  50. package/node_modules/pi-lens/dist/{chunk-37IDWT6O.js → chunk-4GLSO2EM.js} +13 -11
  51. package/node_modules/pi-lens/dist/{chunk-QV3JPCMK.js → chunk-5HVDD7IA.js} +1 -1
  52. package/node_modules/pi-lens/dist/{chunk-ZRQMENT4.js → chunk-62PIU4TO.js} +1 -1
  53. package/node_modules/pi-lens/dist/{chunk-3TSMQZG6.js → chunk-6MDWNZ7E.js} +2 -2
  54. package/node_modules/pi-lens/dist/{chunk-WLD6BGON.js → chunk-6MWX2J5H.js} +4 -0
  55. package/node_modules/pi-lens/dist/{chunk-SCU62JLX.js → chunk-6MZLS6CK.js} +7 -7
  56. package/node_modules/pi-lens/dist/{chunk-B42AIWPJ.js → chunk-7BWPQZHE.js} +3 -3
  57. package/node_modules/pi-lens/dist/{chunk-I3NZVAMN.js → chunk-7JMEPY6P.js} +10 -10
  58. package/node_modules/pi-lens/dist/{chunk-7DPXUPRF.js → chunk-7ORBRDFY.js} +2 -2
  59. package/node_modules/pi-lens/dist/{chunk-6E5QLMWI.js → chunk-7WAQ3K26.js} +23 -23
  60. package/node_modules/pi-lens/dist/{chunk-2H5GHZKC.js → chunk-AB26NAHA.js} +7 -7
  61. package/node_modules/pi-lens/dist/{chunk-BBSDJTOV.js → chunk-AFSG6YUB.js} +13 -13
  62. package/node_modules/pi-lens/dist/{chunk-XDNWR7SG.js → chunk-ALTHJUZO.js} +2 -2
  63. package/node_modules/pi-lens/dist/{chunk-UN72ZAJ5.js → chunk-AOEVZXR6.js} +9 -9
  64. package/node_modules/pi-lens/dist/{chunk-HRLF35WL.js → chunk-ARTCVE6I.js} +9 -9
  65. package/node_modules/pi-lens/dist/{chunk-LQQNFCQJ.js → chunk-B2QO7GHY.js} +1 -1
  66. package/node_modules/pi-lens/dist/{chunk-I2FYOZNW.js → chunk-BJGWP4UX.js} +10 -10
  67. package/node_modules/pi-lens/dist/{chunk-G53LBDNU.js → chunk-BKJ6WZKP.js} +6 -6
  68. package/node_modules/pi-lens/dist/{chunk-P5MSLVUW.js → chunk-BQ72NQQM.js} +11 -11
  69. package/node_modules/pi-lens/dist/{chunk-K7O6AHSJ.js → chunk-BWGNVM33.js} +11 -11
  70. package/node_modules/pi-lens/dist/{chunk-ADYQRETD.js → chunk-BYIEU4E4.js} +2 -2
  71. package/node_modules/pi-lens/dist/{chunk-7ZVTFLCC.js → chunk-CDAJQBKJ.js} +11 -11
  72. package/node_modules/pi-lens/dist/{chunk-BKWFDWYM.js → chunk-D3UQWOCB.js} +16 -16
  73. package/node_modules/pi-lens/dist/{chunk-3PAS2ERX.js → chunk-DHFJS2I4.js} +8 -8
  74. package/node_modules/pi-lens/dist/{chunk-KNSOA43J.js → chunk-DKXIUGNA.js} +2 -2
  75. package/node_modules/pi-lens/dist/{chunk-LOEJFTF2.js → chunk-DLGJYQML.js} +2 -2
  76. package/node_modules/pi-lens/dist/{chunk-VGRGW4UL.js → chunk-DNJJVKJZ.js} +31 -31
  77. package/node_modules/pi-lens/dist/{chunk-5HBQL7DH.js → chunk-EBXCYEII.js} +3 -3
  78. package/node_modules/pi-lens/dist/chunk-EH6EHFW2.js +73 -0
  79. package/node_modules/pi-lens/dist/{chunk-W26QZ3OM.js → chunk-EKQDQPX6.js} +10 -10
  80. package/node_modules/pi-lens/dist/{chunk-TWEOJE3D.js → chunk-EXHSWN3P.js} +844 -377
  81. package/node_modules/pi-lens/dist/{chunk-4IZZEN63.js → chunk-F7BFIENK.js} +33 -33
  82. package/node_modules/pi-lens/dist/{chunk-ZI7YHV6I.js → chunk-FD4LJQ6Y.js} +5 -5
  83. package/node_modules/pi-lens/dist/{chunk-RIH3UBK4.js → chunk-GFCPPCNR.js} +11 -11
  84. package/node_modules/pi-lens/dist/{chunk-5JB4WENL.js → chunk-GIK6VUCY.js} +1 -1
  85. package/node_modules/pi-lens/dist/{chunk-PPQHMSPH.js → chunk-GNK2IHVG.js} +15 -15
  86. package/node_modules/pi-lens/dist/{chunk-CXQYK4YT.js → chunk-H6DNTQ4V.js} +2 -2
  87. package/node_modules/pi-lens/dist/{chunk-NGNBJIUO.js → chunk-HERQPNY6.js} +8 -8
  88. package/node_modules/pi-lens/dist/{chunk-INBK3HIT.js → chunk-HFIFEH46.js} +3 -3
  89. package/node_modules/pi-lens/dist/{chunk-J2ZB5MDS.js → chunk-HKRESBMC.js} +20 -20
  90. package/node_modules/pi-lens/dist/{chunk-AZG5UJYY.js → chunk-HMXWZUQW.js} +1 -1
  91. package/node_modules/pi-lens/dist/{chunk-XSC3BCN3.js → chunk-HOWHAKXO.js} +6 -6
  92. package/node_modules/pi-lens/dist/{chunk-7CLWC2UH.js → chunk-HUWW77QY.js} +1 -1
  93. package/node_modules/pi-lens/dist/{chunk-KZ732ZVW.js → chunk-IO6P3NBP.js} +1 -1
  94. package/node_modules/pi-lens/dist/{chunk-7WKVCZI4.js → chunk-J7VNGHLN.js} +2 -2
  95. package/node_modules/pi-lens/dist/{chunk-QE7BJQ6K.js → chunk-JGCBMCCS.js} +8 -8
  96. package/node_modules/pi-lens/dist/{chunk-PFJLYRO3.js → chunk-KIQSNH3F.js} +34 -34
  97. package/node_modules/pi-lens/dist/{chunk-JGUDT5KD.js → chunk-KSQJBGRO.js} +5 -5
  98. package/node_modules/pi-lens/dist/{chunk-RJ3APNIP.js → chunk-KXKM2DFP.js} +4 -4
  99. package/node_modules/pi-lens/dist/chunk-L3Q72QGQ.js +25 -0
  100. package/node_modules/pi-lens/dist/{chunk-6GLMMGCX.js → chunk-LDPY22FS.js} +2 -2
  101. package/node_modules/pi-lens/dist/{chunk-3PO4YYOX.js → chunk-M3QGXGY4.js} +3793 -3814
  102. package/node_modules/pi-lens/dist/{chunk-NNEQOC3U.js → chunk-MET776XM.js} +9 -7
  103. package/node_modules/pi-lens/dist/{chunk-X33QECRJ.js → chunk-MKQFSW2Q.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-7U36VQL6.js → chunk-MKW7ZUTT.js} +3 -3
  105. package/node_modules/pi-lens/dist/{chunk-PQF6YGYB.js → chunk-N2U644ZW.js} +4 -18
  106. package/node_modules/pi-lens/dist/{chunk-DI4AZZNY.js → chunk-NAACKIKT.js} +2 -2
  107. package/node_modules/pi-lens/dist/{chunk-O6LCSHHI.js → chunk-NHHS5T52.js} +1 -1
  108. package/node_modules/pi-lens/dist/{chunk-DCA2MXVQ.js → chunk-NIZKGBOU.js} +51 -27
  109. package/node_modules/pi-lens/dist/{chunk-PKWEBMCA.js → chunk-NNDZ7DOP.js} +194 -111
  110. package/node_modules/pi-lens/dist/{chunk-Q7J3JYJ2.js → chunk-NZ7NSKIW.js} +13 -13
  111. package/node_modules/pi-lens/dist/{chunk-S6MCMD27.js → chunk-OG3UCAHV.js} +3 -3
  112. package/node_modules/pi-lens/dist/{chunk-3QXFUP6T.js → chunk-OHTHVILU.js} +12 -12
  113. package/node_modules/pi-lens/dist/{chunk-NHA5K226.js → chunk-P7EV5ISR.js} +17 -2
  114. package/node_modules/pi-lens/dist/{chunk-L6BDRYUK.js → chunk-PVV27TOX.js} +5 -5
  115. package/node_modules/pi-lens/dist/{chunk-HIRBC72R.js → chunk-Q32RJDYC.js} +4 -4
  116. package/node_modules/pi-lens/dist/{chunk-QE5DJ7MX.js → chunk-Q4UQNTLB.js} +4 -4
  117. package/node_modules/pi-lens/dist/{chunk-SDYLT45T.js → chunk-QQGZY2BR.js} +2 -2
  118. package/node_modules/pi-lens/dist/{chunk-QMWKSYWB.js → chunk-S247BOH2.js} +4 -4
  119. package/node_modules/pi-lens/dist/{chunk-ARTYCUGF.js → chunk-S7KUDW73.js} +121 -18
  120. package/node_modules/pi-lens/dist/{chunk-6CFSDLHE.js → chunk-SJ2SR432.js} +17 -17
  121. package/node_modules/pi-lens/dist/{chunk-CQY2HEH7.js → chunk-SL4G67AP.js} +2 -2
  122. package/node_modules/pi-lens/dist/{chunk-LVLPA32Q.js → chunk-T2D2WWP6.js} +48 -11
  123. package/node_modules/pi-lens/dist/{chunk-HIJ4CHFF.js → chunk-T7KHGEJ5.js} +3 -3
  124. package/node_modules/pi-lens/dist/{chunk-74AMPWNC.js → chunk-TABDCX35.js} +2 -2
  125. package/node_modules/pi-lens/dist/chunk-TFSBHRL2.js +25 -0
  126. package/node_modules/pi-lens/dist/{chunk-KNJH6WJQ.js → chunk-TQKWR5AZ.js} +7 -7
  127. package/node_modules/pi-lens/dist/chunk-TWAQFMLW.js +110 -0
  128. package/node_modules/pi-lens/dist/{chunk-TKOFTLGB.js → chunk-UARVPNAU.js} +33 -33
  129. package/node_modules/pi-lens/dist/chunk-UWBD3JMH.js +56 -0
  130. package/node_modules/pi-lens/dist/{chunk-K4Z7MK6T.js → chunk-VEF3GFOL.js} +15 -15
  131. package/node_modules/pi-lens/dist/{chunk-4DAHGU3V.js → chunk-W2JPGW7Q.js} +27 -25
  132. package/node_modules/pi-lens/dist/{chunk-CZJGAOKL.js → chunk-W2YHHNY3.js} +7 -7
  133. package/node_modules/pi-lens/dist/{chunk-R4L7KZ7R.js → chunk-WA6U2URH.js} +9 -9
  134. package/node_modules/pi-lens/dist/{chunk-OZQQ3AIR.js → chunk-WAK2AXQQ.js} +9 -9
  135. package/node_modules/pi-lens/dist/{chunk-DFKOA74L.js → chunk-WH6O4IFD.js} +10 -10
  136. package/node_modules/pi-lens/dist/{chunk-27JQHK7Y.js → chunk-WJ7GY5WJ.js} +1 -1
  137. package/node_modules/pi-lens/dist/{chunk-KXGTLAUW.js → chunk-WWZLT6AM.js} +2 -2
  138. package/node_modules/pi-lens/dist/{chunk-O2MHF7QM.js → chunk-XRLZ75YY.js} +38 -38
  139. package/node_modules/pi-lens/dist/chunk-XWWFESYZ.js +27 -0
  140. package/node_modules/pi-lens/dist/chunk-XZSXSM4K.js +27 -0
  141. package/node_modules/pi-lens/dist/{chunk-C5PLBTNR.js → chunk-Y2LIOCA7.js} +1 -1
  142. package/node_modules/pi-lens/dist/{chunk-AXAR5ZW2.js → chunk-YIEHUKX2.js} +84 -169
  143. package/node_modules/pi-lens/dist/{chunk-B2OXE4AH.js → chunk-YOMLAKU6.js} +182 -180
  144. package/node_modules/pi-lens/dist/{chunk-MOAVEPC4.js → chunk-YV7XVYSJ.js} +11 -11
  145. package/node_modules/pi-lens/dist/{chunk-ZULZS2I6.js → chunk-ZVQUYCBU.js} +996 -365
  146. package/node_modules/pi-lens/dist/index.js +4911 -2376
  147. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +8 -8
  148. package/node_modules/pi-lens/dist/mcp/cli.js +40 -40
  149. package/node_modules/pi-lens/dist/mcp/server.js +321 -234
  150. package/node_modules/pi-lens/dist/mcp/worker.js +58 -58
  151. package/node_modules/pi-lens/dist/probes/installer.js +21 -21
  152. package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +18 -9
  153. package/node_modules/pi-lens/docs/ci.md +7 -0
  154. package/node_modules/pi-lens/docs/defect-shapes.md +43 -28
  155. package/node_modules/pi-lens/docs/globalconfig.md +1 -0
  156. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +15 -0
  157. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +3 -3
  158. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +3 -2
  159. package/node_modules/pi-lens/docs/module-report-read-symbol.md +6 -2
  160. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +3 -2
  161. package/node_modules/pi-lens/docs/pi-lens-orchestration.md +2 -1
  162. package/node_modules/pi-lens/docs/pi-lens-subagent.md +2 -1
  163. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  164. package/node_modules/pi-lens/docs/settings.md +1 -0
  165. package/node_modules/pi-lens/docs/usage.md +1 -0
  166. package/node_modules/pi-lens/package.json +1 -1
  167. package/package.json +9 -4
  168. package/node_modules/pi-lens/dist/chunk-2H7NFZ4Q.js +0 -25
  169. package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +0 -56
  170. package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +0 -27
  171. package/node_modules/pi-lens/dist/chunk-H5API74E.js +0 -67
  172. package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +0 -27
  173. package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +0 -88
  174. package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +0 -73
  175. package/node_modules/pi-lens/dist/chunk-MJRGPEQ5.js +0 -25
  176. 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) && !denied?.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
@@ -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. Each entry denies the tool
214
- // with exactly that name, as in Claude Code, and the pi built-in it maps to, so an
215
- // extension tool named `glob` stays denied rather than becoming `find`.
216
- disallowedTools: csvListOptional(
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
@@ -132,6 +132,7 @@ import {
132
132
  settingSources,
133
133
  settingsFilePath,
134
134
  type ToolDescriptionMode,
135
+ type WorkflowToolExposureMode,
135
136
  } from "./settings.js"
136
137
  import {
137
138
  getForegroundOutcomeNote,
@@ -193,6 +194,7 @@ import {
193
194
  renderWorkflowCard,
194
195
  renderWorkflowEntryCard,
195
196
  } from "./ui/workflow-card.js"
197
+ import { WorkflowCardRedraws } from "./ui/workflow-card-redraw.js"
196
198
  import {
197
199
  openWorkflowFromFleet,
198
200
  type WorkflowMenuDeps,
@@ -239,7 +241,7 @@ import {
239
241
  workflowResultText,
240
242
  workflowRunId,
241
243
  } from "./workflow/task.js"
242
- import { fullWorkflowToolDescription } from "./workflow/tool-description.js"
244
+ import { workflowToolDescription } from "./workflow/tool-description.js"
243
245
  import {
244
246
  isWorktreeIsolationEnabled,
245
247
  setWorktreeIsolationEnabled,
@@ -1826,6 +1828,10 @@ export default function (pi: ExtensionAPI) {
1826
1828
  function setToolDescriptionMode(mode: ToolDescriptionMode): void {
1827
1829
  toolDescriptionMode = mode
1828
1830
  }
1831
+ let workflowToolExposure: WorkflowToolExposureMode = "inline"
1832
+ function getWorkflowToolExposure(): WorkflowToolExposureMode {
1833
+ return workflowToolExposure
1834
+ }
1829
1835
 
1830
1836
  // ---- Turn batches for `group` join mode ----
1831
1837
  // Background spawns the parent made in its current turn. The turn's end is
@@ -2070,6 +2076,9 @@ export default function (pi: ExtensionAPI) {
2070
2076
  },
2071
2077
  setDisableDefaultAgents: setDisableDefaultAgents,
2072
2078
  setToolDescriptionMode: setToolDescriptionMode,
2079
+ setWorkflowToolExposure: (mode) => {
2080
+ workflowToolExposure = mode
2081
+ },
2073
2082
  setFleetView: setFleetViewEnabled,
2074
2083
  setAgentMentions: setAgentMentionMode,
2075
2084
  setRememberAgents,
@@ -3290,6 +3299,21 @@ Terse command-style prompts produce shallow, generic work.
3290
3299
  */
3291
3300
  const workflowTasks = new Map<string, WorkflowTask>()
3292
3301
 
3302
+ /**
3303
+ * pi's renderer mode, as last seen on a TUI the fleet list was drawn into.
3304
+ * Remembered rather than read off the list's live handle, which pi clears on
3305
+ * every theme change and mode switch until the list registers again. Before
3306
+ * any draw, pi's own setting, normalized as its `getTuiMode()` does; that
3307
+ * misses a `--tui-mode` flag, which no extension API exposes.
3308
+ */
3309
+ let seenTuiMode: string | undefined
3310
+ const tuiMode = () =>
3311
+ seenTuiMode ??
3312
+ (pi.getSettings().tuiMode === "regular" ? "regular" : "fullscreen")
3313
+ const workflowCards = new WorkflowCardRedraws(
3314
+ () => tuiMode() === "fullscreen",
3315
+ )
3316
+
3293
3317
  /**
3294
3318
  * Workflow runs as the fleet list wants them.
3295
3319
  *
@@ -3308,6 +3332,11 @@ Terse command-style prompts produce shallow, generic work.
3308
3332
  status: task.status,
3309
3333
  doneCount: task.doneCount,
3310
3334
  totalCount: task.agentCount,
3335
+ // A settled run has no phase in progress; a paused one is still in its.
3336
+ phase:
3337
+ task.status === "running" || task.status === "paused"
3338
+ ? task.phaseLabel
3339
+ : "",
3311
3340
  startedAt: task.startTime,
3312
3341
  ...(task.endTime !== undefined ? { completedAt: task.endTime } : {}),
3313
3342
  tokens: task.totalTokens,
@@ -3337,7 +3366,11 @@ Terse command-style prompts produce shallow, generic work.
3337
3366
  rootSessionId: ctx.sessionManager.getSessionId(),
3338
3367
  workflowId: task.id,
3339
3368
  }),
3340
- onProgress: (entries) => updateWorkflowProgressBatch(task, entries),
3369
+ onProgress: (entries) => {
3370
+ if (entries.length === 0) return
3371
+ updateWorkflowProgressBatch(task, entries)
3372
+ workflowCards.request(task.id)
3373
+ },
3341
3374
  // The dialog's pause / skip / retry keys run through this; it is dropped
3342
3375
  // again when the task settles.
3343
3376
  onControl: (control) => {
@@ -3367,6 +3400,7 @@ Terse command-style prompts produce shallow, generic work.
3367
3400
  function notifyWorkflowFinished(task: WorkflowTask) {
3368
3401
  widget.update()
3369
3402
  fleet.update()
3403
+ workflowCards.flush(task.id)
3370
3404
  const result = workflowResultText(task)
3371
3405
  const message = {
3372
3406
  content: formatWorkflowNotification(task),
@@ -3398,11 +3432,16 @@ Terse command-style prompts produce shallow, generic work.
3398
3432
  const workflowTool = defineTool({
3399
3433
  name: SUBAGENT_TOOL_NAMES.WORKFLOW,
3400
3434
  label: "SubagentWorkflow",
3401
- description: renderToolDescriptionTemplate(fullWorkflowToolDescription),
3435
+ // `deferred`: not declared to the model until pi's `tool_search` loads it.
3436
+ ...(getWorkflowToolExposure() === "deferred"
3437
+ ? { exposure: "deferred" as const }
3438
+ : {}),
3439
+ description: renderToolDescriptionTemplate(
3440
+ workflowToolDescription(getWorkflowToolExposure()),
3441
+ ),
3402
3442
  promptSnippet:
3403
3443
  "Run a deterministic script that orchestrates many subagents",
3404
3444
  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
3445
  "Prefer `pipeline` over `parallel` — a barrier costs wall-clock whenever the stages are unevenly sized.",
3407
3446
  "A workflow runs in the background and notifies you when it finishes — do not poll or sleep waiting for it.",
3408
3447
  ],
@@ -3473,6 +3512,21 @@ Terse command-style prompts produce shallow, generic work.
3473
3512
  // No task means the run predates this session (a reloaded transcript) or
3474
3513
  // the call never started one — show what `execute` said instead.
3475
3514
  if (renderContext.isError || !task) return new Text(text, 0, 0)
3515
+ if (task.status === "running" || task.status === "paused") {
3516
+ workflowCards.track(task.id, renderContext.invalidate)
3517
+ // A card that cannot follow the run says where to watch it instead of
3518
+ // showing a launch-time snapshot that reads as live.
3519
+ if (tuiMode() !== "fullscreen") {
3520
+ return new Text(
3521
+ theme.fg(
3522
+ "dim",
3523
+ ` ⎿ Running in background (ID: ${task.id}) · /agents → Workflows`,
3524
+ ),
3525
+ 0,
3526
+ 0,
3527
+ )
3528
+ }
3529
+ }
3476
3530
  return renderWorkflowCard(
3477
3531
  {
3478
3532
  progress: task.workflowProgress,
@@ -3639,9 +3693,18 @@ Terse command-style prompts produce shallow, generic work.
3639
3693
  ownDescription: workflowTool.description,
3640
3694
  pinned: isWorkflowsPinned(),
3641
3695
  })
3642
- if (verdict.kind === "none") return
3643
- if (verdict.kind === "report") {
3644
- warn(verdict.message)
3696
+ if (verdict.kind === "none" || verdict.kind === "report") {
3697
+ if (verdict.kind === "report") warn(verdict.message)
3698
+ // pi's own warning for unreachable deferred tools covers MCP servers only.
3699
+ if (
3700
+ workflowTool.exposure === "deferred" &&
3701
+ !pi.getActiveTools().includes("tool_search")
3702
+ ) {
3703
+ warn(
3704
+ 'workflowToolExposure is "deferred" but tool_search is inactive, so the model cannot load SubagentWorkflow. ' +
3705
+ 'Add "+tool_search" to defaultTools in .pi/settings.json, or set workflowToolExposure to "skill".',
3706
+ )
3707
+ }
3645
3708
  return
3646
3709
  }
3647
3710
 
@@ -3651,6 +3714,10 @@ Terse command-style prompts produce shallow, generic work.
3651
3714
  warn(verdict.message)
3652
3715
 
3653
3716
  if (!verdict.withdraw) return
3717
+ // An inactive deferred tool stays searchable and callable; only `hidden`
3718
+ // exposure takes it out of reach, and tools cannot be unregistered.
3719
+ if (workflowTool.exposure === "deferred")
3720
+ pi.registerTool({ ...workflowTool, exposure: "hidden" })
3654
3721
  const active = pi.getActiveTools()
3655
3722
  if (active.includes(SUBAGENT_TOOL_NAMES.WORKFLOW)) {
3656
3723
  pi.setActiveTools(
@@ -4074,6 +4141,7 @@ Terse command-style prompts produce shallow, generic work.
4074
4141
  strictAgentFiles,
4075
4142
  disableDefaultAgents: isDefaultsDisabled(),
4076
4143
  toolDescriptionMode: getToolDescriptionMode(),
4144
+ workflowToolExposure: getWorkflowToolExposure(),
4077
4145
  fleetView: isFleetViewEnabled(),
4078
4146
  agentMentions: getAgentMentionMode(),
4079
4147
  rememberAgents: getRememberAgents(),
@@ -4337,6 +4405,17 @@ Terse command-style prompts produce shallow, generic work.
4337
4405
  currentValue: isWorkflowsEnabled() ? "on" : "off",
4338
4406
  values: ["on", "off"],
4339
4407
  },
4408
+ {
4409
+ id: "workflowToolExposure",
4410
+ label: "Workflow tool exposure",
4411
+ description:
4412
+ "Where the SubagentWorkflow script reference reaches the model: inline (default — in the tool description, " +
4413
+ "always read) or skill (~4k fewer tokens per session; the description points at the bundled skill file, " +
4414
+ "which the model must choose to read before writing a script) or deferred (not in the tool spec until " +
4415
+ "pi's tool_search loads it, then inline; requires tool_search). Applies on next pi session",
4416
+ currentValue: getWorkflowToolExposure(),
4417
+ values: ["inline", "skill", "deferred"],
4418
+ },
4340
4419
  {
4341
4420
  id: "worktreeIsolation",
4342
4421
  label: "Worktree isolation",
@@ -4651,6 +4730,13 @@ Terse command-style prompts produce shallow, generic work.
4651
4730
  target,
4652
4731
  `Tool description set to ${value}. Takes effect on next pi session.`,
4653
4732
  )
4733
+ } else if (id === "workflowToolExposure") {
4734
+ workflowToolExposure = value as WorkflowToolExposureMode
4735
+ notifyApplied(
4736
+ ctx,
4737
+ target,
4738
+ `Workflow tool exposure set to ${value}. Takes effect on next pi session.`,
4739
+ )
4654
4740
  } else if (id === "reportUsage") {
4655
4741
  const enabled = value === "on"
4656
4742
  setReportUsage(enabled)
@@ -4829,11 +4915,17 @@ Terse command-style prompts produce shallow, generic work.
4829
4915
  // SAFETY: ExtensionContext and ExtensionCommandContext share the runtime
4830
4916
  // UI/session fields used by persistSettings; the value can also be absent.
4831
4917
  getCtx: () => currentCtx as unknown as ExtensionCommandContext | undefined,
4918
+ onTaskChange: (task) => workflowCards.request(task.id),
4832
4919
  }
4833
4920
 
4834
4921
  fleet.setWorkflowSource(fleetWorkflows, (id) =>
4835
4922
  openWorkflowFromFleet(id, workflowMenuDeps),
4836
4923
  )
4924
+ fleet.setTuiModeObserver((mode) => {
4925
+ const was = tuiMode()
4926
+ seenTuiMode = mode
4927
+ if (mode !== was) workflowCards.redrawAll()
4928
+ })
4837
4929
 
4838
4930
  const { showAgentsMenu } = createAgentsMenu({
4839
4931
  pi,
@@ -21,8 +21,7 @@
21
21
 
22
22
  /**
23
23
  * Suggestion trigger: `@` at a token boundary plus the partial handle typed so
24
- * far. Ported from Claude Code, including the CJK sentence-ending punctuation
25
- * it accepts as a boundary.
24
+ * far, including CJK sentence-ending punctuation as a boundary.
26
25
  */
27
26
  export const MENTION_TRIGGER = /(^|[\s。、?!])@([\w-]*)$/
28
27
 
@@ -30,7 +29,7 @@ export const MENTION_TRIGGER = /(^|[\s。、?!])@([\w-]*)$/
30
29
  const MENTION_SEND = /^@([\w-]+)\s+([\s\S]+)$/
31
30
 
32
31
  /**
33
- * Upper bound on a handle, matching Claude Code's `dSS`. Nothing here generates
32
+ * Upper bound on a handle. Nothing here generates
34
33
  * a name this long, but an agent type or a model-supplied name can be arbitrary
35
34
  * text, and an unbounded handle would wrap the suggestion popup.
36
35
  */
@@ -38,8 +37,7 @@ const MAX_HANDLE_LENGTH = 64
38
37
 
39
38
  /**
40
39
  * Handles that address something other than a subagent, and so can never be
41
- * allocated to one. Claude Code reserves exactly this name (`Vq = "main"`),
42
- * refusing it at spawn and routing it to the main conversation instead.
40
+ * allocated to one. This name is refused at spawn and routed to the main conversation instead.
43
41
  */
44
42
  const RESERVED_HANDLES: ReadonlySet<string> = new Set(["main"])
45
43
 
@@ -123,8 +121,8 @@ export function describeMention(message: string): string {
123
121
  * allowed-tools narrowing, and the Task tool is not even named. The model reads
124
122
  * this and calls the tool itself.
125
123
  *
126
- * Ported verbatim from the 2.1.233 bundle's attachment renderer, trailing space
127
- * before the closing newline included, so the wording the model was trained
124
+ * Fixed wording, trailing space before the closing newline
125
+ * included, so the wording the model was trained
128
126
  * against is the wording it gets. The one substitution is ours: pi's equivalent
129
127
  * of Task is the `Agent` tool, and the agent listing that teaches valid
130
128
  * `subagent_type` values is the tool spec rather than a separate attachment.
@@ -137,6 +137,18 @@ export interface SubagentsSettings {
137
137
  * next pi session.
138
138
  */
139
139
  toolDescriptionMode?: ToolDescriptionMode
140
+ /**
141
+ * Where the SubagentWorkflow script reference reaches the model. "inline"
142
+ * (default) puts it in the tool description, where the model cannot skip it.
143
+ * "skill" saves about 4k tokens every session: one line points at the
144
+ * bundled `workflow-authoring` skill file by path instead, and the model has
145
+ * to choose to read it before writing a script — a model that does not
146
+ * writes the script without the reference. "deferred" keeps the tool out of
147
+ * the tool spec until pi's `tool_search` loads it, then carries the inline
148
+ * reference; it needs `tool_search` active. Read once at tool registration;
149
+ * applies on the next pi session.
150
+ */
151
+ workflowToolExposure?: WorkflowToolExposureMode
140
152
  /**
141
153
  * Whether the Claude Code-style FleetView (the navigable main+subagents list
142
154
  * rendered below the editor) is shown. Defaults to `true`. Pure-UI: when off,
@@ -360,6 +372,7 @@ export interface SubagentsSettings {
360
372
  }
361
373
 
362
374
  export type ToolDescriptionMode = "full" | "compact" | "custom"
375
+ export type WorkflowToolExposureMode = "skill" | "inline" | "deferred"
363
376
 
364
377
  /** Setter hooks used by applySettings to wire persisted values into in-memory state. */
365
378
  export interface SettingsAppliers {
@@ -375,6 +388,7 @@ export interface SettingsAppliers {
375
388
  setStrictAgentFiles: (b: boolean) => void
376
389
  setDisableDefaultAgents: (b: boolean) => void
377
390
  setToolDescriptionMode: (mode: ToolDescriptionMode) => void
391
+ setWorkflowToolExposure: (mode: WorkflowToolExposureMode) => void
378
392
  setFleetView: (b: boolean) => void
379
393
  setAgentMentions: (mode: AgentMentionMode) => void
380
394
  setRememberAgents: (b: boolean) => void
@@ -402,6 +416,8 @@ const VALID_JOIN_MODES: ReadonlySet<string> = new Set<JoinMode>([
402
416
  ])
403
417
  const VALID_TOOL_DESCRIPTION_MODES: ReadonlySet<string> =
404
418
  new Set<ToolDescriptionMode>(["full", "compact", "custom"])
419
+ const VALID_WORKFLOW_TOOL_EXPOSURE_MODES: ReadonlySet<string> =
420
+ new Set<WorkflowToolExposureMode>(["skill", "inline", "deferred"])
405
421
  const VALID_WIDGET_MODES: ReadonlySet<string> = new Set<WidgetMode>([
406
422
  "all",
407
423
  "background",
@@ -478,6 +494,7 @@ export const SETTING_DEFAULTS: {
478
494
  strictAgentFiles: false,
479
495
  disableDefaultAgents: false,
480
496
  toolDescriptionMode: "full",
497
+ workflowToolExposure: "inline",
481
498
  fleetView: true,
482
499
  agentMentions: "model",
483
500
  rememberAgents: true,
@@ -557,6 +574,13 @@ function sanitize(raw: unknown): SubagentsSettings {
557
574
  ) {
558
575
  out.toolDescriptionMode = r.toolDescriptionMode as ToolDescriptionMode
559
576
  }
577
+ if (
578
+ typeof r.workflowToolExposure === "string" &&
579
+ VALID_WORKFLOW_TOOL_EXPOSURE_MODES.has(r.workflowToolExposure)
580
+ ) {
581
+ out.workflowToolExposure =
582
+ r.workflowToolExposure as WorkflowToolExposureMode
583
+ }
560
584
  if (typeof r.fleetView === "boolean") {
561
585
  out.fleetView = r.fleetView
562
586
  }
@@ -792,6 +816,8 @@ export function applySettings(
792
816
  appliers.setDisableDefaultAgents(s.disableDefaultAgents)
793
817
  if (s.toolDescriptionMode)
794
818
  appliers.setToolDescriptionMode(s.toolDescriptionMode)
819
+ if (s.workflowToolExposure)
820
+ appliers.setWorkflowToolExposure(s.workflowToolExposure)
795
821
  if (typeof s.fleetView === "boolean") appliers.setFleetView(s.fleetView)
796
822
  if (s.agentMentions) appliers.setAgentMentions(s.agentMentions)
797
823
  if (typeof s.rememberAgents === "boolean")
@@ -67,13 +67,16 @@ export function createStructuredOutputTool(
67
67
  return defineTool({
68
68
  name: STRUCTURED_OUTPUT_TOOL_NAME,
69
69
  label: "Structured Output",
70
+ // The guidelines below carry what a forced call would make unnecessary:
71
+ // prose outside the call is discarded, and a rejected call should be made
72
+ // again.
70
73
  description:
71
- "Report your final answer. Call this exactly once, with the complete result, and put everything the " +
72
- "caller needs inside the arguments — text written outside this call is discarded. If a call is " +
73
- "rejected for not matching the schema, fix the reported fields and call it again.",
74
+ "Use this tool to return your final response in the requested structured format. You MUST call this " +
75
+ "tool exactly once at the end of your response to provide the structured output.",
74
76
  promptSnippet: "Report your final answer as structured data",
75
77
  promptGuidelines: [
76
78
  "Your final answer MUST be reported by calling StructuredOutput. Prose outside that call is discarded.",
79
+ "If a StructuredOutput call is rejected for not matching the schema, fix the reported fields and call it again.",
77
80
  ],
78
81
  // The caller's schema *is* the tool's input schema, verbatim — that is what
79
82
  // makes the provider fill the fields. pi types this as TypeBox's `TSchema`,
@@ -105,7 +108,7 @@ export function createStructuredOutputTool(
105
108
  content: [
106
109
  {
107
110
  type: "text",
108
- text: `StructuredOutput did not match the required schema:\n${verdict}\nCall it again with a corrected value.`,
111
+ text: `Output does not match required schema: ${verdict}`,
109
112
  },
110
113
  ],
111
114
  isError: true,
@@ -115,7 +118,12 @@ export function createStructuredOutputTool(
115
118
  // Last valid call wins: a model that calls twice meant the second one.
116
119
  capture.json = JSON.stringify(params)
117
120
  capture.lastError = undefined
118
- return { content: [{ type: "text", text: "Recorded." }], details: {} }
121
+ return {
122
+ content: [
123
+ { type: "text", text: "Structured output provided successfully" },
124
+ ],
125
+ details: {},
126
+ }
119
127
  },
120
128
  }) as ToolDefinition
121
129
  }
@@ -105,6 +105,8 @@ export interface FleetWorkflow {
105
105
  status: "running" | "completed" | "failed" | "killed" | "paused"
106
106
  doneCount: number
107
107
  totalCount: number
108
+ /** `Reviewing (2/3)` — the run's active phases, or "" for none. */
109
+ phase: string
108
110
  startedAt: number
109
111
  /** Set once the run settles, which is what freezes its clock. */
110
112
  completedAt?: number
@@ -141,6 +143,25 @@ export function formatFleetTokens(count: number): string {
141
143
  return `↓ ${compact} tokens`
142
144
  }
143
145
 
146
+ /** Cells in a workflow row's progress bar — Claude Code's width. */
147
+ export const PROGRESS_BAR_CELLS = 20
148
+
149
+ /**
150
+ * `▰▰▰▱▱…` — a run's done share as filled cells, returned as two runs so the
151
+ * caller can colour them. A run with no agents yet is all empty.
152
+ */
153
+ export function formatProgressBar(
154
+ done: number,
155
+ total: number,
156
+ cells = PROGRESS_BAR_CELLS,
157
+ ): { filled: string; empty: string } {
158
+ const n =
159
+ total > 0
160
+ ? Math.min(cells, Math.max(0, Math.round((cells * done) / total)))
161
+ : 0
162
+ return { filled: "▰".repeat(n), empty: "▱".repeat(cells - n) }
163
+ }
164
+
144
165
  /**
145
166
  * Place `right` flush to `width`, truncating `left` first so the stats survive.
146
167
  * The final clamp guarantees the line never exceeds `width` (which would wrap and
@@ -157,6 +178,7 @@ function rightAlign(left: string, right: string, width: number): string {
157
178
  export class FleetList {
158
179
  private ui: FleetUICtx | undefined
159
180
  private tui: any | undefined
181
+ private onTuiMode?: (mode: string) => void
160
182
  private inputUnsub: (() => void) | undefined
161
183
  private widgetRegistered = false
162
184
  private timer: ReturnType<typeof setInterval> | undefined
@@ -242,6 +264,15 @@ export class FleetList {
242
264
  this.update()
243
265
  }
244
266
 
267
+ /**
268
+ * Told pi's renderer mode (`"fullscreen"` | `"regular"`) each time the list is
269
+ * drawn into a TUI. pi hands over a new TUI on a mode switch, so this is how
270
+ * the extension learns of one.
271
+ */
272
+ setTuiModeObserver(observer: (mode: string) => void): void {
273
+ this.onTuiMode = observer
274
+ }
275
+
245
276
  /** Capture the UI context and (re)register the global input handler. */
246
277
  setUICtx(ui: FleetUICtx): void {
247
278
  if (ui === this.ui) return
@@ -322,6 +353,7 @@ export class FleetList {
322
353
  FLEET_KEY,
323
354
  (tui, theme) => {
324
355
  this.tui = tui
356
+ if (typeof tui?.mode === "string") this.onTuiMode?.(tui.mode)
325
357
  return {
326
358
  render: (w: number) => this.renderBar(w, theme),
327
359
  invalidate: () => {
@@ -765,9 +797,13 @@ export class FleetList {
765
797
  }
766
798
 
767
799
  /**
768
- * A run's row. Shaped like an agent's — gutter, dot, kind, name, stats flush
769
- * right — so the two read as one list, with the agent count where an agent
770
- * has its description and the same elapsed/token tail.
800
+ * A run's row: gutter, dot, a `workflow` label where an agent has its type,
801
+ * the name, then a progress bar, `done/total agents` and the active phases
802
+ * where an agent has its description, and the same elapsed/token tail flush right. Claude Code
803
+ * has no label and runs its stats inline after the bar; the label says what
804
+ * the row is, and the flush-right tail lines up with the agent rows.
805
+ * `rightAlign` cuts the left side first, so a narrow terminal loses the
806
+ * count and bar before the elapsed/token tail.
771
807
  */
772
808
  private renderWorkflowRow(
773
809
  rosterIndex: number,
@@ -777,17 +813,28 @@ export class FleetList {
777
813
  theme: Theme,
778
814
  ): string {
779
815
  const selected = rosterIndex === cursor
780
- const kind = theme.fg(selected ? "text" : "muted", "workflow")
781
816
  const name = selected ? theme.fg("text", workflow.name) : workflow.name
782
817
  const dot = this.dot(workflow.id === this.viewingWorkflowId, theme)
783
- const left = `${this.gutter(rosterIndex, cursor, theme)}${dot} ${kind} ${name}`
818
+ const { filled, empty } = formatProgressBar(
819
+ workflow.doneCount,
820
+ workflow.totalCount,
821
+ )
822
+ const bar =
823
+ theme.fg(workflow.status === "completed" ? "success" : "accent", filled) +
824
+ theme.fg("dim", empty)
825
+ const muted = (text: string) => theme.fg(selected ? "text" : "dim", text)
826
+ const kind = theme.fg(selected ? "text" : "muted", "workflow")
827
+ const count = muted(
828
+ `${workflow.doneCount}/${workflow.totalCount} agents${workflow.phase ? ` · ${workflow.phase}` : ""}`,
829
+ )
830
+ const left = `${this.gutter(rosterIndex, cursor, theme)}${dot} ${kind} ${name} ${bar} ${count}`
784
831
  // Frozen once the run settles, exactly as an agent's clock is.
785
832
  const elapsed = (workflow.completedAt ?? Date.now()) - workflow.startedAt
786
- const agents = `${workflow.doneCount}/${workflow.totalCount} agent${workflow.totalCount === 1 ? "" : "s"}`
787
- const stats = `${agents} · ${formatFleetElapsed(elapsed)} · ${formatFleetTokens(workflow.tokens)}`
788
833
  return rightAlign(
789
834
  left,
790
- selected ? theme.fg("text", stats) : theme.fg("dim", stats),
835
+ muted(
836
+ `${formatFleetElapsed(elapsed)} · ${formatFleetTokens(workflow.tokens)}`,
837
+ ),
791
838
  width,
792
839
  )
793
840
  }