@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
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device mockup, drawn into a canvas around a screenshot.
|
|
3
|
+
*
|
|
4
|
+
* Reads the same `FrameLayout` the live frame is built from, so a framed
|
|
5
|
+
* screenshot puts the page exactly where the preview shows it — beside the
|
|
6
|
+
* status bar and the home indicator, never under them. The finish is the
|
|
7
|
+
* dark one the light theme shows: it reads on any background the image ends
|
|
8
|
+
* up on, which a light device on a light document would not.
|
|
9
|
+
*
|
|
10
|
+
* One renderer for both sides. The viewer calls it directly; the server has
|
|
11
|
+
* no canvas, so it runs the very same function inside a page of the preview
|
|
12
|
+
* browser — which is why `drawDeviceFrame` must stay self-contained: it is
|
|
13
|
+
* shipped as source text, and anything it reached outside its own body would
|
|
14
|
+
* not be there.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
getFrameLayout,
|
|
19
|
+
type DeviceSize,
|
|
20
|
+
type FrameLayout,
|
|
21
|
+
type PageColors,
|
|
22
|
+
type ViewportSize
|
|
23
|
+
} from '$shared/constants/preview';
|
|
24
|
+
import { foregroundFor } from './page-colors';
|
|
25
|
+
|
|
26
|
+
export interface FrameSpec {
|
|
27
|
+
deviceSize: DeviceSize;
|
|
28
|
+
viewport: ViewportSize;
|
|
29
|
+
deviceModel: string | null;
|
|
30
|
+
pageColors?: PageColors | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Everything the drawing needs, already resolved — plain data, so it can cross into a page. */
|
|
34
|
+
export interface FrameDrawInput {
|
|
35
|
+
layout: FrameLayout;
|
|
36
|
+
viewportWidth: number;
|
|
37
|
+
statusBar: string;
|
|
38
|
+
statusInk: string;
|
|
39
|
+
background: string;
|
|
40
|
+
backgroundInk: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Whether a screenshot of this device would get a mockup at all. */
|
|
44
|
+
export function hasDeviceFrame(spec: Pick<FrameSpec, 'deviceSize' | 'viewport' | 'deviceModel'>): boolean {
|
|
45
|
+
return getFrameLayout(spec.deviceSize, spec.viewport, true, spec.deviceModel).kind !== 'none';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The drawing input for a device, or null when it has no mockup. */
|
|
49
|
+
export function frameDrawInput(spec: FrameSpec): FrameDrawInput | null {
|
|
50
|
+
const layout = getFrameLayout(spec.deviceSize, spec.viewport, true, spec.deviceModel);
|
|
51
|
+
if (layout.kind === 'none') return null;
|
|
52
|
+
const statusBar = spec.pageColors?.statusBar ?? '#ffffff';
|
|
53
|
+
const background = spec.pageColors?.background ?? '#ffffff';
|
|
54
|
+
return {
|
|
55
|
+
layout,
|
|
56
|
+
viewportWidth: spec.viewport.width,
|
|
57
|
+
statusBar,
|
|
58
|
+
statusInk: foregroundFor(statusBar),
|
|
59
|
+
background,
|
|
60
|
+
backgroundInk: foregroundFor(background)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The image inside its device, on a transparent background.
|
|
66
|
+
*
|
|
67
|
+
* SELF-CONTAINED: no reference to anything outside this function body.
|
|
68
|
+
*/
|
|
69
|
+
export function drawDeviceFrame(
|
|
70
|
+
image: CanvasImageSource & { width: number; height: number },
|
|
71
|
+
input: FrameDrawInput
|
|
72
|
+
): HTMLCanvasElement | null {
|
|
73
|
+
type Rect = { x: number; y: number; width: number; height: number };
|
|
74
|
+
type Corners = [number, number, number, number];
|
|
75
|
+
type Finish = { hi: string; mid: string; lo: string };
|
|
76
|
+
|
|
77
|
+
const FINISH: Record<string, Finish> = {
|
|
78
|
+
default: { hi: '#6b6b70', mid: '#48484d', lo: '#2a2a2e' },
|
|
79
|
+
aluminum: { hi: '#6b6b70', mid: '#48484d', lo: '#2a2a2e' },
|
|
80
|
+
titanium: { hi: '#5e5d5b', mid: '#3e3d3b', lo: '#222221' },
|
|
81
|
+
'space-black': { hi: '#4a4a4f', mid: '#2e2e32', lo: '#18181b' },
|
|
82
|
+
plastic: { hi: '#2f2f33', mid: '#232326', lo: '#161618' }
|
|
83
|
+
};
|
|
84
|
+
const SYSTEM_FONT = "-apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif";
|
|
85
|
+
const ANDROID_FONT = "Roboto, 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
86
|
+
|
|
87
|
+
const { layout } = input;
|
|
88
|
+
const scale = image.width / input.viewportWidth;
|
|
89
|
+
const canvas = document.createElement('canvas');
|
|
90
|
+
canvas.width = Math.round(layout.footprint.width * scale);
|
|
91
|
+
canvas.height = Math.round(layout.footprint.height * scale);
|
|
92
|
+
const ctx = canvas.getContext('2d');
|
|
93
|
+
if (!ctx) return null;
|
|
94
|
+
ctx.scale(scale, scale);
|
|
95
|
+
|
|
96
|
+
const roundedRect = (rect: Rect, radius: Corners | number = 0) => {
|
|
97
|
+
ctx.beginPath();
|
|
98
|
+
ctx.roundRect(rect.x, rect.y, rect.width, rect.height, Array.isArray(radius) ? radius : [radius]);
|
|
99
|
+
};
|
|
100
|
+
const fill = (rect: Rect, style: string | CanvasGradient, radius: Corners | number = 0) => {
|
|
101
|
+
roundedRect(rect, radius);
|
|
102
|
+
ctx.fillStyle = style;
|
|
103
|
+
ctx.fill();
|
|
104
|
+
};
|
|
105
|
+
const metal = (rect: Rect, finish: Finish) => {
|
|
106
|
+
const gradient = ctx.createLinearGradient(rect.x, rect.y, rect.x + rect.width * 0.45, rect.y + rect.height);
|
|
107
|
+
gradient.addColorStop(0, finish.hi);
|
|
108
|
+
gradient.addColorStop(0.4, finish.mid);
|
|
109
|
+
gradient.addColorStop(1, finish.lo);
|
|
110
|
+
return gradient;
|
|
111
|
+
};
|
|
112
|
+
const lens = (cx: number, cy: number, size: number) => {
|
|
113
|
+
const gradient = ctx.createRadialGradient(cx - size * 0.15, cy - size * 0.15, 0, cx, cy, size / 2);
|
|
114
|
+
gradient.addColorStop(0, '#2b3a4d');
|
|
115
|
+
gradient.addColorStop(0.6, '#0b0f15');
|
|
116
|
+
gradient.addColorStop(1, '#000');
|
|
117
|
+
ctx.beginPath();
|
|
118
|
+
ctx.arc(cx, cy, size / 2, 0, Math.PI * 2);
|
|
119
|
+
ctx.fillStyle = gradient;
|
|
120
|
+
ctx.fill();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const now = new Date();
|
|
124
|
+
const shortTime = now
|
|
125
|
+
.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' })
|
|
126
|
+
.replace(/\s?(AM|PM|am|pm)/, '')
|
|
127
|
+
.trim();
|
|
128
|
+
const fullTime = now.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
|
|
129
|
+
|
|
130
|
+
/** Signal bars, wifi and battery, right-aligned to `right`, centred on `cy`. */
|
|
131
|
+
const statusGlyphs = (right: number, cy: number, unit: number, colour: string) => {
|
|
132
|
+
ctx.fillStyle = colour;
|
|
133
|
+
ctx.strokeStyle = colour;
|
|
134
|
+
|
|
135
|
+
const batteryW = unit * 2.1;
|
|
136
|
+
const batteryH = unit;
|
|
137
|
+
const batteryX = right - batteryW;
|
|
138
|
+
ctx.lineWidth = Math.max(1, unit * 0.09);
|
|
139
|
+
roundedRect({ x: batteryX, y: cy - batteryH / 2, width: batteryW - unit * 0.18, height: batteryH }, unit * 0.25);
|
|
140
|
+
ctx.stroke();
|
|
141
|
+
fill({ x: batteryX + unit * 0.16, y: cy - batteryH / 2 + unit * 0.16, width: batteryW - unit * 0.5, height: batteryH - unit * 0.32 }, colour, unit * 0.12);
|
|
142
|
+
fill({ x: right - unit * 0.12, y: cy - unit * 0.2, width: unit * 0.12, height: unit * 0.4 }, colour, unit * 0.05);
|
|
143
|
+
|
|
144
|
+
const wifiCx = batteryX - unit * 1.1;
|
|
145
|
+
ctx.lineWidth = unit * 0.2;
|
|
146
|
+
ctx.lineCap = 'round';
|
|
147
|
+
for (const r of [0.35, 0.7, 1.05]) {
|
|
148
|
+
ctx.beginPath();
|
|
149
|
+
ctx.arc(wifiCx, cy + unit * 0.55, unit * r, Math.PI * 1.25, Math.PI * 1.75);
|
|
150
|
+
ctx.stroke();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const barsRight = wifiCx - unit * 1.1;
|
|
154
|
+
for (let index = 0; index < 4; index++) {
|
|
155
|
+
const height = unit * (0.35 + index * 0.22);
|
|
156
|
+
fill({ x: barsRight - (3 - index) * unit * 0.32 - unit * 0.22, y: cy + unit * 0.5 - height, width: unit * 0.22, height }, colour, unit * 0.05);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const drawStatusBar = (bar: Rect) => {
|
|
161
|
+
ctx.textBaseline = 'middle';
|
|
162
|
+
if (layout.os === 'macos') {
|
|
163
|
+
fill(bar, 'rgba(245, 245, 247, 0.96)');
|
|
164
|
+
const size = layout.kind === 'laptop' ? 13 : 12;
|
|
165
|
+
const cy = bar.y + bar.height / 2;
|
|
166
|
+
ctx.fillStyle = '#111113';
|
|
167
|
+
// The apple, as a plain dot of ink — a logo is not worth a path here.
|
|
168
|
+
ctx.beginPath();
|
|
169
|
+
ctx.arc(bar.x + 22, cy, size * 0.42, 0, Math.PI * 2);
|
|
170
|
+
ctx.fill();
|
|
171
|
+
ctx.font = `700 ${size}px ${SYSTEM_FONT}`;
|
|
172
|
+
ctx.fillText('Safari', bar.x + 40, cy);
|
|
173
|
+
let x = bar.x + 40 + ctx.measureText('Safari').width + 18;
|
|
174
|
+
ctx.font = `500 ${size}px ${SYSTEM_FONT}`;
|
|
175
|
+
for (const item of ['File', 'Edit', 'View', 'History', 'Bookmarks', 'Window', 'Help']) {
|
|
176
|
+
ctx.fillText(item, x, cy);
|
|
177
|
+
x += ctx.measureText(item).width + 18;
|
|
178
|
+
}
|
|
179
|
+
const clock = `${now.toLocaleDateString(undefined, { weekday: 'short', day: 'numeric', month: 'short' })} ${fullTime}`;
|
|
180
|
+
ctx.textAlign = 'right';
|
|
181
|
+
ctx.fillText(clock, bar.x + bar.width - 16, cy);
|
|
182
|
+
ctx.textAlign = 'left';
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
fill(bar, input.statusBar);
|
|
187
|
+
const android = layout.os === 'android';
|
|
188
|
+
const phone = layout.kind === 'phone';
|
|
189
|
+
const size = phone ? (android ? 14 : 16) : 12;
|
|
190
|
+
ctx.fillStyle = input.statusInk;
|
|
191
|
+
ctx.font = `${android ? 500 : 600} ${size}px ${android ? ANDROID_FONT : SYSTEM_FONT}`;
|
|
192
|
+
|
|
193
|
+
// Phones with an island centre their items on the island's band, not the bar.
|
|
194
|
+
const cy = layout.island ? layout.island.y + layout.island.height / 2 : bar.y + bar.height / 2;
|
|
195
|
+
const inset = phone ? (layout.island ? Math.max(24, (bar.width - layout.island.width) / 4 - 20) : 18) : 22;
|
|
196
|
+
ctx.textAlign = 'left';
|
|
197
|
+
ctx.fillText(shortTime, bar.x + inset, cy);
|
|
198
|
+
statusGlyphs(bar.x + bar.width - inset, cy, phone ? 11 : 9, input.statusInk);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const drawTaskbar = (bar: Rect) => {
|
|
202
|
+
fill(bar, 'rgba(238, 240, 244, 0.96)');
|
|
203
|
+
const cy = bar.y + bar.height / 2;
|
|
204
|
+
const logo = 18;
|
|
205
|
+
const cx = bar.x + bar.width / 2 - 60;
|
|
206
|
+
const half = logo / 2 - 0.5;
|
|
207
|
+
for (const [dx, dy] of [[0, 0], [half + 1, 0], [0, half + 1], [half + 1, half + 1]]) {
|
|
208
|
+
fill({ x: cx + dx, y: cy - logo / 2 + dy, width: half, height: half }, '#0a84ff');
|
|
209
|
+
}
|
|
210
|
+
['#f2b600', '#1f6feb', '#7c3aed'].forEach((colour, index) => {
|
|
211
|
+
fill({ x: cx + 40 + index * 34, y: cy - 11, width: 22, height: 22 }, colour, 5);
|
|
212
|
+
});
|
|
213
|
+
ctx.fillStyle = '#111113';
|
|
214
|
+
ctx.font = `12px ${ANDROID_FONT}`;
|
|
215
|
+
ctx.textAlign = 'right';
|
|
216
|
+
ctx.textBaseline = 'middle';
|
|
217
|
+
ctx.fillText(fullTime, bar.x + bar.width - 14, cy - 7);
|
|
218
|
+
ctx.fillText(now.toLocaleDateString(), bar.x + bar.width - 14, cy + 8);
|
|
219
|
+
ctx.textAlign = 'left';
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const drawNavBar = (bar: Rect & { direction: 'horizontal' | 'vertical' }) => {
|
|
223
|
+
fill(bar, input.background);
|
|
224
|
+
ctx.strokeStyle = input.backgroundInk;
|
|
225
|
+
ctx.lineWidth = 1.8;
|
|
226
|
+
ctx.lineJoin = 'round';
|
|
227
|
+
|
|
228
|
+
// Back, home, recents — left to right, or bottom to top when turned.
|
|
229
|
+
const vertical = bar.direction === 'vertical';
|
|
230
|
+
const length = vertical ? bar.height : bar.width;
|
|
231
|
+
const [back, home, recents] = [0.25, 0.5, 0.75].map((fraction) =>
|
|
232
|
+
vertical
|
|
233
|
+
? { x: bar.x + bar.width / 2, y: bar.y + length * (1 - fraction) }
|
|
234
|
+
: { x: bar.x + length * fraction, y: bar.y + bar.height / 2 }
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
ctx.beginPath();
|
|
238
|
+
ctx.moveTo(back.x + 4, back.y - 5.5);
|
|
239
|
+
ctx.lineTo(back.x + 4, back.y + 5.5);
|
|
240
|
+
ctx.lineTo(back.x - 4.5, back.y);
|
|
241
|
+
ctx.closePath();
|
|
242
|
+
ctx.stroke();
|
|
243
|
+
|
|
244
|
+
ctx.beginPath();
|
|
245
|
+
ctx.arc(home.x, home.y, 6, 0, Math.PI * 2);
|
|
246
|
+
ctx.stroke();
|
|
247
|
+
|
|
248
|
+
roundedRect({ x: recents.x - 5.5, y: recents.y - 5.5, width: 11, height: 11 }, 1.5);
|
|
249
|
+
ctx.stroke();
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const finish = FINISH[layout.finish ?? 'default'] ?? FINISH.default;
|
|
253
|
+
|
|
254
|
+
// Stand and deck sit behind the body.
|
|
255
|
+
if (layout.neck) fill(layout.neck, metal(layout.neck, finish));
|
|
256
|
+
if (layout.foot) fill(layout.foot, metal(layout.foot, finish), layout.foot.height / 2);
|
|
257
|
+
for (const foot of layout.feet) fill(foot, finish.lo, 2);
|
|
258
|
+
if (layout.base) fill(layout.base, metal(layout.base, finish), [2, 2, layout.base.height, layout.base.height]);
|
|
259
|
+
if (layout.scoop) fill(layout.scoop, finish.lo, [0, 0, layout.scoop.height, layout.scoop.height]);
|
|
260
|
+
|
|
261
|
+
for (const button of layout.buttons) {
|
|
262
|
+
const leading = button.edge === 'left' || button.edge === 'top';
|
|
263
|
+
fill(button, finish.mid, leading ? [3, 1, 1, 3] : [1, 3, 3, 1]);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
fill(layout.body, metal(layout.body, finish), layout.bodyRadius);
|
|
267
|
+
const glass = ctx.createLinearGradient(0, layout.glass.y, 0, layout.glass.y + layout.glass.height);
|
|
268
|
+
glass.addColorStop(0, '#0d0d10');
|
|
269
|
+
glass.addColorStop(1, '#050506');
|
|
270
|
+
fill(layout.glass, glass, layout.glassRadius);
|
|
271
|
+
|
|
272
|
+
// Everything on the display is clipped to its rounded corners.
|
|
273
|
+
ctx.save();
|
|
274
|
+
roundedRect(layout.display, layout.displayRadius);
|
|
275
|
+
ctx.clip();
|
|
276
|
+
fill(layout.display, input.background);
|
|
277
|
+
|
|
278
|
+
if (layout.statusBar) drawStatusBar(layout.statusBar);
|
|
279
|
+
|
|
280
|
+
ctx.save();
|
|
281
|
+
roundedRect(layout.screen, layout.screenRadius);
|
|
282
|
+
ctx.clip();
|
|
283
|
+
ctx.drawImage(image, layout.screen.x, layout.screen.y, layout.screen.width, layout.screen.height);
|
|
284
|
+
ctx.restore();
|
|
285
|
+
|
|
286
|
+
if (layout.bottomBar && layout.os === 'windows') drawTaskbar(layout.bottomBar);
|
|
287
|
+
if (layout.homeIndicator) fill(layout.homeIndicator, input.backgroundInk, layout.homeIndicator.height / 2);
|
|
288
|
+
if (layout.navBar) drawNavBar(layout.navBar);
|
|
289
|
+
if (layout.island) fill(layout.island, '#000', layout.island.height / 2);
|
|
290
|
+
if (layout.notch) fill(layout.notch, '#000', [0, 0, layout.notch.height * 0.6, layout.notch.height * 0.6]);
|
|
291
|
+
if (layout.punchHole) {
|
|
292
|
+
const hole = layout.punchHole;
|
|
293
|
+
lens(hole.x + hole.width / 2, hole.y + hole.height / 2, hole.width);
|
|
294
|
+
}
|
|
295
|
+
if (layout.camera && (layout.island || layout.notch)) lens(layout.camera.x, layout.camera.y, layout.camera.size);
|
|
296
|
+
ctx.restore();
|
|
297
|
+
|
|
298
|
+
// Lenses, the earpiece and the home button live in the bezel.
|
|
299
|
+
if (layout.camera && !layout.island && !layout.notch) lens(layout.camera.x, layout.camera.y, layout.camera.size);
|
|
300
|
+
if (layout.earpiece) fill(layout.earpiece, '#1a1a1d', layout.earpiece.height / 2);
|
|
301
|
+
if (layout.homeButton) {
|
|
302
|
+
const button = layout.homeButton;
|
|
303
|
+
ctx.beginPath();
|
|
304
|
+
ctx.arc(button.x + button.width / 2, button.y + button.height / 2, button.width / 2, 0, Math.PI * 2);
|
|
305
|
+
ctx.strokeStyle = finish.hi;
|
|
306
|
+
ctx.lineWidth = 2;
|
|
307
|
+
ctx.stroke();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return canvas;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** The image inside its device, or null when the device has no mockup. In a browser context. */
|
|
314
|
+
export function renderInDeviceFrame(
|
|
315
|
+
image: CanvasImageSource & { width: number; height: number },
|
|
316
|
+
spec: FrameSpec
|
|
317
|
+
): HTMLCanvasElement | null {
|
|
318
|
+
const input = frameDrawInput(spec);
|
|
319
|
+
return input ? drawDeviceFrame(image, input) : null;
|
|
320
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight fuzzy subsequence matching for the Command Palette and the
|
|
3
|
+
* chat composer's `@` picker.
|
|
4
|
+
*
|
|
5
|
+
* Pure, local, and synchronous — no engine round-trip — so Quick Search stays
|
|
6
|
+
* instant. Scoring rewards exact/prefix hits, consecutive runs, and matches at
|
|
7
|
+
* word boundaries so the most relevant result floats to the top as you type.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Characters that mark the start of a "word" for boundary bonuses. */
|
|
11
|
+
const WORD_BOUNDARY = /[\s\-_/.:@]/;
|
|
12
|
+
|
|
13
|
+
export interface FuzzyMatch {
|
|
14
|
+
/** Higher is a better match. */
|
|
15
|
+
score: number;
|
|
16
|
+
/** Indices in the target string that matched, for optional highlighting. */
|
|
17
|
+
positions: number[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Match `query` as a subsequence of `text` (case-insensitive). Returns `null`
|
|
22
|
+
* when not every query character can be found in order. An empty query matches
|
|
23
|
+
* anything with a neutral score of 0.
|
|
24
|
+
*/
|
|
25
|
+
export function fuzzyMatch(query: string, text: string): FuzzyMatch | null {
|
|
26
|
+
const q = query.trim().toLowerCase();
|
|
27
|
+
if (!q) return { score: 0, positions: [] };
|
|
28
|
+
const t = text.toLowerCase();
|
|
29
|
+
|
|
30
|
+
// Exact-substring is the strongest signal — take it directly.
|
|
31
|
+
const exactIdx = t.indexOf(q);
|
|
32
|
+
if (exactIdx !== -1) {
|
|
33
|
+
const boundaryBonus = exactIdx === 0 || WORD_BOUNDARY.test(t[exactIdx - 1]) ? 20 : 0;
|
|
34
|
+
const positions = Array.from({ length: q.length }, (_, i) => exactIdx + i);
|
|
35
|
+
return { score: 100 + boundaryBonus - exactIdx * 0.1, positions };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const positions: number[] = [];
|
|
39
|
+
let score = 0;
|
|
40
|
+
let ti = 0;
|
|
41
|
+
let prevMatch = -2;
|
|
42
|
+
for (let qi = 0; qi < q.length; qi++) {
|
|
43
|
+
const ch = q[qi];
|
|
44
|
+
let found = -1;
|
|
45
|
+
for (; ti < t.length; ti++) {
|
|
46
|
+
if (t[ti] === ch) {
|
|
47
|
+
found = ti;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (found === -1) return null; // query char missing → not a subsequence
|
|
52
|
+
let charScore = 1;
|
|
53
|
+
if (found === prevMatch + 1) charScore += 3; // consecutive run
|
|
54
|
+
if (found === 0 || WORD_BOUNDARY.test(t[found - 1])) charScore += 5; // word start
|
|
55
|
+
score += charScore;
|
|
56
|
+
positions.push(found);
|
|
57
|
+
prevMatch = found;
|
|
58
|
+
ti = found + 1;
|
|
59
|
+
}
|
|
60
|
+
// Slightly prefer denser matches (query fills more of the target).
|
|
61
|
+
score += Math.max(0, 10 - (t.length - q.length) * 0.05);
|
|
62
|
+
return { score, positions };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Best fuzzy score across several candidate strings (e.g. label, description,
|
|
67
|
+
* keywords). Returns 0 when none of them match, so callers can treat `> 0` as
|
|
68
|
+
* "matched".
|
|
69
|
+
*/
|
|
70
|
+
export function bestFuzzyScore(query: string, texts: (string | undefined | null)[]): number {
|
|
71
|
+
if (!query.trim()) return 0;
|
|
72
|
+
let best = 0;
|
|
73
|
+
for (const text of texts) {
|
|
74
|
+
if (!text) continue;
|
|
75
|
+
const m = fuzzyMatch(query, text);
|
|
76
|
+
if (m && m.score > best) best = m.score;
|
|
77
|
+
}
|
|
78
|
+
return best;
|
|
79
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { afterAll, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
import { computeLauncherFingerprint, launcherClosure, launcherPackageImports } from './launcher-fingerprint';
|
|
7
|
+
|
|
8
|
+
// Shaped like a global install, whose own path runs through a node_modules folder.
|
|
9
|
+
const base = mkdtempSync(join(tmpdir(), 'clopen-launcher-'));
|
|
10
|
+
const root = join(base, 'node_modules', '@myrialabs', 'clopen');
|
|
11
|
+
mkdirSync(root, { recursive: true });
|
|
12
|
+
afterAll(() => rmSync(base, { recursive: true, force: true }));
|
|
13
|
+
|
|
14
|
+
function put(file: string, content: string) {
|
|
15
|
+
mkdirSync(dirname(join(root, file)), { recursive: true });
|
|
16
|
+
writeFileSync(join(root, file), content);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
put('bin/clopen.ts', [
|
|
20
|
+
'#!/usr/bin/env bun',
|
|
21
|
+
"import { join } from 'path';",
|
|
22
|
+
"import { supervise } from '../shared/supervisor';",
|
|
23
|
+
"import dep from 'some-dependency';",
|
|
24
|
+
'async function helper() {',
|
|
25
|
+
" const { run } = await import('../backend/helper');",
|
|
26
|
+
' return run;',
|
|
27
|
+
'}',
|
|
28
|
+
'supervise(join, dep, helper);'
|
|
29
|
+
].join('\n'));
|
|
30
|
+
put('shared/supervisor.ts', "import { tree } from './tree';\nexport const supervise = tree;");
|
|
31
|
+
put('shared/tree.ts', 'export const tree = () => {};');
|
|
32
|
+
put('backend/helper.ts', 'export const run = () => {};');
|
|
33
|
+
put('node_modules/some-dependency/index.js', 'module.exports = 1;');
|
|
34
|
+
put('node_modules/some-dependency/package.json', '{"name":"some-dependency","main":"index.js"}');
|
|
35
|
+
|
|
36
|
+
describe('launcherClosure', () => {
|
|
37
|
+
test('follows static project imports only, even inside an installed package', () => {
|
|
38
|
+
expect(launcherClosure(root)).toEqual(['bin/clopen.ts', 'shared/supervisor.ts', 'shared/tree.ts']);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('reports the packages it imports, which the fingerprint cannot see', () => {
|
|
42
|
+
expect(launcherPackageImports(root)).toEqual(['some-dependency']);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('in this repository the launcher imports no packages', () => {
|
|
46
|
+
expect(launcherPackageImports(join(import.meta.dir, '../..'))).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("in this repository it is the launcher and its supervisor, not the git helper", () => {
|
|
50
|
+
const closure = launcherClosure(join(import.meta.dir, '../..'));
|
|
51
|
+
expect(closure).toContain('bin/clopen.ts');
|
|
52
|
+
expect(closure).toContain('shared/utils/process-supervisor.ts');
|
|
53
|
+
expect(closure).not.toContain('backend/git/identity/cli.ts');
|
|
54
|
+
// The server's half of supervision lives apart, so server-only changes
|
|
55
|
+
// do not read as launcher changes.
|
|
56
|
+
expect(closure).not.toContain('shared/utils/supervised-child.ts');
|
|
57
|
+
expect(closure).toContain('shared/utils/supervisor-protocol.ts');
|
|
58
|
+
expect(closure.every(file => !file.startsWith('backend/'))).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('computeLauncherFingerprint', () => {
|
|
63
|
+
test('changes when a file the launcher loads changes, and not otherwise', () => {
|
|
64
|
+
const before = computeLauncherFingerprint(root);
|
|
65
|
+
expect(computeLauncherFingerprint(root)).toBe(before);
|
|
66
|
+
|
|
67
|
+
put('backend/helper.ts', 'export const run = () => 2;');
|
|
68
|
+
expect(computeLauncherFingerprint(root)).toBe(before);
|
|
69
|
+
|
|
70
|
+
put('shared/tree.ts', 'export const tree = () => 1;');
|
|
71
|
+
expect(computeLauncherFingerprint(root)).not.toBe(before);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fingerprint of the code the `clopen` launcher keeps running.
|
|
3
|
+
*
|
|
4
|
+
* The launcher (bin/clopen.ts) is the process in the user's terminal: it
|
|
5
|
+
* holds the supervisor, forwards Ctrl+C and owns the terminal. Restarting the
|
|
6
|
+
* server from the UI swaps everything below it, but the launcher itself keeps
|
|
7
|
+
* running the code it started with. So an update that changes the launcher
|
|
8
|
+
* still needs the user to restart `clopen` by hand — and this is how Clopen
|
|
9
|
+
* tells: the launcher's fingerprint when it started, against the fingerprint
|
|
10
|
+
* of what is on disk now (or of the version about to be installed).
|
|
11
|
+
*
|
|
12
|
+
* The files are found, not listed: the static imports of bin/clopen.ts are
|
|
13
|
+
* followed through every project file they reach, so a new import is covered
|
|
14
|
+
* without anyone remembering to add it. Dynamic imports are left out on
|
|
15
|
+
* purpose — they load per command (`clopen update`, the git helper) in a
|
|
16
|
+
* process that starts fresh each time, not in the long-running launcher.
|
|
17
|
+
*
|
|
18
|
+
* The launcher may only import builtins and project files: a dependency from
|
|
19
|
+
* node_modules would change on update without changing the fingerprint, so
|
|
20
|
+
* Restart now would be offered while part of the launcher was out of date.
|
|
21
|
+
* launcherPackageImports() exists to keep that list empty.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { createHash } from 'node:crypto';
|
|
25
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
26
|
+
import { dirname, isAbsolute, join, relative, sep } from 'node:path';
|
|
27
|
+
|
|
28
|
+
/** Carries the running launcher's fingerprint to the server it starts. */
|
|
29
|
+
export const LAUNCHER_FINGERPRINT_ENV = 'CLOPEN_LAUNCHER_FINGERPRINT';
|
|
30
|
+
|
|
31
|
+
/** The launcher entry, relative to the package root. */
|
|
32
|
+
export const LAUNCHER_ENTRY = 'bin/clopen.ts';
|
|
33
|
+
|
|
34
|
+
const transpiler = new Bun.Transpiler({ loader: 'ts' });
|
|
35
|
+
|
|
36
|
+
function staticImports(source: string): string[] {
|
|
37
|
+
// The shebang is not TypeScript; the transpiler rejects it.
|
|
38
|
+
const code = source.startsWith('#!') ? source.slice(source.indexOf('\n') + 1) : source;
|
|
39
|
+
return transpiler.scanImports(code).filter(entry => entry.kind === 'import-statement').map(entry => entry.path);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface LauncherGraph {
|
|
43
|
+
/** Project files, relative to the package root, sorted. */
|
|
44
|
+
files: string[];
|
|
45
|
+
/** Imports that resolve to a package rather than a project file or a builtin. */
|
|
46
|
+
packages: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function walkLauncher(packageRoot: string): LauncherGraph {
|
|
50
|
+
// Resolution hands back real paths (macOS: /var is /private/var), so the
|
|
51
|
+
// root has to be one too for the relative paths below to mean anything.
|
|
52
|
+
const root = realpathSync(packageRoot);
|
|
53
|
+
const seen = new Set<string>();
|
|
54
|
+
const packages = new Set<string>();
|
|
55
|
+
const pending = [join(root, LAUNCHER_ENTRY)];
|
|
56
|
+
|
|
57
|
+
while (pending.length > 0) {
|
|
58
|
+
const file = pending.pop()!;
|
|
59
|
+
if (seen.has(file)) continue;
|
|
60
|
+
seen.add(file);
|
|
61
|
+
for (const specifier of staticImports(readFileSync(file, 'utf-8'))) {
|
|
62
|
+
let resolved: string;
|
|
63
|
+
try {
|
|
64
|
+
resolved = Bun.resolveSync(specifier, dirname(file));
|
|
65
|
+
} catch {
|
|
66
|
+
packages.add(specifier);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
// Builtins resolve to their bare name.
|
|
70
|
+
if (!isAbsolute(resolved)) continue;
|
|
71
|
+
// Judged relative to the root: an installed Clopen itself lives inside a
|
|
72
|
+
// node_modules folder, so the absolute path always contains one.
|
|
73
|
+
const path = relative(root, resolved);
|
|
74
|
+
if (path.startsWith('..') || path.split(sep).includes('node_modules')) {
|
|
75
|
+
packages.add(specifier);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
pending.push(resolved);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
files: [...seen].map(file => relative(root, file).split(sep).join('/')).sort(),
|
|
84
|
+
packages: [...packages].sort()
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Every project file the launcher loads up front, relative to `packageRoot`, sorted. */
|
|
89
|
+
export function launcherClosure(packageRoot: string): string[] {
|
|
90
|
+
return walkLauncher(packageRoot).files;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Packages the launcher imports. The fingerprint only covers project files, so
|
|
95
|
+
* a package here would change without the fingerprint noticing; it has to stay
|
|
96
|
+
* empty (the test and the publish stamp both fail otherwise).
|
|
97
|
+
*/
|
|
98
|
+
export function launcherPackageImports(packageRoot: string): string[] {
|
|
99
|
+
return walkLauncher(packageRoot).packages;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function computeLauncherFingerprint(packageRoot: string): string {
|
|
103
|
+
const hash = createHash('sha256');
|
|
104
|
+
for (const file of launcherClosure(packageRoot)) {
|
|
105
|
+
hash.update(file).update('\0').update(readFileSync(join(packageRoot, file))).update('\0');
|
|
106
|
+
}
|
|
107
|
+
return hash.digest('hex').slice(0, 16);
|
|
108
|
+
}
|
package/shared/utils/logger.ts
CHANGED
|
@@ -30,6 +30,7 @@ export type LogLabel =
|
|
|
30
30
|
| 'mcp'
|
|
31
31
|
| 'integrations'
|
|
32
32
|
| 'work'
|
|
33
|
+
| 'git-hosts'
|
|
33
34
|
| 'deployments'
|
|
34
35
|
| 'skills'
|
|
35
36
|
| 'artifacts'
|
|
@@ -67,6 +68,7 @@ export type LogLabel =
|
|
|
67
68
|
// System
|
|
68
69
|
| 'server'
|
|
69
70
|
| 'database'
|
|
71
|
+
| 'storage'
|
|
70
72
|
| 'migration'
|
|
71
73
|
| 'seeder'
|
|
72
74
|
| 'path';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { foregroundFor } from './page-colors';
|
|
3
|
+
|
|
4
|
+
describe('foregroundFor', () => {
|
|
5
|
+
test('dark ink on a light page, light ink on a dark one', () => {
|
|
6
|
+
expect(foregroundFor('#ffffff')).toBe('#111113');
|
|
7
|
+
expect(foregroundFor('#fff')).toBe('#111113');
|
|
8
|
+
expect(foregroundFor('#202124')).toBe('#fff');
|
|
9
|
+
expect(foregroundFor('rgb(232, 113, 38)')).toBe('#fff');
|
|
10
|
+
expect(foregroundFor('rgba(250, 250, 250, 0.9)')).toBe('#111113');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('a page with no colours yet is treated as the default white canvas', () => {
|
|
14
|
+
expect(foregroundFor(null)).toBe('#111113');
|
|
15
|
+
expect(foregroundFor('not a colour')).toBe('#111113');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ink for system UI painted in a page's colours: the status bar text and the
|
|
3
|
+
* home indicator go dark on a light page and light on a dark one, as iOS and
|
|
4
|
+
* Android draw them.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Parse `#rgb`, `#rrggbb` or `rgb()/rgba()` into channels, or null. */
|
|
8
|
+
function channels(colour: string): [number, number, number] | null {
|
|
9
|
+
const hex = /^#([\da-f]{3}|[\da-f]{6})$/i.exec(colour.trim());
|
|
10
|
+
if (hex) {
|
|
11
|
+
const digits = hex[1].length === 3 ? hex[1].replace(/./g, (d) => d + d) : hex[1];
|
|
12
|
+
return [0, 2, 4].map((i) => parseInt(digits.slice(i, i + 2), 16)) as [number, number, number];
|
|
13
|
+
}
|
|
14
|
+
const rgb = /rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i.exec(colour);
|
|
15
|
+
return rgb ? [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])] : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function foregroundFor(colour: string | null | undefined): string {
|
|
19
|
+
const rgb = colour ? channels(colour) : null;
|
|
20
|
+
if (!rgb) return '#111113';
|
|
21
|
+
const [r, g, b] = rgb;
|
|
22
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
23
|
+
return luminance > 0.6 ? '#111113' : '#fff';
|
|
24
|
+
}
|