@caupulican/pi-adaptative 0.81.40 → 0.81.41

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 (406) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
  3. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +1 -0
  4. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
  5. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +1 -0
  6. package/dist/cli/args.d.ts +2 -0
  7. package/dist/cli/args.d.ts.map +1 -1
  8. package/dist/cli/args.js +22 -1
  9. package/dist/cli/args.js.map +1 -1
  10. package/dist/core/agent-paths.d.ts +6 -0
  11. package/dist/core/agent-paths.d.ts.map +1 -1
  12. package/dist/core/agent-paths.js +12 -0
  13. package/dist/core/agent-paths.js.map +1 -1
  14. package/dist/core/agent-session-contracts.d.ts +293 -0
  15. package/dist/core/agent-session-contracts.d.ts.map +1 -0
  16. package/dist/core/agent-session-contracts.js +26 -0
  17. package/dist/core/agent-session-contracts.js.map +1 -0
  18. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  19. package/dist/core/agent-session-runtime.js +3 -0
  20. package/dist/core/agent-session-runtime.js.map +1 -1
  21. package/dist/core/agent-session.d.ts +26 -405
  22. package/dist/core/agent-session.d.ts.map +1 -1
  23. package/dist/core/agent-session.js +86 -307
  24. package/dist/core/agent-session.js.map +1 -1
  25. package/dist/core/auth-storage.d.ts.map +1 -1
  26. package/dist/core/auth-storage.js +3 -1
  27. package/dist/core/auth-storage.js.map +1 -1
  28. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  29. package/dist/core/autonomy/lane-tool-surface.js +2 -1
  30. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  31. package/dist/core/background-lane-controller.d.ts +3 -1
  32. package/dist/core/background-lane-controller.d.ts.map +1 -1
  33. package/dist/core/background-lane-controller.js +1 -0
  34. package/dist/core/background-lane-controller.js.map +1 -1
  35. package/dist/core/bedrock-sso-login.d.ts +16 -0
  36. package/dist/core/bedrock-sso-login.d.ts.map +1 -0
  37. package/dist/core/bedrock-sso-login.js +98 -0
  38. package/dist/core/bedrock-sso-login.js.map +1 -0
  39. package/dist/core/compaction-controller.d.ts.map +1 -1
  40. package/dist/core/compaction-controller.js +1 -1
  41. package/dist/core/compaction-controller.js.map +1 -1
  42. package/dist/core/compaction-support.d.ts +3 -8
  43. package/dist/core/compaction-support.d.ts.map +1 -1
  44. package/dist/core/compaction-support.js +3 -3
  45. package/dist/core/compaction-support.js.map +1 -1
  46. package/dist/core/context-pipeline.d.ts +1 -1
  47. package/dist/core/context-pipeline.d.ts.map +1 -1
  48. package/dist/core/context-pipeline.js +7 -33
  49. package/dist/core/context-pipeline.js.map +1 -1
  50. package/dist/core/cost/cost-summary.d.ts.map +1 -1
  51. package/dist/core/cost/cost-summary.js +5 -3
  52. package/dist/core/cost/cost-summary.js.map +1 -1
  53. package/dist/core/cost/daily-usage.d.ts.map +1 -1
  54. package/dist/core/cost/daily-usage.js +4 -5
  55. package/dist/core/cost/daily-usage.js.map +1 -1
  56. package/dist/core/default-tool-surface.d.ts.map +1 -1
  57. package/dist/core/default-tool-surface.js +1 -0
  58. package/dist/core/default-tool-surface.js.map +1 -1
  59. package/dist/core/extension-import-authority.d.ts +6 -0
  60. package/dist/core/extension-import-authority.d.ts.map +1 -0
  61. package/dist/core/extension-import-authority.js +10 -0
  62. package/dist/core/extension-import-authority.js.map +1 -0
  63. package/dist/core/extensions/loader.d.ts.map +1 -1
  64. package/dist/core/extensions/loader.js +2 -3
  65. package/dist/core/extensions/loader.js.map +1 -1
  66. package/dist/core/extensions/runner.d.ts +3 -0
  67. package/dist/core/extensions/runner.d.ts.map +1 -1
  68. package/dist/core/extensions/runner.js +14 -5
  69. package/dist/core/extensions/runner.js.map +1 -1
  70. package/dist/core/extensions/stale-context.d.ts +2 -0
  71. package/dist/core/extensions/stale-context.d.ts.map +1 -0
  72. package/dist/core/extensions/stale-context.js +2 -0
  73. package/dist/core/extensions/stale-context.js.map +1 -0
  74. package/dist/core/extensions/types.d.ts +8 -0
  75. package/dist/core/extensions/types.d.ts.map +1 -1
  76. package/dist/core/extensions/types.js.map +1 -1
  77. package/dist/core/foreground-recovery-controller.d.ts +1 -0
  78. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  79. package/dist/core/foreground-recovery-controller.js +13 -13
  80. package/dist/core/foreground-recovery-controller.js.map +1 -1
  81. package/dist/core/goal-loop-controller.d.ts +14 -9
  82. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  83. package/dist/core/goal-loop-controller.js +47 -75
  84. package/dist/core/goal-loop-controller.js.map +1 -1
  85. package/dist/core/goals/compact-goal-context.d.ts +11 -0
  86. package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
  87. package/dist/core/goals/compact-goal-context.js +59 -0
  88. package/dist/core/goals/compact-goal-context.js.map +1 -0
  89. package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
  90. package/dist/core/goals/goal-acceptance.js +2 -0
  91. package/dist/core/goals/goal-acceptance.js.map +1 -1
  92. package/dist/core/goals/goal-auto-continue-controller.d.ts +2 -1
  93. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  94. package/dist/core/goals/goal-auto-continue-controller.js +5 -8
  95. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  96. package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
  97. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  98. package/dist/core/goals/goal-continuation-controller.js +42 -11
  99. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  100. package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
  101. package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
  102. package/dist/core/goals/goal-continuation-defaults.js +4 -32
  103. package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
  104. package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
  105. package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
  106. package/dist/core/goals/goal-continuation-prompt.js +9 -179
  107. package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
  108. package/dist/core/goals/goal-lifecycle.d.ts +35 -12
  109. package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
  110. package/dist/core/goals/goal-lifecycle.js +98 -13
  111. package/dist/core/goals/goal-lifecycle.js.map +1 -1
  112. package/dist/core/goals/goal-record.d.ts +17 -0
  113. package/dist/core/goals/goal-record.d.ts.map +1 -0
  114. package/dist/core/goals/goal-record.js +31 -0
  115. package/dist/core/goals/goal-record.js.map +1 -0
  116. package/dist/core/goals/goal-session-controller.d.ts +42 -0
  117. package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
  118. package/dist/core/goals/goal-session-controller.js +128 -0
  119. package/dist/core/goals/goal-session-controller.js.map +1 -0
  120. package/dist/core/goals/goal-state.d.ts +45 -25
  121. package/dist/core/goals/goal-state.d.ts.map +1 -1
  122. package/dist/core/goals/goal-state.js +85 -15
  123. package/dist/core/goals/goal-state.js.map +1 -1
  124. package/dist/core/goals/goal-tool-core.d.ts +1 -4
  125. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  126. package/dist/core/goals/goal-tool-core.js +49 -34
  127. package/dist/core/goals/goal-tool-core.js.map +1 -1
  128. package/dist/core/goals/session-goal-state.d.ts +18 -8
  129. package/dist/core/goals/session-goal-state.d.ts.map +1 -1
  130. package/dist/core/goals/session-goal-state.js +134 -11
  131. package/dist/core/goals/session-goal-state.js.map +1 -1
  132. package/dist/core/human-input-controller.d.ts +47 -0
  133. package/dist/core/human-input-controller.d.ts.map +1 -0
  134. package/dist/core/human-input-controller.js +181 -0
  135. package/dist/core/human-input-controller.js.map +1 -0
  136. package/dist/core/local-runtime-controller.d.ts +1 -1
  137. package/dist/core/local-runtime-controller.d.ts.map +1 -1
  138. package/dist/core/local-runtime-controller.js.map +1 -1
  139. package/dist/core/model-capability.d.ts +0 -19
  140. package/dist/core/model-capability.d.ts.map +1 -1
  141. package/dist/core/model-capability.js +0 -19
  142. package/dist/core/model-capability.js.map +1 -1
  143. package/dist/core/model-registry.d.ts +6 -1
  144. package/dist/core/model-registry.d.ts.map +1 -1
  145. package/dist/core/model-registry.js +13 -5
  146. package/dist/core/model-registry.js.map +1 -1
  147. package/dist/core/model-resolver.d.ts +16 -1
  148. package/dist/core/model-resolver.d.ts.map +1 -1
  149. package/dist/core/model-resolver.js +32 -16
  150. package/dist/core/model-resolver.js.map +1 -1
  151. package/dist/core/model-router-controller.d.ts +1 -1
  152. package/dist/core/model-router-controller.d.ts.map +1 -1
  153. package/dist/core/model-router-controller.js.map +1 -1
  154. package/dist/core/model-selection-controller.d.ts +1 -1
  155. package/dist/core/model-selection-controller.d.ts.map +1 -1
  156. package/dist/core/model-selection-controller.js.map +1 -1
  157. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  158. package/dist/core/orchestration/delegation-ledger.js +3 -0
  159. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  160. package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
  161. package/dist/core/orchestration/work-state-projection.js +1 -1
  162. package/dist/core/orchestration/work-state-projection.js.map +1 -1
  163. package/dist/core/package-manager.d.ts.map +1 -1
  164. package/dist/core/package-manager.js +20 -3
  165. package/dist/core/package-manager.js.map +1 -1
  166. package/dist/core/profile-filter-controller.d.ts +8 -1
  167. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  168. package/dist/core/profile-filter-controller.js +23 -5
  169. package/dist/core/profile-filter-controller.js.map +1 -1
  170. package/dist/core/prompt-templates.d.ts +1 -0
  171. package/dist/core/prompt-templates.d.ts.map +1 -1
  172. package/dist/core/prompt-templates.js +18 -29
  173. package/dist/core/prompt-templates.js.map +1 -1
  174. package/dist/core/reflection-controller.d.ts +1 -1
  175. package/dist/core/reflection-controller.d.ts.map +1 -1
  176. package/dist/core/reflection-controller.js +3 -1
  177. package/dist/core/reflection-controller.js.map +1 -1
  178. package/dist/core/request-auth.d.ts +7 -0
  179. package/dist/core/request-auth.d.ts.map +1 -0
  180. package/dist/core/request-auth.js +8 -0
  181. package/dist/core/request-auth.js.map +1 -0
  182. package/dist/core/resource-loader.d.ts.map +1 -1
  183. package/dist/core/resource-loader.js +16 -6
  184. package/dist/core/resource-loader.js.map +1 -1
  185. package/dist/core/risk-classifier.d.ts.map +1 -1
  186. package/dist/core/risk-classifier.js +8 -0
  187. package/dist/core/risk-classifier.js.map +1 -1
  188. package/dist/core/runtime-builder.d.ts +15 -3
  189. package/dist/core/runtime-builder.d.ts.map +1 -1
  190. package/dist/core/runtime-builder.js +132 -79
  191. package/dist/core/runtime-builder.js.map +1 -1
  192. package/dist/core/sdk.d.ts.map +1 -1
  193. package/dist/core/sdk.js +7 -1
  194. package/dist/core/sdk.js.map +1 -1
  195. package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
  196. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
  197. package/dist/core/secrets/credential-exposure-guard.js +241 -0
  198. package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
  199. package/dist/core/secrets/secret-dotenv.d.ts +27 -0
  200. package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
  201. package/dist/core/secrets/secret-dotenv.js +183 -0
  202. package/dist/core/secrets/secret-dotenv.js.map +1 -0
  203. package/dist/core/secrets/secret-vault-format.d.ts +112 -0
  204. package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
  205. package/dist/core/secrets/secret-vault-format.js +397 -0
  206. package/dist/core/secrets/secret-vault-format.js.map +1 -0
  207. package/dist/core/secrets/secret-vault.d.ts +72 -0
  208. package/dist/core/secrets/secret-vault.d.ts.map +1 -0
  209. package/dist/core/secrets/secret-vault.js +671 -0
  210. package/dist/core/secrets/secret-vault.js.map +1 -0
  211. package/dist/core/session-analytics.d.ts +4 -23
  212. package/dist/core/session-analytics.d.ts.map +1 -1
  213. package/dist/core/session-analytics.js +39 -69
  214. package/dist/core/session-analytics.js.map +1 -1
  215. package/dist/core/session-role.d.ts +5 -0
  216. package/dist/core/session-role.d.ts.map +1 -1
  217. package/dist/core/session-role.js +14 -1
  218. package/dist/core/session-role.js.map +1 -1
  219. package/dist/core/session-tree-navigator.d.ts +4 -6
  220. package/dist/core/session-tree-navigator.d.ts.map +1 -1
  221. package/dist/core/session-tree-navigator.js +4 -1
  222. package/dist/core/session-tree-navigator.js.map +1 -1
  223. package/dist/core/settings-manager.d.ts +1 -1
  224. package/dist/core/settings-manager.d.ts.map +1 -1
  225. package/dist/core/settings-manager.js +1 -1
  226. package/dist/core/settings-manager.js.map +1 -1
  227. package/dist/core/slash-commands.d.ts.map +1 -1
  228. package/dist/core/slash-commands.js +2 -2
  229. package/dist/core/slash-commands.js.map +1 -1
  230. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  231. package/dist/core/tool-capability-policy.js +1 -0
  232. package/dist/core/tool-capability-policy.js.map +1 -1
  233. package/dist/core/tool-gate-controller.d.ts.map +1 -1
  234. package/dist/core/tool-gate-controller.js +8 -2
  235. package/dist/core/tool-gate-controller.js.map +1 -1
  236. package/dist/core/tool-protocol-controller.d.ts +2 -4
  237. package/dist/core/tool-protocol-controller.d.ts.map +1 -1
  238. package/dist/core/tool-protocol-controller.js.map +1 -1
  239. package/dist/core/tool-recovery-stats.d.ts +21 -1
  240. package/dist/core/tool-recovery-stats.d.ts.map +1 -1
  241. package/dist/core/tool-recovery-stats.js.map +1 -1
  242. package/dist/core/tools/bash.d.ts +5 -0
  243. package/dist/core/tools/bash.d.ts.map +1 -1
  244. package/dist/core/tools/bash.js +59 -5
  245. package/dist/core/tools/bash.js.map +1 -1
  246. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  247. package/dist/core/tools/delegate-status.js +6 -7
  248. package/dist/core/tools/delegate-status.js.map +1 -1
  249. package/dist/core/tools/delegate.d.ts.map +1 -1
  250. package/dist/core/tools/delegate.js +6 -8
  251. package/dist/core/tools/delegate.js.map +1 -1
  252. package/dist/core/tools/git-filter.d.ts +1 -8
  253. package/dist/core/tools/git-filter.d.ts.map +1 -1
  254. package/dist/core/tools/git-filter.js +2 -63
  255. package/dist/core/tools/git-filter.js.map +1 -1
  256. package/dist/core/tools/goal.d.ts +5 -3
  257. package/dist/core/tools/goal.d.ts.map +1 -1
  258. package/dist/core/tools/goal.js +97 -19
  259. package/dist/core/tools/goal.js.map +1 -1
  260. package/dist/core/tools/index.d.ts +1 -0
  261. package/dist/core/tools/index.d.ts.map +1 -1
  262. package/dist/core/tools/index.js +1 -0
  263. package/dist/core/tools/index.js.map +1 -1
  264. package/dist/core/tools/orchestration-panel.d.ts +1 -4
  265. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  266. package/dist/core/tools/orchestration-panel.js +0 -44
  267. package/dist/core/tools/orchestration-panel.js.map +1 -1
  268. package/dist/core/tools/output-accumulator.d.ts +11 -0
  269. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  270. package/dist/core/tools/output-accumulator.js +36 -3
  271. package/dist/core/tools/output-accumulator.js.map +1 -1
  272. package/dist/core/tools/python.d.ts +2 -0
  273. package/dist/core/tools/python.d.ts.map +1 -1
  274. package/dist/core/tools/python.js +3 -1
  275. package/dist/core/tools/python.js.map +1 -1
  276. package/dist/core/tools/read.d.ts.map +1 -1
  277. package/dist/core/tools/read.js +1 -1
  278. package/dist/core/tools/read.js.map +1 -1
  279. package/dist/core/tools/search-command-guard.d.ts +14 -0
  280. package/dist/core/tools/search-command-guard.d.ts.map +1 -0
  281. package/dist/core/tools/search-command-guard.js +333 -0
  282. package/dist/core/tools/search-command-guard.js.map +1 -0
  283. package/dist/core/tools/secret-store.d.ts +38 -0
  284. package/dist/core/tools/secret-store.d.ts.map +1 -0
  285. package/dist/core/tools/secret-store.js +412 -0
  286. package/dist/core/tools/secret-store.js.map +1 -0
  287. package/dist/core/tools/shell-command-parser.d.ts +16 -0
  288. package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
  289. package/dist/core/tools/shell-command-parser.js +113 -0
  290. package/dist/core/tools/shell-command-parser.js.map +1 -0
  291. package/dist/core/tools/task-steps.d.ts.map +1 -1
  292. package/dist/core/tools/task-steps.js +4 -7
  293. package/dist/core/tools/task-steps.js.map +1 -1
  294. package/dist/core/util/atomic-file.d.ts +6 -2
  295. package/dist/core/util/atomic-file.d.ts.map +1 -1
  296. package/dist/core/util/atomic-file.js +4 -4
  297. package/dist/core/util/atomic-file.js.map +1 -1
  298. package/dist/index.d.ts +3 -2
  299. package/dist/index.d.ts.map +1 -1
  300. package/dist/index.js +2 -1
  301. package/dist/index.js.map +1 -1
  302. package/dist/main.d.ts.map +1 -1
  303. package/dist/main.js +25 -11
  304. package/dist/main.js.map +1 -1
  305. package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
  306. package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
  307. package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
  308. package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
  309. package/dist/modes/interactive/components/activity-lane.d.ts +55 -0
  310. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
  311. package/dist/modes/interactive/components/activity-lane.js +304 -0
  312. package/dist/modes/interactive/components/activity-lane.js.map +1 -0
  313. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  314. package/dist/modes/interactive/components/assistant-message.js +19 -10
  315. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  316. package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
  317. package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
  318. package/dist/modes/interactive/components/expandable-text.js +17 -0
  319. package/dist/modes/interactive/components/expandable-text.js.map +1 -0
  320. package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
  321. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  322. package/dist/modes/interactive/components/extension-editor.js +30 -21
  323. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  324. package/dist/modes/interactive/components/extension-input.d.ts +1 -0
  325. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/extension-input.js +6 -1
  327. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  328. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  329. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  330. package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
  331. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  332. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  333. package/dist/modes/interactive/components/settings-selector.js +4 -4
  334. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  335. package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
  336. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  337. package/dist/modes/interactive/components/tool-execution.js +53 -20
  338. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  339. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
  340. package/dist/modes/interactive/components/tool-group.js +3 -0
  341. package/dist/modes/interactive/components/tool-group.js.map +1 -1
  342. package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
  343. package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
  344. package/dist/modes/interactive/components/usage-action-selector.js +46 -0
  345. package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
  346. package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
  347. package/dist/modes/interactive/extension-ui-host.js +1 -0
  348. package/dist/modes/interactive/extension-ui-host.js.map +1 -1
  349. package/dist/modes/interactive/external-editor.d.ts +15 -0
  350. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  351. package/dist/modes/interactive/external-editor.js +27 -19
  352. package/dist/modes/interactive/external-editor.js.map +1 -1
  353. package/dist/modes/interactive/history-reload-math.d.ts +6 -2
  354. package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
  355. package/dist/modes/interactive/history-reload-math.js +10 -5
  356. package/dist/modes/interactive/history-reload-math.js.map +1 -1
  357. package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
  358. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
  359. package/dist/modes/interactive/interactive-event-controller.js +328 -0
  360. package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
  361. package/dist/modes/interactive/interactive-mode.d.ts +20 -25
  362. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  363. package/dist/modes/interactive/interactive-mode.js +196 -608
  364. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  365. package/dist/modes/interactive/loaded-resources-view.d.ts +20 -0
  366. package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
  367. package/dist/modes/interactive/loaded-resources-view.js +147 -0
  368. package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
  369. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  370. package/dist/modes/interactive/resource-display.js +8 -2
  371. package/dist/modes/interactive/resource-display.js.map +1 -1
  372. package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
  373. package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
  374. package/dist/modes/interactive/resource-shell-commands.js +0 -5
  375. package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
  376. package/dist/modes/interactive/session-flow-commands.d.ts +10 -6
  377. package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
  378. package/dist/modes/interactive/session-flow-commands.js +123 -70
  379. package/dist/modes/interactive/session-flow-commands.js.map +1 -1
  380. package/dist/modes/interactive/usage-commands.d.ts +34 -0
  381. package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
  382. package/dist/modes/interactive/usage-commands.js +225 -0
  383. package/dist/modes/interactive/usage-commands.js.map +1 -0
  384. package/dist/utils/shell.d.ts.map +1 -1
  385. package/dist/utils/shell.js +5 -3
  386. package/dist/utils/shell.js.map +1 -1
  387. package/dist/utils/version-check.d.ts.map +1 -1
  388. package/dist/utils/version-check.js +3 -1
  389. package/dist/utils/version-check.js.map +1 -1
  390. package/docs/UI_POLISH_ORCHESTRATION.md +25 -31
  391. package/docs/UI_QUALITY_ORCHESTRATION.md +22 -24
  392. package/docs/providers.md +9 -1
  393. package/docs/ui-reference/README.md +6 -6
  394. package/docs/ui-reference/orchestration-after.txt +14 -7
  395. package/docs/ui-reference/orchestration-before.txt +12 -6
  396. package/docs/ui-reference/orchestration-reference.txt +15 -5
  397. package/docs/usage.md +9 -1
  398. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  399. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  400. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  401. package/examples/extensions/sandbox/package-lock.json +2 -2
  402. package/examples/extensions/sandbox/package.json +1 -1
  403. package/examples/extensions/with-deps/package-lock.json +2 -2
  404. package/examples/extensions/with-deps/package.json +1 -1
  405. package/npm-shrinkwrap.json +13 -13
  406. package/package.json +4 -4
@@ -1,9 +1,9 @@
1
- import type { Agent, AgentEvent, AgentLoopConfig, AgentMessage, AgentState, AgentTool, StreamIdleOptions, ThinkingLevel } from "@caupulican/pi-agent-core";
1
+ import type { Agent, AgentMessage, AgentState, StreamIdleOptions, ThinkingLevel } from "@caupulican/pi-agent-core";
2
2
  import { type CustomMessage } from "@caupulican/pi-agent-core";
3
3
  import type { BranchSummaryEntry, CompactionResult, SessionManager } from "@caupulican/pi-agent-core/node";
4
- import type { Api, CacheRetention, ImageContent, Message, Model, StopReason, TextContent, Usage } from "@caupulican/pi-ai";
4
+ import type { Api, ImageContent, Model, TextContent, Usage } from "@caupulican/pi-ai";
5
5
  import type { CapabilityEnvelope, EvidenceBundle, LearningDecision, WorkerClaim, WorkerRequest } from "./autonomy/contracts.ts";
6
- import type { LaneRecord, LaneTerminalStatus } from "./autonomy/lane-tracker.ts";
6
+ import type { LaneRecord } from "./autonomy/lane-tracker.ts";
7
7
  import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot, GateOutcomeHistoryEntry } from "./autonomy/status.ts";
8
8
  import type { BashResult } from "./bash-executor.ts";
9
9
  import type { CurationTelemetrySnapshot } from "./context/brain-curator.ts";
@@ -19,12 +19,11 @@ import type { SessionCostSummary } from "./cost/cost-summary.ts";
19
19
  import type { DailyUsageTotals } from "./cost/daily-usage.ts";
20
20
  import { type CostGuardDecision } from "./cost-guard.ts";
21
21
  import type { WorkerDelegationRequest } from "./delegation/worker-delegation-request.ts";
22
- import type { WorkerRunOutcome } from "./delegation/worker-runner.ts";
23
- import type { ContextUsage, ExtensionCommandContextActions, ExtensionContext, ExtensionErrorListener, ExtensionRunner, ExtensionUIContext, InputSource, ReplacedSessionContext, SessionStartEvent, ShutdownHandler, ToolDefinition, ToolInfo } from "./extensions/index.ts";
22
+ import type { ContextUsage, ExtensionRunner, ReplacedSessionContext, ToolDefinition, ToolInfo } from "./extensions/index.ts";
24
23
  import { type ChannelProvider, GatewayRegistry, type JobSchedulerProvider } from "./gateways/channel-provider.ts";
25
- import type { GoalContinuationPrompt, GoalContinuationPromptLimits } from "./goals/goal-continuation-prompt.ts";
26
- import { type GoalRuntimeSnapshot, type GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts";
27
- import { type GoalState } from "./goals/goal-state.ts";
24
+ import type { GoalStateRevision } from "./goals/goal-lifecycle.ts";
25
+ import type { GoalRuntimeSnapshot, GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts";
26
+ import type { GoalState } from "./goals/goal-state.ts";
28
27
  import type { LearningAuditRecord } from "./learning/learning-audit.ts";
29
28
  import type { DemandSignals, ReflectionResult } from "./learning/reflection-engine.ts";
30
29
  import { type CurationProposals } from "./learning/skill-curator.ts";
@@ -33,15 +32,11 @@ import { type LaneWorkerRefusal, type ModelCapabilityProfile } from "./model-cap
33
32
  import type { ModelRegistry } from "./model-registry.ts";
34
33
  import type { StoredFitnessReport } from "./models/fitness-store.ts";
35
34
  import type { PrismLlamaCppRuntime } from "./models/llamacpp-runtime.ts";
36
- import type { LocalRuntimeDeps, OllamaRuntime, TransformersRuntime } from "./models/local-runtime.ts";
37
- import type { OrchestrationProfile } from "./orchestration/contracts.ts";
35
+ import type { OllamaRuntime, TransformersRuntime } from "./models/local-runtime.ts";
38
36
  import { type PromptTemplate } from "./prompt-templates.ts";
39
37
  import type { ModelFitnessReport } from "./research/model-fitness.ts";
40
- import type { ResearchRunResult } from "./research/research-runner.ts";
41
- import { collectWorkspaceSources } from "./research/workspace-collector.ts";
42
38
  import type { ResourceLoader } from "./resource-loader.ts";
43
- import { type ToolArgumentValidationStats } from "./session-analytics.ts";
44
- import type { ResourceProfileFilterSettings, SettingsManager } from "./settings-manager.ts";
39
+ import type { SettingsManager } from "./settings-manager.ts";
45
40
  import { type TaskStepsState } from "./tasks/task-state.ts";
46
41
  import { type ToolProbeReport } from "./tool-protocol-controller.ts";
47
42
  import type { BashOperations } from "./tools/bash.ts";
@@ -52,380 +47,9 @@ import type { BashOperations } from "./tools/bash.ts";
52
47
  * may be set or changed at any time before the request that should observe it.
53
48
  */
54
49
  export declare function setStreamIdleOptionsForTests(opts: Partial<StreamIdleOptions> | undefined): void;
55
- /** Parsed skill block from a user message */
56
- export interface ParsedSkillBlock {
57
- name: string;
58
- location: string;
59
- content: string;
60
- userMessage: string | undefined;
61
- }
62
- /**
63
- * Parse a skill block from message text.
64
- * Returns null if the text doesn't contain a skill block.
65
- */
66
- export declare function parseSkillBlock(text: string): ParsedSkillBlock | null;
67
- /** Session-specific events that extend the core AgentEvent */
68
- export type AgentSessionEvent = Exclude<AgentEvent, {
69
- type: "agent_end";
70
- }> | {
71
- type: "agent_end";
72
- messages: AgentMessage[];
73
- willRetry: boolean;
74
- } | {
75
- type: "queue_update";
76
- steering: readonly string[];
77
- followUp: readonly string[];
78
- commands: readonly string[];
79
- } | {
80
- type: "compaction_start";
81
- reason: "manual" | "threshold" | "overflow";
82
- } | {
83
- type: "session_info_changed";
84
- name: string | undefined;
85
- } | {
86
- type: "thinking_level_changed";
87
- level: ThinkingLevel;
88
- } | {
89
- type: "warning";
90
- message: string;
91
- } | {
92
- type: "compaction_end";
93
- reason: "manual" | "threshold" | "overflow";
94
- result: CompactionResult | undefined;
95
- aborted: boolean;
96
- willRetry: boolean;
97
- errorMessage?: string;
98
- /**
99
- * Benign no-op explanation for auto-compaction (e.g. "nothing to compact yet"). Auto
100
- * bails must never be silent: without a result, either errorMessage (real failure) or
101
- * skipReason (harmless skip) is set so the UI can show why nothing changed.
102
- */
103
- skipReason?: string;
104
- } | {
105
- type: "auto_retry_start";
106
- attempt: number;
107
- maxAttempts: number;
108
- delayMs: number;
109
- errorMessage: string;
110
- } | {
111
- type: "auto_retry_end";
112
- success: boolean;
113
- attempt: number;
114
- finalError?: string;
115
- } | {
116
- type: "routing_start";
117
- } | {
118
- type: "routing_end";
119
- } | {
120
- type: "delegate_workers";
121
- active: number;
122
- queued: number;
123
- running: number;
124
- completedSinceFlush: number;
125
- failedSinceFlush: number;
126
- terminalSinceFlush: Array<{
127
- laneId: string;
128
- status: LaneTerminalStatus;
129
- reasonCode?: string;
130
- }>;
131
- };
132
- /** Listener function for agent session events */
133
- export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
134
- export interface AgentSessionConfig {
135
- agent: Agent;
136
- sessionManager: SessionManager;
137
- settingsManager: SettingsManager;
138
- cwd: string;
139
- /** User-level agent state directory for generated runtime artifacts. */
140
- agentDir?: string;
141
- /** Models to cycle through with Ctrl+P (from --models flag) */
142
- scopedModels?: Array<{
143
- model: Model<Api>;
144
- thinkingLevel?: ThinkingLevel;
145
- }>;
146
- /** Resource loader for skills, prompts, themes, context files, system prompt */
147
- resourceLoader: ResourceLoader;
148
- /** SDK custom tools registered outside extensions */
149
- customTools?: ToolDefinition[];
150
- /** Model registry for API key resolution and model discovery */
151
- modelRegistry: ModelRegistry;
152
- /** Initial active built-in tool names. Default: [read, bash, edit, write, context_audit, goal] */
153
- initialActiveToolNames?: string[];
154
- /** Optional allowlist of tool names. When provided, only these tool names are exposed. */
155
- allowedToolNames?: string[];
156
- /** Optional denylist of tool names. When provided, these tool names are not exposed. */
157
- excludedToolNames?: string[];
158
- /** Optional resource-profile allow/block filters for tool names. */
159
- toolProfileFilter?: ResourceProfileFilterSettings;
160
- /**
161
- * Whether the model/thinking level came from an explicit launch flag. When false, the active
162
- * profile's model/thinking is re-applied on reload() so live profile edits take effect; when
163
- * true, the explicit launch-time choice is preserved.
164
- */
165
- isExplicitModel?: boolean;
166
- isExplicitThinking?: boolean;
167
- /** True when this session is a spawned subagent/child — gates durable memory writes. */
168
- isChildSession?: boolean;
169
- /**
170
- * Override base tools (useful for custom runtimes).
171
- *
172
- * These are synthesized into minimal ToolDefinitions internally so AgentSession can keep
173
- * a definition-first registry even when callers provide plain AgentTool instances.
174
- */
175
- baseToolsOverride?: Record<string, AgentTool>;
176
- /** Mutable ref used by Agent to access the current ExtensionRunner */
177
- extensionRunnerRef?: {
178
- current?: ExtensionRunner;
179
- };
180
- /** Session start event metadata emitted when extensions bind to this runtime. */
181
- sessionStartEvent?: SessionStartEvent;
182
- /**
183
- * Pointer-first workspace source collector for the autonomous research lane. Injected in unit
184
- * tests so they don't spawn a real ripgrep child (which would escape fake timers); production
185
- * defaults to the real, best-effort collector.
186
- */
187
- collectWorkspaceSources?: typeof collectWorkspaceSources;
188
- /** Immutable owner-authored orchestration policy; dispatch cannot mutate it. */
189
- orchestrationProfile?: OrchestrationProfile;
190
- /**
191
- * Injected fetch/spawn/exists for the local (Ollama) runtime health-check + boot used by the
192
- * model router before a turn routed to a local model (see LocalRuntimeController.ensureLocalModelReady).
193
- * Unit tests inject fakes so they never hit a real network/process; production defaults to the real ones.
194
- */
195
- localRuntimeDeps?: LocalRuntimeDeps;
196
- }
197
- export interface ExtensionBindings {
198
- uiContext?: ExtensionUIContext;
199
- mode?: ExtensionContext["mode"];
200
- commandContextActions?: ExtensionCommandContextActions;
201
- abortHandler?: () => void;
202
- shutdownHandler?: ShutdownHandler;
203
- onError?: ExtensionErrorListener;
204
- }
205
- /** Options for AgentSession.prompt() */
206
- export interface PromptOptions {
207
- /** Whether to expand file-based prompt templates and skills (default: true). */
208
- expandPromptTemplates?: boolean;
209
- /** Whether slash commands should be handled before sending to the model. Defaults to expandPromptTemplates. */
210
- processSlashCommands?: boolean;
211
- /** Image attachments */
212
- images?: ImageContent[];
213
- /** When streaming, how to queue the message: "steer" (interrupt) or "followUp" (wait). Required if streaming. */
214
- streamingBehavior?: "steer" | "followUp";
215
- /** Source of input for extension input event handlers. Defaults to "interactive". */
216
- source?: InputSource;
217
- /** Internal hook used by RPC mode to observe prompt preflight acceptance or rejection. */
218
- preflightResult?: (success: boolean) => void;
219
- /** Whether an idle active goal should auto-inject bounded continuation prompts after this prompt settles. Default: true. */
220
- autoContinueGoal?: boolean;
221
- }
50
+ export * from "./agent-session-contracts.ts";
51
+ import type { AgentSessionConfig, AgentSessionEventListener, ExtensionBindings, GoalContinuationLoopOptions, GoalContinuationLoopResult, GoalContinuationOnceOptions, GoalContinuationOnceResult, IsolatedCompletionOptions, IsolatedCompletionResult, ModelCycleResult, PromptOptions, ResearchLaneRunOutcome, SessionStats, SpawnedUsageTotals, WorkerDelegationRunOutcome } from "./agent-session-contracts.ts";
222
52
  export type { ToolProbeReport, ToolProbeResult, ToolProbeVerdict } from "./tool-protocol-controller.ts";
223
- /** Result from cycleModel() */
224
- export interface ModelCycleResult {
225
- model: Model<Api>;
226
- thinkingLevel: ThinkingLevel;
227
- /** Whether cycling through scoped models (--models flag) or all available */
228
- isScoped: boolean;
229
- }
230
- /** Session statistics for /session command */
231
- export interface CompactionGateCheckStats {
232
- failures: number;
233
- minScore?: number;
234
- maxScore?: number;
235
- threshold?: number;
236
- comparator?: "minimum" | "maximum";
237
- }
238
- export interface CompactionGateStats {
239
- gateFailures: number;
240
- deterministicGapFills: number;
241
- compactionsWithGateFailures: number;
242
- checks: Record<string, CompactionGateCheckStats>;
243
- }
244
- export interface SessionStats {
245
- sessionFile: string | undefined;
246
- sessionId: string;
247
- userMessages: number;
248
- assistantMessages: number;
249
- toolCalls: number;
250
- toolResults: number;
251
- totalMessages: number;
252
- tokens: {
253
- input: number;
254
- output: number;
255
- cacheRead: number;
256
- cacheWrite: number;
257
- total: number;
258
- };
259
- cost: number;
260
- contextUsage?: ContextUsage;
261
- toolArgumentValidation: ToolArgumentValidationStats;
262
- compactionGates: CompactionGateStats;
263
- }
264
- /** customType for spawned-usage roll-up entries (Cost Aggregation, Model A). */
265
- export declare const SPAWNED_USAGE_CUSTOM_TYPE = "spawned_usage";
266
- /**
267
- * customType for a persisted runaway-loop-backstop entry: the agent loop stopped a turn stuck
268
- * repeating one identical tool-call signature. This is the session-log/telemetry sink for
269
- * {@link Agent.onRunawayStop} — see `_installAgentToolHooks`.
270
- */
271
- export declare const RUNAWAY_STOP_CUSTOM_TYPE = "runaway_stop";
272
- /** Payload persisted for a {@link RUNAWAY_STOP_CUSTOM_TYPE} entry. */
273
- export interface RunawayStopRecord {
274
- signature: string;
275
- repeats: number;
276
- model?: string;
277
- provider?: string;
278
- at: string;
279
- }
280
- /**
281
- * customType for a persisted tool-validation-escalation entry: the agent loop bounced the same
282
- * tool-call validation failure enough times to escalate. This is the session-log/telemetry sink for
283
- * {@link Agent.onToolValidationEscalation} — see `_installAgentToolHooks`.
284
- */
285
- export declare const TOOL_VALIDATION_ESCALATION_CUSTOM_TYPE = "tool_validation_escalation";
286
- /** Payload persisted for a {@link TOOL_VALIDATION_ESCALATION_CUSTOM_TYPE} entry. */
287
- export interface ToolValidationEscalationRecord {
288
- tool: string;
289
- signature: string;
290
- repeats: number;
291
- model: string;
292
- provider: string;
293
- at: string;
294
- }
295
- /**
296
- * A single spawned/subagent usage report, persisted as a `CustomEntry`
297
- * (`customType: "spawned_usage"`). Persistence-only — does NOT enter LLM context.
298
- *
299
- * Single-hop invariant: each report MUST already include the reporter's own usage AND its
300
- * accumulated sub-usage. A child rolls up its grandchildren, then reports once to its direct
301
- * parent. Only the direct parent records the report — never a grandparent — so cost cannot be
302
- * double-counted across levels.
303
- */
304
- export interface SpawnedUsageReport {
305
- /** Cumulative usage attributed to the spawned session (own + its own sub-usage). */
306
- usage: Usage;
307
- /** Human-readable source label for diagnostics (e.g. subagent name). */
308
- label?: string;
309
- /** Session id of the reporting child, if known. */
310
- sourceSessionId?: string;
311
- /** Stable id used to de-duplicate re-reports (retries, double agent_end). */
312
- reportId?: string;
313
- }
314
- /** Aggregated spawned-usage totals derived from `spawned_usage` custom entries. */
315
- export interface SpawnedUsageTotals {
316
- /** Summed `usage.cost.total` across all recorded reports. */
317
- cost: number;
318
- /** Number of distinct reports recorded. */
319
- reports: number;
320
- }
321
- /**
322
- * Options for {@link AgentSession.runIsolatedCompletion} — an LLM call fully isolated from the main
323
- * session. With no tools it is one-shot (reflection); lane callers may supply a bounded child loop.
324
- */
325
- export interface IsolatedCompletionOptions {
326
- /** System prompt for the isolated call. */
327
- systemPrompt: string;
328
- /** The isolated conversation (e.g. the reflection prompt). NOT the main session history. */
329
- messages: Message[];
330
- /** Model to use. Defaults to the session model; callers should pass a cheap model. */
331
- model?: Model<Api>;
332
- /** Thinking level. Defaults to "off" to keep the call cheap. */
333
- thinkingLevel?: ThinkingLevel;
334
- /** Output token cap. */
335
- maxTokens?: number;
336
- /** Fresh tools owned by the isolated child. Omitted/empty preserves one-shot behavior. */
337
- tools?: AgentTool[];
338
- /** Maximum assistant turns for a tool-enabled child loop. Ignored by one-shot calls. */
339
- maxTurns?: number;
340
- /**
341
- * Optional tool-free finalization prompt. When the bounded child loop exhausts its turns on an
342
- * assistant tool-call message with no text, one final provider call receives the gathered transcript
343
- * plus this prompt so useful work is not discarded solely for lacking a terminal summary.
344
- */
345
- finalTextPrompt?: string;
346
- /** Child-only capability/path gate. Never inherited from the foreground session. */
347
- beforeToolCall?: AgentLoopConfig["beforeToolCall"];
348
- /** Child-only result observer (for example, successful scoped-write accounting). */
349
- afterToolCall?: AgentLoopConfig["afterToolCall"];
350
- /** Abort signal. */
351
- signal?: AbortSignal;
352
- /**
353
- * Prompt-cache retention for this isolated call. REQUIRED — the provider-level default is
354
- * `"short"`, the opposite of this primitive's old implicit default, so a caller that forgot to
355
- * set it would silently pay full input price forever. Pass `"none"` explicitly to preserve full
356
- * isolation (no caching); callers whose `systemPrompt` is STATIC across calls (e.g. reflection,
357
- * #33) should pass `"short"`/`"long"` so the provider reuses the cached prefix and bills only the
358
- * variable tail.
359
- */
360
- cacheRetention: CacheRetention;
361
- /**
362
- * Lane/caller kind (e.g. `"reflection"`, `"research"`, `"worker"`, `"fitness"`) used to derive this
363
- * call's synthetic cache-affinity key (see {@link computeLaneAffinityKey}). Omitted callers fall
364
- * back to {@link DEFAULT_ISOLATED_LANE_KIND} — still a stable, namespaced key, just not
365
- * lane-differentiated. Never the real session id.
366
- */
367
- laneKind?: string;
368
- }
369
- /** Fallback {@link IsolatedCompletionOptions.laneKind} for callers that do not tag their lane. */
370
- export declare const DEFAULT_ISOLATED_LANE_KIND = "isolated";
371
- /**
372
- * Derive a STABLE synthetic cache-affinity key for an isolated completion lane. Isolated calls
373
- * deliberately never carry the real session id (see reflection-controller.ts's isolation invariants —
374
- * an isolated call must not entangle with the main session), which today also means every isolated
375
- * call looks like a brand-new, uncorrelated session to providers with session-affinity headers /
376
- * `prompt_cache_key` (anthropic.ts's `x-session-affinity`, openai-responses.ts /
377
- * openai-completions.ts's `prompt_cache_key`), defeating their cache routing.
378
- *
379
- * This key is deterministic per `(laneKind, model, systemPrompt)` — the SAME lane calling the SAME
380
- * model with the SAME (static) system prompt always gets the SAME key, so repeat calls route to the
381
- * same cache-warm backend — while remaining fully synthetic: it is a salted hash, namespaced with a
382
- * `lane:` prefix, and never derived from or equal to the real session id.
383
- */
384
- export declare function computeLaneAffinityKey(laneKind: string, model: Model<Api> | undefined, systemPrompt: string): string;
385
- /** Result of an isolated completion: the text, the usage spent, and the stop reason. */
386
- export interface IsolatedCompletionResult {
387
- text: string;
388
- usage: Usage;
389
- stopReason: StopReason;
390
- }
391
- export interface ResearchLaneRunOutcome {
392
- /** False when the pass was skipped before starting (see skipReason). */
393
- started: boolean;
394
- skipReason?: string;
395
- /** Terminal lane record when the pass ran. */
396
- record?: LaneRecord;
397
- result?: ResearchRunResult;
398
- }
399
- export interface WorkerDelegationRunOutcome {
400
- /** False when the delegation was skipped before starting (see skipReason). */
401
- started: boolean;
402
- skipReason?: string;
403
- /** Terminal lane record when the delegation ran. */
404
- record?: LaneRecord;
405
- outcome?: WorkerRunOutcome;
406
- }
407
- export interface GoalContinuationOnceOptions {
408
- maxStallTurns: number;
409
- promptLimits?: GoalContinuationPromptLimits;
410
- }
411
- export interface GoalContinuationOnceResult {
412
- submitted: boolean;
413
- snapshot: GoalRuntimeSnapshot;
414
- prompt?: GoalContinuationPrompt;
415
- }
416
- export type GoalContinuationLoopStopReason = "continuation_not_allowed" | "max_turns_reached" | "wall_clock_budget_reached" | "goal_state_not_advanced" | "goal_budget_exhausted" | "already_continuing" | "session_disposed" | "goal_tool_unavailable" | "worker_in_flight";
417
- export interface GoalContinuationLoopOptions extends GoalContinuationOnceOptions {
418
- maxTurns: number;
419
- /** 0 or undefined disables wall-clock budget. */
420
- maxWallClockMinutes?: number;
421
- /** Test seam for wall-clock budget enforcement. Defaults to Date.now. */
422
- now?: () => number;
423
- }
424
- export interface GoalContinuationLoopResult {
425
- turnsSubmitted: number;
426
- stopReason: GoalContinuationLoopStopReason;
427
- finalSnapshot: GoalRuntimeSnapshot;
428
- }
429
53
  export declare class AgentSession {
430
54
  readonly agent: Agent;
431
55
  readonly sessionManager: SessionManager;
@@ -440,9 +64,6 @@ export declare class AgentSession {
440
64
  private _queuedExtensionCommands;
441
65
  private _pendingNextTurnMessages;
442
66
  private _streamingPromptSubmissionTail;
443
- /** Serializes owner-input overlays so concurrent worker terminals cannot replace each other. */
444
- private _humanInputTail;
445
- private _activeHumanInputRequestIds;
446
67
  /**
447
68
  * The last tool set requested via setActiveToolsByName BEFORE model-capability filtering, so
448
69
  * switching from a small-window model back to a large one restores the full requested set.
@@ -479,6 +100,7 @@ export declare class AgentSession {
479
100
  * background-lane-controller.ts); owns the lane timers/guards, the last research-lane skip
480
101
  * reason, the live LaneTracker, and the in-flight research/worker abort controllers. */
481
102
  private readonly _backgroundLanes;
103
+ private readonly _humanInput;
482
104
  /** Plug-and-play memory subsystem (see memory-controller.ts); owns the OKF retrieval provider, the
483
105
  * latest retrieval/prompt-inclusion reports, the reload-safe MemoryManager, the recall
484
106
  * effectiveness tracker, and the extension-contributed pending providers. */
@@ -525,9 +147,8 @@ export declare class AgentSession {
525
147
  /** Native reflection engine + learning-apply/rollback path (see reflection-controller.ts); owns no
526
148
  * session state, applies durable writes through the bundled memory tool and the session log. */
527
149
  private readonly _reflection;
528
- /** Bounded goal auto-continuation loop (see goal-loop-controller.ts); reads goal state fresh
529
- * each pass and re-enters the session's own prompt path. */
530
- private readonly _goalContinuation;
150
+ /** Durable goal lifecycle, accounting, and raw continuation loop. */
151
+ private readonly _goals;
531
152
  private readonly _isChildSession;
532
153
  private _baseToolsOverride?;
533
154
  private _sessionStartEvent;
@@ -901,10 +522,6 @@ export declare class AgentSession {
901
522
  */
902
523
  private _buildSystemPromptForToolNames;
903
524
  private _runAgentPrompt;
904
- private _queueWorkerHumanInput;
905
- private _schedulePendingWorkerHumanInputs;
906
- private _scheduleWorkerHumanInput;
907
- private _resolveWorkerHumanInput;
908
525
  /**
909
526
  * Re-enter an interrupted ask_question call from its durable request snapshot. Pending requests
910
527
  * are presented again; already-checkpointed answers are replayed without asking twice. The
@@ -1208,26 +825,30 @@ export declare class AgentSession {
1208
825
  *
1209
826
  * @returns the id of the appended custom entry
1210
827
  */
1211
- saveGoalStateSnapshot(state: GoalState): string;
828
+ saveGoalStateSnapshot(state: GoalState, expected?: GoalStateRevision): string;
829
+ /** Persist a branch-scoped tombstone and stop goal-owned execution without resurrecting old state. */
830
+ clearGoalStateSnapshot(state: GoalState, now: string): string;
1212
831
  /**
1213
832
  * Retrieve the latest valid goal state snapshot from the session log.
1214
833
  */
1215
834
  getGoalStateSnapshot(): GoalState | undefined;
1216
835
  /**
1217
- * Persist one submitted continuation pass's turn/wall-clock/spend contribution onto the active
1218
- * goal's durable cumulative budget (see `GoalState.continuationTurnsUsed` et al.). This is the
836
+ * Persist one submitted continuation pass's exact turn/wall-clock/token/spend contribution onto the active
837
+ * goal's durable cumulative accounting (see `GoalState.continuationTurnsUsed` et al.). This is the
1219
838
  * "persistence dep" `GoalLoopController` calls once per pass actually submitted — it, not the
1220
- * loop controller, is where USD gets attributed: it reads the session's OWN cumulative model
1221
- * spend (`getCostSummary().ownCost` — deliberately excludes worker/subagent spend, which is
1222
- * tracked and budgeted separately) and threads that single absolute reading into a
1223
- * `record_continuation_budget` event; the pure reducer in `goal-state.ts` derives the delta.
839
+ * loop controller, is where usage gets attributed: it scans only assistant messages appended on
840
+ * the active branch after the pass's captured cursor. Compaction cannot erase or reattribute that
841
+ * append-only interval, and unrelated foreground turns outside the interval are excluded.
1224
842
  * A no-op when no goal state exists (defensive — in practice this is only ever called right
1225
843
  * after a pass the loop already confirmed was submitted against an active goal).
1226
844
  */
1227
845
  recordGoalContinuationPass(pass: {
1228
846
  turns: number;
1229
847
  wallClockMs: number;
848
+ usageCursor: string | null;
1230
849
  }): void;
850
+ /** Restore runtime intent without mutating persisted goal lifecycle state. */
851
+ restoreGoalRuntimeAfterResume(): void;
1231
852
  /** Save native task-step state to the active session log. */
1232
853
  saveTaskStepsStateSnapshot(state: TaskStepsState): string;
1233
854
  /** Retrieve the latest valid native task-step state from the active session log. */
@@ -1313,7 +934,7 @@ export declare class AgentSession {
1313
934
  * continuation. Delegates to {@link BackgroundLaneController.continueGoalLoopExclusive}, the
1314
935
  * single-flight guard that prevents two goal loops from racing to submit prompts through the
1315
936
  * same session (which throws "Agent is already processing" from the second submission). Do not
1316
- * call `this._goalContinuation.continueGoalLoop` directly from here — that bypasses the guard.
937
+ * call `this._goals.continueLoop` directly from here — that bypasses the guard.
1317
938
  */
1318
939
  continueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;
1319
940
  /**