@xopcai/xopc 0.0.248 → 0.0.250
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-etpmyV7S.js → activity-store-DfBjTSo9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BN6FJXkJ.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C7rZH1A2.js +1 -0
- package/dist/gateway/static/root/assets/agents-CgGaoo4z.js +1 -0
- package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-zxpcJfgj.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-D2gMshuS.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-wMu0jSKx.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-KF1Gnv36.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-u6EE3JV8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-DbJurnv-.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Ew_e5HDn.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-DtDFNfPM.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-CnAwmabq.js} +44 -44
- package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-CcbUOWDF.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CX-yWwLD.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-CryTDNdD.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-ji5aWrjG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-Dro_w3eX.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-Ce19KKnX.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-DsSi-3uZ.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-8WQ4woJy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-CgvEBfLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-DkznBbMj.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BOjhchK2.js +1 -0
- package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-OEruhhX3.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BgH3A0LO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-C5mn73ca.js} +1 -1
- package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +72 -0
- package/dist/gateway/static/root/assets/index-DAryGvZ7.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-BYhfzsqe.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DNncc2tn.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-vBlknU7C.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-CF4erhjB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CizZInrT.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-Dnx6mSNe.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-DtBtcHWi.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-CQvzsE24.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-DrMYeHe7.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-AKgGy3Kx.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +8 -0
- package/dist/gateway/static/root/assets/page-tabs-CX9T71by.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-DvEHoimN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-COcr_NUJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-BsRBlji7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-CQ13P-mS.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-BUVyTpZj.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DVY-8_B9.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-CdiVYyTl.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BhenBnUj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-C88YLKm4.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DLir1nM0.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-BMZAfS3G.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BM8ivYan.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-BOgkc_9D.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-DemxChjo.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-CV3Ui5hu.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-CUoCi4Sq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-C-ryeIxj.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BhDlkCMB.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-D8CcPc_C.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +5 -0
- package/dist/gateway/static/root/index.html +11 -27
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
- package/dist/src/agent/agent-manager.d.ts +13 -13
- package/dist/src/agent/agent-manager.js +76 -42
- package/dist/src/agent/background-review/coordinator.d.ts +2 -4
- package/dist/src/agent/background-review/coordinator.js +5 -30
- package/dist/src/agent/background-review/prompts.d.ts +4 -2
- package/dist/src/agent/background-review/prompts.js +33 -19
- package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
- package/dist/src/agent/background-review/run-background-review.js +47 -41
- package/dist/src/agent/background-review/settings.d.ts +0 -1
- package/dist/src/agent/background-review/settings.js +6 -7
- package/dist/src/agent/context/audit.d.ts +38 -0
- package/dist/src/agent/context/audit.js +123 -0
- package/dist/src/agent/context/coordinator.d.ts +31 -0
- package/dist/src/agent/context/coordinator.js +73 -0
- package/dist/src/agent/context/execution-context.d.ts +13 -0
- package/dist/src/agent/context/execution-context.js +211 -0
- package/dist/src/agent/context/execution-context.types.d.ts +50 -0
- package/dist/src/agent/context/execution-scope.d.ts +5 -1
- package/dist/src/agent/context/execution-scope.js +6 -2
- package/dist/src/agent/context/prepend.d.ts +2 -0
- package/dist/src/agent/context/prepend.js +28 -0
- package/dist/src/agent/context/project-context.d.ts +6 -3
- package/dist/src/agent/context/project-context.js +28 -23
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +22 -2
- package/dist/src/agent/embedded/types.d.ts +1 -25
- package/dist/src/agent/external-tools/composio-provider.js +87 -92
- package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
- package/dist/src/agent/external-tools/gateway-tools.js +153 -41
- package/dist/src/agent/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +2 -1
- package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/memory-provider.js +1 -0
- package/dist/src/agent/external-tools/search-error.d.ts +12 -0
- package/dist/src/agent/external-tools/search-error.js +29 -0
- package/dist/src/agent/external-tools/service.d.ts +4 -0
- package/dist/src/agent/external-tools/service.js +22 -2
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/memory/compaction-policy.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
- package/dist/src/agent/memory/compaction-promotion.js +52 -79
- package/dist/src/agent/memory/create-memory-manager.js +1 -3
- package/dist/src/agent/memory/index.d.ts +1 -6
- package/dist/src/agent/memory/index.js +3 -6
- package/dist/src/agent/memory/manager.d.ts +0 -16
- package/dist/src/agent/memory/manager.js +11 -40
- package/dist/src/agent/memory/memory-config.d.ts +0 -5
- package/dist/src/agent/memory/memory-config.js +2 -9
- package/dist/src/agent/memory/runtime.d.ts +2 -2
- package/dist/src/agent/memory/runtime.js +9 -19
- package/dist/src/agent/memory/types.d.ts +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
- package/dist/src/agent/orchestration/context-overflow.js +1 -0
- package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
- package/dist/src/agent/prompt/sections/tooling.js +10 -4
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js +8 -25
- package/dist/src/agent/service/process-direct-streaming.js +8 -7
- package/dist/src/agent/service.js +4 -3
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +5 -2
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +68 -21
- package/dist/src/agent/tools/index.d.ts +3 -2
- package/dist/src/agent/tools/index.js +4 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +184 -0
- package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
- package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +7 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +10 -0
- package/dist/src/agent/tools/user-context-tool.js +98 -0
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/automations/service/automation-service.d.ts +2 -1
- package/dist/src/automations/service/automation-service.js +6 -2
- package/dist/src/chat-commands/builtins/understanding.js +24 -6
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +68 -75
- package/dist/src/config/schema.js +29 -18
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -1
- package/dist/src/connectors/composio-managed-client.js +6 -2
- package/dist/src/connectors/connected-source-ingestion.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
- package/dist/src/connectors/connected-source-understanding.js +86 -99
- package/dist/src/connectors/connection-candidates.d.ts +11 -0
- package/dist/src/connectors/connection-candidates.js +58 -0
- package/dist/src/connectors/connection-capabilities.d.ts +4 -0
- package/dist/src/connectors/connection-capabilities.js +37 -0
- package/dist/src/connectors/connection-recovery-service.d.ts +43 -0
- package/dist/src/connectors/connection-recovery-service.js +420 -0
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.d.ts +0 -2
- package/dist/src/connectors/learning-coordinator.js +6 -7
- package/dist/src/connectors/principal.d.ts +5 -0
- package/dist/src/connectors/principal.js +18 -0
- package/dist/src/files/file-service.js +4 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
- package/dist/src/gateway/agent-builtin-tools.js +30 -9
- package/dist/src/gateway/chat-stream/mapper.js +1 -28
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
- package/dist/src/gateway/clarify-bridge.d.ts +4 -0
- package/dist/src/gateway/clarify-bridge.js +9 -4
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/middleware/auth.js +1 -2
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
- package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
- package/dist/src/gateway/hono/routes/connectors.js +24 -18
- package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
- package/dist/src/gateway/hono/routes/context-sources.js +159 -0
- package/dist/src/gateway/hono/routes/files.js +23 -2
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +22 -7
- package/dist/src/gateway/hono/routes/projects.js +36 -44
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/side-chats.js +13 -2
- package/dist/src/gateway/hono/routes/tasks.js +3 -3
- package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
- package/dist/src/gateway/hono/routes/user-model.js +480 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/agent-runner.d.ts +9 -1
- package/dist/src/gateway/service/agent-runner.js +25 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +18 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +12 -2
- package/dist/src/gateway/service.d.ts +3 -1
- package/dist/src/gateway/service.js +52 -17
- package/dist/src/gateway/side-chat/manager.d.ts +16 -3
- package/dist/src/gateway/side-chat/manager.js +117 -28
- package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
- package/dist/src/gateway/side-chat/run-service.js +28 -5
- package/dist/src/gateway/side-chat/types.d.ts +9 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
- package/dist/src/knowledge-memory/domain.d.ts +36 -0
- package/dist/src/knowledge-memory/index.d.ts +2 -0
- package/dist/src/knowledge-memory/index.js +2 -0
- package/dist/src/knowledge-memory/repository.d.ts +48 -0
- package/dist/src/knowledge-memory/repository.js +168 -0
- package/dist/src/memory-maintenance/index.d.ts +2 -0
- package/dist/src/memory-maintenance/index.js +3 -0
- package/dist/src/memory-maintenance/schedule.d.ts +13 -0
- package/dist/src/memory-maintenance/schedule.js +51 -0
- package/dist/src/memory-maintenance/service.d.ts +28 -0
- package/dist/src/memory-maintenance/service.js +216 -0
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +7 -1
- package/dist/src/notes/types.d.ts +16 -0
- package/dist/src/notifications/planner.js +7 -3
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +1 -10
- package/dist/src/proactive/execution/context.d.ts +8 -10
- package/dist/src/proactive/execution/context.js +93 -42
- package/dist/src/proactive/execution/insight.d.ts +4 -1
- package/dist/src/proactive/execution/insight.js +5 -2
- package/dist/src/proactive/execution/repository.d.ts +1 -0
- package/dist/src/proactive/execution/repository.js +9 -1
- package/dist/src/proactive/execution/types.d.ts +0 -1
- package/dist/src/proactive/execution/worker.js +7 -5
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/inbox/service.js +2 -2
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.js +7 -0
- package/dist/src/proactive/index.d.ts +2 -1
- package/dist/src/proactive/index.js +3 -2
- package/dist/src/proactive/maintenance.d.ts +4 -0
- package/dist/src/proactive/maintenance.js +21 -0
- package/dist/src/proactive/scenarios/repository.d.ts +1 -1
- package/dist/src/proactive/scenarios/repository.js +10 -3
- package/dist/src/proactive/scenarios/types.d.ts +7 -0
- package/dist/src/proactive/service.d.ts +7 -0
- package/dist/src/proactive/service.js +17 -1
- package/dist/src/projects/index.d.ts +1 -1
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/knowledge-bind.d.ts +1 -0
- package/dist/src/projects/knowledge-bind.js +15 -0
- package/dist/src/projects/project-loop.d.ts +3 -3
- package/dist/src/projects/project-loop.js +4 -4
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +3 -2
- package/dist/src/projects/project-store.js +2 -1
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +5 -2
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +19 -0
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
- package/dist/src/storage/sqlite/config-repository.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
- package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
- package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -5
- package/dist/src/storage/sqlite/index.js +6 -8
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
- package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.d.ts +2 -1
- package/dist/src/storage/sqlite/notes-repository.js +37 -3
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
- package/dist/src/storage/sqlite/session-input-repository.js +17 -14
- package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +7 -6
- package/dist/src/storage/sqlite/transcript-repository.js +3 -2
- package/dist/src/tasks/home-query-service.js +35 -13
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
- package/dist/src/tasks/project-monitoring-service.js +4 -1
- package/dist/src/tasks/project-operating-view-service.js +1 -1
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-context-repository.d.ts +0 -1
- package/dist/src/tasks/task-context-repository.js +1 -1
- package/dist/src/tasks/task-deletion-service.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tasks/task-run-repository.js +1 -0
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tool-summary.js +2 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/user-context/access-policy.d.ts +11 -0
- package/dist/src/user-context/access-policy.js +26 -0
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/user-context/config.d.ts +135 -153
- package/dist/src/user-context/config.js +94 -99
- package/dist/src/user-context/relationship-continuity.d.ts +2 -2
- package/dist/src/user-context/relationship-continuity.js +34 -24
- package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -21
- package/dist/src/user-context/sources/repository.js +1 -183
- package/dist/src/user-context/sources/types.d.ts +0 -23
- package/dist/src/user-model/capture/executor.d.ts +50 -0
- package/dist/src/user-model/capture/executor.js +230 -0
- package/dist/src/user-model/capture/index.d.ts +2 -0
- package/dist/src/user-model/capture/index.js +3 -0
- package/dist/src/user-model/capture/semantic.d.ts +39 -0
- package/dist/src/user-model/capture/semantic.js +263 -0
- package/dist/src/user-model/domain.d.ts +93 -0
- package/dist/src/user-model/domain.js +33 -0
- package/dist/src/user-model/goals.d.ts +62 -0
- package/dist/src/user-model/goals.js +91 -0
- package/dist/src/user-model/importance.d.ts +11 -0
- package/dist/src/user-model/importance.js +17 -0
- package/dist/src/user-model/index.d.ts +5 -0
- package/dist/src/user-model/index.js +6 -0
- package/dist/src/user-model/repository.d.ts +23 -0
- package/dist/src/user-model/repository.js +268 -0
- package/dist/src/user-model/temporal.d.ts +10 -0
- package/dist/src/user-model/temporal.js +44 -0
- package/dist/src/voice/realtime/memory-context.d.ts +7 -2
- package/dist/src/voice/realtime/memory-context.js +39 -51
- package/dist/src/work-discovery/service.d.ts +3 -14
- package/dist/src/work-discovery/service.js +138 -99
- package/dist/src/work-discovery/types.d.ts +3 -3
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +0 -1
- package/dist/gateway/static/root/assets/agents-DNq_GKuc.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-qfwAgyhQ.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DqQVUpCC.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DSp--zIZ.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DpN3XZg9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DinCToZh.js +0 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DcguCgsH.js +0 -1
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
- package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Br7lSf6H.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CdPoDMuj.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DHk1hawP.js +0 -1
- package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +0 -1
- package/dist/gateway/static/root/assets/index-D5TQQpeb.js +0 -71
- package/dist/gateway/static/root/assets/index-DReBaaTX.css +0 -2
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CpyvYyrb.js +0 -2
- package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CXKy6E_l.js +0 -2
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +0 -3
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-3NKCniSp.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DuqLahi6.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +0 -5
- package/dist/gateway/static/root/assets/oauth-api-8lP_qJpq.js +0 -1
- package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CjF8DTsN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-BSYuRgFI.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-FKUi9wDL.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +0 -2
- package/dist/gateway/static/root/assets/work-discovery-overlay-jhT2EzeH.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +0 -5
- package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
- package/dist/src/agent/memory/builtin-provider.js +0 -225
- package/dist/src/agent/memory/context/types.d.ts +0 -40
- package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
- package/dist/src/agent/memory/understanding/quality.js +0 -18
- package/dist/src/agent/memory/understanding/service.d.ts +0 -19
- package/dist/src/agent/memory/understanding/service.js +0 -209
- package/dist/src/agent/memory/understanding/types.d.ts +0 -34
- package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
- package/dist/src/agent/memory/user-context-coordinator.js +0 -113
- package/dist/src/agent/tools/dreaming-tool.js +0 -37
- package/dist/src/agent/tools/memory-tool.d.ts +0 -9
- package/dist/src/agent/tools/memory-tool.js +0 -119
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
- package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
- package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
- package/dist/src/gateway/hono/routes/you.d.ts +0 -3
- package/dist/src/gateway/hono/routes/you.js +0 -457
- package/dist/src/projects/memory-bind.d.ts +0 -1
- package/dist/src/projects/memory-bind.js +0 -14
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
- package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
- package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
- package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
- package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +0 -2
- package/dist/src/storage/sqlite/understanding-focus-exclusions.js +0 -24
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
- package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
- package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
- package/dist/src/storage/sqlite/user-context-repository.js +0 -535
- package/dist/src/user-context/automatic-context.d.ts +0 -17
- package/dist/src/user-context/automatic-context.js +0 -85
- package/dist/src/user-context/consolidation.d.ts +0 -27
- package/dist/src/user-context/consolidation.js +0 -187
- package/dist/src/user-context/context-objects.d.ts +0 -17
- package/dist/src/user-context/context-objects.js +0 -99
- package/dist/src/user-context/evaluation/harness.d.ts +0 -13
- package/dist/src/user-context/evaluation/harness.js +0 -31
- package/dist/src/user-context/extraction/executor.d.ts +0 -22
- package/dist/src/user-context/extraction/executor.js +0 -142
- package/dist/src/user-context/extraction/repair.d.ts +0 -19
- package/dist/src/user-context/extraction/repair.js +0 -71
- package/dist/src/user-context/extraction/semantic.d.ts +0 -18
- package/dist/src/user-context/extraction/semantic.js +0 -148
- package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
- package/dist/src/user-context/focus-lifecycle.js +0 -26
- package/dist/src/user-context/manual-understanding.d.ts +0 -12
- package/dist/src/user-context/manual-understanding.js +0 -37
- package/dist/src/user-context/planner.d.ts +0 -17
- package/dist/src/user-context/planner.js +0 -465
- package/dist/src/user-context/relationships/indexer.d.ts +0 -13
- package/dist/src/user-context/relationships/indexer.js +0 -185
- package/dist/src/user-context/relationships/service.d.ts +0 -22
- package/dist/src/user-context/relationships/service.js +0 -50
- package/dist/src/user-context/retriever.d.ts +0 -15
- package/dist/src/user-context/retriever.js +0 -124
- package/dist/src/user-context/scope.d.ts +0 -7
- package/dist/src/user-context/scope.js +0 -9
- package/dist/src/user-context/selection-policy.d.ts +0 -20
- package/dist/src/user-context/selection-policy.js +0 -33
- package/dist/src/user-context/understanding.d.ts +0 -15
- package/dist/src/user-context/understanding.js +0 -24
- package/dist/src/user-context/understandingQuality.d.ts +0 -5
- package/dist/src/user-context/understandingQuality.js +0 -48
- /package/dist/src/agent/{memory/context/types.js → context/execution-context.types.js} +0 -0
- /package/dist/src/{agent/memory/understanding/types.js → knowledge-memory/domain.js} +0 -0
|
@@ -9,15 +9,21 @@ init_logger();
|
|
|
9
9
|
const DEFAULT_IDLE_TTL_MS = 1800 * 1e3;
|
|
10
10
|
const DEFAULT_MAX_PER_CLIENT = 5;
|
|
11
11
|
const DEFAULT_MAX_TOTAL = 50;
|
|
12
|
+
const MAX_EXPIRED_RECORDS = 500;
|
|
12
13
|
const log = createLogger("Gateway:SideChat");
|
|
13
14
|
var SideChatError = class extends Error {
|
|
14
|
-
constructor(message, code) {
|
|
15
|
+
constructor(message, code, reason) {
|
|
15
16
|
super(message);
|
|
16
17
|
this.code = code;
|
|
18
|
+
this.reason = reason;
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
var EphemeralSideChatManager = class {
|
|
20
22
|
entries = /* @__PURE__ */ new Map();
|
|
23
|
+
reservations = /* @__PURE__ */ new Map();
|
|
24
|
+
expired = /* @__PURE__ */ new Map();
|
|
25
|
+
disposals = /* @__PURE__ */ new Map();
|
|
26
|
+
stopped = false;
|
|
21
27
|
now;
|
|
22
28
|
idleTtlMs;
|
|
23
29
|
maxPerClient;
|
|
@@ -43,11 +49,28 @@ var EphemeralSideChatManager = class {
|
|
|
43
49
|
const parentSessionKey = input.parentSessionKey.trim();
|
|
44
50
|
const clientInstanceId = input.clientInstanceId.trim();
|
|
45
51
|
if (!parentSessionKey || !clientInstanceId) throw new SideChatError("parentSessionKey and clientInstanceId are required", "INVALID_REQUEST");
|
|
46
|
-
|
|
47
|
-
if ([...this.
|
|
52
|
+
await this.sweepExpired();
|
|
53
|
+
if (this.stopped || this.entries.size + [...this.reservations.values()].reduce((a, b) => a + b, 0) >= this.maxTotal) throw new SideChatError("The side chat capacity has been reached", "CAPACITY_REACHED");
|
|
54
|
+
if ([...this.entries.values()].filter((entry) => entry.clientInstanceId === clientInstanceId).length + (this.reservations.get(clientInstanceId) ?? 0) >= this.maxPerClient) throw new SideChatError(`A client can have at most ${this.maxPerClient} side chats`, "LIMIT_REACHED");
|
|
55
|
+
this.reservations.set(clientInstanceId, (this.reservations.get(clientInstanceId) ?? 0) + 1);
|
|
56
|
+
try {
|
|
57
|
+
return await this.createEntry({
|
|
58
|
+
...input,
|
|
59
|
+
parentSessionKey,
|
|
60
|
+
clientInstanceId
|
|
61
|
+
});
|
|
62
|
+
} finally {
|
|
63
|
+
const remaining = (this.reservations.get(clientInstanceId) ?? 1) - 1;
|
|
64
|
+
if (remaining) this.reservations.set(clientInstanceId, remaining);
|
|
65
|
+
else this.reservations.delete(clientInstanceId);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async createEntry(input) {
|
|
69
|
+
const { parentSessionKey, clientInstanceId } = input;
|
|
48
70
|
const metadata = await this.options.getParentMetadata(parentSessionKey);
|
|
49
|
-
if (!metadata || !metadata.sessionId) throw new SideChatError("Parent session not found", "
|
|
71
|
+
if (!metadata || !metadata.sessionId) throw new SideChatError("Parent session not found", "PARENT_NOT_FOUND");
|
|
50
72
|
const parentMessages = await this.options.loadParentMessages(parentSessionKey);
|
|
73
|
+
if (this.stopped) throw new SideChatError("Gateway is stopping", "CAPACITY_REACHED");
|
|
51
74
|
let selections;
|
|
52
75
|
try {
|
|
53
76
|
selections = validateSideChatSelections(input.selections);
|
|
@@ -76,6 +99,7 @@ var EphemeralSideChatManager = class {
|
|
|
76
99
|
status: "idle",
|
|
77
100
|
createdAt,
|
|
78
101
|
lastActiveAt: createdAt,
|
|
102
|
+
lastSeenAt: createdAt,
|
|
79
103
|
expiresAt: new Date(now + this.idleTtlMs).toISOString(),
|
|
80
104
|
messageCount: 0,
|
|
81
105
|
context: createSideChatContextSnapshot({
|
|
@@ -89,10 +113,10 @@ var EphemeralSideChatManager = class {
|
|
|
89
113
|
runtime
|
|
90
114
|
};
|
|
91
115
|
this.entries.set(id, entry);
|
|
92
|
-
return toView(entry);
|
|
116
|
+
return this.toView(entry);
|
|
93
117
|
}
|
|
94
118
|
get(id, clientInstanceId) {
|
|
95
|
-
return toView(this.requireEntry(id, clientInstanceId));
|
|
119
|
+
return this.toView(this.requireEntry(id, clientInstanceId));
|
|
96
120
|
}
|
|
97
121
|
getRuntime(id, clientInstanceId) {
|
|
98
122
|
return this.requireEntry(id, clientInstanceId).runtime;
|
|
@@ -105,35 +129,61 @@ var EphemeralSideChatManager = class {
|
|
|
105
129
|
}
|
|
106
130
|
updateConfig(id, clientInstanceId, patch) {
|
|
107
131
|
const entry = this.requireEntry(id, clientInstanceId);
|
|
108
|
-
if (entry.status
|
|
132
|
+
if (entry.status !== "idle") throw new SideChatError("Cannot change config while a run is active", "CONFLICT");
|
|
109
133
|
const modelRef = patch.modelRef === void 0 ? entry.config.modelRef : normalizeOptionalString(patch.modelRef);
|
|
110
134
|
if (!modelRef) throw new SideChatError("modelRef cannot be empty", "INVALID_REQUEST");
|
|
111
135
|
entry.config = {
|
|
112
136
|
modelRef,
|
|
113
137
|
thinkingLevel: patch.thinkingLevel === void 0 ? entry.config.thinkingLevel : patch.thinkingLevel
|
|
114
138
|
};
|
|
115
|
-
this.
|
|
116
|
-
return toView(entry);
|
|
139
|
+
return this.toView(entry);
|
|
117
140
|
}
|
|
118
141
|
heartbeat(id, clientInstanceId) {
|
|
142
|
+
const entry = this.requireEntry(id, clientInstanceId);
|
|
143
|
+
entry.lastSeenAt = new Date(this.now()).toISOString();
|
|
144
|
+
return this.toView(entry);
|
|
145
|
+
}
|
|
146
|
+
extend(id, clientInstanceId) {
|
|
119
147
|
const entry = this.requireEntry(id, clientInstanceId);
|
|
120
148
|
this.touchEntry(entry);
|
|
121
|
-
return toView(entry);
|
|
149
|
+
return this.toView(entry);
|
|
122
150
|
}
|
|
123
|
-
setStatus(id, clientInstanceId, status) {
|
|
151
|
+
setStatus(id, clientInstanceId, status, runId) {
|
|
124
152
|
const entry = this.requireEntry(id, clientInstanceId);
|
|
125
153
|
entry.status = status;
|
|
154
|
+
if (runId) entry.runId = runId;
|
|
155
|
+
if (status === "idle") entry.runId = void 0;
|
|
156
|
+
if (status === "idle" || status === "running") entry.clarification = void 0;
|
|
126
157
|
this.touchEntry(entry);
|
|
127
|
-
return toView(entry);
|
|
158
|
+
return this.toView(entry);
|
|
159
|
+
}
|
|
160
|
+
waitForInput(id, clientInstanceId, clarification, status = "waiting-input") {
|
|
161
|
+
this.setStatus(id, clientInstanceId, status);
|
|
162
|
+
this.requireEntry(id, clientInstanceId).clarification = clarification;
|
|
128
163
|
}
|
|
129
164
|
async dispose(id, clientInstanceId) {
|
|
130
165
|
const entry = this.entries.get(id);
|
|
131
|
-
if (!entry
|
|
166
|
+
if (!entry) {
|
|
167
|
+
const pending = this.disposals.get(id);
|
|
168
|
+
return pending?.clientInstanceId === clientInstanceId ? pending.promise : false;
|
|
169
|
+
}
|
|
170
|
+
if (entry.clientInstanceId !== clientInstanceId) return false;
|
|
132
171
|
entry.status = "closing";
|
|
133
|
-
await this.runBeforeDispose(id, clientInstanceId);
|
|
134
172
|
this.entries.delete(id);
|
|
135
|
-
|
|
136
|
-
|
|
173
|
+
const cleanup = (async () => {
|
|
174
|
+
try {
|
|
175
|
+
await this.runBeforeDispose(id, clientInstanceId);
|
|
176
|
+
await evictEmbeddedSessionRunner(entry.runtime.runtimeId, "side_chat_dispose");
|
|
177
|
+
return true;
|
|
178
|
+
} finally {
|
|
179
|
+
this.disposals.delete(id);
|
|
180
|
+
}
|
|
181
|
+
})();
|
|
182
|
+
this.disposals.set(id, {
|
|
183
|
+
clientInstanceId,
|
|
184
|
+
promise: cleanup
|
|
185
|
+
});
|
|
186
|
+
return cleanup;
|
|
137
187
|
}
|
|
138
188
|
async disposeClient(clientInstanceId) {
|
|
139
189
|
const ids = [...this.entries.values()].filter((entry) => entry.clientInstanceId === clientInstanceId).map((entry) => entry.id);
|
|
@@ -141,26 +191,69 @@ var EphemeralSideChatManager = class {
|
|
|
141
191
|
return ids.length;
|
|
142
192
|
}
|
|
143
193
|
async sweepExpired(at = this.now()) {
|
|
144
|
-
|
|
145
|
-
|
|
194
|
+
this.pruneExpiredRecords(at);
|
|
195
|
+
const expired = [...this.entries.values()].filter((entry) => this.isExpired(entry, at));
|
|
196
|
+
await Promise.all(expired.map((entry) => this.expireEntry(entry)));
|
|
146
197
|
return expired.length;
|
|
147
198
|
}
|
|
148
199
|
async disposeAll() {
|
|
149
200
|
if (this.sweepTimer) clearInterval(this.sweepTimer);
|
|
201
|
+
this.stopped = true;
|
|
150
202
|
const entries = [...this.entries.values()];
|
|
151
|
-
await Promise.all(entries.map((entry) => this.
|
|
152
|
-
this.
|
|
153
|
-
|
|
203
|
+
await Promise.all(entries.map((entry) => this.dispose(entry.id, entry.clientInstanceId)));
|
|
204
|
+
await Promise.all([...this.disposals.values()].map((entry) => entry.promise));
|
|
205
|
+
this.expired.clear();
|
|
154
206
|
}
|
|
155
207
|
requireEntry(id, clientInstanceId) {
|
|
156
208
|
const entry = this.entries.get(id);
|
|
157
|
-
if (
|
|
158
|
-
|
|
209
|
+
if (entry && entry.clientInstanceId !== clientInstanceId) throw new SideChatError("Side chat not found", "NOT_FOUND");
|
|
210
|
+
if (entry && this.isExpired(entry, this.now())) this.expireEntry(entry).catch((err) => log.warn({
|
|
211
|
+
err,
|
|
212
|
+
sideChatId: id
|
|
213
|
+
}, "Side chat expiry cleanup failed"));
|
|
214
|
+
else if (entry) return entry;
|
|
215
|
+
this.pruneExpiredRecords(this.now());
|
|
216
|
+
const expired = this.expired.get(id);
|
|
217
|
+
if (expired?.clientInstanceId === clientInstanceId) throw new SideChatError("Side chat expired", "EXPIRED", expired.reason);
|
|
218
|
+
throw new SideChatError("Side chat not found", "NOT_FOUND");
|
|
219
|
+
}
|
|
220
|
+
isExpired(entry, at) {
|
|
221
|
+
return entry.status !== "running" && entry.expiresAt !== null && Date.parse(entry.expiresAt) <= at;
|
|
222
|
+
}
|
|
223
|
+
expireEntry(entry) {
|
|
224
|
+
const reason = entry.status.startsWith("waiting-") ? "waiting" : "idle";
|
|
225
|
+
this.expired.set(entry.id, {
|
|
226
|
+
clientInstanceId: entry.clientInstanceId,
|
|
227
|
+
reason,
|
|
228
|
+
removeAt: this.now() + DEFAULT_IDLE_TTL_MS
|
|
229
|
+
});
|
|
230
|
+
this.pruneExpiredRecords(this.now());
|
|
231
|
+
const cleanup = this.dispose(entry.id, entry.clientInstanceId);
|
|
232
|
+
try {
|
|
233
|
+
this.options.onExpired?.(entry.id, entry.clientInstanceId, reason);
|
|
234
|
+
} catch (err) {
|
|
235
|
+
log.warn({
|
|
236
|
+
err,
|
|
237
|
+
sideChatId: entry.id
|
|
238
|
+
}, "Side chat expiry notification failed");
|
|
239
|
+
}
|
|
240
|
+
return cleanup;
|
|
241
|
+
}
|
|
242
|
+
pruneExpiredRecords(at) {
|
|
243
|
+
for (const [id, entry] of this.expired) if (entry.removeAt <= at) this.expired.delete(id);
|
|
244
|
+
while (this.expired.size > MAX_EXPIRED_RECORDS) this.expired.delete(this.expired.keys().next().value);
|
|
245
|
+
}
|
|
246
|
+
toView(entry) {
|
|
247
|
+
const { runtime: _runtime, ...view } = entry;
|
|
248
|
+
return structuredClone({
|
|
249
|
+
...view,
|
|
250
|
+
serverNow: new Date(this.now()).toISOString()
|
|
251
|
+
});
|
|
159
252
|
}
|
|
160
253
|
touchEntry(entry) {
|
|
161
254
|
const now = this.now();
|
|
162
255
|
entry.lastActiveAt = new Date(now).toISOString();
|
|
163
|
-
entry.expiresAt = new Date(now + this.idleTtlMs).toISOString();
|
|
256
|
+
entry.expiresAt = entry.status === "running" ? null : new Date(now + this.idleTtlMs).toISOString();
|
|
164
257
|
}
|
|
165
258
|
async runBeforeDispose(id, clientInstanceId) {
|
|
166
259
|
try {
|
|
@@ -174,10 +267,6 @@ var EphemeralSideChatManager = class {
|
|
|
174
267
|
}
|
|
175
268
|
}
|
|
176
269
|
};
|
|
177
|
-
function toView(entry) {
|
|
178
|
-
const { runtime: _runtime, ...view } = entry;
|
|
179
|
-
return structuredClone(view);
|
|
180
|
-
}
|
|
181
270
|
function normalizeOptionalString(value) {
|
|
182
271
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
183
272
|
}
|
|
@@ -16,6 +16,8 @@ export declare class SideChatRunService {
|
|
|
16
16
|
runId: string;
|
|
17
17
|
};
|
|
18
18
|
abort(sideChatId: string, clientInstanceId: string, runId?: string): Promise<boolean>;
|
|
19
|
+
/** Disposal has already removed the transcript from the public manager. */
|
|
20
|
+
cancelRun(sideChatId: string, clientInstanceId: string, runId?: string): Promise<boolean>;
|
|
19
21
|
dispose(sideChatId: string, clientInstanceId: string): Promise<boolean>;
|
|
20
22
|
submitClarification(sideChatId: string, clientInstanceId: string, requestId: string, answer: string): boolean;
|
|
21
23
|
private execute;
|
|
@@ -25,7 +25,7 @@ var SideChatRunService = class {
|
|
|
25
25
|
abortController: new AbortController()
|
|
26
26
|
};
|
|
27
27
|
this.activeBySideChat.set(sideChatId, run);
|
|
28
|
-
this.options.manager.setStatus(sideChatId, clientInstanceId, "running");
|
|
28
|
+
this.options.manager.setStatus(sideChatId, clientInstanceId, "running", run.runId);
|
|
29
29
|
this.execute(run, text, sideChat.config).catch((err) => {
|
|
30
30
|
log.error({
|
|
31
31
|
err,
|
|
@@ -37,9 +37,14 @@ var SideChatRunService = class {
|
|
|
37
37
|
}
|
|
38
38
|
async abort(sideChatId, clientInstanceId, runId) {
|
|
39
39
|
this.options.manager.get(sideChatId, clientInstanceId);
|
|
40
|
+
return this.cancelRun(sideChatId, clientInstanceId, runId);
|
|
41
|
+
}
|
|
42
|
+
/** Disposal has already removed the transcript from the public manager. */
|
|
43
|
+
async cancelRun(sideChatId, clientInstanceId, runId) {
|
|
40
44
|
const active = this.activeBySideChat.get(sideChatId);
|
|
41
|
-
if (!active || runId && active.runId !== runId) return false;
|
|
45
|
+
if (!active || active.clientInstanceId !== clientInstanceId || runId && active.runId !== runId) return false;
|
|
42
46
|
this.options.agentRunner.cancelClarificationForRun(active.runId);
|
|
47
|
+
this.options.agentRunner.unregisterExternalWebchatRun(active.executionSessionKey, active.runId);
|
|
43
48
|
active.abortController.abort();
|
|
44
49
|
await abortEmbeddedRun(active.executionSessionKey).catch(() => false);
|
|
45
50
|
return true;
|
|
@@ -49,8 +54,10 @@ var SideChatRunService = class {
|
|
|
49
54
|
return this.options.manager.dispose(sideChatId, clientInstanceId);
|
|
50
55
|
}
|
|
51
56
|
submitClarification(sideChatId, clientInstanceId, requestId, answer) {
|
|
52
|
-
this.options.manager.get(sideChatId, clientInstanceId);
|
|
53
|
-
|
|
57
|
+
if (this.options.manager.get(sideChatId, clientInstanceId).clarification?.requestId !== requestId) return false;
|
|
58
|
+
const handled = this.options.agentRunner.submitClarifyResponse(requestId, answer);
|
|
59
|
+
if (handled) this.options.manager.setStatus(sideChatId, clientInstanceId, "running");
|
|
60
|
+
return handled;
|
|
54
61
|
}
|
|
55
62
|
async execute(run, content, config) {
|
|
56
63
|
const topic = `run:${run.runId}`;
|
|
@@ -63,6 +70,12 @@ var SideChatRunService = class {
|
|
|
63
70
|
this.options.publishRealtime(topic, event.type, event);
|
|
64
71
|
};
|
|
65
72
|
const publishMapped = (event) => {
|
|
73
|
+
if (run.abortController.signal.aborted) return;
|
|
74
|
+
if (event.type === "clarify_request") this.options.manager.waitForInput(run.sideChatId, run.clientInstanceId, {
|
|
75
|
+
requestId: String(event.requestId),
|
|
76
|
+
question: String(event.question),
|
|
77
|
+
choices: Array.isArray(event.choices) ? event.choices.filter((choice) => typeof choice === "string") : void 0
|
|
78
|
+
}, event.kind === "approval" ? "waiting-approval" : "waiting-input");
|
|
66
79
|
for (const mapped of mapper.map(event)) publish(mapped);
|
|
67
80
|
};
|
|
68
81
|
try {
|
|
@@ -75,7 +88,17 @@ var SideChatRunService = class {
|
|
|
75
88
|
timestamp: Date.now()
|
|
76
89
|
}
|
|
77
90
|
});
|
|
78
|
-
this.options.agentRunner.registerExternalWebchatRun(run.executionSessionKey, run.runId, (event) => publishMapped(event)
|
|
91
|
+
this.options.agentRunner.registerExternalWebchatRun(run.executionSessionKey, run.runId, (event) => publishMapped(event), {
|
|
92
|
+
clarificationTimeoutMs: null,
|
|
93
|
+
beforeClarificationResponse: () => {
|
|
94
|
+
try {
|
|
95
|
+
this.options.manager.setStatus(run.sideChatId, run.clientInstanceId, "running");
|
|
96
|
+
return true;
|
|
97
|
+
} catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
79
102
|
const result = await this.options.getAgentService().runEphemeralTurn({
|
|
80
103
|
executionSessionKey: run.executionSessionKey,
|
|
81
104
|
parentSessionKey: this.options.manager.get(run.sideChatId, run.clientInstanceId).parentSessionKey,
|
|
@@ -48,7 +48,15 @@ export interface SideChatView {
|
|
|
48
48
|
status: SideChatStatus;
|
|
49
49
|
createdAt: string;
|
|
50
50
|
lastActiveAt: string;
|
|
51
|
-
|
|
51
|
+
lastSeenAt: string;
|
|
52
|
+
expiresAt: string | null;
|
|
53
|
+
serverNow?: string;
|
|
54
|
+
runId?: string;
|
|
55
|
+
clarification?: {
|
|
56
|
+
requestId: string;
|
|
57
|
+
question: string;
|
|
58
|
+
choices?: string[];
|
|
59
|
+
};
|
|
52
60
|
messageCount: number;
|
|
53
61
|
context: SideChatContextSnapshot;
|
|
54
62
|
config: SideChatConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
2
3
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
3
4
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -21,7 +21,5 @@ export declare class ConnectedKnowledgePipeline {
|
|
|
21
21
|
private readonly batchSize;
|
|
22
22
|
constructor(options: ConnectedKnowledgePipelineOptions);
|
|
23
23
|
processPending(sourceInstanceId?: string): Promise<KnowledgeSynthesisBatchResult>;
|
|
24
|
-
/** Remove bounded raw items and every content-bearing memory derived only from them. */
|
|
25
24
|
pruneBoundedRetention(sourceInstanceId: string, olderThanMs: number): ConnectedKnowledgePruneResult;
|
|
26
|
-
private rebuildDailySummary;
|
|
27
25
|
}
|