@cortexkit/opencode-antigravity-auth 3.1.7 → 3.1.9

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 (136) hide show
  1. package/dist/cli.js +182 -193
  2. package/dist/cli.js.map +4 -4
  3. package/dist/cli.meta.json +83 -54
  4. package/dist/index.js +6886 -6346
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +475 -387
  7. package/dist/server.js +3056 -2446
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/claustrum/availability.js +1 -1
  11. package/dist/src/common-auth-embedded/claustrum/custody.js +1 -1
  12. package/dist/src/common-auth-embedded/fs/private-files.js +14 -5
  13. package/dist/src/common-auth-embedded/opencode2/index.d.ts +1 -1
  14. package/dist/src/common-auth-embedded/opencode2/index.js +1 -1
  15. package/dist/src/common-auth-embedded/opencode2/install.d.ts +6 -1
  16. package/dist/src/common-auth-embedded/opencode2/install.js +14 -4
  17. package/dist/src/common-auth-embedded/opencode2/types.d.ts +10 -7
  18. package/dist/src/common-auth-embedded/pi-slot/index.d.ts +1 -1
  19. package/dist/src/common-auth-embedded/pi-slot/index.js +1 -1
  20. package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +6 -9
  21. package/dist/src/common-auth-embedded/pi-slot/slot.js +42 -105
  22. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
  23. package/dist/src/common-auth-embedded/routing-accessor/index.js +123 -17
  24. package/dist/src/common-auth-embedded/rpc/index.d.ts +1 -1
  25. package/dist/src/common-auth-embedded/rpc/index.js +1 -1
  26. package/dist/src/common-auth-embedded/rpc/port-file.d.ts +4 -0
  27. package/dist/src/common-auth-embedded/rpc/port-file.js +55 -49
  28. package/dist/src/common-auth-embedded/rpc/rpc-server.js +3 -2
  29. package/dist/src/common-auth-embedded/rpc/startup-sweep.js +32 -0
  30. package/dist/src/common-auth-embedded/source-output.json +77 -68
  31. package/dist/src/common-auth-embedded/store/mutate.js +34 -13
  32. package/dist/src/ga/server/index.d.ts +1 -1
  33. package/dist/src/ga/server/index.d.ts.map +1 -1
  34. package/dist/src/ga/server/index.js +58 -19
  35. package/dist/src/ga/server/index.js.map +1 -1
  36. package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
  37. package/dist/src/plugin/__fixtures__/verified-store.js +3 -3
  38. package/dist/src/plugin/auth-loader.d.ts.map +1 -1
  39. package/dist/src/plugin/auth-loader.js +102 -80
  40. package/dist/src/plugin/auth-loader.js.map +1 -1
  41. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  42. package/dist/src/plugin/fetch-interceptor.js +27 -13
  43. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  44. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  45. package/dist/src/plugin/ga-location-services.js +21 -11
  46. package/dist/src/plugin/ga-location-services.js.map +1 -1
  47. package/dist/src/plugin/index.d.ts.map +1 -1
  48. package/dist/src/plugin/index.js +13 -5
  49. package/dist/src/plugin/index.js.map +1 -1
  50. package/dist/src/plugin/request.d.ts.map +1 -1
  51. package/dist/src/plugin/request.js +2 -2
  52. package/dist/src/plugin/request.js.map +1 -1
  53. package/dist/src/plugin/shared/opencode-retry-hints.d.ts +2 -0
  54. package/dist/src/plugin/shared/opencode-retry-hints.d.ts.map +1 -0
  55. package/dist/src/plugin/shared/opencode-retry-hints.js +22 -0
  56. package/dist/src/plugin/shared/opencode-retry-hints.js.map +1 -0
  57. package/dist/src/plugin/shared/request-services.d.ts +2 -0
  58. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  59. package/dist/src/plugin/shared/request-services.js +410 -112
  60. package/dist/src/plugin/shared/request-services.js.map +1 -1
  61. package/dist/src/plugin/shared/vault-routing-purpose.d.ts +6 -2
  62. package/dist/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -1
  63. package/dist/src/plugin/shared/vault-routing-purpose.js +13 -7
  64. package/dist/src/plugin/shared/vault-routing-purpose.js.map +1 -1
  65. package/dist/src/plugin/shared/vault-routing.d.ts +8 -1
  66. package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -1
  67. package/dist/src/plugin/shared/vault-routing.js +12 -4
  68. package/dist/src/plugin/shared/vault-routing.js.map +1 -1
  69. package/dist/src/plugin/storage.d.ts +1 -0
  70. package/dist/src/plugin/storage.d.ts.map +1 -1
  71. package/dist/src/plugin/storage.js +3 -3
  72. package/dist/src/plugin/storage.js.map +1 -1
  73. package/dist/src/plugin/vault-custody.d.ts +6 -13
  74. package/dist/src/plugin/vault-custody.d.ts.map +1 -1
  75. package/dist/src/plugin/vault-custody.js +19 -16
  76. package/dist/src/plugin/vault-custody.js.map +1 -1
  77. package/dist/src/runtime-layout.d.ts.map +1 -1
  78. package/dist/src/runtime-layout.js +5 -2
  79. package/dist/src/runtime-layout.js.map +1 -1
  80. package/dist/src/setup.d.ts.map +1 -1
  81. package/dist/src/setup.js +2 -7
  82. package/dist/src/setup.js.map +1 -1
  83. package/dist/tui-build-map.json +9 -9
  84. package/dist/tui-ga-build-map.json +1 -1
  85. package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +1 -1
  86. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +6 -1
  87. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +10 -7
  88. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
  89. package/dist/types/src/ga/server/index.d.ts +1 -1
  90. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  91. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
  92. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
  93. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  94. package/dist/types/src/plugin/index.d.ts.map +1 -1
  95. package/dist/types/src/plugin/request.d.ts.map +1 -1
  96. package/dist/types/src/plugin/shared/opencode-retry-hints.d.ts +2 -0
  97. package/dist/types/src/plugin/shared/opencode-retry-hints.d.ts.map +1 -0
  98. package/dist/types/src/plugin/shared/request-services.d.ts +2 -0
  99. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  100. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts +6 -2
  101. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -1
  102. package/dist/types/src/plugin/shared/vault-routing.d.ts +8 -1
  103. package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -1
  104. package/dist/types/src/plugin/storage.d.ts +1 -0
  105. package/dist/types/src/plugin/storage.d.ts.map +1 -1
  106. package/dist/types/src/plugin/vault-custody.d.ts +6 -13
  107. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
  108. package/dist/types/src/runtime-layout.d.ts.map +1 -1
  109. package/dist/types/src/setup.d.ts.map +1 -1
  110. package/package.json +2 -2
  111. package/src/common-auth-embedded/claustrum/availability.js +1 -1
  112. package/src/common-auth-embedded/claustrum/custody.js +1 -1
  113. package/src/common-auth-embedded/fs/private-files.js +14 -5
  114. package/src/common-auth-embedded/opencode2/index.d.ts +1 -1
  115. package/src/common-auth-embedded/opencode2/index.js +1 -1
  116. package/src/common-auth-embedded/opencode2/install.d.ts +6 -1
  117. package/src/common-auth-embedded/opencode2/install.js +14 -4
  118. package/src/common-auth-embedded/opencode2/types.d.ts +10 -7
  119. package/src/common-auth-embedded/pi-slot/index.d.ts +1 -1
  120. package/src/common-auth-embedded/pi-slot/index.js +1 -1
  121. package/src/common-auth-embedded/pi-slot/slot.d.ts +6 -9
  122. package/src/common-auth-embedded/pi-slot/slot.js +42 -105
  123. package/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
  124. package/src/common-auth-embedded/routing-accessor/index.js +123 -17
  125. package/src/common-auth-embedded/rpc/index.d.ts +1 -1
  126. package/src/common-auth-embedded/rpc/index.js +1 -1
  127. package/src/common-auth-embedded/rpc/port-file.d.ts +4 -0
  128. package/src/common-auth-embedded/rpc/port-file.js +55 -49
  129. package/src/common-auth-embedded/rpc/rpc-server.js +3 -2
  130. package/src/common-auth-embedded/rpc/startup-sweep.js +32 -0
  131. package/src/common-auth-embedded/source-output.json +77 -68
  132. package/src/common-auth-embedded/store/mutate.js +34 -13
  133. package/src/tui-compiled/common-auth-embedded/fs/private-files.js +14 -5
  134. package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +55 -49
  135. package/src/tui-raw/common-auth-embedded/fs/private-files.js +14 -5
  136. package/src/tui-raw/common-auth-embedded/rpc/port-file.js +55 -49
@@ -94,9 +94,8 @@ async function removeCorruptPortFile(portFile, log) {
94
94
  export async function writePortFile(dir, entry, options = {}) {
95
95
  // The directory can be removed by another project's sweep between our
96
96
  // mkdir and the first open/rename, so the whole create-then-rename
97
- // unit is retried once on ENOENT. The retry recreates the directory; a
98
- // persistent ENOENT (e.g. permission, read-only parent) will surface on
99
- // the second attempt — failing fast beats an unbounded loop.
97
+ // unit gets up to five attempts on ENOENT. Each retry recreates the
98
+ // directory after a short delay, but persistent removal still surfaces.
100
99
  const writeOnce = async () => {
101
100
  const target = join(dir, `port-${entry.pid}.json`);
102
101
  if (windowsPrivateFiles) {
@@ -136,14 +135,15 @@ export async function writePortFile(dir, entry, options = {}) {
136
135
  }
137
136
  return target;
138
137
  };
139
- try {
140
- return await writeOnce();
141
- }
142
- catch (error) {
143
- if (error.code === 'ENOENT') {
138
+ for (let attempt = 1;; attempt += 1) {
139
+ try {
144
140
  return await writeOnce();
145
141
  }
146
- throw error;
142
+ catch (error) {
143
+ if (error.code !== 'ENOENT' || attempt === 5)
144
+ throw error;
145
+ await new Promise((resolve) => setTimeout(resolve, 25));
146
+ }
147
147
  }
148
148
  }
149
149
  export async function sweepRpcState(root, activeDir, isManagedDir, log, options = {}) {
@@ -163,52 +163,58 @@ export async function sweepRpcState(root, activeDir, isManagedDir, log, options
163
163
  continue;
164
164
  }
165
165
  const dir = join(root, projectDir.name);
166
- let names;
166
+ if (!(await sweepRpcDirectory(dir, log, options, cutoff)))
167
+ continue;
168
+ if (resolve(dir) !== active)
169
+ await rmdir(dir).catch(() => { });
170
+ }
171
+ }
172
+ /** Internal folder cleanup shared by full and throttled startup sweeps. */
173
+ export async function sweepRpcDirectory(dir, log, options = {}, cutoff = staleBefore(options)) {
174
+ let names;
175
+ try {
176
+ names = await readdir(dir);
177
+ }
178
+ catch (error) {
179
+ if (error.code === 'ENOENT')
180
+ return false;
181
+ throw error;
182
+ }
183
+ for (const name of names) {
184
+ if (!name.startsWith('port-') || !name.endsWith('.json'))
185
+ continue;
186
+ const portFile = join(dir, name);
187
+ const info = await stat(portFile).catch(() => undefined);
188
+ let raw;
167
189
  try {
168
- names = await readdir(dir);
190
+ raw = await readPrivateText(portFile);
169
191
  }
170
192
  catch (error) {
171
- if (error.code === 'ENOENT')
172
- continue;
173
- throw error;
193
+ if (error instanceof PrivateFileError && error.code !== 'ENOENT')
194
+ throw error;
195
+ continue;
174
196
  }
175
- for (const name of names) {
176
- if (!name.startsWith('port-') || !name.endsWith('.json'))
177
- continue;
178
- const portFile = join(dir, name);
179
- const info = await stat(portFile).catch(() => undefined);
180
- let raw;
181
- try {
182
- raw = await readPrivateText(portFile);
183
- }
184
- catch (error) {
185
- if (error instanceof PrivateFileError && error.code !== 'ENOENT')
186
- throw error;
187
- continue;
188
- }
189
- if (raw === undefined)
190
- continue;
191
- let parsed;
192
- try {
193
- parsed = JSON.parse(raw);
194
- }
195
- catch {
196
- await removeCorruptPortFile(portFile, log);
197
- continue;
198
- }
199
- if (!isUsablePortFileEntry(parsed, name)) {
200
- await removeCorruptPortFile(portFile, log);
201
- continue;
202
- }
203
- const entry = parsed;
204
- if (!pidAlive(entry.pid))
205
- await unlink(portFile).catch(() => { });
206
- else if (isStalePortFile(entry, info, cutoff))
207
- await removeStalePortFile(portFile, raw, info, options.beforeRemove);
197
+ if (raw === undefined)
198
+ continue;
199
+ let parsed;
200
+ try {
201
+ parsed = JSON.parse(raw);
208
202
  }
209
- if (resolve(dir) !== active)
210
- await rmdir(dir).catch(() => { });
203
+ catch {
204
+ await removeCorruptPortFile(portFile, log);
205
+ continue;
206
+ }
207
+ if (!isUsablePortFileEntry(parsed, name)) {
208
+ await removeCorruptPortFile(portFile, log);
209
+ continue;
210
+ }
211
+ const entry = parsed;
212
+ if (!pidAlive(entry.pid))
213
+ await unlink(portFile).catch(() => { });
214
+ else if (isStalePortFile(entry, info, cutoff))
215
+ await removeStalePortFile(portFile, raw, info, options.beforeRemove);
211
216
  }
217
+ return true;
212
218
  }
213
219
  /** Internal cache validation: probe only the selected file and its PID. */
214
220
  export async function portFileIdentity(dir, entry, options = {}) {