@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":"whimsical-messages.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/whimsical-messages.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6cH,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD","sourcesContent":["/**\n * Whimsical working messages cycled into the interactive loader between turns.\n */\n\nconst messages = [\n // Short\n \"Schlepping...\",\n \"Combobulating...\",\n \"Doing...\",\n \"Channelling...\",\n \"Vibing...\",\n \"Concocting...\",\n \"Spelunking...\",\n \"Transmuting...\",\n \"Imagining...\",\n \"Pontificating...\",\n \"Whirring...\",\n \"Cogitating...\",\n \"Honking...\",\n \"Flibbertigibbeting...\",\n \"Noodling...\",\n \"Percolating...\",\n \"Ruminating...\",\n \"Simmering...\",\n \"Marinating...\",\n \"Fermenting...\",\n \"Gestating...\",\n \"Hatching...\",\n \"Brewing...\",\n \"Steeping...\",\n \"Contemplating...\",\n \"Musing...\",\n \"Pondering...\",\n \"Mulling...\",\n \"Daydreaming...\",\n \"Woolgathering...\",\n \"Dithering...\",\n \"Faffing...\",\n \"Puttering...\",\n \"Tinkering...\",\n \"Fiddling...\",\n \"Noodging...\",\n \"Finagling...\",\n \"Wrangling...\",\n \"Jiggling...\",\n \"Wiggling...\",\n \"Shimmying...\",\n \"Galumphing...\",\n \"Perambulating...\",\n \"Meandering...\",\n \"Traipsing...\",\n \"Moseying...\",\n \"Sauntering...\",\n \"Ambling...\",\n \"Pottering...\",\n \"Bumbling...\",\n \"Futzing...\",\n \"Schmalzing...\",\n \"Kerfuffling...\",\n \"Bamboozling...\",\n \"Discombobulating...\",\n \"Recombobulating...\",\n \"Unbefuddling...\",\n \"Defenestrating...\",\n \"Confabulating...\",\n \"Persnicketing...\",\n \"Flummoxing...\",\n \"Befuddling...\",\n \"Snorkeling...\",\n \"Yodeling...\",\n \"Zigzagging...\",\n \"Ricocheting...\",\n \"Somersaulting...\",\n \"Pirouetting...\",\n \"Canoodling...\",\n \"Schmoozing...\",\n \"Kibbitzing...\",\n \"Skedaddling...\",\n \"Scampering...\",\n \"Skittering...\",\n \"Sashaying...\",\n \"Swashbuckling...\",\n \"Oscillating...\",\n \"Undulating...\",\n \"Pulsating...\",\n \"Effervescing...\",\n \"Fizzing...\",\n \"Bubbling...\",\n \"Perplexing...\",\n \"Mystifying...\",\n \"Enchanting...\",\n \"Bewitching...\",\n \"Beguiling...\",\n \"Mesmerizing...\",\n \"Bedazzling...\",\n \"Sparkling...\",\n \"Glittering...\",\n \"Scintillating...\",\n \"Coruscating...\",\n \"Phosphorescing...\",\n \"Luminescing...\",\n \"Sublimating...\",\n \"Synthesizing...\",\n \"Amalgamating...\",\n \"Procrastinating...\",\n \"Dillydallying...\",\n \"Lollygagging...\",\n \"Dawdling...\",\n \"Malingering...\",\n \"Skulking...\",\n \"Lurking...\",\n \"Sleuthing...\",\n \"Rummaging...\",\n \"Fossicking...\",\n \"Foraging...\",\n \"Scavenging...\",\n \"Absquatulating...\",\n \"Vamoosing...\",\n \"Absconding...\",\n \"Grooving...\",\n \"Jamming...\",\n \"Improvising...\",\n \"Extemporizing...\",\n \"Freestyling...\",\n \"Frolicking...\",\n \"Gamboling...\",\n \"Blorping...\",\n \"Flonking...\",\n \"Snurfling...\",\n \"Whomping...\",\n \"Zorping...\",\n \"Biffing...\",\n \"Splunging...\",\n \"Thwacking...\",\n \"Gonkulating...\",\n \"Splorfing...\",\n \"Wibbling...\",\n \"Wobbling...\",\n \"Squonking...\",\n \"Plonking...\",\n \"Bonking...\",\n \"Zonking...\",\n \"Flumping...\",\n \"Clomping...\",\n \"Squelching...\",\n \"Schlurping...\",\n \"Glurping...\",\n \"Burbling...\",\n \"Gurgling...\",\n \"Splooshing...\",\n \"Whooshing...\",\n \"Swooshing...\",\n \"Kerplunking...\",\n \"Thunking...\",\n \"Clunking...\",\n \"Clanking...\",\n \"Rattling...\",\n \"Jostling...\",\n \"Rustling...\",\n \"Bustling...\",\n \"Hustling...\",\n \"Miffing...\",\n \"Boffing...\",\n \"Snazzifying...\",\n \"Pizzazzing...\",\n \"Razzmatazzing...\",\n \"Bedoodling...\",\n \"Doodling...\",\n \"Scribbling...\",\n \"Squiggling...\",\n \"Wriggling...\",\n \"Niggling...\",\n \"Higgling...\",\n \"Piggling...\",\n \"Figgling...\",\n \"Gibbering...\",\n \"Jabbering...\",\n \"Blathering...\",\n \"Blithering...\",\n \"Withering...\",\n \"Slithering...\",\n \"Tethering...\",\n \"Feathering...\",\n \"Weathering...\",\n \"Leathering...\",\n \"Heathering...\",\n \"Smoldering...\",\n \"Moldering...\",\n \"Shouldering...\",\n \"Bouldering...\",\n \"Tottering...\",\n \"Teetering...\",\n \"Tittering...\",\n \"Flittering...\",\n \"Jittering...\",\n \"Frittering...\",\n \"Twittering...\",\n \"Nattering...\",\n \"Chattering...\",\n \"Clattering...\",\n \"Splattering...\",\n \"Battering...\",\n \"Scattering...\",\n \"Shattering...\",\n \"Flattering...\",\n \"Pattering...\",\n \"Tattering...\",\n \"Mattering...\",\n \"Yammering...\",\n \"Hammering...\",\n \"Stammering...\",\n \"Clamoring...\",\n \"Glamoring...\",\n \"Enamoring...\",\n \"Shimmering...\",\n \"Glimmering...\",\n \"Brimming...\",\n \"Skimming...\",\n \"Trimming...\",\n \"Primming...\",\n \"Whimming...\",\n \"Humming...\",\n \"Strumming...\",\n \"Thrumming...\",\n \"Drumming...\",\n \"Plumbing...\",\n \"Thumbing...\",\n \"Numbing...\",\n \"Fumbling...\",\n \"Grumbling...\",\n \"Mumbling...\",\n \"Rumbling...\",\n \"Stumbling...\",\n \"Tumbling...\",\n \"Crumbling...\",\n \"Jumbling...\",\n \"Humbling...\",\n \"Bungling...\",\n \"Jungling...\",\n \"Mangling...\",\n \"Wangling...\",\n \"Dangling...\",\n \"Tangling...\",\n \"Jangling...\",\n \"Angling...\",\n \"Struggling...\",\n \"Mingling...\",\n \"Tingling...\",\n \"Jingling...\",\n \"Singling...\",\n \"Ringling...\",\n \"Kingling...\",\n\n // Long\n \"Consulting the void...\",\n \"Asking the electrons...\",\n \"Bribing the compiler...\",\n \"Negotiating with entropy...\",\n \"Whispering to the bits...\",\n \"Tickling the stack...\",\n \"Massaging the heap...\",\n \"Appeasing the garbage collector...\",\n \"Summoning semicolons...\",\n \"Herding pointers...\",\n \"Untangling spaghetti...\",\n \"Polishing the algorithms...\",\n \"Waxing philosophical...\",\n \"Consulting ancient scrolls...\",\n \"Reading tea leaves...\",\n \"Shaking the magic 8-ball...\",\n \"Sacrificing to the demo gods...\",\n \"Warming up the hamsters...\",\n \"Spinning up the squirrels...\",\n \"Caffeinating...\",\n \"Existentially questioning...\",\n \"Having a little think...\",\n \"Stroking chin thoughtfully...\",\n \"Squinting at the problem...\",\n \"Staring into the abyss...\",\n \"Abyss staring back...\",\n \"Achieving enlightenment...\",\n \"Transcending mere computation...\",\n \"Ascending to a higher plane...\",\n \"Communing with the machine spirit...\",\n \"Performing arcane rituals...\",\n \"Invoking elder functions...\",\n \"Consulting the oracle...\",\n \"Divining the answer...\",\n \"Scrying the codebase...\",\n \"Dowsing for bugs...\",\n \"Rearranging deck chairs...\",\n \"Shuffling bits around...\",\n \"Aligning the chakras...\",\n \"Reticulating splines...\",\n \"Reversing the polarity...\",\n \"Calibrating the flux capacitor...\",\n \"Charging the crystals...\",\n \"Tuning the vibrations...\",\n \"Adjusting the cosmic frequency...\",\n \"Waiting for a sign...\",\n \"Hoping for the best...\",\n \"Manifesting solutions...\",\n \"Willing it into existence...\",\n \"Believing really hard...\",\n \"Politely asking the CPU...\",\n \"Bribing the runtime...\",\n \"Flirting with the database...\",\n \"Sweet-talking the API...\",\n \"Negotiating with deadlines...\",\n \"Having words with the cache...\",\n \"Reasoning with the memory...\",\n \"Pleading with the logs...\",\n \"Bargaining with fate...\",\n \"Making offerings to the CI...\",\n \"Praying to the uptime gods...\",\n \"Consulting the rubber duck...\",\n \"Interrogating the stack trace...\",\n \"Cross-examining the debugger...\",\n \"Petitioning the kernel...\",\n \"Lobbying the scheduler...\",\n \"Schmoozing the network...\",\n \"Buttering up the firewall...\",\n \"Wining and dining the servers...\",\n \"Taking the bytes out for lunch...\",\n \"Giving the code a pep talk...\",\n \"Reading the room...\",\n \"Checking under the hood...\",\n \"Kicking the tires...\",\n \"Shaking loose the cobwebs...\",\n \"Dusting off the neurons...\",\n \"Greasing the gears...\",\n \"Oiling the cogs...\",\n \"Winding up the clockwork...\",\n \"Stoking the furnace...\",\n \"Feeding the machine...\",\n \"Watering the logic tree...\",\n \"Pruning the decision branches...\",\n \"Harvesting the outputs...\",\n \"Planting computational seeds...\",\n \"Nurturing the algorithm...\",\n \"Raising the exceptions...\",\n \"Taming wild pointers...\",\n \"Herding cats in memory...\",\n \"Teaching old code new tricks...\",\n \"Whispering sweet nothings to the compiler...\",\n \"Serenading the syntax...\",\n \"Dancing with dependencies...\",\n \"Waltzing through the codebase...\",\n \"Tangoing with type errors...\",\n \"Doing the deployment dance...\",\n \"Having a moment of clarity...\",\n \"Experiencing a flash of insight...\",\n \"Channeling the ancient developers...\",\n \"Receiving transmissions from the cloud...\",\n \"Asking the hamsters to run faster...\",\n \"Convincing the pixels to cooperate...\",\n \"Teaching electrons new tricks...\",\n \"Bribing the byte fairies...\",\n \"Whispering passwords to the void...\",\n \"Negotiating with cosmic rays...\",\n \"Flattering the floating points...\",\n \"Seducing the semicolons...\",\n \"Wooing the while loops...\",\n \"Charming the curly braces...\",\n \"Hypnotizing the hash tables...\",\n \"Mesmerizing the memory banks...\",\n \"Enchanting the error handlers...\",\n \"Bewitching the boolean logic...\",\n \"Spellbinding the stack frames...\",\n \"Hexing the hexadecimals...\",\n \"Jinxing the JSON parsers...\",\n \"Cursing the cache misses...\",\n \"Blessing the build process...\",\n \"Anointing the algorithms...\",\n \"Consecrating the callbacks...\",\n \"Sanctifying the source code...\",\n \"Exorcising the exceptions...\",\n \"Purifying the parameters...\",\n \"Cleansing the closures...\",\n \"Baptizing the binary...\",\n \"Absolving the abstractions...\",\n \"Redeeming the recursion...\",\n \"Forgiving the for loops...\",\n \"Pardoning the pointers...\",\n \"Liberating the lambdas...\",\n \"Emancipating the enums...\",\n \"Freeing the functions...\",\n \"Releasing the references...\",\n \"Unbinding the variables...\",\n \"Untying the type knots...\",\n \"Unraveling the regex...\",\n \"Decoding the mysteries...\",\n \"Cracking the conundrums...\",\n \"Solving the riddles of RAM...\",\n \"Unlocking the secrets of silicon...\",\n \"Discovering hidden semicolons...\",\n \"Unearthing buried bugs...\",\n \"Excavating ancient APIs...\",\n \"Archeologically analyzing the architecture...\",\n \"Fossil hunting in the functions...\",\n \"Spelunking through the stack...\",\n \"Scuba diving in the data...\",\n \"Snorkeling through the streams...\",\n \"Parasailing past the parameters...\",\n \"Hang gliding through the heap...\",\n \"Bungee jumping into the backend...\",\n \"Skydiving through the source...\",\n \"Surfing the syntax waves...\",\n \"Skateboarding down the stack trace...\",\n \"Snowboarding through the schemas...\",\n \"Mountain climbing the modules...\",\n \"Hiking through the headers...\",\n \"Trekking through the trees...\",\n \"Backpacking through the binaries...\",\n \"Camping in the codebase...\",\n \"Glamping in the globals...\",\n \"Picnicking with the processes...\",\n \"Barbecuing the bugs...\",\n \"Roasting the race conditions...\",\n \"Grilling the glitches...\",\n \"Sautéing the syntax errors...\",\n \"Flambéing the failures...\",\n \"Caramelizing the callbacks...\",\n \"Braising the breakpoints...\",\n \"Poaching the pointers...\",\n \"Blanching the branches...\",\n \"Searing the segments...\",\n \"Smoking the subroutines...\",\n \"Curing the code smells...\",\n \"Pickling the packages...\",\n \"Preserving the protocols...\",\n \"Canning the constants...\",\n \"Bottling the buffers...\",\n \"Jarring the JavaScript...\",\n \"Decanting the data structures...\",\n \"Aerating the arrays...\",\n \"Letting the logic breathe...\",\n \"Aging the algorithms gracefully...\",\n \"Maturing the methods...\",\n \"Ripening the results...\",\n \"Seasoning the solutions...\",\n \"Spicing up the specs...\",\n \"Garnishing the getters...\",\n \"Plating the output nicely...\",\n \"Presenting with pizzazz...\",\n \"Adding a dash of elegance...\",\n \"Sprinkling some magic dust...\",\n \"Drizzling debug sauce...\",\n \"Folding in the features...\",\n \"Whisking the widgets...\",\n \"Kneading the namespaces...\",\n \"Rolling out the runtime...\",\n \"Proofing the promises...\",\n \"Letting the dough rise...\",\n \"Baking at 350 kilobytes...\",\n \"Frosting the functions...\",\n \"Decorating the deployment...\",\n \"Icing the interfaces...\",\n \"Glazing the graphics...\",\n \"Topping with tests...\",\n \"Cherry-picking the commits...\",\n];\n\nexport function pickWhimsicalWorkingMessage(): string {\n return messages[Math.floor(Math.random() * messages.length)];\n}\n"]}
1
+ {"version":3,"file":"whimsical-messages.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/whimsical-messages.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6cH,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"print-mode.d.ts","sourceRoot":"","sources":["../../src/modes/print-mode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAoB,YAAY,EAAqB,MAAM,8BAA8B,CAAC;AAEtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAO5E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAC/B;AAiED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuK/G","sourcesContent":["/**\n * Print mode (single-shot): Send prompts, output result, exit.\n *\n * Used for:\n * - `pi -p \"prompt\"` - text output\n * - `pi --mode json \"prompt\"` - JSON event stream\n */\n\nimport type { AssistantMessage, ImageContent, ToolResultMessage } from \"@earendil-works/pi-ai/compat\";\nimport type { AgentSessionEvent } from \"../core/agent-session.ts\";\nimport type { AgentSessionRuntime } from \"../core/agent-session-runtime.ts\";\nimport type { ExtensionError } from \"../core/extensions/index.ts\";\nimport type { ToolDefinition } from \"../core/extensions/types.ts\";\nimport type { CustomMessage } from \"../core/messages.ts\";\nimport { flushRawStdout, writeRawStdout } from \"../core/output-guard.ts\";\nimport { killTrackedDetachedChildren } from \"../utils/shell.ts\";\n\n/**\n * Options for print mode.\n */\nexport interface PrintModeOptions {\n\t/** Output mode: \"text\" for final response only, \"json\" for all events */\n\tmode: \"text\" | \"json\";\n\t/** Array of additional prompts to send after initialMessage */\n\tmessages?: string[];\n\t/** First message to send (may contain @file content) */\n\tinitialMessage?: string;\n\t/** Images to attach to the initial message */\n\tinitialImages?: ImageContent[];\n}\n\nfunction isCommandExtensionError(error: ExtensionError): boolean {\n\treturn error.event === \"command\" || error.extensionPath.startsWith(\"command:\");\n}\n\nfunction displayableCustomText(message: CustomMessage): string | undefined {\n\tif (message.display !== true) return undefined;\n\tif (typeof message.content === \"string\") return message.content;\n\n\tlet text = \"\";\n\tlet hasTextPart = false;\n\tfor (const part of message.content) {\n\t\tif (part.type === \"text\") {\n\t\t\thasTextPart = true;\n\t\t\ttext += part.text;\n\t\t}\n\t}\n\n\treturn hasTextPart ? text : undefined;\n}\n\ntype MaybeTerminatingToolResult = {\n\tterminate?: boolean;\n};\n\ntype ToolExecutionEndSessionEvent = Extract<AgentSessionEvent, { type: \"tool_execution_end\" }>;\n\ntype GetToolDefinition = (name: string) => ToolDefinition | undefined;\n\nfunction isStructuredOutputTool(getToolDefinition: GetToolDefinition, name: string): boolean {\n\treturn getToolDefinition(name)?.structuredOutput === true;\n}\n\nfunction isTerminatingStructuredOutputEvent(\n\tevent: AgentSessionEvent,\n\tgetToolDefinition: GetToolDefinition,\n): event is ToolExecutionEndSessionEvent {\n\tif (event.type !== \"tool_execution_end\") return false;\n\tif (!isStructuredOutputTool(getToolDefinition, event.toolName)) return false;\n\tif (event.isError) return false;\n\tconst result = event.result as MaybeTerminatingToolResult | undefined;\n\treturn result?.terminate === true;\n}\n\nfunction textFromToolResult(message: ToolResultMessage): string | undefined {\n\tlet text = \"\";\n\tlet hasTextPart = false;\n\tfor (const part of message.content) {\n\t\tif (part.type === \"text\") {\n\t\t\thasTextPart = true;\n\t\t\ttext += part.text;\n\t\t}\n\t}\n\treturn hasTextPart ? text : undefined;\n}\n\nfunction terminatingStructuredOutputText(\n\tmessage: ToolResultMessage,\n\tterminatingStructuredOutputCallIds: ReadonlySet<string>,\n): string | undefined {\n\tif (!terminatingStructuredOutputCallIds.has(message.toolCallId)) return undefined;\n\treturn textFromToolResult(message);\n}\n\n/**\n * Run in print (single-shot) mode.\n * Sends prompts to the agent and outputs the result.\n */\nexport async function runPrintMode(runtimeHost: AgentSessionRuntime, options: PrintModeOptions): Promise<number> {\n\tconst { mode, messages = [], initialMessage, initialImages } = options;\n\tlet exitCode = 0;\n\tlet suppressFinalOutput = false;\n\tlet activePromptHadCommandError = false;\n\tlet session = runtimeHost.session;\n\tlet unsubscribe: (() => void) | undefined;\n\tconst terminatingStructuredOutputCallIds = new Set<string>();\n\tlet disposed = false;\n\tconst signalCleanupHandlers: Array<() => void> = [];\n\n\tconst disposeRuntime = async (): Promise<void> => {\n\t\tif (disposed) return;\n\t\tdisposed = true;\n\t\tunsubscribe?.();\n\t\tawait runtimeHost.dispose();\n\t};\n\n\tconst registerSignalHandlers = (): void => {\n\t\tconst signals: NodeJS.Signals[] = [\"SIGTERM\"];\n\t\tif (process.platform !== \"win32\") {\n\t\t\tsignals.push(\"SIGHUP\");\n\t\t}\n\n\t\tfor (const signal of signals) {\n\t\t\tconst handler = () => {\n\t\t\t\tkillTrackedDetachedChildren();\n\t\t\t\tvoid disposeRuntime().finally(() => {\n\t\t\t\t\tprocess.exit(signal === \"SIGHUP\" ? 129 : 143);\n\t\t\t\t});\n\t\t\t};\n\t\t\tprocess.on(signal, handler);\n\t\t\tsignalCleanupHandlers.push(() => process.off(signal, handler));\n\t\t}\n\t};\n\n\tregisterSignalHandlers();\n\n\tconst promptWithScopedCommandSuppression = async (\n\t\ttext: string,\n\t\tpromptOptions?: { images?: ImageContent[] },\n\t): Promise<void> => {\n\t\tactivePromptHadCommandError = false;\n\t\ttry {\n\t\t\tif (promptOptions === undefined) {\n\t\t\t\tawait session.prompt(text);\n\t\t\t} else {\n\t\t\t\tawait session.prompt(text, promptOptions);\n\t\t\t}\n\t\t} finally {\n\t\t\t// Final-output suppression is scoped to the most recent prompt so a\n\t\t\t// later successful prompt in the same invocation can still print its\n\t\t\t// result. The non-zero exit code remains sticky across prompts.\n\t\t\tsuppressFinalOutput = activePromptHadCommandError;\n\t\t}\n\t};\n\n\tconst rebindSession = async (): Promise<void> => {\n\t\tsession = runtimeHost.session;\n\t\tawait session.bindExtensions({\n\t\t\tmode: mode === \"json\" ? \"json\" : \"print\",\n\t\t\tcommandContextActions: {\n\t\t\t\twaitForIdle: () => session.agent.waitForIdle(),\n\t\t\t\tnewSession: async (newSessionOptions) => runtimeHost.newSession(newSessionOptions),\n\t\t\t\tfork: async (entryId, forkOptions) => {\n\t\t\t\t\tconst result = await runtimeHost.fork(entryId, forkOptions);\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t},\n\t\t\t\tnavigateTree: async (targetId, navigateOptions) => {\n\t\t\t\t\tconst result = await session.navigateTree(targetId, {\n\t\t\t\t\t\tsummarize: navigateOptions?.summarize,\n\t\t\t\t\t\tcustomInstructions: navigateOptions?.customInstructions,\n\t\t\t\t\t\treplaceInstructions: navigateOptions?.replaceInstructions,\n\t\t\t\t\t\tlabel: navigateOptions?.label,\n\t\t\t\t\t});\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t},\n\t\t\t\tswitchSession: async (sessionPath, switchOptions) => {\n\t\t\t\t\treturn runtimeHost.switchSession(sessionPath, switchOptions);\n\t\t\t\t},\n\t\t\t\treload: async () => {\n\t\t\t\t\tawait session.reload();\n\t\t\t\t},\n\t\t\t},\n\t\t\tonError: (err) => {\n\t\t\t\tconst isCommandError = isCommandExtensionError(err);\n\t\t\t\tif (isCommandError) exitCode = 1;\n\t\t\t\tactivePromptHadCommandError = activePromptHadCommandError || isCommandError;\n\t\t\t\tconsole.error(`Extension error (${err.extensionPath}): ${err.error}`);\n\t\t\t},\n\t\t});\n\n\t\tunsubscribe?.();\n\t\tunsubscribe = session.subscribe((event) => {\n\t\t\tif (isTerminatingStructuredOutputEvent(event, (name) => session.getToolDefinition(name))) {\n\t\t\t\tterminatingStructuredOutputCallIds.add(event.toolCallId);\n\t\t\t}\n\t\t\tif (mode === \"json\") {\n\t\t\t\twriteRawStdout(`${JSON.stringify(event)}\\n`);\n\t\t\t}\n\t\t});\n\t};\n\n\truntimeHost.setRebindSession(async () => {\n\t\tawait rebindSession();\n\t});\n\n\ttry {\n\t\tif (mode === \"json\") {\n\t\t\tconst header = session.sessionManager.getHeader();\n\t\t\tif (header) {\n\t\t\t\twriteRawStdout(`${JSON.stringify(header)}\\n`);\n\t\t\t}\n\t\t}\n\n\t\tawait rebindSession();\n\n\t\tif (initialMessage) {\n\t\t\tawait promptWithScopedCommandSuppression(initialMessage, { images: initialImages });\n\t\t}\n\n\t\tfor (const message of messages) {\n\t\t\tawait promptWithScopedCommandSuppression(message);\n\t\t}\n\n\t\tconst state = session.state;\n\t\tconst lastMessage = state.messages[state.messages.length - 1];\n\n\t\tif (lastMessage?.role === \"assistant\") {\n\t\t\tconst assistantMsg = lastMessage as AssistantMessage;\n\t\t\tif (assistantMsg.stopReason === \"error\" || assistantMsg.stopReason === \"aborted\") {\n\t\t\t\tif (mode === \"text\" && !suppressFinalOutput) {\n\t\t\t\t\tconsole.error(assistantMsg.errorMessage || `Request ${assistantMsg.stopReason}`);\n\t\t\t\t}\n\t\t\t\texitCode = 1;\n\t\t\t} else if (mode === \"text\" && !suppressFinalOutput) {\n\t\t\t\tfor (const content of assistantMsg.content) {\n\t\t\t\t\tif (content.type === \"text\") {\n\t\t\t\t\t\twriteRawStdout(`${content.text}\\n`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (mode === \"text\" && !suppressFinalOutput) {\n\t\t\tif (lastMessage?.role === \"custom\") {\n\t\t\t\tconst text = displayableCustomText(lastMessage as CustomMessage);\n\t\t\t\tif (text !== undefined) {\n\t\t\t\t\twriteRawStdout(`${text}\\n`);\n\t\t\t\t}\n\t\t\t} else if (lastMessage?.role === \"toolResult\") {\n\t\t\t\tconst text = terminatingStructuredOutputText(lastMessage as ToolResultMessage, terminatingStructuredOutputCallIds);\n\t\t\t\tif (text !== undefined) {\n\t\t\t\t\twriteRawStdout(`${text}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn exitCode;\n\t} catch (error: unknown) {\n\t\tconsole.error(error instanceof Error ? error.message : String(error));\n\t\treturn 1;\n\t} finally {\n\t\tfor (const cleanup of signalCleanupHandlers) {\n\t\t\tcleanup();\n\t\t}\n\t\tawait disposeRuntime();\n\t\tawait flushRawStdout();\n\t}\n}\n"]}
1
+ {"version":3,"file":"print-mode.d.ts","sourceRoot":"","sources":["../../src/modes/print-mode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAoB,YAAY,EAAqB,MAAM,8BAA8B,CAAC;AAEtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAO5E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAC/B;AAiED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuK/G"}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAqClG","sourcesContent":["import type { Readable } from \"node:stream\";\nimport { StringDecoder } from \"node:string_decoder\";\n\n/**\n * Serialize a single strict JSONL record.\n *\n * Framing is LF-only. Payload strings may contain other Unicode separators such as\n * U+2028 and U+2029. Clients must split records on `\\n` only.\n */\nexport function serializeJsonLine(value: unknown): string {\n\treturn `${JSON.stringify(value)}\\n`;\n}\n\n/**\n * Attach an LF-only JSONL reader to a stream.\n *\n * This intentionally does not use Node readline. Readline splits on additional\n * Unicode separators that are valid inside JSON strings and therefore does not\n * implement strict JSONL framing.\n */\nexport function attachJsonlLineReader(stream: Readable, onLine: (line: string) => void): () => void {\n\tconst decoder = new StringDecoder(\"utf8\");\n\tlet buffer = \"\";\n\n\tconst emitLine = (line: string) => {\n\t\tonLine(line.endsWith(\"\\r\") ? line.slice(0, -1) : line);\n\t};\n\n\tconst onData = (chunk: string | Buffer) => {\n\t\tbuffer += typeof chunk === \"string\" ? chunk : decoder.write(chunk);\n\n\t\twhile (true) {\n\t\t\tconst newlineIndex = buffer.indexOf(\"\\n\");\n\t\t\tif (newlineIndex === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\temitLine(buffer.slice(0, newlineIndex));\n\t\t\tbuffer = buffer.slice(newlineIndex + 1);\n\t\t}\n\t};\n\n\tconst onEnd = () => {\n\t\tbuffer += decoder.end();\n\t\tif (buffer.length > 0) {\n\t\t\temitLine(buffer);\n\t\t\tbuffer = \"\";\n\t\t}\n\t};\n\n\tstream.on(\"data\", onData);\n\tstream.on(\"end\", onEnd);\n\n\treturn () => {\n\t\tstream.off(\"data\", onData);\n\t\tstream.off(\"end\", onEnd);\n\t};\n}\n"]}
1
+ {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAqClG"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEnF,OAAO,KAAK,EAEX,oBAAoB,EACpB,QAAQ,EAER,eAAe,EACf,eAAe,EACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAYrE,MAAM,WAAW,gBAAgB;IAChC,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM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IACnF,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAG5F;IAED,8BAA8B;IACxB,OAAO,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAG3E;IACK,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGnD;IACK,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhD;IACK,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAG3C;IACK,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAG9C;IACD,WAAW,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1C;IACD,aAAa,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgBlD;IACK,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,SAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAIlG;IACD,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,sBAAsB;IAG9B,OAAO,CAAC,qBAAqB;YAMf,IAAI;IA2ClB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,OAAO;CAKf","sourcesContent":["/**\n * RPC Client for programmatic access to the coding agent.\n *\n * Spawns the agent in RPC mode and provides a typed API for all operations.\n */\n\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { ImageContent } from \"@earendil-works/pi-ai/compat\";\nimport type { SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.ts\";\nimport type {\n\tRpcCommand,\n\tRpcContextWindowInfo,\n\tRpcEvent,\n\tRpcResponse,\n\tRpcSessionState,\n\tRpcSlashCommand,\n} from \"./rpc-types.ts\";\nexport type { RpcContextWindowInfo, RpcEvent } from \"./rpc-types.ts\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Distributive Omit that works with union types */\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\n/** RpcCommand without the id field (for internal send) */\ntype RpcCommandBody = DistributiveOmit<RpcCommand, \"id\">;\n\nexport interface RpcClientOptions {\n\t/** Path to the CLI entry point (default: searches for dist/cli.js) */\n\tcliPath?: string;\n\t/** Working directory for the agent */\n\tcwd?: string;\n\t/** Environment variables */\n\tenv?: Record<string, string>;\n\t/** Provider to use */\n\tprovider?: string;\n\t/** Model ID to use */\n\tmodel?: string;\n\t/** Startup context-window selection, as raw tokens or compact form like \"400k\"/\"1m\" */\n\tcontextWindow?: number | string;\n\t/** Additional CLI arguments */\n\targs?: string[];\n}\n\nexport interface ModelInfo {\n\tprovider: string;\n\tid: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\nexport type RpcEventListener = (event: RpcEvent) => void;\n\n// ============================================================================\n// RPC Client\n// ============================================================================\n\nexport class RpcClient {\n\tprivate process: ChildProcess | null = null;\n\tprivate stopReadingStdout: (() => void) | null = null;\n\tprivate eventListeners: RpcEventListener[] = [];\n\tprivate pendingRequests: Map<string, { resolve: (response: RpcResponse) => void; reject: (error: Error) => void }> =\n\t\tnew Map();\n\tprivate requestId = 0;\n\tprivate stderr = \"\";\n\tprivate exitError: Error | null = null;\n\n\tdeclare private options: RpcClientOptions;\n\n\tconstructor(options: RpcClientOptions = {}) {\n\t\tthis.options = options;\n\t}\n\n\t/** Start the RPC agent process. */\n\tasync start(): Promise<void> {\n\t\tif (this.process) {\n\t\t\tthrow new Error(\"Client already started\");\n\t\t}\n\n\t\tconst cliPath = this.options.cliPath ?? \"dist/cli.js\";\n\t\tconst args = [\"--mode\", \"rpc\"];\n\n\t\tif (this.options.provider) {\n\t\t\targs.push(\"--provider\", this.options.provider);\n\t\t}\n\t\tif (this.options.model) {\n\t\t\targs.push(\"--model\", this.options.model);\n\t\t}\n\t\tif (this.options.contextWindow !== undefined) {\n\t\t\targs.push(\"--context-window\", String(this.options.contextWindow));\n\t\t}\n\t\tif (this.options.args) {\n\t\t\targs.push(...this.options.args);\n\t\t}\n\n\t\tthis.exitError = null;\n\t\tconst childProcess = spawn(\"node\", [cliPath, ...args], {\n\t\t\tcwd: this.options.cwd,\n\t\t\tenv: { ...process.env, ...this.options.env },\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t});\n\t\tthis.process = childProcess;\n\n\t\tchildProcess.once(\"exit\", (code, signal) => {\n\t\t\tconst error = this.createProcessExitError(code, signal);\n\t\t\tthis.exitError = error;\n\t\t\tthis.rejectPendingRequests(error);\n\t\t});\n\t\tchildProcess.once(\"error\", (error) => {\n\t\t\tthis.exitError = error;\n\t\t\tthis.rejectPendingRequests(error);\n\t\t});\n\t\tchildProcess.stdin?.on(\"error\", (error) => {\n\t\t\tthis.exitError = error;\n\t\t\tthis.rejectPendingRequests(error);\n\t\t});\n\n\t\t// Collect stderr for debugging\n\t\tchildProcess.stderr?.on(\"data\", (data) => {\n\t\t\tthis.stderr += data.toString();\n\t\t\tprocess.stderr.write(data);\n\t\t});\n\n\t\t// Set up strict JSONL reader for stdout.\n\t\tthis.stopReadingStdout = attachJsonlLineReader(childProcess.stdout!, (line) => {\n\t\t\tthis.handleLine(line);\n\t\t});\n\n\t\t// Wait a moment for process to initialize\n\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\n\t\tif (this.process.exitCode !== null) {\n\t\t\tthrow new Error(`Agent process exited immediately with code ${this.process.exitCode}. Stderr: ${this.stderr}`);\n\t\t}\n\t}\n\n\t/** Stop the RPC agent process. */\n\tasync stop(): Promise<void> {\n\t\tif (!this.process) return;\n\n\t\tthis.stopReadingStdout?.();\n\t\tthis.stopReadingStdout = null;\n\t\tthis.process.kill(\"SIGTERM\");\n\n\t\t// Wait for process to exit\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tthis.process?.kill(\"SIGKILL\");\n\t\t\t\tresolve();\n\t\t\t}, 1000);\n\n\t\t\tthis.process?.on(\"exit\", () => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\tthis.process = null;\n\t\tthis.pendingRequests.clear();\n\t}\n\n\t/** Subscribe to agent events. */\n\tonEvent(listener: RpcEventListener): () => void {\n\t\tthis.eventListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.eventListeners.indexOf(listener);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.eventListeners.splice(index, 1);\n\t\t\t}\n\t\t};\n\t}\n\n\t/** Get collected stderr output (useful for debugging). */\n\tgetStderr(): string {\n\t\treturn this.stderr;\n\t}\n\n\t// =========================================================================\n\t// Command Methods\n\t// =========================================================================\n\n\t/**\n\t * Send a prompt to the agent.\n\t * Returns immediately after sending; use onEvent() to receive streaming events.\n\t * Use waitForIdle() to wait for completion.\n\t */\n\tasync prompt(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"prompt\", message, images });\n\t}\n\n\t/** Queue a steering message to interrupt the agent mid-run. */\n\tasync steer(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"steer\", message, images });\n\t}\n\n\t/** Queue a follow-up message to be processed after the agent finishes. */\n\tasync followUp(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"follow_up\", message, images });\n\t}\n\n\t/** Abort current operation. */\n\tasync abort(): Promise<void> {\n\t\tawait this.send({ type: \"abort\" });\n\t}\n\n\t/**\n\t * Start a new session, optionally with parent tracking.\n\t * @param parentSession - Optional parent session path for lineage tracking\n\t * @returns Object with `cancelled: true` if an extension cancelled the new session\n\t */\n\tasync newSession(parentSession?: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"new_session\", parentSession });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Get current session state. */\n\tasync getState(): Promise<RpcSessionState> {\n\t\tconst response = await this.send({ type: \"get_state\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Set model by provider and ID. */\n\tasync setModel(provider: string, modelId: string): Promise<{ provider: string; id: string }> {\n\t\tconst response = await this.send({ type: \"set_model\", provider, modelId });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Cycle to next model. */\n\tasync cycleModel(): Promise<{\n\t\tmodel: { provider: string; id: string };\n\t\tthinkingLevel: ThinkingLevel;\n\t\tisScoped: boolean;\n\t} | null> {\n\t\tconst response = await this.send({ type: \"cycle_model\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Get list of available models. */\n\tasync getAvailableModels(): Promise<ModelInfo[]> {\n\t\tconst response = await this.send({ type: \"get_available_models\" });\n\t\treturn this.getData<{ models: ModelInfo[] }>(response).models;\n\t}\n\n\t/** Set thinking level. */\n\tasync setThinkingLevel(level: ThinkingLevel): Promise<void> {\n\t\tawait this.send({ type: \"set_thinking_level\", level });\n\t}\n\n\t/** Cycle thinking level. */\n\tasync cycleThinkingLevel(): Promise<{ level: ThinkingLevel } | null> {\n\t\tconst response = await this.send({ type: \"cycle_thinking_level\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set the active context-window token budget for the current model.\n\t * This is a runtime selection and does not persist context-window defaults.\n\t */\n\tasync setContextWindow(contextWindow: number | string): Promise<void> {\n\t\tconst response = await this.send({ type: \"set_context_window\", contextWindow });\n\t\tthis.assertSuccess(response);\n\t}\n\n\t/** Get selectable context-window token budgets for the current model. */\n\tasync getAvailableContextWindows(): Promise<RpcContextWindowInfo> {\n\t\tconst response = await this.send({ type: \"get_available_context_windows\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Set steering mode. */\n\tasync setSteeringMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_steering_mode\", mode });\n\t}\n\n\t/** Set follow-up mode. */\n\tasync setFollowUpMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_follow_up_mode\", mode });\n\t}\n\n\t/** Compact session context with verbatim line-range compaction. */\n\tasync compact(): Promise<VerbatimCompactionResult> {\n\t\tconst response = await this.send({ type: \"compact\" });\n\t\treturn this.getData(response);\n\t}\n\n\tasync setAutoCompaction(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_compaction\", enabled });\n\t}\n\tasync setAutoRetry(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_retry\", enabled });\n\t}\n\tasync abortRetry(): Promise<void> {\n\t\tawait this.send({ type: \"abort_retry\" });\n\t}\n\tasync bash(command: string): Promise<BashResult> {\n\t\tconst response = await this.send({ type: \"bash\", command });\n\t\treturn this.getData(response);\n\t}\n\tasync abortBash(): Promise<void> {\n\t\tawait this.send({ type: \"abort_bash\" });\n\t}\n\tasync getSessionStats(): Promise<SessionStats> {\n\t\tconst response = await this.send({ type: \"get_session_stats\" });\n\t\treturn this.getData(response);\n\t}\n\tasync exportHtml(outputPath?: string): Promise<{ path: string }> {\n\t\tconst response = await this.send({ type: \"export_html\", outputPath });\n\t\treturn this.getData(response);\n\t}\n\tasync switchSession(sessionPath: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"switch_session\", sessionPath });\n\t\treturn this.getData(response);\n\t}\n\tasync fork(entryId: string): Promise<{ text: string; cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"fork\", entryId });\n\t\treturn this.getData(response);\n\t}\n\tasync clone(): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"clone\" });\n\t\treturn this.getData(response);\n\t}\n\tasync getForkMessages(): Promise<Array<{ entryId: string; text: string }>> {\n\t\tconst response = await this.send({ type: \"get_fork_messages\" });\n\t\treturn this.getData<{ messages: Array<{ entryId: string; text: string }> }>(response).messages;\n\t}\n\n\t/** Session entries in append order, optionally only those after the `since` entry id. */\n\tasync getEntries(since?: string): Promise<{ entries: SessionEntry[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_entries\", since });\n\t\treturn this.getData<{ entries: SessionEntry[]; leafId: string | null }>(response);\n\t}\n\n\t/** The session entry tree. */\n\tasync getTree(): Promise<{ tree: SessionTreeNode[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_tree\" });\n\t\treturn this.getData<{ tree: SessionTreeNode[]; leafId: string | null }>(response);\n\t}\n\tasync getLastAssistantText(): Promise<string | null> {\n\t\tconst response = await this.send({ type: \"get_last_assistant_text\" });\n\t\treturn this.getData<{ text: string | null }>(response).text;\n\t}\n\tasync setSessionName(name: string): Promise<void> {\n\t\tawait this.send({ type: \"set_session_name\", name });\n\t}\n\tasync getMessages(): Promise<AgentMessage[]> {\n\t\tconst response = await this.send({ type: \"get_messages\" });\n\t\treturn this.getData<{ messages: AgentMessage[] }>(response).messages;\n\t}\n\tasync getCommands(): Promise<RpcSlashCommand[]> {\n\t\tconst response = await this.send({ type: \"get_commands\" });\n\t\treturn this.getData<{ commands: RpcSlashCommand[] }>(response).commands;\n\t}\n\twaitForIdle(timeout = 60000): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout waiting for agent to become idle. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tif (event.type === \"agent_end\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\tcollectEvents(timeout = 60000): Promise<RpcEvent[]> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst events: RpcEvent[] = [];\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout collecting events. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tevents.push(event);\n\t\t\t\tif (event.type === \"agent_end\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve(events);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\tasync promptAndWait(message: string, images?: ImageContent[], timeout = 60000): Promise<RpcEvent[]> {\n\t\tconst eventsPromise = this.collectEvents(timeout);\n\t\tawait this.prompt(message, images);\n\t\treturn eventsPromise;\n\t}\n\tprivate handleLine(line: string): void {\n\t\ttry {\n\t\t\tconst data = JSON.parse(line);\n\t\t\tif (data.type === \"response\" && data.id && this.pendingRequests.has(data.id)) {\n\t\t\t\tconst pending = this.pendingRequests.get(data.id)!;\n\t\t\t\tthis.pendingRequests.delete(data.id);\n\t\t\t\tpending.resolve(data as RpcResponse);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const listener of this.eventListeners) {\n\t\t\t\tlistener(data as RpcEvent);\n\t\t\t}\n\t\t} catch {\n\t\t}\n\t}\n\tprivate createProcessExitError(code: number | null, signal: NodeJS.Signals | null): Error {\n\t\treturn new Error(`Agent process exited (code=${code} signal=${signal}). Stderr: ${this.stderr}`);\n\t}\n\tprivate rejectPendingRequests(error: Error): void {\n\t\tfor (const { reject } of this.pendingRequests.values()) {\n\t\t\treject(error);\n\t\t}\n\t\tthis.pendingRequests.clear();\n\t}\n\tprivate async send(command: RpcCommandBody): Promise<RpcResponse> {\n\t\tconst childProcess = this.process;\n\t\tconst stdin = childProcess?.stdin;\n\t\tif (!childProcess || !stdin) {\n\t\t\tthrow new Error(\"Client not started\");\n\t\t}\n\t\tif (this.exitError) {\n\t\t\tthrow this.exitError;\n\t\t}\n\t\tif (childProcess.exitCode !== null) {\n\t\t\tconst error = this.createProcessExitError(childProcess.exitCode, childProcess.signalCode);\n\t\t\tthis.exitError = error;\n\t\t\tthrow error;\n\t\t}\n\t\tif (stdin.destroyed || !stdin.writable) {\n\t\t\tthrow new Error(\"Agent process stdin is not writable\");\n\t\t}\n\t\tconst id = `req_${++this.requestId}`;\n\t\tconst fullCommand = { ...command, id } as RpcCommand;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\treject(new Error(`Timeout waiting for response to ${command.type}. Stderr: ${this.stderr}`));\n\t\t\t}, 30000);\n\t\t\tthis.pendingRequests.set(id, {\n\t\t\t\tresolve: (response) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\tresolve(response);\n\t\t\t\t},\n\t\t\t\treject: (error) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t});\n\t\t\ttry {\n\t\t\t\tstdin.write(serializeJsonLine(fullCommand));\n\t\t\t} catch (error) {\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\treject(error instanceof Error ? error : new Error(String(error)));\n\t\t\t}\n\t\t});\n\t}\n\tprivate assertSuccess(response: RpcResponse): void {\n\t\tif (!response.success) {\n\t\t\tthrow new Error(response.error);\n\t\t}\n\t}\n\tprivate getData<T>(response: RpcResponse): T {\n\t\tthis.assertSuccess(response);\n\t\tconst successResponse = response as Extract<RpcResponse, { success: true; data: unknown }>;\n\t\treturn successResponse.data as T;\n\t}\n}\n"]}
1
+ {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,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W,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1C;IACD,aAAa,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgBlD;IACK,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,SAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAIlG;IACD,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,sBAAsB;IAG9B,OAAO,CAAC,qBAAqB;YAMf,IAAI;IA2ClB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,OAAO;CAKf"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-command-handler.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-command-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAKN,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAoC,MAAM,gBAAgB,CAAC;AAEhG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;AAE1F,UAAU,wBAAwB;IACjC,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,MAAM,YAAY,CAAC;IAC/B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,uBAAuB,CAAC,EACvC,WAAW,EACX,UAAU,EACV,aAAa,EACb,MAAM,GACN,EAAE,wBAAwB,GAAG,iBAAiB,CAqR9C","sourcesContent":["import type { AgentSession } from \"../../core/agent-session.ts\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.ts\";\nimport {\n\tcreateRpcErrorResponse,\n\tcreateRpcSuccessResponse,\n\tformatRpcErrorMessage,\n\tparseRpcContextWindow,\n\ttype RpcOutput,\n} from \"./rpc-responses.ts\";\nimport type { RpcCommand, RpcResponse, RpcSessionState, RpcSlashCommand } from \"./rpc-types.ts\";\n\nexport type RpcCommandHandler = (command: RpcCommand) => Promise<RpcResponse | undefined>;\n\ninterface RpcCommandHandlerOptions {\n\truntimeHost: AgentSessionRuntime;\n\tgetSession: () => AgentSession;\n\trebindSession: () => Promise<void>;\n\toutput: RpcOutput;\n}\n\nexport function createRpcCommandHandler({\n\truntimeHost,\n\tgetSession,\n\trebindSession,\n\toutput,\n}: RpcCommandHandlerOptions): RpcCommandHandler {\n\treturn async (command: RpcCommand): Promise<RpcResponse | undefined> => {\n\t\tconst id = command.id;\n\t\tconst session = getSession();\n\n\t\tswitch (command.type) {\n\t\t\tcase \"prompt\": {\n\t\t\t\tlet preflightSucceeded = false;\n\t\t\t\tvoid session\n\t\t\t\t\t.prompt(command.message, {\n\t\t\t\t\t\timages: command.images,\n\t\t\t\t\t\tstreamingBehavior: command.streamingBehavior,\n\t\t\t\t\t\tsource: \"rpc\",\n\t\t\t\t\t\tpreflightResult: (didSucceed) => {\n\t\t\t\t\t\t\tif (didSucceed) {\n\t\t\t\t\t\t\t\tpreflightSucceeded = true;\n\t\t\t\t\t\t\t\toutput(createRpcSuccessResponse(id, \"prompt\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\t.catch((promptError: unknown) => {\n\t\t\t\t\t\tif (!preflightSucceeded) {\n\t\t\t\t\t\t\toutput(createRpcErrorResponse(id, \"prompt\", formatRpcErrorMessage(promptError)));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tcase \"steer\": {\n\t\t\t\tawait session.steer(command.message, command.images);\n\t\t\t\treturn createRpcSuccessResponse(id, \"steer\");\n\t\t\t}\n\n\t\t\tcase \"follow_up\": {\n\t\t\t\tawait session.followUp(command.message, command.images);\n\t\t\t\treturn createRpcSuccessResponse(id, \"follow_up\");\n\t\t\t}\n\n\t\t\tcase \"abort\": {\n\t\t\t\tawait session.abort();\n\t\t\t\treturn createRpcSuccessResponse(id, \"abort\");\n\t\t\t}\n\n\t\t\tcase \"new_session\": {\n\t\t\t\tconst options = command.parentSession ? { parentSession: command.parentSession } : undefined;\n\t\t\t\tconst result = await runtimeHost.newSession(options);\n\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\tawait rebindSession();\n\t\t\t\t}\n\t\t\t\treturn createRpcSuccessResponse(id, \"new_session\", result);\n\t\t\t}\n\n\t\t\tcase \"get_state\": {\n\t\t\t\tconst state: RpcSessionState = {\n\t\t\t\t\tmodel: session.model,\n\t\t\t\t\tthinkingLevel: session.thinkingLevel,\n\t\t\t\t\tisStreaming: session.isStreaming,\n\t\t\t\t\tisCompacting: session.isCompacting,\n\t\t\t\t\tsteeringMode: session.steeringMode,\n\t\t\t\t\tfollowUpMode: session.followUpMode,\n\t\t\t\t\tsessionFile: session.sessionFile,\n\t\t\t\t\tsessionId: session.sessionId,\n\t\t\t\t\tsessionName: session.sessionName,\n\t\t\t\t\tautoCompactionEnabled: session.autoCompactionEnabled,\n\t\t\t\t\tmessageCount: session.messages.length,\n\t\t\t\t\tpendingMessageCount: session.pendingMessageCount,\n\t\t\t\t};\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_state\", state);\n\t\t\t}\n\n\t\t\tcase \"set_model\": {\n\t\t\t\tconst models = await session.modelRegistry.getAvailable();\n\t\t\t\tconst model = models.find((candidate) => candidate.provider === command.provider && candidate.id === command.modelId);\n\t\t\t\tif (!model) {\n\t\t\t\t\treturn createRpcErrorResponse(id, \"set_model\", `Model not found: ${command.provider}/${command.modelId}`);\n\t\t\t\t}\n\t\t\t\tawait session.setModel(model);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_model\", session.model ?? model);\n\t\t\t}\n\n\t\t\tcase \"cycle_model\": {\n\t\t\t\tconst result = await session.cycleModel();\n\t\t\t\treturn createRpcSuccessResponse(id, \"cycle_model\", result ?? null);\n\t\t\t}\n\n\t\t\tcase \"get_available_models\": {\n\t\t\t\tconst models = await session.modelRegistry.getAvailable();\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_available_models\", { models });\n\t\t\t}\n\n\t\t\tcase \"set_thinking_level\": {\n\t\t\t\tsession.setThinkingLevel(command.level);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_thinking_level\");\n\t\t\t}\n\n\t\t\tcase \"cycle_thinking_level\": {\n\t\t\t\tconst level = session.cycleThinkingLevel();\n\t\t\t\treturn createRpcSuccessResponse(id, \"cycle_thinking_level\", level ? { level } : null);\n\t\t\t}\n\n\t\t\tcase \"set_context_window\": {\n\t\t\t\tconst contextWindow = parseRpcContextWindow(command.contextWindow);\n\t\t\t\tsession.setContextWindow(contextWindow);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_context_window\");\n\t\t\t}\n\n\t\t\tcase \"get_available_context_windows\": {\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_available_context_windows\", {\n\t\t\t\t\tcontextWindows: session.getAvailableContextWindows(),\n\t\t\t\t\tcurrentContextWindow: session.model?.contextWindow,\n\t\t\t\t\tsupportsSelection: session.supportsContextWindowSelection(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tcase \"set_steering_mode\": {\n\t\t\t\tsession.setSteeringMode(command.mode);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_steering_mode\");\n\t\t\t}\n\n\t\t\tcase \"set_follow_up_mode\": {\n\t\t\t\tsession.setFollowUpMode(command.mode);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_follow_up_mode\");\n\t\t\t}\n\n\t\t\tcase \"compact\": {\n\t\t\t\tconst result = await session.compact();\n\t\t\t\treturn createRpcSuccessResponse(id, \"compact\", result);\n\t\t\t}\n\n\n\t\t\tcase \"set_auto_compaction\": {\n\t\t\t\tsession.setAutoCompactionEnabled(command.enabled);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_auto_compaction\");\n\t\t\t}\n\n\t\t\tcase \"set_auto_retry\": {\n\t\t\t\tsession.setAutoRetryEnabled(command.enabled);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_auto_retry\");\n\t\t\t}\n\n\t\t\tcase \"abort_retry\": {\n\t\t\t\tsession.abortRetry();\n\t\t\t\treturn createRpcSuccessResponse(id, \"abort_retry\");\n\t\t\t}\n\n\t\t\tcase \"bash\": {\n\t\t\t\tconst result = await session.executeBash(command.command, undefined, {\n\t\t\t\t\texcludeFromContext: command.excludeFromContext,\n\t\t\t\t});\n\t\t\t\treturn createRpcSuccessResponse(id, \"bash\", result);\n\t\t\t}\n\n\t\t\tcase \"abort_bash\": {\n\t\t\t\tsession.abortBash();\n\t\t\t\treturn createRpcSuccessResponse(id, \"abort_bash\");\n\t\t\t}\n\n\t\t\tcase \"get_session_stats\": {\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_session_stats\", session.getSessionStats());\n\t\t\t}\n\n\t\t\tcase \"export_html\": {\n\t\t\t\tconst path = await session.exportToHtml(command.outputPath);\n\t\t\t\treturn createRpcSuccessResponse(id, \"export_html\", { path });\n\t\t\t}\n\n\t\t\tcase \"switch_session\": {\n\t\t\t\tconst result = await runtimeHost.switchSession(command.sessionPath);\n\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\tawait rebindSession();\n\t\t\t\t}\n\t\t\t\treturn createRpcSuccessResponse(id, \"switch_session\", result);\n\t\t\t}\n\n\t\t\tcase \"fork\": {\n\t\t\t\tconst result = await runtimeHost.fork(command.entryId);\n\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\tawait rebindSession();\n\t\t\t\t}\n\t\t\t\treturn createRpcSuccessResponse(id, \"fork\", { text: result.selectedText, cancelled: result.cancelled });\n\t\t\t}\n\n\t\t\tcase \"clone\": {\n\t\t\t\tconst leafId = session.sessionManager.getLeafId();\n\t\t\t\tif (!leafId) {\n\t\t\t\t\treturn createRpcErrorResponse(id, \"clone\", \"Cannot clone session: no current entry selected\");\n\t\t\t\t}\n\t\t\t\tconst result = await runtimeHost.fork(leafId, { position: \"at\" });\n\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\tawait rebindSession();\n\t\t\t\t}\n\t\t\t\treturn createRpcSuccessResponse(id, \"clone\", { cancelled: result.cancelled });\n\t\t\t}\n\n\t\t\tcase \"get_fork_messages\": {\n\t\t\t\tconst messages = session.getUserMessagesForForking();\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_fork_messages\", { messages });\n\t\t\t}\n\n\t\t\tcase \"get_entries\": {\n\t\t\t\tconst sessionManager = session.sessionManager;\n\t\t\t\tlet entries = sessionManager.getEntries();\n\t\t\t\tif (command.since !== undefined) {\n\t\t\t\t\tconst sinceIndex = entries.findIndex((e) => e.id === command.since);\n\t\t\t\t\tif (sinceIndex === -1) {\n\t\t\t\t\t\treturn createRpcErrorResponse(id, \"get_entries\", `Entry not found: ${command.since}`);\n\t\t\t\t\t}\n\t\t\t\t\tentries = entries.slice(sinceIndex + 1);\n\t\t\t\t}\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_entries\", { entries, leafId: sessionManager.getLeafId() });\n\t\t\t}\n\n\t\t\tcase \"get_tree\": {\n\t\t\t\tconst sessionManager = session.sessionManager;\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_tree\", {\n\t\t\t\t\ttree: sessionManager.getTree(),\n\t\t\t\t\tleafId: sessionManager.getLeafId(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tcase \"get_last_assistant_text\": {\n\t\t\t\tconst text = session.getLastAssistantText();\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_last_assistant_text\", { text });\n\t\t\t}\n\n\t\t\tcase \"set_session_name\": {\n\t\t\t\tconst name = command.name.trim();\n\t\t\t\tif (!name) {\n\t\t\t\t\treturn createRpcErrorResponse(id, \"set_session_name\", \"Session name cannot be empty\");\n\t\t\t\t}\n\t\t\t\tsession.setSessionName(name);\n\t\t\t\treturn createRpcSuccessResponse(id, \"set_session_name\");\n\t\t\t}\n\n\t\t\tcase \"get_messages\": {\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_messages\", { messages: session.messages });\n\t\t\t}\n\n\t\t\tcase \"get_commands\": {\n\t\t\t\tconst commands: RpcSlashCommand[] = [];\n\n\t\t\t\tfor (const registeredCommand of session.extensionRunner.getRegisteredCommands()) {\n\t\t\t\t\tcommands.push({\n\t\t\t\t\t\tname: registeredCommand.invocationName,\n\t\t\t\t\t\tdescription: registeredCommand.description,\n\t\t\t\t\t\tsource: \"extension\",\n\t\t\t\t\t\tsourceInfo: registeredCommand.sourceInfo,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfor (const template of session.promptTemplates) {\n\t\t\t\t\tcommands.push({\n\t\t\t\t\t\tname: template.name,\n\t\t\t\t\t\tdescription: template.description,\n\t\t\t\t\t\tsource: \"prompt\",\n\t\t\t\t\t\tsourceInfo: template.sourceInfo,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfor (const skill of session.resourceLoader.getSkills().skills) {\n\t\t\t\t\tcommands.push({\n\t\t\t\t\t\tname: `skill:${skill.name}`,\n\t\t\t\t\t\tdescription: skill.description,\n\t\t\t\t\t\tsource: \"skill\",\n\t\t\t\t\t\tsourceInfo: skill.sourceInfo,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn createRpcSuccessResponse(id, \"get_commands\", { commands });\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tconst unknownCommand = command as { type: string };\n\t\t\t\treturn createRpcErrorResponse(id, unknownCommand.type, `Unknown command: ${unknownCommand.type}`);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"rpc-command-handler.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-command-handler.ts"],"names":[],"mappings":"AAAA,OAAO,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,CAAC;CACtD;AAyDD,wBAAgB,2BAA2B,CAAC,EAC3C,MAAM,EACN,wBAAwB,GACxB,EAAE,kCAAkC,GAAG,kBAAkB,CA8LzD","sourcesContent":["import * as crypto from \"node:crypto\";\nimport type {\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tWorkingIndicatorOptions,\n} from \"../../core/extensions/index.ts\";\nimport { type Theme, theme } from \"../interactive/theme/theme.ts\";\nimport type { RpcExtensionUIRequest, RpcExtensionUIResponse } from \"./rpc-types.ts\";\nimport type { RpcOutput } from \"./rpc-responses.ts\";\n\nexport interface RpcPendingExtensionRequest {\n\tresolve: (value: RpcExtensionUIResponse) => void;\n\treject: (error: Error) => void;\n}\n\nexport type RpcPendingExtensionRequests = Map<string, RpcPendingExtensionRequest>;\n\ninterface CreateRpcExtensionUIContextOptions {\n\toutput: RpcOutput;\n\tpendingExtensionRequests: RpcPendingExtensionRequests;\n}\n\ninterface DialogPromiseOptions<T> extends CreateRpcExtensionUIContextOptions {\n\tdialogOptions: ExtensionUIDialogOptions | undefined;\n\tdefaultValue: T;\n\trequest: Record<string, unknown>;\n\tparseResponse: (response: RpcExtensionUIResponse) => T;\n}\n\nfunction createDialogPromise<T>({\n\toutput,\n\tpendingExtensionRequests,\n\tdialogOptions,\n\tdefaultValue,\n\trequest,\n\tparseResponse,\n}: DialogPromiseOptions<T>): Promise<T> {\n\tif (dialogOptions?.signal?.aborted) return Promise.resolve(defaultValue);\n\n\tconst id = crypto.randomUUID();\n\treturn new Promise((resolve, reject) => {\n\t\tlet timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n\t\tconst cleanup = () => {\n\t\t\tif (timeoutId) clearTimeout(timeoutId);\n\t\t\tdialogOptions?.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\tpendingExtensionRequests.delete(id);\n\t\t};\n\n\t\tconst onAbort = () => {\n\t\t\tcleanup();\n\t\t\tresolve(defaultValue);\n\t\t};\n\t\tdialogOptions?.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\tif (dialogOptions?.timeout) {\n\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve(defaultValue);\n\t\t\t}, dialogOptions.timeout);\n\t\t}\n\n\t\tpendingExtensionRequests.set(id, {\n\t\t\tresolve: (response: RpcExtensionUIResponse) => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve(parseResponse(response));\n\t\t\t},\n\t\t\treject,\n\t\t});\n\t\toutput({ type: \"extension_ui_request\", id, ...request } as RpcExtensionUIRequest);\n\t});\n}\n\nfunction emitExtensionUIRequest(output: RpcOutput, request: Record<string, unknown>): void {\n\toutput({ type: \"extension_ui_request\", id: crypto.randomUUID(), ...request } as RpcExtensionUIRequest);\n}\n\nexport function createRpcExtensionUIContext({\n\toutput,\n\tpendingExtensionRequests,\n}: CreateRpcExtensionUIContextOptions): ExtensionUIContext {\n\treturn {\n\t\tselect: (title, options, opts) =>\n\t\t\tcreateDialogPromise({\n\t\t\t\toutput,\n\t\t\t\tpendingExtensionRequests,\n\t\t\t\tdialogOptions: opts,\n\t\t\t\tdefaultValue: undefined,\n\t\t\t\trequest: { method: \"select\", title, options, timeout: opts?.timeout },\n\t\t\t\tparseResponse: (response) =>\n\t\t\t\t\t\"cancelled\" in response && response.cancelled ? undefined : \"value\" in response ? response.value : undefined,\n\t\t\t}),\n\n\t\tconfirm: (title, message, opts) =>\n\t\t\tcreateDialogPromise({\n\t\t\t\toutput,\n\t\t\t\tpendingExtensionRequests,\n\t\t\t\tdialogOptions: opts,\n\t\t\t\tdefaultValue: false,\n\t\t\t\trequest: { method: \"confirm\", title, message, timeout: opts?.timeout },\n\t\t\t\tparseResponse: (response) =>\n\t\t\t\t\t\"cancelled\" in response && response.cancelled ? false : \"confirmed\" in response ? response.confirmed : false,\n\t\t\t}),\n\n\t\tinput: (title, placeholder, opts) =>\n\t\t\tcreateDialogPromise({\n\t\t\t\toutput,\n\t\t\t\tpendingExtensionRequests,\n\t\t\t\tdialogOptions: opts,\n\t\t\t\tdefaultValue: undefined,\n\t\t\t\trequest: { method: \"input\", title, placeholder, timeout: opts?.timeout },\n\t\t\t\tparseResponse: (response) =>\n\t\t\t\t\t\"cancelled\" in response && response.cancelled ? undefined : \"value\" in response ? response.value : undefined,\n\t\t\t}),\n\n\t\tnotify(message: string, type?: \"info\" | \"warning\" | \"error\"): void {\n\t\t\temitExtensionUIRequest(output, { method: \"notify\", message, notifyType: type });\n\t\t},\n\n\t\trequestRender(): void {\n\t\t\t// RPC mode does not own a local TUI renderer.\n\t\t},\n\n\t\tonTerminalInput(): () => void {\n\t\t\t// Raw terminal input not supported in RPC mode\n\t\t\treturn () => {};\n\t\t},\n\n\t\tsetStatus(key: string, text: string | undefined): void {\n\t\t\temitExtensionUIRequest(output, { method: \"setStatus\", statusKey: key, statusText: text });\n\t\t},\n\n\t\tsetWorkingMessage(_message?: string): void {\n\t\t\t// Working message not supported in RPC mode - requires TUI loader access\n\t\t},\n\n\t\tsetWorkingVisible(_visible: boolean): void {\n\t\t\t// Working visibility not supported in RPC mode - requires TUI loader access\n\t\t},\n\n\t\tsetWorkingIndicator(_options?: WorkingIndicatorOptions): void {\n\t\t\t// Working indicator customization not supported in RPC mode - requires TUI loader access\n\t\t},\n\n\t\tsetHiddenThinkingLabel(_label?: string): void {\n\t\t\t// Hidden thinking label not supported in RPC mode - requires TUI message rendering access\n\t\t},\n\n\t\tsetWidget(key: string, content: unknown, options?: ExtensionWidgetOptions): void {\n\t\t\t// Only support string arrays in RPC mode - factory functions are ignored\n\t\t\tif (content === undefined || Array.isArray(content)) {\n\t\t\t\temitExtensionUIRequest(output, {\n\t\t\t\t\tmethod: \"setWidget\",\n\t\t\t\t\twidgetKey: key,\n\t\t\t\t\twidgetLines: content as string[] | undefined,\n\t\t\t\t\twidgetPlacement: options?.placement,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\tsetFooter(_factory: unknown): void {\n\t\t\t// Custom footer not supported in RPC mode - requires TUI access\n\t\t},\n\n\t\tsetHeader(_factory: unknown): void {\n\t\t\t// Custom header not supported in RPC mode - requires TUI access\n\t\t},\n\n\t\tsetTitle(title: string): void {\n\t\t\temitExtensionUIRequest(output, { method: \"setTitle\", title });\n\t\t},\n\n\t\tasync custom() {\n\t\t\t// Custom UI not supported in RPC mode\n\t\t\treturn undefined as never;\n\t\t},\n\n\t\tpasteToEditor(text: string): void {\n\t\t\t// Paste handling not supported in RPC mode - falls back to setEditorText\n\t\t\tthis.setEditorText(text);\n\t\t},\n\n\t\tsetEditorText(text: string): void {\n\t\t\temitExtensionUIRequest(output, { method: \"set_editor_text\", text });\n\t\t},\n\n\t\tgetEditorText(): string {\n\t\t\t// Synchronous method can't wait for RPC response; host should track editor state locally if needed.\n\t\t\treturn \"\";\n\t\t},\n\n\t\tasync editor(title: string, prefill?: string): Promise<string | undefined> {\n\t\t\tconst id = crypto.randomUUID();\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tpendingExtensionRequests.set(id, {\n\t\t\t\t\tresolve: (response: RpcExtensionUIResponse) => {\n\t\t\t\t\t\tif (\"cancelled\" in response && response.cancelled) {\n\t\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t\t} else if (\"value\" in response) {\n\t\t\t\t\t\t\tresolve(response.value);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\treject,\n\t\t\t\t});\n\t\t\t\toutput({ type: \"extension_ui_request\", id, method: \"editor\", title, prefill } as RpcExtensionUIRequest);\n\t\t\t});\n\t\t},\n\n\t\taddAutocompleteProvider(): void {\n\t\t\t// Autocomplete provider composition is not supported in RPC mode\n\t\t},\n\n\t\tsetEditorComponent(): void {\n\t\t\t// Custom editor components not supported in RPC mode\n\t\t},\n\n\t\tgetEditorComponent() {\n\t\t\t// Custom editor components not supported in RPC mode\n\t\t\treturn undefined;\n\t\t},\n\n\t\tgetFooterDataProvider() {\n\t\t\treturn {\n\t\t\t\tgetGitBranch: () => null,\n\t\t\t\tgetExtensionStatuses: () => new Map(),\n\t\t\t\tgetAvailableProviderCount: () => 1,\n\t\t\t\tonBranchChange: () => () => {},\n\t\t\t};\n\t\t},\n\n\t\tget theme() {\n\t\t\treturn theme;\n\t\t},\n\n\t\tgetAllThemes() {\n\t\t\treturn [];\n\t\t},\n\n\t\tgetTheme(_name: string) {\n\t\t\treturn undefined;\n\t\t},\n\n\t\tsetTheme(_theme: string | Theme) {\n\t\t\t// Theme switching not supported in RPC mode\n\t\t\treturn { success: false, error: \"Theme switching not supported in RPC mode\" };\n\t\t},\n\n\t\tgetToolsExpanded() {\n\t\t\t// Tool expansion not supported in RPC mode - no TUI\n\t\t\treturn false;\n\t\t},\n\n\t\tsetToolsExpanded(_expanded: boolean) {\n\t\t\t// Tool expansion not supported in RPC mode - no TUI\n\t\t},\n\n\t\tgetChatRenderSettings() {\n\t\t\treturn {\n\t\t\t\thideThinkingBlock: false,\n\t\t\t\thiddenThinkingLabel: \"Thinking...\",\n\t\t\t\ttoolOutputExpanded: false,\n\t\t\t\tshowImages: false,\n\t\t\t\timageWidthCells: 60,\n\t\t\t\tgetToolDefinition: () => undefined,\n\t\t\t\tgetCustomMessageRenderer: () => undefined,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"rpc-extension-ui.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-extension-ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAyB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,2BAA2B,GAAG,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;AAElF,UAAU,kCAAkC;IAC3C,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,2BAA2B,CAAC;CACtD;AAyDD,wBAAgB,2BAA2B,CAAC,EAC3C,MAAM,EACN,wBAAwB,GACxB,EAAE,kCAAkC,GAAG,kBAAkB,CA8LzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-input.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGnG,UAAU,0BAA0B;IACnC,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,2BAA2B,CAAC;IACtD,aAAa,EAAE,iBAAiB,CAAC;IACjC,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AA2BD,wBAAgB,yBAAyB,CAAC,EACzC,MAAM,EACN,wBAAwB,EACxB,aAAa,EACb,sBAAsB,GACtB,EAAE,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAkC9D","sourcesContent":["import { waitForRawStdoutBackpressure } from \"../../core/output-guard.ts\";\nimport type { RpcCommandHandler } from \"./rpc-command-handler.ts\";\nimport type { RpcPendingExtensionRequests } from \"./rpc-extension-ui.ts\";\nimport { createRpcErrorResponse, formatRpcErrorMessage, type RpcOutput } from \"./rpc-responses.ts\";\nimport type { RpcCommand, RpcExtensionUIResponse } from \"./rpc-types.ts\";\n\ninterface RpcInputLineHandlerOptions {\n\toutput: RpcOutput;\n\tpendingExtensionRequests: RpcPendingExtensionRequests;\n\thandleCommand: RpcCommandHandler;\n\tcheckShutdownRequested: () => Promise<void>;\n}\n\ninterface CommandIdentity {\n\tid: string | undefined;\n\ttype: string;\n}\n\nfunction isRpcExtensionUIResponse(value: unknown): value is RpcExtensionUIResponse {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"type\" in value &&\n\t\tvalue.type === \"extension_ui_response\" &&\n\t\t\"id\" in value &&\n\t\ttypeof value.id === \"string\"\n\t);\n}\n\nfunction getCommandIdentity(command: unknown): CommandIdentity {\n\tif (typeof command !== \"object\" || command === null) {\n\t\treturn { id: undefined, type: \"unknown\" };\n\t}\n\tconst id = \"id\" in command && typeof command.id === \"string\" ? command.id : undefined;\n\tconst type = \"type\" in command && typeof command.type === \"string\" ? command.type : \"unknown\";\n\treturn { id, type };\n}\n\nexport function createRpcInputLineHandler({\n\toutput,\n\tpendingExtensionRequests,\n\thandleCommand,\n\tcheckShutdownRequested,\n}: RpcInputLineHandlerOptions): (line: string) => Promise<void> {\n\treturn async (line: string): Promise<void> => {\n\t\tlet parsed: unknown;\n\t\ttry {\n\t\t\tparsed = JSON.parse(line);\n\t\t} catch (parseError: unknown) {\n\t\t\toutput(createRpcErrorResponse(undefined, \"parse\", `Failed to parse command: ${formatRpcErrorMessage(parseError)}`));\n\t\t\tawait waitForRawStdoutBackpressure();\n\t\t\treturn;\n\t\t}\n\n\t\tif (isRpcExtensionUIResponse(parsed)) {\n\t\t\tconst pending = pendingExtensionRequests.get(parsed.id);\n\t\t\tif (pending) {\n\t\t\t\tpendingExtensionRequests.delete(parsed.id);\n\t\t\t\tpending.resolve(parsed);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst command = parsed as RpcCommand;\n\t\ttry {\n\t\t\tconst response = await handleCommand(command);\n\t\t\tif (response) {\n\t\t\t\toutput(response);\n\t\t\t\tawait waitForRawStdoutBackpressure();\n\t\t\t}\n\t\t\tawait checkShutdownRequested();\n\t\t} catch (commandError: unknown) {\n\t\t\tconst identity = getCommandIdentity(command);\n\t\t\toutput(createRpcErrorResponse(identity.id, identity.type, formatRpcErrorMessage(commandError)));\n\t\t\tawait waitForRawStdoutBackpressure();\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"rpc-input.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGnG,UAAU,0BAA0B;IACnC,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,2BAA2B,CAAC;IACtD,aAAa,EAAE,iBAAiB,CAAC;IACjC,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AA2BD,wBAAgB,yBAAyB,CAAC,EACzC,MAAM,EACN,wBAAwB,EACxB,aAAa,EACb,sBAAsB,GACtB,EAAE,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAkC9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAW/E,YAAY,EACX,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,eAAe,GACf,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,CAqGjF","sourcesContent":["/**\n * RPC mode: Headless operation with JSON stdin/stdout protocol.\n *\n * Used for embedding the agent in other applications.\n * Receives commands as JSON on stdin, outputs events and responses as JSON on stdout.\n *\n * Protocol:\n * - Commands: JSON objects with `type` field, optional `id` for correlation\n * - Responses: JSON objects with `type: \"response\"`, `command`, `success`, and optional `data`/`error`\n * - Events: AgentSessionEvent objects streamed as they occur\n * - Extension UI: Extension UI requests are emitted, client responds with extension_ui_response\n */\n\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.ts\";\nimport { flushRawStdout, takeOverStdout, writeRawStdout } from \"../../core/output-guard.ts\";\nimport { killTrackedDetachedChildren } from \"../../utils/shell.ts\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.ts\";\nimport { createRpcCommandHandler } from \"./rpc-command-handler.ts\";\nimport { createRpcInputLineHandler } from \"./rpc-input.ts\";\nimport type { RpcPendingExtensionRequests } from \"./rpc-extension-ui.ts\";\nimport type { RpcOutput } from \"./rpc-responses.ts\";\nimport { RpcSessionBinding } from \"./rpc-session-binding.ts\";\n\n// Re-export types for consumers\nexport type {\n\tRpcCommand,\n\tRpcContextWindowInfo,\n\tRpcExtensionUIRequest,\n\tRpcExtensionUIResponse,\n\tRpcResponse,\n\tRpcSessionState,\n} from \"./rpc-types.ts\";\n\n/**\n * Run in RPC mode.\n * Listens for JSON commands on stdin, outputs events and responses on stdout.\n */\nexport async function runRpcMode(runtimeHost: AgentSessionRuntime): Promise<never> {\n\ttakeOverStdout();\n\n\tconst output: RpcOutput = (obj) => {\n\t\twriteRawStdout(serializeJsonLine(obj));\n\t};\n\tconst pendingExtensionRequests: RpcPendingExtensionRequests = new Map();\n\tconst signalCleanupHandlers: Array<() => void> = [];\n\n\tlet shutdownRequested = false;\n\tlet shuttingDown = false;\n\tlet detachInput = () => {};\n\n\tconst requestShutdown = () => {\n\t\tshutdownRequested = true;\n\t};\n\n\tconst sessionBinding = new RpcSessionBinding({\n\t\truntimeHost,\n\t\toutput,\n\t\tpendingExtensionRequests,\n\t\trequestShutdown,\n\t});\n\n\truntimeHost.setRebindSession(async () => {\n\t\tawait sessionBinding.rebindSession();\n\t});\n\n\tconst handleCommand = createRpcCommandHandler({\n\t\truntimeHost,\n\t\tgetSession: () => sessionBinding.currentSession,\n\t\trebindSession: () => sessionBinding.rebindSession(),\n\t\toutput,\n\t});\n\n\tasync function shutdown(exitCode = 0, signal?: NodeJS.Signals): Promise<never> {\n\t\tif (shuttingDown) {\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tshuttingDown = true;\n\t\tfor (const cleanup of signalCleanupHandlers) {\n\t\t\tcleanup();\n\t\t}\n\t\tsessionBinding.disposeSubscriptions();\n\t\tawait runtimeHost.dispose();\n\t\tdetachInput();\n\t\tprocess.stdin.pause();\n\t\tif (signal !== \"SIGTERM\") {\n\t\t\tawait flushRawStdout();\n\t\t}\n\t\tprocess.exit(exitCode);\n\t}\n\n\tconst checkShutdownRequested = async (): Promise<void> => {\n\t\tif (!shutdownRequested) return;\n\t\tawait shutdown();\n\t};\n\n\tconst registerSignalHandlers = (): void => {\n\t\tconst signals: NodeJS.Signals[] = [\"SIGTERM\"];\n\t\tif (process.platform !== \"win32\") {\n\t\t\tsignals.push(\"SIGHUP\");\n\t\t}\n\n\t\tfor (const signal of signals) {\n\t\t\tconst handler = () => {\n\t\t\t\tkillTrackedDetachedChildren();\n\t\t\t\tvoid shutdown(signal === \"SIGHUP\" ? 129 : 143, signal);\n\t\t\t};\n\t\t\tprocess.on(signal, handler);\n\t\t\tsignalCleanupHandlers.push(() => process.off(signal, handler));\n\t\t}\n\t};\n\n\tawait sessionBinding.rebindSession();\n\tregisterSignalHandlers();\n\n\tconst handleInputLine = createRpcInputLineHandler({\n\t\toutput,\n\t\tpendingExtensionRequests,\n\t\thandleCommand,\n\t\tcheckShutdownRequested,\n\t});\n\n\tconst onInputEnd = () => {\n\t\tvoid shutdown();\n\t};\n\tprocess.stdin.on(\"end\", onInputEnd);\n\n\tdetachInput = (() => {\n\t\tconst detachJsonl = attachJsonlLineReader(process.stdin, (line) => {\n\t\t\tvoid handleInputLine(line);\n\t\t});\n\t\treturn () => {\n\t\t\tdetachJsonl();\n\t\t\tprocess.stdin.off(\"end\", onInputEnd);\n\t\t};\n\t})();\n\n\t// Keep process alive forever\n\treturn new Promise(() => {});\n}\n"]}
1
+ {"version":3,"file":"rpc-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAW/E,YAAY,EACX,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,eAAe,GACf,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,CAqGjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-responses.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-responses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,qBAAqB,GAAG,MAAM,CAAC;AAC3E,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;AAEvD,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,EACpE,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,OAAO,EAAE,CAAC,EACV,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAClB,WAAW,CAKb;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAE5G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAYpE","sourcesContent":["import { parseContextWindowValue } from \"../../core/context-window.ts\";\nimport type { RpcCommand, RpcExtensionUIRequest, RpcResponse } from \"./rpc-types.ts\";\n\nexport type RpcOutputRecord = RpcResponse | RpcExtensionUIRequest | object;\nexport type RpcOutput = (obj: RpcOutputRecord) => void;\n\nexport function createRpcSuccessResponse<T extends RpcCommand[\"type\"]>(\n\tid: string | undefined,\n\tcommand: T,\n\tdata?: object | null,\n): RpcResponse {\n\tif (data === undefined) {\n\t\treturn { id, type: \"response\", command, success: true } as RpcResponse;\n\t}\n\treturn { id, type: \"response\", command, success: true, data } as RpcResponse;\n}\n\nexport function createRpcErrorResponse(id: string | undefined, command: string, message: string): RpcResponse {\n\treturn { id, type: \"response\", command, success: false, error: message };\n}\n\nexport function formatRpcErrorMessage(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nexport function parseRpcContextWindow(value: number | string): number {\n\tif (typeof value === \"number\") {\n\t\treturn value;\n\t}\n\tif (typeof value === \"string\") {\n\t\tconst parsed = parseContextWindowValue(value);\n\t\tif (parsed.value !== undefined) {\n\t\t\treturn parsed.value;\n\t\t}\n\t\tthrow new Error(parsed.error ?? \"Invalid context window\");\n\t}\n\tthrow new Error(\"Context window must be a number of tokens or a compact value like 400k or 1m\");\n}\n"]}
1
+ {"version":3,"file":"rpc-responses.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-responses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,qBAAqB,GAAG,MAAM,CAAC;AAC3E,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;AAEvD,wBAAgB,wBAAwB,CAAC,CAAC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7C,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,wBAAwB,EAAE,eAAe,EAAE,EAAE,wBAAwB,EAMvG;IAED,IAAI,cAAc,IAAI,YAAY,CAEjC;IAEK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkDnC;IAED,oBAAoB,IAAI,IAAI,CAK3B;CACD","sourcesContent":["import type { AgentSession } from \"../../core/agent-session.ts\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.ts\";\nimport { waitForRawStdoutBackpressure } from \"../../core/output-guard.ts\";\nimport { createRpcExtensionUIContext, type RpcPendingExtensionRequests } from \"./rpc-extension-ui.ts\";\nimport type { RpcOutput } from \"./rpc-responses.ts\";\n\ninterface RpcSessionBindingOptions {\n\truntimeHost: AgentSessionRuntime;\n\toutput: RpcOutput;\n\tpendingExtensionRequests: RpcPendingExtensionRequests;\n\trequestShutdown: () => void;\n}\n\nexport class RpcSessionBinding {\n\tprivate session: AgentSession;\n\tprivate unsubscribe?: () => void;\n\tprivate unsubscribeBackpressure?: () => void;\n\tprivate readonly runtimeHost: AgentSessionRuntime;\n\tprivate readonly output: RpcOutput;\n\tprivate readonly pendingExtensionRequests: RpcPendingExtensionRequests;\n\tprivate readonly requestShutdown: () => void;\n\n\tconstructor({ runtimeHost, output, pendingExtensionRequests, requestShutdown }: RpcSessionBindingOptions) {\n\t\tthis.runtimeHost = runtimeHost;\n\t\tthis.output = output;\n\t\tthis.pendingExtensionRequests = pendingExtensionRequests;\n\t\tthis.requestShutdown = requestShutdown;\n\t\tthis.session = runtimeHost.session;\n\t}\n\n\tget currentSession(): AgentSession {\n\t\treturn this.session;\n\t}\n\n\tasync rebindSession(): Promise<void> {\n\t\tthis.session = this.runtimeHost.session;\n\t\tconst session = this.session;\n\n\t\tawait session.bindExtensions({\n\t\t\tuiContext: createRpcExtensionUIContext({\n\t\t\t\toutput: this.output,\n\t\t\t\tpendingExtensionRequests: this.pendingExtensionRequests,\n\t\t\t}),\n\t\t\tmode: \"rpc\",\n\t\t\tcommandContextActions: {\n\t\t\t\twaitForIdle: () => this.session.agent.waitForIdle(),\n\t\t\t\tnewSession: async (options) => this.runtimeHost.newSession(options),\n\t\t\t\tfork: async (entryId, forkOptions) => {\n\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId, forkOptions);\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t},\n\t\t\t\tnavigateTree: async (targetId, options) => {\n\t\t\t\t\tconst result = await this.session.navigateTree(targetId, {\n\t\t\t\t\t\tsummarize: options?.summarize,\n\t\t\t\t\t\tcustomInstructions: options?.customInstructions,\n\t\t\t\t\t\treplaceInstructions: options?.replaceInstructions,\n\t\t\t\t\t\tlabel: options?.label,\n\t\t\t\t\t});\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t},\n\t\t\t\tswitchSession: async (sessionPath, options) => {\n\t\t\t\t\treturn this.runtimeHost.switchSession(sessionPath, options);\n\t\t\t\t},\n\t\t\t\treload: async () => {\n\t\t\t\t\tconst steeringMode = this.session.steeringMode;\n\t\t\t\t\tconst followUpMode = this.session.followUpMode;\n\t\t\t\t\tawait this.session.reload();\n\t\t\t\t\tthis.session.setSteeringMode(steeringMode);\n\t\t\t\t\tthis.session.setFollowUpMode(followUpMode);\n\t\t\t\t},\n\t\t\t},\n\t\t\tshutdownHandler: this.requestShutdown,\n\t\t\tonError: (err) => {\n\t\t\t\tthis.output({ type: \"extension_error\", extensionPath: err.extensionPath, event: err.event, error: err.error });\n\t\t\t},\n\t\t});\n\n\t\tthis.disposeSubscriptions();\n\t\tthis.unsubscribe = session.subscribe((event) => {\n\t\t\tthis.output(event);\n\t\t});\n\t\tthis.unsubscribeBackpressure = session.agent.subscribe(async () => {\n\t\t\tawait waitForRawStdoutBackpressure();\n\t\t});\n\t}\n\n\tdisposeSubscriptions(): void {\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribeBackpressure?.();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.unsubscribeBackpressure = undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"rpc-session-binding.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-session-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAA+B,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,UAAU,wBAAwB;IACjC,WAAW,EAAE,mBAAmB,CAAC;IACjC,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,2BAA2B,CAAC;IACtD,eAAe,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA8B;IACvE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAa;IAE7C,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,wBAAwB,EAAE,eAAe,EAAE,EAAE,wBAAwB,EAMvG;IAED,IAAI,cAAc,IAAI,YAAY,CAEjC;IAEK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkDnC;IAED,oBAAoB,IAAI,IAAI,CAK3B;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,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AW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAClC,eAAe,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC;CAC/C,GACD;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAMzF,0CAA0C;AAC1C,MAAM,MAAM,sBAAsB,GAC/B;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,CAAC;AAMlE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, ImageContent, Model } from \"@earendil-works/pi-ai/compat\";\nimport type { AgentSessionEvent, SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\n\t// Context Window\n\t| { id?: string; type: \"set_context_window\"; contextWindow: number | string }\n\t| { id?: string; type: \"get_available_context_windows\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\" }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\" }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands (available for invocation via prompt)\n\t| { id?: string; type: \"get_commands\" };\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Source metadata for the owning resource */\n\tsourceInfo: SourceInfo;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: Model<Api>;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n}\n\nexport interface RpcContextWindowInfo {\n\tcontextWindows: number[];\n\tcurrentContextWindow?: number;\n\tsupportsSelection: boolean;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<Api>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<Api>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: Model<Api>[] };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\n\t// Context Window\n\t| { id?: string; type: \"response\"; command: \"set_context_window\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_context_windows\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcContextWindowInfo;\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: VerbatimCompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\n\t// Error response (any command can fail)\n\t| { id?: string; type: \"response\"; command: string; success: false; error: string };\n\n// ============================================================================\n// RPC Events (stdout)\n// ============================================================================\n\n/** Events streamed by RPC mode as session activity occurs. */\nexport type RpcEvent = AgentSessionEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string };\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
1
+ {"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EAAE,iB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CAAC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAWtE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CA4ErE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,qBAAqB,GAAG,SAAS,CAmLrF","sourcesContent":["import chalk from \"chalk\";\nimport { APP_NAME, CONFIG_DIR_NAME } from \"./config.ts\";\n\nexport type PackageCommand = \"install\" | \"remove\" | \"update\" | \"list\";\n\nexport type UpdateTarget = { type: \"all\" } | { type: \"self\" } | { type: \"extensions\"; source?: string };\n\ninterface PackageCommandOptions {\n\tcommand: PackageCommand;\n\tsource?: string;\n\tupdateTarget?: UpdateTarget;\n\tshowExtensionsSkippedNote: boolean;\n\tlocal: boolean;\n\tforce: boolean;\n\tprojectTrustOverride?: boolean;\n\thelp: boolean;\n\tinvalidOption?: string;\n\tinvalidArgument?: string;\n\tmissingOptionValue?: string;\n\tconflictingOptions?: string;\n}\n\nexport function getPackageCommandUsage(command: PackageCommand): string {\n\tswitch (command) {\n\t\tcase \"install\":\n\t\t\treturn `${APP_NAME} install <source> [-l] [--approve|--no-approve]`;\n\t\tcase \"remove\":\n\t\t\treturn `${APP_NAME} remove <source> [-l] [--approve|--no-approve]`;\n\t\tcase \"update\":\n\t\t\treturn `${APP_NAME} update [source|self|${APP_NAME}] [--self|--extensions|--all] [--extension <source>] [--approve|--no-approve] [--force]`;\n\t\tcase \"list\":\n\t\t\treturn `${APP_NAME} list [--approve|--no-approve]`;\n\t}\n}\n\nexport function printPackageCommandHelp(command: PackageCommand): void {\n\tswitch (command) {\n\t\tcase \"install\":\n\t\t\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${getPackageCommandUsage(\"install\")}\n\nInstall a package and add it to settings.\n\nOptions:\n -l, --local Install project-locally (${CONFIG_DIR_NAME}/settings.json)\n -a, --approve Trust project-local files for this command\n -na, --no-approve Ignore project-local files for this command\n\nExamples:\n ${APP_NAME} install npm:@foo/bar\n ${APP_NAME} install git:github.com/user/repo\n ${APP_NAME} install git:git@github.com:user/repo\n ${APP_NAME} install https://github.com/user/repo\n ${APP_NAME} install ssh://git@github.com/user/repo\n ${APP_NAME} install ./local/path\n`);\n\t\t\treturn;\n\n\t\tcase \"remove\":\n\t\t\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${getPackageCommandUsage(\"remove\")}\n\nRemove a package and its source from settings.\nAlias: ${APP_NAME} uninstall <source> [-l]\n\nOptions:\n -l, --local Remove from project settings (${CONFIG_DIR_NAME}/settings.json)\n -a, --approve Trust project-local files for this command\n -na, --no-approve Ignore project-local files for this command\n\nExamples:\n ${APP_NAME} remove npm:@foo/bar\n ${APP_NAME} uninstall npm:@foo/bar\n`);\n\t\t\treturn;\n\n\t\tcase \"update\":\n\t\t\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${getPackageCommandUsage(\"update\")}\n\nUpdate ${APP_NAME} and installed packages.\n\nOptions:\n --self Update ${APP_NAME} only (default when no target is given)\n --extensions Update installed packages only\n --all Update ${APP_NAME} and installed packages\n --extension <source> Update one package only\n -a, --approve Trust project-local files for this command\n -na, --no-approve Ignore project-local files for this command\n --force Reinstall ${APP_NAME} even if the current version is latest\n\nShort forms:\n ${APP_NAME} update Update ${APP_NAME} only\n ${APP_NAME} update --all Update ${APP_NAME} and all extensions\n ${APP_NAME} update <source> Update one package\n ${APP_NAME} update ${APP_NAME} Update ${APP_NAME} only (self works as an alias)\n`);\n\t\t\treturn;\n\n\t\tcase \"list\":\n\t\t\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${getPackageCommandUsage(\"list\")}\n\nList installed packages from user and project settings.\n\nOptions:\n -a, --approve Trust project-local files for this command\n -na, --no-approve Ignore project-local files for this command\n`);\n\t\t\treturn;\n\t}\n}\n\nexport function parsePackageCommand(args: string[]): PackageCommandOptions | undefined {\n\tconst [rawCommand, ...rest] = args;\n\tlet command: PackageCommand | undefined;\n\tif (rawCommand === \"uninstall\") {\n\t\tcommand = \"remove\";\n\t} else if (rawCommand === \"install\" || rawCommand === \"remove\" || rawCommand === \"update\" || rawCommand === \"list\") {\n\t\tcommand = rawCommand;\n\t}\n\tif (!command) {\n\t\treturn undefined;\n\t}\n\n\tlet local = false;\n\tlet force = false;\n\tlet projectTrustOverride: boolean | undefined;\n\tlet help = false;\n\tlet invalidOption: string | undefined;\n\tlet invalidArgument: string | undefined;\n\tlet missingOptionValue: string | undefined;\n\tlet conflictingOptions: string | undefined;\n\tlet source: string | undefined;\n\tlet selfFlag = false;\n\tlet extensionsFlag = false;\n\tlet allFlag = false;\n\tlet extensionFlagSource: string | undefined;\n\n\tfor (let index = 0; index < rest.length; index++) {\n\t\tconst arg = rest[index];\n\t\tif (arg === \"-h\" || arg === \"--help\") {\n\t\t\thelp = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"-l\" || arg === \"--local\") {\n\t\t\tif (command === \"install\" || command === \"remove\") {\n\t\t\t\tlocal = true;\n\t\t\t} else {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--self\") {\n\t\t\tif (command === \"update\") {\n\t\t\t\tselfFlag = true;\n\t\t\t} else {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--extensions\") {\n\t\t\tif (command === \"update\") {\n\t\t\t\textensionsFlag = true;\n\t\t\t} else {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--all\") {\n\t\t\tif (command === \"update\") {\n\t\t\t\tallFlag = true;\n\t\t\t} else {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--approve\" || arg === \"-a\") {\n\t\t\tprojectTrustOverride = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--no-approve\" || arg === \"-na\") {\n\t\t\tprojectTrustOverride = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--force\") {\n\t\t\tif (command === \"update\") {\n\t\t\t\tforce = true;\n\t\t\t} else {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--extension\") {\n\t\t\tif (command !== \"update\") {\n\t\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst value = rest[index + 1];\n\t\t\tif (!value || value.startsWith(\"-\")) {\n\t\t\t\tmissingOptionValue = missingOptionValue ?? arg;\n\t\t\t} else if (extensionFlagSource) {\n\t\t\t\tconflictingOptions = conflictingOptions ?? \"--extension can only be provided once\";\n\t\t\t\tindex++;\n\t\t\t} else {\n\t\t\t\textensionFlagSource = value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg.startsWith(\"-\")) {\n\t\t\tinvalidOption = invalidOption ?? arg;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!source) {\n\t\t\tsource = arg;\n\t\t} else {\n\t\t\tinvalidArgument = invalidArgument ?? arg;\n\t\t}\n\t}\n\n\tlet updateTarget: UpdateTarget | undefined;\n\tlet showExtensionsSkippedNote = false;\n\tif (command === \"update\") {\n\t\tif (allFlag && (selfFlag || extensionsFlag || extensionFlagSource)) {\n\t\t\tconflictingOptions =\n\t\t\t\tconflictingOptions ?? \"--all cannot be combined with --self, --extensions, or --extension\";\n\t\t}\n\t\tif (allFlag && source) {\n\t\t\tconflictingOptions = conflictingOptions ?? \"--all cannot be combined with a positional source\";\n\t\t}\n\n\t\tif (extensionFlagSource) {\n\t\t\tif (selfFlag || extensionsFlag || allFlag) {\n\t\t\t\tconflictingOptions =\n\t\t\t\t\tconflictingOptions ?? \"--extension cannot be combined with --self, --extensions, or --all\";\n\t\t\t}\n\t\t\tif (source) {\n\t\t\t\tconflictingOptions = conflictingOptions ?? \"--extension cannot be combined with a positional source\";\n\t\t\t}\n\t\t\tupdateTarget = { type: \"extensions\", source: extensionFlagSource };\n\t\t} else if (source) {\n\t\t\tconst sourceIsSelf = source === \"self\" || source === APP_NAME || source === \"pi\";\n\t\t\tif (sourceIsSelf) {\n\t\t\t\tupdateTarget = extensionsFlag ? { type: \"all\" } : { type: \"self\" };\n\t\t\t} else {\n\t\t\t\tif (extensionsFlag || selfFlag || allFlag) {\n\t\t\t\t\tconflictingOptions =\n\t\t\t\t\t\tconflictingOptions ??\n\t\t\t\t\t\t\"positional update targets cannot be combined with --self, --extensions, or --all\";\n\t\t\t\t}\n\t\t\t\tupdateTarget = { type: \"extensions\", source };\n\t\t\t}\n\t\t} else if (allFlag) {\n\t\t\tupdateTarget = { type: \"all\" };\n\t\t} else if (selfFlag && extensionsFlag) {\n\t\t\tupdateTarget = { type: \"all\" };\n\t\t} else if (selfFlag) {\n\t\t\tupdateTarget = { type: \"self\" };\n\t\t} else if (extensionsFlag) {\n\t\t\tupdateTarget = { type: \"extensions\" };\n\t\t} else {\n\t\t\tupdateTarget = { type: \"self\" };\n\t\t\tshowExtensionsSkippedNote = true;\n\t\t}\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tsource,\n\t\tupdateTarget,\n\t\tshowExtensionsSkippedNote,\n\t\tlocal,\n\t\tforce,\n\t\tprojectTrustOverride,\n\t\thelp,\n\t\tinvalidOption,\n\t\tinvalidArgument,\n\t\tmissingOptionValue,\n\t\tconflictingOptions,\n\t};\n}\n\n"]}
1
+ {"version":3,"file":"package-manager-cli-parser.d.ts","sourceRoot":"","sources":["../src/package-manager-cli-parser.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExG,UAAU,qBAAqB;IAC9B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,yBAAyB,EAAE,OAAO,CAAC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAWtE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CA4ErE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,qBAAqB,GAAG,SAAS,CAmLrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"package-manager-cli.d.ts","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAoHnE,MAAM,WAAW,4BAA4B;IAC5C,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAyDD,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CA0BlB;AAED,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CA8LlB","sourcesContent":["import chalk from \"chalk\";\nimport { selectConfig } from \"./cli/config-selector.ts\";\nimport { createProjectTrustContext } from \"./cli/project-trust.ts\";\nimport {\n\tAPP_NAME,\n\tdetectInstallMethod,\n\tgetAgentDir,\n\tgetPackageDir,\n\tgetSelfUpdateCommand,\n\tgetSelfUpdateUnavailableInstruction,\n\tPACKAGE_NAME,\n\ttype SelfUpdateCommand,\n\tVERSION,\n} from \"./config.ts\";\nimport type { ExtensionFactory } from \"./core/extensions/types.ts\";\nimport { DefaultPackageManager } from \"./core/package-manager.ts\";\nimport { type AppMode, resolveProjectTrusted } from \"./core/project-trust.ts\";\nimport { DefaultResourceLoader } from \"./core/resource-loader.ts\";\nimport { SettingsManager } from \"./core/settings-manager.ts\";\nimport { hasProjectTrustInputs, ProjectTrustStore } from \"./core/trust-manager.ts\";\nimport { spawnProcess } from \"./utils/child-process.ts\";\nimport { getLatestPiRelease, isNewerPackageVersion } from \"./utils/version-check.ts\";\nimport {\n\tcleanupWindowsSelfUpdateQuarantine,\n\tquarantineWindowsNativeDependencies,\n} from \"./utils/windows-self-update.ts\";\n\nimport { getPackageCommandUsage, parsePackageCommand, printPackageCommandHelp, type UpdateTarget } from \"./package-manager-cli-parser.ts\";\nfunction reportSettingsErrors(settingsManager: SettingsManager, context: string): void {\n\tconst errors = settingsManager.drainErrors();\n\tfor (const { scope, error } of errors) {\n\t\tconsole.error(chalk.yellow(`Warning (${context}, ${scope} settings): ${error.message}`));\n\t\tif (error.stack) {\n\t\t\tconsole.error(chalk.dim(error.stack));\n\t\t}\n\t}\n}\n\nfunction updateTargetIncludesSelf(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"self\";\n}\n\nfunction updateTargetIncludesExtensions(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"extensions\";\n}\n\nfunction printSelfUpdateUnavailable(npmCommand?: string[], updatePackageName = PACKAGE_NAME): void {\n\tconsole.error(`error: ${APP_NAME} cannot self-update this installation.`);\n\tconsole.error(getSelfUpdateUnavailableInstruction(PACKAGE_NAME, npmCommand, updatePackageName));\n\n\tconst entrypoint = process.argv[1];\n\tif (entrypoint) {\n\t\tconsole.error(\"\");\n\t\tconsole.error(`Location of ${APP_NAME} executable: ${entrypoint}`);\n\t}\n}\n\nfunction printSelfUpdateFallback(command: SelfUpdateCommand): void {\n\tconsole.error(chalk.dim(`If this keeps failing, run this command yourself: ${command.display}`));\n}\n\ninterface SelfUpdatePlan {\n\tpackageName: string;\n\tshouldRun: boolean;\n}\n\nasync function getSelfUpdatePlan(force: boolean): Promise<SelfUpdatePlan> {\n\tif (force) {\n\t\treturn { packageName: PACKAGE_NAME, shouldRun: true };\n\t}\n\n\ttry {\n\t\tconst latestRelease = await getLatestPiRelease();\n\t\tconst packageName = latestRelease?.packageName ?? PACKAGE_NAME;\n\t\tif (!latestRelease || packageName !== PACKAGE_NAME || isNewerPackageVersion(latestRelease.version, VERSION)) {\n\t\t\treturn { packageName, shouldRun: true };\n\t\t}\n\t} catch {\n\t\treturn { packageName: PACKAGE_NAME, shouldRun: true };\n\t}\n\n\tconsole.log(chalk.green(`${APP_NAME} is already up to date (v${VERSION})`));\n\treturn { packageName: PACKAGE_NAME, shouldRun: false };\n}\n\nasync function runSelfUpdate(command: SelfUpdateCommand): Promise<void> {\n\tconsole.log(chalk.dim(`Updating ${APP_NAME} with ${command.display}...`));\n\tfor (const step of command.steps ?? [command]) {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst child = spawnProcess(step.command, step.args, {\n\t\t\t\tstdio: \"inherit\",\n\t\t\t});\n\t\t\tchild.on(\"error\", (error) => {\n\t\t\t\treject(error);\n\t\t\t});\n\t\t\tchild.on(\"close\", (code, signal) => {\n\t\t\t\tif (code === 0) {\n\t\t\t\t\tresolve();\n\t\t\t\t} else if (signal) {\n\t\t\t\t\treject(new Error(`${step.display} terminated by signal ${signal}`));\n\t\t\t\t} else {\n\t\t\t\t\treject(new Error(`${step.display} exited with code ${code ?? \"unknown\"}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\nfunction prepareWindowsNpmSelfUpdate(): void {\n\tif (process.platform !== \"win32\") {\n\t\treturn;\n\t}\n\n\tconst packageDir = getPackageDir();\n\tcleanupWindowsSelfUpdateQuarantine(packageDir);\n\tquarantineWindowsNativeDependencies(packageDir);\n}\n\nfunction parseProjectTrustOverride(args: readonly string[]): boolean | undefined {\n\tlet trustOverride: boolean | undefined;\n\tfor (const arg of args) {\n\t\tif (arg === \"--approve\" || arg === \"-a\") {\n\t\t\ttrustOverride = true;\n\t\t} else if (arg === \"--no-approve\" || arg === \"-na\") {\n\t\t\ttrustOverride = false;\n\t\t}\n\t}\n\treturn trustOverride;\n}\n\nexport interface PackageCommandRuntimeOptions {\n\textensionFactories?: ExtensionFactory[];\n}\n\ninterface CommandSettingsResult {\n\tsettingsManager: SettingsManager;\n\tprojectTrustWarnings: string[];\n}\n\nfunction getCommandAppMode(): AppMode {\n\treturn process.stdin.isTTY && process.stdout.isTTY ? \"interactive\" : \"print\";\n}\n\nfunction reportProjectTrustWarnings(warnings: readonly string[]): void {\n\tfor (const warning of warnings) {\n\t\tconsole.error(chalk.yellow(`Warning: ${warning}`));\n\t}\n}\n\nasync function createCommandSettingsManager(options: {\n\tcwd: string;\n\tagentDir: string;\n\tprojectTrustOverride?: boolean;\n\textensionFactories?: ExtensionFactory[];\n}): Promise<CommandSettingsResult> {\n\tconst settingsManager = SettingsManager.create(options.cwd, options.agentDir, { projectTrusted: false });\n\tconst projectTrustWarnings: string[] = [];\n\tconst appMode = getCommandAppMode();\n\tconst extensionsResult =\n\t\toptions.projectTrustOverride === undefined && hasProjectTrustInputs(options.cwd)\n\t\t\t? await new DefaultResourceLoader({\n\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\tagentDir: options.agentDir,\n\t\t\t\t\tsettingsManager,\n\t\t\t\t\textensionFactories: options.extensionFactories,\n\t\t\t\t}).loadProjectTrustExtensions()\n\t\t\t: undefined;\n\tfor (const error of extensionsResult?.errors ?? []) {\n\t\tprojectTrustWarnings.push(`Failed to load extension \"${error.path}\": ${error.error}`);\n\t}\n\n\tconst projectTrusted = await resolveProjectTrusted({\n\t\tcwd: options.cwd,\n\t\ttrustStore: new ProjectTrustStore(options.agentDir),\n\t\ttrustOverride: options.projectTrustOverride,\n\t\tdefaultProjectTrust: settingsManager.getDefaultProjectTrust(),\n\t\textensionsResult,\n\t\tprojectTrustContext: createProjectTrustContext({\n\t\t\tcwd: options.cwd,\n\t\t\tmode: appMode,\n\t\t\tsettingsManager,\n\t\t\thasUI: appMode === \"interactive\",\n\t\t}),\n\t\tonExtensionError: (message) => projectTrustWarnings.push(message),\n\t});\n\tsettingsManager.setProjectTrusted(projectTrusted);\n\treturn { settingsManager, projectTrustWarnings };\n}\n\nexport async function handleConfigCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tif (args[0] !== \"config\") {\n\t\treturn false;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: parseProjectTrustOverride(args),\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\treportSettingsErrors(settingsManager, \"config command\");\n\tconst packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });\n\tconst resolvedPaths = await packageManager.resolve();\n\n\tawait selectConfig({\n\t\tresolvedPaths,\n\t\tsettingsManager,\n\t\tcwd,\n\t\tagentDir,\n\t});\n\n\tprocess.exit(0);\n}\n\nexport async function handlePackageCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tconst options = parsePackageCommand(args);\n\tif (!options) {\n\t\treturn false;\n\t}\n\n\tif (options.help) {\n\t\tprintPackageCommandHelp(options.command);\n\t\treturn true;\n\t}\n\n\tif (options.invalidOption) {\n\t\tconsole.error(chalk.red(`Unknown option ${options.invalidOption} for \"${options.command}\".`));\n\t\tconsole.error(chalk.dim(`Use \"${APP_NAME} --help\" or \"${getPackageCommandUsage(options.command)}\".`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.missingOptionValue) {\n\t\tconsole.error(chalk.red(`Missing value for ${options.missingOptionValue}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.invalidArgument) {\n\t\tconsole.error(chalk.red(`Unexpected argument ${options.invalidArgument}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.conflictingOptions) {\n\t\tconsole.error(chalk.red(options.conflictingOptions));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst source = options.source;\n\tif ((options.command === \"install\" || options.command === \"remove\") && !source) {\n\t\tconsole.error(chalk.red(`Missing ${options.command} source.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst writesProjectPackageConfig = (options.command === \"install\" || options.command === \"remove\") && options.local;\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: options.projectTrustOverride,\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\tif (!settingsManager.isProjectTrusted() && writesProjectPackageConfig) {\n\t\tconsole.error(chalk.red(\"Project is not trusted. Use --approve to modify local package config.\"));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\treportSettingsErrors(settingsManager, \"package command\");\n\tconst selfUpdateNpmCommand = settingsManager.getGlobalSettings().npmCommand;\n\n\tconst packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });\n\n\tpackageManager.setProgressCallback((event) => {\n\t\tif (event.type === \"start\") {\n\t\t\tprocess.stdout.write(chalk.dim(`${event.message}\\n`));\n\t\t}\n\t});\n\n\ttry {\n\t\tswitch (options.command) {\n\t\t\tcase \"install\":\n\t\t\t\tawait packageManager.installAndPersist(source!, { local: options.local });\n\t\t\t\tconsole.log(chalk.green(`Installed ${source}`));\n\t\t\t\treturn true;\n\n\t\t\tcase \"remove\": {\n\t\t\t\tconst removed = await packageManager.removeAndPersist(source!, { local: options.local });\n\t\t\t\tif (!removed) {\n\t\t\t\t\tconsole.error(chalk.red(`No matching package found for ${source}`));\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tconsole.log(chalk.green(`Removed ${source}`));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"list\": {\n\t\t\t\tconst configuredPackages = packageManager.listConfiguredPackages();\n\t\t\t\tconst userPackages = configuredPackages.filter((pkg) => pkg.scope === \"user\");\n\t\t\t\tconst projectPackages = configuredPackages.filter((pkg) => pkg.scope === \"project\");\n\n\t\t\t\tif (configuredPackages.length === 0) {\n\t\t\t\t\tconsole.log(chalk.dim(\"No packages installed.\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tconst formatPackage = (pkg: (typeof configuredPackages)[number]) => {\n\t\t\t\t\tconst display = pkg.filtered ? `${pkg.source} (filtered)` : pkg.source;\n\t\t\t\t\tconsole.log(` ${display}`);\n\t\t\t\t\tif (pkg.installedPath) {\n\t\t\t\t\t\tconsole.log(chalk.dim(` ${pkg.installedPath}`));\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif (userPackages.length > 0) {\n\t\t\t\t\tconsole.log(chalk.bold(\"User packages:\"));\n\t\t\t\t\tfor (const pkg of userPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (projectPackages.length > 0) {\n\t\t\t\t\tif (userPackages.length > 0) console.log();\n\t\t\t\t\tconsole.log(chalk.bold(\"Project packages:\"));\n\t\t\t\t\tfor (const pkg of projectPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"update\": {\n\t\t\t\tconst target = options.updateTarget ?? { type: \"self\" };\n\t\t\t\tif (options.showExtensionsSkippedNote) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(`Extensions are skipped. Run ${APP_NAME} update --extensions to update extensions.`),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesExtensions(target)) {\n\t\t\t\t\tconst updateSource = target.type === \"extensions\" ? target.source : undefined;\n\t\t\t\t\tawait packageManager.update(updateSource);\n\t\t\t\t\tif (updateSource) {\n\t\t\t\t\t\tconsole.log(chalk.green(`Updated ${updateSource}`));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log(chalk.green(\"Updated packages\"));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesSelf(target)) {\n\t\t\t\t\tconst selfUpdatePlan = await getSelfUpdatePlan(options.force);\n\t\t\t\t\tif (!selfUpdatePlan.shouldRun) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst installMethod = detectInstallMethod();\n\t\t\t\t\tif (process.platform === \"win32\" && installMethod !== \"npm\" && installMethod !== \"pnpm\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\tchalk.red(`${APP_NAME} self-update on Windows is only supported for npm and pnpm installs.`),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconsole.error(chalk.dim(`Detected install method: ${installMethod}. Update ${APP_NAME} manually.`));\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst selfUpdateCommand = getSelfUpdateCommand(\n\t\t\t\t\t\tPACKAGE_NAME,\n\t\t\t\t\t\tselfUpdateNpmCommand,\n\t\t\t\t\t\tselfUpdatePlan.packageName,\n\t\t\t\t\t);\n\t\t\t\t\tif (!selfUpdateCommand) {\n\t\t\t\t\t\tprintSelfUpdateUnavailable(selfUpdateNpmCommand, selfUpdatePlan.packageName);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (installMethod === \"npm\") {\n\t\t\t\t\t\t\tprepareWindowsNpmSelfUpdate();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait runSelfUpdate(selfUpdateCommand);\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\t\t\t\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\t\t\t\t\tprintSelfUpdateFallback(selfUpdateCommand);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(chalk.green(`Updated ${APP_NAME}`));\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"package-manager-cli.d.ts","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAoHnE,MAAM,WAAW,4BAA4B;IAC5C,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAyDD,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CA0BlB;AAED,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CA8LlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-entry.d.ts","sourceRoot":"","sources":["../src/rpc-entry.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\nimport { APP_NAME } from \"./config.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { main } from \"./main.ts\";\n\nprocess.title = `${APP_NAME}-rpc`;\nprocess.env[`${APP_NAME.toUpperCase()}_CODING_AGENT`] = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconfigureHttpDispatcher();\n\n// rpc-entry is the dedicated RPC entry point, so --mode rpc must always win\n// over any --mode the caller passes (the last --mode in the args wins).\nmain([...process.argv.slice(2), \"--mode\", \"rpc\"]);\n"]}
1
+ {"version":3,"file":"rpc-entry.d.ts","sourceRoot":"","sources":["../src/rpc-entry.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AA6CA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAc/C","sourcesContent":["/*\n * Portions of this file are derived from:\n * - ansi-regex (https://github.com/chalk/ansi-regex)\n * - strip-ansi (https://github.com/chalk/strip-ansi)\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nfunction ansiRegex({ onlyFirst = false }: { onlyFirst?: boolean } = {}): RegExp {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(value: string): string {\n\tif (typeof value !== \"string\") {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof value}\\``);\n\t}\n\n\t// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer\n\tif (!value.includes(\"\\u001B\") && !value.includes(\"\\u009B\")) {\n\t\treturn value;\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn value.replace(regex, \"\");\n}\n"]}
1
+ {"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AA6CA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAc/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AA2HD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,MAAM,CAKlG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,EAAE,CA+CtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,GAAG,MAAM,CAQ1E;AAmBD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,cAAc,EAAE,EACzB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACrB,cAAc,EAAE,CAgBlB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAIjG;AAGD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import path from \"node:path\";\nimport { existsSync, readFileSync } from \"fs\";\n\nexport interface VersionParts {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tprerelease: number | null;\n}\n\nexport interface ChangelogEntry extends VersionParts {\n\tversion: string;\n\tcontent: string;\n}\n\n// The prerelease group accepts BOTH the legacy numeric form (`-N`) and the new\n// `-alpha.N` convention while capturing the numeric revision. The outer capture\n// group preserves the raw version substring so each entry's `version` round-trips\n// faithfully (a `0.8.1-0` header stays `0.8.1-0`; a `0.8.2-alpha.1` header stays\n// `0.8.2-alpha.1`).\nconst RELEASE_VERSION_RE = /^(?:v)?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)$/;\nconst CHANGELOG_VERSION_HEADER_RE =\n\t/^##\\s+\\[?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)\\]?/;\nconst GITHUB_REPO = \"bastani-inc/atomic\";\nconst CHANGELOG_LINK_BASE_PATH = \"packages/coding-agent\";\nconst LEGACY_REPO_RE = /^https:\\/\\/github\\.com\\/(?:badlogic|earendil-works)\\/pi-mono(?=\\/|$)/;\nconst URL_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;\nconst INLINE_MARKDOWN_LINK_RE = /(!?\\[[^\\]\\n]+\\]\\()([^\\s)]+)((?:\\s+[^)]*)?\\))/g;\n\ninterface ParsedVersion extends VersionParts {\n\tversion: string;\n}\n\nfunction parsedVersionFromMatch(match: RegExpMatchArray): ParsedVersion {\n\treturn {\n\t\tversion: match[1] as string,\n\t\tmajor: Number.parseInt(match[2] as string, 10),\n\t\tminor: Number.parseInt(match[3] as string, 10),\n\t\tpatch: Number.parseInt(match[4] as string, 10),\n\t\tprerelease: match[5] === undefined ? null : Number.parseInt(match[5], 10),\n\t};\n}\n\nfunction parseVersion(version: string): VersionParts | null {\n\tconst match = version.trim().match(RELEASE_VERSION_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction parseVersionHeader(line: string): ParsedVersion | null {\n\tconst match = line.match(CHANGELOG_VERSION_HEADER_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction createChangelogEntry(version: ParsedVersion, lines: string[]): ChangelogEntry {\n\treturn {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch,\n\t\tprerelease: version.prerelease,\n\t\tversion: version.version,\n\t\tcontent: lines.join(\"\\n\").trim(),\n\t};\n}\n\nfunction normalizeTag(version: string | ChangelogEntry): string {\n\tconst versionString = typeof version === \"string\" ? version : version.version;\n\treturn versionString.startsWith(\"v\") ? versionString.slice(1) : versionString;\n}\n\nfunction splitLocalTarget(target: string): { fragment: string; pathPart: string; query: string } {\n\tconst hashIndex = target.indexOf(\"#\");\n\tconst beforeHash = hashIndex === -1 ? target : target.slice(0, hashIndex);\n\tconst fragment = hashIndex === -1 ? \"\" : target.slice(hashIndex);\n\tconst queryIndex = beforeHash.indexOf(\"?\");\n\n\tif (queryIndex === -1) {\n\t\treturn { fragment, pathPart: beforeHash, query: \"\" };\n\t}\n\n\treturn {\n\t\tfragment,\n\t\tpathPart: beforeHash.slice(0, queryIndex),\n\t\tquery: beforeHash.slice(queryIndex),\n\t};\n}\n\nfunction normalizePathPart(value: string): string {\n\treturn value.replaceAll(\"\\\\\", \"/\");\n}\n\nfunction resolveRepositoryPath(targetPath: string): string | undefined {\n\tconst normalizedTarget = normalizePathPart(targetPath);\n\tconst joined = normalizedTarget.startsWith(\"/\")\n\t\t? path.posix.normalize(normalizedTarget.replace(/^\\/+/, \"\"))\n\t\t: path.posix.normalize(path.posix.join(CHANGELOG_LINK_BASE_PATH, normalizedTarget));\n\n\tif (joined === \".\" || joined.startsWith(\"../\") || joined === \"..\") {\n\t\treturn undefined;\n\t}\n\n\treturn joined;\n}\n\nfunction isDirectoryTarget(originalPath: string, repositoryPath: string): boolean {\n\tif (originalPath.endsWith(\"/\")) return true;\n\tconst basename = path.posix.basename(repositoryPath);\n\treturn !basename.includes(\".\");\n}\n\nfunction normalizeChangelogLinkTarget(target: string, tag: string): string {\n\tlet canonicalTarget = target.replace(LEGACY_REPO_RE, `https://github.com/${GITHUB_REPO}`);\n\tconst repoUrl = `https://github.com/${GITHUB_REPO}`;\n\n\tfor (const route of [\"blob\", \"tree\"]) {\n\t\tfor (const branch of [\"main\", \"master\"]) {\n\t\t\tconst floatingRefPrefix = `${repoUrl}/${route}/${branch}/`;\n\t\t\tif (canonicalTarget.startsWith(floatingRefPrefix)) {\n\t\t\t\tcanonicalTarget = `${repoUrl}/${route}/${tag}/${canonicalTarget.slice(floatingRefPrefix.length)}`;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (canonicalTarget.startsWith(\"#\") || canonicalTarget.startsWith(\"//\") || URL_SCHEME_RE.test(canonicalTarget)) {\n\t\treturn canonicalTarget;\n\t}\n\n\tconst { fragment, pathPart, query } = splitLocalTarget(canonicalTarget);\n\tif (!pathPart) return canonicalTarget;\n\n\tconst repositoryPath = resolveRepositoryPath(pathPart);\n\tif (!repositoryPath) return canonicalTarget;\n\n\tconst route = isDirectoryTarget(pathPart, repositoryPath) ? \"tree\" : \"blob\";\n\treturn `https://github.com/${GITHUB_REPO}/${route}/${tag}/${encodeURI(repositoryPath)}${query}${fragment}`;\n}\n\nexport function normalizeChangelogLinks(markdown: string, version: string | ChangelogEntry): string {\n\tconst tag = normalizeTag(version);\n\treturn markdown.replace(INLINE_MARKDOWN_LINK_RE, (_match, prefix, target, suffix) => {\n\t\treturn `${prefix}${normalizeChangelogLinkTarget(target, tag)}${suffix}`;\n\t});\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: ParsedVersion | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionParts = parseVersionHeader(line);\n\t\t\t\tif (versionParts) {\n\t\t\t\t\tcurrentVersion = versionParts;\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: VersionParts, v2: VersionParts): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\tif (v1.patch !== v2.patch) return v1.patch - v2.patch;\n\tif (v1.prerelease === v2.prerelease) return 0;\n\tif (v1.prerelease === null) return 1;\n\tif (v2.prerelease === null) return -1;\n\treturn v1.prerelease - v2.prerelease;\n}\n\n/**\n * Get entries newer than lastVersion, optionally bounded by currentVersion.\n *\n * Atomic uses alpha prereleases (for example, 0.8.2-alpha.1, with the revision\n * starting at 1) while legacy numeric prerelease entries (for example, 0.8.1-0)\n * remain parseable, and started its own\n * version line above the upstream Pi changelog history. When currentVersion is\n * provided, changelog order wins over semantic version filtering so historical\n * upstream entries like 0.74.0 or an old 0.10.0 section are not treated as\n * newer Atomic releases.\n */\nfunction findVersionIndex(entries: ChangelogEntry[], version: string): number {\n\tconst target = parseVersion(version);\n\tif (!target) return -1;\n\treturn entries.findIndex((entry) => compareVersions(entry, target) === 0);\n}\n\nexport function getNewEntries(\n\tentries: ChangelogEntry[],\n\tlastVersion: string,\n\tcurrentVersion?: string,\n): ChangelogEntry[] {\n\tif (currentVersion) {\n\t\tconst currentIndex = findVersionIndex(entries, currentVersion);\n\t\tif (currentIndex === -1) return [];\n\n\t\tconst lastIndex = findVersionIndex(entries, lastVersion);\n\t\tif (lastIndex !== -1) {\n\t\t\treturn currentIndex < lastIndex ? entries.slice(currentIndex, lastIndex) : [];\n\t\t}\n\n\t\tconst currentEntry = entries[currentIndex];\n\t\treturn currentIndex === 0 && currentEntry ? [currentEntry] : [];\n\t}\n\n\tconst last = parseVersion(lastVersion) ?? { major: 0, minor: 0, patch: 0, prerelease: null };\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\nexport function getEntriesForVersion(entries: ChangelogEntry[], version: string): ChangelogEntry[] {\n\tconst target = parseVersion(version);\n\tif (!target) return [];\n\treturn entries.filter((entry) => compareVersions(entry, target) === 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AA2HD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,MAAM,CAKlG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,EAAE,CA+CtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,GAAG,MAAM,CAQ1E;AAmBD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,cAAc,EAAE,EACzB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACrB,cAAc,EAAE,CAgBlB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAIjG;AAGD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C,KAAK,0BAA0B,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAIF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,0BAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,GAClE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;AAKnG,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,kCAAkC,GACzC,gBAAgB,CAAC,MAAM,CAAC,CAI1B;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkJzH","sourcesContent":["import {\n\ttype ChildProcess,\n\ttype ChildProcessByStdio,\n\tspawn as nodeSpawn,\n\tspawnSync as nodeSpawnSync,\n\ttype SpawnOptions,\n\ttype SpawnOptionsWithStdioTuple,\n\ttype SpawnSyncOptionsWithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_EXIT_POLL_INTERVAL_MS = 50;\nconst WINDOWS_EXIT_CODE_GRACE_MS = 1_000;\n\ntype WaitForChildProcessOptions = {\n\tplatform?: NodeJS.Platform;\n\tisWindowsProcessAlive?: (pid: number) => boolean;\n\twindowsExitPollIntervalMs?: number;\n\twindowsExitCodeGraceMs?: number;\n};\n\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess, options: WaitForChildProcessOptions = {}): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\t\tlet windowsExitCodeGraceTimer: NodeJS.Timeout | undefined;\n\t\tconst platform = options.platform ?? process.platform;\n\t\tconst processAlive = options.isWindowsProcessAlive ?? isWindowsProcessAlive;\n\t\tconst windowsExitPollIntervalMs = options.windowsExitPollIntervalMs ?? WINDOWS_EXIT_POLL_INTERVAL_MS;\n\t\tconst windowsExitCodeGraceMs = options.windowsExitCodeGraceMs ?? WINDOWS_EXIT_CODE_GRACE_MS;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst armWindowsExitCodeGraceTimer = () => {\n\t\t\tif (windowsExitCodeGraceTimer) return;\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\twindowsExitCodeGraceTimer = setTimeout(() => {\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}, windowsExitCodeGraceMs);\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!processAlive(child.pid)) {\n\t\t\t\tif (child.exitCode !== null) {\n\t\t\t\t\tonExit(child.exitCode);\n\t\t\t\t} else {\n\t\t\t\t\tarmWindowsExitCodeGraceTimer();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (platform === \"win32\" && child.pid) {\n\t\t\twindowsExitPoll = setInterval(pollWindowsExit, windowsExitPollIntervalMs);\n\t\t}\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}
1
+ {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C,KAAK,0BAA0B,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAIF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,0BAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,GAClE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;AAKnG,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,kCAAkC,GACzC,gBAAgB,CAAC,MAAM,CAAC,CAI1B;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkJzH"}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-image.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-image.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AASF,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAE9E;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAazE;AAmND,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8CjC","sourcesContent":["import { spawnSync } from \"child_process\";\nimport { randomUUID } from \"crypto\";\nimport { readFileSync, unlinkSync } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport type ClipboardImage = {\n\tbytes: Uint8Array;\n\tmimeType: string;\n};\n\nconst SUPPORTED_IMAGE_MIME_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"] as const;\n\nconst DEFAULT_LIST_TIMEOUT_MS = 1000;\nconst DEFAULT_READ_TIMEOUT_MS = 3000;\nconst DEFAULT_POWERSHELL_TIMEOUT_MS = 5000;\nconst DEFAULT_MAX_BUFFER_BYTES = 50 * 1024 * 1024;\n\nexport function isWaylandSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === \"wayland\";\n}\n\nfunction baseMimeType(mimeType: string): string {\n\treturn mimeType.split(\";\")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();\n}\n\nexport function extensionForImageMimeType(mimeType: string): string | null {\n\tswitch (baseMimeType(mimeType)) {\n\t\tcase \"image/png\":\n\t\t\treturn \"png\";\n\t\tcase \"image/jpeg\":\n\t\t\treturn \"jpg\";\n\t\tcase \"image/webp\":\n\t\t\treturn \"webp\";\n\t\tcase \"image/gif\":\n\t\t\treturn \"gif\";\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nfunction selectPreferredImageMimeType(mimeTypes: string[]): string | null {\n\tconst normalized = mimeTypes\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean)\n\t\t.map((t) => ({ raw: t, base: baseMimeType(t) }));\n\n\tfor (const preferred of SUPPORTED_IMAGE_MIME_TYPES) {\n\t\tconst match = normalized.find((t) => t.base === preferred);\n\t\tif (match) {\n\t\t\treturn match.raw;\n\t\t}\n\t}\n\n\tconst anyImage = normalized.find((t) => t.base.startsWith(\"image/\"));\n\treturn anyImage?.raw ?? null;\n}\n\nfunction isSupportedImageMimeType(mimeType: string): boolean {\n\tconst base = baseMimeType(mimeType);\n\treturn SUPPORTED_IMAGE_MIME_TYPES.some((t) => t === base);\n}\n\n/**\n * Convert unsupported image formats to PNG using Photon.\n * Returns null if conversion is unavailable or fails.\n */\nasync function convertToPng(bytes: Uint8Array): Promise<Uint8Array | null> {\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst image = photon.PhotonImage.new_from_byteslice(bytes);\n\t\ttry {\n\t\t\treturn image.get_bytes();\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction runCommand(\n\tcommand: string,\n\targs: string[],\n\toptions?: { timeoutMs?: number; maxBufferBytes?: number; env?: NodeJS.ProcessEnv },\n): { stdout: Buffer; ok: boolean } {\n\tconst timeoutMs = options?.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS;\n\tconst maxBufferBytes = options?.maxBufferBytes ?? DEFAULT_MAX_BUFFER_BYTES;\n\n\tconst result = spawnSync(command, args, {\n\t\ttimeout: timeoutMs,\n\t\tmaxBuffer: maxBufferBytes,\n\t\tenv: options?.env,\n\t});\n\n\tif (result.error) {\n\t\treturn { ok: false, stdout: Buffer.alloc(0) };\n\t}\n\n\tif (result.status !== 0) {\n\t\treturn { ok: false, stdout: Buffer.alloc(0) };\n\t}\n\n\tconst stdout = Buffer.isBuffer(result.stdout)\n\t\t? result.stdout\n\t\t: Buffer.from(result.stdout ?? \"\", typeof result.stdout === \"string\" ? \"utf-8\" : undefined);\n\n\treturn { ok: true, stdout };\n}\n\nfunction readClipboardImageViaWlPaste(): ClipboardImage | null {\n\tconst list = runCommand(\"wl-paste\", [\"--list-types\"], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });\n\tif (!list.ok) {\n\t\treturn null;\n\t}\n\n\tconst types = list.stdout\n\t\t.toString(\"utf-8\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean);\n\n\tconst selectedType = selectPreferredImageMimeType(types);\n\tif (!selectedType) {\n\t\treturn null;\n\t}\n\n\tconst data = runCommand(\"wl-paste\", [\"--type\", selectedType, \"--no-newline\"]);\n\tif (!data.ok || data.stdout.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn { bytes: data.stdout, mimeType: baseMimeType(selectedType) };\n}\n\nfunction isWSL(env: NodeJS.ProcessEnv = process.env): boolean {\n\tif (env.WSL_DISTRO_NAME || env.WSLENV) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tconst release = readFileSync(\"/proc/version\", \"utf-8\");\n\t\treturn /microsoft|wsl/i.test(release);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * On WSL, the Linux clipboard (Wayland/X11) does not receive image data from\n * Windows screenshots (Win+Shift+S). PowerShell can access the Windows clipboard\n * directly, so we use it as a fallback.\n */\nfunction readClipboardImageViaPowerShell(): ClipboardImage | null {\n\tconst tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.png`);\n\n\ttry {\n\t\tconst winPathResult = runCommand(\"wslpath\", [\"-w\", tmpFile], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });\n\t\tif (!winPathResult.ok) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst winPath = winPathResult.stdout.toString(\"utf-8\").trim();\n\t\tif (!winPath) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst psQuotedWinPath = winPath.replaceAll(\"'\", \"''\");\n\t\tconst psScript = [\n\t\t\t\"Add-Type -AssemblyName System.Windows.Forms\",\n\t\t\t\"Add-Type -AssemblyName System.Drawing\",\n\t\t\t`$path = '${psQuotedWinPath}'`,\n\t\t\t\"$img = [System.Windows.Forms.Clipboard]::GetImage()\",\n\t\t\t\"if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }\",\n\t\t].join(\"; \");\n\n\t\tconst result = runCommand(\"powershell.exe\", [\"-NoProfile\", \"-Command\", psScript], {\n\t\t\ttimeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,\n\t\t});\n\t\tif (!result.ok) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst output = result.stdout.toString(\"utf-8\").trim();\n\t\tif (output !== \"ok\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst bytes = readFileSync(tmpFile);\n\t\tif (bytes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { bytes: new Uint8Array(bytes), mimeType: \"image/png\" };\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors.\n\t\t}\n\t}\n}\n\nfunction readClipboardImageViaXclip(): ClipboardImage | null {\n\tconst targets = runCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", \"TARGETS\", \"-o\"], {\n\t\ttimeoutMs: DEFAULT_LIST_TIMEOUT_MS,\n\t});\n\n\tlet candidateTypes: string[] = [];\n\tif (targets.ok) {\n\t\tcandidateTypes = targets.stdout\n\t\t\t.toString(\"utf-8\")\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((t) => t.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tconst preferred = candidateTypes.length > 0 ? selectPreferredImageMimeType(candidateTypes) : null;\n\tconst tryTypes = preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : [...SUPPORTED_IMAGE_MIME_TYPES];\n\n\tfor (const mimeType of tryTypes) {\n\t\tconst data = runCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", mimeType, \"-o\"]);\n\t\tif (data.ok && data.stdout.length > 0) {\n\t\t\treturn { bytes: data.stdout, mimeType: baseMimeType(mimeType) };\n\t\t}\n\t}\n\n\treturn null;\n}\n\nasync function readClipboardImageViaNativeClipboard(): Promise<ClipboardImage | null> {\n\tif (!clipboard || !clipboard.hasImage()) {\n\t\treturn null;\n\t}\n\n\tconst imageData = await clipboard.getImageBinary();\n\tif (!imageData || imageData.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst bytes = imageData instanceof Uint8Array ? imageData : Uint8Array.from(imageData);\n\treturn { bytes, mimeType: \"image/png\" };\n}\n\nexport async function readClipboardImage(options?: {\n\tenv?: NodeJS.ProcessEnv;\n\tplatform?: NodeJS.Platform;\n}): Promise<ClipboardImage | null> {\n\tconst env = options?.env ?? process.env;\n\tconst platform = options?.platform ?? process.platform;\n\n\tif (env.TERMUX_VERSION) {\n\t\treturn null;\n\t}\n\n\tlet image: ClipboardImage | null = null;\n\n\tif (platform === \"linux\") {\n\t\tconst wsl = isWSL(env);\n\t\tconst wayland = isWaylandSession(env);\n\n\t\tif (wayland || wsl) {\n\t\t\timage = readClipboardImageViaWlPaste() ?? readClipboardImageViaXclip();\n\t\t}\n\n\t\tif (!image && wsl) {\n\t\t\timage = readClipboardImageViaPowerShell();\n\t\t}\n\n\t\tif (!image && !wayland) {\n\t\t\timage = await readClipboardImageViaNativeClipboard();\n\t\t\tif (!image) {\n\t\t\t\timage = readClipboardImageViaXclip();\n\t\t\t}\n\t\t}\n\t} else {\n\t\timage = await readClipboardImageViaNativeClipboard();\n\t}\n\n\tif (!image) {\n\t\treturn null;\n\t}\n\n\t// Convert unsupported formats (e.g., BMP from WSLg) to PNG\n\tif (!isSupportedImageMimeType(image.mimeType)) {\n\t\tconst pngBytes = await convertToPng(image.bytes);\n\t\tif (!pngBytes) {\n\t\t\treturn null;\n\t\t}\n\t\treturn { bytes: pngBytes, mimeType: \"image/png\" };\n\t}\n\n\treturn image;\n}\n"]}
1
+ {"version":3,"file":"clipboard-image.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-image.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AASF,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAE9E;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAazE;AAmND,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8CjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-native.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-native.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7C,CAAC;AAEF,KAAK,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;AAMhD,wBAAgB,mBAAmB,CAClC,QAAQ,GAAE,SAAS,gBAAgB,EAA0C,GAC3E,eAAe,GAAG,IAAI,CASxB;AAED,QAAA,MAAM,SAAS,wBAA2E,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { createRequire } from \"module\";\nimport { dirname, join } from \"path\";\nimport { pathToFileURL } from \"url\";\n\nexport type ClipboardModule = {\n\tsetText: (text: string) => Promise<void>;\n\thasImage: () => boolean;\n\tgetImageBinary: () => Promise<Array<number>>;\n};\n\ntype ClipboardRequire = (id: string) => unknown;\n\nconst moduleRequire = createRequire(import.meta.url);\nconst executableDirRequire = createRequire(pathToFileURL(join(dirname(process.execPath), \"package.json\")).href);\nconst hasDisplay = process.platform !== \"linux\" || Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);\n\nexport function loadClipboardNative(\n\trequires: readonly ClipboardRequire[] = [moduleRequire, executableDirRequire],\n): ClipboardModule | null {\n\tfor (const requireClipboard of requires) {\n\t\ttry {\n\t\t\treturn requireClipboard(\"@mariozechner/clipboard\") as ClipboardModule;\n\t\t} catch {\n\t\t\t// Try the next resolution root.\n\t\t}\n\t}\n\treturn null;\n}\n\nconst clipboard = !process.env.TERMUX_VERSION && hasDisplay ? loadClipboardNative() : null;\n\nexport { clipboard };\n"]}
1
+ {"version":3,"file":"clipboard-native.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-native.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7C,CAAC;AAEF,KAAK,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;AAMhD,wBAAgB,mBAAmB,CAClC,QAAQ,GAAE,SAAS,gBAAgB,EAA0C,GAC3E,eAAe,GAAG,IAAI,CASxB;AAED,QAAA,MAAM,SAAS,wBAA2E,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAkCA,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FjE","sourcesContent":["import { execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead\n\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\t\t\tproc.unref();\n\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote || !copied) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tthrow new Error(\"Failed to copy to clipboard\");\n\t}\n}\n"]}
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAkCA,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD"}