@selesai/code 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/extensions/handoff-new.ts +1 -1
  3. package/dist/extensions/inline-skills.test.ts +1 -0
  4. package/dist/extensions/inline-skills.ts +1 -1
  5. package/dist/extensions/pi-intercom/CHANGELOG.md +25 -3
  6. package/dist/extensions/pi-intercom/README.md +34 -15
  7. package/dist/extensions/pi-intercom/broker/broker.ts +38 -141
  8. package/dist/extensions/pi-intercom/broker/client-liveness.test.ts +173 -0
  9. package/dist/extensions/pi-intercom/broker/client.ts +78 -150
  10. package/dist/extensions/pi-intercom/broker/extension-state.ts +18 -7
  11. package/dist/extensions/pi-intercom/broker/framing.ts +1 -1
  12. package/dist/extensions/pi-intercom/broker/protocol.ts +182 -0
  13. package/dist/extensions/pi-intercom/broker/spawn.test.ts +106 -7
  14. package/dist/extensions/pi-intercom/broker/spawn.ts +37 -11
  15. package/dist/extensions/pi-intercom/config.test.ts +8 -10
  16. package/dist/extensions/pi-intercom/config.ts +3 -3
  17. package/dist/extensions/pi-intercom/index.ts +218 -147
  18. package/dist/extensions/pi-intercom/intercom.integration.test.ts +891 -103
  19. package/dist/extensions/pi-intercom/package.json +3 -2
  20. package/dist/extensions/pi-intercom/project-agent.test.ts +145 -0
  21. package/dist/extensions/pi-intercom/project-agent.ts +324 -0
  22. package/dist/extensions/pi-intercom/reply-tracker.test.ts +86 -1
  23. package/dist/extensions/pi-intercom/reply-tracker.ts +41 -9
  24. package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +49 -9
  25. package/dist/extensions/pi-intercom/test/inline-message.test.ts +9 -9
  26. package/dist/extensions/pi-intercom/types.ts +3 -1
  27. package/dist/extensions/pi-intercom/ui/inline-message.ts +7 -7
  28. package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +2 -2
  29. package/dist/extensions/pi-powerline-footer/CHANGELOG.md +14 -1
  30. package/dist/extensions/pi-powerline-footer/README.md +20 -37
  31. package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +40 -25
  32. package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +149 -18
  33. package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +1 -0
  34. package/dist/extensions/pi-powerline-footer/editor-performance.ts +99 -0
  35. package/dist/extensions/pi-powerline-footer/git-status.ts +15 -0
  36. package/dist/extensions/pi-powerline-footer/index.ts +394 -317
  37. package/dist/extensions/pi-powerline-footer/package.json +1 -1
  38. package/dist/extensions/pi-powerline-footer/powerline-config.ts +0 -12
  39. package/dist/extensions/pi-powerline-footer/queue/store.ts +8 -56
  40. package/dist/extensions/pi-powerline-footer/queue/types.ts +1 -2
  41. package/dist/extensions/pi-powerline-footer/segments.ts +0 -3
  42. package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +231 -1
  43. package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +5 -19
  44. package/dist/extensions/pi-powerline-footer/tests/editor-performance.test.ts +43 -0
  45. package/dist/extensions/pi-powerline-footer/tests/git-optional-locks.test.ts +64 -0
  46. package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +116 -0
  47. package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +19 -149
  48. package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +6 -0
  49. package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +5 -5
  50. package/dist/extensions/pi-powerline-footer/types.ts +1 -2
  51. package/dist/extensions/pi-subagents/CHANGELOG.md +202 -14
  52. package/dist/extensions/pi-subagents/README.md +65 -1614
  53. package/dist/extensions/pi-subagents/agents/builder.md +0 -1
  54. package/dist/extensions/pi-subagents/agents/delegate.md +14 -0
  55. package/dist/extensions/pi-subagents/agents/oracle.md +74 -0
  56. package/dist/extensions/pi-subagents/agents/reviewer.md +78 -0
  57. package/dist/extensions/pi-subagents/agents/scout.md +50 -0
  58. package/dist/extensions/pi-subagents/agents/worker.md +58 -0
  59. package/dist/extensions/pi-subagents/docs/configuration.md +328 -0
  60. package/dist/extensions/pi-subagents/docs/extension-api.md +308 -0
  61. package/dist/extensions/pi-subagents/docs/missions.md +119 -0
  62. package/dist/extensions/pi-subagents/docs/models.md +192 -0
  63. package/dist/extensions/pi-subagents/docs/observability.md +174 -0
  64. package/dist/extensions/pi-subagents/docs/tool-reference.md +343 -0
  65. package/dist/extensions/pi-subagents/docs/watchdog.md +176 -0
  66. package/dist/extensions/pi-subagents/docs/workflows.md +163 -0
  67. package/dist/extensions/pi-subagents/inspector-runner.mjs +11 -0
  68. package/dist/extensions/pi-subagents/package-lock.json +152 -194
  69. package/dist/extensions/pi-subagents/package.json +9 -10
  70. package/dist/extensions/pi-subagents/prompts/gather-context-and-clarify.md +1 -1
  71. package/dist/extensions/pi-subagents/prompts/parallel-cleanup.md +9 -9
  72. package/dist/extensions/pi-subagents/prompts/parallel-research.md +6 -6
  73. package/dist/extensions/pi-subagents/prompts/parallel-review.md +8 -8
  74. package/dist/extensions/pi-subagents/prompts/review-loop.md +12 -12
  75. package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +22 -17
  76. package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +77 -72
  77. package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +177 -69
  78. package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +28 -8
  79. package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +88 -66
  80. package/dist/extensions/pi-subagents/src/agents/agent-management.ts +3 -3
  81. package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +624 -0
  82. package/dist/extensions/pi-subagents/src/agents/agents.ts +29 -16
  83. package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +7 -3
  84. package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +2 -2
  85. package/dist/extensions/pi-subagents/src/agents/skills.ts +2 -9
  86. package/dist/extensions/pi-subagents/src/api/delegation.ts +1 -2
  87. package/dist/extensions/pi-subagents/src/api/project-panes.ts +30 -0
  88. package/dist/extensions/pi-subagents/src/extension/config.ts +56 -8
  89. package/dist/extensions/pi-subagents/src/extension/control-notices.ts +2 -2
  90. package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +51 -26
  91. package/dist/extensions/pi-subagents/src/extension/index.ts +119 -50
  92. package/dist/extensions/pi-subagents/src/extension/public-execution.ts +72 -0
  93. package/dist/extensions/pi-subagents/src/extension/rpc.ts +15 -15
  94. package/dist/extensions/pi-subagents/src/extension/schemas.ts +58 -21
  95. package/dist/extensions/pi-subagents/src/extension/subagent-guide.ts +39 -0
  96. package/dist/extensions/pi-subagents/src/extension/tool-description.ts +47 -25
  97. package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +3 -3
  98. package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +460 -64
  99. package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +102 -4
  100. package/dist/extensions/pi-subagents/src/missions/actions.ts +77 -16
  101. package/dist/extensions/pi-subagents/src/missions/goal-driver.ts +162 -0
  102. package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +65 -14
  103. package/dist/extensions/pi-subagents/src/missions/store.ts +147 -5
  104. package/dist/extensions/pi-subagents/src/missions/types.ts +58 -3
  105. package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +256 -0
  106. package/dist/extensions/pi-subagents/src/profiles/profiles.ts +8 -8
  107. package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +42 -0
  108. package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +41 -7
  109. package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +294 -134
  110. package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +19 -3
  111. package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +39 -6
  112. package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +267 -0
  113. package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +145 -60
  114. package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +114 -6
  115. package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +33 -0
  116. package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +68 -0
  117. package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +71 -0
  118. package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +21 -2
  119. package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +42 -14
  120. package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +12 -24
  121. package/dist/extensions/pi-subagents/src/runs/background/steering.ts +7 -5
  122. package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +152 -68
  123. package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -4
  124. package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +146 -0
  125. package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +21 -5
  126. package/dist/extensions/pi-subagents/src/runs/foreground/async-dismiss-action.ts +85 -0
  127. package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +43 -18
  128. package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +20 -19
  129. package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +3 -0
  130. package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +55 -26
  131. package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +137 -0
  132. package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +798 -112
  133. package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +187 -0
  134. package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +165 -22
  135. package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
  136. package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +2 -0
  137. package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +9 -5
  138. package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +12 -2
  139. package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +1 -0
  140. package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +465 -116
  141. package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +10 -10
  142. package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +189 -32
  143. package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -2
  144. package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +3 -3
  145. package/dist/extensions/pi-subagents/src/shared/artifacts.ts +128 -3
  146. package/dist/extensions/pi-subagents/src/shared/display-text.ts +100 -0
  147. package/dist/extensions/pi-subagents/src/shared/file-coalescer.ts +9 -0
  148. package/dist/extensions/pi-subagents/src/shared/fork-context.ts +13 -0
  149. package/dist/extensions/pi-subagents/src/shared/formatters.ts +4 -6
  150. package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +51 -0
  151. package/dist/extensions/pi-subagents/src/shared/settings.ts +41 -11
  152. package/dist/extensions/pi-subagents/src/shared/types.ts +100 -3
  153. package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
  154. package/dist/extensions/pi-subagents/src/shared/utils.ts +43 -33
  155. package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +1 -14
  156. package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +1 -1
  157. package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +14 -12
  158. package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +176 -21
  159. package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +12 -6
  160. package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +52 -18
  161. package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +36 -5
  162. package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +30 -16
  163. package/dist/extensions/pi-subagents/src/tui/fleet.ts +151 -31
  164. package/dist/extensions/pi-subagents/src/tui/render.ts +201 -68
  165. package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +0 -6
  166. package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +5 -4
  167. package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +0 -1
  168. package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +313 -25
  169. package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +15 -15
  170. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
  171. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
  172. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
  173. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
  174. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
  175. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
  176. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
  177. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
  178. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
  179. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
  180. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
  181. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
  182. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
  183. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
  184. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
  185. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
  186. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
  187. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
  188. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
  189. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
  190. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
  191. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
  192. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
  193. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
  194. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
  195. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
  196. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
  197. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
  198. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
  199. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
  200. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
  201. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
  202. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
  203. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
  204. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
  205. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
  206. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
  207. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
  208. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
  209. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
  210. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
  211. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
  212. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
  213. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
  214. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
  215. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
  216. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
  217. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
  218. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
  219. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
  220. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
  221. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
  222. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
  223. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
  224. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
  225. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
  226. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
  227. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
  228. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
  229. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
  230. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
  231. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
  232. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
  233. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
  234. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
  235. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
  236. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
  237. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
  238. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
  239. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
  240. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
  241. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
  242. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
  243. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
  244. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
  245. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
  246. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
  247. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
  248. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
  249. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
  250. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  251. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
  252. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
  253. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
  254. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
  255. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
  256. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
  257. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
  258. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
  259. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
  260. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
  261. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
  262. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
  263. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
  264. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
  265. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
  266. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
  267. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  268. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  269. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  270. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  271. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
  272. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  273. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  274. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  275. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
  276. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  277. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
  278. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  279. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  280. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
  281. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
  282. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  283. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  284. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
  285. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
  286. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  287. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  288. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
  289. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  290. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
  291. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  292. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
  293. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
  294. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  295. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  296. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
  297. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  298. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  299. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
  300. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  301. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  302. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  303. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
  304. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  305. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
  306. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
  307. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
  308. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
  309. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
  310. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
  311. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
  312. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
  313. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
  314. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
  315. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
  316. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
  317. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
  318. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
  319. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
  320. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
  321. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
  322. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
  323. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
  324. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
  325. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
  326. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
  327. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
  328. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
  329. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
  330. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
  331. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
  332. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
  333. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
  334. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
  335. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
  336. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
  337. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
  338. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
  339. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
  340. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
  341. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
  342. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
  343. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
  344. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
  345. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/index.mjs +84 -0
  346. package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/package.json +14 -0
  347. package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +15 -15
  348. package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +411 -300
  349. package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +309 -123
  350. package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +99 -56
  351. package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +62 -16
  352. package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +159 -108
  353. package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -1
  354. package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +4 -2
  355. package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -56
  356. package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +114 -45
  357. package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +57 -19
  358. package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +106 -106
  359. package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +416 -106
  360. package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +287 -17
  361. package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +809 -87
  362. package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +107 -20
  363. package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
  364. package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +26 -6
  365. package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
  366. package/dist/extensions/pi-subagents/test/support/helpers.ts +2 -0
  367. package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +1 -1
  368. package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +0 -8
  369. package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +163 -58
  370. package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +15 -15
  371. package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +66 -66
  372. package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +334 -248
  373. package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +52 -52
  374. package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
  375. package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +99 -99
  376. package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +160 -0
  377. package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
  378. package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +43 -1
  379. package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +36 -10
  380. package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +387 -30
  381. package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +9 -9
  382. package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
  383. package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +94 -40
  384. package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +5 -3
  385. package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +7 -7
  386. package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +19 -19
  387. package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
  388. package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
  389. package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
  390. package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
  391. package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +35 -5
  392. package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
  393. package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +52 -52
  394. package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +187 -0
  395. package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +125 -71
  396. package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +18 -3
  397. package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +12 -12
  398. package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +17 -23
  399. package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
  400. package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
  401. package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
  402. package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +15 -0
  403. package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +62 -44
  404. package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +329 -37
  405. package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
  406. package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +37 -0
  407. package/dist/extensions/pi-subagents/test/unit/herdr-inspector-bootstrap.test.ts +69 -0
  408. package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +79 -2
  409. package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +102 -49
  410. package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +98 -32
  411. package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +5 -5
  412. package/dist/extensions/pi-subagents/test/unit/mission-goal-driver.test.ts +116 -0
  413. package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +55 -7
  414. package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +289 -13
  415. package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +28 -1
  416. package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +2 -2
  417. package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +11 -2
  418. package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +84 -10
  419. package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +122 -8
  420. package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +8 -8
  421. package/dist/extensions/pi-subagents/test/unit/notify.test.ts +24 -24
  422. package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +16 -2
  423. package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +7 -7
  424. package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
  425. package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
  426. package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +26 -17
  427. package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +405 -0
  428. package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +357 -92
  429. package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +22 -6
  430. package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +6 -6
  431. package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +43 -43
  432. package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
  433. package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
  434. package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +19 -19
  435. package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +243 -0
  436. package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +68 -168
  437. package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +58 -15
  438. package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +40 -0
  439. package/dist/extensions/pi-subagents/test/unit/reads-resolution.test.ts +66 -0
  440. package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +47 -28
  441. package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +12 -12
  442. package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +57 -0
  443. package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +107 -27
  444. package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
  445. package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +56 -50
  446. package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +69 -28
  447. package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
  448. package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +59 -44
  449. package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +424 -49
  450. package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +23 -1
  451. package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +32 -5
  452. package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
  453. package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +120 -91
  454. package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
  455. package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +85 -0
  456. package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
  457. package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +24 -0
  458. package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +312 -22
  459. package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +150 -15
  460. package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +26 -26
  461. package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +73 -0
  462. package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +76 -25
  463. package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +5 -5
  464. package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +55 -6
  465. package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
  466. package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
  467. package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
  468. package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
  469. package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +6 -6
  470. package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +138 -11
  471. package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
  472. package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +113 -0
  473. package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +7 -7
  474. package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +6 -6
  475. package/dist/extensions/workflow/extension.ts +21 -19
  476. package/dist/extensions/workflow/modes.ts +65 -0
  477. package/dist/skills/pi-subagents/SKILL.md +20 -15
  478. package/dist/skills/pi-subagents/references/constraints-and-recipes.md +77 -83
  479. package/dist/skills/pi-subagents/references/execution-controls.md +215 -106
  480. package/dist/skills/pi-subagents/references/management-authoring-rpc.md +29 -9
  481. package/dist/skills/pi-subagents/references/prompting-and-roles.md +58 -43
  482. package/docs/plans/workflow-autoloop-reference.md +192 -0
  483. package/docs/plans/workflow-subagent-consolidation-planb.md +374 -0
  484. package/docs/plans/workflow-subagent-scripted-merge.md +406 -0
  485. package/package.json +1 -1
  486. package/dist/extensions/workflow/adapter.ts +0 -949
  487. package/dist/extensions/workflow/modes/loop.ts +0 -74
  488. package/dist/extensions/workflow/modes/prototype.ts +0 -170
  489. package/dist/extensions/workflow/modes/quicktype.ts +0 -150
  490. package/dist/extensions/workflow/modes/task.ts +0 -105
  491. package/dist/extensions/workflow/run-state.ts +0 -124
  492. package/dist/extensions/workflow/state-machine.ts +0 -484
  493. package/dist/extensions/workflow/validators.ts +0 -42
@@ -1,4 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
+ import { execFileSync } from "node:child_process";
2
3
  import * as fs from "node:fs";
3
4
  import * as os from "node:os";
4
5
  import * as path from "node:path";
@@ -23,6 +24,50 @@ function writeAgent(filePath: string, body: string): void {
23
24
  fs.writeFileSync(filePath, body, "utf-8");
24
25
  }
25
26
 
27
+ function createNestedLinkedWorktree(): { repo: string; worktree: string } {
28
+ const repo = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-linked-worktree-"));
29
+ tempDirs.push(repo);
30
+ execFileSync("git", ["init"], { cwd: repo, stdio: "ignore" });
31
+ execFileSync("git", ["config", "user.email", "test@example.com"], { cwd: repo });
32
+ execFileSync("git", ["config", "user.name", "Test User"], { cwd: repo });
33
+ fs.writeFileSync(path.join(repo, "base.txt"), "base\n", "utf-8");
34
+ execFileSync("git", ["add", "base.txt"], { cwd: repo });
35
+ execFileSync("git", ["commit", "-m", "base"], { cwd: repo, stdio: "ignore" });
36
+
37
+ const worktree = path.join(repo, ".worktrees", "linked");
38
+ execFileSync("git", ["worktree", "add", "-b", "linked", worktree], { cwd: repo, stdio: "ignore" });
39
+ return { repo, worktree };
40
+ }
41
+
42
+ function writeLinkedWorktreePackage(repo: string): { packageAgentName: string; packageAgentPath: string; settingsPath: string } {
43
+ const packageAgentName = "issue950-workflow.reviewer";
44
+ const packageRoot = path.join(repo, ".selesai", "vendor", "workflow");
45
+ const packageAgentPath = path.join(packageRoot, "agents", "reviewer.md");
46
+ const settingsPath = path.join(repo, ".selesai", "settings.json");
47
+ writeJson(settingsPath, {
48
+ packages: [{ source: "file:./vendor/workflow" }],
49
+ subagents: {
50
+ projectRootResolution: "git-root",
51
+ agentOverrides: {
52
+ reviewer: { model: "issue950/outer-model" },
53
+ },
54
+ },
55
+ });
56
+ writeJson(path.join(packageRoot, "package.json"), {
57
+ name: "issue950-workflow",
58
+ "pi-subagents": { agents: ["./agents"] },
59
+ });
60
+ writeAgent(packageAgentPath, `---
61
+ name: reviewer
62
+ package: issue950-workflow
63
+ description: Review from the primary checkout.
64
+ ---
65
+
66
+ Review the linked worktree.
67
+ `);
68
+ return { packageAgentName, packageAgentPath, settingsPath };
69
+ }
70
+
26
71
  function withTempHome<T>(fn: (home: string) => T): T {
27
72
  const home = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-home-"));
28
73
  tempDirs.push(home);
@@ -60,7 +105,7 @@ describe("folded frontmatter blocks", () => {
60
105
  it("folds ordinary lines and paragraph breaks for > and >-", () => {
61
106
  const expected = "first line second line\nthird line";
62
107
  const folded = parseFrontmatter(`---
63
- name: builder
108
+ name: worker
64
109
  description: >
65
110
  first line
66
111
  second line
@@ -69,7 +114,7 @@ description: >
69
114
  ---
70
115
  body`);
71
116
  const stripped = parseFrontmatter(`---
72
- name: builder
117
+ name: worker
73
118
  description: >-
74
119
  first line
75
120
  second line
@@ -80,7 +125,7 @@ body`);
80
125
 
81
126
  assert.equal(folded.frontmatter.description, expected);
82
127
  assert.equal(stripped.frontmatter.description, expected);
83
- assert.equal(folded.frontmatter.name, "builder");
128
+ assert.equal(folded.frontmatter.name, "worker");
84
129
  });
85
130
 
86
131
  it("keeps quoted indicators as literal values", () => {
@@ -94,6 +139,18 @@ body`);
94
139
  assert.equal(parsed.frontmatter.other, ">-");
95
140
  });
96
141
 
142
+ it("preserves lines for | and |-", () => {
143
+ for (const indicator of ["|", "|-"]) {
144
+ const parsed = parseFrontmatter(`---
145
+ description: ${indicator}
146
+ first line
147
+ second line
148
+ ---
149
+ body`);
150
+ assert.equal(parsed.frontmatter.description, "first line\nsecond line");
151
+ }
152
+ });
153
+
97
154
  it("preserves more-indented lines and repeated whitespace-only separators", () => {
98
155
  const parsed = parseFrontmatter(`---
99
156
  description: >
@@ -105,12 +162,12 @@ description: >
105
162
 
106
163
  ${" ".repeat(3)}
107
164
  second
108
- name: builder
165
+ name: worker
109
166
  ---
110
167
  body`);
111
168
 
112
169
  assert.equal(parsed.frontmatter.description, "normal\n code\nnext\nfirst\n\nsecond");
113
- assert.equal(parsed.frontmatter.name, "builder");
170
+ assert.equal(parsed.frontmatter.name, "worker");
114
171
  });
115
172
 
116
173
  it("keeps paragraph breaks adjacent to more-indented lines", () => {
@@ -183,16 +240,16 @@ describe("agent skillPath frontmatter", () => {
183
240
  it("parses and serializes comma-separated paths", () => withTempHome(() => {
184
241
  const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-skill-path-agent-"));
185
242
  tempDirs.push(project);
186
- writeAgent(path.join(project, ".selesai", "agents", "builder.md"), `---
187
- name: builder
243
+ writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
244
+ name: worker
188
245
  description: Worker
189
246
  skillPath: ./skills, ../shared-skills
190
247
  ---
191
248
  body`);
192
249
 
193
- const builder = discoverAgents(project, "both").agents.find((agent) => agent.name === "builder")!;
194
- assert.deepEqual(builder.skillPath, ["./skills", "../shared-skills"]);
195
- assert.match(serializeAgent(builder), /^skillPath: \.\/skills, \.\.\/shared-skills$/m);
250
+ const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
251
+ assert.deepEqual(worker.skillPath, ["./skills", "../shared-skills"]);
252
+ assert.match(serializeAgent(worker), /^skillPath: \.\/skills, \.\.\/shared-skills$/m);
196
253
  }));
197
254
  });
198
255
 
@@ -200,20 +257,20 @@ describe("agent aliases", () => {
200
257
  it("parses and serializes agent aliases", () => withTempHome(() => {
201
258
  const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-alias-agent-"));
202
259
  tempDirs.push(project);
203
- writeAgent(path.join(project, ".selesai", "agents", "builder.md"), `---
204
- name: builder
260
+ writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
261
+ name: worker
205
262
  description: Worker
206
- aliases: developer, coder, builder
263
+ aliases: developer, coder, worker
207
264
  ---
208
265
  body`);
209
266
 
210
- const builder = discoverAgents(project, "both").agents.find((agent) => agent.name === "builder")!;
211
- assert.deepEqual(builder.aliases, ["developer", "coder"]);
212
- assert.match(serializeAgent(builder), /^aliases: developer, coder$/m);
267
+ const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
268
+ assert.deepEqual(worker.aliases, ["developer", "coder"]);
269
+ assert.match(serializeAgent(worker), /^aliases: developer, coder$/m);
213
270
 
214
271
  const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
215
272
  assert.match(handleManagementAction("list", {}, ctx).content[0]?.text ?? "", /aliases: developer, coder/);
216
- assert.match(handleManagementAction("get", { agent: "developer" }, ctx).content[0]?.text ?? "", /Agent: builder/);
273
+ assert.match(handleManagementAction("get", { agent: "developer" }, ctx).content[0]?.text ?? "", /Agent: worker/);
217
274
  }));
218
275
 
219
276
  it("reports management alias collisions as ambiguous", () => withTempHome(() => {
@@ -221,7 +278,7 @@ body`);
221
278
  tempDirs.push(project);
222
279
  writeAgent(path.join(project, ".selesai", "agents", "review-agent.md"), `---
223
280
  name: review-agent
224
- description: Custom commentator
281
+ description: Custom reviewer
225
282
  aliases: developer
226
283
  ---
227
284
  body`);
@@ -229,11 +286,11 @@ body`);
229
286
  const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
230
287
  const getResult = handleManagementAction("get", { agent: "developer" }, ctx);
231
288
  assert.equal(getResult.isError, true);
232
- assert.match(getResult.content[0]?.text ?? "", /Ambiguous agent alias or name 'developer': (?:review-agent, builder|builder, review-agent)/);
289
+ assert.match(getResult.content[0]?.text ?? "", /Ambiguous agent alias or name 'developer': review-agent, worker/);
233
290
 
234
291
  const disableResult = handleManagementAction("disable", { agent: "developer" }, ctx);
235
292
  assert.equal(disableResult.isError, true);
236
- assert.match(disableResult.content[0]?.text ?? "", /Ambiguous agent alias 'developer': builder, review-agent|Ambiguous agent alias 'developer': review-agent, builder/);
293
+ assert.match(disableResult.content[0]?.text ?? "", /Ambiguous agent alias 'developer': worker, review-agent|Ambiguous agent alias 'developer': review-agent, worker/);
237
294
  }));
238
295
  });
239
296
 
@@ -241,8 +298,8 @@ describe("agent simple-scalar list frontmatter", () => {
241
298
  it("discovers newline block lists for all list fields and routes MCP tools", () => {
242
299
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-block-list-frontmatter-"));
243
300
  tempDirs.push(dir);
244
- writeAgent(path.join(dir, ".selesai", "agents", "builder.md"), `---
245
- name: builder
301
+ writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
302
+ name: worker
246
303
  description: Worker
247
304
  tools:
248
305
  - read-only
@@ -270,15 +327,15 @@ subagentOnlyExtensions:
270
327
  Do work
271
328
  `);
272
329
 
273
- const builder = discoverAgents(dir, "project").agents.find((agent) => agent.name === "builder");
274
- assert.deepEqual(builder?.tools, ["read-only"]);
275
- assert.deepEqual(builder?.mcpDirectTools, ["github/search_repositories"]);
276
- assert.deepEqual(builder?.defaultReads, ["input-one.md", "input-two.md"]);
277
- assert.deepEqual(builder?.skills, ["review-checklist", "safe-bash"]);
278
- assert.deepEqual(builder?.skillPath, ["./private-skills", "../shared-skills"]);
279
- assert.deepEqual(builder?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
280
- assert.deepEqual(builder?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
281
- assert.deepEqual(builder?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
330
+ const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
331
+ assert.deepEqual(worker?.tools, ["read-only"]);
332
+ assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
333
+ assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
334
+ assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
335
+ assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
336
+ assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
337
+ assert.deepEqual(worker?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
338
+ assert.deepEqual(worker?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
282
339
  });
283
340
 
284
341
  it("preserves MCP-only tools as an explicit empty builtin allowlist", () => {
@@ -302,8 +359,8 @@ Do MCP work
302
359
  it("preserves comma-separated syntax across all list fields", () => {
303
360
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-comma-list-frontmatter-"));
304
361
  tempDirs.push(dir);
305
- writeAgent(path.join(dir, ".selesai", "agents", "builder.md"), `---
306
- name: builder
362
+ writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
363
+ name: worker
307
364
  description: Worker
308
365
  tools: read-only, mcp:github/search_repositories
309
366
  defaultReads: input-one.md, input-two.md
@@ -317,15 +374,15 @@ subagentOnlyExtensions: ./child-only.ts, ./child-helper.ts
317
374
  Do work
318
375
  `);
319
376
 
320
- const builder = discoverAgents(dir, "project").agents.find((agent) => agent.name === "builder");
321
- assert.deepEqual(builder?.tools, ["read-only"]);
322
- assert.deepEqual(builder?.mcpDirectTools, ["github/search_repositories"]);
323
- assert.deepEqual(builder?.defaultReads, ["input-one.md", "input-two.md"]);
324
- assert.deepEqual(builder?.skills, ["review-checklist", "safe-bash"]);
325
- assert.deepEqual(builder?.skillPath, ["./private-skills", "../shared-skills"]);
326
- assert.deepEqual(builder?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
327
- assert.deepEqual(builder?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
328
- assert.deepEqual(builder?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
377
+ const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
378
+ assert.deepEqual(worker?.tools, ["read-only"]);
379
+ assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
380
+ assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
381
+ assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
382
+ assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
383
+ assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
384
+ assert.deepEqual(worker?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
385
+ assert.deepEqual(worker?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
329
386
  });
330
387
  });
331
388
 
@@ -335,8 +392,8 @@ describe("agent permission frontmatter", () => {
335
392
  tempDirs.push(dir);
336
393
  const agentsDir = path.join(dir, ".selesai", "agents");
337
394
  fs.mkdirSync(agentsDir, { recursive: true });
338
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
339
- name: builder
395
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
396
+ name: worker
340
397
  description: Worker
341
398
  tools: bash,read,write
342
399
  permission:
@@ -348,10 +405,10 @@ permission:
348
405
  Do work
349
406
  `, "utf-8");
350
407
 
351
- const builder = discoverAgents(dir, "project").agents.find((agent) => agent.name === "builder");
352
- assert.deepEqual(builder?.permissions, { read: "allow", write: "ask", edit: "deny" });
353
- assert.equal(builder?.extraFields?.permission, undefined);
354
- assert.match(serializeAgent(builder!), /^permissions:\n read: allow\n write: ask\n edit: deny$/m);
408
+ const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
409
+ assert.deepEqual(worker?.permissions, { read: "allow", write: "ask", edit: "deny" });
410
+ assert.equal(worker?.extraFields?.permission, undefined);
411
+ assert.match(serializeAgent(worker!), /^permissions:\n read: allow\n write: ask\n edit: deny$/m);
355
412
  });
356
413
 
357
414
  it("rejects bash permission rules and conflicting aliases", () => {
@@ -359,10 +416,10 @@ Do work
359
416
  tempDirs.push(dir);
360
417
  const agentsDir = path.join(dir, ".selesai", "agents");
361
418
  fs.mkdirSync(agentsDir, { recursive: true });
362
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---\nname: builder\ndescription: Worker\npermission:\n bash: deny\n---\n`, "utf-8");
419
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n bash: deny\n---\n`, "utf-8");
363
420
  assert.throws(() => discoverAgents(dir, "project"), /pi-guard/);
364
421
 
365
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---\nname: builder\ndescription: Worker\npermission:\n write: ask\npermissions:\n edit: deny\n---\n`, "utf-8");
422
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n write: ask\npermissions:\n edit: deny\n---\n`, "utf-8");
366
423
  assert.throws(() => discoverAgents(dir, "project"), /cannot declare both permission and permissions/);
367
424
  });
368
425
  });
@@ -370,14 +427,14 @@ Do work
370
427
  describe("agent frontmatter defaultContext", () => {
371
428
  it("serializes defaultContext into agent frontmatter", () => {
372
429
  const agent: AgentConfig = {
373
- name: "builder",
430
+ name: "worker",
374
431
  description: "Worker",
375
432
  systemPrompt: "Do work",
376
433
  systemPromptMode: "replace",
377
434
  inheritProjectContext: true,
378
435
  inheritSkills: false,
379
436
  source: "project",
380
- filePath: "/tmp/builder.md",
437
+ filePath: "/tmp/worker.md",
381
438
  defaultContext: "fork",
382
439
  };
383
440
 
@@ -390,8 +447,8 @@ describe("agent frontmatter defaultContext", () => {
390
447
  tempDirs.push(dir);
391
448
  const agentsDir = path.join(dir, ".selesai", "agents");
392
449
  fs.mkdirSync(agentsDir, { recursive: true });
393
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
394
- name: builder
450
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
451
+ name: worker
395
452
  description: Worker
396
453
  defaultContext: fork
397
454
  ---
@@ -400,18 +457,23 @@ Do work
400
457
  `, "utf-8");
401
458
 
402
459
  const result = discoverAgents(dir, "project");
403
- const builder = result.agents.find((agent) => agent.name === "builder");
404
- assert.equal(builder?.defaultContext, "fork");
460
+ const worker = result.agents.find((agent) => agent.name === "worker");
461
+ assert.equal(worker?.defaultContext, "fork");
405
462
  });
406
463
 
407
- it("loads bundled architect, builder, and commentator context defaults", () => {
464
+ it("loads packaged worker and oracle with fork defaultContext and advisor alias", () => {
408
465
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-default-context-"));
409
466
  tempDirs.push(dir);
410
467
  const agents = discoverAgentsAll(dir).builtin;
411
468
 
412
- assert.equal(agents.find((candidate) => candidate.name === "architect")?.defaultContext, "fork");
413
- assert.equal(agents.find((candidate) => candidate.name === "builder")?.defaultContext, "fresh");
414
- assert.equal(agents.find((candidate) => candidate.name === "commentator")?.defaultContext, "fresh");
469
+ for (const name of ["worker", "oracle"]) {
470
+ const agent = agents.find((candidate) => candidate.name === name);
471
+ assert.equal(agent?.defaultContext, "fork", `${name} should default to fork context`);
472
+ }
473
+ const oracle = agents.find((candidate) => candidate.name === "oracle");
474
+ assert.deepEqual(oracle?.aliases, ["advisor"]);
475
+ assert.equal(agents.some((candidate) => candidate.name === "planner"), false);
476
+ assert.equal(agents.some((candidate) => candidate.name === "context-builder"), false);
415
477
  });
416
478
  });
417
479
 
@@ -419,9 +481,9 @@ describe("agent frontmatter launch defaults", () => {
419
481
  it("serializes and discovers single-agent launch defaults", () => {
420
482
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-launch-defaults-"));
421
483
  tempDirs.push(dir);
422
- const filePath = path.join(dir, ".selesai", "agents", "builder.md");
484
+ const filePath = path.join(dir, ".selesai", "agents", "worker.md");
423
485
  const agent: AgentConfig = {
424
- name: "builder",
486
+ name: "worker",
425
487
  description: "Worker",
426
488
  systemPrompt: "Do work",
427
489
  systemPromptMode: "replace",
@@ -442,29 +504,29 @@ describe("agent frontmatter launch defaults", () => {
442
504
  assert.match(serialized, /^acceptance: \{"level":"none","reason":"lightweight lookup"\}$/m);
443
505
  writeAgent(filePath, serialized);
444
506
 
445
- const builder = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "builder");
446
- assert.equal(builder?.defaultAsync, false);
447
- assert.equal(builder?.defaultTimeoutMs, 90_000);
448
- assert.deepEqual(builder?.defaultTurnBudget, { maxTurns: 12, graceTurns: 2 });
449
- assert.deepEqual(builder?.defaultAcceptance, { level: "none", reason: "lightweight lookup" });
507
+ const worker = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "worker");
508
+ assert.equal(worker?.defaultAsync, false);
509
+ assert.equal(worker?.defaultTimeoutMs, 90_000);
510
+ assert.deepEqual(worker?.defaultTurnBudget, { maxTurns: 12, graceTurns: 2 });
511
+ assert.deepEqual(worker?.defaultAcceptance, { level: "none", reason: "lightweight lookup" });
450
512
  });
451
513
 
452
514
  it("parses scalar acceptance defaults and rejects invalid policies", () => {
453
515
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-acceptance-defaults-"));
454
516
  tempDirs.push(dir);
455
- const filePath = path.join(dir, ".selesai", "agents", "builder.md");
517
+ const filePath = path.join(dir, ".selesai", "agents", "worker.md");
456
518
  writeAgent(filePath, `---
457
- name: builder
519
+ name: worker
458
520
  description: Worker
459
521
  acceptance: checked
460
522
  ---
461
523
 
462
524
  Do work
463
525
  `);
464
- assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "builder")?.defaultAcceptance, "checked");
526
+ assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance, "checked");
465
527
 
466
528
  writeAgent(filePath, `---
467
- name: builder
529
+ name: worker
468
530
  description: Worker
469
531
  acceptance: { level: "none", reason: "NA" }
470
532
  ---
@@ -472,12 +534,12 @@ acceptance: { level: "none", reason: "NA" }
472
534
  Do work
473
535
  `);
474
536
  assert.deepEqual(
475
- discoverAgents(dir, "project").agents.find((agent) => agent.name === "builder")?.defaultAcceptance,
537
+ discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance,
476
538
  { level: "none", reason: "NA" },
477
539
  );
478
540
 
479
541
  writeAgent(filePath, `---
480
- name: builder
542
+ name: worker
481
543
  description: Worker
482
544
  acceptance: none
483
545
  ---
@@ -486,7 +548,7 @@ Do work
486
548
  `);
487
549
  assert.throws(
488
550
  () => discoverAgents(dir, "project"),
489
- /Agent 'builder' acceptance frontmatter level "none" requires a reason/,
551
+ /Agent 'worker' acceptance frontmatter level "none" requires a reason/,
490
552
  );
491
553
  });
492
554
 
@@ -525,8 +587,8 @@ Explore the codebase
525
587
  it("rejects invalid launch defaults instead of silently ignoring them", () => {
526
588
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-invalid-launch-defaults-"));
527
589
  tempDirs.push(dir);
528
- writeAgent(path.join(dir, ".selesai", "agents", "builder.md"), `---
529
- name: builder
590
+ writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
591
+ name: worker
530
592
  description: Worker
531
593
  async: sometimes
532
594
  ---
@@ -536,7 +598,7 @@ Do work
536
598
 
537
599
  assert.throws(
538
600
  () => discoverAgents(dir, "project"),
539
- /Agent 'builder' has invalid async frontmatter; expected true or false/,
601
+ /Agent 'worker' has invalid async frontmatter; expected true or false/,
540
602
  );
541
603
  });
542
604
  });
@@ -552,7 +614,7 @@ name: dynamic-review
552
614
  description: Markdown fallback
553
615
  ---
554
616
 
555
- ## explorer
617
+ ## scout
556
618
 
557
619
  Run the markdown chain
558
620
  `, "utf-8");
@@ -561,14 +623,14 @@ Run the markdown chain
561
623
  description: "JSON dynamic chain",
562
624
  chain: [
563
625
  {
564
- agent: "explorer",
626
+ agent: "scout",
565
627
  task: "Return targets",
566
628
  as: "targets",
567
629
  outputSchema: { type: "object" },
568
630
  },
569
631
  {
570
632
  expand: { from: { output: "targets", path: "/items" }, maxItems: 4 },
571
- parallel: { agent: "commentator", task: "Review {item.path}" },
633
+ parallel: { agent: "reviewer", task: "Review {item.path}" },
572
634
  collect: { as: "reviews" },
573
635
  },
574
636
  ],
@@ -594,8 +656,8 @@ describe("package-provided agents and chains", () => {
594
656
  agents: ["./agents"],
595
657
  },
596
658
  });
597
- writeAgent(path.join(workflowRoot, "agents", "commentator.md"), `---
598
- name: commentator
659
+ writeAgent(path.join(workflowRoot, "agents", "reviewer.md"), `---
660
+ name: reviewer
599
661
  package: my-workflow
600
662
  description: Review changes for this workflow.
601
663
  ---
@@ -616,22 +678,22 @@ package: my-workflow
616
678
  description: Run workflow review.
617
679
  ---
618
680
 
619
- ## my-workflow.commentator
681
+ ## my-workflow.reviewer
620
682
 
621
683
  Review the task.
622
684
  `);
623
685
 
624
686
  const all = discoverAgentsAll(dir);
625
- const packagedAgent = all.package.find((agent) => agent.name === "my-workflow.commentator");
687
+ const packagedAgent = all.package.find((agent) => agent.name === "my-workflow.reviewer");
626
688
  assert.ok(packagedAgent);
627
689
  assert.equal(packagedAgent.source, "package");
628
- assert.equal(packagedAgent.filePath, path.join(workflowRoot, "agents", "commentator.md"));
629
- assert.equal(discoverAgents(dir, "both").agents.find((agent) => agent.name === "my-workflow.commentator")?.source, "package");
690
+ assert.equal(packagedAgent.filePath, path.join(workflowRoot, "agents", "reviewer.md"));
691
+ assert.equal(discoverAgents(dir, "both").agents.find((agent) => agent.name === "my-workflow.reviewer")?.source, "package");
630
692
 
631
693
  const packagedChain = all.chains.find((chain) => chain.name === "my-workflow.review");
632
694
  assert.ok(packagedChain);
633
695
  assert.equal(packagedChain.source, "package");
634
- assert.equal(packagedChain.steps[0]?.agent, "my-workflow.commentator");
696
+ assert.equal(packagedChain.steps[0]?.agent, "my-workflow.reviewer");
635
697
  }));
636
698
 
637
699
  it("loads packages referenced from Pi settings", () => withTempHome(() => {
@@ -649,8 +711,8 @@ Review the task.
649
711
  },
650
712
  },
651
713
  });
652
- writeAgent(path.join(packageRoot, "agents", "architect.md"), `---
653
- name: architect
714
+ writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
715
+ name: planner
654
716
  package: settings-workflow
655
717
  description: Plan from a settings-installed package.
656
718
  ---
@@ -658,7 +720,7 @@ description: Plan from a settings-installed package.
658
720
  Plan the work.
659
721
  `);
660
722
 
661
- const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "settings-workflow.architect");
723
+ const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "settings-workflow.planner");
662
724
  assert.ok(agent);
663
725
  assert.equal(agent.source, "package");
664
726
  }));
@@ -675,8 +737,8 @@ Plan the work.
675
737
  agents: ["./agents"],
676
738
  },
677
739
  });
678
- writeAgent(path.join(packageRoot, "agents", "commentator.md"), `---
679
- name: commentator
740
+ writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
741
+ name: reviewer
680
742
  package: nested-workflow
681
743
  description: Review from a project package.
682
744
  ---
@@ -684,10 +746,10 @@ description: Review from a project package.
684
746
  Review nested project work.
685
747
  `);
686
748
 
687
- const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "nested-workflow.commentator");
749
+ const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "nested-workflow.reviewer");
688
750
  assert.ok(agent);
689
751
  assert.equal(agent.source, "package");
690
- assert.equal(agent.filePath, path.join(packageRoot, "agents", "commentator.md"));
752
+ assert.equal(agent.filePath, path.join(packageRoot, "agents", "reviewer.md"));
691
753
  }));
692
754
 
693
755
  it("keeps nearest project root discovery by default when a nested .pi exists", () => withTempHome(() => {
@@ -703,8 +765,8 @@ Review nested project work.
703
765
  name: "outer-workflow",
704
766
  "pi-subagents": { agents: ["./agents"] },
705
767
  });
706
- writeAgent(path.join(packageRoot, "agents", "architect.md"), `---
707
- name: architect
768
+ writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
769
+ name: planner
708
770
  package: outer-workflow
709
771
  description: Plan from the outer project package.
710
772
  ---
@@ -712,7 +774,7 @@ description: Plan from the outer project package.
712
774
  Plan outer project work.
713
775
  `);
714
776
 
715
- const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "outer-workflow.architect");
777
+ const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "outer-workflow.planner");
716
778
  assert.equal(agent, undefined);
717
779
  }));
718
780
 
@@ -729,7 +791,7 @@ Plan outer project work.
729
791
  subagents: {
730
792
  projectRootResolution: "git-root",
731
793
  agentOverrides: {
732
- commentator: { model: "openai/gpt-5.4" },
794
+ reviewer: { model: "openai/gpt-5.4" },
733
795
  },
734
796
  },
735
797
  });
@@ -737,8 +799,8 @@ Plan outer project work.
737
799
  name: "outer-workflow",
738
800
  "pi-subagents": { agents: ["./agents"] },
739
801
  });
740
- writeAgent(path.join(packageRoot, "agents", "architect.md"), `---
741
- name: architect
802
+ writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
803
+ name: planner
742
804
  package: outer-workflow
743
805
  description: Plan from the outer project package.
744
806
  ---
@@ -747,13 +809,58 @@ Plan outer project work.
747
809
  `);
748
810
 
749
811
  const agents = discoverAgents(nested, "both").agents;
750
- const packageAgent = agents.find((candidate) => candidate.name === "outer-workflow.architect");
812
+ const packageAgent = agents.find((candidate) => candidate.name === "outer-workflow.planner");
751
813
  assert.ok(packageAgent);
752
814
  assert.equal(packageAgent.source, "package");
753
- assert.equal(packageAgent.filePath, path.join(packageRoot, "agents", "architect.md"));
754
- const commentator = agents.find((candidate) => candidate.name === "commentator");
755
- assert.equal(commentator?.model, "openai/gpt-5.4");
756
- assert.equal(commentator?.override?.path, path.join(dir, ".selesai", "settings.json"));
815
+ assert.equal(packageAgent.filePath, path.join(packageRoot, "agents", "planner.md"));
816
+ const reviewer = agents.find((candidate) => candidate.name === "reviewer");
817
+ assert.equal(reviewer?.model, "openai/gpt-5.4");
818
+ assert.equal(reviewer?.override?.path, path.join(dir, ".selesai", "settings.json"));
819
+ }));
820
+
821
+ it("keeps git-root discovery stable when a nested linked worktree creates incidental .pi state", () => withTempHome(() => {
822
+ const { repo, worktree } = createNestedLinkedWorktree();
823
+ const { packageAgentName, packageAgentPath, settingsPath } = writeLinkedWorktreePackage(repo);
824
+
825
+ const before = discoverAgents(worktree, "both").agents;
826
+ const beforePackageAgent = before.find((candidate) => candidate.name === packageAgentName);
827
+ assert.ok(beforePackageAgent);
828
+ assert.equal(beforePackageAgent.source, "package");
829
+ assert.equal(beforePackageAgent.filePath, packageAgentPath);
830
+ assert.equal(before.find((candidate) => candidate.name === "reviewer")?.override?.path, settingsPath);
831
+
832
+ fs.mkdirSync(path.join(worktree, ".selesai", "todos"), { recursive: true });
833
+
834
+ const after = discoverAgents(worktree, "both").agents;
835
+ const all = discoverAgentsAll(worktree);
836
+ const afterPackageAgent = after.find((candidate) => candidate.name === packageAgentName);
837
+ const allPackageAgent = all.package.find((candidate) => candidate.name === packageAgentName);
838
+ assert.equal(afterPackageAgent?.source, beforePackageAgent.source);
839
+ assert.equal(afterPackageAgent?.filePath, beforePackageAgent.filePath);
840
+ assert.equal(allPackageAgent?.filePath, afterPackageAgent.filePath);
841
+ assert.equal(all.projectSettingsPath, settingsPath);
842
+ assert.equal(after.find((candidate) => candidate.name === "reviewer")?.override?.path, all.projectSettingsPath);
843
+ }));
844
+
845
+ it("lets a linked worktree opt back into nearest-root discovery", () => withTempHome(() => {
846
+ const { repo, worktree } = createNestedLinkedWorktree();
847
+ const { packageAgentName } = writeLinkedWorktreePackage(repo);
848
+ const worktreeSettingsPath = path.join(worktree, ".selesai", "settings.json");
849
+ writeJson(worktreeSettingsPath, {
850
+ subagents: {
851
+ projectRootResolution: "nearest",
852
+ agentOverrides: {
853
+ reviewer: { model: "issue950/worktree-model" },
854
+ },
855
+ },
856
+ });
857
+
858
+ const discovered = discoverAgents(worktree, "both").agents;
859
+ const all = discoverAgentsAll(worktree);
860
+ assert.equal(discovered.find((candidate) => candidate.name === packageAgentName), undefined);
861
+ assert.equal(all.package.find((candidate) => candidate.name === packageAgentName), undefined);
862
+ assert.equal(discovered.find((candidate) => candidate.name === "reviewer")?.model, "issue950/worktree-model");
863
+ assert.equal(all.projectSettingsPath, worktreeSettingsPath);
757
864
  }));
758
865
 
759
866
  it("does not register legacy skill files from broad package agent roots", () => withTempHome(() => {
@@ -883,42 +990,42 @@ Ignored
883
990
  chains: ["./chains"],
884
991
  },
885
992
  });
886
- writeAgent(path.join(packageRoot, "agents", "explorer.md"), `---
887
- name: explorer
888
- description: Package explorer
993
+ writeAgent(path.join(packageRoot, "agents", "scout.md"), `---
994
+ name: scout
995
+ description: Package scout
889
996
  ---
890
997
 
891
- Package explorer.
998
+ Package scout.
892
999
  `);
893
1000
  writeAgent(path.join(packageRoot, "chains", "shared.chain.md"), `---
894
1001
  name: shared
895
1002
  description: Package chain
896
1003
  ---
897
1004
 
898
- ## explorer
1005
+ ## scout
899
1006
 
900
1007
  Package chain.
901
1008
  `);
902
- writeAgent(path.join(home, ".selesai", "agent", "agents", "explorer.md"), `---
903
- name: explorer
904
- description: User explorer
1009
+ writeAgent(path.join(home, ".selesai", "agent", "agents", "scout.md"), `---
1010
+ name: scout
1011
+ description: User scout
905
1012
  ---
906
1013
 
907
- User explorer.
1014
+ User scout.
908
1015
  `);
909
- writeAgent(path.join(dir, ".selesai", "agents", "explorer.md"), `---
910
- name: explorer
911
- description: Project explorer
1016
+ writeAgent(path.join(dir, ".selesai", "agents", "scout.md"), `---
1017
+ name: scout
1018
+ description: Project scout
912
1019
  ---
913
1020
 
914
- Project explorer.
1021
+ Project scout.
915
1022
  `);
916
1023
  writeAgent(path.join(home, ".selesai", "agent", "chains", "shared.chain.md"), `---
917
1024
  name: shared
918
1025
  description: User chain
919
1026
  ---
920
1027
 
921
- ## explorer
1028
+ ## scout
922
1029
 
923
1030
  User chain.
924
1031
  `);
@@ -927,13 +1034,13 @@ name: shared
927
1034
  description: Project chain
928
1035
  ---
929
1036
 
930
- ## explorer
1037
+ ## scout
931
1038
 
932
1039
  Project chain.
933
1040
  `);
934
1041
 
935
- assert.equal(discoverAgents(dir, "user").agents.find((agent) => agent.name === "explorer")?.source, "user");
936
- assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "explorer")?.source, "project");
1042
+ assert.equal(discoverAgents(dir, "user").agents.find((agent) => agent.name === "scout")?.source, "user");
1043
+ assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "scout")?.source, "project");
937
1044
  const chainByName = new Map(discoverAgentsAll(dir).chains.map((chain) => [chain.name, chain]));
938
1045
  assert.equal(chainByName.get("shared")?.source, "project");
939
1046
  }));
@@ -948,17 +1055,17 @@ Project chain.
948
1055
  agents: ["./agents"],
949
1056
  },
950
1057
  });
951
- writeAgent(path.join(packageRoot, "agents", "commentator.md"), `---
952
- name: commentator
1058
+ writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
1059
+ name: reviewer
953
1060
  package: readonly-workflow
954
- description: Read-only package commentator.
1061
+ description: Read-only package reviewer.
955
1062
  ---
956
1063
 
957
1064
  Review only.
958
1065
  `);
959
1066
 
960
1067
  const result = handleManagementAction("update", {
961
- agent: "readonly-workflow.commentator",
1068
+ agent: "readonly-workflow.reviewer",
962
1069
  config: { description: "Changed" },
963
1070
  }, {
964
1071
  cwd: dir,
@@ -1029,14 +1136,14 @@ Validate changes
1029
1136
  describe("agent frontmatter maxSubagentDepth", () => {
1030
1137
  it("serializes maxSubagentDepth into agent frontmatter", () => {
1031
1138
  const agent: AgentConfig = {
1032
- name: "explorer",
1139
+ name: "scout",
1033
1140
  description: "Scout",
1034
1141
  systemPrompt: "Inspect code",
1035
1142
  systemPromptMode: "replace",
1036
1143
  inheritProjectContext: false,
1037
1144
  inheritSkills: false,
1038
1145
  source: "project",
1039
- filePath: "/tmp/explorer.md",
1146
+ filePath: "/tmp/scout.md",
1040
1147
  maxSubagentDepth: 1,
1041
1148
  };
1042
1149
 
@@ -1049,8 +1156,8 @@ describe("agent frontmatter maxSubagentDepth", () => {
1049
1156
  tempDirs.push(dir);
1050
1157
  const agentsDir = path.join(dir, ".selesai", "agents");
1051
1158
  fs.mkdirSync(agentsDir, { recursive: true });
1052
- fs.writeFileSync(path.join(agentsDir, "explorer.md"), `---
1053
- name: explorer
1159
+ fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
1160
+ name: scout
1054
1161
  description: Scout
1055
1162
  maxSubagentDepth: 1
1056
1163
  ---
@@ -1059,8 +1166,8 @@ Inspect code
1059
1166
  `, "utf-8");
1060
1167
 
1061
1168
  const result = discoverAgents(dir, "project");
1062
- const explorer = result.agents.find((agent) => agent.name === "explorer");
1063
- assert.equal(explorer?.maxSubagentDepth, 1);
1169
+ const scout = result.agents.find((agent) => agent.name === "scout");
1170
+ assert.equal(scout?.maxSubagentDepth, 1);
1064
1171
  });
1065
1172
  });
1066
1173
 
@@ -1134,14 +1241,14 @@ Do work
1134
1241
  describe("agent frontmatter fallbackModels", () => {
1135
1242
  it("serializes fallbackModels into agent frontmatter", () => {
1136
1243
  const agent: AgentConfig = {
1137
- name: "builder",
1244
+ name: "worker",
1138
1245
  description: "Worker",
1139
1246
  systemPrompt: "Do work",
1140
1247
  systemPromptMode: "replace",
1141
1248
  inheritProjectContext: false,
1142
1249
  inheritSkills: false,
1143
1250
  source: "project",
1144
- filePath: "/tmp/builder.md",
1251
+ filePath: "/tmp/worker.md",
1145
1252
  fallbackModels: ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"],
1146
1253
  };
1147
1254
 
@@ -1154,8 +1261,8 @@ describe("agent frontmatter fallbackModels", () => {
1154
1261
  tempDirs.push(dir);
1155
1262
  const agentsDir = path.join(dir, ".selesai", "agents");
1156
1263
  fs.mkdirSync(agentsDir, { recursive: true });
1157
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
1158
- name: builder
1264
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
1265
+ name: worker
1159
1266
  description: Worker
1160
1267
  fallbackModels: openai/gpt-5-mini, anthropic/claude-sonnet-4
1161
1268
  ---
@@ -1164,22 +1271,22 @@ Do work
1164
1271
  `, "utf-8");
1165
1272
 
1166
1273
  const result = discoverAgents(dir, "project");
1167
- const builder = result.agents.find((agent) => agent.name === "builder");
1168
- assert.deepEqual(builder?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
1274
+ const worker = result.agents.find((agent) => agent.name === "worker");
1275
+ assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
1169
1276
  });
1170
1277
  });
1171
1278
 
1172
1279
  describe("agent frontmatter systemPromptMode", () => {
1173
1280
  it("serializes systemPromptMode into agent frontmatter", () => {
1174
1281
  const agent: AgentConfig = {
1175
- name: "builder",
1282
+ name: "worker",
1176
1283
  description: "Worker",
1177
1284
  systemPrompt: "Do work",
1178
1285
  systemPromptMode: "replace",
1179
1286
  inheritProjectContext: false,
1180
1287
  inheritSkills: false,
1181
1288
  source: "project",
1182
- filePath: "/tmp/builder.md",
1289
+ filePath: "/tmp/worker.md",
1183
1290
  };
1184
1291
 
1185
1292
  const serialized = serializeAgent(agent);
@@ -1191,8 +1298,8 @@ describe("agent frontmatter systemPromptMode", () => {
1191
1298
  tempDirs.push(dir);
1192
1299
  const agentsDir = path.join(dir, ".selesai", "agents");
1193
1300
  fs.mkdirSync(agentsDir, { recursive: true });
1194
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
1195
- name: builder
1301
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
1302
+ name: worker
1196
1303
  description: Worker
1197
1304
  systemPromptMode: replace
1198
1305
  ---
@@ -1201,22 +1308,22 @@ Do work
1201
1308
  `, "utf-8");
1202
1309
 
1203
1310
  const result = discoverAgents(dir, "project");
1204
- const builder = result.agents.find((agent) => agent.name === "builder");
1205
- assert.equal(builder?.systemPromptMode, "replace");
1311
+ const worker = result.agents.find((agent) => agent.name === "worker");
1312
+ assert.equal(worker?.systemPromptMode, "replace");
1206
1313
  });
1207
1314
  });
1208
1315
 
1209
1316
  describe("agent frontmatter prompt inheritance flags", () => {
1210
1317
  it("serializes inheritProjectContext and inheritSkills into agent frontmatter", () => {
1211
1318
  const agent: AgentConfig = {
1212
- name: "builder",
1319
+ name: "worker",
1213
1320
  description: "Worker",
1214
1321
  systemPrompt: "Do work",
1215
1322
  systemPromptMode: "replace",
1216
1323
  inheritProjectContext: true,
1217
1324
  inheritSkills: true,
1218
1325
  source: "project",
1219
- filePath: "/tmp/builder.md",
1326
+ filePath: "/tmp/worker.md",
1220
1327
  };
1221
1328
 
1222
1329
  const serialized = serializeAgent(agent);
@@ -1229,8 +1336,8 @@ describe("agent frontmatter prompt inheritance flags", () => {
1229
1336
  tempDirs.push(dir);
1230
1337
  const agentsDir = path.join(dir, ".selesai", "agents");
1231
1338
  fs.mkdirSync(agentsDir, { recursive: true });
1232
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
1233
- name: builder
1339
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
1340
+ name: worker
1234
1341
  description: Worker
1235
1342
  inheritProjectContext: true
1236
1343
  inheritSkills: true
@@ -1240,23 +1347,23 @@ Do work
1240
1347
  `, "utf-8");
1241
1348
 
1242
1349
  const result = discoverAgents(dir, "project");
1243
- const builder = result.agents.find((agent) => agent.name === "builder");
1244
- assert.equal(builder?.inheritProjectContext, true);
1245
- assert.equal(builder?.inheritSkills, true);
1350
+ const worker = result.agents.find((agent) => agent.name === "worker");
1351
+ assert.equal(worker?.inheritProjectContext, true);
1352
+ assert.equal(worker?.inheritSkills, true);
1246
1353
  });
1247
1354
  });
1248
1355
 
1249
1356
  describe("agent frontmatter subagentOnlyExtensions", () => {
1250
1357
  it("serializes subagentOnlyExtensions into agent frontmatter", () => {
1251
1358
  const agent: AgentConfig = {
1252
- name: "builder",
1359
+ name: "worker",
1253
1360
  description: "Worker",
1254
1361
  systemPrompt: "Do work",
1255
1362
  systemPromptMode: "replace",
1256
1363
  inheritProjectContext: false,
1257
1364
  inheritSkills: false,
1258
1365
  source: "project",
1259
- filePath: "/tmp/builder.md",
1366
+ filePath: "/tmp/worker.md",
1260
1367
  subagentOnlyExtensions: ["./tools/child-search.ts", "/opt/pi/child-only.ts"],
1261
1368
  };
1262
1369
 
@@ -1269,8 +1376,8 @@ describe("agent frontmatter subagentOnlyExtensions", () => {
1269
1376
  tempDirs.push(dir);
1270
1377
  const agentsDir = path.join(dir, ".selesai", "agents");
1271
1378
  fs.mkdirSync(agentsDir, { recursive: true });
1272
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
1273
- name: builder
1379
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
1380
+ name: worker
1274
1381
  description: Worker
1275
1382
  subagentOnlyExtensions: ./tools/child-search.ts, /opt/pi/child-only.ts
1276
1383
  ---
@@ -1279,8 +1386,8 @@ Do work
1279
1386
  `, "utf-8");
1280
1387
 
1281
1388
  const result = discoverAgents(dir, "project");
1282
- const builder = result.agents.find((agent) => agent.name === "builder");
1283
- assert.deepEqual(builder?.subagentOnlyExtensions, ["./tools/child-search.ts", "/opt/pi/child-only.ts"]);
1389
+ const worker = result.agents.find((agent) => agent.name === "worker");
1390
+ assert.deepEqual(worker?.subagentOnlyExtensions, ["./tools/child-search.ts", "/opt/pi/child-only.ts"]);
1284
1391
  });
1285
1392
  });
1286
1393
 
@@ -1290,8 +1397,8 @@ describe("agent frontmatter prompt assembly defaults", () => {
1290
1397
  tempDirs.push(dir);
1291
1398
  const agentsDir = path.join(dir, ".selesai", "agents");
1292
1399
  fs.mkdirSync(agentsDir, { recursive: true });
1293
- fs.writeFileSync(path.join(agentsDir, "builder.md"), `---
1294
- name: builder
1400
+ fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
1401
+ name: worker
1295
1402
  description: Worker
1296
1403
  ---
1297
1404
 
@@ -1299,10 +1406,10 @@ Do work
1299
1406
  `, "utf-8");
1300
1407
 
1301
1408
  const result = discoverAgents(dir, "project");
1302
- const builder = result.agents.find((agent) => agent.name === "builder");
1303
- assert.equal(builder?.systemPromptMode, "replace");
1304
- assert.equal(builder?.inheritProjectContext, false);
1305
- assert.equal(builder?.inheritSkills, false);
1409
+ const worker = result.agents.find((agent) => agent.name === "worker");
1410
+ assert.equal(worker?.systemPromptMode, "replace");
1411
+ assert.equal(worker?.inheritProjectContext, false);
1412
+ assert.equal(worker?.inheritSkills, false);
1306
1413
  });
1307
1414
 
1308
1415
  it("builtin agents inherit project context by default", () => {
@@ -1318,12 +1425,12 @@ Do work
1318
1425
  process.env.USERPROFILE = homeDir;
1319
1426
 
1320
1427
  const result = discoverAgents(dir, "both");
1321
- const explorer = result.agents.find((agent) => agent.name === "explorer");
1322
- const commentator = result.agents.find((agent) => agent.name === "commentator");
1323
- const recapper = result.agents.find((agent) => agent.name === "recapper");
1324
- assert.equal(explorer?.inheritProjectContext, true);
1325
- assert.equal(commentator?.inheritProjectContext, true);
1326
- assert.equal(recapper?.inheritProjectContext, true);
1428
+ const scout = result.agents.find((agent) => agent.name === "scout");
1429
+ const reviewer = result.agents.find((agent) => agent.name === "reviewer");
1430
+ const delegate = result.agents.find((agent) => agent.name === "delegate");
1431
+ assert.equal(scout?.inheritProjectContext, true);
1432
+ assert.equal(reviewer?.inheritProjectContext, true);
1433
+ assert.equal(delegate?.inheritProjectContext, true);
1327
1434
  } finally {
1328
1435
  if (previousHome === undefined) delete process.env.HOME;
1329
1436
  else process.env.HOME = previousHome;
@@ -1356,30 +1463,7 @@ Do work
1356
1463
  }
1357
1464
  });
1358
1465
 
1359
- it("keeps the bundled architect read-only for repository tools", () => {
1360
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-architect-tools-"));
1361
- const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-architect-home-"));
1362
- tempDirs.push(dir);
1363
- tempDirs.push(homeDir);
1364
- const previousHome = process.env.HOME;
1365
- const previousUserProfile = process.env.USERPROFILE;
1366
-
1367
- try {
1368
- process.env.HOME = homeDir;
1369
- process.env.USERPROFILE = homeDir;
1370
- const architect = discoverAgentsAll(dir).builtin.find((agent) => agent.name === "architect");
1371
- assert.ok(architect, "architect builtin should be discovered");
1372
- assert.deepEqual(architect.tools, ["read", "grep", "find", "ls"]);
1373
- assert.equal(architect.acceptanceRole, "read-only");
1374
- } finally {
1375
- if (previousHome === undefined) delete process.env.HOME;
1376
- else process.env.HOME = previousHome;
1377
- if (previousUserProfile === undefined) delete process.env.USERPROFILE;
1378
- else process.env.USERPROFILE = previousUserProfile;
1379
- }
1380
- });
1381
-
1382
- it("builder includes the child-facing supervisor tool", () => {
1466
+ it("worker and delegate include the child-facing supervisor tool", () => {
1383
1467
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-"));
1384
1468
  const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-home-"));
1385
1469
  tempDirs.push(dir);
@@ -1391,9 +1475,11 @@ Do work
1391
1475
  process.env.HOME = homeDir;
1392
1476
  process.env.USERPROFILE = homeDir;
1393
1477
  const agents = discoverAgentsAll(dir).builtin;
1394
- const agent = agents.find((candidate) => candidate.name === "builder");
1395
- assert.ok(agent, "builder builtin should be discovered");
1396
- assert.deepEqual(agent?.tools, ["read", "grep", "find", "ls", "bash", "edit", "write"]);
1478
+ for (const name of ["worker", "delegate"]) {
1479
+ const agent = agents.find((candidate) => candidate.name === name);
1480
+ assert.ok(agent, `${name} builtin should be discovered`);
1481
+ assert.deepEqual(agent?.tools, ["read", "grep", "find", "ls", "bash", "edit", "write", "contact_supervisor"]);
1482
+ }
1397
1483
  } finally {
1398
1484
  if (previousHome === undefined) delete process.env.HOME;
1399
1485
  else process.env.HOME = previousHome;
@@ -1402,13 +1488,13 @@ Do work
1402
1488
  }
1403
1489
  });
1404
1490
 
1405
- it("defaults recapper to replace mode with inherited project context", () => {
1406
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-recapper-default-prompt-settings-"));
1491
+ it("defaults delegate to append mode with inherited project context", () => {
1492
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-delegate-default-prompt-settings-"));
1407
1493
  tempDirs.push(dir);
1408
1494
  const agentsDir = path.join(dir, ".selesai", "agents");
1409
1495
  fs.mkdirSync(agentsDir, { recursive: true });
1410
- fs.writeFileSync(path.join(agentsDir, "recapper.md"), `---
1411
- name: recapper
1496
+ fs.writeFileSync(path.join(agentsDir, "delegate.md"), `---
1497
+ name: delegate
1412
1498
  description: Delegate
1413
1499
  ---
1414
1500
 
@@ -1416,10 +1502,10 @@ Do work
1416
1502
  `, "utf-8");
1417
1503
 
1418
1504
  const result = discoverAgents(dir, "project");
1419
- const recapper = result.agents.find((agent) => agent.name === "recapper");
1420
- assert.equal(recapper?.systemPromptMode, "replace");
1421
- assert.equal(recapper?.inheritProjectContext, false);
1422
- assert.equal(recapper?.inheritSkills, false);
1505
+ const delegate = result.agents.find((agent) => agent.name === "delegate");
1506
+ assert.equal(delegate?.systemPromptMode, "append");
1507
+ assert.equal(delegate?.inheritProjectContext, true);
1508
+ assert.equal(delegate?.inheritSkills, false);
1423
1509
  });
1424
1510
  });
1425
1511
 
@@ -1431,9 +1517,9 @@ describe("packaged agent and chain discovery", () => {
1431
1517
  const nestedChainDir = path.join(dir, ".selesai", "chains", "code-analysis", "deep");
1432
1518
  fs.mkdirSync(nestedDir, { recursive: true });
1433
1519
  fs.mkdirSync(nestedChainDir, { recursive: true });
1434
- fs.writeFileSync(path.join(nestedDir, "explorer.md"), `---
1435
- name: explorer
1436
- description: Nested explorer
1520
+ fs.writeFileSync(path.join(nestedDir, "scout.md"), `---
1521
+ name: scout
1522
+ description: Nested scout
1437
1523
  ---
1438
1524
 
1439
1525
  Inspect code
@@ -1443,13 +1529,13 @@ name: review-flow
1443
1529
  description: Review flow
1444
1530
  ---
1445
1531
 
1446
- ## explorer
1532
+ ## scout
1447
1533
 
1448
1534
  Review
1449
1535
  `, "utf-8");
1450
1536
 
1451
1537
  const result = discoverAgentsAll(dir);
1452
- assert.ok(result.project.find((agent) => agent.name === "explorer" && agent.filePath === path.join(nestedDir, "explorer.md")));
1538
+ assert.ok(result.project.find((agent) => agent.name === "scout" && agent.filePath === path.join(nestedDir, "scout.md")));
1453
1539
  assert.ok(result.chains.find((chain) => chain.name === "review-flow" && chain.filePath === path.join(nestedChainDir, "review.chain.md")));
1454
1540
  assert.equal(result.project.some((agent) => agent.filePath.endsWith("review.chain.md")), false);
1455
1541
  });
@@ -1459,8 +1545,8 @@ Review
1459
1545
  tempDirs.push(dir);
1460
1546
  const agentsDir = path.join(dir, ".selesai", "agents");
1461
1547
  fs.mkdirSync(agentsDir, { recursive: true });
1462
- fs.writeFileSync(path.join(agentsDir, "explorer.md"), `---
1463
- name: explorer
1548
+ fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
1549
+ name: scout
1464
1550
  package: code-analysis
1465
1551
  description: Fast recon
1466
1552
  ---
@@ -1468,14 +1554,14 @@ description: Fast recon
1468
1554
  Inspect code
1469
1555
  `, "utf-8");
1470
1556
 
1471
- const explorer = discoverAgents(dir, "project").agents.find((agent) => agent.name === "code-analysis.explorer");
1472
- assert.ok(explorer);
1473
- assert.equal(explorer.localName, "explorer");
1474
- assert.equal(explorer.packageName, "code-analysis");
1475
- const serialized = serializeAgent(explorer);
1476
- assert.match(serialized, /^name: explorer$/m);
1557
+ const scout = discoverAgents(dir, "project").agents.find((agent) => agent.name === "code-analysis.scout");
1558
+ assert.ok(scout);
1559
+ assert.equal(scout.localName, "scout");
1560
+ assert.equal(scout.packageName, "code-analysis");
1561
+ const serialized = serializeAgent(scout);
1562
+ assert.match(serialized, /^name: scout$/m);
1477
1563
  assert.match(serialized, /^package: code-analysis$/m);
1478
- assert.doesNotMatch(serialized, /^name: code-analysis\.explorer$/m);
1564
+ assert.doesNotMatch(serialized, /^name: code-analysis\.scout$/m);
1479
1565
  });
1480
1566
 
1481
1567
  it("recursively discovers packaged chains by runtime name and preserves package on serialize", () => {
@@ -1489,7 +1575,7 @@ package: code-analysis
1489
1575
  description: Review flow
1490
1576
  ---
1491
1577
 
1492
- ## code-analysis.explorer
1578
+ ## code-analysis.scout
1493
1579
 
1494
1580
  Inspect {task}
1495
1581
  `;
@@ -1499,11 +1585,11 @@ Inspect {task}
1499
1585
  assert.ok(chain);
1500
1586
  assert.equal(chain.localName, "review-flow");
1501
1587
  assert.equal(chain.packageName, "code-analysis");
1502
- assert.equal(chain.steps[0]?.agent, "code-analysis.explorer");
1588
+ assert.equal(chain.steps[0]?.agent, "code-analysis.scout");
1503
1589
  const serialized = serializeChain(chain);
1504
1590
  assert.match(serialized, /^name: review-flow$/m);
1505
1591
  assert.match(serialized, /^package: code-analysis$/m);
1506
- assert.match(serialized, /^## code-analysis\.explorer$/m);
1592
+ assert.match(serialized, /^## code-analysis\.scout$/m);
1507
1593
  assert.doesNotMatch(serialized, /^name: code-analysis\.review-flow$/m);
1508
1594
  });
1509
1595
 
@@ -1512,35 +1598,35 @@ Inspect {task}
1512
1598
  tempDirs.push(dir);
1513
1599
  fs.mkdirSync(path.join(dir, ".agents"), { recursive: true });
1514
1600
  fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
1515
- fs.writeFileSync(path.join(dir, ".agents", "explorer.md"), `---
1516
- name: explorer
1517
- description: Legacy explorer
1601
+ fs.writeFileSync(path.join(dir, ".agents", "scout.md"), `---
1602
+ name: scout
1603
+ description: Legacy scout
1518
1604
  ---
1519
1605
 
1520
1606
  Legacy
1521
1607
  `, "utf-8");
1522
- fs.writeFileSync(path.join(dir, ".selesai", "agents", "explorer.md"), `---
1523
- name: explorer
1524
- description: Project explorer
1608
+ fs.writeFileSync(path.join(dir, ".selesai", "agents", "scout.md"), `---
1609
+ name: scout
1610
+ description: Project scout
1525
1611
  ---
1526
1612
 
1527
1613
  Project
1528
1614
  `, "utf-8");
1529
1615
  fs.writeFileSync(path.join(dir, ".selesai", "agents", "packaged.md"), `---
1530
- name: explorer
1616
+ name: scout
1531
1617
  package: code-analysis
1532
- description: Packaged explorer
1618
+ description: Packaged scout
1533
1619
  ---
1534
1620
 
1535
1621
  Packaged
1536
1622
  `, "utf-8");
1537
1623
 
1538
1624
  const agents = discoverAgents(dir, "project").agents;
1539
- const unqualified = agents.find((agent) => agent.name === "explorer");
1540
- const packaged = agents.find((agent) => agent.name === "code-analysis.explorer");
1541
- assert.equal(unqualified?.description, "Project explorer");
1542
- assert.equal(unqualified?.filePath, path.join(dir, ".selesai", "agents", "explorer.md"));
1543
- assert.equal(packaged?.description, "Packaged explorer");
1625
+ const unqualified = agents.find((agent) => agent.name === "scout");
1626
+ const packaged = agents.find((agent) => agent.name === "code-analysis.scout");
1627
+ assert.equal(unqualified?.description, "Project scout");
1628
+ assert.equal(unqualified?.filePath, path.join(dir, ".selesai", "agents", "scout.md"));
1629
+ assert.equal(packaged?.description, "Packaged scout");
1544
1630
  });
1545
1631
 
1546
1632
  it("parses packaged chains directly from serializer helpers", () => {
@@ -1550,7 +1636,7 @@ package: code-analysis
1550
1636
  description: Review flow
1551
1637
  ---
1552
1638
 
1553
- ## code-analysis.explorer
1639
+ ## code-analysis.scout
1554
1640
 
1555
1641
  Inspect
1556
1642
  `, "project", "/tmp/review.chain.md");
@@ -1568,8 +1654,8 @@ Inspect
1568
1654
  const chainsDir = path.join(dir, ".selesai", "chains");
1569
1655
  fs.mkdirSync(agentsDir, { recursive: true });
1570
1656
  fs.mkdirSync(chainsDir, { recursive: true });
1571
- fs.writeFileSync(path.join(agentsDir, "explorer.md"), `---
1572
- name: explorer
1657
+ fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
1658
+ name: scout
1573
1659
  package: Code Analysis!
1574
1660
  description: Fast recon
1575
1661
  ---
@@ -1582,13 +1668,13 @@ package: Code Analysis!
1582
1668
  description: Review flow
1583
1669
  ---
1584
1670
 
1585
- ## code-analysis.explorer
1671
+ ## code-analysis.scout
1586
1672
 
1587
1673
  Review
1588
1674
  `, "utf-8");
1589
1675
 
1590
1676
  const result = discoverAgentsAll(dir);
1591
- assert.ok(result.project.find((agent) => agent.name === "code-analysis.explorer"));
1677
+ assert.ok(result.project.find((agent) => agent.name === "code-analysis.scout"));
1592
1678
  assert.ok(result.chains.find((chain) => chain.name === "code-analysis.review-flow"));
1593
1679
  });
1594
1680
 
@@ -1599,8 +1685,8 @@ Review
1599
1685
  const chainsDir = path.join(dir, ".selesai", "chains");
1600
1686
  fs.mkdirSync(agentsDir, { recursive: true });
1601
1687
  fs.mkdirSync(chainsDir, { recursive: true });
1602
- fs.writeFileSync(path.join(agentsDir, "explorer.md"), `---
1603
- name: explorer
1688
+ fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
1689
+ name: scout
1604
1690
  package: !!!
1605
1691
  description: Fast recon
1606
1692
  ---
@@ -1613,13 +1699,13 @@ package: !!!
1613
1699
  description: Review flow
1614
1700
  ---
1615
1701
 
1616
- ## explorer
1702
+ ## scout
1617
1703
 
1618
1704
  Review
1619
1705
  `, "utf-8");
1620
1706
 
1621
1707
  const result = discoverAgentsAll(dir);
1622
- assert.equal(result.project.some((agent) => agent.filePath.endsWith("explorer.md")), false);
1708
+ assert.equal(result.project.some((agent) => agent.filePath.endsWith("scout.md")), false);
1623
1709
  assert.equal(result.chains.some((chain) => chain.filePath.endsWith("review.chain.md")), false);
1624
1710
  });
1625
1711
  });
@@ -1763,7 +1849,7 @@ name: ignored-chain
1763
1849
  description: Ignored chain
1764
1850
  ---
1765
1851
 
1766
- ## explorer
1852
+ ## scout
1767
1853
 
1768
1854
  Ignore
1769
1855
  `, "utf-8");
@@ -1772,7 +1858,7 @@ name: canonical-chain
1772
1858
  description: Canonical chain
1773
1859
  ---
1774
1860
 
1775
- ## builder
1861
+ ## worker
1776
1862
 
1777
1863
  Inspect canonical
1778
1864
  `, "utf-8");
@@ -1801,7 +1887,7 @@ name: shared-chain
1801
1887
  description: User chain
1802
1888
  ---
1803
1889
 
1804
- ## explorer
1890
+ ## scout
1805
1891
 
1806
1892
  Inspect user
1807
1893
  `, "utf-8");
@@ -1810,7 +1896,7 @@ name: shared-chain
1810
1896
  description: Project chain
1811
1897
  ---
1812
1898
 
1813
- ## builder
1899
+ ## worker
1814
1900
 
1815
1901
  Inspect project
1816
1902
  `, "utf-8");
@@ -1823,7 +1909,7 @@ Inspect project
1823
1909
  assert.ok(shared);
1824
1910
  assert.equal(shared.filePath, path.join(dir, ".selesai", "chains", "shared.chain.md"));
1825
1911
  assert.equal(shared.description, "Project chain");
1826
- assert.equal(shared.steps[0]?.agent, "builder");
1912
+ assert.equal(shared.steps[0]?.agent, "worker");
1827
1913
  assert.equal(shared.steps[0]?.task, "Inspect project");
1828
1914
  } finally {
1829
1915
  if (oldHome === undefined) delete process.env.HOME;