@cortexkit/opencode-antigravity-auth 3.0.12 → 3.0.14

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 (328) hide show
  1. package/dist/cli.js +9839 -6706
  2. package/dist/cli.js.map +4 -4
  3. package/dist/cli.meta.json +722 -175
  4. package/dist/index.js +4902 -1443
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +756 -190
  7. package/dist/server.js +8671 -4993
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/__fixtures__/runtime-layout-process.d.ts +2 -0
  11. package/dist/src/__fixtures__/runtime-layout-process.d.ts.map +1 -0
  12. package/dist/src/__fixtures__/runtime-layout-process.js +88 -0
  13. package/dist/src/__fixtures__/runtime-layout-process.js.map +1 -0
  14. package/dist/src/cli.d.ts +26 -0
  15. package/dist/src/cli.d.ts.map +1 -1
  16. package/dist/src/cli.js +44 -1
  17. package/dist/src/cli.js.map +1 -1
  18. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +77 -2
  19. package/dist/src/common-auth-embedded/claustrum/consumer.js +320 -35
  20. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +36 -1
  21. package/dist/src/common-auth-embedded/claustrum/custody.js +95 -11
  22. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +9 -0
  23. package/dist/src/common-auth-embedded/claustrum/enrollment.js +52 -20
  24. package/dist/src/common-auth-embedded/claustrum/hub.d.ts +195 -0
  25. package/dist/src/common-auth-embedded/claustrum/hub.js +1032 -0
  26. package/dist/src/common-auth-embedded/claustrum/index.d.ts +13 -3
  27. package/dist/src/common-auth-embedded/claustrum/index.js +37 -4
  28. package/dist/src/common-auth-embedded/claustrum/quota-writer.d.ts +8 -1
  29. package/dist/src/common-auth-embedded/claustrum/quota-writer.js +34 -12
  30. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +49 -1
  31. package/dist/src/common-auth-embedded/claustrum/roster.js +187 -12
  32. package/dist/src/common-auth-embedded/claustrum/shutdown.js +42 -0
  33. package/dist/src/common-auth-embedded/fs/file-read-cache.js +57 -0
  34. package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +1 -1
  35. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +36 -14
  36. package/dist/src/common-auth-embedded/opencode2/errors.d.ts +4 -1
  37. package/dist/src/common-auth-embedded/opencode2/index.d.ts +2 -2
  38. package/dist/src/common-auth-embedded/opencode2/index.js +1 -1
  39. package/dist/src/common-auth-embedded/opencode2/install.d.ts +7 -5
  40. package/dist/src/common-auth-embedded/opencode2/install.js +139 -13
  41. package/dist/src/common-auth-embedded/opencode2/types.d.ts +42 -10
  42. package/dist/src/common-auth-embedded/quota/commit-interval.d.ts +9 -0
  43. package/dist/src/common-auth-embedded/quota/commit-interval.js +18 -0
  44. package/dist/src/common-auth-embedded/rpc/rpc-server.js +29 -19
  45. package/dist/src/common-auth-embedded/setup/command.js +40 -47
  46. package/dist/src/common-auth-embedded/setup/flags.d.ts +50 -0
  47. package/dist/src/common-auth-embedded/setup/flags.js +123 -0
  48. package/dist/src/common-auth-embedded/setup/index.d.ts +1 -0
  49. package/dist/src/common-auth-embedded/setup/index.js +1 -0
  50. package/dist/src/common-auth-embedded/setup/register.d.ts +2 -0
  51. package/dist/src/common-auth-embedded/setup/register.js +90 -11
  52. package/dist/src/common-auth-embedded/setup/types.d.ts +7 -1
  53. package/dist/src/common-auth-embedded/source-output.json +173 -109
  54. package/dist/src/common-auth-embedded/store/mutate.d.ts +2 -0
  55. package/dist/src/common-auth-embedded/store/mutate.js +4 -0
  56. package/dist/src/common-auth-embedded/store/pool.d.ts +6 -1
  57. package/dist/src/common-auth-embedded/store/pool.js +1 -1
  58. package/dist/src/common-auth-embedded/store/quota-writer.js +27 -13
  59. package/dist/src/common-auth-embedded/store/settings.d.ts +1 -1
  60. package/dist/src/common-auth-embedded/store/settings.js +16 -6
  61. package/dist/src/ga/rpc/protocol.d.ts +2 -0
  62. package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
  63. package/dist/src/ga/rpc/protocol.js +2 -2
  64. package/dist/src/ga/rpc/protocol.js.map +1 -1
  65. package/dist/src/ga/server/auth.d.ts.map +1 -1
  66. package/dist/src/ga/server/auth.js +7 -2
  67. package/dist/src/ga/server/auth.js.map +1 -1
  68. package/dist/src/ga/server/index.d.ts.map +1 -1
  69. package/dist/src/ga/server/index.js +25 -0
  70. package/dist/src/ga/server/index.js.map +1 -1
  71. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  72. package/dist/src/ga/tui/host-ga.js +2 -1
  73. package/dist/src/ga/tui/host-ga.js.map +1 -1
  74. package/dist/src/plugin/__fixtures__/controlled-timeouts.d.ts +7 -0
  75. package/dist/src/plugin/__fixtures__/controlled-timeouts.d.ts.map +1 -0
  76. package/dist/src/plugin/__fixtures__/controlled-timeouts.js +41 -0
  77. package/dist/src/plugin/__fixtures__/controlled-timeouts.js.map +1 -0
  78. package/dist/src/plugin/__fixtures__/release-model-ids.d.ts +2 -0
  79. package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -0
  80. package/dist/src/plugin/__fixtures__/release-model-ids.js +11 -0
  81. package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -0
  82. package/dist/src/plugin/__fixtures__/verified-store.d.ts +3 -0
  83. package/dist/src/plugin/__fixtures__/verified-store.d.ts.map +1 -0
  84. package/dist/src/plugin/__fixtures__/verified-store.js +50 -0
  85. package/dist/src/plugin/__fixtures__/verified-store.js.map +1 -0
  86. package/dist/src/plugin/auth-loader.d.ts +7 -1
  87. package/dist/src/plugin/auth-loader.d.ts.map +1 -1
  88. package/dist/src/plugin/auth-loader.js +4 -4
  89. package/dist/src/plugin/auth-loader.js.map +1 -1
  90. package/dist/src/plugin/background-vault-quota-refresh.d.ts +10 -0
  91. package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  92. package/dist/src/plugin/background-vault-quota-refresh.js +33 -5
  93. package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
  94. package/dist/src/plugin/cache/signature-cache.d.ts +7 -1
  95. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  96. package/dist/src/plugin/cache/signature-cache.js +10 -13
  97. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  98. package/dist/src/plugin/command-data.d.ts +2 -2
  99. package/dist/src/plugin/command-data.d.ts.map +1 -1
  100. package/dist/src/plugin/command-data.js +2 -0
  101. package/dist/src/plugin/command-data.js.map +1 -1
  102. package/dist/src/plugin/config/loader.d.ts +2 -1
  103. package/dist/src/plugin/config/loader.d.ts.map +1 -1
  104. package/dist/src/plugin/config/loader.js +4 -2
  105. package/dist/src/plugin/config/loader.js.map +1 -1
  106. package/dist/src/plugin/config/operator-settings-schema.d.ts +1 -1
  107. package/dist/src/plugin/config/schema.d.ts +1 -1
  108. package/dist/src/plugin/config/schema.js +1 -1
  109. package/dist/src/plugin/debug.d.ts.map +1 -1
  110. package/dist/src/plugin/debug.js +18 -19
  111. package/dist/src/plugin/debug.js.map +1 -1
  112. package/dist/src/plugin/errors.js +1 -1
  113. package/dist/src/plugin/errors.js.map +1 -1
  114. package/dist/src/plugin/ga-location-services.d.ts +28 -2
  115. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  116. package/dist/src/plugin/ga-location-services.js +118 -31
  117. package/dist/src/plugin/ga-location-services.js.map +1 -1
  118. package/dist/src/plugin/ga-shared-vault-custody.d.ts +78 -0
  119. package/dist/src/plugin/ga-shared-vault-custody.d.ts.map +1 -0
  120. package/dist/src/plugin/ga-shared-vault-custody.js +177 -0
  121. package/dist/src/plugin/ga-shared-vault-custody.js.map +1 -0
  122. package/dist/src/plugin/index.d.ts.map +1 -1
  123. package/dist/src/plugin/index.js +38 -6
  124. package/dist/src/plugin/index.js.map +1 -1
  125. package/dist/src/plugin/killswitch.d.ts.map +1 -1
  126. package/dist/src/plugin/killswitch.js +13 -7
  127. package/dist/src/plugin/killswitch.js.map +1 -1
  128. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  129. package/dist/src/plugin/oauth-methods.js +3 -0
  130. package/dist/src/plugin/oauth-methods.js.map +1 -1
  131. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  132. package/dist/src/plugin/shared/request-services.js +2 -3
  133. package/dist/src/plugin/shared/request-services.js.map +1 -1
  134. package/dist/src/plugin/shared/source-sidebar.d.ts +6 -0
  135. package/dist/src/plugin/shared/source-sidebar.d.ts.map +1 -1
  136. package/dist/src/plugin/shared/source-sidebar.js +1 -1
  137. package/dist/src/plugin/shared/source-sidebar.js.map +1 -1
  138. package/dist/src/plugin/shared/vault-request-credentials.d.ts +8 -1
  139. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  140. package/dist/src/plugin/shared/vault-request-credentials.js +38 -5
  141. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  142. package/dist/src/plugin/storage.d.ts +5 -2
  143. package/dist/src/plugin/storage.d.ts.map +1 -1
  144. package/dist/src/plugin/storage.js +5 -4
  145. package/dist/src/plugin/storage.js.map +1 -1
  146. package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
  147. package/dist/src/plugin/ui/auth-menu.js +3 -0
  148. package/dist/src/plugin/ui/auth-menu.js.map +1 -1
  149. package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
  150. package/dist/src/plugin/ui/quota-status.js +4 -2
  151. package/dist/src/plugin/ui/quota-status.js.map +1 -1
  152. package/dist/src/plugin/vault-custody.d.ts +57 -15
  153. package/dist/src/plugin/vault-custody.d.ts.map +1 -1
  154. package/dist/src/plugin/vault-custody.js +259 -45
  155. package/dist/src/plugin/vault-custody.js.map +1 -1
  156. package/dist/src/plugin/vault-insula-quota.d.ts.map +1 -1
  157. package/dist/src/plugin/vault-insula-quota.js +4 -0
  158. package/dist/src/plugin/vault-insula-quota.js.map +1 -1
  159. package/dist/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  160. package/dist/src/process-heartbeat.d.ts +96 -0
  161. package/dist/src/process-heartbeat.d.ts.map +1 -0
  162. package/dist/src/process-heartbeat.js +285 -0
  163. package/dist/src/process-heartbeat.js.map +1 -0
  164. package/dist/src/rpc/rpc-server.d.ts +8 -0
  165. package/dist/src/rpc/rpc-server.d.ts.map +1 -1
  166. package/dist/src/rpc/rpc-server.js +26 -1
  167. package/dist/src/rpc/rpc-server.js.map +1 -1
  168. package/dist/src/runtime-layout.d.ts +100 -0
  169. package/dist/src/runtime-layout.d.ts.map +1 -0
  170. package/dist/src/runtime-layout.js +1242 -0
  171. package/dist/src/runtime-layout.js.map +1 -0
  172. package/dist/src/runtime-paths.d.ts +132 -0
  173. package/dist/src/runtime-paths.d.ts.map +1 -0
  174. package/dist/src/runtime-paths.js +214 -0
  175. package/dist/src/runtime-paths.js.map +1 -0
  176. package/dist/src/setup.d.ts.map +1 -1
  177. package/dist/src/setup.js +31 -5
  178. package/dist/src/setup.js.map +1 -1
  179. package/dist/src/sidebar-projection.d.ts +3 -1
  180. package/dist/src/sidebar-projection.d.ts.map +1 -1
  181. package/dist/src/sidebar-projection.js +10 -1
  182. package/dist/src/sidebar-projection.js.map +1 -1
  183. package/dist/src/sidebar-state.d.ts +10 -1
  184. package/dist/src/sidebar-state.d.ts.map +1 -1
  185. package/dist/src/sidebar-state.js +12 -2
  186. package/dist/src/sidebar-state.js.map +1 -1
  187. package/dist/src/tui/quota-layout.d.ts +3 -1
  188. package/dist/src/tui/quota-layout.d.ts.map +1 -1
  189. package/dist/src/tui/quota-layout.js +6 -1
  190. package/dist/src/tui/quota-layout.js.map +1 -1
  191. package/dist/src/vault-folder.d.ts +38 -0
  192. package/dist/src/vault-folder.d.ts.map +1 -0
  193. package/dist/src/vault-folder.js +91 -0
  194. package/dist/src/vault-folder.js.map +1 -0
  195. package/dist/src/version-fence.d.ts +54 -0
  196. package/dist/src/version-fence.d.ts.map +1 -0
  197. package/dist/src/version-fence.js +254 -0
  198. package/dist/src/version-fence.js.map +1 -0
  199. package/dist/tui-build-map.json +9 -9
  200. package/dist/tui-ga-build-map.json +13 -13
  201. package/dist/types/src/cli.d.ts +26 -0
  202. package/dist/types/src/cli.d.ts.map +1 -1
  203. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +77 -2
  204. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +36 -1
  205. package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +9 -0
  206. package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +195 -0
  207. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +13 -3
  208. package/dist/types/src/common-auth-embedded/claustrum/quota-writer.d.ts +8 -1
  209. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +49 -1
  210. package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +1 -1
  211. package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +4 -1
  212. package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +2 -2
  213. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +7 -5
  214. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +42 -10
  215. package/dist/types/src/common-auth-embedded/quota/commit-interval.d.ts +9 -0
  216. package/dist/types/src/common-auth-embedded/setup/flags.d.ts +50 -0
  217. package/dist/types/src/common-auth-embedded/setup/index.d.ts +1 -0
  218. package/dist/types/src/common-auth-embedded/setup/register.d.ts +2 -0
  219. package/dist/types/src/common-auth-embedded/setup/types.d.ts +7 -1
  220. package/dist/types/src/common-auth-embedded/store/mutate.d.ts +2 -0
  221. package/dist/types/src/common-auth-embedded/store/pool.d.ts +6 -1
  222. package/dist/types/src/common-auth-embedded/store/settings.d.ts +1 -1
  223. package/dist/types/src/ga/rpc/protocol.d.ts +2 -0
  224. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  225. package/dist/types/src/ga/server/auth.d.ts.map +1 -1
  226. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  227. package/dist/types/src/plugin/auth-loader.d.ts +7 -1
  228. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
  229. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +10 -0
  230. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  231. package/dist/types/src/plugin/cache/signature-cache.d.ts +7 -1
  232. package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -1
  233. package/dist/types/src/plugin/command-data.d.ts +2 -2
  234. package/dist/types/src/plugin/command-data.d.ts.map +1 -1
  235. package/dist/types/src/plugin/config/loader.d.ts +2 -1
  236. package/dist/types/src/plugin/config/loader.d.ts.map +1 -1
  237. package/dist/types/src/plugin/debug.d.ts.map +1 -1
  238. package/dist/types/src/plugin/ga-location-services.d.ts +28 -2
  239. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  240. package/dist/types/src/plugin/ga-shared-vault-custody.d.ts +78 -0
  241. package/dist/types/src/plugin/ga-shared-vault-custody.d.ts.map +1 -0
  242. package/dist/types/src/plugin/index.d.ts.map +1 -1
  243. package/dist/types/src/plugin/killswitch.d.ts.map +1 -1
  244. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
  245. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  246. package/dist/types/src/plugin/shared/source-sidebar.d.ts +6 -0
  247. package/dist/types/src/plugin/shared/source-sidebar.d.ts.map +1 -1
  248. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +8 -1
  249. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  250. package/dist/types/src/plugin/storage.d.ts +5 -2
  251. package/dist/types/src/plugin/storage.d.ts.map +1 -1
  252. package/dist/types/src/plugin/ui/auth-menu.d.ts.map +1 -1
  253. package/dist/types/src/plugin/ui/quota-status.d.ts.map +1 -1
  254. package/dist/types/src/plugin/vault-custody.d.ts +57 -15
  255. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
  256. package/dist/types/src/plugin/vault-insula-quota.d.ts.map +1 -1
  257. package/dist/types/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  258. package/dist/types/src/process-heartbeat.d.ts +96 -0
  259. package/dist/types/src/process-heartbeat.d.ts.map +1 -0
  260. package/dist/types/src/rpc/rpc-server.d.ts +8 -0
  261. package/dist/types/src/rpc/rpc-server.d.ts.map +1 -1
  262. package/dist/types/src/runtime-layout.d.ts +100 -0
  263. package/dist/types/src/runtime-layout.d.ts.map +1 -0
  264. package/dist/types/src/runtime-paths.d.ts +132 -0
  265. package/dist/types/src/runtime-paths.d.ts.map +1 -0
  266. package/dist/types/src/setup.d.ts.map +1 -1
  267. package/dist/types/src/sidebar-state.d.ts +10 -1
  268. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  269. package/dist/types/src/vault-folder.d.ts +38 -0
  270. package/dist/types/src/vault-folder.d.ts.map +1 -0
  271. package/dist/types/src/version-fence.d.ts +54 -0
  272. package/dist/types/src/version-fence.d.ts.map +1 -0
  273. package/package.json +2 -2
  274. package/src/common-auth-embedded/claustrum/consumer.d.ts +77 -2
  275. package/src/common-auth-embedded/claustrum/consumer.js +320 -35
  276. package/src/common-auth-embedded/claustrum/custody.d.ts +36 -1
  277. package/src/common-auth-embedded/claustrum/custody.js +95 -11
  278. package/src/common-auth-embedded/claustrum/enrollment.d.ts +9 -0
  279. package/src/common-auth-embedded/claustrum/enrollment.js +52 -20
  280. package/src/common-auth-embedded/claustrum/hub.d.ts +195 -0
  281. package/src/common-auth-embedded/claustrum/hub.js +1032 -0
  282. package/src/common-auth-embedded/claustrum/index.d.ts +13 -3
  283. package/src/common-auth-embedded/claustrum/index.js +37 -4
  284. package/src/common-auth-embedded/claustrum/quota-writer.d.ts +8 -1
  285. package/src/common-auth-embedded/claustrum/quota-writer.js +34 -12
  286. package/src/common-auth-embedded/claustrum/roster.d.ts +49 -1
  287. package/src/common-auth-embedded/claustrum/roster.js +187 -12
  288. package/src/common-auth-embedded/claustrum/shutdown.js +42 -0
  289. package/src/common-auth-embedded/fs/file-read-cache.js +57 -0
  290. package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +1 -1
  291. package/src/common-auth-embedded/fs/refresh-file-lock.js +36 -14
  292. package/src/common-auth-embedded/opencode2/errors.d.ts +4 -1
  293. package/src/common-auth-embedded/opencode2/index.d.ts +2 -2
  294. package/src/common-auth-embedded/opencode2/index.js +1 -1
  295. package/src/common-auth-embedded/opencode2/install.d.ts +7 -5
  296. package/src/common-auth-embedded/opencode2/install.js +139 -13
  297. package/src/common-auth-embedded/opencode2/types.d.ts +42 -10
  298. package/src/common-auth-embedded/quota/commit-interval.d.ts +9 -0
  299. package/src/common-auth-embedded/quota/commit-interval.js +18 -0
  300. package/src/common-auth-embedded/rpc/rpc-server.js +29 -19
  301. package/src/common-auth-embedded/setup/command.js +40 -47
  302. package/src/common-auth-embedded/setup/flags.d.ts +50 -0
  303. package/src/common-auth-embedded/setup/flags.js +123 -0
  304. package/src/common-auth-embedded/setup/index.d.ts +1 -0
  305. package/src/common-auth-embedded/setup/index.js +1 -0
  306. package/src/common-auth-embedded/setup/register.d.ts +2 -0
  307. package/src/common-auth-embedded/setup/register.js +90 -11
  308. package/src/common-auth-embedded/setup/types.d.ts +7 -1
  309. package/src/common-auth-embedded/source-output.json +173 -109
  310. package/src/common-auth-embedded/store/mutate.d.ts +2 -0
  311. package/src/common-auth-embedded/store/mutate.js +4 -0
  312. package/src/common-auth-embedded/store/pool.d.ts +6 -1
  313. package/src/common-auth-embedded/store/pool.js +1 -1
  314. package/src/common-auth-embedded/store/quota-writer.js +27 -13
  315. package/src/common-auth-embedded/store/settings.d.ts +1 -1
  316. package/src/common-auth-embedded/store/settings.js +16 -6
  317. package/src/plugin/command-data.ts +4 -2
  318. package/src/sidebar-state.ts +23 -3
  319. package/src/tui-compiled/sidebar-state.js +4 -3
  320. package/src/tui-compiled/tui/quota-layout.js +3 -2
  321. package/src/tui-ga-compiled/host-ga.js +2 -1
  322. package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +9 -2
  323. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +3 -2
  324. package/src/tui-ga-raw/host-ga.tsx +12 -1
  325. package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +9 -2
  326. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +9 -2
  327. package/src/tui-raw/sidebar-state.js +4 -3
  328. package/src/tui-raw/tui/quota-layout.tsx +9 -2
@@ -1 +1 @@
1
- {"version":3,"file":"vault-insula-quota.js","sourceRoot":"","sources":["../../../src/plugin/vault-insula-quota.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,GAAiD;IAC5D,CAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC;IAC7B,CAAC,eAAe,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACrC,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC;IAC7B,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC;CACtC,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAA+B,CACnE,KAAK,EACL,OAAO,EACP,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,SAAS,CAAA;IAC9C,IACE,KAAK,CAAC,QAAQ,KAAK,aAAa;QAChC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;QACtB,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC;QAEnC,OAAO,SAAS,CAAA;IAClB,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,6EAA6E;IAC7E,4EAA4E;IAC5E,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,CACjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,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iB,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,GAAG,GAAG;YAChD,SAAS,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;SAClC,CAAA;QACD,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;YACxC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAA;QACzB,CAAC;QACD,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QACjC,IACE,OAAO,CAAC,iBAAiB,KAAK,SAAS;YACvC,UAAU,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,EACxD,CAAC;YACD,OAAO,CAAC,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAA;YACxD,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QAC1C,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACtD,OAAO;QACL,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE;QAChC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;QACrC,UAAU,EAAE,OAAO,CAAC,SAAS;KAC9B,CAAA;AACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"vault-sidebar-projection.d.ts","sourceRoot":"","sources":["../../../src/plugin/vault-sidebar-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAA;AAE3C,8FAA8F;AAC9F,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,sBAAsB,qEAO9B;AAED,+FAA+F;AAC/F,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EACxC,KAAK,EAAE,sBAAsB,EAC7B,SAAS,SAAa;;;;;;;;;;;;kBA0BgrE,CAAC;;;;;;;;EADxsE"}
1
+ {"version":3,"file":"vault-sidebar-projection.d.ts","sourceRoot":"","sources":["../../../src/plugin/vault-sidebar-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAA;AAE3C,8FAA8F;AAC9F,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,sBAAsB,qEAO9B;AAED,+FAA+F;AAC/F,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EACxC,KAAK,EAAE,sBAAsB,EAC7B,SAAS,SAAa;;;;;;;;;;;;kBA0BisE,CAAC;;;;;;;;EADztE"}
@@ -0,0 +1,96 @@
1
+ /** Where one process keeps one config folder's runtime files. */
2
+ export type ProcessLayout = 'legacy' | 'state-home';
3
+ export interface ProcessHeartbeat {
4
+ pid: number;
5
+ version: string;
6
+ startedAt: number;
7
+ /** Config folder key (`processConfigFolderKey()`) to its layout. */
8
+ layouts: Record<string, ProcessLayout>;
9
+ }
10
+ /**
11
+ * The heartbeat directory, resolved the same way as the RPC directory:
12
+ * `$XDG_STATE_HOME/cortexkit/antigravity-auth/processes`, with
13
+ * `~/.local/state` as the state home when XDG_STATE_HOME is unset, on every
14
+ * operating system.
15
+ */
16
+ export declare function processHeartbeatDir(): string;
17
+ export declare function processHeartbeatPath(pid?: number, dir?: string): string;
18
+ /**
19
+ * The key a config folder is recorded under: the OpenCode config folder the
20
+ * account file lives in (`getConfigDir()` in `plugin/storage.ts`), as
21
+ * `realpathSync.native` returns it, or `path.resolve` when the folder does not
22
+ * exist yet. The string is used exactly as returned, with no lower-casing or
23
+ * other normalisation, so it matches the identity every CortexKit auth plugin's
24
+ * file move compares against.
25
+ */
26
+ export declare function processConfigFolderKey(): string;
27
+ export interface HeartbeatLogger {
28
+ warn(message: string, meta?: Record<string, unknown>): unknown;
29
+ }
30
+ export interface ProcessHeartbeatHandle {
31
+ /** Where the heartbeat is, or undefined when no write has succeeded. */
32
+ path: string | undefined;
33
+ /**
34
+ * Drop this owner. The file is removed when no owner in the process is
35
+ * left and the process holds no legacy layout.
36
+ */
37
+ release(): Promise<void>;
38
+ }
39
+ /**
40
+ * Record this process as running `version`, with `layouts` added to the
41
+ * layouts it already holds. Never throws: a failed write is logged at warn
42
+ * and tried again at the next owner start. The file is written only when
43
+ * this process has not written it yet or its layouts changed, so later
44
+ * owners of a process whose file is current write nothing.
45
+ */
46
+ export declare function startProcessHeartbeat(input: {
47
+ version: string;
48
+ logger: HeartbeatLogger;
49
+ layouts?: Record<string, ProcessLayout>;
50
+ now?: () => number;
51
+ pid?: number;
52
+ dir?: string;
53
+ }): Promise<ProcessHeartbeatHandle>;
54
+ /**
55
+ * Remove this process's heartbeat now, whatever its owners and layouts,
56
+ * because the process is about to exit. The CLI calls it when its command
57
+ * finishes. Never throws.
58
+ */
59
+ export declare function removeProcessHeartbeat(logger: HeartbeatLogger): Promise<void>;
60
+ /**
61
+ * Record which layout this process uses for one config folder. A `legacy`
62
+ * choice is written to the heartbeat file at once, because another process
63
+ * deciding whether it may move the files reads it; the caller makes the
64
+ * choice and this write while it holds the layout lock. A `state-home`
65
+ * choice only goes into the next heartbeat write. Throws when the write
66
+ * fails, unlike `startProcessHeartbeat`.
67
+ */
68
+ export declare function recordProcessLayout(input: {
69
+ key: string;
70
+ layout: ProcessLayout;
71
+ version: string;
72
+ now?: () => number;
73
+ pid?: number;
74
+ dir?: string;
75
+ }): Promise<void>;
76
+ /** This plugin's version, from its package manifest. */
77
+ export declare function pluginPackageVersion(): Promise<string>;
78
+ /**
79
+ * Start one owner of this process's heartbeat: the plugin's version and the
80
+ * layout this process decided for its OpenCode config folder, or `legacy`
81
+ * while it has not decided. When the package manifest cannot be read it
82
+ * writes version `unknown` and no layout. Never throws; a failure is logged
83
+ * at warn.
84
+ */
85
+ export declare function startRuntimeProcessHeartbeat(logger: HeartbeatLogger): Promise<ProcessHeartbeatHandle>;
86
+ /**
87
+ * The standalone CLI's owner of this process's heartbeat. Commands call it only
88
+ * once they are about to use the plugin's data: never for help, a rejected
89
+ * command line, a setup preview or a setup that refuses before its first
90
+ * change, which must leave the disk untouched. The CLI removes the file when
91
+ * its command finishes.
92
+ */
93
+ export declare function holdCliProcessHeartbeat(logger: HeartbeatLogger): Promise<void>;
94
+ /** Forget the process-wide heartbeat state; for tests only. */
95
+ export declare function __resetProcessHeartbeatForTest(): void;
96
+ //# sourceMappingURL=process-heartbeat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-heartbeat.d.ts","sourceRoot":"","sources":["../../src/process-heartbeat.ts"],"names":[],"mappings":"AAqCA,iEAAiE;AACjE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,YAAY,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED,wBAAgB,oBAAoB,CAClC,GAAG,GAAE,MAAoB,EACzB,GAAG,GAAE,MAA8B,GAClC,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAO/C;AA0DD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,OAAO,EAAE,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AAO,CAAC,IAAI,CAAC,CAEf;AAED,+DAA+D;AAC/D,wBAAgB,8BAA8B,IAAI,IAAI,CAMrD"}
@@ -0,0 +1,285 @@
1
+ // Process heartbeat: which plugin versions are running on this machine.
2
+ //
3
+ // Every OpenCode 1 plugin instance, OpenCode 2 location and CLI run leaves
4
+ // one small file, `<pid>.json`, in a shared directory under the user's state
5
+ // home. A later release that moves the account, vault, cache and log files out
6
+ // of the OpenCode config folder reads these files to learn which versions are
7
+ // live before it acts; a reader treats a file whose pid is no longer running
8
+ // as absent, so a crashed process leaves nothing it has to clean up.
9
+ //
10
+ // Writing it is best-effort. A failure is logged and never fails the loader,
11
+ // and nothing here runs on the request path. There is no periodic refresh:
12
+ // the file is written when the process's first owner starts, and a failed
13
+ // write is tried again when the next owner starts.
14
+ //
15
+ // The file also carries `layouts`: for each OpenCode config folder this
16
+ // process resolved, whether it keeps that folder's vault files in the config
17
+ // folder itself (`legacy`) or in the state home (`state-home`), see
18
+ // `runtime-paths.ts`. A process that has not decided records `legacy` (or
19
+ // no layout at all when it cannot read its own package manifest, which the
20
+ // move also treats as blocking). A
21
+ // process that runs on the legacy layout keeps its file until it exits, even
22
+ // after its last owner released it, because its paths stay fixed for its
23
+ // whole life and the move must wait for it.
24
+ //
25
+ // One write is not best-effort: `recordProcessLayout` records a `legacy`
26
+ // decision while the deciding process holds the layout lock, and throws when
27
+ // that write fails, because a process on the old files that other processes
28
+ // cannot see must not start.
29
+ import { randomUUID } from 'node:crypto';
30
+ import { realpathSync, rmSync } from 'node:fs';
31
+ import { chmod, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
32
+ import { homedir } from 'node:os';
33
+ import { join, resolve } from 'node:path';
34
+ import { getConfigDir } from './plugin/storage';
35
+ import { decidedRuntimeLayout, runtimeLayoutLocation } from './runtime-paths';
36
+ /**
37
+ * The heartbeat directory, resolved the same way as the RPC directory:
38
+ * `$XDG_STATE_HOME/cortexkit/antigravity-auth/processes`, with
39
+ * `~/.local/state` as the state home when XDG_STATE_HOME is unset, on every
40
+ * operating system.
41
+ */
42
+ export function processHeartbeatDir() {
43
+ const base = process.env.XDG_STATE_HOME || join(homedir(), '.local', 'state');
44
+ return join(base, 'cortexkit', 'antigravity-auth', 'processes');
45
+ }
46
+ export function processHeartbeatPath(pid = process.pid, dir = processHeartbeatDir()) {
47
+ return join(dir, `${pid}.json`);
48
+ }
49
+ /**
50
+ * The key a config folder is recorded under: the OpenCode config folder the
51
+ * account file lives in (`getConfigDir()` in `plugin/storage.ts`), as
52
+ * `realpathSync.native` returns it, or `path.resolve` when the folder does not
53
+ * exist yet. The string is used exactly as returned, with no lower-casing or
54
+ * other normalisation, so it matches the identity every CortexKit auth plugin's
55
+ * file move compares against.
56
+ */
57
+ export function processConfigFolderKey() {
58
+ const folder = getConfigDir();
59
+ try {
60
+ return realpathSync.native(folder);
61
+ }
62
+ catch {
63
+ return resolve(folder);
64
+ }
65
+ }
66
+ const stateKey = Symbol.for('cortexkit.antigravity-auth.process-heartbeat');
67
+ const globalState = globalThis;
68
+ const shared = globalState[stateKey] ?? {
69
+ owners: 0,
70
+ startedAt: undefined,
71
+ layouts: new Map(),
72
+ writtenPath: undefined,
73
+ writtenLayouts: undefined,
74
+ exitHookInstalled: false,
75
+ };
76
+ globalState[stateKey] = shared;
77
+ function layoutsRecord() {
78
+ return Object.fromEntries(shared.layouts);
79
+ }
80
+ function holdsLegacyLayout() {
81
+ for (const layout of shared.layouts.values())
82
+ if (layout === 'legacy')
83
+ return true;
84
+ return false;
85
+ }
86
+ // Remove the file when the process exits, where Node still runs exit
87
+ // handlers. A process killed outright leaves the file; its dead pid then
88
+ // counts as absent.
89
+ function installExitHook() {
90
+ if (shared.exitHookInstalled)
91
+ return;
92
+ shared.exitHookInstalled = true;
93
+ process.once('exit', () => {
94
+ if (!shared.writtenPath)
95
+ return;
96
+ try {
97
+ rmSync(shared.writtenPath, { force: true });
98
+ }
99
+ catch {
100
+ // Exit cannot report anything; a stale file names a dead pid.
101
+ }
102
+ });
103
+ }
104
+ async function writeHeartbeatFile(dir, heartbeat) {
105
+ await mkdir(dir, { recursive: true, mode: 0o700 });
106
+ // mkdir's mode does not apply to a directory that already exists.
107
+ await chmod(dir, 0o700);
108
+ const target = processHeartbeatPath(heartbeat.pid, dir);
109
+ // Written to a temporary name and renamed into place, so a reader never
110
+ // sees a half-written file.
111
+ const temporary = `${target}.${randomUUID()}.tmp`;
112
+ try {
113
+ await writeFile(temporary, `${JSON.stringify(heartbeat)}\n`, {
114
+ mode: 0o600,
115
+ });
116
+ await rename(temporary, target);
117
+ }
118
+ catch (error) {
119
+ await rm(temporary, { force: true }).catch(() => { });
120
+ throw error;
121
+ }
122
+ return target;
123
+ }
124
+ function errorText(error) {
125
+ return error instanceof Error ? error.message : String(error);
126
+ }
127
+ /**
128
+ * Record this process as running `version`, with `layouts` added to the
129
+ * layouts it already holds. Never throws: a failed write is logged at warn
130
+ * and tried again at the next owner start. The file is written only when
131
+ * this process has not written it yet or its layouts changed, so later
132
+ * owners of a process whose file is current write nothing.
133
+ */
134
+ export async function startProcessHeartbeat(input) {
135
+ const pid = input.pid ?? process.pid;
136
+ const dir = input.dir ?? processHeartbeatDir();
137
+ shared.startedAt ??= (input.now ?? Date.now)();
138
+ shared.owners++;
139
+ for (const [key, layout] of Object.entries(input.layouts ?? {}))
140
+ shared.layouts.set(key, layout);
141
+ const target = processHeartbeatPath(pid, dir);
142
+ const layouts = layoutsRecord();
143
+ const signature = JSON.stringify(layouts);
144
+ let path;
145
+ if (shared.writtenPath === target && shared.writtenLayouts === signature) {
146
+ path = target;
147
+ }
148
+ else {
149
+ try {
150
+ path = await writeHeartbeatFile(dir, {
151
+ pid,
152
+ version: input.version,
153
+ startedAt: shared.startedAt,
154
+ layouts,
155
+ });
156
+ shared.writtenPath = path;
157
+ shared.writtenLayouts = signature;
158
+ installExitHook();
159
+ }
160
+ catch (error) {
161
+ input.logger.warn('process heartbeat not written', {
162
+ dir,
163
+ error: errorText(error),
164
+ });
165
+ }
166
+ }
167
+ let released = false;
168
+ return {
169
+ path,
170
+ async release() {
171
+ if (released)
172
+ return;
173
+ released = true;
174
+ shared.owners = Math.max(0, shared.owners - 1);
175
+ if (shared.owners > 0)
176
+ return;
177
+ // A legacy-layout process keeps using the old paths until it exits.
178
+ if (holdsLegacyLayout())
179
+ return;
180
+ await removeHeartbeatFile(input.logger);
181
+ },
182
+ };
183
+ }
184
+ async function removeHeartbeatFile(logger) {
185
+ const path = shared.writtenPath;
186
+ if (!path)
187
+ return;
188
+ shared.writtenPath = undefined;
189
+ shared.writtenLayouts = undefined;
190
+ await rm(path, { force: true }).catch((error) => {
191
+ logger.warn('process heartbeat not removed', {
192
+ path,
193
+ error: errorText(error),
194
+ });
195
+ });
196
+ }
197
+ /**
198
+ * Remove this process's heartbeat now, whatever its owners and layouts,
199
+ * because the process is about to exit. The CLI calls it when its command
200
+ * finishes. Never throws.
201
+ */
202
+ export async function removeProcessHeartbeat(logger) {
203
+ await removeHeartbeatFile(logger);
204
+ }
205
+ /**
206
+ * Record which layout this process uses for one config folder. A `legacy`
207
+ * choice is written to the heartbeat file at once, because another process
208
+ * deciding whether it may move the files reads it; the caller makes the
209
+ * choice and this write while it holds the layout lock. A `state-home`
210
+ * choice only goes into the next heartbeat write. Throws when the write
211
+ * fails, unlike `startProcessHeartbeat`.
212
+ */
213
+ export async function recordProcessLayout(input) {
214
+ shared.layouts.set(input.key, input.layout);
215
+ if (input.layout !== 'legacy')
216
+ return;
217
+ shared.startedAt ??= (input.now ?? Date.now)();
218
+ const layouts = layoutsRecord();
219
+ const path = await writeHeartbeatFile(input.dir ?? processHeartbeatDir(), {
220
+ pid: input.pid ?? process.pid,
221
+ version: input.version,
222
+ startedAt: shared.startedAt,
223
+ layouts,
224
+ });
225
+ shared.writtenPath = path;
226
+ shared.writtenLayouts = JSON.stringify(layouts);
227
+ installExitHook();
228
+ }
229
+ // The plugin's own version, read from the package manifest. This module sits
230
+ // directly under `src/`, and the bundles it is built into sit directly under
231
+ // `dist/`, so `../package.json` names the manifest from both.
232
+ let packageVersion;
233
+ /** This plugin's version, from its package manifest. */
234
+ export function pluginPackageVersion() {
235
+ packageVersion ??= readFile(new URL('../package.json', import.meta.url), 'utf8')
236
+ .then((text) => JSON.parse(text).version)
237
+ .catch((error) => {
238
+ // Let the next owner start read it again.
239
+ packageVersion = undefined;
240
+ throw error;
241
+ });
242
+ return packageVersion;
243
+ }
244
+ /**
245
+ * Start one owner of this process's heartbeat: the plugin's version and the
246
+ * layout this process decided for its OpenCode config folder, or `legacy`
247
+ * while it has not decided. When the package manifest cannot be read it
248
+ * writes version `unknown` and no layout. Never throws; a failure is logged
249
+ * at warn.
250
+ */
251
+ export async function startRuntimeProcessHeartbeat(logger) {
252
+ let version = 'unknown';
253
+ let layouts = {};
254
+ try {
255
+ version = await pluginPackageVersion();
256
+ layouts = {
257
+ [processConfigFolderKey()]: decidedRuntimeLayout(runtimeLayoutLocation()) ?? 'legacy',
258
+ };
259
+ }
260
+ catch (error) {
261
+ logger.warn('process heartbeat details unavailable', {
262
+ error: errorText(error),
263
+ });
264
+ }
265
+ return startProcessHeartbeat({ version, logger, layouts });
266
+ }
267
+ /**
268
+ * The standalone CLI's owner of this process's heartbeat. Commands call it only
269
+ * once they are about to use the plugin's data: never for help, a rejected
270
+ * command line, a setup preview or a setup that refuses before its first
271
+ * change, which must leave the disk untouched. The CLI removes the file when
272
+ * its command finishes.
273
+ */
274
+ export async function holdCliProcessHeartbeat(logger) {
275
+ await startRuntimeProcessHeartbeat(logger);
276
+ }
277
+ /** Forget the process-wide heartbeat state; for tests only. */
278
+ export function __resetProcessHeartbeatForTest() {
279
+ shared.owners = 0;
280
+ shared.startedAt = undefined;
281
+ shared.layouts.clear();
282
+ shared.writtenPath = undefined;
283
+ shared.writtenLayouts = undefined;
284
+ }
285
+ //# sourceMappingURL=process-heartbeat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-heartbeat.js","sourceRoot":"","sources":["../../src/process-heartb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AA4B,CAChD,MAAuB;IAEvB,IAAI,OAAO,GAAG,SAAS,CAAA;IACvB,IAAI,OAAO,GAAkC,EAAE,CAAA;IAC/C,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,oBAAoB,EAAE,CAAA;QACtC,OAAO,GAAG;YACR,CAAC,sBAAsB,EAAE,CAAC,EACxB,oBAAoB,CAAC,qBAAqB,EAAE,CAAC,IAAI,QAAQ;SAC5D,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE;YACnD,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;SACxB,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,qBAAqB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAuB;IAEvB,MAAM,4BAA4B,CAAC,MAAM,CAAC,CAAA;AAC5C,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,8BAA8B;IAC5C,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IACjB,MAAM,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtB,MAAM,CAAC,WAAW,GAAG,SAAS,CAAA;IAC9B,MAAM,CAAC,cAAc,GAAG,SAAS,CAAA;AACnC,CAAC"}
@@ -11,6 +11,14 @@ export interface StartRpcServerOptions {
11
11
  * not called.
12
12
  */
13
13
  parseApplyRequest: typeof Commands.parseApplyRequest;
14
+ /**
15
+ * This plugin's package version, written into the port file. A process
16
+ * deciding whether it may move the vault files out of OpenCode's config
17
+ * folder (`version-fence.ts`) reads it; a port file without one counts as
18
+ * an older plugin and holds the move. The caller passes it in so this
19
+ * adapter imports nothing beyond the RPC library.
20
+ */
21
+ version: string;
14
22
  /** Runs one parsed menu action and returns the refreshed menu. */
15
23
  apply(request: CommandApplyRequest): Promise<CommandApplyResult> | CommandApplyResult;
16
24
  drain(lastReceivedId: number, sessionId?: string): Promise<RpcNotification[]> | RpcNotification[];
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../../src/rpc/rpc-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,2CAA2C,CAAA;AAM1E,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,iBAAiB,EAAE,OAAO,QAAQ,CAAC,iBAAiB,CAAA;IACpD,kEAAkE;IAClE,KAAK,CACH,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAA;IACnD,KAAK,CACH,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAA;CAClD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB;AAUD,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA4C1B"}
1
+ {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../../src/rpc/rpc-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,2CAA2C,CAAA;AAO1E,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,iBAAiB,EAAE,OAAO,QAAQ,CAAC,iBAAiB,CAAA;IACpD;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,KAAK,CACH,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAA;IACnD,KAAK,CACH,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAA;CAClD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB;AAUD,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAoE1B"}
@@ -1,4 +1,4 @@
1
- import { RpcRequestError, startRpcServer as startPublicRpcServer, } from '../common-auth-embedded/rpc/index.js';
1
+ import { RpcRequestError, startRpcServer as startPublicRpcServer, writePortFile, } from '../common-auth-embedded/rpc/index.js';
2
2
  export async function startRpcServer(options) {
3
3
  // JavaScript callers get no compile-time check for this required option.
4
4
  // Without the guard, a missing parser would only surface as a failure on
@@ -7,6 +7,12 @@ export async function startRpcServer(options) {
7
7
  if (typeof options.parseApplyRequest !== 'function') {
8
8
  throw new TypeError('startRpcServer needs parseApplyRequest from the common-auth commands module');
9
9
  }
10
+ // Without a version the port file would be unversioned, and every later
11
+ // version check would treat this process as an older plugin. Refuse before
12
+ // anything is created, like the parser check above.
13
+ if (typeof options.version !== 'string' || options.version === '') {
14
+ throw new TypeError("startRpcServer needs this plugin's package version");
15
+ }
10
16
  const parseApply = (value) => {
11
17
  const request = options.parseApplyRequest(value);
12
18
  if (request === undefined) {
@@ -28,6 +34,25 @@ export async function startRpcServer(options) {
28
34
  // Use only the asynchronous overload, including for synchronous producers.
29
35
  drainAsync: (async (cursor, session) => Promise.resolve(options.drain(cursor, session))),
30
36
  });
37
+ try {
38
+ // The shared server publishes `port-<pid>.json` without a version. Another
39
+ // process deciding whether it may move the vault files out of OpenCode's
40
+ // config folder (`version-fence.ts`) treats a live port file without a
41
+ // current version as an older plugin and waits. Replace the record with
42
+ // one that names this plugin's version before returning; if that fails,
43
+ // stop the server rather than leave an unversioned record behind.
44
+ const versioned = {
45
+ port: server.port,
46
+ token: server.token,
47
+ pid: process.pid,
48
+ version: options.version,
49
+ };
50
+ await writePortFile(options.dir, versioned, { secureDir: true });
51
+ }
52
+ catch (error) {
53
+ await server.stop().catch(() => { });
54
+ throw error;
55
+ }
31
56
  let stopping;
32
57
  return {
33
58
  port: server.port,
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-server.js","sourceRoot":"","sources":["../../../src/rpc/rpc-server.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEf,cAAc,IAAI,oBAAoB,GACvC,MAAM,sCAAsC,CAAA;AA0C7C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B;IAE9B,yEAAyE;IACzE,yEAAyE;IACzE,uEAAuE;IACvE,mDAAmD;IACnD,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QACpD,MAAM,IAAI,SAAS,CACjB,6EAA6E,CAC9E,CAAA;IACH,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,KAAc,EAAuB,EAAE;QACzD,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAChD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,eAAe,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAA;QACzD,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;QACxC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,SAAS,EAAE,IAAI;QACf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AED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAIlC,IACE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChB,OAAO,KAAK,CAAC,cAAc,KAAK,QAAQ;QACxC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC;QAC3C,KAAK,CAAC,cAAc,GAAG,CAAC;QACxB,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC,EACtE,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,GAAG,EAAE,uCAAuC,CAAC,CAAA;IACzE,CAAC;IACD,OAAO;QACL,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;KACzE,CAAA;AACH,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { type RuntimeLayout } from './runtime-paths.js';
2
+ import { type VersionFenceResult } from './version-fence.js';
3
+ export type { RuntimeLayout };
4
+ /** Name of the lock held while a process decides or moves the layout. */
5
+ export declare const RUNTIME_LAYOUT_LOCK_NAME = "runtime-layout";
6
+ /** Lists the copies an unfinished move has put in the state-home folder. */
7
+ export declare const RUNTIME_LAYOUT_MANIFEST_FILE = "layout-moving.json";
8
+ /**
9
+ * The enrollment state file. A move leaves it in the old folder when it keeps
10
+ * the host in vault mode without its token (approved, or blocked because the
11
+ * token is missing).
12
+ */
13
+ export declare const VAULT_ENROLLMENT_STATE_FILE = "opencode-enrollment-state.json";
14
+ /**
15
+ * The vault files that move, and the only ones the move ever reads, copies,
16
+ * compares or removes in either vault folder. Anything else there (Pi's
17
+ * files, when Pi's account file points into OpenCode's config folder, or a
18
+ * file a later library version adds) is left alone; a new vault file has to
19
+ * be added here on purpose.
20
+ */
21
+ export declare const VAULT_FILE_NAMES: readonly ["opencode-enrollment.json", "opencode-enrollment-state.json", "opencode-roster.json", "opencode-state.json", "opencode-mode.json"];
22
+ /** The message logged once by a process that keeps the legacy layout. */
23
+ export declare const RUNTIME_LAYOUT_DEFERRED_MESSAGE = "antigravity-auth keeps its vault files in OpenCode's config folder until every running OpenCode using it has restarted on this version.";
24
+ /**
25
+ * Plugin start stops when it cannot settle a safe layout: it could not take
26
+ * the layout lock or write its heartbeat (so other processes could not see
27
+ * which files it uses), could not trust the marker, found conflicting vault
28
+ * files, or found a state-home folder owned by another config folder.
29
+ */
30
+ export declare class RuntimeLayoutRefusal extends Error {
31
+ readonly stateDir: string;
32
+ readonly errorClass: string;
33
+ constructor(stateDir: string, errorClass: string, message?: string);
34
+ }
35
+ export interface RuntimeLayoutLogger {
36
+ info(message: string, meta?: Record<string, unknown>): unknown;
37
+ warn(message: string, meta?: Record<string, unknown>): unknown;
38
+ }
39
+ export interface RuntimeLayoutOptions {
40
+ /** This build's version, for the version fence. */
41
+ version: string;
42
+ log?: RuntimeLayoutLogger;
43
+ /**
44
+ * The account file a legacy-layout process of this config folder uses;
45
+ * the old vault folder is beside it. Defaults to `legacyAccountFile()`.
46
+ */
47
+ accountFile?: string;
48
+ /** Defaults to `versionFenceOpen` for `version`, with the layout checks. */
49
+ fence?: () => Promise<VersionFenceResult>;
50
+ /**
51
+ * Whether an existing destination vault folder may be written into.
52
+ * Defaults to the private-files check on Windows (a folder this module did
53
+ * not create is never repaired) and to true elsewhere, where the move sets
54
+ * the folder to 0700 itself.
55
+ */
56
+ destinationPrivate?: (dir: string) => Promise<boolean>;
57
+ /**
58
+ * Test seams, run at one step of the move. A step that throws stands in for
59
+ * a crash there: nothing after it runs.
60
+ */
61
+ steps?: {
62
+ afterManifest?: () => void | Promise<void>;
63
+ afterCopy?: () => void | Promise<void>;
64
+ afterMarker?: () => void | Promise<void>;
65
+ /**
66
+ * Runs right before each removal of an old file, of the move's
67
+ * `layout-moving.json` and of the old vault folder, ahead of the lease
68
+ * check that guards it.
69
+ */
70
+ beforeRemove?: (path: string) => void | Promise<void>;
71
+ };
72
+ /** Test seam: how long to wait for the layout lock. */
73
+ layoutLockWaitMs?: number;
74
+ /**
75
+ * The signature cache file older versions wrote in OpenCode's config
76
+ * folder. Defaults to `legacySignatureCacheFile()`.
77
+ */
78
+ oldSignatureCacheFile?: string;
79
+ }
80
+ /** Test seam: forget this process's runs and log lines. */
81
+ export declare function __resetRuntimeLayoutRunsForTest(): void;
82
+ /**
83
+ * Decide, once per process, where this config folder's vault files live,
84
+ * moving them first when that is safe. Call at plugin start before anything
85
+ * resolves a vault path. Resolves to the layout `getVaultDir()` in
86
+ * `runtime-paths.ts` now uses; rejects with `RuntimeLayoutRefusal` when the
87
+ * plugin must not start.
88
+ */
89
+ export declare function prepareRuntimeLayout(options: RuntimeLayoutOptions): Promise<RuntimeLayout>;
90
+ /**
91
+ * After Disconnect, remove the enrollment state file a move left in the old
92
+ * vault folder, so an older version no longer reads this host as enrolled.
93
+ * Acts only for this config folder's state-home vault folder (`vaultDir`), and
94
+ * only on a vault-shaped leftover of this plugin's enrollment
95
+ * (`isVaultShapedKeptState`); any other file there stays. The emptied old
96
+ * vault folder goes too. `accountFile` is the one the move was given
97
+ * (`RuntimeLayoutOptions.accountFile`).
98
+ */
99
+ export declare function removeMovedVaultStateLeftover(vaultDir: string, accountFile?: string): Promise<void>;
100
+ //# sourceMappingURL=runtime-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-layout.d.ts","sourceRoot":"","sources":["../../src/runtime-layout.ts"],"names":[],"mappings":"AAqHA,OAAO,EAOL,KAAK,aAAa,EAKnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,iBAA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