@ponythewhite/base-context 1.0.0 → 1.0.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 (285) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/NOTICE +0 -5
  3. package/README.md +44 -27
  4. package/dist/NOTICE +0 -5
  5. package/dist/base-context-runtime/pyproject.toml +1 -1
  6. package/dist/base-context-runtime/src/rlm/__init__.py +7 -5
  7. package/dist/base-context-runtime/test/test_subagent_registry.py +28 -1
  8. package/dist/base-context-runtime/uv.lock +1 -1
  9. package/dist/build-info.json +1 -1
  10. package/dist/bundle/amazon-bedrock.js +21 -0
  11. package/dist/bundle/{anthropic-YY4S534V.js → anthropic-UV5GZDGU.js} +5 -5
  12. package/dist/bundle/{azure-openai-responses-JRP6MIM3.js → azure-openai-responses-WSNPXLYC.js} +6 -6
  13. package/dist/bundle/{bundled-modules-P5HARVZA.js → bundled-modules-PWOGKUQQ.js} +71 -16
  14. package/dist/bundle/chunk-27QCJ2AZ.js +2578 -0
  15. package/dist/bundle/{chunk-BYVP7LWV.js → chunk-44PEHPOG.js} +1916 -4689
  16. package/dist/bundle/{chunk-MZHTNNVA.js → chunk-4GXPNXOJ.js} +8 -0
  17. package/dist/bundle/{chunk-SC5KG5R4.js → chunk-DGNX7HQ3.js} +1 -7
  18. package/dist/bundle/{chunk-A53O363M.js → chunk-GRJFXLBM.js} +0 -1
  19. package/dist/bundle/chunk-HKINIBP4.js +29 -0
  20. package/dist/bundle/{chunk-73DCPU3D.js → chunk-IADCPVEI.js} +1019 -3427
  21. package/dist/bundle/{chunk-UDSW6FNG.js → chunk-KTNETTHI.js} +1 -1
  22. package/dist/bundle/{chunk-U7AUVG3B.js → chunk-VSIYFWYI.js} +24 -6
  23. package/dist/bundle/{chunk-IW77OXFS.js → chunk-W46VZFI6.js} +0 -2099
  24. package/dist/bundle/{cli-main-O4X7GFGY.js → cli-main-4DS7Y3PI.js} +8 -6
  25. package/dist/bundle/cli.js +2 -2
  26. package/dist/bundle/{google-AUTVGDGZ.js → google-T32FMD4G.js} +6 -6
  27. package/dist/bundle/{google-vertex-Q75D7RKS.js → google-vertex-56KP6I3B.js} +3 -3
  28. package/dist/bundle/{main-XKOW2BV6.js → main-SV7JLVEB.js} +7 -5
  29. package/dist/bundle/{mistral-7ESB7QUD.js → mistral-WGBMYIVU.js} +5 -5
  30. package/dist/bundle/{openai-codex-responses-LV3QRPN4.js → openai-codex-responses-PIV2RQ3G.js} +6 -6
  31. package/dist/bundle/{openai-completions-OJECLPXJ.js → openai-completions-64C3JPR4.js} +11 -22
  32. package/dist/bundle/{openai-responses-FN6HZMBC.js → openai-responses-UI7RSTDV.js} +6 -6
  33. package/dist/cli/args.d.ts.map +1 -1
  34. package/dist/cli/args.js +108 -59
  35. package/dist/cli/args.js.map +1 -1
  36. package/dist/cli/daemon-ps.d.ts +4 -3
  37. package/dist/cli/daemon-ps.d.ts.map +1 -1
  38. package/dist/cli/daemon-ps.js +6 -1
  39. package/dist/cli/daemon-ps.js.map +1 -1
  40. package/dist/cli/product-doctor.d.ts +0 -1
  41. package/dist/cli/product-doctor.d.ts.map +1 -1
  42. package/dist/cli/product-doctor.js +6 -3
  43. package/dist/cli/product-doctor.js.map +1 -1
  44. package/dist/config.d.ts +0 -3
  45. package/dist/config.d.ts.map +1 -1
  46. package/dist/config.js +0 -8
  47. package/dist/config.js.map +1 -1
  48. package/dist/core/agent-session-config.d.ts +1 -2
  49. package/dist/core/agent-session-config.d.ts.map +1 -1
  50. package/dist/core/agent-session-config.js +0 -3
  51. package/dist/core/agent-session-config.js.map +1 -1
  52. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  53. package/dist/core/agent-session-runtime.js +5 -4
  54. package/dist/core/agent-session-runtime.js.map +1 -1
  55. package/dist/core/agent-session-services.d.ts +5 -3
  56. package/dist/core/agent-session-services.d.ts.map +1 -1
  57. package/dist/core/agent-session-services.js +2 -27
  58. package/dist/core/agent-session-services.js.map +1 -1
  59. package/dist/core/agent-session.d.ts +10 -6
  60. package/dist/core/agent-session.d.ts.map +1 -1
  61. package/dist/core/agent-session.js +107 -107
  62. package/dist/core/agent-session.js.map +1 -1
  63. package/dist/core/auth-storage.d.ts +8 -35
  64. package/dist/core/auth-storage.d.ts.map +1 -1
  65. package/dist/core/auth-storage.js +33 -243
  66. package/dist/core/auth-storage.js.map +1 -1
  67. package/dist/core/cron-jobs.d.ts.map +1 -1
  68. package/dist/core/cron-jobs.js +7 -1
  69. package/dist/core/cron-jobs.js.map +1 -1
  70. package/dist/core/inference-coordinator.d.ts +6 -1
  71. package/dist/core/inference-coordinator.d.ts.map +1 -1
  72. package/dist/core/inference-coordinator.js +18 -2
  73. package/dist/core/inference-coordinator.js.map +1 -1
  74. package/dist/core/kernel/bootstrap.d.ts.map +1 -1
  75. package/dist/core/kernel/bootstrap.js +2 -2
  76. package/dist/core/kernel/bootstrap.js.map +1 -1
  77. package/dist/core/kernel/repl-manager.d.ts +2 -0
  78. package/dist/core/kernel/repl-manager.d.ts.map +1 -1
  79. package/dist/core/kernel/repl-manager.js +44 -1
  80. package/dist/core/kernel/repl-manager.js.map +1 -1
  81. package/dist/core/logging.d.ts +4 -3
  82. package/dist/core/logging.d.ts.map +1 -1
  83. package/dist/core/logging.js +6 -6
  84. package/dist/core/logging.js.map +1 -1
  85. package/dist/core/mcp/mcp-manager.d.ts.map +1 -1
  86. package/dist/core/mcp/mcp-manager.js +3 -3
  87. package/dist/core/mcp/mcp-manager.js.map +1 -1
  88. package/dist/core/model-registry.d.ts +1 -16
  89. package/dist/core/model-registry.d.ts.map +1 -1
  90. package/dist/core/model-registry.js +88 -196
  91. package/dist/core/model-registry.js.map +1 -1
  92. package/dist/core/model-resolver.d.ts +2 -19
  93. package/dist/core/model-resolver.d.ts.map +1 -1
  94. package/dist/core/model-resolver.js +36 -266
  95. package/dist/core/model-resolver.js.map +1 -1
  96. package/dist/core/provider-contracts.d.ts +5 -6
  97. package/dist/core/provider-contracts.d.ts.map +1 -1
  98. package/dist/core/provider-contracts.js +25 -36
  99. package/dist/core/provider-contracts.js.map +1 -1
  100. package/dist/core/provider-display-names.d.ts.map +1 -1
  101. package/dist/core/provider-display-names.js +0 -2
  102. package/dist/core/provider-display-names.js.map +1 -1
  103. package/dist/core/rlm-max-subagents.d.ts +32 -0
  104. package/dist/core/rlm-max-subagents.d.ts.map +1 -0
  105. package/dist/core/rlm-max-subagents.js +50 -0
  106. package/dist/core/rlm-max-subagents.js.map +1 -0
  107. package/dist/core/rlm-runtime.d.ts +3 -3
  108. package/dist/core/rlm-runtime.d.ts.map +1 -1
  109. package/dist/core/rlm-runtime.js.map +1 -1
  110. package/dist/core/sdk.d.ts +4 -3
  111. package/dist/core/sdk.d.ts.map +1 -1
  112. package/dist/core/sdk.js +27 -14
  113. package/dist/core/sdk.js.map +1 -1
  114. package/dist/core/settings-manager.d.ts +3 -16
  115. package/dist/core/settings-manager.d.ts.map +1 -1
  116. package/dist/core/settings-manager.js +12 -44
  117. package/dist/core/settings-manager.js.map +1 -1
  118. package/dist/core/slash-commands.d.ts.map +1 -1
  119. package/dist/core/slash-commands.js +6 -6
  120. package/dist/core/slash-commands.js.map +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js.map +1 -1
  124. package/dist/installer.mjs +2 -3
  125. package/dist/main.d.ts.map +1 -1
  126. package/dist/main.js +39 -34
  127. package/dist/main.js.map +1 -1
  128. package/dist/modes/acp/acp-mode.d.ts.map +1 -1
  129. package/dist/modes/acp/acp-mode.js +1 -1
  130. package/dist/modes/acp/acp-mode.js.map +1 -1
  131. package/dist/modes/agent-connection/daemon-agent-connection.d.ts +6 -2
  132. package/dist/modes/agent-connection/daemon-agent-connection.d.ts.map +1 -1
  133. package/dist/modes/agent-connection/daemon-agent-connection.js +13 -2
  134. package/dist/modes/agent-connection/daemon-agent-connection.js.map +1 -1
  135. package/dist/modes/agent-connection/in-process-agent-connection.d.ts +2 -0
  136. package/dist/modes/agent-connection/in-process-agent-connection.d.ts.map +1 -1
  137. package/dist/modes/agent-connection/in-process-agent-connection.js +6 -0
  138. package/dist/modes/agent-connection/in-process-agent-connection.js.map +1 -1
  139. package/dist/modes/agent-connection/types.d.ts +3 -0
  140. package/dist/modes/agent-connection/types.d.ts.map +1 -1
  141. package/dist/modes/agent-connection/types.js.map +1 -1
  142. package/dist/modes/agents-view/agents-view-mode.d.ts.map +1 -1
  143. package/dist/modes/agents-view/agents-view-mode.js +2 -19
  144. package/dist/modes/agents-view/agents-view-mode.js.map +1 -1
  145. package/dist/modes/daemon/daemon-mode.d.ts +5 -0
  146. package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
  147. package/dist/modes/daemon/daemon-mode.js +107 -12
  148. package/dist/modes/daemon/daemon-mode.js.map +1 -1
  149. package/dist/modes/daemon/daemon-protocol.d.ts +194 -165
  150. package/dist/modes/daemon/daemon-protocol.d.ts.map +1 -1
  151. package/dist/modes/daemon/daemon-protocol.js +16 -11
  152. package/dist/modes/daemon/daemon-protocol.js.map +1 -1
  153. package/dist/modes/daemon/daemon-rlm-capacity-coordinator.d.ts +19 -0
  154. package/dist/modes/daemon/daemon-rlm-capacity-coordinator.d.ts.map +1 -0
  155. package/dist/modes/daemon/daemon-rlm-capacity-coordinator.js +74 -0
  156. package/dist/modes/daemon/daemon-rlm-capacity-coordinator.js.map +1 -0
  157. package/dist/modes/daemon/daemon-rlm-capacity.d.ts +19 -0
  158. package/dist/modes/daemon/daemon-rlm-capacity.d.ts.map +1 -0
  159. package/dist/modes/daemon/daemon-rlm-capacity.js +85 -0
  160. package/dist/modes/daemon/daemon-rlm-capacity.js.map +1 -0
  161. package/dist/modes/daemon/daemon-session-summarizer.d.ts +2 -3
  162. package/dist/modes/daemon/daemon-session-summarizer.d.ts.map +1 -1
  163. package/dist/modes/daemon/daemon-session-summarizer.js +32 -23
  164. package/dist/modes/daemon/daemon-session-summarizer.js.map +1 -1
  165. package/dist/modes/daemon/daemon-state-root.d.ts +15 -0
  166. package/dist/modes/daemon/daemon-state-root.d.ts.map +1 -0
  167. package/dist/modes/daemon/daemon-state-root.js +40 -0
  168. package/dist/modes/daemon/daemon-state-root.js.map +1 -0
  169. package/dist/modes/daemon/daemon-supervisor-ownership.d.ts +2 -0
  170. package/dist/modes/daemon/daemon-supervisor-ownership.d.ts.map +1 -1
  171. package/dist/modes/daemon/daemon-supervisor-ownership.js +27 -0
  172. package/dist/modes/daemon/daemon-supervisor-ownership.js.map +1 -1
  173. package/dist/modes/daemon/daemon-supervisor.d.ts +10 -1
  174. package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
  175. package/dist/modes/daemon/daemon-supervisor.js +213 -20
  176. package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
  177. package/dist/modes/daemon/daemon-worker-protocol.d.ts +28 -1
  178. package/dist/modes/daemon/daemon-worker-protocol.d.ts.map +1 -1
  179. package/dist/modes/daemon/daemon-worker-protocol.js +16 -2
  180. package/dist/modes/daemon/daemon-worker-protocol.js.map +1 -1
  181. package/dist/modes/daemon/saved-session-catalog.d.ts.map +1 -1
  182. package/dist/modes/daemon/saved-session-catalog.js +2 -0
  183. package/dist/modes/daemon/saved-session-catalog.js.map +1 -1
  184. package/dist/modes/interactive/auth-flows.d.ts +0 -6
  185. package/dist/modes/interactive/auth-flows.d.ts.map +1 -1
  186. package/dist/modes/interactive/auth-flows.js +6 -126
  187. package/dist/modes/interactive/auth-flows.js.map +1 -1
  188. package/dist/modes/interactive/components/configuration-menu.d.ts +3 -0
  189. package/dist/modes/interactive/components/configuration-menu.d.ts.map +1 -1
  190. package/dist/modes/interactive/components/configuration-menu.js +13 -2
  191. package/dist/modes/interactive/components/configuration-menu.js.map +1 -1
  192. package/dist/modes/interactive/components/footer.d.ts +1 -1
  193. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  194. package/dist/modes/interactive/components/footer.js +2 -2
  195. package/dist/modes/interactive/components/footer.js.map +1 -1
  196. package/dist/modes/interactive/components/index.d.ts +0 -1
  197. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  198. package/dist/modes/interactive/components/index.js +0 -1
  199. package/dist/modes/interactive/components/index.js.map +1 -1
  200. package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
  201. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  202. package/dist/modes/interactive/components/login-dialog.js +3 -40
  203. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  204. package/dist/modes/interactive/components/model-selector.d.ts +2 -0
  205. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  206. package/dist/modes/interactive/components/model-selector.js +13 -2
  207. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  208. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  209. package/dist/modes/interactive/components/oauth-selector.js +2 -11
  210. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  211. package/dist/modes/interactive/feature-hints.d.ts.map +1 -1
  212. package/dist/modes/interactive/feature-hints.js +0 -4
  213. package/dist/modes/interactive/feature-hints.js.map +1 -1
  214. package/dist/modes/interactive/interactive-mode.d.ts +3 -12
  215. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  216. package/dist/modes/interactive/interactive-mode.js +81 -507
  217. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  218. package/dist/modes/interactive/onboarding.d.ts +0 -3
  219. package/dist/modes/interactive/onboarding.d.ts.map +1 -1
  220. package/dist/modes/interactive/onboarding.js +0 -17
  221. package/dist/modes/interactive/onboarding.js.map +1 -1
  222. package/dist/modes/rpc/rpc-client.d.ts +4 -1
  223. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  224. package/dist/modes/rpc/rpc-client.js +82 -42
  225. package/dist/modes/rpc/rpc-client.js.map +1 -1
  226. package/dist/node/amazon-bedrock.d.ts +2 -0
  227. package/dist/node/amazon-bedrock.d.ts.map +1 -0
  228. package/dist/node/amazon-bedrock.js +6 -0
  229. package/dist/node/amazon-bedrock.js.map +1 -0
  230. package/dist/product-identity.d.ts +0 -1
  231. package/dist/product-identity.d.ts.map +1 -1
  232. package/dist/product-identity.js +0 -1
  233. package/dist/product-identity.js.map +1 -1
  234. package/docs/development.md +1 -1
  235. package/docs/fork-philosophy.md +4 -8
  236. package/docs/installation.md +83 -62
  237. package/docs/providers.md +23 -25
  238. package/docs/quickstart.md +19 -10
  239. package/docs/rlm-runtime.md +13 -5
  240. package/docs/rpc.md +4 -4
  241. package/docs/sdk.md +20 -11
  242. package/docs/sessions.md +0 -1
  243. package/docs/settings.md +9 -42
  244. package/docs/skills.md +0 -1
  245. package/docs/upstream-0.9.5.md +171 -0
  246. package/docs/usage.md +14 -10
  247. package/package.json +4 -4
  248. package/dist/core/agent-traces.d.ts +0 -149
  249. package/dist/core/agent-traces.d.ts.map +0 -1
  250. package/dist/core/agent-traces.js +0 -904
  251. package/dist/core/agent-traces.js.map +0 -1
  252. package/dist/core/prime-inference-auth.d.ts +0 -70
  253. package/dist/core/prime-inference-auth.d.ts.map +0 -1
  254. package/dist/core/prime-inference-auth.js +0 -352
  255. package/dist/core/prime-inference-auth.js.map +0 -1
  256. package/dist/core/prime-inference-model-selection.d.ts +0 -16
  257. package/dist/core/prime-inference-model-selection.d.ts.map +0 -1
  258. package/dist/core/prime-inference-model-selection.js +0 -16
  259. package/dist/core/prime-inference-model-selection.js.map +0 -1
  260. package/dist/core/prime-inference-models.d.ts +0 -6
  261. package/dist/core/prime-inference-models.d.ts.map +0 -1
  262. package/dist/core/prime-inference-models.js +0 -62
  263. package/dist/core/prime-inference-models.js.map +0 -1
  264. package/dist/core/telemetry.d.ts +0 -95
  265. package/dist/core/telemetry.d.ts.map +0 -1
  266. package/dist/core/telemetry.js +0 -637
  267. package/dist/core/telemetry.js.map +0 -1
  268. package/dist/modes/interactive/components/prime-onboarding-splash.d.ts +0 -39
  269. package/dist/modes/interactive/components/prime-onboarding-splash.d.ts.map +0 -1
  270. package/dist/modes/interactive/components/prime-onboarding-splash.js +0 -286
  271. package/dist/modes/interactive/components/prime-onboarding-splash.js.map +0 -1
  272. package/dist/modes/interactive/components/prime-team-selector.d.ts +0 -30
  273. package/dist/modes/interactive/components/prime-team-selector.d.ts.map +0 -1
  274. package/dist/modes/interactive/components/prime-team-selector.js +0 -166
  275. package/dist/modes/interactive/components/prime-team-selector.js.map +0 -1
  276. package/dist/skills/prime-intellect/SKILL.md +0 -87
  277. package/dist/skills/prime-intellect/references/compute.md +0 -45
  278. package/dist/skills/prime-intellect/references/environments.md +0 -73
  279. package/dist/skills/prime-intellect/references/inference.md +0 -47
  280. package/dist/skills/prime-intellect/references/sandboxes.md +0 -75
  281. package/skills/prime-intellect/SKILL.md +0 -87
  282. package/skills/prime-intellect/references/compute.md +0 -45
  283. package/skills/prime-intellect/references/environments.md +0 -73
  284. package/skills/prime-intellect/references/inference.md +0 -47
  285. package/skills/prime-intellect/references/sandboxes.md +0 -75
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAGN,qBAAqB,GAErB,MAAM,kCAAkC,CAAC;AAc1C,OAAO,EAAE,yCAAyC,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAUtE,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,SAAS,qBAAqB,CAAC,KAAiB,EAAsB;IACrE,MAAM,MAAM,GAAG,KAA8C,CAAC;IAC9D,IACC,MAAM,CAAC,IAAI,KAAK,iBAAiB;QACjC,MAAM,CAAC,aAAa,KAAK,iBAAiB;QAC1C,MAAM,CAAC,KAAK,KAAK,mBAAmB;QAEpC,OAAO,MAAM,CAAC,KAAK,CAAC;IACrB,OAAO,SAAS,CAAC;AAAA,CACjB;A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A8E;QAC9E,mFAAmF;QACnF,MAAM,eAAe,GAAG,QAAkE,CAAC;QAC3F,OAAO,eAAe,CAAC,IAAS,CAAC;IAAA,CACjC;CACD","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 {\n\ttype AgentEvent,\n\ttype AgentMessage,\n\tAgentOutputLimitError,\n\ttype ThinkingLevel,\n} from \"@ponythewhite/base-context-agent\";\nimport type { ImageContent } from \"@ponythewhite/base-context-ai\";\nimport type { AgentSessionMessageReceipt, AgentSessionMessageSafetyStatus } from \"../../core/agent-messages.js\";\nimport type { BashResult } from \"../../core/bash-executor.js\";\nimport type { CompactionResult } from \"../../core/compaction/index.js\";\nimport type {\n\tAgentCronJob,\n\tAgentHeartbeatDeliveryMode,\n\tAgentHeartbeatManagementAction,\n\tAgentHeartbeatUpdateAction,\n} from \"../../core/cron-jobs.js\";\nimport type { RefinementResult } from \"../../core/refinement/index.js\";\nimport type { SessionStats } from \"../../core/session-stats.js\";\nimport type { AgentConnectionHeartbeat } from \"../agent-connection/types.js\";\nimport { CANONICAL_SESSION_OWNERSHIP_COMPATIBILITY, DAEMON_PROTOCOL_VERSION } from \"../daemon/daemon-protocol.js\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.js\";\nimport type {\n\tRpcCommand,\n\tRpcObservedSessionEvent,\n\tRpcPromptCompletionError,\n\tRpcResponse,\n\tRpcSessionState,\n\tRpcSlashCommand,\n} from \"./rpc-types.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nfunction promptCompletionError(event: AgentEvent): string | undefined {\n\tconst output = event as AgentEvent | RpcPromptCompletionError;\n\tif (\n\t\toutput.type === \"extension_error\" &&\n\t\toutput.extensionPath === \"<session-input>\" &&\n\t\toutput.event === \"prompt_completion\"\n\t)\n\t\treturn output.error;\n\treturn undefined;\n}\n\n/** Extended response timeout for refine requests, which run an LLM pass. */\nexport const REFINE_REQUEST_TIMEOUT_MS = 10 * 60 * 1000;\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/** 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: AgentEvent) => void;\nexport type RpcObservedSessionListener = (event: RpcObservedSessionEvent) => 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 observedSessionListeners: RpcObservedSessionListener[] = [];\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\n\tconstructor(private options: RpcClientOptions = {}) {}\n\n\t/**\n\t * Start the RPC agent process.\n\t */\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\", \"--rpc-protocol-version\", String(DAEMON_PROTOCOL_VERSION)];\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.args) {\n\t\t\targs.push(...this.options.args);\n\t\t}\n\n\t\tthis.process = 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\n\t\t// Collect stderr for debugging\n\t\tthis.process.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(this.process.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\ttry {\n\t\t\tconst state = await this.getState();\n\t\t\tif (state.protocolVersion !== DAEMON_PROTOCOL_VERSION)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible RPC protocol: expected ${DAEMON_PROTOCOL_VERSION}, got ${state.protocolVersion ?? \"unversioned\"}`,\n\t\t\t\t);\n\t\t\tconst minimumSchema = CANONICAL_SESSION_OWNERSHIP_COMPATIBILITY.minSchemaRevision;\n\t\t\tif (!Number.isSafeInteger(state.schemaRevision) || (state.schemaRevision ?? 0) < minimumSchema)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible RPC schema: expected at least ${minimumSchema}, got ${state.schemaRevision ?? \"unversioned\"}`,\n\t\t\t\t);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.stop();\n\t\t\t} catch (cleanupError) {\n\t\t\t\tthrow new AggregateError([error, cleanupError], \"RPC startup and cleanup failed\", { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Stop the RPC agent process.\n\t */\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/**\n\t * Subscribe to agent events.\n\t */\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\tonObservedSessionEvent(listener: RpcObservedSessionListener): () => void {\n\t\tthis.observedSessionListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.observedSessionListeners.indexOf(listener);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.observedSessionListeners.splice(index, 1);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Get collected stderr output (useful for debugging).\n\t */\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/**\n\t * Queue a steering message to interrupt the agent mid-run.\n\t */\n\tasync steer(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"steer\", message, images });\n\t}\n\n\t/**\n\t * Queue a follow-up message to be processed after the agent finishes.\n\t */\n\tasync followUp(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"follow_up\", message, images });\n\t}\n\n\t/**\n\t * Abort current operation.\n\t */\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/**\n\t * Get current session state.\n\t */\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/**\n\t * Set model by provider and ID.\n\t */\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/**\n\t * Cycle to next model.\n\t */\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/**\n\t * Get list of available models.\n\t */\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/**\n\t * Set thinking level.\n\t */\n\tasync setThinkingLevel(level: ThinkingLevel): Promise<void> {\n\t\tawait this.send({ type: \"set_thinking_level\", level });\n\t}\n\n\t/**\n\t * Cycle thinking level.\n\t */\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 steering mode.\n\t */\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/**\n\t * Set follow-up mode.\n\t */\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/**\n\t * Compact session context.\n\t */\n\tasync compact(customInstructions?: string): Promise<CompactionResult> {\n\t\tconst response = await this.send({ type: \"compact\", customInstructions });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Refine editable continual harness state.\n\t */\n\tasync refine(\n\t\toptions: { instructions?: string; rollbackId?: string; global?: boolean } = {},\n\t): Promise<RefinementResult> {\n\t\t// Refinement runs an LLM pass that routinely exceeds the default 30s response\n\t\t// timeout, so use the same extended window as the daemon refine path.\n\t\tconst command = { type: \"refine\", instructions: options.instructions, rollbackId: options.rollbackId } as {\n\t\t\ttype: \"refine\";\n\t\t\tinstructions?: string;\n\t\t\trollbackId?: string;\n\t\t\tglobal?: boolean;\n\t\t};\n\t\tif (options.global !== undefined) {\n\t\t\tcommand.global = options.global;\n\t\t}\n\t\tconst response = await this.send(command, REFINE_REQUEST_TIMEOUT_MS);\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set auto-compaction enabled/disabled.\n\t */\n\tasync setAutoCompaction(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_compaction\", enabled });\n\t}\n\n\t/**\n\t * Set auto-retry enabled/disabled.\n\t */\n\tasync setAutoRetry(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_retry\", enabled });\n\t}\n\n\t/**\n\t * Abort in-progress retry.\n\t */\n\tasync abortRetry(): Promise<void> {\n\t\tawait this.send({ type: \"abort_retry\" });\n\t}\n\n\t/**\n\t * Execute a bash command.\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\n\t/**\n\t * Abort running bash command.\n\t */\n\tasync abortBash(): Promise<void> {\n\t\tawait this.send({ type: \"abort_bash\" });\n\t}\n\n\t/**\n\t * Get session statistics.\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\n\t/**\n\t * Export session to HTML.\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\n\t/**\n\t * Switch to a different session file.\n\t * @returns Object with `cancelled: true` if an extension cancelled the switch\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\n\t/**\n\t * Fork from a specific message.\n\t * @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)\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\n\t/**\n\t * Clone the current active branch into a new session.\n\t * @returns Object with `cancelled: true` if an extension cancelled the clone\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\n\t/**\n\t * Get messages available for forking.\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/**\n\t * Get text of last assistant message.\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\n\t/**\n\t * Set the session display name.\n\t */\n\tasync setSessionName(name: string): Promise<void> {\n\t\tawait this.send({ type: \"set_session_name\", name });\n\t}\n\n\t/**\n\t * Get all messages in the session.\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\n\tasync sendAgentMessage(targetActiveSessionId: string, message: string): Promise<AgentSessionMessageReceipt> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"send_message\",\n\t\t\ttargetActiveSessionId,\n\t\t\tmessage,\n\t\t});\n\t\treturn this.getData(response);\n\t}\n\n\tasync getAgentMessageStatus(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_status\" }));\n\t}\n\n\tasync pauseAgentMessages(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_pause\" }));\n\t}\n\n\tasync resumeAgentMessages(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_resume\" }));\n\t}\n\n\tasync clearAgentMessages(): Promise<number> {\n\t\tconst response = await this.send({ type: \"agent_messages_clear\" });\n\t\treturn this.getData<{ cleared: number }>(response).cleared;\n\t}\n\n\tasync listSchedules(includeInactive?: boolean): Promise<AgentCronJob[]> {\n\t\tconst response = await this.send({ type: \"list_schedules\", includeInactive });\n\t\treturn this.getData<{ jobs: AgentCronJob[] }>(response).jobs;\n\t}\n\n\tasync addSchedule(schedule: string, prompt: string): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"add_schedule\", schedule, prompt });\n\t\treturn this.getData<{ job: AgentCronJob }>(response).job;\n\t}\n\n\tasync cancelSchedule(jobId: string): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"cancel_schedule\", jobId });\n\t\treturn this.getData<{ job: AgentCronJob }>(response).job;\n\t}\n\n\tasync listHeartbeats(): Promise<AgentConnectionHeartbeat[]> {\n\t\tconst response = await this.send({ type: \"list_heartbeats\" });\n\t\treturn this.getData<{ heartbeats: AgentConnectionHeartbeat[] }>(response).heartbeats;\n\t}\n\n\tasync getHeartbeat(): Promise<AgentCronJob | null> {\n\t\tconst response = await this.send({ type: \"get_heartbeat\" });\n\t\treturn this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t}\n\n\tasync setHeartbeat(\n\t\tschedule: string,\n\t\tprompt: string,\n\t\tdeliveryMode?: AgentHeartbeatDeliveryMode,\n\t): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"set_heartbeat\", schedule, prompt, deliveryMode });\n\t\tconst heartbeat = this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t\tif (!heartbeat) {\n\t\t\tthrow new Error(\"Daemon did not return the created heartbeat\");\n\t\t}\n\t\treturn heartbeat;\n\t}\n\n\tasync updateHeartbeat(action: AgentHeartbeatUpdateAction): Promise<AgentCronJob | null> {\n\t\tconst response = await this.send({ type: \"update_heartbeat\", action });\n\t\treturn this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t}\n\n\tasync manageHeartbeat(\n\t\tactiveSessionId: string,\n\t\tjobId: string,\n\t\taction: AgentHeartbeatManagementAction,\n\t): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"manage_heartbeat\", activeSessionId, jobId, action });\n\t\tconst heartbeat = this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t\tif (!heartbeat) {\n\t\t\tthrow new Error(\"Daemon did not return the managed heartbeat\");\n\t\t}\n\t\treturn heartbeat;\n\t}\n\n\tasync observe(activeSessionId: string): Promise<AgentMessage[]> {\n\t\tconst response = await this.send({ type: \"observe\", activeSessionId });\n\t\treturn this.getData<{ messages: AgentMessage[] }>(response).messages;\n\t}\n\n\tasync unobserve(activeSessionId: string): Promise<void> {\n\t\tawait this.send({ type: \"unobserve\", activeSessionId });\n\t}\n\n\t/**\n\t * Get available commands (extension commands, prompt templates, skills).\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\n\t// =========================================================================\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Wait for agent to become idle (no streaming).\n\t * Resolves when agent_end event is received.\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\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tconst error = promptCompletionError(event);\n\t\t\t\tif (error !== undefined) {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\treject(new Error(error));\n\t\t\t\t} else if (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\n\t/**\n\t * Collect events until agent becomes idle.\n\t */\n\tcollectEvents(timeout = 60000): Promise<AgentEvent[]> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst events: AgentEvent[] = [];\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\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tevents.push(event);\n\t\t\t\tconst error = promptCompletionError(event);\n\t\t\t\tif (error !== undefined) {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\treject(new Error(error));\n\t\t\t\t\treturn;\n\t\t\t\t}\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\n\t/**\n\t * Send prompt and wait for completion, returning all events.\n\t */\n\tasync promptAndWait(message: string, images?: ImageContent[], timeout = 60000): Promise<AgentEvent[]> {\n\t\tconst eventsPromise = this.collectEvents(timeout);\n\t\tawait this.prompt(message, images);\n\t\tconst events = await eventsPromise;\n\t\tconst terminal = events.find((event) => event.type === \"agent_end\");\n\t\tif (terminal?.type === \"agent_end\" && terminal.refusal) throw new AgentOutputLimitError(terminal.refusal);\n\t\treturn events;\n\t}\n\n\t// =========================================================================\n\t// Internal\n\t// =========================================================================\n\n\tprivate handleLine(line: string): void {\n\t\ttry {\n\t\t\tconst data = JSON.parse(line);\n\n\t\t\t// Check if it's a response to a pending request\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\tif (data.type === \"observed_session_event\" || data.type === \"observed_session_closed\") {\n\t\t\t\tfor (const listener of [...this.observedSessionListeners]) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlistener(data as RpcObservedSessionEvent);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Listener failures must not block other RPC subscribers.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise it's an event\n\t\t\tfor (const listener of [...this.eventListeners]) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(data as AgentEvent);\n\t\t\t\t} catch {\n\t\t\t\t\t// Listener failures must not block other RPC subscribers.\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore non-JSON lines\n\t\t}\n\t}\n\n\tprivate async send(command: RpcCommandBody, timeoutMs = 30000): Promise<RpcResponse> {\n\t\tif (!this.process?.stdin) {\n\t\t\tthrow new Error(\"Client not started\");\n\t\t}\n\n\t\tconst id = `req_${++this.requestId}`;\n\t\tconst fullCommand = { ...command, id } as RpcCommand;\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.pendingRequests.set(id, { resolve, reject });\n\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}, timeoutMs);\n\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\n\t\t\tthis.process!.stdin!.write(serializeJsonLine(fullCommand));\n\t\t});\n\t}\n\n\tprivate getData<T>(response: RpcResponse): T {\n\t\tif (!response.success) {\n\t\t\tconst errorResponse = response as Extract<RpcResponse, { success: false }>;\n\t\t\tthrow new Error(errorResponse.error);\n\t\t}\n\t\t// Type assertion: we trust response.data matches T based on the command sent.\n\t\t// This is safe because each public method specifies the correct T for its command.\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.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAGN,qBAAqB,GAErB,MAAM,kCAAkC,CAAC;AAc1C,OAAO,EAAE,yCAAyC,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAUtE,+EAA+E;AAC/E,QA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AAC,CAAC,CAAC;YAAA,CAC7F,EAAE,SAAS,CAAC,CAAC;YAEd,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,EAAE;gBAC5B,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACtB,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAAA,CAClB;gBACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;oBAClB,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,MAAM,CAAC,KAAK,CAAC,CAAC;gBAAA,CACd;aACD,CAAC,CAAC;YAEH,KAAK,CAAC,KAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;QAAA,CACnD,CAAC,CAAC;IAAA,CACH;IAEO,OAAO,CAAI,QAAqB,EAAK;QAC5C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,aAAa,GAAG,QAAoD,CAAC;YAC3E,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,8EAA8E;QAC9E,mFAAmF;QACnF,MAAM,eAAe,GAAG,QAAkE,CAAC;QAC3F,OAAO,eAAe,CAAC,IAAS,CAAC;IAAA,CACjC;CACD","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 {\n\ttype AgentEvent,\n\ttype AgentMessage,\n\tAgentOutputLimitError,\n\ttype ThinkingLevel,\n} from \"@ponythewhite/base-context-agent\";\nimport type { ImageContent } from \"@ponythewhite/base-context-ai\";\nimport type { AgentSessionMessageReceipt, AgentSessionMessageSafetyStatus } from \"../../core/agent-messages.js\";\nimport type { BashResult } from \"../../core/bash-executor.js\";\nimport type { CompactionResult } from \"../../core/compaction/index.js\";\nimport type {\n\tAgentCronJob,\n\tAgentHeartbeatDeliveryMode,\n\tAgentHeartbeatManagementAction,\n\tAgentHeartbeatUpdateAction,\n} from \"../../core/cron-jobs.js\";\nimport type { RefinementResult } from \"../../core/refinement/index.js\";\nimport type { SessionStats } from \"../../core/session-stats.js\";\nimport type { AgentConnectionHeartbeat } from \"../agent-connection/types.js\";\nimport { CANONICAL_SESSION_OWNERSHIP_COMPATIBILITY, DAEMON_PROTOCOL_VERSION } from \"../daemon/daemon-protocol.js\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.js\";\nimport type {\n\tRpcCommand,\n\tRpcObservedSessionEvent,\n\tRpcPromptCompletionError,\n\tRpcResponse,\n\tRpcSessionState,\n\tRpcSlashCommand,\n} from \"./rpc-types.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nfunction promptCompletionError(event: AgentEvent): string | undefined {\n\tconst output = event as AgentEvent | RpcPromptCompletionError;\n\tif (\n\t\toutput.type === \"extension_error\" &&\n\t\toutput.extensionPath === \"<session-input>\" &&\n\t\toutput.event === \"prompt_completion\"\n\t)\n\t\treturn output.error;\n\treturn undefined;\n}\n\n/** Extended response timeout for refine requests, which run an LLM pass. */\nexport const REFINE_REQUEST_TIMEOUT_MS = 10 * 60 * 1000;\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/** 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: AgentEvent) => void;\nexport type RpcObservedSessionListener = (event: RpcObservedSessionEvent) => 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 observedSessionListeners: RpcObservedSessionListener[] = [];\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\n\tconstructor(private options: RpcClientOptions = {}) {}\n\n\t/**\n\t * Start the RPC agent process.\n\t */\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\", \"--rpc-protocol-version\", String(DAEMON_PROTOCOL_VERSION)];\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.args) {\n\t\t\targs.push(...this.options.args);\n\t\t}\n\n\t\tconst child = 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 = child;\n\t\tthis.stderr = \"\";\n\n\t\t// Collect stderr for debugging\n\t\tchild.stderr?.on(\"data\", (data) => {\n\t\t\tif (this.process !== child) return;\n\t\t\tthis.stderr += data.toString();\n\t\t\tprocess.stderr.write(data);\n\t\t});\n\t\tchild.once(\"error\", (error) => {\n\t\t\tif (this.process === child) this.rejectPendingRequests(error);\n\t\t});\n\t\t// Drain final stdout/stderr before rejecting requests that received no response.\n\t\tchild.once(\"close\", () => {\n\t\t\tif (this.process === child) this.rejectPendingRequests(this.processExitError(child));\n\t\t});\n\n\t\t// Set up strict JSONL reader for stdout.\n\t\tthis.stopReadingStdout = attachJsonlLineReader(child.stdout!, (line) => {\n\t\t\tif (this.process === child) this.handleLine(line);\n\t\t});\n\n\t\ttry {\n\t\t\tconst state = await this.getState();\n\t\t\tif (state.protocolVersion !== DAEMON_PROTOCOL_VERSION)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible RPC protocol: expected ${DAEMON_PROTOCOL_VERSION}, got ${state.protocolVersion ?? \"unversioned\"}`,\n\t\t\t\t);\n\t\t\tconst minimumSchema = CANONICAL_SESSION_OWNERSHIP_COMPATIBILITY.minSchemaRevision;\n\t\t\tif (!Number.isSafeInteger(state.schemaRevision) || (state.schemaRevision ?? 0) < minimumSchema)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible RPC schema: expected at least ${minimumSchema}, got ${state.schemaRevision ?? \"unversioned\"}`,\n\t\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (this.process === child) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.stop();\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"RPC startup and cleanup failed\", { cause: error });\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Stop the RPC agent process.\n\t */\n\tasync stop(): Promise<void> {\n\t\tconst child = this.process;\n\t\tif (!child) return;\n\n\t\tthis.stopReadingStdout?.();\n\t\tthis.stopReadingStdout = null;\n\n\t\tif (child.exitCode === null && child.signalCode === null) {\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t\t\tresolve();\n\t\t\t\t}, 1000);\n\n\t\t\t\tchild.once(\"exit\", () => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tchild.kill(\"SIGTERM\");\n\t\t\t});\n\t\t}\n\n\t\tif (this.process === child) {\n\t\t\tthis.process = null;\n\t\t\tthis.rejectPendingRequests(new Error(\"RPC client stopped\"));\n\t\t}\n\t}\n\n\t/**\n\t * Subscribe to agent events.\n\t */\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\tonObservedSessionEvent(listener: RpcObservedSessionListener): () => void {\n\t\tthis.observedSessionListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.observedSessionListeners.indexOf(listener);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.observedSessionListeners.splice(index, 1);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Get collected stderr output (useful for debugging).\n\t */\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 * Resolves after admission succeeds; 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\tthis.getData(await this.send({ type: \"prompt\", message, images }));\n\t}\n\n\t/**\n\t * Queue a steering message to interrupt the agent mid-run.\n\t */\n\tasync steer(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"steer\", message, images });\n\t}\n\n\t/**\n\t * Queue a follow-up message to be processed after the agent finishes.\n\t */\n\tasync followUp(message: string, images?: ImageContent[]): Promise<void> {\n\t\tawait this.send({ type: \"follow_up\", message, images });\n\t}\n\n\t/**\n\t * Abort current operation.\n\t */\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/**\n\t * Get current session state.\n\t */\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/**\n\t * Set model by provider and ID.\n\t */\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/**\n\t * Cycle to next model.\n\t */\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/**\n\t * Get list of available models.\n\t */\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/**\n\t * Set thinking level.\n\t */\n\tasync setThinkingLevel(level: ThinkingLevel): Promise<void> {\n\t\tawait this.send({ type: \"set_thinking_level\", level });\n\t}\n\n\t/**\n\t * Cycle thinking level.\n\t */\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 steering mode.\n\t */\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/**\n\t * Set follow-up mode.\n\t */\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/**\n\t * Compact session context.\n\t */\n\tasync compact(customInstructions?: string): Promise<CompactionResult> {\n\t\tconst response = await this.send({ type: \"compact\", customInstructions });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Refine editable continual harness state.\n\t */\n\tasync refine(\n\t\toptions: { instructions?: string; rollbackId?: string; global?: boolean } = {},\n\t): Promise<RefinementResult> {\n\t\t// Refinement runs an LLM pass that routinely exceeds the default 30s response\n\t\t// timeout, so use the same extended window as the daemon refine path.\n\t\tconst command = { type: \"refine\", instructions: options.instructions, rollbackId: options.rollbackId } as {\n\t\t\ttype: \"refine\";\n\t\t\tinstructions?: string;\n\t\t\trollbackId?: string;\n\t\t\tglobal?: boolean;\n\t\t};\n\t\tif (options.global !== undefined) {\n\t\t\tcommand.global = options.global;\n\t\t}\n\t\tconst response = await this.send(command, REFINE_REQUEST_TIMEOUT_MS);\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set auto-compaction enabled/disabled.\n\t */\n\tasync setAutoCompaction(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_compaction\", enabled });\n\t}\n\n\t/**\n\t * Set auto-retry enabled/disabled.\n\t */\n\tasync setAutoRetry(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_retry\", enabled });\n\t}\n\n\t/**\n\t * Abort in-progress retry.\n\t */\n\tasync abortRetry(): Promise<void> {\n\t\tawait this.send({ type: \"abort_retry\" });\n\t}\n\n\t/**\n\t * Execute a bash command.\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\n\t/**\n\t * Abort running bash command.\n\t */\n\tasync abortBash(): Promise<void> {\n\t\tawait this.send({ type: \"abort_bash\" });\n\t}\n\n\t/**\n\t * Get session statistics.\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\n\t/**\n\t * Export session to HTML.\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\n\t/**\n\t * Switch to a different session file.\n\t * @returns Object with `cancelled: true` if an extension cancelled the switch\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\n\t/**\n\t * Fork from a specific message.\n\t * @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)\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\n\t/**\n\t * Clone the current active branch into a new session.\n\t * @returns Object with `cancelled: true` if an extension cancelled the clone\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\n\t/**\n\t * Get messages available for forking.\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/**\n\t * Get text of last assistant message.\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\n\t/**\n\t * Set the session display name.\n\t */\n\tasync setSessionName(name: string): Promise<void> {\n\t\tawait this.send({ type: \"set_session_name\", name });\n\t}\n\n\t/**\n\t * Get all messages in the session.\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\n\tasync sendAgentMessage(targetActiveSessionId: string, message: string): Promise<AgentSessionMessageReceipt> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"send_message\",\n\t\t\ttargetActiveSessionId,\n\t\t\tmessage,\n\t\t});\n\t\treturn this.getData(response);\n\t}\n\n\tasync getAgentMessageStatus(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_status\" }));\n\t}\n\n\tasync pauseAgentMessages(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_pause\" }));\n\t}\n\n\tasync resumeAgentMessages(): Promise<AgentSessionMessageSafetyStatus> {\n\t\treturn this.getData(await this.send({ type: \"agent_messages_resume\" }));\n\t}\n\n\tasync clearAgentMessages(): Promise<number> {\n\t\tconst response = await this.send({ type: \"agent_messages_clear\" });\n\t\treturn this.getData<{ cleared: number }>(response).cleared;\n\t}\n\n\tasync listSchedules(includeInactive?: boolean): Promise<AgentCronJob[]> {\n\t\tconst response = await this.send({ type: \"list_schedules\", includeInactive });\n\t\treturn this.getData<{ jobs: AgentCronJob[] }>(response).jobs;\n\t}\n\n\tasync addSchedule(schedule: string, prompt: string): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"add_schedule\", schedule, prompt });\n\t\treturn this.getData<{ job: AgentCronJob }>(response).job;\n\t}\n\n\tasync cancelSchedule(jobId: string): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"cancel_schedule\", jobId });\n\t\treturn this.getData<{ job: AgentCronJob }>(response).job;\n\t}\n\n\tasync listHeartbeats(): Promise<AgentConnectionHeartbeat[]> {\n\t\tconst response = await this.send({ type: \"list_heartbeats\" });\n\t\treturn this.getData<{ heartbeats: AgentConnectionHeartbeat[] }>(response).heartbeats;\n\t}\n\n\tasync getHeartbeat(): Promise<AgentCronJob | null> {\n\t\tconst response = await this.send({ type: \"get_heartbeat\" });\n\t\treturn this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t}\n\n\tasync setHeartbeat(\n\t\tschedule: string,\n\t\tprompt: string,\n\t\tdeliveryMode?: AgentHeartbeatDeliveryMode,\n\t): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"set_heartbeat\", schedule, prompt, deliveryMode });\n\t\tconst heartbeat = this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t\tif (!heartbeat) {\n\t\t\tthrow new Error(\"Daemon did not return the created heartbeat\");\n\t\t}\n\t\treturn heartbeat;\n\t}\n\n\tasync updateHeartbeat(action: AgentHeartbeatUpdateAction): Promise<AgentCronJob | null> {\n\t\tconst response = await this.send({ type: \"update_heartbeat\", action });\n\t\treturn this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t}\n\n\tasync manageHeartbeat(\n\t\tactiveSessionId: string,\n\t\tjobId: string,\n\t\taction: AgentHeartbeatManagementAction,\n\t): Promise<AgentCronJob> {\n\t\tconst response = await this.send({ type: \"manage_heartbeat\", activeSessionId, jobId, action });\n\t\tconst heartbeat = this.getData<{ heartbeat: AgentCronJob | null }>(response).heartbeat;\n\t\tif (!heartbeat) {\n\t\t\tthrow new Error(\"Daemon did not return the managed heartbeat\");\n\t\t}\n\t\treturn heartbeat;\n\t}\n\n\tasync observe(activeSessionId: string): Promise<AgentMessage[]> {\n\t\tconst response = await this.send({ type: \"observe\", activeSessionId });\n\t\treturn this.getData<{ messages: AgentMessage[] }>(response).messages;\n\t}\n\n\tasync unobserve(activeSessionId: string): Promise<void> {\n\t\tawait this.send({ type: \"unobserve\", activeSessionId });\n\t}\n\n\t/**\n\t * Get available commands (extension commands, prompt templates, skills).\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\n\t// =========================================================================\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Wait for agent to become idle (no streaming).\n\t * Resolves when agent_end event is received.\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\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tconst error = promptCompletionError(event);\n\t\t\t\tif (error !== undefined) {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\treject(new Error(error));\n\t\t\t\t} else if (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\n\t/**\n\t * Collect events until agent becomes idle.\n\t */\n\tcollectEvents(timeout = 60000): Promise<AgentEvent[]> {\n\t\treturn this.createEventCollection(timeout).result;\n\t}\n\n\tprivate createEventCollection(timeout: number): { result: Promise<AgentEvent[]>; cancel: () => void } {\n\t\tlet cancel = () => {};\n\t\tconst result = new Promise<AgentEvent[]>((resolve, reject) => {\n\t\t\tconst events: AgentEvent[] = [];\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tcancel();\n\t\t\t\treject(new Error(`Timeout collecting events. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tevents.push(event);\n\t\t\t\tconst error = promptCompletionError(event);\n\t\t\t\tif (error !== undefined) {\n\t\t\t\t\tcancel();\n\t\t\t\t\treject(new Error(error));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (event.type === \"agent_end\") {\n\t\t\t\t\tcancel();\n\t\t\t\t\tresolve(events);\n\t\t\t\t}\n\t\t\t});\n\t\t\tcancel = () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tunsubscribe();\n\t\t\t\tcancel = () => {};\n\t\t\t};\n\t\t});\n\t\treturn { result, cancel: () => cancel() };\n\t}\n\n\t/**\n\t * Send prompt and wait for completion, returning all events.\n\t */\n\tasync promptAndWait(message: string, images?: ImageContent[], timeout = 60000): Promise<AgentEvent[]> {\n\t\tconst collection = this.createEventCollection(timeout);\n\t\tlet events: AgentEvent[];\n\t\ttry {\n\t\t\t[, events] = await Promise.all([this.prompt(message, images), collection.result]);\n\t\t} finally {\n\t\t\tcollection.cancel();\n\t\t}\n\t\tconst terminal = events.find((event) => event.type === \"agent_end\");\n\t\tif (terminal?.type === \"agent_end\" && terminal.refusal) throw new AgentOutputLimitError(terminal.refusal);\n\t\treturn events;\n\t}\n\n\t// =========================================================================\n\t// Internal\n\t// =========================================================================\n\n\tprivate processExitError(child: ChildProcess): Error {\n\t\tconst reason = child.signalCode ? `signal ${child.signalCode}` : `code ${child.exitCode}`;\n\t\treturn new Error(`Agent process exited with ${reason}. Stderr: ${this.stderr}`);\n\t}\n\n\tprivate rejectPendingRequests(error: Error): void {\n\t\tfor (const pending of this.pendingRequests.values()) pending.reject(error);\n\t\tthis.pendingRequests.clear();\n\t}\n\n\tprivate handleLine(line: string): void {\n\t\ttry {\n\t\t\tconst data = JSON.parse(line);\n\n\t\t\t// Check if it's a response to a pending request\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\tif (data.type === \"observed_session_event\" || data.type === \"observed_session_closed\") {\n\t\t\t\tfor (const listener of [...this.observedSessionListeners]) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlistener(data as RpcObservedSessionEvent);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Listener failures must not block other RPC subscribers.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise it's an event\n\t\t\tfor (const listener of [...this.eventListeners]) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(data as AgentEvent);\n\t\t\t\t} catch {\n\t\t\t\t\t// Listener failures must not block other RPC subscribers.\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore non-JSON lines\n\t\t}\n\t}\n\n\tprivate async send(command: RpcCommandBody, timeoutMs = 30000): Promise<RpcResponse> {\n\t\tconst child = this.process;\n\t\tif (!child?.stdin) {\n\t\t\tthrow new Error(\"Client not started\");\n\t\t}\n\t\tif (child.exitCode !== null || child.signalCode !== null) {\n\t\t\tthrow this.processExitError(child);\n\t\t}\n\n\t\tconst id = `req_${++this.requestId}`;\n\t\tconst fullCommand = { ...command, id } as RpcCommand;\n\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}, timeoutMs);\n\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\n\t\t\tchild.stdin!.write(serializeJsonLine(fullCommand));\n\t\t});\n\t}\n\n\tprivate getData<T>(response: RpcResponse): T {\n\t\tif (!response.success) {\n\t\t\tconst errorResponse = response as Extract<RpcResponse, { success: false }>;\n\t\t\tthrow new Error(errorResponse.error);\n\t\t}\n\t\t// Type assertion: we trust response.data matches T based on the command sent.\n\t\t// This is safe because each public method specifies the correct T for its command.\n\t\tconst successResponse = response as Extract<RpcResponse, { success: true; data: unknown }>;\n\t\treturn successResponse.data as T;\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const streamBedrock: import("@ponythewhite/base-context-ai").StreamFunction<"bedrock-converse-stream", import("@ponythewhite/base-context-ai").BedrockOptions>, streamSimpleBedrock: import("@ponythewhite/base-context-ai").StreamFunction<"bedrock-converse-stream", import("@ponythewhite/base-context-ai").SimpleStreamOptions>;
2
+ //# sourceMappingURL=amazon-bedrock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amazon-bedrock.d.ts","sourceRoot":"","sources":["../../src/node/amazon-bedrock.ts"],"names":[],"mappings":"AAMA,eAAO,MAAQ,aAAa,6IAAE,mBAAmB,gJAA0B,CAAC","sourcesContent":["import { bedrockProviderModule, setLogSink } from \"@ponythewhite/base-context-ai/bedrock-provider\";\nimport { writeFileLogEntry } from \"../core/logging.js\";\n\n// The external provider has its own logger instance; keep the CLI's sink and context.\nsetLogSink(writeFileLogEntry);\n\nexport const { streamBedrock, streamSimpleBedrock } = bedrockProviderModule;\n"]}
@@ -0,0 +1,6 @@
1
+ import { bedrockProviderModule, setLogSink } from "@ponythewhite/base-context-ai/bedrock-provider";
2
+ import { writeFileLogEntry } from "../core/logging.js";
3
+ // The external provider has its own logger instance; keep the CLI's sink and context.
4
+ setLogSink(writeFileLogEntry);
5
+ export const { streamBedrock, streamSimpleBedrock } = bedrockProviderModule;
6
+ //# sourceMappingURL=amazon-bedrock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amazon-bedrock.js","sourceRoot":"","sources":["../../src/node/amazon-bedrock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,sFAAsF;AACtF,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,qBAAqB,CAAC","sourcesContent":["import { bedrockProviderModule, setLogSink } from \"@ponythewhite/base-context-ai/bedrock-provider\";\nimport { writeFileLogEntry } from \"../core/logging.js\";\n\n// The external provider has its own logger instance; keep the CLI's sink and context.\nsetLogSink(writeFileLogEntry);\n\nexport const { streamBedrock, streamSimpleBedrock } = bedrockProviderModule;\n"]}
@@ -23,7 +23,6 @@ export declare const PRODUCT_ENV: Readonly<{
23
23
  home: "BASE_CONTEXT_HOME";
24
24
  sessions: "BASE_CONTEXT_SESSION_DIR";
25
25
  packageDirectory: "BASE_CONTEXT_PACKAGE_DIR";
26
- shareViewer: "BASE_CONTEXT_SHARE_VIEWER_URL";
27
26
  interactiveSelfUpdate: "BASE_CONTEXT_INTERACTIVE_SELF_UPDATE";
28
27
  kernelPython: "BASE_CONTEXT_KERNEL_PYTHON";
29
28
  kernelVenv: "BASE_CONTEXT_KERNEL_VENV";
@@ -1 +1 @@
1
- {"version":3,"file":"product-identity.d.ts","sourceRoot":"","sources":["../src/product-identity.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO;;;;;;;;;EASiB,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;;;;;;EAStB,CAAC","sourcesContent":["/** Product-owned identity. Provider and model wire identifiers are deliberately separate. */\nexport interface ProductIdentity {\n\treadonly name: string;\n\treadonly command: string;\n\treadonly packageName: string;\n\treadonly configDirectory: string;\n\treadonly environmentPrefix: string;\n\treadonly daemonService: string;\n\treadonly runtimeDistribution: string;\n\treadonly repository: string;\n}\n\nexport const PRODUCT = Object.freeze({\n\tname: \"Base Context\",\n\tcommand: \"base-context\",\n\tpackageName: \"@ponythewhite/base-context\",\n\tconfigDirectory: \".base-context\",\n\tenvironmentPrefix: \"BASE_CONTEXT\",\n\tdaemonService: \"base-context.daemon\",\n\truntimeDistribution: \"base-context-runtime\",\n\trepository: \"https://github.com/BaseModelAI/base-context\",\n} as const satisfies ProductIdentity);\n\nexport const PRODUCT_ENV = Object.freeze({\n\thome: \"BASE_CONTEXT_HOME\",\n\tsessions: \"BASE_CONTEXT_SESSION_DIR\",\n\tpackageDirectory: \"BASE_CONTEXT_PACKAGE_DIR\",\n\tshareViewer: \"BASE_CONTEXT_SHARE_VIEWER_URL\",\n\tinteractiveSelfUpdate: \"BASE_CONTEXT_INTERACTIVE_SELF_UPDATE\",\n\tkernelPython: \"BASE_CONTEXT_KERNEL_PYTHON\",\n\tkernelVenv: \"BASE_CONTEXT_KERNEL_VENV\",\n\tinstallUv: \"BASE_CONTEXT_INSTALL_UV\",\n});\n"]}
1
+ {"version":3,"file":"product-identity.d.ts","sourceRoot":"","sources":["../src/product-identity.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO;;;;;;;;;EASiB,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;;;;;EAQtB,CAAC","sourcesContent":["/** Product-owned identity. Provider and model wire identifiers are deliberately separate. */\nexport interface ProductIdentity {\n\treadonly name: string;\n\treadonly command: string;\n\treadonly packageName: string;\n\treadonly configDirectory: string;\n\treadonly environmentPrefix: string;\n\treadonly daemonService: string;\n\treadonly runtimeDistribution: string;\n\treadonly repository: string;\n}\n\nexport const PRODUCT = Object.freeze({\n\tname: \"Base Context\",\n\tcommand: \"base-context\",\n\tpackageName: \"@ponythewhite/base-context\",\n\tconfigDirectory: \".base-context\",\n\tenvironmentPrefix: \"BASE_CONTEXT\",\n\tdaemonService: \"base-context.daemon\",\n\truntimeDistribution: \"base-context-runtime\",\n\trepository: \"https://github.com/BaseModelAI/base-context\",\n} as const satisfies ProductIdentity);\n\nexport const PRODUCT_ENV = Object.freeze({\n\thome: \"BASE_CONTEXT_HOME\",\n\tsessions: \"BASE_CONTEXT_SESSION_DIR\",\n\tpackageDirectory: \"BASE_CONTEXT_PACKAGE_DIR\",\n\tinteractiveSelfUpdate: \"BASE_CONTEXT_INTERACTIVE_SELF_UPDATE\",\n\tkernelPython: \"BASE_CONTEXT_KERNEL_PYTHON\",\n\tkernelVenv: \"BASE_CONTEXT_KERNEL_VENV\",\n\tinstallUv: \"BASE_CONTEXT_INSTALL_UV\",\n});\n"]}
@@ -12,7 +12,6 @@ export const PRODUCT_ENV = Object.freeze({
12
12
  home: "BASE_CONTEXT_HOME",
13
13
  sessions: "BASE_CONTEXT_SESSION_DIR",
14
14
  packageDirectory: "BASE_CONTEXT_PACKAGE_DIR",
15
- shareViewer: "BASE_CONTEXT_SHARE_VIEWER_URL",
16
15
  interactiveSelfUpdate: "BASE_CONTEXT_INTERACTIVE_SELF_UPDATE",
17
16
  kernelPython: "BASE_CONTEXT_KERNEL_PYTHON",
18
17
  kernelVenv: "BASE_CONTEXT_KERNEL_VENV",
@@ -1 +1 @@
1
- {"version":3,"file":"product-identity.js","sourceRoot":"","sources":["../src/product-identity.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,4BAA4B;IACzC,eAAe,EAAE,eAAe;IAChC,iBAAiB,EAAE,cAAc;IACjC,aAAa,EAAE,qBAAqB;IACpC,mBAAmB,EAAE,sBAAsB;IAC3C,UAAU,EAAE,6CAA6C;CACtB,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,0BAA0B;IACpC,gBAAgB,EAAE,0BAA0B;IAC5C,WAAW,EAAE,+BAA+B;IAC5C,qBAAqB,EAAE,sCAAsC;IAC7D,YAAY,EAAE,4BAA4B;IAC1C,UAAU,EAAE,0BAA0B;IACtC,SAAS,EAAE,yBAAyB;CACpC,CAAC,CAAC","sourcesContent":["/** Product-owned identity. Provider and model wire identifiers are deliberately separate. */\nexport interface ProductIdentity {\n\treadonly name: string;\n\treadonly command: string;\n\treadonly packageName: string;\n\treadonly configDirectory: string;\n\treadonly environmentPrefix: string;\n\treadonly daemonService: string;\n\treadonly runtimeDistribution: string;\n\treadonly repository: string;\n}\n\nexport const PRODUCT = Object.freeze({\n\tname: \"Base Context\",\n\tcommand: \"base-context\",\n\tpackageName: \"@ponythewhite/base-context\",\n\tconfigDirectory: \".base-context\",\n\tenvironmentPrefix: \"BASE_CONTEXT\",\n\tdaemonService: \"base-context.daemon\",\n\truntimeDistribution: \"base-context-runtime\",\n\trepository: \"https://github.com/BaseModelAI/base-context\",\n} as const satisfies ProductIdentity);\n\nexport const PRODUCT_ENV = Object.freeze({\n\thome: \"BASE_CONTEXT_HOME\",\n\tsessions: \"BASE_CONTEXT_SESSION_DIR\",\n\tpackageDirectory: \"BASE_CONTEXT_PACKAGE_DIR\",\n\tshareViewer: \"BASE_CONTEXT_SHARE_VIEWER_URL\",\n\tinteractiveSelfUpdate: \"BASE_CONTEXT_INTERACTIVE_SELF_UPDATE\",\n\tkernelPython: \"BASE_CONTEXT_KERNEL_PYTHON\",\n\tkernelVenv: \"BASE_CONTEXT_KERNEL_VENV\",\n\tinstallUv: \"BASE_CONTEXT_INSTALL_UV\",\n});\n"]}
1
+ {"version":3,"file":"product-identity.js","sourceRoot":"","sources":["../src/product-identity.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,4BAA4B;IACzC,eAAe,EAAE,eAAe;IAChC,iBAAiB,EAAE,cAAc;IACjC,aAAa,EAAE,qBAAqB;IACpC,mBAAmB,EAAE,sBAAsB;IAC3C,UAAU,EAAE,6CAA6C;CACtB,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,0BAA0B;IACpC,gBAAgB,EAAE,0BAA0B;IAC5C,qBAAqB,EAAE,sCAAsC;IAC7D,YAAY,EAAE,4BAA4B;IAC1C,UAAU,EAAE,0BAA0B;IACtC,SAAS,EAAE,yBAAyB;CACpC,CAAC,CAAC","sourcesContent":["/** Product-owned identity. Provider and model wire identifiers are deliberately separate. */\nexport interface ProductIdentity {\n\treadonly name: string;\n\treadonly command: string;\n\treadonly packageName: string;\n\treadonly configDirectory: string;\n\treadonly environmentPrefix: string;\n\treadonly daemonService: string;\n\treadonly runtimeDistribution: string;\n\treadonly repository: string;\n}\n\nexport const PRODUCT = Object.freeze({\n\tname: \"Base Context\",\n\tcommand: \"base-context\",\n\tpackageName: \"@ponythewhite/base-context\",\n\tconfigDirectory: \".base-context\",\n\tenvironmentPrefix: \"BASE_CONTEXT\",\n\tdaemonService: \"base-context.daemon\",\n\truntimeDistribution: \"base-context-runtime\",\n\trepository: \"https://github.com/BaseModelAI/base-context\",\n} as const satisfies ProductIdentity);\n\nexport const PRODUCT_ENV = Object.freeze({\n\thome: \"BASE_CONTEXT_HOME\",\n\tsessions: \"BASE_CONTEXT_SESSION_DIR\",\n\tpackageDirectory: \"BASE_CONTEXT_PACKAGE_DIR\",\n\tinteractiveSelfUpdate: \"BASE_CONTEXT_INTERACTIVE_SELF_UPDATE\",\n\tkernelPython: \"BASE_CONTEXT_KERNEL_PYTHON\",\n\tkernelVenv: \"BASE_CONTEXT_KERNEL_VENV\",\n\tinstallUv: \"BASE_CONTEXT_INSTALL_UV\",\n});\n"]}
@@ -27,7 +27,7 @@ See [installation](installation.md) for Python bootstrap and manual runtime opti
27
27
 
28
28
  The public CLI package is `@ponythewhite/base-context`; the binary is `base-context`. The other public packages are `@ponythewhite/base-context-ai`, `@ponythewhite/base-context-agent`, and `@ponythewhite/base-context-tui`. The bundled Python distribution is `base-context-runtime`; its import remains `rlm`.
29
29
 
30
- Some extension interfaces and package manifests retain the `pi` API/key. Provider identifiers such as `prime-inference` and `PRIME_API_KEY` keep their real provider meaning. Do not rename these just because the product is a fork.
30
+ Some extension interfaces and package manifests retain the `pi` API/key. Supported provider identifiers and authentication variables keep their provider names. Provider and model choices must be explicit.
31
31
 
32
32
  ## Local configuration
33
33
 
@@ -28,6 +28,8 @@ Base Context retains that core approach, along with agent messaging, goals, sche
28
28
 
29
29
  `await rlm(...)` returns an admission handle. Children deliver results through messages or files. This distinction matters: a parent should continue independent work and read results when they arrive, not assume the spawn call contains the answer.
30
30
 
31
+ For 1.0.1, we reviewed the 113 commits in Prime Agent 0.9.5 and selected small runtime, provider and packaging fixes rather than merging the release. The [complete selection and exclusions](upstream-0.9.5.md) explain how that choice preserves the fork's architecture.
32
+
31
33
  ## What Base Context changes
32
34
 
33
35
  | Area | Base Context approach | Important limit |
@@ -62,14 +64,8 @@ Read the [report](../../../benchmarks/python-realworld-30/REPORT.md), [complete
62
64
  - **Keep comparisons honest.** Separate design goals from measured outcomes and benchmark revisions from release versions.
63
65
  - **Stay open.** Retain MIT licensing and upstream notices. Source and documentation should make the implementation understandable without a hosted service.
64
66
 
65
- ## Lineage and acknowledgements
67
+ ## Project and license
66
68
 
67
69
  Base Context is developed by [Synerise](https://synerise.com) and distributed through [BaseModelAI/base-context](https://github.com/BaseModelAI/base-context).
68
70
 
69
- We thank **[Prime Agent](https://github.com/PrimeIntellect-ai/prime-agent)** and **[Prime Intellect](https://www.primeintellect.ai/)** for the agent foundation, the [RLM programming model](https://www.primeintellect.ai/blog/rlm), and the work that made this fork possible.
70
-
71
- We thank **Mario Zechner** for **[Pi / pi-mono](https://github.com/badlogic/pi-mono)**, whose agent and terminal UI work is part of that lineage.
72
-
73
- We also acknowledge **[PrimeRL](https://github.com/PrimeIntellect-ai/prime-rl)**, Prime Intellect's separate open reinforcement-learning project. It is not a direct dependency of the Base Context CLI. This credit does not imply that Prime Intellect or the upstream authors endorse this fork or its benchmark conclusions.
74
-
75
- Base Context remains [MIT licensed](../../../LICENSE). The repository README retains the upstream research citation.
71
+ Base Context is [MIT licensed](../../../LICENSE). Required copyright notices are in [NOTICE](../../../NOTICE).
@@ -1,111 +1,132 @@
1
1
  # Installation, updates, and rollback
2
2
 
3
- The application package is **`@ponythewhite/base-context`**. The executable is **`base-context`**. The repository is [BaseModelAI/base-context](https://github.com/BaseModelAI/base-context). Prime Agent's installers and packages install a different product.
3
+ Install **Synerise base-context** with the installer below. The application package is `@ponythewhite/base-context`; the command is `base-context`.
4
4
 
5
- ## Requirements
5
+ ## Recommended: the installer
6
6
 
7
- - Node.js `^22.12.0 || >=23.3.0`: Node 22.12 or newer on the 22.x line, or Node 23.3 or newer. Node 22.8–22.11 and 23.0–23.2 are not supported.
8
- - npm compatible with that Node version.
9
- - [uv](https://docs.astral.sh/uv/getting-started/installation/) for the managed Python workspace. The default bootstrap installs Python 3.11, the bundled `base-context-runtime`, and its default Python packages.
10
- - A configured, authorized model provider. Provider inference and first-time dependency setup need network access unless you supply local alternatives.
7
+ On **macOS or Linux**, run this in a terminal:
11
8
 
12
- The Node floor comes from the native SQLite session catalog. It does not change the journal format. Normal session owners rebuild older derived indexes; read-only catalog discovery does not migrate them.
9
+ ```bash
10
+ curl -fsSL https://github.com/BaseModelAI/base-context/releases/latest/download/install.sh | bash
11
+ ```
12
+
13
+ **You do not install Node.js, npm, Python, or `uv` first.** The installer:
14
+
15
+ 1. Checks Node.js/npm and asks to install a supported version when needed. Some system package-manager methods need administrator approval.
16
+ 2. Installs `uv` if it is missing, downloads managed Python 3.13, and prepares the bundled runtime and Python packages.
17
+ 3. Activates the CLI only after that preparation succeeds.
18
+ 4. Offers to add the launcher and any standalone Node.js installation to your shell profile. It preserves existing settings.
19
+ 5. Prints one exact `export PATH=... && base-context` command. Run it to activate and launch in your **current terminal**. A child installer cannot change its parent shell's PATH. If you accept the profile update, future shells get the PATH automatically.
20
+
21
+ Use this route **instead of** the npm alternative. No Python virtual-environment activation is needed. Initial setup needs network access and ordinary shell download/archive tools. Missing Node/npm setup needs terminal approval; rerun in a terminal rather than preinstalling everything manually.
13
22
 
14
- ## npm installation
23
+ To start work later:
15
24
 
16
25
  ```bash
17
- npm install -g @ponythewhite/base-context
18
- base-context --version
19
- cd /path/to/project
26
+ cd /path/to/your/project
20
27
  base-context
21
28
  ```
22
29
 
23
- Make sure your npm global binary directory is on `PATH`. Use a user-owned Node installation rather than adding elevated permissions just for this agent.
30
+ Select a supported provider with `/login`, authenticate with that provider, then select a model with `/model`. You must choose the provider and model. Use that provider's account and authentication. See [provider setup](providers.md).
24
31
 
25
- In the UI, use `/login` and then `/model`. See [provider configuration](providers.md). The fork does not inherit permission to use upstream OAuth clients or subscriptions.
32
+ ### Updates and rollback
26
33
 
27
- Update an npm-managed installation with:
34
+ The installer manages a versioned CLI/Python pair beneath `${XDG_DATA_HOME:-$HOME/.local/share}/base-context`. `BASE_CONTEXT_INSTALL_ROOT` selects another root. The stable launcher is `<owned-root>/bin/base-context`. Existing global package-manager installations remain separate and are not overwritten.
28
35
 
29
36
  ```bash
30
- npm install -g @ponythewhite/base-context@latest
37
+ base-context update --self
38
+ base-context-install rollback
31
39
  ```
32
40
 
33
- The CLI also provides `base-context update`. npm/pnpm/yarn/bun global installations remain externally owned. They do not gain the owned installer's paired CLI/Python rollback.
41
+ Rollback selects the retained previous CLI/Python pair for future launches. It does not stop running processes, revert session data or Node.js, or undo changes made by Python skills. Old and failed version directories are retained.
34
42
 
35
- ## Source installation
43
+ To install a specific release, download that release's installer and pass its version:
36
44
 
37
45
  ```bash
38
- git clone https://github.com/BaseModelAI/base-context.git
39
- cd base-context
40
- npm ci
41
- npm run build:source
42
- node packages/coding-agent/dist/bundle/cli.js
46
+ VERSION=1.0.1
47
+ curl -fsSL "https://github.com/BaseModelAI/base-context/releases/download/v${VERSION}/install.sh" -o install-base-context.sh
48
+ sh install-base-context.sh "$VERSION"
43
49
  ```
44
50
 
45
- Do not substitute the upstream repository or an old fork-development branch. The source-built CLI starts in the current working directory. To use it in another project:
51
+ The shell resolves the stable npm tag by default; `beta` selects the npm `beta` tag. A positional version or `BASE_CONTEXT_VERSION` bypasses channel discovery. Matching GitHub release assets must exist. `BASE_CONTEXT_DOWNLOAD_BASE_URL` is an installer repository-base override, not the running application's update-manifest setting; leave it unset for normal use.
52
+
53
+ ## npm alternative
54
+
55
+ Use this only if you already manage Node.js and npm, or if you use Windows. Install supported **Node.js and npm before this route**: Node.js `^22.12.0 || >=23.3.0` (22.12+ on the 22.x line, or 23.3+).
56
+
57
+ Bash/Zsh:
46
58
 
47
59
  ```bash
60
+ npm install -g @ponythewhite/base-context
48
61
  cd /path/to/project
49
- node /absolute/path/to/base-context/packages/coding-agent/dist/bundle/cli.js
62
+ BASE_CONTEXT_INSTALL_UV=1 base-context
50
63
  ```
51
64
 
52
- Replace `base-context` in other examples with that Node invocation when using a source build. Keep source updates under git and rebuild with `npm ci` and `npm run build:source`; a global npm update does not update your checkout.
65
+ PowerShell:
66
+
67
+ ```powershell
68
+ npm install -g @ponythewhite/base-context
69
+ Set-Location C:\path\to\project
70
+ $env:BASE_CONTEXT_INSTALL_UV = "1"
71
+ base-context
72
+ ```
53
73
 
54
- ## Python setup
74
+ Make sure the npm global binary directory is on PATH. Use a user-owned Node installation rather than adding administrator permissions just for this agent.
55
75
 
56
- For npm and source installations, the default kernel environment is `~/.base-context/runtime`. It is prepared lazily when the agent first uses Python. Install `uv` first, or explicitly allow bootstrap to install it with `BASE_CONTEXT_INSTALL_UV=1`. Initial preparation can download Python and dependencies.
76
+ **What happens when:** normal `npm install` installs the CLI but skips Python setup. Starting a normal CLI session begins preparing Python in the background when the Python tool is enabled. `BASE_CONTEXT_INSTALL_UV=1` lets this setup install missing `uv`; it then downloads Python and installs the bundled runtime. You do not install Python manually. Later sessions reuse the environment. `base-context --version` does not start Python.
57
77
 
58
- For a manual environment:
78
+ Without that flag, missing `uv` can make the Python tool fail; normal session startup does not offer an installation prompt. The installer route avoids this separate step by finishing Python setup before activation. Advanced npm postinstall bootstrap flags are optional, not required for this route.
59
79
 
60
- - `BASE_CONTEXT_KERNEL_PYTHON` selects an absolute Python executable with a current **`base-context-runtime`** already installed.
61
- - `BASE_CONTEXT_KERNEL_VENV` selects an absolute manual environment directory.
62
- - The Python import remains `rlm`; an environment containing only `prime-agent-runtime` is not a substitute.
80
+ Update an npm-managed installation with:
63
81
 
64
- The owned installer below prepares its own release-local default environment before activation. Python skills can later change that environment; it is not immutable. See [Python-backed skills](skills.md#python-backed-skills).
82
+ ```bash
83
+ npm install -g @ponythewhite/base-context@latest
84
+ ```
65
85
 
66
- ## Owned installer and rollback
86
+ `base-context update` also supports package-manager updates. npm/pnpm/yarn/bun installations remain externally owned and do not gain the installer's paired CLI/Python rollback.
67
87
 
68
- Use the versioned, rendered installer from the GitHub release:
88
+ ## Source installation
69
89
 
70
90
  ```bash
71
- curl -fL https://github.com/BaseModelAI/base-context/releases/download/v1.0.0/install.sh -o install-base-context.sh
72
- sh install-base-context.sh 1.0.0
91
+ git clone https://github.com/BaseModelAI/base-context.git
92
+ cd base-context
93
+ npm ci
94
+ npm run build:source
95
+ BASE_CONTEXT_INSTALL_UV=1 node packages/coding-agent/dist/bundle/cli.js
73
96
  ```
74
97
 
75
- The separate POSIX installer manages versioned CLI/Python pairs. It defaults to `${XDG_DATA_HOME:-$HOME/.local/share}/base-context`; `BASE_CONTEXT_INSTALL_ROOT` chooses another root. Use the installer and assets from a matching Base Context release, not an upstream installer.
76
-
77
- The release layout uses the repository base `https://github.com/BaseModelAI/base-context`, with versioned assets under `/releases/download/v<V>/`. Assets include `base-context-<V>.tgz`, the three core tarballs, and `SHA256SUMS`. The shell installer resolves `@ponythewhite/base-context@latest`; its `beta` channel resolves the npm `beta` tag. A positional version such as `sh install.sh v1.0.0`, or `BASE_CONTEXT_VERSION`, bypasses channel discovery. The matching release assets must already exist.
98
+ The source-built CLI starts in the current working directory. To work in another project, change to that directory and run `node /absolute/path/to/base-context/packages/coding-agent/dist/bundle/cli.js`. Keep source updates under git, then rerun `npm ci` and `npm run build:source`. A global npm update does not update your checkout.
78
99
 
79
- When invoking a local copy of the shell installer, set `BASE_CONTEXT_DOWNLOAD_BASE_URL` for that invocation to the repository base. This installer setting is **not** the running application's custom update-manifest setting. Leave it unset for normal application launches to use owned npm updates.
100
+ ## Custom Python environments
80
101
 
81
- Preparation must finish before the new CLI/Python pair becomes selected. Follow the installer's PATH instructions, including the separate `base-context-node` directory if it installs standalone Node. The stable launcher is `<owned-root>/bin/base-context`.
102
+ Ordinary installer users can skip this section. npm and source installations normally use `~/.base-context/runtime`; the installer uses a release-local environment. SDK sessions and RLM children normally prepare Python lazily, unlike the normal CLI root session's background prewarm.
82
103
 
83
- After an owned installation:
104
+ For an explicitly managed environment:
84
105
 
85
- ```bash
86
- base-context update --self
87
- base-context-install rollback
88
- ```
106
+ - `BASE_CONTEXT_KERNEL_PYTHON` selects an absolute Python executable with the current bundled **`base-context-runtime`** installed.
107
+ - `BASE_CONTEXT_KERNEL_VENV` selects an absolute environment directory.
108
+ - The package exposes the Python import `rlm`. This is not a command users need to run to install the CLI.
89
109
 
90
- Rollback selects the retained previous CLI/Python pair for future launches. It does not stop running owners, roll back session data or Node, or undo changes made by running processes. Old and failed version directories are retained; there is no automatic cleanup. The owned installer does not convert or overwrite existing global package-manager installations.
110
+ Saved Python namespaces are not portable across minor versions; native startup rejects an incompatible snapshot. Start a new session when selecting a different Python minor version. Python skills can install additional packages. See [Python-backed skills](skills.md#python-backed-skills).
91
111
 
92
- ### Local release packages
112
+ ## Local release packages
93
113
 
94
- For unpublished local packages, use the dedicated installer from the matching, freshly built and extracted main package. Supply the three other first-party tarballs explicitly:
114
+ For unpublished packages, use the dedicated installer from the matching, freshly built and extracted main package. Supply all three other first-party archives explicitly:
95
115
 
96
116
  ```bash
117
+ VERSION=1.0.1
97
118
  PACKS=/absolute/path/to/pack
98
119
  node /absolute/path/to/extracted-main/package/dist/installer.mjs install \
99
120
  /absolute/path/to/new-install-root null \
100
- "$PACKS/ponythewhite-base-context-1.0.0.tgz" 1.0.0 \
101
- --local-dependency "$PACKS/ponythewhite-base-context-ai-1.0.0.tgz" \
102
- --local-dependency "$PACKS/ponythewhite-base-context-tui-1.0.0.tgz" \
103
- --local-dependency "$PACKS/ponythewhite-base-context-agent-1.0.0.tgz"
121
+ "$PACKS/ponythewhite-base-context-${VERSION}.tgz" "$VERSION" \
122
+ --local-dependency "$PACKS/ponythewhite-base-context-ai-${VERSION}.tgz" \
123
+ --local-dependency "$PACKS/ponythewhite-base-context-tui-${VERSION}.tgz" \
124
+ --local-dependency "$PACKS/ponythewhite-base-context-agent-${VERSION}.tgz"
104
125
  ```
105
126
 
106
- Substitute the matching release version and actual tarball names. Use `null` only for a new, unselected owned root. Each `--local-dependency` names a local archive containing `package/package.json`. Relative paths use the invocation's original working directory. `tar` must be available. The installer reads package names and configures candidate-local dependencies; it does not scan adjacent files or modify archive contents.
127
+ Use the actual archive names and a matching version. `null` means a new, unselected owned root. Relative paths use the invocation's original working directory. `tar` must be available. The installer reads package names and sets candidate-local dependencies; it does not scan adjacent files or alter archives.
107
128
 
108
- The dedicated entry skips agent/model/auth startup, but npm scripts and Python bootstrap can still download dependencies. This is not an offline install. Extraction alone does not install or activate the package. Old package sets do not acquire this installer option.
129
+ This entry skips agent/model/auth startup, but npm and Python setup can download dependencies. Extraction alone does not install or activate the package.
109
130
 
110
131
  ## State and configuration
111
132
 
@@ -117,17 +138,17 @@ The dedicated entry skips agent/model/auth startup, but npm scripts and Python b
117
138
  | `BASE_CONTEXT_SESSION_DIR` | Absolute independent session-storage override |
118
139
  | `--session-dir` | Session-directory override with higher precedence |
119
140
 
120
- Do not point writable Base Context state at `.prime`, `.pi`, or `.prime-context`. Do not copy upstream credential files. Use the explicit [offline history import](sessions.md#importing-an-offline-prime-root) if needed.
141
+ Keep writable Base Context state separate from other applications. Use [offline history import](sessions.md#importing-an-offline-prime-root) when needed.
121
142
 
122
143
  `--offline` or `BASE_CONTEXT_OFFLINE=1` disables startup network operations, including update and package checks. It is not a network sandbox and does not make a remote model available offline.
123
144
 
124
145
  ## Troubleshooting
125
146
 
126
- - **Unsupported Node:** upgrade Node before installing or rebuilding.
127
- - **Command not found:** check the npm global binary directory or the owned installer's PATH instructions.
128
- - **Python bootstrap cannot find uv:** install uv, or opt in with `BASE_CONTEXT_INSTALL_UV=1`.
129
- - **Manual Python is rejected:** install the current bundled `base-context-runtime` into the selected environment; do not reuse an upstream-only runtime.
130
- - **No usable model:** configure the actual provider route. A catalog entry is not authentication or subscription permission.
131
- - **Background service issue:** use `base-context status`, then `base-context doctor`; add `--fix` only when you want repairs.
147
+ - **Missing or unsupported Node:** rerun the installer in a terminal and approve prerequisite setup. npm/source users must install supported Node themselves.
148
+ - **Command not found:** run the installer's exact PATH command, or check your npm global binary directory if using npm.
149
+ - **Python cannot find uv with npm/source:** launch with `BASE_CONTEXT_INSTALL_UV=1` as shown above.
150
+ - **Manual Python is rejected:** install the current bundled runtime into that environment.
151
+ - **No model selected:** use `/login` for your provider and `/model` for an explicit model choice.
152
+ - **Background service issue:** use `base-context status`, then `base-context doctor`; add `--fix` when you want repairs.
132
153
 
133
154
  See [settings](settings.md), [usage](usage.md), and [development](development.md) for the full references.