@xopcai/xopc 0.0.188 → 0.0.190
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/README.md +1 -4
- package/README.zh-CN.md +0 -3
- 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--QoUGhiS.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
- package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
- package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
- package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
- package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
- package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DdBlibek.js → product-open-page-Dc9CcWdu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Dzxlq1F0.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
- package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
- package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.js +11 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
- package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
- package/dist/packages/realtime-client/src/index.js +256 -0
- package/dist/packages/realtime-protocol/src/index.js +88 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
- package/dist/src/agent/background-review/run-background-review.js +10 -9
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
- package/dist/src/agent/bootstrap/types.d.ts +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +1 -1
- package/dist/src/agent/context/workspace-templates/SOUL.md +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/index.d.ts +4 -5
- package/dist/src/agent/external-tools/index.js +8 -2
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +2 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
- package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
- package/dist/src/agent/memory/builtin-provider.d.ts +2 -4
- package/dist/src/agent/memory/builtin-provider.js +35 -15
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -0
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +9 -1
- package/dist/src/agent/memory/manager.js +39 -9
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/source-origin.js +0 -2
- package/dist/src/agent/memory/types.d.ts +5 -1
- package/dist/src/agent/memory/understanding/service.d.ts +10 -10
- package/dist/src/agent/memory/understanding/service.js +108 -176
- package/dist/src/agent/memory/understanding/types.d.ts +7 -8
- package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
- package/dist/src/agent/memory/user-context-coordinator.js +27 -41
- package/dist/src/agent/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -7
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js +0 -10
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
- package/dist/src/agent/prompt/system-prompt.js +1 -2
- package/dist/src/agent/service/async-queue.d.ts +1 -1
- package/dist/src/agent/service/async-queue.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service.d.ts +2 -3
- package/dist/src/agent/service.js +10 -21
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/index.d.ts +1 -1
- package/dist/src/agent/session/session-context.d.ts +2 -0
- package/dist/src/agent/session/session-context.js +4 -0
- package/dist/src/agent/session/session-state-bag.d.ts +4 -4
- package/dist/src/agent/session/session-state-bag.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
- package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
- package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
- package/dist/src/agent/tools/dreaming-tool.d.ts +0 -2
- package/dist/src/agent/tools/dreaming-tool.js +13 -38
- package/dist/src/agent/tools/factory.d.ts +4 -3
- package/dist/src/agent/tools/factory.js +2 -10
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
- package/dist/src/agent/workspace-runtime/registry.js +2 -15
- package/dist/src/agent-manifest/schema.d.ts +17 -17
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +29 -29
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/init.js +3 -22
- package/dist/src/cli/templates.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/paths.d.ts +0 -5
- package/dist/src/config/paths.js +2 -11
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +27 -122
- package/dist/src/config/schema.js +9 -42
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/learning-coordinator.js +75 -3
- package/dist/src/endpoint-tools/auth.d.ts +20 -0
- package/dist/src/endpoint-tools/auth.js +51 -0
- package/dist/src/endpoint-tools/index.d.ts +5 -0
- package/dist/src/endpoint-tools/index.js +6 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
- package/dist/src/endpoint-tools/invocation-service.js +190 -0
- package/dist/src/endpoint-tools/policy.d.ts +10 -0
- package/dist/src/endpoint-tools/policy.js +18 -0
- package/dist/src/endpoint-tools/registry.d.ts +45 -0
- package/dist/src/endpoint-tools/registry.js +121 -0
- package/dist/src/endpoint-tools/runtime.d.ts +23 -0
- package/dist/src/endpoint-tools/runtime.js +86 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
- package/dist/src/endpoint-tools/upload-service.js +103 -0
- package/dist/src/extensions/types/hooks.d.ts +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +0 -5
- package/dist/src/gateway/agents-admin.d.ts +0 -7
- package/dist/src/gateway/agents-admin.js +3 -32
- package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/heartbeat/service.js +4 -1
- package/dist/src/gateway/hono/app.js +1 -5
- package/dist/src/gateway/hono/index.d.ts +0 -1
- package/dist/src/gateway/hono/index.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +20 -9
- package/dist/src/gateway/hono/lib/config-payload.js +3 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +17 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/agents.js +1 -33
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +17 -1
- package/dist/src/gateway/hono/routes/connectors.js +13 -12
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
- package/dist/src/gateway/hono/routes/realtime.js +35 -0
- package/dist/src/gateway/hono/routes/status.js +0 -7
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -31
- package/dist/src/gateway/hono/routes/you.js +230 -1161
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +1 -2
- package/dist/src/gateway/protocol.d.ts +1 -7
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/security/operator-scopes.js +1 -1
- package/dist/src/gateway/server.js +4 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -9
- package/dist/src/gateway/service/agent-runner.js +18 -18
- package/dist/src/gateway/service/config-coordinator.d.ts +3 -3
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +15 -17
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service/types.d.ts +0 -5
- package/dist/src/gateway/service.d.ts +7 -6
- package/dist/src/gateway/service.js +43 -26
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
- package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/people-graph.d.ts +22 -25
- package/dist/src/knowledge/people-graph.js +76 -43
- package/dist/src/mcp/channel-bridge.d.ts +6 -9
- package/dist/src/mcp/channel-bridge.js +48 -76
- package/dist/src/mcp/channel-server.js +2 -6
- package/dist/src/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +31 -0
- package/dist/src/realtime/broker.js +114 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +263 -0
- package/dist/src/realtime/tickets.d.ts +15 -0
- package/dist/src/realtime/tickets.js +38 -0
- package/dist/src/realtime/writer.d.ts +15 -0
- package/dist/src/realtime/writer.js +78 -0
- package/dist/src/share/share-config.js +0 -1
- package/dist/src/share/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
- package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
- package/dist/src/storage/sqlite/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +6 -6
- package/dist/src/storage/sqlite/index.js +7 -7
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
- package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +54 -0
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -20
- package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -3
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
- package/dist/src/storage/sqlite/user-context-repository.js +383 -0
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -2
- package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
- package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
- package/dist/src/tui/tool-summary.js +1 -7
- package/dist/src/tui/tui-agent-events.d.ts +0 -1
- package/dist/src/tui/tui-agent-events.js +2 -15
- package/dist/src/tui/tui-backend.d.ts +4 -4
- package/dist/src/tui/tui-run-state.js +0 -4
- package/dist/src/tui/tui-startup-resources.js +1 -2
- package/dist/src/tui/tui-types.d.ts +2 -9
- package/dist/src/tui/tui-types.js +0 -1
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/config.d.ts +17 -210
- package/dist/src/user-context/config.js +19 -85
- package/dist/src/user-context/consolidation.d.ts +26 -0
- package/dist/src/user-context/consolidation.js +115 -0
- package/dist/src/user-context/domain.d.ts +75 -0
- package/dist/src/user-context/domain.js +4 -0
- package/dist/src/user-context/manual-understanding.d.ts +7 -14
- package/dist/src/user-context/manual-understanding.js +19 -49
- package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
- package/dist/src/user-context/planner.js +311 -0
- package/dist/src/user-context/relationship-continuity.d.ts +3 -6
- package/dist/src/user-context/relationship-continuity.js +39 -32
- package/dist/src/user-context/sources/catalog.d.ts +2 -0
- package/dist/src/user-context/sources/catalog.js +149 -0
- package/dist/src/user-context/sources/index.d.ts +3 -0
- package/dist/src/user-context/sources/index.js +3 -0
- package/dist/src/user-context/sources/repository.d.ts +40 -0
- package/dist/src/user-context/sources/repository.js +164 -0
- package/dist/src/user-context/sources/types.d.ts +83 -0
- package/dist/src/user-context/understandingQuality.d.ts +5 -0
- package/dist/src/user-context/understandingQuality.js +44 -0
- package/dist/src/utils/logger/log-stream.d.ts +3 -10
- package/dist/src/utils/logger/log-stream.js +2 -73
- package/dist/src/utils/logger/pino-record.d.ts +1 -1
- package/dist/src/utils/logger/streams.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +4 -3
- package/dist/src/work-discovery/analyzer.js +21 -16
- package/dist/src/work-discovery/incremental-repository.js +42 -40
- package/dist/src/work-discovery/index.js +3 -3
- package/dist/src/work-discovery/service.d.ts +7 -7
- package/dist/src/work-discovery/service.js +241 -190
- package/dist/src/work-discovery/source-repository.js +42 -53
- package/dist/src/work-discovery/types.d.ts +2 -14
- package/package.json +5 -7
- package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-Dn-7MMEo.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-TRr9ybf6.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
- package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-D6hs74o5.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-zxo5ZGOu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-5aVSjTjO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
- package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
- package/dist/src/agent/code-intelligence/binary.js +0 -372
- package/dist/src/agent/code-intelligence/index.d.ts +0 -4
- package/dist/src/agent/code-intelligence/index.js +0 -4
- package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
- package/dist/src/agent/code-intelligence/runtime.js +0 -280
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
- package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
- package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
- package/dist/src/agent/code-intelligence/tools.js +0 -266
- package/dist/src/agent/code-intelligence/types.d.ts +0 -22
- package/dist/src/agent/memory/context/planner.js +0 -286
- package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
- package/dist/src/agent/memory/dreaming/config.js +0 -98
- package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
- package/dist/src/agent/memory/dreaming/constants.js +0 -18
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
- package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/preview.js +0 -52
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
- package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
- package/dist/src/agent/memory/dreaming/runner.js +0 -78
- package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/schedule.js +0 -38
- package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
- package/dist/src/agent/memory/dreaming/scope.js +0 -33
- package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
- package/dist/src/agent/memory/dreaming/utils.js +0 -31
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- package/dist/src/gateway/agent-run-relay.d.ts +0 -19
- package/dist/src/gateway/agent-run-relay.js +0 -169
- package/dist/src/gateway/hono/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- package/dist/src/gateway/hono/sse.d.ts +0 -53
- package/dist/src/gateway/hono/sse.js +0 -207
- package/dist/src/gateway/service/sse-hub.d.ts +0 -10
- package/dist/src/gateway/service/sse-hub.js +0 -53
- package/dist/src/storage/sqlite/dreaming-repository.d.ts +0 -61
- package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
- package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
- package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
- package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
- package/dist/src/user-context/context-compiler.d.ts +0 -27
- package/dist/src/user-context/context-compiler.js +0 -48
- package/dist/src/user-context/import.d.ts +0 -12
- package/dist/src/user-context/import.js +0 -51
- package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
- package/dist/src/user-context/memory-episode-evaluator.js +0 -35
- package/dist/src/user-context/memory-readiness.d.ts +0 -33
- package/dist/src/user-context/memory-readiness.js +0 -41
- package/dist/src/user-context/memory-use-audit.d.ts +0 -10
- package/dist/src/user-context/memory-use-audit.js +0 -26
- package/dist/src/user-context/personal-playbook.d.ts +0 -11
- package/dist/src/user-context/personal-playbook.js +0 -41
- package/dist/src/user-context/profile.d.ts +0 -37
- package/dist/src/user-context/profile.js +0 -163
- package/dist/src/user-context/projection.d.ts +0 -120
- package/dist/src/user-context/projection.js +0 -262
- package/dist/src/user-context/source-recommendations.d.ts +0 -13
- package/dist/src/user-context/source-recommendations.js +0 -85
- /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
|
@@ -1,100 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { resolveDreamingAgentScope } from "../agent/memory/dreaming/scope.js";
|
|
1
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
+
import { USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID, USER_CONTEXT_CONSOLIDATION_TOKEN, compileContextConsolidationCron, resolveContextConsolidationConfig } from "../user-context/consolidation.js";
|
|
4
3
|
//#region src/gateway/dreaming-automation-reconciler.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
phase: "rem",
|
|
18
|
-
name: DREAMING_REM_AUTOMATION_NAME,
|
|
19
|
-
token: DREAMING_REM_SWEEP_TOKEN
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
function phaseDescription(phase) {
|
|
23
|
-
return `${phase === "light" ? "Light sweep" : phase === "deep" ? "Deep promotion" : "REM pattern discovery"} for memory dreaming. ${DREAMING_AUTOMATION_TAG}`;
|
|
24
|
-
}
|
|
25
|
-
function buildTrigger(config, phase) {
|
|
26
|
-
const phaseConfig = config.phases[phase];
|
|
27
|
-
return {
|
|
4
|
+
init_agent_scope();
|
|
5
|
+
async function reconcileDreamingAutomations(params) {
|
|
6
|
+
const result = {
|
|
7
|
+
created: false,
|
|
8
|
+
updated: false,
|
|
9
|
+
disabled: false
|
|
10
|
+
};
|
|
11
|
+
const resolved = resolveContextConsolidationConfig(params.config);
|
|
12
|
+
const agentId = normalizeAgentId(resolveDefaultAgentId(params.config));
|
|
13
|
+
const workingDirectory = resolveAgentWorkspaceDir(params.config, agentId);
|
|
14
|
+
const trigger = {
|
|
28
15
|
kind: "schedule",
|
|
29
16
|
schedule: {
|
|
30
17
|
kind: "cron",
|
|
31
|
-
expr:
|
|
32
|
-
tz:
|
|
18
|
+
expr: compileContextConsolidationCron(resolved.time),
|
|
19
|
+
tz: resolved.timezone
|
|
33
20
|
}
|
|
34
21
|
};
|
|
35
|
-
|
|
36
|
-
function dreamingAutomationId(phase) {
|
|
37
|
-
return `system-user-context-dreaming:${phase}`;
|
|
38
|
-
}
|
|
39
|
-
function buildAction(scope, token) {
|
|
40
|
-
return {
|
|
22
|
+
const action = {
|
|
41
23
|
kind: "agent",
|
|
42
|
-
agentId
|
|
43
|
-
instruction:
|
|
44
|
-
workingDirectory
|
|
45
|
-
timeoutSeconds:
|
|
24
|
+
agentId,
|
|
25
|
+
instruction: USER_CONTEXT_CONSOLIDATION_TOKEN,
|
|
26
|
+
workingDirectory,
|
|
27
|
+
timeoutSeconds: 300
|
|
46
28
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { config, automationService } = params;
|
|
53
|
-
const result = {
|
|
54
|
-
created: [],
|
|
55
|
-
updated: [],
|
|
56
|
-
disabled: []
|
|
57
|
-
};
|
|
58
|
-
const scope = resolveDreamingAgentScope(config);
|
|
59
|
-
const resolved = scope.config;
|
|
60
|
-
for (const spec of DREAMING_AUTOMATIONS) {
|
|
61
|
-
const id = dreamingAutomationId(spec.phase);
|
|
62
|
-
const current = await automationService.get(id);
|
|
63
|
-
const enabled = resolved.enabled && resolved.phases[spec.phase].enabled;
|
|
64
|
-
if (!resolved.enabled) {
|
|
65
|
-
if (current?.enabled) {
|
|
66
|
-
await automationService.update(id, { enabled: false });
|
|
67
|
-
result.disabled.push(id);
|
|
68
|
-
}
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const next = {
|
|
72
|
-
name: spec.name,
|
|
73
|
-
description: phaseDescription(spec.phase),
|
|
74
|
-
enabled,
|
|
75
|
-
trigger: buildTrigger(resolved, spec.phase),
|
|
76
|
-
action: buildAction(scope, spec.token)
|
|
77
|
-
};
|
|
78
|
-
if (!current) {
|
|
79
|
-
await automationService.create({
|
|
80
|
-
id,
|
|
81
|
-
...next,
|
|
82
|
-
safety: { mode: "auto_apply" },
|
|
83
|
-
afterRun: { kind: "none" },
|
|
84
|
-
reliability: { disableAfterConsecutiveFailures: 3 }
|
|
85
|
-
});
|
|
86
|
-
result.created.push(id);
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (automationNeedsUpdate(current, next)) {
|
|
90
|
-
await automationService.update(id, {
|
|
91
|
-
...next,
|
|
92
|
-
safety: { mode: "auto_apply" },
|
|
93
|
-
afterRun: { kind: "none" },
|
|
94
|
-
reliability: { disableAfterConsecutiveFailures: 3 }
|
|
95
|
-
});
|
|
96
|
-
result.updated.push(id);
|
|
29
|
+
const current = await params.automationService.get(USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID);
|
|
30
|
+
if (!resolved.enabled) {
|
|
31
|
+
if (current?.enabled) {
|
|
32
|
+
await params.automationService.update(USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID, { enabled: false });
|
|
33
|
+
result.disabled = true;
|
|
97
34
|
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
const next = {
|
|
38
|
+
name: "User context review",
|
|
39
|
+
description: "Deterministically review structured user understanding for expiry and sufficient evidence.",
|
|
40
|
+
enabled: true,
|
|
41
|
+
trigger,
|
|
42
|
+
action,
|
|
43
|
+
safety: { mode: "auto_apply" },
|
|
44
|
+
afterRun: { kind: "none" },
|
|
45
|
+
reliability: { disableAfterConsecutiveFailures: 3 }
|
|
46
|
+
};
|
|
47
|
+
if (!current) {
|
|
48
|
+
await params.automationService.create({
|
|
49
|
+
id: USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID,
|
|
50
|
+
...next
|
|
51
|
+
});
|
|
52
|
+
result.created = true;
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
if (current.name !== next.name || current.description !== next.description || !current.enabled || JSON.stringify(current.trigger) !== JSON.stringify(trigger) || JSON.stringify(current.action) !== JSON.stringify(action) || current.safety?.mode !== "auto_apply" || current.afterRun?.kind !== "none" || current.reliability?.disableAfterConsecutiveFailures !== 3) {
|
|
56
|
+
await params.automationService.update(USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID, next);
|
|
57
|
+
result.updated = true;
|
|
98
58
|
}
|
|
99
59
|
return result;
|
|
100
60
|
}
|
|
@@ -138,7 +138,10 @@ var HeartbeatService = class {
|
|
|
138
138
|
}
|
|
139
139
|
let reply;
|
|
140
140
|
try {
|
|
141
|
-
reply = await this.deps.agentService.turnDispatcher.processDirect(prompt, sessionKey
|
|
141
|
+
reply = await this.deps.agentService.turnDispatcher.processDirect(prompt, sessionKey, {
|
|
142
|
+
type: "system",
|
|
143
|
+
source: "heartbeat"
|
|
144
|
+
});
|
|
142
145
|
} catch (error) {
|
|
143
146
|
log.error({ err: error }, "Heartbeat: agent call failed");
|
|
144
147
|
return;
|
|
@@ -223,11 +223,7 @@ function createHonoApp(config) {
|
|
|
223
223
|
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
224
224
|
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
225
225
|
}) }),
|
|
226
|
-
channelRateLimitMiddleware
|
|
227
|
-
sseConfig: {
|
|
228
|
-
service,
|
|
229
|
-
maxSseConnections: service.currentConfig.gateway.maxSseConnections
|
|
230
|
-
}
|
|
226
|
+
channelRateLimitMiddleware
|
|
231
227
|
});
|
|
232
228
|
const prewarm = prewarmStaticUiCache();
|
|
233
229
|
if (prewarm.loaded > 0) log.debug({
|
|
@@ -66,7 +66,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
66
66
|
};
|
|
67
67
|
tools: {
|
|
68
68
|
builtin?: Record<string, {
|
|
69
|
-
mode: "allow" | "
|
|
69
|
+
mode: "allow" | "deny" | "confirm";
|
|
70
70
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
71
71
|
limits?: {
|
|
72
72
|
maxCallsPerTurn?: number;
|
|
@@ -75,7 +75,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
75
75
|
}>;
|
|
76
76
|
mcp?: {
|
|
77
77
|
servers?: Record<string, {
|
|
78
|
-
mode: "allow" | "
|
|
78
|
+
mode: "allow" | "deny" | "confirm";
|
|
79
79
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
80
80
|
limits?: {
|
|
81
81
|
maxCallsPerTurn?: number;
|
|
@@ -83,7 +83,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
83
83
|
};
|
|
84
84
|
}>;
|
|
85
85
|
tools?: Record<string, {
|
|
86
|
-
mode: "allow" | "
|
|
86
|
+
mode: "allow" | "deny" | "confirm";
|
|
87
87
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
88
88
|
limits?: {
|
|
89
89
|
maxCallsPerTurn?: number;
|
|
@@ -143,7 +143,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
143
143
|
};
|
|
144
144
|
tools?: {
|
|
145
145
|
builtin?: Record<string, {
|
|
146
|
-
mode: "allow" | "
|
|
146
|
+
mode: "allow" | "deny" | "confirm";
|
|
147
147
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
148
148
|
limits?: {
|
|
149
149
|
maxCallsPerTurn?: number;
|
|
@@ -152,7 +152,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
152
152
|
}>;
|
|
153
153
|
mcp?: {
|
|
154
154
|
servers?: Record<string, {
|
|
155
|
-
mode: "allow" | "
|
|
155
|
+
mode: "allow" | "deny" | "confirm";
|
|
156
156
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
157
157
|
limits?: {
|
|
158
158
|
maxCallsPerTurn?: number;
|
|
@@ -160,7 +160,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
160
160
|
};
|
|
161
161
|
}>;
|
|
162
162
|
tools?: Record<string, {
|
|
163
|
-
mode: "allow" | "
|
|
163
|
+
mode: "allow" | "deny" | "confirm";
|
|
164
164
|
scope?: "workspace" | "readonly" | "unrestricted";
|
|
165
165
|
limits?: {
|
|
166
166
|
maxCallsPerTurn?: number;
|
|
@@ -209,7 +209,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
209
209
|
/** Masked `cfg.providers` for capability keys (image / STT / etc.). */
|
|
210
210
|
providersConfig: Record<string, import("./safe-providers-config.js").SafeProviderAuthEntry>;
|
|
211
211
|
gateway: {
|
|
212
|
-
bind: "
|
|
212
|
+
bind: "custom" | "auto" | "loopback" | "lan" | "tailnet";
|
|
213
213
|
customBindHost: string;
|
|
214
214
|
port: number;
|
|
215
215
|
corsOrigins: string[];
|
|
@@ -255,7 +255,6 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
255
255
|
webchat: {
|
|
256
256
|
activityDetailDefault: "stream" | "on" | "off";
|
|
257
257
|
};
|
|
258
|
-
maxSseConnections: number;
|
|
259
258
|
channelConnectDeferMode: "explicit" | "off" | "auto";
|
|
260
259
|
channelConnectDeferIds: string[];
|
|
261
260
|
channelConnectDeferSkipIds: string[];
|
|
@@ -291,6 +290,18 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
291
290
|
preferences: {
|
|
292
291
|
responseLanguage: "auto" | "zh-CN" | "en";
|
|
293
292
|
};
|
|
293
|
+
dreaming: {
|
|
294
|
+
mode: "off" | "review";
|
|
295
|
+
schedule: {
|
|
296
|
+
time: string;
|
|
297
|
+
};
|
|
298
|
+
minEvidenceSources: number;
|
|
299
|
+
limit: number;
|
|
300
|
+
timezone?: string;
|
|
301
|
+
};
|
|
302
|
+
privacy: {
|
|
303
|
+
sensitiveWritePolicy: "allow" | "deny" | "confirm";
|
|
304
|
+
};
|
|
294
305
|
memory: {
|
|
295
306
|
retention: {
|
|
296
307
|
compaction: {
|
|
@@ -346,7 +357,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
346
357
|
language?: "en" | "zh";
|
|
347
358
|
input?: {
|
|
348
359
|
refinement?: {
|
|
349
|
-
mode: "off" | "
|
|
360
|
+
mode: "off" | "custom" | "punctuation" | "light";
|
|
350
361
|
model?: string;
|
|
351
362
|
customInstruction?: string;
|
|
352
363
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextCompactionPolicySchema, init_config } from "../../../user-context/config.js";
|
|
1
|
+
import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../user-context/config.js";
|
|
2
2
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
3
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
4
4
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
@@ -166,7 +166,6 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
166
166
|
activeHours: config.gateway?.heartbeat?.activeHours
|
|
167
167
|
},
|
|
168
168
|
webchat: { activityDetailDefault: config.gateway?.webchat?.activityDetailDefault ?? "on" },
|
|
169
|
-
maxSseConnections: typeof config.gateway?.maxSseConnections === "number" ? config.gateway.maxSseConnections : 100,
|
|
170
169
|
channelConnectDeferMode: config.gateway?.channelConnectDeferMode ?? "auto",
|
|
171
170
|
channelConnectDeferIds: Array.isArray(config.gateway?.channelConnectDeferIds) ? config.gateway.channelConnectDeferIds : [],
|
|
172
171
|
channelConnectDeferSkipIds: Array.isArray(config.gateway?.channelConnectDeferSkipIds) ? config.gateway.channelConnectDeferSkipIds : [],
|
|
@@ -179,6 +178,8 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
179
178
|
session: resolveSessionConfigForWeb(config),
|
|
180
179
|
userContext: {
|
|
181
180
|
preferences: config.userContext?.preferences ?? { responseLanguage: "auto" },
|
|
181
|
+
dreaming: UserContextDreamingSchema.parse(config.userContext?.dreaming),
|
|
182
|
+
privacy: UserContextPrivacySchema.parse(config.userContext?.privacy),
|
|
182
183
|
memory: { retention: { compaction: ContextCompactionPolicySchema.parse(config.userContext?.memory.retention?.compaction) } }
|
|
183
184
|
},
|
|
184
185
|
tui: { defaultAgent: config.tui?.defaultAgent ?? "coder" },
|
|
@@ -29,18 +29,16 @@ function extractTokenFromHeader(authHeader) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* SECURITY: query-string tokens leak into server logs, Referer headers, and
|
|
32
|
-
* browser history. We accept them only
|
|
33
|
-
* be set
|
|
34
|
-
*
|
|
32
|
+
* browser history. We accept them only for agent avatar `<img>` loads, where an
|
|
33
|
+
* Authorization header cannot be set. Realtime WebSocket authentication uses a
|
|
34
|
+
* one-time ticket acquired over authenticated HTTP.
|
|
35
35
|
*/
|
|
36
36
|
function extractTokenFromQuery(url) {
|
|
37
37
|
return new URL(url).searchParams.get("token");
|
|
38
38
|
}
|
|
39
|
-
const QUERY_TOKEN_ALLOWED_PATHS = new Set(["/api/events", "/api/ws"]);
|
|
40
39
|
const AGENT_AVATAR_GET_PATH = /^\/api\/agents\/[^/]+\/avatar$/;
|
|
41
40
|
/** Exported for gateway security tests. */
|
|
42
41
|
function isQueryTokenAllowedPath(path, method) {
|
|
43
|
-
if (QUERY_TOKEN_ALLOWED_PATHS.has(path) || path.startsWith("/api/events")) return true;
|
|
44
42
|
if (method === "GET" && AGENT_AVATAR_GET_PATH.test(path)) return true;
|
|
45
43
|
return false;
|
|
46
44
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { Hono } from 'hono';
|
|
9
9
|
import type { GatewayService } from '../service.js';
|
|
10
10
|
import { type OAuthCredentials } from '../../auth/oauth/types.js';
|
|
11
|
+
export declare function refreshModelCatalogAfterOAuth(provider: string, service: Pick<GatewayService, 'getModelCatalogSync'>): Promise<void>;
|
|
11
12
|
export declare function resolveOAuthLoginMethodPreference(params: {
|
|
12
13
|
requestedMethod?: unknown;
|
|
13
14
|
supportedMethods?: readonly string[];
|
|
@@ -17,6 +17,19 @@ init_registry();
|
|
|
17
17
|
init_credentials();
|
|
18
18
|
init_logger();
|
|
19
19
|
const log = createLogger("OAuthAsync");
|
|
20
|
+
async function refreshModelCatalogAfterOAuth(provider, service) {
|
|
21
|
+
if (provider !== "xopc-cloud") return;
|
|
22
|
+
try {
|
|
23
|
+
await service.getModelCatalogSync().refreshNow();
|
|
24
|
+
} catch (err) {
|
|
25
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
26
|
+
log.warn({
|
|
27
|
+
err,
|
|
28
|
+
provider,
|
|
29
|
+
errorMessage
|
|
30
|
+
}, `OAuth completed, but the model catalog could not be refreshed: ${errorMessage}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
20
33
|
/** User-facing message when undici/fetch fails (often DNS, firewall, or wrong machine for localhost callback). */
|
|
21
34
|
function formatOAuthAsyncError(err) {
|
|
22
35
|
const base = err instanceof Error ? err.message : "OAuth login failed";
|
|
@@ -200,7 +213,7 @@ function createOAuthAsyncHandler(service) {
|
|
|
200
213
|
/**
|
|
201
214
|
* Run OAuth flow in background
|
|
202
215
|
*/
|
|
203
|
-
async function runOAuthFlow(session, oauthProvider,
|
|
216
|
+
async function runOAuthFlow(session, oauthProvider, service) {
|
|
204
217
|
const abortController = new AbortController();
|
|
205
218
|
session.abortController = abortController;
|
|
206
219
|
let manualCodePromise = null;
|
|
@@ -276,6 +289,8 @@ async function runOAuthFlow(session, oauthProvider, _service) {
|
|
|
276
289
|
const credentials = await oauthProvider.login(callbacks);
|
|
277
290
|
setOAuthCredentialsToCache(session.provider, credentials);
|
|
278
291
|
await new CredentialResolver().saveOAuthCredentials(session.provider, credentials);
|
|
292
|
+
session.message = session.provider === "xopc-cloud" ? "OAuth login successful. Syncing available models..." : "OAuth login successful";
|
|
293
|
+
await refreshModelCatalogAfterOAuth(session.provider, service);
|
|
279
294
|
session.status = "completed";
|
|
280
295
|
session.credentials = credentials;
|
|
281
296
|
session.message = "OAuth login successful";
|
|
@@ -313,4 +328,4 @@ function deleteOAuthCredentialsFromCache(provider) {
|
|
|
313
328
|
oauthCredentialsCache.delete(provider);
|
|
314
329
|
}
|
|
315
330
|
//#endregion
|
|
316
|
-
export { createOAuthAsyncHandler, deleteOAuthCredentialsFromCache, getOAuthCredentialsFromCache, resolveOAuthLoginMethodPreference, setOAuthCredentialsToCache };
|
|
331
|
+
export { createOAuthAsyncHandler, deleteOAuthCredentialsFromCache, getOAuthCredentialsFromCache, refreshModelCatalogAfterOAuth, resolveOAuthLoginMethodPreference, setOAuthCredentialsToCache };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { endpointTurnClaimSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
1
2
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
2
|
-
import { createAgentResumeHandler, createEventsSSEHandler, createSendHandler } from "../sse.js";
|
|
3
3
|
//#region src/gateway/hono/routes/agent-stream.ts
|
|
4
4
|
function registerAgentStreamRoutes(authenticated, deps) {
|
|
5
|
-
const { service, chatRateLimitMiddleware
|
|
6
|
-
authenticated.post("/api/agent/resume", chatRateLimitMiddleware, createAgentResumeHandler(sseConfig));
|
|
5
|
+
const { service, chatRateLimitMiddleware } = deps;
|
|
7
6
|
authenticated.post("/api/agent/abort", chatRateLimitMiddleware, async (c) => {
|
|
8
7
|
const body = await c.req.json().catch(() => null);
|
|
9
8
|
const runId = body && typeof body === "object" && typeof body.runId === "string" ? body.runId.trim() : "";
|
|
@@ -70,13 +69,32 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
70
69
|
message: "Missing delivery"
|
|
71
70
|
}
|
|
72
71
|
}, 400);
|
|
72
|
+
const origin = endpointTurnClaimSchema.safeParse(body.origin);
|
|
73
|
+
if (!origin.success) return c.json({
|
|
74
|
+
ok: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: "BAD_REQUEST",
|
|
77
|
+
message: "Invalid endpoint origin"
|
|
78
|
+
}
|
|
79
|
+
}, 400);
|
|
80
|
+
if (!service.endpointTools.registry.verifyTurnClaim(origin.data.endpointId, origin.data.token)) return c.json({
|
|
81
|
+
ok: false,
|
|
82
|
+
error: {
|
|
83
|
+
code: "INVALID_ENDPOINT",
|
|
84
|
+
message: "Endpoint connection is not active"
|
|
85
|
+
}
|
|
86
|
+
}, 401);
|
|
73
87
|
const result = await service.submitSessionInput({
|
|
74
88
|
sessionKey,
|
|
75
89
|
clientMessageId: typeof body.clientMessageId === "string" ? body.clientMessageId : "",
|
|
76
90
|
delivery,
|
|
77
91
|
content,
|
|
78
92
|
attachments,
|
|
79
|
-
thinking: typeof body.thinking === "string" ? body.thinking : void 0
|
|
93
|
+
thinking: typeof body.thinking === "string" ? body.thinking : void 0,
|
|
94
|
+
origin: {
|
|
95
|
+
type: "endpoint",
|
|
96
|
+
endpointId: origin.data.endpointId
|
|
97
|
+
}
|
|
80
98
|
});
|
|
81
99
|
if (result.ok === false) return c.json({
|
|
82
100
|
ok: false,
|
|
@@ -195,8 +213,33 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
195
213
|
payload: { received: true }
|
|
196
214
|
});
|
|
197
215
|
});
|
|
198
|
-
authenticated.post("/api/send", chatRateLimitMiddleware,
|
|
199
|
-
|
|
216
|
+
authenticated.post("/api/send", chatRateLimitMiddleware, async (c) => {
|
|
217
|
+
const body = await c.req.json().catch(() => null);
|
|
218
|
+
const channel = typeof body?.channel === "string" ? body.channel : "";
|
|
219
|
+
const chatId = typeof body?.chatId === "string" ? body.chatId : "";
|
|
220
|
+
const content = typeof body?.content === "string" ? body.content : "";
|
|
221
|
+
if (!channel || !chatId || !content) return c.json({
|
|
222
|
+
ok: false,
|
|
223
|
+
error: {
|
|
224
|
+
code: "BAD_REQUEST",
|
|
225
|
+
message: "Missing required fields: channel, chatId, content"
|
|
226
|
+
}
|
|
227
|
+
}, 400);
|
|
228
|
+
try {
|
|
229
|
+
return c.json({
|
|
230
|
+
ok: true,
|
|
231
|
+
payload: await service.sendMessage(channel, chatId, content)
|
|
232
|
+
});
|
|
233
|
+
} catch (error) {
|
|
234
|
+
return c.json({
|
|
235
|
+
ok: false,
|
|
236
|
+
error: {
|
|
237
|
+
code: "INTERNAL_ERROR",
|
|
238
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
239
|
+
}
|
|
240
|
+
}, 500);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
200
243
|
}
|
|
201
244
|
//#endregion
|
|
202
245
|
export { registerAgentStreamRoutes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToolPolicySetSchema, init_schema } from "../../../agent-manifest/schema.js";
|
|
2
2
|
import { AgentModelsSchema, init_schema as init_schema$1 } from "../../../config/schema.js";
|
|
3
3
|
import { init_agent_scope, normalizeAgentId } from "../../../agent/agent-scope.js";
|
|
4
|
-
import { deleteAgentAvatarFile, finalizeCreateAgentDirs, getGatewayAgentEffectiveManifest, listAgentProfileFiles, listGatewayAgents, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile,
|
|
4
|
+
import { deleteAgentAvatarFile, finalizeCreateAgentDirs, getGatewayAgentEffectiveManifest, listAgentProfileFiles, listGatewayAgents, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile, runAfterDeletePurge, writeAgentAvatarFromBase64, writeAgentProfileFile } from "../../agents-admin.js";
|
|
5
5
|
import { getVoiceModelsConfig } from "../../../config/voice.js";
|
|
6
6
|
//#region src/gateway/hono/routes/agents.ts
|
|
7
7
|
init_schema$1();
|
|
@@ -89,38 +89,6 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
89
89
|
payload
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
-
authenticated.get("/api/user-profile", async (c) => {
|
|
93
|
-
const res = await readUserProfileFile();
|
|
94
|
-
if (res.ok === false) return c.json({
|
|
95
|
-
ok: false,
|
|
96
|
-
error: { message: res.error }
|
|
97
|
-
}, res.status ?? 400);
|
|
98
|
-
return c.json({
|
|
99
|
-
ok: true,
|
|
100
|
-
payload: res.data
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
authenticated.put("/api/user-profile", strictRateLimitMiddleware, async (c) => {
|
|
104
|
-
let content = "";
|
|
105
|
-
try {
|
|
106
|
-
const body = await c.req.json();
|
|
107
|
-
content = typeof body.content === "string" ? body.content : "";
|
|
108
|
-
} catch {
|
|
109
|
-
return c.json({
|
|
110
|
-
ok: false,
|
|
111
|
-
error: { message: "Invalid JSON" }
|
|
112
|
-
}, 400);
|
|
113
|
-
}
|
|
114
|
-
const res = await writeUserProfileFile(content);
|
|
115
|
-
if (res.ok === false) return c.json({
|
|
116
|
-
ok: false,
|
|
117
|
-
error: { message: res.error }
|
|
118
|
-
}, res.status ?? 400);
|
|
119
|
-
return c.json({
|
|
120
|
-
ok: true,
|
|
121
|
-
payload: res.data
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
92
|
authenticated.post("/api/agents", strictRateLimitMiddleware, async (c) => {
|
|
125
93
|
let body = {};
|
|
126
94
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAllModels, getAvailableModels, init_providers } from "../../../providers/index.js";
|
|
2
2
|
import { ActivationPlanner } from "../../../extensions/activation-planner.js";
|
|
3
3
|
import { mergeActivationContext } from "../../../extensions/activation-context.js";
|
|
4
|
-
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
5
4
|
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
5
|
+
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
6
6
|
import { createOAuthHandler } from "../oauth.js";
|
|
7
7
|
import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
8
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Covers heartbeat, bind/customBindHost/port, tailscale, auth (mode + token +
|
|
5
5
|
* password + rateLimit + trustedProxy), trustedProxies, allowRealIpFallback,
|
|
6
6
|
* dangerouslyAllowHostHeaderOriginFallback, security, share, siteShare, publicUrl, webchat,
|
|
7
|
-
* corsOrigins
|
|
7
|
+
* corsOrigins and channelConnectDefer{Mode,Ids,SkipIds}.
|
|
8
8
|
*
|
|
9
9
|
* Validation policy: each subsection that can reject rejects with a 400 and a
|
|
10
10
|
* specific `message`. The dispatcher converts these into `c.json(...)`.
|
|
11
11
|
*
|
|
12
12
|
* Initial-state branches use the same literal defaults the inline code did
|
|
13
|
-
* (loopback + port 18790 + 1800s heartbeat +
|
|
13
|
+
* (loopback + port 18790 + 1800s heartbeat + empty CORS) so
|
|
14
14
|
* a brand-new install gets a working gateway after the first PATCH.
|
|
15
15
|
*/
|
|
16
16
|
import type { Config } from '../../../../config/schema.js';
|
|
@@ -20,7 +20,6 @@ function ensureGateway(config) {
|
|
|
20
20
|
intervalMs: 18e5,
|
|
21
21
|
includeSystemPromptSection: false
|
|
22
22
|
},
|
|
23
|
-
maxSseConnections: 100,
|
|
24
23
|
corsOrigins: []
|
|
25
24
|
};
|
|
26
25
|
return config.gateway;
|
|
@@ -98,7 +97,6 @@ function applyGatewayPatch(config, body) {
|
|
|
98
97
|
intervalMs: 18e5,
|
|
99
98
|
includeSystemPromptSection: false
|
|
100
99
|
},
|
|
101
|
-
maxSseConnections: 100,
|
|
102
100
|
corsOrigins: []
|
|
103
101
|
};
|
|
104
102
|
else config.gateway.bind = bind;
|
|
@@ -123,7 +121,6 @@ function applyGatewayPatch(config, body) {
|
|
|
123
121
|
intervalMs: 18e5,
|
|
124
122
|
includeSystemPromptSection: false
|
|
125
123
|
},
|
|
126
|
-
maxSseConnections: 100,
|
|
127
124
|
corsOrigins: []
|
|
128
125
|
};
|
|
129
126
|
else config.gateway.port = Math.floor(body.gateway.port);
|
|
@@ -139,7 +136,6 @@ function applyGatewayPatch(config, body) {
|
|
|
139
136
|
intervalMs: 18e5,
|
|
140
137
|
includeSystemPromptSection: false
|
|
141
138
|
},
|
|
142
|
-
maxSseConnections: 100,
|
|
143
139
|
corsOrigins: []
|
|
144
140
|
};
|
|
145
141
|
config.gateway.tailscale = { ...config.gateway.tailscale ?? {
|
|
@@ -251,21 +247,6 @@ function applyGatewayPatch(config, body) {
|
|
|
251
247
|
const gw = ensureGateway(config);
|
|
252
248
|
gw.corsOrigins = body.gateway.corsOrigins.filter((x) => typeof x === "string" && x.trim().length > 0).map((x) => x.trim());
|
|
253
249
|
}
|
|
254
|
-
if (body.gateway?.maxSseConnections !== void 0) {
|
|
255
|
-
if (typeof body.gateway.maxSseConnections !== "number" || !Number.isFinite(body.gateway.maxSseConnections) || body.gateway.maxSseConnections < 1) return patchError("gateway.maxSseConnections must be a positive integer");
|
|
256
|
-
if (!config.gateway) config.gateway = {
|
|
257
|
-
bind: "loopback",
|
|
258
|
-
port: 18790,
|
|
259
|
-
heartbeat: {
|
|
260
|
-
enabled: true,
|
|
261
|
-
intervalMs: 18e5,
|
|
262
|
-
includeSystemPromptSection: false
|
|
263
|
-
},
|
|
264
|
-
maxSseConnections: Math.floor(body.gateway.maxSseConnections),
|
|
265
|
-
corsOrigins: []
|
|
266
|
-
};
|
|
267
|
-
else config.gateway.maxSseConnections = Math.floor(body.gateway.maxSseConnections);
|
|
268
|
-
}
|
|
269
250
|
if (body.gateway?.channelConnectDeferMode !== void 0) {
|
|
270
251
|
const mode = body.gateway.channelConnectDeferMode;
|
|
271
252
|
if (mode !== "auto" && mode !== "off" && mode !== "explicit") return patchError("gateway.channelConnectDeferMode must be auto, off, or explicit");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextCompactionPolicySchema, init_config } from "../../../../user-context/config.js";
|
|
1
|
+
import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../../user-context/config.js";
|
|
2
2
|
import { BindingsConfigSchema, BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
4
4
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
@@ -28,6 +28,22 @@ async function applyMiscPatch(config, body) {
|
|
|
28
28
|
if (body.userContext !== void 0) {
|
|
29
29
|
if (typeof body.userContext !== "object" || body.userContext === null || Array.isArray(body.userContext)) return patchError("userContext must be an object");
|
|
30
30
|
const userContextPatch = body.userContext;
|
|
31
|
+
if (userContextPatch.dreaming !== void 0) {
|
|
32
|
+
const parsed = UserContextDreamingSchema.safeParse(userContextPatch.dreaming);
|
|
33
|
+
if (!parsed.success) return patchError(parsed.error.issues.map((issue) => issue.message).join("; "));
|
|
34
|
+
config.userContext = {
|
|
35
|
+
...config.userContext,
|
|
36
|
+
dreaming: parsed.data
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (userContextPatch.privacy !== void 0) {
|
|
40
|
+
const parsed = UserContextPrivacySchema.safeParse(userContextPatch.privacy);
|
|
41
|
+
if (!parsed.success) return patchError(parsed.error.issues.map((issue) => issue.message).join("; "));
|
|
42
|
+
config.userContext = {
|
|
43
|
+
...config.userContext,
|
|
44
|
+
privacy: parsed.data
|
|
45
|
+
};
|
|
46
|
+
}
|
|
31
47
|
if (userContextPatch.memory !== void 0) {
|
|
32
48
|
if (typeof userContextPatch.memory !== "object" || userContextPatch.memory === null || Array.isArray(userContextPatch.memory)) return patchError("userContext.memory must be an object");
|
|
33
49
|
const memoryPatch = userContextPatch.memory;
|