@elizaos/ui 2.0.0-alpha.526 → 2.0.0-alpha.528
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-elizamaker/src/index.d.ts +2 -0
- package/apps/app-elizamaker/src/index.d.ts.map +1 -1
- package/apps/app-elizamaker/src/index.js +2 -0
- package/apps/app-elizamaker/src/init-registry-services.d.ts +18 -0
- package/apps/app-elizamaker/src/init-registry-services.d.ts.map +1 -0
- package/apps/app-elizamaker/src/init-registry-services.js +63 -0
- package/apps/app-elizamaker/src/plugin.d.ts.map +1 -1
- package/apps/app-elizamaker/src/plugin.js +7 -0
- package/apps/app-elizamaker/src/registry-service-registry.d.ts +4 -0
- package/apps/app-elizamaker/src/registry-service-registry.d.ts.map +1 -0
- package/apps/app-elizamaker/src/registry-service-registry.js +7 -0
- package/apps/app-lifeops/src/automation-node-contributor.d.ts +2 -0
- package/apps/app-lifeops/src/automation-node-contributor.d.ts.map +1 -0
- package/apps/app-lifeops/src/automation-node-contributor.js +93 -0
- package/apps/app-lifeops/src/public.d.ts.map +1 -1
- package/apps/app-lifeops/src/public.js +2 -0
- package/apps/app-training/src/services/training-service-registry.d.ts +4 -0
- package/apps/app-training/src/services/training-service-registry.d.ts.map +1 -0
- package/apps/app-training/src/services/training-service-registry.js +7 -0
- package/package.json +1 -1
- package/packages/agent/src/api/agent-status-routes.d.ts +3 -23
- package/packages/agent/src/api/agent-status-routes.d.ts.map +1 -1
- package/packages/agent/src/api/agent-status-routes.js +7 -40
- package/packages/agent/src/api/coordinator-wiring.d.ts.map +1 -0
- package/packages/agent/src/api/misc-routes.d.ts.map +1 -1
- package/packages/agent/src/api/misc-routes.js +3 -37
- package/packages/agent/src/api/nfa-routes.d.ts.map +1 -1
- package/packages/agent/src/api/nfa-routes.js +1 -9
- package/packages/agent/src/api/provider-switch-routes.d.ts +8 -7
- package/packages/agent/src/api/provider-switch-routes.d.ts.map +1 -1
- package/packages/agent/src/api/provider-switch-routes.js +41 -26
- package/packages/agent/src/api/server-types.d.ts +0 -6
- package/packages/agent/src/api/server-types.d.ts.map +1 -1
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +31 -138
- package/packages/agent/src/api/stream-routes.d.ts.map +1 -1
- package/packages/agent/src/api/stream-routes.js +6 -8
- package/packages/agent/src/api/wallet-trading-profile.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-trading-profile.js +2 -23
- package/packages/agent/src/auth/account-storage.d.ts.map +1 -1
- package/packages/agent/src/auth/account-storage.js +4 -15
- package/packages/agent/src/runtime/eliza.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza.js +2 -6
- package/packages/agent/src/runtime/first-time-setup.d.ts.map +1 -1
- package/packages/agent/src/runtime/first-time-setup.js +1 -7
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts +4 -4
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/cold-strategy.js +13 -46
- package/packages/agent/src/runtime/operations/health-checks.d.ts +1 -0
- package/packages/agent/src/runtime/operations/health-checks.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/health-checks.js +1 -1
- package/packages/agent/src/runtime/operations/health.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/health.js +1 -13
- package/packages/agent/src/runtime/operations/index.d.ts +1 -0
- package/packages/agent/src/runtime/operations/index.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/index.js +1 -0
- package/packages/agent/src/runtime/operations/manager.d.ts +2 -0
- package/packages/agent/src/runtime/operations/manager.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/manager.js +27 -7
- package/packages/agent/src/runtime/operations/reload-hot.d.ts +4 -1
- package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/reload-hot.js +46 -41
- package/packages/agent/src/runtime/operations/repository.d.ts +30 -8
- package/packages/agent/src/runtime/operations/repository.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/repository.js +140 -54
- package/packages/agent/src/runtime/operations/types.d.ts +26 -24
- package/packages/agent/src/runtime/operations/types.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/types.js +8 -20
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts +60 -0
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/vault-bridge.js +80 -0
- package/packages/agent/src/runtime/plugin-resolver.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-resolver.js +1 -3
- package/packages/agent/src/runtime/plugin-types.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-types.js +1 -3
- package/packages/agent/src/services/app-package-modules.d.ts.map +1 -1
- package/packages/agent/src/services/app-package-modules.js +1 -8
- package/packages/agent/src/services/app-run-store.d.ts.map +1 -1
- package/packages/agent/src/services/app-run-store.js +2 -23
- package/packages/agent/src/services/registry-client-local.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-local.js +1 -9
- package/packages/agent/src/utils/atomic-json.d.ts +37 -0
- package/packages/agent/src/utils/atomic-json.d.ts.map +1 -0
- package/packages/agent/src/utils/atomic-json.js +98 -0
- package/packages/app-core/src/api/automation-node-contributors.d.ts +14 -0
- package/packages/app-core/src/api/automation-node-contributors.d.ts.map +1 -0
- package/packages/app-core/src/api/automation-node-contributors.js +14 -0
- package/packages/app-core/src/api/client-agent.d.ts +627 -0
- package/packages/app-core/src/api/client-agent.d.ts.map +1 -0
- package/packages/app-core/src/api/client-agent.js +1442 -0
- package/packages/app-core/src/api/client-automations.d.ts +8 -0
- package/packages/app-core/src/api/client-automations.d.ts.map +1 -0
- package/packages/app-core/src/api/client-automations.js +7 -0
- package/packages/app-core/src/api/client-base.d.ts +82 -0
- package/packages/app-core/src/api/client-base.d.ts.map +1 -0
- package/packages/app-core/src/api/client-base.js +729 -0
- package/packages/app-core/src/api/client-browser-workspace.d.ts +25 -0
- package/packages/app-core/src/api/client-browser-workspace.d.ts.map +1 -0
- package/packages/app-core/src/api/client-browser-workspace.js +98 -0
- package/packages/app-core/src/api/client-chat.d.ts +355 -0
- package/packages/app-core/src/api/client-chat.d.ts.map +1 -0
- package/packages/app-core/src/api/client-chat.js +582 -0
- package/packages/app-core/src/api/client-cloud.d.ts +286 -0
- package/packages/app-core/src/api/client-cloud.d.ts.map +1 -0
- package/packages/app-core/src/api/client-cloud.js +410 -0
- package/packages/app-core/src/api/client-computeruse.d.ts +32 -0
- package/packages/app-core/src/api/client-computeruse.d.ts.map +1 -0
- package/packages/app-core/src/api/client-computeruse.js +16 -0
- package/packages/app-core/src/api/client-imessage.d.ts +68 -0
- package/packages/app-core/src/api/client-imessage.d.ts.map +1 -0
- package/packages/app-core/src/api/client-imessage.js +74 -0
- package/packages/app-core/src/api/client-local-inference.d.ts +62 -0
- package/packages/app-core/src/api/client-local-inference.d.ts.map +1 -0
- package/packages/app-core/src/api/client-local-inference.js +87 -0
- package/packages/app-core/src/api/client-n8n.d.ts +27 -0
- package/packages/app-core/src/api/client-n8n.d.ts.map +1 -0
- package/packages/app-core/src/api/client-n8n.js +61 -0
- package/packages/app-core/src/api/client-skills.d.ts +475 -0
- package/packages/app-core/src/api/client-skills.d.ts.map +1 -0
- package/packages/app-core/src/api/client-skills.js +608 -0
- package/packages/app-core/src/api/client-types-babylon.d.ts +254 -0
- package/packages/app-core/src/api/client-types-babylon.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-babylon.js +2 -0
- package/packages/app-core/src/api/client-types-character.d.ts +39 -0
- package/packages/app-core/src/api/client-types-character.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-character.js +1 -0
- package/packages/app-core/src/api/client-types-chat.d.ts +428 -0
- package/packages/app-core/src/api/client-types-chat.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-chat.js +9 -0
- package/packages/app-core/src/api/client-types-config.d.ts +587 -0
- package/packages/app-core/src/api/client-types-config.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-config.js +5 -0
- package/packages/app-core/src/api/client-types-experience.d.ts +97 -0
- package/packages/app-core/src/api/client-types-experience.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-experience.js +1 -0
- package/packages/app-core/src/api/client-types-relationships.d.ts +181 -0
- package/packages/app-core/src/api/client-types-relationships.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-relationships.js +1 -0
- package/packages/app-core/src/api/client-types-steward.d.ts +85 -0
- package/packages/app-core/src/api/client-types-steward.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-steward.js +9 -0
- package/packages/app-core/src/api/client-types.d.ts +9 -0
- package/packages/app-core/src/api/client-types.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types.js +12 -0
- package/packages/app-core/src/api/client-wallet.d.ts +130 -0
- package/packages/app-core/src/api/client-wallet.d.ts.map +1 -0
- package/packages/app-core/src/api/client-wallet.js +228 -0
- package/packages/app-core/src/api/client.d.ts +36 -0
- package/packages/app-core/src/api/client.d.ts.map +1 -0
- package/packages/app-core/src/api/client.js +36 -0
- package/packages/app-core/src/api/index.d.ts +2 -0
- package/packages/app-core/src/api/index.d.ts.map +1 -0
- package/packages/app-core/src/api/index.js +1 -0
- package/packages/app-core/src/bridge/electrobun-rpc.d.ts +57 -0
- package/packages/app-core/src/bridge/electrobun-rpc.d.ts.map +1 -0
- package/packages/app-core/src/bridge/electrobun-rpc.js +87 -0
- package/packages/app-core/src/bridge/electrobun-runtime.d.ts +3 -0
- package/packages/app-core/src/bridge/electrobun-runtime.d.ts.map +1 -0
- package/packages/app-core/src/bridge/electrobun-runtime.js +34 -0
- package/packages/app-core/src/bridge/native-plugins.d.ts +504 -0
- package/packages/app-core/src/bridge/native-plugins.d.ts.map +1 -0
- package/packages/app-core/src/bridge/native-plugins.js +67 -0
- package/packages/app-core/src/chat/coding-agent-session-state.d.ts +16 -0
- package/packages/app-core/src/chat/coding-agent-session-state.d.ts.map +1 -0
- package/packages/app-core/src/chat/coding-agent-session-state.js +27 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts +80 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts.map +1 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.js +135 -0
- package/packages/app-core/src/services/account-pool.d.ts +98 -0
- package/packages/app-core/src/services/account-pool.d.ts.map +1 -0
- package/packages/app-core/src/services/account-pool.js +506 -0
- package/packages/app-core/src/services/account-usage.d.ts +75 -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/local-inference/active-model.d.ts +59 -0
- package/packages/app-core/src/services/local-inference/active-model.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/active-model.js +120 -0
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts +131 -0
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/device-bridge.js +748 -0
- package/packages/app-core/src/services/local-inference/engine.d.ts +52 -0
- package/packages/app-core/src/services/local-inference/engine.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/engine.js +138 -0
- package/packages/app-core/src/services/local-inference/external-scanner.d.ts +17 -0
- package/packages/app-core/src/services/local-inference/external-scanner.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/external-scanner.js +261 -0
- package/packages/app-core/src/services/local-inference/handler-registry.d.ts +72 -0
- package/packages/app-core/src/services/local-inference/handler-registry.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/handler-registry.js +160 -0
- package/packages/app-core/src/services/local-inference/paths.d.ts +24 -0
- package/packages/app-core/src/services/local-inference/paths.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/paths.js +41 -0
- package/packages/app-core/src/services/local-inference/providers.d.ts +61 -0
- package/packages/app-core/src/services/local-inference/providers.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/providers.js +277 -0
- package/packages/app-core/src/services/local-inference/registry.d.ts +35 -0
- package/packages/app-core/src/services/local-inference/registry.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/registry.js +108 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts +31 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.js +72 -0
- package/packages/app-core/src/services/local-inference/types.d.ts +121 -0
- package/packages/app-core/src/services/local-inference/types.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/types.js +14 -0
- package/packages/app-core/src/services/local-inference/verify.d.ts +39 -0
- package/packages/app-core/src/services/local-inference/verify.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/verify.js +104 -0
- package/packages/app-core/src/types/index.d.ts +658 -0
- package/packages/app-core/src/types/index.d.ts.map +1 -0
- package/packages/app-core/src/types/index.js +4 -0
- package/packages/app-core/src/utils/assistant-text.d.ts +2 -0
- package/packages/app-core/src/utils/assistant-text.d.ts.map +1 -0
- package/packages/app-core/src/utils/assistant-text.js +167 -0
- package/packages/app-core/src/utils/eliza-globals.d.ts +15 -0
- package/packages/app-core/src/utils/eliza-globals.d.ts.map +1 -0
- package/packages/app-core/src/utils/eliza-globals.js +50 -0
- package/packages/app-core/src/utils/streaming-text.d.ts +9 -0
- package/packages/app-core/src/utils/streaming-text.d.ts.map +1 -0
- package/packages/app-core/src/utils/streaming-text.js +112 -0
- package/packages/shared/src/format-error.d.ts +14 -0
- package/packages/shared/src/format-error.d.ts.map +1 -0
- package/packages/shared/src/format-error.js +17 -0
- package/packages/shared/src/index.d.ts +1 -0
- package/packages/shared/src/index.d.ts.map +1 -1
- package/packages/shared/src/index.js +1 -0
- package/packages/typescript/src/runtime.d.ts +14 -0
- package/packages/typescript/src/runtime.d.ts.map +1 -1
- package/packages/typescript/src/runtime.js +42 -0
- package/packages/typescript/src/services/message.d.ts +8 -0
- package/packages/typescript/src/services/message.d.ts.map +1 -1
- package/packages/typescript/src/services/message.js +51 -0
- package/packages/typescript/src/services/task.d.ts +1 -0
- package/packages/typescript/src/services/task.d.ts.map +1 -1
- package/packages/typescript/src/services/task.js +26 -3
- package/apps/app-task-coordinator/src/api/coordinator-wiring.d.ts.map +0 -1
- /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.d.ts +0 -0
- /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.js +0 -0
|
@@ -0,0 +1,1442 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent domain methods — lifecycle, auth, config, connectors, triggers,
|
|
3
|
+
* training, plugins, streaming/PTY, logs, character, permissions, updates.
|
|
4
|
+
*/
|
|
5
|
+
import { isElizaSettingsDebugEnabled, sanitizeForSettingsDebug, settingsDebugCloudSummary, } from "@elizaos/shared";
|
|
6
|
+
import { getAppBlockerPlugin, getWebsiteBlockerPlugin, } from "../bridge/native-plugins";
|
|
7
|
+
import { TERMINAL_STATUSES } from "../chat/coding-agent-session-state";
|
|
8
|
+
import { ElizaClient } from "./client-base";
|
|
9
|
+
import { mapPtySessionsToCodingAgentSessions, mapTaskThreadsToCodingAgentSessions, } from "./client-types";
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Module-level helpers
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
function clientSettingsDebug() {
|
|
14
|
+
let viteEnv;
|
|
15
|
+
try {
|
|
16
|
+
viteEnv = import.meta.env;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
viteEnv = undefined;
|
|
20
|
+
}
|
|
21
|
+
return isElizaSettingsDebugEnabled({
|
|
22
|
+
importMetaEnv: viteEnv,
|
|
23
|
+
env: typeof process !== "undefined" ? process.env : undefined,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const WEBSITE_BLOCKING_PERMISSION_ID = "website-blocking";
|
|
27
|
+
function getNativeWebsiteBlockerPluginIfAvailable() {
|
|
28
|
+
const plugin = getWebsiteBlockerPlugin();
|
|
29
|
+
return typeof plugin.getStatus === "function" &&
|
|
30
|
+
typeof plugin.startBlock === "function" &&
|
|
31
|
+
typeof plugin.stopBlock === "function" &&
|
|
32
|
+
typeof plugin.checkPermissions === "function" &&
|
|
33
|
+
typeof plugin.requestPermissions === "function" &&
|
|
34
|
+
typeof plugin.openSettings === "function"
|
|
35
|
+
? plugin
|
|
36
|
+
: null;
|
|
37
|
+
}
|
|
38
|
+
function getNativeAppBlockerPluginIfAvailable() {
|
|
39
|
+
const plugin = getAppBlockerPlugin();
|
|
40
|
+
return typeof plugin.getStatus === "function" &&
|
|
41
|
+
typeof plugin.checkPermissions === "function" &&
|
|
42
|
+
typeof plugin.requestPermissions === "function" &&
|
|
43
|
+
typeof plugin.getInstalledApps === "function" &&
|
|
44
|
+
typeof plugin.selectApps === "function" &&
|
|
45
|
+
typeof plugin.blockApps === "function" &&
|
|
46
|
+
typeof plugin.unblockApps === "function"
|
|
47
|
+
? plugin
|
|
48
|
+
: null;
|
|
49
|
+
}
|
|
50
|
+
function mapWebsiteBlockerPermissionResult(permission) {
|
|
51
|
+
return {
|
|
52
|
+
id: WEBSITE_BLOCKING_PERMISSION_ID,
|
|
53
|
+
status: permission.status,
|
|
54
|
+
canRequest: permission.canRequest,
|
|
55
|
+
reason: permission.reason,
|
|
56
|
+
lastChecked: Date.now(),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function mapWebsiteBlockerStatusToPermission(status) {
|
|
60
|
+
return {
|
|
61
|
+
id: WEBSITE_BLOCKING_PERMISSION_ID,
|
|
62
|
+
status: status.permissionStatus ??
|
|
63
|
+
(status.available ? "granted" : "not-determined"),
|
|
64
|
+
canRequest: status.canRequestPermission ?? status.supportsElevationPrompt,
|
|
65
|
+
reason: status.reason,
|
|
66
|
+
lastChecked: Date.now(),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function logSettingsClient(phase, detail) {
|
|
70
|
+
if (!clientSettingsDebug())
|
|
71
|
+
return;
|
|
72
|
+
console.debug(`[eliza][settings][client] ${phase}`, sanitizeForSettingsDebug(detail));
|
|
73
|
+
}
|
|
74
|
+
const SETTINGS_MUTATION_TIMEOUT_MS = 30_000;
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Prototype augmentation
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
ElizaClient.prototype.getStatus = async function () {
|
|
79
|
+
return this.fetch("/api/status");
|
|
80
|
+
};
|
|
81
|
+
ElizaClient.prototype.getAgentSelfStatus = async function () {
|
|
82
|
+
return this.fetch("/api/agent/self-status");
|
|
83
|
+
};
|
|
84
|
+
ElizaClient.prototype.getRuntimeSnapshot = async function (opts) {
|
|
85
|
+
const params = new URLSearchParams();
|
|
86
|
+
if (typeof opts?.depth === "number")
|
|
87
|
+
params.set("depth", String(opts.depth));
|
|
88
|
+
if (typeof opts?.maxArrayLength === "number") {
|
|
89
|
+
params.set("maxArrayLength", String(opts.maxArrayLength));
|
|
90
|
+
}
|
|
91
|
+
if (typeof opts?.maxObjectEntries === "number") {
|
|
92
|
+
params.set("maxObjectEntries", String(opts.maxObjectEntries));
|
|
93
|
+
}
|
|
94
|
+
if (typeof opts?.maxStringLength === "number") {
|
|
95
|
+
params.set("maxStringLength", String(opts.maxStringLength));
|
|
96
|
+
}
|
|
97
|
+
const qs = params.toString();
|
|
98
|
+
return this.fetch(`/api/runtime${qs ? `?${qs}` : ""}`);
|
|
99
|
+
};
|
|
100
|
+
ElizaClient.prototype.setAutomationMode = async function (mode) {
|
|
101
|
+
return this.fetch("/api/permissions/automation-mode", {
|
|
102
|
+
method: "PUT",
|
|
103
|
+
body: JSON.stringify({ mode }),
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
ElizaClient.prototype.setTradeMode = async function (mode) {
|
|
107
|
+
return this.fetch("/api/permissions/trade-mode", {
|
|
108
|
+
method: "PUT",
|
|
109
|
+
body: JSON.stringify({ mode }),
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
ElizaClient.prototype.playEmote = async function (emoteId) {
|
|
113
|
+
return this.fetch("/api/emote", {
|
|
114
|
+
method: "POST",
|
|
115
|
+
body: JSON.stringify({ emoteId }),
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
ElizaClient.prototype.runTerminalCommand = async function (command) {
|
|
119
|
+
return this.fetch("/api/terminal/run", {
|
|
120
|
+
method: "POST",
|
|
121
|
+
body: JSON.stringify({ command }),
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
ElizaClient.prototype.getOnboardingStatus = async function () {
|
|
125
|
+
return this.fetch("/api/onboarding/status");
|
|
126
|
+
};
|
|
127
|
+
ElizaClient.prototype.getWalletKeys = async function () {
|
|
128
|
+
return this.fetch("/api/wallet/keys");
|
|
129
|
+
};
|
|
130
|
+
ElizaClient.prototype.getWalletOsStoreStatus = async function () {
|
|
131
|
+
return this.fetch("/api/wallet/os-store");
|
|
132
|
+
};
|
|
133
|
+
ElizaClient.prototype.postWalletOsStoreAction = async function (action) {
|
|
134
|
+
return this.fetch("/api/wallet/os-store", {
|
|
135
|
+
method: "POST",
|
|
136
|
+
body: JSON.stringify({ action }),
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
ElizaClient.prototype.getAuthStatus = async function () {
|
|
140
|
+
const maxRetries = 3;
|
|
141
|
+
const baseBackoffMs = 1000;
|
|
142
|
+
let lastErr;
|
|
143
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
144
|
+
try {
|
|
145
|
+
return await this.fetch("/api/auth/status");
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
const status = err?.status;
|
|
149
|
+
if (status === 401) {
|
|
150
|
+
return { required: true, pairingEnabled: false, expiresAt: null };
|
|
151
|
+
}
|
|
152
|
+
if (status === 404) {
|
|
153
|
+
return { required: false, pairingEnabled: false, expiresAt: null };
|
|
154
|
+
}
|
|
155
|
+
lastErr = err;
|
|
156
|
+
if (attempt < maxRetries) {
|
|
157
|
+
await new Promise((r) => setTimeout(r, baseBackoffMs * 2 ** attempt));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
throw lastErr;
|
|
162
|
+
};
|
|
163
|
+
ElizaClient.prototype.postBootstrapExchange = async function (token) {
|
|
164
|
+
// Use allowNonOk so 401/429/503 bodies are parsed rather than thrown.
|
|
165
|
+
const body = await this.fetch("/api/auth/bootstrap/exchange", {
|
|
166
|
+
method: "POST",
|
|
167
|
+
body: JSON.stringify({ token }),
|
|
168
|
+
}, { allowNonOk: true });
|
|
169
|
+
if (typeof body.sessionId === "string" &&
|
|
170
|
+
typeof body.expiresAt === "number" &&
|
|
171
|
+
typeof body.identityId === "string") {
|
|
172
|
+
return {
|
|
173
|
+
ok: true,
|
|
174
|
+
sessionId: body.sessionId,
|
|
175
|
+
expiresAt: body.expiresAt,
|
|
176
|
+
identityId: body.identityId,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// Map reason to an HTTP status bucket for the UI layer.
|
|
180
|
+
const reason = body.reason;
|
|
181
|
+
const status = reason === "rate_limited"
|
|
182
|
+
? 429
|
|
183
|
+
: reason === "db_unavailable" ||
|
|
184
|
+
reason === "missing_issuer_env" ||
|
|
185
|
+
reason === "missing_container_env"
|
|
186
|
+
? 503
|
|
187
|
+
: reason === "missing_token"
|
|
188
|
+
? 400
|
|
189
|
+
: 401;
|
|
190
|
+
return {
|
|
191
|
+
ok: false,
|
|
192
|
+
status,
|
|
193
|
+
error: body.error ?? "exchange_failed",
|
|
194
|
+
reason,
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
ElizaClient.prototype.pair = async function (code) {
|
|
198
|
+
const res = await this.fetch("/api/auth/pair", {
|
|
199
|
+
method: "POST",
|
|
200
|
+
body: JSON.stringify({ code }),
|
|
201
|
+
});
|
|
202
|
+
return res;
|
|
203
|
+
};
|
|
204
|
+
ElizaClient.prototype.getOnboardingOptions = async function () {
|
|
205
|
+
return this.fetch("/api/onboarding/options");
|
|
206
|
+
};
|
|
207
|
+
ElizaClient.prototype.submitOnboarding = async function (data) {
|
|
208
|
+
await this.fetch("/api/onboarding", {
|
|
209
|
+
method: "POST",
|
|
210
|
+
body: JSON.stringify(data),
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
ElizaClient.prototype.startAnthropicLogin = async function () {
|
|
214
|
+
return this.fetch("/api/subscription/anthropic/start", { method: "POST" });
|
|
215
|
+
};
|
|
216
|
+
ElizaClient.prototype.exchangeAnthropicCode = async function (code) {
|
|
217
|
+
return this.fetch("/api/subscription/anthropic/exchange", {
|
|
218
|
+
method: "POST",
|
|
219
|
+
headers: { "Content-Type": "application/json" },
|
|
220
|
+
body: JSON.stringify({ code }),
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
ElizaClient.prototype.submitAnthropicSetupToken = async function (token) {
|
|
224
|
+
return this.fetch("/api/subscription/anthropic/setup-token", {
|
|
225
|
+
method: "POST",
|
|
226
|
+
headers: { "Content-Type": "application/json" },
|
|
227
|
+
body: JSON.stringify({ token }),
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
ElizaClient.prototype.getSubscriptionStatus = async function () {
|
|
231
|
+
return this.fetch("/api/subscription/status");
|
|
232
|
+
};
|
|
233
|
+
ElizaClient.prototype.deleteSubscription = async function (provider) {
|
|
234
|
+
return this.fetch(`/api/subscription/${encodeURIComponent(provider)}`, {
|
|
235
|
+
method: "DELETE",
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
ElizaClient.prototype.switchProvider = async function (provider, apiKey, primaryModel, options) {
|
|
239
|
+
logSettingsClient("POST /api/provider/switch → start", {
|
|
240
|
+
baseUrl: this.getBaseUrl(),
|
|
241
|
+
provider,
|
|
242
|
+
hasApiKey: Boolean(apiKey?.trim()),
|
|
243
|
+
apiKey,
|
|
244
|
+
hasPrimaryModel: Boolean(primaryModel?.trim()),
|
|
245
|
+
primaryModel,
|
|
246
|
+
useLocalEmbeddings: options?.useLocalEmbeddings,
|
|
247
|
+
});
|
|
248
|
+
const result = (await this.fetch("/api/provider/switch", {
|
|
249
|
+
method: "POST",
|
|
250
|
+
headers: { "Content-Type": "application/json" },
|
|
251
|
+
body: JSON.stringify({
|
|
252
|
+
provider,
|
|
253
|
+
...(apiKey ? { apiKey } : {}),
|
|
254
|
+
...(primaryModel ? { primaryModel } : {}),
|
|
255
|
+
...(options?.useLocalEmbeddings != null
|
|
256
|
+
? { useLocalEmbeddings: options.useLocalEmbeddings }
|
|
257
|
+
: {}),
|
|
258
|
+
}),
|
|
259
|
+
}));
|
|
260
|
+
logSettingsClient("POST /api/provider/switch ← ok", {
|
|
261
|
+
baseUrl: this.getBaseUrl(),
|
|
262
|
+
result,
|
|
263
|
+
});
|
|
264
|
+
return result;
|
|
265
|
+
};
|
|
266
|
+
ElizaClient.prototype.startOpenAILogin = async function () {
|
|
267
|
+
return this.fetch("/api/subscription/openai/start", { method: "POST" });
|
|
268
|
+
};
|
|
269
|
+
ElizaClient.prototype.exchangeOpenAICode = async function (code) {
|
|
270
|
+
return this.fetch("/api/subscription/openai/exchange", {
|
|
271
|
+
method: "POST",
|
|
272
|
+
headers: { "Content-Type": "application/json" },
|
|
273
|
+
body: JSON.stringify({ code }),
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
ElizaClient.prototype.startAgent = async function () {
|
|
277
|
+
const res = await this.fetch("/api/agent/start", {
|
|
278
|
+
method: "POST",
|
|
279
|
+
});
|
|
280
|
+
return res.status;
|
|
281
|
+
};
|
|
282
|
+
ElizaClient.prototype.stopAgent = async function () {
|
|
283
|
+
const res = await this.fetch("/api/agent/stop", {
|
|
284
|
+
method: "POST",
|
|
285
|
+
});
|
|
286
|
+
return res.status;
|
|
287
|
+
};
|
|
288
|
+
ElizaClient.prototype.pauseAgent = async function () {
|
|
289
|
+
const res = await this.fetch("/api/agent/pause", {
|
|
290
|
+
method: "POST",
|
|
291
|
+
});
|
|
292
|
+
return res.status;
|
|
293
|
+
};
|
|
294
|
+
ElizaClient.prototype.resumeAgent = async function () {
|
|
295
|
+
const res = await this.fetch("/api/agent/resume", {
|
|
296
|
+
method: "POST",
|
|
297
|
+
});
|
|
298
|
+
return res.status;
|
|
299
|
+
};
|
|
300
|
+
ElizaClient.prototype.restartAgent = async function () {
|
|
301
|
+
try {
|
|
302
|
+
const res = await this.fetch("/api/agent/restart", {
|
|
303
|
+
method: "POST",
|
|
304
|
+
});
|
|
305
|
+
return res.status;
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
// Back-compat for older runtimes that still expose only the process-level
|
|
309
|
+
// restart endpoint.
|
|
310
|
+
await this.fetch("/api/restart", { method: "POST" });
|
|
311
|
+
return {
|
|
312
|
+
state: "restarting",
|
|
313
|
+
agentName: "Eliza",
|
|
314
|
+
model: undefined,
|
|
315
|
+
uptime: undefined,
|
|
316
|
+
startedAt: undefined,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
ElizaClient.prototype.restartAndWait = async function (maxWaitMs = 30000) {
|
|
321
|
+
const t0 = Date.now();
|
|
322
|
+
console.info("[eliza][reset][client] restartAndWait: begin", {
|
|
323
|
+
baseUrl: this.getBaseUrl(),
|
|
324
|
+
maxWaitMs,
|
|
325
|
+
});
|
|
326
|
+
try {
|
|
327
|
+
await this.restartAgent();
|
|
328
|
+
console.info("[eliza][reset][client] restartAndWait: restart accepted");
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
console.info("[eliza][reset][client] restartAndWait: initial restart call failed (often 409 while restarting)", e);
|
|
332
|
+
}
|
|
333
|
+
const start = Date.now();
|
|
334
|
+
const interval = 1000;
|
|
335
|
+
let pollN = 0;
|
|
336
|
+
while (Date.now() - start < maxWaitMs) {
|
|
337
|
+
await new Promise((r) => setTimeout(r, interval));
|
|
338
|
+
pollN += 1;
|
|
339
|
+
try {
|
|
340
|
+
const status = await this.getStatus();
|
|
341
|
+
if (status.state === "running") {
|
|
342
|
+
console.info("[eliza][reset][client] restartAndWait: running", {
|
|
343
|
+
pollN,
|
|
344
|
+
waitedMs: Date.now() - t0,
|
|
345
|
+
port: status.port,
|
|
346
|
+
});
|
|
347
|
+
return status;
|
|
348
|
+
}
|
|
349
|
+
if (pollN === 1 || pollN % 5 === 0) {
|
|
350
|
+
console.debug("[eliza][reset][client] restartAndWait: poll", {
|
|
351
|
+
pollN,
|
|
352
|
+
state: status.state,
|
|
353
|
+
waitedMs: Date.now() - t0,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
catch (pollErr) {
|
|
358
|
+
if (pollN === 1 || pollN % 5 === 0) {
|
|
359
|
+
console.debug("[eliza][reset][client] restartAndWait: getStatus error while polling", { pollN, waitedMs: Date.now() - t0 }, pollErr);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const final = await this.getStatus();
|
|
364
|
+
console.warn("[eliza][reset][client] restartAndWait: timed out — returning last status", {
|
|
365
|
+
state: final.state,
|
|
366
|
+
waitedMs: Date.now() - t0,
|
|
367
|
+
maxWaitMs,
|
|
368
|
+
});
|
|
369
|
+
return final;
|
|
370
|
+
};
|
|
371
|
+
ElizaClient.prototype.resetAgent = async function () {
|
|
372
|
+
console.info("[eliza][reset][client] POST /api/agent/reset", {
|
|
373
|
+
baseUrl: this.getBaseUrl(),
|
|
374
|
+
});
|
|
375
|
+
await this.fetch("/api/agent/reset", { method: "POST" });
|
|
376
|
+
console.info("[eliza][reset][client] POST /api/agent/reset OK");
|
|
377
|
+
};
|
|
378
|
+
ElizaClient.prototype.restart = async function () {
|
|
379
|
+
return this.fetch("/api/restart", { method: "POST" });
|
|
380
|
+
};
|
|
381
|
+
ElizaClient.prototype.getConfig = async function () {
|
|
382
|
+
logSettingsClient("GET /api/config → start", {
|
|
383
|
+
baseUrl: this.getBaseUrl(),
|
|
384
|
+
});
|
|
385
|
+
const r = (await this.fetch("/api/config"));
|
|
386
|
+
const cloud = r.cloud;
|
|
387
|
+
logSettingsClient("GET /api/config ← ok", {
|
|
388
|
+
baseUrl: this.getBaseUrl(),
|
|
389
|
+
topKeys: Object.keys(r).sort(),
|
|
390
|
+
cloud: settingsDebugCloudSummary(cloud),
|
|
391
|
+
});
|
|
392
|
+
return r;
|
|
393
|
+
};
|
|
394
|
+
ElizaClient.prototype.getConfigSchema = async function () {
|
|
395
|
+
return this.fetch("/api/config/schema");
|
|
396
|
+
};
|
|
397
|
+
ElizaClient.prototype.updateConfig = async function (patch) {
|
|
398
|
+
logSettingsClient("PUT /api/config → start", {
|
|
399
|
+
baseUrl: this.getBaseUrl(),
|
|
400
|
+
patch,
|
|
401
|
+
});
|
|
402
|
+
const out = (await this.fetch("/api/config", {
|
|
403
|
+
method: "PUT",
|
|
404
|
+
headers: { "Content-Type": "application/json" },
|
|
405
|
+
body: JSON.stringify(patch),
|
|
406
|
+
}, {
|
|
407
|
+
timeoutMs: SETTINGS_MUTATION_TIMEOUT_MS,
|
|
408
|
+
}));
|
|
409
|
+
const cloud = out.cloud;
|
|
410
|
+
logSettingsClient("PUT /api/config ← ok", {
|
|
411
|
+
baseUrl: this.getBaseUrl(),
|
|
412
|
+
topKeys: Object.keys(out).sort(),
|
|
413
|
+
cloud: settingsDebugCloudSummary(cloud),
|
|
414
|
+
});
|
|
415
|
+
return out;
|
|
416
|
+
};
|
|
417
|
+
ElizaClient.prototype.uploadCustomVrm = async function (file) {
|
|
418
|
+
const buf = await file.arrayBuffer();
|
|
419
|
+
await this.fetch("/api/avatar/vrm", {
|
|
420
|
+
method: "POST",
|
|
421
|
+
headers: { "Content-Type": "application/octet-stream" },
|
|
422
|
+
body: buf,
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
ElizaClient.prototype.hasCustomVrm = async function () {
|
|
426
|
+
try {
|
|
427
|
+
const res = await this.rawRequest("/api/avatar/vrm", { method: "HEAD" }, { allowNonOk: true });
|
|
428
|
+
return res.ok;
|
|
429
|
+
}
|
|
430
|
+
catch {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
ElizaClient.prototype.uploadCustomBackground = async function (file) {
|
|
435
|
+
const buf = await file.arrayBuffer();
|
|
436
|
+
await this.fetch("/api/avatar/background", {
|
|
437
|
+
method: "POST",
|
|
438
|
+
headers: { "Content-Type": "application/octet-stream" },
|
|
439
|
+
body: buf,
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
ElizaClient.prototype.hasCustomBackground = async function () {
|
|
443
|
+
try {
|
|
444
|
+
const res = await this.rawRequest("/api/avatar/background", { method: "HEAD" }, { allowNonOk: true });
|
|
445
|
+
return res.ok;
|
|
446
|
+
}
|
|
447
|
+
catch {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
ElizaClient.prototype.getConnectors = async function () {
|
|
452
|
+
return this.fetch("/api/connectors");
|
|
453
|
+
};
|
|
454
|
+
ElizaClient.prototype.saveConnector = async function (name, config) {
|
|
455
|
+
return this.fetch("/api/connectors", {
|
|
456
|
+
method: "POST",
|
|
457
|
+
body: JSON.stringify({ name, config }),
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
ElizaClient.prototype.deleteConnector = async function (name) {
|
|
461
|
+
return this.fetch(`/api/connectors/${encodeURIComponent(name)}`, {
|
|
462
|
+
method: "DELETE",
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
ElizaClient.prototype.getTriggers = async function () {
|
|
466
|
+
return this.fetch("/api/triggers");
|
|
467
|
+
};
|
|
468
|
+
ElizaClient.prototype.getTrigger = async function (id) {
|
|
469
|
+
return this.fetch(`/api/triggers/${encodeURIComponent(id)}`);
|
|
470
|
+
};
|
|
471
|
+
ElizaClient.prototype.createTrigger = async function (request) {
|
|
472
|
+
return this.fetch("/api/triggers", {
|
|
473
|
+
method: "POST",
|
|
474
|
+
body: JSON.stringify(request),
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
ElizaClient.prototype.updateTrigger = async function (id, request) {
|
|
478
|
+
return this.fetch(`/api/triggers/${encodeURIComponent(id)}`, {
|
|
479
|
+
method: "PUT",
|
|
480
|
+
body: JSON.stringify(request),
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
ElizaClient.prototype.deleteTrigger = async function (id) {
|
|
484
|
+
return this.fetch(`/api/triggers/${encodeURIComponent(id)}`, {
|
|
485
|
+
method: "DELETE",
|
|
486
|
+
});
|
|
487
|
+
};
|
|
488
|
+
ElizaClient.prototype.runTriggerNow = async function (id) {
|
|
489
|
+
return this.fetch(`/api/triggers/${encodeURIComponent(id)}/execute`, {
|
|
490
|
+
method: "POST",
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
ElizaClient.prototype.getTriggerRuns = async function (id) {
|
|
494
|
+
return this.fetch(`/api/triggers/${encodeURIComponent(id)}/runs`);
|
|
495
|
+
};
|
|
496
|
+
ElizaClient.prototype.emitTriggerEvent = async function (eventKind, payload = {}) {
|
|
497
|
+
return this.fetch(`/api/triggers/events/${encodeURIComponent(eventKind)}`, {
|
|
498
|
+
method: "POST",
|
|
499
|
+
body: JSON.stringify({ payload }),
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
ElizaClient.prototype.getTriggerHealth = async function () {
|
|
503
|
+
return this.fetch("/api/triggers/health");
|
|
504
|
+
};
|
|
505
|
+
ElizaClient.prototype.getTrainingStatus = async function () {
|
|
506
|
+
return this.fetch("/api/training/status");
|
|
507
|
+
};
|
|
508
|
+
ElizaClient.prototype.listTrainingTrajectories = async function (opts) {
|
|
509
|
+
const params = new URLSearchParams();
|
|
510
|
+
if (typeof opts?.limit === "number")
|
|
511
|
+
params.set("limit", String(opts.limit));
|
|
512
|
+
if (typeof opts?.offset === "number")
|
|
513
|
+
params.set("offset", String(opts.offset));
|
|
514
|
+
const qs = params.toString();
|
|
515
|
+
return this.fetch(`/api/training/trajectories${qs ? `?${qs}` : ""}`);
|
|
516
|
+
};
|
|
517
|
+
ElizaClient.prototype.getTrainingTrajectory = async function (trajectoryId) {
|
|
518
|
+
return this.fetch(`/api/training/trajectories/${encodeURIComponent(trajectoryId)}`);
|
|
519
|
+
};
|
|
520
|
+
ElizaClient.prototype.listTrainingDatasets = async function () {
|
|
521
|
+
return this.fetch("/api/training/datasets");
|
|
522
|
+
};
|
|
523
|
+
ElizaClient.prototype.buildTrainingDataset = async function (options) {
|
|
524
|
+
return this.fetch("/api/training/datasets/build", {
|
|
525
|
+
method: "POST",
|
|
526
|
+
body: JSON.stringify(options ?? {}),
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
ElizaClient.prototype.listTrainingJobs = async function () {
|
|
530
|
+
return this.fetch("/api/training/jobs");
|
|
531
|
+
};
|
|
532
|
+
ElizaClient.prototype.startTrainingJob = async function (options) {
|
|
533
|
+
return this.fetch("/api/training/jobs", {
|
|
534
|
+
method: "POST",
|
|
535
|
+
body: JSON.stringify(options ?? {}),
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
ElizaClient.prototype.getTrainingJob = async function (jobId) {
|
|
539
|
+
return this.fetch(`/api/training/jobs/${encodeURIComponent(jobId)}`);
|
|
540
|
+
};
|
|
541
|
+
ElizaClient.prototype.cancelTrainingJob = async function (jobId) {
|
|
542
|
+
return this.fetch(`/api/training/jobs/${encodeURIComponent(jobId)}/cancel`, {
|
|
543
|
+
method: "POST",
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
ElizaClient.prototype.listTrainingModels = async function () {
|
|
547
|
+
return this.fetch("/api/training/models");
|
|
548
|
+
};
|
|
549
|
+
ElizaClient.prototype.importTrainingModelToOllama = async function (modelId, options) {
|
|
550
|
+
return this.fetch(`/api/training/models/${encodeURIComponent(modelId)}/import-ollama`, {
|
|
551
|
+
method: "POST",
|
|
552
|
+
body: JSON.stringify(options ?? {}),
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
ElizaClient.prototype.activateTrainingModel = async function (modelId, providerModel) {
|
|
556
|
+
return this.fetch(`/api/training/models/${encodeURIComponent(modelId)}/activate`, {
|
|
557
|
+
method: "POST",
|
|
558
|
+
body: JSON.stringify({ providerModel }),
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
ElizaClient.prototype.benchmarkTrainingModel = async function (modelId) {
|
|
562
|
+
return this.fetch(`/api/training/models/${encodeURIComponent(modelId)}/benchmark`, { method: "POST" });
|
|
563
|
+
};
|
|
564
|
+
ElizaClient.prototype.getPlugins = async function () {
|
|
565
|
+
return this.fetch("/api/plugins");
|
|
566
|
+
};
|
|
567
|
+
ElizaClient.prototype.fetchModels = async function (provider, refresh = true) {
|
|
568
|
+
const params = new URLSearchParams({ provider });
|
|
569
|
+
if (refresh)
|
|
570
|
+
params.set("refresh", "true");
|
|
571
|
+
return this.fetch(`/api/models?${params.toString()}`);
|
|
572
|
+
};
|
|
573
|
+
ElizaClient.prototype.getCorePlugins = async function () {
|
|
574
|
+
return this.fetch("/api/plugins/core");
|
|
575
|
+
};
|
|
576
|
+
ElizaClient.prototype.toggleCorePlugin = async function (npmName, enabled) {
|
|
577
|
+
return this.fetch("/api/plugins/core/toggle", {
|
|
578
|
+
method: "POST",
|
|
579
|
+
body: JSON.stringify({ npmName, enabled }),
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
ElizaClient.prototype.updatePlugin = async function (id, config) {
|
|
583
|
+
logSettingsClient(`PUT /api/plugins/${id} → start`, {
|
|
584
|
+
baseUrl: this.getBaseUrl(),
|
|
585
|
+
body: config,
|
|
586
|
+
});
|
|
587
|
+
const result = (await this.fetch(`/api/plugins/${id}`, {
|
|
588
|
+
method: "PUT",
|
|
589
|
+
body: JSON.stringify(config),
|
|
590
|
+
}, {
|
|
591
|
+
timeoutMs: SETTINGS_MUTATION_TIMEOUT_MS,
|
|
592
|
+
}));
|
|
593
|
+
logSettingsClient(`PUT /api/plugins/${id} ← ok`, {
|
|
594
|
+
baseUrl: this.getBaseUrl(),
|
|
595
|
+
result,
|
|
596
|
+
});
|
|
597
|
+
return result;
|
|
598
|
+
};
|
|
599
|
+
ElizaClient.prototype.getSecrets = async function () {
|
|
600
|
+
return this.fetch("/api/secrets");
|
|
601
|
+
};
|
|
602
|
+
ElizaClient.prototype.updateSecrets = async function (secrets) {
|
|
603
|
+
logSettingsClient("PUT /api/secrets → start", {
|
|
604
|
+
baseUrl: this.getBaseUrl(),
|
|
605
|
+
secretMeta: Object.keys(secrets)
|
|
606
|
+
.sort()
|
|
607
|
+
.map((key) => ({
|
|
608
|
+
key,
|
|
609
|
+
hasValue: Boolean(secrets[key]),
|
|
610
|
+
})),
|
|
611
|
+
});
|
|
612
|
+
const out = (await this.fetch("/api/secrets", {
|
|
613
|
+
method: "PUT",
|
|
614
|
+
body: JSON.stringify({ secrets }),
|
|
615
|
+
}));
|
|
616
|
+
logSettingsClient("PUT /api/secrets ← ok", {
|
|
617
|
+
baseUrl: this.getBaseUrl(),
|
|
618
|
+
out,
|
|
619
|
+
});
|
|
620
|
+
return out;
|
|
621
|
+
};
|
|
622
|
+
ElizaClient.prototype.testPluginConnection = async function (id) {
|
|
623
|
+
return this.fetch(`/api/plugins/${encodeURIComponent(id)}/test`, {
|
|
624
|
+
method: "POST",
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
ElizaClient.prototype.getLogs = async function (filter) {
|
|
628
|
+
const params = new URLSearchParams();
|
|
629
|
+
if (filter?.source)
|
|
630
|
+
params.set("source", filter.source);
|
|
631
|
+
if (filter?.level)
|
|
632
|
+
params.set("level", filter.level);
|
|
633
|
+
if (filter?.tag)
|
|
634
|
+
params.set("tag", filter.tag);
|
|
635
|
+
if (filter?.since)
|
|
636
|
+
params.set("since", String(filter.since));
|
|
637
|
+
const qs = params.toString();
|
|
638
|
+
return this.fetch(`/api/logs${qs ? `?${qs}` : ""}`);
|
|
639
|
+
};
|
|
640
|
+
// buildSecurityAuditParams is a private helper used only by agent audit methods
|
|
641
|
+
function buildSecurityAuditParams(filter, includeStream = false) {
|
|
642
|
+
const params = new URLSearchParams();
|
|
643
|
+
if (filter?.type)
|
|
644
|
+
params.set("type", filter.type);
|
|
645
|
+
if (filter?.severity)
|
|
646
|
+
params.set("severity", filter.severity);
|
|
647
|
+
if (filter?.since !== undefined) {
|
|
648
|
+
const sinceValue = filter.since instanceof Date
|
|
649
|
+
? filter.since.toISOString()
|
|
650
|
+
: String(filter.since);
|
|
651
|
+
params.set("since", sinceValue);
|
|
652
|
+
}
|
|
653
|
+
if (filter?.limit !== undefined)
|
|
654
|
+
params.set("limit", String(filter.limit));
|
|
655
|
+
if (includeStream)
|
|
656
|
+
params.set("stream", "1");
|
|
657
|
+
return params;
|
|
658
|
+
}
|
|
659
|
+
ElizaClient.prototype.getSecurityAudit = async function (filter) {
|
|
660
|
+
const qs = buildSecurityAuditParams(filter).toString();
|
|
661
|
+
return this.fetch(`/api/security/audit${qs ? `?${qs}` : ""}`);
|
|
662
|
+
};
|
|
663
|
+
ElizaClient.prototype.streamSecurityAudit = async function (onEvent, filter, signal) {
|
|
664
|
+
if (!this.apiAvailable) {
|
|
665
|
+
throw new Error("API not available (no HTTP origin)");
|
|
666
|
+
}
|
|
667
|
+
const token = this.apiToken;
|
|
668
|
+
const qs = buildSecurityAuditParams(filter, true).toString();
|
|
669
|
+
const res = await fetch(`${this.baseUrl}/api/security/audit${qs ? `?${qs}` : ""}`, {
|
|
670
|
+
method: "GET",
|
|
671
|
+
headers: {
|
|
672
|
+
Accept: "text/event-stream",
|
|
673
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
674
|
+
},
|
|
675
|
+
signal,
|
|
676
|
+
});
|
|
677
|
+
if (!res.ok) {
|
|
678
|
+
const body = (await res
|
|
679
|
+
.json()
|
|
680
|
+
.catch(() => ({ error: res.statusText })));
|
|
681
|
+
const err = new Error(body?.error ?? `HTTP ${res.status}`);
|
|
682
|
+
err.status = res.status;
|
|
683
|
+
throw err;
|
|
684
|
+
}
|
|
685
|
+
if (!res.body) {
|
|
686
|
+
throw new Error("Streaming not supported by this browser");
|
|
687
|
+
}
|
|
688
|
+
const parsePayload = (payload) => {
|
|
689
|
+
if (!payload)
|
|
690
|
+
return;
|
|
691
|
+
try {
|
|
692
|
+
const parsed = JSON.parse(payload);
|
|
693
|
+
if (parsed.type === "snapshot" || parsed.type === "entry") {
|
|
694
|
+
onEvent(parsed);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
catch {
|
|
698
|
+
// Ignore malformed payloads to keep stream consumption resilient.
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
const decoder = new TextDecoder();
|
|
702
|
+
const reader = res.body.getReader();
|
|
703
|
+
let buffer = "";
|
|
704
|
+
const findSseEventBreak = (chunkBuffer) => {
|
|
705
|
+
const lfBreak = chunkBuffer.indexOf("\n\n");
|
|
706
|
+
const crlfBreak = chunkBuffer.indexOf("\r\n\r\n");
|
|
707
|
+
if (lfBreak === -1 && crlfBreak === -1)
|
|
708
|
+
return null;
|
|
709
|
+
if (lfBreak === -1)
|
|
710
|
+
return { index: crlfBreak, length: 4 };
|
|
711
|
+
if (crlfBreak === -1)
|
|
712
|
+
return { index: lfBreak, length: 2 };
|
|
713
|
+
return lfBreak < crlfBreak
|
|
714
|
+
? { index: lfBreak, length: 2 }
|
|
715
|
+
: { index: crlfBreak, length: 4 };
|
|
716
|
+
};
|
|
717
|
+
while (true) {
|
|
718
|
+
const { done, value } = await reader.read();
|
|
719
|
+
if (done)
|
|
720
|
+
break;
|
|
721
|
+
buffer += decoder.decode(value, { stream: true });
|
|
722
|
+
let eventBreak = findSseEventBreak(buffer);
|
|
723
|
+
while (eventBreak) {
|
|
724
|
+
const rawEvent = buffer.slice(0, eventBreak.index);
|
|
725
|
+
buffer = buffer.slice(eventBreak.index + eventBreak.length);
|
|
726
|
+
for (const line of rawEvent.split(/\r?\n/)) {
|
|
727
|
+
if (!line.startsWith("data:"))
|
|
728
|
+
continue;
|
|
729
|
+
parsePayload(line.slice(5).trim());
|
|
730
|
+
}
|
|
731
|
+
eventBreak = findSseEventBreak(buffer);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (buffer.trim()) {
|
|
735
|
+
for (const line of buffer.split(/\r?\n/)) {
|
|
736
|
+
if (!line.startsWith("data:"))
|
|
737
|
+
continue;
|
|
738
|
+
parsePayload(line.slice(5).trim());
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
ElizaClient.prototype.getAgentEvents = async function (opts) {
|
|
743
|
+
const params = new URLSearchParams();
|
|
744
|
+
if (opts?.afterEventId)
|
|
745
|
+
params.set("after", opts.afterEventId);
|
|
746
|
+
if (typeof opts?.limit === "number")
|
|
747
|
+
params.set("limit", String(opts.limit));
|
|
748
|
+
if (opts?.runId)
|
|
749
|
+
params.set("runId", opts.runId);
|
|
750
|
+
if (typeof opts?.fromSeq === "number")
|
|
751
|
+
params.set("fromSeq", String(Math.trunc(opts.fromSeq)));
|
|
752
|
+
const qs = params.toString();
|
|
753
|
+
return this.fetch(`/api/agent/events${qs ? `?${qs}` : ""}`);
|
|
754
|
+
};
|
|
755
|
+
ElizaClient.prototype.getExtensionStatus = async function () {
|
|
756
|
+
return this.fetch("/api/extension/status");
|
|
757
|
+
};
|
|
758
|
+
ElizaClient.prototype.getRelationshipsGraph = async function (query) {
|
|
759
|
+
const params = new URLSearchParams();
|
|
760
|
+
if (query?.search)
|
|
761
|
+
params.set("search", query.search);
|
|
762
|
+
if (query?.platform)
|
|
763
|
+
params.set("platform", query.platform);
|
|
764
|
+
if (query?.scope)
|
|
765
|
+
params.set("scope", query.scope);
|
|
766
|
+
if (typeof query?.limit === "number")
|
|
767
|
+
params.set("limit", String(query.limit));
|
|
768
|
+
if (typeof query?.offset === "number")
|
|
769
|
+
params.set("offset", String(query.offset));
|
|
770
|
+
const qs = params.toString();
|
|
771
|
+
const response = await this.fetch(`/api/relationships/graph${qs ? `?${qs}` : ""}`);
|
|
772
|
+
return response.data;
|
|
773
|
+
};
|
|
774
|
+
ElizaClient.prototype.getRelationshipsPeople = async function (query) {
|
|
775
|
+
const params = new URLSearchParams();
|
|
776
|
+
if (query?.search)
|
|
777
|
+
params.set("search", query.search);
|
|
778
|
+
if (query?.platform)
|
|
779
|
+
params.set("platform", query.platform);
|
|
780
|
+
if (query?.scope)
|
|
781
|
+
params.set("scope", query.scope);
|
|
782
|
+
if (typeof query?.limit === "number")
|
|
783
|
+
params.set("limit", String(query.limit));
|
|
784
|
+
if (typeof query?.offset === "number")
|
|
785
|
+
params.set("offset", String(query.offset));
|
|
786
|
+
const qs = params.toString();
|
|
787
|
+
const response = await this.fetch(`/api/relationships/people${qs ? `?${qs}` : ""}`);
|
|
788
|
+
return {
|
|
789
|
+
people: response.data,
|
|
790
|
+
stats: response.stats,
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
ElizaClient.prototype.getRelationshipsPerson = async function (id) {
|
|
794
|
+
const response = await this.fetch(`/api/relationships/people/${encodeURIComponent(id)}`);
|
|
795
|
+
return response.data;
|
|
796
|
+
};
|
|
797
|
+
ElizaClient.prototype.getRelationshipsActivity = async function (limit, offset) {
|
|
798
|
+
const params = new URLSearchParams();
|
|
799
|
+
if (typeof limit === "number")
|
|
800
|
+
params.set("limit", String(limit));
|
|
801
|
+
if (typeof offset === "number")
|
|
802
|
+
params.set("offset", String(offset));
|
|
803
|
+
const qs = params.toString();
|
|
804
|
+
return this.fetch(`/api/relationships/activity${qs ? `?${qs}` : ""}`);
|
|
805
|
+
};
|
|
806
|
+
ElizaClient.prototype.getRelationshipsCandidates = async function () {
|
|
807
|
+
const response = await this.fetch("/api/relationships/candidates");
|
|
808
|
+
return response.data;
|
|
809
|
+
};
|
|
810
|
+
ElizaClient.prototype.acceptRelationshipsCandidate = async function (candidateId) {
|
|
811
|
+
const response = await this.fetch(`/api/relationships/candidates/${encodeURIComponent(candidateId)}/accept`, { method: "POST" });
|
|
812
|
+
return response.data;
|
|
813
|
+
};
|
|
814
|
+
ElizaClient.prototype.rejectRelationshipsCandidate = async function (candidateId) {
|
|
815
|
+
const response = await this.fetch(`/api/relationships/candidates/${encodeURIComponent(candidateId)}/reject`, { method: "POST" });
|
|
816
|
+
return response.data;
|
|
817
|
+
};
|
|
818
|
+
ElizaClient.prototype.proposeRelationshipsLink = async function (sourceEntityId, targetEntityId, evidence) {
|
|
819
|
+
const response = await this.fetch(`/api/relationships/people/${encodeURIComponent(sourceEntityId)}/link`, {
|
|
820
|
+
method: "POST",
|
|
821
|
+
body: JSON.stringify({
|
|
822
|
+
targetEntityId,
|
|
823
|
+
evidence: evidence ?? {},
|
|
824
|
+
}),
|
|
825
|
+
headers: { "Content-Type": "application/json" },
|
|
826
|
+
});
|
|
827
|
+
return response.data;
|
|
828
|
+
};
|
|
829
|
+
ElizaClient.prototype.getCharacter = async function () {
|
|
830
|
+
return this.fetch("/api/character");
|
|
831
|
+
};
|
|
832
|
+
ElizaClient.prototype.getRandomName = async function () {
|
|
833
|
+
return this.fetch("/api/character/random-name");
|
|
834
|
+
};
|
|
835
|
+
ElizaClient.prototype.generateCharacterField = async function (field, context, mode) {
|
|
836
|
+
return this.fetch("/api/character/generate", {
|
|
837
|
+
method: "POST",
|
|
838
|
+
body: JSON.stringify({ field, context, mode }),
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
ElizaClient.prototype.updateCharacter = async function (character) {
|
|
842
|
+
return this.fetch("/api/character", {
|
|
843
|
+
method: "PUT",
|
|
844
|
+
body: JSON.stringify(character),
|
|
845
|
+
});
|
|
846
|
+
};
|
|
847
|
+
ElizaClient.prototype.listCharacterHistory = async function (options) {
|
|
848
|
+
const params = new URLSearchParams();
|
|
849
|
+
if (typeof options?.limit === "number") {
|
|
850
|
+
params.set("limit", String(options.limit));
|
|
851
|
+
}
|
|
852
|
+
if (typeof options?.offset === "number") {
|
|
853
|
+
params.set("offset", String(options.offset));
|
|
854
|
+
}
|
|
855
|
+
const qs = params.toString();
|
|
856
|
+
return this.fetch(`/api/character/history${qs ? `?${qs}` : ""}`);
|
|
857
|
+
};
|
|
858
|
+
ElizaClient.prototype.listExperiences = async function (options) {
|
|
859
|
+
const params = new URLSearchParams();
|
|
860
|
+
const appendMulti = (key, value) => {
|
|
861
|
+
if (Array.isArray(value)) {
|
|
862
|
+
value
|
|
863
|
+
.map((item) => item.trim())
|
|
864
|
+
.filter(Boolean)
|
|
865
|
+
.forEach((item) => {
|
|
866
|
+
params.append(key, item);
|
|
867
|
+
});
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (typeof value === "string" && value.trim()) {
|
|
871
|
+
params.append(key, value.trim());
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
if (typeof options?.limit === "number") {
|
|
875
|
+
params.set("limit", String(options.limit));
|
|
876
|
+
}
|
|
877
|
+
if (typeof options?.offset === "number") {
|
|
878
|
+
params.set("offset", String(options.offset));
|
|
879
|
+
}
|
|
880
|
+
if (typeof options?.q === "string" && options.q.trim()) {
|
|
881
|
+
params.set("q", options.q.trim());
|
|
882
|
+
}
|
|
883
|
+
if (typeof options?.query === "string" && options.query.trim()) {
|
|
884
|
+
params.set("query", options.query.trim());
|
|
885
|
+
}
|
|
886
|
+
if (typeof options?.minConfidence === "number") {
|
|
887
|
+
params.set("minConfidence", String(options.minConfidence));
|
|
888
|
+
}
|
|
889
|
+
if (typeof options?.minImportance === "number") {
|
|
890
|
+
params.set("minImportance", String(options.minImportance));
|
|
891
|
+
}
|
|
892
|
+
if (typeof options?.includeRelated === "boolean") {
|
|
893
|
+
params.set("includeRelated", String(options.includeRelated));
|
|
894
|
+
}
|
|
895
|
+
appendMulti("type", options?.type);
|
|
896
|
+
appendMulti("outcome", options?.outcome);
|
|
897
|
+
appendMulti("domain", options?.domain);
|
|
898
|
+
options?.tags
|
|
899
|
+
?.map((tag) => tag.trim())
|
|
900
|
+
.filter(Boolean)
|
|
901
|
+
.forEach((tag) => {
|
|
902
|
+
params.append("tag", tag);
|
|
903
|
+
});
|
|
904
|
+
const qs = params.toString();
|
|
905
|
+
const response = await this.fetch(`/api/character/experiences${qs ? `?${qs}` : ""}`);
|
|
906
|
+
return {
|
|
907
|
+
experiences: response.data,
|
|
908
|
+
total: response.total,
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
ElizaClient.prototype.getExperienceGraph = async function (options) {
|
|
912
|
+
const params = new URLSearchParams();
|
|
913
|
+
const appendMulti = (key, value) => {
|
|
914
|
+
if (Array.isArray(value)) {
|
|
915
|
+
value
|
|
916
|
+
.map((item) => item.trim())
|
|
917
|
+
.filter(Boolean)
|
|
918
|
+
.forEach((item) => {
|
|
919
|
+
params.append(key, item);
|
|
920
|
+
});
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
if (typeof value === "string" && value.trim()) {
|
|
924
|
+
params.append(key, value.trim());
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
if (typeof options?.limit === "number") {
|
|
928
|
+
params.set("limit", String(options.limit));
|
|
929
|
+
}
|
|
930
|
+
if (typeof options?.q === "string" && options.q.trim()) {
|
|
931
|
+
params.set("q", options.q.trim());
|
|
932
|
+
}
|
|
933
|
+
if (typeof options?.query === "string" && options.query.trim()) {
|
|
934
|
+
params.set("query", options.query.trim());
|
|
935
|
+
}
|
|
936
|
+
if (typeof options?.minConfidence === "number") {
|
|
937
|
+
params.set("minConfidence", String(options.minConfidence));
|
|
938
|
+
}
|
|
939
|
+
if (typeof options?.minImportance === "number") {
|
|
940
|
+
params.set("minImportance", String(options.minImportance));
|
|
941
|
+
}
|
|
942
|
+
if (typeof options?.includeRelated === "boolean") {
|
|
943
|
+
params.set("includeRelated", String(options.includeRelated));
|
|
944
|
+
}
|
|
945
|
+
appendMulti("type", options?.type);
|
|
946
|
+
appendMulti("outcome", options?.outcome);
|
|
947
|
+
appendMulti("domain", options?.domain);
|
|
948
|
+
options?.tags
|
|
949
|
+
?.map((tag) => tag.trim())
|
|
950
|
+
.filter(Boolean)
|
|
951
|
+
.forEach((tag) => {
|
|
952
|
+
params.append("tag", tag);
|
|
953
|
+
});
|
|
954
|
+
const qs = params.toString();
|
|
955
|
+
const response = await this.fetch(`/api/character/experiences/graph${qs ? `?${qs}` : ""}`);
|
|
956
|
+
return { graph: response.data };
|
|
957
|
+
};
|
|
958
|
+
ElizaClient.prototype.runExperienceMaintenance = async function (options) {
|
|
959
|
+
const response = await this.fetch("/api/character/experiences/maintenance", {
|
|
960
|
+
method: "POST",
|
|
961
|
+
body: JSON.stringify(options ?? {}),
|
|
962
|
+
});
|
|
963
|
+
return { result: response.data };
|
|
964
|
+
};
|
|
965
|
+
ElizaClient.prototype.getExperience = async function (id) {
|
|
966
|
+
const response = await this.fetch(`/api/character/experiences/${encodeURIComponent(id)}`);
|
|
967
|
+
return { experience: response.data };
|
|
968
|
+
};
|
|
969
|
+
ElizaClient.prototype.updateExperience = async function (id, data) {
|
|
970
|
+
const response = await this.fetch(`/api/character/experiences/${encodeURIComponent(id)}`, {
|
|
971
|
+
method: "PATCH",
|
|
972
|
+
body: JSON.stringify(data),
|
|
973
|
+
});
|
|
974
|
+
return { experience: response.data };
|
|
975
|
+
};
|
|
976
|
+
ElizaClient.prototype.deleteExperience = async function (id) {
|
|
977
|
+
return this.fetch(`/api/character/experiences/${encodeURIComponent(id)}`, {
|
|
978
|
+
method: "DELETE",
|
|
979
|
+
});
|
|
980
|
+
};
|
|
981
|
+
ElizaClient.prototype.getUpdateStatus = async function (force = false) {
|
|
982
|
+
return this.fetch(`/api/update/status${force ? "?force=true" : ""}`);
|
|
983
|
+
};
|
|
984
|
+
ElizaClient.prototype.setUpdateChannel = async function (channel) {
|
|
985
|
+
return this.fetch("/api/update/channel", {
|
|
986
|
+
method: "PUT",
|
|
987
|
+
body: JSON.stringify({ channel }),
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
ElizaClient.prototype.getAgentAutomationMode = async function () {
|
|
991
|
+
return this.fetch("/api/permissions/automation-mode");
|
|
992
|
+
};
|
|
993
|
+
ElizaClient.prototype.setAgentAutomationMode = async function (mode) {
|
|
994
|
+
return this.fetch("/api/permissions/automation-mode", {
|
|
995
|
+
method: "PUT",
|
|
996
|
+
body: JSON.stringify({ mode }),
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
ElizaClient.prototype.getTradePermissionMode = async function () {
|
|
1000
|
+
return this.fetch("/api/permissions/trade-mode");
|
|
1001
|
+
};
|
|
1002
|
+
ElizaClient.prototype.setTradePermissionMode = async function (mode) {
|
|
1003
|
+
return this.fetch("/api/permissions/trade-mode", {
|
|
1004
|
+
method: "PUT",
|
|
1005
|
+
body: JSON.stringify({ mode }),
|
|
1006
|
+
});
|
|
1007
|
+
};
|
|
1008
|
+
ElizaClient.prototype.getPermissions = async function () {
|
|
1009
|
+
const permissions = await this.fetch("/api/permissions");
|
|
1010
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1011
|
+
if (!plugin) {
|
|
1012
|
+
return permissions;
|
|
1013
|
+
}
|
|
1014
|
+
const permission = mapWebsiteBlockerStatusToPermission(await plugin.getStatus());
|
|
1015
|
+
return {
|
|
1016
|
+
...permissions,
|
|
1017
|
+
[WEBSITE_BLOCKING_PERMISSION_ID]: permission,
|
|
1018
|
+
};
|
|
1019
|
+
};
|
|
1020
|
+
ElizaClient.prototype.getPermission = async function (id) {
|
|
1021
|
+
if (id === WEBSITE_BLOCKING_PERMISSION_ID) {
|
|
1022
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1023
|
+
if (plugin) {
|
|
1024
|
+
return mapWebsiteBlockerStatusToPermission(await plugin.getStatus());
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return this.fetch(`/api/permissions/${id}`);
|
|
1028
|
+
};
|
|
1029
|
+
ElizaClient.prototype.requestPermission = async function (id) {
|
|
1030
|
+
if (id === WEBSITE_BLOCKING_PERMISSION_ID) {
|
|
1031
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1032
|
+
if (plugin) {
|
|
1033
|
+
return mapWebsiteBlockerPermissionResult(await plugin.requestPermissions());
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return this.fetch(`/api/permissions/${id}/request`, { method: "POST" });
|
|
1037
|
+
};
|
|
1038
|
+
ElizaClient.prototype.openPermissionSettings = async function (id) {
|
|
1039
|
+
if (id === WEBSITE_BLOCKING_PERMISSION_ID) {
|
|
1040
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1041
|
+
if (plugin) {
|
|
1042
|
+
await plugin.openSettings();
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
await this.fetch(`/api/permissions/${id}/open-settings`, {
|
|
1047
|
+
method: "POST",
|
|
1048
|
+
});
|
|
1049
|
+
};
|
|
1050
|
+
ElizaClient.prototype.refreshPermissions = async function () {
|
|
1051
|
+
const permissions = await this.fetch("/api/permissions/refresh", {
|
|
1052
|
+
method: "POST",
|
|
1053
|
+
});
|
|
1054
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1055
|
+
if (!plugin) {
|
|
1056
|
+
return permissions;
|
|
1057
|
+
}
|
|
1058
|
+
const permission = mapWebsiteBlockerStatusToPermission(await plugin.getStatus());
|
|
1059
|
+
return {
|
|
1060
|
+
...permissions,
|
|
1061
|
+
[WEBSITE_BLOCKING_PERMISSION_ID]: permission,
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
ElizaClient.prototype.setShellEnabled = async function (enabled) {
|
|
1065
|
+
return this.fetch("/api/permissions/shell", {
|
|
1066
|
+
method: "PUT",
|
|
1067
|
+
body: JSON.stringify({ enabled }),
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
ElizaClient.prototype.isShellEnabled = async function () {
|
|
1071
|
+
const result = await this.fetch("/api/permissions/shell");
|
|
1072
|
+
return result.enabled;
|
|
1073
|
+
};
|
|
1074
|
+
ElizaClient.prototype.getWebsiteBlockerStatus = async function () {
|
|
1075
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1076
|
+
if (plugin) {
|
|
1077
|
+
return await plugin.getStatus();
|
|
1078
|
+
}
|
|
1079
|
+
return this.fetch("/api/website-blocker");
|
|
1080
|
+
};
|
|
1081
|
+
ElizaClient.prototype.startWebsiteBlock = async function (options) {
|
|
1082
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1083
|
+
if (plugin) {
|
|
1084
|
+
return await plugin.startBlock(options);
|
|
1085
|
+
}
|
|
1086
|
+
return this.fetch("/api/website-blocker", {
|
|
1087
|
+
method: "PUT",
|
|
1088
|
+
body: JSON.stringify(options),
|
|
1089
|
+
});
|
|
1090
|
+
};
|
|
1091
|
+
ElizaClient.prototype.stopWebsiteBlock = async function () {
|
|
1092
|
+
const plugin = getNativeWebsiteBlockerPluginIfAvailable();
|
|
1093
|
+
if (plugin) {
|
|
1094
|
+
return await plugin.stopBlock();
|
|
1095
|
+
}
|
|
1096
|
+
return this.fetch("/api/website-blocker", {
|
|
1097
|
+
method: "DELETE",
|
|
1098
|
+
});
|
|
1099
|
+
};
|
|
1100
|
+
ElizaClient.prototype.getAppBlockerStatus = async function () {
|
|
1101
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1102
|
+
if (plugin) {
|
|
1103
|
+
return await plugin.getStatus();
|
|
1104
|
+
}
|
|
1105
|
+
return {
|
|
1106
|
+
available: false,
|
|
1107
|
+
active: false,
|
|
1108
|
+
platform: "web",
|
|
1109
|
+
engine: "none",
|
|
1110
|
+
blockedCount: 0,
|
|
1111
|
+
blockedPackageNames: [],
|
|
1112
|
+
endsAt: null,
|
|
1113
|
+
permissionStatus: "not-applicable",
|
|
1114
|
+
reason: "App blocking is only available on iPhone and Android builds.",
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
ElizaClient.prototype.checkAppBlockerPermissions = async function () {
|
|
1118
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1119
|
+
if (plugin) {
|
|
1120
|
+
return await plugin.checkPermissions();
|
|
1121
|
+
}
|
|
1122
|
+
return {
|
|
1123
|
+
status: "not-applicable",
|
|
1124
|
+
canRequest: false,
|
|
1125
|
+
reason: "App blocking is only available on iPhone and Android builds.",
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
ElizaClient.prototype.requestAppBlockerPermissions = async function () {
|
|
1129
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1130
|
+
if (plugin) {
|
|
1131
|
+
return await plugin.requestPermissions();
|
|
1132
|
+
}
|
|
1133
|
+
return {
|
|
1134
|
+
status: "not-applicable",
|
|
1135
|
+
canRequest: false,
|
|
1136
|
+
reason: "App blocking is only available on iPhone and Android builds.",
|
|
1137
|
+
};
|
|
1138
|
+
};
|
|
1139
|
+
ElizaClient.prototype.getInstalledAppsToBlock = async function () {
|
|
1140
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1141
|
+
if (plugin) {
|
|
1142
|
+
return await plugin.getInstalledApps();
|
|
1143
|
+
}
|
|
1144
|
+
return { apps: [] };
|
|
1145
|
+
};
|
|
1146
|
+
ElizaClient.prototype.selectAppBlockerApps = async function () {
|
|
1147
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1148
|
+
if (plugin) {
|
|
1149
|
+
return await plugin.selectApps();
|
|
1150
|
+
}
|
|
1151
|
+
return {
|
|
1152
|
+
apps: [],
|
|
1153
|
+
cancelled: true,
|
|
1154
|
+
};
|
|
1155
|
+
};
|
|
1156
|
+
ElizaClient.prototype.startAppBlock = async function (options) {
|
|
1157
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1158
|
+
if (plugin) {
|
|
1159
|
+
return await plugin.blockApps(options);
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
success: false,
|
|
1163
|
+
endsAt: null,
|
|
1164
|
+
blockedCount: 0,
|
|
1165
|
+
error: "App blocking is only available on iPhone and Android builds.",
|
|
1166
|
+
};
|
|
1167
|
+
};
|
|
1168
|
+
ElizaClient.prototype.stopAppBlock = async function () {
|
|
1169
|
+
const plugin = getNativeAppBlockerPluginIfAvailable();
|
|
1170
|
+
if (plugin) {
|
|
1171
|
+
return await plugin.unblockApps();
|
|
1172
|
+
}
|
|
1173
|
+
return {
|
|
1174
|
+
success: false,
|
|
1175
|
+
error: "App blocking is only available on iPhone and Android builds.",
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
ElizaClient.prototype.getCodingAgentStatus = async function () {
|
|
1179
|
+
try {
|
|
1180
|
+
const status = await this.fetch("/api/coding-agents/coordinator/status");
|
|
1181
|
+
if (status &&
|
|
1182
|
+
(!status.tasks || status.tasks.length === 0) &&
|
|
1183
|
+
Array.isArray(status.taskThreads) &&
|
|
1184
|
+
status.taskThreads.length > 0) {
|
|
1185
|
+
status.tasks = mapTaskThreadsToCodingAgentSessions(status.taskThreads).filter((task) => !TERMINAL_STATUSES.has(task.status));
|
|
1186
|
+
status.taskCount = status.tasks.length;
|
|
1187
|
+
}
|
|
1188
|
+
if (status && !status.tasks) {
|
|
1189
|
+
// Only fall back to the raw PTY session list when the coordinator
|
|
1190
|
+
// didn't return a tasks array at all (null/undefined). An empty
|
|
1191
|
+
// array means "no tasks" — no need to hit /api/coding-agents which
|
|
1192
|
+
// may not have a handler and would hang until timeout.
|
|
1193
|
+
try {
|
|
1194
|
+
const ptySessions = await this.fetch("/api/coding-agents");
|
|
1195
|
+
if (Array.isArray(ptySessions) && ptySessions.length > 0) {
|
|
1196
|
+
status.tasks = mapPtySessionsToCodingAgentSessions(ptySessions);
|
|
1197
|
+
status.taskCount = status.tasks.length;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
catch {
|
|
1201
|
+
// /api/coding-agents may not exist — ignore
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
return status;
|
|
1205
|
+
}
|
|
1206
|
+
catch {
|
|
1207
|
+
return null;
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
ElizaClient.prototype.listCodingAgentTaskThreads = function (options) {
|
|
1211
|
+
const params = new URLSearchParams();
|
|
1212
|
+
if (options?.includeArchived)
|
|
1213
|
+
params.set("includeArchived", "true");
|
|
1214
|
+
if (options?.status)
|
|
1215
|
+
params.set("status", options.status);
|
|
1216
|
+
if (options?.search)
|
|
1217
|
+
params.set("search", options.search);
|
|
1218
|
+
if (typeof options?.limit === "number" && options.limit > 0) {
|
|
1219
|
+
params.set("limit", String(options.limit));
|
|
1220
|
+
}
|
|
1221
|
+
const query = params.toString();
|
|
1222
|
+
return this.fetch(`/api/coding-agents/coordinator/threads${query ? `?${query}` : ""}`);
|
|
1223
|
+
};
|
|
1224
|
+
ElizaClient.prototype.getCodingAgentTaskThread = function (threadId) {
|
|
1225
|
+
return this.fetch(`/api/coding-agents/coordinator/threads/${encodeURIComponent(threadId)}`);
|
|
1226
|
+
};
|
|
1227
|
+
ElizaClient.prototype.archiveCodingAgentTaskThread = async function (threadId) {
|
|
1228
|
+
await this.fetch(`/api/coding-agents/coordinator/threads/${encodeURIComponent(threadId)}/archive`, { method: "POST" });
|
|
1229
|
+
return true;
|
|
1230
|
+
};
|
|
1231
|
+
ElizaClient.prototype.reopenCodingAgentTaskThread = async function (threadId) {
|
|
1232
|
+
await this.fetch(`/api/coding-agents/coordinator/threads/${encodeURIComponent(threadId)}/reopen`, { method: "POST" });
|
|
1233
|
+
return true;
|
|
1234
|
+
};
|
|
1235
|
+
ElizaClient.prototype.stopCodingAgent = async function (sessionId) {
|
|
1236
|
+
try {
|
|
1237
|
+
await this.fetch(`/api/coding-agents/${encodeURIComponent(sessionId)}/stop`, { method: "POST" });
|
|
1238
|
+
return true;
|
|
1239
|
+
}
|
|
1240
|
+
catch {
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
ElizaClient.prototype.listCodingAgentScratchWorkspaces = async function () {
|
|
1245
|
+
try {
|
|
1246
|
+
return await this.fetch("/api/coding-agents/scratch");
|
|
1247
|
+
}
|
|
1248
|
+
catch (err) {
|
|
1249
|
+
console.warn("[api-client] Failed to list coding agent scratch workspaces:", err);
|
|
1250
|
+
return [];
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
ElizaClient.prototype.keepCodingAgentScratchWorkspace = async function (sessionId) {
|
|
1254
|
+
try {
|
|
1255
|
+
await this.fetch(`/api/coding-agents/${encodeURIComponent(sessionId)}/scratch/keep`, { method: "POST" });
|
|
1256
|
+
return true;
|
|
1257
|
+
}
|
|
1258
|
+
catch {
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
ElizaClient.prototype.deleteCodingAgentScratchWorkspace = async function (sessionId) {
|
|
1263
|
+
try {
|
|
1264
|
+
await this.fetch(`/api/coding-agents/${encodeURIComponent(sessionId)}/scratch/delete`, { method: "POST" });
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
catch {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
ElizaClient.prototype.promoteCodingAgentScratchWorkspace = async function (sessionId, name) {
|
|
1272
|
+
try {
|
|
1273
|
+
const response = await this.fetch(`/api/coding-agents/${encodeURIComponent(sessionId)}/scratch/promote`, {
|
|
1274
|
+
method: "POST",
|
|
1275
|
+
body: JSON.stringify(name ? { name } : {}),
|
|
1276
|
+
});
|
|
1277
|
+
return response.scratch ?? null;
|
|
1278
|
+
}
|
|
1279
|
+
catch {
|
|
1280
|
+
return null;
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
ElizaClient.prototype.spawnShellSession = async function (workdir) {
|
|
1284
|
+
const res = await this.fetch("/api/coding-agents/spawn", {
|
|
1285
|
+
method: "POST",
|
|
1286
|
+
body: JSON.stringify({
|
|
1287
|
+
agentType: "shell",
|
|
1288
|
+
...(workdir ? { workdir } : {}),
|
|
1289
|
+
}),
|
|
1290
|
+
});
|
|
1291
|
+
return { sessionId: res.sessionId };
|
|
1292
|
+
};
|
|
1293
|
+
ElizaClient.prototype.subscribePtyOutput = function (sessionId) {
|
|
1294
|
+
this.sendWsMessage({ type: "pty-subscribe", sessionId });
|
|
1295
|
+
};
|
|
1296
|
+
ElizaClient.prototype.unsubscribePtyOutput = function (sessionId) {
|
|
1297
|
+
this.sendWsMessage({ type: "pty-unsubscribe", sessionId });
|
|
1298
|
+
};
|
|
1299
|
+
ElizaClient.prototype.sendPtyInput = function (sessionId, data) {
|
|
1300
|
+
this.sendWsMessage({ type: "pty-input", sessionId, data });
|
|
1301
|
+
};
|
|
1302
|
+
ElizaClient.prototype.resizePty = function (sessionId, cols, rows) {
|
|
1303
|
+
this.sendWsMessage({ type: "pty-resize", sessionId, cols, rows });
|
|
1304
|
+
};
|
|
1305
|
+
ElizaClient.prototype.getPtyBufferedOutput = async function (sessionId) {
|
|
1306
|
+
try {
|
|
1307
|
+
const res = await this.fetch(`/api/coding-agents/${encodeURIComponent(sessionId)}/buffered-output`);
|
|
1308
|
+
return res.output ?? "";
|
|
1309
|
+
}
|
|
1310
|
+
catch {
|
|
1311
|
+
return "";
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
ElizaClient.prototype.streamGoLive = async function () {
|
|
1315
|
+
return this.fetch("/api/stream/live", { method: "POST" });
|
|
1316
|
+
};
|
|
1317
|
+
ElizaClient.prototype.streamGoOffline = async function () {
|
|
1318
|
+
return this.fetch("/api/stream/offline", { method: "POST" });
|
|
1319
|
+
};
|
|
1320
|
+
ElizaClient.prototype.streamStatus = async function () {
|
|
1321
|
+
return this.fetch("/api/stream/status");
|
|
1322
|
+
};
|
|
1323
|
+
ElizaClient.prototype.getStreamingDestinations = async function () {
|
|
1324
|
+
return this.fetch("/api/streaming/destinations");
|
|
1325
|
+
};
|
|
1326
|
+
ElizaClient.prototype.setActiveDestination = async function (destinationId) {
|
|
1327
|
+
return this.fetch("/api/streaming/destination", {
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
body: JSON.stringify({ destinationId }),
|
|
1330
|
+
});
|
|
1331
|
+
};
|
|
1332
|
+
ElizaClient.prototype.setStreamVolume = async function (volume) {
|
|
1333
|
+
return this.fetch("/api/stream/volume", {
|
|
1334
|
+
method: "POST",
|
|
1335
|
+
body: JSON.stringify({ volume }),
|
|
1336
|
+
});
|
|
1337
|
+
};
|
|
1338
|
+
ElizaClient.prototype.muteStream = async function () {
|
|
1339
|
+
return this.fetch("/api/stream/mute", { method: "POST" });
|
|
1340
|
+
};
|
|
1341
|
+
ElizaClient.prototype.unmuteStream = async function () {
|
|
1342
|
+
return this.fetch("/api/stream/unmute", { method: "POST" });
|
|
1343
|
+
};
|
|
1344
|
+
ElizaClient.prototype.getStreamVoice = async function () {
|
|
1345
|
+
return this.fetch("/api/stream/voice");
|
|
1346
|
+
};
|
|
1347
|
+
ElizaClient.prototype.saveStreamVoice = async function (settings) {
|
|
1348
|
+
return this.fetch("/api/stream/voice", {
|
|
1349
|
+
method: "POST",
|
|
1350
|
+
body: JSON.stringify(settings),
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
ElizaClient.prototype.streamVoiceSpeak = async function (text) {
|
|
1354
|
+
return this.fetch("/api/stream/voice/speak", {
|
|
1355
|
+
method: "POST",
|
|
1356
|
+
body: JSON.stringify({ text }),
|
|
1357
|
+
});
|
|
1358
|
+
};
|
|
1359
|
+
ElizaClient.prototype.getOverlayLayout = async function (destinationId) {
|
|
1360
|
+
const qs = destinationId
|
|
1361
|
+
? `?destination=${encodeURIComponent(destinationId)}`
|
|
1362
|
+
: "";
|
|
1363
|
+
return this.fetch(`/api/stream/overlay-layout${qs}`);
|
|
1364
|
+
};
|
|
1365
|
+
ElizaClient.prototype.saveOverlayLayout = async function (layout, destinationId) {
|
|
1366
|
+
const qs = destinationId
|
|
1367
|
+
? `?destination=${encodeURIComponent(destinationId)}`
|
|
1368
|
+
: "";
|
|
1369
|
+
return this.fetch(`/api/stream/overlay-layout${qs}`, {
|
|
1370
|
+
method: "POST",
|
|
1371
|
+
body: JSON.stringify({ layout }),
|
|
1372
|
+
});
|
|
1373
|
+
};
|
|
1374
|
+
ElizaClient.prototype.getStreamSource = async function () {
|
|
1375
|
+
return this.fetch("/api/stream/source");
|
|
1376
|
+
};
|
|
1377
|
+
ElizaClient.prototype.setStreamSource = async function (sourceType, customUrl) {
|
|
1378
|
+
return this.fetch("/api/stream/source", {
|
|
1379
|
+
method: "POST",
|
|
1380
|
+
body: JSON.stringify({ sourceType, customUrl }),
|
|
1381
|
+
});
|
|
1382
|
+
};
|
|
1383
|
+
ElizaClient.prototype.getStreamSettings = async function () {
|
|
1384
|
+
return this.fetch("/api/stream/settings");
|
|
1385
|
+
};
|
|
1386
|
+
ElizaClient.prototype.saveStreamSettings = async function (settings) {
|
|
1387
|
+
return this.fetch("/api/stream/settings", {
|
|
1388
|
+
method: "POST",
|
|
1389
|
+
body: JSON.stringify({ settings }),
|
|
1390
|
+
});
|
|
1391
|
+
};
|
|
1392
|
+
// ---------------------------------------------------------------------------
|
|
1393
|
+
// Multi-account routes (WS3)
|
|
1394
|
+
// ---------------------------------------------------------------------------
|
|
1395
|
+
ElizaClient.prototype.listAccounts = async function () {
|
|
1396
|
+
return this.fetch("/api/accounts");
|
|
1397
|
+
};
|
|
1398
|
+
ElizaClient.prototype.createApiKeyAccount = async function (providerId, body) {
|
|
1399
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}`, {
|
|
1400
|
+
method: "POST",
|
|
1401
|
+
body: JSON.stringify({ source: "api-key", ...body }),
|
|
1402
|
+
});
|
|
1403
|
+
};
|
|
1404
|
+
ElizaClient.prototype.patchAccount = async function (providerId, accountId, body) {
|
|
1405
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/${encodeURIComponent(accountId)}`, {
|
|
1406
|
+
method: "PATCH",
|
|
1407
|
+
body: JSON.stringify(body),
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
ElizaClient.prototype.deleteAccount = async function (providerId, accountId) {
|
|
1411
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/${encodeURIComponent(accountId)}`, { method: "DELETE" });
|
|
1412
|
+
};
|
|
1413
|
+
ElizaClient.prototype.testAccount = async function (providerId, accountId) {
|
|
1414
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/${encodeURIComponent(accountId)}/test`, { method: "POST" });
|
|
1415
|
+
};
|
|
1416
|
+
ElizaClient.prototype.refreshAccountUsage = async function (providerId, accountId) {
|
|
1417
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/${encodeURIComponent(accountId)}/refresh-usage`, { method: "POST" });
|
|
1418
|
+
};
|
|
1419
|
+
ElizaClient.prototype.startAccountOAuth = async function (providerId, body) {
|
|
1420
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/oauth/start`, {
|
|
1421
|
+
method: "POST",
|
|
1422
|
+
body: JSON.stringify(body),
|
|
1423
|
+
});
|
|
1424
|
+
};
|
|
1425
|
+
ElizaClient.prototype.submitAccountOAuthCode = async function (providerId, body) {
|
|
1426
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/oauth/submit-code`, {
|
|
1427
|
+
method: "POST",
|
|
1428
|
+
body: JSON.stringify(body),
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
ElizaClient.prototype.cancelAccountOAuth = async function (providerId, body) {
|
|
1432
|
+
return this.fetch(`/api/accounts/${encodeURIComponent(providerId)}/oauth/cancel`, {
|
|
1433
|
+
method: "POST",
|
|
1434
|
+
body: JSON.stringify(body),
|
|
1435
|
+
});
|
|
1436
|
+
};
|
|
1437
|
+
ElizaClient.prototype.patchProviderStrategy = async function (providerId, body) {
|
|
1438
|
+
return this.fetch(`/api/providers/${encodeURIComponent(providerId)}/strategy`, {
|
|
1439
|
+
method: "PATCH",
|
|
1440
|
+
body: JSON.stringify(body),
|
|
1441
|
+
});
|
|
1442
|
+
};
|