@caupulican/pi-adaptative 0.81.42 → 0.81.43

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 (1406) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/bun/cli.d.ts.map +1 -1
  3. package/dist/bun/cli.js.map +1 -1
  4. package/dist/bun/register-bedrock.d.ts.map +1 -1
  5. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  6. package/dist/bun/restore-sandbox-env.js.map +1 -1
  7. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
  8. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
  9. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
  10. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +52 -49
  11. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
  12. package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +62 -57
  13. package/dist/bundled-resources/prompts/skillify.md +1 -1
  14. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +16 -19
  15. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +12 -26
  16. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +15 -121
  17. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +52 -79
  18. package/dist/bundled-resources/runtimes/pi-shell-engine/escapes.py +70 -0
  19. package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +110 -61
  20. package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +106 -23
  21. package/dist/bundled-resources/runtimes/pi-shell-engine/paths.py +10 -0
  22. package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +12 -4
  23. package/dist/bundled-resources/runtimes/pi-shell-engine/shell_args.py +22 -0
  24. package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +9 -2
  25. package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +129 -259
  26. package/dist/bundled-resources/skills/authorized-web-security-audit/SKILL.md +187 -0
  27. package/dist/bundled-resources/skills/authorized-web-security-audit/references/assessment-contract.md +92 -0
  28. package/dist/bundled-resources/skills/deduplicate-by-evidence/SKILL.md +134 -0
  29. package/dist/bundled-resources/skills/evidence-gated-tdd/SKILL.md +93 -0
  30. package/dist/bundled-resources/skills/evidence-gated-tdd/references/evidence-model.md +27 -0
  31. package/dist/bundled-resources/skills/evidence-gated-tdd/references/security-scanners.md +24 -0
  32. package/dist/bundled-resources/skills/harness-self-adaptation/SKILL.md +4 -2
  33. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/SKILL.md +217 -0
  34. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/defensive-exploit-catalogue.md +175 -0
  35. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/tool-boundary-checklist.md +87 -0
  36. package/dist/bundled-resources/skills/skill-architect/SKILL.md +2 -2
  37. package/dist/bundled-resources/skills/skill-creator/SKILL.md +188 -0
  38. package/dist/bundled-resources/skills/skill-creator/references/pi-skill-contract.md +73 -0
  39. package/dist/bundled-resources/skills/skill-creator/scripts/init-skill.mjs +142 -0
  40. package/dist/bundled-resources/skills/skill-creator/scripts/validate-skill.mjs +122 -0
  41. package/dist/cli/args.d.ts.map +1 -1
  42. package/dist/cli/args.js.map +1 -1
  43. package/dist/cli/config-selector.d.ts.map +1 -1
  44. package/dist/cli/config-selector.js.map +1 -1
  45. package/dist/cli/file-processor.d.ts.map +1 -1
  46. package/dist/cli/file-processor.js +8 -8
  47. package/dist/cli/file-processor.js.map +1 -1
  48. package/dist/cli/initial-message.d.ts +1 -1
  49. package/dist/cli/initial-message.d.ts.map +1 -1
  50. package/dist/cli/initial-message.js.map +1 -1
  51. package/dist/cli/list-models.d.ts.map +1 -1
  52. package/dist/cli/list-models.js.map +1 -1
  53. package/dist/cli/piped-stdin.d.ts +4 -0
  54. package/dist/cli/piped-stdin.d.ts.map +1 -0
  55. package/dist/cli/piped-stdin.js +13 -0
  56. package/dist/cli/piped-stdin.js.map +1 -0
  57. package/dist/cli/session-picker.d.ts.map +1 -1
  58. package/dist/cli/session-picker.js.map +1 -1
  59. package/dist/cli.d.ts.map +1 -1
  60. package/dist/cli.js.map +1 -1
  61. package/dist/config.d.ts.map +1 -1
  62. package/dist/config.js +9 -14
  63. package/dist/config.js.map +1 -1
  64. package/dist/core/agent-directory-layout.d.ts.map +1 -1
  65. package/dist/core/agent-directory-layout.js.map +1 -1
  66. package/dist/core/agent-paths.d.ts.map +1 -1
  67. package/dist/core/agent-paths.js.map +1 -1
  68. package/dist/core/agent-session-contracts.d.ts +5 -9
  69. package/dist/core/agent-session-contracts.d.ts.map +1 -1
  70. package/dist/core/agent-session-contracts.js +1 -12
  71. package/dist/core/agent-session-contracts.js.map +1 -1
  72. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  73. package/dist/core/agent-session-runtime.js +10 -25
  74. package/dist/core/agent-session-runtime.js.map +1 -1
  75. package/dist/core/agent-session-services.d.ts.map +1 -1
  76. package/dist/core/agent-session-services.js.map +1 -1
  77. package/dist/core/agent-session.d.ts +24 -1
  78. package/dist/core/agent-session.d.ts.map +1 -1
  79. package/dist/core/agent-session.js +210 -237
  80. package/dist/core/agent-session.js.map +1 -1
  81. package/dist/core/auth-guidance.d.ts.map +1 -1
  82. package/dist/core/auth-guidance.js.map +1 -1
  83. package/dist/core/auth-storage.d.ts +4 -1
  84. package/dist/core/auth-storage.d.ts.map +1 -1
  85. package/dist/core/auth-storage.js +13 -39
  86. package/dist/core/auth-storage.js.map +1 -1
  87. package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
  88. package/dist/core/autonomy/approval-gate.js.map +1 -1
  89. package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
  90. package/dist/core/autonomy/bounded-completion.js.map +1 -1
  91. package/dist/core/autonomy/contracts.d.ts.map +1 -1
  92. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  93. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  94. package/dist/core/autonomy/evidence-finding-projection.d.ts +11 -0
  95. package/dist/core/autonomy/evidence-finding-projection.d.ts.map +1 -0
  96. package/dist/core/autonomy/evidence-finding-projection.js +37 -0
  97. package/dist/core/autonomy/evidence-finding-projection.js.map +1 -0
  98. package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
  99. package/dist/core/autonomy/foreground-envelope.js.map +1 -1
  100. package/dist/core/autonomy/gates.d.ts.map +1 -1
  101. package/dist/core/autonomy/gates.js.map +1 -1
  102. package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
  103. package/dist/core/autonomy/lane-private-paths.js.map +1 -1
  104. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  105. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  106. package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
  107. package/dist/core/autonomy/lane-tracker.js +2 -3
  108. package/dist/core/autonomy/lane-tracker.js.map +1 -1
  109. package/dist/core/autonomy/path-scope.d.ts.map +1 -1
  110. package/dist/core/autonomy/path-scope.js.map +1 -1
  111. package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
  112. package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
  113. package/dist/core/autonomy/session-lane-record.js.map +1 -1
  114. package/dist/core/autonomy/status.d.ts.map +1 -1
  115. package/dist/core/autonomy/status.js.map +1 -1
  116. package/dist/core/autonomy/subagent-prompt.d.ts.map +1 -1
  117. package/dist/core/autonomy/subagent-prompt.js.map +1 -1
  118. package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
  119. package/dist/core/autonomy/telemetry-events.js.map +1 -1
  120. package/dist/core/autonomy-telemetry.d.ts.map +1 -1
  121. package/dist/core/autonomy-telemetry.js +2 -4
  122. package/dist/core/autonomy-telemetry.js.map +1 -1
  123. package/dist/core/background-lane-controller.d.ts.map +1 -1
  124. package/dist/core/background-lane-controller.js +2 -15
  125. package/dist/core/background-lane-controller.js.map +1 -1
  126. package/dist/core/background-tool-task-controller.d.ts +88 -0
  127. package/dist/core/background-tool-task-controller.d.ts.map +1 -0
  128. package/dist/core/background-tool-task-controller.js +470 -0
  129. package/dist/core/background-tool-task-controller.js.map +1 -0
  130. package/dist/core/bash-execution-controller.d.ts +1 -0
  131. package/dist/core/bash-execution-controller.d.ts.map +1 -1
  132. package/dist/core/bash-execution-controller.js +5 -4
  133. package/dist/core/bash-execution-controller.js.map +1 -1
  134. package/dist/core/bash-executor.d.ts.map +1 -1
  135. package/dist/core/bash-executor.js.map +1 -1
  136. package/dist/core/bedrock-sso-login.d.ts.map +1 -1
  137. package/dist/core/bedrock-sso-login.js.map +1 -1
  138. package/dist/core/billing-failover-controller.d.ts.map +1 -1
  139. package/dist/core/billing-failover-controller.js +3 -3
  140. package/dist/core/billing-failover-controller.js.map +1 -1
  141. package/dist/core/billing-failover.d.ts.map +1 -1
  142. package/dist/core/billing-failover.js.map +1 -1
  143. package/dist/core/capability-contract.d.ts.map +1 -1
  144. package/dist/core/catalog-manager.d.ts.map +1 -1
  145. package/dist/core/catalog-manager.js +0 -0
  146. package/dist/core/catalog-manager.js.map +1 -1
  147. package/dist/core/compaction-controller.d.ts +2 -0
  148. package/dist/core/compaction-controller.d.ts.map +1 -1
  149. package/dist/core/compaction-controller.js +21 -8
  150. package/dist/core/compaction-controller.js.map +1 -1
  151. package/dist/core/compaction-support.d.ts +8 -0
  152. package/dist/core/compaction-support.d.ts.map +1 -1
  153. package/dist/core/compaction-support.js +0 -2
  154. package/dist/core/compaction-support.js.map +1 -1
  155. package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
  156. package/dist/core/context/artifact-retrieval.js.map +1 -1
  157. package/dist/core/context/brain-curator.d.ts.map +1 -1
  158. package/dist/core/context/brain-curator.js +14 -33
  159. package/dist/core/context/brain-curator.js.map +1 -1
  160. package/dist/core/context/context-artifacts.d.ts.map +1 -1
  161. package/dist/core/context/context-artifacts.js +16 -24
  162. package/dist/core/context/context-artifacts.js.map +1 -1
  163. package/dist/core/context/context-audit.d.ts.map +1 -1
  164. package/dist/core/context/context-audit.js +3 -17
  165. package/dist/core/context/context-audit.js.map +1 -1
  166. package/dist/core/context/context-composition.d.ts.map +1 -1
  167. package/dist/core/context/context-composition.js.map +1 -1
  168. package/dist/core/context/context-item.d.ts.map +1 -1
  169. package/dist/core/context/context-item.js.map +1 -1
  170. package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -1
  171. package/dist/core/context/context-prompt-enforcement.js +3 -16
  172. package/dist/core/context/context-prompt-enforcement.js.map +1 -1
  173. package/dist/core/context/context-prompt-policy.d.ts.map +1 -1
  174. package/dist/core/context/context-prompt-policy.js.map +1 -1
  175. package/dist/core/context/context-retention.d.ts.map +1 -1
  176. package/dist/core/context/context-retention.js.map +1 -1
  177. package/dist/core/context/context-store-retention.d.ts.map +1 -1
  178. package/dist/core/context/context-store-retention.js.map +1 -1
  179. package/dist/core/context/context-store.d.ts.map +1 -1
  180. package/dist/core/context/context-store.js.map +1 -1
  181. package/dist/core/context/context-tool-result.d.ts +4 -0
  182. package/dist/core/context/context-tool-result.d.ts.map +1 -0
  183. package/dist/core/context/context-tool-result.js +15 -0
  184. package/dist/core/context/context-tool-result.js.map +1 -0
  185. package/dist/core/context/current-work-memory.d.ts.map +1 -1
  186. package/dist/core/context/current-work-memory.js.map +1 -1
  187. package/dist/core/context/file-store-memory-provider.d.ts.map +1 -1
  188. package/dist/core/context/file-store-memory-provider.js +7 -28
  189. package/dist/core/context/file-store-memory-provider.js.map +1 -1
  190. package/dist/core/context/local-memory-search.d.ts +11 -0
  191. package/dist/core/context/local-memory-search.d.ts.map +1 -0
  192. package/dist/core/context/local-memory-search.js +37 -0
  193. package/dist/core/context/local-memory-search.js.map +1 -0
  194. package/dist/core/context/long-term-memory-trigger.d.ts.map +1 -1
  195. package/dist/core/context/long-term-memory-trigger.js.map +1 -1
  196. package/dist/core/context/memory-diagnostics.d.ts.map +1 -1
  197. package/dist/core/context/memory-diagnostics.js.map +1 -1
  198. package/dist/core/context/memory-index-store.d.ts.map +1 -1
  199. package/dist/core/context/memory-index-store.js.map +1 -1
  200. package/dist/core/context/memory-prompt-block.d.ts.map +1 -1
  201. package/dist/core/context/memory-prompt-block.js.map +1 -1
  202. package/dist/core/context/memory-prompt-budget.d.ts.map +1 -1
  203. package/dist/core/context/memory-prompt-budget.js.map +1 -1
  204. package/dist/core/context/memory-provider-contract.d.ts.map +1 -1
  205. package/dist/core/context/memory-provider-contract.js.map +1 -1
  206. package/dist/core/context/memory-retrieval.d.ts.map +1 -1
  207. package/dist/core/context/memory-retrieval.js.map +1 -1
  208. package/dist/core/context/memory-tier-composer.d.ts.map +1 -1
  209. package/dist/core/context/memory-tier-composer.js.map +1 -1
  210. package/dist/core/context/message-text.d.ts +7 -0
  211. package/dist/core/context/message-text.d.ts.map +1 -0
  212. package/dist/core/context/message-text.js +68 -0
  213. package/dist/core/context/message-text.js.map +1 -0
  214. package/dist/core/context/okf-memory-provider.d.ts.map +1 -1
  215. package/dist/core/context/okf-memory-provider.js +4 -30
  216. package/dist/core/context/okf-memory-provider.js.map +1 -1
  217. package/dist/core/context/okf-memory.d.ts.map +1 -1
  218. package/dist/core/context/okf-memory.js.map +1 -1
  219. package/dist/core/context/policy-engine.d.ts.map +1 -1
  220. package/dist/core/context/policy-engine.js.map +1 -1
  221. package/dist/core/context/policy-types.d.ts.map +1 -1
  222. package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
  223. package/dist/core/context/sqlite-runtime-index.js.map +1 -1
  224. package/dist/core/context/storage-authority.d.ts.map +1 -1
  225. package/dist/core/context/tool-output-packer.d.ts.map +1 -1
  226. package/dist/core/context/tool-output-packer.js.map +1 -1
  227. package/dist/core/context-gc.d.ts.map +1 -1
  228. package/dist/core/context-gc.js +14 -21
  229. package/dist/core/context-gc.js.map +1 -1
  230. package/dist/core/context-pipeline.d.ts +1 -3
  231. package/dist/core/context-pipeline.d.ts.map +1 -1
  232. package/dist/core/context-pipeline.js +64 -145
  233. package/dist/core/context-pipeline.js.map +1 -1
  234. package/dist/core/cost/cost-summary.d.ts.map +1 -1
  235. package/dist/core/cost/cost-summary.js.map +1 -1
  236. package/dist/core/cost/daily-usage.d.ts.map +1 -1
  237. package/dist/core/cost/daily-usage.js.map +1 -1
  238. package/dist/core/cost/session-usage.d.ts.map +1 -1
  239. package/dist/core/cost/session-usage.js.map +1 -1
  240. package/dist/core/cost-guard.d.ts.map +1 -1
  241. package/dist/core/cost-guard.js.map +1 -1
  242. package/dist/core/default-tool-surface.d.ts.map +1 -1
  243. package/dist/core/default-tool-surface.js +1 -0
  244. package/dist/core/default-tool-surface.js.map +1 -1
  245. package/dist/core/defaults.d.ts.map +1 -1
  246. package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
  247. package/dist/core/delegation/managed-lane-controller.js +2 -6
  248. package/dist/core/delegation/managed-lane-controller.js.map +1 -1
  249. package/dist/core/delegation/session-worker-claim.d.ts.map +1 -1
  250. package/dist/core/delegation/session-worker-claim.js.map +1 -1
  251. package/dist/core/delegation/worker-action-journal.d.ts.map +1 -1
  252. package/dist/core/delegation/worker-action-journal.js +0 -4
  253. package/dist/core/delegation/worker-action-journal.js.map +1 -1
  254. package/dist/core/delegation/worker-actions.d.ts.map +1 -1
  255. package/dist/core/delegation/worker-actions.js.map +1 -1
  256. package/dist/core/delegation/worker-agent-control-coordinator.d.ts +1 -0
  257. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
  258. package/dist/core/delegation/worker-agent-control-coordinator.js +13 -15
  259. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
  260. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
  261. package/dist/core/delegation/worker-agent-control.js +1 -4
  262. package/dist/core/delegation/worker-agent-control.js.map +1 -1
  263. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  264. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  265. package/dist/core/delegation/worker-claim.d.ts.map +1 -1
  266. package/dist/core/delegation/worker-claim.js.map +1 -1
  267. package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
  268. package/dist/core/delegation/worker-conversation-store.js +0 -2
  269. package/dist/core/delegation/worker-conversation-store.js.map +1 -1
  270. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  271. package/dist/core/delegation/worker-delegation-controller.js +5 -14
  272. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  273. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  274. package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
  275. package/dist/core/delegation/worker-dispatch-scheduler.js +5 -6
  276. package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
  277. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  278. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  279. package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -1
  280. package/dist/core/delegation/worker-lane-projection.js.map +1 -1
  281. package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
  282. package/dist/core/delegation/worker-lifecycle.js +0 -3
  283. package/dist/core/delegation/worker-lifecycle.js.map +1 -1
  284. package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
  285. package/dist/core/delegation/worker-notification-coordinator.js +4 -5
  286. package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
  287. package/dist/core/delegation/worker-process-owner.d.ts.map +1 -1
  288. package/dist/core/delegation/worker-process-owner.js.map +1 -1
  289. package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
  290. package/dist/core/delegation/worker-profile-resolver.js +1 -2
  291. package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
  292. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
  293. package/dist/core/delegation/worker-recovery-coordinator.js +3 -4
  294. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
  295. package/dist/core/delegation/worker-resource-catalog.d.ts.map +1 -1
  296. package/dist/core/delegation/worker-resource-catalog.js.map +1 -1
  297. package/dist/core/delegation/worker-resource-materializer.d.ts.map +1 -1
  298. package/dist/core/delegation/worker-resource-materializer.js +1 -4
  299. package/dist/core/delegation/worker-resource-materializer.js.map +1 -1
  300. package/dist/core/delegation/worker-runner.d.ts +2 -4
  301. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  302. package/dist/core/delegation/worker-runner.js +6 -18
  303. package/dist/core/delegation/worker-runner.js.map +1 -1
  304. package/dist/core/delegation/worker-task-label.d.ts.map +1 -1
  305. package/dist/core/delegation/worker-task-label.js.map +1 -1
  306. package/dist/core/delegation/worker-terminal-finalizer.d.ts.map +1 -1
  307. package/dist/core/delegation/worker-terminal-finalizer.js.map +1 -1
  308. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
  309. package/dist/core/delegation/worker-write-reservation-coordinator.js +1 -4
  310. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
  311. package/dist/core/delegation/worker-write-reservation.d.ts.map +1 -1
  312. package/dist/core/delegation/worker-write-reservation.js +0 -2
  313. package/dist/core/delegation/worker-write-reservation.js.map +1 -1
  314. package/dist/core/diagnostics.d.ts.map +1 -1
  315. package/dist/core/doctor.d.ts.map +1 -1
  316. package/dist/core/doctor.js.map +1 -1
  317. package/dist/core/event-bus.d.ts.map +1 -1
  318. package/dist/core/event-bus.js.map +1 -1
  319. package/dist/core/exec.d.ts.map +1 -1
  320. package/dist/core/exec.js +26 -7
  321. package/dist/core/exec.js.map +1 -1
  322. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  323. package/dist/core/export-html/ansi-to-html.js +21 -74
  324. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  325. package/dist/core/export-html/index.d.ts.map +1 -1
  326. package/dist/core/export-html/index.js +4 -0
  327. package/dist/core/export-html/index.js.map +1 -1
  328. package/dist/core/export-html/session-tree-foundations.d.mts +67 -0
  329. package/dist/core/export-html/session-tree-foundations.mjs +313 -0
  330. package/dist/core/export-html/template.css +14 -41
  331. package/dist/core/export-html/template.html +3 -1
  332. package/dist/core/export-html/template.js +26 -435
  333. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  334. package/dist/core/export-html/tool-renderer.js.map +1 -1
  335. package/dist/core/extension-import-authority.d.ts.map +1 -1
  336. package/dist/core/extension-import-authority.js.map +1 -1
  337. package/dist/core/extension-metadata.d.ts.map +1 -1
  338. package/dist/core/extension-metadata.js.map +1 -1
  339. package/dist/core/extensions/builtin.d.ts +17 -0
  340. package/dist/core/extensions/builtin.d.ts.map +1 -1
  341. package/dist/core/extensions/builtin.js +18 -54
  342. package/dist/core/extensions/builtin.js.map +1 -1
  343. package/dist/core/extensions/entry-resolution.d.ts +3 -0
  344. package/dist/core/extensions/entry-resolution.d.ts.map +1 -0
  345. package/dist/core/extensions/entry-resolution.js +17 -0
  346. package/dist/core/extensions/entry-resolution.js.map +1 -0
  347. package/dist/core/extensions/index.d.ts.map +1 -1
  348. package/dist/core/extensions/loader.d.ts.map +1 -1
  349. package/dist/core/extensions/loader.js +76 -21
  350. package/dist/core/extensions/loader.js.map +1 -1
  351. package/dist/core/extensions/runner.d.ts +2 -0
  352. package/dist/core/extensions/runner.d.ts.map +1 -1
  353. package/dist/core/extensions/runner.js +41 -112
  354. package/dist/core/extensions/runner.js.map +1 -1
  355. package/dist/core/extensions/stale-context.d.ts.map +1 -1
  356. package/dist/core/extensions/storage.d.ts.map +1 -1
  357. package/dist/core/extensions/storage.js.map +1 -1
  358. package/dist/core/extensions/types.d.ts.map +1 -1
  359. package/dist/core/extensions/types.js.map +1 -1
  360. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  361. package/dist/core/extensions/wrapper.js.map +1 -1
  362. package/dist/core/failure-corpus.d.ts.map +1 -1
  363. package/dist/core/failure-corpus.js +2 -5
  364. package/dist/core/failure-corpus.js.map +1 -1
  365. package/dist/core/footer-data-provider.d.ts.map +1 -1
  366. package/dist/core/footer-data-provider.js +27 -33
  367. package/dist/core/footer-data-provider.js.map +1 -1
  368. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  369. package/dist/core/foreground-recovery-controller.js +0 -4
  370. package/dist/core/foreground-recovery-controller.js.map +1 -1
  371. package/dist/core/gateways/channel-provider.d.ts.map +1 -1
  372. package/dist/core/gateways/channel-provider.js +7 -5
  373. package/dist/core/gateways/channel-provider.js.map +1 -1
  374. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  375. package/dist/core/goal-loop-controller.js +0 -1
  376. package/dist/core/goal-loop-controller.js.map +1 -1
  377. package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
  378. package/dist/core/goals/compact-goal-context.js +2 -4
  379. package/dist/core/goals/compact-goal-context.js.map +1 -1
  380. package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
  381. package/dist/core/goals/goal-acceptance.js.map +1 -1
  382. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  383. package/dist/core/goals/goal-auto-continue-controller.js +1 -3
  384. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  385. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  386. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  387. package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
  388. package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
  389. package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
  390. package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
  391. package/dist/core/goals/goal-lifecycle.js.map +1 -1
  392. package/dist/core/goals/goal-record.d.ts.map +1 -1
  393. package/dist/core/goals/goal-record.js.map +1 -1
  394. package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
  395. package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
  396. package/dist/core/goals/goal-session-controller.d.ts +15 -0
  397. package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
  398. package/dist/core/goals/goal-session-controller.js +27 -3
  399. package/dist/core/goals/goal-session-controller.js.map +1 -1
  400. package/dist/core/goals/goal-state.d.ts.map +1 -1
  401. package/dist/core/goals/goal-state.js +35 -51
  402. package/dist/core/goals/goal-state.js.map +1 -1
  403. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  404. package/dist/core/goals/goal-tool-core.js.map +1 -1
  405. package/dist/core/goals/natural-language-goal.d.ts +9 -0
  406. package/dist/core/goals/natural-language-goal.d.ts.map +1 -0
  407. package/dist/core/goals/natural-language-goal.js +23 -0
  408. package/dist/core/goals/natural-language-goal.js.map +1 -0
  409. package/dist/core/goals/session-goal-state.d.ts.map +1 -1
  410. package/dist/core/goals/session-goal-state.js.map +1 -1
  411. package/dist/core/http-dispatcher.d.ts.map +1 -1
  412. package/dist/core/http-dispatcher.js.map +1 -1
  413. package/dist/core/human-input-controller.d.ts.map +1 -1
  414. package/dist/core/human-input-controller.js +2 -3
  415. package/dist/core/human-input-controller.js.map +1 -1
  416. package/dist/core/human-input.d.ts.map +1 -1
  417. package/dist/core/human-input.js.map +1 -1
  418. package/dist/core/improvement-loop.d.ts.map +1 -1
  419. package/dist/core/improvement-loop.js +11 -11
  420. package/dist/core/improvement-loop.js.map +1 -1
  421. package/dist/core/index.d.ts.map +1 -1
  422. package/dist/core/install-telemetry.d.ts.map +1 -1
  423. package/dist/core/install-telemetry.js.map +1 -1
  424. package/dist/core/isolated-text-completion.d.ts +17 -0
  425. package/dist/core/isolated-text-completion.d.ts.map +1 -0
  426. package/dist/core/isolated-text-completion.js +15 -0
  427. package/dist/core/isolated-text-completion.js.map +1 -0
  428. package/dist/core/keybindings.d.ts +47 -2
  429. package/dist/core/keybindings.d.ts.map +1 -1
  430. package/dist/core/keybindings.js +12 -1
  431. package/dist/core/keybindings.js.map +1 -1
  432. package/dist/core/learning/learning-audit.d.ts.map +1 -1
  433. package/dist/core/learning/learning-audit.js.map +1 -1
  434. package/dist/core/learning/learning-gate.d.ts.map +1 -1
  435. package/dist/core/learning/learning-gate.js.map +1 -1
  436. package/dist/core/learning/observation-store.d.ts.map +1 -1
  437. package/dist/core/learning/observation-store.js +0 -2
  438. package/dist/core/learning/observation-store.js.map +1 -1
  439. package/dist/core/learning/reflection-engine.d.ts +1 -1
  440. package/dist/core/learning/reflection-engine.d.ts.map +1 -1
  441. package/dist/core/learning/reflection-engine.js +3 -0
  442. package/dist/core/learning/reflection-engine.js.map +1 -1
  443. package/dist/core/learning/reflection-turn-analysis.d.ts +20 -0
  444. package/dist/core/learning/reflection-turn-analysis.d.ts.map +1 -0
  445. package/dist/core/learning/reflection-turn-analysis.js +136 -0
  446. package/dist/core/learning/reflection-turn-analysis.js.map +1 -0
  447. package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
  448. package/dist/core/learning/session-learning-decision.js.map +1 -1
  449. package/dist/core/learning/skill-curator.d.ts.map +1 -1
  450. package/dist/core/learning/skill-curator.js +0 -3
  451. package/dist/core/learning/skill-curator.js.map +1 -1
  452. package/dist/core/local-runtime-controller.d.ts +39 -0
  453. package/dist/core/local-runtime-controller.d.ts.map +1 -1
  454. package/dist/core/local-runtime-controller.js +41 -62
  455. package/dist/core/local-runtime-controller.js.map +1 -1
  456. package/dist/core/memory/effectiveness-tracker.d.ts.map +1 -1
  457. package/dist/core/memory/effectiveness-tracker.js +4 -2
  458. package/dist/core/memory/effectiveness-tracker.js.map +1 -1
  459. package/dist/core/memory/memory-manager.d.ts.map +1 -1
  460. package/dist/core/memory/memory-manager.js +7 -7
  461. package/dist/core/memory/memory-manager.js.map +1 -1
  462. package/dist/core/memory/memory-provider.d.ts.map +1 -1
  463. package/dist/core/memory/providers/file-store.d.ts +7 -0
  464. package/dist/core/memory/providers/file-store.d.ts.map +1 -1
  465. package/dist/core/memory/providers/file-store.js +48 -13
  466. package/dist/core/memory/providers/file-store.js.map +1 -1
  467. package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts +47 -0
  468. package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts.map +1 -0
  469. package/dist/core/memory/providers/transcript-recall-worker-protocol.js +50 -0
  470. package/dist/core/memory/providers/transcript-recall-worker-protocol.js.map +1 -0
  471. package/dist/core/memory/providers/transcript-recall-worker.d.ts +2 -0
  472. package/dist/core/memory/providers/transcript-recall-worker.d.ts.map +1 -0
  473. package/dist/core/memory/providers/transcript-recall-worker.js +143 -0
  474. package/dist/core/memory/providers/transcript-recall-worker.js.map +1 -0
  475. package/dist/core/memory/providers/transcript-recall.d.ts +24 -13
  476. package/dist/core/memory/providers/transcript-recall.d.ts.map +1 -1
  477. package/dist/core/memory/providers/transcript-recall.js +143 -141
  478. package/dist/core/memory/providers/transcript-recall.js.map +1 -1
  479. package/dist/core/memory/providers/user-memory-archive.d.ts +39 -0
  480. package/dist/core/memory/providers/user-memory-archive.d.ts.map +1 -0
  481. package/dist/core/memory/providers/user-memory-archive.js +258 -0
  482. package/dist/core/memory/providers/user-memory-archive.js.map +1 -0
  483. package/dist/core/memory/transcript-index.d.ts.map +1 -1
  484. package/dist/core/memory/transcript-index.js +1 -1
  485. package/dist/core/memory/transcript-index.js.map +1 -1
  486. package/dist/core/memory-controller.d.ts +9 -0
  487. package/dist/core/memory-controller.d.ts.map +1 -1
  488. package/dist/core/memory-controller.js +57 -16
  489. package/dist/core/memory-controller.js.map +1 -1
  490. package/dist/core/model-capability.d.ts.map +1 -1
  491. package/dist/core/model-capability.js.map +1 -1
  492. package/dist/core/model-output-json.d.ts +10 -0
  493. package/dist/core/model-output-json.d.ts.map +1 -0
  494. package/dist/core/model-output-json.js +43 -0
  495. package/dist/core/model-output-json.js.map +1 -0
  496. package/dist/core/model-registry.d.ts +8 -8
  497. package/dist/core/model-registry.d.ts.map +1 -1
  498. package/dist/core/model-registry.js +29 -52
  499. package/dist/core/model-registry.js.map +1 -1
  500. package/dist/core/model-resolver.d.ts.map +1 -1
  501. package/dist/core/model-resolver.js +1 -1
  502. package/dist/core/model-resolver.js.map +1 -1
  503. package/dist/core/model-router/config-diagnostics.d.ts.map +1 -1
  504. package/dist/core/model-router/config-diagnostics.js.map +1 -1
  505. package/dist/core/model-router/executor-route.d.ts.map +1 -1
  506. package/dist/core/model-router/executor-route.js.map +1 -1
  507. package/dist/core/model-router/fitness-gate.d.ts.map +1 -1
  508. package/dist/core/model-router/fitness-gate.js.map +1 -1
  509. package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
  510. package/dist/core/model-router/route-judge.d.ts.map +1 -1
  511. package/dist/core/model-router/route-judge.js +18 -36
  512. package/dist/core/model-router/route-judge.js.map +1 -1
  513. package/dist/core/model-router/session-buffer.d.ts.map +1 -1
  514. package/dist/core/model-router/session-buffer.js.map +1 -1
  515. package/dist/core/model-router/status.d.ts.map +1 -1
  516. package/dist/core/model-router/status.js.map +1 -1
  517. package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
  518. package/dist/core/model-router/tool-escalation.js.map +1 -1
  519. package/dist/core/model-router-controller.d.ts +1 -0
  520. package/dist/core/model-router-controller.d.ts.map +1 -1
  521. package/dist/core/model-router-controller.js +25 -56
  522. package/dist/core/model-router-controller.js.map +1 -1
  523. package/dist/core/model-selection-controller.d.ts +10 -0
  524. package/dist/core/model-selection-controller.d.ts.map +1 -1
  525. package/dist/core/model-selection-controller.js +0 -1
  526. package/dist/core/model-selection-controller.js.map +1 -1
  527. package/dist/core/model-tool-protocol.d.ts.map +1 -1
  528. package/dist/core/model-tool-protocol.js.map +1 -1
  529. package/dist/core/models/adaptation-store.d.ts.map +1 -1
  530. package/dist/core/models/adaptation-store.js +0 -1
  531. package/dist/core/models/adaptation-store.js.map +1 -1
  532. package/dist/core/models/context-sizing.d.ts.map +1 -1
  533. package/dist/core/models/context-sizing.js.map +1 -1
  534. package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
  535. package/dist/core/models/default-model-suggestions.js.map +1 -1
  536. package/dist/core/models/fitness-store.d.ts.map +1 -1
  537. package/dist/core/models/fitness-store.js +0 -1
  538. package/dist/core/models/fitness-store.js.map +1 -1
  539. package/dist/core/models/host-state-store.d.ts.map +1 -1
  540. package/dist/core/models/host-state-store.js +1 -6
  541. package/dist/core/models/host-state-store.js.map +1 -1
  542. package/dist/core/models/llamacpp-runtime.d.ts +4 -19
  543. package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
  544. package/dist/core/models/llamacpp-runtime.js +32 -136
  545. package/dist/core/models/llamacpp-runtime.js.map +1 -1
  546. package/dist/core/models/local-registration.d.ts.map +1 -1
  547. package/dist/core/models/local-registration.js +82 -115
  548. package/dist/core/models/local-registration.js.map +1 -1
  549. package/dist/core/models/local-runtime.d.ts +12 -18
  550. package/dist/core/models/local-runtime.d.ts.map +1 -1
  551. package/dist/core/models/local-runtime.js +60 -204
  552. package/dist/core/models/local-runtime.js.map +1 -1
  553. package/dist/core/models/model-endpoint.d.ts.map +1 -1
  554. package/dist/core/models/model-endpoint.js.map +1 -1
  555. package/dist/core/models/model-ref.d.ts.map +1 -1
  556. package/dist/core/models/model-ref.js.map +1 -1
  557. package/dist/core/models/needle-runtime.d.ts +7 -3
  558. package/dist/core/models/needle-runtime.d.ts.map +1 -1
  559. package/dist/core/models/needle-runtime.js +16 -92
  560. package/dist/core/models/needle-runtime.js.map +1 -1
  561. package/dist/core/models/perf-profile.d.ts +1 -1
  562. package/dist/core/models/perf-profile.d.ts.map +1 -1
  563. package/dist/core/models/perf-profile.js +6 -13
  564. package/dist/core/models/perf-profile.js.map +1 -1
  565. package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -1
  566. package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -1
  567. package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
  568. package/dist/core/models/runtime-arbiter.js +3 -15
  569. package/dist/core/models/runtime-arbiter.js.map +1 -1
  570. package/dist/core/models/runtime-process.d.ts +100 -0
  571. package/dist/core/models/runtime-process.d.ts.map +1 -0
  572. package/dist/core/models/runtime-process.js +183 -0
  573. package/dist/core/models/runtime-process.js.map +1 -0
  574. package/dist/core/orchestration/agent-resume.d.ts.map +1 -1
  575. package/dist/core/orchestration/agent-resume.js.map +1 -1
  576. package/dist/core/orchestration/attempt-usage.d.ts.map +1 -1
  577. package/dist/core/orchestration/attempt-usage.js.map +1 -1
  578. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  579. package/dist/core/orchestration/capability-gateway.js +0 -14
  580. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  581. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  582. package/dist/core/orchestration/contracts.js.map +1 -1
  583. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  584. package/dist/core/orchestration/delegation-ledger.js +0 -2
  585. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  586. package/dist/core/orchestration/event-store.d.ts.map +1 -1
  587. package/dist/core/orchestration/event-store.js +1 -14
  588. package/dist/core/orchestration/event-store.js.map +1 -1
  589. package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
  590. package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
  591. package/dist/core/orchestration/model-binding.d.ts.map +1 -1
  592. package/dist/core/orchestration/model-binding.js.map +1 -1
  593. package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
  594. package/dist/core/orchestration/policy-compiler.js +0 -3
  595. package/dist/core/orchestration/policy-compiler.js.map +1 -1
  596. package/dist/core/orchestration/policy-gate.d.ts.map +1 -1
  597. package/dist/core/orchestration/policy-gate.js +0 -2
  598. package/dist/core/orchestration/policy-gate.js.map +1 -1
  599. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  600. package/dist/core/orchestration/profile-registry.js +1 -1
  601. package/dist/core/orchestration/profile-registry.js.map +1 -1
  602. package/dist/core/orchestration/profile-store.d.ts.map +1 -1
  603. package/dist/core/orchestration/profile-store.js +0 -3
  604. package/dist/core/orchestration/profile-store.js.map +1 -1
  605. package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
  606. package/dist/core/orchestration/risk-budget.js.map +1 -1
  607. package/dist/core/orchestration/task-runtime.d.ts +1 -0
  608. package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
  609. package/dist/core/orchestration/task-runtime.js +27 -42
  610. package/dist/core/orchestration/task-runtime.js.map +1 -1
  611. package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
  612. package/dist/core/orchestration/work-state-projection.js.map +1 -1
  613. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  614. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  615. package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -1
  616. package/dist/core/orchestration/worker-result-adapter.js.map +1 -1
  617. package/dist/core/output-guard.d.ts.map +1 -1
  618. package/dist/core/output-guard.js.map +1 -1
  619. package/dist/core/package-manager.d.ts +3 -0
  620. package/dist/core/package-manager.d.ts.map +1 -1
  621. package/dist/core/package-manager.js +88 -353
  622. package/dist/core/package-manager.js.map +1 -1
  623. package/dist/core/process-identity.d.ts.map +1 -1
  624. package/dist/core/process-identity.js.map +1 -1
  625. package/dist/core/process-liveness.d.ts +3 -0
  626. package/dist/core/process-liveness.d.ts.map +1 -0
  627. package/dist/core/process-liveness.js +17 -0
  628. package/dist/core/process-liveness.js.map +1 -0
  629. package/dist/core/process-matrix/codes.d.ts.map +1 -1
  630. package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -1
  631. package/dist/core/process-matrix/resume-launcher.js.map +1 -1
  632. package/dist/core/process-matrix/runtime.d.ts.map +1 -1
  633. package/dist/core/process-matrix/runtime.js.map +1 -1
  634. package/dist/core/process-matrix/store.d.ts.map +1 -1
  635. package/dist/core/process-matrix/store.js.map +1 -1
  636. package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
  637. package/dist/core/process-matrix/supervisor.js.map +1 -1
  638. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  639. package/dist/core/profile-filter-controller.js +7 -8
  640. package/dist/core/profile-filter-controller.js.map +1 -1
  641. package/dist/core/profile-registry.d.ts.map +1 -1
  642. package/dist/core/profile-registry.js +1 -2
  643. package/dist/core/profile-registry.js.map +1 -1
  644. package/dist/core/profile-resource-selection.d.ts.map +1 -1
  645. package/dist/core/profile-resource-selection.js +18 -59
  646. package/dist/core/profile-resource-selection.js.map +1 -1
  647. package/dist/core/prompt-markup.d.ts +3 -0
  648. package/dist/core/prompt-markup.d.ts.map +1 -0
  649. package/dist/core/prompt-markup.js +7 -0
  650. package/dist/core/prompt-markup.js.map +1 -0
  651. package/dist/core/prompt-templates.d.ts.map +1 -1
  652. package/dist/core/prompt-templates.js +13 -39
  653. package/dist/core/prompt-templates.js.map +1 -1
  654. package/dist/core/provider-display-names.d.ts.map +1 -1
  655. package/dist/core/python-runtime.d.ts.map +1 -1
  656. package/dist/core/python-runtime.js.map +1 -1
  657. package/dist/core/reflection-controller.d.ts +22 -1
  658. package/dist/core/reflection-controller.d.ts.map +1 -1
  659. package/dist/core/reflection-controller.js +143 -25
  660. package/dist/core/reflection-controller.js.map +1 -1
  661. package/dist/core/reload-blockers.d.ts +2 -1
  662. package/dist/core/reload-blockers.d.ts.map +1 -1
  663. package/dist/core/reload-blockers.js +4 -14
  664. package/dist/core/reload-blockers.js.map +1 -1
  665. package/dist/core/request-auth.d.ts.map +1 -1
  666. package/dist/core/request-auth.js.map +1 -1
  667. package/dist/core/research/automata-provider.d.ts.map +1 -1
  668. package/dist/core/research/automata-provider.js.map +1 -1
  669. package/dist/core/research/evidence-bundle.d.ts.map +1 -1
  670. package/dist/core/research/evidence-bundle.js.map +1 -1
  671. package/dist/core/research/lane-model-resolver.d.ts.map +1 -1
  672. package/dist/core/research/lane-model-resolver.js +0 -1
  673. package/dist/core/research/lane-model-resolver.js.map +1 -1
  674. package/dist/core/research/model-fitness-controller.d.ts.map +1 -1
  675. package/dist/core/research/model-fitness-controller.js +17 -33
  676. package/dist/core/research/model-fitness-controller.js.map +1 -1
  677. package/dist/core/research/model-fitness.d.ts.map +1 -1
  678. package/dist/core/research/model-fitness.js +4 -25
  679. package/dist/core/research/model-fitness.js.map +1 -1
  680. package/dist/core/research/research-gate.d.ts.map +1 -1
  681. package/dist/core/research/research-gate.js.map +1 -1
  682. package/dist/core/research/research-lane-controller.d.ts.map +1 -1
  683. package/dist/core/research/research-lane-controller.js +5 -10
  684. package/dist/core/research/research-lane-controller.js.map +1 -1
  685. package/dist/core/research/research-runner.d.ts +2 -4
  686. package/dist/core/research/research-runner.d.ts.map +1 -1
  687. package/dist/core/research/research-runner.js +17 -48
  688. package/dist/core/research/research-runner.js.map +1 -1
  689. package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
  690. package/dist/core/research/session-evidence-bundle.js.map +1 -1
  691. package/dist/core/research/workspace-collector.d.ts.map +1 -1
  692. package/dist/core/research/workspace-collector.js.map +1 -1
  693. package/dist/core/resolve-config-value.d.ts.map +1 -1
  694. package/dist/core/resolve-config-value.js.map +1 -1
  695. package/dist/core/resource-ignore.d.ts +6 -0
  696. package/dist/core/resource-ignore.d.ts.map +1 -0
  697. package/dist/core/resource-ignore.js +44 -0
  698. package/dist/core/resource-ignore.js.map +1 -0
  699. package/dist/core/resource-loader.d.ts +0 -1
  700. package/dist/core/resource-loader.d.ts.map +1 -1
  701. package/dist/core/resource-loader.js +52 -187
  702. package/dist/core/resource-loader.js.map +1 -1
  703. package/dist/core/resource-profile-blocks.d.ts +3 -1
  704. package/dist/core/resource-profile-blocks.d.ts.map +1 -1
  705. package/dist/core/resource-profile-blocks.js +8 -5
  706. package/dist/core/resource-profile-blocks.js.map +1 -1
  707. package/dist/core/resource-profile-equality.d.ts.map +1 -1
  708. package/dist/core/resource-profile-equality.js.map +1 -1
  709. package/dist/core/resource-traversal.d.ts +43 -0
  710. package/dist/core/resource-traversal.d.ts.map +1 -0
  711. package/dist/core/resource-traversal.js +84 -0
  712. package/dist/core/resource-traversal.js.map +1 -0
  713. package/dist/core/risk-classifier.d.ts.map +1 -1
  714. package/dist/core/risk-classifier.js.map +1 -1
  715. package/dist/core/runtime-builder.d.ts +4 -1
  716. package/dist/core/runtime-builder.d.ts.map +1 -1
  717. package/dist/core/runtime-builder.js +25 -50
  718. package/dist/core/runtime-builder.js.map +1 -1
  719. package/dist/core/scout-controller.d.ts.map +1 -1
  720. package/dist/core/scout-controller.js +0 -1
  721. package/dist/core/scout-controller.js.map +1 -1
  722. package/dist/core/sdk.d.ts.map +1 -1
  723. package/dist/core/sdk.js.map +1 -1
  724. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
  725. package/dist/core/secrets/credential-exposure-guard.js +70 -44
  726. package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
  727. package/dist/core/secrets/secret-dotenv.d.ts.map +1 -1
  728. package/dist/core/secrets/secret-dotenv.js +0 -1
  729. package/dist/core/secrets/secret-dotenv.js.map +1 -1
  730. package/dist/core/secrets/secret-vault-format.d.ts.map +1 -1
  731. package/dist/core/secrets/secret-vault-format.js +0 -1
  732. package/dist/core/secrets/secret-vault-format.js.map +1 -1
  733. package/dist/core/secrets/secret-vault.d.ts.map +1 -1
  734. package/dist/core/secrets/secret-vault.js +2 -10
  735. package/dist/core/secrets/secret-vault.js.map +1 -1
  736. package/dist/core/security/secret-text.d.ts.map +1 -1
  737. package/dist/core/security/secret-text.js.map +1 -1
  738. package/dist/core/security/untrusted-boundary.d.ts.map +1 -1
  739. package/dist/core/security/untrusted-boundary.js.map +1 -1
  740. package/dist/core/session-analytics.d.ts.map +1 -1
  741. package/dist/core/session-analytics.js +18 -50
  742. package/dist/core/session-analytics.js.map +1 -1
  743. package/dist/core/session-artifact-bundle.d.ts.map +1 -1
  744. package/dist/core/session-artifact-bundle.js.map +1 -1
  745. package/dist/core/session-cwd.d.ts.map +1 -1
  746. package/dist/core/session-cwd.js +0 -1
  747. package/dist/core/session-cwd.js.map +1 -1
  748. package/dist/core/session-entry-index.d.ts +8 -0
  749. package/dist/core/session-entry-index.d.ts.map +1 -0
  750. package/dist/core/session-entry-index.js +16 -0
  751. package/dist/core/session-entry-index.js.map +1 -0
  752. package/dist/core/session-image-store.d.ts.map +1 -1
  753. package/dist/core/session-image-store.js +0 -3
  754. package/dist/core/session-image-store.js.map +1 -1
  755. package/dist/core/session-jsonl-writer.d.ts +3 -0
  756. package/dist/core/session-jsonl-writer.d.ts.map +1 -0
  757. package/dist/core/session-jsonl-writer.js +38 -0
  758. package/dist/core/session-jsonl-writer.js.map +1 -0
  759. package/dist/core/session-manager-factory.d.ts.map +1 -1
  760. package/dist/core/session-manager-factory.js.map +1 -1
  761. package/dist/core/session-role.d.ts.map +1 -1
  762. package/dist/core/session-role.js.map +1 -1
  763. package/dist/core/session-snapshot.d.ts.map +1 -1
  764. package/dist/core/session-snapshot.js.map +1 -1
  765. package/dist/core/session-supervision-runtime.d.ts.map +1 -1
  766. package/dist/core/session-supervision-runtime.js +1 -4
  767. package/dist/core/session-supervision-runtime.js.map +1 -1
  768. package/dist/core/session-tree-navigator.d.ts.map +1 -1
  769. package/dist/core/session-tree-navigator.js +0 -1
  770. package/dist/core/session-tree-navigator.js.map +1 -1
  771. package/dist/core/settings-manager.d.ts +2 -1
  772. package/dist/core/settings-manager.d.ts.map +1 -1
  773. package/dist/core/settings-manager.js +64 -162
  774. package/dist/core/settings-manager.js.map +1 -1
  775. package/dist/core/skill-block.d.mts +8 -0
  776. package/dist/core/skill-block.mjs +52 -0
  777. package/dist/core/skill-discovery.d.ts +5 -0
  778. package/dist/core/skill-discovery.d.ts.map +1 -0
  779. package/dist/core/skill-discovery.js +34 -0
  780. package/dist/core/skill-discovery.js.map +1 -0
  781. package/dist/core/skills.d.ts.map +1 -1
  782. package/dist/core/skills.js +23 -159
  783. package/dist/core/skills.js.map +1 -1
  784. package/dist/core/slash-commands.d.ts.map +1 -1
  785. package/dist/core/source-info.d.ts.map +1 -1
  786. package/dist/core/source-info.js.map +1 -1
  787. package/dist/core/spawned-usage.d.ts +21 -0
  788. package/dist/core/spawned-usage.d.ts.map +1 -0
  789. package/dist/core/spawned-usage.js +29 -0
  790. package/dist/core/spawned-usage.js.map +1 -0
  791. package/dist/core/system-prompt-builder.d.ts +4 -0
  792. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  793. package/dist/core/system-prompt-builder.js +15 -8
  794. package/dist/core/system-prompt-builder.js.map +1 -1
  795. package/dist/core/system-prompt.d.ts.map +1 -1
  796. package/dist/core/system-prompt.js +52 -35
  797. package/dist/core/system-prompt.js.map +1 -1
  798. package/dist/core/tasks/session-task-state.d.ts.map +1 -1
  799. package/dist/core/tasks/session-task-state.js.map +1 -1
  800. package/dist/core/tasks/task-command.d.ts.map +1 -1
  801. package/dist/core/tasks/task-command.js.map +1 -1
  802. package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -1
  803. package/dist/core/tasks/task-contract-monitor.js.map +1 -1
  804. package/dist/core/tasks/task-projection.d.ts.map +1 -1
  805. package/dist/core/tasks/task-projection.js.map +1 -1
  806. package/dist/core/tasks/task-state.d.ts.map +1 -1
  807. package/dist/core/tasks/task-state.js.map +1 -1
  808. package/dist/core/text-preview.d.ts +4 -0
  809. package/dist/core/text-preview.d.ts.map +1 -0
  810. package/dist/core/text-preview.js +33 -0
  811. package/dist/core/text-preview.js.map +1 -0
  812. package/dist/core/timings.d.ts.map +1 -1
  813. package/dist/core/timings.js.map +1 -1
  814. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  815. package/dist/core/tool-capability-policy.js.map +1 -1
  816. package/dist/core/tool-gate-controller.d.ts.map +1 -1
  817. package/dist/core/tool-gate-controller.js +86 -87
  818. package/dist/core/tool-gate-controller.js.map +1 -1
  819. package/dist/core/tool-protocol-controller.d.ts +4 -1
  820. package/dist/core/tool-protocol-controller.d.ts.map +1 -1
  821. package/dist/core/tool-protocol-controller.js +19 -23
  822. package/dist/core/tool-protocol-controller.js.map +1 -1
  823. package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
  824. package/dist/core/tool-recovery-log-records.js.map +1 -1
  825. package/dist/core/tool-recovery-log-worker.d.ts.map +1 -1
  826. package/dist/core/tool-recovery-log-worker.js.map +1 -1
  827. package/dist/core/tool-recovery-logger.d.ts.map +1 -1
  828. package/dist/core/tool-recovery-logger.js +12 -24
  829. package/dist/core/tool-recovery-logger.js.map +1 -1
  830. package/dist/core/tool-recovery-stats.d.ts.map +1 -1
  831. package/dist/core/tool-recovery-stats.js +16 -22
  832. package/dist/core/tool-recovery-stats.js.map +1 -1
  833. package/dist/core/tool-repair-health.d.ts.map +1 -1
  834. package/dist/core/tool-repair-health.js.map +1 -1
  835. package/dist/core/tool-repair-settings.d.ts.map +1 -1
  836. package/dist/core/tool-repair-settings.js.map +1 -1
  837. package/dist/core/tool-selection/expected-utility.d.ts.map +1 -1
  838. package/dist/core/tool-selection/expected-utility.js.map +1 -1
  839. package/dist/core/tool-selection/promotion.d.ts.map +1 -1
  840. package/dist/core/tool-selection/promotion.js.map +1 -1
  841. package/dist/core/tool-selection/tool-performance-store.d.ts +2 -0
  842. package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
  843. package/dist/core/tool-selection/tool-performance-store.js +49 -7
  844. package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
  845. package/dist/core/tool-selection/tool-phase-timing.d.ts +19 -0
  846. package/dist/core/tool-selection/tool-phase-timing.d.ts.map +1 -0
  847. package/dist/core/tool-selection/tool-phase-timing.js +63 -0
  848. package/dist/core/tool-selection/tool-phase-timing.js.map +1 -0
  849. package/dist/core/tool-selection/tool-selection-controller.d.ts +2 -5
  850. package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
  851. package/dist/core/tool-selection/tool-selection-controller.js +50 -30
  852. package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
  853. package/dist/core/toolkit/reflex-interpreter.d.ts +16 -0
  854. package/dist/core/toolkit/reflex-interpreter.d.ts.map +1 -1
  855. package/dist/core/toolkit/reflex-interpreter.js +21 -0
  856. package/dist/core/toolkit/reflex-interpreter.js.map +1 -1
  857. package/dist/core/toolkit/script-registry.d.ts.map +1 -1
  858. package/dist/core/toolkit/script-registry.js.map +1 -1
  859. package/dist/core/toolkit/script-runner.d.ts.map +1 -1
  860. package/dist/core/toolkit/script-runner.js.map +1 -1
  861. package/dist/core/tools/artifact-retrieve.d.ts.map +1 -1
  862. package/dist/core/tools/artifact-retrieve.js.map +1 -1
  863. package/dist/core/tools/ask-question.d.ts +2 -3
  864. package/dist/core/tools/ask-question.d.ts.map +1 -1
  865. package/dist/core/tools/ask-question.js +14 -40
  866. package/dist/core/tools/ask-question.js.map +1 -1
  867. package/dist/core/tools/bash.d.ts +2 -0
  868. package/dist/core/tools/bash.d.ts.map +1 -1
  869. package/dist/core/tools/bash.js +83 -30
  870. package/dist/core/tools/bash.js.map +1 -1
  871. package/dist/core/tools/context-scout.d.ts.map +1 -1
  872. package/dist/core/tools/context-scout.js.map +1 -1
  873. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  874. package/dist/core/tools/delegate-status.js +9 -7
  875. package/dist/core/tools/delegate-status.js.map +1 -1
  876. package/dist/core/tools/delegate.d.ts.map +1 -1
  877. package/dist/core/tools/delegate.js +6 -6
  878. package/dist/core/tools/delegate.js.map +1 -1
  879. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  880. package/dist/core/tools/edit-diff.js.map +1 -1
  881. package/dist/core/tools/edit.d.ts.map +1 -1
  882. package/dist/core/tools/edit.js.map +1 -1
  883. package/dist/core/tools/extensionify.d.ts.map +1 -1
  884. package/dist/core/tools/extensionify.js.map +1 -1
  885. package/dist/core/tools/fff-search-backend.d.ts +19 -0
  886. package/dist/core/tools/fff-search-backend.d.ts.map +1 -1
  887. package/dist/core/tools/fff-search-backend.js +28 -2
  888. package/dist/core/tools/fff-search-backend.js.map +1 -1
  889. package/dist/core/tools/file-encoding-policy.d.ts.map +1 -1
  890. package/dist/core/tools/file-encoding-policy.js.map +1 -1
  891. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  892. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  893. package/dist/core/tools/find.d.ts +1 -1
  894. package/dist/core/tools/find.d.ts.map +1 -1
  895. package/dist/core/tools/find.js +44 -108
  896. package/dist/core/tools/find.js.map +1 -1
  897. package/dist/core/tools/git-filter.d.ts.map +1 -1
  898. package/dist/core/tools/git-filter.js.map +1 -1
  899. package/dist/core/tools/goal.d.ts.map +1 -1
  900. package/dist/core/tools/goal.js +7 -7
  901. package/dist/core/tools/goal.js.map +1 -1
  902. package/dist/core/tools/grep.d.ts +1 -1
  903. package/dist/core/tools/grep.d.ts.map +1 -1
  904. package/dist/core/tools/grep.js +42 -102
  905. package/dist/core/tools/grep.js.map +1 -1
  906. package/dist/core/tools/index.d.ts.map +1 -1
  907. package/dist/core/tools/index.js.map +1 -1
  908. package/dist/core/tools/ls.d.ts.map +1 -1
  909. package/dist/core/tools/ls.js +20 -36
  910. package/dist/core/tools/ls.js.map +1 -1
  911. package/dist/core/tools/model-fitness.d.ts.map +1 -1
  912. package/dist/core/tools/model-fitness.js.map +1 -1
  913. package/dist/core/tools/orchestration-panel.d.ts +5 -0
  914. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  915. package/dist/core/tools/orchestration-panel.js +5 -5
  916. package/dist/core/tools/orchestration-panel.js.map +1 -1
  917. package/dist/core/tools/output-accumulator.d.ts +2 -0
  918. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  919. package/dist/core/tools/output-accumulator.js +24 -36
  920. package/dist/core/tools/output-accumulator.js.map +1 -1
  921. package/dist/core/tools/path-utils.d.ts.map +1 -1
  922. package/dist/core/tools/path-utils.js.map +1 -1
  923. package/dist/core/tools/persistent-process-coordinator.d.ts +31 -0
  924. package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -0
  925. package/dist/core/tools/persistent-process-coordinator.js +123 -0
  926. package/dist/core/tools/persistent-process-coordinator.js.map +1 -0
  927. package/dist/core/tools/python.d.ts.map +1 -1
  928. package/dist/core/tools/python.js.map +1 -1
  929. package/dist/core/tools/read.d.ts.map +1 -1
  930. package/dist/core/tools/read.js +14 -13
  931. package/dist/core/tools/read.js.map +1 -1
  932. package/dist/core/tools/render-utils.d.ts +29 -0
  933. package/dist/core/tools/render-utils.d.ts.map +1 -1
  934. package/dist/core/tools/render-utils.js +31 -1
  935. package/dist/core/tools/render-utils.js.map +1 -1
  936. package/dist/core/tools/run-process.d.ts.map +1 -1
  937. package/dist/core/tools/run-process.js.map +1 -1
  938. package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
  939. package/dist/core/tools/run-toolkit-script.js.map +1 -1
  940. package/dist/core/tools/search-command-guard.d.ts +10 -0
  941. package/dist/core/tools/search-command-guard.d.ts.map +1 -1
  942. package/dist/core/tools/search-command-guard.js +118 -31
  943. package/dist/core/tools/search-command-guard.js.map +1 -1
  944. package/dist/core/tools/search-router.d.ts.map +1 -1
  945. package/dist/core/tools/search-router.js.map +1 -1
  946. package/dist/core/tools/search-tool-runtime.d.ts +19 -0
  947. package/dist/core/tools/search-tool-runtime.d.ts.map +1 -0
  948. package/dist/core/tools/search-tool-runtime.js +12 -0
  949. package/dist/core/tools/search-tool-runtime.js.map +1 -0
  950. package/dist/core/tools/secret-store.d.ts.map +1 -1
  951. package/dist/core/tools/secret-store.js.map +1 -1
  952. package/dist/core/tools/shell-command-parser.d.ts.map +1 -1
  953. package/dist/core/tools/shell-command-parser.js.map +1 -1
  954. package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
  955. package/dist/core/tools/shell-contract-router.js +4 -1
  956. package/dist/core/tools/shell-contract-router.js.map +1 -1
  957. package/dist/core/tools/shell-execution-session.d.ts +4 -0
  958. package/dist/core/tools/shell-execution-session.d.ts.map +1 -0
  959. package/dist/core/tools/shell-execution-session.js +11 -0
  960. package/dist/core/tools/shell-execution-session.js.map +1 -0
  961. package/dist/core/tools/shell-output-projection.d.ts +49 -0
  962. package/dist/core/tools/shell-output-projection.d.ts.map +1 -0
  963. package/dist/core/tools/shell-output-projection.js +381 -0
  964. package/dist/core/tools/shell-output-projection.js.map +1 -0
  965. package/dist/core/tools/shell-session.d.ts +2 -13
  966. package/dist/core/tools/shell-session.d.ts.map +1 -1
  967. package/dist/core/tools/shell-session.js +36 -136
  968. package/dist/core/tools/shell-session.js.map +1 -1
  969. package/dist/core/tools/skill-audit.d.ts.map +1 -1
  970. package/dist/core/tools/skill-audit.js.map +1 -1
  971. package/dist/core/tools/skillify.d.ts.map +1 -1
  972. package/dist/core/tools/skillify.js.map +1 -1
  973. package/dist/core/tools/task-steps.d.ts +8 -8
  974. package/dist/core/tools/task-steps.d.ts.map +1 -1
  975. package/dist/core/tools/task-steps.js +17 -18
  976. package/dist/core/tools/task-steps.js.map +1 -1
  977. package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
  978. package/dist/core/tools/tmux-dispatch.js.map +1 -1
  979. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  980. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  981. package/dist/core/tools/tool-task.d.ts +23 -0
  982. package/dist/core/tools/tool-task.d.ts.map +1 -0
  983. package/dist/core/tools/tool-task.js +93 -0
  984. package/dist/core/tools/tool-task.js.map +1 -0
  985. package/dist/core/tools/windows-shell-engine.d.ts +17 -11
  986. package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
  987. package/dist/core/tools/windows-shell-engine.js +339 -117
  988. package/dist/core/tools/windows-shell-engine.js.map +1 -1
  989. package/dist/core/tools/windows-shell-state.d.ts.map +1 -1
  990. package/dist/core/tools/windows-shell-state.js.map +1 -1
  991. package/dist/core/tools/worktree-sync.d.ts.map +1 -1
  992. package/dist/core/tools/worktree-sync.js +8 -12
  993. package/dist/core/tools/worktree-sync.js.map +1 -1
  994. package/dist/core/tools/write.d.ts.map +1 -1
  995. package/dist/core/tools/write.js +0 -1
  996. package/dist/core/tools/write.js.map +1 -1
  997. package/dist/core/trust-manager.d.ts.map +1 -1
  998. package/dist/core/trust-manager.js +7 -40
  999. package/dist/core/trust-manager.js.map +1 -1
  1000. package/dist/core/util/atomic-file.d.ts +19 -0
  1001. package/dist/core/util/atomic-file.d.ts.map +1 -1
  1002. package/dist/core/util/atomic-file.js +50 -15
  1003. package/dist/core/util/atomic-file.js.map +1 -1
  1004. package/dist/core/util/bounded-file.d.ts.map +1 -1
  1005. package/dist/core/util/bounded-file.js.map +1 -1
  1006. package/dist/core/util/bounded-jsonl.d.ts.map +1 -1
  1007. package/dist/core/util/bounded-jsonl.js +2 -9
  1008. package/dist/core/util/bounded-jsonl.js.map +1 -1
  1009. package/dist/core/util/bounded-value.d.ts.map +1 -1
  1010. package/dist/core/util/bounded-value.js.map +1 -1
  1011. package/dist/core/util/json-size.d.ts +3 -0
  1012. package/dist/core/util/json-size.d.ts.map +1 -0
  1013. package/dist/core/util/json-size.js +95 -0
  1014. package/dist/core/util/json-size.js.map +1 -0
  1015. package/dist/core/util/minimatch-cache.d.ts.map +1 -1
  1016. package/dist/core/util/minimatch-cache.js.map +1 -1
  1017. package/dist/core/util/value-guards.d.ts.map +1 -1
  1018. package/dist/core/util/value-guards.js.map +1 -1
  1019. package/dist/core/worktree-sync/codes.d.ts.map +1 -1
  1020. package/dist/core/worktree-sync/git-engine.d.ts.map +1 -1
  1021. package/dist/core/worktree-sync/git-engine.js +20 -36
  1022. package/dist/core/worktree-sync/git-engine.js.map +1 -1
  1023. package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
  1024. package/dist/core/worktree-sync/lane-gate.js +1 -4
  1025. package/dist/core/worktree-sync/lane-gate.js.map +1 -1
  1026. package/dist/core/worktree-sync/runtime.d.ts.map +1 -1
  1027. package/dist/core/worktree-sync/runtime.js.map +1 -1
  1028. package/dist/core/worktree-sync/store.d.ts.map +1 -1
  1029. package/dist/core/worktree-sync/store.js.map +1 -1
  1030. package/dist/core/worktree-sync/watcher.d.ts.map +1 -1
  1031. package/dist/core/worktree-sync/watcher.js.map +1 -1
  1032. package/dist/index.d.ts.map +1 -1
  1033. package/dist/index.js.map +1 -1
  1034. package/dist/main.d.ts.map +1 -1
  1035. package/dist/main.js +10 -32
  1036. package/dist/main.js.map +1 -1
  1037. package/dist/migrations.d.ts.map +1 -1
  1038. package/dist/migrations.js +6 -19
  1039. package/dist/migrations.js.map +1 -1
  1040. package/dist/modes/index.d.ts.map +1 -1
  1041. package/dist/modes/interactive/auth-dialogs-controller.d.ts +3 -0
  1042. package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
  1043. package/dist/modes/interactive/auth-dialogs-controller.js +96 -132
  1044. package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
  1045. package/dist/modes/interactive/auto-learn-controller.d.ts +1 -31
  1046. package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
  1047. package/dist/modes/interactive/auto-learn-controller.js +86 -307
  1048. package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
  1049. package/dist/modes/interactive/autocomplete-provider.d.ts.map +1 -1
  1050. package/dist/modes/interactive/autocomplete-provider.js.map +1 -1
  1051. package/dist/modes/interactive/autonomy-commands.d.ts.map +1 -1
  1052. package/dist/modes/interactive/autonomy-commands.js +2 -8
  1053. package/dist/modes/interactive/autonomy-commands.js.map +1 -1
  1054. package/dist/modes/interactive/clipboard-input.d.ts +5 -1
  1055. package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
  1056. package/dist/modes/interactive/clipboard-input.js +17 -0
  1057. package/dist/modes/interactive/clipboard-input.js.map +1 -1
  1058. package/dist/modes/interactive/compaction-queue.d.ts.map +1 -1
  1059. package/dist/modes/interactive/compaction-queue.js +13 -18
  1060. package/dist/modes/interactive/compaction-queue.js.map +1 -1
  1061. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
  1062. package/dist/modes/interactive/components/activity-lane.js +6 -10
  1063. package/dist/modes/interactive/components/activity-lane.js.map +1 -1
  1064. package/dist/modes/interactive/components/armin.d.ts +1 -0
  1065. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  1066. package/dist/modes/interactive/components/armin.js +10 -21
  1067. package/dist/modes/interactive/components/armin.js.map +1 -1
  1068. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  1069. package/dist/modes/interactive/components/assistant-message.js +1 -6
  1070. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  1071. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  1072. package/dist/modes/interactive/components/bash-execution.js +4 -9
  1073. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  1074. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  1075. package/dist/modes/interactive/components/bordered-loader.js +0 -3
  1076. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  1077. package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -8
  1078. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  1079. package/dist/modes/interactive/components/branch-summary-message.js +13 -35
  1080. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  1081. package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -8
  1082. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  1083. package/dist/modes/interactive/components/compaction-summary-message.js +14 -36
  1084. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  1085. package/dist/modes/interactive/components/config-selector.d.ts +1 -0
  1086. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  1087. package/dist/modes/interactive/components/config-selector.js +20 -43
  1088. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  1089. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  1090. package/dist/modes/interactive/components/countdown-timer.js +0 -5
  1091. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  1092. package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
  1093. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  1094. package/dist/modes/interactive/components/custom-editor.js +4 -8
  1095. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  1096. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  1097. package/dist/modes/interactive/components/custom-message.js +1 -6
  1098. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  1099. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  1100. package/dist/modes/interactive/components/daxnuts.js +6 -8
  1101. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  1102. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  1103. package/dist/modes/interactive/components/diff.js.map +1 -1
  1104. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  1105. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  1106. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  1107. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  1108. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  1109. package/dist/modes/interactive/components/expandable-markdown-message.d.ts +21 -0
  1110. package/dist/modes/interactive/components/expandable-markdown-message.d.ts.map +1 -0
  1111. package/dist/modes/interactive/components/expandable-markdown-message.js +48 -0
  1112. package/dist/modes/interactive/components/expandable-markdown-message.js.map +1 -0
  1113. package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -1
  1114. package/dist/modes/interactive/components/expandable-text.js +0 -2
  1115. package/dist/modes/interactive/components/expandable-text.js.map +1 -1
  1116. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  1117. package/dist/modes/interactive/components/extension-editor.js +1 -9
  1118. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  1119. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  1120. package/dist/modes/interactive/components/extension-input.js +2 -8
  1121. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  1122. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  1123. package/dist/modes/interactive/components/extension-selector.js +5 -20
  1124. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  1125. package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
  1126. package/dist/modes/interactive/components/fitness-role-selector.js +0 -1
  1127. package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
  1128. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  1129. package/dist/modes/interactive/components/footer.js +1 -5
  1130. package/dist/modes/interactive/components/footer.js.map +1 -1
  1131. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  1132. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  1133. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  1134. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  1135. package/dist/modes/interactive/components/login-dialog.js +4 -10
  1136. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  1137. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  1138. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  1139. package/dist/modes/interactive/components/model-selector.js +21 -44
  1140. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  1141. package/dist/modes/interactive/components/model-suggestion-selector.d.ts.map +1 -1
  1142. package/dist/modes/interactive/components/model-suggestion-selector.js +0 -1
  1143. package/dist/modes/interactive/components/model-suggestion-selector.js.map +1 -1
  1144. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  1145. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  1146. package/dist/modes/interactive/components/oauth-selector.js +16 -32
  1147. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  1148. package/dist/modes/interactive/components/profile-resource-editor.d.ts +3 -4
  1149. package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
  1150. package/dist/modes/interactive/components/profile-resource-editor.js +34 -93
  1151. package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
  1152. package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
  1153. package/dist/modes/interactive/components/profile-selector.js +0 -1
  1154. package/dist/modes/interactive/components/profile-selector.js.map +1 -1
  1155. package/dist/modes/interactive/components/scoped-models-selector.d.ts +3 -4
  1156. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  1157. package/dist/modes/interactive/components/scoped-models-selector.js +34 -79
  1158. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  1159. package/dist/modes/interactive/components/selector-list.d.ts +63 -0
  1160. package/dist/modes/interactive/components/selector-list.d.ts.map +1 -0
  1161. package/dist/modes/interactive/components/selector-list.js +186 -0
  1162. package/dist/modes/interactive/components/selector-list.js.map +1 -0
  1163. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  1164. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  1165. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  1166. package/dist/modes/interactive/components/session-selector.js +34 -59
  1167. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  1168. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  1169. package/dist/modes/interactive/components/settings-selector.js +40 -138
  1170. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  1171. package/dist/modes/interactive/components/show-images-selector.d.ts +2 -4
  1172. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  1173. package/dist/modes/interactive/components/show-images-selector.js +9 -28
  1174. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  1175. package/dist/modes/interactive/components/skill-invocation-message.d.ts +3 -8
  1176. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  1177. package/dist/modes/interactive/components/skill-invocation-message.js +12 -40
  1178. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  1179. package/dist/modes/interactive/components/theme-selector.d.ts +2 -5
  1180. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  1181. package/dist/modes/interactive/components/theme-selector.js +11 -37
  1182. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  1183. package/dist/modes/interactive/components/thinking-selector.d.ts +2 -4
  1184. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  1185. package/dist/modes/interactive/components/thinking-selector.js +9 -31
  1186. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  1187. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  1188. package/dist/modes/interactive/components/tool-execution.js +9 -28
  1189. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  1190. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
  1191. package/dist/modes/interactive/components/tool-group.js +2 -3
  1192. package/dist/modes/interactive/components/tool-group.js.map +1 -1
  1193. package/dist/modes/interactive/components/tool-panel-registry.d.ts.map +1 -1
  1194. package/dist/modes/interactive/components/tool-panel-registry.js +5 -3
  1195. package/dist/modes/interactive/components/tool-panel-registry.js.map +1 -1
  1196. package/dist/modes/interactive/components/tool-title.d.ts.map +1 -1
  1197. package/dist/modes/interactive/components/tool-title.js +0 -4
  1198. package/dist/modes/interactive/components/tool-title.js.map +1 -1
  1199. package/dist/modes/interactive/components/transcript-pager.d.ts +26 -0
  1200. package/dist/modes/interactive/components/transcript-pager.d.ts.map +1 -0
  1201. package/dist/modes/interactive/components/transcript-pager.js +81 -0
  1202. package/dist/modes/interactive/components/transcript-pager.js.map +1 -0
  1203. package/dist/modes/interactive/components/tree-selector.d.ts +1 -12
  1204. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  1205. package/dist/modes/interactive/components/tree-selector.js +42 -402
  1206. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  1207. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  1208. package/dist/modes/interactive/components/trust-selector.js +4 -16
  1209. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  1210. package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -1
  1211. package/dist/modes/interactive/components/usage-action-selector.js +2 -10
  1212. package/dist/modes/interactive/components/usage-action-selector.js.map +1 -1
  1213. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  1214. package/dist/modes/interactive/components/user-message-selector.js +3 -6
  1215. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  1216. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  1217. package/dist/modes/interactive/components/user-message.js +0 -1
  1218. package/dist/modes/interactive/components/user-message.js.map +1 -1
  1219. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  1220. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  1221. package/dist/modes/interactive/config-backup.d.ts.map +1 -1
  1222. package/dist/modes/interactive/config-backup.js.map +1 -1
  1223. package/dist/modes/interactive/editor-overlay-host.d.ts.map +1 -1
  1224. package/dist/modes/interactive/editor-overlay-host.js +0 -3
  1225. package/dist/modes/interactive/editor-overlay-host.js.map +1 -1
  1226. package/dist/modes/interactive/extension-ui-host.d.ts +2 -0
  1227. package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
  1228. package/dist/modes/interactive/extension-ui-host.js +51 -72
  1229. package/dist/modes/interactive/extension-ui-host.js.map +1 -1
  1230. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  1231. package/dist/modes/interactive/external-editor.js +2 -15
  1232. package/dist/modes/interactive/external-editor.js.map +1 -1
  1233. package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
  1234. package/dist/modes/interactive/history-reload-math.js.map +1 -1
  1235. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
  1236. package/dist/modes/interactive/interactive-event-controller.js +23 -16
  1237. package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
  1238. package/dist/modes/interactive/interactive-mode.d.ts +13 -4
  1239. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  1240. package/dist/modes/interactive/interactive-mode.js +123 -204
  1241. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  1242. package/dist/modes/interactive/interactive-selection-prompts.d.ts +20 -0
  1243. package/dist/modes/interactive/interactive-selection-prompts.d.ts.map +1 -0
  1244. package/dist/modes/interactive/interactive-selection-prompts.js +43 -0
  1245. package/dist/modes/interactive/interactive-selection-prompts.js.map +1 -0
  1246. package/dist/modes/interactive/key-handlers.d.ts +2 -1
  1247. package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
  1248. package/dist/modes/interactive/key-handlers.js +4 -2
  1249. package/dist/modes/interactive/key-handlers.js.map +1 -1
  1250. package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -1
  1251. package/dist/modes/interactive/loaded-resources-view.js.map +1 -1
  1252. package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
  1253. package/dist/modes/interactive/local-model-commands.js +4 -9
  1254. package/dist/modes/interactive/local-model-commands.js.map +1 -1
  1255. package/dist/modes/interactive/model-fitness-presentation.d.ts +21 -0
  1256. package/dist/modes/interactive/model-fitness-presentation.d.ts.map +1 -0
  1257. package/dist/modes/interactive/model-fitness-presentation.js +13 -0
  1258. package/dist/modes/interactive/model-fitness-presentation.js.map +1 -0
  1259. package/dist/modes/interactive/profile-menu-controller.d.ts +2 -0
  1260. package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
  1261. package/dist/modes/interactive/profile-menu-controller.js +79 -171
  1262. package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
  1263. package/dist/modes/interactive/report-commands.d.ts +2 -0
  1264. package/dist/modes/interactive/report-commands.d.ts.map +1 -1
  1265. package/dist/modes/interactive/report-commands.js +12 -6
  1266. package/dist/modes/interactive/report-commands.js.map +1 -1
  1267. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  1268. package/dist/modes/interactive/resource-display.js.map +1 -1
  1269. package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
  1270. package/dist/modes/interactive/resource-shell-commands.js +6 -23
  1271. package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
  1272. package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
  1273. package/dist/modes/interactive/session-flow-commands.js +21 -25
  1274. package/dist/modes/interactive/session-flow-commands.js.map +1 -1
  1275. package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
  1276. package/dist/modes/interactive/session-io-commands.js.map +1 -1
  1277. package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -1
  1278. package/dist/modes/interactive/session-replacement-errors.js.map +1 -1
  1279. package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
  1280. package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
  1281. package/dist/modes/interactive/signal-lifecycle.d.ts.map +1 -1
  1282. package/dist/modes/interactive/signal-lifecycle.js.map +1 -1
  1283. package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
  1284. package/dist/modes/interactive/startup-checks.js +12 -8
  1285. package/dist/modes/interactive/startup-checks.js.map +1 -1
  1286. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  1287. package/dist/modes/interactive/theme/theme.js +10 -76
  1288. package/dist/modes/interactive/theme/theme.js.map +1 -1
  1289. package/dist/modes/interactive/usage-commands.d.ts.map +1 -1
  1290. package/dist/modes/interactive/usage-commands.js.map +1 -1
  1291. package/dist/modes/print-mode.d.ts.map +1 -1
  1292. package/dist/modes/print-mode.js +5 -22
  1293. package/dist/modes/print-mode.js.map +1 -1
  1294. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  1295. package/dist/modes/rpc/jsonl.js +1 -1
  1296. package/dist/modes/rpc/jsonl.js.map +1 -1
  1297. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  1298. package/dist/modes/rpc/rpc-client.js +7 -8
  1299. package/dist/modes/rpc/rpc-client.js.map +1 -1
  1300. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  1301. package/dist/modes/rpc/rpc-mode.js +5 -20
  1302. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  1303. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  1304. package/dist/modes/rpc/rpc-types.js.map +1 -1
  1305. package/dist/modes/termination-signals.d.ts +4 -0
  1306. package/dist/modes/termination-signals.d.ts.map +1 -0
  1307. package/dist/modes/termination-signals.js +21 -0
  1308. package/dist/modes/termination-signals.js.map +1 -0
  1309. package/dist/package-manager-cli.d.ts.map +1 -1
  1310. package/dist/package-manager-cli.js.map +1 -1
  1311. package/dist/utils/ansi-colors.d.ts +5 -0
  1312. package/dist/utils/ansi-colors.d.ts.map +1 -0
  1313. package/dist/utils/ansi-colors.js +38 -0
  1314. package/dist/utils/ansi-colors.js.map +1 -0
  1315. package/dist/utils/ansi.d.ts.map +1 -1
  1316. package/dist/utils/ansi.js.map +1 -1
  1317. package/dist/utils/changelog.d.ts.map +1 -1
  1318. package/dist/utils/changelog.js.map +1 -1
  1319. package/dist/utils/child-process.d.ts.map +1 -1
  1320. package/dist/utils/child-process.js.map +1 -1
  1321. package/dist/utils/clipboard-image.d.ts.map +1 -1
  1322. package/dist/utils/clipboard-image.js.map +1 -1
  1323. package/dist/utils/clipboard-native.d.ts.map +1 -1
  1324. package/dist/utils/clipboard-native.js.map +1 -1
  1325. package/dist/utils/clipboard.d.ts.map +1 -1
  1326. package/dist/utils/clipboard.js.map +1 -1
  1327. package/dist/utils/deprecation.d.ts.map +1 -1
  1328. package/dist/utils/deprecation.js.map +1 -1
  1329. package/dist/utils/exif-orientation.d.ts.map +1 -1
  1330. package/dist/utils/exif-orientation.js.map +1 -1
  1331. package/dist/utils/external-editor-command.d.ts.map +1 -1
  1332. package/dist/utils/external-editor-command.js.map +1 -1
  1333. package/dist/utils/frontmatter.d.ts.map +1 -1
  1334. package/dist/utils/frontmatter.js.map +1 -1
  1335. package/dist/utils/fs-watch.d.ts.map +1 -1
  1336. package/dist/utils/fs-watch.js.map +1 -1
  1337. package/dist/utils/git.d.ts.map +1 -1
  1338. package/dist/utils/git.js +20 -28
  1339. package/dist/utils/git.js.map +1 -1
  1340. package/dist/utils/highlight-js-languages.d.ts.map +1 -1
  1341. package/dist/utils/html.d.ts.map +1 -1
  1342. package/dist/utils/html.js.map +1 -1
  1343. package/dist/utils/image-convert.d.ts.map +1 -1
  1344. package/dist/utils/image-convert.js.map +1 -1
  1345. package/dist/utils/image-resize-core.d.ts.map +1 -1
  1346. package/dist/utils/image-resize-core.js.map +1 -1
  1347. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  1348. package/dist/utils/image-resize-worker.js.map +1 -1
  1349. package/dist/utils/image-resize.d.ts.map +1 -1
  1350. package/dist/utils/image-resize.js.map +1 -1
  1351. package/dist/utils/json.d.ts.map +1 -1
  1352. package/dist/utils/json.js.map +1 -1
  1353. package/dist/utils/mime.d.ts.map +1 -1
  1354. package/dist/utils/mime.js.map +1 -1
  1355. package/dist/utils/open-browser.d.ts.map +1 -1
  1356. package/dist/utils/open-browser.js.map +1 -1
  1357. package/dist/utils/paths.d.ts.map +1 -1
  1358. package/dist/utils/paths.js.map +1 -1
  1359. package/dist/utils/photon.d.ts.map +1 -1
  1360. package/dist/utils/photon.js.map +1 -1
  1361. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  1362. package/dist/utils/pi-user-agent.js.map +1 -1
  1363. package/dist/utils/platform.d.ts.map +1 -1
  1364. package/dist/utils/platform.js.map +1 -1
  1365. package/dist/utils/process-memory.d.ts.map +1 -1
  1366. package/dist/utils/process-memory.js.map +1 -1
  1367. package/dist/utils/safe-write-stream.d.ts.map +1 -1
  1368. package/dist/utils/safe-write-stream.js.map +1 -1
  1369. package/dist/utils/shell.d.ts.map +1 -1
  1370. package/dist/utils/shell.js.map +1 -1
  1371. package/dist/utils/sleep.d.ts.map +1 -1
  1372. package/dist/utils/sleep.js +2 -15
  1373. package/dist/utils/sleep.js.map +1 -1
  1374. package/dist/utils/stdin-events.d.ts +8 -0
  1375. package/dist/utils/stdin-events.d.ts.map +1 -0
  1376. package/dist/utils/stdin-events.js +19 -0
  1377. package/dist/utils/stdin-events.js.map +1 -0
  1378. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  1379. package/dist/utils/syntax-highlight.js +20 -13
  1380. package/dist/utils/syntax-highlight.js.map +1 -1
  1381. package/dist/utils/tools-manager.d.ts.map +1 -1
  1382. package/dist/utils/tools-manager.js.map +1 -1
  1383. package/dist/utils/version-check.d.ts.map +1 -1
  1384. package/dist/utils/version-check.js.map +1 -1
  1385. package/dist/utils/windows-self-update.d.ts.map +1 -1
  1386. package/dist/utils/windows-self-update.js.map +1 -1
  1387. package/dist/utils/work-directory.d.ts.map +1 -1
  1388. package/dist/utils/work-directory.js.map +1 -1
  1389. package/docs/compaction.md +11 -3
  1390. package/docs/sessions.md +6 -0
  1391. package/docs/settings.md +1 -1
  1392. package/docs/windows.md +26 -1
  1393. package/docs/work-directory.md +9 -1
  1394. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  1395. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  1396. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  1397. package/examples/extensions/sandbox/package-lock.json +2 -2
  1398. package/examples/extensions/sandbox/package.json +1 -1
  1399. package/examples/extensions/with-deps/package-lock.json +2 -2
  1400. package/examples/extensions/with-deps/package.json +1 -1
  1401. package/npm-shrinkwrap.json +16 -16
  1402. package/package.json +10 -10
  1403. package/dist/utils/streaming-lines.d.ts +0 -20
  1404. package/dist/utils/streaming-lines.d.ts.map +0 -1
  1405. package/dist/utils/streaming-lines.js +0 -79
  1406. package/dist/utils/streaming-lines.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EAEpB,YAAY,GACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEjF,OAAO,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAEN,0BAA0B,EAC1B,oBAAoB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from \"node:readline\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tformatSize,\n\tGREP_MAX_LINE_LENGTH,\n\ttype TruncationResult,\n\ttruncateLine,\n} from \"@caupulican/pi-agent-core/node\";\nimport { Text } from \"@caupulican/pi-tui\";\nimport { spawn } from \"child_process\";\nimport path from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { waitForChildProcessWithTermination } from \"../../utils/child-process.ts\";\nimport { ensureTool } from \"../../utils/tools-manager.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport {\n\ttype BroadQueryTracker,\n\tbroadQueryInvalidationNote,\n\tformatArtifactNotice,\n\tnormalizeBroadQueryKey,\n\tpackToolOutput,\n} from \"../context/tool-output-packer.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport {\n\tdefaultFffSearchBackend,\n\ttype FffGrepMatch,\n\ttype FffGrepResult,\n\ttype FffSearchBackend,\n\thasGitignoreInTree,\n\trelativePathInside,\n\tsafeGetFinder,\n} from \"./fff-search-backend.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\nimport { getTextOutput, invalidArgText, shortenPath, str } from \"./render-utils.ts\";\nimport { defaultSearchRouter, type SearchRouter } from \"./search-router.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst grepSchema = Type.Object({\n\tpattern: Type.String({ description: \"Search pattern (regex or literal string)\" }),\n\tpath: Type.Optional(Type.String({ description: \"Directory or file to search (default: current directory)\" })),\n\tglob: Type.Optional(Type.String({ description: \"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'\" })),\n\tignoreCase: Type.Optional(Type.Boolean({ description: \"Case-insensitive search (default: false)\" })),\n\tliteral: Type.Optional(\n\t\tType.Boolean({ description: \"Treat pattern as literal string instead of regex (default: false)\" }),\n\t),\n\tcontext: Type.Optional(\n\t\tType.Number({ description: \"Number of lines to show before and after each match (default: 0)\" }),\n\t),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of matches to return (default: 100)\" })),\n});\n\nexport type GrepToolInput = Static<typeof grepSchema>;\nconst DEFAULT_LIMIT = 100;\nconst GREP_PROCESS_TIMEOUT_MS = 5 * 60_000;\nconst GREP_PROCESS_KILL_GRACE_MS = 1_000;\n\nexport interface GrepToolDetails {\n\ttruncation?: TruncationResult;\n\tmatchLimitReached?: number;\n\tlinesTruncated?: boolean;\n\t/** Set only when output was packed to an artifact; see tool-output-packer.ts. */\n\tartifactId?: string;\n\t/** Set when this exact query has repeatedly produced broad/truncated results. */\n\tinvalidationCandidate?: boolean;\n}\n\n/**\n * Pluggable operations for the grep tool.\n * Override these to delegate search to remote systems (for example SSH).\n */\nexport interface GrepOperations {\n\t/** Check if path is a directory. Throws if path does not exist. */\n\tisDirectory: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Read file contents for context lines */\n\treadFile: (absolutePath: string) => Promise<string> | string;\n}\n\nconst defaultGrepOperations: GrepOperations = {\n\tisDirectory: async (p) => (await fsStat(p)).isDirectory(),\n\treadFile: (p) => fsReadFile(p, \"utf-8\"),\n};\n\nexport interface GrepToolOptions {\n\t/** Custom operations for grep. Default: local filesystem plus routed FFF/rg search */\n\toperations?: GrepOperations;\n\t/** FFF backend for resident indexed search. Set false to force ripgrep fallback. */\n\tfff?: FffSearchBackend | false;\n\t/** Pure router that selects FFF or rg from request filters and environment facts. */\n\tsearchRouter?: SearchRouter;\n\t/**\n\t * Opt-in artifact store for first-capture-then-bound output packing (Phase 3). When\n\t * omitted (the default), behavior is byte-for-byte unchanged from before this option\n\t * existed: output is truncated the same way, just never artifact-backed.\n\t */\n\tartifactStore?: ArtifactStore;\n\t/** Opt-in tracker for repeated-broad-query \"do not repeat\" signals. Also default-off. */\n\tbroadQueryTracker?: BroadQueryTracker;\n}\n\nfunction formatGrepCall(\n\targs: { pattern: string; path?: string; glob?: string; limit?: number } | undefined,\n\ttheme: Theme,\n\tcwd: string,\n): string {\n\tconst pattern = str(args?.pattern);\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\", cwd) : null;\n\tconst glob = str(args?.glob);\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"grep\")) +\n\t\t\" \" +\n\t\t(pattern === null ? invalidArg : theme.fg(\"accent\", `/${pattern || \"\"}/`)) +\n\t\ttheme.fg(\"toolOutput\", ` in ${path === null ? invalidArg : path}`);\n\tif (glob) text += theme.fg(\"toolOutput\", ` (${glob})`);\n\tif (limit !== undefined) text += theme.fg(\"toolOutput\", ` limit ${limit}`);\n\treturn text;\n}\n\nfunction formatGrepResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: GrepToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 15;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t\t}\n\t}\n\n\tconst matchLimit = result.details?.matchLimitReached;\n\tconst truncation = result.details?.truncation;\n\tconst linesTruncated = result.details?.linesTruncated;\n\tif (matchLimit || truncation?.truncated || linesTruncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (matchLimit) warnings.push(`${matchLimit} matches limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\tif (linesTruncated) warnings.push(\"some lines truncated\");\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nfunction globConstraintForFff(glob: string | undefined): string {\n\tif (!glob) return \"\";\n\tif (glob.includes(\"/\") || glob.startsWith(\"**/\")) return glob;\n\treturn `**/${glob}`;\n}\n\nfunction fffGrepQuery(options: {\n\tpattern: string;\n\tglob?: string;\n\tisDirectory: boolean;\n\tsearchPathRelativeToCwd: string;\n}): string | undefined {\n\tconst parts: string[] = [];\n\tif (options.searchPathRelativeToCwd) {\n\t\tparts.push(options.isDirectory ? `${options.searchPathRelativeToCwd}/` : options.searchPathRelativeToCwd);\n\t}\n\tparts.push(globConstraintForFff(options.glob));\n\tparts.push(options.pattern);\n\treturn parts.filter(Boolean).join(\" \");\n}\n\nfunction fffDisplayPath(\n\tmatch: FffGrepMatch,\n\toptions: { isDirectory: boolean; searchPathRelativeToCwd: string },\n): string | undefined {\n\tconst relativePath = match.relativePath.replaceAll(\"\\\\\", \"/\");\n\tif (!options.searchPathRelativeToCwd) return relativePath;\n\tif (!options.isDirectory) {\n\t\treturn relativePath === options.searchPathRelativeToCwd ? path.posix.basename(relativePath) : undefined;\n\t}\n\tconst prefix = `${options.searchPathRelativeToCwd}/`;\n\tif (!relativePath.startsWith(prefix)) return undefined;\n\treturn relativePath.slice(prefix.length);\n}\n\nfunction appendFffMatchLines(options: {\n\tmatch: FffGrepMatch;\n\toutputLines: string[];\n\tlinesTruncated: { value: boolean };\n\tcontextValue: number;\n}): void {\n\tconst before = options.match.contextBefore ?? [];\n\tfor (let i = 0; i < before.length; i++) {\n\t\tconst lineNumber = options.match.lineNumber - before.length + i;\n\t\tconst { text, wasTruncated } = truncateLine(before[i] ?? \"\");\n\t\tif (wasTruncated) options.linesTruncated.value = true;\n\t\toptions.outputLines.push(` ${lineNumber}- ${text}`);\n\t}\n\n\tconst { text, wasTruncated } = truncateLine(options.match.lineContent.replace(/\\r/g, \"\"));\n\tif (wasTruncated) options.linesTruncated.value = true;\n\toptions.outputLines.push(` ${options.match.lineNumber}: ${text}`);\n\n\tif (options.contextValue === 0) return;\n\tconst after = options.match.contextAfter ?? [];\n\tfor (let i = 0; i < after.length; i++) {\n\t\tconst lineNumber = options.match.lineNumber + 1 + i;\n\t\tconst { text: contextText, wasTruncated: contextWasTruncated } = truncateLine(after[i] ?? \"\");\n\t\tif (contextWasTruncated) options.linesTruncated.value = true;\n\t\toptions.outputLines.push(` ${lineNumber}- ${contextText}`);\n\t}\n}\n\n/**\n * Shared \"measure -> pack -> notices\" tail for both the FFF and ripgrep result paths:\n * first-capture the raw output to an artifact if it's oversized and a store was provided\n * (Phase 3 tool-output-artifacts.md boundary rule), then append the same match-limit/\n * byte-limit/line-truncation/broad-query notices either path already produced.\n */\nfunction packGrepOutput(options: {\n\trawOutput: string;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\tpattern: string;\n\trawPath?: string;\n\tglob?: string;\n\tmatchLimitReached: number | false;\n\tlinesTruncated: boolean;\n}): { text: string; details: GrepToolDetails } {\n\tconst packed = packToolOutput(\n\t\t{\n\t\t\ttoolName: \"grep\",\n\t\t\tpath: options.rawPath,\n\t\t\trawContent: options.rawOutput,\n\t\t\t// No line limit here because the match limit already caps rows; only the byte\n\t\t\t// cap should apply, matching the pre-Slice-B truncateHead call exactly.\n\t\t\ttruncation: { maxLines: Number.MAX_SAFE_INTEGER },\n\t\t},\n\t\toptions.artifactStore,\n\t\toptions.toolCallId,\n\t);\n\tlet output = packed.content;\n\tconst details: GrepToolDetails = {};\n\n\tconst notices: string[] = [];\n\tif (packed.artifactId) {\n\t\tnotices.push(formatArtifactNotice(packed.artifactId));\n\t\tdetails.artifactId = packed.artifactId;\n\t}\n\tif (options.matchLimitReached) {\n\t\tnotices.push(\n\t\t\t`${options.matchLimitReached} matches limit reached. Use limit=${options.matchLimitReached * 2} for more, or refine pattern`,\n\t\t);\n\t\tdetails.matchLimitReached = options.matchLimitReached;\n\t}\n\tif (packed.truncation.truncated) {\n\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t// Drop the duplicated bounded-preview text: it's already in the message's own\n\t\t// content, and re-including it here can push `details` past\n\t\t// MAX_RETAINED_TOOL_RESULT_DETAILS_BYTES (message-retention.ts), which replaces\n\t\t// the *entire* details object with a stub -- silently losing artifactId and every\n\t\t// other field alongside it. This is load-bearing beyond just the retention budget:\n\t\t// agent-session.ts's _releaseGcPackedArtifactReferences() reads artifactId back off\n\t\t// this same canonical message at eviction time (potentially many turns later), so\n\t\t// keeping `details` small here is what keeps that release path working at all. If\n\t\t// this field ever grows a large addition again, add a regression proving artifactId\n\t\t// survives compactToolResultDetailsForRetention (see\n\t\t// test/suite/agent-session-artifact-lifecycle.test.ts), not just a details-size check.\n\t\tdetails.truncation = { ...packed.truncation, content: \"\" };\n\t}\n\tif (options.linesTruncated) {\n\t\tnotices.push(`Some lines truncated to ${GREP_MAX_LINE_LENGTH} chars. Use read tool to see full lines`);\n\t\tdetails.linesTruncated = true;\n\t}\n\tif (options.matchLimitReached || packed.truncation.truncated) {\n\t\tconst note = broadQueryInvalidationNote(\n\t\t\toptions.broadQueryTracker,\n\t\t\tnormalizeBroadQueryKey({\n\t\t\t\ttoolName: \"grep\",\n\t\t\t\tpattern: options.pattern,\n\t\t\t\tpath: options.rawPath,\n\t\t\t\tglob: options.glob,\n\t\t\t}),\n\t\t\t`grep \"${options.pattern}\" in ${options.rawPath ?? \".\"}`,\n\t\t);\n\t\tif (note) {\n\t\t\tnotices.push(note);\n\t\t\tdetails.invalidationCandidate = true;\n\t\t}\n\t}\n\tif (notices.length > 0) output += `\\n\\n[${notices.join(\". \")}]`;\n\treturn { text: output, details };\n}\n\nfunction formatFffGrepResult(options: {\n\tresult: FffGrepResult;\n\tisDirectory: boolean;\n\tsearchPathRelativeToCwd: string;\n\teffectiveLimit: number;\n\tcontextValue: number;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\tpattern: string;\n\trawPath?: string;\n\tglob?: string;\n}): { text: string; details: GrepToolDetails } {\n\tif (options.result.items.length === 0) return { text: \"No matches found\", details: {} };\n\n\tconst outputLines: string[] = [];\n\tconst linesTruncated = { value: false };\n\tconst resultLimitReached =\n\t\toptions.result.items.length > options.effectiveLimit || Boolean(options.result.nextCursor);\n\tconst displayedMatches = resultLimitReached\n\t\t? options.result.items.slice(0, options.effectiveLimit)\n\t\t: options.result.items;\n\tlet currentPath = \"\";\n\tfor (const match of displayedMatches) {\n\t\tconst displayPath = fffDisplayPath(match, options);\n\t\tif (!displayPath) continue;\n\t\tif (displayPath !== currentPath) {\n\t\t\tcurrentPath = displayPath;\n\t\t\toutputLines.push(`${displayPath}:`);\n\t\t}\n\t\tappendFffMatchLines({\n\t\t\tmatch,\n\t\t\toutputLines,\n\t\t\tlinesTruncated,\n\t\t\tcontextValue: options.contextValue,\n\t\t});\n\t}\n\n\tif (outputLines.length === 0) return { text: \"No matches found\", details: {} };\n\tconst rawOutput = outputLines.join(\"\\n\");\n\treturn packGrepOutput({\n\t\trawOutput,\n\t\ttoolCallId: options.toolCallId,\n\t\tartifactStore: options.artifactStore,\n\t\tbroadQueryTracker: options.broadQueryTracker,\n\t\tpattern: options.pattern,\n\t\trawPath: options.rawPath,\n\t\tglob: options.glob,\n\t\tmatchLimitReached: resultLimitReached ? options.effectiveLimit : false,\n\t\tlinesTruncated: linesTruncated.value,\n\t});\n}\n\nexport async function tryFffGrep(options: {\n\tbackend: FffSearchBackend;\n\trouter: SearchRouter;\n\tcwd: string;\n\tsearchPath: string;\n\tpattern: string;\n\tglob?: string;\n\tignoreCase?: boolean;\n\tliteral?: boolean;\n\tcontextValue: number;\n\teffectiveLimit: number;\n\tisDirectory: boolean;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\trawPath?: string;\n}): Promise<{ text: string; details: GrepToolDetails } | undefined> {\n\t// Kick off the FFF finder -- and, on a machine where fff-node isn't provisioned\n\t// yet, its lazy managed install -- unconditionally and as early as possible.\n\t// See the matching comment in find.ts's tryFffFind: routing below can still\n\t// send THIS call to the rg fallback for reasons unrelated to tool availability\n\t// (chiefly the default match limit exceeding the FFF top-N threshold), and\n\t// that outcome must not gate the install itself. getFinder() is cached per\n\t// basePath, so later calls -- including the `await` below -- reuse this same\n\t// in-flight/resolved promise instead of doing the work twice. safeGetFinder()\n\t// guarantees this can never reject (a non-conforming custom backend that\n\t// throws synchronously still degrades to \"unavailable\"), so it can neither\n\t// produce an unhandled rejection nor fail this tool call outright.\n\tconst finderPromise = safeGetFinder(options.backend, options.cwd);\n\n\tconst searchPathRelativeToCwd = relativePathInside(options.cwd, options.searchPath);\n\tconst baseRoute = options.router.route({\n\t\ttool: \"grep\",\n\t\tglob: Boolean(options.glob),\n\t\tignoreCase: Boolean(options.ignoreCase),\n\t\tlimit: options.effectiveLimit,\n\t\tfinderAvailable: true,\n\t\tpathResolvable: searchPathRelativeToCwd !== undefined,\n\t\tgitignoreInTree: false,\n\t});\n\tif (baseRoute.backend !== \"fff\") return undefined;\n\tif (searchPathRelativeToCwd === undefined) return undefined;\n\n\tconst gitignoreInTree = options.isDirectory ? await hasGitignoreInTree(options.searchPath) : false;\n\tconst semanticRoute = options.router.route({\n\t\ttool: \"grep\",\n\t\tglob: Boolean(options.glob),\n\t\tignoreCase: Boolean(options.ignoreCase),\n\t\tlimit: options.effectiveLimit,\n\t\tfinderAvailable: true,\n\t\tpathResolvable: true,\n\t\tgitignoreInTree,\n\t});\n\tif (semanticRoute.backend !== \"fff\") return undefined;\n\n\tconst finder = await finderPromise;\n\tconst finderRoute = options.router.route({\n\t\ttool: \"grep\",\n\t\tglob: Boolean(options.glob),\n\t\tignoreCase: Boolean(options.ignoreCase),\n\t\tlimit: options.effectiveLimit,\n\t\tfinderAvailable: Boolean(finder),\n\t\tpathResolvable: true,\n\t\tgitignoreInTree: false,\n\t});\n\tif (!finder || finderRoute.backend !== \"fff\") return undefined;\n\n\tconst query = fffGrepQuery({\n\t\tpattern: options.pattern,\n\t\tglob: options.glob,\n\t\tisDirectory: options.isDirectory,\n\t\tsearchPathRelativeToCwd,\n\t});\n\tif (!query) return undefined;\n\n\tconst probeLimit = options.effectiveLimit + 1;\n\tconst result = finder.grep(query, {\n\t\tmode: options.literal ? \"plain\" : \"regex\",\n\t\tsmartCase: false,\n\t\tmaxMatchesPerFile: probeLimit,\n\t\tbeforeContext: options.contextValue,\n\t\tafterContext: options.contextValue,\n\t\tpageSize: probeLimit,\n\t});\n\tif (!result.ok || result.value.regexFallbackError) return undefined;\n\treturn formatFffGrepResult({\n\t\tresult: result.value,\n\t\tisDirectory: options.isDirectory,\n\t\tsearchPathRelativeToCwd,\n\t\teffectiveLimit: options.effectiveLimit,\n\t\tcontextValue: options.contextValue,\n\t\ttoolCallId: options.toolCallId,\n\t\tartifactStore: options.artifactStore,\n\t\tbroadQueryTracker: options.broadQueryTracker,\n\t\tpattern: options.pattern,\n\t\trawPath: options.rawPath,\n\t\tglob: options.glob,\n\t});\n}\n\nexport function createGrepToolDefinition(\n\tcwd: string,\n\toptions?: GrepToolOptions,\n): ToolDefinition<typeof grepSchema, GrepToolDetails | undefined> {\n\tconst customOps = options?.operations;\n\tconst fffBackend = options?.fff === false ? undefined : (options?.fff ?? defaultFffSearchBackend);\n\tconst searchRouter = options?.searchRouter ?? defaultSearchRouter;\n\tconst artifactStore = options?.artifactStore;\n\tconst broadQueryTracker = options?.broadQueryTracker;\n\treturn {\n\t\tname: \"grep\",\n\t\tlabel: \"grep\",\n\t\tdescription: `Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} matches or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Long lines are truncated to ${GREP_MAX_LINE_LENGTH} chars.`,\n\t\tpromptSnippet: \"Search file contents for patterns (respects .gitignore)\",\n\t\tpromptGuidelines: [\n\t\t\t\"Scope grep to the narrowest known root and glob; discover candidate paths first instead of repeatedly scanning an entire repository, home directory, or filesystem.\",\n\t\t],\n\t\tparameters: grepSchema,\n\t\ttoolGroup: \"explore\",\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\t{\n\t\t\t\tpattern,\n\t\t\t\tpath: searchDir,\n\t\t\t\tglob,\n\t\t\t\tignoreCase,\n\t\t\t\tliteral,\n\t\t\t\tcontext,\n\t\t\t\tlimit,\n\t\t\t}: {\n\t\t\t\tpattern: string;\n\t\t\t\tpath?: string;\n\t\t\t\tglob?: string;\n\t\t\t\tignoreCase?: boolean;\n\t\t\t\tliteral?: boolean;\n\t\t\t\tcontext?: number;\n\t\t\t\tlimit?: number;\n\t\t\t},\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet settled = false;\n\t\t\t\tconst settle = (fn: () => void) => {\n\t\t\t\t\tif (!settled) {\n\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\tfn();\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst ops = customOps ?? defaultGrepOperations;\n\t\t\t\t\t\tlet isDirectory: boolean;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tisDirectory = await ops.isDirectory(searchPath);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`Path not found: ${searchPath}`)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst contextValue = context && context > 0 ? context : 0;\n\t\t\t\t\t\tconst effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);\n\t\t\t\t\t\tconst formatPath = (filePath: string): string => {\n\t\t\t\t\t\t\tif (isDirectory) {\n\t\t\t\t\t\t\t\tconst relative = path.relative(searchPath, filePath);\n\t\t\t\t\t\t\t\tif (relative && !relative.startsWith(\"..\")) {\n\t\t\t\t\t\t\t\t\treturn relative.replace(/\\\\/g, \"/\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn path.basename(filePath);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (!customOps && fffBackend) {\n\t\t\t\t\t\t\tconst fffResult = await tryFffGrep({\n\t\t\t\t\t\t\t\tbackend: fffBackend,\n\t\t\t\t\t\t\t\trouter: searchRouter,\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\tsearchPath,\n\t\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\t\tglob,\n\t\t\t\t\t\t\t\tignoreCase,\n\t\t\t\t\t\t\t\tliteral,\n\t\t\t\t\t\t\t\tcontextValue,\n\t\t\t\t\t\t\t\teffectiveLimit,\n\t\t\t\t\t\t\t\tisDirectory,\n\t\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\t\tartifactStore,\n\t\t\t\t\t\t\t\tbroadQueryTracker,\n\t\t\t\t\t\t\t\trawPath: searchDir,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (fffResult) {\n\t\t\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: fffResult.text }],\n\t\t\t\t\t\t\t\t\t\tdetails: Object.keys(fffResult.details).length > 0 ? fffResult.details : undefined,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rgPath = await ensureTool(\"rg\", true);\n\t\t\t\t\t\tif (!rgPath) {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(\"ripgrep (rg) is not available and could not be downloaded\")));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fileCache = new Map<string, string[]>();\n\t\t\t\t\t\tconst getFileLines = async (filePath: string): Promise<string[]> => {\n\t\t\t\t\t\t\tlet lines = fileCache.get(filePath);\n\t\t\t\t\t\t\tif (!lines) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst content = await ops.readFile(filePath);\n\t\t\t\t\t\t\t\t\tlines = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\").split(\"\\n\");\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tlines = [];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfileCache.set(filePath, lines);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn lines;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst args: string[] = [\"--json\", \"--line-number\", \"--color=never\", \"--hidden\"];\n\t\t\t\t\t\tif (ignoreCase) args.push(\"--ignore-case\");\n\t\t\t\t\t\tif (literal) args.push(\"--fixed-strings\");\n\t\t\t\t\t\tif (glob) args.push(\"--glob\", glob);\n\t\t\t\t\t\targs.push(\"--\", pattern, searchPath);\n\n\t\t\t\t\t\tconst child = spawn(rgPath, args, {\n\t\t\t\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst rl = createInterface({ input: child.stdout });\n\t\t\t\t\t\tlet stderr = \"\";\n\t\t\t\t\t\tlet matchCount = 0;\n\t\t\t\t\t\tlet matchLimitReached = false;\n\t\t\t\t\t\tlet linesTruncated = false;\n\t\t\t\t\t\tlet aborted = false;\n\t\t\t\t\t\tlet killedDueToLimit = false;\n\t\t\t\t\t\tconst outputLines: string[] = [];\n\n\t\t\t\t\t\tconst terminationController = new AbortController();\n\t\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\t\trl.close();\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst stopChild = (dueToLimit = false) => {\n\t\t\t\t\t\t\tif (dueToLimit) killedDueToLimit = true;\n\t\t\t\t\t\t\tterminationController.abort();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\t\tstopChild();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (signal?.aborted) onAbort();\n\t\t\t\t\t\telse signal?.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tchild.stderr?.on(\"data\", (chunk) => {\n\t\t\t\t\t\t\tstderr += chunk.toString();\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst formatBlock = async (filePath: string, lineNumber: number): Promise<string[]> => {\n\t\t\t\t\t\t\tconst relativePath = formatPath(filePath);\n\t\t\t\t\t\t\tconst lines = await getFileLines(filePath);\n\t\t\t\t\t\t\tif (!lines.length) return [`${relativePath}:${lineNumber}: (unable to read file)`];\n\t\t\t\t\t\t\tconst block: string[] = [];\n\t\t\t\t\t\t\tconst start = contextValue > 0 ? Math.max(1, lineNumber - contextValue) : lineNumber;\n\t\t\t\t\t\t\tconst end = contextValue > 0 ? Math.min(lines.length, lineNumber + contextValue) : lineNumber;\n\t\t\t\t\t\t\tfor (let current = start; current <= end; current++) {\n\t\t\t\t\t\t\t\tconst lineText = lines[current - 1] ?? \"\";\n\t\t\t\t\t\t\t\tconst sanitized = lineText.replace(/\\r/g, \"\");\n\t\t\t\t\t\t\t\tconst isMatchLine = current === lineNumber;\n\t\t\t\t\t\t\t\t// Truncate long lines so grep output stays compact.\n\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\tif (isMatchLine) block.push(`${relativePath}:${current}: ${truncatedText}`);\n\t\t\t\t\t\t\t\telse block.push(`${relativePath}-${current}- ${truncatedText}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn block;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Collect matches during streaming, then format them after rg exits.\n\t\t\t\t\t\tconst matches: Array<{ filePath: string; lineNumber: number; lineText?: string }> = [];\n\t\t\t\t\t\trl.on(\"line\", (line) => {\n\t\t\t\t\t\t\tif (!line.trim() || matchLimitReached) return;\n\t\t\t\t\t\t\tlet event: any;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tevent = JSON.parse(line);\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (event.type === \"match\") {\n\t\t\t\t\t\t\t\tmatchCount++;\n\t\t\t\t\t\t\t\tif (matchCount > effectiveLimit) {\n\t\t\t\t\t\t\t\t\tmatchLimitReached = true;\n\t\t\t\t\t\t\t\t\tstopChild(true);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst filePath = event.data?.path?.text;\n\t\t\t\t\t\t\t\tconst lineNumber = event.data?.line_number;\n\t\t\t\t\t\t\t\tconst lineText = event.data?.lines?.text;\n\t\t\t\t\t\t\t\tif (filePath && typeof lineNumber === \"number\")\n\t\t\t\t\t\t\t\t\tmatches.push({ filePath, lineNumber, lineText });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst terminal = await waitForChildProcessWithTermination(child, {\n\t\t\t\t\t\t\tsignal: terminationController.signal,\n\t\t\t\t\t\t\ttimeoutMs: GREP_PROCESS_TIMEOUT_MS,\n\t\t\t\t\t\t\tkillGraceMs: GREP_PROCESS_KILL_GRACE_MS,\n\t\t\t\t\t\t}).finally(cleanup);\n\t\t\t\t\t\tconst code = terminal.code;\n\t\t\t\t\t\tif (terminal.reason === \"timeout\") {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`ripgrep timed out after ${GREP_PROCESS_TIMEOUT_MS}ms`)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (aborted) {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(\"Operation aborted\")));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!killedDueToLimit && code !== 0 && code !== 1) {\n\t\t\t\t\t\t\tconst errorMsg = stderr.trim() || `ripgrep exited with code ${code}`;\n\t\t\t\t\t\t\tsettle(() => reject(new Error(errorMsg)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (matchCount === 0) {\n\t\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"No matches found\" }], details: undefined }),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Format matches after streaming finishes so custom readFile() backends can be async.\n\t\t\t\t\t\tconst fileGroups = new Map<string, string[]>();\n\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\tconst relativePath = formatPath(match.filePath);\n\t\t\t\t\t\t\tif (!fileGroups.has(relativePath)) {\n\t\t\t\t\t\t\t\tfileGroups.set(relativePath, []);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst group = fileGroups.get(relativePath)!;\n\n\t\t\t\t\t\t\tif (contextValue === 0 && match.lineText !== undefined) {\n\t\t\t\t\t\t\t\tconst sanitized = match.lineText.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\").replace(/\\n$/, \"\");\n\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\tgroup.push(` ${match.lineNumber}: ${truncatedText}`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst block = await formatBlock(match.filePath, match.lineNumber);\n\t\t\t\t\t\t\t\tfor (const line of block) {\n\t\t\t\t\t\t\t\t\tif (line.startsWith(`${relativePath}:`)) {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line.slice(relativePath.length + 1)}`);\n\t\t\t\t\t\t\t\t\t} else if (line.startsWith(`${relativePath}-`)) {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line.slice(relativePath.length + 1)}`);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line}`);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const [relativePath, lines] of fileGroups) {\n\t\t\t\t\t\t\toutputLines.push(`${relativePath}:`);\n\t\t\t\t\t\t\tlet lastLine = \"\";\n\t\t\t\t\t\t\tfor (const line of lines) {\n\t\t\t\t\t\t\t\tif (line === lastLine) continue;\n\t\t\t\t\t\t\t\toutputLines.push(line);\n\t\t\t\t\t\t\t\tlastLine = line;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = outputLines.join(\"\\n\");\n\t\t\t\t\t\t// Measure -> pack (artifact-backed if oversized and a store was provided) -> notices.\n\t\t\t\t\t\t// There is no line limit here because the match limit already capped rows.\n\t\t\t\t\t\tconst { text: output, details } = packGrepOutput({\n\t\t\t\t\t\t\trawOutput,\n\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\tartifactStore,\n\t\t\t\t\t\t\tbroadQueryTracker,\n\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\trawPath: searchDir,\n\t\t\t\t\t\t\tglob,\n\t\t\t\t\t\t\tmatchLimitReached: matchLimitReached ? effectiveLimit : false,\n\t\t\t\t\t\t\tlinesTruncated,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tsettle(() => reject(err as Error));\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatGrepCall(args, theme, context.cwd));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatGrepResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createGrepTool(cwd: string, options?: GrepToolOptions): AgentTool<typeof grepSchema> {\n\treturn wrapToolDefinition(createGrepToolDefinition(cwd, options));\n}\n"]}
1
+ {"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EAEpB,YAAY,GACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC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AAC,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;oBAClE,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACd,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAY,CAAC,CAAC,CAAC;oBACpC,CAAC;gBACF,CAAC,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO;YAC9B,OAAO,mBAAmB,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7F,CAAC;QACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;YAC3C,OAAO,mBAAmB,CACzB,OAAO,CAAC,aAAa,EACrB,gBAAgB,CAAC,MAAgD,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CACtG,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB;IACpE,OAAO,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import { readFile as fsReadFile, stat as fsStat } from \"node:fs/promises\";\nimport { createInterface } from \"node:readline\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tformatSize,\n\tGREP_MAX_LINE_LENGTH,\n\ttype TruncationResult,\n\ttruncateLine,\n} from \"@caupulican/pi-agent-core/node\";\nimport { spawn } from \"child_process\";\nimport path from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { waitForChildProcessWithTermination } from \"../../utils/child-process.ts\";\nimport { ensureTool } from \"../../utils/tools-manager.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport {\n\ttype BroadQueryTracker,\n\tbroadQueryInvalidationNote,\n\tformatArtifactNotice,\n\tnormalizeBroadQueryKey,\n\tpackToolOutput,\n} from \"../context/tool-output-packer.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport {\n\ttype FffGrepMatch,\n\ttype FffGrepResult,\n\ttype FffSearchBackend,\n\thasGitignoreInTree,\n\tresolveRoutedFffFinder,\n} from \"./fff-search-backend.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\nimport {\n\tformatCollapsibleToolResult,\n\tinvalidArgText,\n\trenderTextComponent,\n\tshortenPath,\n\tstr,\n\ttoolTextResult,\n} from \"./render-utils.ts\";\nimport type { SearchRouter } from \"./search-router.ts\";\nimport { resolveSearchToolRuntime } from \"./search-tool-runtime.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst grepSchema = Type.Object({\n\tpattern: Type.String({ description: \"Search pattern (regex or literal string)\" }),\n\tpath: Type.Optional(Type.String({ description: \"Directory or file to search (default: current directory)\" })),\n\tglob: Type.Optional(Type.String({ description: \"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'\" })),\n\tignoreCase: Type.Optional(Type.Boolean({ description: \"Case-insensitive search (default: false)\" })),\n\tliteral: Type.Optional(\n\t\tType.Boolean({ description: \"Treat pattern as literal string instead of regex (default: false)\" }),\n\t),\n\tcontext: Type.Optional(\n\t\tType.Number({ description: \"Number of lines to show before and after each match (default: 0)\" }),\n\t),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of matches to return (default: 100)\" })),\n});\n\nexport type GrepToolInput = Static<typeof grepSchema>;\nconst DEFAULT_LIMIT = 100;\nconst GREP_PROCESS_TIMEOUT_MS = 5 * 60_000;\nconst GREP_PROCESS_KILL_GRACE_MS = 1_000;\n\nexport interface GrepToolDetails {\n\ttruncation?: TruncationResult;\n\tmatchLimitReached?: number;\n\tlinesTruncated?: boolean;\n\t/** Set only when output was packed to an artifact; see tool-output-packer.ts. */\n\tartifactId?: string;\n\t/** Set when this exact query has repeatedly produced broad/truncated results. */\n\tinvalidationCandidate?: boolean;\n}\n\n/**\n * Pluggable operations for the grep tool.\n * Override these to delegate search to remote systems (for example SSH).\n */\nexport interface GrepOperations {\n\t/** Check if path is a directory. Throws if path does not exist. */\n\tisDirectory: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Read file contents for context lines */\n\treadFile: (absolutePath: string) => Promise<string> | string;\n}\n\nconst defaultGrepOperations: GrepOperations = {\n\tisDirectory: async (p) => (await fsStat(p)).isDirectory(),\n\treadFile: (p) => fsReadFile(p, \"utf-8\"),\n};\n\nexport interface GrepToolOptions {\n\t/** Custom operations for grep. Default: local filesystem plus routed FFF/rg search */\n\toperations?: GrepOperations;\n\t/** FFF backend for resident indexed search. Set false to force ripgrep fallback. */\n\tfff?: FffSearchBackend | false;\n\t/** Pure router that selects FFF or rg from request filters and environment facts. */\n\tsearchRouter?: SearchRouter;\n\t/**\n\t * Opt-in artifact store for first-capture-then-bound output packing (Phase 3). When\n\t * omitted (the default), behavior is byte-for-byte unchanged from before this option\n\t * existed: output is truncated the same way, just never artifact-backed.\n\t */\n\tartifactStore?: ArtifactStore;\n\t/** Opt-in tracker for repeated-broad-query \"do not repeat\" signals. Also default-off. */\n\tbroadQueryTracker?: BroadQueryTracker;\n}\n\nfunction formatGrepCall(\n\targs: { pattern: string; path?: string; glob?: string; limit?: number } | undefined,\n\ttheme: Theme,\n\tcwd: string,\n): string {\n\tconst pattern = str(args?.pattern);\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\", cwd) : null;\n\tconst glob = str(args?.glob);\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"grep\")) +\n\t\t\" \" +\n\t\t(pattern === null ? invalidArg : theme.fg(\"accent\", `/${pattern || \"\"}/`)) +\n\t\ttheme.fg(\"toolOutput\", ` in ${path === null ? invalidArg : path}`);\n\tif (glob) text += theme.fg(\"toolOutput\", ` (${glob})`);\n\tif (limit !== undefined) text += theme.fg(\"toolOutput\", ` limit ${limit}`);\n\treturn text;\n}\n\nfunction formatGrepResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: GrepToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\treturn formatCollapsibleToolResult({\n\t\tresult,\n\t\toptions,\n\t\ttheme,\n\t\tshowImages,\n\t\tcollapsedLineLimit: 15,\n\t\twarnings: (details) => {\n\t\t\tconst warnings: string[] = [];\n\t\t\tif (details?.matchLimitReached) warnings.push(`${details.matchLimitReached} matches limit`);\n\t\t\tif (details?.truncation?.truncated) {\n\t\t\t\twarnings.push(`${formatSize(details.truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\t\t}\n\t\t\tif (details?.linesTruncated) warnings.push(\"some lines truncated\");\n\t\t\treturn warnings;\n\t\t},\n\t});\n}\n\nfunction globConstraintForFff(glob: string | undefined): string {\n\tif (!glob) return \"\";\n\tif (glob.includes(\"/\") || glob.startsWith(\"**/\")) return glob;\n\treturn `**/${glob}`;\n}\n\nfunction fffGrepQuery(options: {\n\tpattern: string;\n\tglob?: string;\n\tisDirectory: boolean;\n\tsearchPathRelativeToCwd: string;\n}): string | undefined {\n\tconst parts: string[] = [];\n\tif (options.searchPathRelativeToCwd) {\n\t\tparts.push(options.isDirectory ? `${options.searchPathRelativeToCwd}/` : options.searchPathRelativeToCwd);\n\t}\n\tparts.push(globConstraintForFff(options.glob));\n\tparts.push(options.pattern);\n\treturn parts.filter(Boolean).join(\" \");\n}\n\nfunction fffDisplayPath(\n\tmatch: FffGrepMatch,\n\toptions: { isDirectory: boolean; searchPathRelativeToCwd: string },\n): string | undefined {\n\tconst relativePath = match.relativePath.replaceAll(\"\\\\\", \"/\");\n\tif (!options.searchPathRelativeToCwd) return relativePath;\n\tif (!options.isDirectory) {\n\t\treturn relativePath === options.searchPathRelativeToCwd ? path.posix.basename(relativePath) : undefined;\n\t}\n\tconst prefix = `${options.searchPathRelativeToCwd}/`;\n\tif (!relativePath.startsWith(prefix)) return undefined;\n\treturn relativePath.slice(prefix.length);\n}\n\nfunction appendFffMatchLines(options: {\n\tmatch: FffGrepMatch;\n\toutputLines: string[];\n\tlinesTruncated: { value: boolean };\n\tcontextValue: number;\n}): void {\n\tconst before = options.match.contextBefore ?? [];\n\tfor (let i = 0; i < before.length; i++) {\n\t\tconst lineNumber = options.match.lineNumber - before.length + i;\n\t\tconst { text, wasTruncated } = truncateLine(before[i] ?? \"\");\n\t\tif (wasTruncated) options.linesTruncated.value = true;\n\t\toptions.outputLines.push(` ${lineNumber}- ${text}`);\n\t}\n\n\tconst { text, wasTruncated } = truncateLine(options.match.lineContent.replace(/\\r/g, \"\"));\n\tif (wasTruncated) options.linesTruncated.value = true;\n\toptions.outputLines.push(` ${options.match.lineNumber}: ${text}`);\n\n\tif (options.contextValue === 0) return;\n\tconst after = options.match.contextAfter ?? [];\n\tfor (let i = 0; i < after.length; i++) {\n\t\tconst lineNumber = options.match.lineNumber + 1 + i;\n\t\tconst { text: contextText, wasTruncated: contextWasTruncated } = truncateLine(after[i] ?? \"\");\n\t\tif (contextWasTruncated) options.linesTruncated.value = true;\n\t\toptions.outputLines.push(` ${lineNumber}- ${contextText}`);\n\t}\n}\n\n/**\n * Shared \"measure -> pack -> notices\" tail for both the FFF and ripgrep result paths:\n * first-capture the raw output to an artifact if it's oversized and a store was provided\n * (Phase 3 tool-output-artifacts.md boundary rule), then append the same match-limit/\n * byte-limit/line-truncation/broad-query notices either path already produced.\n */\nfunction packGrepOutput(options: {\n\trawOutput: string;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\tpattern: string;\n\trawPath?: string;\n\tglob?: string;\n\tmatchLimitReached: number | false;\n\tlinesTruncated: boolean;\n}): { text: string; details: GrepToolDetails } {\n\tconst packed = packToolOutput(\n\t\t{\n\t\t\ttoolName: \"grep\",\n\t\t\tpath: options.rawPath,\n\t\t\trawContent: options.rawOutput,\n\t\t\t// No line limit here because the match limit already caps rows; only the byte\n\t\t\t// cap should apply, matching the pre-Slice-B truncateHead call exactly.\n\t\t\ttruncation: { maxLines: Number.MAX_SAFE_INTEGER },\n\t\t},\n\t\toptions.artifactStore,\n\t\toptions.toolCallId,\n\t);\n\tlet output = packed.content;\n\tconst details: GrepToolDetails = {};\n\n\tconst notices: string[] = [];\n\tif (packed.artifactId) {\n\t\tnotices.push(formatArtifactNotice(packed.artifactId));\n\t\tdetails.artifactId = packed.artifactId;\n\t}\n\tif (options.matchLimitReached) {\n\t\tnotices.push(\n\t\t\t`${options.matchLimitReached} matches limit reached. Use limit=${options.matchLimitReached * 2} for more, or refine pattern`,\n\t\t);\n\t\tdetails.matchLimitReached = options.matchLimitReached;\n\t}\n\tif (packed.truncation.truncated) {\n\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t// Drop the duplicated bounded-preview text: it's already in the message's own\n\t\t// content, and re-including it here can push `details` past\n\t\t// MAX_RETAINED_TOOL_RESULT_DETAILS_BYTES (message-retention.ts), which replaces\n\t\t// the *entire* details object with a stub -- silently losing artifactId and every\n\t\t// other field alongside it. This is load-bearing beyond just the retention budget:\n\t\t// agent-session.ts's _releaseGcPackedArtifactReferences() reads artifactId back off\n\t\t// this same canonical message at eviction time (potentially many turns later), so\n\t\t// keeping `details` small here is what keeps that release path working at all. If\n\t\t// this field ever grows a large addition again, add a regression proving artifactId\n\t\t// survives compactToolResultDetailsForRetention (see\n\t\t// test/suite/agent-session-artifact-lifecycle.test.ts), not just a details-size check.\n\t\tdetails.truncation = { ...packed.truncation, content: \"\" };\n\t}\n\tif (options.linesTruncated) {\n\t\tnotices.push(`Some lines truncated to ${GREP_MAX_LINE_LENGTH} chars. Use read tool to see full lines`);\n\t\tdetails.linesTruncated = true;\n\t}\n\tif (options.matchLimitReached || packed.truncation.truncated) {\n\t\tconst note = broadQueryInvalidationNote(\n\t\t\toptions.broadQueryTracker,\n\t\t\tnormalizeBroadQueryKey({\n\t\t\t\ttoolName: \"grep\",\n\t\t\t\tpattern: options.pattern,\n\t\t\t\tpath: options.rawPath,\n\t\t\t\tglob: options.glob,\n\t\t\t}),\n\t\t\t`grep \"${options.pattern}\" in ${options.rawPath ?? \".\"}`,\n\t\t);\n\t\tif (note) {\n\t\t\tnotices.push(note);\n\t\t\tdetails.invalidationCandidate = true;\n\t\t}\n\t}\n\tif (notices.length > 0) output += `\\n\\n[${notices.join(\". \")}]`;\n\treturn { text: output, details };\n}\n\nfunction formatFffGrepResult(options: {\n\tresult: FffGrepResult;\n\tisDirectory: boolean;\n\tsearchPathRelativeToCwd: string;\n\teffectiveLimit: number;\n\tcontextValue: number;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\tpattern: string;\n\trawPath?: string;\n\tglob?: string;\n}): { text: string; details: GrepToolDetails } {\n\tif (options.result.items.length === 0) return { text: \"No matches found\", details: {} };\n\n\tconst outputLines: string[] = [];\n\tconst linesTruncated = { value: false };\n\tconst resultLimitReached =\n\t\toptions.result.items.length > options.effectiveLimit || Boolean(options.result.nextCursor);\n\tconst displayedMatches = resultLimitReached\n\t\t? options.result.items.slice(0, options.effectiveLimit)\n\t\t: options.result.items;\n\tlet currentPath = \"\";\n\tfor (const match of displayedMatches) {\n\t\tconst displayPath = fffDisplayPath(match, options);\n\t\tif (!displayPath) continue;\n\t\tif (displayPath !== currentPath) {\n\t\t\tcurrentPath = displayPath;\n\t\t\toutputLines.push(`${displayPath}:`);\n\t\t}\n\t\tappendFffMatchLines({\n\t\t\tmatch,\n\t\t\toutputLines,\n\t\t\tlinesTruncated,\n\t\t\tcontextValue: options.contextValue,\n\t\t});\n\t}\n\n\tif (outputLines.length === 0) return { text: \"No matches found\", details: {} };\n\tconst rawOutput = outputLines.join(\"\\n\");\n\treturn packGrepOutput({\n\t\trawOutput,\n\t\ttoolCallId: options.toolCallId,\n\t\tartifactStore: options.artifactStore,\n\t\tbroadQueryTracker: options.broadQueryTracker,\n\t\tpattern: options.pattern,\n\t\trawPath: options.rawPath,\n\t\tglob: options.glob,\n\t\tmatchLimitReached: resultLimitReached ? options.effectiveLimit : false,\n\t\tlinesTruncated: linesTruncated.value,\n\t});\n}\n\nexport async function tryFffGrep(options: {\n\tbackend: FffSearchBackend;\n\trouter: SearchRouter;\n\tcwd: string;\n\tsearchPath: string;\n\tpattern: string;\n\tglob?: string;\n\tignoreCase?: boolean;\n\tliteral?: boolean;\n\tcontextValue: number;\n\teffectiveLimit: number;\n\tisDirectory: boolean;\n\ttoolCallId: string;\n\tartifactStore?: ArtifactStore;\n\tbroadQueryTracker?: BroadQueryTracker;\n\trawPath?: string;\n}): Promise<{ text: string; details: GrepToolDetails } | undefined> {\n\tconst routed = await resolveRoutedFffFinder({\n\t\tbackend: options.backend,\n\t\trouter: options.router,\n\t\ttool: \"grep\",\n\t\tcwd: options.cwd,\n\t\tsearchPath: options.searchPath,\n\t\tglob: Boolean(options.glob),\n\t\tignoreCase: Boolean(options.ignoreCase),\n\t\tlimit: options.effectiveLimit,\n\t\treadGitignoreInTree: () => (options.isDirectory ? hasGitignoreInTree(options.searchPath) : false),\n\t});\n\tif (!routed) return undefined;\n\tconst { finder, searchPathRelativeToCwd } = routed;\n\n\tconst query = fffGrepQuery({\n\t\tpattern: options.pattern,\n\t\tglob: options.glob,\n\t\tisDirectory: options.isDirectory,\n\t\tsearchPathRelativeToCwd,\n\t});\n\tif (!query) return undefined;\n\n\tconst probeLimit = options.effectiveLimit + 1;\n\tconst result = finder.grep(query, {\n\t\tmode: options.literal ? \"plain\" : \"regex\",\n\t\tsmartCase: false,\n\t\tmaxMatchesPerFile: probeLimit,\n\t\tbeforeContext: options.contextValue,\n\t\tafterContext: options.contextValue,\n\t\tpageSize: probeLimit,\n\t});\n\tif (!result.ok || result.value.regexFallbackError) return undefined;\n\treturn formatFffGrepResult({\n\t\tresult: result.value,\n\t\tisDirectory: options.isDirectory,\n\t\tsearchPathRelativeToCwd,\n\t\teffectiveLimit: options.effectiveLimit,\n\t\tcontextValue: options.contextValue,\n\t\ttoolCallId: options.toolCallId,\n\t\tartifactStore: options.artifactStore,\n\t\tbroadQueryTracker: options.broadQueryTracker,\n\t\tpattern: options.pattern,\n\t\trawPath: options.rawPath,\n\t\tglob: options.glob,\n\t});\n}\n\nexport function createGrepToolDefinition(\n\tcwd: string,\n\toptions?: GrepToolOptions,\n): ToolDefinition<typeof grepSchema, GrepToolDetails | undefined> {\n\tconst search = resolveSearchToolRuntime(options);\n\treturn {\n\t\tname: \"grep\",\n\t\tlabel: \"grep\",\n\t\tdescription: `Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} matches or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Long lines are truncated to ${GREP_MAX_LINE_LENGTH} chars.`,\n\t\tpromptSnippet: \"Search file contents for patterns (respects .gitignore)\",\n\t\tpromptGuidelines: [\n\t\t\t\"Scope grep to the narrowest known root and glob; discover candidate paths first instead of repeatedly scanning an entire repository, home directory, or filesystem.\",\n\t\t],\n\t\tparameters: grepSchema,\n\t\ttoolGroup: \"explore\",\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\t{\n\t\t\t\tpattern,\n\t\t\t\tpath: searchDir,\n\t\t\t\tglob,\n\t\t\t\tignoreCase,\n\t\t\t\tliteral,\n\t\t\t\tcontext,\n\t\t\t\tlimit,\n\t\t\t}: {\n\t\t\t\tpattern: string;\n\t\t\t\tpath?: string;\n\t\t\t\tglob?: string;\n\t\t\t\tignoreCase?: boolean;\n\t\t\t\tliteral?: boolean;\n\t\t\t\tcontext?: number;\n\t\t\t\tlimit?: number;\n\t\t\t},\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet settled = false;\n\t\t\t\tconst settle = (fn: () => void) => {\n\t\t\t\t\tif (!settled) {\n\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\tfn();\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst ops = search.operations ?? defaultGrepOperations;\n\t\t\t\t\t\tlet isDirectory: boolean;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tisDirectory = await ops.isDirectory(searchPath);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`Path not found: ${searchPath}`)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst contextValue = context && context > 0 ? context : 0;\n\t\t\t\t\t\tconst effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);\n\t\t\t\t\t\tconst formatPath = (filePath: string): string => {\n\t\t\t\t\t\t\tif (isDirectory) {\n\t\t\t\t\t\t\t\tconst relative = path.relative(searchPath, filePath);\n\t\t\t\t\t\t\t\tif (relative && !relative.startsWith(\"..\")) {\n\t\t\t\t\t\t\t\t\treturn relative.replace(/\\\\/g, \"/\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn path.basename(filePath);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (!search.operations && search.fffBackend) {\n\t\t\t\t\t\t\tconst fffResult = await tryFffGrep({\n\t\t\t\t\t\t\t\tbackend: search.fffBackend,\n\t\t\t\t\t\t\t\trouter: search.searchRouter,\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\tsearchPath,\n\t\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\t\tglob,\n\t\t\t\t\t\t\t\tignoreCase,\n\t\t\t\t\t\t\t\tliteral,\n\t\t\t\t\t\t\t\tcontextValue,\n\t\t\t\t\t\t\t\teffectiveLimit,\n\t\t\t\t\t\t\t\tisDirectory,\n\t\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\t\tartifactStore: search.artifactStore,\n\t\t\t\t\t\t\t\tbroadQueryTracker: search.broadQueryTracker,\n\t\t\t\t\t\t\t\trawPath: searchDir,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (fffResult) {\n\t\t\t\t\t\t\t\tsettle(() => resolve(toolTextResult(fffResult)));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rgPath = await ensureTool(\"rg\", true);\n\t\t\t\t\t\tif (!rgPath) {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(\"ripgrep (rg) is not available and could not be downloaded\")));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fileCache = new Map<string, string[]>();\n\t\t\t\t\t\tconst getFileLines = async (filePath: string): Promise<string[]> => {\n\t\t\t\t\t\t\tlet lines = fileCache.get(filePath);\n\t\t\t\t\t\t\tif (!lines) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst content = await ops.readFile(filePath);\n\t\t\t\t\t\t\t\t\tlines = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\").split(\"\\n\");\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tlines = [];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfileCache.set(filePath, lines);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn lines;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst args: string[] = [\"--json\", \"--line-number\", \"--color=never\", \"--hidden\"];\n\t\t\t\t\t\tif (ignoreCase) args.push(\"--ignore-case\");\n\t\t\t\t\t\tif (literal) args.push(\"--fixed-strings\");\n\t\t\t\t\t\tif (glob) args.push(\"--glob\", glob);\n\t\t\t\t\t\targs.push(\"--\", pattern, searchPath);\n\n\t\t\t\t\t\tconst child = spawn(rgPath, args, {\n\t\t\t\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst rl = createInterface({ input: child.stdout });\n\t\t\t\t\t\tlet stderr = \"\";\n\t\t\t\t\t\tlet matchCount = 0;\n\t\t\t\t\t\tlet matchLimitReached = false;\n\t\t\t\t\t\tlet linesTruncated = false;\n\t\t\t\t\t\tlet aborted = false;\n\t\t\t\t\t\tlet killedDueToLimit = false;\n\t\t\t\t\t\tconst outputLines: string[] = [];\n\n\t\t\t\t\t\tconst terminationController = new AbortController();\n\t\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\t\trl.close();\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst stopChild = (dueToLimit = false) => {\n\t\t\t\t\t\t\tif (dueToLimit) killedDueToLimit = true;\n\t\t\t\t\t\t\tterminationController.abort();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\t\tstopChild();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (signal?.aborted) onAbort();\n\t\t\t\t\t\telse signal?.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tchild.stderr?.on(\"data\", (chunk) => {\n\t\t\t\t\t\t\tstderr += chunk.toString();\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst formatBlock = async (filePath: string, lineNumber: number): Promise<string[]> => {\n\t\t\t\t\t\t\tconst relativePath = formatPath(filePath);\n\t\t\t\t\t\t\tconst lines = await getFileLines(filePath);\n\t\t\t\t\t\t\tif (!lines.length) return [`${relativePath}:${lineNumber}: (unable to read file)`];\n\t\t\t\t\t\t\tconst block: string[] = [];\n\t\t\t\t\t\t\tconst start = contextValue > 0 ? Math.max(1, lineNumber - contextValue) : lineNumber;\n\t\t\t\t\t\t\tconst end = contextValue > 0 ? Math.min(lines.length, lineNumber + contextValue) : lineNumber;\n\t\t\t\t\t\t\tfor (let current = start; current <= end; current++) {\n\t\t\t\t\t\t\t\tconst lineText = lines[current - 1] ?? \"\";\n\t\t\t\t\t\t\t\tconst sanitized = lineText.replace(/\\r/g, \"\");\n\t\t\t\t\t\t\t\tconst isMatchLine = current === lineNumber;\n\t\t\t\t\t\t\t\t// Truncate long lines so grep output stays compact.\n\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\tif (isMatchLine) block.push(`${relativePath}:${current}: ${truncatedText}`);\n\t\t\t\t\t\t\t\telse block.push(`${relativePath}-${current}- ${truncatedText}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn block;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Collect matches during streaming, then format them after rg exits.\n\t\t\t\t\t\tconst matches: Array<{ filePath: string; lineNumber: number; lineText?: string }> = [];\n\t\t\t\t\t\trl.on(\"line\", (line) => {\n\t\t\t\t\t\t\tif (!line.trim() || matchLimitReached) return;\n\t\t\t\t\t\t\tlet event: any;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tevent = JSON.parse(line);\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (event.type === \"match\") {\n\t\t\t\t\t\t\t\tmatchCount++;\n\t\t\t\t\t\t\t\tif (matchCount > effectiveLimit) {\n\t\t\t\t\t\t\t\t\tmatchLimitReached = true;\n\t\t\t\t\t\t\t\t\tstopChild(true);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst filePath = event.data?.path?.text;\n\t\t\t\t\t\t\t\tconst lineNumber = event.data?.line_number;\n\t\t\t\t\t\t\t\tconst lineText = event.data?.lines?.text;\n\t\t\t\t\t\t\t\tif (filePath && typeof lineNumber === \"number\")\n\t\t\t\t\t\t\t\t\tmatches.push({ filePath, lineNumber, lineText });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst terminal = await waitForChildProcessWithTermination(child, {\n\t\t\t\t\t\t\tsignal: terminationController.signal,\n\t\t\t\t\t\t\ttimeoutMs: GREP_PROCESS_TIMEOUT_MS,\n\t\t\t\t\t\t\tkillGraceMs: GREP_PROCESS_KILL_GRACE_MS,\n\t\t\t\t\t\t}).finally(cleanup);\n\t\t\t\t\t\tconst code = terminal.code;\n\t\t\t\t\t\tif (terminal.reason === \"timeout\") {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`ripgrep timed out after ${GREP_PROCESS_TIMEOUT_MS}ms`)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (aborted) {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(\"Operation aborted\")));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!killedDueToLimit && code !== 0 && code !== 1) {\n\t\t\t\t\t\t\tconst errorMsg = stderr.trim() || `ripgrep exited with code ${code}`;\n\t\t\t\t\t\t\tsettle(() => reject(new Error(errorMsg)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (matchCount === 0) {\n\t\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"No matches found\" }], details: undefined }),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Format matches after streaming finishes so custom readFile() backends can be async.\n\t\t\t\t\t\tconst fileGroups = new Map<string, string[]>();\n\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\tconst relativePath = formatPath(match.filePath);\n\t\t\t\t\t\t\tif (!fileGroups.has(relativePath)) {\n\t\t\t\t\t\t\t\tfileGroups.set(relativePath, []);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst group = fileGroups.get(relativePath)!;\n\n\t\t\t\t\t\t\tif (contextValue === 0 && match.lineText !== undefined) {\n\t\t\t\t\t\t\t\tconst sanitized = match.lineText.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\").replace(/\\n$/, \"\");\n\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\tgroup.push(` ${match.lineNumber}: ${truncatedText}`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst block = await formatBlock(match.filePath, match.lineNumber);\n\t\t\t\t\t\t\t\tfor (const line of block) {\n\t\t\t\t\t\t\t\t\tif (line.startsWith(`${relativePath}:`)) {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line.slice(relativePath.length + 1)}`);\n\t\t\t\t\t\t\t\t\t} else if (line.startsWith(`${relativePath}-`)) {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line.slice(relativePath.length + 1)}`);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tgroup.push(` ${line}`);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const [relativePath, lines] of fileGroups) {\n\t\t\t\t\t\t\toutputLines.push(`${relativePath}:`);\n\t\t\t\t\t\t\tlet lastLine = \"\";\n\t\t\t\t\t\t\tfor (const line of lines) {\n\t\t\t\t\t\t\t\tif (line === lastLine) continue;\n\t\t\t\t\t\t\t\toutputLines.push(line);\n\t\t\t\t\t\t\t\tlastLine = line;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = outputLines.join(\"\\n\");\n\t\t\t\t\t\t// Measure -> pack (artifact-backed if oversized and a store was provided) -> notices.\n\t\t\t\t\t\t// There is no line limit here because the match limit already capped rows.\n\t\t\t\t\t\tconst { text: output, details } = packGrepOutput({\n\t\t\t\t\t\t\trawOutput,\n\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\tartifactStore: search.artifactStore,\n\t\t\t\t\t\t\tbroadQueryTracker: search.broadQueryTracker,\n\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\trawPath: searchDir,\n\t\t\t\t\t\t\tglob,\n\t\t\t\t\t\t\tmatchLimitReached: matchLimitReached ? effectiveLimit : false,\n\t\t\t\t\t\t\tlinesTruncated,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsettle(() => resolve(toolTextResult({ text: output, details })));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tsettle(() => reject(err as Error));\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\treturn renderTextComponent(context.lastComponent, formatGrepCall(args, theme, context.cwd));\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\treturn renderTextComponent(\n\t\t\t\tcontext.lastComponent,\n\t\t\t\tformatGrepResult(result as Parameters<typeof formatGrepResult>[0], options, theme, context.showImages),\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createGrepTool(cwd: string, options?: GrepToolOptions): AgentTool<typeof grepSchema> {\n\treturn wrapToolDefinition(createGrepToolDefinition(cwd, options));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,0BAA0B,EAC1B,oCAAoC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,gCAAgC,EAChC,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB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AAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO/E;AAED,wBAAgB,cAAc,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,EACtB,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAgBjC","sourcesContent":["export {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"@caupulican/pi-agent-core/node\";\nexport {\n\ttype ArtifactRetrieveToolDetails,\n\ttype ArtifactRetrieveToolInput,\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPlatformShellOperations,\n\tcreateLocalPowerShellOperations,\n} from \"./bash.ts\";\nexport {\n\tCONTEXT_SCOUT_GUIDANCE,\n\ttype ContextScoutToolDependencies,\n\ttype ContextScoutToolDetails,\n\ttype ContextScoutToolInput,\n\tcreateContextScoutToolDefinition,\n\tformatScoutResult,\n} from \"./context-scout.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreatePythonTool,\n\tcreatePythonToolDefinition,\n\tDEFAULT_PYTHON_TIMEOUT_SECONDS,\n\tMAX_PYTHON_OUTPUT_BYTES,\n\tMAX_PYTHON_TIMEOUT_SECONDS,\n\ttype PythonExecutionRequest,\n\ttype PythonExecutionResult,\n\ttype PythonOperations,\n\ttype PythonToolDetails,\n\ttype PythonToolInput,\n\ttype PythonToolOptions,\n\tresolvePythonToolPath,\n} from \"./python.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSecretStoreToolDefinition,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n} from \"./secret-store.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createPythonTool, createPythonToolDefinition, type PythonToolOptions } from \"./python.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"python\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\"\n\t| \"artifact_retrieve\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"python\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n\t\"artifact_retrieve\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tpython?: PythonToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n\tartifact_retrieve?: ArtifactRetrieveToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonToolDefinition(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonTool(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveTool(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): ToolDef[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, bashOptions),\n\t\tcreatePythonToolDefinition(cwd, options?.python),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, ToolDef>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, bashOptions),\n\t\tpython: createPythonToolDefinition(cwd, options?.python),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),\n\t};\n}\n\nexport function createCodingTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Tool[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, bashOptions),\n\t\tcreatePythonTool(cwd, options?.python),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, Tool>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, bashOptions),\n\t\tpython: createPythonTool(cwd, options?.python),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),\n\t};\n}\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,0BAA0B,EAC1B,oCAAoC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,gCAAgC,EAChC,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,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I,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,EAAE,EAAE,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;QAClC,WAAW,EAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC;QAC5D,QAAQ,EAAE,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC;QACpD,YAAY,EAAE,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC;QAChE,iBAAiB,EAAE,0BAA0B,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,CAAC;KAC9E,CAAC;AAAA,CACF","sourcesContent":["export {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"@caupulican/pi-agent-core/node\";\nexport {\n\ttype ArtifactRetrieveToolDetails,\n\ttype ArtifactRetrieveToolInput,\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPlatformShellOperations,\n\tcreateLocalPowerShellOperations,\n} from \"./bash.ts\";\nexport {\n\tCONTEXT_SCOUT_GUIDANCE,\n\ttype ContextScoutToolDependencies,\n\ttype ContextScoutToolDetails,\n\ttype ContextScoutToolInput,\n\tcreateContextScoutToolDefinition,\n\tformatScoutResult,\n} from \"./context-scout.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreatePythonTool,\n\tcreatePythonToolDefinition,\n\tDEFAULT_PYTHON_TIMEOUT_SECONDS,\n\tMAX_PYTHON_OUTPUT_BYTES,\n\tMAX_PYTHON_TIMEOUT_SECONDS,\n\ttype PythonExecutionRequest,\n\ttype PythonExecutionResult,\n\ttype PythonOperations,\n\ttype PythonToolDetails,\n\ttype PythonToolInput,\n\ttype PythonToolOptions,\n\tresolvePythonToolPath,\n} from \"./python.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSecretStoreToolDefinition,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n} from \"./secret-store.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createPythonTool, createPythonToolDefinition, type PythonToolOptions } from \"./python.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"python\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\"\n\t| \"artifact_retrieve\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"python\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n\t\"artifact_retrieve\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tpython?: PythonToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n\tartifact_retrieve?: ArtifactRetrieveToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonToolDefinition(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonTool(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveTool(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): ToolDef[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, bashOptions),\n\t\tcreatePythonToolDefinition(cwd, options?.python),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, ToolDef>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, bashOptions),\n\t\tpython: createPythonToolDefinition(cwd, options?.python),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),\n\t};\n}\n\nexport function createCodingTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Tool[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, bashOptions),\n\t\tcreatePythonTool(cwd, options?.python),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, Tool>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, bashOptions),\n\t\tpython: createPythonTool(cwd, options?.python),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),\n\t};\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAGV,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAIN,0BAA0B,EAC1B,oCAAoC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAON,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EAItB,gCAAgC,EAChC,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,gCAAgC,GAKhC,MAAM,mBAAmB,CAAC;AAC3B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,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;QAClC,WAAW,EAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC;QAC5D,QAAQ,EAAE,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC;QACpD,YAAY,EAAE,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC;QAChE,iBAAiB,EAAE,0BAA0B,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,CAAC;KAC9E,CAAC;AACH,CAAC","sourcesContent":["export {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"@caupulican/pi-agent-core/node\";\nexport {\n\ttype ArtifactRetrieveToolDetails,\n\ttype ArtifactRetrieveToolInput,\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPlatformShellOperations,\n\tcreateLocalPowerShellOperations,\n} from \"./bash.ts\";\nexport {\n\tCONTEXT_SCOUT_GUIDANCE,\n\ttype ContextScoutToolDependencies,\n\ttype ContextScoutToolDetails,\n\ttype ContextScoutToolInput,\n\tcreateContextScoutToolDefinition,\n\tformatScoutResult,\n} from \"./context-scout.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyInput,\n\ttype ExtensionifyReport,\n\ttype ExtensionifyToolDetails,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreatePythonTool,\n\tcreatePythonToolDefinition,\n\tDEFAULT_PYTHON_TIMEOUT_SECONDS,\n\tMAX_PYTHON_OUTPUT_BYTES,\n\tMAX_PYTHON_TIMEOUT_SECONDS,\n\ttype PythonExecutionRequest,\n\ttype PythonExecutionResult,\n\ttype PythonOperations,\n\ttype PythonToolDetails,\n\ttype PythonToolInput,\n\ttype PythonToolOptions,\n\tresolvePythonToolPath,\n} from \"./python.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tcreateSecretStoreToolDefinition,\n\ttype SecretStoreStatus,\n\ttype SecretStoreToolDetails,\n\ttype SecretStoreToolInput,\n\ttype SecretStoreToolOptions,\n} from \"./secret-store.ts\";\nexport {\n\tcreateSkillAuditTool,\n\tcreateSkillAuditToolDefinition,\n\tjaccard,\n\ttype SkillAuditInput,\n\ttype SkillAuditReport,\n\ttype SkillAuditToolDetails,\n\ttype SkillAuditToolOptions,\n\ttokenize,\n} from \"./skill-audit.ts\";\nexport {\n\tcreateSkillifyTool,\n\tcreateSkillifyToolDefinition,\n\ttype SkillifyInput,\n\ttype SkillifyReport,\n\ttype SkillifyToolDetails,\n\ttype SkillifyToolOptions,\n} from \"./skillify.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\n\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\ttype ArtifactRetrieveToolOptions,\n\tcreateArtifactRetrieveTool,\n\tcreateArtifactRetrieveToolDefinition,\n} from \"./artifact-retrieve.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport {\n\tcreateExtensionifyTool,\n\tcreateExtensionifyToolDefinition,\n\ttype ExtensionifyToolOptions,\n} from \"./extensionify.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createPythonTool, createPythonToolDefinition, type PythonToolOptions } from \"./python.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createSkillAuditTool, createSkillAuditToolDefinition, type SkillAuditToolOptions } from \"./skill-audit.ts\";\nimport { createSkillifyTool, createSkillifyToolDefinition, type SkillifyToolOptions } from \"./skillify.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"python\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"grep\"\n\t| \"find\"\n\t| \"ls\"\n\t| \"skill_audit\"\n\t| \"skillify\"\n\t| \"extensionify\"\n\t| \"artifact_retrieve\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"python\",\n\t\"edit\",\n\t\"write\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"skill_audit\",\n\t\"skillify\",\n\t\"extensionify\",\n\t\"artifact_retrieve\",\n]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tpython?: PythonToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n\tskill_audit?: SkillAuditToolOptions;\n\tskillify?: SkillifyToolOptions;\n\textensionify?: ExtensionifyToolOptions;\n\tartifact_retrieve?: ArtifactRetrieveToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonToolDefinition(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditToolDefinition(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyToolDefinition(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyToolDefinition(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"python\":\n\t\t\treturn createPythonTool(cwd, options?.python);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"skill_audit\":\n\t\t\treturn createSkillAuditTool(cwd, options?.skill_audit);\n\t\tcase \"skillify\":\n\t\t\treturn createSkillifyTool(cwd, options?.skillify);\n\t\tcase \"extensionify\":\n\t\t\treturn createExtensionifyTool(cwd, options?.extensionify);\n\t\tcase \"artifact_retrieve\":\n\t\t\treturn createArtifactRetrieveTool(cwd, options?.artifact_retrieve);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): ToolDef[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, bashOptions),\n\t\tcreatePythonToolDefinition(cwd, options?.python),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, ToolDef>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, bashOptions),\n\t\tpython: createPythonToolDefinition(cwd, options?.python),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditToolDefinition(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyToolDefinition(cwd, options?.skillify),\n\t\textensionify: createExtensionifyToolDefinition(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveToolDefinition(cwd, options?.artifact_retrieve),\n\t};\n}\n\nexport function createCodingTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Tool[] {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, bashOptions),\n\t\tcreatePythonTool(cwd, options?.python),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(\n\tcwd: string,\n\toptions?: ToolsOptions,\n\tplatform: NodeJS.Platform = process.platform,\n): Partial<Record<ToolName, Tool>> {\n\tconst bashOptions: BashToolOptions = { ...options?.bash, platform };\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, bashOptions),\n\t\tpython: createPythonTool(cwd, options?.python),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\tskill_audit: createSkillAuditTool(cwd, options?.skill_audit),\n\t\tskillify: createSkillifyTool(cwd, options?.skillify),\n\t\textensionify: createExtensionifyTool(cwd, options?.extensionify),\n\t\tartifact_retrieve: createArtifactRetrieveTool(cwd, options?.artifact_retrieve),\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAiC,KAAK,gBAAgB,EAAgB,MAAM,gCAAgC,CAAC;AAGpH,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAKtF,QAAA,MAAM,QAAQ;;;;EAIZ,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAIlD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC5B,2BAA2B;IAC3B,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7D,wDAAwD;IACxD,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IACrE,6BAA6B;IAC7B,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CAChE;AAQD,MAAM,WAAW,aAAa;IAC7B,yEAAyE;IACzE,UAAU,CAAC,EAAE,YAAY,CAAC;CAC1B;AAsDD,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,GACrB,cAAc,CAAC,OAAO,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC,CAmJ5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,OAAO,QAAQ,CAAC,CAE7F","sourcesContent":["import { readdir as fsReaddir, stat as fsStat } from \"node:fs/promises\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"@caupulican/pi-agent-core/node\";\nimport { Text } from \"@caupulican/pi-tui\";\nimport nodePath from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { pathExists, resolveToCwd } from \"./path-utils.ts\";\nimport { getTextOutput, renderToolPath, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst lsSchema = Type.Object({\n\tpath: Type.Optional(Type.String({ description: \"Directory to list (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of entries to return (default: 500)\" })),\n\tmetadata: Type.Optional(Type.Boolean({ description: \"Include file size and permission metadata (default: false)\" })),\n});\n\nexport type LsToolInput = Static<typeof lsSchema>;\n\nconst DEFAULT_LIMIT = 500;\n\nexport interface LsToolDetails {\n\ttruncation?: TruncationResult;\n\tentryLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the ls tool.\n * Override these to delegate directory listing to remote systems (for example SSH).\n */\nexport interface LsEntryStats {\n\tisDirectory: () => boolean;\n\tsize?: number;\n\tmode?: number;\n}\n\nexport interface LsOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Get file or directory stats. Throws if not found. */\n\tstat: (absolutePath: string) => Promise<LsEntryStats> | LsEntryStats;\n\t/** Read directory entries */\n\treaddir: (absolutePath: string) => Promise<string[]> | string[];\n}\n\nconst defaultLsOperations: LsOperations = {\n\texists: pathExists,\n\tstat: fsStat,\n\treaddir: fsReaddir,\n};\n\nexport interface LsToolOptions {\n\t/** Custom operations for directory listing. Default: local filesystem */\n\toperations?: LsOperations;\n}\n\nfunction formatLsCall(args: { path?: string; limit?: number } | undefined, theme: Theme, cwd: string): string {\n\tconst limit = args?.limit;\n\tconst pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: \".\" });\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${pathDisplay}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t\t}\n\t}\n\n\tconst entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nfunction getPermissionString(mode: number, isDirectory: boolean): string {\n\tconst typeChar = isDirectory ? \"d\" : \"-\";\n\tconst rwx = (m: number) => [m & 4 ? \"r\" : \"-\", m & 2 ? \"w\" : \"-\", m & 1 ? \"x\" : \"-\"].join(\"\");\n\tconst owner = rwx((mode >> 6) & 7);\n\tconst group = rwx((mode >> 3) & 7);\n\tconst others = rwx(mode & 7);\n\treturn `${typeChar}${owner}${group}${others}`;\n}\n\nexport function createLsToolDefinition(\n\tcwd: string,\n\toptions?: LsToolOptions,\n): ToolDefinition<typeof lsSchema, LsToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultLsOperations;\n\treturn {\n\t\tname: \"ls\",\n\t\tlabel: \"ls\",\n\t\tdescription: `List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${DEFAULT_LIMIT} entries or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"List directory contents\",\n\t\tparameters: lsSchema,\n\t\ttoolGroup: \"explore\",\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, limit, metadata }: { path?: string; limit?: number; metadata?: boolean },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst dirPath = resolveToCwd(path || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\n\t\t\t\t\t\t// Check if path exists.\n\t\t\t\t\t\tif (!(await ops.exists(dirPath))) {\n\t\t\t\t\t\t\treject(new Error(`Path not found: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if path is a directory.\n\t\t\t\t\t\tconst stat = await ops.stat(dirPath);\n\t\t\t\t\t\tif (!stat.isDirectory()) {\n\t\t\t\t\t\t\treject(new Error(`Not a directory: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read directory entries.\n\t\t\t\t\t\tlet entries: string[];\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tentries = await ops.readdir(dirPath);\n\t\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\t\treject(new Error(`Cannot read directory: ${e.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Sort alphabetically, case-insensitive.\n\t\t\t\t\t\tentries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));\n\n\t\t\t\t\t\t// Format entries with directory indicators.\n\t\t\t\t\t\tconst results: string[] = [];\n\t\t\t\t\t\tlet entryLimitReached = false;\n\t\t\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\t\t\tif (results.length >= effectiveLimit) {\n\t\t\t\t\t\t\t\tentryLimitReached = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fullPath = nodePath.join(dirPath, entry);\n\t\t\t\t\t\t\tlet suffix = \"\";\n\t\t\t\t\t\t\tlet sizeStr = \"\";\n\t\t\t\t\t\t\tlet modeStr = \"\";\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst entryStat = await ops.stat(fullPath);\n\t\t\t\t\t\t\t\tconst isDir = entryStat.isDirectory();\n\t\t\t\t\t\t\t\tif (isDir) suffix = \"/\";\n\n\t\t\t\t\t\t\t\tif (metadata) {\n\t\t\t\t\t\t\t\t\tif (isDir) {\n\t\t\t\t\t\t\t\t\t\tsizeStr = \" -\";\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tconst sizeVal = entryStat.size ?? 0;\n\t\t\t\t\t\t\t\t\t\tsizeStr = formatSize(sizeVal).padStart(7);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (typeof entryStat.mode === \"number\") {\n\t\t\t\t\t\t\t\t\t\tmodeStr = getPermissionString(entryStat.mode, isDir);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tmodeStr = isDir ? \"d---------\" : \"----------\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tif (metadata) {\n\t\t\t\t\t\t\t\t\tsizeStr = \"???????\";\n\t\t\t\t\t\t\t\t\tmodeStr = \"??????????\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (metadata) {\n\t\t\t\t\t\t\t\tresults.push(`${modeStr} ${sizeStr} ${entry}${suffix}`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresults.push(entry + suffix);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"(empty directory)\" }], details: undefined });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = results.join(\"\\n\");\n\t\t\t\t\t\t// Apply byte truncation. There is no separate line limit because entry count is already capped.\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet output = truncation.content;\n\t\t\t\t\t\tconst details: LsToolDetails = {};\n\t\t\t\t\t\t// Build actionable notices for truncation and entry limits.\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (entryLimitReached) {\n\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} entries limit reached. Use limit=${effectiveLimit * 2} for more`);\n\t\t\t\t\t\t\tdetails.entryLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\toutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatLsCall(args, theme, context.cwd));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatLsResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema> {\n\treturn wrapToolDefinition(createLsToolDefinition(cwd, options));\n}\n"]}
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAiC,KAAK,gBAAgB,EAAgB,MAAM,gCAAgC,CAAC;AAEpH,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAWtF,QAAA,MAAM,QAAQ;;;;EAIZ,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAIlD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC5B,2BAA2B;IAC3B,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7D,wDAAwD;IACxD,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IACrE,6BAA6B;IAC7B,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CAChE;AAQD,MAAM,WAAW,aAAa;IAC7B,yEAAyE;IACzE,UAAU,CAAC,EAAE,YAAY,CAAC;CAC1B;AA+CD,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,GACrB,cAAc,CAAC,OAAO,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC,CA+I5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,OAAO,QAAQ,CAAC,CAE7F"}
@@ -1,11 +1,9 @@
1
1
  import { readdir as fsReaddir, stat as fsStat } from "node:fs/promises";
2
2
  import { DEFAULT_MAX_BYTES, formatSize, truncateHead } from "@caupulican/pi-agent-core/node";
3
- import { Text } from "@caupulican/pi-tui";
4
3
  import nodePath from "path";
5
4
  import { Type } from "typebox";
6
- import { keyHint } from "../../modes/interactive/components/keybinding-hints.js";
7
5
  import { pathExists, resolveToCwd } from "./path-utils.js";
8
- import { getTextOutput, renderToolPath, str } from "./render-utils.js";
6
+ import { formatCollapsibleToolResult, renderTextComponent, renderToolPath, str, toolTextResult, } from "./render-utils.js";
9
7
  import { wrapToolDefinition } from "./tool-definition-wrapper.js";
10
8
  const lsSchema = Type.Object({
11
9
  path: Type.Optional(Type.String({ description: "Directory to list (default: current directory)" })),
@@ -28,29 +26,22 @@ function formatLsCall(args, theme, cwd) {
28
26
  return text;
29
27
  }
30
28
  function formatLsResult(result, options, theme, showImages) {
31
- const output = getTextOutput(result, showImages).trim();
32
- let text = "";
33
- if (output) {
34
- const lines = output.split("\n");
35
- const maxLines = options.expanded ? lines.length : 20;
36
- const displayLines = lines.slice(0, maxLines);
37
- const remaining = lines.length - maxLines;
38
- text += `\n${displayLines.map((line) => theme.fg("toolOutput", line)).join("\n")}`;
39
- if (remaining > 0) {
40
- text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")})`;
41
- }
42
- }
43
- const entryLimit = result.details?.entryLimitReached;
44
- const truncation = result.details?.truncation;
45
- if (entryLimit || truncation?.truncated) {
46
- const warnings = [];
47
- if (entryLimit)
48
- warnings.push(`${entryLimit} entries limit`);
49
- if (truncation?.truncated)
50
- warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
51
- text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
52
- }
53
- return text;
29
+ return formatCollapsibleToolResult({
30
+ result,
31
+ options,
32
+ theme,
33
+ showImages,
34
+ collapsedLineLimit: 20,
35
+ warnings: (details) => {
36
+ const warnings = [];
37
+ if (details?.entryLimitReached)
38
+ warnings.push(`${details.entryLimitReached} entries limit`);
39
+ if (details?.truncation?.truncated) {
40
+ warnings.push(`${formatSize(details.truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
41
+ }
42
+ return warnings;
43
+ },
44
+ });
54
45
  }
55
46
  function getPermissionString(mode, isDirectory) {
56
47
  const typeChar = isDirectory ? "d" : "-";
@@ -172,10 +163,7 @@ export function createLsToolDefinition(cwd, options) {
172
163
  if (notices.length > 0) {
173
164
  output += `\n\n[${notices.join(". ")}]`;
174
165
  }
175
- resolve({
176
- content: [{ type: "text", text: output }],
177
- details: Object.keys(details).length > 0 ? details : undefined,
178
- });
166
+ resolve(toolTextResult({ text: output, details }));
179
167
  }
180
168
  catch (e) {
181
169
  signal?.removeEventListener("abort", onAbort);
@@ -185,14 +173,10 @@ export function createLsToolDefinition(cwd, options) {
185
173
  });
186
174
  },
187
175
  renderCall(args, theme, context) {
188
- const text = context.lastComponent ?? new Text("", 0, 0);
189
- text.setText(formatLsCall(args, theme, context.cwd));
190
- return text;
176
+ return renderTextComponent(context.lastComponent, formatLsCall(args, theme, context.cwd));
191
177
  },
192
178
  renderResult(result, options, theme, context) {
193
- const text = context.lastComponent ?? new Text("", 0, 0);
194
- text.setText(formatLsResult(result, options, theme, context.showImages));
195
- return text;
179
+ return renderTextComponent(context.lastComponent, formatLsResult(result, options, theme, context.showImages));
196
180
  },
197
181
  };
198
182
  }