@cortexkit/opencode-antigravity-auth 3.0.17 → 3.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +59 -23
- package/dist/cli.js.map +2 -2
- package/dist/cli.meta.json +8 -8
- package/dist/index.js +66 -30
- package/dist/index.js.map +2 -2
- package/dist/index.meta.json +15 -15
- package/dist/server.js +66 -30
- package/dist/server.js.map +2 -2
- package/dist/server.meta.json +1 -1
- package/dist/src/plugin/config/schema.js +4 -4
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +4 -5
- package/dist/src/plugin/config/writer.d.ts.map +1 -1
- package/dist/src/plugin/config/writer.js +4 -5
- package/dist/src/plugin/config/writer.js.map +1 -1
- package/dist/src/plugin/errors.js +1 -1
- package/dist/src/plugin/request-helpers.js +2 -2
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/process-heartbeat.d.ts +2 -0
- package/dist/src/process-heartbeat.d.ts.map +1 -1
- package/dist/src/process-heartbeat.js +44 -25
- package/dist/src/process-heartbeat.js.map +1 -1
- package/dist/src/runtime-layout.d.ts.map +1 -1
- package/dist/src/runtime-layout.js +8 -1
- package/dist/src/runtime-layout.js.map +1 -1
- package/dist/src/runtime-paths.d.ts.map +1 -1
- package/dist/src/runtime-paths.js +3 -0
- package/dist/src/runtime-paths.js.map +1 -1
- package/dist/types/src/plugin/config/writer.d.ts +4 -5
- package/dist/types/src/plugin/config/writer.d.ts.map +1 -1
- package/dist/types/src/process-heartbeat.d.ts +2 -0
- package/dist/types/src/process-heartbeat.d.ts.map +1 -1
- package/dist/types/src/runtime-layout.d.ts.map +1 -1
- package/dist/types/src/runtime-paths.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.meta.json
CHANGED
|
@@ -2984,7 +2984,7 @@
|
|
|
2984
2984
|
"format": "esm"
|
|
2985
2985
|
},
|
|
2986
2986
|
"src/process-heartbeat.ts": {
|
|
2987
|
-
"bytes":
|
|
2987
|
+
"bytes": 18961,
|
|
2988
2988
|
"imports": [
|
|
2989
2989
|
{
|
|
2990
2990
|
"path": "node:crypto",
|
|
@@ -3046,7 +3046,7 @@
|
|
|
3046
3046
|
"format": "esm"
|
|
3047
3047
|
},
|
|
3048
3048
|
"src/runtime-layout.ts": {
|
|
3049
|
-
"bytes":
|
|
3049
|
+
"bytes": 83839,
|
|
3050
3050
|
"imports": [
|
|
3051
3051
|
{
|
|
3052
3052
|
"path": "node:crypto",
|
|
@@ -3153,7 +3153,7 @@
|
|
|
3153
3153
|
"format": "esm"
|
|
3154
3154
|
},
|
|
3155
3155
|
"src/runtime-paths.ts": {
|
|
3156
|
-
"bytes":
|
|
3156
|
+
"bytes": 17250,
|
|
3157
3157
|
"imports": [
|
|
3158
3158
|
{
|
|
3159
3159
|
"path": "node:crypto",
|
|
@@ -5029,7 +5029,7 @@
|
|
|
5029
5029
|
"format": "esm"
|
|
5030
5030
|
},
|
|
5031
5031
|
"src/plugin/config/schema.ts": {
|
|
5032
|
-
"bytes":
|
|
5032
|
+
"bytes": 21153,
|
|
5033
5033
|
"imports": [
|
|
5034
5034
|
{
|
|
5035
5035
|
"path": "zod",
|
|
@@ -5280,7 +5280,7 @@
|
|
|
5280
5280
|
"format": "esm"
|
|
5281
5281
|
},
|
|
5282
5282
|
"src/plugin/request-helpers.ts": {
|
|
5283
|
-
"bytes":
|
|
5283
|
+
"bytes": 85234,
|
|
5284
5284
|
"imports": [
|
|
5285
5285
|
{
|
|
5286
5286
|
"path": "../core/dist/index.js",
|
|
@@ -5631,7 +5631,7 @@
|
|
|
5631
5631
|
"format": "esm"
|
|
5632
5632
|
},
|
|
5633
5633
|
"src/plugin/config/writer.ts": {
|
|
5634
|
-
"bytes":
|
|
5634
|
+
"bytes": 3762,
|
|
5635
5635
|
"imports": [
|
|
5636
5636
|
{
|
|
5637
5637
|
"path": "node:fs",
|
|
@@ -5824,7 +5824,7 @@
|
|
|
5824
5824
|
"format": "esm"
|
|
5825
5825
|
},
|
|
5826
5826
|
"src/plugin/errors.ts": {
|
|
5827
|
-
"bytes":
|
|
5827
|
+
"bytes": 2861,
|
|
5828
5828
|
"imports": [],
|
|
5829
5829
|
"format": "esm"
|
|
5830
5830
|
},
|
|
@@ -6396,7 +6396,7 @@
|
|
|
6396
6396
|
"imports": [],
|
|
6397
6397
|
"exports": [],
|
|
6398
6398
|
"inputs": {},
|
|
6399
|
-
"bytes":
|
|
6399
|
+
"bytes": 4671055
|
|
6400
6400
|
},
|
|
6401
6401
|
"dist/index.js": {
|
|
6402
6402
|
"imports": [
|
|
@@ -7952,19 +7952,19 @@
|
|
|
7952
7952
|
"bytesInOutput": 23969
|
|
7953
7953
|
},
|
|
7954
7954
|
"src/process-heartbeat.ts": {
|
|
7955
|
-
"bytesInOutput":
|
|
7955
|
+
"bytesInOutput": 8730
|
|
7956
7956
|
},
|
|
7957
7957
|
"src/version-fence.ts": {
|
|
7958
7958
|
"bytesInOutput": 6387
|
|
7959
7959
|
},
|
|
7960
7960
|
"src/runtime-layout.ts": {
|
|
7961
|
-
"bytesInOutput":
|
|
7961
|
+
"bytesInOutput": 46165
|
|
7962
7962
|
},
|
|
7963
7963
|
"src/plugin/storage.ts": {
|
|
7964
7964
|
"bytesInOutput": 12150
|
|
7965
7965
|
},
|
|
7966
7966
|
"src/runtime-paths.ts": {
|
|
7967
|
-
"bytesInOutput":
|
|
7967
|
+
"bytesInOutput": 6383
|
|
7968
7968
|
},
|
|
7969
7969
|
"src/plugin/logging-utils.ts": {
|
|
7970
7970
|
"bytesInOutput": 3622
|
|
@@ -8216,7 +8216,7 @@
|
|
|
8216
8216
|
"bytesInOutput": 3022
|
|
8217
8217
|
},
|
|
8218
8218
|
"src/plugin/config/schema.ts": {
|
|
8219
|
-
"bytesInOutput":
|
|
8219
|
+
"bytesInOutput": 18913
|
|
8220
8220
|
},
|
|
8221
8221
|
"src/plugin/stores/signature-store.ts": {
|
|
8222
8222
|
"bytesInOutput": 332
|
|
@@ -8249,7 +8249,7 @@
|
|
|
8249
8249
|
"bytesInOutput": 626
|
|
8250
8250
|
},
|
|
8251
8251
|
"src/plugin/request-helpers.ts": {
|
|
8252
|
-
"bytesInOutput":
|
|
8252
|
+
"bytesInOutput": 51832
|
|
8253
8253
|
},
|
|
8254
8254
|
"src/plugin/thinking-recovery.ts": {
|
|
8255
8255
|
"bytesInOutput": 4816
|
|
@@ -8318,7 +8318,7 @@
|
|
|
8318
8318
|
"bytesInOutput": 78837
|
|
8319
8319
|
},
|
|
8320
8320
|
"src/plugin/errors.ts": {
|
|
8321
|
-
"bytesInOutput":
|
|
8321
|
+
"bytesInOutput": 583
|
|
8322
8322
|
},
|
|
8323
8323
|
"src/plugin/fetch/retry-state.ts": {
|
|
8324
8324
|
"bytesInOutput": 6547
|
|
@@ -8360,7 +8360,7 @@
|
|
|
8360
8360
|
"bytesInOutput": 0
|
|
8361
8361
|
}
|
|
8362
8362
|
},
|
|
8363
|
-
"bytes":
|
|
8363
|
+
"bytes": 2110090
|
|
8364
8364
|
}
|
|
8365
8365
|
}
|
|
8366
8366
|
}
|
package/dist/server.js
CHANGED
|
@@ -30494,6 +30494,7 @@ __export(process_heartbeat_exports, {
|
|
|
30494
30494
|
holdCliProcessHeartbeat: () => holdCliProcessHeartbeat,
|
|
30495
30495
|
pluginPackageVersion: () => pluginPackageVersion,
|
|
30496
30496
|
processConfigFolderKey: () => processConfigFolderKey,
|
|
30497
|
+
processHasOlderGeneration: () => processHasOlderGeneration,
|
|
30497
30498
|
processHeartbeatDir: () => processHeartbeatDir,
|
|
30498
30499
|
processHeartbeatPath: () => processHeartbeatPath,
|
|
30499
30500
|
recordProcessAnchor: () => recordProcessAnchor,
|
|
@@ -30522,10 +30523,19 @@ function processConfigFolderKey() {
|
|
|
30522
30523
|
return resolve12(folder);
|
|
30523
30524
|
}
|
|
30524
30525
|
}
|
|
30526
|
+
function processHasOlderGeneration() {
|
|
30527
|
+
return shared.olderGeneration;
|
|
30528
|
+
}
|
|
30525
30529
|
function layoutsRecord() {
|
|
30526
30530
|
return Object.fromEntries(shared.layouts);
|
|
30527
30531
|
}
|
|
30528
30532
|
function storesRecord() {
|
|
30533
|
+
if (shared.olderGeneration)
|
|
30534
|
+
return Object.fromEntries(
|
|
30535
|
+
[.../* @__PURE__ */ new Set([...shared.layouts.keys(), ...shared.stores.keys()])].map(
|
|
30536
|
+
(key) => [key, "config"]
|
|
30537
|
+
)
|
|
30538
|
+
);
|
|
30529
30539
|
return Object.fromEntries(shared.stores);
|
|
30530
30540
|
}
|
|
30531
30541
|
function recordSignature() {
|
|
@@ -30538,6 +30548,7 @@ function holdsLegacyLayout() {
|
|
|
30538
30548
|
}
|
|
30539
30549
|
function holdsFixedOldPaths() {
|
|
30540
30550
|
if (holdsLegacyLayout()) return true;
|
|
30551
|
+
if (shared.olderGeneration) return true;
|
|
30541
30552
|
for (const anchor of shared.stores.values())
|
|
30542
30553
|
if (anchor === "config") return true;
|
|
30543
30554
|
return false;
|
|
@@ -30579,16 +30590,17 @@ function errorText2(error) {
|
|
|
30579
30590
|
return error instanceof Error ? error.message : String(error);
|
|
30580
30591
|
}
|
|
30581
30592
|
async function startProcessHeartbeat(input2) {
|
|
30582
|
-
|
|
30583
|
-
const dir = input2.dir ?? processHeartbeatDir();
|
|
30584
|
-
shared.startedAt ??= (input2.now ?? Date.now)();
|
|
30585
|
-
shared.owners++;
|
|
30586
|
-
for (const [key, layout] of Object.entries(input2.layouts ?? {}))
|
|
30587
|
-
shared.layouts.set(key, layout);
|
|
30588
|
-
for (const [key, anchor] of Object.entries(input2.stores ?? {}))
|
|
30589
|
-
shared.stores.set(key, anchor);
|
|
30593
|
+
let dir;
|
|
30590
30594
|
let path5;
|
|
30591
30595
|
try {
|
|
30596
|
+
const pid = input2.pid ?? process.pid;
|
|
30597
|
+
dir = input2.dir ?? processHeartbeatDir();
|
|
30598
|
+
shared.startedAt ??= (input2.now ?? Date.now)();
|
|
30599
|
+
shared.owners++;
|
|
30600
|
+
for (const [key, layout] of Object.entries(input2.layouts ?? {}))
|
|
30601
|
+
shared.layouts.set(key, layout);
|
|
30602
|
+
for (const [key, anchor] of Object.entries(input2.stores ?? {}))
|
|
30603
|
+
shared.stores.set(key, shared.olderGeneration ? "config" : anchor);
|
|
30592
30604
|
path5 = await writeCurrentRecords(dir, pid, input2.version);
|
|
30593
30605
|
} catch (error) {
|
|
30594
30606
|
input2.logger.warn("process heartbeat not written", {
|
|
@@ -30602,10 +30614,16 @@ async function startProcessHeartbeat(input2) {
|
|
|
30602
30614
|
async release() {
|
|
30603
30615
|
if (released) return;
|
|
30604
30616
|
released = true;
|
|
30605
|
-
|
|
30606
|
-
|
|
30607
|
-
|
|
30608
|
-
|
|
30617
|
+
try {
|
|
30618
|
+
shared.owners = Math.max(0, shared.owners - 1);
|
|
30619
|
+
if (shared.owners > 0) return;
|
|
30620
|
+
if (holdsFixedOldPaths()) return;
|
|
30621
|
+
await removeHeartbeatFile(input2.logger);
|
|
30622
|
+
} catch (error) {
|
|
30623
|
+
input2.logger.warn("process heartbeat not released", {
|
|
30624
|
+
error: errorText2(error)
|
|
30625
|
+
});
|
|
30626
|
+
}
|
|
30609
30627
|
}
|
|
30610
30628
|
};
|
|
30611
30629
|
}
|
|
@@ -30647,7 +30665,7 @@ async function recordProcessLayout(input2) {
|
|
|
30647
30665
|
await writeRecords(markStartedAt(input2));
|
|
30648
30666
|
}
|
|
30649
30667
|
async function recordProcessAnchor(input2) {
|
|
30650
|
-
shared.stores.set(input2.key, input2.anchor);
|
|
30668
|
+
shared.stores.set(input2.key, shared.olderGeneration ? "config" : input2.anchor);
|
|
30651
30669
|
await writeRecords(markStartedAt(input2));
|
|
30652
30670
|
}
|
|
30653
30671
|
function markStartedAt(input2) {
|
|
@@ -30709,7 +30727,7 @@ function __resetProcessHeartbeatForTest() {
|
|
|
30709
30727
|
shared.writtenPath = void 0;
|
|
30710
30728
|
shared.writtenLayouts = void 0;
|
|
30711
30729
|
}
|
|
30712
|
-
var stateKey, globalState, shared, HeartbeatWriteFailure, packageVersion;
|
|
30730
|
+
var stateKey, globalState, olderGeneration, shared, HeartbeatWriteFailure, packageVersion;
|
|
30713
30731
|
var init_process_heartbeat = __esm({
|
|
30714
30732
|
"src/process-heartbeat.ts"() {
|
|
30715
30733
|
"use strict";
|
|
@@ -30717,15 +30735,16 @@ var init_process_heartbeat = __esm({
|
|
|
30717
30735
|
init_runtime_paths();
|
|
30718
30736
|
stateKey = /* @__PURE__ */ Symbol.for("cortexkit.antigravity-auth.process-heartbeat");
|
|
30719
30737
|
globalState = globalThis;
|
|
30720
|
-
|
|
30721
|
-
|
|
30722
|
-
|
|
30723
|
-
|
|
30724
|
-
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30728
|
-
|
|
30738
|
+
olderGeneration = globalState[stateKey] !== void 0 && globalState[stateKey].stores == null;
|
|
30739
|
+
shared = globalState[stateKey] ?? {};
|
|
30740
|
+
shared.owners ??= 0;
|
|
30741
|
+
shared.startedAt ??= void 0;
|
|
30742
|
+
shared.layouts ??= /* @__PURE__ */ new Map();
|
|
30743
|
+
shared.olderGeneration ??= olderGeneration;
|
|
30744
|
+
shared.stores ??= /* @__PURE__ */ new Map();
|
|
30745
|
+
shared.writtenPath ??= void 0;
|
|
30746
|
+
shared.writtenLayouts ??= void 0;
|
|
30747
|
+
shared.exitHookInstalled ??= false;
|
|
30729
30748
|
globalState[stateKey] = shared;
|
|
30730
30749
|
HeartbeatWriteFailure = class extends Error {
|
|
30731
30750
|
constructor(cause) {
|
|
@@ -31239,6 +31258,17 @@ async function settleAccountStore(location, options, log16) {
|
|
|
31239
31258
|
}
|
|
31240
31259
|
async function decideAccountStore(location, options, log16) {
|
|
31241
31260
|
const keepConfig = () => recordAnchor(location, options, "config", log16);
|
|
31261
|
+
if (processHasOlderGeneration()) {
|
|
31262
|
+
logOnce(
|
|
31263
|
+
"older-generation-account-store",
|
|
31264
|
+
() => showLog(
|
|
31265
|
+
log16,
|
|
31266
|
+
"antigravity-auth keeps the account store in OpenCode's config folder until OpenCode restarts, because an older version of the plugin ran in this process.",
|
|
31267
|
+
{ accountStore: "config" }
|
|
31268
|
+
)
|
|
31269
|
+
);
|
|
31270
|
+
return keepConfig();
|
|
31271
|
+
}
|
|
31242
31272
|
const configAnchor = legacyAccountFile(location.configDir);
|
|
31243
31273
|
const stateAnchor = stateHomeAccountFile(location);
|
|
31244
31274
|
const forward = readForwardedAccountStore(configAnchor);
|
|
@@ -32183,6 +32213,9 @@ var init_runtime_layout = __esm({
|
|
|
32183
32213
|
storeRuns: /* @__PURE__ */ new Map(),
|
|
32184
32214
|
logged: /* @__PURE__ */ new Set()
|
|
32185
32215
|
};
|
|
32216
|
+
processState.runs ??= /* @__PURE__ */ new Map();
|
|
32217
|
+
processState.storeRuns ??= /* @__PURE__ */ new Map();
|
|
32218
|
+
processState.logged ??= /* @__PURE__ */ new Set();
|
|
32186
32219
|
globalState2[stateKey2] = processState;
|
|
32187
32220
|
LayoutMoveError = class extends Error {
|
|
32188
32221
|
constructor(code2, message) {
|
|
@@ -32716,6 +32749,9 @@ var init_runtime_paths = __esm({
|
|
|
32716
32749
|
locations: /* @__PURE__ */ new Map(),
|
|
32717
32750
|
storeAnchors: /* @__PURE__ */ new Map()
|
|
32718
32751
|
};
|
|
32752
|
+
shared2.decisions ??= /* @__PURE__ */ new Map();
|
|
32753
|
+
shared2.locations ??= /* @__PURE__ */ new Map();
|
|
32754
|
+
shared2.storeAnchors ??= /* @__PURE__ */ new Map();
|
|
32719
32755
|
decisionState[decisionsKey] = shared2;
|
|
32720
32756
|
SIGNATURE_CACHE_FILE_NAME = "antigravity-signature-cache.json";
|
|
32721
32757
|
}
|
|
@@ -35073,12 +35109,12 @@ var AntigravityConfigSchema = z.object({
|
|
|
35073
35109
|
* When an account's quota usage reaches this percentage, skip it during
|
|
35074
35110
|
* account selection (same as if it were rate-limited).
|
|
35075
35111
|
*
|
|
35112
|
+
* Disabled by default (100). Set a lower threshold to opt in to a reserve.
|
|
35076
35113
|
* Example: 80 means skip account when 80% of quota is used (20% remaining).
|
|
35077
|
-
* Set to 100 to disable soft quota protection.
|
|
35078
35114
|
*
|
|
35079
|
-
* @default
|
|
35115
|
+
* @default 100
|
|
35080
35116
|
*/
|
|
35081
|
-
soft_quota_threshold_percent: z.number().min(1).max(100).default(
|
|
35117
|
+
soft_quota_threshold_percent: z.number().min(1).max(100).default(100),
|
|
35082
35118
|
/**
|
|
35083
35119
|
* How often to refresh quota data in the background (in minutes).
|
|
35084
35120
|
* Quota is refreshed opportunistically after successful API requests.
|
|
@@ -35207,7 +35243,7 @@ var DEFAULT_CONFIG = {
|
|
|
35207
35243
|
max_backoff_seconds: 60,
|
|
35208
35244
|
request_jitter_max_ms: 0,
|
|
35209
35245
|
switch_account_delay_ms: 500,
|
|
35210
|
-
soft_quota_threshold_percent:
|
|
35246
|
+
soft_quota_threshold_percent: 100,
|
|
35211
35247
|
quota_refresh_interval_minutes: 30,
|
|
35212
35248
|
soft_quota_cache_ttl_minutes: "auto",
|
|
35213
35249
|
proactive_rotation_threshold_percent: 20,
|
|
@@ -41168,8 +41204,8 @@ function createSyntheticTextResponse(text2, extraHeaders = {}) {
|
|
|
41168
41204
|
});
|
|
41169
41205
|
}
|
|
41170
41206
|
var NATIVE_GOOGLE_ERROR_MESSAGES = {
|
|
41171
|
-
operator_policy: "Antigravity account pool is unavailable under the operator quota policy. Adjust /antigravity
|
|
41172
|
-
soft_quota:
|
|
41207
|
+
operator_policy: "Antigravity account pool is unavailable under the operator quota policy. Adjust the quota floor in /antigravity \u2192 Limits or refresh quota.",
|
|
41208
|
+
soft_quota: 'Antigravity account pool is unavailable under the quota protection policy. Add accounts, wait for quota reset, or turn off soft quota protection with `"soft_quota_threshold_percent": 100` in antigravity.json.',
|
|
41173
41209
|
pool_unavailable: "Antigravity account pool has no account available within the configured wait limit. Add accounts with `opencode auth login` or wait for quota reset.",
|
|
41174
41210
|
model_unavailable: "The requested Antigravity model is not available to the configured accounts. Choose another model.",
|
|
41175
41211
|
missing_access_token: "Missing access token. Run `opencode auth login` to reauthenticate.",
|
|
@@ -43572,7 +43608,7 @@ var AntigravityKillswitchError = class extends Error {
|
|
|
43572
43608
|
summaries;
|
|
43573
43609
|
constructor(input2) {
|
|
43574
43610
|
super(
|
|
43575
|
-
input2.message ?? `Antigravity killswitch: all ${input2.summaries.length} account(s) under ${input2.thresholdPercent}% quota for ${input2.family}. Refresh quota or
|
|
43611
|
+
input2.message ?? `Antigravity killswitch: all ${input2.summaries.length} account(s) under ${input2.thresholdPercent}% quota for ${input2.family}. Refresh quota or adjust the quota floor in /antigravity \u2192 Limits.`
|
|
43576
43612
|
);
|
|
43577
43613
|
this.name = "AntigravityKillswitchError";
|
|
43578
43614
|
this.family = input2.family;
|