@cortexkit/opencode-antigravity-auth 3.0.1 → 3.0.3
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.map +2 -2
- package/dist/cli.meta.json +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2877 -2851
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +120 -33
- package/dist/server.js +475 -427
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -7313
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/ga/rpc/protocol.d.ts +1 -1
- package/dist/src/ga/server/index.d.ts +6 -6
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +29 -1
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/tui/host-ga.d.ts +2 -2
- package/dist/src/hooks/auto-update-checker/checker.d.ts +1 -1
- package/dist/src/hooks/auto-update-checker/index.d.ts +4 -4
- package/dist/src/plugin/account-access.d.ts +6 -6
- package/dist/src/plugin/account-command-oauth.d.ts +2 -2
- package/dist/src/plugin/accounts.d.ts +3 -3
- package/dist/src/plugin/auth-doctor.d.ts +2 -2
- package/dist/src/plugin/auth-drift.d.ts +2 -2
- package/dist/src/plugin/auth-loader.d.ts +8 -8
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +1 -0
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/background-quota-refresh.d.ts +3 -3
- package/dist/src/plugin/background-vault-quota-refresh.d.ts +43 -0
- package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -0
- package/dist/src/plugin/background-vault-quota-refresh.js +155 -0
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -0
- package/dist/src/plugin/cache/index.d.ts +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts +2 -2
- package/dist/src/plugin/cache.d.ts +6 -6
- package/dist/src/plugin/cli.d.ts +6 -6
- package/dist/src/plugin/command-apply.d.ts +1 -1
- package/dist/src/plugin/command-data.d.ts +2 -246
- package/dist/src/plugin/command-data.d.ts.map +1 -1
- package/dist/src/plugin/command-data.js +4 -418
- package/dist/src/plugin/command-data.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +4 -4
- package/dist/src/plugin/config/index.d.ts +2 -2
- package/dist/src/plugin/config/loader.d.ts +2 -2
- package/dist/src/plugin/config/models.d.ts +2 -2
- package/dist/src/plugin/config/writer.d.ts +2 -2
- package/dist/src/plugin/core/streaming/index.d.ts +2 -2
- package/dist/src/plugin/core/streaming/transformer.d.ts +1 -1
- package/dist/src/plugin/debug.d.ts +1 -1
- package/dist/src/plugin/dependencies.d.ts +3 -3
- package/dist/src/plugin/event-handler.d.ts +3 -3
- package/dist/src/plugin/fetch-interceptor.d.ts +10 -10
- package/dist/src/plugin/fetch-routing.d.ts +3 -3
- package/dist/src/plugin/ga-location-services.d.ts +10 -10
- package/dist/src/plugin/gemini-dump.d.ts +0 -22
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +0 -39
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-search-tool.d.ts +1 -1
- package/dist/src/plugin/index.d.ts +8 -6
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +41 -18
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/killswitch.d.ts +1 -1
- package/dist/src/plugin/lifecycle.d.ts +2 -2
- package/dist/src/plugin/logger.d.ts +2 -2
- package/dist/src/plugin/oauth-login.d.ts +1 -1
- package/dist/src/plugin/oauth-methods.d.ts +9 -9
- package/dist/src/plugin/operator-settings.d.ts +3 -3
- package/dist/src/plugin/persist-account-pool.d.ts +1 -1
- package/dist/src/plugin/quota.d.ts +5 -4
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +1 -0
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/recovery/index.d.ts +3 -3
- package/dist/src/plugin/recovery/storage.d.ts +1 -1
- package/dist/src/plugin/recovery.d.ts +3 -3
- package/dist/src/plugin/refresh-queue.d.ts +3 -3
- package/dist/src/plugin/request-helpers.d.ts +1 -1
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +10 -417
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +9 -9
- package/dist/src/plugin/request.js +4 -4
- package/dist/src/plugin/session-context.d.ts +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +9 -9
- package/dist/src/plugin/shared/runtime.d.ts +11 -11
- package/dist/src/plugin/shared/source-sidebar.d.ts +1 -1
- package/dist/src/plugin/shared/vault-menu.d.ts +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +3 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/stores/signature-store.d.ts +1 -1
- package/dist/src/plugin/token.d.ts +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +4 -4
- package/dist/src/plugin/ui/model-status.d.ts +3 -3
- package/dist/src/plugin/ui/quota-status.d.ts +2 -2
- package/dist/src/plugin/vault-activation.d.ts +1 -1
- package/dist/src/plugin/vault-quota-refresh.d.ts +7 -0
- package/dist/src/plugin/vault-quota-refresh.d.ts.map +1 -0
- package/dist/src/plugin/vault-quota-refresh.js +12 -0
- package/dist/src/plugin/vault-quota-refresh.js.map +1 -0
- package/dist/src/plugin/vault-sidebar-projection.d.ts +27 -0
- package/dist/src/plugin/vault-sidebar-projection.d.ts.map +1 -0
- package/dist/src/plugin/vault-sidebar-projection.js +34 -0
- package/dist/src/plugin/vault-sidebar-projection.js.map +1 -0
- package/dist/src/rpc/notifications.d.ts +1 -1
- package/dist/src/rpc/rpc-server.d.ts +1 -1
- package/dist/src/server.d.ts +3 -3
- package/dist/src/sidebar-state.d.ts +20 -13
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +20 -10
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui/command-dialogs.d.ts +1 -1
- package/dist/src/tui/host-v1.d.ts +3 -3
- package/dist/src/tui.d.ts +3 -3
- package/dist/src/tui.js +1 -1
- package/dist/tui-build-map.json +6 -6
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +43 -0
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -0
- package/dist/types/src/plugin/command-data.d.ts +2 -246
- package/dist/types/src/plugin/command-data.d.ts.map +1 -1
- package/dist/types/src/plugin/gemini-dump.d.ts +0 -22
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts +2 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/quota.d.ts +1 -0
- package/dist/types/src/plugin/quota.d.ts.map +1 -1
- package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +2 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-quota-refresh.d.ts +7 -0
- package/dist/types/src/plugin/vault-quota-refresh.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-sidebar-projection.d.ts +27 -0
- package/dist/types/src/plugin/vault-sidebar-projection.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +20 -13
- package/dist/types/src/sidebar-state.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/plugin/command-data.ts +6 -712
- package/src/sidebar-state.ts +34 -15
- package/src/tui-compiled/sidebar-state.js +12 -5
- package/src/tui-compiled/tui.js +1 -1
- package/src/tui-raw/sidebar-state.js +12 -5
- package/src/tui-raw/tui.tsx +1 -1
- package/src/tui.tsx +1 -1
package/dist/server.js
CHANGED
|
@@ -20437,11 +20437,11 @@ var AccountManager = class _AccountManager {
|
|
|
20437
20437
|
usage: () => this.requestSaveToDisk(),
|
|
20438
20438
|
stale: (account, label) => this.ignoreStale(account, label)
|
|
20439
20439
|
},
|
|
20440
|
-
// A repository-backed manager gets its own new trackers
|
|
20441
|
-
// manager
|
|
20442
|
-
// (`getHealthTracker`, `getTokenTracker`)
|
|
20443
|
-
healthTracker: options.healthTracker ?? (repositoryBacked ? new HealthScoreTracker() : getHealthTracker),
|
|
20444
|
-
tokenTracker: options.tokenTracker ?? (repositoryBacked ? new TokenBucketTracker() : getTokenTracker),
|
|
20440
|
+
// A repository-backed manager gets its own new trackers, which run on
|
|
20441
|
+
// this manager's clock. A pool-file manager without supplied trackers
|
|
20442
|
+
// shares the process-wide ones (`getHealthTracker`, `getTokenTracker`).
|
|
20443
|
+
healthTracker: options.healthTracker ?? (repositoryBacked ? new HealthScoreTracker({}, this.now) : getHealthTracker),
|
|
20444
|
+
tokenTracker: options.tokenTracker ?? (repositoryBacked ? new TokenBucketTracker({}, this.now) : getTokenTracker),
|
|
20445
20445
|
now: this.now,
|
|
20446
20446
|
random: options.random ?? (() => Math.random()),
|
|
20447
20447
|
pid: options.pid ?? process.pid,
|
|
@@ -24237,29 +24237,29 @@ function appendClaudeThinkingHint(payload, hint = CLAUDE_INTERLEAVED_THINKING_HI
|
|
|
24237
24237
|
}
|
|
24238
24238
|
|
|
24239
24239
|
// ../core/dist/transform/gemini.js
|
|
24240
|
-
var
|
|
24241
|
-
"
|
|
24242
|
-
"
|
|
24243
|
-
"
|
|
24244
|
-
"
|
|
24245
|
-
"
|
|
24246
|
-
"
|
|
24247
|
-
"
|
|
24248
|
-
"
|
|
24249
|
-
"
|
|
24250
|
-
"
|
|
24251
|
-
"
|
|
24252
|
-
"
|
|
24253
|
-
"
|
|
24254
|
-
"
|
|
24255
|
-
"
|
|
24256
|
-
"
|
|
24257
|
-
"
|
|
24258
|
-
"
|
|
24259
|
-
"
|
|
24260
|
-
"
|
|
24261
|
-
"
|
|
24262
|
-
"
|
|
24240
|
+
var ALLOWED_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
24241
|
+
"type",
|
|
24242
|
+
"properties",
|
|
24243
|
+
"items",
|
|
24244
|
+
"required",
|
|
24245
|
+
"description",
|
|
24246
|
+
"format",
|
|
24247
|
+
"pattern",
|
|
24248
|
+
"title",
|
|
24249
|
+
"nullable",
|
|
24250
|
+
"propertyOrdering",
|
|
24251
|
+
"example",
|
|
24252
|
+
"default",
|
|
24253
|
+
"enum",
|
|
24254
|
+
"anyOf",
|
|
24255
|
+
"minimum",
|
|
24256
|
+
"maximum",
|
|
24257
|
+
"minLength",
|
|
24258
|
+
"maxLength",
|
|
24259
|
+
"minItems",
|
|
24260
|
+
"maxItems",
|
|
24261
|
+
"minProperties",
|
|
24262
|
+
"maxProperties"
|
|
24263
24263
|
]);
|
|
24264
24264
|
var NUMERIC_SCHEMA_CONSTRAINTS = /* @__PURE__ */ new Set([
|
|
24265
24265
|
"minLength",
|
|
@@ -24274,13 +24274,121 @@ var NUMERIC_SCHEMA_CONSTRAINTS = /* @__PURE__ */ new Set([
|
|
|
24274
24274
|
"exclusiveMaximum",
|
|
24275
24275
|
"multipleOf"
|
|
24276
24276
|
]);
|
|
24277
|
+
function isSchemaObject(value) {
|
|
24278
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24279
|
+
}
|
|
24280
|
+
function describeValue(value) {
|
|
24281
|
+
return JSON.stringify(value) ?? String(value);
|
|
24282
|
+
}
|
|
24283
|
+
function sameSchemaValue(left, right) {
|
|
24284
|
+
if (left === right)
|
|
24285
|
+
return true;
|
|
24286
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
24287
|
+
return left.length === right.length && left.every((value, index) => sameSchemaValue(value, right[index]));
|
|
24288
|
+
}
|
|
24289
|
+
if (!isSchemaObject(left) || !isSchemaObject(right))
|
|
24290
|
+
return false;
|
|
24291
|
+
const keys = Object.keys(left);
|
|
24292
|
+
return keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && sameSchemaValue(left[key], right[key]));
|
|
24293
|
+
}
|
|
24294
|
+
function mergeSchemaAllOf(schema, hints) {
|
|
24295
|
+
if (!Array.isArray(schema.allOf))
|
|
24296
|
+
return schema;
|
|
24297
|
+
const { allOf, ...base } = schema;
|
|
24298
|
+
const branches = [base, ...allOf];
|
|
24299
|
+
const properties = {};
|
|
24300
|
+
const required2 = /* @__PURE__ */ new Set();
|
|
24301
|
+
const descriptions = [];
|
|
24302
|
+
const metadata = {};
|
|
24303
|
+
let unambiguous = allOf.length > 0;
|
|
24304
|
+
for (const branch of branches) {
|
|
24305
|
+
if (!isSchemaObject(branch) || branch.type !== void 0 && String(branch.type).toUpperCase() !== "OBJECT" || branch.properties !== void 0 && !isSchemaObject(branch.properties)) {
|
|
24306
|
+
unambiguous = false;
|
|
24307
|
+
break;
|
|
24308
|
+
}
|
|
24309
|
+
for (const [key, value] of Object.entries(branch)) {
|
|
24310
|
+
if (!["properties", "required", "description"].includes(key) && !Object.hasOwn(metadata, key))
|
|
24311
|
+
metadata[key] = value;
|
|
24312
|
+
}
|
|
24313
|
+
if (typeof branch.description === "string")
|
|
24314
|
+
descriptions.push(branch.description);
|
|
24315
|
+
for (const [name, property] of Object.entries(branch.properties ?? {})) {
|
|
24316
|
+
if (Object.hasOwn(properties, name) && !sameSchemaValue(properties[name], property))
|
|
24317
|
+
unambiguous = false;
|
|
24318
|
+
properties[name] = property;
|
|
24319
|
+
}
|
|
24320
|
+
if (Array.isArray(branch.required)) {
|
|
24321
|
+
for (const name of branch.required) {
|
|
24322
|
+
if (typeof name === "string")
|
|
24323
|
+
required2.add(name);
|
|
24324
|
+
}
|
|
24325
|
+
}
|
|
24326
|
+
}
|
|
24327
|
+
if (unambiguous) {
|
|
24328
|
+
return {
|
|
24329
|
+
...metadata,
|
|
24330
|
+
type: "object",
|
|
24331
|
+
properties,
|
|
24332
|
+
...required2.size ? { required: [...required2] } : {},
|
|
24333
|
+
...descriptions.length ? { description: descriptions.join(" ") } : {}
|
|
24334
|
+
};
|
|
24335
|
+
}
|
|
24336
|
+
hints.push("allOf: using the first branch; other intersection constraints omitted.");
|
|
24337
|
+
const first = isSchemaObject(allOf[0]) ? allOf[0] : {};
|
|
24338
|
+
return {
|
|
24339
|
+
...base,
|
|
24340
|
+
...first,
|
|
24341
|
+
...base.description ? { description: base.description } : {}
|
|
24342
|
+
};
|
|
24343
|
+
}
|
|
24344
|
+
var CLAUDE_VALIDATED_HINT_FIELDS = /* @__PURE__ */ new Set([
|
|
24345
|
+
"minLength",
|
|
24346
|
+
"maxLength",
|
|
24347
|
+
"minItems",
|
|
24348
|
+
"maxItems",
|
|
24349
|
+
"pattern",
|
|
24350
|
+
"format",
|
|
24351
|
+
"default"
|
|
24352
|
+
]);
|
|
24353
|
+
function flattenClaudeUnion(schema, hints) {
|
|
24354
|
+
if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0)
|
|
24355
|
+
return schema;
|
|
24356
|
+
const { anyOf, ...base } = schema;
|
|
24357
|
+
const branches = anyOf.filter(isSchemaObject);
|
|
24358
|
+
if (!branches.length)
|
|
24359
|
+
return base;
|
|
24360
|
+
if (branches.length === anyOf.length && branches.every((branch) => Array.isArray(branch.enum) && branch.enum.length > 0 && branch.enum.every((value) => typeof value === "string") && (branch.type === void 0 || branch.type === "STRING") && !branch.properties && !branch.items)) {
|
|
24361
|
+
return {
|
|
24362
|
+
...base,
|
|
24363
|
+
type: "STRING",
|
|
24364
|
+
enum: [...new Set(branches.flatMap((branch) => branch.enum))]
|
|
24365
|
+
};
|
|
24366
|
+
}
|
|
24367
|
+
const typeName = (branch) => branch.properties ? "object" : branch.items ? "array" : String(branch.type ?? "null").toLowerCase();
|
|
24368
|
+
const score = (branch) => {
|
|
24369
|
+
const type = typeName(branch);
|
|
24370
|
+
return type === "object" ? 3 : type === "array" ? 2 : type === "null" ? 0 : 1;
|
|
24371
|
+
};
|
|
24372
|
+
let selected = branches[0];
|
|
24373
|
+
for (const branch of branches.slice(1)) {
|
|
24374
|
+
if (score(branch) > score(selected))
|
|
24375
|
+
selected = branch;
|
|
24376
|
+
}
|
|
24377
|
+
const result = { ...base, ...selected };
|
|
24378
|
+
if (typeof base.description === "string" && base.description) {
|
|
24379
|
+
result.description = typeof selected.description === "string" && selected.description && selected.description !== base.description ? `${base.description} (${selected.description})` : base.description;
|
|
24380
|
+
}
|
|
24381
|
+
if (branches.length > 1)
|
|
24382
|
+
hints.push(`Accepts: ${[...new Set(branches.map(typeName))].join(" | ")}`);
|
|
24383
|
+
return result;
|
|
24384
|
+
}
|
|
24277
24385
|
function toGeminiSchema(schema, options = {}) {
|
|
24278
24386
|
if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
|
|
24279
24387
|
return schema;
|
|
24280
24388
|
}
|
|
24281
|
-
const inputSchema = schema;
|
|
24282
|
-
const result = {};
|
|
24283
24389
|
const numericConstraintHints = [];
|
|
24390
|
+
const inputSchema = mergeSchemaAllOf(schema, numericConstraintHints);
|
|
24391
|
+
let result = {};
|
|
24284
24392
|
const propertyNames = /* @__PURE__ */ new Set();
|
|
24285
24393
|
if (inputSchema.properties && typeof inputSchema.properties === "object") {
|
|
24286
24394
|
for (const propName of Object.keys(inputSchema.properties)) {
|
|
@@ -24288,9 +24396,51 @@ function toGeminiSchema(schema, options = {}) {
|
|
|
24288
24396
|
}
|
|
24289
24397
|
}
|
|
24290
24398
|
for (const [key, value] of Object.entries(inputSchema)) {
|
|
24291
|
-
if (
|
|
24399
|
+
if (options.claudeValidated) {
|
|
24400
|
+
if (key === "title")
|
|
24401
|
+
continue;
|
|
24402
|
+
if (key === "additionalProperties" && value === false)
|
|
24403
|
+
numericConstraintHints.push("No extra properties allowed");
|
|
24404
|
+
if (CLAUDE_VALIDATED_HINT_FIELDS.has(key)) {
|
|
24405
|
+
if (value !== void 0 && typeof value !== "object")
|
|
24406
|
+
numericConstraintHints.push(`${key}: ${value}`);
|
|
24407
|
+
continue;
|
|
24408
|
+
}
|
|
24409
|
+
}
|
|
24410
|
+
if (key === "const") {
|
|
24411
|
+
if (typeof value === "string")
|
|
24412
|
+
result.enum = [value];
|
|
24413
|
+
else
|
|
24414
|
+
numericConstraintHints.push(`Must be ${describeValue(value)}.`);
|
|
24415
|
+
continue;
|
|
24416
|
+
}
|
|
24417
|
+
if (NUMERIC_SCHEMA_CONSTRAINTS.has(key)) {
|
|
24418
|
+
const exclusive = key === "exclusiveMinimum" || key === "exclusiveMaximum";
|
|
24419
|
+
if (exclusive && !options.moveNumericConstraintsToDescription && String(inputSchema.type).toUpperCase() === "INTEGER" && typeof value === "number" && Number.isFinite(value)) {
|
|
24420
|
+
const lower = key === "exclusiveMinimum";
|
|
24421
|
+
const bound = lower ? Math.floor(value) + 1 : Math.ceil(value) - 1;
|
|
24422
|
+
const inclusiveKey = lower ? "minimum" : "maximum";
|
|
24423
|
+
const existing = inputSchema[inclusiveKey];
|
|
24424
|
+
if (Number.isSafeInteger(bound)) {
|
|
24425
|
+
result[inclusiveKey] = typeof existing === "number" ? lower ? Math.max(existing, bound) : Math.min(existing, bound) : bound;
|
|
24426
|
+
continue;
|
|
24427
|
+
}
|
|
24428
|
+
}
|
|
24429
|
+
if (options.moveNumericConstraintsToDescription || exclusive || key === "multipleOf") {
|
|
24430
|
+
if (["string", "number", "boolean"].includes(typeof value))
|
|
24431
|
+
numericConstraintHints.push(`${key}: ${value}`);
|
|
24432
|
+
continue;
|
|
24433
|
+
}
|
|
24434
|
+
}
|
|
24435
|
+
if (key === "oneOf" && Array.isArray(value)) {
|
|
24436
|
+
if (!Array.isArray(inputSchema.anyOf))
|
|
24437
|
+
result.anyOf = value.map((item) => toGeminiSchema(item, options));
|
|
24438
|
+
else
|
|
24439
|
+
numericConstraintHints.push("oneOf: additional union constraints omitted.");
|
|
24292
24440
|
continue;
|
|
24293
24441
|
}
|
|
24442
|
+
if (!ALLOWED_SCHEMA_FIELDS.has(key))
|
|
24443
|
+
continue;
|
|
24294
24444
|
if (key === "type" && typeof value === "string") {
|
|
24295
24445
|
result[key] = value.toUpperCase();
|
|
24296
24446
|
} else if (key === "properties" && typeof value === "object" && value !== null) {
|
|
@@ -24301,16 +24451,15 @@ function toGeminiSchema(schema, options = {}) {
|
|
|
24301
24451
|
result[key] = props;
|
|
24302
24452
|
} else if (key === "items" && typeof value === "object") {
|
|
24303
24453
|
result[key] = toGeminiSchema(value, options);
|
|
24304
|
-
} else if (
|
|
24454
|
+
} else if (key === "anyOf" && Array.isArray(value)) {
|
|
24305
24455
|
result[key] = value.map((item) => toGeminiSchema(item, options));
|
|
24306
24456
|
} else if (key === "enum" && Array.isArray(value)) {
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24457
|
+
if (value.every((item) => typeof item === "string")) {
|
|
24458
|
+
if (typeof inputSchema.const !== "string")
|
|
24459
|
+
result.enum = value;
|
|
24460
|
+
} else {
|
|
24461
|
+
numericConstraintHints.push(`Allowed values: ${value.map(describeValue).join(", ")}.`);
|
|
24311
24462
|
}
|
|
24312
|
-
} else if (key === "default" || key === "examples") {
|
|
24313
|
-
result[key] = value;
|
|
24314
24463
|
} else if (key === "required" && Array.isArray(value)) {
|
|
24315
24464
|
if (propertyNames.size > 0) {
|
|
24316
24465
|
const validRequired = value.filter((prop) => typeof prop === "string" && propertyNames.has(prop));
|
|
@@ -24320,10 +24469,23 @@ function toGeminiSchema(schema, options = {}) {
|
|
|
24320
24469
|
} else {
|
|
24321
24470
|
result[key] = value;
|
|
24322
24471
|
}
|
|
24472
|
+
} else if ((key === "minimum" || key === "maximum") && typeof result[key] === "number" && typeof value === "number") {
|
|
24473
|
+
result[key] = key === "minimum" ? Math.max(result[key], value) : Math.min(result[key], value);
|
|
24323
24474
|
} else {
|
|
24324
24475
|
result[key] = value;
|
|
24325
24476
|
}
|
|
24326
24477
|
}
|
|
24478
|
+
if (options.claudeValidated) {
|
|
24479
|
+
result = flattenClaudeUnion(result, numericConstraintHints);
|
|
24480
|
+
if (isSchemaObject(result.properties) && Array.isArray(result.required)) {
|
|
24481
|
+
const properties = result.properties;
|
|
24482
|
+
const required2 = result.required.filter((name) => typeof name === "string" && Object.hasOwn(properties, name));
|
|
24483
|
+
if (required2.length)
|
|
24484
|
+
result.required = required2;
|
|
24485
|
+
else
|
|
24486
|
+
delete result.required;
|
|
24487
|
+
}
|
|
24488
|
+
}
|
|
24327
24489
|
if (numericConstraintHints.length > 0) {
|
|
24328
24490
|
const hint = numericConstraintHints.join(", ");
|
|
24329
24491
|
result.description = typeof result.description === "string" && result.description ? `${result.description} (${hint})` : hint;
|
|
@@ -28984,7 +29146,7 @@ function createStoreAccountLimits(input2) {
|
|
|
28984
29146
|
}
|
|
28985
29147
|
|
|
28986
29148
|
// src/sidebar-state.ts
|
|
28987
|
-
import { mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
29149
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
28988
29150
|
import { homedir as homedir4 } from "node:os";
|
|
28989
29151
|
import { dirname as dirname15, join as join13 } from "node:path";
|
|
28990
29152
|
|
|
@@ -29008,7 +29170,7 @@ if (xdgConfig) {
|
|
|
29008
29170
|
}
|
|
29009
29171
|
|
|
29010
29172
|
// src/sidebar-state.ts
|
|
29011
|
-
var SIDEBAR_STATE_VERSION =
|
|
29173
|
+
var SIDEBAR_STATE_VERSION = 2;
|
|
29012
29174
|
var DEFAULT_SIDEBAR_STATE = {
|
|
29013
29175
|
version: SIDEBAR_STATE_VERSION,
|
|
29014
29176
|
checkedAt: 0,
|
|
@@ -29069,7 +29231,7 @@ function normalizeSidebarState(input2) {
|
|
|
29069
29231
|
}
|
|
29070
29232
|
const record2 = input2;
|
|
29071
29233
|
const version = record2.version;
|
|
29072
|
-
if (version !== SIDEBAR_STATE_VERSION) {
|
|
29234
|
+
if (version !== 1 && version !== SIDEBAR_STATE_VERSION) {
|
|
29073
29235
|
return {
|
|
29074
29236
|
...DEFAULT_SIDEBAR_STATE,
|
|
29075
29237
|
lastError: `unsupported-version:${stringifySafe(version)}`
|
|
@@ -29124,6 +29286,7 @@ function normalizeAccount(input2) {
|
|
|
29124
29286
|
return {
|
|
29125
29287
|
id,
|
|
29126
29288
|
label,
|
|
29289
|
+
...typeof record2.email === "string" ? { email: record2.email } : {},
|
|
29127
29290
|
enabled,
|
|
29128
29291
|
health,
|
|
29129
29292
|
current,
|
|
@@ -29145,6 +29308,7 @@ function normalizeQuota(input2) {
|
|
|
29145
29308
|
if (!isObject(input2)) return null;
|
|
29146
29309
|
const record2 = input2;
|
|
29147
29310
|
const remaining = toFiniteNumber(record2.remainingPercent);
|
|
29311
|
+
const fraction = toFiniteNumber(record2.remainingFraction);
|
|
29148
29312
|
if (remaining === null) return null;
|
|
29149
29313
|
const resetAt = toFiniteNumber(record2.resetAt) ?? void 0;
|
|
29150
29314
|
const checkedAt = toFiniteNumber(record2.checkedAt) ?? void 0;
|
|
@@ -29158,10 +29322,12 @@ function normalizeQuota(input2) {
|
|
|
29158
29322
|
);
|
|
29159
29323
|
const ra = toFiniteNumber(w.resetAt);
|
|
29160
29324
|
const ca = toFiniteNumber(w.checkedAt);
|
|
29325
|
+
const rf = toFiniteNumber(w.remainingFraction);
|
|
29161
29326
|
if (win !== "weekly" && win !== "5h" || rp === null) return null;
|
|
29162
29327
|
return {
|
|
29163
29328
|
window: win,
|
|
29164
29329
|
remainingPercent: clampNumber(rp, 0, 100),
|
|
29330
|
+
...rf !== null ? { remainingFraction: clampNumber(rf, 0, 1) } : {},
|
|
29165
29331
|
resetAt: ra ?? void 0,
|
|
29166
29332
|
...ca !== null && ca >= 0 ? { checkedAt: ca } : {}
|
|
29167
29333
|
};
|
|
@@ -29170,6 +29336,7 @@ function normalizeQuota(input2) {
|
|
|
29170
29336
|
}
|
|
29171
29337
|
return {
|
|
29172
29338
|
remainingPercent: clampNumber(remaining, 0, 100),
|
|
29339
|
+
...fraction !== null ? { remainingFraction: clampNumber(fraction, 0, 1) } : {},
|
|
29173
29340
|
resetAt,
|
|
29174
29341
|
...checkedAt !== void 0 ? { checkedAt } : {},
|
|
29175
29342
|
windows
|
|
@@ -29221,6 +29388,7 @@ function stringifySafe(value) {
|
|
|
29221
29388
|
}
|
|
29222
29389
|
function ensureSidebarStateDir(path5 = getSidebarStateFile()) {
|
|
29223
29390
|
mkdirSync3(dirname15(path5), { recursive: true, mode: SIDEBAR_STATE_DIR_MODE });
|
|
29391
|
+
chmodSync3(dirname15(path5), SIDEBAR_STATE_DIR_MODE);
|
|
29224
29392
|
}
|
|
29225
29393
|
function pruneActiveRouting(map, now) {
|
|
29226
29394
|
const cutoff = now - ACTIVE_ROUTING_MAX_AGE_MS;
|
|
@@ -29299,6 +29467,7 @@ function projectQuotaPoolForSidebar(source, checkedAt) {
|
|
|
29299
29467
|
0,
|
|
29300
29468
|
100
|
|
29301
29469
|
),
|
|
29470
|
+
remainingFraction: clampNumber(w.remainingFraction, 0, 1),
|
|
29302
29471
|
resetAt: typeof w.resetTime === "string" && w.resetTime.length > 0 ? (() => {
|
|
29303
29472
|
const parsed = Date.parse(w.resetTime);
|
|
29304
29473
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
@@ -29306,6 +29475,7 @@ function projectQuotaPoolForSidebar(source, checkedAt) {
|
|
|
29306
29475
|
})) : void 0;
|
|
29307
29476
|
return {
|
|
29308
29477
|
remainingPercent,
|
|
29478
|
+
remainingFraction: clampNumber(fraction, 0, 1),
|
|
29309
29479
|
resetAt,
|
|
29310
29480
|
windows,
|
|
29311
29481
|
...readingAt !== void 0 ? { checkedAt: readingAt } : {}
|
|
@@ -29342,6 +29512,7 @@ function redactAccountForSidebar(source) {
|
|
|
29342
29512
|
return {
|
|
29343
29513
|
id,
|
|
29344
29514
|
label,
|
|
29515
|
+
...typeof source.email === "string" ? { email: source.email } : {},
|
|
29345
29516
|
enabled,
|
|
29346
29517
|
health,
|
|
29347
29518
|
current,
|
|
@@ -29664,6 +29835,7 @@ async function pushSidebarQuotaSnapshot(getAccounts, backoffUntil = 0, getActive
|
|
|
29664
29835
|
accounts.map((entry) => ({
|
|
29665
29836
|
index: entry.index,
|
|
29666
29837
|
label: entry.label,
|
|
29838
|
+
email: entry.email,
|
|
29667
29839
|
enabled: entry.enabled,
|
|
29668
29840
|
current: activeByFamily ? isAccountCurrent(entry.index, activeByFamily) : false,
|
|
29669
29841
|
coolingDownUntil: entry.coolingDownUntil,
|
|
@@ -31095,7 +31267,7 @@ function clearSignatureCache(sessionId) {
|
|
|
31095
31267
|
}
|
|
31096
31268
|
|
|
31097
31269
|
// src/plugin/image-saver.ts
|
|
31098
|
-
import { chmodSync as
|
|
31270
|
+
import { chmodSync as chmodSync4, existsSync as existsSync9, mkdirSync as mkdirSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
31099
31271
|
import { homedir as homedir6 } from "node:os";
|
|
31100
31272
|
import { join as join15 } from "node:path";
|
|
31101
31273
|
function getImageOutputDir(outputDir) {
|
|
@@ -31103,7 +31275,7 @@ function getImageOutputDir(outputDir) {
|
|
|
31103
31275
|
if (!existsSync9(resolved)) {
|
|
31104
31276
|
mkdirSync5(resolved, { recursive: true, mode: 448 });
|
|
31105
31277
|
}
|
|
31106
|
-
|
|
31278
|
+
chmodSync4(resolved, 448);
|
|
31107
31279
|
return resolved;
|
|
31108
31280
|
}
|
|
31109
31281
|
function generateImageFilename(mimeType) {
|
|
@@ -31124,7 +31296,7 @@ function saveImageToDisk(base64Data, mimeType, outputDir) {
|
|
|
31124
31296
|
const resolvedOutputDir = getImageOutputDir(outputDir);
|
|
31125
31297
|
const filePath = join15(resolvedOutputDir, generateImageFilename(mimeType));
|
|
31126
31298
|
writeFileSync3(filePath, Buffer.from(base64Data, "base64"), { mode: 384 });
|
|
31127
|
-
|
|
31299
|
+
chmodSync4(filePath, 384);
|
|
31128
31300
|
return filePath;
|
|
31129
31301
|
} catch (error) {
|
|
31130
31302
|
console.error("[image-saver] Failed to save image:", error);
|
|
@@ -31560,10 +31732,6 @@ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync6, writeFileSy
|
|
|
31560
31732
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
31561
31733
|
import { join as join16 } from "node:path";
|
|
31562
31734
|
var DUMP_STATUS_TITLE = "## Gemini Dump Status";
|
|
31563
|
-
var DUMP_ENABLED_TITLE = "## Gemini Dump Enabled";
|
|
31564
|
-
var DUMP_DISABLED_TITLE = "## Gemini Dump Disabled";
|
|
31565
|
-
var DUMP_USAGE_TITLE = "## Gemini Dump Usage";
|
|
31566
|
-
var DUMP_USAGE = "Usage: `/gemini-dump`, `/gemini-dump on`, or `/gemini-dump off`.";
|
|
31567
31735
|
var DUMP_DIR_ENV = "OPENCODE_ANTIGRAVITY_GEMINI_DUMP_DIR";
|
|
31568
31736
|
var DEFAULT_DUMP_DIR = join16(tmpdir3(), "opencode-antigravity-gemini-dumps");
|
|
31569
31737
|
var DUMP_DIR_MODE = 448;
|
|
@@ -31580,8 +31748,7 @@ function createGeminiDumpState(options = {}) {
|
|
|
31580
31748
|
enabled = next;
|
|
31581
31749
|
},
|
|
31582
31750
|
dumpRequest: (input2) => enabled ? writeGeminiDump(input2) : null,
|
|
31583
|
-
buildStatusSummary: (input2) => renderGeminiDumpStatus(input2?.enabled ?? enabled)
|
|
31584
|
-
executeCommand: (input2) => renderGeminiDumpCommand(input2.argumentsText, input2.enabled ?? enabled)
|
|
31751
|
+
buildStatusSummary: (input2) => renderGeminiDumpStatus(input2?.enabled ?? enabled)
|
|
31585
31752
|
};
|
|
31586
31753
|
}
|
|
31587
31754
|
var legacyDumpState = createGeminiDumpState();
|
|
@@ -31594,15 +31761,6 @@ function setGeminiDumpEnabled(enabled) {
|
|
|
31594
31761
|
function getGeminiDumpDirectory() {
|
|
31595
31762
|
return process.env[DUMP_DIR_ENV] || DEFAULT_DUMP_DIR;
|
|
31596
31763
|
}
|
|
31597
|
-
function parseGeminiDumpCommandAction(argumentsText) {
|
|
31598
|
-
const normalized = argumentsText.trim().split(/\s+/).filter(Boolean);
|
|
31599
|
-
if (normalized.length === 0) return { type: "status" };
|
|
31600
|
-
if (normalized.length === 1 && normalized[0] === "on")
|
|
31601
|
-
return { type: "enable" };
|
|
31602
|
-
if (normalized.length === 1 && normalized[0] === "off")
|
|
31603
|
-
return { type: "disable" };
|
|
31604
|
-
return { type: "usage" };
|
|
31605
|
-
}
|
|
31606
31764
|
function renderGeminiDumpStatus(enabled) {
|
|
31607
31765
|
return [
|
|
31608
31766
|
DUMP_STATUS_TITLE,
|
|
@@ -31613,23 +31771,6 @@ function renderGeminiDumpStatus(enabled) {
|
|
|
31613
31771
|
"- Warning: dumps contain prompt/session content; turn this off after debugging"
|
|
31614
31772
|
].join("\n");
|
|
31615
31773
|
}
|
|
31616
|
-
function renderGeminiDumpCommand(argumentsText, enabled) {
|
|
31617
|
-
const action = parseGeminiDumpCommandAction(argumentsText);
|
|
31618
|
-
if (action.type === "status") return renderGeminiDumpStatus(enabled);
|
|
31619
|
-
if (action.type === "enable") {
|
|
31620
|
-
return [DUMP_ENABLED_TITLE, "", renderGeminiDumpStatus(true)].join("\n");
|
|
31621
|
-
}
|
|
31622
|
-
if (action.type === "disable") {
|
|
31623
|
-
return [DUMP_DISABLED_TITLE, "", renderGeminiDumpStatus(false)].join("\n");
|
|
31624
|
-
}
|
|
31625
|
-
return [
|
|
31626
|
-
DUMP_USAGE_TITLE,
|
|
31627
|
-
"",
|
|
31628
|
-
DUMP_USAGE,
|
|
31629
|
-
"",
|
|
31630
|
-
renderGeminiDumpStatus(enabled)
|
|
31631
|
-
].join("\n");
|
|
31632
|
-
}
|
|
31633
31774
|
function hashText2(value) {
|
|
31634
31775
|
return createHash14("sha256").update(value).digest("hex");
|
|
31635
31776
|
}
|
|
@@ -32294,31 +32435,6 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
32294
32435
|
// src/plugin/request-helpers.ts
|
|
32295
32436
|
var log8 = createLogger4("request-helpers");
|
|
32296
32437
|
var ANTIGRAVITY_PREVIEW_LINK = "https://goo.gle/enable-preview-features";
|
|
32297
|
-
var UNSUPPORTED_CONSTRAINTS = [
|
|
32298
|
-
"minLength",
|
|
32299
|
-
"maxLength",
|
|
32300
|
-
"exclusiveMinimum",
|
|
32301
|
-
"exclusiveMaximum",
|
|
32302
|
-
"pattern",
|
|
32303
|
-
"minItems",
|
|
32304
|
-
"maxItems",
|
|
32305
|
-
"format",
|
|
32306
|
-
"default",
|
|
32307
|
-
"examples"
|
|
32308
|
-
];
|
|
32309
|
-
var UNSUPPORTED_KEYWORDS = [
|
|
32310
|
-
...UNSUPPORTED_CONSTRAINTS,
|
|
32311
|
-
"$schema",
|
|
32312
|
-
"$defs",
|
|
32313
|
-
"definitions",
|
|
32314
|
-
"const",
|
|
32315
|
-
"$ref",
|
|
32316
|
-
"additionalProperties",
|
|
32317
|
-
"propertyNames",
|
|
32318
|
-
"title",
|
|
32319
|
-
"$id",
|
|
32320
|
-
"$comment"
|
|
32321
|
-
];
|
|
32322
32438
|
function appendDescriptionHint(schema, hint) {
|
|
32323
32439
|
if (!schema || typeof schema !== "object") {
|
|
32324
32440
|
return schema;
|
|
@@ -32348,23 +32464,6 @@ function convertRefsToHints(schema) {
|
|
|
32348
32464
|
}
|
|
32349
32465
|
return result;
|
|
32350
32466
|
}
|
|
32351
|
-
function convertConstToEnum(schema) {
|
|
32352
|
-
if (!schema || typeof schema !== "object") {
|
|
32353
|
-
return schema;
|
|
32354
|
-
}
|
|
32355
|
-
if (Array.isArray(schema)) {
|
|
32356
|
-
return schema.map((item) => convertConstToEnum(item));
|
|
32357
|
-
}
|
|
32358
|
-
const result = {};
|
|
32359
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
32360
|
-
if (key === "const" && !schema.enum) {
|
|
32361
|
-
result.enum = [value];
|
|
32362
|
-
} else {
|
|
32363
|
-
result[key] = convertConstToEnum(value);
|
|
32364
|
-
}
|
|
32365
|
-
}
|
|
32366
|
-
return result;
|
|
32367
|
-
}
|
|
32368
32467
|
function addEnumHints(schema) {
|
|
32369
32468
|
if (!schema || typeof schema !== "object") {
|
|
32370
32469
|
return schema;
|
|
@@ -32373,7 +32472,7 @@ function addEnumHints(schema) {
|
|
|
32373
32472
|
return schema.map((item) => addEnumHints(item));
|
|
32374
32473
|
}
|
|
32375
32474
|
let result = { ...schema };
|
|
32376
|
-
if (Array.isArray(result.enum) && result.enum.length > 1 && result.enum.length <= 10) {
|
|
32475
|
+
if (Array.isArray(result.enum) && result.enum.every((value) => typeof value === "string") && result.enum.length > 1 && result.enum.length <= 10) {
|
|
32377
32476
|
const vals = result.enum.map((v) => String(v)).join(", ");
|
|
32378
32477
|
result = appendDescriptionHint(result, `Allowed: ${vals}`);
|
|
32379
32478
|
}
|
|
@@ -32384,213 +32483,6 @@ function addEnumHints(schema) {
|
|
|
32384
32483
|
}
|
|
32385
32484
|
return result;
|
|
32386
32485
|
}
|
|
32387
|
-
function addAdditionalPropertiesHints(schema) {
|
|
32388
|
-
if (!schema || typeof schema !== "object") {
|
|
32389
|
-
return schema;
|
|
32390
|
-
}
|
|
32391
|
-
if (Array.isArray(schema)) {
|
|
32392
|
-
return schema.map((item) => addAdditionalPropertiesHints(item));
|
|
32393
|
-
}
|
|
32394
|
-
let result = { ...schema };
|
|
32395
|
-
if (result.additionalProperties === false) {
|
|
32396
|
-
result = appendDescriptionHint(result, "No extra properties allowed");
|
|
32397
|
-
}
|
|
32398
|
-
for (const [key, value] of Object.entries(result)) {
|
|
32399
|
-
if (key !== "additionalProperties" && typeof value === "object" && value !== null) {
|
|
32400
|
-
result[key] = addAdditionalPropertiesHints(value);
|
|
32401
|
-
}
|
|
32402
|
-
}
|
|
32403
|
-
return result;
|
|
32404
|
-
}
|
|
32405
|
-
function moveConstraintsToDescription(schema) {
|
|
32406
|
-
if (!schema || typeof schema !== "object") {
|
|
32407
|
-
return schema;
|
|
32408
|
-
}
|
|
32409
|
-
if (Array.isArray(schema)) {
|
|
32410
|
-
return schema.map((item) => moveConstraintsToDescription(item));
|
|
32411
|
-
}
|
|
32412
|
-
let result = { ...schema };
|
|
32413
|
-
for (const constraint of UNSUPPORTED_CONSTRAINTS) {
|
|
32414
|
-
if (result[constraint] !== void 0 && typeof result[constraint] !== "object") {
|
|
32415
|
-
result = appendDescriptionHint(
|
|
32416
|
-
result,
|
|
32417
|
-
`${constraint}: ${result[constraint]}`
|
|
32418
|
-
);
|
|
32419
|
-
}
|
|
32420
|
-
}
|
|
32421
|
-
for (const [key, value] of Object.entries(result)) {
|
|
32422
|
-
if (typeof value === "object" && value !== null) {
|
|
32423
|
-
result[key] = moveConstraintsToDescription(value);
|
|
32424
|
-
}
|
|
32425
|
-
}
|
|
32426
|
-
return result;
|
|
32427
|
-
}
|
|
32428
|
-
function mergeAllOf(schema) {
|
|
32429
|
-
if (!schema || typeof schema !== "object") {
|
|
32430
|
-
return schema;
|
|
32431
|
-
}
|
|
32432
|
-
if (Array.isArray(schema)) {
|
|
32433
|
-
return schema.map((item) => mergeAllOf(item));
|
|
32434
|
-
}
|
|
32435
|
-
const result = { ...schema };
|
|
32436
|
-
if (Array.isArray(result.allOf)) {
|
|
32437
|
-
const merged = {};
|
|
32438
|
-
const mergedRequired = [];
|
|
32439
|
-
for (const item of result.allOf) {
|
|
32440
|
-
if (!item || typeof item !== "object") continue;
|
|
32441
|
-
if (item.properties && typeof item.properties === "object") {
|
|
32442
|
-
merged.properties = { ...merged.properties, ...item.properties };
|
|
32443
|
-
}
|
|
32444
|
-
if (Array.isArray(item.required)) {
|
|
32445
|
-
for (const req of item.required) {
|
|
32446
|
-
if (!mergedRequired.includes(req)) {
|
|
32447
|
-
mergedRequired.push(req);
|
|
32448
|
-
}
|
|
32449
|
-
}
|
|
32450
|
-
}
|
|
32451
|
-
for (const [key, value] of Object.entries(item)) {
|
|
32452
|
-
if (key !== "properties" && key !== "required" && merged[key] === void 0) {
|
|
32453
|
-
merged[key] = value;
|
|
32454
|
-
}
|
|
32455
|
-
}
|
|
32456
|
-
}
|
|
32457
|
-
if (merged.properties) {
|
|
32458
|
-
result.properties = { ...result.properties, ...merged.properties };
|
|
32459
|
-
}
|
|
32460
|
-
if (mergedRequired.length > 0) {
|
|
32461
|
-
const existingRequired = Array.isArray(result.required) ? result.required : [];
|
|
32462
|
-
result.required = Array.from(
|
|
32463
|
-
/* @__PURE__ */ new Set([...existingRequired, ...mergedRequired])
|
|
32464
|
-
);
|
|
32465
|
-
}
|
|
32466
|
-
for (const [key, value] of Object.entries(merged)) {
|
|
32467
|
-
if (key !== "properties" && key !== "required" && result[key] === void 0) {
|
|
32468
|
-
result[key] = value;
|
|
32469
|
-
}
|
|
32470
|
-
}
|
|
32471
|
-
delete result.allOf;
|
|
32472
|
-
}
|
|
32473
|
-
for (const [key, value] of Object.entries(result)) {
|
|
32474
|
-
if (typeof value === "object" && value !== null) {
|
|
32475
|
-
result[key] = mergeAllOf(value);
|
|
32476
|
-
}
|
|
32477
|
-
}
|
|
32478
|
-
return result;
|
|
32479
|
-
}
|
|
32480
|
-
function scoreSchemaOption(schema) {
|
|
32481
|
-
if (!schema || typeof schema !== "object") {
|
|
32482
|
-
return { score: 0, typeName: "unknown" };
|
|
32483
|
-
}
|
|
32484
|
-
const type = schema.type;
|
|
32485
|
-
if (type === "object" || schema.properties) {
|
|
32486
|
-
return { score: 3, typeName: "object" };
|
|
32487
|
-
}
|
|
32488
|
-
if (type === "array" || schema.items) {
|
|
32489
|
-
return { score: 2, typeName: "array" };
|
|
32490
|
-
}
|
|
32491
|
-
if (type && type !== "null") {
|
|
32492
|
-
return { score: 1, typeName: type };
|
|
32493
|
-
}
|
|
32494
|
-
return { score: 0, typeName: type || "null" };
|
|
32495
|
-
}
|
|
32496
|
-
function tryMergeEnumFromUnion(options) {
|
|
32497
|
-
if (!Array.isArray(options) || options.length === 0) {
|
|
32498
|
-
return null;
|
|
32499
|
-
}
|
|
32500
|
-
const enumValues = [];
|
|
32501
|
-
for (const option of options) {
|
|
32502
|
-
if (!option || typeof option !== "object") {
|
|
32503
|
-
return null;
|
|
32504
|
-
}
|
|
32505
|
-
if (option.const !== void 0) {
|
|
32506
|
-
enumValues.push(String(option.const));
|
|
32507
|
-
continue;
|
|
32508
|
-
}
|
|
32509
|
-
if (Array.isArray(option.enum) && option.enum.length === 1) {
|
|
32510
|
-
enumValues.push(String(option.enum[0]));
|
|
32511
|
-
continue;
|
|
32512
|
-
}
|
|
32513
|
-
if (Array.isArray(option.enum) && option.enum.length > 0) {
|
|
32514
|
-
for (const val of option.enum) {
|
|
32515
|
-
enumValues.push(String(val));
|
|
32516
|
-
}
|
|
32517
|
-
continue;
|
|
32518
|
-
}
|
|
32519
|
-
if (option.properties || option.items || option.anyOf || option.oneOf || option.allOf) {
|
|
32520
|
-
return null;
|
|
32521
|
-
}
|
|
32522
|
-
if (option.type && !option.const && !option.enum) {
|
|
32523
|
-
return null;
|
|
32524
|
-
}
|
|
32525
|
-
}
|
|
32526
|
-
return enumValues.length > 0 ? enumValues : null;
|
|
32527
|
-
}
|
|
32528
|
-
function flattenAnyOfOneOf(schema) {
|
|
32529
|
-
if (!schema || typeof schema !== "object") {
|
|
32530
|
-
return schema;
|
|
32531
|
-
}
|
|
32532
|
-
if (Array.isArray(schema)) {
|
|
32533
|
-
return schema.map((item) => flattenAnyOfOneOf(item));
|
|
32534
|
-
}
|
|
32535
|
-
let result = { ...schema };
|
|
32536
|
-
for (const unionKey of ["anyOf", "oneOf"]) {
|
|
32537
|
-
if (Array.isArray(result[unionKey]) && result[unionKey].length > 0) {
|
|
32538
|
-
const options = result[unionKey];
|
|
32539
|
-
const parentDesc = typeof result.description === "string" ? result.description : "";
|
|
32540
|
-
const mergedEnum = tryMergeEnumFromUnion(options);
|
|
32541
|
-
if (mergedEnum !== null) {
|
|
32542
|
-
const { [unionKey]: _2, ...rest2 } = result;
|
|
32543
|
-
result = {
|
|
32544
|
-
...rest2,
|
|
32545
|
-
type: "string",
|
|
32546
|
-
enum: mergedEnum
|
|
32547
|
-
};
|
|
32548
|
-
if (parentDesc) {
|
|
32549
|
-
result.description = parentDesc;
|
|
32550
|
-
}
|
|
32551
|
-
continue;
|
|
32552
|
-
}
|
|
32553
|
-
let bestIdx = 0;
|
|
32554
|
-
let bestScore = -1;
|
|
32555
|
-
const allTypes = [];
|
|
32556
|
-
for (let i = 0; i < options.length; i++) {
|
|
32557
|
-
const { score, typeName } = scoreSchemaOption(options[i]);
|
|
32558
|
-
if (typeName) {
|
|
32559
|
-
allTypes.push(typeName);
|
|
32560
|
-
}
|
|
32561
|
-
if (score > bestScore) {
|
|
32562
|
-
bestScore = score;
|
|
32563
|
-
bestIdx = i;
|
|
32564
|
-
}
|
|
32565
|
-
}
|
|
32566
|
-
let selected = flattenAnyOfOneOf(options[bestIdx]) || { type: "string" };
|
|
32567
|
-
if (parentDesc) {
|
|
32568
|
-
const childDesc = typeof selected.description === "string" ? selected.description : "";
|
|
32569
|
-
if (childDesc && childDesc !== parentDesc) {
|
|
32570
|
-
selected = {
|
|
32571
|
-
...selected,
|
|
32572
|
-
description: `${parentDesc} (${childDesc})`
|
|
32573
|
-
};
|
|
32574
|
-
} else if (!childDesc) {
|
|
32575
|
-
selected = { ...selected, description: parentDesc };
|
|
32576
|
-
}
|
|
32577
|
-
}
|
|
32578
|
-
if (allTypes.length > 1) {
|
|
32579
|
-
const uniqueTypes = Array.from(new Set(allTypes));
|
|
32580
|
-
const hint = `Accepts: ${uniqueTypes.join(" | ")}`;
|
|
32581
|
-
selected = appendDescriptionHint(selected, hint);
|
|
32582
|
-
}
|
|
32583
|
-
const { [unionKey]: _, description: __, ...rest } = result;
|
|
32584
|
-
result = { ...rest, ...selected };
|
|
32585
|
-
}
|
|
32586
|
-
}
|
|
32587
|
-
for (const [key, value] of Object.entries(result)) {
|
|
32588
|
-
if (typeof value === "object" && value !== null) {
|
|
32589
|
-
result[key] = flattenAnyOfOneOf(value);
|
|
32590
|
-
}
|
|
32591
|
-
}
|
|
32592
|
-
return result;
|
|
32593
|
-
}
|
|
32594
32486
|
function flattenTypeArrays(schema, nullableFields, currentPath) {
|
|
32595
32487
|
if (!schema || typeof schema !== "object") {
|
|
32596
32488
|
return schema;
|
|
@@ -32659,62 +32551,6 @@ function flattenTypeArrays(schema, nullableFields, currentPath) {
|
|
|
32659
32551
|
}
|
|
32660
32552
|
return result;
|
|
32661
32553
|
}
|
|
32662
|
-
function removeUnsupportedKeywords(schema, insideProperties = false) {
|
|
32663
|
-
if (!schema || typeof schema !== "object") {
|
|
32664
|
-
return schema;
|
|
32665
|
-
}
|
|
32666
|
-
if (Array.isArray(schema)) {
|
|
32667
|
-
return schema.map((item) => removeUnsupportedKeywords(item, false));
|
|
32668
|
-
}
|
|
32669
|
-
const result = {};
|
|
32670
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
32671
|
-
if (!insideProperties && UNSUPPORTED_KEYWORDS.includes(key)) {
|
|
32672
|
-
continue;
|
|
32673
|
-
}
|
|
32674
|
-
if (typeof value === "object" && value !== null) {
|
|
32675
|
-
if (key === "properties") {
|
|
32676
|
-
const propertiesResult = {};
|
|
32677
|
-
for (const [propName, propSchema] of Object.entries(value)) {
|
|
32678
|
-
propertiesResult[propName] = removeUnsupportedKeywords(
|
|
32679
|
-
propSchema,
|
|
32680
|
-
false
|
|
32681
|
-
);
|
|
32682
|
-
}
|
|
32683
|
-
result[key] = propertiesResult;
|
|
32684
|
-
} else {
|
|
32685
|
-
result[key] = removeUnsupportedKeywords(value, false);
|
|
32686
|
-
}
|
|
32687
|
-
} else {
|
|
32688
|
-
result[key] = value;
|
|
32689
|
-
}
|
|
32690
|
-
}
|
|
32691
|
-
return result;
|
|
32692
|
-
}
|
|
32693
|
-
function cleanupRequiredFields(schema) {
|
|
32694
|
-
if (!schema || typeof schema !== "object") {
|
|
32695
|
-
return schema;
|
|
32696
|
-
}
|
|
32697
|
-
if (Array.isArray(schema)) {
|
|
32698
|
-
return schema.map((item) => cleanupRequiredFields(item));
|
|
32699
|
-
}
|
|
32700
|
-
const result = { ...schema };
|
|
32701
|
-
if (Array.isArray(result.required) && result.properties && typeof result.properties === "object") {
|
|
32702
|
-
const validRequired = result.required.filter(
|
|
32703
|
-
(req) => Object.hasOwn(result.properties, req)
|
|
32704
|
-
);
|
|
32705
|
-
if (validRequired.length === 0) {
|
|
32706
|
-
delete result.required;
|
|
32707
|
-
} else if (validRequired.length !== result.required.length) {
|
|
32708
|
-
result.required = validRequired;
|
|
32709
|
-
}
|
|
32710
|
-
}
|
|
32711
|
-
for (const [key, value] of Object.entries(result)) {
|
|
32712
|
-
if (typeof value === "object" && value !== null) {
|
|
32713
|
-
result[key] = cleanupRequiredFields(value);
|
|
32714
|
-
}
|
|
32715
|
-
}
|
|
32716
|
-
return result;
|
|
32717
|
-
}
|
|
32718
32554
|
function addEmptySchemaPlaceholder(schema) {
|
|
32719
32555
|
if (!schema || typeof schema !== "object") {
|
|
32720
32556
|
return schema;
|
|
@@ -32747,19 +32583,11 @@ function cleanJSONSchemaForAntigravity(schema) {
|
|
|
32747
32583
|
if (!schema || typeof schema !== "object") {
|
|
32748
32584
|
return schema;
|
|
32749
32585
|
}
|
|
32750
|
-
let result = schema;
|
|
32751
|
-
result = convertRefsToHints(result);
|
|
32752
|
-
result = convertConstToEnum(result);
|
|
32586
|
+
let result = convertRefsToHints(schema);
|
|
32753
32587
|
result = addEnumHints(result);
|
|
32754
|
-
result = addAdditionalPropertiesHints(result);
|
|
32755
|
-
result = moveConstraintsToDescription(result);
|
|
32756
|
-
result = mergeAllOf(result);
|
|
32757
|
-
result = flattenAnyOfOneOf(result);
|
|
32758
32588
|
result = flattenTypeArrays(result);
|
|
32759
|
-
result = removeUnsupportedKeywords(result);
|
|
32760
|
-
result = cleanupRequiredFields(result);
|
|
32761
32589
|
result = addEmptySchemaPlaceholder(result);
|
|
32762
|
-
return result;
|
|
32590
|
+
return toGeminiSchema(result, { claudeValidated: true });
|
|
32763
32591
|
}
|
|
32764
32592
|
var DEFAULT_THINKING_BUDGET = 16e3;
|
|
32765
32593
|
function isThinkingCapableModel2(modelName) {
|
|
@@ -35455,10 +35283,10 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
35455
35283
|
const normalizeSchema = (schema) => {
|
|
35456
35284
|
const createPlaceholderSchema = (base = {}) => ({
|
|
35457
35285
|
...base,
|
|
35458
|
-
type: "
|
|
35286
|
+
type: "OBJECT",
|
|
35459
35287
|
properties: {
|
|
35460
35288
|
[EMPTY_SCHEMA_PLACEHOLDER_NAME]: {
|
|
35461
|
-
type: "
|
|
35289
|
+
type: "BOOLEAN",
|
|
35462
35290
|
description: EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION
|
|
35463
35291
|
}
|
|
35464
35292
|
},
|
|
@@ -35474,11 +35302,11 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
35474
35302
|
return createPlaceholderSchema();
|
|
35475
35303
|
}
|
|
35476
35304
|
const hasProperties = cleaned.properties && typeof cleaned.properties === "object" && Object.keys(cleaned.properties).length > 0;
|
|
35477
|
-
cleaned.type = "
|
|
35305
|
+
cleaned.type = "OBJECT";
|
|
35478
35306
|
if (!hasProperties) {
|
|
35479
35307
|
cleaned.properties = {
|
|
35480
35308
|
[EMPTY_SCHEMA_PLACEHOLDER_NAME]: {
|
|
35481
|
-
type: "
|
|
35309
|
+
type: "BOOLEAN",
|
|
35482
35310
|
description: EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION
|
|
35483
35311
|
}
|
|
35484
35312
|
};
|
|
@@ -43858,10 +43686,32 @@ function createGaRpcActivation(options) {
|
|
|
43858
43686
|
accountsStatus: { kind: "complete" },
|
|
43859
43687
|
accounts: accounts.rows.map(({ selector, row }) => ({
|
|
43860
43688
|
selector,
|
|
43861
|
-
...redactAccountForSidebar(row)
|
|
43689
|
+
...gaAccountFields(redactAccountForSidebar(row))
|
|
43862
43690
|
}))
|
|
43863
43691
|
};
|
|
43864
43692
|
};
|
|
43693
|
+
const gaAccountFields = (account) => {
|
|
43694
|
+
const { email: _email, quota, ...rest } = account;
|
|
43695
|
+
const entry = (value) => {
|
|
43696
|
+
if (value === void 0) return void 0;
|
|
43697
|
+
const { remainingFraction: _fraction, windows, ...fields } = value;
|
|
43698
|
+
return windows === void 0 ? fields : {
|
|
43699
|
+
...fields,
|
|
43700
|
+
windows: windows.map(
|
|
43701
|
+
({ remainingFraction: _windowFraction, ...window }) => window
|
|
43702
|
+
)
|
|
43703
|
+
};
|
|
43704
|
+
};
|
|
43705
|
+
const gemini = entry(quota.gemini);
|
|
43706
|
+
const nonGemini = entry(quota["non-gemini"]);
|
|
43707
|
+
return {
|
|
43708
|
+
...rest,
|
|
43709
|
+
quota: {
|
|
43710
|
+
...gemini ? { gemini } : {},
|
|
43711
|
+
...nonGemini ? { "non-gemini": nonGemini } : {}
|
|
43712
|
+
}
|
|
43713
|
+
};
|
|
43714
|
+
};
|
|
43865
43715
|
const state = async (input2, signal) => {
|
|
43866
43716
|
const parsed = AntigravityStateInputSchema.parse(input2);
|
|
43867
43717
|
if (!parsed.ok) throw new GaRpcInputError(parsed.issues);
|
|
@@ -49045,6 +48895,7 @@ function createAuthLoader({
|
|
|
49045
48895
|
return {
|
|
49046
48896
|
index: entry.index,
|
|
49047
48897
|
label: entry.label,
|
|
48898
|
+
email: entry.email,
|
|
49048
48899
|
enabled: entry.enabled,
|
|
49049
48900
|
current: isAccountCurrent(entry.index, activeByFamily),
|
|
49050
48901
|
coolingDownUntil: entry.coolingDownUntil,
|
|
@@ -49298,6 +49149,185 @@ function createAuthLoader({
|
|
|
49298
49149
|
return authLoader;
|
|
49299
49150
|
}
|
|
49300
49151
|
|
|
49152
|
+
// src/plugin/vault-quota-refresh.ts
|
|
49153
|
+
async function checkAndPublishVaultQuota(input2, publishSidebar) {
|
|
49154
|
+
const report = await checkVaultQuota(input2);
|
|
49155
|
+
if (report.checked > 0 && !input2.signal.aborted) await publishSidebar();
|
|
49156
|
+
return report;
|
|
49157
|
+
}
|
|
49158
|
+
|
|
49159
|
+
// src/plugin/vault-sidebar-projection.ts
|
|
49160
|
+
function quotaReadingForVaultRoute(route, state) {
|
|
49161
|
+
const stored = state.accounts[route.accountIdentity];
|
|
49162
|
+
return stored?.observed.routeId === route.routeId && stored.observed.credentialId === route.credentialId ? stored.quota : void 0;
|
|
49163
|
+
}
|
|
49164
|
+
function buildVaultSidebarProjection(pool, state, checkedAt = Date.now()) {
|
|
49165
|
+
const projection = buildSidebarMachineStateFromAccounts(
|
|
49166
|
+
pool.selector.rows.map((row) => {
|
|
49167
|
+
const quota = quotaReadingForVaultRoute(row.route, state);
|
|
49168
|
+
return {
|
|
49169
|
+
index: row.index,
|
|
49170
|
+
email: row.route.email,
|
|
49171
|
+
enabled: row.enabled,
|
|
49172
|
+
current: false,
|
|
49173
|
+
coolingDownUntil: row.coolingDownUntil,
|
|
49174
|
+
healthScore: pool.selector.healthTracker.getScore(row.index),
|
|
49175
|
+
cachedQuota: quota ? cachedQuotaOf(quota) : void 0,
|
|
49176
|
+
cachedQuotaUpdatedAt: quota?.cachedQuotaUpdatedAt ?? void 0
|
|
49177
|
+
};
|
|
49178
|
+
}),
|
|
49179
|
+
{ checkedAt }
|
|
49180
|
+
);
|
|
49181
|
+
return {
|
|
49182
|
+
...projection,
|
|
49183
|
+
accounts: projection.accounts.map((account) => ({
|
|
49184
|
+
...account,
|
|
49185
|
+
id: `vault-${account.id}`
|
|
49186
|
+
}))
|
|
49187
|
+
};
|
|
49188
|
+
}
|
|
49189
|
+
|
|
49190
|
+
// src/plugin/background-vault-quota-refresh.ts
|
|
49191
|
+
var BackgroundVaultQuotaRefresh = class {
|
|
49192
|
+
constructor(options) {
|
|
49193
|
+
this.options = options;
|
|
49194
|
+
this.now = options.now ?? Date.now;
|
|
49195
|
+
this.random = options.random ?? Math.random;
|
|
49196
|
+
this.acquireLock = options.acquireLock ?? acquireFencedFileLock;
|
|
49197
|
+
}
|
|
49198
|
+
options;
|
|
49199
|
+
timer = null;
|
|
49200
|
+
inFlight = null;
|
|
49201
|
+
controller = null;
|
|
49202
|
+
disposed = false;
|
|
49203
|
+
started = false;
|
|
49204
|
+
now;
|
|
49205
|
+
random;
|
|
49206
|
+
acquireLock;
|
|
49207
|
+
start() {
|
|
49208
|
+
if (this.disposed || this.started) return;
|
|
49209
|
+
this.started = true;
|
|
49210
|
+
this.schedule(Math.floor(this.random() * 3e4));
|
|
49211
|
+
}
|
|
49212
|
+
/** Custody notifications cancel admitted work as soon as authority changes. */
|
|
49213
|
+
abortTick() {
|
|
49214
|
+
this.controller?.abort();
|
|
49215
|
+
}
|
|
49216
|
+
async dispose() {
|
|
49217
|
+
this.disposed = true;
|
|
49218
|
+
if (this.timer !== null) clearTimeout(this.timer);
|
|
49219
|
+
this.timer = null;
|
|
49220
|
+
this.abortTick();
|
|
49221
|
+
await this.inFlight;
|
|
49222
|
+
}
|
|
49223
|
+
schedule(delay) {
|
|
49224
|
+
if (this.disposed || !this.started) return;
|
|
49225
|
+
this.timer = setTimeout(() => {
|
|
49226
|
+
this.timer = null;
|
|
49227
|
+
void this.tick();
|
|
49228
|
+
}, delay);
|
|
49229
|
+
this.timer.unref?.();
|
|
49230
|
+
}
|
|
49231
|
+
/** One serialized tick; also used by deterministic composition tests. */
|
|
49232
|
+
tick() {
|
|
49233
|
+
if (this.disposed) return Promise.resolve();
|
|
49234
|
+
if (this.inFlight) return this.inFlight;
|
|
49235
|
+
const controller = new AbortController();
|
|
49236
|
+
this.controller = controller;
|
|
49237
|
+
let extraJitter = 0;
|
|
49238
|
+
this.inFlight = this.runTick(controller).catch(() => {
|
|
49239
|
+
extraJitter = 15e3;
|
|
49240
|
+
}).finally(() => {
|
|
49241
|
+
this.inFlight = null;
|
|
49242
|
+
this.controller = null;
|
|
49243
|
+
this.schedule(
|
|
49244
|
+
this.options.intervalMs + Math.floor(this.random() * this.options.intervalMs * 0.1) + extraJitter
|
|
49245
|
+
);
|
|
49246
|
+
});
|
|
49247
|
+
return this.inFlight;
|
|
49248
|
+
}
|
|
49249
|
+
async assertActive(controller) {
|
|
49250
|
+
if (this.disposed || await this.options.readAuthority() !== "vault")
|
|
49251
|
+
controller.abort();
|
|
49252
|
+
controller.signal.throwIfAborted();
|
|
49253
|
+
}
|
|
49254
|
+
async runTick(controller) {
|
|
49255
|
+
await this.assertActive(controller);
|
|
49256
|
+
ensureSidebarStateDir(this.options.sidebarStateFile);
|
|
49257
|
+
const lock = await this.acquireLock({
|
|
49258
|
+
path: this.options.sidebarStateFile,
|
|
49259
|
+
name: "bg-vault-quota-poll",
|
|
49260
|
+
ttlMs: 6e4,
|
|
49261
|
+
renew: true
|
|
49262
|
+
});
|
|
49263
|
+
if (!lock) return;
|
|
49264
|
+
let released = false;
|
|
49265
|
+
void lock.whenLost().then(() => {
|
|
49266
|
+
if (!released) controller.abort();
|
|
49267
|
+
});
|
|
49268
|
+
try {
|
|
49269
|
+
await this.assertActive(controller);
|
|
49270
|
+
await lock.assertOwned();
|
|
49271
|
+
const { source, pool } = await this.options.currentVaultPool();
|
|
49272
|
+
await this.assertActive(controller);
|
|
49273
|
+
await pool.sync();
|
|
49274
|
+
await this.assertActive(controller);
|
|
49275
|
+
const state = await this.options.readProviderState();
|
|
49276
|
+
await this.assertActive(controller);
|
|
49277
|
+
await lock.assertOwned();
|
|
49278
|
+
const threshold = Math.max(
|
|
49279
|
+
this.options.intervalMs - 6e4,
|
|
49280
|
+
Math.floor(this.options.intervalMs / 2)
|
|
49281
|
+
);
|
|
49282
|
+
const now = this.now();
|
|
49283
|
+
const due = pool.selector.rows.some((row) => {
|
|
49284
|
+
const quota = quotaReadingForVaultRoute(row.route, state);
|
|
49285
|
+
const at = quota?.cachedQuotaUpdatedAt;
|
|
49286
|
+
return quota?.cachedQuota == null || typeof at !== "number" || !Number.isFinite(at) || at < 0 || now - at >= threshold;
|
|
49287
|
+
});
|
|
49288
|
+
if (!due) return;
|
|
49289
|
+
await checkAndPublishVaultQuota(
|
|
49290
|
+
{
|
|
49291
|
+
pool,
|
|
49292
|
+
signal: controller.signal,
|
|
49293
|
+
now: this.now,
|
|
49294
|
+
fetchReading: async (ref, signal) => {
|
|
49295
|
+
await this.assertActive(controller);
|
|
49296
|
+
const reading = await fetchVaultAccountQuota({
|
|
49297
|
+
source,
|
|
49298
|
+
ref,
|
|
49299
|
+
signal,
|
|
49300
|
+
logger: this.options.logger,
|
|
49301
|
+
transport: async (url, init, extra) => {
|
|
49302
|
+
await this.assertActive(controller);
|
|
49303
|
+
await lock.assertOwned();
|
|
49304
|
+
controller.signal.throwIfAborted();
|
|
49305
|
+
return this.options.transport(
|
|
49306
|
+
url,
|
|
49307
|
+
{ ...init, signal: extra.signal ?? controller.signal },
|
|
49308
|
+
extra
|
|
49309
|
+
);
|
|
49310
|
+
}
|
|
49311
|
+
});
|
|
49312
|
+
await this.assertActive(controller);
|
|
49313
|
+
await lock.assertOwned();
|
|
49314
|
+
return reading;
|
|
49315
|
+
}
|
|
49316
|
+
},
|
|
49317
|
+
async () => {
|
|
49318
|
+
await this.assertActive(controller);
|
|
49319
|
+
await lock.assertOwned();
|
|
49320
|
+
await this.options.publishSidebar();
|
|
49321
|
+
}
|
|
49322
|
+
);
|
|
49323
|
+
} finally {
|
|
49324
|
+
released = true;
|
|
49325
|
+
await lock.release().catch(() => {
|
|
49326
|
+
});
|
|
49327
|
+
}
|
|
49328
|
+
}
|
|
49329
|
+
};
|
|
49330
|
+
|
|
49301
49331
|
// src/plugin/prompt-context.ts
|
|
49302
49332
|
function isRecord15(value) {
|
|
49303
49333
|
return typeof value === "object" && value !== null;
|
|
@@ -50568,6 +50598,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50568
50598
|
await drainSidebarWrites();
|
|
50569
50599
|
}
|
|
50570
50600
|
});
|
|
50601
|
+
let vaultQuotaPoller;
|
|
50571
50602
|
const vaultCustody = createOpenCodeVaultCustody({
|
|
50572
50603
|
accountFile: resolve11(getStoragePath()),
|
|
50573
50604
|
readHostSlot: async () => {
|
|
@@ -50578,7 +50609,10 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50578
50609
|
// The request executor reports failed bearer authorization to Claustrum,
|
|
50579
50610
|
// which decides whether its served credential needs replacement.
|
|
50580
50611
|
reporterSource: "direct",
|
|
50581
|
-
onAuthorityChanged: () =>
|
|
50612
|
+
onAuthorityChanged: (authority) => {
|
|
50613
|
+
if (authority !== "vault") vaultQuotaPoller?.abortTick();
|
|
50614
|
+
scheduleSidebarPublication();
|
|
50615
|
+
},
|
|
50582
50616
|
onRosterChanged: () => scheduleSidebarPublication()
|
|
50583
50617
|
});
|
|
50584
50618
|
let vaultPool;
|
|
@@ -50625,6 +50659,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50625
50659
|
return manager.getAccounts().map((entry) => ({
|
|
50626
50660
|
index: entry.index,
|
|
50627
50661
|
label: entry.label,
|
|
50662
|
+
email: entry.email,
|
|
50628
50663
|
enabled: entry.enabled,
|
|
50629
50664
|
current: isAccountCurrent(entry.index, activeByFamily),
|
|
50630
50665
|
coolingDownUntil: entry.coolingDownUntil,
|
|
@@ -50652,6 +50687,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50652
50687
|
return buildSidebarMachineStateFromAccounts(
|
|
50653
50688
|
manager?.getAccounts().map((entry) => ({
|
|
50654
50689
|
index: entry.index,
|
|
50690
|
+
email: entry.email,
|
|
50655
50691
|
enabled: entry.enabled,
|
|
50656
50692
|
current: active2 ? isAccountCurrent(entry.index, active2) : false,
|
|
50657
50693
|
coolingDownUntil: entry.coolingDownUntil,
|
|
@@ -50669,23 +50705,13 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50669
50705
|
vault: async () => {
|
|
50670
50706
|
const { pool } = await currentVaultPool();
|
|
50671
50707
|
await pool.sync();
|
|
50672
|
-
const projection =
|
|
50673
|
-
pool
|
|
50674
|
-
|
|
50675
|
-
|
|
50676
|
-
current: false,
|
|
50677
|
-
coolingDownUntil: entry.coolingDownUntil,
|
|
50678
|
-
healthScore: pool.selector.healthTracker.getScore(entry.index),
|
|
50679
|
-
cachedQuota: entry.cachedQuota,
|
|
50680
|
-
cachedQuotaUpdatedAt: entry.cachedQuotaUpdatedAt
|
|
50681
|
-
}))
|
|
50708
|
+
const projection = buildVaultSidebarProjection(
|
|
50709
|
+
pool,
|
|
50710
|
+
await vaultCustody.readState(),
|
|
50711
|
+
dependencies.clock.now()
|
|
50682
50712
|
);
|
|
50683
50713
|
return {
|
|
50684
50714
|
...projection,
|
|
50685
|
-
accounts: projection.accounts.map((account) => ({
|
|
50686
|
-
...account,
|
|
50687
|
-
id: `vault-${account.id}`
|
|
50688
|
-
})),
|
|
50689
50715
|
...projection.accounts.length === 0 ? { lastError: VAULT_ACCOUNT_REMEDY } : {}
|
|
50690
50716
|
};
|
|
50691
50717
|
},
|
|
@@ -50764,6 +50790,21 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50764
50790
|
options._onPollerCreated?.(poller);
|
|
50765
50791
|
poller.start();
|
|
50766
50792
|
lifecycle.register({ dispose: () => poller.dispose() }, "producer");
|
|
50793
|
+
vaultQuotaPoller = new BackgroundVaultQuotaRefresh({
|
|
50794
|
+
intervalMs: config.background_quota_refresh_interval_minutes * 6e4,
|
|
50795
|
+
sidebarStateFile: getSidebarStateFile(),
|
|
50796
|
+
readAuthority: readAuthority2,
|
|
50797
|
+
currentVaultPool,
|
|
50798
|
+
readProviderState: () => vaultCustody.readState(),
|
|
50799
|
+
publishSidebar: () => sidebarPublisher.publish(),
|
|
50800
|
+
transport: dependencies.fetchImpl,
|
|
50801
|
+
logger,
|
|
50802
|
+
now: dependencies.clock.now,
|
|
50803
|
+
random: dependencies.clock.random
|
|
50804
|
+
});
|
|
50805
|
+
options._onVaultPollerCreated?.(vaultQuotaPoller);
|
|
50806
|
+
vaultQuotaPoller.start();
|
|
50807
|
+
lifecycle.register(vaultQuotaPoller, "producer");
|
|
50767
50808
|
}
|
|
50768
50809
|
const operatorSettings = createOperatorSettingsController({
|
|
50769
50810
|
projectConfigPath: join29(directory, ".opencode", "antigravity.json"),
|
|
@@ -50887,17 +50928,21 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
50887
50928
|
vaultSelectors2.set(key, selector);
|
|
50888
50929
|
return selector;
|
|
50889
50930
|
},
|
|
50890
|
-
(signal) =>
|
|
50891
|
-
|
|
50892
|
-
|
|
50893
|
-
|
|
50894
|
-
|
|
50895
|
-
ref,
|
|
50896
|
-
|
|
50897
|
-
|
|
50898
|
-
|
|
50899
|
-
|
|
50900
|
-
|
|
50931
|
+
(signal) => checkAndPublishVaultQuota(
|
|
50932
|
+
{
|
|
50933
|
+
pool,
|
|
50934
|
+
signal,
|
|
50935
|
+
now: dependencies.clock.now,
|
|
50936
|
+
fetchReading: (ref, check) => fetchVaultAccountQuota({
|
|
50937
|
+
source,
|
|
50938
|
+
ref,
|
|
50939
|
+
signal: check,
|
|
50940
|
+
logger,
|
|
50941
|
+
transport: dependencies.fetchImpl
|
|
50942
|
+
})
|
|
50943
|
+
},
|
|
50944
|
+
() => sidebarPublisher.publish()
|
|
50945
|
+
)
|
|
50901
50946
|
)
|
|
50902
50947
|
})
|
|
50903
50948
|
};
|
|
@@ -51145,10 +51190,8 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
51145
51190
|
apply: async (request) => {
|
|
51146
51191
|
const current = await currentMenu();
|
|
51147
51192
|
if (current.kind === "unavailable") throw new Error(current.message);
|
|
51148
|
-
const
|
|
51149
|
-
|
|
51150
|
-
menuInvocation(pushNotification, request.sessionId)
|
|
51151
|
-
);
|
|
51193
|
+
const invocation = menuInvocation(pushNotification, request.sessionId);
|
|
51194
|
+
const result = await current.menu.apply(request, invocation);
|
|
51152
51195
|
try {
|
|
51153
51196
|
if (await readAuthority2() === "local")
|
|
51154
51197
|
await lifecycle.getAccountManager()?.refreshFromRepository();
|
|
@@ -51165,6 +51208,11 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
51165
51208
|
request.sessionId
|
|
51166
51209
|
);
|
|
51167
51210
|
}
|
|
51211
|
+
const refreshed = await currentMenu();
|
|
51212
|
+
if (refreshed.kind === "menu" && refreshed.menu !== current.menu) {
|
|
51213
|
+
const payload = await refreshed.menu.open(invocation);
|
|
51214
|
+
return { ...result, menu: payload.menu };
|
|
51215
|
+
}
|
|
51168
51216
|
return result;
|
|
51169
51217
|
},
|
|
51170
51218
|
drain: drainNotifications
|