@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,582 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat domain methods — chat, conversations, knowledge, memory, MCP,
|
|
3
|
+
* share ingest, workbench, trajectories, database.
|
|
4
|
+
*/
|
|
5
|
+
import { ElizaClient } from "./client-base";
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Prototype augmentation
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
const LEGACY_CHAT_COMPAT_TITLE = "Quick Chat";
|
|
10
|
+
const LEGACY_CHAT_CONVERSATION_STORAGE_PREFIX = "legacy_chat_conversation";
|
|
11
|
+
function getLegacyChatConversationStorageKey(client) {
|
|
12
|
+
const base = client.getBaseUrl() ||
|
|
13
|
+
(typeof window !== "undefined" ? window.location.origin : "same-origin");
|
|
14
|
+
return `${LEGACY_CHAT_CONVERSATION_STORAGE_PREFIX}:${encodeURIComponent(base)}`;
|
|
15
|
+
}
|
|
16
|
+
function readLegacyChatConversationId(client) {
|
|
17
|
+
if (typeof window === "undefined") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const stored = window.sessionStorage.getItem(getLegacyChatConversationStorageKey(client));
|
|
21
|
+
return stored?.trim() ? stored.trim() : null;
|
|
22
|
+
}
|
|
23
|
+
function writeLegacyChatConversationId(client, conversationId) {
|
|
24
|
+
if (typeof window === "undefined") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const key = getLegacyChatConversationStorageKey(client);
|
|
28
|
+
if (conversationId?.trim()) {
|
|
29
|
+
window.sessionStorage.setItem(key, conversationId.trim());
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
window.sessionStorage.removeItem(key);
|
|
33
|
+
}
|
|
34
|
+
async function ensureLegacyChatConversationId(client) {
|
|
35
|
+
const cached = readLegacyChatConversationId(client);
|
|
36
|
+
if (cached) {
|
|
37
|
+
return cached;
|
|
38
|
+
}
|
|
39
|
+
const { conversation } = await client.createConversation(LEGACY_CHAT_COMPAT_TITLE);
|
|
40
|
+
writeLegacyChatConversationId(client, conversation.id);
|
|
41
|
+
return conversation.id;
|
|
42
|
+
}
|
|
43
|
+
ElizaClient.prototype.sendChatRest = async function (text, channelType = "DM", conversationMode) {
|
|
44
|
+
const sendToConversation = async (conversationId) => this.sendConversationMessage(conversationId, text, channelType, undefined, conversationMode);
|
|
45
|
+
const conversationId = await ensureLegacyChatConversationId(this);
|
|
46
|
+
try {
|
|
47
|
+
return await sendToConversation(conversationId);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof Error &&
|
|
51
|
+
error.name === "ApiError" &&
|
|
52
|
+
error.status === 404) {
|
|
53
|
+
writeLegacyChatConversationId(this, null);
|
|
54
|
+
return sendToConversation(await ensureLegacyChatConversationId(this));
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
ElizaClient.prototype.sendChatStream = async function (text, onToken, channelType = "DM", signal, conversationMode) {
|
|
60
|
+
const streamConversation = async (conversationId) => this.sendConversationMessageStream(conversationId, text, onToken, channelType, signal, undefined, conversationMode);
|
|
61
|
+
const conversationId = await ensureLegacyChatConversationId(this);
|
|
62
|
+
try {
|
|
63
|
+
return await streamConversation(conversationId);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error instanceof Error &&
|
|
67
|
+
error.name === "ApiError" &&
|
|
68
|
+
error.status === 404) {
|
|
69
|
+
writeLegacyChatConversationId(this, null);
|
|
70
|
+
return streamConversation(await ensureLegacyChatConversationId(this));
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
ElizaClient.prototype.listConversations = async function () {
|
|
76
|
+
return this.fetch("/api/conversations");
|
|
77
|
+
};
|
|
78
|
+
ElizaClient.prototype.createConversation = async function (title, options) {
|
|
79
|
+
const response = await this.fetch("/api/conversations", {
|
|
80
|
+
method: "POST",
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
title,
|
|
83
|
+
...(options?.includeGreeting === true ||
|
|
84
|
+
options?.bootstrapGreeting === true
|
|
85
|
+
? { includeGreeting: true }
|
|
86
|
+
: {}),
|
|
87
|
+
...(typeof options?.lang === "string" && options.lang.trim()
|
|
88
|
+
? { lang: options.lang.trim() }
|
|
89
|
+
: {}),
|
|
90
|
+
...(options?.metadata ? { metadata: options.metadata } : {}),
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
93
|
+
if (!response.greeting) {
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
...response,
|
|
98
|
+
greeting: {
|
|
99
|
+
...response.greeting,
|
|
100
|
+
text: this.normalizeGreetingText(response.greeting.text),
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
ElizaClient.prototype.getConversationMessages = async function (id) {
|
|
105
|
+
const response = await this.fetch(`/api/conversations/${encodeURIComponent(id)}/messages`);
|
|
106
|
+
return {
|
|
107
|
+
messages: response.messages.map((message) => {
|
|
108
|
+
if (message.role !== "assistant")
|
|
109
|
+
return message;
|
|
110
|
+
const text = this.normalizeAssistantText(message.text);
|
|
111
|
+
return text === message.text ? message : { ...message, text };
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
ElizaClient.prototype.getInboxMessages = async function (options) {
|
|
116
|
+
const params = new URLSearchParams();
|
|
117
|
+
if (typeof options?.limit === "number" && options.limit > 0) {
|
|
118
|
+
params.set("limit", String(options.limit));
|
|
119
|
+
}
|
|
120
|
+
if (options?.sources && options.sources.length > 0) {
|
|
121
|
+
params.set("sources", options.sources.join(","));
|
|
122
|
+
}
|
|
123
|
+
if (typeof options?.roomId === "string" && options.roomId.length > 0) {
|
|
124
|
+
params.set("roomId", options.roomId);
|
|
125
|
+
}
|
|
126
|
+
if (typeof options?.roomSource === "string" &&
|
|
127
|
+
options.roomSource.length > 0) {
|
|
128
|
+
params.set("roomSource", options.roomSource);
|
|
129
|
+
}
|
|
130
|
+
const query = params.toString();
|
|
131
|
+
const path = query ? `/api/inbox/messages?${query}` : "/api/inbox/messages";
|
|
132
|
+
return this.fetch(path);
|
|
133
|
+
};
|
|
134
|
+
ElizaClient.prototype.getInboxSources = async function () {
|
|
135
|
+
return this.fetch("/api/inbox/sources");
|
|
136
|
+
};
|
|
137
|
+
ElizaClient.prototype.getInboxChats = async function (options) {
|
|
138
|
+
const params = new URLSearchParams();
|
|
139
|
+
if (options?.sources && options.sources.length > 0) {
|
|
140
|
+
params.set("sources", options.sources.join(","));
|
|
141
|
+
}
|
|
142
|
+
const query = params.toString();
|
|
143
|
+
const path = query ? `/api/inbox/chats?${query}` : "/api/inbox/chats";
|
|
144
|
+
return this.fetch(path);
|
|
145
|
+
};
|
|
146
|
+
ElizaClient.prototype.sendInboxMessage = async function (data) {
|
|
147
|
+
return this.fetch("/api/inbox/messages", {
|
|
148
|
+
method: "POST",
|
|
149
|
+
body: JSON.stringify(data),
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
ElizaClient.prototype.truncateConversationMessages = async function (id, messageId, options) {
|
|
153
|
+
return this.fetch(`/api/conversations/${encodeURIComponent(id)}/messages/truncate`, {
|
|
154
|
+
method: "POST",
|
|
155
|
+
body: JSON.stringify({
|
|
156
|
+
messageId,
|
|
157
|
+
inclusive: options?.inclusive === true,
|
|
158
|
+
}),
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
ElizaClient.prototype.sendConversationMessage = async function (id, text, channelType = "DM", images, conversationMode, metadata) {
|
|
162
|
+
const response = await this.fetch(`/api/conversations/${encodeURIComponent(id)}/messages`, {
|
|
163
|
+
method: "POST",
|
|
164
|
+
body: JSON.stringify({
|
|
165
|
+
text,
|
|
166
|
+
channelType,
|
|
167
|
+
...(images?.length ? { images } : {}),
|
|
168
|
+
...(conversationMode ? { conversationMode } : {}),
|
|
169
|
+
...(metadata ? { metadata } : {}),
|
|
170
|
+
}),
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
...response,
|
|
174
|
+
text: response.noResponseReason === "ignored"
|
|
175
|
+
? ""
|
|
176
|
+
: this.normalizeAssistantText(response.text),
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
ElizaClient.prototype.sendConversationMessageStream = async function (id, text, onToken, channelType = "DM", signal, images, conversationMode, metadata) {
|
|
180
|
+
return this.streamChatEndpoint(`/api/conversations/${encodeURIComponent(id)}/messages/stream`, text, onToken, channelType, signal, images, conversationMode, metadata);
|
|
181
|
+
};
|
|
182
|
+
ElizaClient.prototype.requestGreeting = async function (id, lang) {
|
|
183
|
+
const qs = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
184
|
+
const response = await this.fetch(`/api/conversations/${encodeURIComponent(id)}/greeting${qs}`, {
|
|
185
|
+
method: "POST",
|
|
186
|
+
});
|
|
187
|
+
return {
|
|
188
|
+
...response,
|
|
189
|
+
text: this.normalizeGreetingText(response.text),
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
ElizaClient.prototype.renameConversation = async function (id, title, options) {
|
|
193
|
+
return this.updateConversation(id, {
|
|
194
|
+
title,
|
|
195
|
+
generate: options?.generate,
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
ElizaClient.prototype.updateConversation = async function (id, data) {
|
|
199
|
+
return this.fetch(`/api/conversations/${encodeURIComponent(id)}`, {
|
|
200
|
+
method: "PATCH",
|
|
201
|
+
body: JSON.stringify({
|
|
202
|
+
...(typeof data?.title === "string" ? { title: data.title } : {}),
|
|
203
|
+
...(typeof data?.generate === "boolean"
|
|
204
|
+
? { generate: data.generate }
|
|
205
|
+
: {}),
|
|
206
|
+
...(data && "metadata" in data ? { metadata: data.metadata } : {}),
|
|
207
|
+
}),
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
ElizaClient.prototype.deleteConversation = async function (id) {
|
|
211
|
+
return this.fetch(`/api/conversations/${encodeURIComponent(id)}`, {
|
|
212
|
+
method: "DELETE",
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
ElizaClient.prototype.cleanupEmptyConversations = async function (options) {
|
|
216
|
+
return this.fetch("/api/conversations/cleanup-empty", {
|
|
217
|
+
method: "POST",
|
|
218
|
+
headers: { "Content-Type": "application/json" },
|
|
219
|
+
body: JSON.stringify({
|
|
220
|
+
...(options?.keepId ? { keepId: options.keepId } : {}),
|
|
221
|
+
}),
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
ElizaClient.prototype.getKnowledgeStats = async function () {
|
|
225
|
+
return this.fetch("/api/knowledge/stats");
|
|
226
|
+
};
|
|
227
|
+
ElizaClient.prototype.listKnowledgeDocuments = async function (options) {
|
|
228
|
+
const params = new URLSearchParams();
|
|
229
|
+
if (options?.limit)
|
|
230
|
+
params.set("limit", String(options.limit));
|
|
231
|
+
if (options?.offset)
|
|
232
|
+
params.set("offset", String(options.offset));
|
|
233
|
+
const query = params.toString();
|
|
234
|
+
return this.fetch(`/api/knowledge/documents${query ? `?${query}` : ""}`);
|
|
235
|
+
};
|
|
236
|
+
ElizaClient.prototype.getKnowledgeDocument = async function (documentId) {
|
|
237
|
+
return this.fetch(`/api/knowledge/documents/${encodeURIComponent(documentId)}`);
|
|
238
|
+
};
|
|
239
|
+
ElizaClient.prototype.updateKnowledgeDocument = async function (documentId, data) {
|
|
240
|
+
return this.fetch(`/api/knowledge/documents/${encodeURIComponent(documentId)}`, {
|
|
241
|
+
method: "PATCH",
|
|
242
|
+
body: JSON.stringify(data),
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
ElizaClient.prototype.deleteKnowledgeDocument = async function (documentId) {
|
|
246
|
+
return this.fetch(`/api/knowledge/documents/${encodeURIComponent(documentId)}`, { method: "DELETE" });
|
|
247
|
+
};
|
|
248
|
+
ElizaClient.prototype.uploadKnowledgeDocument = async function (data) {
|
|
249
|
+
return this.fetch("/api/knowledge/documents", {
|
|
250
|
+
method: "POST",
|
|
251
|
+
body: JSON.stringify(data),
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
ElizaClient.prototype.uploadKnowledgeDocumentsBulk = async function (data) {
|
|
255
|
+
return this.fetch("/api/knowledge/documents/bulk", {
|
|
256
|
+
method: "POST",
|
|
257
|
+
body: JSON.stringify(data),
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
ElizaClient.prototype.uploadKnowledgeFromUrl = async function (url, metadata) {
|
|
261
|
+
return this.fetch("/api/knowledge/documents/url", {
|
|
262
|
+
method: "POST",
|
|
263
|
+
body: JSON.stringify({ url, metadata }),
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
ElizaClient.prototype.searchKnowledge = async function (query, options) {
|
|
267
|
+
const params = new URLSearchParams({ q: query });
|
|
268
|
+
if (options?.threshold !== undefined)
|
|
269
|
+
params.set("threshold", String(options.threshold));
|
|
270
|
+
if (options?.limit !== undefined)
|
|
271
|
+
params.set("limit", String(options.limit));
|
|
272
|
+
return this.fetch(`/api/knowledge/search?${params}`);
|
|
273
|
+
};
|
|
274
|
+
ElizaClient.prototype.getKnowledgeFragments = async function (documentId) {
|
|
275
|
+
return this.fetch(`/api/knowledge/fragments/${encodeURIComponent(documentId)}`);
|
|
276
|
+
};
|
|
277
|
+
ElizaClient.prototype.listScratchpadTopics = async function () {
|
|
278
|
+
return this.fetch("/api/knowledge/scratchpad/topics");
|
|
279
|
+
};
|
|
280
|
+
ElizaClient.prototype.createScratchpadTopic = async function (data) {
|
|
281
|
+
return this.fetch("/api/knowledge/scratchpad/topics", {
|
|
282
|
+
method: "POST",
|
|
283
|
+
body: JSON.stringify(data),
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
ElizaClient.prototype.getScratchpadTopic = async function (topicId) {
|
|
287
|
+
return this.fetch(`/api/knowledge/scratchpad/topics/${encodeURIComponent(topicId)}`);
|
|
288
|
+
};
|
|
289
|
+
ElizaClient.prototype.replaceScratchpadTopic = async function (topicId, data) {
|
|
290
|
+
return this.fetch(`/api/knowledge/scratchpad/topics/${encodeURIComponent(topicId)}`, {
|
|
291
|
+
method: "PUT",
|
|
292
|
+
body: JSON.stringify(data),
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
ElizaClient.prototype.deleteScratchpadTopic = async function (topicId) {
|
|
296
|
+
return this.fetch(`/api/knowledge/scratchpad/topics/${encodeURIComponent(topicId)}`, { method: "DELETE" });
|
|
297
|
+
};
|
|
298
|
+
ElizaClient.prototype.searchScratchpadTopics = async function (query, options) {
|
|
299
|
+
const params = new URLSearchParams({ q: query });
|
|
300
|
+
if (options?.limit !== undefined)
|
|
301
|
+
params.set("limit", String(options.limit));
|
|
302
|
+
return this.fetch(`/api/knowledge/scratchpad/search?${params}`);
|
|
303
|
+
};
|
|
304
|
+
ElizaClient.prototype.previewScratchpadSummary = async function (data) {
|
|
305
|
+
return this.fetch("/api/knowledge/scratchpad/summary-preview", {
|
|
306
|
+
method: "POST",
|
|
307
|
+
body: JSON.stringify(data),
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
ElizaClient.prototype.rememberMemory = async function (text) {
|
|
311
|
+
return this.fetch("/api/memory/remember", {
|
|
312
|
+
method: "POST",
|
|
313
|
+
body: JSON.stringify({ text }),
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
ElizaClient.prototype.searchMemory = async function (query, options) {
|
|
317
|
+
const params = new URLSearchParams({ q: query });
|
|
318
|
+
if (options?.limit !== undefined)
|
|
319
|
+
params.set("limit", String(options.limit));
|
|
320
|
+
return this.fetch(`/api/memory/search?${params}`);
|
|
321
|
+
};
|
|
322
|
+
ElizaClient.prototype.quickContext = async function (query, options) {
|
|
323
|
+
const params = new URLSearchParams({ q: query });
|
|
324
|
+
if (options?.limit !== undefined)
|
|
325
|
+
params.set("limit", String(options.limit));
|
|
326
|
+
return this.fetch(`/api/context/quick?${params}`);
|
|
327
|
+
};
|
|
328
|
+
ElizaClient.prototype.getMemoryFeed = async function (query) {
|
|
329
|
+
const params = new URLSearchParams();
|
|
330
|
+
if (query?.type)
|
|
331
|
+
params.set("type", query.type);
|
|
332
|
+
if (typeof query?.limit === "number")
|
|
333
|
+
params.set("limit", String(query.limit));
|
|
334
|
+
if (typeof query?.before === "number")
|
|
335
|
+
params.set("before", String(query.before));
|
|
336
|
+
const qs = params.toString();
|
|
337
|
+
return this.fetch(`/api/memories/feed${qs ? `?${qs}` : ""}`);
|
|
338
|
+
};
|
|
339
|
+
ElizaClient.prototype.browseMemories = async function (query) {
|
|
340
|
+
const params = new URLSearchParams();
|
|
341
|
+
if (query?.type)
|
|
342
|
+
params.set("type", query.type);
|
|
343
|
+
if (query?.entityId)
|
|
344
|
+
params.set("entityId", query.entityId);
|
|
345
|
+
if (query?.roomId)
|
|
346
|
+
params.set("roomId", query.roomId);
|
|
347
|
+
if (query?.q)
|
|
348
|
+
params.set("q", query.q);
|
|
349
|
+
if (typeof query?.limit === "number")
|
|
350
|
+
params.set("limit", String(query.limit));
|
|
351
|
+
if (typeof query?.offset === "number")
|
|
352
|
+
params.set("offset", String(query.offset));
|
|
353
|
+
const qs = params.toString();
|
|
354
|
+
return this.fetch(`/api/memories/browse${qs ? `?${qs}` : ""}`);
|
|
355
|
+
};
|
|
356
|
+
ElizaClient.prototype.getMemoriesByEntity = async function (entityId, query) {
|
|
357
|
+
const params = new URLSearchParams();
|
|
358
|
+
if (query?.type)
|
|
359
|
+
params.set("type", query.type);
|
|
360
|
+
if (typeof query?.limit === "number")
|
|
361
|
+
params.set("limit", String(query.limit));
|
|
362
|
+
if (typeof query?.offset === "number")
|
|
363
|
+
params.set("offset", String(query.offset));
|
|
364
|
+
if (query?.entityIds && query.entityIds.length > 0)
|
|
365
|
+
params.set("entityIds", query.entityIds.join(","));
|
|
366
|
+
const qs = params.toString();
|
|
367
|
+
return this.fetch(`/api/memories/by-entity/${encodeURIComponent(entityId)}${qs ? `?${qs}` : ""}`);
|
|
368
|
+
};
|
|
369
|
+
ElizaClient.prototype.getMemoryStats = async function () {
|
|
370
|
+
return this.fetch("/api/memories/stats");
|
|
371
|
+
};
|
|
372
|
+
ElizaClient.prototype.getMcpConfig = async function () {
|
|
373
|
+
return this.fetch("/api/mcp/config");
|
|
374
|
+
};
|
|
375
|
+
ElizaClient.prototype.getMcpStatus = async function () {
|
|
376
|
+
return this.fetch("/api/mcp/status");
|
|
377
|
+
};
|
|
378
|
+
ElizaClient.prototype.searchMcpMarketplace = async function (query, limit) {
|
|
379
|
+
const params = new URLSearchParams({ q: query, limit: String(limit) });
|
|
380
|
+
return this.fetch(`/api/mcp/marketplace/search?${params}`);
|
|
381
|
+
};
|
|
382
|
+
ElizaClient.prototype.getMcpServerDetails = async function (name) {
|
|
383
|
+
return this.fetch(`/api/mcp/marketplace/${encodeURIComponent(name)}`);
|
|
384
|
+
};
|
|
385
|
+
ElizaClient.prototype.addMcpServer = async function (name, config) {
|
|
386
|
+
await this.fetch("/api/mcp/servers", {
|
|
387
|
+
method: "POST",
|
|
388
|
+
body: JSON.stringify({ name, config }),
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
ElizaClient.prototype.removeMcpServer = async function (name) {
|
|
392
|
+
await this.fetch(`/api/mcp/servers/${encodeURIComponent(name)}`, {
|
|
393
|
+
method: "DELETE",
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
ElizaClient.prototype.ingestShare = async function (payload) {
|
|
397
|
+
return this.fetch("/api/ingest/share", {
|
|
398
|
+
method: "POST",
|
|
399
|
+
body: JSON.stringify(payload),
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
ElizaClient.prototype.consumeShareIngest = async function () {
|
|
403
|
+
return this.fetch("/api/share/consume", { method: "POST" });
|
|
404
|
+
};
|
|
405
|
+
ElizaClient.prototype.getWorkbenchOverview = async function () {
|
|
406
|
+
return this.fetch("/api/workbench/overview");
|
|
407
|
+
};
|
|
408
|
+
ElizaClient.prototype.listWorkbenchTasks = async function () {
|
|
409
|
+
return this.fetch("/api/workbench/tasks");
|
|
410
|
+
};
|
|
411
|
+
ElizaClient.prototype.getWorkbenchTask = async function (taskId) {
|
|
412
|
+
return this.fetch(`/api/workbench/tasks/${encodeURIComponent(taskId)}`);
|
|
413
|
+
};
|
|
414
|
+
ElizaClient.prototype.createWorkbenchTask = async function (data) {
|
|
415
|
+
return this.fetch("/api/workbench/tasks", {
|
|
416
|
+
method: "POST",
|
|
417
|
+
body: JSON.stringify(data),
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
ElizaClient.prototype.updateWorkbenchTask = async function (taskId, data) {
|
|
421
|
+
return this.fetch(`/api/workbench/tasks/${encodeURIComponent(taskId)}`, {
|
|
422
|
+
method: "PUT",
|
|
423
|
+
body: JSON.stringify(data),
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
ElizaClient.prototype.deleteWorkbenchTask = async function (taskId) {
|
|
427
|
+
return this.fetch(`/api/workbench/tasks/${encodeURIComponent(taskId)}`, {
|
|
428
|
+
method: "DELETE",
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
ElizaClient.prototype.listWorkbenchTodos = async function () {
|
|
432
|
+
return this.fetch("/api/workbench/todos");
|
|
433
|
+
};
|
|
434
|
+
ElizaClient.prototype.getWorkbenchTodo = async function (todoId) {
|
|
435
|
+
return this.fetch(`/api/workbench/todos/${encodeURIComponent(todoId)}`);
|
|
436
|
+
};
|
|
437
|
+
ElizaClient.prototype.createWorkbenchTodo = async function (data) {
|
|
438
|
+
return this.fetch("/api/workbench/todos", {
|
|
439
|
+
method: "POST",
|
|
440
|
+
body: JSON.stringify(data),
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
ElizaClient.prototype.updateWorkbenchTodo = async function (todoId, data) {
|
|
444
|
+
return this.fetch(`/api/workbench/todos/${encodeURIComponent(todoId)}`, {
|
|
445
|
+
method: "PUT",
|
|
446
|
+
body: JSON.stringify(data),
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
ElizaClient.prototype.setWorkbenchTodoCompleted = async function (todoId, isCompleted) {
|
|
450
|
+
await this.fetch(`/api/workbench/todos/${encodeURIComponent(todoId)}/complete`, {
|
|
451
|
+
method: "POST",
|
|
452
|
+
body: JSON.stringify({ isCompleted }),
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
ElizaClient.prototype.deleteWorkbenchTodo = async function (todoId) {
|
|
456
|
+
return this.fetch(`/api/workbench/todos/${encodeURIComponent(todoId)}`, {
|
|
457
|
+
method: "DELETE",
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
ElizaClient.prototype.refreshRegistry = async function () {
|
|
461
|
+
await this.fetch("/api/apps/refresh", { method: "POST" });
|
|
462
|
+
};
|
|
463
|
+
ElizaClient.prototype.getTrajectories = async function (options) {
|
|
464
|
+
const params = new URLSearchParams();
|
|
465
|
+
if (options?.limit)
|
|
466
|
+
params.set("limit", String(options.limit));
|
|
467
|
+
if (options?.offset)
|
|
468
|
+
params.set("offset", String(options.offset));
|
|
469
|
+
if (options?.source)
|
|
470
|
+
params.set("source", options.source);
|
|
471
|
+
if (options?.scenarioId)
|
|
472
|
+
params.set("scenarioId", options.scenarioId);
|
|
473
|
+
if (options?.batchId)
|
|
474
|
+
params.set("batchId", options.batchId);
|
|
475
|
+
if (options?.status)
|
|
476
|
+
params.set("status", options.status);
|
|
477
|
+
if (options?.startDate)
|
|
478
|
+
params.set("startDate", options.startDate);
|
|
479
|
+
if (options?.endDate)
|
|
480
|
+
params.set("endDate", options.endDate);
|
|
481
|
+
if (options?.search)
|
|
482
|
+
params.set("search", options.search);
|
|
483
|
+
const query = params.toString();
|
|
484
|
+
return this.fetch(`/api/trajectories${query ? `?${query}` : ""}`);
|
|
485
|
+
};
|
|
486
|
+
ElizaClient.prototype.getTrajectoryDetail = async function (trajectoryId) {
|
|
487
|
+
return this.fetch(`/api/trajectories/${encodeURIComponent(trajectoryId)}`);
|
|
488
|
+
};
|
|
489
|
+
ElizaClient.prototype.getTrajectoryStats = async function () {
|
|
490
|
+
return this.fetch("/api/trajectories/stats");
|
|
491
|
+
};
|
|
492
|
+
ElizaClient.prototype.getTrajectoryConfig = async function () {
|
|
493
|
+
return this.fetch("/api/trajectories/config");
|
|
494
|
+
};
|
|
495
|
+
ElizaClient.prototype.updateTrajectoryConfig = async function (config) {
|
|
496
|
+
return this.fetch("/api/trajectories/config", {
|
|
497
|
+
method: "PUT",
|
|
498
|
+
body: JSON.stringify(config),
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
ElizaClient.prototype.exportTrajectories = async function (options) {
|
|
502
|
+
const res = await this.rawRequest("/api/trajectories/export", {
|
|
503
|
+
method: "POST",
|
|
504
|
+
headers: {
|
|
505
|
+
"Content-Type": "application/json",
|
|
506
|
+
},
|
|
507
|
+
body: JSON.stringify(options),
|
|
508
|
+
});
|
|
509
|
+
return res.blob();
|
|
510
|
+
};
|
|
511
|
+
ElizaClient.prototype.deleteTrajectories = async function (trajectoryIds) {
|
|
512
|
+
return this.fetch("/api/trajectories", {
|
|
513
|
+
method: "DELETE",
|
|
514
|
+
body: JSON.stringify({ trajectoryIds }),
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
ElizaClient.prototype.clearAllTrajectories = async function () {
|
|
518
|
+
return this.fetch("/api/trajectories", {
|
|
519
|
+
method: "DELETE",
|
|
520
|
+
body: JSON.stringify({ clearAll: true }),
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
ElizaClient.prototype.getDatabaseStatus = async function () {
|
|
524
|
+
return this.fetch("/api/database/status");
|
|
525
|
+
};
|
|
526
|
+
ElizaClient.prototype.getDatabaseConfig = async function () {
|
|
527
|
+
return this.fetch("/api/database/config");
|
|
528
|
+
};
|
|
529
|
+
ElizaClient.prototype.saveDatabaseConfig = async function (config) {
|
|
530
|
+
return this.fetch("/api/database/config", {
|
|
531
|
+
method: "PUT",
|
|
532
|
+
body: JSON.stringify(config),
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
ElizaClient.prototype.testDatabaseConnection = async function (creds) {
|
|
536
|
+
return this.fetch("/api/database/test", {
|
|
537
|
+
method: "POST",
|
|
538
|
+
body: JSON.stringify(creds),
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
ElizaClient.prototype.getDatabaseTables = async function () {
|
|
542
|
+
return this.fetch("/api/database/tables");
|
|
543
|
+
};
|
|
544
|
+
ElizaClient.prototype.getDatabaseRows = async function (table, opts) {
|
|
545
|
+
const params = new URLSearchParams();
|
|
546
|
+
if (opts?.offset != null)
|
|
547
|
+
params.set("offset", String(opts.offset));
|
|
548
|
+
if (opts?.limit != null)
|
|
549
|
+
params.set("limit", String(opts.limit));
|
|
550
|
+
if (opts?.sort)
|
|
551
|
+
params.set("sort", opts.sort);
|
|
552
|
+
if (opts?.order)
|
|
553
|
+
params.set("order", opts.order);
|
|
554
|
+
if (opts?.search)
|
|
555
|
+
params.set("search", opts.search);
|
|
556
|
+
const qs = params.toString();
|
|
557
|
+
return this.fetch(`/api/database/tables/${encodeURIComponent(table)}/rows${qs ? `?${qs}` : ""}`);
|
|
558
|
+
};
|
|
559
|
+
ElizaClient.prototype.insertDatabaseRow = async function (table, data) {
|
|
560
|
+
return this.fetch(`/api/database/tables/${encodeURIComponent(table)}/rows`, {
|
|
561
|
+
method: "POST",
|
|
562
|
+
body: JSON.stringify({ data }),
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
ElizaClient.prototype.updateDatabaseRow = async function (table, where, data) {
|
|
566
|
+
return this.fetch(`/api/database/tables/${encodeURIComponent(table)}/rows`, {
|
|
567
|
+
method: "PUT",
|
|
568
|
+
body: JSON.stringify({ where, data }),
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
ElizaClient.prototype.deleteDatabaseRow = async function (table, where) {
|
|
572
|
+
return this.fetch(`/api/database/tables/${encodeURIComponent(table)}/rows`, {
|
|
573
|
+
method: "DELETE",
|
|
574
|
+
body: JSON.stringify({ where }),
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
ElizaClient.prototype.executeDatabaseQuery = async function (sql, readOnly = true) {
|
|
578
|
+
return this.fetch("/api/database/query", {
|
|
579
|
+
method: "POST",
|
|
580
|
+
body: JSON.stringify({ sql, readOnly }),
|
|
581
|
+
});
|
|
582
|
+
};
|