@caupulican/pi-adaptative 0.94.1 → 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +32 -13
  3. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +7 -4
  4. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
  5. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +201 -293
  6. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
  7. package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +272 -392
  8. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts +52 -0
  9. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts.map +1 -0
  10. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js +118 -0
  11. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js.map +1 -0
  12. package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.ts +169 -0
  13. package/dist/bundled-resources/extensions/tmux-agent-manager/templates/builder-validator.json +1 -1
  14. package/dist/bundled-resources/extensions/tmux-agent-manager/templates/provider-prompt-smoke.json +1 -1
  15. package/dist/bundled-resources/extensions/tps/index.d.ts +3 -0
  16. package/dist/bundled-resources/extensions/tps/index.d.ts.map +1 -0
  17. package/dist/bundled-resources/extensions/tps/index.js +44 -0
  18. package/dist/bundled-resources/extensions/tps/index.js.map +1 -0
  19. package/dist/bundled-resources/extensions/tps/index.ts +48 -0
  20. package/dist/bundled-resources/skills/pi-harness-learning/SKILL.md +13 -7
  21. package/dist/bundled-resources/skills/worker-profile-writer/SKILL.md +11 -11
  22. package/dist/core/agent-session-services.d.ts.map +1 -1
  23. package/dist/core/agent-session-services.js +12 -3
  24. package/dist/core/agent-session-services.js.map +1 -1
  25. package/dist/core/agent-session.d.ts +11 -41
  26. package/dist/core/agent-session.d.ts.map +1 -1
  27. package/dist/core/agent-session.js +93 -160
  28. package/dist/core/agent-session.js.map +1 -1
  29. package/dist/core/autonomy/envelope-enforcement.d.ts +6 -1
  30. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  31. package/dist/core/autonomy/envelope-enforcement.js +26 -25
  32. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  33. package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
  34. package/dist/core/autonomy/lane-private-paths.js +2 -1
  35. package/dist/core/autonomy/lane-private-paths.js.map +1 -1
  36. package/dist/core/autonomy/lane-tool-surface.d.ts +8 -8
  37. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  38. package/dist/core/autonomy/lane-tool-surface.js +45 -30
  39. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  40. package/dist/core/autonomy/worker-session-private-scope.d.ts +12 -0
  41. package/dist/core/autonomy/worker-session-private-scope.d.ts.map +1 -0
  42. package/dist/core/autonomy/worker-session-private-scope.js +42 -0
  43. package/dist/core/autonomy/worker-session-private-scope.js.map +1 -0
  44. package/dist/core/autonomy/worker-tool-adapter-registry.d.ts +65 -0
  45. package/dist/core/autonomy/worker-tool-adapter-registry.d.ts.map +1 -0
  46. package/dist/core/autonomy/worker-tool-adapter-registry.js +145 -0
  47. package/dist/core/autonomy/worker-tool-adapter-registry.js.map +1 -0
  48. package/dist/core/background-lane-controller.d.ts +1 -1
  49. package/dist/core/background-lane-controller.d.ts.map +1 -1
  50. package/dist/core/background-lane-controller.js +1 -1
  51. package/dist/core/background-lane-controller.js.map +1 -1
  52. package/dist/core/background-tool-task-controller.d.ts +8 -2
  53. package/dist/core/background-tool-task-controller.d.ts.map +1 -1
  54. package/dist/core/background-tool-task-controller.js +10 -2
  55. package/dist/core/background-tool-task-controller.js.map +1 -1
  56. package/dist/core/compaction-controller.d.ts +3 -0
  57. package/dist/core/compaction-controller.d.ts.map +1 -1
  58. package/dist/core/compaction-controller.js +12 -1
  59. package/dist/core/compaction-controller.js.map +1 -1
  60. package/dist/core/cost-guard-controller.d.ts +37 -0
  61. package/dist/core/cost-guard-controller.d.ts.map +1 -0
  62. package/dist/core/cost-guard-controller.js +71 -0
  63. package/dist/core/cost-guard-controller.js.map +1 -0
  64. package/dist/core/cost-guard.d.ts +9 -4
  65. package/dist/core/cost-guard.d.ts.map +1 -1
  66. package/dist/core/cost-guard.js +7 -3
  67. package/dist/core/cost-guard.js.map +1 -1
  68. package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
  69. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  70. package/dist/core/delegation/worker-attempt-executor.js +0 -1
  71. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  72. package/dist/core/delegation/worker-authority-resolver.d.ts +16 -3
  73. package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
  74. package/dist/core/delegation/worker-authority-resolver.js +114 -55
  75. package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
  76. package/dist/core/delegation/worker-claim.d.ts +1 -2
  77. package/dist/core/delegation/worker-claim.d.ts.map +1 -1
  78. package/dist/core/delegation/worker-claim.js.map +1 -1
  79. package/dist/core/delegation/worker-delegation-controller.d.ts +19 -6
  80. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  81. package/dist/core/delegation/worker-delegation-controller.js +125 -40
  82. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  83. package/dist/core/delegation/worker-delegation-request.d.ts +3 -3
  84. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  85. package/dist/core/delegation/worker-delegation-request.js +13 -19
  86. package/dist/core/delegation/worker-delegation-request.js.map +1 -1
  87. package/dist/core/delegation/worker-execution-policy.d.ts +3 -2
  88. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  89. package/dist/core/delegation/worker-execution-policy.js +54 -39
  90. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  91. package/dist/core/delegation/worker-fleet-limits.d.ts +3 -3
  92. package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -1
  93. package/dist/core/delegation/worker-fleet-limits.js +7 -7
  94. package/dist/core/delegation/worker-fleet-limits.js.map +1 -1
  95. package/dist/core/delegation/worker-machine-scope.d.ts +12 -0
  96. package/dist/core/delegation/worker-machine-scope.d.ts.map +1 -0
  97. package/dist/core/delegation/worker-machine-scope.js +38 -0
  98. package/dist/core/delegation/worker-machine-scope.js.map +1 -0
  99. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
  100. package/dist/core/delegation/worker-recovery-coordinator.js +6 -1
  101. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
  102. package/dist/core/delegation/worker-runner.d.ts +5 -7
  103. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  104. package/dist/core/delegation/worker-runner.js +1 -4
  105. package/dist/core/delegation/worker-runner.js.map +1 -1
  106. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +3 -2
  107. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
  108. package/dist/core/delegation/worker-write-reservation-coordinator.js +50 -25
  109. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
  110. package/dist/core/durable-custom-message-turn-controller.d.ts +6 -0
  111. package/dist/core/durable-custom-message-turn-controller.d.ts.map +1 -1
  112. package/dist/core/durable-custom-message-turn-controller.js +38 -15
  113. package/dist/core/durable-custom-message-turn-controller.js.map +1 -1
  114. package/dist/core/extension-binding-controller.d.ts +5 -1
  115. package/dist/core/extension-binding-controller.d.ts.map +1 -1
  116. package/dist/core/extension-binding-controller.js +15 -0
  117. package/dist/core/extension-binding-controller.js.map +1 -1
  118. package/dist/core/extension-import-authority.d.ts +3 -1
  119. package/dist/core/extension-import-authority.d.ts.map +1 -1
  120. package/dist/core/extension-import-authority.js +15 -0
  121. package/dist/core/extension-import-authority.js.map +1 -1
  122. package/dist/core/extensions/factory-runtime.d.ts.map +1 -1
  123. package/dist/core/extensions/factory-runtime.js +5 -0
  124. package/dist/core/extensions/factory-runtime.js.map +1 -1
  125. package/dist/core/extensions/runner.d.ts.map +1 -1
  126. package/dist/core/extensions/runner.js +1 -0
  127. package/dist/core/extensions/runner.js.map +1 -1
  128. package/dist/core/extensions/types.d.ts +8 -4
  129. package/dist/core/extensions/types.d.ts.map +1 -1
  130. package/dist/core/extensions/types.js.map +1 -1
  131. package/dist/core/foreground-terminal-handoff-controller.d.ts +14 -0
  132. package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
  133. package/dist/core/foreground-terminal-handoff-controller.js +188 -72
  134. package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
  135. package/dist/core/goals/goal-session-controller.d.ts +2 -0
  136. package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
  137. package/dist/core/goals/goal-session-controller.js +8 -0
  138. package/dist/core/goals/goal-session-controller.js.map +1 -1
  139. package/dist/core/goals/goal-tool-core.d.ts +5 -4
  140. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  141. package/dist/core/goals/goal-tool-core.js +23 -19
  142. package/dist/core/goals/goal-tool-core.js.map +1 -1
  143. package/dist/core/keybindings.d.ts +2 -2
  144. package/dist/core/keybindings.d.ts.map +1 -1
  145. package/dist/core/keybindings.js +2 -2
  146. package/dist/core/keybindings.js.map +1 -1
  147. package/dist/core/learning/auto-learn-settings.d.ts +84 -0
  148. package/dist/core/learning/auto-learn-settings.d.ts.map +1 -0
  149. package/dist/core/learning/auto-learn-settings.js +66 -0
  150. package/dist/core/learning/auto-learn-settings.js.map +1 -0
  151. package/dist/core/learning/reflection-engine.d.ts +4 -0
  152. package/dist/core/learning/reflection-engine.d.ts.map +1 -1
  153. package/dist/core/learning/reflection-engine.js +48 -10
  154. package/dist/core/learning/reflection-engine.js.map +1 -1
  155. package/dist/core/local-prefix-warm-controller.d.ts +24 -0
  156. package/dist/core/local-prefix-warm-controller.d.ts.map +1 -0
  157. package/dist/core/local-prefix-warm-controller.js +79 -0
  158. package/dist/core/local-prefix-warm-controller.js.map +1 -0
  159. package/dist/core/memory/providers/file-store.d.ts +2 -0
  160. package/dist/core/memory/providers/file-store.d.ts.map +1 -1
  161. package/dist/core/memory/providers/file-store.js +71 -15
  162. package/dist/core/memory/providers/file-store.js.map +1 -1
  163. package/dist/core/memory/worker-memory-tools.d.ts +5 -0
  164. package/dist/core/memory/worker-memory-tools.d.ts.map +1 -0
  165. package/dist/core/memory/worker-memory-tools.js +5 -0
  166. package/dist/core/memory/worker-memory-tools.js.map +1 -0
  167. package/dist/core/model-capability.d.ts +7 -0
  168. package/dist/core/model-capability.d.ts.map +1 -1
  169. package/dist/core/model-capability.js +12 -0
  170. package/dist/core/model-capability.js.map +1 -1
  171. package/dist/core/model-registry.d.ts.map +1 -1
  172. package/dist/core/model-registry.js +2 -10
  173. package/dist/core/model-registry.js.map +1 -1
  174. package/dist/core/model-router-controller.d.ts +3 -2
  175. package/dist/core/model-router-controller.d.ts.map +1 -1
  176. package/dist/core/model-router-controller.js +3 -2
  177. package/dist/core/model-router-controller.js.map +1 -1
  178. package/dist/core/orchestration/contracts.d.ts +16 -12
  179. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  180. package/dist/core/orchestration/contracts.js +2 -2
  181. package/dist/core/orchestration/contracts.js.map +1 -1
  182. package/dist/core/orchestration/lane-tool-manifests.d.ts +2 -2
  183. package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
  184. package/dist/core/orchestration/lane-tool-manifests.js +6 -1
  185. package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
  186. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  187. package/dist/core/orchestration/profile-registry.js +14 -0
  188. package/dist/core/orchestration/profile-registry.js.map +1 -1
  189. package/dist/core/orchestration/task-profile-writer.d.ts +7 -4
  190. package/dist/core/orchestration/task-profile-writer.d.ts.map +1 -1
  191. package/dist/core/orchestration/task-profile-writer.js +71 -59
  192. package/dist/core/orchestration/task-profile-writer.js.map +1 -1
  193. package/dist/core/orchestration/thinking-level-schema.d.ts +7 -0
  194. package/dist/core/orchestration/thinking-level-schema.d.ts.map +1 -0
  195. package/dist/core/orchestration/thinking-level-schema.js +19 -0
  196. package/dist/core/orchestration/thinking-level-schema.js.map +1 -0
  197. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  198. package/dist/core/orchestration/worker-execution-contract.js +12 -5
  199. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  200. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  201. package/dist/core/profile-filter-controller.js +5 -2
  202. package/dist/core/profile-filter-controller.js.map +1 -1
  203. package/dist/core/provider-prompt-contracts.d.ts +6 -5
  204. package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
  205. package/dist/core/provider-prompt-contracts.js +9 -11
  206. package/dist/core/provider-prompt-contracts.js.map +1 -1
  207. package/dist/core/provider-request-context-controller.d.ts +2 -0
  208. package/dist/core/provider-request-context-controller.d.ts.map +1 -1
  209. package/dist/core/provider-request-context-controller.js +10 -3
  210. package/dist/core/provider-request-context-controller.js.map +1 -1
  211. package/dist/core/reflection-controller.d.ts +56 -27
  212. package/dist/core/reflection-controller.d.ts.map +1 -1
  213. package/dist/core/reflection-controller.js +206 -117
  214. package/dist/core/reflection-controller.js.map +1 -1
  215. package/dist/core/resource-loader.d.ts.map +1 -1
  216. package/dist/core/resource-loader.js +6 -2
  217. package/dist/core/resource-loader.js.map +1 -1
  218. package/dist/core/risk-classifier.d.ts.map +1 -1
  219. package/dist/core/risk-classifier.js +22 -2
  220. package/dist/core/risk-classifier.js.map +1 -1
  221. package/dist/core/runtime-builder.d.ts +1 -0
  222. package/dist/core/runtime-builder.d.ts.map +1 -1
  223. package/dist/core/runtime-builder.js +25 -14
  224. package/dist/core/runtime-builder.js.map +1 -1
  225. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
  226. package/dist/core/secrets/credential-exposure-guard.js +55 -10
  227. package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
  228. package/dist/core/session-role.d.ts +6 -8
  229. package/dist/core/session-role.d.ts.map +1 -1
  230. package/dist/core/session-role.js +8 -18
  231. package/dist/core/session-role.js.map +1 -1
  232. package/dist/core/settings-manager.d.ts +20 -16
  233. package/dist/core/settings-manager.d.ts.map +1 -1
  234. package/dist/core/settings-manager.js +75 -50
  235. package/dist/core/settings-manager.js.map +1 -1
  236. package/dist/core/skill-vault.d.ts +15 -0
  237. package/dist/core/skill-vault.d.ts.map +1 -1
  238. package/dist/core/skill-vault.js +79 -45
  239. package/dist/core/skill-vault.js.map +1 -1
  240. package/dist/core/skills.d.ts +3 -0
  241. package/dist/core/skills.d.ts.map +1 -1
  242. package/dist/core/skills.js +6 -6
  243. package/dist/core/skills.js.map +1 -1
  244. package/dist/core/system-prompt-builder.d.ts +3 -0
  245. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  246. package/dist/core/system-prompt-builder.js +73 -13
  247. package/dist/core/system-prompt-builder.js.map +1 -1
  248. package/dist/core/system-prompt.d.ts.map +1 -1
  249. package/dist/core/system-prompt.js +6 -2
  250. package/dist/core/system-prompt.js.map +1 -1
  251. package/dist/core/tool-capability-policy.d.ts +3 -0
  252. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  253. package/dist/core/tool-capability-policy.js +13 -2
  254. package/dist/core/tool-capability-policy.js.map +1 -1
  255. package/dist/core/toolkit/script-runner.d.ts +2 -1
  256. package/dist/core/toolkit/script-runner.d.ts.map +1 -1
  257. package/dist/core/toolkit/script-runner.js +10 -2
  258. package/dist/core/toolkit/script-runner.js.map +1 -1
  259. package/dist/core/tools/delegate-status.d.ts +1 -1
  260. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  261. package/dist/core/tools/delegate-status.js +1 -1
  262. package/dist/core/tools/delegate-status.js.map +1 -1
  263. package/dist/core/tools/delegate.d.ts +4 -15
  264. package/dist/core/tools/delegate.d.ts.map +1 -1
  265. package/dist/core/tools/delegate.js +111 -73
  266. package/dist/core/tools/delegate.js.map +1 -1
  267. package/dist/core/tools/goal.d.ts +3 -4
  268. package/dist/core/tools/goal.d.ts.map +1 -1
  269. package/dist/core/tools/goal.js +30 -23
  270. package/dist/core/tools/goal.js.map +1 -1
  271. package/dist/core/tools/orchestration-panel.d.ts +7 -0
  272. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  273. package/dist/core/tools/orchestration-panel.js +58 -9
  274. package/dist/core/tools/orchestration-panel.js.map +1 -1
  275. package/dist/core/tools/profile-writer.d.ts +2 -8
  276. package/dist/core/tools/profile-writer.d.ts.map +1 -1
  277. package/dist/core/tools/profile-writer.js +6 -18
  278. package/dist/core/tools/profile-writer.js.map +1 -1
  279. package/dist/core/tools/run-toolkit-script.d.ts +1 -1
  280. package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
  281. package/dist/core/tools/run-toolkit-script.js +2 -2
  282. package/dist/core/tools/run-toolkit-script.js.map +1 -1
  283. package/dist/core/tools/skill-audit.d.ts +28 -1
  284. package/dist/core/tools/skill-audit.d.ts.map +1 -1
  285. package/dist/core/tools/skill-audit.js +56 -12
  286. package/dist/core/tools/skill-audit.js.map +1 -1
  287. package/dist/core/tools/skill.d.ts +12 -1
  288. package/dist/core/tools/skill.d.ts.map +1 -1
  289. package/dist/core/tools/skill.js +52 -0
  290. package/dist/core/tools/skill.js.map +1 -1
  291. package/dist/core/tools/skillify.d.ts.map +1 -1
  292. package/dist/core/tools/skillify.js +16 -7
  293. package/dist/core/tools/skillify.js.map +1 -1
  294. package/dist/core/tools/task-steps.d.ts.map +1 -1
  295. package/dist/core/tools/task-steps.js +2 -1
  296. package/dist/core/tools/task-steps.js.map +1 -1
  297. package/dist/core/tools/tmux-dispatch.d.ts +4 -16
  298. package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
  299. package/dist/core/tools/tmux-dispatch.js +5 -20
  300. package/dist/core/tools/tmux-dispatch.js.map +1 -1
  301. package/dist/core/worktree-sync/codes.d.ts +1 -2
  302. package/dist/core/worktree-sync/codes.d.ts.map +1 -1
  303. package/dist/core/worktree-sync/codes.js +1 -2
  304. package/dist/core/worktree-sync/codes.js.map +1 -1
  305. package/dist/core/worktree-sync/lane-gate.d.ts +4 -8
  306. package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
  307. package/dist/core/worktree-sync/lane-gate.js +5 -51
  308. package/dist/core/worktree-sync/lane-gate.js.map +1 -1
  309. package/dist/index.d.ts +5 -0
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +7 -0
  312. package/dist/index.js.map +1 -1
  313. package/dist/modes/interactive/auto-learn-controller.d.ts +6 -7
  314. package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
  315. package/dist/modes/interactive/auto-learn-controller.js +30 -207
  316. package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
  317. package/dist/modes/interactive/autonomy-commands.js +2 -2
  318. package/dist/modes/interactive/autonomy-commands.js.map +1 -1
  319. package/dist/modes/interactive/components/agents-overlay.d.ts +16 -4
  320. package/dist/modes/interactive/components/agents-overlay.d.ts.map +1 -1
  321. package/dist/modes/interactive/components/agents-overlay.js +108 -29
  322. package/dist/modes/interactive/components/agents-overlay.js.map +1 -1
  323. package/dist/modes/interactive/components/custom-message.js +17 -0
  324. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  325. package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/fitness-role-selector.js +2 -2
  327. package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
  328. package/dist/modes/interactive/components/footer.js +1 -1
  329. package/dist/modes/interactive/components/footer.js.map +1 -1
  330. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  331. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  332. package/dist/modes/interactive/components/settings-selector.js +150 -73
  333. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  334. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  335. package/dist/modes/interactive/interactive-mode.js +5 -4
  336. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  337. package/dist/modes/interactive/report-commands.d.ts.map +1 -1
  338. package/dist/modes/interactive/report-commands.js +8 -4
  339. package/dist/modes/interactive/report-commands.js.map +1 -1
  340. package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
  341. package/dist/modes/interactive/settings-selector-flow.js +10 -0
  342. package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
  343. package/docs/extensions.md +10 -0
  344. package/docs/harness-architecture.md +28 -32
  345. package/docs/index.md +2 -1
  346. package/docs/keybindings.md +2 -0
  347. package/docs/process-matrix.md +8 -6
  348. package/docs/resources.md +1 -1
  349. package/docs/settings.md +61 -51
  350. package/docs/task-steps.md +2 -0
  351. package/docs/tmux-agent-manager.md +48 -41
  352. package/docs/usage.md +1 -1
  353. package/docs/work-lifecycle.md +137 -0
  354. package/docs/worker-profiles.md +8 -6
  355. package/docs/worktree-sync.md +26 -20
  356. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  357. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  358. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  359. package/examples/extensions/sandbox/package-lock.json +2 -2
  360. package/examples/extensions/sandbox/package.json +1 -1
  361. package/examples/extensions/with-deps/package-lock.json +2 -2
  362. package/examples/extensions/with-deps/package.json +1 -1
  363. package/npm-shrinkwrap.json +12 -12
  364. package/package.json +4 -4
  365. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +0 -133
  366. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +0 -1
  367. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +0 -199
  368. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +0 -1
  369. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +0 -312
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-panel.js","sourceRoot":"","sources":["../../../src/core/tools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QACT,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,CAAC;CACD;AAED,MAAM,UAAU,6BAA6B,CAC5C,KAAY,EACZ,KAA8B,EAC9B,OAAqE;IAErE,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,sBAAsB,EAAE,CAAC;IAC3E,OAAO,IAAI,2BAA2B,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,sBAAsB;IACrC,OAAO;QACN,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE;QAChB,UAAU,KAAI,CAAC;KACf,CAAC;AACH,CAAC","sourcesContent":["import type { Component } from \"@caupulican/pi-tui\";\nimport { truncateToWidth, visibleWidth } from \"@caupulican/pi-tui\";\nimport { renderTitleBadge, type TitleBadgeStatus } from \"../../modes/interactive/components/tool-title.ts\";\nimport type { Theme, ThemeColor } from \"../../modes/interactive/theme/theme.ts\";\nimport type { TaskStep } from \"../tasks/task-state.ts\";\n\nexport type OrchestrationRowStatus =\n\t| \"pending\"\n\t| \"queued\"\n\t| \"running\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"succeeded\"\n\t| \"partial\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"timeout\"\n\t| \"budget_exhausted\"\n\t| \"cancelled\"\n\t| \"canceled\"\n\t| \"reviewed\"\n\t| \"info\";\n\nexport interface OrchestrationPanelRow {\n\tstatus: OrchestrationRowStatus;\n\tlabel: string;\n\tsection?: string;\n\tmeta?: readonly string[];\n\tdetails?: readonly string[];\n}\n\nexport interface OrchestrationPanelNotice {\n\tstatus: \"info\" | \"success\" | \"warning\" | \"error\";\n\ttext: string;\n}\n\nexport interface OrchestrationPanelModel {\n\tlabel: string;\n\taction?: string;\n\tstatus?: TitleBadgeStatus;\n\tsummary?: readonly string[];\n\trows?: readonly OrchestrationPanelRow[];\n\tnotices?: readonly OrchestrationPanelNotice[];\n\temptyText?: string;\n\thiddenRowCount?: number;\n}\n\ninterface RowStyle {\n\ticon: string;\n\tcolor: ThemeColor;\n\tstrike?: boolean;\n\tbold?: boolean;\n}\n\nconst ROW_STYLES: Record<OrchestrationRowStatus, RowStyle> = {\n\tpending: { icon: \"○\", color: \"muted\" },\n\tqueued: { icon: \"◌\", color: \"warning\" },\n\trunning: { icon: \"●\", color: \"accent\", bold: true },\n\tin_progress: { icon: \"●\", color: \"accent\", bold: true },\n\tcompleted: { icon: \"✓\", color: \"success\", strike: true },\n\tsucceeded: { icon: \"✓\", color: \"success\" },\n\tpartial: { icon: \"!\", color: \"warning\" },\n\tblocked: { icon: \"!\", color: \"warning\", bold: true },\n\tfailed: { icon: \"×\", color: \"error\", bold: true },\n\ttimeout: { icon: \"×\", color: \"warning\" },\n\tbudget_exhausted: { icon: \"!\", color: \"warning\" },\n\tcancelled: { icon: \"–\", color: \"muted\", strike: true },\n\tcanceled: { icon: \"–\", color: \"muted\", strike: true },\n\treviewed: { icon: \"✓\", color: \"success\" },\n\tinfo: { icon: \"·\", color: \"muted\" },\n};\n\nconst NOTICE_STYLES: Record<OrchestrationPanelNotice[\"status\"], { icon: string; color: ThemeColor }> = {\n\tinfo: { icon: \"·\", color: \"muted\" },\n\tsuccess: { icon: \"✓\", color: \"success\" },\n\twarning: { icon: \"!\", color: \"warning\" },\n\terror: { icon: \"×\", color: \"error\" },\n};\n\nexport function taskStepPanelRow(step: TaskStep): OrchestrationPanelRow {\n\tconst meta = [\n\t\tstep.priority === \"high\" ? \"high priority\" : undefined,\n\t\tstep.owner ? `@${step.owner}` : undefined,\n\t\tstep.requirementIds?.length\n\t\t\t? `${step.requirementIds.length} requirement${step.requirementIds.length === 1 ? \"\" : \"s\"}`\n\t\t\t: undefined,\n\t\tstep.pipelineRunId && step.pipelineStageId ? `${step.pipelineRunId}/${step.pipelineStageId}` : undefined,\n\t\tstep.evidence.length ? `${step.evidence.length} evidence` : undefined,\n\t].filter((value): value is string => value !== undefined);\n\tconst details = [\n\t\t...step.notes.slice(-2).map((note) => `note: ${note}`),\n\t\t...step.evidence.slice(-2).map((evidence) => `evidence: ${evidence}`),\n\t];\n\treturn {\n\t\tstatus: step.status,\n\t\tlabel: step.status === \"in_progress\" ? (step.activeForm ?? step.content) : step.content,\n\t\tmeta,\n\t\tdetails,\n\t};\n}\n\nfunction renderRow(theme: Theme, row: OrchestrationPanelRow, width: number, expanded: boolean): string[] {\n\tconst style = ROW_STYLES[row.status];\n\tconst prefix = ` ${theme.fg(style.color, style.icon)} `;\n\tconst meta = row.meta?.filter(Boolean).join(\" · \") ?? \"\";\n\tconst suffix = meta ? ` ${theme.fg(\"dim\", meta)}` : \"\";\n\tconst labelWidth = Math.max(4, width - visibleWidth(prefix) - visibleWidth(suffix));\n\tconst clippedLabel = truncateToWidth(row.label, labelWidth, \"…\");\n\tlet label = style.bold ? theme.bold(clippedLabel) : clippedLabel;\n\tif (style.strike) label = theme.strikethrough(label);\n\tconst lines = [`${prefix}${theme.fg(style.strike ? \"dim\" : \"text\", label)}${suffix}`];\n\tif (expanded) {\n\t\tfor (const detail of row.details ?? []) {\n\t\t\tlines.push(` ${theme.fg(\"dim\", truncateToWidth(detail, Math.max(4, width - 4), \"…\"))}`);\n\t\t}\n\t}\n\treturn lines;\n}\n\nexport function renderOrchestrationPanelLines(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\twidth: number,\n\texpanded = false,\n): string[] {\n\tconst safeWidth = Math.max(1, width);\n\tconst title = renderTitleBadge(theme, {\n\t\tlabel: model.label,\n\t\taction: model.action,\n\t\tstatus: model.status ?? \"info\",\n\t});\n\tconst summary = model.summary?.filter(Boolean).join(theme.fg(\"dim\", \" · \")) ?? \"\";\n\tconst lines = [summary ? `${title} ${theme.fg(\"dim\", summary)}` : title];\n\tconst rows = model.rows ?? [];\n\tif (rows.length > 0) {\n\t\tlet section: string | undefined;\n\t\tfor (const row of rows) {\n\t\t\tif (row.section && row.section !== section) {\n\t\t\t\tsection = row.section;\n\t\t\t\tlines.push(` ${theme.fg(\"muted\", theme.bold(row.section))}`);\n\t\t\t}\n\t\t\tlines.push(...renderRow(theme, row, safeWidth, expanded));\n\t\t}\n\t} else if (model.emptyText) {\n\t\tlines.push(` ${theme.fg(\"muted\", model.emptyText)}`);\n\t}\n\tif ((model.hiddenRowCount ?? 0) > 0) {\n\t\tlines.push(` ${theme.fg(\"dim\", `… ${model.hiddenRowCount} more`)}`);\n\t}\n\tfor (const notice of model.notices ?? []) {\n\t\tconst style = NOTICE_STYLES[notice.status];\n\t\tlines.push(` ${theme.fg(style.color, style.icon)} ${theme.fg(\"dim\", notice.text)}`);\n\t}\n\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n}\n\nexport class OrchestrationPanelComponent implements Component {\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\tprivate readonly theme: Theme;\n\tprivate readonly model: OrchestrationPanelModel;\n\tprivate readonly expanded: boolean;\n\n\tconstructor(theme: Theme, model: OrchestrationPanelModel, expanded = false) {\n\t\tthis.theme = theme;\n\t\tthis.model = model;\n\t\tthis.expanded = expanded;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = renderOrchestrationPanelLines(this.theme, this.model, width, this.expanded);\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nexport function renderOrchestrationToolResult(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\toptions: { isPartial: boolean; collapse: boolean; expanded: boolean },\n): Component {\n\tif (options.isPartial || options.collapse) return emptyOrchestrationCall();\n\treturn new OrchestrationPanelComponent(theme, model, options.expanded);\n}\n\nexport function emptyOrchestrationCall(): Component {\n\treturn {\n\t\trender: () => [],\n\t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/pi-tui\";\nimport { truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"@caupulican/pi-tui\";\nimport { renderTitleBadge, type TitleBadgeStatus } from \"../../modes/interactive/components/tool-title.ts\";\nimport type { Theme, ThemeColor } from \"../../modes/interactive/theme/theme.ts\";\nimport type { GoalEvidenceRef, Requirement } from \"../goals/goal-state.ts\";\nimport type { TaskStep } from \"../tasks/task-state.ts\";\n\nexport type OrchestrationRowStatus =\n\t| \"pending\"\n\t| \"queued\"\n\t| \"running\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"succeeded\"\n\t| \"partial\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"timeout\"\n\t| \"budget_exhausted\"\n\t| \"cancelled\"\n\t| \"canceled\"\n\t| \"reviewed\"\n\t| \"info\";\n\nexport interface OrchestrationPanelRow {\n\tstatus: OrchestrationRowStatus;\n\tlabel: string;\n\tsection?: string;\n\tmeta?: readonly string[];\n\tdetails?: readonly string[];\n}\n\nexport interface OrchestrationPanelNotice {\n\tstatus: \"info\" | \"success\" | \"warning\" | \"error\";\n\ttext: string;\n}\n\nexport interface OrchestrationPanelModel {\n\tlabel: string;\n\taction?: string;\n\tstatus?: TitleBadgeStatus;\n\tsummary?: readonly string[];\n\trows?: readonly OrchestrationPanelRow[];\n\tnotices?: readonly OrchestrationPanelNotice[];\n\temptyText?: string;\n\thiddenRowCount?: number;\n\t/** Full context shown beneath the title. Detailed inspector surfaces wrap this instead of truncating it. */\n\tdescription?: string;\n\t/** Preserve complete row/detail text across wrapped lines. Compact tool surfaces keep the legacy one-line form. */\n\twrapRows?: boolean;\n}\n\ninterface RowStyle {\n\ticon: string;\n\tcolor: ThemeColor;\n\tstrike?: boolean;\n\tbold?: boolean;\n}\n\nconst ROW_STYLES: Record<OrchestrationRowStatus, RowStyle> = {\n\tpending: { icon: \"○\", color: \"muted\" },\n\tqueued: { icon: \"◌\", color: \"warning\" },\n\trunning: { icon: \"●\", color: \"accent\", bold: true },\n\tin_progress: { icon: \"●\", color: \"accent\", bold: true },\n\tcompleted: { icon: \"✓\", color: \"success\", strike: true },\n\tsucceeded: { icon: \"✓\", color: \"success\" },\n\tpartial: { icon: \"!\", color: \"warning\" },\n\tblocked: { icon: \"!\", color: \"warning\", bold: true },\n\tfailed: { icon: \"×\", color: \"error\", bold: true },\n\ttimeout: { icon: \"×\", color: \"warning\" },\n\tbudget_exhausted: { icon: \"!\", color: \"warning\" },\n\tcancelled: { icon: \"–\", color: \"muted\", strike: true },\n\tcanceled: { icon: \"–\", color: \"muted\", strike: true },\n\treviewed: { icon: \"✓\", color: \"success\" },\n\tinfo: { icon: \"·\", color: \"muted\" },\n};\n\nconst NOTICE_STYLES: Record<OrchestrationPanelNotice[\"status\"], { icon: string; color: ThemeColor }> = {\n\tinfo: { icon: \"·\", color: \"muted\" },\n\tsuccess: { icon: \"✓\", color: \"success\" },\n\twarning: { icon: \"!\", color: \"warning\" },\n\terror: { icon: \"×\", color: \"error\" },\n};\n\nexport function goalRequirementPanelRow(requirement: Requirement): OrchestrationPanelRow {\n\treturn {\n\t\tstatus:\n\t\t\trequirement.status === \"satisfied\" ? \"completed\" : requirement.status === \"blocked\" ? \"blocked\" : \"pending\",\n\t\tlabel: requirement.text,\n\t\tsection: \"Requirements\",\n\t\tmeta: [\n\t\t\trequirement.id,\n\t\t\trequirement.evidenceIds.length > 0 ? `${requirement.evidenceIds.length} evidence` : undefined,\n\t\t\trequirement.boundLaneId ? `worker: ${requirement.boundLaneId}` : undefined,\n\t\t].filter((value): value is string => value !== undefined),\n\t\tdetails: [\n\t\t\trequirement.blockedReason ? `blocked: ${requirement.blockedReason}` : undefined,\n\t\t\trequirement.dependencies?.length ? `depends on: ${requirement.dependencies.join(\", \")}` : undefined,\n\t\t\trequirement.evidenceIds.length ? `evidence: ${requirement.evidenceIds.join(\", \")}` : undefined,\n\t\t].filter((value): value is string => value !== undefined),\n\t};\n}\n\nexport function goalEvidencePanelRow(evidence: GoalEvidenceRef): OrchestrationPanelRow {\n\treturn {\n\t\tstatus: \"reviewed\",\n\t\tlabel: evidence.summary,\n\t\tsection: \"Evidence\",\n\t\tmeta: [\n\t\t\tevidence.id,\n\t\t\tevidence.kind,\n\t\t\tevidence.verified === true ? \"verified\" : evidence.verified === false ? \"unverified\" : undefined,\n\t\t].filter((value): value is string => value !== undefined),\n\t\tdetails: evidence.uri ? [`source: ${evidence.uri}`] : undefined,\n\t};\n}\n\nexport function taskStepPanelRow(step: TaskStep): OrchestrationPanelRow {\n\tconst meta = [\n\t\tstep.priority === \"high\" ? \"high priority\" : undefined,\n\t\tstep.owner ? `@${step.owner}` : undefined,\n\t\tstep.requirementIds?.length\n\t\t\t? `${step.requirementIds.length} requirement${step.requirementIds.length === 1 ? \"\" : \"s\"}`\n\t\t\t: undefined,\n\t\tstep.pipelineRunId && step.pipelineStageId ? `${step.pipelineRunId}/${step.pipelineStageId}` : undefined,\n\t\tstep.evidence.length ? `${step.evidence.length} evidence` : undefined,\n\t].filter((value): value is string => value !== undefined);\n\tconst details = [\n\t\t...step.notes.slice(-2).map((note) => `note: ${note}`),\n\t\t...step.evidence.slice(-2).map((evidence) => `evidence: ${evidence}`),\n\t];\n\treturn {\n\t\tstatus: step.status,\n\t\tlabel: step.status === \"in_progress\" ? (step.activeForm ?? step.content) : step.content,\n\t\tmeta,\n\t\tdetails,\n\t};\n}\n\nfunction styledRowLabel(theme: Theme, text: string, style: RowStyle): string {\n\tlet label = style.bold ? theme.bold(text) : text;\n\tif (style.strike) label = theme.strikethrough(label);\n\treturn theme.fg(style.strike ? \"dim\" : \"text\", label);\n}\n\nfunction renderRow(\n\ttheme: Theme,\n\trow: OrchestrationPanelRow,\n\twidth: number,\n\texpanded: boolean,\n\twrap: boolean,\n): string[] {\n\tconst style = ROW_STYLES[row.status];\n\tconst prefix = ` ${theme.fg(style.color, style.icon)} `;\n\tconst continuationPrefix = \" \".repeat(visibleWidth(prefix));\n\tconst meta = row.meta?.filter(Boolean).join(\" · \") ?? \"\";\n\tconst suffix = meta ? ` ${theme.fg(\"dim\", meta)}` : \"\";\n\tconst labelWidth = Math.max(4, width - visibleWidth(prefix) - visibleWidth(suffix));\n\tconst labelLines = wrap ? wrapTextWithAnsi(row.label, labelWidth) : [truncateToWidth(row.label, labelWidth, \"…\")];\n\tconst firstLabel = labelLines[0] ?? \"\";\n\tconst lines = [`${prefix}${styledRowLabel(theme, firstLabel, style)}${suffix}`];\n\tfor (const continuation of labelLines.slice(1)) {\n\t\tlines.push(`${continuationPrefix}${styledRowLabel(theme, continuation, style)}`);\n\t}\n\tif (expanded) {\n\t\tfor (const detail of row.details ?? []) {\n\t\t\tconst detailLines = wrap\n\t\t\t\t? wrapTextWithAnsi(detail, Math.max(4, width - 4))\n\t\t\t\t: [truncateToWidth(detail, Math.max(4, width - 4), \"…\")];\n\t\t\tfor (const detailLine of detailLines) lines.push(` ${theme.fg(\"dim\", detailLine)}`);\n\t\t}\n\t}\n\treturn lines;\n}\n\nexport function renderOrchestrationPanelLines(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\twidth: number,\n\texpanded = false,\n): string[] {\n\tconst safeWidth = Math.max(1, width);\n\tconst title = renderTitleBadge(theme, {\n\t\tlabel: model.label,\n\t\taction: model.action,\n\t\tstatus: model.status ?? \"info\",\n\t});\n\tconst summary = model.summary?.filter(Boolean).join(theme.fg(\"dim\", \" · \")) ?? \"\";\n\tconst lines = [summary ? `${title} ${theme.fg(\"dim\", summary)}` : title];\n\tif (model.description) {\n\t\tconst descriptionLines = model.wrapRows\n\t\t\t? wrapTextWithAnsi(model.description, Math.max(4, safeWidth - 2))\n\t\t\t: [truncateToWidth(model.description, Math.max(4, safeWidth - 2), \"…\")];\n\t\tfor (const line of descriptionLines) lines.push(` ${theme.fg(\"text\", line)}`);\n\t}\n\tconst rows = model.rows ?? [];\n\tif (rows.length > 0) {\n\t\tlet section: string | undefined;\n\t\tfor (const row of rows) {\n\t\t\tif (row.section && row.section !== section) {\n\t\t\t\tsection = row.section;\n\t\t\t\tlines.push(` ${theme.fg(\"muted\", theme.bold(row.section))}`);\n\t\t\t}\n\t\t\tlines.push(...renderRow(theme, row, safeWidth, expanded, model.wrapRows === true));\n\t\t}\n\t} else if (model.emptyText) {\n\t\tlines.push(` ${theme.fg(\"muted\", model.emptyText)}`);\n\t}\n\tif ((model.hiddenRowCount ?? 0) > 0) {\n\t\tlines.push(` ${theme.fg(\"dim\", `… ${model.hiddenRowCount} more`)}`);\n\t}\n\tfor (const notice of model.notices ?? []) {\n\t\tconst style = NOTICE_STYLES[notice.status];\n\t\tlines.push(` ${theme.fg(style.color, style.icon)} ${theme.fg(\"dim\", notice.text)}`);\n\t}\n\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n}\n\nexport class OrchestrationPanelComponent implements Component {\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\tprivate readonly theme: Theme;\n\tprivate readonly model: OrchestrationPanelModel;\n\tprivate readonly expanded: boolean;\n\n\tconstructor(theme: Theme, model: OrchestrationPanelModel, expanded = false) {\n\t\tthis.theme = theme;\n\t\tthis.model = model;\n\t\tthis.expanded = expanded;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = renderOrchestrationPanelLines(this.theme, this.model, width, this.expanded);\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nexport function renderOrchestrationToolResult(\n\ttheme: Theme,\n\tmodel: OrchestrationPanelModel,\n\toptions: { isPartial: boolean; collapse: boolean; expanded: boolean },\n): Component {\n\tif (options.isPartial || options.collapse) return emptyOrchestrationCall();\n\treturn new OrchestrationPanelComponent(theme, model, options.expanded);\n}\n\nexport function emptyOrchestrationCall(): Component {\n\treturn {\n\t\trender: () => [],\n\t\tinvalidate() {},\n\t};\n}\n"]}
@@ -7,8 +7,9 @@ export interface DelegateProfileInput {
7
7
  task?: string;
8
8
  baseProfileId?: string;
9
9
  model?: TaskProfileCreateInput["model"];
10
+ thinkingLevel?: TaskProfileCreateInput["thinkingLevel"];
11
+ path?: string;
10
12
  toolNames?: readonly string[];
11
- resourceProfileNames?: readonly string[];
12
13
  }
13
14
  export interface DelegateProfileToolDetails extends TaskProfileCreateResult {
14
15
  started: boolean;
@@ -19,13 +20,6 @@ export interface DelegateProfileToolDetails extends TaskProfileCreateResult {
19
20
  export declare function createDelegateProfileParameterSchemas(): {
20
21
  task: Type.TOptional<Type.TString>;
21
22
  baseProfileId: Type.TOptional<Type.TString>;
22
- model: Type.TOptional<Type.TObject<{
23
- provider: Type.TString;
24
- modelId: Type.TString;
25
- thinkingLevel: Type.TUnion<Type.TLiteral<"high" | "low" | "max" | "medium" | "minimal" | "off" | "ultra" | "xhigh">[]>;
26
- }>>;
27
- toolNames: Type.TOptional<Type.TArray<Type.TString>>;
28
- resourceProfileNames: Type.TOptional<Type.TArray<Type.TString>>;
29
23
  };
30
24
  export declare function delegateProfilePanelModel(details: DelegateProfileToolDetails): OrchestrationPanelModel;
31
25
  export declare function formatTaskProfileInspection(inspection: TaskProfileInspection): string;
@@ -1 +1 @@
1
- {"version":3,"file":"profile-writer.d.ts","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQ/B,OAAO,KAAK,EACX,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,eAAO,MAAM,wBAAwB,YAAI,iBAAiB,EAAE,gBAAgB,CAAU,CAAC;AAEvF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,WAAW,oBAAoB;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RATION_MODEL_PROVIDER_LENGTH, ORCHESTRATION_THINKING_LEVELS, } from "../orchestration/contracts.js";
2
+ import { MAX_ORCHESTRATION_IDENTIFIER_LENGTH } from "../orchestration/contracts.js";
3
3
  export const DELEGATE_PROFILE_ACTIONS = ["profile_inspect", "profile_create"];
4
4
  export function createDelegateProfileParameterSchemas() {
5
5
  return {
6
6
  task: Type.Optional(Type.String({ minLength: 1, maxLength: 3_500 })),
7
7
  baseProfileId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH })),
8
- model: Type.Optional(Type.Object({
9
- provider: Type.String({
10
- minLength: 1,
11
- maxLength: MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,
12
- }),
13
- modelId: Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_MODEL_ID_LENGTH }),
14
- thinkingLevel: Type.Union(ORCHESTRATION_THINKING_LEVELS.map((level) => Type.Literal(level))),
15
- }, { additionalProperties: false })),
16
- toolNames: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {
17
- maxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,
18
- })),
19
- resourceProfileNames: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {
20
- maxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,
21
- })),
22
8
  };
23
9
  }
24
10
  export function delegateProfilePanelModel(details) {
@@ -51,7 +37,8 @@ export function delegateProfilePanelModel(details) {
51
37
  }
52
38
  export function formatTaskProfileInspection(inspection) {
53
39
  const bases = inspection.baseProfiles.map((profile) => profile.profileId).join(", ") || "none";
54
- return `Reusable owner-authored bases for profile_create: ${bases}. Native delegate start does not need a base; omit profileId and set authority.role to explorer or implementer. profile_create requires an owner-authored explorer or implementer base. Available configured models: ${inspection.models.length}.`;
40
+ const inheritedTools = inspection.inheritedToolNames.join(", ") || "none";
41
+ return `Optional owner-authored bases for profile_create: ${bases}. Omit baseProfileId to derive the foreground model, reasoning, compatible tools, and machine scope. Effective inherited native tools: ${inheritedTools}. Optional model, thinkingLevel, path, and toolNames fields narrow that inherited base. Available configured models: ${inspection.models.length}.`;
55
42
  }
56
43
  export function executeDelegateProfileAction(action, input, writer) {
57
44
  if (action === "profile_inspect") {
@@ -82,8 +69,9 @@ export function executeDelegateProfileAction(action, input, writer) {
82
69
  task: input.task,
83
70
  ...(input.baseProfileId !== undefined ? { baseProfileId: input.baseProfileId } : {}),
84
71
  ...(input.model !== undefined ? { model: input.model } : {}),
72
+ ...(input.thinkingLevel !== undefined ? { thinkingLevel: input.thinkingLevel } : {}),
73
+ ...(input.path !== undefined ? { path: input.path } : {}),
85
74
  ...(input.toolNames !== undefined ? { toolNames: input.toolNames } : {}),
86
- ...(input.resourceProfileNames !== undefined ? { resourceProfileNames: input.resourceProfileNames } : {}),
87
75
  };
88
76
  const result = writer.createTaskProfile(request);
89
77
  return {
@@ -91,7 +79,7 @@ export function executeDelegateProfileAction(action, input, writer) {
91
79
  {
92
80
  type: "text",
93
81
  text: result.created
94
- ? `Created immutable session task profile ${result.profileId} from ${result.baseProfileId}.`
82
+ ? `Created immutable session task profile ${result.profileId} from ${result.baseProfileId ?? "foreground inheritance"}.`
95
83
  : `delegate profile_create rejected the request: ${result.reason}.`,
96
84
  },
97
85
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"profile-writer.js","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,6BAA6B,GAC7B,MAAM,+BAA+B,CAAC;AASvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAU,CAAC;AAmBvF,MAAM,UAAU,qCAAqC;IACpD,OAAO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B,EAAE,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzG,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO;QACN,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM,CAAC,OAAO;oBACnB,CAAC,CAAC,0CAA0C,MAAM,CAAC,SAAS,SAAS,MAAM,CAAC,aAAa,GAAG;oBAC5F,CAAC,CAAC,iDAAiD,MAAM,CAAC,MAAM,GAAG;aACpE;SACD;QACD,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;KACxE,CAAC;AACH,CAAC","sourcesContent":["import { Type } from \"typebox\";\nimport {\n\tMAX_ORCHESTRATION_COLLECTION_LENGTH,\n\tMAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_ID_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\tORCHESTRATION_THINKING_LEVELS,\n} from \"../orchestration/contracts.ts\";\nimport type {\n\tTaskProfileCreateInput,\n\tTaskProfileCreateResult,\n\tTaskProfileInspection,\n\tTaskProfileWriterPort,\n} from \"../orchestration/task-profile-writer.ts\";\nimport type { OrchestrationPanelModel } from \"./orchestration-panel.ts\";\n\nexport const DELEGATE_PROFILE_ACTIONS = [\"profile_inspect\", \"profile_create\"] as const;\n\nexport type DelegateProfileAction = (typeof DELEGATE_PROFILE_ACTIONS)[number];\n\nexport interface DelegateProfileInput {\n\ttask?: string;\n\tbaseProfileId?: string;\n\tmodel?: TaskProfileCreateInput[\"model\"];\n\ttoolNames?: readonly string[];\n\tresourceProfileNames?: readonly string[];\n}\n\nexport interface DelegateProfileToolDetails extends TaskProfileCreateResult {\n\tstarted: boolean;\n\taction: DelegateProfileAction;\n\tkind: \"profile\";\n\tinspection?: TaskProfileInspection;\n}\n\nexport function createDelegateProfileParameterSchemas() {\n\treturn {\n\t\ttask: Type.Optional(Type.String({ minLength: 1, maxLength: 3_500 })),\n\t\tbaseProfileId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH })),\n\t\tmodel: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tprovider: Type.String({\n\t\t\t\t\t\tminLength: 1,\n\t\t\t\t\t\tmaxLength: MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\t\t\t\t\t}),\n\t\t\t\t\tmodelId: Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_MODEL_ID_LENGTH }),\n\t\t\t\t\tthinkingLevel: Type.Union(ORCHESTRATION_THINKING_LEVELS.map((level) => Type.Literal(level))),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\ttoolNames: Type.Optional(\n\t\t\tType.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {\n\t\t\t\tmaxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,\n\t\t\t}),\n\t\t),\n\t\tresourceProfileNames: Type.Optional(\n\t\t\tType.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {\n\t\t\t\tmaxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,\n\t\t\t}),\n\t\t),\n\t};\n}\n\nexport function delegateProfilePanelModel(details: DelegateProfileToolDetails): OrchestrationPanelModel {\n\tif (details.action === \"profile_inspect\") {\n\t\treturn {\n\t\t\tlabel: \"worker profiles\",\n\t\t\taction: \"inspected\",\n\t\t\tstatus: \"success\",\n\t\t\tsummary: [\n\t\t\t\t`${details.inspection?.baseProfiles.length ?? 0} bases`,\n\t\t\t\t`${details.inspection?.models.length ?? 0} models`,\n\t\t\t],\n\t\t};\n\t}\n\treturn {\n\t\tlabel: \"worker profiles\",\n\t\taction: details.created ? \"created\" : \"rejected\",\n\t\tstatus: details.created ? \"success\" : \"warning\",\n\t\trows: details.profileId\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: \"succeeded\",\n\t\t\t\t\t\tlabel: details.profileId,\n\t\t\t\t\t\tmeta: details.baseProfileId ? [`base ${details.baseProfileId}`] : undefined,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: undefined,\n\t\temptyText: details.reason,\n\t};\n}\n\nexport function formatTaskProfileInspection(inspection: TaskProfileInspection): string {\n\tconst bases = inspection.baseProfiles.map((profile) => profile.profileId).join(\", \") || \"none\";\n\treturn `Reusable owner-authored bases for profile_create: ${bases}. Native delegate start does not need a base; omit profileId and set authority.role to explorer or implementer. profile_create requires an owner-authored explorer or implementer base. Available configured models: ${inspection.models.length}.`;\n}\n\nexport function executeDelegateProfileAction(\n\taction: DelegateProfileAction,\n\tinput: DelegateProfileInput,\n\twriter: TaskProfileWriterPort,\n): { content: Array<{ type: \"text\"; text: string }>; details: DelegateProfileToolDetails } {\n\tif (action === \"profile_inspect\") {\n\t\tconst inspection = writer.inspectTaskProfileOptions();\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: formatTaskProfileInspection(inspection),\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: { started: true, action, kind: \"profile\", created: false, inspection },\n\t\t};\n\t}\n\n\tif (input.task === undefined) {\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: \"delegate profile_create requires task\" }],\n\t\t\tdetails: {\n\t\t\t\tstarted: false,\n\t\t\t\taction,\n\t\t\t\tkind: \"profile\",\n\t\t\t\tcreated: false,\n\t\t\t\treason: \"missing_profile_task\",\n\t\t\t},\n\t\t};\n\t}\n\tconst request: TaskProfileCreateInput = {\n\t\ttask: input.task,\n\t\t...(input.baseProfileId !== undefined ? { baseProfileId: input.baseProfileId } : {}),\n\t\t...(input.model !== undefined ? { model: input.model } : {}),\n\t\t...(input.toolNames !== undefined ? { toolNames: input.toolNames } : {}),\n\t\t...(input.resourceProfileNames !== undefined ? { resourceProfileNames: input.resourceProfileNames } : {}),\n\t};\n\tconst result = writer.createTaskProfile(request);\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: result.created\n\t\t\t\t\t? `Created immutable session task profile ${result.profileId} from ${result.baseProfileId}.`\n\t\t\t\t\t: `delegate profile_create rejected the request: ${result.reason}.`,\n\t\t\t},\n\t\t],\n\t\tdetails: { started: result.created, action, kind: \"profile\", ...result },\n\t};\n}\n"]}
1
+ {"version":3,"file":"profile-writer.js","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AASpF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAU,CAAC;AAoBvF,MAAM,UAAU,qCAAqC;IACpD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,mCAAmC,EAAE,CAAC,CAAC;KAC3G,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAmC;IAC5E,IAAI,OAAO,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;QAC1C,OAAO;YACN,KAAK,EAAE,iBAAiB;YACxB,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE;gBACR,G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,CAAC;QACzD,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxE,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO;QACN,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM,CAAC,OAAO;oBACnB,CAAC,CAAC,0CAA0C,MAAM,CAAC,SAAS,SAAS,MAAM,CAAC,aAAa,IAAI,wBAAwB,GAAG;oBACxH,CAAC,CAAC,iDAAiD,MAAM,CAAC,MAAM,GAAG;aACpE;SACD;QACD,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;KACxE,CAAC;AACH,CAAC","sourcesContent":["import { Type } from \"typebox\";\nimport { MAX_ORCHESTRATION_IDENTIFIER_LENGTH } from \"../orchestration/contracts.ts\";\nimport type {\n\tTaskProfileCreateInput,\n\tTaskProfileCreateResult,\n\tTaskProfileInspection,\n\tTaskProfileWriterPort,\n} from \"../orchestration/task-profile-writer.ts\";\nimport type { OrchestrationPanelModel } from \"./orchestration-panel.ts\";\n\nexport const DELEGATE_PROFILE_ACTIONS = [\"profile_inspect\", \"profile_create\"] as const;\n\nexport type DelegateProfileAction = (typeof DELEGATE_PROFILE_ACTIONS)[number];\n\nexport interface DelegateProfileInput {\n\ttask?: string;\n\tbaseProfileId?: string;\n\tmodel?: TaskProfileCreateInput[\"model\"];\n\tthinkingLevel?: TaskProfileCreateInput[\"thinkingLevel\"];\n\tpath?: string;\n\ttoolNames?: readonly string[];\n}\n\nexport interface DelegateProfileToolDetails extends TaskProfileCreateResult {\n\tstarted: boolean;\n\taction: DelegateProfileAction;\n\tkind: \"profile\";\n\tinspection?: TaskProfileInspection;\n}\n\nexport function createDelegateProfileParameterSchemas() {\n\treturn {\n\t\ttask: Type.Optional(Type.String({ minLength: 1, maxLength: 3_500 })),\n\t\tbaseProfileId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH })),\n\t};\n}\n\nexport function delegateProfilePanelModel(details: DelegateProfileToolDetails): OrchestrationPanelModel {\n\tif (details.action === \"profile_inspect\") {\n\t\treturn {\n\t\t\tlabel: \"worker profiles\",\n\t\t\taction: \"inspected\",\n\t\t\tstatus: \"success\",\n\t\t\tsummary: [\n\t\t\t\t`${details.inspection?.baseProfiles.length ?? 0} bases`,\n\t\t\t\t`${details.inspection?.models.length ?? 0} models`,\n\t\t\t],\n\t\t};\n\t}\n\treturn {\n\t\tlabel: \"worker profiles\",\n\t\taction: details.created ? \"created\" : \"rejected\",\n\t\tstatus: details.created ? \"success\" : \"warning\",\n\t\trows: details.profileId\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: \"succeeded\",\n\t\t\t\t\t\tlabel: details.profileId,\n\t\t\t\t\t\tmeta: details.baseProfileId ? [`base ${details.baseProfileId}`] : undefined,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: undefined,\n\t\temptyText: details.reason,\n\t};\n}\n\nexport function formatTaskProfileInspection(inspection: TaskProfileInspection): string {\n\tconst bases = inspection.baseProfiles.map((profile) => profile.profileId).join(\", \") || \"none\";\n\tconst inheritedTools = inspection.inheritedToolNames.join(\", \") || \"none\";\n\treturn `Optional owner-authored bases for profile_create: ${bases}. Omit baseProfileId to derive the foreground model, reasoning, compatible tools, and machine scope. Effective inherited native tools: ${inheritedTools}. Optional model, thinkingLevel, path, and toolNames fields narrow that inherited base. Available configured models: ${inspection.models.length}.`;\n}\n\nexport function executeDelegateProfileAction(\n\taction: DelegateProfileAction,\n\tinput: DelegateProfileInput,\n\twriter: TaskProfileWriterPort,\n): { content: Array<{ type: \"text\"; text: string }>; details: DelegateProfileToolDetails } {\n\tif (action === \"profile_inspect\") {\n\t\tconst inspection = writer.inspectTaskProfileOptions();\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: formatTaskProfileInspection(inspection),\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: { started: true, action, kind: \"profile\", created: false, inspection },\n\t\t};\n\t}\n\n\tif (input.task === undefined) {\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: \"delegate profile_create requires task\" }],\n\t\t\tdetails: {\n\t\t\t\tstarted: false,\n\t\t\t\taction,\n\t\t\t\tkind: \"profile\",\n\t\t\t\tcreated: false,\n\t\t\t\treason: \"missing_profile_task\",\n\t\t\t},\n\t\t};\n\t}\n\tconst request: TaskProfileCreateInput = {\n\t\ttask: input.task,\n\t\t...(input.baseProfileId !== undefined ? { baseProfileId: input.baseProfileId } : {}),\n\t\t...(input.model !== undefined ? { model: input.model } : {}),\n\t\t...(input.thinkingLevel !== undefined ? { thinkingLevel: input.thinkingLevel } : {}),\n\t\t...(input.path !== undefined ? { path: input.path } : {}),\n\t\t...(input.toolNames !== undefined ? { toolNames: input.toolNames } : {}),\n\t};\n\tconst result = writer.createTaskProfile(request);\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: result.created\n\t\t\t\t\t? `Created immutable session task profile ${result.profileId} from ${result.baseProfileId ?? \"foreground inheritance\"}.`\n\t\t\t\t\t: `delegate profile_create rejected the request: ${result.reason}.`,\n\t\t\t},\n\t\t],\n\t\tdetails: { started: result.created, action, kind: \"profile\", ...result },\n\t};\n}\n"]}
@@ -20,7 +20,7 @@ export interface RunToolkitScriptDetails {
20
20
  }
21
21
  export interface RunToolkitScriptDependencies {
22
22
  getScripts: () => ToolkitScript[];
23
- execute: (script: ToolkitScript, args: readonly string[]) => Promise<ScriptExecution>;
23
+ execute: (script: ToolkitScript, args: readonly string[], signal?: AbortSignal) => Promise<ScriptExecution>;
24
24
  artifactStore?: ArtifactStore;
25
25
  /**
26
26
  * Optional reflex interpreter (local brain): consulted ONLY when the deterministic Level-0
@@ -1 +1 @@
1
- {"version":3,"file":"run-toolkit-script.d.ts","sourceRoot":"","sources":["../../../src/core/tools/run-toolkit-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,QAAA,MAAM,sBAAsB;;;;EAc3B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,uBAAuB,GAAG,gBAAgB,CAAC;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC5C,UAAU,EAAE,MAAM,aAAa,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;OA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AS,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5G,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACpG;AAED,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,4BAA4B,GAAG,cAAc,CAoIvG"}
@@ -23,7 +23,7 @@ export function createRunToolkitScriptToolDefinition(deps) {
23
23
  "Report real output/exitCode; never claim success for nonzero exitCode.",
24
24
  ],
25
25
  parameters: runToolkitScriptSchema,
26
- async execute(toolCallId, input) {
26
+ async execute(toolCallId, input, signal) {
27
27
  const scripts = deps.getScripts();
28
28
  if (scripts.length === 0) {
29
29
  return {
@@ -88,7 +88,7 @@ export function createRunToolkitScriptToolDefinition(deps) {
88
88
  };
89
89
  }
90
90
  // Explicit args from the caller win; a brain-extracted arg list fills in for fuzzy requests.
91
- const execution = await deps.execute(script, input.args ?? interpreted?.args ?? []);
91
+ const execution = await deps.execute(script, input.args ?? interpreted?.args ?? [], signal);
92
92
  const failed = execution.exitCode !== 0 || execution.timedOut;
93
93
  const header = failed
94
94
  ? `FAILED: ${script.name} exited ${execution.timedOut ? "by timeout" : execution.exitCode} after ${execution.durationMs}ms`
@@ -1 +1 @@
1
- {"version":3,"file":"run-toolkit-script.js","sourceRoot":"","sources":["../../../src/core/tools/run-toolkit-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EAAE,gBAAgB,EAAmB,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAsB,MAAM,+BAA+B,CAAC;AAGvF,MAAM,s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ACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ;oBAC5B,UAAU,EAAE,SAAS,CAAC,UAAU;oBAChC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC/D;gBACD,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpC,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport { formatArtifactNotice, packToolOutput } from \"../context/tool-output-packer.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { acceptReflexPlan, type ReflexPlan } from \"../toolkit/reflex-interpreter.ts\";\nimport { matchToolkitScript, type ToolkitScript } from \"../toolkit/script-registry.ts\";\nimport type { ScriptExecution } from \"../toolkit/script-runner.ts\";\n\nconst runToolkitScriptSchema = Type.Object(\n\t{\n\t\tscript: Type.String({\n\t\t\tdescription:\n\t\t\t\t\"The toolkit script to run: its registered name, a taught alias, or a natural request (e.g. 'restore-db' or 'restore the database'). Ambiguous requests return a shortlist instead of executing.\",\n\t\t}),\n\t\targs: Type.Optional(Type.Array(Type.String(), { description: \"Arguments passed to the script as-is.\" })),\n\t\tconfirm: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Required true to run a script flagged danger: scripts marked dangerous never run without it.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type RunToolkitScriptInput = Static<typeof runToolkitScriptSchema>;\n\nexport interface RunToolkitScriptDetails {\n\toutcome: \"executed\" | \"failed\" | \"ambiguous\" | \"not_found\" | \"confirmation_required\" | \"empty_registry\";\n\tscriptName?: string;\n\texitCode?: number | null;\n\tdurationMs?: number;\n\tshortlist?: string[];\n\tartifactId?: string;\n}\n\nexport interface RunToolkitScriptDependencies {\n\tgetScripts: () => ToolkitScript[];\n\texecute: (script: ToolkitScript, args: readonly string[]) => Promise<ScriptExecution>;\n\tartifactStore?: ArtifactStore;\n\t/**\n\t * Optional reflex interpreter (local brain): consulted ONLY when the deterministic Level-0\n\t * matcher is ambiguous, to resolve fuzzy phrasing (\"prepare db\" vs \"update db\") into a\n\t * registry pick. Its plan is advisory — the danger/confirm rules and structural execution\n\t * contract apply identically to brain-selected scripts.\n\t */\n\tinterpret?: (request: string, scripts: readonly ToolkitScript[]) => Promise<ReflexPlan | undefined>;\n}\n\nexport function createRunToolkitScriptToolDefinition(deps: RunToolkitScriptDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"run_toolkit_script\",\n\t\tlabel: \"run_toolkit_script\",\n\t\tdescription:\n\t\t\t\"Run one of the user's registered toolkit scripts (daily-ops allowlist). Finding is a registry lookup — ambiguous requests return a shortlist to disambiguate, never a guess. The harness executes (uv/powershell/bash) and ALWAYS returns exit code, stdout, and stderr; failures are reported as errors — a failed script can never look like success.\",\n\t\tpromptSnippet: \"Run registered toolkit script by name/alias; structured output/errors.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Prefer exact name. Shortlist: ask owner; pick only if request clearly names one.\",\n\t\t\t\"Dangerous script needs explicit user confirmation, then confirm:true.\",\n\t\t\t\"Report real output/exitCode; never claim success for nonzero exitCode.\",\n\t\t],\n\t\tparameters: runToolkitScriptSchema,\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\tinput: RunToolkitScriptInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: RunToolkitScriptDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tconst scripts = deps.getScripts();\n\t\t\tif (scripts.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: \"run_toolkit_script: no scripts registered (settings.toolkit.scripts).\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"empty_registry\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = matchToolkitScript(input.script, scripts);\n\t\t\tif (match.kind === \"none\") {\n\t\t\t\tconst closest = match.closest.map((script) => `${script.name} — ${script.description}`).join(\"\\n\");\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `script_not_found: nothing registered matches \"${input.script}\".${closest ? `\\nClosest:\\n${closest}` : \"\"}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"not_found\" },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tlet interpreted: { script: ToolkitScript; args: string[]; confidence: number } | undefined;\n\t\t\tif (match.kind === \"ambiguous\" && deps.interpret) {\n\t\t\t\ttry {\n\t\t\t\t\tconst plan = await deps.interpret(input.script, scripts);\n\t\t\t\t\tconst accepted = acceptReflexPlan(plan, scripts);\n\t\t\t\t\tif (accepted && plan) {\n\t\t\t\t\t\tinterpreted = { ...accepted, confidence: plan.confidence };\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// interpreter is best-effort; ambiguity handling below stays authoritative\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (match.kind === \"ambiguous\" && !interpreted) {\n\t\t\t\tconst shortlist = match.shortlist.map((script) => `${script.name} — ${script.description}`);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Ambiguous request — did you mean:\\n${shortlist.join(\"\\n\")}\\nCall again with the exact name.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"ambiguous\", shortlist: match.shortlist.map((script) => script.name) },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst script = interpreted?.script ?? (match as { script: ToolkitScript }).script;\n\t\t\tif (script.danger && input.confirm !== true) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `\"${script.name}\" is flagged DANGEROUS (${script.description}). It was NOT run. Confirm with the user, then call again with confirm: true.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"confirmation_required\", scriptName: script.name },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Explicit args from the caller win; a brain-extracted arg list fills in for fuzzy requests.\n\t\t\tconst execution = await deps.execute(script, input.args ?? interpreted?.args ?? []);\n\t\t\tconst failed = execution.exitCode !== 0 || execution.timedOut;\n\t\t\tconst header = failed\n\t\t\t\t? `FAILED: ${script.name} exited ${execution.timedOut ? \"by timeout\" : execution.exitCode} after ${execution.durationMs}ms`\n\t\t\t\t: `${script.name} succeeded in ${execution.durationMs}ms`;\n\t\t\tconst rawBody = [\n\t\t\t\theader,\n\t\t\t\texecution.stdout.trim() ? `stdout:\\n${execution.stdout.trim()}` : \"stdout: (empty)\",\n\t\t\t\texecution.stderr.trim() ? `stderr:\\n${execution.stderr.trim()}` : \"\",\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\");\n\t\t\tconst packed = packToolOutput(\n\t\t\t\t{\n\t\t\t\t\ttoolName: \"run_toolkit_script\",\n\t\t\t\t\tcommand: script.name,\n\t\t\t\t\tpath: script.path,\n\t\t\t\t\trawContent: rawBody,\n\t\t\t\t\treproducible: false,\n\t\t\t\t\ttruncation: { maxLines: 400, maxBytes: 8 * 1024 },\n\t\t\t\t},\n\t\t\t\tdeps.artifactStore,\n\t\t\t\ttoolCallId,\n\t\t\t);\n\t\t\tconst body = packed.artifactId\n\t\t\t\t? `${packed.content}\\n\\n[${formatArtifactNotice(packed.artifactId)}]`\n\t\t\t\t: packed.content;\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: body }],\n\t\t\t\tdetails: {\n\t\t\t\t\t...(interpreted\n\t\t\t\t\t\t? { interpreter: { script: interpreted.script.name, confidence: interpreted.confidence } }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\toutcome: failed ? \"failed\" : \"executed\",\n\t\t\t\t\tscriptName: script.name,\n\t\t\t\t\texitCode: execution.exitCode,\n\t\t\t\t\tdurationMs: execution.durationMs,\n\t\t\t\t\t...(packed.artifactId ? { artifactId: packed.artifactId } : {}),\n\t\t\t\t},\n\t\t\t\t...(failed ? { isError: true } : {}),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"run-toolkit-script.js","sourceRoot":"","sources":["../../../src/core/tools/run-toolkit-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EAAE,gBAAgB,EAAmB,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAsB,MAAM,+BAA+B,CAAC;AAGvF,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CACzC;IACC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,WAAW,EACV,iMAAiM;KAClM,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;IACxG,OAAO,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,OAAO,CAAC;QACZ,WAAW,EAAE,8FAA8F;KAC3G,CAAC,CACF;CACD,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC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\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport { formatArtifactNotice, packToolOutput } from \"../context/tool-output-packer.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { acceptReflexPlan, type ReflexPlan } from \"../toolkit/reflex-interpreter.ts\";\nimport { matchToolkitScript, type ToolkitScript } from \"../toolkit/script-registry.ts\";\nimport type { ScriptExecution } from \"../toolkit/script-runner.ts\";\n\nconst runToolkitScriptSchema = Type.Object(\n\t{\n\t\tscript: Type.String({\n\t\t\tdescription:\n\t\t\t\t\"The toolkit script to run: its registered name, a taught alias, or a natural request (e.g. 'restore-db' or 'restore the database'). Ambiguous requests return a shortlist instead of executing.\",\n\t\t}),\n\t\targs: Type.Optional(Type.Array(Type.String(), { description: \"Arguments passed to the script as-is.\" })),\n\t\tconfirm: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Required true to run a script flagged danger: scripts marked dangerous never run without it.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type RunToolkitScriptInput = Static<typeof runToolkitScriptSchema>;\n\nexport interface RunToolkitScriptDetails {\n\toutcome: \"executed\" | \"failed\" | \"ambiguous\" | \"not_found\" | \"confirmation_required\" | \"empty_registry\";\n\tscriptName?: string;\n\texitCode?: number | null;\n\tdurationMs?: number;\n\tshortlist?: string[];\n\tartifactId?: string;\n}\n\nexport interface RunToolkitScriptDependencies {\n\tgetScripts: () => ToolkitScript[];\n\texecute: (script: ToolkitScript, args: readonly string[], signal?: AbortSignal) => Promise<ScriptExecution>;\n\tartifactStore?: ArtifactStore;\n\t/**\n\t * Optional reflex interpreter (local brain): consulted ONLY when the deterministic Level-0\n\t * matcher is ambiguous, to resolve fuzzy phrasing (\"prepare db\" vs \"update db\") into a\n\t * registry pick. Its plan is advisory — the danger/confirm rules and structural execution\n\t * contract apply identically to brain-selected scripts.\n\t */\n\tinterpret?: (request: string, scripts: readonly ToolkitScript[]) => Promise<ReflexPlan | undefined>;\n}\n\nexport function createRunToolkitScriptToolDefinition(deps: RunToolkitScriptDependencies): ToolDefinition {\n\treturn {\n\t\tname: \"run_toolkit_script\",\n\t\tlabel: \"run_toolkit_script\",\n\t\tdescription:\n\t\t\t\"Run one of the user's registered toolkit scripts (daily-ops allowlist). Finding is a registry lookup — ambiguous requests return a shortlist to disambiguate, never a guess. The harness executes (uv/powershell/bash) and ALWAYS returns exit code, stdout, and stderr; failures are reported as errors — a failed script can never look like success.\",\n\t\tpromptSnippet: \"Run registered toolkit script by name/alias; structured output/errors.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Prefer exact name. Shortlist: ask owner; pick only if request clearly names one.\",\n\t\t\t\"Dangerous script needs explicit user confirmation, then confirm:true.\",\n\t\t\t\"Report real output/exitCode; never claim success for nonzero exitCode.\",\n\t\t],\n\t\tparameters: runToolkitScriptSchema,\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\tinput: RunToolkitScriptInput,\n\t\t\tsignal?: AbortSignal,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: RunToolkitScriptDetails;\n\t\t\tisError?: boolean;\n\t\t}> {\n\t\t\tconst scripts = deps.getScripts();\n\t\t\tif (scripts.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: \"run_toolkit_script: no scripts registered (settings.toolkit.scripts).\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"empty_registry\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = matchToolkitScript(input.script, scripts);\n\t\t\tif (match.kind === \"none\") {\n\t\t\t\tconst closest = match.closest.map((script) => `${script.name} — ${script.description}`).join(\"\\n\");\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `script_not_found: nothing registered matches \"${input.script}\".${closest ? `\\nClosest:\\n${closest}` : \"\"}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"not_found\" },\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tlet interpreted: { script: ToolkitScript; args: string[]; confidence: number } | undefined;\n\t\t\tif (match.kind === \"ambiguous\" && deps.interpret) {\n\t\t\t\ttry {\n\t\t\t\t\tconst plan = await deps.interpret(input.script, scripts);\n\t\t\t\t\tconst accepted = acceptReflexPlan(plan, scripts);\n\t\t\t\t\tif (accepted && plan) {\n\t\t\t\t\t\tinterpreted = { ...accepted, confidence: plan.confidence };\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// interpreter is best-effort; ambiguity handling below stays authoritative\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (match.kind === \"ambiguous\" && !interpreted) {\n\t\t\t\tconst shortlist = match.shortlist.map((script) => `${script.name} — ${script.description}`);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Ambiguous request — did you mean:\\n${shortlist.join(\"\\n\")}\\nCall again with the exact name.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"ambiguous\", shortlist: match.shortlist.map((script) => script.name) },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst script = interpreted?.script ?? (match as { script: ToolkitScript }).script;\n\t\t\tif (script.danger && input.confirm !== true) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `\"${script.name}\" is flagged DANGEROUS (${script.description}). It was NOT run. Confirm with the user, then call again with confirm: true.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { outcome: \"confirmation_required\", scriptName: script.name },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Explicit args from the caller win; a brain-extracted arg list fills in for fuzzy requests.\n\t\t\tconst execution = await deps.execute(script, input.args ?? interpreted?.args ?? [], signal);\n\t\t\tconst failed = execution.exitCode !== 0 || execution.timedOut;\n\t\t\tconst header = failed\n\t\t\t\t? `FAILED: ${script.name} exited ${execution.timedOut ? \"by timeout\" : execution.exitCode} after ${execution.durationMs}ms`\n\t\t\t\t: `${script.name} succeeded in ${execution.durationMs}ms`;\n\t\t\tconst rawBody = [\n\t\t\t\theader,\n\t\t\t\texecution.stdout.trim() ? `stdout:\\n${execution.stdout.trim()}` : \"stdout: (empty)\",\n\t\t\t\texecution.stderr.trim() ? `stderr:\\n${execution.stderr.trim()}` : \"\",\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\");\n\t\t\tconst packed = packToolOutput(\n\t\t\t\t{\n\t\t\t\t\ttoolName: \"run_toolkit_script\",\n\t\t\t\t\tcommand: script.name,\n\t\t\t\t\tpath: script.path,\n\t\t\t\t\trawContent: rawBody,\n\t\t\t\t\treproducible: false,\n\t\t\t\t\ttruncation: { maxLines: 400, maxBytes: 8 * 1024 },\n\t\t\t\t},\n\t\t\t\tdeps.artifactStore,\n\t\t\t\ttoolCallId,\n\t\t\t);\n\t\t\tconst body = packed.artifactId\n\t\t\t\t? `${packed.content}\\n\\n[${formatArtifactNotice(packed.artifactId)}]`\n\t\t\t\t: packed.content;\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: body }],\n\t\t\t\tdetails: {\n\t\t\t\t\t...(interpreted\n\t\t\t\t\t\t? { interpreter: { script: interpreted.script.name, confidence: interpreted.confidence } }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\toutcome: failed ? \"failed\" : \"executed\",\n\t\t\t\t\tscriptName: script.name,\n\t\t\t\t\texitCode: execution.exitCode,\n\t\t\t\t\tdurationMs: execution.durationMs,\n\t\t\t\t\t...(packed.artifactId ? { artifactId: packed.artifactId } : {}),\n\t\t\t\t},\n\t\t\t\t...(failed ? { isError: true } : {}),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
@@ -1,6 +1,15 @@
1
1
  import type { AgentTool } from "@caupulican/pi-agent-core";
2
2
  import { type Static, Type } from "typebox";
3
3
  import type { ToolDefinition } from "../extensions/types.ts";
4
+ import { type Skill } from "../skills.ts";
5
+ export declare const DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS: Readonly<{
6
+ maxSkills: 256;
7
+ maxComparisonPairs: 32768;
8
+ maxDraftFieldChars: 16384;
9
+ }>;
10
+ export declare const DEFAULT_WORKER_SKILL_AUDIT_MAX_SKILLS: 256;
11
+ export declare const DEFAULT_WORKER_SKILL_AUDIT_MAX_COMPARISON_PAIRS: 32768;
12
+ export declare const DEFAULT_WORKER_SKILL_AUDIT_MAX_DRAFT_FIELD_CHARS: 16384;
4
13
  /**
5
14
  * Tokenize text by lowercasing, removing non-alphanumeric chars (except hyphens and colons),
6
15
  * splitting on whitespace, and filtering out short tokens and stopwords.
@@ -36,8 +45,18 @@ export interface SkillAuditReport {
36
45
  name: string;
37
46
  paths: string[];
38
47
  }>;
48
+ truncated?: boolean;
39
49
  recommendations?: string[];
40
50
  }
51
+ export interface SkillAuditRunOptions {
52
+ signal?: AbortSignal;
53
+ /** Maximum number of host-provided skills considered by a bounded worker audit. */
54
+ maxSkills?: number;
55
+ /** Maximum number of pair comparisons performed by a bounded worker audit. */
56
+ maxComparisonPairs?: number;
57
+ /** Maximum characters accepted in each draft field before any discovery or comparison work. */
58
+ maxDraftFieldChars?: number;
59
+ }
41
60
  /**
42
61
  * Audit existing skills for overlap and compare against a draft skill.
43
62
  */
@@ -45,7 +64,7 @@ export declare function runSkillAudit(cwd: string, draftSkill?: {
45
64
  name?: string;
46
65
  description?: string;
47
66
  body?: string;
48
- }): SkillAuditReport;
67
+ }, providedSkills?: readonly Skill[], redactPath?: (path: string) => string, runOptions?: SkillAuditRunOptions): SkillAuditReport;
49
68
  declare const skillAuditSchema: Type.TObject<{
50
69
  draftName: Type.TOptional<Type.TString>;
51
70
  draftDescription: Type.TOptional<Type.TString>;
@@ -56,6 +75,14 @@ export interface SkillAuditToolDetails {
56
75
  reportPath?: string;
57
76
  }
58
77
  export interface SkillAuditToolOptions {
78
+ /** Host-owned metadata source. Omitted uses the foreground global discovery path. */
79
+ getSkills?: () => readonly Skill[];
80
+ /** Redacts host paths in the structured report before they can reach a worker. */
81
+ redactPath?: (path: string) => string;
82
+ /** Optional host-enforced bounds used by worker adapters; foreground callers remain unbounded. */
83
+ maxSkills?: number;
84
+ maxComparisonPairs?: number;
85
+ maxDraftFieldChars?: number;
59
86
  }
60
87
  export declare function createSkillAuditToolDefinition(cwd: string, _options?: SkillAuditToolOptions): ToolDefinition<typeof skillAuditSchema, SkillAuditReport>;
61
88
  export declare function createSkillAuditTool(cwd: string, options?: SkillAuditToolOptions): AgentTool<typeof skillAuditSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"skill-audit.d.ts","sourceRoot":"","sources":["../../../src/core/tools/skill-audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAY7D;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAU/C;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAQxD;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,K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AM,CAAC;IACtC,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,8BAA8B,CAC7C,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC,CA8E3D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC,OAAO,gBAAgB,CAAC,CAErH"}
@@ -3,6 +3,14 @@ import { getAgentDir } from "../../config.js";
3
3
  import { loadSkills } from "../skills.js";
4
4
  import { wrapToolDefinition } from "./tool-definition-wrapper.js";
5
5
  const DUPLICATE_THRESHOLD = 0.55;
6
+ export const DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS = Object.freeze({
7
+ maxSkills: 256,
8
+ maxComparisonPairs: 32_768,
9
+ maxDraftFieldChars: 16_384,
10
+ });
11
+ export const DEFAULT_WORKER_SKILL_AUDIT_MAX_SKILLS = DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS.maxSkills;
12
+ export const DEFAULT_WORKER_SKILL_AUDIT_MAX_COMPARISON_PAIRS = DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS.maxComparisonPairs;
13
+ export const DEFAULT_WORKER_SKILL_AUDIT_MAX_DRAFT_FIELD_CHARS = DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS.maxDraftFieldChars;
6
14
  const STOPWORDS = new Set("the a an and or of for to with when use using from into this that skill task work working project agent agents code files file in on by as is are be do not should about".split(" "));
7
15
  /**
8
16
  * Tokenize text by lowercasing, removing non-alphanumeric chars (except hyphens and colons),
@@ -33,26 +41,46 @@ export function jaccard(a, b) {
33
41
  const union = new Set([...a, ...b]).size;
34
42
  return union === 0 ? 0 : intersection / union;
35
43
  }
44
+ function throwIfAborted(signal) {
45
+ if (signal?.aborted)
46
+ throw new Error("Operation aborted");
47
+ }
36
48
  /**
37
49
  * Audit existing skills for overlap and compare against a draft skill.
38
50
  */
39
- export function runSkillAudit(cwd, draftSkill) {
51
+ export function runSkillAudit(cwd, draftSkill, providedSkills, redactPath, runOptions) {
52
+ throwIfAborted(runOptions?.signal);
53
+ const maxDraftFieldChars = runOptions?.maxDraftFieldChars;
54
+ if (draftSkill && maxDraftFieldChars !== undefined) {
55
+ for (const [field, value] of [
56
+ ["draftName", draftSkill.name],
57
+ ["draftDescription", draftSkill.description],
58
+ ["draftBody", draftSkill.body],
59
+ ]) {
60
+ if (value !== undefined && value.length > maxDraftFieldChars) {
61
+ throw new Error(`skill_audit_draft_too_large:${field}`);
62
+ }
63
+ }
64
+ }
40
65
  // Load existing skills
41
- const result = loadSkills({
42
- cwd,
43
- agentDir: getAgentDir(),
44
- skillPaths: [],
45
- includeDefaults: true,
46
- });
47
- const skills = result.skills.map((skill) => ({
66
+ const skillsResult = providedSkills
67
+ ? { skills: providedSkills }
68
+ : loadSkills({ cwd, agentDir: getAgentDir(), skillPaths: [], includeDefaults: true });
69
+ const maxSkills = runOptions?.maxSkills;
70
+ const sourceSkills = maxSkills === undefined
71
+ ? skillsResult.skills
72
+ : skillsResult.skills.slice(0, Math.max(0, maxSkills - (draftSkill ? 1 : 0)));
73
+ let truncated = sourceSkills.length < skillsResult.skills.length;
74
+ const skills = sourceSkills.map((skill) => ({
48
75
  name: skill.name,
49
76
  description: skill.description,
50
- path: skill.filePath,
77
+ path: redactPath?.(skill.filePath) ?? skill.filePath,
51
78
  scope: skill.sourceInfo.scope ?? "unknown",
52
79
  keywords: tokenize(`${skill.name} ${skill.description}`),
53
80
  }));
54
81
  // If a draft skill is provided, add it to the set for comparison
55
82
  if (draftSkill) {
83
+ throwIfAborted(runOptions?.signal);
56
84
  const draftName = draftSkill.name || "draft-skill";
57
85
  const draftDesc = draftSkill.description || "";
58
86
  skills.push({
@@ -65,8 +93,17 @@ export function runSkillAudit(cwd, draftSkill) {
65
93
  }
66
94
  // Find near-duplicates based on Jaccard similarity
67
95
  const nearDuplicates = [];
68
- for (let i = 0; i < skills.length; i++) {
96
+ let comparisonPairs = 0;
97
+ comparisonLoop: for (let i = 0; i < skills.length; i++) {
98
+ throwIfAborted(runOptions?.signal);
69
99
  for (let j = i + 1; j < skills.length; j++) {
100
+ throwIfAborted(runOptions?.signal);
101
+ if (runOptions?.maxComparisonPairs !== undefined &&
102
+ comparisonPairs >= Math.max(0, runOptions.maxComparisonPairs)) {
103
+ truncated = true;
104
+ break comparisonLoop;
105
+ }
106
+ comparisonPairs++;
70
107
  const similarity = jaccard(skills[i].keywords, skills[j].keywords);
71
108
  if (similarity >= DUPLICATE_THRESHOLD) {
72
109
  const reason = similarity >= 0.9
@@ -108,6 +145,7 @@ export function runSkillAudit(cwd, draftSkill) {
108
145
  nearDuplicates,
109
146
  compartmentWarnings: [],
110
147
  nameCollisions,
148
+ ...(truncated ? { truncated: true } : {}),
111
149
  recommendations,
112
150
  };
113
151
  }
@@ -117,6 +155,7 @@ const skillAuditSchema = Type.Object({
117
155
  draftBody: Type.Optional(Type.String({ description: "Body/content of the draft skill" })),
118
156
  });
119
157
  export function createSkillAuditToolDefinition(cwd, _options) {
158
+ const options = _options;
120
159
  return {
121
160
  name: "skill_audit",
122
161
  label: "Skill Audit",
@@ -127,7 +166,7 @@ export function createSkillAuditToolDefinition(cwd, _options) {
127
166
  "Similarity >= 55% indicates potential dedup or compartmentalization work.",
128
167
  ],
129
168
  parameters: skillAuditSchema,
130
- async execute(_toolCallId, { draftName, draftDescription, draftBody }, _signal, _onUpdate, _ctx) {
169
+ async execute(_toolCallId, { draftName, draftDescription, draftBody }, signal, _onUpdate, _ctx) {
131
170
  const draftSkill = draftName || draftDescription
132
171
  ? {
133
172
  name: draftName,
@@ -135,7 +174,12 @@ export function createSkillAuditToolDefinition(cwd, _options) {
135
174
  body: draftBody,
136
175
  }
137
176
  : undefined;
138
- const report = runSkillAudit(cwd, draftSkill);
177
+ const report = runSkillAudit(cwd, draftSkill, options?.getSkills?.(), options?.redactPath, {
178
+ signal,
179
+ maxSkills: options?.maxSkills,
180
+ maxComparisonPairs: options?.maxComparisonPairs,
181
+ maxDraftFieldChars: options?.maxDraftFieldChars,
182
+ });
139
183
  // Format the report as readable text
140
184
  const lines = [];
141
185
  lines.push(`Skill audit: ${report.skills.length} skill(s), ${report.nearDuplicates.length} overlap warning(s).`);