@elizaos/agent 2.0.3-beta.2 → 2.0.3-beta.3
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/__tests__/view-user-journeys.d.ts.map +1 -1
- package/__tests__/view-user-journeys.js +52 -41
- package/actions/context-signal.d.ts +2 -2
- package/actions/files.d.ts +9 -0
- package/actions/files.d.ts.map +1 -0
- package/actions/files.js +183 -0
- package/actions/index.d.ts +17 -17
- package/api/accounts-routes.d.ts +1 -1
- package/api/accounts-routes.js +1 -1
- package/api/agent-admin-routes.d.ts +1 -1
- package/api/agent-admin-routes.js +2 -2
- package/api/agent-model.d.ts +1 -1
- package/api/agent-status-routes.d.ts +1 -3
- package/api/agent-status-routes.d.ts.map +1 -1
- package/api/agent-status-routes.js +0 -2
- package/api/approval-routes.d.ts +38 -0
- package/api/approval-routes.d.ts.map +1 -0
- package/api/approval-routes.js +223 -0
- package/api/background-routes.d.ts +13 -0
- package/api/background-routes.d.ts.map +1 -0
- package/api/background-routes.js +91 -0
- package/api/binance-skill-helpers.d.ts +2 -2
- package/api/binance-skill-helpers.js +2 -2
- package/api/builtin-views.d.ts.map +1 -1
- package/api/builtin-views.js +44 -4
- package/api/character-routes.d.ts +1 -1
- package/api/chat-augmentation.d.ts.map +1 -1
- package/api/chat-augmentation.js +17 -0
- package/api/chat-routes.d.ts +29 -2
- package/api/chat-routes.d.ts.map +1 -1
- package/api/chat-routes.js +76 -1
- package/api/commands-routes.d.ts +10 -8
- package/api/commands-routes.d.ts.map +1 -1
- package/api/commands-routes.js +17 -59
- package/api/config-routes.d.ts +1 -1
- package/api/config-routes.d.ts.map +1 -1
- package/api/config-routes.js +0 -2
- package/api/connector-routes.d.ts +1 -1
- package/api/conversation-metadata.d.ts +1 -1
- package/api/conversation-metadata.d.ts.map +1 -1
- package/api/conversation-metadata.js +0 -1
- package/api/conversation-routes.d.ts +4 -3
- package/api/conversation-routes.d.ts.map +1 -1
- package/api/conversation-routes.js +34 -1
- package/api/documents-service-loader.d.ts +0 -4
- package/api/documents-service-loader.d.ts.map +1 -1
- package/api/documents-service-loader.js +0 -2
- package/api/files-routes.d.ts +14 -0
- package/api/files-routes.d.ts.map +1 -0
- package/api/files-routes.js +47 -0
- package/api/first-run-routes.d.ts +1 -1
- package/api/health-routes.d.ts +2 -2
- package/api/index.d.ts +40 -39
- package/api/index.d.ts.map +1 -1
- package/api/index.js +1 -0
- package/api/interactions-routes.d.ts +33 -0
- package/api/interactions-routes.d.ts.map +1 -0
- package/api/interactions-routes.js +63 -0
- package/api/media-runtime.d.ts +2 -1
- package/api/media-runtime.d.ts.map +1 -1
- package/api/media-runtime.js +64 -7
- package/api/media-store.d.ts +36 -0
- package/api/media-store.d.ts.map +1 -1
- package/api/media-store.js +141 -2
- package/api/memory-bounds.d.ts +0 -1
- package/api/memory-bounds.d.ts.map +1 -1
- package/api/memory-bounds.js +0 -1
- package/api/misc-routes.d.ts +1 -1
- package/api/model-provider-helpers.d.ts +2 -2
- package/api/model-provider-helpers.js +2 -2
- package/api/permissions-routes-extra.d.ts +1 -1
- package/api/permissions-routes.d.ts +1 -1
- package/api/permissions-routes.d.ts.map +1 -1
- package/api/permissions-routes.js +8 -7
- package/api/plugin-discovery-helpers.d.ts +5 -6
- package/api/plugin-discovery-helpers.d.ts.map +1 -1
- package/api/plugin-discovery-helpers.js +3 -4
- package/api/plugin-runtime-apply.d.ts +2 -2
- package/api/plugin-runtime-apply.d.ts.map +1 -1
- package/api/plugin-runtime-apply.js +74 -0
- package/api/provider-switch-config.d.ts +1 -1
- package/api/provider-switch-routes.d.ts +2 -2
- package/api/registry-routes.d.ts +1 -1
- package/api/registry-service.d.ts +1 -1
- package/api/remote-capability-routes.d.ts +2 -2
- package/api/remote-capability-routes.d.ts.map +1 -1
- package/api/remote-capability-routes.js +19 -0
- package/api/server-autonomy-helpers.d.ts +2 -2
- package/api/server-helpers-auth.d.ts +10 -0
- package/api/server-helpers-auth.d.ts.map +1 -1
- package/api/server-helpers-auth.js +16 -210
- package/api/server-helpers-config.d.ts +1 -1
- package/api/server-helpers-mcp.d.ts +2 -2
- package/api/server-helpers-plugin.d.ts +1 -1
- package/api/server-helpers-swarm.d.ts +3 -3
- package/api/server-helpers-swarm.d.ts.map +1 -1
- package/api/server-helpers-swarm.js +15 -5
- package/api/server-helpers-wallet.d.ts +1 -1
- package/api/server-helpers.d.ts +4 -4
- package/api/server-lazy-routes.d.ts +40 -38
- package/api/server-lazy-routes.d.ts.map +1 -1
- package/api/server-lazy-routes.js +7 -0
- package/api/server-route-dispatch.d.ts +2 -2
- package/api/server-route-dispatch.d.ts.map +1 -1
- package/api/server-route-dispatch.js +7 -0
- package/api/server-types.d.ts +9 -7
- package/api/server-types.d.ts.map +1 -1
- package/api/server.d.ts +19 -19
- package/api/server.d.ts.map +1 -1
- package/api/server.js +111 -17
- package/api/static-file-server.d.ts +2 -2
- package/api/static-file-server.js +2 -2
- package/api/subscription-routes.d.ts +4 -4
- package/api/subscription-routes.js +3 -4
- package/api/suggestions-routes.d.ts +1 -1
- package/api/suggestions-routes.d.ts.map +1 -1
- package/api/suggestions-routes.js +2 -3
- package/api/terminal-execution-routing.d.ts +1 -1
- package/api/training-service-like.d.ts +1 -1
- package/api/trajectory-fallback-routes.d.ts.map +1 -1
- package/api/trajectory-fallback-routes.js +21 -1
- package/api/update-routes.d.ts +1 -1
- package/api/view-registry-types.d.ts +1 -1
- package/api/views-registry.d.ts +14 -4
- package/api/views-registry.d.ts.map +1 -1
- package/api/views-registry.js +50 -26
- package/api/views-routes.d.ts +1 -1
- package/api/views-routes.d.ts.map +1 -1
- package/api/views-routes.js +131 -14
- package/api/views-search-index.d.ts +1 -1
- package/api/wallet-capability.d.ts +3 -3
- package/api/wallet-rpc.d.ts +1 -1
- package/api/wallet.d.ts +3 -3
- package/api/wallet.d.ts.map +1 -1
- package/api/wallet.js +4 -3
- package/api/workbench-context.d.ts +1 -1
- package/api/workbench-helpers.d.ts +3 -3
- package/api/workbench-helpers.js +3 -3
- package/api/workbench-routes.d.ts +2 -2
- package/api/workbench-vfs-routes.d.ts +1 -1
- package/api/ws-event-replay.d.ts +1 -2
- package/api/ws-event-replay.d.ts.map +1 -1
- package/api/ws-event-replay.js +1 -2
- package/api/x-relay-routes.d.ts +2 -2
- package/api/x402-route-validation.d.ts +4 -0
- package/api/x402-route-validation.d.ts.map +1 -0
- package/api/x402-route-validation.js +6 -0
- package/assets/view-heroes/background.png +0 -0
- package/auth/account-storage.d.ts +1 -1
- package/auth/anthropic.d.ts +1 -1
- package/auth/credentials.d.ts +2 -2
- package/auth/index.d.ts +7 -7
- package/auth/oauth-flow.d.ts +2 -2
- package/auth/openai-codex.d.ts +1 -1
- package/awareness/index.d.ts +1 -1
- package/config/config.js +0 -1
- package/config/env-vars.d.ts +1 -1
- package/config/env-vars.d.ts.map +1 -1
- package/config/env-vars.js +0 -1
- package/config/index.d.ts +10 -10
- package/config/model-metadata.d.ts +1 -1
- package/config/owner-contacts.d.ts +1 -1
- package/config/schema.d.ts +1 -1
- package/hooks/discovery.d.ts +1 -1
- package/hooks/eligibility.d.ts +2 -2
- package/hooks/index.d.ts +2 -2
- package/hooks/loader.d.ts +2 -2
- package/hooks/registry.d.ts +1 -1
- package/index.d.ts +87 -85
- package/index.d.ts.map +1 -1
- package/index.js +11 -3
- package/package.json +54 -44
- package/providers/media-provider.d.ts +1 -1
- package/providers/page-scoped-context.d.ts.map +1 -1
- package/providers/page-scoped-context.js +1 -70
- package/providers/relevant-conversations.d.ts.map +1 -1
- package/providers/relevant-conversations.js +8 -9
- package/providers/workspace.d.ts +1 -1
- package/runtime/actions/web-fetch.d.ts.map +1 -1
- package/runtime/actions/web-fetch.js +23 -3
- package/runtime/actions/web-search.d.ts +32 -0
- package/runtime/actions/web-search.d.ts.map +1 -0
- package/runtime/actions/web-search.js +245 -0
- package/runtime/advanced-capabilities-config.d.ts +1 -1
- package/runtime/boot-telemetry.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.js +1 -1
- package/runtime/conversation-compactor.d.ts +1 -1
- package/runtime/core-plugins.d.ts.map +1 -1
- package/runtime/core-plugins.js +9 -0
- package/runtime/custom-actions.d.ts +18 -9
- package/runtime/custom-actions.d.ts.map +1 -1
- package/runtime/custom-actions.js +85 -23
- package/runtime/eliza-plugin.d.ts.map +1 -1
- package/runtime/eliza-plugin.js +15 -1
- package/runtime/eliza.d.ts +9 -7
- package/runtime/eliza.d.ts.map +1 -1
- package/runtime/eliza.js +86 -23
- package/runtime/first-time-setup.d.ts +1 -3
- package/runtime/first-time-setup.d.ts.map +1 -1
- package/runtime/first-time-setup.js +0 -2
- package/runtime/index.d.ts +18 -18
- package/runtime/load-plugin-from-vfs.d.ts +2 -2
- package/runtime/mobile-dns.d.ts.map +1 -1
- package/runtime/mobile-dns.js +2 -5
- package/runtime/operations/classifier.d.ts +1 -1
- package/runtime/operations/cold-strategy.d.ts +1 -1
- package/runtime/operations/health-checks.d.ts +1 -1
- package/runtime/operations/health.d.ts +1 -1
- package/runtime/operations/index.d.ts +10 -10
- package/runtime/operations/manager.d.ts +3 -3
- package/runtime/operations/reload-hot.d.ts +1 -1
- package/runtime/operations/repository.d.ts +1 -1
- package/runtime/operations/vault-bridge.d.ts +1 -1
- package/runtime/plugin-collector.d.ts +6 -1
- package/runtime/plugin-collector.d.ts.map +1 -1
- package/runtime/plugin-collector.js +11 -28
- package/runtime/plugin-lifecycle.d.ts.map +1 -1
- package/runtime/plugin-lifecycle.js +1 -0
- package/runtime/plugin-resolver.d.ts +2 -2
- package/runtime/plugin-resolver.d.ts.map +1 -1
- package/runtime/plugin-resolver.js +113 -65
- package/runtime/plugin-types.d.ts +1 -1
- package/runtime/prompt-optimization.d.ts +4 -4
- package/runtime/remote-coding-runner-gate.d.ts +7 -0
- package/runtime/remote-coding-runner-gate.d.ts.map +1 -0
- package/runtime/remote-coding-runner-gate.js +36 -0
- package/runtime/roles/src/index.d.ts +4 -4
- package/runtime/roles.d.ts +2 -2
- package/runtime/sandbox-character.d.ts +1 -1
- package/runtime/tool-call-cache/cache.d.ts +1 -1
- package/runtime/tool-call-cache/disk-store.d.ts +1 -1
- package/runtime/tool-call-cache/index.d.ts +6 -6
- package/runtime/tool-call-cache/key.d.ts +1 -1
- package/runtime/tool-call-cache/redact.d.ts +1 -1
- package/runtime/tool-call-cache/registry.d.ts +1 -1
- package/runtime/tool-call-cache-wrapper.d.ts +7 -9
- package/runtime/tool-call-cache-wrapper.d.ts.map +1 -1
- package/runtime/tool-call-cache-wrapper.js +6 -11
- package/runtime/trajectory-export.d.ts +3 -3
- package/runtime/trajectory-internals.d.ts +2 -1
- package/runtime/trajectory-internals.d.ts.map +1 -1
- package/runtime/trajectory-persistence.d.ts +5 -5
- package/runtime/trajectory-steps-reader.d.ts +1 -1
- package/runtime/trajectory-steps-writer.d.ts +1 -1
- package/runtime/trajectory-storage.d.ts +4 -4
- package/runtime/view-action-affinity.d.ts +18 -15
- package/runtime/view-action-affinity.d.ts.map +1 -1
- package/runtime/view-action-affinity.js +26 -29
- package/runtime/web-search-tools.d.ts +4 -1
- package/runtime/web-search-tools.d.ts.map +1 -1
- package/runtime/web-search-tools.js +37 -9
- package/security/index.d.ts +3 -3
- package/services/approval/index.d.ts +9 -0
- package/services/approval/index.d.ts.map +1 -0
- package/services/approval/index.js +8 -0
- package/services/approval/service.d.ts +35 -0
- package/services/approval/service.d.ts.map +1 -0
- package/services/approval/service.js +40 -0
- package/services/approval/sql.d.ts +18 -0
- package/services/approval/sql.d.ts.map +1 -0
- package/services/approval/sql.js +104 -0
- package/services/approval/store.d.ts +39 -0
- package/services/approval/store.d.ts.map +1 -0
- package/services/approval/store.js +534 -0
- package/services/approval/types.d.ts +207 -0
- package/services/approval/types.d.ts.map +1 -0
- package/services/approval/types.js +34 -0
- package/services/character-persistence.d.ts +2 -2
- package/services/client-chat-sender.d.ts +1 -1
- package/services/config-plugin-manager.d.ts +2 -2
- package/services/connector-setup-service.d.ts +1 -1
- package/services/cove-quote-x509.d.ts +1 -1
- package/services/cove-quote.d.ts +2 -2
- package/services/dstack-tee-provider.d.ts +1 -1
- package/services/file-storage.d.ts +20 -0
- package/services/file-storage.d.ts.map +1 -0
- package/services/file-storage.js +70 -0
- package/services/global-pause/index.d.ts +8 -0
- package/services/global-pause/index.d.ts.map +1 -0
- package/services/global-pause/index.js +7 -0
- package/services/global-pause/service.d.ts +29 -0
- package/services/global-pause/service.d.ts.map +1 -0
- package/services/global-pause/service.js +34 -0
- package/services/global-pause/store.d.ts +31 -0
- package/services/global-pause/store.d.ts.map +1 -0
- package/services/global-pause/store.js +83 -0
- package/services/handoff/index.d.ts +8 -0
- package/services/handoff/index.d.ts.map +1 -0
- package/services/handoff/index.js +7 -0
- package/services/handoff/service.d.ts +29 -0
- package/services/handoff/service.d.ts.map +1 -0
- package/services/handoff/service.js +34 -0
- package/services/handoff/store.d.ts +76 -0
- package/services/handoff/store.d.ts.map +1 -0
- package/services/handoff/store.js +148 -0
- package/services/index.d.ts +30 -31
- package/services/index.d.ts.map +1 -1
- package/services/index.js +0 -6
- package/services/js-runtime-bridge.d.ts.map +1 -1
- package/services/js-runtime-bridge.js +8 -2
- package/services/knowledge-graph/index.d.ts +4 -4
- package/services/knowledge-graph/service.d.ts +2 -2
- package/services/pending-prompts/index.d.ts +8 -0
- package/services/pending-prompts/index.d.ts.map +1 -0
- package/services/pending-prompts/index.js +7 -0
- package/services/pending-prompts/service.d.ts +34 -0
- package/services/pending-prompts/service.d.ts.map +1 -0
- package/services/pending-prompts/service.js +68 -0
- package/services/pending-prompts/store.d.ts +70 -0
- package/services/pending-prompts/store.d.ts.map +1 -0
- package/services/pending-prompts/store.js +191 -0
- package/services/plugin-compiler.d.ts +1 -1
- package/services/plugin-installer.d.ts.map +1 -1
- package/services/plugin-installer.js +21 -11
- package/services/plugin-manager-types.d.ts +1 -1
- package/services/proactive-interaction-decider.d.ts +62 -11
- package/services/proactive-interaction-decider.d.ts.map +1 -1
- package/services/proactive-interaction-decider.js +223 -35
- package/services/push/apns-provider.d.ts +1 -1
- package/services/push/fcm-provider.d.ts +1 -1
- package/services/push/notification-push-service.d.ts +2 -2
- package/services/registry-client-app-meta.d.ts +1 -1
- package/services/registry-client-endpoints.d.ts +2 -2
- package/services/registry-client-local.d.ts +1 -1
- package/services/registry-client-network.d.ts +1 -1
- package/services/registry-client-queries.d.ts +1 -1
- package/services/registry-client.d.ts +3 -3
- package/services/relationships-graph.d.ts +1 -1
- package/services/remote-capability-cloud-sandbox.d.ts +3 -3
- package/services/remote-capability-endpoint-conformance.d.ts +1 -1
- package/services/remote-capability-endpoint-provider.d.ts +4 -4
- package/services/remote-capability-url-endpoint-providers.d.ts +1 -1
- package/services/remote-plugin-adapter.d.ts.map +1 -1
- package/services/remote-plugin-adapter.js +3 -0
- package/services/remote-plugin-bridge.d.ts.map +1 -1
- package/services/remote-plugin-bridge.js +97 -26
- package/services/remote-signing-service.d.ts +4 -4
- package/services/research-task-executor.d.ts +1 -1
- package/services/sandbox-manager.d.ts +1 -1
- package/services/self-updater.d.ts +1 -1
- package/services/self-updater.d.ts.map +1 -1
- package/services/self-updater.js +23 -9
- package/services/shell-execution-router.d.ts +1 -1
- package/services/shell-execution-router.d.ts.map +1 -1
- package/services/shell-execution-router.js +19 -2
- package/services/tee-boot-gate-state.d.ts +1 -1
- package/services/tee-boot-gate.d.ts +4 -4
- package/services/tee-confidential-inference.d.ts +3 -3
- package/services/tee-key-release.d.ts +2 -2
- package/services/tee-model-key-boot.d.ts +4 -4
- package/services/tee-policy.d.ts +1 -1
- package/services/tee-production-profile.d.ts +1 -1
- package/services/tee-release-policy.d.ts +1 -1
- package/services/tee-revocation.d.ts +2 -2
- package/services/tee-runtime-config.d.ts +1 -1
- package/services/tee-sealed-volume.d.ts +3 -3
- package/services/tee-signer-backend.d.ts +3 -3
- package/services/update-checker.d.ts +1 -1
- package/services/vault-signer-backend.d.ts +1 -1
- package/services/vfs-git.d.ts +1 -1
- package/test-support/index.d.ts +3 -3
- package/triggers/runtime.d.ts +1 -1
- package/triggers/scheduling.d.ts +3 -22
- package/triggers/scheduling.d.ts.map +1 -1
- package/triggers/scheduling.js +2 -214
- package/tui/agent-terminal-tui.d.ts.map +1 -1
- package/tui/agent-terminal-tui.js +174 -72
- package/types/index.d.ts +3 -3
- package/api/nfa-routes.d.ts +0 -6
- package/api/nfa-routes.d.ts.map +0 -1
- package/api/nfa-routes.js +0 -125
- package/api/server-auth.d.ts +0 -46
- package/api/server-auth.d.ts.map +0 -1
- package/api/server-auth.js +0 -504
- package/runtime/restart.d.ts +0 -9
- package/runtime/restart.d.ts.map +0 -1
- package/runtime/restart.js +0 -8
- package/test-utils/sqlite-compat.d.ts +0 -23
- package/test-utils/sqlite-compat.d.ts.map +0 -1
- package/test-utils/sqlite-compat.js +0 -214
package/runtime/restart.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/runtime/restart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
package/runtime/restart.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Restart infrastructure for Eliza — thin re-export of `@elizaos/shared/restart`.
|
|
3
|
-
*
|
|
4
|
-
* The single source of truth lives in `@elizaos/shared` (browser-safe inert
|
|
5
|
-
* default). This module preserves the historical import path used inside the
|
|
6
|
-
* agent package so existing imports keep working.
|
|
7
|
-
*/
|
|
8
|
-
export { RESTART_EXIT_CODE, requestRestart, setRestartHandler, } from "@elizaos/shared";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type SqliteValue = string | number | bigint | boolean | Uint8Array | null;
|
|
2
|
-
export type SqliteRow = Record<string, SqliteValue>;
|
|
3
|
-
export interface SqliteRunResult {
|
|
4
|
-
changes?: number;
|
|
5
|
-
lastInsertRowid?: number | bigint;
|
|
6
|
-
}
|
|
7
|
-
export interface SqliteStatementCompat {
|
|
8
|
-
all(...params: SqliteValue[]): SqliteRow[];
|
|
9
|
-
get(...params: SqliteValue[]): SqliteRow | null;
|
|
10
|
-
run(...params: SqliteValue[]): SqliteRunResult;
|
|
11
|
-
}
|
|
12
|
-
export interface SqliteDatabaseCompat {
|
|
13
|
-
exec(sql: string): void;
|
|
14
|
-
prepare(sql: string): SqliteStatementCompat;
|
|
15
|
-
close(): void;
|
|
16
|
-
}
|
|
17
|
-
export interface SqliteDatabaseSyncConstructor {
|
|
18
|
-
new (filename: string): SqliteDatabaseCompat;
|
|
19
|
-
}
|
|
20
|
-
export declare const hasSqlite: boolean;
|
|
21
|
-
export declare const DatabaseSync: SqliteDatabaseSyncConstructor;
|
|
22
|
-
export type SqliteDatabaseSync = InstanceType<SqliteDatabaseSyncConstructor>;
|
|
23
|
-
//# sourceMappingURL=sqlite-compat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-compat.d.ts","sourceRoot":"","sources":["../../src/test-utils/sqlite-compat.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,GACV,IAAI,CAAC;AAET,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,CAAC;IAC3C,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;IAChD,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC;CAChD;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;IAC5C,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,6BAA6B;IAC5C,KAAK,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAC9C;AA6QD,eAAO,MAAM,SAAS,SAAiB,CAAC;AACxC,eAAO,MAAM,YAAY,EAAwB,6BAA6B,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC"}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { existsSync, unlinkSync } from "node:fs";
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
let DatabaseSyncValue;
|
|
9
|
-
let hasSqliteValue = false;
|
|
10
|
-
const BUN_SQLITE_BRIDGE_SCRIPT = `
|
|
11
|
-
import { Database } from "bun:sqlite";
|
|
12
|
-
|
|
13
|
-
const payload = JSON.parse(await Bun.stdin.text());
|
|
14
|
-
|
|
15
|
-
function reviveSqliteValue(value) {
|
|
16
|
-
if (value && typeof value === "object") {
|
|
17
|
-
if (value.__sqliteType === "bigint") {
|
|
18
|
-
return BigInt(value.value);
|
|
19
|
-
}
|
|
20
|
-
if (value.__sqliteType === "uint8array") {
|
|
21
|
-
return new Uint8Array(value.value);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function replaceSqliteValue(_key, value) {
|
|
28
|
-
if (typeof value === "bigint") {
|
|
29
|
-
const asNumber = Number(value);
|
|
30
|
-
return Number.isSafeInteger(asNumber) ? asNumber : value.toString();
|
|
31
|
-
}
|
|
32
|
-
if (value instanceof Uint8Array) {
|
|
33
|
-
return Array.from(value);
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const db = new Database(payload.filename);
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
let result = null;
|
|
42
|
-
if (payload.operation === "exec") {
|
|
43
|
-
db.exec(payload.sql);
|
|
44
|
-
} else {
|
|
45
|
-
const params = payload.params.map(reviveSqliteValue);
|
|
46
|
-
const query = db.query(payload.sql);
|
|
47
|
-
if (payload.operation === "all") {
|
|
48
|
-
result = query.all(...params);
|
|
49
|
-
} else if (payload.operation === "get") {
|
|
50
|
-
result = query.get(...params) ?? null;
|
|
51
|
-
} else if (payload.operation === "run") {
|
|
52
|
-
result = query.run(...params);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
process.stdout.write(JSON.stringify({ ok: true, result }, replaceSqliteValue));
|
|
56
|
-
} catch (error) {
|
|
57
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
58
|
-
const stack = error instanceof Error ? error.stack : undefined;
|
|
59
|
-
process.stdout.write(JSON.stringify({ ok: false, error: { message, stack } }));
|
|
60
|
-
process.exitCode = 1;
|
|
61
|
-
} finally {
|
|
62
|
-
db.close();
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
function isBunRuntime() {
|
|
66
|
-
return (typeof process !== "undefined" && typeof process.versions.bun === "string");
|
|
67
|
-
}
|
|
68
|
-
function hasBunCli() {
|
|
69
|
-
const result = spawnSync("bun", ["--version"], {
|
|
70
|
-
encoding: "utf8",
|
|
71
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
72
|
-
});
|
|
73
|
-
return !result.error && result.status === 0;
|
|
74
|
-
}
|
|
75
|
-
function serializeSqliteValue(value) {
|
|
76
|
-
if (typeof value === "bigint") {
|
|
77
|
-
return { __sqliteType: "bigint", value: value.toString() };
|
|
78
|
-
}
|
|
79
|
-
if (value instanceof Uint8Array) {
|
|
80
|
-
return { __sqliteType: "uint8array", value: Array.from(value) };
|
|
81
|
-
}
|
|
82
|
-
return value;
|
|
83
|
-
}
|
|
84
|
-
function runBunSqliteCli(payload) {
|
|
85
|
-
const result = spawnSync("bun", ["--eval", BUN_SQLITE_BRIDGE_SCRIPT], {
|
|
86
|
-
encoding: "utf8",
|
|
87
|
-
input: JSON.stringify(payload),
|
|
88
|
-
maxBuffer: 50 * 1024 * 1024,
|
|
89
|
-
});
|
|
90
|
-
const stdout = result.stdout.trim();
|
|
91
|
-
let response;
|
|
92
|
-
if (stdout.length > 0) {
|
|
93
|
-
try {
|
|
94
|
-
response = JSON.parse(stdout);
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
const detail = result.stderr.trim() || stdout;
|
|
98
|
-
throw new Error(`[sqlite-compat] Could not parse Bun SQLite output: ${detail}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (result.error) {
|
|
102
|
-
throw result.error;
|
|
103
|
-
}
|
|
104
|
-
if (result.status !== 0 || response?.ok === false || !response) {
|
|
105
|
-
const message = response?.ok === false
|
|
106
|
-
? response.error.message
|
|
107
|
-
: result.stderr.trim() ||
|
|
108
|
-
`Bun SQLite bridge exited with status ${result.status ?? "unknown"}`;
|
|
109
|
-
throw new Error(`[sqlite-compat] ${message}`);
|
|
110
|
-
}
|
|
111
|
-
return response.result;
|
|
112
|
-
}
|
|
113
|
-
class BunCliDatabaseSyncCompat {
|
|
114
|
-
filename;
|
|
115
|
-
deleteOnClose;
|
|
116
|
-
constructor(filename) {
|
|
117
|
-
this.deleteOnClose = filename === ":memory:";
|
|
118
|
-
this.filename = this.deleteOnClose
|
|
119
|
-
? join(tmpdir(), `eliza-sqlite-${process.pid}-${randomUUID()}.sqlite`)
|
|
120
|
-
: filename;
|
|
121
|
-
}
|
|
122
|
-
exec(sql) {
|
|
123
|
-
runBunSqliteCli({
|
|
124
|
-
filename: this.filename,
|
|
125
|
-
operation: "exec",
|
|
126
|
-
sql,
|
|
127
|
-
params: [],
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
prepare(sql) {
|
|
131
|
-
return {
|
|
132
|
-
all: (...params) => runBunSqliteCli({
|
|
133
|
-
filename: this.filename,
|
|
134
|
-
operation: "all",
|
|
135
|
-
sql,
|
|
136
|
-
params: params.map(serializeSqliteValue),
|
|
137
|
-
}),
|
|
138
|
-
get: (...params) => runBunSqliteCli({
|
|
139
|
-
filename: this.filename,
|
|
140
|
-
operation: "get",
|
|
141
|
-
sql,
|
|
142
|
-
params: params.map(serializeSqliteValue),
|
|
143
|
-
}),
|
|
144
|
-
run: (...params) => runBunSqliteCli({
|
|
145
|
-
filename: this.filename,
|
|
146
|
-
operation: "run",
|
|
147
|
-
sql,
|
|
148
|
-
params: params.map(serializeSqliteValue),
|
|
149
|
-
}),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
close() {
|
|
153
|
-
if (!this.deleteOnClose) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
for (const filename of [
|
|
157
|
-
this.filename,
|
|
158
|
-
`${this.filename}-shm`,
|
|
159
|
-
`${this.filename}-wal`,
|
|
160
|
-
]) {
|
|
161
|
-
if (existsSync(filename)) {
|
|
162
|
-
unlinkSync(filename);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
({ DatabaseSync: DatabaseSyncValue } = require("node:sqlite"));
|
|
169
|
-
hasSqliteValue = typeof DatabaseSyncValue === "function";
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
DatabaseSyncValue = undefined;
|
|
173
|
-
}
|
|
174
|
-
if (!hasSqliteValue) {
|
|
175
|
-
if (isBunRuntime()) {
|
|
176
|
-
try {
|
|
177
|
-
const { Database } = require("bun:sqlite");
|
|
178
|
-
class BunDatabaseSyncCompat {
|
|
179
|
-
db;
|
|
180
|
-
constructor(filename) {
|
|
181
|
-
this.db = new Database(filename);
|
|
182
|
-
}
|
|
183
|
-
exec(sql) {
|
|
184
|
-
this.db.exec(sql);
|
|
185
|
-
}
|
|
186
|
-
prepare(sql) {
|
|
187
|
-
const query = this.db.query(sql);
|
|
188
|
-
return {
|
|
189
|
-
all: (...params) => query.all(...params),
|
|
190
|
-
get: (...params) => query.get(...params) ?? null,
|
|
191
|
-
run: (...params) => query.run(...params),
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
close() {
|
|
195
|
-
this.db.close();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
DatabaseSyncValue = BunDatabaseSyncCompat;
|
|
199
|
-
hasSqliteValue = true;
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
hasSqliteValue = false;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else if (hasBunCli()) {
|
|
206
|
-
DatabaseSyncValue = BunCliDatabaseSyncCompat;
|
|
207
|
-
hasSqliteValue = true;
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
hasSqliteValue = false;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
export const hasSqlite = hasSqliteValue;
|
|
214
|
-
export const DatabaseSync = DatabaseSyncValue;
|