@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
|
@@ -11,6 +11,7 @@ import { createConnectorSetupSecretRequest, submitConnectorSetupSecret } from ".
|
|
|
11
11
|
import { configureComposioApiKey, executeComposioTool, getComposioInstallationPolicy, getComposioToolkitScope, inspectComposioConnectorHealth, listComposioConnections, listComposioTools, refreshComposioConnection, revokeComposioConnection, setComposioToolkitScope, updateComposioConnection, updateComposioInstallationPolicy } from "../../../connectors/composio.js";
|
|
12
12
|
import { listConnectorProviders } from "../../../connectors/providers.js";
|
|
13
13
|
import { getConnectorDefinition, listConnectorCatalog } from "../../../connectors/catalog.js";
|
|
14
|
+
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
14
15
|
import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
|
|
15
16
|
import { getConnectorInstance, listConnectorInstances } from "../../../connectors/instances.js";
|
|
16
17
|
import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
|
|
@@ -159,8 +160,11 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
159
160
|
...allowedScenarioKeys ? { allowedScenarioKeys } : {}
|
|
160
161
|
});
|
|
161
162
|
const connectionId = account.currentConnectionId;
|
|
162
|
-
if (connectionId && !policy.scanEnabled)
|
|
163
|
-
|
|
163
|
+
if (connectionId && !policy.scanEnabled) {
|
|
164
|
+
service.setConnectorLearningPaused(connectionId, true);
|
|
165
|
+
const grant = listUnderstandingSourceGrants().find((item) => item.sourceKey === `connector-account:${account.id}`);
|
|
166
|
+
if (grant) revokeUnderstandingSourceGrant(grant.id);
|
|
167
|
+
} else if (connectionId && previous?.scanEnabled === false) {
|
|
164
168
|
if (service.setConnectorLearningPaused(connectionId, false) === 0) service.requestConnectorLearning(connectionId, {
|
|
165
169
|
mode: "incremental",
|
|
166
170
|
reason: "schedule"
|
|
@@ -179,15 +183,6 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
179
183
|
ok: false,
|
|
180
184
|
error: "Connector account has no usable authorization."
|
|
181
185
|
}, 409);
|
|
182
|
-
const config = service.currentConfig;
|
|
183
|
-
if (!config.userContext.memory.sources.includes("connectedSources")) {
|
|
184
|
-
config.userContext.memory.sources = [...config.userContext.memory.sources, "connectedSources"];
|
|
185
|
-
const saved = await service.saveConfig(config);
|
|
186
|
-
if (!saved.saved) return c.json({
|
|
187
|
-
ok: false,
|
|
188
|
-
error: saved.error
|
|
189
|
-
}, 500);
|
|
190
|
-
}
|
|
191
186
|
const job = service.requestConnectorLearning(account.currentConnectionId, { reason: "manual" });
|
|
192
187
|
if (!job) return c.json({
|
|
193
188
|
ok: false,
|
|
@@ -255,7 +250,13 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
255
250
|
});
|
|
256
251
|
authenticated.delete("/api/connectors/composio/connections/:id", strictRateLimitMiddleware, async (c) => {
|
|
257
252
|
try {
|
|
258
|
-
|
|
253
|
+
const connectionId = c.req.param("id");
|
|
254
|
+
const connection = listConnectorConnections().find((item) => item.id === connectionId);
|
|
255
|
+
await revokeComposioConnection(connectionId);
|
|
256
|
+
if (connection?.accountId) {
|
|
257
|
+
const grant = listUnderstandingSourceGrants().find((item) => item.sourceKey === `connector-account:${connection.accountId}`);
|
|
258
|
+
if (grant) revokeUnderstandingSourceGrant(grant.id);
|
|
259
|
+
}
|
|
259
260
|
return c.json({
|
|
260
261
|
ok: true,
|
|
261
262
|
payload: { revoked: true }
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { MiddlewareHandler } from 'hono';
|
|
2
2
|
import type { GatewayService } from '../../service.js';
|
|
3
|
-
import type { SSEHandlerConfig } from '../sse.js';
|
|
4
3
|
export interface AuthenticatedRouteDeps {
|
|
5
4
|
service: GatewayService;
|
|
6
5
|
strictRateLimitMiddleware: MiddlewareHandler;
|
|
7
6
|
chatRateLimitMiddleware: MiddlewareHandler;
|
|
8
7
|
xopcCloudPollRateLimitMiddleware: MiddlewareHandler;
|
|
9
8
|
channelRateLimitMiddleware?: MiddlewareHandler;
|
|
10
|
-
sseConfig: SSEHandlerConfig;
|
|
11
9
|
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { endpointPrincipalRegistrationSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import { createEndpointPrincipal, getEndpointPrincipal, listEndpointPrincipals, revokeEndpointPrincipal } from "../../../storage/sqlite/endpoint-principal-repository.js";
|
|
3
|
+
import { listEndpointToolInvocationAudits } from "../../../storage/sqlite/endpoint-tool-invocation-repository.js";
|
|
4
|
+
import "../../../storage/sqlite/index.js";
|
|
5
|
+
import { parseEndpointPublicKey } from "../../../endpoint-tools/auth.js";
|
|
6
|
+
import { ENDPOINT_UPLOAD_MAX_BYTES, EndpointUploadError } from "../../../endpoint-tools/upload-service.js";
|
|
7
|
+
//#region src/gateway/hono/routes/endpoint-tools.ts
|
|
8
|
+
async function readBoundedBody(body, maxBytes) {
|
|
9
|
+
if (!body) return new Uint8Array();
|
|
10
|
+
const reader = body.getReader();
|
|
11
|
+
const chunks = [];
|
|
12
|
+
let size = 0;
|
|
13
|
+
try {
|
|
14
|
+
while (true) {
|
|
15
|
+
const { done, value } = await reader.read();
|
|
16
|
+
if (done) break;
|
|
17
|
+
size += value.byteLength;
|
|
18
|
+
if (size > maxBytes) throw new EndpointUploadError("Uploaded file is too large");
|
|
19
|
+
chunks.push(value);
|
|
20
|
+
}
|
|
21
|
+
} finally {
|
|
22
|
+
reader.releaseLock();
|
|
23
|
+
}
|
|
24
|
+
const bytes = new Uint8Array(size);
|
|
25
|
+
let offset = 0;
|
|
26
|
+
for (const chunk of chunks) {
|
|
27
|
+
bytes.set(chunk, offset);
|
|
28
|
+
offset += chunk.byteLength;
|
|
29
|
+
}
|
|
30
|
+
return bytes;
|
|
31
|
+
}
|
|
32
|
+
function registerEndpointToolRoutes(authenticated, deps) {
|
|
33
|
+
authenticated.get("/api/endpoint-tools/principals", (c) => {
|
|
34
|
+
const endpointsByPrincipal = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const endpoint of deps.service.endpointTools.registry.list()) {
|
|
36
|
+
const endpoints = endpointsByPrincipal.get(endpoint.principalId) ?? [];
|
|
37
|
+
endpoints.push(endpoint);
|
|
38
|
+
endpointsByPrincipal.set(endpoint.principalId, endpoints);
|
|
39
|
+
}
|
|
40
|
+
return c.json({
|
|
41
|
+
ok: true,
|
|
42
|
+
payload: listEndpointPrincipals().map(({ publicKey: _publicKey, ...principal }) => ({
|
|
43
|
+
...principal,
|
|
44
|
+
endpoints: endpointsByPrincipal.get(principal.id) ?? []
|
|
45
|
+
}))
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
authenticated.post("/api/endpoint-tools/principals", async (c) => {
|
|
49
|
+
const parsed = endpointPrincipalRegistrationSchema.safeParse(await c.req.json().catch(() => null));
|
|
50
|
+
if (!parsed.success) return c.json({
|
|
51
|
+
ok: false,
|
|
52
|
+
error: {
|
|
53
|
+
code: "BAD_REQUEST",
|
|
54
|
+
message: "Invalid endpoint principal"
|
|
55
|
+
}
|
|
56
|
+
}, 400);
|
|
57
|
+
try {
|
|
58
|
+
parseEndpointPublicKey(parsed.data.publicKey);
|
|
59
|
+
} catch {
|
|
60
|
+
return c.json({
|
|
61
|
+
ok: false,
|
|
62
|
+
error: {
|
|
63
|
+
code: "BAD_REQUEST",
|
|
64
|
+
message: "Invalid endpoint public key"
|
|
65
|
+
}
|
|
66
|
+
}, 400);
|
|
67
|
+
}
|
|
68
|
+
const existing = getEndpointPrincipal(parsed.data.principalId);
|
|
69
|
+
if (existing && !existing.revokedAt && existing.displayName === parsed.data.displayName && existing.kind === parsed.data.kind && existing.platform === parsed.data.platform && existing.publicKey === parsed.data.publicKey) return c.json({
|
|
70
|
+
ok: true,
|
|
71
|
+
payload: existing
|
|
72
|
+
}, 200);
|
|
73
|
+
if (existing) {
|
|
74
|
+
if (existing.revokedAt) return c.json({
|
|
75
|
+
ok: false,
|
|
76
|
+
error: {
|
|
77
|
+
code: "PRINCIPAL_REVOKED",
|
|
78
|
+
message: "Endpoint principal was revoked"
|
|
79
|
+
}
|
|
80
|
+
}, 403);
|
|
81
|
+
return c.json({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: {
|
|
84
|
+
code: "CONFLICT",
|
|
85
|
+
message: "Endpoint principal already exists"
|
|
86
|
+
}
|
|
87
|
+
}, 409);
|
|
88
|
+
}
|
|
89
|
+
const principal = createEndpointPrincipal({
|
|
90
|
+
id: parsed.data.principalId,
|
|
91
|
+
displayName: parsed.data.displayName,
|
|
92
|
+
kind: parsed.data.kind,
|
|
93
|
+
platform: parsed.data.platform,
|
|
94
|
+
publicKey: parsed.data.publicKey
|
|
95
|
+
});
|
|
96
|
+
return c.json({
|
|
97
|
+
ok: true,
|
|
98
|
+
payload: principal
|
|
99
|
+
}, 201);
|
|
100
|
+
});
|
|
101
|
+
authenticated.delete("/api/endpoint-tools/principals/:principalId", (c) => {
|
|
102
|
+
const principalId = c.req.param("principalId").trim();
|
|
103
|
+
if (!principalId) return c.json({
|
|
104
|
+
ok: false,
|
|
105
|
+
error: {
|
|
106
|
+
code: "BAD_REQUEST",
|
|
107
|
+
message: "Missing principal id"
|
|
108
|
+
}
|
|
109
|
+
}, 400);
|
|
110
|
+
if (!revokeEndpointPrincipal(principalId)) return c.json({
|
|
111
|
+
ok: false,
|
|
112
|
+
error: {
|
|
113
|
+
code: "NOT_FOUND",
|
|
114
|
+
message: "Endpoint principal not found"
|
|
115
|
+
}
|
|
116
|
+
}, 404);
|
|
117
|
+
for (const endpoint of deps.service.endpointTools.registry.list()) if (endpoint.principalId === principalId) deps.service.endpointTools.disconnect(endpoint.endpointId, "Endpoint principal revoked");
|
|
118
|
+
return c.json({
|
|
119
|
+
ok: true,
|
|
120
|
+
payload: {
|
|
121
|
+
principalId,
|
|
122
|
+
revoked: true
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
authenticated.get("/api/endpoint-tools/invocations", (c) => {
|
|
127
|
+
const limit = Number(c.req.query("limit") ?? 100);
|
|
128
|
+
return c.json({
|
|
129
|
+
ok: true,
|
|
130
|
+
payload: listEndpointToolInvocationAudits(Number.isFinite(limit) ? limit : 100)
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
authenticated.post("/api/endpoint-tools/invocations/:invocationId/files", async (c) => {
|
|
134
|
+
const invocationId = c.req.param("invocationId");
|
|
135
|
+
const endpointId = c.req.header("x-endpoint-id") ?? "";
|
|
136
|
+
const token = c.req.header("x-endpoint-upload-token") ?? "";
|
|
137
|
+
const name = c.req.query("name") ?? "";
|
|
138
|
+
const mimeType = c.req.header("content-type")?.split(";", 1)[0]?.trim() ?? "";
|
|
139
|
+
if (Number(c.req.header("content-length") ?? 0) > ENDPOINT_UPLOAD_MAX_BYTES) return c.json({
|
|
140
|
+
ok: false,
|
|
141
|
+
error: {
|
|
142
|
+
code: "RESULT_TOO_LARGE",
|
|
143
|
+
message: "Uploaded file is too large"
|
|
144
|
+
}
|
|
145
|
+
}, 413);
|
|
146
|
+
try {
|
|
147
|
+
const bytes = await readBoundedBody(c.req.raw.body, ENDPOINT_UPLOAD_MAX_BYTES);
|
|
148
|
+
const file = deps.service.endpointTools.uploads.upload({
|
|
149
|
+
invocationId,
|
|
150
|
+
endpointId,
|
|
151
|
+
token,
|
|
152
|
+
name,
|
|
153
|
+
mimeType,
|
|
154
|
+
bytes
|
|
155
|
+
});
|
|
156
|
+
return c.json({
|
|
157
|
+
ok: true,
|
|
158
|
+
payload: {
|
|
159
|
+
type: "file",
|
|
160
|
+
fileId: file.fileId,
|
|
161
|
+
name: file.name,
|
|
162
|
+
mimeType: file.mimeType,
|
|
163
|
+
size: file.size,
|
|
164
|
+
sha256: file.sha256
|
|
165
|
+
}
|
|
166
|
+
}, 201);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
169
|
+
return c.json({
|
|
170
|
+
ok: false,
|
|
171
|
+
error: {
|
|
172
|
+
code: error instanceof EndpointUploadError ? "INVALID_UPLOAD_GRANT" : "UPLOAD_FAILED",
|
|
173
|
+
message
|
|
174
|
+
}
|
|
175
|
+
}, 400);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
authenticated.get("/api/endpoint-tools/files/:fileId", (c) => {
|
|
179
|
+
const file = deps.service.endpointTools.uploads.getFile(c.req.param("fileId"));
|
|
180
|
+
const bytes = file && deps.service.endpointTools.uploads.readFile(file.fileId);
|
|
181
|
+
if (!file || !bytes) return c.json({
|
|
182
|
+
ok: false,
|
|
183
|
+
error: {
|
|
184
|
+
code: "NOT_FOUND",
|
|
185
|
+
message: "Endpoint file not found"
|
|
186
|
+
}
|
|
187
|
+
}, 404);
|
|
188
|
+
c.header("Content-Type", file.mimeType);
|
|
189
|
+
c.header("Content-Length", String(file.size));
|
|
190
|
+
c.header("Content-Disposition", `attachment; filename*=UTF-8''${encodeURIComponent(file.name)}`);
|
|
191
|
+
const body = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
192
|
+
return c.body(body);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { registerEndpointToolRoutes };
|
|
@@ -3,15 +3,17 @@ import { registerAgentStreamRoutes } from "./agent-stream.js";
|
|
|
3
3
|
import { registerDiscussionRoutes } from "./discussions.js";
|
|
4
4
|
import { registerSessionsRoutes } from "./sessions.js";
|
|
5
5
|
import { registerStatusRoutes } from "./status.js";
|
|
6
|
-
import { registerMemoryRoutes } from "./memory.js";
|
|
7
6
|
import { registerProjectsRoutes } from "./projects.js";
|
|
8
7
|
import { registerProjectSkillRoutes } from "./project-skills.js";
|
|
9
8
|
import { registerSearchRoutes } from "./search.js";
|
|
10
9
|
import { registerMobileRoutes } from "./mobile.js";
|
|
11
10
|
import { registerInteractionStateRoutes } from "./interaction-state.js";
|
|
12
11
|
import { registerComposerHistoryRoutes } from "./composer-history.js";
|
|
12
|
+
import { registerEndpointToolRoutes } from "./endpoint-tools.js";
|
|
13
|
+
import { registerRealtimeRoutes } from "./realtime.js";
|
|
13
14
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
14
15
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
16
|
+
import { registerUnderstandingSourceRoutes } from "./understanding-sources.js";
|
|
15
17
|
import { registerTaskRoutes } from "./tasks.js";
|
|
16
18
|
import { registerProactiveRoutes } from "./proactive.js";
|
|
17
19
|
import { mountAppLazyRoutePrefixes, registerAuthenticatedLazyRouteFallback } from "./lazy-fallback.js";
|
|
@@ -20,19 +22,21 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
20
22
|
registerStatusRoutes(authenticated, deps);
|
|
21
23
|
registerAgentStreamRoutes(authenticated, deps);
|
|
22
24
|
registerSessionsRoutes(authenticated, deps);
|
|
23
|
-
registerMemoryRoutes(authenticated, deps);
|
|
24
25
|
registerActivityRoutes(authenticated, deps);
|
|
25
26
|
registerDiscussionRoutes(authenticated, deps);
|
|
26
27
|
registerProjectsRoutes(authenticated, deps);
|
|
27
28
|
registerProjectSkillRoutes(authenticated, deps);
|
|
28
29
|
registerLocalAppsRoutes(authenticated, deps);
|
|
29
30
|
registerWorkDiscoveryRoutes(authenticated, deps);
|
|
31
|
+
registerUnderstandingSourceRoutes(authenticated, deps);
|
|
30
32
|
registerTaskRoutes(authenticated, deps);
|
|
31
33
|
registerProactiveRoutes(authenticated, deps);
|
|
32
34
|
registerSearchRoutes(authenticated, deps);
|
|
33
35
|
registerMobileRoutes(authenticated, deps);
|
|
34
36
|
registerInteractionStateRoutes(authenticated, deps);
|
|
35
37
|
registerComposerHistoryRoutes(authenticated, deps);
|
|
38
|
+
registerEndpointToolRoutes(authenticated, deps);
|
|
39
|
+
registerRealtimeRoutes(authenticated, deps);
|
|
36
40
|
}
|
|
37
41
|
function registerAuthenticatedRoutes(app, authenticated, deps) {
|
|
38
42
|
registerCoreAuthenticatedRoutes(authenticated, deps);
|
|
@@ -94,11 +94,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
id: "agents",
|
|
97
|
-
match: (path) => startsWithAny(path, [
|
|
98
|
-
"/api/agents",
|
|
99
|
-
"/api/user-profile",
|
|
100
|
-
"/api/voice/models"
|
|
101
|
-
]),
|
|
97
|
+
match: (path) => startsWithAny(path, ["/api/agents", "/api/voice/models"]),
|
|
102
98
|
load: async () => {
|
|
103
99
|
const { registerAgentsRoutes } = await import("./agents.js");
|
|
104
100
|
return { register: registerAgentsRoutes };
|
|
@@ -131,10 +131,6 @@ function registerLogsRoutes(authenticated, _deps) {
|
|
|
131
131
|
const { getLogLevel } = await import("../../../utils/logger.js");
|
|
132
132
|
return c.json({ level: getLogLevel() });
|
|
133
133
|
});
|
|
134
|
-
authenticated.get("/api/logs/stream", async (c) => {
|
|
135
|
-
const { createLogSSEHandler } = await import("../../../utils/logger/log-stream.js");
|
|
136
|
-
return createLogSSEHandler()(c);
|
|
137
|
-
});
|
|
138
134
|
}
|
|
139
135
|
//#endregion
|
|
140
136
|
export { registerLogsRoutes };
|
|
@@ -110,10 +110,10 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
110
110
|
"POST /api/sessions/:sessionKey/inputs",
|
|
111
111
|
"GET /api/sessions/:sessionKey/input-state",
|
|
112
112
|
"PATCH/DELETE /api/sessions/:sessionKey/inputs/:inputId",
|
|
113
|
-
"POST /api/agent/resume (SSE stream)",
|
|
114
113
|
"POST /api/agent/abort",
|
|
115
114
|
"POST /api/send",
|
|
116
|
-
"
|
|
115
|
+
"POST /api/realtime/tickets",
|
|
116
|
+
"WS /api/realtime/v1/ws",
|
|
117
117
|
"GET /api/channels/catalog",
|
|
118
118
|
"GET /api/channels/status",
|
|
119
119
|
"POST /api/channels/:channelId/actions/:actionId",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { realtimeClientKindSchema } from "../../../../packages/realtime-protocol/src/index.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/gateway/hono/routes/realtime.ts
|
|
4
|
+
const ticketRequestSchema = z.strictObject({
|
|
5
|
+
clientId: z.string().min(1).max(160),
|
|
6
|
+
clientKind: realtimeClientKindSchema
|
|
7
|
+
});
|
|
8
|
+
function registerRealtimeRoutes(authenticated, deps) {
|
|
9
|
+
authenticated.post("/api/realtime/tickets", async (c) => {
|
|
10
|
+
const parsed = ticketRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
11
|
+
if (!parsed.success) return c.json({
|
|
12
|
+
ok: false,
|
|
13
|
+
error: {
|
|
14
|
+
code: "BAD_REQUEST",
|
|
15
|
+
message: "Invalid realtime ticket request"
|
|
16
|
+
}
|
|
17
|
+
}, 400);
|
|
18
|
+
try {
|
|
19
|
+
return c.json({
|
|
20
|
+
ok: true,
|
|
21
|
+
payload: deps.service.realtime.tickets.issue(parsed.data.clientId, parsed.data.clientKind)
|
|
22
|
+
});
|
|
23
|
+
} catch (error) {
|
|
24
|
+
return c.json({
|
|
25
|
+
ok: false,
|
|
26
|
+
error: {
|
|
27
|
+
code: "TICKET_LIMIT",
|
|
28
|
+
message: error instanceof Error ? error.message : "Ticket issue failed"
|
|
29
|
+
}
|
|
30
|
+
}, 503);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { registerRealtimeRoutes };
|
|
@@ -34,7 +34,6 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
34
34
|
const models = asRecord(manifest.models);
|
|
35
35
|
const tools = asRecord(manifest.tools);
|
|
36
36
|
const skills = manifest.skills ?? [];
|
|
37
|
-
const codeIntelligence = config.codeIntelligence;
|
|
38
37
|
return {
|
|
39
38
|
ok: true,
|
|
40
39
|
payload: {
|
|
@@ -48,12 +47,6 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
48
47
|
systemPromptConfigHash: contentHash(manifest.systemPrompt ?? null),
|
|
49
48
|
toolPolicyHash: contentHash(tools),
|
|
50
49
|
skillPolicyHash: contentHash(skills),
|
|
51
|
-
codeIntelligence: {
|
|
52
|
-
enabled: codeIntelligence?.enabled === true,
|
|
53
|
-
configuredForAgent: codeIntelligence?.agentIds?.includes(agentId) === true,
|
|
54
|
-
indexMode: codeIntelligence?.indexMode ?? null,
|
|
55
|
-
configHash: contentHash(codeIntelligence ?? null)
|
|
56
|
-
},
|
|
57
50
|
presetChain: effective.data.sources
|
|
58
51
|
}
|
|
59
52
|
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings } from "../../../storage/sqlite/user-context-repository.js";
|
|
2
|
+
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
|
+
import "../../../storage/sqlite/index.js";
|
|
4
|
+
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
|
|
5
|
+
import { getWorkDiscoveryService } from "./work-discovery.js";
|
|
6
|
+
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
7
|
+
//#region src/gateway/hono/routes/understanding-sources.ts
|
|
8
|
+
function stringField(body, field) {
|
|
9
|
+
if (!body || typeof body !== "object") return "";
|
|
10
|
+
const value = body[field];
|
|
11
|
+
return typeof value === "string" ? value.trim() : "";
|
|
12
|
+
}
|
|
13
|
+
function decisionsFrom(body) {
|
|
14
|
+
return (body && typeof body === "object" && Array.isArray(body.decisions) ? body.decisions : []).flatMap((value) => {
|
|
15
|
+
if (!value || typeof value !== "object") return [];
|
|
16
|
+
const item = value;
|
|
17
|
+
const understandingId = typeof item.understandingId === "string" ? item.understandingId.trim() : "";
|
|
18
|
+
const status = item.status === "accepted" || item.status === "edited" || item.status === "rejected" ? item.status : null;
|
|
19
|
+
if (!understandingId || !status) return [];
|
|
20
|
+
return [{
|
|
21
|
+
understandingId,
|
|
22
|
+
status,
|
|
23
|
+
...typeof item.statement === "string" ? { statement: item.statement } : {}
|
|
24
|
+
}];
|
|
25
|
+
}).slice(0, 20);
|
|
26
|
+
}
|
|
27
|
+
function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
28
|
+
const service = getWorkDiscoveryService(deps);
|
|
29
|
+
const limited = deps.strictRateLimitMiddleware;
|
|
30
|
+
authenticated.get("/api/understanding/sources/catalog", (c) => {
|
|
31
|
+
const requested = c.req.query("platform");
|
|
32
|
+
const platform = requested === "darwin" || requested === "win32" || requested === "linux" ? requested : process.platform;
|
|
33
|
+
return c.json({
|
|
34
|
+
ok: true,
|
|
35
|
+
sources: listUnderstandingSourceDefinitions(platform)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
authenticated.get("/api/understanding/sources/grants", (c) => c.json({
|
|
39
|
+
ok: true,
|
|
40
|
+
grants: listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" })
|
|
41
|
+
}));
|
|
42
|
+
authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
|
|
43
|
+
const current = getUnderstandingSourceGrant(c.req.param("grantId"));
|
|
44
|
+
const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
|
|
45
|
+
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
46
|
+
if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
|
|
47
|
+
const grant = revokeUnderstandingSourceGrant(c.req.param("grantId"));
|
|
48
|
+
if (grant && c.req.query("deleteDerived") === "true") {
|
|
49
|
+
const activeGrantIds = new Set(listUnderstandingSourceGrants().map((item) => item.id));
|
|
50
|
+
for (const understanding of listUnderstandings()) {
|
|
51
|
+
const grantEvidence = listUnderstandingEvidence(understanding.id).map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
|
|
52
|
+
if (grantEvidence.includes(grant.id) && !grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id))) deleteUnderstanding(understanding.id);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return grant ? c.json({
|
|
56
|
+
ok: true,
|
|
57
|
+
grant
|
|
58
|
+
}) : c.json({
|
|
59
|
+
ok: false,
|
|
60
|
+
error: "Source grant not found"
|
|
61
|
+
}, 404);
|
|
62
|
+
});
|
|
63
|
+
authenticated.post("/api/understanding/sources/grants/:grantId/refresh", limited, async (c) => {
|
|
64
|
+
const grant = getUnderstandingSourceGrant(c.req.param("grantId"));
|
|
65
|
+
if (!grant || grant.status !== "active") return c.json({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: "Active source grant not found"
|
|
68
|
+
}, 404);
|
|
69
|
+
try {
|
|
70
|
+
if (grant.adapterId === "local-work-folders") {
|
|
71
|
+
const result = await service.refreshDirectorySourceIfChanged({
|
|
72
|
+
id: grant.id,
|
|
73
|
+
idempotencyKey: crypto.randomUUID()
|
|
74
|
+
});
|
|
75
|
+
return c.json({
|
|
76
|
+
ok: true,
|
|
77
|
+
result
|
|
78
|
+
}, result.changed ? 202 : 200);
|
|
79
|
+
}
|
|
80
|
+
const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : "";
|
|
81
|
+
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
82
|
+
if (connectionId) {
|
|
83
|
+
const job = deps.service.requestConnectorLearning(connectionId, {
|
|
84
|
+
mode: "incremental",
|
|
85
|
+
reason: "manual"
|
|
86
|
+
});
|
|
87
|
+
return job ? c.json({
|
|
88
|
+
ok: true,
|
|
89
|
+
job
|
|
90
|
+
}, 202) : c.json({
|
|
91
|
+
ok: false,
|
|
92
|
+
error: "Source does not support learning"
|
|
93
|
+
}, 409);
|
|
94
|
+
}
|
|
95
|
+
return c.json({
|
|
96
|
+
ok: false,
|
|
97
|
+
error: "This source is collected from the desktop app"
|
|
98
|
+
}, 409);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
return c.json({
|
|
101
|
+
ok: false,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error)
|
|
103
|
+
}, 400);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
authenticated.get("/api/understanding/sources/work-folders", (c) => c.json({
|
|
107
|
+
ok: true,
|
|
108
|
+
sources: service.listDirectorySources()
|
|
109
|
+
}));
|
|
110
|
+
authenticated.post("/api/understanding/sources/work-folders", limited, async (c) => {
|
|
111
|
+
const rootPath = stringField(await c.req.json().catch(() => null), "rootPath");
|
|
112
|
+
if (!rootPath) return c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: "Missing rootPath"
|
|
115
|
+
}, 400);
|
|
116
|
+
try {
|
|
117
|
+
return c.json({
|
|
118
|
+
ok: true,
|
|
119
|
+
source: await service.grantDirectorySource(rootPath)
|
|
120
|
+
}, 201);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return c.json({
|
|
123
|
+
ok: false,
|
|
124
|
+
error: error instanceof Error ? error.message : String(error)
|
|
125
|
+
}, 400);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
authenticated.post("/api/understanding/sources/work-folders/:grantId/runs", limited, async (c) => {
|
|
129
|
+
try {
|
|
130
|
+
const run = await service.rescanDirectorySource({
|
|
131
|
+
id: c.req.param("grantId"),
|
|
132
|
+
idempotencyKey: crypto.randomUUID()
|
|
133
|
+
});
|
|
134
|
+
return c.json({
|
|
135
|
+
ok: true,
|
|
136
|
+
run
|
|
137
|
+
}, 202);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return c.json({
|
|
140
|
+
ok: false,
|
|
141
|
+
error: error instanceof Error ? error.message : String(error)
|
|
142
|
+
}, 400);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
authenticated.post("/api/understanding/bootstrap", limited, async (c) => {
|
|
146
|
+
const body = await c.req.json().catch(() => null);
|
|
147
|
+
const items = body && typeof body === "object" && Array.isArray(body.items) ? body.items.slice(0, 150) : [];
|
|
148
|
+
if (!items.length) return c.json({
|
|
149
|
+
ok: false,
|
|
150
|
+
error: "No understanding source items were provided"
|
|
151
|
+
}, 400);
|
|
152
|
+
try {
|
|
153
|
+
const result = await service.importUnderstandingSources(items, c.req.raw.signal, stringField(body, "workDiscoveryRunId") || void 0);
|
|
154
|
+
return c.json({
|
|
155
|
+
ok: true,
|
|
156
|
+
...result
|
|
157
|
+
}, 201);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
return c.json({
|
|
160
|
+
ok: false,
|
|
161
|
+
error: error instanceof Error ? error.message : String(error)
|
|
162
|
+
}, 400);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
authenticated.post("/api/understanding/review", limited, async (c) => {
|
|
166
|
+
const decisions = decisionsFrom(await c.req.json().catch(() => null));
|
|
167
|
+
if (!decisions.length) return c.json({
|
|
168
|
+
ok: false,
|
|
169
|
+
error: "At least one valid decision is required"
|
|
170
|
+
}, 400);
|
|
171
|
+
return c.json({
|
|
172
|
+
ok: true,
|
|
173
|
+
decisions: service.updateUnderstandingSourceProfile({ decisions })
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
authenticated.get("/api/understanding/focuses", (c) => c.json({
|
|
177
|
+
ok: true,
|
|
178
|
+
focuses: listUserFocuses()
|
|
179
|
+
}));
|
|
180
|
+
authenticated.patch("/api/understanding/focuses/:focusId", limited, async (c) => {
|
|
181
|
+
const requested = stringField(await c.req.json().catch(() => null), "status");
|
|
182
|
+
if (!new Set([
|
|
183
|
+
"candidate",
|
|
184
|
+
"active",
|
|
185
|
+
"paused",
|
|
186
|
+
"completed",
|
|
187
|
+
"rejected"
|
|
188
|
+
]).has(requested)) return c.json({
|
|
189
|
+
ok: false,
|
|
190
|
+
error: "Invalid focus status"
|
|
191
|
+
}, 400);
|
|
192
|
+
const focus = setUserFocusStatus(c.req.param("focusId"), requested);
|
|
193
|
+
return focus ? c.json({
|
|
194
|
+
ok: true,
|
|
195
|
+
focus
|
|
196
|
+
}) : c.json({
|
|
197
|
+
ok: false,
|
|
198
|
+
error: "Focus not found"
|
|
199
|
+
}, 404);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { registerUnderstandingSourceRoutes };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
|
+
import { WorkDiscoveryService } from '../../../work-discovery/service.js';
|
|
2
3
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
4
|
+
export declare function getWorkDiscoveryService(deps: AuthenticatedRouteDeps): WorkDiscoveryService;
|
|
3
5
|
export declare function registerWorkDiscoveryRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|