@andorra-labs/code 0.1.7 → 0.1.8

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 (1086) hide show
  1. package/README.md +3 -3
  2. package/dist/src/agent-execution.js +46 -15
  3. package/dist/src/app-server/protocol.d.ts +7 -1
  4. package/dist/src/app-server/protocol.js +4 -1
  5. package/dist/src/app-server.d.ts +38 -0
  6. package/dist/src/app-server.js +285 -54
  7. package/dist/src/auth/deployment.d.ts +6 -0
  8. package/dist/src/auth/deployment.js +8 -2
  9. package/dist/src/automation-service.d.ts +7 -2
  10. package/dist/src/automation-service.js +12 -19
  11. package/dist/src/background-tasks.d.ts +40 -0
  12. package/dist/src/background-tasks.js +54 -0
  13. package/dist/src/browser-view.d.ts +10 -0
  14. package/dist/src/browser-view.js +22 -0
  15. package/dist/src/claude-provider.d.ts +8 -0
  16. package/dist/src/claude-provider.js +133 -24
  17. package/dist/src/cli.js +51 -0
  18. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +21 -0
  19. package/dist/src/code-intelligence/CodeIntelligenceManager.js +51 -0
  20. package/dist/src/coding-tools.js +166 -3
  21. package/dist/src/commands.js +2 -2
  22. package/dist/src/completion.js +50 -1
  23. package/dist/src/config.d.ts +12 -3
  24. package/dist/src/config.js +32 -37
  25. package/dist/src/extensions.d.ts +2 -0
  26. package/dist/src/extensions.js +42 -22
  27. package/dist/src/firefox-cookies.d.ts +78 -0
  28. package/dist/src/firefox-cookies.js +261 -0
  29. package/dist/src/graph-health.d.ts +10 -0
  30. package/dist/src/graph-health.js +5 -0
  31. package/dist/src/graph-runner.js +8 -1
  32. package/dist/src/graph-ui/tokens.css +23 -23
  33. package/dist/src/hardened-runtime.d.ts +7 -2
  34. package/dist/src/hardened-runtime.js +24 -12
  35. package/dist/src/host-process-guard.d.ts +62 -0
  36. package/dist/src/host-process-guard.js +2859 -0
  37. package/dist/src/mcp.d.ts +55 -2
  38. package/dist/src/mcp.js +360 -88
  39. package/dist/src/memory/MemoryManager.js +7 -13
  40. package/dist/src/memory/MemoryProvider.d.ts +1 -1
  41. package/dist/src/memory/index.d.ts +0 -2
  42. package/dist/src/memory/index.js +0 -2
  43. package/dist/src/memory/repository.d.ts +1 -1
  44. package/dist/src/memory/repository.js +2 -2
  45. package/dist/src/memory/types.d.ts +1 -8
  46. package/dist/src/memory/types.js +1 -1
  47. package/dist/src/model-health-cache.d.ts +62 -0
  48. package/dist/src/model-health-cache.js +161 -0
  49. package/dist/src/provider-engine.d.ts +21 -0
  50. package/dist/src/provider-engine.js +63 -5
  51. package/dist/src/provider-settings.js +1 -1
  52. package/dist/src/providers.d.ts +22 -0
  53. package/dist/src/providers.js +81 -32
  54. package/dist/src/qa/index.d.ts +3 -2
  55. package/dist/src/qa/index.js +3 -2
  56. package/dist/src/qa/qa-authorize.js +6 -0
  57. package/dist/src/qa/runtime/ProcessManager.d.ts +10 -0
  58. package/dist/src/qa/runtime/ProcessManager.js +21 -2
  59. package/dist/src/qa/runtime/PtyManager.d.ts +9 -0
  60. package/dist/src/qa/runtime/PtyManager.js +18 -0
  61. package/dist/src/qa/runtime/changes.d.ts +15 -0
  62. package/dist/src/qa/runtime/changes.js +15 -0
  63. package/dist/src/qa/tools.js +4 -0
  64. package/dist/src/react-runtime.js +22 -5
  65. package/dist/src/remote/engine-pool.js +3 -1
  66. package/dist/src/remote/network.js +1 -1
  67. package/dist/src/run-control.d.ts +9 -0
  68. package/dist/src/run-control.js +15 -0
  69. package/dist/src/runtime.d.ts +1 -1
  70. package/dist/src/runtime.js +2 -1
  71. package/dist/src/skills/bundled/create-skill/SKILL.md +17 -3
  72. package/dist/src/skills/bundled/diagram/SKILL.md +144 -0
  73. package/dist/src/skills/bundled/graph-manager/SKILL.md +3 -1
  74. package/dist/src/skills/bundled/manage-skills/SKILL.md +6 -1
  75. package/dist/src/skills/bundled/provenance.json +8 -3
  76. package/dist/src/skills/runtime-skills.d.ts +7 -0
  77. package/dist/src/skills/runtime-skills.js +12 -3
  78. package/dist/src/subagent-run.js +1 -1
  79. package/dist/src/tool-availability.d.ts +16 -0
  80. package/dist/src/tool-availability.js +28 -0
  81. package/dist/src/types.d.ts +19 -5
  82. package/dist/src/update-check.d.ts +35 -0
  83. package/dist/src/update-check.js +104 -0
  84. package/dist/src/usage-analytics.d.ts +6 -0
  85. package/dist/src/usage-analytics.js +47 -4
  86. package/dist/src/web-search.d.ts +6 -0
  87. package/dist/src/web-search.js +12 -0
  88. package/dist/src/workspace-instructions.d.ts +10 -0
  89. package/dist/src/workspace-instructions.js +26 -21
  90. package/dist/vendor/engine/provenance.json +3088 -17923
  91. package/dist/vendor/engine/runtime/agent/types.d.ts +1 -1
  92. package/dist/vendor/engine/runtime/ai/types.d.ts +8 -14
  93. package/dist/vendor/engine/runtime/coding-agent/core/tools/bash.d.ts +2 -2
  94. package/dist/vendor/engine/runtime/coding-agent/core/tools/bash.js +2 -2
  95. package/dist/vendor/engine/runtime/coding-agent/core/tools/edit.d.ts +3 -4
  96. package/dist/vendor/engine/runtime/coding-agent/core/tools/edit.js +0 -3
  97. package/dist/vendor/engine/runtime/coding-agent/core/tools/find.d.ts +2 -2
  98. package/dist/vendor/engine/runtime/coding-agent/core/tools/find.js +0 -2
  99. package/dist/vendor/engine/runtime/coding-agent/core/tools/grep.d.ts +2 -2
  100. package/dist/vendor/engine/runtime/coding-agent/core/tools/grep.js +0 -2
  101. package/dist/vendor/engine/runtime/coding-agent/core/tools/index.d.ts +2 -2
  102. package/dist/vendor/engine/runtime/coding-agent/core/tools/ls.d.ts +2 -2
  103. package/dist/vendor/engine/runtime/coding-agent/core/tools/ls.js +0 -2
  104. package/dist/vendor/engine/runtime/coding-agent/core/tools/read.d.ts +3 -3
  105. package/dist/vendor/engine/runtime/coding-agent/core/tools/read.js +0 -2
  106. package/dist/vendor/engine/runtime/coding-agent/core/tools/tool-definition-wrapper.d.ts +2 -2
  107. package/dist/vendor/engine/runtime/coding-agent/core/tools/tool-definition.d.ts +40 -0
  108. package/dist/vendor/engine/runtime/coding-agent/core/tools/write.d.ts +2 -2
  109. package/dist/vendor/engine/runtime/coding-agent/core/tools/write.js +0 -2
  110. package/docs/README.md +1 -1
  111. package/docs/agents/README.md +5 -5
  112. package/docs/agents/install-for-agents.md +7 -6
  113. package/docs/agents/mcp-server.md +4 -4
  114. package/docs/agents/subagent-mode.md +6 -6
  115. package/docs/concepts/README.md +3 -3
  116. package/docs/concepts/jev-efficiency.md +2 -1
  117. package/docs/concepts/limits.md +3 -3
  118. package/docs/concepts/memory.md +5 -25
  119. package/docs/concepts/security.md +13 -5
  120. package/docs/concepts/workspace-instructions.md +3 -2
  121. package/docs/getting-started/README.md +3 -3
  122. package/docs/getting-started/accounts.md +4 -4
  123. package/docs/getting-started/configure-providers.md +4 -2
  124. package/docs/guides/browser.md +13 -1
  125. package/docs/guides/desktop-app.md +71 -18
  126. package/docs/guides/extensions.md +4 -2
  127. package/docs/guides/graph-builder.md +1 -1
  128. package/docs/guides/headless.md +5 -4
  129. package/docs/guides/update.md +3 -1
  130. package/docs/guides/web-search.md +6 -2
  131. package/docs/guides/windows-code-signing.md +13 -10
  132. package/docs/llms.txt +2 -2
  133. package/docs/reference/cli.md +9 -4
  134. package/docs/reference/config.md +14 -8
  135. package/docs/reference/slash-commands.md +5 -2
  136. package/package.json +3 -22
  137. package/tests/harness-extensions-test-plan.md +4 -1
  138. package/dist/src/memory/providers/graphiti/GraphitiClient.d.ts +0 -27
  139. package/dist/src/memory/providers/graphiti/GraphitiClient.js +0 -76
  140. package/dist/src/memory/providers/graphiti/GraphitiMapper.d.ts +0 -6
  141. package/dist/src/memory/providers/graphiti/GraphitiMapper.js +0 -116
  142. package/dist/src/memory/providers/graphiti/GraphitiMemoryProvider.d.ts +0 -27
  143. package/dist/src/memory/providers/graphiti/GraphitiMemoryProvider.js +0 -137
  144. package/dist/src/memory/providers/graphiti/GraphitiTypes.d.ts +0 -57
  145. package/dist/src/memory/providers/graphiti/GraphitiTypes.js +0 -2
  146. package/dist/vendor/engine/runtime/agent/agent-loop.d.ts +0 -23
  147. package/dist/vendor/engine/runtime/agent/agent-loop.js +0 -601
  148. package/dist/vendor/engine/runtime/agent/agent.d.ts +0 -130
  149. package/dist/vendor/engine/runtime/agent/agent.js +0 -430
  150. package/dist/vendor/engine/runtime/agent/harness/agent-harness.d.ts +0 -715
  151. package/dist/vendor/engine/runtime/agent/harness/agent-harness.js +0 -5
  152. package/dist/vendor/engine/runtime/agent/harness/compaction/branch-summarization.d.ts +0 -67
  153. package/dist/vendor/engine/runtime/agent/harness/compaction/branch-summarization.js +0 -175
  154. package/dist/vendor/engine/runtime/agent/harness/compaction/compaction.d.ts +0 -125
  155. package/dist/vendor/engine/runtime/agent/harness/compaction/compaction.js +0 -559
  156. package/dist/vendor/engine/runtime/agent/harness/compaction/utils.d.ts +0 -24
  157. package/dist/vendor/engine/runtime/agent/harness/compaction/utils.js +0 -119
  158. package/dist/vendor/engine/runtime/agent/harness/config.d.ts +0 -8
  159. package/dist/vendor/engine/runtime/agent/harness/config.js +0 -34
  160. package/dist/vendor/engine/runtime/agent/harness/context.d.ts +0 -8
  161. package/dist/vendor/engine/runtime/agent/harness/context.js +0 -12
  162. package/dist/vendor/engine/runtime/agent/harness/events.d.ts +0 -24
  163. package/dist/vendor/engine/runtime/agent/harness/events.js +0 -249
  164. package/dist/vendor/engine/runtime/agent/harness/execution/assistant.d.ts +0 -41
  165. package/dist/vendor/engine/runtime/agent/harness/execution/assistant.js +0 -81
  166. package/dist/vendor/engine/runtime/agent/harness/execution/effect-gate.d.ts +0 -21
  167. package/dist/vendor/engine/runtime/agent/harness/execution/effect-gate.js +0 -48
  168. package/dist/vendor/engine/runtime/agent/harness/execution/tools.d.ts +0 -66
  169. package/dist/vendor/engine/runtime/agent/harness/execution/tools.js +0 -118
  170. package/dist/vendor/engine/runtime/agent/harness/hooks.d.ts +0 -37
  171. package/dist/vendor/engine/runtime/agent/harness/hooks.js +0 -405
  172. package/dist/vendor/engine/runtime/agent/harness/messages.d.ts +0 -50
  173. package/dist/vendor/engine/runtime/agent/harness/messages.js +0 -102
  174. package/dist/vendor/engine/runtime/agent/harness/prompt-templates.d.ts +0 -48
  175. package/dist/vendor/engine/runtime/agent/harness/prompt-templates.js +0 -224
  176. package/dist/vendor/engine/runtime/agent/harness/result.d.ts +0 -132
  177. package/dist/vendor/engine/runtime/agent/harness/result.js +0 -80
  178. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/boundary.d.ts +0 -27
  179. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/boundary.js +0 -172
  180. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/checkpoint.d.ts +0 -7
  181. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/checkpoint.js +0 -132
  182. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/deferred.d.ts +0 -14
  183. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/deferred.js +0 -178
  184. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/generation.d.ts +0 -7
  185. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/generation.js +0 -204
  186. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/reconcile.d.ts +0 -4
  187. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/reconcile.js +0 -139
  188. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/recovery.d.ts +0 -7
  189. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/recovery.js +0 -84
  190. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/response.d.ts +0 -22
  191. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/response.js +0 -393
  192. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/retry.d.ts +0 -3
  193. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/retry.js +0 -33
  194. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/structural.d.ts +0 -31
  195. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/structural.js +0 -928
  196. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/terminal.d.ts +0 -6
  197. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/terminal.js +0 -48
  198. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tool-placement.d.ts +0 -13
  199. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tool-placement.js +0 -218
  200. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tools.d.ts +0 -5
  201. package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tools.js +0 -448
  202. package/dist/vendor/engine/runtime/agent/harness/runtime/drive.d.ts +0 -5
  203. package/dist/vendor/engine/runtime/agent/harness/runtime/drive.js +0 -92
  204. package/dist/vendor/engine/runtime/agent/harness/runtime/harness.d.ts +0 -58
  205. package/dist/vendor/engine/runtime/agent/harness/runtime/harness.js +0 -310
  206. package/dist/vendor/engine/runtime/agent/harness/runtime/lane.d.ts +0 -117
  207. package/dist/vendor/engine/runtime/agent/harness/runtime/lane.js +0 -1574
  208. package/dist/vendor/engine/runtime/agent/harness/runtime/progress.d.ts +0 -14
  209. package/dist/vendor/engine/runtime/agent/harness/runtime/progress.js +0 -65
  210. package/dist/vendor/engine/runtime/agent/harness/runtime/reducer.d.ts +0 -4
  211. package/dist/vendor/engine/runtime/agent/harness/runtime/reducer.js +0 -239
  212. package/dist/vendor/engine/runtime/agent/harness/runtime/restore.d.ts +0 -23
  213. package/dist/vendor/engine/runtime/agent/harness/runtime/restore.js +0 -116
  214. package/dist/vendor/engine/runtime/agent/harness/runtime/transcript.d.ts +0 -20
  215. package/dist/vendor/engine/runtime/agent/harness/runtime/transcript.js +0 -71
  216. package/dist/vendor/engine/runtime/agent/harness/runtime/types.d.ts +0 -104
  217. package/dist/vendor/engine/runtime/agent/harness/runtime/types.js +0 -60
  218. package/dist/vendor/engine/runtime/agent/harness/session/commit.d.ts +0 -52
  219. package/dist/vendor/engine/runtime/agent/harness/session/commit.js +0 -56
  220. package/dist/vendor/engine/runtime/agent/harness/session/context.d.ts +0 -9
  221. package/dist/vendor/engine/runtime/agent/harness/session/context.js +0 -48
  222. package/dist/vendor/engine/runtime/agent/harness/session/fork-policy.d.ts +0 -20
  223. package/dist/vendor/engine/runtime/agent/harness/session/fork-policy.js +0 -54
  224. package/dist/vendor/engine/runtime/agent/harness/session/fork.d.ts +0 -15
  225. package/dist/vendor/engine/runtime/agent/harness/session/fork.js +0 -78
  226. package/dist/vendor/engine/runtime/agent/harness/session/in-memory-storage-state.d.ts +0 -38
  227. package/dist/vendor/engine/runtime/agent/harness/session/in-memory-storage-state.js +0 -275
  228. package/dist/vendor/engine/runtime/agent/harness/session/index.d.ts +0 -10
  229. package/dist/vendor/engine/runtime/agent/harness/session/index.js +0 -8
  230. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/codec.d.ts +0 -20
  231. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/codec.js +0 -44
  232. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/fork.d.ts +0 -37
  233. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/fork.js +0 -263
  234. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/index.d.ts +0 -3
  235. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/index.js +0 -3
  236. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/io.d.ts +0 -13
  237. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/io.js +0 -85
  238. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/legacy-v3.d.ts +0 -43
  239. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/legacy-v3.js +0 -461
  240. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/repo.d.ts +0 -34
  241. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/repo.js +0 -300
  242. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/storage.d.ts +0 -40
  243. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/storage.js +0 -199
  244. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/types.d.ts +0 -38
  245. package/dist/vendor/engine/runtime/agent/harness/session/jsonl/types.js +0 -2
  246. package/dist/vendor/engine/runtime/agent/harness/session/memory.d.ts +0 -47
  247. package/dist/vendor/engine/runtime/agent/harness/session/memory.js +0 -368
  248. package/dist/vendor/engine/runtime/agent/harness/session/mutation-line.d.ts +0 -7
  249. package/dist/vendor/engine/runtime/agent/harness/session/mutation-line.js +0 -20
  250. package/dist/vendor/engine/runtime/agent/harness/session/session.d.ts +0 -81
  251. package/dist/vendor/engine/runtime/agent/harness/session/session.js +0 -360
  252. package/dist/vendor/engine/runtime/agent/harness/session/types.d.ts +0 -511
  253. package/dist/vendor/engine/runtime/agent/harness/session/types.js +0 -8
  254. package/dist/vendor/engine/runtime/agent/harness/session/values.d.ts +0 -94
  255. package/dist/vendor/engine/runtime/agent/harness/session/values.js +0 -80
  256. package/dist/vendor/engine/runtime/agent/harness/skills.d.ts +0 -45
  257. package/dist/vendor/engine/runtime/agent/harness/skills.js +0 -325
  258. package/dist/vendor/engine/runtime/agent/harness/system-prompt.d.ts +0 -2
  259. package/dist/vendor/engine/runtime/agent/harness/system-prompt.js +0 -29
  260. package/dist/vendor/engine/runtime/agent/harness/telemetry.d.ts +0 -1241
  261. package/dist/vendor/engine/runtime/agent/harness/telemetry.js +0 -526
  262. package/dist/vendor/engine/runtime/agent/harness/tools/bash.d.ts +0 -26
  263. package/dist/vendor/engine/runtime/agent/harness/tools/bash.js +0 -104
  264. package/dist/vendor/engine/runtime/agent/harness/tools/edit-diff.d.ts +0 -88
  265. package/dist/vendor/engine/runtime/agent/harness/tools/edit-diff.js +0 -385
  266. package/dist/vendor/engine/runtime/agent/harness/tools/edit.d.ts +0 -18
  267. package/dist/vendor/engine/runtime/agent/harness/tools/edit.js +0 -107
  268. package/dist/vendor/engine/runtime/agent/harness/tools/file-mutation-queue.d.ts +0 -4
  269. package/dist/vendor/engine/runtime/agent/harness/tools/file-mutation-queue.js +0 -45
  270. package/dist/vendor/engine/runtime/agent/harness/tools/image.d.ts +0 -2
  271. package/dist/vendor/engine/runtime/agent/harness/tools/image.js +0 -105
  272. package/dist/vendor/engine/runtime/agent/harness/tools/index.d.ts +0 -5
  273. package/dist/vendor/engine/runtime/agent/harness/tools/index.js +0 -4
  274. package/dist/vendor/engine/runtime/agent/harness/tools/path-utils.d.ts +0 -4
  275. package/dist/vendor/engine/runtime/agent/harness/tools/path-utils.js +0 -25
  276. package/dist/vendor/engine/runtime/agent/harness/tools/read.d.ts +0 -34
  277. package/dist/vendor/engine/runtime/agent/harness/tools/read.js +0 -107
  278. package/dist/vendor/engine/runtime/agent/harness/tools/tool-context.d.ts +0 -5
  279. package/dist/vendor/engine/runtime/agent/harness/tools/write.d.ts +0 -10
  280. package/dist/vendor/engine/runtime/agent/harness/tools/write.js +0 -30
  281. package/dist/vendor/engine/runtime/agent/harness/types.d.ts +0 -304
  282. package/dist/vendor/engine/runtime/agent/harness/types.js +0 -74
  283. package/dist/vendor/engine/runtime/agent/harness/utils/adaptive-publisher.d.ts +0 -23
  284. package/dist/vendor/engine/runtime/agent/harness/utils/adaptive-publisher.js +0 -78
  285. package/dist/vendor/engine/runtime/agent/harness/utils/output-capture.d.ts +0 -30
  286. package/dist/vendor/engine/runtime/agent/harness/utils/output-capture.js +0 -216
  287. package/dist/vendor/engine/runtime/agent/harness/utils/shell-output.d.ts +0 -28
  288. package/dist/vendor/engine/runtime/agent/harness/utils/shell-output.js +0 -70
  289. package/dist/vendor/engine/runtime/agent/harness/utils/truncate.d.ts +0 -70
  290. package/dist/vendor/engine/runtime/agent/harness/utils/truncate.js +0 -295
  291. package/dist/vendor/engine/runtime/agent/harness/utils/usage.d.ts +0 -3
  292. package/dist/vendor/engine/runtime/agent/harness/utils/usage.js +0 -32
  293. package/dist/vendor/engine/runtime/agent/index.d.ts +0 -27
  294. package/dist/vendor/engine/runtime/agent/index.js +0 -25
  295. package/dist/vendor/engine/runtime/agent/proxy.d.ts +0 -71
  296. package/dist/vendor/engine/runtime/agent/proxy.js +0 -309
  297. package/dist/vendor/engine/runtime/agent/search/index.d.ts +0 -28
  298. package/dist/vendor/engine/runtime/agent/search/index.js +0 -1
  299. package/dist/vendor/engine/runtime/agent/stream-fn.d.ts +0 -9
  300. package/dist/vendor/engine/runtime/agent/stream-fn.js +0 -16
  301. package/dist/vendor/engine/runtime/ai/api/anthropic-messages.lazy.d.ts +0 -2
  302. package/dist/vendor/engine/runtime/ai/api/anthropic-messages.lazy.js +0 -2
  303. package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.d.ts +0 -16
  304. package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.js +0 -260
  305. package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.lazy.d.ts +0 -2
  306. package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.lazy.js +0 -2
  307. package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.d.ts +0 -37
  308. package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.js +0 -1091
  309. package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.lazy.d.ts +0 -9
  310. package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.lazy.js +0 -21
  311. package/dist/vendor/engine/runtime/ai/api/google-generative-ai.d.ts +0 -12
  312. package/dist/vendor/engine/runtime/ai/api/google-generative-ai.js +0 -368
  313. package/dist/vendor/engine/runtime/ai/api/google-generative-ai.lazy.d.ts +0 -2
  314. package/dist/vendor/engine/runtime/ai/api/google-generative-ai.lazy.js +0 -2
  315. package/dist/vendor/engine/runtime/ai/api/google-vertex.d.ts +0 -14
  316. package/dist/vendor/engine/runtime/ai/api/google-vertex.js +0 -429
  317. package/dist/vendor/engine/runtime/ai/api/google-vertex.lazy.d.ts +0 -2
  318. package/dist/vendor/engine/runtime/ai/api/google-vertex.lazy.js +0 -2
  319. package/dist/vendor/engine/runtime/ai/api/mistral-conversations.d.ts +0 -24
  320. package/dist/vendor/engine/runtime/ai/api/mistral-conversations.js +0 -747
  321. package/dist/vendor/engine/runtime/ai/api/mistral-conversations.lazy.d.ts +0 -2
  322. package/dist/vendor/engine/runtime/ai/api/mistral-conversations.lazy.js +0 -2
  323. package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.d.ts +0 -30
  324. package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.js +0 -1302
  325. package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.lazy.d.ts +0 -2
  326. package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.lazy.js +0 -2
  327. package/dist/vendor/engine/runtime/ai/api/openai-completions.lazy.d.ts +0 -2
  328. package/dist/vendor/engine/runtime/ai/api/openai-completions.lazy.js +0 -2
  329. package/dist/vendor/engine/runtime/ai/api/openai-responses.lazy.d.ts +0 -2
  330. package/dist/vendor/engine/runtime/ai/api/openai-responses.lazy.js +0 -2
  331. package/dist/vendor/engine/runtime/ai/api/openrouter-images.d.ts +0 -2
  332. package/dist/vendor/engine/runtime/ai/api/openrouter-images.js +0 -131
  333. package/dist/vendor/engine/runtime/ai/api/openrouter-images.lazy.d.ts +0 -2
  334. package/dist/vendor/engine/runtime/ai/api/openrouter-images.lazy.js +0 -3
  335. package/dist/vendor/engine/runtime/ai/api/pi-messages.d.ts +0 -98
  336. package/dist/vendor/engine/runtime/ai/api/pi-messages.js +0 -312
  337. package/dist/vendor/engine/runtime/ai/api/pi-messages.lazy.d.ts +0 -2
  338. package/dist/vendor/engine/runtime/ai/api/pi-messages.lazy.js +0 -2
  339. package/dist/vendor/engine/runtime/ai/auth/helpers.d.ts +0 -21
  340. package/dist/vendor/engine/runtime/ai/auth/helpers.js +0 -52
  341. package/dist/vendor/engine/runtime/ai/auth/oauth/load.d.ts +0 -28
  342. package/dist/vendor/engine/runtime/ai/auth/oauth/load.js +0 -55
  343. package/dist/vendor/engine/runtime/ai/compat/extension-oauth-types.d.ts +0 -38
  344. package/dist/vendor/engine/runtime/ai/compat/extension-oauth-types.js +0 -1
  345. package/dist/vendor/engine/runtime/ai/compat.d.ts +0 -66
  346. package/dist/vendor/engine/runtime/ai/compat.js +0 -201
  347. package/dist/vendor/engine/runtime/ai/env-api-keys.d.ts +0 -20
  348. package/dist/vendor/engine/runtime/ai/env-api-keys.js +0 -148
  349. package/dist/vendor/engine/runtime/ai/image-models.d.ts +0 -9
  350. package/dist/vendor/engine/runtime/ai/image-models.generated.d.ts +0 -814
  351. package/dist/vendor/engine/runtime/ai/image-models.generated.js +0 -816
  352. package/dist/vendor/engine/runtime/ai/image-models.js +0 -22
  353. package/dist/vendor/engine/runtime/ai/images-api-registry.d.ts +0 -13
  354. package/dist/vendor/engine/runtime/ai/images-api-registry.js +0 -21
  355. package/dist/vendor/engine/runtime/ai/images-models.d.ts +0 -94
  356. package/dist/vendor/engine/runtime/ai/images-models.js +0 -142
  357. package/dist/vendor/engine/runtime/ai/images.d.ts +0 -3
  358. package/dist/vendor/engine/runtime/ai/images.js +0 -13
  359. package/dist/vendor/engine/runtime/ai/index.d.ts +0 -36
  360. package/dist/vendor/engine/runtime/ai/index.js +0 -23
  361. package/dist/vendor/engine/runtime/ai/legacy-api-aliases.d.ts +0 -41
  362. package/dist/vendor/engine/runtime/ai/legacy-api-aliases.js +0 -48
  363. package/dist/vendor/engine/runtime/ai/models.generated.d.ts +0 -84
  364. package/dist/vendor/engine/runtime/ai/models.generated.js +0 -86
  365. package/dist/vendor/engine/runtime/ai/oauth.d.ts +0 -2
  366. package/dist/vendor/engine/runtime/ai/oauth.js +0 -1
  367. package/dist/vendor/engine/runtime/ai/providers/all.d.ts +0 -27
  368. package/dist/vendor/engine/runtime/ai/providers/all.js +0 -132
  369. package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.d.ts +0 -2
  370. package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.js +0 -92
  371. package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.models.d.ts +0 -3
  372. package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.models.js +0 -5
  373. package/dist/vendor/engine/runtime/ai/providers/ant-ling.d.ts +0 -2
  374. package/dist/vendor/engine/runtime/ai/providers/ant-ling.js +0 -14
  375. package/dist/vendor/engine/runtime/ai/providers/ant-ling.models.d.ts +0 -3
  376. package/dist/vendor/engine/runtime/ai/providers/ant-ling.models.js +0 -5
  377. package/dist/vendor/engine/runtime/ai/providers/anthropic.d.ts +0 -2
  378. package/dist/vendor/engine/runtime/ai/providers/anthropic.js +0 -55
  379. package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.d.ts +0 -2
  380. package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.js +0 -13
  381. package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.models.d.ts +0 -3
  382. package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.models.js +0 -5
  383. package/dist/vendor/engine/runtime/ai/providers/baseten.d.ts +0 -2
  384. package/dist/vendor/engine/runtime/ai/providers/baseten.js +0 -14
  385. package/dist/vendor/engine/runtime/ai/providers/baseten.models.d.ts +0 -3
  386. package/dist/vendor/engine/runtime/ai/providers/baseten.models.js +0 -5
  387. package/dist/vendor/engine/runtime/ai/providers/cerebras.d.ts +0 -2
  388. package/dist/vendor/engine/runtime/ai/providers/cerebras.js +0 -14
  389. package/dist/vendor/engine/runtime/ai/providers/cerebras.models.d.ts +0 -3
  390. package/dist/vendor/engine/runtime/ai/providers/cerebras.models.js +0 -5
  391. package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.d.ts +0 -4
  392. package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.js +0 -24
  393. package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.models.d.ts +0 -3
  394. package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.models.js +0 -5
  395. package/dist/vendor/engine/runtime/ai/providers/cloudflare-auth.d.ts +0 -3
  396. package/dist/vendor/engine/runtime/ai/providers/cloudflare-auth.js +0 -85
  397. package/dist/vendor/engine/runtime/ai/providers/cloudflare-stream.d.ts +0 -7
  398. package/dist/vendor/engine/runtime/ai/providers/cloudflare-stream.js +0 -20
  399. package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.d.ts +0 -2
  400. package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.js +0 -14
  401. package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.models.d.ts +0 -3
  402. package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.models.js +0 -5
  403. package/dist/vendor/engine/runtime/ai/providers/data/.manifest.json +0 -1
  404. package/dist/vendor/engine/runtime/ai/providers/data/amazon-bedrock.json +0 -1
  405. package/dist/vendor/engine/runtime/ai/providers/data/ant-ling.json +0 -1
  406. package/dist/vendor/engine/runtime/ai/providers/data/azure-openai-responses.json +0 -1
  407. package/dist/vendor/engine/runtime/ai/providers/data/baseten.json +0 -1
  408. package/dist/vendor/engine/runtime/ai/providers/data/cerebras.json +0 -1
  409. package/dist/vendor/engine/runtime/ai/providers/data/cloudflare-ai-gateway.json +0 -1
  410. package/dist/vendor/engine/runtime/ai/providers/data/cloudflare-workers-ai.json +0 -1
  411. package/dist/vendor/engine/runtime/ai/providers/data/deepseek.json +0 -1
  412. package/dist/vendor/engine/runtime/ai/providers/data/fireworks.json +0 -1
  413. package/dist/vendor/engine/runtime/ai/providers/data/github-copilot.json +0 -1
  414. package/dist/vendor/engine/runtime/ai/providers/data/google-vertex.json +0 -1
  415. package/dist/vendor/engine/runtime/ai/providers/data/google.json +0 -1
  416. package/dist/vendor/engine/runtime/ai/providers/data/groq.json +0 -1
  417. package/dist/vendor/engine/runtime/ai/providers/data/huggingface.json +0 -1
  418. package/dist/vendor/engine/runtime/ai/providers/data/kimi-coding.json +0 -1
  419. package/dist/vendor/engine/runtime/ai/providers/data/meta.json +0 -1
  420. package/dist/vendor/engine/runtime/ai/providers/data/minimax-cn.json +0 -1
  421. package/dist/vendor/engine/runtime/ai/providers/data/minimax.json +0 -1
  422. package/dist/vendor/engine/runtime/ai/providers/data/mistral.json +0 -1
  423. package/dist/vendor/engine/runtime/ai/providers/data/moonshotai-cn.json +0 -1
  424. package/dist/vendor/engine/runtime/ai/providers/data/moonshotai.json +0 -1
  425. package/dist/vendor/engine/runtime/ai/providers/data/nvidia.json +0 -1
  426. package/dist/vendor/engine/runtime/ai/providers/data/openai-codex.json +0 -1
  427. package/dist/vendor/engine/runtime/ai/providers/data/openai.json +0 -1
  428. package/dist/vendor/engine/runtime/ai/providers/data/opencode-go.json +0 -1
  429. package/dist/vendor/engine/runtime/ai/providers/data/opencode.json +0 -1
  430. package/dist/vendor/engine/runtime/ai/providers/data/openrouter.json +0 -1
  431. package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan-cn.json +0 -1
  432. package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan-individual.json +0 -1
  433. package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan.json +0 -1
  434. package/dist/vendor/engine/runtime/ai/providers/data/radius.json +0 -1
  435. package/dist/vendor/engine/runtime/ai/providers/data/together.json +0 -1
  436. package/dist/vendor/engine/runtime/ai/providers/data/vercel-ai-gateway.json +0 -1
  437. package/dist/vendor/engine/runtime/ai/providers/data/xai.json +0 -1
  438. package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-ams.json +0 -1
  439. package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-cn.json +0 -1
  440. package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-sgp.json +0 -1
  441. package/dist/vendor/engine/runtime/ai/providers/data/xiaomi.json +0 -1
  442. package/dist/vendor/engine/runtime/ai/providers/data/zai-coding-cn.json +0 -1
  443. package/dist/vendor/engine/runtime/ai/providers/data/zai.json +0 -1
  444. package/dist/vendor/engine/runtime/ai/providers/deepseek.d.ts +0 -2
  445. package/dist/vendor/engine/runtime/ai/providers/deepseek.js +0 -14
  446. package/dist/vendor/engine/runtime/ai/providers/deepseek.models.d.ts +0 -3
  447. package/dist/vendor/engine/runtime/ai/providers/deepseek.models.js +0 -5
  448. package/dist/vendor/engine/runtime/ai/providers/faux.d.ts +0 -102
  449. package/dist/vendor/engine/runtime/ai/providers/faux.js +0 -488
  450. package/dist/vendor/engine/runtime/ai/providers/fireworks.d.ts +0 -2
  451. package/dist/vendor/engine/runtime/ai/providers/fireworks.js +0 -18
  452. package/dist/vendor/engine/runtime/ai/providers/fireworks.models.d.ts +0 -3
  453. package/dist/vendor/engine/runtime/ai/providers/fireworks.models.js +0 -5
  454. package/dist/vendor/engine/runtime/ai/providers/github-copilot.d.ts +0 -2
  455. package/dist/vendor/engine/runtime/ai/providers/github-copilot.js +0 -34
  456. package/dist/vendor/engine/runtime/ai/providers/github-copilot.models.d.ts +0 -3
  457. package/dist/vendor/engine/runtime/ai/providers/github-copilot.models.js +0 -5
  458. package/dist/vendor/engine/runtime/ai/providers/google-vertex.d.ts +0 -2
  459. package/dist/vendor/engine/runtime/ai/providers/google-vertex.js +0 -93
  460. package/dist/vendor/engine/runtime/ai/providers/google-vertex.models.d.ts +0 -3
  461. package/dist/vendor/engine/runtime/ai/providers/google-vertex.models.js +0 -5
  462. package/dist/vendor/engine/runtime/ai/providers/google.d.ts +0 -2
  463. package/dist/vendor/engine/runtime/ai/providers/google.js +0 -14
  464. package/dist/vendor/engine/runtime/ai/providers/google.models.d.ts +0 -3
  465. package/dist/vendor/engine/runtime/ai/providers/google.models.js +0 -5
  466. package/dist/vendor/engine/runtime/ai/providers/groq.d.ts +0 -2
  467. package/dist/vendor/engine/runtime/ai/providers/groq.js +0 -14
  468. package/dist/vendor/engine/runtime/ai/providers/groq.models.d.ts +0 -3
  469. package/dist/vendor/engine/runtime/ai/providers/groq.models.js +0 -5
  470. package/dist/vendor/engine/runtime/ai/providers/huggingface.d.ts +0 -2
  471. package/dist/vendor/engine/runtime/ai/providers/huggingface.js +0 -14
  472. package/dist/vendor/engine/runtime/ai/providers/huggingface.models.d.ts +0 -3
  473. package/dist/vendor/engine/runtime/ai/providers/huggingface.models.js +0 -5
  474. package/dist/vendor/engine/runtime/ai/providers/images/register-builtins.d.ts +0 -3
  475. package/dist/vendor/engine/runtime/ai/providers/images/register-builtins.js +0 -33
  476. package/dist/vendor/engine/runtime/ai/providers/kimi-coding.d.ts +0 -2
  477. package/dist/vendor/engine/runtime/ai/providers/kimi-coding.js +0 -23
  478. package/dist/vendor/engine/runtime/ai/providers/kimi-coding.models.d.ts +0 -3
  479. package/dist/vendor/engine/runtime/ai/providers/kimi-coding.models.js +0 -5
  480. package/dist/vendor/engine/runtime/ai/providers/meta.d.ts +0 -2
  481. package/dist/vendor/engine/runtime/ai/providers/meta.js +0 -23
  482. package/dist/vendor/engine/runtime/ai/providers/meta.models.d.ts +0 -3
  483. package/dist/vendor/engine/runtime/ai/providers/meta.models.js +0 -5
  484. package/dist/vendor/engine/runtime/ai/providers/minimax-cn.d.ts +0 -2
  485. package/dist/vendor/engine/runtime/ai/providers/minimax-cn.js +0 -14
  486. package/dist/vendor/engine/runtime/ai/providers/minimax-cn.models.d.ts +0 -3
  487. package/dist/vendor/engine/runtime/ai/providers/minimax-cn.models.js +0 -5
  488. package/dist/vendor/engine/runtime/ai/providers/minimax.d.ts +0 -2
  489. package/dist/vendor/engine/runtime/ai/providers/minimax.js +0 -14
  490. package/dist/vendor/engine/runtime/ai/providers/minimax.models.d.ts +0 -3
  491. package/dist/vendor/engine/runtime/ai/providers/minimax.models.js +0 -5
  492. package/dist/vendor/engine/runtime/ai/providers/mistral.d.ts +0 -2
  493. package/dist/vendor/engine/runtime/ai/providers/mistral.js +0 -14
  494. package/dist/vendor/engine/runtime/ai/providers/mistral.models.d.ts +0 -3
  495. package/dist/vendor/engine/runtime/ai/providers/mistral.models.js +0 -5
  496. package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.d.ts +0 -2
  497. package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.js +0 -14
  498. package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.models.d.ts +0 -3
  499. package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.models.js +0 -5
  500. package/dist/vendor/engine/runtime/ai/providers/moonshotai.d.ts +0 -2
  501. package/dist/vendor/engine/runtime/ai/providers/moonshotai.js +0 -14
  502. package/dist/vendor/engine/runtime/ai/providers/moonshotai.models.d.ts +0 -3
  503. package/dist/vendor/engine/runtime/ai/providers/moonshotai.models.js +0 -5
  504. package/dist/vendor/engine/runtime/ai/providers/nvidia.d.ts +0 -2
  505. package/dist/vendor/engine/runtime/ai/providers/nvidia.js +0 -14
  506. package/dist/vendor/engine/runtime/ai/providers/nvidia.models.d.ts +0 -3
  507. package/dist/vendor/engine/runtime/ai/providers/nvidia.models.js +0 -5
  508. package/dist/vendor/engine/runtime/ai/providers/openai-codex.d.ts +0 -2
  509. package/dist/vendor/engine/runtime/ai/providers/openai-codex.js +0 -21
  510. package/dist/vendor/engine/runtime/ai/providers/openai-codex.models.d.ts +0 -3
  511. package/dist/vendor/engine/runtime/ai/providers/openai-codex.models.js +0 -5
  512. package/dist/vendor/engine/runtime/ai/providers/openai.d.ts +0 -2
  513. package/dist/vendor/engine/runtime/ai/providers/openai.js +0 -14
  514. package/dist/vendor/engine/runtime/ai/providers/openai.models.d.ts +0 -3
  515. package/dist/vendor/engine/runtime/ai/providers/openai.models.js +0 -5
  516. package/dist/vendor/engine/runtime/ai/providers/opencode-go.d.ts +0 -2
  517. package/dist/vendor/engine/runtime/ai/providers/opencode-go.js +0 -20
  518. package/dist/vendor/engine/runtime/ai/providers/opencode-go.models.d.ts +0 -3
  519. package/dist/vendor/engine/runtime/ai/providers/opencode-go.models.js +0 -5
  520. package/dist/vendor/engine/runtime/ai/providers/opencode-headers.d.ts +0 -3
  521. package/dist/vendor/engine/runtime/ai/providers/opencode-headers.js +0 -21
  522. package/dist/vendor/engine/runtime/ai/providers/opencode.d.ts +0 -2
  523. package/dist/vendor/engine/runtime/ai/providers/opencode.js +0 -22
  524. package/dist/vendor/engine/runtime/ai/providers/opencode.models.d.ts +0 -3
  525. package/dist/vendor/engine/runtime/ai/providers/opencode.models.js +0 -5
  526. package/dist/vendor/engine/runtime/ai/providers/openrouter-images.d.ts +0 -2
  527. package/dist/vendor/engine/runtime/ai/providers/openrouter-images.js +0 -21
  528. package/dist/vendor/engine/runtime/ai/providers/openrouter.d.ts +0 -2
  529. package/dist/vendor/engine/runtime/ai/providers/openrouter.js +0 -26
  530. package/dist/vendor/engine/runtime/ai/providers/openrouter.models.d.ts +0 -3
  531. package/dist/vendor/engine/runtime/ai/providers/openrouter.models.js +0 -5
  532. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.d.ts +0 -2
  533. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.js +0 -14
  534. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.models.d.ts +0 -3
  535. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.models.js +0 -5
  536. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.d.ts +0 -2
  537. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.js +0 -14
  538. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.models.d.ts +0 -3
  539. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.models.js +0 -5
  540. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.d.ts +0 -2
  541. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.js +0 -14
  542. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.models.d.ts +0 -3
  543. package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.models.js +0 -5
  544. package/dist/vendor/engine/runtime/ai/providers/radius-config.d.ts +0 -25
  545. package/dist/vendor/engine/runtime/ai/providers/radius-config.js +0 -62
  546. package/dist/vendor/engine/runtime/ai/providers/radius.d.ts +0 -8
  547. package/dist/vendor/engine/runtime/ai/providers/radius.js +0 -77
  548. package/dist/vendor/engine/runtime/ai/providers/radius.models.d.ts +0 -3
  549. package/dist/vendor/engine/runtime/ai/providers/radius.models.js +0 -5
  550. package/dist/vendor/engine/runtime/ai/providers/together.d.ts +0 -2
  551. package/dist/vendor/engine/runtime/ai/providers/together.js +0 -14
  552. package/dist/vendor/engine/runtime/ai/providers/together.models.d.ts +0 -3
  553. package/dist/vendor/engine/runtime/ai/providers/together.models.js +0 -5
  554. package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.d.ts +0 -2
  555. package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.js +0 -14
  556. package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.models.d.ts +0 -3
  557. package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.models.js +0 -5
  558. package/dist/vendor/engine/runtime/ai/providers/xai.d.ts +0 -2
  559. package/dist/vendor/engine/runtime/ai/providers/xai.js +0 -23
  560. package/dist/vendor/engine/runtime/ai/providers/xai.models.d.ts +0 -3
  561. package/dist/vendor/engine/runtime/ai/providers/xai.models.js +0 -5
  562. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.d.ts +0 -2
  563. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.js +0 -14
  564. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.models.d.ts +0 -3
  565. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.models.js +0 -5
  566. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.d.ts +0 -2
  567. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.js +0 -14
  568. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.models.d.ts +0 -3
  569. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.models.js +0 -5
  570. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.d.ts +0 -2
  571. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.js +0 -14
  572. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.models.d.ts +0 -3
  573. package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.models.js +0 -5
  574. package/dist/vendor/engine/runtime/ai/providers/xiaomi.d.ts +0 -2
  575. package/dist/vendor/engine/runtime/ai/providers/xiaomi.js +0 -14
  576. package/dist/vendor/engine/runtime/ai/providers/xiaomi.models.d.ts +0 -3
  577. package/dist/vendor/engine/runtime/ai/providers/xiaomi.models.js +0 -5
  578. package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.d.ts +0 -2
  579. package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.js +0 -14
  580. package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.models.d.ts +0 -3
  581. package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.models.js +0 -5
  582. package/dist/vendor/engine/runtime/ai/providers/zai.d.ts +0 -2
  583. package/dist/vendor/engine/runtime/ai/providers/zai.js +0 -14
  584. package/dist/vendor/engine/runtime/ai/providers/zai.models.d.ts +0 -3
  585. package/dist/vendor/engine/runtime/ai/providers/zai.models.js +0 -5
  586. package/dist/vendor/engine/runtime/ai/session-resources.d.ts +0 -3
  587. package/dist/vendor/engine/runtime/ai/session-resources.js +0 -21
  588. package/dist/vendor/engine/runtime/ai/utils/abort-signals.d.ts +0 -5
  589. package/dist/vendor/engine/runtime/ai/utils/abort-signals.js +0 -33
  590. package/dist/vendor/engine/runtime/ai/utils/assistant-message-frame.d.ts +0 -76
  591. package/dist/vendor/engine/runtime/ai/utils/assistant-message-frame.js +0 -424
  592. package/dist/vendor/engine/runtime/ai/utils/node-http-proxy.d.ts +0 -3
  593. package/dist/vendor/engine/runtime/ai/utils/node-http-proxy.js +0 -132
  594. package/dist/vendor/engine/runtime/ai/utils/retry.d.ts +0 -57
  595. package/dist/vendor/engine/runtime/ai/utils/retry.js +0 -182
  596. package/dist/vendor/engine/runtime/ai/utils/typebox-helpers.d.ts +0 -16
  597. package/dist/vendor/engine/runtime/ai/utils/typebox-helpers.js +0 -20
  598. package/dist/vendor/engine/runtime/ai/utils/uuid.d.ts +0 -2
  599. package/dist/vendor/engine/runtime/ai/utils/uuid.js +0 -41
  600. package/dist/vendor/engine/runtime/ai/utils/validation.d.ts +0 -17
  601. package/dist/vendor/engine/runtime/ai/utils/validation.js +0 -308
  602. package/dist/vendor/engine/runtime/chord/api.d.ts +0 -14
  603. package/dist/vendor/engine/runtime/chord/api.js +0 -71
  604. package/dist/vendor/engine/runtime/chord/context/index.d.ts +0 -23
  605. package/dist/vendor/engine/runtime/chord/context/index.js +0 -96
  606. package/dist/vendor/engine/runtime/chord/delta/index.d.ts +0 -118
  607. package/dist/vendor/engine/runtime/chord/delta/index.js +0 -1903
  608. package/dist/vendor/engine/runtime/chord/facets/host.d.ts +0 -11
  609. package/dist/vendor/engine/runtime/chord/facets/host.js +0 -762
  610. package/dist/vendor/engine/runtime/chord/facets/loader.d.ts +0 -2
  611. package/dist/vendor/engine/runtime/chord/facets/loader.js +0 -4
  612. package/dist/vendor/engine/runtime/chord/index.d.ts +0 -10
  613. package/dist/vendor/engine/runtime/chord/index.js +0 -9
  614. package/dist/vendor/engine/runtime/chord/json.d.ts +0 -3
  615. package/dist/vendor/engine/runtime/chord/json.js +0 -56
  616. package/dist/vendor/engine/runtime/chord/services/consumer.d.ts +0 -10
  617. package/dist/vendor/engine/runtime/chord/services/consumer.js +0 -536
  618. package/dist/vendor/engine/runtime/chord/services/errors.d.ts +0 -7
  619. package/dist/vendor/engine/runtime/chord/services/errors.js +0 -21
  620. package/dist/vendor/engine/runtime/chord/services/handle.d.ts +0 -14
  621. package/dist/vendor/engine/runtime/chord/services/handle.js +0 -100
  622. package/dist/vendor/engine/runtime/chord/services/instances.d.ts +0 -24
  623. package/dist/vendor/engine/runtime/chord/services/instances.js +0 -136
  624. package/dist/vendor/engine/runtime/chord/services/loopback.d.ts +0 -4
  625. package/dist/vendor/engine/runtime/chord/services/loopback.js +0 -14
  626. package/dist/vendor/engine/runtime/chord/services/provider.d.ts +0 -36
  627. package/dist/vendor/engine/runtime/chord/services/provider.js +0 -471
  628. package/dist/vendor/engine/runtime/chord/services/state-codec.d.ts +0 -14
  629. package/dist/vendor/engine/runtime/chord/services/state-codec.js +0 -114
  630. package/dist/vendor/engine/runtime/chord/services/state-internals.d.ts +0 -10
  631. package/dist/vendor/engine/runtime/chord/services/state-internals.js +0 -9
  632. package/dist/vendor/engine/runtime/chord/services/state.d.ts +0 -22
  633. package/dist/vendor/engine/runtime/chord/services/state.js +0 -123
  634. package/dist/vendor/engine/runtime/chord/services/wire.d.ts +0 -59
  635. package/dist/vendor/engine/runtime/chord/services/wire.js +0 -172
  636. package/dist/vendor/engine/runtime/chord/types.d.ts +0 -202
  637. package/dist/vendor/engine/runtime/chord/types.js +0 -1
  638. package/dist/vendor/engine/runtime/coding-agent/cli/args.d.ts +0 -60
  639. package/dist/vendor/engine/runtime/coding-agent/cli/args.js +0 -439
  640. package/dist/vendor/engine/runtime/coding-agent/cli/auth-check.d.ts +0 -18
  641. package/dist/vendor/engine/runtime/coding-agent/cli/auth-check.js +0 -49
  642. package/dist/vendor/engine/runtime/coding-agent/cli/auth-command.d.ts +0 -23
  643. package/dist/vendor/engine/runtime/coding-agent/cli/auth-command.js +0 -102
  644. package/dist/vendor/engine/runtime/coding-agent/cli/config-selector.d.ts +0 -15
  645. package/dist/vendor/engine/runtime/coding-agent/cli/config-selector.js +0 -31
  646. package/dist/vendor/engine/runtime/coding-agent/cli/credential-print.d.ts +0 -12
  647. package/dist/vendor/engine/runtime/coding-agent/cli/credential-print.js +0 -75
  648. package/dist/vendor/engine/runtime/coding-agent/cli/file-processor.d.ts +0 -14
  649. package/dist/vendor/engine/runtime/coding-agent/cli/file-processor.js +0 -70
  650. package/dist/vendor/engine/runtime/coding-agent/cli/initial-message.d.ts +0 -17
  651. package/dist/vendor/engine/runtime/coding-agent/cli/initial-message.js +0 -21
  652. package/dist/vendor/engine/runtime/coding-agent/cli/list-models.d.ts +0 -8
  653. package/dist/vendor/engine/runtime/coding-agent/cli/list-models.js +0 -97
  654. package/dist/vendor/engine/runtime/coding-agent/cli/project-trust.d.ts +0 -9
  655. package/dist/vendor/engine/runtime/coding-agent/cli/project-trust.js +0 -47
  656. package/dist/vendor/engine/runtime/coding-agent/cli/session-picker.d.ts +0 -9
  657. package/dist/vendor/engine/runtime/coding-agent/cli/session-picker.js +0 -35
  658. package/dist/vendor/engine/runtime/coding-agent/cli/startup-ui.d.ts +0 -19
  659. package/dist/vendor/engine/runtime/coding-agent/cli/startup-ui.js +0 -184
  660. package/dist/vendor/engine/runtime/coding-agent/core/agent-session-runtime.d.ts +0 -118
  661. package/dist/vendor/engine/runtime/coding-agent/core/agent-session-runtime.js +0 -316
  662. package/dist/vendor/engine/runtime/coding-agent/core/agent-session-services.d.ts +0 -85
  663. package/dist/vendor/engine/runtime/coding-agent/core/agent-session-services.js +0 -133
  664. package/dist/vendor/engine/runtime/coding-agent/core/agent-session.d.ts +0 -771
  665. package/dist/vendor/engine/runtime/coding-agent/core/agent-session.js +0 -2990
  666. package/dist/vendor/engine/runtime/coding-agent/core/auth-guidance.d.ts +0 -4
  667. package/dist/vendor/engine/runtime/coding-agent/core/auth-guidance.js +0 -20
  668. package/dist/vendor/engine/runtime/coding-agent/core/auth-storage.d.ts +0 -71
  669. package/dist/vendor/engine/runtime/coding-agent/core/auth-storage.js +0 -425
  670. package/dist/vendor/engine/runtime/coding-agent/core/bash-executor.d.ts +0 -31
  671. package/dist/vendor/engine/runtime/coding-agent/core/bash-executor.js +0 -110
  672. package/dist/vendor/engine/runtime/coding-agent/core/bug-report-upload.d.ts +0 -11
  673. package/dist/vendor/engine/runtime/coding-agent/core/bug-report-upload.js +0 -21
  674. package/dist/vendor/engine/runtime/coding-agent/core/bug-report.d.ts +0 -175
  675. package/dist/vendor/engine/runtime/coding-agent/core/bug-report.js +0 -291
  676. package/dist/vendor/engine/runtime/coding-agent/core/cache-stats.d.ts +0 -48
  677. package/dist/vendor/engine/runtime/coding-agent/core/cache-stats.js +0 -111
  678. package/dist/vendor/engine/runtime/coding-agent/core/cache-warmer.d.ts +0 -102
  679. package/dist/vendor/engine/runtime/coding-agent/core/cache-warmer.js +0 -355
  680. package/dist/vendor/engine/runtime/coding-agent/core/compaction/branch-summarization.d.ts +0 -97
  681. package/dist/vendor/engine/runtime/coding-agent/core/compaction/branch-summarization.js +0 -250
  682. package/dist/vendor/engine/runtime/coding-agent/core/compaction/compaction.d.ts +0 -142
  683. package/dist/vendor/engine/runtime/coding-agent/core/compaction/compaction.js +0 -666
  684. package/dist/vendor/engine/runtime/coding-agent/core/compaction/index.d.ts +0 -6
  685. package/dist/vendor/engine/runtime/coding-agent/core/compaction/index.js +0 -6
  686. package/dist/vendor/engine/runtime/coding-agent/core/compaction/utils.d.ts +0 -37
  687. package/dist/vendor/engine/runtime/coding-agent/core/compaction/utils.js +0 -141
  688. package/dist/vendor/engine/runtime/coding-agent/core/crash-log.d.ts +0 -26
  689. package/dist/vendor/engine/runtime/coding-agent/core/crash-log.js +0 -138
  690. package/dist/vendor/engine/runtime/coding-agent/core/defaults.d.ts +0 -3
  691. package/dist/vendor/engine/runtime/coding-agent/core/defaults.js +0 -10
  692. package/dist/vendor/engine/runtime/coding-agent/core/diagnostics.d.ts +0 -14
  693. package/dist/vendor/engine/runtime/coding-agent/core/diagnostics.js +0 -1
  694. package/dist/vendor/engine/runtime/coding-agent/core/event-bus.d.ts +0 -8
  695. package/dist/vendor/engine/runtime/coding-agent/core/event-bus.js +0 -24
  696. package/dist/vendor/engine/runtime/coding-agent/core/exec.d.ts +0 -28
  697. package/dist/vendor/engine/runtime/coding-agent/core/exec.js +0 -74
  698. package/dist/vendor/engine/runtime/coding-agent/core/experimental.d.ts +0 -1
  699. package/dist/vendor/engine/runtime/coding-agent/core/experimental.js +0 -3
  700. package/dist/vendor/engine/runtime/coding-agent/core/export-html/ansi-to-html.d.ts +0 -21
  701. package/dist/vendor/engine/runtime/coding-agent/core/export-html/ansi-to-html.js +0 -248
  702. package/dist/vendor/engine/runtime/coding-agent/core/export-html/index.d.ts +0 -36
  703. package/dist/vendor/engine/runtime/coding-agent/core/export-html/index.js +0 -225
  704. package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.css +0 -1066
  705. package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.html +0 -55
  706. package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.js +0 -1864
  707. package/dist/vendor/engine/runtime/coding-agent/core/export-html/tool-renderer.d.ts +0 -33
  708. package/dist/vendor/engine/runtime/coding-agent/core/export-html/tool-renderer.js +0 -107
  709. package/dist/vendor/engine/runtime/coding-agent/core/export-html/vendor/highlight.min.js +0 -1213
  710. package/dist/vendor/engine/runtime/coding-agent/core/export-html/vendor/marked.min.js +0 -78
  711. package/dist/vendor/engine/runtime/coding-agent/core/extensions/index.d.ts +0 -11
  712. package/dist/vendor/engine/runtime/coding-agent/core/extensions/index.js +0 -8
  713. package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-loader.d.ts +0 -1
  714. package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-loader.js +0 -3
  715. package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-static-loader.d.ts +0 -1
  716. package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-static-loader.js +0 -3
  717. package/dist/vendor/engine/runtime/coding-agent/core/extensions/loader.d.ts +0 -22
  718. package/dist/vendor/engine/runtime/coding-agent/core/extensions/loader.js +0 -633
  719. package/dist/vendor/engine/runtime/coding-agent/core/extensions/runner.d.ts +0 -180
  720. package/dist/vendor/engine/runtime/coding-agent/core/extensions/runner.js +0 -1028
  721. package/dist/vendor/engine/runtime/coding-agent/core/extensions/types.d.ts +0 -1362
  722. package/dist/vendor/engine/runtime/coding-agent/core/extensions/types.js +0 -47
  723. package/dist/vendor/engine/runtime/coding-agent/core/extensions/virtual-modules.d.ts +0 -2
  724. package/dist/vendor/engine/runtime/coding-agent/core/extensions/virtual-modules.js +0 -37
  725. package/dist/vendor/engine/runtime/coding-agent/core/extensions/wrapper.d.ts +0 -19
  726. package/dist/vendor/engine/runtime/coding-agent/core/extensions/wrapper.js +0 -21
  727. package/dist/vendor/engine/runtime/coding-agent/core/footer-data-provider.d.ts +0 -63
  728. package/dist/vendor/engine/runtime/coding-agent/core/footer-data-provider.js +0 -337
  729. package/dist/vendor/engine/runtime/coding-agent/core/http-dispatcher.d.ts +0 -21
  730. package/dist/vendor/engine/runtime/coding-agent/core/http-dispatcher.js +0 -97
  731. package/dist/vendor/engine/runtime/coding-agent/core/keybindings.d.ts +0 -427
  732. package/dist/vendor/engine/runtime/coding-agent/core/keybindings.js +0 -320
  733. package/dist/vendor/engine/runtime/coding-agent/core/messages.d.ts +0 -76
  734. package/dist/vendor/engine/runtime/coding-agent/core/messages.js +0 -123
  735. package/dist/vendor/engine/runtime/coding-agent/core/model-config.d.ts +0 -723
  736. package/dist/vendor/engine/runtime/coding-agent/core/model-config.js +0 -281
  737. package/dist/vendor/engine/runtime/coding-agent/core/model-registry.d.ts +0 -48
  738. package/dist/vendor/engine/runtime/coding-agent/core/model-registry.js +0 -114
  739. package/dist/vendor/engine/runtime/coding-agent/core/model-resolver.d.ts +0 -123
  740. package/dist/vendor/engine/runtime/coding-agent/core/model-resolver.js +0 -589
  741. package/dist/vendor/engine/runtime/coding-agent/core/model-runtime.d.ts +0 -100
  742. package/dist/vendor/engine/runtime/coding-agent/core/model-runtime.js +0 -603
  743. package/dist/vendor/engine/runtime/coding-agent/core/models-store.d.ts +0 -21
  744. package/dist/vendor/engine/runtime/coding-agent/core/models-store.js +0 -114
  745. package/dist/vendor/engine/runtime/coding-agent/core/output-guard.d.ts +0 -6
  746. package/dist/vendor/engine/runtime/coding-agent/core/output-guard.js +0 -88
  747. package/dist/vendor/engine/runtime/coding-agent/core/package-manager.d.ts +0 -212
  748. package/dist/vendor/engine/runtime/coding-agent/core/package-manager.js +0 -2176
  749. package/dist/vendor/engine/runtime/coding-agent/core/pi-manifest.d.ts +0 -7
  750. package/dist/vendor/engine/runtime/coding-agent/core/pi-manifest.js +0 -25
  751. package/dist/vendor/engine/runtime/coding-agent/core/project-trust.d.ts +0 -14
  752. package/dist/vendor/engine/runtime/coding-agent/core/project-trust.js +0 -58
  753. package/dist/vendor/engine/runtime/coding-agent/core/prompt-templates.d.ts +0 -53
  754. package/dist/vendor/engine/runtime/coding-agent/core/prompt-templates.js +0 -235
  755. package/dist/vendor/engine/runtime/coding-agent/core/provider-attribution.d.ts +0 -3
  756. package/dist/vendor/engine/runtime/coding-agent/core/provider-attribution.js +0 -71
  757. package/dist/vendor/engine/runtime/coding-agent/core/provider-composer.d.ts +0 -59
  758. package/dist/vendor/engine/runtime/coding-agent/core/provider-composer.js +0 -422
  759. package/dist/vendor/engine/runtime/coding-agent/core/radius.d.ts +0 -4
  760. package/dist/vendor/engine/runtime/coding-agent/core/radius.js +0 -7
  761. package/dist/vendor/engine/runtime/coding-agent/core/remote-catalog-provider.d.ts +0 -4
  762. package/dist/vendor/engine/runtime/coding-agent/core/remote-catalog-provider.js +0 -121
  763. package/dist/vendor/engine/runtime/coding-agent/core/resolve-config-value.d.ts +0 -29
  764. package/dist/vendor/engine/runtime/coding-agent/core/resolve-config-value.js +0 -246
  765. package/dist/vendor/engine/runtime/coding-agent/core/resource-loader.d.ts +0 -220
  766. package/dist/vendor/engine/runtime/coding-agent/core/resource-loader.js +0 -874
  767. package/dist/vendor/engine/runtime/coding-agent/core/runtime-credentials.d.ts +0 -14
  768. package/dist/vendor/engine/runtime/coding-agent/core/runtime-credentials.js +0 -38
  769. package/dist/vendor/engine/runtime/coding-agent/core/sdk.d.ts +0 -107
  770. package/dist/vendor/engine/runtime/coding-agent/core/sdk.js +0 -296
  771. package/dist/vendor/engine/runtime/coding-agent/core/session-cwd.d.ts +0 -18
  772. package/dist/vendor/engine/runtime/coding-agent/core/session-cwd.js +0 -37
  773. package/dist/vendor/engine/runtime/coding-agent/core/session-export.d.ts +0 -7
  774. package/dist/vendor/engine/runtime/coding-agent/core/session-export.js +0 -32
  775. package/dist/vendor/engine/runtime/coding-agent/core/session-manager.d.ts +0 -379
  776. package/dist/vendor/engine/runtime/coding-agent/core/session-manager.js +0 -1432
  777. package/dist/vendor/engine/runtime/coding-agent/core/settings-diagnostics.d.ts +0 -8
  778. package/dist/vendor/engine/runtime/coding-agent/core/settings-diagnostics.js +0 -20
  779. package/dist/vendor/engine/runtime/coding-agent/core/settings-manager.d.ts +0 -346
  780. package/dist/vendor/engine/runtime/coding-agent/core/settings-manager.js +0 -1032
  781. package/dist/vendor/engine/runtime/coding-agent/core/skills.d.ts +0 -59
  782. package/dist/vendor/engine/runtime/coding-agent/core/skills.js +0 -406
  783. package/dist/vendor/engine/runtime/coding-agent/core/slash-commands.d.ts +0 -14
  784. package/dist/vendor/engine/runtime/coding-agent/core/slash-commands.js +0 -27
  785. package/dist/vendor/engine/runtime/coding-agent/core/source-info.d.ts +0 -17
  786. package/dist/vendor/engine/runtime/coding-agent/core/source-info.js +0 -18
  787. package/dist/vendor/engine/runtime/coding-agent/core/system-prompt.d.ts +0 -70
  788. package/dist/vendor/engine/runtime/coding-agent/core/system-prompt.js +0 -146
  789. package/dist/vendor/engine/runtime/coding-agent/core/telemetry.d.ts +0 -2
  790. package/dist/vendor/engine/runtime/coding-agent/core/telemetry.js +0 -8
  791. package/dist/vendor/engine/runtime/coding-agent/core/timings.d.ts +0 -9
  792. package/dist/vendor/engine/runtime/coding-agent/core/timings.js +0 -40
  793. package/dist/vendor/engine/runtime/coding-agent/core/tools/render-utils.d.ts +0 -23
  794. package/dist/vendor/engine/runtime/coding-agent/core/tools/render-utils.js +0 -64
  795. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/bash.d.ts +0 -11
  796. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/bash.js +0 -137
  797. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/edit.d.ts +0 -22
  798. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/edit.js +0 -166
  799. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/find.d.ts +0 -9
  800. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/find.js +0 -63
  801. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/grep.d.ts +0 -9
  802. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/grep.js +0 -68
  803. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/index.d.ts +0 -27
  804. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/index.js +0 -46
  805. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/ls.d.ts +0 -9
  806. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/ls.js +0 -57
  807. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/read.d.ts +0 -10
  808. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/read.js +0 -128
  809. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/write.d.ts +0 -9
  810. package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/write.js +0 -152
  811. package/dist/vendor/engine/runtime/coding-agent/core/trust-manager.d.ts +0 -35
  812. package/dist/vendor/engine/runtime/coding-agent/core/trust-manager.js +0 -202
  813. package/dist/vendor/engine/runtime/coding-agent/core/usage-totals.d.ts +0 -18
  814. package/dist/vendor/engine/runtime/coding-agent/core/usage-totals.js +0 -55
  815. package/dist/vendor/engine/runtime/coding-agent/extensions/index.d.ts +0 -2
  816. package/dist/vendor/engine/runtime/coding-agent/extensions/index.js +0 -2
  817. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/client.d.ts +0 -68
  818. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/client.js +0 -312
  819. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/huggingface.d.ts +0 -22
  820. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/huggingface.js +0 -140
  821. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/index.d.ts +0 -2
  822. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/index.js +0 -218
  823. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/provider.d.ts +0 -11
  824. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/provider.js +0 -160
  825. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/ui.d.ts +0 -41
  826. package/dist/vendor/engine/runtime/coding-agent/extensions/llama/ui.js +0 -415
  827. package/dist/vendor/engine/runtime/coding-agent/index.d.ts +0 -36
  828. package/dist/vendor/engine/runtime/coding-agent/index.js +0 -47
  829. package/dist/vendor/engine/runtime/coding-agent/main.d.ts +0 -15
  830. package/dist/vendor/engine/runtime/coding-agent/main.js +0 -808
  831. package/dist/vendor/engine/runtime/coding-agent/migrations.d.ts +0 -32
  832. package/dist/vendor/engine/runtime/coding-agent/migrations.js +0 -281
  833. package/dist/vendor/engine/runtime/coding-agent/modes/index.d.ts +0 -9
  834. package/dist/vendor/engine/runtime/coding-agent/modes/index.js +0 -7
  835. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/bug-report.d.ts +0 -15
  836. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/bug-report.js +0 -209
  837. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/chat-viewport.d.ts +0 -19
  838. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/chat-viewport.js +0 -27
  839. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/armin.d.ts +0 -33
  840. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/armin.js +0 -332
  841. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/assistant-message.d.ts +0 -25
  842. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/assistant-message.js +0 -157
  843. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bash-execution.d.ts +0 -33
  844. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bash-execution.js +0 -174
  845. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bordered-loader.d.ts +0 -15
  846. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bordered-loader.js +0 -53
  847. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/branch-summary-message.d.ts +0 -15
  848. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/branch-summary-message.js +0 -50
  849. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/compaction-summary-message.d.ts +0 -15
  850. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/compaction-summary-message.js +0 -51
  851. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/config-selector.d.ts +0 -101
  852. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/config-selector.js +0 -760
  853. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/countdown-timer.d.ts +0 -13
  854. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/countdown-timer.js +0 -32
  855. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-editor.d.ts +0 -29
  856. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-editor.js +0 -114
  857. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-entry.d.ts +0 -18
  858. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-entry.js +0 -51
  859. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-message.d.ts +0 -21
  860. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-message.js +0 -86
  861. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/daxnuts.d.ts +0 -22
  862. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/daxnuts.js +0 -139
  863. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/diff.d.ts +0 -11
  864. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/diff.js +0 -132
  865. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/dynamic-border.d.ts +0 -14
  866. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/dynamic-border.js +0 -20
  867. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/earendil-announcement.d.ts +0 -4
  868. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/earendil-announcement.js +0 -39
  869. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-editor.d.ts +0 -23
  870. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-editor.js +0 -102
  871. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-input.d.ts +0 -24
  872. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-input.js +0 -66
  873. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-selector.d.ts +0 -26
  874. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-selector.js +0 -86
  875. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/first-time-setup.d.ts +0 -24
  876. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/first-time-setup.js +0 -102
  877. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/footer.d.ts +0 -31
  878. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/footer.js +0 -224
  879. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/index.d.ts +0 -33
  880. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/index.js +0 -34
  881. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/keybinding-hints.d.ts +0 -12
  882. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/keybinding-hints.js +0 -35
  883. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/login-dialog.d.ts +0 -51
  884. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/login-dialog.js +0 -187
  885. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/markdown-transform.d.ts +0 -2
  886. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/markdown-transform.js +0 -18
  887. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/mermaid.d.ts +0 -10
  888. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/mermaid.js +0 -74
  889. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/model-selector.d.ts +0 -59
  890. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/model-selector.js +0 -360
  891. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/oauth-selector.d.ts +0 -32
  892. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/oauth-selector.js +0 -162
  893. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/scoped-models-selector.d.ts +0 -45
  894. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/scoped-models-selector.js +0 -325
  895. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector-search.d.ts +0 -22
  896. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector-search.js +0 -154
  897. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector.d.ts +0 -94
  898. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector.js +0 -892
  899. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-selector.d.ts +0 -93
  900. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-selector.js +0 -719
  901. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-submenu.d.ts +0 -71
  902. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-submenu.js +0 -164
  903. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/show-images-selector.d.ts +0 -9
  904. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/show-images-selector.js +0 -38
  905. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/skill-invocation-message.d.ts +0 -16
  906. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/skill-invocation-message.js +0 -53
  907. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/status-indicator.d.ts +0 -29
  908. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/status-indicator.js +0 -66
  909. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/theme-selector.d.ts +0 -10
  910. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/theme-selector.js +0 -49
  911. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/thinking-selector.d.ts +0 -22
  912. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/thinking-selector.js +0 -108
  913. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tool-execution.d.ts +0 -79
  914. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tool-execution.js +0 -336
  915. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tree-selector.d.ts +0 -93
  916. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tree-selector.js +0 -1246
  917. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/trust-selector.d.ts +0 -22
  918. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/trust-selector.js +0 -90
  919. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message-selector.d.ts +0 -29
  920. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message-selector.js +0 -113
  921. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message.d.ts +0 -15
  922. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message.js +0 -48
  923. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/visual-truncate.d.ts +0 -23
  924. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/visual-truncate.js +0 -32
  925. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/external-editor.d.ts +0 -11
  926. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/external-editor.js +0 -37
  927. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/interactive-mode.d.ts +0 -467
  928. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/interactive-mode.js +0 -5720
  929. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-catalog-refresh.d.ts +0 -6
  930. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-catalog-refresh.js +0 -33
  931. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-search.d.ts +0 -11
  932. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-search.js +0 -14
  933. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/session-share.d.ts +0 -17
  934. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/session-share.js +0 -187
  935. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/dark.json +0 -91
  936. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/light.json +0 -90
  937. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-controller.d.ts +0 -40
  938. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-controller.js +0 -129
  939. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-json.d.ts +0 -83
  940. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-json.js +0 -129
  941. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-schema.json +0 -356
  942. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme.d.ts +0 -130
  943. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme.js +0 -990
  944. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/tui-renderer.d.ts +0 -20
  945. package/dist/vendor/engine/runtime/coding-agent/modes/interactive/tui-renderer.js +0 -65
  946. package/dist/vendor/engine/runtime/coding-agent/modes/json-event.d.ts +0 -33
  947. package/dist/vendor/engine/runtime/coding-agent/modes/json-event.js +0 -28
  948. package/dist/vendor/engine/runtime/coding-agent/modes/print-mode.d.ts +0 -27
  949. package/dist/vendor/engine/runtime/coding-agent/modes/print-mode.js +0 -141
  950. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/jsonl.d.ts +0 -16
  951. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/jsonl.js +0 -48
  952. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-client.d.ts +0 -253
  953. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-client.js +0 -494
  954. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-mode.d.ts +0 -19
  955. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-mode.js +0 -656
  956. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-types.d.ts +0 -468
  957. package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-types.js +0 -7
  958. package/dist/vendor/engine/runtime/coding-agent/package-manager-cli.d.ts +0 -8
  959. package/dist/vendor/engine/runtime/coding-agent/package-manager-cli.js +0 -960
  960. package/dist/vendor/engine/runtime/coding-agent/utils/abort.d.ts +0 -4
  961. package/dist/vendor/engine/runtime/coding-agent/utils/abort.js +0 -47
  962. package/dist/vendor/engine/runtime/coding-agent/utils/ansi.d.ts +0 -1
  963. package/dist/vendor/engine/runtime/coding-agent/utils/ansi.js +0 -51
  964. package/dist/vendor/engine/runtime/coding-agent/utils/changelog.d.ts +0 -21
  965. package/dist/vendor/engine/runtime/coding-agent/utils/changelog.js +0 -164
  966. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-command.d.ts +0 -6
  967. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-command.js +0 -44
  968. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-image.d.ts +0 -10
  969. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-image.js +0 -216
  970. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard.d.ts +0 -3
  971. package/dist/vendor/engine/runtime/coding-agent/utils/clipboard.js +0 -150
  972. package/dist/vendor/engine/runtime/coding-agent/utils/frontmatter.d.ts +0 -7
  973. package/dist/vendor/engine/runtime/coding-agent/utils/frontmatter.js +0 -26
  974. package/dist/vendor/engine/runtime/coding-agent/utils/fs-watch.d.ts +0 -4
  975. package/dist/vendor/engine/runtime/coding-agent/utils/fs-watch.js +0 -24
  976. package/dist/vendor/engine/runtime/coding-agent/utils/git.d.ts +0 -25
  977. package/dist/vendor/engine/runtime/coding-agent/utils/git.js +0 -194
  978. package/dist/vendor/engine/runtime/coding-agent/utils/html.d.ts +0 -6
  979. package/dist/vendor/engine/runtime/coding-agent/utils/html.js +0 -39
  980. package/dist/vendor/engine/runtime/coding-agent/utils/json.d.ts +0 -2
  981. package/dist/vendor/engine/runtime/coding-agent/utils/json.js +0 -6
  982. package/dist/vendor/engine/runtime/coding-agent/utils/open-browser.d.ts +0 -8
  983. package/dist/vendor/engine/runtime/coding-agent/utils/open-browser.js +0 -21
  984. package/dist/vendor/engine/runtime/coding-agent/utils/pi-user-agent.d.ts +0 -1
  985. package/dist/vendor/engine/runtime/coding-agent/utils/pi-user-agent.js +0 -4
  986. package/dist/vendor/engine/runtime/coding-agent/utils/sleep.d.ts +0 -4
  987. package/dist/vendor/engine/runtime/coding-agent/utils/sleep.js +0 -16
  988. package/dist/vendor/engine/runtime/coding-agent/utils/syntax-highlight.d.ts +0 -12
  989. package/dist/vendor/engine/runtime/coding-agent/utils/syntax-highlight.js +0 -176
  990. package/dist/vendor/engine/runtime/coding-agent/utils/tool-result-images.d.ts +0 -20
  991. package/dist/vendor/engine/runtime/coding-agent/utils/tool-result-images.js +0 -47
  992. package/dist/vendor/engine/runtime/coding-agent/utils/version-check.d.ts +0 -18
  993. package/dist/vendor/engine/runtime/coding-agent/utils/version-check.js +0 -78
  994. package/dist/vendor/engine/runtime/coding-agent/utils/windows-self-update.d.ts +0 -2
  995. package/dist/vendor/engine/runtime/coding-agent/utils/windows-self-update.js +0 -76
  996. package/dist/vendor/engine/runtime/coding-agent/utils/wsl.d.ts +0 -2
  997. package/dist/vendor/engine/runtime/coding-agent/utils/wsl.js +0 -14
  998. package/dist/vendor/engine/runtime/coding-agent/utils/zip.d.ts +0 -6
  999. package/dist/vendor/engine/runtime/coding-agent/utils/zip.js +0 -59
  1000. package/dist/vendor/engine/runtime/tui/alt-screen-search.d.ts +0 -45
  1001. package/dist/vendor/engine/runtime/tui/alt-screen-search.js +0 -281
  1002. package/dist/vendor/engine/runtime/tui/autocomplete.d.ts +0 -56
  1003. package/dist/vendor/engine/runtime/tui/autocomplete.js +0 -671
  1004. package/dist/vendor/engine/runtime/tui/components/alt-screen-flash.d.ts +0 -12
  1005. package/dist/vendor/engine/runtime/tui/components/alt-screen-flash.js +0 -36
  1006. package/dist/vendor/engine/runtime/tui/components/box.d.ts +0 -23
  1007. package/dist/vendor/engine/runtime/tui/components/box.js +0 -132
  1008. package/dist/vendor/engine/runtime/tui/components/cancellable-loader.d.ts +0 -21
  1009. package/dist/vendor/engine/runtime/tui/components/cancellable-loader.js +0 -34
  1010. package/dist/vendor/engine/runtime/tui/components/editor.d.ts +0 -259
  1011. package/dist/vendor/engine/runtime/tui/components/editor.js +0 -2041
  1012. package/dist/vendor/engine/runtime/tui/components/h-stack.d.ts +0 -6
  1013. package/dist/vendor/engine/runtime/tui/components/h-stack.js +0 -42
  1014. package/dist/vendor/engine/runtime/tui/components/image.d.ts +0 -27
  1015. package/dist/vendor/engine/runtime/tui/components/image.js +0 -89
  1016. package/dist/vendor/engine/runtime/tui/components/input.d.ts +0 -47
  1017. package/dist/vendor/engine/runtime/tui/components/input.js +0 -416
  1018. package/dist/vendor/engine/runtime/tui/components/loader.d.ts +0 -32
  1019. package/dist/vendor/engine/runtime/tui/components/loader.js +0 -75
  1020. package/dist/vendor/engine/runtime/tui/components/markdown.d.ts +0 -102
  1021. package/dist/vendor/engine/runtime/tui/components/markdown.js +0 -810
  1022. package/dist/vendor/engine/runtime/tui/components/mouse-region.d.ts +0 -11
  1023. package/dist/vendor/engine/runtime/tui/components/mouse-region.js +0 -20
  1024. package/dist/vendor/engine/runtime/tui/components/scroll-view.d.ts +0 -58
  1025. package/dist/vendor/engine/runtime/tui/components/scroll-view.js +0 -194
  1026. package/dist/vendor/engine/runtime/tui/components/select-list.d.ts +0 -52
  1027. package/dist/vendor/engine/runtime/tui/components/select-list.js +0 -205
  1028. package/dist/vendor/engine/runtime/tui/components/settings-list.d.ts +0 -59
  1029. package/dist/vendor/engine/runtime/tui/components/settings-list.js +0 -251
  1030. package/dist/vendor/engine/runtime/tui/components/spacer.d.ts +0 -11
  1031. package/dist/vendor/engine/runtime/tui/components/spacer.js +0 -22
  1032. package/dist/vendor/engine/runtime/tui/components/stack.d.ts +0 -31
  1033. package/dist/vendor/engine/runtime/tui/components/stack.js +0 -110
  1034. package/dist/vendor/engine/runtime/tui/components/text.d.ts +0 -18
  1035. package/dist/vendor/engine/runtime/tui/components/text.js +0 -89
  1036. package/dist/vendor/engine/runtime/tui/components/truncated-text.d.ts +0 -12
  1037. package/dist/vendor/engine/runtime/tui/components/truncated-text.js +0 -50
  1038. package/dist/vendor/engine/runtime/tui/components/v-stack.d.ts +0 -7
  1039. package/dist/vendor/engine/runtime/tui/components/v-stack.js +0 -25
  1040. package/dist/vendor/engine/runtime/tui/editor-component.d.ts +0 -38
  1041. package/dist/vendor/engine/runtime/tui/editor-component.js +0 -1
  1042. package/dist/vendor/engine/runtime/tui/fuzzy.d.ts +0 -15
  1043. package/dist/vendor/engine/runtime/tui/fuzzy.js +0 -110
  1044. package/dist/vendor/engine/runtime/tui/index.d.ts +0 -32
  1045. package/dist/vendor/engine/runtime/tui/index.js +0 -44
  1046. package/dist/vendor/engine/runtime/tui/keybindings.d.ts +0 -272
  1047. package/dist/vendor/engine/runtime/tui/keybindings.js +0 -232
  1048. package/dist/vendor/engine/runtime/tui/keys.d.ts +0 -183
  1049. package/dist/vendor/engine/runtime/tui/keys.js +0 -1173
  1050. package/dist/vendor/engine/runtime/tui/kill-ring.d.ts +0 -27
  1051. package/dist/vendor/engine/runtime/tui/kill-ring.js +0 -43
  1052. package/dist/vendor/engine/runtime/tui/latex.d.ts +0 -9
  1053. package/dist/vendor/engine/runtime/tui/latex.js +0 -1377
  1054. package/dist/vendor/engine/runtime/tui/layout-node.d.ts +0 -39
  1055. package/dist/vendor/engine/runtime/tui/layout-node.js +0 -5
  1056. package/dist/vendor/engine/runtime/tui/layout.d.ts +0 -41
  1057. package/dist/vendor/engine/runtime/tui/layout.js +0 -343
  1058. package/dist/vendor/engine/runtime/tui/native-modifiers.d.ts +0 -3
  1059. package/dist/vendor/engine/runtime/tui/native-modifiers.js +0 -12
  1060. package/dist/vendor/engine/runtime/tui/native-module-path.d.ts +0 -6
  1061. package/dist/vendor/engine/runtime/tui/native-module-path.js +0 -18
  1062. package/dist/vendor/engine/runtime/tui/native-platform.d.ts +0 -17
  1063. package/dist/vendor/engine/runtime/tui/native-platform.js +0 -41
  1064. package/dist/vendor/engine/runtime/tui/stdin-buffer.d.ts +0 -55
  1065. package/dist/vendor/engine/runtime/tui/stdin-buffer.js +0 -365
  1066. package/dist/vendor/engine/runtime/tui/terminal-colors.d.ts +0 -9
  1067. package/dist/vendor/engine/runtime/tui/terminal-colors.js +0 -58
  1068. package/dist/vendor/engine/runtime/tui/terminal-image.d.ts +0 -117
  1069. package/dist/vendor/engine/runtime/tui/terminal-image.js +0 -549
  1070. package/dist/vendor/engine/runtime/tui/terminal.d.ts +0 -122
  1071. package/dist/vendor/engine/runtime/tui/terminal.js +0 -441
  1072. package/dist/vendor/engine/runtime/tui/tui-alt-screen.d.ts +0 -159
  1073. package/dist/vendor/engine/runtime/tui/tui-alt-screen.js +0 -1507
  1074. package/dist/vendor/engine/runtime/tui/tui-main-screen.d.ts +0 -38
  1075. package/dist/vendor/engine/runtime/tui/tui-main-screen.js +0 -593
  1076. package/dist/vendor/engine/runtime/tui/tui.d.ts +0 -385
  1077. package/dist/vendor/engine/runtime/tui/tui.js +0 -1054
  1078. package/dist/vendor/engine/runtime/tui/undo-stack.d.ts +0 -16
  1079. package/dist/vendor/engine/runtime/tui/undo-stack.js +0 -24
  1080. package/dist/vendor/engine/runtime/tui/utils.d.ts +0 -100
  1081. package/dist/vendor/engine/runtime/tui/utils.js +0 -1203
  1082. package/dist/vendor/engine/runtime/tui/word-navigation.d.ts +0 -24
  1083. package/dist/vendor/engine/runtime/tui/word-navigation.js +0 -95
  1084. package/tests/graphiti-test-plan.md +0 -359
  1085. package/tests/mock-graphiti.mjs +0 -106
  1086. /package/dist/vendor/engine/runtime/{agent/harness/tools/tool-context.js → coding-agent/core/tools/tool-definition.js} +0 -0
@@ -1,1903 +0,0 @@
1
- // ─── Classification ──────────────────────────────────────────────────────────
2
- export const andorraIsReplace = (op) => op[0] === "r";
3
- /**
4
- * A batch begins with a replacement. Flush guarantees `r` is at index 0 or absent,
5
- * so this is exact rather than a heuristic.
6
- */
7
- export const andorraIsBase = (ops) => ops.length > 0 && ops[0][0] === "r";
8
- // ─── Overlap ─────────────────────────────────────────────────────────────────
9
- /**
10
- * Longest suffix of `a` that is a prefix of `b`. Probes with indexOf and verifies
11
- * exact substring equality, so the hot loops are native. A hand-written KMP is
12
- * asymptotically equivalent and much slower in practice.
13
- *
14
- * Always correct: the returned n satisfies a.slice(a.length - n) === b.slice(0, n).
15
- */
16
- export function andorraOverlap(a, b, scan, probe = 64, maxCandidates = 8) {
17
- if (a.length === 0 || b.length === 0 || scan === 0)
18
- return 0;
19
- const tail = a.length > scan ? a.slice(a.length - scan) : a;
20
- // A probe of length h can only find overlaps of at least h — the head must
21
- // actually occur in `a`. So try a long head first (few candidates, and it
22
- // catches the large overlaps a rolling window produces), then fall back to one
23
- // character, which finds any overlap at the cost of more candidates.
24
- //
25
- // Candidates are bounded because repetitive output — a build log, or any run of
26
- // one character — makes a long head match at thousands of positions. Giving up
27
- // returns 0, which emits a set: larger, never wrong.
28
- for (const h of [Math.min(probe, b.length), 1]) {
29
- const head = b.slice(0, h);
30
- let tried = 0;
31
- for (let k = tail.indexOf(head); k !== -1; k = tail.indexOf(head, k + 1)) {
32
- if (++tried > maxCandidates)
33
- break;
34
- const n = tail.length - k;
35
- if (n <= b.length && tail.slice(k) === b.slice(0, n))
36
- return n;
37
- }
38
- if (h === 1)
39
- break;
40
- }
41
- return 0;
42
- }
43
- const andorraIsObj = (value) => value !== null && typeof value === "object";
44
- const andorraCloneJson = (value) => {
45
- if (!andorraIsObj(value))
46
- return value;
47
- if (Array.isArray(value))
48
- return value.map((item) => andorraCloneJson(item));
49
- // Spread preserves compact object layouts instead of reserving extra slots
50
- // while growing an empty object. Both branches create own writable properties.
51
- const result = (Object.getPrototypeOf(value) === null ? Object.assign(Object.create(null), value) : { ...value });
52
- for (const key of Object.keys(result)) {
53
- const child = result[key];
54
- if (andorraIsObj(child))
55
- result[key] = andorraCloneJson(child);
56
- }
57
- return result;
58
- };
59
- const INDEX = /^(?:0|[1-9]\d*)$/;
60
- const andorraNorm = (target, key) => typeof key === "symbol" ? key : Array.isArray(target) && INDEX.test(key) ? Number(key) : key;
61
- const MUTATORS = new Set(["push", "pop", "shift", "unshift", "splice", "sort", "reverse", "fill", "copyWithin"]);
62
- const MISSING = Symbol("missing");
63
- const andorraSpliceItems = (target, index, remove, items) => {
64
- const removed = Reflect.apply(Array.prototype.splice, target, [index, remove]);
65
- const chunkSize = 10_000;
66
- for (let offset = 0; offset < items.length; offset += chunkSize) {
67
- Reflect.apply(Array.prototype.splice, target, [index + offset, 0, ...items.slice(offset, offset + chunkSize)]);
68
- }
69
- return removed;
70
- };
71
- const andorraJsonEqual = (left, right) => {
72
- if (left === right)
73
- return true;
74
- if (!andorraIsObj(left) || !andorraIsObj(right) || Array.isArray(left) !== Array.isArray(right))
75
- return false;
76
- if (Array.isArray(left) && Array.isArray(right)) {
77
- if (left.length !== right.length)
78
- return false;
79
- for (let index = 0; index < left.length; index++) {
80
- if (!andorraJsonEqual(left[index], right[index]))
81
- return false;
82
- }
83
- return true;
84
- }
85
- const leftObject = left;
86
- const rightObject = right;
87
- const leftKeys = Object.keys(leftObject);
88
- const rightKeys = Object.keys(rightObject);
89
- if (leftKeys.length !== rightKeys.length)
90
- return false;
91
- for (const key of leftKeys) {
92
- if (!Object.hasOwn(rightObject, key) || !andorraJsonEqual(leftObject[key], rightObject[key]))
93
- return false;
94
- }
95
- return true;
96
- };
97
- const andorraEmitSet = (path, value, out) => {
98
- const snapshot = andorraCloneJson(value);
99
- if (path.length === 0)
100
- out.push(["r", snapshot]);
101
- else
102
- out.push(["s", [...path], snapshot]);
103
- };
104
- const andorraEmitDelete = (path, out) => {
105
- if (path.length === 0)
106
- throw new TypeError("the tracked root cannot be deleted");
107
- out.push(["d", [...path]]);
108
- };
109
- const andorraDiffString = (before, after, path, scan, out) => {
110
- if (before === after)
111
- return;
112
- if (path.length === 0) {
113
- andorraEmitSet(path, after, out);
114
- return;
115
- }
116
- const at = [...path];
117
- // NOT `after.startsWith(before)`. `after` is usually a cons string — the
118
- // producer just did `s += chunk` — and V8's startsWith walks a cons char by
119
- // char. `slice(...) === before` flattens once and compares with memcmp.
120
- // Measured on a 200 KB string growing by 8 bytes per flush: 845 us -> 42 us.
121
- if (after.length > before.length && after.slice(0, before.length) === before) {
122
- out.push(["a", at, after.slice(before.length)]);
123
- return;
124
- }
125
- const shared = andorraOverlap(before, after, scan);
126
- if (shared === 0) {
127
- out.push(["s", at, after]);
128
- return;
129
- }
130
- out.push(["t", at, before.length - shared]);
131
- if (after.length > shared)
132
- out.push(["a", at, after.slice(shared)]);
133
- };
134
- const andorraDiffValue = (before, after, path, scan, out) => {
135
- if (before === MISSING) {
136
- if (after !== MISSING)
137
- andorraEmitSet(path, after, out);
138
- return;
139
- }
140
- if (after === MISSING) {
141
- andorraEmitDelete(path, out);
142
- return;
143
- }
144
- if (before === after)
145
- return;
146
- if (typeof before === "string" && typeof after === "string") {
147
- andorraDiffString(before, after, path, scan, out);
148
- return;
149
- }
150
- if (Array.isArray(before) && Array.isArray(after)) {
151
- andorraDiffArray(before, after, path, scan, out);
152
- return;
153
- }
154
- if (andorraIsObj(before) && andorraIsObj(after) && !Array.isArray(before) && !Array.isArray(after)) {
155
- andorraDiffObject(before, after, path, scan, out);
156
- return;
157
- }
158
- andorraEmitSet(path, after, out);
159
- };
160
- function andorraDiffObject(before, after, path, scan, out) {
161
- if ([...Object.keys(before), ...Object.keys(after)].some((key) => RESERVED_SEGMENTS.has(key))) {
162
- andorraEmitSet(path, after, out);
163
- return;
164
- }
165
- for (const key of Object.keys(after)) {
166
- andorraDiffValue(Object.hasOwn(before, key) ? before[key] : MISSING, after[key], [...path, key], scan, out);
167
- }
168
- for (const key of Object.keys(before)) {
169
- if (!Object.hasOwn(after, key))
170
- andorraEmitDelete([...path, key], out);
171
- }
172
- }
173
- function andorraDiffArray(before, after, path, scan, out) {
174
- if (before.length === after.length) {
175
- for (let index = 0; index < after.length; index++) {
176
- andorraDiffValue(before[index], after[index], [...path, index], scan, out);
177
- }
178
- return;
179
- }
180
- let prefix = 0;
181
- while (prefix < before.length && prefix < after.length && andorraJsonEqual(before[prefix], after[prefix]))
182
- prefix++;
183
- let suffix = 0;
184
- while (suffix < before.length - prefix &&
185
- suffix < after.length - prefix &&
186
- andorraJsonEqual(before[before.length - 1 - suffix], after[after.length - 1 - suffix])) {
187
- suffix++;
188
- }
189
- const shorter = Math.min(before.length, after.length);
190
- if (prefix + suffix === shorter) {
191
- const remove = before.length - prefix - suffix;
192
- const items = after.slice(prefix, after.length - suffix);
193
- if (prefix === 0 && remove === before.length)
194
- andorraEmitSet(path, after, out);
195
- else
196
- out.push(["p", [...path], prefix, remove, andorraCloneJson(items)]);
197
- return;
198
- }
199
- // Structural movement combined with retained-index edits has no unique
200
- // alignment. Preserve the retained index deltas and express only the tail
201
- // length change structurally. It may be broader than the producer's intent,
202
- // but never degrades those edits to a whole-array replacement.
203
- for (let index = 0; index < shorter; index++) {
204
- andorraDiffValue(before[index], after[index], [...path, index], scan, out);
205
- }
206
- if (after.length > before.length) {
207
- out.push(["p", [...path], before.length, 0, andorraCloneJson(after.slice(before.length))]);
208
- }
209
- else if (before.length > after.length) {
210
- if (after.length === 0)
211
- andorraEmitSet(path, after, out);
212
- else
213
- out.push(["p", [...path], after.length, before.length - after.length, []]);
214
- }
215
- }
216
- export function andorraTrack(root, options = {}) {
217
- const scan = options.maxOverlapScan ?? 65_536;
218
- let log = [];
219
- let trie = {};
220
- let nextOrder = 0;
221
- let tombstones = 0;
222
- let liveSlots = 0;
223
- let nodeCount = 1;
224
- let lastAddedSlot;
225
- let hasPending = false;
226
- let forceBase = true;
227
- const andorraClearPending = () => {
228
- log = [];
229
- trie = {};
230
- nextOrder = 0;
231
- tombstones = 0;
232
- liveSlots = 0;
233
- nodeCount = 1;
234
- lastAddedSlot = undefined;
235
- hasPending = false;
236
- };
237
- const andorraLogNode = (path) => {
238
- let at = trie;
239
- for (const segment of path) {
240
- if (!at.kids)
241
- at.kids = new Map();
242
- let next = at.kids.get(segment);
243
- if (next === undefined) {
244
- next = {};
245
- at.kids.set(segment, next);
246
- nodeCount++;
247
- }
248
- at = next;
249
- }
250
- return at;
251
- };
252
- const andorraFindLogNode = (path) => {
253
- let at = trie;
254
- for (const segment of path) {
255
- const next = at.kids?.get(segment);
256
- if (next === undefined)
257
- return undefined;
258
- at = next;
259
- }
260
- return at;
261
- };
262
- const andorraCompactLog = () => {
263
- if (tombstones < 1_024 || tombstones * 2 < log.length)
264
- return;
265
- const compacted = [];
266
- for (const slot of log) {
267
- if (slot === undefined)
268
- continue;
269
- slot.index = compacted.length;
270
- compacted.push(slot);
271
- }
272
- log = compacted;
273
- tombstones = 0;
274
- };
275
- const andorraKillSlot = (slot) => {
276
- if (slot.dead)
277
- return;
278
- slot.dead = true;
279
- liveSlots--;
280
- if (log[slot.index] === slot) {
281
- log[slot.index] = undefined;
282
- tombstones++;
283
- }
284
- };
285
- const andorraLiveSlot = (at) => {
286
- const slots = at.slots;
287
- if (slots === undefined)
288
- return undefined;
289
- while (slots.length > 0 && slots[slots.length - 1].dead)
290
- slots.pop();
291
- if (slots.length === 0) {
292
- at.slots = undefined;
293
- return undefined;
294
- }
295
- return slots[slots.length - 1];
296
- };
297
- const andorraKillHere = (at) => {
298
- if (at.slots === undefined)
299
- return;
300
- for (const slot of at.slots)
301
- andorraKillSlot(slot);
302
- at.slots = undefined;
303
- };
304
- const andorraAddSlot = (at, slot) => {
305
- andorraCompactLog();
306
- slot.order = nextOrder++;
307
- slot.index = log.length;
308
- at.lastOrder = slot.order;
309
- if (at.slots === undefined)
310
- at.slots = [];
311
- at.slots.push(slot);
312
- log.push(slot);
313
- liveSlots++;
314
- lastAddedSlot = slot;
315
- };
316
- const andorraCollapsePending = () => {
317
- // Long mutation windows can otherwise retain operations and retired path
318
- // generations indefinitely. Fall back to a complete snapshot once either
319
- // history exceeds a bounded coalescing window. Payload bytes and transient
320
- // allocation remain workload-dependent.
321
- if (forceBase || (liveSlots <= 4_096 && nodeCount <= 4_096))
322
- return;
323
- const value = andorraCloneJson(root);
324
- andorraClearPending();
325
- hasPending = true;
326
- andorraAddSlot(trie, { op: ["r", value], dead: false, order: 0, index: 0 });
327
- };
328
- const andorraKillSubtree = (at) => {
329
- andorraKillHere(at);
330
- if (at.kids !== undefined) {
331
- for (const child of at.kids.values())
332
- andorraKillSubtree(child);
333
- at.kids = undefined;
334
- }
335
- if (at.retiredKids !== undefined) {
336
- for (const generation of at.retiredKids) {
337
- for (const child of generation.values())
338
- andorraKillSubtree(child);
339
- }
340
- at.retiredKids = undefined;
341
- }
342
- };
343
- const andorraRetireKids = (at) => {
344
- if (at.kids === undefined)
345
- return;
346
- if (at.retiredKids === undefined)
347
- at.retiredKids = [];
348
- at.retiredKids.push(at.kids);
349
- at.kids = undefined;
350
- };
351
- // Deepest live ancestor op carrying a payload we can fold a later write into.
352
- // `s`/`r` carry the whole subtree; `p` carries the items it inserted, so a
353
- // write to one of those indices belongs inside the payload rather than after it.
354
- const andorraFoldTarget = (path) => {
355
- let at = trie;
356
- let found;
357
- let ancestorMax = -1;
358
- for (let depth = 0; depth < path.length; depth++) {
359
- if (found !== undefined && at.lastOrder !== undefined && at.lastOrder > found.slot.order) {
360
- found = undefined;
361
- }
362
- const slot = andorraLiveSlot(at);
363
- // A fold is sound only if nothing has been recorded at this path or above it
364
- // since: a later op there (a splice on the same array, a replacement of an
365
- // ancestor) would have to apply after this write, not before it. Writes to
366
- // other branches are irrelevant, which is why this is not "the most recent op".
367
- if (slot !== undefined && slot.order >= ancestorMax && at.lastOrder === slot.order) {
368
- if (slot.op[0] === "s" || slot.op[0] === "r")
369
- found = { slot, depth };
370
- else if (slot.op[0] === "p") {
371
- const index = path[depth];
372
- const items = slot.op[4];
373
- if (typeof index === "number" && index >= slot.op[2] && index < slot.op[2] + items.length) {
374
- found = { slot, depth: depth + 1, item: index - slot.op[2] };
375
- }
376
- }
377
- }
378
- if (at.lastOrder !== undefined && at.lastOrder > ancestorMax)
379
- ancestorMax = at.lastOrder;
380
- const next = at.kids?.get(path[depth]);
381
- if (next === undefined)
382
- break;
383
- at = next;
384
- }
385
- if (found === undefined)
386
- return undefined;
387
- return { slot: found.slot, rest: path.slice(found.depth), item: found.item };
388
- };
389
- const andorraFoldInto = (container, rest, op) => {
390
- if (rest.length === 0)
391
- return false;
392
- let target = container;
393
- for (let index = 0; index < rest.length - 1; index++) {
394
- if (!andorraIsObj(target))
395
- return false;
396
- target = target[rest[index]];
397
- }
398
- if (!andorraIsObj(target))
399
- return false;
400
- const key = rest[rest.length - 1];
401
- const holder = target;
402
- const andorraWrite = (value) => {
403
- Object.defineProperty(holder, key, { value, writable: true, enumerable: true, configurable: true });
404
- };
405
- switch (op[0]) {
406
- case "s":
407
- if (key === "__proto__")
408
- return false;
409
- andorraWrite(andorraCloneJson(op[2]));
410
- return true;
411
- case "d":
412
- delete holder[key];
413
- return true;
414
- case "a": {
415
- const value = holder[key];
416
- if (typeof value !== "string")
417
- return false;
418
- andorraWrite(value + op[2]);
419
- return true;
420
- }
421
- case "t": {
422
- const value = holder[key];
423
- if (typeof value !== "string")
424
- return false;
425
- andorraWrite(value.slice(op[2]));
426
- return true;
427
- }
428
- case "p": {
429
- const value = holder[key];
430
- if (!Array.isArray(value))
431
- return false;
432
- andorraSpliceItems(value, op[2], op[3], andorraCloneJson(op[4]));
433
- return true;
434
- }
435
- default:
436
- return false;
437
- }
438
- };
439
- const andorraRecordString = (path, previous, value) => {
440
- if (forceBase)
441
- return;
442
- hasPending = true;
443
- // a string inside a pending payload belongs in that payload, as for any write
444
- const fold = andorraFoldTarget(path);
445
- if (fold !== undefined) {
446
- const op = ["s", path, value];
447
- if (fold.item !== undefined) {
448
- const items = fold.slot.op[4];
449
- if (fold.rest.length === 0) {
450
- items[fold.item] = value;
451
- return;
452
- }
453
- if (andorraFoldInto(items[fold.item], fold.rest, op))
454
- return;
455
- }
456
- else {
457
- const payload = fold.slot.op[0] === "r" ? fold.slot.op[1] : fold.slot.op[2];
458
- if (andorraFoldInto(payload, fold.rest, op))
459
- return;
460
- }
461
- }
462
- const at = andorraLogNode(path);
463
- const live = andorraLiveSlot(at);
464
- if (live?.str !== undefined) {
465
- live.str.value = value;
466
- return;
467
- }
468
- if (live !== undefined) {
469
- // a pending set or delete at this path already replaced the value; keep that
470
- // op and carry the new value in it rather than anchoring to it
471
- if (live.op[0] === "s" || live.op[0] === "r") {
472
- live.op = live.op[0] === "r" ? ["r", value] : ["s", live.op[1], value];
473
- return;
474
- }
475
- if (live.op[0] === "d") {
476
- andorraKillHere(at);
477
- andorraAddSlot(at, {
478
- op: ["s", path, value],
479
- dead: false,
480
- order: 0,
481
- index: 0,
482
- });
483
- return;
484
- }
485
- // a truncate/append pair from an earlier string diff: both must go
486
- andorraKillHere(at);
487
- }
488
- andorraKillSubtree(at);
489
- andorraAddSlot(at, {
490
- op: ["s", path, value],
491
- dead: false,
492
- order: 0,
493
- index: 0,
494
- str: { anchor: previous, value },
495
- });
496
- };
497
- const andorraRecord = (op) => {
498
- if (forceBase)
499
- return;
500
- hasPending = true;
501
- const path = (op[0] === "r" ? [] : op[1]);
502
- const existing = andorraFindLogNode(path);
503
- const anchored = existing === undefined ? undefined : andorraLiveSlot(existing);
504
- if (anchored?.str !== undefined) {
505
- switch (op[0]) {
506
- case "a":
507
- anchored.str.value += op[2];
508
- return;
509
- case "t":
510
- anchored.str.value = anchored.str.value.slice(op[2]);
511
- return;
512
- case "s":
513
- if (typeof op[2] === "string") {
514
- anchored.str.value = op[2];
515
- return;
516
- }
517
- }
518
- if (existing !== undefined)
519
- andorraKillSubtree(existing);
520
- }
521
- else if (existing !== undefined && (op[0] === "s" || op[0] === "d" || op[0] === "r")) {
522
- // A replacement absorbed into an ancestor payload must still invalidate
523
- // operations already recorded at and below its destination.
524
- andorraKillSubtree(existing);
525
- }
526
- if (path.length > 0) {
527
- const fold = andorraFoldTarget(path);
528
- if (fold !== undefined) {
529
- if (fold.item !== undefined) {
530
- const items = fold.slot.op[4];
531
- if (fold.rest.length === 0) {
532
- if (op[0] === "s") {
533
- items[fold.item] = andorraCloneJson(op[2]);
534
- return;
535
- }
536
- }
537
- else if (andorraFoldInto(items[fold.item], fold.rest, op))
538
- return;
539
- }
540
- else {
541
- const payload = fold.slot.op[0] === "r" ? fold.slot.op[1] : fold.slot.op[2];
542
- if (andorraFoldInto(payload, fold.rest, op))
543
- return;
544
- }
545
- }
546
- }
547
- const at = andorraLogNode(path);
548
- const live = andorraLiveSlot(at);
549
- if (live !== undefined) {
550
- const previous = live.op;
551
- if (op[0] === "a" && previous[0] === "a") {
552
- live.op = ["a", previous[1], previous[2] + op[2]];
553
- return;
554
- }
555
- if (op[0] === "a" && (previous[0] === "s" || previous[0] === "r")) {
556
- const value = previous[0] === "r" ? previous[1] : previous[2];
557
- if (typeof value === "string") {
558
- live.op = previous[0] === "r" ? ["r", value + op[2]] : ["s", previous[1], value + op[2]];
559
- return;
560
- }
561
- }
562
- if (op[0] === "t" && (previous[0] === "s" || previous[0] === "r")) {
563
- const value = previous[0] === "r" ? previous[1] : previous[2];
564
- if (typeof value === "string") {
565
- const cut = value.slice(op[2]);
566
- live.op = previous[0] === "r" ? ["r", cut] : ["s", previous[1], cut];
567
- return;
568
- }
569
- }
570
- if (op[0] === "p" && previous[0] === "p") {
571
- const previousItems = previous[4];
572
- // These rewrites are sound only for adjacent recorded operations. A
573
- // tombstoned operation remains a barrier through lastAddedSlot.
574
- if (previous[3] === 0 &&
575
- op[3] === 0 &&
576
- previous[2] + previousItems.length === op[2] &&
577
- lastAddedSlot === live) {
578
- const items = op[4];
579
- for (let index = 0; index < items.length; index++)
580
- previousItems.push(items[index]);
581
- return;
582
- }
583
- if (previous[3] === 0 &&
584
- lastAddedSlot === live &&
585
- op[2] >= previous[2] &&
586
- op[2] + op[3] <= previous[2] + previousItems.length) {
587
- andorraSpliceItems(previousItems, op[2] - previous[2], op[3], op[4]);
588
- if (previousItems.length === 0 && previous[3] === 0)
589
- andorraKillSlot(live);
590
- return;
591
- }
592
- if (op[3] > 0 &&
593
- op[4].length === 0 &&
594
- previousItems.length > 0 &&
595
- lastAddedSlot === live) {
596
- const from = op[2] - previous[2];
597
- if (from >= 0 && from + op[3] === previousItems.length) {
598
- previousItems.length = from;
599
- if (previousItems.length === 0 && previous[3] === 0)
600
- andorraKillSlot(live);
601
- return;
602
- }
603
- }
604
- }
605
- if (op[0] === "s" || op[0] === "d" || op[0] === "r")
606
- andorraKillHere(at);
607
- }
608
- if (op[0] === "s" || op[0] === "r" || op[0] === "d") {
609
- // Replacements dominate all earlier descendants, including generations
610
- // detached by array splices.
611
- andorraKillSubtree(at);
612
- }
613
- else if (op[0] === "p") {
614
- // Splices preserve earlier writes but form a barrier for later folding.
615
- andorraRetireKids(at);
616
- }
617
- andorraAddSlot(at, { op, dead: false, order: 0, index: 0 });
618
- };
619
- // Local diff, used when a whole container is assigned: keeps op quality
620
- // without a baseline by comparing the outgoing value with the incoming one at
621
- // the moment of the write. String leaves go through recordString so every
622
- // string path keeps a single anchored slot; otherwise a later write to the
623
- // same string would have to supersede ops whose starting value it no longer
624
- // knows.
625
- const andorraDiffInto = (before, after, at) => {
626
- if (forceBase)
627
- return;
628
- hasPending = true;
629
- if (before === after)
630
- return;
631
- if (typeof before === "string" && typeof after === "string") {
632
- andorraRecordString(at.slice(), before, after);
633
- return;
634
- }
635
- if (Array.isArray(before) && Array.isArray(after) && before.length === after.length) {
636
- for (let index = 0; index < after.length; index++) {
637
- at.push(index);
638
- andorraDiffInto(before[index], after[index], at);
639
- at.pop();
640
- }
641
- return;
642
- }
643
- if (andorraIsObj(before) && andorraIsObj(after) && !Array.isArray(before) && !Array.isArray(after)) {
644
- const beforeObject = before;
645
- const afterObject = after;
646
- const beforeKeys = Object.keys(beforeObject);
647
- const afterKeys = Object.keys(afterObject);
648
- if ([...beforeKeys, ...afterKeys].some((key) => RESERVED_SEGMENTS.has(key))) {
649
- andorraRecord(["s", at.slice(), andorraCloneJson(after)]);
650
- return;
651
- }
652
- for (const key of afterKeys) {
653
- at.push(key);
654
- if (Object.hasOwn(beforeObject, key))
655
- andorraDiffInto(beforeObject[key], afterObject[key], at);
656
- else
657
- andorraRecord(["s", at.slice(), andorraCloneJson(afterObject[key])]);
658
- at.pop();
659
- }
660
- for (const key of beforeKeys) {
661
- if (!Object.hasOwn(afterObject, key))
662
- andorraRecord(["d", [...at, key]]);
663
- }
664
- return;
665
- }
666
- // arrays of differing length, and everything else: chord's own diff
667
- const out = [];
668
- andorraDiffValue(before, after, at, scan, out);
669
- for (const op of out)
670
- andorraRecord(op);
671
- };
672
- const andorraGuard = (segment) => {
673
- if (typeof segment === "symbol")
674
- throw new AndorraUnsafePathError(String(segment));
675
- if (typeof segment === "string" && RESERVED_SEGMENTS.has(segment))
676
- throw new AndorraUnsafePathError(segment);
677
- return segment;
678
- };
679
- const andorraInteger = (value) => {
680
- const number = Number(value);
681
- if (Number.isNaN(number) || number === 0)
682
- return 0;
683
- return Number.isFinite(number) ? Math.trunc(number) : number;
684
- };
685
- const andorraSpliceRange = (length, args) => {
686
- const rawStart = args.length === 0 ? 0 : andorraInteger(args[0]);
687
- const index = rawStart < 0 ? Math.max(0, length + rawStart) : Math.min(rawStart, length);
688
- const remove = args.length === 0
689
- ? 0
690
- : args.length === 1
691
- ? length - index
692
- : Math.max(0, Math.min(andorraInteger(args[1]), length - index));
693
- return { index, remove };
694
- };
695
- // Paths are walked from placement cells rather than baked into proxies. A held
696
- // descendant keeps its cells and their owner entries alive, so an ancestor can
697
- // be re-created after GC without losing array-renumbering metadata. Entries keep
698
- // only weak references to public proxies; parent caches keep only weak cells.
699
- let shape = 0;
700
- // Ordinary tree entries are weak values. Explicit aliases are sparse and stay
701
- // strong while their raw weak key is alive so alias locations survive a period
702
- // in which no public proxy exists.
703
- const entries = new WeakMap();
704
- const aliases = new WeakMap();
705
- // A live public proxy retains its entry through this ephemeron. Raw proxy RHS
706
- // values can therefore be unwrapped before they are written into plain targets.
707
- const proxyEntries = new WeakMap();
708
- // WeakRef targets already stay alive through the current JavaScript job. These
709
- // strong job-local caches avoid repeated deref bookkeeping without extending
710
- // that lifetime; one microtask drops both maps before the next job.
711
- let jobCells = new WeakMap();
712
- let jobProxies = new WeakMap();
713
- let jobCleanupScheduled = false;
714
- const andorraScheduleJobCleanup = () => {
715
- if (jobCleanupScheduled)
716
- return;
717
- jobCleanupScheduled = true;
718
- queueMicrotask(() => {
719
- jobCells = new WeakMap();
720
- jobProxies = new WeakMap();
721
- jobCleanupScheduled = false;
722
- });
723
- };
724
- const andorraKeepCellForJob = (ref, cell) => {
725
- jobCells.set(ref, cell);
726
- andorraScheduleJobCleanup();
727
- };
728
- const andorraDerefCell = (ref) => {
729
- const cached = jobCells.get(ref);
730
- if (cached !== undefined)
731
- return cached;
732
- const cell = ref.deref();
733
- if (cell !== undefined)
734
- andorraKeepCellForJob(ref, cell);
735
- return cell;
736
- };
737
- const entryFinalizer = new FinalizationRegistry(({ target, token }) => {
738
- const raw = target.deref();
739
- if (raw !== undefined && entries.get(raw)?.token === token)
740
- entries.delete(raw);
741
- });
742
- const cellFinalizer = new FinalizationRegistry(({ owner, key, ref }) => {
743
- const entry = owner.deref();
744
- if (entry === undefined)
745
- return;
746
- if (key !== undefined && entry.childProxies?.get(key) === ref)
747
- entry.childProxies.delete(key);
748
- entry.childCells?.delete(ref);
749
- });
750
- // Almost no document ever puts one object at two positions. Until one does,
751
- // every write has exactly one path, so the per-write cell walk is skipped.
752
- let aliased = false;
753
- const andorraIsDetached = (cell) => {
754
- for (let c = cell; c !== undefined; c = c.parent)
755
- if (c.dead)
756
- return true;
757
- return false;
758
- };
759
- const andorraPathOf = (cell) => {
760
- if (cell.at === shape && cell.cached !== undefined)
761
- return cell.cached;
762
- const out = [];
763
- for (let c = cell; c !== undefined && c.parent !== undefined; c = c.parent)
764
- out.push(c.seg);
765
- out.reverse();
766
- cell.at = shape;
767
- cell.cached = out;
768
- return out;
769
- };
770
- const andorraLiveCells = (entry) => {
771
- const out = [];
772
- for (const cell of entry.cells)
773
- if (!andorraIsDetached(cell))
774
- out.push(cell);
775
- return out;
776
- };
777
- const andorraPrimary = (entry) => (aliased ? (andorraLiveCells(entry)[0] ?? entry.fallback) : entry.fallback);
778
- const andorraPathNow = (entry) => andorraPathOf(andorraPrimary(entry));
779
- const andorraFindEntry = (target) => {
780
- const alias = aliases.get(target);
781
- if (alias !== undefined)
782
- return alias;
783
- const slot = entries.get(target);
784
- const entry = slot?.ref.deref();
785
- if (slot !== undefined && entry === undefined)
786
- entries.delete(target);
787
- return entry;
788
- };
789
- const andorraIndexEntry = (entry) => {
790
- const token = {};
791
- entries.set(entry.target, { ref: new WeakRef(entry), token });
792
- entryFinalizer.register(entry, { target: new WeakRef(entry.target), token });
793
- };
794
- const andorraAddPlacement = (entry, cell) => {
795
- if (entry.cells.has(cell))
796
- return;
797
- let hasLive = false;
798
- for (const existing of entry.cells) {
799
- if (!andorraIsDetached(existing)) {
800
- hasLive = true;
801
- break;
802
- }
803
- }
804
- cell.entry = entry;
805
- cell.target = entry.target;
806
- entry.cells.add(cell);
807
- if (!hasLive) {
808
- const previous = entry.fallback;
809
- entry.fallback = cell;
810
- if (previous !== cell) {
811
- shape++;
812
- // Reattaching a held container moves every known immediate child to
813
- // its new placement. Array registrations survive cache clears.
814
- const children = new Set();
815
- for (const ref of entry.childProxies?.values() ?? []) {
816
- const child = andorraDerefCell(ref);
817
- if (child !== undefined)
818
- children.add(child);
819
- }
820
- for (const ref of entry.childCells ?? []) {
821
- const child = andorraDerefCell(ref);
822
- if (child !== undefined)
823
- children.add(child);
824
- }
825
- for (const child of children) {
826
- if (!child.dead && child.parent === previous)
827
- child.parent = cell;
828
- }
829
- }
830
- }
831
- else if (entry.blocked === undefined) {
832
- aliased = true;
833
- aliases.set(entry.target, entry);
834
- }
835
- };
836
- const andorraCachePlacement = (owner, key, cell) => {
837
- let cleanup = cell.cleanup;
838
- if (cleanup === undefined) {
839
- cleanup = { owner: new WeakRef(owner), key: undefined, ref: new WeakRef(cell) };
840
- cell.cleanup = cleanup;
841
- cellFinalizer.register(cell, cleanup);
842
- }
843
- andorraKeepCellForJob(cleanup.ref, cell);
844
- if (cleanup.key !== undefined && cleanup.key !== key && owner.childProxies?.get(cleanup.key) === cleanup.ref) {
845
- owner.childProxies.delete(cleanup.key);
846
- }
847
- if (owner.childProxies === undefined)
848
- owner.childProxies = new Map();
849
- owner.childProxies.set(key, cleanup.ref);
850
- cleanup.key = key;
851
- if (Array.isArray(owner.target)) {
852
- if (owner.childCells === undefined)
853
- owner.childCells = new Set();
854
- owner.childCells.add(cleanup.ref);
855
- }
856
- };
857
- const andorraFindPlacement = (owner, parent, segment, target, blocked) => {
858
- if (blocked === undefined) {
859
- const known = andorraFindEntry(target);
860
- if (known !== undefined) {
861
- for (const cell of known.cells) {
862
- if (!cell.dead && cell.owner === owner && cell.parent === parent && cell.seg === segment)
863
- return cell;
864
- }
865
- }
866
- return undefined;
867
- }
868
- // Blocked views are intentionally absent from the ordinary raw-entry index.
869
- for (const ref of owner.childCells ?? []) {
870
- const cell = andorraDerefCell(ref);
871
- if (cell !== undefined &&
872
- !cell.dead &&
873
- cell.target === target &&
874
- cell.entry?.blocked === blocked &&
875
- cell.parent === parent &&
876
- cell.seg === segment) {
877
- return cell;
878
- }
879
- }
880
- return undefined;
881
- };
882
- const andorraUnwrap = (value) => (andorraIsObj(value) ? (proxyEntries.get(value)?.target ?? value) : value);
883
- const andorraAdoptItems = (values) => values.map(andorraUnwrap);
884
- // Every operation is emitted once per live location of an explicitly aliased
885
- // object. Alias cells are independent of public proxy lifetimes.
886
- const andorraEmit = (entry, op) => {
887
- andorraRecord(op);
888
- if (!aliased)
889
- return;
890
- const live = andorraLiveCells(entry);
891
- if (live.length <= 1)
892
- return;
893
- const base = andorraPathNow(entry);
894
- const head = andorraPrimary(entry);
895
- for (const cell of live) {
896
- if (cell === head || op[0] === "r")
897
- continue;
898
- const rest = op[1].slice(base.length);
899
- const cloned = [...op];
900
- cloned[1] = [...andorraPathOf(cell), ...rest];
901
- andorraRecord(cloned);
902
- }
903
- };
904
- // Structural mutation updates every still-live placement cell, including cells
905
- // retained only by held descendants. Dead weak registrations are pruned lazily;
906
- // finalizers keep idle live parents from accumulating them indefinitely.
907
- const andorraRenumber = (entry, key, before, after, spliceAt, spliceRemove, spliceInsert) => {
908
- shape++;
909
- const childCells = entry.childCells;
910
- if (key === "push" || !Array.isArray(entry.target) || childCells === undefined || childCells.size === 0)
911
- return;
912
- let index;
913
- let remove = 0;
914
- let insert = 0;
915
- if (key === "pop") {
916
- index = before - 1;
917
- remove = before > 0 ? 1 : 0;
918
- }
919
- else if (key === "shift") {
920
- index = 0;
921
- remove = before > 0 ? 1 : 0;
922
- }
923
- else if (key === "unshift") {
924
- index = 0;
925
- insert = after - before;
926
- }
927
- else if (key === "splice") {
928
- index = spliceAt;
929
- remove = spliceRemove;
930
- insert = spliceInsert;
931
- }
932
- else {
933
- for (const ref of [...childCells]) {
934
- const cell = andorraDerefCell(ref);
935
- if (cell === undefined) {
936
- childCells.delete(ref);
937
- continue;
938
- }
939
- const at = entry.target.indexOf(cell.target);
940
- if (at < 0) {
941
- cell.dead = true;
942
- childCells.delete(ref);
943
- }
944
- else
945
- cell.seg = at;
946
- }
947
- entry.childProxies?.clear();
948
- return;
949
- }
950
- const delta = insert - remove;
951
- for (const ref of [...childCells]) {
952
- const cell = andorraDerefCell(ref);
953
- if (cell === undefined) {
954
- childCells.delete(ref);
955
- continue;
956
- }
957
- const at = cell.seg;
958
- if (typeof at !== "number")
959
- continue;
960
- if (at >= index && at < index + remove) {
961
- cell.dead = true;
962
- childCells.delete(ref);
963
- }
964
- else if (at >= index + remove)
965
- cell.seg = at + delta;
966
- }
967
- entry.childProxies?.clear();
968
- };
969
- const andorraWrap = (object, cell, blockedSegment) => {
970
- const placed = cell.entry;
971
- if (placed !== undefined && placed.target === object && placed.blocked === blockedSegment) {
972
- return andorraProxyFor(placed);
973
- }
974
- const existing = blockedSegment === undefined ? andorraFindEntry(object) : undefined;
975
- if (existing !== undefined) {
976
- andorraAddPlacement(existing, cell);
977
- return andorraProxyFor(existing);
978
- }
979
- const entry = {
980
- target: object,
981
- cells: new Set(),
982
- fallback: cell,
983
- blocked: blockedSegment,
984
- proxy: undefined,
985
- childProxies: undefined,
986
- childCells: undefined,
987
- };
988
- andorraAddPlacement(entry, cell);
989
- if (blockedSegment === undefined)
990
- andorraIndexEntry(entry);
991
- return andorraProxyFor(entry);
992
- };
993
- const handlerPrototype = {
994
- get(target, key, receiver) {
995
- const entry = this.entry;
996
- if (Array.isArray(target) && typeof key === "string" && MUTATORS.has(key)) {
997
- return (...args) => {
998
- if (entry.blocked !== undefined)
999
- throw new AndorraUnsafePathError(entry.blocked);
1000
- const detached = aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback);
1001
- if (detached) {
1002
- return Reflect.apply(Array.prototype[key], target, args.map(andorraUnwrap));
1003
- }
1004
- const before = target.length;
1005
- let spliceAt = -1;
1006
- let spliceRemove = 0;
1007
- let spliceInsert = 0;
1008
- let insertAt = -1;
1009
- let insertCount = 0;
1010
- let result;
1011
- switch (key) {
1012
- case "push": {
1013
- const items = andorraAdoptItems(args);
1014
- if (items.length > 0)
1015
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], before, 0, andorraCloneJson(items)]);
1016
- insertAt = before;
1017
- insertCount = items.length;
1018
- andorraSpliceItems(target, before, 0, items);
1019
- result = target.length;
1020
- break;
1021
- }
1022
- case "unshift": {
1023
- const items = andorraAdoptItems(args);
1024
- if (items.length > 0)
1025
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], 0, 0, andorraCloneJson(items)]);
1026
- insertAt = 0;
1027
- insertCount = items.length;
1028
- andorraSpliceItems(target, 0, 0, items);
1029
- result = target.length;
1030
- break;
1031
- }
1032
- case "pop":
1033
- if (before > 0)
1034
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], before - 1, 1, []]);
1035
- result = Reflect.apply(Array.prototype.pop, target, args);
1036
- break;
1037
- case "shift":
1038
- if (before > 0)
1039
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], 0, 1, []]);
1040
- result = Reflect.apply(Array.prototype.shift, target, args);
1041
- break;
1042
- case "splice": {
1043
- const items = andorraAdoptItems(args.slice(2));
1044
- const { index, remove } = andorraSpliceRange(before, args);
1045
- spliceAt = index;
1046
- spliceRemove = remove;
1047
- spliceInsert = items.length;
1048
- insertAt = index;
1049
- insertCount = items.length;
1050
- if (remove > 0 || items.length > 0) {
1051
- if (index === 0 && remove === before) {
1052
- if (andorraPathNow(entry).length === 0)
1053
- andorraEmit(entry, ["r", andorraCloneJson(items)]);
1054
- else
1055
- andorraEmit(entry, [
1056
- "s",
1057
- [...andorraPathNow(entry)],
1058
- andorraCloneJson(items),
1059
- ]);
1060
- }
1061
- else
1062
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], index, remove, andorraCloneJson(items)]);
1063
- }
1064
- result = andorraSpliceItems(target, index, remove, items);
1065
- break;
1066
- }
1067
- default: {
1068
- result = Reflect.apply(Array.prototype[key], target, args.map(andorraUnwrap));
1069
- if (andorraPathNow(entry).length === 0)
1070
- andorraEmit(entry, ["r", andorraCloneJson(target)]);
1071
- else
1072
- andorraEmit(entry, [
1073
- "s",
1074
- [...andorraPathNow(entry)],
1075
- andorraCloneJson(target),
1076
- ]);
1077
- }
1078
- }
1079
- andorraCollapsePending();
1080
- andorraRenumber(entry, key, before, target.length, spliceAt, spliceRemove, spliceInsert);
1081
- for (let index = insertAt; insertCount > 0 && index < insertAt + insertCount; index++) {
1082
- const item = target[index];
1083
- if (!andorraIsObj(item))
1084
- continue;
1085
- const known = andorraFindEntry(item);
1086
- if (known === undefined || known.target === entry.target)
1087
- continue;
1088
- const parent = andorraPrimary(entry);
1089
- let seen = false;
1090
- for (const existingCell of known.cells) {
1091
- if (!existingCell.dead && existingCell.parent === parent && existingCell.seg === index)
1092
- seen = true;
1093
- }
1094
- if (!seen) {
1095
- const inserted = {
1096
- parent,
1097
- owner: entry,
1098
- entry: undefined,
1099
- target: item,
1100
- seg: index,
1101
- dead: false,
1102
- };
1103
- andorraAddPlacement(known, inserted);
1104
- andorraCachePlacement(entry, String(index), inserted);
1105
- }
1106
- }
1107
- return key === "sort" || key === "reverse" || key === "fill" || key === "copyWithin" ? receiver : result;
1108
- };
1109
- }
1110
- const value = Reflect.get(target, key, receiver);
1111
- if (!andorraIsObj(value))
1112
- return value;
1113
- const cachedRef = entry.childProxies?.get(key);
1114
- const cached = cachedRef === undefined ? undefined : andorraDerefCell(cachedRef);
1115
- if (cached !== undefined && cached.target === value && cached.entry !== undefined) {
1116
- return andorraProxyFor(cached.entry);
1117
- }
1118
- if (cachedRef !== undefined && cached === undefined && entry.childProxies?.get(key) === cachedRef) {
1119
- entry.childProxies?.delete(key);
1120
- }
1121
- const rawSegment = andorraNorm(target, key);
1122
- let segment;
1123
- let childBlocked = entry.blocked;
1124
- if (entry.blocked !== undefined) {
1125
- if (typeof rawSegment === "symbol")
1126
- throw new AndorraUnsafePathError(String(rawSegment));
1127
- segment = rawSegment;
1128
- }
1129
- else if (typeof rawSegment === "string" && RESERVED_SEGMENTS.has(rawSegment) && Object.hasOwn(target, key)) {
1130
- segment = rawSegment;
1131
- childBlocked = rawSegment;
1132
- }
1133
- else
1134
- segment = andorraGuard(rawSegment);
1135
- const parent = andorraPrimary(entry);
1136
- const existingCell = andorraFindPlacement(entry, parent, segment, value, childBlocked);
1137
- if (existingCell?.entry !== undefined) {
1138
- andorraCachePlacement(entry, key, existingCell);
1139
- return andorraProxyFor(existingCell.entry);
1140
- }
1141
- const childCell = {
1142
- parent,
1143
- owner: entry,
1144
- entry: undefined,
1145
- target: value,
1146
- seg: segment,
1147
- dead: false,
1148
- };
1149
- const child = andorraWrap(value, childCell, childBlocked);
1150
- andorraCachePlacement(entry, key, childCell);
1151
- return child;
1152
- },
1153
- set(target, key, value) {
1154
- const entry = this.entry;
1155
- if (entry.blocked !== undefined)
1156
- throw new AndorraUnsafePathError(entry.blocked);
1157
- const rawValue = andorraUnwrap(value);
1158
- if (aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback)) {
1159
- return Reflect.set(target, key, rawValue);
1160
- }
1161
- if (Array.isArray(target) && key === "length") {
1162
- const before = target.length;
1163
- const next = Number(rawValue);
1164
- if (!Number.isSafeInteger(next) || next < 0 || next > 4_294_967_295) {
1165
- return Reflect.set(target, key, rawValue);
1166
- }
1167
- if (next < before) {
1168
- if (next === 0) {
1169
- if (andorraPathNow(entry).length === 0)
1170
- andorraEmit(entry, ["r", []]);
1171
- else
1172
- andorraEmit(entry, ["s", [...andorraPathNow(entry)], []]);
1173
- }
1174
- else
1175
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], next, before - next, []]);
1176
- Reflect.set(target, key, next);
1177
- andorraRenumber(entry, "splice", before, next, next, before - next, 0);
1178
- entry.childProxies?.clear();
1179
- }
1180
- else if (next > before) {
1181
- target.length = next;
1182
- target.fill(null, before);
1183
- const grown = new Array(next - before).fill(null);
1184
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], before, 0, grown]);
1185
- }
1186
- andorraCollapsePending();
1187
- return true;
1188
- }
1189
- const segment = andorraGuard(andorraNorm(target, key));
1190
- if (Array.isArray(target)) {
1191
- if (typeof segment !== "number")
1192
- throw new AndorraUnsafePathError(segment);
1193
- if (segment > target.length)
1194
- throw new AndorraUnsafePathError(segment);
1195
- }
1196
- const at = [...andorraPathNow(entry), segment];
1197
- if (rawValue === undefined) {
1198
- if (Array.isArray(target))
1199
- throw new TypeError("undefined would create a sparse array; use splice instead");
1200
- if (Object.hasOwn(target, key))
1201
- andorraEmit(entry, ["d", at]);
1202
- entry.childProxies?.delete(key);
1203
- const deleted = Reflect.deleteProperty(target, key);
1204
- if (deleted)
1205
- andorraCollapsePending();
1206
- return deleted;
1207
- }
1208
- const previous = target[key];
1209
- if (previous === rawValue)
1210
- return true;
1211
- if (Array.isArray(target) && segment === target.length) {
1212
- andorraEmit(entry, ["p", [...andorraPathNow(entry)], target.length, 0, [andorraCloneJson(rawValue)]]);
1213
- }
1214
- else if (andorraIsObj(previous) && andorraIsObj(rawValue)) {
1215
- andorraDiffInto(previous, rawValue, [...andorraPathNow(entry), segment]);
1216
- }
1217
- else if (typeof previous === "string" && typeof rawValue === "string") {
1218
- if (!aliased)
1219
- andorraRecordString([...andorraPathNow(entry), segment], previous, rawValue);
1220
- else
1221
- for (const cell of andorraLiveCells(entry))
1222
- andorraRecordString([...andorraPathOf(cell), segment], previous, rawValue);
1223
- }
1224
- else {
1225
- andorraEmit(entry, ["s", at, andorraCloneJson(rawValue)]);
1226
- }
1227
- entry.childProxies?.delete(key);
1228
- const updated = Reflect.set(target, key, rawValue);
1229
- if (updated) {
1230
- if (andorraIsObj(rawValue)) {
1231
- const known = andorraFindEntry(rawValue);
1232
- if (known !== undefined) {
1233
- const placement = {
1234
- parent: andorraPrimary(entry),
1235
- owner: entry,
1236
- entry: undefined,
1237
- target: rawValue,
1238
- seg: segment,
1239
- dead: false,
1240
- };
1241
- andorraAddPlacement(known, placement);
1242
- andorraCachePlacement(entry, key, placement);
1243
- }
1244
- }
1245
- andorraCollapsePending();
1246
- }
1247
- return updated;
1248
- },
1249
- deleteProperty(target, key) {
1250
- const entry = this.entry;
1251
- if (entry.blocked !== undefined)
1252
- throw new AndorraUnsafePathError(entry.blocked);
1253
- if (aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback)) {
1254
- return Reflect.deleteProperty(target, key);
1255
- }
1256
- const segment = andorraGuard(andorraNorm(target, key));
1257
- if (Array.isArray(target)) {
1258
- if (typeof segment !== "number")
1259
- throw new AndorraUnsafePathError(segment);
1260
- throw new TypeError("delete would create a sparse array; use splice instead");
1261
- }
1262
- if (Object.hasOwn(target, key))
1263
- andorraEmit(entry, ["d", [...andorraPathNow(entry), segment]]);
1264
- entry.childProxies?.delete(key);
1265
- const deleted = Reflect.deleteProperty(target, key);
1266
- if (deleted)
1267
- andorraCollapsePending();
1268
- return deleted;
1269
- },
1270
- defineProperty() {
1271
- throw new TypeError("defineProperty is not supported on tracked state; use assignment");
1272
- },
1273
- setPrototypeOf() {
1274
- throw new TypeError("setPrototypeOf is not supported on tracked state");
1275
- },
1276
- preventExtensions() {
1277
- throw new TypeError("preventExtensions is not supported on tracked state");
1278
- },
1279
- };
1280
- function andorraProxyFor(entry) {
1281
- const cached = jobProxies.get(entry);
1282
- if (cached !== undefined)
1283
- return cached;
1284
- const existing = entry.proxy?.deref();
1285
- if (existing !== undefined) {
1286
- jobProxies.set(entry, existing);
1287
- andorraScheduleJobCleanup();
1288
- return existing;
1289
- }
1290
- const handler = Object.create(handlerPrototype);
1291
- handler.entry = entry;
1292
- const proxy = new Proxy(entry.target, handler);
1293
- entry.proxy = new WeakRef(proxy);
1294
- jobProxies.set(entry, proxy);
1295
- andorraScheduleJobCleanup();
1296
- proxyEntries.set(proxy, entry);
1297
- return proxy;
1298
- }
1299
- const rootCell = {
1300
- parent: undefined,
1301
- owner: undefined,
1302
- entry: undefined,
1303
- target: root,
1304
- seg: "",
1305
- dead: false,
1306
- };
1307
- let state = andorraWrap(root, rootCell);
1308
- return {
1309
- get state() {
1310
- return state;
1311
- },
1312
- get target() {
1313
- return root;
1314
- },
1315
- set state(next) {
1316
- const rawNext = andorraUnwrap(next);
1317
- if (rawNext === root) {
1318
- andorraClearPending();
1319
- forceBase = true;
1320
- return;
1321
- }
1322
- andorraClearPending();
1323
- root = rawNext;
1324
- state = andorraWrap(root, {
1325
- parent: undefined,
1326
- owner: undefined,
1327
- entry: undefined,
1328
- target: root,
1329
- seg: "",
1330
- dead: false,
1331
- });
1332
- forceBase = true;
1333
- },
1334
- rebase() {
1335
- andorraClearPending();
1336
- forceBase = true;
1337
- },
1338
- get dirty() {
1339
- // conservative: true if anything was written since the last flush, even
1340
- // if the writes cancelled out
1341
- return forceBase || hasPending;
1342
- },
1343
- discard() {
1344
- andorraClearPending();
1345
- },
1346
- flush() {
1347
- if (forceBase) {
1348
- const value = andorraCloneJson(root);
1349
- forceBase = false;
1350
- andorraClearPending();
1351
- return [["r", value]];
1352
- }
1353
- if (!hasPending)
1354
- return [];
1355
- const out = [];
1356
- for (const slot of log) {
1357
- if (slot === undefined || slot.dead)
1358
- continue;
1359
- if (slot.str !== undefined) {
1360
- andorraDiffValue(slot.str.anchor, slot.str.value, slot.op[1], scan, out);
1361
- continue;
1362
- }
1363
- out.push(slot.op);
1364
- }
1365
- andorraClearPending();
1366
- return out;
1367
- },
1368
- };
1369
- }
1370
- // ─── Path safety ─────────────────────────────────────────────────────────────
1371
- /**
1372
- * Segments that reach the prototype chain.
1373
- *
1374
- * `JSON.parse` is safe on its own — it makes `__proto__` an own property. What is
1375
- * not safe is `parent[key] = value`, which is exactly what an applier does, and
1376
- * paths are data: `["s", ["__proto__", "isAdmin"], true]` pollutes
1377
- * `Object.prototype` for the whole process.
1378
- *
1379
- * Ops arrive from a facet, a plugin compartment, or a tool whose details may echo
1380
- * model output, so none of it is trusted input.
1381
- */
1382
- export const RESERVED_SEGMENTS = new Set(["__proto__", "constructor", "prototype"]);
1383
- export class AndorraUnsafePathError extends Error {
1384
- // Not a parameter property: Node's --experimental-strip-types rejects those,
1385
- // and these files are meant to run under it directly.
1386
- segment;
1387
- constructor(segment) {
1388
- super(`unsafe path segment: ${String(segment)}`);
1389
- this.segment = segment;
1390
- this.name = "UnsafePathError";
1391
- }
1392
- }
1393
- /**
1394
- * Verb, arity and payload shape for a **decoded** op: paths inline, no `#`, no
1395
- * short forms. `apply` uses this.
1396
- *
1397
- * Validating `Op` against the wire grammar would be laxer than the type: a
1398
- * two-element `["s", value]` would pass, and `apply` would then read the value as
1399
- * a path. Each vocabulary gets the validator that matches it.
1400
- */
1401
- export function andorraAssertValidOp(op) {
1402
- if (!Array.isArray(op) || op.length === 0)
1403
- throw new TypeError("op is not a tuple");
1404
- switch (op[0]) {
1405
- case "r":
1406
- if (op.length !== 2)
1407
- throw new TypeError("r arity");
1408
- return;
1409
- case "s":
1410
- if (op.length !== 3)
1411
- throw new TypeError("s arity");
1412
- andorraAssertPathArg(op[1], true);
1413
- return;
1414
- case "d":
1415
- if (op.length !== 2)
1416
- throw new TypeError("d arity");
1417
- andorraAssertPathArg(op[1], true);
1418
- return;
1419
- case "a":
1420
- if (op.length !== 3 || typeof op[2] !== "string")
1421
- throw new TypeError("a shape");
1422
- andorraAssertPathArg(op[1], true);
1423
- return;
1424
- case "t":
1425
- if (op.length !== 3 || !Number.isInteger(op[2]) || op[2] < 0)
1426
- throw new TypeError("t shape");
1427
- andorraAssertPathArg(op[1], true);
1428
- return;
1429
- case "p": {
1430
- if (op.length !== 5)
1431
- throw new TypeError("p arity");
1432
- andorraAssertPathArg(op[1]);
1433
- if (!Number.isInteger(op[2]) || op[2] < 0)
1434
- throw new TypeError("p index");
1435
- if (!Number.isInteger(op[3]) || op[3] < 0)
1436
- throw new TypeError("p remove");
1437
- if (!Array.isArray(op[4]))
1438
- throw new TypeError("p items");
1439
- return;
1440
- }
1441
- // Silently skipping an unknown verb is how a newer producer's op vanishes.
1442
- default:
1443
- throw new TypeError(`unknown op verb: ${String(op[0])}`);
1444
- }
1445
- }
1446
- function andorraAssertPathArg(p, nonEmpty = false) {
1447
- if (!Array.isArray(p))
1448
- throw new TypeError("path is not an array");
1449
- if (nonEmpty && p.length === 0)
1450
- throw new TypeError("path is empty");
1451
- andorraAssertSafePath(p);
1452
- }
1453
- /** The same, for the wire grammar: ids and short forms are legal here. */
1454
- export function andorraAssertValidWireOp(op) {
1455
- if (!Array.isArray(op) || op.length === 0)
1456
- throw new TypeError("op is not a tuple");
1457
- const [verb] = op;
1458
- const andorraOkRef = (r) => {
1459
- if (typeof r === "number") {
1460
- if (!Number.isInteger(r) || r < 0)
1461
- throw new TypeError("bad path id");
1462
- return;
1463
- }
1464
- // A string is not a path. Unchecked, `"a".slice(0, -1)` is `""`, so it
1465
- // resolves to the ROOT and writes there — a path that is not a path, accepted.
1466
- if (!Array.isArray(r))
1467
- throw new TypeError("path is not an array");
1468
- andorraAssertSafePath(r);
1469
- };
1470
- switch (verb) {
1471
- case "r":
1472
- if (op.length !== 2)
1473
- throw new TypeError("r arity");
1474
- return;
1475
- case "s":
1476
- if (op.length === 3)
1477
- andorraOkRef(op[1]);
1478
- else if (op.length !== 2)
1479
- throw new TypeError("s arity");
1480
- return;
1481
- case "d":
1482
- if (op.length === 2)
1483
- andorraOkRef(op[1]);
1484
- else if (op.length !== 1)
1485
- throw new TypeError("d arity");
1486
- return;
1487
- case "a":
1488
- if (op.length === 3) {
1489
- andorraOkRef(op[1]);
1490
- if (typeof op[2] !== "string")
1491
- throw new TypeError("a value");
1492
- }
1493
- else if (op.length === 2) {
1494
- if (typeof op[1] !== "string")
1495
- throw new TypeError("a value");
1496
- }
1497
- else
1498
- throw new TypeError("a arity");
1499
- return;
1500
- case "t":
1501
- if (op.length === 3) {
1502
- andorraOkRef(op[1]);
1503
- if (!Number.isInteger(op[2]) || op[2] < 0)
1504
- throw new TypeError("t count");
1505
- }
1506
- else if (op.length === 2) {
1507
- if (!Number.isInteger(op[1]) || op[1] < 0)
1508
- throw new TypeError("t count");
1509
- }
1510
- else
1511
- throw new TypeError("t arity");
1512
- return;
1513
- case "p": {
1514
- const [i, r, items] = op.length === 5 ? [op[2], op[3], op[4]] : op.length === 4 ? [op[1], op[2], op[3]] : [];
1515
- if (items === undefined)
1516
- throw new TypeError("p arity");
1517
- if (op.length === 5)
1518
- andorraOkRef(op[1]);
1519
- if (!Number.isInteger(i) || i < 0)
1520
- throw new TypeError("p index");
1521
- if (!Number.isInteger(r) || r < 0)
1522
- throw new TypeError("p remove");
1523
- if (!Array.isArray(items))
1524
- throw new TypeError("p items");
1525
- return;
1526
- }
1527
- case "#": {
1528
- if (op.length !== 3 || !Number.isInteger(op[1]) || op[1] < 0 || !Array.isArray(op[2])) {
1529
- throw new TypeError("# shape");
1530
- }
1531
- andorraAssertSafePath(op[2]);
1532
- return;
1533
- }
1534
- // Silently skipping an unknown verb is how a newer producer's op vanishes.
1535
- default:
1536
- throw new TypeError(`unknown op verb: ${String(verb)}`);
1537
- }
1538
- }
1539
- export function andorraAssertSafePath(path) {
1540
- for (const seg of path) {
1541
- if (typeof seg === "string") {
1542
- if (RESERVED_SEGMENTS.has(seg))
1543
- throw new AndorraUnsafePathError(seg);
1544
- }
1545
- else if (!Number.isInteger(seg) || seg < 0) {
1546
- throw new AndorraUnsafePathError(seg);
1547
- }
1548
- }
1549
- }
1550
- /**
1551
- * An index may address an existing element or append exactly one past the end.
1552
- *
1553
- * This is not an arbitrary cap — it is what keeps the value a `JsonValue`. A
1554
- * sparse array does not survive a JSON round trip: holes serialise to `null` and
1555
- * return as real properties, so `arr[7] = x` on a length-3 array already produces
1556
- * state a replica cannot match. Rejecting the write is more honest than silently
1557
- * diverging.
1558
- *
1559
- * It also removes the denial of service it would otherwise permit:
1560
- * `["s", ["xs", 4294967290], 1]` allocates a 4.29-billion-entry array from one op.
1561
- * Growth stays possible and stays proportional — the tracker already emits
1562
- * `arr.length = n` as a splice of explicit nulls, whose op size grows with the
1563
- * gap, so a large growth costs a large op rather than a small one.
1564
- */
1565
- function andorraAssertIndexInRange(parent, index) {
1566
- if (index > parent.length)
1567
- throw new AndorraUnsafePathError(index);
1568
- }
1569
- // ─── Applier ─────────────────────────────────────────────────────────────────
1570
- export class AndorraPathError extends Error {
1571
- path;
1572
- constructor(path) {
1573
- super(`unresolvable path: ${JSON.stringify(path)}`);
1574
- this.path = path;
1575
- this.name = "PathError";
1576
- }
1577
- }
1578
- /**
1579
- * Apply ops to a plain mutable value. Returns the value, because `r` replaces it
1580
- * outright and cannot be done in place.
1581
- *
1582
- * Takes decoded ops. Path ids and omitted paths are a wire concern — run
1583
- * `decode` first if the ops came from a boundary.
1584
- */
1585
- export function andorraApply(target, ops) {
1586
- return andorraApplyOps(target, ops);
1587
- }
1588
- function andorraApplyOps(target, ops) {
1589
- let root = target;
1590
- for (const op of ops) {
1591
- andorraAssertValidOp(op);
1592
- if (op[0] === "r") {
1593
- // Adopted, not copied. The consumer owns the batch it was handed.
1594
- //
1595
- // Fanning one batch out to several consumers in-process therefore makes
1596
- // their replicas alias each other. That is an ownership rule, not a
1597
- // defect: copy the batch at the fan-out point, or let each consumer
1598
- // decode its own. A batch that crosses a real boundary is already
1599
- // distinct, because serialisation produces fresh objects.
1600
- root = op[1];
1601
- continue;
1602
- }
1603
- const path = op[1];
1604
- andorraAssertSafePath(path);
1605
- if (op[0] === "p") {
1606
- const target_ = path.length === 0 ? root : andorraResolve(root, path);
1607
- if (!Array.isArray(target_))
1608
- throw new AndorraPathError(path);
1609
- target_.splice(op[2], op[3]);
1610
- const chunkSize = 10_000;
1611
- for (let offset = 0; offset < op[4].length; offset += chunkSize) {
1612
- target_.splice(op[2] + offset, 0, ...op[4].slice(offset, offset + chunkSize));
1613
- }
1614
- continue;
1615
- }
1616
- // s/d/a/t can never target the root — the type forbids it.
1617
- const parent = andorraResolve(root, path.slice(0, -1));
1618
- const key = path[path.length - 1];
1619
- if (Array.isArray(parent)) {
1620
- if (typeof key !== "number")
1621
- throw new AndorraUnsafePathError(key);
1622
- andorraAssertIndexInRange(parent, key);
1623
- }
1624
- // defineProperty rather than assignment: a setter inherited from the prototype
1625
- // chain would otherwise run on write.
1626
- const andorraWrite = (value) => {
1627
- Object.defineProperty(parent, key, { value, writable: true, enumerable: true, configurable: true });
1628
- };
1629
- const andorraRead = () => (Object.hasOwn(parent, key) ? parent[key] : undefined);
1630
- switch (op[0]) {
1631
- case "s":
1632
- andorraWrite(op[2]);
1633
- break;
1634
- case "d":
1635
- if (Array.isArray(parent)) {
1636
- if (typeof key !== "number" || key >= parent.length)
1637
- throw new AndorraPathError(path);
1638
- parent.splice(key, 1);
1639
- }
1640
- else
1641
- delete parent[key];
1642
- break;
1643
- case "a": {
1644
- const current = andorraRead();
1645
- if (typeof current !== "string")
1646
- throw new AndorraPathError(path);
1647
- andorraWrite(`${current}${op[2]}`);
1648
- break;
1649
- }
1650
- case "t": {
1651
- const current = andorraRead();
1652
- if (typeof current !== "string")
1653
- throw new AndorraPathError(path);
1654
- andorraWrite(current.slice(op[2]));
1655
- break;
1656
- }
1657
- }
1658
- }
1659
- return root;
1660
- }
1661
- /** Apply decoded operations without mutating the previous immutable value. */
1662
- export function andorraApplyImmutable(target, ops) {
1663
- let root = target;
1664
- for (const op of ops) {
1665
- if (op[0] === "r") {
1666
- andorraAssertValidOp(op);
1667
- root = op[1];
1668
- continue;
1669
- }
1670
- root = andorraCopyContainers(root, op[0] === "p" ? op[1] : op[1].slice(0, -1));
1671
- root = andorraApplyOps(root, [op]);
1672
- }
1673
- return root;
1674
- }
1675
- function andorraCopyContainers(root, path) {
1676
- const andorraCopy = (value) => {
1677
- if (Array.isArray(value))
1678
- return value.slice();
1679
- if (!andorraIsObj(value))
1680
- throw new AndorraPathError(path);
1681
- const result = Object.create(Object.getPrototypeOf(value) === null ? null : Object.prototype);
1682
- for (const key of Object.keys(value)) {
1683
- Object.defineProperty(result, key, {
1684
- value: value[key],
1685
- writable: true,
1686
- enumerable: true,
1687
- configurable: true,
1688
- });
1689
- }
1690
- return result;
1691
- };
1692
- const copiedRoot = andorraCopy(root);
1693
- let source = root;
1694
- let destination = copiedRoot;
1695
- for (const segment of path) {
1696
- if (!andorraIsObj(source) || !Object.hasOwn(source, segment))
1697
- throw new AndorraPathError(path);
1698
- if (Array.isArray(source) && typeof segment !== "number")
1699
- throw new AndorraUnsafePathError(segment);
1700
- const child = source[segment];
1701
- const copiedChild = andorraCopy(child);
1702
- Object.defineProperty(destination, segment, {
1703
- value: copiedChild,
1704
- writable: true,
1705
- enumerable: true,
1706
- configurable: true,
1707
- });
1708
- source = child;
1709
- destination = copiedChild;
1710
- }
1711
- return copiedRoot;
1712
- }
1713
- function andorraResolveValue(root, path) {
1714
- let node = root;
1715
- for (const seg of path) {
1716
- if (!andorraIsObj(node))
1717
- throw new AndorraPathError(path);
1718
- if (Array.isArray(node) && typeof seg !== "number")
1719
- throw new AndorraUnsafePathError(seg);
1720
- // Own properties only: an inherited getter must not run, and a walk must not
1721
- // escape the value into the prototype chain.
1722
- if (!Object.hasOwn(node, seg))
1723
- throw new AndorraPathError(path);
1724
- node = node[seg];
1725
- }
1726
- return node;
1727
- }
1728
- function andorraResolve(root, path) {
1729
- const node = andorraResolveValue(root, path);
1730
- if (!andorraIsObj(node))
1731
- throw new AndorraPathError(path);
1732
- return node;
1733
- }
1734
- // ─── Codec ───────────────────────────────────────────────────────────────────
1735
- //
1736
- // Path interning and arity omission live between the tracker and a boundary;
1737
- // `Op` and `apply` know nothing about them.
1738
- //
1739
- // ONE PAIR PER INDEPENDENT STATE STREAM. Every decoder must observe exactly the
1740
- // batches encoded by its matching encoder, beginning with that state's base.
1741
- // Sharing a transport connection does not make separately hydrated states one
1742
- // stream.
1743
- const andorraPathKey = (path) => JSON.stringify(path);
1744
- /**
1745
- * Intern on SECOND use. A definition costs more than the path it replaces, so
1746
- * interning on first use loses on the many paths written exactly once.
1747
- */
1748
- export function andorraEncoder() {
1749
- const seen = new Set();
1750
- const ids = new Map();
1751
- let nextId = 0;
1752
- let previous; // last path in THIS batch
1753
- return {
1754
- encode(ops) {
1755
- // Arity omission is scoped to a batch. Letting it span batches would make
1756
- // a batch's first op depend on the previous batch's last one, so a reader
1757
- // that skips or reorders a batch decodes into the wrong path. Ids are the
1758
- // only cross-batch state, and the dictionary makes those explicit.
1759
- previous = undefined;
1760
- const out = [];
1761
- for (const op of ops) {
1762
- if (op[0] === "r") {
1763
- out.push(op);
1764
- // A base batch is a RECOVERY POINT: a reader replays from the last one
1765
- // with a fresh decoder. So everything after it must be self-contained.
1766
- // Keeping ids across a replacement emits references to definitions the
1767
- // reader never saw — recovery fails with an unresolvable path id.
1768
- seen.clear();
1769
- ids.clear();
1770
- nextId = 0;
1771
- previous = undefined;
1772
- continue;
1773
- }
1774
- const path = op[1];
1775
- const key = andorraPathKey(path);
1776
- // Same path as the previous op: drop the ref entirely.
1777
- if (key === previous) {
1778
- switch (op[0]) {
1779
- case "s":
1780
- out.push(["s", op[2]]);
1781
- break;
1782
- case "d":
1783
- out.push(["d"]);
1784
- break;
1785
- case "a":
1786
- out.push(["a", op[2]]);
1787
- break;
1788
- case "t":
1789
- out.push(["t", op[2]]);
1790
- break;
1791
- case "p":
1792
- out.push(["p", op[2], op[3], op[4]]);
1793
- break;
1794
- }
1795
- continue;
1796
- }
1797
- let ref = path;
1798
- const existing = ids.get(key);
1799
- if (existing !== undefined) {
1800
- ref = existing;
1801
- }
1802
- else if (seen.has(key)) {
1803
- const id = nextId++;
1804
- ids.set(key, id);
1805
- out.push(["#", id, path]); // second use: define, then reference
1806
- ref = id;
1807
- }
1808
- else {
1809
- seen.add(key); // first use: inline
1810
- }
1811
- switch (op[0]) {
1812
- case "s":
1813
- out.push(["s", ref, op[2]]);
1814
- break;
1815
- case "d":
1816
- out.push(["d", ref]);
1817
- break;
1818
- case "a":
1819
- out.push(["a", ref, op[2]]);
1820
- break;
1821
- case "t":
1822
- out.push(["t", ref, op[2]]);
1823
- break;
1824
- case "p":
1825
- out.push(["p", ref, op[2], op[3], op[4]]);
1826
- break;
1827
- }
1828
- previous = key;
1829
- }
1830
- return out;
1831
- },
1832
- };
1833
- }
1834
- export function andorraDecoder() {
1835
- const paths = new Map();
1836
- return {
1837
- decode(wire) {
1838
- let previous; // scoped to the batch, as in encode
1839
- const out = [];
1840
- for (const op of wire) {
1841
- andorraAssertValidWireOp(op);
1842
- if (op[0] === "#") {
1843
- andorraAssertSafePath(op[2]);
1844
- paths.set(op[1], op[2]);
1845
- continue;
1846
- }
1847
- if (op[0] === "r") {
1848
- out.push(op);
1849
- paths.clear();
1850
- previous = undefined;
1851
- continue;
1852
- }
1853
- // Arity tells us whether a ref is present: the short forms omit it.
1854
- const short = (op[0] === "d" && op.length === 1) ||
1855
- (op[0] !== "d" && op[0] !== "p" && op.length === 2) ||
1856
- (op[0] === "p" && op.length === 4);
1857
- let path;
1858
- if (short) {
1859
- if (previous === undefined)
1860
- throw new AndorraPathError([]);
1861
- path = previous;
1862
- }
1863
- else {
1864
- const ref = op[1];
1865
- if (typeof ref === "number") {
1866
- const resolved = paths.get(ref);
1867
- if (resolved === undefined)
1868
- throw new AndorraPathError(ref);
1869
- path = resolved;
1870
- }
1871
- else {
1872
- path = ref;
1873
- }
1874
- previous = path;
1875
- }
1876
- if (op[0] !== "p" && path.length === 0)
1877
- throw new AndorraPathError(path);
1878
- switch (op[0]) {
1879
- case "s":
1880
- out.push(["s", path, (short ? op[1] : op[2])]);
1881
- break;
1882
- case "d":
1883
- out.push(["d", path]);
1884
- break;
1885
- case "a":
1886
- out.push(["a", path, (short ? op[1] : op[2])]);
1887
- break;
1888
- case "t":
1889
- out.push(["t", path, (short ? op[1] : op[2])]);
1890
- break;
1891
- case "p": {
1892
- const [i, r, items] = short
1893
- ? [op[1], op[2], op[3]]
1894
- : [op[2], op[3], op[4]];
1895
- out.push(["p", path, i, r, items]);
1896
- break;
1897
- }
1898
- }
1899
- }
1900
- return out;
1901
- },
1902
- };
1903
- }