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

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 (474) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +37 -0
  3. package/dist/builtin/intercom/CHANGELOG.md +16 -0
  4. package/dist/builtin/intercom/broker/broker.ts +110 -39
  5. package/dist/builtin/intercom/broker/client.ts +8 -1
  6. package/dist/builtin/intercom/index.bundle.mjs +61 -2
  7. package/dist/builtin/intercom/live-route-refusal.ts +69 -0
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/intercom/recoverable-disconnect.ts +16 -4
  10. package/dist/builtin/intercom/skills/intercom/SKILL.md +43 -12
  11. package/dist/builtin/intercom/types.ts +3 -1
  12. package/dist/builtin/mcp/package.json +2 -2
  13. package/dist/builtin/subagents/CHANGELOG.md +18 -0
  14. package/dist/builtin/subagents/README.md +2 -0
  15. package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
  16. package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
  17. package/dist/builtin/subagents/agents/codebase-online-researcher.md +3 -3
  18. package/dist/builtin/subagents/agents/debugger.md +7 -5
  19. package/dist/builtin/subagents/agents/worker.md +4 -2
  20. package/dist/builtin/subagents/package.json +3 -3
  21. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +56 -0
  22. package/dist/builtin/subagents/skills/cua-driver/BROWSER.md +494 -0
  23. package/dist/builtin/subagents/skills/cua-driver/EMBEDDING.md +578 -0
  24. package/dist/builtin/subagents/skills/cua-driver/LINUX.md +364 -0
  25. package/dist/builtin/subagents/skills/cua-driver/MACOS.md +509 -0
  26. package/dist/builtin/subagents/skills/cua-driver/README.md +113 -0
  27. package/dist/builtin/subagents/skills/cua-driver/RECORDING.md +162 -0
  28. package/dist/builtin/subagents/skills/cua-driver/SKILL.md +1105 -0
  29. package/dist/builtin/subagents/skills/cua-driver/WINDOWS.md +866 -0
  30. package/dist/builtin/subagents/skills/subagent/SKILL.md +32 -8
  31. package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -4
  32. package/dist/builtin/web-access/package.json +2 -2
  33. package/dist/builtin/workflows/CHANGELOG.md +43 -0
  34. package/dist/builtin/workflows/README.md +4 -2
  35. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  36. package/dist/builtin/workflows/builtin/{chunk-1dydq7w3.js → chunk-2hzrv5y8.js} +202 -45
  37. package/dist/builtin/workflows/builtin/{chunk-n4yxrsm9.js → chunk-3tx8ry44.js} +3 -2
  38. package/dist/builtin/workflows/builtin/{chunk-n8g2da69.js → chunk-5724b0cf.js} +1 -1
  39. package/dist/builtin/workflows/builtin/{chunk-scgprmdj.js → chunk-7n51c5gh.js} +1 -1
  40. package/dist/builtin/workflows/builtin/{chunk-9y0f90rd.js → chunk-9z3ztr2a.js} +1 -1
  41. package/dist/builtin/workflows/builtin/{chunk-vt9zgr9d.js → chunk-deq63d9p.js} +4 -4
  42. package/dist/builtin/workflows/builtin/{chunk-k18g9me8.js → chunk-dxjxtgmp.js} +1 -1
  43. package/dist/builtin/workflows/builtin/{chunk-kf5xpbkz.js → chunk-ffdrv23t.js} +1 -1
  44. package/dist/builtin/workflows/builtin/{chunk-119kxb28.js → chunk-hmt5w62g.js} +72 -45
  45. package/dist/builtin/workflows/builtin/{chunk-hnbbb5r0.js → chunk-jngsbbpm.js} +4 -4
  46. package/dist/builtin/workflows/builtin/{chunk-d1xqh1rd.js → chunk-njmf5ze7.js} +1 -1
  47. package/dist/builtin/workflows/builtin/{chunk-sn5mchnx.js → chunk-vn0wb31x.js} +1 -1
  48. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  49. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  50. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  51. package/dist/builtin/workflows/builtin/goal.js +4 -4
  52. package/dist/builtin/workflows/builtin/index.d.ts +1 -1
  53. package/dist/builtin/workflows/builtin/index.js +12 -12
  54. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  55. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -1
  56. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  57. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  58. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  59. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  60. package/dist/builtin/workflows/package.json +2 -2
  61. package/dist/builtin/workflows/skills/impeccable/SKILL.md +18 -11
  62. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +1 -1
  63. package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +1 -1
  64. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +1 -1
  65. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  66. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +6 -6
  67. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +2 -2
  68. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +1 -1
  69. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +1 -1
  70. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +0 -6
  71. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +19 -41
  72. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +11 -65
  73. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +3 -3
  74. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +4 -4
  75. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +1 -1
  76. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +1 -1
  77. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  78. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +4 -4
  79. package/dist/builtin/workflows/skills/impeccable/reference/document.md +4 -4
  80. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  81. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  82. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +21 -21
  83. package/dist/builtin/workflows/skills/impeccable/reference/init.md +8 -8
  84. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +2 -2
  85. package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +10 -8
  86. package/dist/builtin/workflows/skills/impeccable/reference/live.md +39 -38
  87. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +48 -21
  88. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  89. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  90. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  91. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +11 -3
  92. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  93. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +13 -7
  94. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +2 -2
  95. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +13 -19
  96. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -0
  97. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index-failures.json +121 -0
  98. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index.json +1 -0
  99. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +212 -0
  100. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +218 -0
  101. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +21 -0
  102. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +242 -0
  103. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +25 -4
  104. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +666 -197
  105. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  106. package/dist/builtin/workflows/src/extension/index.bundle.mjs +352 -117
  107. package/dist/builtin/workflows/src/index.js +1403 -1218
  108. package/dist/cli/args.d.ts.map +1 -1
  109. package/dist/cli/args.js +15 -4
  110. package/dist/cli/args.js.map +1 -1
  111. package/dist/cli/file-processor.d.ts +1 -1
  112. package/dist/cli/file-processor.d.ts.map +1 -1
  113. package/dist/cli/file-processor.js.map +1 -1
  114. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  115. package/dist/core/agent-session-auto-compaction.js +40 -12
  116. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  117. package/dist/core/agent-session-bash.d.ts.map +1 -1
  118. package/dist/core/agent-session-bash.js +9 -8
  119. package/dist/core/agent-session-bash.js.map +1 -1
  120. package/dist/core/agent-session-boundaries.d.ts +68 -0
  121. package/dist/core/agent-session-boundaries.d.ts.map +1 -0
  122. package/dist/core/agent-session-boundaries.js +334 -0
  123. package/dist/core/agent-session-boundaries.js.map +1 -0
  124. package/dist/core/agent-session-compaction.js +1 -1
  125. package/dist/core/agent-session-compaction.js.map +1 -1
  126. package/dist/core/agent-session-events.d.ts.map +1 -1
  127. package/dist/core/agent-session-events.js +27 -13
  128. package/dist/core/agent-session-events.js.map +1 -1
  129. package/dist/core/agent-session-export.d.ts.map +1 -1
  130. package/dist/core/agent-session-export.js +16 -20
  131. package/dist/core/agent-session-export.js.map +1 -1
  132. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  133. package/dist/core/agent-session-message-queue.js +3 -2
  134. package/dist/core/agent-session-message-queue.js.map +1 -1
  135. package/dist/core/agent-session-methods.d.ts +30 -4
  136. package/dist/core/agent-session-methods.d.ts.map +1 -1
  137. package/dist/core/agent-session-methods.js.map +1 -1
  138. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  139. package/dist/core/agent-session-persistent-custom-messages.js +2 -1
  140. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  141. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  142. package/dist/core/agent-session-prompt.js +93 -25
  143. package/dist/core/agent-session-prompt.js.map +1 -1
  144. package/dist/core/agent-session-retry.d.ts.map +1 -1
  145. package/dist/core/agent-session-retry.js +4 -9
  146. package/dist/core/agent-session-retry.js.map +1 -1
  147. package/dist/core/agent-session-runtime.js +1 -1
  148. package/dist/core/agent-session-runtime.js.map +1 -1
  149. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  150. package/dist/core/agent-session-tool-hooks.js +15 -5
  151. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  152. package/dist/core/agent-session-tree.d.ts.map +1 -1
  153. package/dist/core/agent-session-tree.js +2 -3
  154. package/dist/core/agent-session-tree.js.map +1 -1
  155. package/dist/core/agent-session-types.d.ts +6 -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 -2
  159. package/dist/core/agent-session.d.ts.map +1 -1
  160. package/dist/core/agent-session.js +17 -1
  161. package/dist/core/agent-session.js.map +1 -1
  162. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  163. package/dist/core/compaction/branch-summarization.js +1 -0
  164. package/dist/core/compaction/branch-summarization.js.map +1 -1
  165. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  166. package/dist/core/compaction/compaction-boundary.js +11 -6
  167. package/dist/core/compaction/compaction-boundary.js.map +1 -1
  168. package/dist/core/compaction/compaction.d.ts +3 -1
  169. package/dist/core/compaction/compaction.d.ts.map +1 -1
  170. package/dist/core/compaction/compaction.js +37 -0
  171. package/dist/core/compaction/compaction.js.map +1 -1
  172. package/dist/core/crash-log.d.ts +6 -0
  173. package/dist/core/crash-log.d.ts.map +1 -0
  174. package/dist/core/crash-log.js +69 -0
  175. package/dist/core/crash-log.js.map +1 -0
  176. package/dist/core/execution-model-router.d.ts +3 -0
  177. package/dist/core/execution-model-router.d.ts.map +1 -1
  178. package/dist/core/execution-model-router.js +45 -16
  179. package/dist/core/execution-model-router.js.map +1 -1
  180. package/dist/core/export-html/template-js/tree-filter-render.js +6 -1
  181. package/dist/core/export-html/template.js +6 -1
  182. package/dist/core/extensions/agent-events.d.ts +69 -3
  183. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  184. package/dist/core/extensions/agent-events.js.map +1 -1
  185. package/dist/core/extensions/api-types.d.ts +5 -3
  186. package/dist/core/extensions/api-types.d.ts.map +1 -1
  187. package/dist/core/extensions/api-types.js.map +1 -1
  188. package/dist/core/extensions/event-results.d.ts +3 -0
  189. package/dist/core/extensions/event-results.d.ts.map +1 -1
  190. package/dist/core/extensions/event-results.js.map +1 -1
  191. package/dist/core/extensions/event-types.d.ts +2 -2
  192. package/dist/core/extensions/event-types.d.ts.map +1 -1
  193. package/dist/core/extensions/event-types.js.map +1 -1
  194. package/dist/core/extensions/index.d.ts +1 -1
  195. package/dist/core/extensions/index.d.ts.map +1 -1
  196. package/dist/core/extensions/index.js.map +1 -1
  197. package/dist/core/extensions/provider-types.d.ts +2 -0
  198. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  199. package/dist/core/extensions/provider-types.js.map +1 -1
  200. package/dist/core/extensions/runner-events.d.ts +16 -2
  201. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  202. package/dist/core/extensions/runner-events.js +98 -5
  203. package/dist/core/extensions/runner-events.js.map +1 -1
  204. package/dist/core/extensions/runner.d.ts +3 -2
  205. package/dist/core/extensions/runner.d.ts.map +1 -1
  206. package/dist/core/extensions/runner.js +4 -1
  207. package/dist/core/extensions/runner.js.map +1 -1
  208. package/dist/core/index.d.ts +1 -1
  209. package/dist/core/index.d.ts.map +1 -1
  210. package/dist/core/index.js.map +1 -1
  211. package/dist/core/messages.d.ts +10 -0
  212. package/dist/core/messages.d.ts.map +1 -1
  213. package/dist/core/messages.js +57 -0
  214. package/dist/core/messages.js.map +1 -1
  215. package/dist/core/model-config.d.ts +52 -0
  216. package/dist/core/model-config.d.ts.map +1 -1
  217. package/dist/core/model-config.js +16 -0
  218. package/dist/core/model-config.js.map +1 -1
  219. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  220. package/dist/core/model-resolver-defaults.js +2 -1
  221. package/dist/core/model-resolver-defaults.js.map +1 -1
  222. package/dist/core/model-routing-task.d.ts +1 -1
  223. package/dist/core/model-routing-task.d.ts.map +1 -1
  224. package/dist/core/model-routing-task.js +4 -3
  225. package/dist/core/model-routing-task.js.map +1 -1
  226. package/dist/core/prompt-templates-async.d.ts +2 -2
  227. package/dist/core/prompt-templates-async.d.ts.map +1 -1
  228. package/dist/core/prompt-templates-async.js +57 -29
  229. package/dist/core/prompt-templates-async.js.map +1 -1
  230. package/dist/core/prompt-templates.d.ts +6 -1
  231. package/dist/core/prompt-templates.d.ts.map +1 -1
  232. package/dist/core/prompt-templates.js +61 -35
  233. package/dist/core/prompt-templates.js.map +1 -1
  234. package/dist/core/provider-composer-internal.d.ts +1 -0
  235. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  236. package/dist/core/provider-composer-internal.js +19 -0
  237. package/dist/core/provider-composer-internal.js.map +1 -1
  238. package/dist/core/resource-loader-assets.d.ts.map +1 -1
  239. package/dist/core/resource-loader-assets.js +6 -6
  240. package/dist/core/resource-loader-assets.js.map +1 -1
  241. package/dist/core/sdk.js +3 -2
  242. package/dist/core/sdk.js.map +1 -1
  243. package/dist/core/session-manager-core.d.ts +10 -3
  244. package/dist/core/session-manager-core.d.ts.map +1 -1
  245. package/dist/core/session-manager-core.js +65 -7
  246. package/dist/core/session-manager-core.js.map +1 -1
  247. package/dist/core/session-manager-entries.d.ts +4 -1
  248. package/dist/core/session-manager-entries.d.ts.map +1 -1
  249. package/dist/core/session-manager-entries.js +8 -0
  250. package/dist/core/session-manager-entries.js.map +1 -1
  251. package/dist/core/session-manager-history.d.ts +16 -1
  252. package/dist/core/session-manager-history.d.ts.map +1 -1
  253. package/dist/core/session-manager-history.js +105 -42
  254. package/dist/core/session-manager-history.js.map +1 -1
  255. package/dist/core/session-manager-types.d.ts +30 -3
  256. package/dist/core/session-manager-types.d.ts.map +1 -1
  257. package/dist/core/session-manager-types.js.map +1 -1
  258. package/dist/core/session-manager.d.ts +2 -2
  259. package/dist/core/session-manager.d.ts.map +1 -1
  260. package/dist/core/session-manager.js +1 -1
  261. package/dist/core/session-manager.js.map +1 -1
  262. package/dist/core/structured-output/index.d.ts +0 -1
  263. package/dist/core/structured-output/index.d.ts.map +1 -1
  264. package/dist/core/structured-output/index.js +3 -15
  265. package/dist/core/structured-output/index.js.map +1 -1
  266. package/dist/core/structured-output/jev-client.d.ts +4 -8
  267. package/dist/core/structured-output/jev-client.d.ts.map +1 -1
  268. package/dist/core/structured-output/jev-client.js +36 -32
  269. package/dist/core/structured-output/jev-client.js.map +1 -1
  270. package/dist/core/structured-output/jev.d.ts.map +1 -1
  271. package/dist/core/structured-output/jev.js +4 -12
  272. package/dist/core/structured-output/jev.js.map +1 -1
  273. package/dist/core/structured-output/types.d.ts +0 -2
  274. package/dist/core/structured-output/types.d.ts.map +1 -1
  275. package/dist/core/structured-output/types.js.map +1 -1
  276. package/dist/core/system-prompt.d.ts.map +1 -1
  277. package/dist/core/system-prompt.js +2 -1
  278. package/dist/core/system-prompt.js.map +1 -1
  279. package/dist/core/tools/read.d.ts +4 -0
  280. package/dist/core/tools/read.d.ts.map +1 -1
  281. package/dist/core/tools/read.js +5 -1
  282. package/dist/core/tools/read.js.map +1 -1
  283. package/dist/index-extensions.d.ts +1 -1
  284. package/dist/index-extensions.d.ts.map +1 -1
  285. package/dist/index-extensions.js.map +1 -1
  286. package/dist/index.d.ts +3 -3
  287. package/dist/index.d.ts.map +1 -1
  288. package/dist/index.js +3 -3
  289. package/dist/index.js.map +1 -1
  290. package/dist/main-app-mode.d.ts +1 -1
  291. package/dist/main-app-mode.d.ts.map +1 -1
  292. package/dist/main-app-mode.js +3 -2
  293. package/dist/main-app-mode.js.map +1 -1
  294. package/dist/main.d.ts.map +1 -1
  295. package/dist/main.js +1 -1
  296. package/dist/main.js.map +1 -1
  297. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  298. package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
  299. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  300. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  301. package/dist/modes/interactive/components/tree-selector-content.js +6 -0
  302. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  303. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -1
  304. package/dist/modes/interactive/components/tree-selector-model.js +1 -0
  305. package/dist/modes/interactive/components/tree-selector-model.js.map +1 -1
  306. package/dist/modes/interactive/interactive-agent-events.js +17 -1
  307. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  308. package/dist/modes/interactive/interactive-mode-helpers.d.ts +1 -0
  309. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  310. package/dist/modes/interactive/interactive-mode-helpers.js +16 -0
  311. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  312. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  313. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  314. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  315. package/dist/modes/interactive/interactive-process-lifecycle.js +13 -1
  316. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  317. package/dist/modes/interactive/interactive-session-runtime.js +5 -1
  318. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  319. package/dist/utils/mime.js +1 -1
  320. package/dist/utils/mime.js.map +1 -1
  321. package/dist/utils/tool-result-images.d.ts +3 -1
  322. package/dist/utils/tool-result-images.d.ts.map +1 -1
  323. package/dist/utils/tool-result-images.js +4 -1
  324. package/dist/utils/tool-result-images.js.map +1 -1
  325. package/docs/compaction.md +5 -1
  326. package/docs/computer-use.md +123 -73
  327. package/docs/extensions/events.md +75 -7
  328. package/docs/extensions.md +6 -2
  329. package/docs/getting-started/first-session.md +3 -2
  330. package/docs/getting-started/installation.md +6 -2
  331. package/docs/intercom/operations.md +13 -1
  332. package/docs/intercom.md +7 -2
  333. package/docs/models/evals.md +68 -82
  334. package/docs/models/model-selection.md +11 -7
  335. package/docs/models/reference.md +30 -2
  336. package/docs/packages.md +2 -0
  337. package/docs/prompt-templates.md +1 -0
  338. package/docs/providers.md +8 -2
  339. package/docs/quickstart.md +1 -1
  340. package/docs/sdk/reference.md +1 -2
  341. package/docs/sdk/structured-decisions.md +10 -9
  342. package/docs/sdk.md +13 -2
  343. package/docs/session-format.md +17 -2
  344. package/docs/settings.md +1 -1
  345. package/docs/skills.md +3 -1
  346. package/docs/subagents/reference.md +6 -6
  347. package/docs/subagents.md +8 -2
  348. package/docs/usage.md +2 -0
  349. package/docs/windows.md +1 -1
  350. package/docs/workflows/api-reference.md +5 -4
  351. package/docs/workflows/authoring.md +191 -0
  352. package/docs/workflows/builtins.md +2 -2
  353. package/docs/workflows/operations.md +10 -4
  354. package/docs/workflows/reliable-design.md +12 -1
  355. package/docs/workflows/verification.md +27 -14
  356. package/npm-shrinkwrap.json +69 -69
  357. package/package.json +8 -8
  358. package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +0 -420
  359. package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +0 -23
  360. package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +0 -39
  361. package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +0 -87
  362. package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +0 -241
  363. package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +0 -225
  364. package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +0 -275
  365. package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +0 -433
  366. package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +0 -139
  367. package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +0 -143
  368. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +0 -94
  369. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +0 -27
  370. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +0 -41
  371. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
  372. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +0 -4
  373. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +0 -695
  374. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +0 -325
  375. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +0 -1503
  376. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +0 -222
  377. package/dist/builtin/workflows/skills/impeccable/scripts/detect-csp.mjs +0 -198
  378. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +0 -21
  379. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -2073
  380. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +0 -432
  381. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +0 -1121
  382. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8746
  383. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -51
  384. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -376
  385. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -1168
  386. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1192
  387. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -290
  388. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  389. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +0 -18
  390. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +0 -213
  391. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  392. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  393. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +0 -5534
  394. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +0 -588
  395. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +0 -112
  396. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  397. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  398. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +0 -35
  399. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +0 -338
  400. package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +0 -270
  401. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +0 -277
  402. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +0 -783
  403. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +0 -2305
  404. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +0 -78
  405. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  406. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  407. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +0 -395
  408. package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +0 -925
  409. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -640
  410. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  411. package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +0 -72
  412. package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +0 -57
  413. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +0 -5
  414. package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +0 -369
  415. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +0 -483
  416. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  417. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +0 -528
  418. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  419. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +0 -42
  420. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +0 -33
  421. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +0 -146
  422. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +0 -617
  423. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +0 -71
  424. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -77
  425. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +0 -28
  426. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +0 -199
  427. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  428. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -157
  429. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +0 -143
  430. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +0 -205
  431. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  432. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +0 -170
  433. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +0 -26
  434. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  435. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  436. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  437. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  438. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  439. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +0 -149
  440. package/dist/builtin/workflows/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
  441. package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +0 -169
  442. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
  443. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  444. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  445. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +0 -14
  446. package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +0 -670
  447. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +0 -563
  448. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +0 -105
  449. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +0 -105
  450. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +0 -969
  451. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +0 -1401
  452. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -314
  453. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  454. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +0 -75
  455. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +0 -171
  456. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +0 -961
  457. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  458. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +0 -107
  459. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -800
  460. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  461. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +0 -515
  462. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +0 -292
  463. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -371
  464. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +0 -427
  465. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +0 -123
  466. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +0 -1675
  467. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +0 -71
  468. package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +0 -30
  469. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +0 -927
  470. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +0 -365
  471. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +0 -628
  472. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +0 -224
  473. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +0 -1540
  474. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +0 -74
@@ -1,137 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { resolveProjectRoot } from '../context.mjs';
4
- import { designSidecarCandidatesFor } from './staleness.mjs';
5
- export { IMPECCABLE_COMMAND_PREFIX } from './provider.mjs';
6
-
7
- export const IMPECCABLE_DIR = '.impeccable';
8
- export const LIVE_DIR = 'live';
9
- export const CRITIQUE_DIR = 'critique';
10
-
11
- export function getImpeccableDir(cwd = process.cwd(), options = {}) {
12
- return path.join(resolveProjectRoot(cwd, options), IMPECCABLE_DIR);
13
- }
14
-
15
- export function getDesignSidecarPath(cwd = process.cwd(), options = {}) {
16
- return path.join(getImpeccableDir(cwd, options), 'design.json');
17
- }
18
-
19
- export function getDesignSidecarCandidates(cwd = process.cwd(), contextDir = cwd, options = {}) {
20
- return designSidecarCandidatesFor(resolveProjectRoot(cwd, options), contextDir);
21
- }
22
-
23
- export function resolveDesignSidecarPath(cwd = process.cwd(), contextDir = cwd, options = {}) {
24
- return firstExisting(getDesignSidecarCandidates(cwd, contextDir, options));
25
- }
26
-
27
- export function getLiveDir(cwd = process.cwd(), options = {}) {
28
- return path.join(getImpeccableDir(cwd, options), LIVE_DIR);
29
- }
30
-
31
- export function getLiveConfigPath(cwd = process.cwd(), options = {}) {
32
- return path.join(getLiveDir(cwd, options), 'config.json');
33
- }
34
-
35
- export function getLegacyLiveConfigPath(scriptsDir) {
36
- return path.join(scriptsDir, 'config.json');
37
- }
38
-
39
- export function resolveLiveConfigPath({ cwd = process.cwd(), scriptsDir, env = process.env, targetPath } = {}) {
40
- if (env.IMPECCABLE_LIVE_CONFIG && env.IMPECCABLE_LIVE_CONFIG.trim()) {
41
- const configured = env.IMPECCABLE_LIVE_CONFIG.trim();
42
- return path.isAbsolute(configured) ? configured : path.resolve(cwd, configured);
43
- }
44
- const primary = getLiveConfigPath(cwd, { targetPath });
45
- if (fs.existsSync(primary)) return primary;
46
- if (scriptsDir) {
47
- const legacy = getLegacyLiveConfigPath(scriptsDir);
48
- if (fs.existsSync(legacy)) return legacy;
49
- }
50
- return primary;
51
- }
52
-
53
- export function getLiveServerPath(cwd = process.cwd(), options = {}) {
54
- return path.join(getLiveDir(cwd, options), 'server.json');
55
- }
56
-
57
- export function getLegacyLiveServerPath(cwd = process.cwd(), options = {}) {
58
- return path.join(resolveProjectRoot(cwd, options), '.impeccable-live.json');
59
- }
60
-
61
- export function readLiveServerInfo(cwd = process.cwd(), options = {}) {
62
- for (const filePath of [getLiveServerPath(cwd, options), getLegacyLiveServerPath(cwd, options)]) {
63
- try {
64
- const info = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
65
- if (info && typeof info.pid === 'number' && !isLiveServerPidReachable(info.pid)) {
66
- try { fs.unlinkSync(filePath); } catch {}
67
- continue;
68
- }
69
- return { info, path: filePath };
70
- } catch {
71
- /* try next */
72
- }
73
- }
74
- return null;
75
- }
76
-
77
- export function isLiveServerPidReachable(pid) {
78
- try {
79
- process.kill(pid, 0);
80
- return true;
81
- } catch (err) {
82
- // ESRCH means "no such process". EPERM means the process exists but this
83
- // user cannot signal it, so the live server info is still valid.
84
- return err?.code !== 'ESRCH';
85
- }
86
- }
87
-
88
- export function writeLiveServerInfo(cwd = process.cwd(), info, options = {}) {
89
- const filePath = getLiveServerPath(cwd, options);
90
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
91
- fs.writeFileSync(filePath, JSON.stringify(info));
92
- return filePath;
93
- }
94
-
95
- export function removeLiveServerInfo(cwd = process.cwd(), options = {}) {
96
- for (const filePath of [getLiveServerPath(cwd, options), getLegacyLiveServerPath(cwd, options)]) {
97
- try { fs.unlinkSync(filePath); } catch {}
98
- }
99
- }
100
-
101
- /**
102
- * Session IDs become path segments (journals, snapshots, accept receipts,
103
- * preview manifests, generated component dirs). They arrive from CLI `--id`
104
- * arguments and HTTP payloads, so anything containing a separator or `..` must
105
- * be rejected before it reaches path.join, which would happily escape
106
- * `.impeccable/live/`. Real IDs are 8 hex chars; the tests use short slugs.
107
- */
108
- export function safeSessionId(id) {
109
- if (typeof id !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(id)) {
110
- throw new Error('invalid session id: ' + id);
111
- }
112
- return id;
113
- }
114
-
115
- export function getLiveSessionsDir(cwd = process.cwd(), options = {}) {
116
- return path.join(getLiveDir(cwd, options), 'sessions');
117
- }
118
-
119
- export function getLegacyLiveSessionsDir(cwd = process.cwd(), options = {}) {
120
- return path.join(resolveProjectRoot(cwd, options), '.impeccable-live', 'sessions');
121
- }
122
-
123
- export function getLiveAnnotationsDir(cwd = process.cwd(), options = {}) {
124
- return path.join(getLiveDir(cwd, options), 'annotations');
125
- }
126
-
127
- export function getCritiqueDir(cwd = process.cwd(), options = {}) {
128
- return path.join(getImpeccableDir(cwd, options), CRITIQUE_DIR);
129
- }
130
-
131
- export function getLegacyLiveAnnotationsDir(cwd = process.cwd(), options = {}) {
132
- return path.join(resolveProjectRoot(cwd, options), '.impeccable-live', 'annotations');
133
- }
134
-
135
- function firstExisting(paths) {
136
- return paths.find((filePath) => fs.existsSync(filePath)) || null;
137
- }
@@ -1,72 +0,0 @@
1
- /**
2
- * Decide whether a given file is "generated" (regenerated by a build step,
3
- * unsafe to write variants into) or "source" (safe to edit, changes persist).
4
- *
5
- * Why this matters: when the user picks an element on a page whose underlying
6
- * file is regenerated by a build step (e.g. `scripts/build-sub-pages.js`
7
- * rewriting `public/docs/*.html`), writing variants or accepted changes into
8
- * that file is silent data loss — the next build wipes them.
9
- *
10
- * Signals, in order of reliability:
11
- * 1. Git check-ignore: gitignored files are assumed generated.
12
- * 2. File-header markers ("GENERATED", "DO NOT EDIT", "AUTO-GENERATED")
13
- * within the first ~300 characters — catches non-git projects.
14
- */
15
-
16
- import { execFileSync } from 'node:child_process';
17
- import fs from 'node:fs';
18
- import path from 'node:path';
19
-
20
- const HEADER_SCAN_BYTES = 300;
21
- const HEADER_MARKERS = [
22
- /@generated\b/i,
23
- /\bGENERATED\s+FILE\b/,
24
- /\bAUTO-?GENERATED\b/i,
25
- /\bDO\s+NOT\s+EDIT\b/i,
26
- ];
27
-
28
- /**
29
- * @param {string} filePath - absolute or cwd-relative path
30
- * @param {object} [options]
31
- * @param {string} [options.cwd] - project root (defaults to process.cwd())
32
- */
33
- export function isGeneratedFile(filePath, options = {}) {
34
- const cwd = options.cwd || process.cwd();
35
- const absPath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
36
-
37
- if (isGitIgnored(absPath, cwd)) return true;
38
- if (hasGeneratedHeader(absPath)) return true;
39
- return false;
40
- }
41
-
42
- function isGitIgnored(absPath, cwd) {
43
- try {
44
- // argv form, never a shell: this runs on every file the live-mode source
45
- // walk reaches, so a hostile filename embedding $(...) or backticks must
46
- // not be interpretable (issue #476). JSON.stringify is not shell quoting.
47
- execFileSync('git', ['check-ignore', '--quiet', '--', absPath], {
48
- cwd,
49
- stdio: 'ignore',
50
- });
51
- return true; // exit 0 = ignored
52
- } catch (err) {
53
- // Exit code 1 = not ignored. Exit code 128 = not a git repo or other error.
54
- // In both cases, treat as "not known to be ignored."
55
- return false;
56
- }
57
- }
58
-
59
- function hasGeneratedHeader(absPath) {
60
- let fd;
61
- try {
62
- fd = fs.openSync(absPath, 'r');
63
- const buf = Buffer.alloc(HEADER_SCAN_BYTES);
64
- const bytesRead = fs.readSync(fd, buf, 0, HEADER_SCAN_BYTES, 0);
65
- const head = buf.slice(0, bytesRead).toString('utf-8');
66
- return HEADER_MARKERS.some((re) => re.test(head));
67
- } catch {
68
- return false;
69
- } finally {
70
- if (fd !== undefined) { try { fs.closeSync(fd); } catch {} }
71
- }
72
- }
@@ -1,57 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
-
3
- const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '::1', '[::1]']);
4
- const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/u;
5
-
6
- /**
7
- * Validate the URL before handing it to an operating-system browser opener.
8
- * The opener is only used for local question/review pages; accepting a remote
9
- * URL here would turn a convenience helper into an outbound navigation sink.
10
- */
11
- export function validateBrowserUrl(value) {
12
- if (typeof value !== 'string' || value.length === 0 || CONTROL_CHARACTERS.test(value)) return null;
13
- let parsed;
14
- try {
15
- parsed = new URL(value);
16
- } catch {
17
- return null;
18
- }
19
- if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return null;
20
- if (parsed.username || parsed.password) return null;
21
- if (!LOOPBACK_HOSTS.has(parsed.hostname.toLowerCase())) return null;
22
- return parsed;
23
- }
24
-
25
- export function browserOpenCommand(url, { platform = process.platform } = {}) {
26
- if (!validateBrowserUrl(url)) return null;
27
- if (platform === 'darwin') return { command: 'open', args: [url] };
28
- // `start` is a cmd.exe built-in and would expose the URL to shell parsing.
29
- // Explorer accepts a URL as an argv value and is a fixed non-shell target.
30
- if (platform === 'win32') return { command: 'explorer.exe', args: [url] };
31
- return { command: 'xdg-open', args: [url] };
32
- }
33
-
34
- /**
35
- * Open a validated loopback URL with a fixed executable and argv. Synchronous
36
- * spawn failures return false; asynchronous child failures are consumed so a
37
- * browser that is unavailable cannot crash the serving question process.
38
- */
39
- export function openSystemBrowser(url, {
40
- platform = process.platform,
41
- spawnImpl = spawn,
42
- } = {}) {
43
- const command = browserOpenCommand(url, { platform });
44
- if (!command) return false;
45
- try {
46
- const child = spawnImpl(command.command, command.args, {
47
- stdio: 'ignore',
48
- detached: true,
49
- shell: false,
50
- });
51
- child.once('error', () => {});
52
- if (typeof child.unref === 'function') child.unref();
53
- return true;
54
- } catch {
55
- return false;
56
- }
57
- }
@@ -1,5 +0,0 @@
1
- // Source scripts default to slash commands. The provider build replaces only
2
- // this exact declaration, avoiding heuristic rewrites across executable code.
3
- export const IMPECCABLE_COMMAND_PREFIX = "$";
4
- export const IMPECCABLE_PROVIDER_ID = "agents";
5
- export const IMPECCABLE_COMMAND = `${IMPECCABLE_COMMAND_PREFIX}impeccable`;
@@ -1,369 +0,0 @@
1
- // The one implementation of world-roll selection.
2
- //
3
- // Two copies of this logic used to exist: this repo's concept-seed.mjs and the
4
- // service repo's functions/api/_worldroll-core.js, whose header claimed they
5
- // matched "exactly". They did not. The API had no breadth gate on either pool,
6
- // no rating weighting for compositions, and dealt one composition where the
7
- // seeder dealt three. Because the catalog never ships with the skill, every real
8
- // user rolls through that API, so those gates reached nobody.
9
- //
10
- // Why generators. The two callers cannot agree on a hash: Node has a
11
- // synchronous one, Workers only have async crypto.subtle, and concept-seed's
12
- // local render path is deliberately synchronous so prepared eval sessions and
13
- // tests can call it without awaiting. Rather than fork the logic or force the
14
- // whole seeder async, the selection is written once as a generator that yields
15
- // batches of strings to hash and resumes with their digests. runSyncSelection
16
- // and runAsyncSelection below are the only runtime-specific code, about eight
17
- // lines each. Both digests are the same bytes, so a roll is identical either way.
18
- //
19
- // Nothing here reads a file, an environment variable, or the network: callers
20
- // pass pools in.
21
-
22
- export const WELL_TIERS = ['graphic', 'interaction', 'atmosphere'];
23
-
24
- // Grain: how much of the product a composition composes. Named grain rather than
25
- // scope because scope already means direction-or-surface on every roll, and
26
- // 'surface' is already a register value, so a scope of 'surface' would collide
27
- // with both.
28
- //
29
- // This axis is framed by what the skill can be asked for, not by what the
30
- // catalog happens to hold. A user asks for a docs site, an onboarding flow, a
31
- // landing page, or a data table, and those are four different amounts of
32
- // product. Register says what kind of work it is; grain says how much of it.
33
- // Without grain, a request for a hero section can be dealt a whole-site
34
- // navigation structure and nothing notices.
35
- //
36
- // Measured when this was added: 137 of 173 approved compositions were view
37
- // grain, product grain was empty, and flow grain held one entry. That is why an
38
- // onboarding request had nothing to draw.
39
- export const COMPOSITION_GRAINS = [
40
- 'product', // a whole site or app: its information architecture
41
- 'flow', // a sequence of views with one outcome: onboarding, checkout, setup
42
- 'view', // one page or screen
43
- 'region', // a section inside a view: a hero, a feature grid, a table
44
- ];
45
-
46
- // Delivery targets a composition can survive. Mirrors the skill's platform axis
47
- // minus 'adaptive', which is a project-level value meaning both native targets
48
- // rather than something a single composition is authored for.
49
- //
50
- // A composition that leans on hover, a pointer, or a wide viewport does not
51
- // survive a phone, and nothing in the schema could say so before this.
52
- export const COMPOSITION_PLATFORMS = ['web', 'ios', 'android'];
53
-
54
- // Both fields are optional and absence means eligible everywhere, so no entry
55
- // has to be backfilled before this ships and no existing roll changes.
56
- export function isGrain(value) {
57
- return COMPOSITION_GRAINS.includes(value);
58
- }
59
-
60
- export function isPlatform(value) {
61
- return COMPOSITION_PLATFORMS.includes(value);
62
- }
63
-
64
-
65
- /**
66
- * Drives a selection generator with a synchronous hash.
67
- * @param {Generator} generator yields string[] to hash, resumes with hex string[]
68
- * @param {(input: string) => string} hash
69
- */
70
- export function runSyncSelection(generator, hash) {
71
- let step = generator.next();
72
- while (!step.done) step = generator.next(step.value.map(hash));
73
- return step.value;
74
- }
75
-
76
- /**
77
- * Drives a selection generator with an asynchronous hash.
78
- * @param {Generator} generator
79
- * @param {(input: string) => Promise<string>} hash
80
- */
81
- export async function runAsyncSelection(generator, hash) {
82
- let step = generator.next();
83
- while (!step.done) step = generator.next(await Promise.all(step.value.map(hash)));
84
- return step.value;
85
- }
86
-
87
- // Ranks items by the digest of `${input}:${id}`, descending, with the id as a
88
- // stable tiebreak. Yields every needed digest in one batch so the async driver
89
- // can resolve them concurrently.
90
- function* rank(items, input, idFor = item => item.id) {
91
- const ids = items.map(idFor);
92
- const digests = yield ids.map(id => `${input}:${id}`);
93
- return items
94
- .map((item, index) => ({ item, id: ids[index], score: digests[index] }))
95
- .sort((a, b) => b.score.localeCompare(a.score) || a.id.localeCompare(b.id))
96
- .map(entry => entry.item);
97
- }
98
-
99
- // Rating sets how many tickets a world holds; breadth decides whether it draws
100
- // at all. A niche world leaves the pool however good it is, keeping its approval
101
- // for direct briefs. Breadth was split out of rating because the only way to
102
- // hold a narrow world back used to be calling it marginal, which made "excellent
103
- // but narrow" unrecordable and corrupted ratings as a calibration signal.
104
- //
105
- // Two tickets for a 3-star, one for everything else, was too sharp. Measured
106
- // against the catalog as it stood: 3-star worlds absorbed 57% of the graphic
107
- // draw from 65 of 163 eligible worlds, 46% of atmosphere from 13 of 43, and
108
- // 75% of interaction from 15 of 25. The reviewer's complaint, that the same
109
- // worlds keep coming back, is what a rating multiplier does to a pool whose
110
- // thinnest tier holds 25 worlds.
111
- //
112
- // So a 3-star no longer outdraws a 2-star, and a 1-star draws at half rather
113
- // than not at all. A marginal keep is still worth showing sometimes: the
114
- // judgement it records is "narrow or unexceptional", not "wrong", and excluding
115
- // it entirely made a rating do a job breadth already does properly.
116
- const RATING_TICKETS = { 1: 1, 2: 2, 3: 2 };
117
- const ticketsForRating = rating => RATING_TICKETS[rating] ?? 2;
118
-
119
- function challengerTickets(pool) {
120
- return pool.flatMap(concept => {
121
- if (concept.review?.breadth === 'niche') return [];
122
- return Array.from({ length: ticketsForRating(concept.review?.rating) },
123
- (_, ticket) => ({ concept, ticket }));
124
- });
125
- }
126
-
127
- function compositionTickets(pool) {
128
- return pool.flatMap(composition => Array.from(
129
- { length: ticketsForRating(composition.review?.rating) },
130
- (_, ticket) => ({ composition, ticket })));
131
- }
132
-
133
- /**
134
- * Six challengers, two per translation tier, from an explicit approved pool.
135
- * Drive with runSyncSelection or runAsyncSelection.
136
- *
137
- * @param {object} options
138
- * @param {'direction'|'surface'} options.scope
139
- * @param {string} options.key same key reproduces the roll
140
- * @param {number} [options.reroll] round of the re-roll chain
141
- * @param {number|null} [options.minRating] optional floor, skipped per tier it would empty
142
- * @param {Array} options.concepts merged concepts with status, review, wellTier, familyId
143
- * @returns {Generator<string[], {approved: Array, picks: Array}, string[]>}
144
- */
145
- // A world with no allowedModes is eligible everywhere, which is what keeps this
146
- // additive: nothing has to be backfilled for the filter to be safe.
147
- function modeAllows(concept, mode) {
148
- const allowed = concept.review?.allowedModes;
149
- if (!Array.isArray(allowed) || allowed.length === 0) return true;
150
- return allowed.includes(mode);
151
- }
152
-
153
- export function* selectApprovedChallengers({ scope, key, reroll = 0, minRating = null, mode = null, concepts }) {
154
- const approved = concepts.filter(concept => concept.status === 'approved');
155
- // Direction chooses a durable identity, so it draws worlds; surface designs
156
- // one page inside a committed identity, so it draws compositions. Duals serve
157
- // both. A tier with no matching-strength approvals falls back to its full
158
- // approved pool rather than starving the roll.
159
- const wanted = scope === 'direction'
160
- ? new Set(['world', 'dual'])
161
- : new Set(['composition', 'dual']);
162
-
163
- const approvedByTier = new Map();
164
- for (const concept of approved) {
165
- const tier = approvedByTier.get(concept.wellTier) || [];
166
- tier.push(concept);
167
- approvedByTier.set(concept.wellTier, tier);
168
- }
169
- if (WELL_TIERS.some(tier => !(approvedByTier.get(tier) || []).length)) {
170
- throw new Error('concept-seed: every challenger tier needs at least one approved concept');
171
- }
172
-
173
- // Optional minimum-rating gate, applied per tier and skipped for any tier it
174
- // would empty, so a thin tier degrades to its full approved pool.
175
- if (minRating) {
176
- for (const [tier, pool] of approvedByTier) {
177
- const rated = pool.filter(concept => (concept.review?.rating || 0) >= minRating);
178
- if (rated.length > 0) approvedByTier.set(tier, rated);
179
- }
180
- }
181
- // Mode eligibility, per tier and skipped where it would empty a tier. Worlds
182
- // used to be drawn with no mode awareness at all, so a build asking for an app
183
- // UI could get six worlds that only make sense on a landing page. A world is an
184
- // identity and identities transfer further than compositions do, so this is a
185
- // ceiling the reviewer sets rather than a category assignment: eligible
186
- // everywhere until someone says otherwise.
187
- if (mode) {
188
- for (const [tier, pool] of approvedByTier) {
189
- const eligible = pool.filter(concept => modeAllows(concept, mode));
190
- if (eligible.length > 0) approvedByTier.set(tier, eligible);
191
- }
192
- }
193
- for (const [tier, pool] of approvedByTier) {
194
- const matching = pool.filter(concept => wanted.has(concept.strength));
195
- if (matching.length > 0) approvedByTier.set(tier, matching);
196
- }
197
-
198
- // Two challengers per tier, so every roll carries near-zero-translation
199
- // graphic systems beside instrument languages and atmosphere worlds, with the
200
- // second pick preferring a different family. Tier order is rolled too, to
201
- // avoid positional bias.
202
- function* pickRound(round, excluded) {
203
- const salt = round === 0 ? '' : `:reroll-${round}`;
204
- const tierOrder = (yield* rank(
205
- WELL_TIERS.map(id => ({ id })),
206
- `${scope}:${key}:tiers${salt}`
207
- )).map(item => item.id);
208
- const picks = [];
209
- for (const [index, tier] of tierOrder.entries()) {
210
- let pool = approvedByTier.get(tier).filter(concept => !excluded.has(concept.id));
211
- // A tier exhausted by prior rounds falls back to reuse over starvation.
212
- if (pool.length === 0) pool = approvedByTier.get(tier);
213
- let tickets = challengerTickets(pool);
214
- if (tickets.length === 0) tickets = pool.map(concept => ({ concept, ticket: 0 }));
215
- const ranked = yield* rank(
216
- tickets,
217
- `${scope}:${key}:challenger-${index}${salt}`,
218
- entry => `${entry.concept.id}#${entry.ticket}`
219
- );
220
- const order = [];
221
- const seen = new Set();
222
- for (const entry of ranked) {
223
- if (seen.has(entry.concept.id)) continue;
224
- seen.add(entry.concept.id);
225
- order.push(entry.concept);
226
- }
227
- const first = order[0];
228
- const second = order.find(concept => concept.familyId !== first.familyId)
229
- || order.find(concept => concept.id !== first.id);
230
- picks.push(...(second ? [first, second] : [first]));
231
- }
232
- return picks;
233
- }
234
-
235
- // Round n of a re-roll chain excludes everything rounds 0..n-1 drew, so the
236
- // same base key reproduces the whole chain.
237
- const excluded = new Set();
238
- let picks = yield* pickRound(0, excluded);
239
- for (let round = 1; round <= reroll; round += 1) {
240
- for (const pick of picks) excluded.add(pick.id);
241
- picks = yield* pickRound(round, excluded);
242
- }
243
- return { approved, picks };
244
- }
245
-
246
- function emptyMatch(grain, platform, platformExcluded = 0) {
247
- return { grain: grain ?? null, atGrain: grain ? 0 : null, grainAvailable: grain ? 0 : null, platform: platform ?? null, platformExcluded };
248
- }
249
-
250
- /**
251
- * Three identity-free composition inputs from an explicit approved pool.
252
- * Drive with runSyncSelection or runAsyncSelection.
253
- *
254
- * One input was too weak a counterweight to a model's habitual page skeleton:
255
- * it became a single optional flourish beside six identity challengers rather
256
- * than a real search over composition. Distinct composition families are preferred
257
- * so a roll tests materially different hierarchy, sequence, and interaction
258
- * laws. Cross-mode fallback would make the input misleading, so an absent mode
259
- * returns nothing rather than borrowing. Re-rolls exclude every earlier set
260
- * until the pool runs out.
261
- *
262
- * @param {object} options
263
- * @param {'direction'|'surface'} options.scope
264
- * @param {string} options.key
265
- * @param {number} [options.reroll]
266
- * @param {string|null} [options.mode] surface register to stay inside
267
- * @param {string|null} [options.grain] how much of the product is in play
268
- * @param {string|null} [options.platform] delivery target the result has to survive
269
- * @param {Array} options.compositions merged compositions with status, review, surface, familyId
270
- * @param {number} [options.count]
271
- * @returns {Generator<string[], {picks: Array, match: object}, string[]>}
272
- */
273
- export function* selectApprovedCompositions({ scope, key, reroll = 0, mode = null, grain = null, platform = null, compositions, count = 3 }) {
274
- // Compositions honour the same breadth gate as worlds: one too specific to serve
275
- // an arbitrary build stays approved for direct briefs and leaves the
276
- // challenger pool. Falls back to the full approved set rather than returning
277
- // nothing if every approved composition is niche.
278
- let approved = compositions.filter(composition => composition.status === 'approved');
279
- const broad = approved.filter(composition => composition.review?.breadth !== 'niche');
280
- if (broad.length > 0) approved = broad;
281
- if (approved.length === 0) return { picks: [], match: emptyMatch(grain, platform) };
282
- if (mode) {
283
- const matching = approved.filter(composition => composition.surface === mode);
284
- if (matching.length === 0) return { picks: [], match: emptyMatch(grain, platform) };
285
- approved = matching;
286
- }
287
- // Platform is a hard filter, unlike grain. A composition that needs hover or a
288
- // pointer does not degrade on a phone into something slightly worse; it stops
289
- // working, so borrowing it would be a defect rather than a stretch. Absent
290
- // platforms means it survives anywhere.
291
- let platformExcluded = 0;
292
- if (platform) {
293
- const survives = approved.filter(composition => {
294
- const only = composition.platforms;
295
- return !Array.isArray(only) || only.length === 0 || only.includes(platform);
296
- });
297
- platformExcluded = approved.length - survives.length;
298
- // No fallback here either: dealing a hover-only composition to a phone build
299
- // is worse than dealing nothing, and an empty deal is a visible gap.
300
- approved = survives;
301
- if (approved.length === 0) return { picks: [], match: emptyMatch(grain, platform, platformExcluded) };
302
- }
303
-
304
- const prior = new Set();
305
- let picks = [];
306
- for (let round = 0; round <= reroll; round += 1) {
307
- const available = approved.filter(composition => !prior.has(composition.id));
308
- const base = available.length >= Math.min(count, approved.length) ? available : approved;
309
- // Rating weights the draw as it does for worlds. It matters more here
310
- // because the per-surface pools are small, so an unweighted shuffle repeats
311
- // a weak composition far more often. Each ticket carries its index so the rank
312
- // sees a distinct key per ticket: ranking bare duplicates would hash
313
- // identically and the pick loop's id-dedupe would silently discard the
314
- // second copy, making the weighting a no-op.
315
- let tickets = compositionTickets(base);
316
- // A pool of nothing but 1-star keeps still has to yield compositions.
317
- if (tickets.length === 0) tickets = base.map(composition => ({ composition, ticket: 0 }));
318
- const ranked = (yield* rank(
319
- tickets,
320
- // The salt keeps the word "staging" deliberately. It is hash input, so
321
- // renaming it would re-deal every roll anyone has ever reproduced by key.
322
- round === 0 ? `${scope}:${key}:staging` : `${scope}:${key}:staging:reroll-${round}`,
323
- entry => `${entry.composition.id}#${entry.ticket}`
324
- )).map(entry => entry.composition);
325
-
326
- // Grain is a preference, not a filter: requesting an onboarding flow deals
327
- // flow-grain compositions first and tops up from the rest of the register
328
- // rather than dealing fewer than three. A stable partition of an already
329
- // deterministic ranking is still deterministic.
330
- //
331
- // The top-up is why match is reported. Dealing three plausible view-grain
332
- // compositions against a flow request, with no signal that none matched, is
333
- // the same silent-plausibility failure this whole axis exists to fix: the
334
- // model would improvise the flow structure while believing it was handed one.
335
- const ordered = grain
336
- ? [...ranked.filter(composition => composition.grain === grain),
337
- ...ranked.filter(composition => composition.grain !== grain)]
338
- : ranked;
339
-
340
- const families = new Set();
341
- picks = [];
342
- for (const composition of ordered) {
343
- const family = composition.familyId ?? composition.id;
344
- if (families.has(family)) continue;
345
- picks.push(composition);
346
- families.add(family);
347
- if (picks.length >= count) break;
348
- }
349
- for (const composition of ordered) {
350
- if (picks.length >= count) break;
351
- if (!picks.some(pick => pick.id === composition.id)) picks.push(composition);
352
- }
353
- if (round < reroll) picks.forEach(composition => prior.add(composition.id));
354
- }
355
-
356
- const atGrain = grain ? picks.filter(composition => composition.grain === grain).length : null;
357
- return {
358
- picks,
359
- match: {
360
- grain: grain ?? null,
361
- // How many of the dealt compositions actually sit at the requested grain.
362
- // 0 with a grain requested means every pick is a borrowed structure.
363
- atGrain,
364
- grainAvailable: grain ? approved.filter(composition => composition.grain === grain).length : null,
365
- platform: platform ?? null,
366
- platformExcluded,
367
- },
368
- };
369
- }