@elizaos/app-core 2.0.0-alpha.413 → 2.0.0-alpha.415
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/apps/app-lifeops/src/lifeops/service-mixin-whatsapp.js +1 -90
- package/package.json +5 -5
- package/packages/agent/src/actions/index.d.ts +0 -1
- package/packages/agent/src/actions/index.d.ts.map +1 -1
- package/packages/agent/src/actions/index.js +0 -1
- package/packages/agent/src/api/accounts-routes.d.ts +31 -0
- package/packages/agent/src/api/accounts-routes.d.ts.map +1 -0
- package/packages/agent/src/api/accounts-routes.js +745 -0
- package/packages/agent/src/api/index.d.ts +1 -0
- package/packages/agent/src/api/index.d.ts.map +1 -1
- package/packages/agent/src/api/index.js +1 -0
- package/packages/agent/src/api/model-provider-helpers.js +10 -10
- package/packages/agent/src/api/provider-switch-config.js +2 -2
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +14 -0
- package/packages/agent/src/api/subscription-routes.d.ts.map +1 -1
- package/packages/agent/src/api/subscription-routes.js +48 -1
- package/packages/agent/src/auth/credentials.d.ts.map +1 -1
- package/packages/agent/src/auth/credentials.js +14 -3
- package/packages/agent/src/auth/index.d.ts +2 -0
- package/packages/agent/src/auth/index.d.ts.map +1 -1
- package/packages/agent/src/auth/index.js +2 -0
- package/packages/agent/src/auth/oauth-flow.d.ts +106 -0
- package/packages/agent/src/auth/oauth-flow.d.ts.map +1 -0
- package/packages/agent/src/auth/oauth-flow.js +349 -0
- package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.d.ts +32 -0
- package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.d.ts.map +1 -1
- package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.js +63 -28
- package/packages/agent/src/config/schema.js +1 -1
- package/packages/agent/src/config/types.messages.d.ts +1 -1
- package/packages/agent/src/config/types.tools.d.ts +1 -1
- package/packages/agent/src/providers/page-scoped-context.js +1 -1
- package/packages/agent/src/runtime/eliza-plugin.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza-plugin.js +0 -3
- package/packages/agent/src/runtime/eliza.js +3 -3
- package/packages/agent/src/runtime/plugin-collector.js +3 -4
- package/packages/app-core/src/api/accounts-routes.d.ts +16 -0
- package/packages/app-core/src/api/accounts-routes.d.ts.map +1 -0
- package/packages/app-core/src/api/accounts-routes.js +15 -0
- package/packages/app-core/src/api/credential-resolver.d.ts +15 -0
- package/packages/app-core/src/api/credential-resolver.d.ts.map +1 -1
- package/packages/app-core/src/api/credential-resolver.js +43 -0
- package/packages/app-core/src/api/plugins-compat-routes.d.ts +1 -0
- package/packages/app-core/src/api/plugins-compat-routes.d.ts.map +1 -1
- package/packages/app-core/src/api/plugins-compat-routes.js +5 -3
- package/packages/app-core/src/components/conversations/conversation-utils.js +4 -4
- package/packages/app-core/src/components/pages/page-scoped-conversations.js +1 -1
- package/packages/app-core/src/components/settings/ProviderSwitcher.js +1 -1
- package/packages/app-core/src/services/account-pool.d.ts +91 -0
- package/packages/app-core/src/services/account-pool.d.ts.map +1 -0
- package/packages/app-core/src/services/account-pool.js +466 -0
- package/packages/app-core/src/services/account-usage.d.ts +73 -0
- package/packages/app-core/src/services/account-usage.d.ts.map +1 -0
- package/packages/app-core/src/services/account-usage.js +179 -0
- package/packages/app-core/src/services/auth-store.js +1 -1
- package/packages/app-core/src/state/useOnboardingState.js +1 -1
- package/packages/shared/src/contracts/lifeops.d.ts +5 -4
- package/packages/shared/src/contracts/lifeops.d.ts.map +1 -1
- package/packages/typescript/src/utils/context-catalog.d.ts.map +1 -1
- package/packages/typescript/src/utils/context-catalog.js +2 -3
- package/packages/agent/src/actions/app-control.d.ts +0 -23
- package/packages/agent/src/actions/app-control.d.ts.map +0 -1
- package/packages/agent/src/actions/app-control.js +0 -775
|
@@ -8,6 +8,21 @@ export interface ResolvedCredential {
|
|
|
8
8
|
* Resolve the real credential for a specific provider.
|
|
9
9
|
*/
|
|
10
10
|
export declare function resolveProviderCredential(providerId: string): ResolvedCredential | null;
|
|
11
|
+
/**
|
|
12
|
+
* Multi-account credential resolution. When the install has any
|
|
13
|
+
* `LinkedAccountConfig` records for the requested provider, the pool
|
|
14
|
+
* picks one (priority by default, with health-aware skipping) and we
|
|
15
|
+
* return its access token via WS1's `getAccessToken`. When no accounts
|
|
16
|
+
* are configured, falls back to the legacy single-source resolver.
|
|
17
|
+
*
|
|
18
|
+
* `sessionKey` (optional) keeps repeated calls in the same logical
|
|
19
|
+
* session glued to the same account so token refreshes and rate-limit
|
|
20
|
+
* tracking stay coherent.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveProviderCredentialMulti(providerId: string, opts?: {
|
|
23
|
+
sessionKey?: string;
|
|
24
|
+
exclude?: string[];
|
|
25
|
+
}): Promise<ResolvedCredential | null>;
|
|
11
26
|
/**
|
|
12
27
|
* Scan all credential sources. Returns every provider that has a
|
|
13
28
|
* resolvable credential on this machine.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/api/credential-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credential-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/api/credential-resolver.ts"],"names":[],"mappings":"AAoLA,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,GAAG,cAAc,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,kBAAkB,GAAG,IAAI,CAiB3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,8BAA8B,CAClD,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GACjD,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAiCpC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,kBAAkB,EAAE,CAiBzD"}
|
|
@@ -15,7 +15,9 @@ import { execFileSync } from "node:child_process";
|
|
|
15
15
|
import fs from "node:fs";
|
|
16
16
|
import os from "node:os";
|
|
17
17
|
import path from "node:path";
|
|
18
|
+
import { getAccessToken, listProviderAccounts } from "@elizaos/agent";
|
|
18
19
|
import { logger } from "@elizaos/core";
|
|
20
|
+
import { getDefaultAccountPool } from "../services/account-pool.js";
|
|
19
21
|
// ── File/Keychain readers ────────────────────────────────────────────
|
|
20
22
|
function readJsonSafe(filePath) {
|
|
21
23
|
try {
|
|
@@ -177,6 +179,47 @@ export function resolveProviderCredential(providerId) {
|
|
|
177
179
|
}
|
|
178
180
|
return null;
|
|
179
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Multi-account credential resolution. When the install has any
|
|
184
|
+
* `LinkedAccountConfig` records for the requested provider, the pool
|
|
185
|
+
* picks one (priority by default, with health-aware skipping) and we
|
|
186
|
+
* return its access token via WS1's `getAccessToken`. When no accounts
|
|
187
|
+
* are configured, falls back to the legacy single-source resolver.
|
|
188
|
+
*
|
|
189
|
+
* `sessionKey` (optional) keeps repeated calls in the same logical
|
|
190
|
+
* session glued to the same account so token refreshes and rate-limit
|
|
191
|
+
* tracking stay coherent.
|
|
192
|
+
*/
|
|
193
|
+
export async function resolveProviderCredentialMulti(providerId, opts) {
|
|
194
|
+
const subscriptionMatch = providerId === "anthropic-subscription" || providerId === "openai-codex";
|
|
195
|
+
if (subscriptionMatch) {
|
|
196
|
+
const accounts = listProviderAccounts(providerId);
|
|
197
|
+
if (accounts.length > 0) {
|
|
198
|
+
const pool = getDefaultAccountPool();
|
|
199
|
+
const account = await pool.select({
|
|
200
|
+
providerId,
|
|
201
|
+
sessionKey: opts?.sessionKey,
|
|
202
|
+
exclude: opts?.exclude,
|
|
203
|
+
});
|
|
204
|
+
if (account) {
|
|
205
|
+
const token = await getAccessToken(providerId, account.id);
|
|
206
|
+
if (token) {
|
|
207
|
+
const envVar = providerId === "openai-codex"
|
|
208
|
+
? "OPENAI_API_KEY"
|
|
209
|
+
: "ANTHROPIC_API_KEY";
|
|
210
|
+
logger.info(`[credential-resolver] Multi-account: serving ${providerId} from "${account.label}" (${account.id})`);
|
|
211
|
+
return {
|
|
212
|
+
providerId,
|
|
213
|
+
envVar,
|
|
214
|
+
apiKey: token,
|
|
215
|
+
authType: "subscription",
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return resolveProviderCredential(providerId);
|
|
222
|
+
}
|
|
180
223
|
/**
|
|
181
224
|
* Scan all credential sources. Returns every provider that has a
|
|
182
225
|
* resolvable credential on this machine.
|
|
@@ -67,6 +67,7 @@ interface PluginDriftDiagnosticsReport {
|
|
|
67
67
|
summary: PluginDriftDiagnosticsSummary;
|
|
68
68
|
plugins: PluginDriftDiagnostic[];
|
|
69
69
|
}
|
|
70
|
+
export declare function resolveCompatPluginEnabledForList(active: boolean, persistedEnabled: boolean | undefined, advancedCapabilityEnabled?: boolean): boolean;
|
|
70
71
|
export declare function analyzePluginStateDrift(pluginList: CompatPluginRecord[], configRecord: Record<string, unknown>, configEntries: Record<string, {
|
|
71
72
|
enabled?: unknown;
|
|
72
73
|
}>, allowList: Set<string> | null): PluginDriftDiagnosticsReport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-compat-routes.d.ts","sourceRoot":"","sources":["../../../../../src/api/plugins-compat-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAKL,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAY1D,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,uBAAuB,CAAC;AAY/B,K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CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IAKvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,eAAe,GAChB,mBAAmB,GACnB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,CAAC;AAE1B,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,UAAU,6BAA6B;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,UAAU,4BAA4B;IACpC,OAAO,EAAE,6BAA6B,CAAC;IACvC,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;
|
|
1
|
+
{"version":3,"file":"plugins-compat-routes.d.ts","sourceRoot":"","sources":["../../../../../src/api/plugins-compat-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAKL,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAY1D,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ChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EACpD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAC5B,4BAA4B,CA8F9B;AA8TD,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAiBzD;AA6DD,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,IAAI,GAC/C;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAiBhD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG;IACrE,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CA0LA;AAgDD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,kBAAkB,GACzB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAoHA;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,OAAO,CAAC,CAwLlB"}
|
|
@@ -204,6 +204,9 @@ function resolvePersistedPluginEnabled(pluginId, category, npmName, configEntrie
|
|
|
204
204
|
}
|
|
205
205
|
return pluginEnabled;
|
|
206
206
|
}
|
|
207
|
+
export function resolveCompatPluginEnabledForList(active, persistedEnabled, advancedCapabilityEnabled) {
|
|
208
|
+
return advancedCapabilityEnabled ?? persistedEnabled ?? active;
|
|
209
|
+
}
|
|
207
210
|
function shortPluginIdFromNpmName(npmName) {
|
|
208
211
|
if (!npmName || typeof npmName !== "string") {
|
|
209
212
|
return null;
|
|
@@ -598,9 +601,8 @@ export function buildPluginListResponse(runtime) {
|
|
|
598
601
|
const advancedCapabilityStatus = resolveAdvancedCapabilityCompatStatus(pluginId, config, runtime);
|
|
599
602
|
const active = advancedCapabilityStatus?.isActive ??
|
|
600
603
|
isPluginLoaded(pluginId, entry.npmName, loadedNames);
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
Boolean(resolvePersistedPluginEnabled(pluginId, category, entry.npmName, configEntries, configRecord)));
|
|
604
|
+
const persistedEnabled = resolvePersistedPluginEnabled(pluginId, category, entry.npmName, configEntries, configRecord);
|
|
605
|
+
const enabled = resolveCompatPluginEnabledForList(active, persistedEnabled, advancedCapabilityStatus?.enabled);
|
|
604
606
|
const validationErrors = parameters
|
|
605
607
|
.filter((parameter) => parameter.required && !parameter.isSet)
|
|
606
608
|
.map((parameter) => ({
|
|
@@ -104,10 +104,10 @@ export function isNonChatModelLabel(model) {
|
|
|
104
104
|
export function estimateTokenCost(promptTokens, completionTokens, model) {
|
|
105
105
|
const normalizedModel = (model ?? "").toLowerCase();
|
|
106
106
|
const pricingByMillion = {
|
|
107
|
-
"gpt-5.
|
|
108
|
-
"gpt-5.
|
|
109
|
-
"gpt-5.
|
|
110
|
-
"gpt-5.
|
|
107
|
+
"gpt-5.5-pro": [30.0, 180.0],
|
|
108
|
+
"gpt-5.5-mini": [0.75, 4.5],
|
|
109
|
+
"gpt-5.5-nano": [0.2, 1.25],
|
|
110
|
+
"gpt-5.5": [2.5, 15.0],
|
|
111
111
|
"gpt-4.1": [2.0, 8.0],
|
|
112
112
|
"gpt-4o": [2.5, 10.0],
|
|
113
113
|
"gpt-4": [30.0, 60.0],
|
|
@@ -37,7 +37,7 @@ export const PAGE_SCOPE_COPY = {
|
|
|
37
37
|
"page-apps": {
|
|
38
38
|
title: "Apps chat",
|
|
39
39
|
body: "Use me to browse the catalog, compare apps, launch an app, stop a running app, open a live viewer, inspect run health, and manage favorites or recent apps. Recommended: describe the outcome you want, and I'll suggest the right app or launch it. Ask me about any catalog item or running app.",
|
|
40
|
-
systemAddendum: "You are answering inside the Apps view. The user can browse the catalog, compare apps by category and capability, launch apps, stop running apps, open attached live viewers, inspect run health and summaries, and manage favorites or recent apps. Recommend the best app or next run-management action based on live catalog and run state. Use
|
|
40
|
+
systemAddendum: "You are answering inside the Apps view. The user can browse the catalog, compare apps by category and capability, launch apps, stop running apps, open attached live viewers, inspect run health and summaries, and manage favorites or recent apps. Recommend the best app or next run-management action based on live catalog and run state. Use APP with mode launch, relaunch, list, load_from_directory, or create when the request is concrete. Refer to apps by display name and never invent app names.",
|
|
41
41
|
},
|
|
42
42
|
"page-connectors": {
|
|
43
43
|
title: "Connectors chat",
|
|
@@ -168,7 +168,7 @@ export function ProviderSwitcher(props = {}) {
|
|
|
168
168
|
const providerId = getOnboardingProviderOption(llmText?.backend)?.id;
|
|
169
169
|
const elizaCloudEnabledCfg = llmText?.transport === "cloud-proxy" && providerId === "elizacloud";
|
|
170
170
|
const defaults = {
|
|
171
|
-
nano: "openai/gpt-5.
|
|
171
|
+
nano: "openai/gpt-5.5-nano",
|
|
172
172
|
small: "minimax/minimax-m2.7",
|
|
173
173
|
medium: "anthropic/claude-sonnet-4.6",
|
|
174
174
|
large: "moonshotai/kimi-k2.5",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-account selection brain.
|
|
3
|
+
*
|
|
4
|
+
* Owns the runtime decision "which `LinkedAccountConfig` should serve this
|
|
5
|
+
* request?" given a strategy (priority / round-robin / least-used /
|
|
6
|
+
* quota-aware), session affinity, and per-account health state.
|
|
7
|
+
*
|
|
8
|
+
* The pool never reads OAuth credentials directly — callers resolve them
|
|
9
|
+
* via `getAccessToken(providerId, accountId)` from `@elizaos/agent` once
|
|
10
|
+
* the pool returns an account. Health, priority, and usage live in this
|
|
11
|
+
* layer; the OAuth blob lives under `~/.eliza/auth/` (see WS1's
|
|
12
|
+
* `account-storage.ts`).
|
|
13
|
+
*
|
|
14
|
+
* Persistence: the pool layers rich metadata (priority, enabled, health,
|
|
15
|
+
* usage) on top of WS1's credential records. The metadata is written to
|
|
16
|
+
* `<ELIZA_HOME>/auth/_pool-metadata.json` atomically so it survives
|
|
17
|
+
* process restarts and is independent of WS3's eventual `milady.json`
|
|
18
|
+
* field — when WS3 lands its CRUD API on top of `LinkedAccountsConfig`
|
|
19
|
+
* we can swap `createDefaultAccountPool()`'s deps without touching the
|
|
20
|
+
* pool itself.
|
|
21
|
+
*/
|
|
22
|
+
import type { LinkedAccountConfig, LinkedAccountProviderId, LinkedAccountsConfig } from "@elizaos/shared";
|
|
23
|
+
export type Strategy = "priority" | "round-robin" | "least-used" | "quota-aware";
|
|
24
|
+
export type PoolProviderId = LinkedAccountProviderId | "anthropic-api" | "openai-api";
|
|
25
|
+
export interface AccountPoolDeps {
|
|
26
|
+
/** Read the current `LinkedAccountsConfig` (live). */
|
|
27
|
+
readAccounts: () => Record<string, LinkedAccountConfig>;
|
|
28
|
+
/** Persist a single account's mutated fields. */
|
|
29
|
+
writeAccount: (account: LinkedAccountConfig) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export interface SelectInput {
|
|
32
|
+
providerId: PoolProviderId;
|
|
33
|
+
/** Stable session key for affinity (e.g. agent id + run id). */
|
|
34
|
+
sessionKey?: string;
|
|
35
|
+
/** Defaults to `"priority"`. */
|
|
36
|
+
strategy?: Strategy;
|
|
37
|
+
/** Explicit pool; defaults to all enabled accounts for `providerId`. */
|
|
38
|
+
accountIds?: string[];
|
|
39
|
+
/** Account IDs to skip (e.g. just-failed accounts). */
|
|
40
|
+
exclude?: string[];
|
|
41
|
+
}
|
|
42
|
+
export declare class AccountPool {
|
|
43
|
+
private readonly deps;
|
|
44
|
+
private readonly affinity;
|
|
45
|
+
private readonly roundRobinCursor;
|
|
46
|
+
constructor(deps: AccountPoolDeps);
|
|
47
|
+
select(input: SelectInput): Promise<LinkedAccountConfig | null>;
|
|
48
|
+
private filterEligible;
|
|
49
|
+
private applyStrategy;
|
|
50
|
+
recordCall(accountId: string, result: {
|
|
51
|
+
tokens?: number;
|
|
52
|
+
latencyMs?: number;
|
|
53
|
+
ok: boolean;
|
|
54
|
+
errorCode?: string;
|
|
55
|
+
model?: string;
|
|
56
|
+
}): Promise<void>;
|
|
57
|
+
refreshUsage(accountId: string, accessToken: string, opts?: {
|
|
58
|
+
codexAccountId?: string;
|
|
59
|
+
}): Promise<void>;
|
|
60
|
+
markRateLimited(accountId: string, untilMs: number, detail?: string): Promise<void>;
|
|
61
|
+
markNeedsReauth(accountId: string, detail?: string): Promise<void>;
|
|
62
|
+
markInvalid(accountId: string, detail?: string): Promise<void>;
|
|
63
|
+
markHealthy(accountId: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Re-probe accounts whose `health` is non-OK and whose `healthDetail.until`
|
|
66
|
+
* has passed (or is absent). Used by background sweepers to recover
|
|
67
|
+
* temporarily flagged accounts. We don't load access tokens here — the
|
|
68
|
+
* caller probes via `refreshUsage` separately.
|
|
69
|
+
*/
|
|
70
|
+
reprobeFlagged(): Promise<string[]>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Module-level singleton for the default pool wired against WS1's
|
|
74
|
+
* `account-storage` and the pool-owned metadata file. Plugins / runtime
|
|
75
|
+
* resolvers should import `getDefaultAccountPool()` rather than building
|
|
76
|
+
* a new pool. WS3 may later swap the default deps to read/write the
|
|
77
|
+
* `LinkedAccountsConfig` field directly out of `milady.json`; consumers
|
|
78
|
+
* keep the same accessor.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getDefaultAccountPool(): AccountPool;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated kept for compatibility with the WS2 spec naming. Use
|
|
83
|
+
* {@link getDefaultAccountPool}.
|
|
84
|
+
*/
|
|
85
|
+
export declare function createDefaultAccountPool(): AccountPool;
|
|
86
|
+
/**
|
|
87
|
+
* Resets the cached singleton. Test-only.
|
|
88
|
+
*/
|
|
89
|
+
export declare function __resetDefaultAccountPoolForTests(): void;
|
|
90
|
+
export type { LinkedAccountsConfig };
|
|
91
|
+
//# sourceMappingURL=account-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../../src/services/account-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAiBH,OAAO,KAAK,EACV,mBAAmB,EAGnB,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,aAAa,GACb,YAAY,GACZ,aAAa,CAAC;AAElB,MAAM,MAAM,cAAc,GACtB,uBAAuB,GACvB,eAAe,GACf,YAAY,CAAC;AAEjB,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,YAAY,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACxD,iDAAiD;IACjD,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAWD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QA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