@bastani/atomic 0.9.20-alpha.3 → 0.9.20-alpha.4

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 (763) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +15 -7
  3. package/dist/builtin/intercom/CHANGELOG.md +18 -0
  4. package/dist/builtin/intercom/README.md +2 -2
  5. package/dist/builtin/intercom/broker/send-handler.ts +59 -2
  6. package/dist/builtin/intercom/index.bundle.mjs +101 -16
  7. package/dist/builtin/intercom/package.json +3 -3
  8. package/dist/builtin/intercom/session-target.ts +34 -9
  9. package/dist/builtin/intercom/skills/intercom/SKILL.md +4 -4
  10. package/dist/builtin/mcp/CHANGELOG.md +13 -0
  11. package/dist/builtin/mcp/OAUTH.md +1 -1
  12. package/dist/builtin/mcp/README.md +3 -1
  13. package/dist/builtin/mcp/index.bundle.mjs +412 -64
  14. package/dist/builtin/mcp/package.json +3 -3
  15. package/dist/builtin/subagents/CHANGELOG.md +27 -0
  16. package/dist/builtin/subagents/README.md +2 -2
  17. package/dist/builtin/subagents/agents/code-simplifier.md +2 -3
  18. package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -3
  19. package/dist/builtin/subagents/agents/codebase-locator.md +2 -3
  20. package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -3
  21. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -3
  22. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -3
  23. package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -3
  24. package/dist/builtin/subagents/agents/debugger.md +1 -2
  25. package/dist/builtin/subagents/agents/worker.md +1 -2
  26. package/dist/builtin/subagents/package.json +4 -8
  27. package/dist/builtin/subagents/skills/subagent/SKILL.md +15 -13
  28. package/dist/builtin/subagents/src/extension/index.bundle.mjs +249 -63
  29. package/dist/builtin/web-access/CHANGELOG.md +12 -0
  30. package/dist/builtin/web-access/index.bundle.mjs +367 -295
  31. package/dist/builtin/web-access/package.json +3 -3
  32. package/dist/builtin/workflows/CHANGELOG.md +68 -0
  33. package/dist/builtin/workflows/README.md +29 -30
  34. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  35. package/dist/builtin/workflows/builtin/{chunk-yeee2jrc.js → chunk-119kxb28.js} +5 -46
  36. package/dist/builtin/workflows/builtin/chunk-1dydq7w3.js +9722 -0
  37. package/dist/builtin/workflows/builtin/{chunk-31j2gs7h.js → chunk-9y0f90rd.js} +4 -6
  38. package/dist/builtin/workflows/builtin/{chunk-z29qbehr.js → chunk-d1xqh1rd.js} +4 -6
  39. package/dist/builtin/workflows/builtin/{chunk-zqtm1d2c.js → chunk-hnbbb5r0.js} +12 -217
  40. package/dist/builtin/workflows/builtin/{chunk-wf741bv3.js → chunk-k18g9me8.js} +4 -6
  41. package/dist/builtin/workflows/builtin/{chunk-g0csgs7w.js → chunk-kf5xpbkz.js} +8 -10
  42. package/dist/builtin/workflows/builtin/{chunk-a2kdsqn8.js → chunk-n4yxrsm9.js} +1 -1
  43. package/dist/builtin/workflows/builtin/{chunk-xtxcq5tj.js → chunk-n8g2da69.js} +17 -1
  44. package/dist/builtin/workflows/builtin/{chunk-fg9esgkj.js → chunk-scgprmdj.js} +4 -6
  45. package/dist/builtin/workflows/builtin/{chunk-6w6cvk6b.js → chunk-sn5mchnx.js} +4 -6
  46. package/dist/builtin/workflows/builtin/{chunk-ewkkkbak.js → chunk-vt9zgr9d.js} +9 -91
  47. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  48. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  49. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  50. package/dist/builtin/workflows/builtin/goal.js +4 -4
  51. package/dist/builtin/workflows/builtin/index.js +12 -12
  52. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  53. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  54. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  55. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  56. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  57. package/dist/builtin/workflows/package.json +3 -3
  58. package/dist/builtin/workflows/src/authoring.d.ts +2 -0
  59. package/dist/builtin/workflows/src/durable/dependency-doctor-types.d.ts +42 -0
  60. package/dist/builtin/workflows/src/extension/index.bundle.mjs +82005 -78701
  61. package/dist/builtin/workflows/src/index.js +8900 -1200
  62. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +11 -0
  63. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +4 -1
  64. package/dist/cli/args.js +2 -2
  65. package/dist/cli/args.js.map +1 -1
  66. package/dist/config.d.ts +1 -0
  67. package/dist/config.d.ts.map +1 -1
  68. package/dist/config.js +1 -0
  69. package/dist/config.js.map +1 -1
  70. package/dist/core/agent-session-accessors.d.ts.map +1 -1
  71. package/dist/core/agent-session-accessors.js +2 -1
  72. package/dist/core/agent-session-accessors.js.map +1 -1
  73. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  74. package/dist/core/agent-session-auto-compaction.js +9 -2
  75. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  76. package/dist/core/agent-session-bash.d.ts +3 -1
  77. package/dist/core/agent-session-bash.d.ts.map +1 -1
  78. package/dist/core/agent-session-bash.js +18 -6
  79. package/dist/core/agent-session-bash.js.map +1 -1
  80. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  81. package/dist/core/agent-session-compaction.js +25 -8
  82. package/dist/core/agent-session-compaction.js.map +1 -1
  83. package/dist/core/agent-session-events.d.ts +6 -6
  84. package/dist/core/agent-session-events.d.ts.map +1 -1
  85. package/dist/core/agent-session-events.js +145 -62
  86. package/dist/core/agent-session-events.js.map +1 -1
  87. package/dist/core/agent-session-export.d.ts +1 -1
  88. package/dist/core/agent-session-export.d.ts.map +1 -1
  89. package/dist/core/agent-session-export.js +18 -19
  90. package/dist/core/agent-session-export.js.map +1 -1
  91. package/dist/core/agent-session-extension-bindings.d.ts +3 -2
  92. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  93. package/dist/core/agent-session-extension-bindings.js +274 -70
  94. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  95. package/dist/core/agent-session-message-queue.d.ts +1 -1
  96. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  97. package/dist/core/agent-session-message-queue.js +30 -4
  98. package/dist/core/agent-session-message-queue.js.map +1 -1
  99. package/dist/core/agent-session-methods.d.ts +19 -11
  100. package/dist/core/agent-session-methods.d.ts.map +1 -1
  101. package/dist/core/agent-session-methods.js.map +1 -1
  102. package/dist/core/agent-session-models.d.ts +2 -2
  103. package/dist/core/agent-session-models.d.ts.map +1 -1
  104. package/dist/core/agent-session-models.js +38 -29
  105. package/dist/core/agent-session-models.js.map +1 -1
  106. package/dist/core/agent-session-persistent-custom-messages.d.ts +1 -1
  107. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  108. package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
  109. package/dist/core/agent-session-post-tool-compaction.js +18 -1
  110. package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
  111. package/dist/core/agent-session-prompt.d.ts +1 -1
  112. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  113. package/dist/core/agent-session-prompt.js +104 -22
  114. package/dist/core/agent-session-prompt.js.map +1 -1
  115. package/dist/core/agent-session-queue-pause.d.ts +2 -0
  116. package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
  117. package/dist/core/agent-session-queue-pause.js +13 -2
  118. package/dist/core/agent-session-queue-pause.js.map +1 -1
  119. package/dist/core/agent-session-retry.d.ts +0 -3
  120. package/dist/core/agent-session-retry.d.ts.map +1 -1
  121. package/dist/core/agent-session-retry.js +24 -11
  122. package/dist/core/agent-session-retry.js.map +1 -1
  123. package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
  124. package/dist/core/agent-session-runtime-auth.js +10 -0
  125. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  126. package/dist/core/agent-session-runtime.d.ts +17 -1
  127. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  128. package/dist/core/agent-session-runtime.js +428 -197
  129. package/dist/core/agent-session-runtime.js.map +1 -1
  130. package/dist/core/agent-session-services.d.ts +4 -0
  131. package/dist/core/agent-session-services.d.ts.map +1 -1
  132. package/dist/core/agent-session-services.js +31 -2
  133. package/dist/core/agent-session-services.js.map +1 -1
  134. package/dist/core/agent-session-state.d.ts +10 -2
  135. package/dist/core/agent-session-state.d.ts.map +1 -1
  136. package/dist/core/agent-session-state.js +32 -22
  137. package/dist/core/agent-session-state.js.map +1 -1
  138. package/dist/core/agent-session-summary.d.ts.map +1 -1
  139. package/dist/core/agent-session-summary.js +9 -2
  140. package/dist/core/agent-session-summary.js.map +1 -1
  141. package/dist/core/agent-session-tasks.d.ts +1 -0
  142. package/dist/core/agent-session-tasks.d.ts.map +1 -1
  143. package/dist/core/agent-session-tasks.js +24 -3
  144. package/dist/core/agent-session-tasks.js.map +1 -1
  145. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  146. package/dist/core/agent-session-tool-hooks.js +26 -3
  147. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  148. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  149. package/dist/core/agent-session-tool-registry.js +0 -2
  150. package/dist/core/agent-session-tool-registry.js.map +1 -1
  151. package/dist/core/agent-session-transfer.js.map +1 -1
  152. package/dist/core/agent-session-tree.d.ts.map +1 -1
  153. package/dist/core/agent-session-tree.js +6 -0
  154. package/dist/core/agent-session-tree.js.map +1 -1
  155. package/dist/core/agent-session-types.d.ts +5 -0
  156. package/dist/core/agent-session-types.d.ts.map +1 -1
  157. package/dist/core/agent-session-types.js.map +1 -1
  158. package/dist/core/agent-session.d.ts +15 -8
  159. package/dist/core/agent-session.d.ts.map +1 -1
  160. package/dist/core/agent-session.js +113 -66
  161. package/dist/core/agent-session.js.map +1 -1
  162. package/dist/core/auth-storage.d.ts +5 -3
  163. package/dist/core/auth-storage.d.ts.map +1 -1
  164. package/dist/core/auth-storage.js +18 -5
  165. package/dist/core/auth-storage.js.map +1 -1
  166. package/dist/core/builtin-diagnostics.d.ts +2 -0
  167. package/dist/core/builtin-diagnostics.d.ts.map +1 -0
  168. package/dist/core/builtin-diagnostics.js +14 -0
  169. package/dist/core/builtin-diagnostics.js.map +1 -0
  170. package/dist/core/builtin-packages.d.ts +5 -2
  171. package/dist/core/builtin-packages.d.ts.map +1 -1
  172. package/dist/core/builtin-packages.js +24 -3
  173. package/dist/core/builtin-packages.js.map +1 -1
  174. package/dist/core/builtin-resource-loader.d.ts +4 -0
  175. package/dist/core/builtin-resource-loader.d.ts.map +1 -0
  176. package/dist/core/builtin-resource-loader.js +239 -0
  177. package/dist/core/builtin-resource-loader.js.map +1 -0
  178. package/dist/core/cache-retention.d.ts +4 -0
  179. package/dist/core/cache-retention.d.ts.map +1 -0
  180. package/dist/core/cache-retention.js +58 -0
  181. package/dist/core/cache-retention.js.map +1 -0
  182. package/dist/core/cache-stats.d.ts.map +1 -1
  183. package/dist/core/cache-stats.js +11 -0
  184. package/dist/core/cache-stats.js.map +1 -1
  185. package/dist/core/cache-warmer.d.ts +66 -0
  186. package/dist/core/cache-warmer.d.ts.map +1 -0
  187. package/dist/core/cache-warmer.js +313 -0
  188. package/dist/core/cache-warmer.js.map +1 -0
  189. package/dist/core/child-session-options.d.ts +5 -0
  190. package/dist/core/child-session-options.d.ts.map +1 -0
  191. package/dist/core/child-session-options.js +30 -0
  192. package/dist/core/child-session-options.js.map +1 -0
  193. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  194. package/dist/core/compaction/branch-summarization.js +2 -2
  195. package/dist/core/compaction/branch-summarization.js.map +1 -1
  196. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  197. package/dist/core/compaction/compaction-boundary.js +2 -1
  198. package/dist/core/compaction/compaction-boundary.js.map +1 -1
  199. package/dist/core/compaction/compaction.d.ts.map +1 -1
  200. package/dist/core/compaction/compaction.js +18 -0
  201. package/dist/core/compaction/compaction.js.map +1 -1
  202. package/dist/core/compaction/fallback-planner.d.ts +1 -0
  203. package/dist/core/compaction/fallback-planner.d.ts.map +1 -1
  204. package/dist/core/compaction/fallback-planner.js +2 -0
  205. package/dist/core/compaction/fallback-planner.js.map +1 -1
  206. package/dist/core/compaction/range-planner.d.ts.map +1 -1
  207. package/dist/core/compaction/range-planner.js +3 -3
  208. package/dist/core/compaction/range-planner.js.map +1 -1
  209. package/dist/core/compaction/session-summarization.d.ts.map +1 -1
  210. package/dist/core/compaction/session-summarization.js +2 -1
  211. package/dist/core/compaction/session-summarization.js.map +1 -1
  212. package/dist/core/credential-screening.d.ts +17 -0
  213. package/dist/core/credential-screening.d.ts.map +1 -0
  214. package/dist/core/credential-screening.js +30 -0
  215. package/dist/core/credential-screening.js.map +1 -0
  216. package/dist/core/decision-provider.d.ts +4 -0
  217. package/dist/core/decision-provider.d.ts.map +1 -0
  218. package/dist/core/decision-provider.js +12 -0
  219. package/dist/core/decision-provider.js.map +1 -0
  220. package/dist/core/execution-model-router.d.ts +28 -0
  221. package/dist/core/execution-model-router.d.ts.map +1 -0
  222. package/dist/core/execution-model-router.js +165 -0
  223. package/dist/core/execution-model-router.js.map +1 -0
  224. package/dist/core/extensions/agent-events.d.ts +4 -4
  225. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  226. package/dist/core/extensions/agent-events.js.map +1 -1
  227. package/dist/core/extensions/api-types.d.ts +46 -40
  228. package/dist/core/extensions/api-types.d.ts.map +1 -1
  229. package/dist/core/extensions/api-types.js.map +1 -1
  230. package/dist/core/extensions/context-types.d.ts +7 -1
  231. package/dist/core/extensions/context-types.d.ts.map +1 -1
  232. package/dist/core/extensions/context-types.js.map +1 -1
  233. package/dist/core/extensions/event-results.d.ts +7 -6
  234. package/dist/core/extensions/event-results.d.ts.map +1 -1
  235. package/dist/core/extensions/event-results.js.map +1 -1
  236. package/dist/core/extensions/event-types.d.ts +2 -1
  237. package/dist/core/extensions/event-types.d.ts.map +1 -1
  238. package/dist/core/extensions/event-types.js.map +1 -1
  239. package/dist/core/extensions/extension-work.d.ts +14 -0
  240. package/dist/core/extensions/extension-work.d.ts.map +1 -0
  241. package/dist/core/extensions/extension-work.js +73 -0
  242. package/dist/core/extensions/extension-work.js.map +1 -0
  243. package/dist/core/extensions/herdr-file-integration.d.ts +36 -0
  244. package/dist/core/extensions/herdr-file-integration.d.ts.map +1 -0
  245. package/dist/core/extensions/herdr-file-integration.js +60 -0
  246. package/dist/core/extensions/herdr-file-integration.js.map +1 -0
  247. package/dist/core/extensions/host-input.d.ts +51 -0
  248. package/dist/core/extensions/host-input.d.ts.map +1 -0
  249. package/dist/core/extensions/host-input.js +211 -0
  250. package/dist/core/extensions/host-input.js.map +1 -0
  251. package/dist/core/extensions/index.d.ts +4 -2
  252. package/dist/core/extensions/index.d.ts.map +1 -1
  253. package/dist/core/extensions/index.js +0 -3
  254. package/dist/core/extensions/index.js.map +1 -1
  255. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  256. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  257. package/dist/core/extensions/jiti-loader.js +3 -0
  258. package/dist/core/extensions/jiti-loader.js.map +1 -0
  259. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  260. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  261. package/dist/core/extensions/jiti-static-loader.js +3 -0
  262. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  263. package/dist/core/extensions/loader-api.d.ts +7 -0
  264. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  265. package/dist/core/extensions/loader-api.js +154 -28
  266. package/dist/core/extensions/loader-api.js.map +1 -1
  267. package/dist/core/extensions/loader-bindings.d.ts +24 -0
  268. package/dist/core/extensions/loader-bindings.d.ts.map +1 -0
  269. package/dist/core/extensions/loader-bindings.js +128 -0
  270. package/dist/core/extensions/loader-bindings.js.map +1 -0
  271. package/dist/core/extensions/loader-core.d.ts +2 -1
  272. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  273. package/dist/core/extensions/loader-core.js +91 -14
  274. package/dist/core/extensions/loader-core.js.map +1 -1
  275. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  276. package/dist/core/extensions/loader-host-modules.js +3 -1
  277. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  278. package/dist/core/extensions/loader-rollback.d.ts +14 -0
  279. package/dist/core/extensions/loader-rollback.d.ts.map +1 -0
  280. package/dist/core/extensions/loader-rollback.js +95 -0
  281. package/dist/core/extensions/loader-rollback.js.map +1 -0
  282. package/dist/core/extensions/loader-runtime.d.ts +3 -1
  283. package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
  284. package/dist/core/extensions/loader-runtime.js +38 -14
  285. package/dist/core/extensions/loader-runtime.js.map +1 -1
  286. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  287. package/dist/core/extensions/loader-virtual-modules.js +9 -2
  288. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  289. package/dist/core/extensions/loader.d.ts +1 -1
  290. package/dist/core/extensions/loader.d.ts.map +1 -1
  291. package/dist/core/extensions/loader.js +1 -1
  292. package/dist/core/extensions/loader.js.map +1 -1
  293. package/dist/core/extensions/reactive-widget.d.ts +1 -1
  294. package/dist/core/extensions/reactive-widget.js.map +1 -1
  295. package/dist/core/extensions/runner-context.d.ts +4 -0
  296. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  297. package/dist/core/extensions/runner-context.js +25 -0
  298. package/dist/core/extensions/runner-context.js.map +1 -1
  299. package/dist/core/extensions/runner-events.d.ts +8 -4
  300. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  301. package/dist/core/extensions/runner-events.js +55 -53
  302. package/dist/core/extensions/runner-events.js.map +1 -1
  303. package/dist/core/extensions/runner-project-trust.d.ts.map +1 -1
  304. package/dist/core/extensions/runner-project-trust.js +2 -4
  305. package/dist/core/extensions/runner-project-trust.js.map +1 -1
  306. package/dist/core/extensions/runner.d.ts +31 -4
  307. package/dist/core/extensions/runner.d.ts.map +1 -1
  308. package/dist/core/extensions/runner.js +219 -23
  309. package/dist/core/extensions/runner.js.map +1 -1
  310. package/dist/core/extensions/runtime-types.d.ts +2 -0
  311. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  312. package/dist/core/extensions/runtime-types.js.map +1 -1
  313. package/dist/core/extensions/types.d.ts +3 -2
  314. package/dist/core/extensions/types.d.ts.map +1 -1
  315. package/dist/core/extensions/types.js +0 -12
  316. package/dist/core/extensions/types.js.map +1 -1
  317. package/dist/core/extensions/workflow-activity-hub.d.ts +2 -0
  318. package/dist/core/extensions/workflow-activity-hub.d.ts.map +1 -1
  319. package/dist/core/extensions/workflow-activity-hub.js +5 -3
  320. package/dist/core/extensions/workflow-activity-hub.js.map +1 -1
  321. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  322. package/dist/core/extensions/wrapper.js +5 -3
  323. package/dist/core/extensions/wrapper.js.map +1 -1
  324. package/dist/core/fast-model-routing.d.ts +3 -3
  325. package/dist/core/fast-model-routing.d.ts.map +1 -1
  326. package/dist/core/fast-model-routing.js +3 -3
  327. package/dist/core/fast-model-routing.js.map +1 -1
  328. package/dist/core/fast-model-variants.d.ts +4 -0
  329. package/dist/core/fast-model-variants.d.ts.map +1 -1
  330. package/dist/core/fast-model-variants.js +3 -0
  331. package/dist/core/fast-model-variants.js.map +1 -1
  332. package/dist/core/index.d.ts +4 -1
  333. package/dist/core/index.d.ts.map +1 -1
  334. package/dist/core/index.js +2 -0
  335. package/dist/core/index.js.map +1 -1
  336. package/dist/core/mandatory-resource-loader.d.ts +4 -0
  337. package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
  338. package/dist/core/mandatory-resource-loader.js +29 -1
  339. package/dist/core/mandatory-resource-loader.js.map +1 -1
  340. package/dist/core/mandatory-runtime-tools.d.ts +1 -4
  341. package/dist/core/mandatory-runtime-tools.d.ts.map +1 -1
  342. package/dist/core/mandatory-runtime-tools.js +1 -9
  343. package/dist/core/mandatory-runtime-tools.js.map +1 -1
  344. package/dist/core/messages.d.ts.map +1 -1
  345. package/dist/core/messages.js +8 -1
  346. package/dist/core/messages.js.map +1 -1
  347. package/dist/core/model-config.d.ts +41 -10
  348. package/dist/core/model-config.d.ts.map +1 -1
  349. package/dist/core/model-config.js +11 -2
  350. package/dist/core/model-config.js.map +1 -1
  351. package/dist/core/model-registry.d.ts +4 -2
  352. package/dist/core/model-registry.d.ts.map +1 -1
  353. package/dist/core/model-registry.js +6 -2
  354. package/dist/core/model-registry.js.map +1 -1
  355. package/dist/core/model-routing-constraints.d.ts +24 -0
  356. package/dist/core/model-routing-constraints.d.ts.map +1 -0
  357. package/dist/core/model-routing-constraints.js +46 -0
  358. package/dist/core/model-routing-constraints.js.map +1 -0
  359. package/dist/core/model-routing-task.d.ts +4 -0
  360. package/dist/core/model-routing-task.d.ts.map +1 -0
  361. package/dist/core/model-routing-task.js +76 -0
  362. package/dist/core/model-routing-task.js.map +1 -0
  363. package/dist/core/model-runtime-streaming.d.ts +13 -3
  364. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  365. package/dist/core/model-runtime-streaming.js +15 -5
  366. package/dist/core/model-runtime-streaming.js.map +1 -1
  367. package/dist/core/model-runtime-types.d.ts +2 -2
  368. package/dist/core/model-runtime-types.d.ts.map +1 -1
  369. package/dist/core/model-runtime-types.js.map +1 -1
  370. package/dist/core/model-runtime.d.ts +6 -3
  371. package/dist/core/model-runtime.d.ts.map +1 -1
  372. package/dist/core/model-runtime.js +29 -2
  373. package/dist/core/model-runtime.js.map +1 -1
  374. package/dist/core/provider-composer-internal.d.ts +3 -2
  375. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  376. package/dist/core/provider-composer-internal.js +2 -0
  377. package/dist/core/provider-composer-internal.js.map +1 -1
  378. package/dist/core/provider-composer.d.ts.map +1 -1
  379. package/dist/core/provider-composer.js.map +1 -1
  380. package/dist/core/resolve-config-value.d.ts +2 -0
  381. package/dist/core/resolve-config-value.d.ts.map +1 -1
  382. package/dist/core/resolve-config-value.js +23 -1
  383. package/dist/core/resolve-config-value.js.map +1 -1
  384. package/dist/core/resource-loader-core.d.ts +6 -0
  385. package/dist/core/resource-loader-core.d.ts.map +1 -1
  386. package/dist/core/resource-loader-core.js +37 -6
  387. package/dist/core/resource-loader-core.js.map +1 -1
  388. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  389. package/dist/core/resource-loader-extensions.js +2 -0
  390. package/dist/core/resource-loader-extensions.js.map +1 -1
  391. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  392. package/dist/core/resource-loader-reload.js +7 -2
  393. package/dist/core/resource-loader-reload.js.map +1 -1
  394. package/dist/core/resource-loader.d.ts +1 -1
  395. package/dist/core/resource-loader.d.ts.map +1 -1
  396. package/dist/core/resource-loader.js +1 -1
  397. package/dist/core/resource-loader.js.map +1 -1
  398. package/dist/core/runtime-credentials.d.ts +2 -0
  399. package/dist/core/runtime-credentials.d.ts.map +1 -1
  400. package/dist/core/runtime-credentials.js +15 -0
  401. package/dist/core/runtime-credentials.js.map +1 -1
  402. package/dist/core/sdk-types.d.ts +13 -5
  403. package/dist/core/sdk-types.d.ts.map +1 -1
  404. package/dist/core/sdk-types.js.map +1 -1
  405. package/dist/core/sdk.d.ts +3 -1
  406. package/dist/core/sdk.d.ts.map +1 -1
  407. package/dist/core/sdk.js +211 -37
  408. package/dist/core/sdk.js.map +1 -1
  409. package/dist/core/session-lifecycle-scope.d.ts +15 -0
  410. package/dist/core/session-lifecycle-scope.d.ts.map +1 -0
  411. package/dist/core/session-lifecycle-scope.js +13 -0
  412. package/dist/core/session-lifecycle-scope.js.map +1 -0
  413. package/dist/core/session-lifecycle-work.d.ts +17 -0
  414. package/dist/core/session-lifecycle-work.d.ts.map +1 -0
  415. package/dist/core/session-lifecycle-work.js +144 -0
  416. package/dist/core/session-lifecycle-work.js.map +1 -0
  417. package/dist/core/session-manager-core.d.ts +8 -4
  418. package/dist/core/session-manager-core.d.ts.map +1 -1
  419. package/dist/core/session-manager-core.js +27 -3
  420. package/dist/core/session-manager-core.js.map +1 -1
  421. package/dist/core/session-manager-history.d.ts.map +1 -1
  422. package/dist/core/session-manager-history.js +3 -0
  423. package/dist/core/session-manager-history.js.map +1 -1
  424. package/dist/core/session-manager-list.d.ts +3 -3
  425. package/dist/core/session-manager-list.d.ts.map +1 -1
  426. package/dist/core/session-manager-list.js +89 -74
  427. package/dist/core/session-manager-list.js.map +1 -1
  428. package/dist/core/session-manager-storage.d.ts.map +1 -1
  429. package/dist/core/session-manager-storage.js +10 -7
  430. package/dist/core/session-manager-storage.js.map +1 -1
  431. package/dist/core/session-manager-types.d.ts +13 -3
  432. package/dist/core/session-manager-types.d.ts.map +1 -1
  433. package/dist/core/session-manager-types.js.map +1 -1
  434. package/dist/core/session-manager.d.ts +1 -1
  435. package/dist/core/session-manager.d.ts.map +1 -1
  436. package/dist/core/session-manager.js.map +1 -1
  437. package/dist/core/session-startup-rollback.d.ts +5 -0
  438. package/dist/core/session-startup-rollback.d.ts.map +1 -0
  439. package/dist/core/session-startup-rollback.js +16 -0
  440. package/dist/core/session-startup-rollback.js.map +1 -0
  441. package/dist/core/settings-manager-basic-accessors.d.ts +5 -0
  442. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  443. package/dist/core/settings-manager-basic-accessors.js +35 -0
  444. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  445. package/dist/core/settings-manager-core.d.ts.map +1 -1
  446. package/dist/core/settings-manager-core.js +4 -0
  447. package/dist/core/settings-manager-core.js.map +1 -1
  448. package/dist/core/settings-manager.d.ts +1 -0
  449. package/dist/core/settings-manager.d.ts.map +1 -1
  450. package/dist/core/settings-manager.js +1 -0
  451. package/dist/core/settings-manager.js.map +1 -1
  452. package/dist/core/settings-types.d.ts +4 -0
  453. package/dist/core/settings-types.d.ts.map +1 -1
  454. package/dist/core/settings-types.js +1 -1
  455. package/dist/core/settings-types.js.map +1 -1
  456. package/dist/core/settings-write-ownership.d.ts +7 -0
  457. package/dist/core/settings-write-ownership.d.ts.map +1 -0
  458. package/dist/core/settings-write-ownership.js +24 -0
  459. package/dist/core/settings-write-ownership.js.map +1 -0
  460. package/dist/core/slash-commands.js +1 -1
  461. package/dist/core/slash-commands.js.map +1 -1
  462. package/dist/core/structured-output/index.d.ts +12 -0
  463. package/dist/core/structured-output/index.d.ts.map +1 -0
  464. package/dist/core/structured-output/index.js +251 -0
  465. package/dist/core/structured-output/index.js.map +1 -0
  466. package/dist/core/structured-output/invalid-output.d.ts +8 -0
  467. package/dist/core/structured-output/invalid-output.d.ts.map +1 -0
  468. package/dist/core/structured-output/invalid-output.js +4 -0
  469. package/dist/core/structured-output/invalid-output.js.map +1 -0
  470. package/dist/core/structured-output/jev-client.d.ts +20 -0
  471. package/dist/core/structured-output/jev-client.d.ts.map +1 -0
  472. package/dist/core/structured-output/jev-client.js +116 -0
  473. package/dist/core/structured-output/jev-client.js.map +1 -0
  474. package/dist/core/structured-output/jev.d.ts +5 -0
  475. package/dist/core/structured-output/jev.d.ts.map +1 -0
  476. package/dist/core/structured-output/jev.js +275 -0
  477. package/dist/core/structured-output/jev.js.map +1 -0
  478. package/dist/core/structured-output/resolver.d.ts +41 -0
  479. package/dist/core/structured-output/resolver.d.ts.map +1 -0
  480. package/dist/core/structured-output/resolver.js +56 -0
  481. package/dist/core/structured-output/resolver.js.map +1 -0
  482. package/dist/core/structured-output/types.d.ts +68 -0
  483. package/dist/core/structured-output/types.d.ts.map +1 -0
  484. package/dist/core/structured-output/types.js +2 -0
  485. package/dist/core/structured-output/types.js.map +1 -0
  486. package/dist/core/system-prompt.d.ts +48 -5
  487. package/dist/core/system-prompt.d.ts.map +1 -1
  488. package/dist/core/system-prompt.js +130 -99
  489. package/dist/core/system-prompt.js.map +1 -1
  490. package/dist/core/tasks/contracts.d.ts +6 -0
  491. package/dist/core/tasks/contracts.d.ts.map +1 -1
  492. package/dist/core/tasks/contracts.js.map +1 -1
  493. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  494. package/dist/core/tasks/supervisor.js +7 -0
  495. package/dist/core/tasks/supervisor.js.map +1 -1
  496. package/dist/core/tools/ask-user-question/ask-user-question.d.ts +4 -1
  497. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  498. package/dist/core/tools/ask-user-question/ask-user-question.js +31 -35
  499. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  500. package/dist/core/tools/ask-user-question/index.d.ts +1 -1
  501. package/dist/core/tools/ask-user-question/index.js.map +1 -1
  502. package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts +1 -1
  503. package/dist/core/tools/ask-user-question/state/build-questionnaire.js.map +1 -1
  504. package/dist/core/tools/ask-user-question/state/key-router.d.ts +1 -1
  505. package/dist/core/tools/ask-user-question/state/key-router.js.map +1 -1
  506. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +1 -1
  507. package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
  508. package/dist/core/tools/ask-user-question/state/row-intent.d.ts +1 -1
  509. package/dist/core/tools/ask-user-question/state/row-intent.js.map +1 -1
  510. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts +1 -1
  511. package/dist/core/tools/ask-user-question/state/selectors/contract.js.map +1 -1
  512. package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts +1 -1
  513. package/dist/core/tools/ask-user-question/state/selectors/derivations.js.map +1 -1
  514. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts +1 -1
  515. package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -1
  516. package/dist/core/tools/ask-user-question/state/state.d.ts +1 -1
  517. package/dist/core/tools/ask-user-question/state/state.js.map +1 -1
  518. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +1 -1
  519. package/dist/core/tools/ask-user-question/tool/format-answer.js.map +1 -1
  520. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts +1 -1
  521. package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -1
  522. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts +1 -1
  523. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.js.map +1 -1
  524. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts +1 -1
  525. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
  526. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts +1 -1
  527. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.js.map +1 -1
  528. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +1 -1
  529. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -1
  530. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts +1 -1
  531. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.js.map +1 -1
  532. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts +1 -1
  533. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js.map +1 -1
  534. package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
  535. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
  536. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts +1 -1
  537. package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
  538. package/dist/core/tools/ask-user-question/view/props-adapter.d.ts +1 -1
  539. package/dist/core/tools/ask-user-question/view/props-adapter.js.map +1 -1
  540. package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts +1 -1
  541. package/dist/core/tools/ask-user-question/view/tab-content-strategy.js.map +1 -1
  542. package/dist/core/tools/bash.d.ts.map +1 -1
  543. package/dist/core/tools/bash.js +16 -11
  544. package/dist/core/tools/bash.js.map +1 -1
  545. package/dist/core/tools/find.d.ts +2 -2
  546. package/dist/core/tools/find.d.ts.map +1 -1
  547. package/dist/core/tools/find.js +1 -1
  548. package/dist/core/tools/find.js.map +1 -1
  549. package/dist/core/usage-totals.d.ts.map +1 -1
  550. package/dist/core/usage-totals.js +4 -0
  551. package/dist/core/usage-totals.js.map +1 -1
  552. package/dist/extensions/herdr/index.d.ts.map +1 -1
  553. package/dist/extensions/herdr/index.js +0 -7
  554. package/dist/extensions/herdr/index.js.map +1 -1
  555. package/dist/extensions/llama/client.d.ts +2 -0
  556. package/dist/extensions/llama/client.d.ts.map +1 -1
  557. package/dist/extensions/llama/client.js +6 -2
  558. package/dist/extensions/llama/client.js.map +1 -1
  559. package/dist/extensions/llama/provider.d.ts.map +1 -1
  560. package/dist/extensions/llama/provider.js +18 -4
  561. package/dist/extensions/llama/provider.js.map +1 -1
  562. package/dist/index.d.ts +10 -1
  563. package/dist/index.d.ts.map +1 -1
  564. package/dist/index.js +5 -0
  565. package/dist/index.js.map +1 -1
  566. package/dist/main-session.d.ts.map +1 -1
  567. package/dist/main-session.js +19 -10
  568. package/dist/main-session.js.map +1 -1
  569. package/dist/main.d.ts.map +1 -1
  570. package/dist/main.js +4 -5
  571. package/dist/main.js.map +1 -1
  572. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  573. package/dist/modes/interactive/components/branch-summary-message.js +12 -5
  574. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  575. package/dist/modes/interactive/components/chat-message-renderer.d.ts +5 -1
  576. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  577. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  578. package/dist/modes/interactive/components/chat-session-host-events.d.ts +2 -2
  579. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  580. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  581. package/dist/modes/interactive/components/compaction-boundary-message.js +17 -9
  582. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  583. package/dist/modes/interactive/components/custom-editor.d.ts +6 -0
  584. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  585. package/dist/modes/interactive/components/custom-editor.js +17 -0
  586. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  587. package/dist/modes/interactive/components/host-input-form-mount.d.ts +1 -1
  588. package/dist/modes/interactive/components/host-input-form-mount.js.map +1 -1
  589. package/dist/modes/interactive/components/host-input-form.d.ts +1 -1
  590. package/dist/modes/interactive/components/host-input-form.js.map +1 -1
  591. package/dist/modes/interactive/components/host-session-picker.d.ts +1 -1
  592. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  593. package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts +1 -1
  594. package/dist/modes/interactive/components/reserved-bottom-overlay.js.map +1 -1
  595. package/dist/modes/interactive/components/scroll-widget.d.ts +1 -1
  596. package/dist/modes/interactive/components/scroll-widget.js.map +1 -1
  597. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
  598. package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
  599. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  600. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  601. package/dist/modes/interactive/components/settings-selector-items.js +50 -1
  602. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  603. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
  604. package/dist/modes/interactive/components/settings-selector-submenus.js +2 -1
  605. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
  606. package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -1
  607. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  608. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  609. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  610. package/dist/modes/interactive/components/skill-invocation-message.js +11 -4
  611. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  612. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  613. package/dist/modes/interactive/components/tool-execution.js +14 -9
  614. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  615. package/dist/modes/interactive/interactive-auth-login.js +1 -1
  616. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  617. package/dist/modes/interactive/interactive-auth-routing.js +2 -2
  618. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  619. package/dist/modes/interactive/interactive-autocomplete.js +4 -0
  620. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  621. package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -1
  622. package/dist/modes/interactive/interactive-bash-compact.js +13 -6
  623. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  624. package/dist/modes/interactive/interactive-extension-runtime.js +5 -0
  625. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  626. package/dist/modes/interactive/interactive-input-handling.js +2 -2
  627. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  628. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  629. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  630. package/dist/modes/interactive/interactive-mode-deps.js +1 -1
  631. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  632. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -1
  633. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  634. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  635. package/dist/modes/interactive/interactive-render-chat.js +27 -25
  636. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  637. package/dist/modes/interactive/interactive-selectors.js +10 -0
  638. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  639. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  640. package/dist/modes/interactive/interactive-startup.js +2 -2
  641. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  642. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  643. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  644. package/dist/modes/interactive-engine/engine-custom-ui.js +3 -1
  645. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  646. package/dist/modes/interactive-engine/engine-input-form.d.ts +1 -1
  647. package/dist/modes/interactive-engine/engine-input-form.js.map +1 -1
  648. package/dist/modes/interactive-engine/engine-session-picker.d.ts +1 -1
  649. package/dist/modes/interactive-engine/engine-session-picker.js.map +1 -1
  650. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  651. package/dist/modes/interactive-engine/isolated-runtime.js +10 -1
  652. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  653. package/dist/modes/interactive-engine/protocol.d.ts +1 -1
  654. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  655. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  656. package/dist/modes/rpc/rpc-keybindings-reload.d.ts +1 -1
  657. package/dist/modes/rpc/rpc-keybindings-reload.js.map +1 -1
  658. package/dist/modes/rpc/rpc-provider-auth.d.ts +1 -1
  659. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  660. package/dist/session-id-target.d.ts +31 -0
  661. package/dist/session-id-target.d.ts.map +1 -0
  662. package/dist/session-id-target.js +57 -0
  663. package/dist/session-id-target.js.map +1 -0
  664. package/dist/utils/abort.d.ts.map +1 -1
  665. package/dist/utils/abort.js +29 -4
  666. package/dist/utils/abort.js.map +1 -1
  667. package/dist/utils/clipboard-image.d.ts.map +1 -1
  668. package/dist/utils/clipboard-image.js +1 -12
  669. package/dist/utils/clipboard-image.js.map +1 -1
  670. package/dist/utils/clipboard.d.ts.map +1 -1
  671. package/dist/utils/clipboard.js +87 -23
  672. package/dist/utils/clipboard.js.map +1 -1
  673. package/dist/utils/wsl.d.ts +3 -0
  674. package/dist/utils/wsl.d.ts.map +1 -0
  675. package/dist/utils/wsl.js +15 -0
  676. package/dist/utils/wsl.js.map +1 -0
  677. package/docs/background-tasks.md +24 -14
  678. package/docs/build.md +6 -16
  679. package/docs/compaction/reference.md +10 -12
  680. package/docs/compaction.md +30 -112
  681. package/docs/computer-use.md +1 -3
  682. package/docs/containerization.md +4 -5
  683. package/docs/custom-provider/api-reference.md +10 -1
  684. package/docs/custom-provider/oauth.md +4 -2
  685. package/docs/custom-provider/streaming.md +8 -3
  686. package/docs/custom-provider.md +1 -1
  687. package/docs/development.md +13 -138
  688. package/docs/docs.json +19 -5
  689. package/docs/environment-variables.md +20 -4
  690. package/docs/extensions/api-reference.md +6 -2
  691. package/docs/extensions/authoring.md +10 -7
  692. package/docs/extensions/events.md +14 -24
  693. package/docs/extensions/ui.md +3 -4
  694. package/docs/extensions.md +22 -18
  695. package/docs/getting-started/authentication.md +4 -1
  696. package/docs/getting-started/first-session.md +8 -6
  697. package/docs/getting-started/installation.md +8 -4
  698. package/docs/getting-started/project-instructions.md +5 -1
  699. package/docs/guides/configuration.md +10 -5
  700. package/docs/guides/non-interactive.md +2 -2
  701. package/docs/guides.md +8 -17
  702. package/docs/herdr.md +2 -1
  703. package/docs/index.md +2 -2
  704. package/docs/intercom/operations.md +16 -70
  705. package/docs/intercom/reference.md +15 -5
  706. package/docs/intercom.md +10 -6
  707. package/docs/json.md +12 -2
  708. package/docs/keybindings.md +13 -8
  709. package/docs/llama-cpp.md +5 -1
  710. package/docs/{mcp.md → mcp-servers.md} +21 -2
  711. package/docs/models/evals.md +133 -465
  712. package/docs/models/model-selection.md +27 -116
  713. package/docs/models/reference.md +18 -21
  714. package/docs/models.md +7 -4
  715. package/docs/packages/authoring.md +5 -1
  716. package/docs/packages/reference.md +5 -1
  717. package/docs/packages.md +5 -3
  718. package/docs/programmatic.md +3 -1
  719. package/docs/prompt-templates.md +2 -10
  720. package/docs/providers/reference.md +2 -2
  721. package/docs/providers.md +41 -16
  722. package/docs/quickstart.md +7 -3
  723. package/docs/reference/cli.md +19 -11
  724. package/docs/reference.md +3 -6
  725. package/docs/rpc/protocol.md +11 -13
  726. package/docs/rpc.md +5 -1
  727. package/docs/sdk/reference.md +59 -239
  728. package/docs/sdk/structured-decisions.md +132 -0
  729. package/docs/sdk.md +181 -17
  730. package/docs/security.md +7 -4
  731. package/docs/session-format.md +18 -5
  732. package/docs/sessions.md +12 -6
  733. package/docs/settings.md +68 -16
  734. package/docs/skills/authoring.md +7 -1
  735. package/docs/skills.md +25 -6
  736. package/docs/subagents/authoring.md +11 -1
  737. package/docs/subagents/reference.md +98 -10
  738. package/docs/subagents.md +45 -35
  739. package/docs/terminal-setup.md +4 -2
  740. package/docs/termux.md +3 -1
  741. package/docs/themes/reference.md +4 -1
  742. package/docs/themes.md +1 -1
  743. package/docs/tools.md +431 -20
  744. package/docs/tui/reference.md +13 -14
  745. package/docs/tui.md +10 -6
  746. package/docs/usage.md +19 -7
  747. package/docs/web-access.md +5 -1
  748. package/docs/windows.md +18 -11
  749. package/docs/workflows/api-reference.md +135 -25
  750. package/docs/workflows/authoring.md +48 -39
  751. package/docs/workflows/builtins.md +20 -26
  752. package/docs/workflows/operations.md +284 -137
  753. package/docs/workflows/reliable-design.md +62 -129
  754. package/docs/workflows.md +10 -16
  755. package/examples/extensions/custom-provider-anthropic/index.ts +15 -10
  756. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  757. package/examples/extensions/prompt-customizer.ts +17 -37
  758. package/npm-shrinkwrap.json +502 -709
  759. package/package.json +12 -10
  760. package/dist/builtin/workflows/builtin/chunk-m0xfsef8.js +0 -2813
  761. package/docs/models/artificial-analysis-index.md +0 -89
  762. package/docs/models/pareto-efficiency.md +0 -90
  763. package/docs/tools/edit.md +0 -378
@@ -1,8 +1,12 @@
1
- import { execSync, spawn } from "child_process";
2
- import { platform } from "os";
1
+ import { execFileSync, execSync, spawn } from "child_process";
2
+ import { randomUUID } from "crypto";
3
+ import { unlinkSync, writeFileSync } from "fs";
4
+ import { platform, tmpdir } from "os";
5
+ import { join } from "path";
3
6
  import { createChildProcessEnvironment } from "./child-process.js";
4
7
  import { isWaylandSession } from "./clipboard-image.js";
5
8
  import { clipboard } from "./clipboard-native.js";
9
+ import { isWSL } from "./wsl.js";
6
10
  function copyToX11Clipboard(options) {
7
11
  try {
8
12
  execSync("xclip -selection clipboard", options);
@@ -12,7 +16,7 @@ function copyToX11Clipboard(options) {
12
16
  }
13
17
  }
14
18
  const MAX_OSC52_ENCODED_LENGTH = 100_000;
15
- function isRemoteSession(env = process.env) {
19
+ function isRemoteSession(env) {
16
20
  return Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);
17
21
  }
18
22
  function emitOsc52(text) {
@@ -23,6 +27,45 @@ function emitOsc52(text) {
23
27
  process.stdout.write(`\x1b]52;c;${encoded}\x07`);
24
28
  return true;
25
29
  }
30
+ /**
31
+ * WSL without WSLg has no Linux display, so the Windows clipboard is written through
32
+ * interop. PowerShell reads the text from a file because `clip.exe` and PowerShell stdin
33
+ * decode piped bytes with the console code page, which mangles non-ASCII UTF-8.
34
+ */
35
+ function copyViaWindowsClipboard(text) {
36
+ const tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.txt`);
37
+ const env = createChildProcessEnvironment();
38
+ try {
39
+ writeFileSync(tmpFile, text, { encoding: "utf8", mode: 0o600 });
40
+ const winPath = execFileSync("wslpath", ["-w", tmpFile], {
41
+ timeout: 1000,
42
+ stdio: ["ignore", "pipe", "ignore"],
43
+ env,
44
+ })
45
+ .toString("utf8")
46
+ .trim();
47
+ if (!winPath)
48
+ return false;
49
+ const script = `Set-Clipboard -Value ([System.IO.File]::ReadAllText('${winPath.replaceAll("'", "''")}', [System.Text.Encoding]::UTF8))`;
50
+ execFileSync("powershell.exe", ["-NoProfile", "-Command", script], {
51
+ timeout: 5000,
52
+ stdio: ["ignore", "ignore", "ignore"],
53
+ env,
54
+ });
55
+ return true;
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ finally {
61
+ try {
62
+ unlinkSync(tmpFile);
63
+ }
64
+ catch {
65
+ // The file may not have been created.
66
+ }
67
+ }
68
+ }
26
69
  export async function readClipboardText(source = clipboard) {
27
70
  try {
28
71
  if (!source)
@@ -36,6 +79,7 @@ export async function readClipboardText(source = clipboard) {
36
79
  export async function copyToClipboard(text) {
37
80
  let copied = false;
38
81
  const p = platform();
82
+ const env = process.env;
39
83
  // Prefer direct clipboard writes. Emitting OSC 52 first can make terminals
40
84
  // write the same native clipboard concurrently with the addon, and very large
41
85
  // OSC 52 payloads can desynchronize terminal rendering.
@@ -55,7 +99,7 @@ export async function copyToClipboard(text) {
55
99
  catch {
56
100
  // Fall through to platform-specific clipboard tools.
57
101
  }
58
- const remote = isRemoteSession();
102
+ const remote = isRemoteSession(env);
59
103
  if (copied && !remote) {
60
104
  return;
61
105
  }
@@ -77,7 +121,7 @@ export async function copyToClipboard(text) {
77
121
  }
78
122
  else {
79
123
  // Linux. Try Termux, Wayland, or X11 clipboard tools.
80
- if (process.env.TERMUX_VERSION) {
124
+ if (env.TERMUX_VERSION) {
81
125
  try {
82
126
  execSync("termux-clipboard-set", options);
83
127
  copied = true;
@@ -87,8 +131,8 @@ export async function copyToClipboard(text) {
87
131
  }
88
132
  }
89
133
  if (!copied) {
90
- const hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);
91
- const hasX11Display = Boolean(process.env.DISPLAY);
134
+ const hasWaylandDisplay = Boolean(env.WAYLAND_DISPLAY);
135
+ const hasX11Display = Boolean(env.DISPLAY);
92
136
  const isWayland = isWaylandSession();
93
137
  if (isWayland && hasWaylandDisplay) {
94
138
  try {
@@ -138,24 +182,44 @@ export async function copyToClipboard(text) {
138
182
  // Fall through to OSC 52 fallback.
139
183
  }
140
184
  }
141
- if (remote) {
142
- const osc52Copied = emitOsc52(text);
143
- copied = copied || osc52Copied;
185
+ let osc52Emitted = false;
186
+ // A remote session skips the Windows clipboard: the copied text belongs on the connected
187
+ // client, which the OSC 52 fallback below reaches, not on the remote host.
188
+ if (!copied && !remote && p === "linux" && isWSL(env)) {
189
+ // Windows Terminal supports OSC 52; prefer it over the slower PowerShell round trip.
190
+ if (env.WT_SESSION)
191
+ osc52Emitted = emitOsc52(text);
192
+ copied = osc52Emitted || copyViaWindowsClipboard(text);
144
193
  }
145
- if (!copied) {
146
- if (p === "linux") {
147
- if (process.env.TERMUX_VERSION) {
148
- throw new Error("Clipboard unavailable: install the Termux:API app and `termux-api` package");
149
- }
150
- if (process.env.WAYLAND_DISPLAY) {
151
- throw new Error("Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access");
152
- }
153
- if (process.env.DISPLAY) {
154
- throw new Error("Clipboard unavailable: install `xclip` or `xsel`, or check X11 access");
155
- }
156
- throw new Error("Clipboard unavailable: no Wayland or X11 display detected");
194
+ // OSC 52 cannot be verified, so a desktop session with a display reports the failure
195
+ // instead. Without a display the terminal is the only clipboard route (containers,
196
+ // WSL without WSLg). A remote session emits it even after a successful local write:
197
+ // that write reached the remote host's display clipboard, while the user is at the
198
+ // client, which only the terminal can reach. The Windows interop fallback above is
199
+ // different because it is a last resort that a remote session gains nothing from.
200
+ const headless = p === "linux" && !env.DISPLAY && !env.WAYLAND_DISPLAY && !env.TERMUX_VERSION;
201
+ let oversized = false;
202
+ if (!osc52Emitted && (remote || (!copied && headless))) {
203
+ if (emitOsc52(text))
204
+ copied = true;
205
+ else
206
+ oversized = true;
207
+ }
208
+ if (copied)
209
+ return;
210
+ if (oversized)
211
+ throw new Error("Clipboard unavailable: text exceeds the OSC 52 size limit");
212
+ if (p === "linux") {
213
+ if (env.TERMUX_VERSION) {
214
+ throw new Error("Clipboard unavailable: install the Termux:API app and `termux-api` package");
215
+ }
216
+ if (env.WAYLAND_DISPLAY) {
217
+ throw new Error("Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access");
218
+ }
219
+ if (env.DISPLAY) {
220
+ throw new Error("Clipboard unavailable: install `xclip` or `xsel`, or check X11 access");
157
221
  }
158
- throw new Error("Clipboard unavailable");
159
222
  }
223
+ throw new Error("Clipboard unavailable");
160
224
  }
161
225
  //# sourceMappingURL=clipboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],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AAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;YACtG,CAAC;YACD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC1F,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC1C,CAAC;AACF,CAAC","sourcesContent":["import { execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { createChildProcessEnvironment } from \"./child-process.ts\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n\tenv: NodeJS.ProcessEnv;\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nexport async function readClipboardText(\n\tsource: { getText(): Promise<string> } | null = clipboard,\n): Promise<string | null> {\n\ttry {\n\t\tif (!source) return null;\n\t\treturn await source.getText();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = {\n\t\tinput: text,\n\t\ttimeout: 5000,\n\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\tenv: createChildProcessEnvironment(),\n\t};\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\", env: createChildProcessEnvironment() });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead.\n\t\t\t\t\t\t\t// Await its terminal event so failures can fall through to X11 or OSC 52.\n\t\t\t\t\t\t\tconst exitCode = await new Promise<number>((resolve) => {\n\t\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], {\n\t\t\t\t\t\t\t\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\t\t\t\t\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tlet settled = false;\n\t\t\t\t\t\t\t\tconst finish = (code: number) => {\n\t\t\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\t\t\tresolve(code);\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tproc.once(\"error\", () => finish(1));\n\t\t\t\t\t\t\t\tproc.once(\"close\", (code) => finish(code ?? 1));\n\t\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {});\n\t\t\t\t\t\t\t\tproc.stdin.end(text);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (exitCode === 0) copied = true;\n\t\t\t\t\t\t\telse if (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tif (p === \"linux\") {\n\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\tthrow new Error(\"Clipboard unavailable: install the Termux:API app and `termux-api` package\");\n\t\t\t}\n\t\t\tif (process.env.WAYLAND_DISPLAY) {\n\t\t\t\tthrow new Error(\"Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access\");\n\t\t\t}\n\t\t\tif (process.env.DISPLAY) {\n\t\t\t\tthrow new Error(\"Clipboard unavailable: install `xclip` or `xsel`, or check X11 access\");\n\t\t\t}\n\t\t\tthrow new Error(\"Clipboard unavailable: no Wayland or X11 display detected\");\n\t\t}\n\t\tthrow new Error(\"Clipboard unavailable\");\n\t}\n}\n"]}
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AASjC,SAAS,kBAAkB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B,CAAC;IACD,IAAI,MAAM;QAAE,OAAO;IACnB,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC5F,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC;QACnB,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAC/F,CAAC;QACD,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACtG,CAAC;QACD,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;QAC1F,CAAC;IACF,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { execFileSync, execSync, spawn } from \"child_process\";\nimport { randomUUID } from \"crypto\";\nimport { unlinkSync, writeFileSync } from \"fs\";\nimport { platform, tmpdir } from \"os\";\nimport { join } from \"path\";\nimport { createChildProcessEnvironment } from \"./child-process.ts\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { isWSL } from \"./wsl.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n\tenv: NodeJS.ProcessEnv;\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\n/**\n * WSL without WSLg has no Linux display, so the Windows clipboard is written through\n * interop. PowerShell reads the text from a file because `clip.exe` and PowerShell stdin\n * decode piped bytes with the console code page, which mangles non-ASCII UTF-8.\n */\nfunction copyViaWindowsClipboard(text: string): boolean {\n\tconst tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.txt`);\n\tconst env = createChildProcessEnvironment();\n\ttry {\n\t\twriteFileSync(tmpFile, text, { encoding: \"utf8\", mode: 0o600 });\n\t\tconst winPath = execFileSync(\"wslpath\", [\"-w\", tmpFile], {\n\t\t\ttimeout: 1000,\n\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\tenv,\n\t\t})\n\t\t\t.toString(\"utf8\")\n\t\t\t.trim();\n\t\tif (!winPath) return false;\n\t\tconst script = `Set-Clipboard -Value ([System.IO.File]::ReadAllText('${winPath.replaceAll(\"'\", \"''\")}', [System.Text.Encoding]::UTF8))`;\n\t\texecFileSync(\"powershell.exe\", [\"-NoProfile\", \"-Command\", script], {\n\t\t\ttimeout: 5000,\n\t\t\tstdio: [\"ignore\", \"ignore\", \"ignore\"],\n\t\t\tenv,\n\t\t});\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// The file may not have been created.\n\t\t}\n\t}\n}\n\nexport async function readClipboardText(\n\tsource: { getText(): Promise<string> } | null = clipboard,\n): Promise<string | null> {\n\ttry {\n\t\tif (!source) return null;\n\t\treturn await source.getText();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\tconst env = process.env;\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession(env);\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = {\n\t\tinput: text,\n\t\ttimeout: 5000,\n\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\tenv: createChildProcessEnvironment(),\n\t};\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\", env: createChildProcessEnvironment() });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead.\n\t\t\t\t\t\t\t// Await its terminal event so failures can fall through to X11 or OSC 52.\n\t\t\t\t\t\t\tconst exitCode = await new Promise<number>((resolve) => {\n\t\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], {\n\t\t\t\t\t\t\t\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\t\t\t\t\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tlet settled = false;\n\t\t\t\t\t\t\t\tconst finish = (code: number) => {\n\t\t\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\t\t\tresolve(code);\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tproc.once(\"error\", () => finish(1));\n\t\t\t\t\t\t\t\tproc.once(\"close\", (code) => finish(code ?? 1));\n\t\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {});\n\t\t\t\t\t\t\t\tproc.stdin.end(text);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (exitCode === 0) copied = true;\n\t\t\t\t\t\t\telse if (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tlet osc52Emitted = false;\n\t// A remote session skips the Windows clipboard: the copied text belongs on the connected\n\t// client, which the OSC 52 fallback below reaches, not on the remote host.\n\tif (!copied && !remote && p === \"linux\" && isWSL(env)) {\n\t\t// Windows Terminal supports OSC 52; prefer it over the slower PowerShell round trip.\n\t\tif (env.WT_SESSION) osc52Emitted = emitOsc52(text);\n\t\tcopied = osc52Emitted || copyViaWindowsClipboard(text);\n\t}\n\t// OSC 52 cannot be verified, so a desktop session with a display reports the failure\n\t// instead. Without a display the terminal is the only clipboard route (containers,\n\t// WSL without WSLg). A remote session emits it even after a successful local write:\n\t// that write reached the remote host's display clipboard, while the user is at the\n\t// client, which only the terminal can reach. The Windows interop fallback above is\n\t// different because it is a last resort that a remote session gains nothing from.\n\tconst headless = p === \"linux\" && !env.DISPLAY && !env.WAYLAND_DISPLAY && !env.TERMUX_VERSION;\n\tlet oversized = false;\n\tif (!osc52Emitted && (remote || (!copied && headless))) {\n\t\tif (emitOsc52(text)) copied = true;\n\t\telse oversized = true;\n\t}\n\tif (copied) return;\n\tif (oversized) throw new Error(\"Clipboard unavailable: text exceeds the OSC 52 size limit\");\n\tif (p === \"linux\") {\n\t\tif (env.TERMUX_VERSION) {\n\t\t\tthrow new Error(\"Clipboard unavailable: install the Termux:API app and `termux-api` package\");\n\t\t}\n\t\tif (env.WAYLAND_DISPLAY) {\n\t\t\tthrow new Error(\"Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access\");\n\t\t}\n\t\tif (env.DISPLAY) {\n\t\t\tthrow new Error(\"Clipboard unavailable: install `xclip` or `xsel`, or check X11 access\");\n\t\t}\n\t}\n\tthrow new Error(\"Clipboard unavailable\");\n}\n"]}
@@ -0,0 +1,3 @@
1
+ /** Windows Subsystem for Linux, where Windows executables are reachable through interop. */
2
+ export declare function isWSL(env?: NodeJS.ProcessEnv): boolean;
3
+ //# sourceMappingURL=wsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wsl.d.ts","sourceRoot":"","sources":["../../src/utils/wsl.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,wBAAgB,KAAK,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAWnE"}
@@ -0,0 +1,15 @@
1
+ import { readFileSync } from "node:fs";
2
+ /** Windows Subsystem for Linux, where Windows executables are reachable through interop. */
3
+ export function isWSL(env = process.env) {
4
+ if (env.WSL_DISTRO_NAME || env.WSLENV) {
5
+ return true;
6
+ }
7
+ try {
8
+ const release = readFileSync("/proc/version", "utf-8");
9
+ return /microsoft|wsl/i.test(release);
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ //# sourceMappingURL=wsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wsl.js","sourceRoot":"","sources":["../../src/utils/wsl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,4FAA4F;AAC5F,MAAM,UAAU,KAAK,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACzD,IAAI,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\n\n/** Windows Subsystem for Linux, where Windows executables are reachable through interop. */\nexport function isWSL(env: NodeJS.ProcessEnv = process.env): boolean {\n\tif (env.WSL_DISTRO_NAME || env.WSLENV) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tconst release = readFileSync(\"/proc/version\", \"utf-8\");\n\t\treturn /microsoft|wsl/i.test(release);\n\t} catch {\n\t\treturn false;\n\t}\n}\n"]}
@@ -13,13 +13,23 @@ In main chat and live workflow-stage chat, a compact indicator appears **below t
13
13
  Tasks 2 local agents running · 1 queued · /tasks
14
14
  ```
15
15
 
16
- It summarizes only active background agents and shells, including queued work, stopping tasks, and tasks needing attention. Completed, failed, and stopped tasks leave the footer immediately; when no background work is active, the indicator disappears. Results and failure details remain in completion cards and `/tasks`, so an old failure cannot keep the live indicator red. Running tasks do not expire merely because they are quiet.
16
+ The indicator counts active agents and shells, including queued, stopping, and attention-needed tasks. Completed, failed, and stopped tasks leave it immediately. It disappears when no background work is active. Quiet tasks do not expire.
17
17
 
18
- Run `/tasks` to open a compact inline picker in the editor slot, like `/workflow connect`, with the conversation still visible above it. Detail, transcript, input, and cancellation-confirmation pages use the full screen. Escape returns to the picker with the selected task preserved, then to chat. The command also appears in workflow-stage slash suggestions, including when skill commands are disabled. Foreground-only commands do not appear. Work that ran in the background stays available after completion or a later foreground wait. Updates never open the list automatically. Closing the inspector does not stop the tasks.
18
+ ### Open the task inspector
19
19
 
20
- Main and workflow-stage pickers use the same layout for empty and populated lists. Below the picker, the footer keeps that chat's resolved model and reasoning level, current folder and Git branch, and MCP status, including while its foreground turn streams. Each picker lists only its owner's tasks.
20
+ Run `/tasks` to inspect work without stopping it:
21
21
 
22
- Opening `/tasks` is navigation, not an approval request. It does not mark the agent blocked in Herdr or produce a "Main chat needs input" notice. A genuine main-chat question waiting behind the workflow graph still shows that notice until answered or the graph is hidden or closed. The inspector stays open until you close it, even when its tasks finish; task history is not deleted when the compact indicator disappears.
22
+ - The compact picker opens in the editor slot, with the conversation visible above it. It lists only tasks owned by that chat.
23
+ - Detail, transcript, input, and cancellation-confirmation pages use the full screen.
24
+ - Escape returns to the picker with your selection preserved, then to chat.
25
+ - Completed background work remains available, including after a later foreground wait. Foreground-only commands are excluded.
26
+ - Updates never open or close the inspector automatically. Closing it does not stop tasks.
27
+
28
+ Results and failures remain in completion cards and `/tasks` after leaving the live indicator. The command appears in workflow-stage slash suggestions even when skill commands are disabled.
29
+
30
+ Main and workflow-stage pickers share the same layout. Their footers retain the chat's resolved model and reasoning level, current folder and Git branch, and MCP status, including during foreground streaming.
31
+
32
+ Opening `/tasks` is navigation, not approval. It does not mark the agent blocked in Herdr or produce a "Main chat needs input" notice. A genuine question waiting behind the workflow graph still shows that notice until answered or the graph is hidden or closed.
23
33
 
24
34
  ## Choose how long to wait
25
35
 
@@ -41,7 +51,7 @@ If the task finishes during observation, the call returns its terminal result in
41
51
 
42
52
  Shell `budgetMs` accepts finite non-negative milliseconds; zero means no observation delay. On command launches it belongs inside a foreground `wait`; existing-task `action: "wait"` calls take it at the top level. A trusted SDK host can override the usual budgets or select `tasks.wait.kind: "until-settled"`; omitted foreground budgets then wait until settlement. Explicit per-call budgets still take precedence.
43
53
 
44
- Native observation timers run independently of JavaScript. A zero-budget wait can already be backgrounded by the time a caller reads the next task snapshot, even before JavaScript awaits the result. Synchronous wait registration does not guarantee a visible foreground interval. The elapsed result still identifies the same wait and task; execution continues.
54
+ A zero-budget wait may return a background state immediately. It still refers to the same task; execution continues.
45
55
 
46
56
  ## Background subagents
47
57
 
@@ -110,11 +120,13 @@ Completion creates a shaded notification card in the owning chat without dependi
110
120
  /tasks to inspect
111
121
  ```
112
122
 
113
- The parent model also receives the result context. The internal receipt stays in structured message details, rather than becoming raw JSON in chat. The same persisted completion identity handles delivery retries without relaunching the child. Workflow completions remain in their owning stage chat, not the main conversation.
123
+ The parent model also receives the result context. Delivery retries do not relaunch the child. Workflow completions stay in their owning stage chat, not the main conversation.
114
124
 
115
125
  Supervisor progress messages are labelled **Historical supervisor update** with their original `Sent:` timestamp. They describe the child's state when sent, not its current status, and can arrive after completion. Prefer a later correction or final result over an earlier progress hypothesis; use `/tasks` for the current task state.
116
126
 
117
- Stopping a subagent through `/tasks` (`x`, then `y`) also delivers a **stopped** card and stop context to the parent model. The notice arrives after termination is confirmed, not while the task is merely **Stopping**, and does not require a final response from the child. Cancelling queued work notifies without starting it. Repeated stop requests or late child results do not duplicate the notice or overwrite the recorded outcome; a task that finished before cancellation keeps its actual result. Closing the owning session or workflow stage still suppresses late notices.
127
+ Stopping a subagent through `/tasks` (`x`, then `y`) delivers a **stopped** card and stop context to the parent model. The notice arrives only after termination is confirmed, not while the task is **Stopping**. It requires no final response from the child. Cancelling queued work sends the notice without starting it.
128
+
129
+ Repeated stop requests or late child results do not duplicate the notice or overwrite the recorded outcome. A task that finished before cancellation keeps its actual result. Closing the owning session or workflow stage still suppresses late notices.
118
130
 
119
131
  Restored completions may have only an outcome and task identity if the original live task or transcript is unavailable. Atomic does not invent missing output. Excerpts are bounded; inspect retained history for more detail.
120
132
 
@@ -199,7 +211,7 @@ The response includes `taskId`, `decision`, `execution`, and `cleanup`. `cancell
199
211
 
200
212
  Shell completions use the same shaded card as subagents, with a retained output preview and available exit code. Nonzero shell exits are shown as failures even though the process itself reached a terminal state. Cancellation shows Stopped. The card and below-prompt count update in the owning main or workflow-stage chat.
201
213
 
202
- Native Windows owned shells use supervised pipes or ConPTY, with Job Object containment before execution resumes and confirmed cleanup. If containment cannot be established, launch is refused rather than falling back to unsupervised execution. The legacy Windows WSL `bash.exe` stdin transport remains unsupported for owned launch because Windows jobs cannot supervise Linux guest processes. Running Atomic inside WSL uses the normal POSIX/Bash path.
214
+ Native Windows refuses owned shell launches it cannot supervise. Legacy Windows WSL `bash.exe` stdin transport is unsupported; run Atomic inside WSL for the normal POSIX/Bash path.
203
215
 
204
216
  Bash calls inside subagent sessions retain their existing execution paths. Without a supported task owner, explicit background requests are refused before execution; foreground calls wait for completion rather than automatically yielding. Custom operations adapters receive `wait` but must implement it themselves. External-terminal processes are not adopted into `/tasks`. A child's own tool use appears in that subagent's activity and transcript.
205
217
 
@@ -207,7 +219,7 @@ Bash calls inside subagent sessions retain their existing execution paths. Witho
207
219
 
208
220
  Background means independent of the current observation, not independent of its owner. **Pausing main chat** aborts the foreground turn only; its background agents and shells keep running. Detaching a workflow pane, ending a model turn, or closing `/tasks` also leaves owned background work alone.
209
221
 
210
- **Pausing a workflow stage** blocks new task launches immediately and cancels that stage generation's active and admitted queued agents and commands. Queued agents are cancelled before active cancellations free execution slots. Command setup already in flight may briefly start a shell during the pause transition; pause waits for those admissions, cancels the resulting shells, and confirms resource cleanup before completing. A successful pause leaves no owned active or queued executions. Cancellation or cleanup failures are reported instead of confirming pause. Main-chat tasks, sibling stages, and future stage generations are unaffected by a stage-scoped pause.
222
+ **Pausing a workflow stage** blocks new launches and cancels its active and queued agents and shells. Pause completes only after confirming cleanup; failures are reported rather than treated as a successful pause. Main-chat tasks, sibling stages, and future stage generations are unaffected.
211
223
 
212
224
  Pause does not close the stage's message generation: queued user and Intercom messages remain held for resume. Resume permits fresh launches but never resurrects cancelled executions; retained task results remain inspectable. Closing a session or stage generation still cancels its remaining owned work. Explicit `/tasks` stop and declared execution timeouts remain separate controls.
213
225
 
@@ -215,15 +227,13 @@ On native Windows, Suspend opens a PowerShell subshell rather than freezing Atom
215
227
 
216
228
  Task inspection is owner-scoped. It is not a machine-wide process list. Switching sessions does not copy the previous session's task rows into the new one. Missing retained history is reported explicitly.
217
229
 
218
- Git branch watchers for alternate folders are shared by their chat footers and released when the last viewer closes or changes folders. Main chat and other open stage chats keep their live branch updates; closing `/tasks` alone leaves its chat footer active.
230
+ Closing `/tasks` does not stop the chat footer's live Git branch updates.
219
231
 
220
232
  ## Task state and completion delivery
221
233
 
222
- Foreground and background describe observation, not different executions. Each admitted task keeps its identity and owning session as callers start or stop waiting. The native `wasBackground` field remains set after a designated wait yields, including after a later foreground wait or settlement.
223
-
224
- Execution outcome and resource cleanup are separate states. A terminal result does not by itself prove that resources were reaped. Cleanup failures remain explicit. Supervised shells retain output while running, and finish output draining as part of cleanup.
234
+ Foreground and background are observation modes for the same task. Stopping a wait does not create, stop, or restart execution.
225
235
 
226
- Native integrations can use `TaskSupervisor.taskSettlement(task)` from `@bastani/atomic-natives` to retrieve an authentic terminal receipt without creating a new wait. This supports recovery when a bounded event journal no longer contains the completion event. Session-history completion intents and acknowledgements reuse the same identity when notification delivery is retried.
236
+ A terminal result does not by itself confirm resource cleanup. Check the tool's cleanup status before treating a stop as complete.
227
237
 
228
238
  UI previews are bounded and are not a substitute for retained output. Gaps and truncation are labelled; unavailable history is reported rather than reconstructed from activity counters.
229
239
 
package/docs/build.md CHANGED
@@ -5,9 +5,9 @@ description: Extend Atomic with skills, subagents, intercom, workflows, extensio
5
5
 
6
6
  # Build with Atomic
7
7
 
8
- Build covers everything you add to Atomic: customization mechanisms that change how a session behaves, and programmatic interfaces that embed Atomic in your own software.
8
+ Customize an Atomic session or embed it in your own software. Choose a starting point below.
9
9
 
10
- If you have not run Atomic yet, start at the [Quickstart](/quickstart). If you are looking for an exact contract rather than a way to build something, go to the [Reference index](/reference).
10
+ New to Atomic? Start with the [Quickstart](/quickstart). To look up an exact contract, use the [Reference index](/reference).
11
11
 
12
12
  ## Choose the lightest mechanism
13
13
 
@@ -25,25 +25,15 @@ Work down this list and stop at the first mechanism that solves your problem.
25
25
 
26
26
  - [Custom models](/models) — add model entries for a supported provider API.
27
27
  - [Custom providers](/custom-provider) — implement a provider API or OAuth flow Atomic does not ship.
28
- - [Themes](/themes) — restyle the terminal interface.
28
+
29
+ ## Customization
30
+
31
+ Use [Themes](/themes) to restyle the terminal with a built-in or custom theme.
29
32
 
30
33
  ## Embed Atomic in your own software
31
34
 
32
35
  [Programmatic use](/programmatic) compares JSON mode, RPC, and the SDK, and links each one to its protocol or API reference.
33
36
 
34
- ## Customization
35
-
36
- - [Extensions](/extensions) - TypeScript modules for tools, commands, events, and custom UI.
37
- - [Skills](/skills) - Agent Skills for reusable on-demand capabilities.
38
- - [Subagents](/subagents) - focused child agents for research, analysis, debugging, cleanup, and review compositions.
39
- - [Workflows](/workflows) - executable engineering loops with tracked stages, artifacts, gates, and resumable runs.
40
- - [Prompt templates](/prompt-templates) - reusable prompts that expand from slash commands.
41
- - [Themes](/themes) - built-in and custom terminal themes.
42
- - [Atomic packages](/packages) - bundle and share extensions, skills, prompts, and themes.
43
- - [Custom models](/models) - add model entries for supported provider APIs.
44
- - [Custom providers](/custom-provider) - implement custom APIs and OAuth flows.
45
-
46
- ## Programmatic usage
47
37
 
48
38
  - [SDK](/sdk) - embed Atomic in Node.js applications.
49
39
  - [RPC mode](/rpc) - integrate over stdin/stdout JSONL.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Compaction reference
3
3
  sidebarTitle: "Compaction internals"
4
- description: Compaction parameters, persistence, extension hooks, formats, settings, and historical formats.
4
+ description: Compaction parameters, saved results, extension hooks, formats, and settings.
5
5
  ---
6
6
 
7
7
  # Compaction reference
@@ -16,11 +16,13 @@ The effective parameters appear in extension events and successful results:
16
16
  | `preserve_recent` | `2` | Exact number of newest context-visible messages protected client-side |
17
17
  | `query` | Last visible user message | Relevance focus for deciding which older lines to retain |
18
18
 
19
- `preserve_recent` counts context-visible messages without aligning the boundary to a user turn. An assistant message or tool result may therefore begin the kept tail. Because such a tail can start or end mid-turn, the kept messages are not replayed as structured message blocks: they are serialized with the same transcript grammar as the compacted region and appended to the end of the boundary string, so the whole boundary reaches the provider as one message. Serialization of the kept tail is lossless — tool results keep their full text instead of being truncated at 16k characters, and images stay attached as image blocks rather than becoming `[image]` markers — so protected content is preserved, not merely summarized. A value of `0` protects no messages and makes the entire active transcript compactable. If `query` is absent, Atomic derives it from the last visible user message.
19
+ `preserve_recent` counts context-visible messages without aligning to a user turn. An assistant message or tool result may begin the kept tail. A value of `0` protects no messages and makes the entire active transcript compactable.
20
20
 
21
- One consequence is worth stating for Claude models that sign their reasoning. Because the kept tail is serialized into the boundary string rather than replayed as structured assistant messages, no `thinking` or `redacted_thinking` block survives a compaction boundary. Compaction therefore **intentionally resets the signed reasoning chain**: reasoning produced before a boundary is not carried across it. This is deliberate, and it is the first of the two remedies Anthropic documents for keep-tail compaction — carry the text and tool calls across, leave the thinking blocks behind — reached structurally rather than by a stripping pass. The tail's own content is unaffected: text, tool calls, and tool results cross the boundary losslessly. See [Preserved thinking and model switches](/models/reference#preserved-thinking-and-model-switches) for how Atomic handles prefix changes *between* boundaries, which is a separate mechanism.
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 query is used whole and is never truncated. This matters for structured prompts: a truncated query would make section order the retention policy, because only the leading section could influence what the planner kept, and a constraint stated later in the prompt could not. Long queries are safe — an oversized planner request surfaces as an explicit provider-overflow failure rather than silent truncation — but `keepContext` tags, not query length, are the way to guarantee a span survives.
23
+ 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
+
25
+ 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.
24
26
 
25
27
  Configure defaults in `~/.atomic/agent/settings.json` or `.atomic/settings.json`:
26
28
 
@@ -56,7 +58,7 @@ Use `compaction.modelOverrides` to set `reserveTokens` and/or `preserve_recent`
56
58
 
57
59
  Each field falls back independently to the ordinary setting, then its built-in default. Keys are case-sensitive and do not support wildcards or reasoning suffixes. Both fields require non-negative safe integers. The active session model selects the budgets for manual, automatic, overflow, and post-tool compaction; switching models changes the next resolution, while borrowing a fallback planner does not. Explicit manual parameters take precedence over resolved defaults.
58
60
 
59
- Atomic intentionally differs from upstream pi: the recent-history override is an exact message count (`preserve_recent`), not a token budget (`keepRecentTokens`). Verbatim line reconstruction, `compression_ratio`, and `query` are unchanged; the latter two and `enabled` remain ordinary settings. See [Settings](/settings#compaction) for merge and validation details.
61
+ `preserve_recent` counts messages, not tokens. `compression_ratio`, `query`, and `enabled` remain ordinary settings, not per-model overrides. See [Settings](/settings#compaction) for merge and validation rules.
60
62
 
61
63
  ## Persistence and resume
62
64
 
@@ -94,11 +96,9 @@ The entry's `tokensBefore` is the provider-aware whole-context count used for bu
94
96
  }
95
97
  ```
96
98
 
97
- There is no format-version bump and no new entry type. Both `"fresh"` and `plannerModel` are additive: they are absent on every existing entry and on any compaction that used the session model, so old readers are unaffected. A `"fresh"` boundary that had to drop the `preserve_recent` tail persists `firstKeptEntryId: null`.
98
-
99
- A `compaction` entry is active only when `details.strategy === "verbatim-lines"`. On rebuild, Atomic emits one visible custom-role boundary message: the durable `summary` with the kept tail—the entries from `firstKeptEntryId` up to the boundary—serialized and concatenated onto its end. The tail is never restored as separate assistant/tool-result blocks, so a tail that starts or ends mid-turn cannot produce out-of-order provider blocks; images inside the tail ride along as image blocks on that same boundary message. When no pre-boundary context-visible message is retained—such as with `preserve_recent: 0`—`firstKeptEntryId` is `null` and the boundary carries the `summary` alone. Messages appended after the boundary are always replayed as real messages. The boundary is converted to a user-role provider message and shown in the TUI as a collapsible compaction card.
99
+ A `"fresh"` boundary that drops the recent tail records `firstKeptEntryId: null`. Only entries with `details.strategy === "verbatim-lines"` affect active context.
100
100
 
101
- Resume does not rerun planning or re-derive deletions: the exact compacted string and nullable tail boundary are already in JSONL. Existing records with a string `firstKeptEntryId` keep their original resume behavior. Legacy `context_compaction` logical-deletion records and old `compaction` summary records without the discriminator are inert archival data. Their historical omissions are not reapplied when an old session resumes.
101
+ Resume uses the saved compacted text without rerunning planning. The TUI shows a collapsible compaction card; new messages after it remain ordinary messages. Old inactive formats do not reapply their historical omissions, so content they once hid can return on resume.
102
102
 
103
103
  ## Extension hooks
104
104
 
@@ -190,7 +190,7 @@ path/to/changed.ts
190
190
 
191
191
  ### Message Serialization for Branch Summaries
192
192
 
193
- Before branch summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
193
+ Branch-summary input uses role-labelled text:
194
194
 
195
195
  ```text
196
196
  [User]: What they said
@@ -265,5 +265,3 @@ Two old formats remain parseable but inactive:
265
265
 
266
266
  - `type:"context_compaction"` records store logical entry/content-block deletion targets from older versions. Those records are inert, so content they once hid can re-enter context when an old session resumes.
267
267
  - `type:"compaction"` without `details.strategy: "verbatim-lines"` stored generated summary prose. Those records also remain inert.
268
-
269
- Both are distinguished from active boundaries by the discriminated `details` on the shared `CompactionEntry` shape; the session format version is the same for all of them.