@bastani/atomic 0.9.27 → 0.9.28-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/broker.ts +13 -1
  4. package/dist/builtin/intercom/package.json +2 -2
  5. package/dist/builtin/mcp/CHANGELOG.md +6 -0
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/subagents/package.json +3 -3
  8. package/dist/builtin/web-access/index.bundle.mjs +194 -44
  9. package/dist/builtin/web-access/package.json +3 -3
  10. package/dist/builtin/workflows/CHANGELOG.md +31 -0
  11. package/dist/builtin/workflows/builtin/{chunk-gw7rghda.js → chunk-aqv8ny38.js} +257 -259
  12. package/dist/builtin/workflows/builtin/{chunk-gts8wgjr.js → chunk-br4ac9a3.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-9bhs02gm.js → chunk-p3xmajmj.js} +439 -40
  14. package/dist/builtin/workflows/builtin/chunk-p6jagvyf.js +8 -0
  15. package/dist/builtin/workflows/builtin/goal.js +2 -2
  16. package/dist/builtin/workflows/builtin/index.js +4 -4
  17. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  18. package/dist/builtin/workflows/package.json +2 -2
  19. package/dist/builtin/workflows/src/authoring.d.ts +14 -0
  20. package/dist/builtin/workflows/src/extension/index.bundle.mjs +108110 -107201
  21. package/dist/builtin/workflows/src/index.js +42226 -41077
  22. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +16 -11
  23. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +16 -1
  24. package/dist/cli/args.d.ts +1 -0
  25. package/dist/cli/args.d.ts.map +1 -1
  26. package/dist/cli/args.js +12 -5
  27. package/dist/cli/args.js.map +1 -1
  28. package/dist/cli/credential-print.d.ts +1 -1
  29. package/dist/cli/credential-print.d.ts.map +1 -1
  30. package/dist/cli/credential-print.js +2 -56
  31. package/dist/cli/credential-print.js.map +1 -1
  32. package/dist/codemode-worker.js +99 -3
  33. package/dist/core/agent-session-accessors.d.ts.map +1 -1
  34. package/dist/core/agent-session-accessors.js +6 -1
  35. package/dist/core/agent-session-accessors.js.map +1 -1
  36. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  37. package/dist/core/agent-session-compaction.js +20 -3
  38. package/dist/core/agent-session-compaction.js.map +1 -1
  39. package/dist/core/agent-session-events.d.ts.map +1 -1
  40. package/dist/core/agent-session-events.js +3 -2
  41. package/dist/core/agent-session-events.js.map +1 -1
  42. package/dist/core/agent-session-extension-bindings.d.ts +6 -0
  43. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  44. package/dist/core/agent-session-extension-bindings.js +96 -12
  45. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  46. package/dist/core/agent-session-methods.d.ts +4 -1
  47. package/dist/core/agent-session-methods.d.ts.map +1 -1
  48. package/dist/core/agent-session-methods.js.map +1 -1
  49. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  50. package/dist/core/agent-session-prompt.js +19 -3
  51. package/dist/core/agent-session-prompt.js.map +1 -1
  52. package/dist/core/agent-session-services.d.ts +1 -0
  53. package/dist/core/agent-session-services.d.ts.map +1 -1
  54. package/dist/core/agent-session-services.js +1 -0
  55. package/dist/core/agent-session-services.js.map +1 -1
  56. package/dist/core/agent-session-state.d.ts.map +1 -1
  57. package/dist/core/agent-session-state.js +3 -2
  58. package/dist/core/agent-session-state.js.map +1 -1
  59. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  60. package/dist/core/agent-session-tool-registry.js +11 -16
  61. package/dist/core/agent-session-tool-registry.js.map +1 -1
  62. package/dist/core/agent-session-types.d.ts +1 -0
  63. package/dist/core/agent-session-types.d.ts.map +1 -1
  64. package/dist/core/agent-session-types.js.map +1 -1
  65. package/dist/core/agent-session.d.ts +2 -0
  66. package/dist/core/agent-session.d.ts.map +1 -1
  67. package/dist/core/agent-session.js +5 -0
  68. package/dist/core/agent-session.js.map +1 -1
  69. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  70. package/dist/core/auth-storage-backends.js +2 -1
  71. package/dist/core/auth-storage-backends.js.map +1 -1
  72. package/dist/core/auth-storage.d.ts +1 -1
  73. package/dist/core/auth-storage.d.ts.map +1 -1
  74. package/dist/core/auth-storage.js +15 -7
  75. package/dist/core/auth-storage.js.map +1 -1
  76. package/dist/core/azure-provider-compat.d.ts +8 -0
  77. package/dist/core/azure-provider-compat.d.ts.map +1 -0
  78. package/dist/core/azure-provider-compat.js +65 -0
  79. package/dist/core/azure-provider-compat.js.map +1 -0
  80. package/dist/core/child-session-options.d.ts +1 -1
  81. package/dist/core/child-session-options.d.ts.map +1 -1
  82. package/dist/core/child-session-options.js +11 -2
  83. package/dist/core/child-session-options.js.map +1 -1
  84. package/dist/core/compaction/classifier-compaction.d.ts +13 -0
  85. package/dist/core/compaction/classifier-compaction.d.ts.map +1 -0
  86. package/dist/core/compaction/classifier-compaction.js +110 -0
  87. package/dist/core/compaction/classifier-compaction.js.map +1 -0
  88. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  89. package/dist/core/compaction/compaction-boundary.js +2 -6
  90. package/dist/core/compaction/compaction-boundary.js.map +1 -1
  91. package/dist/core/compaction/compaction-runner.d.ts +16 -1
  92. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  93. package/dist/core/compaction/compaction-runner.js +97 -12
  94. package/dist/core/compaction/compaction-runner.js.map +1 -1
  95. package/dist/core/compaction/compaction-types.d.ts +18 -1
  96. package/dist/core/compaction/compaction-types.d.ts.map +1 -1
  97. package/dist/core/compaction/compaction-types.js +1 -1
  98. package/dist/core/compaction/compaction-types.js.map +1 -1
  99. package/dist/core/compaction/fallback-planner.d.ts +1 -0
  100. package/dist/core/compaction/fallback-planner.d.ts.map +1 -1
  101. package/dist/core/compaction/fallback-planner.js +2 -0
  102. package/dist/core/compaction/fallback-planner.js.map +1 -1
  103. package/dist/core/compaction/index.d.ts +3 -0
  104. package/dist/core/compaction/index.d.ts.map +1 -1
  105. package/dist/core/compaction/index.js +3 -0
  106. package/dist/core/compaction/index.js.map +1 -1
  107. package/dist/core/compaction/model-resolver.d.ts +16 -0
  108. package/dist/core/compaction/model-resolver.d.ts.map +1 -0
  109. package/dist/core/compaction/model-resolver.js +18 -0
  110. package/dist/core/compaction/model-resolver.js.map +1 -0
  111. package/dist/core/compaction/morph-compaction.d.ts +14 -0
  112. package/dist/core/compaction/morph-compaction.d.ts.map +1 -0
  113. package/dist/core/compaction/morph-compaction.js +99 -0
  114. package/dist/core/compaction/morph-compaction.js.map +1 -0
  115. package/dist/core/compaction/pi-summary-fallback.d.ts +34 -0
  116. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -0
  117. package/dist/core/compaction/pi-summary-fallback.js +357 -0
  118. package/dist/core/compaction/pi-summary-fallback.js.map +1 -0
  119. package/dist/core/compaction/planner-outcome.d.ts +10 -6
  120. package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
  121. package/dist/core/compaction/planner-outcome.js +11 -4
  122. package/dist/core/compaction/planner-outcome.js.map +1 -1
  123. package/dist/core/compaction/range-planner-diagnostics.d.ts +3 -1
  124. package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -1
  125. package/dist/core/compaction/range-planner-diagnostics.js +11 -0
  126. package/dist/core/compaction/range-planner-diagnostics.js.map +1 -1
  127. package/dist/core/compaction/range-planner.d.ts +3 -3
  128. package/dist/core/compaction/range-planner.d.ts.map +1 -1
  129. package/dist/core/compaction/range-planner.js +59 -28
  130. package/dist/core/compaction/range-planner.js.map +1 -1
  131. package/dist/core/compaction/region-trimming.d.ts.map +1 -1
  132. package/dist/core/compaction/region-trimming.js +7 -0
  133. package/dist/core/compaction/region-trimming.js.map +1 -1
  134. package/dist/core/compaction/structured-compaction-input.d.ts +19 -0
  135. package/dist/core/compaction/structured-compaction-input.d.ts.map +1 -0
  136. package/dist/core/compaction/structured-compaction-input.js +70 -0
  137. package/dist/core/compaction/structured-compaction-input.js.map +1 -0
  138. package/dist/core/compaction/transcript-serialization.d.ts +1 -0
  139. package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
  140. package/dist/core/compaction/transcript-serialization.js +26 -0
  141. package/dist/core/compaction/transcript-serialization.js.map +1 -1
  142. package/dist/core/extensions/api-types.d.ts +3 -2
  143. package/dist/core/extensions/api-types.d.ts.map +1 -1
  144. package/dist/core/extensions/api-types.js.map +1 -1
  145. package/dist/core/extensions/context-types.d.ts +1 -0
  146. package/dist/core/extensions/context-types.d.ts.map +1 -1
  147. package/dist/core/extensions/context-types.js.map +1 -1
  148. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  149. package/dist/core/extensions/loader-api.js +5 -0
  150. package/dist/core/extensions/loader-api.js.map +1 -1
  151. package/dist/core/extensions/loader-host-modules.d.ts +1 -0
  152. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  153. package/dist/core/extensions/loader-host-modules.js +12 -0
  154. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  155. package/dist/core/extensions/runner-context.d.ts +10 -4
  156. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  157. package/dist/core/extensions/runner-context.js +47 -3
  158. package/dist/core/extensions/runner-context.js.map +1 -1
  159. package/dist/core/extensions/runner.d.ts +11 -4
  160. package/dist/core/extensions/runner.d.ts.map +1 -1
  161. package/dist/core/extensions/runner.js +38 -9
  162. package/dist/core/extensions/runner.js.map +1 -1
  163. package/dist/core/extensions/tool-types.d.ts +2 -0
  164. package/dist/core/extensions/tool-types.d.ts.map +1 -1
  165. package/dist/core/extensions/tool-types.js.map +1 -1
  166. package/dist/core/extensions/workflow-events.d.ts +49 -0
  167. package/dist/core/extensions/workflow-events.d.ts.map +1 -1
  168. package/dist/core/extensions/workflow-events.js.map +1 -1
  169. package/dist/core/extensions/workflow-run-control-hub.d.ts +16 -4
  170. package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
  171. package/dist/core/extensions/workflow-run-control-hub.js +72 -1
  172. package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
  173. package/dist/core/extensions/workflow-run-control.d.ts +11 -3
  174. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  175. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  176. package/dist/core/fast-model-variants.d.ts +1 -1
  177. package/dist/core/fast-model-variants.js +1 -1
  178. package/dist/core/fast-model-variants.js.map +1 -1
  179. package/dist/core/keybindings.d.ts +4 -4
  180. package/dist/core/messages.d.ts +1 -0
  181. package/dist/core/messages.d.ts.map +1 -1
  182. package/dist/core/messages.js +5 -1
  183. package/dist/core/messages.js.map +1 -1
  184. package/dist/core/model-config.d.ts.map +1 -1
  185. package/dist/core/model-config.js +2 -1
  186. package/dist/core/model-config.js.map +1 -1
  187. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  188. package/dist/core/model-fallback-failures.js +5 -1
  189. package/dist/core/model-fallback-failures.js.map +1 -1
  190. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  191. package/dist/core/model-resolver-cli.js +5 -1
  192. package/dist/core/model-resolver-cli.js.map +1 -1
  193. package/dist/core/model-resolver-defaults.js +1 -1
  194. package/dist/core/model-resolver-defaults.js.map +1 -1
  195. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  196. package/dist/core/model-resolver-initial.js +6 -1
  197. package/dist/core/model-resolver-initial.js.map +1 -1
  198. package/dist/core/model-resolver-patterns.d.ts.map +1 -1
  199. package/dist/core/model-resolver-patterns.js +2 -1
  200. package/dist/core/model-resolver-patterns.js.map +1 -1
  201. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  202. package/dist/core/model-resolver-scope.js +3 -1
  203. package/dist/core/model-resolver-scope.js.map +1 -1
  204. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  205. package/dist/core/model-runtime-streaming.js +2 -0
  206. package/dist/core/model-runtime-streaming.js.map +1 -1
  207. package/dist/core/model-runtime.d.ts.map +1 -1
  208. package/dist/core/model-runtime.js +48 -22
  209. package/dist/core/model-runtime.js.map +1 -1
  210. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  211. package/dist/core/provider-composer-internal.js +4 -1
  212. package/dist/core/provider-composer-internal.js.map +1 -1
  213. package/dist/core/provider-display-names.js +1 -1
  214. package/dist/core/provider-display-names.js.map +1 -1
  215. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  216. package/dist/core/remote-catalog-provider.js +3 -0
  217. package/dist/core/remote-catalog-provider.js.map +1 -1
  218. package/dist/core/resource-loader-core.d.ts +1 -0
  219. package/dist/core/resource-loader-core.d.ts.map +1 -1
  220. package/dist/core/resource-loader-core.js +4 -0
  221. package/dist/core/resource-loader-core.js.map +1 -1
  222. package/dist/core/resource-loader-internals.d.ts +1 -0
  223. package/dist/core/resource-loader-internals.d.ts.map +1 -1
  224. package/dist/core/resource-loader-internals.js.map +1 -1
  225. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  226. package/dist/core/resource-loader-reload.js +28 -5
  227. package/dist/core/resource-loader-reload.js.map +1 -1
  228. package/dist/core/resource-loader-types.d.ts +2 -0
  229. package/dist/core/resource-loader-types.d.ts.map +1 -1
  230. package/dist/core/resource-loader-types.js.map +1 -1
  231. package/dist/core/sdk-types.d.ts +6 -4
  232. package/dist/core/sdk-types.d.ts.map +1 -1
  233. package/dist/core/sdk-types.js.map +1 -1
  234. package/dist/core/sdk.d.ts.map +1 -1
  235. package/dist/core/sdk.js +5 -3
  236. package/dist/core/sdk.js.map +1 -1
  237. package/dist/core/session-lifecycle-work.d.ts +2 -1
  238. package/dist/core/session-lifecycle-work.d.ts.map +1 -1
  239. package/dist/core/session-lifecycle-work.js +15 -1
  240. package/dist/core/session-lifecycle-work.js.map +1 -1
  241. package/dist/core/session-manager-history.d.ts.map +1 -1
  242. package/dist/core/session-manager-history.js +4 -2
  243. package/dist/core/session-manager-history.js.map +1 -1
  244. package/dist/core/settings-manager-basic-accessors.d.ts +2 -0
  245. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  246. package/dist/core/settings-manager-basic-accessors.js +33 -4
  247. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  248. package/dist/core/settings-manager-core.d.ts.map +1 -1
  249. package/dist/core/settings-manager-core.js +2 -0
  250. package/dist/core/settings-manager-core.js.map +1 -1
  251. package/dist/core/settings-storage.d.ts.map +1 -1
  252. package/dist/core/settings-storage.js +2 -1
  253. package/dist/core/settings-storage.js.map +1 -1
  254. package/dist/core/settings-types.d.ts +1 -0
  255. package/dist/core/settings-types.d.ts.map +1 -1
  256. package/dist/core/settings-types.js.map +1 -1
  257. package/dist/core/skills.d.ts +1 -1
  258. package/dist/core/skills.d.ts.map +1 -1
  259. package/dist/core/skills.js +3 -1
  260. package/dist/core/skills.js.map +1 -1
  261. package/dist/core/system-prompt.d.ts +3 -0
  262. package/dist/core/system-prompt.d.ts.map +1 -1
  263. package/dist/core/system-prompt.js +7 -3
  264. package/dist/core/system-prompt.js.map +1 -1
  265. package/dist/core/tool-loadout.d.ts.map +1 -1
  266. package/dist/core/tool-loadout.js +8 -1
  267. package/dist/core/tool-loadout.js.map +1 -1
  268. package/dist/core/tool-selection.d.ts +13 -0
  269. package/dist/core/tool-selection.d.ts.map +1 -0
  270. package/dist/core/tool-selection.js +43 -0
  271. package/dist/core/tool-selection.js.map +1 -0
  272. package/dist/core/tools/read.d.ts +7 -0
  273. package/dist/core/tools/read.d.ts.map +1 -1
  274. package/dist/core/tools/read.js +11 -1
  275. package/dist/core/tools/read.js.map +1 -1
  276. package/dist/core/transcript.d.ts +58 -0
  277. package/dist/core/transcript.d.ts.map +1 -0
  278. package/dist/core/transcript.js +185 -0
  279. package/dist/core/transcript.js.map +1 -0
  280. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  281. package/dist/extensions/codemode/execute.js +2 -1
  282. package/dist/extensions/codemode/execute.js.map +1 -1
  283. package/dist/extensions/codemode/index.d.ts.map +1 -1
  284. package/dist/extensions/codemode/index.js +1 -0
  285. package/dist/extensions/codemode/index.js.map +1 -1
  286. package/dist/extensions/codemode/tool.d.ts +4 -1
  287. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  288. package/dist/extensions/codemode/tool.js +6 -3
  289. package/dist/extensions/codemode/tool.js.map +1 -1
  290. package/dist/extensions/herdr/index.d.ts.map +1 -1
  291. package/dist/extensions/herdr/index.js +15 -10
  292. package/dist/extensions/herdr/index.js.map +1 -1
  293. package/dist/extensions/herdr/pane-owner.d.ts +6 -2
  294. package/dist/extensions/herdr/pane-owner.d.ts.map +1 -1
  295. package/dist/extensions/herdr/pane-owner.js +19 -4
  296. package/dist/extensions/herdr/pane-owner.js.map +1 -1
  297. package/dist/extensions/mcp/client/oauth/flow.d.ts.map +1 -1
  298. package/dist/extensions/mcp/client/oauth/flow.js +14 -1
  299. package/dist/extensions/mcp/client/oauth/flow.js.map +1 -1
  300. package/dist/extensions/mcp/client/oauth/types.d.ts +1 -0
  301. package/dist/extensions/mcp/client/oauth/types.d.ts.map +1 -1
  302. package/dist/extensions/mcp/client/oauth/types.js.map +1 -1
  303. package/dist/extensions/mcp/index.js.map +1 -1
  304. package/dist/extensions/mcp/runtime.d.ts +5 -2
  305. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  306. package/dist/extensions/mcp/runtime.js +18 -4
  307. package/dist/extensions/mcp/runtime.js.map +1 -1
  308. package/dist/index.d.ts +2 -0
  309. package/dist/index.d.ts.map +1 -1
  310. package/dist/index.js +2 -0
  311. package/dist/index.js.map +1 -1
  312. package/dist/main.d.ts.map +1 -1
  313. package/dist/main.js +2 -0
  314. package/dist/main.js.map +1 -1
  315. package/dist/migrations-azure.d.ts +4 -0
  316. package/dist/migrations-azure.d.ts.map +1 -0
  317. package/dist/migrations-azure.js +41 -0
  318. package/dist/migrations-azure.js.map +1 -0
  319. package/dist/migrations.d.ts.map +1 -1
  320. package/dist/migrations.js +2 -0
  321. package/dist/migrations.js.map +1 -1
  322. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  323. package/dist/modes/interactive/components/chat-session-host-state.js +2 -1
  324. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  325. package/dist/modes/interactive/components/chat-transcript.d.ts +2 -0
  326. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  327. package/dist/modes/interactive/components/chat-transcript.js +9 -3
  328. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  329. package/dist/modes/interactive/components/compaction-boundary-message.d.ts +2 -0
  330. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  331. package/dist/modes/interactive/components/compaction-boundary-message.js +15 -3
  332. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  333. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  334. package/dist/modes/interactive/components/settings-selector-items.js +43 -0
  335. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  336. package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -0
  337. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  338. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  339. package/dist/modes/interactive/interactive-prompt-turn.js +6 -4
  340. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  341. package/dist/modes/interactive/interactive-render-chat.js +13 -1
  342. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  343. package/dist/modes/interactive/interactive-selectors.js +8 -0
  344. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  345. package/dist/modes/interactive/interactive-session-runtime.js +2 -0
  346. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  347. package/dist/modes/interactive/interactive-startup.js +1 -1
  348. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  349. package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -1
  350. package/dist/modes/interactive/theme/tui-theme.js +1 -0
  351. package/dist/modes/interactive/theme/tui-theme.js.map +1 -1
  352. package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
  353. package/dist/modes/interactive-engine/engine-args.js +1 -0
  354. package/dist/modes/interactive-engine/engine-args.js.map +1 -1
  355. package/dist/utils/credential-redaction.d.ts +2 -0
  356. package/dist/utils/credential-redaction.d.ts.map +1 -0
  357. package/dist/utils/credential-redaction.js +20 -0
  358. package/dist/utils/credential-redaction.js.map +1 -0
  359. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  360. package/dist/utils/syntax-highlight.js +6 -1
  361. package/dist/utils/syntax-highlight.js.map +1 -1
  362. package/docs/codemode.md +3 -2
  363. package/docs/compaction/reference.md +10 -4
  364. package/docs/compaction.md +40 -8
  365. package/docs/docs.json +1 -0
  366. package/docs/extensions/api-reference.md +18 -0
  367. package/docs/extensions/authoring.md +1 -1
  368. package/docs/extensions/events.md +2 -2
  369. package/docs/extensions.md +2 -0
  370. package/docs/keybindings.md +9 -9
  371. package/docs/mcp-servers.md +4 -0
  372. package/docs/providers.md +33 -3
  373. package/docs/reference/cli.md +10 -3
  374. package/docs/sdk/reference.md +16 -1
  375. package/docs/sdk/web-server.md +325 -0
  376. package/docs/sdk.md +83 -1
  377. package/docs/security.md +1 -1
  378. package/docs/workflows/api-reference.md +74 -4
  379. package/docs/workflows/authoring.md +6 -2
  380. package/docs/workflows/builtins.md +4 -0
  381. package/docs/workflows/operations.md +12 -4
  382. package/npm-shrinkwrap.json +78 -74
  383. package/package.json +9 -9
@@ -0,0 +1,20 @@
1
+ const CREDENTIAL_SHAPES = [
2
+ /\bBearer\s+[\w.~+/-]+=*/giu,
3
+ /\beyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]+/gu,
4
+ /\b(?:sk|pk|rk|api|key|tok|token|secret)[-_][\w-]{12,}/giu,
5
+ ];
6
+ const CREDENTIAL_FIELD_NAME = "(?:x-)?(?:api[-_]?key|apikey|auth(?:orization)?|access[-_]?token|refresh[-_]?token|id[-_]?token|client[-_]?secret|secret[-_]?key|private[-_]?key|session[-_]?key|password|passwd|token|secret|key)";
7
+ const CREDENTIAL_AUTH_SCHEME = "(?:Bearer|Basic|Digest|Token|ApiKey|OAuth)";
8
+ const CREDENTIAL_CONTEXTS = [
9
+ new RegExp(String.raw `\b${CREDENTIAL_FIELD_NAME}\s*:\s*(?:${CREDENTIAL_AUTH_SCHEME}\s+)?[^\s,;}"']+`, "giu"),
10
+ new RegExp(String.raw `(["']?)${CREDENTIAL_FIELD_NAME}\1\s*:\s*(["'])(?:(?!\2).)*\2`, "giu"),
11
+ new RegExp(String.raw `\b${CREDENTIAL_FIELD_NAME}\s*=\s*[^\s&,;}"']+`, "giu"),
12
+ ];
13
+ export function redactCredentialShapes(text) {
14
+ const byContext = CREDENTIAL_CONTEXTS.reduce((masked, context) => masked.replace(context, (match) => {
15
+ const separator = /[:=]/u.exec(match);
16
+ return separator ? `${match.slice(0, separator.index + 1)} [redacted]` : "[redacted]";
17
+ }), text);
18
+ return CREDENTIAL_SHAPES.reduce((masked, shape) => masked.replace(shape, "[redacted]"), byContext);
19
+ }
20
+ //# sourceMappingURL=credential-redaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-redaction.js","sourceRoot":"","sources":["../../src/utils/credential-redaction.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAsB;IAC5C,4BAA4B;IAC5B,qCAAqC;IACrC,0DAA0D;CAC1D,CAAC;AAEF,MAAM,qBAAqB,GAC1B,oMAAoM,CAAC;AACtM,MAAM,sBAAsB,GAAG,4CAA4C,CAAC;AAE5E,MAAM,mBAAmB,GAAsB;IAC9C,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,KAAK,qBAAqB,aAAa,sBAAsB,kBAAkB,EAAE,KAAK,CAAC;IAC5G,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,UAAU,qBAAqB,+BAA+B,EAAE,KAAK,CAAC;IAC3F,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,KAAK,qBAAqB,qBAAqB,EAAE,KAAK,CAAC;CAC5E,CAAC;AAEF,MAAM,UAAU,sBAAsB,CAAC,IAAY;IAClD,MAAM,SAAS,GAAG,mBAAmB,CAAC,MAAM,CAC3C,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CACnB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;IACvF,CAAC,CAAC,EACH,IAAI,CACJ,CAAC;IACF,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC;AACpG,CAAC","sourcesContent":["const CREDENTIAL_SHAPES: readonly RegExp[] = [\n\t/\\bBearer\\s+[\\w.~+/-]+=*/giu,\n\t/\\beyJ[\\w-]{8,}\\.[\\w-]{8,}\\.[\\w-]+/gu,\n\t/\\b(?:sk|pk|rk|api|key|tok|token|secret)[-_][\\w-]{12,}/giu,\n];\n\nconst CREDENTIAL_FIELD_NAME =\n\t\"(?:x-)?(?:api[-_]?key|apikey|auth(?:orization)?|access[-_]?token|refresh[-_]?token|id[-_]?token|client[-_]?secret|secret[-_]?key|private[-_]?key|session[-_]?key|password|passwd|token|secret|key)\";\nconst CREDENTIAL_AUTH_SCHEME = \"(?:Bearer|Basic|Digest|Token|ApiKey|OAuth)\";\n\nconst CREDENTIAL_CONTEXTS: readonly RegExp[] = [\n\tnew RegExp(String.raw`\\b${CREDENTIAL_FIELD_NAME}\\s*:\\s*(?:${CREDENTIAL_AUTH_SCHEME}\\s+)?[^\\s,;}\"']+`, \"giu\"),\n\tnew RegExp(String.raw`([\"']?)${CREDENTIAL_FIELD_NAME}\\1\\s*:\\s*([\"'])(?:(?!\\2).)*\\2`, \"giu\"),\n\tnew RegExp(String.raw`\\b${CREDENTIAL_FIELD_NAME}\\s*=\\s*[^\\s&,;}\"']+`, \"giu\"),\n];\n\nexport function redactCredentialShapes(text: string): string {\n\tconst byContext = CREDENTIAL_CONTEXTS.reduce(\n\t\t(masked, context) =>\n\t\t\tmasked.replace(context, (match) => {\n\t\t\t\tconst separator = /[:=]/u.exec(match);\n\t\t\t\treturn separator ? `${match.slice(0, separator.index + 1)} [redacted]` : \"[redacted]\";\n\t\t\t}),\n\t\ttext,\n\t);\n\treturn CREDENTIAL_SHAPES.reduce((masked, shape) => masked.replace(shape, \"[redacted]\"), byContext);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"syntax-highlight.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"AAqDA,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAezD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CACvB;AAoED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,cAAmB,GAAG,MAAM,CAoDtF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAQ9E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
1
+ {"version":3,"file":"syntax-highlight.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"AAqDA,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAezD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CACvB;AAoED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,cAAmB,GAAG,MAAM,CAyDtF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAQ9E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -125,7 +125,12 @@ export function renderHighlightedHtml(html, theme = {}) {
125
125
  return;
126
126
  }
127
127
  const formatter = getActiveFormatter(scopes, theme);
128
- output += formatter ? formatter(textBuffer) : textBuffer;
128
+ output += formatter
129
+ ? textBuffer
130
+ .split("\n")
131
+ .map((line) => (line ? formatter(line) : line))
132
+ .join("\n")
133
+ : textBuffer;
129
134
  textBuffer = "";
130
135
  };
131
136
  let index = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"syntax-highlight.js","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,IAAI,MAAM,0BAA0B,CAAC;AAC5C,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,C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,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;AAC7C,CAAC","sourcesContent":["/// <reference path=\"./highlight-js.d.ts\" />\nimport hljs from \"highlight.js/lib/core.js\";\nimport bash from \"highlight.js/lib/languages/bash.js\";\nimport c from \"highlight.js/lib/languages/c.js\";\nimport cpp from \"highlight.js/lib/languages/cpp.js\";\nimport csharp from \"highlight.js/lib/languages/csharp.js\";\nimport dart from \"highlight.js/lib/languages/dart.js\";\nimport go from \"highlight.js/lib/languages/go.js\";\nimport groovy from \"highlight.js/lib/languages/groovy.js\";\nimport java from \"highlight.js/lib/languages/java.js\";\nimport javascript from \"highlight.js/lib/languages/javascript.js\";\nimport kotlin from \"highlight.js/lib/languages/kotlin.js\";\nimport lua from \"highlight.js/lib/languages/lua.js\";\nimport nix from \"highlight.js/lib/languages/nix.js\";\nimport perl from \"highlight.js/lib/languages/perl.js\";\nimport php from \"highlight.js/lib/languages/php.js\";\nimport python from \"highlight.js/lib/languages/python.js\";\nimport ruby from \"highlight.js/lib/languages/ruby.js\";\nimport rust from \"highlight.js/lib/languages/rust.js\";\nimport scala from \"highlight.js/lib/languages/scala.js\";\nimport swift from \"highlight.js/lib/languages/swift.js\";\nimport typescript from \"highlight.js/lib/languages/typescript.js\";\nimport { decodeHtmlEntityAt } from \"./html.ts\";\n\nconst eagerLanguages = {\n\tpython,\n\tjava,\n\tgo,\n\tjavascript,\n\tcpp,\n\ttypescript,\n\tphp,\n\truby,\n\tc,\n\tcsharp,\n\tnix,\n\tbash,\n\trust,\n\tscala,\n\tkotlin,\n\tswift,\n\tdart,\n\tgroovy,\n\tperl,\n\tlua,\n};\n\nfor (const [name, language] of Object.entries(eagerLanguages)) {\n\thljs.registerLanguage(name, language);\n}\n\nlet allLanguagesPromise: Promise<void> | undefined;\n\nexport function loadAllHighlightLanguages(): Promise<void> {\n\tif (!allLanguagesPromise) {\n\t\tallLanguagesPromise = new Promise((resolve) => {\n\t\t\tsetImmediate(() => {\n\t\t\t\tvoid import(\"highlight.js/lib/index.js\").then(\n\t\t\t\t\t() => resolve(),\n\t\t\t\t\t() => {\n\t\t\t\t\t\t// Eager languages and plaintext fallback remain available.\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t}\n\treturn allLanguagesPromise;\n}\n\nexport type HighlightFormatter = (text: string) => string;\nexport type HighlightTheme = Partial<Record<string, HighlightFormatter>>;\n\nexport interface HighlightOptions {\n\tlanguage?: string;\n\tignoreIllegals?: boolean;\n\tlanguageSubset?: string[];\n\ttheme?: HighlightTheme;\n}\n\nconst SPAN_CLOSE = \"</span>\";\nconst HIGHLIGHT_CLASS_PREFIX = \"hljs-\";\n\nfunction getScopeFromSpanTag(tag: string): string | undefined {\n\tconst match = /\\sclass\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/.exec(tag);\n\tconst classValue = match?.[1] ?? match?.[2];\n\tif (!classValue) {\n\t\treturn undefined;\n\t}\n\n\tfor (const className of classValue.split(/\\s+/)) {\n\t\tif (className.startsWith(HIGHLIGHT_CLASS_PREFIX)) {\n\t\t\treturn className.slice(HIGHLIGHT_CLASS_PREFIX.length);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction getScopeFormatter(scope: string, theme: HighlightTheme): HighlightFormatter | undefined {\n\tconst exact = theme[scope];\n\tif (exact) {\n\t\treturn exact;\n\t}\n\n\tconst dotIndex = scope.indexOf(\".\");\n\tif (dotIndex !== -1) {\n\t\tconst prefixFormatter = theme[scope.slice(0, dotIndex)];\n\t\tif (prefixFormatter) {\n\t\t\treturn prefixFormatter;\n\t\t}\n\t}\n\n\tconst dashIndex = scope.indexOf(\"-\");\n\tif (dashIndex !== -1) {\n\t\tconst prefixFormatter = theme[scope.slice(0, dashIndex)];\n\t\tif (prefixFormatter) {\n\t\t\treturn prefixFormatter;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction getActiveFormatter(scopes: Array<string | undefined>, theme: HighlightTheme): HighlightFormatter | undefined {\n\tfor (let i = scopes.length - 1; i >= 0; i--) {\n\t\tconst scope = scopes[i];\n\t\tif (!scope) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst formatter = getScopeFormatter(scope, theme);\n\t\tif (formatter) {\n\t\t\treturn formatter;\n\t\t}\n\t}\n\treturn theme.default;\n}\n\nfunction isSpanOpenTagStart(html: string, index: number): boolean {\n\tif (!html.startsWith(\"<span\", index)) {\n\t\treturn false;\n\t}\n\tconst nextChar = html[index + \"<span\".length];\n\treturn nextChar === \">\" || nextChar === \" \" || nextChar === \"\\t\" || nextChar === \"\\n\" || nextChar === \"\\r\";\n}\n\nexport function renderHighlightedHtml(html: string, theme: HighlightTheme = {}): string {\n\tlet output = \"\";\n\tlet textBuffer = \"\";\n\tconst scopes: Array<string | undefined> = [];\n\n\tconst flushText = () => {\n\t\tif (!textBuffer) {\n\t\t\treturn;\n\t\t}\n\t\tconst formatter = getActiveFormatter(scopes, theme);\n\t\toutput += formatter ? formatter(textBuffer) : textBuffer;\n\t\ttextBuffer = \"\";\n\t};\n\n\tlet index = 0;\n\twhile (index < html.length) {\n\t\tif (isSpanOpenTagStart(html, index)) {\n\t\t\tconst tagEndIndex = html.indexOf(\">\", index + 5);\n\t\t\tif (tagEndIndex !== -1) {\n\t\t\t\tflushText();\n\t\t\t\tconst tag = html.slice(index, tagEndIndex + 1);\n\t\t\t\tconst scope = getScopeFromSpanTag(tag);\n\t\t\t\tscopes.push(scope);\n\t\t\t\tindex = tagEndIndex + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (html.startsWith(SPAN_CLOSE, index)) {\n\t\t\tflushText();\n\t\t\tif (scopes.length > 0) {\n\t\t\t\tscopes.pop();\n\t\t\t}\n\t\t\tindex += SPAN_CLOSE.length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (html[index] === \"&\") {\n\t\t\tconst decoded = decodeHtmlEntityAt(html, index);\n\t\t\tif (decoded) {\n\t\t\t\ttextBuffer += decoded.text;\n\t\t\t\tindex += decoded.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\ttextBuffer += html[index];\n\t\tindex++;\n\t}\n\n\tflushText();\n\treturn output;\n}\n\nexport function highlight(code: string, options: HighlightOptions = {}): string {\n\tconst html = options.language\n\t\t? hljs.highlight(code, {\n\t\t\t\tlanguage: options.language,\n\t\t\t\tignoreIllegals: options.ignoreIllegals,\n\t\t\t}).value\n\t\t: hljs.highlightAuto(code, options.languageSubset).value;\n\treturn renderHighlightedHtml(html, options.theme);\n}\n\nexport function supportsLanguage(name: string): boolean {\n\treturn hljs.getLanguage(name) !== undefined;\n}\n"]}
1
+ {"version":3,"file":"syntax-highlight.js","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,IAAI,MAAM,0BAA0B,CAAC;AAC5C,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,CAAC,MAAM,iCAAiC,CAAC;AAChD,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,MAAM,MAAM,sCAAsC,CAAC;AAC1D,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAClD,OAAO,MAAM,MAAM,sCAAsC,CAAC;AAC1D,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,UAAU,MAAM,0CAA0C,CAAC;AAClE,OAAO,MAAM,MAAM,sCAAsC,CAAC;AAC1D,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,MAAM,MAAM,sCAAsC,CAAC;AAC1D,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,KAAK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AAC;YAChD,IAAI,OAAO,EAAE,CAAC;gBACb,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;gBAC3B,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;gBACxB,SAAS;YACV,CAAC;QACF,CAAC;QAED,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,KAAK,EAAE,CAAC;IACT,CAAC;IAED,SAAS,EAAE,CAAC;IACZ,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAO,GAAqB,EAAE;IACrE,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ;QAC5B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YACrB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;SACtC,CAAC,CAAC,KAAK;QACT,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;IAC1D,OAAO,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;AAC7C,CAAC","sourcesContent":["/// <reference path=\"./highlight-js.d.ts\" />\nimport hljs from \"highlight.js/lib/core.js\";\nimport bash from \"highlight.js/lib/languages/bash.js\";\nimport c from \"highlight.js/lib/languages/c.js\";\nimport cpp from \"highlight.js/lib/languages/cpp.js\";\nimport csharp from \"highlight.js/lib/languages/csharp.js\";\nimport dart from \"highlight.js/lib/languages/dart.js\";\nimport go from \"highlight.js/lib/languages/go.js\";\nimport groovy from \"highlight.js/lib/languages/groovy.js\";\nimport java from \"highlight.js/lib/languages/java.js\";\nimport javascript from \"highlight.js/lib/languages/javascript.js\";\nimport kotlin from \"highlight.js/lib/languages/kotlin.js\";\nimport lua from \"highlight.js/lib/languages/lua.js\";\nimport nix from \"highlight.js/lib/languages/nix.js\";\nimport perl from \"highlight.js/lib/languages/perl.js\";\nimport php from \"highlight.js/lib/languages/php.js\";\nimport python from \"highlight.js/lib/languages/python.js\";\nimport ruby from \"highlight.js/lib/languages/ruby.js\";\nimport rust from \"highlight.js/lib/languages/rust.js\";\nimport scala from \"highlight.js/lib/languages/scala.js\";\nimport swift from \"highlight.js/lib/languages/swift.js\";\nimport typescript from \"highlight.js/lib/languages/typescript.js\";\nimport { decodeHtmlEntityAt } from \"./html.ts\";\n\nconst eagerLanguages = {\n\tpython,\n\tjava,\n\tgo,\n\tjavascript,\n\tcpp,\n\ttypescript,\n\tphp,\n\truby,\n\tc,\n\tcsharp,\n\tnix,\n\tbash,\n\trust,\n\tscala,\n\tkotlin,\n\tswift,\n\tdart,\n\tgroovy,\n\tperl,\n\tlua,\n};\n\nfor (const [name, language] of Object.entries(eagerLanguages)) {\n\thljs.registerLanguage(name, language);\n}\n\nlet allLanguagesPromise: Promise<void> | undefined;\n\nexport function loadAllHighlightLanguages(): Promise<void> {\n\tif (!allLanguagesPromise) {\n\t\tallLanguagesPromise = new Promise((resolve) => {\n\t\t\tsetImmediate(() => {\n\t\t\t\tvoid import(\"highlight.js/lib/index.js\").then(\n\t\t\t\t\t() => resolve(),\n\t\t\t\t\t() => {\n\t\t\t\t\t\t// Eager languages and plaintext fallback remain available.\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t}\n\treturn allLanguagesPromise;\n}\n\nexport type HighlightFormatter = (text: string) => string;\nexport type HighlightTheme = Partial<Record<string, HighlightFormatter>>;\n\nexport interface HighlightOptions {\n\tlanguage?: string;\n\tignoreIllegals?: boolean;\n\tlanguageSubset?: string[];\n\ttheme?: HighlightTheme;\n}\n\nconst SPAN_CLOSE = \"</span>\";\nconst HIGHLIGHT_CLASS_PREFIX = \"hljs-\";\n\nfunction getScopeFromSpanTag(tag: string): string | undefined {\n\tconst match = /\\sclass\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/.exec(tag);\n\tconst classValue = match?.[1] ?? match?.[2];\n\tif (!classValue) {\n\t\treturn undefined;\n\t}\n\n\tfor (const className of classValue.split(/\\s+/)) {\n\t\tif (className.startsWith(HIGHLIGHT_CLASS_PREFIX)) {\n\t\t\treturn className.slice(HIGHLIGHT_CLASS_PREFIX.length);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction getScopeFormatter(scope: string, theme: HighlightTheme): HighlightFormatter | undefined {\n\tconst exact = theme[scope];\n\tif (exact) {\n\t\treturn exact;\n\t}\n\n\tconst dotIndex = scope.indexOf(\".\");\n\tif (dotIndex !== -1) {\n\t\tconst prefixFormatter = theme[scope.slice(0, dotIndex)];\n\t\tif (prefixFormatter) {\n\t\t\treturn prefixFormatter;\n\t\t}\n\t}\n\n\tconst dashIndex = scope.indexOf(\"-\");\n\tif (dashIndex !== -1) {\n\t\tconst prefixFormatter = theme[scope.slice(0, dashIndex)];\n\t\tif (prefixFormatter) {\n\t\t\treturn prefixFormatter;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction getActiveFormatter(scopes: Array<string | undefined>, theme: HighlightTheme): HighlightFormatter | undefined {\n\tfor (let i = scopes.length - 1; i >= 0; i--) {\n\t\tconst scope = scopes[i];\n\t\tif (!scope) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst formatter = getScopeFormatter(scope, theme);\n\t\tif (formatter) {\n\t\t\treturn formatter;\n\t\t}\n\t}\n\treturn theme.default;\n}\n\nfunction isSpanOpenTagStart(html: string, index: number): boolean {\n\tif (!html.startsWith(\"<span\", index)) {\n\t\treturn false;\n\t}\n\tconst nextChar = html[index + \"<span\".length];\n\treturn nextChar === \">\" || nextChar === \" \" || nextChar === \"\\t\" || nextChar === \"\\n\" || nextChar === \"\\r\";\n}\n\nexport function renderHighlightedHtml(html: string, theme: HighlightTheme = {}): string {\n\tlet output = \"\";\n\tlet textBuffer = \"\";\n\tconst scopes: Array<string | undefined> = [];\n\n\tconst flushText = () => {\n\t\tif (!textBuffer) {\n\t\t\treturn;\n\t\t}\n\t\tconst formatter = getActiveFormatter(scopes, theme);\n\t\toutput += formatter\n\t\t\t? textBuffer\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => (line ? formatter(line) : line))\n\t\t\t\t\t.join(\"\\n\")\n\t\t\t: textBuffer;\n\t\ttextBuffer = \"\";\n\t};\n\n\tlet index = 0;\n\twhile (index < html.length) {\n\t\tif (isSpanOpenTagStart(html, index)) {\n\t\t\tconst tagEndIndex = html.indexOf(\">\", index + 5);\n\t\t\tif (tagEndIndex !== -1) {\n\t\t\t\tflushText();\n\t\t\t\tconst tag = html.slice(index, tagEndIndex + 1);\n\t\t\t\tconst scope = getScopeFromSpanTag(tag);\n\t\t\t\tscopes.push(scope);\n\t\t\t\tindex = tagEndIndex + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (html.startsWith(SPAN_CLOSE, index)) {\n\t\t\tflushText();\n\t\t\tif (scopes.length > 0) {\n\t\t\t\tscopes.pop();\n\t\t\t}\n\t\t\tindex += SPAN_CLOSE.length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (html[index] === \"&\") {\n\t\t\tconst decoded = decodeHtmlEntityAt(html, index);\n\t\t\tif (decoded) {\n\t\t\t\ttextBuffer += decoded.text;\n\t\t\t\tindex += decoded.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\ttextBuffer += html[index];\n\t\tindex++;\n\t}\n\n\tflushText();\n\treturn output;\n}\n\nexport function highlight(code: string, options: HighlightOptions = {}): string {\n\tconst html = options.language\n\t\t? hljs.highlight(code, {\n\t\t\t\tlanguage: options.language,\n\t\t\t\tignoreIllegals: options.ignoreIllegals,\n\t\t\t}).value\n\t\t: hljs.highlightAuto(code, options.languageSubset).value;\n\treturn renderHighlightedHtml(html, options.theme);\n}\n\nexport function supportsLanguage(name: string): boolean {\n\treturn hljs.getLanguage(name) !== undefined;\n}\n"]}
package/docs/codemode.md CHANGED
@@ -47,13 +47,14 @@ What a call resolves to depends on the tool:
47
47
 
48
48
  - Tools with an output schema resolve to a structured value. `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes. Its `output` is not limited to what the model sees directly: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
49
49
  - MCP tools resolve to their `CallToolResult`, including `isError` and `structuredContent`.
50
- - Other tools, such as `read`, `edit`, and `write`, resolve to their text output.
50
+ - `read` resolves to the returned text (including path headers and line numbers unless `:raw` is used), or for an image to an image block `{ type: "image", data, mimeType, note }` that `image()` shows. `data` is the base64 image the model would see and `note` the accompanying text, such as resize hints.
51
+ - Other tools, such as `edit` and `write`, resolve to their text output.
51
52
 
52
53
  A call that fails, is blocked, or gets invalid arguments rejects with an `Error` that carries the tool's error text. Use `Promise.allSettled()` to keep the results of the calls that succeed. Reading a tool that does not exist throws an error that names the close matches, so `tools.Bash` suggests `tools.bash`; check for a tool with `"name" in tools`.
53
54
 
54
55
  The `codemode` description lists tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure are not listed, so the description stays the same while they register. Listed declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](/settings#tools)). Scripts find the other tools with `searchTools()`, `describeTool()`, `describeNamespace()`, or by filtering `ALL_TOOLS`.
55
56
 
56
- While `codemode` is active, `codemode.mode` in [settings](/settings#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say in one line how scripts call them and what the call resolves to. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts.
57
+ While `codemode` is active, `codemode.mode` in [settings](/settings#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say in one line how scripts call them and what the call resolves to. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts. Tool declarations in the `codemode` description, `describeTool()`, and `ALL_TOOLS` carry the tools' prompt guidelines, since the system prompt rules only cover declared tools.
57
58
 
58
59
  ## Store values
59
60
 
@@ -20,6 +20,8 @@ The effective parameters appear in extension events and successful results:
20
20
 
21
21
  Atomic carries the recent tail with the compaction boundary rather than replaying it as separate assistant and tool-result messages. Tail text, tool calls, and tool results remain lossless; images remain image blocks. If `query` is absent, Atomic uses the last visible user message.
22
22
 
23
+ The policy-refusal summary fallback instead keeps a token-based recent tail, replayed as separate messages. Its checkpoint is lossy rather than a verbatim transcript.
24
+
23
25
  Compaction resets Claude's signed reasoning chain: `thinking` and `redacted_thinking` blocks do not survive the boundary. See [Preserved thinking and model switches](/models/reference#preserved-thinking-and-model-switches) for behavior between boundaries.
24
26
 
25
27
  The query is never truncated. An oversized planner request reports overflow rather than silently dropping part of it. Use `keepContext` tags, not a longer query, to guarantee protection.
@@ -75,8 +77,10 @@ A successful run appends the existing pi-style `type:"compaction"` entry shape:
75
77
  "tokensBefore": 51234,
76
78
  "details": {
77
79
  "strategy": "verbatim-lines",
78
- "promptVersion": 3,
80
+ "promptVersion": 4,
79
81
  "rung": "planned",
82
+ "backend": "planner",
83
+ "model": "openai-codex/gpt-6.1-sol",
80
84
  "parameters": {"compression_ratio": 0.5, "preserve_recent": 2, "query": "fix the failing test"},
81
85
  "stats": {"linesBefore": 812, "linesDeleted": 417, "linesKept": 395, "rangeCount": 63, "tokensBefore": 51234, "tokensAfter": 24980, "percentReduction": 51.2}
82
86
  }
@@ -85,12 +89,12 @@ A successful run appends the existing pi-style `type:"compaction"` entry shape:
85
89
 
86
90
  The entry's `tokensBefore` is the provider-aware whole-context count used for budgeting and the Compacted from display. `details.stats.tokensBefore`, `tokensAfter`, and `percentReduction` are heuristic estimates of the compactable region plus the kept tail. Those stats can differ from the entry count, and `percentReduction` is negative when the reconstructed estimate is larger. The display count is not stored again under `details.tokensBefore`.
87
91
 
88
- `details.rung` is one of `"planned"` (a model ranked the lines — the session model **or** a borrowed fallback, including silent partial recovery), `"extension"` (a `session_before_compact` override), or `"fresh"` (the compactable conversation was discarded and a new context window started). `details.plannerModel` is present **only** when a borrowed fallback model ranked the lines:
92
+ `details.rung` is `"planned"` for successful model compaction, `"extension"` for a `session_before_compact` override, or `"fresh"` when older context was discarded. `details.backend` and `details.model` identify the successful compactor. A policy-refusal fallback records `backend: "summary"`, the same model that refused, and file lists in `details.summary`. Its card says `summary (pi fallback)`. `details.plannerModel` identifies a borrowed chat planner:
89
93
 
90
94
  ```json
91
95
  "details": {
92
96
  "strategy": "verbatim-lines",
93
- "promptVersion": 3,
97
+ "promptVersion": 4,
94
98
  "rung": "planned",
95
99
  "plannerModel": {"provider": "openai", "id": "gpt-5.1", "thinkingLevel": "high"}
96
100
  }
@@ -255,7 +259,9 @@ Configure compaction in `~/.atomic/agent/settings.json` or `<project-dir>/.atomi
255
259
  | `enabled` | `true` | Enable automatic Verbatim Compaction. |
256
260
  | `reserveTokens` | `16384` | Tokens to reserve for the next LLM response; threshold auto-compaction starts when completed-response usage or a prospective post-tool context exceeds the model's effective input budget minus this reserve. It is an **input-side** reserve only and never caps planner output. |
257
261
 
258
- Compaction has no configuration key of its own for fallback borrowing: it reuses `settings.fallbackModels`, the same ordered `provider/model[:thinkingLevel]` list that main-chat model fallback walks. With no `fallbackModels` configured, compaction behaves as before: one planner model, then either an honest failure (recoverable) or a fresh context window (load-bearing).
262
+ The top-level `compactionModel` setting defaults to `"auto"`, using the session model. An exact registered chat-model, classifier, or compactor ID selects a separate compactor. Project settings may not select `morph/*`. See [Compaction model](/compaction#compaction-model).
263
+
264
+ Fallback borrowing reuses `settings.fallbackModels`, the same ordered `provider/model[:thinkingLevel]` list used for chat fallback. It skips entries equal to the selected compaction model. A policy refusal from any chat compaction model, including `auto`, explicit chat-model IDs, and borrowed fallback entries, first tries pi's summary compaction on the same model. Classifier and Morph refusals skip summary fallback and advance directly to the next configured model. Other failures and failed summaries also advance to the next configured model. Only load-bearing recovery may clear older context after all attempts fail.
259
265
 
260
266
  Disable auto-compaction with `"enabled": false`. You can still compact manually with `/compact`.
261
267
 
@@ -7,9 +7,9 @@ description: "Verbatim line compaction, when it runs, planning rungs, and branch
7
7
 
8
8
  LLMs have finite context windows. Atomic reduces older transcript context with **verbatim line compaction** while preserving a configured count of recent context-visible messages. Branch summarization is a separate, lossy feature used when navigating away from a branch.
9
9
 
10
- Compaction runs locally without an external compaction service. It normally asks the active session model to rank lines. If that model cannot rank them because of a rate limit, quota exhaustion, provider error, context overflow, or empty plan, Atomic *borrows* the next model from your configured `fallbackModels` for that planner request.
10
+ Compaction normally uses the model selected by `compactionModel`. If it fails, Atomic borrows the next model from your configured `fallbackModels` for that request. A chat model's policy refusal first triggers pi's summary compaction on the same model, whether selected by `auto`, an explicit chat-model ID, or a `fallbackModels` entry. If that also fails, Atomic continues through the fallback models. Classifier and Morph failures go straight to the fallback models.
11
11
 
12
- **A configured fallback model may therefore receive the compaction transcript**, using that provider's own credentials. Borrowing never changes the session's model or thinking level. The model only selects lines to delete. Atomic reconstructs retained text from the originals, so surviving lines are never rewritten.
12
+ **The selected compaction model and configured fallback models may receive the compaction transcript**, using their own credentials. Borrowing never changes the session's model or thinking level. Line planners select deletions, and Atomic reconstructs surviving lines without rewriting them. The policy-refusal summary fallback is lossy and appears as `summary (pi fallback)`.
13
13
 
14
14
  ## On this page and its reference
15
15
 
@@ -19,8 +19,9 @@ This page covers the concepts and normal use of compaction and branch summarizat
19
19
 
20
20
  | Mechanism | Trigger | Model output | Durable result |
21
21
  |---|---|---|---|
22
- | Verbatim compaction | `/compact`, RPC `compact`, or automatic threshold/overflow recovery | Bare `start,end` deletion records (one per line) | A `CompactionEntry` whose `summary` is mechanically reconstructed transcript text |
23
- | Planner fallback borrowing | Any terminal planner outcome on the current planner model | Same deletion records, from a configured `fallbackModels` entry | The same `"planned"` boundary, with `details.plannerModel` naming the borrowed model |
22
+ | Verbatim compaction | `/compact`, RPC `compact`, or automatic threshold/overflow recovery | Per-message `id:start,end` deletion records | Retained transcript text reconstructed from the originals |
23
+ | Planner fallback borrowing | A failed selected compaction model | Same deletion records, from a configured `fallbackModels` entry | Retained text with the borrowed model recorded |
24
+ | Policy-refusal summary fallback | A chat provider refuses compaction under its policy | Pi's summary compaction on the same model | A summary boundary labeled `summary (pi fallback)` |
24
25
  | Fresh context window | Load-bearing compaction after every configured model failed | *(none — no model call)* | A `CompactionEntry` with `details.rung: "fresh"` |
25
26
  | Branch summarization | Optional `/tree` navigation | Generated summary prose | A `BranchSummaryEntry` |
26
27
 
@@ -43,10 +44,10 @@ Atomic serializes the compactable part of the conversation into role-tagged line
43
44
  [Assistant]: The off-by-one error is fixed.
44
45
  ```
45
46
 
46
- The planner sees the same text numbered as `N→content` and returns only one-based, inclusive line ranges as bare records:
47
+ The planner receives messages with their role and an array of lines. It returns inclusive per-message deletion ranges. For example, this deletes lines 2 through 5 of message 1:
47
48
 
48
49
  ```text
49
- 2,5
50
+ 1:2,5
50
51
  ```
51
52
 
52
53
  The model selects lines to delete; it does not rewrite retained text. Retained non-marker lines stay byte-identical and in their original order.
@@ -86,6 +87,37 @@ Protection includes the tags and survives repeated compaction, even if the plann
86
87
 
87
88
  Results report protected ranges as `keptRanges`.
88
89
 
90
+ ## Compaction model
91
+
92
+ Use `/settings` → **Compaction model** to choose Auto, a chat model, a registered classifier, or Morph without changing your chat model. Auto uses the current session model. The selector saves to project settings when a project override already exists; otherwise it saves globally.
93
+
94
+ You can also set `compactionModel` in `~/.atomic/agent/settings.json` or a trusted project's `.atomic/settings.json`:
95
+
96
+ ```json
97
+ {
98
+ "compactionModel": "auto",
99
+ "fallbackModels": ["openai-codex/gpt-6.1-sol"]
100
+ }
101
+ ```
102
+
103
+ The default, `auto`, or an empty value uses the current session model, including Anthropic models. An exact registered chat-model ID selects that model just for compaction. Registered classifiers and Morph compactors are also selectable. Project settings cannot select `morph/*`; choose Morph globally instead.
104
+
105
+ An explicit compaction model can send the compactable transcript to a different provider, using that provider's credentials. Choose only providers permitted to receive your conversation. Changing `compactionModel` does not affect branch summaries.
106
+
107
+ For classifier compaction, log in with `/login typesafe`, then set `"compactionModel": "typesafe/jev-latest"`. The classifier scores groups of transcript lines; Atomic removes lower-scored groups without rewriting the rest. Protected lines and the recent tail are not sent for scoring. If scoring fails, Atomic tries your fallback models. Group boundaries can make the retained fraction differ from the requested compression ratio.
108
+
109
+ For Morph compaction, use `/login morph` or set `MORPH_API_KEY`, then choose `morph/morph-compactor` in the global selector or settings file. Without a credential, the selector marks Morph as `requires /login morph`. Morph receives the compactable transcript, including serialized thinking, but not the recent tail. Atomic reconstructs surviving lines from the originals and preserves `<keepContext>` spans. Morph is not a chat-model choice.
110
+
111
+ The compaction card shows the backend and model that produced the result, such as `classifier · typesafe/jev-latest` or `morph · morph/morph-compactor`. A policy-refusal summary appears as `summary (pi fallback)`.
112
+
113
+ ### Troubleshooting policy refusals
114
+
115
+ If you see "This request was blocked as it seems to violate Anthropic's Terms of Service", or a refusal about reverse engineering or duplicating model outputs, the provider refused that compaction request. Atomic does not retry policy refusals as transient errors. For any chat compaction model, including `auto`, it tries pi's summary compaction on the same model. That summary retries recoverable rate-limit, server, overload, and transport errors according to `settings.retry`, just like the planner. If the summary also fails or is refused, Atomic continues through `fallbackModels`.
116
+
117
+ Classifier and Morph refusals skip the summary fallback and go directly to the next configured model. Anthropic remains a supported compactor. To keep verbatim compaction when a model refuses deletion planning, choose another `compactionModel`, such as a chat model, classifier, or Morph. Adding a `fallbackModels` entry gives Atomic another verbatim planner if the same-model summary fails.
118
+
119
+ If every attempt fails, manual `/compact` leaves your context unchanged. Overflow recovery and post-tool preflight may instead clear older context as described below.
120
+
89
121
  ## Parameters
90
122
 
91
123
  Moved to [Compaction reference](/compaction/reference#parameters).
@@ -117,7 +149,7 @@ Threshold decisions and recovery use the canonical session projection. When Atom
117
149
 
118
150
  Atomic uses the session's reasoning level unless a fallback entry specifies its own level. The provider controls the planner's output limit.
119
151
 
120
- `settings.retry` controls retries within one model. If planning fails, Atomic tries configured `settings.fallbackModels` in order, using each model's own credentials. Unavailable credentials do not prevent trying later models. Borrowing does not change the chat model, thinking level, or model-selection events.
152
+ `settings.retry` controls recoverable-error retries within one chat model, including a policy-refusal summary fallback. Policy refusals are not retried. If compaction fails, Atomic tries configured `settings.fallbackModels` in order, using each model's own credentials and skipping the selected compaction model if listed again. Unavailable credentials do not prevent trying later models. Borrowing does not change the chat model, thinking level, or model-selection events.
121
153
 
122
154
  When every configured model is exhausted, what happens depends on how much the caller can afford to lose:
123
155
 
@@ -262,7 +294,7 @@ When prompted, choose one of:
262
294
  2. summarize with the default prompt
263
295
  3. summarize with custom focus instructions
264
296
 
265
- Branch summaries are separate from `/compact`: branch navigation can generate summary prose (optionally with focus instructions), while Verbatim Compaction lets a model select numbered line ranges and reconstructs retained text mechanically.
297
+ Branch summaries are separate from `/compact`: branch navigation generates summary prose, while normal verbatim compaction selects per-message line ranges and reconstructs retained text mechanically. A chat compaction policy refusal can trigger pi's summary compaction as described above.
266
298
 
267
299
  Use the [Compaction reference](/compaction/reference) for extension hooks and saved formats.
268
300
 
package/docs/docs.json CHANGED
@@ -161,6 +161,7 @@
161
161
  "pages": [
162
162
  "programmatic",
163
163
  "sdk",
164
+ "sdk/web-server",
164
165
  "rpc",
165
166
  "rpc/extension-ui",
166
167
  "rpc/examples",
@@ -18,6 +18,10 @@ UI methods for user interaction. See [Custom UI](/extensions/ui#custom-ui) for f
18
18
 
19
19
  `false` in print mode (`-p`) and JSON mode. `true` in interactive and RPC mode. In RPC mode, dialog methods (`select`, `confirm`, `input`, `editor`) work via the extension UI sub-protocol, and fire-and-forget methods (`notify`, `setStatus`, `setWidget`, `setTitle`, `setEditorText`) emit requests to the client. Some TUI-specific methods are no-ops or return defaults (see [RPC mode](/rpc/extension-ui#extension-ui-protocol)).
20
20
 
21
+ ### ctx.isPresentationOnly
22
+
23
+ `true` in the local presentation host when the isolated interactive engine owns execution. Keep UI registration active, but skip background execution and durable recovery in lifecycle hooks in this context to avoid starting the same work in both processes. Normal SDK, print, RPC, and engine contexts leave this flag false or unset.
24
+
21
25
  ### ctx.cwd
22
26
 
23
27
  Current working directory.
@@ -819,6 +823,20 @@ if (pi.getFlag("plan")) {
819
823
  }
820
824
  ```
821
825
 
826
+ ### pi.getWorkflowHostModules()
827
+
828
+ Returns a promise for the running host's in-memory module namespaces. The workflows adapter uses this capability to avoid re-evaluating the host's package graphs for each workflow file.
829
+
830
+ The returned object has exactly these keys:
831
+
832
+ - `@bastani/atomic`
833
+ - `@bastani/pi-ai`, backed by the host's compatibility API
834
+ - `@bastani/pi-ai/providers/all`
835
+
836
+ These are shared host instances, not isolated copies. Workflow imports use the host's versions rather than project-local copies of these exact specifiers, preserving identity for exports such as `AuthStorage` and sharing module state. This also supports standalone-binary projects without those packages in `node_modules`. Other deep subpaths and third-party dependencies still resolve from disk. Workflow files and their relative imports are evaluated fresh on `/workflow reload`.
837
+
838
+ `getWorkflowHostModules()` is required on the current Atomic `ExtensionAPI`. It is optional on the workflows adapter's host interface so older or alternative hosts can omit it. Integrations that support those hosts should check for the method before calling it, for example `await pi.getWorkflowHostModules?.()`. Without it, the workflows adapter retains filesystem package resolution and needs resolvable packages for these imports.
839
+
822
840
  ### pi.exec(command, args, options?)
823
841
 
824
842
  Execute a shell command.
@@ -435,7 +435,7 @@ Atomic's workflow, subagent, Intercom/supervisor, and user-question tools are `m
435
435
 
436
436
  `direct` and `model-only` tools activate by default. Set `defaultActive: false` to keep a registered tool inactive until you select it with `pi.setActiveTools()`. `namespace: { name, description }` groups related tools. Optional `annotations` carry `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`; these are advisory hints, not permission checks or verified guarantees.
437
437
 
438
- An active orchestrator may implement `prepareLoadout(loadout)`. The loadout lists `declared`, `callable`, and `registered` tools and provides `getExposure(name)` and `getNamespace(name)`. Return `descriptions` to replace model-facing descriptions or `hiddenDeclarations` to hide declarations while retaining permitted nested access. This changes presentation, not authorization.
438
+ An active orchestrator may implement `prepareLoadout(loadout)`. The loadout lists `declared`, `callable`, and `registered` tools and provides `getExposure(name)`, `getNamespace(name)`, and `getPromptGuidelines(name)`. Return `descriptions` to replace model-facing descriptions or `hiddenDeclarations` to hide declarations while retaining permitted nested access. This changes presentation, not authorization.
439
439
 
440
440
  ### Fireworks deferred tool loading
441
441
 
@@ -849,9 +849,9 @@ export default function (pi: ExtensionAPI) {
849
849
  }
850
850
  ```
851
851
 
852
- Frames are ordinary objects with a `{ epoch: string, revision: number }` cursor. Revisions increase within an epoch; lifecycle publication may leave gaps between activity revisions. A new publisher starts a new epoch and an `unavailable` snapshot. Never compare revision numbers across epochs. A `ready` snapshot has a `roots` array, including an empty array when known empty. `recovering` and `unavailable` snapshots omit `roots`. Subsequent snapshots replace all prior knowledge. Changes replace a complete root, not increment counters. Removals contain `rootRunId`. Root summaries include `state`, `reason`, execution/wait counts, and `needsAttention`.
852
+ Frames are ordinary objects with a `{ epoch: string, revision: number }` cursor. Revisions increase within an epoch; lifecycle publication may leave gaps between activity revisions. A new publisher starts a new epoch and an `unavailable` snapshot. Never compare revision numbers across epochs. A `ready` snapshot has a `roots` array, including an empty array when known empty. `recovering` and `unavailable` snapshots omit `roots`. Subsequent snapshots replace all prior knowledge. Changes replace a complete root, not increment counters. Removals contain `rootRunId`. Root summaries include `state`, `reason`, execution/wait counts, and `needsAttention`. Roots published by the workflows extension also carry an optional `graph: { nodes }`. It holds the root's expanded workflow graph, including the nodes of nested child workflows. Each node is a `stage` or `tool` node with `id`, `runId`, `nodeId`, `name`, `status`, `parentIds`, `depth`, and `executionOrder` when it is known. Tool nodes add their `ordinal`. Stages waiting on a prompt add `pendingPrompt` (`id`, `kind`, `message`, `choices`, `createdAt`). Prompts raised by a run rather than a stage appear in `graph.runPrompts`, each with the same fields plus its `runId`. A node status change publishes a `changed` frame. Treat `graph` as optional, because other publishers may omit it.
853
853
 
854
- The workflows extension also calls `pi.registerWorkflowRunControl(control)` to back `session.workflows`, the typed pause, quit, and resume API for SDK hosts (see [Workflow run control](/sdk#workflow-run-control)). The registration is released with the extension generation, and only the most recent registration is active.
854
+ The workflows extension also calls `pi.registerWorkflowRunControl(control)` with a `WorkflowRunControl` to back `session.workflows`, the typed pause, quit, and resume API for SDK hosts (see [Workflow run control](/sdk#workflow-run-control)). SDK hosts follow this same activity stream through `session.workflows.observe(observer)`. The registration is released with the extension generation, and only the most recent registration is active.
855
855
 
856
856
  Providers call `pi.registerWorkflowActivityPublisher()` and retain its returned `WorkflowActivityPublisher`. Its methods are `publishSnapshot({ availability: "ready", roots })`, `publishSnapshot({ availability: "recovering" | "unavailable" })`, `publishChanged(root)`, `publishRemoved(rootRunId)`, `publishLifecycle(event)`, `publishHeartbeat(event)`, and `dispose()`. Lifecycle input includes `type: "workflow_lifecycle"` and the envelope except `cursor`, which the host supplies. Heartbeat input includes `type: "workflow_heartbeat"`. IDs, names, timestamps, zero counts and optional attribution are preserved. Roots are keyed by `rootRunId`; duplicate snapshot IDs use the last value at the first insertion position. Removing an absent ID is permitted. Changes do not turn an unknown source into `ready`; publish a snapshot to establish readiness.
857
857
 
@@ -522,6 +522,8 @@ Moved to [Extension API reference](/extensions/api-reference#pi-on-event-handler
522
522
 
523
523
  Moved to [Extension API reference](/extensions/api-reference#pi-registertool-definition).
524
524
 
525
+ A tool that orchestrates other tools can adjust what the model sees with `prepareLoadout(loadout)`. The hook receives declared, callable, and registered tools, with `getExposure()`, `getNamespace()`, and `getPromptGuidelines()`. Return replacement `descriptions` or `hiddenDeclarations` to hide active tools' declarations while keeping them callable. The default system prompt omits hidden tools from its tool list and rules, and names no tool in the skills hint when the file reader is hidden. The orchestrating tool should present those guidelines itself, as `codemode` does.
526
+
525
527
  #### Built-in tool prompt contributions
526
528
 
527
529
  Moved to [Extension API reference](/extensions/api-reference#built-in-tool-prompt-contributions).
@@ -51,8 +51,8 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `ctrl+s
51
51
  | `tui.editor.cursorWordRight` | `alt+right`, `ctrl+right`, `alt+f` | Move cursor word right |
52
52
  | `tui.editor.historyPrevious` | *(none)* | Select the previous prompt history entry |
53
53
  | `tui.editor.historyNext` | *(none)* | Select the next prompt history entry |
54
- | `tui.editor.cursorLineStart` | `home`, `ctrl+home`, `ctrl+a` | Move to line start |
55
- | `tui.editor.cursorLineEnd` | `end`, `ctrl+end`, `ctrl+e` | Move to line end |
54
+ | `tui.editor.cursorLineStart` | `home`, `ctrl+a` | Move to line start |
55
+ | `tui.editor.cursorLineEnd` | `end`, `ctrl+e` | Move to line end |
56
56
  | `tui.editor.jumpForward` | `ctrl+]` | Jump forward to character |
57
57
  | `tui.editor.jumpBackward` | `ctrl+alt+]` | Jump backward to character |
58
58
  | `tui.editor.pageUp` | `pageUp`, `ctrl+pageUp` | Scroll up by page |
@@ -111,21 +111,21 @@ Hold Alt while using the mouse wheel to scroll five times as far in fullscreen m
111
111
 
112
112
  Drag with the primary button to select characters, double-click for a word or path, and triple-click for a line. Changing focus or clicking elsewhere clears the selection.
113
113
 
114
- While the main editor has focus, fullscreen transcript bindings take precedence. Unmodified navigation keys control the transcript; their `ctrl` variants control the editor.
114
+ While the main editor has focus, fullscreen transcript bindings take precedence. `home` and `end` stay with the editor; `ctrl+home` and `ctrl+end` jump to the transcript top and bottom. `pageUp` and `pageDown` control the transcript, while their `ctrl` variants control the editor.
115
115
 
116
116
  | Key | Editor action | Fullscreen action |
117
117
  |-----|---------------|------------------|
118
- | `home`, `end` | Editor | Transcript |
119
- | `ctrl+home`, `ctrl+end` | Editor | Editor |
118
+ | `home`, `end` | Editor | Editor |
119
+ | `ctrl+home`, `ctrl+end` | *(none)* | Transcript |
120
120
  | `pageUp`, `pageDown` | Editor | Transcript |
121
121
  | `ctrl+pageUp`, `ctrl+pageDown` | Editor | Editor |
122
122
 
123
123
  This routing remains configurable through the ordinary action bindings. For example, `"tui.altScreen.pageUp": "ctrl+pageUp"` makes `pageUp` control the editor and `ctrl+pageUp` control the transcript in fullscreen mode. Bind `tui.altScreen.halfPageUp` and `tui.altScreen.halfPageDown` for half-page steps, or `tui.altScreen.lineUp` and `tui.altScreen.lineDown` for single-line steps, while keeping the full-page bindings. Setting `"tui.altScreen.pageUp": []` disables that transcript shortcut entirely. User bindings replace the defaults for that action.
124
124
  A focused custom component may consume viewport keys and mouse input before the transcript. Extension authors should follow the [input handling contract](/extensions/ui#custom-components).
125
125
 
126
- The blocking `ask_user_question` dialog is a bottom-pinned overlay. Opening it does not shrink the transcript viewport or change the page step. `pageUp`, `pageDown`, `home`, `end`, and the wheel still reach every scrollback line, including the newest ones, in the visible strip above the dialog.
126
+ The blocking `ask_user_question` dialog is a bottom-pinned overlay. Opening it does not shrink the transcript viewport or change the page step. `pageUp`, `pageDown`, `ctrl+home`, `ctrl+end`, and the wheel still reach every scrollback line, including the newest ones, in the visible strip above the dialog.
127
127
 
128
- These transcript actions also work while Notes is open. Notes keeps ordinary text and edit actions, including the default `ctrl+home` and `ctrl+end`. A key moves the transcript instead only when configured for a `tui.altScreen.*` action.
128
+ These transcript actions also work while Notes is open. Notes keeps ordinary text and edit actions, including the default `home` and `end`. A key moves the transcript instead only when configured for a `tui.altScreen.*` action.
129
129
 
130
130
  On short terminals, the dialog is bounded to preserve that visible strip. The active questionnaire row stays visible as you move through single-select and multi-select choices, Next, Submit, Cancel, and inline inputs. The dialog keeps its own arrow, `enter`, `tab`, `space`, `esc`, click, and selection input.
131
131
 
@@ -139,8 +139,8 @@ On short terminals, the dialog is bounded to preserve that visible strip. The ac
139
139
  | `tui.altScreen.lineDown` | *(none)* | Scroll the transcript down by one line |
140
140
  | `tui.altScreen.previousPrompt` | `ctrl+shift+up` | Jump to the previous marked message |
141
141
  | `tui.altScreen.nextPrompt` | `ctrl+shift+down` | Jump to the next marked message |
142
- | `tui.altScreen.top` | `home` | Scroll to the beginning of the transcript |
143
- | `tui.altScreen.bottom` | `end` | Scroll to the transcript end and follow new output |
142
+ | `tui.altScreen.top` | `ctrl+home` | Scroll to the beginning of the transcript |
143
+ | `tui.altScreen.bottom` | `ctrl+end` | Scroll to the transcript end and follow new output |
144
144
 
145
145
  Atomic does not ship a find-in-transcript shortcut. The four `tui.altScreen.search*` actions remain in the keybinding table so an existing `keybindings.json` still validates, but they have no default keys and do nothing.
146
146
 
@@ -145,6 +145,10 @@ Tools are named `mcp__<server>__<tool>`, with punctuation replaced by `_`. Names
145
145
 
146
146
  Codemode and deferred tools can be reached through either indirect mechanism. Server summaries appear in the `mcp_servers` system prompt section. Scripts can read instructions and tool names with `describeNamespace("mcp__github")`.
147
147
 
148
+ `--tools` keeps MCP tools unless an entry starts with `mcp__`. For example, `atomic --tools read,codemode` can still call non-hidden MCP tools with codemode or deferred exposure from scripts, but unmatched MCP tools are not declared directly. Unmatched direct-exposure tools remain registered but inactive. Include `tool_search` to load unmatched tools with non-direct exposure. To restrict the server tools, use `atomic --tools read,codemode,'mcp__docs__*'`. `--exclude-tools` accepts the same `*` patterns and also applies to MCP resource tools.
149
+
150
+ `--no-mcp` disables built-in MCP support for one run. No built-in servers connect, MCP tools load, or `/mcp` command registers. A replacement extension is unaffected.
151
+
148
152
  Codemode receives the complete MCP result, including `content`, `structuredContent`, and `isError`. Text over 20 KB is shortened for the model, with the complete text saved to a temporary file named in the result. Every MCP call passes through Atomic's tool pipeline, including permission hooks.
149
153
 
150
154
  ## Use resources
package/docs/providers.md CHANGED
@@ -14,6 +14,8 @@ This page is provider setup: subscriptions, API keys, provider-specific configur
14
14
  - [Auth File](#auth-file)
15
15
  - [Provider Specific Config](#provider-specific-config)
16
16
  - [llama.cpp](#llama-cpp)
17
+ - [TypeSafe Jev](#typesafe-jev)
18
+ - [Morph compaction](#morph-compaction)
17
19
  - [Stop Reasons](/providers/reference#stop-reasons)
18
20
  - [Resolution Order](/providers/reference#resolution-order)
19
21
  - [Custom Providers](#custom-providers)
@@ -209,7 +211,7 @@ Catalog failures preserve the last usable models for each provider. See [catalog
209
211
  | ---------------------------------- | ------------------------------------------------------------------------- | ---------------------------- |
210
212
  | Anthropic | `ANTHROPIC_API_KEY` or bearer-only `ANTHROPIC_AUTH_TOKEN` | `anthropic` |
211
213
  | Ant Ling | `ANT_LING_API_KEY` | `ant-ling` |
212
- | Azure OpenAI Responses | `AZURE_OPENAI_API_KEY` | `azure-openai-responses` |
214
+ | Azure | `AZURE_OPENAI_API_KEY` | `azure` |
213
215
  | OpenAI | `OPENAI_API_KEY` | `openai` |
214
216
  | DeepSeek | `DEEPSEEK_API_KEY` | `deepseek` |
215
217
  | NVIDIA NIM | `NVIDIA_API_KEY` | `nvidia` |
@@ -230,6 +232,7 @@ Catalog failures preserve the last usable models for each provider. See [catalog
230
232
  | Radius | `RADIUS_API_KEY` | `radius` |
231
233
  | Hugging Face | `HF_TOKEN` | `huggingface` |
232
234
  | TypeSafe Jev | `TYPESAFE_API_KEY` | `typesafe` |
235
+ | Morph | `MORPH_API_KEY` | `morph` |
233
236
  | Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
234
237
  | Together AI | `TOGETHER_API_KEY` | `together` |
235
238
  | Baseten | `BASETEN_API_KEY` | `baseten` |
@@ -344,12 +347,25 @@ atomic --provider nvidia --model nvidia/nemotron-3-ultra-550b-a55b
344
347
 
345
348
  Use `--list-models` or `/model` to check the current catalog and replace a missing saved model. A catalog listing does not verify account access or serving availability.
346
349
 
347
- ### Azure OpenAI
350
+ <a id="azure-openai" />
351
+
352
+ ### Azure
353
+
354
+ Use the `azure` provider for OpenAI Responses models and Azure Foundry Chat Completions, including `azure/deepseek-v4-pro`:
355
+
356
+ ```bash
357
+ atomic --model azure/deepseek-v4-pro:high
358
+ ```
359
+
360
+ DeepSeek V4 Pro supports `low`, `medium`, and `high` reasoning effort. Azure OpenAI models keep the `azure-openai-responses` API ID; Chat Completions models use `openai-completions`.
361
+
362
+ Custom Azure deployments in `models.json` or extension registrations default to the Responses API when no API is specified and the model ID is not in the catalog. Set `api: "openai-completions"` at the provider or model level to use Chat Completions.
348
363
 
349
364
  ```bash
350
365
  export AZURE_OPENAI_API_KEY=...
351
366
  export AZURE_OPENAI_BASE_URL=https://your-resource.openai.azure.com
352
367
  # also supported: https://your-resource.cognitiveservices.azure.com
368
+ # Azure Foundry endpoints such as https://your-resource.services.ai.azure.com are supported too
353
369
  # root endpoints are auto-normalized to /openai/v1
354
370
  # or use resource name instead of base URL
355
371
  export AZURE_OPENAI_RESOURCE_NAME=your-resource
@@ -359,6 +375,12 @@ export AZURE_OPENAI_API_VERSION=2024-02-01
359
375
  export AZURE_OPENAI_DEPLOYMENT_NAME_MAP=gpt-4=my-gpt4,gpt-4o=my-gpt4o
360
376
  ```
361
377
 
378
+ `AZURE_OPENAI_API_VERSION` configures Responses requests. Chat Completions uses the normalized `/openai/v1` endpoint.
379
+
380
+ Deployment names default to model IDs. Set `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` when your deployments have different names; it applies to both APIs without changing the model ID shown in sessions.
381
+
382
+ The former provider name `azure-openai-responses` remains accepted in model selections, saved sessions, and SDK lookups. Startup renames that provider in `auth.json`, `settings.json`, and `models.json`, including legacy Pi configuration paths. Existing `azure` entries win on collisions. Project configuration is migrated only after the project is trusted; session files are not rewritten. Use `azure` in new configuration.
383
+
362
384
  ### Amazon Bedrock
363
385
 
364
386
  ```bash
@@ -551,7 +573,7 @@ For router-mode discovery, load/unload management, and Hugging Face downloads wi
551
573
 
552
574
  ## TypeSafe Jev
553
575
 
554
- `typesafe/jev-latest` is the built-in TypeSafe classifier. Name it explicitly in `routerModel`, `structured_output`, or `generateStructuredOutput()` when you want it. An unset or `auto` router uses the current chat model; saved credentials do not select a classifier. Jev is never an execution `auto` candidate, chat `--model`, or `/model` choice. Any other classifier works the same way only when the current model registry lists it. A models.dev listing does not register a classifier.
576
+ `typesafe/jev-latest` is the built-in TypeSafe classifier. Name it explicitly in `compactionModel`, `routerModel`, `structured_output`, or `generateStructuredOutput()` when you want it. An unset or `auto` compaction model or router uses the current chat model; saved credentials do not select a classifier. Jev is never an execution `auto` candidate, chat `--model`, or `/model` choice. Any other classifier works the same way only when the current model registry lists it. A models.dev listing does not register a classifier. See [Compaction model](/compaction#compaction-model) for verbatim classifier compaction.
555
577
 
556
578
  Use `/login typesafe` to save an API key under `typesafe` in `auth.json`, or set `TYPESAFE_API_KEY` in Atomic's process environment. Stored credentials take precedence over the environment key. `/logout typesafe` removes the saved TypeSafe credential; an environment key remains active until you unset it. Jev appears in `/login` but not `/model`, because it only makes structured decisions. Do not put the key in prompts, decision state, or `settings.json`.
557
579
 
@@ -563,6 +585,14 @@ Routers send one classify request for a registered classifier and can repair a m
563
585
 
564
586
  HTTP 401 means check the key saved through `/login typesafe` or `TYPESAFE_API_KEY`, 422 means check the question/state contract, and 429 or 529 means wait before retrying explicitly. Configured credentials do not verify access or quota. See [TypeSafe's API](https://docs.typesafe.ai/api.md) and [Choice reference](https://docs.typesafe.ai/primitives/choice.md).
565
587
 
588
+ ## Morph compaction
589
+
590
+ Use `/login morph` to save a Morph API key under `morph` in `~/.atomic/agent/auth.json`, or set `MORPH_API_KEY` in Atomic's process environment. Stored credentials take precedence over the environment key. Do not put the key in prompts or `settings.json`.
591
+
592
+ Then choose `morph/morph-compactor` through `/settings` → **Compaction model**, or set `"compactionModel": "morph/morph-compactor"` in global settings. Without credentials, the selector marks it as `requires /login morph`. Morph receives the compactable transcript, including serialized thinking; the preserved recent tail is not sent. Atomic retains the original surviving lines and enforces `<keepContext>` protection. Choose Morph only if it is permitted to receive your transcript.
593
+
594
+ Morph is a compactor, not a chat model. It does not appear in `/model` or automatic model routing. Project settings cannot select `morph/*`. Missing credentials, HTTP errors, policy refusals, or unusable results advance directly to your configured fallback models without a Morph summary request. `/logout morph` removes the saved credential; an environment key remains active until you unset it. See [Compaction model](/compaction#compaction-model).
595
+
566
596
  ## Custom Providers
567
597
 
568
598
  **Via models.json:** Add Ollama, LM Studio, vLLM, or any provider that speaks a supported API (OpenAI Completions, OpenAI Responses, Anthropic Messages, Google Generative AI). See [Custom models](/models).
@@ -144,15 +144,21 @@ When a print-mode turn correctly finishes by calling an opt-in terminating struc
144
144
 
145
145
  | Option | Description |
146
146
  |--------|-------------|
147
- | `--tools <list>`, `-t <list>` | Allowlist specific coding, extension, and custom tools, including Intercom |
148
- | `--exclude-tools <list>`, `-xt <list>` | Exclude specific coding, extension, and custom tools, including Intercom |
147
+ | `--tools <list>`, `-t <list>` | Allowlist tool names or `*` patterns; keeps MCP tools unless an entry starts with `mcp__` |
148
+ | `--exclude-tools <list>`, `-xt <list>` | Exclude tool names or `*` patterns, including MCP tools and Intercom |
149
149
  | `--no-builtin-tools`, `-nbt` | Disable built-in tools but keep extension/custom tools enabled |
150
150
  | `--no-tools`, `-nt` | Disable every tool, including Intercom, even with `--tools` |
151
151
 
152
- Default built-in tools: `read`, `bash`, `kill`, `edit`, `write`, `find`, `search`, `ask_user_question`, `todo`, plus `powershell` on native Windows when a PowerShell executable is available. `ls` remains available but is not a default. `defaultTools` selects initial coding tools without narrowing extension/custom tools. `--tools` selects an explicit allowlist; `--exclude-tools` subtracts from it. `--no-builtin-tools` suppresses coding defaults when no allowlist is given. `--no-tools` overrides all selection. To retain Intercom with an allowlist, include `intercom` explicitly.
152
+ Default built-in tools: `read`, `bash`, `kill`, `edit`, `write`, `find`, `search`, `ask_user_question`, `todo`, plus `powershell` on native Windows when a PowerShell executable is available. `ls` remains available but is not a default. `defaultTools` selects initial coding tools without narrowing extension/custom tools. `--tools` selects an explicit allowlist; `--exclude-tools` subtracts from it. `--no-builtin-tools` suppresses coding defaults when no allowlist is given. The bundled Intercom extension remains loaded with `--no-extensions`, but its tool follows the allowlist, exclusions, and `--no-tools` like other extension tools.
153
153
 
154
154
  To add opt-in [codemode](/tools#codemode) or [tool search](/tools#tool_search) alongside defaults, use `"defaultTools": ["+codemode", "+tool_search"]` in settings. With `--tools`, include their names and every other tool you want available.
155
155
 
156
+ ### MCP tools
157
+
158
+ `--tools read,codemode` keeps non-hidden MCP tools with codemode or deferred exposure callable from codemode scripts. MCP tools unmatched by the allowlist are not declared directly, regardless of exposure. Unmatched direct-exposure tools remain registered but inactive. Only an enabled `tool_search` can load unmatched tools with non-direct exposure.
159
+
160
+ An entry starting with `mcp__` filters MCP tools too. For example, `atomic --tools read,codemode,'mcp__docs__*'` keeps only tools from the `docs` server. MCP resource tools also count as MCP tools. Exclusions apply to both server and resource tools. Use `--no-mcp` to disable built-in MCP connections and resources entirely.
161
+
156
162
  ## Project Trust Options
157
163
 
158
164
  | Option | Description |
@@ -168,6 +174,7 @@ Project trust gates `.atomic`/legacy `.pi` project resources, project package se
168
174
  |--------|-------------|
169
175
  | `-e`, `--extension <source>` | Load an extension from path, npm, or git; repeatable |
170
176
  | `--no-extensions`, `-ne` | Disable optional extension discovery; mandatory bundled Intercom remains loaded |
177
+ | `--no-mcp` | Disable built-in MCP support for this run, even when explicitly enabled; replacement extensions are unaffected |
171
178
  | `--skill <path>` | Load a skill; repeatable |
172
179
  | `--no-skills`, `-ns` | Disable skill discovery |
173
180
  | `--prompt-template <path>` | Load a prompt template; repeatable |
@@ -845,12 +845,27 @@ generateDiffString
845
845
  generateUnifiedPatch
846
846
  type EditDiffResult
847
847
 
848
+ // Session output
849
+ createTranscript
850
+ type Transcript
851
+ type TranscriptOptions
852
+ type TranscriptPart
853
+
848
854
  // Session management
849
855
  SessionManager
850
856
  SettingsManager
851
857
 
852
- // Workflow run control (session.workflows)
858
+ // Workflow run control and observation (session.workflows)
853
859
  type SessionWorkflows
860
+ type WorkflowRunControl
861
+ type WorkflowActivityFrame
862
+ type WorkflowActivityObserver
863
+ type WorkflowActivitySubscription
864
+ type WorkflowRootActivity
865
+ type WorkflowRootGraph
866
+ type WorkflowGraphNode
867
+ type WorkflowGraphNodePrompt
868
+ type WorkflowGraphRunPrompt
854
869
  type WorkflowRunSummary
855
870
  type WorkflowRunDetail
856
871
  type WorkflowRunControlOutcome