@elizaos/app-core 2.0.0-alpha.414 → 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/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/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/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/pages/page-scoped-conversations.js +1 -1
- package/packages/app-core/src/services/account-pool.d.ts.map +1 -1
- package/packages/app-core/src/services/account-pool.js +91 -1
- package/packages/app-core/src/services/auth-store.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,KAAK,eAAe,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,uBAAuB,EAC5B,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAA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C;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,eAAe,CAAC;AAUvB,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,eAAe,CAAC;AAUvB,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,qBAAqB,CAAC;AAmL7B,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,yBAAyB,EACzB,eAAe,EACf,oCAAoC,EACpC,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAcpC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iCAAiC,EACjC,6BAA6B,EAC7B,mBAAmB,E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AE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;KACnC,KACE,IAAI,CAAC;CACX,CAAC,CAqgDD"}
|
|
@@ -129,6 +129,7 @@ import { cloneWithoutBlockedObjectKeys, decodePathComponent, getErrorMessage, ha
|
|
|
129
129
|
import { applySignalQrOverride } from "./signal-routes.js";
|
|
130
130
|
import { discoverSkills } from "./skill-discovery-helpers.js";
|
|
131
131
|
import { handleSkillsRoutes } from "./skills-routes.js";
|
|
132
|
+
import { handleAccountsRoutes } from "./accounts-routes.js";
|
|
132
133
|
import { handleSubscriptionRoutes } from "./subscription-routes.js";
|
|
133
134
|
import { handleTelegramAccountRoute } from "./telegram-account-routes.js";
|
|
134
135
|
import { handleTriggerRoutes } from "./trigger-routes.js";
|
|
@@ -818,6 +819,19 @@ async function handleRequest(req, res, state, ctx) {
|
|
|
818
819
|
})) {
|
|
819
820
|
return;
|
|
820
821
|
}
|
|
822
|
+
if (await handleAccountsRoutes({
|
|
823
|
+
req,
|
|
824
|
+
res,
|
|
825
|
+
method,
|
|
826
|
+
pathname,
|
|
827
|
+
readJsonBody,
|
|
828
|
+
json,
|
|
829
|
+
error,
|
|
830
|
+
state: { config: state.config },
|
|
831
|
+
saveConfig: saveElizaConfig,
|
|
832
|
+
})) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
821
835
|
// ═══════════════════════════════════════════════════════════════════════
|
|
822
836
|
// Health / status / runtime routes (extracted to health-routes.ts)
|
|
823
837
|
// ═══════════════════════════════════════════════════════════════════════
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-routes.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/subscription-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"subscription-routes.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/subscription-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAM5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,KAAK,UAAU,GAAG,cAAc,eAAe,CAAC,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,UAAU,EACR,uBAAuB,GACvB,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,8BAA8B,GAC9B,mBAAmB,CACtB,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,KAAK,EAAE,sBAAsB,CAAC;IAC9B,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,oBAAoB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1D;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,wBAAwB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAwQlB"}
|
|
@@ -6,7 +6,27 @@ export async function handleSubscriptionRoutes(ctx) {
|
|
|
6
6
|
if (method === "GET" && pathname === "/api/subscription/status") {
|
|
7
7
|
try {
|
|
8
8
|
const { getSubscriptionStatus } = await loadSubscriptionAuth();
|
|
9
|
-
|
|
9
|
+
const baseRows = getSubscriptionStatus();
|
|
10
|
+
// Join each per-account row with its rich LinkedAccountConfig
|
|
11
|
+
// entry from `milady.json` (priority, enabled, health, usage).
|
|
12
|
+
// CLI / setup-token / Claude Code rows have synthetic accountIds
|
|
13
|
+
// and no config-level row — they pass through unchanged so the
|
|
14
|
+
// UI's existing `find(s => s.provider === ...)` keeps working.
|
|
15
|
+
const linkedAccounts = readRichLinkedAccounts(state.config);
|
|
16
|
+
const rows = baseRows.map((row) => {
|
|
17
|
+
const linked = linkedAccounts[row.accountId];
|
|
18
|
+
if (!linked || linked.providerId !== row.provider)
|
|
19
|
+
return row;
|
|
20
|
+
const enriched = {
|
|
21
|
+
...row,
|
|
22
|
+
priority: linked.priority,
|
|
23
|
+
enabled: linked.enabled,
|
|
24
|
+
health: linked.health,
|
|
25
|
+
...(linked.usage ? { usage: linked.usage } : {}),
|
|
26
|
+
};
|
|
27
|
+
return enriched;
|
|
28
|
+
});
|
|
29
|
+
json(res, { providers: rows });
|
|
10
30
|
}
|
|
11
31
|
catch (err) {
|
|
12
32
|
logger.error(`[api] Failed to get subscription status: ${String(err)}`);
|
|
@@ -211,3 +231,30 @@ export async function handleSubscriptionRoutes(ctx) {
|
|
|
211
231
|
}
|
|
212
232
|
return false;
|
|
213
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Read rich `LinkedAccountConfig` rows out of the dual-shape
|
|
236
|
+
* `linkedAccounts` config bag. Skips legacy
|
|
237
|
+
* `LinkedAccountFlagConfig` entries (provider-name keys like
|
|
238
|
+
* `elizacloud`) — those are filtered out by the shape check.
|
|
239
|
+
*/
|
|
240
|
+
function readRichLinkedAccounts(config) {
|
|
241
|
+
const bag = config.linkedAccounts;
|
|
242
|
+
if (!bag)
|
|
243
|
+
return {};
|
|
244
|
+
const out = {};
|
|
245
|
+
for (const [key, value] of Object.entries(bag)) {
|
|
246
|
+
if (!value || typeof value !== "object")
|
|
247
|
+
continue;
|
|
248
|
+
const candidate = value;
|
|
249
|
+
if (typeof candidate.id === "string" &&
|
|
250
|
+
typeof candidate.providerId === "string" &&
|
|
251
|
+
typeof candidate.label === "string" &&
|
|
252
|
+
typeof candidate.enabled === "boolean" &&
|
|
253
|
+
typeof candidate.priority === "number" &&
|
|
254
|
+
typeof candidate.createdAt === "number" &&
|
|
255
|
+
typeof candidate.health === "string") {
|
|
256
|
+
out[key] = candidate;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return out;
|
|
260
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/auth/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EACL,KAAK,uBAAuB,EAM7B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEtB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAsBpB;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,GAAE,MAA2B,GACrC,IAAI,CAuBN;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,GAAE,MAA2B,GACrC,iBAAiB,GAAG,IAAI,CAI1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,GAAE,MAA2B,GACrC,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,GAAE,MAA2B,GACrC,OAAO,CAIT;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,GAC7B,uBAAuB,EAAE,CAE3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,oBAA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AC;CACH,GAAG,OAAO,CAAC,IAAI,CAAC,CAmGhB"}
|
|
@@ -396,11 +396,22 @@ export async function applySubscriptionCredentials(config) {
|
|
|
396
396
|
}
|
|
397
397
|
// ── OpenAI Codex subscription → set OPENAI_API_KEY ────────────────────
|
|
398
398
|
//
|
|
399
|
-
//
|
|
400
|
-
//
|
|
399
|
+
// Account selection goes through the WS2 AccountPool when its shim is
|
|
400
|
+
// installed (via `app-core`'s `getDefaultAccountPool()` accessor). The
|
|
401
|
+
// shim is symbol-keyed on `globalThis` so this package doesn't need to
|
|
402
|
+
// depend on `@elizaos/app-core`. When the shim is absent (e.g. agent
|
|
403
|
+
// running without app-core), we fall back to the lowest-createdAt
|
|
404
|
+
// account, which is stable for single-account installs.
|
|
401
405
|
const codexAccounts = listProviderAccounts("openai-codex");
|
|
402
406
|
if (codexAccounts.length > 0) {
|
|
403
|
-
const
|
|
407
|
+
const selectorSymbol = Symbol.for("milady.account-pool.subscription-selector.v1");
|
|
408
|
+
const selector = globalThis[selectorSymbol];
|
|
409
|
+
let chosenId = null;
|
|
410
|
+
if (selector) {
|
|
411
|
+
chosenId = await selector.pickAccountId("openai-codex");
|
|
412
|
+
}
|
|
413
|
+
const primary = codexAccounts.find((a) => a.id === chosenId) ??
|
|
414
|
+
codexAccounts.slice().sort((a, b) => a.createdAt - b.createdAt)[0];
|
|
404
415
|
const codexToken = await getAccessToken("openai-codex", primary.id);
|
|
405
416
|
if (codexToken) {
|
|
406
417
|
process.env.OPENAI_API_KEY = codexToken;
|
|
@@ -9,7 +9,7 @@ const PAGE_SCOPE_BRIEF = {
|
|
|
9
9
|
"page-browser": "The user is in the Browser view. Tabs are grouped into User Tabs, Agent Tabs, and App Tabs. User Tabs are writable: the user can open them, navigate URLs, refresh pages, capture snapshots, show or hide tabs, and close tabs there. Agent Tabs and App Tabs are read-only context: inspect and explain them, but do not navigate, click, type into, refresh, close, or otherwise mutate them. Action vocabulary the agent can rely on includes openBrowserWorkspaceTab, navigateBrowserWorkspaceTab, snapshotBrowserWorkspaceTab, showBrowserWorkspaceTab, hideBrowserWorkspaceTab, closeBrowserWorkspaceTab. When the user asks what to do, explain the available browser actions, recommend the next action from live tab and bridge state, and offer to answer questions about tabs, forms, current pages, or setup. Do not invent tabs or URLs.",
|
|
10
10
|
"page-character": "The user is in the Character view. The Character hub is organized into Overview, Personality, Knowledge, Experience, and Relationships. Name, voice, and system prompt live in Settings > Identity; Personality focuses on bio, style rules, message examples, and evolution history; Knowledge holds uploaded and learned knowledge; Experience surfaces durable learnings the agent recorded; Relationships shows the full relationship graph, facts, memories, and user-scoped personality preferences. When the user asks what to do, explain the relevant hub section, recommend the next improvement from live state, and offer to draft exact copy. Guide the user to the relevant section rather than fabricate a generic setter action.",
|
|
11
11
|
"page-automations": "The user is in the Automations view. They can create coordinator-text triggers, one-off tasks, recurring tasks, and n8n workflows; set cron or interval schedules; configure wake mode (inject_now / schedule_at / interval), max-runs, and enabled state; browse templates; inspect existing automations; and troubleshoot failed runs. Action vocabulary: createTriggerTaskAction, updateTriggerTaskAction, deleteTriggerTaskAction, runTriggerNowAction, createWorkflowAction, deleteWorkflowAction, toggleWorkflowActiveAction, promoteTaskToWorkflowAction, manageTasksAction. When the user asks what to do, recommend trigger vs task vs workflow based on the event, schedule, and desired result. Triggers and workflows already in the system are listed in live state below; reference them by display name when answering.",
|
|
12
|
-
"page-apps": "The user is in the Apps view. They can browse and compare catalog apps, launch apps, stop running apps, open attached live viewers, inspect run health and summaries, and manage favorites or recent apps. Action vocabulary:
|
|
12
|
+
"page-apps": "The user is in the Apps view. They can browse and compare catalog apps, launch apps, stop running apps, open attached live viewers, inspect run health and summaries, and manage favorites or recent apps. Action vocabulary: APP with mode launch, relaunch, list, load_from_directory, or create. When the user asks what to do, recommend an app or run-management action from the live catalog and running app state. Refer to apps by display name and never invent app names.",
|
|
13
13
|
"page-connectors": "The user is in the Connectors view. They can inspect connector availability, authentication state, setup requirements, webhook readiness, and integration health. When the user asks what to do, recommend the smallest connector setup or troubleshooting action that fits the visible state. Never invent connected accounts, permissions, webhook state, or delivery results.",
|
|
14
14
|
"page-plugins": "The user is in the Plugins view. They can inspect installed plugins, registry plugins, configuration readiness, plugin health, and runtime capability gaps. When the user asks what to do, recommend the smallest plugin setup or troubleshooting action that fits the visible state. Never invent installed plugins, credentials, or enabled capabilities.",
|
|
15
15
|
"page-lifeops": "The user is in the LifeOps view. They can inspect the overview, goals, reminders, calendar, messages, mail, sleep, screen time, social context, connector setup, capability readiness, and LifeOps settings. The LifeOps app provider and actions are the authoritative execution path for creating or changing personal workflows, reminders, goals, schedules, inbox drafts, connector setup, and executive-assistant follow-through. When the user asks what to do, recommend capability readiness and overview review first, then suggest the smallest concrete LifeOps action. Reference only live LifeOps state below; never invent reminders, messages, calendar events, goals, or connector status.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eliza-plugin.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/eliza-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAgB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"eliza-plugin.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/eliza-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAgB,MAAM,eAAe,CAAC;AA0GzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAoMpE"}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Memory search/get actions are superseded by plugin-clipboard.
|
|
7
7
|
*/
|
|
8
8
|
import { AgentEventService } from "@elizaos/core";
|
|
9
|
-
import { launchAppAction, stopAppAction } from "../actions/app-control.js";
|
|
10
9
|
import { browserSessionAction } from "../actions/browser-session.js";
|
|
11
10
|
import { executeDatabaseQueryAction, getTableDataAction, listDatabaseTablesAction, searchVectorsAction, } from "../actions/database.js";
|
|
12
11
|
import { getRelationshipActivityAction, linkEntityAction, readEntityAction, resolveMergeCandidateAction, searchEntityAction, } from "../actions/entity-actions.js";
|
|
@@ -167,8 +166,6 @@ export function createElizaPlugin(config) {
|
|
|
167
166
|
evaluators: [lateJoinWhitelistEvaluator],
|
|
168
167
|
actions: [
|
|
169
168
|
restartAction,
|
|
170
|
-
launchAppAction,
|
|
171
|
-
stopAppAction,
|
|
172
169
|
sendAdminMessageAction,
|
|
173
170
|
terminalAction,
|
|
174
171
|
createTriggerTaskAction,
|
|
@@ -391,10 +391,9 @@ export function collectPluginNames(config, reasons) {
|
|
|
391
391
|
if (shellPluginDisabled) {
|
|
392
392
|
pluginsToLoad.delete("@elizaos/plugin-shell");
|
|
393
393
|
}
|
|
394
|
-
for (const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
pluginsToLoad.delete(resolved);
|
|
394
|
+
for (const pluginName of Array.from(pluginsToLoad)) {
|
|
395
|
+
if (isPluginExplicitlyDisabled(pluginName)) {
|
|
396
|
+
pluginsToLoad.delete(pluginName);
|
|
398
397
|
}
|
|
399
398
|
}
|
|
400
399
|
return pluginsToLoad;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrapper around the agent's `handleAccountsRoutes` so app-core
|
|
3
|
+
* consumers can compose multi-account CRUD + OAuth-from-UI routes
|
|
4
|
+
* into their own HTTP servers without depending directly on the
|
|
5
|
+
* agent package internals. Mirrors `subscription-routes.ts`.
|
|
6
|
+
*/
|
|
7
|
+
import { type ElizaConfig, type RouteRequestContext } from "@elizaos/agent";
|
|
8
|
+
export interface AccountsRouteState {
|
|
9
|
+
config: ElizaConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface AccountsRouteContext extends RouteRequestContext {
|
|
12
|
+
state: AccountsRouteState;
|
|
13
|
+
saveConfig: (config: ElizaConfig) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function handleAccountsRoutes(ctx: AccountsRouteContext): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=accounts-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts-routes.d.ts","sourceRoot":"","sources":["../../../../../src/api/accounts-routes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrapper around the agent's `handleAccountsRoutes` so app-core
|
|
3
|
+
* consumers can compose multi-account CRUD + OAuth-from-UI routes
|
|
4
|
+
* into their own HTTP servers without depending directly on the
|
|
5
|
+
* agent package internals. Mirrors `subscription-routes.ts`.
|
|
6
|
+
*/
|
|
7
|
+
import { handleAccountsRoutes as handleAgentAccountsRoutes, } from "@elizaos/agent";
|
|
8
|
+
export async function handleAccountsRoutes(ctx) {
|
|
9
|
+
const agentCtx = {
|
|
10
|
+
...ctx,
|
|
11
|
+
state: { config: ctx.state.config },
|
|
12
|
+
saveConfig: (config) => ctx.saveConfig(config),
|
|
13
|
+
};
|
|
14
|
+
return handleAgentAccountsRoutes(agentCtx);
|
|
15
|
+
}
|
|
@@ -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,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O,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,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,MAA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 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) => ({
|
|
@@ -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",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../../src/services/account-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
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;A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AAI,WAAW,CAWnD;AA0ED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CAEtD;AAED;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
|
|
23
23
|
import os from "node:os";
|
|
24
24
|
import path from "node:path";
|
|
25
|
-
import { listProviderAccounts, } from "@elizaos/agent";
|
|
25
|
+
import { getAccessToken as getSubscriptionAccessToken, listProviderAccounts, } from "@elizaos/agent";
|
|
26
26
|
import { pollAnthropicUsage, pollCodexUsage, recordCall as recordUsageEntry, } from "./account-usage.js";
|
|
27
27
|
const DEFAULT_RATE_LIMIT_BACKOFF_MS = 60_000;
|
|
28
28
|
const QUOTA_AWARE_SKIP_PCT = 85;
|
|
@@ -343,6 +343,25 @@ async function persistAccount(account) {
|
|
|
343
343
|
};
|
|
344
344
|
writeMetaStore(store);
|
|
345
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Symbol-keyed shim contract consumed by plugin-anthropic's
|
|
348
|
+
* `credential-store.ts`. Kept narrow so the plugin doesn't have to import
|
|
349
|
+
* the full pool surface (or the rest of `@elizaos/app-core`).
|
|
350
|
+
*/
|
|
351
|
+
const ANTHROPIC_POOL_SHIM_SYMBOL = Symbol.for("milady.account-pool.anthropic.v1");
|
|
352
|
+
/**
|
|
353
|
+
* Shim used by plugin-agent-orchestrator. The orchestrator can't depend on
|
|
354
|
+
* `@elizaos/app-core`, so it discovers the pool via this symbol on
|
|
355
|
+
* `globalThis`. Returns the picked account + access token in one shot
|
|
356
|
+
* because the orchestrator only needs to inject the env vars and forget.
|
|
357
|
+
*/
|
|
358
|
+
const ORCHESTRATOR_POOL_SHIM_SYMBOL = Symbol.for("milady.account-pool.orchestrator.v1");
|
|
359
|
+
/**
|
|
360
|
+
* Shim used by `applySubscriptionCredentials` in `@elizaos/agent` to pick
|
|
361
|
+
* the active Codex account when applying `OPENAI_API_KEY`. Lives behind
|
|
362
|
+
* a symbol so the agent package doesn't need to depend on app-core.
|
|
363
|
+
*/
|
|
364
|
+
const SUBSCRIPTION_SELECTOR_SHIM_SYMBOL = Symbol.for("milady.account-pool.subscription-selector.v1");
|
|
346
365
|
let cachedDefaultPool = null;
|
|
347
366
|
/**
|
|
348
367
|
* Module-level singleton for the default pool wired against WS1's
|
|
@@ -358,9 +377,80 @@ export function getDefaultAccountPool() {
|
|
|
358
377
|
readAccounts: () => loadAllAccounts(),
|
|
359
378
|
writeAccount: persistAccount,
|
|
360
379
|
});
|
|
380
|
+
installAnthropicShim(cachedDefaultPool);
|
|
381
|
+
installOrchestratorShim(cachedDefaultPool);
|
|
382
|
+
installSubscriptionSelectorShim(cachedDefaultPool);
|
|
361
383
|
}
|
|
362
384
|
return cachedDefaultPool;
|
|
363
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Install the `globalThis`-keyed shim that plugin-anthropic's
|
|
388
|
+
* credential-store reads. Idempotent — repeated installs replace the
|
|
389
|
+
* previous shim.
|
|
390
|
+
*/
|
|
391
|
+
function installAnthropicShim(pool) {
|
|
392
|
+
if (typeof globalThis === "undefined")
|
|
393
|
+
return;
|
|
394
|
+
const shim = {
|
|
395
|
+
selectAnthropicSubscription: async (opts) => {
|
|
396
|
+
const account = await pool.select({
|
|
397
|
+
providerId: "anthropic-subscription",
|
|
398
|
+
sessionKey: opts?.sessionKey,
|
|
399
|
+
exclude: opts?.exclude,
|
|
400
|
+
});
|
|
401
|
+
if (!account)
|
|
402
|
+
return null;
|
|
403
|
+
// expiresAt is sourced from the underlying credential blob via
|
|
404
|
+
// `loadCredentials`; we cache it on the cached account record's
|
|
405
|
+
// lastUsedAt is independent. The plugin only uses expiresAt as a
|
|
406
|
+
// hint for cache TTL, so an Infinity fallback is acceptable.
|
|
407
|
+
return { id: account.id, expiresAt: Number.POSITIVE_INFINITY };
|
|
408
|
+
},
|
|
409
|
+
getAccessToken: (providerId, accountId) => getSubscriptionAccessToken(providerId, accountId),
|
|
410
|
+
markInvalid: (accountId, detail) => pool.markInvalid(accountId, detail),
|
|
411
|
+
markRateLimited: (accountId, untilMs, detail) => pool.markRateLimited(accountId, untilMs, detail),
|
|
412
|
+
};
|
|
413
|
+
globalThis[ANTHROPIC_POOL_SHIM_SYMBOL] = shim;
|
|
414
|
+
}
|
|
415
|
+
function installOrchestratorShim(pool) {
|
|
416
|
+
if (typeof globalThis === "undefined")
|
|
417
|
+
return;
|
|
418
|
+
const shim = {
|
|
419
|
+
pickAnthropicTokenForSpawn: async ({ sessionKey }) => {
|
|
420
|
+
const account = await pool.select({
|
|
421
|
+
providerId: "anthropic-subscription",
|
|
422
|
+
sessionKey,
|
|
423
|
+
});
|
|
424
|
+
if (!account)
|
|
425
|
+
return null;
|
|
426
|
+
const token = await getSubscriptionAccessToken("anthropic-subscription", account.id);
|
|
427
|
+
if (!token)
|
|
428
|
+
return null;
|
|
429
|
+
return { accessToken: token, accountId: account.id };
|
|
430
|
+
},
|
|
431
|
+
markRateLimited: (accountId, untilMs, detail) => {
|
|
432
|
+
void pool.markRateLimited(accountId, untilMs, detail);
|
|
433
|
+
},
|
|
434
|
+
markInvalid: (accountId, detail) => {
|
|
435
|
+
void pool.markInvalid(accountId, detail);
|
|
436
|
+
},
|
|
437
|
+
markNeedsReauth: (accountId, detail) => {
|
|
438
|
+
void pool.markNeedsReauth(accountId, detail);
|
|
439
|
+
},
|
|
440
|
+
};
|
|
441
|
+
globalThis[ORCHESTRATOR_POOL_SHIM_SYMBOL] = shim;
|
|
442
|
+
}
|
|
443
|
+
function installSubscriptionSelectorShim(pool) {
|
|
444
|
+
if (typeof globalThis === "undefined")
|
|
445
|
+
return;
|
|
446
|
+
const shim = {
|
|
447
|
+
pickAccountId: async (providerId) => {
|
|
448
|
+
const account = await pool.select({ providerId });
|
|
449
|
+
return account?.id ?? null;
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
globalThis[SUBSCRIPTION_SELECTOR_SHIM_SYMBOL] = shim;
|
|
453
|
+
}
|
|
364
454
|
/**
|
|
365
455
|
* @deprecated kept for compatibility with the WS2 spec naming. Use
|
|
366
456
|
* {@link getDefaultAccountPool}.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Every method is fail-fast: errors propagate to the caller. The auth code
|
|
9
9
|
* path must NEVER swallow a DB error and pretend a request was authenticated.
|
|
10
10
|
*/
|
|
11
|
-
import { authAuditEventTable, authBootstrapJtiSeenTable, authIdentityTable, authOwnerBindingTable, authOwnerLoginTokenTable, authSessionTable, } from "@elizaos/plugin-sql";
|
|
11
|
+
import { authAuditEventTable, authBootstrapJtiSeenTable, authIdentityTable, authOwnerBindingTable, authOwnerLoginTokenTable, authSessionTable, } from "@elizaos/plugin-sql/schema";
|
|
12
12
|
import { and, desc, eq, isNull, lte, ne } from "drizzle-orm";
|
|
13
13
|
function nullableString(value) {
|
|
14
14
|
return value === undefined ? null : value;
|
|
@@ -1880,10 +1880,11 @@ export type LifeOpsTelegramAuthState = (typeof LIFEOPS_TELEGRAM_AUTH_STATES)[num
|
|
|
1880
1880
|
export interface LifeOpsWhatsAppConnectorStatus {
|
|
1881
1881
|
provider: "whatsapp";
|
|
1882
1882
|
/**
|
|
1883
|
-
* `connected` here means
|
|
1884
|
-
* does NOT
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1883
|
+
* `connected` here means LifeOps-specific Cloud API credentials are present.
|
|
1884
|
+
* It does NOT reflect the user-facing WhatsApp connector session and does not
|
|
1885
|
+
* imply a live network probe has been performed. A live send can still fail if
|
|
1886
|
+
* the upstream token has been revoked. Callers that need true liveness must
|
|
1887
|
+
* catch errors from the actual send/receive methods.
|
|
1887
1888
|
*/
|
|
1888
1889
|
connected: boolean;
|
|
1889
1890
|
/**
|