@claudexor/cli 3.4.2 → 3.6.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/accounts-projection.d.ts +18 -12
- package/dist/accounts-projection.d.ts.map +1 -1
- package/dist/accounts-projection.js +63 -58
- package/dist/accounts-projection.js.map +1 -1
- package/dist/accounts-services.d.ts +134 -127
- package/dist/accounts-services.d.ts.map +1 -1
- package/dist/accounts-services.js +15 -7
- package/dist/accounts-services.js.map +1 -1
- package/dist/accounts-unified-migration.d.ts +110 -0
- package/dist/accounts-unified-migration.d.ts.map +1 -0
- package/dist/accounts-unified-migration.js +422 -0
- package/dist/accounts-unified-migration.js.map +1 -0
- package/dist/agy-quota-source.d.ts +36 -0
- package/dist/agy-quota-source.d.ts.map +1 -0
- package/dist/agy-quota-source.js +334 -0
- package/dist/agy-quota-source.js.map +1 -0
- package/dist/auth-login-harnesses.d.ts +13 -0
- package/dist/auth-login-harnesses.d.ts.map +1 -0
- package/dist/auth-login-harnesses.js +18 -0
- package/dist/auth-login-harnesses.js.map +1 -0
- package/dist/claude-oauth-usage.d.ts.map +1 -1
- package/dist/claude-oauth-usage.js +9 -3
- package/dist/claude-oauth-usage.js.map +1 -1
- package/dist/claude-statusline.d.ts.map +1 -1
- package/dist/claude-statusline.js +14 -1
- package/dist/claude-statusline.js.map +1 -1
- package/dist/claudexord.d.ts.map +1 -1
- package/dist/claudexord.js +25 -37
- package/dist/claudexord.js.map +1 -1
- package/dist/codex-quota-source.d.ts.map +1 -1
- package/dist/codex-quota-source.js +8 -3
- package/dist/codex-quota-source.js.map +1 -1
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +2 -13
- package/dist/command-registry.js.map +1 -1
- package/dist/config-dir-login-harnesses.d.ts +7 -0
- package/dist/config-dir-login-harnesses.d.ts.map +1 -0
- package/dist/config-dir-login-harnesses.js +46 -0
- package/dist/config-dir-login-harnesses.js.map +1 -0
- package/dist/control-services.d.ts +203 -185
- package/dist/control-services.d.ts.map +1 -1
- package/dist/control-services.js +39 -118
- package/dist/control-services.js.map +1 -1
- package/dist/credential-commands.d.ts.map +1 -1
- package/dist/credential-commands.js +51 -34
- package/dist/credential-commands.js.map +1 -1
- package/dist/credential-profile-mutations.d.ts +63 -0
- package/dist/credential-profile-mutations.d.ts.map +1 -0
- package/dist/credential-profile-mutations.js +187 -0
- package/dist/credential-profile-mutations.js.map +1 -0
- package/dist/credential-status-invalidation.d.ts +11 -0
- package/dist/credential-status-invalidation.d.ts.map +1 -0
- package/dist/credential-status-invalidation.js +36 -0
- package/dist/credential-status-invalidation.js.map +1 -0
- package/dist/daemon-admission-runtime.d.ts +5 -0
- package/dist/daemon-admission-runtime.d.ts.map +1 -1
- package/dist/daemon-admission-runtime.js +1 -0
- package/dist/daemon-admission-runtime.js.map +1 -1
- package/dist/harness-command-specs.d.ts +17 -0
- package/dist/harness-command-specs.d.ts.map +1 -0
- package/dist/harness-command-specs.js +22 -0
- package/dist/harness-command-specs.js.map +1 -0
- package/dist/harness-command.d.ts +4 -4
- package/dist/harness-command.d.ts.map +1 -1
- package/dist/harness-command.js +6 -5
- package/dist/harness-command.js.map +1 -1
- package/dist/harness-installer.d.ts +23 -10
- package/dist/harness-installer.d.ts.map +1 -1
- package/dist/harness-installer.js +93 -33
- package/dist/harness-installer.js.map +1 -1
- package/dist/mcp-run-projections.d.ts +1 -1
- package/dist/native-login.d.ts +10 -1
- package/dist/native-login.d.ts.map +1 -1
- package/dist/native-login.js +61 -5
- package/dist/native-login.js.map +1 -1
- package/dist/ops-commands.d.ts +1 -2
- package/dist/ops-commands.d.ts.map +1 -1
- package/dist/ops-commands.js +6 -5
- package/dist/ops-commands.js.map +1 -1
- package/dist/profile-registration.d.ts +13 -1
- package/dist/profile-registration.d.ts.map +1 -1
- package/dist/profile-registration.js +79 -4
- package/dist/profile-registration.js.map +1 -1
- package/dist/quota-refreshers.d.ts +3 -0
- package/dist/quota-refreshers.d.ts.map +1 -1
- package/dist/quota-refreshers.js +2 -0
- package/dist/quota-refreshers.js.map +1 -1
- package/dist/quota-services.d.ts +4 -2
- package/dist/quota-services.d.ts.map +1 -1
- package/dist/quota-subject-universe.d.ts.map +1 -1
- package/dist/quota-subject-universe.js +11 -2
- package/dist/quota-subject-universe.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -1
- package/dist/registry.js.map +1 -1
- package/dist/run-orchestrator.d.ts +28 -0
- package/dist/run-orchestrator.d.ts.map +1 -0
- package/dist/run-orchestrator.js +43 -0
- package/dist/run-orchestrator.js.map +1 -0
- package/dist/settings-service.d.ts +1 -1
- package/dist/settings-service.js +3 -3
- package/dist/settings-service.js.map +1 -1
- package/dist/setup-job-store.d.ts +4 -2
- package/dist/setup-job-store.d.ts.map +1 -1
- package/dist/setup-job-support.d.ts +50 -1
- package/dist/setup-job-support.d.ts.map +1 -1
- package/dist/setup-job-support.js +93 -11
- package/dist/setup-job-support.js.map +1 -1
- package/dist/setup-jobs.d.ts +8 -4
- package/dist/setup-jobs.d.ts.map +1 -1
- package/dist/setup-jobs.js +17 -18
- package/dist/setup-jobs.js.map +1 -1
- package/dist/setup-login-completion.d.ts.map +1 -1
- package/dist/setup-login-completion.js +16 -0
- package/dist/setup-login-completion.js.map +1 -1
- package/dist/setup-login-io.d.ts +7 -1
- package/dist/setup-login-io.d.ts.map +1 -1
- package/dist/setup-login-io.js +43 -3
- package/dist/setup-login-io.js.map +1 -1
- package/dist/setup-login-pty.d.ts +27 -0
- package/dist/setup-login-pty.d.ts.map +1 -0
- package/dist/setup-login-pty.js +58 -0
- package/dist/setup-login-pty.js.map +1 -0
- package/dist/setup-login-runner.d.ts +1 -9
- package/dist/setup-login-runner.d.ts.map +1 -1
- package/dist/setup-login-runner.js +17 -49
- package/dist/setup-login-runner.js.map +1 -1
- package/dist/setup-login-url.d.ts +10 -0
- package/dist/setup-login-url.d.ts.map +1 -0
- package/dist/setup-login-url.js +48 -0
- package/dist/setup-login-url.js.map +1 -0
- package/dist/thread-continuity-context.d.ts +24 -0
- package/dist/thread-continuity-context.d.ts.map +1 -1
- package/dist/thread-continuity-context.js +17 -0
- package/dist/thread-continuity-context.js.map +1 -1
- package/package.json +24 -23
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-harness
|
|
3
|
-
*
|
|
4
|
-
* run
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* Per-harness POOL AUTHORITY projection of the unified account model
|
|
3
|
+
* (INV-135): every account is a named registry row; `accountPools` carries
|
|
4
|
+
* the routing facts (who an UNPINNED run routes to next), computed ONCE on
|
|
5
|
+
* the server by the same pool owner run admission uses so no surface
|
|
6
|
+
* re-derives it. The legacy `harnessAccounts` carrier stays on the wire as
|
|
7
|
+
* `[]` for strict old clients; its native "CLI login" pseudo-row is gone —
|
|
8
|
+
* detected default-store logins are auto-registered as ordinary rows at
|
|
9
|
+
* daemon start.
|
|
10
10
|
*/
|
|
11
|
-
import type { AccountIdentity,
|
|
11
|
+
import type { AccountIdentity, ControlHarnessAccountPool, CredentialProfile, CredentialProfileStatus, QuotaSnapshot } from "@claudexor/schema";
|
|
12
12
|
import type { HarnessStatus } from "@claudexor/gateway";
|
|
13
13
|
/**
|
|
14
14
|
* Non-secret {email, plan} of a config_dir_login PROFILE, read daemon-side from
|
|
@@ -34,12 +34,18 @@ export declare function profileAccountProjection(profile: CredentialProfile): Pr
|
|
|
34
34
|
status: CredentialProfileStatus;
|
|
35
35
|
identity: AccountIdentity | null;
|
|
36
36
|
}>;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The per-harness pool routing verdict (`GET /v2/account-pools` and the
|
|
39
|
+
* additive `accountPools` key of the credential-profiles response). Routing
|
|
40
|
+
* facts ONLY — account facts live on the profile rows. The API-key ROUTE
|
|
41
|
+
* appears exclusively here (`api_key_route`) so legacy strict `next_up`
|
|
42
|
+
* decoders never see an unknown kind.
|
|
43
|
+
*/
|
|
44
|
+
export declare function accountPoolsProjection(repoRoot: string, quotaSnapshots?: readonly QuotaSnapshot[], snapshot?: {
|
|
38
45
|
statuses?: readonly HarnessStatus[];
|
|
39
46
|
profiles?: readonly {
|
|
40
47
|
profile: CredentialProfile;
|
|
41
48
|
status: CredentialProfileStatus;
|
|
42
49
|
}[];
|
|
43
|
-
|
|
44
|
-
}): Promise<ControlHarnessAccounts[]>;
|
|
50
|
+
}): Promise<ControlHarnessAccountPool[]>;
|
|
45
51
|
//# sourceMappingURL=accounts-projection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-projection.d.ts","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"accounts-projection.d.ts","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAY3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAKzF;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,uBAAuB,CAAC,CAGlC;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAClF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,uBAAuB,CAAC;IAChC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CAClC,CAAC,CAyBD;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,aAAa,EAAO,EAC7C,QAAQ,CAAC,EAAE;IACT,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,SAAS;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,uBAAuB,CAAA;KAAE,EAAE,CAAC;CACvF,GACA,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAgFtC"}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import { AccountIdentity as AccountIdentitySchema } from "@claudexor/schema";
|
|
1
|
+
import { AccountIdentity as AccountIdentitySchema, estimateEffectiveAuthRoute, } from "@claudexor/schema";
|
|
2
2
|
import { loadConfig } from "@claudexor/config";
|
|
3
|
-
import {
|
|
4
|
-
import { codexAccountIdentity
|
|
5
|
-
import { claudeAccountIdentity
|
|
3
|
+
import { effectiveAuthPreference, probeCredentialProfileStatus, profileStatusAdmits, selectFromAccountPool, } from "@claudexor/orchestrator";
|
|
4
|
+
import { codexAccountIdentity } from "@claudexor/harness-codex";
|
|
5
|
+
import { claudeAccountIdentity } from "@claudexor/harness-claude";
|
|
6
6
|
import { buildGateway, buildRegistry } from "./registry.js";
|
|
7
|
-
/**
|
|
8
|
-
* Non-secret {email, plan} of a harness's NATIVE/CLI login, read daemon-side
|
|
9
|
-
* from the Claudexor-owned native store (never the ordinary vendor home).
|
|
10
|
-
* Cursor's CLI-reported identity arrives through the Accounts-only doctor
|
|
11
|
-
* receipt instead; this helper remains the static-store owner for codex/claude.
|
|
12
|
-
*/
|
|
13
|
-
function nativeAccountIdentity(harnessId) {
|
|
14
|
-
if (harnessId === "codex")
|
|
15
|
-
return codexAccountIdentity(defaultNativeCodexHome());
|
|
16
|
-
if (harnessId === "claude")
|
|
17
|
-
return claudeAccountIdentity(defaultNativeClaudeConfigDir());
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
7
|
/**
|
|
21
8
|
* Non-secret {email, plan} of a config_dir_login PROFILE, read daemon-side from
|
|
22
9
|
* the profile's OWN isolation-locator store (INV-067) — never the ordinary
|
|
@@ -68,34 +55,26 @@ export async function profileAccountProjection(profile) {
|
|
|
68
55
|
});
|
|
69
56
|
return { profile, status, identity };
|
|
70
57
|
}
|
|
71
|
-
|
|
58
|
+
/**
|
|
59
|
+
* The per-harness pool routing verdict (`GET /v2/account-pools` and the
|
|
60
|
+
* additive `accountPools` key of the credential-profiles response). Routing
|
|
61
|
+
* facts ONLY — account facts live on the profile rows. The API-key ROUTE
|
|
62
|
+
* appears exclusively here (`api_key_route`) so legacy strict `next_up`
|
|
63
|
+
* decoders never see an unknown kind.
|
|
64
|
+
*/
|
|
65
|
+
export async function accountPoolsProjection(repoRoot, quotaSnapshots = [], snapshot) {
|
|
72
66
|
const cfg = loadConfig(repoRoot).global;
|
|
73
67
|
const harnessIds = [...buildRegistry({ includeFakes: false }).keys()].sort();
|
|
74
|
-
const nativeDetected = new Map();
|
|
75
68
|
let statuses = snapshot?.statuses ?? [];
|
|
76
|
-
const accountIdentities = new Map(snapshot?.accountIdentities ?? []);
|
|
77
69
|
if (!snapshot?.statuses) {
|
|
78
70
|
try {
|
|
79
|
-
|
|
80
|
-
statuses = receipts.map((receipt) => receipt.status);
|
|
81
|
-
for (const receipt of receipts) {
|
|
82
|
-
accountIdentities.set(receipt.status.id, receipt.identity);
|
|
83
|
-
}
|
|
71
|
+
statuses = await buildGateway({ includeFakes: false }).statusAll({ cwd: repoRoot }, harnessIds);
|
|
84
72
|
}
|
|
85
73
|
catch {
|
|
86
74
|
statuses = [];
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
|
-
const
|
|
90
|
-
for (const s of statuses) {
|
|
91
|
-
const native = s.authSources.find((source) => source.source === "native_session");
|
|
92
|
-
const detected = native?.availability === "available";
|
|
93
|
-
nativeDetected.set(s.id, detected);
|
|
94
|
-
const harness = cfg.harnesses[s.id];
|
|
95
|
-
const route = defaultCredentialRoute(s, effectiveAuthPreference(harness?.auth_preference, cfg.routing.auth_preference));
|
|
96
|
-
if (route)
|
|
97
|
-
defaultRoutes.set(s.id, route);
|
|
98
|
-
}
|
|
77
|
+
const statusById = new Map(statuses.map((status) => [status.id, status]));
|
|
99
78
|
const readyProfiles = new Map();
|
|
100
79
|
for (const entry of snapshot?.profiles ?? []) {
|
|
101
80
|
if (!entry.profile.enabled || !profileStatusAdmits(entry.profile, entry.status))
|
|
@@ -106,31 +85,57 @@ export async function harnessAccountsProjection(repoRoot, quotaSnapshots = [], s
|
|
|
106
85
|
}
|
|
107
86
|
return harnessIds.map((harnessId) => {
|
|
108
87
|
const h = cfg.harnesses[harnessId];
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
88
|
+
if (h?.enabled === false) {
|
|
89
|
+
return {
|
|
90
|
+
harness_id: harnessId,
|
|
91
|
+
next_up: {
|
|
92
|
+
kind: "none",
|
|
93
|
+
reason: `harness is disabled in settings (harnesses.${harnessId}.enabled=false)`,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// next_up must never advertise a row the runtime would not select: a
|
|
98
|
+
// NON-EMPTY rotation_eligible list restricts the runtime's candidates
|
|
99
|
+
// (staticRotationCandidates), so the projection applies the same filter.
|
|
100
|
+
const rotationEligible = h?.profile_policy?.rotation_eligible ?? [];
|
|
101
|
+
const ready = readyProfiles.get(harnessId) ?? new Set();
|
|
102
|
+
const eligibleReady = rotationEligible.length > 0
|
|
103
|
+
? new Set([...ready].filter((id) => rotationEligible.includes(id)))
|
|
104
|
+
: ready;
|
|
105
|
+
const selection = selectFromAccountPool({
|
|
106
|
+
registry: cfg.credential_profiles,
|
|
107
|
+
harnessId,
|
|
108
|
+
snapshots: quotaSnapshots,
|
|
109
|
+
readyProfileIds: eligibleReady,
|
|
110
|
+
headroomThreshold: h?.profile_policy?.headroom_threshold ?? 0.9,
|
|
111
|
+
model: h?.default_model ?? null,
|
|
112
|
+
});
|
|
113
|
+
if (selection.outcome === "selected") {
|
|
114
|
+
return {
|
|
115
|
+
harness_id: harnessId,
|
|
116
|
+
next_up: { kind: "profile", profileId: selection.candidate.profile.profile_id },
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Pool exhaustion is the typed `credential_pool_exhausted` terminal at
|
|
120
|
+
// run time (owner Q3=A): the paid API-key ROUTE serves it ONLY under the
|
|
121
|
+
// EXPLICIT api_key preference — never silently under auto — so next_up
|
|
122
|
+
// advertises the paid route exactly when the runtime would take it.
|
|
123
|
+
const preference = effectiveAuthPreference(h?.auth_preference, cfg.routing.auth_preference);
|
|
124
|
+
const status = statusById.get(harnessId);
|
|
125
|
+
const keyRouteReady = preference === "api_key" &&
|
|
126
|
+
status !== undefined &&
|
|
127
|
+
estimateEffectiveAuthRoute("api_key", status.authSources) === "api_key";
|
|
128
|
+
if (keyRouteReady) {
|
|
129
|
+
return { harness_id: harnessId, next_up: { kind: "api_key_route" } };
|
|
130
|
+
}
|
|
112
131
|
return {
|
|
113
132
|
harness_id: harnessId,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
registry: cfg.credential_profiles,
|
|
121
|
-
harnessId,
|
|
122
|
-
policy: h?.profile_policy ?? {
|
|
123
|
-
limit_action: "fail",
|
|
124
|
-
rotation_eligible: [],
|
|
125
|
-
headroom_threshold: 0.9,
|
|
126
|
-
},
|
|
127
|
-
snapshots: quotaSnapshots,
|
|
128
|
-
defaultEnabled,
|
|
129
|
-
defaultReady: defaultRoute !== null,
|
|
130
|
-
defaultRoute,
|
|
131
|
-
readyProfileIds: readyProfiles.get(harnessId) ?? new Set(),
|
|
132
|
-
model: h?.default_model ?? null,
|
|
133
|
-
}),
|
|
133
|
+
next_up: {
|
|
134
|
+
kind: "none",
|
|
135
|
+
reason: selection.outcome === "exhausted"
|
|
136
|
+
? `every enabled account is over its quota window${selection.resets_at ? ` (earliest reset ${selection.resets_at})` : ""}; unpinned runs wait for the reset (the paid API-key route requires the explicit api_key preference)`
|
|
137
|
+
: "no enabled account is signed in for this harness; connect an account or pin one per-run (--profile)",
|
|
138
|
+
},
|
|
134
139
|
};
|
|
135
140
|
});
|
|
136
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-projection.js","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAiBA,OAAO,
|
|
1
|
+
{"version":3,"file":"accounts-projection.js","sourceRoot":"","sources":["../src/accounts-projection.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,eAAe,IAAI,qBAAqB,EACxC,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA0B;IAC/D,IAAI,CAAC,OAAO,CAAC,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC5C,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO;QAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3F,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ;QAAE,OAAO,qBAAqB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7F,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA0B;IAE1B,MAAM,OA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C;QACH,IAAI,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACrC,OAAO;gBACL,UAAU,EAAE,SAAS;gBACrB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE;aAChF,CAAC;QACJ,CAAC;QACD,uEAAuE;QACvE,yEAAyE;QACzE,uEAAuE;QACvE,oEAAoE;QACpE,MAAM,UAAU,GAAG,uBAAuB,CAAC,CAAC,EAAE,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC5F,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,aAAa,GACjB,UAAU,KAAK,SAAS;YACxB,MAAM,KAAK,SAAS;YACpB,0BAA0B,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,SAAS,CAAC;QAC1E,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,CAAC;QACvE,CAAC;QACD,OAAO;YACL,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,MAAM,EACJ,SAAS,CAAC,OAAO,KAAK,WAAW;oBAC/B,CAAC,CAAC,iDAAiD,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,sGAAsG;oBAC9N,CAAC,CAAC,qGAAqG;aAC5G;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -38,139 +38,146 @@ export declare function projectHarnessStatuses(statuses: readonly HarnessStatus[
|
|
|
38
38
|
}[]>;
|
|
39
39
|
/** One server-owned Accounts response builder. The opt-in form refreshes quota
|
|
40
40
|
* first and then derives next_up from that exact returned response; no client
|
|
41
|
-
* can accidentally pair a newer quota card with an older routing identity.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
native_credentials_enabled: boolean;
|
|
53
|
-
native_login_detected: boolean;
|
|
54
|
-
identity: {
|
|
55
|
-
email?: string | undefined;
|
|
56
|
-
plan?: string | undefined;
|
|
57
|
-
} | null;
|
|
58
|
-
next_up: {
|
|
59
|
-
kind: "profile";
|
|
60
|
-
profileId: string;
|
|
61
|
-
} | {
|
|
62
|
-
kind: "native";
|
|
63
|
-
route?: "api_key" | "local_session" | undefined;
|
|
64
|
-
} | {
|
|
65
|
-
kind: "none";
|
|
66
|
-
reason: string;
|
|
67
|
-
};
|
|
68
|
-
}[];
|
|
69
|
-
} | {
|
|
70
|
-
profiles: {
|
|
71
|
-
profile: CredentialProfile;
|
|
72
|
-
status: CredentialProfileStatus;
|
|
73
|
-
identity: import("@claudexor/schema").AccountIdentity | null;
|
|
74
|
-
}[];
|
|
75
|
-
harnessAccounts: {
|
|
76
|
-
harness_id: string;
|
|
77
|
-
native_credentials_enabled: boolean;
|
|
78
|
-
native_login_detected: boolean;
|
|
79
|
-
identity: {
|
|
80
|
-
email?: string | undefined;
|
|
81
|
-
plan?: string | undefined;
|
|
82
|
-
} | null;
|
|
83
|
-
next_up: {
|
|
84
|
-
kind: "profile";
|
|
85
|
-
profileId: string;
|
|
86
|
-
} | {
|
|
87
|
-
kind: "native";
|
|
88
|
-
route?: "api_key" | "local_session" | undefined;
|
|
89
|
-
} | {
|
|
90
|
-
kind: "none";
|
|
91
|
-
reason: string;
|
|
92
|
-
};
|
|
93
|
-
}[];
|
|
94
|
-
harnesses: {
|
|
95
|
-
id: string;
|
|
96
|
-
available: boolean;
|
|
97
|
-
status: "ok" | "degraded" | "unavailable";
|
|
98
|
-
manifest: import("@claudexor/schema").HarnessManifest | null;
|
|
99
|
-
enabledIntents: import("@claudexor/schema").Intent[];
|
|
100
|
-
routableIntents: import("@claudexor/schema").Intent[];
|
|
101
|
-
disabledIntents: import("@claudexor/schema").Intent[];
|
|
102
|
-
checks: import("@claudexor/schema").ConformanceCheck[];
|
|
103
|
-
reasons: string[];
|
|
104
|
-
authSources: import("@claudexor/schema").AuthSourceReadiness[];
|
|
105
|
-
configuredModel: string | null;
|
|
106
|
-
configuredModelCheck: {
|
|
107
|
-
status: "ok" | "rejected";
|
|
108
|
-
message?: string | null;
|
|
109
|
-
} | null;
|
|
110
|
-
delegation: {
|
|
111
|
-
available: boolean;
|
|
112
|
-
reason: "manifest_unsupported" | "ready" | "runtime_unavailable";
|
|
113
|
-
remediation: string | null;
|
|
114
|
-
requiresFullAccess: boolean;
|
|
115
|
-
};
|
|
116
|
-
readiness: {
|
|
117
|
-
id: string;
|
|
118
|
-
kind: "auth" | "binary" | "model" | "probe" | "smoke";
|
|
119
|
-
title: string;
|
|
120
|
-
status: "fail" | "pass" | "skip";
|
|
121
|
-
detail: string | null;
|
|
41
|
+
* can accidentally pair a newer quota card with an older routing identity.
|
|
42
|
+
* Returns the listing service plus the pool-authority read
|
|
43
|
+
* (`GET /v2/account-pools`) so both share one cached projection. */
|
|
44
|
+
export declare function createCredentialProfilesService(quotaRegistry: () => QuotaRegistry): {
|
|
45
|
+
credentialProfiles: (input?: {
|
|
46
|
+
snapshot?: boolean;
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
profiles: {
|
|
49
|
+
profile: CredentialProfile;
|
|
50
|
+
status: CredentialProfileStatus;
|
|
51
|
+
identity: import("@claudexor/schema").AccountIdentity | null;
|
|
122
52
|
}[];
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
53
|
+
harnessAccounts: never[];
|
|
54
|
+
accountPools: {
|
|
55
|
+
harness_id: string;
|
|
56
|
+
next_up: {
|
|
57
|
+
kind: "profile";
|
|
58
|
+
profileId: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: "api_key_route";
|
|
61
|
+
} | {
|
|
62
|
+
kind: "none";
|
|
63
|
+
reason: string;
|
|
64
|
+
};
|
|
65
|
+
}[];
|
|
66
|
+
} | {
|
|
67
|
+
profiles: {
|
|
68
|
+
profile: CredentialProfile;
|
|
69
|
+
status: CredentialProfileStatus;
|
|
70
|
+
identity: import("@claudexor/schema").AccountIdentity | null;
|
|
71
|
+
}[];
|
|
72
|
+
harnessAccounts: never[];
|
|
73
|
+
accountPools: {
|
|
74
|
+
harness_id: string;
|
|
75
|
+
next_up: {
|
|
76
|
+
kind: "profile";
|
|
77
|
+
profileId: string;
|
|
78
|
+
} | {
|
|
79
|
+
kind: "api_key_route";
|
|
80
|
+
} | {
|
|
81
|
+
kind: "none";
|
|
82
|
+
reason: string;
|
|
137
83
|
};
|
|
138
|
-
|
|
84
|
+
}[];
|
|
85
|
+
harnesses: {
|
|
86
|
+
id: string;
|
|
87
|
+
available: boolean;
|
|
88
|
+
status: "ok" | "degraded" | "unavailable";
|
|
89
|
+
manifest: import("@claudexor/schema").HarnessManifest | null;
|
|
90
|
+
enabledIntents: import("@claudexor/schema").Intent[];
|
|
91
|
+
routableIntents: import("@claudexor/schema").Intent[];
|
|
92
|
+
disabledIntents: import("@claudexor/schema").Intent[];
|
|
93
|
+
checks: import("@claudexor/schema").ConformanceCheck[];
|
|
94
|
+
reasons: string[];
|
|
95
|
+
authSources: import("@claudexor/schema").AuthSourceReadiness[];
|
|
96
|
+
configuredModel: string | null;
|
|
97
|
+
configuredModelCheck: {
|
|
98
|
+
status: "ok" | "rejected";
|
|
99
|
+
message?: string | null;
|
|
100
|
+
} | null;
|
|
101
|
+
delegation: {
|
|
102
|
+
available: boolean;
|
|
103
|
+
reason: "manifest_unsupported" | "ready" | "runtime_unavailable";
|
|
104
|
+
remediation: string | null;
|
|
105
|
+
requiresFullAccess: boolean;
|
|
106
|
+
};
|
|
107
|
+
readiness: {
|
|
139
108
|
id: string;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
resets_at: string | null;
|
|
145
|
-
cooldown_until: string | null;
|
|
109
|
+
kind: "auth" | "binary" | "model" | "probe" | "smoke";
|
|
110
|
+
title: string;
|
|
111
|
+
status: "fail" | "pass" | "skip";
|
|
112
|
+
detail: string | null;
|
|
146
113
|
}[];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
114
|
+
}[];
|
|
115
|
+
git: {
|
|
116
|
+
status: "available" | "developer_tools_stub" | "failed" | "missing";
|
|
117
|
+
version: string | null;
|
|
118
|
+
detail: string | null;
|
|
119
|
+
remediation: string | null;
|
|
120
|
+
};
|
|
121
|
+
quota: {
|
|
122
|
+
snapshots: {
|
|
123
|
+
subject: {
|
|
124
|
+
harness: string;
|
|
125
|
+
credential_route: "local" | "managed_api_key" | "vendor_native";
|
|
126
|
+
plan_label: string | null;
|
|
127
|
+
subject_id: string | null;
|
|
128
|
+
};
|
|
129
|
+
constraints: {
|
|
130
|
+
id: string;
|
|
131
|
+
label: string;
|
|
132
|
+
applies_to_models?: string[] | null | undefined;
|
|
133
|
+
applies_to_unspecified_model?: boolean | undefined;
|
|
134
|
+
used_ratio: number | null;
|
|
135
|
+
window_seconds: number | null;
|
|
157
136
|
resets_at: string | null;
|
|
137
|
+
cooldown_until: string | null;
|
|
158
138
|
}[];
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
139
|
+
source: "agy_command_usage" | "claude_api_retry" | "claude_oauth_usage" | "claude_statusline" | "codex_app_server" | "codex_rollout" | "cursor_rate_limit";
|
|
140
|
+
observed_at: string;
|
|
141
|
+
freshness: "fresh" | "stale" | "unknown";
|
|
142
|
+
availability?: {
|
|
143
|
+
state: "available" | "cooldown" | "exhausted";
|
|
144
|
+
blocking_constraints: string[];
|
|
145
|
+
resets_at: string | null;
|
|
146
|
+
model_scoped_exhaustions: {
|
|
147
|
+
constraint_id: string;
|
|
148
|
+
applies_to_models: string[];
|
|
149
|
+
resets_at: string | null;
|
|
150
|
+
}[];
|
|
151
|
+
} | undefined;
|
|
152
|
+
}[];
|
|
153
|
+
absences: {
|
|
154
|
+
subject: {
|
|
155
|
+
harness: string;
|
|
156
|
+
credential_route: "local" | "managed_api_key" | "vendor_native";
|
|
157
|
+
plan_label: string | null;
|
|
158
|
+
subject_id: string | null;
|
|
159
|
+
};
|
|
160
|
+
reason: "auth_revoked" | "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
|
|
161
|
+
detail: string | null;
|
|
162
|
+
observed_at: string;
|
|
163
|
+
}[];
|
|
164
|
+
refreshed_at: string | null;
|
|
165
|
+
};
|
|
166
|
+
quotaEventCursor: string;
|
|
167
|
+
}>;
|
|
168
|
+
accountPools: () => Promise<{
|
|
169
|
+
accountPools: {
|
|
170
|
+
harness_id: string;
|
|
171
|
+
next_up: {
|
|
172
|
+
kind: "profile";
|
|
173
|
+
profileId: string;
|
|
174
|
+
} | {
|
|
175
|
+
kind: "api_key_route";
|
|
176
|
+
} | {
|
|
177
|
+
kind: "none";
|
|
178
|
+
reason: string;
|
|
167
179
|
};
|
|
168
|
-
reason: "auth_revoked" | "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
|
|
169
|
-
detail: string | null;
|
|
170
|
-
observed_at: string;
|
|
171
180
|
}[];
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
quotaEventCursor: string;
|
|
175
|
-
}>;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
176
183
|
//# sourceMappingURL=accounts-services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-services.d.ts","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI5E,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EAGxB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE;;;;;;;;;;;;;gBAKpD,IAAI,GAAG,UAAU;kBAAY,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;KAuBpE;AAED
|
|
1
|
+
{"version":3,"file":"accounts-services.d.ts","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI5E,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EAGxB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE;;;;;;;;;;;;;gBAKpD,IAAI,GAAG,UAAU;kBAAY,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;KAuBpE;AAED;;;;oEAIoE;AACpE,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,aAAa;iCA4BtC;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA1DvC,IAAI,GAAG,UAAU;0BAAY,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+FpE"}
|
|
@@ -6,7 +6,7 @@ import { noProjectRepoRoot } from "@claudexor/util";
|
|
|
6
6
|
import { validateModel } from "@claudexor/core";
|
|
7
7
|
import { withQuotaAvailability } from "@claudexor/schema";
|
|
8
8
|
import { vendorVerifiedProfileStatus } from "@claudexor/orchestrator";
|
|
9
|
-
import {
|
|
9
|
+
import { accountPoolsProjection, profileAccountProjection } from "./accounts-projection.js";
|
|
10
10
|
import { buildGateway, harnessModels } from "./registry.js";
|
|
11
11
|
import { delegationCapabilityFor } from "./delegation-capability.js";
|
|
12
12
|
const NO_PROJECT_ROOT = noProjectRepoRoot();
|
|
@@ -35,7 +35,9 @@ export async function projectHarnessStatuses(statuses) {
|
|
|
35
35
|
}
|
|
36
36
|
/** One server-owned Accounts response builder. The opt-in form refreshes quota
|
|
37
37
|
* first and then derives next_up from that exact returned response; no client
|
|
38
|
-
* can accidentally pair a newer quota card with an older routing identity.
|
|
38
|
+
* can accidentally pair a newer quota card with an older routing identity.
|
|
39
|
+
* Returns the listing service plus the pool-authority read
|
|
40
|
+
* (`GET /v2/account-pools`) so both share one cached projection. */
|
|
39
41
|
export function createCredentialProfilesService(quotaRegistry) {
|
|
40
42
|
const projectProfiles = () => {
|
|
41
43
|
const profiles = loadConfig(NO_PROJECT_ROOT).global.credential_profiles;
|
|
@@ -53,7 +55,10 @@ export function createCredentialProfilesService(quotaRegistry) {
|
|
|
53
55
|
const out = withVendorVerification(await projectProfiles(), quota);
|
|
54
56
|
return {
|
|
55
57
|
profiles: out,
|
|
56
|
-
|
|
58
|
+
// Unified account model: the legacy carrier stays PRESENT and empty for
|
|
59
|
+
// strict old clients; routing facts ride accountPools.
|
|
60
|
+
harnessAccounts: [],
|
|
61
|
+
accountPools: await accountPoolsProjection(NO_PROJECT_ROOT, quota.snapshots, {
|
|
57
62
|
profiles: out,
|
|
58
63
|
}),
|
|
59
64
|
};
|
|
@@ -61,7 +66,7 @@ export function createCredentialProfilesService(quotaRegistry) {
|
|
|
61
66
|
const pollCache = new StatusProjectionCache({
|
|
62
67
|
versionOf: globalConfigVersion,
|
|
63
68
|
});
|
|
64
|
-
|
|
69
|
+
const credentialProfiles = async (input) => {
|
|
65
70
|
if (input?.snapshot === true) {
|
|
66
71
|
const [probed, accountStatuses, git, fencedQuota] = await Promise.all([
|
|
67
72
|
projectProfiles(),
|
|
@@ -73,7 +78,6 @@ export function createCredentialProfilesService(quotaRegistry) {
|
|
|
73
78
|
quotaRegistry().refreshWithCursor(),
|
|
74
79
|
]);
|
|
75
80
|
const statuses = accountStatuses.map((receipt) => receipt.status);
|
|
76
|
-
const accountIdentities = new Map(accountStatuses.map((receipt) => [receipt.status.id, receipt.identity]));
|
|
77
81
|
const rawQuota = fencedQuota.response;
|
|
78
82
|
const out = withVendorVerification(probed, rawQuota);
|
|
79
83
|
// The explicit refresh proved the live state — drop the stale poll
|
|
@@ -82,10 +86,10 @@ export function createCredentialProfilesService(quotaRegistry) {
|
|
|
82
86
|
pollCache.invalidate();
|
|
83
87
|
return {
|
|
84
88
|
profiles: out,
|
|
85
|
-
harnessAccounts:
|
|
89
|
+
harnessAccounts: [],
|
|
90
|
+
accountPools: await accountPoolsProjection(NO_PROJECT_ROOT, rawQuota.snapshots, {
|
|
86
91
|
profiles: out,
|
|
87
92
|
statuses,
|
|
88
|
-
accountIdentities,
|
|
89
93
|
}),
|
|
90
94
|
harnesses: await projectHarnessStatuses(statuses),
|
|
91
95
|
git,
|
|
@@ -95,6 +99,10 @@ export function createCredentialProfilesService(quotaRegistry) {
|
|
|
95
99
|
}
|
|
96
100
|
return pollCache.read(buildPollResponse);
|
|
97
101
|
};
|
|
102
|
+
const accountPools = async () => ({
|
|
103
|
+
accountPools: (await pollCache.read(buildPollResponse)).accountPools,
|
|
104
|
+
});
|
|
105
|
+
return { credentialProfiles, accountPools };
|
|
98
106
|
}
|
|
99
107
|
/**
|
|
100
108
|
* Replace each profile's LOCAL verification verdict with the vendor's, wherever
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-services.js","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"accounts-services.js","sourceRoot":"","sources":["../src/accounts-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAA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