@caupulican/pi-adaptative 0.94.1 → 0.96.0

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 (369) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +32 -13
  3. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +7 -4
  4. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
  5. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +201 -293
  6. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
  7. package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +272 -392
  8. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts +52 -0
  9. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts.map +1 -0
  10. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js +118 -0
  11. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js.map +1 -0
  12. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.ts +169 -0
  13. package/dist/bundled-resources/extensions/tmux-agent-manager/templates/builder-validator.json +1 -1
  14. package/dist/bundled-resources/extensions/tmux-agent-manager/templates/provider-prompt-smoke.json +1 -1
  15. package/dist/bundled-resources/extensions/tps/index.d.ts +3 -0
  16. package/dist/bundled-resources/extensions/tps/index.d.ts.map +1 -0
  17. package/dist/bundled-resources/extensions/tps/index.js +44 -0
  18. package/dist/bundled-resources/extensions/tps/index.js.map +1 -0
  19. package/dist/bundled-resources/extensions/tps/index.ts +48 -0
  20. package/dist/bundled-resources/skills/pi-harness-learning/SKILL.md +13 -7
  21. package/dist/bundled-resources/skills/worker-profile-writer/SKILL.md +11 -11
  22. package/dist/core/agent-session-services.d.ts.map +1 -1
  23. package/dist/core/agent-session-services.js +12 -3
  24. package/dist/core/agent-session-services.js.map +1 -1
  25. package/dist/core/agent-session.d.ts +11 -41
  26. package/dist/core/agent-session.d.ts.map +1 -1
  27. package/dist/core/agent-session.js +93 -160
  28. package/dist/core/agent-session.js.map +1 -1
  29. package/dist/core/autonomy/envelope-enforcement.d.ts +6 -1
  30. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  31. package/dist/core/autonomy/envelope-enforcement.js +26 -25
  32. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  33. package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
  34. package/dist/core/autonomy/lane-private-paths.js +2 -1
  35. package/dist/core/autonomy/lane-private-paths.js.map +1 -1
  36. package/dist/core/autonomy/lane-tool-surface.d.ts +8 -8
  37. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  38. package/dist/core/autonomy/lane-tool-surface.js +45 -30
  39. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  40. package/dist/core/autonomy/worker-session-private-scope.d.ts +12 -0
  41. package/dist/core/autonomy/worker-session-private-scope.d.ts.map +1 -0
  42. package/dist/core/autonomy/worker-session-private-scope.js +42 -0
  43. package/dist/core/autonomy/worker-session-private-scope.js.map +1 -0
  44. package/dist/core/autonomy/worker-tool-adapter-registry.d.ts +65 -0
  45. package/dist/core/autonomy/worker-tool-adapter-registry.d.ts.map +1 -0
  46. package/dist/core/autonomy/worker-tool-adapter-registry.js +145 -0
  47. package/dist/core/autonomy/worker-tool-adapter-registry.js.map +1 -0
  48. package/dist/core/background-lane-controller.d.ts +1 -1
  49. package/dist/core/background-lane-controller.d.ts.map +1 -1
  50. package/dist/core/background-lane-controller.js +1 -1
  51. package/dist/core/background-lane-controller.js.map +1 -1
  52. package/dist/core/background-tool-task-controller.d.ts +8 -2
  53. package/dist/core/background-tool-task-controller.d.ts.map +1 -1
  54. package/dist/core/background-tool-task-controller.js +10 -2
  55. package/dist/core/background-tool-task-controller.js.map +1 -1
  56. package/dist/core/compaction-controller.d.ts +3 -0
  57. package/dist/core/compaction-controller.d.ts.map +1 -1
  58. package/dist/core/compaction-controller.js +12 -1
  59. package/dist/core/compaction-controller.js.map +1 -1
  60. package/dist/core/cost-guard-controller.d.ts +37 -0
  61. package/dist/core/cost-guard-controller.d.ts.map +1 -0
  62. package/dist/core/cost-guard-controller.js +71 -0
  63. package/dist/core/cost-guard-controller.js.map +1 -0
  64. package/dist/core/cost-guard.d.ts +9 -4
  65. package/dist/core/cost-guard.d.ts.map +1 -1
  66. package/dist/core/cost-guard.js +7 -3
  67. package/dist/core/cost-guard.js.map +1 -1
  68. package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
  69. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  70. package/dist/core/delegation/worker-attempt-executor.js +0 -1
  71. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  72. package/dist/core/delegation/worker-authority-resolver.d.ts +16 -3
  73. package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
  74. package/dist/core/delegation/worker-authority-resolver.js +114 -55
  75. package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
  76. package/dist/core/delegation/worker-claim.d.ts +1 -2
  77. package/dist/core/delegation/worker-claim.d.ts.map +1 -1
  78. package/dist/core/delegation/worker-claim.js.map +1 -1
  79. package/dist/core/delegation/worker-delegation-controller.d.ts +19 -6
  80. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  81. package/dist/core/delegation/worker-delegation-controller.js +125 -40
  82. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  83. package/dist/core/delegation/worker-delegation-request.d.ts +3 -3
  84. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  85. package/dist/core/delegation/worker-delegation-request.js +13 -19
  86. package/dist/core/delegation/worker-delegation-request.js.map +1 -1
  87. package/dist/core/delegation/worker-execution-policy.d.ts +3 -2
  88. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  89. package/dist/core/delegation/worker-execution-policy.js +54 -39
  90. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  91. package/dist/core/delegation/worker-fleet-limits.d.ts +3 -3
  92. package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -1
  93. package/dist/core/delegation/worker-fleet-limits.js +7 -7
  94. package/dist/core/delegation/worker-fleet-limits.js.map +1 -1
  95. package/dist/core/delegation/worker-machine-scope.d.ts +12 -0
  96. package/dist/core/delegation/worker-machine-scope.d.ts.map +1 -0
  97. package/dist/core/delegation/worker-machine-scope.js +38 -0
  98. package/dist/core/delegation/worker-machine-scope.js.map +1 -0
  99. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
  100. package/dist/core/delegation/worker-recovery-coordinator.js +6 -1
  101. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
  102. package/dist/core/delegation/worker-runner.d.ts +5 -7
  103. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  104. package/dist/core/delegation/worker-runner.js +1 -4
  105. package/dist/core/delegation/worker-runner.js.map +1 -1
  106. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +3 -2
  107. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
  108. package/dist/core/delegation/worker-write-reservation-coordinator.js +50 -25
  109. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
  110. package/dist/core/durable-custom-message-turn-controller.d.ts +6 -0
  111. package/dist/core/durable-custom-message-turn-controller.d.ts.map +1 -1
  112. package/dist/core/durable-custom-message-turn-controller.js +38 -15
  113. package/dist/core/durable-custom-message-turn-controller.js.map +1 -1
  114. package/dist/core/extension-binding-controller.d.ts +5 -1
  115. package/dist/core/extension-binding-controller.d.ts.map +1 -1
  116. package/dist/core/extension-binding-controller.js +15 -0
  117. package/dist/core/extension-binding-controller.js.map +1 -1
  118. package/dist/core/extension-import-authority.d.ts +3 -1
  119. package/dist/core/extension-import-authority.d.ts.map +1 -1
  120. package/dist/core/extension-import-authority.js +15 -0
  121. package/dist/core/extension-import-authority.js.map +1 -1
  122. package/dist/core/extensions/factory-runtime.d.ts.map +1 -1
  123. package/dist/core/extensions/factory-runtime.js +5 -0
  124. package/dist/core/extensions/factory-runtime.js.map +1 -1
  125. package/dist/core/extensions/runner.d.ts.map +1 -1
  126. package/dist/core/extensions/runner.js +1 -0
  127. package/dist/core/extensions/runner.js.map +1 -1
  128. package/dist/core/extensions/types.d.ts +8 -4
  129. package/dist/core/extensions/types.d.ts.map +1 -1
  130. package/dist/core/extensions/types.js.map +1 -1
  131. package/dist/core/foreground-terminal-handoff-controller.d.ts +14 -0
  132. package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
  133. package/dist/core/foreground-terminal-handoff-controller.js +188 -72
  134. package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
  135. package/dist/core/goals/goal-session-controller.d.ts +2 -0
  136. package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
  137. package/dist/core/goals/goal-session-controller.js +8 -0
  138. package/dist/core/goals/goal-session-controller.js.map +1 -1
  139. package/dist/core/goals/goal-tool-core.d.ts +5 -4
  140. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  141. package/dist/core/goals/goal-tool-core.js +23 -19
  142. package/dist/core/goals/goal-tool-core.js.map +1 -1
  143. package/dist/core/keybindings.d.ts +2 -2
  144. package/dist/core/keybindings.d.ts.map +1 -1
  145. package/dist/core/keybindings.js +2 -2
  146. package/dist/core/keybindings.js.map +1 -1
  147. package/dist/core/learning/auto-learn-settings.d.ts +84 -0
  148. package/dist/core/learning/auto-learn-settings.d.ts.map +1 -0
  149. package/dist/core/learning/auto-learn-settings.js +66 -0
  150. package/dist/core/learning/auto-learn-settings.js.map +1 -0
  151. package/dist/core/learning/reflection-engine.d.ts +4 -0
  152. package/dist/core/learning/reflection-engine.d.ts.map +1 -1
  153. package/dist/core/learning/reflection-engine.js +48 -10
  154. package/dist/core/learning/reflection-engine.js.map +1 -1
  155. package/dist/core/local-prefix-warm-controller.d.ts +24 -0
  156. package/dist/core/local-prefix-warm-controller.d.ts.map +1 -0
  157. package/dist/core/local-prefix-warm-controller.js +79 -0
  158. package/dist/core/local-prefix-warm-controller.js.map +1 -0
  159. package/dist/core/memory/providers/file-store.d.ts +2 -0
  160. package/dist/core/memory/providers/file-store.d.ts.map +1 -1
  161. package/dist/core/memory/providers/file-store.js +71 -15
  162. package/dist/core/memory/providers/file-store.js.map +1 -1
  163. package/dist/core/memory/worker-memory-tools.d.ts +5 -0
  164. package/dist/core/memory/worker-memory-tools.d.ts.map +1 -0
  165. package/dist/core/memory/worker-memory-tools.js +5 -0
  166. package/dist/core/memory/worker-memory-tools.js.map +1 -0
  167. package/dist/core/model-capability.d.ts +7 -0
  168. package/dist/core/model-capability.d.ts.map +1 -1
  169. package/dist/core/model-capability.js +12 -0
  170. package/dist/core/model-capability.js.map +1 -1
  171. package/dist/core/model-registry.d.ts.map +1 -1
  172. package/dist/core/model-registry.js +2 -10
  173. package/dist/core/model-registry.js.map +1 -1
  174. package/dist/core/model-router-controller.d.ts +3 -2
  175. package/dist/core/model-router-controller.d.ts.map +1 -1
  176. package/dist/core/model-router-controller.js +3 -2
  177. package/dist/core/model-router-controller.js.map +1 -1
  178. package/dist/core/orchestration/contracts.d.ts +16 -12
  179. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  180. package/dist/core/orchestration/contracts.js +2 -2
  181. package/dist/core/orchestration/contracts.js.map +1 -1
  182. package/dist/core/orchestration/lane-tool-manifests.d.ts +2 -2
  183. package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
  184. package/dist/core/orchestration/lane-tool-manifests.js +6 -1
  185. package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
  186. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  187. package/dist/core/orchestration/profile-registry.js +14 -0
  188. package/dist/core/orchestration/profile-registry.js.map +1 -1
  189. package/dist/core/orchestration/task-profile-writer.d.ts +7 -4
  190. package/dist/core/orchestration/task-profile-writer.d.ts.map +1 -1
  191. package/dist/core/orchestration/task-profile-writer.js +71 -59
  192. package/dist/core/orchestration/task-profile-writer.js.map +1 -1
  193. package/dist/core/orchestration/thinking-level-schema.d.ts +7 -0
  194. package/dist/core/orchestration/thinking-level-schema.d.ts.map +1 -0
  195. package/dist/core/orchestration/thinking-level-schema.js +19 -0
  196. package/dist/core/orchestration/thinking-level-schema.js.map +1 -0
  197. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  198. package/dist/core/orchestration/worker-execution-contract.js +12 -5
  199. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  200. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  201. package/dist/core/profile-filter-controller.js +5 -2
  202. package/dist/core/profile-filter-controller.js.map +1 -1
  203. package/dist/core/provider-prompt-contracts.d.ts +6 -5
  204. package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
  205. package/dist/core/provider-prompt-contracts.js +9 -11
  206. package/dist/core/provider-prompt-contracts.js.map +1 -1
  207. package/dist/core/provider-request-context-controller.d.ts +2 -0
  208. package/dist/core/provider-request-context-controller.d.ts.map +1 -1
  209. package/dist/core/provider-request-context-controller.js +10 -3
  210. package/dist/core/provider-request-context-controller.js.map +1 -1
  211. package/dist/core/reflection-controller.d.ts +56 -27
  212. package/dist/core/reflection-controller.d.ts.map +1 -1
  213. package/dist/core/reflection-controller.js +206 -117
  214. package/dist/core/reflection-controller.js.map +1 -1
  215. package/dist/core/resource-loader.d.ts.map +1 -1
  216. package/dist/core/resource-loader.js +6 -2
  217. package/dist/core/resource-loader.js.map +1 -1
  218. package/dist/core/risk-classifier.d.ts.map +1 -1
  219. package/dist/core/risk-classifier.js +22 -2
  220. package/dist/core/risk-classifier.js.map +1 -1
  221. package/dist/core/runtime-builder.d.ts +1 -0
  222. package/dist/core/runtime-builder.d.ts.map +1 -1
  223. package/dist/core/runtime-builder.js +25 -14
  224. package/dist/core/runtime-builder.js.map +1 -1
  225. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
  226. package/dist/core/secrets/credential-exposure-guard.js +55 -10
  227. package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
  228. package/dist/core/session-role.d.ts +6 -8
  229. package/dist/core/session-role.d.ts.map +1 -1
  230. package/dist/core/session-role.js +8 -18
  231. package/dist/core/session-role.js.map +1 -1
  232. package/dist/core/settings-manager.d.ts +20 -16
  233. package/dist/core/settings-manager.d.ts.map +1 -1
  234. package/dist/core/settings-manager.js +75 -50
  235. package/dist/core/settings-manager.js.map +1 -1
  236. package/dist/core/skill-vault.d.ts +15 -0
  237. package/dist/core/skill-vault.d.ts.map +1 -1
  238. package/dist/core/skill-vault.js +79 -45
  239. package/dist/core/skill-vault.js.map +1 -1
  240. package/dist/core/skills.d.ts +3 -0
  241. package/dist/core/skills.d.ts.map +1 -1
  242. package/dist/core/skills.js +6 -6
  243. package/dist/core/skills.js.map +1 -1
  244. package/dist/core/system-prompt-builder.d.ts +3 -0
  245. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  246. package/dist/core/system-prompt-builder.js +73 -13
  247. package/dist/core/system-prompt-builder.js.map +1 -1
  248. package/dist/core/system-prompt.d.ts.map +1 -1
  249. package/dist/core/system-prompt.js +6 -2
  250. package/dist/core/system-prompt.js.map +1 -1
  251. package/dist/core/tool-capability-policy.d.ts +3 -0
  252. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  253. package/dist/core/tool-capability-policy.js +13 -2
  254. package/dist/core/tool-capability-policy.js.map +1 -1
  255. package/dist/core/toolkit/script-runner.d.ts +2 -1
  256. package/dist/core/toolkit/script-runner.d.ts.map +1 -1
  257. package/dist/core/toolkit/script-runner.js +10 -2
  258. package/dist/core/toolkit/script-runner.js.map +1 -1
  259. package/dist/core/tools/delegate-status.d.ts +1 -1
  260. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  261. package/dist/core/tools/delegate-status.js +1 -1
  262. package/dist/core/tools/delegate-status.js.map +1 -1
  263. package/dist/core/tools/delegate.d.ts +4 -15
  264. package/dist/core/tools/delegate.d.ts.map +1 -1
  265. package/dist/core/tools/delegate.js +111 -73
  266. package/dist/core/tools/delegate.js.map +1 -1
  267. package/dist/core/tools/goal.d.ts +3 -4
  268. package/dist/core/tools/goal.d.ts.map +1 -1
  269. package/dist/core/tools/goal.js +30 -23
  270. package/dist/core/tools/goal.js.map +1 -1
  271. package/dist/core/tools/orchestration-panel.d.ts +7 -0
  272. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  273. package/dist/core/tools/orchestration-panel.js +58 -9
  274. package/dist/core/tools/orchestration-panel.js.map +1 -1
  275. package/dist/core/tools/profile-writer.d.ts +2 -8
  276. package/dist/core/tools/profile-writer.d.ts.map +1 -1
  277. package/dist/core/tools/profile-writer.js +6 -18
  278. package/dist/core/tools/profile-writer.js.map +1 -1
  279. package/dist/core/tools/run-toolkit-script.d.ts +1 -1
  280. package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
  281. package/dist/core/tools/run-toolkit-script.js +2 -2
  282. package/dist/core/tools/run-toolkit-script.js.map +1 -1
  283. package/dist/core/tools/skill-audit.d.ts +28 -1
  284. package/dist/core/tools/skill-audit.d.ts.map +1 -1
  285. package/dist/core/tools/skill-audit.js +56 -12
  286. package/dist/core/tools/skill-audit.js.map +1 -1
  287. package/dist/core/tools/skill.d.ts +12 -1
  288. package/dist/core/tools/skill.d.ts.map +1 -1
  289. package/dist/core/tools/skill.js +52 -0
  290. package/dist/core/tools/skill.js.map +1 -1
  291. package/dist/core/tools/skillify.d.ts.map +1 -1
  292. package/dist/core/tools/skillify.js +16 -7
  293. package/dist/core/tools/skillify.js.map +1 -1
  294. package/dist/core/tools/task-steps.d.ts.map +1 -1
  295. package/dist/core/tools/task-steps.js +2 -1
  296. package/dist/core/tools/task-steps.js.map +1 -1
  297. package/dist/core/tools/tmux-dispatch.d.ts +4 -16
  298. package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
  299. package/dist/core/tools/tmux-dispatch.js +5 -20
  300. package/dist/core/tools/tmux-dispatch.js.map +1 -1
  301. package/dist/core/worktree-sync/codes.d.ts +1 -2
  302. package/dist/core/worktree-sync/codes.d.ts.map +1 -1
  303. package/dist/core/worktree-sync/codes.js +1 -2
  304. package/dist/core/worktree-sync/codes.js.map +1 -1
  305. package/dist/core/worktree-sync/lane-gate.d.ts +4 -8
  306. package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
  307. package/dist/core/worktree-sync/lane-gate.js +5 -51
  308. package/dist/core/worktree-sync/lane-gate.js.map +1 -1
  309. package/dist/index.d.ts +5 -0
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +7 -0
  312. package/dist/index.js.map +1 -1
  313. package/dist/modes/interactive/auto-learn-controller.d.ts +6 -7
  314. package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
  315. package/dist/modes/interactive/auto-learn-controller.js +30 -207
  316. package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
  317. package/dist/modes/interactive/autonomy-commands.js +2 -2
  318. package/dist/modes/interactive/autonomy-commands.js.map +1 -1
  319. package/dist/modes/interactive/components/agents-overlay.d.ts +16 -4
  320. package/dist/modes/interactive/components/agents-overlay.d.ts.map +1 -1
  321. package/dist/modes/interactive/components/agents-overlay.js +108 -29
  322. package/dist/modes/interactive/components/agents-overlay.js.map +1 -1
  323. package/dist/modes/interactive/components/custom-message.js +17 -0
  324. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  325. package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/fitness-role-selector.js +2 -2
  327. package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
  328. package/dist/modes/interactive/components/footer.js +1 -1
  329. package/dist/modes/interactive/components/footer.js.map +1 -1
  330. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  331. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  332. package/dist/modes/interactive/components/settings-selector.js +150 -73
  333. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  334. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  335. package/dist/modes/interactive/interactive-mode.js +5 -4
  336. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  337. package/dist/modes/interactive/report-commands.d.ts.map +1 -1
  338. package/dist/modes/interactive/report-commands.js +8 -4
  339. package/dist/modes/interactive/report-commands.js.map +1 -1
  340. package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
  341. package/dist/modes/interactive/settings-selector-flow.js +10 -0
  342. package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
  343. package/docs/extensions.md +10 -0
  344. package/docs/harness-architecture.md +28 -32
  345. package/docs/index.md +2 -1
  346. package/docs/keybindings.md +2 -0
  347. package/docs/process-matrix.md +8 -6
  348. package/docs/resources.md +1 -1
  349. package/docs/settings.md +61 -51
  350. package/docs/task-steps.md +2 -0
  351. package/docs/tmux-agent-manager.md +48 -41
  352. package/docs/usage.md +1 -1
  353. package/docs/work-lifecycle.md +137 -0
  354. package/docs/worker-profiles.md +8 -6
  355. package/docs/worktree-sync.md +26 -20
  356. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  357. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  358. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  359. package/examples/extensions/sandbox/package-lock.json +2 -2
  360. package/examples/extensions/sandbox/package.json +1 -1
  361. package/examples/extensions/with-deps/package-lock.json +2 -2
  362. package/examples/extensions/with-deps/package.json +1 -1
  363. package/npm-shrinkwrap.json +12 -12
  364. package/package.json +4 -4
  365. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +0 -133
  366. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +0 -1
  367. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +0 -199
  368. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +0 -1
  369. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +0 -312
@@ -1,25 +1,10 @@
1
- /**
2
- * Classify a `fire_task` launch failure into an honest, stable skip reason. For an UNATTENDED
3
- * caller (`ctx.hasUI === false`, always true from the goal/idle path) `authorizeLaunch`'s ONLY
4
- * refusal throw is the no-standing-grant error (`tmux-agent-manager/index.ts`'s `authorizeLaunch`,
5
- * message containing the stable phrase "no standing grant") -- matched here by substring since the
6
- * extension throws a plain `Error`, not a tagged error code (documented follow-up hardening, not
7
- * blocking). Every other thrown error (a bad jobId, a live session-name collision,
8
- * an environment failure) maps onto the generic `"tmux_dispatch_failed"` -- still surfaced through
9
- * the existing `dispatchSkipReason` contract, never a crash and never a silently-ignored failure.
10
- */
11
- export function classifyDispatchError(error) {
12
- const message = error instanceof Error ? error.message : String(error);
13
- return message.includes("no standing grant") ? "no_standing_grant" : "tmux_dispatch_failed";
14
- }
15
1
  /**
16
2
  * Structurally dispatch ONE persistent tmux worker agent for a single goal requirement, by
17
3
  * invoking the SAME `tmux_agent_manager` `fire_task` tool call the model itself would make. Core
18
4
  * -- not model discretion -- decides WHEN this fires (the goal tool's `dispatchTarget:"tmux"`
19
- * routing gates the call); the launch itself always still goes through the extension's own
20
- * grant-gated `authorizeLaunch`, so an ungranted unattended call is honestly refused here (never a
21
- * silent launch, never a fabricated laneId) and the refusal is surfaced through the existing
22
- * `dispatchSkipReason` contract on the goal tool's response.
5
+ * routing gates the call). The extension derives an immutable child profile from the parent's
6
+ * admitted worker surface and reserves it durably before launch; no separate approval handshake is
7
+ * involved. Any launch failure is surfaced through the existing `dispatchSkipReason` contract.
23
8
  */
24
9
  export async function dispatchTmuxWorker(deps, args) {
25
10
  // Capability check FIRST -- before the tool-definition lookup and before createLaneWorktree --
@@ -86,8 +71,8 @@ export async function dispatchTmuxWorker(deps, args) {
86
71
  try {
87
72
  result = await toolDef.execute(toolCallId, params, ctx.signal, undefined, ctx);
88
73
  }
89
- catch (error) {
90
- return { skipReason: classifyDispatchError(error) };
74
+ catch {
75
+ return { skipReason: "tmux_dispatch_failed" };
91
76
  }
92
77
  // Correlate: the extension reports its dispatch under its OWN caller-chosen laneId
93
78
  // (`tmux:${job.id}:${agent.id}`, reconstructed here from the tool result's `details.job` --
@@ -1 +1 @@
1
- {"version":3,"file":"tmux-dispatch.js","sourceRoot":"","sources":["../../../src/core/tools/tmux-dispatch.ts"],"names":[],"mappings":"AAuDA;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IACnD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,sBAAsB,CAAC;AAC7F,CAAC;AAaD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,IAAsB,EACtB,IAAqD;IAErD,+FAA+F;IAC/F,gGAAgG;IAChG,8FAA8F;IAC9F,6FAA6F;IAC7F,kGAAkG;IAClG,IAAI,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,OAAO;QAAE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;IAE/F,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAEjE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,iBAAiB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;IAC1E,IAA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AAQ,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE;SAC1C;KACD,CAAC;IACF,IAAI,MAAsD,CAAC;IAC3D,IAAI,CAAC;QACJ,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAChF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,UAAU,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;IACrD,CAAC;IAED,mFAAmF;IACnF,4FAA4F;IAC5F,4FAA4F;IAC5F,yFAAyF;IACzF,sEAAsE;IACtE,MAAM,GAAG,GAAI,MAAM,CAAC,OAA6C,EAAE,GAAG,CAAC;IACvE,MAAM,OAAO,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,CAAC;IAEhF,MAAM,YAAY,GAAG,QAAQ,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACjE,OAAO,gBAAgB,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,yBAAyB,EAAE,CAAC;AACjH,CAAC","sourcesContent":["import type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\nimport type { LaneWorkerRefusal } from \"../model-capability.ts\";\n\n/**\n * Dependencies for {@link dispatchTmuxWorker}, injected from the construction site\n * (`RuntimeBuilder`) so the adapter itself stays a small, unit-testable, faux-tool-driven module\n * with no direct dependency on `AgentSession`/`ExtensionRunner`/`BackgroundLaneController`.\n */\nexport interface TmuxDispatchDeps {\n\t/** Runtime platform seam. Native Windows has no supported tmux backend; WSL reports `linux`. */\n\tplatform?: NodeJS.Platform;\n\t/** Look up a registered tool by name -- the SAME seam the model's own tool calls resolve\n\t * through (`AgentSession.getToolDefinition` -> `RuntimeBuilder.getToolDefinition`). `undefined`\n\t * when the tmux extension is not loaded in this session -- an honest, non-fatal skip, not a\n\t * crash and not a silent no-op. */\n\tgetToolDefinition: (name: string) => ToolDefinition | undefined;\n\t/** Build a fresh, non-turn-bound `ExtensionContext` for this call\n\t * (`ExtensionRunner.createContext()`) -- safe to invoke from the goal/idle path, outside any\n\t * live model turn. */\n\tcreateExtensionContext: () => ExtensionContext;\n\t/**\n\t * Confirm that the tmux extension's caller-chosen lane id (reconstructed below from the\n\t * `fire_task` result's `details.job`) was durably registered by the host. The returned id is\n\t * identity-preserving and is the same value `Requirement.boundLaneId` uses.\n\t */\n\tresolveManagedLaneId: (callerLaneId: string) => string | undefined;\n\t/** Active goal id, threaded onto the `fire_task` call so the dispatched lane is goal-tagged\n\t * (`ManagedLaneEvent.goalId`) -- `undefined` when no goal is active (dispatch still proceeds;\n\t * the resulting lane is simply untagged). */\n\tgetGoalId: () => string | undefined;\n\t/**\n\t * Worktree-sync lane-first dispatch (opt-in -- wired ONLY inside `runtime-builder.ts`'s\n\t * `worktreeSync.enabled` block, via the engine's `createLane`): when present, `dispatchTmuxWorker`\n\t * creates a fresh worktree-sync lane for this requirement BEFORE issuing any `fire_task` call, so\n\t * a creation refusal aborts cleanly before any tmux/pane side effect ever runs -- never a\n\t * half-made lane, never a fabricated worktree. On success the dispatched agent's `cwd` is the new\n\t * lane worktree and it carries `worktreeLane` (threaded to the tmux extension's launch profile --\n\t * see `dispatch-grant.ts`'s `buildLaunchProfileFlags`). Absent dep -> existing byte-identical\n\t * `params.agents` (no `cwd`/`worktreeLane`), exactly as before this field existed.\n\t */\n\tcreateLaneWorktree?: (args: {\n\t\tgoalId?: string;\n\t\trequirementId: string;\n\t}) => Promise<{ laneKey: string; worktreePath: string } | { skipReason: string }>;\n\t/**\n\t * Lane-worker capability eligibility (opt-in -- wired only from `runtime-builder.ts`, backed by\n\t * `AgentSession.getLaneWorkerRefusal`): checked FIRST, before `createLaneWorktree`, so an\n\t * ineligible model's dispatch is refused before any lane/pane side effect ever runs. This is the\n\t * parent's best-effort check only -- the dispatched child session refuses authoritatively at its\n\t * own startup (main.ts) regardless of what the parent decides here. Absent dep -> no capability\n\t * check runs, byte-identical to before this field existed.\n\t */\n\tevaluateWorkerLaneRefusal?: () => LaneWorkerRefusal | undefined;\n}\n\n/**\n * Classify a `fire_task` launch failure into an honest, stable skip reason. For an UNATTENDED\n * caller (`ctx.hasUI === false`, always true from the goal/idle path) `authorizeLaunch`'s ONLY\n * refusal throw is the no-standing-grant error (`tmux-agent-manager/index.ts`'s `authorizeLaunch`,\n * message containing the stable phrase \"no standing grant\") -- matched here by substring since the\n * extension throws a plain `Error`, not a tagged error code (documented follow-up hardening, not\n * blocking). Every other thrown error (a bad jobId, a live session-name collision,\n * an environment failure) maps onto the generic `\"tmux_dispatch_failed\"` -- still surfaced through\n * the existing `dispatchSkipReason` contract, never a crash and never a silently-ignored failure.\n */\nexport function classifyDispatchError(error: unknown): string {\n\tconst message = error instanceof Error ? error.message : String(error);\n\treturn message.includes(\"no standing grant\") ? \"no_standing_grant\" : \"tmux_dispatch_failed\";\n}\n\ninterface FireTaskResultDetails {\n\tjob?: {\n\t\tid?: string;\n\t\tagents?: ReadonlyArray<{ id?: string }>;\n\t};\n}\n\ninterface TmuxGuardResultDetails {\n\tguard?: { allowed?: boolean };\n}\n\n/**\n * Structurally dispatch ONE persistent tmux worker agent for a single goal requirement, by\n * invoking the SAME `tmux_agent_manager` `fire_task` tool call the model itself would make. Core\n * -- not model discretion -- decides WHEN this fires (the goal tool's `dispatchTarget:\"tmux\"`\n * routing gates the call); the launch itself always still goes through the extension's own\n * grant-gated `authorizeLaunch`, so an ungranted unattended call is honestly refused here (never a\n * silent launch, never a fabricated laneId) and the refusal is surfaced through the existing\n * `dispatchSkipReason` contract on the goal tool's response.\n */\nexport async function dispatchTmuxWorker(\n\tdeps: TmuxDispatchDeps,\n\targs: { requirementId: string; instructions: string },\n): Promise<{ laneId?: string; skipReason?: string }> {\n\t// Capability check FIRST -- before the tool-definition lookup and before createLaneWorktree --\n\t// so an ineligible model's dispatch is refused with zero lane/pane/tool side effect. The coarse\n\t// \"worker_capability_insufficient\" skip reason is the stable contract code on the goal tool's\n\t// response; the granular reason (class/window/tool-calling) lives only in the refusal object\n\t// itself, surfaced by the caller for logging (see model-capability.ts's formatLaneWorkerRefusal).\n\tif (deps.evaluateWorkerLaneRefusal?.() !== undefined) {\n\t\treturn { skipReason: \"worker_capability_insufficient\" };\n\t}\n\tif ((deps.platform ?? process.platform) === \"win32\") return { skipReason: \"tmux_unavailable\" };\n\n\tconst toolDef = deps.getToolDefinition(\"tmux_agent_manager\");\n\tif (!toolDef) return { skipReason: \"tmux_extension_not_loaded\" };\n\n\tconst goalId = deps.getGoalId();\n\tconst ctx = deps.createExtensionContext();\n\tconst toolCallId = `goal-dispatch:${goalId ?? \"?\"}:${args.requirementId}`;\n\ttry {\n\t\tconst guardResult = await toolDef.execute(`${toolCallId}:guard`, { action: \"guard\" }, ctx.signal, undefined, ctx);\n\t\tconst guard = (guardResult.details as TmuxGuardResultDetails | undefined)?.guard;\n\t\tif (guard?.allowed !== true) return { skipReason: \"tmux_unavailable\" };\n\t} catch {\n\t\t// A guard failure is side-effect free. Treat it as backend unavailability so the goal owner can\n\t\t// safely choose its native worker fallback without fabricating a tmux lane.\n\t\treturn { skipReason: \"tmux_unavailable\" };\n\t}\n\n\t// Availability first, then lane-first: when worktree-sync is wired, create the lane only after\n\t// tmux's pure guard succeeds and BEFORE any fire_task call so a\n\t// creation refusal (max lanes, invalid key, git error, ...) aborts cleanly with no tmux/pane side\n\t// effect ever having run. The specific engine refusal code is deliberately collapsed onto the one\n\t// stable `worktree_create_failed` skip reason -- same narrow `{laneId?, skipReason?}` contract\n\t// every other skip path here already uses; the engine's own detail lives in its audit log, not in\n\t// this narrow return.\n\tlet laneWorktree: { laneKey: string; worktreePath: string } | undefined;\n\tif (deps.createLaneWorktree) {\n\t\tconst created = await deps.createLaneWorktree({ goalId, requirementId: args.requirementId });\n\t\tif (\"skipReason\" in created) return { skipReason: \"worktree_create_failed\" };\n\t\tlaneWorktree = created;\n\t}\n\n\t// Single-agent 1:1 mapping: a bare fire_task with no `agents` defaults to a THREE-agent\n\t// team (pi/agy/codex -- `DEFAULT_AGENT_PROVIDERS`), which would mint three lanes for one\n\t// requirement. A goal-bound dispatch must map to exactly one lane, so `agents` is always\n\t// passed explicitly here.\n\tconst params = {\n\t\taction: \"fire_task\",\n\t\ttask: args.instructions,\n\t\tgoalId,\n\t\tagents: [\n\t\t\tlaneWorktree\n\t\t\t\t? {\n\t\t\t\t\t\tprovider: \"pi\",\n\t\t\t\t\t\tname: \"goal-worker\",\n\t\t\t\t\t\tcwd: laneWorktree.worktreePath,\n\t\t\t\t\t\tworktreeLane: laneWorktree.laneKey,\n\t\t\t\t\t}\n\t\t\t\t: { provider: \"pi\", name: \"goal-worker\" },\n\t\t],\n\t};\n\tlet result: Awaited<ReturnType<ToolDefinition[\"execute\"]>>;\n\ttry {\n\t\tresult = await toolDef.execute(toolCallId, params, ctx.signal, undefined, ctx);\n\t} catch (error) {\n\t\treturn { skipReason: classifyDispatchError(error) };\n\t}\n\n\t// Correlate: the extension reports its dispatch under its OWN caller-chosen laneId\n\t// (`tmux:${job.id}:${agent.id}`, reconstructed here from the tool result's `details.job` --\n\t// the same format `agentLaneId` builds extension-side) which the host's `recordManagedLane`\n\t// bridge preserves as the canonical durable id; `resolveManagedLaneId` confirms that the\n\t// matching dispatch report reached the host before the goal binds it.\n\tconst job = (result.details as FireTaskResultDetails | undefined)?.job;\n\tconst primary = job?.agents?.[0];\n\tif (!job?.id || !primary?.id) return { skipReason: \"tmux_dispatch_incomplete\" };\n\n\tconst callerLaneId = `tmux:${job.id}:${primary.id}`;\n\tconst registeredLaneId = deps.resolveManagedLaneId(callerLaneId);\n\treturn registeredLaneId === callerLaneId ? { laneId: callerLaneId } : { skipReason: \"lane_correlation_failed\" };\n}\n"]}
1
+ {"version":3,"file":"tmux-dispatch.js","sourceRoot":"","sources":["../../../src/core/tools/tmux-dispatch.ts"],"names":[],"mappings":"AAkEA;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,IAAsB,EACtB,IAAqD;IAErD,+FAA+F;IAC/F,gGAAgG;IAChG,8FAA8F;IAC9F,6FAA6F;IAC7F,kGAAkG;IAClG,IAAI,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,OAAO;QAAE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;IAE/F,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAEjE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,iBAAiB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;IAC1E,IAAI,CAAC;QACJ,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAClH,MAAM,KAAK,GAAI,WAAW,CAAC,OAA8C,EA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CAAC,CAAC;IAChF,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,CAAC;IAC/C,CAAC;IAED,mFAAmF;IACnF,4FAA4F;IAC5F,4FAA4F;IAC5F,yFAAyF;IACzF,sEAAsE;IACtE,MAAM,GAAG,GAAI,MAAM,CAAC,OAA6C,EAAE,GAAG,CAAC;IACvE,MAAM,OAAO,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,CAAC;IAEhF,MAAM,YAAY,GAAG,QAAQ,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACjE,OAAO,gBAAgB,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,yBAAyB,EAAE,CAAC;AACjH,CAAC","sourcesContent":["import type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\nimport type { LaneWorkerRefusal } from \"../model-capability.ts\";\n\n/**\n * Dependencies for {@link dispatchTmuxWorker}, injected from the construction site\n * (`RuntimeBuilder`) so the adapter itself stays a small, unit-testable, faux-tool-driven module\n * with no direct dependency on `AgentSession`/`ExtensionRunner`/`BackgroundLaneController`.\n */\nexport interface TmuxDispatchDeps {\n\t/** Runtime platform seam. Native Windows has no supported tmux backend; WSL reports `linux`. */\n\tplatform?: NodeJS.Platform;\n\t/** Look up a registered tool by name -- the SAME seam the model's own tool calls resolve\n\t * through (`AgentSession.getToolDefinition` -> `RuntimeBuilder.getToolDefinition`). `undefined`\n\t * when the tmux extension is not loaded in this session -- an honest, non-fatal skip, not a\n\t * crash and not a silent no-op. */\n\tgetToolDefinition: (name: string) => ToolDefinition | undefined;\n\t/** Build a fresh, non-turn-bound `ExtensionContext` for this call\n\t * (`ExtensionRunner.createContext()`) -- safe to invoke from the goal/idle path, outside any\n\t * live model turn. */\n\tcreateExtensionContext: () => ExtensionContext;\n\t/**\n\t * Confirm that the tmux extension's caller-chosen lane id (reconstructed below from the\n\t * `fire_task` result's `details.job`) was durably registered by the host. The returned id is\n\t * identity-preserving and is the same value `Requirement.boundLaneId` uses.\n\t */\n\tresolveManagedLaneId: (callerLaneId: string) => string | undefined;\n\t/** Active goal id, threaded onto the `fire_task` call so the dispatched lane is goal-tagged\n\t * (`ManagedLaneEvent.goalId`) -- `undefined` when no goal is active (dispatch still proceeds;\n\t * the resulting lane is simply untagged). */\n\tgetGoalId: () => string | undefined;\n\t/**\n\t * Worktree-sync lane-first dispatch (opt-in -- wired ONLY inside `runtime-builder.ts`'s\n\t * `worktreeSync.enabled` block, via the engine's `createLane`): when present, `dispatchTmuxWorker`\n\t * creates a fresh worktree-sync lane for this requirement BEFORE issuing any `fire_task` call, so\n\t * a creation refusal aborts cleanly before any tmux/pane side effect ever runs -- never a\n\t * half-made lane, never a fabricated worktree. On success the dispatched agent's `cwd` is the new\n\t * lane worktree and it carries `worktreeLane` (threaded to the tmux extension's launch profile --\n\t * see `launch-profile.ts`'s `buildLaunchProfileFlags`). Absent dep -> existing byte-identical\n\t * `params.agents` (no `cwd`/`worktreeLane`), exactly as before this field existed.\n\t */\n\tcreateLaneWorktree?: (args: {\n\t\tgoalId?: string;\n\t\trequirementId: string;\n\t}) => Promise<{ laneKey: string; worktreePath: string } | { skipReason: string }>;\n\t/**\n\t * Lane-worker capability eligibility (opt-in -- wired only from `runtime-builder.ts`, backed by\n\t * `AgentSession.getLaneWorkerRefusal`): checked FIRST, before `createLaneWorktree`, so an\n\t * ineligible model's dispatch is refused before any lane/pane side effect ever runs. This is the\n\t * parent's best-effort check only -- the dispatched child session refuses authoritatively at its\n\t * own startup (main.ts) regardless of what the parent decides here. Absent dep -> no capability\n\t * check runs, byte-identical to before this field existed.\n\t */\n\tevaluateWorkerLaneRefusal?: () => LaneWorkerRefusal | undefined;\n}\n\ninterface FireTaskResultDetails {\n\tjob?: {\n\t\tid?: string;\n\t\tagents?: ReadonlyArray<{ id?: string }>;\n\t};\n}\n\ninterface TmuxGuardResultDetails {\n\tguard?: { allowed?: boolean };\n}\n\n/**\n * Structurally dispatch ONE persistent tmux worker agent for a single goal requirement, by\n * invoking the SAME `tmux_agent_manager` `fire_task` tool call the model itself would make. Core\n * -- not model discretion -- decides WHEN this fires (the goal tool's `dispatchTarget:\"tmux\"`\n * routing gates the call). The extension derives an immutable child profile from the parent's\n * admitted worker surface and reserves it durably before launch; no separate approval handshake is\n * involved. Any launch failure is surfaced through the existing `dispatchSkipReason` contract.\n */\nexport async function dispatchTmuxWorker(\n\tdeps: TmuxDispatchDeps,\n\targs: { requirementId: string; instructions: string },\n): Promise<{ laneId?: string; skipReason?: string }> {\n\t// Capability check FIRST -- before the tool-definition lookup and before createLaneWorktree --\n\t// so an ineligible model's dispatch is refused with zero lane/pane/tool side effect. The coarse\n\t// \"worker_capability_insufficient\" skip reason is the stable contract code on the goal tool's\n\t// response; the granular reason (class/window/tool-calling) lives only in the refusal object\n\t// itself, surfaced by the caller for logging (see model-capability.ts's formatLaneWorkerRefusal).\n\tif (deps.evaluateWorkerLaneRefusal?.() !== undefined) {\n\t\treturn { skipReason: \"worker_capability_insufficient\" };\n\t}\n\tif ((deps.platform ?? process.platform) === \"win32\") return { skipReason: \"tmux_unavailable\" };\n\n\tconst toolDef = deps.getToolDefinition(\"tmux_agent_manager\");\n\tif (!toolDef) return { skipReason: \"tmux_extension_not_loaded\" };\n\n\tconst goalId = deps.getGoalId();\n\tconst ctx = deps.createExtensionContext();\n\tconst toolCallId = `goal-dispatch:${goalId ?? \"?\"}:${args.requirementId}`;\n\ttry {\n\t\tconst guardResult = await toolDef.execute(`${toolCallId}:guard`, { action: \"guard\" }, ctx.signal, undefined, ctx);\n\t\tconst guard = (guardResult.details as TmuxGuardResultDetails | undefined)?.guard;\n\t\tif (guard?.allowed !== true) return { skipReason: \"tmux_unavailable\" };\n\t} catch {\n\t\t// A guard failure is side-effect free. Treat it as backend unavailability so the goal owner can\n\t\t// safely choose its native worker fallback without fabricating a tmux lane.\n\t\treturn { skipReason: \"tmux_unavailable\" };\n\t}\n\n\t// Availability first, then lane-first: when worktree-sync is wired, create the lane only after\n\t// tmux's pure guard succeeds and BEFORE any fire_task call so a\n\t// creation refusal (max lanes, invalid key, git error, ...) aborts cleanly with no tmux/pane side\n\t// effect ever having run. The specific engine refusal code is deliberately collapsed onto the one\n\t// stable `worktree_create_failed` skip reason -- same narrow `{laneId?, skipReason?}` contract\n\t// every other skip path here already uses; the engine's own detail lives in its audit log, not in\n\t// this narrow return.\n\tlet laneWorktree: { laneKey: string; worktreePath: string } | undefined;\n\tif (deps.createLaneWorktree) {\n\t\tconst created = await deps.createLaneWorktree({ goalId, requirementId: args.requirementId });\n\t\tif (\"skipReason\" in created) return { skipReason: \"worktree_create_failed\" };\n\t\tlaneWorktree = created;\n\t}\n\n\t// Single-agent 1:1 mapping: a bare fire_task with no `agents` defaults to a THREE-agent\n\t// team (pi/agy/codex -- `DEFAULT_AGENT_PROVIDERS`), which would mint three lanes for one\n\t// requirement. A goal-bound dispatch must map to exactly one lane, so `agents` is always\n\t// passed explicitly here.\n\tconst params = {\n\t\taction: \"fire_task\",\n\t\ttask: args.instructions,\n\t\tgoalId,\n\t\tagents: [\n\t\t\tlaneWorktree\n\t\t\t\t? {\n\t\t\t\t\t\tprovider: \"pi\",\n\t\t\t\t\t\tname: \"goal-worker\",\n\t\t\t\t\t\tcwd: laneWorktree.worktreePath,\n\t\t\t\t\t\tworktreeLane: laneWorktree.laneKey,\n\t\t\t\t\t}\n\t\t\t\t: { provider: \"pi\", name: \"goal-worker\" },\n\t\t],\n\t};\n\tlet result: Awaited<ReturnType<ToolDefinition[\"execute\"]>>;\n\ttry {\n\t\tresult = await toolDef.execute(toolCallId, params, ctx.signal, undefined, ctx);\n\t} catch {\n\t\treturn { skipReason: \"tmux_dispatch_failed\" };\n\t}\n\n\t// Correlate: the extension reports its dispatch under its OWN caller-chosen laneId\n\t// (`tmux:${job.id}:${agent.id}`, reconstructed here from the tool result's `details.job` --\n\t// the same format `agentLaneId` builds extension-side) which the host's `recordManagedLane`\n\t// bridge preserves as the canonical durable id; `resolveManagedLaneId` confirms that the\n\t// matching dispatch report reached the host before the goal binds it.\n\tconst job = (result.details as FireTaskResultDetails | undefined)?.job;\n\tconst primary = job?.agents?.[0];\n\tif (!job?.id || !primary?.id) return { skipReason: \"tmux_dispatch_incomplete\" };\n\n\tconst callerLaneId = `tmux:${job.id}:${primary.id}`;\n\tconst registeredLaneId = deps.resolveManagedLaneId(callerLaneId);\n\treturn registeredLaneId === callerLaneId ? { laneId: callerLaneId } : { skipReason: \"lane_correlation_failed\" };\n}\n"]}
@@ -2,8 +2,7 @@
2
2
  * Worktree-sync SSOT for tagged result codes and shared record types.
3
3
  *
4
4
  * Every worktree-sync operation reports its outcome through one of these string-literal codes in
5
- * a typed result -- callers branch on `code`, NEVER on message/stderr substrings (the
6
- * `classifyDispatchError` substring compromise is deliberately not repeated here). Git stderr is
5
+ * a typed result -- callers branch on `code`, NEVER on message/stderr substrings. Git stderr is
7
6
  * carried alongside as evidence for humans, not as a branch condition.
8
7
  */
9
8
  /** Cap on `WorktreeSyncEpoch.changedPaths`; beyond it the list is truncated and overlap checks
@@ -1 +1 @@
1
- {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/core/worktree-sync/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;gGACgG;AAChG,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C,MAAM,MAAM,gBAAgB,GACzB,IAAI,GACJ,UAAU,GACV,gBAAgB,GAChB,2BAA2B,G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,MAAM,CAAC;IACd,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACvC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9E,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,gBAAgB,GACzB,UAAU,GACV,mBAAmB,CAAC,gBAAgB,GAAG,2BAA2B,GAAG,WAAW,CAAC,CAAC"}
@@ -2,8 +2,7 @@
2
2
  * Worktree-sync SSOT for tagged result codes and shared record types.
3
3
  *
4
4
  * Every worktree-sync operation reports its outcome through one of these string-literal codes in
5
- * a typed result -- callers branch on `code`, NEVER on message/stderr substrings (the
6
- * `classifyDispatchError` substring compromise is deliberately not repeated here). Git stderr is
5
+ * a typed result -- callers branch on `code`, NEVER on message/stderr substrings. Git stderr is
7
6
  * carried alongside as evidence for humans, not as a branch condition.
8
7
  */
9
8
  /** Cap on `WorktreeSyncEpoch.changedPaths`; beyond it the list is truncated and overlap checks
@@ -1 +1 @@
1
- {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/core/worktree-sync/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;gGACgG;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["/**\n * Worktree-sync SSOT for tagged result codes and shared record types.\n *\n * Every worktree-sync operation reports its outcome through one of these string-literal codes in\n * a typed result -- callers branch on `code`, NEVER on message/stderr substrings (the\n * `classifyDispatchError` substring compromise is deliberately not repeated here). Git stderr is\n * carried alongside as evidence for humans, not as a branch condition.\n */\n\n/** Cap on `WorktreeSyncEpoch.changedPaths`; beyond it the list is truncated and overlap checks\n * treat the land as conservatively overlapping EVERYTHING (deterministic, never optimistic). */\nexport const EPOCH_CHANGED_PATHS_CAP = 500;\n\n/** Branch namespace for lane branches: `pi/wt/<laneKey>`. */\nexport const LANE_BRANCH_PREFIX = \"pi/wt/\";\n\nexport type WorktreeSyncCode =\n\t| \"ok\"\n\t| \"disabled\"\n\t| \"not_a_git_repo\"\n\t| \"default_branch_unresolved\"\n\t| \"hub_missing\"\n\t| \"invalid_lane_key\"\n\t| \"lane_exists\"\n\t| \"lane_not_found\"\n\t| \"max_lanes_reached\"\n\t| \"lane_dirty\"\n\t| \"hub_dirty\"\n\t| \"stale_lane\"\n\t| \"sync_required\"\n\t| \"sync_clean\"\n\t| \"sync_conflicts\"\n\t| \"rebase_in_progress\"\n\t| \"no_rebase_in_progress\"\n\t| \"conflict_markers_present\"\n\t| \"gate_command_unset\"\n\t| \"gate_failed\"\n\t| \"lane_changed_during_gate\"\n\t| \"ff_failed\"\n\t| \"lock_busy\"\n\t| \"lock_takeover\"\n\t| \"nothing_to_land\"\n\t| \"main_mutation_refused\"\n\t| \"lane_unlanded_work\"\n\t| \"worktree_missing\"\n\t| \"released\"\n\t| \"reconciled\"\n\t| \"git_error\"\n\t| \"role_forbidden\"\n\t| \"path_outside_lane\"\n\t| \"lane_owner_conflict\";\n\n/**\n * A refusal/failure outcome. `message` is deterministic text assembled from facts (safe to show a\n * model verbatim); `gitStderr` is bounded raw evidence; `paths` names offending files where the\n * refusal is about specific files (dirty files, conflict markers); `holder` identifies the\n * integration-lock holder on `lock_busy`.\n */\nexport interface WorktreeSyncRefusal<C extends WorktreeSyncCode = WorktreeSyncCode> {\n\tcode: C;\n\tmessage: string;\n\tgitStderr?: string;\n\tpaths?: string[];\n\tholder?: IntegrationLockOwner;\n}\n\n/** Staleness-propagation policy (D9). `on_land_mandatory` is the default: every land marks every\n * other active lane sync_required. `overlap_mandatory` requires it only on changed-file overlap.\n * `land_time_only` keeps staleness advisory until the land gate (G3 always enforces). */\nexport type WorktreeSyncPolicy = \"on_land_mandatory\" | \"overlap_mandatory\" | \"land_time_only\";\n\n/** One lane registration record (`lanes/<laneKey>.json`). Identity/binding fields ONLY -- git\n * truths (freshness, dirtiness, ahead/behind) are always re-derived live, never stored here. */\nexport interface LaneRegistration {\n\tlaneKey: string;\n\tbranch: string;\n\tworktreePath: string;\n\tstatus: \"active\" | \"released\" | \"orphaned\";\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tgoalId?: string;\n\trequirementId?: string;\n\t/** Host `LaneRecord.laneId` after dispatch correlation (tmux/in-process worker binding). */\n\tboundLaneId?: string;\n\townerPid?: number;\n\townerSessionId?: string;\n}\n\n/** `epoch.json` -- the integration epoch. `epoch` is monotonic messaging/audit sugar; correctness\n * always derives from git shas (`merge-base --is-ancestor`), never from this counter. */\nexport interface WorktreeSyncEpoch {\n\tepoch: number;\n\tmainSha: string;\n\tpreviousMainSha?: string;\n\tlandedLaneKey?: string;\n\tlandedAt?: string;\n\tchangedPaths: string[];\n\tchangedPathsTruncated: boolean;\n}\n\n/** Live, git-derived facts about one lane. Computed fresh per call -- there is no cached copy to\n * go stale, which is the point. */\nexport interface LaneFacts {\n\tlaneKey: string;\n\tbranch: string;\n\tworktreePath: string;\n\tregistrationStatus: LaneRegistration[\"status\"];\n\t/** Lane branch tip sha; undefined when the branch no longer exists. */\n\tbranchSha?: string;\n\t/** True iff current main is an ancestor of the lane tip (`merge-base --is-ancestor`). */\n\tfresh: boolean;\n\t/** True when `status --porcelain` in the lane worktree is non-empty. */\n\tdirty: boolean;\n\trebaseInProgress: boolean;\n\taheadOfMain: number;\n\tbehindMain: number;\n\tworktreePresent: boolean;\n\t/** Undefined when the lane has no recorded owner pid. */\n\townerAlive?: boolean;\n}\n\nexport interface IntegrationLockOwner {\n\tpid: number;\n\thostname: string;\n\t/** Random acquisition identity; PID/session are diagnostic only and never authorize release. */\n\ttoken: string;\n\tsessionId?: string;\n\tlaneKey?: string;\n\tacquiredAt: string;\n}\n\nexport type IntegrationLockAcquisition =\n\t| { acquired: true; takeover: boolean; token: string }\n\t| { acquired: false; holder?: IntegrationLockOwner; holderAlive: boolean };\n\n/** One conflicted file in a sync stopped on conflicts. */\nexport interface ConflictWorklistFile {\n\tpath: string;\n\t/** Both-modified is the common case; add/add and modify/delete surface as their index states. */\n\tkind: \"both_modified\" | \"both_added\" | \"deleted_by_us\" | \"deleted_by_them\" | \"unknown\";\n\t/** True when git rerere already replayed a recorded resolution for this file -- review, not re-resolve. */\n\tresolvedByRerere: boolean;\n}\n\n/** Structured conflict worklist returned when a sync/continue stops on conflicts. */\nexport interface ConflictWorklist {\n\t/** e.g. \"2/5\" -- rebase progress (stopped step / total steps). */\n\tstep: string;\n\tstoppedAtCommit?: { sha: string; subject: string };\n\tfiles: ConflictWorklistFile[];\n}\n\nexport type BindLaneWorkerResult =\n\t| { code: \"bound\"; laneKey: string; laneId: string }\n\t| { code: \"already_bound\"; laneKey: string; laneId: string }\n\t| { code: \"binding_conflict\"; laneKey: string; boundLaneId: string }\n\t| { code: \"lane_not_found\"; message: string }\n\t| { code: \"lane_not_active\"; message: string }\n\t| { code: \"store_error\"; message: string };\n\nexport type CreateLaneResult =\n\t| { code: \"ok\"; lane: LaneRegistration }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"invalid_lane_key\"\n\t\t\t| \"lane_exists\"\n\t\t\t| \"max_lanes_reached\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type ReleaseLaneResult =\n\t| { code: \"released\"; laneKey: string }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"lane_unlanded_work\"\n\t\t\t| \"lane_owner_conflict\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport interface LandingTransaction {\n\tlaneKey: string;\n\tpriorMainSha: string;\n\ttestedTipSha: string;\n\tchangedPaths: string[];\n\tchangedPathsTruncated: boolean;\n\tlockToken: string;\n\tgate: \"passed\" | \"off\";\n\tstage: \"ready_to_merge\" | \"main_moved\" | \"epoch_written\" | \"audit_logged\";\n}\n\nexport interface ReconcileSummary {\n\tcode: \"reconciled\";\n\torphanedLaneKeys: string[];\n\treRegisteredLaneKeys: string[];\n\townerClearedLaneKeys: string[];\n\tstaleLockReleased: boolean;\n}\n\nexport type ReconcileResult =\n\t| ReconcileSummary\n\t| WorktreeSyncRefusal<\"not_a_git_repo\" | \"default_branch_unresolved\" | \"git_error\">;\n\nexport type SyncLaneResult =\n\t| { code: \"sync_clean\"; laneKey: string; alreadyFresh: boolean; autoContinued: number }\n\t| { code: \"sync_conflicts\"; laneKey: string; worklist: ConflictWorklist }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"lane_dirty\"\n\t\t\t| \"rebase_in_progress\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type ContinueSyncResult =\n\t| { code: \"sync_clean\"; laneKey: string; autoContinued: number }\n\t| { code: \"sync_conflicts\"; laneKey: string; worklist: ConflictWorklist }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"no_rebase_in_progress\"\n\t\t\t| \"conflict_markers_present\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type AbortSyncResult =\n\t| { code: \"ok\"; laneKey: string }\n\t| WorktreeSyncRefusal<\n\t\t\t\"not_a_git_repo\" | \"default_branch_unresolved\" | \"lane_not_found\" | \"no_rebase_in_progress\" | \"git_error\"\n\t >;\n\nexport type LandResult =\n\t| { code: \"ok\"; laneKey: string; epoch: number; mainSha: string; gate: \"passed\" | \"off\" }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"rebase_in_progress\"\n\t\t\t| \"lane_dirty\"\n\t\t\t| \"stale_lane\"\n\t\t\t| \"hub_missing\"\n\t\t\t| \"hub_dirty\"\n\t\t\t| \"gate_command_unset\"\n\t\t\t| \"gate_failed\"\n\t\t\t| \"lane_changed_during_gate\"\n\t\t\t| \"ff_failed\"\n\t\t\t| \"lock_busy\"\n\t\t\t| \"nothing_to_land\"\n\t\t\t| \"lane_owner_conflict\"\n\t\t\t| \"git_error\"\n\t >;\n\n/** One lane's full status entry: live git facts plus registry identity plus policy derivation. */\nexport interface LaneStatusEntry extends LaneFacts {\n\tgoalId?: string;\n\trequirementId?: string;\n\tboundLaneId?: string;\n\t/** Not fresh: main moved past this lane's base. Derived, never stored. */\n\tstale: boolean;\n\t/** Stale AND the active policy makes syncing mandatory NOW (G8 gates on this). */\n\tsyncRequired: boolean;\n\t/** Lane-changed files intersecting the last land's changed files (conservatively the whole\n\t * lane-changed list when the epoch's changedPaths were truncated). */\n\toverlapWithLastLand: string[];\n}\n\n/** The deterministic full picture (`status` action): everything an agent would otherwise infer\n * probabilistically from porcelain output, computed mechanically. */\nexport interface SyncStatus {\n\tcode: \"ok\";\n\tmainBranch: string;\n\tmainSha: string;\n\tepoch: number;\n\thub?: { path: string; clean: boolean };\n\tlock: { held: boolean; holder?: IntegrationLockOwner; holderAlive?: boolean };\n\tlanes: LaneStatusEntry[];\n\t/** One deterministic advisory sentence assembled from the codes above; never model-generated. */\n\tadvice?: string;\n}\n\nexport type SyncStatusResult =\n\t| SyncStatus\n\t| WorktreeSyncRefusal<\"not_a_git_repo\" | \"default_branch_unresolved\" | \"git_error\">;\n"]}
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/core/worktree-sync/codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;gGACgG;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["/**\n * Worktree-sync SSOT for tagged result codes and shared record types.\n *\n * Every worktree-sync operation reports its outcome through one of these string-literal codes in\n * a typed result -- callers branch on `code`, NEVER on message/stderr substrings. Git stderr is\n * carried alongside as evidence for humans, not as a branch condition.\n */\n\n/** Cap on `WorktreeSyncEpoch.changedPaths`; beyond it the list is truncated and overlap checks\n * treat the land as conservatively overlapping EVERYTHING (deterministic, never optimistic). */\nexport const EPOCH_CHANGED_PATHS_CAP = 500;\n\n/** Branch namespace for lane branches: `pi/wt/<laneKey>`. */\nexport const LANE_BRANCH_PREFIX = \"pi/wt/\";\n\nexport type WorktreeSyncCode =\n\t| \"ok\"\n\t| \"disabled\"\n\t| \"not_a_git_repo\"\n\t| \"default_branch_unresolved\"\n\t| \"hub_missing\"\n\t| \"invalid_lane_key\"\n\t| \"lane_exists\"\n\t| \"lane_not_found\"\n\t| \"max_lanes_reached\"\n\t| \"lane_dirty\"\n\t| \"hub_dirty\"\n\t| \"stale_lane\"\n\t| \"sync_required\"\n\t| \"sync_clean\"\n\t| \"sync_conflicts\"\n\t| \"rebase_in_progress\"\n\t| \"no_rebase_in_progress\"\n\t| \"conflict_markers_present\"\n\t| \"gate_command_unset\"\n\t| \"gate_failed\"\n\t| \"lane_changed_during_gate\"\n\t| \"ff_failed\"\n\t| \"lock_busy\"\n\t| \"lock_takeover\"\n\t| \"nothing_to_land\"\n\t| \"main_mutation_refused\"\n\t| \"lane_unlanded_work\"\n\t| \"worktree_missing\"\n\t| \"released\"\n\t| \"reconciled\"\n\t| \"git_error\"\n\t| \"role_forbidden\"\n\t| \"path_outside_lane\"\n\t| \"lane_owner_conflict\";\n\n/**\n * A refusal/failure outcome. `message` is deterministic text assembled from facts (safe to show a\n * model verbatim); `gitStderr` is bounded raw evidence; `paths` names offending files where the\n * refusal is about specific files (dirty files, conflict markers); `holder` identifies the\n * integration-lock holder on `lock_busy`.\n */\nexport interface WorktreeSyncRefusal<C extends WorktreeSyncCode = WorktreeSyncCode> {\n\tcode: C;\n\tmessage: string;\n\tgitStderr?: string;\n\tpaths?: string[];\n\tholder?: IntegrationLockOwner;\n}\n\n/** Staleness-propagation policy (D9). `on_land_mandatory` is the default: every land marks every\n * other active lane sync_required. `overlap_mandatory` requires it only on changed-file overlap.\n * `land_time_only` keeps staleness advisory until the land gate (G3 always enforces). */\nexport type WorktreeSyncPolicy = \"on_land_mandatory\" | \"overlap_mandatory\" | \"land_time_only\";\n\n/** One lane registration record (`lanes/<laneKey>.json`). Identity/binding fields ONLY -- git\n * truths (freshness, dirtiness, ahead/behind) are always re-derived live, never stored here. */\nexport interface LaneRegistration {\n\tlaneKey: string;\n\tbranch: string;\n\tworktreePath: string;\n\tstatus: \"active\" | \"released\" | \"orphaned\";\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tgoalId?: string;\n\trequirementId?: string;\n\t/** Host `LaneRecord.laneId` after dispatch correlation (tmux/in-process worker binding). */\n\tboundLaneId?: string;\n\townerPid?: number;\n\townerSessionId?: string;\n}\n\n/** `epoch.json` -- the integration epoch. `epoch` is monotonic messaging/audit sugar; correctness\n * always derives from git shas (`merge-base --is-ancestor`), never from this counter. */\nexport interface WorktreeSyncEpoch {\n\tepoch: number;\n\tmainSha: string;\n\tpreviousMainSha?: string;\n\tlandedLaneKey?: string;\n\tlandedAt?: string;\n\tchangedPaths: string[];\n\tchangedPathsTruncated: boolean;\n}\n\n/** Live, git-derived facts about one lane. Computed fresh per call -- there is no cached copy to\n * go stale, which is the point. */\nexport interface LaneFacts {\n\tlaneKey: string;\n\tbranch: string;\n\tworktreePath: string;\n\tregistrationStatus: LaneRegistration[\"status\"];\n\t/** Lane branch tip sha; undefined when the branch no longer exists. */\n\tbranchSha?: string;\n\t/** True iff current main is an ancestor of the lane tip (`merge-base --is-ancestor`). */\n\tfresh: boolean;\n\t/** True when `status --porcelain` in the lane worktree is non-empty. */\n\tdirty: boolean;\n\trebaseInProgress: boolean;\n\taheadOfMain: number;\n\tbehindMain: number;\n\tworktreePresent: boolean;\n\t/** Undefined when the lane has no recorded owner pid. */\n\townerAlive?: boolean;\n}\n\nexport interface IntegrationLockOwner {\n\tpid: number;\n\thostname: string;\n\t/** Random acquisition identity; PID/session are diagnostic only and never authorize release. */\n\ttoken: string;\n\tsessionId?: string;\n\tlaneKey?: string;\n\tacquiredAt: string;\n}\n\nexport type IntegrationLockAcquisition =\n\t| { acquired: true; takeover: boolean; token: string }\n\t| { acquired: false; holder?: IntegrationLockOwner; holderAlive: boolean };\n\n/** One conflicted file in a sync stopped on conflicts. */\nexport interface ConflictWorklistFile {\n\tpath: string;\n\t/** Both-modified is the common case; add/add and modify/delete surface as their index states. */\n\tkind: \"both_modified\" | \"both_added\" | \"deleted_by_us\" | \"deleted_by_them\" | \"unknown\";\n\t/** True when git rerere already replayed a recorded resolution for this file -- review, not re-resolve. */\n\tresolvedByRerere: boolean;\n}\n\n/** Structured conflict worklist returned when a sync/continue stops on conflicts. */\nexport interface ConflictWorklist {\n\t/** e.g. \"2/5\" -- rebase progress (stopped step / total steps). */\n\tstep: string;\n\tstoppedAtCommit?: { sha: string; subject: string };\n\tfiles: ConflictWorklistFile[];\n}\n\nexport type BindLaneWorkerResult =\n\t| { code: \"bound\"; laneKey: string; laneId: string }\n\t| { code: \"already_bound\"; laneKey: string; laneId: string }\n\t| { code: \"binding_conflict\"; laneKey: string; boundLaneId: string }\n\t| { code: \"lane_not_found\"; message: string }\n\t| { code: \"lane_not_active\"; message: string }\n\t| { code: \"store_error\"; message: string };\n\nexport type CreateLaneResult =\n\t| { code: \"ok\"; lane: LaneRegistration }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"invalid_lane_key\"\n\t\t\t| \"lane_exists\"\n\t\t\t| \"max_lanes_reached\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type ReleaseLaneResult =\n\t| { code: \"released\"; laneKey: string }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"lane_unlanded_work\"\n\t\t\t| \"lane_owner_conflict\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport interface LandingTransaction {\n\tlaneKey: string;\n\tpriorMainSha: string;\n\ttestedTipSha: string;\n\tchangedPaths: string[];\n\tchangedPathsTruncated: boolean;\n\tlockToken: string;\n\tgate: \"passed\" | \"off\";\n\tstage: \"ready_to_merge\" | \"main_moved\" | \"epoch_written\" | \"audit_logged\";\n}\n\nexport interface ReconcileSummary {\n\tcode: \"reconciled\";\n\torphanedLaneKeys: string[];\n\treRegisteredLaneKeys: string[];\n\townerClearedLaneKeys: string[];\n\tstaleLockReleased: boolean;\n}\n\nexport type ReconcileResult =\n\t| ReconcileSummary\n\t| WorktreeSyncRefusal<\"not_a_git_repo\" | \"default_branch_unresolved\" | \"git_error\">;\n\nexport type SyncLaneResult =\n\t| { code: \"sync_clean\"; laneKey: string; alreadyFresh: boolean; autoContinued: number }\n\t| { code: \"sync_conflicts\"; laneKey: string; worklist: ConflictWorklist }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"lane_dirty\"\n\t\t\t| \"rebase_in_progress\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type ContinueSyncResult =\n\t| { code: \"sync_clean\"; laneKey: string; autoContinued: number }\n\t| { code: \"sync_conflicts\"; laneKey: string; worklist: ConflictWorklist }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"no_rebase_in_progress\"\n\t\t\t| \"conflict_markers_present\"\n\t\t\t| \"git_error\"\n\t >;\n\nexport type AbortSyncResult =\n\t| { code: \"ok\"; laneKey: string }\n\t| WorktreeSyncRefusal<\n\t\t\t\"not_a_git_repo\" | \"default_branch_unresolved\" | \"lane_not_found\" | \"no_rebase_in_progress\" | \"git_error\"\n\t >;\n\nexport type LandResult =\n\t| { code: \"ok\"; laneKey: string; epoch: number; mainSha: string; gate: \"passed\" | \"off\" }\n\t| WorktreeSyncRefusal<\n\t\t\t| \"not_a_git_repo\"\n\t\t\t| \"default_branch_unresolved\"\n\t\t\t| \"lane_not_found\"\n\t\t\t| \"worktree_missing\"\n\t\t\t| \"rebase_in_progress\"\n\t\t\t| \"lane_dirty\"\n\t\t\t| \"stale_lane\"\n\t\t\t| \"hub_missing\"\n\t\t\t| \"hub_dirty\"\n\t\t\t| \"gate_command_unset\"\n\t\t\t| \"gate_failed\"\n\t\t\t| \"lane_changed_during_gate\"\n\t\t\t| \"ff_failed\"\n\t\t\t| \"lock_busy\"\n\t\t\t| \"nothing_to_land\"\n\t\t\t| \"lane_owner_conflict\"\n\t\t\t| \"git_error\"\n\t >;\n\n/** One lane's full status entry: live git facts plus registry identity plus policy derivation. */\nexport interface LaneStatusEntry extends LaneFacts {\n\tgoalId?: string;\n\trequirementId?: string;\n\tboundLaneId?: string;\n\t/** Not fresh: main moved past this lane's base. Derived, never stored. */\n\tstale: boolean;\n\t/** Stale AND the active policy makes syncing mandatory NOW (G8 gates on this). */\n\tsyncRequired: boolean;\n\t/** Lane-changed files intersecting the last land's changed files (conservatively the whole\n\t * lane-changed list when the epoch's changedPaths were truncated). */\n\toverlapWithLastLand: string[];\n}\n\n/** The deterministic full picture (`status` action): everything an agent would otherwise infer\n * probabilistically from porcelain output, computed mechanically. */\nexport interface SyncStatus {\n\tcode: \"ok\";\n\tmainBranch: string;\n\tmainSha: string;\n\tepoch: number;\n\thub?: { path: string; clean: boolean };\n\tlock: { held: boolean; holder?: IntegrationLockOwner; holderAlive?: boolean };\n\tlanes: LaneStatusEntry[];\n\t/** One deterministic advisory sentence assembled from the codes above; never model-generated. */\n\tadvice?: string;\n}\n\nexport type SyncStatusResult =\n\t| SyncStatus\n\t| WorktreeSyncRefusal<\"not_a_git_repo\" | \"default_branch_unresolved\" | \"git_error\">;\n"]}
@@ -4,9 +4,10 @@
4
4
  * write / bash) with {@link WorktreeLaneGate.checkMutation}; a lane that the active policy marks
5
5
  * sync_required fails closed with the exact recovery step until it rebases main.
6
6
  *
7
- * Honesty boundary (unchanged from the tmux trust model): this is HARD for pi children -- the
8
- * wrapper lives under the tool layer, not in the prompt -- and cooperative-only for foreign
9
- * CLIs, whose backstop is the land CAS (G3): stale work simply cannot land.
7
+ * Honesty boundary: edit/write checks are structural for Pi children because the wrapper lives
8
+ * under the tool layer. Bash remains a deliberate host-trust boundary; this gate only rejects
9
+ * integration-sensitive Git forms and never claims to sandbox arbitrary process code. Foreign
10
+ * CLIs stay cooperative-only, with the land CAS (G3) as their backstop.
10
11
  *
11
12
  * Determinism: the gate re-derives from git only when the epoch file actually changed (mtime
12
13
  * fence) or while blocked; verdicts in between are cached. No polling, no timers.
@@ -44,11 +45,6 @@ export interface WorktreeLaneGateConfig {
44
45
  laneKey: string;
45
46
  engineDeps: () => WorktreeSyncEngineDeps;
46
47
  policy: () => WorktreeSyncPolicy;
47
- /** Worker launches use a hard shell envelope: only lane-safe Git/WIP commands and the owner-configured
48
- * exact gate command may pass through bash. Interactive lane sessions retain the legacy cooperative
49
- * command surface while the typed worktree_sync actions are used for hard worker mutations. */
50
- hardShell?: boolean;
51
- trustedGateCommand?: () => string | undefined;
52
48
  }
53
49
  export type LaneMutationCheck = {
54
50
  allowed: true;
@@ -1 +1 @@
1
- {"version":3,"file":"lane-gate.d.ts","sourceRoot":"","sources":["../../../src/core/worktree-sync/lane-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBtG;;;GAGG;AACH,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,cAAc,CAAS;IAE/B,YAAY,MAAM,EAAE,sBAAsB,EAEzC;YAEa,cAAc;IAQ5B,8EAA8E;IAC9E,OAAO,CAAC,YAAY;IAYd,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0F3G;CACD"}
@@ -4,9 +4,10 @@
4
4
  * write / bash) with {@link WorktreeLaneGate.checkMutation}; a lane that the active policy marks
5
5
  * sync_required fails closed with the exact recovery step until it rebases main.
6
6
  *
7
- * Honesty boundary (unchanged from the tmux trust model): this is HARD for pi children -- the
8
- * wrapper lives under the tool layer, not in the prompt -- and cooperative-only for foreign
9
- * CLIs, whose backstop is the land CAS (G3): stale work simply cannot land.
7
+ * Honesty boundary: edit/write checks are structural for Pi children because the wrapper lives
8
+ * under the tool layer. Bash remains a deliberate host-trust boundary; this gate only rejects
9
+ * integration-sensitive Git forms and never claims to sandbox arbitrary process code. Foreign
10
+ * CLIs stay cooperative-only, with the land CAS (G3) as their backstop.
10
11
  *
11
12
  * Determinism: the gate re-derives from git only when the epoch file actually changed (mtime
12
13
  * fence) or while blocked; verdicts in between are cached. No polling, no timers.
@@ -184,24 +185,6 @@ async function changedPaths(deps, cwd, base, ref) {
184
185
  .map((path) => path.trim())
185
186
  .filter(Boolean));
186
187
  }
187
- function hardShellCommandAllowed(command, mainBranch, trustedGateCommand) {
188
- const trimmed = command.trim();
189
- if (trustedGateCommand && trimmed === trustedGateCommand.trim())
190
- return true;
191
- if (!/^git(?:\s|$)/u.test(trimmed))
192
- return false;
193
- const verdict = classifyLaneBashCommand(trimmed, mainBranch);
194
- if (verdict.verdict === "main_mutation_refused")
195
- return false;
196
- const tokens = trimmed.split(/\s+/u);
197
- const subcommand = tokens[1] ?? "";
198
- if (!SYNC_SAFE_GIT_SUBCOMMANDS.has(subcommand) && subcommand !== "commit")
199
- return false;
200
- // Git path operands must not escape the lane checkout. The typed worktree
201
- // actions are the authoritative route for path-sensitive add/diff operations;
202
- // this final check prevents the common absolute/parent escape in the shell floor.
203
- return !tokens.slice(2).some((token) => token.startsWith("/") || token.startsWith("..") || token.includes("/../"));
204
- }
205
188
  /**
206
189
  * The G8 gate object RuntimeBuilder holds per lane-bound session. `checkMutation` is called by
207
190
  * the wrapped edit/write/bash tools before every mutating execution.
@@ -237,24 +220,9 @@ export class WorktreeLaneGate {
237
220
  async checkMutation(toolName, bashCommand, targetPath) {
238
221
  const ctx = await this.resolveContext();
239
222
  // No repo context (deleted repo, engine failure): fail OPEN for plain tools -- the land
240
- // CAS still holds -- but the G10 bash rules below never depend on repo state.
223
+ // CAS still holds -- but the integration-sensitive Git rules below never depend on repo state.
241
224
  const mainBranch = ctx?.mainBranch ?? "main";
242
- if (this.config.hardShell && !ctx) {
243
- return {
244
- allowed: false,
245
- code: "lane_state_unavailable",
246
- message: "worktree-sync: lane state is unavailable; hard worker mutations fail closed",
247
- };
248
- }
249
225
  if (toolName === "bash" && bashCommand !== undefined) {
250
- if (this.config.hardShell &&
251
- !hardShellCommandAllowed(bashCommand, mainBranch, this.config.trustedGateCommand?.())) {
252
- return {
253
- allowed: false,
254
- code: "main_mutation_refused",
255
- message: "worktree-sync: unrestricted bash is unavailable in a hard worker lane; use typed worktree_sync actions",
256
- };
257
- }
258
226
  const verdict = classifyLaneBashCommand(bashCommand, mainBranch);
259
227
  if (verdict.verdict === "main_mutation_refused") {
260
228
  return { allowed: false, code: "main_mutation_refused", message: `worktree-sync: ${verdict.reason}` };
@@ -284,26 +252,12 @@ export class WorktreeLaneGate {
284
252
  const deps = this.config.engineDeps();
285
253
  const lane = await readLane(ctx.paths, this.config.laneKey);
286
254
  if (!lane || lane.status !== "active") {
287
- if (this.config.hardShell) {
288
- return {
289
- allowed: false,
290
- code: "lane_state_unavailable",
291
- message: "worktree-sync: hard worker lane registration is missing or inactive; reconcile before mutating",
292
- };
293
- }
294
255
  this._cachedAllowed = true;
295
256
  return { allowed: true };
296
257
  }
297
258
  // Re-derive main tip: the cached ctx pins the sha from session start.
298
259
  const fresh = await resolveRepoContext(deps);
299
260
  if ("code" in fresh) {
300
- if (this.config.hardShell) {
301
- return {
302
- allowed: false,
303
- code: "lane_state_unavailable",
304
- message: "worktree-sync: Git context is unavailable; hard worker mutation refused",
305
- };
306
- }
307
261
  this._cachedAllowed = true;
308
262
  return { allowed: true };
309
263
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lane-gate.js","sourceRoot":"","sources":["../../../src/core/worktree-sync/lane-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,eAAe,EAAoB,kBAAkB,EAA+B,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACzC,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,WAAW;IACX,UAAU;IACV,OAAO;IACP,MAAM;CACN,CAAC,CAAC;AAEH,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QA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,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnE,CAAC;YACF,CAAC;QACF,CAAC;QACD,IAAI,MAAM,KAAK,gBAAgB;YAAE,YAAY,GAAG,KAAK,CAAC;QAEtD,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,OAAO;YACN,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,eAAe;YACrB,OAAO,EACN,wBAAwB,IAAI,CAAC,MAAM,CAAC,OAAO,8CAA8C;gBACzF,yFAAyF;gBACzF,0FAA0F;SAC3F,CAAC;IACH,CAAC;CACD","sourcesContent":["/**\n * Lane gate: G8/G10 enforcement for a LANE-BOUND `pi` session (launched with\n * `PI_WORKTREE_LANE=<key>`). RuntimeBuilder wraps the session's file-mutation tools (edit /\n * write / bash) with {@link WorktreeLaneGate.checkMutation}; a lane that the active policy marks\n * sync_required fails closed with the exact recovery step until it rebases main.\n *\n * Honesty boundary (unchanged from the tmux trust model): this is HARD for pi children -- the\n * wrapper lives under the tool layer, not in the prompt -- and cooperative-only for foreign\n * CLIs, whose backstop is the land CAS (G3): stale work simply cannot land.\n *\n * Determinism: the gate re-derives from git only when the epoch file actually changed (mtime\n * fence) or while blocked; verdicts in between are cached. No polling, no timers.\n */\n\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, resolve, sep } from \"node:path\";\nimport type { WorktreeSyncPolicy } from \"./codes.ts\";\nimport { deriveLaneFacts, type RepoContext, resolveRepoContext, type WorktreeSyncEngineDeps } from \"./git-engine.ts\";\nimport { readLane } from \"./store.ts\";\n\nexport type LaneBashVerdict =\n\t| { verdict: \"allowed\" }\n\t| { verdict: \"allowed_even_when_sync_required\" }\n\t| { verdict: \"main_mutation_refused\"; reason: string };\n\nconst SYNC_SAFE_GIT_SUBCOMMANDS = new Set([\n\t\"status\",\n\t\"diff\",\n\t\"log\",\n\t\"show\",\n\t\"add\",\n\t\"commit\",\n\t\"stash\",\n\t\"rev-parse\",\n\t\"ls-files\",\n\t\"blame\",\n\t\"grep\",\n]);\n\nconst MAIN_MUTATING_GIT_SUBCOMMANDS = new Set([\"merge\", \"rebase\", \"reset\", \"commit\", \"branch\", \"update-ref\", \"push\"]);\n\n/**\n * Classify one bash command line for a lane-bound session (G10 + the sync_required allowlist).\n * Tokenization is whitespace-naive by design -- deterministic and reviewable; shell-quoting\n * tricks can evade it, which is the documented cooperative boundary (the land CAS cannot be\n * evaded). Command POSITION still matters: `git` only begins an invocation at the start of the\n * command or immediately after a shell separator (`&&`, `||`, `;`, `|`) -- a bare `git` token\n * elsewhere (e.g. as a plain argument to `echo`) is not an invocation. Rules:\n * - `git push` anywhere: refused (main moves only through the land gate; pushing is owner-only).\n * - `git -C <path>` / `--git-dir` combined with a mutating subcommand: refused (escaping the\n * lane worktree to operate on another checkout, e.g. the hub).\n * - `git branch -f/-M/-D <main>` / `git update-ref refs/heads/<main>`: refused.\n * - Everything else: allowed; a read/commit-shaped git subcommand additionally stays allowed\n * while the lane is sync_required (committing WIP is the prescribed step BEFORE syncing).\n */\nexport function classifyLaneBashCommand(command: string, mainBranch: string): LaneBashVerdict {\n\t// This classifier is defense-in-depth, not a shell parser. Refuse compound\n\t// syntax before any segment can return an allow verdict; otherwise `git\n\t// status; git push` is approved by the first safe segment.\n\tif (/[|;&<>$`(){}\\n\\r]/u.test(command)) {\n\t\treturn {\n\t\t\tverdict: \"main_mutation_refused\",\n\t\t\treason: \"compound shell syntax is refused in a lane; use typed worktree_sync actions\",\n\t\t};\n\t}\n\tif (/^\\s*[\"']git[\"']\\s/u.test(command)) {\n\t\treturn {\n\t\t\tverdict: \"main_mutation_refused\",\n\t\t\treason: \"quoted command names are refused in a lane; use the typed Git actions\",\n\t\t};\n\t}\n\tconst segments = [command];\n\tlet allowedWhenSyncRequired = false;\n\tfor (const segment of segments) {\n\t\tconst tokens = segment.trim().split(/\\s+/).filter(Boolean);\n\t\tif (tokens[0] !== \"git\") continue;\n\t\tlet j = 1;\n\t\tlet escapesWorktree = false;\n\t\t// Skip git global options to find the subcommand; -C/--git-dir mark checkout escape.\n\t\twhile (j < tokens.length) {\n\t\t\tconst token = tokens[j] ?? \"\";\n\t\t\tif (token === \"-C\" || token === \"--git-dir\" || token === \"--work-tree\") {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"-C\") && token !== \"-C\") {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"--git-dir=\") || token.startsWith(\"--work-tree=\")) {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"-\")) {\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tconst subcommand = tokens[j] ?? \"\";\n\t\tconst rest = tokens.slice(j + 1);\n\t\tif (subcommand === \"push\") {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason:\n\t\t\t\t\t\"git push is refused in a lane session; landing is the only integration path and pushing stays an owner action\",\n\t\t\t};\n\t\t}\n\t\tif (escapesWorktree && MAIN_MUTATING_GIT_SUBCOMMANDS.has(subcommand)) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git -C/--git-dir with '${subcommand}' escapes the lane worktree; operate only on this lane (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (\n\t\t\tsubcommand === \"branch\" &&\n\t\t\trest.some((token) => /^(?:-f|--force|-M|-m|-D|-d)$/.test(token)) &&\n\t\t\trest.includes(mainBranch)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git branch may not move/delete '${mainBranch}' from a lane; main moves only through the land gate (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (subcommand === \"update-ref\" && rest.some((token) => token === `refs/heads/${mainBranch}`)) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git update-ref may not touch refs/heads/${mainBranch} from a lane (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (SYNC_SAFE_GIT_SUBCOMMANDS.has(subcommand)) allowedWhenSyncRequired = true;\n\t}\n\treturn allowedWhenSyncRequired ? { verdict: \"allowed_even_when_sync_required\" } : { verdict: \"allowed\" };\n}\n\n/** Symlink-safe resolution of a path that may not exist yet: realpath the NEAREST EXISTING\n * ancestor, then re-append the not-yet-existing tail literally (a not-yet-created file's own\n * missing final component can never itself be a symlink escape). */\nfunction resolveSymlinkSafe(targetPath: string): string {\n\tif (existsSync(targetPath)) {\n\t\ttry {\n\t\t\treturn realpathSync(targetPath);\n\t\t} catch {\n\t\t\treturn targetPath;\n\t\t}\n\t}\n\tconst tail: string[] = [basename(targetPath)];\n\tlet ancestor = dirname(targetPath);\n\twhile (!existsSync(ancestor)) {\n\t\tconst parent = dirname(ancestor);\n\t\tif (parent === ancestor) break; // reached the filesystem root without finding one\n\t\ttail.unshift(basename(ancestor));\n\t\tancestor = parent;\n\t}\n\tlet realAncestor: string;\n\ttry {\n\t\trealAncestor = realpathSync(ancestor);\n\t} catch {\n\t\trealAncestor = ancestor;\n\t}\n\treturn join(realAncestor, ...tail);\n}\n\n/** Symlink-safe containment check (G-path): does `targetPath` resolve inside `worktreePath`? */\nexport function isPathOutsideLane(targetPath: string, worktreePath: string): boolean {\n\tlet realRoot: string;\n\ttry {\n\t\trealRoot = realpathSync(worktreePath);\n\t} catch {\n\t\trealRoot = worktreePath;\n\t}\n\tconst resolvedTarget = resolveSymlinkSafe(targetPath);\n\treturn resolvedTarget !== realRoot && !resolvedTarget.startsWith(realRoot + sep);\n}\n\n/** Resolve a user-supplied relative lane path and reject symlink/parent escapes. */\nexport function resolveLaneMutationPath(worktreePath: string, candidate: string): string | undefined {\n\tconst target = resolve(worktreePath, candidate);\n\treturn isPathOutsideLane(target, worktreePath) ? undefined : target;\n}\n\nexport interface WorktreeLaneGateConfig {\n\tlaneKey: string;\n\tengineDeps: () => WorktreeSyncEngineDeps;\n\tpolicy: () => WorktreeSyncPolicy;\n\t/** Worker launches use a hard shell envelope: only lane-safe Git/WIP commands and the owner-configured\n\t * exact gate command may pass through bash. Interactive lane sessions retain the legacy cooperative\n\t * command surface while the typed worktree_sync actions are used for hard worker mutations. */\n\thardShell?: boolean;\n\ttrustedGateCommand?: () => string | undefined;\n}\n\nexport type LaneMutationCheck = { allowed: true } | { allowed: false; code: string; message: string };\n\nasync function changedPaths(\n\tdeps: WorktreeSyncEngineDeps,\n\tcwd: string,\n\tbase: string,\n\tref: string,\n): Promise<Set<string> | undefined> {\n\tconst result = await deps.exec(\"git\", [\"diff\", \"--name-only\", `${base}..${ref}`, \"--\"], {\n\t\tcwd,\n\t\ttimeout: 60_000,\n\t\tmaxBuffer: 1024 * 1024,\n\t});\n\tif (result.code !== 0) return undefined;\n\treturn new Set(\n\t\tresult.stdout\n\t\t\t.split(/\\r?\\n/u)\n\t\t\t.map((path) => path.trim())\n\t\t\t.filter(Boolean),\n\t);\n}\n\nfunction hardShellCommandAllowed(command: string, mainBranch: string, trustedGateCommand?: string): boolean {\n\tconst trimmed = command.trim();\n\tif (trustedGateCommand && trimmed === trustedGateCommand.trim()) return true;\n\tif (!/^git(?:\\s|$)/u.test(trimmed)) return false;\n\tconst verdict = classifyLaneBashCommand(trimmed, mainBranch);\n\tif (verdict.verdict === \"main_mutation_refused\") return false;\n\tconst tokens = trimmed.split(/\\s+/u);\n\tconst subcommand = tokens[1] ?? \"\";\n\tif (!SYNC_SAFE_GIT_SUBCOMMANDS.has(subcommand) && subcommand !== \"commit\") return false;\n\t// Git path operands must not escape the lane checkout. The typed worktree\n\t// actions are the authoritative route for path-sensitive add/diff operations;\n\t// this final check prevents the common absolute/parent escape in the shell floor.\n\treturn !tokens.slice(2).some((token) => token.startsWith(\"/\") || token.startsWith(\"..\") || token.includes(\"/../\"));\n}\n\n/**\n * The G8 gate object RuntimeBuilder holds per lane-bound session. `checkMutation` is called by\n * the wrapped edit/write/bash tools before every mutating execution.\n */\nexport class WorktreeLaneGate {\n\tprivate readonly config: WorktreeLaneGateConfig;\n\tprivate _ctx: RepoContext | undefined;\n\tprivate _epochFileMtimeMs: number | undefined;\n\tprivate _cachedAllowed = false;\n\n\tconstructor(config: WorktreeLaneGateConfig) {\n\t\tthis.config = config;\n\t}\n\n\tprivate async resolveContext(): Promise<RepoContext | undefined> {\n\t\tif (this._ctx) return this._ctx;\n\t\tconst ctx = await resolveRepoContext(this.config.engineDeps());\n\t\tif (\"code\" in ctx) return undefined;\n\t\tthis._ctx = ctx;\n\t\treturn ctx;\n\t}\n\n\t/** Cheap fence: has the epoch file changed since the last allowed verdict? */\n\tprivate epochChanged(ctx: RepoContext): boolean {\n\t\tlet mtimeMs: number | undefined;\n\t\ttry {\n\t\t\tmtimeMs = statSync(ctx.paths.epochFile).mtimeMs;\n\t\t} catch {\n\t\t\tmtimeMs = undefined;\n\t\t}\n\t\tif (mtimeMs === this._epochFileMtimeMs) return false;\n\t\tthis._epochFileMtimeMs = mtimeMs;\n\t\treturn true;\n\t}\n\n\tasync checkMutation(toolName: string, bashCommand?: string, targetPath?: string): Promise<LaneMutationCheck> {\n\t\tconst ctx = await this.resolveContext();\n\t\t// No repo context (deleted repo, engine failure): fail OPEN for plain tools -- the land\n\t\t// CAS still holds -- but the G10 bash rules below never depend on repo state.\n\t\tconst mainBranch = ctx?.mainBranch ?? \"main\";\n\t\tif (this.config.hardShell && !ctx) {\n\t\t\treturn {\n\t\t\t\tallowed: false,\n\t\t\t\tcode: \"lane_state_unavailable\",\n\t\t\t\tmessage: \"worktree-sync: lane state is unavailable; hard worker mutations fail closed\",\n\t\t\t};\n\t\t}\n\n\t\tif (toolName === \"bash\" && bashCommand !== undefined) {\n\t\t\tif (\n\t\t\t\tthis.config.hardShell &&\n\t\t\t\t!hardShellCommandAllowed(bashCommand, mainBranch, this.config.trustedGateCommand?.())\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\tallowed: false,\n\t\t\t\t\tcode: \"main_mutation_refused\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"worktree-sync: unrestricted bash is unavailable in a hard worker lane; use typed worktree_sync actions\",\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst verdict = classifyLaneBashCommand(bashCommand, mainBranch);\n\t\t\tif (verdict.verdict === \"main_mutation_refused\") {\n\t\t\t\treturn { allowed: false, code: \"main_mutation_refused\", message: `worktree-sync: ${verdict.reason}` };\n\t\t\t}\n\t\t\tif (verdict.verdict === \"allowed_even_when_sync_required\") return { allowed: true };\n\t\t}\n\t\tif (!ctx) return { allowed: true };\n\n\t\t// G-path: an edit/write target must resolve INSIDE this lane's worktree (symlink-safe),\n\t\t// checked BEFORE the staleness cache so a cached \"allowed\" verdict never short-circuits past\n\t\t// it. No active lane record: existing fail-open stands (mirrors the readLane check below).\n\t\tif ((toolName === \"edit\" || toolName === \"write\") && targetPath !== undefined) {\n\t\t\tconst laneForPath = await readLane(ctx.paths, this.config.laneKey);\n\t\t\tif (laneForPath?.status === \"active\" && isPathOutsideLane(targetPath, laneForPath.worktreePath)) {\n\t\t\t\treturn {\n\t\t\t\t\tallowed: false,\n\t\t\t\t\tcode: \"path_outside_lane\",\n\t\t\t\t\tmessage: `worktree-sync: '${targetPath}' resolves outside lane '${this.config.laneKey}' worktree (${laneForPath.worktreePath}); edit/write only inside your lane checkout`,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// G8: sync_required fails mutations closed. Re-derive only when the epoch moved or while\n\t\t// blocked (a successful sync clears the block on the very next check).\n\t\tif (this._cachedAllowed && !this.epochChanged(ctx)) return { allowed: true };\n\n\t\tconst deps = this.config.engineDeps();\n\t\tconst lane = await readLane(ctx.paths, this.config.laneKey);\n\t\tif (!lane || lane.status !== \"active\") {\n\t\t\tif (this.config.hardShell) {\n\t\t\t\treturn {\n\t\t\t\t\tallowed: false,\n\t\t\t\t\tcode: \"lane_state_unavailable\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"worktree-sync: hard worker lane registration is missing or inactive; reconcile before mutating\",\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\t// Re-derive main tip: the cached ctx pins the sha from session start.\n\t\tconst fresh = await resolveRepoContext(deps);\n\t\tif (\"code\" in fresh) {\n\t\t\tif (this.config.hardShell) {\n\t\t\t\treturn {\n\t\t\t\t\tallowed: false,\n\t\t\t\t\tcode: \"lane_state_unavailable\",\n\t\t\t\t\tmessage: \"worktree-sync: Git context is unavailable; hard worker mutation refused\",\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\tthis._ctx = fresh;\n\t\tconst facts = await deriveLaneFacts(deps, fresh, lane);\n\t\tif (facts.fresh) {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\n\t\tconst policy = this.config.policy();\n\t\tlet syncRequired = policy === \"on_land_mandatory\";\n\t\tif (policy === \"overlap_mandatory\") {\n\t\t\t// Epoch files are notification/diagnostic state only. Derive both sides from the\n\t\t\t// current merge base so an overlap from land N remains enforced after unrelated land N+1.\n\t\t\tconst mergeBase = await deps.exec(\"git\", [\"merge-base\", fresh.mainBranch, lane.branch], {\n\t\t\t\tcwd: fresh.topLevel,\n\t\t\t\ttimeout: 60_000,\n\t\t\t\tmaxBuffer: 1024 * 1024,\n\t\t\t});\n\t\t\tif (mergeBase.code !== 0 || !mergeBase.stdout.trim()) {\n\t\t\t\tsyncRequired = true;\n\t\t\t} else {\n\t\t\t\tconst base = mergeBase.stdout.trim().split(/\\s+/u)[0];\n\t\t\t\tconst lanePaths = await changedPaths(deps, fresh.topLevel, base, lane.branch);\n\t\t\t\tconst mainPaths = await changedPaths(deps, fresh.topLevel, base, fresh.mainBranch);\n\t\t\t\tif (!lanePaths || !mainPaths) {\n\t\t\t\t\tsyncRequired = true;\n\t\t\t\t} else {\n\t\t\t\t\tsyncRequired = [...lanePaths].some((path) => mainPaths.has(path));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (policy === \"land_time_only\") syncRequired = false;\n\n\t\tif (!syncRequired) {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\tthis._cachedAllowed = false;\n\t\treturn {\n\t\t\tallowed: false,\n\t\t\tcode: \"sync_required\",\n\t\t\tmessage:\n\t\t\t\t`worktree-sync: lane '${this.config.laneKey}' must rebase main before further mutations ` +\n\t\t\t\t`(main moved past this lane). Commit any WIP (git add/commit stay available), then call ` +\n\t\t\t\t`worktree_sync {\"action\":\"sync\"}, resolve conflicts if any, and continue. (sync_required)`,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"lane-gate.js","sourceRoot":"","sources":["../../../src/core/worktree-sync/lane-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,eAAe,EAAoB,kBAAkB,EAA+B,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACzC,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,WAAW;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AAO,EACN,wBAAwB,IAAI,CAAC,MAAM,CAAC,OAAO,8CAA8C;gBACzF,yFAAyF;gBACzF,0FAA0F;SAC3F,CAAC;IACH,CAAC;CACD","sourcesContent":["/**\n * Lane gate: G8/G10 enforcement for a LANE-BOUND `pi` session (launched with\n * `PI_WORKTREE_LANE=<key>`). RuntimeBuilder wraps the session's file-mutation tools (edit /\n * write / bash) with {@link WorktreeLaneGate.checkMutation}; a lane that the active policy marks\n * sync_required fails closed with the exact recovery step until it rebases main.\n *\n * Honesty boundary: edit/write checks are structural for Pi children because the wrapper lives\n * under the tool layer. Bash remains a deliberate host-trust boundary; this gate only rejects\n * integration-sensitive Git forms and never claims to sandbox arbitrary process code. Foreign\n * CLIs stay cooperative-only, with the land CAS (G3) as their backstop.\n *\n * Determinism: the gate re-derives from git only when the epoch file actually changed (mtime\n * fence) or while blocked; verdicts in between are cached. No polling, no timers.\n */\n\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, resolve, sep } from \"node:path\";\nimport type { WorktreeSyncPolicy } from \"./codes.ts\";\nimport { deriveLaneFacts, type RepoContext, resolveRepoContext, type WorktreeSyncEngineDeps } from \"./git-engine.ts\";\nimport { readLane } from \"./store.ts\";\n\nexport type LaneBashVerdict =\n\t| { verdict: \"allowed\" }\n\t| { verdict: \"allowed_even_when_sync_required\" }\n\t| { verdict: \"main_mutation_refused\"; reason: string };\n\nconst SYNC_SAFE_GIT_SUBCOMMANDS = new Set([\n\t\"status\",\n\t\"diff\",\n\t\"log\",\n\t\"show\",\n\t\"add\",\n\t\"commit\",\n\t\"stash\",\n\t\"rev-parse\",\n\t\"ls-files\",\n\t\"blame\",\n\t\"grep\",\n]);\n\nconst MAIN_MUTATING_GIT_SUBCOMMANDS = new Set([\"merge\", \"rebase\", \"reset\", \"commit\", \"branch\", \"update-ref\", \"push\"]);\n\n/**\n * Classify one bash command line for a lane-bound session (G10 + the sync_required allowlist).\n * Tokenization is whitespace-naive by design -- deterministic and reviewable; shell-quoting\n * tricks can evade it, which is the documented cooperative boundary (the land CAS cannot be\n * evaded). Command POSITION still matters: `git` only begins an invocation at the start of the\n * command or immediately after a shell separator (`&&`, `||`, `;`, `|`) -- a bare `git` token\n * elsewhere (e.g. as a plain argument to `echo`) is not an invocation. Rules:\n * - `git push` anywhere: refused (main moves only through the land gate; pushing is owner-only).\n * - `git -C <path>` / `--git-dir` combined with a mutating subcommand: refused (escaping the\n * lane worktree to operate on another checkout, e.g. the hub).\n * - `git branch -f/-M/-D <main>` / `git update-ref refs/heads/<main>`: refused.\n * - Everything else: allowed; a read/commit-shaped git subcommand additionally stays allowed\n * while the lane is sync_required (committing WIP is the prescribed step BEFORE syncing).\n */\nexport function classifyLaneBashCommand(command: string, mainBranch: string): LaneBashVerdict {\n\t// This classifier is defense-in-depth, not a shell parser. Refuse compound\n\t// syntax before any segment can return an allow verdict; otherwise `git\n\t// status; git push` is approved by the first safe segment.\n\tif (/[|;&<>$`(){}\\n\\r]/u.test(command)) {\n\t\treturn {\n\t\t\tverdict: \"main_mutation_refused\",\n\t\t\treason: \"compound shell syntax is refused in a lane; use typed worktree_sync actions\",\n\t\t};\n\t}\n\tif (/^\\s*[\"']git[\"']\\s/u.test(command)) {\n\t\treturn {\n\t\t\tverdict: \"main_mutation_refused\",\n\t\t\treason: \"quoted command names are refused in a lane; use the typed Git actions\",\n\t\t};\n\t}\n\tconst segments = [command];\n\tlet allowedWhenSyncRequired = false;\n\tfor (const segment of segments) {\n\t\tconst tokens = segment.trim().split(/\\s+/).filter(Boolean);\n\t\tif (tokens[0] !== \"git\") continue;\n\t\tlet j = 1;\n\t\tlet escapesWorktree = false;\n\t\t// Skip git global options to find the subcommand; -C/--git-dir mark checkout escape.\n\t\twhile (j < tokens.length) {\n\t\t\tconst token = tokens[j] ?? \"\";\n\t\t\tif (token === \"-C\" || token === \"--git-dir\" || token === \"--work-tree\") {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"-C\") && token !== \"-C\") {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"--git-dir=\") || token.startsWith(\"--work-tree=\")) {\n\t\t\t\tescapesWorktree = true;\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (token.startsWith(\"-\")) {\n\t\t\t\tj += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tconst subcommand = tokens[j] ?? \"\";\n\t\tconst rest = tokens.slice(j + 1);\n\t\tif (subcommand === \"push\") {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason:\n\t\t\t\t\t\"git push is refused in a lane session; landing is the only integration path and pushing stays an owner action\",\n\t\t\t};\n\t\t}\n\t\tif (escapesWorktree && MAIN_MUTATING_GIT_SUBCOMMANDS.has(subcommand)) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git -C/--git-dir with '${subcommand}' escapes the lane worktree; operate only on this lane (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (\n\t\t\tsubcommand === \"branch\" &&\n\t\t\trest.some((token) => /^(?:-f|--force|-M|-m|-D|-d)$/.test(token)) &&\n\t\t\trest.includes(mainBranch)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git branch may not move/delete '${mainBranch}' from a lane; main moves only through the land gate (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (subcommand === \"update-ref\" && rest.some((token) => token === `refs/heads/${mainBranch}`)) {\n\t\t\treturn {\n\t\t\t\tverdict: \"main_mutation_refused\",\n\t\t\t\treason: `git update-ref may not touch refs/heads/${mainBranch} from a lane (G10)`,\n\t\t\t};\n\t\t}\n\t\tif (SYNC_SAFE_GIT_SUBCOMMANDS.has(subcommand)) allowedWhenSyncRequired = true;\n\t}\n\treturn allowedWhenSyncRequired ? { verdict: \"allowed_even_when_sync_required\" } : { verdict: \"allowed\" };\n}\n\n/** Symlink-safe resolution of a path that may not exist yet: realpath the NEAREST EXISTING\n * ancestor, then re-append the not-yet-existing tail literally (a not-yet-created file's own\n * missing final component can never itself be a symlink escape). */\nfunction resolveSymlinkSafe(targetPath: string): string {\n\tif (existsSync(targetPath)) {\n\t\ttry {\n\t\t\treturn realpathSync(targetPath);\n\t\t} catch {\n\t\t\treturn targetPath;\n\t\t}\n\t}\n\tconst tail: string[] = [basename(targetPath)];\n\tlet ancestor = dirname(targetPath);\n\twhile (!existsSync(ancestor)) {\n\t\tconst parent = dirname(ancestor);\n\t\tif (parent === ancestor) break; // reached the filesystem root without finding one\n\t\ttail.unshift(basename(ancestor));\n\t\tancestor = parent;\n\t}\n\tlet realAncestor: string;\n\ttry {\n\t\trealAncestor = realpathSync(ancestor);\n\t} catch {\n\t\trealAncestor = ancestor;\n\t}\n\treturn join(realAncestor, ...tail);\n}\n\n/** Symlink-safe containment check (G-path): does `targetPath` resolve inside `worktreePath`? */\nexport function isPathOutsideLane(targetPath: string, worktreePath: string): boolean {\n\tlet realRoot: string;\n\ttry {\n\t\trealRoot = realpathSync(worktreePath);\n\t} catch {\n\t\trealRoot = worktreePath;\n\t}\n\tconst resolvedTarget = resolveSymlinkSafe(targetPath);\n\treturn resolvedTarget !== realRoot && !resolvedTarget.startsWith(realRoot + sep);\n}\n\n/** Resolve a user-supplied relative lane path and reject symlink/parent escapes. */\nexport function resolveLaneMutationPath(worktreePath: string, candidate: string): string | undefined {\n\tconst target = resolve(worktreePath, candidate);\n\treturn isPathOutsideLane(target, worktreePath) ? undefined : target;\n}\n\nexport interface WorktreeLaneGateConfig {\n\tlaneKey: string;\n\tengineDeps: () => WorktreeSyncEngineDeps;\n\tpolicy: () => WorktreeSyncPolicy;\n}\n\nexport type LaneMutationCheck = { allowed: true } | { allowed: false; code: string; message: string };\n\nasync function changedPaths(\n\tdeps: WorktreeSyncEngineDeps,\n\tcwd: string,\n\tbase: string,\n\tref: string,\n): Promise<Set<string> | undefined> {\n\tconst result = await deps.exec(\"git\", [\"diff\", \"--name-only\", `${base}..${ref}`, \"--\"], {\n\t\tcwd,\n\t\ttimeout: 60_000,\n\t\tmaxBuffer: 1024 * 1024,\n\t});\n\tif (result.code !== 0) return undefined;\n\treturn new Set(\n\t\tresult.stdout\n\t\t\t.split(/\\r?\\n/u)\n\t\t\t.map((path) => path.trim())\n\t\t\t.filter(Boolean),\n\t);\n}\n\n/**\n * The G8 gate object RuntimeBuilder holds per lane-bound session. `checkMutation` is called by\n * the wrapped edit/write/bash tools before every mutating execution.\n */\nexport class WorktreeLaneGate {\n\tprivate readonly config: WorktreeLaneGateConfig;\n\tprivate _ctx: RepoContext | undefined;\n\tprivate _epochFileMtimeMs: number | undefined;\n\tprivate _cachedAllowed = false;\n\n\tconstructor(config: WorktreeLaneGateConfig) {\n\t\tthis.config = config;\n\t}\n\n\tprivate async resolveContext(): Promise<RepoContext | undefined> {\n\t\tif (this._ctx) return this._ctx;\n\t\tconst ctx = await resolveRepoContext(this.config.engineDeps());\n\t\tif (\"code\" in ctx) return undefined;\n\t\tthis._ctx = ctx;\n\t\treturn ctx;\n\t}\n\n\t/** Cheap fence: has the epoch file changed since the last allowed verdict? */\n\tprivate epochChanged(ctx: RepoContext): boolean {\n\t\tlet mtimeMs: number | undefined;\n\t\ttry {\n\t\t\tmtimeMs = statSync(ctx.paths.epochFile).mtimeMs;\n\t\t} catch {\n\t\t\tmtimeMs = undefined;\n\t\t}\n\t\tif (mtimeMs === this._epochFileMtimeMs) return false;\n\t\tthis._epochFileMtimeMs = mtimeMs;\n\t\treturn true;\n\t}\n\n\tasync checkMutation(toolName: string, bashCommand?: string, targetPath?: string): Promise<LaneMutationCheck> {\n\t\tconst ctx = await this.resolveContext();\n\t\t// No repo context (deleted repo, engine failure): fail OPEN for plain tools -- the land\n\t\t// CAS still holds -- but the integration-sensitive Git rules below never depend on repo state.\n\t\tconst mainBranch = ctx?.mainBranch ?? \"main\";\n\n\t\tif (toolName === \"bash\" && bashCommand !== undefined) {\n\t\t\tconst verdict = classifyLaneBashCommand(bashCommand, mainBranch);\n\t\t\tif (verdict.verdict === \"main_mutation_refused\") {\n\t\t\t\treturn { allowed: false, code: \"main_mutation_refused\", message: `worktree-sync: ${verdict.reason}` };\n\t\t\t}\n\t\t\tif (verdict.verdict === \"allowed_even_when_sync_required\") return { allowed: true };\n\t\t}\n\t\tif (!ctx) return { allowed: true };\n\n\t\t// G-path: an edit/write target must resolve INSIDE this lane's worktree (symlink-safe),\n\t\t// checked BEFORE the staleness cache so a cached \"allowed\" verdict never short-circuits past\n\t\t// it. No active lane record: existing fail-open stands (mirrors the readLane check below).\n\t\tif ((toolName === \"edit\" || toolName === \"write\") && targetPath !== undefined) {\n\t\t\tconst laneForPath = await readLane(ctx.paths, this.config.laneKey);\n\t\t\tif (laneForPath?.status === \"active\" && isPathOutsideLane(targetPath, laneForPath.worktreePath)) {\n\t\t\t\treturn {\n\t\t\t\t\tallowed: false,\n\t\t\t\t\tcode: \"path_outside_lane\",\n\t\t\t\t\tmessage: `worktree-sync: '${targetPath}' resolves outside lane '${this.config.laneKey}' worktree (${laneForPath.worktreePath}); edit/write only inside your lane checkout`,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// G8: sync_required fails mutations closed. Re-derive only when the epoch moved or while\n\t\t// blocked (a successful sync clears the block on the very next check).\n\t\tif (this._cachedAllowed && !this.epochChanged(ctx)) return { allowed: true };\n\n\t\tconst deps = this.config.engineDeps();\n\t\tconst lane = await readLane(ctx.paths, this.config.laneKey);\n\t\tif (!lane || lane.status !== \"active\") {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\t// Re-derive main tip: the cached ctx pins the sha from session start.\n\t\tconst fresh = await resolveRepoContext(deps);\n\t\tif (\"code\" in fresh) {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\tthis._ctx = fresh;\n\t\tconst facts = await deriveLaneFacts(deps, fresh, lane);\n\t\tif (facts.fresh) {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\n\t\tconst policy = this.config.policy();\n\t\tlet syncRequired = policy === \"on_land_mandatory\";\n\t\tif (policy === \"overlap_mandatory\") {\n\t\t\t// Epoch files are notification/diagnostic state only. Derive both sides from the\n\t\t\t// current merge base so an overlap from land N remains enforced after unrelated land N+1.\n\t\t\tconst mergeBase = await deps.exec(\"git\", [\"merge-base\", fresh.mainBranch, lane.branch], {\n\t\t\t\tcwd: fresh.topLevel,\n\t\t\t\ttimeout: 60_000,\n\t\t\t\tmaxBuffer: 1024 * 1024,\n\t\t\t});\n\t\t\tif (mergeBase.code !== 0 || !mergeBase.stdout.trim()) {\n\t\t\t\tsyncRequired = true;\n\t\t\t} else {\n\t\t\t\tconst base = mergeBase.stdout.trim().split(/\\s+/u)[0];\n\t\t\t\tconst lanePaths = await changedPaths(deps, fresh.topLevel, base, lane.branch);\n\t\t\t\tconst mainPaths = await changedPaths(deps, fresh.topLevel, base, fresh.mainBranch);\n\t\t\t\tif (!lanePaths || !mainPaths) {\n\t\t\t\t\tsyncRequired = true;\n\t\t\t\t} else {\n\t\t\t\t\tsyncRequired = [...lanePaths].some((path) => mainPaths.has(path));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (policy === \"land_time_only\") syncRequired = false;\n\n\t\tif (!syncRequired) {\n\t\t\tthis._cachedAllowed = true;\n\t\t\treturn { allowed: true };\n\t\t}\n\t\tthis._cachedAllowed = false;\n\t\treturn {\n\t\t\tallowed: false,\n\t\t\tcode: \"sync_required\",\n\t\t\tmessage:\n\t\t\t\t`worktree-sync: lane '${this.config.laneKey}' must rebase main before further mutations ` +\n\t\t\t\t`(main moved past this lane). Commit any WIP (git add/commit stay available), then call ` +\n\t\t\t\t`worktree_sync {\"action\":\"sync\"}, resolve conflicts if any, and continue. (sync_required)`,\n\t\t};\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export { type Args, parseArgs } from "./cli/args.ts";
4
4
  export { getAgentDir, VERSION } from "./config.ts";
5
5
  export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
6
6
  export { type ApiKeyCredential, type AuthCredential, type AuthStatus, AuthStorage, type AuthStorageBackend, FileAuthStorageBackend, InMemoryAuthStorageBackend, type OAuthCredential, } from "./core/auth-storage.ts";
7
+ export { encodeWorkerSessionAllowedPaths, PI_WORKER_ALLOWED_PATHS_ENV, } from "./core/autonomy/worker-session-private-scope.ts";
8
+ export { mapToolNamesForPlatform } from "./core/default-tool-surface.ts";
7
9
  export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
8
10
  export type { AgentEndEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextEventResult, ContextUsage, CustomToolCallEvent, EditToolCallEvent, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionStorage, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, ExtensionWorkRunOptions, FindToolCallEvent, GrepToolCallEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
9
11
  export { defineTool, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
@@ -19,6 +21,7 @@ export * from "./core/orchestration/policy-compiler.ts";
19
21
  export * from "./core/orchestration/profile-registry.ts";
20
22
  export * from "./core/orchestration/profile-store.ts";
21
23
  export * from "./core/orchestration/task-runtime.ts";
24
+ export { orchestrationThinkingLevelSchema } from "./core/orchestration/thinking-level-schema.ts";
22
25
  export type { PackageManager, PathMetadata, ProgressCallback, ProgressEvent, ResolvedPaths, ResolvedResource, } from "./core/package-manager.ts";
23
26
  export { DefaultPackageManager } from "./core/package-manager.ts";
24
27
  export { PI_ORCHESTRATION_AGENT_ID_ENV } from "./core/process-identity.ts";
@@ -33,10 +36,12 @@ export { type BitwardenSecretsManagerCommandRequest, type BitwardenSecretsManage
33
36
  export { type CredentialActivationResult, type CredentialConnectionStatus, CredentialManager, CredentialManagerError, type CredentialManagerErrorCode, type CredentialManagerOptions, type CredentialMutationResult, type CredentialProfileRecord, type CredentialProfileStorage, type CredentialProfileSummary, type CredentialProjectIdentity, type CredentialProjectResolver, CredentialStorageError, type CredentialStorageErrorCode, type CredentialStorageProvider, type CredentialVariable, type MachineCredentialSession, type MachineCredentialSessionResolver, type StoredCredentialProfileSummary, } from "./core/secrets/credential-manager.ts";
34
37
  export { type CredentialMigrationSource, CredentialMigrationSourceError, type CredentialMigrationSourceErrorCode, type CredentialMigrationSourceResolver, resolveCredentialMigrationSources, } from "./core/secrets/credential-migration-source.ts";
35
38
  export { createPortableGitProjectKey, resolveCredentialProject } from "./core/secrets/credential-project.ts";
39
+ export { WORKER_FORBIDDEN_TOOLS } from "./core/session-role.ts";
36
40
  export { type CompactionSettings, type DirectoryResourceProfileInfo, getDirectoryResourceProfileInfo, type ImageSettings, matchesResourceProfilePattern, type PackageSource, type ResourceProfileFilterSettings, type ResourceProfileKind, type ResourceProfileSettings, type RetrySettings, SettingsManager, type SettingsManagerCreateOptions, } from "./core/settings-manager.ts";
37
41
  export { DEFAULT_SKILL_IDLE_TIMEOUT_MS, MAX_ACTIVE_SKILL_BODY_BYTES, MAX_LOADED_SKILLS, MAX_PINNED_SKILLS, MIN_ACTIVE_SKILL_BODY_BYTES, resolveActiveSkillBodyByteLimit, type SkillLoadResult, type SkillSearchResult, type SkillSlotStatus, SkillVaultController, type SkillVaultControllerOptions, type SkillVaultStatus, } from "./core/skill-vault.ts";
38
42
  export { type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, MAX_SKILL_FRONTMATTER_BYTES, readSkillFrontmatterFile, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
39
43
  export { createSyntheticSourceInfo } from "./core/source-info.ts";
44
+ export { POLICY_OWNED_RUNTIME_TOOL_NAMES } from "./core/tool-capability-policy.ts";
40
45
  export { type AskQuestion, type AskQuestionAnswer, AskQuestionDialog, type AskQuestionStopReason, type AskQuestionToolDetails, type AskQuestionToolInput, type AskQuestionToolOptions, createAskQuestionToolDefinition, } from "./core/tools/ask-question.ts";
41
46
  export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFileFailureRecoveryAuthority, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createSecretStoreToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FileContentReference, type FileFailureRecoveryAuthority, FileMutationIntentController, type FileMutationIntentControllerOptions, type FileMutationIntentOperations, type FileMutationKind, type FileMutationLease, type FileMutationPayloadReference, FileMutationPreflightError, type FileMutationPreflightFailureReason, type FilePathIdentity, type FilePathInspection, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatMiddleOmissionMarker, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type SecretStoreStatus, type SecretStoreToolDetails, type SecretStoreToolInput, type SecretStoreToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateKnownHeadTail, truncateLine, truncateMiddle, truncateTail, type WriteOperations, type WriteToolDetails, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
42
47
  export { createSkillVaultToolDefinition, type SkillToolDetails, type SkillToolInput, } from "./core/tools/skill.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2B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,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,YAAY,GACjB,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EACd,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,mBAAmB,EACxB,qBAAqB,EACrB,aAAa,EACb,KAAK,wBAAwB,GAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yB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BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,KAAK,qBAAqB,EAC1B,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,YAAY,GACjB,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -8,6 +8,10 @@ export { getAgentDir, VERSION } from "./config.js";
8
8
  export { AgentSession, parseSkillBlock, } from "./core/agent-session.js";
9
9
  // Auth and model registry
10
10
  export { AuthStorage, FileAuthStorageBackend, InMemoryAuthStorageBackend, } from "./core/auth-storage.js";
11
+ // Copied bundled extensions resolve runtime dependencies through this public module. Bun embeds
12
+ // this surface; relative imports back into dist/core do not exist beside a compiled executable.
13
+ export { encodeWorkerSessionAllowedPaths, PI_WORKER_ALLOWED_PATHS_ENV, } from "./core/autonomy/worker-session-private-scope.js";
14
+ export { mapToolNamesForPlatform } from "./core/default-tool-surface.js";
11
15
  export { createEventBus } from "./core/event-bus.js";
12
16
  export { defineTool, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.js";
13
17
  export { createExtensionRuntime, discoverAndLoadExtensions } from "./core/extensions/loader.js";
@@ -21,6 +25,7 @@ export * from "./core/orchestration/policy-compiler.js";
21
25
  export * from "./core/orchestration/profile-registry.js";
22
26
  export * from "./core/orchestration/profile-store.js";
23
27
  export * from "./core/orchestration/task-runtime.js";
28
+ export { orchestrationThinkingLevelSchema } from "./core/orchestration/thinking-level-schema.js";
24
29
  export { DefaultPackageManager } from "./core/package-manager.js";
25
30
  export { PI_ORCHESTRATION_AGENT_ID_ENV } from "./core/process-identity.js";
26
31
  export { ACTIVE_TURN_TTL_MS, AUTO_RELOAD_COORDINATOR_TTL_MS, describeReloadSession, getPendingReloadBlockers, getReloadCoordinationDir, isReloadSessionProcessAlive, } from "./core/reload-blockers.js";
@@ -38,11 +43,13 @@ export { BitwardenSecretsManagerCredentialStorage, BitwardenSecretsManagerStorag
38
43
  export { CredentialManager, CredentialManagerError, CredentialStorageError, } from "./core/secrets/credential-manager.js";
39
44
  export { CredentialMigrationSourceError, resolveCredentialMigrationSources, } from "./core/secrets/credential-migration-source.js";
40
45
  export { createPortableGitProjectKey, resolveCredentialProject } from "./core/secrets/credential-project.js";
46
+ export { WORKER_FORBIDDEN_TOOLS } from "./core/session-role.js";
41
47
  export { getDirectoryResourceProfileInfo, matchesResourceProfilePattern, SettingsManager, } from "./core/settings-manager.js";
42
48
  export { DEFAULT_SKILL_IDLE_TIMEOUT_MS, MAX_ACTIVE_SKILL_BODY_BYTES, MAX_LOADED_SKILLS, MAX_PINNED_SKILLS, MIN_ACTIVE_SKILL_BODY_BYTES, resolveActiveSkillBodyByteLimit, SkillVaultController, } from "./core/skill-vault.js";
43
49
  // Skills
44
50
  export { loadSkills, loadSkillsFromDir, MAX_SKILL_FRONTMATTER_BYTES, readSkillFrontmatterFile, } from "./core/skills.js";
45
51
  export { createSyntheticSourceInfo } from "./core/source-info.js";
52
+ export { POLICY_OWNED_RUNTIME_TOOL_NAMES } from "./core/tool-capability-policy.js";
46
53
  export { AskQuestionDialog, createAskQuestionToolDefinition, } from "./core/tools/ask-question.js";
47
54
  // Tools
48
55
  export { createBashToolDefinition, createEditToolDefinition, createFileFailureRecoveryAuthority, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createSecretStoreToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, FileMutationIntentController, FileMutationPreflightError, formatMiddleOmissionMarker, formatSize, truncateHead, truncateKnownHeadTail, truncateLine, truncateMiddle, truncateTail, withFileMutationQueue, } from "./core/tools/index.js";