@xopcai/xopc 0.0.314 → 0.0.316
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BFkjfurL.js → agent-avatar-dicebear-XIyH14Sn.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DJl_o7Xf.js +1 -0
- package/dist/gateway/static/root/assets/agents-CGFhxPFv.js +1 -0
- package/dist/gateway/static/root/assets/{api-BYhRsTAc.js → api-Dy056n2_.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B4kihr-A.js → app-management-settings-panel-Dp7Fcj2Z.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-N9sYmNOx.js → appearance-settings-CSUffLjx.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BMcy10_s.js → apps-page-DtIcKfJG.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-k_SuYWyV.js → archive-plugin-D3SdndlF.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DRv5QWUK.js → attachment-load-BgxXYRkd.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CkJV3DN0.js → automations-page-krhofMgL.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-EbpneB06.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Dg3h3TA7.js → binary-plugins-w6lazTqo.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DVhdHntT.js → block-editor-CxHqPODE.js} +5 -5
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BMRYUW8_.js → browser-automation-inputs-hNdEgfGG.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Byv6-FY2.js → browser-automations-page-BYsGJ_xs.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CP_c5q0V.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ljW3s3vv.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-CR9SRgFp.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D4AHa51o.js → chat-terminal-dock-medSiQoQ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-eXPe500D.js → computer-settings-page-DJxO0CfY.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BQTFlq_k.js → connector-service-page-WaoUqr8a.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-KIi15pQl.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-7MtovynY.js → date-picker-DalDr0E6.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Bj_xkXID.js → dependency-picker-ONChq2Yr.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CTmba9zH.js → desktop-pet-b1a37SVn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DNM_BlWN.js → desktop-pet-settings-CwqZxGv4.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C_MNpS30.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-J_olaL7e.js → extension-debug-page-CGthPGca.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-pK5RvqN8.js → extension-page-CExNJs0G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BwroEN08.js → extension-settings-page-DBfxzKR8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-FuJTIg_a.js → gateway-config-swr-DFjsI4QK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BlpheZrf.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CKg_gu8_.js → gateway-startup-retry-oRRqSoe9.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BvdT-uaI.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bo6NZ7zb.js → image-generation-api-CyDy_Sxu.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C8-hX8gS.js → imports-page-Dnp2hmFL.js} +1 -1
- package/dist/gateway/static/root/assets/index-BYKatjhB.css +1 -0
- package/dist/gateway/static/root/assets/index-DhCnwCI9.js +89 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BkBEjUZD.js → keyboard-shortcuts-settings-1DUcGrYh.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BW2-80Og.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CrbKIixo.js → local-apps-page-C7_2zyV_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CvGwNbml.js → locale-store-D6VmRI5e.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DBHlZts9.js → logs-page-Cbr7bPM6.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-G7GcFx2_.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-nXo5nrsv.js → markdown-view-B5MfZeKH.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-upxXJ-4l.js → media-plugins-IbcEpV96.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BCqLsIZK.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C4DiKkDf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DgHQmpVq.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DUyA-K4L.js → page-context-capture-button-B5rZ_F0R.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-Cl-NFPNr.js → page-tabs-B84Yghg5.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DX81PwJ3.js → preview-open-alternatives-CaEtDmZO.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CrfIGwm8.js → product-open-page-BK9z5b-v.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Qj8Xb9qS.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-nM9a9XNS.js → projects-page-BOp6swwM.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CHxgohY0.js → registry-api-sOL6E5LU.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-yb8l4ppq.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D3dLOW04.js → runtime-tools-settings-panel-BAvzw1T0.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-CiAgb7hf.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-ZxuIvD2_.js → schema-form-Dytkw9RZ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-43hcOW84.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C414vr2V.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-TZRfg4yo.js → settings-form-section-DBJlmKQV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-a8qcJpdZ.js → settings-page-C9GbP-ZG.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BfvlRT9q.js → settings-page-layout-OvBOGen7.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BCMym4xj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DCt1pTWB.js → share-preview-page-D-sx26yN.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-EdNGhsuF.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DYYM1qVn.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BIOcg44X.js → skills-page-Cgrfnet5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CgZdzT4I.js → skills-page.utils-COPGVfmB.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-_YaRncA6.js → system-settings-panel-B9tptggE.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BrsM6Xmm.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-uOupJOoS.js → tunnel-api-qb33IFGP.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BezzHBLE.js → use-autosave-DfhqCGRX.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-Sg94U7zz.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BmYifdwL.js → voice-api-key-field-taBVzvtI.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D_5Q2_A3.js → voice-config-api-B4yjd1Kb.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-4DmyEckJ.js → work-discovery-overlay-DWGTB3Uk.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DeZe8bTZ.js → workflow-run-setup-panel-CP58uTNh.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Clka1xiQ.js +6 -0
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +18 -17
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +28 -15
- package/dist/src/agent/embedded/system-prompt-override.js +14 -3
- package/dist/src/agent/embedded/xopc-stream-bridge.js +13 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +39 -0
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +32 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +11 -0
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +2 -1
- package/dist/src/agent/mcp/mcp-resource-id.d.ts +6 -0
- package/dist/src/agent/mcp/mcp-resource-id.js +19 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/context-budget.js +1 -1
- package/dist/src/agent/orchestration/agent-turn-policy.d.ts +2 -2
- package/dist/src/agent/prompt/agent-system-prompt.d.ts +3 -0
- package/dist/src/agent/prompt/agent-system-prompt.js +16 -0
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/source-context/browser-tab.d.ts +3 -0
- package/dist/src/agent/source-context/browser-tab.js +29 -0
- package/dist/src/agent/source-context/file-context.d.ts +3 -0
- package/dist/src/agent/source-context/file-context.js +64 -0
- package/dist/src/agent/source-context/index.d.ts +4 -0
- package/dist/src/agent/source-context/index.js +5 -1
- package/dist/src/agent/source-context/injector.js +1 -1
- package/dist/src/agent/source-context/mcp-resource-context.d.ts +8 -0
- package/dist/src/agent/source-context/mcp-resource-context.js +30 -0
- package/dist/src/agent/source-context/session-context.d.ts +8 -0
- package/dist/src/agent/source-context/session-context.js +33 -0
- package/dist/src/agent/source-context/types.d.ts +9 -3
- package/dist/src/agent/source-context/types.js +3 -2
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -0
- package/dist/src/agent-config/schema.d.ts +8 -8
- package/dist/src/ai-assist/text-assist.js +3 -2
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.d.ts +8 -8
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/schema.d.ts +5 -5
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.d.ts +1 -0
- package/dist/src/connectors/connected-source-ingestion.js +1 -0
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +91 -31
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +3 -1
- package/dist/src/connectors/learning-coordinator.js +24 -24
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +12 -6
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +2 -2
- package/dist/src/gateway/hono/routes/browser.js +32 -0
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +0 -16
- package/dist/src/gateway/hono/routes/endpoint-tools.js +86 -30
- package/dist/src/gateway/hono/routes/mcp.js +32 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +6 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
- package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -2
- package/dist/src/gateway/service/agent-runner.d.ts +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/app-context-access.d.ts +0 -4
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +3 -3
- package/dist/src/gateway/service.js +47 -10
- package/dist/src/gateway/workspace-file-search.js +25 -12
- package/dist/src/knowledge/ingestion-service.d.ts +5 -2
- package/dist/src/knowledge/ingestion-service.js +24 -15
- package/dist/src/knowledge-memory/domain.d.ts +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/platform/client.d.ts +2 -2
- package/dist/src/platform/contracts.d.ts +2 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js +6 -4
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-call.js +3 -3
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/presentation.js +4 -3
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/client-history.d.ts +2 -1
- package/dist/src/session/client-history.js +3 -2
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +1 -2
- package/dist/src/storage/sqlite/context-extraction-repository.js +1 -9
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +15 -1
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +39 -6
- package/dist/src/storage/sqlite/index.d.ts +2 -3
- package/dist/src/storage/sqlite/index.js +3 -4
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +3 -0
- package/dist/src/storage/sqlite/migrations/200_connected_work_threads.sql +92 -0
- package/dist/src/storage/sqlite/migrations/201_connector_extraction_audit.sql +127 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/user-context/domain.d.ts +0 -13
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +10 -0
- package/dist/src/user-context/sources/repository.js +19 -4
- package/dist/src/user-context/sources/types.d.ts +1 -0
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BdOZ6q8Z.js +0 -1
- package/dist/gateway/static/root/assets/agents-CCcavsHq.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BEa2doeR.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-DRCHGFpO.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-mxRP0gl0.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DBt_6GsB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BKeBWwcI.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-C2XE0QhT.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLLDp23J.js +0 -1
- package/dist/gateway/static/root/assets/home-page-B5Epb1PH.js +0 -1
- package/dist/gateway/static/root/assets/index-14F1yGJI.js +0 -89
- package/dist/gateway/static/root/assets/index-cB7rWIDY.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-6jC3vQpY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DsUWLu5m.js +0 -1
- package/dist/gateway/static/root/assets/messages-B_AwRroN.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-0Q9TOtJG.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D0NmcwNw.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BVfVrYmn.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C8b_k88G.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DEowreZV.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-B_nPhera.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqhIOuus.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CRj5Ruqn.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BNbXPk--.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNMCLbav.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CAcfAG-c.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BFFeneDq.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Sv4hEc6W.js +0 -6
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +0 -50
- package/dist/src/storage/sqlite/context-relation-repository.js +0 -98
|
@@ -28,7 +28,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
28
28
|
primary: string;
|
|
29
29
|
fallbacks: string[];
|
|
30
30
|
};
|
|
31
|
-
intents?: Partial<Record<"review" | "coding" | "
|
|
31
|
+
intents?: Partial<Record<"review" | "coding" | "fast" | "reasoning" | "vision" | "understanding", {
|
|
32
32
|
primary: string;
|
|
33
33
|
fallbacks: string[];
|
|
34
34
|
}>>;
|
|
@@ -72,7 +72,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
72
72
|
primary: string;
|
|
73
73
|
fallbacks: string[];
|
|
74
74
|
};
|
|
75
|
-
intents: Partial<Record<"review" | "coding" | "
|
|
75
|
+
intents: Partial<Record<"review" | "coding" | "fast" | "reasoning" | "vision" | "understanding", {
|
|
76
76
|
primary: string;
|
|
77
77
|
fallbacks: string[];
|
|
78
78
|
}>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
2
2
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
3
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
4
|
-
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
5
4
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
6
5
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
6
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
7
7
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
8
8
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
9
9
|
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
@@ -57,7 +57,7 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
57
57
|
ok: false,
|
|
58
58
|
error: {
|
|
59
59
|
code: "BAD_REQUEST",
|
|
60
|
-
message: "Invalid
|
|
60
|
+
message: "Invalid source context references"
|
|
61
61
|
}
|
|
62
62
|
}, 400);
|
|
63
63
|
if (body.content !== void 0) {
|
|
@@ -93,7 +93,7 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
93
93
|
ok: false,
|
|
94
94
|
error: {
|
|
95
95
|
code: result.contextUnavailable ? "CONTEXT_UNAVAILABLE" : "CONFLICT",
|
|
96
|
-
message: result.contextUnavailable ? "A referenced
|
|
96
|
+
message: result.contextUnavailable ? "A referenced source changed or is no longer available. Select it again." : "Input changed"
|
|
97
97
|
},
|
|
98
98
|
payload: result.state
|
|
99
99
|
}, 409);
|
|
@@ -78,6 +78,38 @@ function canManageBrowserSession(c, service, conversationId) {
|
|
|
78
78
|
}
|
|
79
79
|
function registerBrowserRoutes(authenticated, deps) {
|
|
80
80
|
const { service, strictRateLimitMiddleware } = deps;
|
|
81
|
+
authenticated.get("/api/browser/tabs", (c) => {
|
|
82
|
+
const conversationId = (c.req.query("conversationId") ?? "").trim();
|
|
83
|
+
if (!conversationId) return c.json({
|
|
84
|
+
ok: false,
|
|
85
|
+
error: {
|
|
86
|
+
code: "BAD_REQUEST",
|
|
87
|
+
message: "Missing conversationId"
|
|
88
|
+
}
|
|
89
|
+
}, 400);
|
|
90
|
+
const binding = getBrowserTabBinding(conversationId);
|
|
91
|
+
if (!binding) return c.json({
|
|
92
|
+
ok: true,
|
|
93
|
+
payload: { tabs: [] }
|
|
94
|
+
});
|
|
95
|
+
if (!canManageBrowserSession(c, service, conversationId)) return c.json({
|
|
96
|
+
ok: false,
|
|
97
|
+
error: {
|
|
98
|
+
code: "FORBIDDEN",
|
|
99
|
+
message: "Tab binding belongs to another device"
|
|
100
|
+
}
|
|
101
|
+
}, 403);
|
|
102
|
+
return c.json({
|
|
103
|
+
ok: true,
|
|
104
|
+
payload: { tabs: [{
|
|
105
|
+
id: binding.id,
|
|
106
|
+
title: new URL(binding.urlOrigin).hostname,
|
|
107
|
+
url: binding.urlOrigin,
|
|
108
|
+
documentId: binding.documentId,
|
|
109
|
+
active: true
|
|
110
|
+
}] }
|
|
111
|
+
});
|
|
112
|
+
});
|
|
81
113
|
authenticated.get("/api/browser/tab-bindings/:conversationId", (c) => {
|
|
82
114
|
const conversationId = c.req.param("conversationId").trim();
|
|
83
115
|
const binding = getBrowserTabBinding(conversationId);
|
|
@@ -19,7 +19,6 @@ import { createConnectorSetupSecretRequest, submitConnectorSetupSecret } from ".
|
|
|
19
19
|
import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
|
|
20
20
|
import { getConnectorInstance, getInstalledConnectorDefinition, listConnectorInstances } from "../../../connectors/instances.js";
|
|
21
21
|
import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
|
|
22
|
-
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
23
22
|
import { resumeApprovedConnectorAction } from "../../../connectors/approval-resume.js";
|
|
24
23
|
import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
25
24
|
import { startConnectorAuthorization } from "../../../connectors/auth-provider-registry.js";
|
|
@@ -27,6 +26,7 @@ import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
|
27
26
|
import { inspectManagedComposioStatus } from "../../../connectors/composio-managed-client.js";
|
|
28
27
|
import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
|
|
29
28
|
import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
|
|
29
|
+
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
30
30
|
import { previewConnectorDefinition, testConnectorInstance } from "../../../connectors/health.js";
|
|
31
31
|
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
32
32
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
@@ -180,10 +180,6 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
180
180
|
}
|
|
181
181
|
}, 201);
|
|
182
182
|
});
|
|
183
|
-
authenticated.get("/api/devices", (c) => c.json({
|
|
184
|
-
ok: true,
|
|
185
|
-
devices: listDevices()
|
|
186
|
-
}));
|
|
187
183
|
authenticated.get("/api/devices/me", (c) => {
|
|
188
184
|
const principal = getGatewayPrincipal(c);
|
|
189
185
|
if (principal.kind !== "device" || !principal.deviceId) return c.json({
|
|
@@ -224,18 +220,6 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
224
220
|
revoked
|
|
225
221
|
});
|
|
226
222
|
});
|
|
227
|
-
authenticated.delete("/api/devices/:deviceId", (c) => {
|
|
228
|
-
const deviceId = c.req.param("deviceId");
|
|
229
|
-
const revoked = revokeDevice(deviceId);
|
|
230
|
-
if (revoked) {
|
|
231
|
-
deps.service.realtime.disconnectPrincipal(deviceId);
|
|
232
|
-
deps.service.voiceRealtime.disconnectPrincipal(deviceId);
|
|
233
|
-
}
|
|
234
|
-
return c.json({
|
|
235
|
-
ok: true,
|
|
236
|
-
revoked
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
223
|
}
|
|
240
224
|
//#endregion
|
|
241
225
|
export { registerDeviceAuthPublicRoutes, registerDeviceRoutes };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import { getDevice } from "../../../storage/sqlite/device-access-repository.js";
|
|
3
|
+
import { getDevice, listDevices, revokeDevice } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
4
|
import { endpointPrincipalRegistrationSchema, endpointSessionBindingRequestSchema, init_src } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
5
5
|
import { createEndpointPrincipal, getEndpointPrincipal, listEndpointPrincipals, revokeEndpointPrincipal } from "../../../storage/sqlite/endpoint-principal-repository.js";
|
|
6
|
-
import {
|
|
6
|
+
import { listEndpointToolInvocationAuditPage } from "../../../storage/sqlite/endpoint-tool-invocation-repository.js";
|
|
7
7
|
import "../../../storage/sqlite/index.js";
|
|
8
8
|
import { parseEndpointPublicKey } from "../../../endpoint-tools/auth.js";
|
|
9
9
|
import { ENDPOINT_UPLOAD_MAX_BYTES, EndpointUploadError } from "../../../endpoint-tools/upload-service.js";
|
|
@@ -42,19 +42,75 @@ async function readBoundedBody(body, maxBytes) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function registerEndpointToolRoutes(authenticated, deps) {
|
|
45
|
-
authenticated.get("/api/endpoint-tools/
|
|
45
|
+
authenticated.get("/api/endpoint-tools/devices", (c) => {
|
|
46
46
|
const endpointsByPrincipal = /* @__PURE__ */ new Map();
|
|
47
47
|
for (const endpoint of deps.service.endpointTools.registry.list()) {
|
|
48
48
|
const endpoints = endpointsByPrincipal.get(endpoint.principalId) ?? [];
|
|
49
49
|
endpoints.push(endpoint);
|
|
50
50
|
endpointsByPrincipal.set(endpoint.principalId, endpoints);
|
|
51
51
|
}
|
|
52
|
+
const devicesById = new Map(listDevices().map((device) => [device.id, device]));
|
|
53
|
+
const principalsById = new Map(listEndpointPrincipals().map((principal) => [principal.id, principal]));
|
|
54
|
+
const devices = [...new Set([...devicesById.keys(), ...principalsById.keys()])].map((id) => {
|
|
55
|
+
const access = devicesById.get(id);
|
|
56
|
+
const principal = principalsById.get(id);
|
|
57
|
+
const lastSeenAt = Math.max(access?.lastSeenAt ?? 0, principal?.lastSeenAt ?? 0) || void 0;
|
|
58
|
+
return {
|
|
59
|
+
id,
|
|
60
|
+
displayName: principal?.displayName ?? access?.displayName ?? id,
|
|
61
|
+
kind: principal?.kind ?? (access?.platform === "chrome" ? "browser" : "mobile"),
|
|
62
|
+
platform: principal?.platform ?? access?.platform ?? "unknown",
|
|
63
|
+
createdAt: Math.min(access?.createdAt ?? Number.POSITIVE_INFINITY, principal?.createdAt ?? Number.POSITIVE_INFINITY),
|
|
64
|
+
...lastSeenAt ? { lastSeenAt } : {},
|
|
65
|
+
access: access ? {
|
|
66
|
+
scopes: access.scopes,
|
|
67
|
+
createdAt: access.createdAt,
|
|
68
|
+
...access.lastSeenAt ? { lastSeenAt: access.lastSeenAt } : {},
|
|
69
|
+
...access.revokedAt ? { revokedAt: access.revokedAt } : {}
|
|
70
|
+
} : null,
|
|
71
|
+
principal: principal ? {
|
|
72
|
+
createdAt: principal.createdAt,
|
|
73
|
+
...principal.lastSeenAt ? { lastSeenAt: principal.lastSeenAt } : {},
|
|
74
|
+
...principal.revokedAt ? { revokedAt: principal.revokedAt } : {}
|
|
75
|
+
} : null,
|
|
76
|
+
endpoints: endpointsByPrincipal.get(id) ?? []
|
|
77
|
+
};
|
|
78
|
+
}).sort((left, right) => (right.lastSeenAt ?? right.createdAt) - (left.lastSeenAt ?? left.createdAt));
|
|
52
79
|
return c.json({
|
|
53
80
|
ok: true,
|
|
54
|
-
payload:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
81
|
+
payload: devices
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
authenticated.post("/api/endpoint-tools/devices/revoke", async (c) => {
|
|
85
|
+
const body = await c.req.json().catch(() => null);
|
|
86
|
+
if (!Array.isArray(body?.ids) || body.ids.length === 0 || body.ids.length > 100 || body.ids.some((id) => typeof id !== "string" || !id.trim())) return c.json({
|
|
87
|
+
ok: false,
|
|
88
|
+
error: {
|
|
89
|
+
code: "BAD_REQUEST",
|
|
90
|
+
message: "Expected 1 to 100 device ids"
|
|
91
|
+
}
|
|
92
|
+
}, 400);
|
|
93
|
+
const results = [...new Set(body.ids.map((id) => id.trim()))].map((id) => {
|
|
94
|
+
const access = getDevice(id);
|
|
95
|
+
const principal = getEndpointPrincipal(id);
|
|
96
|
+
const accessRevoked = Boolean(access && access.revokedAt === void 0 && revokeDevice(id));
|
|
97
|
+
const principalRevoked = Boolean(principal && principal.revokedAt === void 0 && revokeEndpointPrincipal(id));
|
|
98
|
+
if (accessRevoked) {
|
|
99
|
+
deps.service.realtime.disconnectPrincipal(id);
|
|
100
|
+
deps.service.voiceRealtime.disconnectPrincipal(id);
|
|
101
|
+
}
|
|
102
|
+
if (principalRevoked) {
|
|
103
|
+
for (const endpoint of deps.service.endpointTools.registry.list()) if (endpoint.principalId === id) deps.service.endpointTools.disconnect(endpoint.endpointId, "Device revoked");
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
id,
|
|
107
|
+
found: Boolean(access || principal),
|
|
108
|
+
revoked: accessRevoked || principalRevoked
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
return c.json({
|
|
112
|
+
ok: true,
|
|
113
|
+
payload: { results }
|
|
58
114
|
});
|
|
59
115
|
});
|
|
60
116
|
authenticated.post("/api/endpoint-tools/principals", async (c) => {
|
|
@@ -123,36 +179,36 @@ function registerEndpointToolRoutes(authenticated, deps) {
|
|
|
123
179
|
payload: principal
|
|
124
180
|
}, 201);
|
|
125
181
|
});
|
|
126
|
-
authenticated.
|
|
127
|
-
const
|
|
128
|
-
|
|
182
|
+
authenticated.get("/api/endpoint-tools/invocations", (c) => {
|
|
183
|
+
const page = Number(c.req.query("page") ?? 1);
|
|
184
|
+
const pageSize = Number(c.req.query("pageSize") ?? 20);
|
|
185
|
+
const status = c.req.query("status");
|
|
186
|
+
const effect = c.req.query("effect");
|
|
187
|
+
if (!Number.isInteger(page) || page < 1 || !Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100 || status && ![
|
|
188
|
+
"running",
|
|
189
|
+
"succeeded",
|
|
190
|
+
"failed"
|
|
191
|
+
].includes(status) || effect && ![
|
|
192
|
+
"read",
|
|
193
|
+
"write",
|
|
194
|
+
"destructive"
|
|
195
|
+
].includes(effect)) return c.json({
|
|
129
196
|
ok: false,
|
|
130
197
|
error: {
|
|
131
198
|
code: "BAD_REQUEST",
|
|
132
|
-
message: "
|
|
199
|
+
message: "Invalid invocation filters"
|
|
133
200
|
}
|
|
134
201
|
}, 400);
|
|
135
|
-
if (!revokeEndpointPrincipal(principalId)) return c.json({
|
|
136
|
-
ok: false,
|
|
137
|
-
error: {
|
|
138
|
-
code: "NOT_FOUND",
|
|
139
|
-
message: "Endpoint principal not found"
|
|
140
|
-
}
|
|
141
|
-
}, 404);
|
|
142
|
-
for (const endpoint of deps.service.endpointTools.registry.list()) if (endpoint.principalId === principalId) deps.service.endpointTools.disconnect(endpoint.endpointId, "Endpoint principal revoked");
|
|
143
|
-
return c.json({
|
|
144
|
-
ok: true,
|
|
145
|
-
payload: {
|
|
146
|
-
principalId,
|
|
147
|
-
revoked: true
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
authenticated.get("/api/endpoint-tools/invocations", (c) => {
|
|
152
|
-
const limit = Number(c.req.query("limit") ?? 100);
|
|
153
202
|
return c.json({
|
|
154
203
|
ok: true,
|
|
155
|
-
payload:
|
|
204
|
+
payload: listEndpointToolInvocationAuditPage({
|
|
205
|
+
page,
|
|
206
|
+
pageSize,
|
|
207
|
+
query: c.req.query("query"),
|
|
208
|
+
principalId: c.req.query("principalId"),
|
|
209
|
+
status,
|
|
210
|
+
effect
|
|
211
|
+
})
|
|
156
212
|
});
|
|
157
213
|
});
|
|
158
214
|
authenticated.get("/api/endpoint-tools/bindings/:conversationId", (c) => {
|
|
@@ -3,7 +3,7 @@ import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "
|
|
|
3
3
|
import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
|
|
4
4
|
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
5
5
|
import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
6
|
-
import { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-gateway.js";
|
|
6
|
+
import { listBundleMcpResourcesForGateway, listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-gateway.js";
|
|
7
7
|
//#region src/gateway/hono/routes/mcp.ts
|
|
8
8
|
function registerMcpRoutes(authenticated, deps) {
|
|
9
9
|
const resolveServer = (id) => {
|
|
@@ -36,6 +36,37 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
authenticated.get("/api/mcp/resources", async (c) => {
|
|
40
|
+
const cfg = deps.service.currentConfig;
|
|
41
|
+
const workspaceDir = getWorkspacePath(cfg) || "./workspace";
|
|
42
|
+
const query = (c.req.query("q") ?? "").trim().toLocaleLowerCase();
|
|
43
|
+
const serverId = (c.req.query("serverId") ?? "").trim();
|
|
44
|
+
try {
|
|
45
|
+
const items = (await listBundleMcpResourcesForGateway({
|
|
46
|
+
workspaceDir,
|
|
47
|
+
cfg
|
|
48
|
+
})).filter((resource) => {
|
|
49
|
+
if (serverId && resource.serverId !== serverId) return false;
|
|
50
|
+
if (!query) return true;
|
|
51
|
+
return [
|
|
52
|
+
resource.name,
|
|
53
|
+
resource.title,
|
|
54
|
+
resource.description,
|
|
55
|
+
resource.uri,
|
|
56
|
+
resource.serverId
|
|
57
|
+
].some((value) => value?.toLocaleLowerCase().includes(query));
|
|
58
|
+
}).slice(0, 20);
|
|
59
|
+
return c.json({
|
|
60
|
+
ok: true,
|
|
61
|
+
payload: { resources: items }
|
|
62
|
+
});
|
|
63
|
+
} catch (err) {
|
|
64
|
+
return c.json({
|
|
65
|
+
ok: false,
|
|
66
|
+
error: err instanceof Error ? err.message : String(err)
|
|
67
|
+
}, 500);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
39
70
|
authenticated.get("/api/mcp/servers/:id/oauth", async (c) => {
|
|
40
71
|
const id = c.req.param("id");
|
|
41
72
|
const server = resolveServer(id);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
1
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
3
|
import { computerModelProfile, init_model_policy, isDedicatedComputerModel } from "../../../computer/model-policy.js";
|
|
4
4
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
5
5
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
@@ -62,9 +62,10 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
|
|
|
62
62
|
url?: string;
|
|
63
63
|
capturedAt?: number;
|
|
64
64
|
documentId?: string;
|
|
65
|
+
fileKind?: "file" | "directory";
|
|
65
66
|
}[];
|
|
66
67
|
contextSnapshots?: {
|
|
67
|
-
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "browser_page" | "app_context";
|
|
68
|
+
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "file" | "session" | "mcp_resource" | "browser_tab" | "browser_page" | "app_context";
|
|
68
69
|
sourceId: string;
|
|
69
70
|
version: string;
|
|
70
71
|
title: string;
|
|
@@ -79,6 +80,7 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
|
|
|
79
80
|
url?: string;
|
|
80
81
|
capturedAt?: number;
|
|
81
82
|
documentId?: string;
|
|
83
|
+
fileKind?: "file" | "directory";
|
|
82
84
|
appContext?: {
|
|
83
85
|
version: 1;
|
|
84
86
|
clientInstanceId: string;
|
|
@@ -196,9 +198,10 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
196
198
|
url?: string;
|
|
197
199
|
capturedAt?: number;
|
|
198
200
|
documentId?: string;
|
|
201
|
+
fileKind?: "file" | "directory";
|
|
199
202
|
}[];
|
|
200
203
|
contextSnapshots?: {
|
|
201
|
-
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "browser_page" | "app_context";
|
|
204
|
+
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "file" | "session" | "mcp_resource" | "browser_tab" | "browser_page" | "app_context";
|
|
202
205
|
sourceId: string;
|
|
203
206
|
version: string;
|
|
204
207
|
title: string;
|
|
@@ -213,6 +216,7 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
213
216
|
url?: string;
|
|
214
217
|
capturedAt?: number;
|
|
215
218
|
documentId?: string;
|
|
219
|
+
fileKind?: "file" | "directory";
|
|
216
220
|
appContext?: {
|
|
217
221
|
version: 1;
|
|
218
222
|
clientInstanceId: string;
|
|
@@ -39,7 +39,7 @@ async function submitSessionInput(c, deps, conversationId, options) {
|
|
|
39
39
|
ok: false,
|
|
40
40
|
error: {
|
|
41
41
|
code: "BAD_REQUEST",
|
|
42
|
-
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid
|
|
42
|
+
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid source references`
|
|
43
43
|
}
|
|
44
44
|
}, 400);
|
|
45
45
|
const browserContexts = browserPageContextsInputSchema.safeParse(body.browserContexts ?? []);
|
|
@@ -201,7 +201,7 @@ async function submitSessionInput(c, deps, conversationId, options) {
|
|
|
201
201
|
ok: false,
|
|
202
202
|
error: {
|
|
203
203
|
code: result.code,
|
|
204
|
-
message: result.code === "CONTEXT_UNAVAILABLE" ? "A referenced
|
|
204
|
+
message: result.code === "CONTEXT_UNAVAILABLE" ? "A referenced source changed or is no longer available. Select it again." : "Input was not accepted"
|
|
205
205
|
}
|
|
206
206
|
}, result.code === "SESSION_CHANGED" || result.code === "QUEUE_FULL" || result.code === "CONTEXT_UNAVAILABLE" ? 409 : 400);
|
|
207
207
|
return c.json({
|
|
@@ -235,7 +235,7 @@ async function replaceLatestSessionTurn(c, deps, conversationId, targetTurnId) {
|
|
|
235
235
|
ok: false,
|
|
236
236
|
error: {
|
|
237
237
|
code: "BAD_REQUEST",
|
|
238
|
-
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid
|
|
238
|
+
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid source references`
|
|
239
239
|
}
|
|
240
240
|
}, 400);
|
|
241
241
|
const content = typeof body.content === "string" ? body.content : "";
|
|
@@ -321,7 +321,7 @@ async function replaceLatestSessionTurn(c, deps, conversationId, targetTurnId) {
|
|
|
321
321
|
});
|
|
322
322
|
if (result.ok === false) {
|
|
323
323
|
const status = result.code === "TARGET_NOT_FOUND" ? 404 : result.code === "BAD_REQUEST" ? 400 : 409;
|
|
324
|
-
const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : result.code === "CONTEXT_UNAVAILABLE" ? "A referenced
|
|
324
|
+
const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : result.code === "CONTEXT_UNAVAILABLE" ? "A referenced source changed or is no longer available. Select it again." : "Replacement input was not accepted";
|
|
325
325
|
return c.json({
|
|
326
326
|
ok: false,
|
|
327
327
|
error: {
|
|
@@ -2,7 +2,7 @@ import { listConnectorLearningJobs } from "../../../storage/sqlite/connector-lea
|
|
|
2
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import "../../../storage/sqlite/index.js";
|
|
4
4
|
import { getWorkDiscoveryRun } from "../../../work-discovery/repository.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getConnectorUnderstandingSourceRun } from "../../../user-context/sources/repository.js";
|
|
6
6
|
import { isLocalUnderstandingSourceId } from "../../../user-context/sources/local-source-contract.js";
|
|
7
7
|
import { normalizeUnderstandingSourceItems } from "../../../work-discovery/service.js";
|
|
8
8
|
import { UnderstandingRefreshService } from "../../../user-context/sources/refresh-service.js";
|
|
@@ -63,7 +63,7 @@ function createUnderstandingRefreshService(deps) {
|
|
|
63
63
|
phase: "completed",
|
|
64
64
|
error: "Connector update is no longer available."
|
|
65
65
|
};
|
|
66
|
-
const sourceRun =
|
|
66
|
+
const sourceRun = getConnectorUnderstandingSourceRun(job.id);
|
|
67
67
|
if (job.status === "completed") return {
|
|
68
68
|
status: sourceRun?.status === "partial" ? "partial" : "completed",
|
|
69
69
|
phase: "completed",
|
|
@@ -22,7 +22,7 @@ export interface GatewayAgentRunnerOptions {
|
|
|
22
22
|
emit: (type: string, payload: unknown) => void;
|
|
23
23
|
publishRealtime: (topic: string, event: string, data: unknown) => void;
|
|
24
24
|
completeRealtimeTopic: (topic: string) => void;
|
|
25
|
-
resolveTurnContext: (ref: TurnContextRef) => Promise<AgentSourceContext | null>;
|
|
25
|
+
resolveTurnContext: (ref: TurnContextRef, conversationId: string) => Promise<AgentSourceContext | null>;
|
|
26
26
|
}
|
|
27
27
|
export declare class GatewayAgentRunner {
|
|
28
28
|
private readonly opts;
|
|
@@ -76,7 +76,7 @@ var GatewayAgentRunner = class {
|
|
|
76
76
|
size: ref.size
|
|
77
77
|
}));
|
|
78
78
|
},
|
|
79
|
-
prepareContexts: async (refs) => {
|
|
79
|
+
prepareContexts: async (conversationId, refs) => {
|
|
80
80
|
if (!refs?.length) return void 0;
|
|
81
81
|
const unique = /* @__PURE__ */ new Map();
|
|
82
82
|
for (const ref of refs) {
|
|
@@ -87,7 +87,7 @@ var GatewayAgentRunner = class {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
if (unique.size > MAX_TURN_CONTEXTS) throw new Error(`A message can reference at most ${MAX_TURN_CONTEXTS} sources`);
|
|
90
|
-
const contexts = await Promise.all([...unique.values()].map((ref) => opts.resolveTurnContext(ref)));
|
|
90
|
+
const contexts = await Promise.all([...unique.values()].map((ref) => opts.resolveTurnContext(ref, conversationId)));
|
|
91
91
|
if (contexts.some((context) => context === null)) throw new Error("A referenced source is unavailable or has changed; select it again");
|
|
92
92
|
return fitSourceContextsToBudget(contexts.filter((context) => context !== null));
|
|
93
93
|
},
|
|
@@ -2,10 +2,6 @@ import type { AgentSourceContext } from '../../agent/source-context/types.js';
|
|
|
2
2
|
import { type CapabilityDispatcher } from '../../capabilities/runtime/dispatcher.js';
|
|
3
3
|
import type { ResolvedGatewayAuth } from '../auth.js';
|
|
4
4
|
import type { GatewayPrincipal } from '../security/gateway-principal.js';
|
|
5
|
-
export interface AppContextGrant {
|
|
6
|
-
principal: GatewayPrincipal;
|
|
7
|
-
authRevision: string;
|
|
8
|
-
}
|
|
9
5
|
/** A queued read retains its original scope ceiling, but never a revoked identity. */
|
|
10
6
|
export declare function checkAppContextAccess(source: AgentSourceContext, dispatcher: CapabilityDispatcher, auth: ResolvedGatewayAuth): Promise<void>;
|
|
11
7
|
export declare function prepareAppContext(input: unknown, principal: GatewayPrincipal, auth: ResolvedGatewayAuth, dispatcher: CapabilityDispatcher, previous?: AgentSourceContext): Promise<AgentSourceContext>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
3
|
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
4
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
5
5
|
import { init_providers } from "../../providers/index.js";
|
|
6
6
|
import { disposeAllSessionMcpRuntimes } from "../../agent/mcp/bundle-mcp-runtime.js";
|
|
7
7
|
import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
|
|
@@ -11,9 +11,9 @@ import { resolveExecutionContext } from "../../tasks/execution-context.js";
|
|
|
11
11
|
import { TaskRunCoordinator } from "../../tasks/task-run-coordinator.js";
|
|
12
12
|
import { formatAgentRunErrorForClient } from "../../agent/client-error-format.js";
|
|
13
13
|
import "../chat-limits.js";
|
|
14
|
+
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
14
15
|
import { ChatStreamMapper } from "../chat-stream/mapper.js";
|
|
15
16
|
import { markdownNotificationPreview } from "../../notifications/plain-text.js";
|
|
16
|
-
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
17
17
|
import { resolveWebchatConversationId } from "../resolve-webchat-session-key.js";
|
|
18
18
|
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
19
19
|
import { coalesceThinkingDeltas } from "../chat-stream/thinking-delta-coalescer.js";
|
|
@@ -39,7 +39,7 @@ export declare class SessionInputCoordinator {
|
|
|
39
39
|
summary: string;
|
|
40
40
|
}>;
|
|
41
41
|
prepareAttachments: (conversationId: string, attachments?: UserTurnAttachment[]) => Promise<UserTurnAttachment[] | undefined>;
|
|
42
|
-
prepareContexts: (contextRefs?: TurnContextRef[]) => Promise<AgentSourceContext[] | undefined>;
|
|
42
|
+
prepareContexts: (conversationId: string, contextRefs?: TurnContextRef[]) => Promise<AgentSourceContext[] | undefined>;
|
|
43
43
|
steer: (conversationId: string, content: string) => Promise<boolean>;
|
|
44
44
|
emit: (type: string, payload: unknown) => void;
|
|
45
45
|
});
|
|
@@ -109,7 +109,7 @@ var SessionInputCoordinator = class {
|
|
|
109
109
|
const attachments = await this.deps.prepareAttachments(conversationId, input.attachments);
|
|
110
110
|
let sourceContexts;
|
|
111
111
|
try {
|
|
112
|
-
sourceContexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
112
|
+
sourceContexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(conversationId, input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
113
113
|
} catch (err) {
|
|
114
114
|
log.warn({
|
|
115
115
|
err,
|
|
@@ -185,7 +185,7 @@ var SessionInputCoordinator = class {
|
|
|
185
185
|
const attachments = await this.deps.prepareAttachments(conversationId, input.attachments);
|
|
186
186
|
let sourceContexts;
|
|
187
187
|
try {
|
|
188
|
-
sourceContexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
188
|
+
sourceContexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(conversationId, input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
189
189
|
} catch (err) {
|
|
190
190
|
log.warn({
|
|
191
191
|
err,
|
|
@@ -310,7 +310,7 @@ var SessionInputCoordinator = class {
|
|
|
310
310
|
if (body.contextRefs !== void 0) {
|
|
311
311
|
const existing = getSessionInputById(conversationId, id);
|
|
312
312
|
if (!contextRefsMatchFrozenSnapshot(body.contextRefs, existing?.contextRefs)) try {
|
|
313
|
-
const resolved = await this.deps.prepareContexts(body.contextRefs) ?? [];
|
|
313
|
+
const resolved = await this.deps.prepareContexts(conversationId, body.contextRefs) ?? [];
|
|
314
314
|
sourceContexts = fitSourceContextsToBudget([...existing?.contextSnapshots?.filter((source) => source.kind !== "note" && source.kind !== "task") ?? [], ...resolved]);
|
|
315
315
|
} catch (err) {
|
|
316
316
|
log.warn({
|