@andorra-labs/code 0.1.11 → 0.1.13

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 (614) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/account-presentation.d.ts +1 -37
  4. package/dist/src/account-presentation.js +2 -42
  5. package/dist/src/activity.d.ts +0 -25
  6. package/dist/src/activity.js +1 -23
  7. package/dist/src/agent-definitions.d.ts +0 -26
  8. package/dist/src/agent-definitions.js +0 -43
  9. package/dist/src/agent-execution.d.ts +0 -2
  10. package/dist/src/agent-execution.js +59 -414
  11. package/dist/src/agent-mcp-catalog.d.ts +0 -8
  12. package/dist/src/agent-mcp-catalog.js +0 -2
  13. package/dist/src/agent-mcp.d.ts +0 -56
  14. package/dist/src/agent-mcp.js +14 -153
  15. package/dist/src/agent-modifiers.d.ts +0 -1
  16. package/dist/src/agent-modifiers.js +25 -68
  17. package/dist/src/analytics.d.ts +0 -66
  18. package/dist/src/analytics.js +0 -45
  19. package/dist/src/anthropic-console-auth.d.ts +0 -24
  20. package/dist/src/anthropic-console-auth.js +0 -37
  21. package/dist/src/anthropic-credentials.d.ts +0 -25
  22. package/dist/src/anthropic-credentials.js +0 -28
  23. package/dist/src/app-server/protocol.d.ts +19 -244
  24. package/dist/src/app-server/protocol.js +1 -132
  25. package/dist/src/app-server/reasoning.d.ts +0 -31
  26. package/dist/src/app-server/reasoning.js +0 -54
  27. package/dist/src/app-server/terminal.d.ts +0 -36
  28. package/dist/src/app-server/terminal.js +3 -39
  29. package/dist/src/app-server/workspace.d.ts +0 -167
  30. package/dist/src/app-server/workspace.js +4 -406
  31. package/dist/src/app-server.d.ts +33 -918
  32. package/dist/src/app-server.js +608 -2984
  33. package/dist/src/artifacts.d.ts +0 -10
  34. package/dist/src/artifacts.js +1 -11
  35. package/dist/src/attachments.d.ts +4 -98
  36. package/dist/src/attachments.js +10 -130
  37. package/dist/src/auth/AuthManager.d.ts +0 -93
  38. package/dist/src/auth/AuthManager.js +3 -165
  39. package/dist/src/auth/callback-page.d.ts +0 -1
  40. package/dist/src/auth/callback-page.js +0 -4
  41. package/dist/src/auth/callback.d.ts +0 -25
  42. package/dist/src/auth/callback.js +1 -29
  43. package/dist/src/auth/deployment.d.ts +0 -16
  44. package/dist/src/auth/deployment.js +0 -16
  45. package/dist/src/auth/index.d.ts +0 -11
  46. package/dist/src/auth/index.js +0 -11
  47. package/dist/src/auth/lock.d.ts +0 -1
  48. package/dist/src/auth/lock.js +0 -1
  49. package/dist/src/auth/store.d.ts +7 -108
  50. package/dist/src/auth/store.js +21 -129
  51. package/dist/src/auth/types.d.ts +0 -8
  52. package/dist/src/auth-commands.d.ts +0 -5
  53. package/dist/src/auth-commands.js +0 -1
  54. package/dist/src/automation-runner.d.ts +0 -9
  55. package/dist/src/automation-runner.js +0 -11
  56. package/dist/src/automation-service.d.ts +0 -10
  57. package/dist/src/automation-service.js +3 -17
  58. package/dist/src/automation-tool.js +0 -5
  59. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  60. package/dist/src/automation-worker-shutdown.js +0 -3
  61. package/dist/src/automations.d.ts +23 -2
  62. package/dist/src/automations.js +91 -12
  63. package/dist/src/background-tasks.d.ts +0 -23
  64. package/dist/src/background-tasks.js +0 -11
  65. package/dist/src/boot-trace.d.ts +0 -13
  66. package/dist/src/boot-trace.js +1 -14
  67. package/dist/src/browser-activity.js +0 -2
  68. package/dist/src/browser-bridge.d.ts +0 -2
  69. package/dist/src/browser-bridge.js +0 -27
  70. package/dist/src/browser-captcha-tool.d.ts +0 -13
  71. package/dist/src/browser-captcha-tool.js +3 -35
  72. package/dist/src/browser-extensions-tool.d.ts +24 -0
  73. package/dist/src/browser-extensions-tool.js +137 -0
  74. package/dist/src/browser-extensions.d.ts +127 -0
  75. package/dist/src/browser-extensions.js +729 -0
  76. package/dist/src/browser-observation.d.ts +0 -15
  77. package/dist/src/browser-observation.js +1 -22
  78. package/dist/src/browser-panel-tool.d.ts +10 -25
  79. package/dist/src/browser-panel-tool.js +64 -60
  80. package/dist/src/browser-runner.d.ts +0 -1
  81. package/dist/src/browser-runner.js +7 -46
  82. package/dist/src/browser-server.d.ts +0 -6
  83. package/dist/src/browser-server.js +6 -229
  84. package/dist/src/browser-session.d.ts +0 -25
  85. package/dist/src/browser-session.js +1 -71
  86. package/dist/src/browser-stealth.d.ts +0 -12
  87. package/dist/src/browser-stealth.js +0 -36
  88. package/dist/src/browser-ui/app.js +7 -174
  89. package/dist/src/browser-ui/style.css +0 -68
  90. package/dist/src/browser-ui/tokens.css +11 -93
  91. package/dist/src/browser-view.d.ts +52 -290
  92. package/dist/src/browser-view.js +354 -567
  93. package/dist/src/capabilities.d.ts +0 -8
  94. package/dist/src/capabilities.js +0 -29
  95. package/dist/src/capsolver.d.ts +0 -13
  96. package/dist/src/capsolver.js +0 -15
  97. package/dist/src/clarification-ui.d.ts +0 -7
  98. package/dist/src/clarification-ui.js +0 -8
  99. package/dist/src/claude-executable.d.ts +0 -1
  100. package/dist/src/claude-executable.js +1 -2
  101. package/dist/src/claude-provider.d.ts +6 -19
  102. package/dist/src/claude-provider.js +166 -61
  103. package/dist/src/cli-executable.d.ts +0 -16
  104. package/dist/src/cli-executable.js +0 -7
  105. package/dist/src/cli-process.d.ts +0 -26
  106. package/dist/src/cli-process.js +0 -18
  107. package/dist/src/cli-sign-in.d.ts +0 -20
  108. package/dist/src/cli-sign-in.js +1 -17
  109. package/dist/src/cli.d.ts +3 -56
  110. package/dist/src/cli.js +193 -702
  111. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  112. package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
  113. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  114. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  115. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  116. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  117. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  118. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  119. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  120. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  121. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  122. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  123. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  124. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  125. package/dist/src/code-intelligence/repository.d.ts +0 -9
  126. package/dist/src/code-intelligence/repository.js +1 -11
  127. package/dist/src/code-intelligence/types.d.ts +0 -8
  128. package/dist/src/codex-auth.d.ts +0 -44
  129. package/dist/src/codex-auth.js +0 -45
  130. package/dist/src/codex-browser-auth.d.ts +0 -13
  131. package/dist/src/codex-browser-auth.js +3 -20
  132. package/dist/src/codex-errors.js +0 -2
  133. package/dist/src/codex-executable.d.ts +0 -2
  134. package/dist/src/codex-executable.js +1 -7
  135. package/dist/src/codex-provider.d.ts +0 -13
  136. package/dist/src/codex-provider.js +1 -26
  137. package/dist/src/codex-rpc.d.ts +0 -10
  138. package/dist/src/codex-rpc.js +0 -12
  139. package/dist/src/coding-tools.d.ts +6 -27
  140. package/dist/src/coding-tools.js +193 -205
  141. package/dist/src/command-metrics.d.ts +0 -4
  142. package/dist/src/command-output-tap.d.ts +0 -11
  143. package/dist/src/command-output-tap.js +0 -3
  144. package/dist/src/command-screens.d.ts +24 -0
  145. package/dist/src/command-screens.js +132 -100
  146. package/dist/src/commands.d.ts +6 -63
  147. package/dist/src/commands.js +20 -100
  148. package/dist/src/completion-gates.d.ts +0 -47
  149. package/dist/src/completion-gates.js +0 -14
  150. package/dist/src/completion.d.ts +2 -58
  151. package/dist/src/completion.js +90 -186
  152. package/dist/src/config.d.ts +12 -116
  153. package/dist/src/config.js +41 -171
  154. package/dist/src/context-budget.d.ts +0 -22
  155. package/dist/src/context-budget.js +0 -44
  156. package/dist/src/context-compaction.d.ts +29 -6
  157. package/dist/src/context-compaction.js +94 -25
  158. package/dist/src/context-selection.d.ts +0 -24
  159. package/dist/src/context-selection.js +0 -34
  160. package/dist/src/dashboard-view.d.ts +0 -2
  161. package/dist/src/dashboard-view.js +0 -35
  162. package/dist/src/dashboard.d.ts +0 -2
  163. package/dist/src/dashboard.js +0 -9
  164. package/dist/src/deadline.d.ts +0 -45
  165. package/dist/src/deadline.js +0 -54
  166. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  167. package/dist/src/decision/ContinuationAdapter.js +0 -5
  168. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  169. package/dist/src/decision/DecisionManager.d.ts +0 -1
  170. package/dist/src/decision/DecisionManager.js +2 -7
  171. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  172. package/dist/src/decision/DecisionPolicy.js +0 -1
  173. package/dist/src/decision/FactContinuations.d.ts +11 -43
  174. package/dist/src/decision/FactContinuations.js +126 -95
  175. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  176. package/dist/src/decision/FactServiceGate.js +0 -4
  177. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  178. package/dist/src/decision/PreparedSteps.js +1 -11
  179. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  180. package/dist/src/decision/applyToolMenu.js +1 -5
  181. package/dist/src/decision/checks.d.ts +15 -28
  182. package/dist/src/decision/checks.js +118 -49
  183. package/dist/src/decision/facts.d.ts +0 -16
  184. package/dist/src/decision/facts.js +0 -30
  185. package/dist/src/decision/guidancePolicy.js +0 -1
  186. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  187. package/dist/src/decision/hostedPolicy.js +0 -7
  188. package/dist/src/decision/hostedSkills.d.ts +0 -19
  189. package/dist/src/decision/hostedSkills.js +0 -19
  190. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  191. package/dist/src/decision/optimizationPolicy.js +1 -4
  192. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  193. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  194. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  195. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  196. package/dist/src/decision/routeTools.d.ts +0 -8
  197. package/dist/src/decision/routeTools.js +1 -8
  198. package/dist/src/decision/toolFamilies.d.ts +0 -1
  199. package/dist/src/decision/toolFamilies.js +0 -1
  200. package/dist/src/decision/toolMenu.d.ts +0 -3
  201. package/dist/src/decision/toolMenu.js +0 -4
  202. package/dist/src/decision/types.d.ts +0 -6
  203. package/dist/src/default-graph.d.ts +0 -9
  204. package/dist/src/default-graph.js +0 -9
  205. package/dist/src/delegation-changes.d.ts +0 -56
  206. package/dist/src/delegation-changes.js +15 -124
  207. package/dist/src/diff-preview.d.ts +1 -1
  208. package/dist/src/diff-preview.js +4 -12
  209. package/dist/src/duration.d.ts +0 -50
  210. package/dist/src/duration.js +0 -50
  211. package/dist/src/efficiency.d.ts +0 -39
  212. package/dist/src/efficiency.js +0 -16
  213. package/dist/src/engine/protocol.d.ts +0 -2
  214. package/dist/src/engine/protocol.js +0 -2
  215. package/dist/src/engine-streams.d.ts +13 -0
  216. package/dist/src/engine-streams.js +16 -0
  217. package/dist/src/extensions.d.ts +3 -2
  218. package/dist/src/extensions.js +76 -37
  219. package/dist/src/favicons.d.ts +0 -26
  220. package/dist/src/favicons.js +0 -34
  221. package/dist/src/file-diff.d.ts +2 -58
  222. package/dist/src/file-diff.js +0 -32
  223. package/dist/src/file-read-key.d.ts +1 -0
  224. package/dist/src/file-read-key.js +5 -0
  225. package/dist/src/file-read-state.d.ts +0 -1
  226. package/dist/src/file-read-state.js +0 -4
  227. package/dist/src/firefox-cookies.d.ts +0 -34
  228. package/dist/src/firefox-cookies.js +1 -55
  229. package/dist/src/git-identity-audit.d.ts +27 -0
  230. package/dist/src/git-identity-audit.js +286 -0
  231. package/dist/src/git-identity-guard.d.ts +4 -0
  232. package/dist/src/git-identity-guard.js +998 -0
  233. package/dist/src/git-identity-hold.d.ts +12 -0
  234. package/dist/src/git-identity-hold.js +81 -0
  235. package/dist/src/git-summary.d.ts +0 -58
  236. package/dist/src/git-summary.js +2 -212
  237. package/dist/src/goal-completion-verification.d.ts +2 -2
  238. package/dist/src/goal-completion-verification.js +3 -6
  239. package/dist/src/graph-account.d.ts +0 -21
  240. package/dist/src/graph-account.js +0 -17
  241. package/dist/src/graph-editor-session.d.ts +0 -1
  242. package/dist/src/graph-editor-session.js +1 -3
  243. package/dist/src/graph-health.d.ts +7 -49
  244. package/dist/src/graph-health.js +35 -46
  245. package/dist/src/graph-manager-chat.d.ts +27 -128
  246. package/dist/src/graph-manager-chat.js +36 -166
  247. package/dist/src/graph-provider-portability.d.ts +1 -21
  248. package/dist/src/graph-provider-portability.js +6 -45
  249. package/dist/src/graph-quota.d.ts +0 -33
  250. package/dist/src/graph-quota.js +1 -44
  251. package/dist/src/graph-runner.d.ts +0 -1
  252. package/dist/src/graph-runner.js +47 -387
  253. package/dist/src/graph-selection.d.ts +0 -14
  254. package/dist/src/graph-selection.js +0 -14
  255. package/dist/src/graph-server.d.ts +3 -11
  256. package/dist/src/graph-server.js +70 -111
  257. package/dist/src/graph-studio-features.d.ts +0 -5
  258. package/dist/src/graph-studio-features.js +2 -42
  259. package/dist/src/graph-sync.d.ts +0 -78
  260. package/dist/src/graph-sync.js +5 -201
  261. package/dist/src/graph-tool.d.ts +0 -18
  262. package/dist/src/graph-tool.js +0 -27
  263. package/dist/src/graph-ui/app.js +229 -498
  264. package/dist/src/graph-ui/compat.js +0 -7
  265. package/dist/src/graph-ui/controls.css +47 -43
  266. package/dist/src/graph-ui/controls.js +0 -88
  267. package/dist/src/graph-ui/drafts.js +0 -12
  268. package/dist/src/graph-ui/edge-router.js +0 -62
  269. package/dist/src/graph-ui/embed.js +0 -59
  270. package/dist/src/graph-ui/icons.js +2 -7
  271. package/dist/src/graph-ui/index.html +2 -2
  272. package/dist/src/graph-ui/library.css +0 -5
  273. package/dist/src/graph-ui/manager-markdown.js +0 -11
  274. package/dist/src/graph-ui/manager-state.js +110 -49
  275. package/dist/src/graph-ui/manager.css +2 -20
  276. package/dist/src/graph-ui/manager.js +251 -166
  277. package/dist/src/graph-ui/model-picker.js +250 -0
  278. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  279. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  280. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  281. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  282. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  283. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  284. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  285. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  286. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  287. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  288. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  289. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  290. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  291. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  292. package/dist/src/graph-ui/sidebar.js +2 -3
  293. package/dist/src/graph-ui/skill-picker.js +373 -39
  294. package/dist/src/graph-ui/studio-canvas.js +3 -38
  295. package/dist/src/graph-ui/studio.css +0 -18
  296. package/dist/src/graph-ui/studio.js +3 -71
  297. package/dist/src/graph-ui/style.css +11 -134
  298. package/dist/src/graph-ui/theme.js +1 -26
  299. package/dist/src/graph-ui/tokens.css +15 -114
  300. package/dist/src/graphs.d.ts +7 -156
  301. package/dist/src/graphs.js +72 -273
  302. package/dist/src/grep-regex-worker.js +0 -2
  303. package/dist/src/grep-regex.d.ts +1 -5
  304. package/dist/src/grep-regex.js +6 -8
  305. package/dist/src/grok-provider.d.ts +0 -17
  306. package/dist/src/grok-provider.js +1 -26
  307. package/dist/src/handoffs.d.ts +0 -11
  308. package/dist/src/handoffs.js +0 -13
  309. package/dist/src/hardened-runtime.d.ts +0 -10
  310. package/dist/src/hardened-runtime.js +8 -46
  311. package/dist/src/harness-home.d.ts +21 -0
  312. package/dist/src/harness-home.js +87 -0
  313. package/dist/src/host-process-guard.d.ts +0 -50
  314. package/dist/src/host-process-guard.js +0 -641
  315. package/dist/src/limits.d.ts +0 -64
  316. package/dist/src/limits.js +0 -62
  317. package/dist/src/managed-sign-in.d.ts +0 -12
  318. package/dist/src/managed-sign-in.js +0 -16
  319. package/dist/src/markdown.d.ts +0 -28
  320. package/dist/src/markdown.js +1 -175
  321. package/dist/src/mcp.d.ts +21 -82
  322. package/dist/src/mcp.js +228 -237
  323. package/dist/src/membership-errors.d.ts +0 -14
  324. package/dist/src/membership-errors.js +0 -13
  325. package/dist/src/membership.d.ts +2 -60
  326. package/dist/src/membership.js +0 -85
  327. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  328. package/dist/src/memory/LocalToolMemory.js +2 -7
  329. package/dist/src/memory/MemoryDistiller.js +0 -15
  330. package/dist/src/memory/MemoryManager.d.ts +0 -3
  331. package/dist/src/memory/MemoryManager.js +6 -18
  332. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  333. package/dist/src/memory/MemoryPolicy.js +0 -2
  334. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  335. package/dist/src/memory/MemoryRetriever.js +0 -7
  336. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  337. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  338. package/dist/src/memory/ProjectMemory.d.ts +42 -0
  339. package/dist/src/memory/ProjectMemory.js +285 -0
  340. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  341. package/dist/src/memory/ToolFailureLessons.js +0 -6
  342. package/dist/src/memory/index.d.ts +1 -0
  343. package/dist/src/memory/index.js +1 -0
  344. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  345. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  346. package/dist/src/memory/redaction.d.ts +0 -5
  347. package/dist/src/memory/redaction.js +0 -11
  348. package/dist/src/memory/repository.d.ts +0 -6
  349. package/dist/src/memory/repository.js +2 -12
  350. package/dist/src/memory/types.d.ts +0 -1
  351. package/dist/src/model-health-cache.d.ts +0 -38
  352. package/dist/src/model-health-cache.js +1 -49
  353. package/dist/src/model-metadata.d.ts +0 -18
  354. package/dist/src/model-metadata.js +2 -42
  355. package/dist/src/model-override.d.ts +0 -36
  356. package/dist/src/model-override.js +0 -43
  357. package/dist/src/model-tiers.d.ts +0 -13
  358. package/dist/src/model-tiers.js +0 -23
  359. package/dist/src/opencode-catalog.d.ts +0 -2
  360. package/dist/src/opencode-catalog.js +0 -11
  361. package/dist/src/opencode-cli-provider.d.ts +0 -35
  362. package/dist/src/opencode-cli-provider.js +1 -44
  363. package/dist/src/opencode-provider.d.ts +0 -2
  364. package/dist/src/opencode-provider.js +6 -22
  365. package/dist/src/package-name.d.ts +1 -0
  366. package/dist/src/package-name.js +1 -0
  367. package/dist/src/paged-transcript.d.ts +0 -11
  368. package/dist/src/paged-transcript.js +2 -20
  369. package/dist/src/palette.d.ts +0 -63
  370. package/dist/src/palette.js +0 -63
  371. package/dist/src/permissions.d.ts +0 -15
  372. package/dist/src/permissions.js +0 -17
  373. package/dist/src/powershell-pool.d.ts +0 -9
  374. package/dist/src/powershell-pool.js +3 -26
  375. package/dist/src/process-warnings.d.ts +4 -0
  376. package/dist/src/process-warnings.js +103 -0
  377. package/dist/src/profile.d.ts +0 -43
  378. package/dist/src/profile.js +0 -43
  379. package/dist/src/project-reservation.d.ts +11 -0
  380. package/dist/src/project-reservation.js +143 -0
  381. package/dist/src/provider-connection.d.ts +0 -18
  382. package/dist/src/provider-connection.js +0 -39
  383. package/dist/src/provider-engine.d.ts +0 -21
  384. package/dist/src/provider-engine.js +3 -98
  385. package/dist/src/provider-import.d.ts +0 -49
  386. package/dist/src/provider-import.js +0 -60
  387. package/dist/src/provider-keys.d.ts +1 -36
  388. package/dist/src/provider-keys.js +5 -48
  389. package/dist/src/provider-settings.d.ts +0 -2
  390. package/dist/src/provider-settings.js +0 -32
  391. package/dist/src/providers.d.ts +0 -217
  392. package/dist/src/providers.js +0 -315
  393. package/dist/src/pull-requests.d.ts +0 -173
  394. package/dist/src/pull-requests.js +5 -195
  395. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  396. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  397. package/dist/src/qa/command-policy.d.ts +0 -23
  398. package/dist/src/qa/command-policy.js +0 -30
  399. package/dist/src/qa/guidance.d.ts +0 -21
  400. package/dist/src/qa/guidance.js +0 -20
  401. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  402. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  403. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  404. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  405. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  406. package/dist/src/qa/profile/QaProfile.js +0 -7
  407. package/dist/src/qa/profile/yaml.d.ts +0 -9
  408. package/dist/src/qa/profile/yaml.js +0 -13
  409. package/dist/src/qa/qa-authorize.d.ts +0 -19
  410. package/dist/src/qa/qa-authorize.js +4 -11
  411. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  412. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  413. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  414. package/dist/src/qa/runtime/PtyManager.js +2 -7
  415. package/dist/src/qa/runtime/changes.d.ts +0 -11
  416. package/dist/src/qa/runtime/changes.js +1 -3
  417. package/dist/src/qa/tools.d.ts +0 -10
  418. package/dist/src/qa/tools.js +0 -12
  419. package/dist/src/qa/types.d.ts +0 -13
  420. package/dist/src/react-runtime.d.ts +2 -21
  421. package/dist/src/react-runtime.js +106 -418
  422. package/dist/src/read-document-doc.d.ts +0 -6
  423. package/dist/src/read-document-doc.js +0 -55
  424. package/dist/src/read-document-docx.d.ts +0 -16
  425. package/dist/src/read-document-docx.js +2 -69
  426. package/dist/src/read-document-text.d.ts +0 -17
  427. package/dist/src/read-document-text.js +0 -22
  428. package/dist/src/read-document-tool.d.ts +0 -31
  429. package/dist/src/read-document-tool.js +0 -30
  430. package/dist/src/read-document.d.ts +0 -49
  431. package/dist/src/read-document.js +1 -67
  432. package/dist/src/read-image.d.ts +0 -32
  433. package/dist/src/read-image.js +0 -33
  434. package/dist/src/remote/cert.d.ts +1 -19
  435. package/dist/src/remote/cert.js +2 -51
  436. package/dist/src/remote/client.d.ts +0 -70
  437. package/dist/src/remote/client.js +2 -117
  438. package/dist/src/remote/command.js +0 -17
  439. package/dist/src/remote/engine-pool.d.ts +0 -152
  440. package/dist/src/remote/engine-pool.js +17 -335
  441. package/dist/src/remote/errors.d.ts +0 -15
  442. package/dist/src/remote/errors.js +0 -7
  443. package/dist/src/remote/network.d.ts +0 -26
  444. package/dist/src/remote/network.js +1 -34
  445. package/dist/src/remote/pairing.d.ts +16 -51
  446. package/dist/src/remote/pairing.js +50 -57
  447. package/dist/src/remote/pem.d.ts +2 -0
  448. package/dist/src/remote/pem.js +7 -0
  449. package/dist/src/remote/roots.d.ts +0 -20
  450. package/dist/src/remote/roots.js +0 -8
  451. package/dist/src/remote/serve.d.ts +0 -47
  452. package/dist/src/remote/serve.js +0 -30
  453. package/dist/src/remote/server.d.ts +0 -14
  454. package/dist/src/remote/server.js +1 -79
  455. package/dist/src/remote/types.d.ts +1 -32
  456. package/dist/src/remote/types.js +0 -10
  457. package/dist/src/run-control.d.ts +0 -7
  458. package/dist/src/run-control.js +0 -7
  459. package/dist/src/run-progress.d.ts +0 -170
  460. package/dist/src/run-progress.js +0 -285
  461. package/dist/src/run-records.d.ts +0 -443
  462. package/dist/src/run-records.js +44 -678
  463. package/dist/src/run-temp.d.ts +12 -0
  464. package/dist/src/run-temp.js +50 -0
  465. package/dist/src/runtime.d.ts +11 -227
  466. package/dist/src/runtime.js +0 -127
  467. package/dist/src/sandbox-child.js +0 -1
  468. package/dist/src/save-lock.d.ts +0 -12
  469. package/dist/src/save-lock.js +0 -28
  470. package/dist/src/screen-selection.d.ts +0 -23
  471. package/dist/src/screen-selection.js +0 -22
  472. package/dist/src/secret-redaction.d.ts +0 -12
  473. package/dist/src/secret-redaction.js +0 -45
  474. package/dist/src/session-changes.d.ts +4 -80
  475. package/dist/src/session-changes.js +25 -130
  476. package/dist/src/session-goal.d.ts +129 -0
  477. package/dist/src/session-goal.js +230 -0
  478. package/dist/src/session-monitor.d.ts +1 -10
  479. package/dist/src/session-monitor.js +2 -39
  480. package/dist/src/session-reaper.d.ts +0 -15
  481. package/dist/src/session-reaper.js +0 -14
  482. package/dist/src/session-skills.d.ts +15 -44
  483. package/dist/src/session-skills.js +75 -60
  484. package/dist/src/session-summary.d.ts +0 -26
  485. package/dist/src/session-summary.js +0 -32
  486. package/dist/src/session-title.d.ts +0 -1
  487. package/dist/src/session-title.js +0 -2
  488. package/dist/src/sessions.d.ts +2 -120
  489. package/dist/src/sessions.js +9 -178
  490. package/dist/src/shell.d.ts +3 -20
  491. package/dist/src/shell.js +8 -72
  492. package/dist/src/side-panel.d.ts +5 -99
  493. package/dist/src/side-panel.js +76 -133
  494. package/dist/src/sign-in-detection.d.ts +43 -0
  495. package/dist/src/sign-in-detection.js +154 -0
  496. package/dist/src/sign-in-offer.d.ts +17 -0
  497. package/dist/src/sign-in-offer.js +103 -0
  498. package/dist/src/skill-commands.d.ts +0 -1
  499. package/dist/src/skill-commands.js +1 -4
  500. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  501. package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
  502. package/dist/src/skills/bundled/provenance.json +2 -2
  503. package/dist/src/skills/invocable-skills.d.ts +0 -18
  504. package/dist/src/skills/invocable-skills.js +0 -17
  505. package/dist/src/skills/project-skills.d.ts +0 -1
  506. package/dist/src/skills/project-skills.js +0 -3
  507. package/dist/src/skills/prompt-skills.js +0 -14
  508. package/dist/src/skills/runtime-skills.d.ts +1 -8
  509. package/dist/src/skills/runtime-skills.js +8 -32
  510. package/dist/src/stall-recovery.d.ts +0 -25
  511. package/dist/src/stall-recovery.js +0 -38
  512. package/dist/src/stray-files.d.ts +5 -0
  513. package/dist/src/stray-files.js +65 -0
  514. package/dist/src/structured-step.d.ts +0 -22
  515. package/dist/src/structured-step.js +0 -22
  516. package/dist/src/subagent-run.d.ts +0 -163
  517. package/dist/src/subagent-run.js +10 -374
  518. package/dist/src/subagent-tree.d.ts +32 -0
  519. package/dist/src/subagent-tree.js +128 -0
  520. package/dist/src/telemetry/aggregate.d.ts +0 -37
  521. package/dist/src/telemetry/aggregate.js +0 -40
  522. package/dist/src/telemetry/capture-core.d.ts +0 -87
  523. package/dist/src/telemetry/capture-core.js +0 -67
  524. package/dist/src/telemetry/capture.d.ts +0 -1
  525. package/dist/src/telemetry/capture.js +0 -3
  526. package/dist/src/telemetry/classify.d.ts +0 -58
  527. package/dist/src/telemetry/classify.js +0 -60
  528. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  529. package/dist/src/telemetry/emitter.d.ts +0 -30
  530. package/dist/src/telemetry/emitter.js +1 -62
  531. package/dist/src/telemetry/gate.d.ts +0 -29
  532. package/dist/src/telemetry/gate.js +0 -22
  533. package/dist/src/telemetry/identity.d.ts +0 -13
  534. package/dist/src/telemetry/identity.js +0 -29
  535. package/dist/src/telemetry/outbox.d.ts +0 -64
  536. package/dist/src/telemetry/outbox.js +1 -108
  537. package/dist/src/telemetry/schema.d.ts +1 -49
  538. package/dist/src/telemetry/schema.js +1 -82
  539. package/dist/src/telemetry/state.d.ts +0 -53
  540. package/dist/src/telemetry/state.js +0 -64
  541. package/dist/src/telemetry/surface.d.ts +0 -31
  542. package/dist/src/telemetry/surface.js +1 -39
  543. package/dist/src/telemetry/uploader.d.ts +0 -11
  544. package/dist/src/telemetry/uploader.js +0 -46
  545. package/dist/src/telemetry/uploads.d.ts +0 -11
  546. package/dist/src/telemetry/uploads.js +0 -11
  547. package/dist/src/telemetry/version.d.ts +0 -4
  548. package/dist/src/telemetry/version.js +0 -14
  549. package/dist/src/telemetry/workspace.d.ts +0 -7
  550. package/dist/src/telemetry/workspace.js +1 -22
  551. package/dist/src/terminal-ui.d.ts +15 -524
  552. package/dist/src/terminal-ui.js +80 -876
  553. package/dist/src/test-edit-guard.d.ts +74 -0
  554. package/dist/src/test-edit-guard.js +269 -0
  555. package/dist/src/text.d.ts +0 -1
  556. package/dist/src/text.js +0 -1
  557. package/dist/src/time-limit.d.ts +0 -36
  558. package/dist/src/time-limit.js +0 -37
  559. package/dist/src/timers.d.ts +0 -161
  560. package/dist/src/timers.js +0 -126
  561. package/dist/src/todos.d.ts +0 -1
  562. package/dist/src/todos.js +0 -3
  563. package/dist/src/token-rate.d.ts +0 -94
  564. package/dist/src/token-rate.js +0 -154
  565. package/dist/src/tool-activity.d.ts +0 -6
  566. package/dist/src/tool-activity.js +1 -8
  567. package/dist/src/tool-availability.d.ts +0 -13
  568. package/dist/src/tool-availability.js +1 -14
  569. package/dist/src/tool-call-clock.d.ts +1 -4
  570. package/dist/src/tool-call-clock.js +0 -13
  571. package/dist/src/tool-catalog.d.ts +0 -11
  572. package/dist/src/tool-catalog.js +0 -23
  573. package/dist/src/tool-dependencies.d.ts +0 -5
  574. package/dist/src/tool-dependencies.js +0 -4
  575. package/dist/src/tool-diff-stats.d.ts +0 -23
  576. package/dist/src/tool-diff-stats.js +0 -49
  577. package/dist/src/tool-errors.d.ts +9 -7
  578. package/dist/src/tool-errors.js +13 -6
  579. package/dist/src/tool-failure-tracker.d.ts +3 -11
  580. package/dist/src/tool-failure-tracker.js +19 -27
  581. package/dist/src/tool-names.d.ts +0 -16
  582. package/dist/src/tool-names.js +0 -12
  583. package/dist/src/tool-profile.d.ts +6 -0
  584. package/dist/src/tool-profile.js +23 -0
  585. package/dist/src/tool-result-filter.d.ts +0 -19
  586. package/dist/src/tool-result-filter.js +1 -66
  587. package/dist/src/tool-schema-compatibility.d.ts +1 -2
  588. package/dist/src/tool-schema-compatibility.js +2 -7
  589. package/dist/src/tools.d.ts +0 -4
  590. package/dist/src/tools.js +11 -114
  591. package/dist/src/trajectory.d.ts +0 -13
  592. package/dist/src/trajectory.js +23 -79
  593. package/dist/src/transcript.d.ts +1 -37
  594. package/dist/src/transcript.js +11 -61
  595. package/dist/src/types.d.ts +2 -167
  596. package/dist/src/untracked-file-removal.d.ts +3 -0
  597. package/dist/src/untracked-file-removal.js +105 -0
  598. package/dist/src/update-check.d.ts +0 -14
  599. package/dist/src/update-check.js +2 -16
  600. package/dist/src/update.d.ts +4 -29
  601. package/dist/src/update.js +20 -98
  602. package/dist/src/usage-analytics.d.ts +17 -17
  603. package/dist/src/usage-analytics.js +168 -209
  604. package/dist/src/web-search.d.ts +0 -23
  605. package/dist/src/web-search.js +1 -27
  606. package/dist/src/widgets.d.ts +0 -25
  607. package/dist/src/widgets.js +0 -24
  608. package/dist/src/workspace-facts.d.ts +0 -12
  609. package/dist/src/workspace-facts.js +1 -18
  610. package/dist/src/workspace-git-metadata.d.ts +4 -5
  611. package/dist/src/workspace-git-metadata.js +37 -9
  612. package/dist/src/workspace-instructions.d.ts +3 -15
  613. package/dist/src/workspace-instructions.js +7 -20
  614. package/package.json +2 -2
@@ -1,31 +1,20 @@
1
- /*
2
- * Skills in graph prompts. Typing `/` in a prompt opens a browser of this machine's skills, and
3
- * picking one writes its `/command` where the slash was. When the graph runs, the node loads every
4
- * skill its prompts name (src/skills/prompt-skills.ts finds them with the same pattern as below).
5
- *
6
- * A name no skill on this machine answers to is a warning under the prompt, never an error: the
7
- * graph still saves and runs, and the agent is told to go on without that skill. A graph can be
8
- * built on one machine and run on another, and a project's own skills (.agents/skills) are only
9
- * known when the run starts in that project.
10
- */
11
1
  'use strict';
12
2
  (() => {
13
3
  const REFERENCE = /(^|[\s([{])\/((?:skill::)?[A-Za-z0-9][\w-]*(?::(?:\.|[\w-]+(?:\.[\w-]+)*(?:\/[\w-]+(?:\.[\w-]+)*)*))?)(?![\w:/-])(?!\.\w)/g;
14
- // A qualified command (`/team:skills/review`) keeps filtering through its slashes and dots.
15
4
  const QUERY = /(^|[\s([{])\/([\w-]*(?::[\w.\/:-]*)?)$/;
16
5
  const STALE_MS = 15_000;
17
6
  const MAX_SHOWN = 60;
7
+ const CHIP_SCAN = /(^|\s)(\/\S+)(?=\s|$)/g;
8
+ const LAYER_METRICS = ['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'lineHeight', 'letterSpacing', 'wordSpacing', 'tabSize', 'textIndent',
9
+ 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'];
18
10
  let cache = { at: 0, value: undefined, error: undefined, pending: undefined };
19
11
  let pickerSeq = 0;
20
- // One picker is open at a time; a window resize moves that one. The inspector redraws its fields
21
- // often, so no per-field window listener is left behind.
22
12
  let openPlace;
23
13
  window.addEventListener('resize', () => openPlace?.());
24
14
 
25
15
  const el = (tag, text, className) => { const item = document.createElement(tag); if (text !== undefined) item.textContent = text; if (className) item.className = className; return item; };
26
16
  const icon = (name, size = 14) => globalThis.AndorraIcons?.icon?.(name, size);
27
17
 
28
- /** The catalog, refetched when older than a few seconds so a skill turned on in Settings shows up. */
29
18
  function catalog(load, force = false) {
30
19
  if (cache.pending) return cache.pending;
31
20
  if (!force && cache.value && Date.now() - cache.at < STALE_MS) return Promise.resolve(cache.value);
@@ -33,14 +22,12 @@
33
22
  cache = { at: Date.now(), value: { skills: Array.isArray(value?.skills) ? value.skills : [], inactive: Array.isArray(value?.inactive) ? value.inactive : [], reserved: Array.isArray(value?.reserved) ? value.reserved : [] }, error: undefined, pending: undefined };
34
23
  return cache.value;
35
24
  }, error => {
36
- // A failed refresh keeps the last catalog that loaded; with none, nothing is judged missing.
37
25
  cache = { ...cache, at: Date.now(), error: error?.message || String(error), pending: undefined };
38
26
  return cache.value;
39
27
  });
40
28
  return cache.pending;
41
29
  }
42
30
 
43
- /** Every `/name` a prompt names, in order, without built-in commands. */
44
31
  function references(text, reserved = []) {
45
32
  const names = [];
46
33
  if (typeof text !== 'string' || !text.includes('/')) return names;
@@ -54,11 +41,6 @@
54
41
  const named = (skill, name) => skill.command === '/' + name || skill.id === name;
55
42
  const answers = (skill, name) => named(skill, name) || skill.name === name;
56
43
 
57
- /**
58
- * The names in a prompt this machine cannot load, each with the reason. An installed skill owns
59
- * its name even while turned off or broken, as it does for a typed command: Andorra's skill of the
60
- * same name then answers only to `/andorra:name`, so the short name is reported, not substituted.
61
- */
62
44
  function problems(text, value) {
63
45
  if (!value) return [];
64
46
  const result = [];
@@ -77,6 +59,53 @@
77
59
  return `Skill /${name} not found on this machine. The step still runs, without it.`;
78
60
  }
79
61
 
62
+ // Chip handling, ported from desktop/src/engine/slashSuggestions.ts and generalized to many chips per text.
63
+ function chipSpan(value, chip) {
64
+ return { start: chip.start, end: value[chip.end] === ' ' ? chip.end + 1 : chip.end };
65
+ }
66
+
67
+ function skillChipRanges(value, commands) {
68
+ if (typeof value !== 'string' || !Array.isArray(commands) || !value.includes('/')) return [];
69
+ const found = [];
70
+ for (const match of value.matchAll(CHIP_SCAN)) {
71
+ if (!commands.includes(match[2])) continue;
72
+ const start = match.index + match[1].length;
73
+ found.push({ start, end: start + match[2].length });
74
+ }
75
+ return found;
76
+ }
77
+
78
+ function chipSelection(chips, selectionStart, selectionEnd) {
79
+ let start = selectionStart, end = selectionEnd, expanded = false;
80
+ for (const chip of chips ?? []) {
81
+ const overlaps = start < chip.end && end > chip.start;
82
+ const covers = start <= chip.start && end >= chip.end;
83
+ if (!overlaps || covers) continue;
84
+ start = Math.min(start, chip.start);
85
+ end = Math.max(end, chip.end);
86
+ expanded = true;
87
+ }
88
+ return expanded ? { start, end } : undefined;
89
+ }
90
+
91
+ function chipDeletion(value, chips, selectionStart, selectionEnd, key) {
92
+ if (selectionStart !== selectionEnd) return chipSelection(chips, selectionStart, selectionEnd);
93
+ for (const chip of chips ?? []) {
94
+ const span = chipSpan(value, chip);
95
+ if (key === 'Backspace' && (selectionStart === chip.end || selectionStart === span.end) && selectionStart > chip.start) return span;
96
+ if (key === 'Delete' && selectionStart === chip.start) return span;
97
+ }
98
+ return undefined;
99
+ }
100
+
101
+ function snapOutOfChip(chips, caret) {
102
+ for (const chip of chips ?? []) {
103
+ if (caret <= chip.start || caret >= chip.end) continue;
104
+ return caret - chip.start < chip.end - caret ? chip.start : chip.end;
105
+ }
106
+ return undefined;
107
+ }
108
+
80
109
  function matching(skills, query) {
81
110
  const needle = query.toLowerCase();
82
111
  const rank = skill => skill.command.slice(1).toLowerCase().startsWith(needle) ? 0 : String(skill.name).toLowerCase().startsWith(needle) ? 1 : 2;
@@ -85,7 +114,6 @@
85
114
  .sort((a, b) => rank(a) - rank(b) || (a.source === b.source ? 0 : a.source === 'installed' ? -1 : 1) || a.command.localeCompare(b.command));
86
115
  }
87
116
 
88
- /** The caret's box in the viewport, measured on a mirror of the textarea. */
89
117
  function caretRect(textarea) {
90
118
  const box = textarea.getBoundingClientRect();
91
119
  try {
@@ -105,10 +133,6 @@
105
133
  } catch { return { left: box.left, top: box.bottom, bottom: box.bottom }; }
106
134
  }
107
135
 
108
- /**
109
- * Gives a prompt textarea the `/` picker and the warning row. `load` fetches the catalog;
110
- * `onPick` runs after a picked command is written, so the caller can record the change.
111
- */
112
136
  function attach(textarea, { load, onPick } = {}) {
113
137
  if (!textarea || typeof load !== 'function' || textarea.dataset?.skillPicker) return;
114
138
  textarea.dataset.skillPicker = 'on';
@@ -131,7 +155,135 @@
131
155
  warnings.hidden = !warnings.childElementCount;
132
156
  };
133
157
  let warnTimer;
134
- const refreshWarnings = (force = false) => { void catalog(load, force).then(renderWarnings); };
158
+ let syncChips = () => { };
159
+ const applyCatalog = value => { renderWarnings(value); syncChips(); };
160
+ const refreshWarnings = (force = false) => { void catalog(load, force).then(applyCatalog); };
161
+
162
+ // Chip overlay: a sibling layer that draws the highlighted /names behind the (transparent) textarea text.
163
+ const commands = () => {
164
+ const skills = cache.value?.skills;
165
+ return Array.isArray(skills) ? skills.map(skill => skill.command).filter(command => typeof command === 'string' && command.startsWith('/')) : [];
166
+ };
167
+ const currentChips = () => { const list = commands(); return list.length ? skillChipRanges(textarea.value, list) : []; };
168
+ const snapCaret = () => {
169
+ const chips = currentChips();
170
+ if (!chips.length || textarea.selectionStart !== textarea.selectionEnd) return;
171
+ const snapped = snapOutOfChip(chips, textarea.selectionStart);
172
+ if (snapped !== undefined && snapped !== textarea.selectionStart) textarea.setSelectionRange(snapped, snapped);
173
+ };
174
+ const removeRange = (start, end) => {
175
+ try { textarea.focus(); } catch { }
176
+ textarea.setSelectionRange(start, end);
177
+ let removed = false;
178
+ try { removed = typeof document.execCommand === 'function' && document.execCommand('delete'); } catch { removed = false; }
179
+ if (removed) return;
180
+ textarea.value = textarea.value.slice(0, start) + textarea.value.slice(end);
181
+ textarea.setSelectionRange(start, start);
182
+ textarea.dispatchEvent(new Event('input', { bubbles: true }));
183
+ };
184
+ const chipKey = event => {
185
+ const chips = currentChips();
186
+ if (!chips.length || event.altKey || event.metaKey || event.ctrlKey) return false;
187
+ const start = textarea.selectionStart, end = textarea.selectionEnd;
188
+ if (start === end && !event.shiftKey && (event.key === 'ArrowRight' || event.key === 'ArrowLeft')) {
189
+ const chip = event.key === 'ArrowRight' ? chips.find(item => item.start === start) : chips.find(item => item.end === start);
190
+ if (chip) {
191
+ event.preventDefault();
192
+ const target = event.key === 'ArrowRight' ? chip.end : chip.start;
193
+ textarea.setSelectionRange(target, target);
194
+ return true;
195
+ }
196
+ }
197
+ // Shift+Delete is cut on Windows and Linux: leave it to the browser so the text reaches the
198
+ // clipboard, and let the 'cut' listener below grow a selection that partly covers a chip.
199
+ if (event.key === 'Delete' && event.shiftKey) return false;
200
+ if (event.key === 'Backspace' || event.key === 'Delete') {
201
+ const range = chipDeletion(textarea.value, chips, start, end, event.key);
202
+ if (!range) return false;
203
+ event.preventDefault();
204
+ removeRange(range.start, range.end);
205
+ return true;
206
+ }
207
+ if (start !== end && (event.key === 'Enter' || event.key.length === 1)) {
208
+ const grown = chipSelection(chips, start, end);
209
+ if (grown) textarea.setSelectionRange(grown.start, grown.end);
210
+ }
211
+ return false;
212
+ };
213
+
214
+ let layer, layerInner, layerValue = '', layerCommands = '';
215
+ const hideChips = () => {
216
+ layer?.remove?.(); layer = undefined; layerInner = undefined; layerValue = ''; layerCommands = '';
217
+ textarea.parentElement?.classList?.remove?.('hosts-skill-chips');
218
+ delete textarea.dataset.skillChips;
219
+ };
220
+ const positionLayer = () => {
221
+ if (!layer) return;
222
+ const parent = textarea.parentElement;
223
+ if (parent && layer.parentElement !== parent) {
224
+ layer.parentElement?.classList?.remove?.('hosts-skill-chips');
225
+ try { if (getComputedStyle(parent).position === 'static') parent.classList.add('hosts-skill-chips'); } catch { }
226
+ parent.append(layer);
227
+ }
228
+ try {
229
+ const style = getComputedStyle(textarea);
230
+ for (const property of LAYER_METRICS) layer.style[property] = style[property];
231
+ // The layer paints the input background inside the textarea's border box: offsetTop/Left are the
232
+ // border-box origin while clientWidth/Height exclude the border, so inset by the border widths
233
+ // and size to the padding box. That also lines the layer text up exactly with the textarea's text.
234
+ layer.style.top = `${textarea.offsetTop + (parseFloat(style.borderTopWidth) || 0)}px`;
235
+ layer.style.left = `${textarea.offsetLeft + (parseFloat(style.borderLeftWidth) || 0)}px`;
236
+ } catch {
237
+ layer.style.top = `${textarea.offsetTop}px`; layer.style.left = `${textarea.offsetLeft}px`;
238
+ }
239
+ layer.style.width = `${textarea.clientWidth}px`; layer.style.height = `${textarea.clientHeight}px`;
240
+ if (layerInner) layerInner.style.transform = `translateY(${-textarea.scrollTop}px)`;
241
+ };
242
+ const drawChips = () => {
243
+ if (!layer || !layerInner) return;
244
+ const value = textarea.value;
245
+ const list = commands();
246
+ const chips = list.length ? skillChipRanges(value, list) : [];
247
+ if (!chips.length) { hideChips(); return; }
248
+ const key = list.join('\n');
249
+ if (value === layerValue && key === layerCommands) return;
250
+ layerValue = value; layerCommands = key;
251
+ layerInner.replaceChildren();
252
+ let at = 0;
253
+ for (const chip of chips) {
254
+ if (chip.start > at) layerInner.append(document.createTextNode(value.slice(at, chip.start)));
255
+ const chipNode = el('span', undefined, 'skill-chip');
256
+ chipNode.append(el('span', '/', 'skill-chip-slash'), el('span', value.slice(chip.start + 1, chip.end)));
257
+ layerInner.append(chipNode);
258
+ at = chip.end;
259
+ }
260
+ if (at < value.length) layerInner.append(document.createTextNode(value.slice(at)));
261
+ layerInner.append(document.createTextNode('\u200b'));
262
+ };
263
+ const renderChips = () => {
264
+ if (!commands().length || !skillChipRanges(textarea.value, commands()).length) { hideChips(); return; }
265
+ if (!layer) {
266
+ layer = el('div', undefined, 'skill-chip-layer'); layer.setAttribute('aria-hidden', 'true');
267
+ layerInner = el('div'); layer.append(layerInner);
268
+ const parent = textarea.parentElement;
269
+ try { if (parent && getComputedStyle(parent).position === 'static') parent.classList.add('hosts-skill-chips'); } catch { }
270
+ parent?.append?.(layer);
271
+ textarea.dataset.skillChips = 'true';
272
+ }
273
+ positionLayer();
274
+ drawChips();
275
+ };
276
+ syncChips = () => { renderChips(); };
277
+ // Inspector renders replace prompt textareas, so the observer lets go of a removed one; otherwise its
278
+ // callback would keep the detached prompt and its picker state alive for the rest of the session.
279
+ let resizeObserver;
280
+ const stopObserving = () => { resizeObserver?.disconnect(); resizeObserver = undefined; };
281
+ try {
282
+ if (typeof ResizeObserver === 'function') {
283
+ resizeObserver = new ResizeObserver(() => { if (!textarea.isConnected) { stopObserving(); return; } renderChips(); });
284
+ resizeObserver.observe(textarea);
285
+ }
286
+ } catch { }
135
287
 
136
288
  let panel, list, options = [], active = 0, query;
137
289
  const close = () => {
@@ -149,7 +301,6 @@
149
301
  const accept = skill => {
150
302
  if (!query || !skill) return;
151
303
  const value = textarea.value;
152
- // A pick replaces the whole token under the caret, including any part typed after it.
153
304
  const tail = /^[\w:.\/-]*/.exec(value.slice(query.end))[0].length;
154
305
  const after = value.slice(query.end + tail);
155
306
  const insert = skill.command + (/^\s/.test(after) ? '' : ' ');
@@ -176,7 +327,6 @@
176
327
  if (!panel) {
177
328
  panel = el('div', undefined, 'select-panel skill-picker'); panel.id = id;
178
329
  panel.setAttribute('role', 'listbox'); panel.setAttribute('aria-label', 'Skills');
179
- // Keep focus in the prompt while the pointer chooses.
180
330
  panel.addEventListener('mousedown', event => event.preventDefault());
181
331
  (textarea.closest('dialog') ?? document.body).append(panel);
182
332
  textarea.setAttribute('aria-expanded', 'true'); textarea.setAttribute('aria-controls', id);
@@ -217,26 +367,210 @@
217
367
  if (query?.text !== next.text) active = 0;
218
368
  query = next;
219
369
  render(cache.value);
220
- void catalog(load).then(value => { if (query === next) render(value); });
370
+ void catalog(load).then(value => { if (query === next) render(value); applyCatalog(value); });
221
371
  };
222
372
 
223
- textarea.addEventListener('input', () => { update(); clearTimeout(warnTimer); warnTimer = setTimeout(() => refreshWarnings(), 200); });
373
+ textarea.addEventListener('input', () => { renderChips(); snapCaret(); update(); clearTimeout(warnTimer); warnTimer = setTimeout(() => refreshWarnings(), 200); });
224
374
  textarea.addEventListener('click', update);
225
- textarea.addEventListener('focus', () => refreshWarnings());
375
+ textarea.addEventListener('select', snapCaret);
376
+ textarea.addEventListener('focus', () => { renderChips(); snapCaret(); refreshWarnings(); });
226
377
  textarea.addEventListener('blur', close);
378
+ textarea.addEventListener('scroll', () => { place(); positionLayer(); });
379
+ textarea.addEventListener('keydown', event => {
380
+ if (event.isComposing) return;
381
+ if (!panel) { chipKey(event); return; }
382
+ if (event.key === 'Escape') { event.preventDefault(); event.stopImmediatePropagation(); close(); return; }
383
+ if (!event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey && options.length) {
384
+ if (event.key === 'ArrowDown') { event.preventDefault(); highlight((active + 1) % options.length); return; }
385
+ if (event.key === 'ArrowUp') { event.preventDefault(); highlight((active - 1 + options.length) % options.length); return; }
386
+ if (event.key === 'Enter' || event.key === 'Tab') { event.preventDefault(); accept(options[active]?.skill); return; }
387
+ }
388
+ chipKey(event);
389
+ }, true);
390
+ // Paste and cut also replace or remove the current selection, and their keydowns exit at the
391
+ // modifier guard above, so grow a selection that partly covers a chip before the edit lands.
392
+ const growEditSelection = () => {
393
+ const chips = currentChips();
394
+ const start = textarea.selectionStart, end = textarea.selectionEnd;
395
+ if (!chips.length || start === end) return;
396
+ const grown = chipSelection(chips, start, end);
397
+ if (grown) textarea.setSelectionRange(grown.start, grown.end);
398
+ };
399
+ textarea.addEventListener('paste', growEditSelection);
400
+ textarea.addEventListener('cut', growEditSelection);
401
+ // The browser fires 'select' only for real text selections; plain caret moves (a click, Up/Down/Home/End)
402
+ // surface as document selectionchange, so this is what keeps the caret out of chips the way the chat
403
+ // composer's React onSelect does. The listener removes itself, and the resize observer, once the
404
+ // textarea leaves the DOM.
405
+ const onSelectionChange = () => {
406
+ if (!textarea.isConnected) { document.removeEventListener('selectionchange', onSelectionChange); stopObserving(); return; }
407
+ if (document.activeElement === textarea) snapCaret();
408
+ };
409
+ document.addEventListener('selectionchange', onSelectionChange);
410
+ refreshWarnings();
411
+ }
412
+
413
+ // Where the caret sits in a JSON draft: undefined unless it is where a key of an object goes.
414
+ function keyContext(text) {
415
+ const stack = [];
416
+ let expectKey = false, structural = -1;
417
+ for (let i = 0; i < text.length; i++) {
418
+ const char = text[i], top = stack.at(-1);
419
+ if (char === '"') {
420
+ let end = i + 1;
421
+ while (end < text.length && text[end] !== '"') end += text[end] === '\\' ? 2 : 1;
422
+ if (end >= text.length) {
423
+ const typed = text.slice(i + 1);
424
+ if (top?.kind !== 'object' || !expectKey || !/^\w*$/.test(typed)) return undefined;
425
+ return { start: i, text: typed, depth: stack.length, parentKey: top.parentKey, present: top.keys };
426
+ }
427
+ if (top?.kind === 'object' && expectKey) { top.key = text.slice(i + 1, end); top.keys.push(top.key); expectKey = false; structural = end; }
428
+ i = end;
429
+ } else if (char === '{') { stack.push({ kind: 'object', parentKey: top?.key, keys: [] }); expectKey = true; structural = i; }
430
+ else if (char === '[') { stack.push({ kind: 'array', key: top?.key }); expectKey = false; structural = i; }
431
+ else if (char === '}' || char === ']') { stack.pop(); expectKey = false; structural = i; }
432
+ else if (char === ',') { expectKey = stack.at(-1)?.kind === 'object'; structural = i; }
433
+ else if (char === ':') { expectKey = false; structural = i; }
434
+ }
435
+ const word = /^\s*([A-Za-z]\w*)?$/.exec(text.slice(structural + 1));
436
+ if (!word) return undefined;
437
+ const typed = word[1] ?? '';
438
+ const top = stack.at(-1);
439
+ if (!stack.length) return structural === -1 ? { start: text.length - typed.length, text: typed, depth: 0, parentKey: undefined, present: [], wrap: true } : undefined;
440
+ if (top.kind !== 'object' || !expectKey) return undefined;
441
+ return { start: text.length - typed.length, text: typed, depth: stack.length, parentKey: top.parentKey, present: top.keys };
442
+ }
443
+
444
+ // The rest of the key under the caret. A quote counts as its closing quote only where a key can end.
445
+ const KEY_TAIL = /^\w*(?:"(?=\s*(?:[:,}]|$)))?/;
446
+ // Keys the enclosing object already has after the caret, up to its closing brace.
447
+ function keysAhead(text) {
448
+ const keys = [];
449
+ let depth = 0;
450
+ for (let i = 0; i < text.length; i++) {
451
+ const char = text[i];
452
+ if (char === '"') {
453
+ let end = i + 1;
454
+ while (end < text.length && text[end] !== '"') end += text[end] === '\\' ? 2 : 1;
455
+ if (depth === 0 && /^\s*:/.test(text.slice(end + 1))) keys.push(text.slice(i + 1, end));
456
+ i = end;
457
+ } else if (char === '{' || char === '[') depth++;
458
+ else if (char === '}' || char === ']') { if (depth === 0) break; depth--; }
459
+ }
460
+ return keys;
461
+ }
462
+
463
+ function matchingKeys(keys, context) {
464
+ const needle = context.text.toLowerCase();
465
+ return keys
466
+ .filter(item => !context.present.includes(item.key) && item.key.toLowerCase().includes(needle))
467
+ .sort((a, b) => Number(!a.key.toLowerCase().startsWith(needle)) - Number(!b.key.toLowerCase().startsWith(needle)));
468
+ }
469
+
470
+ // The same menu as the skills browser, over the key names a JSON field accepts.
471
+ function attachKeys(textarea, { keys, offer, label = 'Accepted settings' } = {}) {
472
+ if (!textarea || !Array.isArray(keys) || !keys.length || textarea.dataset?.keyPicker) return;
473
+ textarea.dataset.keyPicker = 'on';
474
+ const id = `key-picker-${++pickerSeq}`;
475
+ textarea.setAttribute('aria-autocomplete', 'list');
476
+ textarea.setAttribute('aria-haspopup', 'listbox');
477
+ textarea.setAttribute('aria-expanded', 'false');
478
+
479
+ let panel, options = [], active = 0, context, navigated = false, picked = false;
480
+ const close = () => {
481
+ panel?.remove(); panel = undefined; options = []; context = undefined; navigated = false;
482
+ if (openPlace === place) openPlace = undefined;
483
+ textarea.setAttribute('aria-expanded', 'false'); textarea.removeAttribute('aria-controls'); textarea.removeAttribute('aria-activedescendant');
484
+ };
485
+ const highlight = index => {
486
+ active = index;
487
+ options.forEach((option, i) => { option.row.dataset.active = String(i === index); option.row.setAttribute('aria-selected', String(i === index)); });
488
+ const current = options[index]?.row;
489
+ if (current) { textarea.setAttribute('aria-activedescendant', current.id); current.scrollIntoView?.({ block: 'nearest' }); }
490
+ else textarea.removeAttribute('aria-activedescendant');
491
+ };
492
+ const accept = item => {
493
+ if (!context || !item) return;
494
+ if (moved()) { update(); return; }
495
+ const value = textarea.value;
496
+ const rest = value.slice(context.end), own = KEY_TAIL.exec(rest)[0].length;
497
+ const tail = own + /^(?:[ \t]*:)?[ \t]*/.exec(rest.slice(own))[0].length;
498
+ const before = value.slice(0, context.start), after = value.slice(context.end + tail);
499
+ const insert = `${context.wrap ? '{\n ' : ''}"${item.key}": `;
500
+ textarea.value = before + insert + (context.wrap ? `${after.trimEnd()}\n}` : after);
501
+ const caret = before.length + insert.length;
502
+ textarea.setSelectionRange(caret, caret);
503
+ close();
504
+ picked = true;
505
+ textarea.dispatchEvent(new Event('input', { bubbles: true }));
506
+ };
507
+ const place = () => {
508
+ if (!panel) return;
509
+ const caret = caretRect(textarea);
510
+ const width = Math.min(380, window.innerWidth - 16);
511
+ panel.style.width = `${width}px`;
512
+ panel.style.left = `${Math.min(Math.max(8, caret.left - 12), window.innerWidth - width - 8)}px`;
513
+ const below = window.innerHeight - caret.bottom - 12, above = caret.top - 12;
514
+ if (below >= 180 || below >= above) { panel.style.top = `${caret.bottom + 4}px`; panel.style.bottom = ''; panel.style.maxHeight = `${Math.max(120, below)}px`; }
515
+ else { panel.style.bottom = `${window.innerHeight - caret.top + 4}px`; panel.style.top = ''; panel.style.maxHeight = `${Math.max(120, above)}px`; }
516
+ };
517
+ const update = () => {
518
+ const start = textarea.selectionStart, end = textarea.selectionEnd;
519
+ const next = start === end && document.activeElement === textarea ? keyContext(textarea.value.slice(0, start)) : undefined;
520
+ // The key under the caret is the one being replaced; every other key of the object is taken.
521
+ if (next) next.present = [...next.present, ...keysAhead(textarea.value.slice(start).replace(KEY_TAIL, ''))];
522
+ const found = next && (!offer || offer(next)) ? matchingKeys(keys, next) : [];
523
+ if (!found.length) { close(); return; }
524
+ if (context?.text !== next.text) active = 0;
525
+ context = { ...next, end: start };
526
+ if (!panel) {
527
+ panel = el('div', undefined, 'select-panel skill-picker key-picker'); panel.id = id;
528
+ panel.setAttribute('role', 'listbox'); panel.setAttribute('aria-label', label);
529
+ panel.addEventListener('mousedown', event => event.preventDefault());
530
+ (textarea.closest('dialog') ?? document.body).append(panel);
531
+ textarea.setAttribute('aria-expanded', 'true'); textarea.setAttribute('aria-controls', id);
532
+ openPlace = place;
533
+ }
534
+ panel.replaceChildren();
535
+ const list = el('div', undefined, 'select-list'); panel.append(list);
536
+ list.append(el('div', label, 'select-group'));
537
+ options = [];
538
+ for (const item of found) {
539
+ const row = el('div', undefined, 'select-option skill-option'); row.id = `${id}-${options.length}`;
540
+ row.setAttribute('role', 'option');
541
+ row.append(el('span', item.key, 'skill-option-command'));
542
+ if (item.description) { row.title = item.description; row.append(el('span', item.description, 'skill-option-description')); }
543
+ const index = options.length;
544
+ row.addEventListener('mousemove', () => { if (active !== index) highlight(index); });
545
+ row.addEventListener('click', () => accept(item));
546
+ options.push({ item, row }); list.append(row);
547
+ }
548
+ panel.append(el('div', 'Up/Down to choose, Enter to insert, Esc to close', 'skill-picker-hint'));
549
+ highlight(Math.min(active, options.length - 1));
550
+ place();
551
+ };
552
+
553
+ // Arrow keys, Home and End move the caret without an input event.
554
+ const moved = () => !!context && (textarea.selectionStart !== context.end || textarea.selectionEnd !== context.end);
555
+ // A pick changes the value from script, which the browser does not report as a change when the
556
+ // field is left. Typing afterwards does get reported, so only an untouched pick is sent here.
557
+ textarea.addEventListener('input', event => { if (event.isTrusted) picked = false; update(); });
558
+ textarea.addEventListener('change', () => { picked = false; });
559
+ textarea.addEventListener('click', update);
560
+ textarea.addEventListener('keyup', () => { if (moved()) update(); });
561
+ textarea.addEventListener('blur', () => { close(); if (picked) textarea.dispatchEvent(new Event('change', { bubbles: true })); });
227
562
  textarea.addEventListener('scroll', () => place());
228
- // Capture runs before the prompt's own Escape handling (leaving full screen), so Escape closes
229
- // only the picker while it is open.
230
563
  textarea.addEventListener('keydown', event => {
564
+ if (panel && moved()) update();
231
565
  if (!panel || event.isComposing) return;
232
566
  if (event.key === 'Escape') { event.preventDefault(); event.stopImmediatePropagation(); close(); return; }
233
567
  if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey || !options.length) return;
234
- if (event.key === 'ArrowDown') { event.preventDefault(); highlight((active + 1) % options.length); }
235
- else if (event.key === 'ArrowUp') { event.preventDefault(); highlight((active - 1 + options.length) % options.length); }
236
- else if (event.key === 'Enter' || event.key === 'Tab') { event.preventDefault(); accept(options[active]?.skill); }
568
+ if (event.key === 'ArrowDown') { event.preventDefault(); navigated = true; highlight((active + 1) % options.length); }
569
+ else if (event.key === 'ArrowUp') { event.preventDefault(); navigated = true; highlight((active - 1 + options.length) % options.length); }
570
+ // Enter straight after { or , is the author starting a new line, not a pick.
571
+ else if (event.key === 'Tab' || (event.key === 'Enter' && (navigated || context.text !== ''))) { event.preventDefault(); accept(options[active]?.item); }
237
572
  }, true);
238
- refreshWarnings();
239
573
  }
240
574
 
241
- globalThis.AndorraSkillPicker = { attach, references, problems, problemText, invalidate: () => { cache = { at: 0, value: undefined, error: undefined, pending: undefined }; } };
575
+ globalThis.AndorraSkillPicker = { attach, attachKeys, keyContext, keysAhead, references, problems, problemText, skillChipRanges, chipSpan, chipSelection, chipDeletion, snapOutOfChip, invalidate: () => { cache = { at: 0, value: undefined, error: undefined, pending: undefined }; } };
242
576
  })();
@@ -1,4 +1,3 @@
1
- /* Canvas extensions: draggable connections, marquee, persisted groups, minimap, copy/paste and shortcuts. */
2
1
  (() => {
3
2
  'use strict';
4
3
  const studio = window.AndorraStudio;
@@ -114,8 +113,6 @@
114
113
  layer.setAttribute('width', String(bounds.width));
115
114
  layer.setAttribute('height', String(bounds.height));
116
115
  path.setAttribute('fill', 'none');
117
- // The accent is a token, and an SVG attribute cannot name one: its value is read from the
118
- // page instead. A harness that loads this file on its own falls back to the register's value.
119
116
  path.setAttribute('stroke', typeof themeColor === 'function' ? themeColor('--accent', '#ececec') : '#ececec');
120
117
  path.setAttribute('stroke-width', '2.5');
121
118
  path.setAttribute('stroke-dasharray', '6 4');
@@ -147,8 +144,6 @@
147
144
  };
148
145
  port.addEventListener('pointerdown', event => {
149
146
  if (event.button !== 0 || event.ctrlKey || event.metaKey) return;
150
- // The base editor already stops port pointerdowns; keep the invariant
151
- // here as well so wire gestures never start the parent node's drag.
152
147
  event.stopPropagation();
153
148
  const startX = event.clientX, startY = event.clientY;
154
149
  const pointerId = event.pointerId;
@@ -191,14 +186,10 @@
191
186
  };
192
187
  const cancel = e => {
193
188
  if (!active || !matchesPointer(e)) return;
194
- // Cancellation is terminal; no stale pointerup may finish this gesture.
195
189
  cleanup();
196
190
  dragging = false;
197
191
  };
198
192
  window.addEventListener('pointermove', move);
199
- // Do not use once:true: an unrelated pointer's release/cancel would
200
- // consume the listener before this pointer finishes. cleanup() removes
201
- // both listeners after the matching gesture terminates.
202
193
  window.addEventListener('pointerup', finish);
203
194
  window.addEventListener('pointercancel', cancel);
204
195
  });
@@ -249,7 +240,7 @@
249
240
  status(studio.selectedStepsText(picked.length));
250
241
  };
251
242
  const cancel = e => {
252
- if (matchesPointer(e)) cleanup(); // Aborted gestures never alter the selection.
243
+ if (matchesPointer(e)) cleanup();
253
244
  };
254
245
  window.addEventListener('pointermove', move);
255
246
  window.addEventListener('pointerup', up);
@@ -260,21 +251,15 @@
260
251
  function copyNodes() {
261
252
  const chosen = selectedNodes();
262
253
  if (!chosen.length) return false;
263
- // An Orchestrator is a singleton entrypoint, never duplicated by clipboard operations.
264
254
  const selected = chosen.filter(node => node.agentRole !== 'orchestrator');
265
255
  if (!selected.length) { status('The Orchestrator cannot be duplicated.', true); return false; }
266
256
  const ids = new Set(selected.map(node => node.id));
267
257
  const order = Object.keys(state.graph.nodes);
268
- // Legacy/imported nodes can have no stored position. The base canvas renders
269
- // those using their graph index; capture that exact visible position rather
270
- // than collapsing copied nodes to the same 120,120 clipboard fallback.
271
258
  const snapshots = selected.map(node => {
272
259
  const snapshot = copy(node);
273
260
  if (!snapshot.position) snapshot.position = copy(position(node, order.indexOf(node.id)));
274
261
  return snapshot;
275
262
  });
276
- // An imported node's unmet provider requirement travels with its clipboard snapshot, so a
277
- // pasted copy asks for assignment exactly like the node it came from.
278
263
  copied = { graphId: state.graph.id, nodes: snapshots, edges: copy(state.graph.edges.filter(edge => ids.has(edge.source) && ids.has(edge.target))),
279
264
  pendingProviderIds: selected.filter(node => state.pendingProviderNodes?.has(node.id)).map(node => node.id) };
280
265
  pasteOffset = 0;
@@ -287,15 +272,11 @@
287
272
  const externalSources = copied.nodes
288
273
  .map(node => node.condition?.source)
289
274
  .filter(source => source && !copiedIds.has(source));
290
- // An external Condition source is meaningful only in its original graph.
291
- // Reject the entire paste across graphs (even if an unrelated node reuses
292
- // the same ID), or if the source was removed in the current graph.
293
275
  if (externalSources.length && (copied.graphId !== state.graph.id ||
294
276
  externalSources.some(source => !Object.hasOwn(state.graph.nodes, source)))) {
295
277
  status('Copy Condition steps with their source steps before pasting into another graph.', true);
296
278
  return;
297
279
  }
298
- // The free-tier rules live in app.js; a page or harness without them has no allowance to apply.
299
280
  const freeRefusal = typeof freeNodeRefusal === 'function' ? freeNodeRefusal(copied.nodes) : undefined;
300
281
  if (freeRefusal) { status(freeRefusal, true); return; }
301
282
  if (Object.keys(state.graph.nodes).length + copied.nodes.length > nodeLimit(state.graph)) {
@@ -304,11 +285,9 @@
304
285
  pasteOffset += 40;
305
286
  const positions = copied.nodes.map(node => node.position || { x: 120, y: 120 });
306
287
  const shift = axis => {
307
- // Apply one shared translation to the selection, preserving relative layout
308
- // while keeping every cloned coordinate within the validator's ±100000 range.
309
288
  const lower = Math.max(...positions.map(p => -100000 - p[axis]));
310
289
  const upper = Math.min(...positions.map(p => 100000 - p[axis]));
311
- if (lower > upper) return null; // Invalid draft: no shared valid translation exists.
290
+ if (lower > upper) return null;
312
291
  if (pasteOffset >= lower && pasteOffset <= upper) return pasteOffset;
313
292
  if (-pasteOffset >= lower && -pasteOffset <= upper) return -pasteOffset;
314
293
  return Math.max(lower, Math.min(upper, pasteOffset));
@@ -323,13 +302,9 @@
323
302
  for (const original of copied.nodes) {
324
303
  const node = copy(original);
325
304
  node.id = ids.get(original.id);
326
- // A copied Condition must read its copied predecessor, not the original Agent.
327
- // Preserve external references only for existing sources in this same graph.
328
305
  if (node.condition?.source && ids.has(node.condition.source)) {
329
306
  node.condition.source = ids.get(node.condition.source);
330
307
  }
331
- // Node names are limited to 200 characters by the graph validator. Keep
332
- // duplication usable for nodes already at that limit (including repeat copies).
333
308
  node.name = node.name.slice(0, 195).trimEnd() + ' copy';
334
309
  const p = original.position || { x: 120, y: 120 };
335
310
  node.position = { x: p.x + dx, y: p.y + dy };
@@ -339,8 +314,6 @@
339
314
  ...copy(original), id: 'edge-' + crypto.randomUUID().slice(0, 8),
340
315
  source: ids.get(original.source), target: ids.get(original.target)
341
316
  });
342
- // A pasted copy of a node that still owes its provider assignment owes it too, whether it
343
- // lands back in this graph or in another one.
344
317
  for (const originalId of copied.pendingProviderIds ?? []) {
345
318
  state.pendingProviderNodes ||= new Set();
346
319
  state.pendingProviderNodes.add(ids.get(originalId));
@@ -357,9 +330,6 @@
357
330
  const mod = event.ctrlKey || event.metaKey;
358
331
  const key = event.key.toLowerCase();
359
332
  if (mod && key === 'c') {
360
- // Preserve browser copy for selected diagnostics, context previews and
361
- // timeline text. A non-collapsed text selection takes precedence over
362
- // the graph's node clipboard, even outside form fields.
363
333
  const selection = window.getSelection?.();
364
334
  if (selection && !selection.isCollapsed) return;
365
335
  event.preventDefault(); copyNodes();
@@ -381,10 +351,6 @@
381
351
  });
382
352
  }
383
353
 
384
- /**
385
- * The keyboard reference, as the app's dialog: each shortcut a row of keys and what it does.
386
- * Keys are drawn as keycaps; a pointer gesture is said in words beside them.
387
- */
388
354
  const SHORTCUTS = [
389
355
  { keys: ['Ctrl/Cmd', 'C'], action: 'Copy steps' }, { keys: ['Ctrl/Cmd', 'V'], action: 'Paste steps' },
390
356
  { keys: ['Ctrl/Cmd', 'D'], action: 'Duplicate' }, { keys: ['Ctrl/Cmd', 'A'], action: 'Select all' },
@@ -428,7 +394,7 @@
428
394
  if (magnet) snapButton.append(magnet); else snapButton.textContent = 'Snap';
429
395
  snapButton.onclick = () => {
430
396
  state.studioSnap = !state.studioSnap;
431
- try { localStorage.setItem('andorra-studio-snap', String(state.studioSnap)); } catch { /* Ephemeral preference is fine. */ }
397
+ try { localStorage.setItem('andorra-studio-snap', String(state.studioSnap)); } catch { }
432
398
  refreshSnap();
433
399
  };
434
400
  toolbar.append(snapButton);
@@ -447,7 +413,6 @@
447
413
  }
448
414
  const previous = studio.canvas;
449
415
  studio.canvas = () => { previous?.(); makeGroups(); installPortDragging(); minimap(); };
450
- // A dragged card carries its layout group's frame with it; the minimap follows on release.
451
416
  studio.dragged = () => { makeGroups(); };
452
417
  installToolbar();
453
418
  marquee();