@xopcai/xopc 0.0.249 → 0.0.251
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/gateway/static/root/assets/{activity-store-B759R_qf.js → activity-store-DfBjTSo9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BUu7EnwM.js → agent-avatar-dicebear-Bo_dmLv8.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-kILWelNb.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DK9HjHO0.js → agents-yuUn8n-f.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Cg0v7Lpn.js → api-zxpcJfgj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C9DkCW_d.js → app-management-settings-panel-Cz56nrVF.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CFggS95Y.js → appearance-settings-DxSws5U4.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BnizTdgs.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BQrilVVv.js → archive-plugin-7k15-hqo.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BG0BliqV.js → attachment-load-B-SFpjd9.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Bo4RiTkh.js → automations-page-Qy36j19q.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CZRKqSqY.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BCnyNU0C.js → binary-plugins-CPOZQt8F.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Db8DlVvg.js → block-editor-DhvVlIp9.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-pN5LbChY.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C71vfl0b.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-vvmSYKsO.js → browser-workflows-page-C65MI57t.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CJw2e16J.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CRgjb4Ck.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CKyV3jY5.js → channels-status-swr-CX-yWwLD.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B1Xd6OFB.js → chat-terminal-dock-1PJoxRuV.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-Dcpdy06y.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-D-F9vjtE.js → cron-expression-CBCc6zFA.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B2OoYvic.js → date-picker-u8K5Kt_N.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BiGx9Sbj.js → dependency-picker-y_i_cnpz.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BNMRqipe.js → desktop-pet-DyL0JxLm.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DeYbIV7A.js → desktop-pet-settings-d2d_IsyP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-COyn05ub.js → extension-debug-page-DqIBKJwl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-oH43chS2.js → extension-page-DUW1xxj2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BMO59994.js → extension-settings-page-BHY9qaNw.js} +1 -1
- package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-cimpViGk.js → gateway-config-api-e3BRcgDx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BGdHwT4e.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BHJtnSic.js → gateway-settings-Cheo0Rkc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CuaM3b4c.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DNhrZHqx.js → heartbeat-settings-7CD9iPR7.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DVrTRqNc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D7duj7Uj.js → image-generation-api-C5mn73ca.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DGeGmj4k.css → index-B7CX4Qob.css} +1 -1
- package/dist/gateway/static/root/assets/index-BHrpyJ4t.js +72 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D8Zw_lYd.js → keyboard-shortcuts-settings-BtlqMleF.js} +1 -1
- package/dist/gateway/static/root/assets/languages-5WaOu0Lf.js +2 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-BjxfkjxE.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CvPDPRwb.js → local-apps-page-B7xqQe2s.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-zEL8bkwx.js → locale-store-CF4erhjB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-kACaPZKL.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D8moh99U.js → management-settings-A432siER.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-editor-BjMTIM-m.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DGRN-8wP.js → markdown-view-CQvzsE24.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BLaE5b1Y.js → media-plugins-CpvYiauZ.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DiVDuCxl.js → mobile-pairing-wizard-DyjVGngO.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CUd8O4K7.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BLQwd39W.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BFMGjA60.js → page-tabs-B3FKzjR6.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DNEWZN7H.js → preview-open-alternatives-DnjrwAHD.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Co5u7asH.js → product-open-page-COcr_NUJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-NttW338u.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BzH8pjEz.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-Cg92zSod.js → registry-api-BsRBlji7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BxpjSDnL.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C0ByNmlV.js → runtime-tools-settings-panel-LO4wZ_dO.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Dq_VQpuY.js → schema-form-crcj4-Pm.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BLMaibOb.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BRvvKhoH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CZu6FX4k.js → settings-form-section-Bl4MvTmq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S8ekeUZd.js → settings-page-DplrjZ6x.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BdVmwXMv.js → setup-status-panel-DTOsxQC1.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D2fEidbn.js → share-preview-page-CJP1kURj.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CemgzEi4.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BWYanBlQ.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-AYiPlgZE.js → skills-page-DsjcKg9Q.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DGzl-ib-.js → skills-page.utils-D6gWBbvy.js} +1 -1
- package/dist/gateway/static/root/assets/source-workspace-editor-CVWzt0oT.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-5Xd5mIiR.js → system-settings-panel-_eCXfqCo.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BQAUaCDD.js → task-detail-page-D0Z_K5JT.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-ZVClZKQ0.js → theme-store-BOgkc_9D.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CdZN1Jin.js → tunnel-api-W5mktxl1.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-czRI0NBc.js → use-autosave-Na2DYzT3.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-B_-SNat-.js +2 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror--gTq3YAI.js → vendor-codemirror-Qdcjid65.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-8YEvA3cU.js → voice-api-key-field-OXweUxS_.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CopF64lY.js → voice-config-api-C-ryeIxj.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-keLtqYYJ.js → work-discovery-overlay-BqOsO47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Dy5WgYMO.js → workflow-run-setup-panel-B9S_lfT1.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CNOT2Coo.js +5 -0
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
- package/dist/src/agent/agent-manager.d.ts +9 -9
- package/dist/src/agent/agent-manager.js +50 -32
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +11 -2
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/context/audit.d.ts +3 -1
- package/dist/src/agent/context/audit.js +32 -6
- package/dist/src/agent/context/coordinator.d.ts +6 -1
- package/dist/src/agent/context/coordinator.js +14 -13
- package/dist/src/agent/context/execution-context.d.ts +6 -47
- package/dist/src/agent/context/execution-context.js +79 -15
- package/dist/src/agent/context/execution-context.types.d.ts +50 -0
- package/dist/src/agent/context/execution-context.types.js +1 -0
- package/dist/src/agent/context/execution-scope.d.ts +5 -1
- package/dist/src/agent/context/execution-scope.js +6 -2
- package/dist/src/agent/context/project-context.d.ts +3 -0
- package/dist/src/agent/context/project-context.js +5 -3
- 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/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +1 -0
- package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/memory-provider.js +1 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +3 -3
- package/dist/src/agent/memory/memory-config.d.ts +0 -5
- package/dist/src/agent/memory/memory-config.js +1 -8
- package/dist/src/agent/orchestration/context-overflow.js +1 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +3 -4
- 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/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +37 -7
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +6 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +81 -26
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +7 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +2 -0
- package/dist/src/agent/tools/user-context-tool.js +21 -4
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/service/automation-service.d.ts +2 -1
- package/dist/src/automations/service/automation-service.js +6 -2
- package/dist/src/browser/providers/browser-ext-install.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 +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +46 -22
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/files/file-service.js +142 -14
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +17 -3
- package/dist/src/gateway/hono/routes/files.js +23 -2
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/agent-runner.js +1 -1
- 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.js +1 -1
- package/dist/src/gateway/service.js +12 -8
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge-memory/domain.d.ts +1 -0
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +4 -1
- package/dist/src/knowledge-memory/repository.js +16 -2
- package/dist/src/notifications/planner.js +7 -3
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +1 -10
- package/dist/src/proactive/execution/context.d.ts +6 -8
- package/dist/src/proactive/execution/context.js +78 -32
- package/dist/src/proactive/execution/insight.d.ts +4 -1
- package/dist/src/proactive/execution/insight.js +5 -2
- package/dist/src/proactive/execution/repository.d.ts +1 -0
- package/dist/src/proactive/execution/repository.js +9 -1
- package/dist/src/proactive/execution/types.d.ts +0 -1
- package/dist/src/proactive/execution/worker.js +7 -5
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/inbox/service.js +2 -2
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.js +7 -0
- package/dist/src/proactive/index.d.ts +1 -0
- package/dist/src/proactive/index.js +2 -1
- package/dist/src/proactive/maintenance.d.ts +4 -0
- package/dist/src/proactive/maintenance.js +21 -0
- package/dist/src/proactive/scenarios/repository.d.ts +1 -1
- package/dist/src/proactive/scenarios/repository.js +10 -3
- package/dist/src/proactive/scenarios/types.d.ts +7 -0
- package/dist/src/proactive/service.d.ts +7 -0
- package/dist/src/proactive/service.js +17 -1
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +3 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +5 -2
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +3 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +1 -1
- package/dist/src/storage/sqlite/config-repository.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.js +2 -2
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.js +1 -1
- package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +3 -5
- package/dist/src/storage/sqlite/transcript-repository.js +2 -1
- package/dist/src/tasks/home-query-service.js +35 -13
- package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
- package/dist/src/tasks/project-monitoring-service.js +4 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/access-policy.d.ts +11 -0
- package/dist/src/user-context/access-policy.js +26 -0
- package/dist/src/user-model/capture/executor.d.ts +10 -0
- package/dist/src/user-model/capture/executor.js +99 -3
- package/dist/src/user-model/capture/semantic.d.ts +18 -0
- package/dist/src/user-model/capture/semantic.js +72 -6
- package/dist/src/user-model/goals.d.ts +4 -0
- package/dist/src/user-model/goals.js +4 -2
- package/dist/src/voice/realtime/agentEngine.js +0 -1
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C1rXNUAG.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-jOvT-fzU.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BKjKTlW8.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Dzq18pO1.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DW4SBQf4.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-57OGuewD.js +0 -1
- package/dist/gateway/static/root/assets/code-editor-D4_k-6QN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CT_I3kbR.js +0 -2
- package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BiHwiBnQ.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +0 -1
- package/dist/gateway/static/root/assets/index-aBs0EfQB.js +0 -72
- package/dist/gateway/static/root/assets/local-app-workbench-page-eBFVWmtH.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-ClvcWlL6.js +0 -2
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D7V3j0vE.js +0 -1
- package/dist/gateway/static/root/assets/messages-W5P19VTF.js +0 -11
- package/dist/gateway/static/root/assets/note-detail-panel-CEEvR-fV.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLqgXNCx.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CIiFJ5tk.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B3UF-Pfm.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUtpkJPG.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-UgJmG-V4.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DDCzpdkl.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BdsqnCYj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ghzAQKna.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-W3GTm6nA.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BbAV3h7n.js +0 -5
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
4
|
-
import {
|
|
5
|
-
import { readCurrentSessionId } from "../storage/sqlite/session-repository.js";
|
|
4
|
+
import { readCurrentSessionId } from "../storage/sqlite/session-instance-repository.js";
|
|
6
5
|
import { getSessionInputState } from "../storage/sqlite/session-input-repository.js";
|
|
6
|
+
import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
|
|
7
|
+
import "../storage/sqlite/session-repository.js";
|
|
7
8
|
import { getConnectorInstallation, listConnectorConnections, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
9
|
+
import { getConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
8
10
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
9
11
|
import { getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "./composio.js";
|
|
10
12
|
import { getConnectorDefinition } from "./catalog.js";
|
|
11
13
|
import { capabilityActions, isToolInputSchema, missingConnectionCapabilities } from "./connection-capabilities.js";
|
|
12
14
|
import { connectorPrincipalForSession } from "./principal.js";
|
|
13
15
|
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
14
|
-
import {
|
|
16
|
+
import { listConnectorInstances } from "./instances.js";
|
|
15
17
|
import { installConnector } from "./install.js";
|
|
16
18
|
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
17
19
|
import { randomUUID } from "node:crypto";
|
|
@@ -79,7 +81,7 @@ var ConnectionRecoveryService = class {
|
|
|
79
81
|
}
|
|
80
82
|
view(wait, verifiedIds) {
|
|
81
83
|
const needs = wait.needs.map((need) => {
|
|
82
|
-
const instance =
|
|
84
|
+
const instance = listConnectorInstances(this.deps.getConfig()).find((instance) => instance.connectorId === need.connectorId);
|
|
83
85
|
const installation = getConnectorInstallation(`${need.connectorId}-${wait.principalId}`);
|
|
84
86
|
const scopeBlocked = Math.max(1, ...need.capabilities.filter((capability) => /^[A-Z]+_/.test(capability)).map((capability) => SCOPE_ORDER[scopeForComposioAction(capability).scope])) > SCOPE_ORDER[installation?.maxScope ?? "read"];
|
|
85
87
|
const blocked = scopeBlocked || instance?.enabled === false || installation?.enabled === false || Boolean(installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId));
|
|
@@ -87,9 +89,17 @@ var ConnectionRecoveryService = class {
|
|
|
87
89
|
principalId: wait.principalId,
|
|
88
90
|
connectorId: need.connectorId
|
|
89
91
|
});
|
|
90
|
-
const
|
|
92
|
+
const eligible = all.filter((connection) => connection.status === "active" && (!verifiedIds || verifiedIds.has(connection.id)) && (!need.accountId || connection.accountId === need.accountId) && (!installation?.selectedConnectionIds.length || installation.selectedConnectionIds.includes(connection.id)));
|
|
93
|
+
const byAccount = /* @__PURE__ */ new Map();
|
|
94
|
+
for (const connection of eligible) {
|
|
95
|
+
const key = connection.accountId ?? connection.id;
|
|
96
|
+
const previous = byAccount.get(key);
|
|
97
|
+
const preferredId = need.connectionId ?? eligible.find((item) => item.providerConnectionId === need.attempt?.connectionId)?.id ?? (connection.accountId ? getConnectorAccount(connection.accountId)?.currentConnectionId : void 0);
|
|
98
|
+
if (!previous || connection.id === preferredId || previous.id !== preferredId && connection.updatedAt > previous.updatedAt) byAccount.set(key, connection);
|
|
99
|
+
}
|
|
100
|
+
const active = [...byAccount.values()];
|
|
91
101
|
const selected = !verifiedIds && need.unavailable ? void 0 : need.attempt ? active.find((connection) => connection.providerConnectionId === need.attempt?.connectionId) : need.connectionId ? active.find((connection) => connection.id === need.connectionId) : active.length === 1 && !need.accountSelector ? active[0] : void 0;
|
|
92
|
-
const phase = blocked || selected && need.capabilityError ? "blocked" : selected
|
|
102
|
+
const phase = blocked || selected && need.capabilityError ? "blocked" : selected ? "ready" : active.length > 1 || need.accountSelector && active.length > 0 && !need.connectionId ? "choose_account" : need.attempt && need.attempt.expiresAt > Date.now() ? "authorizing" : need.unavailable || all.some((connection) => [
|
|
93
103
|
"expired",
|
|
94
104
|
"revoked",
|
|
95
105
|
"failed"
|
|
@@ -121,6 +131,28 @@ var ConnectionRecoveryService = class {
|
|
|
121
131
|
phase: wait.status === "queued" ? "queued" : ready ? review ? "review_scope" : "ready" : "needs_connection"
|
|
122
132
|
};
|
|
123
133
|
}
|
|
134
|
+
async ensureInstallation(wait, connectorId) {
|
|
135
|
+
const config = this.deps.getConfig();
|
|
136
|
+
const instance = listConnectorInstances(config).find((item) => item.connectorId === connectorId);
|
|
137
|
+
const installationId = `${connectorId}-${wait.principalId}`;
|
|
138
|
+
const installation = getConnectorInstallation(installationId);
|
|
139
|
+
if (instance?.enabled === false || installation?.enabled === false || installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId)) throw new Error("Connector policy blocks this connection.");
|
|
140
|
+
if (!instance) await persistConfigMutation({
|
|
141
|
+
config,
|
|
142
|
+
mutate: () => installConnector(config, connectorId, {}),
|
|
143
|
+
save: () => this.deps.saveConfig(config)
|
|
144
|
+
});
|
|
145
|
+
if (!installation) upsertConnectorInstallation({
|
|
146
|
+
id: installationId,
|
|
147
|
+
connectorId,
|
|
148
|
+
principalId: wait.principalId,
|
|
149
|
+
enabled: true,
|
|
150
|
+
allowedAgentIds: [],
|
|
151
|
+
maxScope: "read",
|
|
152
|
+
confirmationPolicy: "writes",
|
|
153
|
+
selectedConnectionIds: []
|
|
154
|
+
});
|
|
155
|
+
}
|
|
124
156
|
async checkCapabilities(wait, verified) {
|
|
125
157
|
const views = this.view({
|
|
126
158
|
...wait,
|
|
@@ -135,6 +167,7 @@ var ConnectionRecoveryService = class {
|
|
|
135
167
|
capabilityError: void 0
|
|
136
168
|
};
|
|
137
169
|
try {
|
|
170
|
+
if (!listConnectorInstances(this.deps.getConfig()).some((instance) => instance.connectorId === need.connectorId && instance.enabled)) throw new Error("Connector setup is unavailable");
|
|
138
171
|
const definition = getConnectorDefinition(need.connectorId);
|
|
139
172
|
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error("Unsupported connector");
|
|
140
173
|
const toolkit = definition.runtime.toolkit;
|
|
@@ -261,22 +294,8 @@ var ConnectionRecoveryService = class {
|
|
|
261
294
|
}, wait.version);
|
|
262
295
|
publishConnectionWait(sessionKey);
|
|
263
296
|
const config = this.deps.getConfig();
|
|
264
|
-
|
|
265
|
-
config,
|
|
266
|
-
mutate: () => installConnector(config, need.connectorId, {}),
|
|
267
|
-
save: () => this.deps.saveConfig(config)
|
|
268
|
-
});
|
|
297
|
+
await this.ensureInstallation(wait, need.connectorId);
|
|
269
298
|
const installationId = `${need.connectorId}-${wait.principalId}`;
|
|
270
|
-
if (!getConnectorInstallation(installationId)) upsertConnectorInstallation({
|
|
271
|
-
id: installationId,
|
|
272
|
-
connectorId: need.connectorId,
|
|
273
|
-
principalId: wait.principalId,
|
|
274
|
-
enabled: true,
|
|
275
|
-
allowedAgentIds: [],
|
|
276
|
-
maxScope: "read",
|
|
277
|
-
confirmationPolicy: "writes",
|
|
278
|
-
selectedConnectionIds: []
|
|
279
|
-
});
|
|
280
299
|
const auth = await this.adapter.authorize({
|
|
281
300
|
principalId: wait.principalId,
|
|
282
301
|
toolkit: definition.runtime.toolkit,
|
|
@@ -335,9 +354,14 @@ var ConnectionRecoveryService = class {
|
|
|
335
354
|
...item,
|
|
336
355
|
connectionId: connection.id,
|
|
337
356
|
accountId: connection.accountId,
|
|
338
|
-
unavailable: false
|
|
357
|
+
unavailable: false,
|
|
358
|
+
attempt: void 0
|
|
339
359
|
} : item);
|
|
340
360
|
}
|
|
361
|
+
for (const selected of this.view({
|
|
362
|
+
...wait,
|
|
363
|
+
needs
|
|
364
|
+
}, verified).needs) if (selected.phase === "ready" || selected.capabilityError && selected.connectionId) await this.ensureInstallation(wait, selected.connectorId);
|
|
341
365
|
needs = await this.checkCapabilities({
|
|
342
366
|
...wait,
|
|
343
367
|
needs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { mkdir, readFile } from "fs/promises";
|
|
@@ -4,7 +4,7 @@ import "../projects/index.js";
|
|
|
4
4
|
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { constants } from "node:fs";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
-
import { access, lstat, opendir, realpath, stat } from "node:fs/promises";
|
|
7
|
+
import { access, lstat, open, opendir, realpath, stat } from "node:fs/promises";
|
|
8
8
|
//#region src/files/file-service.ts
|
|
9
9
|
init_agent_scope();
|
|
10
10
|
const SKIPPED_NAMES = new Set([
|
|
@@ -12,26 +12,120 @@ const SKIPPED_NAMES = new Set([
|
|
|
12
12
|
".git",
|
|
13
13
|
"node_modules"
|
|
14
14
|
]);
|
|
15
|
+
const TEXT_SNIFF_BYTES = 8 * 1024;
|
|
15
16
|
const TEXT_EXTENSIONS = new Set([
|
|
17
|
+
"astro",
|
|
18
|
+
"bash",
|
|
19
|
+
"bat",
|
|
20
|
+
"c",
|
|
21
|
+
"cc",
|
|
22
|
+
"cfg",
|
|
23
|
+
"clj",
|
|
24
|
+
"cljs",
|
|
25
|
+
"cljc",
|
|
26
|
+
"cmd",
|
|
27
|
+
"conf",
|
|
28
|
+
"cpp",
|
|
29
|
+
"cs",
|
|
16
30
|
"css",
|
|
17
31
|
"csv",
|
|
18
|
-
"
|
|
32
|
+
"cts",
|
|
33
|
+
"cxx",
|
|
34
|
+
"dart",
|
|
35
|
+
"editorconfig",
|
|
36
|
+
"edn",
|
|
37
|
+
"env",
|
|
38
|
+
"erl",
|
|
39
|
+
"ex",
|
|
40
|
+
"exs",
|
|
41
|
+
"fish",
|
|
42
|
+
"fs",
|
|
43
|
+
"fsx",
|
|
44
|
+
"gitattributes",
|
|
45
|
+
"gitignore",
|
|
46
|
+
"go",
|
|
47
|
+
"gql",
|
|
48
|
+
"graphql",
|
|
49
|
+
"groovy",
|
|
50
|
+
"h",
|
|
51
|
+
"hh",
|
|
52
|
+
"hpp",
|
|
53
|
+
"hrl",
|
|
19
54
|
"htm",
|
|
55
|
+
"html",
|
|
56
|
+
"hxx",
|
|
57
|
+
"ini",
|
|
58
|
+
"java",
|
|
20
59
|
"js",
|
|
21
60
|
"json",
|
|
61
|
+
"json5",
|
|
62
|
+
"jsonc",
|
|
22
63
|
"jsx",
|
|
23
|
-
"
|
|
64
|
+
"kt",
|
|
65
|
+
"kts",
|
|
66
|
+
"less",
|
|
67
|
+
"lock",
|
|
68
|
+
"log",
|
|
69
|
+
"lua",
|
|
70
|
+
"m",
|
|
24
71
|
"markdown",
|
|
72
|
+
"md",
|
|
25
73
|
"mjs",
|
|
26
|
-
"
|
|
74
|
+
"mm",
|
|
75
|
+
"mts",
|
|
76
|
+
"nix",
|
|
77
|
+
"npmrc",
|
|
78
|
+
"php",
|
|
79
|
+
"pl",
|
|
80
|
+
"pm",
|
|
81
|
+
"properties",
|
|
82
|
+
"proto",
|
|
83
|
+
"ps1",
|
|
84
|
+
"py",
|
|
85
|
+
"pyw",
|
|
86
|
+
"r",
|
|
87
|
+
"rb",
|
|
88
|
+
"rs",
|
|
89
|
+
"sass",
|
|
90
|
+
"scala",
|
|
91
|
+
"scss",
|
|
92
|
+
"sh",
|
|
93
|
+
"sol",
|
|
94
|
+
"sql",
|
|
95
|
+
"svelte",
|
|
27
96
|
"svg",
|
|
97
|
+
"swift",
|
|
98
|
+
"tf",
|
|
99
|
+
"tfvars",
|
|
100
|
+
"toml",
|
|
28
101
|
"ts",
|
|
29
|
-
"tsx",
|
|
30
102
|
"tsv",
|
|
103
|
+
"tsx",
|
|
31
104
|
"txt",
|
|
105
|
+
"vue",
|
|
32
106
|
"xml",
|
|
107
|
+
"xsd",
|
|
108
|
+
"xsl",
|
|
33
109
|
"yaml",
|
|
34
|
-
"yml"
|
|
110
|
+
"yml",
|
|
111
|
+
"zsh"
|
|
112
|
+
]);
|
|
113
|
+
const TEXT_FILE_NAMES = new Set([
|
|
114
|
+
".dockerignore",
|
|
115
|
+
".eslintignore",
|
|
116
|
+
".prettierignore",
|
|
117
|
+
".stylelintignore",
|
|
118
|
+
"brewfile",
|
|
119
|
+
"changelog",
|
|
120
|
+
"codeowners",
|
|
121
|
+
"dockerfile",
|
|
122
|
+
"gemfile",
|
|
123
|
+
"jenkinsfile",
|
|
124
|
+
"license",
|
|
125
|
+
"makefile",
|
|
126
|
+
"procfile",
|
|
127
|
+
"rakefile",
|
|
128
|
+
"readme"
|
|
35
129
|
]);
|
|
36
130
|
const MIME_TYPES = {
|
|
37
131
|
png: "image/png",
|
|
@@ -82,16 +176,49 @@ function normalizeRelativePath(input) {
|
|
|
82
176
|
if (normalized.includes("\0") || normalized.split("/").some((part) => part === "..")) throw new FileServiceError(400, "Invalid file path");
|
|
83
177
|
return normalized.split("/").filter((part) => part && part !== ".").join("/");
|
|
84
178
|
}
|
|
85
|
-
function
|
|
179
|
+
function fileExtension(name) {
|
|
180
|
+
return name.includes(".") ? name.split(".").pop().toLowerCase() : "";
|
|
181
|
+
}
|
|
182
|
+
function isTextFileName(name) {
|
|
183
|
+
const normalized = name.toLowerCase();
|
|
184
|
+
const extension = fileExtension(normalized);
|
|
185
|
+
return TEXT_EXTENSIONS.has(extension) || TEXT_FILE_NAMES.has(normalized) || normalized.startsWith(".env.") || normalized.startsWith("dockerfile.");
|
|
186
|
+
}
|
|
187
|
+
function bufferLooksText(buffer) {
|
|
188
|
+
if (buffer.length === 0) return true;
|
|
189
|
+
let controlBytes = 0;
|
|
190
|
+
for (const byte of buffer) {
|
|
191
|
+
if (byte === 0) return false;
|
|
192
|
+
if ((byte < 8 || byte > 13 && byte < 32) && byte !== 27) controlBytes += 1;
|
|
193
|
+
}
|
|
194
|
+
return controlBytes / buffer.length < .01;
|
|
195
|
+
}
|
|
196
|
+
async function isTextFile(name, absolutePath) {
|
|
197
|
+
if (isTextFileName(name)) return true;
|
|
198
|
+
if (MIME_TYPES[fileExtension(name)]) return false;
|
|
199
|
+
const handle = await open(absolutePath, "r").catch(() => null);
|
|
200
|
+
if (!handle) return false;
|
|
201
|
+
try {
|
|
202
|
+
const buffer = Buffer.allocUnsafe(TEXT_SNIFF_BYTES);
|
|
203
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
204
|
+
return bufferLooksText(buffer.subarray(0, bytesRead));
|
|
205
|
+
} finally {
|
|
206
|
+
await handle.close();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function mimeType(name, directory, textFile) {
|
|
86
210
|
if (directory) return "inode/directory";
|
|
87
|
-
return MIME_TYPES[name
|
|
211
|
+
return MIME_TYPES[fileExtension(name)] ?? (textFile ? "text/plain" : "application/octet-stream");
|
|
88
212
|
}
|
|
89
|
-
function capabilities(name, directory, writable) {
|
|
213
|
+
function capabilities(name, directory, writable, textFile) {
|
|
90
214
|
if (directory) return writable ? ["share", "upload"] : ["share"];
|
|
91
|
-
const extension =
|
|
215
|
+
const extension = fileExtension(name);
|
|
92
216
|
const result = ["download", "share"];
|
|
93
|
-
if (MIME_TYPES[extension] ||
|
|
94
|
-
if (writable
|
|
217
|
+
if (MIME_TYPES[extension] || textFile) result.unshift("preview");
|
|
218
|
+
if (writable) {
|
|
219
|
+
if (textFile) result.push("edit");
|
|
220
|
+
result.push("delete");
|
|
221
|
+
}
|
|
95
222
|
return result;
|
|
96
223
|
}
|
|
97
224
|
function fileSpaceId(root) {
|
|
@@ -143,6 +270,7 @@ async function fileResourceFromPath(space, absolutePath, displayPath = absoluteP
|
|
|
143
270
|
const relativePath = relative(await realpath(space.root), displayPath).split(sep).join("/");
|
|
144
271
|
const name = basename(displayPath);
|
|
145
272
|
const directory = info.isDirectory();
|
|
273
|
+
const textFile = !directory && await isTextFile(name, absolutePath);
|
|
146
274
|
return {
|
|
147
275
|
id: fileResourceId(space.id, relativePath),
|
|
148
276
|
spaceId: space.id,
|
|
@@ -150,11 +278,11 @@ async function fileResourceFromPath(space, absolutePath, displayPath = absoluteP
|
|
|
150
278
|
relativePath,
|
|
151
279
|
parentPath: dirname(relativePath).split(sep).join("/").replace(/^\.$/, ""),
|
|
152
280
|
kind: directory ? "directory" : "file",
|
|
153
|
-
mimeType: mimeType(name, directory),
|
|
281
|
+
mimeType: mimeType(name, directory, textFile),
|
|
154
282
|
size: info.size,
|
|
155
283
|
modifiedAt: Math.max(0, Math.round(info.mtimeMs)),
|
|
156
284
|
revision: `${revisionInfo.mtimeNs}:${revisionInfo.ctimeNs}:${revisionInfo.ino}:${revisionInfo.size}`,
|
|
157
|
-
capabilities: capabilities(name, directory, space.writable)
|
|
285
|
+
capabilities: capabilities(name, directory, space.writable, textFile)
|
|
158
286
|
};
|
|
159
287
|
}
|
|
160
288
|
var FileSpaceService = class {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
3
2
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
3
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
5
5
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
6
6
|
import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
|
|
@@ -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";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -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";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasGatewayScope } from "../../security/gateway-scopes.js";
|
|
1
2
|
import { listConnectorLearningJobs } from "../../../storage/sqlite/connector-learning-repository.js";
|
|
2
3
|
import { decideConnectorApproval, getConnectorApproval, listConnectorApprovals, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
|
|
3
4
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
@@ -25,6 +26,7 @@ import { previewConnectorDefinition, testConnectorInstance } from "../../../conn
|
|
|
25
26
|
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
26
27
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
27
28
|
import { projectComposioConnectionStatus } from "../../../connectors/runtime-status.js";
|
|
29
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
28
30
|
import { markContextSourceAssertionsForReview } from "./context-sources.js";
|
|
29
31
|
//#region src/gateway/hono/routes/connectors.ts
|
|
30
32
|
init_agent_scope();
|
|
@@ -467,9 +469,15 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
467
469
|
ok: false,
|
|
468
470
|
error: "Invalid approval status."
|
|
469
471
|
}, 400);
|
|
472
|
+
const principalId = c.req.query("principalId")?.trim() || "local-owner";
|
|
473
|
+
const sessionKey = c.req.query("sessionKey")?.trim() || void 0;
|
|
474
|
+
if (!hasGatewayScope(getGatewayPrincipal(c).scopes, "gateway.admin") && (!sessionKey || principalId !== "local-owner")) return c.json({
|
|
475
|
+
ok: false,
|
|
476
|
+
error: "A local-owner session is required to read confirmations."
|
|
477
|
+
}, 403);
|
|
470
478
|
const approvals = listConnectorApprovals({
|
|
471
|
-
principalId
|
|
472
|
-
sessionKey
|
|
479
|
+
principalId,
|
|
480
|
+
sessionKey,
|
|
473
481
|
status,
|
|
474
482
|
limit: Number(c.req.query("limit") ?? "100")
|
|
475
483
|
});
|
|
@@ -582,10 +590,16 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
582
590
|
ok: false,
|
|
583
591
|
error: "Approval id and an approved or denied decision are required."
|
|
584
592
|
}, 400);
|
|
585
|
-
|
|
593
|
+
const current = getConnectorApproval(id);
|
|
594
|
+
if (!current) return c.json({
|
|
586
595
|
ok: false,
|
|
587
596
|
error: "Connector approval not found."
|
|
588
597
|
}, 404);
|
|
598
|
+
const sessionKey = typeof record.sessionKey === "string" ? record.sessionKey.trim() : "";
|
|
599
|
+
if (!hasGatewayScope(getGatewayPrincipal(c).scopes, "gateway.admin") && (!sessionKey || current.sessionKey !== sessionKey || current.principalId !== "local-owner")) return c.json({
|
|
600
|
+
ok: false,
|
|
601
|
+
error: "Confirmation does not belong to the requested local-owner session."
|
|
602
|
+
}, 403);
|
|
589
603
|
const approval = decideConnectorApproval(id, decision);
|
|
590
604
|
if (!approval || approval.status !== decision) return c.json({
|
|
591
605
|
ok: false,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FileServiceError, fileResourceFromPath, resolveFilePath } from "../../../files/file-service.js";
|
|
1
|
+
import { FileServiceError, fileResourceFromPath, parseFileResourceId, resolveFilePath } from "../../../files/file-service.js";
|
|
2
2
|
import { getGatewayFileSpaceService } from "../../file-space-service.js";
|
|
3
3
|
import { fuzzySearchWorkspaceFiles, fuzzySubsequenceScore } from "../../workspace-file-search.js";
|
|
4
4
|
import { registerFileReferenceRoutes } from "./file-references.js";
|
|
5
5
|
import { basename, join } from "node:path";
|
|
6
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
6
|
+
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
7
7
|
//#region src/gateway/hono/routes/files.ts
|
|
8
8
|
const mutationLocks = /* @__PURE__ */ new Map();
|
|
9
9
|
async function withMutationLock(key, action) {
|
|
@@ -185,6 +185,27 @@ function registerFilesRoutes(authenticated, deps) {
|
|
|
185
185
|
return errorResponse(c, error);
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
+
authenticated.delete("/api/files/:id", async (c) => {
|
|
189
|
+
try {
|
|
190
|
+
const id = c.req.param("id");
|
|
191
|
+
const initial = await files.resource(id);
|
|
192
|
+
if (!initial.space.writable) throw new FileServiceError(403, "File space is read-only");
|
|
193
|
+
if (initial.resource.kind !== "file") throw new FileServiceError(400, "Resource is not a file");
|
|
194
|
+
await withMutationLock(initial.absolutePath, async () => {
|
|
195
|
+
const current = await files.resource(id);
|
|
196
|
+
if (current.absolutePath !== initial.absolutePath) throw new FileServiceError(409, "File has changed");
|
|
197
|
+
if (current.resource.kind !== "file") throw new FileServiceError(400, "Resource is not a file");
|
|
198
|
+
const { relativePath } = parseFileResourceId(id);
|
|
199
|
+
await unlink(await resolveFilePath(current.space.root, relativePath, false)).catch((error) => {
|
|
200
|
+
if (error.code === "ENOENT") throw new FileServiceError(404, "File not found");
|
|
201
|
+
throw error;
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
return c.json({ ok: true });
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return errorResponse(c, error);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
188
209
|
authenticated.post("/api/files/spaces/:id/upload", async (c) => {
|
|
189
210
|
try {
|
|
190
211
|
const space = await files.get(c.req.param("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 { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
4
4
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
@@ -25,7 +25,7 @@ function registerTaskRoutes(authenticated, deps) {
|
|
|
25
25
|
const taskRateLimit = deps.taskRateLimitMiddleware ?? deps.strictRateLimitMiddleware;
|
|
26
26
|
const application = new TaskApplicationService();
|
|
27
27
|
const operatingViews = new ProjectOperatingViewService(deps.service.projects);
|
|
28
|
-
const monitoring = new ProjectMonitoringService();
|
|
28
|
+
const monitoring = new ProjectMonitoringService(deps.service.currentWorkspacePath);
|
|
29
29
|
const metrics = new TaskValueMetricsService();
|
|
30
30
|
const tasks = new TaskRepository();
|
|
31
31
|
const runs = new TaskRunRepository();
|
|
@@ -48,6 +48,8 @@ function requiredGatewayScope(method, path) {
|
|
|
48
48
|
if (path === "/api/device-auth/refresh" || path === "/api/devices/me") return "device.self";
|
|
49
49
|
if (path.startsWith("/api/devices/me/push")) return "notifications.self";
|
|
50
50
|
if (path.startsWith("/api/endpoint-tools")) return "device.self";
|
|
51
|
+
if (method === "GET" && path === "/api/connectors/approvals") return "sessions.read";
|
|
52
|
+
if (method === "POST" && path === "/api/connectors/approvals/respond") return "sessions.write";
|
|
51
53
|
if (path === "/api/agent" || path.startsWith("/api/agent/")) return "agents.run";
|
|
52
54
|
if (path.startsWith("/api/agents") || path.startsWith("/api/models")) return methodScope(method, "agents.read", "gateway.admin");
|
|
53
55
|
if (path.startsWith("/api/sessions") || path.startsWith("/api/side-chats")) return methodScope(method, "sessions.read", "sessions.write");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { onConnectionWaitChanged } from "../../storage/sqlite/connection-wait-repository.js";
|
|
4
3
|
import { listActiveSessionInputRuns } from "../../storage/sqlite/session-input-repository.js";
|
|
4
|
+
import { onConnectionWaitChanged } from "../../storage/sqlite/connection-wait-repository.js";
|
|
5
5
|
import "../../storage/sqlite/index.js";
|
|
6
6
|
import { ClarifyBridge } from "../clarify-bridge.js";
|
|
7
7
|
import { runGatewayAgent } from "./run-gateway-agent.js";
|
|
@@ -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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { inboundCorrelationMetadataFromAsyncLogContext, updateAsyncLogContext } from "../../utils/logger/context.js";
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
|
-
import { getConnectionResumeInput, isConnectionSuspended } from "../../storage/sqlite/connection-wait-repository.js";
|
|
5
4
|
import { updateInteractionStateFromMessage } from "../../storage/sqlite/interaction-state-repository.js";
|
|
5
|
+
import { getConnectionResumeInput, isConnectionSuspended } from "../../storage/sqlite/connection-wait-repository.js";
|
|
6
6
|
import "../../storage/sqlite/index.js";
|
|
7
7
|
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
8
8
|
import { resolveExecutionContext } from "../../tasks/execution-context.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { cancelConnectionObjective, consumeConnectionResume, invalidateConnectionResumeIntent, publishConnectionWait } from "../../storage/sqlite/connection-wait-repository.js";
|
|
4
3
|
import { SessionInstanceChangedError, cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, finishSessionInputRun, getSessionInputById, getSessionInputState, insertSessionInput, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus } from "../../storage/sqlite/session-input-repository.js";
|
|
5
4
|
import { replaceLatestSessionTurnAndQueueInput, validateLatestSessionTurnTarget } from "../../storage/sqlite/session-turn-replace-repository.js";
|
|
5
|
+
import { cancelConnectionObjective, consumeConnectionResume, invalidateConnectionResumeIntent, publishConnectionWait } from "../../storage/sqlite/connection-wait-repository.js";
|
|
6
6
|
import "../../storage/sqlite/index.js";
|
|
7
7
|
import { summarizeSourceContext } from "../../agent/source-context/types.js";
|
|
8
8
|
import { deleteMediaUrisNoLongerReferenced } from "../../media/session-references.js";
|
|
@@ -6,22 +6,22 @@ import { getRuntimeLogStats } from "../utils/logger/stats.js";
|
|
|
6
6
|
import { createLogger } from "../utils/logger/index.js";
|
|
7
7
|
import { init_logger } from "../utils/logger.js";
|
|
8
8
|
import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connection.js";
|
|
9
|
-
import { notifyUserContextChange } from "../user-context/changes.js";
|
|
10
9
|
import { insertSessionInput } from "../storage/sqlite/session-input-repository.js";
|
|
10
|
+
import { notifyUserContextChange } from "../user-context/changes.js";
|
|
11
11
|
import { getSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
12
12
|
import "../storage/sqlite/index.js";
|
|
13
13
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
14
14
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
15
|
-
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
16
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
17
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
18
15
|
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
16
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
19
17
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
20
18
|
import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
|
|
21
19
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
|
|
22
20
|
import { loadConfig, saveConfig } from "../config/loader.js";
|
|
23
|
-
import {
|
|
21
|
+
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
22
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
24
23
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
24
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
25
25
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
26
26
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
27
27
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
@@ -366,9 +366,9 @@ var GatewayService = class {
|
|
|
366
366
|
this.workspacePath = getWorkspacePath(this.config) || "./workspace";
|
|
367
367
|
this.initializeExtensionLoader();
|
|
368
368
|
this.sessionIndex = new SessionIndex({ config: this.config });
|
|
369
|
-
this.automationService = new AutomationService(this.proactive);
|
|
369
|
+
this.automationService = new AutomationService(this.proactive, this.workspacePath);
|
|
370
370
|
this.notesService = new NotesService(new NotesStore());
|
|
371
|
-
this.projects = new ProjectService(void 0, this.proactive);
|
|
371
|
+
this.projects = new ProjectService(void 0, this.proactive, this.workspacePath);
|
|
372
372
|
const emitDiscussion = (capture) => {
|
|
373
373
|
this.emit("discussion.updated", capture);
|
|
374
374
|
};
|
|
@@ -1096,7 +1096,11 @@ var GatewayService = class {
|
|
|
1096
1096
|
log.debug("Gateway service started");
|
|
1097
1097
|
}
|
|
1098
1098
|
ensureDefaultProactiveScenarioSubscriptions() {
|
|
1099
|
-
for (const scenarioKey of [
|
|
1099
|
+
for (const scenarioKey of [
|
|
1100
|
+
"automation_failure_impact",
|
|
1101
|
+
"meeting_preparation",
|
|
1102
|
+
"discussion_follow_up"
|
|
1103
|
+
]) {
|
|
1100
1104
|
if (this.proactiveScenarios.subscriptions(scenarioKey).some((subscription) => subscription.workspaceId === this.currentWorkspacePath)) continue;
|
|
1101
1105
|
this.proactiveScenarios.subscribe({
|
|
1102
1106
|
scenarioKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -3,6 +3,7 @@ export type KnowledgeKind = 'project_fact' | 'workspace_fact' | 'decision' | 'ta
|
|
|
3
3
|
export type KnowledgeStatus = 'candidate' | 'active' | 'needs_review' | 'stale' | 'archived' | 'rejected';
|
|
4
4
|
export type KnowledgeOriginClass = 'owner' | 'agent' | 'system' | 'untrusted';
|
|
5
5
|
export type KnowledgeRecordClass = 'memory' | 'source_index';
|
|
6
|
+
export type KnowledgeSource = 'session' | 'workspace' | 'project' | 'connector';
|
|
6
7
|
export interface KnowledgeItem {
|
|
7
8
|
id: string;
|
|
8
9
|
principalId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getKnowledgeItem, listKnowledgeItems, searchKnowledgeItems, setKnowledgeStatus, writeKnowledgeItem } from "./repository.js";
|
|
2
|
-
export { getKnowledgeItem, listKnowledgeItems, searchKnowledgeItems, setKnowledgeStatus, writeKnowledgeItem };
|
|
1
|
+
import { getKnowledgeItem, knowledgeSourceAllowed, listKnowledgeItems, searchKnowledgeItems, setKnowledgeStatus, writeKnowledgeItem } from "./repository.js";
|
|
2
|
+
export { getKnowledgeItem, knowledgeSourceAllowed, listKnowledgeItems, searchKnowledgeItems, setKnowledgeStatus, writeKnowledgeItem };
|