@openchamber/web 1.22.1 → 1.23.0
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/bin/cli.js +11 -1
- package/bin/cli.test.js +92 -0
- package/bin/lib/cli-startup.js +49 -0
- package/bin/lib/commands-startup.js +41 -6
- package/dist/assets/{CodeMirrorCommentWidgets-BO_2OW4E.js → CodeMirrorCommentWidgets-DbcnxAfY.js} +1 -1
- package/dist/assets/DiffView-Dp1tomqK.js +4 -0
- package/dist/assets/{DirtyBranchSwitchDialog-jADfXQnR.js → DirtyBranchSwitchDialog-DE2sKIYv.js} +1 -1
- package/dist/assets/FilesView-C_of2nIT.js +17 -0
- package/dist/assets/{GitView-Cv2xH-S6.js → GitView-CKgUkb5Z.js} +4 -4
- package/dist/assets/{JsonTreeView-DUiIpERC.js → JsonTreeView-Bce2ettZ.js} +1 -1
- package/dist/assets/{LinearIssuesView-CoZ7pQN5.js → LinearIssuesView-BZVWM2zw.js} +1 -1
- package/dist/assets/MarkdownImageGallery-DdROVz29.js +1 -0
- package/dist/assets/MarkdownRendererImpl-CenrzmMN.js +12 -0
- package/dist/assets/OnboardingScreen-DyqYG_NP.js +1 -0
- package/dist/assets/{PatchDiff-BymkP9JA.js → PatchDiff-CR3RVO5I.js} +1 -1
- package/dist/assets/PierreDiffViewer-KihzO94X.js +161 -0
- package/dist/assets/PlanView-jcQAfr2A.js +5 -0
- package/dist/assets/SettingsView-Buvom5A2.js +28 -0
- package/dist/assets/{SettingsWindow-COzgfFxM.js → SettingsWindow-CV_hzB5v.js} +1 -1
- package/dist/assets/SymbolsNerdFontMono-Regular-aK5vsLov.woff2 +0 -0
- package/dist/assets/{ToolOutputDialog-Dlhh_-oe.js → ToolOutputDialog-llKecK_Z.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-b9joNtXH.js → ToolPartDiffPreview-ZDMTdCGn.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-vqW3KKo5.js → VirtualizedFileDiff-ClvqQ4j0.js} +1 -1
- package/dist/assets/WalkthroughView-BgpSnSlU.js +4 -0
- package/dist/assets/{computeVirtualFileMetrics-DUnyszhW.js → computeVirtualFileMetrics-Nm5_wabb.js} +2 -2
- package/dist/assets/contextPanelEmbeddedChat-CirXEPJq.js +1 -0
- package/dist/assets/de-DTQDjaiv.js +10 -0
- package/dist/assets/es-SOCFd_r-.js +16 -0
- package/dist/assets/fr-CP6jqIzw.js +14 -0
- package/dist/assets/ghostty-vt-DdA0Zryv.wasm +0 -0
- package/dist/assets/index-B68h5S5B.css +1 -0
- package/dist/assets/index-CRf2xk51.js +39 -0
- package/dist/assets/{index-DLiD86ge.js → index-Du9sZhDb.js} +1 -1
- package/dist/assets/{isDiffPlainText-TNageFjy.js → isDiffPlainText-EQERIius.js} +1 -1
- package/dist/assets/{isFilePlainText-JPmZOYSp.js → isFilePlainText-BCoVpkQy.js} +1 -1
- package/dist/assets/ja-BKfafwsD.js +16 -0
- package/dist/assets/ko-BA5xgCYp.js +16 -0
- package/dist/assets/main-BNiPEont.js +930 -0
- package/dist/assets/{main-DCB4JgVe.js → main-DPf32fO6.js} +2 -2
- package/dist/assets/markdownCore-CQ7CAuuV.js +5 -0
- package/dist/assets/{miniChat-BtV7N5OF.js → miniChat-CHqVTsgj.js} +2 -2
- package/dist/assets/{mobile-DZV_sfX7.js → mobile-BQmgHA57.js} +2 -2
- package/dist/assets/patchFileDiff-C4X_trug.js +13 -0
- package/dist/assets/pl-B215pG1Y.js +16 -0
- package/dist/assets/pt-BR-Bo2pnlEa.js +16 -0
- package/dist/assets/renderElectronMiniChatApp-BUcHPOXW.js +2 -0
- package/dist/assets/renderMobileApp-BvTmuRE-.js +25 -0
- package/dist/assets/runtimeEndpointReset-C8GAA2kS.js +17 -0
- package/dist/assets/scheduledTasksApi-BAScWwt3.js +1 -0
- package/dist/assets/{shikiHighlight-CRpCl7UT.js → shikiHighlight-BTObuQCR.js} +1 -1
- package/dist/assets/surface-BvRzS58U.js +1 -0
- package/dist/assets/tr-CUaxHc8X.js +7 -0
- package/dist/assets/uk-YTJgyqAZ.js +16 -0
- package/dist/assets/{useAppFontEffects-CCgvcQ6u.js → useAppFontEffects-theH_IJL.js} +143 -137
- package/dist/assets/useGitComparison-B94I6kOI.js +1 -0
- package/dist/assets/useInlineCommentController-Bs3PgeA8.js +2 -0
- package/dist/assets/useRootScrollLock-hSYwnxZs.js +1 -0
- package/dist/assets/{vendor-base-ui-BeMD8X_w.js → vendor-base-ui-DdV8vhHn.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BxpoC5Fp.js → vendor-codemirror-language-data-Cxgr01md.js} +2 -2
- package/dist/assets/vendor-legendapp-list-BuBPBC3R.js +1 -0
- package/dist/assets/vendor-zod-BPAANqvH.js +39 -0
- package/dist/assets/{web-components-B6QgbmTo.js → web-components-CaS0ksnZ.js} +1 -1
- package/dist/assets/zh-CN-CZ2BxZS6.js +16 -0
- package/dist/assets/zh-TW-BsUrPdXz.js +16 -0
- package/dist/index.html +5 -43
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +3 -4
- package/server/index.d.ts +15 -0
- package/server/index.js +52 -10
- package/server/lib/changelog/update-notes.js +82 -0
- package/server/lib/changelog/update-notes.test.js +59 -0
- package/server/lib/data-dir-migration.js +40 -0
- package/server/lib/data-dir-migration.test.js +59 -0
- package/server/lib/event-stream/runtime.test.js +12 -12
- package/server/lib/fs/DOCUMENTATION.md +5 -0
- package/server/lib/fs/routes.js +63 -21
- package/server/lib/fs/routes.test.js +187 -1
- package/server/lib/git/DOCUMENTATION.md +29 -5
- package/server/lib/git/routes.js +24 -4
- package/server/lib/git/service.js +194 -198
- package/server/lib/git/service.test.js +440 -25
- package/server/lib/inherited-env.js +16 -9
- package/server/lib/inherited-env.test.js +8 -9
- package/server/lib/message-queue/DOCUMENTATION.md +20 -7
- package/server/lib/message-queue/runtime.js +59 -7
- package/server/lib/message-queue/runtime.test.js +59 -3
- package/server/lib/network-defaults.js +23 -0
- package/server/lib/network-defaults.test.js +52 -0
- package/server/lib/opencode/DOCUMENTATION.md +25 -5
- package/server/lib/opencode/bootstrap-runtime.js +2 -0
- package/server/lib/opencode/config-paths.test.js +116 -0
- package/server/lib/opencode/feature-routes-runtime.js +4 -0
- package/server/lib/opencode/input-history-scope.js +14 -0
- package/server/lib/opencode/openchamber-routes.js +64 -4
- package/server/lib/opencode/openchamber-routes.test.js +128 -1
- package/server/lib/opencode/plugins.js +2 -2
- package/server/lib/opencode/providers.js +44 -2
- package/server/lib/opencode/providers.test.js +131 -4
- package/server/lib/opencode/routes.js +9 -7
- package/server/lib/opencode/server-startup-runtime.js +1 -1
- package/server/lib/opencode/settings-files.js +214 -0
- package/server/lib/opencode/settings-helpers.js +113 -41
- package/server/lib/opencode/settings-helpers.test.js +342 -0
- package/server/lib/opencode/settings-registry.json +747 -0
- package/server/lib/opencode/settings-runtime.js +139 -18
- package/server/lib/opencode/settings-runtime.test.js +163 -5
- package/server/lib/opencode/shared.js +4 -1
- package/server/lib/opencode/skill-routes.js +2 -1
- package/server/lib/opencode/snippets.js +1 -2
- package/server/lib/package-manager.js +3 -28
- package/server/lib/project-context/DOCUMENTATION.md +25 -1
- package/server/lib/project-context/routes.http.test.js +18 -0
- package/server/lib/project-context/routes.js +15 -0
- package/server/lib/project-context/runtime.js +248 -23
- package/server/lib/project-context/runtime.test.js +106 -3
- package/server/lib/projects/DOCUMENTATION.md +76 -0
- package/server/lib/projects/project-config.js +142 -9
- package/server/lib/projects/project-id.js +17 -0
- package/server/lib/projects/project-setup.js +409 -0
- package/server/lib/projects/project-setup.test.js +557 -0
- package/server/lib/projects/routes.js +59 -0
- package/server/lib/quota/DOCUMENTATION.md +38 -1
- package/server/lib/quota/index.js +1 -0
- package/server/lib/quota/providers/cline-pass.js +125 -0
- package/server/lib/quota/providers/cline-pass.test.js +103 -0
- package/server/lib/quota/providers/hyper.js +118 -0
- package/server/lib/quota/providers/hyper.test.js +126 -0
- package/server/lib/quota/providers/index.js +15 -0
- package/server/lib/quota/providers/neuralwatt.js +3 -6
- package/server/lib/quota/providers/neuralwatt.test.js +7 -7
- package/server/lib/quota/providers/ollama-cloud.js +31 -0
- package/server/lib/quota/providers/ollama-cloud.test.js +33 -1
- package/server/lib/quota/providers/opencode-go.js +1 -1
- package/server/lib/quota/providers/opencode-go.test.js +26 -1
- package/server/lib/quota/providers/openrouter.js +119 -24
- package/server/lib/quota/providers/openrouter.test.js +330 -0
- package/server/lib/quota/utils/auth.js +1 -1
- package/server/lib/relay/DOCUMENTATION.md +55 -0
- package/server/lib/relay/cross-compat.test.js +26 -0
- package/server/lib/relay/downstream-scheduler.js +154 -0
- package/server/lib/relay/downstream-scheduler.test.js +162 -0
- package/server/lib/relay/e2ee.js +10 -8
- package/server/lib/relay/flow-control.test.js +177 -0
- package/server/lib/relay/host-client.js +37 -8
- package/server/lib/relay/host-client.test.js +9 -1
- package/server/lib/relay/tunnel-codec.js +9 -0
- package/server/lib/relay/tunnel-host.js +66 -17
- package/server/lib/session-assist/runtime.js +6 -10
- package/server/lib/session-goal/DOCUMENTATION.md +20 -7
- package/server/lib/session-goal/runtime.js +80 -20
- package/server/lib/session-goal/runtime.test.js +426 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +1 -1
- package/server/lib/skills-catalog/install.js +3 -2
- package/server/lib/small-model/DOCUMENTATION.md +3 -2
- package/server/lib/small-model/call.js +9 -4
- package/server/lib/small-model/call.test.js +29 -0
- package/server/lib/small-model/index.js +5 -10
- package/server/lib/small-model/runtime-providers.js +15 -7
- package/server/lib/small-model/runtime-providers.test.js +7 -1
- package/server/lib/terminal/DOCUMENTATION.md +14 -10
- package/server/lib/terminal/runtime.js +160 -24
- package/server/lib/terminal/runtime.test.js +571 -37
- package/server/lib/terminal/shells.js +17 -0
- package/server/lib/terminal/shells.test.js +32 -1
- package/server/lib/walkthrough/DOCUMENTATION.md +33 -14
- package/server/lib/walkthrough/model-settings.js +8 -12
- package/server/lib/walkthrough/prompt.js +3 -1
- package/server/lib/walkthrough/routes.test.js +26 -5
- package/server/lib/walkthrough/sources.js +23 -2
- package/dist/assets/DiffView-CNnDxRmO.js +0 -4
- package/dist/assets/FilesView-8wdiG2mj.js +0 -17
- package/dist/assets/MarkdownImageGallery-DffjmciG.js +0 -1
- package/dist/assets/MarkdownRendererImpl-DxqdYDAx.js +0 -12
- package/dist/assets/OnboardingScreen-CTZe6HZn.js +0 -1
- package/dist/assets/PierreDiffViewer-BvwtCxW4.js +0 -157
- package/dist/assets/PlanView-C1qvAm7m.js +0 -5
- package/dist/assets/SettingsView-xGONHFGS.js +0 -28
- package/dist/assets/WalkthroughView-D-HFgdmM.js +0 -4
- package/dist/assets/contextPanelEmbeddedChat-CV-DwAiX.js +0 -1
- package/dist/assets/de-Cv_4FoXm.js +0 -10
- package/dist/assets/es-BIWNEbnS.js +0 -16
- package/dist/assets/fr-SD3OfMHJ.js +0 -14
- package/dist/assets/index-CHUT_bDS.css +0 -1
- package/dist/assets/index-DDInLQDd.js +0 -40
- package/dist/assets/ja-D7I9HofF.js +0 -16
- package/dist/assets/ko-BsVJM_PQ.js +0 -16
- package/dist/assets/main-De8Z5w49.js +0 -928
- package/dist/assets/markdownCore-BoQVG5-a.js +0 -3
- package/dist/assets/patchFileDiff-Chmiz6hq.js +0 -10
- package/dist/assets/pl-XR9Bs8Be.js +0 -16
- package/dist/assets/pt-BR-Due4be8g.js +0 -16
- package/dist/assets/renderElectronMiniChatApp-8tXADjfl.js +0 -2
- package/dist/assets/renderMobileApp-Cji7Hma5.js +0 -25
- package/dist/assets/runtimeEndpointReset-gWt3Lb5D.js +0 -16
- package/dist/assets/scheduledTasksApi-9e-UX6im.js +0 -1
- package/dist/assets/tr-DBJcAv4y.js +0 -7
- package/dist/assets/uk-COYh2BaN.js +0 -16
- package/dist/assets/useInlineCommentController-BkfXnjNZ.js +0 -2
- package/dist/assets/useRootScrollLock-KzOUytpn.js +0 -1
- package/dist/assets/vendor-ghostty-web-CrxinGGH.js +0 -13
- package/dist/assets/vendor-legendapp-list-gg7YLRW7.js +0 -1
- package/dist/assets/vendor-zod-DVWEh-IS.js +0 -39
- package/dist/assets/zh-CN-Cjk6lzhc.js +0 -16
- package/dist/assets/zh-TW-Dk0dOg03.js +0 -16
package/dist/index.html
CHANGED
|
@@ -509,16 +509,16 @@
|
|
|
509
509
|
pointer-events: none;
|
|
510
510
|
}
|
|
511
511
|
</style>
|
|
512
|
-
<script type="module" crossorigin src="/assets/main-
|
|
512
|
+
<script type="module" crossorigin src="/assets/main-DPf32fO6.js"></script>
|
|
513
513
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
514
514
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
515
515
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
516
516
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
517
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
517
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BPAANqvH.js">
|
|
518
518
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
519
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
520
|
-
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-
|
|
521
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
519
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CRf2xk51.js">
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
|
|
521
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B68h5S5B.css">
|
|
522
522
|
</head>
|
|
523
523
|
<body class="h-full bg-background text-foreground">
|
|
524
524
|
<div id="root" class="h-full">
|
|
@@ -603,44 +603,6 @@
|
|
|
603
603
|
}, 10000);
|
|
604
604
|
</script>
|
|
605
605
|
|
|
606
|
-
<!-- CSS Font Loading API for reliable Nerd Font loading. The ~2 MB of
|
|
607
|
-
Nerd Fonts are only used by the terminal viewport, so they are no
|
|
608
|
-
longer downloaded on every cold start: the terminal requests them on
|
|
609
|
-
first mount through this idempotent hook. -->
|
|
610
|
-
<script>
|
|
611
|
-
(function() {
|
|
612
|
-
let nerdFontsPromise = null;
|
|
613
|
-
window.__openchamberEnsureNerdFonts = function() {
|
|
614
|
-
if (nerdFontsPromise) {
|
|
615
|
-
return nerdFontsPromise;
|
|
616
|
-
}
|
|
617
|
-
const fonts = [
|
|
618
|
-
{
|
|
619
|
-
name: 'JetBrainsMono Nerd Font',
|
|
620
|
-
url: 'https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/JetBrainsMonoNerdFont-Regular.woff2'
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
name: 'FiraCode Nerd Font',
|
|
624
|
-
url: 'https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/FiraCodeNerdFont-Regular.woff2'
|
|
625
|
-
}
|
|
626
|
-
];
|
|
627
|
-
|
|
628
|
-
const fontPromises = fonts.map(font => {
|
|
629
|
-
const fontFace = new FontFace(font.name, `url(${font.url}) format('woff2')`);
|
|
630
|
-
document.fonts.add(fontFace);
|
|
631
|
-
return fontFace.load().catch(err => {
|
|
632
|
-
console.warn(`Failed to load font: ${font.name}`, err);
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
nerdFontsPromise = Promise.allSettled(fontPromises).then(() => {
|
|
637
|
-
document.documentElement.classList.add('fonts-loaded');
|
|
638
|
-
});
|
|
639
|
-
return nerdFontsPromise;
|
|
640
|
-
};
|
|
641
|
-
})();
|
|
642
|
-
</script>
|
|
643
|
-
|
|
644
606
|
<!-- Polyfill for process before loading React -->
|
|
645
607
|
<script>
|
|
646
608
|
if (typeof process === 'undefined') {
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-CHqVTsgj.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BPAANqvH.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
85
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CRf2xk51.js">
|
|
85
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B68h5S5B.css">
|
|
86
86
|
</head>
|
|
87
87
|
<body class="h-full bg-background text-foreground">
|
|
88
88
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-BQmgHA57.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BPAANqvH.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
74
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CRf2xk51.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B68h5S5B.css">
|
|
75
75
|
</head>
|
|
76
76
|
<body class="h-full bg-background text-foreground">
|
|
77
77
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"dev": "bun run build:watch",
|
|
16
16
|
"dev:server": "OPENCHAMBER_RELAY_HOST=${OPENCHAMBER_RELAY_HOST:-off} bun server/index.js --port ${OPENCHAMBER_PORT:-3001}",
|
|
17
|
-
"dev:server:watch": "
|
|
17
|
+
"dev:server:watch": "node ./scripts/dev-server-watch.mjs",
|
|
18
18
|
"build": "vite build",
|
|
19
19
|
"build:watch": "vite build --watch",
|
|
20
20
|
"type-check": "tsc --noEmit",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@clack/prompts": "^1.1.0",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
|
-
"@opencode-ai/sdk": "1.18.
|
|
28
|
+
"@opencode-ai/sdk": "1.18.30",
|
|
29
29
|
"@simplewebauthn/server": "13.3.1",
|
|
30
30
|
"bun-pty": "^0.4.5",
|
|
31
31
|
"compression": "^1.8.1",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"eslint": "^9.33.0",
|
|
78
78
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
79
79
|
"eslint-plugin-react-refresh": "^0.5.0",
|
|
80
|
-
"ghostty-web": "0.4.0",
|
|
81
80
|
"globals": "^16.3.0",
|
|
82
81
|
"next-themes": "^0.4.6",
|
|
83
82
|
"nodemon": "^3.1.7",
|
package/server/index.d.ts
CHANGED
|
@@ -11,12 +11,27 @@ export interface WebUiServerController {
|
|
|
11
11
|
stop: (options?: { exitProcess?: boolean }) => Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface DesktopUpdateInfo {
|
|
15
|
+
available: boolean;
|
|
16
|
+
currentVersion?: string;
|
|
17
|
+
version?: string | null;
|
|
18
|
+
body?: string | null;
|
|
19
|
+
date?: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DesktopUpdater {
|
|
23
|
+
check: () => Promise<DesktopUpdateInfo>;
|
|
24
|
+
install: () => Promise<DesktopUpdateInfo>;
|
|
25
|
+
restart: () => Promise<void> | void;
|
|
26
|
+
}
|
|
27
|
+
|
|
14
28
|
export interface StartWebUiServerOptions {
|
|
15
29
|
port?: number;
|
|
16
30
|
host?: string;
|
|
17
31
|
attachSignals?: boolean;
|
|
18
32
|
exitOnShutdown?: boolean;
|
|
19
33
|
uiPassword?: string | null;
|
|
34
|
+
desktopUpdater?: DesktopUpdater;
|
|
20
35
|
}
|
|
21
36
|
|
|
22
37
|
export declare function startWebUiServer(
|
package/server/index.js
CHANGED
|
@@ -94,6 +94,7 @@ import { createPermissionAutoAcceptRuntime } from './lib/permission-auto-accept/
|
|
|
94
94
|
import { createMessageQueueRuntime } from './lib/message-queue/runtime.js';
|
|
95
95
|
import { createGracefulShutdownRuntime } from './lib/opencode/shutdown-runtime.js';
|
|
96
96
|
import { createProjectConfigRuntime } from './lib/projects/project-config.js';
|
|
97
|
+
import { migrateLegacyUserDirs } from './lib/data-dir-migration.js';
|
|
97
98
|
import { createProjectContextRuntime } from './lib/project-context/runtime.js';
|
|
98
99
|
import { createAgentMemoryRuntime } from './lib/agent-memory/runtime.js';
|
|
99
100
|
import { createAgentMemoryActions } from './lib/agent-memory/actions.js';
|
|
@@ -117,6 +118,10 @@ import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
|
117
118
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
118
119
|
import { OpenChamberControlError } from './lib/openchamber-control/error.js';
|
|
119
120
|
import webPush from 'web-push';
|
|
121
|
+
import { applyConnectAttemptTimeout } from './lib/network-defaults.js';
|
|
122
|
+
|
|
123
|
+
// Background CLI launches enter here in a fresh process, without CLI defaults.
|
|
124
|
+
applyConnectAttemptTimeout();
|
|
120
125
|
|
|
121
126
|
const __filename = fileURLToPath(import.meta.url);
|
|
122
127
|
const __dirname = path.dirname(__filename);
|
|
@@ -259,16 +264,27 @@ const normalizeManagedRemoteTunnelPresets = (...args) =>
|
|
|
259
264
|
const normalizeManagedRemoteTunnelPresetTokens = (...args) =>
|
|
260
265
|
settingsNormalizationRuntime.normalizeManagedRemoteTunnelPresetTokens(...args);
|
|
261
266
|
const isUnsafeSkillRelativePath = (...args) => settingsNormalizationRuntime.isUnsafeSkillRelativePath(...args);
|
|
262
|
-
const sanitizeTypographySizesPartial = (...args) =>
|
|
263
|
-
settingsNormalizationRuntime.sanitizeTypographySizesPartial(...args);
|
|
264
267
|
const normalizeStringArray = (...args) => settingsNormalizationRuntime.normalizeStringArray(...args);
|
|
265
268
|
const sanitizeModelRefs = (...args) => settingsNormalizationRuntime.sanitizeModelRefs(...args);
|
|
266
269
|
const sanitizeSkillCatalogs = (...args) => settingsNormalizationRuntime.sanitizeSkillCatalogs(...args);
|
|
267
270
|
const sanitizeProjects = (...args) => settingsNormalizationRuntime.sanitizeProjects(...args);
|
|
268
271
|
|
|
269
|
-
|
|
272
|
+
// Every OpenChamber-owned file and folder hangs off one root: the default
|
|
273
|
+
// `~/.config/openchamber`, or `OPENCHAMBER_DATA_DIR` when set. The user
|
|
274
|
+
// folders (`projects/`, `themes/`, `speech-models/`) are copied into a custom
|
|
275
|
+
// root once at startup (`migrateLegacyUserDirs`), because they used to ignore
|
|
276
|
+
// the variable.
|
|
277
|
+
const OPENCHAMBER_DEFAULT_CONFIG_ROOT = path.join(os.homedir(), '.config', 'openchamber');
|
|
278
|
+
const OPENCHAMBER_USER_CONFIG_ROOT = process.env.OPENCHAMBER_DATA_DIR
|
|
279
|
+
? path.resolve(process.env.OPENCHAMBER_DATA_DIR)
|
|
280
|
+
: OPENCHAMBER_DEFAULT_CONFIG_ROOT;
|
|
270
281
|
const OPENCHAMBER_USER_THEMES_DIR = path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'themes');
|
|
271
282
|
const OPENCHAMBER_PROJECTS_CONFIG_DIR = path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'projects');
|
|
283
|
+
// OPENCHAMBER_CHATS_DIR relocates managed chat worktrees — needed when the
|
|
284
|
+
// OpenCode server runs as a separate user that cannot traverse $HOME.
|
|
285
|
+
const OPENCHAMBER_CHATS_DIR = process.env.OPENCHAMBER_CHATS_DIR && process.env.OPENCHAMBER_CHATS_DIR.trim()
|
|
286
|
+
? path.resolve(process.env.OPENCHAMBER_CHATS_DIR.trim())
|
|
287
|
+
: path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats');
|
|
272
288
|
|
|
273
289
|
const MAX_THEME_JSON_BYTES = 512 * 1024;
|
|
274
290
|
|
|
@@ -300,9 +316,7 @@ const maybeCacheSessionInfoFromEvent = (...args) => notificationTemplateRuntime.
|
|
|
300
316
|
const buildTemplateVariables = (...args) => notificationTemplateRuntime.buildTemplateVariables(...args);
|
|
301
317
|
const getCachedZenModels = (...args) => notificationTemplateRuntime.getCachedZenModels(...args);
|
|
302
318
|
|
|
303
|
-
const OPENCHAMBER_DATA_DIR =
|
|
304
|
-
? path.resolve(process.env.OPENCHAMBER_DATA_DIR)
|
|
305
|
-
: path.join(os.homedir(), '.config', 'openchamber');
|
|
319
|
+
const OPENCHAMBER_DATA_DIR = OPENCHAMBER_USER_CONFIG_ROOT;
|
|
306
320
|
const SETTINGS_FILE_PATH = path.join(OPENCHAMBER_DATA_DIR, 'settings.json');
|
|
307
321
|
const PUSH_SUBSCRIPTIONS_FILE_PATH = path.join(OPENCHAMBER_DATA_DIR, 'push-subscriptions.json');
|
|
308
322
|
const APNS_TOKENS_FILE_PATH = path.join(OPENCHAMBER_DATA_DIR, 'apns-tokens.json');
|
|
@@ -340,7 +354,6 @@ const settingsHelpers = createSettingsHelpers({
|
|
|
340
354
|
normalizeManagedRemoteTunnelHostname,
|
|
341
355
|
normalizeManagedRemoteTunnelPresets,
|
|
342
356
|
normalizeManagedRemoteTunnelPresetTokens,
|
|
343
|
-
sanitizeTypographySizesPartial,
|
|
344
357
|
normalizeStringArray,
|
|
345
358
|
sanitizeModelRefs,
|
|
346
359
|
sanitizeSkillCatalogs,
|
|
@@ -479,6 +492,17 @@ const getUpstreamStallTimeoutMs = () => (
|
|
|
479
492
|
: DEFAULT_UPSTREAM_STALL_TIMEOUT_MS
|
|
480
493
|
);
|
|
481
494
|
|
|
495
|
+
const movedUserDirs = await migrateLegacyUserDirs({
|
|
496
|
+
fsPromises,
|
|
497
|
+
path,
|
|
498
|
+
dataDir: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
499
|
+
legacyRoot: OPENCHAMBER_DEFAULT_CONFIG_ROOT,
|
|
500
|
+
warn: (message) => console.warn(`[data-dir] ${message}`),
|
|
501
|
+
});
|
|
502
|
+
if (movedUserDirs.length > 0) {
|
|
503
|
+
console.log(`[data-dir] Copied ${movedUserDirs.join(', ')} into ${OPENCHAMBER_USER_CONFIG_ROOT}`);
|
|
504
|
+
}
|
|
505
|
+
|
|
482
506
|
const projectConfigRuntime = createProjectConfigRuntime({
|
|
483
507
|
fsPromises,
|
|
484
508
|
path,
|
|
@@ -489,6 +513,7 @@ const projectContextRuntime = createProjectContextRuntime({
|
|
|
489
513
|
fsPromises,
|
|
490
514
|
path,
|
|
491
515
|
projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
|
|
516
|
+
resolveSharedPlansDir: (projectId) => projectConfigRuntime.resolveSharedPlansDir(projectId),
|
|
492
517
|
});
|
|
493
518
|
|
|
494
519
|
const agentMemoryRuntime = createAgentMemoryRuntime({
|
|
@@ -888,7 +913,13 @@ const messageQueueRuntime = createMessageQueueRuntime({
|
|
|
888
913
|
buildOpenCodeUrl,
|
|
889
914
|
getOpenCodeAuthHeaders,
|
|
890
915
|
sessionKnowledgeRuntime,
|
|
891
|
-
|
|
916
|
+
// OpenCode's /global/event SSE proxy cannot carry OpenChamber-owned events.
|
|
917
|
+
// Use the shared control stream for SSE clients and the existing WS fan-out.
|
|
918
|
+
broadcastGlobalUiEvent: createGlobalUiEventBroadcaster({
|
|
919
|
+
sseClients: uiOpenChamberEventClients,
|
|
920
|
+
wsClients: uiNotificationWsClients,
|
|
921
|
+
writeSseEvent,
|
|
922
|
+
}),
|
|
892
923
|
onPromptSent: (sessionId) => sessionRuntime.markUserMessageSent(sessionId),
|
|
893
924
|
dataDir: OPENCHAMBER_DATA_DIR,
|
|
894
925
|
});
|
|
@@ -1315,7 +1346,7 @@ const resolveMemoryProjectId = createMemoryProjectResolver({
|
|
|
1315
1346
|
return sanitizeProjects(settings?.projects || []).map((project) => project.path);
|
|
1316
1347
|
},
|
|
1317
1348
|
resolvePrimaryWorktreeRoot,
|
|
1318
|
-
managedProjectRoots: [path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats')],
|
|
1349
|
+
managedProjectRoots: [...new Set([path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats'), OPENCHAMBER_CHATS_DIR])],
|
|
1319
1350
|
});
|
|
1320
1351
|
|
|
1321
1352
|
/**
|
|
@@ -1637,6 +1668,12 @@ async function main(options = {}) {
|
|
|
1637
1668
|
const getDesktopRuntimeConfig = typeof options.getDesktopRuntimeConfig === 'function'
|
|
1638
1669
|
? options.getDesktopRuntimeConfig
|
|
1639
1670
|
: null;
|
|
1671
|
+
const desktopUpdater = options.desktopUpdater
|
|
1672
|
+
&& typeof options.desktopUpdater.check === 'function'
|
|
1673
|
+
&& typeof options.desktopUpdater.install === 'function'
|
|
1674
|
+
&& typeof options.desktopUpdater.restart === 'function'
|
|
1675
|
+
? options.desktopUpdater
|
|
1676
|
+
: null;
|
|
1640
1677
|
|
|
1641
1678
|
console.log(`Starting OpenChamber on port ${port === 0 ? 'auto' : port}`);
|
|
1642
1679
|
|
|
@@ -1671,7 +1708,10 @@ async function main(options = {}) {
|
|
|
1671
1708
|
res.setHeader('Access-Control-Allow-Origin', origin);
|
|
1672
1709
|
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
1673
1710
|
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
|
|
1674
|
-
|
|
1711
|
+
// The packaged desktop UI (openchamber-ui://) and the dev UI sit on a
|
|
1712
|
+
// different origin, so every custom request header must be listed here or
|
|
1713
|
+
// the browser refuses the request at preflight, before it reaches a route.
|
|
1714
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding,Ngrok-Skip-Browser-Warning,X-OpenChamber-Surface');
|
|
1675
1715
|
res.setHeader('Access-Control-Expose-Headers', 'x-next-cursor');
|
|
1676
1716
|
res.setHeader('Vary', 'Origin');
|
|
1677
1717
|
if (req.method === 'OPTIONS') {
|
|
@@ -1812,6 +1852,7 @@ async function main(options = {}) {
|
|
|
1812
1852
|
getCachedZenModels,
|
|
1813
1853
|
setAutoAcceptSession,
|
|
1814
1854
|
agentToolRuntime,
|
|
1855
|
+
desktopUpdater,
|
|
1815
1856
|
});
|
|
1816
1857
|
uiAuthController = bootstrapResult.uiAuthController;
|
|
1817
1858
|
realtimeProxyRuntime = attachRealtimeProxy({
|
|
@@ -1903,6 +1944,7 @@ async function main(options = {}) {
|
|
|
1903
1944
|
createFsSearchRuntime: createFsSearchRuntimeFactory,
|
|
1904
1945
|
openchamberDataDir: OPENCHAMBER_DATA_DIR,
|
|
1905
1946
|
openchamberUserConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
1947
|
+
managedChatsRoot: OPENCHAMBER_CHATS_DIR,
|
|
1906
1948
|
normalizeDirectoryPath,
|
|
1907
1949
|
resolveProjectDirectory,
|
|
1908
1950
|
resolveOptionalProjectDirectory,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Release notes for the update dialog.
|
|
2
|
+
//
|
|
3
|
+
// The repo publishes `changelog/index.json` on `main`: one object per release,
|
|
4
|
+
// newest first, with the app notes grouped as New / Improvements / Fixes /
|
|
5
|
+
// Misc. This module fetches it and renders the releases between the installed
|
|
6
|
+
// version (exclusive) and the offered one (inclusive) as the Markdown the
|
|
7
|
+
// dialog already understands: a `## [x.y.z] - YYYY-MM-DD` header per release,
|
|
8
|
+
// the release title in bold, the intro, then the groups.
|
|
9
|
+
//
|
|
10
|
+
// Any failure (network, 404, unexpected shape) yields null: the update is
|
|
11
|
+
// still offered, only without notes.
|
|
12
|
+
|
|
13
|
+
export const CHANGELOG_INDEX_URL = 'https://raw.githubusercontent.com/openchamber/openchamber/main/changelog/index.json';
|
|
14
|
+
|
|
15
|
+
const GROUPS = [
|
|
16
|
+
['new', 'New'],
|
|
17
|
+
['improvements', 'Improvements'],
|
|
18
|
+
['fixes', 'Fixes'],
|
|
19
|
+
['misc', 'Misc'],
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const VERSION_PATTERN = /^\d+\.\d+\.\d+$/;
|
|
23
|
+
const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
24
|
+
|
|
25
|
+
// The file crosses a network boundary with no schema library on this side, so
|
|
26
|
+
// each field is coerced into its domain shape here; a release without a valid
|
|
27
|
+
// version and date is dropped.
|
|
28
|
+
const text = (value) => (value === null || value === undefined ? null : String(value).trim() || null);
|
|
29
|
+
const bulletList = (value) => (Array.isArray(value) ? value.map((item) => String(item)) : []);
|
|
30
|
+
|
|
31
|
+
const parseRelease = (entry) => {
|
|
32
|
+
if (entry === null || entry === undefined) return null;
|
|
33
|
+
const version = text(entry.version);
|
|
34
|
+
const date = text(entry.date);
|
|
35
|
+
if (!version || !VERSION_PATTERN.test(version) || !date || !DATE_PATTERN.test(date)) return null;
|
|
36
|
+
const app = entry.app ?? {};
|
|
37
|
+
return {
|
|
38
|
+
version,
|
|
39
|
+
date,
|
|
40
|
+
title: text(entry.title),
|
|
41
|
+
intro: text(entry.intro),
|
|
42
|
+
groups: GROUPS.map(([key, heading]) => ({ heading, bullets: bulletList(app[key]) })),
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const renderRelease = (release) => {
|
|
47
|
+
const lines = [`## [${release.version}] - ${release.date}`, ''];
|
|
48
|
+
if (release.title) lines.push(`**${release.title}**`, '');
|
|
49
|
+
if (release.intro) lines.push(release.intro, '');
|
|
50
|
+
for (const { heading, bullets } of release.groups) {
|
|
51
|
+
if (bullets.length === 0) continue;
|
|
52
|
+
lines.push(`### ${heading}`, '', ...bullets.map((bullet) => `- ${bullet}`), '');
|
|
53
|
+
}
|
|
54
|
+
return lines.join('\n').trim();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Markdown for the releases in (fromVersion, toVersion], newest first, or
|
|
59
|
+
* null when the index holds none of them.
|
|
60
|
+
*/
|
|
61
|
+
export function renderUpdateNotes(index, fromVersion, toVersion, compareVersions) {
|
|
62
|
+
if (!Array.isArray(index)) return null;
|
|
63
|
+
const relevant = index
|
|
64
|
+
.map(parseRelease)
|
|
65
|
+
.filter((release) => release !== null)
|
|
66
|
+
.filter((release) => compareVersions(release.version, fromVersion) > 0 && compareVersions(release.version, toVersion) <= 0)
|
|
67
|
+
.sort((a, b) => compareVersions(b.version, a.version));
|
|
68
|
+
if (relevant.length === 0) return null;
|
|
69
|
+
return relevant.map(renderRelease).join('\n\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Fetch the index and render the notes for one update; null on any failure. */
|
|
73
|
+
export async function fetchUpdateNotes(fromVersion, toVersion, compareVersions, options = {}) {
|
|
74
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetchImpl(CHANGELOG_INDEX_URL, { signal: AbortSignal.timeout(options.timeoutMs ?? 10_000) });
|
|
77
|
+
if (!response.ok) return null;
|
|
78
|
+
return renderUpdateNotes(await response.json(), fromVersion, toVersion, compareVersions);
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { fetchUpdateNotes, renderUpdateNotes } from './update-notes.js';
|
|
3
|
+
|
|
4
|
+
const compare = (a, b) => {
|
|
5
|
+
const pa = a.split('.').map(Number);
|
|
6
|
+
const pb = b.split('.').map(Number);
|
|
7
|
+
for (let i = 0; i < 3; i += 1) if (pa[i] !== pb[i]) return pa[i] - pb[i];
|
|
8
|
+
return 0;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const index = [
|
|
12
|
+
{ version: '1.2.3', date: '2026-03-03', title: 'Comments everywhere', intro: 'A short intro.', app: { new: ['**Comments:** on code.'], improvements: [], fixes: ['Chat: no freeze.'], misc: [] }, vscode: null },
|
|
13
|
+
{ version: '1.2.2', date: '2026-03-02', title: null, intro: null, app: { new: [], improvements: ['Faster.'], fixes: [], misc: [] }, vscode: null },
|
|
14
|
+
{ version: '1.2.1', date: '2026-03-01', title: 'Old', intro: null, app: { new: ['Older.'], improvements: [], fixes: [], misc: [] }, vscode: null },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
describe('renderUpdateNotes', () => {
|
|
18
|
+
it('renders the releases after the installed version up to the offered one, newest first', () => {
|
|
19
|
+
expect(renderUpdateNotes(index, '1.2.1', '1.2.3', compare)).toBe(`## [1.2.3] - 2026-03-03
|
|
20
|
+
|
|
21
|
+
**Comments everywhere**
|
|
22
|
+
|
|
23
|
+
A short intro.
|
|
24
|
+
|
|
25
|
+
### New
|
|
26
|
+
|
|
27
|
+
- **Comments:** on code.
|
|
28
|
+
|
|
29
|
+
### Fixes
|
|
30
|
+
|
|
31
|
+
- Chat: no freeze.
|
|
32
|
+
|
|
33
|
+
## [1.2.2] - 2026-03-02
|
|
34
|
+
|
|
35
|
+
### Improvements
|
|
36
|
+
|
|
37
|
+
- Faster.`);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('returns null when nothing lies in the range or the payload is not an index', () => {
|
|
41
|
+
expect(renderUpdateNotes(index, '1.2.3', '1.2.3', compare)).toBe(null);
|
|
42
|
+
expect(renderUpdateNotes({ entries: [] }, '1.0.0', '9.9.9', compare)).toBe(null);
|
|
43
|
+
expect(renderUpdateNotes([{ version: 'nope' }, { version: '1.2.2', date: '2026' }], '1.0.0', '9.9.9', compare)).toBe(null);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('fetchUpdateNotes', () => {
|
|
48
|
+
it('turns a failed request or a thrown fetch into null', async () => {
|
|
49
|
+
const notFound = async () => ({ ok: false });
|
|
50
|
+
expect(await fetchUpdateNotes('1.0.0', '2.0.0', compare, { fetch: notFound })).toBe(null);
|
|
51
|
+
const throwing = async () => { throw new Error('offline'); };
|
|
52
|
+
expect(await fetchUpdateNotes('1.0.0', '2.0.0', compare, { fetch: throwing })).toBe(null);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('renders a successful response', async () => {
|
|
56
|
+
const ok = async () => ({ ok: true, json: async () => index });
|
|
57
|
+
expect(await fetchUpdateNotes('1.2.2', '1.2.3', compare, { fetch: ok })).toMatch(/^## \[1\.2\.3\] - 2026-03-03\n\n\*\*Comments everywhere\*\*/);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// One-time copy of the user-authored folders into a custom data directory.
|
|
2
|
+
//
|
|
3
|
+
// `OPENCHAMBER_DATA_DIR` is documented as "the OpenChamber data directory",
|
|
4
|
+
// but for a long time only the flat files (settings, auth, push tokens)
|
|
5
|
+
// followed it while `projects/`, `themes/`, and `speech-models/` stayed under
|
|
6
|
+
// `~/.config/openchamber`. Now every folder hangs off the data directory, so an
|
|
7
|
+
// instance that already ran with a custom directory finds those folders in
|
|
8
|
+
// the old place. This copies each one over once: only when the new location
|
|
9
|
+
// does not exist yet and the old one does. It copies rather than moves
|
|
10
|
+
// because a second instance on the same machine (a custom directory next to
|
|
11
|
+
// the default one) must not strip the default instance of its projects.
|
|
12
|
+
|
|
13
|
+
const USER_DIR_ENTRIES = Object.freeze(['projects', 'themes', 'speech-models']);
|
|
14
|
+
|
|
15
|
+
const exists = async (fsPromises, target) => fsPromises.access(target).then(() => true, () => false);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copy the user folders from `legacyRoot` into `dataDir`. Returns the entries
|
|
19
|
+
* copied. A no-op when the two roots are the same directory. A folder whose
|
|
20
|
+
* copy fails is reported through `warn` and its partial copy removed; the
|
|
21
|
+
* server keeps starting, reading the (empty) new location.
|
|
22
|
+
*/
|
|
23
|
+
export const migrateLegacyUserDirs = async ({ fsPromises, path, dataDir, legacyRoot, warn = () => {}, entries = USER_DIR_ENTRIES }) => {
|
|
24
|
+
if (path.resolve(dataDir) === path.resolve(legacyRoot)) return [];
|
|
25
|
+
const moved = [];
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
const from = path.join(legacyRoot, entry);
|
|
28
|
+
const to = path.join(dataDir, entry);
|
|
29
|
+
if (await exists(fsPromises, to) || !(await exists(fsPromises, from))) continue;
|
|
30
|
+
try {
|
|
31
|
+
await fsPromises.mkdir(dataDir, { recursive: true });
|
|
32
|
+
await fsPromises.cp(from, to, { recursive: true, errorOnExist: true, force: false });
|
|
33
|
+
moved.push(entry);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
await fsPromises.rm(to, { recursive: true, force: true }).catch(() => {});
|
|
36
|
+
warn(`Failed to copy ${from} to ${to}: ${error instanceof Error ? error.message : String(error)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return moved;
|
|
40
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fsPromises from 'fs/promises';
|
|
5
|
+
|
|
6
|
+
import { migrateLegacyUserDirs } from './data-dir-migration.js';
|
|
7
|
+
|
|
8
|
+
const setup = async () => {
|
|
9
|
+
const root = await fsPromises.mkdtemp(path.join(os.tmpdir(), 'oc-data-dir-'));
|
|
10
|
+
const legacyRoot = path.join(root, 'legacy');
|
|
11
|
+
const dataDir = path.join(root, 'custom');
|
|
12
|
+
await fsPromises.mkdir(path.join(legacyRoot, 'projects'), { recursive: true });
|
|
13
|
+
await fsPromises.writeFile(path.join(legacyRoot, 'projects', 'p.json'), '{"a":1}');
|
|
14
|
+
await fsPromises.mkdir(path.join(legacyRoot, 'themes'), { recursive: true });
|
|
15
|
+
return { root, legacyRoot, dataDir, cleanup: () => fsPromises.rm(root, { recursive: true, force: true }) };
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('migrateLegacyUserDirs', () => {
|
|
19
|
+
it('copies the user folders once into a custom data dir and leaves the originals', async () => {
|
|
20
|
+
const { legacyRoot, dataDir, cleanup } = await setup();
|
|
21
|
+
try {
|
|
22
|
+
const warnings = [];
|
|
23
|
+
const moved = await migrateLegacyUserDirs({ fsPromises, path, dataDir, legacyRoot, warn: (message) => warnings.push(message) });
|
|
24
|
+
expect(moved).toEqual(['projects', 'themes']);
|
|
25
|
+
expect(warnings).toEqual([]);
|
|
26
|
+
expect(await fsPromises.readFile(path.join(dataDir, 'projects', 'p.json'), 'utf8')).toBe('{"a":1}');
|
|
27
|
+
// The default instance keeps its own copy: a second instance must not strip it.
|
|
28
|
+
expect(await fsPromises.readFile(path.join(legacyRoot, 'projects', 'p.json'), 'utf8')).toBe('{"a":1}');
|
|
29
|
+
// A second start copies nothing more.
|
|
30
|
+
expect(await migrateLegacyUserDirs({ fsPromises, path, dataDir, legacyRoot })).toEqual([]);
|
|
31
|
+
} finally {
|
|
32
|
+
await cleanup();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('never merges into a folder that already exists in the data dir', async () => {
|
|
37
|
+
const { legacyRoot, dataDir, cleanup } = await setup();
|
|
38
|
+
try {
|
|
39
|
+
await fsPromises.mkdir(path.join(dataDir, 'projects'), { recursive: true });
|
|
40
|
+
await fsPromises.writeFile(path.join(dataDir, 'projects', 'q.json'), '{}');
|
|
41
|
+
const moved = await migrateLegacyUserDirs({ fsPromises, path, dataDir, legacyRoot });
|
|
42
|
+
expect(moved).toEqual(['themes']);
|
|
43
|
+
expect(await fsPromises.readdir(path.join(dataDir, 'projects'))).toEqual(['q.json']);
|
|
44
|
+
expect(await fsPromises.readdir(path.join(legacyRoot, 'projects'))).toEqual(['p.json']);
|
|
45
|
+
} finally {
|
|
46
|
+
await cleanup();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('is a no-op when the data dir is the default root', async () => {
|
|
51
|
+
const { legacyRoot, cleanup } = await setup();
|
|
52
|
+
try {
|
|
53
|
+
expect(await migrateLegacyUserDirs({ fsPromises, path, dataDir: legacyRoot, legacyRoot })).toEqual([]);
|
|
54
|
+
expect(await fsPromises.readdir(path.join(legacyRoot, 'projects'))).toEqual(['p.json']);
|
|
55
|
+
} finally {
|
|
56
|
+
await cleanup();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -446,18 +446,18 @@ describe('message stream websocket runtime', () => {
|
|
|
446
446
|
const socket = new FakeSocket();
|
|
447
447
|
runtime.wsServer.emit('connection', socket, { url: '/api/global/event/ws' });
|
|
448
448
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
449
|
+
try {
|
|
450
|
+
// Wait for the reconnect event itself; a 35ms sleep raced the event
|
|
451
|
+
// loop when the workspace build and test workers ran together.
|
|
452
|
+
await expect.poll(() => socket.sent.filter((frame) => frame.type === 'ready').length).toBeGreaterThanOrEqual(2);
|
|
453
|
+
const eventFrames = socket.sent.filter((frame) => frame.type === 'event' && frame.payload?.type === 'server.connected');
|
|
454
|
+
expect(eventFrames.length).toBeGreaterThanOrEqual(2);
|
|
455
|
+
expect(fetchCalls.slice(0, 2)).toEqual([null, 'evt-1']);
|
|
456
|
+
expect(triggerHealthCheckCalls).toBe(0);
|
|
457
|
+
} finally {
|
|
458
|
+
socket.close();
|
|
459
|
+
await runtime.close();
|
|
460
|
+
}
|
|
461
461
|
});
|
|
462
462
|
|
|
463
463
|
it('keeps synthetic event processing on forwarded upstream events', async () => {
|
|
@@ -14,6 +14,8 @@ Own filesystem API behavior for the web server runtime, including workspace-boun
|
|
|
14
14
|
- `POST /api/fs/mkdir`
|
|
15
15
|
- `GET /api/fs/read`
|
|
16
16
|
- `GET /api/fs/raw`
|
|
17
|
+
- `GET /api/fs/stat`
|
|
18
|
+
- `GET /api/fs/directory-stat`
|
|
17
19
|
- `GET /api/fs/serve/:path(*)`
|
|
18
20
|
- `POST /api/fs/write`
|
|
19
21
|
- `POST /api/fs/upload`
|
|
@@ -40,7 +42,10 @@ Own filesystem API behavior for the web server runtime, including workspace-boun
|
|
|
40
42
|
|
|
41
43
|
## Notes for contributors
|
|
42
44
|
- Keep filesystem policy (workspace root checks, error mapping, exec timeout behavior) inside this module, not in the composition root.
|
|
45
|
+
- Workspace checks accept, besides the active workspace and its worktrees, the **managed roots**: the OpenChamber config root and the managed chats root (`managedChatsRoot` dependency; `OPENCHAMBER_CHATS_DIR` upstream, default `<config root>/chats`). Chat worktrees may legitimately live outside every project workspace.
|
|
46
|
+
- `GET /api/fs/home` answers `{ home, chatsRoot }`. `chatsRoot` is the server-resolved managed chats root; clients must use it instead of joining `home` + the well-known segment (a relocated root does not contain that segment).
|
|
43
47
|
- Filesystem `EPERM`/`EACCES` failures use the stable `reason: "os-permission"` response marker. Policy denials such as workspace-boundary or missing-grant failures must not use that marker because a native folder picker cannot remediate them.
|
|
48
|
+
- `GET /api/fs/directory-stat?path=...` uses one `stat` without listing contents or resolving project topology. It follows the same authenticated directory-discovery path policy as `/api/fs/list`, including targets outside the active workspace. A directory returns `{ isDirectory: true }`; `ENOENT` returns `not-found`, and a file or `ENOTDIR` returns `not-directory`. Permission and other failures remain distinct from a missing path. VS Code explicitly returns 501, so the shared client treats its probe as unknown.
|
|
44
49
|
- Read-only routes authorize the requested path against the workspace before resolving symlinks. A symlink reached through the workspace may therefore target a file outside it, while a directly requested outside path still requires an exact-path grant. Write routes keep canonical-target boundary checks.
|
|
45
50
|
- If adding new `/api/fs/*` endpoints, add them in `routes.js` and extend this document.
|
|
46
51
|
- `GET /api/fs/list` may resolve symlinks with `realpath` to read directory contents, but the response `path` and each entry `path` must stay in the caller's requested path space (`path.join(requestedPath, name)`). Returning real paths breaks file-tree expansion for directories reached through workspace symlinks.
|