@caupulican/pi-adaptative 0.86.3 → 0.86.6

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 (247) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/core/agent-paths.d.ts +13 -0
  3. package/dist/core/agent-paths.d.ts.map +1 -1
  4. package/dist/core/agent-paths.js +23 -0
  5. package/dist/core/agent-paths.js.map +1 -1
  6. package/dist/core/autonomy/bounded-completion.d.ts +7 -0
  7. package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
  8. package/dist/core/autonomy/bounded-completion.js +12 -4
  9. package/dist/core/autonomy/bounded-completion.js.map +1 -1
  10. package/dist/core/autonomy/lane-tool-surface.d.ts +2 -0
  11. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  12. package/dist/core/autonomy/lane-tool-surface.js +6 -3
  13. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  14. package/dist/core/autonomy/subagent-prompt.js +1 -1
  15. package/dist/core/autonomy/subagent-prompt.js.map +1 -1
  16. package/dist/core/background-lane-controller.d.ts +25 -2
  17. package/dist/core/background-lane-controller.d.ts.map +1 -1
  18. package/dist/core/background-lane-controller.js +67 -0
  19. package/dist/core/background-lane-controller.js.map +1 -1
  20. package/dist/core/delegation/replay-safe-mailbox-bounds.d.ts +4 -0
  21. package/dist/core/delegation/replay-safe-mailbox-bounds.d.ts.map +1 -0
  22. package/dist/core/delegation/replay-safe-mailbox-bounds.js +20 -0
  23. package/dist/core/delegation/replay-safe-mailbox-bounds.js.map +1 -0
  24. package/dist/core/delegation/sanitized-context-fork.d.ts +25 -0
  25. package/dist/core/delegation/sanitized-context-fork.d.ts.map +1 -0
  26. package/dist/core/delegation/sanitized-context-fork.js +299 -0
  27. package/dist/core/delegation/sanitized-context-fork.js.map +1 -0
  28. package/dist/core/delegation/session-root-mailbox.d.ts +75 -0
  29. package/dist/core/delegation/session-root-mailbox.d.ts.map +1 -0
  30. package/dist/core/delegation/session-root-mailbox.js +627 -0
  31. package/dist/core/delegation/session-root-mailbox.js.map +1 -0
  32. package/dist/core/delegation/worker-agent-control-coordinator.d.ts +102 -9
  33. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
  34. package/dist/core/delegation/worker-agent-control-coordinator.js +1307 -125
  35. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
  36. package/dist/core/delegation/worker-agent-control.d.ts +183 -8
  37. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
  38. package/dist/core/delegation/worker-agent-control.js +778 -48
  39. package/dist/core/delegation/worker-agent-control.js.map +1 -1
  40. package/dist/core/delegation/worker-attempt-executor.d.ts +9 -0
  41. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  42. package/dist/core/delegation/worker-attempt-executor.js +479 -214
  43. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  44. package/dist/core/delegation/worker-authority-resolver.d.ts +9 -0
  45. package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
  46. package/dist/core/delegation/worker-authority-resolver.js +21 -2
  47. package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
  48. package/dist/core/delegation/worker-context-fork-store.d.ts +71 -0
  49. package/dist/core/delegation/worker-context-fork-store.d.ts.map +1 -0
  50. package/dist/core/delegation/worker-context-fork-store.js +437 -0
  51. package/dist/core/delegation/worker-context-fork-store.js.map +1 -0
  52. package/dist/core/delegation/worker-context-inheritance-policy.d.ts +18 -0
  53. package/dist/core/delegation/worker-context-inheritance-policy.d.ts.map +1 -0
  54. package/dist/core/delegation/worker-context-inheritance-policy.js +28 -0
  55. package/dist/core/delegation/worker-context-inheritance-policy.js.map +1 -0
  56. package/dist/core/delegation/worker-conversation-revision.d.ts +31 -0
  57. package/dist/core/delegation/worker-conversation-revision.d.ts.map +1 -0
  58. package/dist/core/delegation/worker-conversation-revision.js +203 -0
  59. package/dist/core/delegation/worker-conversation-revision.js.map +1 -0
  60. package/dist/core/delegation/worker-conversation-store.d.ts +130 -18
  61. package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
  62. package/dist/core/delegation/worker-conversation-store.js +1263 -79
  63. package/dist/core/delegation/worker-conversation-store.js.map +1 -1
  64. package/dist/core/delegation/worker-delegation-controller.d.ts +30 -2
  65. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  66. package/dist/core/delegation/worker-delegation-controller.js +675 -111
  67. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  68. package/dist/core/delegation/worker-delegation-request.d.ts +2 -0
  69. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  70. package/dist/core/delegation/worker-delegation-request.js.map +1 -1
  71. package/dist/core/delegation/worker-dispatch-scheduler.d.ts +20 -1
  72. package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
  73. package/dist/core/delegation/worker-dispatch-scheduler.js +210 -37
  74. package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
  75. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  76. package/dist/core/delegation/worker-execution-policy.js +14 -2
  77. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  78. package/dist/core/delegation/worker-fleet-limits.d.ts +38 -0
  79. package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -0
  80. package/dist/core/delegation/worker-fleet-limits.js +113 -0
  81. package/dist/core/delegation/worker-fleet-limits.js.map +1 -0
  82. package/dist/core/delegation/worker-lane-projection.d.ts +1 -0
  83. package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -1
  84. package/dist/core/delegation/worker-lane-projection.js +6 -2
  85. package/dist/core/delegation/worker-lane-projection.js.map +1 -1
  86. package/dist/core/delegation/worker-lifecycle.d.ts +20 -3
  87. package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
  88. package/dist/core/delegation/worker-lifecycle.js +42 -18
  89. package/dist/core/delegation/worker-lifecycle.js.map +1 -1
  90. package/dist/core/delegation/worker-notification-coordinator.d.ts +4 -0
  91. package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
  92. package/dist/core/delegation/worker-notification-coordinator.js +45 -4
  93. package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
  94. package/dist/core/delegation/worker-provider-turn-protocol.d.ts +50 -0
  95. package/dist/core/delegation/worker-provider-turn-protocol.d.ts.map +1 -0
  96. package/dist/core/delegation/worker-provider-turn-protocol.js +185 -0
  97. package/dist/core/delegation/worker-provider-turn-protocol.js.map +1 -0
  98. package/dist/core/delegation/worker-recovery-coordinator.d.ts +45 -4
  99. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
  100. package/dist/core/delegation/worker-recovery-coordinator.js +223 -17
  101. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
  102. package/dist/core/delegation/worker-retry-policy.d.ts +36 -0
  103. package/dist/core/delegation/worker-retry-policy.d.ts.map +1 -0
  104. package/dist/core/delegation/worker-retry-policy.js +41 -0
  105. package/dist/core/delegation/worker-retry-policy.js.map +1 -0
  106. package/dist/core/delegation/worker-runner.d.ts +3 -1
  107. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  108. package/dist/core/delegation/worker-runner.js +4 -2
  109. package/dist/core/delegation/worker-runner.js.map +1 -1
  110. package/dist/core/delegation/worker-task-view.d.ts +43 -0
  111. package/dist/core/delegation/worker-task-view.d.ts.map +1 -0
  112. package/dist/core/delegation/worker-task-view.js +194 -0
  113. package/dist/core/delegation/worker-task-view.js.map +1 -0
  114. package/dist/core/delegation/worker-terminal-handoff-coordinator.d.ts +55 -0
  115. package/dist/core/delegation/worker-terminal-handoff-coordinator.d.ts.map +1 -0
  116. package/dist/core/delegation/worker-terminal-handoff-coordinator.js +179 -0
  117. package/dist/core/delegation/worker-terminal-handoff-coordinator.js.map +1 -0
  118. package/dist/core/delegation/worker-tree-budget-coordinator.d.ts +2 -2
  119. package/dist/core/delegation/worker-tree-budget-coordinator.d.ts.map +1 -1
  120. package/dist/core/delegation/worker-tree-budget-coordinator.js +12 -46
  121. package/dist/core/delegation/worker-tree-budget-coordinator.js.map +1 -1
  122. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  123. package/dist/core/goals/goal-continuation-controller.js +15 -0
  124. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  125. package/dist/core/goals/goal-state.d.ts +6 -0
  126. package/dist/core/goals/goal-state.d.ts.map +1 -1
  127. package/dist/core/goals/goal-state.js +1 -0
  128. package/dist/core/goals/goal-state.js.map +1 -1
  129. package/dist/core/goals/goal-tool-core.d.ts +1 -0
  130. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  131. package/dist/core/goals/goal-tool-core.js +25 -3
  132. package/dist/core/goals/goal-tool-core.js.map +1 -1
  133. package/dist/core/keybindings.d.ts +10 -0
  134. package/dist/core/keybindings.d.ts.map +1 -1
  135. package/dist/core/keybindings.js +2 -0
  136. package/dist/core/keybindings.js.map +1 -1
  137. package/dist/core/orchestration/attempt-ordering.d.ts +9 -0
  138. package/dist/core/orchestration/attempt-ordering.d.ts.map +1 -0
  139. package/dist/core/orchestration/attempt-ordering.js +29 -0
  140. package/dist/core/orchestration/attempt-ordering.js.map +1 -0
  141. package/dist/core/orchestration/capability-gateway.d.ts +19 -0
  142. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  143. package/dist/core/orchestration/capability-gateway.js +19 -2
  144. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  145. package/dist/core/orchestration/contracts.d.ts +43 -3
  146. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  147. package/dist/core/orchestration/contracts.js +24 -0
  148. package/dist/core/orchestration/contracts.js.map +1 -1
  149. package/dist/core/orchestration/delegation-ledger.d.ts +8 -3
  150. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  151. package/dist/core/orchestration/delegation-ledger.js +148 -55
  152. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  153. package/dist/core/orchestration/event-store.d.ts +6 -3
  154. package/dist/core/orchestration/event-store.d.ts.map +1 -1
  155. package/dist/core/orchestration/event-store.js +228 -30
  156. package/dist/core/orchestration/event-store.js.map +1 -1
  157. package/dist/core/orchestration/task-runtime-codecs.d.ts +31 -0
  158. package/dist/core/orchestration/task-runtime-codecs.d.ts.map +1 -0
  159. package/dist/core/orchestration/task-runtime-codecs.js +1471 -0
  160. package/dist/core/orchestration/task-runtime-codecs.js.map +1 -0
  161. package/dist/core/orchestration/task-runtime-projection.d.ts +30 -0
  162. package/dist/core/orchestration/task-runtime-projection.d.ts.map +1 -0
  163. package/dist/core/orchestration/task-runtime-projection.js +340 -0
  164. package/dist/core/orchestration/task-runtime-projection.js.map +1 -0
  165. package/dist/core/orchestration/task-runtime-reducer.d.ts +38 -0
  166. package/dist/core/orchestration/task-runtime-reducer.d.ts.map +1 -0
  167. package/dist/core/orchestration/task-runtime-reducer.js +1270 -0
  168. package/dist/core/orchestration/task-runtime-reducer.js.map +1 -0
  169. package/dist/core/orchestration/task-runtime-state.d.ts +142 -0
  170. package/dist/core/orchestration/task-runtime-state.d.ts.map +1 -0
  171. package/dist/core/orchestration/task-runtime-state.js +14 -0
  172. package/dist/core/orchestration/task-runtime-state.js.map +1 -0
  173. package/dist/core/orchestration/task-runtime.d.ts +44 -98
  174. package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
  175. package/dist/core/orchestration/task-runtime.js +357 -1113
  176. package/dist/core/orchestration/task-runtime.js.map +1 -1
  177. package/dist/core/orchestration/worker-context-fork-reference.d.ts +20 -0
  178. package/dist/core/orchestration/worker-context-fork-reference.d.ts.map +1 -0
  179. package/dist/core/orchestration/worker-context-fork-reference.js +53 -0
  180. package/dist/core/orchestration/worker-context-fork-reference.js.map +1 -0
  181. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  182. package/dist/core/orchestration/worker-execution-contract.js +4 -2
  183. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  184. package/dist/core/research/research-runner.d.ts +2 -0
  185. package/dist/core/research/research-runner.d.ts.map +1 -1
  186. package/dist/core/research/research-runner.js +1 -0
  187. package/dist/core/research/research-runner.js.map +1 -1
  188. package/dist/core/runtime-builder.d.ts.map +1 -1
  189. package/dist/core/runtime-builder.js +8 -0
  190. package/dist/core/runtime-builder.js.map +1 -1
  191. package/dist/core/secrets/credential-project.d.ts.map +1 -1
  192. package/dist/core/secrets/credential-project.js +24 -2
  193. package/dist/core/secrets/credential-project.js.map +1 -1
  194. package/dist/core/security/secret-text.d.ts +3 -0
  195. package/dist/core/security/secret-text.d.ts.map +1 -1
  196. package/dist/core/security/secret-text.js +15 -0
  197. package/dist/core/security/secret-text.js.map +1 -1
  198. package/dist/core/settings-manager.d.ts +3 -0
  199. package/dist/core/settings-manager.d.ts.map +1 -1
  200. package/dist/core/settings-manager.js +160 -8
  201. package/dist/core/settings-manager.js.map +1 -1
  202. package/dist/core/tools/delegate.d.ts +33 -15
  203. package/dist/core/tools/delegate.d.ts.map +1 -1
  204. package/dist/core/tools/delegate.js +763 -115
  205. package/dist/core/tools/delegate.js.map +1 -1
  206. package/dist/core/tools/goal.d.ts +1 -0
  207. package/dist/core/tools/goal.d.ts.map +1 -1
  208. package/dist/core/tools/goal.js +9 -1
  209. package/dist/core/tools/goal.js.map +1 -1
  210. package/dist/main.d.ts.map +1 -1
  211. package/dist/main.js +1 -0
  212. package/dist/main.js.map +1 -1
  213. package/dist/modes/interactive/components/activity-lane.d.ts +5 -0
  214. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
  215. package/dist/modes/interactive/components/activity-lane.js +133 -49
  216. package/dist/modes/interactive/components/activity-lane.js.map +1 -1
  217. package/dist/modes/interactive/components/agents-overlay.d.ts +40 -0
  218. package/dist/modes/interactive/components/agents-overlay.d.ts.map +1 -0
  219. package/dist/modes/interactive/components/agents-overlay.js +153 -0
  220. package/dist/modes/interactive/components/agents-overlay.js.map +1 -0
  221. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  222. package/dist/modes/interactive/components/settings-selector.js +18 -13
  223. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  224. package/dist/modes/interactive/interactive-event-controller.d.ts +1 -1
  225. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
  226. package/dist/modes/interactive/interactive-event-controller.js +6 -3
  227. package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
  228. package/dist/modes/interactive/interactive-mode.d.ts +5 -0
  229. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  230. package/dist/modes/interactive/interactive-mode.js +51 -0
  231. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  232. package/dist/modes/interactive/key-handlers.d.ts +1 -0
  233. package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
  234. package/dist/modes/interactive/key-handlers.js +1 -0
  235. package/dist/modes/interactive/key-handlers.js.map +1 -1
  236. package/docs/harness-architecture.md +61 -17
  237. package/docs/settings.md +17 -9
  238. package/docs/worker-profiles.md +6 -2
  239. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  240. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  241. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  242. package/examples/extensions/sandbox/package-lock.json +2 -2
  243. package/examples/extensions/sandbox/package.json +1 -1
  244. package/examples/extensions/with-deps/package-lock.json +2 -2
  245. package/examples/extensions/with-deps/package.json +1 -1
  246. package/npm-shrinkwrap.json +12 -12
  247. package/package.json +4 -4
@@ -35,6 +35,7 @@ export interface KeyHandlersHost {
35
35
  showModelSelector(initialSearchInput?: string): Promise<void>;
36
36
  loadTuiHistoryOnDemand(): void;
37
37
  showTranscriptPager(): void;
38
+ toggleAgentsOverlay(): void;
38
39
  toggleThinkingBlockVisibility(): Promise<void>;
39
40
  openExternalEditor(): Promise<void>;
40
41
  handleFollowUp(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"key-handlers.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/key-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,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ction("app.tools.expand", () => host.loadTuiHistoryOnDemand());
56
56
  host.defaultEditor.onBackgroundTool = () => host.session.backgroundRunningToolCalls() > 0;
57
57
  host.defaultEditor.onAction("app.transcript.open", () => host.showTranscriptPager());
58
+ host.defaultEditor.onAction("app.agents.open", () => host.toggleAgentsOverlay());
58
59
  host.defaultEditor.onAction("app.thinking.toggle", () => void host.toggleThinkingBlockVisibility());
59
60
  host.defaultEditor.onAction("app.editor.external", () => host.openExternalEditor());
60
61
  host.defaultEditor.onAction("app.message.followUp", () => host.handleFollowUp());
@@ -1 +1 @@
1
- {"version":3,"file":"key-handlers.js","sourceRoot":"","sources":["../../../src/modes/interactive/key-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqCH,MAAM,UAAU,gBAAgB,CAAC,IAAqB;IACrD,0EAA0E;IAC1E,8DAA8D;IAC9D,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,GAAG,EAAE;QAClC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,CAAC,6BAA6B,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChC,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1C,qFAAqF;YACrF,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE,CAAC;YAC5D,IAAI,MAAM,KAAK,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I,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC/E,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACtF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAEpF,IAAI,CAAC,aAAa,CAAC,eAAe,GAAG,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE;QAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,kBAAkB,KAAK,GAAG,CAAC;QAC7C,IAAI,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACrC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChC,CAAC;IACF,CAAC,CAAC;IAEF,mFAAmF;IACnF,IAAI,CAAC,aAAa,CAAC,YAAY,GAAG,GAAG,EAAE;QACtC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Editor/global key-handler wiring extracted from interactive-mode.\n *\n * `setupKeyHandlers` installs the escape/action/ctrl-D/change/paste/recall\n * callbacks on the default editor (and the global debug handler on the TUI),\n * each delegating to a host method or toggling the bash-mode/last-escape state.\n * It runs once at init through a wide `KeyHandlersHost` seam; interactive-mode\n * keeps a thin wrapper.\n */\n\nimport type { EditorComponent, TUI } from \"@caupulican/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\nimport type { SettingsManager } from \"../../core/settings-manager.ts\";\nimport type { CustomEditor } from \"./components/custom-editor.ts\";\n\nexport interface KeyHandlersHost {\n\treadonly defaultEditor: CustomEditor;\n\treadonly editor: EditorComponent;\n\treadonly ui: TUI;\n\treadonly session: Pick<AgentSession, \"isStreaming\" | \"isBashRunning\" | \"abortBash\" | \"backgroundRunningToolCalls\">;\n\treadonly settingsManager: Pick<SettingsManager, \"getDoubleEscapeAction\">;\n\tisBashMode: boolean;\n\tlastEscapeTime: number;\n\trestoreQueuedMessagesToEditor(options?: { abort?: boolean; currentText?: string }): number;\n\tupdateEditorBorderColor(): void;\n\tshowTreeSelector(initialSelectedId?: string): void;\n\tshowUserMessageSelector(newSessionName?: string): void;\n\thandleCtrlC(): void;\n\thandleCtrlD(): void;\n\thandleCtrlZ(): void;\n\tcycleThinkingLevel(): void;\n\tcycleModel(direction: \"forward\" | \"backward\"): Promise<void>;\n\thandleDebugCommand(): void;\n\tshowModelSelector(initialSearchInput?: string): Promise<void>;\n\tloadTuiHistoryOnDemand(): void;\n\tshowTranscriptPager(): void;\n\ttoggleThinkingBlockVisibility(): Promise<void>;\n\topenExternalEditor(): Promise<void>;\n\thandleFollowUp(): Promise<void>;\n\thandleDequeue(): void;\n\thandleClearCommand(newSessionName?: string): Promise<void>;\n\tshowSessionSelector(): void;\n\thandleClipboardImagePaste(): Promise<void>;\n}\n\nexport function setupKeyHandlers(host: KeyHandlersHost): void {\n\t// Set up handlers on defaultEditor - they use host.editor for text access\n\t// so they work correctly regardless of which editor is active\n\thost.defaultEditor.onEscape = () => {\n\t\tif (host.session.isStreaming) {\n\t\t\thost.restoreQueuedMessagesToEditor({ abort: true });\n\t\t} else if (host.session.isBashRunning) {\n\t\t\thost.session.abortBash();\n\t\t} else if (host.isBashMode) {\n\t\t\thost.editor.setText(\"\");\n\t\t\thost.isBashMode = false;\n\t\t\thost.updateEditorBorderColor();\n\t\t} else if (!host.editor.getText().trim()) {\n\t\t\t// Double-escape with empty editor triggers /tree, /fork, or nothing based on setting\n\t\t\tconst action = host.settingsManager.getDoubleEscapeAction();\n\t\t\tif (action !== \"none\") {\n\t\t\t\tconst now = Date.now();\n\t\t\t\tif (now - host.lastEscapeTime < 500) {\n\t\t\t\t\tif (action === \"tree\") {\n\t\t\t\t\t\thost.showTreeSelector();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thost.showUserMessageSelector();\n\t\t\t\t\t}\n\t\t\t\t\thost.lastEscapeTime = 0;\n\t\t\t\t} else {\n\t\t\t\t\thost.lastEscapeTime = now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\t// Register app action handlers\n\thost.defaultEditor.onAction(\"app.clear\", () => host.handleCtrlC());\n\thost.defaultEditor.onCtrlD = () => host.handleCtrlD();\n\thost.defaultEditor.onAction(\"app.suspend\", () => host.handleCtrlZ());\n\thost.defaultEditor.onAction(\"app.thinking.cycle\", () => host.cycleThinkingLevel());\n\thost.defaultEditor.onAction(\"app.model.cycleForward\", () => host.cycleModel(\"forward\"));\n\thost.defaultEditor.onAction(\"app.model.cycleBackward\", () => host.cycleModel(\"backward\"));\n\n\t// Global debug handler on TUI (works regardless of focus)\n\thost.ui.onDebug = () => host.handleDebugCommand();\n\thost.defaultEditor.onAction(\"app.model.select\", () => void host.showModelSelector());\n\thost.defaultEditor.onAction(\"app.tools.expand\", () => host.loadTuiHistoryOnDemand());\n\thost.defaultEditor.onBackgroundTool = () => host.session.backgroundRunningToolCalls() > 0;\n\thost.defaultEditor.onAction(\"app.transcript.open\", () => host.showTranscriptPager());\n\thost.defaultEditor.onAction(\"app.thinking.toggle\", () => void host.toggleThinkingBlockVisibility());\n\thost.defaultEditor.onAction(\"app.editor.external\", () => host.openExternalEditor());\n\thost.defaultEditor.onAction(\"app.message.followUp\", () => host.handleFollowUp());\n\thost.defaultEditor.onAction(\"app.message.dequeue\", () => host.handleDequeue());\n\t// Plain Up arrow on an empty editor recalls queued messages for editing\n\t// before history navigation. Many terminals (e.g. Windows Terminal) swallow\n\t// the alt-chord bindings, so the queue must be reachable without them.\n\thost.defaultEditor.onRecallQueued = () => host.restoreQueuedMessagesToEditor() > 0;\n\thost.defaultEditor.onAction(\"app.session.new\", () => host.handleClearCommand());\n\thost.defaultEditor.onAction(\"app.session.tree\", () => host.showTreeSelector());\n\thost.defaultEditor.onAction(\"app.session.fork\", () => host.showUserMessageSelector());\n\thost.defaultEditor.onAction(\"app.session.resume\", () => host.showSessionSelector());\n\n\thost.defaultEditor.onChangeSummary = ({ firstNonWhitespace }) => {\n\t\tconst wasBashMode = host.isBashMode;\n\t\thost.isBashMode = firstNonWhitespace === \"!\";\n\t\tif (wasBashMode !== host.isBashMode) {\n\t\t\thost.updateEditorBorderColor();\n\t\t}\n\t};\n\n\t// Handle the configurable platform paste chord (Ctrl+V on Unix, Alt+V on Windows).\n\thost.defaultEditor.onPasteImage = () => {\n\t\thost.handleClipboardImagePaste();\n\t};\n}\n"]}
1
+ {"version":3,"file":"key-handlers.js","sourceRoot":"","sources":["../../../src/modes/interactive/key-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsCH,MAAM,UAAU,gBAAgB,CAAC,IAAqB;IACrD,0EAA0E;IAC1E,8DAA8D;IAC9D,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,GAAG,EAAE;QAClC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,CAAC,6BAA6B,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChC,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1C,qFAAqF;YACrF,MAAM,MAAM,GAAG,I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G,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IACnF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAChF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC/E,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACtF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAEpF,IAAI,CAAC,aAAa,CAAC,eAAe,GAAG,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE;QAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,kBAAkB,KAAK,GAAG,CAAC;QAC7C,IAAI,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACrC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChC,CAAC;IACF,CAAC,CAAC;IAEF,mFAAmF;IACnF,IAAI,CAAC,aAAa,CAAC,YAAY,GAAG,GAAG,EAAE;QACtC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Editor/global key-handler wiring extracted from interactive-mode.\n *\n * `setupKeyHandlers` installs the escape/action/ctrl-D/change/paste/recall\n * callbacks on the default editor (and the global debug handler on the TUI),\n * each delegating to a host method or toggling the bash-mode/last-escape state.\n * It runs once at init through a wide `KeyHandlersHost` seam; interactive-mode\n * keeps a thin wrapper.\n */\n\nimport type { EditorComponent, TUI } from \"@caupulican/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\nimport type { SettingsManager } from \"../../core/settings-manager.ts\";\nimport type { CustomEditor } from \"./components/custom-editor.ts\";\n\nexport interface KeyHandlersHost {\n\treadonly defaultEditor: CustomEditor;\n\treadonly editor: EditorComponent;\n\treadonly ui: TUI;\n\treadonly session: Pick<AgentSession, \"isStreaming\" | \"isBashRunning\" | \"abortBash\" | \"backgroundRunningToolCalls\">;\n\treadonly settingsManager: Pick<SettingsManager, \"getDoubleEscapeAction\">;\n\tisBashMode: boolean;\n\tlastEscapeTime: number;\n\trestoreQueuedMessagesToEditor(options?: { abort?: boolean; currentText?: string }): number;\n\tupdateEditorBorderColor(): void;\n\tshowTreeSelector(initialSelectedId?: string): void;\n\tshowUserMessageSelector(newSessionName?: string): void;\n\thandleCtrlC(): void;\n\thandleCtrlD(): void;\n\thandleCtrlZ(): void;\n\tcycleThinkingLevel(): void;\n\tcycleModel(direction: \"forward\" | \"backward\"): Promise<void>;\n\thandleDebugCommand(): void;\n\tshowModelSelector(initialSearchInput?: string): Promise<void>;\n\tloadTuiHistoryOnDemand(): void;\n\tshowTranscriptPager(): void;\n\ttoggleAgentsOverlay(): void;\n\ttoggleThinkingBlockVisibility(): Promise<void>;\n\topenExternalEditor(): Promise<void>;\n\thandleFollowUp(): Promise<void>;\n\thandleDequeue(): void;\n\thandleClearCommand(newSessionName?: string): Promise<void>;\n\tshowSessionSelector(): void;\n\thandleClipboardImagePaste(): Promise<void>;\n}\n\nexport function setupKeyHandlers(host: KeyHandlersHost): void {\n\t// Set up handlers on defaultEditor - they use host.editor for text access\n\t// so they work correctly regardless of which editor is active\n\thost.defaultEditor.onEscape = () => {\n\t\tif (host.session.isStreaming) {\n\t\t\thost.restoreQueuedMessagesToEditor({ abort: true });\n\t\t} else if (host.session.isBashRunning) {\n\t\t\thost.session.abortBash();\n\t\t} else if (host.isBashMode) {\n\t\t\thost.editor.setText(\"\");\n\t\t\thost.isBashMode = false;\n\t\t\thost.updateEditorBorderColor();\n\t\t} else if (!host.editor.getText().trim()) {\n\t\t\t// Double-escape with empty editor triggers /tree, /fork, or nothing based on setting\n\t\t\tconst action = host.settingsManager.getDoubleEscapeAction();\n\t\t\tif (action !== \"none\") {\n\t\t\t\tconst now = Date.now();\n\t\t\t\tif (now - host.lastEscapeTime < 500) {\n\t\t\t\t\tif (action === \"tree\") {\n\t\t\t\t\t\thost.showTreeSelector();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thost.showUserMessageSelector();\n\t\t\t\t\t}\n\t\t\t\t\thost.lastEscapeTime = 0;\n\t\t\t\t} else {\n\t\t\t\t\thost.lastEscapeTime = now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\t// Register app action handlers\n\thost.defaultEditor.onAction(\"app.clear\", () => host.handleCtrlC());\n\thost.defaultEditor.onCtrlD = () => host.handleCtrlD();\n\thost.defaultEditor.onAction(\"app.suspend\", () => host.handleCtrlZ());\n\thost.defaultEditor.onAction(\"app.thinking.cycle\", () => host.cycleThinkingLevel());\n\thost.defaultEditor.onAction(\"app.model.cycleForward\", () => host.cycleModel(\"forward\"));\n\thost.defaultEditor.onAction(\"app.model.cycleBackward\", () => host.cycleModel(\"backward\"));\n\n\t// Global debug handler on TUI (works regardless of focus)\n\thost.ui.onDebug = () => host.handleDebugCommand();\n\thost.defaultEditor.onAction(\"app.model.select\", () => void host.showModelSelector());\n\thost.defaultEditor.onAction(\"app.tools.expand\", () => host.loadTuiHistoryOnDemand());\n\thost.defaultEditor.onBackgroundTool = () => host.session.backgroundRunningToolCalls() > 0;\n\thost.defaultEditor.onAction(\"app.transcript.open\", () => host.showTranscriptPager());\n\thost.defaultEditor.onAction(\"app.agents.open\", () => host.toggleAgentsOverlay());\n\thost.defaultEditor.onAction(\"app.thinking.toggle\", () => void host.toggleThinkingBlockVisibility());\n\thost.defaultEditor.onAction(\"app.editor.external\", () => host.openExternalEditor());\n\thost.defaultEditor.onAction(\"app.message.followUp\", () => host.handleFollowUp());\n\thost.defaultEditor.onAction(\"app.message.dequeue\", () => host.handleDequeue());\n\t// Plain Up arrow on an empty editor recalls queued messages for editing\n\t// before history navigation. Many terminals (e.g. Windows Terminal) swallow\n\t// the alt-chord bindings, so the queue must be reachable without them.\n\thost.defaultEditor.onRecallQueued = () => host.restoreQueuedMessagesToEditor() > 0;\n\thost.defaultEditor.onAction(\"app.session.new\", () => host.handleClearCommand());\n\thost.defaultEditor.onAction(\"app.session.tree\", () => host.showTreeSelector());\n\thost.defaultEditor.onAction(\"app.session.fork\", () => host.showUserMessageSelector());\n\thost.defaultEditor.onAction(\"app.session.resume\", () => host.showSessionSelector());\n\n\thost.defaultEditor.onChangeSummary = ({ firstNonWhitespace }) => {\n\t\tconst wasBashMode = host.isBashMode;\n\t\thost.isBashMode = firstNonWhitespace === \"!\";\n\t\tif (wasBashMode !== host.isBashMode) {\n\t\t\thost.updateEditorBorderColor();\n\t\t}\n\t};\n\n\t// Handle the configurable platform paste chord (Ctrl+V on Unix, Alt+V on Windows).\n\thost.defaultEditor.onPasteImage = () => {\n\t\thost.handleClipboardImagePaste();\n\t};\n}\n"]}
@@ -85,33 +85,67 @@ resume. A process-backed Pi worker similarly retains its logical agent ID and re
85
85
  woken with `/resume` against the same session, worktree, orchestration preset, and checkpoint
86
86
  pointers when present.
87
87
 
88
+ The model-facing `delegate tasks` action is a bounded read model over that same durable DAG, not a
89
+ second task list. It exposes task dependencies, status, latest attempt/agent dispatch, terminal
90
+ reason, verifier state, and durable retry metadata. `delegate start` may attach existing
91
+ same-objective task IDs through `dependsOn`; unknown, forward, cross-objective, self, and cyclic edges
92
+ are rejected before dispatch. Agent, task, and attempt projections each retain at most 256 entries.
93
+ An evidence-classified transient failure suspends its exact attempt with a persisted `notBefore`
94
+ deadline; recovery reconstructs eligibility from that deadline and transcript instead of resetting a
95
+ process-local backoff counter.
96
+
88
97
  Policy is a mandatory pre-lease gate. An attempt cannot lease without a compiled execution grant.
89
98
  When compilation crosses owner authority or budget, the gate persists a typed approval request and
90
99
  an owner notification; approval and rejection replay as durable human decisions. Approval alone is
91
100
  never authority: an approved attempt remains unleaseable until policy compiles and binds a new grant
92
101
  under the expanded owner authorization. Pausing an objective blocks lease, start, and agent resume;
93
- cancellation remains a replayable terminal transition across its open tasks and attempts.
102
+ queued and suspended attempts remain nonterminal until an objective-resume event drains them.
103
+ Cancellation remains a replayable terminal transition across its open tasks and attempts.
94
104
 
95
105
  Acceptance is a runtime invariant, not a worker claim. Task criterion IDs must refer to their
96
106
  objective, a completed criterion-bound result must carry trusted evidence for every linked criterion,
97
107
  and an objective cannot close until all required criteria have trusted evidence in its task results.
98
108
 
99
- In-process agents have fresh context, a synthetic cache-affinity key, a selected model and exact
100
- reasoning level, and a construction-filtered tool surface. They inherit `delegate`, may inspect exact
101
- paginated transcripts for any logical peer in the session tree, exchange threaded messages, and may
102
- materialize a persistent per-agent platform shell. There is no framework depth or fan-out cap; one
103
- global scheduler owns concurrency and durable queuing, one root coordinator owns cumulative
104
- token/cost/tool/active-time/attempt budgets, and exact ancestor task cycles are rejected. `run_process`
109
+ In-process agents have immutable birth context, a synthetic cache-affinity key, a selected model and
110
+ exact reasoning level, and a construction-filtered tool surface. They inherit `delegate`, may inspect
111
+ bounded raw-transcript pages only for themselves and their control subtree, exchange non-waking
112
+ threaded evidence with discoverable session peers, broadcast to a bounded peer set, wait for one or
113
+ many workers through state-change events, and may materialize a persistent per-agent platform shell.
114
+ Wake, interrupt, resume, cancel, and retirement authority remains subtree-scoped. Retirement closes
115
+ only an idle leaf with no unresolved mailbox/reply obligations; it preserves the durable binding and
116
+ transcript for audit. Fleet admission runs before task, conversation, agent, or queue creation and
117
+ bounds depth to 8, direct children to 64, session identities to 256, and queued dispatches to 256.
118
+ Admission preserves queue, task, attempt, and agent headroom for every already-admitted pending
119
+ verifier plus the current contract's future verifier. Failed mandatory-verifier dispatch remains
120
+ durably derivable and replays on queue-capacity events. One global scheduler owns concurrency and
121
+ durable queuing, one root coordinator owns cumulative token/cost/tool/active-time/attempt budgets, and exact
122
+ ancestor task cycles are rejected. Descendant profile selection may vary model and role, but its
123
+ resource pointers must be a full-identity subset of the ancestral contract, its soul text must match
124
+ exactly, and verifier context/authority stays within the previously admitted verifier or worker
125
+ boundary. `run_process`
105
126
  keeps its separate exact executable allowlist, direct argv, scoped environment, bounded output, and
106
127
  process-tree termination contract. The platform shell is real host process authority, not container
107
128
  isolation or a path-scoped substitute for `write`/`edit`.
108
129
 
130
+ Birth context is selected once, before a new logical agent is admitted, with `forkTurns: "none"`,
131
+ `"all"`, or a positive turn count such as `"3"`. Omission means `all` only when parent and child use
132
+ the exact same provider and model; crossing either boundary defaults to `none`, and an explicit
133
+ non-`none` cross-boundary request is rejected. The content-addressed snapshot contains bounded whole
134
+ user turns and complete text-only assistant answers. It excludes system/developer/custom messages,
135
+ reasoning and commentary, tool calls/results, mailbox controls, non-text attachments, and incomplete
136
+ assistant output. A compacted prefix can enter only as its bounded checkpoint attached to the next
137
+ real user turn. The snapshot and its durable reference are immutable; reusing a persistent worker
138
+ continues its existing transcript and cannot install a second birth context.
139
+
109
140
  Worker output remains untrusted evidence. The parent receives a bounded terminal event and retrieves
110
- lane results explicitly; raw peer transcripts require an explicit `transcript` action and are paged
111
- only for context size. A preset that requires independent verification names a separate owner-pinned
112
- verifier profile. The runtime automatically dispatches that verifier as a durable task, withholds the
113
- implementation's terminal handoff, and reconciles the typed verdict before the implementation can
114
- become accepted. Restart recovery closes both persistence gaps: an implementation awaiting a
141
+ lane results explicitly; child/subtree transcript pages require an explicit `transcript` action,
142
+ and the subtree authority check happens before bounded pagination. Transcript cursors are opaque raw
143
+ session-entry offsets: a page can contain no messages but still return `nextCursor`, and an individual
144
+ message that exceeds the byte bound is omitted with an explicit omission count. A preset that requires independent
145
+ verification names a separate owner-pinned verifier profile. The runtime automatically dispatches
146
+ that verifier as a durable task, withholds the implementation's terminal handoff, and reconciles the
147
+ typed verdict before the implementation can become accepted. Restart recovery closes both
148
+ persistence gaps: an implementation awaiting a
115
149
  not-yet-created verifier is re-dispatched, while a persisted verifier result awaiting reconciliation
116
150
  is applied exactly once.
117
151
 
@@ -121,9 +155,14 @@ Out-of-process managed workers use the same lifecycle shape:
121
155
  queued → running → terminal signal → bounded persisted handoff → parent notification → explicit retrieval
122
156
  ```
123
157
 
124
- Completion discovery is event-driven. A parent never polls pane output to learn whether work ended,
125
- and a late worker result is never injected into an active foreground transcript. Every managed
126
- process must emit a terminal signal even on failure, persist a bounded handoff, and wake its owner.
158
+ Completion discovery is event-driven. A parent never polls pane output or retries a full mailbox on a
159
+ clock to learn whether work ended, and a late worker result is never injected into an active
160
+ foreground transcript. Each terminal attempt is retained once in a bounded process-local queue until
161
+ the parent mailbox accepts it; terminal publication, mailbox-capacity changes, state changes, and
162
+ restart recovery are the only drain events. Exact replays are inert, conflicting payloads fail closed,
163
+ delivery errors stay retained, and reentrant state signals coalesce into a bounded redrain. Every
164
+ managed process must emit a terminal signal even on failure, persist a bounded handoff, and wake its
165
+ owner.
127
166
 
128
167
  ## Runtime generations and reload
129
168
 
@@ -149,8 +188,13 @@ races an active execution unit.
149
188
  - New harness behavior requires a focused faux-provider regression. Provider APIs and paid tokens are
150
189
  not used by the coding-agent suite.
151
190
 
152
- Worker lifecycle, scheduling, execution, verification, recovery, and notification are owned by
153
- `WorkerDelegationController`. `ResearchLaneController`, `ModelFitnessController`, and
191
+ `WorkerDelegationController` composes and coordinates the native worker subsystem.
192
+ `WorkerLifecycle` owns durable lifecycle and verification transitions; `WorkerDispatchScheduler`
193
+ owns queue and running-promise transitions; `WorkerAttemptExecutor` and `WorkerRunner` own the
194
+ provider/tool loop and result projection; `WorkerRecoveryCoordinator` owns retry and recovery;
195
+ `WorkerNotificationCoordinator` owns status and owner notification delivery; and
196
+ `WorkerTerminalHandoffCoordinator` owns bounded process-local terminal retention and redrain.
197
+ `ResearchLaneController`, `ModelFitnessController`, and
154
198
  `GoalAutoContinueController` own their respective timers, guards, cancellation, accounting, and
155
199
  persistence; research and fitness share only the provider-neutral `LaneModelResolver`.
156
200
  `BackgroundLaneController` only coordinates these owners and their shared lane read model;
package/docs/settings.md CHANGED
@@ -150,12 +150,15 @@ Fitness applicability is intentionally split by autonomy level:
150
150
 
151
151
  Pi's native delegation runtime is a durable recursive agent tree. A profile is not required. A profile-free root agent starts from the foreground model and the maximum classified core worker surface the host can materialize: `read`, `grep`, `find`, `ls`, `write`, `edit`, `memory`, the platform shell, and `delegate`. Live service switches can revoke memory, writes, or delegation. Every descendant inherits its parent's immutable execution grant and the tree's remaining budget by default.
152
152
 
153
- An agent may set `authority` on `delegate` to choose its child's role label, authenticated model, supported reasoning level, semantic capabilities, tools, read/write paths, and budget. Omitted fields inherit from the parent or selected preset. The host validates the request, resolves the concrete model and tools, intersects execution authority with the immutable parent grant and live global switches, then persists the exact result before the child starts. A descendant can specialize or narrow authority but cannot add an execution capability, tool, path, or budget that the parent did not hold. Roles are descriptive routing and audit labels; the built-in compiler does not impose hidden role ceilings, though an embedding may supply an explicit host ceiling.
153
+ An agent may set `authority` on `delegate` to choose its child's role label, authenticated model, supported reasoning level, semantic capabilities, tools, read/write paths, and budget. Omitted fields inherit from the parent or selected preset. The host validates the request, resolves the concrete model and tools, intersects execution authority with the immutable parent grant and live global switches, then persists the exact result before the child starts. A descendant can specialize or narrow authority but cannot add an execution capability, tool, path, or budget that the parent did not hold. Profile selection also cannot add context: every child resource pointer must fully match an ancestral pointer (ID alone is insufficient), soul text must match exactly, and a verifier stays within its previously admitted ancestral verifier or worker boundary. Roles are descriptive routing and audit labels; the built-in compiler does not impose hidden role ceilings, though an embedding may supply an explicit host ceiling.
154
+
155
+ For a new logical agent, `forkTurns` chooses immutable sanitized birth context: `"none"`, `"all"`, or a positive user-turn count encoded as a string, such as `"3"`. When omitted, an exact same-provider/model child defaults to `"all"`; a child that changes provider or model defaults to `"none"`, and explicitly requesting inherited turns across that boundary is rejected. The bounded snapshot keeps whole text-only user/complete-assistant turns and a valid compaction checkpoint when needed. It excludes system/developer/custom context, reasoning/commentary, tool protocol and results, mailbox controls, attachments, and incomplete assistant output. A reused `agentId` continues its existing transcript and cannot replace its birth context.
154
156
 
155
157
  ```json
156
158
  {
157
159
  "action": "start",
158
160
  "instructions": "Implement and verify the scheduler change.",
161
+ "forkTurns": "3",
159
162
  "authority": {
160
163
  "role": "implementer",
161
164
  "model": { "provider": "openai-codex", "modelId": "gpt-5.5" },
@@ -177,16 +180,21 @@ An agent may set `authority` on `delegate` to choose its child's role label, aut
177
180
  }
178
181
  ```
179
182
 
180
- There is no framework depth or fan-out cap. `workerDelegation.maxConcurrent` is the one global running-agent limit; excess work enters the durable queue. The kernel rejects only an exact recursive cycle when a child repeats the same normalized instructions and effective profile already present in its ancestor chain. Root budgets are cumulative across every descendant and attempt: token, cost, tool-call, active-wall-clock, and attempt usage are reconstructed from durable checkpoints and checked before more work is admitted.
183
+ Fleet creation is bounded before Pi creates a durable task, conversation, agent, or queue entry: depth is at most 8, one parent may own at most 64 direct children, one session may retain at most 256 logical agents, and the scheduler may retain at most 256 queued dispatches. Admission dynamically preserves queue and durable-projection headroom for every implementation whose mandatory verifier has not yet materialized, plus a newly admitted contract's verifier. A verifier dispatch that encounters saturation remains represented by its durable subject and replays on a queue-capacity event. The shared durable projection independently caps agents, tasks, and attempts at 256 each. `workerDelegation.maxConcurrent` remains the global running-agent limit; excess admitted work enters the bounded durable queue. The kernel also rejects an exact recursive cycle when a child repeats the same normalized instructions and effective profile already present in its ancestor chain. Root budgets are cumulative across every descendant and attempt: token, cost, tool-call, active-wall-clock, and attempt usage are reconstructed from durable checkpoints and checked before more work is admitted.
184
+
185
+ `delegate` exposes the shared durable task/tree state through distinct authority boundaries:
181
186
 
182
- Every agent can coordinate the complete session tree through `delegate` actions:
187
+ - `tasks` returns a bounded view of durable DAG tasks, dependencies, status, latest attempt/agent dispatch, verifier state, terminal reason, and persisted retry eligibility. `start.dependsOn` accepts only existing same-objective task IDs; forward, cross-objective, self, and cyclic edges fail before dispatch.
188
+ - `list` returns safe metadata for session agents, including lineage, depth, state, and reusable activity; it does not grant transcript or control authority.
189
+ - `transcript` pages bounded messages only for the session root or the caller's own agent/control subtree, with an opaque raw-entry cursor and page size of 1-64. A page may be empty and still provide `nextCursor` after visiting non-message entries; an individually oversized message is omitted and counted rather than partially returned. Sibling and unrelated peer transcripts are not readable by workers.
190
+ - `send` and `broadcast` queue bounded, non-waking, threaded peer evidence; broadcast canonicalizes a bounded target set and reports acceptance per target. Peer content is untrusted data, never authority.
191
+ - `follow_up`, `interrupt`, `resume`, and `cancel` may wake or mutate only within the caller's control subtree. `resume` keeps the admitted model, transcript, resources, and grant; a paused objective retains its suspended attempt without starting or cancelling it until objective resume drains the scheduler. `cancel` terminates only the selected current task.
192
+ - `reply` answers one exact reply-expected request. The session root consumes replies through the acknowledged `inbox`, event-driven `inbox_wait`, and `inbox_ack` flow instead of unsolicited transcript injection.
193
+ - `wait` and `wait_many` are event-driven; `wait_many` accepts a bounded canonical target set and completes in `any` or `all` mode. `retire` replay-safely closes only an idle leaf after its mailbox and reply obligations clear, preserving its binding and transcript.
183
194
 
184
- - `list` returns durable logical-agent identities, lineage, depth, and state.
185
- - `transcript` returns exact peer messages with a cursor and a page size of 1-64; pagination is a context bound, not an authority restriction.
186
- - `send` and `follow_up` carry durable thread, reply, and expected-reply metadata.
187
- - `wait` is event-driven; `interrupt` is resumable; `resume` keeps the admitted model, transcript, resources, and grant; `cancel` terminates only the selected current task.
195
+ Transient attempt retries are evidence-gated. A classified provider or transport failure suspends the exact attempt with its retry count and ISO `notBefore` deadline, then resumes from the persisted transcript under a fresh fence when that deadline is eligible. Restart recovery uses the durable deadline rather than resetting an in-memory backoff; `maxAttempts: 1` disables the ladder, and missing/unknown failure classification never retries.
188
196
 
189
- `delegate` returns a lane id immediately. Completion persists a bounded terminal handoff before waking the parent; late output stays in the worker transcript instead of racing into the active foreground transcript. `delegate_status` remains available for bounded lane-result retrieval.
197
+ `delegate` returns a stable agent/lane identity immediately. Completion persists a bounded terminal handoff before waking the parent; late output stays in the worker transcript instead of racing into the active foreground transcript. A full parent mailbox retains the attempt-keyed handoff until an explicit terminal, mailbox-capacity, state-change, or recovery event drains it—there is no retry polling loop. Exact replays are inert, conflicts fail closed, and delivery errors remain retained. `delegate_status` remains available for bounded lane-result retrieval.
190
198
 
191
199
  Global profiles live at `~/.pi/agent/profiles/orchestration/<id>.json`; project profiles live at `.pi/profiles/orchestration/<id>.json`. They are optional presets for model, reasoning, tools, resources, budget, verification, and prompt defaults. Select one with `profileId` on a call or configure `workerDelegation.orchestrationProfile`. `dispatchProfileIds` is preset-routing metadata, not an admission allowlist. Profile `maxConcurrent` is retained in the authored schema but does not override the global scheduler. `profile_writer` can create an optional immutable session-scoped narrowing when a reusable preset is useful; direct authority selection does not require it.
192
200
 
@@ -200,7 +208,7 @@ Direct `write`/`edit` calls use review-after-apply semantics. The compiled grant
200
208
  | `workerDelegation.orchestrationProfile` | string | - | Optional default execution preset; agents may replace its defaults within inherited authority |
201
209
  | `workerDelegation.maxUsd` | number | `0.5` | Cumulative USD ceiling for one root tree; `0` disables this settings-level ceiling |
202
210
  | `workerDelegation.maxWallClockMs` | number | `120000` | Cumulative active wall-clock ceiling for one root tree; `0` disables this settings-level ceiling |
203
- | `workerDelegation.maxConcurrent` | number | `1` | Global scheduler concurrency; any positive safe integer is accepted, with no depth or fan-out cap |
211
+ | `workerDelegation.maxConcurrent` | number | `20` | Global running-agent concurrency inside the fixed fleet and queue bounds |
204
212
  | `workerDelegation.writeEnabled` | boolean | `true` | Expose direct `write`/`edit`; explicit `false` revokes them for newly admitted work and narrows resumed grants |
205
213
  | `workerDelegation.writePaths` | string[] | `["."]` | Global envelope for direct child writes; an explicit empty array revokes direct `write`/`edit` |
206
214
 
@@ -13,6 +13,10 @@ Native delegation does not require a profile. `delegate.authority` can choose a
13
13
 
14
14
  Use `profile_writer { action: "inspect" }` when the reusable bases or model combinations are unknown. Then call `create` with a concise task and only the defaults worth preserving. Pass the returned profile ID unchanged to `delegate`; never invent one.
15
15
 
16
- Worker agents do not invoke `profile_writer`. They receive `delegate` only when their admitted tool set and capability ceiling both retain delegation; a caller can create a non-delegating leaf by narrowing either field. Delegating workers may recursively create descendants, inspect exact paginated peer transcripts, and exchange threaded messages.
16
+ Worker agents do not invoke `profile_writer`. They receive `delegate` only when their admitted tool set and capability ceiling both retain delegation; a caller can create a non-delegating leaf by narrowing either field. Delegating workers may recursively create descendants within the fixed depth, direct-child, session-agent, and queue bounds. They can discover safe session-peer metadata, exchange non-waking threaded messages and bounded broadcasts, and use event-driven `wait`/`wait_many`, but bounded transcript reads and waking controls remain limited to the caller's own control subtree. Transcript cursors address raw session entries, so a continuation page may be empty after non-message entries; an individually oversized message is omitted with a count instead of being truncated. A descendant may vary model or role through another preset, but it cannot acquire new resources: pointers must fully match the ancestor's admitted pointer metadata, soul text must match exactly, and verifier resources and authority stay within the ancestral verifier or worker boundary.
17
17
 
18
- Pi registers each logical child before scheduler admission, so queued children already have stable agent IDs. A parent that waits yields its scheduler slot until an event-driven state change, and every terminal child writes one bounded, idempotent handoff to its owning parent's mailbox. Active parents receive that handoff without transcript races; idle registered parents resume once. Exact child output remains in the child transcript, and control over interruption, resume, or cancellation is limited to the caller's subtree. A resumed worker retains the exact admitted preset or adaptive grant, model, resources, lineage, and transcript.
18
+ New agents may receive immutable sanitized birth context with `forkTurns: "none"`, `"all"`, or a positive user-turn count such as `"3"`. Omission inherits all bounded complete turns only for the exact same provider and model. Crossing either provider or model defaults to no inherited turns, and an explicit non-`none` cross-boundary fork is rejected. Tool calls/results, reasoning/commentary, system/developer/custom messages, mailbox controls, non-text content, and incomplete assistant output never enter the snapshot. Dispatching another task with an existing `agentId` reuses that agent's durable transcript and cannot replace its birth context.
19
+
20
+ `delegate tasks` is the bounded view of the same durable task/DAG runtime used for dispatch and recovery. A new task may name existing same-objective task IDs with `dependsOn`; it remains pending until those dependencies complete, while invalid or cyclic edges fail closed. Evidence-classified transient failures retain their attempt/retry count and exact `notBefore` deadline across restart. Agent, task, and attempt projections are independently capped at 256 entries.
21
+
22
+ Pi admits fleet and queue capacity before registering a new logical child; every accepted queued child then has a stable agent ID. Queue and projection admission preserve one continuation slot for every pending mandatory verifier, and a verifier blocked by saturation is retried from durable subject state when capacity changes. A parent that waits yields its scheduler slot until an event-driven state change, and every terminal child writes one bounded, idempotent handoff to its owning parent's mailbox. A full mailbox retains that handoff by terminal attempt ID until an explicit capacity/state/recovery signal drains it; no timer polls for delivery. Active parents receive the handoff without transcript races; idle registered parents resume once. Child output remains in the child transcript. `interrupt`, `resume`, `cancel`, and `follow_up` are subtree-scoped; a paused objective keeps a suspended worker nonterminal until resume. `retire` closes only an idle leaf with no unresolved mailbox/reply work and preserves its binding and transcript. A resumed worker retains the exact admitted preset or adaptive grant, model, resources, lineage, and transcript.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.86.3",
3
+ "version": "0.86.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.86.3",
9
+ "version": "0.86.6",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.86.3",
4
+ "version": "0.86.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.86.3",
4
+ "version": "0.86.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "0.86.3",
3
+ "version": "0.86.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "0.86.3",
9
+ "version": "0.86.6",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.86.3",
4
+ "version": "0.86.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.86.3",
3
+ "version": "0.86.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.86.3",
9
+ "version": "0.86.6",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.86.3",
4
+ "version": "0.86.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.86.3",
3
+ "version": "0.86.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@caupulican/pi-adaptative",
9
- "version": "0.86.3",
9
+ "version": "0.86.6",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@caupulican/pi-agent-core": "^0.86.3",
13
- "@caupulican/pi-ai": "^0.86.3",
14
- "@caupulican/pi-tui": "^0.86.3",
12
+ "@caupulican/pi-agent-core": "^0.86.6",
13
+ "@caupulican/pi-ai": "^0.86.6",
14
+ "@caupulican/pi-tui": "^0.86.6",
15
15
  "@silvia-odwyer/photon-node": "0.3.4",
16
16
  "chalk": "5.6.2",
17
17
  "cross-spawn": "7.0.6",
@@ -547,11 +547,11 @@
547
547
  }
548
548
  },
549
549
  "node_modules/@caupulican/pi-agent-core": {
550
- "version": "0.86.3",
551
- "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.86.3.tgz",
550
+ "version": "0.86.6",
551
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.86.6.tgz",
552
552
  "license": "MIT",
553
553
  "dependencies": {
554
- "@caupulican/pi-ai": "^0.86.3",
554
+ "@caupulican/pi-ai": "^0.86.6",
555
555
  "ignore": "7.0.5",
556
556
  "typebox": "1.1.38",
557
557
  "yaml": "2.9.0"
@@ -561,8 +561,8 @@
561
561
  }
562
562
  },
563
563
  "node_modules/@caupulican/pi-ai": {
564
- "version": "0.86.3",
565
- "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.86.3.tgz",
564
+ "version": "0.86.6",
565
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.86.6.tgz",
566
566
  "license": "MIT",
567
567
  "dependencies": {
568
568
  "@anthropic-ai/sdk": "0.91.1",
@@ -616,8 +616,8 @@
616
616
  }
617
617
  },
618
618
  "node_modules/@caupulican/pi-tui": {
619
- "version": "0.86.3",
620
- "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.86.3.tgz",
619
+ "version": "0.86.6",
620
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.86.6.tgz",
621
621
  "license": "MIT",
622
622
  "dependencies": {
623
623
  "get-east-asian-width": "1.6.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.86.3",
3
+ "version": "0.86.6",
4
4
  "description": "Adaptive fork of Pi coding agent for self-evolving agent harness experiments",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -84,9 +84,9 @@
84
84
  "postinstall": "node scripts/postinstall-python-runtime.mjs"
85
85
  },
86
86
  "dependencies": {
87
- "@caupulican/pi-agent-core": "^0.86.3",
88
- "@caupulican/pi-ai": "^0.86.3",
89
- "@caupulican/pi-tui": "^0.86.3",
87
+ "@caupulican/pi-agent-core": "^0.86.6",
88
+ "@caupulican/pi-ai": "^0.86.6",
89
+ "@caupulican/pi-tui": "^0.86.6",
90
90
  "@silvia-odwyer/photon-node": "0.3.4",
91
91
  "chalk": "5.6.2",
92
92
  "cross-spawn": "7.0.6",