@openlimiter/core 2.0.3 → 2.1.0
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/acquire/cadence.d.ts.map +1 -1
- package/dist/acquire/cadence.js +3 -2
- package/dist/acquire/cadence.js.map +1 -1
- package/dist/acquire/codex-app-server.d.ts +29 -0
- package/dist/acquire/codex-app-server.d.ts.map +1 -0
- package/dist/acquire/codex-app-server.js +218 -0
- package/dist/acquire/codex-app-server.js.map +1 -0
- package/dist/acquire/credentials.d.ts +6 -21
- package/dist/acquire/credentials.d.ts.map +1 -1
- package/dist/acquire/credentials.js +17 -46
- package/dist/acquire/credentials.js.map +1 -1
- package/dist/acquire/identity.d.ts +1 -1
- package/dist/acquire/identity.js +1 -1
- package/dist/acquire/index.d.ts +1 -1
- package/dist/acquire/index.d.ts.map +1 -1
- package/dist/acquire/index.js +1 -1
- package/dist/acquire/index.js.map +1 -1
- package/dist/acquire/providers.d.ts +8 -15
- package/dist/acquire/providers.d.ts.map +1 -1
- package/dist/acquire/providers.js +33 -36
- package/dist/acquire/providers.js.map +1 -1
- package/dist/acquire/runner.d.ts +4 -20
- package/dist/acquire/runner.d.ts.map +1 -1
- package/dist/acquire/runner.js +27 -156
- package/dist/acquire/runner.js.map +1 -1
- package/dist/acquire/transport.d.ts +26 -20
- package/dist/acquire/transport.d.ts.map +1 -1
- package/dist/acquire/transport.js +6 -19
- package/dist/acquire/transport.js.map +1 -1
- package/dist/cache.d.ts +19 -4
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +159 -68
- package/dist/cache.js.map +1 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +18 -9
- package/dist/collection.js.map +1 -1
- package/dist/contracts/claude-presentation.json +49 -0
- package/dist/contracts/wire.d.ts.map +1 -1
- package/dist/contracts/wire.js +11 -3
- package/dist/contracts/wire.js.map +1 -1
- package/dist/data-rules.d.ts +2 -0
- package/dist/data-rules.d.ts.map +1 -1
- package/dist/data-rules.js +34 -4
- package/dist/data-rules.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +16 -4
- package/dist/merge.js.map +1 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +5 -1
- package/dist/policy.js.map +1 -1
- package/dist/provider-presentation.d.ts +52 -0
- package/dist/provider-presentation.d.ts.map +1 -0
- package/dist/provider-presentation.js +264 -0
- package/dist/provider-presentation.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/acquire/antigravity-probe.d.ts +0 -142
- package/dist/acquire/antigravity-probe.d.ts.map +0 -1
- package/dist/acquire/antigravity-probe.js +0 -655
- package/dist/acquire/antigravity-probe.js.map +0 -1
package/dist/acquire/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export * from "./cadence.js";
|
|
|
2
2
|
export * from "./coordination.js";
|
|
3
3
|
export * from "./credentials.js";
|
|
4
4
|
export * from "./cursor.js";
|
|
5
|
+
export * from "./codex-app-server.js";
|
|
5
6
|
export * from "./identity.js";
|
|
6
7
|
export * from "./providers.js";
|
|
7
8
|
export * from "./runner.js";
|
|
8
9
|
export * from "./transport.js";
|
|
9
10
|
export * from "./windows-credential.js";
|
|
10
|
-
export * from "./antigravity-probe.js";
|
|
11
11
|
export * from "./antigravity-meters.js";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/acquire/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/acquire/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
package/dist/acquire/index.js
CHANGED
|
@@ -2,11 +2,11 @@ export * from "./cadence.js";
|
|
|
2
2
|
export * from "./coordination.js";
|
|
3
3
|
export * from "./credentials.js";
|
|
4
4
|
export * from "./cursor.js";
|
|
5
|
+
export * from "./codex-app-server.js";
|
|
5
6
|
export * from "./identity.js";
|
|
6
7
|
export * from "./providers.js";
|
|
7
8
|
export * from "./runner.js";
|
|
8
9
|
export * from "./transport.js";
|
|
9
10
|
export * from "./windows-credential.js";
|
|
10
|
-
export * from "./antigravity-probe.js";
|
|
11
11
|
export * from "./antigravity-meters.js";
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/acquire/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/acquire/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* cadence, coordination and configuration, and they are separate on purpose.
|
|
8
8
|
*/
|
|
9
9
|
import type { RawMeter } from "../types.js";
|
|
10
|
-
import type { AcquiredCredential } from "./credentials.js";
|
|
11
10
|
import type { AcquisitionSpec, AcquisitionStep } from "./runner.js";
|
|
12
11
|
export type PayloadParser = (payload: unknown, now: string) => readonly RawMeter[] | null;
|
|
13
12
|
/**
|
|
@@ -22,18 +21,12 @@ export declare const ACQUISITION_DISCLOSURE: {
|
|
|
22
21
|
readonly claude: string;
|
|
23
22
|
readonly codex: "reads the login the Codex CLI stored, may break when OpenAI changes it";
|
|
24
23
|
readonly gemini: "reads the login the Gemini CLI stored, may break when Google changes it";
|
|
25
|
-
readonly antigravity: string;
|
|
26
24
|
readonly grok: string;
|
|
27
|
-
readonly antigravityShared: string;
|
|
28
25
|
readonly kimi: "reads the login the Kimi CLI stored, may break when Moonshot changes it";
|
|
29
26
|
readonly openrouter: "reads OpenRouter's documented key report with your own key";
|
|
30
27
|
};
|
|
31
28
|
/** What the Code Assist bootstrap calls the project the quota read is scoped to. */
|
|
32
29
|
export declare const CODE_ASSIST_PROJECT_FIELD = "cloudaicompanionProject";
|
|
33
|
-
/** The account label a reading taken from the shared Gemini login carries. */
|
|
34
|
-
export declare const SHARED_CODE_ASSIST_ACCOUNT = "gemini-cli-shared";
|
|
35
|
-
/** What a surface should print for that account instead of the identifier. */
|
|
36
|
-
export declare const SHARED_CODE_ASSIST_LABEL = "Shared Google Code Assist quota";
|
|
37
30
|
/** The list a bootstrap carries when it answered and withheld the project. */
|
|
38
31
|
export declare const CODE_ASSIST_TIERS_FIELD = "allowedTiers";
|
|
39
32
|
/**
|
|
@@ -54,6 +47,8 @@ export declare const CODE_ASSIST_TIERS_FIELD = "allowedTiers";
|
|
|
54
47
|
* is not this, stays an ordinary transient failure on the ordinary cadence.
|
|
55
48
|
*/
|
|
56
49
|
export declare const CODE_ASSIST_IDENTITY_SENTENCE: string;
|
|
50
|
+
export declare const GEMINI_CLI_CONSUMER_RETIRED_NOTE = "Google ended Gemini CLI sign in for this plan on June 18, 2026.";
|
|
51
|
+
export declare function isRetiredGeminiCliTier(value: unknown): boolean;
|
|
57
52
|
/**
|
|
58
53
|
* The two step Code Assist read, shared by Gemini CLI and Antigravity.
|
|
59
54
|
*
|
|
@@ -61,16 +56,17 @@ export declare const CODE_ASSIST_IDENTITY_SENTENCE: string;
|
|
|
61
56
|
* that names no project produces no request, which the runner reads as a shape
|
|
62
57
|
* this build did not understand rather than as a reason to ask anyway.
|
|
63
58
|
*/
|
|
64
|
-
export declare function codeAssistSteps(
|
|
59
|
+
export declare function codeAssistSteps(options?: {
|
|
60
|
+
readonly retireConsumerTiers?: boolean;
|
|
61
|
+
}): readonly AcquisitionStep[];
|
|
65
62
|
export interface ClaudeSpecOptions {
|
|
66
63
|
readonly parse: PayloadParser;
|
|
67
64
|
/**
|
|
68
65
|
* Whether the poll is on.
|
|
69
66
|
*
|
|
70
|
-
* Off
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* person opts into it knowing what it does.
|
|
67
|
+
* Off in every code path that does not read a recorded choice. The documented
|
|
68
|
+
* status line payload is Claude's primary source; this poll only exists for
|
|
69
|
+
* the hours Claude Code is closed.
|
|
74
70
|
*/
|
|
75
71
|
readonly enabled: boolean;
|
|
76
72
|
}
|
|
@@ -78,9 +74,6 @@ export declare function claudeSpec(options: ClaudeSpecOptions): AcquisitionSpec;
|
|
|
78
74
|
export declare function codexSpec(parse: PayloadParser): AcquisitionSpec;
|
|
79
75
|
export declare function cursorSpec(parse: PayloadParser): AcquisitionSpec;
|
|
80
76
|
export declare function geminiCliSpec(parse: PayloadParser): AcquisitionSpec;
|
|
81
|
-
/** Whether this credential is the Gemini CLI's, borrowed for the shared quota. */
|
|
82
|
-
export declare function isSharedCodeAssist(credential: AcquiredCredential): boolean;
|
|
83
|
-
export declare function antigravitySpec(parse: PayloadParser): AcquisitionSpec;
|
|
84
77
|
export declare function grokSpec(parse: PayloadParser): AcquisitionSpec;
|
|
85
78
|
export declare function kimiSpec(parse: PayloadParser): AcquisitionSpec;
|
|
86
79
|
export declare function openrouterSpec(parse: PayloadParser): AcquisitionSpec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/acquire/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/acquire/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAapE,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,KACR,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;CAazB,CAAC;AAEX,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAEnE,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,6BAA6B,QAEU,CAAC;AAErD,eAAO,MAAM,gCAAgC,oEACsB,CAAC;AAiBpE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,SAAS,eAAe,EAAE,CA2BpH;AAQD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CAWtE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAiB/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAOhE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CASnE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAU9D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAQ9D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAQpE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { cursorAccountId } from "./cursor.js";
|
|
2
|
-
import { claudeUsageRequest, codeAssistLoadRequest, codeAssistQuotaRequest,
|
|
2
|
+
import { claudeUsageRequest, codeAssistLoadRequest, codeAssistQuotaRequest, cursorUsageRequest, grokBillingRequest, kimiUsageRequest, openrouterKeyRequest } from "./transport.js";
|
|
3
|
+
import { codexAppServerRequest } from "./codex-app-server.js";
|
|
4
|
+
import { acquisitionAccountId } from "./identity.js";
|
|
3
5
|
/**
|
|
4
6
|
* The sentence each row carries about how its number was obtained.
|
|
5
7
|
*
|
|
@@ -9,26 +11,18 @@ import { claudeUsageRequest, codeAssistLoadRequest, codeAssistQuotaRequest, code
|
|
|
9
11
|
* once rather than implied.
|
|
10
12
|
*/
|
|
11
13
|
export const ACQUISITION_DISCLOSURE = {
|
|
12
|
-
claude: "polls Anthropic with the token Claude Code stored on this machine
|
|
13
|
-
"
|
|
14
|
+
claude: "polls Anthropic with the token Claude Code stored on this machine after " +
|
|
15
|
+
"a recorded choice",
|
|
14
16
|
codex: "reads the login the Codex CLI stored, may break when OpenAI changes it",
|
|
15
17
|
gemini: "reads the login the Gemini CLI stored, may break when Google changes it",
|
|
16
|
-
antigravity: "reads the credential the Antigravity CLI stored, may break when Google " +
|
|
17
|
-
"changes it",
|
|
18
18
|
grok: "reads the login the Grok CLI stored, without the client marker xAI's own " +
|
|
19
19
|
"tool sends, so this request is verified on the first install that has a " +
|
|
20
20
|
"Grok login",
|
|
21
|
-
antigravityShared: "shared Google Code Assist quota from the Gemini CLI login, not " +
|
|
22
|
-
"Antigravity's own login",
|
|
23
21
|
kimi: "reads the login the Kimi CLI stored, may break when Moonshot changes it",
|
|
24
22
|
openrouter: "reads OpenRouter's documented key report with your own key"
|
|
25
23
|
};
|
|
26
24
|
/** What the Code Assist bootstrap calls the project the quota read is scoped to. */
|
|
27
25
|
export const CODE_ASSIST_PROJECT_FIELD = "cloudaicompanionProject";
|
|
28
|
-
/** The account label a reading taken from the shared Gemini login carries. */
|
|
29
|
-
export const SHARED_CODE_ASSIST_ACCOUNT = "gemini-cli-shared";
|
|
30
|
-
/** What a surface should print for that account instead of the identifier. */
|
|
31
|
-
export const SHARED_CODE_ASSIST_LABEL = "Shared Google Code Assist quota";
|
|
32
26
|
/** The list a bootstrap carries when it answered and withheld the project. */
|
|
33
27
|
export const CODE_ASSIST_TIERS_FIELD = "allowedTiers";
|
|
34
28
|
/**
|
|
@@ -50,9 +44,27 @@ export const CODE_ASSIST_TIERS_FIELD = "allowedTiers";
|
|
|
50
44
|
*/
|
|
51
45
|
export const CODE_ASSIST_IDENTITY_SENTENCE = "Google answers this quota only to its own tools, so it is read here only " +
|
|
52
46
|
"when another tool on this machine has written it";
|
|
47
|
+
export const GEMINI_CLI_CONSUMER_RETIRED_NOTE = "Google ended Gemini CLI sign in for this plan on June 18, 2026.";
|
|
48
|
+
const GEMINI_CLI_RETIRED_TIER_IDS = new Set([
|
|
49
|
+
"free-tier",
|
|
50
|
+
"g1-pro-tier",
|
|
51
|
+
"g1-ultra-tier"
|
|
52
|
+
]);
|
|
53
53
|
function isRecord(value) {
|
|
54
54
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55
55
|
}
|
|
56
|
+
function tierId(value) {
|
|
57
|
+
if (!isRecord(value))
|
|
58
|
+
return null;
|
|
59
|
+
return typeof value["id"] === "string" ? value["id"] : null;
|
|
60
|
+
}
|
|
61
|
+
export function isRetiredGeminiCliTier(value) {
|
|
62
|
+
if (!isRecord(value))
|
|
63
|
+
return false;
|
|
64
|
+
const paidTier = tierId(value["paidTier"]);
|
|
65
|
+
const currentTier = tierId(value["currentTier"]);
|
|
66
|
+
return GEMINI_CLI_RETIRED_TIER_IDS.has(paidTier ?? currentTier ?? "");
|
|
67
|
+
}
|
|
56
68
|
/**
|
|
57
69
|
* The two step Code Assist read, shared by Gemini CLI and Antigravity.
|
|
58
70
|
*
|
|
@@ -60,7 +72,7 @@ function isRecord(value) {
|
|
|
60
72
|
* that names no project produces no request, which the runner reads as a shape
|
|
61
73
|
* this build did not understand rather than as a reason to ask anyway.
|
|
62
74
|
*/
|
|
63
|
-
export function codeAssistSteps() {
|
|
75
|
+
export function codeAssistSteps(options = {}) {
|
|
64
76
|
return [
|
|
65
77
|
({ credential }) => codeAssistLoadRequest(credential.secret),
|
|
66
78
|
({ credential, previous }) => {
|
|
@@ -68,6 +80,9 @@ export function codeAssistSteps() {
|
|
|
68
80
|
/* Not an object at all is a shape this build does not understand. */
|
|
69
81
|
if (!isRecord(bootstrap))
|
|
70
82
|
return null;
|
|
83
|
+
if (options.retireConsumerTiers && isRetiredGeminiCliTier(bootstrap)) {
|
|
84
|
+
return { stop: "quota_unavailable" };
|
|
85
|
+
}
|
|
71
86
|
const project = bootstrap[CODE_ASSIST_PROJECT_FIELD];
|
|
72
87
|
if (typeof project === "string") {
|
|
73
88
|
return codeAssistQuotaRequest(credential.secret, project);
|
|
@@ -88,7 +103,8 @@ export function codeAssistSteps() {
|
|
|
88
103
|
}
|
|
89
104
|
/** The sentence overrides both Code Assist readers carry. */
|
|
90
105
|
const codeAssistSentences = {
|
|
91
|
-
identity_refused: CODE_ASSIST_IDENTITY_SENTENCE
|
|
106
|
+
identity_refused: CODE_ASSIST_IDENTITY_SENTENCE,
|
|
107
|
+
quota_unavailable: GEMINI_CLI_CONSUMER_RETIRED_NOTE
|
|
92
108
|
};
|
|
93
109
|
export function claudeSpec(options) {
|
|
94
110
|
return {
|
|
@@ -106,9 +122,10 @@ export function codexSpec(parse) {
|
|
|
106
122
|
provider: "CODEX",
|
|
107
123
|
credentialProvider: "CODEX",
|
|
108
124
|
steps: [
|
|
109
|
-
({ credential }) => credential.accountId === null
|
|
125
|
+
({ credential }) => credential.accountId === null ||
|
|
126
|
+
credential.codexHome === undefined || credential.executable === undefined
|
|
110
127
|
? null
|
|
111
|
-
:
|
|
128
|
+
: codexAppServerRequest(credential.executable, credential.codexHome, acquisitionAccountId("CODEX", credential))
|
|
112
129
|
],
|
|
113
130
|
parse,
|
|
114
131
|
disclosure: ACQUISITION_DISCLOSURE.codex
|
|
@@ -126,32 +143,12 @@ export function geminiCliSpec(parse) {
|
|
|
126
143
|
return {
|
|
127
144
|
provider: "GEMINI_CLI",
|
|
128
145
|
credentialProvider: "GEMINI_CLI",
|
|
129
|
-
steps: codeAssistSteps(),
|
|
146
|
+
steps: codeAssistSteps({ retireConsumerTiers: true }),
|
|
130
147
|
parse,
|
|
131
148
|
disclosure: ACQUISITION_DISCLOSURE.gemini,
|
|
132
149
|
outcomeSentence: codeAssistSentences
|
|
133
150
|
};
|
|
134
151
|
}
|
|
135
|
-
/** Whether this credential is the Gemini CLI's, borrowed for the shared quota. */
|
|
136
|
-
export function isSharedCodeAssist(credential) {
|
|
137
|
-
return credential.origin === "shared_code_assist";
|
|
138
|
-
}
|
|
139
|
-
export function antigravitySpec(parse) {
|
|
140
|
-
return {
|
|
141
|
-
provider: "ANTIGRAVITY",
|
|
142
|
-
credentialProvider: "ANTIGRAVITY",
|
|
143
|
-
steps: codeAssistSteps(),
|
|
144
|
-
parse,
|
|
145
|
-
disclosure: ACQUISITION_DISCLOSURE.antigravity,
|
|
146
|
-
outcomeSentence: codeAssistSentences,
|
|
147
|
-
/* A reading taken from the Gemini CLI's file is filed under its own account
|
|
148
|
-
label, so it can never be mistaken in the cache, on a bar or in a sync
|
|
149
|
-
for a login the person made to Antigravity. */
|
|
150
|
-
accountIdFor: (credential) => isSharedCodeAssist(credential) ? SHARED_CODE_ASSIST_ACCOUNT : null,
|
|
151
|
-
accountLabelFor: (credential) => isSharedCodeAssist(credential) ? SHARED_CODE_ASSIST_LABEL : null,
|
|
152
|
-
disclosureFor: (credential) => isSharedCodeAssist(credential) ? ACQUISITION_DISCLOSURE.antigravityShared : null
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
152
|
export function grokSpec(parse) {
|
|
156
153
|
return {
|
|
157
154
|
provider: "GROK",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/acquire/providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/acquire/providers.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAA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oBAAoB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpE,KAAK;QACL,UAAU,EAAE,sBAAsB,CAAC,UAAU;KAC9C,CAAC;AACJ,CAAC"}
|
package/dist/acquire/runner.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { ProviderCode, RawMeter } from "../types.js";
|
|
|
4
4
|
import { type AcquisitionSchedule } from "./cadence.js";
|
|
5
5
|
import { type AcquiredCredential, type AcquisitionProvider, type CredentialLookupOptions, type CredentialResult } from "./credentials.js";
|
|
6
6
|
import { type AcquisitionOutcome, type AcquisitionRequest, type AcquisitionTransport } from "./transport.js";
|
|
7
|
-
import { type AntigravityProbeOptions, type AntigravityProbeResult } from "./antigravity-probe.js";
|
|
8
7
|
export interface AcquisitionStepContext {
|
|
9
8
|
readonly credential: AcquiredCredential;
|
|
10
9
|
/** The parsed bodies of the steps already taken, oldest first. */
|
|
@@ -24,14 +23,14 @@ export type AcquisitionStepResult = AcquisitionRequest | {
|
|
|
24
23
|
/**
|
|
25
24
|
* One request in a provider's read.
|
|
26
25
|
*
|
|
27
|
-
* Most providers have exactly one.
|
|
26
|
+
* Most providers have exactly one. Code Assist has two, because the
|
|
28
27
|
* first answers with the companion project the second has to be scoped to.
|
|
29
28
|
*/
|
|
30
29
|
export type AcquisitionStep = (context: AcquisitionStepContext) => AcquisitionStepResult | null;
|
|
31
30
|
export interface AcquisitionSpec {
|
|
32
31
|
/** The provider code the resulting rows carry. */
|
|
33
32
|
readonly provider: ProviderCode;
|
|
34
|
-
/** Whose stored credential this read uses.
|
|
33
|
+
/** Whose stored credential this read uses. */
|
|
35
34
|
readonly credentialProvider: AcquisitionProvider;
|
|
36
35
|
readonly steps: readonly AcquisitionStep[];
|
|
37
36
|
/** The connector parser for this provider's response, injected by the caller. */
|
|
@@ -48,14 +47,7 @@ export interface AcquisitionSpec {
|
|
|
48
47
|
readonly enabled?: boolean;
|
|
49
48
|
/** Why it is off, in the words the row prints. */
|
|
50
49
|
readonly disabledReason?: string;
|
|
51
|
-
/**
|
|
52
|
-
* The account label these rows carry, when the credential decides it.
|
|
53
|
-
*
|
|
54
|
-
* Antigravity is the reason this exists. Reading the Gemini CLI's file is a
|
|
55
|
-
* legitimate way to reach the shared Code Assist quota, and it is not
|
|
56
|
-
* Antigravity's own login, so the rows are filed under an account that says
|
|
57
|
-
* which it was rather than under the provider's unnamed default.
|
|
58
|
-
*/
|
|
50
|
+
/** The account identity these rows carry when the credential decides it. */
|
|
59
51
|
readonly accountIdFor?: (credential: AcquiredCredential) => string | null;
|
|
60
52
|
/** The disclosure these rows carry, when the credential changes it. */
|
|
61
53
|
readonly disclosureFor?: (credential: AcquiredCredential) => string | null;
|
|
@@ -67,7 +59,7 @@ export interface AcquisitionSpec {
|
|
|
67
59
|
/** What one provider's row says after a round. */
|
|
68
60
|
export type AcquisitionStatus = "read" | "stale" | "waiting" | "not_detected" | "off";
|
|
69
61
|
export interface AcquisitionRow {
|
|
70
|
-
readonly availability?: "expired_credentials" | "access_denied" | "rate_limited";
|
|
62
|
+
readonly availability?: "expired_credentials" | "access_denied" | "quota_unavailable" | "rate_limited";
|
|
71
63
|
readonly retryAt?: string;
|
|
72
64
|
readonly provider: ProviderCode;
|
|
73
65
|
/** The account these rows were filed under, when one was decided. */
|
|
@@ -105,14 +97,6 @@ export interface AcquisitionRunOptions {
|
|
|
105
97
|
* rather than invented by a parser.
|
|
106
98
|
*/
|
|
107
99
|
readonly stamp?: (meters: readonly RawMeter[], credential: AcquiredCredential) => readonly RawMeter[];
|
|
108
|
-
readonly probeAntigravity?: (options?: AntigravityProbeOptions) => Promise<AntigravityProbeResult>;
|
|
109
|
-
/**
|
|
110
|
-
* How the Antigravity probe turns a pid into the executable path it checks
|
|
111
|
-
* against the trusted install roots. Threaded through from here rather than
|
|
112
|
-
* left to the probe's own untrusted fallback, so a caller that wants a
|
|
113
|
-
* verified reading always gets one: see `resolveAgyExecutablePath`.
|
|
114
|
-
*/
|
|
115
|
-
readonly resolveExecutablePath?: (pid: string) => Promise<string | null>;
|
|
116
100
|
}
|
|
117
101
|
/**
|
|
118
102
|
* The failure vocabulary the cache understands, from ours.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/acquire/runner.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAA2E,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACzH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAC;AACpE,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/acquire/runner.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAA2E,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACzH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAC;AACpE,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AAGxB,M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SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,cAAc,CAAC,EAAE,CACxB,QAAQ,EAAE,mBAAmB,KAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CACf,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,UAAU,EAAE,kBAAkB,KAC3B,SAAS,QAAQ,EAAE,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,kBAAkB,GAC1B,uBAAuB,CAKzB;AAYD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKnD;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQtF;AAwED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,SAAS,eAAe,EAAE,EACjC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA4P/B"}
|
package/dist/acquire/runner.js
CHANGED
|
@@ -19,8 +19,6 @@ import { acquireMachineLease, recordAcquisitionAvailability, withPolicyFreshness
|
|
|
19
19
|
import { ACQUISITION_OUTCOME_SENTENCE, isProviderDue, nextAttemptInstant } from "./cadence.js";
|
|
20
20
|
import { CREDENTIAL_FAILURE_SENTENCE, credentialCandidatePaths, readAcquisitionCredential } from "./credentials.js";
|
|
21
21
|
import { outcomeForStatus } from "./transport.js";
|
|
22
|
-
import { AGY_NOT_RUNNING_SENTENCE } from "./antigravity-probe.js";
|
|
23
|
-
import { isSharedCodeAssist } from "./providers.js";
|
|
24
22
|
import { acquisitionAccountId } from "./identity.js";
|
|
25
23
|
/**
|
|
26
24
|
* The failure vocabulary the cache understands, from ours.
|
|
@@ -98,10 +96,13 @@ async function attempt(spec, credential, options) {
|
|
|
98
96
|
return { outcome: "transport", meters: [], retryAfterSeconds: null, phase: "request" };
|
|
99
97
|
}
|
|
100
98
|
retryAfter = reply.retryAfterSeconds;
|
|
99
|
+
if (reply.missingCredential === true) {
|
|
100
|
+
return { outcome: "transport", meters: [], retryAfterSeconds: null, phase: "request", missingCredential: true };
|
|
101
|
+
}
|
|
101
102
|
if (reply.status === 0) {
|
|
102
103
|
return { outcome: "too_large", meters: [], retryAfterSeconds: retryAfter, phase: "request" };
|
|
103
104
|
}
|
|
104
|
-
const outcome = outcomeForStatus(reply.status);
|
|
105
|
+
const outcome = reply.outcome ?? outcomeForStatus(reply.status);
|
|
105
106
|
if (outcome !== "ok")
|
|
106
107
|
return { outcome, meters: [], retryAfterSeconds: retryAfter, phase: "request" };
|
|
107
108
|
let body;
|
|
@@ -154,13 +155,7 @@ export async function runAcquisition(specs, options) {
|
|
|
154
155
|
...options.lookup,
|
|
155
156
|
now: options.now
|
|
156
157
|
}));
|
|
157
|
-
const
|
|
158
|
-
const readCredential = async (provider) => {
|
|
159
|
-
const result = await credentialReader(provider);
|
|
160
|
-
if (result.ok)
|
|
161
|
-
observedCredentials.set(provider, result.credential);
|
|
162
|
-
return result;
|
|
163
|
-
};
|
|
158
|
+
const readCredential = credentialReader;
|
|
164
159
|
const revisionFor = async (spec) => {
|
|
165
160
|
const credential = await readCredential(spec.credentialProvider);
|
|
166
161
|
const files = options.readCredential && !options.lookup ? [] : credentialCandidatePaths(spec.credentialProvider, options.lookup);
|
|
@@ -177,10 +172,14 @@ export async function runAcquisition(specs, options) {
|
|
|
177
172
|
/* Where the provider being read is right now, for the outer catch. */
|
|
178
173
|
let phase = "credential";
|
|
179
174
|
const failure = (failedIn, outcome) => outcome === "ok" ? {} : { phase: failedIn, errorClass: outcome };
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
/* Outcomes that wait a day and belong to the credential itself, so a new
|
|
176
|
+
credential releases them: a retired plan is one of those (Astra, 2026-10-01). */
|
|
177
|
+
const refused = (outcome) => outcome === "unauthorized" || outcome === "blocked" || outcome === "identity_refused" || outcome === "quota_unavailable";
|
|
178
|
+
const outcomeAvailability = (outcome) => outcome === "quota_unavailable"
|
|
179
|
+
? { availability: "quota_unavailable" }
|
|
180
|
+
: outcome === "unauthorized"
|
|
181
|
+
? { availability: "expired_credentials" }
|
|
182
|
+
: outcome === "blocked" || outcome === "identity_refused" ? { availability: "access_denied" } : {};
|
|
184
183
|
/**
|
|
185
184
|
* One provider, start to finish.
|
|
186
185
|
*
|
|
@@ -208,7 +207,7 @@ export async function runAcquisition(specs, options) {
|
|
|
208
207
|
provider: spec.provider,
|
|
209
208
|
detected: true,
|
|
210
209
|
status: "waiting",
|
|
211
|
-
...(existing ?
|
|
210
|
+
...(existing ? outcomeAvailability(existing.outcome) : {}),
|
|
212
211
|
reason: existing === undefined
|
|
213
212
|
? null
|
|
214
213
|
: ACQUISITION_OUTCOME_SENTENCE[existing.outcome],
|
|
@@ -217,126 +216,6 @@ export async function runAcquisition(specs, options) {
|
|
|
217
216
|
});
|
|
218
217
|
return;
|
|
219
218
|
}
|
|
220
|
-
if (spec.provider === "ANTIGRAVITY" && options.probeAntigravity !== undefined) {
|
|
221
|
-
phase = "probe";
|
|
222
|
-
let probeResult;
|
|
223
|
-
try {
|
|
224
|
-
probeResult = await options.probeAntigravity({
|
|
225
|
-
now: options.now,
|
|
226
|
-
...(options.lookup !== undefined ? { lookup: options.lookup } : {}),
|
|
227
|
-
...(options.resolveExecutablePath !== undefined
|
|
228
|
-
? { resolveExecutablePath: options.resolveExecutablePath }
|
|
229
|
-
: {})
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
probeResult = { ok: false, reason: "unreachable" };
|
|
234
|
-
}
|
|
235
|
-
if (probeResult.ok && probeResult.meters.length > 0) {
|
|
236
|
-
const nextAttemptAt = nextAttemptInstant("ok", options.now);
|
|
237
|
-
schedule[spec.provider] = {
|
|
238
|
-
lastAttemptAt: options.now,
|
|
239
|
-
nextAttemptAt: nextAttemptAt ?? options.now,
|
|
240
|
-
outcome: "ok"
|
|
241
|
-
};
|
|
242
|
-
const accountId = acquisitionAccountId("ANTIGRAVITY", { secret: "", accountId: null, origin: "vendor_store" });
|
|
243
|
-
const snapshots = normalizeMeters(stamp(probeResult.meters, {
|
|
244
|
-
secret: "",
|
|
245
|
-
accountId: null,
|
|
246
|
-
expiresAtMilliseconds: null,
|
|
247
|
-
origin: "vendor_store"
|
|
248
|
-
}).map(row => ({ ...row, accountId })));
|
|
249
|
-
if (snapshots.length > 0) {
|
|
250
|
-
rows.push({
|
|
251
|
-
provider: spec.provider,
|
|
252
|
-
accountId,
|
|
253
|
-
detected: true,
|
|
254
|
-
status: "read",
|
|
255
|
-
reason: null,
|
|
256
|
-
nextAttemptAt,
|
|
257
|
-
disclosure: spec.disclosure
|
|
258
|
-
});
|
|
259
|
-
reports.push({
|
|
260
|
-
ok: true,
|
|
261
|
-
provider: spec.provider,
|
|
262
|
-
accountId,
|
|
263
|
-
observedAt: options.now,
|
|
264
|
-
snapshots
|
|
265
|
-
});
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (!probeResult.ok && probeResult.reason === "not_running") {
|
|
270
|
-
const credential = await readCredential(spec.credentialProvider);
|
|
271
|
-
if (credential.ok && isSharedCodeAssist(credential.credential)) {
|
|
272
|
-
const fallbackResult = await attempt(spec, credential.credential, options);
|
|
273
|
-
if (fallbackResult.outcome !== "ok") {
|
|
274
|
-
const expired = fallbackResult.expiredCredentials === true;
|
|
275
|
-
const nextAttemptAt = expired ? null : nextAttemptInstant(fallbackResult.outcome, options.now, fallbackResult.retryAfterSeconds, existing?.attempts ?? options.lease?.attempts ?? 0);
|
|
276
|
-
if (expired)
|
|
277
|
-
delete schedule[spec.provider];
|
|
278
|
-
if (nextAttemptAt)
|
|
279
|
-
schedule[spec.provider] = { lastAttemptAt: options.now, nextAttemptAt, outcome: fallbackResult.outcome, attempts: (existing?.attempts ?? options.lease?.attempts ?? 0) + 1,
|
|
280
|
-
...failure(fallbackResult.phase ?? "request", fallbackResult.outcome),
|
|
281
|
-
...(refused(fallbackResult.outcome) ? { refusalRevision: await revisionFor(spec) } : {}) };
|
|
282
|
-
rows.push({ provider: spec.provider, detected: true, status: "stale", reason: expired ? CREDENTIAL_FAILURE_SENTENCE.expired : ACQUISITION_OUTCOME_SENTENCE[fallbackResult.outcome], nextAttemptAt, disclosure: spec.disclosure,
|
|
283
|
-
...(expired ? { availability: "expired_credentials" } : fallbackResult.outcome === "rate_limited" && nextAttemptAt ? { availability: "rate_limited", retryAt: nextAttemptAt } : refusalAvailability(fallbackResult.outcome)) });
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (fallbackResult.outcome === "ok" && fallbackResult.meters.length > 0) {
|
|
287
|
-
const accountId = spec.accountIdFor?.(credential.credential) ?? acquisitionAccountId(spec.provider, credential.credential);
|
|
288
|
-
const accountLabel = spec.accountLabelFor?.(credential.credential) ?? null;
|
|
289
|
-
const disclosure = spec.disclosureFor?.(credential.credential) ?? spec.disclosure;
|
|
290
|
-
const nextAttemptAt = nextAttemptInstant("ok", options.now);
|
|
291
|
-
schedule[spec.provider] = {
|
|
292
|
-
lastAttemptAt: options.now,
|
|
293
|
-
nextAttemptAt: nextAttemptAt ?? options.now,
|
|
294
|
-
outcome: "ok"
|
|
295
|
-
};
|
|
296
|
-
const snapshots = normalizeMeters(stamp(fallbackResult.meters, credential.credential).map((entry) => ({
|
|
297
|
-
...entry,
|
|
298
|
-
...(accountId === null ? {} : { accountId }),
|
|
299
|
-
...(accountLabel === null ? {} : { accountLabel })
|
|
300
|
-
})));
|
|
301
|
-
if (snapshots.length > 0) {
|
|
302
|
-
rows.push({
|
|
303
|
-
provider: spec.provider,
|
|
304
|
-
...(accountId === null ? {} : { accountId }),
|
|
305
|
-
detected: true,
|
|
306
|
-
status: "read",
|
|
307
|
-
reason: null,
|
|
308
|
-
nextAttemptAt,
|
|
309
|
-
disclosure
|
|
310
|
-
});
|
|
311
|
-
reports.push({
|
|
312
|
-
ok: true,
|
|
313
|
-
provider: spec.provider,
|
|
314
|
-
...(accountId === null ? {} : { accountId }),
|
|
315
|
-
observedAt: options.now,
|
|
316
|
-
snapshots
|
|
317
|
-
});
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const nextAttemptAt = nextAttemptInstant("not_running", options.now);
|
|
323
|
-
schedule[spec.provider] = {
|
|
324
|
-
lastAttemptAt: options.now,
|
|
325
|
-
nextAttemptAt: nextAttemptAt ?? options.now,
|
|
326
|
-
outcome: "not_running",
|
|
327
|
-
...failure("probe", "not_running")
|
|
328
|
-
};
|
|
329
|
-
rows.push({
|
|
330
|
-
provider: spec.provider,
|
|
331
|
-
detected: true,
|
|
332
|
-
status: "stale",
|
|
333
|
-
reason: AGY_NOT_RUNNING_SENTENCE,
|
|
334
|
-
nextAttemptAt,
|
|
335
|
-
disclosure: spec.disclosure
|
|
336
|
-
});
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
219
|
phase = "credential";
|
|
341
220
|
const credential = await readCredential(spec.credentialProvider);
|
|
342
221
|
if (!credential.ok) {
|
|
@@ -367,6 +246,18 @@ export async function runAcquisition(specs, options) {
|
|
|
367
246
|
const sentence = (outcome) => spec.outcomeSentence?.[outcome] ?? ACQUISITION_OUTCOME_SENTENCE[outcome];
|
|
368
247
|
phase = "request";
|
|
369
248
|
const result = await attempt(spec, held, options);
|
|
249
|
+
if (result.missingCredential === true) {
|
|
250
|
+
delete schedule[spec.provider];
|
|
251
|
+
rows.push({
|
|
252
|
+
provider: spec.provider,
|
|
253
|
+
detected: false,
|
|
254
|
+
status: "not_detected",
|
|
255
|
+
reason: CREDENTIAL_FAILURE_SENTENCE.absent,
|
|
256
|
+
nextAttemptAt: null,
|
|
257
|
+
disclosure
|
|
258
|
+
});
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
370
261
|
if (result.expiredCredentials) {
|
|
371
262
|
delete schedule[spec.provider];
|
|
372
263
|
rows.push({ provider: spec.provider, detected: true, status: "stale", accountId: acquisitionAccountId(spec.provider, held), availability: "expired_credentials", reason: CREDENTIAL_FAILURE_SENTENCE.expired, nextAttemptAt: null, disclosure });
|
|
@@ -429,7 +320,7 @@ export async function runAcquisition(specs, options) {
|
|
|
429
320
|
...(accountId === null ? {} : { accountId }),
|
|
430
321
|
detected: true,
|
|
431
322
|
status: "stale",
|
|
432
|
-
...(outcome === "rate_limited" && nextAttemptAt ? { availability: "rate_limited", retryAt: nextAttemptAt } :
|
|
323
|
+
...(outcome === "rate_limited" && nextAttemptAt ? { availability: "rate_limited", retryAt: nextAttemptAt } : outcomeAvailability(outcome)),
|
|
433
324
|
reason: sentence(outcome),
|
|
434
325
|
nextAttemptAt,
|
|
435
326
|
disclosure
|
|
@@ -442,26 +333,6 @@ export async function runAcquisition(specs, options) {
|
|
|
442
333
|
phase = "lease";
|
|
443
334
|
lease = await acquireMachineLease(spec.provider, options.stateDirectory, options.clock?.() ?? Date.parse(options.now), await revisionFor(spec));
|
|
444
335
|
if (lease === null) {
|
|
445
|
-
// A borrowed Gemini login describes the same quota. Reuse the observation
|
|
446
|
-
// from this round, retaining its age, instead of polling Code Assist twice.
|
|
447
|
-
if (spec.provider === "ANTIGRAVITY") {
|
|
448
|
-
const originalCredential = observedCredentials.get("GEMINI_CLI");
|
|
449
|
-
const credential = await readCredential(spec.credentialProvider);
|
|
450
|
-
const source = reports.find((report) => report.ok && report.provider === "GEMINI_CLI");
|
|
451
|
-
if (credential.ok && originalCredential?.secret === credential.credential.secret && isSharedCodeAssist(credential.credential) && !credentialExpired(credential.credential, Date.parse(options.now)) && source?.ok) {
|
|
452
|
-
const accountId = spec.accountIdFor?.(credential.credential) ?? acquisitionAccountId(spec.provider, credential.credential);
|
|
453
|
-
const accountLabel = spec.accountLabelFor?.(credential.credential) ?? null;
|
|
454
|
-
const snapshots = source.snapshots.map((snapshot) => ({ ...snapshot, provider: spec.provider,
|
|
455
|
-
...(accountId ? { accountId } : {}), ...(accountLabel ? { accountLabel } : {}) }));
|
|
456
|
-
reports.push({ ...source, provider: spec.provider, ...(accountId ? { accountId } : {}), snapshots });
|
|
457
|
-
const previous = schedule["GEMINI_CLI"];
|
|
458
|
-
if (previous)
|
|
459
|
-
schedule[spec.provider] = previous;
|
|
460
|
-
rows.push({ provider: spec.provider, ...(accountId ? { accountId } : {}), detected: true, status: "read", reason: null,
|
|
461
|
-
nextAttemptAt: previous?.nextAttemptAt ?? null, disclosure: spec.disclosureFor?.(credential.credential) ?? spec.disclosure });
|
|
462
|
-
continue;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
336
|
rows.push({ provider: spec.provider, detected: true, status: "waiting", reason: "another acquisition owns this provider or its retry deadline is pending", nextAttemptAt: null, disclosure: spec.disclosure });
|
|
466
337
|
continue;
|
|
467
338
|
}
|