@elizaos/agent 2.0.3-beta.2 → 2.0.3-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/view-user-journeys.d.ts.map +1 -1
- package/__tests__/view-user-journeys.js +52 -41
- package/actions/context-signal.d.ts +2 -2
- package/actions/files.d.ts +9 -0
- package/actions/files.d.ts.map +1 -0
- package/actions/files.js +183 -0
- package/actions/index.d.ts +17 -17
- package/api/accounts-routes.d.ts +1 -1
- package/api/accounts-routes.js +1 -1
- package/api/agent-admin-routes.d.ts +1 -1
- package/api/agent-admin-routes.js +2 -2
- package/api/agent-model.d.ts +1 -1
- package/api/agent-status-routes.d.ts +1 -3
- package/api/agent-status-routes.d.ts.map +1 -1
- package/api/agent-status-routes.js +0 -2
- package/api/approval-routes.d.ts +38 -0
- package/api/approval-routes.d.ts.map +1 -0
- package/api/approval-routes.js +223 -0
- package/api/background-routes.d.ts +13 -0
- package/api/background-routes.d.ts.map +1 -0
- package/api/background-routes.js +91 -0
- package/api/binance-skill-helpers.d.ts +2 -2
- package/api/binance-skill-helpers.js +2 -2
- package/api/builtin-views.d.ts.map +1 -1
- package/api/builtin-views.js +44 -4
- package/api/character-routes.d.ts +1 -1
- package/api/chat-augmentation.d.ts.map +1 -1
- package/api/chat-augmentation.js +17 -0
- package/api/chat-routes.d.ts +29 -2
- package/api/chat-routes.d.ts.map +1 -1
- package/api/chat-routes.js +76 -1
- package/api/commands-routes.d.ts +10 -8
- package/api/commands-routes.d.ts.map +1 -1
- package/api/commands-routes.js +17 -59
- package/api/config-routes.d.ts +1 -1
- package/api/config-routes.d.ts.map +1 -1
- package/api/config-routes.js +0 -2
- package/api/connector-routes.d.ts +1 -1
- package/api/conversation-metadata.d.ts +1 -1
- package/api/conversation-metadata.d.ts.map +1 -1
- package/api/conversation-metadata.js +0 -1
- package/api/conversation-routes.d.ts +4 -3
- package/api/conversation-routes.d.ts.map +1 -1
- package/api/conversation-routes.js +34 -1
- package/api/documents-service-loader.d.ts +0 -4
- package/api/documents-service-loader.d.ts.map +1 -1
- package/api/documents-service-loader.js +0 -2
- package/api/files-routes.d.ts +14 -0
- package/api/files-routes.d.ts.map +1 -0
- package/api/files-routes.js +47 -0
- package/api/first-run-routes.d.ts +1 -1
- package/api/health-routes.d.ts +2 -2
- package/api/index.d.ts +40 -39
- package/api/index.d.ts.map +1 -1
- package/api/index.js +1 -0
- package/api/interactions-routes.d.ts +33 -0
- package/api/interactions-routes.d.ts.map +1 -0
- package/api/interactions-routes.js +63 -0
- package/api/media-runtime.d.ts +2 -1
- package/api/media-runtime.d.ts.map +1 -1
- package/api/media-runtime.js +64 -7
- package/api/media-store.d.ts +36 -0
- package/api/media-store.d.ts.map +1 -1
- package/api/media-store.js +141 -2
- package/api/memory-bounds.d.ts +0 -1
- package/api/memory-bounds.d.ts.map +1 -1
- package/api/memory-bounds.js +0 -1
- package/api/misc-routes.d.ts +1 -1
- package/api/model-provider-helpers.d.ts +2 -2
- package/api/model-provider-helpers.js +2 -2
- package/api/permissions-routes-extra.d.ts +1 -1
- package/api/permissions-routes.d.ts +1 -1
- package/api/permissions-routes.d.ts.map +1 -1
- package/api/permissions-routes.js +8 -7
- package/api/plugin-discovery-helpers.d.ts +5 -6
- package/api/plugin-discovery-helpers.d.ts.map +1 -1
- package/api/plugin-discovery-helpers.js +3 -4
- package/api/plugin-runtime-apply.d.ts +2 -2
- package/api/plugin-runtime-apply.d.ts.map +1 -1
- package/api/plugin-runtime-apply.js +74 -0
- package/api/provider-switch-config.d.ts +1 -1
- package/api/provider-switch-routes.d.ts +2 -2
- package/api/registry-routes.d.ts +1 -1
- package/api/registry-service.d.ts +1 -1
- package/api/remote-capability-routes.d.ts +2 -2
- package/api/remote-capability-routes.d.ts.map +1 -1
- package/api/remote-capability-routes.js +19 -0
- package/api/server-autonomy-helpers.d.ts +2 -2
- package/api/server-helpers-auth.d.ts +10 -0
- package/api/server-helpers-auth.d.ts.map +1 -1
- package/api/server-helpers-auth.js +16 -210
- package/api/server-helpers-config.d.ts +1 -1
- package/api/server-helpers-mcp.d.ts +2 -2
- package/api/server-helpers-plugin.d.ts +1 -1
- package/api/server-helpers-swarm.d.ts +3 -3
- package/api/server-helpers-swarm.d.ts.map +1 -1
- package/api/server-helpers-swarm.js +15 -5
- package/api/server-helpers-wallet.d.ts +1 -1
- package/api/server-helpers.d.ts +4 -4
- package/api/server-lazy-routes.d.ts +40 -38
- package/api/server-lazy-routes.d.ts.map +1 -1
- package/api/server-lazy-routes.js +7 -0
- package/api/server-route-dispatch.d.ts +2 -2
- package/api/server-route-dispatch.d.ts.map +1 -1
- package/api/server-route-dispatch.js +7 -0
- package/api/server-types.d.ts +9 -7
- package/api/server-types.d.ts.map +1 -1
- package/api/server.d.ts +19 -19
- package/api/server.d.ts.map +1 -1
- package/api/server.js +111 -17
- package/api/static-file-server.d.ts +2 -2
- package/api/static-file-server.js +2 -2
- package/api/subscription-routes.d.ts +4 -4
- package/api/subscription-routes.js +3 -4
- package/api/suggestions-routes.d.ts +1 -1
- package/api/suggestions-routes.d.ts.map +1 -1
- package/api/suggestions-routes.js +2 -3
- package/api/terminal-execution-routing.d.ts +1 -1
- package/api/training-service-like.d.ts +1 -1
- package/api/trajectory-fallback-routes.d.ts.map +1 -1
- package/api/trajectory-fallback-routes.js +21 -1
- package/api/update-routes.d.ts +1 -1
- package/api/view-registry-types.d.ts +1 -1
- package/api/views-registry.d.ts +14 -4
- package/api/views-registry.d.ts.map +1 -1
- package/api/views-registry.js +50 -26
- package/api/views-routes.d.ts +1 -1
- package/api/views-routes.d.ts.map +1 -1
- package/api/views-routes.js +131 -14
- package/api/views-search-index.d.ts +1 -1
- package/api/wallet-capability.d.ts +3 -3
- package/api/wallet-rpc.d.ts +1 -1
- package/api/wallet.d.ts +3 -3
- package/api/wallet.d.ts.map +1 -1
- package/api/wallet.js +4 -3
- package/api/workbench-context.d.ts +1 -1
- package/api/workbench-helpers.d.ts +3 -3
- package/api/workbench-helpers.js +3 -3
- package/api/workbench-routes.d.ts +2 -2
- package/api/workbench-vfs-routes.d.ts +1 -1
- package/api/ws-event-replay.d.ts +1 -2
- package/api/ws-event-replay.d.ts.map +1 -1
- package/api/ws-event-replay.js +1 -2
- package/api/x-relay-routes.d.ts +2 -2
- package/api/x402-route-validation.d.ts +4 -0
- package/api/x402-route-validation.d.ts.map +1 -0
- package/api/x402-route-validation.js +6 -0
- package/assets/view-heroes/background.png +0 -0
- package/auth/account-storage.d.ts +1 -1
- package/auth/anthropic.d.ts +1 -1
- package/auth/credentials.d.ts +2 -2
- package/auth/index.d.ts +7 -7
- package/auth/oauth-flow.d.ts +2 -2
- package/auth/openai-codex.d.ts +1 -1
- package/awareness/index.d.ts +1 -1
- package/config/config.js +0 -1
- package/config/env-vars.d.ts +1 -1
- package/config/env-vars.d.ts.map +1 -1
- package/config/env-vars.js +0 -1
- package/config/index.d.ts +10 -10
- package/config/model-metadata.d.ts +1 -1
- package/config/owner-contacts.d.ts +1 -1
- package/config/schema.d.ts +1 -1
- package/hooks/discovery.d.ts +1 -1
- package/hooks/eligibility.d.ts +2 -2
- package/hooks/index.d.ts +2 -2
- package/hooks/loader.d.ts +2 -2
- package/hooks/registry.d.ts +1 -1
- package/index.d.ts +87 -85
- package/index.d.ts.map +1 -1
- package/index.js +11 -3
- package/package.json +54 -44
- package/providers/media-provider.d.ts +1 -1
- package/providers/page-scoped-context.d.ts.map +1 -1
- package/providers/page-scoped-context.js +1 -70
- package/providers/relevant-conversations.d.ts.map +1 -1
- package/providers/relevant-conversations.js +8 -9
- package/providers/workspace.d.ts +1 -1
- package/runtime/actions/web-fetch.d.ts.map +1 -1
- package/runtime/actions/web-fetch.js +23 -3
- package/runtime/actions/web-search.d.ts +32 -0
- package/runtime/actions/web-search.d.ts.map +1 -0
- package/runtime/actions/web-search.js +245 -0
- package/runtime/advanced-capabilities-config.d.ts +1 -1
- package/runtime/boot-telemetry.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.d.ts +1 -1
- package/runtime/conversation-compactor-runtime.js +1 -1
- package/runtime/conversation-compactor.d.ts +1 -1
- package/runtime/core-plugins.d.ts.map +1 -1
- package/runtime/core-plugins.js +9 -0
- package/runtime/custom-actions.d.ts +18 -9
- package/runtime/custom-actions.d.ts.map +1 -1
- package/runtime/custom-actions.js +85 -23
- package/runtime/eliza-plugin.d.ts.map +1 -1
- package/runtime/eliza-plugin.js +15 -1
- package/runtime/eliza.d.ts +9 -7
- package/runtime/eliza.d.ts.map +1 -1
- package/runtime/eliza.js +86 -23
- package/runtime/first-time-setup.d.ts +1 -3
- package/runtime/first-time-setup.d.ts.map +1 -1
- package/runtime/first-time-setup.js +0 -2
- package/runtime/index.d.ts +18 -18
- package/runtime/load-plugin-from-vfs.d.ts +2 -2
- package/runtime/mobile-dns.d.ts.map +1 -1
- package/runtime/mobile-dns.js +2 -5
- package/runtime/operations/classifier.d.ts +1 -1
- package/runtime/operations/cold-strategy.d.ts +1 -1
- package/runtime/operations/health-checks.d.ts +1 -1
- package/runtime/operations/health.d.ts +1 -1
- package/runtime/operations/index.d.ts +10 -10
- package/runtime/operations/manager.d.ts +3 -3
- package/runtime/operations/reload-hot.d.ts +1 -1
- package/runtime/operations/repository.d.ts +1 -1
- package/runtime/operations/vault-bridge.d.ts +1 -1
- package/runtime/plugin-collector.d.ts +6 -1
- package/runtime/plugin-collector.d.ts.map +1 -1
- package/runtime/plugin-collector.js +11 -28
- package/runtime/plugin-lifecycle.d.ts.map +1 -1
- package/runtime/plugin-lifecycle.js +1 -0
- package/runtime/plugin-resolver.d.ts +2 -2
- package/runtime/plugin-resolver.d.ts.map +1 -1
- package/runtime/plugin-resolver.js +113 -65
- package/runtime/plugin-types.d.ts +1 -1
- package/runtime/prompt-optimization.d.ts +4 -4
- package/runtime/remote-coding-runner-gate.d.ts +7 -0
- package/runtime/remote-coding-runner-gate.d.ts.map +1 -0
- package/runtime/remote-coding-runner-gate.js +36 -0
- package/runtime/roles/src/index.d.ts +4 -4
- package/runtime/roles.d.ts +2 -2
- package/runtime/sandbox-character.d.ts +1 -1
- package/runtime/tool-call-cache/cache.d.ts +1 -1
- package/runtime/tool-call-cache/disk-store.d.ts +1 -1
- package/runtime/tool-call-cache/index.d.ts +6 -6
- package/runtime/tool-call-cache/key.d.ts +1 -1
- package/runtime/tool-call-cache/redact.d.ts +1 -1
- package/runtime/tool-call-cache/registry.d.ts +1 -1
- package/runtime/tool-call-cache-wrapper.d.ts +7 -9
- package/runtime/tool-call-cache-wrapper.d.ts.map +1 -1
- package/runtime/tool-call-cache-wrapper.js +6 -11
- package/runtime/trajectory-export.d.ts +3 -3
- package/runtime/trajectory-internals.d.ts +2 -1
- package/runtime/trajectory-internals.d.ts.map +1 -1
- package/runtime/trajectory-persistence.d.ts +5 -5
- package/runtime/trajectory-steps-reader.d.ts +1 -1
- package/runtime/trajectory-steps-writer.d.ts +1 -1
- package/runtime/trajectory-storage.d.ts +4 -4
- package/runtime/view-action-affinity.d.ts +18 -15
- package/runtime/view-action-affinity.d.ts.map +1 -1
- package/runtime/view-action-affinity.js +26 -29
- package/runtime/web-search-tools.d.ts +4 -1
- package/runtime/web-search-tools.d.ts.map +1 -1
- package/runtime/web-search-tools.js +37 -9
- package/security/index.d.ts +3 -3
- package/services/approval/index.d.ts +9 -0
- package/services/approval/index.d.ts.map +1 -0
- package/services/approval/index.js +8 -0
- package/services/approval/service.d.ts +35 -0
- package/services/approval/service.d.ts.map +1 -0
- package/services/approval/service.js +40 -0
- package/services/approval/sql.d.ts +18 -0
- package/services/approval/sql.d.ts.map +1 -0
- package/services/approval/sql.js +104 -0
- package/services/approval/store.d.ts +39 -0
- package/services/approval/store.d.ts.map +1 -0
- package/services/approval/store.js +534 -0
- package/services/approval/types.d.ts +207 -0
- package/services/approval/types.d.ts.map +1 -0
- package/services/approval/types.js +34 -0
- package/services/character-persistence.d.ts +2 -2
- package/services/client-chat-sender.d.ts +1 -1
- package/services/config-plugin-manager.d.ts +2 -2
- package/services/connector-setup-service.d.ts +1 -1
- package/services/cove-quote-x509.d.ts +1 -1
- package/services/cove-quote.d.ts +2 -2
- package/services/dstack-tee-provider.d.ts +1 -1
- package/services/file-storage.d.ts +20 -0
- package/services/file-storage.d.ts.map +1 -0
- package/services/file-storage.js +70 -0
- package/services/global-pause/index.d.ts +8 -0
- package/services/global-pause/index.d.ts.map +1 -0
- package/services/global-pause/index.js +7 -0
- package/services/global-pause/service.d.ts +29 -0
- package/services/global-pause/service.d.ts.map +1 -0
- package/services/global-pause/service.js +34 -0
- package/services/global-pause/store.d.ts +31 -0
- package/services/global-pause/store.d.ts.map +1 -0
- package/services/global-pause/store.js +83 -0
- package/services/handoff/index.d.ts +8 -0
- package/services/handoff/index.d.ts.map +1 -0
- package/services/handoff/index.js +7 -0
- package/services/handoff/service.d.ts +29 -0
- package/services/handoff/service.d.ts.map +1 -0
- package/services/handoff/service.js +34 -0
- package/services/handoff/store.d.ts +76 -0
- package/services/handoff/store.d.ts.map +1 -0
- package/services/handoff/store.js +148 -0
- package/services/index.d.ts +30 -31
- package/services/index.d.ts.map +1 -1
- package/services/index.js +0 -6
- package/services/js-runtime-bridge.d.ts.map +1 -1
- package/services/js-runtime-bridge.js +8 -2
- package/services/knowledge-graph/index.d.ts +4 -4
- package/services/knowledge-graph/service.d.ts +2 -2
- package/services/pending-prompts/index.d.ts +8 -0
- package/services/pending-prompts/index.d.ts.map +1 -0
- package/services/pending-prompts/index.js +7 -0
- package/services/pending-prompts/service.d.ts +34 -0
- package/services/pending-prompts/service.d.ts.map +1 -0
- package/services/pending-prompts/service.js +68 -0
- package/services/pending-prompts/store.d.ts +70 -0
- package/services/pending-prompts/store.d.ts.map +1 -0
- package/services/pending-prompts/store.js +191 -0
- package/services/plugin-compiler.d.ts +1 -1
- package/services/plugin-installer.d.ts.map +1 -1
- package/services/plugin-installer.js +21 -11
- package/services/plugin-manager-types.d.ts +1 -1
- package/services/proactive-interaction-decider.d.ts +62 -11
- package/services/proactive-interaction-decider.d.ts.map +1 -1
- package/services/proactive-interaction-decider.js +223 -35
- package/services/push/apns-provider.d.ts +1 -1
- package/services/push/fcm-provider.d.ts +1 -1
- package/services/push/notification-push-service.d.ts +2 -2
- package/services/registry-client-app-meta.d.ts +1 -1
- package/services/registry-client-endpoints.d.ts +2 -2
- package/services/registry-client-local.d.ts +1 -1
- package/services/registry-client-network.d.ts +1 -1
- package/services/registry-client-queries.d.ts +1 -1
- package/services/registry-client.d.ts +3 -3
- package/services/relationships-graph.d.ts +1 -1
- package/services/remote-capability-cloud-sandbox.d.ts +3 -3
- package/services/remote-capability-endpoint-conformance.d.ts +1 -1
- package/services/remote-capability-endpoint-provider.d.ts +4 -4
- package/services/remote-capability-url-endpoint-providers.d.ts +1 -1
- package/services/remote-plugin-adapter.d.ts.map +1 -1
- package/services/remote-plugin-adapter.js +3 -0
- package/services/remote-plugin-bridge.d.ts.map +1 -1
- package/services/remote-plugin-bridge.js +97 -26
- package/services/remote-signing-service.d.ts +4 -4
- package/services/research-task-executor.d.ts +1 -1
- package/services/sandbox-manager.d.ts +1 -1
- package/services/self-updater.d.ts +1 -1
- package/services/self-updater.d.ts.map +1 -1
- package/services/self-updater.js +23 -9
- package/services/shell-execution-router.d.ts +1 -1
- package/services/shell-execution-router.d.ts.map +1 -1
- package/services/shell-execution-router.js +19 -2
- package/services/tee-boot-gate-state.d.ts +1 -1
- package/services/tee-boot-gate.d.ts +4 -4
- package/services/tee-confidential-inference.d.ts +3 -3
- package/services/tee-key-release.d.ts +2 -2
- package/services/tee-model-key-boot.d.ts +4 -4
- package/services/tee-policy.d.ts +1 -1
- package/services/tee-production-profile.d.ts +1 -1
- package/services/tee-release-policy.d.ts +1 -1
- package/services/tee-revocation.d.ts +2 -2
- package/services/tee-runtime-config.d.ts +1 -1
- package/services/tee-sealed-volume.d.ts +3 -3
- package/services/tee-signer-backend.d.ts +3 -3
- package/services/update-checker.d.ts +1 -1
- package/services/vault-signer-backend.d.ts +1 -1
- package/services/vfs-git.d.ts +1 -1
- package/test-support/index.d.ts +3 -3
- package/triggers/runtime.d.ts +1 -1
- package/triggers/scheduling.d.ts +3 -22
- package/triggers/scheduling.d.ts.map +1 -1
- package/triggers/scheduling.js +2 -214
- package/tui/agent-terminal-tui.d.ts.map +1 -1
- package/tui/agent-terminal-tui.js +174 -72
- package/types/index.d.ts +3 -3
- package/api/nfa-routes.d.ts +0 -6
- package/api/nfa-routes.d.ts.map +0 -1
- package/api/nfa-routes.js +0 -125
- package/api/server-auth.d.ts +0 -46
- package/api/server-auth.d.ts.map +0 -1
- package/api/server-auth.js +0 -504
- package/runtime/restart.d.ts +0 -9
- package/runtime/restart.d.ts.map +0 -1
- package/runtime/restart.js +0 -8
- package/test-utils/sqlite-compat.d.ts +0 -23
- package/test-utils/sqlite-compat.d.ts.map +0 -1
- package/test-utils/sqlite-compat.js +0 -214
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `PendingPromptsStore` — backing store for open scheduled-task prompts.
|
|
3
|
+
*
|
|
4
|
+
* When a `ScheduledTask` whose `completionCheck.kind === "user_replied_within"`
|
|
5
|
+
* (or implicit `user_acknowledged`) fires, the runner records the open prompt
|
|
6
|
+
* here keyed by `roomId`. When an inbound message arrives the planner uses
|
|
7
|
+
* `list(roomId)` to decide whether to route to `complete` / `acknowledge` on
|
|
8
|
+
* the open task instead of treating it as a fresh request.
|
|
9
|
+
*
|
|
10
|
+
* Retention: open prompts are retained for `expiresAt + reopenWindowHours`
|
|
11
|
+
* (default 24h) so late inbound replies still correlate. After the reopen
|
|
12
|
+
* window the entry is purged.
|
|
13
|
+
*
|
|
14
|
+
* Backing storage: runtime cache, keyed per room. Bounded per-room slot count
|
|
15
|
+
* to defend against unbounded growth in a noisy chat.
|
|
16
|
+
*/
|
|
17
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
18
|
+
export type ExpectedReplyKind = "any" | "yes_no" | "approval" | "free_form";
|
|
19
|
+
export interface PendingPrompt {
|
|
20
|
+
taskId: string;
|
|
21
|
+
promptSnippet: string;
|
|
22
|
+
firedAt: string;
|
|
23
|
+
expectedReplyKind: ExpectedReplyKind;
|
|
24
|
+
expiresAt?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PendingPromptWithRoom extends PendingPrompt {
|
|
27
|
+
roomId: string;
|
|
28
|
+
}
|
|
29
|
+
export interface RecordedPendingPrompt extends PendingPrompt {
|
|
30
|
+
roomId: string;
|
|
31
|
+
/**
|
|
32
|
+
* Soft-purge cut-off. After this instant the entry is no longer returned by
|
|
33
|
+
* `list()` and is dropped on the next read. Set to
|
|
34
|
+
* `expiresAt + reopenWindowHours * 3600s`, or `firedAt + 24h` when no
|
|
35
|
+
* `expiresAt` was provided.
|
|
36
|
+
*/
|
|
37
|
+
retainUntilIso: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PendingPromptRecordInput {
|
|
40
|
+
taskId: string;
|
|
41
|
+
roomId: string;
|
|
42
|
+
promptSnippet: string;
|
|
43
|
+
firedAt: string;
|
|
44
|
+
expectedReplyKind?: ExpectedReplyKind;
|
|
45
|
+
expiresAt?: string;
|
|
46
|
+
/** override the default 24h reopen window */
|
|
47
|
+
reopenWindowHours?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface PendingPromptsStore {
|
|
50
|
+
/** Record that a task with an open prompt has fired into a room. */
|
|
51
|
+
record(input: PendingPromptRecordInput): Promise<RecordedPendingPrompt>;
|
|
52
|
+
/** List open prompts for a room. Excludes prompts past their retain window. */
|
|
53
|
+
list(roomId: string, opts?: {
|
|
54
|
+
lookbackMinutes?: number;
|
|
55
|
+
now?: Date;
|
|
56
|
+
}): Promise<PendingPrompt[]>;
|
|
57
|
+
/** List open prompts across every indexed room for UI/provider surfaces. */
|
|
58
|
+
listAll(opts?: {
|
|
59
|
+
lookbackMinutes?: number;
|
|
60
|
+
now?: Date;
|
|
61
|
+
}): Promise<PendingPromptWithRoom[]>;
|
|
62
|
+
/** Resolve a pending prompt (called when the runner records a terminal verb). */
|
|
63
|
+
resolve(roomId: string, taskId: string): Promise<void>;
|
|
64
|
+
/** Remove all entries for a task during lifecycle cleanup. */
|
|
65
|
+
forgetTask(taskId: string): Promise<void>;
|
|
66
|
+
/** Remove every recorded entry during lifecycle cleanup. */
|
|
67
|
+
clearAll(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export declare function createPendingPromptsStore(runtime: IAgentRuntime): PendingPromptsStore;
|
|
70
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/services/pending-prompts/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAOnD,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAE5E,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxE,+EAA+E;IAC/E,IAAI,CACF,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,IAAI,CAAA;KAAE,GAC9C,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,IAAI,CAAC,EAAE;QACb,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,GAAG,CAAC,EAAE,IAAI,CAAC;KACZ,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACrC,iFAAiF;IACjF,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,8DAA8D;IAC9D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,4DAA4D;IAC5D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAuED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,GACrB,mBAAmB,CA8JrB"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `PendingPromptsStore` — backing store for open scheduled-task prompts.
|
|
3
|
+
*
|
|
4
|
+
* When a `ScheduledTask` whose `completionCheck.kind === "user_replied_within"`
|
|
5
|
+
* (or implicit `user_acknowledged`) fires, the runner records the open prompt
|
|
6
|
+
* here keyed by `roomId`. When an inbound message arrives the planner uses
|
|
7
|
+
* `list(roomId)` to decide whether to route to `complete` / `acknowledge` on
|
|
8
|
+
* the open task instead of treating it as a fresh request.
|
|
9
|
+
*
|
|
10
|
+
* Retention: open prompts are retained for `expiresAt + reopenWindowHours`
|
|
11
|
+
* (default 24h) so late inbound replies still correlate. After the reopen
|
|
12
|
+
* window the entry is purged.
|
|
13
|
+
*
|
|
14
|
+
* Backing storage: runtime cache, keyed per room. Bounded per-room slot count
|
|
15
|
+
* to defend against unbounded growth in a noisy chat.
|
|
16
|
+
*/
|
|
17
|
+
const PROMPT_SNIPPET_MAX_LENGTH = 120;
|
|
18
|
+
const DEFAULT_REOPEN_WINDOW_HOURS = 24;
|
|
19
|
+
const PER_ROOM_MAX_PROMPTS = 16;
|
|
20
|
+
const ROOM_INDEX_KEY = "eliza:lifeops:pending-prompts:rooms:v1";
|
|
21
|
+
function roomCacheKey(roomId) {
|
|
22
|
+
return `eliza:lifeops:pending-prompts:room:${roomId}:v1`;
|
|
23
|
+
}
|
|
24
|
+
function clampSnippet(value) {
|
|
25
|
+
const trimmed = value.trim();
|
|
26
|
+
if (trimmed.length <= PROMPT_SNIPPET_MAX_LENGTH) {
|
|
27
|
+
return trimmed;
|
|
28
|
+
}
|
|
29
|
+
return `${trimmed.slice(0, PROMPT_SNIPPET_MAX_LENGTH - 1).trimEnd()}…`;
|
|
30
|
+
}
|
|
31
|
+
function isValidIso(value) {
|
|
32
|
+
if (typeof value !== "string" || value.length === 0)
|
|
33
|
+
return false;
|
|
34
|
+
return Number.isFinite(Date.parse(value));
|
|
35
|
+
}
|
|
36
|
+
function computeRetainUntil(firedAt, expiresAt, reopenWindowHours) {
|
|
37
|
+
const baseMs = expiresAt ? Date.parse(expiresAt) : Date.parse(firedAt);
|
|
38
|
+
if (!Number.isFinite(baseMs)) {
|
|
39
|
+
throw new Error("[pending-prompts] cannot compute retain window");
|
|
40
|
+
}
|
|
41
|
+
const retainMs = baseMs + reopenWindowHours * 3_600_000;
|
|
42
|
+
return new Date(retainMs).toISOString();
|
|
43
|
+
}
|
|
44
|
+
async function loadRoom(cache, roomId) {
|
|
45
|
+
const stored = await cache.getCache(roomCacheKey(roomId));
|
|
46
|
+
return Array.isArray(stored) ? stored : [];
|
|
47
|
+
}
|
|
48
|
+
async function saveRoom(cache, roomId, entries) {
|
|
49
|
+
await cache.setCache(roomCacheKey(roomId), entries);
|
|
50
|
+
await registerRoom(cache, roomId);
|
|
51
|
+
}
|
|
52
|
+
async function registerRoom(cache, roomId) {
|
|
53
|
+
const stored = await cache.getCache(ROOM_INDEX_KEY);
|
|
54
|
+
const next = new Set(Array.isArray(stored) ? stored : []);
|
|
55
|
+
next.add(roomId);
|
|
56
|
+
await cache.setCache(ROOM_INDEX_KEY, [...next]);
|
|
57
|
+
}
|
|
58
|
+
async function listRooms(cache) {
|
|
59
|
+
const stored = await cache.getCache(ROOM_INDEX_KEY);
|
|
60
|
+
return Array.isArray(stored) ? stored : [];
|
|
61
|
+
}
|
|
62
|
+
export function createPendingPromptsStore(runtime) {
|
|
63
|
+
const cache = runtime;
|
|
64
|
+
const store = {
|
|
65
|
+
async record(input) {
|
|
66
|
+
if (!input.roomId || typeof input.roomId !== "string") {
|
|
67
|
+
throw new Error("[pending-prompts] roomId is required");
|
|
68
|
+
}
|
|
69
|
+
if (!input.taskId || typeof input.taskId !== "string") {
|
|
70
|
+
throw new Error("[pending-prompts] taskId is required");
|
|
71
|
+
}
|
|
72
|
+
if (!isValidIso(input.firedAt)) {
|
|
73
|
+
throw new Error("[pending-prompts] firedAt must be ISO-8601");
|
|
74
|
+
}
|
|
75
|
+
if (input.expiresAt !== undefined && !isValidIso(input.expiresAt)) {
|
|
76
|
+
throw new Error("[pending-prompts] expiresAt must be ISO-8601");
|
|
77
|
+
}
|
|
78
|
+
const reopenWindowHours = typeof input.reopenWindowHours === "number" &&
|
|
79
|
+
input.reopenWindowHours > 0
|
|
80
|
+
? input.reopenWindowHours
|
|
81
|
+
: DEFAULT_REOPEN_WINDOW_HOURS;
|
|
82
|
+
const recorded = {
|
|
83
|
+
roomId: input.roomId,
|
|
84
|
+
taskId: input.taskId,
|
|
85
|
+
promptSnippet: clampSnippet(input.promptSnippet),
|
|
86
|
+
firedAt: input.firedAt,
|
|
87
|
+
expectedReplyKind: input.expectedReplyKind ?? "any",
|
|
88
|
+
retainUntilIso: computeRetainUntil(input.firedAt, input.expiresAt, reopenWindowHours),
|
|
89
|
+
};
|
|
90
|
+
if (input.expiresAt !== undefined) {
|
|
91
|
+
recorded.expiresAt = input.expiresAt;
|
|
92
|
+
}
|
|
93
|
+
const existing = await loadRoom(cache, input.roomId);
|
|
94
|
+
const filtered = existing.filter((entry) => entry.taskId !== input.taskId);
|
|
95
|
+
filtered.push(recorded);
|
|
96
|
+
// Bound per-room growth: keep newest N entries (FIFO eviction).
|
|
97
|
+
const trimmed = filtered.length > PER_ROOM_MAX_PROMPTS
|
|
98
|
+
? filtered.slice(-PER_ROOM_MAX_PROMPTS)
|
|
99
|
+
: filtered;
|
|
100
|
+
await saveRoom(cache, input.roomId, trimmed);
|
|
101
|
+
return recorded;
|
|
102
|
+
},
|
|
103
|
+
async list(roomId, opts = {}) {
|
|
104
|
+
const now = opts.now ?? new Date();
|
|
105
|
+
const lookbackCutoffMs = typeof opts.lookbackMinutes === "number" && opts.lookbackMinutes > 0
|
|
106
|
+
? now.getTime() - opts.lookbackMinutes * 60_000
|
|
107
|
+
: null;
|
|
108
|
+
const stored = await loadRoom(cache, roomId);
|
|
109
|
+
let mutated = false;
|
|
110
|
+
const live = [];
|
|
111
|
+
for (const entry of stored) {
|
|
112
|
+
const retainMs = Date.parse(entry.retainUntilIso);
|
|
113
|
+
if (Number.isFinite(retainMs) && retainMs <= now.getTime()) {
|
|
114
|
+
mutated = true;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
live.push(entry);
|
|
118
|
+
}
|
|
119
|
+
if (mutated) {
|
|
120
|
+
await saveRoom(cache, roomId, live);
|
|
121
|
+
}
|
|
122
|
+
const visible = live.filter((entry) => {
|
|
123
|
+
if (lookbackCutoffMs === null)
|
|
124
|
+
return true;
|
|
125
|
+
const firedMs = Date.parse(entry.firedAt);
|
|
126
|
+
return Number.isFinite(firedMs) && firedMs >= lookbackCutoffMs;
|
|
127
|
+
});
|
|
128
|
+
return visible
|
|
129
|
+
.slice()
|
|
130
|
+
.sort((a, b) => Date.parse(b.firedAt) - Date.parse(a.firedAt))
|
|
131
|
+
.map((entry) => {
|
|
132
|
+
const projected = {
|
|
133
|
+
taskId: entry.taskId,
|
|
134
|
+
promptSnippet: entry.promptSnippet,
|
|
135
|
+
firedAt: entry.firedAt,
|
|
136
|
+
expectedReplyKind: entry.expectedReplyKind,
|
|
137
|
+
};
|
|
138
|
+
if (entry.expiresAt !== undefined) {
|
|
139
|
+
projected.expiresAt = entry.expiresAt;
|
|
140
|
+
}
|
|
141
|
+
return projected;
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
async listAll(opts = {}) {
|
|
145
|
+
const rooms = await listRooms(cache);
|
|
146
|
+
const perRoom = await Promise.all(rooms.map(async (roomId) => (await store.list(roomId, opts)).map((prompt) => ({
|
|
147
|
+
...prompt,
|
|
148
|
+
roomId,
|
|
149
|
+
}))));
|
|
150
|
+
return perRoom
|
|
151
|
+
.flat()
|
|
152
|
+
.sort((a, b) => Date.parse(b.firedAt) - Date.parse(a.firedAt));
|
|
153
|
+
},
|
|
154
|
+
async resolve(roomId, taskId) {
|
|
155
|
+
const existing = await loadRoom(cache, roomId);
|
|
156
|
+
const next = existing.filter((entry) => entry.taskId !== taskId);
|
|
157
|
+
if (next.length === existing.length) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
await saveRoom(cache, roomId, next);
|
|
161
|
+
},
|
|
162
|
+
async forgetTask(taskId) {
|
|
163
|
+
const rooms = await listRooms(cache);
|
|
164
|
+
for (const roomId of rooms) {
|
|
165
|
+
const existing = await loadRoom(cache, roomId);
|
|
166
|
+
const next = existing.filter((entry) => entry.taskId !== taskId);
|
|
167
|
+
if (next.length !== existing.length) {
|
|
168
|
+
await saveRoom(cache, roomId, next);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
async clearAll() {
|
|
173
|
+
const rooms = await listRooms(cache);
|
|
174
|
+
for (const roomId of rooms) {
|
|
175
|
+
if (typeof cache.deleteCache === "function") {
|
|
176
|
+
await cache.deleteCache(roomCacheKey(roomId));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
await cache.setCache(roomCacheKey(roomId), []);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (typeof cache.deleteCache === "function") {
|
|
183
|
+
await cache.deleteCache(ROOM_INDEX_KEY);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
await cache.setCache(ROOM_INDEX_KEY, []);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
return store;
|
|
191
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as esbuild from "esbuild";
|
|
2
|
-
import type { VirtualFilesystemService } from "./virtual-filesystem.
|
|
2
|
+
import type { VirtualFilesystemService } from "./virtual-filesystem.js";
|
|
3
3
|
export type PluginCompilerFormat = "esm" | "cjs";
|
|
4
4
|
export interface PluginCompilerOptions {
|
|
5
5
|
vfs: VirtualFilesystemService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-installer.d.ts","sourceRoot":"","sources":["../../src/services/plugin-installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAU9E,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,QACiB,CAAC;AAKjD,uFAAuF;AACvF,eAAO,MAAM,YAAY,QAA0B,CAAC;AAEpD,wDAAwD;AACxD,eAAO,MAAM,aAAa,QAAyC,CAAC;AAKpE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIzD;AAQD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAInD;AAYD,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,aAAa,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Ae,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAE5E;AA6DD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAQ1B;AAgKD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAgMD,uDAAuD;AACvD,wBAAgB,oBAAoB,IAAI,KAAK,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAUD"}
|
|
@@ -130,7 +130,10 @@ function resolveInstallVersion(canonicalName, info, requestedVersion) {
|
|
|
130
130
|
export async function detectPackageManager() {
|
|
131
131
|
for (const cmd of ["bun", "npm"]) {
|
|
132
132
|
try {
|
|
133
|
-
await execFileAsync(cmd, ["--version"]
|
|
133
|
+
await execFileAsync(cmd, ["--version"], {
|
|
134
|
+
// npm is a `.cmd` shim on Windows; Node can't spawn it without a shell.
|
|
135
|
+
shell: process.platform === "win32",
|
|
136
|
+
});
|
|
134
137
|
return cmd;
|
|
135
138
|
}
|
|
136
139
|
catch (err) {
|
|
@@ -409,13 +412,10 @@ async function runInstallSpec(pm, spec, targetDir) {
|
|
|
409
412
|
});
|
|
410
413
|
break;
|
|
411
414
|
default:
|
|
412
|
-
await execFileAsync("npm", [
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
"--prefix",
|
|
417
|
-
targetDir,
|
|
418
|
-
]);
|
|
415
|
+
await execFileAsync("npm", ["install", "--ignore-scripts", spec, "--prefix", targetDir],
|
|
416
|
+
// npm is a `.cmd` shim on Windows; Node can't spawn it without a shell.
|
|
417
|
+
// `spec` is validated by assertValidPackageName/assertValidVersion.
|
|
418
|
+
{ shell: process.platform === "win32" });
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
async function readInstalledVersion(targetDir, packageName, fallbackVersion) {
|
|
@@ -537,11 +537,18 @@ async function gitCloneInstall(info, targetDir, onProgress) {
|
|
|
537
537
|
message: "Installing dependencies...",
|
|
538
538
|
});
|
|
539
539
|
const pm = await detectPackageManager();
|
|
540
|
-
await execFileAsync(pm, ["install", "--ignore-scripts"], {
|
|
540
|
+
await execFileAsync(pm, ["install", "--ignore-scripts"], {
|
|
541
|
+
cwd: tempDir,
|
|
542
|
+
// `pm` is npm.cmd on Windows when bun is absent; needs a shell to resolve.
|
|
543
|
+
shell: process.platform === "win32",
|
|
544
|
+
});
|
|
541
545
|
const registrySourceDir = resolveRegistrySourceDir(tempDir, info.directory);
|
|
542
546
|
if (registrySourceDir !== tempDir) {
|
|
543
547
|
try {
|
|
544
|
-
await execFileAsync(pm, ["run", "build"], {
|
|
548
|
+
await execFileAsync(pm, ["run", "build"], {
|
|
549
|
+
cwd: registrySourceDir,
|
|
550
|
+
shell: process.platform === "win32",
|
|
551
|
+
});
|
|
545
552
|
}
|
|
546
553
|
catch (buildErr) {
|
|
547
554
|
logger.warn(`[plugin-installer] build step failed for ${info.name}: ${buildErr instanceof Error ? buildErr.message : String(buildErr)}`);
|
|
@@ -565,7 +572,10 @@ async function gitCloneInstall(info, targetDir, onProgress) {
|
|
|
565
572
|
}
|
|
566
573
|
let buildFailed = false;
|
|
567
574
|
try {
|
|
568
|
-
await execFileAsync(pm, ["run", "build"], {
|
|
575
|
+
await execFileAsync(pm, ["run", "build"], {
|
|
576
|
+
cwd: tsDir,
|
|
577
|
+
shell: process.platform === "win32",
|
|
578
|
+
});
|
|
569
579
|
}
|
|
570
580
|
catch (buildErr) {
|
|
571
581
|
buildFailed = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppUiExtensionConfig, RegistryAppMeta, RegistryAppSessionFeature, RegistryAppSessionMeta, RegistryAppSessionMode, RegistryAppViewerMeta, RegistryPluginInfo as RegistryClientPluginInfo, RegistrySearchResult as RegistryClientSearchResult } from "./registry-client-types.
|
|
1
|
+
import type { AppUiExtensionConfig, RegistryAppMeta, RegistryAppSessionFeature, RegistryAppSessionMeta, RegistryAppSessionMode, RegistryAppViewerMeta, RegistryPluginInfo as RegistryClientPluginInfo, RegistrySearchResult as RegistryClientSearchResult } from "./registry-client-types.js";
|
|
2
2
|
export type { AppUiExtensionConfig };
|
|
3
3
|
export type RegistryVersionSupport = RegistryClientPluginInfo["supports"];
|
|
4
4
|
export type RegistryPluginNpmInfo = RegistryClientPluginInfo["npm"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Proactive-interaction decider (#8792).
|
|
3
3
|
*
|
|
4
|
-
* Consumes UI interaction events (view switches
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Consumes UI interaction events (view switches, slash commands, shortcuts) and
|
|
5
|
+
* decides whether to surface a single scoped, helpful offer through either the
|
|
6
|
+
* existing `routeAutonomyTextToUser` → `proactive-message` pipeline with
|
|
7
|
+
* `source: "proactive-interaction"` or the low-priority notification rail.
|
|
8
8
|
*
|
|
9
9
|
* Two layers, both testable in isolation:
|
|
10
10
|
* - {@link decideProactiveComment} — the pure policy + governance decision
|
|
@@ -13,21 +13,66 @@
|
|
|
13
13
|
* subscribes to the event bus, runs the small-model judge, and routes the
|
|
14
14
|
* admitted comment.
|
|
15
15
|
*/
|
|
16
|
-
import { type IAgentRuntime, type ViewSwitchedPayload } from "@elizaos/core";
|
|
17
|
-
import { type ProactiveInteractionGate } from "./proactive-interaction-gate.
|
|
16
|
+
import { type IAgentRuntime, type ShortcutFiredPayload, type SlashCommandInvokedPayload, type ViewSwitchedPayload } from "@elizaos/core";
|
|
17
|
+
import { type ProactiveInteractionGate } from "./proactive-interaction-gate.js";
|
|
18
18
|
/** Source tag for proactive comments driven by UI interactions. */
|
|
19
19
|
export declare const PROACTIVE_INTERACTION_SOURCE = "proactive-interaction";
|
|
20
|
-
/**
|
|
21
|
-
export type
|
|
20
|
+
/** Any interaction the decider reacts to (#8792). */
|
|
21
|
+
export type InteractionPayload = ViewSwitchedPayload | SlashCommandInvokedPayload | ShortcutFiredPayload;
|
|
22
|
+
/**
|
|
23
|
+
* Runtime setting key for the user-facing "Proactive suggestions" control
|
|
24
|
+
* (off/subtle/chatty). Read via `runtime.getSetting`, it takes precedence over
|
|
25
|
+
* the `ELIZA_PROACTIVE_INTERACTIONS` env default inside the gate resolver.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PROACTIVE_CHATTINESS_SETTING_KEY = "ELIZA_PROACTIVE_INTERACTIONS";
|
|
28
|
+
/** Where an admitted proactive offer should be delivered. */
|
|
29
|
+
export type ProactiveDelivery = "chat" | "notify";
|
|
30
|
+
/** A scoped offer from the judge, normalized before governance/admission. */
|
|
31
|
+
export interface ProactiveOffer {
|
|
32
|
+
text: string;
|
|
33
|
+
delivery: ProactiveDelivery;
|
|
34
|
+
title?: string;
|
|
35
|
+
deepLink?: string;
|
|
36
|
+
groupKey?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A model judge: given an interaction context, return an offer or null. */
|
|
39
|
+
export type ProactiveJudgeResult = string | ProactiveOffer | null;
|
|
40
|
+
export type ProactiveJudge = (payload: InteractionPayload) => Promise<ProactiveJudgeResult>;
|
|
22
41
|
export interface DecideProactiveInput {
|
|
23
|
-
payload:
|
|
42
|
+
payload: InteractionPayload;
|
|
24
43
|
gate: ProactiveInteractionGate;
|
|
25
44
|
judge: ProactiveJudge;
|
|
26
45
|
now: number;
|
|
27
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Control / dismiss / help shortcuts that must never trigger a proactive comment
|
|
49
|
+
* (#8792). These are gestures, not intent: commenting on them is noise, and —
|
|
50
|
+
* critically — the small-model judge runs BEFORE the governance gate, so letting
|
|
51
|
+
* them reach the judge would spend a TEXT_SMALL call per keystroke. Denying them
|
|
52
|
+
* here (a surface of `null`) skips the judge entirely. Navigation-bearing
|
|
53
|
+
* shortcuts ("open X") report `VIEW_SWITCHED` through the navigate route instead,
|
|
54
|
+
* so SHORTCUT_FIRED stays a small, high-signal channel for non-navigation
|
|
55
|
+
* capability-invokes (e.g. opening the command palette).
|
|
56
|
+
*/
|
|
57
|
+
export declare const NON_PROACTIVE_SHORTCUT_IDS: ReadonlySet<string>;
|
|
58
|
+
/**
|
|
59
|
+
* The governance surface for an interaction, or `null` when policy says never
|
|
60
|
+
* comment. Explicitly-typed slash commands return `null`: the user already
|
|
61
|
+
* expressed intent and the command produced its own reply, so a proactive
|
|
62
|
+
* comment would be double-talk (#8792 open question). Control/dismiss shortcuts
|
|
63
|
+
* are denied (see {@link NON_PROACTIVE_SHORTCUT_IDS}). View switches key on the
|
|
64
|
+
* view; remaining (intent-bearing) shortcuts key on the shortcut id.
|
|
65
|
+
*/
|
|
66
|
+
export declare function interactionSurface(payload: InteractionPayload): string | null;
|
|
28
67
|
export interface DecideProactiveResult {
|
|
29
68
|
/** The comment to surface, or null when none should be sent. */
|
|
30
69
|
text: string | null;
|
|
70
|
+
/** Delivery rail for the admitted text. Null when no text is admitted. */
|
|
71
|
+
delivery: ProactiveDelivery | null;
|
|
72
|
+
/** Optional notification headline when delivery is notify. */
|
|
73
|
+
title?: string;
|
|
74
|
+
deepLink?: string;
|
|
75
|
+
groupKey?: string;
|
|
31
76
|
reason: string;
|
|
32
77
|
}
|
|
33
78
|
/**
|
|
@@ -41,13 +86,19 @@ export interface DecideProactiveResult {
|
|
|
41
86
|
* call and records the emission.
|
|
42
87
|
*/
|
|
43
88
|
export declare function decideProactiveComment(input: DecideProactiveInput): Promise<DecideProactiveResult>;
|
|
44
|
-
/** Build the small-model judge prompt for
|
|
45
|
-
export declare function buildProactiveJudgePrompt(payload:
|
|
89
|
+
/** Build the small-model judge prompt for an interaction. */
|
|
90
|
+
export declare function buildProactiveJudgePrompt(payload: InteractionPayload): string;
|
|
91
|
+
/** Parse the judge model output into a typed offer or null. */
|
|
92
|
+
export declare function parseProactiveJudgeDecisionOutput(raw: unknown): ProactiveOffer | null;
|
|
46
93
|
/** Parse the judge model output into an offer string or null. */
|
|
47
94
|
export declare function parseProactiveJudgeOutput(raw: unknown): string | null;
|
|
48
95
|
export interface ProactiveDeciderWiring {
|
|
49
96
|
/** Route an admitted comment to the user (proactive-message pipeline). */
|
|
50
97
|
route: (text: string) => Promise<void>;
|
|
98
|
+
/** Route an admitted low-urgency offer to the notification rail. */
|
|
99
|
+
notify?: (offer: ProactiveOffer) => Promise<void>;
|
|
100
|
+
/** Suppress comments while a foreground chat turn is already speaking/typing. */
|
|
101
|
+
shouldSuppress?: () => boolean;
|
|
51
102
|
gate: ProactiveInteractionGate;
|
|
52
103
|
/** Override the clock (tests). */
|
|
53
104
|
now?: () => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proactive-interaction-decider.d.ts","sourceRoot":"","sources":["../../src/services/proactive-interaction-decider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,iCAAiC,CAAC;AAEzC,mEAAmE;AACnE,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,
|
|
1
|
+
{"version":3,"file":"proactive-interaction-decider.d.ts","sourceRoot":"","sources":["../../src/services/proactive-interaction-decider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,iCAAiC,CAAC;AAEzC,mEAAmE;AACnE,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,qDAAqD;AACrD,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,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