@greppleai/grip 0.1.5 → 0.1.7

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 (587) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js.map +1 -1
  5. package/dist/bun/embedded-assets.d.ts.map +1 -1
  6. package/dist/bun/embedded-assets.js.map +1 -1
  7. package/dist/bun/register-bedrock.d.ts.map +1 -1
  8. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  9. package/dist/bun/restore-sandbox-env.js.map +1 -1
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js.map +1 -1
  12. package/dist/cli/config-selector.d.ts.map +1 -1
  13. package/dist/cli/config-selector.js.map +1 -1
  14. package/dist/cli/file-processor.d.ts.map +1 -1
  15. package/dist/cli/file-processor.js.map +1 -1
  16. package/dist/cli/initial-message.d.ts +1 -1
  17. package/dist/cli/initial-message.d.ts.map +1 -1
  18. package/dist/cli/initial-message.js.map +1 -1
  19. package/dist/cli/list-models.d.ts.map +1 -1
  20. package/dist/cli/list-models.js.map +1 -1
  21. package/dist/cli/session-picker.d.ts.map +1 -1
  22. package/dist/cli/session-picker.js.map +1 -1
  23. package/dist/cli.d.ts.map +1 -1
  24. package/dist/cli.js.map +1 -1
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js +2 -0
  27. package/dist/config.js.map +1 -1
  28. package/dist/core/agent-session.d.ts +38 -1
  29. package/dist/core/agent-session.d.ts.map +1 -1
  30. package/dist/core/agent-session.js +289 -154
  31. package/dist/core/agent-session.js.map +1 -1
  32. package/dist/core/auth-guidance.d.ts.map +1 -1
  33. package/dist/core/auth-guidance.js.map +1 -1
  34. package/dist/core/auth-storage.d.ts +4 -0
  35. package/dist/core/auth-storage.d.ts.map +1 -1
  36. package/dist/core/auth-storage.js +3 -10
  37. package/dist/core/auth-storage.js.map +1 -1
  38. package/dist/core/bash-executor.d.ts.map +1 -1
  39. package/dist/core/bash-executor.js +19 -23
  40. package/dist/core/bash-executor.js.map +1 -1
  41. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  42. package/dist/core/compaction/branch-summarization.js.map +1 -1
  43. package/dist/core/compaction/compaction.d.ts.map +1 -1
  44. package/dist/core/compaction/compaction.js +9 -2
  45. package/dist/core/compaction/compaction.js.map +1 -1
  46. package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -1
  47. package/dist/core/compaction/compression-detection-ledger.js.map +1 -1
  48. package/dist/core/compaction/compression-detector.d.ts +1 -0
  49. package/dist/core/compaction/compression-detector.d.ts.map +1 -1
  50. package/dist/core/compaction/compression-detector.js +10 -21
  51. package/dist/core/compaction/compression-detector.js.map +1 -1
  52. package/dist/core/compaction/compression-economics.d.ts.map +1 -1
  53. package/dist/core/compaction/compression-economics.js.map +1 -1
  54. package/dist/core/compaction/utils.d.ts.map +1 -1
  55. package/dist/core/compaction/utils.js.map +1 -1
  56. package/dist/core/defaults.d.ts.map +1 -1
  57. package/dist/core/diagnostics.d.ts.map +1 -1
  58. package/dist/core/event-bus.d.ts.map +1 -1
  59. package/dist/core/event-bus.js.map +1 -1
  60. package/dist/core/exec.d.ts.map +1 -1
  61. package/dist/core/exec.js.map +1 -1
  62. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  63. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  64. package/dist/core/export-html/index.d.ts.map +1 -1
  65. package/dist/core/export-html/index.js.map +1 -1
  66. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  67. package/dist/core/export-html/tool-renderer.js.map +1 -1
  68. package/dist/core/extensions/loader.d.ts.map +1 -1
  69. package/dist/core/extensions/loader.js.map +1 -1
  70. package/dist/core/extensions/runner.d.ts +3 -0
  71. package/dist/core/extensions/runner.d.ts.map +1 -1
  72. package/dist/core/extensions/runner.js +40 -30
  73. package/dist/core/extensions/runner.js.map +1 -1
  74. package/dist/core/extensions/types.d.ts +21 -1
  75. package/dist/core/extensions/types.d.ts.map +1 -1
  76. package/dist/core/extensions/types.js.map +1 -1
  77. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  78. package/dist/core/extensions/wrapper.js.map +1 -1
  79. package/dist/core/footer-data-provider.d.ts.map +1 -1
  80. package/dist/core/footer-data-provider.js +15 -16
  81. package/dist/core/footer-data-provider.js.map +1 -1
  82. package/dist/core/grip-agent.d.ts.map +1 -1
  83. package/dist/core/grip-agent.js +7 -21
  84. package/dist/core/grip-agent.js.map +1 -1
  85. package/dist/core/grip-manifest.d.ts.map +1 -1
  86. package/dist/core/grip-manifest.js.map +1 -1
  87. package/dist/core/hooks/aggregate.d.ts.map +1 -1
  88. package/dist/core/hooks/aggregate.js.map +1 -1
  89. package/dist/core/hooks/config.d.ts.map +1 -1
  90. package/dist/core/hooks/config.js.map +1 -1
  91. package/dist/core/hooks/executor.d.ts.map +1 -1
  92. package/dist/core/hooks/executor.js.map +1 -1
  93. package/dist/core/hooks/index.d.ts.map +1 -1
  94. package/dist/core/hooks/index.js.map +1 -1
  95. package/dist/core/hooks/matcher.d.ts.map +1 -1
  96. package/dist/core/hooks/matcher.js.map +1 -1
  97. package/dist/core/hooks/trust-store.d.ts.map +1 -1
  98. package/dist/core/hooks/trust-store.js +0 -3
  99. package/dist/core/hooks/trust-store.js.map +1 -1
  100. package/dist/core/hooks/types.d.ts.map +1 -1
  101. package/dist/core/hooks/types.js.map +1 -1
  102. package/dist/core/http-dispatcher.d.ts.map +1 -1
  103. package/dist/core/http-dispatcher.js.map +1 -1
  104. package/dist/core/instruction-resource-loader.d.ts +1 -0
  105. package/dist/core/instruction-resource-loader.d.ts.map +1 -1
  106. package/dist/core/instruction-resource-loader.js +2 -4
  107. package/dist/core/instruction-resource-loader.js.map +1 -1
  108. package/dist/core/keybindings.d.ts.map +1 -1
  109. package/dist/core/keybindings.js +0 -1
  110. package/dist/core/keybindings.js.map +1 -1
  111. package/dist/core/lsp/abort.d.ts.map +1 -1
  112. package/dist/core/lsp/abort.js.map +1 -1
  113. package/dist/core/lsp/client.d.ts.map +1 -1
  114. package/dist/core/lsp/client.js +8 -22
  115. package/dist/core/lsp/client.js.map +1 -1
  116. package/dist/core/lsp/config-loader.d.ts.map +1 -1
  117. package/dist/core/lsp/config-loader.js.map +1 -1
  118. package/dist/core/lsp/config.d.ts.map +1 -1
  119. package/dist/core/lsp/config.js.map +1 -1
  120. package/dist/core/lsp/diagnostics.d.ts.map +1 -1
  121. package/dist/core/lsp/diagnostics.js.map +1 -1
  122. package/dist/core/lsp/file-sync.d.ts.map +1 -1
  123. package/dist/core/lsp/file-sync.js +7 -9
  124. package/dist/core/lsp/file-sync.js.map +1 -1
  125. package/dist/core/lsp/integration.d.ts.map +1 -1
  126. package/dist/core/lsp/integration.js.map +1 -1
  127. package/dist/core/lsp/language-map.d.ts.map +1 -1
  128. package/dist/core/lsp/language-map.js +2 -7
  129. package/dist/core/lsp/language-map.js.map +1 -1
  130. package/dist/core/lsp/manager.d.ts.map +1 -1
  131. package/dist/core/lsp/manager.js +18 -29
  132. package/dist/core/lsp/manager.js.map +1 -1
  133. package/dist/core/lsp/navigation.d.ts.map +1 -1
  134. package/dist/core/lsp/navigation.js.map +1 -1
  135. package/dist/core/lsp/portable-path.d.ts.map +1 -1
  136. package/dist/core/lsp/portable-path.js.map +1 -1
  137. package/dist/core/lsp/refactor.d.ts.map +1 -1
  138. package/dist/core/lsp/refactor.js.map +1 -1
  139. package/dist/core/lsp/transport.d.ts.map +1 -1
  140. package/dist/core/lsp/transport.js.map +1 -1
  141. package/dist/core/messages.d.ts.map +1 -1
  142. package/dist/core/messages.js +30 -1
  143. package/dist/core/messages.js.map +1 -1
  144. package/dist/core/model-registry.d.ts.map +1 -1
  145. package/dist/core/model-registry.js +5 -7
  146. package/dist/core/model-registry.js.map +1 -1
  147. package/dist/core/model-resolver.d.ts.map +1 -1
  148. package/dist/core/model-resolver.js.map +1 -1
  149. package/dist/core/output-guard.d.ts.map +1 -1
  150. package/dist/core/output-guard.js.map +1 -1
  151. package/dist/core/package-manager.d.ts.map +1 -1
  152. package/dist/core/package-manager.js +0 -6
  153. package/dist/core/package-manager.js.map +1 -1
  154. package/dist/core/prompt-templates.d.ts.map +1 -1
  155. package/dist/core/prompt-templates.js.map +1 -1
  156. package/dist/core/provider-display-names.d.ts.map +1 -1
  157. package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -1
  158. package/dist/core/remote-workspace-protocol/contract.js +4 -2
  159. package/dist/core/remote-workspace-protocol/contract.js.map +1 -1
  160. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -1
  161. package/dist/core/remote-workspace-protocol/guest-shared-client.js +1 -5
  162. package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -1
  163. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -1
  164. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +5 -10
  165. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -1
  166. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -1
  167. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +2 -9
  168. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -1
  169. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -1
  170. package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -1
  171. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -1
  172. package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -1
  173. package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -1
  174. package/dist/core/remote-workspace-protocol/session.js +27 -65
  175. package/dist/core/remote-workspace-protocol/session.js.map +1 -1
  176. package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -1
  177. package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -1
  178. package/dist/core/resolve-config-value.d.ts.map +1 -1
  179. package/dist/core/resolve-config-value.js.map +1 -1
  180. package/dist/core/resource-loader.d.ts.map +1 -1
  181. package/dist/core/resource-loader.js +0 -48
  182. package/dist/core/resource-loader.js.map +1 -1
  183. package/dist/core/rules.d.ts.map +1 -1
  184. package/dist/core/rules.js.map +1 -1
  185. package/dist/core/sandbox/command.d.ts.map +1 -1
  186. package/dist/core/sandbox/command.js.map +1 -1
  187. package/dist/core/sandbox/config.d.ts.map +1 -1
  188. package/dist/core/sandbox/config.js.map +1 -1
  189. package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -1
  190. package/dist/core/sandbox/lima-guest-binary.js.map +1 -1
  191. package/dist/core/sandbox/lima.d.ts +2 -0
  192. package/dist/core/sandbox/lima.d.ts.map +1 -1
  193. package/dist/core/sandbox/lima.js +3 -9
  194. package/dist/core/sandbox/lima.js.map +1 -1
  195. package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -1
  196. package/dist/core/sandbox/shared-lima-roots.js.map +1 -1
  197. package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -1
  198. package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -1
  199. package/dist/core/session/constants.d.ts.map +1 -1
  200. package/dist/core/session/context-metadata.d.ts.map +1 -1
  201. package/dist/core/session/context-metadata.js.map +1 -1
  202. package/dist/core/session/context.d.ts.map +1 -1
  203. package/dist/core/session/context.js.map +1 -1
  204. package/dist/core/session/ids.d.ts.map +1 -1
  205. package/dist/core/session/ids.js.map +1 -1
  206. package/dist/core/session/in-memory-session-manager.d.ts.map +1 -1
  207. package/dist/core/session/in-memory-session-manager.js +0 -1
  208. package/dist/core/session/in-memory-session-manager.js.map +1 -1
  209. package/dist/core/session/in-memory-session.d.ts.map +1 -1
  210. package/dist/core/session/in-memory-session.js.map +1 -1
  211. package/dist/core/session/jsonl-errors.d.ts.map +1 -1
  212. package/dist/core/session/jsonl-errors.js +0 -11
  213. package/dist/core/session/jsonl-errors.js.map +1 -1
  214. package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
  215. package/dist/core/session/jsonl-helpers.js.map +1 -1
  216. package/dist/core/session/local-session-manager.d.ts.map +1 -1
  217. package/dist/core/session/local-session-manager.js +4 -6
  218. package/dist/core/session/local-session-manager.js.map +1 -1
  219. package/dist/core/session/local-session.d.ts.map +1 -1
  220. package/dist/core/session/local-session.js.map +1 -1
  221. package/dist/core/session/migrations.d.ts.map +1 -1
  222. package/dist/core/session/migrations.js.map +1 -1
  223. package/dist/core/session/remote-session-client.d.ts.map +1 -1
  224. package/dist/core/session/remote-session-client.js +0 -6
  225. package/dist/core/session/remote-session-client.js.map +1 -1
  226. package/dist/core/session/remote-session-manager.d.ts.map +1 -1
  227. package/dist/core/session/remote-session-manager.js +0 -3
  228. package/dist/core/session/remote-session-manager.js.map +1 -1
  229. package/dist/core/session/remote-session.d.ts.map +1 -1
  230. package/dist/core/session/remote-session.js +0 -1
  231. package/dist/core/session/remote-session.js.map +1 -1
  232. package/dist/core/session/session-manager.d.ts.map +1 -1
  233. package/dist/core/session/session.d.ts.map +1 -1
  234. package/dist/core/session/session.js +1 -5
  235. package/dist/core/session/session.js.map +1 -1
  236. package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -1
  237. package/dist/core/session/stores/in-memory-session-store.js +7 -6
  238. package/dist/core/session/stores/in-memory-session-store.js.map +1 -1
  239. package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
  240. package/dist/core/session/stores/jsonl-session-store.js +6 -14
  241. package/dist/core/session/stores/jsonl-session-store.js.map +1 -1
  242. package/dist/core/session/stores/remote-session-store.d.ts.map +1 -1
  243. package/dist/core/session/stores/remote-session-store.js +3 -8
  244. package/dist/core/session/stores/remote-session-store.js.map +1 -1
  245. package/dist/core/session/stores/session-store.d.ts.map +1 -1
  246. package/dist/core/session/types.d.ts.map +1 -1
  247. package/dist/core/session/usage-ledger.d.ts.map +1 -1
  248. package/dist/core/session/usage-ledger.js.map +1 -1
  249. package/dist/core/session-cwd.d.ts.map +1 -1
  250. package/dist/core/session-cwd.js +0 -1
  251. package/dist/core/session-cwd.js.map +1 -1
  252. package/dist/core/settings-manager.d.ts.map +1 -1
  253. package/dist/core/settings-manager.js +9 -17
  254. package/dist/core/settings-manager.js.map +1 -1
  255. package/dist/core/skills.d.ts.map +1 -1
  256. package/dist/core/skills.js +3 -2
  257. package/dist/core/skills.js.map +1 -1
  258. package/dist/core/slash-commands.d.ts.map +1 -1
  259. package/dist/core/source-info.d.ts.map +1 -1
  260. package/dist/core/source-info.js.map +1 -1
  261. package/dist/core/system-prompt.d.ts +1 -1
  262. package/dist/core/system-prompt.d.ts.map +1 -1
  263. package/dist/core/system-prompt.js +3 -2
  264. package/dist/core/system-prompt.js.map +1 -1
  265. package/dist/core/telemetry.d.ts.map +1 -1
  266. package/dist/core/telemetry.js.map +1 -1
  267. package/dist/core/timings.d.ts.map +1 -1
  268. package/dist/core/timings.js.map +1 -1
  269. package/dist/core/tools/bash.d.ts +1 -0
  270. package/dist/core/tools/bash.d.ts.map +1 -1
  271. package/dist/core/tools/bash.js +34 -28
  272. package/dist/core/tools/bash.js.map +1 -1
  273. package/dist/core/tools/compress-context.d.ts.map +1 -1
  274. package/dist/core/tools/compress-context.js.map +1 -1
  275. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  276. package/dist/core/tools/edit-diff.js.map +1 -1
  277. package/dist/core/tools/edit.d.ts.map +1 -1
  278. package/dist/core/tools/edit.js.map +1 -1
  279. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  280. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  281. package/dist/core/tools/find.d.ts.map +1 -1
  282. package/dist/core/tools/find.js.map +1 -1
  283. package/dist/core/tools/grep.d.ts.map +1 -1
  284. package/dist/core/tools/grep.js.map +1 -1
  285. package/dist/core/tools/hash-store.d.ts.map +1 -1
  286. package/dist/core/tools/hash-store.js.map +1 -1
  287. package/dist/core/tools/hashline/apply.d.ts.map +1 -1
  288. package/dist/core/tools/hashline/apply.js.map +1 -1
  289. package/dist/core/tools/hashline/hash.d.ts.map +1 -1
  290. package/dist/core/tools/hashline/hash.js.map +1 -1
  291. package/dist/core/tools/hashline/parse.d.ts.map +1 -1
  292. package/dist/core/tools/hashline/parse.js.map +1 -1
  293. package/dist/core/tools/hashline/resolve.d.ts.map +1 -1
  294. package/dist/core/tools/hashline/resolve.js.map +1 -1
  295. package/dist/core/tools/hashline-utils.d.ts.map +1 -1
  296. package/dist/core/tools/hashline-utils.js.map +1 -1
  297. package/dist/core/tools/index.d.ts.map +1 -1
  298. package/dist/core/tools/index.js.map +1 -1
  299. package/dist/core/tools/ls.d.ts.map +1 -1
  300. package/dist/core/tools/ls.js.map +1 -1
  301. package/dist/core/tools/operations.d.ts +11 -0
  302. package/dist/core/tools/operations.d.ts.map +1 -1
  303. package/dist/core/tools/operations.js +54 -28
  304. package/dist/core/tools/operations.js.map +1 -1
  305. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  306. package/dist/core/tools/output-accumulator.js +12 -18
  307. package/dist/core/tools/output-accumulator.js.map +1 -1
  308. package/dist/core/tools/path-utils.d.ts.map +1 -1
  309. package/dist/core/tools/path-utils.js.map +1 -1
  310. package/dist/core/tools/read.d.ts.map +1 -1
  311. package/dist/core/tools/read.js.map +1 -1
  312. package/dist/core/tools/render-utils.d.ts.map +1 -1
  313. package/dist/core/tools/render-utils.js.map +1 -1
  314. package/dist/core/tools/replace-diff.d.ts.map +1 -1
  315. package/dist/core/tools/replace-diff.js.map +1 -1
  316. package/dist/core/tools/replace-normalize.d.ts.map +1 -1
  317. package/dist/core/tools/replace-normalize.js.map +1 -1
  318. package/dist/core/tools/replace-render.d.ts +1 -1
  319. package/dist/core/tools/replace-render.d.ts.map +1 -1
  320. package/dist/core/tools/replace-render.js.map +1 -1
  321. package/dist/core/tools/runtime.d.ts.map +1 -1
  322. package/dist/core/tools/runtime.js.map +1 -1
  323. package/dist/core/tools/session-history.d.ts.map +1 -1
  324. package/dist/core/tools/session-history.js.map +1 -1
  325. package/dist/core/tools/subagent-agents.d.ts.map +1 -1
  326. package/dist/core/tools/subagent-agents.js.map +1 -1
  327. package/dist/core/tools/subagent.d.ts.map +1 -1
  328. package/dist/core/tools/subagent.js.map +1 -1
  329. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  330. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  331. package/dist/core/tools/truncate.d.ts.map +1 -1
  332. package/dist/core/tools/truncate.js.map +1 -1
  333. package/dist/core/tools/websearch.d.ts.map +1 -1
  334. package/dist/core/tools/websearch.js.map +1 -1
  335. package/dist/core/tools/workspace-tool-host.d.ts +1 -0
  336. package/dist/core/tools/workspace-tool-host.d.ts.map +1 -1
  337. package/dist/core/tools/workspace-tool-host.js +36 -22
  338. package/dist/core/tools/workspace-tool-host.js.map +1 -1
  339. package/dist/core/tools/write.d.ts.map +1 -1
  340. package/dist/core/tools/write.js +0 -1
  341. package/dist/core/tools/write.js.map +1 -1
  342. package/dist/core/workspace-identity.d.ts.map +1 -1
  343. package/dist/daemon/activity-budget.d.ts.map +1 -1
  344. package/dist/daemon/activity-budget.js +2 -3
  345. package/dist/daemon/activity-budget.js.map +1 -1
  346. package/dist/daemon/command.d.ts.map +1 -1
  347. package/dist/daemon/command.js.map +1 -1
  348. package/dist/daemon/config.d.ts +2 -0
  349. package/dist/daemon/config.d.ts.map +1 -1
  350. package/dist/daemon/config.js +4 -0
  351. package/dist/daemon/config.js.map +1 -1
  352. package/dist/daemon/help.d.ts.map +1 -1
  353. package/dist/daemon/help.js +4 -3
  354. package/dist/daemon/help.js.map +1 -1
  355. package/dist/daemon/lsp-config.d.ts.map +1 -1
  356. package/dist/daemon/lsp-config.js.map +1 -1
  357. package/dist/daemon/outbound-budget.d.ts.map +1 -1
  358. package/dist/daemon/outbound-budget.js +2 -4
  359. package/dist/daemon/outbound-budget.js.map +1 -1
  360. package/dist/daemon/security.d.ts.map +1 -1
  361. package/dist/daemon/security.js.map +1 -1
  362. package/dist/daemon/server.d.ts.map +1 -1
  363. package/dist/daemon/server.js.map +1 -1
  364. package/dist/daemon/shared-connection.d.ts.map +1 -1
  365. package/dist/daemon/shared-connection.js +10 -15
  366. package/dist/daemon/shared-connection.js.map +1 -1
  367. package/dist/daemon/shared-revision.d.ts.map +1 -1
  368. package/dist/daemon/shared-revision.js +2 -1
  369. package/dist/daemon/shared-revision.js.map +1 -1
  370. package/dist/daemon/shared-roots.d.ts.map +1 -1
  371. package/dist/daemon/shared-roots.js +0 -1
  372. package/dist/daemon/shared-roots.js.map +1 -1
  373. package/dist/daemon/workspace-runtime.d.ts +2 -0
  374. package/dist/daemon/workspace-runtime.d.ts.map +1 -1
  375. package/dist/daemon/workspace-runtime.js +43 -15
  376. package/dist/daemon/workspace-runtime.js.map +1 -1
  377. package/dist/index.d.ts +1 -1
  378. package/dist/index.d.ts.map +1 -1
  379. package/dist/index.js.map +1 -1
  380. package/dist/main.d.ts.map +1 -1
  381. package/dist/main.js +8 -3
  382. package/dist/main.js.map +1 -1
  383. package/dist/migrations.d.ts.map +1 -1
  384. package/dist/migrations.js.map +1 -1
  385. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  386. package/dist/modes/interactive/components/assistant-message.js +3 -10
  387. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  388. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/bash-execution.js +4 -9
  390. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  391. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  392. package/dist/modes/interactive/components/bordered-loader.js +0 -3
  393. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  394. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  395. package/dist/modes/interactive/components/branch-summary-message.js +1 -3
  396. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  397. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  398. package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
  399. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  400. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  401. package/dist/modes/interactive/components/config-selector.js +6 -16
  402. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  403. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  404. package/dist/modes/interactive/components/countdown-timer.js +0 -5
  405. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  406. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  407. package/dist/modes/interactive/components/custom-editor.js +1 -8
  408. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  409. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  410. package/dist/modes/interactive/components/custom-message.js +1 -6
  411. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  412. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  413. package/dist/modes/interactive/components/diff.js.map +1 -1
  414. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  415. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  416. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  417. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  418. package/dist/modes/interactive/components/extension-editor.js +1 -7
  419. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  420. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  421. package/dist/modes/interactive/components/extension-input.js +2 -8
  422. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  423. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  424. package/dist/modes/interactive/components/extension-selector.js +1 -9
  425. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  426. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  427. package/dist/modes/interactive/components/footer.js +8 -4
  428. package/dist/modes/interactive/components/footer.js.map +1 -1
  429. package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
  430. package/dist/modes/interactive/components/hook-execution.js +2 -5
  431. package/dist/modes/interactive/components/hook-execution.js.map +1 -1
  432. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  433. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  434. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  435. package/dist/modes/interactive/components/login-dialog.js +3 -9
  436. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  437. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
  438. package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
  439. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  440. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  441. package/dist/modes/interactive/components/message-card.d.ts.map +1 -1
  442. package/dist/modes/interactive/components/message-card.js +0 -1
  443. package/dist/modes/interactive/components/message-card.js.map +1 -1
  444. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  445. package/dist/modes/interactive/components/model-selector.js +13 -28
  446. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  447. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  448. package/dist/modes/interactive/components/oauth-selector.js +3 -12
  449. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  450. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  451. package/dist/modes/interactive/components/scoped-models-selector.js +9 -13
  452. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  453. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  454. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  455. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  456. package/dist/modes/interactive/components/session-selector.js +33 -58
  457. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  458. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  459. package/dist/modes/interactive/components/settings-selector.js +0 -4
  460. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  461. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  462. package/dist/modes/interactive/components/show-images-selector.js +0 -1
  463. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  464. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  465. package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
  466. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  467. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  468. package/dist/modes/interactive/components/theme-selector.js +0 -2
  469. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  470. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  471. package/dist/modes/interactive/components/thinking-selector.js +0 -1
  472. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  473. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  474. package/dist/modes/interactive/components/tool-execution.js +9 -24
  475. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  476. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  477. package/dist/modes/interactive/components/tree-selector.js +18 -34
  478. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  479. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  480. package/dist/modes/interactive/components/user-message-selector.js +3 -6
  481. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  482. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  483. package/dist/modes/interactive/components/user-message.js +0 -4
  484. package/dist/modes/interactive/components/user-message.js.map +1 -1
  485. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  486. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  487. package/dist/modes/interactive/interactive-mode.d.ts +13 -0
  488. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  489. package/dist/modes/interactive/interactive-mode.js +162 -136
  490. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  491. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  492. package/dist/modes/interactive/theme/theme.js +0 -7
  493. package/dist/modes/interactive/theme/theme.js.map +1 -1
  494. package/dist/modes/json-event.d.ts.map +1 -1
  495. package/dist/modes/json-event.js.map +1 -1
  496. package/dist/modes/print-mode.d.ts.map +1 -1
  497. package/dist/modes/print-mode.js.map +1 -1
  498. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  499. package/dist/modes/rpc/jsonl.js.map +1 -1
  500. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  501. package/dist/modes/rpc/rpc-client.js +10 -11
  502. package/dist/modes/rpc/rpc-client.js.map +1 -1
  503. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  504. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  505. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  506. package/dist/package-manager-cli.d.ts.map +1 -1
  507. package/dist/package-manager-cli.js +33 -2
  508. package/dist/package-manager-cli.js.map +1 -1
  509. package/dist/utils/ansi.d.ts.map +1 -1
  510. package/dist/utils/ansi.js.map +1 -1
  511. package/dist/utils/binary-self-update.d.ts +25 -0
  512. package/dist/utils/binary-self-update.d.ts.map +1 -0
  513. package/dist/utils/binary-self-update.js +159 -0
  514. package/dist/utils/binary-self-update.js.map +1 -0
  515. package/dist/utils/changelog.d.ts.map +1 -1
  516. package/dist/utils/changelog.js.map +1 -1
  517. package/dist/utils/child-process.d.ts.map +1 -1
  518. package/dist/utils/child-process.js.map +1 -1
  519. package/dist/utils/clipboard-image.d.ts.map +1 -1
  520. package/dist/utils/clipboard-image.js.map +1 -1
  521. package/dist/utils/clipboard-native.d.ts.map +1 -1
  522. package/dist/utils/clipboard-native.js.map +1 -1
  523. package/dist/utils/clipboard.d.ts.map +1 -1
  524. package/dist/utils/clipboard.js.map +1 -1
  525. package/dist/utils/deprecation.d.ts.map +1 -1
  526. package/dist/utils/deprecation.js.map +1 -1
  527. package/dist/utils/directory-completions.d.ts +8 -0
  528. package/dist/utils/directory-completions.d.ts.map +1 -1
  529. package/dist/utils/directory-completions.js +42 -1
  530. package/dist/utils/directory-completions.js.map +1 -1
  531. package/dist/utils/exif-orientation.d.ts.map +1 -1
  532. package/dist/utils/exif-orientation.js.map +1 -1
  533. package/dist/utils/frontmatter.d.ts.map +1 -1
  534. package/dist/utils/frontmatter.js.map +1 -1
  535. package/dist/utils/fs-watch.d.ts.map +1 -1
  536. package/dist/utils/fs-watch.js.map +1 -1
  537. package/dist/utils/git.d.ts.map +1 -1
  538. package/dist/utils/git.js.map +1 -1
  539. package/dist/utils/grip-user-agent.d.ts.map +1 -1
  540. package/dist/utils/grip-user-agent.js.map +1 -1
  541. package/dist/utils/html.d.ts.map +1 -1
  542. package/dist/utils/html.js.map +1 -1
  543. package/dist/utils/image-convert.d.ts.map +1 -1
  544. package/dist/utils/image-convert.js.map +1 -1
  545. package/dist/utils/image-process.d.ts.map +1 -1
  546. package/dist/utils/image-process.js.map +1 -1
  547. package/dist/utils/image-resize-core.d.ts.map +1 -1
  548. package/dist/utils/image-resize-core.js.map +1 -1
  549. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  550. package/dist/utils/image-resize-worker.js.map +1 -1
  551. package/dist/utils/image-resize.d.ts.map +1 -1
  552. package/dist/utils/image-resize.js.map +1 -1
  553. package/dist/utils/json.d.ts.map +1 -1
  554. package/dist/utils/json.js.map +1 -1
  555. package/dist/utils/mime.d.ts.map +1 -1
  556. package/dist/utils/mime.js.map +1 -1
  557. package/dist/utils/open-browser.d.ts.map +1 -1
  558. package/dist/utils/open-browser.js.map +1 -1
  559. package/dist/utils/paths.d.ts.map +1 -1
  560. package/dist/utils/paths.js.map +1 -1
  561. package/dist/utils/photon.d.ts.map +1 -1
  562. package/dist/utils/photon.js +10 -5
  563. package/dist/utils/photon.js.map +1 -1
  564. package/dist/utils/shell.d.ts.map +1 -1
  565. package/dist/utils/shell.js.map +1 -1
  566. package/dist/utils/sleep.d.ts.map +1 -1
  567. package/dist/utils/sleep.js.map +1 -1
  568. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  569. package/dist/utils/syntax-highlight.js +1 -1
  570. package/dist/utils/syntax-highlight.js.map +1 -1
  571. package/dist/utils/tools-manager.d.ts.map +1 -1
  572. package/dist/utils/tools-manager.js.map +1 -1
  573. package/dist/utils/version-check.d.ts.map +1 -1
  574. package/dist/utils/version-check.js.map +1 -1
  575. package/dist/utils/windows-self-update.d.ts.map +1 -1
  576. package/dist/utils/windows-self-update.js.map +1 -1
  577. package/docs/extensions.md +31 -1
  578. package/docs/sandbox.md +6 -0
  579. package/docs/sessions.md +1 -1
  580. package/docs/skills.md +4 -4
  581. package/docs/usage.md +2 -1
  582. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  583. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  584. package/examples/extensions/sandbox/package.json +2 -2
  585. package/examples/extensions/with-deps/package.json +1 -1
  586. package/npm-shrinkwrap.json +602 -834
  587. package/package.json +20 -21
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAkB,MAAM,iBAAiB,CAAC;AAE1D,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAU,CAAC;AAEpG,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,iBAAiB;IACjB,cAAc;IACd,sBAAsB;IACtB,YAAY;IACZ,eAAe;IACf,WAAW;CACF,CAAC;AAIX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;I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kBAAkB,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAAC;SAC9F;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA6B,EAAgC;IACzG,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB;YACrB,OAAO,UAAU,CAAC;QACnB,KAAK,gBAAgB;YACpB,OAAO,SAAS,CAAC;QAClB,KAAK,aAAa;YACjB,OAAO,SAAS,CAAC;QAClB;YACC,OAAO,MAAM,CAAC;IAChB,CAAC;AAAA,CACD","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { type Static, Type } from \"typebox\";\nimport { Compile, type Validator } from \"typebox/compile\";\n\nexport const REMOTE_WORKSPACE_PROTOCOL_VERSIONS = [{ major: 1, minMinor: 0, maxMinor: 0 }] as const;\n\nexport const REMOTE_WORKSPACE_CAPABILITIES = [\n\t\"catalog_refresh\",\n\t\"tool_updates\",\n\t\"primitive_operations\",\n\t\"lsp_status\",\n\t\"file_transfer\",\n\t\"artifacts\",\n] as const;\n\nexport type RemoteWorkspaceCapability = (typeof REMOTE_WORKSPACE_CAPABILITIES)[number];\n\nexport const REMOTE_WORKSPACE_METHODS = [\n\t\"catalog.get\",\n\t\"tool.invoke\",\n\t\"workspace.access\",\n\t\"workspace.read\",\n\t\"workspace.write\",\n\t\"workspace.mkdir\",\n\t\"workspace.stat\",\n\t\"workspace.readdir\",\n\t\"workspace.glob\",\n\t\"workspace.grep\",\n\t\"workspace.detect_image_mime\",\n\t\"workspace.exec\",\n\t\"lsp.status\",\n\t\"resource.read\",\n\t\"artifact.read\",\n\t\"transfer.upload\",\n\t\"transfer.download\",\n] as const;\n\nexport type RemoteWorkspaceMethod = (typeof REMOTE_WORKSPACE_METHODS)[number];\n\nexport const REMOTE_WORKSPACE_ERROR_CODES = [\n\t\"invalid_request\",\n\t\"method_not_supported\",\n\t\"incompatible_version\",\n\t\"capability_mismatch\",\n\t\"schema_mismatch\",\n\t\"stale_generation\",\n\t\"not_available\",\n\t\"limit_exceeded\",\n\t\"deadline_exceeded\",\n\t\"cancelled\",\n\t\"conflict\",\n\t\"generation_retired\",\n\t\"connection_draining\",\n\t\"result_too_large\",\n\t\"internal_error\",\n] as const;\n\nexport type RemoteWorkspaceErrorCode = (typeof REMOTE_WORKSPACE_ERROR_CODES)[number];\nexport type RemoteWorkspaceExecutionState = \"not_started\" | \"completed\" | \"indeterminate\";\nexport type RemoteWorkspacePathFlavor = \"posix\" | \"windows\";\nexport type RemoteWorkspaceOperationKind = \"read\" | \"mutation\" | \"process\" | \"service\";\n\nexport interface RemoteWorkspaceStructuralLimits {\n\tmaxMessageBytes: number;\n\tmaxStringBytes: number;\n\tmaxDepth: number;\n\tmaxObjectKeys: number;\n\tmaxArrayLength: number;\n\tmaxNodes: number;\n}\n\nexport interface RemoteWorkspaceProtocolLimits extends RemoteWorkspaceStructuralLimits {\n\tmaxRequestMs: number;\n\tmaxTransferChunkBytes: number;\n\tmaxPendingTransferBytes: number;\n\tmaxPendingInboundBytes: number;\n\tmaxPendingInboundMessages: number;\n\tmaxPendingOutboundBytes: number;\n\tmaxPendingOutboundMessages: number;\n\tmaxTransferBytes: number;\n\tmaxTransferChunks: number;\n\tmaxActiveRequests: number;\n\tmaxActiveTransfers: number;\n\tmaxCancellationMs: number;\n\tmaxTransportSendMs: number;\n}\n\nexport const DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS: RemoteWorkspaceProtocolLimits = {\n\tmaxMessageBytes: 2 * 1024 * 1024,\n\tmaxStringBytes: 1536 * 1024,\n\tmaxDepth: 32,\n\tmaxObjectKeys: 4096,\n\tmaxArrayLength: 4096,\n\tmaxNodes: 16_384,\n\tmaxRequestMs: 10 * 60 * 1000,\n\tmaxTransferChunkBytes: 64 * 1024,\n\tmaxPendingTransferBytes: 256 * 1024,\n\tmaxPendingInboundBytes: 4 * 1024 * 1024,\n\tmaxPendingInboundMessages: 64,\n\tmaxPendingOutboundBytes: 4 * 1024 * 1024,\n\tmaxPendingOutboundMessages: 128,\n\tmaxTransferBytes: 100 * 1024 * 1024,\n\tmaxTransferChunks: 16_384,\n\tmaxActiveRequests: 64,\n\tmaxActiveTransfers: 8,\n\tmaxCancellationMs: 100,\n\tmaxTransportSendMs: 10_000,\n};\n\nconst closedObject = { additionalProperties: false } as const;\nconst safeIntegerOptions = { minimum: 0, maximum: Number.MAX_SAFE_INTEGER } as const;\nconst RequestIdSchema = Type.String({ minLength: 1, maxLength: 128, pattern: \"^[A-Za-z0-9._:-]+$\" });\nconst HashSchema = Type.String({ pattern: \"^[0-9a-f]{64}$\" });\nconst CapabilitySchema = Type.String({ minLength: 1, maxLength: 128, pattern: \"^[a-z][a-z0-9_.-]*$\" });\nconst RemoteWorkspaceMethodSchema = Type.Union([\n\tType.Literal(\"catalog.get\"),\n\tType.Literal(\"tool.invoke\"),\n\tType.Literal(\"workspace.access\"),\n\tType.Literal(\"workspace.read\"),\n\tType.Literal(\"workspace.write\"),\n\tType.Literal(\"workspace.mkdir\"),\n\tType.Literal(\"workspace.stat\"),\n\tType.Literal(\"workspace.readdir\"),\n\tType.Literal(\"workspace.glob\"),\n\tType.Literal(\"workspace.grep\"),\n\tType.Literal(\"workspace.detect_image_mime\"),\n\tType.Literal(\"workspace.exec\"),\n\tType.Literal(\"lsp.status\"),\n\tType.Literal(\"resource.read\"),\n\tType.Literal(\"artifact.read\"),\n\tType.Literal(\"transfer.upload\"),\n\tType.Literal(\"transfer.download\"),\n]);\n\nexport const RemoteWorkspaceVersionRangeSchema = Type.Object(\n\t{\n\t\tmajor: Type.Integer({ minimum: 1, maximum: 65535 }),\n\t\tminMinor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t\tmaxMinor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceVersionRange = Static<typeof RemoteWorkspaceVersionRangeSchema>;\n\nexport const RemoteWorkspaceVersionSchema = Type.Object(\n\t{\n\t\tmajor: Type.Integer({ minimum: 1, maximum: 65535 }),\n\t\tminor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceVersion = Static<typeof RemoteWorkspaceVersionSchema>;\n\nexport const RemoteWorkspaceLimitsSchema = Type.Object(\n\t{\n\t\tmaxMessageBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxStringBytes: Type.Integer({ minimum: 1, maximum: 64 * 1024 * 1024 }),\n\t\tmaxDepth: Type.Integer({ minimum: 1, maximum: 256 }),\n\t\tmaxObjectKeys: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxArrayLength: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxNodes: Type.Integer({ minimum: 1, maximum: 2_000_000 }),\n\t\tmaxRequestMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),\n\t\tmaxTransferChunkBytes: Type.Integer({ minimum: 1024, maximum: 1024 * 1024 }),\n\t\tmaxPendingTransferBytes: Type.Integer({ minimum: 1024, maximum: 16 * 1024 * 1024 }),\n\t\tmaxPendingInboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxPendingInboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),\n\t\tmaxPendingOutboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxPendingOutboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),\n\t\tmaxTransferBytes: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tmaxTransferChunks: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxActiveRequests: Type.Integer({ minimum: 1, maximum: 10_000_000 }),\n\t\tmaxActiveTransfers: Type.Integer({ minimum: 1, maximum: 10_000 }),\n\t\tmaxCancellationMs: Type.Integer({ minimum: 1, maximum: 60_000 }),\n\t\tmaxTransportSendMs: Type.Integer({ minimum: 1, maximum: 5 * 60_000 }),\n\t},\n\tclosedObject,\n);\n\nexport const RemoteWorkspaceIdentitySchema = Type.Object(\n\t{\n\t\tid: Type.String({ minLength: 16, maxLength: 128, pattern: \"^[A-Za-z0-9_-]+$\" }),\n\t\troot: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tpathFlavor: Type.Union([Type.Literal(\"posix\"), Type.Literal(\"windows\")]),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceIdentity = Static<typeof RemoteWorkspaceIdentitySchema>;\n\nexport const RemoteWorkspaceToolCatalogEntrySchema = Type.Object(\n\t{\n\t\tname: Type.String({ minLength: 1, maxLength: 128, pattern: \"^[A-Za-z][A-Za-z0-9_.-]*$\" }),\n\t\texecutionMode: Type.Union([\n\t\t\tType.Literal(\"read\"),\n\t\t\tType.Literal(\"mutation\"),\n\t\t\tType.Literal(\"process\"),\n\t\t\tType.Literal(\"service\"),\n\t\t]),\n\t\tparameterSchema: Type.Record(Type.String({ maxLength: 256 }), Type.Unknown()),\n\t\tschemaHash: HashSchema,\n\t\tfeatureFlags: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceToolCatalogEntry = Static<typeof RemoteWorkspaceToolCatalogEntrySchema>;\n\nexport const RemoteWorkspaceCatalogSchema = Type.Object(\n\t{\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\ttools: Type.Array(RemoteWorkspaceToolCatalogEntrySchema, { maxItems: 1024 }),\n\t\toperations: Type.Array(RemoteWorkspaceMethodSchema, { maxItems: 256 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCatalog = Static<typeof RemoteWorkspaceCatalogSchema>;\n\nexport const RemoteWorkspaceHandshakeSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"handshake\"),\n\t\tid: RequestIdSchema,\n\t\tversions: Type.Array(RemoteWorkspaceVersionRangeSchema, { minItems: 1, maxItems: 16 }),\n\t\trequiredCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\toptionalCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\treceiveLimits: RemoteWorkspaceLimitsSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceHandshake = Static<typeof RemoteWorkspaceHandshakeSchema>;\n\nexport const RemoteWorkspaceHandshakeAckSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"handshake_ack\"),\n\t\tid: RequestIdSchema,\n\t\tversion: RemoteWorkspaceVersionSchema,\n\t\tcapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t\tlimits: RemoteWorkspaceLimitsSchema,\n\t\tcatalog: RemoteWorkspaceCatalogSchema,\n\t\tcatalogHash: HashSchema,\n\t\tbackendMetadata: Type.Object(\n\t\t\t{\n\t\t\t\tkind: Type.Literal(\"remote-workspace\"),\n\t\t\t\tlabel: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),\n\t\t\t},\n\t\t\tclosedObject,\n\t\t),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceHandshakeAck = Static<typeof RemoteWorkspaceHandshakeAckSchema>;\n\nexport const RemoteWorkspaceRequestSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"request\"),\n\t\tid: RequestIdSchema,\n\t\tmethod: Type.String({ minLength: 1, maxLength: 128 }),\n\t\ttimeoutMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),\n\t\tparams: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceRequest = Static<typeof RemoteWorkspaceRequestSchema>;\n\nexport const RemoteWorkspaceCancelSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"cancel\"),\n\t\tid: RequestIdSchema,\n\t\treason: Type.Optional(Type.String({ maxLength: 256 })),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCancel = Static<typeof RemoteWorkspaceCancelSchema>;\n\nexport const RemoteWorkspaceTransferChunkSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_chunk\"),\n\t\tid: RequestIdSchema,\n\t\tsequence: Type.Integer(safeIntegerOptions),\n\t\tdataBase64: Type.String({ minLength: 4 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferChunk = Static<typeof RemoteWorkspaceTransferChunkSchema>;\n\nexport const RemoteWorkspaceTransferFinishSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_finish\"),\n\t\tid: RequestIdSchema,\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferFinish = Static<typeof RemoteWorkspaceTransferFinishSchema>;\n\nexport const RemoteWorkspaceResultSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"result\"),\n\t\tid: RequestIdSchema,\n\t\tresult: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceResult = Static<typeof RemoteWorkspaceResultSchema>;\n\nexport const RemoteWorkspaceProtocolErrorSchema = Type.Object(\n\t{\n\t\tcode: Type.Union([\n\t\t\tType.Literal(\"invalid_request\"),\n\t\t\tType.Literal(\"method_not_supported\"),\n\t\t\tType.Literal(\"incompatible_version\"),\n\t\t\tType.Literal(\"capability_mismatch\"),\n\t\t\tType.Literal(\"schema_mismatch\"),\n\t\t\tType.Literal(\"stale_generation\"),\n\t\t\tType.Literal(\"not_available\"),\n\t\t\tType.Literal(\"limit_exceeded\"),\n\t\t\tType.Literal(\"deadline_exceeded\"),\n\t\t\tType.Literal(\"cancelled\"),\n\t\t\tType.Literal(\"conflict\"),\n\t\t\tType.Literal(\"generation_retired\"),\n\t\t\tType.Literal(\"connection_draining\"),\n\t\t\tType.Literal(\"result_too_large\"),\n\t\t\tType.Literal(\"internal_error\"),\n\t\t]),\n\t\tmessage: Type.String({ minLength: 1, maxLength: 4096 }),\n\t\texecutionState: Type.Union([\n\t\t\tType.Literal(\"not_started\"),\n\t\t\tType.Literal(\"completed\"),\n\t\t\tType.Literal(\"indeterminate\"),\n\t\t]),\n\t\tretryable: Type.Boolean(),\n\t\tdetails: Type.Optional(Type.Unknown()),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceProtocolError = Static<typeof RemoteWorkspaceProtocolErrorSchema>;\n\nexport const RemoteWorkspaceErrorMessageSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"error\"),\n\t\tid: RequestIdSchema,\n\t\terror: RemoteWorkspaceProtocolErrorSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceErrorMessage = Static<typeof RemoteWorkspaceErrorMessageSchema>;\n\nexport const RemoteWorkspaceUpdateSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"update\"),\n\t\tid: RequestIdSchema,\n\t\tsequence: Type.Integer(safeIntegerOptions),\n\t\tupdate: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceUpdate = Static<typeof RemoteWorkspaceUpdateSchema>;\n\nexport const RemoteWorkspaceTransferStartSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_start\"),\n\t\tid: RequestIdSchema,\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferStart = Static<typeof RemoteWorkspaceTransferStartSchema>;\n\nexport const RemoteWorkspaceCatalogChangedSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"catalog_changed\"),\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tcatalogHash: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCatalogChanged = Static<typeof RemoteWorkspaceCatalogChangedSchema>;\n\nexport const RemoteWorkspaceClientMessageSchema = Type.Union([\n\tRemoteWorkspaceHandshakeSchema,\n\tRemoteWorkspaceRequestSchema,\n\tRemoteWorkspaceCancelSchema,\n\tRemoteWorkspaceTransferChunkSchema,\n\tRemoteWorkspaceTransferFinishSchema,\n]);\n\nexport const RemoteWorkspaceServerMessageSchema = Type.Union([\n\tRemoteWorkspaceHandshakeAckSchema,\n\tRemoteWorkspaceResultSchema,\n\tRemoteWorkspaceErrorMessageSchema,\n\tRemoteWorkspaceUpdateSchema,\n\tRemoteWorkspaceTransferStartSchema,\n\tRemoteWorkspaceTransferChunkSchema,\n\tRemoteWorkspaceCatalogChangedSchema,\n]);\n\nexport type RemoteWorkspaceClientMessage = Static<typeof RemoteWorkspaceClientMessageSchema>;\nexport type RemoteWorkspaceServerMessage = Static<typeof RemoteWorkspaceServerMessageSchema>;\n\nconst EmptyParamsSchema = Type.Object({}, closedObject);\nconst PathParamsSchema = Type.Object({ path: Type.String({ minLength: 1, maxLength: 32_768 }) }, closedObject);\nconst CatalogGetParamsSchema = EmptyParamsSchema;\nconst SessionEnvironmentSchema = Type.Object(\n\t{\n\t\tGRIP_SESSION_ID: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_SESSION_FILE: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_PROVIDER: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_MODEL: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_REASONING_LEVEL: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t},\n\tclosedObject,\n);\n/** Shared v2 mutations require an observed digest/absence, or an explicitly unsafe write. */\nconst ExpectedRevisionSchema = Type.Union([\n\tType.Object({ sha256: HashSchema }, closedObject),\n\tType.Object({ absent: Type.Literal(true) }, closedObject),\n\tType.Object({ unsafeOverwrite: Type.Literal(true) }, closedObject),\n]);\nexport type ExpectedWorkspaceRevision = Static<typeof ExpectedRevisionSchema>;\nconst ToolInvokeParamsSchema = Type.Object(\n\t{\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tcatalogHash: HashSchema,\n\t\ttoolName: Type.String({ minLength: 1, maxLength: 128 }),\n\t\tschemaHash: HashSchema,\n\t\targumentsPrepared: Type.Literal(true),\n\t\targuments: Type.Unknown(),\n\t\texpectedRevision: Type.Optional(ExpectedRevisionSchema),\n\t\texecutionOptions: Type.Object(\n\t\t\t{\n\t\t\t\timageAutoResize: Type.Optional(Type.Boolean()),\n\t\t\t\tshellCommandPrefix: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\t\t\tsessionEnvironment: Type.Optional(SessionEnvironmentSchema),\n\t\t\t},\n\t\t\tclosedObject,\n\t\t),\n\t},\n\tclosedObject,\n);\nconst AccessParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tmode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"exists\"), Type.Literal(\"read\"), Type.Literal(\"write\"), Type.Literal(\"readwrite\")]),\n\t\t),\n\t},\n\tclosedObject,\n);\nconst WriteParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tcontentBase64: Type.String(),\n\t\texpectedRevision: Type.Optional(ExpectedRevisionSchema),\n\t},\n\tclosedObject,\n);\nconst MkdirParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\trecursive: Type.Boolean(),\n\t},\n\tclosedObject,\n);\nconst GlobParamsSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tcwd: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tignore: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 4096 }),\n\t\tlimit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t},\n\tclosedObject,\n);\nconst GrepParamsSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({ maxLength: 1024 * 1024 }),\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tglob: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tignoreCase: Type.Optional(Type.Boolean()),\n\t\tliteral: Type.Optional(Type.Boolean()),\n\t\tlimit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t},\n\tclosedObject,\n);\nconst ExecParamsSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1 }),\n\t\tcwd: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t},\n\tclosedObject,\n);\nconst TransferUploadParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t\toverwrite: Type.Boolean(),\n\t},\n\tclosedObject,\n);\nconst TransferDownloadParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t},\n\tclosedObject,\n);\n\nconst ToolContentSchema = Type.Union([\n\tType.Object({ type: Type.Literal(\"text\"), text: Type.String() }, closedObject),\n\tType.Object(\n\t\t{\n\t\t\ttype: Type.Literal(\"image\"),\n\t\t\tdata: Type.String(),\n\t\t\tmimeType: Type.String({ minLength: 1, maxLength: 256 }),\n\t\t},\n\t\tclosedObject,\n\t),\n]);\nconst ToolResultSchema = Type.Object(\n\t{\n\t\tcontent: Type.Array(ToolContentSchema),\n\t\tdetails: Type.Optional(Type.Unknown()),\n\t\tterminate: Type.Optional(Type.Boolean()),\n\t},\n\tclosedObject,\n);\nconst EmptyResultSchema = EmptyParamsSchema;\nconst LspStatusServerSchema = Type.Object(\n\t{\n\t\tserverId: Type.String({ minLength: 1, maxLength: 256 }),\n\t\tlanguageIds: Type.Array(Type.String({ maxLength: 256 }), { maxItems: 256 }),\n\t\ttransport: Type.String({ minLength: 1, maxLength: 128 }),\n\t\tinstanceKey: Type.Optional(Type.String({ maxLength: 4096 })),\n\t\tworkspaceRoot: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tendpoint: Type.Optional(Type.String({ maxLength: 4096 })),\n\t\trootUri: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\townership: Type.Union([Type.Literal(\"managed\"), Type.Literal(\"attached\")]),\n\t\tshutdownMode: Type.Union([Type.Literal(\"protocol\"), Type.Literal(\"disconnect\")]),\n\t\tstate: Type.Union([\n\t\t\tType.Literal(\"idle\"),\n\t\t\tType.Literal(\"connecting\"),\n\t\t\tType.Literal(\"initializing\"),\n\t\t\tType.Literal(\"running\"),\n\t\t\tType.Literal(\"closed\"),\n\t\t\tType.Literal(\"failed\"),\n\t\t\tType.Literal(\"disposed\"),\n\t\t]),\n\t\treconnectEligible: Type.Boolean(),\n\t\trunning: Type.Boolean(),\n\t\tstarting: Type.Boolean(),\n\t\tdiagnosticsCount: Type.Integer(safeIntegerOptions),\n\t\tlastError: Type.Optional(Type.String()),\n\t\tlastRequestError: Type.Optional(Type.String()),\n\t\tstderr: Type.Optional(Type.String()),\n\t\tsynchronizationError: Type.Optional(Type.String()),\n\t},\n\tclosedObject,\n);\nconst LspStatusResultSchema = Type.Object(\n\t{ enabled: Type.Boolean(), servers: Type.Array(LspStatusServerSchema, { maxItems: 1024 }) },\n\tclosedObject,\n);\nexport type RemoteLspStatus = Static<typeof LspStatusResultSchema>;\nconst ReadResultSchema = Type.Object(\n\t{\n\t\tcontentBase64: Type.String(),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t\trevision: Type.Optional(HashSchema),\n\t},\n\tclosedObject,\n);\nconst StatResultSchema = Type.Object(\n\t{\n\t\tkind: Type.Union([\n\t\t\tType.Literal(\"file\"),\n\t\t\tType.Literal(\"directory\"),\n\t\t\tType.Literal(\"other\"),\n\t\t\tType.Literal(\"absent\"),\n\t\t]),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst ReaddirResultSchema = Type.Object(\n\t{\n\t\tentries: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst GlobResultSchema = Type.Object(\n\t{\n\t\tmatches: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst GrepResultSchema = Type.Object(\n\t{\n\t\tisDirectory: Type.Boolean(),\n\t\tmatches: Type.Array(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tfilePath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\t\t\t\tlineNumber: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\t\t\t\tlineText: Type.Optional(Type.String()),\n\t\t\t\t},\n\t\t\t\tclosedObject,\n\t\t\t),\n\t\t\t{ maxItems: 1_000_000 },\n\t\t),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst MimeResultSchema = Type.Object(\n\t{\n\t\tmimeType: Type.Union([\n\t\t\tType.Literal(\"image/jpeg\"),\n\t\t\tType.Literal(\"image/png\"),\n\t\t\tType.Literal(\"image/gif\"),\n\t\t\tType.Literal(\"image/webp\"),\n\t\t\tType.Null(),\n\t\t]),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst ExecResultSchema = Type.Object(\n\t{ exitCode: Type.Union([Type.Integer({ minimum: 0, maximum: 255 }), Type.Null()]) },\n\tclosedObject,\n);\nconst TransferResultSchema = Type.Object(\n\t{\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nconst parameterValidators = {\n\t\"catalog.get\": Compile(CatalogGetParamsSchema),\n\t\"tool.invoke\": Compile(ToolInvokeParamsSchema),\n\t\"workspace.access\": Compile(AccessParamsSchema),\n\t\"workspace.read\": Compile(PathParamsSchema),\n\t\"workspace.write\": Compile(WriteParamsSchema),\n\t\"workspace.mkdir\": Compile(MkdirParamsSchema),\n\t\"workspace.stat\": Compile(PathParamsSchema),\n\t\"workspace.readdir\": Compile(PathParamsSchema),\n\t\"workspace.glob\": Compile(GlobParamsSchema),\n\t\"workspace.grep\": Compile(GrepParamsSchema),\n\t\"workspace.detect_image_mime\": Compile(PathParamsSchema),\n\t\"workspace.exec\": Compile(ExecParamsSchema),\n\t\"lsp.status\": Compile(EmptyParamsSchema),\n\t\"resource.read\": Compile(PathParamsSchema),\n\t\"artifact.read\": Compile(PathParamsSchema),\n\t\"transfer.upload\": Compile(TransferUploadParamsSchema),\n\t\"transfer.download\": Compile(TransferDownloadParamsSchema),\n} satisfies Record<RemoteWorkspaceMethod, ReturnType<typeof Compile>>;\n\nconst resultValidators = {\n\t\"catalog.get\": Compile(RemoteWorkspaceCatalogSchema),\n\t\"tool.invoke\": Compile(ToolResultSchema),\n\t\"workspace.access\": Compile(EmptyResultSchema),\n\t\"workspace.read\": Compile(ReadResultSchema),\n\t\"workspace.write\": Compile(EmptyResultSchema),\n\t\"workspace.mkdir\": Compile(EmptyResultSchema),\n\t\"workspace.stat\": Compile(StatResultSchema),\n\t\"workspace.readdir\": Compile(ReaddirResultSchema),\n\t\"workspace.glob\": Compile(GlobResultSchema),\n\t\"workspace.grep\": Compile(GrepResultSchema),\n\t\"workspace.detect_image_mime\": Compile(MimeResultSchema),\n\t\"workspace.exec\": Compile(ExecResultSchema),\n\t\"lsp.status\": Compile(LspStatusResultSchema),\n\t\"resource.read\": Compile(ReadResultSchema),\n\t\"artifact.read\": Compile(TransferResultSchema),\n\t\"transfer.upload\": Compile(TransferResultSchema),\n\t\"transfer.download\": Compile(TransferResultSchema),\n} satisfies Record<RemoteWorkspaceMethod, ReturnType<typeof Compile> | undefined>;\n\nconst clientMessageValidator = Compile(RemoteWorkspaceClientMessageSchema);\nconst serverMessageValidator = Compile(RemoteWorkspaceServerMessageSchema);\nconst handshakeAckValidator = Compile(RemoteWorkspaceHandshakeAckSchema);\nconst limitsValidator = Compile(RemoteWorkspaceLimitsSchema);\n\nexport class RemoteWorkspaceValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteWorkspaceValidationError\";\n\t}\n}\n\nfunction validationMessage(validator: Validator, value: unknown): string {\n\tconst error = validator.Errors(value)[0];\n\tif (!error) return \"value does not match the protocol schema\";\n\treturn `${error.instancePath || \"/\"}: ${error.message}`;\n}\n\nfunction parseWithValidator<T>(validator: Validator, value: unknown, label: string): T {\n\tif (!validator.Check(value)) {\n\t\tthrow new RemoteWorkspaceValidationError(`Invalid ${label}: ${validationMessage(validator, value)}`);\n\t}\n\treturn value as T;\n}\n\nexport function validateRemoteWorkspaceProtocolLimits(value: unknown): RemoteWorkspaceProtocolLimits {\n\tconst limits = parseWithValidator<RemoteWorkspaceProtocolLimits>(limitsValidator, value, \"protocol limits\");\n\tif (limits.maxMessageBytes > limits.maxPendingInboundBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxMessageBytes must not exceed maxPendingInboundBytes\");\n\t}\n\tif (limits.maxMessageBytes > limits.maxPendingOutboundBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxMessageBytes must not exceed maxPendingOutboundBytes\");\n\t}\n\tif (limits.maxTransferChunkBytes > limits.maxPendingTransferBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxTransferChunkBytes must not exceed maxPendingTransferBytes\");\n\t}\n\tif (Math.ceil((limits.maxTransferChunkBytes * 4) / 3) + 512 > limits.maxMessageBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxTransferChunkBytes must fit in one base64 protocol message\");\n\t}\n\treturn limits;\n}\n\ninterface RemoteWorkspacePendingValue {\n\tvalue: unknown;\n\tdepth: number;\n}\n\ninterface RemoteWorkspaceStructureState {\n\tpending: RemoteWorkspacePendingValue[];\n\tnodes: number;\n\tobjectKeys: number;\n\tlimits: RemoteWorkspaceStructuralLimits;\n}\n\nfunction validateRemoteWorkspaceNodeBudget(depth: number, state: RemoteWorkspaceStructureState): void {\n\tstate.nodes++;\n\tif (state.nodes > state.limits.maxNodes)\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol value exceeds node limit\");\n\tif (depth > state.limits.maxDepth) throw new RemoteWorkspaceValidationError(\"Protocol value exceeds depth limit\");\n}\n\nfunction validateRemoteWorkspaceScalar(value: unknown, limits: RemoteWorkspaceStructuralLimits): boolean {\n\tif (value === null || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new RemoteWorkspaceValidationError(\"Protocol numbers must be finite\");\n\t\treturn true;\n\t}\n\tif (typeof value !== \"string\") return false;\n\tif (Buffer.byteLength(value, \"utf8\") > limits.maxStringBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol string exceeds byte limit\");\n\t}\n\treturn true;\n}\n\nfunction enqueueRemoteWorkspaceArray(value: unknown[], depth: number, state: RemoteWorkspaceStructureState): void {\n\tif (value.length > state.limits.maxArrayLength) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol array exceeds item limit\");\n\t}\n\tfor (let index = value.length - 1; index >= 0; index--) {\n\t\tstate.pending.push({ value: value[index], depth: depth + 1 });\n\t}\n}\n\nfunction enqueueRemoteWorkspaceObject(value: unknown, depth: number, state: RemoteWorkspaceStructureState): void {\n\tif (value === null || typeof value !== \"object\")\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol values must be JSON-compatible\");\n\tconst prototype = Object.getPrototypeOf(value);\n\tif (prototype !== Object.prototype && prototype !== null) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol objects must be plain JSON objects\");\n\t}\n\tconst entries = Object.entries(value);\n\tif (entries.length > state.limits.maxObjectKeys) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol object exceeds key limit\");\n\t}\n\tstate.objectKeys += entries.length;\n\tif (state.objectKeys > state.limits.maxObjectKeys) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol value exceeds total key limit\");\n\t}\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (!entry) continue;\n\t\tif (Buffer.byteLength(entry[0], \"utf8\") > state.limits.maxStringBytes) {\n\t\t\tthrow new RemoteWorkspaceValidationError(\"Protocol object key exceeds byte limit\");\n\t\t}\n\t\tstate.pending.push({ value: entry[1], depth: depth + 1 });\n\t}\n}\n\nexport function assertRemoteWorkspaceJsonStructure(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): void {\n\tconst state: RemoteWorkspaceStructureState = {\n\t\tpending: [{ value, depth: 1 }],\n\t\tnodes: 0,\n\t\tobjectKeys: 0,\n\t\tlimits,\n\t};\n\twhile (state.pending.length > 0) {\n\t\tconst current = state.pending.pop();\n\t\tif (!current) break;\n\t\tvalidateRemoteWorkspaceNodeBudget(current.depth, state);\n\t\tif (validateRemoteWorkspaceScalar(current.value, limits)) continue;\n\t\tif (Array.isArray(current.value)) {\n\t\t\tenqueueRemoteWorkspaceArray(current.value, current.depth, state);\n\t\t\tcontinue;\n\t\t}\n\t\tenqueueRemoteWorkspaceObject(current.value, current.depth, state);\n\t}\n}\n\nexport function decodeRemoteWorkspaceMessage(\n\tpayload: string | Uint8Array,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tconst bytes = typeof payload === \"string\" ? Buffer.from(payload, \"utf8\") : payload;\n\tif (bytes.byteLength > limits.maxMessageBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol message exceeds byte limit\");\n\t}\n\tconst text = typeof payload === \"string\" ? payload : new TextDecoder(\"utf-8\", { fatal: true }).decode(payload);\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(text) as unknown;\n\t} catch (error) {\n\t\tthrow new RemoteWorkspaceValidationError(\n\t\t\t`Protocol message is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn value;\n}\n\nexport function parseRemoteWorkspaceClientMessage(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): RemoteWorkspaceClientMessage {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator<RemoteWorkspaceClientMessage>(clientMessageValidator, value, \"client message\");\n}\n\nexport function parseRemoteWorkspaceServerMessage(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): RemoteWorkspaceServerMessage {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator<RemoteWorkspaceServerMessage>(serverMessageValidator, value, \"server message\");\n}\n\nexport function isRemoteWorkspaceMethod(method: string): method is RemoteWorkspaceMethod {\n\treturn (REMOTE_WORKSPACE_METHODS as readonly string[]).includes(method);\n}\n\nexport function parseRemoteWorkspaceRequestParams(\n\tmethod: RemoteWorkspaceMethod,\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\tconst parsed = parseWithValidator(parameterValidators[method], value, `${method} params`);\n\tif (method === \"workspace.write\") {\n\t\tdecodeCanonicalBase64((parsed as { contentBase64: string }).contentBase64, limits.maxMessageBytes);\n\t}\n\treturn parsed;\n}\n\nexport function parseRemoteWorkspaceResult(\n\tmethod: RemoteWorkspaceMethod,\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\tconst validator = resultValidators[method];\n\tconst parsed = validator ? parseWithValidator(validator, value, `${method} result`) : value;\n\tif (method === \"workspace.read\" || method === \"resource.read\") {\n\t\tdecodeCanonicalBase64((parsed as { contentBase64: string }).contentBase64, limits.maxMessageBytes);\n\t}\n\treturn parsed;\n}\n\nexport function parseRemoteWorkspaceToolResult(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator(Compile(ToolResultSchema), value, \"tool result\");\n}\n\nexport function decodeCanonicalBase64(value: string, maxBytes: number): Buffer {\n\tif (value.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value)) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Transfer data is not canonical base64\");\n\t}\n\tconst decoded = Buffer.from(value, \"base64\");\n\tif (decoded.byteLength > maxBytes) throw new RemoteWorkspaceValidationError(\"Transfer chunk exceeds byte limit\");\n\tif (decoded.toString(\"base64\") !== value) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Transfer data is not canonical base64\");\n\t}\n\treturn decoded;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tif (value === null) return \"null\";\n\tif (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new RemoteWorkspaceValidationError(\"Cannot hash a non-finite number\");\n\t\treturn JSON.stringify(value);\n\t}\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (Array.isArray(value)) return `[${value.map((entry) => canonicalJson(entry)).join(\",\")}]`;\n\tif (typeof value !== \"object\" || value === undefined) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Cannot hash a non-JSON value\");\n\t}\n\tconst entries = Object.entries(value).sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));\n\treturn `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n}\n\nexport function hashRemoteWorkspaceJson(value: unknown): string {\n\tassertRemoteWorkspaceJsonStructure(value);\n\treturn createHash(\"sha256\").update(canonicalJson(value)).digest(\"hex\");\n}\n\nexport function hashRemoteWorkspaceCatalog(catalog: RemoteWorkspaceCatalog): string {\n\treturn hashRemoteWorkspaceJson(catalog);\n}\n\nfunction assertUnique(values: readonly string[], label: string): void {\n\tif (new Set(values).size !== values.length) throw new RemoteWorkspaceValidationError(`${label} contains duplicates`);\n}\n\nexport function validateRemoteWorkspaceCatalog(catalog: RemoteWorkspaceCatalog): void {\n\tparseWithValidator(Compile(RemoteWorkspaceCatalogSchema), catalog, \"tool catalog\");\n\tassertUnique(catalog.operations, \"Catalog operations\");\n\tassertUnique(\n\t\tcatalog.tools.map((tool) => tool.name),\n\t\t\"Catalog tool names\",\n\t);\n\tfor (const tool of catalog.tools) {\n\t\tassertUnique(tool.featureFlags, `Feature flags for ${tool.name}`);\n\t\tif (hashRemoteWorkspaceJson(tool.parameterSchema) !== tool.schemaHash) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Schema hash mismatch for tool ${tool.name}`);\n\t\t}\n\t}\n}\n\nexport function validateRemoteWorkspaceLocalToolSchemas(\n\tcatalog: RemoteWorkspaceCatalog,\n\tlocalToolSchemas: ReadonlyMap<string, string>,\n): void {\n\tfor (const tool of catalog.tools) {\n\t\tconst localHash = localToolSchemas.get(tool.name);\n\t\tif (localHash !== undefined && localHash !== tool.schemaHash) {\n\t\t\tthrow new RemoteWorkspaceValidationError(\n\t\t\t\t`Remote schema does not match the local canonical schema for ${tool.name}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function validateRemoteWorkspaceHandshakeAck(\n\tack: unknown,\n\toffer: RemoteWorkspaceHandshake,\n\tlocalToolSchemas: ReadonlyMap<string, string> = new Map(),\n): RemoteWorkspaceHandshakeAck {\n\tconst parsed = parseWithValidator<RemoteWorkspaceHandshakeAck>(handshakeAckValidator, ack, \"handshake response\");\n\tvalidateRemoteWorkspaceProtocolLimits(offer.receiveLimits);\n\tvalidateRemoteWorkspaceProtocolLimits(parsed.limits);\n\tconst selected = offer.versions.some(\n\t\t(range) =>\n\t\t\trange.major === parsed.version.major &&\n\t\t\trange.minMinor <= parsed.version.minor &&\n\t\t\trange.maxMinor >= parsed.version.minor,\n\t);\n\tif (!selected)\n\t\tthrow new RemoteWorkspaceValidationError(\"Server selected a protocol version outside the offered range\");\n\tconst offeredCapabilities = new Set([...offer.requiredCapabilities, ...offer.optionalCapabilities]);\n\tfor (const capability of parsed.capabilities) {\n\t\tif (!offeredCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server selected an unoffered capability: ${capability}`);\n\t\t}\n\t}\n\tconst selectedCapabilities = new Set(parsed.capabilities);\n\tfor (const capability of offer.requiredCapabilities) {\n\t\tif (!selectedCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server omitted required capability: ${capability}`);\n\t\t}\n\t}\n\tassertUnique(parsed.capabilities, \"Negotiated capabilities\");\n\tvalidateRemoteWorkspaceCatalog(parsed.catalog);\n\tif (hashRemoteWorkspaceCatalog(parsed.catalog) !== parsed.catalogHash) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Catalog hash does not match the negotiated catalog\");\n\t}\n\tvalidateRemoteWorkspaceLocalToolSchemas(parsed.catalog, localToolSchemas);\n\tfor (const key of Object.keys(offer.receiveLimits) as (keyof RemoteWorkspaceProtocolLimits)[]) {\n\t\tif (parsed.limits[key] > offer.receiveLimits[key]) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server increased negotiated limit: ${key}`);\n\t\t}\n\t}\n\treturn parsed;\n}\n\nexport interface RemoteWorkspaceNegotiationOptions {\n\tserverVersions: readonly RemoteWorkspaceVersionRange[];\n\tserverCapabilities: readonly string[];\n\trequiredClientCapabilities?: readonly string[];\n\tserverLimits: RemoteWorkspaceProtocolLimits;\n}\n\nexport interface RemoteWorkspaceNegotiationResult {\n\tversion: RemoteWorkspaceVersion;\n\tcapabilities: string[];\n\tlimits: RemoteWorkspaceProtocolLimits;\n}\n\nexport type RemoteWorkspaceNegotiationErrorCode = \"incompatible_version\" | \"capability_mismatch\";\n\nexport class RemoteWorkspaceNegotiationError extends Error {\n\treadonly code: RemoteWorkspaceNegotiationErrorCode;\n\n\tconstructor(code: RemoteWorkspaceNegotiationErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteWorkspaceNegotiationError\";\n\t\tthis.code = code;\n\t}\n}\n\nfunction validateVersionRanges(ranges: readonly RemoteWorkspaceVersionRange[], label: string): void {\n\tfor (const range of ranges) {\n\t\tif (range.minMinor > range.maxMinor) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\"incompatible_version\", `${label} has an inverted minor range`);\n\t\t}\n\t}\n}\n\nfunction findCompatibleRemoteWorkspaceVersions(\n\tclientVersions: readonly RemoteWorkspaceVersionRange[],\n\tserverVersions: readonly RemoteWorkspaceVersionRange[],\n): RemoteWorkspaceVersion[] {\n\tconst serverVersionsByMajor = new Map<number, RemoteWorkspaceVersionRange[]>();\n\tfor (const server of serverVersions) {\n\t\tconst ranges = serverVersionsByMajor.get(server.major) ?? [];\n\t\tranges.push(server);\n\t\tserverVersionsByMajor.set(server.major, ranges);\n\t}\n\tconst candidates: RemoteWorkspaceVersion[] = [];\n\tfor (const client of clientVersions) {\n\t\tfor (const server of serverVersionsByMajor.get(client.major) ?? []) {\n\t\t\tconst minMinor = Math.max(client.minMinor, server.minMinor);\n\t\t\tconst maxMinor = Math.min(client.maxMinor, server.maxMinor);\n\t\t\tif (minMinor <= maxMinor) candidates.push({ major: client.major, minor: maxMinor });\n\t\t}\n\t}\n\treturn candidates;\n}\n\nexport function negotiateRemoteWorkspaceHandshake(\n\thandshake: RemoteWorkspaceHandshake,\n\toptions: RemoteWorkspaceNegotiationOptions,\n): RemoteWorkspaceNegotiationResult {\n\tvalidateRemoteWorkspaceProtocolLimits(handshake.receiveLimits);\n\tvalidateRemoteWorkspaceProtocolLimits(options.serverLimits);\n\tvalidateVersionRanges(handshake.versions, \"Client version offer\");\n\tvalidateVersionRanges(options.serverVersions, \"Server version offer\");\n\tassertUnique(handshake.requiredCapabilities, \"Required capabilities\");\n\tassertUnique(handshake.optionalCapabilities, \"Optional capabilities\");\n\tconst optionalCapabilities = new Set(handshake.optionalCapabilities);\n\tconst duplicateOffer = handshake.requiredCapabilities.find((capability) => optionalCapabilities.has(capability));\n\tif (duplicateOffer) {\n\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\"capability_mismatch\",\n\t\t\t`Capability is both required and optional: ${duplicateOffer}`,\n\t\t);\n\t}\n\tconst candidates = findCompatibleRemoteWorkspaceVersions(handshake.versions, options.serverVersions);\n\tcandidates.sort((left, right) => right.major - left.major || right.minor - left.minor);\n\tconst version = candidates[0];\n\tif (!version) {\n\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\"incompatible_version\",\n\t\t\t\"No compatible remote workspace protocol version\",\n\t\t);\n\t}\n\tconst serverCapabilities = new Set(options.serverCapabilities);\n\tfor (const capability of handshake.requiredCapabilities) {\n\t\tif (!serverCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\t\"capability_mismatch\",\n\t\t\t\t`Server does not support required capability: ${capability}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst clientCapabilities = new Set([...handshake.requiredCapabilities, ...handshake.optionalCapabilities]);\n\tfor (const capability of options.requiredClientCapabilities ?? []) {\n\t\tif (!clientCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\t\"capability_mismatch\",\n\t\t\t\t`Client does not support required capability: ${capability}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst capabilities = Array.from(clientCapabilities)\n\t\t.filter((capability) => serverCapabilities.has(capability))\n\t\t.sort();\n\tconst clientLimits = handshake.receiveLimits;\n\tconst serverLimits = options.serverLimits;\n\treturn {\n\t\tversion,\n\t\tcapabilities,\n\t\tlimits: {\n\t\t\tmaxMessageBytes: Math.min(clientLimits.maxMessageBytes, serverLimits.maxMessageBytes),\n\t\t\tmaxStringBytes: Math.min(clientLimits.maxStringBytes, serverLimits.maxStringBytes),\n\t\t\tmaxDepth: Math.min(clientLimits.maxDepth, serverLimits.maxDepth),\n\t\t\tmaxObjectKeys: Math.min(clientLimits.maxObjectKeys, serverLimits.maxObjectKeys),\n\t\t\tmaxArrayLength: Math.min(clientLimits.maxArrayLength, serverLimits.maxArrayLength),\n\t\t\tmaxNodes: Math.min(clientLimits.maxNodes, serverLimits.maxNodes),\n\t\t\tmaxRequestMs: Math.min(clientLimits.maxRequestMs, serverLimits.maxRequestMs),\n\t\t\tmaxTransferChunkBytes: Math.min(clientLimits.maxTransferChunkBytes, serverLimits.maxTransferChunkBytes),\n\t\t\tmaxPendingTransferBytes: Math.min(clientLimits.maxPendingTransferBytes, serverLimits.maxPendingTransferBytes),\n\t\t\tmaxPendingInboundBytes: Math.min(clientLimits.maxPendingInboundBytes, serverLimits.maxPendingInboundBytes),\n\t\t\tmaxPendingInboundMessages: Math.min(\n\t\t\t\tclientLimits.maxPendingInboundMessages,\n\t\t\t\tserverLimits.maxPendingInboundMessages,\n\t\t\t),\n\t\t\tmaxPendingOutboundBytes: Math.min(clientLimits.maxPendingOutboundBytes, serverLimits.maxPendingOutboundBytes),\n\t\t\tmaxPendingOutboundMessages: Math.min(\n\t\t\t\tclientLimits.maxPendingOutboundMessages,\n\t\t\t\tserverLimits.maxPendingOutboundMessages,\n\t\t\t),\n\t\t\tmaxTransferBytes: Math.min(clientLimits.maxTransferBytes, serverLimits.maxTransferBytes),\n\t\t\tmaxTransferChunks: Math.min(clientLimits.maxTransferChunks, serverLimits.maxTransferChunks),\n\t\t\tmaxActiveRequests: Math.min(clientLimits.maxActiveRequests, serverLimits.maxActiveRequests),\n\t\t\tmaxActiveTransfers: Math.min(clientLimits.maxActiveTransfers, serverLimits.maxActiveTransfers),\n\t\t\tmaxCancellationMs: Math.min(clientLimits.maxCancellationMs, serverLimits.maxCancellationMs),\n\t\t\tmaxTransportSendMs: Math.min(clientLimits.maxTransportSendMs, serverLimits.maxTransportSendMs),\n\t\t},\n\t};\n}\n\nexport function getRemoteWorkspaceMethodKind(method: RemoteWorkspaceMethod): RemoteWorkspaceOperationKind {\n\tswitch (method) {\n\t\tcase \"workspace.write\":\n\t\tcase \"workspace.mkdir\":\n\t\tcase \"transfer.upload\":\n\t\t\treturn \"mutation\";\n\t\tcase \"workspace.exec\":\n\t\t\treturn \"process\";\n\t\tcase \"tool.invoke\":\n\t\t\treturn \"service\";\n\t\tdefault:\n\t\t\treturn \"read\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAkB,MAAM,iBAAiB,CAAC;AAE1D,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAU,CAAC;AAEpG,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,iBAAiB;IACjB,cAAc;IACd,sBAAsB;IACtB,YAAY;IACZ,eAAe;IACf,WAAW;CACF,CAAC;AAIX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,6BAA6B;IA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AC,iBAAiB,CAAC;YAC3F,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,CAAC;YAC3F,kBAAkB,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAAC;YAC9F,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,CAAC;YAC3F,kBAAkB,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAAC;SAC9F;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA6B;IACzE,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB;YACrB,OAAO,UAAU,CAAC;QACnB,KAAK,gBAAgB;YACpB,OAAO,SAAS,CAAC;QAClB,KAAK,aAAa;YACjB,OAAO,SAAS,CAAC;QAClB;YACC,OAAO,MAAM,CAAC;IAChB,CAAC;AACF,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { type Static, Type } from \"typebox\";\nimport { Compile, type Validator } from \"typebox/compile\";\n\nexport const REMOTE_WORKSPACE_PROTOCOL_VERSIONS = [{ major: 1, minMinor: 0, maxMinor: 0 }] as const;\n\nexport const REMOTE_WORKSPACE_CAPABILITIES = [\n\t\"catalog_refresh\",\n\t\"tool_updates\",\n\t\"primitive_operations\",\n\t\"lsp_status\",\n\t\"file_transfer\",\n\t\"artifacts\",\n] as const;\n\nexport type RemoteWorkspaceCapability = (typeof REMOTE_WORKSPACE_CAPABILITIES)[number];\n\nexport const REMOTE_WORKSPACE_METHODS = [\n\t\"catalog.get\",\n\t\"tool.invoke\",\n\t\"workspace.access\",\n\t\"workspace.read\",\n\t\"workspace.write\",\n\t\"workspace.mkdir\",\n\t\"workspace.stat\",\n\t\"workspace.readdir\",\n\t\"workspace.glob\",\n\t\"workspace.grep\",\n\t\"workspace.detect_image_mime\",\n\t\"workspace.exec\",\n\t\"lsp.status\",\n\t\"resource.read\",\n\t\"artifact.read\",\n\t\"transfer.upload\",\n\t\"transfer.download\",\n] as const;\n\nexport type RemoteWorkspaceMethod = (typeof REMOTE_WORKSPACE_METHODS)[number];\n\nexport const REMOTE_WORKSPACE_ERROR_CODES = [\n\t\"invalid_request\",\n\t\"method_not_supported\",\n\t\"incompatible_version\",\n\t\"capability_mismatch\",\n\t\"schema_mismatch\",\n\t\"stale_generation\",\n\t\"not_available\",\n\t\"limit_exceeded\",\n\t\"deadline_exceeded\",\n\t\"cancelled\",\n\t\"conflict\",\n\t\"generation_retired\",\n\t\"connection_draining\",\n\t\"result_too_large\",\n\t\"internal_error\",\n] as const;\n\nexport type RemoteWorkspaceErrorCode = (typeof REMOTE_WORKSPACE_ERROR_CODES)[number];\nexport type RemoteWorkspaceExecutionState = \"not_started\" | \"completed\" | \"indeterminate\";\nexport type RemoteWorkspacePathFlavor = \"posix\" | \"windows\";\nexport type RemoteWorkspaceOperationKind = \"read\" | \"mutation\" | \"process\" | \"service\";\n\nexport interface RemoteWorkspaceStructuralLimits {\n\tmaxMessageBytes: number;\n\tmaxStringBytes: number;\n\tmaxDepth: number;\n\tmaxObjectKeys: number;\n\tmaxArrayLength: number;\n\tmaxNodes: number;\n}\n\nexport interface RemoteWorkspaceProtocolLimits extends RemoteWorkspaceStructuralLimits {\n\tmaxRequestMs: number;\n\tmaxTransferChunkBytes: number;\n\tmaxPendingTransferBytes: number;\n\tmaxPendingInboundBytes: number;\n\tmaxPendingInboundMessages: number;\n\tmaxPendingOutboundBytes: number;\n\tmaxPendingOutboundMessages: number;\n\tmaxTransferBytes: number;\n\tmaxTransferChunks: number;\n\tmaxActiveRequests: number;\n\tmaxActiveTransfers: number;\n\tmaxCancellationMs: number;\n\tmaxTransportSendMs: number;\n}\n\nexport const DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS: RemoteWorkspaceProtocolLimits = {\n\tmaxMessageBytes: 2 * 1024 * 1024,\n\tmaxStringBytes: 1536 * 1024,\n\tmaxDepth: 32,\n\tmaxObjectKeys: 4096,\n\tmaxArrayLength: 4096,\n\tmaxNodes: 16_384,\n\tmaxRequestMs: 10 * 60 * 1000,\n\tmaxTransferChunkBytes: 64 * 1024,\n\tmaxPendingTransferBytes: 256 * 1024,\n\tmaxPendingInboundBytes: 4 * 1024 * 1024,\n\tmaxPendingInboundMessages: 64,\n\tmaxPendingOutboundBytes: 4 * 1024 * 1024,\n\tmaxPendingOutboundMessages: 128,\n\tmaxTransferBytes: 100 * 1024 * 1024,\n\tmaxTransferChunks: 16_384,\n\tmaxActiveRequests: 64,\n\tmaxActiveTransfers: 8,\n\tmaxCancellationMs: 100,\n\tmaxTransportSendMs: 10_000,\n};\n\nconst closedObject = { additionalProperties: false } as const;\nconst safeIntegerOptions = { minimum: 0, maximum: Number.MAX_SAFE_INTEGER } as const;\nconst RequestIdSchema = Type.String({ minLength: 1, maxLength: 128, pattern: \"^[A-Za-z0-9._:-]+$\" });\nconst HashSchema = Type.String({ pattern: \"^[0-9a-f]{64}$\" });\nconst CapabilitySchema = Type.String({ minLength: 1, maxLength: 128, pattern: \"^[a-z][a-z0-9_.-]*$\" });\nconst RemoteWorkspaceMethodSchema = Type.Union([\n\tType.Literal(\"catalog.get\"),\n\tType.Literal(\"tool.invoke\"),\n\tType.Literal(\"workspace.access\"),\n\tType.Literal(\"workspace.read\"),\n\tType.Literal(\"workspace.write\"),\n\tType.Literal(\"workspace.mkdir\"),\n\tType.Literal(\"workspace.stat\"),\n\tType.Literal(\"workspace.readdir\"),\n\tType.Literal(\"workspace.glob\"),\n\tType.Literal(\"workspace.grep\"),\n\tType.Literal(\"workspace.detect_image_mime\"),\n\tType.Literal(\"workspace.exec\"),\n\tType.Literal(\"lsp.status\"),\n\tType.Literal(\"resource.read\"),\n\tType.Literal(\"artifact.read\"),\n\tType.Literal(\"transfer.upload\"),\n\tType.Literal(\"transfer.download\"),\n]);\n\nexport const RemoteWorkspaceVersionRangeSchema = Type.Object(\n\t{\n\t\tmajor: Type.Integer({ minimum: 1, maximum: 65535 }),\n\t\tminMinor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t\tmaxMinor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceVersionRange = Static<typeof RemoteWorkspaceVersionRangeSchema>;\n\nexport const RemoteWorkspaceVersionSchema = Type.Object(\n\t{\n\t\tmajor: Type.Integer({ minimum: 1, maximum: 65535 }),\n\t\tminor: Type.Integer({ minimum: 0, maximum: 65535 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceVersion = Static<typeof RemoteWorkspaceVersionSchema>;\n\nexport const RemoteWorkspaceLimitsSchema = Type.Object(\n\t{\n\t\tmaxMessageBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxStringBytes: Type.Integer({ minimum: 1, maximum: 64 * 1024 * 1024 }),\n\t\tmaxDepth: Type.Integer({ minimum: 1, maximum: 256 }),\n\t\tmaxObjectKeys: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxArrayLength: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxNodes: Type.Integer({ minimum: 1, maximum: 2_000_000 }),\n\t\tmaxRequestMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),\n\t\tmaxTransferChunkBytes: Type.Integer({ minimum: 1024, maximum: 1024 * 1024 }),\n\t\tmaxPendingTransferBytes: Type.Integer({ minimum: 1024, maximum: 16 * 1024 * 1024 }),\n\t\tmaxPendingInboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxPendingInboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),\n\t\tmaxPendingOutboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),\n\t\tmaxPendingOutboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),\n\t\tmaxTransferBytes: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tmaxTransferChunks: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t\tmaxActiveRequests: Type.Integer({ minimum: 1, maximum: 10_000_000 }),\n\t\tmaxActiveTransfers: Type.Integer({ minimum: 1, maximum: 10_000 }),\n\t\tmaxCancellationMs: Type.Integer({ minimum: 1, maximum: 60_000 }),\n\t\tmaxTransportSendMs: Type.Integer({ minimum: 1, maximum: 5 * 60_000 }),\n\t},\n\tclosedObject,\n);\n\nexport const RemoteWorkspaceIdentitySchema = Type.Object(\n\t{\n\t\tid: Type.String({ minLength: 16, maxLength: 128, pattern: \"^[A-Za-z0-9_-]+$\" }),\n\t\troot: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tpathFlavor: Type.Union([Type.Literal(\"posix\"), Type.Literal(\"windows\")]),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceIdentity = Static<typeof RemoteWorkspaceIdentitySchema>;\n\nexport const RemoteWorkspaceToolCatalogEntrySchema = Type.Object(\n\t{\n\t\tname: Type.String({ minLength: 1, maxLength: 128, pattern: \"^[A-Za-z][A-Za-z0-9_.-]*$\" }),\n\t\texecutionMode: Type.Union([\n\t\t\tType.Literal(\"read\"),\n\t\t\tType.Literal(\"mutation\"),\n\t\t\tType.Literal(\"process\"),\n\t\t\tType.Literal(\"service\"),\n\t\t]),\n\t\tparameterSchema: Type.Record(Type.String({ maxLength: 256 }), Type.Unknown()),\n\t\tschemaHash: HashSchema,\n\t\tfeatureFlags: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceToolCatalogEntry = Static<typeof RemoteWorkspaceToolCatalogEntrySchema>;\n\nexport const RemoteWorkspaceCatalogSchema = Type.Object(\n\t{\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\ttools: Type.Array(RemoteWorkspaceToolCatalogEntrySchema, { maxItems: 1024 }),\n\t\toperations: Type.Array(RemoteWorkspaceMethodSchema, { maxItems: 256 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCatalog = Static<typeof RemoteWorkspaceCatalogSchema>;\n\nexport const RemoteWorkspaceHandshakeSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"handshake\"),\n\t\tid: RequestIdSchema,\n\t\tversions: Type.Array(RemoteWorkspaceVersionRangeSchema, { minItems: 1, maxItems: 16 }),\n\t\trequiredCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\toptionalCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\treceiveLimits: RemoteWorkspaceLimitsSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceHandshake = Static<typeof RemoteWorkspaceHandshakeSchema>;\n\nexport const RemoteWorkspaceHandshakeAckSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"handshake_ack\"),\n\t\tid: RequestIdSchema,\n\t\tversion: RemoteWorkspaceVersionSchema,\n\t\tcapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t\tlimits: RemoteWorkspaceLimitsSchema,\n\t\tcatalog: RemoteWorkspaceCatalogSchema,\n\t\tcatalogHash: HashSchema,\n\t\tbackendMetadata: Type.Object(\n\t\t\t{\n\t\t\t\tkind: Type.Literal(\"remote-workspace\"),\n\t\t\t\tlabel: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),\n\t\t\t},\n\t\t\tclosedObject,\n\t\t),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceHandshakeAck = Static<typeof RemoteWorkspaceHandshakeAckSchema>;\n\nexport const RemoteWorkspaceRequestSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"request\"),\n\t\tid: RequestIdSchema,\n\t\tmethod: Type.String({ minLength: 1, maxLength: 128 }),\n\t\ttimeoutMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),\n\t\tparams: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceRequest = Static<typeof RemoteWorkspaceRequestSchema>;\n\nexport const RemoteWorkspaceCancelSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"cancel\"),\n\t\tid: RequestIdSchema,\n\t\treason: Type.Optional(Type.String({ maxLength: 256 })),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCancel = Static<typeof RemoteWorkspaceCancelSchema>;\n\nexport const RemoteWorkspaceTransferChunkSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_chunk\"),\n\t\tid: RequestIdSchema,\n\t\tsequence: Type.Integer(safeIntegerOptions),\n\t\tdataBase64: Type.String({ minLength: 4 }),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferChunk = Static<typeof RemoteWorkspaceTransferChunkSchema>;\n\nexport const RemoteWorkspaceTransferFinishSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_finish\"),\n\t\tid: RequestIdSchema,\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferFinish = Static<typeof RemoteWorkspaceTransferFinishSchema>;\n\nexport const RemoteWorkspaceResultSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"result\"),\n\t\tid: RequestIdSchema,\n\t\tresult: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceResult = Static<typeof RemoteWorkspaceResultSchema>;\n\nexport const RemoteWorkspaceProtocolErrorSchema = Type.Object(\n\t{\n\t\tcode: Type.Union([\n\t\t\tType.Literal(\"invalid_request\"),\n\t\t\tType.Literal(\"method_not_supported\"),\n\t\t\tType.Literal(\"incompatible_version\"),\n\t\t\tType.Literal(\"capability_mismatch\"),\n\t\t\tType.Literal(\"schema_mismatch\"),\n\t\t\tType.Literal(\"stale_generation\"),\n\t\t\tType.Literal(\"not_available\"),\n\t\t\tType.Literal(\"limit_exceeded\"),\n\t\t\tType.Literal(\"deadline_exceeded\"),\n\t\t\tType.Literal(\"cancelled\"),\n\t\t\tType.Literal(\"conflict\"),\n\t\t\tType.Literal(\"generation_retired\"),\n\t\t\tType.Literal(\"connection_draining\"),\n\t\t\tType.Literal(\"result_too_large\"),\n\t\t\tType.Literal(\"internal_error\"),\n\t\t]),\n\t\tmessage: Type.String({ minLength: 1, maxLength: 4096 }),\n\t\texecutionState: Type.Union([\n\t\t\tType.Literal(\"not_started\"),\n\t\t\tType.Literal(\"completed\"),\n\t\t\tType.Literal(\"indeterminate\"),\n\t\t]),\n\t\tretryable: Type.Boolean(),\n\t\tdetails: Type.Optional(Type.Unknown()),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceProtocolError = Static<typeof RemoteWorkspaceProtocolErrorSchema>;\n\nexport const RemoteWorkspaceErrorMessageSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"error\"),\n\t\tid: RequestIdSchema,\n\t\terror: RemoteWorkspaceProtocolErrorSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceErrorMessage = Static<typeof RemoteWorkspaceErrorMessageSchema>;\n\nexport const RemoteWorkspaceUpdateSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"update\"),\n\t\tid: RequestIdSchema,\n\t\tsequence: Type.Integer(safeIntegerOptions),\n\t\tupdate: Type.Unknown(),\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceUpdate = Static<typeof RemoteWorkspaceUpdateSchema>;\n\nexport const RemoteWorkspaceTransferStartSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"transfer_start\"),\n\t\tid: RequestIdSchema,\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceTransferStart = Static<typeof RemoteWorkspaceTransferStartSchema>;\n\nexport const RemoteWorkspaceCatalogChangedSchema = Type.Object(\n\t{\n\t\ttype: Type.Literal(\"catalog_changed\"),\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tcatalogHash: HashSchema,\n\t},\n\tclosedObject,\n);\n\nexport type RemoteWorkspaceCatalogChanged = Static<typeof RemoteWorkspaceCatalogChangedSchema>;\n\nexport const RemoteWorkspaceClientMessageSchema = Type.Union([\n\tRemoteWorkspaceHandshakeSchema,\n\tRemoteWorkspaceRequestSchema,\n\tRemoteWorkspaceCancelSchema,\n\tRemoteWorkspaceTransferChunkSchema,\n\tRemoteWorkspaceTransferFinishSchema,\n]);\n\nexport const RemoteWorkspaceServerMessageSchema = Type.Union([\n\tRemoteWorkspaceHandshakeAckSchema,\n\tRemoteWorkspaceResultSchema,\n\tRemoteWorkspaceErrorMessageSchema,\n\tRemoteWorkspaceUpdateSchema,\n\tRemoteWorkspaceTransferStartSchema,\n\tRemoteWorkspaceTransferChunkSchema,\n\tRemoteWorkspaceCatalogChangedSchema,\n]);\n\nexport type RemoteWorkspaceClientMessage = Static<typeof RemoteWorkspaceClientMessageSchema>;\nexport type RemoteWorkspaceServerMessage = Static<typeof RemoteWorkspaceServerMessageSchema>;\n\nconst EmptyParamsSchema = Type.Object({}, closedObject);\nconst PathParamsSchema = Type.Object({ path: Type.String({ minLength: 1, maxLength: 32_768 }) }, closedObject);\nconst WorkspaceStatParamsSchema = Type.Object(\n\t{ path: Type.String({ minLength: 1, maxLength: 32_768 }), workspaceOnly: Type.Optional(Type.Boolean()) },\n\tclosedObject,\n);\nconst CatalogGetParamsSchema = EmptyParamsSchema;\nconst SessionEnvironmentSchema = Type.Object(\n\t{\n\t\tGRIP_SESSION_ID: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_SESSION_FILE: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_PROVIDER: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_MODEL: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tGRIP_REASONING_LEVEL: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t},\n\tclosedObject,\n);\n/** Shared v2 mutations require an observed digest/absence, or an explicitly unsafe write. */\nconst ExpectedRevisionSchema = Type.Union([\n\tType.Object({ sha256: HashSchema }, closedObject),\n\tType.Object({ absent: Type.Literal(true) }, closedObject),\n\tType.Object({ unsafeOverwrite: Type.Literal(true) }, closedObject),\n]);\nexport type ExpectedWorkspaceRevision = Static<typeof ExpectedRevisionSchema>;\nconst ToolInvokeParamsSchema = Type.Object(\n\t{\n\t\tgeneration: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\tcatalogHash: HashSchema,\n\t\ttoolName: Type.String({ minLength: 1, maxLength: 128 }),\n\t\tschemaHash: HashSchema,\n\t\targumentsPrepared: Type.Literal(true),\n\t\targuments: Type.Unknown(),\n\t\texpectedRevision: Type.Optional(ExpectedRevisionSchema),\n\t\texecutionOptions: Type.Object(\n\t\t\t{\n\t\t\t\timageAutoResize: Type.Optional(Type.Boolean()),\n\t\t\t\tshellCommandPrefix: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\t\t\tsessionEnvironment: Type.Optional(SessionEnvironmentSchema),\n\t\t\t\tcwd: Type.Optional(Type.String({ minLength: 1, maxLength: 32_768 })),\n\t\t\t},\n\t\t\tclosedObject,\n\t\t),\n\t},\n\tclosedObject,\n);\nconst AccessParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tmode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"exists\"), Type.Literal(\"read\"), Type.Literal(\"write\"), Type.Literal(\"readwrite\")]),\n\t\t),\n\t},\n\tclosedObject,\n);\nconst WriteParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tcontentBase64: Type.String(),\n\t\texpectedRevision: Type.Optional(ExpectedRevisionSchema),\n\t},\n\tclosedObject,\n);\nconst MkdirParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\trecursive: Type.Boolean(),\n\t},\n\tclosedObject,\n);\nconst GlobParamsSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tcwd: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tignore: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 4096 }),\n\t\tlimit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t},\n\tclosedObject,\n);\nconst GrepParamsSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({ maxLength: 1024 * 1024 }),\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tglob: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tignoreCase: Type.Optional(Type.Boolean()),\n\t\tliteral: Type.Optional(Type.Boolean()),\n\t\tlimit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),\n\t},\n\tclosedObject,\n);\nconst ExecParamsSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1 }),\n\t\tcwd: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t},\n\tclosedObject,\n);\nconst TransferUploadParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t\toverwrite: Type.Boolean(),\n\t},\n\tclosedObject,\n);\nconst TransferDownloadParamsSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t},\n\tclosedObject,\n);\n\nconst ToolContentSchema = Type.Union([\n\tType.Object({ type: Type.Literal(\"text\"), text: Type.String() }, closedObject),\n\tType.Object(\n\t\t{\n\t\t\ttype: Type.Literal(\"image\"),\n\t\t\tdata: Type.String(),\n\t\t\tmimeType: Type.String({ minLength: 1, maxLength: 256 }),\n\t\t},\n\t\tclosedObject,\n\t),\n]);\nconst ToolResultSchema = Type.Object(\n\t{\n\t\tcontent: Type.Array(ToolContentSchema),\n\t\tdetails: Type.Optional(Type.Unknown()),\n\t\tterminate: Type.Optional(Type.Boolean()),\n\t},\n\tclosedObject,\n);\nconst EmptyResultSchema = EmptyParamsSchema;\nconst LspStatusServerSchema = Type.Object(\n\t{\n\t\tserverId: Type.String({ minLength: 1, maxLength: 256 }),\n\t\tlanguageIds: Type.Array(Type.String({ maxLength: 256 }), { maxItems: 256 }),\n\t\ttransport: Type.String({ minLength: 1, maxLength: 128 }),\n\t\tinstanceKey: Type.Optional(Type.String({ maxLength: 4096 })),\n\t\tworkspaceRoot: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\tendpoint: Type.Optional(Type.String({ maxLength: 4096 })),\n\t\trootUri: Type.Optional(Type.String({ maxLength: 32_768 })),\n\t\townership: Type.Union([Type.Literal(\"managed\"), Type.Literal(\"attached\")]),\n\t\tshutdownMode: Type.Union([Type.Literal(\"protocol\"), Type.Literal(\"disconnect\")]),\n\t\tstate: Type.Union([\n\t\t\tType.Literal(\"idle\"),\n\t\t\tType.Literal(\"connecting\"),\n\t\t\tType.Literal(\"initializing\"),\n\t\t\tType.Literal(\"running\"),\n\t\t\tType.Literal(\"closed\"),\n\t\t\tType.Literal(\"failed\"),\n\t\t\tType.Literal(\"disposed\"),\n\t\t]),\n\t\treconnectEligible: Type.Boolean(),\n\t\trunning: Type.Boolean(),\n\t\tstarting: Type.Boolean(),\n\t\tdiagnosticsCount: Type.Integer(safeIntegerOptions),\n\t\tlastError: Type.Optional(Type.String()),\n\t\tlastRequestError: Type.Optional(Type.String()),\n\t\tstderr: Type.Optional(Type.String()),\n\t\tsynchronizationError: Type.Optional(Type.String()),\n\t},\n\tclosedObject,\n);\nconst LspStatusResultSchema = Type.Object(\n\t{ enabled: Type.Boolean(), servers: Type.Array(LspStatusServerSchema, { maxItems: 1024 }) },\n\tclosedObject,\n);\nexport type RemoteLspStatus = Static<typeof LspStatusResultSchema>;\nconst ReadResultSchema = Type.Object(\n\t{\n\t\tcontentBase64: Type.String(),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t\trevision: Type.Optional(HashSchema),\n\t},\n\tclosedObject,\n);\nconst StatResultSchema = Type.Object(\n\t{\n\t\tkind: Type.Union([\n\t\t\tType.Literal(\"file\"),\n\t\t\tType.Literal(\"directory\"),\n\t\t\tType.Literal(\"other\"),\n\t\t\tType.Literal(\"absent\"),\n\t\t]),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t\tcanonicalPath: Type.Optional(Type.String({ minLength: 1, maxLength: 32_768 })),\n\t},\n\tclosedObject,\n);\nconst ReaddirResultSchema = Type.Object(\n\t{\n\t\tentries: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst GlobResultSchema = Type.Object(\n\t{\n\t\tmatches: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst GrepResultSchema = Type.Object(\n\t{\n\t\tisDirectory: Type.Boolean(),\n\t\tmatches: Type.Array(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tfilePath: Type.String({ minLength: 1, maxLength: 32_768 }),\n\t\t\t\t\tlineNumber: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),\n\t\t\t\t\tlineText: Type.Optional(Type.String()),\n\t\t\t\t},\n\t\t\t\tclosedObject,\n\t\t\t),\n\t\t\t{ maxItems: 1_000_000 },\n\t\t),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst MimeResultSchema = Type.Object(\n\t{\n\t\tmimeType: Type.Union([\n\t\t\tType.Literal(\"image/jpeg\"),\n\t\t\tType.Literal(\"image/png\"),\n\t\t\tType.Literal(\"image/gif\"),\n\t\t\tType.Literal(\"image/webp\"),\n\t\t\tType.Null(),\n\t\t]),\n\t\tworkspace: RemoteWorkspaceIdentitySchema,\n\t},\n\tclosedObject,\n);\nconst ExecResultSchema = Type.Object(\n\t{ exitCode: Type.Union([Type.Integer({ minimum: 0, maximum: 255 }), Type.Null()]) },\n\tclosedObject,\n);\nconst TransferResultSchema = Type.Object(\n\t{\n\t\tlength: Type.Integer(safeIntegerOptions),\n\t\tsha256: HashSchema,\n\t},\n\tclosedObject,\n);\n\nconst parameterValidators = {\n\t\"catalog.get\": Compile(CatalogGetParamsSchema),\n\t\"tool.invoke\": Compile(ToolInvokeParamsSchema),\n\t\"workspace.access\": Compile(AccessParamsSchema),\n\t\"workspace.read\": Compile(PathParamsSchema),\n\t\"workspace.write\": Compile(WriteParamsSchema),\n\t\"workspace.mkdir\": Compile(MkdirParamsSchema),\n\t\"workspace.stat\": Compile(WorkspaceStatParamsSchema),\n\t\"workspace.readdir\": Compile(PathParamsSchema),\n\t\"workspace.glob\": Compile(GlobParamsSchema),\n\t\"workspace.grep\": Compile(GrepParamsSchema),\n\t\"workspace.detect_image_mime\": Compile(PathParamsSchema),\n\t\"workspace.exec\": Compile(ExecParamsSchema),\n\t\"lsp.status\": Compile(EmptyParamsSchema),\n\t\"resource.read\": Compile(PathParamsSchema),\n\t\"artifact.read\": Compile(PathParamsSchema),\n\t\"transfer.upload\": Compile(TransferUploadParamsSchema),\n\t\"transfer.download\": Compile(TransferDownloadParamsSchema),\n} satisfies Record<RemoteWorkspaceMethod, ReturnType<typeof Compile>>;\n\nconst resultValidators = {\n\t\"catalog.get\": Compile(RemoteWorkspaceCatalogSchema),\n\t\"tool.invoke\": Compile(ToolResultSchema),\n\t\"workspace.access\": Compile(EmptyResultSchema),\n\t\"workspace.read\": Compile(ReadResultSchema),\n\t\"workspace.write\": Compile(EmptyResultSchema),\n\t\"workspace.mkdir\": Compile(EmptyResultSchema),\n\t\"workspace.stat\": Compile(StatResultSchema),\n\t\"workspace.readdir\": Compile(ReaddirResultSchema),\n\t\"workspace.glob\": Compile(GlobResultSchema),\n\t\"workspace.grep\": Compile(GrepResultSchema),\n\t\"workspace.detect_image_mime\": Compile(MimeResultSchema),\n\t\"workspace.exec\": Compile(ExecResultSchema),\n\t\"lsp.status\": Compile(LspStatusResultSchema),\n\t\"resource.read\": Compile(ReadResultSchema),\n\t\"artifact.read\": Compile(TransferResultSchema),\n\t\"transfer.upload\": Compile(TransferResultSchema),\n\t\"transfer.download\": Compile(TransferResultSchema),\n} satisfies Record<RemoteWorkspaceMethod, ReturnType<typeof Compile> | undefined>;\n\nconst clientMessageValidator = Compile(RemoteWorkspaceClientMessageSchema);\nconst serverMessageValidator = Compile(RemoteWorkspaceServerMessageSchema);\nconst handshakeAckValidator = Compile(RemoteWorkspaceHandshakeAckSchema);\nconst limitsValidator = Compile(RemoteWorkspaceLimitsSchema);\n\nexport class RemoteWorkspaceValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteWorkspaceValidationError\";\n\t}\n}\n\nfunction validationMessage(validator: Validator, value: unknown): string {\n\tconst error = validator.Errors(value)[0];\n\tif (!error) return \"value does not match the protocol schema\";\n\treturn `${error.instancePath || \"/\"}: ${error.message}`;\n}\n\nfunction parseWithValidator<T>(validator: Validator, value: unknown, label: string): T {\n\tif (!validator.Check(value)) {\n\t\tthrow new RemoteWorkspaceValidationError(`Invalid ${label}: ${validationMessage(validator, value)}`);\n\t}\n\treturn value as T;\n}\n\nexport function validateRemoteWorkspaceProtocolLimits(value: unknown): RemoteWorkspaceProtocolLimits {\n\tconst limits = parseWithValidator<RemoteWorkspaceProtocolLimits>(limitsValidator, value, \"protocol limits\");\n\tif (limits.maxMessageBytes > limits.maxPendingInboundBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxMessageBytes must not exceed maxPendingInboundBytes\");\n\t}\n\tif (limits.maxMessageBytes > limits.maxPendingOutboundBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxMessageBytes must not exceed maxPendingOutboundBytes\");\n\t}\n\tif (limits.maxTransferChunkBytes > limits.maxPendingTransferBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxTransferChunkBytes must not exceed maxPendingTransferBytes\");\n\t}\n\tif (Math.ceil((limits.maxTransferChunkBytes * 4) / 3) + 512 > limits.maxMessageBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"maxTransferChunkBytes must fit in one base64 protocol message\");\n\t}\n\treturn limits;\n}\n\ninterface RemoteWorkspacePendingValue {\n\tvalue: unknown;\n\tdepth: number;\n}\n\ninterface RemoteWorkspaceStructureState {\n\tpending: RemoteWorkspacePendingValue[];\n\tnodes: number;\n\tobjectKeys: number;\n\tlimits: RemoteWorkspaceStructuralLimits;\n}\n\nfunction validateRemoteWorkspaceNodeBudget(depth: number, state: RemoteWorkspaceStructureState): void {\n\tstate.nodes++;\n\tif (state.nodes > state.limits.maxNodes)\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol value exceeds node limit\");\n\tif (depth > state.limits.maxDepth) throw new RemoteWorkspaceValidationError(\"Protocol value exceeds depth limit\");\n}\n\nfunction validateRemoteWorkspaceScalar(value: unknown, limits: RemoteWorkspaceStructuralLimits): boolean {\n\tif (value === null || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new RemoteWorkspaceValidationError(\"Protocol numbers must be finite\");\n\t\treturn true;\n\t}\n\tif (typeof value !== \"string\") return false;\n\tif (Buffer.byteLength(value, \"utf8\") > limits.maxStringBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol string exceeds byte limit\");\n\t}\n\treturn true;\n}\n\nfunction enqueueRemoteWorkspaceArray(value: unknown[], depth: number, state: RemoteWorkspaceStructureState): void {\n\tif (value.length > state.limits.maxArrayLength) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol array exceeds item limit\");\n\t}\n\tfor (let index = value.length - 1; index >= 0; index--) {\n\t\tstate.pending.push({ value: value[index], depth: depth + 1 });\n\t}\n}\n\nfunction enqueueRemoteWorkspaceObject(value: unknown, depth: number, state: RemoteWorkspaceStructureState): void {\n\tif (value === null || typeof value !== \"object\")\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol values must be JSON-compatible\");\n\tconst prototype = Object.getPrototypeOf(value);\n\tif (prototype !== Object.prototype && prototype !== null) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol objects must be plain JSON objects\");\n\t}\n\tconst entries = Object.entries(value);\n\tif (entries.length > state.limits.maxObjectKeys) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol object exceeds key limit\");\n\t}\n\tstate.objectKeys += entries.length;\n\tif (state.objectKeys > state.limits.maxObjectKeys) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol value exceeds total key limit\");\n\t}\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (!entry) continue;\n\t\tif (Buffer.byteLength(entry[0], \"utf8\") > state.limits.maxStringBytes) {\n\t\t\tthrow new RemoteWorkspaceValidationError(\"Protocol object key exceeds byte limit\");\n\t\t}\n\t\tstate.pending.push({ value: entry[1], depth: depth + 1 });\n\t}\n}\n\nexport function assertRemoteWorkspaceJsonStructure(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): void {\n\tconst state: RemoteWorkspaceStructureState = {\n\t\tpending: [{ value, depth: 1 }],\n\t\tnodes: 0,\n\t\tobjectKeys: 0,\n\t\tlimits,\n\t};\n\twhile (state.pending.length > 0) {\n\t\tconst current = state.pending.pop();\n\t\tif (!current) break;\n\t\tvalidateRemoteWorkspaceNodeBudget(current.depth, state);\n\t\tif (validateRemoteWorkspaceScalar(current.value, limits)) continue;\n\t\tif (Array.isArray(current.value)) {\n\t\t\tenqueueRemoteWorkspaceArray(current.value, current.depth, state);\n\t\t\tcontinue;\n\t\t}\n\t\tenqueueRemoteWorkspaceObject(current.value, current.depth, state);\n\t}\n}\n\nexport function decodeRemoteWorkspaceMessage(\n\tpayload: string | Uint8Array,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tconst bytes = typeof payload === \"string\" ? Buffer.from(payload, \"utf8\") : payload;\n\tif (bytes.byteLength > limits.maxMessageBytes) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Protocol message exceeds byte limit\");\n\t}\n\tconst text = typeof payload === \"string\" ? payload : new TextDecoder(\"utf-8\", { fatal: true }).decode(payload);\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(text) as unknown;\n\t} catch (error) {\n\t\tthrow new RemoteWorkspaceValidationError(\n\t\t\t`Protocol message is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn value;\n}\n\nexport function parseRemoteWorkspaceClientMessage(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): RemoteWorkspaceClientMessage {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator<RemoteWorkspaceClientMessage>(clientMessageValidator, value, \"client message\");\n}\n\nexport function parseRemoteWorkspaceServerMessage(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): RemoteWorkspaceServerMessage {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator<RemoteWorkspaceServerMessage>(serverMessageValidator, value, \"server message\");\n}\n\nexport function isRemoteWorkspaceMethod(method: string): method is RemoteWorkspaceMethod {\n\treturn (REMOTE_WORKSPACE_METHODS as readonly string[]).includes(method);\n}\n\nexport function parseRemoteWorkspaceRequestParams(\n\tmethod: RemoteWorkspaceMethod,\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\tconst parsed = parseWithValidator(parameterValidators[method], value, `${method} params`);\n\tif (method === \"workspace.write\") {\n\t\tdecodeCanonicalBase64((parsed as { contentBase64: string }).contentBase64, limits.maxMessageBytes);\n\t}\n\treturn parsed;\n}\n\nexport function parseRemoteWorkspaceResult(\n\tmethod: RemoteWorkspaceMethod,\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\tconst validator = resultValidators[method];\n\tconst parsed = validator ? parseWithValidator(validator, value, `${method} result`) : value;\n\tif (method === \"workspace.read\" || method === \"resource.read\") {\n\t\tdecodeCanonicalBase64((parsed as { contentBase64: string }).contentBase64, limits.maxMessageBytes);\n\t}\n\treturn parsed;\n}\n\nexport function parseRemoteWorkspaceToolResult(\n\tvalue: unknown,\n\tlimits: RemoteWorkspaceStructuralLimits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n): unknown {\n\tassertRemoteWorkspaceJsonStructure(value, limits);\n\treturn parseWithValidator(Compile(ToolResultSchema), value, \"tool result\");\n}\n\nexport function decodeCanonicalBase64(value: string, maxBytes: number): Buffer {\n\tif (value.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value)) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Transfer data is not canonical base64\");\n\t}\n\tconst decoded = Buffer.from(value, \"base64\");\n\tif (decoded.byteLength > maxBytes) throw new RemoteWorkspaceValidationError(\"Transfer chunk exceeds byte limit\");\n\tif (decoded.toString(\"base64\") !== value) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Transfer data is not canonical base64\");\n\t}\n\treturn decoded;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tif (value === null) return \"null\";\n\tif (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new RemoteWorkspaceValidationError(\"Cannot hash a non-finite number\");\n\t\treturn JSON.stringify(value);\n\t}\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (Array.isArray(value)) return `[${value.map((entry) => canonicalJson(entry)).join(\",\")}]`;\n\tif (typeof value !== \"object\" || value === undefined) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Cannot hash a non-JSON value\");\n\t}\n\tconst entries = Object.entries(value).sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));\n\treturn `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n}\n\nexport function hashRemoteWorkspaceJson(value: unknown): string {\n\tassertRemoteWorkspaceJsonStructure(value);\n\treturn createHash(\"sha256\").update(canonicalJson(value)).digest(\"hex\");\n}\n\nexport function hashRemoteWorkspaceCatalog(catalog: RemoteWorkspaceCatalog): string {\n\treturn hashRemoteWorkspaceJson(catalog);\n}\n\nfunction assertUnique(values: readonly string[], label: string): void {\n\tif (new Set(values).size !== values.length) throw new RemoteWorkspaceValidationError(`${label} contains duplicates`);\n}\n\nexport function validateRemoteWorkspaceCatalog(catalog: RemoteWorkspaceCatalog): void {\n\tparseWithValidator(Compile(RemoteWorkspaceCatalogSchema), catalog, \"tool catalog\");\n\tassertUnique(catalog.operations, \"Catalog operations\");\n\tassertUnique(\n\t\tcatalog.tools.map((tool) => tool.name),\n\t\t\"Catalog tool names\",\n\t);\n\tfor (const tool of catalog.tools) {\n\t\tassertUnique(tool.featureFlags, `Feature flags for ${tool.name}`);\n\t\tif (hashRemoteWorkspaceJson(tool.parameterSchema) !== tool.schemaHash) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Schema hash mismatch for tool ${tool.name}`);\n\t\t}\n\t}\n}\n\nexport function validateRemoteWorkspaceLocalToolSchemas(\n\tcatalog: RemoteWorkspaceCatalog,\n\tlocalToolSchemas: ReadonlyMap<string, string>,\n): void {\n\tfor (const tool of catalog.tools) {\n\t\tconst localHash = localToolSchemas.get(tool.name);\n\t\tif (localHash !== undefined && localHash !== tool.schemaHash) {\n\t\t\tthrow new RemoteWorkspaceValidationError(\n\t\t\t\t`Remote schema does not match the local canonical schema for ${tool.name}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function validateRemoteWorkspaceHandshakeAck(\n\tack: unknown,\n\toffer: RemoteWorkspaceHandshake,\n\tlocalToolSchemas: ReadonlyMap<string, string> = new Map(),\n): RemoteWorkspaceHandshakeAck {\n\tconst parsed = parseWithValidator<RemoteWorkspaceHandshakeAck>(handshakeAckValidator, ack, \"handshake response\");\n\tvalidateRemoteWorkspaceProtocolLimits(offer.receiveLimits);\n\tvalidateRemoteWorkspaceProtocolLimits(parsed.limits);\n\tconst selected = offer.versions.some(\n\t\t(range) =>\n\t\t\trange.major === parsed.version.major &&\n\t\t\trange.minMinor <= parsed.version.minor &&\n\t\t\trange.maxMinor >= parsed.version.minor,\n\t);\n\tif (!selected)\n\t\tthrow new RemoteWorkspaceValidationError(\"Server selected a protocol version outside the offered range\");\n\tconst offeredCapabilities = new Set([...offer.requiredCapabilities, ...offer.optionalCapabilities]);\n\tfor (const capability of parsed.capabilities) {\n\t\tif (!offeredCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server selected an unoffered capability: ${capability}`);\n\t\t}\n\t}\n\tconst selectedCapabilities = new Set(parsed.capabilities);\n\tfor (const capability of offer.requiredCapabilities) {\n\t\tif (!selectedCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server omitted required capability: ${capability}`);\n\t\t}\n\t}\n\tassertUnique(parsed.capabilities, \"Negotiated capabilities\");\n\tvalidateRemoteWorkspaceCatalog(parsed.catalog);\n\tif (hashRemoteWorkspaceCatalog(parsed.catalog) !== parsed.catalogHash) {\n\t\tthrow new RemoteWorkspaceValidationError(\"Catalog hash does not match the negotiated catalog\");\n\t}\n\tvalidateRemoteWorkspaceLocalToolSchemas(parsed.catalog, localToolSchemas);\n\tfor (const key of Object.keys(offer.receiveLimits) as (keyof RemoteWorkspaceProtocolLimits)[]) {\n\t\tif (parsed.limits[key] > offer.receiveLimits[key]) {\n\t\t\tthrow new RemoteWorkspaceValidationError(`Server increased negotiated limit: ${key}`);\n\t\t}\n\t}\n\treturn parsed;\n}\n\nexport interface RemoteWorkspaceNegotiationOptions {\n\tserverVersions: readonly RemoteWorkspaceVersionRange[];\n\tserverCapabilities: readonly string[];\n\trequiredClientCapabilities?: readonly string[];\n\tserverLimits: RemoteWorkspaceProtocolLimits;\n}\n\nexport interface RemoteWorkspaceNegotiationResult {\n\tversion: RemoteWorkspaceVersion;\n\tcapabilities: string[];\n\tlimits: RemoteWorkspaceProtocolLimits;\n}\n\nexport type RemoteWorkspaceNegotiationErrorCode = \"incompatible_version\" | \"capability_mismatch\";\n\nexport class RemoteWorkspaceNegotiationError extends Error {\n\treadonly code: RemoteWorkspaceNegotiationErrorCode;\n\n\tconstructor(code: RemoteWorkspaceNegotiationErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteWorkspaceNegotiationError\";\n\t\tthis.code = code;\n\t}\n}\n\nfunction validateVersionRanges(ranges: readonly RemoteWorkspaceVersionRange[], label: string): void {\n\tfor (const range of ranges) {\n\t\tif (range.minMinor > range.maxMinor) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\"incompatible_version\", `${label} has an inverted minor range`);\n\t\t}\n\t}\n}\n\nfunction findCompatibleRemoteWorkspaceVersions(\n\tclientVersions: readonly RemoteWorkspaceVersionRange[],\n\tserverVersions: readonly RemoteWorkspaceVersionRange[],\n): RemoteWorkspaceVersion[] {\n\tconst serverVersionsByMajor = new Map<number, RemoteWorkspaceVersionRange[]>();\n\tfor (const server of serverVersions) {\n\t\tconst ranges = serverVersionsByMajor.get(server.major) ?? [];\n\t\tranges.push(server);\n\t\tserverVersionsByMajor.set(server.major, ranges);\n\t}\n\tconst candidates: RemoteWorkspaceVersion[] = [];\n\tfor (const client of clientVersions) {\n\t\tfor (const server of serverVersionsByMajor.get(client.major) ?? []) {\n\t\t\tconst minMinor = Math.max(client.minMinor, server.minMinor);\n\t\t\tconst maxMinor = Math.min(client.maxMinor, server.maxMinor);\n\t\t\tif (minMinor <= maxMinor) candidates.push({ major: client.major, minor: maxMinor });\n\t\t}\n\t}\n\treturn candidates;\n}\n\nexport function negotiateRemoteWorkspaceHandshake(\n\thandshake: RemoteWorkspaceHandshake,\n\toptions: RemoteWorkspaceNegotiationOptions,\n): RemoteWorkspaceNegotiationResult {\n\tvalidateRemoteWorkspaceProtocolLimits(handshake.receiveLimits);\n\tvalidateRemoteWorkspaceProtocolLimits(options.serverLimits);\n\tvalidateVersionRanges(handshake.versions, \"Client version offer\");\n\tvalidateVersionRanges(options.serverVersions, \"Server version offer\");\n\tassertUnique(handshake.requiredCapabilities, \"Required capabilities\");\n\tassertUnique(handshake.optionalCapabilities, \"Optional capabilities\");\n\tconst optionalCapabilities = new Set(handshake.optionalCapabilities);\n\tconst duplicateOffer = handshake.requiredCapabilities.find((capability) => optionalCapabilities.has(capability));\n\tif (duplicateOffer) {\n\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\"capability_mismatch\",\n\t\t\t`Capability is both required and optional: ${duplicateOffer}`,\n\t\t);\n\t}\n\tconst candidates = findCompatibleRemoteWorkspaceVersions(handshake.versions, options.serverVersions);\n\tcandidates.sort((left, right) => right.major - left.major || right.minor - left.minor);\n\tconst version = candidates[0];\n\tif (!version) {\n\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\"incompatible_version\",\n\t\t\t\"No compatible remote workspace protocol version\",\n\t\t);\n\t}\n\tconst serverCapabilities = new Set(options.serverCapabilities);\n\tfor (const capability of handshake.requiredCapabilities) {\n\t\tif (!serverCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\t\"capability_mismatch\",\n\t\t\t\t`Server does not support required capability: ${capability}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst clientCapabilities = new Set([...handshake.requiredCapabilities, ...handshake.optionalCapabilities]);\n\tfor (const capability of options.requiredClientCapabilities ?? []) {\n\t\tif (!clientCapabilities.has(capability)) {\n\t\t\tthrow new RemoteWorkspaceNegotiationError(\n\t\t\t\t\"capability_mismatch\",\n\t\t\t\t`Client does not support required capability: ${capability}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst capabilities = Array.from(clientCapabilities)\n\t\t.filter((capability) => serverCapabilities.has(capability))\n\t\t.sort();\n\tconst clientLimits = handshake.receiveLimits;\n\tconst serverLimits = options.serverLimits;\n\treturn {\n\t\tversion,\n\t\tcapabilities,\n\t\tlimits: {\n\t\t\tmaxMessageBytes: Math.min(clientLimits.maxMessageBytes, serverLimits.maxMessageBytes),\n\t\t\tmaxStringBytes: Math.min(clientLimits.maxStringBytes, serverLimits.maxStringBytes),\n\t\t\tmaxDepth: Math.min(clientLimits.maxDepth, serverLimits.maxDepth),\n\t\t\tmaxObjectKeys: Math.min(clientLimits.maxObjectKeys, serverLimits.maxObjectKeys),\n\t\t\tmaxArrayLength: Math.min(clientLimits.maxArrayLength, serverLimits.maxArrayLength),\n\t\t\tmaxNodes: Math.min(clientLimits.maxNodes, serverLimits.maxNodes),\n\t\t\tmaxRequestMs: Math.min(clientLimits.maxRequestMs, serverLimits.maxRequestMs),\n\t\t\tmaxTransferChunkBytes: Math.min(clientLimits.maxTransferChunkBytes, serverLimits.maxTransferChunkBytes),\n\t\t\tmaxPendingTransferBytes: Math.min(clientLimits.maxPendingTransferBytes, serverLimits.maxPendingTransferBytes),\n\t\t\tmaxPendingInboundBytes: Math.min(clientLimits.maxPendingInboundBytes, serverLimits.maxPendingInboundBytes),\n\t\t\tmaxPendingInboundMessages: Math.min(\n\t\t\t\tclientLimits.maxPendingInboundMessages,\n\t\t\t\tserverLimits.maxPendingInboundMessages,\n\t\t\t),\n\t\t\tmaxPendingOutboundBytes: Math.min(clientLimits.maxPendingOutboundBytes, serverLimits.maxPendingOutboundBytes),\n\t\t\tmaxPendingOutboundMessages: Math.min(\n\t\t\t\tclientLimits.maxPendingOutboundMessages,\n\t\t\t\tserverLimits.maxPendingOutboundMessages,\n\t\t\t),\n\t\t\tmaxTransferBytes: Math.min(clientLimits.maxTransferBytes, serverLimits.maxTransferBytes),\n\t\t\tmaxTransferChunks: Math.min(clientLimits.maxTransferChunks, serverLimits.maxTransferChunks),\n\t\t\tmaxActiveRequests: Math.min(clientLimits.maxActiveRequests, serverLimits.maxActiveRequests),\n\t\t\tmaxActiveTransfers: Math.min(clientLimits.maxActiveTransfers, serverLimits.maxActiveTransfers),\n\t\t\tmaxCancellationMs: Math.min(clientLimits.maxCancellationMs, serverLimits.maxCancellationMs),\n\t\t\tmaxTransportSendMs: Math.min(clientLimits.maxTransportSendMs, serverLimits.maxTransportSendMs),\n\t\t},\n\t};\n}\n\nexport function getRemoteWorkspaceMethodKind(method: RemoteWorkspaceMethod): RemoteWorkspaceOperationKind {\n\tswitch (method) {\n\t\tcase \"workspace.write\":\n\t\tcase \"workspace.mkdir\":\n\t\tcase \"transfer.upload\":\n\t\t\treturn \"mutation\";\n\t\tcase \"workspace.exec\":\n\t\t\treturn \"process\";\n\t\tcase \"tool.invoke\":\n\t\t\treturn \"service\";\n\t\tdefault:\n\t\t\treturn \"read\";\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"guest-shared-client.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EACX,6BAA6B,EAC7B,kCAAkC,EAClC,gCAAgC,EAChC,MAAM,cAAc,CAAC;AAEtB,0FAA0F;AAC1F,qBAAa,0BAA2B,YAAW,gCAAgC,CAAC,4BAA4B,CAAC;IAChH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAgC;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,OAAO,eAIN;IAED,OAAa,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAmBjG;IAED,IAAI,CAAC,QAAQ,EAAE,6BAA6B,GAAG,IAAI,CAGlD;IAED,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzD;IAEK,KAAK,CAAC,OAAO,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;CACD","sourcesContent":["import type { RemoteWorkspaceClientMessage } from \"./contract.ts\";\nimport { GuestSharedUplink, type GuestUplinkChannel } from \"./guest-shared-uplink.ts\";\nimport type {\n\tRemoteWorkspaceClientProtocol,\n\tRemoteWorkspaceProtocolCloseReason,\n\tRemoteWorkspaceProtocolTransport,\n} from \"./session.ts\";\n\n/** A TUI owns its physical guest connection; the guest isolates its workspace channel. */\nexport class GuestSharedClientTransport implements RemoteWorkspaceProtocolTransport<RemoteWorkspaceClientMessage> {\n\tprivate readonly uplink: GuestSharedUplink;\n\tprivate readonly channel: GuestUplinkChannel;\n\tprivate protocol?: RemoteWorkspaceClientProtocol;\n\tprivate closed = false;\n\treadonly root: string;\n\n\tprivate constructor(uplink: GuestSharedUplink, channel: GuestUplinkChannel, root: string) {\n\t\tthis.uplink = uplink;\n\t\tthis.channel = channel;\n\t\tthis.root = root;\n\t}\n\n\tstatic async attach(url: string, root: string, token: string): Promise<GuestSharedClientTransport> {\n\t\tconst uplink = await GuestSharedUplink.connect(url, token);\n\t\tlet transport: GuestSharedClientTransport | undefined;\n\t\ttry {\n\t\t\tconst channel = await uplink.open(\n\t\t\t\troot,\n\t\t\t\t(message) => {\n\t\t\t\t\tvoid transport?.protocol?.receive(Buffer.from(JSON.stringify(message))).catch(() => undefined);\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\tif (!transport?.closed) void transport?.protocol?.disconnect(error.message);\n\t\t\t\t},\n\t\t\t);\n\t\t\ttransport = new GuestSharedClientTransport(uplink, channel, root);\n\t\t\treturn transport;\n\t\t} catch (error) {\n\t\t\tuplink.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tbind(protocol: RemoteWorkspaceClientProtocol): void {\n\t\tif (this.closed || this.protocol) throw new Error(\"Guest shared protocol cannot be bound\");\n\t\tthis.protocol = protocol;\n\t}\n\n\tsend(message: RemoteWorkspaceClientMessage): Promise<void> {\n\t\tif (this.closed || !this.protocol) return Promise.reject(new Error(\"Guest shared channel is closed\"));\n\t\treturn this.channel.send(message);\n\t}\n\n\tasync close(_reason: RemoteWorkspaceProtocolCloseReason): Promise<void> {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\ttry {\n\t\t\tawait this.channel.close();\n\t\t} finally {\n\t\t\tthis.uplink.dispose();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"guest-shared-client.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EACX,6BAA6B,EAC7B,kCAAkC,EAClC,gCAAgC,EAChC,MAAM,cAAc,CAAC;AAEtB,0FAA0F;AAC1F,qBAAa,0BAA2B,YAAW,gCAAgC,CAAC,4BAA4B,CAAC;IAChH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAgC;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,OAAO,eAIN;IAED,OAAa,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAmBjG;IAED,IAAI,CAAC,QAAQ,EAAE,6BAA6B,GAAG,IAAI,CAGlD;IAED,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzD;IAEK,KAAK,CAAC,OAAO,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;CACD"}
@@ -1,12 +1,8 @@
1
1
  import { GuestSharedUplink } from "./guest-shared-uplink.js";
2
2
  /** A TUI owns its physical guest connection; the guest isolates its workspace channel. */
3
3
  export class GuestSharedClientTransport {
4
- uplink;
5
- channel;
6
- protocol;
7
- closed = false;
8
- root;
9
4
  constructor(uplink, channel, root) {
5
+ this.closed = false;
10
6
  this.uplink = uplink;
11
7
  this.channel = channel;
12
8
  this.root = root;
@@ -1 +1 @@
1
- {"version":3,"file":"guest-shared-client.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA2B,MAAM,0BAA0B,CAAC;AAOtF,0FAA0F;AAC1F,MAAM,OAAO,0BAA0B;IACrB,MAAM,CAAoB;IAC1B,OAAO,CAAqB;IACrC,QAAQ,CAAiC;IACzC,MAAM,GAAG,KAAK,CAAC;IACd,IAAI,CAAS;IAEtB,YAAoB,MAAyB,EAAE,OAA2B,EAAE,IAAY,EAAE;QAC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ED,IAAI,CAAC,OAAqC,EAAiB;QAC1D,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACtG,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAAA,CAClC;IAED,KAAK,CAAC,KAAK,CAAC,OAA2C,EAAiB;QACvE,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IAAA,CACD;CACD","sourcesContent":["import type { RemoteWorkspaceClientMessage } from \"./contract.ts\";\nimport { GuestSharedUplink, type GuestUplinkChannel } from \"./guest-shared-uplink.ts\";\nimport type {\n\tRemoteWorkspaceClientProtocol,\n\tRemoteWorkspaceProtocolCloseReason,\n\tRemoteWorkspaceProtocolTransport,\n} from \"./session.ts\";\n\n/** A TUI owns its physical guest connection; the guest isolates its workspace channel. */\nexport class GuestSharedClientTransport implements RemoteWorkspaceProtocolTransport<RemoteWorkspaceClientMessage> {\n\tprivate readonly uplink: GuestSharedUplink;\n\tprivate readonly channel: GuestUplinkChannel;\n\tprivate protocol?: RemoteWorkspaceClientProtocol;\n\tprivate closed = false;\n\treadonly root: string;\n\n\tprivate constructor(uplink: GuestSharedUplink, channel: GuestUplinkChannel, root: string) {\n\t\tthis.uplink = uplink;\n\t\tthis.channel = channel;\n\t\tthis.root = root;\n\t}\n\n\tstatic async attach(url: string, root: string, token: string): Promise<GuestSharedClientTransport> {\n\t\tconst uplink = await GuestSharedUplink.connect(url, token);\n\t\tlet transport: GuestSharedClientTransport | undefined;\n\t\ttry {\n\t\t\tconst channel = await uplink.open(\n\t\t\t\troot,\n\t\t\t\t(message) => {\n\t\t\t\t\tvoid transport?.protocol?.receive(Buffer.from(JSON.stringify(message))).catch(() => undefined);\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\tif (!transport?.closed) void transport?.protocol?.disconnect(error.message);\n\t\t\t\t},\n\t\t\t);\n\t\t\ttransport = new GuestSharedClientTransport(uplink, channel, root);\n\t\t\treturn transport;\n\t\t} catch (error) {\n\t\t\tuplink.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tbind(protocol: RemoteWorkspaceClientProtocol): void {\n\t\tif (this.closed || this.protocol) throw new Error(\"Guest shared protocol cannot be bound\");\n\t\tthis.protocol = protocol;\n\t}\n\n\tsend(message: RemoteWorkspaceClientMessage): Promise<void> {\n\t\tif (this.closed || !this.protocol) return Promise.reject(new Error(\"Guest shared channel is closed\"));\n\t\treturn this.channel.send(message);\n\t}\n\n\tasync close(_reason: RemoteWorkspaceProtocolCloseReason): Promise<void> {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\ttry {\n\t\t\tawait this.channel.close();\n\t\t} finally {\n\t\t\tthis.uplink.dispose();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"guest-shared-client.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA2B,MAAM,0BAA0B,CAAC;AAOtF,0FAA0F;AAC1F,MAAM,OAAO,0BAA0B;IAOtC,YAAoB,MAAyB,EAAE,OAA2B,EAAE,IAAY;QAHhF,WAAM,GAAG,KAAK,CAAC;QAItB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,IAAY,EAAE,KAA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IACnC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAA2C;QACtD,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { RemoteWorkspaceClientMessage } from \"./contract.ts\";\nimport { GuestSharedUplink, type GuestUplinkChannel } from \"./guest-shared-uplink.ts\";\nimport type {\n\tRemoteWorkspaceClientProtocol,\n\tRemoteWorkspaceProtocolCloseReason,\n\tRemoteWorkspaceProtocolTransport,\n} from \"./session.ts\";\n\n/** A TUI owns its physical guest connection; the guest isolates its workspace channel. */\nexport class GuestSharedClientTransport implements RemoteWorkspaceProtocolTransport<RemoteWorkspaceClientMessage> {\n\tprivate readonly uplink: GuestSharedUplink;\n\tprivate readonly channel: GuestUplinkChannel;\n\tprivate protocol?: RemoteWorkspaceClientProtocol;\n\tprivate closed = false;\n\treadonly root: string;\n\n\tprivate constructor(uplink: GuestSharedUplink, channel: GuestUplinkChannel, root: string) {\n\t\tthis.uplink = uplink;\n\t\tthis.channel = channel;\n\t\tthis.root = root;\n\t}\n\n\tstatic async attach(url: string, root: string, token: string): Promise<GuestSharedClientTransport> {\n\t\tconst uplink = await GuestSharedUplink.connect(url, token);\n\t\tlet transport: GuestSharedClientTransport | undefined;\n\t\ttry {\n\t\t\tconst channel = await uplink.open(\n\t\t\t\troot,\n\t\t\t\t(message) => {\n\t\t\t\t\tvoid transport?.protocol?.receive(Buffer.from(JSON.stringify(message))).catch(() => undefined);\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\tif (!transport?.closed) void transport?.protocol?.disconnect(error.message);\n\t\t\t\t},\n\t\t\t);\n\t\t\ttransport = new GuestSharedClientTransport(uplink, channel, root);\n\t\t\treturn transport;\n\t\t} catch (error) {\n\t\t\tuplink.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tbind(protocol: RemoteWorkspaceClientProtocol): void {\n\t\tif (this.closed || this.protocol) throw new Error(\"Guest shared protocol cannot be bound\");\n\t\tthis.protocol = protocol;\n\t}\n\n\tsend(message: RemoteWorkspaceClientMessage): Promise<void> {\n\t\tif (this.closed || !this.protocol) return Promise.reject(new Error(\"Guest shared channel is closed\"));\n\t\treturn this.channel.send(message);\n\t}\n\n\tasync close(_reason: RemoteWorkspaceProtocolCloseReason): Promise<void> {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\ttry {\n\t\t\tawait this.channel.close();\n\t\t} finally {\n\t\t\tthis.uplink.dispose();\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"guest-shared-outbound-scheduler.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-outbound-scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAIxF,0FAA0F;AAC1F,qBAAa,sBAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,CAAM;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6D;IACpF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,YACC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,IAAI,EAClE,cAAc,EAAE,MAAM,MAAM,EAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAKjC;IAED,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,IAAI;IAoBZ,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C7C;IAED,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAMvB;CACD","sourcesContent":["import { DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS as limits } from \"./contract.ts\";\nimport type { SharedWorkspaceClientFrame } from \"./shared-transport.ts\";\n\nexport type GuestOutboundFrame = Exclude<SharedWorkspaceClientFrame, { type: \"hello\" }>;\n\ntype Job = { bytes: Buffer; key: string; finish: (error?: Error) => void };\n\n/** FIFO within each channel, round-robin between channels, including ordered detaches. */\nexport class GuestOutboundScheduler {\n\tprivate readonly buckets = new Map<string, Job[]>();\n\tprivate readonly ready: string[] = [];\n\tprivate readonly pending = new Set<Job>();\n\tprivate pendingBytes = 0;\n\tprivate inFlight?: Job;\n\tprivate scheduled = false;\n\tprivate failure?: Error;\n\tprivate readonly writer: (bytes: Buffer, callback: (error?: Error) => void) => void;\n\tprivate readonly bufferedAmount: () => number;\n\tprivate readonly onFailure: (error: Error) => void;\n\n\tconstructor(\n\t\twriter: (bytes: Buffer, callback: (error?: Error) => void) => void,\n\t\tbufferedAmount: () => number,\n\t\tonFailure: (error: Error) => void,\n\t) {\n\t\tthis.writer = writer;\n\t\tthis.bufferedAmount = bufferedAmount;\n\t\tthis.onFailure = onFailure;\n\t}\n\n\tprivate schedule(): void {\n\t\tif (this.scheduled || this.failure) return;\n\t\tthis.scheduled = true;\n\t\tqueueMicrotask(() => {\n\t\t\tthis.scheduled = false;\n\t\t\tthis.pump();\n\t\t});\n\t}\n\n\tprivate pump(): void {\n\t\tif (this.failure || this.inFlight) return;\n\t\tconst key = this.ready.shift();\n\t\tif (!key) return;\n\t\tconst bucket = this.buckets.get(key)!;\n\t\tconst job = bucket.shift()!;\n\t\tif (bucket.length) this.ready.push(key);\n\t\telse this.buckets.delete(key);\n\t\tthis.inFlight = job;\n\t\ttry {\n\t\t\tthis.writer(job.bytes, (error) => {\n\t\t\t\tif (error) this.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t\t\telse job.finish();\n\t\t\t\tthis.schedule();\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t}\n\t}\n\n\tsend(frame: GuestOutboundFrame): Promise<void> {\n\t\tif (this.failure) return Promise.reject(this.failure);\n\t\tconst bytes = Buffer.from(JSON.stringify(frame));\n\t\tconst key = frame.type === \"open\" ? `open:${frame.id}` : frame.channelId;\n\t\tconst bucket = this.buckets.get(key);\n\t\tconst perChannel = (bucket?.length ?? 0) + (this.inFlight?.key === key ? 1 : 0);\n\t\tif (\n\t\t\tbytes.length > limits.maxMessageBytes ||\n\t\t\tthis.pending.size >= limits.maxPendingOutboundMessages ||\n\t\t\tperChannel >= 32 ||\n\t\t\tthis.pendingBytes + bytes.length + this.bufferedAmount() > limits.maxPendingOutboundBytes\n\t\t) {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink output budget exceeded; operations may have committed\"));\n\t\t\treturn Promise.reject(this.failure ?? new Error(\"Shared workspace uplink output budget exceeded\"));\n\t\t}\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tlet finished = false;\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send timed out; operations may have committed\"));\n\t\t\t}, limits.maxTransportSendMs);\n\t\t\tconst job: Job = {\n\t\t\t\tbytes,\n\t\t\t\tkey,\n\t\t\t\tfinish: (error) => {\n\t\t\t\t\tif (finished) return;\n\t\t\t\t\tfinished = true;\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tthis.pending.delete(job);\n\t\t\t\t\tthis.pendingBytes -= bytes.length;\n\t\t\t\t\tif (this.inFlight === job) this.inFlight = undefined;\n\t\t\t\t\tif (error) reject(error);\n\t\t\t\t\telse resolve();\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.pending.add(job);\n\t\t\tthis.pendingBytes += bytes.length;\n\t\t\tif (bucket) bucket.push(job);\n\t\t\telse {\n\t\t\t\tthis.buckets.set(key, [job]);\n\t\t\t\tthis.ready.push(key);\n\t\t\t}\n\t\t\tthis.schedule();\n\t\t});\n\t}\n\n\tfail(error: Error): void {\n\t\tif (this.failure) return;\n\t\tthis.failure = error;\n\t\tfor (const job of this.pending) job.finish(error);\n\t\tthis.buckets.clear();\n\t\tthis.ready.length = 0;\n\t}\n}\n"]}
1
+ {"version":3,"file":"guest-shared-outbound-scheduler.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-outbound-scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAIxF,0FAA0F;AAC1F,qBAAa,sBAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,CAAM;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6D;IACpF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,YACC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,IAAI,EAClE,cAAc,EAAE,MAAM,MAAM,EAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAKjC;IAED,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,IAAI;IAoBZ,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C7C;IAED,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAMvB;CACD"}
@@ -1,17 +1,12 @@
1
1
  import { DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS as limits } from "./contract.js";
2
2
  /** FIFO within each channel, round-robin between channels, including ordered detaches. */
3
3
  export class GuestOutboundScheduler {
4
- buckets = new Map();
5
- ready = [];
6
- pending = new Set();
7
- pendingBytes = 0;
8
- inFlight;
9
- scheduled = false;
10
- failure;
11
- writer;
12
- bufferedAmount;
13
- onFailure;
14
4
  constructor(writer, bufferedAmount, onFailure) {
5
+ this.buckets = new Map();
6
+ this.ready = [];
7
+ this.pending = new Set();
8
+ this.pendingBytes = 0;
9
+ this.scheduled = false;
15
10
  this.writer = writer;
16
11
  this.bufferedAmount = bufferedAmount;
17
12
  this.onFailure = onFailure;
@@ -1 +1 @@
1
- {"version":3,"file":"guest-shared-outbound-scheduler.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-outbound-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAOnF,0FAA0F;AAC1F,MAAM,OAAO,sBAAsB;IACjB,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnC,KAAK,GAAa,EAAE,CAAC;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I,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;QAAA,CAChB,CAAC,CAAC;IAAA,CACH;IAED,IAAI,CAAC,KAAY,EAAQ;QACxB,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO;YAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAAA,CACtB;CACD","sourcesContent":["import { DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS as limits } from \"./contract.ts\";\nimport type { SharedWorkspaceClientFrame } from \"./shared-transport.ts\";\n\nexport type GuestOutboundFrame = Exclude<SharedWorkspaceClientFrame, { type: \"hello\" }>;\n\ntype Job = { bytes: Buffer; key: string; finish: (error?: Error) => void };\n\n/** FIFO within each channel, round-robin between channels, including ordered detaches. */\nexport class GuestOutboundScheduler {\n\tprivate readonly buckets = new Map<string, Job[]>();\n\tprivate readonly ready: string[] = [];\n\tprivate readonly pending = new Set<Job>();\n\tprivate pendingBytes = 0;\n\tprivate inFlight?: Job;\n\tprivate scheduled = false;\n\tprivate failure?: Error;\n\tprivate readonly writer: (bytes: Buffer, callback: (error?: Error) => void) => void;\n\tprivate readonly bufferedAmount: () => number;\n\tprivate readonly onFailure: (error: Error) => void;\n\n\tconstructor(\n\t\twriter: (bytes: Buffer, callback: (error?: Error) => void) => void,\n\t\tbufferedAmount: () => number,\n\t\tonFailure: (error: Error) => void,\n\t) {\n\t\tthis.writer = writer;\n\t\tthis.bufferedAmount = bufferedAmount;\n\t\tthis.onFailure = onFailure;\n\t}\n\n\tprivate schedule(): void {\n\t\tif (this.scheduled || this.failure) return;\n\t\tthis.scheduled = true;\n\t\tqueueMicrotask(() => {\n\t\t\tthis.scheduled = false;\n\t\t\tthis.pump();\n\t\t});\n\t}\n\n\tprivate pump(): void {\n\t\tif (this.failure || this.inFlight) return;\n\t\tconst key = this.ready.shift();\n\t\tif (!key) return;\n\t\tconst bucket = this.buckets.get(key)!;\n\t\tconst job = bucket.shift()!;\n\t\tif (bucket.length) this.ready.push(key);\n\t\telse this.buckets.delete(key);\n\t\tthis.inFlight = job;\n\t\ttry {\n\t\t\tthis.writer(job.bytes, (error) => {\n\t\t\t\tif (error) this.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t\t\telse job.finish();\n\t\t\t\tthis.schedule();\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t}\n\t}\n\n\tsend(frame: GuestOutboundFrame): Promise<void> {\n\t\tif (this.failure) return Promise.reject(this.failure);\n\t\tconst bytes = Buffer.from(JSON.stringify(frame));\n\t\tconst key = frame.type === \"open\" ? `open:${frame.id}` : frame.channelId;\n\t\tconst bucket = this.buckets.get(key);\n\t\tconst perChannel = (bucket?.length ?? 0) + (this.inFlight?.key === key ? 1 : 0);\n\t\tif (\n\t\t\tbytes.length > limits.maxMessageBytes ||\n\t\t\tthis.pending.size >= limits.maxPendingOutboundMessages ||\n\t\t\tperChannel >= 32 ||\n\t\t\tthis.pendingBytes + bytes.length + this.bufferedAmount() > limits.maxPendingOutboundBytes\n\t\t) {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink output budget exceeded; operations may have committed\"));\n\t\t\treturn Promise.reject(this.failure ?? new Error(\"Shared workspace uplink output budget exceeded\"));\n\t\t}\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tlet finished = false;\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send timed out; operations may have committed\"));\n\t\t\t}, limits.maxTransportSendMs);\n\t\t\tconst job: Job = {\n\t\t\t\tbytes,\n\t\t\t\tkey,\n\t\t\t\tfinish: (error) => {\n\t\t\t\t\tif (finished) return;\n\t\t\t\t\tfinished = true;\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tthis.pending.delete(job);\n\t\t\t\t\tthis.pendingBytes -= bytes.length;\n\t\t\t\t\tif (this.inFlight === job) this.inFlight = undefined;\n\t\t\t\t\tif (error) reject(error);\n\t\t\t\t\telse resolve();\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.pending.add(job);\n\t\t\tthis.pendingBytes += bytes.length;\n\t\t\tif (bucket) bucket.push(job);\n\t\t\telse {\n\t\t\t\tthis.buckets.set(key, [job]);\n\t\t\t\tthis.ready.push(key);\n\t\t\t}\n\t\t\tthis.schedule();\n\t\t});\n\t}\n\n\tfail(error: Error): void {\n\t\tif (this.failure) return;\n\t\tthis.failure = error;\n\t\tfor (const job of this.pending) job.finish(error);\n\t\tthis.buckets.clear();\n\t\tthis.ready.length = 0;\n\t}\n}\n"]}
1
+ {"version":3,"file":"guest-shared-outbound-scheduler.js","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-outbound-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAOnF,0FAA0F;AAC1F,MAAM,OAAO,sBAAsB;IAYlC,YACC,MAAkE,EAClE,cAA4B,EAC5B,SAAiC;QAdjB,YAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;QACnC,UAAK,GAAa,EAAE,CAAC;QACrB,YAAO,GAAG,IAAI,GAAG,EAAO,CAAC;QAClC,iBAAY,GAAG,CAAC,CAAC;QAEjB,cAAS,GAAG,KAAK,CAAC;QAWzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cA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AAO;YAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS as limits } from \"./contract.ts\";\nimport type { SharedWorkspaceClientFrame } from \"./shared-transport.ts\";\n\nexport type GuestOutboundFrame = Exclude<SharedWorkspaceClientFrame, { type: \"hello\" }>;\n\ntype Job = { bytes: Buffer; key: string; finish: (error?: Error) => void };\n\n/** FIFO within each channel, round-robin between channels, including ordered detaches. */\nexport class GuestOutboundScheduler {\n\tprivate readonly buckets = new Map<string, Job[]>();\n\tprivate readonly ready: string[] = [];\n\tprivate readonly pending = new Set<Job>();\n\tprivate pendingBytes = 0;\n\tprivate inFlight?: Job;\n\tprivate scheduled = false;\n\tprivate failure?: Error;\n\tprivate readonly writer: (bytes: Buffer, callback: (error?: Error) => void) => void;\n\tprivate readonly bufferedAmount: () => number;\n\tprivate readonly onFailure: (error: Error) => void;\n\n\tconstructor(\n\t\twriter: (bytes: Buffer, callback: (error?: Error) => void) => void,\n\t\tbufferedAmount: () => number,\n\t\tonFailure: (error: Error) => void,\n\t) {\n\t\tthis.writer = writer;\n\t\tthis.bufferedAmount = bufferedAmount;\n\t\tthis.onFailure = onFailure;\n\t}\n\n\tprivate schedule(): void {\n\t\tif (this.scheduled || this.failure) return;\n\t\tthis.scheduled = true;\n\t\tqueueMicrotask(() => {\n\t\t\tthis.scheduled = false;\n\t\t\tthis.pump();\n\t\t});\n\t}\n\n\tprivate pump(): void {\n\t\tif (this.failure || this.inFlight) return;\n\t\tconst key = this.ready.shift();\n\t\tif (!key) return;\n\t\tconst bucket = this.buckets.get(key)!;\n\t\tconst job = bucket.shift()!;\n\t\tif (bucket.length) this.ready.push(key);\n\t\telse this.buckets.delete(key);\n\t\tthis.inFlight = job;\n\t\ttry {\n\t\t\tthis.writer(job.bytes, (error) => {\n\t\t\t\tif (error) this.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t\t\telse job.finish();\n\t\t\t\tthis.schedule();\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send failed; operations may have committed\"));\n\t\t}\n\t}\n\n\tsend(frame: GuestOutboundFrame): Promise<void> {\n\t\tif (this.failure) return Promise.reject(this.failure);\n\t\tconst bytes = Buffer.from(JSON.stringify(frame));\n\t\tconst key = frame.type === \"open\" ? `open:${frame.id}` : frame.channelId;\n\t\tconst bucket = this.buckets.get(key);\n\t\tconst perChannel = (bucket?.length ?? 0) + (this.inFlight?.key === key ? 1 : 0);\n\t\tif (\n\t\t\tbytes.length > limits.maxMessageBytes ||\n\t\t\tthis.pending.size >= limits.maxPendingOutboundMessages ||\n\t\t\tperChannel >= 32 ||\n\t\t\tthis.pendingBytes + bytes.length + this.bufferedAmount() > limits.maxPendingOutboundBytes\n\t\t) {\n\t\t\tthis.onFailure(new Error(\"Shared workspace uplink output budget exceeded; operations may have committed\"));\n\t\t\treturn Promise.reject(this.failure ?? new Error(\"Shared workspace uplink output budget exceeded\"));\n\t\t}\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tlet finished = false;\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tthis.onFailure(new Error(\"Shared workspace uplink send timed out; operations may have committed\"));\n\t\t\t}, limits.maxTransportSendMs);\n\t\t\tconst job: Job = {\n\t\t\t\tbytes,\n\t\t\t\tkey,\n\t\t\t\tfinish: (error) => {\n\t\t\t\t\tif (finished) return;\n\t\t\t\t\tfinished = true;\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tthis.pending.delete(job);\n\t\t\t\t\tthis.pendingBytes -= bytes.length;\n\t\t\t\t\tif (this.inFlight === job) this.inFlight = undefined;\n\t\t\t\t\tif (error) reject(error);\n\t\t\t\t\telse resolve();\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.pending.add(job);\n\t\t\tthis.pendingBytes += bytes.length;\n\t\t\tif (bucket) bucket.push(job);\n\t\t\telse {\n\t\t\t\tthis.buckets.set(key, [job]);\n\t\t\t\tthis.ready.push(key);\n\t\t\t}\n\t\t\tthis.schedule();\n\t\t});\n\t}\n\n\tfail(error: Error): void {\n\t\tif (this.failure) return;\n\t\tthis.failure = error;\n\t\tfor (const job of this.pending) job.finish(error);\n\t\tthis.buckets.clear();\n\t\tthis.ready.length = 0;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"guest-shared-uplink.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-uplink.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,MAAM,eAAe,CAAC;AAQvB,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,CAAC;AACxF,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAa/D,wFAAwF;AACxF,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwF;IAC9G,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,eAkBN;IAED,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,KAAK;IAqBb,OAAa,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwE5E;IAEK,IAAI,CACT,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,yBAAyB,EACpC,SAAS,EAAE,yBAAyB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CA0D7B;IAED,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAmBZ,OAAO,IAAI,IAAI,CAEd;CACD","sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport WebSocket from \"ws\";\nimport { VERSION } from \"../../config.ts\";\nimport {\n\tDEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS as limits,\n\tparseRemoteWorkspaceClientMessage,\n\ttype RemoteWorkspaceClientMessage,\n\ttype RemoteWorkspaceServerMessage,\n} from \"./contract.ts\";\nimport { type GuestOutboundFrame, GuestOutboundScheduler } from \"./guest-shared-outbound-scheduler.ts\";\nimport {\n\tparseSharedWorkspaceServerFrame,\n\tSHARED_WORKSPACE_WEBSOCKET_PROTOCOL,\n\ttype SharedWorkspaceServerFrame,\n} from \"./shared-transport.ts\";\n\nexport interface GuestUplinkChannel {\n\treadonly id: string;\n\tsend(message: RemoteWorkspaceClientMessage): Promise<void>;\n\tclose(): Promise<void>;\n}\n\nexport type GuestUplinkMessageHandler = (message: RemoteWorkspaceServerMessage) => void;\nexport type GuestUplinkFailureHandler = (error: Error) => void;\n\ntype Channel = {\n\tonMessage: GuestUplinkMessageHandler;\n\tonFailure: GuestUplinkFailureHandler;\n\tclosing: boolean;\n\tclosePromise?: Promise<void>;\n\tresolveClose?: () => void;\n\trejectClose?: (error: Error) => void;\n};\n\ntype GuestControlFrame = Extract<SharedWorkspaceServerFrame, { type: \"opened\" | \"control_error\" }>;\n\n/** Owns one v2 physical socket. Loss invalidates every channel; nothing is replayed. */\nexport class GuestSharedUplink {\n\tprivate readonly channels = new Map<string, Channel>();\n\tprivate readonly opens = new Map<string, { resolve: (id: string) => void; reject: (error: Error) => void }>();\n\tprivate failure?: Error;\n\tprivate readonly outbound: GuestOutboundScheduler;\n\tprivate readonly socket: WebSocket;\n\treadonly epoch: string;\n\t/** Resolves on any terminal uplink failure (including explicit disposal); never reconnects. */\n\treadonly whenFailed: Promise<void>;\n\tprivate resolveFailure!: () => void;\n\n\tprivate constructor(socket: WebSocket, epoch: string) {\n\t\tthis.socket = socket;\n\t\tthis.epoch = epoch;\n\t\tthis.whenFailed = new Promise<void>((resolve) => {\n\t\t\tthis.resolveFailure = resolve;\n\t\t});\n\t\tthis.outbound = new GuestOutboundScheduler(\n\t\t\t(bytes, callback) =>\n\t\t\t\tsocket.send(bytes, { binary: false, compress: false }, (error) => callback(error ?? undefined)),\n\t\t\t() => socket.bufferedAmount,\n\t\t\t(error) => this.fail(error),\n\t\t);\n\t\tsocket.on(\"message\", (data, isBinary) => this.receive(data as Buffer, isBinary));\n\t\tsocket.on(\"close\", () =>\n\t\t\tthis.fail(new Error(\"Shared workspace uplink disconnected; operations may have committed\")),\n\t\t);\n\t\tsocket.on(\"error\", () => this.fail(new Error(\"Shared workspace uplink failed; operations may have committed\")));\n\t\tif (socket.readyState !== WebSocket.OPEN) this.fail(new Error(\"Shared workspace uplink disconnected\"));\n\t}\n\n\tprivate receive(data: Buffer, isBinary: boolean): void {\n\t\ttry {\n\t\t\tif (isBinary) throw new Error(\"Unexpected binary shared workspace frame\");\n\t\t\tthis.route(parseSharedWorkspaceServerFrame(data, limits));\n\t\t} catch {\n\t\t\tthis.fail(new Error(\"Invalid or unrouteable shared workspace response\"));\n\t\t}\n\t}\n\n\tprivate routeControl(frame: GuestControlFrame): void {\n\t\tconst pending = this.opens.get(frame.id);\n\t\tif (!pending) throw new Error(\"Unknown shared workspace control ID\");\n\t\tthis.opens.delete(frame.id);\n\t\tif (frame.type === \"opened\") pending.resolve(frame.channelId);\n\t\telse pending.reject(new Error(`Shared workspace open failed: ${frame.code}`));\n\t}\n\n\tprivate route(frame: SharedWorkspaceServerFrame): void {\n\t\tif (frame.type === \"hello_ack\") throw new Error(\"Unexpected shared workspace hello acknowledgement\");\n\t\tif (frame.type === \"opened\" || frame.type === \"control_error\") {\n\t\t\tthis.routeControl(frame);\n\t\t\treturn;\n\t\t}\n\t\tconst channel = this.channels.get(frame.channelId);\n\t\tif (!channel) throw new Error(\"Unknown shared workspace channel ID\");\n\t\tif (frame.type === \"closed\") {\n\t\t\tthis.channels.delete(frame.channelId);\n\t\t\tif (frame.reason || !channel.closing) {\n\t\t\t\tconst error = new Error(frame.reason?.message ?? \"Shared workspace channel closed unexpectedly\");\n\t\t\t\tchannel.rejectClose?.(error);\n\t\t\t\tchannel.onFailure(error);\n\t\t\t} else channel.resolveClose?.();\n\t\t\treturn;\n\t\t}\n\t\t// An in-flight response can race a requested detach; deliver until closed is acknowledged.\n\t\tchannel.onMessage(frame.payload);\n\t}\n\n\tstatic async connect(url: string, token?: string): Promise<GuestSharedUplink> {\n\t\tconst endpoint = new URL(url);\n\t\tif (\n\t\t\t!([\"ws:\", \"wss:\"] as string[]).includes(endpoint.protocol) ||\n\t\t\tendpoint.username ||\n\t\t\tendpoint.password ||\n\t\t\tendpoint.hash\n\t\t) {\n\t\t\tthrow new Error(\"Invalid shared workspace endpoint\");\n\t\t}\n\t\tconst socket = new WebSocket(endpoint.toString(), SHARED_WORKSPACE_WEBSOCKET_PROTOCOL, {\n\t\t\tperMessageDeflate: false,\n\t\t\t...(token ? { headers: { authorization: `Bearer ${token}` } } : {}),\n\t\t});\n\t\ttry {\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tconst timer = setTimeout(() => reject(new Error(\"Shared workspace connection timed out\")), 5000);\n\t\t\t\tsocket.once(\"open\", () => {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tsocket.once(\"error\", () => {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\treject(new Error(\"Shared workspace connection failed\"));\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (socket.protocol !== SHARED_WORKSPACE_WEBSOCKET_PROTOCOL) {\n\t\t\t\tthrow new Error(\"Daemon does not support grip.workspace.v2\");\n\t\t\t}\n\t\t\tconst id = randomBytes(12).toString(\"hex\");\n\t\t\tconst epoch = await new Promise<string>((resolve, reject) => {\n\t\t\t\tlet settled = false;\n\t\t\t\tconst timer = setTimeout(() => settle(undefined, new Error(\"Shared workspace hello timed out\")), 5000);\n\t\t\t\tconst settle = (value?: string, error?: Error) => {\n\t\t\t\t\tif (settled) return;\n\t\t\t\t\tsettled = true;\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tsocket.off(\"message\", onMessage);\n\t\t\t\t\tsocket.off(\"close\", onClose);\n\t\t\t\t\tsocket.off(\"error\", onError);\n\t\t\t\t\tif (error) reject(error);\n\t\t\t\t\telse resolve(value!);\n\t\t\t\t};\n\t\t\t\tconst onError = () => settle(undefined, new Error(\"Shared workspace hello failed\"));\n\t\t\t\tconst onClose = () => settle(undefined, new Error(\"Shared workspace hello failed\"));\n\t\t\t\tconst onMessage = (data: WebSocket.RawData, isBinary: boolean) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (isBinary) throw new Error(\"Unexpected binary frame\");\n\t\t\t\t\t\tconst frame = parseSharedWorkspaceServerFrame(Buffer.from(data as Buffer), limits);\n\t\t\t\t\t\tif (frame.type !== \"hello_ack\" || frame.id !== id) throw new Error(\"Unexpected hello response\");\n\t\t\t\t\t\tif (frame.daemonVersion !== VERSION) {\n\t\t\t\t\t\t\tsettle(undefined, new Error(\"Shared workspace daemon version mismatch\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsettle(frame.epoch);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tsettle(undefined, new Error(\"Invalid shared workspace hello response\"));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tsocket.on(\"message\", onMessage);\n\t\t\t\tsocket.once(\"close\", onClose);\n\t\t\t\tsocket.once(\"error\", onError);\n\t\t\t\tsocket.send(JSON.stringify({ type: \"hello\", version: 2, id }), (error) => {\n\t\t\t\t\tif (error) settle(undefined, new Error(\"Shared workspace hello send failed\"));\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn new GuestSharedUplink(socket, epoch);\n\t\t} catch (error) {\n\t\t\tsocket.on(\"error\", () => undefined);\n\t\t\tsocket.terminate();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync open(\n\t\troot: string,\n\t\tonMessage: GuestUplinkMessageHandler,\n\t\tonFailure: GuestUplinkFailureHandler,\n\t): Promise<GuestUplinkChannel> {\n\t\tif (this.failure) throw this.failure;\n\t\tif (this.channels.size + this.opens.size >= 32) throw new Error(\"Shared workspace channel limit exceeded\");\n\t\tconst id = randomBytes(12).toString(\"hex\");\n\t\tconst channelId = await new Promise<string>((resolve, reject) => {\n\t\t\tconst timer = setTimeout(\n\t\t\t\t() => this.fail(new Error(\"Shared workspace open timed out; operations may have committed\")),\n\t\t\t\t5000,\n\t\t\t);\n\t\t\tthis.opens.set(id, {\n\t\t\t\tresolve: (openedId) => {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tresolve(openedId);\n\t\t\t\t},\n\t\t\t\treject: (error) => {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t});\n\t\t\tvoid this.send({ type: \"open\", id, root }).catch((error: Error) => {\n\t\t\t\tconst pending = this.opens.get(id);\n\t\t\t\tthis.opens.delete(id);\n\t\t\t\tpending?.reject(error);\n\t\t\t});\n\t\t});\n\t\tif (this.failure) throw this.failure;\n\t\tconst channel: Channel = { onMessage, onFailure, closing: false };\n\t\tthis.channels.set(channelId, channel);\n\t\treturn {\n\t\t\tid: channelId,\n\t\t\tsend: (payload) => {\n\t\t\t\tif (channel.closing || this.channels.get(channelId) !== channel) {\n\t\t\t\t\treturn Promise.reject(new Error(\"Shared workspace channel is closed\"));\n\t\t\t\t}\n\t\t\t\tparseRemoteWorkspaceClientMessage(payload, limits);\n\t\t\t\treturn this.send({ type: \"channel\", channelId, payload });\n\t\t\t},\n\t\t\tclose: () => {\n\t\t\t\tif (channel.closePromise) return channel.closePromise;\n\t\t\t\tif (this.channels.get(channelId) !== channel) return Promise.resolve();\n\t\t\t\tchannel.closing = true;\n\t\t\t\tchannel.closePromise = new Promise<void>((resolve, reject) => {\n\t\t\t\t\tconst timer = setTimeout(() => {\n\t\t\t\t\t\tthis.fail(new Error(\"Shared workspace detach timed out; operations may have committed\"));\n\t\t\t\t\t}, 5000);\n\t\t\t\t\tchannel.resolveClose = () => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t};\n\t\t\t\t\tchannel.rejectClose = (error) => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t};\n\t\t\t\t\tvoid this.send({ type: \"close\", channelId }).catch(channel.rejectClose);\n\t\t\t\t});\n\t\t\t\treturn channel.closePromise;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate send(frame: GuestOutboundFrame): Promise<void> {\n\t\treturn this.outbound.send(frame);\n\t}\n\n\tprivate fail(error: Error): void {\n\t\tif (this.failure) return;\n\t\tthis.failure = error;\n\t\tthis.outbound.fail(error);\n\t\tthis.socket.terminate();\n\t\tfor (const pending of this.opens.values()) pending.reject(error);\n\t\tthis.opens.clear();\n\t\tfor (const channel of this.channels.values()) {\n\t\t\tchannel.rejectClose?.(error);\n\t\t\ttry {\n\t\t\t\tchannel.onFailure(error);\n\t\t\t} catch {\n\t\t\t\t// Do not let one local callback block failure delivery to sibling channels.\n\t\t\t}\n\t\t}\n\t\tthis.channels.clear();\n\t\tthis.resolveFailure();\n\t}\n\n\tdispose(): void {\n\t\tthis.fail(new Error(\"Shared workspace uplink stopped; operations may have committed\"));\n\t}\n}\n"]}
1
+ {"version":3,"file":"guest-shared-uplink.d.ts","sourceRoot":"","sources":["../../../src/core/remote-workspace-protocol/guest-shared-uplink.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,MAAM,eAAe,CAAC;AAQvB,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,CAAC;AACxF,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAa/D,wFAAwF;AACxF,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwF;IAC9G,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,eAkBN;IAED,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,KAAK;IAqBb,OAAa,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwE5E;IAEK,IAAI,CACT,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,yBAAyB,EACpC,SAAS,EAAE,yBAAyB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CA0D7B;IAED,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAmBZ,OAAO,IAAI,IAAI,CAEd;CACD"}
@@ -6,16 +6,9 @@ import { GuestOutboundScheduler } from "./guest-shared-outbound-scheduler.js";
6
6
  import { parseSharedWorkspaceServerFrame, SHARED_WORKSPACE_WEBSOCKET_PROTOCOL, } from "./shared-transport.js";
7
7
  /** Owns one v2 physical socket. Loss invalidates every channel; nothing is replayed. */
8
8
  export class GuestSharedUplink {
9
- channels = new Map();
10
- opens = new Map();
11
- failure;
12
- outbound;
13
- socket;
14
- epoch;
15
- /** Resolves on any terminal uplink failure (including explicit disposal); never reconnects. */
16
- whenFailed;
17
- resolveFailure;
18
9
  constructor(socket, epoch) {
10
+ this.channels = new Map();
11
+ this.opens = new Map();
19
12
  this.socket = socket;
20
13
  this.epoch = epoch;
21
14
  this.whenFailed = new Promise((resolve) => {