@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.
- package/dist/cli.js +182 -193
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +83 -54
- package/dist/index.js +6886 -6346
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +475 -387
- package/dist/server.js +3056 -2446
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/availability.js +1 -1
- package/dist/src/common-auth-embedded/claustrum/custody.js +1 -1
- package/dist/src/common-auth-embedded/fs/private-files.js +14 -5
- package/dist/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/opencode2/index.js +1 -1
- package/dist/src/common-auth-embedded/opencode2/install.d.ts +6 -1
- package/dist/src/common-auth-embedded/opencode2/install.js +14 -4
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +10 -7
- package/dist/src/common-auth-embedded/pi-slot/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/pi-slot/index.js +1 -1
- package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +6 -9
- package/dist/src/common-auth-embedded/pi-slot/slot.js +42 -105
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
- package/dist/src/common-auth-embedded/routing-accessor/index.js +123 -17
- package/dist/src/common-auth-embedded/rpc/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/rpc/index.js +1 -1
- package/dist/src/common-auth-embedded/rpc/port-file.d.ts +4 -0
- package/dist/src/common-auth-embedded/rpc/port-file.js +55 -49
- package/dist/src/common-auth-embedded/rpc/rpc-server.js +3 -2
- package/dist/src/common-auth-embedded/rpc/startup-sweep.js +32 -0
- package/dist/src/common-auth-embedded/source-output.json +77 -68
- package/dist/src/common-auth-embedded/store/mutate.js +34 -13
- package/dist/src/ga/server/index.d.ts +1 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +58 -19
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +3 -3
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +102 -80
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +27 -13
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +21 -11
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +13 -5
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +2 -2
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/opencode-retry-hints.d.ts +2 -0
- package/dist/src/plugin/shared/opencode-retry-hints.d.ts.map +1 -0
- package/dist/src/plugin/shared/opencode-retry-hints.js +22 -0
- package/dist/src/plugin/shared/opencode-retry-hints.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +2 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +410 -112
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-routing-purpose.d.ts +6 -2
- package/dist/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-routing-purpose.js +13 -7
- package/dist/src/plugin/shared/vault-routing-purpose.js.map +1 -1
- package/dist/src/plugin/shared/vault-routing.d.ts +8 -1
- package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-routing.js +12 -4
- package/dist/src/plugin/shared/vault-routing.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +1 -0
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +3 -3
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts +6 -13
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +19 -16
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/runtime-layout.d.ts.map +1 -1
- package/dist/src/runtime-layout.js +5 -2
- package/dist/src/runtime-layout.js.map +1 -1
- package/dist/src/setup.d.ts.map +1 -1
- package/dist/src/setup.js +2 -7
- package/dist/src/setup.js.map +1 -1
- package/dist/tui-build-map.json +9 -9
- package/dist/tui-ga-build-map.json +1 -1
- package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +6 -1
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +10 -7
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
- package/dist/types/src/ga/server/index.d.ts +1 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/opencode-retry-hints.d.ts +2 -0
- package/dist/types/src/plugin/shared/opencode-retry-hints.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +2 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts +6 -2
- package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts +8 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +1 -0
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts +6 -13
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/runtime-layout.d.ts.map +1 -1
- package/dist/types/src/setup.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/claustrum/availability.js +1 -1
- package/src/common-auth-embedded/claustrum/custody.js +1 -1
- package/src/common-auth-embedded/fs/private-files.js +14 -5
- package/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/src/common-auth-embedded/opencode2/index.js +1 -1
- package/src/common-auth-embedded/opencode2/install.d.ts +6 -1
- package/src/common-auth-embedded/opencode2/install.js +14 -4
- package/src/common-auth-embedded/opencode2/types.d.ts +10 -7
- package/src/common-auth-embedded/pi-slot/index.d.ts +1 -1
- package/src/common-auth-embedded/pi-slot/index.js +1 -1
- package/src/common-auth-embedded/pi-slot/slot.d.ts +6 -9
- package/src/common-auth-embedded/pi-slot/slot.js +42 -105
- package/src/common-auth-embedded/routing-accessor/index.d.ts +66 -16
- package/src/common-auth-embedded/routing-accessor/index.js +123 -17
- package/src/common-auth-embedded/rpc/index.d.ts +1 -1
- package/src/common-auth-embedded/rpc/index.js +1 -1
- package/src/common-auth-embedded/rpc/port-file.d.ts +4 -0
- package/src/common-auth-embedded/rpc/port-file.js +55 -49
- package/src/common-auth-embedded/rpc/rpc-server.js +3 -2
- package/src/common-auth-embedded/rpc/startup-sweep.js +32 -0
- package/src/common-auth-embedded/source-output.json +77 -68
- package/src/common-auth-embedded/store/mutate.js +34 -13
- package/src/tui-compiled/common-auth-embedded/fs/private-files.js +14 -5
- package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +55 -49
- package/src/tui-raw/common-auth-embedded/fs/private-files.js +14 -5
- 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
|
|
98
|
-
//
|
|
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
|
-
|
|
140
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
190
|
+
raw = await readPrivateText(portFile);
|
|
169
191
|
}
|
|
170
192
|
catch (error) {
|
|
171
|
-
if (error.code
|
|
172
|
-
|
|
173
|
-
|
|
193
|
+
if (error instanceof PrivateFileError && error.code !== 'ENOENT')
|
|
194
|
+
throw error;
|
|
195
|
+
continue;
|
|
174
196
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
210
|
-
await
|
|
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 = {}) {
|