@myrialabs/clopen 0.4.49 → 0.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/backend/chat/attachments.test.ts +106 -17
- package/backend/chat/attachments.ts +131 -34
- package/backend/chat/background-wait.test.ts +28 -0
- package/backend/chat/engine-handoff.ts +42 -6
- package/backend/chat/message-pages.test.ts +17 -0
- package/backend/chat/message-pages.ts +6 -2
- package/backend/chat/stream-manager.ts +114 -19
- package/backend/containers/actions.ts +22 -0
- package/backend/control/actions/projects.ts +93 -37
- package/backend/control/folders.test.ts +27 -2
- package/backend/control/index.ts +2 -1
- package/backend/database/migrations/056_support_mssql_driver.ts +7 -0
- package/backend/database/migrations/077_create_integration_db_links.ts +7 -0
- package/backend/database/migrations/086_single_owner.ts +66 -73
- package/backend/database/migrations/088_create_messages_fts_map.ts +52 -0
- package/backend/database/migrations/089_add_memory_layout_tiles.ts +58 -0
- package/backend/database/migrations/090_create_storage_tables.ts +83 -0
- package/backend/database/migrations/index.ts +25 -2
- package/backend/database/queries/graph-queries.ts +392 -135
- package/backend/database/queries/integration-queries.ts +10 -0
- package/backend/database/queries/memory-queue-queries.ts +11 -0
- package/backend/database/queries/message-fts.test.ts +120 -0
- package/backend/database/queries/message-queries.ts +45 -9
- package/backend/database/queries/project-queries.ts +6 -0
- package/backend/database/queries/session-queries.ts +6 -2
- package/backend/database/queries/utils-queries.ts +3 -0
- package/backend/database/utils/migration-runner.test.ts +196 -0
- package/backend/database/utils/migration-runner.ts +61 -16
- package/backend/database/utils/seeder-runner.ts +22 -16
- package/backend/engine/adapters/claude/environment.ts +4 -0
- package/backend/engine/adapters/claude/input-gate.test.ts +59 -0
- package/backend/engine/adapters/claude/input-gate.ts +74 -0
- package/backend/engine/adapters/claude/message-converter.test.ts +16 -0
- package/backend/engine/adapters/claude/message-converter.ts +8 -0
- package/backend/engine/adapters/claude/stream.ts +20 -0
- package/backend/engine/adapters/cursor/environment.ts +1 -1
- package/backend/engine/adapters/qwen/session-store.ts +10 -1
- package/backend/engine/types.ts +7 -0
- package/backend/git/identity/cli.ts +35 -0
- package/backend/git/identity/env.test.ts +52 -1
- package/backend/git/identity/env.ts +69 -10
- package/backend/git/identity/index.ts +25 -6
- package/backend/git/identity/resolve.ts +2 -1
- package/backend/git/identity/scope-config.test.ts +7 -4
- package/backend/git/identity/scope-config.ts +13 -7
- package/backend/git-hosts/accounts.ts +106 -0
- package/backend/git-hosts/auth/client-ids.ts +34 -0
- package/backend/git-hosts/auth/connect.ts +110 -0
- package/backend/git-hosts/auth/endpoints.ts +130 -0
- package/backend/git-hosts/auth/flows.ts +355 -0
- package/backend/git-hosts/auth/local.ts +152 -0
- package/backend/git-hosts/ci.ts +18 -0
- package/backend/git-hosts/cli.test.ts +82 -0
- package/backend/git-hosts/cli.ts +342 -0
- package/backend/git-hosts/credentials.ts +173 -0
- package/backend/git-hosts/git-credential.ts +30 -0
- package/backend/git-hosts/health.ts +39 -0
- package/backend/git-hosts/http.ts +174 -0
- package/backend/git-hosts/index.ts +34 -0
- package/backend/git-hosts/providers/bitbucket.ts +186 -0
- package/backend/git-hosts/providers/gitea.ts +208 -0
- package/backend/git-hosts/providers/github.ts +270 -0
- package/backend/git-hosts/providers/gitlab-client.ts +70 -0
- package/backend/git-hosts/providers/gitlab.ts +285 -0
- package/backend/git-hosts/providers/locators.test.ts +68 -0
- package/backend/git-hosts/registry.ts +50 -0
- package/backend/git-hosts/service.ts +432 -0
- package/backend/git-hosts/types.ts +82 -0
- package/backend/git-hosts/urls.test.ts +42 -0
- package/backend/git-hosts/urls.ts +69 -0
- package/backend/index.ts +84 -17
- package/backend/integrations/accounts.ts +50 -3
- package/backend/integrations/registry/define.ts +9 -0
- package/backend/integrations/registry/index.ts +11 -0
- package/backend/integrations/registry/providers/bitbucket.ts +51 -0
- package/backend/integrations/registry/providers/gitea.ts +53 -0
- package/backend/integrations/registry/providers/github.ts +24 -7
- package/backend/integrations/registry/providers/gitlab.ts +57 -0
- package/backend/integrations/registry/types.ts +13 -1
- package/backend/mcp/internal/servers/browser-automation/actions/inspect.ts +115 -31
- package/backend/mcp/internal/servers/browser-automation/description.ts +5 -0
- package/backend/memory/README.md +7 -4
- package/backend/memory/layout.test.ts +377 -0
- package/backend/memory/layout.ts +1029 -265
- package/backend/memory/view.ts +257 -386
- package/backend/mentions/diff.ts +63 -0
- package/backend/mentions/index.ts +109 -0
- package/backend/mentions/mentions.test.ts +27 -0
- package/backend/mentions/shared.ts +82 -0
- package/backend/mentions/sources/ai-changes.ts +140 -0
- package/backend/mentions/sources/chats.ts +122 -0
- package/backend/mentions/sources/database.ts +211 -0
- package/backend/mentions/sources/files.ts +240 -0
- package/backend/mentions/sources/git.ts +308 -0
- package/backend/mentions/sources/notes-memory.ts +121 -0
- package/backend/mentions/sources/ops.ts +125 -0
- package/backend/mentions/sources/preview.ts +153 -0
- package/backend/mentions/sources/projects.ts +114 -0
- package/backend/mentions/sources/system.ts +135 -0
- package/backend/mentions/sources/terminal.ts +50 -0
- package/backend/mentions/types.ts +75 -0
- package/backend/preview/browser/bot-check-frames.test.ts +49 -0
- package/backend/preview/browser/bot-check-frames.ts +66 -0
- package/backend/preview/browser/browser-dialog-handler.ts +6 -5
- package/backend/preview/browser/browser-host-bridge.ts +4 -2
- package/backend/preview/browser/browser-native-ui-handler.ts +21 -0
- package/backend/preview/browser/browser-pool.ts +26 -17
- package/backend/preview/browser/browser-preview-service.ts +164 -2
- package/backend/preview/browser/browser-screenshot.test.ts +113 -0
- package/backend/preview/browser/browser-screenshot.ts +396 -0
- package/backend/preview/browser/browser-tab-manager.ts +35 -186
- package/backend/preview/browser/browser-video-capture.ts +12 -17
- package/backend/preview/browser/element-describe.ts +125 -0
- package/backend/preview/browser/page-binding.ts +141 -0
- package/backend/preview/browser/screenshot-files.test.ts +117 -0
- package/backend/preview/browser/screenshot-files.ts +134 -0
- package/backend/preview/browser/user-agent.test.ts +25 -0
- package/backend/preview/browser/user-agent.ts +100 -0
- package/backend/project/status-manager.ts +4 -2
- package/backend/projects/engine-transcripts.ts +153 -0
- package/backend/projects/folder-guard.ts +55 -0
- package/backend/projects/move.test.ts +208 -0
- package/backend/projects/move.ts +277 -0
- package/backend/projects/project-cleanup.integration.test.ts +3 -1
- package/backend/projects/project-cleanup.ts +10 -0
- package/backend/storage/actions.ts +260 -0
- package/backend/storage/chats.test.ts +57 -0
- package/backend/storage/chats.ts +170 -0
- package/backend/storage/database.ts +105 -0
- package/backend/storage/engine-homes.ts +145 -0
- package/backend/storage/fs-size.ts +111 -0
- package/backend/storage/history.ts +39 -0
- package/backend/storage/policy.ts +156 -0
- package/backend/storage/preview-profiles.ts +169 -0
- package/backend/storage/purge.ts +158 -0
- package/backend/storage/scanner.ts +339 -0
- package/backend/storage/session-index.ts +208 -0
- package/backend/storage/snapshots.ts +99 -0
- package/backend/storage/storage-flow.test.ts +137 -0
- package/backend/storage/transcripts/aliases.ts +75 -0
- package/backend/storage/transcripts/claude-dedupe.test.ts +101 -0
- package/backend/storage/transcripts/claude-dedupe.ts +152 -0
- package/backend/storage/transcripts/claude.ts +155 -0
- package/backend/storage/transcripts/cursor.ts +165 -0
- package/backend/storage/transcripts/file-stores.ts +224 -0
- package/backend/storage/transcripts/index.ts +207 -0
- package/backend/storage/transcripts/opencode.ts +124 -0
- package/backend/storage/transcripts/references.ts +42 -0
- package/backend/storage/transcripts/types.ts +58 -0
- package/backend/storage/worktrees.ts +114 -0
- package/backend/terminal/ptykit.ts +25 -0
- package/backend/update/registry.ts +24 -0
- package/backend/update/release-notes.test.ts +110 -0
- package/backend/update/release-notes.ts +132 -0
- package/backend/update/restart.ts +159 -0
- package/backend/utils/env.test.ts +64 -0
- package/backend/utils/env.ts +23 -55
- package/backend/utils/port-utils.ts +13 -0
- package/backend/work/index.ts +13 -2
- package/backend/work/providers/github/actions-logs.ts +1 -1
- package/backend/work/providers/github/adapter.ts +32 -1
- package/backend/work/providers/github/client.ts +7 -3
- package/backend/work/providers/gitlab/adapter.ts +770 -0
- package/backend/work/providers/gitlab/system-notes.test.ts +24 -0
- package/backend/work/service.ts +60 -36
- package/backend/work/start-work.ts +1 -1
- package/backend/work/types.ts +4 -0
- package/backend/worktrees/index.ts +1 -0
- package/backend/worktrees/service.ts +23 -2
- package/backend/ws/chat/composer.ts +47 -6
- package/backend/ws/chat/stream.ts +19 -10
- package/backend/ws/files/search.ts +1 -1
- package/backend/ws/files/write.ts +27 -0
- package/backend/ws/hosting/index.ts +231 -0
- package/backend/ws/index.ts +12 -2
- package/backend/ws/integrations/crud.ts +31 -5
- package/backend/ws/integrations/hosting-auth.ts +227 -0
- package/backend/ws/integrations/index.ts +2 -0
- package/backend/ws/memory/crud.ts +118 -81
- package/backend/ws/mentions/index.ts +81 -0
- package/backend/ws/messages/crud.ts +3 -1
- package/backend/ws/preview/browser/screenshot.ts +184 -0
- package/backend/ws/preview/index.ts +23 -0
- package/backend/ws/projects/crud.ts +66 -58
- package/backend/ws/sessions/crud.ts +7 -95
- package/backend/ws/snapshot/changes.ts +3 -3
- package/backend/ws/storage/index.ts +102 -0
- package/backend/ws/system/index.ts +7 -0
- package/backend/ws/system/operations.ts +125 -69
- package/backend/ws/work/context.ts +3 -4
- package/backend/ws/work/crud.ts +33 -0
- package/backend/ws/work/schemas.ts +4 -1
- package/bin/clopen.ts +18 -18
- package/dist/assets/{index-DD0-3EWg.js → index-B9rHDvjg.js} +1 -1
- package/dist/assets/index-B9rHDvjg.js.br +0 -0
- package/dist/assets/index-B9rHDvjg.js.gz +0 -0
- package/dist/assets/{index-CrVWZH_D.js → index-DFlwOd7k.js} +1 -1
- package/dist/assets/index-DFlwOd7k.js.br +0 -0
- package/dist/assets/index-DFlwOd7k.js.gz +0 -0
- package/dist/assets/main-Bz_brxxS.css +1 -0
- package/dist/assets/main-Bz_brxxS.css.br +0 -0
- package/dist/assets/main-Bz_brxxS.css.gz +0 -0
- package/dist/assets/main-DRcX9SHx.js +1273 -0
- package/dist/assets/main-DRcX9SHx.js.br +0 -0
- package/dist/assets/main-DRcX9SHx.js.gz +0 -0
- package/dist/assets/pdf-DfwfQPLy.js +57 -0
- package/dist/assets/pdf-DfwfQPLy.js.br +0 -0
- package/dist/assets/pdf-DfwfQPLy.js.gz +0 -0
- package/dist/assets/pdf.worker.min-B5Yc7dP4.mjs +27 -0
- package/dist/assets/pdf.worker.min-B5Yc7dP4.mjs.br +0 -0
- package/dist/assets/pdf.worker.min-B5Yc7dP4.mjs.gz +0 -0
- package/dist/assets/pdf.worker.min-BOrSNwfp.js +1 -0
- package/dist/index.html +2 -2
- package/dist/index.html.br +0 -0
- package/dist/index.html.gz +0 -0
- package/dist/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/dist/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GB-H.bcmap +6 -0
- package/dist/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/dist/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/dist/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
- package/dist/vendor/pdfjs/iccs/LICENSE +116 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_PDFJS_QUICKJS +21 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/vendor/pdfjs/wasm/LICENSE_QUICKJS +22 -0
- package/dist/vendor/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/vendor/pdfjs/wasm/jbig2.wasm.br +0 -0
- package/dist/vendor/pdfjs/wasm/jbig2.wasm.gz +0 -0
- package/dist/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +2 -0
- package/dist/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js.br +0 -0
- package/dist/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js.gz +0 -0
- package/dist/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/vendor/pdfjs/wasm/openjpeg.wasm.br +0 -0
- package/dist/vendor/pdfjs/wasm/openjpeg.wasm.gz +0 -0
- package/dist/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +2 -0
- package/dist/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js.br +0 -0
- package/dist/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js.gz +0 -0
- package/dist/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/vendor/pdfjs/wasm/qcms_bg.wasm.br +0 -0
- package/dist/vendor/pdfjs/wasm/qcms_bg.wasm.gz +0 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.js +16 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.js.br +0 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.js.gz +0 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.wasm.br +0 -0
- package/dist/vendor/pdfjs/wasm/quickjs-eval.wasm.gz +0 -0
- package/package.json +8 -9
- package/scripts/start.ts +21 -4
- package/shared/constants/binary-extensions.ts +20 -4
- package/shared/constants/support.test.ts +27 -0
- package/shared/constants/support.ts +79 -0
- package/shared/constants/tool-icons.ts +7 -1
- package/shared/types/database/schema.ts +6 -0
- package/shared/types/git-hosting.ts +241 -0
- package/shared/types/integrations.ts +51 -1
- package/shared/types/memory.ts +96 -73
- package/shared/types/mentions.ts +96 -0
- package/shared/types/release-notes.ts +31 -0
- package/shared/types/storage.ts +175 -0
- package/shared/types/stores/settings.ts +16 -0
- package/shared/types/unified/index.ts +2 -0
- package/shared/types/unified/message.ts +26 -1
- package/shared/types/unified/stream.ts +22 -1
- package/shared/types/unified/tool.ts +4 -0
- package/shared/types/work.ts +6 -0
- package/shared/utils/attachment-mentions.test.ts +39 -0
- package/shared/utils/attachment-mentions.ts +100 -0
- package/shared/utils/context-document.test.ts +53 -0
- package/shared/utils/context-document.ts +226 -0
- package/shared/utils/device-frame.test.ts +73 -0
- package/shared/utils/device-frame.ts +320 -0
- package/shared/utils/fuzzy.ts +79 -0
- package/shared/utils/launcher-fingerprint.test.ts +73 -0
- package/shared/utils/launcher-fingerprint.ts +108 -0
- package/shared/utils/logger.ts +2 -0
- package/shared/utils/page-colors.test.ts +17 -0
- package/shared/utils/page-colors.ts +24 -0
- package/shared/utils/process-supervisor.test.ts +88 -1
- package/shared/utils/process-supervisor.ts +123 -29
- package/shared/utils/process-tree.ts +99 -0
- package/shared/utils/restart-intent.test.ts +57 -0
- package/shared/utils/restart-intent.ts +80 -0
- package/shared/utils/semver.test.ts +33 -0
- package/shared/utils/semver.ts +35 -0
- package/shared/utils/supervised-child.ts +44 -0
- package/shared/utils/supervisor-protocol.ts +20 -0
- package/.env.example +0 -9
- package/dist/assets/graph-layout.worker-CRFqN7ZQ.js +0 -1
- package/dist/assets/graph-layout.worker-CRFqN7ZQ.js.br +0 -0
- package/dist/assets/graph-layout.worker-CRFqN7ZQ.js.gz +0 -0
- package/dist/assets/index-CrVWZH_D.js.br +0 -0
- package/dist/assets/index-CrVWZH_D.js.gz +0 -0
- package/dist/assets/index-DD0-3EWg.js.br +0 -0
- package/dist/assets/index-DD0-3EWg.js.gz +0 -0
- package/dist/assets/main-D2_TmcwQ.js +0 -1240
- package/dist/assets/main-D2_TmcwQ.js.br +0 -0
- package/dist/assets/main-D2_TmcwQ.js.gz +0 -0
- package/dist/assets/main-Yucigcmf.css +0 -1
- package/dist/assets/main-Yucigcmf.css.br +0 -0
- package/dist/assets/main-Yucigcmf.css.gz +0 -0
package/backend/index.ts
CHANGED
|
@@ -33,6 +33,13 @@ import { runGitHelper } from './git/identity/cli';
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
import { Elysia } from 'elysia';
|
|
36
|
+
import { RESTART_EXIT_CODE } from '$shared/utils/supervisor-protocol';
|
|
37
|
+
import { supervisorPid, watchSupervisor } from '$shared/utils/supervised-child';
|
|
38
|
+
import { onRestartRequested } from './update/restart';
|
|
39
|
+
import { clearRestartIntent } from '$shared/utils/restart-intent';
|
|
40
|
+
import { collectDescendants, signalAll } from '$shared/utils/process-tree';
|
|
41
|
+
import { ptyKitManager } from './terminal/ptykit';
|
|
42
|
+
import { tunnelKit } from './tunnel/tunnel-config';
|
|
36
43
|
import { corsMiddleware } from './middleware/cors';
|
|
37
44
|
import { errorHandlerMiddleware } from './middleware/error-handler';
|
|
38
45
|
import { loggerMiddleware } from './middleware/logger';
|
|
@@ -80,6 +87,7 @@ import { browserPreviewServiceManager } from './preview';
|
|
|
80
87
|
|
|
81
88
|
// MCP remote server for Open Code custom tools
|
|
82
89
|
import { handleMcpRequest, handleExternalMcpRequest, handleProjectMcpRequest, closeMcpServer, completeAuthorization } from './mcp';
|
|
90
|
+
import { completeBrowserFlow, failBrowserFlow } from './git-hosts';
|
|
83
91
|
|
|
84
92
|
// Auth middleware
|
|
85
93
|
import { checkRouteAccess, PUBLIC_ROUTES } from './auth/permissions';
|
|
@@ -98,6 +106,7 @@ import { ws as wsServer } from './utils/ws';
|
|
|
98
106
|
import { messageRateLimiter } from './ws/message-rate-limiter';
|
|
99
107
|
import { flushEpisodicIngest, stopExtractionRunner } from './memory/extract';
|
|
100
108
|
import { stopMemoryMaintenance } from './memory/maintenance';
|
|
109
|
+
import { startStorageMaintenance, stopStorageMaintenance } from './storage/policy';
|
|
101
110
|
import { WS_SERVER_OPTIONS } from './utils/ws-wire';
|
|
102
111
|
import { serveIndexHtml, serveStaticFile } from './http/static-assets';
|
|
103
112
|
|
|
@@ -233,6 +242,31 @@ const app = new Elysia({ websocket: WS_SERVER_OPTIONS })
|
|
|
233
242
|
}
|
|
234
243
|
})
|
|
235
244
|
|
|
245
|
+
// Stable OAuth redirect target for a git hosting sign-in in the browser
|
|
246
|
+
// (Gitea/Forgejo, self-managed GitLab). The connect dialog polls the flow,
|
|
247
|
+
// so this page only has to say how it went.
|
|
248
|
+
.get('/api/integrations/oauth/callback', async ({ query }) => {
|
|
249
|
+
const { code, state, error } = query as { code?: string; state?: string; error?: string };
|
|
250
|
+
const page = (title: string, body: string) =>
|
|
251
|
+
new Response(
|
|
252
|
+
`<!doctype html><html><head><meta charset="utf-8"><title>${title}</title><style>body{font-family:system-ui,sans-serif;background:#0f172a;color:#e2e8f0;display:flex;min-height:100vh;align-items:center;justify-content:center;margin:0}div{text-align:center;max-width:28rem;padding:2rem}h1{font-size:1.1rem}p{color:#94a3b8;font-size:.9rem}</style></head><body><div><h1>${title}</h1><p>${body}</p><script>setTimeout(()=>window.close(),2500)</script></div></body></html>`,
|
|
253
|
+
{ headers: { 'Content-Type': 'text/html' } }
|
|
254
|
+
);
|
|
255
|
+
const escape = (value: string) => value.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
256
|
+
if (error) {
|
|
257
|
+
if (state) failBrowserFlow(state, error);
|
|
258
|
+
return page('Sign-in failed', `The server returned: ${escape(error)}. You can close this tab and try again.`);
|
|
259
|
+
}
|
|
260
|
+
if (!code || !state) return page('Sign-in failed', 'Missing authorization code. You can close this tab and try again.');
|
|
261
|
+
try {
|
|
262
|
+
await completeBrowserFlow(state, code);
|
|
263
|
+
return page('Connected', 'Sign-in complete. You can close this tab and return to Clopen.');
|
|
264
|
+
} catch (err) {
|
|
265
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
266
|
+
return page('Sign-in failed', `${escape(message)}. You can close this tab and try again.`);
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
|
|
236
270
|
// HTTP file transfer — mounted before the WS plugin so /api/files/* stays
|
|
237
271
|
// on the HTTP path through the Vite dev proxy.
|
|
238
272
|
.use(filesUploadRoute)
|
|
@@ -338,6 +372,9 @@ async function startServer() {
|
|
|
338
372
|
// machine. Idle-cheap too — a machine with no runtime is remembered as
|
|
339
373
|
// having none, so the tick costs a cached lookup and no command at all.
|
|
340
374
|
containerMonitor.start();
|
|
375
|
+
// Scheduled cleanup (Settings → Storage). Idle-gated: a tick with a chat
|
|
376
|
+
// streaming, or before the interval has passed, returns immediately.
|
|
377
|
+
startStorageMaintenance();
|
|
341
378
|
} catch (error) {
|
|
342
379
|
console.error('❌ Database initialization failed — refusing to start:', error);
|
|
343
380
|
console.error(` Data directory: ${SERVER_ENV.DATA_DIR}`);
|
|
@@ -349,6 +386,8 @@ async function startServer() {
|
|
|
349
386
|
port: PORT,
|
|
350
387
|
hostname: HOST
|
|
351
388
|
}, () => {
|
|
389
|
+
// Back on the port a restart from the UI asked for; that restart is done.
|
|
390
|
+
clearRestartIntent(SERVER_ENV.DATA_DIR, supervisorPid());
|
|
352
391
|
if (isDevelopment) {
|
|
353
392
|
console.log('🚀 Backend ready — waiting for frontend...');
|
|
354
393
|
} else {
|
|
@@ -367,6 +406,14 @@ async function startServer() {
|
|
|
367
406
|
});
|
|
368
407
|
}
|
|
369
408
|
|
|
409
|
+
// Supervised (bin/clopen.ts, scripts/dev.ts): if the supervisor disappears
|
|
410
|
+
// without stopping us, stop anyway rather than keep the port unowned. Read
|
|
411
|
+
// before startServer spawns anything that would inherit the variable.
|
|
412
|
+
watchSupervisor(() => {
|
|
413
|
+
debug.warn('server', 'Supervisor is gone — shutting down');
|
|
414
|
+
void gracefulShutdown();
|
|
415
|
+
});
|
|
416
|
+
|
|
370
417
|
startServer().catch((error) => {
|
|
371
418
|
console.error('❌ Failed to start server:', error);
|
|
372
419
|
process.exit(1);
|
|
@@ -375,16 +422,19 @@ startServer().catch((error) => {
|
|
|
375
422
|
// Graceful shutdown - properly close server and database
|
|
376
423
|
let isShuttingDown = false;
|
|
377
424
|
|
|
378
|
-
async function gracefulShutdown() {
|
|
425
|
+
async function gracefulShutdown(exitCode = 0) {
|
|
379
426
|
if (isShuttingDown) return;
|
|
380
427
|
isShuttingDown = true;
|
|
381
428
|
|
|
382
|
-
//
|
|
383
|
-
//
|
|
429
|
+
// The port is released first thing (app.stop below), so the rest takes the
|
|
430
|
+
// time it actually needs. This only bounds a step that hangs: whatever this
|
|
431
|
+
// process started is then killed with it — the preview's Chrome sits in a
|
|
432
|
+
// process group of its own and would otherwise outlive us.
|
|
384
433
|
const forceExitTimer = setTimeout(() => {
|
|
385
|
-
debug.warn('server', '⚠️ Shutdown timeout — forcing exit
|
|
434
|
+
debug.warn('server', '⚠️ Shutdown timeout — forcing exit');
|
|
435
|
+
signalAll(collectDescendants(process.pid), 'SIGKILL');
|
|
386
436
|
process.exit(1);
|
|
387
|
-
},
|
|
437
|
+
}, 12_000);
|
|
388
438
|
|
|
389
439
|
console.log('\n🛑 Shutting down server...');
|
|
390
440
|
try {
|
|
@@ -404,6 +454,12 @@ async function gracefulShutdown() {
|
|
|
404
454
|
// transport so their remote sessions and bound ports are released now.
|
|
405
455
|
await sshForwardManager.stopAll();
|
|
406
456
|
sshClientPool.closeAll();
|
|
457
|
+
// Terminal tabs: each session's shell and everything started from it
|
|
458
|
+
// (a dev server, a background job) ends with the server.
|
|
459
|
+
ptyKitManager.dispose();
|
|
460
|
+
// Tunnels: cloudflared drains before it exits; wait for it so nothing is
|
|
461
|
+
// left serving this server's public URL.
|
|
462
|
+
await tunnelKit.stopAll();
|
|
407
463
|
// Dispose rate limiter timer
|
|
408
464
|
authRateLimiter.dispose();
|
|
409
465
|
// Dispose expired session cleanup timer
|
|
@@ -430,6 +486,7 @@ async function gracefulShutdown() {
|
|
|
430
486
|
// own — and the queue is a table, so whatever is left is picked up on the next
|
|
431
487
|
// start rather than lost.
|
|
432
488
|
stopMemoryMaintenance();
|
|
489
|
+
stopStorageMaintenance();
|
|
433
490
|
stopExtractionRunner();
|
|
434
491
|
await flushEpisodicIngest();
|
|
435
492
|
// Close database connection
|
|
@@ -439,28 +496,38 @@ async function gracefulShutdown() {
|
|
|
439
496
|
debug.error('server', '❌ Error during shutdown:', error);
|
|
440
497
|
}
|
|
441
498
|
clearTimeout(forceExitTimer);
|
|
442
|
-
process.exit(
|
|
499
|
+
process.exit(exitCode);
|
|
443
500
|
}
|
|
444
501
|
|
|
445
|
-
|
|
446
|
-
|
|
502
|
+
// Wrapped: a signal handler is called with the signal's name, which must not
|
|
503
|
+
// become the exit code.
|
|
504
|
+
process.on('SIGINT', () => void gracefulShutdown());
|
|
505
|
+
process.on('SIGTERM', () => void gracefulShutdown());
|
|
447
506
|
|
|
448
|
-
//
|
|
449
|
-
//
|
|
450
|
-
|
|
507
|
+
// Restart from the UI (backend/update/restart.ts): the same clean shutdown,
|
|
508
|
+
// ending in the exit code that tells the supervisor to start us again.
|
|
509
|
+
onRestartRequested(() => void gracefulShutdown(RESTART_EXIT_CODE));
|
|
510
|
+
|
|
511
|
+
// SIGHUP: the controlling terminal or SSH session closed. Started in a
|
|
512
|
+
// terminal, the server goes with it, like any program run there. Without one
|
|
513
|
+
// on stdout — supervised (the supervisor decides), `nohup`, a service — it
|
|
514
|
+
// keeps running. Without a handler Bun would exit abruptly instead.
|
|
515
|
+
const startedInTerminal = process.stdout.isTTY === true;
|
|
451
516
|
process.on('SIGHUP', () => {
|
|
452
|
-
|
|
517
|
+
if (startedInTerminal) {
|
|
518
|
+
void gracefulShutdown();
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
debug.log('server', 'Received SIGHUP — no terminal attached, server stays running');
|
|
453
522
|
});
|
|
454
523
|
|
|
455
524
|
// Safety net: prevent server crash from unhandled promise rejections.
|
|
456
525
|
// These can occur when third-party SDKs emit asynchronous errors that bypass
|
|
457
526
|
// the normal try/catch flow, e.g.:
|
|
458
527
|
// - AI engine SDKs whose subprocess is killed during initialization
|
|
459
|
-
// -
|
|
460
|
-
//
|
|
461
|
-
//
|
|
462
|
-
// handler attached and would otherwise kill the whole server while the user
|
|
463
|
-
// is interacting with the Preview.
|
|
528
|
+
// - CDP calls left in flight on a Preview target that closes mid-call (a
|
|
529
|
+
// popup, a tab the user just closed), which reject with TargetCloseError
|
|
530
|
+
// and would otherwise kill the whole server.
|
|
464
531
|
//
|
|
465
532
|
// IMPORTANT (Bun routing — verified on Bun 1.3.14): top-level unhandled
|
|
466
533
|
// rejections are suppressed by Node's process.on('unhandledRejection') but NOT
|
|
@@ -20,6 +20,8 @@ import { defaultCapabilitiesOf, getProvider, type IntegrationProvider } from './
|
|
|
20
20
|
import { randomBytes } from 'crypto';
|
|
21
21
|
import { reproject, releaseAll } from './projections';
|
|
22
22
|
import { debug } from '$shared/utils/logger';
|
|
23
|
+
import { getHostAdapter } from '$backend/git-hosts/registry';
|
|
24
|
+
import type { IntegrationAccountHosting, IntegrationAuthMethod } from '$shared/types/integrations';
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Told after any account is connected, reconfigured, toggled, rebound or
|
|
@@ -71,6 +73,36 @@ export interface ConnectInput {
|
|
|
71
73
|
projectId?: string | null;
|
|
72
74
|
credentials: Record<string, string>;
|
|
73
75
|
capabilities?: IntegrationCapability[];
|
|
76
|
+
/**
|
|
77
|
+
* How the credential was obtained. Defaults to the provider's primary
|
|
78
|
+
* method; a sign-in flow passes the one it actually used.
|
|
79
|
+
*/
|
|
80
|
+
authMethod?: IntegrationAuthMethod;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function assertKnownAuthMethod(provider: IntegrationProvider, method: IntegrationAuthMethod): void {
|
|
84
|
+
const allowed = provider.authMethods ?? [provider.authMethod];
|
|
85
|
+
if (!allowed.includes(method)) {
|
|
86
|
+
throw new Error(`${provider.name} cannot be connected with "${method}"`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Hosting facts for an account of a git hosting provider — who it is, where,
|
|
92
|
+
* and whether its token is followed from a CLI or expires. No credential.
|
|
93
|
+
*/
|
|
94
|
+
function hostingOf(row: IntegrationAccountRow, credentials: Record<string, string>): IntegrationAccountHosting | undefined {
|
|
95
|
+
const adapter = getHostAdapter(row.provider);
|
|
96
|
+
if (!adapter) return undefined;
|
|
97
|
+
const linked = credentials.authSource === 'cli' ? credentials.cliTool : '';
|
|
98
|
+
return {
|
|
99
|
+
host: adapter.host(credentials),
|
|
100
|
+
login: credentials.login || null,
|
|
101
|
+
linkedCli: linked === 'gh' || linked === 'glab' || linked === 'tea' ? linked : null,
|
|
102
|
+
expiresAt: credentials.authSource === 'oauth' && credentials.expiresAt && !credentials.refreshToken
|
|
103
|
+
? credentials.expiresAt
|
|
104
|
+
: null
|
|
105
|
+
};
|
|
74
106
|
}
|
|
75
107
|
|
|
76
108
|
function requireProvider(id: string): IntegrationProvider {
|
|
@@ -134,6 +166,7 @@ function configuredFieldsOf(provider: IntegrationProvider, credentials: Record<s
|
|
|
134
166
|
export function toAccountInfo(row: IntegrationAccountRow): IntegrationAccountInfo {
|
|
135
167
|
const provider = getProvider(row.provider);
|
|
136
168
|
const credentials = integrationAccountQueries.credentialsOf(row);
|
|
169
|
+
const hosting = hostingOf(row, credentials);
|
|
137
170
|
|
|
138
171
|
return {
|
|
139
172
|
id: row.id,
|
|
@@ -154,7 +187,8 @@ export function toAccountInfo(row: IntegrationAccountRow): IntegrationAccountInf
|
|
|
154
187
|
targetKind: projection.target_kind,
|
|
155
188
|
targetId: projection.target_id,
|
|
156
189
|
adopted: projection.adopted === 1
|
|
157
|
-
}))
|
|
190
|
+
})),
|
|
191
|
+
...(hosting && { hosting })
|
|
158
192
|
};
|
|
159
193
|
}
|
|
160
194
|
|
|
@@ -174,12 +208,14 @@ export const integrationAccounts = {
|
|
|
174
208
|
|
|
175
209
|
const capabilities = input.capabilities ?? [...defaultCapabilitiesOf(provider)];
|
|
176
210
|
assertKnownCapabilities(provider, capabilities);
|
|
211
|
+
const authMethod = input.authMethod ?? provider.authMethod;
|
|
212
|
+
assertKnownAuthMethod(provider, authMethod);
|
|
177
213
|
|
|
178
214
|
const row = integrationAccountQueries.create({
|
|
179
215
|
provider: provider.id,
|
|
180
216
|
label: (input.label ?? '').trim() || defaultLabel(provider),
|
|
181
217
|
projectId: input.projectId ?? null,
|
|
182
|
-
authMethod
|
|
218
|
+
authMethod,
|
|
183
219
|
// Generated fields are Clopen's, not the form's: whatever a client sent
|
|
184
220
|
// for one is dropped rather than trusted as a secret.
|
|
185
221
|
credentials: withGeneratedCredentials(provider, stripGenerated(provider, input.credentials)),
|
|
@@ -208,17 +244,28 @@ export const integrationAccounts = {
|
|
|
208
244
|
* it" — the same rule the db-client and SSH forms follow, and the reason
|
|
209
245
|
* editing a label does not wipe a token.
|
|
210
246
|
*/
|
|
211
|
-
updateCredentials(
|
|
247
|
+
updateCredentials(
|
|
248
|
+
id: string,
|
|
249
|
+
patch: Record<string, string>,
|
|
250
|
+
options: { authMethod?: IntegrationAuthMethod; replace?: string[] } = {}
|
|
251
|
+
): IntegrationAccountInfo {
|
|
212
252
|
const row = integrationAccountQueries.getById(id);
|
|
213
253
|
if (!row) throw new Error('Integration account not found');
|
|
214
254
|
const provider = requireProvider(row.provider);
|
|
215
255
|
|
|
216
256
|
const merged = { ...integrationAccountQueries.credentialsOf(row) };
|
|
257
|
+
// Keys a sign-in method owns are dropped first when the method changes —
|
|
258
|
+
// a token pasted over a CLI-linked account must not keep re-reading gh.
|
|
259
|
+
for (const field of options.replace ?? []) delete merged[field];
|
|
217
260
|
for (const [field, value] of Object.entries(stripGenerated(provider, patch))) {
|
|
218
261
|
if (value === '') continue;
|
|
219
262
|
merged[field] = value;
|
|
220
263
|
}
|
|
221
264
|
assertRequiredFields(provider, merged);
|
|
265
|
+
if (options.authMethod) {
|
|
266
|
+
assertKnownAuthMethod(provider, options.authMethod);
|
|
267
|
+
integrationAccountQueries.setAuthMethod(id, options.authMethod);
|
|
268
|
+
}
|
|
222
269
|
|
|
223
270
|
integrationAccountQueries.setCredentials(id, withGeneratedCredentials(provider, merged));
|
|
224
271
|
integrationAccountQueries.setStatus(id, 'unknown', null);
|
|
@@ -44,6 +44,15 @@ export function defineProvider(provider: IntegrationProvider): IntegrationProvid
|
|
|
44
44
|
throw new Error(`Integration provider "${provider.id}" both asks for and generates "${field}"`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
if (provider.authMethods && !provider.authMethods.includes(provider.authMethod)) {
|
|
48
|
+
throw new Error(`Integration provider "${provider.id}" lists auth methods that omit its primary one`);
|
|
49
|
+
}
|
|
50
|
+
if (provider.hosting && !provider.authMethods?.includes('api-key')) {
|
|
51
|
+
// The token form is the method that works on every server, including the
|
|
52
|
+
// self-hosted ones no OAuth app exists for. A hosting provider without it
|
|
53
|
+
// would have no way in at all on such a server.
|
|
54
|
+
throw new Error(`Hosting provider "${provider.id}" must accept a token`);
|
|
55
|
+
}
|
|
47
56
|
for (const capability of provider.defaultCapabilities ?? []) {
|
|
48
57
|
if (!provider.capabilities.includes(capability)) {
|
|
49
58
|
throw new Error(`Integration provider "${provider.id}" defaults to a capability it does not offer: ${capability}`);
|
|
@@ -7,24 +7,31 @@
|
|
|
7
7
|
* projection, the webhook route — is derived from that declaration.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import bitbucket from './providers/bitbucket';
|
|
10
11
|
import context7 from './providers/context7';
|
|
11
12
|
import firecrawl from './providers/firecrawl';
|
|
13
|
+
import gitea from './providers/gitea';
|
|
12
14
|
import github from './providers/github';
|
|
15
|
+
import gitlab from './providers/gitlab';
|
|
13
16
|
import neon from './providers/neon';
|
|
14
17
|
import supabase from './providers/supabase';
|
|
15
18
|
import telegram from './providers/telegram';
|
|
16
19
|
import vercel from './providers/vercel';
|
|
17
20
|
import type { IntegrationProvider } from './types';
|
|
18
21
|
import type { IntegrationProviderInfo } from '$shared/types/integrations';
|
|
22
|
+
import { hasBundledClientId } from '$backend/git-hosts/auth/client-ids';
|
|
19
23
|
|
|
20
24
|
export type { IntegrationProvider, McpPreset, WebhookSpec } from './types';
|
|
21
25
|
export { defineProvider } from './define';
|
|
22
26
|
|
|
23
27
|
/** Every declared provider. Add new ones here. */
|
|
24
28
|
export const PROVIDERS: readonly IntegrationProvider[] = [
|
|
29
|
+
bitbucket,
|
|
25
30
|
context7,
|
|
26
31
|
firecrawl,
|
|
32
|
+
gitea,
|
|
27
33
|
github,
|
|
34
|
+
gitlab,
|
|
28
35
|
neon,
|
|
29
36
|
supabase,
|
|
30
37
|
telegram,
|
|
@@ -52,7 +59,11 @@ export function toProviderInfo(provider: IntegrationProvider): IntegrationProvid
|
|
|
52
59
|
docsUrl: provider.docsUrl,
|
|
53
60
|
consoleUrl: provider.consoleUrl,
|
|
54
61
|
authMethod: provider.authMethod,
|
|
62
|
+
authMethods: provider.authMethods ?? [provider.authMethod],
|
|
55
63
|
credentialFields: provider.credentialFields,
|
|
64
|
+
...(provider.hosting && {
|
|
65
|
+
hosting: { ...provider.hosting, hasBundledClientId: hasBundledClientId(provider.id) }
|
|
66
|
+
}),
|
|
56
67
|
capabilities: [...provider.capabilities],
|
|
57
68
|
defaultCapabilities: [...defaultCapabilitiesOf(provider)],
|
|
58
69
|
providesAgentTools: provider.capabilities.includes('agent-tools'),
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitbucket Cloud.
|
|
3
|
+
*
|
|
4
|
+
* Token only. Bitbucket's OAuth needs a client SECRET, and a secret shipped
|
|
5
|
+
* inside a self-hosted app is not a secret. Atlassian API tokens are the
|
|
6
|
+
* supported replacement for app passwords, and they authenticate the REST API
|
|
7
|
+
* as `email:token` and git over HTTPS as `x-bitbucket-api-token-auth:token` —
|
|
8
|
+
* which is why the email is a field.
|
|
9
|
+
*
|
|
10
|
+
* Hosting only, like Gitea: no Issues & PRs adapter yet.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { defineProvider } from '../define';
|
|
14
|
+
|
|
15
|
+
export default defineProvider({
|
|
16
|
+
id: 'bitbucket',
|
|
17
|
+
name: 'Bitbucket',
|
|
18
|
+
category: 'source-control',
|
|
19
|
+
description: 'Publish repositories to Bitbucket Cloud and push without a separate credential.',
|
|
20
|
+
docsUrl: 'https://id.atlassian.com/manage-profile/security/api-tokens',
|
|
21
|
+
consoleUrl: 'https://bitbucket.org',
|
|
22
|
+
authMethod: 'api-key',
|
|
23
|
+
authMethods: ['api-key'],
|
|
24
|
+
hosting: {
|
|
25
|
+
defaultHost: 'bitbucket.org',
|
|
26
|
+
selfHosted: false,
|
|
27
|
+
requiresServerUrl: false,
|
|
28
|
+
cli: null,
|
|
29
|
+
deviceFlow: false,
|
|
30
|
+
browserFlow: false,
|
|
31
|
+
oauthAppUrl: null,
|
|
32
|
+
scopes: ['read:user:bitbucket', 'read:workspace:bitbucket', 'read:repository:bitbucket', 'write:repository:bitbucket', 'admin:repository:bitbucket']
|
|
33
|
+
},
|
|
34
|
+
capabilities: [],
|
|
35
|
+
credentialFields: [
|
|
36
|
+
{
|
|
37
|
+
name: 'email',
|
|
38
|
+
label: 'Atlassian account email',
|
|
39
|
+
placeholder: 'you@example.com',
|
|
40
|
+
isSecret: false,
|
|
41
|
+
isRequired: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'token',
|
|
45
|
+
label: 'API token',
|
|
46
|
+
help: 'Create one "with scopes" for Bitbucket: account and workspace read, repository read, write and admin.',
|
|
47
|
+
isSecret: true,
|
|
48
|
+
isRequired: true
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gitea and Forgejo — always self-hosted, so the server URL is required.
|
|
3
|
+
*
|
|
4
|
+
* Forgejo is a Gitea fork whose API is still Gitea's, so one provider serves
|
|
5
|
+
* both; the connect dialog probes the server and names which it found.
|
|
6
|
+
*
|
|
7
|
+
* Neither implements the OAuth device grant, so the browser sign-in is the
|
|
8
|
+
* authorization-code flow with PKCE against an application the user registers
|
|
9
|
+
* on their own server (a public client — no secret is stored). `tea` is
|
|
10
|
+
* borrowed when it is signed in to the same server.
|
|
11
|
+
*
|
|
12
|
+
* Hosting only: Clopen has no Issues & PRs adapter for Gitea yet, and saying
|
|
13
|
+
* so is better than declaring a capability that would show nothing.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { defineProvider } from '../define';
|
|
17
|
+
|
|
18
|
+
export default defineProvider({
|
|
19
|
+
id: 'gitea',
|
|
20
|
+
name: 'Gitea / Forgejo',
|
|
21
|
+
category: 'source-control',
|
|
22
|
+
description:
|
|
23
|
+
'Publish repositories to your own Gitea or Forgejo server and push without a separate credential.',
|
|
24
|
+
authMethod: 'api-key',
|
|
25
|
+
authMethods: ['cli', 'oauth-code', 'api-key'],
|
|
26
|
+
hosting: {
|
|
27
|
+
defaultHost: null,
|
|
28
|
+
selfHosted: true,
|
|
29
|
+
requiresServerUrl: true,
|
|
30
|
+
cli: 'tea',
|
|
31
|
+
deviceFlow: false,
|
|
32
|
+
browserFlow: true,
|
|
33
|
+
oauthAppUrl: null,
|
|
34
|
+
scopes: ['write:repository', 'read:user', 'read:organization']
|
|
35
|
+
},
|
|
36
|
+
capabilities: [],
|
|
37
|
+
credentialFields: [
|
|
38
|
+
{
|
|
39
|
+
name: 'baseUrl',
|
|
40
|
+
label: 'Server URL',
|
|
41
|
+
placeholder: 'https://git.your-company.com',
|
|
42
|
+
isSecret: false,
|
|
43
|
+
isRequired: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'token',
|
|
47
|
+
label: 'Access token',
|
|
48
|
+
help: 'Settings → Applications → Generate token, with repository read/write and user read.',
|
|
49
|
+
isSecret: true,
|
|
50
|
+
isRequired: true
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
});
|
|
@@ -19,10 +19,13 @@
|
|
|
19
19
|
* and are not rejected — the diagnosis in the adapter names the difference when
|
|
20
20
|
* one of them cannot see a repository.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* only
|
|
22
|
+
* Three ways in, cheapest first. A `gh` CLI that is already signed in is
|
|
23
|
+
* borrowed — LINKED, so the token is re-read from `gh` on every use and
|
|
24
|
+
* rotating or logging out there is followed here. The OAuth device flow needs
|
|
25
|
+
* only a client id, never a secret, which is why it suits a self-hosted app:
|
|
26
|
+
* the id ships with Clopen (or is overridden by the user's own app for
|
|
27
|
+
* Enterprise Server). And the token form stays, because it is the one method
|
|
28
|
+
* that works on every server and under every policy.
|
|
26
29
|
*
|
|
27
30
|
* `agent-tools` is DECLARED but OFF by default. GitHub's official remote MCP
|
|
28
31
|
* server accepts the same token, so offering it costs nothing — but adding a
|
|
@@ -37,10 +40,24 @@ export default defineProvider({
|
|
|
37
40
|
name: 'GitHub',
|
|
38
41
|
category: 'source-control',
|
|
39
42
|
description:
|
|
40
|
-
'
|
|
41
|
-
docsUrl: 'https://github.com/settings/tokens/new?scopes=repo,read:org&description=Clopen',
|
|
43
|
+
'Publish repositories, push without a separate credential, and work with issues, pull requests and Actions from the Git panel.',
|
|
44
|
+
docsUrl: 'https://github.com/settings/tokens/new?scopes=repo,read:org,workflow&description=Clopen',
|
|
42
45
|
consoleUrl: 'https://github.com',
|
|
43
46
|
authMethod: 'api-key',
|
|
47
|
+
authMethods: ['cli', 'oauth-device', 'api-key'],
|
|
48
|
+
hosting: {
|
|
49
|
+
defaultHost: 'github.com',
|
|
50
|
+
selfHosted: true,
|
|
51
|
+
requiresServerUrl: false,
|
|
52
|
+
cli: 'gh',
|
|
53
|
+
deviceFlow: true,
|
|
54
|
+
browserFlow: false,
|
|
55
|
+
oauthAppUrl: 'https://github.com/settings/applications/new',
|
|
56
|
+
// `workflow` because pushing a change under .github/workflows over
|
|
57
|
+
// HTTPS is refused without it — a failure that otherwise reads as a
|
|
58
|
+
// broken token on the one commit that touched CI.
|
|
59
|
+
scopes: ['repo', 'read:org', 'workflow']
|
|
60
|
+
},
|
|
44
61
|
capabilities: ['work', 'agent-tools'],
|
|
45
62
|
// Connecting GitHub means "show me my work", not "give every agent GitHub
|
|
46
63
|
// tools". The second is one switch away in the hub.
|
|
@@ -53,7 +70,7 @@ export default defineProvider({
|
|
|
53
70
|
// Deliberately short. The full explanation of why classic beats
|
|
54
71
|
// fine-grained belongs in the error a failing token produces, where
|
|
55
72
|
// it is actionable — not in a paragraph nobody reads while pasting.
|
|
56
|
-
help: '
|
|
73
|
+
help: 'Scopes: "repo" and "workflow" (plus "read:org" for SAML organisations). Fine-grained tokens work too, but only for repositories their owner granted.',
|
|
57
74
|
isSecret: true,
|
|
58
75
|
isRequired: true
|
|
59
76
|
},
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab — gitlab.com and self-managed instances.
|
|
3
|
+
*
|
|
4
|
+
* The same three ways in as GitHub. `glab` is borrowed when it is signed in;
|
|
5
|
+
* the OAuth device grant exists from GitLab 17.2 and needs only a client id;
|
|
6
|
+
* and a personal access token with the `api` scope works on every version.
|
|
7
|
+
*
|
|
8
|
+
* Self-managed is the common case for GitLab, not the exception, so the server
|
|
9
|
+
* URL is a first-class field rather than an "Enterprise" footnote. An OAuth
|
|
10
|
+
* sign-in against a self-managed server needs an application registered on
|
|
11
|
+
* THAT server — Clopen's own app only exists on gitlab.com.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { defineProvider } from '../define';
|
|
15
|
+
|
|
16
|
+
export default defineProvider({
|
|
17
|
+
id: 'gitlab',
|
|
18
|
+
name: 'GitLab',
|
|
19
|
+
category: 'source-control',
|
|
20
|
+
description:
|
|
21
|
+
'Publish projects, push without a separate credential, and work with issues, merge requests and pipelines from the Git panel.',
|
|
22
|
+
docsUrl: 'https://gitlab.com/-/user_settings/personal_access_tokens?name=Clopen&scopes=api,read_user,write_repository',
|
|
23
|
+
consoleUrl: 'https://gitlab.com',
|
|
24
|
+
authMethod: 'api-key',
|
|
25
|
+
authMethods: ['cli', 'oauth-device', 'api-key'],
|
|
26
|
+
hosting: {
|
|
27
|
+
defaultHost: 'gitlab.com',
|
|
28
|
+
selfHosted: true,
|
|
29
|
+
requiresServerUrl: false,
|
|
30
|
+
cli: 'glab',
|
|
31
|
+
deviceFlow: true,
|
|
32
|
+
browserFlow: false,
|
|
33
|
+
oauthAppUrl: 'https://gitlab.com/-/user_settings/applications',
|
|
34
|
+
// `write_repository` is what git over HTTPS checks; `api` alone does not
|
|
35
|
+
// authorise a push on every version.
|
|
36
|
+
scopes: ['api', 'read_user', 'write_repository']
|
|
37
|
+
},
|
|
38
|
+
capabilities: ['work'],
|
|
39
|
+
credentialFields: [
|
|
40
|
+
{
|
|
41
|
+
name: 'token',
|
|
42
|
+
label: 'Personal access token',
|
|
43
|
+
placeholder: 'glpat-…',
|
|
44
|
+
help: 'Scopes: "api", "read_user" and "write_repository".',
|
|
45
|
+
isSecret: true,
|
|
46
|
+
isRequired: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'baseUrl',
|
|
50
|
+
label: 'Server URL',
|
|
51
|
+
placeholder: 'https://gitlab.your-company.com',
|
|
52
|
+
help: 'Leave empty for gitlab.com.',
|
|
53
|
+
isSecret: false,
|
|
54
|
+
isRequired: false
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
});
|
|
@@ -15,7 +15,8 @@ import type {
|
|
|
15
15
|
IntegrationAuthMethod,
|
|
16
16
|
IntegrationCapability,
|
|
17
17
|
IntegrationCategory,
|
|
18
|
-
IntegrationCredentialField
|
|
18
|
+
IntegrationCredentialField,
|
|
19
|
+
IntegrationHostingInfo
|
|
19
20
|
} from '$shared/types/integrations';
|
|
20
21
|
import type { McpTransport } from '$backend/database/queries';
|
|
21
22
|
|
|
@@ -99,6 +100,17 @@ export interface IntegrationProvider {
|
|
|
99
100
|
/** The provider's own dashboard, for what Clopen cannot do — see `IntegrationProviderInfo`. */
|
|
100
101
|
consoleUrl?: string;
|
|
101
102
|
authMethod: IntegrationAuthMethod;
|
|
103
|
+
/**
|
|
104
|
+
* Every way this provider can be connected, preferred first. Omitted means
|
|
105
|
+
* `[authMethod]`. The token form (`api-key`) is always the last resort: it
|
|
106
|
+
* works everywhere, and it is the one that asks the most of the user.
|
|
107
|
+
*/
|
|
108
|
+
authMethods?: IntegrationAuthMethod[];
|
|
109
|
+
/**
|
|
110
|
+
* Present for a provider that hosts git repositories. Whether a client id
|
|
111
|
+
* ships with Clopen is decided at runtime, not declared, so it is left out.
|
|
112
|
+
*/
|
|
113
|
+
hosting?: Omit<IntegrationHostingInfo, 'hasBundledClientId'>;
|
|
102
114
|
credentialFields: IntegrationCredentialField[];
|
|
103
115
|
/** Everything this provider is able to offer. */
|
|
104
116
|
capabilities: IntegrationCapability[];
|