@bastani/atomic 0.9.14 → 0.9.15

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 (525) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +1 -1
  3. package/dist/builtin/intercom/package.json +2 -2
  4. package/dist/builtin/mcp/CHANGELOG.md +14 -0
  5. package/dist/builtin/mcp/package.json +4 -4
  6. package/dist/builtin/mcp/sampling-handler.ts +2 -2
  7. package/dist/builtin/mcp/types.ts +1 -1
  8. package/dist/builtin/subagents/CHANGELOG.md +40 -0
  9. package/dist/builtin/subagents/README.md +5 -22
  10. package/dist/builtin/subagents/agents/code-simplifier.md +2 -2
  11. package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -2
  12. package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
  13. package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -2
  14. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
  15. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -2
  16. package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
  17. package/dist/builtin/subagents/agents/worker.md +2 -2
  18. package/dist/builtin/subagents/package.json +4 -4
  19. package/dist/builtin/subagents/skills/subagent/SKILL.md +6 -6
  20. package/dist/builtin/subagents/src/agents/agent-loaders.ts +0 -4
  21. package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +1 -12
  22. package/dist/builtin/subagents/src/agents/agent-management.ts +0 -1
  23. package/dist/builtin/subagents/src/agents/agent-serializer.ts +7 -6
  24. package/dist/builtin/subagents/src/agents/agent-types.ts +0 -1
  25. package/dist/builtin/subagents/src/extension/schemas.ts +2 -2
  26. package/dist/builtin/subagents/src/extension/startup-maintenance.ts +2 -2
  27. package/dist/builtin/subagents/src/intercom/result-intercom.ts +0 -127
  28. package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +1 -3
  29. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +15 -106
  30. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +0 -3
  31. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +2 -13
  32. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +2 -12
  33. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +1 -20
  34. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +0 -6
  35. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +10 -21
  36. package/dist/builtin/subagents/src/runs/inprocess/attempt-handles.ts +104 -0
  37. package/dist/builtin/subagents/src/runs/inprocess/index.ts +10 -21
  38. package/dist/builtin/subagents/src/runs/inprocess/prompt-behavior.ts +2 -3
  39. package/dist/builtin/subagents/src/runs/inprocess/runner.ts +11 -32
  40. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/temp-cleanup.ts +69 -0
  41. package/dist/builtin/subagents/src/shared/model-resolution.ts +1 -1
  42. package/dist/builtin/subagents/src/shared/types-config.ts +0 -4
  43. package/dist/builtin/subagents/src/shared/types-depth.ts +15 -103
  44. package/dist/builtin/subagents/src/shared/types-foreground-state.ts +56 -0
  45. package/dist/builtin/subagents/src/shared/types-results.ts +1 -59
  46. package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -2
  47. package/dist/builtin/subagents/src/shared/types.ts +1 -1
  48. package/dist/builtin/subagents/src/shared/utils.ts +1 -1
  49. package/dist/builtin/subagents/src/slash/slash-live-state.ts +1 -1
  50. package/dist/builtin/web-access/package.json +2 -2
  51. package/dist/builtin/web-access/summary-review.ts +2 -2
  52. package/dist/builtin/web-access/web-search-summary.ts +2 -2
  53. package/dist/builtin/workflows/CHANGELOG.md +30 -0
  54. package/dist/builtin/workflows/README.md +2 -2
  55. package/dist/builtin/workflows/package.json +2 -2
  56. package/dist/builtin/workflows/src/extension/index.bundle.mjs +60473 -401
  57. package/dist/builtin/workflows/src/extension/public-types.ts +1 -1
  58. package/dist/builtin/workflows/src/extension/wiring.ts +1 -1
  59. package/dist/builtin/workflows/src/extension/workflow-heartbeat-delivery.ts +48 -4
  60. package/dist/builtin/workflows/src/extension/workflow-tool.ts +1 -1
  61. package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +5 -0
  62. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +35 -2
  63. package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +1 -1
  64. package/dist/builtin/workflows/src/runs/foreground/stage-runner-pause.ts +6 -0
  65. package/dist/builtin/workflows/src/tui/chat-surface-message.ts +15 -13
  66. package/dist/builtin/workflows/src/tui/store-widget-installer.ts +25 -2
  67. package/dist/bun/cli.js +1 -1
  68. package/dist/bun/cli.js.map +1 -1
  69. package/dist/bun/register-bedrock.js +2 -2
  70. package/dist/bun/register-bedrock.js.map +1 -1
  71. package/dist/cli/auth-check.d.ts +1 -1
  72. package/dist/cli/auth-check.d.ts.map +1 -1
  73. package/dist/cli/auth-check.js +1 -1
  74. package/dist/cli/auth-check.js.map +1 -1
  75. package/dist/cli/credential-print.d.ts +1 -1
  76. package/dist/cli/credential-print.d.ts.map +1 -1
  77. package/dist/cli/credential-print.js +2 -2
  78. package/dist/cli/credential-print.js.map +1 -1
  79. package/dist/cli/file-processor.d.ts +1 -1
  80. package/dist/cli/file-processor.d.ts.map +1 -1
  81. package/dist/cli/file-processor.js.map +1 -1
  82. package/dist/cli/initial-message.d.ts +1 -1
  83. package/dist/cli/initial-message.d.ts.map +1 -1
  84. package/dist/cli/initial-message.js.map +1 -1
  85. package/dist/cli/list-models.js.map +1 -1
  86. package/dist/core/agent-session-auto-compaction.d.ts +1 -1
  87. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  88. package/dist/core/agent-session-auto-compaction.js +1 -1
  89. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  90. package/dist/core/agent-session-events.d.ts +1 -1
  91. package/dist/core/agent-session-events.d.ts.map +1 -1
  92. package/dist/core/agent-session-events.js +1 -1
  93. package/dist/core/agent-session-events.js.map +1 -1
  94. package/dist/core/agent-session-export.js.map +1 -1
  95. package/dist/core/agent-session-extension-bindings.js +1 -1
  96. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  97. package/dist/core/agent-session-message-queue.d.ts +1 -1
  98. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  99. package/dist/core/agent-session-message-queue.js.map +1 -1
  100. package/dist/core/agent-session-methods.d.ts +2 -2
  101. package/dist/core/agent-session-methods.d.ts.map +1 -1
  102. package/dist/core/agent-session-methods.js.map +1 -1
  103. package/dist/core/agent-session-models.d.ts +2 -2
  104. package/dist/core/agent-session-models.d.ts.map +1 -1
  105. package/dist/core/agent-session-models.js +2 -2
  106. package/dist/core/agent-session-models.js.map +1 -1
  107. package/dist/core/agent-session-prompt.d.ts +1 -1
  108. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  109. package/dist/core/agent-session-prompt.js.map +1 -1
  110. package/dist/core/agent-session-retry.d.ts +1 -1
  111. package/dist/core/agent-session-retry.d.ts.map +1 -1
  112. package/dist/core/agent-session-retry.js +1 -1
  113. package/dist/core/agent-session-retry.js.map +1 -1
  114. package/dist/core/agent-session-runtime-auth.js +1 -1
  115. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  116. package/dist/core/agent-session-runtime.d.ts +1 -1
  117. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  118. package/dist/core/agent-session-runtime.js +1 -1
  119. package/dist/core/agent-session-runtime.js.map +1 -1
  120. package/dist/core/agent-session-services.d.ts +1 -1
  121. package/dist/core/agent-session-services.d.ts.map +1 -1
  122. package/dist/core/agent-session-services.js.map +1 -1
  123. package/dist/core/agent-session-state.d.ts +1 -1
  124. package/dist/core/agent-session-state.d.ts.map +1 -1
  125. package/dist/core/agent-session-state.js.map +1 -1
  126. package/dist/core/agent-session-tree.js.map +1 -1
  127. package/dist/core/agent-session-types.d.ts +1 -1
  128. package/dist/core/agent-session-types.d.ts.map +1 -1
  129. package/dist/core/agent-session-types.js.map +1 -1
  130. package/dist/core/agent-session.d.ts +1 -1
  131. package/dist/core/agent-session.d.ts.map +1 -1
  132. package/dist/core/agent-session.js.map +1 -1
  133. package/dist/core/anthropic-thinking-guard.d.ts +1 -1
  134. package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
  135. package/dist/core/anthropic-thinking-guard.js +1 -1
  136. package/dist/core/anthropic-thinking-guard.js.map +1 -1
  137. package/dist/core/auth-storage.d.ts +1 -1
  138. package/dist/core/auth-storage.d.ts.map +1 -1
  139. package/dist/core/auth-storage.js.map +1 -1
  140. package/dist/core/cache-stats.d.ts +1 -1
  141. package/dist/core/cache-stats.d.ts.map +1 -1
  142. package/dist/core/cache-stats.js.map +1 -1
  143. package/dist/core/cloudflare-gateway-binding.d.ts +1 -1
  144. package/dist/core/cloudflare-gateway-binding.d.ts.map +1 -1
  145. package/dist/core/cloudflare-gateway-binding.js +1 -1
  146. package/dist/core/cloudflare-gateway-binding.js.map +1 -1
  147. package/dist/core/codex-fast-mode.d.ts +2 -2
  148. package/dist/core/codex-fast-mode.d.ts.map +1 -1
  149. package/dist/core/codex-fast-mode.js +3 -2
  150. package/dist/core/codex-fast-mode.js.map +1 -1
  151. package/dist/core/compaction/branch-summarization.d.ts +2 -2
  152. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  153. package/dist/core/compaction/branch-summarization.js +2 -2
  154. package/dist/core/compaction/branch-summarization.js.map +1 -1
  155. package/dist/core/compaction/compaction-runner.d.ts +2 -2
  156. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  157. package/dist/core/compaction/compaction-runner.js.map +1 -1
  158. package/dist/core/compaction/compaction-types.d.ts +2 -2
  159. package/dist/core/compaction/compaction-types.d.ts.map +1 -1
  160. package/dist/core/compaction/compaction-types.js.map +1 -1
  161. package/dist/core/compaction/compaction.d.ts +1 -1
  162. package/dist/core/compaction/compaction.d.ts.map +1 -1
  163. package/dist/core/compaction/compaction.js.map +1 -1
  164. package/dist/core/compaction/fallback-planner.d.ts +1 -1
  165. package/dist/core/compaction/fallback-planner.d.ts.map +1 -1
  166. package/dist/core/compaction/fallback-planner.js.map +1 -1
  167. package/dist/core/compaction/planner-outcome.d.ts +1 -1
  168. package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
  169. package/dist/core/compaction/planner-outcome.js +1 -1
  170. package/dist/core/compaction/planner-outcome.js.map +1 -1
  171. package/dist/core/compaction/range-planner-diagnostics.d.ts +1 -1
  172. package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -1
  173. package/dist/core/compaction/range-planner-diagnostics.js +1 -1
  174. package/dist/core/compaction/range-planner-diagnostics.js.map +1 -1
  175. package/dist/core/compaction/range-planner.d.ts +2 -2
  176. package/dist/core/compaction/range-planner.d.ts.map +1 -1
  177. package/dist/core/compaction/range-planner.js +2 -2
  178. package/dist/core/compaction/range-planner.js.map +1 -1
  179. package/dist/core/compaction/session-summarization.d.ts +2 -2
  180. package/dist/core/compaction/session-summarization.d.ts.map +1 -1
  181. package/dist/core/compaction/session-summarization.js +2 -2
  182. package/dist/core/compaction/session-summarization.js.map +1 -1
  183. package/dist/core/compaction/transcript-serialization.d.ts +1 -1
  184. package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
  185. package/dist/core/compaction/transcript-serialization.js.map +1 -1
  186. package/dist/core/compaction/utils.d.ts +1 -1
  187. package/dist/core/compaction/utils.d.ts.map +1 -1
  188. package/dist/core/compaction/utils.js.map +1 -1
  189. package/dist/core/experimental.d.ts +1 -1
  190. package/dist/core/experimental.d.ts.map +1 -1
  191. package/dist/core/experimental.js.map +1 -1
  192. package/dist/core/export-html/tool-renderer.js.map +1 -1
  193. package/dist/core/extensions/agent-events.d.ts +2 -2
  194. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  195. package/dist/core/extensions/agent-events.js.map +1 -1
  196. package/dist/core/extensions/api-types.d.ts +2 -2
  197. package/dist/core/extensions/api-types.d.ts.map +1 -1
  198. package/dist/core/extensions/api-types.js.map +1 -1
  199. package/dist/core/extensions/context-types.d.ts +1 -7
  200. package/dist/core/extensions/context-types.d.ts.map +1 -1
  201. package/dist/core/extensions/context-types.js.map +1 -1
  202. package/dist/core/extensions/event-results.d.ts +1 -1
  203. package/dist/core/extensions/event-results.d.ts.map +1 -1
  204. package/dist/core/extensions/event-results.js.map +1 -1
  205. package/dist/core/extensions/index.d.ts +1 -1
  206. package/dist/core/extensions/index.d.ts.map +1 -1
  207. package/dist/core/extensions/index.js.map +1 -1
  208. package/dist/core/extensions/loader-api.js.map +1 -1
  209. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  210. package/dist/core/extensions/loader-virtual-modules.js +21 -9
  211. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  212. package/dist/core/extensions/provider-types.d.ts +2 -2
  213. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  214. package/dist/core/extensions/provider-types.js.map +1 -1
  215. package/dist/core/extensions/reactive-widget.d.ts +6 -0
  216. package/dist/core/extensions/reactive-widget.d.ts.map +1 -1
  217. package/dist/core/extensions/reactive-widget.js +62 -6
  218. package/dist/core/extensions/reactive-widget.js.map +1 -1
  219. package/dist/core/extensions/runner-context.d.ts +1 -1
  220. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  221. package/dist/core/extensions/runner-context.js.map +1 -1
  222. package/dist/core/extensions/runner-events.d.ts +1 -1
  223. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  224. package/dist/core/extensions/runner-events.js.map +1 -1
  225. package/dist/core/extensions/runner.d.ts +2 -2
  226. package/dist/core/extensions/runner.d.ts.map +1 -1
  227. package/dist/core/extensions/runner.js.map +1 -1
  228. package/dist/core/extensions/runtime-types.d.ts +2 -2
  229. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  230. package/dist/core/extensions/runtime-types.js.map +1 -1
  231. package/dist/core/extensions/tool-events.d.ts +1 -1
  232. package/dist/core/extensions/tool-events.d.ts.map +1 -1
  233. package/dist/core/extensions/tool-events.js.map +1 -1
  234. package/dist/core/extensions/tool-types.d.ts +2 -2
  235. package/dist/core/extensions/tool-types.d.ts.map +1 -1
  236. package/dist/core/extensions/tool-types.js.map +1 -1
  237. package/dist/core/extensions/ui-types.d.ts +2 -0
  238. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  239. package/dist/core/extensions/ui-types.js.map +1 -1
  240. package/dist/core/fallback-models.d.ts +1 -1
  241. package/dist/core/fallback-models.d.ts.map +1 -1
  242. package/dist/core/fallback-models.js.map +1 -1
  243. package/dist/core/http-dispatcher.d.ts.map +1 -1
  244. package/dist/core/http-dispatcher.js +14 -0
  245. package/dist/core/http-dispatcher.js.map +1 -1
  246. package/dist/core/messages.d.ts +1 -1
  247. package/dist/core/messages.d.ts.map +1 -1
  248. package/dist/core/messages.js.map +1 -1
  249. package/dist/core/model-capabilities.d.ts +1 -1
  250. package/dist/core/model-capabilities.d.ts.map +1 -1
  251. package/dist/core/model-capabilities.js.map +1 -1
  252. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  253. package/dist/core/model-fallback-failures.js +18 -1
  254. package/dist/core/model-fallback-failures.js.map +1 -1
  255. package/dist/core/model-registry.d.ts +1 -1
  256. package/dist/core/model-registry.d.ts.map +1 -1
  257. package/dist/core/model-registry.js.map +1 -1
  258. package/dist/core/model-resolver-cli.js.map +1 -1
  259. package/dist/core/model-resolver-defaults.d.ts +1 -1
  260. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  261. package/dist/core/model-resolver-defaults.js +1 -1
  262. package/dist/core/model-resolver-defaults.js.map +1 -1
  263. package/dist/core/model-resolver-initial.d.ts +1 -1
  264. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  265. package/dist/core/model-resolver-initial.js.map +1 -1
  266. package/dist/core/model-resolver-patterns.d.ts +1 -1
  267. package/dist/core/model-resolver-patterns.d.ts.map +1 -1
  268. package/dist/core/model-resolver-patterns.js.map +1 -1
  269. package/dist/core/model-resolver-scope.d.ts +1 -1
  270. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  271. package/dist/core/model-resolver-scope.js +1 -1
  272. package/dist/core/model-resolver-scope.js.map +1 -1
  273. package/dist/core/model-resolver-types.d.ts +1 -1
  274. package/dist/core/model-resolver-types.d.ts.map +1 -1
  275. package/dist/core/model-resolver-types.js.map +1 -1
  276. package/dist/core/model-runtime-auth.d.ts +1 -1
  277. package/dist/core/model-runtime-auth.d.ts.map +1 -1
  278. package/dist/core/model-runtime-auth.js.map +1 -1
  279. package/dist/core/model-runtime-providers.d.ts +2 -2
  280. package/dist/core/model-runtime-providers.d.ts.map +1 -1
  281. package/dist/core/model-runtime-providers.js +2 -2
  282. package/dist/core/model-runtime-providers.js.map +1 -1
  283. package/dist/core/model-runtime-restoration.d.ts +1 -1
  284. package/dist/core/model-runtime-restoration.d.ts.map +1 -1
  285. package/dist/core/model-runtime-restoration.js.map +1 -1
  286. package/dist/core/model-runtime-snapshot.d.ts +1 -1
  287. package/dist/core/model-runtime-snapshot.d.ts.map +1 -1
  288. package/dist/core/model-runtime-snapshot.js.map +1 -1
  289. package/dist/core/model-runtime-streaming.d.ts +1 -1
  290. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  291. package/dist/core/model-runtime-streaming.js +1 -1
  292. package/dist/core/model-runtime-streaming.js.map +1 -1
  293. package/dist/core/model-runtime-types.d.ts +1 -1
  294. package/dist/core/model-runtime-types.d.ts.map +1 -1
  295. package/dist/core/model-runtime-types.js.map +1 -1
  296. package/dist/core/model-runtime.d.ts +8 -1
  297. package/dist/core/model-runtime.d.ts.map +1 -1
  298. package/dist/core/model-runtime.js +15 -3
  299. package/dist/core/model-runtime.js.map +1 -1
  300. package/dist/core/models-store.d.ts +1 -1
  301. package/dist/core/models-store.d.ts.map +1 -1
  302. package/dist/core/models-store.js.map +1 -1
  303. package/dist/core/oauth-login.d.ts +1 -1
  304. package/dist/core/oauth-login.d.ts.map +1 -1
  305. package/dist/core/oauth-login.js.map +1 -1
  306. package/dist/core/oauth-provider-metadata.d.ts +1 -1
  307. package/dist/core/oauth-provider-metadata.d.ts.map +1 -1
  308. package/dist/core/oauth-provider-metadata.js.map +1 -1
  309. package/dist/core/openai-responses-payload-sanitizer.d.ts +1 -1
  310. package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
  311. package/dist/core/openai-responses-payload-sanitizer.js.map +1 -1
  312. package/dist/core/provider-attribution.d.ts +1 -1
  313. package/dist/core/provider-attribution.d.ts.map +1 -1
  314. package/dist/core/provider-attribution.js.map +1 -1
  315. package/dist/core/provider-composer-internal.d.ts +1 -1
  316. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  317. package/dist/core/provider-composer-internal.js.map +1 -1
  318. package/dist/core/provider-composer.d.ts +1 -1
  319. package/dist/core/provider-composer.d.ts.map +1 -1
  320. package/dist/core/provider-composer.js +2 -2
  321. package/dist/core/provider-composer.js.map +1 -1
  322. package/dist/core/provider-context-usage.d.ts.map +1 -1
  323. package/dist/core/provider-context-usage.js.map +1 -1
  324. package/dist/core/remote-catalog-provider.d.ts +1 -1
  325. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  326. package/dist/core/remote-catalog-provider.js.map +1 -1
  327. package/dist/core/runtime-credentials.d.ts +1 -1
  328. package/dist/core/runtime-credentials.d.ts.map +1 -1
  329. package/dist/core/runtime-credentials.js.map +1 -1
  330. package/dist/core/sdk-types.d.ts +1 -1
  331. package/dist/core/sdk-types.d.ts.map +1 -1
  332. package/dist/core/sdk-types.js.map +1 -1
  333. package/dist/core/sdk.d.ts +1 -1
  334. package/dist/core/sdk.d.ts.map +1 -1
  335. package/dist/core/sdk.js +30 -6
  336. package/dist/core/sdk.js.map +1 -1
  337. package/dist/core/session-manager-core.d.ts +2 -2
  338. package/dist/core/session-manager-core.d.ts.map +1 -1
  339. package/dist/core/session-manager-core.js.map +1 -1
  340. package/dist/core/session-manager-entries.d.ts +1 -1
  341. package/dist/core/session-manager-entries.d.ts.map +1 -1
  342. package/dist/core/session-manager-entries.js.map +1 -1
  343. package/dist/core/session-manager-list.js.map +1 -1
  344. package/dist/core/session-manager-types.d.ts +1 -1
  345. package/dist/core/session-manager-types.d.ts.map +1 -1
  346. package/dist/core/session-manager-types.js.map +1 -1
  347. package/dist/core/session-manager-validation.js +1 -1
  348. package/dist/core/session-manager-validation.js.map +1 -1
  349. package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
  350. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  351. package/dist/core/settings-manager-basic-accessors.js +11 -0
  352. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  353. package/dist/core/settings-types.d.ts +2 -1
  354. package/dist/core/settings-types.d.ts.map +1 -1
  355. package/dist/core/settings-types.js.map +1 -1
  356. package/dist/core/summarization-retry.d.ts +1 -1
  357. package/dist/core/summarization-retry.d.ts.map +1 -1
  358. package/dist/core/summarization-retry.js.map +1 -1
  359. package/dist/core/tools/bash-session-environment.d.ts +1 -1
  360. package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
  361. package/dist/core/tools/bash-session-environment.js.map +1 -1
  362. package/dist/core/tools/oversized-tool-result.d.ts +1 -1
  363. package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
  364. package/dist/core/tools/oversized-tool-result.js.map +1 -1
  365. package/dist/core/tools/read-url.d.ts +1 -1
  366. package/dist/core/tools/read-url.d.ts.map +1 -1
  367. package/dist/core/tools/read-url.js.map +1 -1
  368. package/dist/core/tools/read.d.ts.map +1 -1
  369. package/dist/core/tools/read.js.map +1 -1
  370. package/dist/core/tools/render-utils.d.ts +1 -1
  371. package/dist/core/tools/render-utils.d.ts.map +1 -1
  372. package/dist/core/tools/render-utils.js.map +1 -1
  373. package/dist/core/tools/resource-selectors.d.ts +1 -1
  374. package/dist/core/tools/resource-selectors.d.ts.map +1 -1
  375. package/dist/core/tools/resource-selectors.js +2 -7
  376. package/dist/core/tools/resource-selectors.js.map +1 -1
  377. package/dist/core/typebox-compat.js +1 -1
  378. package/dist/core/typebox-compat.js.map +1 -1
  379. package/dist/core/usage-totals.d.ts +1 -1
  380. package/dist/core/usage-totals.d.ts.map +1 -1
  381. package/dist/core/usage-totals.js.map +1 -1
  382. package/dist/extensions/llama/provider.d.ts +1 -1
  383. package/dist/extensions/llama/provider.d.ts.map +1 -1
  384. package/dist/extensions/llama/provider.js +1 -1
  385. package/dist/extensions/llama/provider.js.map +1 -1
  386. package/dist/main-app-mode.d.ts +1 -1
  387. package/dist/main-app-mode.d.ts.map +1 -1
  388. package/dist/main-app-mode.js.map +1 -1
  389. package/dist/main-session-options.js +1 -1
  390. package/dist/main-session-options.js.map +1 -1
  391. package/dist/modes/interactive/components/assistant-message.d.ts +1 -1
  392. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  394. package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -1
  395. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  396. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  397. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  398. package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
  399. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  400. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  401. package/dist/modes/interactive/components/model-selector.d.ts +1 -1
  402. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  403. package/dist/modes/interactive/components/model-selector.js +1 -1
  404. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  405. package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -1
  406. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  407. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  408. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  409. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -1
  410. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  411. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  412. package/dist/modes/interactive/interactive-auth-routing.js +1 -1
  413. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  414. package/dist/modes/interactive/interactive-deferred-startup.js +1 -1
  415. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  416. package/dist/modes/interactive/interactive-extension-context.js +26 -0
  417. package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
  418. package/dist/modes/interactive/interactive-extension-runtime.js +7 -2
  419. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  420. package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
  421. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  422. package/dist/modes/interactive/interactive-mode-base.js +1 -0
  423. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  424. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  425. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  426. package/dist/modes/interactive/interactive-mode-deps.js +1 -1
  427. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  428. package/dist/modes/interactive/interactive-mode-helpers.js +1 -1
  429. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  430. package/dist/modes/interactive/interactive-mode-surface.d.ts +2 -0
  431. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  432. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  433. package/dist/modes/interactive/model-catalog-refresh.d.ts +1 -1
  434. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
  435. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
  436. package/dist/modes/interactive/streaming-assistant-message.d.ts +1 -1
  437. package/dist/modes/interactive/streaming-assistant-message.d.ts.map +1 -1
  438. package/dist/modes/interactive/streaming-assistant-message.js.map +1 -1
  439. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +3 -0
  440. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  441. package/dist/modes/interactive-engine/engine-custom-ui.js +26 -3
  442. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  443. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  444. package/dist/modes/interactive-engine/remote-component.d.ts +2 -1
  445. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  446. package/dist/modes/interactive-engine/remote-component.js +14 -0
  447. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  448. package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
  449. package/dist/modes/json-event.d.ts +1 -1
  450. package/dist/modes/json-event.d.ts.map +1 -1
  451. package/dist/modes/json-event.js.map +1 -1
  452. package/dist/modes/print-mode.d.ts +1 -1
  453. package/dist/modes/print-mode.d.ts.map +1 -1
  454. package/dist/modes/print-mode.js.map +1 -1
  455. package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
  456. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  457. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  458. package/dist/modes/rpc/rpc-client.d.ts +1 -1
  459. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  460. package/dist/modes/rpc/rpc-client.js.map +1 -1
  461. package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
  462. package/dist/modes/rpc/rpc-extension-ui.js +4 -1
  463. package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
  464. package/dist/modes/rpc/rpc-provider-auth.d.ts +1 -1
  465. package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
  466. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  467. package/dist/modes/rpc/rpc-types.d.ts +2 -2
  468. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  469. package/dist/modes/rpc/rpc-types.js.map +1 -1
  470. package/dist/utils/tool-result-images.d.ts +1 -1
  471. package/dist/utils/tool-result-images.d.ts.map +1 -1
  472. package/dist/utils/tool-result-images.js.map +1 -1
  473. package/docs/custom-provider.md +11 -8
  474. package/docs/development.md +0 -2
  475. package/docs/extensions.md +2 -2
  476. package/docs/json.md +1 -1
  477. package/docs/models/artificial-analysis-index.md +2 -2
  478. package/docs/models/model-selection.md +8 -8
  479. package/docs/models/pareto-efficiency.md +10 -10
  480. package/docs/models.md +9 -3
  481. package/docs/packages.md +1 -1
  482. package/docs/providers.md +5 -3
  483. package/docs/quickstart.md +1 -1
  484. package/docs/rpc.md +1 -1
  485. package/docs/sdk.md +2 -2
  486. package/docs/session-format.md +2 -2
  487. package/docs/settings.md +2 -1
  488. package/docs/subagents.md +5 -6
  489. package/docs/tui.md +3 -0
  490. package/docs/workflows.md +3 -1
  491. package/examples/extensions/README.md +1 -1
  492. package/examples/extensions/custom-footer.ts +1 -1
  493. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  494. package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
  495. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  496. package/examples/extensions/handoff.ts +2 -2
  497. package/examples/extensions/hello.ts +1 -1
  498. package/examples/extensions/plan-mode/index.ts +1 -1
  499. package/examples/extensions/preset.ts +1 -1
  500. package/examples/extensions/qna.ts +1 -1
  501. package/examples/extensions/subagent/display.ts +1 -1
  502. package/examples/extensions/subagent/runner.ts +1 -1
  503. package/examples/extensions/subagent/types.ts +1 -1
  504. package/examples/extensions/summarize.ts +2 -2
  505. package/examples/extensions/tool-override.ts +1 -1
  506. package/examples/sdk/02-custom-model.ts +1 -1
  507. package/examples/sdk/12-full-control.ts +1 -1
  508. package/examples/sdk/README.md +1 -1
  509. package/npm-shrinkwrap.json +54 -31
  510. package/package.json +3 -3
  511. package/dist/builtin/subagents/src/extension/fanout-child.ts +0 -259
  512. package/dist/builtin/subagents/src/runs/inprocess/nested-routing.ts +0 -218
  513. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +0 -55
  514. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-control.ts +0 -178
  515. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +0 -187
  516. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-paths.ts +0 -57
  517. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +0 -42
  518. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-registry.ts +0 -352
  519. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-rendering.ts +0 -136
  520. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +0 -252
  521. package/dist/builtin/subagents/src/shared/types-nested.ts +0 -127
  522. package/dist/core/copilot-env-routing.d.ts +0 -36
  523. package/dist/core/copilot-env-routing.d.ts.map +0 -1
  524. package/dist/core/copilot-env-routing.js +0 -94
  525. package/dist/core/copilot-env-routing.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type {\n\tAuthInfoLink,\n\tCredential,\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthPrompt,\n\tOAuthSelectPrompt,\n} from \"@earendil-works/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@earendil-works/pi-ai/compat\";\nimport type { CompactionReason, SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { ModelFallbackReason } from \"../../core/model-resolver-types.ts\";\nimport type { CredentialSynchronizationOperation } from \"../../core/model-runtime.js\";\nimport type { OAuthProviderMetadata } from \"../../core/oauth-login.ts\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport interface RpcModelCatalog {\n\tmodels: Model<Api>[];\n\tscopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tcustomAuthProviders: Array<{ id: string; name: string }>;\n\toauthProviders?: OAuthProviderMetadata[];\n}\n\nexport interface RpcModelRefreshResult extends RpcModelCatalog {\n\taborted: boolean;\n\terrors: Array<{ provider: string; message: string }>;\n}\n/**\n * The host supplied the API key through the login input form, so echoing it\n * back over the stdout pipe would make this response a second credential\n * egress. Only the metadata a caller needs to confirm the login travels.\n */\nexport type RpcLoginProviderResult =\n\t| (RpcModelCatalog & {\n\t\t\tprovider: string;\n\t\t\tcancelled: false;\n\t\t\ttype: \"api_key\";\n\t })\n\t| { provider: string; cancelled: true };\n\nexport type RpcOAuthLoginProviderResult =\n\t| (RpcModelCatalog & { provider: string; cancelled: false })\n\t| { provider: string; cancelled: true };\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\" }\n\t| { id?: string; type: \"get_available_models\" }\n\t| { id?: string; type: \"login_provider\"; provider: string; authType?: \"api_key\" | \"oauth\"; loginId?: string }\n\t| { id?: string; type: \"save_provider_credential\"; provider: string; credential: Credential }\n\t| { id?: string; type: \"cancel_login_provider\"; provider: string; loginId?: string }\n\t| { id?: string; type: \"logout_provider\"; provider: string }\n\t| { id?: string; type: \"refresh_models\"; timeoutMs?: number; force?: boolean; allowNetwork?: boolean }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\" }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"abort_compaction\" }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\t| { id?: string; type: \"clear_queue\" }\n\t| { id?: string; type: \"pause_queued_messages\" }\n\t| { id?: string; type: \"resume_queued_messages\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"user_bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\"; requestId?: string }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"import_session\"; inputPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\ttargetId: string;\n\t\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string };\n\t }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"get_shortcuts\" }\n\t| { id?: string; type: \"invoke_shortcut\"; key: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands and their live argument completions\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_command_completions\"; commandName: string; argumentPrefix: string };\n// ============================================================================\n// RPC Argument Completion\n// ============================================================================\n\nexport interface RpcAutocompleteItem {\n\tvalue: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** Whether the engine can evaluate argument completions for this command. */\n\thasArgumentCompletions?: boolean;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Source metadata for the owning resource */\n\tsourceInfo: SourceInfo;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: Model<Api>;\n\tmodelFallbackMessage?: string;\n\tmodelFallbackReason?: ModelFallbackReason;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tcompactionReason?: CompactionReason;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tqueuedMessagesPaused: boolean;\n\tresourceOverlaps?: ResourceOverlap[];\n}\n\nexport interface RpcLogoutProviderResult {\n\tprovider: string;\n\tauthStatus: AuthStatus;\n\tmodels: Model<Api>[];\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<Api>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<Api>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"refresh_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelRefreshResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"login_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLoginProviderResult | RpcOAuthLoginProviderResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"save_provider_credential\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| { id?: string; type: \"response\"; command: \"cancel_login_provider\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"logout_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLogoutProviderResult;\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: VerbatimCompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: { steering: string[]; followUp: string[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"pause_queued_messages\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"resume_queued_messages\"; success: true; data: { released: boolean } }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"user_bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"import_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; editorText?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_label\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_shortcuts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { shortcuts: Array<{ key: string; description?: string }> };\n\t }\n\t| { id?: string; type: \"response\"; command: \"invoke_shortcut\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_command_completions\";\n\t\t\tsuccess: true;\n\t\t\tdata: { completions: RpcAutocompleteItem[] | null };\n\t }\n\n\t// Error response (any command can fail)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t\t\terrorCode?: \"credential_synchronization\";\n\t\t\terrorDetails?: {\n\t\t\t\tproviderId: string;\n\t\t\t\toperation: CredentialSynchronizationOperation;\n\t\t\t};\n\t };\n\n// ============================================================================\n// RPC Events (stdout)\n// ============================================================================\n\n/** Events streamed by RPC mode as session activity occurs. */\nexport type RpcEvent = JsonAgentSessionEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\ntype RpcOAuthUIEnvelope = { type: \"extension_ui_request\"; id: string; provider: string; loginId: string };\n\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_auth\"; info: OAuthAuthInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_device_code\"; info: OAuthDeviceCodeInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_progress\"; message: string })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_info\"; message: string; links: AuthInfoLink[] })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_prompt\"; prompt: OAuthPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_select\"; prompt: OAuthSelectPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code\" })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code_cancel\" });\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
1
+ {"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type {\n\tAuthInfoLink,\n\tCredential,\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthPrompt,\n\tOAuthSelectPrompt,\n} from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { CompactionReason, SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { ModelFallbackReason } from \"../../core/model-resolver-types.ts\";\nimport type { CredentialSynchronizationOperation } from \"../../core/model-runtime.js\";\nimport type { OAuthProviderMetadata } from \"../../core/oauth-login.ts\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport interface RpcModelCatalog {\n\tmodels: Model<Api>[];\n\tscopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tcustomAuthProviders: Array<{ id: string; name: string }>;\n\toauthProviders?: OAuthProviderMetadata[];\n}\n\nexport interface RpcModelRefreshResult extends RpcModelCatalog {\n\taborted: boolean;\n\terrors: Array<{ provider: string; message: string }>;\n}\n/**\n * The host supplied the API key through the login input form, so echoing it\n * back over the stdout pipe would make this response a second credential\n * egress. Only the metadata a caller needs to confirm the login travels.\n */\nexport type RpcLoginProviderResult =\n\t| (RpcModelCatalog & {\n\t\t\tprovider: string;\n\t\t\tcancelled: false;\n\t\t\ttype: \"api_key\";\n\t })\n\t| { provider: string; cancelled: true };\n\nexport type RpcOAuthLoginProviderResult =\n\t| (RpcModelCatalog & { provider: string; cancelled: false })\n\t| { provider: string; cancelled: true };\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\" }\n\t| { id?: string; type: \"get_available_models\" }\n\t| { id?: string; type: \"login_provider\"; provider: string; authType?: \"api_key\" | \"oauth\"; loginId?: string }\n\t| { id?: string; type: \"save_provider_credential\"; provider: string; credential: Credential }\n\t| { id?: string; type: \"cancel_login_provider\"; provider: string; loginId?: string }\n\t| { id?: string; type: \"logout_provider\"; provider: string }\n\t| { id?: string; type: \"refresh_models\"; timeoutMs?: number; force?: boolean; allowNetwork?: boolean }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\" }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"abort_compaction\" }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\t| { id?: string; type: \"clear_queue\" }\n\t| { id?: string; type: \"pause_queued_messages\" }\n\t| { id?: string; type: \"resume_queued_messages\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"user_bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\"; requestId?: string }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"import_session\"; inputPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\ttargetId: string;\n\t\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string };\n\t }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"get_shortcuts\" }\n\t| { id?: string; type: \"invoke_shortcut\"; key: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands and their live argument completions\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_command_completions\"; commandName: string; argumentPrefix: string };\n// ============================================================================\n// RPC Argument Completion\n// ============================================================================\n\nexport interface RpcAutocompleteItem {\n\tvalue: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** Whether the engine can evaluate argument completions for this command. */\n\thasArgumentCompletions?: boolean;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Source metadata for the owning resource */\n\tsourceInfo: SourceInfo;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: Model<Api>;\n\tmodelFallbackMessage?: string;\n\tmodelFallbackReason?: ModelFallbackReason;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tcompactionReason?: CompactionReason;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tqueuedMessagesPaused: boolean;\n\tresourceOverlaps?: ResourceOverlap[];\n}\n\nexport interface RpcLogoutProviderResult {\n\tprovider: string;\n\tauthStatus: AuthStatus;\n\tmodels: Model<Api>[];\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<Api>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<Api>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"refresh_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelRefreshResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"login_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLoginProviderResult | RpcOAuthLoginProviderResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"save_provider_credential\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| { id?: string; type: \"response\"; command: \"cancel_login_provider\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"logout_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLogoutProviderResult;\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: VerbatimCompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: { steering: string[]; followUp: string[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"pause_queued_messages\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"resume_queued_messages\"; success: true; data: { released: boolean } }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"user_bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"import_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; editorText?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_label\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_shortcuts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { shortcuts: Array<{ key: string; description?: string }> };\n\t }\n\t| { id?: string; type: \"response\"; command: \"invoke_shortcut\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_command_completions\";\n\t\t\tsuccess: true;\n\t\t\tdata: { completions: RpcAutocompleteItem[] | null };\n\t }\n\n\t// Error response (any command can fail)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t\t\terrorCode?: \"credential_synchronization\";\n\t\t\terrorDetails?: {\n\t\t\t\tproviderId: string;\n\t\t\t\toperation: CredentialSynchronizationOperation;\n\t\t\t};\n\t };\n\n// ============================================================================\n// RPC Events (stdout)\n// ============================================================================\n\n/** Events streamed by RPC mode as session activity occurs. */\nexport type RpcEvent = JsonAgentSessionEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\ntype RpcOAuthUIEnvelope = { type: \"extension_ui_request\"; id: string; provider: string; loginId: string };\n\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_auth\"; info: OAuthAuthInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_device_code\"; info: OAuthDeviceCodeInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_progress\"; message: string })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_info\"; message: string; links: AuthInfoLink[] })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_prompt\"; prompt: OAuthPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_select\"; prompt: OAuthSelectPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code\" })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code_cancel\" });\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
@@ -1,4 +1,4 @@
1
- import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
1
+ import type { ImageContent, TextContent } from "@bastani/pi-ai";
2
2
  export type ToolResultContent = TextContent | ImageContent;
3
3
  export interface NormalizeToolResultImagesOptions {
4
4
  /** Whether oversized images are resized to inline provider limits. Default: true */
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result-images.d.ts","sourceRoot":"","sources":["../../src/utils/tool-result-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGvE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE3D,MAAM,WAAW,gCAAgC;IAChD,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC9C,OAAO,EAAE,iBAAiB,EAAE,EAC5B,OAAO,CAAC,EAAE,gCAAgC,GACxC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmC9B"}
1
+ {"version":3,"file":"tool-result-images.d.ts","sourceRoot":"","sources":["../../src/utils/tool-result-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGhE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE3D,MAAM,WAAW,gCAAgC;IAChD,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC9C,OAAO,EAAE,iBAAiB,EAAE,EAC5B,OAAO,CAAC,EAAE,gCAAgC,GACxC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result-images.js","sourceRoot":"","sources":["../../src/utils/tool-result-images.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,OAA4B,EAC5B,OAA0C;IAE1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,CAAC;QACtD,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,MAAM,gBAAgB,GAAG,OAAO,EAAE,gBAAgB,IAAI,IAAI,CAAC;IAC3D,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC9G,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YACnB,kFAAkF;YAClF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5G,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvF,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AACvC,CAAC","sourcesContent":["import type { ImageContent, TextContent } from \"@earendil-works/pi-ai\";\nimport { processImage } from \"./image-process.ts\";\n\nexport type ToolResultContent = TextContent | ImageContent;\n\nexport interface NormalizeToolResultImagesOptions {\n\t/** Whether oversized images are resized to inline provider limits. Default: true */\n\tautoResizeImages?: boolean;\n}\n\n/**\n * Normalize image blocks returned by tool results.\n *\n * The `read` tool and `@file` CLI attachments run their images through `processImage`, but tools\n * that produce images themselves hand back arbitrary base64 payloads that go straight into session\n * history and every subsequent provider request. Normalize them once as they enter history.\n *\n * Returns the original array when nothing changed so callers can skip rewriting the result.\n */\nexport async function normalizeToolResultImages(\n\tcontent: ToolResultContent[],\n\toptions?: NormalizeToolResultImagesOptions,\n): Promise<ToolResultContent[]> {\n\tif (!content.some((block) => block.type === \"image\")) {\n\t\treturn content;\n\t}\n\n\tconst autoResizeImages = options?.autoResizeImages ?? true;\n\tconst normalized: ToolResultContent[] = [];\n\tlet changed = false;\n\n\tfor (const block of content) {\n\t\tif (block.type !== \"image\") {\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst processed = await processImage(Buffer.from(block.data, \"base64\"), block.mimeType, { autoResizeImages });\n\t\tif (!processed.ok) {\n\t\t\t// Keep a tool-produced image when its backend is unavailable or cannot decode it.\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (processed.data === block.data && processed.mimeType === block.mimeType && processed.hints.length === 0) {\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnormalized.push({ type: \"image\", data: processed.data, mimeType: processed.mimeType });\n\t\tif (processed.hints.length > 0) {\n\t\t\tnormalized.push({ type: \"text\", text: processed.hints.join(\"\\n\") });\n\t\t}\n\t\tchanged = true;\n\t}\n\n\treturn changed ? normalized : content;\n}\n"]}
1
+ {"version":3,"file":"tool-result-images.js","sourceRoot":"","sources":["../../src/utils/tool-result-images.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,OAA4B,EAC5B,OAA0C;IAE1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,CAAC;QACtD,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,MAAM,gBAAgB,GAAG,OAAO,EAAE,gBAAgB,IAAI,IAAI,CAAC;IAC3D,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC9G,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YACnB,kFAAkF;YAClF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5G,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,SAAS;QACV,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvF,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AACvC,CAAC","sourcesContent":["import type { ImageContent, TextContent } from \"@bastani/pi-ai\";\nimport { processImage } from \"./image-process.ts\";\n\nexport type ToolResultContent = TextContent | ImageContent;\n\nexport interface NormalizeToolResultImagesOptions {\n\t/** Whether oversized images are resized to inline provider limits. Default: true */\n\tautoResizeImages?: boolean;\n}\n\n/**\n * Normalize image blocks returned by tool results.\n *\n * The `read` tool and `@file` CLI attachments run their images through `processImage`, but tools\n * that produce images themselves hand back arbitrary base64 payloads that go straight into session\n * history and every subsequent provider request. Normalize them once as they enter history.\n *\n * Returns the original array when nothing changed so callers can skip rewriting the result.\n */\nexport async function normalizeToolResultImages(\n\tcontent: ToolResultContent[],\n\toptions?: NormalizeToolResultImagesOptions,\n): Promise<ToolResultContent[]> {\n\tif (!content.some((block) => block.type === \"image\")) {\n\t\treturn content;\n\t}\n\n\tconst autoResizeImages = options?.autoResizeImages ?? true;\n\tconst normalized: ToolResultContent[] = [];\n\tlet changed = false;\n\n\tfor (const block of content) {\n\t\tif (block.type !== \"image\") {\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst processed = await processImage(Buffer.from(block.data, \"base64\"), block.mimeType, { autoResizeImages });\n\t\tif (!processed.ok) {\n\t\t\t// Keep a tool-produced image when its backend is unavailable or cannot decode it.\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (processed.data === block.data && processed.mimeType === block.mimeType && processed.hints.length === 0) {\n\t\t\tnormalized.push(block);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnormalized.push({ type: \"image\", data: processed.data, mimeType: processed.mimeType });\n\t\tif (processed.hints.length > 0) {\n\t\t\tnormalized.push({ type: \"text\", text: processed.hints.join(\"\\n\") });\n\t\t}\n\t\tchanged = true;\n\t}\n\n\treturn changed ? normalized : content;\n}\n"]}
@@ -251,7 +251,7 @@ pi.registerProvider("custom-api", {
251
251
  Add OAuth/SSO authentication that integrates with `/login`:
252
252
 
253
253
  ```typescript
254
- import type { OAuthCredentials, OAuthLoginCallbacks } from "@earendil-works/pi-ai";
254
+ import type { OAuthCredentials, OAuthLoginCallbacks } from "@bastani/pi-ai";
255
255
 
256
256
  pi.registerProvider("corporate-ai", {
257
257
  baseUrl: "https://ai.corp.com/v1",
@@ -377,7 +377,7 @@ For providers with non-standard APIs, implement `streamSimple`. Study the existi
377
377
 
378
378
  **Reference implementations:**
379
379
 
380
- Atomic uses provider implementations from its installed `@earendil-works/pi-ai` dependency. The streaming implementations behind the `api` field live under `node_modules/@earendil-works/pi-ai/dist/api/`, including:
380
+ Atomic uses provider implementations from its installed `@bastani/pi-ai` dependency. The streaming implementations behind the `api` field live under `node_modules/@bastani/pi-ai/dist/api/`, including:
381
381
  - `anthropic-messages.d.ts` / `anthropic-messages.js` - Anthropic Messages API
382
382
  - `mistral-conversations.d.ts` / `mistral-conversations.js` - Mistral Conversations/Chat streaming
383
383
  - `openai-completions.d.ts` / `openai-completions.js` - OpenAI Chat Completions
@@ -399,7 +399,7 @@ import {
399
399
  type SimpleStreamOptions,
400
400
  calculateCost,
401
401
  createAssistantMessageEventStream,
402
- } from "@earendil-works/pi-ai";
402
+ } from "@bastani/pi-ai";
403
403
 
404
404
  function streamMyProvider(
405
405
  model: Model<any>,
@@ -581,7 +581,7 @@ pi.registerProvider("my-provider", {
581
581
 
582
582
  ## Testing Your Implementation
583
583
 
584
- Test your provider against focused tests that mirror Atomic's provider contract. If you are working from the source checkout, note that provider internals come from `@earendil-works/pi-ai`; this monorepo does not contain a `packages/ai/test` directory to copy from directly:
584
+ Test your provider against focused tests that mirror Atomic's provider contract. If you are working from the source checkout, note that provider internals come from `@bastani/pi-ai`; this monorepo does not contain a `packages/ai/test` directory to copy from directly:
585
585
 
586
586
  | Test | Purpose |
587
587
  |------|---------|
@@ -711,9 +711,11 @@ interface ProviderModelConfig {
711
711
  requiresAssistantAfterToolResult?: boolean;
712
712
  requiresThinkingAsText?: boolean;
713
713
  requiresReasoningContentOnAssistantMessages?: boolean;
714
- thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";
714
+ thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";
715
715
  supportsStrictTools?: boolean;
716
- chatTemplateKwargs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort"; omitWhenOff?: boolean }>;
716
+ chatTemplateKwargs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort" | "thinking.budget"; omitWhenOff?: boolean }>;
717
+ chatTemplateArgs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort" | "thinking.budget"; omitWhenOff?: boolean }>;
718
+ thinkingTokenBudgetField?: "thinking_token_budget" | "thinking_budget" | "thinking_budget_tokens";
717
719
  cacheControlFormat?: "anthropic";
718
720
  sendSessionAffinityHeaders?: boolean;
719
721
  sessionAffinityFormat?: "openai" | "openai-nosession" | "openrouter";
@@ -725,8 +727,9 @@ interface ProviderModelConfig {
725
727
 
726
728
  The `cost` shape is equivalent to `Model<Api>["cost"]`. Base rates and every tier are complete rate sets. When multiple thresholds match, `calculateCost()` uses the highest threshold and applies that tier to all four cost buckets for the request.
727
729
 
728
- `openrouter` sends `reasoning: { effort }`. `deepseek` sends `thinking: { type: "enabled" | "disabled" }` and `reasoning_effort` when enabled. `together` sends `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` is for DashScope-style top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that read `chat_template_kwargs.enable_thinking` and need `preserve_thinking`. Use `chat-template` for configurable `chat_template_kwargs`, for example DeepSeek V3.x behind vLLM with `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }`.
729
- `cacheControlFormat: "anthropic"` applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user/assistant text content.
730
+ `openrouter` sends `reasoning: { effort }`. `deepseek` sends `thinking: { type: "enabled" | "disabled" }` and `reasoning_effort` when enabled. `together` sends `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` is for DashScope-style top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that read `chat_template_kwargs.enable_thinking` and need `preserve_thinking`. Use `chat-template` for configurable `chat_template_kwargs`, for example DeepSeek V3.x behind vLLM with `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }`. Use `thinkingFormat: "baseten"` with `chatTemplateArgs` when the provider expects toggle values under `chat_template_args` and optionally supports top-level `reasoning_effort`.
731
+ `thinkingTokenBudgetField` sends a clamped per-level thinking budget as a top-level request field (`thinking_token_budget` on vLLM, `thinking_budget` on Qwen/SGLang, `thinking_budget_tokens` on llama.cpp). `supportsThinkingTokenBudget: true` is an alias for the vLLM field name. Do not combine it with `reasoning_effort` on DashScope Qwen models.
732
+ `cacheControlFormat: "anthropic"` applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.
730
733
 
731
734
  Capability flags are enforcement claims, not preferences. `supportsStrictMode` controls strict JSON-schema tools for OpenAI-compatible APIs; Anthropic/Bedrock use `supportsStrictTools`; `supportsOpenAIGrammarTools` controls OpenAI Lark/regex custom tools. Atomic also accepts `supportsGrammarTools` as a compatibility alias and synchronizes it to the canonical OpenAI name; when both disagree, the canonical field wins. Leave these fields unset/false unless the endpoint and selected model actually preserve and enforce the corresponding request shape. See [Extensions](/extensions#constrained-sampling) for exact `constrainedSampling` modes.
732
735
 
@@ -67,8 +67,6 @@ npm run test:all # Run all tests
67
67
  npm run test:scripts # Run the repository script tests under node --test
68
68
  # Run the package Vitest suite (Node-hosted)
69
69
  npm run test --workspace=@bastani/atomic -- test/specific.test.ts
70
- # Run its Bun-hosted half. Required: the SQLite selector tests load bun:sqlite,
71
- # which the shipped binary has and Node does not.
72
70
  ```
73
71
 
74
72
  ## Deterministic installs
@@ -203,7 +203,7 @@ To share extensions via npm or git as Atomic packages, see [Atomic packages](/pa
203
203
  |---------|---------|
204
204
  | `@bastani/atomic` | Extension types (`ExtensionAPI`, `ExtensionContext`, events) |
205
205
  | `typebox` | Schema definitions for tool parameters |
206
- | `@earendil-works/pi-ai` | AI utilities (`StringEnum` for Google-compatible enums) |
206
+ | `@bastani/pi-ai` | AI utilities (`StringEnum` for Google-compatible enums) |
207
207
  | `@earendil-works/pi-tui` | TUI components for custom rendering |
208
208
 
209
209
  Registry dependencies work too. Add a `package.json` next to your extension (or in a parent directory), then install dependencies with Bun:
@@ -1860,7 +1860,7 @@ If you implement an `ExtensionRuntime` for an embedded host, provide `trackEvent
1860
1860
 
1861
1861
  ### Native providers
1862
1862
 
1863
- In addition to `registerProvider(name, config)`, extensions can register a complete native `Provider` from `@earendil-works/pi-ai` with `pi.registerProvider(provider)`. Use the native overload for provider-owned authentication, catalog refresh, and transport behavior; use the config overload for ordinary proxies and custom endpoints.
1863
+ In addition to `registerProvider(name, config)`, extensions can register a complete native `Provider` from `@bastani/pi-ai` with `pi.registerProvider(provider)`. Use the native overload for provider-owned authentication, catalog refresh, and transport behavior; use the config overload for ordinary proxies and custom endpoints.
1864
1864
 
1865
1865
  ### pi.registerProvider(name, config)
1866
1866
 
package/docs/json.md CHANGED
@@ -59,7 +59,7 @@ On the wire, Atomic narrows `message_update`: every record carries the streaming
59
59
 
60
60
  ## Message Types
61
61
 
62
- Base messages come from `@earendil-works/pi-ai` (installed as an Atomic dependency):
62
+ Base messages come from `@bastani/pi-ai` (installed as an Atomic dependency):
63
63
  - `UserMessage`
64
64
  - `AssistantMessage`
65
65
  - `ToolResultMessage`
@@ -8,7 +8,7 @@ description: "The external benchmarks that inform Atomic model selection — Art
8
8
  Atomic's model-selection docs are keyed to two live external benchmark sources rather than a hand-maintained table of scores. This page lists each benchmark, what it measures, and **when to reference it** for a given workflow role — so the docs stay useful as new models ship without a manual rewrite every time.
9
9
 
10
10
  <Warning>
11
- No single benchmark is the source of truth. Use these as inputs and validate against Atomic's own workflow evals — public suites test different task distributions than real engineering loops. When Atomic's numbers disagree with a public index, Atomic's evals win. **Last reviewed: 2026-08-16.**
11
+ No single benchmark is the source of truth. Use these as inputs and validate against Atomic's own workflow evals — public suites test different task distributions than real engineering loops. When Atomic's numbers disagree with a public index, Atomic's evals win. **Last reviewed: 2026-08-21.**
12
12
  </Warning>
13
13
 
14
14
  ## The two sources at a glance
@@ -32,7 +32,7 @@ Artificial Analysis separates performance by benchmark, which lets a workflow pi
32
32
 
33
33
  ### Composite indices
34
34
 
35
- - **Intelligence Index (v4.1.1)** — composite of the nine evaluations below. Use as a first-pass filter when a new model appears.
35
+ - **Intelligence Index (v4.1.1)** — composite of the nine evaluations below, weighted across four categories: Agents 34%, Coding 24%, Scientific Reasoning 24%, General 18%. Use as a first-pass filter when a new model appears.
36
36
  - **Coding Index** — coding-weighted sub-index. Cross-check against DeepSWE.
37
37
  - **Agentic Index** — tool use, planning, autonomy, complex problem solving. The best AA signal for orchestrator and reviewer roles.
38
38
 
@@ -14,7 +14,7 @@ This page gives workflow authors and runtime policy code a practical way to answ
14
14
  It is a **static reference**. It does not change runtime model routing — routing is configured elsewhere. Treat these recommendations as a starting point and validate against your own workflow evals.
15
15
 
16
16
  <Note>
17
- The table below is a snapshot of the [DeepSWE](https://deepswe.datacurve.ai/) leaderboard (v1.1, highest published thinking level per model), a long-horizon coding-agent benchmark reporting `pass@1` and average dollars per task. Benchmarks and pricing drift and new models ship constantly, so **treat the live leaderboards as authoritative** and refresh this page from them rather than hand-maintaining scores. See [Benchmark sources & when to reference each](/models/artificial-analysis-index). **Last compiled: 2026-08-16.**
17
+ The table below is a snapshot of the [DeepSWE](https://deepswe.datacurve.ai/) leaderboard (v1.1, highest published thinking level per model), a long-horizon coding-agent benchmark reporting `pass@1` and average dollars per task. Benchmarks and pricing drift and new models ship constantly, so **treat the live leaderboards as authoritative** and refresh this page from them rather than hand-maintaining scores. See [Benchmark sources & when to reference each](/models/artificial-analysis-index). **Last compiled: 2026-08-21.**
18
18
  </Note>
19
19
 
20
20
  ## Benchmark levels are measurement settings
@@ -30,15 +30,16 @@ reports the ambiguity. Use `--provider <provider> --model <id>` or `--model <pro
30
30
 
31
31
  ## Recommendation chart
32
32
 
33
- The current highest-effort-config Pareto frontier is **claude-opus-5** (accuracy ceiling), **gpt-5.6-sol**, **gpt-5.6-terra**, **gpt-5.6-luna**, **deepseek-v4-pro**, and **deepseek-v4-flash**. Everything else is dominated on DeepSWE cost and accuracy and earns a place only through role fit or provider diversity. For the frontier reasoning, see [Pareto Efficiency](/models/pareto-efficiency).
33
+ The current highest-effort-config Pareto frontier is **claude-opus-5** (accuracy ceiling), **gpt-5.6-sol**, **glm-5.3**, **gpt-5.6-luna**, **deepseek-v4-pro**, and **deepseek-v4-flash**. Everything else is dominated on DeepSWE cost and accuracy and earns a place only through role fit or provider diversity. For the frontier reasoning, see [Pareto Efficiency](/models/pareto-efficiency).
34
34
 
35
35
  | Model [benchmark measurement level] | pass@1 | $/task | Verdict | Use it for |
36
36
  | --- | --- | --- | --- | --- |
37
37
  | claude-opus-5 [max] | 74% | $11.84 | Accuracy ceiling / frontier | Final approval and the hardest debugging when one more point can justify the cost |
38
38
  | gpt-5.6-sol [max] | 73% | $8.39 | Frontier | High-cost judgment gates; nearly the top score at lower cost than Opus 5 |
39
- | gpt-5.6-terra [max] | 70% | $3.96 | Frontier best top-tier value | High-accuracy reviewers and planners |
40
- | claude-fable-5 [max] | 70% | $21.63 | Drop | Sol and Terra match or beat its score for much less |
41
- | kimi-k3 [max] | 69% | $4.65 | Diversity fallback | Open-weights diversity, though Terra is cheaper and more accurate on DeepSWE |
39
+ | gpt-5.6-terra [max] | 70% | $3.96 | Off the live board | Last published measurement (July pricing); no longer displayed on the live leaderboard as of the August 20 refresh — re-verify against the source before relying on it |
40
+ | claude-fable-5 [max] | 70% | $21.63 | Drop | Sol matches or beats its score for much less |
41
+ | glm-5.3 [max] | 69% | $3.99 | Frontier open-weights value | Best open-weights cost/accuracy point; matches Kimi K3's rounded score for less |
42
+ | kimi-k3 [max] | 69% | $4.65 | Dominated | GLM-5.3 matches its rounded score for $0.66 less; Moonshot-family diversity only |
42
43
  | gpt-5.6-luna [max] | 67% | $0.61 | Frontier — best general value | Research, orchestration, workers, and code simplification |
43
44
  | gpt-5.5 [xhigh] | 67% | $7.23 | Superseded | Luna matches its score for less than one tenth of the task cost |
44
45
  | grok-4.6 [xhigh] | 67% | $5.50 | Provider fallback | xAI diversity; Luna has the same rounded score at lower DeepSWE task cost |
@@ -58,10 +59,9 @@ The current highest-effort-config Pareto frontier is **claude-opus-5** (accuracy
58
59
  | kimi-k2.7-code [low] | 31% | $2.19 | Superseded | Kimi K3 is the current family fallback |
59
60
  | claude-sonnet-4.6 [high] | 30% | $5.52 | Drop everywhere | Removed from all chains |
60
61
  | gemini-3.1-pro [high] | 12% | $2.14 | Drop everywhere | Removed from all chains |
61
- | glm-5.3 [high] | unmeasured | unmeasured | Diversity fallback | Current direct Z.AI fallback; GLM-5.2 measurements are not relabeled |
62
62
 
63
63
  <Note>
64
- DeepSWE values above use the v1.1 results and reporting corrections published through August 14, 2026; `pass@1` is rounded as on the live leaderboard and confidence intervals are omitted here. The highest published thinking level is a measurement choice, not a production default. See the live page for intervals, output tokens, steps, lower-effort configurations, and later corrections.
64
+ DeepSWE values above use the v1.1 results and reporting corrections published through August 20, 2026; `pass@1` is rounded as on the live leaderboard and confidence intervals are omitted here. The highest published thinking level is a measurement choice, not a production default. GPT-5.6 Terra's July measurement no longer appears on the live board, so its row keeps the last published values. See the live page for intervals, output tokens, steps, lower-effort configurations, and later corrections.
65
65
  </Note>
66
66
 
67
67
  ## Role-based thinking effort
@@ -82,7 +82,7 @@ Reserve `max` for a high-cost-of-error role or an explicit user request. An expl
82
82
  Pick by the cost of being wrong in each role, not by raw accuracy. Match the role to the benchmark that best measures it (see [Benchmark sources](/models/artificial-analysis-index)).
83
83
 
84
84
  - **Reviewer / judgment gates** — use `max` when the reviewer makes a security, identity, adversarial, or final-approval decision whose wrong verdict discards an entire loop. `claude-opus-5` is the DeepSWE accuracy ceiling; `gpt-5.6-sol` is the lower-cost near-peer. Use another family when decorrelated errors matter.
85
- - **Codebase mapping / planner** — start at `high` for repository mapping, lifecycle analysis, compatibility, and plans. `gpt-5.6-terra` is the strongest top-tier value at its measured `max` configuration; raise production effort to `max` only when the plan gates a high-cost loop or the user asks for it.
85
+ - **Codebase mapping / planner** — start at `high` for repository mapping, lifecycle analysis, compatibility, and plans. `gpt-5.6-sol` is the strongest top-tier value at its measured `max` configuration, and `glm-5.3` carries the open-weights mid tier; raise production effort to `max` only when the plan gates a high-cost loop or the user asks for it.
86
86
  - **Debugger / triage / repair** — start at `high`; deep reasoning pays off when root-causing or repairing is costly. Weight DeepSWE and Terminal-Bench together rather than treating either as a complete measure.
87
87
  - **Research / synthesis** — use `high` for demanding research and evidence reconciliation; use `medium` for routine synthesis when the evidence is already strong. `gpt-5.6-luna` remains the workhorse. Benchmark to weight: AA-LCR and AA-Omniscience.
88
88
  - **Orchestrator / worker / cheap loops** — Luna offers the best broad cost/accuracy balance. DeepSeek V4 Pro and Flash occupy the budget frontier but take 155 and 153 steps on average; use them only when that longer path fits. Use another family when provider diversity matters.
@@ -10,7 +10,7 @@ A model is **Pareto-efficient** (on the frontier) if no other model is both chea
10
10
  The axes here are `pass@1` (accuracy) and `average dollars per task` (cost), taken from the [DeepSWE](https://deepswe.datacurve.ai/) coding-agent leaderboard. For the full table and role guidance, see [Model Selection](/models/model-selection).
11
11
 
12
12
  <Note>
13
- Figures are a snapshot of DeepSWE v1.1 using the highest published thinking level per model and reporting corrections through August 14, 2026. The frontier moves whenever a model, run, or price changes — DeepSWE publishes a live cost-vs-score scatter, so **read the frontier off the live chart** rather than trusting a static list. **Last compiled: 2026-08-16.**
13
+ Figures are a snapshot of DeepSWE v1.1 using the highest published thinking level per model and reporting corrections through August 20, 2026. The frontier moves whenever a model, run, or price changes — DeepSWE publishes a live cost-vs-score scatter, so **read the frontier off the live chart** rather than trusting a static list. **Last compiled: 2026-08-21.**
14
14
  </Note>
15
15
 
16
16
  ## The frontier
@@ -20,22 +20,22 @@ Six highest-effort model configurations currently sit on the frontier, from the
20
20
  - **deepseek-v4-flash [max]** — 53% for $0.10. The cheapest point, with lower accuracy and 153 average steps.
21
21
  - **deepseek-v4-pro [max]** — 63% for $0.24. A large accuracy gain for another $0.14 per task, with 155 average steps.
22
22
  - **gpt-5.6-luna [max]** — 67% for $0.61. The best broad value on the board.
23
- - **gpt-5.6-terra [max]** — 70% for $3.96. The best top-tier value after the July price correction.
23
+ - **glm-5.3 [max]** — 69% for $3.99. The open-weights mid-tier point; matches Kimi K3's rounded score for less.
24
24
  - **gpt-5.6-sol [max]** — 73% for $8.39. The lower-cost near-peer to the accuracy leader.
25
25
  - **claude-opus-5 [max]** — 74% for $11.84. The current accuracy ceiling.
26
26
 
27
27
  ## What changed — the frontier moved
28
28
 
29
- The August results and reporting fixes changed both ends of the frontier:
29
+ The August 20 refresh reshuffled the middle of the frontier:
30
30
 
31
- - **Claude Opus 5 [max]** set a new 74% ceiling, one point above Sol, at $11.84 per task.
32
- - **DeepSeek V4 Flash and Pro [max]** added $0.10 and $0.24 budget-frontier points. Their 153–155 average steps remain a separate latency and loop-length cost.
33
- - **GPT-5.6 Luna and Terra [max]** now cost $0.61 and $3.96 per task after corrected pricing, strengthening both positions.
31
+ - **GLM-5.3 [max]** is now measured — 69% for $3.99 with 124 average steps and takes the mid-tier frontier slot.
32
+ - **GPT-5.6 Terra [max]** no longer appears on the live board; its July measurement (70% for $3.96) is retained in [Model Selection](/models/model-selection) as history, not a current frontier point.
33
+ - **Kimi K3 [max]** is now strictly dominated: GLM-5.3 matches its rounded score for $0.66 less per task.
34
34
 
35
35
  ## Dominated models — and why
36
36
 
37
- - **claude-fable-5 [max]** — Sol is more accurate and much cheaper; Terra matches its rounded score for less than one fifth of the task cost.
38
- - **kimi-k3 [max]** — Terra is one point more accurate and $0.69 cheaper; Kimi remains useful for open-weights diversity.
37
+ - **claude-fable-5 [max]** — Sol is more accurate and much cheaper; GLM-5.3 comes within a point for less than one fifth of the task cost.
38
+ - **kimi-k3 [max]** — GLM-5.3 matches its rounded score and is $0.66 cheaper; Kimi remains useful for Moonshot-family diversity.
39
39
  - **gpt-5.5 [xhigh]** and **grok-4.6 [xhigh]** — Luna matches their rounded 67% for $0.61.
40
40
  - **gemini-3.7-flash [high]** — Luna is two points more accurate and less than one third of its task cost.
41
41
  - **grok-4.5 [high]**, **muse-spark-1.1 [xhigh]**, **muse-spark-1.2 [xhigh]**, and **gpt-5.4 [xhigh]** — the new DeepSeek and GPT-5.6 points dominate these former budget choices.
@@ -47,8 +47,8 @@ The August results and reporting fixes changed both ends of the frontier:
47
47
  Efficiency is not the only axis. A dominated model can still earn a slot when it decorrelates errors or fills a niche:
48
48
 
49
49
  - **grok-4.6** — retained as the operational xAI and OpenRouter provider-diversity fallback.
50
- - **glm-5.3 [high]** — unmeasured in the current DeepSWE snapshot; retained as a direct Z.AI provider-diversity fallback. GLM-5.2 results are not relabeled as GLM-5.3.
51
- - **kimi-k3** — retained as a strong open-weights provider-diversity option despite Terra's strict DeepSWE dominance.
50
+ - **glm-5.2 [max]** — kept only as a measured predecessor; its results are never relabeled as GLM-5.3, which is now measured directly on the frontier.
51
+ - **kimi-k3** — retained as a Moonshot-family provider-diversity option despite GLM-5.3's strict DeepSWE dominance.
52
52
  - **claude-opus-4.8 [max]** — retained where Anthropic diversity or its long-context behavior has separate value.
53
53
  - **claude-fable-5** — kept where Anthropic-family behavior is specifically wanted, such as the quality-first, unbenchmarked design chain.
54
54
  - **Unmeasured models** — a family without current DeepSWE or Artificial Analysis coverage may remain an operational default, but should not inherit a predecessor's score.
package/docs/models.md CHANGED
@@ -289,6 +289,8 @@ For `modelOverrides`, `cost` is partial: any supplied scalar rate replaces that
289
289
 
290
290
  This override changes only the base input rate, retains the model's other base rates, and clears its inherited long-context tiers.
291
291
 
292
+ A constant thinking-token cap can go here too, but it will not follow `thinkingBudgets` or leave room for the answer. Prefer `compat.thinkingTokenBudgetField` (or the `supportsThinkingTokenBudget` alias) for that.
293
+
292
294
  ### Thinking Level Map
293
295
 
294
296
  Use `thinkingLevelMap` on a model to describe model-specific thinking controls. Keys are Atomic thinking levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. A level is selectable only when the active model supports it; `xhigh` and `max` are not universal provider capabilities.
@@ -518,14 +520,16 @@ For providers with partial OpenAI compatibility, use the `compat` field.
518
520
  | `supportsReasoningEffort` | Support for `reasoning_effort` parameter |
519
521
  | `supportsUsageInStreaming` | Supports `stream_options: { include_usage: true }` (default: `true`) |
520
522
  | `supportsFinishReason` | Whether streamed responses include `finish_reason`. When `false`, Atomic infers `stop` or `toolUse` when the stream ends. Default: `true`. |
521
- | `supportsThinkingTokenBudget` | Whether the endpoint accepts top-level vLLM `thinking_token_budget`; use it with reasoning models that share the response budget. Default: `false`. |
523
+ | `supportsThinkingTokenBudget` | Alias for `thinkingTokenBudgetField: "thinking_token_budget"` (vLLM). Prefer `thinkingTokenBudgetField`. Default: `false`. |
524
+ | `thinkingTokenBudgetField` | Top-level request field used to cap reasoning tokens from `thinkingBudgets`, clamped so at least 1024 tokens remain for the answer. `"thinking_token_budget"` (vLLM), `"thinking_budget"` (Qwen/DashScope/SGLang), `"thinking_budget_tokens"` (llama.cpp). Off by default; not set on the generated catalog. |
522
525
  | `maxTokensField` | Use `max_completion_tokens` or `max_tokens` |
523
526
  | `requiresToolResultName` | Include `name` on tool result messages |
524
527
  | `requiresAssistantAfterToolResult` | Insert an assistant message before a user message after tool results |
525
528
  | `requiresThinkingAsText` | Convert thinking blocks to plain text |
526
529
  | `requiresReasoningContentOnAssistantMessages` | Include empty `reasoning_content` on all replayed assistant messages when reasoning is enabled |
527
530
  | `thinkingFormat` | Use `reasoning_effort`, `openrouter`, `deepseek`, `together`, `zai`, `qwen`, `chat-template`, or `qwen-chat-template` thinking parameters |
528
- | `chatTemplateKwargs` | `chat_template_kwargs` values for `thinkingFormat: "chat-template"`; use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for Atomic-controlled thinking values |
531
+ | `chatTemplateKwargs` | `chat_template_kwargs` values for `thinkingFormat: "chat-template"`; use `{ "$var": "thinking.enabled" }`, `{ "$var": "thinking.effort" }`, or `{ "$var": "thinking.budget" }` for Atomic-controlled thinking values |
532
+ | `chatTemplateArgs` | `chat_template_args` values for `thinkingFormat: "baseten"`; use `{ "$var": "thinking.enabled" }`, `{ "$var": "thinking.effort" }`, or `{ "$var": "thinking.budget" }` for Atomic-controlled thinking values |
529
533
  | `cacheControlFormat` | Use Anthropic-style `cache_control` markers on the system prompt, last tool definition, and last user/assistant text content. Currently only `anthropic` is supported. |
530
534
  | `supportsStrictMode` | OpenAI-compatible strict JSON-schema function tools. This is not a general guarantee for every API. |
531
535
  | `supportsStrictTools` | Anthropic/Bedrock strict-tool capability, normally generated from verified model metadata. |
@@ -546,7 +550,9 @@ Strict JSON-schema support currently includes OpenAI, Anthropic, capable Bedrock
546
550
  Authenticated remote catalogs are cached in `models-store.json`. Atomic revalidates pi.dev catalogs with the stored ETag through `If-None-Match`; an empty `304 Not Modified` is success and retains the cached body while updating its check time. A newer bundled catalog wins over an older persisted overlay even when package file mtimes are misleading. Final visibility is built-ins, persisted/remote data subject to freshness, the single active-agent `models.json` configuration, and live provider catalogs/overrides; Atomic does not merge project `.atomic`/`.pi` model files or a legacy agent-directory fallback. Provider failures retain the last usable provider-specific snapshot.
547
551
 
548
552
  Claude Opus 5 is present in the generated Anthropic and Amazon Bedrock catalogs. Its metadata enables adaptive thinking, including `xhigh` where advertised. Bedrock uses its generated inference-profile ID, prompt-caching and strict-tool metadata, and preserves provider/AWS validation errors. Custom entries must reproduce those capabilities honestly rather than copying a display name alone.
549
- `openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking` and `preserve_thinking`. Use `chat-template` for vLLM/Hugging Face chat templates that need configurable `chat_template_kwargs`, such as `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }` for DeepSeek V3.x templates.
553
+ `openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking` and `preserve_thinking`. Use `chat-template` for vLLM/Hugging Face chat templates that need configurable `chat_template_kwargs`, such as `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }` for DeepSeek V3.x templates. Use `thinkingFormat: "baseten"` with `chatTemplateArgs` for providers that expose toggle controls through `chat_template_args` and optionally support top-level `reasoning_effort`.
554
+
555
+ `thinkingTokenBudgetField` is independent of `thinkingFormat`. Do not enable it on the generated Qwen catalog: those models already send `reasoning_effort`, and DashScope rejects `thinking_budget` together with `reasoning_effort`.
550
556
 
551
557
  `cacheControlFormat: "anthropic"` is for OpenAI-compatible providers that expose Anthropic-style prompt caching through `cache_control` markers on text content and tool definitions.
552
558
 
package/docs/packages.md CHANGED
@@ -185,7 +185,7 @@ When a package manifest exists, declared resource arrays normally define what lo
185
185
 
186
186
  Third-party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, themes, or workflows also belong in `dependencies`. When Atomic installs a package from npm or git, it runs the configured npm-compatible install command, so those dependencies are installed automatically.
187
187
 
188
- Atomic bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@bastani/atomic`, `@earendil-works/pi-tui`, `typebox`.
188
+ Atomic bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@bastani/pi-ai`, `@earendil-works/pi-agent-core`, `@bastani/atomic`, `@earendil-works/pi-tui`, `typebox`.
189
189
 
190
190
  Workflow packages should author workflow files with `import { workflow } from "@bastani/workflows"`, `import { Type } from "typebox"`, and export definitions produced by `workflow({ ... })`. Do not use the removed `runWorkflow` object-form API, and do not hand-roll objects with `__piWorkflow: true`; discovery accepts only definitions minted by `workflow({ ... })`. `@bastani/workflows` is not a separate npm package: its types resolve through `@bastani/atomic`, so list `@bastani/atomic` and `typebox` in `peerDependencies`. A pure workflow-only package also adds the one-line ambient opt-in noted above; a package that imports `@bastani/atomic` elsewhere picks the types up automatically.
191
191
 
package/docs/providers.md CHANGED
@@ -83,6 +83,8 @@ OAuth logins get their Copilot host from the token GitHub issues during login. E
83
83
 
84
84
  A `models.json` provider `baseUrl` for `github-copilot` overrides all of the above. Without `COPILOT_GITHUB_TOKEN` the provider is left exactly as upstream `pi-ai` defines it.
85
85
 
86
+ Chat requests authenticated with a raw `COPILOT_GITHUB_TOKEN` (including `github_pat_`, `ghp_`, `gho_`, and `ghu_` tokens) send `Copilot-Integration-Id: copilot-developer-cli`. A `Copilot-Integration-Id` supplied through `models.json` provider headers, `modelOverrides`, or per request always takes precedence, including an explicit `vscode-chat` value. Exchanged OAuth tokens containing a `tid=` segment keep the existing OAuth headers unchanged. The env-token routing implementation and its exported helpers now live in `@bastani/pi-ai`.
87
+
86
88
  Business and enterprise tokens sent to the individual host return `421 Misdirected Request`; if you see that, set `COPILOT_API_TARGET` to the host your organization issues.
87
89
 
88
90
  ### xAI (Grok/X subscription)
@@ -157,7 +159,7 @@ Remote pi.dev catalogs persist their ETag and are revalidated with `If-None-Matc
157
159
 
158
160
  Z.AI and Z.AI Coding Plan (China) default to `glm-5.3` (`zai/glm-5.3` and `zai-coding-cn/glm-5.3`); the generated catalogs expose reasoning without a thinking-level map, so built-in chains use the supported `:high` suffix rather than inventing distinct `:xhigh` or `:max` tiers. OpenRouter currently exposes `z-ai/glm-5.2` but not `z-ai/glm-5.3`, so Atomic does not ship an unavailable OpenRouter GLM-5.3 fallback. Baseten also has no GLM-5.3 catalog entry, so its documented default remains `zai-org/GLM-5.2` and its catalog supplies the provider-specific thinking levels. Qwen Token Plan Individual defaults to `qwen3.8-max` and uses the international `QWEN_TOKEN_PLAN_API_KEY` shared with the existing Qwen Token Plan provider.
159
161
 
160
- Reference for environment variables and `auth.json` keys: `findEnvKeys()` / `getEnvApiKey()` in the installed `@earendil-works/pi-ai` dependency (`node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts`). The private provider map those functions use is in `node_modules/@earendil-works/pi-ai/dist/env-api-keys.js`; Atomic does not include a separate `packages/ai` source directory in this monorepo.
162
+ Reference for environment variables and `auth.json` keys: `findEnvKeys()` / `getEnvApiKey()` in the installed `@bastani/pi-ai` dependency (`node_modules/@bastani/pi-ai/dist/env-api-keys.d.ts`). The private provider map those functions use is in `node_modules/@bastani/pi-ai/dist/env-api-keys.js`; Atomic does not include a separate `packages/ai` source directory in this monorepo.
161
163
 
162
164
  #### Auth File
163
165
 
@@ -349,7 +351,7 @@ import {
349
351
  DefaultResourceLoader,
350
352
  type AiGatewayBinding,
351
353
  } from "@bastani/atomic";
352
- import { streamSimple as anthropicStreamSimple } from "@earendil-works/pi-ai/api/anthropic-messages";
354
+ import { streamSimple as anthropicStreamSimple } from "@bastani/pi-ai/api/anthropic-messages";
353
355
 
354
356
  // `AI` is the Workers AI binding; `AiGatewayBinding` is the structural type for it,
355
357
  // so the snippet needs no `@cloudflare/workers-types` dependency.
@@ -410,7 +412,7 @@ export default {
410
412
  };
411
413
  ```
412
414
 
413
- Every request under the gateway prefix becomes one `env.AI.gateway(id).run({ provider, endpoint, headers, query })` call in the provider's native wire format, so streaming behaves identically to the HTTPS route. The transport serves only its gateway-bound client: URLs outside the prefix, and in-prefix requests the universal endpoint cannot express (non-POST, non-JSON body), reject with a descriptive error rather than being forwarded. Repeat the same pattern with `@earendil-works/pi-ai/api/openai-completions` (or `openai-responses`) to cover the `/openai` and `/compat` passthrough models of the same provider.
415
+ Every request under the gateway prefix becomes one `env.AI.gateway(id).run({ provider, endpoint, headers, query })` call in the provider's native wire format, so streaming behaves identically to the HTTPS route. The transport serves only its gateway-bound client: URLs outside the prefix, and in-prefix requests the universal endpoint cannot express (non-POST, non-JSON body), reject with a descriptive error rather than being forwarded. Repeat the same pattern with `@bastani/pi-ai/api/openai-completions` (or `openai-responses`) to cover the `/openai` and `/compat` passthrough models of the same provider.
414
416
 
415
417
  ### Cloudflare Workers AI
416
418
 
@@ -5,7 +5,7 @@ This page gets you from install to a useful first Atomic session. Atomic is the
5
5
  ## Prerequisites
6
6
 
7
7
  - **Node.js 24 LTS or newer** — Atomic requires the latest Node LTS runtime. Check with `node --version`.
8
- - **A package manager** — use npm (included with Node), pnpm, Yarn, or Bun. Bun installs need Bun 1.3.14+.
8
+ - **A package manager** — use npm (included with Node), pnpm, Yarn, or Bun. Bun installs need Bun 1.4.0+.
9
9
  - **Model-provider access** — Use `/login` after startup. Supports provider subscriptions and APIs.
10
10
 
11
11
  ## Install
package/docs/rpc.md CHANGED
@@ -1413,7 +1413,7 @@ Parse errors:
1413
1413
  ## Types
1414
1414
 
1415
1415
  Source files and installed definitions:
1416
- - `node_modules/@earendil-works/pi-ai/dist/types.d.ts` - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
1416
+ - `node_modules/@bastani/pi-ai/dist/types.d.ts` - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
1417
1417
  - `node_modules/@earendil-works/pi-agent-core/dist/types.d.ts` - `AgentMessage`, `AgentEvent`
1418
1418
  - [`src/core/messages.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/messages.ts) - `BashExecutionMessage`
1419
1419
  - [`src/modes/rpc/rpc-types.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
package/docs/sdk.md CHANGED
@@ -447,7 +447,7 @@ When you pass a custom `ResourceLoader`, `cwd` and `agentDir` no longer control
447
447
  ### Model
448
448
 
449
449
  ```typescript
450
- import { getModel } from "@earendil-works/pi-ai/compat";
450
+ import { getModel } from "@bastani/pi-ai/compat";
451
451
  import { ModelRuntime } from "@bastani/atomic";
452
452
 
453
453
  const modelRuntime = await ModelRuntime.create();
@@ -1050,7 +1050,7 @@ interface LoadExtensionsResult {
1050
1050
  ## Complete Example
1051
1051
 
1052
1052
  ```typescript
1053
- import { getModel } from "@earendil-works/pi-ai/compat";
1053
+ import { getModel } from "@bastani/pi-ai/compat";
1054
1054
  import { Type } from "typebox";
1055
1055
  import {
1056
1056
  AuthStorage,
@@ -32,7 +32,7 @@ Source on GitHub ([atomic](https://github.com/bastani-inc/atomic)):
32
32
  - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
33
  - [`packages/coding-agent/src/core/messages.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
34
 
35
- Base message and agent event types are provided by Atomic's installed runtime dependencies (`@earendil-works/pi-ai` and `@earendil-works/pi-agent-core`), not by separate `packages/ai` or `packages/agent` directories in this monorepo. For TypeScript definitions in your project, inspect `node_modules/@bastani/atomic/dist/`, `node_modules/@earendil-works/pi-ai/dist/`, and `node_modules/@earendil-works/pi-agent-core/dist/`.
35
+ Base message and agent event types are provided by Atomic's installed runtime dependencies (`@bastani/pi-ai` and `@earendil-works/pi-agent-core`), not by separate `packages/ai` or `packages/agent` directories in this monorepo. For TypeScript definitions in your project, inspect `node_modules/@bastani/atomic/dist/`, `node_modules/@bastani/pi-ai/dist/`, and `node_modules/@earendil-works/pi-agent-core/dist/`.
36
36
 
37
37
  ## Message Types
38
38
 
@@ -67,7 +67,7 @@ interface ToolCall {
67
67
  }
68
68
  ```
69
69
 
70
- ### Base Message Types (from `@earendil-works/pi-ai`)
70
+ ### Base Message Types (from `@bastani/pi-ai`)
71
71
 
72
72
  ```typescript
73
73
  interface UserMessage {
package/docs/settings.md CHANGED
@@ -35,7 +35,7 @@ Settings and trust JSON files may start with a UTF-8 BOM, as commonly written by
35
35
  | `defaultModel` | string | - | Default model ID |
36
36
  | `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`; the active model must support the selected level |
37
37
  | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
38
- | `thinkingBudgets` | object | - | Custom token budgets per thinking level |
38
+ | `thinkingBudgets` | object | - | Custom token budgets per thinking level. Anthropic, Google, and Bedrock use these natively. OpenAI-compatible models use them when `compat.thinkingTokenBudgetField` (or `supportsThinkingTokenBudget`) is set. |
39
39
  | `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses and their attributed wasted tokens |
40
40
  | `fallbackModels` | string[] | - | Ordered fallback models, written as `"provider/model"` with optional model-supported reasoning suffixes such as `:high`, `:xhigh`, or `:max`. Used by main-chat turns and, since compaction fallback rungs, borrowed for compaction planner requests |
41
41
 
@@ -267,6 +267,7 @@ The `/settings` picker offers these presets:
267
267
  | `transport` | string | `"auto"` | Preferred transport for providers that support multiple transports: `"sse"`, `"websocket"`, `"websocket-cached"`, or `"auto"` |
268
268
  | `httpIdleTimeoutMs` | number or string | `600000` | HTTP idle timeout in milliseconds, a duration string, or `"disabled"`; also used by providers with explicit stream idle timeouts. |
269
269
  | `websocketConnectTimeoutMs` | number or string | `15000` | WebSocket connect/open handshake timeout; accepts milliseconds, a duration string, or `"disabled"`/`0` to disable. |
270
+ | `streamDeadlineMs` | number or string | `300000` | Maximum idle gap between two provider stream events, enforced below the HTTP layer; accepts milliseconds, duration strings such as `30s`, `5m`, or `1h`, or `"disabled"`/`0` to disable. A stream that stalls without an error — for example a response body that fails to decompress — is cut at this deadline and retried or failed over instead of hanging the request. |
270
271
 
271
272
  Older settings with a boolean `websockets` value are migrated to `transport`: `true` becomes `"websocket"` and `false` becomes `"sse"` when `transport` is not already set.
272
273
 
package/docs/subagents.md CHANGED
@@ -161,18 +161,17 @@ Single-agent calls accept `progress: boolean` in foreground and resumed mode. `p
161
161
  subagent({ agent: "worker", task: "Implement the approved fix.", progress: true })
162
162
  ```
163
163
 
164
- ## Nested and fanout boundaries
164
+ ## Delegation and child boundaries
165
165
 
166
166
  Child-safety boundaries are enforced by typed admission policy and the bundled subagent extension:
167
167
 
168
168
  - In-process child sessions load bundled extensions through normal discovery. The `subagent` tool may therefore be registered when the child's active tool selection permits it, including the default no-allowlist case; an explicit allowlist may omit it. Tool presence does not grant fanout. The bundled subagents skill remains parent-only and is stripped from child prompts, including fanout-authorized children.
169
169
  - Child context is filtered to remove parent orchestration artifacts, old control/status messages, and prior parent `subagent` tool calls/results.
170
- - Non-fanout children are instructed that they are not the parent orchestrator and must not propose or run subagents.
171
- - Nested fanout is available only for explicitly authorized agents whose resolved tools include `subagent`. Authorized fanout children receive narrower instructions that limit delegation to the assigned fanout.
172
- - Typed admission policy lets a non-fanout child use only `list`, `get`, `status`, and `doctor`; delegation, `resume`, and `interrupt` receive the fanout refusal. A management-restricted child is also refused `create`, `update`, and `delete`.
173
- - The recursion guard has a hard maximum of five delegated subagent levels. The admitted depth policy may choose a lower value from `0` to `5`; deeper admission is refused rather than inherited from process environment state.
170
+ - Children are instructed that they are not the parent orchestrator and must complete their assigned task directly rather than delegating.
171
+ - Delegation is exactly one level deep and is not configurable. A session admitted as a subagent child is refused every launch, `resume`, and `interrupt`; only `list`, `get`, `status`, and `doctor` stay available. A management-restricted child is also refused `create`, `update`, and `delete`.
172
+ - The rule is enforced twice: the subagent executor refuses a child before any run starts, and the Rust admission door refuses a child deeper than the single permitted level. Admitted depth is typed admission state, never inherited from process environment state.
174
173
 
175
- This keeps the parent session responsible for orchestration unless you deliberately choose a fanout-capable custom agent.
174
+ This keeps the parent session responsible for orchestration.
176
175
 
177
176
  ## Custom agents
178
177