@cortexkit/opencode-antigravity-auth 3.0.19 → 3.0.21
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/README.md +3 -1
- package/dist/cli.js +277 -150
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +43 -23
- package/dist/index.js +331 -204
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +43 -23
- package/dist/server.js +344 -217
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +10 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.js +25 -0
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +6 -2
- package/dist/src/common-auth-embedded/claustrum/custody.js +45 -6
- package/dist/src/common-auth-embedded/claustrum/hub.d.ts +3 -1
- package/dist/src/common-auth-embedded/claustrum/hub.js +75 -6
- package/dist/src/common-auth-embedded/claustrum/insula.js +6 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +1 -1
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +2 -1
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +3 -1
- package/dist/src/common-auth-embedded/fs/with-lock.js +1 -1
- package/dist/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/opencode2/install.d.ts +4 -3
- package/dist/src/common-auth-embedded/opencode2/install.js +144 -17
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +52 -1
- package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
- package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
- package/dist/src/common-auth-embedded/source-output.json +73 -53
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +2 -3
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/server.d.ts +4 -4
- package/dist/src/server.js +4 -4
- package/dist/src/tui/quota-layout.d.ts +4 -58
- package/dist/src/tui/quota-layout.d.ts.map +1 -1
- package/dist/src/tui/quota-layout.js +4 -90
- package/dist/src/tui/quota-layout.js.map +1 -1
- package/dist/src/tui/sidebar-frame.d.ts +4 -35
- package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
- package/dist/src/tui/sidebar-frame.js +91 -171
- package/dist/src/tui/sidebar-frame.js.map +1 -1
- package/dist/src/tui.js +3 -3
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +27 -13
- package/dist/tui-ga-build-map.json +28 -13
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +10 -0
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +6 -2
- package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +3 -1
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +2 -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 +4 -3
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +52 -1
- package/dist/types/src/server.d.ts +4 -4
- package/package.json +3 -3
- package/src/common-auth-embedded/claustrum/consumer.d.ts +10 -0
- package/src/common-auth-embedded/claustrum/consumer.js +25 -0
- package/src/common-auth-embedded/claustrum/custody.d.ts +6 -2
- package/src/common-auth-embedded/claustrum/custody.js +45 -6
- package/src/common-auth-embedded/claustrum/hub.d.ts +3 -1
- package/src/common-auth-embedded/claustrum/hub.js +75 -6
- package/src/common-auth-embedded/claustrum/insula.js +6 -0
- package/src/common-auth-embedded/claustrum/roster.js +1 -1
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +2 -1
- package/src/common-auth-embedded/fs/refresh-file-lock.js +3 -1
- package/src/common-auth-embedded/fs/with-lock.js +1 -1
- package/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/src/common-auth-embedded/opencode2/install.d.ts +4 -3
- package/src/common-auth-embedded/opencode2/install.js +144 -17
- package/src/common-auth-embedded/opencode2/types.d.ts +52 -1
- package/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
- package/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
- package/src/common-auth-embedded/source-output.json +73 -53
- package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +666 -0
- package/src/tui-compiled/tui/quota-layout.js +5 -330
- package/src/tui-compiled/tui/sidebar-frame.js +241 -503
- package/src/tui-compiled/tui.js +3 -3
- package/src/tui-ga-compiled/host-ga.js +2 -3
- package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +241 -503
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +5 -330
- package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +666 -0
- package/src/tui-ga-raw/host-ga.tsx +2 -3
- package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +209 -419
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +10 -301
- package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +630 -0
- package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +630 -0
- package/src/tui-raw/tui/quota-layout.tsx +10 -301
- package/src/tui-raw/tui/sidebar-frame.tsx +209 -419
- package/src/tui-raw/tui.tsx +3 -3
- package/src/tui.tsx +3 -3
package/dist/server.js
CHANGED
|
@@ -7751,7 +7751,7 @@ async function rmEvictingDir(evictingPath) {
|
|
|
7751
7751
|
});
|
|
7752
7752
|
}
|
|
7753
7753
|
async function sleep(ms) {
|
|
7754
|
-
await new Promise((
|
|
7754
|
+
await new Promise((resolve27) => setTimeout(resolve27, ms));
|
|
7755
7755
|
}
|
|
7756
7756
|
async function acquireFencedFileLock(options) {
|
|
7757
7757
|
const lockPath = `${options.path}.${options.name}.lock`;
|
|
@@ -7867,8 +7867,8 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
7867
7867
|
let released = false;
|
|
7868
7868
|
let lost = false;
|
|
7869
7869
|
let lostResolve = null;
|
|
7870
|
-
let lostPromise = new Promise((
|
|
7871
|
-
lostResolve =
|
|
7870
|
+
let lostPromise = new Promise((resolve27) => {
|
|
7871
|
+
lostResolve = resolve27;
|
|
7872
7872
|
});
|
|
7873
7873
|
const markLost = () => {
|
|
7874
7874
|
if (lost)
|
|
@@ -7878,9 +7878,9 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
7878
7878
|
clearInterval(renewTimer);
|
|
7879
7879
|
renewTimer = null;
|
|
7880
7880
|
}
|
|
7881
|
-
const
|
|
7881
|
+
const resolve27 = lostResolve;
|
|
7882
7882
|
lostResolve = null;
|
|
7883
|
-
|
|
7883
|
+
resolve27?.();
|
|
7884
7884
|
};
|
|
7885
7885
|
const setupRenew = () => {
|
|
7886
7886
|
if (options.renew === false)
|
|
@@ -8503,7 +8503,7 @@ async function saveAccountStorageReplace(path5, incoming) {
|
|
|
8503
8503
|
return mutateAccountStorage(path5, () => incoming);
|
|
8504
8504
|
}
|
|
8505
8505
|
async function clearAccountStorage(path5) {
|
|
8506
|
-
const sleep5 = (ms) => new Promise((
|
|
8506
|
+
const sleep5 = (ms) => new Promise((resolve27) => setTimeout(resolve27, ms));
|
|
8507
8507
|
const lock = await acquireWithRetry(path5, sleep5);
|
|
8508
8508
|
try {
|
|
8509
8509
|
await assertLegacyAccountStorageWritable(path5);
|
|
@@ -8551,7 +8551,7 @@ var init_account_storage = __esm({
|
|
|
8551
8551
|
}
|
|
8552
8552
|
};
|
|
8553
8553
|
RETRY_DELAYS_MS = [100, 200, 400, 800, 1e3];
|
|
8554
|
-
DEFAULT_SLEEP = (ms) => new Promise((
|
|
8554
|
+
DEFAULT_SLEEP = (ms) => new Promise((resolve27) => setTimeout(resolve27, ms));
|
|
8555
8555
|
DEFAULT_BUILD_BACKUP_PATH = (path5, now) => `${path5}.corrupt-${now.toISOString().replace(/[:.]/g, "-")}`;
|
|
8556
8556
|
}
|
|
8557
8557
|
});
|
|
@@ -9753,8 +9753,8 @@ var init_account_manager = __esm({
|
|
|
9753
9753
|
await this.saveInFlight;
|
|
9754
9754
|
return;
|
|
9755
9755
|
}
|
|
9756
|
-
return new Promise((
|
|
9757
|
-
this.savePromiseResolvers.push({ resolve:
|
|
9756
|
+
return new Promise((resolve27, reject) => {
|
|
9757
|
+
this.savePromiseResolvers.push({ resolve: resolve27, reject });
|
|
9758
9758
|
});
|
|
9759
9759
|
}
|
|
9760
9760
|
async dispose() {
|
|
@@ -9797,8 +9797,8 @@ var init_account_manager = __esm({
|
|
|
9797
9797
|
reject(error);
|
|
9798
9798
|
throw error;
|
|
9799
9799
|
}
|
|
9800
|
-
for (const { resolve:
|
|
9801
|
-
|
|
9800
|
+
for (const { resolve: resolve27 } of resolvers)
|
|
9801
|
+
resolve27();
|
|
9802
9802
|
}
|
|
9803
9803
|
async executeSave() {
|
|
9804
9804
|
this.savePending = false;
|
|
@@ -9812,16 +9812,16 @@ var init_account_manager = __esm({
|
|
|
9812
9812
|
}
|
|
9813
9813
|
try {
|
|
9814
9814
|
await this.saveToDisk();
|
|
9815
|
-
for (const { resolve:
|
|
9816
|
-
|
|
9815
|
+
for (const { resolve: resolve27 } of resolvers) {
|
|
9816
|
+
resolve27();
|
|
9817
9817
|
}
|
|
9818
9818
|
} catch (error) {
|
|
9819
9819
|
if (isStorageLockContention(error)) {
|
|
9820
9820
|
this.onDiagnostic?.("Skipped account-state persist due to storage lock contention", {
|
|
9821
9821
|
error: String(error)
|
|
9822
9822
|
});
|
|
9823
|
-
for (const { resolve:
|
|
9824
|
-
|
|
9823
|
+
for (const { resolve: resolve27 } of resolvers) {
|
|
9824
|
+
resolve27();
|
|
9825
9825
|
}
|
|
9826
9826
|
return;
|
|
9827
9827
|
}
|
|
@@ -10310,7 +10310,7 @@ function getHttpsProxy(url) {
|
|
|
10310
10310
|
}
|
|
10311
10311
|
}
|
|
10312
10312
|
function waitForHead(socket, timeoutMs, onTimeout) {
|
|
10313
|
-
return new Promise((
|
|
10313
|
+
return new Promise((resolve27, reject) => {
|
|
10314
10314
|
let buffer = Buffer3.alloc(0);
|
|
10315
10315
|
const timeout = setTimeout(() => {
|
|
10316
10316
|
onTimeout();
|
|
@@ -10333,7 +10333,7 @@ function waitForHead(socket, timeoutMs, onTimeout) {
|
|
|
10333
10333
|
return;
|
|
10334
10334
|
const head = buffer.subarray(0, marker).toString("latin1");
|
|
10335
10335
|
const leftover = buffer.subarray(marker + 4);
|
|
10336
|
-
cleanup2(() =>
|
|
10336
|
+
cleanup2(() => resolve27({ head, leftover }));
|
|
10337
10337
|
};
|
|
10338
10338
|
socket.on("data", onData);
|
|
10339
10339
|
socket.once("error", onError);
|
|
@@ -10347,7 +10347,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
10347
10347
|
port: Number(proxyUrl.port || DEFAULT_PROXY_PORT),
|
|
10348
10348
|
signal: signal ?? void 0
|
|
10349
10349
|
});
|
|
10350
|
-
await new Promise((
|
|
10350
|
+
await new Promise((resolve27, reject) => {
|
|
10351
10351
|
const timeout = setTimeout(() => {
|
|
10352
10352
|
onDebug?.(`agy transport proxy connect timeout after ${timeoutMs}ms`);
|
|
10353
10353
|
proxySocket.destroy();
|
|
@@ -10356,7 +10356,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
10356
10356
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10357
10357
|
proxySocket.once("connect", () => {
|
|
10358
10358
|
cleanup2();
|
|
10359
|
-
|
|
10359
|
+
resolve27();
|
|
10360
10360
|
});
|
|
10361
10361
|
proxySocket.once("error", (error) => {
|
|
10362
10362
|
cleanup2();
|
|
@@ -10381,7 +10381,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10381
10381
|
if (leftover.length > 0) {
|
|
10382
10382
|
proxySocket.unshift(leftover);
|
|
10383
10383
|
}
|
|
10384
|
-
return await new Promise((
|
|
10384
|
+
return await new Promise((resolve27, reject) => {
|
|
10385
10385
|
const tlsOptions = {
|
|
10386
10386
|
socket: proxySocket,
|
|
10387
10387
|
servername: targetHost,
|
|
@@ -10396,7 +10396,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10396
10396
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10397
10397
|
tlsSocket.once("secureConnect", () => {
|
|
10398
10398
|
cleanup2();
|
|
10399
|
-
|
|
10399
|
+
resolve27(tlsSocket);
|
|
10400
10400
|
});
|
|
10401
10401
|
tlsSocket.once("error", (error) => {
|
|
10402
10402
|
cleanup2();
|
|
@@ -10405,7 +10405,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10405
10405
|
});
|
|
10406
10406
|
}
|
|
10407
10407
|
async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
10408
|
-
return await new Promise((
|
|
10408
|
+
return await new Promise((resolve27, reject) => {
|
|
10409
10409
|
const tlsOptions = {
|
|
10410
10410
|
host: targetUrl.hostname,
|
|
10411
10411
|
port: Number(targetUrl.port || DEFAULT_HTTPS_PORT),
|
|
@@ -10421,7 +10421,7 @@ async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
|
10421
10421
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10422
10422
|
socket.once("secureConnect", () => {
|
|
10423
10423
|
cleanup2();
|
|
10424
|
-
|
|
10424
|
+
resolve27(socket);
|
|
10425
10425
|
});
|
|
10426
10426
|
socket.once("error", (error) => {
|
|
10427
10427
|
cleanup2();
|
|
@@ -12494,8 +12494,8 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
12494
12494
|
let releaseConfirmed = false;
|
|
12495
12495
|
let loss;
|
|
12496
12496
|
let resolveLoss;
|
|
12497
|
-
const lostPromise = new Promise((
|
|
12498
|
-
resolveLoss =
|
|
12497
|
+
const lostPromise = new Promise((resolve27) => {
|
|
12498
|
+
resolveLoss = resolve27;
|
|
12499
12499
|
});
|
|
12500
12500
|
function notifyTimerStep(event) {
|
|
12501
12501
|
try {
|
|
@@ -12656,7 +12656,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
12656
12656
|
}
|
|
12657
12657
|
}
|
|
12658
12658
|
async function backoff() {
|
|
12659
|
-
await new Promise((
|
|
12659
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.floor(Math.random() * 4)));
|
|
12660
12660
|
}
|
|
12661
12661
|
async function readLockState(notifyReady = true) {
|
|
12662
12662
|
if (notifyReady && options.onStep)
|
|
@@ -13094,7 +13094,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13094
13094
|
...typeof observed?.expiresAt === "number" ? { observedExpiresAt: observed.expiresAt } : {}
|
|
13095
13095
|
});
|
|
13096
13096
|
},
|
|
13097
|
-
release: async () => {
|
|
13097
|
+
release: async (signal) => {
|
|
13098
13098
|
if (windowsPrivateFiles && releaseConfirmed)
|
|
13099
13099
|
return;
|
|
13100
13100
|
released = true;
|
|
@@ -13135,6 +13135,8 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13135
13135
|
releaseConfirmed = removalConfirmed;
|
|
13136
13136
|
return;
|
|
13137
13137
|
}
|
|
13138
|
+
if (signal?.aborted)
|
|
13139
|
+
return;
|
|
13138
13140
|
await recoverStaleEvictionMarker();
|
|
13139
13141
|
} catch (error) {
|
|
13140
13142
|
if (windowsPrivateFiles)
|
|
@@ -13144,7 +13146,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13144
13146
|
const remainingMs = deadline - performance.now();
|
|
13145
13147
|
if (remainingMs <= 0)
|
|
13146
13148
|
break;
|
|
13147
|
-
await new Promise((
|
|
13149
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(delayMs, remainingMs)));
|
|
13148
13150
|
delayMs = Math.min(delayMs * 2, 50);
|
|
13149
13151
|
}
|
|
13150
13152
|
if (windowsPrivateFiles)
|
|
@@ -13187,7 +13189,7 @@ async function withLock(target, options, fn) {
|
|
|
13187
13189
|
options.signal?.throwIfAborted();
|
|
13188
13190
|
return await fn(lock);
|
|
13189
13191
|
} finally {
|
|
13190
|
-
await lock.release();
|
|
13192
|
+
await lock.release(options.signal);
|
|
13191
13193
|
}
|
|
13192
13194
|
}
|
|
13193
13195
|
const remaining = options.timeoutMs - (performance.now() - started);
|
|
@@ -13198,7 +13200,7 @@ async function withLock(target, options, fn) {
|
|
|
13198
13200
|
timeoutMs: options.timeoutMs
|
|
13199
13201
|
});
|
|
13200
13202
|
}
|
|
13201
|
-
await new Promise((
|
|
13203
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(25, Math.ceil(remaining))));
|
|
13202
13204
|
}
|
|
13203
13205
|
}
|
|
13204
13206
|
var LockContentionError, LockOwnershipError;
|
|
@@ -13317,7 +13319,7 @@ async function acquirePoolLock(spec, defaults, env3) {
|
|
|
13317
13319
|
});
|
|
13318
13320
|
}
|
|
13319
13321
|
const jitter = Math.floor(Math.random() * (options.retryMs + 1));
|
|
13320
|
-
await new Promise((
|
|
13322
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(options.retryMs + jitter, remaining)));
|
|
13321
13323
|
}
|
|
13322
13324
|
}
|
|
13323
13325
|
function definedOnly(spec) {
|
|
@@ -16359,7 +16361,7 @@ function createEngine(options) {
|
|
|
16359
16361
|
});
|
|
16360
16362
|
}, 500);
|
|
16361
16363
|
}
|
|
16362
|
-
function emit(
|
|
16364
|
+
function emit(channel3, level, message, data) {
|
|
16363
16365
|
if (logFileSource === void 0 && captureSink === void 0)
|
|
16364
16366
|
return;
|
|
16365
16367
|
try {
|
|
@@ -16372,10 +16374,10 @@ function createEngine(options) {
|
|
|
16372
16374
|
} catch {
|
|
16373
16375
|
scrubbedData = "[unserializable]";
|
|
16374
16376
|
}
|
|
16375
|
-
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${level.toUpperCase()} [${
|
|
16377
|
+
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${level.toUpperCase()} [${channel3}] ${scrubbedMessage}` + (data === void 0 ? "" : safeSerialize(scrubbedData)) + "\n";
|
|
16376
16378
|
try {
|
|
16377
16379
|
captureSink?.({
|
|
16378
|
-
channel,
|
|
16380
|
+
channel: channel3,
|
|
16379
16381
|
level,
|
|
16380
16382
|
message: scrubbedMessage,
|
|
16381
16383
|
data: scrubbedData
|
|
@@ -16395,13 +16397,13 @@ function createEngine(options) {
|
|
|
16395
16397
|
} catch {
|
|
16396
16398
|
}
|
|
16397
16399
|
}
|
|
16398
|
-
function createLogger5(
|
|
16400
|
+
function createLogger5(channel3) {
|
|
16399
16401
|
return {
|
|
16400
|
-
error: (m, d) => emit(
|
|
16401
|
-
warn: (m, d) => emit(
|
|
16402
|
-
info: (m, d) => emit(
|
|
16403
|
-
debug: (m, d) => emit(
|
|
16404
|
-
trace: (m, d) => emit(
|
|
16402
|
+
error: (m, d) => emit(channel3, "error", m, d),
|
|
16403
|
+
warn: (m, d) => emit(channel3, "warn", m, d),
|
|
16404
|
+
info: (m, d) => emit(channel3, "info", m, d),
|
|
16405
|
+
debug: (m, d) => emit(channel3, "debug", m, d),
|
|
16406
|
+
trace: (m, d) => emit(channel3, "trace", m, d)
|
|
16405
16407
|
};
|
|
16406
16408
|
}
|
|
16407
16409
|
function reset() {
|
|
@@ -16439,8 +16441,8 @@ function setLogLevel(l) {
|
|
|
16439
16441
|
function flushLogs() {
|
|
16440
16442
|
return defaultEngine.flushLogs();
|
|
16441
16443
|
}
|
|
16442
|
-
function createLogger2(
|
|
16443
|
-
return defaultEngine.createLogger(
|
|
16444
|
+
function createLogger2(channel3) {
|
|
16445
|
+
return defaultEngine.createLogger(channel3);
|
|
16444
16446
|
}
|
|
16445
16447
|
async function flushForTest() {
|
|
16446
16448
|
return defaultEngine.flushLogs();
|
|
@@ -16588,11 +16590,11 @@ var init_quota_writer = __esm({
|
|
|
16588
16590
|
const left = deadline - performance.now();
|
|
16589
16591
|
if (left <= 0)
|
|
16590
16592
|
throw refusal2("pull", id, "lock-contention", `pool quota queue for ${id} is full (${POOL_QUOTA_QUEUE_LIMIT} readings) and the store locks stayed held`, true);
|
|
16591
|
-
await new Promise((
|
|
16593
|
+
await new Promise((resolve27) => {
|
|
16592
16594
|
const done = () => {
|
|
16593
16595
|
clearTimeout(timer);
|
|
16594
16596
|
this.wake.delete(done);
|
|
16595
|
-
|
|
16597
|
+
resolve27();
|
|
16596
16598
|
};
|
|
16597
16599
|
const timer = setTimeout(done, left);
|
|
16598
16600
|
this.wake.add(done);
|
|
@@ -19363,7 +19365,7 @@ async function select(terminal, items, options) {
|
|
|
19363
19365
|
writeLine("");
|
|
19364
19366
|
renderedLines = lines;
|
|
19365
19367
|
};
|
|
19366
|
-
return new Promise((
|
|
19368
|
+
return new Promise((resolve27) => {
|
|
19367
19369
|
const wasRaw = stdin.isRaw ?? false;
|
|
19368
19370
|
const cleanup2 = () => {
|
|
19369
19371
|
if (cleaned)
|
|
@@ -19383,7 +19385,7 @@ async function select(terminal, items, options) {
|
|
|
19383
19385
|
};
|
|
19384
19386
|
const finish = (value) => {
|
|
19385
19387
|
cleanup2();
|
|
19386
|
-
|
|
19388
|
+
resolve27(value);
|
|
19387
19389
|
};
|
|
19388
19390
|
const onSignal = () => finish(null);
|
|
19389
19391
|
const onKey = (data) => {
|
|
@@ -19423,7 +19425,7 @@ async function select(terminal, items, options) {
|
|
|
19423
19425
|
stdin.setRawMode(true);
|
|
19424
19426
|
} catch {
|
|
19425
19427
|
cleanup2();
|
|
19426
|
-
|
|
19428
|
+
resolve27(null);
|
|
19427
19429
|
return;
|
|
19428
19430
|
}
|
|
19429
19431
|
stdin.resume();
|
|
@@ -20648,6 +20650,8 @@ var init_insula = __esm({
|
|
|
20648
20650
|
...typeof entry.source === "string" && { source: entry.source }
|
|
20649
20651
|
}
|
|
20650
20652
|
};
|
|
20653
|
+
if (entry.stale !== void 0 && (!record2(entry.stale) || entry.stale.class !== "local_source_unavailable"))
|
|
20654
|
+
return { miss: "upstream-failed", reading };
|
|
20651
20655
|
return now >= fetchedAt + MAX_AGE || entry.stale !== void 0 ? { miss: "stale", reading } : { reading };
|
|
20652
20656
|
}
|
|
20653
20657
|
if (this.#completeProviders.has(provider2))
|
|
@@ -21469,10 +21473,10 @@ async function drainShutdown(pending, onTimeout) {
|
|
|
21469
21473
|
try {
|
|
21470
21474
|
await Promise.race([
|
|
21471
21475
|
drained,
|
|
21472
|
-
new Promise((
|
|
21476
|
+
new Promise((resolve27) => {
|
|
21473
21477
|
timer = setTimeout(() => {
|
|
21474
21478
|
expired = true;
|
|
21475
|
-
|
|
21479
|
+
resolve27();
|
|
21476
21480
|
}, 2e3);
|
|
21477
21481
|
})
|
|
21478
21482
|
]);
|
|
@@ -21490,6 +21494,7 @@ var init_shutdown = __esm({
|
|
|
21490
21494
|
});
|
|
21491
21495
|
|
|
21492
21496
|
// ../core/dist/common-auth-embedded/claustrum/custody.js
|
|
21497
|
+
import { channel } from "node:diagnostics_channel";
|
|
21493
21498
|
import { ClaustrumCredentialError as ClaustrumCredentialError3 } from "@cortexkit/claustrum-client";
|
|
21494
21499
|
function isScopedCredentialRotation(served, current) {
|
|
21495
21500
|
return current !== void 0 && !current.fromKeptReceipt && !served.fromKeptReceipt && current.credentialId === served.credentialId && current.accountIdentity === served.accountIdentity && current.recordVersion !== served.recordVersion;
|
|
@@ -21546,15 +21551,27 @@ function credentialTypeOf(row, family) {
|
|
|
21546
21551
|
return notMine;
|
|
21547
21552
|
if (!row.categories.includes(family.category))
|
|
21548
21553
|
return notMine;
|
|
21549
|
-
if (row.credentialType !== "oauth" && row.credentialType !== "api_key")
|
|
21550
|
-
return notMine;
|
|
21551
21554
|
if ("classify" in family) {
|
|
21555
|
+
const metadata = rowFactsOf(row);
|
|
21556
|
+
let type;
|
|
21557
|
+
switch (metadata.authMethod) {
|
|
21558
|
+
case "apikey":
|
|
21559
|
+
type = "api_key";
|
|
21560
|
+
break;
|
|
21561
|
+
case "chatgpt":
|
|
21562
|
+
case "antigravity":
|
|
21563
|
+
case "oauth":
|
|
21564
|
+
type = "oauth";
|
|
21565
|
+
break;
|
|
21566
|
+
default:
|
|
21567
|
+
return { kind: "refused", code: "unknown-auth-method" };
|
|
21568
|
+
}
|
|
21552
21569
|
const facts = {
|
|
21553
21570
|
credentialId: row.id,
|
|
21554
|
-
credentialType:
|
|
21571
|
+
credentialType: type,
|
|
21555
21572
|
categories: row.categories,
|
|
21556
21573
|
refreshAdapter: row.refreshAdapter,
|
|
21557
|
-
...
|
|
21574
|
+
...metadata
|
|
21558
21575
|
};
|
|
21559
21576
|
if (facts.providerIds === void 0)
|
|
21560
21577
|
return { kind: "refused", code: "unmapped" };
|
|
@@ -21563,13 +21580,15 @@ function credentialTypeOf(row, family) {
|
|
|
21563
21580
|
if (result.kind === "not-mine")
|
|
21564
21581
|
return notMine;
|
|
21565
21582
|
if (result.kind === "mine" && typeof result.member === "string")
|
|
21566
|
-
return { kind: "mine", type
|
|
21583
|
+
return { kind: "mine", type, member: result.member };
|
|
21567
21584
|
if (result.kind === "refused" && typeof result.code === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(result.code) && !result.code.includes("\n") && family.refusalCodes.includes(result.code))
|
|
21568
21585
|
return { kind: "refused", code: result.code };
|
|
21569
21586
|
} catch {
|
|
21570
21587
|
}
|
|
21571
21588
|
return { kind: "refused", code: "unclassified" };
|
|
21572
21589
|
}
|
|
21590
|
+
if (row.credentialType !== "oauth" && row.credentialType !== "api_key")
|
|
21591
|
+
return notMine;
|
|
21573
21592
|
if (row.credentialType === "oauth")
|
|
21574
21593
|
return row.refreshAdapter === family.refreshAdapter ? { kind: "mine", type: "oauth" } : notMine;
|
|
21575
21594
|
if (row.credentialType === "api_key" && family.apiKeys)
|
|
@@ -21589,7 +21608,7 @@ function grantReachOf(listed) {
|
|
|
21589
21608
|
tuples: Object.freeze(grantTuples.map(({ selectorKind, selector, operation }) => Object.freeze({ selectorKind, selector, operation })))
|
|
21590
21609
|
});
|
|
21591
21610
|
}
|
|
21592
|
-
var defaultLogger, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, ClaustrumScopedCustody;
|
|
21611
|
+
var defaultLogger, phaseDiagnostics, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, ClaustrumScopedCustody;
|
|
21593
21612
|
var init_custody = __esm({
|
|
21594
21613
|
"../core/dist/common-auth-embedded/claustrum/custody.js"() {
|
|
21595
21614
|
"use strict";
|
|
@@ -21601,6 +21620,7 @@ var init_custody = __esm({
|
|
|
21601
21620
|
init_shutdown();
|
|
21602
21621
|
init_watch();
|
|
21603
21622
|
defaultLogger = createLogger2("claustrum");
|
|
21623
|
+
phaseDiagnostics = channel("common-auth.claustrum.phases");
|
|
21604
21624
|
SERVING_MARGIN_MS = 3e5;
|
|
21605
21625
|
KEPT_RECEIPT_MARGIN_MS = 6e4;
|
|
21606
21626
|
ClaustrumScopedCustody = class {
|
|
@@ -21704,6 +21724,11 @@ var init_custody = __esm({
|
|
|
21704
21724
|
}
|
|
21705
21725
|
async #token(signal) {
|
|
21706
21726
|
this.#check(signal);
|
|
21727
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
21728
|
+
phaseDiagnostics.publish({
|
|
21729
|
+
logger: this.#logger,
|
|
21730
|
+
phase: "token read begin"
|
|
21731
|
+
});
|
|
21707
21732
|
const pending = this.#readToken();
|
|
21708
21733
|
this.#tokenReads.add(pending);
|
|
21709
21734
|
let value;
|
|
@@ -21711,6 +21736,11 @@ var init_custody = __esm({
|
|
|
21711
21736
|
value = await pending;
|
|
21712
21737
|
} finally {
|
|
21713
21738
|
this.#tokenReads.delete(pending);
|
|
21739
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
21740
|
+
phaseDiagnostics.publish({
|
|
21741
|
+
logger: this.#logger,
|
|
21742
|
+
phase: "token read end"
|
|
21743
|
+
});
|
|
21714
21744
|
}
|
|
21715
21745
|
this.#check(signal);
|
|
21716
21746
|
if (!/^[0-9a-f]{64}$/.test(value.token) || !Number.isSafeInteger(value.token_generation) || value.token_generation < 1) {
|
|
@@ -21772,11 +21802,22 @@ var init_custody = __esm({
|
|
|
21772
21802
|
this.#kept.clear();
|
|
21773
21803
|
throw error;
|
|
21774
21804
|
}
|
|
21805
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
21806
|
+
phaseDiagnostics.publish({
|
|
21807
|
+
logger: this.#logger,
|
|
21808
|
+
phase: "list scoped begin"
|
|
21809
|
+
});
|
|
21775
21810
|
try {
|
|
21776
21811
|
inventory = await this.#call(() => this.#client.listScoped(token), signal);
|
|
21777
21812
|
} catch (error) {
|
|
21778
21813
|
this.listFailed(error);
|
|
21779
21814
|
throw error;
|
|
21815
|
+
} finally {
|
|
21816
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
21817
|
+
phaseDiagnostics.publish({
|
|
21818
|
+
logger: this.#logger,
|
|
21819
|
+
phase: "list scoped end"
|
|
21820
|
+
});
|
|
21780
21821
|
}
|
|
21781
21822
|
const skipped = [];
|
|
21782
21823
|
const refused2 = [];
|
|
@@ -22716,7 +22757,7 @@ async function refreshVaultRoster(options) {
|
|
|
22716
22757
|
pendingDiscoveries.set(key, discovered);
|
|
22717
22758
|
throw error;
|
|
22718
22759
|
} finally {
|
|
22719
|
-
await lease.release();
|
|
22760
|
+
await lease.release(options.signal);
|
|
22720
22761
|
}
|
|
22721
22762
|
}
|
|
22722
22763
|
function resolveVaultPrimary(input2) {
|
|
@@ -23069,7 +23110,7 @@ var init_consumer = __esm({
|
|
|
23069
23110
|
this.#shutdown.signal,
|
|
23070
23111
|
...signal ? [signal] : []
|
|
23071
23112
|
]);
|
|
23072
|
-
return new Promise((
|
|
23113
|
+
return new Promise((resolve27, reject) => {
|
|
23073
23114
|
const cleanup2 = () => {
|
|
23074
23115
|
combined.signal.removeEventListener("abort", abort);
|
|
23075
23116
|
combined.dispose();
|
|
@@ -23084,7 +23125,7 @@ var init_consumer = __esm({
|
|
|
23084
23125
|
if (combined.signal.aborted)
|
|
23085
23126
|
reject(combined.signal.reason);
|
|
23086
23127
|
else
|
|
23087
|
-
|
|
23128
|
+
resolve27(value);
|
|
23088
23129
|
}, (error) => {
|
|
23089
23130
|
cleanup2();
|
|
23090
23131
|
reject(error);
|
|
@@ -23258,8 +23299,16 @@ var init_consumer = __esm({
|
|
|
23258
23299
|
this.#refreshing = void 0;
|
|
23259
23300
|
});
|
|
23260
23301
|
this.#track(this.#refreshing);
|
|
23302
|
+
this.#notifyDiscovery(this.#refreshing);
|
|
23261
23303
|
return this.#refreshing;
|
|
23262
23304
|
}
|
|
23305
|
+
#notifyDiscovery(promise) {
|
|
23306
|
+
try {
|
|
23307
|
+
this.#options.onDiscovery?.(promise);
|
|
23308
|
+
} catch (error) {
|
|
23309
|
+
this.#options.onError?.(error);
|
|
23310
|
+
}
|
|
23311
|
+
}
|
|
23263
23312
|
/**
|
|
23264
23313
|
* Poll in the background and open the vault and insula watches. Until the
|
|
23265
23314
|
* vault watch is accepted, and whenever it is unavailable, every tick lists
|
|
@@ -23489,6 +23538,13 @@ var init_consumer = __esm({
|
|
|
23489
23538
|
/** The hub's handle on this member's memory. */
|
|
23490
23539
|
#hubHooks() {
|
|
23491
23540
|
return {
|
|
23541
|
+
discovery: (promise) => {
|
|
23542
|
+
const hub = this.#hub;
|
|
23543
|
+
if (!hub || !this.#options.onDiscovery || this.#shutdown.signal.aborted)
|
|
23544
|
+
return;
|
|
23545
|
+
const discovery = this.#track(promise.then((outcome) => this.#hubOutcome(hub, outcome)));
|
|
23546
|
+
this.#notifyDiscovery(discovery);
|
|
23547
|
+
},
|
|
23492
23548
|
install: (roster) => {
|
|
23493
23549
|
if (this.#shutdown.signal.aborted)
|
|
23494
23550
|
return;
|
|
@@ -23523,6 +23579,9 @@ var init_consumer = __esm({
|
|
|
23523
23579
|
*/
|
|
23524
23580
|
async #hubRefresh(hub) {
|
|
23525
23581
|
const outcome = await hub.refresh();
|
|
23582
|
+
return this.#hubOutcome(hub, outcome);
|
|
23583
|
+
}
|
|
23584
|
+
#hubOutcome(hub, outcome) {
|
|
23526
23585
|
this.#assertOpen();
|
|
23527
23586
|
if (!outcome)
|
|
23528
23587
|
return void 0;
|
|
@@ -23677,6 +23736,8 @@ var init_consumer = __esm({
|
|
|
23677
23736
|
this.#assertOpen();
|
|
23678
23737
|
await declineVaultRoute(this.#options.rosterPath, routeId);
|
|
23679
23738
|
this.#roster = pendingVaultQuota(this.#options.rosterPath, await readVaultRoster(this.#options.rosterPath));
|
|
23739
|
+
if (this.#roster)
|
|
23740
|
+
this.#hub?.publishRoster(this.#roster);
|
|
23680
23741
|
if (this.#hub)
|
|
23681
23742
|
this.#hub.retainUnion();
|
|
23682
23743
|
else
|
|
@@ -23686,6 +23747,8 @@ var init_consumer = __esm({
|
|
|
23686
23747
|
this.#assertOpen();
|
|
23687
23748
|
await acceptVaultRoute(this.#options.rosterPath, routeId);
|
|
23688
23749
|
this.#roster = pendingVaultQuota(this.#options.rosterPath, await readVaultRoster(this.#options.rosterPath));
|
|
23750
|
+
if (this.#roster)
|
|
23751
|
+
this.#hub?.publishRoster(this.#roster);
|
|
23689
23752
|
}
|
|
23690
23753
|
/**
|
|
23691
23754
|
* Set the order vault accounts are tried in (`reorderVaultRoster`), then
|
|
@@ -23696,6 +23759,8 @@ var init_consumer = __esm({
|
|
|
23696
23759
|
this.#assertOpen();
|
|
23697
23760
|
const result = await reorderVaultRoster(this.#options.rosterPath, routeIds);
|
|
23698
23761
|
this.#roster = pendingVaultQuota(this.#options.rosterPath, await readVaultRoster(this.#options.rosterPath));
|
|
23762
|
+
if (this.#roster)
|
|
23763
|
+
this.#hub?.publishRoster(this.#roster);
|
|
23699
23764
|
return result;
|
|
23700
23765
|
}
|
|
23701
23766
|
/**
|
|
@@ -23772,8 +23837,9 @@ var init_consumer = __esm({
|
|
|
23772
23837
|
|
|
23773
23838
|
// ../core/dist/common-auth-embedded/claustrum/hub.js
|
|
23774
23839
|
import { createHash as createHash8 } from "node:crypto";
|
|
23840
|
+
import { channel as channel2 } from "node:diagnostics_channel";
|
|
23775
23841
|
import { readdir, stat as stat6 } from "node:fs/promises";
|
|
23776
|
-
import { dirname as dirname10, join as join7 } from "node:path";
|
|
23842
|
+
import { dirname as dirname10, join as join7, resolve as resolve9 } from "node:path";
|
|
23777
23843
|
function canonicalJson3(value, path5 = /* @__PURE__ */ new Set()) {
|
|
23778
23844
|
if (value === null)
|
|
23779
23845
|
return "null";
|
|
@@ -23834,12 +23900,12 @@ function unreachableConnect2() {
|
|
|
23834
23900
|
return new ClaustrumUnreachableError();
|
|
23835
23901
|
}
|
|
23836
23902
|
function untilAborted(pending, signal) {
|
|
23837
|
-
return new Promise((
|
|
23903
|
+
return new Promise((resolve27, reject) => {
|
|
23838
23904
|
const abort = () => reject(signal.reason);
|
|
23839
23905
|
signal.addEventListener("abort", abort, { once: true });
|
|
23840
23906
|
pending.then((value) => {
|
|
23841
23907
|
signal.removeEventListener("abort", abort);
|
|
23842
|
-
|
|
23908
|
+
resolve27(value);
|
|
23843
23909
|
}, (error) => {
|
|
23844
23910
|
signal.removeEventListener("abort", abort);
|
|
23845
23911
|
reject(error);
|
|
@@ -23851,7 +23917,7 @@ function untilAborted(pending, signal) {
|
|
|
23851
23917
|
function enabledRows(roster) {
|
|
23852
23918
|
return JSON.stringify((roster?.rows ?? []).map((row) => [row.credentialId, row.enabled]));
|
|
23853
23919
|
}
|
|
23854
|
-
var FILE_ID, WINDOWS_DEVICE, FINGERPRINT, PENDING_EVERY_TICK, ClaustrumDiscoveryHub;
|
|
23920
|
+
var sharedRosters, FILE_ID, WINDOWS_DEVICE, FINGERPRINT, PENDING_EVERY_TICK, ClaustrumDiscoveryHub;
|
|
23855
23921
|
var init_hub = __esm({
|
|
23856
23922
|
"../core/dist/common-auth-embedded/claustrum/hub.js"() {
|
|
23857
23923
|
"use strict";
|
|
@@ -23865,6 +23931,7 @@ var init_hub = __esm({
|
|
|
23865
23931
|
init_roster();
|
|
23866
23932
|
init_shutdown();
|
|
23867
23933
|
init_watch();
|
|
23934
|
+
sharedRosters = /* @__PURE__ */ new Map();
|
|
23868
23935
|
FILE_ID = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
23869
23936
|
WINDOWS_DEVICE = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\.|$)/;
|
|
23870
23937
|
FINGERPRINT = /^[0-9a-f]{16}$/;
|
|
@@ -23971,9 +24038,11 @@ var init_hub = __esm({
|
|
|
23971
24038
|
watchMode: () => this.watchState(),
|
|
23972
24039
|
keptReceiptState: () => this.keptReceiptState(),
|
|
23973
24040
|
retainUnion: () => this.#retainUnion(),
|
|
24041
|
+
publishRoster: (roster) => this.#publishRoster(entry, roster),
|
|
23974
24042
|
forget: (credentialId) => this.#current?.custody?.forget(credentialId),
|
|
23975
24043
|
detach: () => {
|
|
23976
24044
|
entry.closed = true;
|
|
24045
|
+
entry.releaseRoster?.();
|
|
23977
24046
|
}
|
|
23978
24047
|
};
|
|
23979
24048
|
const consumerOptions = {
|
|
@@ -23986,14 +24055,51 @@ var init_hub = __esm({
|
|
|
23986
24055
|
},
|
|
23987
24056
|
...this.#options.mapAccount && { mapAccount: this.#options.mapAccount },
|
|
23988
24057
|
...options.onRoster && { onRoster: options.onRoster },
|
|
24058
|
+
...options.onDiscovery && { onDiscovery: options.onDiscovery },
|
|
23989
24059
|
...options.onError && { onError: options.onError },
|
|
23990
24060
|
logger: options.logger ?? this.#logger,
|
|
23991
24061
|
...this.#options.now && { now: this.#options.now }
|
|
23992
24062
|
};
|
|
23993
24063
|
const { consumer, hooks } = createHubMember(port, consumerOptions);
|
|
23994
24064
|
entry.hooks = hooks;
|
|
24065
|
+
const path5 = resolve9(entry.path);
|
|
24066
|
+
const subscribers = sharedRosters.get(path5) ?? /* @__PURE__ */ new Set();
|
|
24067
|
+
const install = (roster) => {
|
|
24068
|
+
if (entry.closed || this.#active !== true || !this.#current || !this.#live(this.#current) || !hooks.roster() || this.#collides(hooks, roster))
|
|
24069
|
+
return;
|
|
24070
|
+
entry.seen = JSON.stringify(decodedVaultRoster(roster));
|
|
24071
|
+
hooks.install(roster);
|
|
24072
|
+
if (roster.view !== this.#committed?.view)
|
|
24073
|
+
entry.pending ??= { failures: 0, wait: 0 };
|
|
24074
|
+
this.#retainUnion();
|
|
24075
|
+
};
|
|
24076
|
+
subscribers.add(install);
|
|
24077
|
+
entry.receiveRoster = install;
|
|
24078
|
+
sharedRosters.set(path5, subscribers);
|
|
24079
|
+
let subscribed = true;
|
|
24080
|
+
entry.releaseRoster = () => {
|
|
24081
|
+
if (!subscribed)
|
|
24082
|
+
return;
|
|
24083
|
+
subscribed = false;
|
|
24084
|
+
subscribers.delete(install);
|
|
24085
|
+
if (!subscribers.size)
|
|
24086
|
+
sharedRosters.delete(path5);
|
|
24087
|
+
};
|
|
23995
24088
|
return consumer;
|
|
23996
24089
|
}
|
|
24090
|
+
#publishRoster(entry, roster) {
|
|
24091
|
+
const generation = this.#current;
|
|
24092
|
+
if (entry.closed || !generation || !this.#live(generation))
|
|
24093
|
+
return;
|
|
24094
|
+
entry.seen = JSON.stringify(decodedVaultRoster(roster));
|
|
24095
|
+
entry.hooks?.install(roster);
|
|
24096
|
+
for (const install of sharedRosters.get(resolve9(entry.path)) ?? []) {
|
|
24097
|
+
if (!this.#live(generation))
|
|
24098
|
+
return;
|
|
24099
|
+
if (install !== entry.receiveRoster)
|
|
24100
|
+
install(roster);
|
|
24101
|
+
}
|
|
24102
|
+
}
|
|
23997
24103
|
// --- leases ---
|
|
23998
24104
|
#startGeneration() {
|
|
23999
24105
|
const generation = {
|
|
@@ -24289,6 +24395,8 @@ var init_hub = __esm({
|
|
|
24289
24395
|
}));
|
|
24290
24396
|
run.promise = promise;
|
|
24291
24397
|
this.#run = run;
|
|
24398
|
+
for (const entry of this.#open())
|
|
24399
|
+
entry.hooks?.discovery(promise);
|
|
24292
24400
|
return promise;
|
|
24293
24401
|
}
|
|
24294
24402
|
/**
|
|
@@ -24365,9 +24473,7 @@ var init_hub = __esm({
|
|
|
24365
24473
|
this.#markPending(entry);
|
|
24366
24474
|
continue;
|
|
24367
24475
|
}
|
|
24368
|
-
entry
|
|
24369
|
-
if (!entry.closed)
|
|
24370
|
-
hooks.install(roster);
|
|
24476
|
+
this.#publishRoster(entry, roster);
|
|
24371
24477
|
}
|
|
24372
24478
|
if (!this.#live(generation))
|
|
24373
24479
|
return void 0;
|
|
@@ -24398,7 +24504,24 @@ var init_hub = __esm({
|
|
|
24398
24504
|
throw closed("Claustrum hub member has no base view");
|
|
24399
24505
|
if (base instanceof Error)
|
|
24400
24506
|
throw base;
|
|
24401
|
-
|
|
24507
|
+
let seed;
|
|
24508
|
+
if (!base.file) {
|
|
24509
|
+
const phaseDiagnostics2 = channel2("common-auth.claustrum.phases");
|
|
24510
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
24511
|
+
phaseDiagnostics2.publish({
|
|
24512
|
+
logger: this.#logger,
|
|
24513
|
+
phase: `seed read ${entry.provider} begin`
|
|
24514
|
+
});
|
|
24515
|
+
try {
|
|
24516
|
+
seed = await this.#seed(entry);
|
|
24517
|
+
} finally {
|
|
24518
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
24519
|
+
phaseDiagnostics2.publish({
|
|
24520
|
+
logger: this.#logger,
|
|
24521
|
+
phase: `seed read ${entry.provider} end`
|
|
24522
|
+
});
|
|
24523
|
+
}
|
|
24524
|
+
}
|
|
24402
24525
|
const roster = await refreshVaultRoster({
|
|
24403
24526
|
path: entry.path,
|
|
24404
24527
|
custody: { discover: async () => share },
|
|
@@ -24522,7 +24645,7 @@ var init_hub = __esm({
|
|
|
24522
24645
|
}
|
|
24523
24646
|
const before = enabledRows(memory);
|
|
24524
24647
|
entry.seen = content;
|
|
24525
|
-
|
|
24648
|
+
this.#publishRoster(entry, file);
|
|
24526
24649
|
if (enabledRows(hooks.roster()) !== before)
|
|
24527
24650
|
this.#retainUnion();
|
|
24528
24651
|
}
|
|
@@ -24679,6 +24802,8 @@ var init_hub = __esm({
|
|
|
24679
24802
|
if (this.#shutdown.signal.aborted)
|
|
24680
24803
|
return;
|
|
24681
24804
|
this.#shutdown.abort(closed("Claustrum discovery hub is closed"));
|
|
24805
|
+
for (const entry of this.#members.values())
|
|
24806
|
+
entry.releaseRoster?.();
|
|
24682
24807
|
if (this.#timer)
|
|
24683
24808
|
(this.#options.clearTimeoutImpl ?? clearTimeout)(this.#timer);
|
|
24684
24809
|
this.#timer = void 0;
|
|
@@ -25013,7 +25138,7 @@ var init_lock = __esm({
|
|
|
25013
25138
|
import { createHash as createHash9 } from "node:crypto";
|
|
25014
25139
|
import { constants as constants2 } from "node:fs";
|
|
25015
25140
|
import { lstat as lstat5, mkdir as mkdir10, open as open7, unlink as unlink7 } from "node:fs/promises";
|
|
25016
|
-
import { dirname as dirname11, resolve as
|
|
25141
|
+
import { dirname as dirname11, resolve as resolve10 } from "node:path";
|
|
25017
25142
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
25018
25143
|
function rootSpans(text2) {
|
|
25019
25144
|
let i = text2.indexOf("{") + 1;
|
|
@@ -25214,8 +25339,8 @@ function createPiSlot(options, onStep, hooks) {
|
|
|
25214
25339
|
if (!provider2 || !options.authPath || !options.stashPath || !placeholderKey || placeholderKey.startsWith("!") || placeholderKey.includes("$") || !Number.isFinite(timeout) || timeout < 0) {
|
|
25215
25340
|
throw new PiSlotError("invalid-options");
|
|
25216
25341
|
}
|
|
25217
|
-
const authPath =
|
|
25218
|
-
const stashPath =
|
|
25342
|
+
const authPath = resolve10(options.authPath);
|
|
25343
|
+
const stashPath = resolve10(options.stashPath);
|
|
25219
25344
|
if (authPath === stashPath || stashPath === `${authPath}.lock`) {
|
|
25220
25345
|
throw new PiSlotError("invalid-options");
|
|
25221
25346
|
}
|
|
@@ -25838,8 +25963,8 @@ function getDefaultTierId(allowedTiers) {
|
|
|
25838
25963
|
return allowedTiers[0]?.id;
|
|
25839
25964
|
}
|
|
25840
25965
|
function wait(ms) {
|
|
25841
|
-
return new Promise((
|
|
25842
|
-
setTimeout(
|
|
25966
|
+
return new Promise((resolve27) => {
|
|
25967
|
+
setTimeout(resolve27, ms);
|
|
25843
25968
|
});
|
|
25844
25969
|
}
|
|
25845
25970
|
function extractManagedProjectId(payload) {
|
|
@@ -28161,12 +28286,12 @@ var init_vault_provider_state = __esm({
|
|
|
28161
28286
|
function untilAborted2(pending, signal) {
|
|
28162
28287
|
if (!signal)
|
|
28163
28288
|
return pending;
|
|
28164
|
-
return new Promise((
|
|
28289
|
+
return new Promise((resolve27, reject) => {
|
|
28165
28290
|
const abort = () => reject(signal.reason);
|
|
28166
28291
|
signal.addEventListener("abort", abort, { once: true });
|
|
28167
28292
|
if (signal.aborted)
|
|
28168
28293
|
abort();
|
|
28169
|
-
pending.then(
|
|
28294
|
+
pending.then(resolve27, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
28170
28295
|
});
|
|
28171
28296
|
}
|
|
28172
28297
|
async function resolveClaustrumConnectionPath(explicit) {
|
|
@@ -28640,7 +28765,7 @@ var init_capture_sink2 = __esm({
|
|
|
28640
28765
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
28641
28766
|
import { lstat as lstat6, readFile as readFile8, rename as rename8, unlink as unlink8 } from "node:fs/promises";
|
|
28642
28767
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
28643
|
-
import { dirname as dirname13, join as join9, resolve as
|
|
28768
|
+
import { dirname as dirname13, join as join9, resolve as resolve11 } from "node:path";
|
|
28644
28769
|
function ioCode2(detail) {
|
|
28645
28770
|
if (detail?.reason === "io-error") {
|
|
28646
28771
|
if (detail.win32Code === 2 || detail.win32Code === 3)
|
|
@@ -28687,7 +28812,7 @@ async function privateOperation2(path5, stage, operation) {
|
|
|
28687
28812
|
}
|
|
28688
28813
|
}
|
|
28689
28814
|
async function verifySafeDirectory2(path5, options) {
|
|
28690
|
-
path5 =
|
|
28815
|
+
path5 = resolve11(path5);
|
|
28691
28816
|
options ??= safeParentOptionsForTest2;
|
|
28692
28817
|
await privateOperation2(path5, "safe-parent", async () => {
|
|
28693
28818
|
const result = await (await loadBackend2()).verifySafeParent(path5, options);
|
|
@@ -28702,7 +28827,7 @@ async function verifySafeDirectory2(path5, options) {
|
|
|
28702
28827
|
});
|
|
28703
28828
|
}
|
|
28704
28829
|
async function verifyPrivate2(path5, kind, migrate = false) {
|
|
28705
|
-
path5 =
|
|
28830
|
+
path5 = resolve11(path5);
|
|
28706
28831
|
if (kind === "directory")
|
|
28707
28832
|
return verifySafeDirectory2(path5);
|
|
28708
28833
|
await privateOperation2(path5, "verify", async () => {
|
|
@@ -28737,7 +28862,7 @@ async function verifyPrivate2(path5, kind, migrate = false) {
|
|
|
28737
28862
|
});
|
|
28738
28863
|
}
|
|
28739
28864
|
async function ensurePrivateDirectory2(path5, _migrate = false, options) {
|
|
28740
|
-
path5 =
|
|
28865
|
+
path5 = resolve11(path5);
|
|
28741
28866
|
await privateOperation2(path5, "directory", async () => {
|
|
28742
28867
|
const api = await loadBackend2();
|
|
28743
28868
|
try {
|
|
@@ -28768,7 +28893,7 @@ async function readPrivateText2(path5, migrate = false) {
|
|
|
28768
28893
|
async function readPrivateBuffer2(path5, migrate = false) {
|
|
28769
28894
|
if (!windowsPrivateFiles2)
|
|
28770
28895
|
return readFile8(path5);
|
|
28771
|
-
path5 =
|
|
28896
|
+
path5 = resolve11(path5);
|
|
28772
28897
|
if (migrate) {
|
|
28773
28898
|
await verifySafeDirectory2(dirname13(path5));
|
|
28774
28899
|
await verifyPrivate2(path5, "file", true);
|
|
@@ -28776,20 +28901,20 @@ async function readPrivateBuffer2(path5, migrate = false) {
|
|
|
28776
28901
|
return privateOperation2(path5, "read", async () => (await loadBackend2()).readOwnerOnly(path5));
|
|
28777
28902
|
}
|
|
28778
28903
|
async function createPrivateBytes2(path5, bytes) {
|
|
28779
|
-
await verifySafeDirectory2(dirname13(
|
|
28904
|
+
await verifySafeDirectory2(dirname13(resolve11(path5)));
|
|
28780
28905
|
await privateOperation2(path5, "create", async () => {
|
|
28781
|
-
await (await loadBackend2()).createPrivateFile(
|
|
28906
|
+
await (await loadBackend2()).createPrivateFile(resolve11(path5), bytes);
|
|
28782
28907
|
});
|
|
28783
28908
|
}
|
|
28784
28909
|
async function createPrivateDirectoryExclusive2(path5) {
|
|
28785
|
-
await verifySafeDirectory2(dirname13(
|
|
28910
|
+
await verifySafeDirectory2(dirname13(resolve11(path5)));
|
|
28786
28911
|
await privateOperation2(path5, "directory-create", async () => {
|
|
28787
|
-
await (await loadBackend2()).createOwnerOnly(
|
|
28912
|
+
await (await loadBackend2()).createOwnerOnly(resolve11(path5), { kind: "dir" });
|
|
28788
28913
|
});
|
|
28789
28914
|
}
|
|
28790
28915
|
async function replaceWindowsFile2(from, to, options = {}) {
|
|
28791
|
-
from =
|
|
28792
|
-
to =
|
|
28916
|
+
from = resolve11(from);
|
|
28917
|
+
to = resolve11(to);
|
|
28793
28918
|
const now = options.now ?? (() => performance.now());
|
|
28794
28919
|
const start = now();
|
|
28795
28920
|
const leaseDeadline = options.deadline ?? Infinity;
|
|
@@ -28832,7 +28957,7 @@ async function replaceWindowsFile2(from, to, options = {}) {
|
|
|
28832
28957
|
throw error;
|
|
28833
28958
|
}
|
|
28834
28959
|
async function writePrivateAtomic2(path5, bytes, options = {}) {
|
|
28835
|
-
path5 =
|
|
28960
|
+
path5 = resolve11(path5);
|
|
28836
28961
|
await ensurePrivateDirectory2(dirname13(path5));
|
|
28837
28962
|
try {
|
|
28838
28963
|
await verifyPrivate2(path5, "file", true);
|
|
@@ -28840,7 +28965,7 @@ async function writePrivateAtomic2(path5, bytes, options = {}) {
|
|
|
28840
28965
|
if (error.code !== "ENOENT")
|
|
28841
28966
|
throw error;
|
|
28842
28967
|
}
|
|
28843
|
-
const stage =
|
|
28968
|
+
const stage = resolve11(options.stagePath ?? `${path5}.${randomUUID13()}.tmp`);
|
|
28844
28969
|
if (dirname13(stage) !== dirname13(path5))
|
|
28845
28970
|
throw new PrivateFileError2(path5, "stage-directory", { code: "EXDEV" });
|
|
28846
28971
|
let created = false;
|
|
@@ -29006,7 +29131,7 @@ var init_redact2 = __esm({
|
|
|
29006
29131
|
// src/common-auth-embedded/logger/engine.js
|
|
29007
29132
|
import { appendFileSync as appendFileSync2, chmodSync as chmodSync2, existsSync as existsSync2, renameSync as renameSync2, statSync as statSync3 } from "node:fs";
|
|
29008
29133
|
import { open as open8 } from "node:fs/promises";
|
|
29009
|
-
import { dirname as dirname14, resolve as
|
|
29134
|
+
import { dirname as dirname14, resolve as resolve12 } from "node:path";
|
|
29010
29135
|
function chmodPrivate2(path5) {
|
|
29011
29136
|
try {
|
|
29012
29137
|
chmodSync2(path5, 384);
|
|
@@ -29057,7 +29182,7 @@ async function openWindowsFile2(sink, file) {
|
|
|
29057
29182
|
return sink.handle;
|
|
29058
29183
|
}
|
|
29059
29184
|
async function flushWindowsFile2(sink, file, text2) {
|
|
29060
|
-
file =
|
|
29185
|
+
file = resolve12(file);
|
|
29061
29186
|
try {
|
|
29062
29187
|
if (sink.file !== file)
|
|
29063
29188
|
await closeWindowsFile2(sink);
|
|
@@ -29204,7 +29329,7 @@ function createEngine2(options) {
|
|
|
29204
29329
|
});
|
|
29205
29330
|
}, 500);
|
|
29206
29331
|
}
|
|
29207
|
-
function emit(
|
|
29332
|
+
function emit(channel3, level, message, data) {
|
|
29208
29333
|
if (logFileSource === void 0 && captureSink === void 0)
|
|
29209
29334
|
return;
|
|
29210
29335
|
try {
|
|
@@ -29217,10 +29342,10 @@ function createEngine2(options) {
|
|
|
29217
29342
|
} catch {
|
|
29218
29343
|
scrubbedData = "[unserializable]";
|
|
29219
29344
|
}
|
|
29220
|
-
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${level.toUpperCase()} [${
|
|
29345
|
+
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${level.toUpperCase()} [${channel3}] ${scrubbedMessage}` + (data === void 0 ? "" : safeSerialize2(scrubbedData)) + "\n";
|
|
29221
29346
|
try {
|
|
29222
29347
|
captureSink?.({
|
|
29223
|
-
channel,
|
|
29348
|
+
channel: channel3,
|
|
29224
29349
|
level,
|
|
29225
29350
|
message: scrubbedMessage,
|
|
29226
29351
|
data: scrubbedData
|
|
@@ -29240,13 +29365,13 @@ function createEngine2(options) {
|
|
|
29240
29365
|
} catch {
|
|
29241
29366
|
}
|
|
29242
29367
|
}
|
|
29243
|
-
function createLogger5(
|
|
29368
|
+
function createLogger5(channel3) {
|
|
29244
29369
|
return {
|
|
29245
|
-
error: (m, d) => emit(
|
|
29246
|
-
warn: (m, d) => emit(
|
|
29247
|
-
info: (m, d) => emit(
|
|
29248
|
-
debug: (m, d) => emit(
|
|
29249
|
-
trace: (m, d) => emit(
|
|
29370
|
+
error: (m, d) => emit(channel3, "error", m, d),
|
|
29371
|
+
warn: (m, d) => emit(channel3, "warn", m, d),
|
|
29372
|
+
info: (m, d) => emit(channel3, "info", m, d),
|
|
29373
|
+
debug: (m, d) => emit(channel3, "debug", m, d),
|
|
29374
|
+
trace: (m, d) => emit(channel3, "trace", m, d)
|
|
29250
29375
|
};
|
|
29251
29376
|
}
|
|
29252
29377
|
function reset() {
|
|
@@ -30116,11 +30241,11 @@ function createOpenCodeVaultCustody(options) {
|
|
|
30116
30241
|
].join("\n");
|
|
30117
30242
|
const waitForApproval = async () => {
|
|
30118
30243
|
while (!closed2) {
|
|
30119
|
-
await new Promise((
|
|
30244
|
+
await new Promise((resolve27) => {
|
|
30120
30245
|
const done = () => {
|
|
30121
30246
|
clearTimeout(timer);
|
|
30122
30247
|
cancelWait = void 0;
|
|
30123
|
-
|
|
30248
|
+
resolve27();
|
|
30124
30249
|
};
|
|
30125
30250
|
const timer = setTimeout(done, 2e3);
|
|
30126
30251
|
timer.unref?.();
|
|
@@ -30507,7 +30632,7 @@ import { randomUUID as randomUUID14 } from "node:crypto";
|
|
|
30507
30632
|
import { realpathSync, rmSync } from "node:fs";
|
|
30508
30633
|
import { chmod as chmod4, mkdir as mkdir12, readFile as readFile10, rename as rename9, rm as rm5, writeFile as writeFile3 } from "node:fs/promises";
|
|
30509
30634
|
import { homedir as homedir2 } from "node:os";
|
|
30510
|
-
import { join as join11, resolve as
|
|
30635
|
+
import { join as join11, resolve as resolve13 } from "node:path";
|
|
30511
30636
|
function processHeartbeatDir() {
|
|
30512
30637
|
const base = process.env.XDG_STATE_HOME || join11(homedir2(), ".local", "state");
|
|
30513
30638
|
return join11(base, "cortexkit", "antigravity-auth", "processes");
|
|
@@ -30520,7 +30645,7 @@ function processConfigFolderKey() {
|
|
|
30520
30645
|
try {
|
|
30521
30646
|
return realpathSync.native(folder);
|
|
30522
30647
|
} catch {
|
|
30523
|
-
return
|
|
30648
|
+
return resolve13(folder);
|
|
30524
30649
|
}
|
|
30525
30650
|
}
|
|
30526
30651
|
function processHasOlderGeneration() {
|
|
@@ -30966,7 +31091,7 @@ import {
|
|
|
30966
31091
|
stat as stat9,
|
|
30967
31092
|
unlink as unlink9
|
|
30968
31093
|
} from "node:fs/promises";
|
|
30969
|
-
import { basename as basename4, dirname as dirname15, join as join13, resolve as
|
|
31094
|
+
import { basename as basename4, dirname as dirname15, join as join13, resolve as resolve14 } from "node:path";
|
|
30970
31095
|
function refusalMessage(stateDir, errorClass2) {
|
|
30971
31096
|
if (errorClass2 === "ERR_PRIVATE_FILES_SECURITY")
|
|
30972
31097
|
return `antigravity-auth cannot start: ${stateDir} is not a folder only your user can access, or it is a link, so the plugin will not use it (${errorClass2}). Replace it with a plain folder of your own, then restart OpenCode.`;
|
|
@@ -31821,7 +31946,7 @@ async function isVaultShapedKeptState(files) {
|
|
|
31821
31946
|
async function removeMovedVaultStateLeftover(vaultDir, accountFile) {
|
|
31822
31947
|
const location = runtimeLayoutLocation();
|
|
31823
31948
|
const files = layoutFiles(location, accountFile);
|
|
31824
|
-
if (
|
|
31949
|
+
if (resolve14(vaultDir) !== resolve14(files.vault.next)) return;
|
|
31825
31950
|
const stateDir = location.stateHomeDir;
|
|
31826
31951
|
const marker = await readMarker(
|
|
31827
31952
|
join13(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
@@ -32249,7 +32374,7 @@ import {
|
|
|
32249
32374
|
writeFileSync
|
|
32250
32375
|
} from "node:fs";
|
|
32251
32376
|
import { homedir as homedir4 } from "node:os";
|
|
32252
|
-
import { dirname as dirname16, join as join14, resolve as
|
|
32377
|
+
import { dirname as dirname16, join as join14, resolve as resolve15 } from "node:path";
|
|
32253
32378
|
async function ensureGitignore(configDir) {
|
|
32254
32379
|
const gitignorePath = join14(configDir, ".gitignore");
|
|
32255
32380
|
try {
|
|
@@ -32349,8 +32474,8 @@ function migrateLegacyWindowsConfig() {
|
|
|
32349
32474
|
}
|
|
32350
32475
|
}
|
|
32351
32476
|
function resolveWindowsAccountAnchor(newPath, legacyPath) {
|
|
32352
|
-
const standard =
|
|
32353
|
-
const legacy =
|
|
32477
|
+
const standard = resolve15(newPath);
|
|
32478
|
+
const legacy = resolve15(legacyPath);
|
|
32354
32479
|
if (standard.toLowerCase() === legacy.toLowerCase()) return newPath;
|
|
32355
32480
|
const standardPointer = existsSync3(accountStorePointerPath(standard));
|
|
32356
32481
|
const legacyPointer = existsSync3(accountStorePointerPath(legacy));
|
|
@@ -32372,7 +32497,7 @@ function getStoragePathWithMigration() {
|
|
|
32372
32497
|
"antigravity-accounts.json"
|
|
32373
32498
|
);
|
|
32374
32499
|
const anchored = resolveWindowsAccountAnchor(newPath, legacyPath);
|
|
32375
|
-
if (
|
|
32500
|
+
if (resolve15(anchored).toLowerCase() !== resolve15(newPath).toLowerCase() && !existsSync3(accountStorePointerPath(resolve15(anchored)))) {
|
|
32376
32501
|
log5.info("Using legacy Windows config path (migration failed)", {
|
|
32377
32502
|
legacyPath,
|
|
32378
32503
|
newPath
|
|
@@ -32389,7 +32514,7 @@ function accountFileForVault(configDir = getConfigDir()) {
|
|
|
32389
32514
|
const configured = join14(configDir, "antigravity-accounts.json");
|
|
32390
32515
|
if (process.platform !== "win32") return configured;
|
|
32391
32516
|
const legacyDir = getLegacyWindowsConfigDir();
|
|
32392
|
-
if (
|
|
32517
|
+
if (resolve15(configDir).toLowerCase() === resolve15(legacyDir).toLowerCase())
|
|
32393
32518
|
return configured;
|
|
32394
32519
|
const configuredVault = join14(configDir, "antigravity-auth-vault");
|
|
32395
32520
|
const legacyVault = join14(legacyDir, "antigravity-auth-vault");
|
|
@@ -32420,7 +32545,7 @@ function getStoragePath() {
|
|
|
32420
32545
|
}
|
|
32421
32546
|
async function assertLegacyPoolInUse(legacyPath) {
|
|
32422
32547
|
try {
|
|
32423
|
-
await assertLegacyAccountStorageWritable(
|
|
32548
|
+
await assertLegacyAccountStorageWritable(resolve15(legacyPath));
|
|
32424
32549
|
} catch (error) {
|
|
32425
32550
|
throw new LegacyAccountPoolRetiredError(legacyPath, { cause: error });
|
|
32426
32551
|
}
|
|
@@ -32438,7 +32563,7 @@ function refusalMessage2(admission) {
|
|
|
32438
32563
|
async function bindingOf(options) {
|
|
32439
32564
|
if (options.legacyPath === void 0) await prepareLocalAccountStore();
|
|
32440
32565
|
const now = options.now ?? (() => Date.now());
|
|
32441
|
-
const legacyPath =
|
|
32566
|
+
const legacyPath = resolve15(options.legacyPath ?? getStoragePath());
|
|
32442
32567
|
return {
|
|
32443
32568
|
legacyPath,
|
|
32444
32569
|
now,
|
|
@@ -32507,7 +32632,7 @@ async function openAccountStore(options) {
|
|
|
32507
32632
|
async function initializeFreshAccountStoreFor(modules, options = {}) {
|
|
32508
32633
|
if (options.legacyPath === void 0) await prepareLocalAccountStore();
|
|
32509
32634
|
return initializeFreshAccountStore(modules, {
|
|
32510
|
-
legacyPath:
|
|
32635
|
+
legacyPath: resolve15(options.legacyPath ?? getStoragePath()),
|
|
32511
32636
|
now: options.now ?? (() => Date.now())
|
|
32512
32637
|
});
|
|
32513
32638
|
}
|
|
@@ -32585,12 +32710,12 @@ var init_storage = __esm({
|
|
|
32585
32710
|
import { createHash as createHash12 } from "node:crypto";
|
|
32586
32711
|
import { existsSync as existsSync4, promises as fs2, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
32587
32712
|
import { homedir as homedir5 } from "node:os";
|
|
32588
|
-
import { dirname as dirname17, join as join15, resolve as
|
|
32713
|
+
import { dirname as dirname17, join as join15, resolve as resolve16 } from "node:path";
|
|
32589
32714
|
function configDirIdentity(path5) {
|
|
32590
32715
|
try {
|
|
32591
32716
|
return realpathSync2.native(path5);
|
|
32592
32717
|
} catch {
|
|
32593
|
-
return
|
|
32718
|
+
return resolve16(path5);
|
|
32594
32719
|
}
|
|
32595
32720
|
}
|
|
32596
32721
|
function decisionKey(location) {
|
|
@@ -33043,13 +33168,13 @@ function closeDebugStream(state) {
|
|
|
33043
33168
|
state.logWriter = () => {
|
|
33044
33169
|
};
|
|
33045
33170
|
if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
|
|
33046
|
-
return new Promise((
|
|
33047
|
-
current.once("close", () =>
|
|
33048
|
-
current.once("error", () =>
|
|
33171
|
+
return new Promise((resolve27) => {
|
|
33172
|
+
current.once("close", () => resolve27());
|
|
33173
|
+
current.once("error", () => resolve27());
|
|
33049
33174
|
try {
|
|
33050
33175
|
current.end();
|
|
33051
33176
|
} catch {
|
|
33052
|
-
|
|
33177
|
+
resolve27();
|
|
33053
33178
|
}
|
|
33054
33179
|
});
|
|
33055
33180
|
}
|
|
@@ -33314,13 +33439,13 @@ function closeDebugLog() {
|
|
|
33314
33439
|
if (!state || !current) return Promise.resolve();
|
|
33315
33440
|
state.logStream = null;
|
|
33316
33441
|
if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
|
|
33317
|
-
return new Promise((
|
|
33318
|
-
current.once("close", () =>
|
|
33319
|
-
current.once("error", () =>
|
|
33442
|
+
return new Promise((resolve27) => {
|
|
33443
|
+
current.once("close", () => resolve27());
|
|
33444
|
+
current.once("error", () => resolve27());
|
|
33320
33445
|
try {
|
|
33321
33446
|
current.end();
|
|
33322
33447
|
} catch {
|
|
33323
|
-
|
|
33448
|
+
resolve27();
|
|
33324
33449
|
}
|
|
33325
33450
|
});
|
|
33326
33451
|
}
|
|
@@ -33437,10 +33562,10 @@ function createLocationLogger(options) {
|
|
|
33437
33562
|
const engine = createLoggerInstance2({
|
|
33438
33563
|
level: () => configuredLevel,
|
|
33439
33564
|
extraSecretKeys: isProviderSecretKey,
|
|
33440
|
-
captureSink: ({ channel, level, message, data }) => {
|
|
33565
|
+
captureSink: ({ channel: channel3, level, message, data }) => {
|
|
33441
33566
|
const extra = data !== null && typeof data === "object" && !Array.isArray(data) ? Object.fromEntries(Object.entries(data)) : void 0;
|
|
33442
33567
|
emit({
|
|
33443
|
-
service:
|
|
33568
|
+
service: channel3,
|
|
33444
33569
|
level: level === "trace" ? "debug" : level,
|
|
33445
33570
|
message,
|
|
33446
33571
|
extra
|
|
@@ -33449,12 +33574,12 @@ function createLocationLogger(options) {
|
|
|
33449
33574
|
});
|
|
33450
33575
|
return {
|
|
33451
33576
|
createLogger(module) {
|
|
33452
|
-
const
|
|
33577
|
+
const channel3 = engine.createLogger(`antigravity.${module}`);
|
|
33453
33578
|
return {
|
|
33454
|
-
debug: (message, extra) =>
|
|
33455
|
-
info: (message, extra) =>
|
|
33456
|
-
warn: (message, extra) =>
|
|
33457
|
-
error: (message, extra) =>
|
|
33579
|
+
debug: (message, extra) => channel3.debug(message, extra),
|
|
33580
|
+
info: (message, extra) => channel3.info(message, extra),
|
|
33581
|
+
warn: (message, extra) => channel3.warn(message, extra),
|
|
33582
|
+
error: (message, extra) => channel3.error(message, extra)
|
|
33458
33583
|
};
|
|
33459
33584
|
},
|
|
33460
33585
|
setLevel(level) {
|
|
@@ -33495,10 +33620,10 @@ function initLogger3(client) {
|
|
|
33495
33620
|
setLogSink(getLegacyLogger().coreLogSink);
|
|
33496
33621
|
}
|
|
33497
33622
|
function createLogger4(module) {
|
|
33498
|
-
let
|
|
33623
|
+
let channel3;
|
|
33499
33624
|
const log16 = (level, message, extra) => {
|
|
33500
|
-
|
|
33501
|
-
|
|
33625
|
+
channel3 ??= getLegacyLogger().createLogger(module);
|
|
33626
|
+
channel3[level](message, extra);
|
|
33502
33627
|
};
|
|
33503
33628
|
return {
|
|
33504
33629
|
debug: (message, extra) => log16("debug", message, extra),
|
|
@@ -34787,7 +34912,7 @@ init_runtime_paths();
|
|
|
34787
34912
|
init_logger4();
|
|
34788
34913
|
import { existsSync as existsSync5, readFileSync as readFileSync3, realpathSync as realpathSync3 } from "node:fs";
|
|
34789
34914
|
import { homedir as homedir6 } from "node:os";
|
|
34790
|
-
import { basename as basename5, dirname as dirname18, join as join17, resolve as
|
|
34915
|
+
import { basename as basename5, dirname as dirname18, join as join17, resolve as resolve17 } from "node:path";
|
|
34791
34916
|
|
|
34792
34917
|
// src/plugin/config/schema.ts
|
|
34793
34918
|
import { z } from "zod";
|
|
@@ -35361,7 +35486,7 @@ function createLocationConfig(directory, options) {
|
|
|
35361
35486
|
};
|
|
35362
35487
|
}
|
|
35363
35488
|
function canonicalizeOwnedPath(path5) {
|
|
35364
|
-
const absolute =
|
|
35489
|
+
const absolute = resolve17(path5);
|
|
35365
35490
|
const missing = [];
|
|
35366
35491
|
let current = absolute;
|
|
35367
35492
|
for (; ; ) {
|
|
@@ -35740,7 +35865,7 @@ function createStoreAccountLimits(input2) {
|
|
|
35740
35865
|
|
|
35741
35866
|
// src/plugin/ga-shared-vault-custody.ts
|
|
35742
35867
|
init_dist();
|
|
35743
|
-
import { resolve as
|
|
35868
|
+
import { resolve as resolve18 } from "node:path";
|
|
35744
35869
|
|
|
35745
35870
|
// src/sidebar-state.ts
|
|
35746
35871
|
init_atomic_write();
|
|
@@ -36156,7 +36281,7 @@ function drainSidebarWrites() {
|
|
|
36156
36281
|
return sidebarWriteChain;
|
|
36157
36282
|
}
|
|
36158
36283
|
async function sleep3(ms) {
|
|
36159
|
-
await new Promise((
|
|
36284
|
+
await new Promise((resolve27) => setTimeout(resolve27, ms));
|
|
36160
36285
|
}
|
|
36161
36286
|
async function acquireSidebarLockWithRetry(stateFile) {
|
|
36162
36287
|
const start = Date.now();
|
|
@@ -36715,14 +36840,14 @@ var LocalQuotaGrantStaleError = class extends Error {
|
|
|
36715
36840
|
name = "LocalQuotaGrantStaleError";
|
|
36716
36841
|
};
|
|
36717
36842
|
function untilQuotaAborted(pending, signal) {
|
|
36718
|
-
return new Promise((
|
|
36843
|
+
return new Promise((resolve27, reject) => {
|
|
36719
36844
|
const abort = () => reject(signal.reason);
|
|
36720
36845
|
if (signal.aborted) abort();
|
|
36721
36846
|
else signal.addEventListener("abort", abort, { once: true });
|
|
36722
36847
|
void pending.then(
|
|
36723
36848
|
(value) => {
|
|
36724
36849
|
signal.removeEventListener("abort", abort);
|
|
36725
|
-
|
|
36850
|
+
resolve27(value);
|
|
36726
36851
|
},
|
|
36727
36852
|
(error) => {
|
|
36728
36853
|
signal.removeEventListener("abort", abort);
|
|
@@ -37617,7 +37742,7 @@ init_vault_request_credentials();
|
|
|
37617
37742
|
init_vault_custody();
|
|
37618
37743
|
var shared3 = /* @__PURE__ */ new Map();
|
|
37619
37744
|
function acquireGaVaultCustody(options) {
|
|
37620
|
-
const key = options.layoutRefusal === void 0 ?
|
|
37745
|
+
const key = options.layoutRefusal === void 0 ? resolve18(options.vaultDir) : `unsettled\0${resolve18(options.vaultDir)}`;
|
|
37621
37746
|
let entry = shared3.get(key);
|
|
37622
37747
|
if (!entry) {
|
|
37623
37748
|
const leases = /* @__PURE__ */ new Set();
|
|
@@ -43249,12 +43374,12 @@ async function startOAuthListener({
|
|
|
43249
43374
|
let resolveCallback;
|
|
43250
43375
|
let rejectCallback;
|
|
43251
43376
|
let timeoutHandle;
|
|
43252
|
-
const callbackPromise = new Promise((
|
|
43377
|
+
const callbackPromise = new Promise((resolve27, reject) => {
|
|
43253
43378
|
resolveCallback = (url) => {
|
|
43254
43379
|
if (settled) return;
|
|
43255
43380
|
settled = true;
|
|
43256
43381
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
43257
|
-
|
|
43382
|
+
resolve27(url);
|
|
43258
43383
|
};
|
|
43259
43384
|
rejectCallback = (error) => {
|
|
43260
43385
|
if (settled) return;
|
|
@@ -43413,7 +43538,7 @@ async function startOAuthListener({
|
|
|
43413
43538
|
});
|
|
43414
43539
|
});
|
|
43415
43540
|
const bindAddress = getBindAddress();
|
|
43416
|
-
await new Promise((
|
|
43541
|
+
await new Promise((resolve27, reject) => {
|
|
43417
43542
|
const handleError = (error) => {
|
|
43418
43543
|
server.off("error", handleError);
|
|
43419
43544
|
if (error.code === "EADDRINUSE") {
|
|
@@ -43429,7 +43554,7 @@ async function startOAuthListener({
|
|
|
43429
43554
|
server.once("error", handleError);
|
|
43430
43555
|
server.listen(port, bindAddress, () => {
|
|
43431
43556
|
server.off("error", handleError);
|
|
43432
|
-
|
|
43557
|
+
resolve27();
|
|
43433
43558
|
});
|
|
43434
43559
|
});
|
|
43435
43560
|
server.on("error", (error) => {
|
|
@@ -43437,7 +43562,7 @@ async function startOAuthListener({
|
|
|
43437
43562
|
});
|
|
43438
43563
|
return {
|
|
43439
43564
|
waitForCallback: () => callbackPromise,
|
|
43440
|
-
close: () => new Promise((
|
|
43565
|
+
close: () => new Promise((resolve27, reject) => {
|
|
43441
43566
|
server.close((error) => {
|
|
43442
43567
|
if (error && error.code !== "ERR_SERVER_NOT_RUNNING") {
|
|
43443
43568
|
reject(error);
|
|
@@ -43446,7 +43571,7 @@ async function startOAuthListener({
|
|
|
43446
43571
|
if (!settled) {
|
|
43447
43572
|
rejectCallback(new Error("OAuth listener closed before callback"));
|
|
43448
43573
|
}
|
|
43449
|
-
|
|
43574
|
+
resolve27();
|
|
43450
43575
|
});
|
|
43451
43576
|
})
|
|
43452
43577
|
};
|
|
@@ -43457,7 +43582,7 @@ async function startOAuthListener({
|
|
|
43457
43582
|
}
|
|
43458
43583
|
|
|
43459
43584
|
// src/plugin/session-context.ts
|
|
43460
|
-
import { resolve as
|
|
43585
|
+
import { resolve as resolve19 } from "node:path";
|
|
43461
43586
|
import { pathToFileURL } from "node:url";
|
|
43462
43587
|
var FALLBACK_SESSION_KEY = "__default__";
|
|
43463
43588
|
function extractOpenCodeSessionIdentity(headers) {
|
|
@@ -43471,7 +43596,7 @@ var AgySessionRegistry = class {
|
|
|
43471
43596
|
requestSessions;
|
|
43472
43597
|
parentSessionIds = /* @__PURE__ */ new Map();
|
|
43473
43598
|
constructor(directory, options = {}) {
|
|
43474
|
-
const workspaceUri = directory ? pathToFileURL(
|
|
43599
|
+
const workspaceUri = directory ? pathToFileURL(resolve19(directory)).href : "";
|
|
43475
43600
|
this.requestSessions = new AgyRequestSessionStore(workspaceUri, options);
|
|
43476
43601
|
}
|
|
43477
43602
|
getOrCreate(identity3) {
|
|
@@ -44100,10 +44225,10 @@ async function retainResponseLifetime(response, cancellation) {
|
|
|
44100
44225
|
cancellation.release();
|
|
44101
44226
|
throw error;
|
|
44102
44227
|
}
|
|
44103
|
-
let
|
|
44228
|
+
let resolve27 = () => {
|
|
44104
44229
|
};
|
|
44105
44230
|
const settled = new Promise((done) => {
|
|
44106
|
-
|
|
44231
|
+
resolve27 = done;
|
|
44107
44232
|
});
|
|
44108
44233
|
let stopping = false;
|
|
44109
44234
|
let finished = false;
|
|
@@ -44113,7 +44238,7 @@ async function retainResponseLifetime(response, cancellation) {
|
|
|
44113
44238
|
finished = true;
|
|
44114
44239
|
cancellation.signal.removeEventListener("abort", abort);
|
|
44115
44240
|
cancellation.release();
|
|
44116
|
-
|
|
44241
|
+
resolve27();
|
|
44117
44242
|
};
|
|
44118
44243
|
const abort = () => {
|
|
44119
44244
|
if (finished || stopping) return;
|
|
@@ -44182,8 +44307,8 @@ function createAfterHandoff(work, signals, onFailure) {
|
|
|
44182
44307
|
let running = false;
|
|
44183
44308
|
let resolveCompletion = () => {
|
|
44184
44309
|
};
|
|
44185
|
-
const completion = new Promise((
|
|
44186
|
-
resolveCompletion =
|
|
44310
|
+
const completion = new Promise((resolve27) => {
|
|
44311
|
+
resolveCompletion = resolve27;
|
|
44187
44312
|
});
|
|
44188
44313
|
const finish = () => {
|
|
44189
44314
|
if (finished) return;
|
|
@@ -44230,14 +44355,14 @@ function createAfterHandoff(work, signals, onFailure) {
|
|
|
44230
44355
|
};
|
|
44231
44356
|
}
|
|
44232
44357
|
function publishResponse(dispatch) {
|
|
44233
|
-
return new Promise((
|
|
44358
|
+
return new Promise((resolve27, reject) => {
|
|
44234
44359
|
let acknowledge;
|
|
44235
44360
|
void Promise.resolve().then(
|
|
44236
44361
|
() => dispatch((callback) => {
|
|
44237
44362
|
acknowledge = callback;
|
|
44238
44363
|
})
|
|
44239
44364
|
).then((response) => {
|
|
44240
|
-
|
|
44365
|
+
resolve27(response);
|
|
44241
44366
|
acknowledge?.();
|
|
44242
44367
|
}, reject);
|
|
44243
44368
|
});
|
|
@@ -44339,7 +44464,7 @@ function formatWaitTime(ms) {
|
|
|
44339
44464
|
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
44340
44465
|
}
|
|
44341
44466
|
function sleep4(ms, signal) {
|
|
44342
|
-
return new Promise((
|
|
44467
|
+
return new Promise((resolve27, reject) => {
|
|
44343
44468
|
if (signal?.aborted) {
|
|
44344
44469
|
reject(
|
|
44345
44470
|
signal.reason instanceof Error ? signal.reason : new Error("Aborted")
|
|
@@ -44348,7 +44473,7 @@ function sleep4(ms, signal) {
|
|
|
44348
44473
|
}
|
|
44349
44474
|
const timeout = setTimeout(() => {
|
|
44350
44475
|
cleanup2();
|
|
44351
|
-
|
|
44476
|
+
resolve27();
|
|
44352
44477
|
}, ms);
|
|
44353
44478
|
const onAbort = () => {
|
|
44354
44479
|
cleanup2();
|
|
@@ -47431,7 +47556,7 @@ function createGaReauthorize(input2) {
|
|
|
47431
47556
|
const continuations = /* @__PURE__ */ new Set();
|
|
47432
47557
|
const shutdown = new AbortController();
|
|
47433
47558
|
let disposed = false;
|
|
47434
|
-
const waitForRedirect = (code2) => new Promise((
|
|
47559
|
+
const waitForRedirect = (code2) => new Promise((resolve27, reject) => {
|
|
47435
47560
|
const detach = () => shutdown.signal.removeEventListener("abort", abort);
|
|
47436
47561
|
const abort = () => {
|
|
47437
47562
|
detach();
|
|
@@ -47442,7 +47567,7 @@ function createGaReauthorize(input2) {
|
|
|
47442
47567
|
void code2.then(
|
|
47443
47568
|
(value) => {
|
|
47444
47569
|
detach();
|
|
47445
|
-
|
|
47570
|
+
resolve27(value);
|
|
47446
47571
|
},
|
|
47447
47572
|
(error) => {
|
|
47448
47573
|
detach();
|
|
@@ -50103,11 +50228,11 @@ init_dist();
|
|
|
50103
50228
|
var GA_POOL_METHOD_ID = "antigravity-auth-pool-browser";
|
|
50104
50229
|
var LOGIN_FAILED = "The Antigravity pool login could not be completed.";
|
|
50105
50230
|
function abortable(pending, signal) {
|
|
50106
|
-
return new Promise((
|
|
50231
|
+
return new Promise((resolve27, reject) => {
|
|
50107
50232
|
const abort = () => reject(signal.reason);
|
|
50108
50233
|
if (signal.aborted) abort();
|
|
50109
50234
|
else signal.addEventListener("abort", abort, { once: true });
|
|
50110
|
-
void pending.then(
|
|
50235
|
+
void pending.then(resolve27, reject).finally(() => {
|
|
50111
50236
|
signal.removeEventListener("abort", abort);
|
|
50112
50237
|
});
|
|
50113
50238
|
});
|
|
@@ -50477,11 +50602,11 @@ async function startGaLoopbackBridge(options) {
|
|
|
50477
50602
|
}
|
|
50478
50603
|
}
|
|
50479
50604
|
};
|
|
50480
|
-
await new Promise((
|
|
50605
|
+
await new Promise((resolve27, reject) => {
|
|
50481
50606
|
server.once("error", reject);
|
|
50482
50607
|
server.listen(0, BRIDGE_HOST, () => {
|
|
50483
50608
|
server.off("error", reject);
|
|
50484
|
-
|
|
50609
|
+
resolve27();
|
|
50485
50610
|
});
|
|
50486
50611
|
});
|
|
50487
50612
|
server.unref();
|
|
@@ -50585,8 +50710,8 @@ async function startGaLoopbackBridge(options) {
|
|
|
50585
50710
|
disposal = (async () => {
|
|
50586
50711
|
for (const { timer } of queued.values()) clearTimeout(timer);
|
|
50587
50712
|
queued.clear();
|
|
50588
|
-
const closed2 = new Promise((
|
|
50589
|
-
server.close(() =>
|
|
50713
|
+
const closed2 = new Promise((resolve27) => {
|
|
50714
|
+
server.close(() => resolve27());
|
|
50590
50715
|
});
|
|
50591
50716
|
for (const controller of running) {
|
|
50592
50717
|
controller.abort(
|
|
@@ -50650,9 +50775,9 @@ async function pipeResponse(upstream, response, onFailure, onHandoff) {
|
|
|
50650
50775
|
return;
|
|
50651
50776
|
}
|
|
50652
50777
|
if (!response.write(value) && !response.destroyed) {
|
|
50653
|
-
await new Promise((
|
|
50654
|
-
response.once("drain",
|
|
50655
|
-
response.once("close",
|
|
50778
|
+
await new Promise((resolve27) => {
|
|
50779
|
+
response.once("drain", resolve27);
|
|
50780
|
+
response.once("close", resolve27);
|
|
50656
50781
|
});
|
|
50657
50782
|
}
|
|
50658
50783
|
if (response.destroyed) {
|
|
@@ -51323,13 +51448,13 @@ function createGaAntigravityPlugin(overrides = {}) {
|
|
|
51323
51448
|
// src/plugin/index.ts
|
|
51324
51449
|
init_dist();
|
|
51325
51450
|
import { createHash as createHash23, randomUUID as randomUUID22 } from "node:crypto";
|
|
51326
|
-
import { join as join38, resolve as
|
|
51451
|
+
import { join as join38, resolve as resolve26 } from "node:path";
|
|
51327
51452
|
|
|
51328
51453
|
// src/cli.ts
|
|
51329
51454
|
init_dist();
|
|
51330
51455
|
import { execFile } from "node:child_process";
|
|
51331
51456
|
import { realpathSync as realpathSync5 } from "node:fs";
|
|
51332
|
-
import { resolve as
|
|
51457
|
+
import { resolve as resolve23 } from "node:path";
|
|
51333
51458
|
import { createInterface } from "node:readline/promises";
|
|
51334
51459
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
51335
51460
|
import { promisify } from "node:util";
|
|
@@ -51386,7 +51511,7 @@ init_runtime_paths();
|
|
|
51386
51511
|
// src/setup.ts
|
|
51387
51512
|
init_dist();
|
|
51388
51513
|
import { lstat as lstat9, readFile as readFile16 } from "node:fs/promises";
|
|
51389
|
-
import { join as join29, resolve as
|
|
51514
|
+
import { join as join29, resolve as resolve22 } from "node:path";
|
|
51390
51515
|
|
|
51391
51516
|
// src/common-auth-embedded/auth-menu/ansi.js
|
|
51392
51517
|
var ANSI2 = {
|
|
@@ -51554,7 +51679,7 @@ async function select2(terminal, items, options) {
|
|
|
51554
51679
|
writeLine("");
|
|
51555
51680
|
renderedLines = lines;
|
|
51556
51681
|
};
|
|
51557
|
-
return new Promise((
|
|
51682
|
+
return new Promise((resolve27) => {
|
|
51558
51683
|
const wasRaw = stdin.isRaw ?? false;
|
|
51559
51684
|
const cleanup2 = () => {
|
|
51560
51685
|
if (cleaned)
|
|
@@ -51574,7 +51699,7 @@ async function select2(terminal, items, options) {
|
|
|
51574
51699
|
};
|
|
51575
51700
|
const finish = (value) => {
|
|
51576
51701
|
cleanup2();
|
|
51577
|
-
|
|
51702
|
+
resolve27(value);
|
|
51578
51703
|
};
|
|
51579
51704
|
const onSignal = () => finish(null);
|
|
51580
51705
|
const onKey = (data) => {
|
|
@@ -51614,7 +51739,7 @@ async function select2(terminal, items, options) {
|
|
|
51614
51739
|
stdin.setRawMode(true);
|
|
51615
51740
|
} catch {
|
|
51616
51741
|
cleanup2();
|
|
51617
|
-
|
|
51742
|
+
resolve27(null);
|
|
51618
51743
|
return;
|
|
51619
51744
|
}
|
|
51620
51745
|
stdin.resume();
|
|
@@ -51628,12 +51753,12 @@ async function select2(terminal, items, options) {
|
|
|
51628
51753
|
import { createHash as createHash18, randomBytes as randomBytes6, randomUUID as randomUUID19 } from "node:crypto";
|
|
51629
51754
|
import { constants as fsConstants2 } from "node:fs";
|
|
51630
51755
|
import { chmod as chmod6, mkdir as mkdir15, open as open10, readFile as readFile14, realpath as realpath4, rename as rename12, stat as stat11, unlink as unlink10 } from "node:fs/promises";
|
|
51631
|
-
import { basename as basename6, dirname as dirname22, extname as extname2, isAbsolute as isAbsolute3, join as join25, resolve as
|
|
51756
|
+
import { basename as basename6, dirname as dirname22, extname as extname2, isAbsolute as isAbsolute3, join as join25, resolve as resolve21 } from "node:path";
|
|
51632
51757
|
import { ClaustrumCredentialError as ClaustrumCredentialError5, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
|
|
51633
51758
|
|
|
51634
51759
|
// src/common-auth-embedded/fs/file-read-cache.js
|
|
51635
51760
|
import { lstat as lstat7 } from "node:fs/promises";
|
|
51636
|
-
import { resolve as
|
|
51761
|
+
import { resolve as resolve20 } from "node:path";
|
|
51637
51762
|
async function identity2(path5) {
|
|
51638
51763
|
try {
|
|
51639
51764
|
const metadata = await lstat7(path5);
|
|
@@ -51650,7 +51775,7 @@ function sameIdentity2(left, right) {
|
|
|
51650
51775
|
var FileReadCache2 = class {
|
|
51651
51776
|
#entries = /* @__PURE__ */ new Map();
|
|
51652
51777
|
async read(paths, read, validateHit) {
|
|
51653
|
-
const resolvedPaths = paths.map((path5) =>
|
|
51778
|
+
const resolvedPaths = paths.map((path5) => resolve20(path5));
|
|
51654
51779
|
const key = JSON.stringify(resolvedPaths);
|
|
51655
51780
|
const probed = await Promise.all(resolvedPaths.map(identity2));
|
|
51656
51781
|
const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
|
|
@@ -51770,8 +51895,8 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
51770
51895
|
let releaseConfirmed = false;
|
|
51771
51896
|
let loss;
|
|
51772
51897
|
let resolveLoss;
|
|
51773
|
-
const lostPromise = new Promise((
|
|
51774
|
-
resolveLoss =
|
|
51898
|
+
const lostPromise = new Promise((resolve27) => {
|
|
51899
|
+
resolveLoss = resolve27;
|
|
51775
51900
|
});
|
|
51776
51901
|
function notifyTimerStep(event) {
|
|
51777
51902
|
try {
|
|
@@ -51932,7 +52057,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
51932
52057
|
}
|
|
51933
52058
|
}
|
|
51934
52059
|
async function backoff() {
|
|
51935
|
-
await new Promise((
|
|
52060
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.floor(Math.random() * 4)));
|
|
51936
52061
|
}
|
|
51937
52062
|
async function readLockState(notifyReady = true) {
|
|
51938
52063
|
if (notifyReady && options.onStep)
|
|
@@ -52370,7 +52495,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
52370
52495
|
...typeof observed?.expiresAt === "number" ? { observedExpiresAt: observed.expiresAt } : {}
|
|
52371
52496
|
});
|
|
52372
52497
|
},
|
|
52373
|
-
release: async () => {
|
|
52498
|
+
release: async (signal) => {
|
|
52374
52499
|
if (windowsPrivateFiles2 && releaseConfirmed)
|
|
52375
52500
|
return;
|
|
52376
52501
|
released = true;
|
|
@@ -52411,6 +52536,8 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
52411
52536
|
releaseConfirmed = removalConfirmed;
|
|
52412
52537
|
return;
|
|
52413
52538
|
}
|
|
52539
|
+
if (signal?.aborted)
|
|
52540
|
+
return;
|
|
52414
52541
|
await recoverStaleEvictionMarker();
|
|
52415
52542
|
} catch (error) {
|
|
52416
52543
|
if (windowsPrivateFiles2)
|
|
@@ -52420,7 +52547,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
52420
52547
|
const remainingMs = deadline - performance.now();
|
|
52421
52548
|
if (remainingMs <= 0)
|
|
52422
52549
|
break;
|
|
52423
|
-
await new Promise((
|
|
52550
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(delayMs, remainingMs)));
|
|
52424
52551
|
delayMs = Math.min(delayMs * 2, 50);
|
|
52425
52552
|
}
|
|
52426
52553
|
if (windowsPrivateFiles2)
|
|
@@ -52493,7 +52620,7 @@ function hostEnrollmentPaths2(input2) {
|
|
|
52493
52620
|
const override = input2.override?.trim();
|
|
52494
52621
|
if (override && !isAbsolute3(override) && !input2.cwd)
|
|
52495
52622
|
throw new ClaustrumConsumerError2("invalid-state", "A relative Claustrum enrollment override needs a base directory");
|
|
52496
|
-
const tokenPath = override ? isAbsolute3(override) ? override :
|
|
52623
|
+
const tokenPath = override ? isAbsolute3(override) ? override : resolve21(input2.cwd, override) : join25(input2.stateDir, `${input2.host}-enrollment.json`);
|
|
52497
52624
|
return getClaustrumEnrollmentPaths2(tokenPath);
|
|
52498
52625
|
}
|
|
52499
52626
|
function isRecord11(value) {
|
|
@@ -53121,7 +53248,7 @@ var ByteTail = class {
|
|
|
53121
53248
|
};
|
|
53122
53249
|
var defaultCommandRunner = {
|
|
53123
53250
|
run(file, args, options = {}) {
|
|
53124
|
-
return new Promise((
|
|
53251
|
+
return new Promise((resolve27) => {
|
|
53125
53252
|
const started = performance.now();
|
|
53126
53253
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
53127
53254
|
const stderr = new ByteTail();
|
|
@@ -53139,7 +53266,7 @@ var defaultCommandRunner = {
|
|
|
53139
53266
|
stdio: ["ignore", "pipe", "pipe"]
|
|
53140
53267
|
});
|
|
53141
53268
|
} catch {
|
|
53142
|
-
|
|
53269
|
+
resolve27({
|
|
53143
53270
|
exitCode: 1,
|
|
53144
53271
|
stdout: "",
|
|
53145
53272
|
stderr: "",
|
|
@@ -53174,7 +53301,7 @@ var defaultCommandRunner = {
|
|
|
53174
53301
|
settled = true;
|
|
53175
53302
|
if (timer)
|
|
53176
53303
|
clearTimeout(timer);
|
|
53177
|
-
|
|
53304
|
+
resolve27({
|
|
53178
53305
|
exitCode: spawnError ? 1 : outputExceeded ? 1 : code2 ?? 1,
|
|
53179
53306
|
stdout: Buffer.concat(stdout, stdoutLength).toString("utf8"),
|
|
53180
53307
|
stderr: stderr.toString(),
|
|
@@ -54576,7 +54703,7 @@ async function writeNativeSlot(host, slot, context, expectedAuthority = "local")
|
|
|
54576
54703
|
beforeRename: async () => {
|
|
54577
54704
|
await assertSetupHostsStopped();
|
|
54578
54705
|
const claustrum = await loadCommonAuthClaustrum();
|
|
54579
|
-
const stateDir = host === "opencode" ? openCodeVaultDir(
|
|
54706
|
+
const stateDir = host === "opencode" ? openCodeVaultDir(resolve22(accountFileForVault())) : getPiAntigravityVaultDir();
|
|
54580
54707
|
if (await claustrum.enrollmentAuthority(
|
|
54581
54708
|
claustrum.hostEnrollmentPaths({ stateDir, host }),
|
|
54582
54709
|
`antigravity-auth-${host}`
|
|
@@ -54614,7 +54741,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
54614
54741
|
// `beforeSignIn`, which may move it after this plugin is built.
|
|
54615
54742
|
paths: {
|
|
54616
54743
|
get stateDir() {
|
|
54617
|
-
return openCodeVaultDir(
|
|
54744
|
+
return openCodeVaultDir(resolve22(accountFileForVault()));
|
|
54618
54745
|
},
|
|
54619
54746
|
host: "opencode"
|
|
54620
54747
|
}
|
|
@@ -54631,7 +54758,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
54631
54758
|
const assertLocal = async (host, context) => {
|
|
54632
54759
|
if (host === "opencode")
|
|
54633
54760
|
return assertLocalOpenCodeLogin(
|
|
54634
|
-
|
|
54761
|
+
resolve22(accountFileForVault()),
|
|
54635
54762
|
context.opencodeGeneration
|
|
54636
54763
|
);
|
|
54637
54764
|
if (await authority(host) !== "local")
|
|
@@ -55261,7 +55388,7 @@ async function runCliProcess(argv, deps) {
|
|
|
55261
55388
|
...deps,
|
|
55262
55389
|
prepareVaultFolder: deps.prepareVaultFolder ?? (async (options) => {
|
|
55263
55390
|
const folder = await prepareVaultFolder({
|
|
55264
|
-
accountFile:
|
|
55391
|
+
accountFile: resolve23(accountFileForVault()),
|
|
55265
55392
|
...options
|
|
55266
55393
|
});
|
|
55267
55394
|
if (folder.refusal) throw folder.refusal;
|
|
@@ -55307,11 +55434,11 @@ function createDefaultCliDependencies() {
|
|
|
55307
55434
|
);
|
|
55308
55435
|
if (host !== "pi")
|
|
55309
55436
|
await assertLocalOpenCodeLogin(
|
|
55310
|
-
|
|
55437
|
+
resolve23(accountFileForVault()),
|
|
55311
55438
|
context?.opencodeGeneration
|
|
55312
55439
|
);
|
|
55313
55440
|
const repository = host === "pi" ? void 0 : await prepareCliLoginStore(
|
|
55314
|
-
|
|
55441
|
+
resolve23(getStoragePath()),
|
|
55315
55442
|
context?.opencodeGeneration
|
|
55316
55443
|
);
|
|
55317
55444
|
try {
|
|
@@ -55327,7 +55454,7 @@ function createDefaultCliDependencies() {
|
|
|
55327
55454
|
}
|
|
55328
55455
|
if (host === "opencode") await assertSetupHostsStopped();
|
|
55329
55456
|
await assertLocalOpenCodeLogin(
|
|
55330
|
-
|
|
55457
|
+
resolve23(accountFileForVault()),
|
|
55331
55458
|
context?.opencodeGeneration
|
|
55332
55459
|
);
|
|
55333
55460
|
await persistCliStoreLogin(
|
|
@@ -55347,7 +55474,7 @@ function createDefaultCliDependencies() {
|
|
|
55347
55474
|
};
|
|
55348
55475
|
}
|
|
55349
55476
|
async function prepareCliLoginStore(legacyPath, generation) {
|
|
55350
|
-
await assertLocalOpenCodeLogin(
|
|
55477
|
+
await assertLocalOpenCodeLogin(resolve23(accountFileForVault()), generation);
|
|
55351
55478
|
const modules = await loadCommonAuthStoreModules();
|
|
55352
55479
|
const options = {
|
|
55353
55480
|
legacyPath,
|
|
@@ -55472,7 +55599,7 @@ async function readAccountStore(legacyPath) {
|
|
|
55472
55599
|
function createDefaultAccountStoreOperations() {
|
|
55473
55600
|
const offline = { processesStopped: true };
|
|
55474
55601
|
return {
|
|
55475
|
-
legacyPath: () =>
|
|
55602
|
+
legacyPath: () => resolve23(
|
|
55476
55603
|
decidedAccountStoreAnchor(runtimeLayoutLocation()) ? getStoragePath() : discoveredAccountFile()
|
|
55477
55604
|
),
|
|
55478
55605
|
migrate: async (legacyPath) => createAccountMigrationFactory(await loadCommonAuthStoreModules())({
|
|
@@ -55503,7 +55630,7 @@ function createDefaultAccountStoreOperations() {
|
|
|
55503
55630
|
};
|
|
55504
55631
|
}
|
|
55505
55632
|
function samePath(left, right) {
|
|
55506
|
-
return process.platform === "win32" ?
|
|
55633
|
+
return process.platform === "win32" ? resolve23(left).toLowerCase() === resolve23(right).toLowerCase() : resolve23(left) === resolve23(right);
|
|
55507
55634
|
}
|
|
55508
55635
|
function isCliEntry() {
|
|
55509
55636
|
if (import.meta.main !== void 0) return import.meta.main;
|
|
@@ -55993,14 +56120,14 @@ function isTuiConnected(sessionId) {
|
|
|
55993
56120
|
// src/rpc/rpc-dir.ts
|
|
55994
56121
|
import { createHash as createHash19 } from "node:crypto";
|
|
55995
56122
|
import { homedir as homedir13, tmpdir as tmpdir6 } from "node:os";
|
|
55996
|
-
import { isAbsolute as isAbsolute4, join as join33, resolve as
|
|
56123
|
+
import { isAbsolute as isAbsolute4, join as join33, resolve as resolve24 } from "node:path";
|
|
55997
56124
|
var RPC_DIR_ENV = "ANTIGRAVITY_AUTH_RPC_DIR";
|
|
55998
56125
|
function getRpcDir(projectDirectory) {
|
|
55999
56126
|
const override = process.env[RPC_DIR_ENV]?.trim();
|
|
56000
56127
|
if (override) {
|
|
56001
|
-
return isAbsolute4(override) ? override :
|
|
56128
|
+
return isAbsolute4(override) ? override : resolve24(projectDirectory, override);
|
|
56002
56129
|
}
|
|
56003
|
-
const projectHash = createHash19("sha256").update(
|
|
56130
|
+
const projectHash = createHash19("sha256").update(resolve24(projectDirectory)).digest("hex").slice(0, 16);
|
|
56004
56131
|
const stateHome = process.env.XDG_STATE_HOME ?? join33(homedir13(), ".local", "state");
|
|
56005
56132
|
return join33(stateHome, "cortexkit", "antigravity-auth", "rpc", projectHash);
|
|
56006
56133
|
}
|
|
@@ -56014,7 +56141,7 @@ function isSessionId(value) {
|
|
|
56014
56141
|
init_private_files2();
|
|
56015
56142
|
import { createHash as createHash20, randomUUID as randomUUID21 } from "node:crypto";
|
|
56016
56143
|
import { chmod as chmod7, mkdir as mkdir17, open as open12, readdir as readdir4, rename as rename14, rmdir as rmdir3, stat as stat14, unlink as unlink12 } from "node:fs/promises";
|
|
56017
|
-
import { join as join34, resolve as
|
|
56144
|
+
import { join as join34, resolve as resolve25 } from "node:path";
|
|
56018
56145
|
function isProbeablePid(pid) {
|
|
56019
56146
|
return typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0;
|
|
56020
56147
|
}
|
|
@@ -56101,7 +56228,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log16) {
|
|
|
56101
56228
|
return;
|
|
56102
56229
|
throw error;
|
|
56103
56230
|
}
|
|
56104
|
-
const active2 =
|
|
56231
|
+
const active2 = resolve25(activeDir);
|
|
56105
56232
|
for (const projectDir of projectDirs) {
|
|
56106
56233
|
if (!projectDir.isDirectory() || !isManagedDir(projectDir.name)) {
|
|
56107
56234
|
continue;
|
|
@@ -56145,7 +56272,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log16) {
|
|
|
56145
56272
|
await unlink12(portFile).catch(() => {
|
|
56146
56273
|
});
|
|
56147
56274
|
}
|
|
56148
|
-
if (
|
|
56275
|
+
if (resolve25(dir) !== active2)
|
|
56149
56276
|
await rmdir3(dir).catch(() => {
|
|
56150
56277
|
});
|
|
56151
56278
|
}
|
|
@@ -56179,7 +56306,7 @@ var BodyTooLargeError = class extends Error {
|
|
|
56179
56306
|
}
|
|
56180
56307
|
};
|
|
56181
56308
|
function readBody(req) {
|
|
56182
|
-
return new Promise((
|
|
56309
|
+
return new Promise((resolve27, reject) => {
|
|
56183
56310
|
const tooLarge = (declaredOversize = false) => {
|
|
56184
56311
|
req.removeAllListeners("data");
|
|
56185
56312
|
req.on("data", () => {
|
|
@@ -56202,7 +56329,7 @@ function readBody(req) {
|
|
|
56202
56329
|
}
|
|
56203
56330
|
chunks.push(chunk);
|
|
56204
56331
|
});
|
|
56205
|
-
req.on("end", () =>
|
|
56332
|
+
req.on("end", () => resolve27(Buffer.concat(chunks).toString("utf8")));
|
|
56206
56333
|
req.on("error", reject);
|
|
56207
56334
|
});
|
|
56208
56335
|
}
|
|
@@ -56381,12 +56508,12 @@ async function startRpcServer(options) {
|
|
|
56381
56508
|
json(500, { error: "internal error" });
|
|
56382
56509
|
}
|
|
56383
56510
|
}
|
|
56384
|
-
const port = await new Promise((
|
|
56511
|
+
const port = await new Promise((resolve27, reject) => {
|
|
56385
56512
|
server.on("error", reject);
|
|
56386
56513
|
server.listen(0, "127.0.0.1", () => {
|
|
56387
56514
|
const addr = server.address();
|
|
56388
56515
|
if (addr && typeof addr === "object")
|
|
56389
|
-
|
|
56516
|
+
resolve27(addr.port);
|
|
56390
56517
|
else
|
|
56391
56518
|
reject(new Error("no port"));
|
|
56392
56519
|
});
|
|
@@ -56409,16 +56536,16 @@ async function startRpcServer(options) {
|
|
|
56409
56536
|
rpcPort: port
|
|
56410
56537
|
});
|
|
56411
56538
|
} catch (error) {
|
|
56412
|
-
await new Promise((
|
|
56539
|
+
await new Promise((resolve27) => server.close(() => resolve27()));
|
|
56413
56540
|
throw error;
|
|
56414
56541
|
}
|
|
56415
56542
|
return {
|
|
56416
56543
|
port,
|
|
56417
56544
|
token,
|
|
56418
56545
|
async stop() {
|
|
56419
|
-
await new Promise((
|
|
56546
|
+
await new Promise((resolve27) => {
|
|
56420
56547
|
server.closeAllConnections?.();
|
|
56421
|
-
server.close(() =>
|
|
56548
|
+
server.close(() => resolve27());
|
|
56422
56549
|
for (const socket of connections)
|
|
56423
56550
|
socket.destroy();
|
|
56424
56551
|
});
|
|
@@ -57024,7 +57151,7 @@ async function select3(items, options) {
|
|
|
57024
57151
|
}
|
|
57025
57152
|
renderedLines = linesWritten;
|
|
57026
57153
|
};
|
|
57027
|
-
return new Promise((
|
|
57154
|
+
return new Promise((resolve27) => {
|
|
57028
57155
|
const wasRaw = stdin.isRaw ?? false;
|
|
57029
57156
|
const cleanup2 = () => {
|
|
57030
57157
|
if (isCleanedUp) return;
|
|
@@ -57045,11 +57172,11 @@ async function select3(items, options) {
|
|
|
57045
57172
|
};
|
|
57046
57173
|
const onSignal = () => {
|
|
57047
57174
|
cleanup2();
|
|
57048
|
-
|
|
57175
|
+
resolve27(null);
|
|
57049
57176
|
};
|
|
57050
57177
|
const finishWithValue = (value) => {
|
|
57051
57178
|
cleanup2();
|
|
57052
|
-
|
|
57179
|
+
resolve27(value);
|
|
57053
57180
|
};
|
|
57054
57181
|
const findNextSelectable = (from, direction) => {
|
|
57055
57182
|
if (items.length === 0) return from;
|
|
@@ -57095,7 +57222,7 @@ async function select3(items, options) {
|
|
|
57095
57222
|
stdin.setRawMode(true);
|
|
57096
57223
|
} catch {
|
|
57097
57224
|
cleanup2();
|
|
57098
|
-
|
|
57225
|
+
resolve27(null);
|
|
57099
57226
|
return;
|
|
57100
57227
|
}
|
|
57101
57228
|
stdin.resume();
|
|
@@ -60099,10 +60226,10 @@ function resolvePluginDependencies(overrides = {}) {
|
|
|
60099
60226
|
}
|
|
60100
60227
|
async function defaultSleep(ms, signal) {
|
|
60101
60228
|
if (ms <= 0) return;
|
|
60102
|
-
await new Promise((
|
|
60229
|
+
await new Promise((resolve27, reject) => {
|
|
60103
60230
|
const timer = setTimeout(() => {
|
|
60104
60231
|
signal?.removeEventListener("abort", onAbort);
|
|
60105
|
-
|
|
60232
|
+
resolve27();
|
|
60106
60233
|
}, ms);
|
|
60107
60234
|
timer.unref?.();
|
|
60108
60235
|
const onAbort = () => {
|
|
@@ -60822,8 +60949,8 @@ function createPluginLifecycle(options) {
|
|
|
60822
60949
|
};
|
|
60823
60950
|
let failDisposal = () => {
|
|
60824
60951
|
};
|
|
60825
|
-
disposal = new Promise((
|
|
60826
|
-
finishDisposal =
|
|
60952
|
+
disposal = new Promise((resolve27, reject) => {
|
|
60953
|
+
finishDisposal = resolve27;
|
|
60827
60954
|
failDisposal = reject;
|
|
60828
60955
|
});
|
|
60829
60956
|
void (async () => {
|
|
@@ -60972,7 +61099,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
60972
61099
|
await drainSidebarWrites();
|
|
60973
61100
|
}
|
|
60974
61101
|
});
|
|
60975
|
-
const accountFile =
|
|
61102
|
+
const accountFile = resolve26(accountFileForVault());
|
|
60976
61103
|
const vaultFolder = await prepareVaultFolder({ accountFile });
|
|
60977
61104
|
const unavailableMessage = vaultFolder.refusal?.message ?? VAULT_ACCOUNT_REMEDY;
|
|
60978
61105
|
let vaultQuotaPoller;
|