@bastani/atomic 0.9.9-alpha.1 → 0.9.9-alpha.2

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 (534) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/builtin/cursor/CHANGELOG.md +6 -0
  3. package/dist/builtin/cursor/package.json +3 -3
  4. package/dist/builtin/intercom/CHANGELOG.md +7 -0
  5. package/dist/builtin/intercom/package.json +3 -3
  6. package/dist/builtin/mcp/CHANGELOG.md +7 -0
  7. package/dist/builtin/mcp/package.json +4 -4
  8. package/dist/builtin/subagents/CHANGELOG.md +7 -0
  9. package/dist/builtin/subagents/package.json +5 -5
  10. package/dist/builtin/web-access/CHANGELOG.md +7 -0
  11. package/dist/builtin/web-access/package.json +3 -3
  12. package/dist/builtin/web-access/web-search-tool.ts +1 -2
  13. package/dist/builtin/workflows/CHANGELOG.md +7 -0
  14. package/dist/builtin/workflows/package.json +3 -3
  15. package/dist/builtin/workflows/src/shared/serializable.ts +1 -1
  16. package/dist/bun/cli.d.ts.map +1 -1
  17. package/dist/bun/internal-intercom-broker.d.ts.map +1 -1
  18. package/dist/bun/register-bedrock.d.ts.map +1 -1
  19. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  20. package/dist/bun/split-loader.d.ts.map +1 -1
  21. package/dist/cli/args.d.ts.map +1 -1
  22. package/dist/cli/config-selector.d.ts.map +1 -1
  23. package/dist/cli/file-processor.d.ts.map +1 -1
  24. package/dist/cli/initial-message.d.ts.map +1 -1
  25. package/dist/cli/list-models.d.ts.map +1 -1
  26. package/dist/cli/project-trust.d.ts.map +1 -1
  27. package/dist/cli/session-picker.d.ts.map +1 -1
  28. package/dist/cli/startup-ui.d.ts.map +1 -1
  29. package/dist/cli.d.ts.map +1 -1
  30. package/dist/config-self-update.d.ts.map +1 -1
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/core/agent-session-accessors.d.ts.map +1 -1
  33. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  34. package/dist/core/agent-session-bash.d.ts.map +1 -1
  35. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  36. package/dist/core/agent-session-events.d.ts.map +1 -1
  37. package/dist/core/agent-session-export.d.ts.map +1 -1
  38. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  39. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  40. package/dist/core/agent-session-methods.d.ts.map +1 -1
  41. package/dist/core/agent-session-models.d.ts.map +1 -1
  42. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  43. package/dist/core/agent-session-retry.d.ts.map +1 -1
  44. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  45. package/dist/core/agent-session-services.d.ts.map +1 -1
  46. package/dist/core/agent-session-skill-block.d.ts.map +1 -1
  47. package/dist/core/agent-session-state.d.ts.map +1 -1
  48. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  49. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  50. package/dist/core/agent-session-tree.d.ts.map +1 -1
  51. package/dist/core/agent-session-types.d.ts.map +1 -1
  52. package/dist/core/agent-session.d.ts.map +1 -1
  53. package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
  54. package/dist/core/async/format.d.ts.map +1 -1
  55. package/dist/core/async/job-manager.d.ts.map +1 -1
  56. package/dist/core/async/session-manager.d.ts.map +1 -1
  57. package/dist/core/async/types.d.ts.map +1 -1
  58. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  59. package/dist/core/auth-guidance.d.ts.map +1 -1
  60. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  61. package/dist/core/auth-storage.d.ts +4 -0
  62. package/dist/core/auth-storage.d.ts.map +1 -1
  63. package/dist/core/bash-executor.d.ts.map +1 -1
  64. package/dist/core/builtin-packages.d.ts.map +1 -1
  65. package/dist/core/codex-fast-mode.d.ts.map +1 -1
  66. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  67. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  68. package/dist/core/compaction/compaction-parameters.d.ts.map +1 -1
  69. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  70. package/dist/core/compaction/compaction-types.d.ts.map +1 -1
  71. package/dist/core/compaction/compaction.d.ts.map +1 -1
  72. package/dist/core/compaction/deleted-ranges.d.ts.map +1 -1
  73. package/dist/core/compaction/index.d.ts.map +1 -1
  74. package/dist/core/compaction/range-planner.d.ts.map +1 -1
  75. package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
  76. package/dist/core/compaction/utils.d.ts.map +1 -1
  77. package/dist/core/context-window.d.ts.map +1 -1
  78. package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -1
  79. package/dist/core/copilot-errors.d.ts.map +1 -1
  80. package/dist/core/copilot-gemini-payload-sanitizer.d.ts.map +1 -1
  81. package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
  82. package/dist/core/copilot-gemini-tool-arguments.d.ts.map +1 -1
  83. package/dist/core/copilot-hosts.d.ts.map +1 -1
  84. package/dist/core/copilot-model-catalog.d.ts.map +1 -1
  85. package/dist/core/copilot-model-static-fallbacks.d.ts.map +1 -1
  86. package/dist/core/copilot-model-synthesis.d.ts.map +1 -1
  87. package/dist/core/defaults.d.ts.map +1 -1
  88. package/dist/core/diagnostics.d.ts.map +1 -1
  89. package/dist/core/event-bus.d.ts.map +1 -1
  90. package/dist/core/exec.d.ts.map +1 -1
  91. package/dist/core/experimental.d.ts.map +1 -1
  92. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  93. package/dist/core/export-html/index.d.ts.map +1 -1
  94. package/dist/core/export-html/template-script.d.ts.map +1 -1
  95. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  96. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  97. package/dist/core/extensions/api-types.d.ts.map +1 -1
  98. package/dist/core/extensions/command-types.d.ts.map +1 -1
  99. package/dist/core/extensions/context-types.d.ts.map +1 -1
  100. package/dist/core/extensions/event-results.d.ts.map +1 -1
  101. package/dist/core/extensions/event-types.d.ts.map +1 -1
  102. package/dist/core/extensions/index.d.ts.map +1 -1
  103. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  104. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  105. package/dist/core/extensions/loader-discovery.d.ts.map +1 -1
  106. package/dist/core/extensions/loader-resources.d.ts.map +1 -1
  107. package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
  108. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  109. package/dist/core/extensions/loader.d.ts.map +1 -1
  110. package/dist/core/extensions/message-types.d.ts.map +1 -1
  111. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  112. package/dist/core/extensions/reactive-widget.d.ts.map +1 -1
  113. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  114. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  115. package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
  116. package/dist/core/extensions/runner-project-trust.d.ts.map +1 -1
  117. package/dist/core/extensions/runner-registries.d.ts.map +1 -1
  118. package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
  119. package/dist/core/extensions/runner-ui.d.ts.map +1 -1
  120. package/dist/core/extensions/runner.d.ts.map +1 -1
  121. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  122. package/dist/core/extensions/session-events.d.ts.map +1 -1
  123. package/dist/core/extensions/tool-events.d.ts.map +1 -1
  124. package/dist/core/extensions/tool-types.d.ts.map +1 -1
  125. package/dist/core/extensions/types.d.ts.map +1 -1
  126. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  127. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  128. package/dist/core/flattened-tool-arguments.d.ts.map +1 -1
  129. package/dist/core/footer-data-provider.d.ts.map +1 -1
  130. package/dist/core/http-dispatcher.d.ts.map +1 -1
  131. package/dist/core/index.d.ts.map +1 -1
  132. package/dist/core/keybindings.d.ts.map +1 -1
  133. package/dist/core/messages.d.ts.map +1 -1
  134. package/dist/core/model-registry-auth.d.ts.map +1 -1
  135. package/dist/core/model-registry-builtins.d.ts.map +1 -1
  136. package/dist/core/model-registry-builtins.js.map +1 -1
  137. package/dist/core/model-registry-custom-loader.d.ts.map +1 -1
  138. package/dist/core/model-registry-custom-loader.js.map +1 -1
  139. package/dist/core/model-registry-dynamic.d.ts.map +1 -1
  140. package/dist/core/model-registry-loader.d.ts.map +1 -1
  141. package/dist/core/model-registry-schemas.d.ts +65 -13
  142. package/dist/core/model-registry-schemas.d.ts.map +1 -1
  143. package/dist/core/model-registry-schemas.js +5 -1
  144. package/dist/core/model-registry-schemas.js.map +1 -1
  145. package/dist/core/model-registry-types.d.ts.map +1 -1
  146. package/dist/core/model-registry.d.ts.map +1 -1
  147. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  148. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  149. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  150. package/dist/core/model-resolver-patterns.d.ts.map +1 -1
  151. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  152. package/dist/core/model-resolver-types.d.ts.map +1 -1
  153. package/dist/core/model-resolver.d.ts.map +1 -1
  154. package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
  155. package/dist/core/output-guard.d.ts.map +1 -1
  156. package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
  157. package/dist/core/package-manager-command.d.ts.map +1 -1
  158. package/dist/core/package-manager-constants.d.ts.map +1 -1
  159. package/dist/core/package-manager-env.d.ts.map +1 -1
  160. package/dist/core/package-manager-git.d.ts.map +1 -1
  161. package/dist/core/package-manager-manifest.d.ts.map +1 -1
  162. package/dist/core/package-manager-npm.d.ts.map +1 -1
  163. package/dist/core/package-manager-operations.d.ts.map +1 -1
  164. package/dist/core/package-manager-paths.d.ts.map +1 -1
  165. package/dist/core/package-manager-progress.d.ts.map +1 -1
  166. package/dist/core/package-manager-resolver.d.ts.map +1 -1
  167. package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -1
  168. package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
  169. package/dist/core/package-manager-resource-files.d.ts.map +1 -1
  170. package/dist/core/package-manager-resource-patterns.d.ts.map +1 -1
  171. package/dist/core/package-manager-settings.d.ts.map +1 -1
  172. package/dist/core/package-manager-source.d.ts.map +1 -1
  173. package/dist/core/package-manager-types.d.ts.map +1 -1
  174. package/dist/core/package-manager.d.ts.map +1 -1
  175. package/dist/core/project-trust.d.ts.map +1 -1
  176. package/dist/core/prompt-templates-async.d.ts.map +1 -1
  177. package/dist/core/prompt-templates.d.ts.map +1 -1
  178. package/dist/core/provider-attribution.d.ts.map +1 -1
  179. package/dist/core/provider-context-usage.d.ts.map +1 -1
  180. package/dist/core/provider-display-names.d.ts.map +1 -1
  181. package/dist/core/resolve-config-value.d.ts.map +1 -1
  182. package/dist/core/resource-loader-assets.d.ts.map +1 -1
  183. package/dist/core/resource-loader-context-files.d.ts.map +1 -1
  184. package/dist/core/resource-loader-core.d.ts.map +1 -1
  185. package/dist/core/resource-loader-discovery.d.ts.map +1 -1
  186. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  187. package/dist/core/resource-loader-helpers.d.ts.map +1 -1
  188. package/dist/core/resource-loader-internals.d.ts.map +1 -1
  189. package/dist/core/resource-loader-package-resources.d.ts.map +1 -1
  190. package/dist/core/resource-loader-paths.d.ts.map +1 -1
  191. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  192. package/dist/core/resource-loader-source-info.d.ts.map +1 -1
  193. package/dist/core/resource-loader-types.d.ts.map +1 -1
  194. package/dist/core/resource-loader.d.ts.map +1 -1
  195. package/dist/core/sdk-exports.d.ts.map +1 -1
  196. package/dist/core/sdk-types.d.ts.map +1 -1
  197. package/dist/core/sdk.d.ts.map +1 -1
  198. package/dist/core/session-cwd.d.ts.map +1 -1
  199. package/dist/core/session-entry-normalization.d.ts.map +1 -1
  200. package/dist/core/session-manager-archive.d.ts.map +1 -1
  201. package/dist/core/session-manager-classification.d.ts.map +1 -1
  202. package/dist/core/session-manager-core.d.ts.map +1 -1
  203. package/dist/core/session-manager-entries.d.ts.map +1 -1
  204. package/dist/core/session-manager-history.d.ts.map +1 -1
  205. package/dist/core/session-manager-list.d.ts.map +1 -1
  206. package/dist/core/session-manager-migrations.d.ts.map +1 -1
  207. package/dist/core/session-manager-paths.d.ts.map +1 -1
  208. package/dist/core/session-manager-storage.d.ts.map +1 -1
  209. package/dist/core/session-manager-types.d.ts.map +1 -1
  210. package/dist/core/session-manager-validation.d.ts.map +1 -1
  211. package/dist/core/session-manager.d.ts.map +1 -1
  212. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  213. package/dist/core/settings-manager-core.d.ts.map +1 -1
  214. package/dist/core/settings-manager-internals.d.ts.map +1 -1
  215. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
  216. package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
  217. package/dist/core/settings-manager.d.ts.map +1 -1
  218. package/dist/core/settings-merge.d.ts.map +1 -1
  219. package/dist/core/settings-storage.d.ts.map +1 -1
  220. package/dist/core/settings-types.d.ts.map +1 -1
  221. package/dist/core/skills-async.d.ts.map +1 -1
  222. package/dist/core/skills.d.ts.map +1 -1
  223. package/dist/core/slash-commands.d.ts.map +1 -1
  224. package/dist/core/source-info.d.ts.map +1 -1
  225. package/dist/core/system-prompt.d.ts.map +1 -1
  226. package/dist/core/telemetry.d.ts.map +1 -1
  227. package/dist/core/thinking-blocks.d.ts.map +1 -1
  228. package/dist/core/timings.d.ts.map +1 -1
  229. package/dist/core/tools/artifact-protocol.d.ts.map +1 -1
  230. package/dist/core/tools/artifacts.d.ts.map +1 -1
  231. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  232. package/dist/core/tools/ask-user-question/config.d.ts.map +1 -1
  233. package/dist/core/tools/ask-user-question/index.d.ts.map +1 -1
  234. package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts.map +1 -1
  235. package/dist/core/tools/ask-user-question/state/inline-input.d.ts.map +1 -1
  236. package/dist/core/tools/ask-user-question/state/key-router.d.ts.map +1 -1
  237. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
  238. package/dist/core/tools/ask-user-question/state/row-intent.d.ts.map +1 -1
  239. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -1
  240. package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts.map +1 -1
  241. package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts.map +1 -1
  242. package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
  243. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -1
  244. package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -1
  245. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -1
  246. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -1
  247. package/dist/core/tools/ask-user-question/tool/types.d.ts.map +1 -1
  248. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts.map +1 -1
  249. package/dist/core/tools/ask-user-question/view/body-residual-spacer.d.ts.map +1 -1
  250. package/dist/core/tools/ask-user-question/view/component-binding.d.ts.map +1 -1
  251. package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts.map +1 -1
  252. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
  253. package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts.map +1 -1
  254. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts.map +1 -1
  255. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -1
  256. package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.d.ts.map +1 -1
  257. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts.map +1 -1
  258. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts.map +1 -1
  259. package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
  260. package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts.map +1 -1
  261. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
  262. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
  263. package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -1
  264. package/dist/core/tools/ask-user-question/view/stateful-view.d.ts.map +1 -1
  265. package/dist/core/tools/ask-user-question/view/tab-components.d.ts.map +1 -1
  266. package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts.map +1 -1
  267. package/dist/core/tools/bash-async-execution.d.ts.map +1 -1
  268. package/dist/core/tools/bash-async-jobs.d.ts.map +1 -1
  269. package/dist/core/tools/bash-async-output.d.ts.map +1 -1
  270. package/dist/core/tools/bash-interceptor.d.ts.map +1 -1
  271. package/dist/core/tools/bash-leading-cd.d.ts.map +1 -1
  272. package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
  273. package/dist/core/tools/bash.d.ts.map +1 -1
  274. package/dist/core/tools/block-resolver.d.ts.map +1 -1
  275. package/dist/core/tools/conflict-registry.d.ts.map +1 -1
  276. package/dist/core/tools/directory-tree.d.ts.map +1 -1
  277. package/dist/core/tools/edit-diff-preserve.d.ts.map +1 -1
  278. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  279. package/dist/core/tools/edit.d.ts.map +1 -1
  280. package/dist/core/tools/fetch-url.d.ts.map +1 -1
  281. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  282. package/dist/core/tools/find.d.ts.map +1 -1
  283. package/dist/core/tools/glob-path-utils.d.ts.map +1 -1
  284. package/dist/core/tools/grep.d.ts.map +1 -1
  285. package/dist/core/tools/hashline-engine/apply.d.ts.map +1 -1
  286. package/dist/core/tools/hashline-engine/block.d.ts.map +1 -1
  287. package/dist/core/tools/hashline-engine/diff-preview.d.ts.map +1 -1
  288. package/dist/core/tools/hashline-engine/format.d.ts.map +1 -1
  289. package/dist/core/tools/hashline-engine/fs.d.ts.map +1 -1
  290. package/dist/core/tools/hashline-engine/index.d.ts.map +1 -1
  291. package/dist/core/tools/hashline-engine/input.d.ts.map +1 -1
  292. package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -1
  293. package/dist/core/tools/hashline-engine/mismatch.d.ts.map +1 -1
  294. package/dist/core/tools/hashline-engine/normalize.d.ts.map +1 -1
  295. package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -1
  296. package/dist/core/tools/hashline-engine/patcher.d.ts.map +1 -1
  297. package/dist/core/tools/hashline-engine/prefixes.d.ts.map +1 -1
  298. package/dist/core/tools/hashline-engine/recovery.d.ts.map +1 -1
  299. package/dist/core/tools/hashline-engine/snapshots.d.ts.map +1 -1
  300. package/dist/core/tools/hashline-engine/stream.d.ts.map +1 -1
  301. package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -1
  302. package/dist/core/tools/hashline-engine/types.d.ts.map +1 -1
  303. package/dist/core/tools/hashline.d.ts.map +1 -1
  304. package/dist/core/tools/index.d.ts.map +1 -1
  305. package/dist/core/tools/ls.d.ts.map +1 -1
  306. package/dist/core/tools/notebook.d.ts.map +1 -1
  307. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  308. package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
  309. package/dist/core/tools/path-utils.d.ts.map +1 -1
  310. package/dist/core/tools/read-document-extract.d.ts.map +1 -1
  311. package/dist/core/tools/read-selectors.d.ts.map +1 -1
  312. package/dist/core/tools/read-url.d.ts.map +1 -1
  313. package/dist/core/tools/read.d.ts.map +1 -1
  314. package/dist/core/tools/render-utils.d.ts.map +1 -1
  315. package/dist/core/tools/resource-selectors.d.ts.map +1 -1
  316. package/dist/core/tools/search-details.d.ts.map +1 -1
  317. package/dist/core/tools/search-line-ranges.d.ts.map +1 -1
  318. package/dist/core/tools/search-native.d.ts.map +1 -1
  319. package/dist/core/tools/search.d.ts.map +1 -1
  320. package/dist/core/tools/structured-output.d.ts.map +1 -1
  321. package/dist/core/tools/todos-execute.d.ts.map +1 -1
  322. package/dist/core/tools/todos-locks.d.ts.map +1 -1
  323. package/dist/core/tools/todos-model.d.ts.map +1 -1
  324. package/dist/core/tools/todos-mutations.d.ts.map +1 -1
  325. package/dist/core/tools/todos-paths.d.ts.map +1 -1
  326. package/dist/core/tools/todos-render.d.ts.map +1 -1
  327. package/dist/core/tools/todos-storage.d.ts.map +1 -1
  328. package/dist/core/tools/todos-types.d.ts.map +1 -1
  329. package/dist/core/tools/todos-types.js +1 -1
  330. package/dist/core/tools/todos-types.js.map +1 -1
  331. package/dist/core/tools/todos.d.ts.map +1 -1
  332. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  333. package/dist/core/tools/tool-definition-wrapper.js +6 -2
  334. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  335. package/dist/core/tools/tool-limits.d.ts.map +1 -1
  336. package/dist/core/tools/truncate.d.ts.map +1 -1
  337. package/dist/core/tools/url-ip-guards.d.ts.map +1 -1
  338. package/dist/core/tools/write.d.ts.map +1 -1
  339. package/dist/core/trust-manager.d.ts.map +1 -1
  340. package/dist/core/typebox-compat.d.ts +12 -0
  341. package/dist/core/typebox-compat.d.ts.map +1 -0
  342. package/dist/core/typebox-compat.js +10 -0
  343. package/dist/core/typebox-compat.js.map +1 -0
  344. package/dist/index-extensions.d.ts.map +1 -1
  345. package/dist/index.d.ts +1 -0
  346. package/dist/index.d.ts.map +1 -1
  347. package/dist/index.js +1 -0
  348. package/dist/index.js.map +1 -1
  349. package/dist/main-app-mode.d.ts.map +1 -1
  350. package/dist/main-deferred-startup.d.ts.map +1 -1
  351. package/dist/main-early-input.d.ts.map +1 -1
  352. package/dist/main-session-options.d.ts.map +1 -1
  353. package/dist/main-session.d.ts.map +1 -1
  354. package/dist/main-stdio.d.ts.map +1 -1
  355. package/dist/main.d.ts.map +1 -1
  356. package/dist/migrations-config-values.d.ts.map +1 -1
  357. package/dist/migrations.d.ts.map +1 -1
  358. package/dist/modes/index.d.ts.map +1 -1
  359. package/dist/modes/interactive/chat-input-actions.d.ts.map +1 -1
  360. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  361. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  362. package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
  363. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  364. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  365. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  366. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  368. package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -1
  369. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  370. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  372. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.d.ts.map +1 -1
  374. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
  375. package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
  376. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  377. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  378. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -1
  380. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  381. package/dist/modes/interactive/components/context-window-selector.d.ts.map +1 -1
  382. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  383. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  384. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  386. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  387. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  388. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  390. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  391. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  392. package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  394. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  395. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  396. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  398. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  399. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  400. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
  401. package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -1
  402. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  403. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  404. package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -1
  405. package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -1
  406. package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -1
  407. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  408. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
  409. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  410. package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -1
  411. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
  412. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  413. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  414. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  415. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  416. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  417. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  418. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  419. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  420. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  421. package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
  422. package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -1
  423. package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
  424. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -1
  425. package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -1
  426. package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -1
  427. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  428. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  429. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  430. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  431. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  432. package/dist/modes/interactive/components/working-status.d.ts.map +1 -1
  433. package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
  434. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
  435. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
  436. package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
  437. package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -1
  438. package/dist/modes/interactive/interactive-child-ordering.d.ts.map +1 -1
  439. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  440. package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
  441. package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -1
  442. package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -1
  443. package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -1
  444. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
  445. package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -1
  446. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -1
  447. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  448. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  449. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  450. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  451. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  452. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
  453. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  454. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  455. package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -1
  456. package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -1
  457. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  458. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  459. package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
  460. package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -1
  461. package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -1
  462. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  463. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
  464. package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
  465. package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -1
  466. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  467. package/dist/modes/interactive/model-search.d.ts.map +1 -1
  468. package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
  469. package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -1
  470. package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
  471. package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -1
  472. package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
  473. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  474. package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
  475. package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -1
  476. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  477. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  478. package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -1
  479. package/dist/modes/interactive/whimsical-messages.d.ts.map +1 -1
  480. package/dist/modes/print-mode.d.ts.map +1 -1
  481. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  482. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  483. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  484. package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
  485. package/dist/modes/rpc/rpc-input.d.ts.map +1 -1
  486. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  487. package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
  488. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  489. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  490. package/dist/package-manager-cli-parser.d.ts.map +1 -1
  491. package/dist/package-manager-cli.d.ts.map +1 -1
  492. package/dist/rpc-entry.d.ts.map +1 -1
  493. package/dist/utils/ansi.d.ts.map +1 -1
  494. package/dist/utils/changelog.d.ts.map +1 -1
  495. package/dist/utils/child-process.d.ts.map +1 -1
  496. package/dist/utils/clipboard-image.d.ts.map +1 -1
  497. package/dist/utils/clipboard-native.d.ts.map +1 -1
  498. package/dist/utils/clipboard.d.ts.map +1 -1
  499. package/dist/utils/deprecation.d.ts.map +1 -1
  500. package/dist/utils/event-loop.d.ts.map +1 -1
  501. package/dist/utils/exif-orientation.d.ts.map +1 -1
  502. package/dist/utils/frontmatter.d.ts.map +1 -1
  503. package/dist/utils/fs-watch.d.ts.map +1 -1
  504. package/dist/utils/git-env.d.ts.map +1 -1
  505. package/dist/utils/git.d.ts.map +1 -1
  506. package/dist/utils/html.d.ts.map +1 -1
  507. package/dist/utils/image-convert.d.ts.map +1 -1
  508. package/dist/utils/image-process.d.ts.map +1 -1
  509. package/dist/utils/image-resize-core.d.ts.map +1 -1
  510. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  511. package/dist/utils/image-resize.d.ts.map +1 -1
  512. package/dist/utils/json.d.ts.map +1 -1
  513. package/dist/utils/markit.d.ts.map +1 -1
  514. package/dist/utils/mime.d.ts.map +1 -1
  515. package/dist/utils/module-require.d.ts.map +1 -1
  516. package/dist/utils/open-browser.d.ts.map +1 -1
  517. package/dist/utils/paths.d.ts.map +1 -1
  518. package/dist/utils/photon.d.ts.map +1 -1
  519. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  520. package/dist/utils/shell.d.ts.map +1 -1
  521. package/dist/utils/sleep.d.ts.map +1 -1
  522. package/dist/utils/split-launcher.d.ts.map +1 -1
  523. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  524. package/dist/utils/tools-manager.d.ts.map +1 -1
  525. package/dist/utils/version-check.d.ts.map +1 -1
  526. package/dist/utils/windows-self-update.d.ts.map +1 -1
  527. package/docs/custom-provider.md +7 -1
  528. package/docs/extensions.md +6 -4
  529. package/examples/extensions/README.md +3 -1
  530. package/examples/extensions/subagent/schemas.ts +1 -1
  531. package/examples/extensions/tic-tac-toe.ts +1 -2
  532. package/examples/extensions/todo.ts +1 -2
  533. package/npm-shrinkwrap.json +214 -98
  534. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"todos-execute.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAkB/D,OAAO,EAKN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,kBAAkB,CAAC;AA8N1B,wBAAsB,qBAAqB,CAC1C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAuB3C","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport { existsSync } from \"node:fs\";\nimport type { ExtensionContext } from \"../extensions/types.ts\";\nimport {\n\tclearAssignmentIfClosed,\n\tformatTodoId,\n\tsplitTodosByAssignment,\n\tvalidateTodoId,\n} from \"./todos-model.ts\";\nimport { deleteTodo, claimTodoAssignment, releaseTodoAssignment } from \"./todos-mutations.ts\";\nimport { getTodoPath, getTodosDir } from \"./todos-paths.ts\";\nimport { serializeTodoForAgent, serializeTodoListForAgent } from \"./todos-render.ts\";\nimport {\n\tappendTodoBody,\n\tensureTodoExists,\n\tensureTodosDir,\n\tgenerateTodoId,\n\tlistTodos,\n\twriteTodoFile,\n} from \"./todos-storage.ts\";\nimport {\n\tisTodoOperationError,\n\ttype TodoFrontMatter,\n\ttype TodoRecord,\n\ttype TodoRecordAction,\n\ttype TodoToolDetails,\n\ttype TodoToolParams,\n} from \"./todos-types.ts\";\nimport { withTodoLock } from \"./todos-locks.ts\";\n\nfunction todoActionResult(\n\taction: TodoRecordAction,\n\ttext: string,\n\tdetailsError: string,\n): AgentToolResult<TodoToolDetails> {\n\treturn {\n\t\tcontent: [{ type: \"text\", text }],\n\t\tdetails: { action, error: detailsError },\n\t};\n}\n\nfunction idRequiredResult(action: TodoRecordAction): AgentToolResult<TodoToolDetails> {\n\treturn todoActionResult(action, \"Error: id required\", \"id required\");\n}\n\nfunction todoSuccessResult(\n\taction: TodoRecordAction,\n\ttodo: TodoRecord,\n): AgentToolResult<TodoToolDetails> {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: serializeTodoForAgent(todo) }],\n\t\tdetails: { action, todo },\n\t};\n}\n\nfunction todoListResult(\n\taction: \"list\" | \"list-all\",\n\ttodos: TodoFrontMatter[],\n\tcurrentSessionId: string,\n): AgentToolResult<TodoToolDetails> {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: serializeTodoListForAgent(todos) }],\n\t\tdetails: { action, todos, currentSessionId },\n\t};\n}\n\nasync function executeListAction(\n\ttodosDir: string,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tconst todos = await listTodos(todosDir);\n\tconst { assignedTodos, openTodos } = splitTodosByAssignment(todos);\n\tconst listedTodos = [...assignedTodos, ...openTodos];\n\tconst currentSessionId = ctx.sessionManager.getSessionId();\n\treturn todoListResult(\"list\", listedTodos, currentSessionId);\n}\n\nasync function executeListAllAction(\n\ttodosDir: string,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tconst todos = await listTodos(todosDir);\n\tconst currentSessionId = ctx.sessionManager.getSessionId();\n\treturn todoListResult(\"list-all\", todos, currentSessionId);\n}\n\nasync function executeGetAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"get\");\n\tconst validated = validateTodoId(params.id);\n\tif (\"error\" in validated) {\n\t\treturn todoActionResult(\"get\", validated.error, validated.error);\n\t}\n\tconst normalizedId = validated.id;\n\tconst displayId = formatTodoId(normalizedId);\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tconst todo = await ensureTodoExists(filePath, normalizedId);\n\tif (!todo) {\n\t\treturn todoActionResult(\"get\", `Todo ${displayId} not found`, \"not found\");\n\t}\n\treturn todoSuccessResult(\"get\", todo);\n}\n\nasync function executeCreateAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.title) {\n\t\treturn todoActionResult(\"create\", \"Error: title required\", \"title required\");\n\t}\n\tawait ensureTodosDir(todosDir);\n\tconst id = await generateTodoId(todosDir);\n\tconst filePath = getTodoPath(todosDir, id);\n\tconst todo: TodoRecord = {\n\t\tid,\n\t\ttitle: params.title,\n\t\ttags: params.tags ?? [],\n\t\tstatus: params.status ?? \"open\",\n\t\tcreated_at: new Date().toISOString(),\n\t\tbody: params.body ?? \"\",\n\t};\n\n\tconst result = await withTodoLock<TodoRecord>(todosDir, id, ctx, async () => {\n\t\tawait writeTodoFile(filePath, todo);\n\t\treturn todo;\n\t});\n\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"create\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"create\", todo);\n}\n\nasync function executeUpdateAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"update\");\n\tconst validated = validateTodoId(params.id);\n\tif (\"error\" in validated) {\n\t\treturn todoActionResult(\"update\", validated.error, validated.error);\n\t}\n\tconst normalizedId = validated.id;\n\tconst displayId = formatTodoId(normalizedId);\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tif (!existsSync(filePath)) {\n\t\treturn todoActionResult(\"update\", `Todo ${displayId} not found`, \"not found\");\n\t}\n\tconst result = await withTodoLock<TodoRecord>(todosDir, normalizedId, ctx, async () => {\n\t\tconst existing = await ensureTodoExists(filePath, normalizedId);\n\t\tif (!existing) return { error: `Todo ${displayId} not found` };\n\n\t\texisting.id = normalizedId;\n\t\tif (params.title !== undefined) existing.title = params.title;\n\t\tif (params.status !== undefined) existing.status = params.status;\n\t\tif (params.tags !== undefined) existing.tags = params.tags;\n\t\tif (params.body !== undefined) existing.body = params.body;\n\t\tif (!existing.created_at) existing.created_at = new Date().toISOString();\n\t\tclearAssignmentIfClosed(existing);\n\n\t\tawait writeTodoFile(filePath, existing);\n\t\treturn existing;\n\t});\n\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"update\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"update\", result);\n}\n\nasync function executeAppendAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"append\");\n\tconst validated = validateTodoId(params.id);\n\tif (\"error\" in validated) {\n\t\treturn todoActionResult(\"append\", validated.error, validated.error);\n\t}\n\tconst normalizedId = validated.id;\n\tconst displayId = formatTodoId(normalizedId);\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tif (!existsSync(filePath)) {\n\t\treturn todoActionResult(\"append\", `Todo ${displayId} not found`, \"not found\");\n\t}\n\tconst result = await withTodoLock<TodoRecord>(todosDir, normalizedId, ctx, async () => {\n\t\tconst existing = await ensureTodoExists(filePath, normalizedId);\n\t\tif (!existing) return { error: `Todo ${displayId} not found` };\n\t\tif (!params.body || !params.body.trim()) {\n\t\t\treturn existing;\n\t\t}\n\t\treturn appendTodoBody(filePath, existing, params.body);\n\t});\n\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"append\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"append\", result);\n}\n\nasync function executeClaimAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"claim\");\n\tconst result = await claimTodoAssignment(todosDir, params.id, ctx, Boolean(params.force));\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"claim\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"claim\", result);\n}\n\nasync function executeReleaseAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"release\");\n\tconst result = await releaseTodoAssignment(todosDir, params.id, ctx, Boolean(params.force));\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"release\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"release\", result);\n}\n\nasync function executeDeleteAction(\n\ttodosDir: string,\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tif (!params.id) return idRequiredResult(\"delete\");\n\n\tconst validated = validateTodoId(params.id);\n\tif (\"error\" in validated) {\n\t\treturn todoActionResult(\"delete\", validated.error, validated.error);\n\t}\n\tconst result = await deleteTodo(todosDir, validated.id, ctx);\n\tif (isTodoOperationError(result)) {\n\t\treturn todoActionResult(\"delete\", result.error, result.error);\n\t}\n\treturn todoSuccessResult(\"delete\", result);\n}\n\nexport async function executeTodoToolAction(\n\tparams: TodoToolParams,\n\tctx: ExtensionContext,\n): Promise<AgentToolResult<TodoToolDetails>> {\n\tconst todosDir = getTodosDir(ctx.cwd);\n\n\tswitch (params.action) {\n\t\tcase \"list\":\n\t\t\treturn executeListAction(todosDir, ctx);\n\t\tcase \"list-all\":\n\t\t\treturn executeListAllAction(todosDir, ctx);\n\t\tcase \"get\":\n\t\t\treturn executeGetAction(todosDir, params);\n\t\tcase \"create\":\n\t\t\treturn executeCreateAction(todosDir, params, ctx);\n\t\tcase \"update\":\n\t\t\treturn executeUpdateAction(todosDir, params, ctx);\n\t\tcase \"append\":\n\t\t\treturn executeAppendAction(todosDir, params, ctx);\n\t\tcase \"claim\":\n\t\t\treturn executeClaimAction(todosDir, params, ctx);\n\t\tcase \"release\":\n\t\t\treturn executeReleaseAction(todosDir, params, ctx);\n\t\tcase \"delete\":\n\t\t\treturn executeDeleteAction(todosDir, params, ctx);\n\t}\n}\n"]}
1
+ {"version":3,"file":"todos-execute.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAkB/D,OAAO,EAKN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,kBAAkB,CAAC;AA8N1B,wBAAsB,qBAAqB,CAC1C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAuB3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos-locks.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-locks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAIN,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AA6E1B,wBAAsB,YAAY,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,EACrB,EAAE,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAQjC","sourcesContent":["import fs from \"node:fs/promises\";\nimport type { ExtensionContext } from \"../extensions/types.ts\";\nimport { displayTodoId } from \"./todos-model.ts\";\nimport { getLockPath } from \"./todos-paths.ts\";\nimport {\n\tisTodoOperationError,\n\ttype LockInfo,\n\ttype TodoOperationError,\n\ttype TodoOperationResult,\n} from \"./todos-types.ts\";\n\nconst LOCK_TTL_MS = 30 * 60 * 1000;\n\ntype TodoLockRelease = () => Promise<void>;\n\nasync function readLockInfo(lockPath: string): Promise<LockInfo | null> {\n\ttry {\n\t\tconst raw = await fs.readFile(lockPath, \"utf8\");\n\t\treturn JSON.parse(raw) as LockInfo;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nasync function acquireLock(\n\ttodosDir: string,\n\tid: string,\n\tctx: ExtensionContext,\n): Promise<TodoLockRelease | TodoOperationError> {\n\tconst lockPath = getLockPath(todosDir, id);\n\tconst now = Date.now();\n\tconst session = ctx.sessionManager.getSessionFile();\n\n\tfor (let attempt = 0; attempt < 2; attempt += 1) {\n\t\ttry {\n\t\t\tconst handle = await fs.open(lockPath, \"wx\");\n\t\t\tconst info: LockInfo = {\n\t\t\t\tid,\n\t\t\t\tpid: process.pid,\n\t\t\t\tsession,\n\t\t\t\tcreated_at: new Date(now).toISOString(),\n\t\t\t};\n\t\t\tawait handle.writeFile(JSON.stringify(info, null, 2), \"utf8\");\n\t\t\tawait handle.close();\n\t\t\treturn async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait fs.unlink(lockPath);\n\t\t\t\t} catch {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst fsError = error as { code?: string; message?: string };\n\t\t\tif (fsError.code !== \"EEXIST\") {\n\t\t\t\treturn {\n\t\t\t\t\terror: `Failed to acquire lock: ${fsError.message ?? \"unknown error\"}`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst stats = await fs.stat(lockPath).catch(() => null);\n\t\t\tconst lockAge = stats ? now - stats.mtimeMs : LOCK_TTL_MS + 1;\n\t\t\tif (lockAge <= LOCK_TTL_MS) {\n\t\t\t\tconst info = await readLockInfo(lockPath);\n\t\t\t\tconst owner = info?.session ? ` (session ${info.session})` : \"\";\n\t\t\t\treturn {\n\t\t\t\t\terror: `Todo ${displayTodoId(id)} is locked${owner}. Try again later.`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!ctx.hasUI) {\n\t\t\t\treturn {\n\t\t\t\t\terror: `Todo ${displayTodoId(id)} lock is stale; rerun in interactive mode to steal it.`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst ok = await ctx.ui.confirm(\n\t\t\t\t\"Todo locked\",\n\t\t\t\t`Todo ${displayTodoId(id)} appears locked. Steal the lock?`,\n\t\t\t);\n\t\t\tif (!ok) {\n\t\t\t\treturn { error: `Todo ${displayTodoId(id)} remains locked.` };\n\t\t\t}\n\t\t\tawait fs.unlink(lockPath).catch(() => undefined);\n\t\t}\n\t}\n\n\treturn { error: `Failed to acquire lock for todo ${displayTodoId(id)}.` };\n}\n\nexport async function withTodoLock<T>(\n\ttodosDir: string,\n\tid: string,\n\tctx: ExtensionContext,\n\tfn: () => Promise<TodoOperationResult<T>>,\n): Promise<TodoOperationResult<T>> {\n\tconst lock = await acquireLock(todosDir, id, ctx);\n\tif (isTodoOperationError(lock)) return lock;\n\ttry {\n\t\treturn await fn();\n\t} finally {\n\t\tawait lock();\n\t}\n}\n"]}
1
+ {"version":3,"file":"todos-locks.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-locks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAIN,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AA6E1B,wBAAsB,YAAY,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,EACrB,EAAE,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAQjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos-model.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,cAAc,UAAU,CAAC;AAGtC,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CASlD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAM7E;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAE1D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAE3D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAInE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAUrE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG;IACjE,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,WAAW,EAAE,eAAe,EAAE,CAAC;CAC/B,CAgBA","sourcesContent":["import type { TodoFrontMatter } from \"./todos-types.ts\";\n\nexport const TODO_ID_PREFIX = \"TODO-\";\nconst TODO_ID_PATTERN = /^[a-f0-9]{8}$/i;\n\nexport function formatTodoId(id: string): string {\n\treturn `${TODO_ID_PREFIX}${id}`;\n}\n\nexport function normalizeTodoId(id: string): string {\n\tlet trimmed = id.trim();\n\tif (trimmed.startsWith(\"#\")) {\n\t\ttrimmed = trimmed.slice(1);\n\t}\n\tif (trimmed.toUpperCase().startsWith(TODO_ID_PREFIX)) {\n\t\ttrimmed = trimmed.slice(TODO_ID_PREFIX.length);\n\t}\n\treturn trimmed;\n}\n\nexport function validateTodoId(id: string): { id: string } | { error: string } {\n\tconst normalized = normalizeTodoId(id);\n\tif (!normalized || !TODO_ID_PATTERN.test(normalized)) {\n\t\treturn { error: \"Invalid todo id. Expected TODO-<hex>.\" };\n\t}\n\treturn { id: normalized.toLowerCase() };\n}\n\nexport function displayTodoId(id: string): string {\n\treturn formatTodoId(normalizeTodoId(id));\n}\n\nexport function isTodoClosed(status: string): boolean {\n\treturn [\"closed\", \"done\"].includes(status.toLowerCase());\n}\n\nexport function getTodoTitle(todo: TodoFrontMatter): string {\n\treturn todo.title || \"(untitled)\";\n}\n\nexport function getTodoStatus(todo: TodoFrontMatter): string {\n\treturn todo.status || \"open\";\n}\n\nexport function clearAssignmentIfClosed(todo: TodoFrontMatter): void {\n\tif (isTodoClosed(getTodoStatus(todo))) {\n\t\ttodo.assigned_to_session = undefined;\n\t}\n}\n\nexport function sortTodos(todos: TodoFrontMatter[]): TodoFrontMatter[] {\n\treturn [...todos].sort((a, b) => {\n\t\tconst aClosed = isTodoClosed(a.status);\n\t\tconst bClosed = isTodoClosed(b.status);\n\t\tif (aClosed !== bClosed) return aClosed ? 1 : -1;\n\t\tconst aAssigned = !aClosed && Boolean(a.assigned_to_session);\n\t\tconst bAssigned = !bClosed && Boolean(b.assigned_to_session);\n\t\tif (aAssigned !== bAssigned) return aAssigned ? -1 : 1;\n\t\treturn (a.created_at || \"\").localeCompare(b.created_at || \"\");\n\t});\n}\n\nexport function splitTodosByAssignment(todos: TodoFrontMatter[]): {\n\tassignedTodos: TodoFrontMatter[];\n\topenTodos: TodoFrontMatter[];\n\tclosedTodos: TodoFrontMatter[];\n} {\n\tconst assignedTodos: TodoFrontMatter[] = [];\n\tconst openTodos: TodoFrontMatter[] = [];\n\tconst closedTodos: TodoFrontMatter[] = [];\n\tfor (const todo of todos) {\n\t\tif (isTodoClosed(getTodoStatus(todo))) {\n\t\t\tclosedTodos.push(todo);\n\t\t\tcontinue;\n\t\t}\n\t\tif (todo.assigned_to_session) {\n\t\t\tassignedTodos.push(todo);\n\t\t} else {\n\t\t\topenTodos.push(todo);\n\t\t}\n\t}\n\treturn { assignedTodos, openTodos, closedTodos };\n}\n"]}
1
+ {"version":3,"file":"todos-model.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,cAAc,UAAU,CAAC;AAGtC,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/C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E,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,EACrB,KAAK,UAAQ,GACX,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CA2B1C;AAED,wBAAsB,UAAU,CAC/B,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAiB1C","sourcesContent":["import { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport type { ExtensionContext } from \"../extensions/types.ts\";\nimport { displayTodoId, isTodoClosed, validateTodoId } from \"./todos-model.ts\";\nimport { getTodoPath } from \"./todos-paths.ts\";\nimport { withTodoLock } from \"./todos-locks.ts\";\nimport { ensureTodoExists, writeTodoFile } from \"./todos-storage.ts\";\nimport type { TodoOperationResult, TodoRecord } from \"./todos-types.ts\";\n\nexport async function claimTodoAssignment(\n\ttodosDir: string,\n\tid: string,\n\tctx: ExtensionContext,\n\tforce = false,\n): Promise<TodoOperationResult<TodoRecord>> {\n\tconst validated = validateTodoId(id);\n\tif (\"error\" in validated) {\n\t\treturn { error: validated.error };\n\t}\n\tconst normalizedId = validated.id;\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tif (!existsSync(filePath)) {\n\t\treturn { error: `Todo ${displayTodoId(id)} not found` };\n\t}\n\tconst sessionId = ctx.sessionManager.getSessionId();\n\treturn withTodoLock<TodoRecord>(todosDir, normalizedId, ctx, async () => {\n\t\tconst existing = await ensureTodoExists(filePath, normalizedId);\n\t\tif (!existing) return { error: `Todo ${displayTodoId(id)} not found` };\n\t\tif (isTodoClosed(existing.status)) {\n\t\t\treturn { error: `Todo ${displayTodoId(id)} is closed` };\n\t\t}\n\t\tconst assigned = existing.assigned_to_session;\n\t\tif (assigned && assigned !== sessionId && !force) {\n\t\t\treturn {\n\t\t\t\terror: `Todo ${displayTodoId(id)} is already assigned to session ${assigned}. Use force to override.`,\n\t\t\t};\n\t\t}\n\t\tif (assigned !== sessionId) {\n\t\t\texisting.assigned_to_session = sessionId;\n\t\t\tawait writeTodoFile(filePath, existing);\n\t\t}\n\t\treturn existing;\n\t});\n}\n\nexport async function releaseTodoAssignment(\n\ttodosDir: string,\n\tid: string,\n\tctx: ExtensionContext,\n\tforce = false,\n): Promise<TodoOperationResult<TodoRecord>> {\n\tconst validated = validateTodoId(id);\n\tif (\"error\" in validated) {\n\t\treturn { error: validated.error };\n\t}\n\tconst normalizedId = validated.id;\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tif (!existsSync(filePath)) {\n\t\treturn { error: `Todo ${displayTodoId(id)} not found` };\n\t}\n\tconst sessionId = ctx.sessionManager.getSessionId();\n\treturn withTodoLock<TodoRecord>(todosDir, normalizedId, ctx, async () => {\n\t\tconst existing = await ensureTodoExists(filePath, normalizedId);\n\t\tif (!existing) return { error: `Todo ${displayTodoId(id)} not found` };\n\t\tconst assigned = existing.assigned_to_session;\n\t\tif (!assigned) {\n\t\t\treturn existing;\n\t\t}\n\t\tif (assigned !== sessionId && !force) {\n\t\t\treturn {\n\t\t\t\terror: `Todo ${displayTodoId(id)} is assigned to session ${assigned}. Use force to release.`,\n\t\t\t};\n\t\t}\n\t\texisting.assigned_to_session = undefined;\n\t\tawait writeTodoFile(filePath, existing);\n\t\treturn existing;\n\t});\n}\n\nexport async function deleteTodo(\n\ttodosDir: string,\n\tid: string,\n\tctx: ExtensionContext,\n): Promise<TodoOperationResult<TodoRecord>> {\n\tconst validated = validateTodoId(id);\n\tif (\"error\" in validated) {\n\t\treturn { error: validated.error };\n\t}\n\tconst normalizedId = validated.id;\n\tconst filePath = getTodoPath(todosDir, normalizedId);\n\tif (!existsSync(filePath)) {\n\t\treturn { error: `Todo ${displayTodoId(id)} not found` };\n\t}\n\n\treturn withTodoLock<TodoRecord>(todosDir, normalizedId, ctx, async () => {\n\t\tconst existing = await ensureTodoExists(filePath, normalizedId);\n\t\tif (!existing) return { error: `Todo ${displayTodoId(id)} not found` };\n\t\tawait fs.unlink(filePath);\n\t\treturn existing;\n\t});\n}\n"]}
1
+ {"version":3,"file":"todos-mutations.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-mutations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAExE,wBAAsB,mBAAmB,CACxC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,EACrB,KAAK,UAAQ,GACX,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CA6B1C;AAED,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,EACrB,KAAK,UAAQ,GACX,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CA2B1C;AAED,wBAAsB,UAAU,CAC/B,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAiB1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos-paths.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-paths.ts"],"names":[],"mappings":"AAMA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhE","sourcesContent":["import path from \"node:path\";\nimport { APP_NAME, CONFIG_DIR_NAME, getEnvValue } from \"../../config.ts\";\n\nconst TODO_DIR_NAME = `${CONFIG_DIR_NAME}/todos`;\nconst TODO_PATH_ENV = `${APP_NAME.toUpperCase()}_TODO_PATH`;\n\nexport function getTodosDir(cwd: string): string {\n\tconst overridePath = getEnvValue(TODO_PATH_ENV);\n\tif (overridePath && overridePath.trim()) {\n\t\treturn path.resolve(cwd, overridePath.trim());\n\t}\n\treturn path.resolve(cwd, TODO_DIR_NAME);\n}\n\nexport function getTodosDirLabel(cwd: string): string {\n\tconst overridePath = getEnvValue(TODO_PATH_ENV);\n\tif (overridePath && overridePath.trim()) {\n\t\treturn path.resolve(cwd, overridePath.trim());\n\t}\n\treturn TODO_DIR_NAME;\n}\n\nexport function getTodoPath(todosDir: string, id: string): string {\n\treturn path.join(todosDir, `${id}.md`);\n}\n\nexport function getLockPath(todosDir: string, id: string): string {\n\treturn path.join(todosDir, `${id}.lock`);\n}\n"]}
1
+ {"version":3,"file":"todos-paths.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-paths.ts"],"names":[],"mappings":"AAMA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos-render.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAG9D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,CAe1E;AAiHD,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAavE;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC,EACxC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,uBAAuB,EAChD,KAAK,EAAE,KAAK,GACV,IAAI,CAyCN","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport { Text } from \"@earendil-works/pi-tui\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport {\n\tformatTodoId,\n\tgetTodoStatus,\n\tgetTodoTitle,\n\tisTodoClosed,\n\tnormalizeTodoId,\n\tsplitTodosByAssignment,\n} from \"./todos-model.ts\";\nimport type { TodoFrontMatter, TodoRecord, TodoToolDetails, TodoToolParams } from \"./todos-types.ts\";\n\nexport function serializeTodoForAgent(todo: TodoRecord): string {\n\tconst payload = { ...todo, id: formatTodoId(todo.id) };\n\treturn JSON.stringify(payload, null, 2);\n}\n\nexport function serializeTodoListForAgent(todos: TodoFrontMatter[]): string {\n\tconst { assignedTodos, openTodos, closedTodos } = splitTodosByAssignment(todos);\n\tconst mapTodo = (todo: TodoFrontMatter) => ({\n\t\t...todo,\n\t\tid: formatTodoId(todo.id),\n\t});\n\treturn JSON.stringify(\n\t\t{\n\t\t\tassigned: assignedTodos.map(mapTodo),\n\t\t\topen: openTodos.map(mapTodo),\n\t\t\tclosed: closedTodos.map(mapTodo),\n\t\t},\n\t\tnull,\n\t\t2,\n\t);\n}\n\nfunction renderAssignmentSuffix(\n\ttheme: Theme,\n\ttodo: TodoFrontMatter,\n\tcurrentSessionId?: string,\n): string {\n\tif (!todo.assigned_to_session) return \"\";\n\tconst isCurrent = todo.assigned_to_session === currentSessionId;\n\tconst color = isCurrent ? \"success\" : \"dim\";\n\tconst suffix = isCurrent ? \", current\" : \"\";\n\treturn theme.fg(color, ` (assigned: ${todo.assigned_to_session}${suffix})`);\n}\n\nfunction renderTodoHeading(\n\ttheme: Theme,\n\ttodo: TodoFrontMatter,\n\tcurrentSessionId?: string,\n): string {\n\tconst closed = isTodoClosed(getTodoStatus(todo));\n\tconst titleColor = closed ? \"dim\" : \"text\";\n\tconst tagText = todo.tags.length ? theme.fg(\"dim\", ` [${todo.tags.join(\", \")}]`) : \"\";\n\tconst assignmentText = renderAssignmentSuffix(theme, todo, currentSessionId);\n\treturn (\n\t\ttheme.fg(\"accent\", formatTodoId(todo.id)) +\n\t\t\" \" +\n\t\ttheme.fg(titleColor, getTodoTitle(todo)) +\n\t\ttagText +\n\t\tassignmentText\n\t);\n}\n\nfunction renderTodoList(\n\ttheme: Theme,\n\ttodos: TodoFrontMatter[],\n\texpanded: boolean,\n\tcurrentSessionId?: string,\n): string {\n\tif (!todos.length) return theme.fg(\"dim\", \"No todos\");\n\n\tconst { assignedTodos, openTodos, closedTodos } = splitTodosByAssignment(todos);\n\tconst lines: string[] = [];\n\tconst pushSection = (label: string, sectionTodos: TodoFrontMatter[]) => {\n\t\tlines.push(theme.fg(\"muted\", `${label} (${sectionTodos.length})`));\n\t\tif (!sectionTodos.length) {\n\t\t\tlines.push(theme.fg(\"dim\", \" none\"));\n\t\t\treturn;\n\t\t}\n\t\tconst maxItems = expanded ? sectionTodos.length : Math.min(sectionTodos.length, 3);\n\t\tfor (let i = 0; i < maxItems; i++) {\n\t\t\tlines.push(` ${renderTodoHeading(theme, sectionTodos[i], currentSessionId)}`);\n\t\t}\n\t\tif (!expanded && sectionTodos.length > maxItems) {\n\t\t\tlines.push(theme.fg(\"dim\", ` ... ${sectionTodos.length - maxItems} more`));\n\t\t}\n\t};\n\n\tconst sections: Array<{ label: string; todos: TodoFrontMatter[] }> = [\n\t\t{ label: \"Assigned todos\", todos: assignedTodos },\n\t\t{ label: \"Open todos\", todos: openTodos },\n\t\t{ label: \"Closed todos\", todos: closedTodos },\n\t];\n\n\tsections.forEach((section, index) => {\n\t\tif (index > 0) lines.push(\"\");\n\t\tpushSection(section.label, section.todos);\n\t});\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction renderTodoDetail(theme: Theme, todo: TodoRecord, expanded: boolean): string {\n\tconst summary = renderTodoHeading(theme, todo);\n\tif (!expanded) return summary;\n\n\tconst tags = todo.tags.length ? todo.tags.join(\", \") : \"none\";\n\tconst createdAt = todo.created_at || \"unknown\";\n\tconst bodyText = todo.body?.trim() ? todo.body.trim() : \"No details yet.\";\n\tconst bodyLines = bodyText.split(\"\\n\");\n\n\tconst lines = [\n\t\tsummary,\n\t\ttheme.fg(\"muted\", `Status: ${getTodoStatus(todo)}`),\n\t\ttheme.fg(\"muted\", `Tags: ${tags}`),\n\t\ttheme.fg(\"muted\", `Created: ${createdAt}`),\n\t\t\"\",\n\t\ttheme.fg(\"muted\", \"Body:\"),\n\t\t...bodyLines.map((line) => theme.fg(\"text\", ` ${line}`)),\n\t];\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction appendExpandHint(theme: Theme, text: string): string {\n\treturn `${text}\\n${theme.fg(\"dim\", `(${keyHint(\"app.tools.expand\", \"Expand\")})`)}`;\n}\n\nfunction getActionLabel(action: TodoToolDetails[\"action\"]): string | null {\n\treturn action === \"create\"\n\t\t? \"Created\"\n\t\t: action === \"update\"\n\t\t\t? \"Updated\"\n\t\t\t: action === \"append\"\n\t\t\t\t? \"Appended to\"\n\t\t\t\t: action === \"delete\"\n\t\t\t\t\t? \"Deleted\"\n\t\t\t\t\t: action === \"claim\"\n\t\t\t\t\t\t? \"Claimed\"\n\t\t\t\t\t\t: action === \"release\"\n\t\t\t\t\t\t\t? \"Released\"\n\t\t\t\t\t\t\t: null;\n}\n\nexport function renderTodoCall(args: TodoToolParams, theme: Theme): Text {\n\tconst action = typeof args.action === \"string\" ? args.action : \"\";\n\tconst id = typeof args.id === \"string\" ? args.id : \"\";\n\tconst normalizedId = id ? normalizeTodoId(id) : \"\";\n\tconst title = typeof args.title === \"string\" ? args.title : \"\";\n\tlet text = theme.fg(\"toolTitle\", theme.bold(\"todo \")) + theme.fg(\"muted\", action);\n\tif (normalizedId) {\n\t\ttext += \" \" + theme.fg(\"accent\", formatTodoId(normalizedId));\n\t}\n\tif (title) {\n\t\ttext += \" \" + theme.fg(\"dim\", `\"${title}\"`);\n\t}\n\treturn new Text(text, 0, 0);\n}\n\nexport function renderTodoResult(\n\tresult: AgentToolResult<TodoToolDetails>,\n\t{ expanded, isPartial }: ToolRenderResultOptions,\n\ttheme: Theme,\n): Text {\n\tconst details = result.details as TodoToolDetails | undefined;\n\tif (isPartial) {\n\t\treturn new Text(theme.fg(\"warning\", \"Processing...\"), 0, 0);\n\t}\n\tif (!details) {\n\t\tconst text = result.content[0];\n\t\treturn new Text(text?.type === \"text\" ? text.text : \"\", 0, 0);\n\t}\n\n\tif (details.error) {\n\t\treturn new Text(theme.fg(\"error\", `Error: ${details.error}`), 0, 0);\n\t}\n\n\tif (details.action === \"list\" || details.action === \"list-all\") {\n\t\tlet text = renderTodoList(theme, details.todos, expanded, details.currentSessionId);\n\t\tif (!expanded) {\n\t\t\tconst { closedTodos } = splitTodosByAssignment(details.todos);\n\t\t\tif (closedTodos.length) {\n\t\t\t\ttext = appendExpandHint(theme, text);\n\t\t\t}\n\t\t}\n\t\treturn new Text(text, 0, 0);\n\t}\n\n\tif (!(\"todo\" in details) || !details.todo) {\n\t\tconst text = result.content[0];\n\t\treturn new Text(text?.type === \"text\" ? text.text : \"\", 0, 0);\n\t}\n\n\tlet text = renderTodoDetail(theme, details.todo, expanded);\n\tconst actionLabel = getActionLabel(details.action);\n\tif (actionLabel) {\n\t\tconst lines = text.split(\"\\n\");\n\t\tlines[0] = theme.fg(\"success\", \"✓ \") + theme.fg(\"muted\", `${actionLabel} `) + lines[0];\n\t\ttext = lines.join(\"\\n\");\n\t}\n\tif (!expanded) {\n\t\ttext = appendExpandHint(theme, text);\n\t}\n\treturn new Text(text, 0, 0);\n}\n"]}
1
+ {"version":3,"file":"todos-render.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAG9D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,CAe1E;AAiHD,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAavE;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC,EACxC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,uBAAuB,EAChD,KAAK,EAAE,KAAK,GACV,IAAI,CAyCN"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos-storage.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-storage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiIpE,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAEpD;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAG5F;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,iBAErE;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOtE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA+B5E;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAG/F;AAED,wBAAsB,cAAc,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CAKrB","sourcesContent":["import crypto from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { sortTodos } from \"./todos-model.ts\";\nimport { getTodoPath } from \"./todos-paths.ts\";\nimport type { TodoFrontMatter, TodoRecord } from \"./todos-types.ts\";\n\nfunction parseFrontMatter(text: string, idFallback: string): TodoFrontMatter {\n\tconst data: TodoFrontMatter = {\n\t\tid: idFallback,\n\t\ttitle: \"\",\n\t\ttags: [],\n\t\tstatus: \"open\",\n\t\tcreated_at: \"\",\n\t\tassigned_to_session: undefined,\n\t};\n\n\tconst trimmed = text.trim();\n\tif (!trimmed) return data;\n\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed) as Partial<TodoFrontMatter> | null;\n\t\tif (!parsed || typeof parsed !== \"object\") return data;\n\t\tif (typeof parsed.id === \"string\" && parsed.id) data.id = parsed.id;\n\t\tif (typeof parsed.title === \"string\") data.title = parsed.title;\n\t\tif (typeof parsed.status === \"string\" && parsed.status) data.status = parsed.status;\n\t\tif (typeof parsed.created_at === \"string\") data.created_at = parsed.created_at;\n\t\tif (\n\t\t\ttypeof parsed.assigned_to_session === \"string\" &&\n\t\t\tparsed.assigned_to_session.trim()\n\t\t) {\n\t\t\tdata.assigned_to_session = parsed.assigned_to_session;\n\t\t}\n\t\tif (Array.isArray(parsed.tags)) {\n\t\t\tdata.tags = parsed.tags.filter((tag): tag is string => typeof tag === \"string\");\n\t\t}\n\t} catch {\n\t\treturn data;\n\t}\n\n\treturn data;\n}\n\nfunction findJsonObjectEnd(content: string): number {\n\tlet depth = 0;\n\tlet inString = false;\n\tlet escaped = false;\n\n\tfor (let i = 0; i < content.length; i += 1) {\n\t\tconst char = content[i];\n\n\t\tif (inString) {\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tescaped = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === '\"') {\n\t\t\t\tinString = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === '\"') {\n\t\t\tinString = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === \"{\") {\n\t\t\tdepth += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === \"}\") {\n\t\t\tdepth -= 1;\n\t\t\tif (depth === 0) return i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction splitFrontMatter(content: string): { frontMatter: string; body: string } {\n\tif (!content.startsWith(\"{\")) {\n\t\treturn { frontMatter: \"\", body: content };\n\t}\n\n\tconst endIndex = findJsonObjectEnd(content);\n\tif (endIndex === -1) {\n\t\treturn { frontMatter: \"\", body: content };\n\t}\n\n\tconst frontMatter = content.slice(0, endIndex + 1);\n\tconst body = content.slice(endIndex + 1).replace(/^\\r?\\n+/, \"\");\n\treturn { frontMatter, body };\n}\n\nfunction parseTodoContent(content: string, idFallback: string): TodoRecord {\n\tconst { frontMatter, body } = splitFrontMatter(content);\n\tconst parsed = parseFrontMatter(frontMatter, idFallback);\n\treturn {\n\t\tid: idFallback,\n\t\ttitle: parsed.title,\n\t\ttags: parsed.tags ?? [],\n\t\tstatus: parsed.status,\n\t\tcreated_at: parsed.created_at,\n\t\tassigned_to_session: parsed.assigned_to_session,\n\t\tbody: body ?? \"\",\n\t};\n}\n\nfunction serializeTodo(todo: TodoRecord): string {\n\tconst frontMatter = JSON.stringify(\n\t\t{\n\t\t\tid: todo.id,\n\t\t\ttitle: todo.title,\n\t\t\ttags: todo.tags ?? [],\n\t\t\tstatus: todo.status,\n\t\t\tcreated_at: todo.created_at,\n\t\t\tassigned_to_session: todo.assigned_to_session || undefined,\n\t\t},\n\t\tnull,\n\t\t2,\n\t);\n\n\tconst body = todo.body ?? \"\";\n\tconst trimmedBody = body.replace(/^\\n+/, \"\").replace(/\\s+$/, \"\");\n\tif (!trimmedBody) return `${frontMatter}\\n`;\n\treturn `${frontMatter}\\n\\n${trimmedBody}\\n`;\n}\n\nexport async function ensureTodosDir(todosDir: string) {\n\tawait fs.mkdir(todosDir, { recursive: true });\n}\n\nexport async function readTodoFile(filePath: string, idFallback: string): Promise<TodoRecord> {\n\tconst content = await fs.readFile(filePath, \"utf8\");\n\treturn parseTodoContent(content, idFallback);\n}\n\nexport async function writeTodoFile(filePath: string, todo: TodoRecord) {\n\tawait fs.writeFile(filePath, serializeTodo(todo), \"utf8\");\n}\n\nexport async function generateTodoId(todosDir: string): Promise<string> {\n\tfor (let attempt = 0; attempt < 10; attempt += 1) {\n\t\tconst id = crypto.randomBytes(4).toString(\"hex\");\n\t\tconst todoPath = getTodoPath(todosDir, id);\n\t\tif (!existsSync(todoPath)) return id;\n\t}\n\tthrow new Error(\"Failed to generate unique todo id\");\n}\n\nexport async function listTodos(todosDir: string): Promise<TodoFrontMatter[]> {\n\tlet entries: string[] = [];\n\ttry {\n\t\tentries = await fs.readdir(todosDir);\n\t} catch {\n\t\treturn [];\n\t}\n\n\tconst todos: TodoFrontMatter[] = [];\n\tfor (const entry of entries) {\n\t\tif (!entry.endsWith(\".md\")) continue;\n\t\tconst id = entry.slice(0, -3);\n\t\tconst filePath = path.join(todosDir, entry);\n\t\ttry {\n\t\t\tconst content = await fs.readFile(filePath, \"utf8\");\n\t\t\tconst { frontMatter } = splitFrontMatter(content);\n\t\t\tconst parsed = parseFrontMatter(frontMatter, id);\n\t\t\ttodos.push({\n\t\t\t\tid,\n\t\t\t\ttitle: parsed.title,\n\t\t\t\ttags: parsed.tags ?? [],\n\t\t\t\tstatus: parsed.status,\n\t\t\t\tcreated_at: parsed.created_at,\n\t\t\t\tassigned_to_session: parsed.assigned_to_session,\n\t\t\t});\n\t\t} catch {\n\t\t\t// ignore unreadable todo\n\t\t}\n\t}\n\n\treturn sortTodos(todos);\n}\n\nexport async function ensureTodoExists(filePath: string, id: string): Promise<TodoRecord | null> {\n\tif (!existsSync(filePath)) return null;\n\treturn readTodoFile(filePath, id);\n}\n\nexport async function appendTodoBody(\n\tfilePath: string,\n\ttodo: TodoRecord,\n\ttext: string,\n): Promise<TodoRecord> {\n\tconst spacer = todo.body.trim().length ? \"\\n\\n\" : \"\";\n\ttodo.body = `${todo.body.replace(/\\s+$/, \"\")}${spacer}${text.trim()}\\n`;\n\tawait writeTodoFile(filePath, todo);\n\treturn todo;\n}\n"]}
1
+ {"version":3,"file":"todos-storage.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-storage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiIpE,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAEpD;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAG5F;AAED,wBAAsB,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AAM,UAAU,GACnB,MAAM,GACN,UAAU,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,CAAC;AAEb,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAExE,MAAM,MAAM,eAAe,GACxB;IACA,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,GACD;IACA,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEL,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC;AAE5D,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,kBAAkB,CAEpG","sourcesContent":["import { StringEnum } from \"@earendil-works/pi-ai/compat\";\nimport { type Static, Type } from \"typebox\";\n\nexport interface TodoFrontMatter {\n\tid: string;\n\ttitle: string;\n\ttags: string[];\n\tstatus: string;\n\tcreated_at: string;\n\tassigned_to_session?: string;\n}\n\nexport interface TodoRecord extends TodoFrontMatter {\n\tbody: string;\n}\n\nexport interface LockInfo {\n\tid: string;\n\tpid: number;\n\tsession?: string | null;\n\tcreated_at: string;\n}\n\nexport const TodoParams = Type.Object({\n\taction: StringEnum([\n\t\t\"list\",\n\t\t\"list-all\",\n\t\t\"get\",\n\t\t\"create\",\n\t\t\"update\",\n\t\t\"append\",\n\t\t\"delete\",\n\t\t\"claim\",\n\t\t\"release\",\n\t] as const),\n\tid: Type.Optional(Type.String({ description: \"Todo id (TODO-<hex> or raw hex filename)\" })),\n\ttitle: Type.Optional(Type.String({ description: \"Short summary shown in lists\" })),\n\tstatus: Type.Optional(Type.String({ description: \"Todo status\" })),\n\ttags: Type.Optional(Type.Array(Type.String({ description: \"Todo tag\" }))),\n\tbody: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Long-form details (markdown). Update replaces; append adds.\",\n\t\t}),\n\t),\n\tforce: Type.Optional(Type.Boolean({ description: \"Override another session's assignment\" })),\n});\n\nexport type TodoToolParams = Static<typeof TodoParams>;\n\nexport type TodoAction =\n\t| \"list\"\n\t| \"list-all\"\n\t| \"get\"\n\t| \"create\"\n\t| \"update\"\n\t| \"append\"\n\t| \"delete\"\n\t| \"claim\"\n\t| \"release\";\n\nexport type TodoRecordAction = Exclude<TodoAction, \"list\" | \"list-all\">;\n\nexport type TodoToolDetails =\n\t| {\n\t\t\taction: \"list\" | \"list-all\";\n\t\t\ttodos: TodoFrontMatter[];\n\t\t\tcurrentSessionId?: string;\n\t\t\terror?: string;\n\t }\n\t| {\n\t\t\taction: TodoRecordAction;\n\t\t\ttodo?: TodoRecord;\n\t\t\terror?: string;\n\t };\n\nexport interface TodoOperationError {\n\terror: string;\n}\n\nexport type TodoOperationResult<T> = T | TodoOperationError;\n\nexport function isTodoOperationError<T>(result: TodoOperationResult<T>): result is TodoOperationError {\n\treturn typeof result === \"object\" && result !== null && \"error\" in result;\n}\n"]}
1
+ {"version":3,"file":"todos-types.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,mBAA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typebox";
2
+ import { StringEnum } from "../typebox-compat.js";
3
3
  export const TodoParams = Type.Object({
4
4
  action: StringEnum([
5
5
  "list",
@@ -1 +1 @@
1
- {"version":3,"file":"todos-types.js","sourceRoot":"","sources":["../../../src/core/tools/todos-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAsB5C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,UAAU,CAAC;QAClB,MAAM;QACN,UAAU;QACV,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,SAAS;KACA,CAAC;IACX,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC,CAAC;IAC3F,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC,CAAC;IAClF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;IAClE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACzE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,6DAA6D;KAC1E,CAAC,CACF;IACD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC;AAoCH,MAAM,UAAU,oBAAoB,CAAI,MAA8B;IACrE,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,IAAI,MAAM,CAAC;AAC3E,CAAC","sourcesContent":["import { StringEnum } from \"@earendil-works/pi-ai/compat\";\nimport { type Static, Type } from \"typebox\";\n\nexport interface TodoFrontMatter {\n\tid: string;\n\ttitle: string;\n\ttags: string[];\n\tstatus: string;\n\tcreated_at: string;\n\tassigned_to_session?: string;\n}\n\nexport interface TodoRecord extends TodoFrontMatter {\n\tbody: string;\n}\n\nexport interface LockInfo {\n\tid: string;\n\tpid: number;\n\tsession?: string | null;\n\tcreated_at: string;\n}\n\nexport const TodoParams = Type.Object({\n\taction: StringEnum([\n\t\t\"list\",\n\t\t\"list-all\",\n\t\t\"get\",\n\t\t\"create\",\n\t\t\"update\",\n\t\t\"append\",\n\t\t\"delete\",\n\t\t\"claim\",\n\t\t\"release\",\n\t] as const),\n\tid: Type.Optional(Type.String({ description: \"Todo id (TODO-<hex> or raw hex filename)\" })),\n\ttitle: Type.Optional(Type.String({ description: \"Short summary shown in lists\" })),\n\tstatus: Type.Optional(Type.String({ description: \"Todo status\" })),\n\ttags: Type.Optional(Type.Array(Type.String({ description: \"Todo tag\" }))),\n\tbody: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Long-form details (markdown). Update replaces; append adds.\",\n\t\t}),\n\t),\n\tforce: Type.Optional(Type.Boolean({ description: \"Override another session's assignment\" })),\n});\n\nexport type TodoToolParams = Static<typeof TodoParams>;\n\nexport type TodoAction =\n\t| \"list\"\n\t| \"list-all\"\n\t| \"get\"\n\t| \"create\"\n\t| \"update\"\n\t| \"append\"\n\t| \"delete\"\n\t| \"claim\"\n\t| \"release\";\n\nexport type TodoRecordAction = Exclude<TodoAction, \"list\" | \"list-all\">;\n\nexport type TodoToolDetails =\n\t| {\n\t\t\taction: \"list\" | \"list-all\";\n\t\t\ttodos: TodoFrontMatter[];\n\t\t\tcurrentSessionId?: string;\n\t\t\terror?: string;\n\t }\n\t| {\n\t\t\taction: TodoRecordAction;\n\t\t\ttodo?: TodoRecord;\n\t\t\terror?: string;\n\t };\n\nexport interface TodoOperationError {\n\terror: string;\n}\n\nexport type TodoOperationResult<T> = T | TodoOperationError;\n\nexport function isTodoOperationError<T>(result: TodoOperationResult<T>): result is TodoOperationError {\n\treturn typeof result === \"object\" && result !== null && \"error\" in result;\n}\n"]}
1
+ {"version":3,"file":"todos-types.js","sourceRoot":"","sources":["../../../src/core/tools/todos-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAsBlD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,UAAU,CAAC;QAClB,MAAM;QACN,UAAU;QACV,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,SAAS;KACA,CAAC;IACX,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC,CAAC;IAC3F,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC,CAAC;IAClF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;IAClE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACzE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,6DAA6D;KAC1E,CAAC,CACF;IACD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC;AAoCH,MAAM,UAAU,oBAAoB,CAAI,MAA8B;IACrE,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,IAAI,MAAM,CAAC;AAC3E,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { StringEnum } from \"../typebox-compat.ts\";\n\nexport interface TodoFrontMatter {\n\tid: string;\n\ttitle: string;\n\ttags: string[];\n\tstatus: string;\n\tcreated_at: string;\n\tassigned_to_session?: string;\n}\n\nexport interface TodoRecord extends TodoFrontMatter {\n\tbody: string;\n}\n\nexport interface LockInfo {\n\tid: string;\n\tpid: number;\n\tsession?: string | null;\n\tcreated_at: string;\n}\n\nexport const TodoParams = Type.Object({\n\taction: StringEnum([\n\t\t\"list\",\n\t\t\"list-all\",\n\t\t\"get\",\n\t\t\"create\",\n\t\t\"update\",\n\t\t\"append\",\n\t\t\"delete\",\n\t\t\"claim\",\n\t\t\"release\",\n\t] as const),\n\tid: Type.Optional(Type.String({ description: \"Todo id (TODO-<hex> or raw hex filename)\" })),\n\ttitle: Type.Optional(Type.String({ description: \"Short summary shown in lists\" })),\n\tstatus: Type.Optional(Type.String({ description: \"Todo status\" })),\n\ttags: Type.Optional(Type.Array(Type.String({ description: \"Todo tag\" }))),\n\tbody: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Long-form details (markdown). Update replaces; append adds.\",\n\t\t}),\n\t),\n\tforce: Type.Optional(Type.Boolean({ description: \"Override another session's assignment\" })),\n});\n\nexport type TodoToolParams = Static<typeof TodoParams>;\n\nexport type TodoAction =\n\t| \"list\"\n\t| \"list-all\"\n\t| \"get\"\n\t| \"create\"\n\t| \"update\"\n\t| \"append\"\n\t| \"delete\"\n\t| \"claim\"\n\t| \"release\";\n\nexport type TodoRecordAction = Exclude<TodoAction, \"list\" | \"list-all\">;\n\nexport type TodoToolDetails =\n\t| {\n\t\t\taction: \"list\" | \"list-all\";\n\t\t\ttodos: TodoFrontMatter[];\n\t\t\tcurrentSessionId?: string;\n\t\t\terror?: string;\n\t }\n\t| {\n\t\t\taction: TodoRecordAction;\n\t\t\ttodo?: TodoRecord;\n\t\t\terror?: string;\n\t };\n\nexport interface TodoOperationError {\n\terror: string;\n}\n\nexport type TodoOperationResult<T> = T | TodoOperationError;\n\nexport function isTodoOperationError<T>(result: TodoOperationResult<T>): result is TodoOperationError {\n\treturn typeof result === \"object\" && result !== null && \"error\" in result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpE,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAE3C,CAAC;AAEF,wBAAgB,wBAAwB,CACvC,GAAG,GAAE,MAAsB,GACzB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,CAAC,CAiBpD","sourcesContent":["/**\n * This tool stores todo items as files under <todo-dir> (defaults to\n * <CONFIG_DIR_NAME>/todos, or the path in <APP_NAME>_TODO_PATH). Each todo is\n * a standalone markdown file named <id>.md and an optional <id>.lock file is\n * used while a session is editing it.\n *\n * File format in <CONFIG_DIR_NAME>/todos:\n * - The file starts with a JSON object (not YAML) containing the front matter:\n * { id, title, tags, status, created_at, assigned_to_session }\n * - After the JSON block comes optional markdown body text separated by a blank line.\n */\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { executeTodoToolAction } from \"./todos-execute.ts\";\nimport { getTodosDirLabel } from \"./todos-paths.ts\";\nimport { renderTodoCall, renderTodoResult } from \"./todos-render.ts\";\nimport { TodoParams, type TodoToolDetails } from \"./todos-types.ts\";\n\nexport const DEFAULT_PROMPT_GUIDANCE: string[] = [\n\t\"**To-do management**: If the user has a complex task that can be broken down into actionable steps, use the `todo` tool to create a task list before proceeding. This ensures clarity and alignment with the user's goals and that you have a way to track your work and ensure you are meeting the user's expectations.\",\n];\n\nexport function createTodoToolDefinition(\n\tcwd: string = process.cwd(),\n): ToolDefinition<typeof TodoParams, TodoToolDetails> {\n\tconst todosDirLabel = getTodosDirLabel(cwd);\n\n\treturn {\n\t\tname: \"todo\",\n\t\tlabel: \"Todo\",\n\t\tdescription:\n\t\t\t`Manage file-based todos in ${todosDirLabel} (list, list-all, get, create, update, append, delete, claim, release). ` +\n\t\t\t\"Title is the short summary; body is long-form markdown notes (update replaces, append adds). \" +\n\t\t\t\"Todo ids are shown as TODO-<hex>; id parameters accept TODO-<hex> or the raw hex filename. \" +\n\t\t\t\"Claim tasks before working on them to avoid conflicts, and close them when complete.\",\n\t\tparameters: TodoParams,\n\t\tpromptGuidelines: DEFAULT_PROMPT_GUIDANCE,\n\t\texecute: (_toolCallId, params, _signal, _onUpdate, ctx) => executeTodoToolAction(params, ctx),\n\t\trenderCall: renderTodoCall,\n\t\trenderResult: renderTodoResult,\n\t};\n}\n"]}
1
+ {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/core/tools/todos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpE,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAE3C,CAAC;AAEF,wBAAgB,wBAAwB,CACvC,GAAG,GAAE,MAAsB,GACzB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,CAAC,CAiBpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-definition-wrapper.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,QAAQ,+BAA+B,CAAC,CAAC;IAC/C,UAAU,SAAS,CAAC,WAAW,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,GAAG;QACxE,qGAAqG;QACrG,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC5B;CACD;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,OAAO,EAAE,QAAQ,GAAG,OAAO,EAC7E,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAC7C,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAY9B;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAC/C,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAE/B;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,OAAO,EACtG,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,GAChC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAWnC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { TSchema } from \"typebox\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\n\ndeclare module \"@earendil-works/pi-agent-core\" {\n\tinterface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> {\n\t\t/** Optional per-tool character cap for model-visible result persistence. Use Infinity to opt out. */\n\t\tmaxResultSizeChars?: number;\n\t}\n}\n\n/** Wrap a ToolDefinition into an AgentTool for the core runtime. */\nexport function wrapToolDefinition<TParams extends TSchema, TDetails = unknown>(\n\tdefinition: ToolDefinition<TParams, TDetails>,\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TParams, TDetails> {\n\treturn {\n\t\tname: definition.name,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tmaxResultSizeChars: definition.maxResultSizeChars,\n\t\tprepareArguments: definition.prepareArguments,\n\t\texecutionMode: definition.executionMode,\n\t\texecute: (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params, signal, onUpdate, ctxFactory?.() as ExtensionContext),\n\t};\n}\n\n/** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */\nexport function wrapToolDefinitions(\n\tdefinitions: ToolDefinition<TSchema, unknown>[],\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TSchema, unknown>[] {\n\treturn definitions.map((definition) => wrapToolDefinition(definition, ctxFactory));\n}\n\n/**\n * Synthesize a minimal ToolDefinition from an AgentTool.\n *\n * This keeps AgentSession's internal registry definition-first even when a caller\n * provides plain AgentTool overrides that do not include prompt metadata or renderers.\n */\nexport function createToolDefinitionFromAgentTool<TParams extends TSchema = TSchema, TDetails = unknown>(\n\ttool: AgentTool<TParams, TDetails>,\n): ToolDefinition<TParams, TDetails> {\n\treturn {\n\t\tname: tool.name,\n\t\tlabel: tool.label,\n\t\tdescription: tool.description,\n\t\tparameters: tool.parameters,\n\t\tmaxResultSizeChars: tool.maxResultSizeChars,\n\t\tprepareArguments: tool.prepareArguments,\n\t\texecutionMode: tool.executionMode,\n\t\texecute: async (toolCallId, params, signal, onUpdate) => tool.execute(toolCallId, params, signal, onUpdate),\n\t};\n}\n"]}
1
+ {"version":3,"file":"tool-definition-wrapper.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,QAAQ,+BAA+B,CAAC;IAC9C,UAAU,SAAS,CAAC,WAAW,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,GAAG;QACxE,qGAAqG;QACrG,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC5B;CACD;AAKD,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,OAAO,EAAE,QAAQ,GAAG,OAAO,EAC7E,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAC7C,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAc9B;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAC/C,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAE/B;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,OAAO,EACtG,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,GAChC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAcnC"}
@@ -6,7 +6,9 @@ export function wrapToolDefinition(definition, ctxFactory) {
6
6
  description: definition.description,
7
7
  parameters: definition.parameters,
8
8
  maxResultSizeChars: definition.maxResultSizeChars,
9
- prepareArguments: definition.prepareArguments,
9
+ prepareArguments: definition.prepareArguments
10
+ ? (args) => definition.prepareArguments?.(args)
11
+ : undefined,
10
12
  executionMode: definition.executionMode,
11
13
  execute: (toolCallId, params, signal, onUpdate) => definition.execute(toolCallId, params, signal, onUpdate, ctxFactory?.()),
12
14
  };
@@ -28,7 +30,9 @@ export function createToolDefinitionFromAgentTool(tool) {
28
30
  description: tool.description,
29
31
  parameters: tool.parameters,
30
32
  maxResultSizeChars: tool.maxResultSizeChars,
31
- prepareArguments: tool.prepareArguments,
33
+ prepareArguments: tool.prepareArguments
34
+ ? (args) => tool.prepareArguments?.(args)
35
+ : undefined,
32
36
  executionMode: tool.executionMode,
33
37
  execute: async (toolCallId, params, signal, onUpdate) => tool.execute(toolCallId, params, signal, onUpdate),
34
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tool-definition-wrapper.js","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAWA,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CACjC,UAA6C,EAC7C,UAAmC;IAEnC,OAAO;QACN,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;QACjD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;QAC7C,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CACjD,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAsB,CAAC;KAC7F,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAClC,WAA+C,EAC/C,UAAmC;IAEnC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAChD,IAAkC;IAElC,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;KAC3G,CAAC;AACH,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { TSchema } from \"typebox\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\n\ndeclare module \"@earendil-works/pi-agent-core\" {\n\tinterface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> {\n\t\t/** Optional per-tool character cap for model-visible result persistence. Use Infinity to opt out. */\n\t\tmaxResultSizeChars?: number;\n\t}\n}\n\n/** Wrap a ToolDefinition into an AgentTool for the core runtime. */\nexport function wrapToolDefinition<TParams extends TSchema, TDetails = unknown>(\n\tdefinition: ToolDefinition<TParams, TDetails>,\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TParams, TDetails> {\n\treturn {\n\t\tname: definition.name,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tmaxResultSizeChars: definition.maxResultSizeChars,\n\t\tprepareArguments: definition.prepareArguments,\n\t\texecutionMode: definition.executionMode,\n\t\texecute: (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params, signal, onUpdate, ctxFactory?.() as ExtensionContext),\n\t};\n}\n\n/** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */\nexport function wrapToolDefinitions(\n\tdefinitions: ToolDefinition<TSchema, unknown>[],\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TSchema, unknown>[] {\n\treturn definitions.map((definition) => wrapToolDefinition(definition, ctxFactory));\n}\n\n/**\n * Synthesize a minimal ToolDefinition from an AgentTool.\n *\n * This keeps AgentSession's internal registry definition-first even when a caller\n * provides plain AgentTool overrides that do not include prompt metadata or renderers.\n */\nexport function createToolDefinitionFromAgentTool<TParams extends TSchema = TSchema, TDetails = unknown>(\n\ttool: AgentTool<TParams, TDetails>,\n): ToolDefinition<TParams, TDetails> {\n\treturn {\n\t\tname: tool.name,\n\t\tlabel: tool.label,\n\t\tdescription: tool.description,\n\t\tparameters: tool.parameters,\n\t\tmaxResultSizeChars: tool.maxResultSizeChars,\n\t\tprepareArguments: tool.prepareArguments,\n\t\texecutionMode: tool.executionMode,\n\t\texecute: async (toolCallId, params, signal, onUpdate) => tool.execute(toolCallId, params, signal, onUpdate),\n\t};\n}\n"]}
1
+ {"version":3,"file":"tool-definition-wrapper.js","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAcA,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CACjC,UAA6C,EAC7C,UAAmC;IAEnC,OAAO;QACN,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;QACjD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;YAC5C,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAA8B;YAC5E,CAAC,CAAC,SAAS;QACZ,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CACjD,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,MAAyB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAsB,CAAC;KAChH,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAClC,WAA+C,EAC/C,UAAmC;IAEnC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAChD,IAAkC;IAElC,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACtC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAoB;YAC5D,CAAC,CAAC,SAAS;QACZ,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CACvD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,MAA+B,EAAE,MAAM,EAAE,QAAQ,CAAC;KAC5E,CAAC;AACH,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\n\ndeclare module \"@earendil-works/pi-agent-core\" {\n\tinterface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> {\n\t\t/** Optional per-tool character cap for model-visible result persistence. Use Infinity to opt out. */\n\t\tmaxResultSizeChars?: number;\n\t}\n}\n\ntype PiToolParams<TParams extends TSchema> = Parameters<AgentTool<TParams>[\"execute\"]>[1];\ntype PiPreparedParams<TParams extends TSchema> = ReturnType<NonNullable<AgentTool<TParams>[\"prepareArguments\"]>>;\n\n/** Wrap a ToolDefinition into an AgentTool for the core runtime. */\nexport function wrapToolDefinition<TParams extends TSchema, TDetails = unknown>(\n\tdefinition: ToolDefinition<TParams, TDetails>,\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TParams, TDetails> {\n\treturn {\n\t\tname: definition.name,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tmaxResultSizeChars: definition.maxResultSizeChars,\n\t\tprepareArguments: definition.prepareArguments\n\t\t\t? (args) => definition.prepareArguments?.(args) as PiPreparedParams<TParams>\n\t\t\t: undefined,\n\t\texecutionMode: definition.executionMode,\n\t\texecute: (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params as Static<TParams>, signal, onUpdate, ctxFactory?.() as ExtensionContext),\n\t};\n}\n\n/** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */\nexport function wrapToolDefinitions(\n\tdefinitions: ToolDefinition<TSchema, unknown>[],\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<TSchema, unknown>[] {\n\treturn definitions.map((definition) => wrapToolDefinition(definition, ctxFactory));\n}\n\n/**\n * Synthesize a minimal ToolDefinition from an AgentTool.\n *\n * This keeps AgentSession's internal registry definition-first even when a caller\n * provides plain AgentTool overrides that do not include prompt metadata or renderers.\n */\nexport function createToolDefinitionFromAgentTool<TParams extends TSchema = TSchema, TDetails = unknown>(\n\ttool: AgentTool<TParams, TDetails>,\n): ToolDefinition<TParams, TDetails> {\n\treturn {\n\t\tname: tool.name,\n\t\tlabel: tool.label,\n\t\tdescription: tool.description,\n\t\tparameters: tool.parameters,\n\t\tmaxResultSizeChars: tool.maxResultSizeChars,\n\t\tprepareArguments: tool.prepareArguments\n\t\t\t? (args) => tool.prepareArguments?.(args) as Static<TParams>\n\t\t\t: undefined,\n\t\texecutionMode: tool.executionMode,\n\t\texecute: async (toolCallId, params, signal, onUpdate) =>\n\t\t\ttool.execute(toolCallId, params as PiToolParams<TParams>, signal, onUpdate),\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-limits.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,OAAO,CAAC","sourcesContent":["/**\n * Constants related to tool result size limits.\n *\n * These mirror the conventions used by the upstream Claude Code tool-result\n * storage mechanism (mehmoodosman/claude-code, `src/constants/toolLimits.ts`):\n * oversized tool results are persisted to disk and replaced in model context\n * with a short preview that references the saved file.\n */\n\n/**\n * Default maximum size in characters for tool results before they get persisted\n * to disk. When exceeded, the result is saved to a file and the model receives\n * a preview with the file path instead of the full content.\n *\n * Individual tools may declare a lower cap, but this constant acts as a\n * system-wide ceiling regardless of what tools declare.\n */\nexport const DEFAULT_MAX_RESULT_SIZE_CHARS = 50_000;\n\n/** Subdirectory (within the session directory) for persisted tool results. */\nexport const TOOL_RESULTS_SUBDIR = \"tool-results\";\n\n/** XML tags wrapping a persisted-output preview message. */\nexport const PERSISTED_OUTPUT_TAG = \"<persisted-output>\";\nexport const PERSISTED_OUTPUT_CLOSING_TAG = \"</persisted-output>\";\n\n/** Preview size in bytes shown inline in the persisted-output message. */\nexport const PREVIEW_SIZE_BYTES = 2000;\n"]}
1
+ {"version":3,"file":"tool-limits.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/core/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAChC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IACtC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,eAAe,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAkF/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAyE/F;AAuBD;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA6B,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAKzC","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 3000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 3000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 512; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 3000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\nfunction splitLinesForCounting(content: string): string[] {\n\tif (content.length === 0) {\n\t\treturn [];\n\t}\n\tconst lines = content.split(\"\\n\");\n\tif (content.endsWith(\"\\n\")) {\n\t\tlines.pop();\n\t}\n\treturn lines;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = splitLinesForCounting(content);\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = Buffer.byteLength(lines[0], \"utf-8\");\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = splitLinesForCounting(content);\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = Buffer.byteLength(truncatedLine, \"utf-8\");\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tconst buf = Buffer.from(str, \"utf-8\");\n\tif (buf.length <= maxBytes) {\n\t\treturn str;\n\t}\n\n\t// Start from the end, skip maxBytes back\n\tlet start = buf.length - maxBytes;\n\n\t// Find a valid UTF-8 boundary (start of a character)\n\twhile (start < buf.length && (buf[start] & 0xc0) === 0x80) {\n\t\tstart++;\n\t}\n\n\treturn buf.slice(start).toString(\"utf-8\");\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
1
+ {"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/core/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAChC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAA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AAM,GAAG,SAAS,CAE3E;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,CAE/C;AAsCD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAgB3D","sourcesContent":["import { isIP } from \"node:net\";\n\nfunction parseIpv4Part(part: string): bigint | undefined {\n\tif (part === \"\") return undefined;\n\tif (/^0x[0-9a-f]+$/i.test(part)) return BigInt(Number.parseInt(part.slice(2), 16));\n\tif (/^0[0-7]+$/.test(part)) return BigInt(Number.parseInt(part, 8));\n\tif (/^(?:0|[1-9]\\d*)$/.test(part)) return BigInt(part);\n\treturn undefined;\n}\n\nfunction dottedQuadFromValue(value: bigint): string | undefined {\n\tif (value < 0n || value > 0xffffffffn) return undefined;\n\treturn [24n, 16n, 8n, 0n].map((shift) => Number((value >> shift) & 255n)).join(\".\");\n}\n\nfunction canonicalNumericIpv4(hostname: string): string | undefined {\n\tif (!/^[0-9a-fx.]+$/i.test(hostname)) return undefined;\n\tconst parts = hostname.split(\".\");\n\tif (parts.length < 1 || parts.length > 4) return undefined;\n\tconst nums = parts.map(parseIpv4Part);\n\tif (nums.some((part) => part === undefined)) return undefined;\n\tconst values = nums as bigint[];\n\tif (values.length === 1) return dottedQuadFromValue(values[0]!);\n\tif (values[0]! > 255n) return undefined;\n\tif (values.length === 2) {\n\t\tif (values[1]! > 0xffffffn) return undefined;\n\t\treturn dottedQuadFromValue((values[0]! << 24n) + values[1]!);\n\t}\n\tif (values[1]! > 255n) return undefined;\n\tif (values.length === 3) {\n\t\tif (values[2]! > 0xffffn) return undefined;\n\t\treturn dottedQuadFromValue((values[0]! << 24n) + (values[1]! << 16n) + values[2]!);\n\t}\n\tif (values[2]! > 255n || values[3]! > 255n) return undefined;\n\treturn dottedQuadFromValue((values[0]! << 24n) + (values[1]! << 16n) + (values[2]! << 8n) + values[3]!);\n}\n\nexport function normalizeIpLiteralHost(hostname: string): string | undefined {\n\treturn isIP(hostname) ? hostname : canonicalNumericIpv4(hostname);\n}\n\nexport function ipFamily(address: string): 4 | 6 {\n\treturn address.includes(\":\") ? 6 : 4;\n}\nfunction ipv4FromHextets(high: number, low: number): string { return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`; }\n\nfunction expandIpv6(address: string): number[] | undefined {\n\tconst value = address.toLowerCase().replace(/%.+$/, \"\");\n\tconst pieces = value.split(\"::\"); if (pieces.length > 2) return undefined;\n\tconst parseSide = (side: string): number[] | undefined => side ? side.split(\":\").flatMap((part) => {\n\t\tif (part.includes(\".\")) { const nums = part.split(\".\").map((v) => Number.parseInt(v, 10)); if (nums.length !== 4 || nums.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return [Number.NaN]; return [(nums[0]! << 8) | nums[1]!, (nums[2]! << 8) | nums[3]!]; }\n\t\tif (!/^[0-9a-f]{1,4}$/.test(part)) return [Number.NaN]; return [Number.parseInt(part, 16)];\n\t}) : [];\n\tconst left = parseSide(pieces[0] ?? \"\"), right = parseSide(pieces[1] ?? \"\"); if (!left || !right || left.some(Number.isNaN) || right.some(Number.isNaN)) return undefined;\n\tconst zeros = pieces.length === 2 ? 8 - left.length - right.length : 0; if (zeros < 0 || pieces.length === 1 && left.length !== 8) return undefined;\n\treturn [...left, ...Array.from({ length: zeros }, () => 0), ...right];\n}\n\nfunction embeddedPrivateIpv4(address: string): boolean {\n\tconst hextets = expandIpv6(address); if (!hextets) return false;\n\t// IPv4-mapped (::ffff:0:0/96) and IPv4-compatible (::/96) addresses: any\n\t// fully-expanded form (e.g. [0:0:0:0:0:ffff:169.254.169.254]) must be\n\t// re-checked against the IPv4 private predicates, not just the compressed\n\t// `::ffff:` literals handled by isPrivateIpAddress.\n\tif (hextets.slice(0, 5).every((part) => part === 0) && hextets[5] === 0xffff) return isPrivateIpAddress(ipv4FromHextets(hextets[6]!, hextets[7]!));\n\tif (hextets.slice(0, 6).every((part) => part === 0)) return isPrivateIpAddress(ipv4FromHextets(hextets[6]!, hextets[7]!));\n\tif (hextets[0] === 0x2002) return isPrivateIpAddress(ipv4FromHextets(hextets[1]!, hextets[2]!));\n\tif (hextets[0] === 0x64 && hextets[1] === 0xff9b && hextets.slice(2, 6).every((part) => part === 0)) return isPrivateIpAddress(ipv4FromHextets(hextets[6]!, hextets[7]!));\n\treturn false;\n}\n\nfunction isPrivateIpv6Address(address: string): boolean {\n\tconst hextets = expandIpv6(address);\n\tif (!hextets) return false;\n\tconst h0 = hextets[0]!;\n\treturn hextets.every((part) => part === 0)\n\t\t|| hextets.slice(0, 7).every((part) => part === 0) && hextets[7] === 1\n\t\t|| (h0 & 0xffc0) === 0xfe80\n\t\t|| (h0 & 0xfe00) === 0xfc00;\n}\n\nexport function isPrivateIpAddress(address: string): boolean {\n\tif (address.includes(\":\")) {\n\t\tconst lower = address.toLowerCase();\n\t\tif (isPrivateIpv6Address(lower)) return true;\n\t\tconst mapped = lower.match(/::ffff:(\\d+\\.\\d+\\.\\d+\\.\\d+)$/)?.[1];\n\t\tconst hexMapped = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);\n\t\tif (hexMapped) {\n\t\t\tconst high = Number.parseInt(hexMapped[1]!, 16), low = Number.parseInt(hexMapped[2]!, 16);\n\t\t\treturn isPrivateIpAddress(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);\n\t\t}\n\t\treturn mapped ? isPrivateIpAddress(mapped) : embeddedPrivateIpv4(address);\n\t}\n\tconst parts = address.split(\".\").map((part) => Number.parseInt(part, 10));\n\tif (parts.length !== 4 || parts.some((part) => !Number.isFinite(part))) return false;\n\tconst [a, b] = parts as [number, number, number, number];\n\treturn a === 0 || a === 10 || a === 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 100 && b >= 64 && b <= 127;\n}\n"]}
1
+ {"version":3,"file":"url-ip-guards.d.ts","sourceRoot":"","sources":["../../../src/core/tools/url-ip-guards.ts"],"names":[],"mappings":"AAqCA,wBAA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a,CAAC,EAAE,qBAAqB,CAAC;CACtC;AA6ID,wBAAgB,yBAAyB,CACxC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,gBAAgB,GACxB,cAAc,CAAC,OAAO,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAiIlE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC,OAAO,WAAW,CAAC,CAEtG","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Container, Text } from \"@earendil-works/pi-tui\";\nimport { chmod as fsChmod, mkdir as fsMkdir, readFile as fsReadFile, readdir as fsReaddir, stat as fsStat, writeFile as fsWriteFile } from \"fs/promises\";\nimport { dirname, join } from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { getRegisteredConflictBlocks, parseConflictBlocks, type ConflictBlock } from \"./conflict-registry.ts\";\nimport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nimport { createHashlineSnapshotStore, formatHashlineContent, recordHashlineSnapshot, stripKnownHashlineCopiedContent, stripKnownHashlineCopiedContentWithMeta, type HashlineSnapshotStore } from \"./hashline.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\nimport { parseArchiveSelector, parseSqliteSelector, resolveArchiveSelector, resolveInternalSelector, sqliteSelectorForPath, writeArchiveSelector, writeInternalSelector, writeSqliteSelector, type InternalResourceContext } from \"./resource-selectors.ts\";\nimport { invalidateNativeSearchCache } from \"./search-native.ts\";\nimport { invalidArgText, normalizeDisplayText, replaceTabs, shortenPath, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst writeSchema = Type.Object({\n\tpath: Type.String({ description: \"File path, writable internal resource, archive entry, SQLite row selector, or conflict resolution target.\" }),\n\tcontent: Type.String({ description: \"Full replacement content. SQLite non-delete writes parse as a JSON5 object; empty content deletes a SQLite row when a row key exists.\" }),\n}, { additionalProperties: false });\n\nexport type WriteToolInput = Static<typeof writeSchema>;\nexport interface WriteToolDetails { resolvedPath?: string; madeExecutable?: boolean; meta?: { sourcePath?: string; diagnostics?: unknown }; diagnostics?: unknown }\n\n/**\n * Pluggable operations for the write tool.\n * Override these to delegate file writing to remote systems (for example SSH).\n */\nexport interface WriteOperations {\n\t/** Write content to a file */\n\twriteFile: (absolutePath: string, content: string) => Promise<void>;\n\tmkdir: (dir: string) => Promise<void>;\n}\n\n\nasync function findConflictBlocks(root: string, limit = 100): Promise<ConflictBlock[]> {\n\tconst out: ConflictBlock[] = [];\n\tasync function walk(dir: string): Promise<void> { for (const entry of await fsReaddir(dir, { withFileTypes: true }).catch(() => [])) { if (out.length >= limit || entry.name === \".git\" || entry.name === \"node_modules\") continue; const full = join(dir, entry.name); if (entry.isDirectory()) await walk(full); else if (entry.isFile()) { const text = await fsReadFile(full, \"utf8\").catch(() => \"\"); if (text.includes(\"<<<<<<<\") && text.includes(\"=======\") && text.includes(\">>>>>>>\")) out.push(...parseConflictBlocks(full, text)); } } }\n\tawait walk(root); return out;\n}\n/**\n * Reconcile the read-time conflict view (registry, populated by `read\n * …:conflicts`) against the live tree-walk snapshot. A registered block is\n * only trustworthy when the markers still sit at its recorded file+offset —\n * otherwise the file drifted and the id→block mapping would be wrong. When\n * any registered block is still live, resolve ids against the registered\n * ordering (what the agent actually saw); otherwise fall back to the fresh\n * tree walk. This closes the divergent id-space where `conflict://2` could\n * resolve a different block than the read displayed.\n */\nfunction reconcileConflictBlocks(live: ConflictBlock[], cwd: string): ConflictBlock[] {\n\tconst registered = getRegisteredConflictBlocks(cwd);\n\tif (registered.length === 0) return live;\n\tconst liveKeys = new Set(live.map((block) => `${block.file}\\0${block.start}\\0${block.end}`));\n\tconst registeredLive = registered.filter((block) => liveKeys.has(`${block.file}\\0${block.start}\\0${block.end}`));\n\t// If the registered view no longer matches the live tree at all, the file\n\t// changed under us — trust the live walk rather than a stale id mapping.\n\treturn registeredLive.length > 0 ? registeredLive : live;\n}\nfunction conflictReplacement(content: string, block: ConflictBlock): string[] {\n\tconst token = content.trim();\n\tif (token === \"@ours\") return block.ours;\n\tif (token === \"@theirs\") return block.theirs;\n\tif (token === \"@base\") return block.base;\n\tconst normalized = content.endsWith(\"\\n\") ? content.slice(0, -1) : content;\n\treturn normalized === \"\" ? [] : normalized.split(\"\\n\");\n}\nasync function resolveConflictBlocks(blocks: ConflictBlock[], content: string): Promise<string[]> {\n\tconst byFile = new Map<string, ConflictBlock[]>();\n\tfor (const block of blocks) byFile.set(block.file, [...(byFile.get(block.file) ?? []), block]);\n\tconst written: string[] = [];\n\tfor (const [file, fileBlocks] of byFile) {\n\t\tconst text = await fsReadFile(file, \"utf8\"), lines = text.split(\"\\n\");\n\t\tfor (const block of fileBlocks.sort((a, b) => b.start - a.start)) lines.splice(block.start, block.end - block.start + 1, ...conflictReplacement(content, block));\n\t\tawait fsWriteFile(file, lines.join(\"\\n\"), \"utf8\"); written.push(file);\n\t}\n\treturn written;\n}\nasync function conflictSnapshotHeaders(files: string[], cwd: string, store: HashlineSnapshotStore): Promise<string[]> {\n\tconst headers: string[] = [];\n\tfor (const file of [...new Set(files)]) { invalidateNativeSearchCache(file); const text = await fsReadFile(file, \"utf8\").catch(() => undefined); if (text !== undefined) headers.push(formatHashlineContent(recordHashlineSnapshot(file, cwd, text, store)).split(\"\\n\")[0]!); }\n\treturn headers;\n}\nconst GENERATED_MARKER_BYTES = 1024;\nconst GENERATED_MARKER_LINES = 40;\nfunction hasGeneratedMarker(text: string): boolean {\n\tconst header = text.slice(0, GENERATED_MARKER_BYTES).split(\"\\n\").slice(0, GENERATED_MARKER_LINES);\n\treturn header.some((line) => /@generated|auto-generated|DO NOT EDIT|GENERATED -- do not edit/i.test(line));\n}\nfunction strippedHashlineNote(stripped: boolean): string { return stripped ? \"\\n\\nNote: stripped copied hashline headers and line prefixes before writing.\" : \"\"; }\nfunction hashlineHeaderForWrite(path: string, cwd: string, content: string, store: HashlineSnapshotStore): string { const snapshot = recordHashlineSnapshot(path, cwd, content, store); return `[${snapshot.displayPath}#${snapshot.tag}]`; }\nconst defaultWriteOperations: WriteOperations = {\n\twriteFile: (path, content) => fsWriteFile(path, content, \"utf-8\"),\n\tmkdir: (dir) => fsMkdir(dir, { recursive: true }).then(() => {}),\n};\n\nexport interface WriteToolOptions {\n\t/** Custom operations for file writing. Default: local filesystem */\n\toperations?: WriteOperations;\n\thashlineStore?: HashlineSnapshotStore;\n}\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\n\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\n\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\n\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\n\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\n\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\n\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\n\nfunction formatWriteCall(\n\targs: { path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.ts\").theme,\n\tcache: WriteHighlightCache | undefined,\n): string {\n\tconst rawPath = str(args?.path);\n\tconst fileContent = str(args?.content);\n\tconst path = rawPath !== null ? shortenPath(rawPath) : null;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${path === null ? invalidArg : path ? theme.fg(\"accent\", path) : theme.fg(\"toolOutput\", \"...\")}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst renderedLines = lang\n\t\t\t? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"Expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\n\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.ts\").theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", output)}`;\n}\n\nexport function createWriteToolDefinition(\n\tcwd: string,\n\toptions?: WriteToolOptions,\n): ToolDefinition<typeof writeSchema, WriteToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultWriteOperations;\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn {\n\t\tname: \"write\",\n\t\tlabel: \"write\",\n\t\tdescription: \"Create or overwrite a file, writable internal resource, archive entry, SQLite row, or merge-conflict resolution.\",\n\t\tpromptSnippet: \"Create or overwrite a writable path selector.\",\n\t\tpromptGuidelines: [\"Use write when replacing the full content of a target; use edit for source edits anchored to existing hashline snapshots.\"],\n\t\tparameters: writeSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, content }: { path: string; content: string },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst resourceCtx = _ctx as InternalResourceContext | undefined;\n\t\t\tconst archive = parseArchiveSelector(path);\n\t\t\tconst parsedSqlite = parseSqliteSelector(path);\n\t\t\tif (parsedSqlite?.table && path.includes(\"?\")) throw new Error(\"SQLite write selectors must not include query parameters.\");\n\t\t\tif (parsedSqlite?.table && (parsedSqlite.limit !== undefined || parsedSqlite.offset !== undefined || parsedSqlite.where || parsedSqlite.order || parsedSqlite.schema || parsedSqlite.sampleRows !== undefined || parsedSqlite.query)) throw new Error(\"SQLite write selectors must not include query parameters.\");\n\t\t\tconst sqlite = sqliteSelectorForPath(path, cwd);\n\t\t\tif (!sqlite && parsedSqlite?.table) throw new Error(`SQLite database not found or is not SQLite: ${path}`);\n\t\t\tif (sqlite) {\n\t\t\t\tconst stripped = stripKnownHashlineCopiedContentWithMeta(content, \"\", cwd, hashlineStore);\n\t\t\t\tconst message = writeSqliteSelector(sqlite, stripped.content);\n\t\t\t\treturn { content: [{ type: \"text\", text: `${message}${strippedHashlineNote(stripped.stripped)}` }], details: { meta: { sourcePath: sqlite.databasePath } } };\n\t\t\t}\n\t\t\tif (archive) {\n\t\t\t\tconst stripped = stripKnownHashlineCopiedContentWithMeta(content, \"\", cwd, hashlineStore);\n\t\t\t\tconst resolvedArchive = resolveArchiveSelector(archive, cwd);\n\t\t\t\twriteArchiveSelector(resolvedArchive, stripped.content);\n\t\t\t\treturn { content: [{ type: \"text\", text: `Successfully wrote ${stripped.content.length} bytes to ${path}${strippedHashlineNote(stripped.stripped)}` }], details: { resolvedPath: resolvedArchive.archivePath } };\n\t\t\t}\n\t\t\tif (path.startsWith(\"conflict://\")) {\n\t\t\t\tconst writeContent = stripKnownHashlineCopiedContent(content, \"\", cwd, hashlineStore);\n\t\t\t\tconst target = decodeURIComponent(path.slice(\"conflict://\".length));\n\t\t\t\tif (!target) throw new Error(\"conflict:// target is required.\");\n\t\t\t\tif (target.includes(\"/\")) throw new Error(\"Scoped conflict resources are read-only; write conflict://<id> or conflict://*.\");\n\t\t\t\tconst liveBlocks = await findConflictBlocks(cwd);\n\t\t\t\tif (liveBlocks.length === 0) throw new Error(\"No conflict markers found.\");\n\t\t\t\tconst blocks = reconcileConflictBlocks(liveBlocks, cwd);\n\t\t\t\tif (target === \"*\") { const headers = await conflictSnapshotHeaders(await resolveConflictBlocks(blocks, writeContent), cwd, hashlineStore); return { content: [{ type: \"text\", text: `Resolved ${blocks.length} conflict${blocks.length === 1 ? \"\" : \"s\"}${headers.length > 0 ? `\\n\\nSnapshots:\\n${headers.join(\"\\n\")}` : \"\"}` }], details: undefined }; }\n\t\t\t\tif (!/^\\d+$/.test(target)) throw new Error(\"Conflict writes must target conflict://<id> or conflict://*.\");\n\t\t\t\tconst id = Number.parseInt(target, 10);\n\t\t\t\tconst block = blocks[id - 1];\n\t\t\t\tif (!block) throw new Error(`Conflict id not found: ${target}`);\n\t\t\t\tconst headers = await conflictSnapshotHeaders(await resolveConflictBlocks([block], writeContent), cwd, hashlineStore);\n\t\t\t\treturn { content: [{ type: \"text\", text: `Resolved conflict ${target}${headers[0] ? `\\n\\n${headers[0]}` : \"\"}` }], details: undefined };\n\t\t\t}\n\t\t\tif (/^[a-z]+:\\/\\//i.test(path)) {\n\t\t\t\tconst sourcePath = path.startsWith(\"local://\") ? resolveInternalSelector(path, cwd) : undefined;\n\t\t\t\tif (sourcePath) return createWriteToolDefinition(cwd, options).execute(_toolCallId, { path: sourcePath, content }, signal, _onUpdate, _ctx as never);\n\t\t\t\tconst stripped = stripKnownHashlineCopiedContentWithMeta(content, \"\", cwd, hashlineStore);\n\t\t\t\tawait writeInternalSelector(path, cwd, stripped.content, resourceCtx);\n\t\t\t\treturn { content: [{ type: \"text\", text: `Successfully wrote ${stripped.content.length} bytes to ${path}${strippedHashlineNote(stripped.stripped)}` }], details: {} };\n\t\t\t}\n\t\t\tconst absolutePath = resolveToCwd(path, cwd);\n\t\t\tconst dir = dirname(absolutePath);\n\t\t\treturn withFileMutationQueue(absolutePath, async () => {\n\t\t\t\t// Do not reject from an abort event listener here: that would release the\n\t\t\t\t// mutation queue while an in-flight filesystem operation may still finish.\n\t\t\t\t// Checking signal.aborted after each await observes the same aborts while\n\t\t\t\t// keeping the queue locked until the current operation has settled.\n\t\t\t\tconst throwIfAborted = (): void => {\n\t\t\t\t\tif (signal?.aborted) throw new Error(\"Operation aborted\");\n\t\t\t\t};\n\n\t\t\t\tthrowIfAborted();\n\t\t\t\t// Create parent directories if needed.\n\t\t\t\tawait ops.mkdir(dir);\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\tconst existing = await fsReadFile(absolutePath, \"utf8\").catch(() => undefined);\n\t\t\t\tif (existing !== undefined && hasGeneratedMarker(existing)) throw new Error(`Refusing to overwrite generated file: ${path}`);\n\t\t\t\tconst stripped = stripKnownHashlineCopiedContentWithMeta(content, absolutePath, cwd, hashlineStore);\n\t\t\t\tconst writeContent = stripped.content;\n\t\t\t\tawait ops.writeFile(absolutePath, writeContent);\n\t\t\t\tinvalidateNativeSearchCache(absolutePath);\n\t\t\t\tlet madeExecutable = false;\n\t\t\t\tif (writeContent.startsWith(\"#!\")) {\n\t\t\t\t\tconst mode = await fsStat(absolutePath).then((stat) => stat.mode).catch(() => undefined);\n\t\t\t\t\tif (mode !== undefined) { await fsChmod(absolutePath, mode | 0o111); madeExecutable = true; }\n\t\t\t\t}\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\tconst header = hashlineHeaderForWrite(absolutePath, cwd, writeContent, hashlineStore);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `${header}\\nSuccessfully wrote ${writeContent.length} bytes to ${path}${strippedHashlineNote(stripped.stripped)}` }],\n\t\t\t\t\tdetails: { resolvedPath: absolutePath, ...(madeExecutable ? { madeExecutable } : {}) },\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst renderArgs = args as { path?: string; content?: string } | undefined;\n\t\t\tconst rawPath = str(renderArgs?.path);\n\t\t\tconst fileContent = str(renderArgs?.content);\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\t\tif (fileContent !== null) {\n\t\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t\t} else {\n\t\t\t\tcomponent.cache = undefined;\n\t\t\t}\n\t\t\tcomponent.setText(\n\t\t\t\tformatWriteCall(\n\t\t\t\t\trenderArgs,\n\t\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\t\ttheme,\n\t\t\t\t\tcomponent.cache,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn component;\n\t\t},\n\t\trenderResult(result, _options, theme, context) {\n\t\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\t\tif (!output) {\n\t\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\t\tcomponent.clear();\n\t\t\t\treturn component;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(output);\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createWriteTool(cwd: string, options?: WriteToolOptions): AgentTool<typeof writeSchema> {\n\treturn wrapToolDefinition(createWriteToolDefinition(cwd, options));\n}\n"]}
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/core/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAAwJ,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAOjN,QAAA,MAAM,WAAW;;;EAGkB,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AACxD,MAAM,WAAW,gBAAgB;IAAG,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE;AAEnK;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,8BAA8B;IAC9B,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAgED,MAAM,WAAW,gBAA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E,OAAO,CAAA;CAAE,GAAG,kBAAkB,EAAE,CA8BpH;AAkFD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGxD;AASD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmBtE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CA0B1D;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,SAAS,CAAS;IAE1B,YAAY,QAAQ,EAAE,MAAM,EAE3B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAErC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAKnD;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAErD;IAED,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAa7C;CACD","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport lockfile from \"proper-lockfile\";\nimport { CONFIG_DIR_NAMES } from \"../config.ts\";\nimport { parseJsonFileContent } from \"../utils/json.ts\";\nimport { canonicalizePath, getHomeDir, resolvePath } from \"../utils/paths.ts\";\n\nexport type ProjectTrustDecision = boolean | null;\n\nexport interface ProjectTrustStoreEntry {\n\tpath: string;\n\tdecision: boolean;\n}\n\nexport interface ProjectTrustUpdate {\n\tpath: string;\n\tdecision: ProjectTrustDecision;\n}\n\nexport interface ProjectTrustOption {\n\tlabel: string;\n\ttrusted: boolean;\n\tupdates: ProjectTrustUpdate[];\n\tsavedPath?: string;\n}\n\ntype TrustFile = Record<string, boolean | null | undefined>;\nexport const TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES = [\n\t\"settings.json\",\n\t\"extensions\",\n\t\"skills\",\n\t\"prompts\",\n\t\"themes\",\n\t\"SYSTEM.md\",\n\t\"APPEND_SYSTEM.md\",\n] as const;\n\nfunction normalizeCwd(cwd: string): string {\n\treturn canonicalizePath(resolvePath(cwd));\n}\n\nfunction findNearestTrustEntry(data: TrustFile, cwd: string): ProjectTrustStoreEntry | null {\n\tlet currentDir = normalizeCwd(cwd);\n\twhile (true) {\n\t\tconst value = data[currentDir];\n\t\tif (value === true || value === false) {\n\t\t\treturn { path: currentDir, decision: value };\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\treturn null;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n}\n\nexport function getProjectTrustPath(cwd: string): string {\n\treturn normalizeCwd(cwd);\n}\n\nexport function getProjectTrustParentPath(cwd: string): string | undefined {\n\tconst trustPath = getProjectTrustPath(cwd);\n\tconst parentDir = dirname(trustPath);\n\treturn parentDir === trustPath ? undefined : parentDir;\n}\n\nexport function getProjectTrustOptions(cwd: string, options?: { includeSessionOnly?: boolean }): ProjectTrustOption[] {\n\tconst trustPath = getProjectTrustPath(cwd);\n\tconst trustOptions: ProjectTrustOption[] = [\n\t\t{ label: \"Trust\", trusted: true, updates: [{ path: trustPath, decision: true }], savedPath: trustPath },\n\t];\n\tconst parentPath = getProjectTrustParentPath(cwd);\n\tif (parentPath !== undefined) {\n\t\ttrustOptions.push({\n\t\t\tlabel: `Trust parent folder (${parentPath})`,\n\t\t\ttrusted: true,\n\t\t\tupdates: [\n\t\t\t\t{ path: parentPath, decision: true },\n\t\t\t\t{ path: trustPath, decision: null },\n\t\t\t],\n\t\t\tsavedPath: parentPath,\n\t\t});\n\t}\n\tif (options?.includeSessionOnly) {\n\t\ttrustOptions.push({ label: \"Trust (this session only)\", trusted: true, updates: [] });\n\t}\n\ttrustOptions.push({\n\t\tlabel: \"Do not trust\",\n\t\ttrusted: false,\n\t\tupdates: [{ path: trustPath, decision: false }],\n\t\tsavedPath: trustPath,\n\t});\n\tif (options?.includeSessionOnly) {\n\t\ttrustOptions.push({ label: \"Do not trust (this session only)\", trusted: false, updates: [] });\n\t}\n\treturn trustOptions;\n}\n\nfunction readTrustFile(path: string): TrustFile {\n\tif (!existsSync(path)) {\n\t\treturn {};\n\t}\n\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = parseJsonFileContent(readFileSync(path, \"utf-8\"));\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new Error(`Failed to read trust store ${path}: ${message}`);\n\t}\n\n\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n\t\tthrow new Error(`Invalid trust store ${path}: expected an object`);\n\t}\n\n\tconst data: TrustFile = {};\n\tfor (const [key, value] of Object.entries(parsed)) {\n\t\tif (value !== true && value !== false && value !== null) {\n\t\t\tthrow new Error(`Invalid trust store ${path}: value for ${JSON.stringify(key)} must be true, false, or null`);\n\t\t}\n\t\tdata[key] = value;\n\t}\n\treturn data;\n}\n\nfunction writeTrustFile(path: string, data: TrustFile): void {\n\tconst sorted: TrustFile = {};\n\tfor (const key of Object.keys(data).sort()) {\n\t\tconst value = data[key];\n\t\tif (value === true || value === false || value === null) {\n\t\t\tsorted[key] = value;\n\t\t}\n\t}\n\tmkdirSync(dirname(path), { recursive: true });\n\twriteFileSync(path, `${JSON.stringify(sorted, null, 2)}\\n`, \"utf-8\");\n}\n\nfunction acquireTrustLockSync(path: string): () => void {\n\tconst trustDir = dirname(path);\n\tmkdirSync(trustDir, { recursive: true });\n\tconst maxAttempts = 10;\n\tconst delayMs = 20;\n\tlet lastError: unknown;\n\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\ttry {\n\t\t\treturn lockfile.lockSync(trustDir, { realpath: false, lockfilePath: `${path}.lock` });\n\t\t} catch (error) {\n\t\t\tconst code =\n\t\t\t\ttypeof error === \"object\" && error !== null && \"code\" in error\n\t\t\t\t\t? String((error as { code?: unknown }).code)\n\t\t\t\t\t: undefined;\n\t\t\tif (code !== \"ELOCKED\" || attempt === maxAttempts) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tlastError = error;\n\t\t\tconst start = Date.now();\n\t\t\twhile (Date.now() - start < delayMs) {\n\t\t\t\t// Sleep synchronously to avoid changing trust store callers to async.\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lastError instanceof Error) {\n\t\tthrow lastError;\n\t}\n\tthrow new Error(\"Failed to acquire trust store lock\");\n}\n\nfunction withTrustFileLock<T>(path: string, fn: () => T): T {\n\tconst release = acquireTrustLockSync(path);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\trelease();\n\t}\n}\n\nexport function hasProjectConfigDir(cwd: string): boolean {\n\tconst projectCwd = canonicalizePath(resolvePath(cwd));\n\treturn CONFIG_DIR_NAMES.some((configDirName) => existsSync(join(projectCwd, configDirName)));\n}\nfunction hasTrustRequiringConfigResources(cwd: string): boolean {\n\tconst projectCwd = canonicalizePath(resolvePath(cwd));\n\treturn CONFIG_DIR_NAMES.some((configDirName) => {\n\t\tconst configDir = join(projectCwd, configDirName);\n\t\treturn TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES.some((entry) => existsSync(join(configDir, entry)));\n\t});\n}\n\n/**\n * Returns true when cwd has project-local resources that must be gated by\n * project trust: trust-requiring entries under cwd/.atomic or cwd/.pi, or\n * .agents/skills in cwd or one of its ancestors. Returns false for inert\n * state-only config directories. The user-global ~/.agents/skills directory is\n * always treated as a trusted user resource and ignored, even when cwd is $HOME.\n */\nexport function hasTrustRequiringProjectResources(cwd: string): boolean {\n\tif (hasTrustRequiringConfigResources(cwd)) {\n\t\treturn true;\n\t}\n\n\tconst userGlobalSkillsDir = canonicalizePath(resolvePath(join(getHomeDir(), \".agents\", \"skills\")));\n\tlet currentDir = canonicalizePath(resolvePath(cwd));\n\twhile (true) {\n\t\tconst skillsDir = canonicalizePath(resolvePath(join(currentDir, \".agents\", \"skills\")));\n\t\tif (skillsDir !== userGlobalSkillsDir && existsSync(skillsDir)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\treturn false;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n}\n\nexport function hasProjectTrustInputs(cwd: string): boolean {\n\tlet currentDir = canonicalizePath(resolvePath(cwd));\n\tif (hasTrustRequiringConfigResources(currentDir)) {\n\t\treturn true;\n\t}\n\tconst userGlobalSkillsDir = canonicalizePath(resolvePath(join(getHomeDir(), \".agents\", \"skills\")));\n\tconst contextFileNames = [\"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"];\n\n\twhile (true) {\n\t\tfor (const contextFileName of contextFileNames) {\n\t\t\tif (existsSync(join(currentDir, contextFileName))) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tconst skillsDir = canonicalizePath(resolvePath(join(currentDir, \".agents\", \"skills\")));\n\t\tif (skillsDir !== userGlobalSkillsDir && existsSync(skillsDir)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\treturn false;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n}\n\nexport class ProjectTrustStore {\n\tprivate trustPath: string;\n\n\tconstructor(agentDir: string) {\n\t\tthis.trustPath = join(resolvePath(agentDir), \"trust.json\");\n\t}\n\n\tget(cwd: string): ProjectTrustDecision {\n\t\treturn this.getEntry(cwd)?.decision ?? null;\n\t}\n\n\tgetEntry(cwd: string): ProjectTrustStoreEntry | null {\n\t\treturn withTrustFileLock(this.trustPath, () => {\n\t\t\tconst data = readTrustFile(this.trustPath);\n\t\t\treturn findNearestTrustEntry(data, cwd);\n\t\t});\n\t}\n\n\tset(cwd: string, decision: ProjectTrustDecision): void {\n\t\tthis.setMany([{ path: cwd, decision }]);\n\t}\n\n\tsetMany(decisions: ProjectTrustUpdate[]): void {\n\t\twithTrustFileLock(this.trustPath, () => {\n\t\t\tconst data = readTrustFile(this.trustPath);\n\t\t\tfor (const { path, decision } of decisions) {\n\t\t\t\tconst key = normalizeCwd(path);\n\t\t\t\tif (decision === null) {\n\t\t\t\t\tdelete data[key];\n\t\t\t\t} else {\n\t\t\t\t\tdata[key] = decision;\n\t\t\t\t}\n\t\t\t}\n\t\t\twriteTrustFile(this.trustPath, data);\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"trust-manager.d.ts","sourceRoot":"","sources":["../../src/core/trust-manager.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,IAAI,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,oBAAoB,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,wCAAwC,YACpD,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,kBAAkB,CACT,CAAC;AAsBX,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIzE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,EAAE,CA8BpH;AAkFD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGxD;AASD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmBtE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CA0B1D;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,SAAS,CAAS;IAE1B,YAAY,QAAQ,EAAE,MAAM,EAE3B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAErC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAKnD;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAErD;IAED,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAa7C;CACD"}
@@ -0,0 +1,12 @@
1
+ import type { TUnsafe } from "typebox";
2
+ export interface StringEnumOptions<TValue extends string> {
3
+ description?: string;
4
+ default?: TValue;
5
+ }
6
+ /**
7
+ * Build Pi's Google-compatible string enum with the direct TypeBox schema identity.
8
+ * Pi 0.80.7 pins an older TypeBox instance, so this narrow boundary keeps extension
9
+ * schemas portable when they compose the result with Atomic's direct TypeBox version.
10
+ */
11
+ export declare function StringEnum<const TValues extends readonly string[]>(values: TValues, options?: StringEnumOptions<TValues[number]>): TUnsafe<TValues[number]>;
12
+ //# sourceMappingURL=typebox-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typebox-compat.d.ts","sourceRoot":"","sources":["../../src/core/typebox-compat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,MAAM;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,MAAM,EAAE,EACjE,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAE1B"}
@@ -0,0 +1,10 @@
1
+ import { StringEnum as PiStringEnum } from "@earendil-works/pi-ai/compat";
2
+ /**
3
+ * Build Pi's Google-compatible string enum with the direct TypeBox schema identity.
4
+ * Pi 0.80.7 pins an older TypeBox instance, so this narrow boundary keeps extension
5
+ * schemas portable when they compose the result with Atomic's direct TypeBox version.
6
+ */
7
+ export function StringEnum(values, options) {
8
+ return PiStringEnum(values, options);
9
+ }
10
+ //# sourceMappingURL=typebox-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typebox-compat.js","sourceRoot":"","sources":["../../src/core/typebox-compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAQ1E;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACzB,MAAe,EACf,OAA4C;IAE5C,OAAO,YAAY,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAC/C,CAAC","sourcesContent":["import { StringEnum as PiStringEnum } from \"@earendil-works/pi-ai/compat\";\nimport type { TUnsafe } from \"typebox\";\n\nexport interface StringEnumOptions<TValue extends string> {\n\tdescription?: string;\n\tdefault?: TValue;\n}\n\n/**\n * Build Pi's Google-compatible string enum with the direct TypeBox schema identity.\n * Pi 0.80.7 pins an older TypeBox instance, so this narrow boundary keeps extension\n * schemas portable when they compose the result with Atomic's direct TypeBox version.\n */\nexport function StringEnum<const TValues extends readonly string[]>(\n\tvalues: TValues,\n\toptions?: StringEnumOptions<TValues[number]>,\n): TUnsafe<TValues[number]> {\n\treturn PiStringEnum(values, options) as never;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index-extensions.d.ts","sourceRoot":"","sources":["../src/index-extensions.ts"],"names":[],"mappings":"AACA,YAAY,EACX,aAAa,EACb,eAAe,EACf,e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e,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,sBAAsB,EACtB,0BAA0B,EAC1B,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC","sourcesContent":["// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tWorkflowStageOrchestrationContext,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tModelSelectEvent,\n\tOrchestrationContext,\n\tProjectTrustContext,\n\tProjectTrustEvent,\n\tProjectTrustEventDecision,\n\tProjectTrustEventResult,\n\tProjectTrustHandler,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReactiveWidgetAction,\n\tReactiveWidgetComponent,\n\tReactiveWidgetController,\n\tReactiveWidgetFactory,\n\tReactiveWidgetRefreshReason,\n\tReactiveWidgetRenderContext,\n\tReactiveWidgetRenderState,\n\tReactiveWidgetScheduler,\n\tReactiveWidgetTimerApi,\n\tReactiveWidgetTimerHandle,\n\tReactiveWidgetUi,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionInfoChangedEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionStartEvent,\n\tToolExecutionMode,\n\tInstallReactiveWidgetOptions,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdecideReactiveWidgetAction,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\tinstallReactiveWidget,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n"]}
1
+ {"version":3,"file":"index-extensions.d.ts","sourceRoot":"","sources":["../src/index-extensions.ts"],"names":[],"mappings":"AACA,YAAY,EACX,aA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R,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,sBAAsB,EACtB,0BAA0B,EAC1B,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { type Args, parseArgs } from "./cli/args.ts";
3
3
  export { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, CONFIG_DIR_NAMES, LEGACY_CONFIG_DIR_NAME, LEGACY_ENV_PREFIX, getAgentConfigPaths, getAgentDir, getAgentDirs, getBundledInteractiveAssetPath, getChangelogPath, getDocsPath, getExamplesPath, getExportTemplateDir, getInteractiveAssetsDir, getLegacyAgentDir, getPackageDir, getPackageJsonPath, getProjectConfigDirs, getProjectConfigPaths, getReadmePath, getThemesDir, getEnvNames, getEnvValue, ENV_CODEX_FAST_MODE, WORKFLOW_STAGE_SUBAGENT_GUARD_ENV, isBunBinary, getUserConfigDirs, getUserConfigPaths, hasEnvValue, PACKAGE_NAME, setEnvValue, VERSION, } from "./config.ts";
4
4
  export { type BashResult, executeBashWithOperations } from "./core/bash-executor.ts";
5
5
  export { parseFlattenedKeyPath, reconstructFlattenedKeys, unflattenArgumentsWithSchema, } from "./core/flattened-tool-arguments.ts";
6
+ export { StringEnum, type StringEnumOptions } from "./core/typebox-compat.ts";
6
7
  export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
7
8
  export { type ApiKeyCredential, type AuthCredential, type AuthStatus, AuthStorage, type AuthStorageBackend, FileAuthStorageBackend, InMemoryAuthStorageBackend, type OAuthCredential, } from "./core/auth-storage.ts";
8
9
  export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactedTranscript, type CompactionPlanOptions, type VerbatimCompactionDetails, type VerbatimCompactionParameters, type VerbatimCompactionPreparation, type VerbatimCompactionResult, type LineRange, calculateContextTokens, collectEntriesForBranchSummary, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, type GenerateBranchSummaryOptions, generateBranchSummary, getLastAssistantUsage, prepareBranchEntries, prepareCompactionBoundary, runVerbatimCompaction, serializeConversation, serializeConversationForCompaction, shouldCompact, } from "./core/compaction/index.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,iCAAiC,EACjC,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,UAAU,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,YAAY,EACZ,KAAK,kB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,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EACvC,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetBundledInteractiveAssetPath,\n\tgetChangelogPath,\n\tgetDocsPath,\n\tgetExamplesPath,\n\tgetExportTemplateDir,\n\tgetInteractiveAssetsDir,\n\tgetLegacyAgentDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetReadmePath,\n\tgetThemesDir,\n\tgetEnvNames,\n\tgetEnvValue,\n\tENV_CODEX_FAST_MODE,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n\tisBunBinary,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n} from \"./config.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport {\n parseFlattenedKeyPath,\n reconstructFlattenedKeys,\n unflattenArgumentsWithSchema,\n} from \"./core/flattened-tool-arguments.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactedTranscript,\n\ttype CompactionPlanOptions,\n\ttype VerbatimCompactionDetails,\n\ttype VerbatimCompactionParameters,\n\ttype VerbatimCompactionPreparation,\n\ttype VerbatimCompactionResult,\n\ttype LineRange,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tprepareCompactionBoundary,\n\trunVerbatimCompaction,\n\tserializeConversation,\n\tserializeConversationForCompaction,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport {\n\tCODEX_FAST_MODE_SERVICE_TIER,\n\tformatCodexFastModeModelLabel,\n\tgetCodexFastModeScope,\n\thasSupportedCodexFastModeModel,\n\tisCodexFastModeEnabledForScope,\n\tisCodexFastModeCandidateModelId,\n\tisCodexFastModeSupportedModel,\n\tisCodexFastModeSupportedProvider,\n\tshouldApplyCodexFastMode,\n\tshouldApplyCodexFastModeForScope,\n\ttype CodexFastModeResolvedSettings,\n\ttype CodexFastModeScope,\n} from \"./core/codex-fast-mode.ts\";\nexport {\n\tformatContextWindow,\n\tgetEffectiveInputBudget,\n\tgetModelDefaultContextWindow,\n\tgetSupportedContextWindows,\n\tnormalizeContextWindowOptions,\n\tparseContextWindowValue,\n\tselectContextWindow,\n\tvalidateContextWindowValue,\n\twithContextWindowOptions,\n\ttype ContextWindowParseResult,\n\ttype ContextWindowSelection,\n\ttype ContextWindowSelectionError,\n\ttype ContextWindowSelectionOptions,\n} from \"./core/context-window.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\nexport { areExperimentalFeaturesEnabled } from \"./core/experimental.ts\";\nexport * from \"./index-extensions.js\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\nexport { createAskUserQuestionToolDefinition } from \"./core/tools/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type { DefaultProjectTrust } from \"./core/settings-manager.ts\";\nexport {\n\thasProjectTrustInputs,\n\thasTrustRequiringProjectResources,\n\tTRUST_REQUIRING_PROJECT_CONFIG_RESOURCES,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n} from \"./core/trust-manager.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tResourceCollision,\n\tResourceDiagnostic,\n\tResourceLoader,\n} from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateSearchTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateStructuredOutputCapture,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype PromptTemplate,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n} from \"./core/sdk.ts\";\nexport {\n\tWORKFLOW_SESSION_METADATA_ENV,\n\tworkflowSessionMetadataFromEnv,\n} from \"./core/session-manager-classification.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionBoundaryEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionWorkflowMetadata,\n\ttype SessionTreeNode,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateSearchToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcContextWindowInfo,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tchatEntriesFromAgentMessages,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\tChatTranscriptComponent,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tBranchSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tUsageMeterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport {\n\tisSafeFsWatchPathError,\n\tisUnsafeWindowsShortPath,\n\tresolveNativeWatchPath,\n\tSAFE_FS_WATCH_CANONICALIZATION_FAILED,\n\tSAFE_FS_WATCH_UNSAFE_WINDOWS_SHORT_PATH,\n\twatchWithErrorHandler,\n\ttype SafeFsWatchErrorCode,\n\ttype SafeFsWatchPathError,\n} from \"./utils/fs-watch.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,oBAA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KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EACvC,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { parseArgs } from "./cli/args.js";
4
4
  export { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, CONFIG_DIR_NAMES, LEGACY_CONFIG_DIR_NAME, LEGACY_ENV_PREFIX, getAgentConfigPaths, getAgentDir, getAgentDirs, getBundledInteractiveAssetPath, getChangelogPath, getDocsPath, getExamplesPath, getExportTemplateDir, getInteractiveAssetsDir, getLegacyAgentDir, getPackageDir, getPackageJsonPath, getProjectConfigDirs, getProjectConfigPaths, getReadmePath, getThemesDir, getEnvNames, getEnvValue, ENV_CODEX_FAST_MODE, WORKFLOW_STAGE_SUBAGENT_GUARD_ENV, isBunBinary, getUserConfigDirs, getUserConfigPaths, hasEnvValue, PACKAGE_NAME, setEnvValue, VERSION, } from "./config.js";
5
5
  export { executeBashWithOperations } from "./core/bash-executor.js";
6
6
  export { parseFlattenedKeyPath, reconstructFlattenedKeys, unflattenArgumentsWithSchema, } from "./core/flattened-tool-arguments.js";
7
+ export { StringEnum } from "./core/typebox-compat.js";
7
8
  export { AgentSession, parseSkillBlock, } from "./core/agent-session.js";
8
9
  // Auth and model registry
9
10
  export { AuthStorage, FileAuthStorageBackend, InMemoryAuthStorageBackend, } from "./core/auth-storage.js";