@elizaos/agent 2.0.0-beta.2 → 2.0.11-beta.6
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__/plugin-lifecycle-test-utils.d.ts +47 -0
- package/__tests__/plugin-lifecycle-test-utils.d.ts.map +1 -0
- package/__tests__/plugin-lifecycle-test-utils.js +81 -0
- package/__tests__/view-user-journeys.d.ts +55 -0
- package/__tests__/view-user-journeys.d.ts.map +1 -0
- package/__tests__/view-user-journeys.js +707 -0
- package/actions/compact-conversation.d.ts +3 -0
- package/actions/compact-conversation.d.ts.map +1 -0
- package/actions/compact-conversation.js +256 -0
- package/actions/connector-resolver.d.ts.map +1 -0
- package/actions/connector-resolver.js +250 -0
- package/actions/contact.d.ts.map +1 -0
- package/actions/contact.js +1700 -0
- package/actions/context-signal-lexicon.d.ts.map +1 -0
- package/actions/context-signal.d.ts.map +1 -0
- package/actions/context-signal.js +153 -0
- package/actions/database.d.ts.map +1 -0
- package/actions/database.js +674 -0
- package/actions/extract-params.d.ts +87 -0
- package/actions/extract-params.d.ts.map +1 -0
- package/actions/extract-params.js +204 -0
- package/actions/grounded-action-reply.d.ts.map +1 -0
- package/actions/grounded-action-reply.js +287 -0
- package/actions/index.d.ts +18 -0
- package/actions/index.d.ts.map +1 -0
- package/actions/index.js +17 -0
- package/actions/logs.d.ts.map +1 -0
- package/actions/memories.d.ts +3 -0
- package/actions/memories.d.ts.map +1 -0
- package/actions/memories.js +357 -0
- package/actions/notify.d.ts +14 -0
- package/actions/notify.d.ts.map +1 -0
- package/actions/notify.js +163 -0
- package/actions/page-action-groups.d.ts +9 -0
- package/actions/page-action-groups.d.ts.map +1 -0
- package/actions/page-action-groups.js +259 -0
- package/actions/plugin.d.ts +3 -0
- package/actions/plugin.d.ts.map +1 -0
- package/actions/plugin.js +755 -0
- package/actions/recent-conversation-texts.d.ts.map +1 -0
- package/actions/recent-conversation-texts.js +76 -0
- package/actions/runtime.d.ts.map +1 -0
- package/actions/runtime.js +517 -0
- package/actions/settings-actions.d.ts +19 -0
- package/actions/settings-actions.d.ts.map +1 -0
- package/actions/settings-actions.js +478 -0
- package/actions/terminal.d.ts.map +1 -0
- package/actions/terminal.js +327 -0
- package/actions/trigger.d.ts.map +1 -0
- package/actions/trigger.js +511 -0
- package/api/accounts-routes.d.ts +38 -0
- package/api/accounts-routes.d.ts.map +1 -0
- package/api/accounts-routes.js +932 -0
- package/api/agent-admin-routes.d.ts +36 -0
- package/api/agent-admin-routes.d.ts.map +1 -0
- package/api/agent-admin-routes.js +151 -0
- package/api/agent-lifecycle-routes.d.ts.map +1 -0
- package/api/agent-lifecycle-routes.js +104 -0
- package/api/agent-model.d.ts.map +1 -0
- package/api/agent-model.js +172 -0
- package/api/agent-status-routes.d.ts.map +1 -0
- package/api/agent-status-routes.js +280 -0
- package/api/agent-transfer-routes.d.ts.map +1 -0
- package/api/agent-transfer-routes.js +124 -0
- package/api/app-package-routes.d.ts +3 -0
- package/api/app-package-routes.d.ts.map +1 -0
- package/api/app-package-routes.js +59 -0
- package/api/auth-routes.d.ts.map +1 -0
- package/api/auth-routes.js +126 -0
- package/api/avatar-routes.d.ts.map +1 -0
- package/api/avatar-routes.js +210 -0
- package/api/background-tasks-routes.d.ts +18 -0
- package/api/background-tasks-routes.d.ts.map +1 -0
- package/api/background-tasks-routes.js +58 -0
- package/api/binance-skill-helpers.d.ts.map +1 -0
- package/api/binance-skill-helpers.js +859 -0
- package/api/bug-report-routes.d.ts +10 -0
- package/api/bug-report-routes.d.ts.map +1 -0
- package/api/bug-report-routes.js +276 -0
- package/api/builtin-views.d.ts +11 -0
- package/api/builtin-views.d.ts.map +1 -0
- package/api/builtin-views.js +164 -0
- package/api/character-routes.d.ts.map +1 -0
- package/api/character-routes.js +380 -0
- package/api/chat-augmentation.d.ts +22 -0
- package/api/chat-augmentation.d.ts.map +1 -0
- package/api/chat-augmentation.js +367 -0
- package/api/chat-routes.d.ts +150 -0
- package/api/chat-routes.d.ts.map +1 -0
- package/api/chat-routes.js +2581 -0
- package/api/chat-text-helpers.d.ts.map +1 -0
- package/api/client-chat-admin.d.ts.map +1 -0
- package/api/commands-routes.d.ts +30 -0
- package/api/commands-routes.d.ts.map +1 -0
- package/api/commands-routes.js +90 -0
- package/api/compat-utils.d.ts.map +1 -0
- package/api/config-env.d.ts.map +1 -0
- package/api/config-env.js +283 -0
- package/api/config-routes.d.ts.map +1 -0
- package/api/config-routes.js +433 -0
- package/api/connector-account-routes.d.ts.map +1 -0
- package/api/connector-account-routes.js +740 -0
- package/api/connector-health.d.ts.map +1 -0
- package/api/connector-oauth-callback-auth.d.ts.map +1 -0
- package/api/connector-routes.d.ts.map +1 -0
- package/api/connector-routes.js +198 -0
- package/api/conversation-metadata.d.ts.map +1 -0
- package/api/conversation-metadata.js +118 -0
- package/api/conversation-routes.d.ts +64 -0
- package/api/conversation-routes.d.ts.map +1 -0
- package/api/conversation-routes.js +1795 -0
- package/api/coordinator-wiring.d.ts.map +1 -0
- package/api/coordinator-wiring.js +108 -0
- package/api/credit-detection.d.ts.map +1 -0
- package/api/credit-detection.js +41 -0
- package/api/database.d.ts +33 -0
- package/api/database.d.ts.map +1 -0
- package/api/database.js +1026 -0
- package/api/diagnostics-routes.d.ts +51 -0
- package/api/diagnostics-routes.d.ts.map +1 -0
- package/api/diagnostics-routes.js +361 -0
- package/api/dispatch-route.d.ts +40 -0
- package/api/dispatch-route.d.ts.map +1 -0
- package/api/dispatch-route.js +387 -0
- package/api/documents-service-loader.d.ts.map +1 -0
- package/api/early-logs.d.ts +24 -0
- package/api/early-logs.d.ts.map +1 -0
- package/api/first-run-routes.d.ts +50 -0
- package/api/first-run-routes.d.ts.map +1 -0
- package/api/first-run-routes.js +570 -0
- package/api/health-routes.d.ts +58 -0
- package/api/health-routes.d.ts.map +1 -0
- package/api/health-routes.js +554 -0
- package/api/hono-adapter.d.ts +29 -0
- package/api/hono-adapter.d.ts.map +1 -0
- package/api/hono-adapter.js +170 -0
- package/api/hono-mount.d.ts +16 -0
- package/api/hono-mount.d.ts.map +1 -0
- package/api/hono-mount.js +121 -0
- package/api/inbox-routes.d.ts.map +1 -0
- package/api/inbox-routes.js +1587 -0
- package/api/index.d.ts +43 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +52 -0
- package/api/media-runtime.d.ts +36 -0
- package/api/media-runtime.d.ts.map +1 -0
- package/api/media-runtime.js +136 -0
- package/api/media-store.d.ts +86 -0
- package/api/media-store.d.ts.map +1 -0
- package/api/media-store.js +461 -0
- package/api/media-thumbnail.d.ts +22 -0
- package/api/media-thumbnail.d.ts.map +1 -0
- package/api/media-thumbnail.js +121 -0
- package/api/memory-bounds.d.ts.map +1 -0
- package/api/memory-routes.d.ts.map +1 -0
- package/api/memory-routes.js +480 -0
- package/api/misc-routes.d.ts.map +1 -0
- package/api/misc-routes.js +569 -0
- package/api/mobile-optional-routes.d.ts.map +1 -0
- package/api/mobile-optional-routes.js +258 -0
- package/api/model-provider-helpers.d.ts +70 -0
- package/api/model-provider-helpers.d.ts.map +1 -0
- package/api/model-provider-helpers.js +663 -0
- package/api/models-routes.d.ts.map +1 -0
- package/api/music-player-route-fallback.d.ts.map +1 -0
- package/api/nfa-routes.d.ts +6 -0
- package/api/nfa-routes.d.ts.map +1 -0
- package/api/nfa-routes.js +125 -0
- package/api/notification-routes.d.ts +38 -0
- package/api/notification-routes.d.ts.map +1 -0
- package/api/notification-routes.js +169 -0
- package/api/owner-contact-helpers.d.ts.map +1 -0
- package/api/parse-action-block.d.ts +53 -0
- package/api/parse-action-block.d.ts.map +1 -0
- package/api/pending-request-map.d.ts +30 -0
- package/api/pending-request-map.d.ts.map +1 -0
- package/api/pending-request-map.js +40 -0
- package/api/permission-request-prompt.d.ts +19 -0
- package/api/permission-request-prompt.d.ts.map +1 -0
- package/api/permission-request-prompt.js +55 -0
- package/api/permissions-routes-extra.d.ts +28 -0
- package/api/permissions-routes-extra.d.ts.map +1 -0
- package/api/permissions-routes.d.ts.map +1 -0
- package/api/permissions-routes.js +468 -0
- package/api/platform-detect.d.ts +26 -0
- package/api/platform-detect.d.ts.map +1 -0
- package/api/platform-detect.js +40 -0
- package/api/plugin-discovery-helpers.d.ts +118 -0
- package/api/plugin-discovery-helpers.d.ts.map +1 -0
- package/api/plugin-discovery-helpers.js +1159 -0
- package/api/plugin-runtime-apply.d.ts.map +1 -0
- package/api/plugin-runtime-apply.js +217 -0
- package/api/plugin-validation.d.ts.map +1 -0
- package/api/provider-switch-config.d.ts +59 -0
- package/api/provider-switch-config.d.ts.map +1 -0
- package/api/provider-switch-config.js +804 -0
- package/api/provider-switch-routes.d.ts.map +1 -0
- package/api/provider-switch-routes.js +133 -0
- package/api/push-token-routes.d.ts +30 -0
- package/api/push-token-routes.d.ts.map +1 -0
- package/api/push-token-routes.js +83 -0
- package/api/rate-limiter.d.ts.map +1 -0
- package/api/registry-routes.d.ts.map +1 -0
- package/api/registry-routes.js +98 -0
- package/api/registry-service.d.ts.map +1 -0
- package/api/registry-service.js +190 -0
- package/api/relationships-routes.d.ts.map +1 -0
- package/api/relationships-routes.js +286 -0
- package/api/remote-capability-routes.d.ts +26 -0
- package/api/remote-capability-routes.d.ts.map +1 -0
- package/api/remote-capability-routes.js +612 -0
- package/api/runtime-plugin-routes.d.ts.map +1 -0
- package/api/runtime-plugin-routes.js +251 -0
- package/api/runtime-ready-gate.d.ts +25 -0
- package/api/runtime-ready-gate.d.ts.map +1 -0
- package/api/runtime-ready-gate.js +35 -0
- package/api/server-auth.d.ts.map +1 -0
- package/api/server-auth.js +504 -0
- package/api/server-autonomy-helpers.d.ts.map +1 -0
- package/api/server-helpers-auth.d.ts +62 -0
- package/api/server-helpers-auth.d.ts.map +1 -0
- package/api/server-helpers-auth.js +889 -0
- package/api/server-helpers-config.d.ts +37 -0
- package/api/server-helpers-config.d.ts.map +1 -0
- package/api/server-helpers-config.js +289 -0
- package/api/server-helpers-fetch.d.ts.map +1 -0
- package/api/server-helpers-mcp.d.ts +17 -0
- package/api/server-helpers-mcp.d.ts.map +1 -0
- package/api/server-helpers-mcp.js +60 -0
- package/api/server-helpers-plugin.d.ts.map +1 -0
- package/api/server-helpers-swarm.d.ts +101 -0
- package/api/server-helpers-swarm.d.ts.map +1 -0
- package/api/server-helpers-swarm.js +646 -0
- package/api/server-helpers-wallet.d.ts.map +1 -0
- package/api/server-helpers.d.ts +85 -0
- package/api/server-helpers.d.ts.map +1 -0
- package/api/server-helpers.js +676 -0
- package/api/server-lazy-routes.d.ts +88 -0
- package/api/server-lazy-routes.d.ts.map +1 -0
- package/api/server-lazy-routes.js +446 -0
- package/api/server-route-dispatch.d.ts.map +1 -0
- package/api/server-route-dispatch.js +127 -0
- package/api/server-types.d.ts +197 -0
- package/api/server-types.d.ts.map +1 -0
- package/api/server.d.ts +61 -0
- package/api/server.d.ts.map +1 -0
- package/api/server.js +3684 -0
- package/api/static-file-server.d.ts.map +1 -0
- package/api/static-file-server.js +233 -0
- package/api/subscription-routes.d.ts.map +1 -0
- package/api/subscription-routes.js +294 -0
- package/api/suggestions-routes.d.ts +50 -0
- package/api/suggestions-routes.d.ts.map +1 -0
- package/api/suggestions-routes.js +301 -0
- package/api/task-agent-message-routing.d.ts.map +1 -0
- package/api/terminal-execution-routing.d.ts.map +1 -0
- package/api/terminal-run-limits.d.ts.map +1 -0
- package/api/terminal-run-limits.js +20 -0
- package/api/trade-safety.d.ts +35 -0
- package/api/trade-safety.d.ts.map +1 -0
- package/api/trade-safety.js +65 -0
- package/api/training-backend-check.d.ts.map +1 -0
- package/api/training-service-like.d.ts.map +1 -0
- package/api/tx-service.d.ts +53 -0
- package/api/tx-service.d.ts.map +1 -0
- package/api/tx-service.js +217 -0
- package/api/update-routes.d.ts.map +1 -0
- package/api/update-routes.js +69 -0
- package/api/view-registry-types.d.ts +52 -0
- package/api/view-registry-types.d.ts.map +1 -0
- package/api/view-registry-types.js +9 -0
- package/api/views-registry.d.ts +90 -0
- package/api/views-registry.d.ts.map +1 -0
- package/api/views-registry.js +471 -0
- package/api/views-routes.d.ts +50 -0
- package/api/views-routes.d.ts.map +1 -0
- package/api/views-routes.js +821 -0
- package/api/views-search-index.d.ts +56 -0
- package/api/views-search-index.d.ts.map +1 -0
- package/api/views-search-index.js +128 -0
- package/api/wallet-capability.d.ts +32 -0
- package/api/wallet-capability.d.ts.map +1 -0
- package/api/wallet-capability.js +192 -0
- package/api/wallet-dex-prices.d.ts.map +1 -0
- package/api/wallet-env-sync.d.ts +2 -0
- package/api/wallet-env-sync.d.ts.map +1 -0
- package/api/wallet-evm-balance.d.ts.map +1 -0
- package/api/wallet-keygen.d.ts +5 -0
- package/api/wallet-keygen.d.ts.map +1 -0
- package/api/wallet-keygen.js +67 -0
- package/api/wallet-rpc.d.ts.map +1 -0
- package/api/wallet-rpc.js +440 -0
- package/api/wallet-trading-profile.d.ts.map +1 -0
- package/api/wallet-trading-profile.js +544 -0
- package/api/wallet.d.ts.map +1 -0
- package/api/wallet.js +786 -0
- package/api/workbench-context.d.ts +48 -0
- package/api/workbench-context.d.ts.map +1 -0
- package/api/workbench-context.js +9 -0
- package/api/workbench-helpers.d.ts.map +1 -0
- package/api/workbench-routes.d.ts +5 -0
- package/api/workbench-routes.d.ts.map +1 -0
- package/api/workbench-routes.js +283 -0
- package/api/workbench-vfs-routes.d.ts +3 -0
- package/api/workbench-vfs-routes.d.ts.map +1 -0
- package/api/workbench-vfs-routes.js +396 -0
- package/api/ws-event-replay.d.ts +64 -0
- package/api/ws-event-replay.d.ts.map +1 -0
- package/api/ws-event-replay.js +84 -0
- package/api/x-relay-routes.d.ts.map +1 -0
- package/api/x-relay-routes.js +141 -0
- package/api/zip-utils.d.ts.map +1 -0
- package/assets/view-heroes/automations.png +0 -0
- package/assets/view-heroes/camera.png +0 -0
- package/assets/view-heroes/character.png +0 -0
- package/assets/view-heroes/chat.png +0 -0
- package/assets/view-heroes/database.png +0 -0
- package/assets/view-heroes/help.png +0 -0
- package/assets/view-heroes/logs.png +0 -0
- package/assets/view-heroes/memories.png +0 -0
- package/assets/view-heroes/plugins-page.png +0 -0
- package/assets/view-heroes/settings.png +0 -0
- package/assets/view-heroes/trajectories.png +0 -0
- package/assets/view-heroes/tutorial.png +0 -0
- package/auth/account-storage.d.ts +35 -0
- package/auth/account-storage.d.ts.map +1 -0
- package/auth/account-storage.js +135 -0
- package/auth/anthropic.d.ts.map +1 -0
- package/auth/claude-code-stealth.d.ts.map +1 -0
- package/auth/claude-code-stealth.js +114 -0
- package/auth/credentials.d.ts +131 -0
- package/auth/credentials.d.ts.map +1 -0
- package/auth/credentials.js +596 -0
- package/auth/index.d.ts.map +1 -0
- package/auth/oauth-flow.d.ts +106 -0
- package/auth/oauth-flow.d.ts.map +1 -0
- package/auth/oauth-flow.js +349 -0
- package/auth/openai-codex.d.ts.map +1 -0
- package/auth/openai-codex.js +84 -0
- package/auth/refresh-mutex.d.ts +24 -0
- package/auth/refresh-mutex.d.ts.map +1 -0
- package/auth/refresh-mutex.js +38 -0
- package/auth/types.d.ts +65 -0
- package/auth/types.d.ts.map +1 -0
- package/auth/types.js +157 -0
- package/auth/vendor/pi-oauth/anthropic-login.d.ts.map +1 -0
- package/auth/vendor/pi-oauth/anthropic-login.js +118 -0
- package/auth/vendor/pi-oauth/openai-codex-login.d.ts +28 -0
- package/auth/vendor/pi-oauth/openai-codex-login.d.ts.map +1 -0
- package/auth/vendor/pi-oauth/openai-codex-login.js +342 -0
- package/auth/vendor/pi-oauth/pkce.d.ts.map +1 -0
- package/awareness/index.d.ts.map +1 -0
- package/awareness/registry.d.ts.map +1 -0
- package/bin.d.ts.map +1 -0
- package/bin.js +120 -0
- package/cli/benchmark.d.ts.map +1 -0
- package/cli/benchmark.js +305 -0
- package/cli/index.d.ts.map +1 -0
- package/cli/index.js +174 -0
- package/config/character-schema.d.ts.map +1 -0
- package/config/config.d.ts.map +1 -0
- package/config/config.js +288 -0
- package/config/env-vars.d.ts.map +1 -0
- package/config/feature-flags.d.ts +26 -0
- package/config/feature-flags.d.ts.map +1 -0
- package/config/feature-flags.js +48 -0
- package/config/includes.d.ts +26 -0
- package/config/includes.d.ts.map +1 -0
- package/config/includes.js +151 -0
- package/config/index.d.ts.map +1 -0
- package/config/model-metadata.d.ts.map +1 -0
- package/config/model-metadata.js +133 -0
- package/config/owner-contacts.d.ts.map +1 -0
- package/config/owner-contacts.js +238 -0
- package/config/paths.d.ts +16 -0
- package/config/paths.d.ts.map +1 -0
- package/config/paths.js +61 -0
- package/config/plugin-auto-enable.d.ts.map +1 -0
- package/config/plugin-widgets.d.ts +26 -0
- package/config/plugin-widgets.d.ts.map +1 -0
- package/config/plugin-widgets.js +60 -0
- package/config/schema.d.ts.map +1 -0
- package/config/schema.js +928 -0
- package/config/telegram-custom-commands.d.ts.map +1 -0
- package/config/types.agent-defaults.d.ts.map +1 -0
- package/config/types.agents.d.ts.map +1 -0
- package/config/types.d.ts.map +1 -0
- package/config/types.eliza.d.ts.map +1 -0
- package/config/types.hooks.d.ts.map +1 -0
- package/config/types.messages.d.ts.map +1 -0
- package/config/zod-schema.agent-runtime.d.ts +1166 -0
- package/config/zod-schema.agent-runtime.d.ts.map +1 -0
- package/config/zod-schema.agent-runtime.js +810 -0
- package/config/zod-schema.core.d.ts +1279 -0
- package/config/zod-schema.core.d.ts.map +1 -0
- package/config/zod-schema.core.js +761 -0
- package/config/zod-schema.d.ts +3406 -0
- package/config/zod-schema.d.ts.map +1 -0
- package/config/zod-schema.hooks.d.ts.map +1 -0
- package/config/zod-schema.js +846 -0
- package/config/zod-schema.providers-core.d.ts +2752 -0
- package/config/zod-schema.providers-core.d.ts.map +1 -0
- package/config/zod-schema.providers-core.js +969 -0
- package/config/zod-schema.session.d.ts +183 -0
- package/config/zod-schema.session.d.ts.map +1 -0
- package/contracts/awareness.d.ts.map +1 -0
- package/diagnostics/integration-observability.d.ts.map +1 -0
- package/hooks/discovery.d.ts +13 -0
- package/hooks/discovery.d.ts.map +1 -0
- package/hooks/discovery.js +191 -0
- package/hooks/eligibility.d.ts.map +1 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/loader.d.ts.map +1 -0
- package/hooks/loader.js +214 -0
- package/hooks/registry.d.ts.map +1 -0
- package/hooks/types.d.ts.map +1 -0
- package/index.d.ts +97 -0
- package/index.d.ts.map +1 -0
- package/index.js +128 -0
- package/package.json +272 -78
- package/providers/admin-panel.d.ts.map +1 -0
- package/providers/admin-trust.d.ts.map +1 -0
- package/providers/automation-terminal-bridge.d.ts.map +1 -0
- package/providers/automation-terminal-bridge.js +77 -0
- package/providers/conversation-proximity.d.ts.map +1 -0
- package/providers/escalation-trigger.d.ts.map +1 -0
- package/providers/media-provider.d.ts +234 -0
- package/providers/media-provider.d.ts.map +1 -0
- package/providers/media-provider.js +1511 -0
- package/providers/page-scoped-context.d.ts.map +1 -0
- package/providers/page-scoped-context.js +551 -0
- package/providers/pending-permissions-provider.d.ts +19 -0
- package/providers/pending-permissions-provider.d.ts.map +1 -0
- package/providers/pending-permissions-provider.js +110 -0
- package/providers/recent-conversations.d.ts.map +1 -0
- package/providers/recent-conversations.js +100 -0
- package/providers/relevant-conversations.d.ts.map +1 -0
- package/providers/relevant-conversations.js +99 -0
- package/providers/role-backfill.d.ts +18 -0
- package/providers/role-backfill.d.ts.map +1 -0
- package/providers/role-backfill.js +86 -0
- package/providers/rolodex.d.ts.map +1 -0
- package/providers/rolodex.js +90 -0
- package/providers/session-bridge.d.ts.map +1 -0
- package/providers/session-bridge.js +71 -0
- package/providers/session-utils.d.ts +14 -0
- package/providers/session-utils.d.ts.map +1 -0
- package/providers/session-utils.js +24 -0
- package/providers/skill-provider.d.ts.map +1 -0
- package/providers/tasks.d.ts.map +1 -0
- package/providers/ui-catalog.d.ts.map +1 -0
- package/providers/ui-catalog.js +132 -0
- package/providers/user-name.d.ts.map +1 -0
- package/providers/workspace-provider.d.ts.map +1 -0
- package/providers/workspace-provider.js +183 -0
- package/providers/workspace.d.ts +53 -0
- package/providers/workspace.d.ts.map +1 -0
- package/providers/workspace.js +419 -0
- package/runtime/actions/web-fetch.d.ts +28 -0
- package/runtime/actions/web-fetch.d.ts.map +1 -0
- package/runtime/actions/web-fetch.js +190 -0
- package/runtime/advanced-capabilities-config.d.ts.map +1 -0
- package/runtime/agent-event-service.d.ts.map +1 -0
- package/runtime/agent-wallets.d.ts +134 -0
- package/runtime/agent-wallets.d.ts.map +1 -0
- package/runtime/agent-wallets.js +317 -0
- package/runtime/android-app-plugins.d.ts +4 -0
- package/runtime/android-app-plugins.d.ts.map +1 -0
- package/runtime/android-app-plugins.js +40 -0
- package/runtime/boot-telemetry.d.ts +36 -0
- package/runtime/boot-telemetry.d.ts.map +1 -0
- package/runtime/boot-telemetry.js +198 -0
- package/runtime/boot-timer.d.ts +41 -0
- package/runtime/boot-timer.d.ts.map +1 -0
- package/runtime/boot-timer.js +42 -0
- package/runtime/build-character-config.d.ts.map +1 -0
- package/runtime/build-character-config.js +220 -0
- package/runtime/conversation-compactor-runtime.d.ts +164 -0
- package/runtime/conversation-compactor-runtime.d.ts.map +1 -0
- package/runtime/conversation-compactor-runtime.js +1114 -0
- package/runtime/conversation-compactor.d.ts +38 -0
- package/runtime/conversation-compactor.d.ts.map +1 -0
- package/runtime/conversation-compactor.js +1238 -0
- package/runtime/conversation-compactor.types.d.ts +102 -0
- package/runtime/conversation-compactor.types.d.ts.map +1 -0
- package/runtime/core-plugins.d.ts +142 -0
- package/runtime/core-plugins.d.ts.map +1 -0
- package/runtime/core-plugins.js +257 -0
- package/runtime/custom-actions.d.ts +71 -0
- package/runtime/custom-actions.d.ts.map +1 -0
- package/runtime/custom-actions.js +611 -0
- package/runtime/default-documents.d.ts +21 -0
- package/runtime/default-documents.d.ts.map +1 -0
- package/runtime/default-documents.js +283 -0
- package/runtime/eliza-plugin.d.ts.map +1 -0
- package/runtime/eliza-plugin.js +204 -0
- package/runtime/eliza.d.ts +136 -0
- package/runtime/eliza.d.ts.map +1 -0
- package/runtime/eliza.js +4331 -0
- package/runtime/first-run-names.d.ts +20 -0
- package/runtime/first-run-names.d.ts.map +1 -0
- package/runtime/first-run-names.js +104 -0
- package/runtime/first-time-setup.d.ts +51 -0
- package/runtime/first-time-setup.d.ts.map +1 -0
- package/runtime/first-time-setup.js +716 -0
- package/runtime/index.d.ts +19 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +18 -0
- package/runtime/load-plugin-from-directory.d.ts +59 -0
- package/runtime/load-plugin-from-directory.d.ts.map +1 -0
- package/runtime/load-plugin-from-directory.js +143 -0
- package/runtime/load-plugin-from-vfs.d.ts +68 -0
- package/runtime/load-plugin-from-vfs.d.ts.map +1 -0
- package/runtime/load-plugin-from-vfs.js +100 -0
- package/runtime/local-execution-mode.d.ts +11 -0
- package/runtime/local-execution-mode.d.ts.map +1 -0
- package/runtime/mobile-dns.d.ts +18 -0
- package/runtime/mobile-dns.d.ts.map +1 -0
- package/runtime/mobile-dns.js +258 -0
- package/runtime/model-resolution.d.ts.map +1 -0
- package/runtime/model-resolution.js +55 -0
- package/runtime/native-runtime-features.d.ts.map +1 -0
- package/runtime/operations/classifier.d.ts.map +1 -0
- package/runtime/operations/classifier.js +72 -0
- package/runtime/operations/cold-strategy.d.ts.map +1 -0
- package/runtime/operations/health-checks.d.ts.map +1 -0
- package/runtime/operations/health.d.ts.map +1 -0
- package/runtime/operations/index.d.ts.map +1 -0
- package/runtime/operations/manager.d.ts +70 -0
- package/runtime/operations/manager.d.ts.map +1 -0
- package/runtime/operations/manager.js +210 -0
- package/runtime/operations/reload-hot.d.ts +43 -0
- package/runtime/operations/reload-hot.d.ts.map +1 -0
- package/runtime/operations/reload-hot.js +181 -0
- package/runtime/operations/repository.d.ts.map +1 -0
- package/runtime/operations/types.d.ts.map +1 -0
- package/runtime/operations/vault-bridge.d.ts +81 -0
- package/runtime/operations/vault-bridge.d.ts.map +1 -0
- package/runtime/owner-entity.d.ts.map +1 -0
- package/runtime/owner-entity.js +34 -0
- package/runtime/pglite-error-compat.d.ts +27 -0
- package/runtime/pglite-error-compat.d.ts.map +1 -0
- package/runtime/pglite-error-compat.js +53 -0
- package/runtime/plugin-collector.d.ts.map +1 -0
- package/runtime/plugin-collector.js +604 -0
- package/runtime/plugin-lifecycle.d.ts +16 -0
- package/runtime/plugin-lifecycle.d.ts.map +1 -0
- package/runtime/plugin-lifecycle.js +653 -0
- package/runtime/plugin-resolver.d.ts +59 -0
- package/runtime/plugin-resolver.d.ts.map +1 -0
- package/runtime/plugin-resolver.js +1549 -0
- package/runtime/plugin-role-gating.d.ts +23 -0
- package/runtime/plugin-role-gating.d.ts.map +1 -0
- package/runtime/plugin-role-gating.js +172 -0
- package/runtime/plugin-types.d.ts +64 -0
- package/runtime/plugin-types.d.ts.map +1 -0
- package/runtime/plugin-types.js +310 -0
- package/runtime/prompt-compaction.d.ts +100 -0
- package/runtime/prompt-compaction.d.ts.map +1 -0
- package/runtime/prompt-compaction.js +395 -0
- package/runtime/prompt-optimization.d.ts +50 -0
- package/runtime/prompt-optimization.d.ts.map +1 -0
- package/runtime/prompt-optimization.js +1243 -0
- package/runtime/release-plugin-policy.d.ts.map +1 -0
- package/runtime/release-plugin-policy.js +115 -0
- package/runtime/restart.d.ts +9 -0
- package/runtime/restart.d.ts.map +1 -0
- package/runtime/restart.js +8 -0
- package/runtime/roles/src/index.d.ts.map +1 -0
- package/runtime/roles/src/index.js +279 -0
- package/runtime/roles/src/provider.d.ts.map +1 -0
- package/runtime/roles/src/types.d.ts.map +1 -0
- package/runtime/roles/src/utils.d.ts.map +1 -0
- package/runtime/roles.d.ts.map +1 -0
- package/runtime/sandbox-character.d.ts +61 -0
- package/runtime/sandbox-character.d.ts.map +1 -0
- package/runtime/sandbox-character.js +193 -0
- package/runtime/sandbox-registry.d.ts +96 -0
- package/runtime/sandbox-registry.d.ts.map +1 -0
- package/runtime/sandbox-registry.js +346 -0
- package/runtime/tool-call-cache/cache.d.ts +62 -0
- package/runtime/tool-call-cache/cache.d.ts.map +1 -0
- package/runtime/tool-call-cache/cache.js +123 -0
- package/runtime/tool-call-cache/disk-store.d.ts.map +1 -0
- package/runtime/tool-call-cache/index.d.ts +7 -0
- package/runtime/tool-call-cache/index.d.ts.map +1 -0
- package/runtime/tool-call-cache/index.js +4 -0
- package/runtime/tool-call-cache/key.d.ts.map +1 -0
- package/runtime/tool-call-cache/key.js +31 -0
- package/runtime/tool-call-cache/lru.d.ts.map +1 -0
- package/runtime/tool-call-cache/redact.d.ts +17 -0
- package/runtime/tool-call-cache/redact.d.ts.map +1 -0
- package/runtime/tool-call-cache/redact.js +77 -0
- package/runtime/tool-call-cache/registry.d.ts +18 -0
- package/runtime/tool-call-cache/registry.d.ts.map +1 -0
- package/runtime/tool-call-cache/registry.js +66 -0
- package/runtime/tool-call-cache/types.d.ts.map +1 -0
- package/runtime/tool-call-cache-wrapper.d.ts.map +1 -0
- package/runtime/trajectory-export.d.ts.map +1 -0
- package/runtime/trajectory-export.js +132 -0
- package/runtime/trajectory-internals.d.ts +263 -0
- package/runtime/trajectory-internals.d.ts.map +1 -0
- package/runtime/trajectory-internals.js +1720 -0
- package/runtime/trajectory-persistence.d.ts +30 -0
- package/runtime/trajectory-persistence.d.ts.map +1 -0
- package/runtime/trajectory-persistence.js +47 -0
- package/runtime/trajectory-query.d.ts.map +1 -0
- package/runtime/trajectory-query.js +29 -0
- package/runtime/trajectory-steps-reader.d.ts +41 -0
- package/runtime/trajectory-steps-reader.d.ts.map +1 -0
- package/runtime/trajectory-steps-reader.js +129 -0
- package/runtime/trajectory-steps-writer.d.ts +35 -0
- package/runtime/trajectory-steps-writer.d.ts.map +1 -0
- package/runtime/trajectory-steps-writer.js +135 -0
- package/runtime/trajectory-storage.d.ts +103 -0
- package/runtime/trajectory-storage.d.ts.map +1 -0
- package/runtime/trajectory-storage.js +1174 -0
- package/runtime/vault-profile-resolver.d.ts +37 -0
- package/runtime/vault-profile-resolver.d.ts.map +1 -0
- package/runtime/vault-profile-resolver.js +79 -0
- package/runtime/version.d.ts.map +1 -0
- package/runtime/view-action-affinity.d.ts +129 -0
- package/runtime/view-action-affinity.d.ts.map +1 -0
- package/runtime/view-action-affinity.js +211 -0
- package/runtime/web-search-tools.d.ts +31 -0
- package/runtime/web-search-tools.d.ts.map +1 -0
- package/runtime/web-search-tools.js +170 -0
- package/security/access.d.ts.map +1 -0
- package/security/access.js +56 -0
- package/security/audit-log.d.ts.map +1 -0
- package/security/audit-log.js +165 -0
- package/security/index.d.ts.map +1 -0
- package/security/mcp-server-config.d.ts +6 -0
- package/security/mcp-server-config.d.ts.map +1 -0
- package/security/mcp-server-config.js +358 -0
- package/security/network-policy.d.ts.map +1 -0
- package/services/agent-export.d.ts +100 -0
- package/services/agent-export.d.ts.map +1 -0
- package/services/agent-export.js +767 -0
- package/services/app-manager-agents-list-guard.d.ts.map +1 -0
- package/services/app-package-modules.d.ts +26 -0
- package/services/app-package-modules.d.ts.map +1 -0
- package/services/app-package-modules.js +451 -0
- package/services/app-session-gate.d.ts.map +1 -0
- package/services/app-session-gate.js +71 -0
- package/services/capability-broker.d.ts.map +1 -0
- package/services/capability-broker.js +339 -0
- package/services/character-history.d.ts.map +1 -0
- package/services/character-persistence.d.ts.map +1 -0
- package/services/client-chat-sender.d.ts.map +1 -0
- package/services/client-chat-sender.js +88 -0
- package/services/config-plugin-manager.d.ts.map +1 -0
- package/services/connector-setup-service.d.ts.map +1 -0
- package/services/cove-quote-x509.d.ts +143 -0
- package/services/cove-quote-x509.d.ts.map +1 -0
- package/services/cove-quote-x509.js +424 -0
- package/services/cove-quote.d.ts +189 -0
- package/services/cove-quote.d.ts.map +1 -0
- package/services/cove-quote.js +455 -0
- package/services/dstack-tee-provider.d.ts +57 -0
- package/services/dstack-tee-provider.d.ts.map +1 -0
- package/services/dstack-tee-provider.js +180 -0
- package/services/e2b-capability-router.d.ts +139 -0
- package/services/e2b-capability-router.d.ts.map +1 -0
- package/services/e2b-capability-router.js +1239 -0
- package/services/escalation.d.ts.map +1 -0
- package/services/escalation.js +378 -0
- package/services/evm-signing-capability.d.ts +33 -0
- package/services/evm-signing-capability.d.ts.map +1 -0
- package/services/evm-signing-capability.js +52 -0
- package/services/external-bridge-state.d.ts +11 -0
- package/services/external-bridge-state.d.ts.map +1 -0
- package/services/external-bridge-state.js +15 -0
- package/services/hosted-tools.d.ts +77 -0
- package/services/hosted-tools.d.ts.map +1 -0
- package/services/hosted-tools.js +87 -0
- package/services/index.d.ts +32 -0
- package/services/index.d.ts.map +1 -0
- package/services/index.js +40 -0
- package/services/js-runtime-bridge.d.ts.map +1 -0
- package/services/js-runtime-bridge.js +216 -0
- package/services/knowledge-graph/entity-store.d.ts +94 -0
- package/services/knowledge-graph/entity-store.d.ts.map +1 -0
- package/services/knowledge-graph/entity-store.js +509 -0
- package/services/knowledge-graph/index.d.ts +12 -0
- package/services/knowledge-graph/index.d.ts.map +1 -0
- package/services/knowledge-graph/index.js +11 -0
- package/services/knowledge-graph/relationship-store.d.ts +58 -0
- package/services/knowledge-graph/relationship-store.d.ts.map +1 -0
- package/services/knowledge-graph/relationship-store.js +303 -0
- package/services/knowledge-graph/schema.d.ts +2070 -0
- package/services/knowledge-graph/schema.d.ts.map +1 -0
- package/services/knowledge-graph/schema.js +119 -0
- package/services/knowledge-graph/service.d.ts +35 -0
- package/services/knowledge-graph/service.d.ts.map +1 -0
- package/services/knowledge-graph/service.js +42 -0
- package/services/knowledge-graph/sql.d.ts +22 -0
- package/services/knowledge-graph/sql.d.ts.map +1 -0
- package/services/knowledge-graph/sql.js +142 -0
- package/services/mcp-marketplace.d.ts.map +1 -0
- package/services/mcp-marketplace.js +200 -0
- package/services/media-generation.d.ts +10 -0
- package/services/media-generation.d.ts.map +1 -0
- package/services/media-generation.js +102 -0
- package/services/overlay-app-presence.d.ts.map +1 -0
- package/services/owner-name.d.ts.map +1 -0
- package/services/permissions/contracts.d.ts +2 -0
- package/services/permissions/contracts.d.ts.map +1 -0
- package/services/permissions/contracts.js +1 -0
- package/services/permissions/probers/_bridge.d.ts +112 -0
- package/services/permissions/probers/_bridge.d.ts.map +1 -0
- package/services/permissions/probers/_bridge.js +313 -0
- package/services/permissions/probers/accessibility.d.ts.map +1 -0
- package/services/permissions/probers/automation.d.ts +17 -0
- package/services/permissions/probers/automation.d.ts.map +1 -0
- package/services/permissions/probers/automation.js +44 -0
- package/services/permissions/probers/calendar.d.ts +6 -0
- package/services/permissions/probers/calendar.d.ts.map +1 -0
- package/services/permissions/probers/calendar.js +42 -0
- package/services/permissions/probers/camera.d.ts.map +1 -0
- package/services/permissions/probers/contacts.d.ts +9 -0
- package/services/permissions/probers/contacts.d.ts.map +1 -0
- package/services/permissions/probers/contacts.js +44 -0
- package/services/permissions/probers/full-disk.d.ts.map +1 -0
- package/services/permissions/probers/health.d.ts +23 -0
- package/services/permissions/probers/health.d.ts.map +1 -0
- package/services/permissions/probers/health.js +60 -0
- package/services/permissions/probers/index.d.ts.map +1 -0
- package/services/permissions/probers/index.js +44 -0
- package/services/permissions/probers/location.d.ts +13 -0
- package/services/permissions/probers/location.d.ts.map +1 -0
- package/services/permissions/probers/location.js +54 -0
- package/services/permissions/probers/microphone.d.ts.map +1 -0
- package/services/permissions/probers/native-platform.d.ts +3 -0
- package/services/permissions/probers/native-platform.d.ts.map +1 -0
- package/services/permissions/probers/native-platform.js +27 -0
- package/services/permissions/probers/notes.d.ts +18 -0
- package/services/permissions/probers/notes.d.ts.map +1 -0
- package/services/permissions/probers/notes.js +44 -0
- package/services/permissions/probers/notifications.d.ts +18 -0
- package/services/permissions/probers/notifications.d.ts.map +1 -0
- package/services/permissions/probers/notifications.js +53 -0
- package/services/permissions/probers/reminders.d.ts +9 -0
- package/services/permissions/probers/reminders.d.ts.map +1 -0
- package/services/permissions/probers/reminders.js +44 -0
- package/services/permissions/probers/screen-recording.d.ts.map +1 -0
- package/services/permissions/probers/screentime.d.ts +21 -0
- package/services/permissions/probers/screentime.d.ts.map +1 -0
- package/services/permissions/probers/screentime.js +55 -0
- package/services/permissions/probers/shell.d.ts +16 -0
- package/services/permissions/probers/shell.d.ts.map +1 -0
- package/services/permissions/probers/shell.js +28 -0
- package/services/permissions/probers/website-blocking.d.ts.map +1 -0
- package/services/permissions/register-probers.d.ts +13 -0
- package/services/permissions/register-probers.d.ts.map +1 -0
- package/services/permissions/register-probers.js +15 -0
- package/services/permissions-registry.d.ts.map +1 -0
- package/services/permissions-registry.js +209 -0
- package/services/plugin-compiler.d.ts.map +1 -0
- package/services/plugin-compiler.js +168 -0
- package/services/plugin-installer.d.ts +93 -0
- package/services/plugin-installer.d.ts.map +1 -0
- package/services/plugin-installer.js +653 -0
- package/services/plugin-manager-types.d.ts.map +1 -0
- package/services/push/apns-provider.d.ts +58 -0
- package/services/push/apns-provider.d.ts.map +1 -0
- package/services/push/apns-provider.js +186 -0
- package/services/push/fcm-provider.d.ts +49 -0
- package/services/push/fcm-provider.d.ts.map +1 -0
- package/services/push/fcm-provider.js +206 -0
- package/services/push/notification-push-service.d.ts +58 -0
- package/services/push/notification-push-service.d.ts.map +1 -0
- package/services/push/notification-push-service.js +148 -0
- package/services/push/push-token-registry.d.ts +49 -0
- package/services/push/push-token-registry.d.ts.map +1 -0
- package/services/push/push-token-registry.js +91 -0
- package/services/push/push-types.d.ts +41 -0
- package/services/push/push-types.d.ts.map +1 -0
- package/services/push/push-types.js +16 -0
- package/services/registry-client-app-meta.d.ts.map +1 -0
- package/services/registry-client-app-meta.js +153 -0
- package/services/registry-client-endpoints.d.ts.map +1 -0
- package/services/registry-client-endpoints.js +199 -0
- package/services/registry-client-local.d.ts.map +1 -0
- package/services/registry-client-local.js +563 -0
- package/services/registry-client-network.d.ts +27 -0
- package/services/registry-client-network.d.ts.map +1 -0
- package/services/registry-client-network.js +211 -0
- package/services/registry-client-queries.d.ts.map +1 -0
- package/services/registry-client-queries.js +216 -0
- package/services/registry-client-types.d.ts +133 -0
- package/services/registry-client-types.d.ts.map +1 -0
- package/services/registry-client-types.js +1 -0
- package/services/registry-client.d.ts +39 -0
- package/services/registry-client.d.ts.map +1 -0
- package/services/registry-client.js +292 -0
- package/services/relationships-graph.d.ts +13 -0
- package/services/relationships-graph.d.ts.map +1 -0
- package/services/relationships-graph.js +48 -0
- package/services/remote-capability-cloud-sandbox.d.ts +45 -0
- package/services/remote-capability-cloud-sandbox.d.ts.map +1 -0
- package/services/remote-capability-cloud-sandbox.js +253 -0
- package/services/remote-capability-endpoint-conformance.d.ts +60 -0
- package/services/remote-capability-endpoint-conformance.d.ts.map +1 -0
- package/services/remote-capability-endpoint-conformance.js +819 -0
- package/services/remote-capability-endpoint-provider.d.ts +54 -0
- package/services/remote-capability-endpoint-provider.d.ts.map +1 -0
- package/services/remote-capability-endpoint-provider.js +255 -0
- package/services/remote-capability-live-report.d.ts +19 -0
- package/services/remote-capability-live-report.d.ts.map +1 -0
- package/services/remote-capability-live-report.js +147 -0
- package/services/remote-capability-router.d.ts +49 -0
- package/services/remote-capability-router.d.ts.map +1 -0
- package/services/remote-capability-router.js +784 -0
- package/services/remote-capability-url-endpoint-providers.d.ts +17 -0
- package/services/remote-capability-url-endpoint-providers.d.ts.map +1 -0
- package/services/remote-capability-url-endpoint-providers.js +69 -0
- package/services/remote-plugin-adapter.d.ts +42 -0
- package/services/remote-plugin-adapter.d.ts.map +1 -0
- package/services/remote-plugin-adapter.js +1731 -0
- package/services/remote-plugin-bridge.d.ts +81 -0
- package/services/remote-plugin-bridge.d.ts.map +1 -0
- package/services/remote-plugin-bridge.js +598 -0
- package/services/remote-signing-service.d.ts +110 -0
- package/services/remote-signing-service.d.ts.map +1 -0
- package/services/remote-signing-service.js +264 -0
- package/services/research-task-executor.d.ts.map +1 -0
- package/services/research-task-executor.js +133 -0
- package/services/sandbox-engine.d.ts.map +1 -0
- package/services/sandbox-manager.d.ts +132 -0
- package/services/sandbox-manager.d.ts.map +1 -0
- package/services/sandbox-manager.js +440 -0
- package/services/self-updater.d.ts +38 -0
- package/services/self-updater.d.ts.map +1 -0
- package/services/self-updater.js +248 -0
- package/services/send-handler-availability.d.ts.map +1 -0
- package/services/send-handler-availability.js +23 -0
- package/services/shell-execution-router.d.ts +69 -0
- package/services/shell-execution-router.d.ts.map +1 -0
- package/services/shell-execution-router.js +329 -0
- package/services/signing-policy.d.ts +46 -0
- package/services/signing-policy.d.ts.map +1 -0
- package/services/task-executor.d.ts.map +1 -0
- package/services/tee-boot-gate-state.d.ts +29 -0
- package/services/tee-boot-gate-state.d.ts.map +1 -0
- package/services/tee-boot-gate-state.js +38 -0
- package/services/tee-boot-gate.d.ts +45 -0
- package/services/tee-boot-gate.d.ts.map +1 -0
- package/services/tee-boot-gate.js +80 -0
- package/services/tee-confidential-inference.d.ts +177 -0
- package/services/tee-confidential-inference.d.ts.map +1 -0
- package/services/tee-confidential-inference.js +254 -0
- package/services/tee-evidence.d.ts +46 -0
- package/services/tee-evidence.d.ts.map +1 -0
- package/services/tee-evidence.js +149 -0
- package/services/tee-key-release.d.ts +100 -0
- package/services/tee-key-release.d.ts.map +1 -0
- package/services/tee-key-release.js +301 -0
- package/services/tee-model-key-boot.d.ts +82 -0
- package/services/tee-model-key-boot.d.ts.map +1 -0
- package/services/tee-model-key-boot.js +99 -0
- package/services/tee-policy.d.ts +31 -0
- package/services/tee-policy.d.ts.map +1 -0
- package/services/tee-policy.js +233 -0
- package/services/tee-production-profile.d.ts +35 -0
- package/services/tee-production-profile.d.ts.map +1 -0
- package/services/tee-production-profile.js +64 -0
- package/services/tee-release-policy.d.ts +18 -0
- package/services/tee-release-policy.d.ts.map +1 -0
- package/services/tee-release-policy.js +53 -0
- package/services/tee-revocation.d.ts +60 -0
- package/services/tee-revocation.d.ts.map +1 -0
- package/services/tee-revocation.js +150 -0
- package/services/tee-runtime-config.d.ts +9 -0
- package/services/tee-runtime-config.d.ts.map +1 -0
- package/services/tee-runtime-config.js +109 -0
- package/services/tee-sealed-volume.d.ts +114 -0
- package/services/tee-sealed-volume.d.ts.map +1 -0
- package/services/tee-sealed-volume.js +161 -0
- package/services/tee-signer-backend.d.ts +18 -0
- package/services/tee-signer-backend.d.ts.map +1 -0
- package/services/tee-signer-backend.js +26 -0
- package/services/update-checker.d.ts.map +1 -0
- package/services/vault-signer-backend.d.ts +32 -0
- package/services/vault-signer-backend.d.ts.map +1 -0
- package/services/vault-signer-backend.js +57 -0
- package/services/version-compat.d.ts.map +1 -0
- package/services/version-compat.js +212 -0
- package/services/vfs-builtin-shell.d.ts +17 -0
- package/services/vfs-builtin-shell.d.ts.map +1 -0
- package/services/vfs-builtin-shell.js +375 -0
- package/services/vfs-git.d.ts +18 -0
- package/services/vfs-git.d.ts.map +1 -0
- package/services/vfs-git.js +315 -0
- package/services/virtual-filesystem.d.ts +100 -0
- package/services/virtual-filesystem.d.ts.map +1 -0
- package/services/virtual-filesystem.js +482 -0
- package/shared/conversation-format.d.ts.map +1 -0
- package/shared/conversation-format.js +69 -0
- package/shared/ui-catalog-prompt.d.ts.map +1 -0
- package/shared/workspace-resolution.d.ts.map +1 -0
- package/shared/workspace-resolution.js +82 -0
- package/test-support/index.d.ts.map +1 -0
- package/test-support/process-helpers.d.ts.map +1 -0
- package/test-support/route-test-helpers.d.ts.map +1 -0
- package/test-support/test-helpers.d.ts.map +1 -0
- package/test-utils/sqlite-compat.d.ts.map +1 -0
- package/test-utils/sqlite-compat.js +214 -0
- package/triggers/runtime.d.ts.map +1 -0
- package/triggers/runtime.js +482 -0
- package/triggers/scheduling.d.ts +78 -0
- package/triggers/scheduling.d.ts.map +1 -0
- package/triggers/scheduling.js +420 -0
- package/triggers/types.d.ts +30 -0
- package/triggers/types.d.ts.map +1 -0
- package/tui/agent-terminal-tui.d.ts +14 -0
- package/tui/agent-terminal-tui.d.ts.map +1 -0
- package/tui/agent-terminal-tui.js +416 -0
- package/tui/slash-commands.d.ts +107 -0
- package/tui/slash-commands.d.ts.map +1 -0
- package/tui/slash-commands.js +108 -0
- package/tui/tui-enabled.d.ts +8 -0
- package/tui/tui-enabled.d.ts.map +1 -0
- package/tui/tui-enabled.js +17 -0
- package/types/agent-skills.d.ts.map +1 -0
- package/types/config-like.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/trajectory.d.ts +21 -0
- package/types/trajectory.d.ts.map +1 -0
- package/utils/atomic-json.d.ts.map +1 -0
- package/utils/terminal-command.d.ts +10 -0
- package/utils/terminal-command.d.ts.map +1 -0
- package/utils/terminal-command.js +19 -0
- package/version-resolver.d.ts.map +1 -0
- package/packages/agent/src/actions/connector-resolver.d.ts.map +0 -1
- package/packages/agent/src/actions/connector-resolver.js +0 -253
- package/packages/agent/src/actions/contact.d.ts.map +0 -1
- package/packages/agent/src/actions/contact.js +0 -1698
- package/packages/agent/src/actions/context-signal-lexicon.d.ts.map +0 -1
- package/packages/agent/src/actions/context-signal.d.ts.map +0 -1
- package/packages/agent/src/actions/context-signal.js +0 -153
- package/packages/agent/src/actions/database.d.ts.map +0 -1
- package/packages/agent/src/actions/database.js +0 -671
- package/packages/agent/src/actions/extract-page.d.ts +0 -3
- package/packages/agent/src/actions/extract-page.d.ts.map +0 -1
- package/packages/agent/src/actions/extract-page.js +0 -153
- package/packages/agent/src/actions/extract-params.d.ts +0 -87
- package/packages/agent/src/actions/extract-params.d.ts.map +0 -1
- package/packages/agent/src/actions/extract-params.js +0 -187
- package/packages/agent/src/actions/grounded-action-reply.d.ts.map +0 -1
- package/packages/agent/src/actions/grounded-action-reply.js +0 -287
- package/packages/agent/src/actions/index.d.ts +0 -22
- package/packages/agent/src/actions/index.d.ts.map +0 -1
- package/packages/agent/src/actions/index.js +0 -21
- package/packages/agent/src/actions/logs.d.ts.map +0 -1
- package/packages/agent/src/actions/media.d.ts +0 -9
- package/packages/agent/src/actions/media.d.ts.map +0 -1
- package/packages/agent/src/actions/media.js +0 -135
- package/packages/agent/src/actions/memories.d.ts +0 -9
- package/packages/agent/src/actions/memories.d.ts.map +0 -1
- package/packages/agent/src/actions/memories.js +0 -369
- package/packages/agent/src/actions/page-action-groups.d.ts +0 -17
- package/packages/agent/src/actions/page-action-groups.d.ts.map +0 -1
- package/packages/agent/src/actions/page-action-groups.js +0 -413
- package/packages/agent/src/actions/plugin.d.ts +0 -32
- package/packages/agent/src/actions/plugin.d.ts.map +0 -1
- package/packages/agent/src/actions/plugin.js +0 -780
- package/packages/agent/src/actions/recent-conversation-texts.d.ts.map +0 -1
- package/packages/agent/src/actions/recent-conversation-texts.js +0 -76
- package/packages/agent/src/actions/runtime.d.ts.map +0 -1
- package/packages/agent/src/actions/runtime.js +0 -517
- package/packages/agent/src/actions/settings-actions.d.ts +0 -19
- package/packages/agent/src/actions/settings-actions.d.ts.map +0 -1
- package/packages/agent/src/actions/settings-actions.js +0 -478
- package/packages/agent/src/actions/skill-command.d.ts +0 -20
- package/packages/agent/src/actions/skill-command.d.ts.map +0 -1
- package/packages/agent/src/actions/skill-command.js +0 -170
- package/packages/agent/src/actions/stream-control.d.ts +0 -20
- package/packages/agent/src/actions/stream-control.d.ts.map +0 -1
- package/packages/agent/src/actions/stream-control.js +0 -166
- package/packages/agent/src/actions/terminal.d.ts.map +0 -1
- package/packages/agent/src/actions/terminal.js +0 -305
- package/packages/agent/src/actions/trajectories.d.ts +0 -8
- package/packages/agent/src/actions/trajectories.d.ts.map +0 -1
- package/packages/agent/src/actions/trajectories.js +0 -135
- package/packages/agent/src/actions/trigger.d.ts.map +0 -1
- package/packages/agent/src/actions/trigger.js +0 -514
- package/packages/agent/src/api/accounts-routes.d.ts +0 -38
- package/packages/agent/src/api/accounts-routes.d.ts.map +0 -1
- package/packages/agent/src/api/accounts-routes.js +0 -927
- package/packages/agent/src/api/agent-admin-routes.d.ts +0 -39
- package/packages/agent/src/api/agent-admin-routes.d.ts.map +0 -1
- package/packages/agent/src/api/agent-admin-routes.js +0 -190
- package/packages/agent/src/api/agent-lifecycle-routes.d.ts.map +0 -1
- package/packages/agent/src/api/agent-lifecycle-routes.js +0 -101
- package/packages/agent/src/api/agent-model.d.ts.map +0 -1
- package/packages/agent/src/api/agent-model.js +0 -170
- package/packages/agent/src/api/agent-status-routes.d.ts.map +0 -1
- package/packages/agent/src/api/agent-status-routes.js +0 -264
- package/packages/agent/src/api/agent-transfer-routes.d.ts.map +0 -1
- package/packages/agent/src/api/agent-transfer-routes.js +0 -124
- package/packages/agent/src/api/app-package-routes.d.ts +0 -7
- package/packages/agent/src/api/app-package-routes.d.ts.map +0 -1
- package/packages/agent/src/api/app-package-routes.js +0 -59
- package/packages/agent/src/api/apps-routes.d.ts +0 -32
- package/packages/agent/src/api/apps-routes.d.ts.map +0 -1
- package/packages/agent/src/api/apps-routes.js +0 -998
- package/packages/agent/src/api/auth-routes.d.ts.map +0 -1
- package/packages/agent/src/api/auth-routes.js +0 -119
- package/packages/agent/src/api/avatar-routes.d.ts.map +0 -1
- package/packages/agent/src/api/avatar-routes.js +0 -205
- package/packages/agent/src/api/binance-skill-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/binance-skill-helpers.js +0 -745
- package/packages/agent/src/api/bug-report-routes.d.ts +0 -10
- package/packages/agent/src/api/bug-report-routes.d.ts.map +0 -1
- package/packages/agent/src/api/bug-report-routes.js +0 -271
- package/packages/agent/src/api/build-variant-routes.d.ts +0 -27
- package/packages/agent/src/api/build-variant-routes.d.ts.map +0 -1
- package/packages/agent/src/api/build-variant-routes.js +0 -27
- package/packages/agent/src/api/character-routes.d.ts.map +0 -1
- package/packages/agent/src/api/character-routes.js +0 -377
- package/packages/agent/src/api/chat-augmentation.d.ts +0 -70
- package/packages/agent/src/api/chat-augmentation.d.ts.map +0 -1
- package/packages/agent/src/api/chat-augmentation.js +0 -464
- package/packages/agent/src/api/chat-routes.d.ts +0 -124
- package/packages/agent/src/api/chat-routes.d.ts.map +0 -1
- package/packages/agent/src/api/chat-routes.js +0 -1841
- package/packages/agent/src/api/chat-text-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/client-chat-admin.d.ts.map +0 -1
- package/packages/agent/src/api/cloud-route-registry.d.ts +0 -22
- package/packages/agent/src/api/cloud-route-registry.d.ts.map +0 -1
- package/packages/agent/src/api/cloud-route-registry.js +0 -20
- package/packages/agent/src/api/compat-utils.d.ts.map +0 -1
- package/packages/agent/src/api/config-env.d.ts.map +0 -1
- package/packages/agent/src/api/config-env.js +0 -284
- package/packages/agent/src/api/config-routes.d.ts.map +0 -1
- package/packages/agent/src/api/config-routes.js +0 -429
- package/packages/agent/src/api/connector-account-routes.d.ts.map +0 -1
- package/packages/agent/src/api/connector-account-routes.js +0 -740
- package/packages/agent/src/api/connector-health.d.ts.map +0 -1
- package/packages/agent/src/api/connector-oauth-callback-auth.d.ts.map +0 -1
- package/packages/agent/src/api/connector-routes.d.ts.map +0 -1
- package/packages/agent/src/api/connector-routes.js +0 -184
- package/packages/agent/src/api/conversation-metadata.d.ts.map +0 -1
- package/packages/agent/src/api/conversation-metadata.js +0 -107
- package/packages/agent/src/api/conversation-routes.d.ts +0 -43
- package/packages/agent/src/api/conversation-routes.d.ts.map +0 -1
- package/packages/agent/src/api/conversation-routes.js +0 -1208
- package/packages/agent/src/api/coordinator-wiring.d.ts.map +0 -1
- package/packages/agent/src/api/coordinator-wiring.js +0 -108
- package/packages/agent/src/api/credit-detection.d.ts.map +0 -1
- package/packages/agent/src/api/credit-detection.js +0 -47
- package/packages/agent/src/api/curated-skills-routes.d.ts +0 -22
- package/packages/agent/src/api/curated-skills-routes.d.ts.map +0 -1
- package/packages/agent/src/api/curated-skills-routes.js +0 -295
- package/packages/agent/src/api/database.d.ts +0 -35
- package/packages/agent/src/api/database.d.ts.map +0 -1
- package/packages/agent/src/api/database.js +0 -1140
- package/packages/agent/src/api/diagnostics-routes.d.ts +0 -59
- package/packages/agent/src/api/diagnostics-routes.d.ts.map +0 -1
- package/packages/agent/src/api/diagnostics-routes.js +0 -365
- package/packages/agent/src/api/documents-routes.d.ts +0 -9
- package/packages/agent/src/api/documents-routes.d.ts.map +0 -1
- package/packages/agent/src/api/documents-routes.js +0 -26
- package/packages/agent/src/api/documents-service-loader.d.ts.map +0 -1
- package/packages/agent/src/api/early-logs.d.ts +0 -29
- package/packages/agent/src/api/early-logs.d.ts.map +0 -1
- package/packages/agent/src/api/health-routes.d.ts +0 -46
- package/packages/agent/src/api/health-routes.d.ts.map +0 -1
- package/packages/agent/src/api/health-routes.js +0 -450
- package/packages/agent/src/api/inbox-routes.d.ts.map +0 -1
- package/packages/agent/src/api/inbox-routes.js +0 -1579
- package/packages/agent/src/api/index.d.ts +0 -46
- package/packages/agent/src/api/index.d.ts.map +0 -1
- package/packages/agent/src/api/index.js +0 -49
- package/packages/agent/src/api/memory-bounds.d.ts.map +0 -1
- package/packages/agent/src/api/memory-routes.d.ts.map +0 -1
- package/packages/agent/src/api/memory-routes.js +0 -474
- package/packages/agent/src/api/misc-routes.d.ts.map +0 -1
- package/packages/agent/src/api/misc-routes.js +0 -569
- package/packages/agent/src/api/mobile-optional-routes.d.ts.map +0 -1
- package/packages/agent/src/api/mobile-optional-routes.js +0 -91
- package/packages/agent/src/api/model-provider-helpers.d.ts +0 -68
- package/packages/agent/src/api/model-provider-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/model-provider-helpers.js +0 -623
- package/packages/agent/src/api/models-routes.d.ts.map +0 -1
- package/packages/agent/src/api/music-player-route-fallback.d.ts.map +0 -1
- package/packages/agent/src/api/nfa-routes.d.ts +0 -6
- package/packages/agent/src/api/nfa-routes.d.ts.map +0 -1
- package/packages/agent/src/api/nfa-routes.js +0 -125
- package/packages/agent/src/api/onboarding-routes.d.ts +0 -50
- package/packages/agent/src/api/onboarding-routes.d.ts.map +0 -1
- package/packages/agent/src/api/onboarding-routes.js +0 -588
- package/packages/agent/src/api/owner-contact-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/parse-action-block.d.ts +0 -53
- package/packages/agent/src/api/parse-action-block.d.ts.map +0 -1
- package/packages/agent/src/api/permission-request-prompt.d.ts +0 -19
- package/packages/agent/src/api/permission-request-prompt.d.ts.map +0 -1
- package/packages/agent/src/api/permission-request-prompt.js +0 -53
- package/packages/agent/src/api/permissions-routes-extra.d.ts +0 -30
- package/packages/agent/src/api/permissions-routes-extra.d.ts.map +0 -1
- package/packages/agent/src/api/permissions-routes.d.ts.map +0 -1
- package/packages/agent/src/api/permissions-routes.js +0 -352
- package/packages/agent/src/api/plugin-discovery-helpers.d.ts +0 -147
- package/packages/agent/src/api/plugin-discovery-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/plugin-discovery-helpers.js +0 -1118
- package/packages/agent/src/api/plugin-routes.d.ts +0 -144
- package/packages/agent/src/api/plugin-routes.d.ts.map +0 -1
- package/packages/agent/src/api/plugin-routes.js +0 -1285
- package/packages/agent/src/api/plugin-runtime-apply.d.ts.map +0 -1
- package/packages/agent/src/api/plugin-runtime-apply.js +0 -217
- package/packages/agent/src/api/plugin-validation.d.ts.map +0 -1
- package/packages/agent/src/api/provider-switch-config.d.ts +0 -62
- package/packages/agent/src/api/provider-switch-config.d.ts.map +0 -1
- package/packages/agent/src/api/provider-switch-config.js +0 -719
- package/packages/agent/src/api/provider-switch-routes.d.ts.map +0 -1
- package/packages/agent/src/api/provider-switch-routes.js +0 -142
- package/packages/agent/src/api/rate-limiter.d.ts.map +0 -1
- package/packages/agent/src/api/registry-routes.d.ts.map +0 -1
- package/packages/agent/src/api/registry-routes.js +0 -98
- package/packages/agent/src/api/registry-service.d.ts.map +0 -1
- package/packages/agent/src/api/registry-service.js +0 -190
- package/packages/agent/src/api/relationships-routes.d.ts.map +0 -1
- package/packages/agent/src/api/relationships-routes.js +0 -287
- package/packages/agent/src/api/runtime-plugin-routes.d.ts.map +0 -1
- package/packages/agent/src/api/runtime-plugin-routes.js +0 -203
- package/packages/agent/src/api/server-auth.d.ts.map +0 -1
- package/packages/agent/src/api/server-auth.js +0 -507
- package/packages/agent/src/api/server-autonomy-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-auth.d.ts +0 -41
- package/packages/agent/src/api/server-helpers-auth.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-auth.js +0 -627
- package/packages/agent/src/api/server-helpers-config.d.ts +0 -37
- package/packages/agent/src/api/server-helpers-config.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-config.js +0 -293
- package/packages/agent/src/api/server-helpers-fetch.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-mcp.d.ts +0 -12
- package/packages/agent/src/api/server-helpers-mcp.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-mcp.js +0 -315
- package/packages/agent/src/api/server-helpers-plugin.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-swarm.d.ts +0 -101
- package/packages/agent/src/api/server-helpers-swarm.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers-swarm.js +0 -646
- package/packages/agent/src/api/server-helpers-wallet.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers.d.ts +0 -96
- package/packages/agent/src/api/server-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/server-helpers.js +0 -595
- package/packages/agent/src/api/server-route-dispatch.d.ts.map +0 -1
- package/packages/agent/src/api/server-route-dispatch.js +0 -103
- package/packages/agent/src/api/server-startup.d.ts +0 -16
- package/packages/agent/src/api/server-startup.d.ts.map +0 -1
- package/packages/agent/src/api/server-startup.js +0 -14
- package/packages/agent/src/api/server-types.d.ts +0 -232
- package/packages/agent/src/api/server-types.d.ts.map +0 -1
- package/packages/agent/src/api/server-types.js +0 -6
- package/packages/agent/src/api/server.d.ts +0 -61
- package/packages/agent/src/api/server.d.ts.map +0 -1
- package/packages/agent/src/api/server.js +0 -3215
- package/packages/agent/src/api/skill-discovery-helpers.d.ts +0 -80
- package/packages/agent/src/api/skill-discovery-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/skill-discovery-helpers.js +0 -385
- package/packages/agent/src/api/skills-routes.d.ts +0 -32
- package/packages/agent/src/api/skills-routes.d.ts.map +0 -1
- package/packages/agent/src/api/skills-routes.js +0 -978
- package/packages/agent/src/api/static-file-server.d.ts.map +0 -1
- package/packages/agent/src/api/static-file-server.js +0 -234
- package/packages/agent/src/api/subscription-routes.d.ts.map +0 -1
- package/packages/agent/src/api/subscription-routes.js +0 -261
- package/packages/agent/src/api/task-agent-message-routing.d.ts.map +0 -1
- package/packages/agent/src/api/terminal-execution-routing.d.ts.map +0 -1
- package/packages/agent/src/api/terminal-run-limits.d.ts.map +0 -1
- package/packages/agent/src/api/terminal-run-limits.js +0 -20
- package/packages/agent/src/api/trade-safety.d.ts +0 -35
- package/packages/agent/src/api/trade-safety.d.ts.map +0 -1
- package/packages/agent/src/api/trade-safety.js +0 -62
- package/packages/agent/src/api/training-backend-check.d.ts.map +0 -1
- package/packages/agent/src/api/training-service-like.d.ts.map +0 -1
- package/packages/agent/src/api/travel-provider-relay-routes.d.ts +0 -9
- package/packages/agent/src/api/travel-provider-relay-routes.d.ts.map +0 -1
- package/packages/agent/src/api/travel-provider-relay-routes.js +0 -143
- package/packages/agent/src/api/tx-service.d.ts +0 -53
- package/packages/agent/src/api/tx-service.d.ts.map +0 -1
- package/packages/agent/src/api/tx-service.js +0 -217
- package/packages/agent/src/api/update-routes.d.ts.map +0 -1
- package/packages/agent/src/api/update-routes.js +0 -54
- package/packages/agent/src/api/wallet-capability.d.ts +0 -33
- package/packages/agent/src/api/wallet-capability.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-capability.js +0 -193
- package/packages/agent/src/api/wallet-dex-prices.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-env-sync.d.ts +0 -2
- package/packages/agent/src/api/wallet-env-sync.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-evm-balance.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-routes.d.ts +0 -41
- package/packages/agent/src/api/wallet-routes.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-routes.js +0 -848
- package/packages/agent/src/api/wallet-rpc.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-rpc.js +0 -437
- package/packages/agent/src/api/wallet-trading-profile.d.ts.map +0 -1
- package/packages/agent/src/api/wallet-trading-profile.js +0 -544
- package/packages/agent/src/api/wallet.d.ts.map +0 -1
- package/packages/agent/src/api/wallet.js +0 -780
- package/packages/agent/src/api/workbench-helpers.d.ts.map +0 -1
- package/packages/agent/src/api/workbench-routes.d.ts +0 -43
- package/packages/agent/src/api/workbench-routes.d.ts.map +0 -1
- package/packages/agent/src/api/workbench-routes.js +0 -265
- package/packages/agent/src/api/x-relay-routes.d.ts.map +0 -1
- package/packages/agent/src/api/x-relay-routes.js +0 -134
- package/packages/agent/src/api/zip-utils.d.ts.map +0 -1
- package/packages/agent/src/auth/account-storage.d.ts +0 -48
- package/packages/agent/src/auth/account-storage.d.ts.map +0 -1
- package/packages/agent/src/auth/account-storage.js +0 -229
- package/packages/agent/src/auth/anthropic.d.ts.map +0 -1
- package/packages/agent/src/auth/claude-code-stealth-preload.d.ts +0 -2
- package/packages/agent/src/auth/claude-code-stealth-preload.d.ts.map +0 -1
- package/packages/agent/src/auth/claude-code-stealth-preload.js +0 -2
- package/packages/agent/src/auth/claude-code-stealth.d.ts.map +0 -1
- package/packages/agent/src/auth/claude-code-stealth.js +0 -116
- package/packages/agent/src/auth/credentials.d.ts +0 -100
- package/packages/agent/src/auth/credentials.d.ts.map +0 -1
- package/packages/agent/src/auth/credentials.js +0 -553
- package/packages/agent/src/auth/index.d.ts.map +0 -1
- package/packages/agent/src/auth/oauth-flow.d.ts +0 -106
- package/packages/agent/src/auth/oauth-flow.d.ts.map +0 -1
- package/packages/agent/src/auth/oauth-flow.js +0 -349
- package/packages/agent/src/auth/openai-codex.d.ts.map +0 -1
- package/packages/agent/src/auth/openai-codex.js +0 -76
- package/packages/agent/src/auth/refresh-mutex.d.ts +0 -19
- package/packages/agent/src/auth/refresh-mutex.d.ts.map +0 -1
- package/packages/agent/src/auth/refresh-mutex.js +0 -33
- package/packages/agent/src/auth/types.d.ts +0 -58
- package/packages/agent/src/auth/types.d.ts.map +0 -1
- package/packages/agent/src/auth/types.js +0 -149
- package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.d.ts.map +0 -1
- package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.js +0 -113
- package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.d.ts +0 -26
- package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.d.ts.map +0 -1
- package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.js +0 -343
- package/packages/agent/src/auth/vendor/pi-oauth/pkce.d.ts.map +0 -1
- package/packages/agent/src/autonomy/index.d.ts +0 -48
- package/packages/agent/src/autonomy/index.d.ts.map +0 -1
- package/packages/agent/src/autonomy/index.js +0 -344
- package/packages/agent/src/awareness/index.d.ts.map +0 -1
- package/packages/agent/src/awareness/registry.d.ts.map +0 -1
- package/packages/agent/src/bin.d.ts.map +0 -1
- package/packages/agent/src/bin.js +0 -51
- package/packages/agent/src/cli/benchmark.d.ts.map +0 -1
- package/packages/agent/src/cli/benchmark.js +0 -293
- package/packages/agent/src/cli/index.d.ts.map +0 -1
- package/packages/agent/src/cli/index.js +0 -94
- package/packages/agent/src/cli/parse-duration.d.ts +0 -5
- package/packages/agent/src/cli/parse-duration.d.ts.map +0 -1
- package/packages/agent/src/cli/parse-duration.js +0 -27
- package/packages/agent/src/config/character-schema.d.ts.map +0 -1
- package/packages/agent/src/config/config.d.ts.map +0 -1
- package/packages/agent/src/config/config.js +0 -285
- package/packages/agent/src/config/env-vars.d.ts.map +0 -1
- package/packages/agent/src/config/feature-flags.d.ts +0 -17
- package/packages/agent/src/config/feature-flags.d.ts.map +0 -1
- package/packages/agent/src/config/feature-flags.js +0 -37
- package/packages/agent/src/config/includes.d.ts +0 -26
- package/packages/agent/src/config/includes.d.ts.map +0 -1
- package/packages/agent/src/config/includes.js +0 -149
- package/packages/agent/src/config/index.d.ts.map +0 -1
- package/packages/agent/src/config/model-metadata.d.ts.map +0 -1
- package/packages/agent/src/config/model-metadata.js +0 -133
- package/packages/agent/src/config/owner-contacts.d.ts.map +0 -1
- package/packages/agent/src/config/owner-contacts.js +0 -238
- package/packages/agent/src/config/paths.d.ts +0 -17
- package/packages/agent/src/config/paths.d.ts.map +0 -1
- package/packages/agent/src/config/paths.js +0 -65
- package/packages/agent/src/config/plugin-auto-enable.d.ts.map +0 -1
- package/packages/agent/src/config/plugin-widgets.d.ts +0 -29
- package/packages/agent/src/config/plugin-widgets.d.ts.map +0 -1
- package/packages/agent/src/config/plugin-widgets.js +0 -104
- package/packages/agent/src/config/schema.d.ts.map +0 -1
- package/packages/agent/src/config/schema.js +0 -928
- package/packages/agent/src/config/telegram-custom-commands.d.ts.map +0 -1
- package/packages/agent/src/config/types.agent-defaults.d.ts.map +0 -1
- package/packages/agent/src/config/types.agents.d.ts.map +0 -1
- package/packages/agent/src/config/types.d.ts.map +0 -1
- package/packages/agent/src/config/types.eliza.d.ts.map +0 -1
- package/packages/agent/src/config/types.gateway.d.ts +0 -2
- package/packages/agent/src/config/types.gateway.d.ts.map +0 -1
- package/packages/agent/src/config/types.gateway.js +0 -1
- package/packages/agent/src/config/types.hooks.d.ts.map +0 -1
- package/packages/agent/src/config/types.messages.d.ts.map +0 -1
- package/packages/agent/src/config/types.tools.d.ts +0 -2
- package/packages/agent/src/config/types.tools.d.ts.map +0 -1
- package/packages/agent/src/config/types.tools.js +0 -1
- package/packages/agent/src/config/zod-schema.agent-runtime.d.ts +0 -1164
- package/packages/agent/src/config/zod-schema.agent-runtime.d.ts.map +0 -1
- package/packages/agent/src/config/zod-schema.agent-runtime.js +0 -808
- package/packages/agent/src/config/zod-schema.core.d.ts +0 -1279
- package/packages/agent/src/config/zod-schema.core.d.ts.map +0 -1
- package/packages/agent/src/config/zod-schema.core.js +0 -761
- package/packages/agent/src/config/zod-schema.d.ts +0 -3404
- package/packages/agent/src/config/zod-schema.d.ts.map +0 -1
- package/packages/agent/src/config/zod-schema.hooks.d.ts.map +0 -1
- package/packages/agent/src/config/zod-schema.js +0 -846
- package/packages/agent/src/config/zod-schema.providers-core.d.ts +0 -2752
- package/packages/agent/src/config/zod-schema.providers-core.d.ts.map +0 -1
- package/packages/agent/src/config/zod-schema.providers-core.js +0 -969
- package/packages/agent/src/config/zod-schema.session.d.ts +0 -183
- package/packages/agent/src/config/zod-schema.session.d.ts.map +0 -1
- package/packages/agent/src/contracts/awareness.d.ts.map +0 -1
- package/packages/agent/src/contracts/index.d.ts +0 -2
- package/packages/agent/src/contracts/index.d.ts.map +0 -1
- package/packages/agent/src/contracts/index.js +0 -1
- package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts +0 -177
- package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts.map +0 -1
- package/packages/agent/src/contracts/onboarding-provider-defaults.js +0 -202
- package/packages/agent/src/diagnostics/index.d.ts +0 -2
- package/packages/agent/src/diagnostics/index.d.ts.map +0 -1
- package/packages/agent/src/diagnostics/index.js +0 -1
- package/packages/agent/src/diagnostics/integration-observability.d.ts.map +0 -1
- package/packages/agent/src/hooks/discovery.d.ts +0 -13
- package/packages/agent/src/hooks/discovery.d.ts.map +0 -1
- package/packages/agent/src/hooks/discovery.js +0 -191
- package/packages/agent/src/hooks/eligibility.d.ts.map +0 -1
- package/packages/agent/src/hooks/index.d.ts.map +0 -1
- package/packages/agent/src/hooks/loader.d.ts.map +0 -1
- package/packages/agent/src/hooks/loader.js +0 -214
- package/packages/agent/src/hooks/registry.d.ts.map +0 -1
- package/packages/agent/src/hooks/types.d.ts.map +0 -1
- package/packages/agent/src/index.d.ts +0 -73
- package/packages/agent/src/index.d.ts.map +0 -1
- package/packages/agent/src/index.js +0 -104
- package/packages/agent/src/providers/admin-panel.d.ts.map +0 -1
- package/packages/agent/src/providers/admin-trust.d.ts.map +0 -1
- package/packages/agent/src/providers/automation-terminal-bridge.d.ts.map +0 -1
- package/packages/agent/src/providers/automation-terminal-bridge.js +0 -77
- package/packages/agent/src/providers/conversation-proximity.d.ts.map +0 -1
- package/packages/agent/src/providers/escalation-trigger.d.ts.map +0 -1
- package/packages/agent/src/providers/index.d.ts +0 -19
- package/packages/agent/src/providers/index.d.ts.map +0 -1
- package/packages/agent/src/providers/index.js +0 -18
- package/packages/agent/src/providers/local-models.d.ts +0 -118
- package/packages/agent/src/providers/local-models.d.ts.map +0 -1
- package/packages/agent/src/providers/local-models.js +0 -418
- package/packages/agent/src/providers/media-provider.d.ts +0 -233
- package/packages/agent/src/providers/media-provider.d.ts.map +0 -1
- package/packages/agent/src/providers/media-provider.js +0 -1474
- package/packages/agent/src/providers/page-scoped-context.d.ts.map +0 -1
- package/packages/agent/src/providers/page-scoped-context.js +0 -551
- package/packages/agent/src/providers/pending-permissions-provider.d.ts +0 -19
- package/packages/agent/src/providers/pending-permissions-provider.d.ts.map +0 -1
- package/packages/agent/src/providers/pending-permissions-provider.js +0 -104
- package/packages/agent/src/providers/recent-conversations.d.ts.map +0 -1
- package/packages/agent/src/providers/recent-conversations.js +0 -100
- package/packages/agent/src/providers/relevant-conversations.d.ts.map +0 -1
- package/packages/agent/src/providers/relevant-conversations.js +0 -99
- package/packages/agent/src/providers/role-backfill.d.ts +0 -18
- package/packages/agent/src/providers/role-backfill.d.ts.map +0 -1
- package/packages/agent/src/providers/role-backfill.js +0 -86
- package/packages/agent/src/providers/rolodex.d.ts.map +0 -1
- package/packages/agent/src/providers/rolodex.js +0 -83
- package/packages/agent/src/providers/self-status.d.ts +0 -4
- package/packages/agent/src/providers/self-status.d.ts.map +0 -1
- package/packages/agent/src/providers/self-status.js +0 -22
- package/packages/agent/src/providers/session-bridge.d.ts.map +0 -1
- package/packages/agent/src/providers/session-bridge.js +0 -90
- package/packages/agent/src/providers/session-utils.d.ts +0 -20
- package/packages/agent/src/providers/session-utils.d.ts.map +0 -1
- package/packages/agent/src/providers/session-utils.js +0 -32
- package/packages/agent/src/providers/simple-mode.d.ts +0 -4
- package/packages/agent/src/providers/simple-mode.d.ts.map +0 -1
- package/packages/agent/src/providers/simple-mode.js +0 -49
- package/packages/agent/src/providers/skill-provider.d.ts.map +0 -1
- package/packages/agent/src/providers/tasks.d.ts.map +0 -1
- package/packages/agent/src/providers/ui-catalog.d.ts.map +0 -1
- package/packages/agent/src/providers/ui-catalog.js +0 -100
- package/packages/agent/src/providers/user-name.d.ts.map +0 -1
- package/packages/agent/src/providers/workspace-provider.d.ts.map +0 -1
- package/packages/agent/src/providers/workspace-provider.js +0 -183
- package/packages/agent/src/providers/workspace.d.ts +0 -53
- package/packages/agent/src/providers/workspace.d.ts.map +0 -1
- package/packages/agent/src/providers/workspace.js +0 -418
- package/packages/agent/src/runtime/advanced-capabilities-config.d.ts.map +0 -1
- package/packages/agent/src/runtime/agent-event-service.d.ts.map +0 -1
- package/packages/agent/src/runtime/agent-wallets.d.ts +0 -138
- package/packages/agent/src/runtime/agent-wallets.d.ts.map +0 -1
- package/packages/agent/src/runtime/agent-wallets.js +0 -308
- package/packages/agent/src/runtime/analysis-mode-flag.d.ts +0 -93
- package/packages/agent/src/runtime/analysis-mode-flag.d.ts.map +0 -1
- package/packages/agent/src/runtime/analysis-mode-flag.js +0 -131
- package/packages/agent/src/runtime/android-app-plugins.d.ts +0 -13
- package/packages/agent/src/runtime/android-app-plugins.d.ts.map +0 -1
- package/packages/agent/src/runtime/android-app-plugins.js +0 -48
- package/packages/agent/src/runtime/aosp-dflash-adapter.d.ts +0 -99
- package/packages/agent/src/runtime/aosp-dflash-adapter.d.ts.map +0 -1
- package/packages/agent/src/runtime/aosp-dflash-adapter.js +0 -332
- package/packages/agent/src/runtime/build-character-config.d.ts.map +0 -1
- package/packages/agent/src/runtime/build-character-config.js +0 -176
- package/packages/agent/src/runtime/conversation-compactor-runtime.d.ts +0 -141
- package/packages/agent/src/runtime/conversation-compactor-runtime.d.ts.map +0 -1
- package/packages/agent/src/runtime/conversation-compactor-runtime.js +0 -460
- package/packages/agent/src/runtime/conversation-compactor.d.ts +0 -38
- package/packages/agent/src/runtime/conversation-compactor.d.ts.map +0 -1
- package/packages/agent/src/runtime/conversation-compactor.js +0 -1121
- package/packages/agent/src/runtime/conversation-compactor.types.d.ts +0 -102
- package/packages/agent/src/runtime/conversation-compactor.types.d.ts.map +0 -1
- package/packages/agent/src/runtime/core-plugins.d.ts +0 -64
- package/packages/agent/src/runtime/core-plugins.d.ts.map +0 -1
- package/packages/agent/src/runtime/core-plugins.js +0 -120
- package/packages/agent/src/runtime/custom-actions.d.ts +0 -43
- package/packages/agent/src/runtime/custom-actions.d.ts.map +0 -1
- package/packages/agent/src/runtime/custom-actions.js +0 -533
- package/packages/agent/src/runtime/default-documents.d.ts +0 -21
- package/packages/agent/src/runtime/default-documents.d.ts.map +0 -1
- package/packages/agent/src/runtime/default-documents.js +0 -283
- package/packages/agent/src/runtime/eliza-plugin.d.ts.map +0 -1
- package/packages/agent/src/runtime/eliza-plugin.js +0 -180
- package/packages/agent/src/runtime/eliza.d.ts +0 -109
- package/packages/agent/src/runtime/eliza.d.ts.map +0 -1
- package/packages/agent/src/runtime/eliza.js +0 -3372
- package/packages/agent/src/runtime/embedding-presets.d.ts +0 -19
- package/packages/agent/src/runtime/embedding-presets.d.ts.map +0 -1
- package/packages/agent/src/runtime/embedding-presets.js +0 -60
- package/packages/agent/src/runtime/first-time-setup.d.ts +0 -47
- package/packages/agent/src/runtime/first-time-setup.d.ts.map +0 -1
- package/packages/agent/src/runtime/first-time-setup.js +0 -704
- package/packages/agent/src/runtime/index.d.ts +0 -20
- package/packages/agent/src/runtime/index.d.ts.map +0 -1
- package/packages/agent/src/runtime/index.js +0 -19
- package/packages/agent/src/runtime/load-plugin-from-vfs.d.ts +0 -54
- package/packages/agent/src/runtime/load-plugin-from-vfs.d.ts.map +0 -1
- package/packages/agent/src/runtime/load-plugin-from-vfs.js +0 -86
- package/packages/agent/src/runtime/local-execution-mode.d.ts +0 -11
- package/packages/agent/src/runtime/local-execution-mode.d.ts.map +0 -1
- package/packages/agent/src/runtime/model-resolution.d.ts.map +0 -1
- package/packages/agent/src/runtime/model-resolution.js +0 -55
- package/packages/agent/src/runtime/native-runtime-features.d.ts.map +0 -1
- package/packages/agent/src/runtime/onboarding-names.d.ts +0 -11
- package/packages/agent/src/runtime/onboarding-names.d.ts.map +0 -1
- package/packages/agent/src/runtime/onboarding-names.js +0 -81
- package/packages/agent/src/runtime/operations/classifier.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/classifier.js +0 -72
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/health-checks.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/health.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/index.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/manager.d.ts +0 -70
- package/packages/agent/src/runtime/operations/manager.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/manager.js +0 -202
- package/packages/agent/src/runtime/operations/reload-hot.d.ts +0 -43
- package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/reload-hot.js +0 -181
- package/packages/agent/src/runtime/operations/repository.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/types.d.ts.map +0 -1
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts +0 -81
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts.map +0 -1
- package/packages/agent/src/runtime/owner-entity.d.ts.map +0 -1
- package/packages/agent/src/runtime/owner-entity.js +0 -30
- package/packages/agent/src/runtime/pglite-error-compat.d.ts +0 -28
- package/packages/agent/src/runtime/pglite-error-compat.d.ts.map +0 -1
- package/packages/agent/src/runtime/pglite-error-compat.js +0 -54
- package/packages/agent/src/runtime/plugin-collector.d.ts.map +0 -1
- package/packages/agent/src/runtime/plugin-collector.js +0 -503
- package/packages/agent/src/runtime/plugin-lifecycle.d.ts +0 -45
- package/packages/agent/src/runtime/plugin-lifecycle.d.ts.map +0 -1
- package/packages/agent/src/runtime/plugin-lifecycle.js +0 -602
- package/packages/agent/src/runtime/plugin-resolver.d.ts +0 -46
- package/packages/agent/src/runtime/plugin-resolver.d.ts.map +0 -1
- package/packages/agent/src/runtime/plugin-resolver.js +0 -1375
- package/packages/agent/src/runtime/plugin-role-gating.d.ts +0 -24
- package/packages/agent/src/runtime/plugin-role-gating.d.ts.map +0 -1
- package/packages/agent/src/runtime/plugin-role-gating.js +0 -106
- package/packages/agent/src/runtime/plugin-types.d.ts +0 -64
- package/packages/agent/src/runtime/plugin-types.d.ts.map +0 -1
- package/packages/agent/src/runtime/plugin-types.js +0 -306
- package/packages/agent/src/runtime/prompt-compaction.d.ts +0 -98
- package/packages/agent/src/runtime/prompt-compaction.d.ts.map +0 -1
- package/packages/agent/src/runtime/prompt-compaction.js +0 -362
- package/packages/agent/src/runtime/prompt-optimization.d.ts +0 -47
- package/packages/agent/src/runtime/prompt-optimization.d.ts.map +0 -1
- package/packages/agent/src/runtime/prompt-optimization.js +0 -1123
- package/packages/agent/src/runtime/release-plugin-policy.d.ts.map +0 -1
- package/packages/agent/src/runtime/release-plugin-policy.js +0 -85
- package/packages/agent/src/runtime/restart.d.ts +0 -9
- package/packages/agent/src/runtime/restart.d.ts.map +0 -1
- package/packages/agent/src/runtime/restart.js +0 -8
- package/packages/agent/src/runtime/roles/src/index.d.ts.map +0 -1
- package/packages/agent/src/runtime/roles/src/index.js +0 -255
- package/packages/agent/src/runtime/roles/src/provider.d.ts.map +0 -1
- package/packages/agent/src/runtime/roles/src/types.d.ts.map +0 -1
- package/packages/agent/src/runtime/roles/src/utils.d.ts.map +0 -1
- package/packages/agent/src/runtime/roles.d.ts.map +0 -1
- package/packages/agent/src/runtime/subagent-output.d.ts +0 -51
- package/packages/agent/src/runtime/subagent-output.d.ts.map +0 -1
- package/packages/agent/src/runtime/subagent-output.js +0 -173
- package/packages/agent/src/runtime/task-heartbeat.d.ts +0 -22
- package/packages/agent/src/runtime/task-heartbeat.d.ts.map +0 -1
- package/packages/agent/src/runtime/task-heartbeat.js +0 -84
- package/packages/agent/src/runtime/tool-call-cache/cache.d.ts +0 -62
- package/packages/agent/src/runtime/tool-call-cache/cache.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/cache.js +0 -123
- package/packages/agent/src/runtime/tool-call-cache/disk-store.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/index.d.ts +0 -7
- package/packages/agent/src/runtime/tool-call-cache/index.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/index.js +0 -4
- package/packages/agent/src/runtime/tool-call-cache/key.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/key.js +0 -31
- package/packages/agent/src/runtime/tool-call-cache/lru.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/redact.d.ts +0 -17
- package/packages/agent/src/runtime/tool-call-cache/redact.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/redact.js +0 -77
- package/packages/agent/src/runtime/tool-call-cache/registry.d.ts +0 -18
- package/packages/agent/src/runtime/tool-call-cache/registry.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache/registry.js +0 -66
- package/packages/agent/src/runtime/tool-call-cache/types.d.ts.map +0 -1
- package/packages/agent/src/runtime/tool-call-cache-wrapper.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-export.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-export.js +0 -109
- package/packages/agent/src/runtime/trajectory-internals.d.ts +0 -242
- package/packages/agent/src/runtime/trajectory-internals.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-internals.js +0 -1281
- package/packages/agent/src/runtime/trajectory-persistence.d.ts +0 -15
- package/packages/agent/src/runtime/trajectory-persistence.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-persistence.js +0 -29
- package/packages/agent/src/runtime/trajectory-query.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-query.js +0 -27
- package/packages/agent/src/runtime/trajectory-storage.d.ts +0 -91
- package/packages/agent/src/runtime/trajectory-storage.d.ts.map +0 -1
- package/packages/agent/src/runtime/trajectory-storage.js +0 -1093
- package/packages/agent/src/runtime/vault-profile-resolver.d.ts +0 -37
- package/packages/agent/src/runtime/vault-profile-resolver.d.ts.map +0 -1
- package/packages/agent/src/runtime/vault-profile-resolver.js +0 -79
- package/packages/agent/src/runtime/version.d.ts.map +0 -1
- package/packages/agent/src/runtime/web-search-tools.d.ts +0 -22
- package/packages/agent/src/runtime/web-search-tools.d.ts.map +0 -1
- package/packages/agent/src/runtime/web-search-tools.js +0 -151
- package/packages/agent/src/security/access.d.ts.map +0 -1
- package/packages/agent/src/security/access.js +0 -54
- package/packages/agent/src/security/audit-log.d.ts.map +0 -1
- package/packages/agent/src/security/audit-log.js +0 -161
- package/packages/agent/src/security/index.d.ts.map +0 -1
- package/packages/agent/src/security/network-policy.d.ts.map +0 -1
- package/packages/agent/src/services/agent-export.d.ts +0 -100
- package/packages/agent/src/services/agent-export.d.ts.map +0 -1
- package/packages/agent/src/services/agent-export.js +0 -764
- package/packages/agent/src/services/app-manager-agents-list-guard.d.ts.map +0 -1
- package/packages/agent/src/services/app-manager.d.ts +0 -108
- package/packages/agent/src/services/app-manager.d.ts.map +0 -1
- package/packages/agent/src/services/app-manager.js +0 -1678
- package/packages/agent/src/services/app-package-modules.d.ts +0 -22
- package/packages/agent/src/services/app-package-modules.d.ts.map +0 -1
- package/packages/agent/src/services/app-package-modules.js +0 -397
- package/packages/agent/src/services/app-run-store.d.ts +0 -6
- package/packages/agent/src/services/app-run-store.d.ts.map +0 -1
- package/packages/agent/src/services/app-run-store.js +0 -547
- package/packages/agent/src/services/app-session-gate.d.ts.map +0 -1
- package/packages/agent/src/services/app-session-gate.js +0 -71
- package/packages/agent/src/services/capability-broker.d.ts.map +0 -1
- package/packages/agent/src/services/capability-broker.js +0 -339
- package/packages/agent/src/services/character-history.d.ts.map +0 -1
- package/packages/agent/src/services/character-persistence.d.ts.map +0 -1
- package/packages/agent/src/services/client-chat-sender.d.ts.map +0 -1
- package/packages/agent/src/services/client-chat-sender.js +0 -88
- package/packages/agent/src/services/config-plugin-manager.d.ts.map +0 -1
- package/packages/agent/src/services/connector-setup-service.d.ts.map +0 -1
- package/packages/agent/src/services/escalation.d.ts.map +0 -1
- package/packages/agent/src/services/escalation.js +0 -376
- package/packages/agent/src/services/evm-signing-capability.d.ts +0 -33
- package/packages/agent/src/services/evm-signing-capability.d.ts.map +0 -1
- package/packages/agent/src/services/evm-signing-capability.js +0 -52
- package/packages/agent/src/services/external-bridge-state.d.ts +0 -10
- package/packages/agent/src/services/external-bridge-state.d.ts.map +0 -1
- package/packages/agent/src/services/external-bridge-state.js +0 -14
- package/packages/agent/src/services/hosted-tools.d.ts +0 -70
- package/packages/agent/src/services/hosted-tools.d.ts.map +0 -1
- package/packages/agent/src/services/hosted-tools.js +0 -87
- package/packages/agent/src/services/index.d.ts +0 -27
- package/packages/agent/src/services/index.d.ts.map +0 -1
- package/packages/agent/src/services/index.js +0 -32
- package/packages/agent/src/services/js-runtime-bridge.d.ts.map +0 -1
- package/packages/agent/src/services/js-runtime-bridge.js +0 -217
- package/packages/agent/src/services/mcp-marketplace.d.ts.map +0 -1
- package/packages/agent/src/services/mcp-marketplace.js +0 -200
- package/packages/agent/src/services/media-generation.d.ts +0 -10
- package/packages/agent/src/services/media-generation.d.ts.map +0 -1
- package/packages/agent/src/services/media-generation.js +0 -102
- package/packages/agent/src/services/overlay-app-presence.d.ts.map +0 -1
- package/packages/agent/src/services/owner-name.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/contracts.d.ts +0 -9
- package/packages/agent/src/services/permissions/contracts.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/contracts.js +0 -8
- package/packages/agent/src/services/permissions/probers/_bridge.d.ts +0 -77
- package/packages/agent/src/services/permissions/probers/_bridge.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/_bridge.js +0 -224
- package/packages/agent/src/services/permissions/probers/accessibility.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/automation.d.ts +0 -17
- package/packages/agent/src/services/permissions/probers/automation.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/automation.js +0 -46
- package/packages/agent/src/services/permissions/probers/calendar.d.ts +0 -14
- package/packages/agent/src/services/permissions/probers/calendar.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/calendar.js +0 -33
- package/packages/agent/src/services/permissions/probers/camera.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/contacts.d.ts +0 -13
- package/packages/agent/src/services/permissions/probers/contacts.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/contacts.js +0 -32
- package/packages/agent/src/services/permissions/probers/full-disk.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/health.d.ts +0 -23
- package/packages/agent/src/services/permissions/probers/health.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/health.js +0 -82
- package/packages/agent/src/services/permissions/probers/index.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/index.js +0 -42
- package/packages/agent/src/services/permissions/probers/location.d.ts +0 -21
- package/packages/agent/src/services/permissions/probers/location.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/location.js +0 -47
- package/packages/agent/src/services/permissions/probers/microphone.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/notes.d.ts +0 -19
- package/packages/agent/src/services/permissions/probers/notes.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/notes.js +0 -55
- package/packages/agent/src/services/permissions/probers/notifications.d.ts +0 -24
- package/packages/agent/src/services/permissions/probers/notifications.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/notifications.js +0 -47
- package/packages/agent/src/services/permissions/probers/reminders.d.ts +0 -22
- package/packages/agent/src/services/permissions/probers/reminders.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/reminders.js +0 -44
- package/packages/agent/src/services/permissions/probers/screen-recording.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/screentime.d.ts +0 -21
- package/packages/agent/src/services/permissions/probers/screentime.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/screentime.js +0 -67
- package/packages/agent/src/services/permissions/probers/shell.d.ts +0 -19
- package/packages/agent/src/services/permissions/probers/shell.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/probers/shell.js +0 -31
- package/packages/agent/src/services/permissions/probers/website-blocking.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/register-probers.d.ts +0 -29
- package/packages/agent/src/services/permissions/register-probers.d.ts.map +0 -1
- package/packages/agent/src/services/permissions/register-probers.js +0 -31
- package/packages/agent/src/services/permissions-registry.d.ts.map +0 -1
- package/packages/agent/src/services/permissions-registry.js +0 -213
- package/packages/agent/src/services/plugin-compiler.d.ts.map +0 -1
- package/packages/agent/src/services/plugin-compiler.js +0 -90
- package/packages/agent/src/services/plugin-installer.d.ts +0 -93
- package/packages/agent/src/services/plugin-installer.d.ts.map +0 -1
- package/packages/agent/src/services/plugin-installer.js +0 -623
- package/packages/agent/src/services/plugin-manager-types.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-app-meta.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-app-meta.js +0 -168
- package/packages/agent/src/services/registry-client-endpoints.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-endpoints.js +0 -190
- package/packages/agent/src/services/registry-client-local.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-local.js +0 -555
- package/packages/agent/src/services/registry-client-network.d.ts +0 -14
- package/packages/agent/src/services/registry-client-network.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-network.js +0 -147
- package/packages/agent/src/services/registry-client-queries.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client-queries.js +0 -197
- package/packages/agent/src/services/registry-client-types.d.ts +0 -114
- package/packages/agent/src/services/registry-client-types.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client.d.ts +0 -39
- package/packages/agent/src/services/registry-client.d.ts.map +0 -1
- package/packages/agent/src/services/registry-client.js +0 -349
- package/packages/agent/src/services/relationships-graph.d.ts +0 -13
- package/packages/agent/src/services/relationships-graph.d.ts.map +0 -1
- package/packages/agent/src/services/relationships-graph.js +0 -38
- package/packages/agent/src/services/remote-signing-service.d.ts +0 -58
- package/packages/agent/src/services/remote-signing-service.d.ts.map +0 -1
- package/packages/agent/src/services/remote-signing-service.js +0 -185
- package/packages/agent/src/services/research-task-executor.d.ts.map +0 -1
- package/packages/agent/src/services/research-task-executor.js +0 -138
- package/packages/agent/src/services/sandbox-engine.d.ts.map +0 -1
- package/packages/agent/src/services/sandbox-manager.d.ts +0 -127
- package/packages/agent/src/services/sandbox-manager.d.ts.map +0 -1
- package/packages/agent/src/services/sandbox-manager.js +0 -418
- package/packages/agent/src/services/self-updater.d.ts +0 -21
- package/packages/agent/src/services/self-updater.d.ts.map +0 -1
- package/packages/agent/src/services/self-updater.js +0 -162
- package/packages/agent/src/services/send-handler-availability.d.ts.map +0 -1
- package/packages/agent/src/services/send-handler-availability.js +0 -20
- package/packages/agent/src/services/shell-execution-router.d.ts +0 -67
- package/packages/agent/src/services/shell-execution-router.d.ts.map +0 -1
- package/packages/agent/src/services/shell-execution-router.js +0 -201
- package/packages/agent/src/services/signing-policy.d.ts +0 -44
- package/packages/agent/src/services/signing-policy.d.ts.map +0 -1
- package/packages/agent/src/services/skill-catalog-client.d.ts +0 -47
- package/packages/agent/src/services/skill-catalog-client.d.ts.map +0 -1
- package/packages/agent/src/services/skill-catalog-client.js +0 -130
- package/packages/agent/src/services/skill-marketplace.d.ts +0 -42
- package/packages/agent/src/services/skill-marketplace.d.ts.map +0 -1
- package/packages/agent/src/services/skill-marketplace.js +0 -691
- package/packages/agent/src/services/task-executor.d.ts.map +0 -1
- package/packages/agent/src/services/update-checker.d.ts.map +0 -1
- package/packages/agent/src/services/version-compat.d.ts.map +0 -1
- package/packages/agent/src/services/version-compat.js +0 -211
- package/packages/agent/src/services/virtual-filesystem.d.ts +0 -88
- package/packages/agent/src/services/virtual-filesystem.d.ts.map +0 -1
- package/packages/agent/src/services/virtual-filesystem.js +0 -410
- package/packages/agent/src/shared/conversation-format.d.ts.map +0 -1
- package/packages/agent/src/shared/conversation-format.js +0 -69
- package/packages/agent/src/shared/index.d.ts +0 -4
- package/packages/agent/src/shared/index.d.ts.map +0 -1
- package/packages/agent/src/shared/index.js +0 -3
- package/packages/agent/src/shared/ui-catalog-prompt.d.ts.map +0 -1
- package/packages/agent/src/shared/workspace-resolution.d.ts.map +0 -1
- package/packages/agent/src/shared/workspace-resolution.js +0 -70
- package/packages/agent/src/templates/skill-scaffold.d.ts +0 -9
- package/packages/agent/src/templates/skill-scaffold.d.ts.map +0 -1
- package/packages/agent/src/templates/skill-scaffold.js +0 -26
- package/packages/agent/src/test-support/index.d.ts.map +0 -1
- package/packages/agent/src/test-support/process-helpers.d.ts.map +0 -1
- package/packages/agent/src/test-support/route-test-helpers.d.ts.map +0 -1
- package/packages/agent/src/test-support/test-helpers.d.ts.map +0 -1
- package/packages/agent/src/test-utils/sqlite-compat.d.ts.map +0 -1
- package/packages/agent/src/test-utils/sqlite-compat.js +0 -214
- package/packages/agent/src/testing/index.d.ts +0 -4
- package/packages/agent/src/testing/index.d.ts.map +0 -1
- package/packages/agent/src/testing/index.js +0 -3
- package/packages/agent/src/triggers/index.d.ts +0 -5
- package/packages/agent/src/triggers/index.d.ts.map +0 -1
- package/packages/agent/src/triggers/index.js +0 -4
- package/packages/agent/src/triggers/runtime.d.ts.map +0 -1
- package/packages/agent/src/triggers/runtime.js +0 -447
- package/packages/agent/src/triggers/scheduling.d.ts +0 -78
- package/packages/agent/src/triggers/scheduling.d.ts.map +0 -1
- package/packages/agent/src/triggers/scheduling.js +0 -436
- package/packages/agent/src/triggers/text-to-workflow.d.ts +0 -58
- package/packages/agent/src/triggers/text-to-workflow.d.ts.map +0 -1
- package/packages/agent/src/triggers/text-to-workflow.js +0 -44
- package/packages/agent/src/triggers/types.d.ts +0 -96
- package/packages/agent/src/triggers/types.d.ts.map +0 -1
- package/packages/agent/src/types/agent-skills.d.ts.map +0 -1
- package/packages/agent/src/types/config-like.d.ts.map +0 -1
- package/packages/agent/src/types/index.d.ts.map +0 -1
- package/packages/agent/src/types/trajectory.d.ts +0 -20
- package/packages/agent/src/types/trajectory.d.ts.map +0 -1
- package/packages/agent/src/utils/atomic-json.d.ts.map +0 -1
- package/packages/agent/src/utils/exec-safety.d.ts +0 -2
- package/packages/agent/src/utils/exec-safety.d.ts.map +0 -1
- package/packages/agent/src/utils/exec-safety.js +0 -21
- package/packages/agent/src/utils/index.d.ts +0 -2
- package/packages/agent/src/utils/index.d.ts.map +0 -1
- package/packages/agent/src/utils/index.js +0 -1
- package/packages/agent/src/utils/number-parsing.d.ts +0 -26
- package/packages/agent/src/utils/number-parsing.d.ts.map +0 -1
- package/packages/agent/src/utils/number-parsing.js +0 -51
- package/packages/agent/src/version-resolver.d.ts.map +0 -1
- /package/{packages/agent/src/actions → actions}/connector-resolver.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/contact.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/context-signal-lexicon.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/context-signal-lexicon.js +0 -0
- /package/{packages/agent/src/actions → actions}/context-signal.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/database.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/grounded-action-reply.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/logs.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/logs.js +0 -0
- /package/{packages/agent/src/actions → actions}/recent-conversation-texts.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/runtime.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/terminal.d.ts +0 -0
- /package/{packages/agent/src/actions → actions}/trigger.d.ts +0 -0
- /package/{packages/agent/src/api → api}/agent-lifecycle-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/agent-model.d.ts +0 -0
- /package/{packages/agent/src/api → api}/agent-status-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/agent-transfer-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/auth-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/avatar-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/binance-skill-helpers.d.ts +0 -0
- /package/{packages/agent/src/api → api}/character-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/chat-text-helpers.d.ts +0 -0
- /package/{packages/agent/src/api → api}/chat-text-helpers.js +0 -0
- /package/{packages/agent/src/api → api}/client-chat-admin.d.ts +0 -0
- /package/{packages/agent/src/api → api}/client-chat-admin.js +0 -0
- /package/{packages/agent/src/api → api}/compat-utils.d.ts +0 -0
- /package/{packages/agent/src/api → api}/compat-utils.js +0 -0
- /package/{packages/agent/src/api → api}/config-env.d.ts +0 -0
- /package/{packages/agent/src/api → api}/config-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/connector-account-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/connector-health.d.ts +0 -0
- /package/{packages/agent/src/api → api}/connector-health.js +0 -0
- /package/{packages/agent/src/api → api}/connector-oauth-callback-auth.d.ts +0 -0
- /package/{packages/agent/src/api → api}/connector-oauth-callback-auth.js +0 -0
- /package/{packages/agent/src/api → api}/connector-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/conversation-metadata.d.ts +0 -0
- /package/{packages/agent/src/api → api}/coordinator-wiring.d.ts +0 -0
- /package/{packages/agent/src/api → api}/credit-detection.d.ts +0 -0
- /package/{packages/agent/src/api → api}/documents-service-loader.d.ts +0 -0
- /package/{packages/agent/src/api → api}/documents-service-loader.js +0 -0
- /package/{packages/agent/src/api → api}/early-logs.js +0 -0
- /package/{packages/agent/src/api → api}/inbox-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/memory-bounds.d.ts +0 -0
- /package/{packages/agent/src/api → api}/memory-bounds.js +0 -0
- /package/{packages/agent/src/api → api}/memory-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/misc-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/mobile-optional-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/models-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/models-routes.js +0 -0
- /package/{packages/agent/src/api → api}/music-player-route-fallback.d.ts +0 -0
- /package/{packages/agent/src/api → api}/music-player-route-fallback.js +0 -0
- /package/{packages/agent/src/api → api}/owner-contact-helpers.d.ts +0 -0
- /package/{packages/agent/src/api → api}/owner-contact-helpers.js +0 -0
- /package/{packages/agent/src/api → api}/parse-action-block.js +0 -0
- /package/{packages/agent/src/api → api}/permissions-routes-extra.js +0 -0
- /package/{packages/agent/src/api → api}/permissions-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/plugin-runtime-apply.d.ts +0 -0
- /package/{packages/agent/src/api → api}/plugin-validation.d.ts +0 -0
- /package/{packages/agent/src/api → api}/plugin-validation.js +0 -0
- /package/{packages/agent/src/api → api}/provider-switch-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/rate-limiter.d.ts +0 -0
- /package/{packages/agent/src/api → api}/rate-limiter.js +0 -0
- /package/{packages/agent/src/api → api}/registry-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/registry-service.d.ts +0 -0
- /package/{packages/agent/src/api → api}/relationships-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/runtime-plugin-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-auth.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-autonomy-helpers.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-autonomy-helpers.js +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-fetch.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-fetch.js +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-plugin.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-plugin.js +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-wallet.d.ts +0 -0
- /package/{packages/agent/src/api → api}/server-helpers-wallet.js +0 -0
- /package/{packages/agent/src/api → api}/server-route-dispatch.d.ts +0 -0
- /package/{packages/agent/src/api/training-service-like.js → api/server-types.js} +0 -0
- /package/{packages/agent/src/api → api}/static-file-server.d.ts +0 -0
- /package/{packages/agent/src/api → api}/subscription-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/task-agent-message-routing.d.ts +0 -0
- /package/{packages/agent/src/api → api}/task-agent-message-routing.js +0 -0
- /package/{packages/agent/src/api → api}/terminal-execution-routing.d.ts +0 -0
- /package/{packages/agent/src/api → api}/terminal-execution-routing.js +0 -0
- /package/{packages/agent/src/api → api}/terminal-run-limits.d.ts +0 -0
- /package/{packages/agent/src/api → api}/training-backend-check.d.ts +0 -0
- /package/{packages/agent/src/api → api}/training-backend-check.js +0 -0
- /package/{packages/agent/src/api → api}/training-service-like.d.ts +0 -0
- /package/{packages/agent/src/services/registry-client-types.js → api/training-service-like.js} +0 -0
- /package/{packages/agent/src/api → api}/update-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/wallet-dex-prices.d.ts +0 -0
- /package/{packages/agent/src/api → api}/wallet-dex-prices.js +0 -0
- /package/{packages/agent/src/api → api}/wallet-env-sync.js +0 -0
- /package/{packages/agent/src/api → api}/wallet-evm-balance.d.ts +0 -0
- /package/{packages/agent/src/api → api}/wallet-evm-balance.js +0 -0
- /package/{packages/agent/src/api → api}/wallet-rpc.d.ts +0 -0
- /package/{packages/agent/src/api → api}/wallet-trading-profile.d.ts +0 -0
- /package/{packages/agent/src/api → api}/wallet.d.ts +0 -0
- /package/{packages/agent/src/api → api}/workbench-helpers.d.ts +0 -0
- /package/{packages/agent/src/api → api}/workbench-helpers.js +0 -0
- /package/{packages/agent/src/api → api}/x-relay-routes.d.ts +0 -0
- /package/{packages/agent/src/api → api}/zip-utils.d.ts +0 -0
- /package/{packages/agent/src/api → api}/zip-utils.js +0 -0
- /package/{packages/agent/src/auth → auth}/anthropic.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/anthropic.js +0 -0
- /package/{packages/agent/src/auth → auth}/claude-code-stealth.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/index.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/index.js +0 -0
- /package/{packages/agent/src/auth → auth}/openai-codex.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/anthropic-login.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/pkce.d.ts +0 -0
- /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/pkce.js +0 -0
- /package/{packages/agent/src/awareness → awareness}/index.d.ts +0 -0
- /package/{packages/agent/src/awareness → awareness}/index.js +0 -0
- /package/{packages/agent/src/awareness → awareness}/registry.d.ts +0 -0
- /package/{packages/agent/src/awareness → awareness}/registry.js +0 -0
- /package/{packages/agent/src/bin.d.ts → bin.d.ts} +0 -0
- /package/{packages/agent/src/cli → cli}/benchmark.d.ts +0 -0
- /package/{packages/agent/src/cli → cli}/index.d.ts +0 -0
- /package/{packages/agent/src/config → config}/character-schema.d.ts +0 -0
- /package/{packages/agent/src/config → config}/character-schema.js +0 -0
- /package/{packages/agent/src/config → config}/config.d.ts +0 -0
- /package/{packages/agent/src/config → config}/env-vars.d.ts +0 -0
- /package/{packages/agent/src/config → config}/env-vars.js +0 -0
- /package/{packages/agent/src/config → config}/index.d.ts +0 -0
- /package/{packages/agent/src/config → config}/index.js +0 -0
- /package/{packages/agent/src/config → config}/model-metadata.d.ts +0 -0
- /package/{packages/agent/src/config → config}/owner-contacts.d.ts +0 -0
- /package/{packages/agent/src/config → config}/plugin-auto-enable.d.ts +0 -0
- /package/{packages/agent/src/config → config}/plugin-auto-enable.js +0 -0
- /package/{packages/agent/src/config → config}/schema.d.ts +0 -0
- /package/{packages/agent/src/config → config}/telegram-custom-commands.d.ts +0 -0
- /package/{packages/agent/src/config → config}/telegram-custom-commands.js +0 -0
- /package/{packages/agent/src/config → config}/types.agent-defaults.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.agent-defaults.js +0 -0
- /package/{packages/agent/src/config → config}/types.agents.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.agents.js +0 -0
- /package/{packages/agent/src/config → config}/types.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.eliza.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.eliza.js +0 -0
- /package/{packages/agent/src/config → config}/types.hooks.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.hooks.js +0 -0
- /package/{packages/agent/src/config → config}/types.js +0 -0
- /package/{packages/agent/src/config → config}/types.messages.d.ts +0 -0
- /package/{packages/agent/src/config → config}/types.messages.js +0 -0
- /package/{packages/agent/src/config → config}/zod-schema.hooks.d.ts +0 -0
- /package/{packages/agent/src/config → config}/zod-schema.hooks.js +0 -0
- /package/{packages/agent/src/config → config}/zod-schema.session.js +0 -0
- /package/{packages/agent/src/contracts → contracts}/awareness.d.ts +0 -0
- /package/{packages/agent/src/contracts → contracts}/awareness.js +0 -0
- /package/{packages/agent/src/diagnostics → diagnostics}/integration-observability.d.ts +0 -0
- /package/{packages/agent/src/diagnostics → diagnostics}/integration-observability.js +0 -0
- /package/{packages/agent/src/hooks → hooks}/eligibility.d.ts +0 -0
- /package/{packages/agent/src/hooks → hooks}/eligibility.js +0 -0
- /package/{packages/agent/src/hooks → hooks}/index.d.ts +0 -0
- /package/{packages/agent/src/hooks → hooks}/index.js +0 -0
- /package/{packages/agent/src/hooks → hooks}/loader.d.ts +0 -0
- /package/{packages/agent/src/hooks → hooks}/registry.d.ts +0 -0
- /package/{packages/agent/src/hooks → hooks}/registry.js +0 -0
- /package/{packages/agent/src/hooks → hooks}/types.d.ts +0 -0
- /package/{packages/agent/src/hooks → hooks}/types.js +0 -0
- /package/{packages/agent/src/providers → providers}/admin-panel.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/admin-panel.js +0 -0
- /package/{packages/agent/src/providers → providers}/admin-trust.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/admin-trust.js +0 -0
- /package/{packages/agent/src/providers → providers}/automation-terminal-bridge.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/conversation-proximity.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/conversation-proximity.js +0 -0
- /package/{packages/agent/src/providers → providers}/escalation-trigger.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/escalation-trigger.js +0 -0
- /package/{packages/agent/src/providers → providers}/page-scoped-context.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/recent-conversations.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/relevant-conversations.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/rolodex.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/session-bridge.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/skill-provider.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/skill-provider.js +0 -0
- /package/{packages/agent/src/providers → providers}/tasks.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/tasks.js +0 -0
- /package/{packages/agent/src/providers → providers}/ui-catalog.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/user-name.d.ts +0 -0
- /package/{packages/agent/src/providers → providers}/user-name.js +0 -0
- /package/{packages/agent/src/providers → providers}/workspace-provider.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/advanced-capabilities-config.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/advanced-capabilities-config.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/agent-event-service.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/agent-event-service.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/build-character-config.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/conversation-compactor.types.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/eliza-plugin.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/local-execution-mode.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/model-resolution.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/native-runtime-features.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/native-runtime-features.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/classifier.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/cold-strategy.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/cold-strategy.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/health-checks.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/health-checks.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/health.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/health.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/index.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/index.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/repository.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/repository.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/types.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/types.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/operations/vault-bridge.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/owner-entity.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/plugin-collector.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/release-plugin-policy.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/index.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/provider.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/provider.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/types.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/types.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/utils.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles/src/utils.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/roles.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/disk-store.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/disk-store.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/key.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/lru.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/lru.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/types.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache/types.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache-wrapper.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/tool-call-cache-wrapper.js +0 -0
- /package/{packages/agent/src/runtime → runtime}/trajectory-export.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/trajectory-query.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/version.d.ts +0 -0
- /package/{packages/agent/src/runtime → runtime}/version.js +0 -0
- /package/{packages/agent/src/security → security}/access.d.ts +0 -0
- /package/{packages/agent/src/security → security}/audit-log.d.ts +0 -0
- /package/{packages/agent/src/security → security}/index.d.ts +0 -0
- /package/{packages/agent/src/security → security}/index.js +0 -0
- /package/{packages/agent/src/security → security}/network-policy.d.ts +0 -0
- /package/{packages/agent/src/security → security}/network-policy.js +0 -0
- /package/{packages/agent/src/services → services}/app-manager-agents-list-guard.d.ts +0 -0
- /package/{packages/agent/src/services → services}/app-manager-agents-list-guard.js +0 -0
- /package/{packages/agent/src/services → services}/app-session-gate.d.ts +0 -0
- /package/{packages/agent/src/services → services}/capability-broker.d.ts +0 -0
- /package/{packages/agent/src/services → services}/character-history.d.ts +0 -0
- /package/{packages/agent/src/services → services}/character-history.js +0 -0
- /package/{packages/agent/src/services → services}/character-persistence.d.ts +0 -0
- /package/{packages/agent/src/services → services}/character-persistence.js +0 -0
- /package/{packages/agent/src/services → services}/client-chat-sender.d.ts +0 -0
- /package/{packages/agent/src/services → services}/config-plugin-manager.d.ts +0 -0
- /package/{packages/agent/src/services → services}/config-plugin-manager.js +0 -0
- /package/{packages/agent/src/services → services}/connector-setup-service.d.ts +0 -0
- /package/{packages/agent/src/services → services}/connector-setup-service.js +0 -0
- /package/{packages/agent/src/services → services}/escalation.d.ts +0 -0
- /package/{packages/agent/src/services → services}/js-runtime-bridge.d.ts +0 -0
- /package/{packages/agent/src/services → services}/mcp-marketplace.d.ts +0 -0
- /package/{packages/agent/src/services → services}/overlay-app-presence.d.ts +0 -0
- /package/{packages/agent/src/services → services}/overlay-app-presence.js +0 -0
- /package/{packages/agent/src/services → services}/owner-name.d.ts +0 -0
- /package/{packages/agent/src/services → services}/owner-name.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/accessibility.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/accessibility.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/camera.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/camera.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/full-disk.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/full-disk.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/index.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/microphone.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/microphone.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/screen-recording.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/screen-recording.js +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/website-blocking.d.ts +0 -0
- /package/{packages/agent/src/services → services}/permissions/probers/website-blocking.js +0 -0
- /package/{packages/agent/src/services → services}/permissions-registry.d.ts +0 -0
- /package/{packages/agent/src/services → services}/plugin-compiler.d.ts +0 -0
- /package/{packages/agent/src/services → services}/plugin-manager-types.d.ts +0 -0
- /package/{packages/agent/src/services → services}/plugin-manager-types.js +0 -0
- /package/{packages/agent/src/services → services}/registry-client-app-meta.d.ts +0 -0
- /package/{packages/agent/src/services → services}/registry-client-endpoints.d.ts +0 -0
- /package/{packages/agent/src/services → services}/registry-client-local.d.ts +0 -0
- /package/{packages/agent/src/services → services}/registry-client-queries.d.ts +0 -0
- /package/{packages/agent/src/services → services}/research-task-executor.d.ts +0 -0
- /package/{packages/agent/src/services → services}/sandbox-engine.d.ts +0 -0
- /package/{packages/agent/src/services → services}/sandbox-engine.js +0 -0
- /package/{packages/agent/src/services → services}/send-handler-availability.d.ts +0 -0
- /package/{packages/agent/src/services → services}/signing-policy.js +0 -0
- /package/{packages/agent/src/services → services}/task-executor.d.ts +0 -0
- /package/{packages/agent/src/services → services}/task-executor.js +0 -0
- /package/{packages/agent/src/services → services}/update-checker.d.ts +0 -0
- /package/{packages/agent/src/services → services}/update-checker.js +0 -0
- /package/{packages/agent/src/services → services}/version-compat.d.ts +0 -0
- /package/{packages/agent/src/shared → shared}/conversation-format.d.ts +0 -0
- /package/{packages/agent/src/shared → shared}/ui-catalog-prompt.d.ts +0 -0
- /package/{packages/agent/src/shared → shared}/ui-catalog-prompt.js +0 -0
- /package/{packages/agent/src/shared → shared}/workspace-resolution.d.ts +0 -0
- /package/{packages/agent/src/test-support → test-support}/index.d.ts +0 -0
- /package/{packages/agent/src/test-support → test-support}/index.js +0 -0
- /package/{packages/agent/src/test-support → test-support}/process-helpers.d.ts +0 -0
- /package/{packages/agent/src/test-support → test-support}/process-helpers.js +0 -0
- /package/{packages/agent/src/test-support → test-support}/route-test-helpers.d.ts +0 -0
- /package/{packages/agent/src/test-support → test-support}/route-test-helpers.js +0 -0
- /package/{packages/agent/src/test-support → test-support}/test-helpers.d.ts +0 -0
- /package/{packages/agent/src/test-support → test-support}/test-helpers.js +0 -0
- /package/{packages/agent/src/test-utils → test-utils}/sqlite-compat.d.ts +0 -0
- /package/{packages/agent/src/triggers → triggers}/runtime.d.ts +0 -0
- /package/{packages/agent/src/triggers → triggers}/types.js +0 -0
- /package/{packages/agent/src/types → types}/agent-skills.d.ts +0 -0
- /package/{packages/agent/src/types → types}/agent-skills.js +0 -0
- /package/{packages/agent/src/types → types}/config-like.d.ts +0 -0
- /package/{packages/agent/src/types → types}/config-like.js +0 -0
- /package/{packages/agent/src/types → types}/index.d.ts +0 -0
- /package/{packages/agent/src/types → types}/index.js +0 -0
- /package/{packages/agent/src/types → types}/trajectory.js +0 -0
- /package/{packages/agent/src/utils → utils}/atomic-json.d.ts +0 -0
- /package/{packages/agent/src/utils → utils}/atomic-json.js +0 -0
- /package/{packages/agent/src/version-resolver.d.ts → version-resolver.d.ts} +0 -0
- /package/{packages/agent/src/version-resolver.js → version-resolver.js} +0 -0
|
@@ -0,0 +1,2581 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat route handlers extracted from server.ts.
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* POST /v1/chat/completions – OpenAI-compatible
|
|
6
|
+
* POST /v1/messages – Anthropic-compatible
|
|
7
|
+
* GET /v1/models – OpenAI model listing
|
|
8
|
+
* GET /v1/models/:id – OpenAI single model
|
|
9
|
+
*
|
|
10
|
+
* Also exports generateChatResponse() and supporting helpers so that
|
|
11
|
+
* conversation-routes.ts (and server.ts itself) can reuse them.
|
|
12
|
+
*/
|
|
13
|
+
import crypto from "node:crypto";
|
|
14
|
+
import { ChannelType, createMessageMemory, logger, ModelType, runWithTrajectoryContext, stringToUuid, } from "@elizaos/core";
|
|
15
|
+
import { asRecord, extractAssistantReplyText, normalizeCharacterLanguage, resolveStreamingUpdate, } from "@elizaos/shared";
|
|
16
|
+
import { estimateTokenCount, withModelUsageCapture, } from "../runtime/prompt-optimization.js";
|
|
17
|
+
import { resolveTrajectoryGrouping } from "../runtime/trajectory-internals.js";
|
|
18
|
+
import { startTrajectoryStepInDatabase } from "../runtime/trajectory-storage.js";
|
|
19
|
+
import { syncCharacterIntoConfig } from "../services/character-persistence.js";
|
|
20
|
+
import { detectRuntimeModel } from "./agent-model.js";
|
|
21
|
+
import { executeFallbackParsedActions, maybeHandleDirectBinanceSkillRequest, parseFallbackActionBlocks, } from "./binance-skill-helpers.js";
|
|
22
|
+
import { maybeAugmentChatMessageWithDocuments, maybeAugmentChatMessageWithLanguage, } from "./chat-augmentation.js";
|
|
23
|
+
import { isClientVisibleNoResponse, isNoResponsePlaceholder, } from "./chat-text-helpers.js";
|
|
24
|
+
import { resolveClientChatAdminEntityId } from "./client-chat-admin.js";
|
|
25
|
+
import { extractAnthropicSystemAndLastUser, extractCompatTextContent, extractOpenAiSystemAndLastUser, resolveCompatRoomKey, } from "./compat-utils.js";
|
|
26
|
+
import { isInsufficientCreditsError, isInsufficientCreditsMessage, } from "./credit-detection.js";
|
|
27
|
+
import { buildWalletActionNotExecutedReply, cloneWithoutBlockedObjectKeys, decodePathComponent, getErrorMessage, hasBlockedObjectKeyDeep, isWalletActionRequiredIntent, maybeAugmentChatMessageWithWalletContext, normalizeIncomingChatPrompt, resolveAppUserName, trimWalletProgressPrefix, validateChatImages, } from "./server-helpers.js";
|
|
28
|
+
const DEFAULT_CONVERSATION_TITLE_TIMEOUT_MS = 5_000;
|
|
29
|
+
let localInferenceChatApiPromise = null;
|
|
30
|
+
function getLocalInferenceChatApi() {
|
|
31
|
+
localInferenceChatApiPromise ??= import("@elizaos/plugin-local-inference");
|
|
32
|
+
return localInferenceChatApiPromise;
|
|
33
|
+
}
|
|
34
|
+
const CHAT_MAX_BODY_BYTES = 20 * 1024 * 1024; // 20 MB (image-capable)
|
|
35
|
+
/** Max accepted client-supplied idempotency key length. Anything longer is a
|
|
36
|
+
* malformed/abusive client and is treated as absent (no dedupe). */
|
|
37
|
+
const CLIENT_MESSAGE_ID_MAX_LENGTH = 128;
|
|
38
|
+
/**
|
|
39
|
+
* Short-window idempotency cache for the HTTP chat path, the analogue of the
|
|
40
|
+
* WebSocket `isDuplicateWsMessage` cache in server.ts. Chat sends go over HTTP
|
|
41
|
+
* SSE (not WS), so the WS cache does not cover them. The client stamps a stable
|
|
42
|
+
* `clientMessageId` on every send (`ui/src/api/client-base.ts`); a retried or
|
|
43
|
+
* double-submitted POST carries the same id, and without this guard would start
|
|
44
|
+
* a second LLM turn and persist a duplicate assistant memory (report 05,
|
|
45
|
+
* Finding 1 / W3.1).
|
|
46
|
+
*
|
|
47
|
+
* Keyed by `${conversationOrUserScope}:${clientMessageId}` so a legitimately
|
|
48
|
+
* identical message in a different conversation, or the same text re-sent after
|
|
49
|
+
* the TTL, is NOT suppressed. Entries expire after `CHAT_DEDUPE_TTL_MS`; the map
|
|
50
|
+
* stays bounded via an amortized sweep (at most once per TTL window) — the same
|
|
51
|
+
* O(1)-check / amortized-eviction shape as the WS cache.
|
|
52
|
+
*/
|
|
53
|
+
const chatSeenMessageIds = new Map();
|
|
54
|
+
const CHAT_DEDUPE_TTL_MS = 30_000;
|
|
55
|
+
let chatSeenLastSweepAt = 0;
|
|
56
|
+
/** Normalize a raw body value into a usable idempotency key, or `null` when
|
|
57
|
+
* absent/invalid. Exported for unit testing the dedupe decision in isolation. */
|
|
58
|
+
export function normalizeClientMessageId(value) {
|
|
59
|
+
if (typeof value !== "string")
|
|
60
|
+
return null;
|
|
61
|
+
const trimmed = value.trim();
|
|
62
|
+
if (trimmed.length === 0 || trimmed.length > CLIENT_MESSAGE_ID_MAX_LENGTH) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return trimmed;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* TTL-aware O(1) duplicate check for an HTTP chat send. Returns `true` when this
|
|
69
|
+
* `(scope, clientMessageId)` pair was already seen within the TTL window. When
|
|
70
|
+
* `clientMessageId` is absent/invalid the result is ALWAYS `false`, so requests
|
|
71
|
+
* without an idempotency key behave exactly as before (no dedupe). The first
|
|
72
|
+
* sighting records the timestamp and returns `false`; a repeat within the window
|
|
73
|
+
* returns `true`. After the TTL elapses the id is treated as new again.
|
|
74
|
+
*
|
|
75
|
+
* `scope` is the conversation room id (dashboard chat) or the per-user room key
|
|
76
|
+
* (agent-message API) so the key cannot collide across conversations/users.
|
|
77
|
+
*/
|
|
78
|
+
export function isDuplicateChatMessage(scope, clientMessageId, now = Date.now()) {
|
|
79
|
+
if (!clientMessageId)
|
|
80
|
+
return false;
|
|
81
|
+
const key = `${scope}:${clientMessageId}`;
|
|
82
|
+
const seenAt = chatSeenMessageIds.get(key);
|
|
83
|
+
if (seenAt !== undefined && now - seenAt <= CHAT_DEDUPE_TTL_MS)
|
|
84
|
+
return true;
|
|
85
|
+
chatSeenMessageIds.set(key, now);
|
|
86
|
+
// Amortized eviction: sweep expired entries at most once per TTL window
|
|
87
|
+
// rather than on every request, keeping the map bounded without a per-request
|
|
88
|
+
// O(n) scan.
|
|
89
|
+
if (now - chatSeenLastSweepAt > CHAT_DEDUPE_TTL_MS) {
|
|
90
|
+
chatSeenLastSweepAt = now;
|
|
91
|
+
for (const [seenKey, ts] of chatSeenMessageIds) {
|
|
92
|
+
if (now - ts > CHAT_DEDUPE_TTL_MS)
|
|
93
|
+
chatSeenMessageIds.delete(seenKey);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
/** Test-only: clear the HTTP chat idempotency cache between cases. */
|
|
99
|
+
export function __resetChatDedupeForTests() {
|
|
100
|
+
chatSeenMessageIds.clear();
|
|
101
|
+
chatSeenLastSweepAt = 0;
|
|
102
|
+
}
|
|
103
|
+
const ANDROID_LOCAL_DIRECT_CHAT_DENY_PATTERN = /\b(check|search|find|fetch|get|look\s+up|browse|open|click|call|email|send|create|update|delete|save|remember|schedule|remind|set|run|execute|install|download|upload|read|inspect|build|deploy|commit|push|pull|merge|rebase|book|pay|buy|order)\b/i;
|
|
104
|
+
const ANDROID_LOCAL_CURRENT_DATA_PATTERN = /\b(latest|current|today|tomorrow|yesterday|weather|price|calendar|email|file|repo|repository|log|logs|issue|issues|pr|pull\s+request|wallet|transaction|account|contact|contacts)\b/i;
|
|
105
|
+
const ANDROID_LOCAL_CONTEXTUAL_MEMORY_PATTERN = /\b(what\s+did\s+i\s+just\s+say|what\s+(?:is|'s)\s+my\s+name|who\s+am\s+i|do\s+you\s+remember|remember\s+(?:me|my|that)|what\s+was\s+my|what\s+did\s+we|previous(?:ly)?|earlier|last\s+(?:message|thing|question|conversation)|recent\s+(?:message|conversation)|my\s+(?:name|email|address|phone|preference|preferences))\b/i;
|
|
106
|
+
function readRuntimeStringSetting(runtime, key) {
|
|
107
|
+
const setting = typeof runtime.getSetting === "function" ? runtime.getSetting(key) : null;
|
|
108
|
+
if (typeof setting === "string" && setting.trim().length > 0) {
|
|
109
|
+
return setting.trim();
|
|
110
|
+
}
|
|
111
|
+
if (typeof setting === "number" || typeof setting === "boolean") {
|
|
112
|
+
return String(setting);
|
|
113
|
+
}
|
|
114
|
+
const env = process.env[key];
|
|
115
|
+
return typeof env === "string" && env.trim().length > 0 ? env.trim() : null;
|
|
116
|
+
}
|
|
117
|
+
function readPositiveIntegerSetting(runtime, key, fallback) {
|
|
118
|
+
const raw = readRuntimeStringSetting(runtime, key);
|
|
119
|
+
const parsed = raw ? Number.parseInt(raw, 10) : Number.NaN;
|
|
120
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
|
|
121
|
+
}
|
|
122
|
+
function isAndroidLocalDirectChatRuntime(runtime) {
|
|
123
|
+
const optOut = readRuntimeStringSetting(runtime, "ELIZA_MOBILE_LOCAL_DIRECT_REPLY");
|
|
124
|
+
if (/^(0|false|no|off)$/i.test(optOut ?? "")) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const platform = readRuntimeStringSetting(runtime, "ELIZA_MOBILE_PLATFORM") ??
|
|
128
|
+
readRuntimeStringSetting(runtime, "ELIZA_PLATFORM");
|
|
129
|
+
const normalizedPlatform = platform?.toLowerCase();
|
|
130
|
+
const localLlama = readRuntimeStringSetting(runtime, "ELIZA_LOCAL_LLAMA") === "1" ||
|
|
131
|
+
readRuntimeStringSetting(runtime, "ELIZA_DEVICE_BRIDGE_ENABLED") === "1" ||
|
|
132
|
+
readRuntimeStringSetting(runtime, "ELIZA_IOS_LOCAL_BACKEND") === "1";
|
|
133
|
+
return ((normalizedPlatform === "android" || normalizedPlatform === "ios") &&
|
|
134
|
+
localLlama);
|
|
135
|
+
}
|
|
136
|
+
function hasAndroidLocalDirectChatBlockingContent(content) {
|
|
137
|
+
if (Array.isArray(content.attachments) && content.attachments.length > 0) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(content.media) && content.media.length > 0) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
if (Array.isArray(content.files) && content.files.length > 0) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
if (content.documentIds || content.documents || content.localInference) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
const metadata = content.metadata && typeof content.metadata === "object"
|
|
150
|
+
? content.metadata
|
|
151
|
+
: {};
|
|
152
|
+
return Boolean(metadata.benchmark || metadata.localInference || metadata.contextRouting);
|
|
153
|
+
}
|
|
154
|
+
function isAndroidLocalDirectChatChannel(content) {
|
|
155
|
+
const channelType = content.channelType;
|
|
156
|
+
return (channelType === ChannelType.API ||
|
|
157
|
+
channelType === ChannelType.DM ||
|
|
158
|
+
channelType === ChannelType.SELF ||
|
|
159
|
+
channelType === ChannelType.VOICE_DM ||
|
|
160
|
+
channelType === undefined);
|
|
161
|
+
}
|
|
162
|
+
function shouldUseAndroidLocalDirectChat(runtime, message) {
|
|
163
|
+
if (!isAndroidLocalDirectChatRuntime(runtime)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const text = normalizeAndroidLocalDirectUserText(extractCompatTextContent(message.content));
|
|
167
|
+
if (!text || text.length > 700) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (!isAndroidLocalDirectChatChannel(message.content)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (hasAndroidLocalDirectChatBlockingContent(message.content)) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (ANDROID_LOCAL_DIRECT_CHAT_DENY_PATTERN.test(text)) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
if (ANDROID_LOCAL_CONTEXTUAL_MEMORY_PATTERN.test(text)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
if (ANDROID_LOCAL_CURRENT_DATA_PATTERN.test(text)) {
|
|
183
|
+
return /\b(local|locally|on[-\s]?device|device|pixel|eliza[-\s]?1|llama)\b/i.test(text);
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
function escapeAndroidLocalChatTemplateTokens(text) {
|
|
188
|
+
return text
|
|
189
|
+
.replaceAll("<|im_start|>", "<| im_start |>")
|
|
190
|
+
.replaceAll("<|im_end|>", "<| im_end |>")
|
|
191
|
+
.replaceAll("<think>", "< think >")
|
|
192
|
+
.replaceAll("</think>", "</ think >");
|
|
193
|
+
}
|
|
194
|
+
function normalizeAndroidLocalDirectUserText(text) {
|
|
195
|
+
return text
|
|
196
|
+
.replace(/(^|\s)\/(?:no_)?think\b/gi, " ")
|
|
197
|
+
.replace(/\s+/g, " ")
|
|
198
|
+
.trim();
|
|
199
|
+
}
|
|
200
|
+
function buildAndroidLocalDirectChatPrompt(args) {
|
|
201
|
+
const systemText = [
|
|
202
|
+
"Eliza-1 on device.",
|
|
203
|
+
"One natural sentence under 10 words. Stop after it.",
|
|
204
|
+
"If asked local/on-device: yes, local Eliza-1.",
|
|
205
|
+
"No markdown, labels, tools, logs, or hidden reasoning.",
|
|
206
|
+
].join("\n");
|
|
207
|
+
return [
|
|
208
|
+
"<|im_start|>system",
|
|
209
|
+
systemText,
|
|
210
|
+
"<|im_end|>",
|
|
211
|
+
"<|im_start|>user",
|
|
212
|
+
escapeAndroidLocalChatTemplateTokens(args.userText),
|
|
213
|
+
"<|im_end|>",
|
|
214
|
+
"<|im_start|>assistant",
|
|
215
|
+
// Match llama.cpp's Qwen3 `enable_thinking=false` chat-template shape.
|
|
216
|
+
// The direct mobile path is for short voice/chat replies; pre-filling an
|
|
217
|
+
// empty think block prevents the model from spending its first tokens on
|
|
218
|
+
// hidden `<think>...</think>` scaffolding before any speakable text.
|
|
219
|
+
"<think>",
|
|
220
|
+
"",
|
|
221
|
+
"</think>",
|
|
222
|
+
"",
|
|
223
|
+
].join("\n");
|
|
224
|
+
}
|
|
225
|
+
function extractAndroidLocalModelText(raw) {
|
|
226
|
+
if (typeof raw === "string") {
|
|
227
|
+
return raw;
|
|
228
|
+
}
|
|
229
|
+
if (!raw || typeof raw !== "object") {
|
|
230
|
+
return "";
|
|
231
|
+
}
|
|
232
|
+
const record = raw;
|
|
233
|
+
if (typeof record.text === "string") {
|
|
234
|
+
return record.text;
|
|
235
|
+
}
|
|
236
|
+
if (typeof record.content === "string") {
|
|
237
|
+
return record.content;
|
|
238
|
+
}
|
|
239
|
+
if (Array.isArray(record.content)) {
|
|
240
|
+
return record.content
|
|
241
|
+
.map((part) => {
|
|
242
|
+
if (typeof part === "string")
|
|
243
|
+
return part;
|
|
244
|
+
if (part && typeof part === "object") {
|
|
245
|
+
const partRecord = part;
|
|
246
|
+
return typeof partRecord.text === "string" ? partRecord.text : "";
|
|
247
|
+
}
|
|
248
|
+
return "";
|
|
249
|
+
})
|
|
250
|
+
.join("");
|
|
251
|
+
}
|
|
252
|
+
return "";
|
|
253
|
+
}
|
|
254
|
+
function truncateAndroidLocalReplyToFirstSentence(text) {
|
|
255
|
+
const compact = text.replace(/\s+/g, " ").trim();
|
|
256
|
+
if (!compact)
|
|
257
|
+
return "";
|
|
258
|
+
const firstSentence = compact.match(/^(.{12,280}?[.!?])(?:\s|$)/u)?.[1];
|
|
259
|
+
return (firstSentence ?? compact).trim();
|
|
260
|
+
}
|
|
261
|
+
function stripAndroidLocalReasoning(text) {
|
|
262
|
+
let next = text.replace(/<think>[\s\S]*?<\/think>/gi, "");
|
|
263
|
+
const danglingClose = next.lastIndexOf("</think>");
|
|
264
|
+
if (danglingClose >= 0) {
|
|
265
|
+
next = next.slice(danglingClose + "</think>".length);
|
|
266
|
+
}
|
|
267
|
+
const danglingOpen = next.indexOf("<think>");
|
|
268
|
+
if (danglingOpen >= 0) {
|
|
269
|
+
next = next.slice(0, danglingOpen);
|
|
270
|
+
}
|
|
271
|
+
return next;
|
|
272
|
+
}
|
|
273
|
+
function cleanAndroidLocalDirectChatReply(raw) {
|
|
274
|
+
let text = stripAndroidLocalReasoning(extractAndroidLocalModelText(raw));
|
|
275
|
+
text = text
|
|
276
|
+
.split("<|im_end|>")[0]
|
|
277
|
+
.split("<|im_start|>")[0]
|
|
278
|
+
.replace(/^\s*(assistant|eliza)\s*:\s*/i, "")
|
|
279
|
+
.replace(/\bEliza-1\b/gi, "Eliza-1")
|
|
280
|
+
.trim();
|
|
281
|
+
text = truncateAndroidLocalReplyToFirstSentence(text);
|
|
282
|
+
if (text.length <= 700) {
|
|
283
|
+
return text;
|
|
284
|
+
}
|
|
285
|
+
const truncated = text.slice(0, 700);
|
|
286
|
+
const sentenceEnd = Math.max(truncated.lastIndexOf("."), truncated.lastIndexOf("!"), truncated.lastIndexOf("?"));
|
|
287
|
+
return (sentenceEnd >= 80 ? truncated.slice(0, sentenceEnd + 1) : truncated).trim();
|
|
288
|
+
}
|
|
289
|
+
async function rewriteDirectActionCallbackText(args) {
|
|
290
|
+
const text = args.text.trim();
|
|
291
|
+
if (!text)
|
|
292
|
+
return args.text;
|
|
293
|
+
const fallback = () => {
|
|
294
|
+
const error = typeof args.content?.error === "string" && args.content.error.trim()
|
|
295
|
+
? ` It reported: ${args.content.error.trim()}`
|
|
296
|
+
: "";
|
|
297
|
+
return `I ran ${args.actionName} and got a result, but I couldn't format the details cleanly here.${error}`;
|
|
298
|
+
};
|
|
299
|
+
try {
|
|
300
|
+
const raw = await args.runtime.useModel(ModelType.TEXT_SMALL, {
|
|
301
|
+
prompt: [
|
|
302
|
+
"Rewrite this direct action callback in the assistant character's user-facing voice.",
|
|
303
|
+
'Return strict JSON only: {"response":"..."}.',
|
|
304
|
+
"",
|
|
305
|
+
"Rules:",
|
|
306
|
+
"- Preserve status, IDs, names, URLs, counts, errors, and next steps.",
|
|
307
|
+
"- Do not expose raw JSON, shell output, schema names, stack traces, or internal action plumbing unless an exact value is necessary.",
|
|
308
|
+
"- Do not claim success if the payload says failed or pending.",
|
|
309
|
+
"- Keep it brief and natural.",
|
|
310
|
+
"",
|
|
311
|
+
`Character: ${JSON.stringify({
|
|
312
|
+
name: args.runtime.character?.name,
|
|
313
|
+
system: args.runtime.character?.system,
|
|
314
|
+
bio: args.runtime.character?.bio,
|
|
315
|
+
style: args.runtime.character?.style,
|
|
316
|
+
})}`,
|
|
317
|
+
`Action: ${JSON.stringify(args.actionName)}`,
|
|
318
|
+
`Payload: ${JSON.stringify(text)}`,
|
|
319
|
+
`Metadata: ${JSON.stringify({
|
|
320
|
+
source: args.content?.source,
|
|
321
|
+
actions: args.content?.actions,
|
|
322
|
+
actionStatus: args.content?.actionStatus,
|
|
323
|
+
error: args.content?.error,
|
|
324
|
+
})}`,
|
|
325
|
+
].join("\n"),
|
|
326
|
+
maxTokens: 260,
|
|
327
|
+
providerOptions: { eliza: { thinking: "off" } },
|
|
328
|
+
});
|
|
329
|
+
const parsed = JSON.parse(String(raw).trim());
|
|
330
|
+
return typeof parsed.response === "string" && parsed.response.trim()
|
|
331
|
+
? parsed.response.trim()
|
|
332
|
+
: fallback();
|
|
333
|
+
}
|
|
334
|
+
catch (err) {
|
|
335
|
+
args.runtime.logger.debug({
|
|
336
|
+
src: "eliza-api",
|
|
337
|
+
action: args.actionName,
|
|
338
|
+
err: err instanceof Error ? err.message : String(err),
|
|
339
|
+
}, "[eliza-api] Direct action callback voice rewrite failed");
|
|
340
|
+
return fallback();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async function maybeGenerateAndroidLocalDirectChatResponse(args) {
|
|
344
|
+
if (!shouldUseAndroidLocalDirectChat(args.runtime, args.message)) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const userText = normalizeAndroidLocalDirectUserText(extractCompatTextContent(args.message.content));
|
|
348
|
+
if (!userText)
|
|
349
|
+
return null;
|
|
350
|
+
const prompt = buildAndroidLocalDirectChatPrompt({
|
|
351
|
+
runtime: args.runtime,
|
|
352
|
+
userText,
|
|
353
|
+
});
|
|
354
|
+
const maxTokens = readPositiveIntegerSetting(args.runtime, "ELIZA_MOBILE_LOCAL_DIRECT_REPLY_MAX_TOKENS", 20);
|
|
355
|
+
const startedAt = Date.now();
|
|
356
|
+
args.runtime.logger.info({
|
|
357
|
+
src: "eliza-api",
|
|
358
|
+
promptChars: prompt.length,
|
|
359
|
+
maxTokens,
|
|
360
|
+
messageId: args.message.id,
|
|
361
|
+
}, "[eliza-api] Android local direct chat fast path start");
|
|
362
|
+
let streamedRaw = "";
|
|
363
|
+
let lastStreamedSnapshot = "";
|
|
364
|
+
let streamedChunks = 0;
|
|
365
|
+
const emitCleanStreamingSnapshot = (snapshot) => {
|
|
366
|
+
if (!snapshot || snapshot === lastStreamedSnapshot)
|
|
367
|
+
return;
|
|
368
|
+
const update = resolveStreamingUpdate(lastStreamedSnapshot, snapshot);
|
|
369
|
+
if (update.kind === "append") {
|
|
370
|
+
args.opts?.onChunk?.(update.emittedText);
|
|
371
|
+
}
|
|
372
|
+
else if (update.kind === "replace" && !args.opts?.onSnapshot) {
|
|
373
|
+
// OpenAI-compatible SSE cannot rewrite already-sent text. In the rare
|
|
374
|
+
// case cleaning turns a partial local reply into a non-append snapshot,
|
|
375
|
+
// hold the rewrite for the final response body instead of duplicating
|
|
376
|
+
// content on the token stream.
|
|
377
|
+
args.runtime.logger.debug({
|
|
378
|
+
src: "eliza-api",
|
|
379
|
+
previousChars: lastStreamedSnapshot.length,
|
|
380
|
+
nextChars: snapshot.length,
|
|
381
|
+
messageId: args.message.id,
|
|
382
|
+
}, "[eliza-api] Android local direct chat fast path held non-append streaming snapshot");
|
|
383
|
+
}
|
|
384
|
+
args.opts?.onSnapshot?.(snapshot);
|
|
385
|
+
lastStreamedSnapshot = snapshot;
|
|
386
|
+
};
|
|
387
|
+
const raw = await args.runtime.useModel(ModelType.TEXT_SMALL, {
|
|
388
|
+
prompt,
|
|
389
|
+
maxTokens,
|
|
390
|
+
stopSequences: ["<|im_end|>", "<|im_start|>"],
|
|
391
|
+
temperature: 0,
|
|
392
|
+
providerOptions: {
|
|
393
|
+
eliza: {
|
|
394
|
+
thinking: "off",
|
|
395
|
+
},
|
|
396
|
+
androidLocal: {
|
|
397
|
+
stopOnFirstSentence: true,
|
|
398
|
+
minFirstSentenceChars: 12,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
signal: args.signal,
|
|
402
|
+
stream: true,
|
|
403
|
+
onStreamChunk: (chunk) => {
|
|
404
|
+
streamedRaw += chunk;
|
|
405
|
+
streamedChunks += 1;
|
|
406
|
+
const snapshot = cleanAndroidLocalDirectChatReply(streamedRaw);
|
|
407
|
+
emitCleanStreamingSnapshot(snapshot);
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
const text = cleanAndroidLocalDirectChatReply(raw);
|
|
411
|
+
if (!text) {
|
|
412
|
+
args.runtime.logger.warn({ src: "eliza-api", messageId: args.message.id }, "[eliza-api] Android local direct chat fast path returned empty text");
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const latencyMs = Date.now() - startedAt;
|
|
416
|
+
emitCleanStreamingSnapshot(text);
|
|
417
|
+
const localInference = {
|
|
418
|
+
provider: "mobile-local-direct-reply",
|
|
419
|
+
mode: "api_fast_path",
|
|
420
|
+
latencyMs,
|
|
421
|
+
promptChars: prompt.length,
|
|
422
|
+
maxTokens,
|
|
423
|
+
streamedChunks,
|
|
424
|
+
};
|
|
425
|
+
const responseContent = {
|
|
426
|
+
text,
|
|
427
|
+
source: "client_chat",
|
|
428
|
+
actions: ["REPLY"],
|
|
429
|
+
localInference,
|
|
430
|
+
};
|
|
431
|
+
args.runtime.logger.info({
|
|
432
|
+
src: "eliza-api",
|
|
433
|
+
latencyMs,
|
|
434
|
+
textChars: text.length,
|
|
435
|
+
messageId: args.message.id,
|
|
436
|
+
}, "[eliza-api] Android local direct chat fast path done");
|
|
437
|
+
return {
|
|
438
|
+
text,
|
|
439
|
+
agentName: args.agentName,
|
|
440
|
+
localInference,
|
|
441
|
+
responseContent,
|
|
442
|
+
usage: {
|
|
443
|
+
promptTokens: estimateTokenCount(prompt),
|
|
444
|
+
completionTokens: estimateTokenCount(text),
|
|
445
|
+
totalTokens: estimateTokenCount(prompt) + estimateTokenCount(text),
|
|
446
|
+
model: detectRuntimeModel(args.runtime, undefined) ?? undefined,
|
|
447
|
+
provider: "mobile-local-direct-reply",
|
|
448
|
+
isEstimated: true,
|
|
449
|
+
llmCalls: 1,
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function resolveCallbackMergeMode(content, fallback = "replace") {
|
|
454
|
+
return content.merge === "append" || content.merge === "replace"
|
|
455
|
+
? content.merge
|
|
456
|
+
: fallback;
|
|
457
|
+
}
|
|
458
|
+
function normalizeActionCallbackText(text) {
|
|
459
|
+
return text.trim();
|
|
460
|
+
}
|
|
461
|
+
function getLatestVisibleResponseMessageText(responseMessages) {
|
|
462
|
+
if (!Array.isArray(responseMessages) || responseMessages.length === 0) {
|
|
463
|
+
return "";
|
|
464
|
+
}
|
|
465
|
+
for (let index = responseMessages.length - 1; index >= 0; index -= 1) {
|
|
466
|
+
const content = responseMessages[index]?.content;
|
|
467
|
+
const text = typeof extractCompatTextContent(content) === "string"
|
|
468
|
+
? extractCompatTextContent(content).trim()
|
|
469
|
+
: "";
|
|
470
|
+
if (!text || isNoResponsePlaceholder(text)) {
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
return text;
|
|
474
|
+
}
|
|
475
|
+
return "";
|
|
476
|
+
}
|
|
477
|
+
const EXACT_GROUNDED_VALUE_REQUEST = /\b(?:exact|verbatim|copy|quoted?|identifier|codeword|return only|only the)\b/i;
|
|
478
|
+
const DOCUMENT_VALUE_CAPTURE = /\b(?:codeword|identifier|token|value)\s*(?:is|=|:)\s*([A-Za-z0-9][A-Za-z0-9._-]{1,127})\b/gi;
|
|
479
|
+
const UPPERCASE_IDENTIFIER_CAPTURE = /\b[A-Z0-9]+(?:[-_][A-Z0-9]+)+\b/g;
|
|
480
|
+
const UUID_IDENTIFIER_CAPTURE = /\b[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}\b/gi;
|
|
481
|
+
function uniqueMatches(matches) {
|
|
482
|
+
return Array.from(new Set(Array.from(matches).map((value) => value.trim()))).filter((value) => value.length > 0);
|
|
483
|
+
}
|
|
484
|
+
function collectRegexMatches(text, pattern, groupIndex) {
|
|
485
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
486
|
+
return Array.from(text.matchAll(regex), (match) => String(groupIndex === undefined ? match[0] : (match[groupIndex] ?? "")));
|
|
487
|
+
}
|
|
488
|
+
function extractExactGroundedValueFromText(messageText, documentText) {
|
|
489
|
+
if (!messageText || !EXACT_GROUNDED_VALUE_REQUEST.test(messageText)) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
if (!documentText) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
const capturedDocumentValues = uniqueMatches(collectRegexMatches(documentText, DOCUMENT_VALUE_CAPTURE, 1));
|
|
496
|
+
if (capturedDocumentValues.length === 1) {
|
|
497
|
+
return capturedDocumentValues[0];
|
|
498
|
+
}
|
|
499
|
+
const uppercaseCandidates = uniqueMatches(collectRegexMatches(documentText, UPPERCASE_IDENTIFIER_CAPTURE));
|
|
500
|
+
if (uppercaseCandidates.length === 1) {
|
|
501
|
+
return uppercaseCandidates[0];
|
|
502
|
+
}
|
|
503
|
+
const uuidCandidates = uniqueMatches(collectRegexMatches(documentText, UUID_IDENTIFIER_CAPTURE));
|
|
504
|
+
if (uuidCandidates.length === 1) {
|
|
505
|
+
return uuidCandidates[0];
|
|
506
|
+
}
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
async function resolveExactDocumentValueForChat(runtime, message) {
|
|
510
|
+
const messageText = typeof extractCompatTextContent(message.content) === "string"
|
|
511
|
+
? extractCompatTextContent(message.content).trim()
|
|
512
|
+
: "";
|
|
513
|
+
if (!messageText || !EXACT_GROUNDED_VALUE_REQUEST.test(messageText)) {
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
const documentsService = runtime.getService("documents");
|
|
517
|
+
if (!documentsService ||
|
|
518
|
+
typeof documentsService.searchDocuments !== "function") {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
try {
|
|
522
|
+
const matches = await documentsService.searchDocuments(message);
|
|
523
|
+
if (!Array.isArray(matches) || matches.length === 0) {
|
|
524
|
+
return null;
|
|
525
|
+
}
|
|
526
|
+
const uploadedMatches = matches.filter((match) => {
|
|
527
|
+
const metadata = match.metadata && typeof match.metadata === "object"
|
|
528
|
+
? match.metadata
|
|
529
|
+
: null;
|
|
530
|
+
return metadata?.source === "upload";
|
|
531
|
+
});
|
|
532
|
+
const preferredMatches = uploadedMatches.length > 0 ? uploadedMatches : matches;
|
|
533
|
+
const exactMatchCandidates = uniqueMatches(preferredMatches
|
|
534
|
+
.map((match) => typeof match.content?.text === "string"
|
|
535
|
+
? extractExactGroundedValueFromText(messageText, match.content.text.trim())
|
|
536
|
+
: null)
|
|
537
|
+
.filter((value) => typeof value === "string"));
|
|
538
|
+
if (exactMatchCandidates.length === 1) {
|
|
539
|
+
return exactMatchCandidates[0];
|
|
540
|
+
}
|
|
541
|
+
const documentsText = preferredMatches
|
|
542
|
+
.map((match) => typeof match.content?.text === "string"
|
|
543
|
+
? match.content.text.trim()
|
|
544
|
+
: "")
|
|
545
|
+
.filter((text) => text.length > 0)
|
|
546
|
+
.join("\n\n");
|
|
547
|
+
return extractExactGroundedValueFromText(messageText, documentsText);
|
|
548
|
+
}
|
|
549
|
+
catch {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
// ---------------------------------------------------------------------------
|
|
554
|
+
// Chat failure / no-response helpers
|
|
555
|
+
// ---------------------------------------------------------------------------
|
|
556
|
+
// Reserved for path #4 — actual generation throw caught by getChatFailureReply.
|
|
557
|
+
// Do NOT use as the generic empty-response fallback; that mislabels every
|
|
558
|
+
// IGNORE / empty-action / empty-normalized-text path as a provider failure.
|
|
559
|
+
const PROVIDER_ISSUE_CHAT_REPLY = "Sorry, I'm having a provider issue";
|
|
560
|
+
const INSUFFICIENT_CREDITS_CHAT_REPLY = "Eliza Cloud credits are depleted. Top up the cloud balance and try again.";
|
|
561
|
+
// Used by paths #1-#3: planner picked IGNORE/NONE/empty REPLY, action ran but
|
|
562
|
+
// emitted no text callback, or normalized text became empty. None of these are
|
|
563
|
+
// provider failures, so the message must not blame the provider.
|
|
564
|
+
const NO_RESPONSE_FALLBACK_REPLY = "I don't have a reply for that — try rephrasing?";
|
|
565
|
+
// Routed-model errors raised by the model router when no provider plugin is
|
|
566
|
+
// loaded for a requested model class (e.g. TEXT_SMALL). Identifies the OOB
|
|
567
|
+
// "no provider configured" case so chat routes can return a structured 503
|
|
568
|
+
// instead of a generic 500 — UI clients gate on `error.type === "no_provider"`
|
|
569
|
+
// to render a "Connect a provider" CTA instead of an opaque error toast.
|
|
570
|
+
const NO_PROVIDER_ERROR_FRAGMENTS = [
|
|
571
|
+
"No provider registered for",
|
|
572
|
+
"No model registered for",
|
|
573
|
+
];
|
|
574
|
+
function isNoProviderError(err) {
|
|
575
|
+
const msg = err instanceof Error ? err.message : typeof err === "string" ? err : "";
|
|
576
|
+
return NO_PROVIDER_ERROR_FRAGMENTS.some((frag) => msg.includes(frag));
|
|
577
|
+
}
|
|
578
|
+
const NO_PROVIDER_CHAT_MESSAGE = "Connect an LLM provider to start chatting. Open Settings → Providers, " +
|
|
579
|
+
"or choose Eliza Cloud during first-run setup.";
|
|
580
|
+
const DEFAULT_CHAT_GENERATION_TIMEOUT_MS = 180_000;
|
|
581
|
+
const NON_EXECUTABLE_FALLBACK_ACTIONS = new Set(["REPLY", "NONE", "IGNORE"]);
|
|
582
|
+
function isExecutableFallbackAction(action) {
|
|
583
|
+
return !NON_EXECUTABLE_FALLBACK_ACTIONS.has(action.name);
|
|
584
|
+
}
|
|
585
|
+
function classifySyntheticChatFailureText(text) {
|
|
586
|
+
const normalized = text
|
|
587
|
+
.trim()
|
|
588
|
+
.toLowerCase()
|
|
589
|
+
.replace(/[’]/g, "'")
|
|
590
|
+
.replace(/\s+/g, " ");
|
|
591
|
+
if (!normalized)
|
|
592
|
+
return null;
|
|
593
|
+
if (normalized === PROVIDER_ISSUE_CHAT_REPLY.toLowerCase()) {
|
|
594
|
+
return "provider_issue";
|
|
595
|
+
}
|
|
596
|
+
if (/\bprovider issue\b/.test(normalized)) {
|
|
597
|
+
return "provider_issue";
|
|
598
|
+
}
|
|
599
|
+
if (normalized === NO_RESPONSE_FALLBACK_REPLY.toLowerCase()) {
|
|
600
|
+
return "no_response";
|
|
601
|
+
}
|
|
602
|
+
if (normalized === INSUFFICIENT_CREDITS_CHAT_REPLY.toLowerCase()) {
|
|
603
|
+
return "insufficient_credits";
|
|
604
|
+
}
|
|
605
|
+
if (normalized === NO_PROVIDER_CHAT_MESSAGE.toLowerCase()) {
|
|
606
|
+
return "no_provider";
|
|
607
|
+
}
|
|
608
|
+
if (normalized === "something went wrong on my end. please try again.") {
|
|
609
|
+
return "transient_failure";
|
|
610
|
+
}
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
export function markSyntheticChatFailureContent(content) {
|
|
614
|
+
const text = extractCompatTextContent(content);
|
|
615
|
+
const failureKind = typeof content.failureKind === "string"
|
|
616
|
+
? content.failureKind
|
|
617
|
+
: classifySyntheticChatFailureText(text);
|
|
618
|
+
if (!failureKind)
|
|
619
|
+
return content;
|
|
620
|
+
const metadata = asRecord(content.metadata) ?? {};
|
|
621
|
+
return {
|
|
622
|
+
...content,
|
|
623
|
+
metadata: {
|
|
624
|
+
...metadata,
|
|
625
|
+
elizaSyntheticFailure: true,
|
|
626
|
+
chatFailureKind: failureKind,
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function normalizeActionName(value) {
|
|
631
|
+
return typeof value === "string" ? value.trim().toUpperCase() : "";
|
|
632
|
+
}
|
|
633
|
+
function ensureMessageMemoryContent(content) {
|
|
634
|
+
return typeof content.text === "string"
|
|
635
|
+
? { ...content, text: content.text }
|
|
636
|
+
: { ...content, text: "" };
|
|
637
|
+
}
|
|
638
|
+
function buildRuntimeActionNameLookup(runtime) {
|
|
639
|
+
const lookup = new Map();
|
|
640
|
+
const runtimeActions = Array.isArray(runtime.actions)
|
|
641
|
+
? runtime.actions
|
|
642
|
+
: [];
|
|
643
|
+
for (const action of runtimeActions) {
|
|
644
|
+
const canonicalName = normalizeActionName(action.name);
|
|
645
|
+
if (!canonicalName) {
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
lookup.set(canonicalName, canonicalName);
|
|
649
|
+
if (!Array.isArray(action.similes)) {
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
for (const alias of action.similes) {
|
|
653
|
+
const normalizedAlias = normalizeActionName(alias);
|
|
654
|
+
if (normalizedAlias) {
|
|
655
|
+
lookup.set(normalizedAlias, canonicalName);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return lookup;
|
|
660
|
+
}
|
|
661
|
+
function readRuntimeActionResults(runtime, messageId) {
|
|
662
|
+
if (!messageId) {
|
|
663
|
+
return [];
|
|
664
|
+
}
|
|
665
|
+
const getActionResults = runtime.getActionResults;
|
|
666
|
+
if (typeof getActionResults !== "function") {
|
|
667
|
+
return [];
|
|
668
|
+
}
|
|
669
|
+
try {
|
|
670
|
+
return getActionResults(messageId);
|
|
671
|
+
}
|
|
672
|
+
catch {
|
|
673
|
+
return [];
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function listExecutedRuntimeActions(runtime, messageId) {
|
|
677
|
+
return new Set(readRuntimeActionResults(runtime, messageId)
|
|
678
|
+
.map((result) => {
|
|
679
|
+
if (typeof result === "string") {
|
|
680
|
+
return normalizeActionName(result);
|
|
681
|
+
}
|
|
682
|
+
if (!result || typeof result !== "object") {
|
|
683
|
+
return "";
|
|
684
|
+
}
|
|
685
|
+
const record = result;
|
|
686
|
+
if (typeof record.actionName === "string") {
|
|
687
|
+
return normalizeActionName(record.actionName);
|
|
688
|
+
}
|
|
689
|
+
const data = record.data && typeof record.data === "object"
|
|
690
|
+
? record.data
|
|
691
|
+
: null;
|
|
692
|
+
return normalizeActionName(data?.actionName);
|
|
693
|
+
})
|
|
694
|
+
.filter((name) => name.length > 0));
|
|
695
|
+
}
|
|
696
|
+
function sanitizeActionResultValue(value, depth = 0) {
|
|
697
|
+
if (value === null)
|
|
698
|
+
return null;
|
|
699
|
+
if (typeof value === "boolean")
|
|
700
|
+
return value;
|
|
701
|
+
if (typeof value === "number")
|
|
702
|
+
return Number.isFinite(value) ? value : undefined;
|
|
703
|
+
if (typeof value === "string") {
|
|
704
|
+
return value.length > 1000 ? `${value.slice(0, 997)}...` : value;
|
|
705
|
+
}
|
|
706
|
+
if (Array.isArray(value)) {
|
|
707
|
+
if (depth >= 2)
|
|
708
|
+
return undefined;
|
|
709
|
+
return value
|
|
710
|
+
.slice(0, 20)
|
|
711
|
+
.map((entry) => sanitizeActionResultValue(entry, depth + 1))
|
|
712
|
+
.filter((entry) => entry !== undefined);
|
|
713
|
+
}
|
|
714
|
+
if (value && typeof value === "object") {
|
|
715
|
+
if (depth >= 2)
|
|
716
|
+
return undefined;
|
|
717
|
+
const output = {};
|
|
718
|
+
for (const [key, entry] of Object.entries(value).slice(0, 20)) {
|
|
719
|
+
const safe = sanitizeActionResultValue(entry, depth + 1);
|
|
720
|
+
if (safe !== undefined)
|
|
721
|
+
output[key] = safe;
|
|
722
|
+
}
|
|
723
|
+
return output;
|
|
724
|
+
}
|
|
725
|
+
return undefined;
|
|
726
|
+
}
|
|
727
|
+
function sanitizeActionResultValues(values) {
|
|
728
|
+
if (!values || typeof values !== "object" || Array.isArray(values))
|
|
729
|
+
return undefined;
|
|
730
|
+
const output = {};
|
|
731
|
+
for (const [key, value] of Object.entries(values).slice(0, 20)) {
|
|
732
|
+
const safe = sanitizeActionResultValue(value);
|
|
733
|
+
if (safe !== undefined)
|
|
734
|
+
output[key] = safe;
|
|
735
|
+
}
|
|
736
|
+
return Object.keys(output).length > 0 ? output : undefined;
|
|
737
|
+
}
|
|
738
|
+
function summarizeActionResultForClient(result) {
|
|
739
|
+
if (typeof result === "string") {
|
|
740
|
+
const actionName = normalizeActionName(result);
|
|
741
|
+
return actionName ? { actionName, success: true } : null;
|
|
742
|
+
}
|
|
743
|
+
if (!result || typeof result !== "object")
|
|
744
|
+
return null;
|
|
745
|
+
const record = result;
|
|
746
|
+
const data = asRecord(record.data);
|
|
747
|
+
const actionName = (typeof data?.actionName === "string" && data.actionName.trim()) ||
|
|
748
|
+
(typeof record.actionName === "string" && record.actionName.trim()) ||
|
|
749
|
+
undefined;
|
|
750
|
+
const values = sanitizeActionResultValues(record.values);
|
|
751
|
+
const text = typeof record.text === "string" && record.text.trim()
|
|
752
|
+
? String(sanitizeActionResultValue(record.text))
|
|
753
|
+
: undefined;
|
|
754
|
+
const error = typeof record.error === "string" && record.error.trim()
|
|
755
|
+
? String(sanitizeActionResultValue(record.error))
|
|
756
|
+
: record.error instanceof Error
|
|
757
|
+
? record.error.message
|
|
758
|
+
: undefined;
|
|
759
|
+
if (!actionName && !values && !text && !error)
|
|
760
|
+
return null;
|
|
761
|
+
return {
|
|
762
|
+
...(actionName ? { actionName } : {}),
|
|
763
|
+
success: Boolean(record.success),
|
|
764
|
+
...(text ? { text } : {}),
|
|
765
|
+
...(error ? { error } : {}),
|
|
766
|
+
...(values ? { values } : {}),
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
function summarizeRuntimeActionResults(runtime, messageId) {
|
|
770
|
+
return readRuntimeActionResults(runtime, messageId)
|
|
771
|
+
.map(summarizeActionResultForClient)
|
|
772
|
+
.filter((entry) => Boolean(entry))
|
|
773
|
+
.slice(-8);
|
|
774
|
+
}
|
|
775
|
+
function pickInsufficientCreditsChatReply() {
|
|
776
|
+
return INSUFFICIENT_CREDITS_CHAT_REPLY;
|
|
777
|
+
}
|
|
778
|
+
function findRecentInsufficientCreditsLog(logBuffer, lookbackMs = 60_000) {
|
|
779
|
+
const now = Date.now();
|
|
780
|
+
for (let i = logBuffer.length - 1; i >= 0; i--) {
|
|
781
|
+
const entry = logBuffer[i];
|
|
782
|
+
if (now - entry.timestamp > lookbackMs)
|
|
783
|
+
break;
|
|
784
|
+
if (isInsufficientCreditsMessage(entry.message)) {
|
|
785
|
+
return entry;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
export function resolveNoResponseFallback(logBuffer, _runtime, _lang = "en") {
|
|
791
|
+
if (findRecentInsufficientCreditsLog(logBuffer)) {
|
|
792
|
+
return pickInsufficientCreditsChatReply();
|
|
793
|
+
}
|
|
794
|
+
return NO_RESPONSE_FALLBACK_REPLY;
|
|
795
|
+
}
|
|
796
|
+
function getProviderIssueChatReply() {
|
|
797
|
+
return PROVIDER_ISSUE_CHAT_REPLY;
|
|
798
|
+
}
|
|
799
|
+
function resolveChatGenerationTimeoutMs(explicit) {
|
|
800
|
+
if (typeof explicit === "number" &&
|
|
801
|
+
Number.isFinite(explicit) &&
|
|
802
|
+
explicit > 0) {
|
|
803
|
+
return Math.max(1, Math.floor(explicit));
|
|
804
|
+
}
|
|
805
|
+
const fromEnv = process.env.ELIZA_CHAT_GENERATION_TIMEOUT_MS?.trim();
|
|
806
|
+
if (!fromEnv)
|
|
807
|
+
return DEFAULT_CHAT_GENERATION_TIMEOUT_MS;
|
|
808
|
+
const parsed = Number.parseInt(fromEnv, 10);
|
|
809
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
810
|
+
return DEFAULT_CHAT_GENERATION_TIMEOUT_MS;
|
|
811
|
+
}
|
|
812
|
+
return Math.max(1_000, parsed);
|
|
813
|
+
}
|
|
814
|
+
function createChatGenerationTimeoutError(timeoutMs) {
|
|
815
|
+
return new Error(`Chat generation timed out after ${timeoutMs}ms`);
|
|
816
|
+
}
|
|
817
|
+
async function withTimeout(promise, timeoutMs, createError, onTimeout) {
|
|
818
|
+
let timeoutHandle;
|
|
819
|
+
try {
|
|
820
|
+
return await Promise.race([
|
|
821
|
+
promise,
|
|
822
|
+
new Promise((_resolve, reject) => {
|
|
823
|
+
timeoutHandle = setTimeout(() => {
|
|
824
|
+
onTimeout?.();
|
|
825
|
+
reject(createError());
|
|
826
|
+
}, timeoutMs);
|
|
827
|
+
}),
|
|
828
|
+
]);
|
|
829
|
+
}
|
|
830
|
+
finally {
|
|
831
|
+
if (timeoutHandle) {
|
|
832
|
+
clearTimeout(timeoutHandle);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
export function getChatFailureReply(err, logBuffer) {
|
|
837
|
+
if (isInsufficientCreditsError(err) ||
|
|
838
|
+
findRecentInsufficientCreditsLog(logBuffer)) {
|
|
839
|
+
return pickInsufficientCreditsChatReply();
|
|
840
|
+
}
|
|
841
|
+
if (isNoProviderError(err)) {
|
|
842
|
+
return NO_PROVIDER_CHAT_MESSAGE;
|
|
843
|
+
}
|
|
844
|
+
return getProviderIssueChatReply();
|
|
845
|
+
}
|
|
846
|
+
export function classifyChatFailure(err, logBuffer) {
|
|
847
|
+
if (isInsufficientCreditsError(err) ||
|
|
848
|
+
findRecentInsufficientCreditsLog(logBuffer)) {
|
|
849
|
+
return "insufficient_credits";
|
|
850
|
+
}
|
|
851
|
+
if (isNoProviderError(err)) {
|
|
852
|
+
return "no_provider";
|
|
853
|
+
}
|
|
854
|
+
if (isLocalInferenceError(err)) {
|
|
855
|
+
return "local_inference";
|
|
856
|
+
}
|
|
857
|
+
return "provider_issue";
|
|
858
|
+
}
|
|
859
|
+
function normalizeIntentText(text) {
|
|
860
|
+
return text
|
|
861
|
+
.toLowerCase()
|
|
862
|
+
.replace(/[`"'“”‘’]/g, "")
|
|
863
|
+
.replace(/[_-]+/g, " ")
|
|
864
|
+
.replace(/\s+/g, " ")
|
|
865
|
+
.trim();
|
|
866
|
+
}
|
|
867
|
+
function hasLocalInferenceMetadata(message) {
|
|
868
|
+
const contentMetadata = asRecord(message.content.metadata) ?? {};
|
|
869
|
+
const messageMetadata = asRecord(message.metadata) ?? {};
|
|
870
|
+
const metadata = { ...contentMetadata, ...messageMetadata };
|
|
871
|
+
const localValue = metadata.localInference ??
|
|
872
|
+
metadata.localInferenceContext ??
|
|
873
|
+
metadata.localModel ??
|
|
874
|
+
metadata.modelHub;
|
|
875
|
+
if (localValue === true)
|
|
876
|
+
return true;
|
|
877
|
+
if (typeof localValue === "string") {
|
|
878
|
+
return /^(1|true|yes|local|local-inference|model-hub)$/i.test(localValue.trim());
|
|
879
|
+
}
|
|
880
|
+
const context = typeof metadata.context === "string"
|
|
881
|
+
? metadata.context
|
|
882
|
+
: typeof metadata.scope === "string"
|
|
883
|
+
? metadata.scope
|
|
884
|
+
: "";
|
|
885
|
+
return /\blocal[-_\s]?inference\b|\bmodel[-_\s]?hub\b/i.test(context);
|
|
886
|
+
}
|
|
887
|
+
function hasLocalInferenceTopic(text) {
|
|
888
|
+
return (/\b(local|locally|on device|on-device|device model|local model|local inference|model hub|gguf|llama|inference|provider|runtime)\b/i.test(text) || /\bmodel\s+(?:download|install|load|setup)\b/i.test(text));
|
|
889
|
+
}
|
|
890
|
+
function isImperativeCloudOrLocalRouting(text) {
|
|
891
|
+
return /^(?:please\s+)?(?:use|switch|prefer|route|go|move)\s+(?:me\s+)?(?:to\s+)?(?:the\s+)?(?:cloud|local|on device|on-device)\b/i.test(text);
|
|
892
|
+
}
|
|
893
|
+
export function detectLocalInferenceCommandIntent(text, options = {}) {
|
|
894
|
+
const normalized = normalizeIntentText(text);
|
|
895
|
+
if (!normalized)
|
|
896
|
+
return null;
|
|
897
|
+
const explicitContext = options.localInferenceContext === true ||
|
|
898
|
+
hasLocalInferenceTopic(normalized) ||
|
|
899
|
+
isImperativeCloudOrLocalRouting(normalized);
|
|
900
|
+
if (!explicitContext)
|
|
901
|
+
return null;
|
|
902
|
+
if (/\b(?:use|switch|prefer|route|go|move)\s+(?:to\s+)?(?:the\s+)?cloud\b/.test(normalized) ||
|
|
903
|
+
/\bcloud\s+(?:mode|provider|inference|model|routing)\b/.test(normalized)) {
|
|
904
|
+
return "use_cloud";
|
|
905
|
+
}
|
|
906
|
+
if (/\b(?:status|progress|state|ready|loaded|loading|how far|what model)\b/.test(normalized) &&
|
|
907
|
+
(options.localInferenceContext === true ||
|
|
908
|
+
/\b(?:download|model|local|inference|gguf|eliza-1|provider|runtime)\b/.test(normalized))) {
|
|
909
|
+
return "status";
|
|
910
|
+
}
|
|
911
|
+
if (/\b(?:use|switch|prefer|route|go|move)\s+(?:to\s+)?(?:the\s+)?(?:local|on device|on device model)\b/.test(normalized) ||
|
|
912
|
+
/\b(?:local|on device)\s+(?:mode|provider|inference|model|routing)\b/.test(normalized)) {
|
|
913
|
+
return "use_local";
|
|
914
|
+
}
|
|
915
|
+
if (/\b(?:smaller|smallest|tiny|lighter|lightweight|less memory|low ram|low memory)\b/.test(normalized) &&
|
|
916
|
+
/\b(?:switch|use|load|pick|select|change|model)\b/.test(normalized)) {
|
|
917
|
+
return "switch_smaller";
|
|
918
|
+
}
|
|
919
|
+
if (/\b(?:cancel|stop|abort|halt)\b/.test(normalized) &&
|
|
920
|
+
/\b(?:download|model|local|inference)\b/.test(normalized)) {
|
|
921
|
+
return "cancel";
|
|
922
|
+
}
|
|
923
|
+
if (/\b(?:re download|redownload|download again|fresh download)\b/.test(normalized)) {
|
|
924
|
+
return "redownload";
|
|
925
|
+
}
|
|
926
|
+
if (/\b(?:retry|try again|resume|continue|restart)\b/.test(normalized) &&
|
|
927
|
+
/\b(?:download|model|local|inference)\b/.test(normalized)) {
|
|
928
|
+
return normalized.includes("resume") || normalized.includes("continue")
|
|
929
|
+
? "resume"
|
|
930
|
+
: "retry";
|
|
931
|
+
}
|
|
932
|
+
if (/\b(?:download|install|get|fetch|pull)\b/.test(normalized) &&
|
|
933
|
+
(options.localInferenceContext === true ||
|
|
934
|
+
/\b(?:model|local|inference|gguf|eliza-1)\b/.test(normalized))) {
|
|
935
|
+
return "download";
|
|
936
|
+
}
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
export function isLocalInferenceError(err) {
|
|
940
|
+
const message = err instanceof Error ? err.message : typeof err === "string" ? err : "";
|
|
941
|
+
return /\b(?:local inference|local model|on-device|device bridge|llama|gguf|capacitor-llama|no local model|model download|enospc|no space left|disk full)\b/i.test(message);
|
|
942
|
+
}
|
|
943
|
+
export function normalizeChatResponseText(text, logBuffer, runtime) {
|
|
944
|
+
// Both fallback strings can hit this path; either should be re-routed to
|
|
945
|
+
// the insufficient-credits reply when a recent credits log explains why
|
|
946
|
+
// generation produced nothing.
|
|
947
|
+
const visibleText = extractAssistantReplyText(text) ?? text;
|
|
948
|
+
const trimmed = visibleText.trim();
|
|
949
|
+
if ((trimmed === PROVIDER_ISSUE_CHAT_REPLY ||
|
|
950
|
+
trimmed === NO_RESPONSE_FALLBACK_REPLY) &&
|
|
951
|
+
findRecentInsufficientCreditsLog(logBuffer)) {
|
|
952
|
+
return pickInsufficientCreditsChatReply();
|
|
953
|
+
}
|
|
954
|
+
if (!isClientVisibleNoResponse(visibleText))
|
|
955
|
+
return visibleText;
|
|
956
|
+
return resolveNoResponseFallback(logBuffer, runtime);
|
|
957
|
+
}
|
|
958
|
+
function listResponseActions(responseContent) {
|
|
959
|
+
if (!Array.isArray(responseContent?.actions)) {
|
|
960
|
+
return [];
|
|
961
|
+
}
|
|
962
|
+
return responseContent.actions
|
|
963
|
+
.map((action) => typeof action === "string" ? action.trim().toUpperCase() : "")
|
|
964
|
+
.filter((action) => action.length > 0);
|
|
965
|
+
}
|
|
966
|
+
function isIntentionalNoResponseResult(result, candidateText) {
|
|
967
|
+
if (!result)
|
|
968
|
+
return false;
|
|
969
|
+
const actions = listResponseActions(result.responseContent);
|
|
970
|
+
const hasSilentTerminalAction = actions.length === 1 && (actions[0] === "IGNORE" || actions[0] === "STOP");
|
|
971
|
+
const hasNoVisibleText = candidateText.trim().length === 0 ||
|
|
972
|
+
isClientVisibleNoResponse(candidateText);
|
|
973
|
+
return (hasNoVisibleText && (result.didRespond === false || hasSilentTerminalAction));
|
|
974
|
+
}
|
|
975
|
+
function buildUnexecutedActionPayloadReply(actionNames) {
|
|
976
|
+
const uniqueNames = [
|
|
977
|
+
...new Set(actionNames.map((name) => normalizeActionName(name)).filter(Boolean)),
|
|
978
|
+
];
|
|
979
|
+
const actionsLabel = uniqueNames.length > 0 ? uniqueNames.join(", ") : "unknown";
|
|
980
|
+
return [
|
|
981
|
+
"I could not complete that request because the model returned actions that were not executed.",
|
|
982
|
+
`Unexecuted actions: ${actionsLabel}.`,
|
|
983
|
+
"No side effects were applied.",
|
|
984
|
+
].join("\n");
|
|
985
|
+
}
|
|
986
|
+
// ---------------------------------------------------------------------------
|
|
987
|
+
// SSE helpers
|
|
988
|
+
// ---------------------------------------------------------------------------
|
|
989
|
+
export function initSse(res) {
|
|
990
|
+
res.writeHead(200, {
|
|
991
|
+
"Content-Type": "text/event-stream",
|
|
992
|
+
"Cache-Control": "no-cache, no-transform",
|
|
993
|
+
Connection: "keep-alive",
|
|
994
|
+
"X-Accel-Buffering": "no",
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
export function writeSse(res, payload) {
|
|
998
|
+
if (res.writableEnded || res.destroyed)
|
|
999
|
+
return;
|
|
1000
|
+
res.write(`data: ${JSON.stringify(payload)}\n\n`);
|
|
1001
|
+
}
|
|
1002
|
+
export function writeChatTokenSse(res, text, fullText) {
|
|
1003
|
+
writeSse(res, { type: "token", text, fullText });
|
|
1004
|
+
}
|
|
1005
|
+
export function writeSseData(res, data, event) {
|
|
1006
|
+
if (res.writableEnded || res.destroyed)
|
|
1007
|
+
return;
|
|
1008
|
+
const safeEvent = typeof event === "string" && /^[A-Za-z0-9_.-]+$/.test(event) ? event : null;
|
|
1009
|
+
if (safeEvent)
|
|
1010
|
+
res.write(`event: ${safeEvent}\n`);
|
|
1011
|
+
for (const line of data.split(/\r\n|\r|\n/)) {
|
|
1012
|
+
res.write(`data: ${line}\n`);
|
|
1013
|
+
}
|
|
1014
|
+
res.write("\n");
|
|
1015
|
+
}
|
|
1016
|
+
export function writeSseJson(res, payload, event) {
|
|
1017
|
+
writeSseData(res, JSON.stringify(payload), event);
|
|
1018
|
+
}
|
|
1019
|
+
// ---------------------------------------------------------------------------
|
|
1020
|
+
// Persistence helpers
|
|
1021
|
+
// ---------------------------------------------------------------------------
|
|
1022
|
+
function isDuplicateMemoryError(err) {
|
|
1023
|
+
if (!(err instanceof Error))
|
|
1024
|
+
return false;
|
|
1025
|
+
const msg = err.message.toLowerCase();
|
|
1026
|
+
return (msg.includes("duplicate") ||
|
|
1027
|
+
msg.includes("already exists") ||
|
|
1028
|
+
msg.includes("unique constraint"));
|
|
1029
|
+
}
|
|
1030
|
+
export async function persistConversationMemory(runtime, memory) {
|
|
1031
|
+
try {
|
|
1032
|
+
await runtime.createMemory(memory, "messages");
|
|
1033
|
+
}
|
|
1034
|
+
catch (err) {
|
|
1035
|
+
if (isDuplicateMemoryError(err))
|
|
1036
|
+
return;
|
|
1037
|
+
throw err;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
async function hasRecentAssistantMemory(runtime, roomId, text, sinceMs) {
|
|
1041
|
+
const trimmed = text.trim();
|
|
1042
|
+
if (!trimmed)
|
|
1043
|
+
return false;
|
|
1044
|
+
try {
|
|
1045
|
+
const recent = await runtime.getMemories({
|
|
1046
|
+
roomId,
|
|
1047
|
+
tableName: "messages",
|
|
1048
|
+
limit: 12,
|
|
1049
|
+
});
|
|
1050
|
+
return recent.some((memory) => {
|
|
1051
|
+
const contentText = memory.content?.text?.trim();
|
|
1052
|
+
const createdAt = memory.createdAt ?? 0;
|
|
1053
|
+
return (memory.entityId === runtime.agentId &&
|
|
1054
|
+
contentText === trimmed &&
|
|
1055
|
+
createdAt >= sinceMs - 2000);
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
catch {
|
|
1059
|
+
return false;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
export async function hasRecentVisibleAssistantMemorySince(runtime, roomId, sinceMs) {
|
|
1063
|
+
return Boolean(await getRecentVisibleAssistantMemoryTextSince(runtime, roomId, sinceMs));
|
|
1064
|
+
}
|
|
1065
|
+
export async function getRecentVisibleAssistantMemoryTextSince(runtime, roomId, sinceMs) {
|
|
1066
|
+
try {
|
|
1067
|
+
const recent = await runtime.getMemories({
|
|
1068
|
+
roomId,
|
|
1069
|
+
tableName: "messages",
|
|
1070
|
+
limit: 12,
|
|
1071
|
+
});
|
|
1072
|
+
const persistedAssistantTurn = recent
|
|
1073
|
+
.filter((memory) => {
|
|
1074
|
+
const contentText = memory.content?.text?.trim();
|
|
1075
|
+
const createdAt = memory.createdAt ?? 0;
|
|
1076
|
+
return (memory.entityId === runtime.agentId &&
|
|
1077
|
+
Boolean(contentText) &&
|
|
1078
|
+
createdAt >= sinceMs - 2000);
|
|
1079
|
+
})
|
|
1080
|
+
.sort((a, b) => (b.createdAt ?? 0) - (a.createdAt ?? 0))[0];
|
|
1081
|
+
return (persistedAssistantTurn?.content?.text?.trim() ?? null);
|
|
1082
|
+
}
|
|
1083
|
+
catch {
|
|
1084
|
+
return null;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
export async function persistAssistantConversationMemory(runtime, roomId, content, channelType, dedupeSinceMs) {
|
|
1088
|
+
const persistedContent = markSyntheticChatFailureContent(typeof content === "string"
|
|
1089
|
+
? {
|
|
1090
|
+
text: content,
|
|
1091
|
+
source: "client_chat",
|
|
1092
|
+
channelType,
|
|
1093
|
+
}
|
|
1094
|
+
: {
|
|
1095
|
+
...content,
|
|
1096
|
+
text: extractCompatTextContent(content),
|
|
1097
|
+
source: typeof content.source === "string" ? content.source : "client_chat",
|
|
1098
|
+
channelType: typeof content.channelType === "string"
|
|
1099
|
+
? content.channelType
|
|
1100
|
+
: channelType,
|
|
1101
|
+
});
|
|
1102
|
+
const trimmed = persistedContent.text.trim();
|
|
1103
|
+
if (!trimmed)
|
|
1104
|
+
return;
|
|
1105
|
+
if (typeof dedupeSinceMs === "number") {
|
|
1106
|
+
const alreadyPersisted = await hasRecentAssistantMemory(runtime, roomId, trimmed, dedupeSinceMs);
|
|
1107
|
+
if (alreadyPersisted)
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
await persistConversationMemory(runtime, createMessageMemory({
|
|
1111
|
+
id: crypto.randomUUID(),
|
|
1112
|
+
entityId: runtime.agentId,
|
|
1113
|
+
agentId: runtime.agentId,
|
|
1114
|
+
roomId,
|
|
1115
|
+
content: persistedContent,
|
|
1116
|
+
}));
|
|
1117
|
+
}
|
|
1118
|
+
// ---------------------------------------------------------------------------
|
|
1119
|
+
// Chat request parsing
|
|
1120
|
+
// ---------------------------------------------------------------------------
|
|
1121
|
+
const VALID_CHANNEL_TYPES = new Set(Object.values(ChannelType));
|
|
1122
|
+
function parseRequestChannelType(value, fallback = ChannelType.DM) {
|
|
1123
|
+
if (value === undefined || value === null) {
|
|
1124
|
+
return fallback;
|
|
1125
|
+
}
|
|
1126
|
+
if (typeof value !== "string") {
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
const normalized = value.trim().toUpperCase();
|
|
1130
|
+
if (!VALID_CHANNEL_TYPES.has(normalized)) {
|
|
1131
|
+
return null;
|
|
1132
|
+
}
|
|
1133
|
+
return normalized;
|
|
1134
|
+
}
|
|
1135
|
+
function readUiLanguageHeader(req) {
|
|
1136
|
+
if (!req) {
|
|
1137
|
+
return undefined;
|
|
1138
|
+
}
|
|
1139
|
+
const header = req.headers["x-eliza-ui-language"];
|
|
1140
|
+
if (Array.isArray(header)) {
|
|
1141
|
+
return header.find((value) => value.trim())?.trim();
|
|
1142
|
+
}
|
|
1143
|
+
return typeof header === "string" && header.trim()
|
|
1144
|
+
? header.trim()
|
|
1145
|
+
: undefined;
|
|
1146
|
+
}
|
|
1147
|
+
export async function readChatRequestPayload(req, res, helpers,
|
|
1148
|
+
/** Body size limit. Image-capable endpoints pass CHAT_MAX_BODY_BYTES (20 MB);
|
|
1149
|
+
* legacy/cloud-proxy endpoints that don't process images pass MAX_BODY_BYTES (1 MB). */
|
|
1150
|
+
maxBytes = CHAT_MAX_BODY_BYTES) {
|
|
1151
|
+
const body = await helpers.readJsonBody(req, res, { maxBytes });
|
|
1152
|
+
if (!body)
|
|
1153
|
+
return null;
|
|
1154
|
+
const normalizedPrompt = normalizeIncomingChatPrompt(body.text, body.images);
|
|
1155
|
+
if (!normalizedPrompt) {
|
|
1156
|
+
helpers.error(res, "text is required");
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1159
|
+
const channelType = parseRequestChannelType(body.channelType, ChannelType.DM);
|
|
1160
|
+
if (!channelType) {
|
|
1161
|
+
helpers.error(res, "channelType is invalid", 400);
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
const imageValidationError = validateChatImages(body.images);
|
|
1165
|
+
if (imageValidationError) {
|
|
1166
|
+
helpers.error(res, imageValidationError, 400);
|
|
1167
|
+
return null;
|
|
1168
|
+
}
|
|
1169
|
+
const images = Array.isArray(body.images)
|
|
1170
|
+
? body.images.map((img) => ({
|
|
1171
|
+
...img,
|
|
1172
|
+
mimeType: img.mimeType.toLowerCase(),
|
|
1173
|
+
}))
|
|
1174
|
+
: undefined;
|
|
1175
|
+
const rawPreferredLanguage = (typeof body.language === "string" && body.language.trim()
|
|
1176
|
+
? body.language
|
|
1177
|
+
: undefined) ?? readUiLanguageHeader(req);
|
|
1178
|
+
const preferredLanguage = rawPreferredLanguage
|
|
1179
|
+
? normalizeCharacterLanguage(rawPreferredLanguage)
|
|
1180
|
+
: undefined;
|
|
1181
|
+
const source = typeof body.source === "string" && body.source.trim().length > 0
|
|
1182
|
+
? body.source.trim()
|
|
1183
|
+
: undefined;
|
|
1184
|
+
const metadata = body.metadata &&
|
|
1185
|
+
typeof body.metadata === "object" &&
|
|
1186
|
+
!Array.isArray(body.metadata)
|
|
1187
|
+
? body.metadata
|
|
1188
|
+
: undefined;
|
|
1189
|
+
const clientMessageId = normalizeClientMessageId(body.clientMessageId);
|
|
1190
|
+
return {
|
|
1191
|
+
prompt: normalizedPrompt,
|
|
1192
|
+
channelType,
|
|
1193
|
+
images,
|
|
1194
|
+
...(preferredLanguage ? { preferredLanguage } : {}),
|
|
1195
|
+
...(source ? { source } : {}),
|
|
1196
|
+
...(metadata ? { metadata } : {}),
|
|
1197
|
+
...(clientMessageId ? { clientMessageId } : {}),
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function readMessageTrajectoryStepId(message) {
|
|
1201
|
+
const metadata = message.metadata;
|
|
1202
|
+
if (!metadata || typeof metadata !== "object")
|
|
1203
|
+
return null;
|
|
1204
|
+
const stepId = metadata.trajectoryStepId;
|
|
1205
|
+
return typeof stepId === "string" && stepId.trim().length > 0
|
|
1206
|
+
? stepId.trim()
|
|
1207
|
+
: null;
|
|
1208
|
+
}
|
|
1209
|
+
function readMessageTrajectoryGrouping(message) {
|
|
1210
|
+
const contentMetadata = asRecord(message.content.metadata) ?? {};
|
|
1211
|
+
const evalMetadata = asRecord(contentMetadata.eval) ?? {};
|
|
1212
|
+
const messageMetadata = asRecord(message.metadata) ?? {};
|
|
1213
|
+
return resolveTrajectoryGrouping({
|
|
1214
|
+
...contentMetadata,
|
|
1215
|
+
...evalMetadata,
|
|
1216
|
+
...messageMetadata,
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
async function persistMessageTrajectoryGrouping(runtime, message) {
|
|
1220
|
+
const stepId = readMessageTrajectoryStepId(message);
|
|
1221
|
+
if (!stepId)
|
|
1222
|
+
return;
|
|
1223
|
+
const grouping = readMessageTrajectoryGrouping(message);
|
|
1224
|
+
if (!grouping.scenarioId && !grouping.batchId)
|
|
1225
|
+
return;
|
|
1226
|
+
await startTrajectoryStepInDatabase({
|
|
1227
|
+
runtime,
|
|
1228
|
+
stepId,
|
|
1229
|
+
source: typeof message.content.source === "string" &&
|
|
1230
|
+
message.content.source.trim().length > 0
|
|
1231
|
+
? message.content.source
|
|
1232
|
+
: undefined,
|
|
1233
|
+
metadata: {
|
|
1234
|
+
...(grouping.scenarioId ? { scenarioId: grouping.scenarioId } : {}),
|
|
1235
|
+
...(grouping.batchId ? { batchId: grouping.batchId } : {}),
|
|
1236
|
+
},
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
function buildChatUsage(runtime, message, finalText, capturedUsage) {
|
|
1240
|
+
const model = capturedUsage?.model ?? detectRuntimeModel(runtime, undefined) ?? undefined;
|
|
1241
|
+
if (capturedUsage) {
|
|
1242
|
+
return {
|
|
1243
|
+
promptTokens: capturedUsage.promptTokens,
|
|
1244
|
+
completionTokens: capturedUsage.completionTokens,
|
|
1245
|
+
totalTokens: capturedUsage.totalTokens,
|
|
1246
|
+
...(model ? { model } : {}),
|
|
1247
|
+
...(capturedUsage.provider ? { provider: capturedUsage.provider } : {}),
|
|
1248
|
+
isEstimated: capturedUsage.isEstimated,
|
|
1249
|
+
llmCalls: capturedUsage.llmCalls,
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
const promptText = extractCompatTextContent(message.content);
|
|
1253
|
+
const promptTokens = estimateTokenCount(promptText);
|
|
1254
|
+
const completionTokens = estimateTokenCount(finalText);
|
|
1255
|
+
return {
|
|
1256
|
+
promptTokens,
|
|
1257
|
+
completionTokens,
|
|
1258
|
+
totalTokens: promptTokens + completionTokens,
|
|
1259
|
+
...(model ? { model } : {}),
|
|
1260
|
+
isEstimated: true,
|
|
1261
|
+
llmCalls: 0,
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
// ---------------------------------------------------------------------------
|
|
1265
|
+
// generateChatResponse
|
|
1266
|
+
// ---------------------------------------------------------------------------
|
|
1267
|
+
export async function generateChatResponse(runtime, message, agentName, opts) {
|
|
1268
|
+
const generationTimeoutMs = resolveChatGenerationTimeoutMs(opts?.timeoutDuration);
|
|
1269
|
+
let generationTimedOut = false;
|
|
1270
|
+
if (generationTimeoutMs <= 1) {
|
|
1271
|
+
generationTimedOut = true;
|
|
1272
|
+
throw createChatGenerationTimeoutError(generationTimeoutMs);
|
|
1273
|
+
}
|
|
1274
|
+
const generationAbortController = new AbortController();
|
|
1275
|
+
const abortGeneration = (reason) => {
|
|
1276
|
+
if (!generationAbortController.signal.aborted) {
|
|
1277
|
+
generationAbortController.abort(reason);
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
const onExternalAbort = () => {
|
|
1281
|
+
abortGeneration(opts?.abortSignal?.reason);
|
|
1282
|
+
};
|
|
1283
|
+
if (opts?.abortSignal?.aborted) {
|
|
1284
|
+
onExternalAbort();
|
|
1285
|
+
}
|
|
1286
|
+
else {
|
|
1287
|
+
opts?.abortSignal?.addEventListener("abort", onExternalAbort, {
|
|
1288
|
+
once: true,
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
try {
|
|
1292
|
+
const originalUserText = String(extractCompatTextContent(message.content));
|
|
1293
|
+
let responseText = "";
|
|
1294
|
+
let forcedWalletExecutionText = false;
|
|
1295
|
+
let blockedUnexecutedActionPayload = false;
|
|
1296
|
+
let activeStreamSource = "unset";
|
|
1297
|
+
const actionCallbackHistory = [];
|
|
1298
|
+
// Snapshot of `responseText` at the moment the first action callback runs.
|
|
1299
|
+
// WHY: LLM streaming genuinely appends token deltas. Action handlers that
|
|
1300
|
+
// call HandlerCallback multiple times (Discord "progressive message" pattern)
|
|
1301
|
+
// send unrelated status strings — merging them with mergeStreamingText would
|
|
1302
|
+
// concatenate ("🔍…" + "✨…" + "Now playing…"). We preserve the streamed
|
|
1303
|
+
// prefix and replace only the callback suffix so the dashboard SSE client
|
|
1304
|
+
// gets snapshot fullText updates (same UX as editing one chat bubble).
|
|
1305
|
+
let preCallbackText = null;
|
|
1306
|
+
const messageSource = typeof message.content.source === "string" &&
|
|
1307
|
+
message.content.source.trim().length > 0
|
|
1308
|
+
? message.content.source
|
|
1309
|
+
: "api";
|
|
1310
|
+
const emitChunk = (chunk) => {
|
|
1311
|
+
if (!chunk)
|
|
1312
|
+
return;
|
|
1313
|
+
responseText += chunk;
|
|
1314
|
+
opts?.onChunk?.(chunk);
|
|
1315
|
+
};
|
|
1316
|
+
const emitSnapshot = (text) => {
|
|
1317
|
+
if (!text)
|
|
1318
|
+
return;
|
|
1319
|
+
// Skip when the snapshot matches the current responseText exactly:
|
|
1320
|
+
// re-emitting the same fullText forces clients to re-render an identical
|
|
1321
|
+
// bubble (and on-the-wire bytes for nothing).
|
|
1322
|
+
if (text === responseText)
|
|
1323
|
+
return;
|
|
1324
|
+
responseText = text;
|
|
1325
|
+
opts?.onSnapshot?.(text);
|
|
1326
|
+
};
|
|
1327
|
+
const claimStreamSource = (source) => {
|
|
1328
|
+
if (activeStreamSource === "unset") {
|
|
1329
|
+
activeStreamSource = source;
|
|
1330
|
+
return true;
|
|
1331
|
+
}
|
|
1332
|
+
return activeStreamSource === source;
|
|
1333
|
+
};
|
|
1334
|
+
const appendIncomingText = (incoming) => {
|
|
1335
|
+
const update = resolveStreamingUpdate(responseText, incoming);
|
|
1336
|
+
if (update.kind === "unchanged")
|
|
1337
|
+
return;
|
|
1338
|
+
if (update.kind === "append") {
|
|
1339
|
+
emitChunk(update.emittedText);
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
emitSnapshot(update.nextText);
|
|
1343
|
+
};
|
|
1344
|
+
const captureCallbackBaseline = () => {
|
|
1345
|
+
if (preCallbackText === null) {
|
|
1346
|
+
preCallbackText = responseText;
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
const recordActionCallbackText = (incoming) => {
|
|
1350
|
+
const normalized = normalizeActionCallbackText(incoming);
|
|
1351
|
+
if (!normalized)
|
|
1352
|
+
return;
|
|
1353
|
+
if (actionCallbackHistory.at(-1) === normalized)
|
|
1354
|
+
return;
|
|
1355
|
+
actionCallbackHistory.push(normalized);
|
|
1356
|
+
};
|
|
1357
|
+
/** Latest action callback wins: replaces prior callback text, keeps LLM prefix. */
|
|
1358
|
+
const replaceCallbackText = (incoming) => {
|
|
1359
|
+
recordActionCallbackText(incoming);
|
|
1360
|
+
captureCallbackBaseline();
|
|
1361
|
+
const baseline = preCallbackText ?? "";
|
|
1362
|
+
const separator = baseline.length > 0 ? "\n\n" : "";
|
|
1363
|
+
const nextText = `${baseline}${separator}${incoming}`;
|
|
1364
|
+
// Heuristic: if the new callback text is a true append on top of the
|
|
1365
|
+
// currently streamed responseText, emit a delta chunk (cheap on the wire,
|
|
1366
|
+
// lets modern SSE clients append without re-rendering the whole bubble)
|
|
1367
|
+
// AND a snapshot for legacy clients that only consume `fullText`.
|
|
1368
|
+
// Otherwise (structural rewrite — Discord-style "🔍 searching" → "✨ done"
|
|
1369
|
+
// or planner restart), snapshot only.
|
|
1370
|
+
if (nextText === responseText)
|
|
1371
|
+
return;
|
|
1372
|
+
if (nextText.startsWith(responseText) && responseText.length > 0) {
|
|
1373
|
+
const delta = nextText.slice(responseText.length);
|
|
1374
|
+
emitChunk(delta);
|
|
1375
|
+
// emitChunk already advanced responseText; re-emit snapshot for
|
|
1376
|
+
// legacy clients that only handle fullText updates.
|
|
1377
|
+
opts?.onSnapshot?.(nextText);
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
emitSnapshot(nextText);
|
|
1381
|
+
};
|
|
1382
|
+
const applyCallbackTextUpdate = (content, incoming) => {
|
|
1383
|
+
captureCallbackBaseline();
|
|
1384
|
+
if (resolveCallbackMergeMode(content) === "append") {
|
|
1385
|
+
recordActionCallbackText(incoming);
|
|
1386
|
+
appendIncomingText(incoming);
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
replaceCallbackText(incoming);
|
|
1390
|
+
};
|
|
1391
|
+
// Emit inbound events so trajectory/session hooks run for API chat.
|
|
1392
|
+
try {
|
|
1393
|
+
if (typeof runtime.emitEvent === "function") {
|
|
1394
|
+
await runtime.emitEvent("MESSAGE_RECEIVED", {
|
|
1395
|
+
message,
|
|
1396
|
+
source: messageSource,
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
catch (err) {
|
|
1401
|
+
runtime.logger.warn({
|
|
1402
|
+
err,
|
|
1403
|
+
src: "eliza-api",
|
|
1404
|
+
messageId: message.id,
|
|
1405
|
+
roomId: message.roomId,
|
|
1406
|
+
}, "Failed to emit MESSAGE_RECEIVED event");
|
|
1407
|
+
}
|
|
1408
|
+
const trajectoryStepId = readMessageTrajectoryStepId(message);
|
|
1409
|
+
const trajectoryContext = typeof trajectoryStepId === "string" && trajectoryStepId.trim().length > 0
|
|
1410
|
+
? { trajectoryStepId: trajectoryStepId.trim() }
|
|
1411
|
+
: undefined;
|
|
1412
|
+
const androidDirectResult = await runWithTrajectoryContext(trajectoryContext, () => maybeGenerateAndroidLocalDirectChatResponse({
|
|
1413
|
+
runtime,
|
|
1414
|
+
message,
|
|
1415
|
+
agentName,
|
|
1416
|
+
signal: generationAbortController.signal,
|
|
1417
|
+
opts,
|
|
1418
|
+
}));
|
|
1419
|
+
if (androidDirectResult) {
|
|
1420
|
+
try {
|
|
1421
|
+
if (androidDirectResult.responseContent &&
|
|
1422
|
+
typeof runtime.emitEvent === "function") {
|
|
1423
|
+
const memoryLike = createMessageMemory({
|
|
1424
|
+
id: crypto.randomUUID(),
|
|
1425
|
+
roomId: message.roomId,
|
|
1426
|
+
entityId: runtime.agentId,
|
|
1427
|
+
content: ensureMessageMemoryContent(androidDirectResult.responseContent),
|
|
1428
|
+
});
|
|
1429
|
+
memoryLike.metadata = message.metadata;
|
|
1430
|
+
await runtime.emitEvent("MESSAGE_SENT", {
|
|
1431
|
+
message: memoryLike,
|
|
1432
|
+
source: messageSource,
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
catch (err) {
|
|
1437
|
+
runtime.logger.warn({
|
|
1438
|
+
err,
|
|
1439
|
+
src: "eliza-api",
|
|
1440
|
+
messageId: message.id,
|
|
1441
|
+
roomId: message.roomId,
|
|
1442
|
+
}, "Failed to emit MESSAGE_SENT event");
|
|
1443
|
+
}
|
|
1444
|
+
return androidDirectResult;
|
|
1445
|
+
}
|
|
1446
|
+
let result;
|
|
1447
|
+
let capturedUsage = null;
|
|
1448
|
+
let actionCallbacksSeen = 0;
|
|
1449
|
+
const seenActionTags = new Set();
|
|
1450
|
+
const recordActionCallback = (actionTag, hasText) => {
|
|
1451
|
+
actionCallbacksSeen += 1;
|
|
1452
|
+
const normalizedActionTag = normalizeActionName(actionTag);
|
|
1453
|
+
if (normalizedActionTag) {
|
|
1454
|
+
seenActionTags.add(normalizedActionTag);
|
|
1455
|
+
}
|
|
1456
|
+
runtime.logger.info({
|
|
1457
|
+
src: "eliza-api",
|
|
1458
|
+
action: normalizedActionTag || actionTag,
|
|
1459
|
+
hasText,
|
|
1460
|
+
}, `[eliza-api] Action callback fired: ${normalizedActionTag || actionTag}`);
|
|
1461
|
+
};
|
|
1462
|
+
const extractCallbackActionTag = (content) => {
|
|
1463
|
+
const record = content;
|
|
1464
|
+
if (typeof record.action === "string" && record.action.length > 0) {
|
|
1465
|
+
return record.action;
|
|
1466
|
+
}
|
|
1467
|
+
if (Array.isArray(record.actions)) {
|
|
1468
|
+
const firstAction = record.actions.find((action) => typeof action === "string" && action.trim().length > 0);
|
|
1469
|
+
if (firstAction)
|
|
1470
|
+
return firstAction;
|
|
1471
|
+
}
|
|
1472
|
+
return "VISIBLE_CALLBACK";
|
|
1473
|
+
};
|
|
1474
|
+
const generationCapture = await withModelUsageCapture(runtime, () => withTimeout(Promise.resolve(runWithTrajectoryContext(trajectoryContext, async () => {
|
|
1475
|
+
// Binance skill direct dispatch
|
|
1476
|
+
const directSkillText = await maybeHandleDirectBinanceSkillRequest(runtime, message, replaceCallbackText, emitSnapshot);
|
|
1477
|
+
if (directSkillText) {
|
|
1478
|
+
const finalText = isClientVisibleNoResponse(directSkillText)
|
|
1479
|
+
? directSkillText || "(no response)"
|
|
1480
|
+
: directSkillText;
|
|
1481
|
+
result = {
|
|
1482
|
+
didRespond: true,
|
|
1483
|
+
responseContent: { text: finalText },
|
|
1484
|
+
responseMessages: [],
|
|
1485
|
+
};
|
|
1486
|
+
responseText = finalText;
|
|
1487
|
+
forcedWalletExecutionText =
|
|
1488
|
+
isClientVisibleNoResponse(directSkillText);
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
// Direct dispatch for explicit task creation intent from UI
|
|
1492
|
+
const contentMetadata = message.content.metadata;
|
|
1493
|
+
if (contentMetadata?.intent === "create_task") {
|
|
1494
|
+
const coordinator = runtime.getService("SWARM_COORDINATOR");
|
|
1495
|
+
if (coordinator) {
|
|
1496
|
+
const createTaskAction = runtime.actions.find((a) => a.name.toUpperCase() === "START_CODING_TASK") ??
|
|
1497
|
+
runtime.actions.find((a) => a.name.toUpperCase() === "CREATE_TASK");
|
|
1498
|
+
if (createTaskAction) {
|
|
1499
|
+
runtime.logger.info({
|
|
1500
|
+
src: "eliza-api",
|
|
1501
|
+
agentType: contentMetadata.agentType,
|
|
1502
|
+
intent: "create_task",
|
|
1503
|
+
}, "[eliza-api] Direct dispatch START_CODING_TASK from UI intent");
|
|
1504
|
+
let actionResponseText = "";
|
|
1505
|
+
await createTaskAction.handler(runtime, message, undefined, {}, async (content) => {
|
|
1506
|
+
if (generationTimedOut || opts?.isAborted?.()) {
|
|
1507
|
+
throw createChatGenerationTimeoutError(generationTimeoutMs);
|
|
1508
|
+
}
|
|
1509
|
+
const chunk = extractCompatTextContent(content);
|
|
1510
|
+
if (chunk) {
|
|
1511
|
+
const voicedChunk = await rewriteDirectActionCallbackText({
|
|
1512
|
+
runtime,
|
|
1513
|
+
actionName: createTaskAction.name,
|
|
1514
|
+
text: chunk,
|
|
1515
|
+
content,
|
|
1516
|
+
});
|
|
1517
|
+
applyCallbackTextUpdate(content, voicedChunk);
|
|
1518
|
+
actionResponseText = responseText;
|
|
1519
|
+
}
|
|
1520
|
+
return [];
|
|
1521
|
+
});
|
|
1522
|
+
const finalText = actionResponseText || responseText || "Task created.";
|
|
1523
|
+
result = {
|
|
1524
|
+
didRespond: true,
|
|
1525
|
+
responseContent: { text: finalText },
|
|
1526
|
+
responseMessages: [],
|
|
1527
|
+
};
|
|
1528
|
+
responseText = finalText;
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
// Fall through to normal LLM-based routing if coordinator not available
|
|
1533
|
+
}
|
|
1534
|
+
const localInferenceIntent = detectLocalInferenceCommandIntent(originalUserText, {
|
|
1535
|
+
localInferenceContext: hasLocalInferenceMetadata(message),
|
|
1536
|
+
});
|
|
1537
|
+
if (localInferenceIntent) {
|
|
1538
|
+
const { handleLocalInferenceChatCommand } = await getLocalInferenceChatApi();
|
|
1539
|
+
const localResult = await handleLocalInferenceChatCommand(localInferenceIntent, originalUserText);
|
|
1540
|
+
emitSnapshot(localResult.text);
|
|
1541
|
+
result = {
|
|
1542
|
+
didRespond: true,
|
|
1543
|
+
responseContent: {
|
|
1544
|
+
text: localResult.text,
|
|
1545
|
+
source: "client_chat",
|
|
1546
|
+
actions: ["REPLY"],
|
|
1547
|
+
localInference: localResult.localInference,
|
|
1548
|
+
failureKind: localResult.localInference.status === "failed" ||
|
|
1549
|
+
localResult.localInference.status === "no_space"
|
|
1550
|
+
? "local_inference"
|
|
1551
|
+
: undefined,
|
|
1552
|
+
},
|
|
1553
|
+
responseMessages: [],
|
|
1554
|
+
};
|
|
1555
|
+
responseText = localResult.text;
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
const languageAugmentedMessage = maybeAugmentChatMessageWithLanguage(message, opts?.preferredLanguage);
|
|
1559
|
+
const walletAugmentedMessage = maybeAugmentChatMessageWithWalletContext(runtime, languageAugmentedMessage);
|
|
1560
|
+
const generationMessage = await maybeAugmentChatMessageWithDocuments(runtime, walletAugmentedMessage);
|
|
1561
|
+
result = await runtime.messageService?.handleMessage(runtime, generationMessage, async (content) => {
|
|
1562
|
+
if (generationTimedOut || opts?.isAborted?.()) {
|
|
1563
|
+
throw createChatGenerationTimeoutError(generationTimeoutMs);
|
|
1564
|
+
}
|
|
1565
|
+
const chunk = extractCompatTextContent(content);
|
|
1566
|
+
recordActionCallback(extractCallbackActionTag(content), Boolean(chunk));
|
|
1567
|
+
if (!chunk)
|
|
1568
|
+
return [];
|
|
1569
|
+
if (!claimStreamSource("callback"))
|
|
1570
|
+
return [];
|
|
1571
|
+
applyCallbackTextUpdate(content, chunk);
|
|
1572
|
+
return [];
|
|
1573
|
+
}, {
|
|
1574
|
+
timeoutDuration: generationTimeoutMs,
|
|
1575
|
+
abortSignal: generationAbortController.signal,
|
|
1576
|
+
keepExistingResponses: true,
|
|
1577
|
+
onStreamChunk: opts?.onChunk
|
|
1578
|
+
? async (chunk) => {
|
|
1579
|
+
if (generationTimedOut || opts?.isAborted?.()) {
|
|
1580
|
+
throw createChatGenerationTimeoutError(generationTimeoutMs);
|
|
1581
|
+
}
|
|
1582
|
+
if (!chunk)
|
|
1583
|
+
return;
|
|
1584
|
+
if (!claimStreamSource("onStreamChunk"))
|
|
1585
|
+
return;
|
|
1586
|
+
appendIncomingText(chunk);
|
|
1587
|
+
}
|
|
1588
|
+
: undefined,
|
|
1589
|
+
});
|
|
1590
|
+
// Ensure MESSAGE_SENT hooks run for API chat flows.
|
|
1591
|
+
try {
|
|
1592
|
+
const responseMessages = Array.isArray(result?.responseMessages)
|
|
1593
|
+
? result.responseMessages
|
|
1594
|
+
: [];
|
|
1595
|
+
const fallbackResponseContent = result?.responseContent &&
|
|
1596
|
+
typeof result.responseContent === "object"
|
|
1597
|
+
? result.responseContent
|
|
1598
|
+
: responseText
|
|
1599
|
+
? { text: responseText }
|
|
1600
|
+
: null;
|
|
1601
|
+
const messagesToEmit = responseMessages.length > 0
|
|
1602
|
+
? responseMessages
|
|
1603
|
+
: fallbackResponseContent
|
|
1604
|
+
? [
|
|
1605
|
+
{
|
|
1606
|
+
id: crypto.randomUUID(),
|
|
1607
|
+
content: fallbackResponseContent,
|
|
1608
|
+
},
|
|
1609
|
+
]
|
|
1610
|
+
: [];
|
|
1611
|
+
if (messagesToEmit.length > 0 &&
|
|
1612
|
+
typeof runtime.emitEvent === "function") {
|
|
1613
|
+
for (const responseMessage of messagesToEmit) {
|
|
1614
|
+
const memoryLike = createMessageMemory({
|
|
1615
|
+
id: responseMessage.id ??
|
|
1616
|
+
crypto.randomUUID(),
|
|
1617
|
+
roomId: message.roomId,
|
|
1618
|
+
entityId: runtime.agentId,
|
|
1619
|
+
content: markSyntheticChatFailureContent(ensureMessageMemoryContent(responseMessage.content ?? { text: "" })),
|
|
1620
|
+
});
|
|
1621
|
+
memoryLike.metadata = message.metadata;
|
|
1622
|
+
await runtime.emitEvent("MESSAGE_SENT", {
|
|
1623
|
+
message: memoryLike,
|
|
1624
|
+
source: messageSource,
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
catch (err) {
|
|
1630
|
+
runtime.logger.warn({
|
|
1631
|
+
err,
|
|
1632
|
+
src: "eliza-api",
|
|
1633
|
+
messageId: message.id,
|
|
1634
|
+
roomId: message.roomId,
|
|
1635
|
+
}, "Failed to emit MESSAGE_SENT event");
|
|
1636
|
+
}
|
|
1637
|
+
// Post-process fallback actions
|
|
1638
|
+
if (result) {
|
|
1639
|
+
const rc = result.responseContent;
|
|
1640
|
+
const resultRecord = asRecord(result);
|
|
1641
|
+
runtime.logger.info({
|
|
1642
|
+
src: "eliza-api",
|
|
1643
|
+
mode: resultRecord?.mode,
|
|
1644
|
+
actions: rc?.actions,
|
|
1645
|
+
hasText: Boolean(rc?.text),
|
|
1646
|
+
}, "[eliza-api] Chat response metadata");
|
|
1647
|
+
const rawActionsPayload = rc?.actions ?? resultRecord?.actions;
|
|
1648
|
+
const modelText = String(extractCompatTextContent(result.responseContent));
|
|
1649
|
+
const parsedFallbackActions = parseFallbackActionBlocks(rawActionsPayload, modelText);
|
|
1650
|
+
const actionNameLookup = buildRuntimeActionNameLookup(runtime);
|
|
1651
|
+
const executedRuntimeActions = listExecutedRuntimeActions(runtime, typeof message.id === "string" ? message.id : undefined);
|
|
1652
|
+
const executedActionNames = new Set([...executedRuntimeActions, ...seenActionTags]
|
|
1653
|
+
.map((name) => actionNameLookup.get(name) ?? name)
|
|
1654
|
+
.filter((name) => name.length > 0));
|
|
1655
|
+
// Only run fallback execution when the core did NOT dispatch actions itself.
|
|
1656
|
+
const coreHandledActions = resultRecord?.mode === "actions";
|
|
1657
|
+
const executableFallbackActions = parsedFallbackActions.filter((action) => {
|
|
1658
|
+
if (!isExecutableFallbackAction(action)) {
|
|
1659
|
+
return false;
|
|
1660
|
+
}
|
|
1661
|
+
const canonicalName = actionNameLookup.get(normalizeActionName(action.name)) ??
|
|
1662
|
+
normalizeActionName(action.name);
|
|
1663
|
+
return !executedActionNames.has(canonicalName);
|
|
1664
|
+
});
|
|
1665
|
+
if (!coreHandledActions && executableFallbackActions.length > 0) {
|
|
1666
|
+
const selfControlFallbackActions = executableFallbackActions.filter((action) => {
|
|
1667
|
+
const canonicalName = actionNameLookup.get(normalizeActionName(action.name)) ??
|
|
1668
|
+
normalizeActionName(action.name);
|
|
1669
|
+
return canonicalName === "BLOCK";
|
|
1670
|
+
});
|
|
1671
|
+
const callbacksBeforeFallback = actionCallbacksSeen;
|
|
1672
|
+
if (selfControlFallbackActions.length > 0) {
|
|
1673
|
+
await executeFallbackParsedActions(runtime, message, selfControlFallbackActions, appendIncomingText, recordActionCallback, {
|
|
1674
|
+
getCurrentText: () => responseText || modelText,
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
const selfControlFallbackExecuted = actionCallbacksSeen > callbacksBeforeFallback;
|
|
1678
|
+
const remainingExecutableFallbackActions = executableFallbackActions.filter((action) => {
|
|
1679
|
+
const canonicalName = actionNameLookup.get(normalizeActionName(action.name)) ??
|
|
1680
|
+
normalizeActionName(action.name);
|
|
1681
|
+
if (canonicalName === "BLOCK") {
|
|
1682
|
+
return !selfControlFallbackExecuted;
|
|
1683
|
+
}
|
|
1684
|
+
return true;
|
|
1685
|
+
});
|
|
1686
|
+
if (remainingExecutableFallbackActions.length > 0) {
|
|
1687
|
+
runtime.logger.error({
|
|
1688
|
+
src: "eliza-api",
|
|
1689
|
+
parsedActions: remainingExecutableFallbackActions.map((a) => a.name),
|
|
1690
|
+
}, "[eliza-api] Unexecuted action payload detected; failing closed");
|
|
1691
|
+
const failureText = buildUnexecutedActionPayloadReply(remainingExecutableFallbackActions.map((action) => action.name));
|
|
1692
|
+
if (opts?.onSnapshot) {
|
|
1693
|
+
emitSnapshot(failureText);
|
|
1694
|
+
}
|
|
1695
|
+
else {
|
|
1696
|
+
responseText = failureText;
|
|
1697
|
+
}
|
|
1698
|
+
blockedUnexecutedActionPayload = true;
|
|
1699
|
+
}
|
|
1700
|
+
if (remainingExecutableFallbackActions.some((action) => normalizeActionName(action.name) === "CHECK_BALANCE")) {
|
|
1701
|
+
forcedWalletExecutionText = true;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
})), generationTimeoutMs, () => createChatGenerationTimeoutError(generationTimeoutMs), () => {
|
|
1706
|
+
generationTimedOut = true;
|
|
1707
|
+
abortGeneration(createChatGenerationTimeoutError(generationTimeoutMs));
|
|
1708
|
+
}));
|
|
1709
|
+
capturedUsage = generationCapture.usage;
|
|
1710
|
+
const responseMessageText = getLatestVisibleResponseMessageText(result?.responseMessages);
|
|
1711
|
+
const resultText = responseMessageText ||
|
|
1712
|
+
extractCompatTextContent(result?.responseContent) ||
|
|
1713
|
+
"";
|
|
1714
|
+
// Fallback: if callbacks weren't used for text, stream + return final text.
|
|
1715
|
+
if (!responseText && resultText) {
|
|
1716
|
+
if (opts?.onSnapshot) {
|
|
1717
|
+
emitSnapshot(resultText);
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
emitChunk(resultText);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
else if (actionCallbacksSeen === 0 &&
|
|
1724
|
+
resultText &&
|
|
1725
|
+
resultText !== responseText &&
|
|
1726
|
+
resultText.startsWith(responseText)) {
|
|
1727
|
+
emitChunk(resultText.slice(responseText.length));
|
|
1728
|
+
}
|
|
1729
|
+
else if (actionCallbacksSeen === 0 &&
|
|
1730
|
+
resultText &&
|
|
1731
|
+
resultText !== responseText &&
|
|
1732
|
+
!forcedWalletExecutionText &&
|
|
1733
|
+
!blockedUnexecutedActionPayload) {
|
|
1734
|
+
if (opts?.onSnapshot) {
|
|
1735
|
+
emitSnapshot(resultText);
|
|
1736
|
+
}
|
|
1737
|
+
else {
|
|
1738
|
+
responseText = resultText;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
if (actionCallbacksSeen === 0 &&
|
|
1742
|
+
isWalletActionRequiredIntent(originalUserText)) {
|
|
1743
|
+
const failureText = buildWalletActionNotExecutedReply(runtime, originalUserText.trim());
|
|
1744
|
+
if (opts?.onSnapshot) {
|
|
1745
|
+
emitSnapshot(failureText);
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
responseText = failureText;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const noResponseFallback = opts?.resolveNoResponseText?.();
|
|
1752
|
+
const exactDocumentValue = await resolveExactDocumentValueForChat(runtime, message);
|
|
1753
|
+
const normalizedResponseText = trimWalletProgressPrefix(exactDocumentValue || responseText || resultText || "");
|
|
1754
|
+
const intentionalNoResponse = isIntentionalNoResponseResult(result, normalizedResponseText);
|
|
1755
|
+
const finalText = intentionalNoResponse
|
|
1756
|
+
? ""
|
|
1757
|
+
: isClientVisibleNoResponse(normalizedResponseText)
|
|
1758
|
+
? (noResponseFallback ??
|
|
1759
|
+
(normalizedResponseText || responseText || "(no response)"))
|
|
1760
|
+
: normalizedResponseText;
|
|
1761
|
+
const responseMessages = Array.isArray(result?.responseMessages)
|
|
1762
|
+
? result.responseMessages.map((entry) => ({
|
|
1763
|
+
...(entry.id ? { id: entry.id } : {}),
|
|
1764
|
+
...(entry.content ? { content: entry.content } : {}),
|
|
1765
|
+
}))
|
|
1766
|
+
: [];
|
|
1767
|
+
const responseContent = result?.responseContent && typeof result.responseContent === "object"
|
|
1768
|
+
? {
|
|
1769
|
+
...result.responseContent,
|
|
1770
|
+
text: finalText,
|
|
1771
|
+
}
|
|
1772
|
+
: finalText
|
|
1773
|
+
? { text: finalText }
|
|
1774
|
+
: null;
|
|
1775
|
+
const responseRecord = responseContent;
|
|
1776
|
+
const localInference = responseRecord?.localInference &&
|
|
1777
|
+
typeof responseRecord.localInference === "object"
|
|
1778
|
+
? responseRecord.localInference
|
|
1779
|
+
: undefined;
|
|
1780
|
+
const responseMetadata = asRecord(responseRecord?.metadata);
|
|
1781
|
+
const rawFailureKind = typeof responseRecord?.failureKind === "string"
|
|
1782
|
+
? responseRecord.failureKind
|
|
1783
|
+
: typeof responseMetadata?.chatFailureKind === "string"
|
|
1784
|
+
? responseMetadata.chatFailureKind
|
|
1785
|
+
: undefined;
|
|
1786
|
+
const failureKind = rawFailureKind === "insufficient_credits" ||
|
|
1787
|
+
rawFailureKind === "local_inference" ||
|
|
1788
|
+
rawFailureKind === "no_provider" ||
|
|
1789
|
+
rawFailureKind === "provider_issue"
|
|
1790
|
+
? rawFailureKind
|
|
1791
|
+
: undefined;
|
|
1792
|
+
const thought = typeof responseContent?.thought === "string" &&
|
|
1793
|
+
responseContent.thought.trim()
|
|
1794
|
+
? responseContent.thought
|
|
1795
|
+
: undefined;
|
|
1796
|
+
const actionResultSummaries = summarizeRuntimeActionResults(runtime, typeof message.id === "string" ? message.id : undefined);
|
|
1797
|
+
return {
|
|
1798
|
+
text: finalText,
|
|
1799
|
+
agentName,
|
|
1800
|
+
...(thought ? { thought } : {}),
|
|
1801
|
+
...(intentionalNoResponse
|
|
1802
|
+
? { noResponseReason: "ignored" }
|
|
1803
|
+
: {}),
|
|
1804
|
+
...(failureKind ? { failureKind } : {}),
|
|
1805
|
+
...(localInference ? { localInference } : {}),
|
|
1806
|
+
...(actionCallbacksSeen > 0 ? { usedActionCallbacks: true } : {}),
|
|
1807
|
+
...(actionCallbackHistory.length > 0
|
|
1808
|
+
? { actionCallbackHistory: [...actionCallbackHistory] }
|
|
1809
|
+
: {}),
|
|
1810
|
+
...(actionResultSummaries.length > 0
|
|
1811
|
+
? { actionResults: actionResultSummaries }
|
|
1812
|
+
: {}),
|
|
1813
|
+
...(responseContent ? { responseContent } : {}),
|
|
1814
|
+
...(responseMessages.length > 0 ? { responseMessages } : {}),
|
|
1815
|
+
usage: buildChatUsage(runtime, message, finalText, capturedUsage),
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
finally {
|
|
1819
|
+
opts?.abortSignal?.removeEventListener("abort", onExternalAbort);
|
|
1820
|
+
try {
|
|
1821
|
+
await persistMessageTrajectoryGrouping(runtime, message);
|
|
1822
|
+
}
|
|
1823
|
+
catch (err) {
|
|
1824
|
+
runtime.logger.warn({
|
|
1825
|
+
err,
|
|
1826
|
+
src: "eliza-api",
|
|
1827
|
+
messageId: message.id,
|
|
1828
|
+
roomId: message.roomId,
|
|
1829
|
+
}, "Failed to persist trajectory grouping metadata");
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
function createConversationTitleAbortSignal(options = {}) {
|
|
1834
|
+
const controller = new AbortController();
|
|
1835
|
+
const abortFromCaller = () => {
|
|
1836
|
+
controller.abort(options.signal?.reason ?? new Error("Request aborted"));
|
|
1837
|
+
};
|
|
1838
|
+
if (options.signal?.aborted) {
|
|
1839
|
+
abortFromCaller();
|
|
1840
|
+
}
|
|
1841
|
+
else {
|
|
1842
|
+
options.signal?.addEventListener("abort", abortFromCaller, { once: true });
|
|
1843
|
+
}
|
|
1844
|
+
const timeoutMs = typeof options.timeoutMs === "number" &&
|
|
1845
|
+
Number.isFinite(options.timeoutMs) &&
|
|
1846
|
+
options.timeoutMs > 0
|
|
1847
|
+
? Math.floor(options.timeoutMs)
|
|
1848
|
+
: DEFAULT_CONVERSATION_TITLE_TIMEOUT_MS;
|
|
1849
|
+
const timer = setTimeout(() => {
|
|
1850
|
+
controller.abort(new DOMException(`Conversation title generation timed out after ${timeoutMs}ms`, "TimeoutError"));
|
|
1851
|
+
}, timeoutMs);
|
|
1852
|
+
timer.unref?.();
|
|
1853
|
+
return {
|
|
1854
|
+
signal: controller.signal,
|
|
1855
|
+
cleanup: () => {
|
|
1856
|
+
clearTimeout(timer);
|
|
1857
|
+
options.signal?.removeEventListener("abort", abortFromCaller);
|
|
1858
|
+
},
|
|
1859
|
+
};
|
|
1860
|
+
}
|
|
1861
|
+
function isAbortLikeError(err) {
|
|
1862
|
+
if (!(err instanceof Error))
|
|
1863
|
+
return false;
|
|
1864
|
+
return (err.name === "AbortError" ||
|
|
1865
|
+
err.name === "TimeoutError" ||
|
|
1866
|
+
err.message.toLowerCase().includes("aborted"));
|
|
1867
|
+
}
|
|
1868
|
+
export async function generateConversationTitle(runtime, userMessage, agentName, options) {
|
|
1869
|
+
const modelClass = ModelType.TEXT_SMALL;
|
|
1870
|
+
const prompt = `Based on the user's first message in a new chat, generate a very short, concise title (max 4-5 words) for the conversation.
|
|
1871
|
+
The agent's name is "${agentName}". The title should reflect the topic or intent of the user.
|
|
1872
|
+
Ideally, the title should fit the persona/vibe of the agent if possible, but clarity is more important.
|
|
1873
|
+
Do not use quotes. Do not include "Title:" prefix.
|
|
1874
|
+
|
|
1875
|
+
User message: "${userMessage}"
|
|
1876
|
+
|
|
1877
|
+
Title:`;
|
|
1878
|
+
const abort = createConversationTitleAbortSignal(options);
|
|
1879
|
+
try {
|
|
1880
|
+
const title = await runtime.useModel(modelClass, {
|
|
1881
|
+
prompt,
|
|
1882
|
+
maxTokens: 20,
|
|
1883
|
+
temperature: 0.7,
|
|
1884
|
+
signal: abort.signal,
|
|
1885
|
+
});
|
|
1886
|
+
if (!title)
|
|
1887
|
+
return null;
|
|
1888
|
+
let cleanTitle = title.trim();
|
|
1889
|
+
if ((cleanTitle.startsWith('"') && cleanTitle.endsWith('"')) ||
|
|
1890
|
+
(cleanTitle.startsWith("'") && cleanTitle.endsWith("'"))) {
|
|
1891
|
+
cleanTitle = cleanTitle.slice(1, -1);
|
|
1892
|
+
}
|
|
1893
|
+
if (!cleanTitle || cleanTitle.length > 50)
|
|
1894
|
+
return null;
|
|
1895
|
+
return cleanTitle;
|
|
1896
|
+
}
|
|
1897
|
+
catch (err) {
|
|
1898
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1899
|
+
if (isAbortLikeError(err)) {
|
|
1900
|
+
logger.info(`[eliza] Conversation title generation cancelled: ${message}`);
|
|
1901
|
+
}
|
|
1902
|
+
else {
|
|
1903
|
+
logger.warn(`[eliza] Failed to generate conversation title: ${message}`);
|
|
1904
|
+
}
|
|
1905
|
+
return null;
|
|
1906
|
+
}
|
|
1907
|
+
finally {
|
|
1908
|
+
abort.cleanup();
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
export function resolveChatAdminEntityId(state) {
|
|
1912
|
+
return resolveClientChatAdminEntityId(state);
|
|
1913
|
+
}
|
|
1914
|
+
async function ensureCompatChatConnection(state, runtime, agentName, channelIdPrefix, roomKey) {
|
|
1915
|
+
const userId = ensureAdminEntityIdForChat(state);
|
|
1916
|
+
const roomId = stringToUuid(`${agentName}-${channelIdPrefix}-room-${roomKey}`);
|
|
1917
|
+
const worldId = stringToUuid(`${agentName}-web-chat-world`);
|
|
1918
|
+
const messageServerId = stringToUuid(`${agentName}-web-server`);
|
|
1919
|
+
await runtime.ensureConnection({
|
|
1920
|
+
entityId: userId,
|
|
1921
|
+
roomId,
|
|
1922
|
+
worldId,
|
|
1923
|
+
userName: resolveAppUserName(state.config),
|
|
1924
|
+
source: "client_chat",
|
|
1925
|
+
channelId: `${channelIdPrefix}-${roomKey}`,
|
|
1926
|
+
type: ChannelType.DM,
|
|
1927
|
+
messageServerId,
|
|
1928
|
+
metadata: { ownership: { ownerId: userId } },
|
|
1929
|
+
});
|
|
1930
|
+
// Ensure world ownership
|
|
1931
|
+
const world = await runtime.getWorld(worldId);
|
|
1932
|
+
if (world) {
|
|
1933
|
+
let needsUpdate = false;
|
|
1934
|
+
if (!world.metadata) {
|
|
1935
|
+
world.metadata = {};
|
|
1936
|
+
needsUpdate = true;
|
|
1937
|
+
}
|
|
1938
|
+
if (!world.metadata.ownership ||
|
|
1939
|
+
typeof world.metadata.ownership !== "object" ||
|
|
1940
|
+
world.metadata.ownership.ownerId !== userId) {
|
|
1941
|
+
world.metadata.ownership = { ownerId: userId };
|
|
1942
|
+
needsUpdate = true;
|
|
1943
|
+
}
|
|
1944
|
+
const metadataWithRoles = world.metadata;
|
|
1945
|
+
const roles = metadataWithRoles.roles ?? {};
|
|
1946
|
+
if (roles[userId] !== "OWNER") {
|
|
1947
|
+
roles[userId] = "OWNER";
|
|
1948
|
+
metadataWithRoles.roles = roles;
|
|
1949
|
+
needsUpdate = true;
|
|
1950
|
+
}
|
|
1951
|
+
if (needsUpdate) {
|
|
1952
|
+
await runtime.updateWorld(world);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
return { userId, roomId, worldId };
|
|
1956
|
+
}
|
|
1957
|
+
function ensureAdminEntityIdForChat(state) {
|
|
1958
|
+
return resolveChatAdminEntityId(state);
|
|
1959
|
+
}
|
|
1960
|
+
function syncRuntimeCharacterToChatStateConfig(state) {
|
|
1961
|
+
if (!state.runtime || !state.config) {
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
syncCharacterIntoConfig(state.config, state.runtime.character);
|
|
1965
|
+
}
|
|
1966
|
+
// ---------------------------------------------------------------------------
|
|
1967
|
+
// Main route handler
|
|
1968
|
+
// ---------------------------------------------------------------------------
|
|
1969
|
+
export async function handleChatRoutes(ctx) {
|
|
1970
|
+
const { req, res, method, pathname, readJsonBody, json, state } = ctx;
|
|
1971
|
+
// ── GET /v1/models (OpenAI compatible) ─────────────────────────────────
|
|
1972
|
+
if (method === "GET" && pathname === "/v1/models") {
|
|
1973
|
+
const created = Math.floor(Date.now() / 1000);
|
|
1974
|
+
const ids = new Set();
|
|
1975
|
+
ids.add("eliza");
|
|
1976
|
+
if (state.agentName.trim())
|
|
1977
|
+
ids.add(state.agentName.trim());
|
|
1978
|
+
if (state.runtime?.character.name?.trim())
|
|
1979
|
+
ids.add(state.runtime.character.name.trim());
|
|
1980
|
+
json(res, {
|
|
1981
|
+
object: "list",
|
|
1982
|
+
data: Array.from(ids).map((id) => ({
|
|
1983
|
+
id,
|
|
1984
|
+
object: "model",
|
|
1985
|
+
created,
|
|
1986
|
+
owned_by: "eliza",
|
|
1987
|
+
})),
|
|
1988
|
+
});
|
|
1989
|
+
return true;
|
|
1990
|
+
}
|
|
1991
|
+
// ── GET /v1/models/:id (OpenAI compatible) ─────────────────────────────
|
|
1992
|
+
if (method === "GET" && /^\/v1\/models\/[^/]+$/.test(pathname)) {
|
|
1993
|
+
const created = Math.floor(Date.now() / 1000);
|
|
1994
|
+
const raw = pathname.split("/")[3] ?? "";
|
|
1995
|
+
const decoded = decodePathComponent(raw, res, "model id");
|
|
1996
|
+
if (!decoded)
|
|
1997
|
+
return true;
|
|
1998
|
+
const id = decoded.trim();
|
|
1999
|
+
if (!id) {
|
|
2000
|
+
json(res, {
|
|
2001
|
+
error: {
|
|
2002
|
+
message: "Model id is required",
|
|
2003
|
+
type: "invalid_request_error",
|
|
2004
|
+
},
|
|
2005
|
+
}, 400);
|
|
2006
|
+
return true;
|
|
2007
|
+
}
|
|
2008
|
+
json(res, { id, object: "model", created, owned_by: "eliza" });
|
|
2009
|
+
return true;
|
|
2010
|
+
}
|
|
2011
|
+
// ── POST /v1/chat/completions (OpenAI compatible) ──────────────────────
|
|
2012
|
+
if (method === "POST" && pathname === "/v1/chat/completions") {
|
|
2013
|
+
const body = await readJsonBody(req, res);
|
|
2014
|
+
if (!body)
|
|
2015
|
+
return true;
|
|
2016
|
+
if (hasBlockedObjectKeyDeep(body)) {
|
|
2017
|
+
json(res, {
|
|
2018
|
+
error: {
|
|
2019
|
+
message: "Request body contains a blocked object key",
|
|
2020
|
+
type: "invalid_request_error",
|
|
2021
|
+
},
|
|
2022
|
+
}, 400);
|
|
2023
|
+
return true;
|
|
2024
|
+
}
|
|
2025
|
+
const safeBody = cloneWithoutBlockedObjectKeys(body);
|
|
2026
|
+
const extracted = extractOpenAiSystemAndLastUser(safeBody.messages);
|
|
2027
|
+
if (!extracted) {
|
|
2028
|
+
json(res, {
|
|
2029
|
+
error: {
|
|
2030
|
+
message: "messages must be an array containing at least one user message",
|
|
2031
|
+
type: "invalid_request_error",
|
|
2032
|
+
},
|
|
2033
|
+
}, 400);
|
|
2034
|
+
return true;
|
|
2035
|
+
}
|
|
2036
|
+
const roomKey = resolveCompatRoomKey(safeBody).slice(0, 120);
|
|
2037
|
+
const wantsStream = safeBody.stream === true ||
|
|
2038
|
+
(req.headers.accept ?? "").includes("text/event-stream");
|
|
2039
|
+
const requestedModel = typeof safeBody.model === "string" && safeBody.model.trim()
|
|
2040
|
+
? safeBody.model.trim()
|
|
2041
|
+
: null;
|
|
2042
|
+
const prompt = extracted.system
|
|
2043
|
+
? `${extracted.system}\n\n${extracted.user}`.trim()
|
|
2044
|
+
: extracted.user;
|
|
2045
|
+
const created = Math.floor(Date.now() / 1000);
|
|
2046
|
+
const id = `chatcmpl-${crypto.randomUUID()}`;
|
|
2047
|
+
const model = requestedModel ?? state.agentName;
|
|
2048
|
+
if (wantsStream) {
|
|
2049
|
+
initSse(res);
|
|
2050
|
+
let aborted = false;
|
|
2051
|
+
req.on("close", () => {
|
|
2052
|
+
aborted = true;
|
|
2053
|
+
});
|
|
2054
|
+
const sendChunk = (delta, finishReason) => {
|
|
2055
|
+
writeSseData(res, JSON.stringify({
|
|
2056
|
+
id,
|
|
2057
|
+
object: "chat.completion.chunk",
|
|
2058
|
+
created,
|
|
2059
|
+
model,
|
|
2060
|
+
choices: [
|
|
2061
|
+
{
|
|
2062
|
+
index: 0,
|
|
2063
|
+
delta,
|
|
2064
|
+
finish_reason: finishReason,
|
|
2065
|
+
},
|
|
2066
|
+
],
|
|
2067
|
+
}));
|
|
2068
|
+
};
|
|
2069
|
+
try {
|
|
2070
|
+
if (!state.runtime) {
|
|
2071
|
+
writeSseData(res, JSON.stringify({
|
|
2072
|
+
error: {
|
|
2073
|
+
message: "Agent is not running",
|
|
2074
|
+
type: "service_unavailable",
|
|
2075
|
+
},
|
|
2076
|
+
}));
|
|
2077
|
+
writeSseData(res, "[DONE]");
|
|
2078
|
+
return true;
|
|
2079
|
+
}
|
|
2080
|
+
sendChunk({ role: "assistant" }, null);
|
|
2081
|
+
let fullText = "";
|
|
2082
|
+
{
|
|
2083
|
+
const runtime = state.runtime;
|
|
2084
|
+
if (!runtime)
|
|
2085
|
+
throw new Error("Agent is not running");
|
|
2086
|
+
const agentName = runtime.character.name ?? "Eliza";
|
|
2087
|
+
const { userId, roomId } = await ensureCompatChatConnection(state, runtime, agentName, "openai-compat", roomKey);
|
|
2088
|
+
const message = createMessageMemory({
|
|
2089
|
+
id: crypto.randomUUID(),
|
|
2090
|
+
entityId: userId,
|
|
2091
|
+
agentId: runtime.agentId,
|
|
2092
|
+
roomId,
|
|
2093
|
+
content: {
|
|
2094
|
+
text: prompt,
|
|
2095
|
+
source: "compat_openai",
|
|
2096
|
+
channelType: ChannelType.API,
|
|
2097
|
+
},
|
|
2098
|
+
});
|
|
2099
|
+
const result = await generateChatResponse(runtime, message, state.agentName, {
|
|
2100
|
+
isAborted: () => aborted,
|
|
2101
|
+
onChunk: (chunk) => {
|
|
2102
|
+
fullText += chunk;
|
|
2103
|
+
if (chunk)
|
|
2104
|
+
sendChunk({ content: chunk }, null);
|
|
2105
|
+
},
|
|
2106
|
+
resolveNoResponseText: () => resolveNoResponseFallback(state.logBuffer, runtime),
|
|
2107
|
+
});
|
|
2108
|
+
if (result.localInference && !fullText) {
|
|
2109
|
+
fullText = result.text;
|
|
2110
|
+
sendChunk({ content: result.text }, null);
|
|
2111
|
+
}
|
|
2112
|
+
syncRuntimeCharacterToChatStateConfig(state);
|
|
2113
|
+
}
|
|
2114
|
+
const resolved = normalizeChatResponseText(fullText, state.logBuffer, state.runtime);
|
|
2115
|
+
if ((fullText.trim().length === 0 || isNoResponsePlaceholder(fullText)) &&
|
|
2116
|
+
resolved.trim()) {
|
|
2117
|
+
sendChunk({ content: resolved }, null);
|
|
2118
|
+
}
|
|
2119
|
+
sendChunk({}, "stop");
|
|
2120
|
+
writeSseData(res, "[DONE]");
|
|
2121
|
+
}
|
|
2122
|
+
catch (err) {
|
|
2123
|
+
if (!aborted) {
|
|
2124
|
+
if (isLocalInferenceError(err)) {
|
|
2125
|
+
const { getLocalInferenceChatStatus } = await getLocalInferenceChatApi();
|
|
2126
|
+
const localFailure = await getLocalInferenceChatStatus("status", err);
|
|
2127
|
+
writeSseData(res, JSON.stringify({
|
|
2128
|
+
error: {
|
|
2129
|
+
message: localFailure.text,
|
|
2130
|
+
type: "local_inference",
|
|
2131
|
+
localInference: localFailure.localInference,
|
|
2132
|
+
},
|
|
2133
|
+
}));
|
|
2134
|
+
}
|
|
2135
|
+
else if (isNoProviderError(err)) {
|
|
2136
|
+
writeSseData(res, JSON.stringify({
|
|
2137
|
+
error: {
|
|
2138
|
+
message: NO_PROVIDER_CHAT_MESSAGE,
|
|
2139
|
+
type: "no_provider",
|
|
2140
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2141
|
+
},
|
|
2142
|
+
}));
|
|
2143
|
+
}
|
|
2144
|
+
else {
|
|
2145
|
+
writeSseData(res, JSON.stringify({
|
|
2146
|
+
error: {
|
|
2147
|
+
message: getErrorMessage(err),
|
|
2148
|
+
type: "server_error",
|
|
2149
|
+
},
|
|
2150
|
+
}));
|
|
2151
|
+
}
|
|
2152
|
+
writeSseData(res, "[DONE]");
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
finally {
|
|
2156
|
+
res.end();
|
|
2157
|
+
}
|
|
2158
|
+
return true;
|
|
2159
|
+
}
|
|
2160
|
+
// Non-streaming
|
|
2161
|
+
try {
|
|
2162
|
+
let responseText;
|
|
2163
|
+
let localInference;
|
|
2164
|
+
let failureKind;
|
|
2165
|
+
{
|
|
2166
|
+
if (!state.runtime) {
|
|
2167
|
+
json(res, {
|
|
2168
|
+
error: {
|
|
2169
|
+
message: "Agent is not running",
|
|
2170
|
+
type: "service_unavailable",
|
|
2171
|
+
},
|
|
2172
|
+
}, 503);
|
|
2173
|
+
return true;
|
|
2174
|
+
}
|
|
2175
|
+
const runtime = state.runtime;
|
|
2176
|
+
const agentName = runtime.character.name ?? "Eliza";
|
|
2177
|
+
const { userId, roomId } = await ensureCompatChatConnection(state, runtime, agentName, "openai-compat", roomKey);
|
|
2178
|
+
const message = createMessageMemory({
|
|
2179
|
+
id: crypto.randomUUID(),
|
|
2180
|
+
entityId: userId,
|
|
2181
|
+
roomId,
|
|
2182
|
+
content: {
|
|
2183
|
+
text: prompt,
|
|
2184
|
+
source: "compat_openai",
|
|
2185
|
+
channelType: ChannelType.API,
|
|
2186
|
+
},
|
|
2187
|
+
});
|
|
2188
|
+
const result = await generateChatResponse(runtime, message, state.agentName, {
|
|
2189
|
+
resolveNoResponseText: () => resolveNoResponseFallback(state.logBuffer, runtime),
|
|
2190
|
+
});
|
|
2191
|
+
syncRuntimeCharacterToChatStateConfig(state);
|
|
2192
|
+
responseText = result.text;
|
|
2193
|
+
localInference = result.localInference;
|
|
2194
|
+
failureKind = result.failureKind;
|
|
2195
|
+
}
|
|
2196
|
+
if (failureKind === "no_provider") {
|
|
2197
|
+
json(res, {
|
|
2198
|
+
error: {
|
|
2199
|
+
message: NO_PROVIDER_CHAT_MESSAGE,
|
|
2200
|
+
type: "no_provider",
|
|
2201
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2202
|
+
},
|
|
2203
|
+
}, 503);
|
|
2204
|
+
return true;
|
|
2205
|
+
}
|
|
2206
|
+
const resolvedText = normalizeChatResponseText(responseText, state.logBuffer, state.runtime);
|
|
2207
|
+
json(res, {
|
|
2208
|
+
id,
|
|
2209
|
+
object: "chat.completion",
|
|
2210
|
+
created,
|
|
2211
|
+
model,
|
|
2212
|
+
choices: [
|
|
2213
|
+
{
|
|
2214
|
+
index: 0,
|
|
2215
|
+
message: { role: "assistant", content: resolvedText },
|
|
2216
|
+
finish_reason: "stop",
|
|
2217
|
+
},
|
|
2218
|
+
],
|
|
2219
|
+
...(failureKind ? { failureKind } : {}),
|
|
2220
|
+
...(localInference ? { localInference } : {}),
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
catch (err) {
|
|
2224
|
+
if (isLocalInferenceError(err)) {
|
|
2225
|
+
const { getLocalInferenceChatStatus } = await getLocalInferenceChatApi();
|
|
2226
|
+
const localFailure = await getLocalInferenceChatStatus("status", err);
|
|
2227
|
+
json(res, {
|
|
2228
|
+
error: {
|
|
2229
|
+
message: localFailure.text,
|
|
2230
|
+
type: "local_inference",
|
|
2231
|
+
localInference: localFailure.localInference,
|
|
2232
|
+
},
|
|
2233
|
+
}, 503);
|
|
2234
|
+
}
|
|
2235
|
+
else if (isNoProviderError(err)) {
|
|
2236
|
+
json(res, {
|
|
2237
|
+
error: {
|
|
2238
|
+
message: NO_PROVIDER_CHAT_MESSAGE,
|
|
2239
|
+
type: "no_provider",
|
|
2240
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2241
|
+
},
|
|
2242
|
+
}, 503);
|
|
2243
|
+
}
|
|
2244
|
+
else {
|
|
2245
|
+
json(res, { error: { message: getErrorMessage(err), type: "server_error" } }, 500);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
return true;
|
|
2249
|
+
}
|
|
2250
|
+
// ── POST /v1/messages (Anthropic compatible) ───────────────────────────
|
|
2251
|
+
if (method === "POST" && pathname === "/v1/messages") {
|
|
2252
|
+
const body = await readJsonBody(req, res);
|
|
2253
|
+
if (!body)
|
|
2254
|
+
return true;
|
|
2255
|
+
if (hasBlockedObjectKeyDeep(body)) {
|
|
2256
|
+
json(res, {
|
|
2257
|
+
error: {
|
|
2258
|
+
type: "invalid_request_error",
|
|
2259
|
+
message: "Request body contains a blocked object key",
|
|
2260
|
+
},
|
|
2261
|
+
}, 400);
|
|
2262
|
+
return true;
|
|
2263
|
+
}
|
|
2264
|
+
const safeBody = cloneWithoutBlockedObjectKeys(body);
|
|
2265
|
+
const extracted = extractAnthropicSystemAndLastUser({
|
|
2266
|
+
system: safeBody.system,
|
|
2267
|
+
messages: safeBody.messages,
|
|
2268
|
+
});
|
|
2269
|
+
if (!extracted) {
|
|
2270
|
+
json(res, {
|
|
2271
|
+
error: {
|
|
2272
|
+
type: "invalid_request_error",
|
|
2273
|
+
message: "messages must be an array containing at least one user message",
|
|
2274
|
+
},
|
|
2275
|
+
}, 400);
|
|
2276
|
+
return true;
|
|
2277
|
+
}
|
|
2278
|
+
const roomKey = resolveCompatRoomKey(safeBody).slice(0, 120);
|
|
2279
|
+
const wantsStream = safeBody.stream === true ||
|
|
2280
|
+
(req.headers.accept ?? "").includes("text/event-stream");
|
|
2281
|
+
const requestedModel = typeof safeBody.model === "string" && safeBody.model.trim()
|
|
2282
|
+
? safeBody.model.trim()
|
|
2283
|
+
: null;
|
|
2284
|
+
const prompt = extracted.system
|
|
2285
|
+
? `${extracted.system}\n\n${extracted.user}`.trim()
|
|
2286
|
+
: extracted.user;
|
|
2287
|
+
const id = `msg_${crypto.randomUUID().replace(/-/g, "")}`;
|
|
2288
|
+
const model = requestedModel ?? state.agentName;
|
|
2289
|
+
if (wantsStream) {
|
|
2290
|
+
initSse(res);
|
|
2291
|
+
let aborted = false;
|
|
2292
|
+
req.on("close", () => {
|
|
2293
|
+
aborted = true;
|
|
2294
|
+
});
|
|
2295
|
+
try {
|
|
2296
|
+
if (!state.runtime) {
|
|
2297
|
+
writeSseJson(res, {
|
|
2298
|
+
type: "error",
|
|
2299
|
+
error: {
|
|
2300
|
+
type: "service_unavailable",
|
|
2301
|
+
message: "Agent is not running",
|
|
2302
|
+
},
|
|
2303
|
+
}, "error");
|
|
2304
|
+
return true;
|
|
2305
|
+
}
|
|
2306
|
+
// Anthropic's wire format reports input_tokens on message_start (the
|
|
2307
|
+
// prompt is fully known here) and accumulates output_tokens on the
|
|
2308
|
+
// closing message_delta. We don't have a real model-side prompt count
|
|
2309
|
+
// before generation, so input_tokens is the same heuristic estimate the
|
|
2310
|
+
// rest of this file uses (estimateTokenCount); output_tokens is filled
|
|
2311
|
+
// from the real generation result below.
|
|
2312
|
+
const inputTokens = estimateTokenCount(prompt);
|
|
2313
|
+
writeSseJson(res, {
|
|
2314
|
+
type: "message_start",
|
|
2315
|
+
message: {
|
|
2316
|
+
id,
|
|
2317
|
+
type: "message",
|
|
2318
|
+
role: "assistant",
|
|
2319
|
+
model,
|
|
2320
|
+
content: [],
|
|
2321
|
+
stop_reason: null,
|
|
2322
|
+
stop_sequence: null,
|
|
2323
|
+
usage: { input_tokens: inputTokens, output_tokens: 0 },
|
|
2324
|
+
},
|
|
2325
|
+
}, "message_start");
|
|
2326
|
+
writeSseJson(res, {
|
|
2327
|
+
type: "content_block_start",
|
|
2328
|
+
index: 0,
|
|
2329
|
+
content_block: { type: "text", text: "" },
|
|
2330
|
+
}, "content_block_start");
|
|
2331
|
+
let fullText = "";
|
|
2332
|
+
let outputTokens = 0;
|
|
2333
|
+
const onDelta = (chunk) => {
|
|
2334
|
+
if (!chunk)
|
|
2335
|
+
return;
|
|
2336
|
+
fullText += chunk;
|
|
2337
|
+
writeSseJson(res, {
|
|
2338
|
+
type: "content_block_delta",
|
|
2339
|
+
index: 0,
|
|
2340
|
+
delta: { type: "text_delta", text: chunk },
|
|
2341
|
+
}, "content_block_delta");
|
|
2342
|
+
};
|
|
2343
|
+
{
|
|
2344
|
+
const runtime = state.runtime;
|
|
2345
|
+
if (!runtime)
|
|
2346
|
+
throw new Error("Agent is not running");
|
|
2347
|
+
const agentName = runtime.character.name ?? "Eliza";
|
|
2348
|
+
const { userId, roomId } = await ensureCompatChatConnection(state, runtime, agentName, "anthropic-compat", roomKey);
|
|
2349
|
+
const message = createMessageMemory({
|
|
2350
|
+
id: crypto.randomUUID(),
|
|
2351
|
+
entityId: userId,
|
|
2352
|
+
roomId,
|
|
2353
|
+
content: {
|
|
2354
|
+
text: prompt,
|
|
2355
|
+
source: "compat_anthropic",
|
|
2356
|
+
channelType: ChannelType.API,
|
|
2357
|
+
},
|
|
2358
|
+
});
|
|
2359
|
+
const generation = await generateChatResponse(runtime, message, state.agentName, {
|
|
2360
|
+
isAborted: () => aborted,
|
|
2361
|
+
onChunk: onDelta,
|
|
2362
|
+
resolveNoResponseText: () => resolveNoResponseFallback(state.logBuffer, runtime),
|
|
2363
|
+
});
|
|
2364
|
+
outputTokens = generation.usage?.completionTokens ?? outputTokens;
|
|
2365
|
+
syncRuntimeCharacterToChatStateConfig(state);
|
|
2366
|
+
}
|
|
2367
|
+
const resolved = normalizeChatResponseText(fullText, state.logBuffer, state.runtime);
|
|
2368
|
+
if ((fullText.trim().length === 0 || isNoResponsePlaceholder(fullText)) &&
|
|
2369
|
+
resolved.trim()) {
|
|
2370
|
+
onDelta(resolved);
|
|
2371
|
+
}
|
|
2372
|
+
writeSseJson(res, { type: "content_block_stop", index: 0 }, "content_block_stop");
|
|
2373
|
+
writeSseJson(res, {
|
|
2374
|
+
type: "message_delta",
|
|
2375
|
+
delta: { stop_reason: "end_turn", stop_sequence: null },
|
|
2376
|
+
usage: {
|
|
2377
|
+
output_tokens: outputTokens > 0 ? outputTokens : estimateTokenCount(fullText),
|
|
2378
|
+
},
|
|
2379
|
+
}, "message_delta");
|
|
2380
|
+
writeSseJson(res, { type: "message_stop" }, "message_stop");
|
|
2381
|
+
}
|
|
2382
|
+
catch (err) {
|
|
2383
|
+
if (!aborted) {
|
|
2384
|
+
if (isNoProviderError(err)) {
|
|
2385
|
+
writeSseJson(res, {
|
|
2386
|
+
type: "error",
|
|
2387
|
+
error: {
|
|
2388
|
+
type: "no_provider",
|
|
2389
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2390
|
+
message: NO_PROVIDER_CHAT_MESSAGE,
|
|
2391
|
+
},
|
|
2392
|
+
}, "error");
|
|
2393
|
+
}
|
|
2394
|
+
else {
|
|
2395
|
+
writeSseJson(res, {
|
|
2396
|
+
type: "error",
|
|
2397
|
+
error: { type: "server_error", message: getErrorMessage(err) },
|
|
2398
|
+
}, "error");
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
finally {
|
|
2403
|
+
res.end();
|
|
2404
|
+
}
|
|
2405
|
+
return true;
|
|
2406
|
+
}
|
|
2407
|
+
// Non-streaming
|
|
2408
|
+
try {
|
|
2409
|
+
let responseText;
|
|
2410
|
+
let inputTokens = estimateTokenCount(prompt);
|
|
2411
|
+
let outputTokens = 0;
|
|
2412
|
+
{
|
|
2413
|
+
if (!state.runtime) {
|
|
2414
|
+
json(res, {
|
|
2415
|
+
error: {
|
|
2416
|
+
type: "service_unavailable",
|
|
2417
|
+
message: "Agent is not running",
|
|
2418
|
+
},
|
|
2419
|
+
}, 503);
|
|
2420
|
+
return true;
|
|
2421
|
+
}
|
|
2422
|
+
const runtime = state.runtime;
|
|
2423
|
+
const agentName = runtime.character.name ?? "Eliza";
|
|
2424
|
+
const { userId, roomId } = await ensureCompatChatConnection(state, runtime, agentName, "anthropic-compat", roomKey);
|
|
2425
|
+
const message = createMessageMemory({
|
|
2426
|
+
id: crypto.randomUUID(),
|
|
2427
|
+
entityId: userId,
|
|
2428
|
+
roomId,
|
|
2429
|
+
content: {
|
|
2430
|
+
text: prompt,
|
|
2431
|
+
source: "compat_anthropic",
|
|
2432
|
+
channelType: ChannelType.API,
|
|
2433
|
+
},
|
|
2434
|
+
});
|
|
2435
|
+
const result = await generateChatResponse(runtime, message, state.agentName, {
|
|
2436
|
+
resolveNoResponseText: () => resolveNoResponseFallback(state.logBuffer, runtime),
|
|
2437
|
+
});
|
|
2438
|
+
syncRuntimeCharacterToChatStateConfig(state);
|
|
2439
|
+
responseText = result.text;
|
|
2440
|
+
if (result.usage) {
|
|
2441
|
+
inputTokens = result.usage.promptTokens;
|
|
2442
|
+
outputTokens = result.usage.completionTokens;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
const resolvedText = normalizeChatResponseText(responseText, state.logBuffer, state.runtime);
|
|
2446
|
+
json(res, {
|
|
2447
|
+
id,
|
|
2448
|
+
type: "message",
|
|
2449
|
+
role: "assistant",
|
|
2450
|
+
model,
|
|
2451
|
+
content: [{ type: "text", text: resolvedText }],
|
|
2452
|
+
stop_reason: "end_turn",
|
|
2453
|
+
stop_sequence: null,
|
|
2454
|
+
usage: {
|
|
2455
|
+
input_tokens: inputTokens,
|
|
2456
|
+
output_tokens: outputTokens > 0 ? outputTokens : estimateTokenCount(resolvedText),
|
|
2457
|
+
},
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
catch (err) {
|
|
2461
|
+
if (isNoProviderError(err)) {
|
|
2462
|
+
json(res, {
|
|
2463
|
+
error: {
|
|
2464
|
+
type: "no_provider",
|
|
2465
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2466
|
+
message: NO_PROVIDER_CHAT_MESSAGE,
|
|
2467
|
+
},
|
|
2468
|
+
}, 503);
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
json(res, { error: { type: "server_error", message: getErrorMessage(err) } }, 500);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
return true;
|
|
2475
|
+
}
|
|
2476
|
+
// ── POST /api/agents/:id/message ───────────────────────────────────────
|
|
2477
|
+
// Local-mode mirror of the cloud agent-server's per-agent message
|
|
2478
|
+
// endpoint (`packages/cloud-services/agent-server/src/routes.ts`). Shares the
|
|
2479
|
+
// same `generateChatResponse` path as `/v1/chat/completions` so model
|
|
2480
|
+
// routing (incl. local-inference TEXT_LARGE handlers) is identical.
|
|
2481
|
+
if (method === "POST" && /^\/api\/agents\/[^/]+\/message$/.test(pathname)) {
|
|
2482
|
+
const rawId = pathname.split("/")[3] ?? "";
|
|
2483
|
+
const decoded = decodePathComponent(rawId, res, "agent id");
|
|
2484
|
+
if (!decoded)
|
|
2485
|
+
return true;
|
|
2486
|
+
const agentIdParam = decoded.trim();
|
|
2487
|
+
if (!agentIdParam) {
|
|
2488
|
+
json(res, { error: "agent id is required" }, 400);
|
|
2489
|
+
return true;
|
|
2490
|
+
}
|
|
2491
|
+
if (!state.runtime) {
|
|
2492
|
+
json(res, { error: "Agent is not running" }, 503);
|
|
2493
|
+
return true;
|
|
2494
|
+
}
|
|
2495
|
+
// Surface a 404 only when the caller targeted an agent that this
|
|
2496
|
+
// process doesn't actually run — distinct from "route missing", which
|
|
2497
|
+
// is what the original issue (#7680) was reporting.
|
|
2498
|
+
if (state.runtime.agentId !== agentIdParam) {
|
|
2499
|
+
json(res, { error: "Agent not found" }, 404);
|
|
2500
|
+
return true;
|
|
2501
|
+
}
|
|
2502
|
+
const body = await readJsonBody(req, res);
|
|
2503
|
+
if (!body)
|
|
2504
|
+
return true;
|
|
2505
|
+
if (hasBlockedObjectKeyDeep(body)) {
|
|
2506
|
+
json(res, { error: "Request body contains a blocked object key" }, 400);
|
|
2507
|
+
return true;
|
|
2508
|
+
}
|
|
2509
|
+
const safeBody = cloneWithoutBlockedObjectKeys(body);
|
|
2510
|
+
const userId = typeof safeBody.userId === "string" && safeBody.userId.trim().length > 0
|
|
2511
|
+
? safeBody.userId.trim()
|
|
2512
|
+
: null;
|
|
2513
|
+
const text = typeof safeBody.text === "string" && safeBody.text.trim().length > 0
|
|
2514
|
+
? safeBody.text
|
|
2515
|
+
: null;
|
|
2516
|
+
if (!userId || !text) {
|
|
2517
|
+
json(res, { error: "userId and text are required" }, 400);
|
|
2518
|
+
return true;
|
|
2519
|
+
}
|
|
2520
|
+
const platformName = typeof safeBody.platformName === "string" ? safeBody.platformName : null;
|
|
2521
|
+
const channelType = typeof safeBody.channelType === "string"
|
|
2522
|
+
? safeBody.channelType
|
|
2523
|
+
: ChannelType.API;
|
|
2524
|
+
const source = platformName || "agent_message_api";
|
|
2525
|
+
try {
|
|
2526
|
+
const runtime = state.runtime;
|
|
2527
|
+
const agentName = runtime.character.name ?? "Eliza";
|
|
2528
|
+
// Per-user room key — matches cloud `handleMessage`'s
|
|
2529
|
+
// `stringToUuid(\`${agentId}:${userId}\`)` shape closely enough that
|
|
2530
|
+
// both surfaces produce stable, user-scoped conversation rooms.
|
|
2531
|
+
const { roomId, userId: connUserId } = await ensureCompatChatConnection(state, runtime, agentName, "agent-message", `${agentIdParam}:${userId}`.slice(0, 120));
|
|
2532
|
+
const message = createMessageMemory({
|
|
2533
|
+
id: crypto.randomUUID(),
|
|
2534
|
+
entityId: connUserId,
|
|
2535
|
+
agentId: runtime.agentId,
|
|
2536
|
+
roomId,
|
|
2537
|
+
content: {
|
|
2538
|
+
text,
|
|
2539
|
+
source,
|
|
2540
|
+
channelType,
|
|
2541
|
+
},
|
|
2542
|
+
});
|
|
2543
|
+
const result = await generateChatResponse(runtime, message, state.agentName, {
|
|
2544
|
+
resolveNoResponseText: () => resolveNoResponseFallback(state.logBuffer, runtime),
|
|
2545
|
+
});
|
|
2546
|
+
syncRuntimeCharacterToChatStateConfig(state);
|
|
2547
|
+
const resolvedText = normalizeChatResponseText(result.text, state.logBuffer, state.runtime);
|
|
2548
|
+
json(res, {
|
|
2549
|
+
response: resolvedText,
|
|
2550
|
+
agentName: result.agentName,
|
|
2551
|
+
...(result.failureKind ? { failureKind: result.failureKind } : {}),
|
|
2552
|
+
...(result.localInference
|
|
2553
|
+
? { localInference: result.localInference }
|
|
2554
|
+
: {}),
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
catch (err) {
|
|
2558
|
+
if (isLocalInferenceError(err)) {
|
|
2559
|
+
const { getLocalInferenceChatStatus } = await getLocalInferenceChatApi();
|
|
2560
|
+
const localFailure = await getLocalInferenceChatStatus("status", err);
|
|
2561
|
+
json(res, {
|
|
2562
|
+
error: localFailure.text,
|
|
2563
|
+
type: "local_inference",
|
|
2564
|
+
localInference: localFailure.localInference,
|
|
2565
|
+
}, 503);
|
|
2566
|
+
}
|
|
2567
|
+
else if (isNoProviderError(err)) {
|
|
2568
|
+
json(res, {
|
|
2569
|
+
error: NO_PROVIDER_CHAT_MESSAGE,
|
|
2570
|
+
type: "no_provider",
|
|
2571
|
+
code: "NO_PROVIDER_REGISTERED",
|
|
2572
|
+
}, 503);
|
|
2573
|
+
}
|
|
2574
|
+
else {
|
|
2575
|
+
json(res, { error: getErrorMessage(err) }, 500);
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
return true;
|
|
2579
|
+
}
|
|
2580
|
+
return false;
|
|
2581
|
+
}
|