@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
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":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AyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEN,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAGf,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextEventResult,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tdefineTool,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\nexport { createExtensionRuntime, discoverAndLoadExtensions } from \"./core/extensions/loader.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\tBitwardenCredentialStorage,\n\tBitwardenCredentialStorageError,\n\ttype BitwardenCredentialStorageErrorCode,\n\ttype BitwardenCredentialStorageOptions,\n} from \"./core/secrets/bitwarden-credential-storage.ts\";\nexport {\n\tBitwardenCredentialStorageRouter,\n\ttype BitwardenCredentialStorageRouterOptions,\n} from \"./core/secrets/bitwarden-credential-storage-router.ts\";\nexport {\n\ttype BitwardenSecretsManagerCommandRequest,\n\ttype BitwardenSecretsManagerCommandResult,\n\tBitwardenSecretsManagerCredentialStorage,\n\ttype BitwardenSecretsManagerCredentialStorageOptions,\n\tBitwardenSecretsManagerStorageError,\n} from \"./core/secrets/bitwarden-secrets-manager-storage.ts\";\nexport {\n\ttype CredentialActivationResult,\n\ttype CredentialConnectionStatus,\n\tCredentialManager,\n\tCredentialManagerError,\n\ttype CredentialManagerErrorCode,\n\ttype CredentialManagerOptions,\n\ttype CredentialMutationResult,\n\ttype CredentialProfileRecord,\n\ttype CredentialProfileStorage,\n\ttype CredentialProfileSummary,\n\ttype CredentialProjectIdentity,\n\ttype CredentialProjectResolver,\n\tCredentialStorageError,\n\ttype CredentialStorageErrorCode,\n\ttype CredentialStorageProvider,\n\ttype CredentialVariable,\n\ttype MachineCredentialSession,\n\ttype MachineCredentialSessionResolver,\n\ttype StoredCredentialProfileSummary,\n} from \"./core/secrets/credential-manager.ts\";\nexport {\n\ttype CredentialMigrationSource,\n\tCredentialMigrationSourceError,\n\ttype CredentialMigrationSourceErrorCode,\n\ttype CredentialMigrationSourceResolver,\n\tresolveCredentialMigrationSources,\n} from \"./core/secrets/credential-migration-source.ts\";\nexport { createPortableGitProjectKey, resolveCredentialProject } from \"./core/secrets/credential-project.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\nexport {\n\tDEFAULT_SKILL_IDLE_TIMEOUT_MS,\n\tMAX_ACTIVE_SKILL_BODY_BYTES,\n\tMAX_LOADED_SKILLS,\n\tMAX_PINNED_SKILLS,\n\tMIN_ACTIVE_SKILL_BODY_BYTES,\n\tresolveActiveSkillBodyByteLimit,\n\ttype SkillLoadResult,\n\ttype SkillSearchResult,\n\ttype SkillSlotStatus,\n\tSkillVaultController,\n\ttype SkillVaultControllerOptions,\n\ttype SkillVaultStatus,\n} from \"./core/skill-vault.ts\";\n// Skills\nexport {\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\tMAX_SKILL_FRONTMATTER_BYTES,\n\treadSkillFrontmatterFile,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFileFailureRecoveryAuthority,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSecretStoreToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FileContentReference,\n\ttype FileFailureRecoveryAuthority,\n\tFileMutationIntentController,\n\ttype FileMutationIntentControllerOptions,\n\ttype FileMutationIntentOperations,\n\ttype FileMutationKind,\n\ttype FileMutationLease,\n\ttype FileMutationPayloadReference,\n\tFileMutationPreflightError,\n\ttype FileMutationPreflightFailureReason,\n\ttype FilePathIdentity,\n\ttype FilePathInspection,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatMiddleOmissionMarker,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateKnownHeadTail,\n\ttruncateLine,\n\ttruncateMiddle,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolDetails,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\tcreateSkillVaultToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n} from \"./core/tools/skill.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,aAAa;AACb,OAAO,EAIN,mBAAmB,EAInB,uBAAuB,EAIvB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAGd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EAExB,qBAAqB,EAErB,mBAAmB,EACnB,oBAAoB,EAOpB,cAAc,EAEd,qBAAqB,EACrB,aAAa,GAEb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAIN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,gGAAgG;AAChG,gGAAgG;AAChG,OAAO,EACN,+BAA+B,EAC/B,2BAA2B,GAC3B,MAAM,iDAAiD,CAAC;AACzD,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A0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EAInB,sBAAsB,EAEtB,kBAAkB,EAIlB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,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,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEN,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAGf,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Copied bundled extensions resolve runtime dependencies through this public module. Bun embeds\n// this surface; relative imports back into dist/core do not exist beside a compiled executable.\nexport {\n\tencodeWorkerSessionAllowedPaths,\n\tPI_WORKER_ALLOWED_PATHS_ENV,\n} from \"./core/autonomy/worker-session-private-scope.ts\";\nexport { mapToolNamesForPlatform } from \"./core/default-tool-surface.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextEventResult,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tdefineTool,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\nexport { createExtensionRuntime, discoverAndLoadExtensions } from \"./core/extensions/loader.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport { orchestrationThinkingLevelSchema } from \"./core/orchestration/thinking-level-schema.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\tBitwardenCredentialStorage,\n\tBitwardenCredentialStorageError,\n\ttype BitwardenCredentialStorageErrorCode,\n\ttype BitwardenCredentialStorageOptions,\n} from \"./core/secrets/bitwarden-credential-storage.ts\";\nexport {\n\tBitwardenCredentialStorageRouter,\n\ttype BitwardenCredentialStorageRouterOptions,\n} from \"./core/secrets/bitwarden-credential-storage-router.ts\";\nexport {\n\ttype BitwardenSecretsManagerCommandRequest,\n\ttype BitwardenSecretsManagerCommandResult,\n\tBitwardenSecretsManagerCredentialStorage,\n\ttype BitwardenSecretsManagerCredentialStorageOptions,\n\tBitwardenSecretsManagerStorageError,\n} from \"./core/secrets/bitwarden-secrets-manager-storage.ts\";\nexport {\n\ttype CredentialActivationResult,\n\ttype CredentialConnectionStatus,\n\tCredentialManager,\n\tCredentialManagerError,\n\ttype CredentialManagerErrorCode,\n\ttype CredentialManagerOptions,\n\ttype CredentialMutationResult,\n\ttype CredentialProfileRecord,\n\ttype CredentialProfileStorage,\n\ttype CredentialProfileSummary,\n\ttype CredentialProjectIdentity,\n\ttype CredentialProjectResolver,\n\tCredentialStorageError,\n\ttype CredentialStorageErrorCode,\n\ttype CredentialStorageProvider,\n\ttype CredentialVariable,\n\ttype MachineCredentialSession,\n\ttype MachineCredentialSessionResolver,\n\ttype StoredCredentialProfileSummary,\n} from \"./core/secrets/credential-manager.ts\";\nexport {\n\ttype CredentialMigrationSource,\n\tCredentialMigrationSourceError,\n\ttype CredentialMigrationSourceErrorCode,\n\ttype CredentialMigrationSourceResolver,\n\tresolveCredentialMigrationSources,\n} from \"./core/secrets/credential-migration-source.ts\";\nexport { createPortableGitProjectKey, resolveCredentialProject } from \"./core/secrets/credential-project.ts\";\nexport { WORKER_FORBIDDEN_TOOLS } from \"./core/session-role.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\nexport {\n\tDEFAULT_SKILL_IDLE_TIMEOUT_MS,\n\tMAX_ACTIVE_SKILL_BODY_BYTES,\n\tMAX_LOADED_SKILLS,\n\tMAX_PINNED_SKILLS,\n\tMIN_ACTIVE_SKILL_BODY_BYTES,\n\tresolveActiveSkillBodyByteLimit,\n\ttype SkillLoadResult,\n\ttype SkillSearchResult,\n\ttype SkillSlotStatus,\n\tSkillVaultController,\n\ttype SkillVaultControllerOptions,\n\ttype SkillVaultStatus,\n} from \"./core/skill-vault.ts\";\n// Skills\nexport {\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\tMAX_SKILL_FRONTMATTER_BYTES,\n\treadSkillFrontmatterFile,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport { POLICY_OWNED_RUNTIME_TOOL_NAMES } from \"./core/tool-capability-policy.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFileFailureRecoveryAuthority,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSecretStoreToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FileContentReference,\n\ttype FileFailureRecoveryAuthority,\n\tFileMutationIntentController,\n\ttype FileMutationIntentControllerOptions,\n\ttype FileMutationIntentOperations,\n\ttype FileMutationKind,\n\ttype FileMutationLease,\n\ttype FileMutationPayloadReference,\n\tFileMutationPreflightError,\n\ttype FileMutationPreflightFailureReason,\n\ttype FilePathIdentity,\n\ttype FilePathInspection,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatMiddleOmissionMarker,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateKnownHeadTail,\n\ttruncateLine,\n\ttruncateMiddle,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolDetails,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\tcreateSkillVaultToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n} from \"./core/tools/skill.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}
@@ -107,10 +107,11 @@ export declare class AutoLearnController {
107
107
  getAutoLearnTenantDataDir(): string;
108
108
  private getAutoLearnMessageCount;
109
109
  private buildAutoLearnDecisionFromState;
110
+ /** Read-only readiness projection for the manual Auto Learn command and status report. */
111
+ private evaluateAutoLearn;
110
112
  private resolveAutoLearnModelPattern;
111
113
  private getAutoLearnSpawnTarget;
112
114
  validateAutoLearnModelValue(value: string | undefined): string | undefined;
113
- private evaluateAutoLearn;
114
115
  private buildAutonomyAuthorityPrompt;
115
116
  private buildAutoLearnPrompt;
116
117
  private reserveAutoLearnRun;
@@ -124,10 +125,9 @@ export declare class AutoLearnController {
124
125
  turnDigest?: string;
125
126
  bypassReflectionCooldown?: boolean;
126
127
  }): string;
127
- private evaluateAutonomyReview;
128
128
  /**
129
- * Native reflection is the in-process replacement for the buggy `continuous-learning`
130
- * subprocess. It runs when auto-learn is enabled and is not killed via `PI_NATIVE_REFLECTION=0`.
129
+ * Current-session reflection is available only to the root orchestrator. It never launches a
130
+ * learner process; the session provider planner owns its single-request transient cue.
131
131
  */
132
132
  isNativeReflectionEnabled(): boolean;
133
133
  /**
@@ -139,9 +139,8 @@ export declare class AutoLearnController {
139
139
  * `task_steps_context` pages through). Zero model calls; a delivery failure is swallowed so this
140
140
  * best-effort nudge can never disrupt the turn.
141
141
  *
142
- * Called from both `maybeRunNativeReflection` and `maybeStartAutoLearn` the mutually exclusive
143
- * `agent_end` branches in interactive-mode.ts so it runs on every turn regardless of whether
144
- * native reflection or legacy auto-learn is enabled, without adding a new turn-boundary hook.
142
+ * Called from both interactive turn-boundary compatibility hooks so it runs regardless of the
143
+ * current-session reflection setting without adding another provider turn.
145
144
  */
146
145
  private checkTaskStepsContractNudge;
147
146
  maybeRunNativeReflection(messages: AgentMessage[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"auto-learn-controller.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/auto-learn-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAUhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAuEtF,eAAO,MAAM,cAAc,EAAE,YAAY,EAAwC,CAAC;AAElF,eAAO,MAAM,+BAA+B,QAA0B,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChD;AAiID,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,4BAA4B,GAAG,2BAA2B,CAYpH;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CA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qB,IAAI,MAAM,CA8C9B;CACD"}
1
+ {"version":3,"file":"auto-learn-controller.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/auto-learn-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAchE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAStF,eAAO,MAAM,cAAc,EAAE,YAAY,EAAwC,CAAC;AAElF,eAAO,MAAM,+BAA+B,QAA0B,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChD;AAiID,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,4BAA4B,GAAG,2BAA2B,CAYpH;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MA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,oBAAoB;IAU5B,yBAAyB,IAAI,MAAM,CAElC;IAED,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,+BAA+B;IA6EvC,0FAA0F;IAC1F,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,uBAAuB;IAoB/B,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAWzE;IAED,OAAO,CAAC,4BAA4B;IA8BpC,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,mBAAmB;IAgE3B,OAAO,CAAC,2BAA2B;IAkBnC,OAAO,CAAC,6BAA6B;IAgBrC,OAAO,CAAC,4BAA4B;IAqBpC,OAAO,CAAC,+BAA+B;IA8BvC,eAAe,CACd,MAAM,EAAE,MAAM,EACd,KAAK,UAAQ,EACb,OAAO,GAAE;QACR,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;QACrC,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;QACnC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,wBAAwB,CAAC,EAAE,OAAO,CAAC;KAC9B,GACJ,MAAM,CAgIR;IAED;;;OAGG;IACH,yBAAyB,IAAI,OAAO,CAEnC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,2BAA2B;IAenC,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAMvD;IAED,mBAAmB,IAAI,OAAO,CAK7B;IAED,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAK1D;IAED,qBAAqB,IAAI,IAAI,CAiB5B;IAED,qBAAqB,IAAI,MAAM,CAwC9B;CACD"}
@@ -15,73 +15,13 @@ import { spawn } from "child_process";
15
15
  import lockfile from "proper-lockfile";
16
16
  import { getAgentDir } from "../../config.js";
17
17
  import { readAutoLearnSessionIdFromFile, reportCompletedAutoLearnUsageHelper } from "../../core/cost/session-usage.js";
18
- import { analyzeReflectionTurn } from "../../core/learning/reflection-turn-analysis.js";
18
+ import { getAutoLearnPreset, isCurrentSessionReflectionEnabled, resolveAutoLearnSettings, } from "../../core/learning/auto-learn-settings.js";
19
19
  import { isProcessAlive } from "../../core/process-liveness.js";
20
20
  import { describeInFlightWorkUnit, getInFlightWorkUnits, getPendingReloadBlockers, } from "../../core/reload-blockers.js";
21
21
  import { PI_SESSION_ROLE_ENV } from "../../core/session-role.js";
22
22
  import { checkTaskStepsContract, INITIAL_TASK_CONTRACT_STREAK, } from "../../core/tasks/task-contract-monitor.js";
23
23
  import { getProcessWorkRun } from "../../utils/work-directory.js";
24
24
  import { theme } from "./theme/theme.js";
25
- const AUTO_LEARN_DEFAULTS = {
26
- enabled: false,
27
- model: "active",
28
- thinkingLevel: "low",
29
- longSessionMessages: 32,
30
- longSessionContextPercent: 70,
31
- cooldownMinutes: 24 * 60,
32
- leaseMinutes: 90,
33
- maxConcurrentLearners: 1,
34
- applyHighConfidence: false,
35
- reflectionReview: true,
36
- reflectionMinToolCalls: 12,
37
- reflectionCooldownMinutes: 24 * 60,
38
- complexTaskToolCalls: 12,
39
- };
40
- const AUTONOMY_AUTO_LEARN_PRESETS = {
41
- off: { ...AUTO_LEARN_DEFAULTS, enabled: true, reflectionReview: true },
42
- safe: {
43
- ...AUTO_LEARN_DEFAULTS,
44
- enabled: true,
45
- longSessionMessages: 64,
46
- longSessionContextPercent: 85,
47
- cooldownMinutes: 24 * 60,
48
- leaseMinutes: 60,
49
- maxConcurrentLearners: 1,
50
- applyHighConfidence: false,
51
- reflectionReview: true,
52
- reflectionMinToolCalls: 12,
53
- reflectionCooldownMinutes: 24 * 60,
54
- complexTaskToolCalls: 12,
55
- },
56
- balanced: {
57
- ...AUTO_LEARN_DEFAULTS,
58
- enabled: true,
59
- longSessionMessages: 64,
60
- longSessionContextPercent: 85,
61
- cooldownMinutes: 24 * 60,
62
- leaseMinutes: 90,
63
- maxConcurrentLearners: 1,
64
- applyHighConfidence: false,
65
- reflectionReview: true,
66
- reflectionMinToolCalls: 12,
67
- reflectionCooldownMinutes: 24 * 60,
68
- complexTaskToolCalls: 12,
69
- },
70
- full: {
71
- ...AUTO_LEARN_DEFAULTS,
72
- enabled: true,
73
- longSessionMessages: 64,
74
- longSessionContextPercent: 85,
75
- cooldownMinutes: 24 * 60,
76
- leaseMinutes: 90,
77
- maxConcurrentLearners: 1,
78
- applyHighConfidence: true,
79
- reflectionReview: true,
80
- reflectionMinToolCalls: 12,
81
- reflectionCooldownMinutes: 24 * 60,
82
- complexTaskToolCalls: 12,
83
- },
84
- };
85
25
  export const AUTONOMY_MODES = ["off", "safe", "balanced", "full"];
86
26
  const AUTO_LEARN_RESERVATION_MS = 2 * 60 * 1000;
87
27
  export const AUTO_LEARN_HISTORY_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
@@ -226,9 +166,8 @@ export class AutoLearnController {
226
166
  constructor(deps) {
227
167
  // Cheap turn-boundary task_steps contract nudge. Tracks the consecutive-violation streak
228
168
  // across turns so `checkTaskStepsContractNudge` (invoked from the existing per-turn `agent_end`
229
- // pass below) can fire exactly one advisory harness note per sustained-violation streak. No model
230
- // calls; best-effort coupling to whichever per-turn branch runs (native reflection or the
231
- // auto-learn/autonomy-review pair) — see `checkTaskStepsContractNudge` for the rationale.
169
+ // pass below) can fire exactly one advisory harness note per sustained-violation streak. It makes
170
+ // no model call and remains independent of current-session reflection cue planning.
232
171
  this._taskContractStreak = INITIAL_TASK_CONTRACT_STREAK;
233
172
  this.deps = deps;
234
173
  }
@@ -421,27 +360,11 @@ export class AutoLearnController {
421
360
  });
422
361
  }
423
362
  getAutoLearnPresetForAutonomyMode(mode, current = {}) {
424
- const preset = AUTONOMY_AUTO_LEARN_PRESETS[mode] ?? AUTONOMY_AUTO_LEARN_PRESETS.off;
425
- return { ...preset, model: current.model?.trim() || preset.model };
363
+ return getAutoLearnPreset(mode, current);
426
364
  }
427
365
  getEffectiveAutoLearnSettings() {
428
366
  const settings = this.session.settingsManager.getAutoLearnSettings();
429
- const preset = this.getAutoLearnPresetForAutonomyMode(this.session.settingsManager.getAutonomySettings().mode, settings);
430
- return {
431
- enabled: settings.enabled ?? preset.enabled,
432
- model: settings.model?.trim() || preset.model,
433
- longSessionMessages: settings.longSessionMessages ?? preset.longSessionMessages,
434
- longSessionContextPercent: settings.longSessionContextPercent ?? preset.longSessionContextPercent,
435
- cooldownMinutes: settings.cooldownMinutes ?? preset.cooldownMinutes,
436
- leaseMinutes: settings.leaseMinutes ?? preset.leaseMinutes,
437
- maxConcurrentLearners: settings.maxConcurrentLearners ?? preset.maxConcurrentLearners,
438
- applyHighConfidence: settings.applyHighConfidence ?? preset.applyHighConfidence,
439
- reflectionReview: settings.reflectionReview ?? preset.reflectionReview,
440
- reflectionMinToolCalls: settings.reflectionMinToolCalls ?? preset.reflectionMinToolCalls,
441
- reflectionCooldownMinutes: settings.reflectionCooldownMinutes ?? preset.reflectionCooldownMinutes,
442
- complexTaskToolCalls: settings.complexTaskToolCalls ?? preset.complexTaskToolCalls,
443
- thinkingLevel: settings.thinkingLevel ?? preset.thinkingLevel,
444
- };
367
+ return resolveAutoLearnSettings(this.session.settingsManager.getAutonomySettings().mode, settings);
445
368
  }
446
369
  getCurrentAutoLearnSettings() {
447
370
  return this.getEffectiveAutoLearnSettings();
@@ -535,6 +458,14 @@ export class AutoLearnController {
535
458
  runningCount,
536
459
  };
537
460
  }
461
+ /** Read-only readiness projection for the manual Auto Learn command and status report. */
462
+ evaluateAutoLearn(force = false) {
463
+ const settings = this.getEffectiveAutoLearnSettings();
464
+ return this.withAutoLearnStateLock((current) => {
465
+ const state = this.pruneAutoLearnHistoryFromState(current);
466
+ return { result: this.buildAutoLearnDecisionFromState(state, settings, force), next: state };
467
+ });
468
+ }
538
469
  resolveAutoLearnModelPattern(settings) {
539
470
  if (settings.model === "active") {
540
471
  return this.session.model ? `${this.session.model.provider}/${this.session.model.id}` : undefined;
@@ -572,13 +503,6 @@ export class AutoLearnController {
572
503
  return undefined;
573
504
  return `Auto Learn model "${modelValue}" is not in configured subscription/API models; saved as manual/unverified.`;
574
505
  }
575
- evaluateAutoLearn(force = false) {
576
- const settings = this.getEffectiveAutoLearnSettings();
577
- return this.withAutoLearnStateLock((current) => {
578
- const state = this.pruneAutoLearnHistoryFromState(current);
579
- return { result: this.buildAutoLearnDecisionFromState(state, settings, force), next: state };
580
- });
581
- }
582
506
  buildAutonomyAuthorityPrompt() {
583
507
  const autonomy = this.session.settingsManager.getAutonomySettings();
584
508
  const selfModification = this.session.settingsManager.getSelfModificationSettings();
@@ -736,6 +660,9 @@ export class AutoLearnController {
736
660
  });
737
661
  }
738
662
  launchAutoLearn(reason, force = false, options = {}) {
663
+ if (options.promptKind === "reflection" || options.cooldownKind === "reflection") {
664
+ return "Auto Learn not started: automatic reflection runs only in the current root session; background reflection learners are disabled.";
665
+ }
739
666
  const settings = this.getEffectiveAutoLearnSettings();
740
667
  const modelPattern = this.resolveAutoLearnModelPattern(settings);
741
668
  if (!modelPattern) {
@@ -860,93 +787,12 @@ export class AutoLearnController {
860
787
  this.updateAutoLearnFooter();
861
788
  return `Auto Learn started. Log: ${logPath}`;
862
789
  }
863
- evaluateAutonomyReview(messages) {
864
- const settings = this.getEffectiveAutoLearnSettings();
865
- const complexTaskThreshold = Math.max(1, settings.complexTaskToolCalls ?? 12);
866
- const turn = analyzeReflectionTurn(messages, complexTaskThreshold);
867
- const digest = turn.recentTurnText || "[No textual turn digest available.]";
868
- const state = this.withAutoLearnStateLock((current) => {
869
- const pruned = this.pruneAutoLearnHistoryFromState(current);
870
- return { result: pruned, next: pruned };
871
- });
872
- const now = Date.now();
873
- const tenant = this.getAutoLearnTenantKey();
874
- const runningCount = Object.values(state.runs ?? {}).filter((run) => run.tenant === tenant).length;
875
- const lastReflection = state.lastReflectionByTenant?.[tenant] ?? 0;
876
- const cooldownMs = settings.reflectionCooldownMinutes * 60 * 1000;
877
- const cooldownRemainingMs = Math.max(0, lastReflection + cooldownMs - now);
878
- const messageCount = this.getAutoLearnMessageCount();
879
- const contextPercent = this.session.getContextUsage()?.percent ?? null;
880
- const toolCalls = turn.toolCallCount;
881
- const userText = turn.userText;
882
- const correctionSignal = turn.hadCorrection;
883
- const behavioralSelfImprovementSignal = /\b(harness|pi|agent|autonomy|autonomous|self[- ]?improv(?:e|ement|ing)?|steer(?:ing)?|trigger(?:s)?|skill(?:s)?|code[- ]?bak(?:e|ed)|bake(?:d)? into code|not (?:automata|memory)|reference agent|hermes)\b/i.test(userText) &&
884
- /\b(improve|automatic(?:ally)?|autonomous|trigger|fire|skill|steer|self[- ]?improv(?:e|ement|ing)?|code[- ]?bak(?:e|ed)|bake(?:d)?|too much|less)\b/i.test(userText);
885
- const complexTaskSignal = toolCalls >= complexTaskThreshold;
886
- const bypassCooldown = correctionSignal || behavioralSelfImprovementSignal || complexTaskSignal;
887
- const base = { messageCount, contextPercent, cooldownRemainingMs, runningCount, toolCalls };
888
- if (!settings.enabled)
889
- return { ...base, shouldRun: false, reason: "disabled" };
890
- if (!settings.reflectionReview)
891
- return { ...base, shouldRun: false, reason: "reflection disabled" };
892
- if (runningCount >= settings.maxConcurrentLearners) {
893
- return {
894
- ...base,
895
- shouldRun: false,
896
- reason: `max tenant learners running (${runningCount}/${settings.maxConcurrentLearners})`,
897
- };
898
- }
899
- if (cooldownRemainingMs > 0 && !bypassCooldown) {
900
- return { ...base, shouldRun: false, reason: "reflection cooldown" };
901
- }
902
- if (behavioralSelfImprovementSignal) {
903
- return {
904
- ...base,
905
- shouldRun: true,
906
- reason: "reflection behavioral self-improvement signal",
907
- digest,
908
- bypassCooldown: true,
909
- };
910
- }
911
- if (correctionSignal) {
912
- return {
913
- ...base,
914
- shouldRun: true,
915
- reason: "reflection correction signal",
916
- digest,
917
- bypassCooldown: true,
918
- };
919
- }
920
- if (complexTaskSignal) {
921
- return {
922
- ...base,
923
- shouldRun: true,
924
- reason: `reflection complex task learning signal (${toolCalls}/${complexTaskThreshold} tool calls)`,
925
- digest,
926
- bypassCooldown: true,
927
- };
928
- }
929
- // Full autonomy expands allowed action scope for triggered reviews; it does not make every turn a review trigger.
930
- if (toolCalls >= settings.reflectionMinToolCalls) {
931
- return {
932
- ...base,
933
- shouldRun: true,
934
- reason: `reflection tool trigger (${toolCalls}/${settings.reflectionMinToolCalls})`,
935
- digest,
936
- };
937
- }
938
- return { ...base, shouldRun: false, reason: "reflection thresholds not met" };
939
- }
940
790
  /**
941
- * Native reflection is the in-process replacement for the buggy `continuous-learning`
942
- * subprocess. It runs when auto-learn is enabled and is not killed via `PI_NATIVE_REFLECTION=0`.
791
+ * Current-session reflection is available only to the root orchestrator. It never launches a
792
+ * learner process; the session provider planner owns its single-request transient cue.
943
793
  */
944
794
  isNativeReflectionEnabled() {
945
- if (process.env.PI_NATIVE_REFLECTION === "0")
946
- return false;
947
- if (process.env.PI_AUTO_LEARN_CHILD === "1")
948
- return false;
949
- return this.getEffectiveAutoLearnSettings().enabled;
795
+ return isCurrentSessionReflectionEnabled(this.getEffectiveAutoLearnSettings());
950
796
  }
951
797
  /**
952
798
  * Cheap turn-boundary task_steps contract check. Reads the current task_steps snapshot,
@@ -957,9 +803,8 @@ export class AutoLearnController {
957
803
  * `task_steps_context` pages through). Zero model calls; a delivery failure is swallowed so this
958
804
  * best-effort nudge can never disrupt the turn.
959
805
  *
960
- * Called from both `maybeRunNativeReflection` and `maybeStartAutoLearn` the mutually exclusive
961
- * `agent_end` branches in interactive-mode.ts so it runs on every turn regardless of whether
962
- * native reflection or legacy auto-learn is enabled, without adding a new turn-boundary hook.
806
+ * Called from both interactive turn-boundary compatibility hooks so it runs regardless of the
807
+ * current-session reflection setting without adding another provider turn.
963
808
  */
964
809
  checkTaskStepsContractNudge() {
965
810
  const state = this.session.getTaskStepsStateSnapshot();
@@ -981,36 +826,16 @@ export class AutoLearnController {
981
826
  void messages;
982
827
  }
983
828
  maybeStartAutoLearn() {
984
- // The other mutually exclusive `agent_end` branch (see `checkTaskStepsContractNudge`) runs
985
- // unconditionally here so the contract nudge fires every turn regardless of auto-learn settings.
829
+ // Preserve the deterministic task-contract monitor, but never buy an automatic learner turn.
986
830
  this.checkTaskStepsContractNudge();
987
- if (process.env.PI_AUTO_LEARN_CHILD === "1")
988
- return false;
989
- const decision = this.evaluateAutoLearn(false);
990
- if (!decision.shouldRun) {
991
- this.updateAutoLearnFooter();
992
- return false;
993
- }
994
- const message = this.launchAutoLearn(decision.reason, false);
995
- if (!message.startsWith("Auto Learn started"))
996
- this.deps.ui.showStatus(message);
997
- return message.startsWith("Auto Learn started");
831
+ this.updateAutoLearnFooter();
832
+ return false;
998
833
  }
999
834
  maybeStartAutonomyReview(messages) {
1000
- if (process.env.PI_AUTO_LEARN_CHILD === "1")
1001
- return false;
1002
- const decision = this.evaluateAutonomyReview(messages);
1003
- if (!decision.shouldRun)
1004
- return false;
1005
- const message = this.launchAutoLearn(decision.reason, true, {
1006
- cooldownKind: "reflection",
1007
- promptKind: "reflection",
1008
- turnDigest: decision.digest,
1009
- bypassReflectionCooldown: decision.bypassCooldown,
1010
- });
1011
- if (!message.startsWith("Auto Learn started"))
1012
- this.deps.ui.showStatus(message);
1013
- return message.startsWith("Auto Learn started");
835
+ // Compatibility hook for InteractiveEventHost. Completed-turn reflection is deterministic and
836
+ // session-owned; it never creates a background process or a second provider turn.
837
+ void messages;
838
+ return false;
1014
839
  }
1015
840
  updateAutoLearnFooter() {
1016
841
  const settings = this.getEffectiveAutoLearnSettings();
@@ -1062,10 +887,8 @@ export class AutoLearnController {
1062
887
  const inFlightWorkLines = inFlightWork.length
1063
888
  ? inFlightWork.map((unit) => `- ${describeInFlightWorkUnit(unit)}`).join("\n")
1064
889
  : "- none";
1065
- const reflectionLast = state.lastReflectionByTenant?.[this.getAutoLearnTenantKey()] ?? 0;
1066
- const reflectionCooldownRemainingMs = Math.max(0, reflectionLast + settings.reflectionCooldownMinutes * 60 * 1000 - Date.now());
1067
- const reflectionCooldownText = reflectionCooldownRemainingMs > 0 ? `${Math.ceil(reflectionCooldownRemainingMs / 60000)}m remaining` : "ready";
1068
- return `Auto Learn status\nEnabled: ${settings.enabled}\nModel: ${settings.model}\nNext decision: ${decision.shouldRun ? "ready" : decision.reason}\nMessages: ${decision.messageCount}/${settings.longSessionMessages}\nContext: ${contextText}/${settings.longSessionContextPercent}%\nCooldown: ${cooldownText}\nReflection review: ${settings.reflectionReview ? "enabled" : "disabled"} (tool trigger ${settings.reflectionMinToolCalls}, cooldown ${reflectionCooldownText})\nHistory retention: 7 days for internal Auto Learn prompts/logs/sessions\nRunning tenant leases: ${runs.length}/${settings.maxConcurrentLearners}\nOther tenant leases: ${otherTenantRuns}\nTenant artifact dir: ${this.getAutoLearnTenantDataDir()}\nPi auto-reload blockers: ${reloadBlockers.pending ? reloadBlockers.reason : "none"}\n${reloadBlockerLines}\nIn-process reload-gate work: ${inFlightWork.length ? `${inFlightWork.length} unit(s)` : "none"}\n${inFlightWorkLines}\nRuns:\n${runLines}`;
890
+ const reflectionStatus = this.isNativeReflectionEnabled() ? "enabled" : "disabled";
891
+ return `Auto Learn status\nEnabled: ${settings.enabled}\nModel: ${settings.model}\nNext decision: ${decision.shouldRun ? "ready" : decision.reason}\nMessages: ${decision.messageCount}/${settings.longSessionMessages}\nContext: ${contextText}/${settings.longSessionContextPercent}%\nCooldown: ${cooldownText}\nCurrent-session reflection: ${reflectionStatus} (complex trigger ${settings.complexTaskToolCalls} tool calls; automatic provider requests 0)\nHistory retention: 7 days for internal Auto Learn prompts/logs/sessions\nRunning tenant leases: ${runs.length}/${settings.maxConcurrentLearners}\nOther tenant leases: ${otherTenantRuns}\nTenant artifact dir: ${this.getAutoLearnTenantDataDir()}\nPi auto-reload blockers: ${reloadBlockers.pending ? reloadBlockers.reason : "none"}\n${reloadBlockerLines}\nIn-process reload-gate work: ${inFlightWork.length ? `${inFlightWork.length} unit(s)` : "none"}\n${inFlightWorkLines}\nRuns:\n${runLines}`;
1069
892
  }
1070
893
  }
1071
894
  //# sourceMappingURL=auto-learn-controller.js.map