@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
|
@@ -64,7 +64,7 @@ function parseModelRef(ref) {
|
|
|
64
64
|
model: trimmed.slice(idx + 1).trim()
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayWebchatConfigSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpServerSchema, McpConfigSchema,
|
|
67
|
+
var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayWebchatConfigSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpServerSchema, McpConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
|
|
68
68
|
var init_schema = __esmMin((() => {
|
|
69
69
|
init_schema$1();
|
|
70
70
|
init_preset_chain();
|
|
@@ -465,7 +465,6 @@ activityDetailDefault: z.enum([
|
|
|
465
465
|
auth: GatewayAuthSchema.optional(),
|
|
466
466
|
heartbeat: HeartbeatConfigSchema.optional(),
|
|
467
467
|
webchat: GatewayWebchatConfigSchema.optional(),
|
|
468
|
-
maxSseConnections: z.number().optional(),
|
|
469
468
|
corsOrigins: z.array(z.string()).optional(),
|
|
470
469
|
/**
|
|
471
470
|
* Reverse-proxy publicly reachable URL (e.g. `https://gateway.example.com`).
|
|
@@ -639,7 +638,6 @@ activityDetailDefault: z.enum([
|
|
|
639
638
|
includeSystemPromptSection: false
|
|
640
639
|
},
|
|
641
640
|
webchat: { activityDetailDefault: "on" },
|
|
642
|
-
maxSseConnections: 100,
|
|
643
641
|
corsOrigins: [],
|
|
644
642
|
skillsMarketplaceProvider: "store",
|
|
645
643
|
skillsStoreBaseUrl: "https://store.xopc.ai"
|
|
@@ -904,30 +902,6 @@ defaultAgent: z.string().min(1).optional() }).strict().default({});
|
|
|
904
902
|
servers: z.record(z.string(), McpServerSchema).optional(),
|
|
905
903
|
sessionIdleTtlMs: z.number().finite().min(0).optional()
|
|
906
904
|
}).strict().optional();
|
|
907
|
-
CodeIntelligenceConfigSchema = z.object({
|
|
908
|
-
enabled: z.boolean().default(true),
|
|
909
|
-
agentIds: z.array(z.string().min(1)).default(["coder"]),
|
|
910
|
-
indexMode: z.enum([
|
|
911
|
-
"fast",
|
|
912
|
-
"moderate",
|
|
913
|
-
"full"
|
|
914
|
-
]).default("moderate"),
|
|
915
|
-
autoIndex: z.boolean().default(true),
|
|
916
|
-
autoRefresh: z.boolean().default(true),
|
|
917
|
-
refreshDebounceMs: z.number().int().min(100).max(3e4).default(600),
|
|
918
|
-
queryTimeoutMs: z.number().int().min(1e3).max(12e4).default(2e4),
|
|
919
|
-
indexTimeoutMs: z.number().int().min(1e4).max(30 * 6e4).default(5 * 6e4),
|
|
920
|
-
binaryPath: z.string().min(1).optional()
|
|
921
|
-
}).strict().default({
|
|
922
|
-
enabled: true,
|
|
923
|
-
agentIds: ["coder"],
|
|
924
|
-
indexMode: "moderate",
|
|
925
|
-
autoIndex: true,
|
|
926
|
-
autoRefresh: true,
|
|
927
|
-
refreshDebounceMs: 600,
|
|
928
|
-
queryTimeoutMs: 2e4,
|
|
929
|
-
indexTimeoutMs: 5 * 6e4
|
|
930
|
-
});
|
|
931
905
|
ConnectorsConfigSchema = z.object({ instances: z.record(z.string(), z.record(z.string(), z.unknown())).optional() }).strict().optional();
|
|
932
906
|
ExperimentalConfigSchema = z.object({
|
|
933
907
|
/** First-run activation that analyzes one explicitly selected local folder. */
|
|
@@ -944,7 +918,6 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
944
918
|
workspace: WorkspaceConfigSchema,
|
|
945
919
|
tools: ToolsConfigSchema,
|
|
946
920
|
mcp: McpConfigSchema,
|
|
947
|
-
codeIntelligence: CodeIntelligenceConfigSchema,
|
|
948
921
|
connectors: ConnectorsConfigSchema,
|
|
949
922
|
experimental: ExperimentalConfigSchema,
|
|
950
923
|
extensions: ExtensionsConfigSchema.default({}),
|
|
@@ -959,7 +932,7 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
959
932
|
update: UpdateConfigSchema,
|
|
960
933
|
commands: CommandsConfigSchema,
|
|
961
934
|
tui: TuiConfigSchema
|
|
962
|
-
}).default({
|
|
935
|
+
}).strict().default({
|
|
963
936
|
userContext: {
|
|
964
937
|
enabled: true,
|
|
965
938
|
preferences: { responseLanguage: "auto" },
|
|
@@ -981,7 +954,12 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
981
954
|
writeStrategy: "local-first",
|
|
982
955
|
allowExternalWrites: false
|
|
983
956
|
},
|
|
984
|
-
dreaming: {
|
|
957
|
+
dreaming: {
|
|
958
|
+
mode: "review",
|
|
959
|
+
schedule: { time: "03:00" },
|
|
960
|
+
minEvidenceSources: 2,
|
|
961
|
+
limit: 500
|
|
962
|
+
}
|
|
985
963
|
},
|
|
986
964
|
agents: {
|
|
987
965
|
default: "main",
|
|
@@ -1042,7 +1020,6 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1042
1020
|
includeSystemPromptSection: false
|
|
1043
1021
|
},
|
|
1044
1022
|
webchat: { activityDetailDefault: "on" },
|
|
1045
|
-
maxSseConnections: 100,
|
|
1046
1023
|
corsOrigins: [],
|
|
1047
1024
|
skillsMarketplaceProvider: "store",
|
|
1048
1025
|
skillsStoreBaseUrl: "https://store.xopc.ai"
|
|
@@ -1055,16 +1032,6 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1055
1032
|
maxResults: 5,
|
|
1056
1033
|
providers: []
|
|
1057
1034
|
} } },
|
|
1058
|
-
codeIntelligence: {
|
|
1059
|
-
enabled: true,
|
|
1060
|
-
agentIds: ["coder"],
|
|
1061
|
-
indexMode: "moderate",
|
|
1062
|
-
autoIndex: true,
|
|
1063
|
-
autoRefresh: true,
|
|
1064
|
-
refreshDebounceMs: 600,
|
|
1065
|
-
queryTimeoutMs: 2e4,
|
|
1066
|
-
indexTimeoutMs: 5 * 6e4
|
|
1067
|
-
},
|
|
1068
1035
|
experimental: { workDiscoveryOnboarding: true },
|
|
1069
1036
|
extensions: {
|
|
1070
1037
|
allow: [],
|
|
@@ -1088,4 +1055,4 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1088
1055
|
}));
|
|
1089
1056
|
//#endregion
|
|
1090
1057
|
init_schema();
|
|
1091
|
-
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema,
|
|
1058
|
+
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
|
|
@@ -93,7 +93,6 @@ function mergeGatewaySkillsMarketplacePatch(config, patch) {
|
|
|
93
93
|
intervalMs: 18e5,
|
|
94
94
|
includeSystemPromptSection: false
|
|
95
95
|
},
|
|
96
|
-
maxSseConnections: 100,
|
|
97
96
|
corsOrigins: []
|
|
98
97
|
};
|
|
99
98
|
if (parsed.data.skillsMarketplaceProvider !== void 0) config.gateway.skillsMarketplaceProvider = parsed.data.skillsMarketplaceProvider.trim();
|
|
@@ -10,6 +10,7 @@ import { connectorIdentityKey, normalizeConnectorIdentity } from "./connector-id
|
|
|
10
10
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
11
11
|
import { buildConnectorLearningArguments, getConnectorLearningPlan } from "./learning-recipes.js";
|
|
12
12
|
import { getConnectorDefinition } from "./catalog.js";
|
|
13
|
+
import { createUnderstandingSourceRun, listUnderstandingSourceRuns, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant, upsertUserFocus } from "../user-context/sources/repository.js";
|
|
13
14
|
import { ConnectedUnderstandingPipeline } from "../knowledge/connected-understanding-pipeline.js";
|
|
14
15
|
import "../knowledge/index.js";
|
|
15
16
|
import { ingestComposioConnectedSource } from "./connected-source-ingestion.js";
|
|
@@ -22,8 +23,41 @@ function learningFailureCode(error) {
|
|
|
22
23
|
const message = error instanceof Error ? error.message : String(error);
|
|
23
24
|
return message.includes("ToolRouterV2_InvalidConnectedAccountIds") || message.includes("Could not find connected account(s)") || message.includes("missing its provider identity") ? CONNECTED_ACCOUNT_UNAVAILABLE : CONNECTED_SOURCE_SYNC_FAILED;
|
|
24
25
|
}
|
|
26
|
+
function connectorSourceCategory(toolkit) {
|
|
27
|
+
if (toolkit === "gmail") return "mail";
|
|
28
|
+
if (toolkit === "googlecalendar") return "calendar";
|
|
29
|
+
if (toolkit === "github" || toolkit === "linear") return "code_activity";
|
|
30
|
+
if (toolkit === "slack") return "messages";
|
|
31
|
+
return "files";
|
|
32
|
+
}
|
|
33
|
+
function ensureUnderstandingSourceRun(job, toolkit, displayName) {
|
|
34
|
+
const grant = upsertUnderstandingSourceGrant({
|
|
35
|
+
sourceKey: `connector-account:${job.accountId}`,
|
|
36
|
+
adapterId: `connector:${job.connectorId}`,
|
|
37
|
+
category: connectorSourceCategory(toolkit),
|
|
38
|
+
platform: "all",
|
|
39
|
+
displayName,
|
|
40
|
+
accessMode: "continuous",
|
|
41
|
+
retentionPolicy: "bounded_raw",
|
|
42
|
+
processingPolicy: "remote_allowed",
|
|
43
|
+
config: {
|
|
44
|
+
connectorId: job.connectorId,
|
|
45
|
+
accountId: job.accountId,
|
|
46
|
+
readOnly: true
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return listUnderstandingSourceRuns(grant.id, 100).find((run) => run.metadata.connectorLearningJobId === job.id) ?? createUnderstandingSourceRun({
|
|
50
|
+
grantId: grant.id,
|
|
51
|
+
kind: job.mode,
|
|
52
|
+
status: "queued",
|
|
53
|
+
metadata: {
|
|
54
|
+
connectorLearningJobId: job.id,
|
|
55
|
+
connectorId: job.connectorId
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
25
59
|
function learningEnabled(config) {
|
|
26
|
-
return config.userContext.enabled && config.userContext.understanding.enabled
|
|
60
|
+
return config.userContext.enabled && config.userContext.understanding.enabled;
|
|
27
61
|
}
|
|
28
62
|
function startConnectorLearningCoordinator(options) {
|
|
29
63
|
const intervalMs = Math.max(2e3, Math.min(options.intervalMs ?? 1e4, 6e4));
|
|
@@ -60,6 +94,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
60
94
|
idempotencyKey: request.idempotencyKey ?? (mode === "bootstrap" ? `bootstrap:${connection.accountId}:v1` : `incremental:${connection.accountId}:${request.reason ?? "manual"}:${bucket}`),
|
|
61
95
|
nextRunAt: request.nextRunAt
|
|
62
96
|
});
|
|
97
|
+
ensureUnderstandingSourceRun(job, definition.runtime.toolkit, definition.displayName);
|
|
63
98
|
publish(job);
|
|
64
99
|
queueMicrotask(() => void runNow());
|
|
65
100
|
return job;
|
|
@@ -77,6 +112,8 @@ function startConnectorLearningCoordinator(options) {
|
|
|
77
112
|
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error(`Connector learning is unavailable for ${job.connectorId}.`);
|
|
78
113
|
const plan = getConnectorLearningPlan(definition.runtime.toolkit);
|
|
79
114
|
if (!plan) throw new Error(`Connector learning has no plan for ${definition.runtime.toolkit}.`);
|
|
115
|
+
const sourceRun = ensureUnderstandingSourceRun(job, plan.toolkit, definition.displayName);
|
|
116
|
+
updateUnderstandingSourceRun(sourceRun.id, { status: "running" });
|
|
80
117
|
let connection = listConnectorConnections().find((candidate) => candidate.id === job.connectionId);
|
|
81
118
|
if (!connection) throw new Error("Connector account no longer exists.");
|
|
82
119
|
const installation = getConnectorInstallation(`${job.connectorId}-local-owner`);
|
|
@@ -153,13 +190,42 @@ function startConnectorLearningCoordinator(options) {
|
|
|
153
190
|
}));
|
|
154
191
|
publish(updateConnectorLearningJob(job.id, { phase: "deriving" }));
|
|
155
192
|
const understanding = await new ConnectedUnderstandingPipeline(options.getMemoryManager()).process(job.sourceInstanceId, job.connectorId, job.agentId);
|
|
156
|
-
|
|
193
|
+
for (const record of understanding.createdRecords.filter((item) => item.kind === "project_context")) upsertUserFocus({
|
|
194
|
+
canonicalKey: `connector-focus:${job.accountId}:${record.id}`,
|
|
195
|
+
title: record.content.slice(0, 120),
|
|
196
|
+
summary: record.content,
|
|
197
|
+
horizon: "ongoing",
|
|
198
|
+
status: "candidate",
|
|
199
|
+
confidence: .72,
|
|
200
|
+
evidenceRefs: [`connector-account:${job.accountId}`],
|
|
201
|
+
sourceRunId: sourceRun.id
|
|
202
|
+
});
|
|
203
|
+
const completed = updateConnectorLearningJob(job.id, {
|
|
157
204
|
status: "completed",
|
|
158
205
|
phase: "completed",
|
|
159
206
|
candidatesCreated: understanding.created,
|
|
160
207
|
nextRunAt: null,
|
|
161
208
|
finished: true
|
|
162
|
-
})
|
|
209
|
+
});
|
|
210
|
+
updateUnderstandingSourceRun(sourceRun.id, {
|
|
211
|
+
status: "completed",
|
|
212
|
+
itemsSeen,
|
|
213
|
+
cursorAfter: (/* @__PURE__ */ new Date()).toISOString(),
|
|
214
|
+
completed: true,
|
|
215
|
+
metadata: {
|
|
216
|
+
...sourceRun.metadata,
|
|
217
|
+
itemsIndexed,
|
|
218
|
+
candidatesCreated: understanding.created
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
updateUnderstandingSourceGrantCheckpoint(sourceRun.grantId, {
|
|
222
|
+
checkpoint: {
|
|
223
|
+
cursor: (/* @__PURE__ */ new Date()).toISOString(),
|
|
224
|
+
connectorLearningJobId: job.id
|
|
225
|
+
},
|
|
226
|
+
lastCollectedAt: Date.now()
|
|
227
|
+
});
|
|
228
|
+
publish(completed);
|
|
163
229
|
pruneBoundedKnowledgeSourceItems(job.sourceInstanceId, Date.now() - plan.bootstrapWindowDays * 24 * 60 * 6e4);
|
|
164
230
|
const syncPolicy = getConnectorSyncPolicyForConnection(job.connectionId);
|
|
165
231
|
if (syncPolicy?.scanEnabled === false) return;
|
|
@@ -190,6 +256,12 @@ function startConnectorLearningCoordinator(options) {
|
|
|
190
256
|
nextRunAt: exhausted ? null : Date.now() + Math.min(30 * 6e4, 3e4 * 2 ** Math.min(job.attemptCount, 6)),
|
|
191
257
|
finished: true
|
|
192
258
|
}));
|
|
259
|
+
const definition = getConnectorDefinition(job.connectorId);
|
|
260
|
+
if (definition?.runtime.type === "composio" && definition.runtime.role === "toolkit") updateUnderstandingSourceRun(ensureUnderstandingSourceRun(job, definition.runtime.toolkit, definition.displayName).id, {
|
|
261
|
+
status: "failed",
|
|
262
|
+
errorMessage,
|
|
263
|
+
completed: true
|
|
264
|
+
});
|
|
193
265
|
log.warn({
|
|
194
266
|
err,
|
|
195
267
|
jobId: job.id,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { type EndpointHelloPayload } from '@xopcai/endpoint-tools-protocol';
|
|
3
|
+
import type { EndpointPrincipal } from '../storage/sqlite/index.js';
|
|
4
|
+
export interface EndpointAuthenticatorDeps {
|
|
5
|
+
getPrincipal(id: string): EndpointPrincipal | undefined;
|
|
6
|
+
bindEndpoint(endpointId: string, principalId: string, boundAt?: number): boolean;
|
|
7
|
+
touchPrincipal(id: string, seenAt?: number): void;
|
|
8
|
+
now?: () => number;
|
|
9
|
+
}
|
|
10
|
+
export declare class EndpointAuthenticationError extends Error {
|
|
11
|
+
}
|
|
12
|
+
export declare function parseEndpointPublicKey(encoded: string): crypto.KeyObject;
|
|
13
|
+
export declare class EndpointAuthenticator {
|
|
14
|
+
private readonly deps;
|
|
15
|
+
private readonly usedNonces;
|
|
16
|
+
private readonly now;
|
|
17
|
+
constructor(deps: EndpointAuthenticatorDeps);
|
|
18
|
+
authenticate(payload: EndpointHelloPayload): EndpointPrincipal;
|
|
19
|
+
private pruneNonces;
|
|
20
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { endpointHelloSigningPayload } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import crypto from "node:crypto";
|
|
3
|
+
//#region src/endpoint-tools/auth.ts
|
|
4
|
+
const MAX_CLOCK_SKEW_MS = 6e4;
|
|
5
|
+
var EndpointAuthenticationError = class extends Error {};
|
|
6
|
+
function parseEndpointPublicKey(encoded) {
|
|
7
|
+
const key = crypto.createPublicKey({
|
|
8
|
+
key: Buffer.from(encoded, "base64url"),
|
|
9
|
+
format: "der",
|
|
10
|
+
type: "spki"
|
|
11
|
+
});
|
|
12
|
+
if (key.asymmetricKeyType !== "ec" || key.asymmetricKeyDetails?.namedCurve !== "prime256v1") throw new Error("Endpoint public key must be ECDSA P-256");
|
|
13
|
+
return key;
|
|
14
|
+
}
|
|
15
|
+
var EndpointAuthenticator = class {
|
|
16
|
+
usedNonces = /* @__PURE__ */ new Map();
|
|
17
|
+
now;
|
|
18
|
+
constructor(deps) {
|
|
19
|
+
this.deps = deps;
|
|
20
|
+
this.now = deps.now ?? Date.now;
|
|
21
|
+
}
|
|
22
|
+
authenticate(payload) {
|
|
23
|
+
const now = this.now();
|
|
24
|
+
this.pruneNonces(now);
|
|
25
|
+
if (Math.abs(now - payload.signedAt) > MAX_CLOCK_SKEW_MS) throw new EndpointAuthenticationError("Endpoint signature timestamp is outside the allowed window");
|
|
26
|
+
const nonceKey = `${payload.principalId}:${payload.nonce}`;
|
|
27
|
+
if (this.usedNonces.has(nonceKey)) throw new EndpointAuthenticationError("Endpoint hello nonce was already used");
|
|
28
|
+
const principal = this.deps.getPrincipal(payload.principalId);
|
|
29
|
+
if (!principal || principal.revokedAt !== void 0) throw new EndpointAuthenticationError("Endpoint principal is unknown or revoked");
|
|
30
|
+
if (principal.kind !== payload.kind || principal.platform !== payload.platform || principal.displayName !== payload.displayName) throw new EndpointAuthenticationError("Endpoint identity does not match its registered principal");
|
|
31
|
+
let publicKey;
|
|
32
|
+
try {
|
|
33
|
+
publicKey = parseEndpointPublicKey(principal.publicKey);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new EndpointAuthenticationError("Endpoint principal public key is invalid", { cause: error });
|
|
36
|
+
}
|
|
37
|
+
if (!crypto.verify("sha256", Buffer.from(endpointHelloSigningPayload(payload), "utf8"), {
|
|
38
|
+
key: publicKey,
|
|
39
|
+
dsaEncoding: "ieee-p1363"
|
|
40
|
+
}, Buffer.from(payload.signature, "base64url"))) throw new EndpointAuthenticationError("Endpoint hello signature is invalid");
|
|
41
|
+
if (!this.deps.bindEndpoint(payload.endpointId, principal.id, now)) throw new EndpointAuthenticationError("Endpoint instance belongs to another principal");
|
|
42
|
+
this.usedNonces.set(nonceKey, now + MAX_CLOCK_SKEW_MS);
|
|
43
|
+
this.deps.touchPrincipal(principal.id, now);
|
|
44
|
+
return principal;
|
|
45
|
+
}
|
|
46
|
+
pruneNonces(now) {
|
|
47
|
+
for (const [key, expiresAt] of this.usedNonces) if (expiresAt <= now) this.usedNonces.delete(key);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { EndpointAuthenticationError, EndpointAuthenticator, parseEndpointPublicKey };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EndpointToolRuntime } from './runtime.js';
|
|
2
|
+
export { EndpointInvocationService, EndpointToolExecutionError, type EndpointInvocationAuditSink, type EndpointInvocationResult, } from './invocation-service.js';
|
|
3
|
+
export { EndpointToolPolicy, EndpointToolPolicyError } from './policy.js';
|
|
4
|
+
export { EndpointRegistry, endpointToolRevision, type EndpointConnectionSnapshot, type RegisteredEndpointTool, } from './registry.js';
|
|
5
|
+
export { EndpointUploadError, EndpointUploadService, ENDPOINT_UPLOAD_MAX_BYTES, type EndpointUploadedFile, type EndpointUploadGrant, } from './upload-service.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EndpointToolPolicy, EndpointToolPolicyError } from "./policy.js";
|
|
2
|
+
import { EndpointInvocationService, EndpointToolExecutionError } from "./invocation-service.js";
|
|
3
|
+
import { EndpointRegistry, endpointToolRevision } from "./registry.js";
|
|
4
|
+
import { ENDPOINT_UPLOAD_MAX_BYTES, EndpointUploadError, EndpointUploadService } from "./upload-service.js";
|
|
5
|
+
import { EndpointToolRuntime } from "./runtime.js";
|
|
6
|
+
export { ENDPOINT_UPLOAD_MAX_BYTES, EndpointInvocationService, EndpointRegistry, EndpointToolExecutionError, EndpointToolPolicy, EndpointToolPolicyError, EndpointToolRuntime, EndpointUploadError, EndpointUploadService, endpointToolRevision };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ClientEndpointMessage, type EndpointToolContent, type EndpointToolErrorCode } from '@xopcai/endpoint-tools-protocol';
|
|
2
|
+
import { EndpointRegistry } from './registry.js';
|
|
3
|
+
import { EndpointToolPolicy } from './policy.js';
|
|
4
|
+
import type { EndpointUploadService } from './upload-service.js';
|
|
5
|
+
type ToolClientMessage = Exclude<ClientEndpointMessage, {
|
|
6
|
+
type: `endpoint.${string}`;
|
|
7
|
+
}>;
|
|
8
|
+
export interface EndpointInvocationAuditSink {
|
|
9
|
+
started(params: {
|
|
10
|
+
id: string;
|
|
11
|
+
principalId: string;
|
|
12
|
+
endpointId: string;
|
|
13
|
+
toolCallId: string;
|
|
14
|
+
toolName: string;
|
|
15
|
+
effect: 'read' | 'write' | 'destructive';
|
|
16
|
+
confirmationRequired: boolean;
|
|
17
|
+
argumentsSha256: string;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
}): void;
|
|
20
|
+
finished(params: {
|
|
21
|
+
id: string;
|
|
22
|
+
status: 'succeeded' | 'failed';
|
|
23
|
+
errorCode?: EndpointToolErrorCode;
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
completedAt: number;
|
|
26
|
+
}): void;
|
|
27
|
+
}
|
|
28
|
+
export interface EndpointInvocationServiceOptions {
|
|
29
|
+
audit?: EndpointInvocationAuditSink;
|
|
30
|
+
uploads?: EndpointUploadService;
|
|
31
|
+
policy?: EndpointToolPolicy;
|
|
32
|
+
}
|
|
33
|
+
export interface EndpointInvocationResult {
|
|
34
|
+
content: EndpointToolContent[];
|
|
35
|
+
details?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
export declare class EndpointToolExecutionError extends Error {
|
|
38
|
+
readonly code: EndpointToolErrorCode;
|
|
39
|
+
constructor(code: EndpointToolErrorCode, message: string);
|
|
40
|
+
}
|
|
41
|
+
export declare class EndpointInvocationService {
|
|
42
|
+
private readonly registry;
|
|
43
|
+
private readonly options;
|
|
44
|
+
private readonly pending;
|
|
45
|
+
private readonly policy;
|
|
46
|
+
constructor(registry: EndpointRegistry, options?: EndpointInvocationServiceOptions);
|
|
47
|
+
invoke(params: {
|
|
48
|
+
endpointId: string;
|
|
49
|
+
toolCallId: string;
|
|
50
|
+
toolName: string;
|
|
51
|
+
arguments: Record<string, unknown>;
|
|
52
|
+
descriptorRevision: string;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
onProgress?: (progress: {
|
|
55
|
+
message?: string;
|
|
56
|
+
percent?: number;
|
|
57
|
+
}) => void;
|
|
58
|
+
}): Promise<EndpointInvocationResult>;
|
|
59
|
+
handleMessage(endpointId: string, message: ToolClientMessage): void;
|
|
60
|
+
failEndpoint(endpointId: string): void;
|
|
61
|
+
close(): void;
|
|
62
|
+
private cancel;
|
|
63
|
+
private succeed;
|
|
64
|
+
private fail;
|
|
65
|
+
private take;
|
|
66
|
+
private error;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { ENDPOINT_INVOCATION_RECEIPT_TIMEOUT_MS, canonicalJson } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import { EndpointToolPolicy, EndpointToolPolicyError } from "./policy.js";
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
//#region src/endpoint-tools/invocation-service.ts
|
|
5
|
+
var EndpointToolExecutionError = class extends Error {
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.name = "EndpointToolExecutionError";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var EndpointInvocationService = class {
|
|
13
|
+
pending = /* @__PURE__ */ new Map();
|
|
14
|
+
policy;
|
|
15
|
+
constructor(registry, options = {}) {
|
|
16
|
+
this.registry = registry;
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.policy = options.policy ?? new EndpointToolPolicy();
|
|
19
|
+
}
|
|
20
|
+
invoke(params) {
|
|
21
|
+
const endpoint = this.registry.get(params.endpointId);
|
|
22
|
+
if (!endpoint) return Promise.reject(this.error("ENDPOINT_OFFLINE", "Endpoint is offline"));
|
|
23
|
+
const tool = this.registry.getTool(params.endpointId, params.toolName);
|
|
24
|
+
if (!tool) return Promise.reject(this.error("TOOL_NOT_FOUND", "Endpoint tool is unavailable"));
|
|
25
|
+
if (tool.revision !== params.descriptorRevision) return Promise.reject(this.error("TOOL_REVISION_MISMATCH", "Endpoint tool contract changed"));
|
|
26
|
+
let confirmationRequired;
|
|
27
|
+
try {
|
|
28
|
+
confirmationRequired = this.policy.evaluate(tool.descriptor, endpoint.availability).confirmationRequired;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error instanceof EndpointToolPolicyError) return Promise.reject(this.error("ENDPOINT_NOT_FOREGROUND", error.message));
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
if (params.signal?.aborted) return Promise.reject(this.error("TOOL_CANCELLED", "Endpoint tool call was cancelled"));
|
|
34
|
+
const endpointPending = [...this.pending.values()].filter((item) => item.endpointId === params.endpointId);
|
|
35
|
+
if (endpointPending.length >= 4) return Promise.reject(this.error("TOOL_BUSY", "Endpoint has reached its invocation limit"));
|
|
36
|
+
if (endpointPending.filter((item) => item.toolName === params.toolName).length >= tool.descriptor.maxConcurrency) return Promise.reject(this.error("TOOL_BUSY", "Endpoint tool has reached its invocation limit"));
|
|
37
|
+
const invocationId = crypto.randomUUID();
|
|
38
|
+
const startedAt = Date.now();
|
|
39
|
+
const uploadGrant = tool.descriptor.resultKinds.includes("file") ? this.options.uploads?.createGrant(invocationId, params.endpointId, startedAt) : void 0;
|
|
40
|
+
try {
|
|
41
|
+
this.options.audit?.started({
|
|
42
|
+
id: invocationId,
|
|
43
|
+
principalId: endpoint.principalId,
|
|
44
|
+
endpointId: params.endpointId,
|
|
45
|
+
toolCallId: params.toolCallId,
|
|
46
|
+
toolName: params.toolName,
|
|
47
|
+
effect: tool.descriptor.effect,
|
|
48
|
+
confirmationRequired,
|
|
49
|
+
argumentsSha256: crypto.createHash("sha256").update(canonicalJson(params.arguments)).digest("hex"),
|
|
50
|
+
startedAt
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
this.options.uploads?.abort(invocationId);
|
|
54
|
+
return Promise.reject(error);
|
|
55
|
+
}
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const pending = {
|
|
58
|
+
id: invocationId,
|
|
59
|
+
endpointId: params.endpointId,
|
|
60
|
+
toolName: params.toolName,
|
|
61
|
+
state: "sent",
|
|
62
|
+
receiptTimer: setTimeout(() => {
|
|
63
|
+
this.fail(invocationId, this.error("TOOL_TIMEOUT", "Endpoint did not receive the invocation"));
|
|
64
|
+
}, ENDPOINT_INVOCATION_RECEIPT_TIMEOUT_MS),
|
|
65
|
+
deadlineTimer: setTimeout(() => {
|
|
66
|
+
this.cancel(invocationId, "Endpoint tool timed out", "TOOL_TIMEOUT");
|
|
67
|
+
}, tool.descriptor.timeoutMs),
|
|
68
|
+
abortSignal: params.signal,
|
|
69
|
+
onProgress: params.onProgress,
|
|
70
|
+
resolve,
|
|
71
|
+
reject
|
|
72
|
+
};
|
|
73
|
+
if (params.signal) {
|
|
74
|
+
pending.abortHandler = () => this.cancel(invocationId, "Agent cancelled the tool call", "TOOL_CANCELLED");
|
|
75
|
+
params.signal.addEventListener("abort", pending.abortHandler, { once: true });
|
|
76
|
+
}
|
|
77
|
+
this.pending.set(invocationId, pending);
|
|
78
|
+
try {
|
|
79
|
+
this.registry.send(params.endpointId, "tool.invoke", {
|
|
80
|
+
invocationId,
|
|
81
|
+
toolCallId: params.toolCallId,
|
|
82
|
+
toolName: params.toolName,
|
|
83
|
+
arguments: params.arguments,
|
|
84
|
+
descriptorRevision: params.descriptorRevision,
|
|
85
|
+
confirmationRequired,
|
|
86
|
+
deadlineAt: Date.now() + tool.descriptor.timeoutMs,
|
|
87
|
+
...uploadGrant ? { uploadGrant } : {}
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
this.fail(invocationId, this.error("ENDPOINT_DISCONNECTED", "Endpoint disconnected before invocation"));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
handleMessage(endpointId, message) {
|
|
95
|
+
const invocationId = message.payload.invocationId;
|
|
96
|
+
const pending = this.pending.get(invocationId);
|
|
97
|
+
if (!pending || pending.endpointId !== endpointId) return;
|
|
98
|
+
switch (message.type) {
|
|
99
|
+
case "tool.received":
|
|
100
|
+
if (pending.state !== "sent") return;
|
|
101
|
+
pending.state = "running";
|
|
102
|
+
clearTimeout(pending.receiptTimer);
|
|
103
|
+
return;
|
|
104
|
+
case "tool.progress":
|
|
105
|
+
if (pending.state !== "running") return;
|
|
106
|
+
pending.onProgress?.({
|
|
107
|
+
...message.payload.message === void 0 ? {} : { message: message.payload.message },
|
|
108
|
+
...message.payload.percent === void 0 ? {} : { percent: message.payload.percent }
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
case "tool.result":
|
|
112
|
+
if (pending.state !== "running") return;
|
|
113
|
+
try {
|
|
114
|
+
this.options.uploads?.validateAndClose(invocationId, message.payload.content);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
this.fail(invocationId, this.error("PROTOCOL_ERROR", error instanceof Error ? error.message : String(error)));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this.succeed(invocationId, {
|
|
120
|
+
content: message.payload.content,
|
|
121
|
+
...message.payload.details === void 0 ? {} : { details: message.payload.details }
|
|
122
|
+
});
|
|
123
|
+
return;
|
|
124
|
+
case "tool.error":
|
|
125
|
+
this.fail(invocationId, this.error(message.payload.code, message.payload.message));
|
|
126
|
+
return;
|
|
127
|
+
case "tool.cancelled": this.fail(invocationId, this.error("TOOL_CANCELLED", "Endpoint cancelled the tool call"));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
failEndpoint(endpointId) {
|
|
131
|
+
for (const pending of this.pending.values()) if (pending.endpointId === endpointId) this.fail(pending.id, this.error("ENDPOINT_DISCONNECTED", "Endpoint disconnected"));
|
|
132
|
+
}
|
|
133
|
+
close() {
|
|
134
|
+
for (const pending of this.pending.values()) this.fail(pending.id, this.error("ENDPOINT_DISCONNECTED", "Endpoint runtime stopped"));
|
|
135
|
+
}
|
|
136
|
+
cancel(invocationId, reason, code) {
|
|
137
|
+
const pending = this.pending.get(invocationId);
|
|
138
|
+
if (!pending) return;
|
|
139
|
+
try {
|
|
140
|
+
this.registry.send(pending.endpointId, "tool.cancel", {
|
|
141
|
+
invocationId,
|
|
142
|
+
reason
|
|
143
|
+
});
|
|
144
|
+
} catch {}
|
|
145
|
+
this.fail(invocationId, this.error(code, reason));
|
|
146
|
+
}
|
|
147
|
+
succeed(invocationId, result) {
|
|
148
|
+
const pending = this.take(invocationId);
|
|
149
|
+
if (!pending) return;
|
|
150
|
+
try {
|
|
151
|
+
this.options.audit?.finished({
|
|
152
|
+
id: invocationId,
|
|
153
|
+
status: "succeeded",
|
|
154
|
+
completedAt: Date.now()
|
|
155
|
+
});
|
|
156
|
+
} finally {
|
|
157
|
+
pending.resolve(result);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
fail(invocationId, error) {
|
|
161
|
+
const pending = this.take(invocationId);
|
|
162
|
+
if (!pending) return;
|
|
163
|
+
try {
|
|
164
|
+
this.options.uploads?.abort(invocationId);
|
|
165
|
+
this.options.audit?.finished({
|
|
166
|
+
id: invocationId,
|
|
167
|
+
status: "failed",
|
|
168
|
+
...error instanceof EndpointToolExecutionError ? { errorCode: error.code } : {},
|
|
169
|
+
errorMessage: error.message,
|
|
170
|
+
completedAt: Date.now()
|
|
171
|
+
});
|
|
172
|
+
} finally {
|
|
173
|
+
pending.reject(error);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
take(invocationId) {
|
|
177
|
+
const pending = this.pending.get(invocationId);
|
|
178
|
+
if (!pending) return void 0;
|
|
179
|
+
this.pending.delete(invocationId);
|
|
180
|
+
clearTimeout(pending.receiptTimer);
|
|
181
|
+
clearTimeout(pending.deadlineTimer);
|
|
182
|
+
if (pending.abortSignal && pending.abortHandler) pending.abortSignal.removeEventListener("abort", pending.abortHandler);
|
|
183
|
+
return pending;
|
|
184
|
+
}
|
|
185
|
+
error(code, message) {
|
|
186
|
+
return new EndpointToolExecutionError(code, message);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
//#endregion
|
|
190
|
+
export { EndpointInvocationService, EndpointToolExecutionError };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EndpointAvailability, EndpointKind, EndpointToolDescriptor } from '@xopcai/endpoint-tools-protocol';
|
|
2
|
+
export interface EndpointToolPolicyDecision {
|
|
3
|
+
confirmationRequired: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class EndpointToolPolicyError extends Error {
|
|
6
|
+
}
|
|
7
|
+
export declare class EndpointToolPolicy {
|
|
8
|
+
validateDescriptor(kind: EndpointKind, descriptor: EndpointToolDescriptor): void;
|
|
9
|
+
evaluate(descriptor: EndpointToolDescriptor, availability: EndpointAvailability): EndpointToolPolicyDecision;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/endpoint-tools/policy.ts
|
|
2
|
+
var EndpointToolPolicyError = class extends Error {};
|
|
3
|
+
var EndpointToolPolicy = class {
|
|
4
|
+
validateDescriptor(kind, descriptor) {
|
|
5
|
+
if (!descriptor.name.startsWith(`${kind}.`)) throw new EndpointToolPolicyError(`Tool ${descriptor.name} does not belong to ${kind}`);
|
|
6
|
+
if (descriptor.effect !== "read") {
|
|
7
|
+
if (descriptor.confirmation !== "always") throw new EndpointToolPolicyError(`Mutating tool ${descriptor.name} must always require confirmation`);
|
|
8
|
+
if (!descriptor.requiresForeground) throw new EndpointToolPolicyError(`Mutating tool ${descriptor.name} must require foreground`);
|
|
9
|
+
if (descriptor.requiredPermissions.length === 0) throw new EndpointToolPolicyError(`Mutating tool ${descriptor.name} must declare a permission`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
evaluate(descriptor, availability) {
|
|
13
|
+
if (descriptor.requiresForeground && availability !== "foreground") throw new EndpointToolPolicyError("Endpoint is not in the foreground");
|
|
14
|
+
return { confirmationRequired: descriptor.confirmation === "always" || descriptor.effect !== "read" };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { EndpointToolPolicy, EndpointToolPolicyError };
|