@caupulican/pi-adaptative 0.81.40 → 0.81.42

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 (599) hide show
  1. package/CHANGELOG.md +41 -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/bundled-resources/runtimes/pi-shell-engine/commands/text.py +5 -1
  7. package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +3 -3
  8. package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +8 -0
  9. package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +26 -3
  10. package/dist/bundled-resources/runtimes/pi-shell-engine/expand.py +3 -0
  11. package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +4 -1
  12. package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +2 -1
  13. package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +2 -0
  14. package/dist/cli/args.d.ts +2 -0
  15. package/dist/cli/args.d.ts.map +1 -1
  16. package/dist/cli/args.js +22 -1
  17. package/dist/cli/args.js.map +1 -1
  18. package/dist/core/agent-paths.d.ts +38 -0
  19. package/dist/core/agent-paths.d.ts.map +1 -1
  20. package/dist/core/agent-paths.js +77 -0
  21. package/dist/core/agent-paths.js.map +1 -1
  22. package/dist/core/agent-session-contracts.d.ts +311 -0
  23. package/dist/core/agent-session-contracts.d.ts.map +1 -0
  24. package/dist/core/agent-session-contracts.js +26 -0
  25. package/dist/core/agent-session-contracts.js.map +1 -0
  26. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  27. package/dist/core/agent-session-runtime.js +3 -0
  28. package/dist/core/agent-session-runtime.js.map +1 -1
  29. package/dist/core/agent-session.d.ts +26 -405
  30. package/dist/core/agent-session.d.ts.map +1 -1
  31. package/dist/core/agent-session.js +90 -316
  32. package/dist/core/agent-session.js.map +1 -1
  33. package/dist/core/auth-storage.d.ts.map +1 -1
  34. package/dist/core/auth-storage.js +3 -1
  35. package/dist/core/auth-storage.js.map +1 -1
  36. package/dist/core/autonomy/contracts.d.ts +2 -0
  37. package/dist/core/autonomy/contracts.d.ts.map +1 -1
  38. package/dist/core/autonomy/contracts.js.map +1 -1
  39. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  40. package/dist/core/autonomy/envelope-enforcement.js +4 -9
  41. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  42. package/dist/core/autonomy/lane-tool-surface.d.ts +3 -1
  43. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  44. package/dist/core/autonomy/lane-tool-surface.js +19 -5
  45. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  46. package/dist/core/autonomy/path-scope.d.ts +14 -0
  47. package/dist/core/autonomy/path-scope.d.ts.map +1 -1
  48. package/dist/core/autonomy/path-scope.js +37 -6
  49. package/dist/core/autonomy/path-scope.js.map +1 -1
  50. package/dist/core/background-lane-controller.d.ts +30 -2
  51. package/dist/core/background-lane-controller.d.ts.map +1 -1
  52. package/dist/core/background-lane-controller.js +33 -1
  53. package/dist/core/background-lane-controller.js.map +1 -1
  54. package/dist/core/bedrock-sso-login.d.ts +16 -0
  55. package/dist/core/bedrock-sso-login.d.ts.map +1 -0
  56. package/dist/core/bedrock-sso-login.js +98 -0
  57. package/dist/core/bedrock-sso-login.js.map +1 -0
  58. package/dist/core/compaction-controller.d.ts.map +1 -1
  59. package/dist/core/compaction-controller.js +1 -1
  60. package/dist/core/compaction-controller.js.map +1 -1
  61. package/dist/core/compaction-support.d.ts +3 -8
  62. package/dist/core/compaction-support.d.ts.map +1 -1
  63. package/dist/core/compaction-support.js +3 -3
  64. package/dist/core/compaction-support.js.map +1 -1
  65. package/dist/core/context-pipeline.d.ts +1 -1
  66. package/dist/core/context-pipeline.d.ts.map +1 -1
  67. package/dist/core/context-pipeline.js +7 -33
  68. package/dist/core/context-pipeline.js.map +1 -1
  69. package/dist/core/cost/cost-summary.d.ts.map +1 -1
  70. package/dist/core/cost/cost-summary.js +5 -3
  71. package/dist/core/cost/cost-summary.js.map +1 -1
  72. package/dist/core/cost/daily-usage.d.ts.map +1 -1
  73. package/dist/core/cost/daily-usage.js +4 -5
  74. package/dist/core/cost/daily-usage.js.map +1 -1
  75. package/dist/core/default-tool-surface.d.ts.map +1 -1
  76. package/dist/core/default-tool-surface.js +1 -0
  77. package/dist/core/default-tool-surface.js.map +1 -1
  78. package/dist/core/delegation/managed-lane-controller.d.ts +11 -1
  79. package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
  80. package/dist/core/delegation/managed-lane-controller.js +84 -41
  81. package/dist/core/delegation/managed-lane-controller.js.map +1 -1
  82. package/dist/core/delegation/session-worker-claim.d.ts.map +1 -1
  83. package/dist/core/delegation/session-worker-claim.js +4 -3
  84. package/dist/core/delegation/session-worker-claim.js.map +1 -1
  85. package/dist/core/delegation/worker-action-journal.d.ts +73 -0
  86. package/dist/core/delegation/worker-action-journal.d.ts.map +1 -0
  87. package/dist/core/delegation/worker-action-journal.js +297 -0
  88. package/dist/core/delegation/worker-action-journal.js.map +1 -0
  89. package/dist/core/delegation/worker-actions.d.ts +36 -1
  90. package/dist/core/delegation/worker-actions.d.ts.map +1 -1
  91. package/dist/core/delegation/worker-actions.js +171 -46
  92. package/dist/core/delegation/worker-actions.js.map +1 -1
  93. package/dist/core/delegation/worker-agent-control-coordinator.d.ts +75 -0
  94. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -0
  95. package/dist/core/delegation/worker-agent-control-coordinator.js +218 -0
  96. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -0
  97. package/dist/core/delegation/worker-agent-control.d.ts +66 -0
  98. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -0
  99. package/dist/core/delegation/worker-agent-control.js +163 -0
  100. package/dist/core/delegation/worker-agent-control.js.map +1 -0
  101. package/dist/core/delegation/worker-attempt-executor.d.ts +80 -0
  102. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -0
  103. package/dist/core/delegation/worker-attempt-executor.js +343 -0
  104. package/dist/core/delegation/worker-attempt-executor.js.map +1 -0
  105. package/dist/core/delegation/worker-claim.d.ts +30 -0
  106. package/dist/core/delegation/worker-claim.d.ts.map +1 -1
  107. package/dist/core/delegation/worker-claim.js +205 -53
  108. package/dist/core/delegation/worker-claim.js.map +1 -1
  109. package/dist/core/delegation/worker-conversation-store.d.ts +116 -0
  110. package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -0
  111. package/dist/core/delegation/worker-conversation-store.js +442 -0
  112. package/dist/core/delegation/worker-conversation-store.js.map +1 -0
  113. package/dist/core/delegation/worker-delegation-controller.d.ts +21 -5
  114. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  115. package/dist/core/delegation/worker-delegation-controller.js +386 -251
  116. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  117. package/dist/core/delegation/worker-delegation-request.d.ts +14 -0
  118. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  119. package/dist/core/delegation/worker-delegation-request.js.map +1 -1
  120. package/dist/core/delegation/worker-dispatch-scheduler.d.ts +4 -2
  121. package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
  122. package/dist/core/delegation/worker-dispatch-scheduler.js +16 -6
  123. package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
  124. package/dist/core/delegation/worker-execution-policy.d.ts +2 -1
  125. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  126. package/dist/core/delegation/worker-execution-policy.js +5 -7
  127. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  128. package/dist/core/delegation/worker-lifecycle.d.ts +44 -1
  129. package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
  130. package/dist/core/delegation/worker-lifecycle.js +120 -0
  131. package/dist/core/delegation/worker-lifecycle.js.map +1 -1
  132. package/dist/core/delegation/worker-process-owner.d.ts +18 -0
  133. package/dist/core/delegation/worker-process-owner.d.ts.map +1 -0
  134. package/dist/core/delegation/worker-process-owner.js +54 -0
  135. package/dist/core/delegation/worker-process-owner.js.map +1 -0
  136. package/dist/core/delegation/worker-profile-resolver.d.ts +5 -1
  137. package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
  138. package/dist/core/delegation/worker-profile-resolver.js +8 -0
  139. package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
  140. package/dist/core/delegation/worker-recovery-coordinator.d.ts +54 -0
  141. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -0
  142. package/dist/core/delegation/worker-recovery-coordinator.js +181 -0
  143. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -0
  144. package/dist/core/delegation/worker-resource-catalog.d.ts +32 -0
  145. package/dist/core/delegation/worker-resource-catalog.d.ts.map +1 -0
  146. package/dist/core/delegation/worker-resource-catalog.js +116 -0
  147. package/dist/core/delegation/worker-resource-catalog.js.map +1 -0
  148. package/dist/core/delegation/worker-resource-materializer.d.ts +47 -0
  149. package/dist/core/delegation/worker-resource-materializer.d.ts.map +1 -0
  150. package/dist/core/delegation/worker-resource-materializer.js +137 -0
  151. package/dist/core/delegation/worker-resource-materializer.js.map +1 -0
  152. package/dist/core/delegation/worker-runner.d.ts +3 -1
  153. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  154. package/dist/core/delegation/worker-runner.js +189 -54
  155. package/dist/core/delegation/worker-runner.js.map +1 -1
  156. package/dist/core/delegation/worker-terminal-finalizer.d.ts +23 -0
  157. package/dist/core/delegation/worker-terminal-finalizer.d.ts.map +1 -0
  158. package/dist/core/delegation/worker-terminal-finalizer.js +12 -0
  159. package/dist/core/delegation/worker-terminal-finalizer.js.map +1 -0
  160. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +38 -0
  161. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -0
  162. package/dist/core/delegation/worker-write-reservation-coordinator.js +107 -0
  163. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -0
  164. package/dist/core/delegation/worker-write-reservation.d.ts +90 -0
  165. package/dist/core/delegation/worker-write-reservation.d.ts.map +1 -0
  166. package/dist/core/delegation/worker-write-reservation.js +348 -0
  167. package/dist/core/delegation/worker-write-reservation.js.map +1 -0
  168. package/dist/core/extension-import-authority.d.ts +6 -0
  169. package/dist/core/extension-import-authority.d.ts.map +1 -0
  170. package/dist/core/extension-import-authority.js +10 -0
  171. package/dist/core/extension-import-authority.js.map +1 -0
  172. package/dist/core/extensions/loader.d.ts.map +1 -1
  173. package/dist/core/extensions/loader.js +2 -3
  174. package/dist/core/extensions/loader.js.map +1 -1
  175. package/dist/core/extensions/runner.d.ts +3 -0
  176. package/dist/core/extensions/runner.d.ts.map +1 -1
  177. package/dist/core/extensions/runner.js +14 -5
  178. package/dist/core/extensions/runner.js.map +1 -1
  179. package/dist/core/extensions/stale-context.d.ts +2 -0
  180. package/dist/core/extensions/stale-context.d.ts.map +1 -0
  181. package/dist/core/extensions/stale-context.js +2 -0
  182. package/dist/core/extensions/stale-context.js.map +1 -0
  183. package/dist/core/extensions/types.d.ts +8 -0
  184. package/dist/core/extensions/types.d.ts.map +1 -1
  185. package/dist/core/extensions/types.js.map +1 -1
  186. package/dist/core/foreground-recovery-controller.d.ts +1 -0
  187. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  188. package/dist/core/foreground-recovery-controller.js +13 -13
  189. package/dist/core/foreground-recovery-controller.js.map +1 -1
  190. package/dist/core/goal-loop-controller.d.ts +14 -9
  191. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  192. package/dist/core/goal-loop-controller.js +47 -75
  193. package/dist/core/goal-loop-controller.js.map +1 -1
  194. package/dist/core/goals/compact-goal-context.d.ts +11 -0
  195. package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
  196. package/dist/core/goals/compact-goal-context.js +59 -0
  197. package/dist/core/goals/compact-goal-context.js.map +1 -0
  198. package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
  199. package/dist/core/goals/goal-acceptance.js +2 -0
  200. package/dist/core/goals/goal-acceptance.js.map +1 -1
  201. package/dist/core/goals/goal-auto-continue-controller.d.ts +2 -1
  202. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  203. package/dist/core/goals/goal-auto-continue-controller.js +5 -8
  204. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  205. package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
  206. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  207. package/dist/core/goals/goal-continuation-controller.js +42 -11
  208. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  209. package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
  210. package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
  211. package/dist/core/goals/goal-continuation-defaults.js +4 -32
  212. package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
  213. package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
  214. package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
  215. package/dist/core/goals/goal-continuation-prompt.js +9 -179
  216. package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
  217. package/dist/core/goals/goal-lifecycle.d.ts +35 -12
  218. package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
  219. package/dist/core/goals/goal-lifecycle.js +98 -13
  220. package/dist/core/goals/goal-lifecycle.js.map +1 -1
  221. package/dist/core/goals/goal-record.d.ts +17 -0
  222. package/dist/core/goals/goal-record.d.ts.map +1 -0
  223. package/dist/core/goals/goal-record.js +31 -0
  224. package/dist/core/goals/goal-record.js.map +1 -0
  225. package/dist/core/goals/goal-session-controller.d.ts +42 -0
  226. package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
  227. package/dist/core/goals/goal-session-controller.js +128 -0
  228. package/dist/core/goals/goal-session-controller.js.map +1 -0
  229. package/dist/core/goals/goal-state.d.ts +45 -25
  230. package/dist/core/goals/goal-state.d.ts.map +1 -1
  231. package/dist/core/goals/goal-state.js +85 -15
  232. package/dist/core/goals/goal-state.js.map +1 -1
  233. package/dist/core/goals/goal-tool-core.d.ts +1 -4
  234. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  235. package/dist/core/goals/goal-tool-core.js +49 -34
  236. package/dist/core/goals/goal-tool-core.js.map +1 -1
  237. package/dist/core/goals/session-goal-state.d.ts +18 -8
  238. package/dist/core/goals/session-goal-state.d.ts.map +1 -1
  239. package/dist/core/goals/session-goal-state.js +134 -11
  240. package/dist/core/goals/session-goal-state.js.map +1 -1
  241. package/dist/core/human-input-controller.d.ts +47 -0
  242. package/dist/core/human-input-controller.d.ts.map +1 -0
  243. package/dist/core/human-input-controller.js +181 -0
  244. package/dist/core/human-input-controller.js.map +1 -0
  245. package/dist/core/local-runtime-controller.d.ts +1 -1
  246. package/dist/core/local-runtime-controller.d.ts.map +1 -1
  247. package/dist/core/local-runtime-controller.js.map +1 -1
  248. package/dist/core/model-capability.d.ts +0 -19
  249. package/dist/core/model-capability.d.ts.map +1 -1
  250. package/dist/core/model-capability.js +0 -19
  251. package/dist/core/model-capability.js.map +1 -1
  252. package/dist/core/model-registry.d.ts +6 -1
  253. package/dist/core/model-registry.d.ts.map +1 -1
  254. package/dist/core/model-registry.js +13 -5
  255. package/dist/core/model-registry.js.map +1 -1
  256. package/dist/core/model-resolver.d.ts +16 -1
  257. package/dist/core/model-resolver.d.ts.map +1 -1
  258. package/dist/core/model-resolver.js +32 -16
  259. package/dist/core/model-resolver.js.map +1 -1
  260. package/dist/core/model-router-controller.d.ts +1 -1
  261. package/dist/core/model-router-controller.d.ts.map +1 -1
  262. package/dist/core/model-router-controller.js.map +1 -1
  263. package/dist/core/model-selection-controller.d.ts +1 -1
  264. package/dist/core/model-selection-controller.d.ts.map +1 -1
  265. package/dist/core/model-selection-controller.js.map +1 -1
  266. package/dist/core/models/model-endpoint.d.ts +3 -0
  267. package/dist/core/models/model-endpoint.d.ts.map +1 -0
  268. package/dist/core/models/model-endpoint.js +11 -0
  269. package/dist/core/models/model-endpoint.js.map +1 -0
  270. package/dist/core/orchestration/agent-resume.d.ts +2 -0
  271. package/dist/core/orchestration/agent-resume.d.ts.map +1 -1
  272. package/dist/core/orchestration/agent-resume.js +7 -0
  273. package/dist/core/orchestration/agent-resume.js.map +1 -1
  274. package/dist/core/orchestration/attempt-usage.d.ts +28 -0
  275. package/dist/core/orchestration/attempt-usage.d.ts.map +1 -0
  276. package/dist/core/orchestration/attempt-usage.js +168 -0
  277. package/dist/core/orchestration/attempt-usage.js.map +1 -0
  278. package/dist/core/orchestration/capability-gateway.d.ts +19 -1
  279. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  280. package/dist/core/orchestration/capability-gateway.js +128 -28
  281. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  282. package/dist/core/orchestration/contracts.d.ts +35 -0
  283. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  284. package/dist/core/orchestration/contracts.js +17 -0
  285. package/dist/core/orchestration/contracts.js.map +1 -1
  286. package/dist/core/orchestration/delegation-ledger.d.ts +17 -2
  287. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  288. package/dist/core/orchestration/delegation-ledger.js +81 -3
  289. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  290. package/dist/core/orchestration/event-store.d.ts +1 -0
  291. package/dist/core/orchestration/event-store.d.ts.map +1 -1
  292. package/dist/core/orchestration/event-store.js +78 -38
  293. package/dist/core/orchestration/event-store.js.map +1 -1
  294. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  295. package/dist/core/orchestration/profile-registry.js +81 -41
  296. package/dist/core/orchestration/profile-registry.js.map +1 -1
  297. package/dist/core/orchestration/profile-store.d.ts.map +1 -1
  298. package/dist/core/orchestration/profile-store.js +18 -4
  299. package/dist/core/orchestration/profile-store.js.map +1 -1
  300. package/dist/core/orchestration/risk-budget.d.ts +2 -0
  301. package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
  302. package/dist/core/orchestration/risk-budget.js +26 -0
  303. package/dist/core/orchestration/risk-budget.js.map +1 -1
  304. package/dist/core/orchestration/task-runtime.d.ts +13 -1
  305. package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
  306. package/dist/core/orchestration/task-runtime.js +127 -16
  307. package/dist/core/orchestration/task-runtime.js.map +1 -1
  308. package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
  309. package/dist/core/orchestration/work-state-projection.js +1 -1
  310. package/dist/core/orchestration/work-state-projection.js.map +1 -1
  311. package/dist/core/orchestration/worker-execution-contract.d.ts +3 -1
  312. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  313. package/dist/core/orchestration/worker-execution-contract.js +75 -23
  314. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  315. package/dist/core/orchestration/worker-result-adapter.d.ts +9 -3
  316. package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -1
  317. package/dist/core/orchestration/worker-result-adapter.js +167 -14
  318. package/dist/core/orchestration/worker-result-adapter.js.map +1 -1
  319. package/dist/core/package-manager.d.ts.map +1 -1
  320. package/dist/core/package-manager.js +20 -3
  321. package/dist/core/package-manager.js.map +1 -1
  322. package/dist/core/profile-filter-controller.d.ts +8 -1
  323. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  324. package/dist/core/profile-filter-controller.js +23 -5
  325. package/dist/core/profile-filter-controller.js.map +1 -1
  326. package/dist/core/prompt-templates.d.ts +1 -0
  327. package/dist/core/prompt-templates.d.ts.map +1 -1
  328. package/dist/core/prompt-templates.js +18 -29
  329. package/dist/core/prompt-templates.js.map +1 -1
  330. package/dist/core/reflection-controller.d.ts +2 -2
  331. package/dist/core/reflection-controller.d.ts.map +1 -1
  332. package/dist/core/reflection-controller.js +92 -54
  333. package/dist/core/reflection-controller.js.map +1 -1
  334. package/dist/core/request-auth.d.ts +7 -0
  335. package/dist/core/request-auth.d.ts.map +1 -0
  336. package/dist/core/request-auth.js +8 -0
  337. package/dist/core/request-auth.js.map +1 -0
  338. package/dist/core/research/evidence-bundle.d.ts +20 -0
  339. package/dist/core/research/evidence-bundle.d.ts.map +1 -1
  340. package/dist/core/research/evidence-bundle.js +173 -69
  341. package/dist/core/research/evidence-bundle.js.map +1 -1
  342. package/dist/core/resource-loader.d.ts.map +1 -1
  343. package/dist/core/resource-loader.js +16 -6
  344. package/dist/core/resource-loader.js.map +1 -1
  345. package/dist/core/risk-classifier.d.ts.map +1 -1
  346. package/dist/core/risk-classifier.js +8 -0
  347. package/dist/core/risk-classifier.js.map +1 -1
  348. package/dist/core/runtime-builder.d.ts +22 -3
  349. package/dist/core/runtime-builder.d.ts.map +1 -1
  350. package/dist/core/runtime-builder.js +147 -80
  351. package/dist/core/runtime-builder.js.map +1 -1
  352. package/dist/core/sdk.d.ts.map +1 -1
  353. package/dist/core/sdk.js +7 -1
  354. package/dist/core/sdk.js.map +1 -1
  355. package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
  356. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
  357. package/dist/core/secrets/credential-exposure-guard.js +241 -0
  358. package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
  359. package/dist/core/secrets/secret-dotenv.d.ts +27 -0
  360. package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
  361. package/dist/core/secrets/secret-dotenv.js +183 -0
  362. package/dist/core/secrets/secret-dotenv.js.map +1 -0
  363. package/dist/core/secrets/secret-vault-format.d.ts +112 -0
  364. package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
  365. package/dist/core/secrets/secret-vault-format.js +397 -0
  366. package/dist/core/secrets/secret-vault-format.js.map +1 -0
  367. package/dist/core/secrets/secret-vault.d.ts +72 -0
  368. package/dist/core/secrets/secret-vault.d.ts.map +1 -0
  369. package/dist/core/secrets/secret-vault.js +671 -0
  370. package/dist/core/secrets/secret-vault.js.map +1 -0
  371. package/dist/core/session-analytics.d.ts +4 -23
  372. package/dist/core/session-analytics.d.ts.map +1 -1
  373. package/dist/core/session-analytics.js +39 -69
  374. package/dist/core/session-analytics.js.map +1 -1
  375. package/dist/core/session-artifact-bundle.d.ts +35 -0
  376. package/dist/core/session-artifact-bundle.d.ts.map +1 -0
  377. package/dist/core/session-artifact-bundle.js +61 -0
  378. package/dist/core/session-artifact-bundle.js.map +1 -0
  379. package/dist/core/session-role.d.ts +5 -0
  380. package/dist/core/session-role.d.ts.map +1 -1
  381. package/dist/core/session-role.js +14 -1
  382. package/dist/core/session-role.js.map +1 -1
  383. package/dist/core/session-tree-navigator.d.ts +4 -6
  384. package/dist/core/session-tree-navigator.d.ts.map +1 -1
  385. package/dist/core/session-tree-navigator.js +4 -1
  386. package/dist/core/session-tree-navigator.js.map +1 -1
  387. package/dist/core/settings-manager.d.ts +1 -1
  388. package/dist/core/settings-manager.d.ts.map +1 -1
  389. package/dist/core/settings-manager.js +1 -1
  390. package/dist/core/settings-manager.js.map +1 -1
  391. package/dist/core/slash-commands.d.ts.map +1 -1
  392. package/dist/core/slash-commands.js +2 -2
  393. package/dist/core/slash-commands.js.map +1 -1
  394. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  395. package/dist/core/tool-capability-policy.js +1 -0
  396. package/dist/core/tool-capability-policy.js.map +1 -1
  397. package/dist/core/tool-gate-controller.d.ts.map +1 -1
  398. package/dist/core/tool-gate-controller.js +8 -2
  399. package/dist/core/tool-gate-controller.js.map +1 -1
  400. package/dist/core/tool-protocol-controller.d.ts +2 -4
  401. package/dist/core/tool-protocol-controller.d.ts.map +1 -1
  402. package/dist/core/tool-protocol-controller.js.map +1 -1
  403. package/dist/core/tool-recovery-stats.d.ts +21 -1
  404. package/dist/core/tool-recovery-stats.d.ts.map +1 -1
  405. package/dist/core/tool-recovery-stats.js.map +1 -1
  406. package/dist/core/tools/bash.d.ts +5 -0
  407. package/dist/core/tools/bash.d.ts.map +1 -1
  408. package/dist/core/tools/bash.js +59 -5
  409. package/dist/core/tools/bash.js.map +1 -1
  410. package/dist/core/tools/delegate-status.d.ts +6 -1
  411. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  412. package/dist/core/tools/delegate-status.js +106 -25
  413. package/dist/core/tools/delegate-status.js.map +1 -1
  414. package/dist/core/tools/delegate.d.ts +9 -1
  415. package/dist/core/tools/delegate.d.ts.map +1 -1
  416. package/dist/core/tools/delegate.js +329 -69
  417. package/dist/core/tools/delegate.js.map +1 -1
  418. package/dist/core/tools/git-filter.d.ts +1 -8
  419. package/dist/core/tools/git-filter.d.ts.map +1 -1
  420. package/dist/core/tools/git-filter.js +2 -63
  421. package/dist/core/tools/git-filter.js.map +1 -1
  422. package/dist/core/tools/goal.d.ts +5 -3
  423. package/dist/core/tools/goal.d.ts.map +1 -1
  424. package/dist/core/tools/goal.js +97 -19
  425. package/dist/core/tools/goal.js.map +1 -1
  426. package/dist/core/tools/index.d.ts +1 -0
  427. package/dist/core/tools/index.d.ts.map +1 -1
  428. package/dist/core/tools/index.js +1 -0
  429. package/dist/core/tools/index.js.map +1 -1
  430. package/dist/core/tools/orchestration-panel.d.ts +1 -4
  431. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  432. package/dist/core/tools/orchestration-panel.js +0 -44
  433. package/dist/core/tools/orchestration-panel.js.map +1 -1
  434. package/dist/core/tools/output-accumulator.d.ts +11 -0
  435. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  436. package/dist/core/tools/output-accumulator.js +36 -3
  437. package/dist/core/tools/output-accumulator.js.map +1 -1
  438. package/dist/core/tools/python.d.ts +2 -0
  439. package/dist/core/tools/python.d.ts.map +1 -1
  440. package/dist/core/tools/python.js +3 -1
  441. package/dist/core/tools/python.js.map +1 -1
  442. package/dist/core/tools/read.d.ts.map +1 -1
  443. package/dist/core/tools/read.js +1 -1
  444. package/dist/core/tools/read.js.map +1 -1
  445. package/dist/core/tools/run-process.d.ts +1 -1
  446. package/dist/core/tools/run-process.d.ts.map +1 -1
  447. package/dist/core/tools/run-process.js +69 -9
  448. package/dist/core/tools/run-process.js.map +1 -1
  449. package/dist/core/tools/search-command-guard.d.ts +14 -0
  450. package/dist/core/tools/search-command-guard.d.ts.map +1 -0
  451. package/dist/core/tools/search-command-guard.js +333 -0
  452. package/dist/core/tools/search-command-guard.js.map +1 -0
  453. package/dist/core/tools/secret-store.d.ts +38 -0
  454. package/dist/core/tools/secret-store.d.ts.map +1 -0
  455. package/dist/core/tools/secret-store.js +412 -0
  456. package/dist/core/tools/secret-store.js.map +1 -0
  457. package/dist/core/tools/shell-command-parser.d.ts +16 -0
  458. package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
  459. package/dist/core/tools/shell-command-parser.js +113 -0
  460. package/dist/core/tools/shell-command-parser.js.map +1 -0
  461. package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
  462. package/dist/core/tools/shell-contract-router.js +12 -5
  463. package/dist/core/tools/shell-contract-router.js.map +1 -1
  464. package/dist/core/tools/task-steps.d.ts.map +1 -1
  465. package/dist/core/tools/task-steps.js +4 -7
  466. package/dist/core/tools/task-steps.js.map +1 -1
  467. package/dist/core/util/atomic-file.d.ts +6 -2
  468. package/dist/core/util/atomic-file.d.ts.map +1 -1
  469. package/dist/core/util/atomic-file.js +4 -4
  470. package/dist/core/util/atomic-file.js.map +1 -1
  471. package/dist/core/util/bounded-file.d.ts +15 -0
  472. package/dist/core/util/bounded-file.d.ts.map +1 -0
  473. package/dist/core/util/bounded-file.js +120 -0
  474. package/dist/core/util/bounded-file.js.map +1 -0
  475. package/dist/core/util/bounded-jsonl.d.ts.map +1 -1
  476. package/dist/core/util/bounded-jsonl.js +119 -9
  477. package/dist/core/util/bounded-jsonl.js.map +1 -1
  478. package/dist/core/util/bounded-value.d.ts +3 -0
  479. package/dist/core/util/bounded-value.d.ts.map +1 -0
  480. package/dist/core/util/bounded-value.js +12 -0
  481. package/dist/core/util/bounded-value.js.map +1 -0
  482. package/dist/core/util/value-guards.d.ts +2 -0
  483. package/dist/core/util/value-guards.d.ts.map +1 -1
  484. package/dist/core/util/value-guards.js +5 -0
  485. package/dist/core/util/value-guards.js.map +1 -1
  486. package/dist/index.d.ts +3 -2
  487. package/dist/index.d.ts.map +1 -1
  488. package/dist/index.js +2 -1
  489. package/dist/index.js.map +1 -1
  490. package/dist/main.d.ts.map +1 -1
  491. package/dist/main.js +25 -11
  492. package/dist/main.js.map +1 -1
  493. package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
  494. package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
  495. package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
  496. package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
  497. package/dist/modes/interactive/components/activity-lane.d.ts +55 -0
  498. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
  499. package/dist/modes/interactive/components/activity-lane.js +304 -0
  500. package/dist/modes/interactive/components/activity-lane.js.map +1 -0
  501. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  502. package/dist/modes/interactive/components/assistant-message.js +19 -10
  503. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  504. package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
  505. package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
  506. package/dist/modes/interactive/components/expandable-text.js +17 -0
  507. package/dist/modes/interactive/components/expandable-text.js.map +1 -0
  508. package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
  509. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  510. package/dist/modes/interactive/components/extension-editor.js +30 -21
  511. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  512. package/dist/modes/interactive/components/extension-input.d.ts +1 -0
  513. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  514. package/dist/modes/interactive/components/extension-input.js +6 -1
  515. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  516. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  517. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  518. package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
  519. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  520. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  521. package/dist/modes/interactive/components/session-selector.js +27 -44
  522. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  523. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  524. package/dist/modes/interactive/components/settings-selector.js +4 -4
  525. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  526. package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
  527. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  528. package/dist/modes/interactive/components/tool-execution.js +53 -20
  529. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  530. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
  531. package/dist/modes/interactive/components/tool-group.js +3 -0
  532. package/dist/modes/interactive/components/tool-group.js.map +1 -1
  533. package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
  534. package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
  535. package/dist/modes/interactive/components/usage-action-selector.js +46 -0
  536. package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
  537. package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
  538. package/dist/modes/interactive/extension-ui-host.js +1 -0
  539. package/dist/modes/interactive/extension-ui-host.js.map +1 -1
  540. package/dist/modes/interactive/external-editor.d.ts +15 -0
  541. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  542. package/dist/modes/interactive/external-editor.js +27 -19
  543. package/dist/modes/interactive/external-editor.js.map +1 -1
  544. package/dist/modes/interactive/history-reload-math.d.ts +6 -2
  545. package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
  546. package/dist/modes/interactive/history-reload-math.js +10 -5
  547. package/dist/modes/interactive/history-reload-math.js.map +1 -1
  548. package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
  549. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
  550. package/dist/modes/interactive/interactive-event-controller.js +328 -0
  551. package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
  552. package/dist/modes/interactive/interactive-mode.d.ts +20 -25
  553. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  554. package/dist/modes/interactive/interactive-mode.js +196 -608
  555. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  556. package/dist/modes/interactive/loaded-resources-view.d.ts +20 -0
  557. package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
  558. package/dist/modes/interactive/loaded-resources-view.js +147 -0
  559. package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
  560. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  561. package/dist/modes/interactive/resource-display.js +8 -2
  562. package/dist/modes/interactive/resource-display.js.map +1 -1
  563. package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
  564. package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
  565. package/dist/modes/interactive/resource-shell-commands.js +0 -5
  566. package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
  567. package/dist/modes/interactive/session-flow-commands.d.ts +10 -6
  568. package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
  569. package/dist/modes/interactive/session-flow-commands.js +123 -70
  570. package/dist/modes/interactive/session-flow-commands.js.map +1 -1
  571. package/dist/modes/interactive/usage-commands.d.ts +34 -0
  572. package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
  573. package/dist/modes/interactive/usage-commands.js +225 -0
  574. package/dist/modes/interactive/usage-commands.js.map +1 -0
  575. package/dist/utils/shell.d.ts.map +1 -1
  576. package/dist/utils/shell.js +5 -3
  577. package/dist/utils/shell.js.map +1 -1
  578. package/dist/utils/version-check.d.ts.map +1 -1
  579. package/dist/utils/version-check.js +3 -1
  580. package/dist/utils/version-check.js.map +1 -1
  581. package/docs/UI_POLISH_ORCHESTRATION.md +25 -31
  582. package/docs/UI_QUALITY_ORCHESTRATION.md +22 -24
  583. package/docs/providers.md +9 -1
  584. package/docs/tool-repair.md +3 -0
  585. package/docs/ui-reference/README.md +6 -6
  586. package/docs/ui-reference/orchestration-after.txt +14 -7
  587. package/docs/ui-reference/orchestration-before.txt +12 -6
  588. package/docs/ui-reference/orchestration-reference.txt +15 -5
  589. package/docs/usage.md +9 -1
  590. package/docs/windows.md +4 -2
  591. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  592. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  593. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  594. package/examples/extensions/sandbox/package-lock.json +2 -2
  595. package/examples/extensions/sandbox/package.json +1 -1
  596. package/examples/extensions/with-deps/package-lock.json +2 -2
  597. package/examples/extensions/with-deps/package.json +1 -1
  598. package/npm-shrinkwrap.json +13 -13
  599. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-jsonl.js","sourceRoot":"","sources":["../../../src/core/util/bounded-jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,IAAI,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQxG,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAE1D,SAAS,cAAc,CAAC,MAA0B,EAAQ;IACzD,IACC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;QACtC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QACzC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;QACxC,MAAM,CAAC,QAAQ,IAAI,CAAC;QACpB,MAAM,CAAC,WAAW,IAAI,CAAC;QACvB,MAAM,CAA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K,IAAI,EAAE,CAAC;YACxC,MAAM,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ;gBAAE,OAAO;YACtE,MAAM,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAAA,CACvG,CAAC,CAAC;IAAA,CACH,CAAC,CAAC;IACJ,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAI,CAAC;QACJ,MAAM,SAAS,CAAC;IACjB,CAAC;YAAS,CAAC;QACV,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS;YAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrF,CAAC;AAAA,CACD","sourcesContent":["import { appendFileSync, promises as fsPromises, readFileSync, statSync } from \"node:fs\";\nimport { withFileLock, withFileLockSync, writeFileAtomic, writeFileAtomicSync } from \"./atomic-file.ts\";\n\nexport interface BoundedJsonlLimits {\n\tmaxBytes: number;\n\ttargetBytes: number;\n\tmaxRecords: number;\n}\n\nconst asyncAppendTails = new Map<string, Promise<void>>();\n\nfunction validateLimits(limits: BoundedJsonlLimits): void {\n\tif (\n\t\t!Number.isSafeInteger(limits.maxBytes) ||\n\t\t!Number.isSafeInteger(limits.targetBytes) ||\n\t\t!Number.isSafeInteger(limits.maxRecords) ||\n\t\tlimits.maxBytes <= 0 ||\n\t\tlimits.targetBytes <= 0 ||\n\t\tlimits.targetBytes > limits.maxBytes ||\n\t\tlimits.maxRecords <= 0\n\t) {\n\t\tthrow new TypeError(\"Bounded JSONL limits require positive integers and targetBytes <= maxBytes.\");\n\t}\n}\n\nfunction retainedContent(content: string, limits: BoundedJsonlLimits): string {\n\tconst lines = content.split(\"\\n\").filter((line) => line.trim().length > 0);\n\tconst retained: string[] = [];\n\tlet retainedBytes = 0;\n\tfor (let index = lines.length - 1; index >= 0 && retained.length < limits.maxRecords; index--) {\n\t\tconst line = lines[index]!;\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + 1;\n\t\tif (lineBytes > limits.maxBytes) continue;\n\t\tif (retained.length > 0 && retainedBytes + lineBytes > limits.targetBytes) break;\n\t\tretained.push(line);\n\t\tretainedBytes += lineBytes;\n\t\tif (retainedBytes >= limits.targetBytes) break;\n\t}\n\tretained.reverse();\n\treturn retained.length > 0 ? `${retained.join(\"\\n\")}\\n` : \"\";\n}\n\nfunction serializeLine(value: unknown): string {\n\tconst encoded = JSON.stringify(value);\n\tif (encoded === undefined) throw new TypeError(\"Bounded JSONL records must be JSON-serializable values.\");\n\treturn `${encoded}\\n`;\n}\n\n/** Append one JSON record and rotate to the newest low-water tail under one exclusive lock. */\nexport function appendBoundedJsonLineSync(filePath: string, value: unknown, limits: BoundedJsonlLimits): void {\n\tvalidateLimits(limits);\n\tconst line = serializeLine(value);\n\twithFileLockSync(filePath, () => {\n\t\tappendFileSync(filePath, line, \"utf-8\");\n\t\tif (statSync(filePath).size <= limits.maxBytes) return;\n\t\twriteFileAtomicSync(filePath, retainedContent(readFileSync(filePath, \"utf-8\"), limits));\n\t});\n}\n\n/** Async counterpart of {@link appendBoundedJsonLineSync}. */\nexport async function appendBoundedJsonLine(\n\tfilePath: string,\n\tvalue: unknown,\n\tlimits: BoundedJsonlLimits,\n): Promise<void> {\n\tvalidateLimits(limits);\n\tconst line = serializeLine(value);\n\tconst previous = asyncAppendTails.get(filePath) ?? Promise.resolve();\n\tconst operation = previous\n\t\t.catch(() => undefined)\n\t\t.then(async () => {\n\t\t\tawait withFileLock(filePath, async () => {\n\t\t\t\tawait fsPromises.appendFile(filePath, line, \"utf-8\");\n\t\t\t\tif ((await fsPromises.stat(filePath)).size <= limits.maxBytes) return;\n\t\t\t\tawait writeFileAtomic(filePath, retainedContent(await fsPromises.readFile(filePath, \"utf-8\"), limits));\n\t\t\t});\n\t\t});\n\tasyncAppendTails.set(filePath, operation);\n\ttry {\n\t\tawait operation;\n\t} finally {\n\t\tif (asyncAppendTails.get(filePath) === operation) asyncAppendTails.delete(filePath);\n\t}\n}\n"]}
1
+ {"version":3,"file":"bounded-jsonl.js","sourceRoot":"","sources":["../../../src/core/util/bounded-jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,IAAI,UAAU,EAAc,QAAQ,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAQjF,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAC1D,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAO7B,MAAM,UAAU,GAAG,IAAI,GAAG,EAA0B,CAAC;AAErD,SAAS,aAAa,CAAC,IAAW,EAAE,KAAY,EAAW;IAC1D,OAAO,CACN,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;QACtB,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;QACtB,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QACxB,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;QAC9B,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,CAC9B,CAAC;AAAA,CACF;AAED,SAAS,iBAAiB,CAAC,QAAgB,EAAE,KAAY,EAAsB;IAC9E,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAA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MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC5B,MAAM,KAAK,CAAC;YACb,CAAC;QAAA,CACD,CAAC,CAAC;IAAA,CACH,CAAC,CAAC;IACJ,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAI,CAAC;QACJ,MAAM,SAAS,CAAC;IACjB,CAAC;YAAS,CAAC;QACV,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS;YAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrF,CAAC;AAAA,CACD","sourcesContent":["import { appendFileSync, promises as fsPromises, type Stats, statSync } from \"node:fs\";\nimport { withFileLock, withFileLockSync, writeFileAtomic, writeFileAtomicSync } from \"./atomic-file.ts\";\nimport { readBoundedTextFile, readBoundedTextFileSync } from \"./bounded-file.ts\";\n\nexport interface BoundedJsonlLimits {\n\tmaxBytes: number;\n\ttargetBytes: number;\n\tmaxRecords: number;\n}\n\nconst asyncAppendTails = new Map<string, Promise<void>>();\nconst MAX_CACHED_FILES = 128;\n\ninterface JsonlFileState {\n\tstats: Stats;\n\trecordCount: number;\n}\n\nconst fileStates = new Map<string, JsonlFileState>();\n\nfunction sameFileState(left: Stats, right: Stats): boolean {\n\treturn (\n\t\tleft.dev === right.dev &&\n\t\tleft.ino === right.ino &&\n\t\tleft.size === right.size &&\n\t\tleft.mtimeMs === right.mtimeMs &&\n\t\tleft.ctimeMs === right.ctimeMs\n\t);\n}\n\nfunction cachedRecordCount(filePath: string, stats: Stats): number | undefined {\n\tconst cached = fileStates.get(filePath);\n\tif (!cached || !sameFileState(cached.stats, stats)) return undefined;\n\tfileStates.delete(filePath);\n\tfileStates.set(filePath, cached);\n\treturn cached.recordCount;\n}\n\nfunction rememberFileState(filePath: string, stats: Stats, recordCount: number): void {\n\tfileStates.delete(filePath);\n\tfileStates.set(filePath, { stats, recordCount });\n\twhile (fileStates.size > MAX_CACHED_FILES) {\n\t\tconst oldest = fileStates.keys().next().value;\n\t\tif (oldest === undefined) break;\n\t\tfileStates.delete(oldest);\n\t}\n}\n\nfunction recordCount(content: string): number {\n\tlet count = 0;\n\tfor (const line of content.split(\"\\n\")) {\n\t\tif (line.trim().length > 0) count++;\n\t}\n\treturn count;\n}\n\nfunction validateLimits(limits: BoundedJsonlLimits): void {\n\tif (\n\t\t!Number.isSafeInteger(limits.maxBytes) ||\n\t\t!Number.isSafeInteger(limits.targetBytes) ||\n\t\t!Number.isSafeInteger(limits.maxRecords) ||\n\t\tlimits.maxBytes <= 0 ||\n\t\tlimits.targetBytes <= 0 ||\n\t\tlimits.targetBytes > limits.maxBytes ||\n\t\tlimits.maxRecords <= 0\n\t) {\n\t\tthrow new TypeError(\"Bounded JSONL limits require positive integers and targetBytes <= maxBytes.\");\n\t}\n}\n\nfunction retainedContent(content: string, limits: BoundedJsonlLimits): string {\n\tconst lines = content.split(\"\\n\").filter((line) => line.trim().length > 0);\n\tconst retained: string[] = [];\n\tlet retainedBytes = 0;\n\tfor (let index = lines.length - 1; index >= 0 && retained.length < limits.maxRecords; index--) {\n\t\tconst line = lines[index]!;\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + 1;\n\t\tif (lineBytes > limits.maxBytes) continue;\n\t\tif (retained.length > 0 && retainedBytes + lineBytes > limits.targetBytes) break;\n\t\tretained.push(line);\n\t\tretainedBytes += lineBytes;\n\t\tif (retainedBytes >= limits.targetBytes) break;\n\t}\n\tretained.reverse();\n\treturn retained.length > 0 ? `${retained.join(\"\\n\")}\\n` : \"\";\n}\n\nfunction serializeLine(value: unknown): string {\n\tconst encoded = JSON.stringify(value);\n\tif (encoded === undefined) throw new TypeError(\"Bounded JSONL records must be JSON-serializable values.\");\n\treturn `${encoded}\\n`;\n}\n\nfunction assertLineFits(line: string, limits: BoundedJsonlLimits): number {\n\tconst bytes = Buffer.byteLength(line, \"utf-8\");\n\tif (bytes > limits.maxBytes) throw new Error(\"Bounded JSONL record exceeds maxBytes.\");\n\treturn bytes;\n}\n\nfunction existingStatsSync(filePath: string): Stats | undefined {\n\ttry {\n\t\treturn statSync(filePath);\n\t} catch (error) {\n\t\tif (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") return undefined;\n\t\tthrow error;\n\t}\n}\n\nasync function existingStats(filePath: string): Promise<Stats | undefined> {\n\ttry {\n\t\treturn await fsPromises.stat(filePath);\n\t} catch (error) {\n\t\tif (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") return undefined;\n\t\tthrow error;\n\t}\n}\n\n/** Append one JSON record and rotate to the newest low-water tail under one exclusive lock. */\nexport function appendBoundedJsonLineSync(filePath: string, value: unknown, limits: BoundedJsonlLimits): void {\n\tvalidateLimits(limits);\n\tconst line = serializeLine(value);\n\tconst lineBytes = assertLineFits(line, limits);\n\twithFileLockSync(filePath, () => {\n\t\ttry {\n\t\t\tconst before = existingStatsSync(filePath);\n\t\t\tif (!before || before.size > limits.maxBytes) {\n\t\t\t\twriteFileAtomicSync(filePath, line);\n\t\t\t\trememberFileState(filePath, statSync(filePath), 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet content: string | undefined;\n\t\t\tlet count = cachedRecordCount(filePath, before);\n\t\t\tif (count === undefined) {\n\t\t\t\tcontent = readBoundedTextFileSync(filePath, limits.maxBytes, \"Bounded JSONL file\");\n\t\t\t\tcount = recordCount(content);\n\t\t\t}\n\t\t\tif (before.size + lineBytes <= limits.maxBytes && count + 1 <= limits.maxRecords) {\n\t\t\t\tappendFileSync(filePath, line, \"utf-8\");\n\t\t\t\trememberFileState(filePath, statSync(filePath), count + 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcontent ??= readBoundedTextFileSync(filePath, limits.maxBytes, \"Bounded JSONL file\");\n\t\t\tconst retained = retainedContent(`${content}${line}`, limits);\n\t\t\twriteFileAtomicSync(filePath, retained);\n\t\t\trememberFileState(filePath, statSync(filePath), recordCount(retained));\n\t\t} catch (error) {\n\t\t\tfileStates.delete(filePath);\n\t\t\tthrow error;\n\t\t}\n\t});\n}\n\n/** Async counterpart of {@link appendBoundedJsonLineSync}. */\nexport async function appendBoundedJsonLine(\n\tfilePath: string,\n\tvalue: unknown,\n\tlimits: BoundedJsonlLimits,\n): Promise<void> {\n\tvalidateLimits(limits);\n\tconst line = serializeLine(value);\n\tconst lineBytes = assertLineFits(line, limits);\n\tconst previous = asyncAppendTails.get(filePath) ?? Promise.resolve();\n\tconst operation = previous\n\t\t.catch(() => undefined)\n\t\t.then(async () => {\n\t\t\tawait withFileLock(filePath, async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst before = await existingStats(filePath);\n\t\t\t\t\tif (!before || before.size > limits.maxBytes) {\n\t\t\t\t\t\tawait writeFileAtomic(filePath, line);\n\t\t\t\t\t\trememberFileState(filePath, await fsPromises.stat(filePath), 1);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet content: string | undefined;\n\t\t\t\t\tlet count = cachedRecordCount(filePath, before);\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tcontent = await readBoundedTextFile(filePath, limits.maxBytes, \"Bounded JSONL file\");\n\t\t\t\t\t\tcount = recordCount(content);\n\t\t\t\t\t}\n\t\t\t\t\tif (before.size + lineBytes <= limits.maxBytes && count + 1 <= limits.maxRecords) {\n\t\t\t\t\t\tawait fsPromises.appendFile(filePath, line, \"utf-8\");\n\t\t\t\t\t\trememberFileState(filePath, await fsPromises.stat(filePath), count + 1);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcontent ??= await readBoundedTextFile(filePath, limits.maxBytes, \"Bounded JSONL file\");\n\t\t\t\t\tconst retained = retainedContent(`${content}${line}`, limits);\n\t\t\t\t\tawait writeFileAtomic(filePath, retained);\n\t\t\t\t\trememberFileState(filePath, await fsPromises.stat(filePath), recordCount(retained));\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfileStates.delete(filePath);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\tasyncAppendTails.set(filePath, operation);\n\ttry {\n\t\tawait operation;\n\t} finally {\n\t\tif (asyncAppendTails.get(filePath) === operation) asyncAppendTails.delete(filePath);\n\t}\n}\n"]}
@@ -0,0 +1,3 @@
1
+ /** One primitive for required, trimmed durable text fields shared across control-plane stores. */
2
+ export declare function requireBoundedTrimmedText(value: string, maximum: number, label: string): string;
3
+ //# sourceMappingURL=bounded-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-value.d.ts","sourceRoot":"","sources":["../../../src/core/util/bounded-value.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS/F","sourcesContent":["/** One primitive for required, trimmed durable text fields shared across control-plane stores. */\nexport function requireBoundedTrimmedText(value: string, maximum: number, label: string): string {\n\tif (!Number.isSafeInteger(maximum) || maximum < 1) {\n\t\tthrow new TypeError(\"A bounded text maximum must be a positive safe integer.\");\n\t}\n\tconst trimmed = value.trim();\n\tif (!trimmed || trimmed.length > maximum) {\n\t\tthrow new TypeError(`${label} must be between 1 and ${maximum} characters.`);\n\t}\n\treturn trimmed;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /** One primitive for required, trimmed durable text fields shared across control-plane stores. */
2
+ export function requireBoundedTrimmedText(value, maximum, label) {
3
+ if (!Number.isSafeInteger(maximum) || maximum < 1) {
4
+ throw new TypeError("A bounded text maximum must be a positive safe integer.");
5
+ }
6
+ const trimmed = value.trim();
7
+ if (!trimmed || trimmed.length > maximum) {
8
+ throw new TypeError(`${label} must be between 1 and ${maximum} characters.`);
9
+ }
10
+ return trimmed;
11
+ }
12
+ //# sourceMappingURL=bounded-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-value.js","sourceRoot":"","sources":["../../../src/core/util/bounded-value.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,UAAU,yBAAyB,CAAC,KAAa,EAAE,OAAe,EAAE,KAAa,EAAU;IAChG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,0BAA0B,OAAO,cAAc,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,OAAO,CAAC;AAAA,CACf","sourcesContent":["/** One primitive for required, trimmed durable text fields shared across control-plane stores. */\nexport function requireBoundedTrimmedText(value: string, maximum: number, label: string): string {\n\tif (!Number.isSafeInteger(maximum) || maximum < 1) {\n\t\tthrow new TypeError(\"A bounded text maximum must be a positive safe integer.\");\n\t}\n\tconst trimmed = value.trim();\n\tif (!trimmed || trimmed.length > maximum) {\n\t\tthrow new TypeError(`${label} must be between 1 and ${maximum} characters.`);\n\t}\n\treturn trimmed;\n}\n"]}
@@ -2,4 +2,6 @@
2
2
  export declare function isRecordObject(value: unknown): value is Record<string, unknown>;
3
3
  /** Accepts only ordinary JSON-style records, including null-prototype dictionaries. */
4
4
  export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
5
+ /** Fail closed when an untrusted record contains a field outside its typed contract. */
6
+ export declare function hasOnlyKeys(record: Record<string, unknown>, allowed: readonly string[]): boolean;
5
7
  //# sourceMappingURL=value-guards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"value-guards.d.ts","sourceRoot":"","sources":["../../../src/core/util/value-guards.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE/E;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAI9E","sourcesContent":["/** Accepts non-null object records while excluding arrays; custom prototypes remain valid. */\nexport function isRecordObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Accepts only ordinary JSON-style records, including null-prototype dictionaries. */\nexport function isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (!isRecordObject(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n"]}
1
+ {"version":3,"file":"value-guards.d.ts","sourceRoot":"","sources":["../../../src/core/util/value-guards.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE/E;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAI9E;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAGhG","sourcesContent":["/** Accepts non-null object records while excluding arrays; custom prototypes remain valid. */\nexport function isRecordObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Accepts only ordinary JSON-style records, including null-prototype dictionaries. */\nexport function isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (!isRecordObject(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n/** Fail closed when an untrusted record contains a field outside its typed contract. */\nexport function hasOnlyKeys(record: Record<string, unknown>, allowed: readonly string[]): boolean {\n\tconst allowedSet = new Set(allowed);\n\treturn Object.keys(record).every((key) => allowedSet.has(key));\n}\n"]}
@@ -9,4 +9,9 @@ export function isPlainRecord(value) {
9
9
  const prototype = Object.getPrototypeOf(value);
10
10
  return prototype === Object.prototype || prototype === null;
11
11
  }
12
+ /** Fail closed when an untrusted record contains a field outside its typed contract. */
13
+ export function hasOnlyKeys(record, allowed) {
14
+ const allowedSet = new Set(allowed);
15
+ return Object.keys(record).every((key) => allowedSet.has(key));
16
+ }
12
17
  //# sourceMappingURL=value-guards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"value-guards.js","sourceRoot":"","sources":["../../../src/core/util/value-guards.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAAC,KAAc,EAAoC;IAChF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC5E;AAED,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,KAAc,EAAoC;IAC/E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAAA,CAC5D","sourcesContent":["/** Accepts non-null object records while excluding arrays; custom prototypes remain valid. */\nexport function isRecordObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Accepts only ordinary JSON-style records, including null-prototype dictionaries. */\nexport function isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (!isRecordObject(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n"]}
1
+ {"version":3,"file":"value-guards.js","sourceRoot":"","sources":["../../../src/core/util/value-guards.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAAC,KAAc,EAAoC;IAChF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC5E;AAED,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,KAAc,EAAoC;IAC/E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAAA,CAC5D;AAED,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,MAA+B,EAAE,OAA0B,EAAW;IACjG,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAAA,CAC/D","sourcesContent":["/** Accepts non-null object records while excluding arrays; custom prototypes remain valid. */\nexport function isRecordObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Accepts only ordinary JSON-style records, including null-prototype dictionaries. */\nexport function isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (!isRecordObject(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n/** Fail closed when an untrusted record contains a field outside its typed contract. */\nexport function hasOnlyKeys(record: Record<string, unknown>, allowed: readonly string[]): boolean {\n\tconst allowedSet = new Set(allowed);\n\treturn Object.keys(record).every((key) => allowedSet.has(key));\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { getAgentDir, VERSION } from "./config.ts";
5
5
  export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
6
6
  export { type ApiKeyCredential, type AuthCredential, type AuthStatus, AuthStorage, type AuthStorageBackend, FileAuthStorageBackend, InMemoryAuthStorageBackend, type OAuthCredential, } from "./core/auth-storage.ts";
7
7
  export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
8
- export type { AgentEndEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionStorage, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, ExtensionWorkRunOptions, FindToolCallEvent, GrepToolCallEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageRenderer, MessageRenderOptions, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionMode, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
8
+ export type { AgentEndEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionStorage, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, ExtensionWorkRunOptions, FindToolCallEvent, GrepToolCallEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
9
9
  export { createExtensionRuntime, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
10
10
  export type { ReadonlyFooterDataProvider } from "./core/footer-data-provider.ts";
11
11
  export { appendRunRecord, type ConfidenceMode, type ConfidenceResult, cleanupImprovementSandbox, compareMetric, computeMadConfidence, createImprovementDecisionTool, createImprovementLoopTool, createImprovementSandbox, decideImprovement, exportImprovementSandboxPatch, type GitStatusEntry, type ImprovementDecision, type ImprovementDecisionInput, type ImprovementDecisionReason, type ImprovementDecisionResult, type ImprovementLoopConfig, type ImprovementLoopExec, type ImprovementLoopInitInput, type ImprovementLoopPaths, type ImprovementLoopRecordInput, type ImprovementLoopState, type ImprovementLoopStatusInput, type ImprovementLoopToolAction, type ImprovementLoopToolDetails, type ImprovementMeasurementCommandResult, type ImprovementMeasurementResult, type ImprovementRunRecord, type ImprovementSandboxCleanupInput, type ImprovementSandboxCreateInput, type ImprovementSandboxExportInput, type ImprovementSandboxRecord, improvementLoopPaths, initImprovementLoop, type LowConfidenceAction, type MetricComparison, type MetricDirection, median, medianAbsoluteDeviation, metricMapFromOutput, type OwnedDiscardPlan, type OwnedDiscardPlanInput, parseGitPorcelainStatus, parseMetricLines, planOwnedDiscard, readImprovementLoopState, readRunRecords, recordImprovementRun, runImprovementMeasurement, selectPrimaryMetric, serializeRunRecord, } from "./core/improvement-loop.ts";
@@ -26,11 +26,12 @@ export type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from "./co
26
26
  export { DefaultResourceLoader, loadProjectContextFiles } from "./core/resource-loader.ts";
27
27
  export { mergeResourceProfileMap, mergeResourceProfileSettings, parseResourceProfileBlocks, parseResourceProfileInput, parseResourceProfileJson, stripResourceProfileBlocks, } from "./core/resource-profile-blocks.ts";
28
28
  export { AgentSessionRuntime, type AgentSessionRuntimeDiagnostic, type AgentSessionRuntimeResource, type AgentSessionServices, type AgentSessionSwitchOptions, type CreateAgentSessionFromServicesOptions, type CreateAgentSessionOptions, type CreateAgentSessionResult, type CreateAgentSessionRuntimeFactory, type CreateAgentSessionRuntimeResult, type CreateAgentSessionServicesOptions, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool, type PromptTemplate, SessionReplacementCallbackError, SessionReplacementRuntimeError, } from "./core/sdk.ts";
29
+ export { type SecretEnvDestinationState, type SecretMaterializationResult, type SecretProfileSummary, type SecretRemovalResult, type SecretVariableValue, SecretVault, SecretVaultError, type SecretVaultErrorCode, type SecretVaultOptions, } from "./core/secrets/secret-vault.ts";
29
30
  export { type CompactionSettings, type DirectoryResourceProfileInfo, getDirectoryResourceProfileInfo, type ImageSettings, matchesResourceProfilePattern, type PackageSource, type ResourceProfileFilterSettings, type ResourceProfileKind, type ResourceProfileSettings, type RetrySettings, SettingsManager, type SettingsManagerCreateOptions, } from "./core/settings-manager.ts";
30
31
  export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
31
32
  export { createSyntheticSourceInfo } from "./core/source-info.ts";
32
33
  export { type AskQuestion, type AskQuestionAnswer, AskQuestionDialog, type AskQuestionStopReason, type AskQuestionToolDetails, type AskQuestionToolInput, type AskQuestionToolOptions, createAskQuestionToolDefinition, } from "./core/tools/ask-question.ts";
33
- export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
34
+ export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createSecretStoreToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type SecretStoreStatus, type SecretStoreToolDetails, type SecretStoreToolInput, type SecretStoreToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
34
35
  export { jaccard, runSkillAudit, type SkillAuditReport, type SkillSummary, tokenize, } from "./core/tools/skill-audit.ts";
35
36
  export { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from "./core/trust-manager.ts";
36
37
  export { type MainOptions, main } from "./main.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAA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KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,KAAK,qBAAqB,EAC1B,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,YAAY,GACjB,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EACd,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,mBAAmB,EACxB,qBAAqB,EACrB,aAAa,EACb,KAAK,wBAAwB,GAC7B,MAAM,gCAAgC,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AqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,KAAK,qBAAqB,EAC1B,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,YAAY,GACjB,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\ttype SecretEnvDestinationState,\n\ttype SecretMaterializationResult,\n\ttype SecretProfileSummary,\n\ttype SecretRemovalResult,\n\ttype SecretVariableValue,\n\tSecretVault,\n\tSecretVaultError,\n\ttype SecretVaultErrorCode,\n\ttype SecretVaultOptions,\n} from \"./core/secrets/secret-vault.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSecretStoreToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}
package/dist/index.js CHANGED
@@ -31,13 +31,14 @@ export { AgentSessionRuntime,
31
31
  createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool,
32
32
  // Tool factories (for custom cwd)
33
33
  createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool, SessionReplacementCallbackError, SessionReplacementRuntimeError, } from "./core/sdk.js";
34
+ export { SecretVault, SecretVaultError, } from "./core/secrets/secret-vault.js";
34
35
  export { getDirectoryResourceProfileInfo, matchesResourceProfilePattern, SettingsManager, } from "./core/settings-manager.js";
35
36
  // Skills
36
37
  export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir, } from "./core/skills.js";
37
38
  export { createSyntheticSourceInfo } from "./core/source-info.js";
38
39
  export { AskQuestionDialog, createAskQuestionToolDefinition, } from "./core/tools/ask-question.js";
39
40
  // Tools
40
- export { createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, withFileMutationQueue, } from "./core/tools/index.js";
41
+ export { createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createSecretStoreToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, withFileMutationQueue, } from "./core/tools/index.js";
41
42
  // Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native
42
43
  // Jaccard overlap audit via `import { runSkillAudit } from "@caupulican/pi-adaptative"` instead of
43
44
  // carrying a duplicate copy.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,aAAa;AACb,OAAO,EAIN,mBAAmB,EAInB,uBAAuB,EAIvB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAGd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EAExB,qBAAqB,EAErB,mBAAmB,EACnB,oBAAoB,EAOpB,cAAc,EAEd,qBAAqB,EACrB,aAAa,GAEb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAIN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AAoF7F,OAAO,EACN,sBAAsB,EACtB,UAAU,EACV,yBAAyB,EACzB,eAA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,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EAInB,sBAAsB,EAEtB,kBAAkB,EAIlB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEN,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAGf,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,aAAa;AACb,OAAO,EAIN,mBAAmB,EAInB,uBAAuB,EAIvB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAGd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EAExB,qBAAqB,EAErB,mBAAmB,EACnB,oBAAoB,EAOpB,cAAc,EAEd,qBAAqB,EACrB,aAAa,GAEb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAIN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CA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B,EAChB,gBAAgB,EAChB,eAAe,GAGf,MAAM,2BAA2B,CAAC","sourcesContent":["// Core session management\n\nexport { convertToLlm } from \"@caupulican/pi-agent-core\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryEntry,\n\ttype BranchSummaryResult,\n\tbuildSessionContext,\n\ttype CollectEntriesResult,\n\ttype CompactionEntry,\n\ttype CompactionResult,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileEntry,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\tprepareBranchEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\tserializeConversation,\n\tshouldCompact,\n\ttype ThinkingLevelChangeEntry,\n} from \"@caupulican/pi-agent-core/node\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionStorage,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tExtensionWorkRunOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport * from \"./core/orchestration/capability-gateway.ts\";\nexport * from \"./core/orchestration/contracts.ts\";\nexport * from \"./core/orchestration/event-store.ts\";\nexport * from \"./core/orchestration/model-binding.ts\";\nexport * from \"./core/orchestration/policy-compiler.ts\";\nexport * from \"./core/orchestration/profile-registry.ts\";\nexport * from \"./core/orchestration/profile-store.ts\";\nexport * from \"./core/orchestration/task-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport { PI_ORCHESTRATION_AGENT_ID_ENV } from \"./core/process-identity.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tgetReloadCoordinationDir,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionRuntimeResource,\n\ttype AgentSessionServices,\n\ttype AgentSessionSwitchOptions,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\tSessionReplacementCallbackError,\n\tSessionReplacementRuntimeError,\n} from \"./core/sdk.ts\";\nexport {\n\ttype SecretEnvDestinationState,\n\ttype SecretMaterializationResult,\n\ttype SecretProfileSummary,\n\ttype SecretRemovalResult,\n\ttype SecretVariableValue,\n\tSecretVault,\n\tSecretVaultError,\n\ttype SecretVaultErrorCode,\n\ttype SecretVaultOptions,\n} from \"./core/secrets/secret-vault.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\ttype AskQuestion,\n\ttype AskQuestionAnswer,\n\tAskQuestionDialog,\n\ttype AskQuestionStopReason,\n\ttype AskQuestionToolDetails,\n\ttype AskQuestionToolInput,\n\ttype AskQuestionToolOptions,\n\tcreateAskQuestionToolDefinition,\n} from \"./core/tools/ask-question.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSecretStoreToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\nexport {\n\ttype AcquireWorkRunOptions,\n\tacquireWorkRun,\n\tassertPortablePathSegment,\n\tboundedWorkRetention,\n\tcreateWorkRunId,\n\tgetProcessWorkRun,\n\tgetWorkRoot,\n\tgetWorkRunDir,\n\tgetWorkTenantDir,\n\tPI_WORK_ROOT_ENV,\n\tpruneWorkTenant,\n\ttype WorkRetentionOptions,\n\ttype WorkRunLease,\n} from \"./utils/work-directory.ts\";\n"]}