@xopcai/xopc 0.0.323 → 0.0.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -9
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DFzmThVi.js → agent-avatar-dicebear-CxfXpPWs.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CDHe8gJf.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DYFYiuig.js → agent-plugin-dialog-DMv-udoZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BqIlB5Co.js → agents-D_xOAXgj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BgvMRGWe.js → app-management-settings-panel-p7fZB4dT.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CliHU03A.js → appearance-settings-C-clVcfp.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Dz2g7eAN.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DnuPpm0u.js → archive-plugin-Xm6xChUX.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BiwaK0ie.js → attachment-load-Di8kuG4L.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CJSISGQH.js → automations-page-GUZgDhKj.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BUZhG9aJ.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-KDjduQZO.js → binary-plugins-OCrDjC9O.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-bclvgove.js → block-editor-m9tqvu7x.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CfQ2T9t6.js → browser-automation-inputs-DSWXq9lI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Cxq38Nnp.js → browser-automations-page-DuOaridE.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-D2_PgHep.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-7Y_pJqyt.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-B-Igy1ro.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DKQC62nQ.js → chat-terminal-dock-BfnVh8oo.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-D1whpIqL.js → computer-settings-page-aRG2lU4w.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BAuYTgf5.js → connector-service-page-B5EhnfJH.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-7HfRt1LW.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-CtDyij_x.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DOuVO2M1.js → dependency-picker-z6ouWxmz.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D9tu6Bhu.js → desktop-pet-BsIYCAkG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CQPXub2f.js → desktop-pet-settings-z-0aQ5ct.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DxkOYSut.js → device-pairing-wizard-DlmhQvY5.js} +1 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CtWClPz-.js → extension-debug-page-Ct9pABNW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BHh9HLCz.js → extension-page-BktsR4hj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BdT3v5Uh.js → extension-settings-page-BQJc-vXH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-1eqyz9vZ.js → gateway-config-swr-CoQVulMd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CZas_Ekx.js → gateway-settings-BfDVlvy6.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C4rsW6vJ.js → gateway-startup-retry-B5GJ-CQV.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CI_eQTPL.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B5DXMylk.js → image-generation-api-DvWDkbk1.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B1JH0G5j.js → imports-page-DFpQfHVU.js} +1 -1
- package/dist/gateway/static/root/assets/index-19rMUT3d.js +121 -0
- package/dist/gateway/static/root/assets/{index-CNc4N4TX.css → index-BKL5tg2f.css} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGrLJ8Yh.js → keyboard-shortcuts-settings-ctJLm8TP.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-C9kaP3Dy.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DqjStqbL.js → local-apps-page-BxC_LTqq.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BIkcRr3t.js → locale-store-BPZR8x9b.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Ok5SpG-G.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-gCfH4cwH.js → management-settings-aOzRaQHM.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Ck_5MADq.js → markdown-view-Dft8ASFD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DTsZqgo6.js → media-plugins-ni5zJ4Ok.js} +1 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C9OEltN9.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dj9rMgdi.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DTI_g4tz.js → page-context-capture-button-BJA3d8vU.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-CfW_Q-K5.js → page-tabs-Dyc3wKkl.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CuPN-vAn.js → preview-open-alternatives-tIOIQbNX.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BHjxRz1E.js → product-open-page-DQctU8z3.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dy-EwZcc.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-Bk-es4i9.js → projects-page-JaGKa6rM.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BAAZUGnU.js → registry-api-DWWO6ajd.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cb8-nd60.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CHJBJKL1.js → runtime-tools-settings-panel-xhOSYfiX.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-ClBkFdRY.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-FQAit5HL.js → schema-form-z8IeSdBp.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BYW5l_nY.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDNwmXuH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BDc6bw1q.js → settings-form-section-BXTJAser.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DnhxBJjV.js → settings-page-Br9no5e4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3KNSQ5g.js → settings-page-layout-D6745w0p.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D2N9764S.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DVQCRxwK.js → share-preview-page-CE0SER59.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dk3_QOKQ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CPt61fEv.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Db6PB2C6.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-mDwC9UJ-.js → skills-page.utils-DrtW5FBy.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bk7GrMij.js → system-settings-panel-CuY1Zh5s.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-o7RiDUMi.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-D3Aquraj.js → tunnel-api-PGHDgvWb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C1xQ-sHn.js → use-autosave-B55oBQUt.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DspelwAa.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DCNECvcp.js → voice-api-key-field-By6Lgbse.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B-_niUTU.js → voice-config-api-BaxITrwZ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BrGx_JS_.js → work-discovery-overlay-DdhgIlyf.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmmC2Pdr.js → workflow-run-setup-panel-BOJYQaxX.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-6ObD0IQZ.js +6 -0
- package/dist/gateway/static/root/index.html +11 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/home.js +284 -55
- package/dist/packages/gateway-contract/src/index.js +0 -2
- package/dist/packages/gateway-contract/src/notifications.js +3 -10
- package/dist/src/activity/emitter.js +2 -1
- package/dist/src/activity/service.js +2 -1
- package/dist/src/agent/agent-manager.d.ts +3 -2
- package/dist/src/agent/agent-manager.js +36 -44
- package/dist/src/agent/agent-scope.d.ts +19 -48
- package/dist/src/agent/agent-scope.js +47 -169
- package/dist/src/agent/background-review/run-background-review.js +5 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/commands/command-registry.js +7 -3
- package/dist/src/agent/context/coordinator.js +1 -1
- package/dist/src/agent/context/execution-context.js +2 -1
- package/dist/src/agent/context/execution-scope.js +2 -1
- package/dist/src/agent/context/workspace-seed.d.ts +1 -2
- package/dist/src/agent/context/workspace-seed.js +3 -3
- package/dist/src/agent/context/workspace-state.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +2 -1
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -1
- package/dist/src/agent/external-tools/composio-provider.js +2 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/index.js +2 -3
- package/dist/src/agent/external-tools/mcp-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +4 -5
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/socket.js +3 -3
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -2
- package/dist/src/agent/models/manager.d.ts +1 -1
- package/dist/src/agent/models/manager.js +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +1 -1
- package/dist/src/agent/prompt/response-language.js +2 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +6 -3
- package/dist/src/agent/prompt/system-prompt.js +2 -1
- package/dist/src/agent/reply/post-compaction-context.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.js +2 -1
- package/dist/src/agent/service.d.ts +1 -1
- package/dist/src/agent/service.js +12 -11
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/session-inspector.js +4 -5
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +5 -0
- package/dist/src/agent/starter-agents.d.ts +4 -5
- package/dist/src/agent/starter-agents.js +21 -20
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +31 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +2 -3
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +10 -9
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +2 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
- package/dist/src/agent/tools/xopc-use-tool.js +54 -6
- package/dist/src/agent/workflow/workflow-child-tools.js +1 -2
- package/dist/src/agent/workspace-runtime/registry.d.ts +1 -1
- package/dist/src/agent/workspace-runtime/registry.js +2 -2
- package/dist/src/agent-catalog/capabilities.d.ts +3 -0
- package/dist/src/agent-catalog/capabilities.js +238 -0
- package/dist/src/agent-catalog/id.d.ts +15 -0
- package/dist/src/agent-catalog/id.js +101 -0
- package/dist/src/agent-catalog/index.d.ts +6 -0
- package/dist/src/agent-catalog/index.js +10 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.d.ts +11 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +195 -0
- package/dist/src/agent-catalog/repository.d.ts +39 -0
- package/dist/src/agent-catalog/repository.js +319 -0
- package/dist/src/agent-catalog/service.d.ts +33 -0
- package/dist/src/agent-catalog/service.js +202 -0
- package/dist/src/agent-catalog/test-support.d.ts +14 -0
- package/dist/src/agent-catalog/test-support.js +34 -0
- package/dist/src/agent-catalog/types.d.ts +26 -0
- package/dist/src/agent-catalog/types.js +1 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +1 -172
- package/dist/src/agent-config/schema.js +2 -41
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.d.ts +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -9
- package/dist/src/automations/capabilities/drafts.js +8 -7
- package/dist/src/automations/service/action-executor.js +2 -1
- package/dist/src/bootstrap/application-state.d.ts +10 -0
- package/dist/src/bootstrap/application-state.js +26 -0
- package/dist/src/browser/automations/repository.js +2 -1
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +5 -4
- package/dist/src/browser/providers/extension.js +4 -2
- package/dist/src/browser/providers/realtime-extension.js +2 -1
- package/dist/src/capabilities/readiness/from-config.js +7 -4
- package/dist/src/capabilities/runtime/dispatcher.d.ts +1 -0
- package/dist/src/capabilities/runtime/dispatcher.js +10 -4
- package/dist/src/capabilities/runtime/product.js +2 -0
- package/dist/src/channels/catalog/channel-catalog-service.js +7 -13
- package/dist/src/chat-commands/agent-edit.js +4 -3
- package/dist/src/chat-commands/builtins/config.js +6 -8
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/chat-commands/context.js +2 -3
- package/dist/src/chat-previews/store.js +2 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agent.js +4 -4
- package/dist/src/cli/commands/agents.d.ts +1 -1
- package/dist/src/cli/commands/agents.js +36 -48
- package/dist/src/cli/commands/auth.js +2 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -2
- package/dist/src/cli/commands/channels.js +2 -4
- package/dist/src/cli/commands/config.js +4 -5
- package/dist/src/cli/commands/connectors.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-config.js +2 -4
- package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -2
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +4 -4
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/gateway-service.js +1 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +13 -11
- package/dist/src/cli/commands/doctor/checks/security-audit.js +1 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +3 -3
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -2
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +5 -7
- package/dist/src/cli/commands/extension-agent-plugin.js +1 -2
- package/dist/src/cli/commands/extension-dev.js +2 -4
- package/dist/src/cli/commands/extension-marketplace.js +1 -2
- package/dist/src/cli/commands/extension-pack.js +1 -2
- package/dist/src/cli/commands/extension.js +1 -2
- package/dist/src/cli/commands/gateway/run-foreground.js +3 -3
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/history.js +2 -1
- package/dist/src/cli/commands/image.js +2 -2
- package/dist/src/cli/commands/init.js +11 -30
- package/dist/src/cli/commands/mcp.js +1 -2
- package/dist/src/cli/commands/models.js +13 -11
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -2
- package/dist/src/cli/commands/onboard/gateway.js +1 -2
- package/dist/src/cli/commands/onboard/model.d.ts +1 -1
- package/dist/src/cli/commands/onboard/model.js +18 -26
- package/dist/src/cli/commands/onboard.js +4 -2
- package/dist/src/cli/commands/platform.js +1 -0
- package/dist/src/cli/commands/project.js +3 -3
- package/dist/src/cli/commands/providers.js +2 -1
- package/dist/src/cli/commands/runtime.js +1 -2
- package/dist/src/cli/commands/search.js +1 -2
- package/dist/src/cli/commands/skills.js +1 -2
- package/dist/src/cli/commands/tui-runner.js +3 -2
- package/dist/src/cli/commands/tui.js +6 -8
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/voice.js +1 -2
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/index.js +4 -2
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +15 -16
- package/dist/src/cli/utils/session.js +1 -2
- package/dist/src/computer/model-config.d.ts +3 -3
- package/dist/src/computer/model-config.js +10 -20
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/agent-model-intents.js +2 -2
- package/dist/src/config/agent-profile.d.ts +5 -6
- package/dist/src/config/agent-profile.js +19 -19
- package/dist/src/config/config-surface.d.ts +0 -3
- package/dist/src/config/default-model.js +2 -6
- package/dist/src/config/index.js +7 -8
- package/dist/src/config/loader.js +12 -18
- package/dist/src/config/models-json.d.ts +6 -6
- package/dist/src/config/paths.d.ts +18 -19
- package/dist/src/config/paths.js +35 -35
- package/dist/src/config/reload.d.ts +0 -1
- package/dist/src/config/reload.js +1 -6
- package/dist/src/config/rules.js +0 -15
- package/dist/src/config/schema.d.ts +3 -406
- package/dist/src/config/schema.js +24 -86
- package/dist/src/config/validate-channel-configs.js +8 -14
- package/dist/src/config/workspace-dirs.d.ts +3 -4
- package/dist/src/config/workspace-dirs.js +9 -8
- package/dist/src/config/workspace-path-helpers.d.ts +1 -1
- package/dist/src/config/workspace-path-helpers.js +2 -2
- package/dist/src/connectors/cli/lifecycle.js +2 -1
- package/dist/src/connectors/composio-managed-events.js +2 -1
- package/dist/src/connectors/connected-source-ingestion.js +2 -1
- package/dist/src/connectors/connected-source-understanding.js +4 -2
- package/dist/src/connectors/content-enrichment.js +2 -1
- package/dist/src/connectors/learning-coordinator.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +2 -1
- package/dist/src/connectors/workflow-preflight.d.ts +8 -1
- package/dist/src/connectors/workflow-preflight.js +11 -3
- package/dist/src/discussions/analyzer.js +2 -2
- package/dist/src/endpoint-tools/runtime.js +2 -1
- package/dist/src/execution-environments/subject.js +2 -1
- package/dist/src/extensions/activation-context.js +3 -16
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/discover-extensions.js +9 -15
- package/dist/src/extensions/extension-metadata-snapshot.d.ts +1 -1
- package/dist/src/extensions/extension-metadata-snapshot.js +9 -16
- package/dist/src/extensions/index.js +4 -10
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +7 -14
- package/dist/src/extensions/manifest-registry.js +93 -98
- package/dist/src/extensions/marketplace.js +5 -2
- package/dist/src/extensions/normalize-manifest.js +12 -17
- package/dist/src/extensions/update.js +1 -2
- package/dist/src/files/file-service.js +7 -8
- package/dist/src/gateway/agents-admin.d.ts +23 -27
- package/dist/src/gateway/agents-admin.js +109 -130
- package/dist/src/gateway/file-path-classifier.js +3 -3
- package/dist/src/gateway/file-space-service.js +2 -1
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -4
- package/dist/src/gateway/global-defaults-admin.js +21 -20
- package/dist/src/gateway/hono/app.js +2 -1
- package/dist/src/gateway/hono/lib/config-payload.js +12 -9
- package/dist/src/gateway/hono/middleware/auth.js +2 -1
- package/dist/src/gateway/hono/middleware/scopes.js +2 -1
- package/dist/src/gateway/hono/routes/agents.js +22 -49
- package/dist/src/gateway/hono/routes/browser.js +4 -2
- package/dist/src/gateway/hono/routes/channels.js +1 -2
- package/dist/src/gateway/hono/routes/cli-connectors.js +2 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +3 -1
- package/dist/src/gateway/hono/routes/composer-history.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/index.d.ts +1 -3
- package/dist/src/gateway/hono/routes/config-patch/index.js +1 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -11
- package/dist/src/gateway/hono/routes/config.js +0 -2
- package/dist/src/gateway/hono/routes/connectors.js +8 -4
- package/dist/src/gateway/hono/routes/context-sources.js +4 -3
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -1
- package/dist/src/gateway/hono/routes/device-push.js +3 -2
- package/dist/src/gateway/hono/routes/devices.js +6 -3
- package/dist/src/gateway/hono/routes/discussions.js +2 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +8 -16
- package/dist/src/gateway/hono/routes/home.js +93 -4
- package/dist/src/gateway/hono/routes/interaction-state.js +2 -1
- package/dist/src/gateway/hono/routes/models.js +8 -7
- package/dist/src/gateway/hono/routes/notes.js +4 -5
- package/dist/src/gateway/hono/routes/projects.js +6 -6
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +4 -2
- package/dist/src/gateway/hono/routes/shares.js +4 -3
- package/dist/src/gateway/hono/routes/site-shares.js +2 -2
- package/dist/src/gateway/hono/routes/status.js +2 -3
- package/dist/src/gateway/hono/routes/tasks.js +1 -2
- package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -1
- package/dist/src/gateway/hono/routes/user-model.js +3 -2
- package/dist/src/gateway/hono/routes/work-discovery.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/image-generation-setup.d.ts +19 -10
- package/dist/src/gateway/image-generation-setup.js +59 -23
- package/dist/src/gateway/index.js +1 -4
- package/dist/src/gateway/lock.js +13 -18
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +4 -3
- package/dist/src/gateway/run-loop.js +2 -3
- package/dist/src/gateway/security/gateway-scopes.js +6 -2
- package/dist/src/gateway/security/index.js +4 -1
- package/dist/src/gateway/service/agent-runner.js +4 -2
- package/dist/src/gateway/service/app-context-access.js +2 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +0 -1
- package/dist/src/gateway/service/config-coordinator.js +4 -22
- package/dist/src/gateway/service/marketplace-service.js +3 -1
- package/dist/src/gateway/service/run-gateway-agent.js +4 -2
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +109 -33
- package/dist/src/gateway/session-context-summary.js +4 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +15 -10
- package/dist/src/home-intelligence/application-service.d.ts +31 -0
- package/dist/src/home-intelligence/application-service.js +134 -0
- package/dist/src/home-intelligence/capability-preflight.d.ts +32 -0
- package/dist/src/home-intelligence/capability-preflight.js +118 -0
- package/dist/src/home-intelligence/evaluation.d.ts +34 -0
- package/dist/src/home-intelligence/evaluation.js +49 -0
- package/dist/src/home-intelligence/generator.d.ts +125 -0
- package/dist/src/home-intelligence/generator.js +227 -0
- package/dist/src/home-intelligence/host.d.ts +53 -0
- package/dist/src/home-intelligence/host.js +257 -0
- package/dist/src/home-intelligence/notification.d.ts +8 -0
- package/dist/src/home-intelligence/notification.js +20 -0
- package/dist/src/home-intelligence/policy.d.ts +16 -0
- package/dist/src/home-intelligence/policy.js +152 -0
- package/dist/src/home-intelligence/repository.d.ts +81 -0
- package/dist/src/home-intelligence/repository.js +495 -0
- package/dist/src/home-intelligence/snapshot.d.ts +43 -0
- package/dist/src/home-intelligence/snapshot.js +133 -0
- package/dist/src/home-intelligence/strategy.d.ts +14 -0
- package/dist/src/home-intelligence/strategy.js +10 -0
- package/dist/src/home-intelligence/types.d.ts +13 -0
- package/dist/src/home-intelligence/types.js +1 -0
- package/dist/src/infra/update-restart.js +4 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -1
- package/dist/src/knowledge/ingestion-service.js +2 -1
- package/dist/src/knowledge-memory/repository.js +2 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/local-apps/store.js +2 -1
- package/dist/src/mcp/channel-bridge.js +1 -2
- package/dist/src/mcp/channel-server.js +1 -2
- package/dist/src/mcp/gateway-http-client.js +1 -2
- package/dist/src/media/session-references.js +2 -1
- package/dist/src/memory-maintenance/service.js +2 -1
- package/dist/src/migrations/memory-config.js +1 -2
- package/dist/src/notes/agent-context.js +2 -1
- package/dist/src/notes/attachment-ref.js +8 -4
- package/dist/src/notes/note-attachment-sync.js +2 -1
- package/dist/src/notes/note-index-meta.js +14 -7
- package/dist/src/notes/note-markdown.js +13 -7
- package/dist/src/notes/service.js +6 -3
- package/dist/src/notes/store.js +4 -2
- package/dist/src/notifications/device-store.js +1 -1
- package/dist/src/notifications/planner.js +24 -0
- package/dist/src/notifications/service.d.ts +7 -14
- package/dist/src/notifications/service.js +13 -3
- package/dist/src/notifications/store.js +1 -1
- package/dist/src/notifications/types.d.ts +1 -1
- package/dist/src/notifications/types.js +1 -1
- package/dist/src/projects/capabilities/write.js +2 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-agent.js +4 -4
- package/dist/src/projects/project-service.js +2 -1
- package/dist/src/projects/workspace.js +3 -2
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-reference-auditor.d.ts +1 -2
- package/dist/src/providers/model-reference-auditor.js +8 -5
- package/dist/src/realtime/runtime.js +2 -1
- package/dist/src/routing/binding-schema.d.ts +41 -0
- package/dist/src/routing/binding-schema.js +26 -0
- package/dist/src/routing/bindings.d.ts +4 -2
- package/dist/src/routing/bindings.js +4 -4
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/src/routing/resolve-route.d.ts +7 -24
- package/dist/src/routing/resolve-route.js +17 -18
- package/dist/src/routing/resolve-tui-session-key.d.ts +1 -4
- package/dist/src/routing/resolve-tui-session-key.js +10 -9
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/model.js +1 -1
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +1 -1
- package/dist/src/scenes/taskFollowUp/service.js +6 -4
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/session/config-store.js +2 -1
- package/dist/src/session/init-session-turn.js +2 -1
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/session-workspace.js +1 -1
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/activity-repository.js +6 -2
- package/dist/src/storage/sqlite/browser-tab-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/clarification-wait-repository.js +13 -8
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +8 -3
- package/dist/src/storage/sqlite/composer-input-history-repository.js +8 -3
- package/dist/src/storage/sqlite/config-repository.js +9 -5
- package/dist/src/storage/sqlite/connector-learning-repository.js +6 -2
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +6 -2
- package/dist/src/storage/sqlite/context-evidence-repository.js +8 -3
- package/dist/src/storage/sqlite/context-extraction-repository.js +8 -3
- package/dist/src/storage/sqlite/device-access-repository.js +15 -9
- package/dist/src/storage/sqlite/device-pairing-approval.js +6 -2
- package/dist/src/storage/sqlite/device-pairing-repository.js +10 -5
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +6 -2
- package/dist/src/storage/sqlite/gateway-identity-repository.js +6 -2
- package/dist/src/storage/sqlite/home-attention-repository.js +6 -2
- package/dist/src/storage/sqlite/index.d.ts +0 -1
- package/dist/src/storage/sqlite/index.js +72 -42
- package/dist/src/storage/sqlite/interaction-state-repository.js +10 -4
- package/dist/src/storage/sqlite/knowledge-repository.js +6 -2
- package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +70 -0
- package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +78 -0
- package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +66 -0
- package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +3 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -4
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +7 -1
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +2 -2
- 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/note-agent-context-repository.js +6 -2
- package/dist/src/storage/sqlite/notes-repository.js +9 -4
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.js +14 -9
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +9 -5
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +14 -9
- package/dist/src/storage/sqlite/transcript-repository.js +10 -6
- package/dist/src/storage/sqlite/user-people-repository.js +8 -3
- package/dist/src/storage/sqlite/user-trust-repository.js +8 -3
- package/dist/src/tasks/attention-governor.d.ts +0 -1
- package/dist/src/tasks/attention-governor.js +1 -7
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/execution-context.d.ts +2 -2
- package/dist/src/tasks/execution-context.js +6 -5
- package/dist/src/tasks/home-query-service.d.ts +3 -2
- package/dist/src/tasks/home-query-service.js +23 -44
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-context-repository.d.ts +1 -1
- package/dist/src/tasks/task-contract-planner.d.ts +0 -3
- package/dist/src/tasks/task-contract-planner.js +1 -4
- package/dist/src/tasks/task-handoff-service.d.ts +0 -2
- package/dist/src/tasks/task-handoff-service.js +3 -3
- package/dist/src/tasks/task-value-metrics-service.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +12 -14
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -3
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +3 -3
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/registration-proof.js +2 -1
- package/dist/src/user-context/access-policy.js +2 -1
- package/dist/src/user-context/domain.d.ts +1 -1
- package/dist/src/user-context/domain.js +18 -13
- package/dist/src/user-context/extraction/registry.js +2 -1
- package/dist/src/user-context/interaction-state.js +4 -1
- package/dist/src/user-context/relationship-continuity.js +2 -1
- package/dist/src/user-context/trust-policy.js +13 -8
- package/dist/src/user-model/bootstrap.js +2 -1
- package/dist/src/user-model/capture/executor.js +4 -2
- package/dist/src/user-model/capture/semantic.d.ts +1 -1
- package/dist/src/user-model/capture/semantic.js +1 -1
- package/dist/src/user-model/domain.js +7 -2
- package/dist/src/user-model/goals.js +2 -1
- package/dist/src/user-model/index.js +4 -1
- package/dist/src/user-model/repository.js +2 -1
- package/dist/src/utils/helpers.js +1 -4
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/logger/index.d.ts +1 -1
- package/dist/src/utils/logger/index.js +2 -2
- package/dist/src/utils/logger/redact.d.ts +2 -0
- package/dist/src/utils/logger/redact.js +11 -3
- package/dist/src/utils/logger.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/voice/realtime/persona-context.js +6 -6
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/analyzer.js +3 -3
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/work-discovery/service.js +12 -11
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -5
- package/dist/src/workflows/store/paths.js +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CfCo3lqh.js +0 -1
- package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +0 -1
- package/dist/gateway/static/root/assets/index--3c0awkr.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Dl4kM4Na.js +0 -2
- package/dist/gateway/static/root/assets/messages-7VAhscYe.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-B-GDnZO9.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-ClLAD1pz.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-F0rCQ-2a.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-RdDYu7Yj.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +0 -6
- package/dist/packages/gateway-contract/src/proactive.js +0 -136
- package/dist/src/commands/agents.config.d.ts +0 -31
- package/dist/src/commands/agents.config.js +0 -129
- package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +0 -2
- package/dist/src/gateway/hono/routes/config-patch/agents.js +0 -6
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +0 -17
- package/dist/src/storage/sqlite/relationship-settings-repository.js +0 -65
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { normalizeAgentId, validateAgentIdForNewAgent } from "../agent-catalog/id.js";
|
|
2
|
+
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
|
+
import { init_agent_scope, listAgentEntries, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath } from "../agent/agent-scope.js";
|
|
3
4
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
4
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
6
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
7
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
8
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
6
|
-
import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
|
|
7
|
-
import { applyAgentConfig, findAgentEntryIndex, getAgentDeleteBlocker, pruneAgentConfig, removeAgentDirsFromDisk } from "../commands/agents.config.js";
|
|
8
9
|
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
9
10
|
import { join, resolve } from "node:path";
|
|
10
11
|
import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -13,11 +14,12 @@ import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/prom
|
|
|
13
14
|
* Gateway REST helpers for multi-agent management.
|
|
14
15
|
*/
|
|
15
16
|
init_agent_scope();
|
|
17
|
+
init_repository();
|
|
16
18
|
init_paths();
|
|
17
19
|
const EDITABLE_PROFILE_MARKDOWN_NAMES = new Set([...AGENT_PROFILE_MARKDOWN_SYSTEM_FILES]);
|
|
18
|
-
function collectAgentIdsForList(
|
|
19
|
-
const entries = listAgentEntries(
|
|
20
|
-
const defaultId = resolveDefaultAgentId(
|
|
20
|
+
function collectAgentIdsForList() {
|
|
21
|
+
const entries = listAgentEntries().filter((e) => e.enabled !== false);
|
|
22
|
+
const defaultId = resolveDefaultAgentId();
|
|
21
23
|
if (entries.length === 0) return [defaultId];
|
|
22
24
|
const ids = /* @__PURE__ */ new Set();
|
|
23
25
|
for (const e of entries) ids.add(normalizeAgentId(e.id));
|
|
@@ -44,16 +46,16 @@ function parseIdentityMarkdown(content) {
|
|
|
44
46
|
}
|
|
45
47
|
return out;
|
|
46
48
|
}
|
|
47
|
-
async function listGatewayAgents(
|
|
48
|
-
const defaultId = resolveDefaultAgentId(
|
|
49
|
+
async function listGatewayAgents(_options = {}) {
|
|
50
|
+
const defaultId = resolveDefaultAgentId();
|
|
49
51
|
const agents = [];
|
|
50
|
-
for (const id of collectAgentIdsForList(
|
|
51
|
-
const profile = resolveEffectiveAgentProfile(
|
|
52
|
-
const entry = listAgentEntries(
|
|
52
|
+
for (const id of collectAgentIdsForList()) {
|
|
53
|
+
const profile = resolveEffectiveAgentProfile(id);
|
|
54
|
+
const entry = listAgentEntries().find((e) => normalizeAgentId(e.id) === id);
|
|
53
55
|
if (!entry) continue;
|
|
54
56
|
let identity = {};
|
|
55
57
|
try {
|
|
56
|
-
identity = parseIdentityMarkdown(await readFile(join(resolveAgentProfileDir(
|
|
58
|
+
identity = parseIdentityMarkdown(await readFile(join(resolveAgentProfileDir(id), WORKSPACE_FILES.IDENTITY), "utf-8"));
|
|
57
59
|
} catch {}
|
|
58
60
|
agents.push({
|
|
59
61
|
id,
|
|
@@ -62,7 +64,7 @@ async function listGatewayAgents(cfg, _options = {}) {
|
|
|
62
64
|
...identity.language ? { language: identity.language } : {},
|
|
63
65
|
...identity.avatar ? { avatar: identity.avatar } : {},
|
|
64
66
|
workspace: profile.resolvedWorkspacePath,
|
|
65
|
-
profileDir: resolveAgentProfileDir(
|
|
67
|
+
profileDir: resolveAgentProfileDir(id),
|
|
66
68
|
override: structuredClone(entry),
|
|
67
69
|
effective: structuredClone(profile.config),
|
|
68
70
|
sources: { ...profile.sources },
|
|
@@ -76,9 +78,9 @@ async function listGatewayAgents(cfg, _options = {}) {
|
|
|
76
78
|
builtinToolIds: [...GATEWAY_BUILTIN_TOOL_IDS]
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
|
-
function getGatewayAgentEffectiveConfig(
|
|
81
|
+
function getGatewayAgentEffectiveConfig(agentIdRaw) {
|
|
80
82
|
const agentId = normalizeAgentId(agentIdRaw);
|
|
81
|
-
if (!listAgentEntries(
|
|
83
|
+
if (!listAgentEntries().find((e) => normalizeAgentId(e.id) === agentId)) return {
|
|
82
84
|
ok: false,
|
|
83
85
|
error: `agent "${agentId}" not found`,
|
|
84
86
|
status: 404
|
|
@@ -87,7 +89,7 @@ function getGatewayAgentEffectiveConfig(cfg, agentIdRaw) {
|
|
|
87
89
|
return {
|
|
88
90
|
ok: true,
|
|
89
91
|
data: (() => {
|
|
90
|
-
const profile = resolveEffectiveAgentProfile(
|
|
92
|
+
const profile = resolveEffectiveAgentProfile(agentId);
|
|
91
93
|
return {
|
|
92
94
|
config: profile.config,
|
|
93
95
|
sources: profile.sources
|
|
@@ -102,7 +104,7 @@ function getGatewayAgentEffectiveConfig(cfg, agentIdRaw) {
|
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
function
|
|
107
|
+
async function createGatewayAgent(body) {
|
|
106
108
|
const idRes = validateAgentIdForNewAgent(body.id, body.profile.name);
|
|
107
109
|
if (idRes.ok === false) return {
|
|
108
110
|
ok: false,
|
|
@@ -110,113 +112,90 @@ function prepareCreateAgent(cfg, body) {
|
|
|
110
112
|
status: 400
|
|
111
113
|
};
|
|
112
114
|
const agentId = idRes.agentId;
|
|
113
|
-
if (
|
|
115
|
+
if (new AgentCatalogRepository().get(agentId, { includeDeleted: true })) return {
|
|
114
116
|
ok: false,
|
|
115
117
|
error: `agent "${agentId}" already exists`,
|
|
116
118
|
status: 409
|
|
117
119
|
};
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const workspace = body.workspace?.trim() ? resolveUserPath(body.workspace) : void 0;
|
|
121
|
+
try {
|
|
122
|
+
await new AgentCatalogService().create({
|
|
123
|
+
id: agentId,
|
|
124
|
+
enabled: true,
|
|
125
|
+
...workspace ? { workspace } : {},
|
|
126
|
+
profile: structuredClone(body.profile)
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
ok: true,
|
|
130
|
+
data: {
|
|
123
131
|
agentId,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const profilePath = resolveAgentProfileDir(cfg, agentId);
|
|
135
|
-
const adPath = resolveAgentDir(cfg, agentId);
|
|
136
|
-
await mkdir(wsPath, { recursive: true });
|
|
137
|
-
await mkdir(profilePath, { recursive: true });
|
|
138
|
-
await mkdir(adPath, { recursive: true });
|
|
139
|
-
const id = normalizeAgentId(agentId);
|
|
140
|
-
seedAgentProfileMarkdownFiles(profilePath, wsPath, { displayName: listAgentEntries(cfg).find((candidate) => normalizeAgentId(candidate.id) === id)?.profile?.name ?? id });
|
|
141
|
-
return {
|
|
142
|
-
ok: true,
|
|
143
|
-
data: void 0
|
|
144
|
-
};
|
|
132
|
+
workspace: resolveAgentWorkspaceDir(agentId)
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
} catch (error) {
|
|
136
|
+
return {
|
|
137
|
+
ok: false,
|
|
138
|
+
error: error instanceof Error ? error.message : String(error),
|
|
139
|
+
status: 400
|
|
140
|
+
};
|
|
141
|
+
}
|
|
145
142
|
}
|
|
146
|
-
function
|
|
143
|
+
async function updateGatewayAgent(agentIdRaw, body) {
|
|
147
144
|
const agentId = normalizeAgentId(agentIdRaw);
|
|
148
|
-
|
|
149
|
-
const idx = findAgentEntryIndex(list, agentId);
|
|
150
|
-
if (idx < 0) return {
|
|
145
|
+
if (!new AgentCatalogRepository().get(agentId)) return {
|
|
151
146
|
ok: false,
|
|
152
147
|
error: `agent "${agentId}" not found`,
|
|
153
148
|
status: 404
|
|
154
149
|
};
|
|
155
|
-
const
|
|
156
|
-
if (body.workspace !== void 0)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
150
|
+
const patch = {};
|
|
151
|
+
if (body.workspace !== void 0) patch.workspace = body.workspace?.trim() ? resolveUserPath(body.workspace) : void 0;
|
|
152
|
+
if (body.profile !== void 0) patch.profile = body.profile ?? void 0;
|
|
153
|
+
if (body.models !== void 0) patch.models = body.models ?? void 0;
|
|
154
|
+
if (body.skills !== void 0) patch.skills = body.skills ?? void 0;
|
|
155
|
+
if (body.tools !== void 0) patch.tools = body.tools ?? void 0;
|
|
156
|
+
if (body.workflows !== void 0) patch.workflows = body.workflows ?? void 0;
|
|
157
|
+
if (body.runtime !== void 0) patch.runtime = body.runtime ?? void 0;
|
|
158
|
+
try {
|
|
159
|
+
const service = new AgentCatalogService();
|
|
160
|
+
await service.update(agentId, patch);
|
|
161
|
+
if (body.setDefault === true) service.setDefault(agentId);
|
|
162
|
+
return {
|
|
163
|
+
ok: true,
|
|
164
|
+
data: void 0
|
|
165
|
+
};
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
error: error instanceof Error ? error.message : String(error),
|
|
170
|
+
status: 400
|
|
171
|
+
};
|
|
160
172
|
}
|
|
161
|
-
if (body.profile !== void 0) if (body.profile === null) delete entry.profile;
|
|
162
|
-
else entry.profile = structuredClone(body.profile);
|
|
163
|
-
if (body.models !== void 0) if (body.models === null) delete entry.models;
|
|
164
|
-
else entry.models = structuredClone(body.models);
|
|
165
|
-
if (body.skills !== void 0) if (body.skills === null) delete entry.skills;
|
|
166
|
-
else entry.skills = structuredClone(body.skills);
|
|
167
|
-
if (body.tools !== void 0) if (body.tools === null) delete entry.tools;
|
|
168
|
-
else entry.tools = body.tools;
|
|
169
|
-
if (body.workflows !== void 0) if (body.workflows === null) delete entry.workflows;
|
|
170
|
-
else entry.workflows = structuredClone(body.workflows);
|
|
171
|
-
if (body.runtime !== void 0) if (body.runtime === null) delete entry.runtime;
|
|
172
|
-
else entry.runtime = structuredClone(body.runtime);
|
|
173
|
-
list[idx] = entry;
|
|
174
|
-
let next = {
|
|
175
|
-
...cfg,
|
|
176
|
-
agents: {
|
|
177
|
-
...cfg.agents,
|
|
178
|
-
list
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
if (body.setDefault === true) next = {
|
|
182
|
-
...next,
|
|
183
|
-
agents: {
|
|
184
|
-
...next.agents,
|
|
185
|
-
default: agentId
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
return {
|
|
189
|
-
ok: true,
|
|
190
|
-
data: { nextConfig: next }
|
|
191
|
-
};
|
|
192
173
|
}
|
|
193
|
-
function
|
|
174
|
+
async function deleteGatewayAgent(agentIdRaw, options = {}) {
|
|
194
175
|
const agentId = normalizeAgentId(agentIdRaw);
|
|
195
|
-
|
|
196
|
-
if (blocker) return {
|
|
197
|
-
ok: false,
|
|
198
|
-
error: blocker,
|
|
199
|
-
status: 400
|
|
200
|
-
};
|
|
201
|
-
if (findAgentEntryIndex(listAgentEntries(cfg), agentId) < 0) return {
|
|
176
|
+
if (!new AgentCatalogRepository().get(agentId)) return {
|
|
202
177
|
ok: false,
|
|
203
178
|
error: `agent "${agentId}" not found`,
|
|
204
179
|
status: 404
|
|
205
180
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
181
|
+
try {
|
|
182
|
+
return {
|
|
183
|
+
ok: true,
|
|
184
|
+
data: {
|
|
185
|
+
agentId,
|
|
186
|
+
removedBindings: (await new AgentCatalogService().delete(agentId, options)).removedBindings
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return {
|
|
191
|
+
ok: false,
|
|
192
|
+
error: error instanceof Error ? error.message : String(error),
|
|
193
|
+
status: 400
|
|
194
|
+
};
|
|
195
|
+
}
|
|
217
196
|
}
|
|
218
|
-
async function profileMarkdownRootReal(
|
|
219
|
-
const dir = resolveAgentProfileDir(
|
|
197
|
+
async function profileMarkdownRootReal(agentId) {
|
|
198
|
+
const dir = resolveAgentProfileDir(agentId);
|
|
220
199
|
await mkdir(dir, { recursive: true });
|
|
221
200
|
try {
|
|
222
201
|
return await realpath(dir);
|
|
@@ -232,14 +211,14 @@ function assertAllowedFile(name) {
|
|
|
232
211
|
};
|
|
233
212
|
return null;
|
|
234
213
|
}
|
|
235
|
-
async function listAgentProfileFiles(
|
|
214
|
+
async function listAgentProfileFiles(agentId) {
|
|
236
215
|
const id = normalizeAgentId(agentId);
|
|
237
|
-
if (collectAgentIdsForList(
|
|
216
|
+
if (collectAgentIdsForList().every((x) => x !== id)) return {
|
|
238
217
|
ok: false,
|
|
239
218
|
error: `agent "${id}" not found`,
|
|
240
219
|
status: 404
|
|
241
220
|
};
|
|
242
|
-
const root = await profileMarkdownRootReal(
|
|
221
|
+
const root = await profileMarkdownRootReal(id);
|
|
243
222
|
const names = [...EDITABLE_PROFILE_MARKDOWN_NAMES];
|
|
244
223
|
const files = [];
|
|
245
224
|
for (const name of names.sort((a, b) => a.localeCompare(b))) {
|
|
@@ -272,16 +251,16 @@ async function listAgentProfileFiles(cfg, agentId) {
|
|
|
272
251
|
}
|
|
273
252
|
};
|
|
274
253
|
}
|
|
275
|
-
async function readAgentProfileFile(
|
|
254
|
+
async function readAgentProfileFile(agentId, name) {
|
|
276
255
|
const bad = assertAllowedFile(name);
|
|
277
256
|
if (bad) return bad;
|
|
278
257
|
const id = normalizeAgentId(agentId);
|
|
279
|
-
if (collectAgentIdsForList(
|
|
258
|
+
if (collectAgentIdsForList().every((x) => x !== id)) return {
|
|
280
259
|
ok: false,
|
|
281
260
|
error: `agent "${id}" not found`,
|
|
282
261
|
status: 404
|
|
283
262
|
};
|
|
284
|
-
const abs = resolveWorkspaceSafePath(await profileMarkdownRootReal(
|
|
263
|
+
const abs = resolveWorkspaceSafePath(await profileMarkdownRootReal(id), name);
|
|
285
264
|
if (!abs) return {
|
|
286
265
|
ok: false,
|
|
287
266
|
error: "invalid path",
|
|
@@ -304,22 +283,22 @@ async function readAgentProfileFile(cfg, agentId, name) {
|
|
|
304
283
|
};
|
|
305
284
|
}
|
|
306
285
|
}
|
|
307
|
-
async function writeAgentProfileFile(
|
|
286
|
+
async function writeAgentProfileFile(agentId, name, content) {
|
|
308
287
|
const bad = assertAllowedFile(name);
|
|
309
288
|
if (bad) return bad;
|
|
310
289
|
const id = normalizeAgentId(agentId);
|
|
311
|
-
if (collectAgentIdsForList(
|
|
290
|
+
if (collectAgentIdsForList().every((x) => x !== id)) return {
|
|
312
291
|
ok: false,
|
|
313
292
|
error: `agent "${id}" not found`,
|
|
314
293
|
status: 404
|
|
315
294
|
};
|
|
316
|
-
const abs = resolveWorkspaceSafePath(await profileMarkdownRootReal(
|
|
295
|
+
const abs = resolveWorkspaceSafePath(await profileMarkdownRootReal(id), name);
|
|
317
296
|
if (!abs) return {
|
|
318
297
|
ok: false,
|
|
319
298
|
error: "invalid path",
|
|
320
299
|
status: 400
|
|
321
300
|
};
|
|
322
|
-
if (!isPathUnderWorkspace(await profileMarkdownRootReal(
|
|
301
|
+
if (!isPathUnderWorkspace(await profileMarkdownRootReal(id), abs)) return {
|
|
323
302
|
ok: false,
|
|
324
303
|
error: "path escapes profile markdown root",
|
|
325
304
|
status: 400
|
|
@@ -357,19 +336,19 @@ function detectImageMimeFromBytes(buf) {
|
|
|
357
336
|
if (buf.length >= 12 && buf[0] === 82 && buf[1] === 73 && buf[2] === 70 && buf[3] === 70 && buf[8] === 87 && buf[9] === 69 && buf[10] === 66 && buf[11] === 80) return "image/webp";
|
|
358
337
|
return null;
|
|
359
338
|
}
|
|
360
|
-
function assertAgentExistsForAvatar(
|
|
361
|
-
if (collectAgentIdsForList(
|
|
339
|
+
function assertAgentExistsForAvatar(id) {
|
|
340
|
+
if (collectAgentIdsForList().every((x) => x !== id)) return {
|
|
362
341
|
ok: false,
|
|
363
342
|
error: `agent "${id}" not found`,
|
|
364
343
|
status: 404
|
|
365
344
|
};
|
|
366
345
|
return null;
|
|
367
346
|
}
|
|
368
|
-
async function readAgentAvatarFile(
|
|
369
|
-
const missingAgent = assertAgentExistsForAvatar(
|
|
347
|
+
async function readAgentAvatarFile(agentId) {
|
|
348
|
+
const missingAgent = assertAgentExistsForAvatar(agentId);
|
|
370
349
|
if (missingAgent) return missingAgent;
|
|
371
350
|
const id = normalizeAgentId(agentId);
|
|
372
|
-
const root = await profileMarkdownRootReal(
|
|
351
|
+
const root = await profileMarkdownRootReal(id);
|
|
373
352
|
for (const name of agentAvatarFilenames()) {
|
|
374
353
|
const abs = resolveWorkspaceSafePath(root, name);
|
|
375
354
|
if (!abs) continue;
|
|
@@ -396,8 +375,8 @@ async function readAgentAvatarFile(cfg, agentId) {
|
|
|
396
375
|
status: 404
|
|
397
376
|
};
|
|
398
377
|
}
|
|
399
|
-
async function writeAgentAvatarFromBase64(
|
|
400
|
-
const missingAgent = assertAgentExistsForAvatar(
|
|
378
|
+
async function writeAgentAvatarFromBase64(agentId, base64, mimeType) {
|
|
379
|
+
const missingAgent = assertAgentExistsForAvatar(agentId);
|
|
401
380
|
if (missingAgent) return missingAgent;
|
|
402
381
|
const id = normalizeAgentId(agentId);
|
|
403
382
|
const ext = mimeToExt(mimeType);
|
|
@@ -427,8 +406,8 @@ async function writeAgentAvatarFromBase64(cfg, agentId, base64, mimeType) {
|
|
|
427
406
|
error: "file content does not match declared image type",
|
|
428
407
|
status: 400
|
|
429
408
|
};
|
|
430
|
-
const root = await profileMarkdownRootReal(
|
|
431
|
-
const rootReal = await profileMarkdownRootReal(
|
|
409
|
+
const root = await profileMarkdownRootReal(id);
|
|
410
|
+
const rootReal = await profileMarkdownRootReal(id);
|
|
432
411
|
const targetName = `${AGENT_AVATAR_BASENAME}${ext}`;
|
|
433
412
|
const abs = resolveWorkspaceSafePath(root, targetName);
|
|
434
413
|
if (!abs || !isPathUnderWorkspace(rootReal, abs)) return {
|
|
@@ -461,12 +440,12 @@ function extMatchesDetectedMime(ext, detected) {
|
|
|
461
440
|
return detected === mimeToExtToMime(ext);
|
|
462
441
|
}
|
|
463
442
|
/** Remove any `agent-avatar.*` in the agent profile markdown root. Idempotent: ok even when no file existed. */
|
|
464
|
-
async function deleteAgentAvatarFile(
|
|
465
|
-
const missingAgent = assertAgentExistsForAvatar(
|
|
443
|
+
async function deleteAgentAvatarFile(agentId) {
|
|
444
|
+
const missingAgent = assertAgentExistsForAvatar(agentId);
|
|
466
445
|
if (missingAgent) return missingAgent;
|
|
467
446
|
const id = normalizeAgentId(agentId);
|
|
468
|
-
const root = await profileMarkdownRootReal(
|
|
469
|
-
const rootReal = await profileMarkdownRootReal(
|
|
447
|
+
const root = await profileMarkdownRootReal(id);
|
|
448
|
+
const rootReal = await profileMarkdownRootReal(id);
|
|
470
449
|
for (const name of agentAvatarFilenames()) {
|
|
471
450
|
const abs = resolveWorkspaceSafePath(root, name);
|
|
472
451
|
if (!abs || !isPathUnderWorkspace(rootReal, abs)) continue;
|
|
@@ -480,4 +459,4 @@ async function deleteAgentAvatarFile(cfg, agentId) {
|
|
|
480
459
|
};
|
|
481
460
|
}
|
|
482
461
|
//#endregion
|
|
483
|
-
export { deleteAgentAvatarFile,
|
|
462
|
+
export { createGatewayAgent, deleteAgentAvatarFile, deleteGatewayAgent, extractAvatarFromIdentityMarkdown, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, parseIdentityMarkdown, readAgentAvatarFile, readAgentProfileFile, updateGatewayAgent, writeAgentAvatarFromBase64, writeAgentProfileFile };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
3
|
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -11,11 +11,11 @@ init_agent_scope();
|
|
|
11
11
|
init_paths();
|
|
12
12
|
init_paths_state();
|
|
13
13
|
function buildFilePathClassifierContext(cfg, conversationIdRaw, explicitAgentId) {
|
|
14
|
-
const agentId = explicitAgentId ?? extractProfileAgentId(conversationIdRaw
|
|
14
|
+
const agentId = explicitAgentId ?? extractProfileAgentId(conversationIdRaw);
|
|
15
15
|
const stateDir = resolveStateDir();
|
|
16
16
|
return {
|
|
17
17
|
workspaceRoot: "",
|
|
18
|
-
profileMarkdownRoot: resolveAgentProfileDir(
|
|
18
|
+
profileMarkdownRoot: resolveAgentProfileDir(agentId),
|
|
19
19
|
stateDir,
|
|
20
20
|
skillsDir: resolveSkillsDir(),
|
|
21
21
|
configFilePath: resolveConfigPath(),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { listSessionWorkspaceOverrides } from "../storage/sqlite/config-repository.js";
|
|
1
|
+
import { init_config_repository, listSessionWorkspaceOverrides } from "../storage/sqlite/config-repository.js";
|
|
2
2
|
import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
|
|
3
3
|
import { getProjectForSession } from "../projects/workspace.js";
|
|
4
4
|
import { FileSpaceService } from "../files/file-service.js";
|
|
5
5
|
//#region src/gateway/file-space-service.ts
|
|
6
|
+
init_config_repository();
|
|
6
7
|
const services = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
/** Share the file registry, including session-specific spaces, across gateway routes. */
|
|
8
9
|
function getGatewayFileSpaceService(service) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type AgentDefaults } from '../agent-config/index.js';
|
|
2
|
-
import type { Config } from '../config/schema.js';
|
|
3
2
|
import { type GatewayBuiltinToolSummary } from './agent-builtin-tools.js';
|
|
4
3
|
export type GlobalDefaultsPayload = {
|
|
5
4
|
defaults: AgentDefaults;
|
|
@@ -16,8 +15,11 @@ export type GlobalDefaultsAdminResult<T> = {
|
|
|
16
15
|
error: string;
|
|
17
16
|
status?: 400 | 404 | 500;
|
|
18
17
|
};
|
|
19
|
-
export declare function listGlobalDefaults(
|
|
20
|
-
export declare function prepareUpdateGlobalDefaults(
|
|
21
|
-
|
|
18
|
+
export declare function listGlobalDefaults(): GlobalDefaultsPayload;
|
|
19
|
+
export declare function prepareUpdateGlobalDefaults(body: UpdateGlobalDefaultsBody): GlobalDefaultsAdminResult<{
|
|
20
|
+
defaults: AgentDefaults;
|
|
21
|
+
changed: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function updateGlobalDefaults(body: UpdateGlobalDefaultsBody): GlobalDefaultsAdminResult<{
|
|
22
24
|
changed: boolean;
|
|
23
25
|
}>;
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import { AgentDefaultsSchema } from "../agent-config/schema.js";
|
|
2
2
|
import { init_agent_config } from "../agent-config/index.js";
|
|
3
|
+
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
4
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
3
5
|
import { GATEWAY_BUILTIN_TOOLS } from "./agent-builtin-tools.js";
|
|
4
|
-
import {
|
|
6
|
+
import { validateComputerModelChange } from "../computer/model-config.js";
|
|
5
7
|
import { isDeepStrictEqual } from "node:util";
|
|
6
8
|
//#region src/gateway/global-defaults-admin.ts
|
|
7
9
|
init_agent_config();
|
|
8
|
-
|
|
10
|
+
init_repository();
|
|
11
|
+
function listGlobalDefaults() {
|
|
9
12
|
return {
|
|
10
|
-
defaults: structuredClone(
|
|
13
|
+
defaults: structuredClone(new AgentCatalogRepository().getSettings().defaults),
|
|
11
14
|
builtinTools: GATEWAY_BUILTIN_TOOLS.map((tool) => ({
|
|
12
15
|
id: tool.id,
|
|
13
16
|
description: { ...tool.description }
|
|
14
17
|
}))
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
|
-
function prepareUpdateGlobalDefaults(
|
|
20
|
+
function prepareUpdateGlobalDefaults(body) {
|
|
18
21
|
const parsed = AgentDefaultsSchema.safeParse(body.defaults);
|
|
19
22
|
if (!parsed.success) return {
|
|
20
23
|
ok: false,
|
|
21
24
|
error: `defaults ${parsed.error.issues[0]?.message ?? "is invalid"}`,
|
|
22
25
|
status: 400
|
|
23
26
|
};
|
|
27
|
+
const current = new AgentCatalogRepository().getSettings().defaults;
|
|
24
28
|
try {
|
|
25
|
-
|
|
26
|
-
...cfg,
|
|
27
|
-
agents: {
|
|
28
|
-
...cfg.agents,
|
|
29
|
-
defaults: parsed.data
|
|
30
|
-
}
|
|
31
|
-
}, cfg);
|
|
29
|
+
validateComputerModelChange(parsed.data.models.computerUse, current.models.computerUse);
|
|
32
30
|
} catch (error) {
|
|
33
31
|
return {
|
|
34
32
|
ok: false,
|
|
@@ -39,16 +37,19 @@ function prepareUpdateGlobalDefaults(cfg, body) {
|
|
|
39
37
|
return {
|
|
40
38
|
ok: true,
|
|
41
39
|
data: {
|
|
42
|
-
changed: !isDeepStrictEqual(
|
|
43
|
-
|
|
44
|
-
...cfg,
|
|
45
|
-
agents: {
|
|
46
|
-
...cfg.agents,
|
|
47
|
-
defaults: parsed.data
|
|
48
|
-
}
|
|
49
|
-
}
|
|
40
|
+
changed: !isDeepStrictEqual(current, parsed.data),
|
|
41
|
+
defaults: parsed.data
|
|
50
42
|
}
|
|
51
43
|
};
|
|
52
44
|
}
|
|
45
|
+
function updateGlobalDefaults(body) {
|
|
46
|
+
const prepared = prepareUpdateGlobalDefaults(body);
|
|
47
|
+
if (!prepared.ok) return prepared;
|
|
48
|
+
if (prepared.data.changed) new AgentCatalogService().updateDefaults(prepared.data.defaults);
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
data: { changed: prepared.data.changed }
|
|
52
|
+
};
|
|
53
|
+
}
|
|
53
54
|
//#endregion
|
|
54
|
-
export { listGlobalDefaults, prepareUpdateGlobalDefaults };
|
|
55
|
+
export { listGlobalDefaults, prepareUpdateGlobalDefaults, updateGlobalDefaults };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { listDevices } from "../../storage/sqlite/device-access-repository.js";
|
|
3
|
+
import { init_device_access_repository, listDevices } from "../../storage/sqlite/device-access-repository.js";
|
|
4
4
|
import { ENDPOINT_MAX_FILE_BYTES, init_src } from "../../../packages/endpoint-tools-protocol/src/index.js";
|
|
5
5
|
import { resolveAllowedBrowserOrigins, resolveGatewayServiceListenPort } from "../host.js";
|
|
6
6
|
import { resolveGatewayEffectiveHost } from "../../config/gateway-bind.js";
|
|
@@ -34,6 +34,7 @@ import { getConnInfo } from "@hono/node-server/conninfo";
|
|
|
34
34
|
//#region src/gateway/hono/app.ts
|
|
35
35
|
init_src();
|
|
36
36
|
init_logger();
|
|
37
|
+
init_device_access_repository();
|
|
37
38
|
const log = createLogger("Gateway:App");
|
|
38
39
|
/**
|
|
39
40
|
* Extension sandbox HTML under `/api/extensions/:id/assets/*` ships its own CSP
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
2
|
+
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
3
|
+
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
3
4
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
4
|
-
import {
|
|
5
|
+
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
5
6
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
6
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
7
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
@@ -9,6 +10,7 @@ import { getAllProviders, init_providers, isProviderConfigured } from "../../../
|
|
|
9
10
|
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
10
11
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
11
12
|
import { maskTunnelSecretForWeb } from "../../../tunnel/env.js";
|
|
13
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus } from "../../../channels/catalog/channel-catalog-service.js";
|
|
12
14
|
import { resolveSessionConfigForWeb, resolveUpdateConfigForWeb } from "../../../config/web-patch.js";
|
|
13
15
|
import { GENERIC_MASKED_SECRET, maskSecretLength } from "./mask-secret-length.js";
|
|
14
16
|
import { safeToolsWebForGet } from "../../config-tools-web.js";
|
|
@@ -16,7 +18,7 @@ import { buildSafeProvidersConfigForWeb } from "./safe-providers-config.js";
|
|
|
16
18
|
import { maskRealtimeVoiceConfigForWeb, maskSttConfigForWeb, maskTtsConfigForWeb } from "./safe-voice-config.js";
|
|
17
19
|
//#region src/gateway/hono/lib/config-payload.ts
|
|
18
20
|
init_agent_scope();
|
|
19
|
-
|
|
21
|
+
init_repository();
|
|
20
22
|
init_credentials();
|
|
21
23
|
init_models_json();
|
|
22
24
|
init_providers();
|
|
@@ -63,6 +65,7 @@ function buildSafeBrowserConfigForWeb(browser) {
|
|
|
63
65
|
/** Sanitized config snapshot for GET/PATCH `/api/config` (matches persisted `service.currentConfig`). */
|
|
64
66
|
async function buildSafeWebConfigPayload(service, options = {}) {
|
|
65
67
|
const config = service.currentConfig;
|
|
68
|
+
const agentCatalog = new AgentCatalogRepository().snapshot();
|
|
66
69
|
const snapshot = (typeof service.getExtensionLoader === "function" ? service.getExtensionLoader() : void 0)?.getManifestSnapshot();
|
|
67
70
|
const catalog = snapshot ? buildChannelCatalogFromSnapshot(snapshot, { locale: options.locale }) : buildChannelCatalogForConfig(config, { locale: options.locale });
|
|
68
71
|
const channelsPayload = Object.fromEntries(catalog.entries.map((entry) => {
|
|
@@ -81,8 +84,8 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
81
84
|
}));
|
|
82
85
|
return {
|
|
83
86
|
agents: {
|
|
84
|
-
defaultId: resolveDefaultAgentId(
|
|
85
|
-
list: listAgentEntries(
|
|
87
|
+
defaultId: resolveDefaultAgentId(),
|
|
88
|
+
list: listAgentEntries().filter((e) => e.enabled !== false).map((e) => ({
|
|
86
89
|
id: normalizeAgentId(e.id),
|
|
87
90
|
workspace: e.workspace,
|
|
88
91
|
models: e.models,
|
|
@@ -90,7 +93,7 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
90
93
|
skills: e.skills,
|
|
91
94
|
workflows: e.workflows
|
|
92
95
|
})),
|
|
93
|
-
defaults:
|
|
96
|
+
defaults: agentCatalog.defaults
|
|
94
97
|
},
|
|
95
98
|
computer: config.computer,
|
|
96
99
|
channels: channelsPayload,
|
|
@@ -142,7 +145,7 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
142
145
|
knowledgeMemory: KnowledgeMemoryConfigSchema.parse(config.userContext?.knowledgeMemory),
|
|
143
146
|
contextPlanning: ContextPlanningConfigSchema.parse(config.userContext?.contextPlanning)
|
|
144
147
|
},
|
|
145
|
-
tui: { defaultAgent:
|
|
148
|
+
tui: { defaultAgent: agentCatalog.surfaceDefaults.tui ?? agentCatalog.defaultAgentId },
|
|
146
149
|
tunnel: {
|
|
147
150
|
enabled: config.tunnel?.enabled === true,
|
|
148
151
|
autoStart: config.tunnel?.autoStart === true,
|
|
@@ -159,7 +162,7 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
159
162
|
tts: maskTtsConfigForWeb(config.messages?.tts),
|
|
160
163
|
voice: maskRealtimeVoiceConfigForWeb(config.voice),
|
|
161
164
|
tools: safeToolsWebForGet(config),
|
|
162
|
-
bindings:
|
|
165
|
+
bindings: agentCatalog.bindings,
|
|
163
166
|
mcp: buildSafeMcpConfigForWeb(config)
|
|
164
167
|
};
|
|
165
168
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logAuthEvent } from "../../../utils/logger/audit.js";
|
|
2
2
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../../utils/logger.js";
|
|
4
|
-
import { authenticateDeviceAccessToken, getDevice } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
|
+
import { authenticateDeviceAccessToken, getDevice, init_device_access_repository } from "../../../storage/sqlite/device-access-repository.js";
|
|
5
5
|
import { safeEqualSecret } from "../../security/secret-equal.js";
|
|
6
6
|
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
7
7
|
import { authPolicyConfig, buckets, resolveAuthRateLimit } from "../../rate-limit/buckets.js";
|
|
@@ -16,6 +16,7 @@ import { setGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
|
16
16
|
import { createMiddleware } from "hono/factory";
|
|
17
17
|
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
18
18
|
//#region src/gateway/hono/middleware/auth.ts
|
|
19
|
+
init_device_access_repository();
|
|
19
20
|
init_logger();
|
|
20
21
|
const log = createLogger("Gateway:Auth");
|
|
21
22
|
function resolveExpectedCredential(auth) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import { hasGatewayScope, requiredGatewayScope } from "../../security/gateway-scopes.js";
|
|
3
|
+
import { hasGatewayScope, init_gateway_scopes, requiredGatewayScope } from "../../security/gateway-scopes.js";
|
|
4
4
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
5
5
|
import { createMiddleware } from "hono/factory";
|
|
6
6
|
//#region src/gateway/hono/middleware/scopes.ts
|
|
7
|
+
init_gateway_scopes();
|
|
7
8
|
init_logger();
|
|
8
9
|
const log = createLogger("Hono:Scopes");
|
|
9
10
|
/** Enforces fail-closed route scopes after authentication establishes a principal. */
|