@xopcai/xopc 0.0.234 → 0.0.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-BzswYHcj.js → activity-store-DLfkwJzZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CztNAQyE.js → agent-avatar-dicebear-BCZ6T3y8.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-KPtQudPf.js +1 -0
- package/dist/gateway/static/root/assets/agents-DKQZKGCB.js +1 -0
- package/dist/gateway/static/root/assets/{api-7zOtMbaE.js → api-IUm57Zse.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-B_h6HVgw.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-D07Ew40N.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-_toby2SK.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DawToDU8.js → archive-plugin-Bha1jUhj.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BpCKsdiO.js → attachment-load-C2Ac3q6g.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-a6_hTplT.js → automations-page-Bc4Is3z0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DH-QeQ0O.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-OqUf-uET.js → binary-plugins-yMQJYHIQ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-9OAYqVKF.js → block-editor-DrNzI_0p.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-Bv8GclZd.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-4ooVX-Tx.js → browser-workflow-inputs-CHHw7Ula.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CUgwXXsi.js → browser-workflows-page-D_EOs50E.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-gKLN0aaW.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-Bh7BqWsN.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BDJvMnA_.js → channels-status-swr-CwUSKmeY.js} +1 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-B7agEwma.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-DifO0WX4.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-a9Jyianb.js → cron-expression-bjxQQFdv.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B_l2CHWO.js → date-picker-C7ujLHll.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-rl8E7nXp.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-ZCBsj8Je.js → desktop-pet-D4GbYBcD.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bo34tFlD.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CMXbAkx-.js → extension-debug-page-DuPa1bVQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-WWePedpo.js → extension-page-CB9xF3qo.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DjIhNJVI.js → extension-settings-page-CovEdmGD.js} +1 -1
- package/dist/gateway/static/root/assets/{files-Dp8_uGTO.js → files-DQjhZjr2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BNj6srhV.js → gateway-config-api-CAaoukkR.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-R702lNJR.js → gateway-config-swr-DfMY-MLf.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CesXGTe3.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-2rVSUvyw.js → gateway-startup-retry-S6aB0hVI.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-Bu5cIcNb.js +1 -0
- package/dist/gateway/static/root/assets/home-page-sQfx98tH.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B28USRCK.js → image-generation-api-DOX5uq-R.js} +1 -1
- package/dist/gateway/static/root/assets/index-C73V7tJP.js +70 -0
- package/dist/gateway/static/root/assets/index-C9rUND9-.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-d12AAEaC.js → keyboard-shortcuts-settings-CpZxPmd0.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DjvHSI0e.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-5KTZwLbX.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-8k4mvYGL.js → locale-store-XDFAPNNu.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-frYgoe2x.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-9iZjSpHe.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-7rTfQCN_.js → markdown-split-C4-0M8mu.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +1 -0
- package/dist/gateway/static/root/assets/markdown-view-v-O3cOpk.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-BIfKo5Ow.js → media-plugins-CjMa9GMF.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B1HDp_j8.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-DikJ7HCm.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-Bngs8o1m.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-p2Pncp2B.js → notes-api-BMhFpRmW.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-dOvbZBOQ.js → notes-page-CC45W2KR.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-BFreGbmY.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-DpLONwfK.js → oauth-api-B_pcOUfT.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DBrVS3tZ.js +1 -0
- package/dist/gateway/static/root/assets/{product-delivery-tRr-7IxY.js → product-delivery-dUJgmBQZ.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-B8cjLdm4.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-53z9nB5L.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DR7OvyAl.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B7b0LJgI.js → registry-api-DeVvBsl4.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BkSGDDbn.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D3PS55Yg.js → runtime-tools-settings-panel-DLv-QsQo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-H-aeWTzM.js → schema-form-DDW7aJWa.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C-yaSuuQ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CelrRPXt.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B9oF8Rhw.js → settings-form-section-5NTg906_.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CAmWMaOT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C6pmQNzY.js → settings-page-DgTYtrmh.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Dm_gdAfm.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BX2Ev7-I.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-D2Zd9l04.js +1 -0
- package/dist/gateway/static/root/assets/skeleton-BwbyijEw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BvND7xsL.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CfNV6kgb.js → skills-page-Cmqu9f_n.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DgxGb7v7.js → skills-page.utils-KOxLvm84.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-CS7cDwv2.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-COpgFG6K.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CpcBI73Q.js → theme-store-5-XHH7F0.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-D3h311_s.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DR7YWBzR.js → use-autosave-DvATIVb_.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-PKrbPu4w.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BZhqoxBR.js → voice-api-key-field-C3BgRKG2.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ynE-vY6I.js → voice-config-api-Bk_bVeGX.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CouKiK45.js → work-discovery-overlay-DHcQSZZD.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CUqAESrr.js → workflow-run-setup-panel-Nx6xmy_N.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DBkP6B4E.js +5 -0
- package/dist/gateway/static/root/index.html +19 -18
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +39 -0
- package/dist/packages/gateway-contract/src/model-selection.js +7 -0
- package/dist/packages/gateway-contract/src/new-session.js +9 -2
- package/dist/packages/gateway-contract/src/turn-outcome.js +27 -2
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +5 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/models/manager.d.ts +3 -0
- package/dist/src/agent/models/manager.js +9 -0
- package/dist/src/agent/prompt/sections/tooling.js +1 -0
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +6 -2
- package/dist/src/agent/session/session-config-service.js +78 -17
- package/dist/src/agent/session/session-hydrator.d.ts +3 -4
- package/dist/src/agent/session/session-hydrator.js +19 -8
- package/dist/src/agent/session/session-inspector.d.ts +3 -1
- package/dist/src/agent/session/session-inspector.js +8 -4
- 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/create-share-tool.js +1 -1
- package/dist/src/agent/tools/exec-command.js +1 -0
- package/dist/src/agent/tools/publish-artifacts.d.ts +1 -0
- package/dist/src/agent/tools/publish-artifacts.js +16 -5
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/transcript/thinking-types.d.ts +1 -1
- package/dist/src/agent/transcript/thinking-types.js +2 -0
- package/dist/src/agent-config/schema.d.ts +16 -16
- 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/domain/validation.d.ts +62 -62
- package/dist/src/automations/draft/automation-draft-validator.d.ts +10 -10
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -0
- 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.d.ts +137 -11
- package/dist/src/config/models-json.js +29 -2
- package/dist/src/config/schema.d.ts +15 -15
- package/dist/src/execution-environments/git.d.ts +27 -0
- package/dist/src/execution-environments/git.js +125 -0
- package/dist/src/execution-environments/index.d.ts +7 -0
- package/dist/src/execution-environments/index.js +8 -0
- package/dist/src/execution-environments/local-worktree-manager.d.ts +37 -0
- package/dist/src/execution-environments/local-worktree-manager.js +322 -0
- package/dist/src/execution-environments/paths.d.ts +2 -0
- package/dist/src/execution-environments/paths.js +18 -0
- package/dist/src/execution-environments/session-environment-service.d.ts +22 -0
- package/dist/src/execution-environments/session-environment-service.js +73 -0
- package/dist/src/execution-environments/store.d.ts +13 -0
- package/dist/src/execution-environments/store.js +183 -0
- package/dist/src/execution-environments/subject.d.ts +2 -0
- package/dist/src/execution-environments/subject.js +12 -0
- package/dist/src/execution-environments/types.d.ts +74 -0
- package/dist/src/execution-environments/types.js +54 -0
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/files/file-service.d.ts +10 -2
- package/dist/src/files/file-service.js +33 -12
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/custom-image-providers.d.ts +1 -1
- package/dist/src/gateway/file-path-classifier.d.ts +30 -0
- package/dist/src/gateway/file-path-classifier.js +105 -0
- package/dist/src/gateway/file-reference-errors.d.ts +6 -0
- package/dist/src/gateway/file-reference-errors.js +21 -0
- package/dist/src/gateway/file-reference-registry.d.ts +34 -0
- package/dist/src/gateway/file-reference-registry.js +45 -0
- package/dist/src/gateway/file-space-service.d.ts +4 -0
- package/dist/src/gateway/file-space-service.js +19 -0
- package/dist/src/gateway/hono/app.js +3 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -4
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/chat-model-config.d.ts +34 -0
- package/dist/src/gateway/hono/routes/chat-model-config.js +42 -0
- package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +100 -0
- package/dist/src/gateway/hono/routes/devices.js +15 -8
- package/dist/src/gateway/hono/routes/execution-environments.d.ts +3 -0
- package/dist/src/gateway/hono/routes/execution-environments.js +136 -0
- package/dist/src/gateway/hono/routes/file-references.d.ts +4 -0
- package/dist/src/gateway/hono/routes/file-references.js +98 -0
- package/dist/src/gateway/hono/routes/files.js +39 -17
- package/dist/src/gateway/hono/routes/html-preview.d.ts +4 -0
- package/dist/src/gateway/hono/routes/html-preview.js +45 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/mobile-privacy.d.ts +3 -0
- package/dist/src/gateway/hono/routes/mobile-privacy.js +13 -0
- package/dist/src/gateway/hono/routes/models.js +10 -1
- package/dist/src/gateway/hono/routes/projects.js +43 -4
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +122 -52
- package/dist/src/gateway/hono/routes/sessions.js +105 -22
- package/dist/src/gateway/hono/routes/shares.js +18 -10
- package/dist/src/gateway/hono/routes/tasks.js +7 -15
- package/dist/src/gateway/mobile-privacy.d.ts +7 -0
- package/dist/src/gateway/mobile-privacy.js +102 -0
- package/dist/src/gateway/security/csp.d.ts +1 -1
- package/dist/src/gateway/security/csp.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +2 -1
- package/dist/src/gateway/service/session-input-coordinator.js +14 -5
- package/dist/src/gateway/service/sessions-api.d.ts +4 -12
- package/dist/src/gateway/service/sessions-api.js +13 -0
- package/dist/src/gateway/service.d.ts +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/gateway/session-context-summary.d.ts +5 -0
- package/dist/src/gateway/session-context-summary.js +151 -0
- package/dist/src/i18n/response-language.d.ts +1 -1
- package/dist/src/projects/index.js +3 -3
- package/dist/src/projects/project-kind.d.ts +7 -0
- package/dist/src/projects/project-kind.js +6 -1
- package/dist/src/projects/project-service.js +10 -2
- package/dist/src/projects/project-store.d.ts +1 -0
- package/dist/src/projects/project-store.js +10 -7
- package/dist/src/projects/types.d.ts +4 -0
- 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 +3 -1
- package/dist/src/providers/model-thinking.d.ts +4 -0
- package/dist/src/providers/model-thinking.js +41 -0
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/config-types.d.ts +1 -0
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/model-config-lock.d.ts +2 -0
- package/dist/src/session/model-config-lock.js +14 -0
- package/dist/src/session/session-workspace.d.ts +2 -1
- package/dist/src/session/session-workspace.js +5 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/session/turn-outcome-projector.js +9 -9
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/storage/sqlite/config-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/config-repository.js +14 -6
- package/dist/src/storage/sqlite/device-access-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/device-access-repository.js +12 -2
- package/dist/src/storage/sqlite/device-pairing-approval.d.ts +19 -0
- package/dist/src/storage/sqlite/device-pairing-approval.js +154 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/device-pairing-repository.js +11 -4
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +17 -0
- package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +1 -0
- package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +1 -0
- package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +59 -0
- package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +5 -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.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +3 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/session-input-repository.js +15 -4
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/tasks/execution-context.d.ts +3 -1
- package/dist/src/tasks/execution-context.js +7 -2
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/components/thinking-selector.js +1 -0
- package/dist/src/tui/tui-settings.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/config.d.ts +9 -9
- package/dist/src/work-discovery/service.d.ts +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BHeLVAW5.js +0 -1
- package/dist/gateway/static/root/assets/agents-B8c0U7Ze.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BxBMAdWc.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DVAxCOPL.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BtzXxSYK.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-C7ZwZl04.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CEHhbDj0.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CAbI9beX.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-BksDnAyv.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-DB9zi_dy.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-CnY8lcGJ.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DjcEIzVJ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DJJf0EvL.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DvlFDxhZ.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-Dlahslof.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DJhUd30b.js +0 -1
- package/dist/gateway/static/root/assets/index-BTUuTnc9.css +0 -2
- package/dist/gateway/static/root/assets/index-CXGQihfj.js +0 -70
- package/dist/gateway/static/root/assets/local-app-workbench-page-DUP0UiFY.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-_z2o0cD1.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CPUaLcGH.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-eTBfNgXU.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +0 -1
- package/dist/gateway/static/root/assets/markdown-view-D02mJdoU.js +0 -201
- package/dist/gateway/static/root/assets/messages-CoovNoMn.js +0 -3
- package/dist/gateway/static/root/assets/mobile-device-api-CvjVB_TB.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-CYr6LzvY.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-DQMUpDc9.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CgZhadZQ.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D1HidxgT.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CxwNbbud.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CK59rSc_.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C2tP7363.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlYBA2N-.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CazDM3n5.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cn2E0G2o.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-XgxvE8cx.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Czph0_fM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DDq_QEqd.js +0 -1
- package/dist/gateway/static/root/assets/system-settings-panel-B4W--Ukh.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-UY5kNWoR.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-DnUL8kJU.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B8dJRjMJ.js +0 -5
- /package/dist/gateway/static/root/assets/{dist-DqPZM2MH2.js → dist-DqPZM2MH.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import "../storage/sqlite/index.js";
|
|
3
|
+
import { ExecutionEnvironmentStore } from "./store.js";
|
|
4
|
+
//#region src/execution-environments/subject.ts
|
|
5
|
+
function getExecutionEnvironmentForSession(sessionKey) {
|
|
6
|
+
if (!isXopcDatabaseOpen()) return void 0;
|
|
7
|
+
const store = new ExecutionEnvironmentStore();
|
|
8
|
+
const binding = store.resolveBinding(sessionKey);
|
|
9
|
+
return binding ? store.get(binding.environmentId) : void 0;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getExecutionEnvironmentForSession };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const EXECUTION_ENVIRONMENT_KINDS: readonly ["local_checkout", "managed_worktree"];
|
|
2
|
+
export type ExecutionEnvironmentKind = (typeof EXECUTION_ENVIRONMENT_KINDS)[number];
|
|
3
|
+
export declare const EXECUTION_ENVIRONMENT_STATUSES: readonly ["requested", "provisioning", "ready", "degraded", "deleting", "deleted", "error"];
|
|
4
|
+
export type ExecutionEnvironmentStatus = (typeof EXECUTION_ENVIRONMENT_STATUSES)[number];
|
|
5
|
+
export interface ExecutionEnvironment {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId?: string;
|
|
8
|
+
kind: ExecutionEnvironmentKind;
|
|
9
|
+
status: ExecutionEnvironmentStatus;
|
|
10
|
+
rootPath: string;
|
|
11
|
+
repositoryRoot?: string;
|
|
12
|
+
gitCommonDir?: string;
|
|
13
|
+
baseRef?: string;
|
|
14
|
+
baseSha?: string;
|
|
15
|
+
branchRef?: string;
|
|
16
|
+
version: number;
|
|
17
|
+
lastError?: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
lastUsedAt?: number;
|
|
21
|
+
deletedAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionEnvironmentBinding {
|
|
24
|
+
id: string;
|
|
25
|
+
sessionKey: string;
|
|
26
|
+
environmentId: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
releasedAt?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ExecutionEnvironmentEvent {
|
|
31
|
+
id: string;
|
|
32
|
+
environmentId: string;
|
|
33
|
+
fromStatus?: ExecutionEnvironmentStatus;
|
|
34
|
+
toStatus: ExecutionEnvironmentStatus;
|
|
35
|
+
reason: string;
|
|
36
|
+
metadata: Record<string, unknown>;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateExecutionEnvironmentInput {
|
|
40
|
+
id?: string;
|
|
41
|
+
projectId?: string;
|
|
42
|
+
kind: ExecutionEnvironmentKind;
|
|
43
|
+
rootPath: string;
|
|
44
|
+
repositoryRoot?: string;
|
|
45
|
+
gitCommonDir?: string;
|
|
46
|
+
baseRef?: string;
|
|
47
|
+
baseSha?: string;
|
|
48
|
+
branchRef?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ExecutionEnvironmentListQuery {
|
|
51
|
+
projectId?: string;
|
|
52
|
+
status?: ExecutionEnvironmentStatus;
|
|
53
|
+
includeDeleted?: boolean;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface BindExecutionEnvironmentInput {
|
|
57
|
+
sessionKey: string;
|
|
58
|
+
environmentId: string;
|
|
59
|
+
}
|
|
60
|
+
export interface TransitionExecutionEnvironmentInput {
|
|
61
|
+
environmentId: string;
|
|
62
|
+
toStatus: ExecutionEnvironmentStatus;
|
|
63
|
+
expectedVersion: number;
|
|
64
|
+
reason: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
export declare class ExecutionEnvironmentConflictError extends Error {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
export declare class ExecutionEnvironmentNotFoundError extends Error {
|
|
72
|
+
constructor(environmentId: string);
|
|
73
|
+
}
|
|
74
|
+
export declare function canTransitionExecutionEnvironment(fromStatus: ExecutionEnvironmentStatus, toStatus: ExecutionEnvironmentStatus): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/execution-environments/types.ts
|
|
2
|
+
const EXECUTION_ENVIRONMENT_KINDS = ["local_checkout", "managed_worktree"];
|
|
3
|
+
const EXECUTION_ENVIRONMENT_STATUSES = [
|
|
4
|
+
"requested",
|
|
5
|
+
"provisioning",
|
|
6
|
+
"ready",
|
|
7
|
+
"degraded",
|
|
8
|
+
"deleting",
|
|
9
|
+
"deleted",
|
|
10
|
+
"error"
|
|
11
|
+
];
|
|
12
|
+
var ExecutionEnvironmentConflictError = class extends Error {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "ExecutionEnvironmentConflictError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var ExecutionEnvironmentNotFoundError = class extends Error {
|
|
19
|
+
constructor(environmentId) {
|
|
20
|
+
super(`Execution environment not found: ${environmentId}`);
|
|
21
|
+
this.name = "ExecutionEnvironmentNotFoundError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const STATUS_TRANSITIONS = {
|
|
25
|
+
requested: [
|
|
26
|
+
"provisioning",
|
|
27
|
+
"deleting",
|
|
28
|
+
"error"
|
|
29
|
+
],
|
|
30
|
+
provisioning: [
|
|
31
|
+
"ready",
|
|
32
|
+
"degraded",
|
|
33
|
+
"deleting",
|
|
34
|
+
"error"
|
|
35
|
+
],
|
|
36
|
+
ready: [
|
|
37
|
+
"degraded",
|
|
38
|
+
"deleting",
|
|
39
|
+
"error"
|
|
40
|
+
],
|
|
41
|
+
degraded: [
|
|
42
|
+
"provisioning",
|
|
43
|
+
"deleting",
|
|
44
|
+
"error"
|
|
45
|
+
],
|
|
46
|
+
deleting: ["deleted", "error"],
|
|
47
|
+
deleted: [],
|
|
48
|
+
error: ["provisioning", "deleting"]
|
|
49
|
+
};
|
|
50
|
+
function canTransitionExecutionEnvironment(fromStatus, toStatus) {
|
|
51
|
+
return STATUS_TRANSITIONS[fromStatus].includes(toStatus);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { EXECUTION_ENVIRONMENT_KINDS, EXECUTION_ENVIRONMENT_STATUSES, ExecutionEnvironmentConflictError, ExecutionEnvironmentNotFoundError, canTransitionExecutionEnvironment };
|
|
@@ -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_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
3
|
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
4
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { mkdir, readFile } from "fs/promises";
|
|
@@ -15,17 +15,25 @@ export declare class FileServiceError extends Error {
|
|
|
15
15
|
readonly status: 400 | 403 | 404 | 409;
|
|
16
16
|
constructor(status: 400 | 403 | 404 | 409, message: string);
|
|
17
17
|
}
|
|
18
|
-
export declare function fileResourceFromPath(space: ResolvedFileSpace, absolutePath: string): Promise<FileResource>;
|
|
18
|
+
export declare function fileResourceFromPath(space: ResolvedFileSpace, absolutePath: string, displayPath?: string): Promise<FileResource>;
|
|
19
19
|
export declare class FileSpaceService {
|
|
20
20
|
private readonly getConfig;
|
|
21
21
|
private readonly projects;
|
|
22
22
|
private readonly resolveSessionWorkspace;
|
|
23
|
+
private readonly listSessionWorkspaces;
|
|
23
24
|
private readonly dynamicSpaces;
|
|
24
25
|
private cache;
|
|
25
|
-
constructor(getConfig: () => Config, projects: ProjectService, resolveSessionWorkspace: (sessionKey: string) => string)
|
|
26
|
+
constructor(getConfig: () => Config, projects: ProjectService, resolveSessionWorkspace: (sessionKey: string) => string | Promise<string>, listSessionWorkspaces?: () => Array<{
|
|
27
|
+
sessionKey: string;
|
|
28
|
+
root: string;
|
|
29
|
+
}> | Promise<Array<{
|
|
30
|
+
sessionKey: string;
|
|
31
|
+
root: string;
|
|
32
|
+
}>>);
|
|
26
33
|
private createSpace;
|
|
27
34
|
list(): Promise<ResolvedFileSpace[]>;
|
|
28
35
|
forContext(kind: 'agent' | 'project' | 'session', id: string): Promise<ResolvedFileSpace>;
|
|
36
|
+
defaultSpace(): Promise<ResolvedFileSpace>;
|
|
29
37
|
get(id: string): Promise<ResolvedFileSpace>;
|
|
30
38
|
resource(id: string): Promise<{
|
|
31
39
|
space: ResolvedFileSpace;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
1
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
2
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
3
3
|
import "../projects/index.js";
|
|
4
4
|
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -21,6 +21,7 @@ const TEXT_EXTENSIONS = new Set([
|
|
|
21
21
|
"json",
|
|
22
22
|
"jsx",
|
|
23
23
|
"md",
|
|
24
|
+
"markdown",
|
|
24
25
|
"mjs",
|
|
25
26
|
"cjs",
|
|
26
27
|
"svg",
|
|
@@ -40,6 +41,7 @@ const MIME_TYPES = {
|
|
|
40
41
|
webp: "image/webp",
|
|
41
42
|
svg: "image/svg+xml",
|
|
42
43
|
md: "text/markdown",
|
|
44
|
+
markdown: "text/markdown",
|
|
43
45
|
txt: "text/plain",
|
|
44
46
|
json: "application/json",
|
|
45
47
|
html: "text/html",
|
|
@@ -85,7 +87,7 @@ function mimeType(name, directory) {
|
|
|
85
87
|
return MIME_TYPES[name.includes(".") ? name.split(".").pop().toLowerCase() : ""] ?? "application/octet-stream";
|
|
86
88
|
}
|
|
87
89
|
function capabilities(name, directory, writable) {
|
|
88
|
-
if (directory) return writable ? ["upload"] : [];
|
|
90
|
+
if (directory) return writable ? ["share", "upload"] : ["share"];
|
|
89
91
|
const extension = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
|
|
90
92
|
const result = ["download", "share"];
|
|
91
93
|
if (MIME_TYPES[extension] || TEXT_EXTENSIONS.has(extension)) result.unshift("preview");
|
|
@@ -135,11 +137,11 @@ var FileServiceError = class extends Error {
|
|
|
135
137
|
this.status = status;
|
|
136
138
|
}
|
|
137
139
|
};
|
|
138
|
-
async function fileResourceFromPath(space, absolutePath) {
|
|
140
|
+
async function fileResourceFromPath(space, absolutePath, displayPath = absolutePath) {
|
|
139
141
|
const info = await stat(absolutePath);
|
|
140
142
|
const revisionInfo = await stat(absolutePath, { bigint: true });
|
|
141
|
-
const relativePath = relative(await realpath(space.root),
|
|
142
|
-
const name = basename(
|
|
143
|
+
const relativePath = relative(await realpath(space.root), displayPath).split(sep).join("/");
|
|
144
|
+
const name = basename(displayPath);
|
|
143
145
|
const directory = info.isDirectory();
|
|
144
146
|
return {
|
|
145
147
|
id: fileResourceId(space.id, relativePath),
|
|
@@ -158,10 +160,11 @@ async function fileResourceFromPath(space, absolutePath) {
|
|
|
158
160
|
var FileSpaceService = class {
|
|
159
161
|
dynamicSpaces = /* @__PURE__ */ new Map();
|
|
160
162
|
cache = null;
|
|
161
|
-
constructor(getConfig, projects, resolveSessionWorkspace) {
|
|
163
|
+
constructor(getConfig, projects, resolveSessionWorkspace, listSessionWorkspaces = () => []) {
|
|
162
164
|
this.getConfig = getConfig;
|
|
163
165
|
this.projects = projects;
|
|
164
166
|
this.resolveSessionWorkspace = resolveSessionWorkspace;
|
|
167
|
+
this.listSessionWorkspaces = listSessionWorkspaces;
|
|
165
168
|
}
|
|
166
169
|
async createSpace(root, title, bindings) {
|
|
167
170
|
const canonicalRoot = await realpath(root).catch(() => null);
|
|
@@ -213,6 +216,13 @@ var FileSpaceService = class {
|
|
|
213
216
|
offset += page.items.length;
|
|
214
217
|
}
|
|
215
218
|
const merged = /* @__PURE__ */ new Map();
|
|
219
|
+
for (const { sessionKey, root } of await this.listSessionWorkspaces()) {
|
|
220
|
+
const space = await this.createSpace(root, sessionKey, [{
|
|
221
|
+
kind: "session",
|
|
222
|
+
id: sessionKey
|
|
223
|
+
}]);
|
|
224
|
+
if (space) spaces.push(space);
|
|
225
|
+
}
|
|
216
226
|
for (const space of [...spaces, ...this.dynamicSpaces.values()]) {
|
|
217
227
|
const existing = merged.get(space.id);
|
|
218
228
|
if (existing) existing.bindings = [...existing.bindings, ...space.bindings.filter((binding) => !existing.bindings.some((item) => item.kind === binding.kind && item.id === binding.id))];
|
|
@@ -245,7 +255,7 @@ var FileSpaceService = class {
|
|
|
245
255
|
}
|
|
246
256
|
title = project?.name ?? id;
|
|
247
257
|
}
|
|
248
|
-
if (kind === "session") root = this.resolveSessionWorkspace(id);
|
|
258
|
+
if (kind === "session") root = await this.resolveSessionWorkspace(id);
|
|
249
259
|
if (!root) throw new FileServiceError(404, "File space not found");
|
|
250
260
|
const space = await this.createSpace(root, title, [{
|
|
251
261
|
kind,
|
|
@@ -256,8 +266,16 @@ var FileSpaceService = class {
|
|
|
256
266
|
this.cache = null;
|
|
257
267
|
return space;
|
|
258
268
|
}
|
|
269
|
+
defaultSpace() {
|
|
270
|
+
return this.forContext("agent", resolveDefaultAgentId(this.getConfig()));
|
|
271
|
+
}
|
|
259
272
|
async get(id) {
|
|
260
|
-
const
|
|
273
|
+
const hadCache = this.cache !== null;
|
|
274
|
+
let space = (await this.list()).find((item) => item.id === id);
|
|
275
|
+
if (!space && hadCache) {
|
|
276
|
+
this.cache = null;
|
|
277
|
+
space = (await this.list()).find((item) => item.id === id);
|
|
278
|
+
}
|
|
261
279
|
if (!space) throw new FileServiceError(404, "File space not found");
|
|
262
280
|
return space;
|
|
263
281
|
}
|
|
@@ -267,7 +285,7 @@ var FileSpaceService = class {
|
|
|
267
285
|
const absolutePath = await resolveFilePath(space.root, locator.relativePath);
|
|
268
286
|
return {
|
|
269
287
|
space,
|
|
270
|
-
resource: await fileResourceFromPath(space, absolutePath),
|
|
288
|
+
resource: await fileResourceFromPath(space, absolutePath, resolve(space.root, locator.relativePath)),
|
|
271
289
|
absolutePath
|
|
272
290
|
};
|
|
273
291
|
}
|
|
@@ -280,9 +298,12 @@ var FileSpaceService = class {
|
|
|
280
298
|
for await (const entry of dir) {
|
|
281
299
|
if (SKIPPED_NAMES.has(entry.name)) continue;
|
|
282
300
|
const target = resolve(directory, entry.name);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
301
|
+
if (!await lstat(target).catch(() => null)) continue;
|
|
302
|
+
const canonicalTarget = await resolveFilePath(space.root, target).catch(() => null);
|
|
303
|
+
if (!canonicalTarget) continue;
|
|
304
|
+
const info = await stat(canonicalTarget).catch(() => null);
|
|
305
|
+
if (!info || !info.isFile() && !info.isDirectory()) continue;
|
|
306
|
+
entries.push(await fileResourceFromPath(space, canonicalTarget, resolve(space.root, path, entry.name)));
|
|
286
307
|
}
|
|
287
308
|
return entries.sort((a, b) => a.kind === b.kind ? a.name.localeCompare(b.name) : a.kind === "directory" ? -1 : 1);
|
|
288
309
|
}
|
|
@@ -247,4 +247,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
247
247
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
248
248
|
};
|
|
249
249
|
}];
|
|
250
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "
|
|
250
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "memory_search" | "memory_get" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "dreaming" | "web_extract" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "xopc_tool_search" | "xopc_tool_describe" | "xopc_tool_execute" | "send_message" | "send_media" | "read_media" | "create_share" | "session_status" | "tool_manual" | "delegate_task" | "skill_install" | "text_to_speech" | "execute_code" | "create_desktop_pet")[];
|
|
@@ -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 { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
3
2
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
3
|
+
import { WORKSPACE_FILES, init_paths } from "../config/paths.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";
|
|
@@ -53,8 +53,8 @@ export declare const CustomImageProviderInputSchema: z.ZodObject<{
|
|
|
53
53
|
qualities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
54
54
|
low: "low";
|
|
55
55
|
high: "high";
|
|
56
|
-
auto: "auto";
|
|
57
56
|
medium: "medium";
|
|
57
|
+
auto: "auto";
|
|
58
58
|
}>>>;
|
|
59
59
|
formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
60
60
|
png: "png";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import type { FileReferenceLocationKind, FileReferenceScope } from './file-reference-registry.js';
|
|
3
|
+
export type { FileReferenceLocationKind };
|
|
4
|
+
export interface FilePathClassifierContext {
|
|
5
|
+
workspaceRoot: string;
|
|
6
|
+
profileMarkdownRoot?: string;
|
|
7
|
+
stateDir: string;
|
|
8
|
+
skillsDir: string;
|
|
9
|
+
configFilePath: string;
|
|
10
|
+
agentsHomeDir: string;
|
|
11
|
+
agentId: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildFilePathClassifierContext(cfg: Config, sessionKeyRaw?: string): FilePathClassifierContext;
|
|
14
|
+
export declare function looksLikeHostAbsolutePath(pathRaw: string): boolean;
|
|
15
|
+
export declare function fileRefSessionKeysMatch(registered?: string, query?: string): boolean;
|
|
16
|
+
export interface ClassifiedFileLocation {
|
|
17
|
+
scope: FileReferenceScope;
|
|
18
|
+
locationKind?: FileReferenceLocationKind;
|
|
19
|
+
manageRoute?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function classifyFileLocation(absPath: string, ctx: FilePathClassifierContext): ClassifiedFileLocation;
|
|
22
|
+
export interface ResolveFileReferenceCandidateResult {
|
|
23
|
+
candidate: string | null;
|
|
24
|
+
invalid: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve user path to an absolute candidate (workspace, absolute host, or profile fallback).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveFileReferenceCandidate(rawPath: string, workspaceRoot: string, ctx: FilePathClassifierContext): Promise<ResolveFileReferenceCandidateResult>;
|
|
30
|
+
export declare function displayNameForPath(rawPath: string): string;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
|
+
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
|
+
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
5
|
+
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
|
+
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
|
+
import { basename, isAbsolute, resolve } from "node:path";
|
|
8
|
+
import { stat } from "node:fs/promises";
|
|
9
|
+
//#region src/gateway/file-path-classifier.ts
|
|
10
|
+
init_agent_scope();
|
|
11
|
+
init_paths();
|
|
12
|
+
init_paths_state();
|
|
13
|
+
function buildFilePathClassifierContext(cfg, sessionKeyRaw) {
|
|
14
|
+
const agentId = extractProfileAgentId(sessionKeyRaw, cfg);
|
|
15
|
+
const stateDir = resolveStateDir();
|
|
16
|
+
return {
|
|
17
|
+
workspaceRoot: "",
|
|
18
|
+
profileMarkdownRoot: resolveAgentProfileDir(cfg, agentId),
|
|
19
|
+
stateDir,
|
|
20
|
+
skillsDir: resolveSkillsDir(),
|
|
21
|
+
configFilePath: resolveConfigPath(),
|
|
22
|
+
agentsHomeDir: resolve(stateDir, "agents"),
|
|
23
|
+
agentId
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function looksLikeHostAbsolutePath(pathRaw) {
|
|
27
|
+
const p = pathRaw.trim();
|
|
28
|
+
if (!p) return false;
|
|
29
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(p) && !/^[A-Za-z]:[\\/]/.test(p)) return false;
|
|
30
|
+
return isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p) || p.startsWith("\\\\");
|
|
31
|
+
}
|
|
32
|
+
function fileRefSessionKeysMatch(registered, query) {
|
|
33
|
+
return (registered ?? "").trim() === (query ?? "").trim();
|
|
34
|
+
}
|
|
35
|
+
function classifyFileLocation(absPath, ctx) {
|
|
36
|
+
const p = resolve(absPath);
|
|
37
|
+
if (isPathUnderWorkspace(resolve(ctx.workspaceRoot), p)) return { scope: "workspace" };
|
|
38
|
+
if (ctx.profileMarkdownRoot) {
|
|
39
|
+
if (isPathUnderWorkspace(resolve(ctx.profileMarkdownRoot), p)) return {
|
|
40
|
+
scope: "agent-profile",
|
|
41
|
+
locationKind: "agent-profile",
|
|
42
|
+
manageRoute: `/agents/${encodeURIComponent(ctx.agentId)}`
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (isPathUnderWorkspace(resolve(ctx.skillsDir), p)) return {
|
|
46
|
+
scope: "external",
|
|
47
|
+
locationKind: "xopc-skills",
|
|
48
|
+
manageRoute: "/skills"
|
|
49
|
+
};
|
|
50
|
+
if (isPathUnderWorkspace(resolve(ctx.agentsHomeDir), p)) return {
|
|
51
|
+
scope: "external",
|
|
52
|
+
locationKind: "xopc-agents",
|
|
53
|
+
manageRoute: `/agents/${encodeURIComponent(ctx.agentId)}`
|
|
54
|
+
};
|
|
55
|
+
const stateRoot = resolve(ctx.stateDir);
|
|
56
|
+
if (p === resolve(ctx.configFilePath) || isPathUnderWorkspace(stateRoot, p)) return {
|
|
57
|
+
scope: "external",
|
|
58
|
+
locationKind: "xopc-config",
|
|
59
|
+
manageRoute: "/settings/gateway"
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
scope: "external",
|
|
63
|
+
locationKind: "host"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Resolve user path to an absolute candidate (workspace, absolute host, or profile fallback).
|
|
68
|
+
*/
|
|
69
|
+
async function resolveFileReferenceCandidate(rawPath, workspaceRoot, ctx) {
|
|
70
|
+
const displayRoot = workspaceRoot;
|
|
71
|
+
ctx = {
|
|
72
|
+
...ctx,
|
|
73
|
+
workspaceRoot: displayRoot
|
|
74
|
+
};
|
|
75
|
+
if (looksLikeHostAbsolutePath(rawPath)) return {
|
|
76
|
+
candidate: resolve(rawPath),
|
|
77
|
+
invalid: false
|
|
78
|
+
};
|
|
79
|
+
const wsPath = resolveWorkspaceSafePath(workspaceRoot, rawPath);
|
|
80
|
+
if (!wsPath) return {
|
|
81
|
+
candidate: null,
|
|
82
|
+
invalid: true
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
await stat(wsPath);
|
|
86
|
+
return {
|
|
87
|
+
candidate: wsPath,
|
|
88
|
+
invalid: false
|
|
89
|
+
};
|
|
90
|
+
} catch (e) {
|
|
91
|
+
if (e?.code === "ENOENT" && ctx.profileMarkdownRoot && isBareProfileMarkdownFileName(rawPath)) return {
|
|
92
|
+
candidate: resolveProfileMarkdownPathIfBareName(rawPath, ctx.profileMarkdownRoot),
|
|
93
|
+
invalid: false
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
candidate: wsPath,
|
|
97
|
+
invalid: false
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function displayNameForPath(rawPath) {
|
|
102
|
+
return basename(rawPath.replace(/\\/g, "/")) || rawPath;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { buildFilePathClassifierContext, classifyFileLocation, displayNameForPath, fileRefSessionKeysMatch, looksLikeHostAbsolutePath, resolveFileReferenceCandidate };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/gateway/file-reference-errors.ts
|
|
2
|
+
function classifyFileReferenceFsError(err) {
|
|
3
|
+
const code = err?.code;
|
|
4
|
+
if (code === "ENOENT" || code === "ENOTDIR") return {
|
|
5
|
+
code: "FILE_NOT_FOUND",
|
|
6
|
+
message: "File not found",
|
|
7
|
+
status: 404
|
|
8
|
+
};
|
|
9
|
+
if (code === "EACCES" || code === "EPERM") return {
|
|
10
|
+
code: "FILE_ACCESS_DENIED",
|
|
11
|
+
message: "Gateway does not have permission to access this file",
|
|
12
|
+
status: 403
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
code: "FILE_ACCESS_FAILED",
|
|
16
|
+
message: "Gateway could not access this file",
|
|
17
|
+
status: 500
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { classifyFileReferenceFsError };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type FileReferenceScope = 'workspace' | 'external' | 'agent-profile' | 'session-artifact' | 'missing' | 'invalid';
|
|
2
|
+
/** Where an off-workspace file lives (UI badge + manage deep link). */
|
|
3
|
+
export type FileReferenceLocationKind = 'agent-profile' | 'xopc-skills' | 'xopc-config' | 'xopc-agents' | 'xopc-sessions' | 'host';
|
|
4
|
+
export type FileReferenceCapability = 'preview' | 'edit' | 'openExternal' | 'revealInFolder' | 'copyPath' | 'importToWorkspace';
|
|
5
|
+
export interface RegisteredFileReference {
|
|
6
|
+
id: string;
|
|
7
|
+
absolutePath: string;
|
|
8
|
+
sessionKey?: string;
|
|
9
|
+
scope: FileReferenceScope;
|
|
10
|
+
locationKind?: FileReferenceLocationKind;
|
|
11
|
+
capabilities: FileReferenceCapability[];
|
|
12
|
+
expiresAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface RegisterFileReferenceInput {
|
|
15
|
+
absolutePath: string;
|
|
16
|
+
sessionKey?: string;
|
|
17
|
+
scope: FileReferenceScope;
|
|
18
|
+
locationKind?: FileReferenceLocationKind;
|
|
19
|
+
capabilities: FileReferenceCapability[];
|
|
20
|
+
ttlMs?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class FileReferenceRegistry {
|
|
23
|
+
private readonly refs;
|
|
24
|
+
register(input: RegisterFileReferenceInput): RegisteredFileReference;
|
|
25
|
+
resolve(id: string): RegisteredFileReference | null;
|
|
26
|
+
/**
|
|
27
|
+
* Remove a specific reference (used after a one-shot action like
|
|
28
|
+
* import-to-workspace completes so the source card can't be re-triggered).
|
|
29
|
+
* Returns true if the reference existed and was removed.
|
|
30
|
+
*/
|
|
31
|
+
expireById(id: string): boolean;
|
|
32
|
+
expire(now?: number): void;
|
|
33
|
+
}
|
|
34
|
+
export declare const fileReferenceRegistry: FileReferenceRegistry;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
//#region src/gateway/file-reference-registry.ts
|
|
3
|
+
const DEFAULT_TTL_MS = 1800 * 1e3;
|
|
4
|
+
var FileReferenceRegistry = class {
|
|
5
|
+
refs = /* @__PURE__ */ new Map();
|
|
6
|
+
register(input) {
|
|
7
|
+
this.expire();
|
|
8
|
+
const id = randomUUID();
|
|
9
|
+
const ref = {
|
|
10
|
+
id,
|
|
11
|
+
absolutePath: input.absolutePath,
|
|
12
|
+
sessionKey: input.sessionKey?.trim() || void 0,
|
|
13
|
+
scope: input.scope,
|
|
14
|
+
locationKind: input.locationKind,
|
|
15
|
+
capabilities: [...new Set(input.capabilities)],
|
|
16
|
+
expiresAt: Date.now() + (input.ttlMs ?? DEFAULT_TTL_MS)
|
|
17
|
+
};
|
|
18
|
+
this.refs.set(id, ref);
|
|
19
|
+
return ref;
|
|
20
|
+
}
|
|
21
|
+
resolve(id) {
|
|
22
|
+
this.expire();
|
|
23
|
+
const ref = this.refs.get(id);
|
|
24
|
+
if (!ref) return null;
|
|
25
|
+
if (ref.expiresAt <= Date.now()) {
|
|
26
|
+
this.refs.delete(id);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return ref;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Remove a specific reference (used after a one-shot action like
|
|
33
|
+
* import-to-workspace completes so the source card can't be re-triggered).
|
|
34
|
+
* Returns true if the reference existed and was removed.
|
|
35
|
+
*/
|
|
36
|
+
expireById(id) {
|
|
37
|
+
return this.refs.delete(id);
|
|
38
|
+
}
|
|
39
|
+
expire(now = Date.now()) {
|
|
40
|
+
for (const [id, ref] of this.refs) if (ref.expiresAt <= now) this.refs.delete(id);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const fileReferenceRegistry = new FileReferenceRegistry();
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FileReferenceRegistry, fileReferenceRegistry };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FileSpaceService } from '../files/file-service.js';
|
|
2
|
+
import type { GatewayService } from './service.js';
|
|
3
|
+
/** Share the file registry, including session-specific spaces, across gateway routes. */
|
|
4
|
+
export declare function getGatewayFileSpaceService(service: GatewayService): FileSpaceService;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { listSessionWorkspaceOverrides } from "../storage/sqlite/config-repository.js";
|
|
2
|
+
import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
|
|
3
|
+
import { getProjectForSession } from "../projects/workspace.js";
|
|
4
|
+
import { FileSpaceService } from "../files/file-service.js";
|
|
5
|
+
//#region src/gateway/file-space-service.ts
|
|
6
|
+
const services = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
/** Share the file registry, including session-specific spaces, across gateway routes. */
|
|
8
|
+
function getGatewayFileSpaceService(service) {
|
|
9
|
+
const existing = services.get(service);
|
|
10
|
+
if (existing) return existing;
|
|
11
|
+
const created = new FileSpaceService(() => service.currentConfig, service.projects, (sessionKey) => service.sessions.getEffectiveWorkspacePath(sessionKey), () => listSessionWorkspaceOverrides().map(({ sessionKey, workingDirectoryOverride }) => ({
|
|
12
|
+
sessionKey,
|
|
13
|
+
root: effectiveWorkspacePathForSession(service.currentConfig, sessionKey, { workingDirectoryOverride }, getProjectForSession(sessionKey))
|
|
14
|
+
})));
|
|
15
|
+
services.set(service, created);
|
|
16
|
+
return created;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getGatewayFileSpaceService };
|
|
@@ -21,6 +21,7 @@ import { resetLazyRouteBundlesForTests } from "./routes/lazy-fallback.js";
|
|
|
21
21
|
import { registerAuthenticatedRoutes } from "./routes/index.js";
|
|
22
22
|
import { prewarmStaticUiCache } from "./lib/static-ui.js";
|
|
23
23
|
import { registerPublicGatewayRoutes } from "./routes/public-gateway.js";
|
|
24
|
+
import { registerPublicHtmlPreviewRoute } from "./routes/html-preview.js";
|
|
24
25
|
import { registerSiteShareMiddleware } from "../../share/site-share-router.js";
|
|
25
26
|
import { Hono } from "hono";
|
|
26
27
|
import { cors } from "hono/cors";
|
|
@@ -109,7 +110,7 @@ function createHonoApp(config) {
|
|
|
109
110
|
const gatewayConsoleCsp = buildGatewayConsoleCspHeader();
|
|
110
111
|
app.use(createMiddleware(async (c, next) => {
|
|
111
112
|
await next();
|
|
112
|
-
if (isExtensionGatewayUiAssetPath(c.req.path)) return;
|
|
113
|
+
if (isExtensionGatewayUiAssetPath(c.req.path) || c.req.path === "/api/preview/html" && (c.req.method === "GET" || c.req.method === "HEAD")) return;
|
|
113
114
|
c.header("X-Frame-Options", "DENY");
|
|
114
115
|
c.header("X-Content-Type-Options", "nosniff");
|
|
115
116
|
c.header("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
@@ -194,6 +195,7 @@ function createHonoApp(config) {
|
|
|
194
195
|
})(c, next);
|
|
195
196
|
});
|
|
196
197
|
registerPublicGatewayRoutes(app, service);
|
|
198
|
+
registerPublicHtmlPreviewRoute(app);
|
|
197
199
|
registerDeviceAuthPublicRoutes(app);
|
|
198
200
|
registerPublicExtensionAssetRoutes(app, service);
|
|
199
201
|
registerPublicLocalAppPreviewRoutes(app, service);
|