@cortexkit/opencode-antigravity-auth 2.2.1 → 3.0.1

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 (957) hide show
  1. package/README.md +100 -92
  2. package/dist/cli.js +18476 -812
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +4100 -0
  5. package/dist/index.js +40602 -15857
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +6978 -0
  8. package/dist/server.js +51220 -0
  9. package/dist/server.js.map +7 -0
  10. package/dist/server.meta.json +7313 -0
  11. package/dist/src/cli.d.ts +46 -1
  12. package/dist/src/cli.d.ts.map +1 -1
  13. package/dist/src/cli.js +207 -2
  14. package/dist/src/cli.js.map +1 -1
  15. package/dist/src/common-auth-embedded/NOTICE.txt +21 -0
  16. package/dist/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
  17. package/dist/src/common-auth-embedded/auth-menu/accounts.js +387 -0
  18. package/dist/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
  19. package/dist/src/common-auth-embedded/auth-menu/ansi.js +98 -0
  20. package/dist/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
  21. package/dist/src/common-auth-embedded/auth-menu/confirm.js +21 -0
  22. package/dist/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
  23. package/dist/src/common-auth-embedded/auth-menu/doctor.js +81 -0
  24. package/dist/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
  25. package/dist/src/common-auth-embedded/auth-menu/index.js +12 -0
  26. package/dist/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
  27. package/dist/src/common-auth-embedded/auth-menu/login.js +83 -0
  28. package/dist/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
  29. package/dist/src/common-auth-embedded/auth-menu/menu.js +73 -0
  30. package/dist/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
  31. package/dist/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
  32. package/dist/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
  33. package/dist/src/common-auth-embedded/auth-menu/select.js +159 -0
  34. package/dist/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  35. package/dist/src/common-auth-embedded/auth-menu/terminal.js +19 -0
  36. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
  37. package/dist/src/common-auth-embedded/claustrum/consumer.js +298 -0
  38. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
  39. package/dist/src/common-auth-embedded/claustrum/custody.js +354 -0
  40. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
  41. package/dist/src/common-auth-embedded/claustrum/enrollment.js +759 -0
  42. package/dist/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  43. package/dist/src/common-auth-embedded/claustrum/errors.js +8 -0
  44. package/dist/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  45. package/dist/src/common-auth-embedded/claustrum/host-slot.js +72 -0
  46. package/dist/src/common-auth-embedded/claustrum/index.d.ts +18 -0
  47. package/dist/src/common-auth-embedded/claustrum/index.js +22 -0
  48. package/dist/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  49. package/dist/src/common-auth-embedded/claustrum/interlock.js +29 -0
  50. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
  51. package/dist/src/common-auth-embedded/claustrum/roster.js +536 -0
  52. package/dist/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  53. package/dist/src/common-auth-embedded/commands/builtins.js +534 -0
  54. package/dist/src/common-auth-embedded/commands/index.d.ts +10 -0
  55. package/dist/src/common-auth-embedded/commands/index.js +5 -0
  56. package/dist/src/common-auth-embedded/commands/menu.d.ts +61 -0
  57. package/dist/src/common-auth-embedded/commands/menu.js +300 -0
  58. package/dist/src/common-auth-embedded/commands/model.d.ts +238 -0
  59. package/dist/src/common-auth-embedded/commands/model.js +16 -0
  60. package/dist/src/common-auth-embedded/commands/pi.d.ts +23 -0
  61. package/dist/src/common-auth-embedded/commands/pi.js +206 -0
  62. package/dist/src/common-auth-embedded/commands/seam.d.ts +72 -0
  63. package/dist/src/common-auth-embedded/commands/seam.js +301 -0
  64. package/dist/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
  65. package/dist/src/common-auth-embedded/fs/atomic-write.js +80 -0
  66. package/dist/src/common-auth-embedded/fs/index.d.ts +7 -0
  67. package/dist/src/common-auth-embedded/fs/index.js +6 -0
  68. package/dist/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
  69. package/dist/src/common-auth-embedded/fs/lock-constants.js +14 -0
  70. package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  71. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
  72. package/dist/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
  73. package/dist/src/common-auth-embedded/fs/with-lock.js +48 -0
  74. package/dist/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  75. package/dist/src/common-auth-embedded/logger/capture-sink.js +13 -0
  76. package/dist/src/common-auth-embedded/logger/engine.d.ts +100 -0
  77. package/dist/src/common-auth-embedded/logger/engine.js +246 -0
  78. package/dist/src/common-auth-embedded/logger/index.d.ts +6 -0
  79. package/dist/src/common-auth-embedded/logger/index.js +3 -0
  80. package/dist/src/common-auth-embedded/logger/redact.d.ts +11 -0
  81. package/dist/src/common-auth-embedded/logger/redact.js +83 -0
  82. package/dist/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  83. package/dist/src/common-auth-embedded/opencode2/errors.js +15 -0
  84. package/dist/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  85. package/dist/src/common-auth-embedded/opencode2/index.js +4 -0
  86. package/dist/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  87. package/dist/src/common-auth-embedded/opencode2/install.js +886 -0
  88. package/dist/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  89. package/dist/src/common-auth-embedded/opencode2/integration.js +143 -0
  90. package/dist/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  91. package/dist/src/common-auth-embedded/opencode2/sse.js +60 -0
  92. package/dist/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  93. package/dist/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
  94. package/dist/src/common-auth-embedded/pi-slot/index.js +2 -0
  95. package/dist/src/common-auth-embedded/pi-slot/lock.js +212 -0
  96. package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
  97. package/dist/src/common-auth-embedded/pi-slot/slot.js +383 -0
  98. package/dist/src/common-auth-embedded/quota/codec.d.ts +11 -0
  99. package/dist/src/common-auth-embedded/quota/codec.js +12 -0
  100. package/dist/src/common-auth-embedded/quota/format.d.ts +46 -0
  101. package/dist/src/common-auth-embedded/quota/format.js +138 -0
  102. package/dist/src/common-auth-embedded/quota/index.d.ts +10 -0
  103. package/dist/src/common-auth-embedded/quota/index.js +5 -0
  104. package/dist/src/common-auth-embedded/quota/map.d.ts +63 -0
  105. package/dist/src/common-auth-embedded/quota/map.js +105 -0
  106. package/dist/src/common-auth-embedded/quota/merge.d.ts +48 -0
  107. package/dist/src/common-auth-embedded/quota/merge.js +162 -0
  108. package/dist/src/common-auth-embedded/quota/projection.d.ts +64 -0
  109. package/dist/src/common-auth-embedded/quota/projection.js +134 -0
  110. package/dist/src/common-auth-embedded/routing/admission.d.ts +93 -0
  111. package/dist/src/common-auth-embedded/routing/admission.js +142 -0
  112. package/dist/src/common-auth-embedded/routing/index.d.ts +8 -0
  113. package/dist/src/common-auth-embedded/routing/index.js +4 -0
  114. package/dist/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  115. package/dist/src/common-auth-embedded/routing/ordered.js +58 -0
  116. package/dist/src/common-auth-embedded/routing/pins.d.ts +22 -0
  117. package/dist/src/common-auth-embedded/routing/pins.js +34 -0
  118. package/dist/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  119. package/dist/src/common-auth-embedded/routing/sticky.js +339 -0
  120. package/dist/src/common-auth-embedded/rpc/client.d.ts +3 -0
  121. package/dist/src/common-auth-embedded/rpc/client.js +2 -0
  122. package/dist/src/common-auth-embedded/rpc/index.d.ts +10 -0
  123. package/dist/src/common-auth-embedded/rpc/index.js +5 -0
  124. package/dist/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
  125. package/dist/src/common-auth-embedded/rpc/notifications.js +100 -0
  126. package/dist/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
  127. package/dist/src/common-auth-embedded/rpc/port-file.js +217 -0
  128. package/dist/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
  129. package/dist/src/common-auth-embedded/rpc/rpc-client.js +253 -0
  130. package/dist/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
  131. package/dist/src/common-auth-embedded/rpc/rpc-server.js +311 -0
  132. package/dist/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
  133. package/dist/src/common-auth-embedded/rpc/server-registry.js +47 -0
  134. package/dist/src/common-auth-embedded/source-output.json +1326 -0
  135. package/dist/src/common-auth-embedded/store/attribution.d.ts +28 -0
  136. package/dist/src/common-auth-embedded/store/attribution.js +60 -0
  137. package/dist/src/common-auth-embedded/store/errors.d.ts +55 -0
  138. package/dist/src/common-auth-embedded/store/errors.js +38 -0
  139. package/dist/src/common-auth-embedded/store/hooks.d.ts +12 -0
  140. package/dist/src/common-auth-embedded/store/hooks.js +34 -0
  141. package/dist/src/common-auth-embedded/store/identity.d.ts +39 -0
  142. package/dist/src/common-auth-embedded/store/identity.js +79 -0
  143. package/dist/src/common-auth-embedded/store/index.d.ts +21 -0
  144. package/dist/src/common-auth-embedded/store/index.js +7 -0
  145. package/dist/src/common-auth-embedded/store/mutate.d.ts +189 -0
  146. package/dist/src/common-auth-embedded/store/mutate.js +500 -0
  147. package/dist/src/common-auth-embedded/store/pool.d.ts +196 -0
  148. package/dist/src/common-auth-embedded/store/pool.js +120 -0
  149. package/dist/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  150. package/dist/src/common-auth-embedded/store/provider-state.js +226 -0
  151. package/dist/src/common-auth-embedded/store/publication.d.ts +47 -0
  152. package/dist/src/common-auth-embedded/store/publication.js +304 -0
  153. package/dist/src/common-auth-embedded/store/pull.d.ts +36 -0
  154. package/dist/src/common-auth-embedded/store/pull.js +143 -0
  155. package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  156. package/dist/src/common-auth-embedded/store/refresh-lock.js +136 -0
  157. package/dist/src/common-auth-embedded/store/refresh.d.ts +72 -0
  158. package/dist/src/common-auth-embedded/store/refresh.js +225 -0
  159. package/dist/src/common-auth-embedded/store/reserved.js +13 -0
  160. package/dist/src/common-auth-embedded/store/rows.d.ts +313 -0
  161. package/dist/src/common-auth-embedded/store/rows.js +1258 -0
  162. package/dist/src/common-auth-embedded/store/runtime.d.ts +36 -0
  163. package/dist/src/common-auth-embedded/store/runtime.js +68 -0
  164. package/dist/src/common-auth-embedded/store/schema.d.ts +443 -0
  165. package/dist/src/common-auth-embedded/store/schema.js +754 -0
  166. package/dist/src/common-auth-embedded/store/settings.d.ts +63 -0
  167. package/dist/src/common-auth-embedded/store/settings.js +120 -0
  168. package/dist/src/common-auth-embedded/store/torn.d.ts +78 -0
  169. package/dist/src/common-auth-embedded/store/torn.js +294 -0
  170. package/dist/src/common-auth-embedded/tui/index.d.ts +8 -0
  171. package/dist/src/common-auth-embedded/tui/index.js +21 -0
  172. package/dist/src/common-auth-embedded/util/any-signal.js +42 -0
  173. package/dist/src/constants.d.ts +1 -0
  174. package/dist/src/constants.d.ts.map +1 -1
  175. package/dist/src/constants.js +4 -0
  176. package/dist/src/constants.js.map +1 -1
  177. package/dist/src/ga/proxy-guard.d.ts +120 -0
  178. package/dist/src/ga/proxy-guard.d.ts.map +1 -0
  179. package/dist/src/ga/proxy-guard.js +269 -0
  180. package/dist/src/ga/proxy-guard.js.map +1 -0
  181. package/dist/src/ga/rpc/protocol.d.ts +504 -0
  182. package/dist/src/ga/rpc/protocol.d.ts.map +1 -0
  183. package/dist/src/ga/rpc/protocol.js +1278 -0
  184. package/dist/src/ga/rpc/protocol.js.map +1 -0
  185. package/dist/src/ga/server/auth.d.ts +9 -0
  186. package/dist/src/ga/server/auth.d.ts.map +1 -0
  187. package/dist/src/ga/server/auth.js +37 -0
  188. package/dist/src/ga/server/auth.js.map +1 -0
  189. package/dist/src/ga/server/index.d.ts +576 -0
  190. package/dist/src/ga/server/index.d.ts.map +1 -0
  191. package/dist/src/ga/server/index.js +1012 -0
  192. package/dist/src/ga/server/index.js.map +1 -0
  193. package/dist/src/ga/tui/host-ga.d.ts +350 -0
  194. package/dist/src/ga/tui/host-ga.d.ts.map +1 -0
  195. package/dist/src/ga/tui/host-ga.js +1242 -0
  196. package/dist/src/ga/tui/host-ga.js.map +1 -0
  197. package/dist/src/logging/provider-key-policy.d.ts +9 -0
  198. package/dist/src/logging/provider-key-policy.d.ts.map +1 -0
  199. package/dist/src/logging/provider-key-policy.js +11 -0
  200. package/dist/src/logging/provider-key-policy.js.map +1 -0
  201. package/dist/src/plugin/account-access.d.ts +130 -15
  202. package/dist/src/plugin/account-access.d.ts.map +1 -1
  203. package/dist/src/plugin/account-access.js +331 -129
  204. package/dist/src/plugin/account-access.js.map +1 -1
  205. package/dist/src/plugin/account-blocks.d.ts +102 -0
  206. package/dist/src/plugin/account-blocks.d.ts.map +1 -0
  207. package/dist/src/plugin/account-blocks.js +196 -0
  208. package/dist/src/plugin/account-blocks.js.map +1 -0
  209. package/dist/src/plugin/accounts.d.ts +85 -1
  210. package/dist/src/plugin/accounts.d.ts.map +1 -1
  211. package/dist/src/plugin/accounts.js +127 -3
  212. package/dist/src/plugin/accounts.js.map +1 -1
  213. package/dist/src/plugin/auth-loader.d.ts +69 -5
  214. package/dist/src/plugin/auth-loader.d.ts.map +1 -1
  215. package/dist/src/plugin/auth-loader.js +355 -52
  216. package/dist/src/plugin/auth-loader.js.map +1 -1
  217. package/dist/src/plugin/background-quota-refresh.d.ts +54 -8
  218. package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
  219. package/dist/src/plugin/background-quota-refresh.js +81 -24
  220. package/dist/src/plugin/background-quota-refresh.js.map +1 -1
  221. package/dist/src/plugin/cache/index.d.ts +1 -1
  222. package/dist/src/plugin/cache/index.d.ts.map +1 -1
  223. package/dist/src/plugin/cache/index.js +1 -1
  224. package/dist/src/plugin/cache/index.js.map +1 -1
  225. package/dist/src/plugin/cache/signature-cache.d.ts +55 -10
  226. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  227. package/dist/src/plugin/cache/signature-cache.js +100 -41
  228. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  229. package/dist/src/plugin/cache.d.ts +80 -16
  230. package/dist/src/plugin/cache.d.ts.map +1 -1
  231. package/dist/src/plugin/cache.js +339 -200
  232. package/dist/src/plugin/cache.js.map +1 -1
  233. package/dist/src/plugin/catalog.d.ts +4 -18
  234. package/dist/src/plugin/catalog.d.ts.map +1 -1
  235. package/dist/src/plugin/catalog.js +11 -41
  236. package/dist/src/plugin/catalog.js.map +1 -1
  237. package/dist/src/plugin/command-apply.d.ts +58 -0
  238. package/dist/src/plugin/command-apply.d.ts.map +1 -0
  239. package/dist/src/plugin/command-apply.js +168 -0
  240. package/dist/src/plugin/command-apply.js.map +1 -0
  241. package/dist/src/plugin/command-data.d.ts +1 -0
  242. package/dist/src/plugin/command-data.d.ts.map +1 -1
  243. package/dist/src/plugin/command-data.js +2 -0
  244. package/dist/src/plugin/command-data.js.map +1 -1
  245. package/dist/src/plugin/commands.d.ts +142 -132
  246. package/dist/src/plugin/commands.d.ts.map +1 -1
  247. package/dist/src/plugin/commands.js +214 -686
  248. package/dist/src/plugin/commands.js.map +1 -1
  249. package/dist/src/plugin/config/index.d.ts +1 -1
  250. package/dist/src/plugin/config/index.d.ts.map +1 -1
  251. package/dist/src/plugin/config/index.js +1 -1
  252. package/dist/src/plugin/config/index.js.map +1 -1
  253. package/dist/src/plugin/config/loader.d.ts +37 -1
  254. package/dist/src/plugin/config/loader.d.ts.map +1 -1
  255. package/dist/src/plugin/config/loader.js +64 -9
  256. package/dist/src/plugin/config/loader.js.map +1 -1
  257. package/dist/src/plugin/config/operator-settings-schema.d.ts +2 -2
  258. package/dist/src/plugin/config/schema.d.ts +2 -2
  259. package/dist/src/plugin/config/writer.d.ts +7 -0
  260. package/dist/src/plugin/config/writer.d.ts.map +1 -1
  261. package/dist/src/plugin/config/writer.js +10 -1
  262. package/dist/src/plugin/config/writer.js.map +1 -1
  263. package/dist/src/plugin/debug.d.ts +72 -29
  264. package/dist/src/plugin/debug.d.ts.map +1 -1
  265. package/dist/src/plugin/debug.js +353 -239
  266. package/dist/src/plugin/debug.js.map +1 -1
  267. package/dist/src/plugin/fetch/retry-state.d.ts +1 -1
  268. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
  269. package/dist/src/plugin/fetch/retry-state.js.map +1 -1
  270. package/dist/src/plugin/fetch-interceptor.d.ts +66 -11
  271. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  272. package/dist/src/plugin/fetch-interceptor.js +228 -1352
  273. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  274. package/dist/src/plugin/fetch-routing.d.ts +7 -2
  275. package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
  276. package/dist/src/plugin/fetch-routing.js +7 -4
  277. package/dist/src/plugin/fetch-routing.js.map +1 -1
  278. package/dist/src/plugin/ga-location-services.d.ts +389 -0
  279. package/dist/src/plugin/ga-location-services.d.ts.map +1 -0
  280. package/dist/src/plugin/ga-location-services.js +1838 -0
  281. package/dist/src/plugin/ga-location-services.js.map +1 -0
  282. package/dist/src/plugin/gemini-dump.d.ts +37 -12
  283. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  284. package/dist/src/plugin/gemini-dump.js +42 -21
  285. package/dist/src/plugin/gemini-dump.js.map +1 -1
  286. package/dist/src/plugin/google-search-tool.d.ts +2 -1
  287. package/dist/src/plugin/google-search-tool.d.ts.map +1 -1
  288. package/dist/src/plugin/google-search-tool.js +4 -1
  289. package/dist/src/plugin/google-search-tool.js.map +1 -1
  290. package/dist/src/plugin/index.d.ts.map +1 -1
  291. package/dist/src/plugin/index.js +505 -141
  292. package/dist/src/plugin/index.js.map +1 -1
  293. package/dist/src/plugin/killswitch.d.ts +1 -2
  294. package/dist/src/plugin/killswitch.d.ts.map +1 -1
  295. package/dist/src/plugin/lifecycle.d.ts +24 -1
  296. package/dist/src/plugin/lifecycle.d.ts.map +1 -1
  297. package/dist/src/plugin/lifecycle.js +95 -8
  298. package/dist/src/plugin/lifecycle.js.map +1 -1
  299. package/dist/src/plugin/logger.d.ts +61 -10
  300. package/dist/src/plugin/logger.d.ts.map +1 -1
  301. package/dist/src/plugin/logger.js +134 -63
  302. package/dist/src/plugin/logger.js.map +1 -1
  303. package/dist/src/plugin/neutral-types.d.ts +42 -0
  304. package/dist/src/plugin/neutral-types.d.ts.map +1 -0
  305. package/dist/src/plugin/neutral-types.js +12 -0
  306. package/dist/src/plugin/neutral-types.js.map +1 -0
  307. package/dist/src/plugin/oauth-methods.d.ts +2 -1
  308. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  309. package/dist/src/plugin/oauth-methods.js +173 -88
  310. package/dist/src/plugin/oauth-methods.js.map +1 -1
  311. package/dist/src/plugin/operator-settings.d.ts +34 -0
  312. package/dist/src/plugin/operator-settings.d.ts.map +1 -1
  313. package/dist/src/plugin/operator-settings.js +105 -2
  314. package/dist/src/plugin/operator-settings.js.map +1 -1
  315. package/dist/src/plugin/persist-account-pool.d.ts +63 -2
  316. package/dist/src/plugin/persist-account-pool.d.ts.map +1 -1
  317. package/dist/src/plugin/persist-account-pool.js +125 -2
  318. package/dist/src/plugin/persist-account-pool.js.map +1 -1
  319. package/dist/src/plugin/quota.d.ts +335 -35
  320. package/dist/src/plugin/quota.d.ts.map +1 -1
  321. package/dist/src/plugin/quota.js +825 -95
  322. package/dist/src/plugin/quota.js.map +1 -1
  323. package/dist/src/plugin/refresh-queue.d.ts +35 -5
  324. package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
  325. package/dist/src/plugin/refresh-queue.js +50 -16
  326. package/dist/src/plugin/refresh-queue.js.map +1 -1
  327. package/dist/src/plugin/request-helpers.d.ts +30 -5
  328. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  329. package/dist/src/plugin/request-helpers.js +82 -17
  330. package/dist/src/plugin/request-helpers.js.map +1 -1
  331. package/dist/src/plugin/request.d.ts +63 -15
  332. package/dist/src/plugin/request.d.ts.map +1 -1
  333. package/dist/src/plugin/request.js +229 -65
  334. package/dist/src/plugin/request.js.map +1 -1
  335. package/dist/src/plugin/session-context.d.ts.map +1 -1
  336. package/dist/src/plugin/session-context.js +5 -2
  337. package/dist/src/plugin/session-context.js.map +1 -1
  338. package/dist/src/plugin/shared/local-grant.d.ts +26 -0
  339. package/dist/src/plugin/shared/local-grant.d.ts.map +1 -0
  340. package/dist/src/plugin/shared/local-grant.js +19 -0
  341. package/dist/src/plugin/shared/local-grant.js.map +1 -0
  342. package/dist/src/plugin/shared/request-cancellation.d.ts +12 -0
  343. package/dist/src/plugin/shared/request-cancellation.d.ts.map +1 -0
  344. package/dist/src/plugin/shared/request-cancellation.js +118 -0
  345. package/dist/src/plugin/shared/request-cancellation.js.map +1 -0
  346. package/dist/src/plugin/shared/request-services.d.ts +375 -0
  347. package/dist/src/plugin/shared/request-services.d.ts.map +1 -0
  348. package/dist/src/plugin/shared/request-services.js +1752 -0
  349. package/dist/src/plugin/shared/request-services.js.map +1 -0
  350. package/dist/src/plugin/shared/runtime.d.ts +217 -0
  351. package/dist/src/plugin/shared/runtime.d.ts.map +1 -0
  352. package/dist/src/plugin/shared/runtime.js +345 -0
  353. package/dist/src/plugin/shared/runtime.js.map +1 -0
  354. package/dist/src/plugin/shared/source-sidebar.d.ts +15 -0
  355. package/dist/src/plugin/shared/source-sidebar.d.ts.map +1 -0
  356. package/dist/src/plugin/shared/source-sidebar.js +41 -0
  357. package/dist/src/plugin/shared/source-sidebar.js.map +1 -0
  358. package/dist/src/plugin/shared/vault-menu.d.ts +5 -0
  359. package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -0
  360. package/dist/src/plugin/shared/vault-menu.js +49 -0
  361. package/dist/src/plugin/shared/vault-menu.js.map +1 -0
  362. package/dist/src/plugin/shared/vault-request-credentials.d.ts +168 -0
  363. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
  364. package/dist/src/plugin/shared/vault-request-credentials.js +485 -0
  365. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -0
  366. package/dist/src/plugin/storage.d.ts +127 -1
  367. package/dist/src/plugin/storage.d.ts.map +1 -1
  368. package/dist/src/plugin/storage.js +188 -3
  369. package/dist/src/plugin/storage.js.map +1 -1
  370. package/dist/src/plugin/token.d.ts +23 -1
  371. package/dist/src/plugin/token.d.ts.map +1 -1
  372. package/dist/src/plugin/token.js +117 -58
  373. package/dist/src/plugin/token.js.map +1 -1
  374. package/dist/src/plugin/ui/quota-status.d.ts +1 -10
  375. package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
  376. package/dist/src/plugin/ui/quota-status.js +6 -42
  377. package/dist/src/plugin/ui/quota-status.js.map +1 -1
  378. package/dist/src/plugin/vault-activation.d.ts +11 -0
  379. package/dist/src/plugin/vault-activation.d.ts.map +1 -0
  380. package/dist/src/plugin/vault-activation.js +53 -0
  381. package/dist/src/plugin/vault-activation.js.map +1 -0
  382. package/dist/src/plugin/vault-custody.d.ts +131 -0
  383. package/dist/src/plugin/vault-custody.d.ts.map +1 -0
  384. package/dist/src/plugin/vault-custody.js +381 -0
  385. package/dist/src/plugin/vault-custody.js.map +1 -0
  386. package/dist/src/quota-presentation.d.ts +18 -0
  387. package/dist/src/quota-presentation.d.ts.map +1 -0
  388. package/dist/src/quota-presentation.js +58 -0
  389. package/dist/src/quota-presentation.js.map +1 -0
  390. package/dist/src/rpc/notifications.d.ts +2 -2
  391. package/dist/src/rpc/notifications.d.ts.map +1 -1
  392. package/dist/src/rpc/notifications.js +1 -1
  393. package/dist/src/rpc/notifications.js.map +1 -1
  394. package/dist/src/rpc/port-file.d.ts +2 -12
  395. package/dist/src/rpc/port-file.d.ts.map +1 -1
  396. package/dist/src/rpc/port-file.js +5 -107
  397. package/dist/src/rpc/port-file.js.map +1 -1
  398. package/dist/src/rpc/protocol.d.ts +47 -16
  399. package/dist/src/rpc/protocol.d.ts.map +1 -1
  400. package/dist/src/rpc/rpc-client.d.ts +27 -3
  401. package/dist/src/rpc/rpc-client.d.ts.map +1 -1
  402. package/dist/src/rpc/rpc-client.js +55 -45
  403. package/dist/src/rpc/rpc-client.js.map +1 -1
  404. package/dist/src/rpc/rpc-server.d.ts +13 -2
  405. package/dist/src/rpc/rpc-server.d.ts.map +1 -1
  406. package/dist/src/rpc/rpc-server.js +38 -212
  407. package/dist/src/rpc/rpc-server.js.map +1 -1
  408. package/dist/src/server.d.ts +30 -0
  409. package/dist/src/server.d.ts.map +1 -0
  410. package/dist/src/server.js +29 -0
  411. package/dist/src/server.js.map +1 -0
  412. package/dist/src/sidebar-projection.d.ts +102 -0
  413. package/dist/src/sidebar-projection.d.ts.map +1 -0
  414. package/dist/src/sidebar-projection.js +146 -0
  415. package/dist/src/sidebar-projection.js.map +1 -0
  416. package/dist/src/sidebar-state.d.ts +13 -5
  417. package/dist/src/sidebar-state.d.ts.map +1 -1
  418. package/dist/src/sidebar-state.js +49 -16
  419. package/dist/src/sidebar-state.js.map +1 -1
  420. package/dist/src/tui/command-dialogs.d.ts +58 -52
  421. package/dist/src/tui/command-dialogs.d.ts.map +1 -1
  422. package/dist/src/tui/command-dialogs.js +379 -571
  423. package/dist/src/tui/command-dialogs.js.map +1 -1
  424. package/dist/src/tui/file-logger.d.ts +2 -3
  425. package/dist/src/tui/file-logger.d.ts.map +1 -1
  426. package/dist/src/tui/file-logger.js +21 -7
  427. package/dist/src/tui/file-logger.js.map +1 -1
  428. package/dist/src/tui/host-api.d.ts +196 -0
  429. package/dist/src/tui/host-api.d.ts.map +1 -0
  430. package/dist/src/tui/host-api.js +357 -0
  431. package/dist/src/tui/host-api.js.map +1 -0
  432. package/dist/src/tui/host-v1.d.ts +60 -0
  433. package/dist/src/tui/host-v1.d.ts.map +1 -0
  434. package/dist/src/tui/host-v1.js +147 -0
  435. package/dist/src/tui/host-v1.js.map +1 -0
  436. package/dist/src/tui/vault-setup.d.ts +98 -0
  437. package/dist/src/tui/vault-setup.d.ts.map +1 -0
  438. package/dist/src/tui/vault-setup.js +198 -0
  439. package/dist/src/tui/vault-setup.js.map +1 -0
  440. package/dist/src/tui.d.ts +4 -11
  441. package/dist/src/tui.d.ts.map +1 -1
  442. package/dist/src/tui.js +33 -75
  443. package/dist/src/tui.js.map +1 -1
  444. package/dist/tui-build-map.json +380 -0
  445. package/dist/tui-ga-build-map.json +187 -0
  446. package/dist/types/src/antigravity/oauth.d.ts +2 -0
  447. package/dist/types/src/antigravity/oauth.d.ts.map +1 -0
  448. package/dist/types/src/cli.d.ts +66 -0
  449. package/dist/types/src/cli.d.ts.map +1 -0
  450. package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  451. package/dist/types/src/common-auth-embedded/commands/index.d.ts +10 -0
  452. package/dist/types/src/common-auth-embedded/commands/menu.d.ts +61 -0
  453. package/dist/types/src/common-auth-embedded/commands/model.d.ts +238 -0
  454. package/dist/types/src/common-auth-embedded/commands/pi.d.ts +23 -0
  455. package/dist/types/src/common-auth-embedded/commands/seam.d.ts +72 -0
  456. package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  457. package/dist/types/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  458. package/dist/types/src/common-auth-embedded/logger/engine.d.ts +100 -0
  459. package/dist/types/src/common-auth-embedded/logger/index.d.ts +6 -0
  460. package/dist/types/src/common-auth-embedded/logger/redact.d.ts +11 -0
  461. package/dist/types/src/common-auth-embedded/quota/codec.d.ts +11 -0
  462. package/dist/types/src/common-auth-embedded/quota/format.d.ts +46 -0
  463. package/dist/types/src/common-auth-embedded/quota/index.d.ts +10 -0
  464. package/dist/types/src/common-auth-embedded/quota/map.d.ts +63 -0
  465. package/dist/types/src/common-auth-embedded/quota/merge.d.ts +48 -0
  466. package/dist/types/src/common-auth-embedded/quota/projection.d.ts +64 -0
  467. package/dist/types/src/common-auth-embedded/store/attribution.d.ts +28 -0
  468. package/dist/types/src/common-auth-embedded/store/errors.d.ts +55 -0
  469. package/dist/types/src/common-auth-embedded/store/hooks.d.ts +12 -0
  470. package/dist/types/src/common-auth-embedded/store/identity.d.ts +39 -0
  471. package/dist/types/src/common-auth-embedded/store/index.d.ts +21 -0
  472. package/dist/types/src/common-auth-embedded/store/mutate.d.ts +189 -0
  473. package/dist/types/src/common-auth-embedded/store/pool.d.ts +196 -0
  474. package/dist/types/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  475. package/dist/types/src/common-auth-embedded/store/publication.d.ts +47 -0
  476. package/dist/types/src/common-auth-embedded/store/pull.d.ts +36 -0
  477. package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  478. package/dist/types/src/common-auth-embedded/store/refresh.d.ts +72 -0
  479. package/dist/types/src/common-auth-embedded/store/rows.d.ts +313 -0
  480. package/dist/types/src/common-auth-embedded/store/runtime.d.ts +36 -0
  481. package/dist/types/src/common-auth-embedded/store/schema.d.ts +443 -0
  482. package/dist/types/src/common-auth-embedded/store/settings.d.ts +63 -0
  483. package/dist/types/src/common-auth-embedded/store/torn.d.ts +78 -0
  484. package/dist/types/src/constants.d.ts +3 -0
  485. package/dist/types/src/constants.d.ts.map +1 -0
  486. package/dist/types/src/ga/proxy-guard.d.ts +120 -0
  487. package/dist/types/src/ga/proxy-guard.d.ts.map +1 -0
  488. package/dist/types/src/ga/rpc/protocol.d.ts +504 -0
  489. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -0
  490. package/dist/types/src/ga/server/auth.d.ts +9 -0
  491. package/dist/types/src/ga/server/auth.d.ts.map +1 -0
  492. package/dist/types/src/ga/server/index.d.ts +576 -0
  493. package/dist/types/src/ga/server/index.d.ts.map +1 -0
  494. package/dist/types/src/hooks/auto-update-checker/cache.d.ts +3 -0
  495. package/dist/types/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  496. package/dist/types/src/hooks/auto-update-checker/checker.d.ts +16 -0
  497. package/dist/types/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  498. package/dist/types/src/hooks/auto-update-checker/constants.d.ts +9 -0
  499. package/dist/types/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  500. package/dist/types/src/hooks/auto-update-checker/index.d.ts +34 -0
  501. package/dist/types/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  502. package/dist/types/src/hooks/auto-update-checker/logging.d.ts +3 -0
  503. package/dist/types/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
  504. package/dist/types/src/hooks/auto-update-checker/types.d.ts +25 -0
  505. package/dist/types/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  506. package/dist/types/src/logging/provider-key-policy.d.ts +9 -0
  507. package/dist/types/src/logging/provider-key-policy.d.ts.map +1 -0
  508. package/dist/types/src/plugin/account-access.d.ts +214 -0
  509. package/dist/types/src/plugin/account-access.d.ts.map +1 -0
  510. package/dist/types/src/plugin/account-blocks.d.ts +102 -0
  511. package/dist/types/src/plugin/account-blocks.d.ts.map +1 -0
  512. package/dist/types/src/plugin/account-command-oauth.d.ts +34 -0
  513. package/dist/types/src/plugin/account-command-oauth.d.ts.map +1 -0
  514. package/dist/types/src/plugin/accounts.d.ts +94 -0
  515. package/dist/types/src/plugin/accounts.d.ts.map +1 -0
  516. package/dist/types/src/plugin/agy-request-metadata.d.ts +2 -0
  517. package/dist/types/src/plugin/agy-request-metadata.d.ts.map +1 -0
  518. package/dist/types/src/plugin/agy-transport.d.ts +2 -0
  519. package/dist/types/src/plugin/agy-transport.d.ts.map +1 -0
  520. package/dist/types/src/plugin/auth-doctor.d.ts +30 -0
  521. package/dist/types/src/plugin/auth-doctor.d.ts.map +1 -0
  522. package/dist/types/src/plugin/auth-drift.d.ts +13 -0
  523. package/dist/types/src/plugin/auth-drift.d.ts.map +1 -0
  524. package/dist/types/src/plugin/auth-loader.d.ts +114 -0
  525. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -0
  526. package/dist/types/src/plugin/auth.d.ts +2 -0
  527. package/dist/types/src/plugin/auth.d.ts.map +1 -0
  528. package/dist/types/src/plugin/background-quota-refresh.d.ts +192 -0
  529. package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -0
  530. package/dist/types/src/plugin/cache/signature-cache.d.ts +156 -0
  531. package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -0
  532. package/dist/types/src/plugin/cache.d.ts +109 -0
  533. package/dist/types/src/plugin/cache.d.ts.map +1 -0
  534. package/dist/types/src/plugin/catalog.d.ts +9 -0
  535. package/dist/types/src/plugin/catalog.d.ts.map +1 -0
  536. package/dist/types/src/plugin/cli.d.ts +44 -0
  537. package/dist/types/src/plugin/cli.d.ts.map +1 -0
  538. package/dist/types/src/plugin/command-apply.d.ts +58 -0
  539. package/dist/types/src/plugin/command-apply.d.ts.map +1 -0
  540. package/dist/types/src/plugin/command-data.d.ts +330 -0
  541. package/dist/types/src/plugin/command-data.d.ts.map +1 -0
  542. package/dist/types/src/plugin/commands.d.ts +164 -0
  543. package/dist/types/src/plugin/commands.d.ts.map +1 -0
  544. package/dist/types/src/plugin/config/index.d.ts +16 -0
  545. package/dist/types/src/plugin/config/index.d.ts.map +1 -0
  546. package/dist/types/src/plugin/config/loader.d.ts +72 -0
  547. package/dist/types/src/plugin/config/loader.d.ts.map +1 -0
  548. package/dist/types/src/plugin/config/models.d.ts +3 -0
  549. package/dist/types/src/plugin/config/models.d.ts.map +1 -0
  550. package/dist/types/src/plugin/config/operator-settings-schema.d.ts +29 -0
  551. package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
  552. package/dist/types/src/plugin/config/schema.d.ts +162 -0
  553. package/dist/types/src/plugin/config/schema.d.ts.map +1 -0
  554. package/dist/types/src/plugin/config/updater.d.ts +55 -0
  555. package/dist/types/src/plugin/config/updater.d.ts.map +1 -0
  556. package/dist/types/src/plugin/config/writer.d.ts +41 -0
  557. package/dist/types/src/plugin/config/writer.d.ts.map +1 -0
  558. package/dist/types/src/plugin/core/streaming/index.d.ts +3 -0
  559. package/dist/types/src/plugin/core/streaming/index.d.ts.map +1 -0
  560. package/dist/types/src/plugin/core/streaming/transformer.d.ts +12 -0
  561. package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  562. package/dist/types/src/plugin/core/streaming/types.d.ts +34 -0
  563. package/dist/types/src/plugin/core/streaming/types.d.ts.map +1 -0
  564. package/dist/types/src/plugin/debug.d.ts +144 -0
  565. package/dist/types/src/plugin/debug.d.ts.map +1 -0
  566. package/dist/types/src/plugin/dependencies.d.ts +129 -0
  567. package/dist/types/src/plugin/dependencies.d.ts.map +1 -0
  568. package/dist/types/src/plugin/errors.d.ts +55 -0
  569. package/dist/types/src/plugin/errors.d.ts.map +1 -0
  570. package/dist/types/src/plugin/event-handler.d.ts +53 -0
  571. package/dist/types/src/plugin/event-handler.d.ts.map +1 -0
  572. package/dist/types/src/plugin/fetch/retry-state.d.ts +61 -0
  573. package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -0
  574. package/dist/types/src/plugin/fetch/warmup.d.ts +30 -0
  575. package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -0
  576. package/dist/types/src/plugin/fetch-interceptor.d.ts +114 -0
  577. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -0
  578. package/dist/types/src/plugin/fetch-routing.d.ts +31 -0
  579. package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -0
  580. package/dist/types/src/plugin/fingerprint.d.ts +2 -0
  581. package/dist/types/src/plugin/fingerprint.d.ts.map +1 -0
  582. package/dist/types/src/plugin/ga-location-services.d.ts +389 -0
  583. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -0
  584. package/dist/types/src/plugin/gemini-dump.d.ts +72 -0
  585. package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -0
  586. package/dist/types/src/plugin/google-search-tool.d.ts +10 -0
  587. package/dist/types/src/plugin/google-search-tool.d.ts.map +1 -0
  588. package/dist/types/src/plugin/image-saver.d.ts +6 -0
  589. package/dist/types/src/plugin/image-saver.d.ts.map +1 -0
  590. package/dist/types/src/plugin/index.d.ts +30 -0
  591. package/dist/types/src/plugin/index.d.ts.map +1 -0
  592. package/dist/types/src/plugin/killswitch.d.ts +93 -0
  593. package/dist/types/src/plugin/killswitch.d.ts.map +1 -0
  594. package/dist/types/src/plugin/lifecycle.d.ts +63 -0
  595. package/dist/types/src/plugin/lifecycle.d.ts.map +1 -0
  596. package/dist/types/src/plugin/logger.d.ts +83 -0
  597. package/dist/types/src/plugin/logger.d.ts.map +1 -0
  598. package/dist/types/src/plugin/logging-utils.d.ts +57 -0
  599. package/dist/types/src/plugin/logging-utils.d.ts.map +1 -0
  600. package/dist/types/src/plugin/model-registry.d.ts +2 -0
  601. package/dist/types/src/plugin/model-registry.d.ts.map +1 -0
  602. package/dist/types/src/plugin/neutral-types.d.ts +42 -0
  603. package/dist/types/src/plugin/neutral-types.d.ts.map +1 -0
  604. package/dist/types/src/plugin/oauth-login.d.ts +22 -0
  605. package/dist/types/src/plugin/oauth-login.d.ts.map +1 -0
  606. package/dist/types/src/plugin/oauth-methods.d.ts +43 -0
  607. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -0
  608. package/dist/types/src/plugin/operator-settings.d.ts +74 -0
  609. package/dist/types/src/plugin/operator-settings.d.ts.map +1 -0
  610. package/dist/types/src/plugin/persist-account-pool.d.ts +98 -0
  611. package/dist/types/src/plugin/persist-account-pool.d.ts.map +1 -0
  612. package/dist/types/src/plugin/project.d.ts +2 -0
  613. package/dist/types/src/plugin/project.d.ts.map +1 -0
  614. package/dist/types/src/plugin/prompt-context.d.ts +18 -0
  615. package/dist/types/src/plugin/prompt-context.d.ts.map +1 -0
  616. package/dist/types/src/plugin/quota.d.ts +441 -0
  617. package/dist/types/src/plugin/quota.d.ts.map +1 -0
  618. package/dist/types/src/plugin/recovery/constants.d.ts +22 -0
  619. package/dist/types/src/plugin/recovery/constants.d.ts.map +1 -0
  620. package/dist/types/src/plugin/recovery/storage.d.ts +24 -0
  621. package/dist/types/src/plugin/recovery/storage.d.ts.map +1 -0
  622. package/dist/types/src/plugin/recovery/types.d.ts +116 -0
  623. package/dist/types/src/plugin/recovery/types.d.ts.map +1 -0
  624. package/dist/types/src/plugin/recovery.d.ts +61 -0
  625. package/dist/types/src/plugin/recovery.d.ts.map +1 -0
  626. package/dist/types/src/plugin/refresh-queue.d.ts +133 -0
  627. package/dist/types/src/plugin/refresh-queue.d.ts.map +1 -0
  628. package/dist/types/src/plugin/request-helpers.d.ts +304 -0
  629. package/dist/types/src/plugin/request-helpers.d.ts.map +1 -0
  630. package/dist/types/src/plugin/request.d.ts +161 -0
  631. package/dist/types/src/plugin/request.d.ts.map +1 -0
  632. package/dist/types/src/plugin/rotation.d.ts +2 -0
  633. package/dist/types/src/plugin/rotation.d.ts.map +1 -0
  634. package/dist/types/src/plugin/search.d.ts +25 -0
  635. package/dist/types/src/plugin/search.d.ts.map +1 -0
  636. package/dist/types/src/plugin/server.d.ts +23 -0
  637. package/dist/types/src/plugin/server.d.ts.map +1 -0
  638. package/dist/types/src/plugin/session-context.d.ts +22 -0
  639. package/dist/types/src/plugin/session-context.d.ts.map +1 -0
  640. package/dist/types/src/plugin/shared/local-grant.d.ts +26 -0
  641. package/dist/types/src/plugin/shared/local-grant.d.ts.map +1 -0
  642. package/dist/types/src/plugin/shared/request-cancellation.d.ts +12 -0
  643. package/dist/types/src/plugin/shared/request-cancellation.d.ts.map +1 -0
  644. package/dist/types/src/plugin/shared/request-services.d.ts +375 -0
  645. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -0
  646. package/dist/types/src/plugin/shared/runtime.d.ts +217 -0
  647. package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -0
  648. package/dist/types/src/plugin/shared/source-sidebar.d.ts +15 -0
  649. package/dist/types/src/plugin/shared/source-sidebar.d.ts.map +1 -0
  650. package/dist/types/src/plugin/shared/vault-menu.d.ts +5 -0
  651. package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -0
  652. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +168 -0
  653. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
  654. package/dist/types/src/plugin/storage.d.ts +221 -0
  655. package/dist/types/src/plugin/storage.d.ts.map +1 -0
  656. package/dist/types/src/plugin/stores/signature-store.d.ts +5 -0
  657. package/dist/types/src/plugin/stores/signature-store.d.ts.map +1 -0
  658. package/dist/types/src/plugin/thinking-recovery.d.ts +90 -0
  659. package/dist/types/src/plugin/thinking-recovery.d.ts.map +1 -0
  660. package/dist/types/src/plugin/token.d.ts +41 -0
  661. package/dist/types/src/plugin/token.d.ts.map +1 -0
  662. package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts +2 -0
  663. package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  664. package/dist/types/src/plugin/transform/index.d.ts +2 -0
  665. package/dist/types/src/plugin/transform/index.d.ts.map +1 -0
  666. package/dist/types/src/plugin/transform/model-resolver.d.ts +2 -0
  667. package/dist/types/src/plugin/transform/model-resolver.d.ts.map +1 -0
  668. package/dist/types/src/plugin/transform/types.d.ts +2 -0
  669. package/dist/types/src/plugin/transform/types.d.ts.map +1 -0
  670. package/dist/types/src/plugin/types.d.ts +36 -0
  671. package/dist/types/src/plugin/types.d.ts.map +1 -0
  672. package/dist/types/src/plugin/ui/ansi.d.ts +32 -0
  673. package/dist/types/src/plugin/ui/ansi.d.ts.map +1 -0
  674. package/dist/types/src/plugin/ui/auth-menu.d.ts +59 -0
  675. package/dist/types/src/plugin/ui/auth-menu.d.ts.map +1 -0
  676. package/dist/types/src/plugin/ui/confirm.d.ts +2 -0
  677. package/dist/types/src/plugin/ui/confirm.d.ts.map +1 -0
  678. package/dist/types/src/plugin/ui/quota-status.d.ts +73 -0
  679. package/dist/types/src/plugin/ui/quota-status.d.ts.map +1 -0
  680. package/dist/types/src/plugin/ui/select.d.ts +23 -0
  681. package/dist/types/src/plugin/ui/select.d.ts.map +1 -0
  682. package/dist/types/src/plugin/vault-activation.d.ts +11 -0
  683. package/dist/types/src/plugin/vault-activation.d.ts.map +1 -0
  684. package/dist/types/src/plugin/vault-custody.d.ts +131 -0
  685. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -0
  686. package/dist/types/src/plugin/version.d.ts +2 -0
  687. package/dist/types/src/plugin/version.d.ts.map +1 -0
  688. package/dist/types/src/quota-presentation.d.ts +18 -0
  689. package/dist/types/src/quota-presentation.d.ts.map +1 -0
  690. package/dist/types/src/rpc/notifications.d.ts +6 -0
  691. package/dist/types/src/rpc/notifications.d.ts.map +1 -0
  692. package/dist/types/src/rpc/protocol.d.ts +53 -0
  693. package/dist/types/src/rpc/protocol.d.ts.map +1 -0
  694. package/dist/types/src/rpc/rpc-dir.d.ts +4 -0
  695. package/dist/types/src/rpc/rpc-dir.d.ts.map +1 -0
  696. package/dist/types/src/rpc/rpc-server.d.ts +24 -0
  697. package/dist/types/src/rpc/rpc-server.d.ts.map +1 -0
  698. package/dist/types/src/server.d.ts +30 -0
  699. package/dist/types/src/server.d.ts.map +1 -0
  700. package/dist/types/src/sidebar-state.d.ts +365 -0
  701. package/dist/types/src/sidebar-state.d.ts.map +1 -0
  702. package/dist/types/src/tui/host-api.d.ts +196 -0
  703. package/dist/types/src/tui/host-api.d.ts.map +1 -0
  704. package/package.json +46 -19
  705. package/server.js +6 -0
  706. package/src/common-auth-embedded/NOTICE.txt +21 -0
  707. package/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
  708. package/src/common-auth-embedded/auth-menu/accounts.js +387 -0
  709. package/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
  710. package/src/common-auth-embedded/auth-menu/ansi.js +98 -0
  711. package/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
  712. package/src/common-auth-embedded/auth-menu/confirm.js +21 -0
  713. package/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
  714. package/src/common-auth-embedded/auth-menu/doctor.js +81 -0
  715. package/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
  716. package/src/common-auth-embedded/auth-menu/index.js +12 -0
  717. package/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
  718. package/src/common-auth-embedded/auth-menu/login.js +83 -0
  719. package/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
  720. package/src/common-auth-embedded/auth-menu/menu.js +73 -0
  721. package/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
  722. package/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
  723. package/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
  724. package/src/common-auth-embedded/auth-menu/select.js +159 -0
  725. package/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  726. package/src/common-auth-embedded/auth-menu/terminal.js +19 -0
  727. package/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
  728. package/src/common-auth-embedded/claustrum/consumer.js +298 -0
  729. package/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
  730. package/src/common-auth-embedded/claustrum/custody.js +354 -0
  731. package/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
  732. package/src/common-auth-embedded/claustrum/enrollment.js +759 -0
  733. package/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  734. package/src/common-auth-embedded/claustrum/errors.js +8 -0
  735. package/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  736. package/src/common-auth-embedded/claustrum/host-slot.js +72 -0
  737. package/src/common-auth-embedded/claustrum/index.d.ts +18 -0
  738. package/src/common-auth-embedded/claustrum/index.js +22 -0
  739. package/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  740. package/src/common-auth-embedded/claustrum/interlock.js +29 -0
  741. package/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
  742. package/src/common-auth-embedded/claustrum/roster.js +536 -0
  743. package/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  744. package/src/common-auth-embedded/commands/builtins.js +534 -0
  745. package/src/common-auth-embedded/commands/index.d.ts +10 -0
  746. package/src/common-auth-embedded/commands/index.js +5 -0
  747. package/src/common-auth-embedded/commands/menu.d.ts +61 -0
  748. package/src/common-auth-embedded/commands/menu.js +300 -0
  749. package/src/common-auth-embedded/commands/model.d.ts +238 -0
  750. package/src/common-auth-embedded/commands/model.js +16 -0
  751. package/src/common-auth-embedded/commands/pi.d.ts +23 -0
  752. package/src/common-auth-embedded/commands/pi.js +206 -0
  753. package/src/common-auth-embedded/commands/seam.d.ts +72 -0
  754. package/src/common-auth-embedded/commands/seam.js +301 -0
  755. package/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
  756. package/src/common-auth-embedded/fs/atomic-write.js +80 -0
  757. package/src/common-auth-embedded/fs/index.d.ts +7 -0
  758. package/src/common-auth-embedded/fs/index.js +6 -0
  759. package/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
  760. package/src/common-auth-embedded/fs/lock-constants.js +14 -0
  761. package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  762. package/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
  763. package/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
  764. package/src/common-auth-embedded/fs/with-lock.js +48 -0
  765. package/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  766. package/src/common-auth-embedded/logger/capture-sink.js +13 -0
  767. package/src/common-auth-embedded/logger/engine.d.ts +100 -0
  768. package/src/common-auth-embedded/logger/engine.js +246 -0
  769. package/src/common-auth-embedded/logger/index.d.ts +6 -0
  770. package/src/common-auth-embedded/logger/index.js +3 -0
  771. package/src/common-auth-embedded/logger/redact.d.ts +11 -0
  772. package/src/common-auth-embedded/logger/redact.js +83 -0
  773. package/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  774. package/src/common-auth-embedded/opencode2/errors.js +15 -0
  775. package/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  776. package/src/common-auth-embedded/opencode2/index.js +4 -0
  777. package/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  778. package/src/common-auth-embedded/opencode2/install.js +886 -0
  779. package/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  780. package/src/common-auth-embedded/opencode2/integration.js +143 -0
  781. package/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  782. package/src/common-auth-embedded/opencode2/sse.js +60 -0
  783. package/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  784. package/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
  785. package/src/common-auth-embedded/pi-slot/index.js +2 -0
  786. package/src/common-auth-embedded/pi-slot/lock.js +212 -0
  787. package/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
  788. package/src/common-auth-embedded/pi-slot/slot.js +383 -0
  789. package/src/common-auth-embedded/quota/codec.d.ts +11 -0
  790. package/src/common-auth-embedded/quota/codec.js +12 -0
  791. package/src/common-auth-embedded/quota/format.d.ts +46 -0
  792. package/src/common-auth-embedded/quota/format.js +138 -0
  793. package/src/common-auth-embedded/quota/index.d.ts +10 -0
  794. package/src/common-auth-embedded/quota/index.js +5 -0
  795. package/src/common-auth-embedded/quota/map.d.ts +63 -0
  796. package/src/common-auth-embedded/quota/map.js +105 -0
  797. package/src/common-auth-embedded/quota/merge.d.ts +48 -0
  798. package/src/common-auth-embedded/quota/merge.js +162 -0
  799. package/src/common-auth-embedded/quota/projection.d.ts +64 -0
  800. package/src/common-auth-embedded/quota/projection.js +134 -0
  801. package/src/common-auth-embedded/routing/admission.d.ts +93 -0
  802. package/src/common-auth-embedded/routing/admission.js +142 -0
  803. package/src/common-auth-embedded/routing/index.d.ts +8 -0
  804. package/src/common-auth-embedded/routing/index.js +4 -0
  805. package/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  806. package/src/common-auth-embedded/routing/ordered.js +58 -0
  807. package/src/common-auth-embedded/routing/pins.d.ts +22 -0
  808. package/src/common-auth-embedded/routing/pins.js +34 -0
  809. package/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  810. package/src/common-auth-embedded/routing/sticky.js +339 -0
  811. package/src/common-auth-embedded/rpc/client.d.ts +3 -0
  812. package/src/common-auth-embedded/rpc/client.js +2 -0
  813. package/src/common-auth-embedded/rpc/index.d.ts +10 -0
  814. package/src/common-auth-embedded/rpc/index.js +5 -0
  815. package/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
  816. package/src/common-auth-embedded/rpc/notifications.js +100 -0
  817. package/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
  818. package/src/common-auth-embedded/rpc/port-file.js +217 -0
  819. package/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
  820. package/src/common-auth-embedded/rpc/rpc-client.js +253 -0
  821. package/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
  822. package/src/common-auth-embedded/rpc/rpc-server.js +311 -0
  823. package/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
  824. package/src/common-auth-embedded/rpc/server-registry.js +47 -0
  825. package/src/common-auth-embedded/source-output.json +1326 -0
  826. package/src/common-auth-embedded/store/attribution.d.ts +28 -0
  827. package/src/common-auth-embedded/store/attribution.js +60 -0
  828. package/src/common-auth-embedded/store/errors.d.ts +55 -0
  829. package/src/common-auth-embedded/store/errors.js +38 -0
  830. package/src/common-auth-embedded/store/hooks.d.ts +12 -0
  831. package/src/common-auth-embedded/store/hooks.js +34 -0
  832. package/src/common-auth-embedded/store/identity.d.ts +39 -0
  833. package/src/common-auth-embedded/store/identity.js +79 -0
  834. package/src/common-auth-embedded/store/index.d.ts +21 -0
  835. package/src/common-auth-embedded/store/index.js +7 -0
  836. package/src/common-auth-embedded/store/mutate.d.ts +189 -0
  837. package/src/common-auth-embedded/store/mutate.js +500 -0
  838. package/src/common-auth-embedded/store/pool.d.ts +196 -0
  839. package/src/common-auth-embedded/store/pool.js +120 -0
  840. package/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  841. package/src/common-auth-embedded/store/provider-state.js +226 -0
  842. package/src/common-auth-embedded/store/publication.d.ts +47 -0
  843. package/src/common-auth-embedded/store/publication.js +304 -0
  844. package/src/common-auth-embedded/store/pull.d.ts +36 -0
  845. package/src/common-auth-embedded/store/pull.js +143 -0
  846. package/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  847. package/src/common-auth-embedded/store/refresh-lock.js +136 -0
  848. package/src/common-auth-embedded/store/refresh.d.ts +72 -0
  849. package/src/common-auth-embedded/store/refresh.js +225 -0
  850. package/src/common-auth-embedded/store/reserved.js +13 -0
  851. package/src/common-auth-embedded/store/rows.d.ts +313 -0
  852. package/src/common-auth-embedded/store/rows.js +1258 -0
  853. package/src/common-auth-embedded/store/runtime.d.ts +36 -0
  854. package/src/common-auth-embedded/store/runtime.js +68 -0
  855. package/src/common-auth-embedded/store/schema.d.ts +443 -0
  856. package/src/common-auth-embedded/store/schema.js +754 -0
  857. package/src/common-auth-embedded/store/settings.d.ts +63 -0
  858. package/src/common-auth-embedded/store/settings.js +120 -0
  859. package/src/common-auth-embedded/store/torn.d.ts +78 -0
  860. package/src/common-auth-embedded/store/torn.js +294 -0
  861. package/src/common-auth-embedded/tui/index.d.ts +8 -0
  862. package/src/common-auth-embedded/tui/index.js +21 -0
  863. package/src/common-auth-embedded/util/any-signal.js +42 -0
  864. package/src/plugin/command-data.ts +3 -0
  865. package/src/rpc/port-file.ts +6 -140
  866. package/src/rpc/protocol.ts +59 -24
  867. package/src/rpc/rpc-client.ts +101 -71
  868. package/src/sidebar-state.ts +82 -24
  869. package/src/tui/command-dialogs.tsx +412 -776
  870. package/src/tui/entry.d.mts +17 -0
  871. package/src/tui/entry.mjs +34 -66
  872. package/src/tui/file-logger.ts +22 -7
  873. package/src/tui-compiled/common-auth-embedded/logger/capture-sink.js +13 -0
  874. package/src/tui-compiled/common-auth-embedded/logger/engine.js +246 -0
  875. package/src/tui-compiled/common-auth-embedded/logger/index.js +3 -0
  876. package/src/tui-compiled/common-auth-embedded/logger/redact.js +83 -0
  877. package/src/tui-compiled/common-auth-embedded/quota/codec.js +12 -0
  878. package/src/tui-compiled/common-auth-embedded/quota/format.js +138 -0
  879. package/src/tui-compiled/common-auth-embedded/quota/index.js +5 -0
  880. package/src/tui-compiled/common-auth-embedded/quota/map.js +105 -0
  881. package/src/tui-compiled/common-auth-embedded/quota/merge.js +162 -0
  882. package/src/tui-compiled/common-auth-embedded/quota/projection.js +134 -0
  883. package/src/tui-compiled/common-auth-embedded/rpc/client.js +2 -0
  884. package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +217 -0
  885. package/src/tui-compiled/common-auth-embedded/rpc/rpc-client.js +253 -0
  886. package/src/tui-compiled/logging/provider-key-policy.js +3 -0
  887. package/src/tui-compiled/quota-presentation.js +42 -0
  888. package/src/tui-compiled/rpc/rpc-client.js +35 -0
  889. package/src/tui-compiled/rpc/rpc-dir.js +13 -0
  890. package/src/tui-compiled/selector.js +21 -0
  891. package/src/tui-compiled/sidebar-state.js +401 -0
  892. package/src/tui-compiled/tui/command-dialogs.js +424 -0
  893. package/src/tui-compiled/tui/file-logger.js +73 -0
  894. package/src/tui-compiled/tui/host-api.js +269 -0
  895. package/src/tui-compiled/tui/host-v1.js +228 -0
  896. package/src/tui-compiled/tui-preferences.js +230 -0
  897. package/src/tui-compiled/{tui.tsx → tui.js} +140 -231
  898. package/src/tui-ga-compiled/host-ga.js +1304 -0
  899. package/src/tui-ga-compiled/selector.js +21 -0
  900. package/src/tui-ga-compiled/shared/07365a7d2ccade4c-host-api.js +269 -0
  901. package/src/tui-ga-compiled/shared/0e19a88ff3535906-command-dialogs.js +424 -0
  902. package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +134 -0
  903. package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +105 -0
  904. package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
  905. package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
  906. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +138 -0
  907. package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +5 -0
  908. package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +12 -0
  909. package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +162 -0
  910. package/src/tui-ga-raw/host-ga.tsx +1740 -0
  911. package/src/tui-ga-raw/selector.js +21 -0
  912. package/src/tui-ga-raw/shared/07365a7d2ccade4c-host-api.js +269 -0
  913. package/src/tui-ga-raw/shared/0e19a88ff3535906-command-dialogs.tsx +468 -0
  914. package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +134 -0
  915. package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +105 -0
  916. package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
  917. package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
  918. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +138 -0
  919. package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +5 -0
  920. package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +12 -0
  921. package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +162 -0
  922. package/src/tui-raw/common-auth-embedded/logger/capture-sink.js +13 -0
  923. package/src/tui-raw/common-auth-embedded/logger/engine.js +246 -0
  924. package/src/tui-raw/common-auth-embedded/logger/index.js +3 -0
  925. package/src/tui-raw/common-auth-embedded/logger/redact.js +83 -0
  926. package/src/tui-raw/common-auth-embedded/quota/codec.js +12 -0
  927. package/src/tui-raw/common-auth-embedded/quota/format.js +138 -0
  928. package/src/tui-raw/common-auth-embedded/quota/index.js +5 -0
  929. package/src/tui-raw/common-auth-embedded/quota/map.js +105 -0
  930. package/src/tui-raw/common-auth-embedded/quota/merge.js +162 -0
  931. package/src/tui-raw/common-auth-embedded/quota/projection.js +134 -0
  932. package/src/tui-raw/common-auth-embedded/rpc/client.js +2 -0
  933. package/src/tui-raw/common-auth-embedded/rpc/port-file.js +217 -0
  934. package/src/tui-raw/common-auth-embedded/rpc/rpc-client.js +253 -0
  935. package/src/tui-raw/logging/provider-key-policy.js +3 -0
  936. package/src/tui-raw/quota-presentation.js +42 -0
  937. package/src/tui-raw/rpc/rpc-client.js +35 -0
  938. package/src/tui-raw/rpc/rpc-dir.js +13 -0
  939. package/src/tui-raw/selector.js +21 -0
  940. package/src/tui-raw/sidebar-state.js +401 -0
  941. package/src/tui-raw/tui/command-dialogs.tsx +468 -0
  942. package/src/tui-raw/tui/file-logger.js +73 -0
  943. package/src/tui-raw/tui/host-api.js +269 -0
  944. package/src/tui-raw/tui/host-v1.tsx +249 -0
  945. package/src/tui-raw/tui-preferences.js +230 -0
  946. package/src/tui-raw/tui.tsx +1088 -0
  947. package/src/tui.tsx +58 -141
  948. package/tui.js +6 -0
  949. package/src/tui-compiled/plugin/command-data.ts +0 -931
  950. package/src/tui-compiled/rpc/port-file.ts +0 -143
  951. package/src/tui-compiled/rpc/protocol.ts +0 -31
  952. package/src/tui-compiled/rpc/rpc-client.ts +0 -102
  953. package/src/tui-compiled/rpc/rpc-dir.ts +0 -24
  954. package/src/tui-compiled/sidebar-state.ts +0 -991
  955. package/src/tui-compiled/tui/command-dialogs.tsx +0 -779
  956. package/src/tui-compiled/tui/file-logger.ts +0 -145
  957. package/src/tui-compiled/tui-preferences.ts +0 -416
@@ -0,0 +1,1278 @@
1
+ /**
2
+ * RPC contract between this plugin's server side and its clients (the TUI and
3
+ * test tools) on OpenCode 2. "OpenCode 2" means the 2.x host line; this
4
+ * contract targets its 2.0.22 release, whose plugin API lets a server plugin
5
+ * register named RPC methods. "OpenCode 1" is the 1.x host line, where the
6
+ * same dialogs talk to this plugin through its own loopback HTTP RPC
7
+ * (`src/rpc/`).
8
+ *
9
+ * `antigravity-auth`, protocol version 1, and the methods `state` and `apply`
10
+ * are names this plugin defines. They are not existing host or provider APIs.
11
+ * The OpenCode 2.0.22 host routes `POST /api/rpc/:rpcID/:method` with body
12
+ * `{ input }` to the definition registered under that id at the requested
13
+ * location, and answers `{ output? }` (its generated client's `rpc.call`).
14
+ * The host validates input before calling the handler, and validates output
15
+ * before answering, with the schemas in the definition. It accepts Standard
16
+ * Schema V1 objects as schemas, so every schema below is a Standard Schema
17
+ * object backed by a strict hand-written validator.
18
+ *
19
+ * Portability: this module has no runtime imports. Clients can bundle it
20
+ * without pulling in server, account, OAuth or credential code. Its imports
21
+ * are type-only: the request, result and payload types of the Antigravity
22
+ * menu (`/antigravity`), defined by `@cortexkit/common-auth/commands` and
23
+ * carried by the OpenCode 1 RPC as well, and core's name for that command.
24
+ *
25
+ * Contract rules (each has a test in `protocol.test.ts`):
26
+ *
27
+ * - Version: every input and output carries `version: 1`. Any other value,
28
+ * including the string `"1"`, is refused before any effect.
29
+ * - Generation: each server activation (one plugin setup at one location) has
30
+ * an opaque generation token. `state` with `generation: null` asks for the
31
+ * current one. A `state` with a different generation is answered with
32
+ * `reset: 'generation-changed'` and the scope's notifications restart at
33
+ * cursor 0. `apply` requires the current generation and is answered with
34
+ * `kind: 'stale-generation'` and no effect otherwise.
35
+ * - Scope: `{ kind: 'session', sessionID }` or `{ kind: 'sessionless' }`.
36
+ * Scopes are disjoint: a session scope sees only that session's
37
+ * notifications and route; the sessionless scope sees only notifications
38
+ * raised without a session. Omitting a session never widens access.
39
+ * - Cursor: a non-negative safe integer per scope. Notifications carry
40
+ * cursors starting at 1. Sending cursor `c` acknowledges everything up to
41
+ * `c`; the answer holds the next notifications after `c`, at most
42
+ * `MAX_NOTIFICATIONS_PER_STATE`, with `more` set when further ones remain.
43
+ * A cursor ahead of the scope's last issued cursor is answered with
44
+ * `reset: 'cursor-ahead'` and delivery from cursor 0. `dropped` counts
45
+ * notifications evicted before the client acknowledged them.
46
+ * - Disposal: once an activation is disposed, both methods answer
47
+ * `kind: 'disposed'` with that activation's generation, and a late
48
+ * completion from it never touches a newer activation.
49
+ * - Redaction: accounts are ordinal (`acct-<n>`, `Account <n+1>`) and carry
50
+ * only enabled/current/health/cooldown/quota percentages and plan tier.
51
+ * There is no field for an email, token, project id, fingerprint, profile
52
+ * name or upstream error text, and unknown keys are refused, so a live
53
+ * account object spread into a DTO fails validation.
54
+ * - Menu: the GA `apply` input carries one action of the Antigravity menu,
55
+ * a `CommandApplyRequest` of `@cortexkit/common-auth/commands` without
56
+ * `sessionId`; the server sets `sessionId` from the input's scope. The
57
+ * answer is that module's `CommandApplyResult`, which holds the refreshed
58
+ * menu. A notification carries either the Antigravity menu payload (the
59
+ * client opens the menu) or a message for a toast. Menu actions name an
60
+ * account by the opaque item id the menu issued for its current
61
+ * credential; account positions and `acct-<n>` ids are never targets.
62
+ * - Selectors: each account in a snapshot carries an opaque random
63
+ * `selector` naming its current credential, so a client can tell a
64
+ * replaced credential from the same one across reads.
65
+ * - Account limit: a roster larger than `ANTIGRAVITY_RPC_LIMITS.accounts` is
66
+ * answered with `accountsStatus: over-limit` and no accounts, never with a
67
+ * shortened list.
68
+ * - Settings: every snapshot carries the location's current operator
69
+ * settings, so a client never needs an `apply` to read them.
70
+ * - Validation never coerces: `true`, `"5"`, `5.5`, `-1`, `-0`, `NaN` and
71
+ * `Infinity` are not cursors, and no value is passed through `Number()`.
72
+ * Issue messages name the field, never the received value, so a rejected
73
+ * menu value (which can hold a pasted OAuth code) is not echoed back.
74
+ */
75
+ // Identity
76
+ /** The RPC id this adapter registers. Chosen by this adapter, not the host. */
77
+ export const ANTIGRAVITY_RPC_ID = 'antigravity-auth';
78
+ /** The only protocol version this module accepts and produces. */
79
+ export const ANTIGRAVITY_RPC_VERSION = 1;
80
+ export const ANTIGRAVITY_RPC_METHODS = ['state', 'apply'];
81
+ /** Event published to the location when a notification is queued. */
82
+ export const ANTIGRAVITY_RPC_EVENTS = ['changed'];
83
+ /** The shared menu's slash command; every menu request and payload names it. */
84
+ export const ANTIGRAVITY_MENU_COMMAND_NAME = 'antigravity';
85
+ // Compile-time guard: core builds the shared menu under this same command.
86
+ const MENU_COMMAND_MATCHES_CORE = ANTIGRAVITY_MENU_COMMAND_NAME;
87
+ void MENU_COMMAND_MATCHES_CORE;
88
+ export const ANTIGRAVITY_LOG_LEVELS = [
89
+ 'error',
90
+ 'warn',
91
+ 'info',
92
+ 'debug',
93
+ 'trace',
94
+ ];
95
+ // Limits
96
+ export const ANTIGRAVITY_RPC_LIMITS = {
97
+ /** Generation tokens: 1–64 characters of `[A-Za-z0-9_-]`. */
98
+ generationMaxLength: 64,
99
+ /** Session ids: 1–256 visible ASCII characters (0x21–0x7E). */
100
+ sessionIDMaxLength: 256,
101
+ /** Menu ids (command, section, item, action, knob, choice values). */
102
+ menuIdMaxLength: 256,
103
+ /** Knob values in one menu request. */
104
+ menuValues: 64,
105
+ /** Sections in one menu. */
106
+ menuSections: 16,
107
+ /** Items in one menu section. */
108
+ menuItemsPerSection: 512,
109
+ /** Actions on one section or item. */
110
+ menuActions: 64,
111
+ /** Knobs on one action. */
112
+ menuKnobs: 64,
113
+ /** Choices of one `choice` knob. */
114
+ menuChoices: 256,
115
+ /** Read-only lines of one section. */
116
+ menuLines: 256,
117
+ /** Entries in one `facts` record. */
118
+ menuFacts: 64,
119
+ /** Nesting depth of a `facts` value. */
120
+ menuFactsDepth: 4,
121
+ /** Any user-facing text in an output. */
122
+ textMaxLength: 4096,
123
+ /** Notifications returned by one `state` call. */
124
+ notificationsPerState: 32,
125
+ /** Accounts in one output. */
126
+ accounts: 64,
127
+ /** Quota windows per pool entry. */
128
+ quotaWindows: 4,
129
+ /** Maximum length of a plan tier id. */
130
+ tierIDMaxLength: 128,
131
+ /** OAuth authorization URLs handed to the user. */
132
+ authorizationURLMaxLength: 4096,
133
+ };
134
+ export const MAX_NOTIFICATIONS_PER_STATE = ANTIGRAVITY_RPC_LIMITS.notificationsPerState;
135
+ export const ANTIGRAVITY_STATE_RESETS = [
136
+ 'initial',
137
+ 'generation-changed',
138
+ 'cursor-ahead',
139
+ ];
140
+ class Issues {
141
+ list = [];
142
+ add(path, message) {
143
+ this.list.push({ path: [...path], message });
144
+ }
145
+ }
146
+ function isPlainRecord(value) {
147
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
148
+ return false;
149
+ }
150
+ const prototype = Object.getPrototypeOf(value);
151
+ return prototype === Object.prototype || prototype === null;
152
+ }
153
+ /**
154
+ * Check an object's own keys. `required` keys must be present (an explicit
155
+ * `undefined` counts as missing); `optional` keys may be absent or
156
+ * `undefined`; any other key is refused.
157
+ */
158
+ function checkRecord(value, path, issues, required, optional = []) {
159
+ if (!isPlainRecord(value)) {
160
+ issues.add(path, 'expected a plain object');
161
+ return false;
162
+ }
163
+ const allowed = new Set([...required, ...optional]);
164
+ for (const key of Object.keys(value)) {
165
+ if (!allowed.has(key))
166
+ issues.add([...path, key], 'unexpected key');
167
+ }
168
+ for (const key of required) {
169
+ if (!Object.hasOwn(value, key) || value[key] === undefined) {
170
+ issues.add([...path, key], 'missing required key');
171
+ }
172
+ }
173
+ return true;
174
+ }
175
+ function present(record, key) {
176
+ return Object.hasOwn(record, key) && record[key] !== undefined;
177
+ }
178
+ function checkLiteral(value, allowed, path, issues) {
179
+ if (!allowed.some((candidate) => Object.is(candidate, value))) {
180
+ issues.add(path, `expected one of ${allowed.join(', ')}`);
181
+ return false;
182
+ }
183
+ return true;
184
+ }
185
+ function checkBoolean(value, path, issues) {
186
+ if (typeof value !== 'boolean')
187
+ issues.add(path, 'expected a boolean');
188
+ }
189
+ /** A non-negative safe integer, without coercion and without `-0`. */
190
+ function isCursor(value) {
191
+ return (typeof value === 'number' &&
192
+ Number.isSafeInteger(value) &&
193
+ value >= 0 &&
194
+ !Object.is(value, -0));
195
+ }
196
+ function checkCursor(value, path, issues) {
197
+ if (!isCursor(value)) {
198
+ issues.add(path, 'expected a non-negative safe integer');
199
+ }
200
+ }
201
+ function checkPositiveCursor(value, path, issues) {
202
+ if (!isCursor(value) || value === 0) {
203
+ issues.add(path, 'expected a positive safe integer');
204
+ }
205
+ }
206
+ /** A finite number in `[min, max]`. */
207
+ function checkFinite(value, path, issues, min, max = Number.MAX_VALUE) {
208
+ if (typeof value !== 'number' ||
209
+ !Number.isFinite(value) ||
210
+ value < min ||
211
+ value > max) {
212
+ issues.add(path, `expected a finite number in [${min}, ${max}]`);
213
+ }
214
+ }
215
+ /** An epoch-millisecond timestamp. */
216
+ function checkTimestamp(value, path, issues) {
217
+ checkFinite(value, path, issues, 0);
218
+ }
219
+ function checkString(value, path, issues, options) {
220
+ if (typeof value !== 'string') {
221
+ issues.add(path, 'expected a string');
222
+ return false;
223
+ }
224
+ const min = options.min ?? 0;
225
+ if (value.length < min || value.length > options.max) {
226
+ issues.add(path, `expected a string of length ${min}–${options.max}`);
227
+ return false;
228
+ }
229
+ if (options.pattern && !options.pattern.test(value)) {
230
+ issues.add(path, 'string has an invalid format');
231
+ return false;
232
+ }
233
+ if (options.noNul && value.includes('\u0000')) {
234
+ issues.add(path, 'string must not contain NUL');
235
+ return false;
236
+ }
237
+ return true;
238
+ }
239
+ const GENERATION_PATTERN = /^[A-Za-z0-9_-]+$/;
240
+ const SESSION_ID_PATTERN = /^[\x21-\x7e]+$/;
241
+ const ACCOUNT_ID_PATTERN = /^acct-(0|[1-9][0-9]{0,5})$/;
242
+ const ACCOUNT_LABEL_PATTERN = /^Account [1-9][0-9]{0,5}$/;
243
+ const TIER_ID_PATTERN = /^[\x20-\x7e]+$/;
244
+ const SELECTOR_PATTERN = /^sel-[A-Za-z0-9_-]{32}$/;
245
+ function checkSelector(value, path, issues) {
246
+ checkString(value, path, issues, {
247
+ min: 36,
248
+ max: 36,
249
+ pattern: SELECTOR_PATTERN,
250
+ });
251
+ }
252
+ function checkGeneration(value, path, issues) {
253
+ checkString(value, path, issues, {
254
+ min: 1,
255
+ max: ANTIGRAVITY_RPC_LIMITS.generationMaxLength,
256
+ pattern: GENERATION_PATTERN,
257
+ });
258
+ }
259
+ function checkScope(value, path, issues) {
260
+ if (!isPlainRecord(value)) {
261
+ issues.add(path, 'expected a plain object');
262
+ return;
263
+ }
264
+ if (value.kind === 'sessionless') {
265
+ checkRecord(value, path, issues, ['kind']);
266
+ return;
267
+ }
268
+ if (value.kind === 'session') {
269
+ if (!checkRecord(value, path, issues, ['kind', 'sessionID']))
270
+ return;
271
+ if (present(value, 'sessionID')) {
272
+ checkString(value.sessionID, [...path, 'sessionID'], issues, {
273
+ min: 1,
274
+ max: ANTIGRAVITY_RPC_LIMITS.sessionIDMaxLength,
275
+ pattern: SESSION_ID_PATTERN,
276
+ });
277
+ }
278
+ return;
279
+ }
280
+ issues.add([...path, 'kind'], 'expected one of session, sessionless');
281
+ }
282
+ function checkVersion(record, path, issues) {
283
+ if (present(record, 'version')) {
284
+ checkLiteral(record.version, [ANTIGRAVITY_RPC_VERSION], [...path, 'version'], issues);
285
+ }
286
+ }
287
+ function checkText(value, path, issues) {
288
+ checkString(value, path, issues, {
289
+ max: ANTIGRAVITY_RPC_LIMITS.textMaxLength,
290
+ noNul: true,
291
+ });
292
+ }
293
+ function checkArray(value, path, issues, max, element) {
294
+ if (!Array.isArray(value)) {
295
+ issues.add(path, 'expected an array');
296
+ return;
297
+ }
298
+ if (value.length > max) {
299
+ issues.add(path, `expected at most ${max} items`);
300
+ return;
301
+ }
302
+ value.forEach((item, index) => {
303
+ element(item, [...path, index], issues);
304
+ });
305
+ }
306
+ function checkQuotaWindow(value, path, issues) {
307
+ if (!checkRecord(value, path, issues, ['window', 'remainingPercent'], ['resetAt', 'checkedAt'])) {
308
+ return;
309
+ }
310
+ if (present(value, 'window')) {
311
+ checkLiteral(value.window, ['weekly', '5h'], [...path, 'window'], issues);
312
+ }
313
+ if (present(value, 'remainingPercent')) {
314
+ checkFinite(value.remainingPercent, [...path, 'remainingPercent'], issues, 0, 100);
315
+ }
316
+ if (present(value, 'resetAt')) {
317
+ checkTimestamp(value.resetAt, [...path, 'resetAt'], issues);
318
+ }
319
+ if (present(value, 'checkedAt')) {
320
+ checkTimestamp(value.checkedAt, [...path, 'checkedAt'], issues);
321
+ }
322
+ }
323
+ function checkQuotaEntry(value, path, issues) {
324
+ if (!checkRecord(value, path, issues, ['remainingPercent'], ['resetAt', 'windows', 'checkedAt'])) {
325
+ return;
326
+ }
327
+ if (present(value, 'remainingPercent')) {
328
+ checkFinite(value.remainingPercent, [...path, 'remainingPercent'], issues, 0, 100);
329
+ }
330
+ if (present(value, 'resetAt')) {
331
+ checkTimestamp(value.resetAt, [...path, 'resetAt'], issues);
332
+ }
333
+ if (present(value, 'checkedAt')) {
334
+ checkTimestamp(value.checkedAt, [...path, 'checkedAt'], issues);
335
+ }
336
+ if (present(value, 'windows')) {
337
+ checkArray(value.windows, [...path, 'windows'], issues, ANTIGRAVITY_RPC_LIMITS.quotaWindows, checkQuotaWindow);
338
+ }
339
+ }
340
+ function checkAccount(value, path, issues) {
341
+ if (!checkRecord(value, path, issues, ['selector', 'id', 'label', 'enabled', 'health', 'current', 'quota'], ['cooldownUntil', 'tier'])) {
342
+ return;
343
+ }
344
+ if (present(value, 'selector')) {
345
+ checkSelector(value.selector, [...path, 'selector'], issues);
346
+ }
347
+ if (present(value, 'id')) {
348
+ checkString(value.id, [...path, 'id'], issues, {
349
+ min: 1,
350
+ max: 16,
351
+ pattern: ACCOUNT_ID_PATTERN,
352
+ });
353
+ }
354
+ if (present(value, 'label')) {
355
+ checkString(value.label, [...path, 'label'], issues, {
356
+ min: 1,
357
+ max: 16,
358
+ pattern: ACCOUNT_LABEL_PATTERN,
359
+ });
360
+ }
361
+ if (present(value, 'enabled')) {
362
+ checkBoolean(value.enabled, [...path, 'enabled'], issues);
363
+ }
364
+ if (present(value, 'health')) {
365
+ checkFinite(value.health, [...path, 'health'], issues, 0, 100);
366
+ }
367
+ if (present(value, 'current')) {
368
+ checkBoolean(value.current, [...path, 'current'], issues);
369
+ }
370
+ if (present(value, 'cooldownUntil')) {
371
+ checkTimestamp(value.cooldownUntil, [...path, 'cooldownUntil'], issues);
372
+ }
373
+ if (present(value, 'quota')) {
374
+ const quotaPath = [...path, 'quota'];
375
+ const quota = value.quota;
376
+ if (checkRecord(quota, quotaPath, issues, [], ['gemini', 'non-gemini'])) {
377
+ for (const key of ['gemini', 'non-gemini']) {
378
+ if (present(quota, key)) {
379
+ checkQuotaEntry(quota[key], [...quotaPath, key], issues);
380
+ }
381
+ }
382
+ }
383
+ }
384
+ if (present(value, 'tier')) {
385
+ const tierPath = [...path, 'tier'];
386
+ const tier = value.tier;
387
+ if (checkRecord(tier, tierPath, issues, ['id', 'capturedAt'], ['paidId'])) {
388
+ for (const key of ['id', 'paidId']) {
389
+ if (present(tier, key)) {
390
+ checkString(tier[key], [...tierPath, key], issues, {
391
+ min: 1,
392
+ max: ANTIGRAVITY_RPC_LIMITS.tierIDMaxLength,
393
+ pattern: TIER_ID_PATTERN,
394
+ });
395
+ }
396
+ }
397
+ if (present(tier, 'capturedAt')) {
398
+ checkTimestamp(tier.capturedAt, [...tierPath, 'capturedAt'], issues);
399
+ }
400
+ }
401
+ }
402
+ }
403
+ function checkAccounts(value, path, issues) {
404
+ checkArray(value, path, issues, ANTIGRAVITY_RPC_LIMITS.accounts, checkAccount);
405
+ }
406
+ function checkRoute(value, path, issues) {
407
+ if (value === null)
408
+ return;
409
+ if (!checkRecord(value, path, issues, [
410
+ 'accountId',
411
+ 'modelFamily',
412
+ 'headerStyle',
413
+ 'strategy',
414
+ 'updatedAt',
415
+ ])) {
416
+ return;
417
+ }
418
+ checkString(value.accountId, [...path, 'accountId'], issues, {
419
+ min: 1,
420
+ max: 16,
421
+ pattern: ACCOUNT_ID_PATTERN,
422
+ });
423
+ checkLiteral(value.modelFamily, ['claude', 'gemini'], [...path, 'modelFamily'], issues);
424
+ checkLiteral(value.headerStyle, ['antigravity', 'gemini-cli'], [...path, 'headerStyle'], issues);
425
+ if (value.strategy !== null) {
426
+ checkLiteral(value.strategy, ['sticky', 'round-robin', 'hybrid'], [...path, 'strategy'], issues);
427
+ }
428
+ checkTimestamp(value.updatedAt, [...path, 'updatedAt'], issues);
429
+ }
430
+ function checkStatus(value, path, issues) {
431
+ if (!checkRecord(value, path, issues, ['routingAuthoritative'], ['checkedAt', 'quotaBackoffUntil'])) {
432
+ return;
433
+ }
434
+ // `checkedAt` and `quotaBackoffUntil` must be present but may be `null`,
435
+ // so their presence is checked separately from their values.
436
+ checkNullableKeysPresent(value, ['checkedAt', 'quotaBackoffUntil'], path, issues);
437
+ for (const key of ['checkedAt', 'quotaBackoffUntil']) {
438
+ if (value[key] !== null && present(value, key)) {
439
+ checkTimestamp(value[key], [...path, key], issues);
440
+ }
441
+ }
442
+ if (present(value, 'routingAuthoritative')) {
443
+ checkBoolean(value.routingAuthoritative, [...path, 'routingAuthoritative'], issues);
444
+ }
445
+ }
446
+ function checkNotification(value, path, issues) {
447
+ if (!checkRecord(value, path, issues, ['cursor', 'payload']))
448
+ return;
449
+ if (present(value, 'cursor')) {
450
+ checkPositiveCursor(value.cursor, [...path, 'cursor'], issues);
451
+ }
452
+ if (present(value, 'payload')) {
453
+ checkNotificationPayload(value.payload, [...path, 'payload'], issues);
454
+ }
455
+ }
456
+ /**
457
+ * Check required keys whose value may be `null`. checkRecord treats an
458
+ * explicit `undefined` as missing, which is still right for these keys.
459
+ */
460
+ function checkNullableKeysPresent(record, keys, path, issues) {
461
+ for (const key of keys) {
462
+ if (!Object.hasOwn(record, key) || record[key] === undefined) {
463
+ issues.add([...path, key], 'missing required key');
464
+ }
465
+ }
466
+ }
467
+ function checkDisposed(value, path, issues) {
468
+ if (!checkRecord(value, path, issues, ['version', 'kind', 'generation'])) {
469
+ return;
470
+ }
471
+ checkVersion(value, path, issues);
472
+ if (present(value, 'generation')) {
473
+ checkGeneration(value.generation, [...path, 'generation'], issues);
474
+ }
475
+ }
476
+ // Antigravity menu: validators for the `@cortexkit/common-auth/commands`
477
+ // menu model, request and result, which this module mirrors by hand
478
+ // because it may not import that module at runtime.
479
+ const MENU_ID_PATTERN = /^[\x21-\x7e]+$/;
480
+ const SECTION_SLOTS = [
481
+ 'accounts',
482
+ 'quota',
483
+ 'routing',
484
+ 'limits',
485
+ 'cache',
486
+ 'diagnostics',
487
+ 'extra',
488
+ ];
489
+ const KNOB_KINDS = ['choice', 'toggle', 'number', 'text'];
490
+ const NOTIFY_KINDS = ['info', 'warning', 'error'];
491
+ function checkMenuId(value, path, issues) {
492
+ checkString(value, path, issues, {
493
+ min: 1,
494
+ max: ANTIGRAVITY_RPC_LIMITS.menuIdMaxLength,
495
+ pattern: MENU_ID_PATTERN,
496
+ });
497
+ }
498
+ function checkMenuCommand(value, path, issues) {
499
+ checkLiteral(value, [ANTIGRAVITY_MENU_COMMAND_NAME], path, issues);
500
+ }
501
+ function checkFiniteNumber(value, path, issues) {
502
+ checkFinite(value, path, issues, -Number.MAX_VALUE);
503
+ }
504
+ /** A knob value: string, finite number, boolean or `null`. */
505
+ function checkKnobValue(value, path, issues) {
506
+ if (value === null || typeof value === 'boolean')
507
+ return;
508
+ if (typeof value === 'number') {
509
+ checkFiniteNumber(value, path, issues);
510
+ return;
511
+ }
512
+ if (typeof value === 'string') {
513
+ checkText(value, path, issues);
514
+ return;
515
+ }
516
+ issues.add(path, 'expected a string, finite number, boolean or null');
517
+ }
518
+ function checkKnobValues(value, path, issues) {
519
+ if (!isPlainRecord(value)) {
520
+ issues.add(path, 'expected a plain object');
521
+ return;
522
+ }
523
+ const names = Object.keys(value);
524
+ if (names.length > ANTIGRAVITY_RPC_LIMITS.menuValues) {
525
+ issues.add(path, `expected at most ${ANTIGRAVITY_RPC_LIMITS.menuValues} values`);
526
+ return;
527
+ }
528
+ for (const name of names) {
529
+ checkMenuId(name, [...path, name], issues);
530
+ checkKnobValue(value[name], [...path, name], issues);
531
+ }
532
+ }
533
+ /** One action request; `sessionId` is never part of it on this wire. */
534
+ function checkMenuRequest(value, path, issues) {
535
+ if (!checkRecord(value, path, issues, ['command', 'sectionId', 'actionId'], ['itemId', 'values', 'confirmed'])) {
536
+ return;
537
+ }
538
+ if (present(value, 'command')) {
539
+ checkMenuCommand(value.command, [...path, 'command'], issues);
540
+ }
541
+ for (const key of ['sectionId', 'actionId', 'itemId']) {
542
+ if (present(value, key))
543
+ checkMenuId(value[key], [...path, key], issues);
544
+ }
545
+ if (present(value, 'values')) {
546
+ checkKnobValues(value.values, [...path, 'values'], issues);
547
+ }
548
+ if (present(value, 'confirmed')) {
549
+ checkBoolean(value.confirmed, [...path, 'confirmed'], issues);
550
+ }
551
+ }
552
+ /**
553
+ * Plugin facts: JSON data the Antigravity menu lists by name. Only plain records,
554
+ * arrays, strings, finite numbers, booleans and `null`, bounded in size and
555
+ * depth.
556
+ */
557
+ function checkFactValue(value, path, issues, depth) {
558
+ if (value === null || typeof value === 'boolean')
559
+ return;
560
+ if (typeof value === 'number') {
561
+ checkFiniteNumber(value, path, issues);
562
+ return;
563
+ }
564
+ if (typeof value === 'string') {
565
+ checkText(value, path, issues);
566
+ return;
567
+ }
568
+ if (depth >= ANTIGRAVITY_RPC_LIMITS.menuFactsDepth) {
569
+ issues.add(path, 'value is nested too deeply');
570
+ return;
571
+ }
572
+ if (Array.isArray(value)) {
573
+ checkArray(value, path, issues, ANTIGRAVITY_RPC_LIMITS.menuFacts, (item, p, i) => checkFactValue(item, p, i, depth + 1));
574
+ return;
575
+ }
576
+ checkFacts(value, path, issues, depth + 1);
577
+ }
578
+ function checkFacts(value, path, issues, depth = 0) {
579
+ if (!isPlainRecord(value)) {
580
+ issues.add(path, 'expected a plain object');
581
+ return;
582
+ }
583
+ const names = Object.keys(value);
584
+ if (names.length > ANTIGRAVITY_RPC_LIMITS.menuFacts) {
585
+ issues.add(path, `expected at most ${ANTIGRAVITY_RPC_LIMITS.menuFacts} entries`);
586
+ return;
587
+ }
588
+ for (const name of names) {
589
+ checkText(name, [...path, name], issues);
590
+ checkFactValue(value[name], [...path, name], issues, depth);
591
+ }
592
+ }
593
+ function checkChoice(value, path, issues) {
594
+ if (!checkRecord(value, path, issues, ['value', 'label']))
595
+ return;
596
+ if (present(value, 'value'))
597
+ checkMenuId(value.value, [...path, 'value'], issues);
598
+ if (present(value, 'label'))
599
+ checkText(value.label, [...path, 'label'], issues);
600
+ }
601
+ function checkKnob(value, path, issues) {
602
+ if (!isPlainRecord(value)) {
603
+ issues.add(path, 'expected a plain object');
604
+ return;
605
+ }
606
+ const base = ['kind', 'id', 'label'];
607
+ switch (value.kind) {
608
+ case 'choice':
609
+ if (!checkRecord(value, path, issues, [...base, 'choices'], ['value'])) {
610
+ return;
611
+ }
612
+ if (present(value, 'choices')) {
613
+ checkArray(value.choices, [...path, 'choices'], issues, ANTIGRAVITY_RPC_LIMITS.menuChoices, checkChoice);
614
+ }
615
+ if (present(value, 'value'))
616
+ checkMenuId(value.value, [...path, 'value'], issues);
617
+ break;
618
+ case 'toggle':
619
+ if (!checkRecord(value, path, issues, [...base, 'value']))
620
+ return;
621
+ if (present(value, 'value'))
622
+ checkBoolean(value.value, [...path, 'value'], issues);
623
+ break;
624
+ case 'number':
625
+ if (!checkRecord(value, path, issues, base, [
626
+ 'value',
627
+ 'min',
628
+ 'max',
629
+ 'required',
630
+ ])) {
631
+ return;
632
+ }
633
+ for (const key of ['value', 'min', 'max']) {
634
+ if (present(value, key))
635
+ checkFiniteNumber(value[key], [...path, key], issues);
636
+ }
637
+ if (present(value, 'required')) {
638
+ checkBoolean(value.required, [...path, 'required'], issues);
639
+ }
640
+ break;
641
+ case 'text':
642
+ if (!checkRecord(value, path, issues, base, [
643
+ 'value',
644
+ 'placeholder',
645
+ 'masked',
646
+ 'required',
647
+ ])) {
648
+ return;
649
+ }
650
+ for (const key of ['value', 'placeholder']) {
651
+ if (present(value, key))
652
+ checkText(value[key], [...path, key], issues);
653
+ }
654
+ for (const key of ['masked', 'required']) {
655
+ if (present(value, key))
656
+ checkBoolean(value[key], [...path, key], issues);
657
+ }
658
+ break;
659
+ default:
660
+ issues.add([...path, 'kind'], `expected one of ${KNOB_KINDS.join(', ')}`);
661
+ return;
662
+ }
663
+ if (present(value, 'id'))
664
+ checkMenuId(value.id, [...path, 'id'], issues);
665
+ if (present(value, 'label'))
666
+ checkText(value.label, [...path, 'label'], issues);
667
+ }
668
+ function checkMenuAction(value, path, issues) {
669
+ if (!checkRecord(value, path, issues, ['id', 'label', 'knobs'], ['description', 'confirm'])) {
670
+ return;
671
+ }
672
+ if (present(value, 'id'))
673
+ checkMenuId(value.id, [...path, 'id'], issues);
674
+ if (present(value, 'label'))
675
+ checkText(value.label, [...path, 'label'], issues);
676
+ if (present(value, 'description')) {
677
+ checkText(value.description, [...path, 'description'], issues);
678
+ }
679
+ if (present(value, 'knobs')) {
680
+ checkArray(value.knobs, [...path, 'knobs'], issues, ANTIGRAVITY_RPC_LIMITS.menuKnobs, checkKnob);
681
+ }
682
+ if (present(value, 'confirm')) {
683
+ const confirmPath = [...path, 'confirm'];
684
+ if (checkRecord(value.confirm, confirmPath, issues, [
685
+ 'message',
686
+ 'irreversible',
687
+ ])) {
688
+ if (present(value.confirm, 'message')) {
689
+ checkText(value.confirm.message, [...confirmPath, 'message'], issues);
690
+ }
691
+ if (present(value.confirm, 'irreversible')) {
692
+ checkBoolean(value.confirm.irreversible, [...confirmPath, 'irreversible'], issues);
693
+ }
694
+ }
695
+ }
696
+ }
697
+ function checkMenuActions(value, path, issues) {
698
+ checkArray(value, path, issues, ANTIGRAVITY_RPC_LIMITS.menuActions, checkMenuAction);
699
+ }
700
+ function checkMenuAccount(value, path, issues) {
701
+ if (!checkRecord(value, path, issues, ['id', 'enabled', 'type'], ['label', 'identity'])) {
702
+ return;
703
+ }
704
+ if (present(value, 'id'))
705
+ checkMenuId(value.id, [...path, 'id'], issues);
706
+ if (present(value, 'enabled')) {
707
+ checkBoolean(value.enabled, [...path, 'enabled'], issues);
708
+ }
709
+ if (present(value, 'type')) {
710
+ checkLiteral(value.type, ['oauth', 'api'], [...path, 'type'], issues);
711
+ }
712
+ for (const key of ['label', 'identity']) {
713
+ if (present(value, key))
714
+ checkText(value[key], [...path, key], issues);
715
+ }
716
+ }
717
+ function checkMenuItem(value, path, issues) {
718
+ if (!checkRecord(value, path, issues, ['id', 'label', 'actions'], ['detail', 'account', 'facts'])) {
719
+ return;
720
+ }
721
+ if (present(value, 'id'))
722
+ checkMenuId(value.id, [...path, 'id'], issues);
723
+ if (present(value, 'label'))
724
+ checkText(value.label, [...path, 'label'], issues);
725
+ if (present(value, 'detail')) {
726
+ checkText(value.detail, [...path, 'detail'], issues);
727
+ }
728
+ if (present(value, 'account')) {
729
+ checkMenuAccount(value.account, [...path, 'account'], issues);
730
+ }
731
+ if (present(value, 'facts'))
732
+ checkFacts(value.facts, [...path, 'facts'], issues);
733
+ if (present(value, 'actions')) {
734
+ checkMenuActions(value.actions, [...path, 'actions'], issues);
735
+ }
736
+ }
737
+ function checkMenuSection(value, path, issues) {
738
+ if (!checkRecord(value, path, issues, ['id', 'slot', 'title', 'lines', 'items', 'actions'], ['facts'])) {
739
+ return;
740
+ }
741
+ if (present(value, 'id'))
742
+ checkMenuId(value.id, [...path, 'id'], issues);
743
+ if (present(value, 'slot')) {
744
+ checkLiteral(value.slot, SECTION_SLOTS, [...path, 'slot'], issues);
745
+ }
746
+ if (present(value, 'title'))
747
+ checkText(value.title, [...path, 'title'], issues);
748
+ if (present(value, 'lines')) {
749
+ checkArray(value.lines, [...path, 'lines'], issues, ANTIGRAVITY_RPC_LIMITS.menuLines, checkText);
750
+ }
751
+ if (present(value, 'items')) {
752
+ checkArray(value.items, [...path, 'items'], issues, ANTIGRAVITY_RPC_LIMITS.menuItemsPerSection, checkMenuItem);
753
+ }
754
+ if (present(value, 'actions')) {
755
+ checkMenuActions(value.actions, [...path, 'actions'], issues);
756
+ }
757
+ if (present(value, 'facts'))
758
+ checkFacts(value.facts, [...path, 'facts'], issues);
759
+ }
760
+ function checkMenuModel(value, path, issues) {
761
+ if (!checkRecord(value, path, issues, ['command', 'title', 'sections'])) {
762
+ return;
763
+ }
764
+ if (present(value, 'command')) {
765
+ checkMenuCommand(value.command, [...path, 'command'], issues);
766
+ }
767
+ if (present(value, 'title'))
768
+ checkText(value.title, [...path, 'title'], issues);
769
+ if (present(value, 'sections')) {
770
+ checkArray(value.sections, [...path, 'sections'], issues, ANTIGRAVITY_RPC_LIMITS.menuSections, checkMenuSection);
771
+ }
772
+ }
773
+ /** The Antigravity menu payload the client opens, or a toast message. */
774
+ function checkNotificationPayload(value, path, issues) {
775
+ if (!isPlainRecord(value)) {
776
+ issues.add(path, 'expected a plain object');
777
+ return;
778
+ }
779
+ if (Object.hasOwn(value, 'notify')) {
780
+ if (!checkRecord(value, path, issues, ['command', 'notify']))
781
+ return;
782
+ if (present(value, 'command')) {
783
+ checkMenuCommand(value.command, [...path, 'command'], issues);
784
+ }
785
+ const notifyPath = [...path, 'notify'];
786
+ if (present(value, 'notify') &&
787
+ checkRecord(value.notify, notifyPath, issues, ['message', 'kind'])) {
788
+ if (present(value.notify, 'message')) {
789
+ checkText(value.notify.message, [...notifyPath, 'message'], issues);
790
+ }
791
+ if (present(value.notify, 'kind')) {
792
+ checkLiteral(value.notify.kind, NOTIFY_KINDS, [...notifyPath, 'kind'], issues);
793
+ }
794
+ }
795
+ return;
796
+ }
797
+ if (!checkRecord(value, path, issues, ['command', 'menu']))
798
+ return;
799
+ if (present(value, 'command')) {
800
+ checkMenuCommand(value.command, [...path, 'command'], issues);
801
+ }
802
+ if (present(value, 'menu'))
803
+ checkMenuModel(value.menu, [...path, 'menu'], issues);
804
+ }
805
+ /** `@cortexkit/common-auth/commands`' `CommandApplyResult` for the Antigravity menu. */
806
+ function checkApplyResult(value, path, issues) {
807
+ if (!checkRecord(value, path, issues, ['command', 'ok', 'text', 'menu'], ['code', 'needsConfirmation'])) {
808
+ return;
809
+ }
810
+ if (present(value, 'command')) {
811
+ checkMenuCommand(value.command, [...path, 'command'], issues);
812
+ }
813
+ if (present(value, 'ok'))
814
+ checkBoolean(value.ok, [...path, 'ok'], issues);
815
+ if (present(value, 'text'))
816
+ checkText(value.text, [...path, 'text'], issues);
817
+ if (present(value, 'code'))
818
+ checkMenuId(value.code, [...path, 'code'], issues);
819
+ if (present(value, 'needsConfirmation')) {
820
+ checkBoolean(value.needsConfirmation, [...path, 'needsConfirmation'], issues);
821
+ }
822
+ if (present(value, 'menu'))
823
+ checkMenuModel(value.menu, [...path, 'menu'], issues);
824
+ }
825
+ // Top-level validators
826
+ function validateStateInput(value, issues) {
827
+ const path = [];
828
+ if (!checkRecord(value, path, issues, ['version', 'scope', 'cursor'], ['generation'])) {
829
+ return;
830
+ }
831
+ // `generation` is required but may be `null` on first contact.
832
+ checkNullableKeysPresent(value, ['generation'], path, issues);
833
+ checkVersion(value, path, issues);
834
+ if (value.generation !== null && present(value, 'generation')) {
835
+ checkGeneration(value.generation, ['generation'], issues);
836
+ }
837
+ if (present(value, 'scope'))
838
+ checkScope(value.scope, ['scope'], issues);
839
+ if (present(value, 'cursor'))
840
+ checkCursor(value.cursor, ['cursor'], issues);
841
+ }
842
+ function validateApplyInput(value, issues) {
843
+ const path = [];
844
+ if (!checkRecord(value, path, issues, [
845
+ 'version',
846
+ 'generation',
847
+ 'scope',
848
+ 'request',
849
+ ])) {
850
+ return;
851
+ }
852
+ checkVersion(value, path, issues);
853
+ if (present(value, 'generation')) {
854
+ checkGeneration(value.generation, ['generation'], issues);
855
+ }
856
+ if (present(value, 'scope'))
857
+ checkScope(value.scope, ['scope'], issues);
858
+ if (present(value, 'request')) {
859
+ checkMenuRequest(value.request, ['request'], issues);
860
+ }
861
+ }
862
+ function validateStateOutput(value, issues) {
863
+ const path = [];
864
+ if (!isPlainRecord(value)) {
865
+ issues.add(path, 'expected a plain object');
866
+ return;
867
+ }
868
+ if (value.kind === 'disposed') {
869
+ checkDisposed(value, path, issues);
870
+ return;
871
+ }
872
+ if (value.kind !== 'snapshot') {
873
+ issues.add(['kind'], 'expected one of snapshot, disposed');
874
+ return;
875
+ }
876
+ if (!checkRecord(value, path, issues, [
877
+ 'version',
878
+ 'kind',
879
+ 'generation',
880
+ 'scope',
881
+ 'cursor',
882
+ 'dropped',
883
+ 'more',
884
+ 'notifications',
885
+ 'readSeq',
886
+ 'accountsStatus',
887
+ 'accounts',
888
+ 'status',
889
+ 'settings',
890
+ ], ['reset', 'route'])) {
891
+ return;
892
+ }
893
+ checkNullableKeysPresent(value, ['reset', 'route'], path, issues);
894
+ checkVersion(value, path, issues);
895
+ if (present(value, 'generation')) {
896
+ checkGeneration(value.generation, ['generation'], issues);
897
+ }
898
+ if (present(value, 'scope'))
899
+ checkScope(value.scope, ['scope'], issues);
900
+ if (value.reset !== null && present(value, 'reset')) {
901
+ checkLiteral(value.reset, ANTIGRAVITY_STATE_RESETS, ['reset'], issues);
902
+ }
903
+ if (present(value, 'cursor'))
904
+ checkCursor(value.cursor, ['cursor'], issues);
905
+ if (present(value, 'dropped')) {
906
+ checkCursor(value.dropped, ['dropped'], issues);
907
+ }
908
+ if (present(value, 'more'))
909
+ checkBoolean(value.more, ['more'], issues);
910
+ if (present(value, 'notifications')) {
911
+ checkArray(value.notifications, ['notifications'], issues, ANTIGRAVITY_RPC_LIMITS.notificationsPerState, checkNotification);
912
+ // Delivered notifications must be in strictly increasing cursor order
913
+ // and must not pass the answer's cursor.
914
+ if (Array.isArray(value.notifications) && isCursor(value.cursor)) {
915
+ let previous = 0;
916
+ value.notifications.forEach((notification, index) => {
917
+ const cursor = isPlainRecord(notification)
918
+ ? notification.cursor
919
+ : undefined;
920
+ if (!isCursor(cursor))
921
+ return;
922
+ if (cursor <= previous || cursor > value.cursor) {
923
+ issues.add(['notifications', index, 'cursor'], 'cursors must increase and not pass the answer cursor');
924
+ }
925
+ previous = cursor;
926
+ });
927
+ }
928
+ }
929
+ if (present(value, 'readSeq')) {
930
+ checkPositiveCursor(value.readSeq, ['readSeq'], issues);
931
+ }
932
+ if (present(value, 'accountsStatus')) {
933
+ checkAccountsStatus(value.accountsStatus, ['accountsStatus'], issues);
934
+ }
935
+ if (present(value, 'accounts')) {
936
+ checkAccounts(value.accounts, ['accounts'], issues);
937
+ // An over-limit answer carries no accounts, never a shortened list.
938
+ if (isPlainRecord(value.accountsStatus) &&
939
+ value.accountsStatus.kind === 'over-limit' &&
940
+ Array.isArray(value.accounts) &&
941
+ value.accounts.length > 0) {
942
+ issues.add(['accounts'], 'expected no accounts when over the limit');
943
+ }
944
+ }
945
+ if (present(value, 'route'))
946
+ checkRoute(value.route, ['route'], issues);
947
+ if (present(value, 'status'))
948
+ checkStatus(value.status, ['status'], issues);
949
+ if (present(value, 'settings')) {
950
+ checkSettings(value.settings, ['settings'], issues);
951
+ }
952
+ }
953
+ function checkAccountsStatus(value, path, issues) {
954
+ if (!isPlainRecord(value)) {
955
+ issues.add(path, 'expected a plain object');
956
+ return;
957
+ }
958
+ if (value.kind === 'complete') {
959
+ checkRecord(value, path, issues, ['kind']);
960
+ return;
961
+ }
962
+ if (value.kind !== 'over-limit') {
963
+ issues.add([...path, 'kind'], 'expected one of complete, over-limit');
964
+ return;
965
+ }
966
+ if (!checkRecord(value, path, issues, ['kind', 'count', 'limit']))
967
+ return;
968
+ if (present(value, 'limit')) {
969
+ checkLiteral(value.limit, [ANTIGRAVITY_RPC_LIMITS.accounts], [...path, 'limit'], issues);
970
+ }
971
+ if (present(value, 'count') &&
972
+ (!isCursor(value.count) || value.count <= ANTIGRAVITY_RPC_LIMITS.accounts)) {
973
+ issues.add([...path, 'count'], 'expected a count above the limit');
974
+ }
975
+ }
976
+ function checkSettings(value, path, issues) {
977
+ if (!checkRecord(value, path, issues, [
978
+ 'routing',
979
+ 'killswitch',
980
+ 'logLevel',
981
+ 'dump',
982
+ ])) {
983
+ return;
984
+ }
985
+ const routingPath = [...path, 'routing'];
986
+ if (present(value, 'routing') &&
987
+ checkRecord(value.routing, routingPath, issues, [
988
+ 'cliFirst',
989
+ 'quotaStyleFallback',
990
+ ])) {
991
+ checkBoolean(value.routing.cliFirst, [...routingPath, 'cliFirst'], issues);
992
+ checkBoolean(value.routing.quotaStyleFallback, [...routingPath, 'quotaStyleFallback'], issues);
993
+ }
994
+ const killswitchPath = [...path, 'killswitch'];
995
+ if (present(value, 'killswitch') &&
996
+ checkRecord(value.killswitch, killswitchPath, issues, [
997
+ 'enabled',
998
+ 'minimumRemainingPercent',
999
+ ])) {
1000
+ checkBoolean(value.killswitch.enabled, [...killswitchPath, 'enabled'], issues);
1001
+ checkFinite(value.killswitch.minimumRemainingPercent, [...killswitchPath, 'minimumRemainingPercent'], issues, 0, 100);
1002
+ }
1003
+ if (present(value, 'logLevel')) {
1004
+ checkLiteral(value.logLevel, ANTIGRAVITY_LOG_LEVELS, [...path, 'logLevel'], issues);
1005
+ }
1006
+ const dumpPath = [...path, 'dump'];
1007
+ if (present(value, 'dump') &&
1008
+ checkRecord(value.dump, dumpPath, issues, ['enabled'])) {
1009
+ checkBoolean(value.dump.enabled, [...dumpPath, 'enabled'], issues);
1010
+ }
1011
+ }
1012
+ function validateApplyOutput(value, issues) {
1013
+ const path = [];
1014
+ if (!isPlainRecord(value)) {
1015
+ issues.add(path, 'expected a plain object');
1016
+ return;
1017
+ }
1018
+ switch (value.kind) {
1019
+ case 'disposed':
1020
+ checkDisposed(value, path, issues);
1021
+ return;
1022
+ case 'stale-generation':
1023
+ if (checkRecord(value, path, issues, ['version', 'kind', 'generation'])) {
1024
+ checkVersion(value, path, issues);
1025
+ if (present(value, 'generation')) {
1026
+ checkGeneration(value.generation, ['generation'], issues);
1027
+ }
1028
+ }
1029
+ return;
1030
+ case 'applied':
1031
+ if (checkRecord(value, path, issues, [
1032
+ 'version',
1033
+ 'kind',
1034
+ 'generation',
1035
+ 'scope',
1036
+ 'result',
1037
+ ])) {
1038
+ checkVersion(value, path, issues);
1039
+ if (present(value, 'generation')) {
1040
+ checkGeneration(value.generation, ['generation'], issues);
1041
+ }
1042
+ if (present(value, 'scope'))
1043
+ checkScope(value.scope, ['scope'], issues);
1044
+ if (present(value, 'result')) {
1045
+ checkApplyResult(value.result, ['result'], issues);
1046
+ }
1047
+ }
1048
+ return;
1049
+ default:
1050
+ issues.add(['kind'], 'expected one of applied, stale-generation, disposed');
1051
+ }
1052
+ }
1053
+ function validateChangedEvent(value, issues) {
1054
+ if (!checkRecord(value, [], issues, ['version', 'generation']))
1055
+ return;
1056
+ checkVersion(value, [], issues);
1057
+ if (present(value, 'generation')) {
1058
+ checkGeneration(value.generation, ['generation'], issues);
1059
+ }
1060
+ }
1061
+ const VENDOR = 'cortexkit.antigravity-auth';
1062
+ function makeSchema(validate) {
1063
+ const parse = (value) => {
1064
+ const issues = new Issues();
1065
+ try {
1066
+ validate(value, issues);
1067
+ }
1068
+ catch {
1069
+ // A getter or proxy that throws is a malformed value, not a crash.
1070
+ issues.add([], 'value could not be read');
1071
+ }
1072
+ if (issues.list.length > 0)
1073
+ return { ok: false, issues: issues.list };
1074
+ // Validated values are returned as-is: no field is coerced or copied.
1075
+ return { ok: true, value: value };
1076
+ };
1077
+ return {
1078
+ parse,
1079
+ '~standard': {
1080
+ version: 1,
1081
+ vendor: VENDOR,
1082
+ validate: (value) => {
1083
+ const result = parse(value);
1084
+ return result.ok ? { value: result.value } : { issues: result.issues };
1085
+ },
1086
+ },
1087
+ };
1088
+ }
1089
+ export const AntigravityStateInputSchema = makeSchema(validateStateInput);
1090
+ export const AntigravityStateOutputSchema = makeSchema(validateStateOutput);
1091
+ export const AntigravityApplyInputSchema = makeSchema(validateApplyInput);
1092
+ export const AntigravityApplyOutputSchema = makeSchema(validateApplyOutput);
1093
+ export const AntigravityChangedEventSchema = makeSchema(validateChangedEvent);
1094
+ export const AntigravityAccountsSchema = makeSchema((value, issues) => checkAccounts(value, [], issues));
1095
+ export const AntigravityApplyResultSchema = makeSchema((value, issues) => checkApplyResult(value, [], issues));
1096
+ export const AntigravityNotificationPayloadSchema = makeSchema((value, issues) => checkNotificationPayload(value, [], issues));
1097
+ // Definition
1098
+ /**
1099
+ * The definition the server registers and clients call. Its shape is the one
1100
+ * the OpenCode 2.0.22 RPC registry reads: `id`, `methods.<name>.{input,
1101
+ * output}` and `events.<name>.schema`. This module imports nothing from the
1102
+ * host SDK, so the check against the SDK's `Rpc.PortableDefinition` type
1103
+ * happens where the server passes this object to `rpc.register`.
1104
+ */
1105
+ export const ANTIGRAVITY_RPC_DEFINITION = {
1106
+ id: ANTIGRAVITY_RPC_ID,
1107
+ methods: {
1108
+ state: {
1109
+ input: AntigravityStateInputSchema,
1110
+ output: AntigravityStateOutputSchema,
1111
+ },
1112
+ apply: {
1113
+ input: AntigravityApplyInputSchema,
1114
+ output: AntigravityApplyOutputSchema,
1115
+ },
1116
+ },
1117
+ events: {
1118
+ changed: { schema: AntigravityChangedEventSchema },
1119
+ },
1120
+ };
1121
+ export function stateCall(input) {
1122
+ return { rpcID: ANTIGRAVITY_RPC_ID, method: 'state', input };
1123
+ }
1124
+ export function applyCall(input) {
1125
+ return { rpcID: ANTIGRAVITY_RPC_ID, method: 'apply', input };
1126
+ }
1127
+ /**
1128
+ * Read the `output` member of the host's `rpc.call` answer (`{ output? }`)
1129
+ * and validate it. A client must not trust the answer without this.
1130
+ */
1131
+ function readCallOutput(raw, schema) {
1132
+ if (!isPlainRecord(raw)) {
1133
+ return {
1134
+ ok: false,
1135
+ issues: [{ path: [], message: 'expected the rpc.call answer object' }],
1136
+ };
1137
+ }
1138
+ const unexpected = Object.keys(raw).filter((key) => key !== 'output');
1139
+ if (unexpected.length > 0) {
1140
+ return {
1141
+ ok: false,
1142
+ issues: unexpected.map((key) => ({
1143
+ path: [key],
1144
+ message: 'unexpected key',
1145
+ })),
1146
+ };
1147
+ }
1148
+ const result = schema.parse(raw.output);
1149
+ if (result.ok)
1150
+ return result;
1151
+ return {
1152
+ ok: false,
1153
+ issues: result.issues.map((issue) => ({
1154
+ path: ['output', ...issue.path],
1155
+ message: issue.message,
1156
+ })),
1157
+ };
1158
+ }
1159
+ export function readStateCallOutput(raw) {
1160
+ return readCallOutput(raw, AntigravityStateOutputSchema);
1161
+ }
1162
+ export function readApplyCallOutput(raw) {
1163
+ return readCallOutput(raw, AntigravityApplyOutputSchema);
1164
+ }
1165
+ // Contract descriptor
1166
+ /**
1167
+ * Every name, literal and limit of the serialized contract in one value.
1168
+ * A test checks its SHA-256, so any change to the wire contract also changes
1169
+ * that hash, and clients built against another version can detect it.
1170
+ */
1171
+ export const ANTIGRAVITY_RPC_CONTRACT = {
1172
+ id: ANTIGRAVITY_RPC_ID,
1173
+ version: ANTIGRAVITY_RPC_VERSION,
1174
+ methods: ANTIGRAVITY_RPC_METHODS,
1175
+ events: ANTIGRAVITY_RPC_EVENTS,
1176
+ menuCommand: ANTIGRAVITY_MENU_COMMAND_NAME,
1177
+ logLevels: ANTIGRAVITY_LOG_LEVELS,
1178
+ scopeKinds: ['session', 'sessionless'],
1179
+ stateKinds: ['snapshot', 'disposed'],
1180
+ applyKinds: ['applied', 'stale-generation', 'disposed'],
1181
+ stateResets: ANTIGRAVITY_STATE_RESETS,
1182
+ menuSectionSlots: SECTION_SLOTS,
1183
+ menuKnobKinds: KNOB_KINDS,
1184
+ notifyKinds: NOTIFY_KINDS,
1185
+ menuIdPattern: '^[\\x21-\\x7e]+$',
1186
+ accountsStatusKinds: ['complete', 'over-limit'],
1187
+ selectorPattern: '^sel-[A-Za-z0-9_-]{32}$',
1188
+ limits: ANTIGRAVITY_RPC_LIMITS,
1189
+ keys: {
1190
+ stateInput: ['version', 'generation', 'scope', 'cursor'],
1191
+ applyInput: ['version', 'generation', 'scope', 'request'],
1192
+ menuRequest: [
1193
+ 'command',
1194
+ 'sectionId',
1195
+ 'actionId',
1196
+ 'itemId?',
1197
+ 'values?',
1198
+ 'confirmed?',
1199
+ ],
1200
+ stateSnapshot: [
1201
+ 'version',
1202
+ 'kind',
1203
+ 'generation',
1204
+ 'scope',
1205
+ 'reset',
1206
+ 'cursor',
1207
+ 'dropped',
1208
+ 'more',
1209
+ 'notifications',
1210
+ 'readSeq',
1211
+ 'accountsStatus',
1212
+ 'accounts',
1213
+ 'route',
1214
+ 'status',
1215
+ 'settings',
1216
+ ],
1217
+ notification: ['cursor', 'payload'],
1218
+ notificationPayload: {
1219
+ menu: ['command', 'menu'],
1220
+ notify: ['command', 'notify'],
1221
+ notifyBody: ['message', 'kind'],
1222
+ },
1223
+ menu: ['command', 'title', 'sections'],
1224
+ menuSection: ['id', 'slot', 'title', 'lines', 'items', 'actions', 'facts?'],
1225
+ menuItem: ['id', 'label', 'actions', 'detail?', 'account?', 'facts?'],
1226
+ menuAccount: ['id', 'enabled', 'type', 'label?', 'identity?'],
1227
+ menuAction: ['id', 'label', 'knobs', 'description?', 'confirm?'],
1228
+ menuConfirm: ['message', 'irreversible'],
1229
+ menuKnob: {
1230
+ choice: ['kind', 'id', 'label', 'choices', 'value?'],
1231
+ toggle: ['kind', 'id', 'label', 'value'],
1232
+ number: ['kind', 'id', 'label', 'value?', 'min?', 'max?', 'required?'],
1233
+ text: [
1234
+ 'kind',
1235
+ 'id',
1236
+ 'label',
1237
+ 'value?',
1238
+ 'placeholder?',
1239
+ 'masked?',
1240
+ 'required?',
1241
+ ],
1242
+ },
1243
+ menuChoice: ['value', 'label'],
1244
+ applyResult: [
1245
+ 'command',
1246
+ 'ok',
1247
+ 'text',
1248
+ 'menu',
1249
+ 'code?',
1250
+ 'needsConfirmation?',
1251
+ ],
1252
+ account: [
1253
+ 'selector',
1254
+ 'id',
1255
+ 'label',
1256
+ 'enabled',
1257
+ 'health',
1258
+ 'current',
1259
+ 'cooldownUntil?',
1260
+ 'quota',
1261
+ 'tier?',
1262
+ ],
1263
+ accountsStatus: {
1264
+ complete: ['kind'],
1265
+ 'over-limit': ['kind', 'count', 'limit'],
1266
+ },
1267
+ settings: {
1268
+ root: ['routing', 'killswitch', 'logLevel', 'dump'],
1269
+ routing: ['cliFirst', 'quotaStyleFallback'],
1270
+ killswitch: ['enabled', 'minimumRemainingPercent'],
1271
+ dump: ['enabled'],
1272
+ },
1273
+ route: ['accountId', 'modelFamily', 'headerStyle', 'strategy', 'updatedAt'],
1274
+ status: ['checkedAt', 'quotaBackoffUntil', 'routingAuthoritative'],
1275
+ changedEvent: ['version', 'generation'],
1276
+ },
1277
+ };
1278
+ //# sourceMappingURL=protocol.js.map