@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
|
@@ -27,6 +27,7 @@ import type {
|
|
|
27
27
|
RateLimitEvent,
|
|
28
28
|
RateLimitType,
|
|
29
29
|
NotificationEvent,
|
|
30
|
+
BackgroundWorkEvent,
|
|
30
31
|
TokenUsage,
|
|
31
32
|
StopReason,
|
|
32
33
|
UserContentBlock,
|
|
@@ -46,6 +47,8 @@ import { extractMessageText } from '../snapshot/helpers';
|
|
|
46
47
|
import { deferEpisodicIngest, ingestTurn } from '../memory/extract';
|
|
47
48
|
import { buildMemoryContext, withMemoryContext } from '../memory/context';
|
|
48
49
|
import { buildEngineHandoff, resolveBranchEngine, withHandoff } from './engine-handoff';
|
|
50
|
+
import { labelAttachments } from './attachments';
|
|
51
|
+
import { resolveTranscriptAlias, transcriptExists } from '../storage/transcripts';
|
|
49
52
|
import { resolveGitEnv } from '$backend/git/identity';
|
|
50
53
|
import { debug } from '$shared/utils/logger';
|
|
51
54
|
import { attachSubmittedAnswers } from '$shared/utils/ask-user-question';
|
|
@@ -85,6 +88,10 @@ export interface StreamState {
|
|
|
85
88
|
*/
|
|
86
89
|
partialBlock?: number;
|
|
87
90
|
reasoningBlock?: number;
|
|
91
|
+
/** Background work the engine is still running (see BackgroundWorkEvent). */
|
|
92
|
+
backgroundTasks?: Array<{ id: string; description?: string }>;
|
|
93
|
+
/** Between an engine turn's `result` and the stream's next output. */
|
|
94
|
+
betweenTurns?: boolean;
|
|
88
95
|
error?: string;
|
|
89
96
|
abortController?: AbortController;
|
|
90
97
|
streamPromise?: Promise<void>;
|
|
@@ -101,6 +108,8 @@ export interface StreamState {
|
|
|
101
108
|
engineInstance?: AIEngine;
|
|
102
109
|
sdkSessionId?: string;
|
|
103
110
|
preStreamSessionId?: string | null;
|
|
111
|
+
/** The transcript actually resumed — differs from `preStreamSessionId` when it was deduplicated. */
|
|
112
|
+
resumeTargetSessionId?: string | null;
|
|
104
113
|
hasCompactBoundary?: boolean;
|
|
105
114
|
eventSeq: number;
|
|
106
115
|
/**
|
|
@@ -286,6 +295,17 @@ export interface RateLimitSnapshot {
|
|
|
286
295
|
receivedAt: string;
|
|
287
296
|
}
|
|
288
297
|
|
|
298
|
+
/**
|
|
299
|
+
* How many background tasks an active stream is waiting on between turns — 0
|
|
300
|
+
* while the engine is producing output. The turn that started the work has
|
|
301
|
+
* ended; the engine will start another when the work finishes. Shown as
|
|
302
|
+
* "waiting for background work" instead of "generating".
|
|
303
|
+
*/
|
|
304
|
+
export function waitingOnBackground(stream: Pick<StreamState, 'status' | 'betweenTurns' | 'backgroundTasks'>): number {
|
|
305
|
+
if (stream.status !== 'active' || !stream.betweenTurns) return 0;
|
|
306
|
+
return stream.backgroundTasks?.length ?? 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
289
309
|
class StreamManager extends EventEmitter {
|
|
290
310
|
private activeStreams = new Map<string, StreamState>();
|
|
291
311
|
private sessionStreams = new Map<string, string>(); // composite key -> streamId
|
|
@@ -504,6 +524,31 @@ class StreamManager extends EventEmitter {
|
|
|
504
524
|
/**
|
|
505
525
|
* Emit a stream event to all subscribers
|
|
506
526
|
*/
|
|
527
|
+
/**
|
|
528
|
+
* Follow whether the stream sits between turns waiting on background work,
|
|
529
|
+
* and announce every change (presence shows it on every device). A turn's
|
|
530
|
+
* `result` opens the gap; any output of the next turn closes it.
|
|
531
|
+
*/
|
|
532
|
+
private trackTurnGap(streamState: StreamState, output: EngineOutput): void {
|
|
533
|
+
const before = waitingOnBackground(streamState);
|
|
534
|
+
if (output.type === 'background_work') {
|
|
535
|
+
streamState.backgroundTasks = (output as BackgroundWorkEvent).tasks;
|
|
536
|
+
} else if (output.type === 'result') {
|
|
537
|
+
streamState.betweenTurns = true;
|
|
538
|
+
} else if (output.type !== 'rate_limit' && output.type !== 'notification' && output.type !== 'system_init') {
|
|
539
|
+
streamState.betweenTurns = false;
|
|
540
|
+
}
|
|
541
|
+
const after = waitingOnBackground(streamState);
|
|
542
|
+
if (after !== before) {
|
|
543
|
+
this.emit('stream:background', {
|
|
544
|
+
streamId: streamState.streamId,
|
|
545
|
+
chatSessionId: streamState.chatSessionId,
|
|
546
|
+
projectId: streamState.projectId,
|
|
547
|
+
waiting: after
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
507
552
|
private emitStreamEvent(streamState: StreamState, type: StreamEventType, data: any): void {
|
|
508
553
|
// Increment sequence number for deduplication
|
|
509
554
|
streamState.eventSeq++;
|
|
@@ -654,6 +699,31 @@ class StreamManager extends EventEmitter {
|
|
|
654
699
|
}
|
|
655
700
|
streamState.preStreamSessionId = resumeSessionId ?? null;
|
|
656
701
|
|
|
702
|
+
// Where that session lives now, and whether it still exists at all.
|
|
703
|
+
// Settings → Storage deduplicates Claude forks (an earlier fork becomes
|
|
704
|
+
// "the later one, cut at this entry") and may delete the transcripts of
|
|
705
|
+
// a slimmed chat. A target that is gone is not resumed — the branch is
|
|
706
|
+
// replayed as prompt content instead, exactly as for an engine switch,
|
|
707
|
+
// so the conversation carries on with its context rather than failing
|
|
708
|
+
// or silently starting blank.
|
|
709
|
+
let engineResume: string | undefined = resumeSessionId;
|
|
710
|
+
let engineResumeAt: string | undefined;
|
|
711
|
+
let resumeLost = false;
|
|
712
|
+
if (resumeSessionId) {
|
|
713
|
+
const alias = resolveTranscriptAlias(requestEngine.type, resumeSessionId);
|
|
714
|
+
if (alias) {
|
|
715
|
+
engineResume = alias.targetSessionId;
|
|
716
|
+
engineResumeAt = alias.resumeAt;
|
|
717
|
+
}
|
|
718
|
+
if (!(await transcriptExists(requestEngine.type, engineResume!, projectPath))) {
|
|
719
|
+
debug.log('chat', `Resume target ${engineResume} is gone; replaying the branch instead`);
|
|
720
|
+
resumeLost = true;
|
|
721
|
+
engineResume = undefined;
|
|
722
|
+
engineResumeAt = undefined;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
streamState.resumeTargetSessionId = engineResume ?? null;
|
|
726
|
+
|
|
657
727
|
// Convert raw SDK prompt → UserMessage (unified)
|
|
658
728
|
const userMessage = convertRawPromptToUserMessage(rawPrompt);
|
|
659
729
|
|
|
@@ -757,17 +827,23 @@ class StreamManager extends EventEmitter {
|
|
|
757
827
|
debug.warn('chat', 'Slash skill expansion failed, sending the message as typed:', error);
|
|
758
828
|
}
|
|
759
829
|
|
|
760
|
-
|
|
830
|
+
// Every attachment is labelled with its `@N` (saved ones with where
|
|
831
|
+
// they are), so the numbers the user writes mean the same files to the
|
|
832
|
+
// engine. After the slash expansion, which reads the first text block.
|
|
833
|
+
enginePrompt = { ...enginePrompt, content: labelAttachments(enginePrompt.content, projectPath) };
|
|
834
|
+
|
|
835
|
+
if ((engineSwitched || resumeLost) && chatSessionId) {
|
|
761
836
|
try {
|
|
762
837
|
const handoff = buildEngineHandoff(
|
|
763
838
|
chatSessionId,
|
|
764
839
|
requestEngine.type,
|
|
765
840
|
requestEngine.model.id || '',
|
|
766
|
-
|
|
841
|
+
// Same engine, lost transcript: not a takeover from another engine.
|
|
842
|
+
engineSwitched ? branchEngine : null,
|
|
767
843
|
userMessageId
|
|
768
844
|
);
|
|
769
845
|
if (handoff) {
|
|
770
|
-
enginePrompt = withHandoff(
|
|
846
|
+
enginePrompt = withHandoff(enginePrompt, handoff.blocks);
|
|
771
847
|
const { turns, clearedToolResults, droppedAttachments, estimatedTokens } = handoff.stats;
|
|
772
848
|
debug.log(
|
|
773
849
|
'chat',
|
|
@@ -825,7 +901,7 @@ class StreamManager extends EventEmitter {
|
|
|
825
901
|
// Detect orphaned user messages and prepend context (claude-code only).
|
|
826
902
|
// Same idea as the handoff above but for the in-engine case: messages the
|
|
827
903
|
// engine's own session never saw because an earlier turn was cancelled.
|
|
828
|
-
if (!engineSwitched && requestEngine.type === 'claude-code' && chatSessionId) {
|
|
904
|
+
if (!engineSwitched && !resumeLost && requestEngine.type === 'claude-code' && chatSessionId) {
|
|
829
905
|
try {
|
|
830
906
|
const head = sessionQueries.getHead(chatSessionId);
|
|
831
907
|
if (head) {
|
|
@@ -906,7 +982,8 @@ class StreamManager extends EventEmitter {
|
|
|
906
982
|
const streamIterable = engine.streamQuery({
|
|
907
983
|
projectPath,
|
|
908
984
|
prompt: enginePrompt,
|
|
909
|
-
resume:
|
|
985
|
+
resume: engineResume,
|
|
986
|
+
...(engineResumeAt && { resumeAt: engineResumeAt }),
|
|
910
987
|
providerSlug: requestEngine.provider,
|
|
911
988
|
modelId: requestEngine.model.id,
|
|
912
989
|
...(streamState.reasoningEffort && { reasoningEffort: streamState.reasoningEffort }),
|
|
@@ -935,6 +1012,8 @@ class StreamManager extends EventEmitter {
|
|
|
935
1012
|
// the same folder, for any tool (see snapshot/turn-activity.ts).
|
|
936
1013
|
if (chatSessionId) snapshotService.observeEngineOutput(chatSessionId, output);
|
|
937
1014
|
|
|
1015
|
+
this.trackTurnGap(streamState, output);
|
|
1016
|
+
|
|
938
1017
|
// ── Route by type discriminant ──────────────────────────────
|
|
939
1018
|
|
|
940
1019
|
// Extract session ID from first event that has one
|
|
@@ -984,6 +1063,10 @@ class StreamManager extends EventEmitter {
|
|
|
984
1063
|
continue; // Don't save to DB
|
|
985
1064
|
}
|
|
986
1065
|
|
|
1066
|
+
// ── Background work (tracked in trackTurnGap) ─────────────
|
|
1067
|
+
case 'background_work':
|
|
1068
|
+
continue;
|
|
1069
|
+
|
|
987
1070
|
// ── Compact Boundary ───────────────────────────────────
|
|
988
1071
|
case 'compact_boundary': {
|
|
989
1072
|
const boundary = enrichMessageEngine(output, engineCtx) as CompactBoundaryMessage;
|
|
@@ -1166,24 +1249,31 @@ class StreamManager extends EventEmitter {
|
|
|
1166
1249
|
});
|
|
1167
1250
|
}
|
|
1168
1251
|
} else if (streamEvt.event === 'stop') {
|
|
1252
|
+
// `end` re-sends a block's full text once, as the reconciliation
|
|
1253
|
+
// point. Only for a block still being streamed: once its saved
|
|
1254
|
+
// message has gone out (which clears the text below), the block is
|
|
1255
|
+
// settled and an `end` for it could only bring a stale copy back.
|
|
1256
|
+
// A reasoning stop never ends the text block.
|
|
1169
1257
|
const lifecycle = streamEvt as StreamLifecycleEvent;
|
|
1170
|
-
if (lifecycle.reasoning
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1258
|
+
if (lifecycle.reasoning) {
|
|
1259
|
+
if (streamState.currentReasoningText) {
|
|
1260
|
+
this.emitStreamEvent(streamState, 'partial', {
|
|
1261
|
+
processId: streamState.processId,
|
|
1262
|
+
eventType: 'end',
|
|
1263
|
+
block: streamState.reasoningBlock ?? 0,
|
|
1264
|
+
partialText: streamState.currentReasoningText,
|
|
1265
|
+
deltaText: '',
|
|
1266
|
+
reasoning: true,
|
|
1267
|
+
timestamp: new Date().toISOString()
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1180
1270
|
streamState.currentReasoningText = '';
|
|
1181
|
-
} else {
|
|
1271
|
+
} else if (streamState.currentPartialText) {
|
|
1182
1272
|
this.emitStreamEvent(streamState, 'partial', {
|
|
1183
1273
|
processId: streamState.processId,
|
|
1184
1274
|
eventType: 'end',
|
|
1185
1275
|
block: streamState.partialBlock ?? 0,
|
|
1186
|
-
partialText: streamState.currentPartialText
|
|
1276
|
+
partialText: streamState.currentPartialText,
|
|
1187
1277
|
deltaText: '',
|
|
1188
1278
|
timestamp: new Date().toISOString()
|
|
1189
1279
|
});
|
|
@@ -1240,6 +1330,13 @@ class StreamManager extends EventEmitter {
|
|
|
1240
1330
|
const usage = assistantMsg.usage;
|
|
1241
1331
|
const messageTimestamp = assistantMsg.createdAt;
|
|
1242
1332
|
|
|
1333
|
+
// The text this message settles stops being "live" before it is
|
|
1334
|
+
// saved, so a catch-up snapshot can never carry text whose saved
|
|
1335
|
+
// message a reloaded transcript already shows. Only a root message
|
|
1336
|
+
// settles the root's live text — a sub-agent's (parent-tagged) one
|
|
1337
|
+
// finishing must not wipe the main turn's partial.
|
|
1338
|
+
if (!assistantMsg.parent.toolUseId) streamState.currentPartialText = undefined;
|
|
1339
|
+
|
|
1243
1340
|
let savedMsgId: string | undefined;
|
|
1244
1341
|
let savedParentId: string | null = null;
|
|
1245
1342
|
if (chatSessionId) {
|
|
@@ -1252,8 +1349,6 @@ class StreamManager extends EventEmitter {
|
|
|
1252
1349
|
savedParentId = saved?.parent_message_id || null;
|
|
1253
1350
|
}
|
|
1254
1351
|
|
|
1255
|
-
if (!assistantMsg.parent.toolUseId) streamState.currentPartialText = undefined;
|
|
1256
|
-
|
|
1257
1352
|
streamState.messages.push({
|
|
1258
1353
|
processId: streamState.processId,
|
|
1259
1354
|
message: assistantMsg as any,
|
|
@@ -291,6 +291,28 @@ export async function readStats(hostId: string, containerId: string): Promise<Co
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/** Everything `inspect` knows, read only when a detail pane asks for it. */
|
|
294
|
+
/**
|
|
295
|
+
* The last lines a container wrote, read once — what a chat mention attaches.
|
|
296
|
+
* Following a log is logs.ts; this is a snapshot of it.
|
|
297
|
+
*/
|
|
298
|
+
export async function readRecentLogs(hostId: string, containerId: string, lines = 2000): Promise<string | null> {
|
|
299
|
+
assertContainerId(containerId);
|
|
300
|
+
|
|
301
|
+
return containerMonitor.withHost(hostId, async (runner, platform) => {
|
|
302
|
+
const info = await detectRuntime(hostId, runner, platform);
|
|
303
|
+
if (info.problem !== 'none' || !info.runtime) return null;
|
|
304
|
+
|
|
305
|
+
const result = await tryRun(
|
|
306
|
+
runner,
|
|
307
|
+
containerArgv(info.runtime, platform, ['logs', '--tail', String(Math.max(1, Math.floor(lines))), '--timestamps', containerId]),
|
|
308
|
+
CONTAINER_TIMEOUTS.inspect
|
|
309
|
+
);
|
|
310
|
+
if (result.code !== 0) return null;
|
|
311
|
+
// The runtime writes the container's stderr to its own; both are the log.
|
|
312
|
+
return [result.stdout, result.stderr].filter((part) => part.trim()).join('\n');
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
294
316
|
export async function inspectContainer(
|
|
295
317
|
hostId: string,
|
|
296
318
|
containerId: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Projects: list, open, Home, and adding one by walking the
|
|
3
|
-
* folders (making, renaming or deleting folders on the way).
|
|
2
|
+
* Projects: list, open, Home, rename, and adding one by walking the
|
|
3
|
+
* machine's folders (making, renaming or deleting folders on the way).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { t } from 'elysia';
|
|
@@ -9,12 +9,13 @@ import { basename, dirname, isAbsolute, join, resolve, sep } from 'path';
|
|
|
9
9
|
import { homedir } from 'os';
|
|
10
10
|
import { projectQueries } from '$backend/database/queries';
|
|
11
11
|
import { ensureHomeProject } from '$backend/projects/home';
|
|
12
|
+
import { projectAtFolder, protectedFolderReason, validFolderName } from '$backend/projects/folder-guard';
|
|
13
|
+
import type { MoveOutcome } from '$backend/projects/move';
|
|
14
|
+
import { getProjectUsage } from '$backend/projects/move';
|
|
12
15
|
import { homeFirst, isHomeProject, HOME_PROJECT_NAME } from '$shared/utils/home-project';
|
|
13
16
|
import type { Project } from '$shared/types/database/schema';
|
|
14
17
|
import { defineAction } from '../define';
|
|
15
18
|
import type { ControlChoice, ControlResult } from '../types';
|
|
16
|
-
import { isPathInside } from '$backend/worktrees';
|
|
17
|
-
import { getClopenDir } from '$backend/utils/paths';
|
|
18
19
|
import { latestSession, projectLabel } from '../workspace';
|
|
19
20
|
import { paged } from '../paging';
|
|
20
21
|
|
|
@@ -96,30 +97,6 @@ function shortPath(path: string): string {
|
|
|
96
97
|
/** Folders not worth walking into when looking for a project. */
|
|
97
98
|
const SKIPPED_FOLDERS = new Set(['node_modules', 'Library', 'Applications', 'AppData']);
|
|
98
99
|
|
|
99
|
-
/**
|
|
100
|
-
* Why a folder must not be renamed or deleted from a chat, or null when it
|
|
101
|
-
* may. The home folder and everything above it, Clopen's own data, and any
|
|
102
|
-
* folder that is (or holds) a project are off limits: a project whose folder
|
|
103
|
-
* moved or vanished is broken in Clopen for everyone who has it.
|
|
104
|
-
*/
|
|
105
|
-
function protectedReason(folder: string): string | null {
|
|
106
|
-
if (folder === resolve(sep) || isPathInside(folder, homedir())) return 'it is your home folder or one above it';
|
|
107
|
-
const data = getClopenDir();
|
|
108
|
-
if (isPathInside(data, folder) || isPathInside(folder, data)) return "it holds Clopen's own data";
|
|
109
|
-
const project = projectQueries.getAll().find((entry) => isPathInside(folder, resolve(entry.path)));
|
|
110
|
-
if (project) return `it ${resolve(project.path) === folder ? 'is' : 'holds'} the project ${isHomeProject(project) ? HOME_PROJECT_NAME : project.name}`;
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** A folder name typed in a chat: one path segment, nothing that climbs out. */
|
|
115
|
-
function folderName(input: string | undefined): string {
|
|
116
|
-
const name = (input ?? '').trim();
|
|
117
|
-
if (!name || name === '.' || name === '..' || /[/\\\0]/.test(name) || name.length > 255) {
|
|
118
|
-
throw new Error('That is not a folder name. Use a single name, without slashes.');
|
|
119
|
-
}
|
|
120
|
-
return name;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
100
|
function existingFolder(path: string): string {
|
|
124
101
|
const folder = normalisePath(path);
|
|
125
102
|
if (!existsSync(folder) || !statSync(folder).isDirectory()) throw new Error(`There is no folder at ${shortPath(folder)}.`);
|
|
@@ -137,7 +114,7 @@ function browse(folder: string, page: number | undefined, note?: string): Contro
|
|
|
137
114
|
} catch {
|
|
138
115
|
throw new Error(`Clopen cannot read ${shortPath(folder)}.`);
|
|
139
116
|
}
|
|
140
|
-
const existing =
|
|
117
|
+
const existing = projectAtFolder(folder);
|
|
141
118
|
const { choices, range } = paged(
|
|
142
119
|
entries,
|
|
143
120
|
page,
|
|
@@ -145,13 +122,16 @@ function browse(folder: string, page: number | undefined, note?: string): Contro
|
|
|
145
122
|
{ action: 'projects.browse', args: { path: folder } }
|
|
146
123
|
);
|
|
147
124
|
const parent = dirname(folder);
|
|
148
|
-
const locked =
|
|
125
|
+
const locked = protectedFolderReason(folder) !== null;
|
|
126
|
+
// A project's own folder is renamed with the project, so it stays a project.
|
|
127
|
+
const renamable = existing && !isHomeProject(existing) && protectedFolderReason(folder, existing.id) === null;
|
|
149
128
|
const top: ControlChoice[] = [
|
|
150
129
|
existing
|
|
151
130
|
? { label: `📂 Open ${existing.name}`, action: 'projects.open', args: { projectId: existing.id } }
|
|
152
131
|
: { label: `✅ Add ${basename(folder) || folder} as a project`, action: 'projects.create', args: { path: folder } },
|
|
153
132
|
...(parent !== folder ? [{ label: '⬆️ Up', action: 'projects.browse', args: { path: parent } }] : []),
|
|
154
133
|
{ label: '➕ New folder here', action: 'projects.mkdir', args: { path: folder } },
|
|
134
|
+
...(renamable ? [{ label: '✏️ Rename this project', action: 'projects.rename', args: { projectId: existing.id } }] : []),
|
|
155
135
|
...(locked
|
|
156
136
|
? []
|
|
157
137
|
: [
|
|
@@ -196,7 +176,7 @@ export const makeFolder = defineAction({
|
|
|
196
176
|
if (args.name === undefined) {
|
|
197
177
|
return { text: `📂 \`${shortPath(parent)}\``, ask: { question: 'Name of the new folder?', action: 'projects.mkdir', args: { path: parent }, key: 'name' } };
|
|
198
178
|
}
|
|
199
|
-
const folder = join(parent,
|
|
179
|
+
const folder = join(parent, validFolderName(args.name));
|
|
200
180
|
if (existsSync(folder)) throw new Error(`${shortPath(folder)} already exists.`);
|
|
201
181
|
mkdirSync(folder);
|
|
202
182
|
return browse(folder, 0, `✅ Created \`${shortPath(folder)}\`.`);
|
|
@@ -211,12 +191,19 @@ export const renameFolder = defineAction({
|
|
|
211
191
|
args: t.Object({ path: t.String({ minLength: 1 }), name: t.Optional(t.String()) }),
|
|
212
192
|
async run(_ctx, args) {
|
|
213
193
|
const folder = existingFolder(args.path);
|
|
214
|
-
const
|
|
194
|
+
const project = projectAtFolder(folder);
|
|
195
|
+
if (project && !isHomeProject(project) && projectQueries.isListed(project.id)) {
|
|
196
|
+
return {
|
|
197
|
+
text: `📂 \`${shortPath(folder)}\` is the project **${escapeMd(project.name)}**: renaming it renames the project too.`,
|
|
198
|
+
choices: [{ label: '✏️ Rename this project', action: 'projects.rename', args: { projectId: project.id } }]
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const reason = protectedFolderReason(folder);
|
|
215
202
|
if (reason) throw new Error(`${shortPath(folder)} cannot be renamed here: ${reason}.`);
|
|
216
203
|
if (args.name === undefined) {
|
|
217
204
|
return { text: `📂 \`${shortPath(folder)}\``, ask: { question: `New name for ${basename(folder)}?`, action: 'projects.rename-folder', args: { path: folder }, key: 'name' } };
|
|
218
205
|
}
|
|
219
|
-
const renamed = join(dirname(folder),
|
|
206
|
+
const renamed = join(dirname(folder), validFolderName(args.name));
|
|
220
207
|
if (renamed === folder) return browse(folder, 0);
|
|
221
208
|
if (existsSync(renamed)) throw new Error(`${shortPath(renamed)} already exists.`);
|
|
222
209
|
renameSync(folder, renamed);
|
|
@@ -242,7 +229,7 @@ export const deleteFolder = defineAction({
|
|
|
242
229
|
},
|
|
243
230
|
async run(_ctx, args) {
|
|
244
231
|
const folder = existingFolder(args.path);
|
|
245
|
-
const reason =
|
|
232
|
+
const reason = protectedFolderReason(folder);
|
|
246
233
|
if (reason) throw new Error(`${shortPath(folder)} cannot be deleted here: ${reason}.`);
|
|
247
234
|
rmSync(folder, { recursive: true, force: true });
|
|
248
235
|
return browse(dirname(folder), 0, `🗑️ Deleted \`${shortPath(folder)}\`.`);
|
|
@@ -253,12 +240,12 @@ export const createProject = defineAction({
|
|
|
253
240
|
id: 'projects.create',
|
|
254
241
|
group: 'projects',
|
|
255
242
|
title: 'Add project',
|
|
256
|
-
description: 'Add a folder on this machine as a project, and switch to it.',
|
|
257
|
-
args: t.Object({ path: t.String({ minLength: 1 })
|
|
243
|
+
description: 'Add a folder on this machine as a project, and switch to it. The project is named after the folder.',
|
|
244
|
+
args: t.Object({ path: t.String({ minLength: 1 }) }),
|
|
258
245
|
async run(ctx, args) {
|
|
259
246
|
const path = normalisePath(args.path);
|
|
260
247
|
if (!existsSync(path) || !statSync(path).isDirectory()) throw new Error(`There is no folder at ${shortPath(path)}.`);
|
|
261
|
-
const project = await ctx.call<Project>('projects:create', {
|
|
248
|
+
const project = await ctx.call<Project>('projects:create', { path });
|
|
262
249
|
return {
|
|
263
250
|
text: `📁 Added and opened **${escapeMd(project.name)}** (\`${shortPath(path)}\`).`,
|
|
264
251
|
target: { projectId: project.id, sessionId: latestSession(project.id)?.id ?? null }
|
|
@@ -266,6 +253,75 @@ export const createProject = defineAction({
|
|
|
266
253
|
}
|
|
267
254
|
});
|
|
268
255
|
|
|
256
|
+
/** The project an action names, or the one the conversation is in. */
|
|
257
|
+
function projectToRename(projectId: string | undefined, fallback: string): Project {
|
|
258
|
+
const project = projectQueries.getById(projectId ?? fallback);
|
|
259
|
+
if (!project || !projectQueries.isListed(project.id)) throw new Error('That project is not in Clopen any more.');
|
|
260
|
+
if (isHomeProject(project)) throw new Error(`${HOME_PROJECT_NAME} cannot be renamed. Open a project first with /projects.`);
|
|
261
|
+
return project;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function plural(count: number, noun: string): string {
|
|
265
|
+
return `${count} ${noun}${count === 1 ? '' : 's'}`;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** "2 chats and 1 terminal", or with what each is doing — the words the web dialog uses. */
|
|
269
|
+
function describeUsage(usage: { chats: number; terminals: number }, withState = true): string {
|
|
270
|
+
const parts = [
|
|
271
|
+
...(usage.chats ? [`${plural(usage.chats, 'chat')}${withState ? ' still running' : ''}`] : []),
|
|
272
|
+
...(usage.terminals ? [`${plural(usage.terminals, 'terminal')}${withState ? ' open' : ''}`] : [])
|
|
273
|
+
];
|
|
274
|
+
return parts.join(' and ');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Renaming a project renames its folder: the project is always named after
|
|
279
|
+
* it. Work running there blocks it until the user asks to stop that work.
|
|
280
|
+
*/
|
|
281
|
+
export const renameProject = defineAction({
|
|
282
|
+
id: 'projects.rename',
|
|
283
|
+
group: 'projects',
|
|
284
|
+
title: 'Rename project',
|
|
285
|
+
description: 'Rename the project and its folder on disk. Chats, terminals and history follow it.',
|
|
286
|
+
args: t.Object({
|
|
287
|
+
projectId: t.Optional(t.String({ minLength: 1 })),
|
|
288
|
+
name: t.Optional(t.String()),
|
|
289
|
+
force: t.Optional(t.Boolean())
|
|
290
|
+
}),
|
|
291
|
+
command: { name: 'renameproject', argument: { keys: ['name'], hint: '<new name>' } },
|
|
292
|
+
confirm(args, ctx) {
|
|
293
|
+
if (!args.force || args.name === undefined) return null;
|
|
294
|
+
const project = projectToRename(args.projectId, ctx.target.projectId);
|
|
295
|
+
const usage = getProjectUsage(project.id);
|
|
296
|
+
if (!usage.chats && !usage.terminals) return null;
|
|
297
|
+
return `This stops ${describeUsage(usage, false)} in ${project.name}, then renames it to “${args.name.trim()}”.`;
|
|
298
|
+
},
|
|
299
|
+
async run(ctx, args) {
|
|
300
|
+
const project = projectToRename(args.projectId, ctx.target.projectId);
|
|
301
|
+
if (args.name === undefined) {
|
|
302
|
+
return {
|
|
303
|
+
text: `📁 **${escapeMd(project.name)}** (\`${shortPath(project.path)}\`)`,
|
|
304
|
+
ask: { question: `New name for ${project.name}? Its folder is renamed too.`, action: 'projects.rename', args: { projectId: project.id }, key: 'name' }
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
const name = validFolderName(args.name);
|
|
308
|
+
const outcome = await ctx.call<MoveOutcome>('projects:rename', { id: project.id, name, force: args.force ?? false }, { projectId: project.id });
|
|
309
|
+
if (outcome.status === 'busy') {
|
|
310
|
+
return {
|
|
311
|
+
text: `⏳ **${escapeMd(project.name)}** has ${describeUsage(outcome.usage)}. Renaming would leave them working in a folder that is gone.`,
|
|
312
|
+
choices: [{ label: '⏹️ Stop all & rename', action: 'projects.rename', args: { projectId: project.id, name, force: true } }]
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
const lines = [
|
|
316
|
+
outcome.previousPath === outcome.project.path
|
|
317
|
+
? `📁 **${escapeMd(project.name)}** already has that name.`
|
|
318
|
+
: `✏️ Renamed to **${escapeMd(outcome.project.name)}** (\`${shortPath(outcome.project.path)}\`).`,
|
|
319
|
+
...outcome.warnings.map((warning) => `⚠️ ${warning}`)
|
|
320
|
+
];
|
|
321
|
+
return { text: lines.join('\n') };
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
269
325
|
/** Names are user data: keep `*`, `_` and friends literal inside Markdown. */
|
|
270
326
|
export function escapeMd(value: string): string {
|
|
271
327
|
return value.replace(/([\\`*_~[\]])/g, '\\$1');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Managing folders from a chat while adding a project: making, renaming and
|
|
3
|
-
* deleting work on ordinary folders, never on a project's or above home.
|
|
3
|
+
* deleting work on ordinary folders, never on a project's or above home. A
|
|
4
|
+
* project's own folder is renamed through the project, which moves with it.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import { describe, it, expect, beforeAll, afterAll } from 'bun:test';
|
|
@@ -9,7 +10,8 @@ import { homedir, tmpdir } from 'os';
|
|
|
9
10
|
import { join } from 'path';
|
|
10
11
|
import { initializeDatabase, closeDatabase } from '$backend/database';
|
|
11
12
|
import { projectQueries } from '$backend/database/queries';
|
|
12
|
-
import { createControlContext, getControlAction, runControlAction } from './index';
|
|
13
|
+
import { createControlContext, getControlAction, registerControlRouter, runControlAction } from './index';
|
|
14
|
+
import { projectsRouter } from '$backend/ws/projects';
|
|
13
15
|
|
|
14
16
|
const admin = { id: 'folders-admin', name: 'Admin', role: 'admin' } as never;
|
|
15
17
|
const ctx = () => createControlContext(admin, { projectId: 'none', sessionId: null });
|
|
@@ -19,6 +21,8 @@ let projectId: string;
|
|
|
19
21
|
|
|
20
22
|
beforeAll(async () => {
|
|
21
23
|
await initializeDatabase();
|
|
24
|
+
// The project rename goes through the same WebSocket route the web UI uses.
|
|
25
|
+
registerControlRouter(projectsRouter);
|
|
22
26
|
root = mkdtempSync(join(tmpdir(), 'clopen-folders-'));
|
|
23
27
|
mkdirSync(join(root, 'project'));
|
|
24
28
|
projectId = projectQueries.create({ name: 'folders-test', path: join(root, 'project'), created_at: new Date().toISOString(), last_opened_at: new Date().toISOString() } as never).id;
|
|
@@ -63,5 +67,26 @@ describe('folders while adding a project', () => {
|
|
|
63
67
|
expect(existsSync(join(root, 'project'))).toBe(true);
|
|
64
68
|
const menu = await runControlAction(ctx(), 'projects.browse', { path: join(root, 'project') });
|
|
65
69
|
expect(menu.choices?.some((choice) => choice.action === 'projects.delete-folder')).toBe(false);
|
|
70
|
+
expect(menu.choices?.some((choice) => choice.action === 'projects.rename')).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('renames a project with its folder: asks for the name, then moves both', async () => {
|
|
74
|
+
projectQueries.list(projectId);
|
|
75
|
+
const asked = await runControlAction(ctx(), 'projects.rename', { projectId });
|
|
76
|
+
expect(asked.ask).toMatchObject({ action: 'projects.rename', key: 'name', args: { projectId } });
|
|
77
|
+
|
|
78
|
+
const done = await runControlAction(ctx(), 'projects.rename', { projectId, name: 'project-renamed' });
|
|
79
|
+
expect(done.text).toContain('Renamed to');
|
|
80
|
+
expect(existsSync(join(root, 'project-renamed'))).toBe(true);
|
|
81
|
+
expect(existsSync(join(root, 'project'))).toBe(false);
|
|
82
|
+
expect(projectQueries.getById(projectId)).toMatchObject({ name: 'project-renamed', path: join(root, 'project-renamed') });
|
|
83
|
+
|
|
84
|
+
// A plain folder rename of a project's folder hands over to the project rename.
|
|
85
|
+
const handed = await runControlAction(ctx(), 'projects.rename-folder', { path: join(root, 'project-renamed'), name: 'x' });
|
|
86
|
+
expect(handed.choices?.[0]).toMatchObject({ action: 'projects.rename', args: { projectId } });
|
|
87
|
+
expect(existsSync(join(root, 'project-renamed'))).toBe(true);
|
|
88
|
+
|
|
89
|
+
await runControlAction(ctx(), 'projects.rename', { projectId, name: 'project' });
|
|
90
|
+
expect(projectQueries.getById(projectId)?.path).toBe(join(root, 'project'));
|
|
66
91
|
});
|
|
67
92
|
});
|
package/backend/control/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { Value } from '@sinclair/typebox/value';
|
|
|
19
19
|
import type { AuthUser } from '$backend/auth/auth-service';
|
|
20
20
|
import { callRouteAs } from './invoke';
|
|
21
21
|
import { CONTROL_GROUP_LABELS, type ControlAction, type ControlContext, type ControlGroup, type ControlResult, type ControlTarget } from './types';
|
|
22
|
-
import { browseFolders, createProject, deleteFolder, goHome, listProjects, makeFolder, openProject, renameFolder } from './actions/projects';
|
|
22
|
+
import { browseFolders, createProject, deleteFolder, goHome, listProjects, makeFolder, openProject, renameFolder, renameProject } from './actions/projects';
|
|
23
23
|
import { deleteSession, dropQueued, listSessions, newSession, openSession, runningSessions, searchSessions, sessionStatus, showQueue, stopSession } from './actions/sessions';
|
|
24
24
|
import { listSkills, runSkill } from './actions/skills';
|
|
25
25
|
import { getFile, turnDiff } from './actions/files';
|
|
@@ -57,6 +57,7 @@ export const CONTROL_ACTIONS: readonly ControlAction[] = [
|
|
|
57
57
|
renameFolder,
|
|
58
58
|
deleteFolder,
|
|
59
59
|
createProject,
|
|
60
|
+
renameProject,
|
|
60
61
|
listEngines,
|
|
61
62
|
listModels,
|
|
62
63
|
setModel,
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { DatabaseConnection } from '$shared/types/database/connection';
|
|
2
2
|
import { debug } from '$shared/utils/logger';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Rebuilds a table, so the runner runs it with foreign keys off (see
|
|
6
|
+
* Migration.foreignKeysOff). The pragma lines below are kept from before the
|
|
7
|
+
* runner did this; inside its transaction they do nothing.
|
|
8
|
+
*/
|
|
9
|
+
export const foreignKeysOff = true;
|
|
10
|
+
|
|
4
11
|
export const description = 'Support mssql driver in db_client_connections CHECK constraint';
|
|
5
12
|
|
|
6
13
|
export const up = (db: DatabaseConnection): void => {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { DatabaseConnection } from '$shared/types/database/connection';
|
|
2
2
|
import { debug } from '$shared/utils/logger';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Rebuilds a table, so the runner runs it with foreign keys off (see
|
|
6
|
+
* Migration.foreignKeysOff). The pragma lines below are kept from before the
|
|
7
|
+
* runner did this; inside its transaction they do nothing.
|
|
8
|
+
*/
|
|
9
|
+
export const foreignKeysOff = true;
|
|
10
|
+
|
|
4
11
|
export const description = 'Create integration_db_links and widen integration_projections to many rows per capability';
|
|
5
12
|
|
|
6
13
|
/**
|