@elizaos/agent 2.0.3-beta.2 → 2.0.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/view-user-journeys.d.ts.map +1 -1
- package/__tests__/view-user-journeys.js +52 -41
- package/actions/context-signal.d.ts +2 -2
- package/actions/files.d.ts +9 -0
- package/actions/files.d.ts.map +1 -0
- package/actions/files.js +183 -0
- package/actions/index.d.ts +17 -17
- package/api/accounts-routes.d.ts +1 -1
- package/api/accounts-routes.js +1 -1
- package/api/agent-admin-routes.d.ts +1 -1
- package/api/agent-admin-routes.js +2 -2
- package/api/agent-model.d.ts +1 -1
- package/api/agent-status-routes.d.ts +1 -3
- package/api/agent-status-routes.d.ts.map +1 -1
- package/api/agent-status-routes.js +0 -2
- package/api/approval-routes.d.ts +38 -0
- package/api/approval-routes.d.ts.map +1 -0
- package/api/approval-routes.js +223 -0
- package/api/background-routes.d.ts +13 -0
- package/api/background-routes.d.ts.map +1 -0
- package/api/background-routes.js +91 -0
- package/api/binance-skill-helpers.d.ts +2 -2
- package/api/binance-skill-helpers.js +2 -2
- package/api/builtin-views.d.ts.map +1 -1
- package/api/builtin-views.js +44 -4
- package/api/character-routes.d.ts +1 -1
- package/api/chat-augmentation.d.ts.map +1 -1
- package/api/chat-augmentation.js +17 -0
- package/api/chat-routes.d.ts +29 -2
- package/api/chat-routes.d.ts.map +1 -1
- package/api/chat-routes.js +76 -1
- package/api/commands-routes.d.ts +10 -8
- package/api/commands-routes.d.ts.map +1 -1
- package/api/commands-routes.js +17 -59
- package/api/config-routes.d.ts +1 -1
- package/api/config-routes.d.ts.map +1 -1
- package/api/config-routes.js +0 -2
- package/api/connector-routes.d.ts +1 -1
- package/api/conversation-metadata.d.ts +1 -1
- package/api/conversation-metadata.d.ts.map +1 -1
- package/api/conversation-metadata.js +0 -1
- package/api/conversation-routes.d.ts +4 -3
- package/api/conversation-routes.d.ts.map +1 -1
- package/api/conversation-routes.js +34 -1
- package/api/documents-service-loader.d.ts +0 -4
- package/api/documents-service-loader.d.ts.map +1 -1
- package/api/documents-service-loader.js +0 -2
- package/api/files-routes.d.ts +14 -0
- package/api/files-routes.d.ts.map +1 -0
- package/api/files-routes.js +47 -0
- package/api/first-run-routes.d.ts +1 -1
- package/api/health-routes.d.ts +2 -2
- package/api/index.d.ts +40 -39
- package/api/index.d.ts.map +1 -1
- package/api/index.js +1 -0
- package/api/interactions-routes.d.ts +33 -0
- package/api/interactions-routes.d.ts.map +1 -0
- package/api/interactions-routes.js +63 -0
- package/api/media-runtime.d.ts +2 -1
- package/api/media-runtime.d.ts.map +1 -1
- package/api/media-runtime.js +64 -7
- package/api/media-store.d.ts +36 -0
- package/api/media-store.d.ts.map +1 -1
- package/api/media-store.js +141 -2
- package/api/memory-bounds.d.ts +0 -1
- package/api/memory-bounds.d.ts.map +1 -1
- package/api/memory-bounds.js +0 -1
- package/api/misc-routes.d.ts +1 -1
- package/api/model-provider-helpers.d.ts +2 -2
- package/api/model-provider-helpers.js +2 -2
- package/api/permissions-routes-extra.d.ts +1 -1
- package/api/permissions-routes.d.ts +1 -1
- package/api/permissions-routes.d.ts.map +1 -1
- package/api/permissions-routes.js +8 -7
- package/api/plugin-discovery-helpers.d.ts +5 -6
- package/api/plugin-discovery-helpers.d.ts.map +1 -1
- package/api/plugin-discovery-helpers.js +3 -4
- package/api/plugin-runtime-apply.d.ts +2 -2
- package/api/plugin-runtime-apply.d.ts.map +1 -1
- package/api/plugin-runtime-apply.js +74 -0
- package/api/provider-switch-config.d.ts +1 -1
- package/api/provider-switch-routes.d.ts +2 -2
- package/api/registry-routes.d.ts +1 -1
- package/api/registry-service.d.ts +1 -1
- package/api/remote-capability-routes.d.ts +2 -2
- package/api/remote-capability-routes.d.ts.map +1 -1
- package/api/remote-capability-routes.js +19 -0
- package/api/server-autonomy-helpers.d.ts +2 -2
- package/api/server-helpers-auth.d.ts +10 -0
- package/api/server-helpers-auth.d.ts.map +1 -1
- package/api/server-helpers-auth.js +16 -210
- package/api/server-helpers-config.d.ts +1 -1
- package/api/server-helpers-mcp.d.ts +2 -2
- package/api/server-helpers-plugin.d.ts +1 -1
- package/api/server-helpers-swarm.d.ts +3 -3
- package/api/server-helpers-swarm.d.ts.map +1 -1
- package/api/server-helpers-swarm.js +15 -5
- package/api/server-helpers-wallet.d.ts +1 -1
- package/api/server-helpers.d.ts +4 -4
- package/api/server-lazy-routes.d.ts +40 -38
- package/api/server-lazy-routes.d.ts.map +1 -1
- package/api/server-lazy-routes.js +7 -0
- package/api/server-route-dispatch.d.ts +2 -2
- package/api/server-route-dispatch.d.ts.map +1 -1
- package/api/server-route-dispatch.js +7 -0
- package/api/server-types.d.ts +9 -7
- package/api/server-types.d.ts.map +1 -1
- package/api/server.d.ts +19 -19
- package/api/server.d.ts.map +1 -1
- package/api/server.js +111 -17
- package/api/static-file-server.d.ts +2 -2
- package/api/static-file-server.js +2 -2
- package/api/subscription-routes.d.ts +4 -4
- package/api/subscription-routes.js +3 -4
- package/api/suggestions-routes.d.ts +1 -1
- package/api/suggestions-routes.d.ts.map +1 -1
- package/api/suggestions-routes.js +2 -3
- package/api/terminal-execution-routing.d.ts +1 -1
- package/api/training-service-like.d.ts +1 -1
- package/api/trajectory-fallback-routes.d.ts.map +1 -1
- package/api/trajectory-fallback-routes.js +21 -1
- package/api/update-routes.d.ts +1 -1
- package/api/view-registry-types.d.ts +1 -1
- package/api/views-registry.d.ts +14 -4
- package/api/views-registry.d.ts.map +1 -1
- package/api/views-registry.js +107 -72
- package/api/views-routes.d.ts +1 -1
- package/api/views-routes.d.ts.map +1 -1
- package/api/views-routes.js +131 -14
- package/api/views-search-index.d.ts +1 -1
- package/api/wallet-capability.d.ts +3 -3
- package/api/wallet-rpc.d.ts +1 -1
- package/api/wallet.d.ts +3 -3
- package/api/wallet.d.ts.map +1 -1
- package/api/wallet.js +4 -3
- package/api/workbench-context.d.ts +1 -1
- package/api/workbench-helpers.d.ts +3 -3
- package/api/workbench-helpers.js +3 -3
- package/api/workbench-routes.d.ts +2 -2
- package/api/workbench-vfs-routes.d.ts +1 -1
- package/api/ws-event-replay.d.ts +1 -2
- package/api/ws-event-replay.d.ts.map +1 -1
- package/api/ws-event-replay.js +1 -2
- package/api/x-relay-routes.d.ts +2 -2
- package/api/x402-route-validation.d.ts +4 -0
- package/api/x402-route-validation.d.ts.map +1 -0
- package/api/x402-route-validation.js +6 -0
- package/assets/view-heroes/background.png +0 -0
- package/auth/account-storage.d.ts +1 -1
- package/auth/anthropic.d.ts +1 -1
- package/auth/credentials.d.ts +2 -2
- package/auth/index.d.ts +7 -7
- package/auth/oauth-flow.d.ts +2 -2
- package/auth/openai-codex.d.ts +1 -1
- package/awareness/index.d.ts +1 -1
- package/config/config.js +0 -1
- package/config/env-vars.d.ts +1 -1
- package/config/env-vars.d.ts.map +1 -1
- package/config/env-vars.js +0 -1
- package/config/index.d.ts +10 -10
- package/config/model-metadata.d.ts +1 -1
- package/config/owner-contacts.d.ts +1 -1
- package/config/schema.d.ts +1 -1
- package/hooks/discovery.d.ts +1 -1
- package/hooks/eligibility.d.ts +2 -2
- package/hooks/index.d.ts +2 -2
- package/hooks/loader.d.ts +2 -2
- package/hooks/registry.d.ts +1 -1
- package/index.d.ts +87 -85
- package/index.d.ts.map +1 -1
- package/index.js +11 -3
- package/package.json +54 -44
- package/providers/media-provider.d.ts +1 -1
- package/providers/page-scoped-context.d.ts.map +1 -1
- package/providers/page-scoped-context.js +1 -70
- package/providers/relevant-conversations.d.ts.map +1 -1
- package/providers/relevant-conversations.js +8 -9
- package/providers/workspace.d.ts +1 -1
- package/runtime/actions/web-fetch.d.ts.map +1 -1
- package/runtime/actions/web-fetch.js +23 -3
- package/runtime/actions/web-search.d.ts +32 -0
- package/runtime/actions/web-search.d.ts.map +1 -0
- package/runtime/actions/web-search.js +245 -0
- package/runtime/advanced-capabilities-config.d.ts +1 -1
- package/runtime/boot-telemetry.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.js +1 -1
- package/runtime/conversation-compactor.d.ts +1 -1
- package/runtime/core-plugins.d.ts.map +1 -1
- package/runtime/core-plugins.js +9 -0
- package/runtime/custom-actions.d.ts +18 -9
- package/runtime/custom-actions.d.ts.map +1 -1
- package/runtime/custom-actions.js +85 -23
- package/runtime/eliza-plugin.d.ts.map +1 -1
- package/runtime/eliza-plugin.js +15 -1
- package/runtime/eliza.d.ts +9 -7
- package/runtime/eliza.d.ts.map +1 -1
- package/runtime/eliza.js +86 -23
- package/runtime/first-time-setup.d.ts +1 -3
- package/runtime/first-time-setup.d.ts.map +1 -1
- package/runtime/first-time-setup.js +0 -2
- package/runtime/index.d.ts +18 -18
- package/runtime/load-plugin-from-vfs.d.ts +2 -2
- package/runtime/mobile-dns.d.ts.map +1 -1
- package/runtime/mobile-dns.js +2 -5
- package/runtime/operations/classifier.d.ts +1 -1
- package/runtime/operations/cold-strategy.d.ts +1 -1
- package/runtime/operations/health-checks.d.ts +1 -1
- package/runtime/operations/health.d.ts +1 -1
- package/runtime/operations/index.d.ts +10 -10
- package/runtime/operations/manager.d.ts +3 -3
- package/runtime/operations/reload-hot.d.ts +1 -1
- package/runtime/operations/repository.d.ts +1 -1
- package/runtime/operations/vault-bridge.d.ts +1 -1
- package/runtime/plugin-collector.d.ts +6 -1
- package/runtime/plugin-collector.d.ts.map +1 -1
- package/runtime/plugin-collector.js +11 -28
- package/runtime/plugin-lifecycle.d.ts.map +1 -1
- package/runtime/plugin-lifecycle.js +1 -0
- package/runtime/plugin-resolver.d.ts +2 -2
- package/runtime/plugin-resolver.d.ts.map +1 -1
- package/runtime/plugin-resolver.js +113 -65
- package/runtime/plugin-types.d.ts +1 -1
- package/runtime/prompt-optimization.d.ts +4 -4
- package/runtime/remote-coding-runner-gate.d.ts +7 -0
- package/runtime/remote-coding-runner-gate.d.ts.map +1 -0
- package/runtime/remote-coding-runner-gate.js +36 -0
- package/runtime/roles/src/index.d.ts +4 -4
- package/runtime/roles.d.ts +2 -2
- package/runtime/sandbox-character.d.ts +1 -1
- package/runtime/tool-call-cache/cache.d.ts +1 -1
- package/runtime/tool-call-cache/disk-store.d.ts +1 -1
- package/runtime/tool-call-cache/index.d.ts +6 -6
- package/runtime/tool-call-cache/key.d.ts +1 -1
- package/runtime/tool-call-cache/redact.d.ts +1 -1
- package/runtime/tool-call-cache/registry.d.ts +1 -1
- package/runtime/tool-call-cache-wrapper.d.ts +7 -9
- package/runtime/tool-call-cache-wrapper.d.ts.map +1 -1
- package/runtime/tool-call-cache-wrapper.js +6 -11
- package/runtime/trajectory-export.d.ts +3 -3
- package/runtime/trajectory-internals.d.ts +2 -1
- package/runtime/trajectory-internals.d.ts.map +1 -1
- package/runtime/trajectory-persistence.d.ts +5 -5
- package/runtime/trajectory-steps-reader.d.ts +1 -1
- package/runtime/trajectory-steps-writer.d.ts +1 -1
- package/runtime/trajectory-storage.d.ts +4 -4
- package/runtime/view-action-affinity.d.ts +18 -15
- package/runtime/view-action-affinity.d.ts.map +1 -1
- package/runtime/view-action-affinity.js +26 -29
- package/runtime/web-search-tools.d.ts +4 -1
- package/runtime/web-search-tools.d.ts.map +1 -1
- package/runtime/web-search-tools.js +37 -9
- package/security/index.d.ts +3 -3
- package/services/approval/index.d.ts +9 -0
- package/services/approval/index.d.ts.map +1 -0
- package/services/approval/index.js +8 -0
- package/services/approval/service.d.ts +35 -0
- package/services/approval/service.d.ts.map +1 -0
- package/services/approval/service.js +40 -0
- package/services/approval/sql.d.ts +18 -0
- package/services/approval/sql.d.ts.map +1 -0
- package/services/approval/sql.js +104 -0
- package/services/approval/store.d.ts +39 -0
- package/services/approval/store.d.ts.map +1 -0
- package/services/approval/store.js +534 -0
- package/services/approval/types.d.ts +207 -0
- package/services/approval/types.d.ts.map +1 -0
- package/services/approval/types.js +34 -0
- package/services/character-persistence.d.ts +2 -2
- package/services/client-chat-sender.d.ts +1 -1
- package/services/config-plugin-manager.d.ts +2 -2
- package/services/connector-setup-service.d.ts +1 -1
- package/services/cove-quote-x509.d.ts +1 -1
- package/services/cove-quote.d.ts +2 -2
- package/services/dstack-tee-provider.d.ts +1 -1
- package/services/file-storage.d.ts +20 -0
- package/services/file-storage.d.ts.map +1 -0
- package/services/file-storage.js +70 -0
- package/services/global-pause/index.d.ts +8 -0
- package/services/global-pause/index.d.ts.map +1 -0
- package/services/global-pause/index.js +7 -0
- package/services/global-pause/service.d.ts +29 -0
- package/services/global-pause/service.d.ts.map +1 -0
- package/services/global-pause/service.js +34 -0
- package/services/global-pause/store.d.ts +31 -0
- package/services/global-pause/store.d.ts.map +1 -0
- package/services/global-pause/store.js +83 -0
- package/services/handoff/index.d.ts +8 -0
- package/services/handoff/index.d.ts.map +1 -0
- package/services/handoff/index.js +7 -0
- package/services/handoff/service.d.ts +29 -0
- package/services/handoff/service.d.ts.map +1 -0
- package/services/handoff/service.js +34 -0
- package/services/handoff/store.d.ts +76 -0
- package/services/handoff/store.d.ts.map +1 -0
- package/services/handoff/store.js +148 -0
- package/services/index.d.ts +30 -31
- package/services/index.d.ts.map +1 -1
- package/services/index.js +0 -6
- package/services/js-runtime-bridge.d.ts.map +1 -1
- package/services/js-runtime-bridge.js +8 -2
- package/services/knowledge-graph/index.d.ts +4 -4
- package/services/knowledge-graph/service.d.ts +2 -2
- package/services/pending-prompts/index.d.ts +8 -0
- package/services/pending-prompts/index.d.ts.map +1 -0
- package/services/pending-prompts/index.js +7 -0
- package/services/pending-prompts/service.d.ts +34 -0
- package/services/pending-prompts/service.d.ts.map +1 -0
- package/services/pending-prompts/service.js +68 -0
- package/services/pending-prompts/store.d.ts +70 -0
- package/services/pending-prompts/store.d.ts.map +1 -0
- package/services/pending-prompts/store.js +191 -0
- package/services/plugin-compiler.d.ts +1 -1
- package/services/plugin-installer.d.ts.map +1 -1
- package/services/plugin-installer.js +21 -11
- package/services/plugin-manager-types.d.ts +1 -1
- package/services/proactive-interaction-decider.d.ts +62 -11
- package/services/proactive-interaction-decider.d.ts.map +1 -1
- package/services/proactive-interaction-decider.js +223 -35
- package/services/push/apns-provider.d.ts +1 -1
- package/services/push/fcm-provider.d.ts +1 -1
- package/services/push/notification-push-service.d.ts +2 -2
- package/services/registry-client-app-meta.d.ts +1 -1
- package/services/registry-client-endpoints.d.ts +2 -2
- package/services/registry-client-local.d.ts +1 -1
- package/services/registry-client-network.d.ts +1 -1
- package/services/registry-client-queries.d.ts +1 -1
- package/services/registry-client.d.ts +3 -3
- package/services/relationships-graph.d.ts +1 -1
- package/services/remote-capability-cloud-sandbox.d.ts +3 -3
- package/services/remote-capability-endpoint-conformance.d.ts +1 -1
- package/services/remote-capability-endpoint-provider.d.ts +4 -4
- package/services/remote-capability-url-endpoint-providers.d.ts +1 -1
- package/services/remote-plugin-adapter.d.ts.map +1 -1
- package/services/remote-plugin-adapter.js +3 -0
- package/services/remote-plugin-bridge.d.ts.map +1 -1
- package/services/remote-plugin-bridge.js +97 -26
- package/services/remote-signing-service.d.ts +4 -4
- package/services/research-task-executor.d.ts +1 -1
- package/services/sandbox-manager.d.ts +1 -1
- package/services/self-updater.d.ts +1 -1
- package/services/self-updater.d.ts.map +1 -1
- package/services/self-updater.js +23 -9
- package/services/shell-execution-router.d.ts +1 -1
- package/services/shell-execution-router.d.ts.map +1 -1
- package/services/shell-execution-router.js +19 -2
- package/services/tee-boot-gate-state.d.ts +1 -1
- package/services/tee-boot-gate.d.ts +4 -4
- package/services/tee-confidential-inference.d.ts +3 -3
- package/services/tee-key-release.d.ts +2 -2
- package/services/tee-model-key-boot.d.ts +4 -4
- package/services/tee-policy.d.ts +1 -1
- package/services/tee-production-profile.d.ts +1 -1
- package/services/tee-release-policy.d.ts +1 -1
- package/services/tee-revocation.d.ts +2 -2
- package/services/tee-runtime-config.d.ts +1 -1
- package/services/tee-sealed-volume.d.ts +3 -3
- package/services/tee-signer-backend.d.ts +3 -3
- package/services/update-checker.d.ts +1 -1
- package/services/vault-signer-backend.d.ts +1 -1
- package/services/vfs-git.d.ts +1 -1
- package/test-support/index.d.ts +3 -3
- package/triggers/runtime.d.ts +1 -1
- package/triggers/scheduling.d.ts +3 -22
- package/triggers/scheduling.d.ts.map +1 -1
- package/triggers/scheduling.js +2 -214
- package/tui/agent-terminal-tui.d.ts.map +1 -1
- package/tui/agent-terminal-tui.js +174 -72
- package/types/index.d.ts +3 -3
- package/api/nfa-routes.d.ts +0 -6
- package/api/nfa-routes.d.ts.map +0 -1
- package/api/nfa-routes.js +0 -125
- package/api/server-auth.d.ts +0 -46
- package/api/server-auth.d.ts.map +0 -1
- package/api/server-auth.js +0 -504
- package/runtime/restart.d.ts +0 -9
- package/runtime/restart.d.ts.map +0 -1
- package/runtime/restart.js +0 -8
- package/test-utils/sqlite-compat.d.ts +0 -23
- package/test-utils/sqlite-compat.d.ts.map +0 -1
- package/test-utils/sqlite-compat.js +0 -214
package/triggers/scheduling.js
CHANGED
|
@@ -1,222 +1,10 @@
|
|
|
1
|
+
import { computeNextCronRunAtMs, DISABLED_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS, MIN_TRIGGER_INTERVAL_MS, normalizeTriggerIntervalMs, parseCronExpression, parseScheduledAtIso, resolveTriggerTiming, } from "@elizaos/core";
|
|
1
2
|
import { TRIGGER_SCHEMA_VERSION, } from "./types.js";
|
|
2
|
-
export
|
|
3
|
-
export const MAX_TRIGGER_INTERVAL_MS = 31 * 24 * 60 * 60 * 1000;
|
|
4
|
-
export const DISABLED_TRIGGER_INTERVAL_MS = 365 * 24 * 60 * 60 * 1000;
|
|
3
|
+
export { computeNextCronRunAtMs, DISABLED_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS, MIN_TRIGGER_INTERVAL_MS, normalizeTriggerIntervalMs, parseCronExpression, parseScheduledAtIso, resolveTriggerTiming, };
|
|
5
4
|
export const MAX_TRIGGER_RUN_HISTORY = 100;
|
|
6
|
-
const CRON_FIELDS = 5;
|
|
7
|
-
const CRON_SCAN_WINDOW_MS = 366 * 24 * 60 * 60 * 1000;
|
|
8
|
-
const CRON_MINUTE_MS = 60_000;
|
|
9
|
-
const CRON_RANGES = [
|
|
10
|
-
{ min: 0, max: 59 },
|
|
11
|
-
{ min: 0, max: 23 },
|
|
12
|
-
{ min: 1, max: 31 },
|
|
13
|
-
{ min: 1, max: 12 },
|
|
14
|
-
{ min: 0, max: 6 },
|
|
15
|
-
];
|
|
16
|
-
function parseInteger(raw) {
|
|
17
|
-
if (!/^-?\d+$/.test(raw))
|
|
18
|
-
return null;
|
|
19
|
-
const value = Number(raw);
|
|
20
|
-
if (!Number.isFinite(value))
|
|
21
|
-
return null;
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
function clamp(value, min, max) {
|
|
25
|
-
if (value < min)
|
|
26
|
-
return min;
|
|
27
|
-
if (value > max)
|
|
28
|
-
return max;
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
5
|
export function normalizeText(value) {
|
|
32
6
|
return value.trim().replace(/\s+/g, " ");
|
|
33
7
|
}
|
|
34
|
-
function parseCronPart(part, range) {
|
|
35
|
-
const output = new Set();
|
|
36
|
-
const chunks = part.split(",");
|
|
37
|
-
for (const chunkRaw of chunks) {
|
|
38
|
-
const chunk = chunkRaw.trim();
|
|
39
|
-
if (!chunk)
|
|
40
|
-
return null;
|
|
41
|
-
const [baseRaw, stepRaw, extraStep] = chunk.split("/");
|
|
42
|
-
if (baseRaw === undefined || extraStep !== undefined)
|
|
43
|
-
return null;
|
|
44
|
-
const step = stepRaw === undefined ? 1 : parseInteger(stepRaw.trim());
|
|
45
|
-
if (step === null || step <= 0)
|
|
46
|
-
return null;
|
|
47
|
-
const base = baseRaw.trim();
|
|
48
|
-
if (base === "*") {
|
|
49
|
-
for (let value = range.min; value <= range.max; value += step) {
|
|
50
|
-
output.add(value);
|
|
51
|
-
}
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const [rangeStartRaw, rangeEndRaw, extraRange] = base.split("-");
|
|
55
|
-
if (rangeStartRaw === undefined || extraRange !== undefined)
|
|
56
|
-
return null;
|
|
57
|
-
if (rangeEndRaw === undefined) {
|
|
58
|
-
const single = parseInteger(rangeStartRaw.trim());
|
|
59
|
-
if (single === null)
|
|
60
|
-
return null;
|
|
61
|
-
if (single < range.min || single > range.max)
|
|
62
|
-
return null;
|
|
63
|
-
output.add(single);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const start = parseInteger(rangeStartRaw.trim());
|
|
67
|
-
const end = parseInteger(rangeEndRaw.trim());
|
|
68
|
-
if (start === null || end === null)
|
|
69
|
-
return null;
|
|
70
|
-
if (start > end)
|
|
71
|
-
return null;
|
|
72
|
-
if (start < range.min || end > range.max)
|
|
73
|
-
return null;
|
|
74
|
-
for (let value = start; value <= end; value += step) {
|
|
75
|
-
output.add(value);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return output.size > 0 ? output : null;
|
|
79
|
-
}
|
|
80
|
-
export function parseCronExpression(expression) {
|
|
81
|
-
const trimmed = expression.trim();
|
|
82
|
-
if (!trimmed)
|
|
83
|
-
return null;
|
|
84
|
-
const parts = trimmed.split(/\s+/);
|
|
85
|
-
if (parts.length !== CRON_FIELDS)
|
|
86
|
-
return null;
|
|
87
|
-
const [minuteExpr, hourExpr, dayOfMonthExpr, monthExpr, dayOfWeekExpr] = parts;
|
|
88
|
-
if (minuteExpr === undefined ||
|
|
89
|
-
hourExpr === undefined ||
|
|
90
|
-
dayOfMonthExpr === undefined ||
|
|
91
|
-
monthExpr === undefined ||
|
|
92
|
-
dayOfWeekExpr === undefined) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
const minute = parseCronPart(minuteExpr, CRON_RANGES[0]);
|
|
96
|
-
const hour = parseCronPart(hourExpr, CRON_RANGES[1]);
|
|
97
|
-
const dayOfMonth = parseCronPart(dayOfMonthExpr, CRON_RANGES[2]);
|
|
98
|
-
const month = parseCronPart(monthExpr, CRON_RANGES[3]);
|
|
99
|
-
const dayOfWeek = parseCronPart(dayOfWeekExpr, CRON_RANGES[4]);
|
|
100
|
-
if (!minute || !hour || !dayOfMonth || !month || !dayOfWeek) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
minute,
|
|
105
|
-
hour,
|
|
106
|
-
dayOfMonth,
|
|
107
|
-
month,
|
|
108
|
-
dayOfWeek,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function cronMatchesUTC(schedule, candidateMs) {
|
|
112
|
-
const candidate = new Date(candidateMs);
|
|
113
|
-
return (schedule.minute.has(candidate.getUTCMinutes()) &&
|
|
114
|
-
schedule.hour.has(candidate.getUTCHours()) &&
|
|
115
|
-
schedule.dayOfMonth.has(candidate.getUTCDate()) &&
|
|
116
|
-
schedule.month.has(candidate.getUTCMonth() + 1) &&
|
|
117
|
-
schedule.dayOfWeek.has(candidate.getUTCDay()));
|
|
118
|
-
}
|
|
119
|
-
function getTimezoneOffsetMs(timezone, atMs) {
|
|
120
|
-
if (!timezone || timezone === "UTC")
|
|
121
|
-
return 0;
|
|
122
|
-
try {
|
|
123
|
-
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
124
|
-
timeZone: timezone,
|
|
125
|
-
year: "numeric",
|
|
126
|
-
month: "2-digit",
|
|
127
|
-
day: "2-digit",
|
|
128
|
-
hour: "2-digit",
|
|
129
|
-
minute: "2-digit",
|
|
130
|
-
second: "2-digit",
|
|
131
|
-
hour12: false,
|
|
132
|
-
});
|
|
133
|
-
const parts = formatter.formatToParts(new Date(atMs));
|
|
134
|
-
const get = (type) => {
|
|
135
|
-
const part = parts.find((p) => p.type === type);
|
|
136
|
-
return part ? Number(part.value) : 0;
|
|
137
|
-
};
|
|
138
|
-
const tzDate = Date.UTC(get("year"), get("month") - 1, get("day"), get("hour"), get("minute"), get("second"));
|
|
139
|
-
return tzDate - atMs;
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
return 0;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function cronMatches(schedule, candidateMs, timezone) {
|
|
146
|
-
if (!timezone || timezone === "UTC") {
|
|
147
|
-
return cronMatchesUTC(schedule, candidateMs);
|
|
148
|
-
}
|
|
149
|
-
const offsetMs = getTimezoneOffsetMs(timezone, candidateMs);
|
|
150
|
-
const wallClockMs = candidateMs + offsetMs;
|
|
151
|
-
return cronMatchesUTC(schedule, wallClockMs);
|
|
152
|
-
}
|
|
153
|
-
export function computeNextCronRunAtMs(expression, fromMs, timezone) {
|
|
154
|
-
const schedule = parseCronExpression(expression);
|
|
155
|
-
if (!schedule)
|
|
156
|
-
return null;
|
|
157
|
-
const start = Math.floor(fromMs / CRON_MINUTE_MS) * CRON_MINUTE_MS;
|
|
158
|
-
const cutoff = start + CRON_SCAN_WINDOW_MS;
|
|
159
|
-
for (let candidate = start + CRON_MINUTE_MS; candidate <= cutoff; candidate += CRON_MINUTE_MS) {
|
|
160
|
-
if (cronMatches(schedule, candidate, timezone)) {
|
|
161
|
-
return candidate;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
export function parseScheduledAtIso(scheduledAtIso) {
|
|
167
|
-
const parsed = Date.parse(scheduledAtIso);
|
|
168
|
-
if (!Number.isFinite(parsed))
|
|
169
|
-
return null;
|
|
170
|
-
return parsed;
|
|
171
|
-
}
|
|
172
|
-
export function normalizeTriggerIntervalMs(intervalMs) {
|
|
173
|
-
if (!Number.isFinite(intervalMs))
|
|
174
|
-
return MIN_TRIGGER_INTERVAL_MS;
|
|
175
|
-
const rounded = Math.floor(intervalMs);
|
|
176
|
-
return clamp(rounded, MIN_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS);
|
|
177
|
-
}
|
|
178
|
-
export function resolveTriggerTiming(trigger, nowMs) {
|
|
179
|
-
if (!trigger.enabled)
|
|
180
|
-
return null;
|
|
181
|
-
if (trigger.triggerType === "interval") {
|
|
182
|
-
const intervalMs = normalizeTriggerIntervalMs(trigger.intervalMs ?? 0);
|
|
183
|
-
return {
|
|
184
|
-
updatedAt: nowMs,
|
|
185
|
-
updateIntervalMs: intervalMs,
|
|
186
|
-
nextRunAtMs: nowMs + intervalMs,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
if (trigger.triggerType === "once") {
|
|
190
|
-
const scheduledAt = trigger.scheduledAtIso
|
|
191
|
-
? parseScheduledAtIso(trigger.scheduledAtIso)
|
|
192
|
-
: null;
|
|
193
|
-
if (scheduledAt === null)
|
|
194
|
-
return null;
|
|
195
|
-
const nextRunAtMs = Math.max(nowMs, scheduledAt);
|
|
196
|
-
return {
|
|
197
|
-
updatedAt: nowMs,
|
|
198
|
-
updateIntervalMs: Math.max(0, nextRunAtMs - nowMs),
|
|
199
|
-
nextRunAtMs,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
if (trigger.triggerType === "event") {
|
|
203
|
-
return {
|
|
204
|
-
updatedAt: nowMs,
|
|
205
|
-
updateIntervalMs: DISABLED_TRIGGER_INTERVAL_MS,
|
|
206
|
-
nextRunAtMs: nowMs + DISABLED_TRIGGER_INTERVAL_MS,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
const nextRunAtMs = trigger.cronExpression
|
|
210
|
-
? computeNextCronRunAtMs(trigger.cronExpression, nowMs, trigger.timezone)
|
|
211
|
-
: null;
|
|
212
|
-
if (nextRunAtMs === null)
|
|
213
|
-
return null;
|
|
214
|
-
return {
|
|
215
|
-
updatedAt: nowMs,
|
|
216
|
-
updateIntervalMs: Math.max(0, nextRunAtMs - nowMs),
|
|
217
|
-
nextRunAtMs,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
8
|
export function buildTriggerMetadata(params) {
|
|
221
9
|
const timing = resolveTriggerTiming(params.trigger, params.nowMs);
|
|
222
10
|
if (!timing)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-terminal-tui.d.ts","sourceRoot":"","sources":["../../src/tui/agent-terminal-tui.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"agent-terminal-tui.d.ts","sourceRoot":"","sources":["../../src/tui/agent-terminal-tui.ts"],"names":[],"mappings":"AAKA,OAAO,EAaL,KAAK,QAAQ,EAGd,MAAM,cAAc,CAAC;AAiBtB,UAAU,uBAAuB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAoiBD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,GAAG,IAAI,CA2B/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveApiBindHost, resolveDesktopApiPort, resolveServerOnlyPort, } from "@elizaos/shared";
|
|
2
|
-
import { ansi, CombinedAutocompleteProvider, darkTheme, Editor, getTerminalView, hasTerminalView, ProcessTerminal, SelectList, TUI, truncateToWidth, } from "@elizaos/tui";
|
|
2
|
+
import { ansi, CombinedAutocompleteProvider, darkTheme, Editor, getTerminalView, getTerminalViewFactory, hasTerminalView, ProcessTerminal, SelectList, TUI, truncateToWidth, } from "@elizaos/tui";
|
|
3
3
|
import { matchSlashInput, resolveSlashDispatch, toSlashCommands, } from "./slash-commands.js";
|
|
4
4
|
import { isTerminalTuiEnabled } from "./tui-enabled.js";
|
|
5
5
|
const selectTheme = {
|
|
@@ -34,6 +34,20 @@ async function readJson(fetchImpl, apiBaseUrl, path, init) {
|
|
|
34
34
|
}
|
|
35
35
|
return (await response.json());
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The persistent shell layout: a mounted spatial-view block on top with a
|
|
39
|
+
* fixed chat composer pinned to the bottom rows, both always visible.
|
|
40
|
+
*
|
|
41
|
+
* Mode collapses to where the *view block* is: the default `list` (registered
|
|
42
|
+
* tui views to pick from), `view` (a mounted spatial/registered view rendering
|
|
43
|
+
* inline), or `search` (filter the list). Chat is never a mode — the composer
|
|
44
|
+
* is always rendered last.
|
|
45
|
+
*
|
|
46
|
+
* Focus has two targets: `view` routes Tab/arrows/Enter to the mounted view's
|
|
47
|
+
* controls (and the top-level keybindings `/ r 1-9 q`), while `composer` sends
|
|
48
|
+
* every printable char + Enter to the chat input. Ctrl+L toggles between them;
|
|
49
|
+
* Esc from the composer returns focus to the view block.
|
|
50
|
+
*/
|
|
37
51
|
class AgentTerminalView {
|
|
38
52
|
tui;
|
|
39
53
|
apiBaseUrl;
|
|
@@ -42,9 +56,11 @@ class AgentTerminalView {
|
|
|
42
56
|
views = [];
|
|
43
57
|
selectedView = null;
|
|
44
58
|
status = "starting terminal tui";
|
|
45
|
-
mode = "
|
|
46
|
-
/** The registered terminal view rendered inline in `
|
|
47
|
-
|
|
59
|
+
mode = "list";
|
|
60
|
+
/** The registered terminal view rendered inline in `view` mode. */
|
|
61
|
+
mountedView = null;
|
|
62
|
+
/** Which surface receives keyboard input: the view block or the composer. */
|
|
63
|
+
focusTarget = "composer";
|
|
48
64
|
searchQuery = "";
|
|
49
65
|
viewList = new SelectList([], 12, selectTheme);
|
|
50
66
|
chatInput;
|
|
@@ -57,6 +73,8 @@ class AgentTerminalView {
|
|
|
57
73
|
this.fetchImpl = fetchImpl;
|
|
58
74
|
this.onExit = onExit;
|
|
59
75
|
this.chatInput = new Editor(tui, editorTheme, { paddingX: 0 });
|
|
76
|
+
// The composer owns input by default so a user can type immediately.
|
|
77
|
+
this.chatInput.focused = true;
|
|
60
78
|
this.viewList.onSelect = (item) => {
|
|
61
79
|
const view = this.views.find((candidate) => candidate.id === item.value);
|
|
62
80
|
if (view)
|
|
@@ -120,15 +138,15 @@ class AgentTerminalView {
|
|
|
120
138
|
this.tui.requestRender();
|
|
121
139
|
}
|
|
122
140
|
}
|
|
123
|
-
|
|
124
|
-
|
|
141
|
+
/** Lines for the view block (everything above the pinned composer). */
|
|
142
|
+
renderViewBlock(width) {
|
|
143
|
+
if (this.mode === "view" && this.mountedView) {
|
|
125
144
|
const header = [
|
|
126
145
|
ansi.bold(`elizaOS terminal tui · ${this.selectedView?.label ?? "view"}`),
|
|
127
|
-
ansi.dim("
|
|
146
|
+
ansi.dim(`${this.focusTarget === "view" ? "tab/↑↓ focus · enter activates" : "ctrl+l focuses the view"} · esc/q closes`),
|
|
128
147
|
"",
|
|
129
148
|
];
|
|
130
|
-
|
|
131
|
-
return [...header, ...body].map((line) => truncateToWidth(line, width));
|
|
149
|
+
return [...header, ...this.mountedView.render(width)];
|
|
132
150
|
}
|
|
133
151
|
const selected = this.selectedView
|
|
134
152
|
? `${this.selectedView.label} (${this.selectedView.path ?? this.selectedView.id})`
|
|
@@ -139,51 +157,84 @@ class AgentTerminalView {
|
|
|
139
157
|
`status: ${this.status}`,
|
|
140
158
|
`selected: ${selected}`,
|
|
141
159
|
"",
|
|
142
|
-
"shortcuts: ↑/↓ select enter open 1-9 quick-open r refresh / search
|
|
143
|
-
"chat: type after pressing c, enter sends, esc returns to views",
|
|
160
|
+
"shortcuts: ↑/↓ select enter open 1-9 quick-open r refresh / search ctrl+l focus q quit",
|
|
144
161
|
"",
|
|
145
162
|
];
|
|
146
|
-
if (this.mode === "chat") {
|
|
147
|
-
const hint = this.commands.length > 0
|
|
148
|
-
? ansi.dim("type / for commands · enter sends · esc returns to views")
|
|
149
|
-
: ansi.dim("enter sends · esc returns to views");
|
|
150
|
-
lines.push(ansi.cyan("chat composer"), this.lastChatLine, hint, "");
|
|
151
|
-
lines.push(...this.chatInput.render(width));
|
|
152
|
-
// Guard every line to the terminal width — the TUI render loop throws on
|
|
153
|
-
// any overflow (e.g. the shortcuts line on an 80-col terminal).
|
|
154
|
-
return lines.map((line) => truncateToWidth(line, width));
|
|
155
|
-
}
|
|
156
163
|
if (this.mode === "search") {
|
|
157
164
|
lines.push(ansi.cyan("search views"), `filter: ${this.searchQuery || ansi.dim("(type to filter)")}`, ansi.dim("enter opens highlighted view; esc clears search"), "");
|
|
158
165
|
}
|
|
159
166
|
lines.push(ansi.cyan("registered tui views"));
|
|
160
167
|
lines.push(...this.viewList.render(width));
|
|
161
|
-
return lines
|
|
168
|
+
return lines;
|
|
169
|
+
}
|
|
170
|
+
/** The chat composer block, always pinned to the bottom rows. */
|
|
171
|
+
renderComposer(width) {
|
|
172
|
+
const focusedComposer = this.focusTarget === "composer";
|
|
173
|
+
const hint = this.commands.length > 0
|
|
174
|
+
? "type / for commands · enter sends · ctrl+l focuses the view"
|
|
175
|
+
: "enter sends · ctrl+l focuses the view";
|
|
176
|
+
const label = focusedComposer
|
|
177
|
+
? ansi.cyan("chat")
|
|
178
|
+
: ansi.dim("chat (ctrl+l to type)");
|
|
179
|
+
return [
|
|
180
|
+
ansi.dim("─".repeat(Math.max(1, width))),
|
|
181
|
+
label,
|
|
182
|
+
this.lastChatLine,
|
|
183
|
+
ansi.dim(hint),
|
|
184
|
+
...this.chatInput.render(width),
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
render(width) {
|
|
188
|
+
const composer = this.renderComposer(width);
|
|
189
|
+
// Reserve the bottom rows for the composer; the view block fills the rest of
|
|
190
|
+
// the visible viewport so the composer is pinned to the last rows. Falls
|
|
191
|
+
// back to a generous default height when the terminal size is unknown.
|
|
192
|
+
const height = this.tui.terminal.rows || 24;
|
|
193
|
+
const viewHeight = Math.max(1, height - composer.length);
|
|
194
|
+
let viewBlock = this.renderViewBlock(width);
|
|
195
|
+
if (viewBlock.length > viewHeight) {
|
|
196
|
+
// Keep the most recent / focused content visible by trimming the top.
|
|
197
|
+
viewBlock = viewBlock.slice(viewBlock.length - viewHeight);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
while (viewBlock.length < viewHeight)
|
|
201
|
+
viewBlock.push("");
|
|
202
|
+
}
|
|
203
|
+
return [...viewBlock, ...composer].map((line) => truncateToWidth(line, width));
|
|
162
204
|
}
|
|
163
205
|
handleInput(data) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (data === "" || data === "q" || data === "") {
|
|
168
|
-
this.mode = "views";
|
|
169
|
-
this.detailView = null;
|
|
170
|
-
this.status = `${this.views.length} tui views ready`;
|
|
171
|
-
this.tui.requestRender();
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
this.detailView?.handleInput?.(data);
|
|
175
|
-
this.tui.requestRender();
|
|
206
|
+
// Ctrl+L toggles which surface owns the keyboard (view block <-> composer).
|
|
207
|
+
if (data === "") {
|
|
208
|
+
this.setFocus(this.focusTarget === "composer" ? "view" : "composer");
|
|
176
209
|
return;
|
|
177
210
|
}
|
|
178
|
-
|
|
179
|
-
|
|
211
|
+
// Ctrl+C always exits the whole TUI regardless of focus.
|
|
212
|
+
if (data === "") {
|
|
213
|
+
this.onExit?.();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (this.focusTarget === "composer") {
|
|
217
|
+
this.handleComposerInput(data);
|
|
180
218
|
return;
|
|
181
219
|
}
|
|
220
|
+
// -- view-focused: top-level keybindings + the mounted view / list --------
|
|
182
221
|
if (this.mode === "search") {
|
|
183
222
|
this.handleSearchInput(data);
|
|
184
223
|
return;
|
|
185
224
|
}
|
|
186
|
-
if (
|
|
225
|
+
if (this.mode === "view" && this.mountedView) {
|
|
226
|
+
// Esc / q close the mounted view back to the list; everything else drives
|
|
227
|
+
// the inline view so it stays interactive (tab/arrows/enter activate).
|
|
228
|
+
if (data === "" || data === "q") {
|
|
229
|
+
this.closeMountedView();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.mountedView.handleInput?.(data);
|
|
233
|
+
this.tui.requestRender();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
// List mode, view-focused.
|
|
237
|
+
if (data === "q") {
|
|
187
238
|
this.onExit?.();
|
|
188
239
|
return;
|
|
189
240
|
}
|
|
@@ -191,13 +242,9 @@ class AgentTerminalView {
|
|
|
191
242
|
void this.refreshViews();
|
|
192
243
|
return;
|
|
193
244
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
// Bare `/` enters view-search mode (a top-level keybinding). The Editor's
|
|
199
|
-
// own `/`-at-line-start slash menu lives inside the composer and only
|
|
200
|
-
// fires once chat mode owns the input, so the two never collide.
|
|
245
|
+
// Bare slash enters view-search mode (a top-level keybinding while the view
|
|
246
|
+
// block is focused). The composer slash menu is unaffected -- it only fires
|
|
247
|
+
// once the composer owns the input.
|
|
201
248
|
if (data === "/") {
|
|
202
249
|
this.mode = "search";
|
|
203
250
|
this.status = "filtering tui views";
|
|
@@ -213,60 +260,115 @@ class AgentTerminalView {
|
|
|
213
260
|
}
|
|
214
261
|
this.viewList.handleInput(data);
|
|
215
262
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// Keep focus on the view so Escape/Ctrl+C can return to views; the Editor
|
|
219
|
-
// renders its cursor off its own `focused` flag, which we drive manually.
|
|
220
|
-
this.chatInput.focused = true;
|
|
221
|
-
this.tui.requestRender();
|
|
222
|
-
}
|
|
223
|
-
exitChatMode() {
|
|
224
|
-
this.mode = "views";
|
|
225
|
-
this.chatInput.focused = false;
|
|
226
|
-
this.tui.requestRender();
|
|
227
|
-
}
|
|
228
|
-
handleChatInput(data) {
|
|
263
|
+
/** Route a keystroke into the always-on composer. */
|
|
264
|
+
handleComposerInput(data) {
|
|
229
265
|
// Escape with an open dropdown closes the dropdown (handled by the Editor)
|
|
230
|
-
// rather than
|
|
231
|
-
if (data === "
|
|
266
|
+
// rather than moving focus, so one Escape does not do two things.
|
|
267
|
+
if (data === "" && this.chatInput.isShowingAutocomplete()) {
|
|
232
268
|
this.chatInput.handleInput(data);
|
|
233
269
|
this.tui.requestRender();
|
|
234
270
|
return;
|
|
235
271
|
}
|
|
236
|
-
// Escape (no dropdown)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
this.exitChatMode();
|
|
272
|
+
// Escape (no dropdown) hands focus back to the view block.
|
|
273
|
+
if (data === "") {
|
|
274
|
+
this.setFocus("view");
|
|
240
275
|
return;
|
|
241
276
|
}
|
|
242
277
|
this.chatInput.handleInput(data);
|
|
243
278
|
this.tui.requestRender();
|
|
244
279
|
}
|
|
280
|
+
/** Move keyboard focus between the view block and the composer. */
|
|
281
|
+
setFocus(target) {
|
|
282
|
+
this.focusTarget = target;
|
|
283
|
+
this.chatInput.focused = target === "composer";
|
|
284
|
+
this.tui.requestRender();
|
|
285
|
+
}
|
|
286
|
+
/** Unmount the active view and return to the list (view block stays focused). */
|
|
287
|
+
closeMountedView() {
|
|
288
|
+
this.mode = "list";
|
|
289
|
+
this.mountedView = null;
|
|
290
|
+
this.status = `${this.views.length} tui views ready`;
|
|
291
|
+
this.tui.requestRender();
|
|
292
|
+
}
|
|
245
293
|
invalidate() {
|
|
246
294
|
this.viewList.invalidate();
|
|
295
|
+
this.mountedView?.invalidate?.();
|
|
247
296
|
}
|
|
248
297
|
async openView(view) {
|
|
249
298
|
this.selectedView = view;
|
|
299
|
+
this.mode = this.mode === "search" ? "list" : this.mode;
|
|
250
300
|
// A plugin-registered terminal view renders its real content inline — the
|
|
251
301
|
// first time a `viewType: "tui"` view actually renders in the terminal,
|
|
252
|
-
// rather than only navigating the GUI shell.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
302
|
+
// rather than only navigating the GUI shell. Mount via the view's factory
|
|
303
|
+
// (when one is registered) so we can supply `onActivate`: a focused button
|
|
304
|
+
// activation in the view dispatches the view-scoped action to the agent.
|
|
305
|
+
// Fall back to the cached default component for legacy registrations.
|
|
306
|
+
const factory = getTerminalViewFactory(view.id);
|
|
307
|
+
const mounted = factory
|
|
308
|
+
? factory({ onActivate: (elementId) => this.activateElement(elementId) })
|
|
309
|
+
: getTerminalView(view.id);
|
|
310
|
+
if (mounted) {
|
|
311
|
+
this.mountedView = mounted;
|
|
312
|
+
this.mode = "view";
|
|
313
|
+
// Surface focus to the view block so its controls are immediately
|
|
314
|
+
// tab/enter-drivable; the composer stays one Ctrl+L away.
|
|
315
|
+
this.setFocus("view");
|
|
257
316
|
this.status = `viewing ${view.label}`;
|
|
317
|
+
// Tell the runtime which view is active so the activate endpoint can
|
|
318
|
+
// resolve elements and the planner upweights its scoped actions. Best
|
|
319
|
+
// effort; the inline render does not depend on it.
|
|
320
|
+
void this.navigateView(view, { silent: true });
|
|
258
321
|
this.tui.requestRender();
|
|
259
322
|
return;
|
|
260
323
|
}
|
|
261
324
|
this.status = `opening ${view.label}`;
|
|
262
325
|
this.tui.requestRender();
|
|
326
|
+
await this.navigateView(view, { silent: false });
|
|
327
|
+
}
|
|
328
|
+
/** POST the navigate event so the runtime marks this view active. */
|
|
329
|
+
async navigateView(view, { silent }) {
|
|
263
330
|
try {
|
|
264
331
|
await readJson(this.fetchImpl, this.apiBaseUrl, `/api/views/${encodeURIComponent(view.id)}/navigate?viewType=tui`, { method: "POST", body: JSON.stringify({ viewType: "tui" }) });
|
|
265
|
-
|
|
332
|
+
if (!silent)
|
|
333
|
+
this.status = `opened ${view.label}`;
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
if (!silent) {
|
|
337
|
+
this.status =
|
|
338
|
+
error instanceof Error
|
|
339
|
+
? error.message
|
|
340
|
+
: `failed to open ${view.label}`;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
finally {
|
|
344
|
+
this.tui.requestRender();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* A focused control in the mounted view was activated — dispatch it to the
|
|
349
|
+
* agent via POST /api/views/:id/activate, which resolves the element to its
|
|
350
|
+
* view-scoped action (CLICK_ELEMENT semantics) and runs it. The view's local
|
|
351
|
+
* onPress already fired (state change) inside the spatial component; this is
|
|
352
|
+
* the agent-facing half. Fire-and-forget; surfaced in the status line.
|
|
353
|
+
*/
|
|
354
|
+
async activateElement(elementId) {
|
|
355
|
+
const view = this.selectedView;
|
|
356
|
+
if (!view)
|
|
357
|
+
return;
|
|
358
|
+
this.status = `activating ${elementId}…`;
|
|
359
|
+
this.tui.requestRender();
|
|
360
|
+
try {
|
|
361
|
+
await readJson(this.fetchImpl, this.apiBaseUrl, `/api/views/${encodeURIComponent(view.id)}/activate?viewType=tui`, {
|
|
362
|
+
method: "POST",
|
|
363
|
+
body: JSON.stringify({ elementId, viewType: "tui" }),
|
|
364
|
+
});
|
|
365
|
+
this.status = `activated ${elementId}`;
|
|
266
366
|
}
|
|
267
367
|
catch (error) {
|
|
268
368
|
this.status =
|
|
269
|
-
error instanceof Error
|
|
369
|
+
error instanceof Error
|
|
370
|
+
? `activate failed: ${error.message}`
|
|
371
|
+
: `activate failed: ${elementId}`;
|
|
270
372
|
}
|
|
271
373
|
finally {
|
|
272
374
|
this.tui.requestRender();
|
|
@@ -274,7 +376,7 @@ class AgentTerminalView {
|
|
|
274
376
|
}
|
|
275
377
|
handleSearchInput(data) {
|
|
276
378
|
if (data === "\u001b") {
|
|
277
|
-
this.mode = "
|
|
379
|
+
this.mode = "list";
|
|
278
380
|
this.searchQuery = "";
|
|
279
381
|
this.viewList.setFilter("");
|
|
280
382
|
this.status = `${this.views.length} tui views ready`;
|
|
@@ -286,7 +388,7 @@ class AgentTerminalView {
|
|
|
286
388
|
const view = selected
|
|
287
389
|
? this.views.find((candidate) => candidate.id === selected.value)
|
|
288
390
|
: null;
|
|
289
|
-
this.mode = "
|
|
391
|
+
this.mode = "list";
|
|
290
392
|
if (view)
|
|
291
393
|
void this.openView(view);
|
|
292
394
|
return;
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./agent-skills.
|
|
2
|
-
export * from "./config-like.
|
|
3
|
-
export * from "./trajectory.
|
|
1
|
+
export * from "./agent-skills.js";
|
|
2
|
+
export * from "./config-like.js";
|
|
3
|
+
export * from "./trajectory.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/api/nfa-routes.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type RouteRequestMeta } from "@elizaos/core";
|
|
2
|
-
import type { RouteHelpers } from "@elizaos/shared";
|
|
3
|
-
export interface NfaRouteContext extends RouteRequestMeta, Pick<RouteHelpers, "json" | "error"> {
|
|
4
|
-
}
|
|
5
|
-
export declare function handleNfaRoutes(ctx: NfaRouteContext): Promise<boolean>;
|
|
6
|
-
//# sourceMappingURL=nfa-routes.d.ts.map
|
package/api/nfa-routes.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nfa-routes.d.ts","sourceRoot":"","sources":["../../src/api/nfa-routes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAoCpD,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;CAAG;AAuB3C,wBAAsB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA+F5E"}
|