@openchamber/web 1.22.1 → 1.22.2
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 +4 -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-BI-TY1UG.js} +1 -1
- package/dist/assets/{DiffView-CNnDxRmO.js → DiffView-cOmByCaX.js} +3 -3
- package/dist/assets/{DirtyBranchSwitchDialog-jADfXQnR.js → DirtyBranchSwitchDialog-BwSnDlNy.js} +1 -1
- package/dist/assets/FilesView-DRRy_6oZ.js +17 -0
- package/dist/assets/{GitView-Cv2xH-S6.js → GitView-B7YCg1YM.js} +4 -4
- package/dist/assets/{JsonTreeView-DUiIpERC.js → JsonTreeView-CjzNsiIU.js} +1 -1
- package/dist/assets/{LinearIssuesView-CoZ7pQN5.js → LinearIssuesView-BYlE0YrW.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-DffjmciG.js → MarkdownImageGallery-DlTF-wua.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-CqgeZRlP.js +12 -0
- package/dist/assets/{OnboardingScreen-CTZe6HZn.js → OnboardingScreen-BsJU7oav.js} +1 -1
- package/dist/assets/{PatchDiff-BymkP9JA.js → PatchDiff-CDNu968J.js} +1 -1
- package/dist/assets/{PierreDiffViewer-BvwtCxW4.js → PierreDiffViewer-BoBsAanf.js} +1 -1
- package/dist/assets/{PlanView-C1qvAm7m.js → PlanView-Cxr8LQT1.js} +4 -4
- package/dist/assets/SettingsView-bsKpCZbB.js +28 -0
- package/dist/assets/{SettingsWindow-COzgfFxM.js → SettingsWindow-B0rHQdw4.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Dlhh_-oe.js → ToolOutputDialog-6zP8hwzX.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-b9joNtXH.js → ToolPartDiffPreview-Bvwh4Y31.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-vqW3KKo5.js → VirtualizedFileDiff-aaIfrRxl.js} +1 -1
- package/dist/assets/{WalkthroughView-D-HFgdmM.js → WalkthroughView-baZ0ssy9.js} +2 -2
- package/dist/assets/{computeVirtualFileMetrics-DUnyszhW.js → computeVirtualFileMetrics-DfgllYQc.js} +2 -2
- package/dist/assets/{contextPanelEmbeddedChat-CV-DwAiX.js → contextPanelEmbeddedChat-prHos-tt.js} +1 -1
- package/dist/assets/{de-Cv_4FoXm.js → de-hknQLFxa.js} +2 -2
- package/dist/assets/{es-BIWNEbnS.js → es-C_bD3kvW.js} +2 -2
- package/dist/assets/{fr-SD3OfMHJ.js → fr-BVF-C2Nu.js} +2 -2
- package/dist/assets/index-B0aX0JeI.js +39 -0
- package/dist/assets/{index-DLiD86ge.js → index-DUwZ2cWA.js} +1 -1
- package/dist/assets/index-Dl3xbAB_.css +1 -0
- package/dist/assets/{isDiffPlainText-TNageFjy.js → isDiffPlainText-COIS9Df5.js} +1 -1
- package/dist/assets/{isFilePlainText-JPmZOYSp.js → isFilePlainText-D7LEG-KY.js} +1 -1
- package/dist/assets/{ja-D7I9HofF.js → ja-B2G5hD59.js} +2 -2
- package/dist/assets/{ko-BsVJM_PQ.js → ko-D6OrOdZ3.js} +2 -2
- package/dist/assets/main-BBuBZzoi.js +930 -0
- package/dist/assets/{main-DCB4JgVe.js → main-CwIEELQq.js} +2 -2
- package/dist/assets/{markdownCore-BoQVG5-a.js → markdownCore-BE_Hhps5.js} +2 -2
- package/dist/assets/{miniChat-BtV7N5OF.js → miniChat-CeXAoWiF.js} +2 -2
- package/dist/assets/{mobile-DZV_sfX7.js → mobile-ilq39yLQ.js} +2 -2
- package/dist/assets/{patchFileDiff-Chmiz6hq.js → patchFileDiff-DLky6SYr.js} +5 -5
- package/dist/assets/{pl-XR9Bs8Be.js → pl-CVroZXt1.js} +2 -2
- package/dist/assets/{pt-BR-Due4be8g.js → pt-BR-eH3onaIW.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-8tXADjfl.js → renderElectronMiniChatApp-BsywqmJT.js} +2 -2
- package/dist/assets/{renderMobileApp-Cji7Hma5.js → renderMobileApp-CDun1795.js} +7 -7
- package/dist/assets/runtimeEndpointReset-DebJIo5U.js +17 -0
- package/dist/assets/{scheduledTasksApi-9e-UX6im.js → scheduledTasksApi-B0tChXQC.js} +1 -1
- package/dist/assets/{shikiHighlight-CRpCl7UT.js → shikiHighlight-DJSXdcG4.js} +1 -1
- package/dist/assets/tr-BvtU2tXS.js +7 -0
- package/dist/assets/{uk-COYh2BaN.js → uk-nu36iqFz.js} +2 -2
- package/dist/assets/{useAppFontEffects-CCgvcQ6u.js → useAppFontEffects-Bb1Zihd2.js} +134 -131
- package/dist/assets/useInlineCommentController-B8dQWRpH.js +2 -0
- package/dist/assets/{useRootScrollLock-KzOUytpn.js → useRootScrollLock-DrJ8gE-x.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BxpoC5Fp.js → vendor-codemirror-language-data-CNjvbb69.js} +2 -2
- package/dist/assets/vendor-zod-CK21ihK-.js +39 -0
- package/dist/assets/{web-components-B6QgbmTo.js → web-components-C06MmTcR.js} +1 -1
- package/dist/assets/{zh-CN-Cjk6lzhc.js → zh-CN-BClBzZ64.js} +2 -2
- package/dist/assets/{zh-TW-Dk0dOg03.js → zh-TW-CXtSqJHF.js} +2 -2
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +3 -3
- package/server/index.js +7 -1
- package/server/lib/changelog/update-notes.js +82 -0
- package/server/lib/changelog/update-notes.test.js +59 -0
- package/server/lib/fs/DOCUMENTATION.md +2 -0
- package/server/lib/fs/routes.js +32 -21
- package/server/lib/fs/routes.test.js +77 -0
- package/server/lib/git/service.js +10 -0
- package/server/lib/git/service.test.js +18 -0
- package/server/lib/message-queue/DOCUMENTATION.md +17 -7
- package/server/lib/message-queue/runtime.js +59 -7
- package/server/lib/message-queue/runtime.test.js +59 -3
- package/server/lib/opencode/DOCUMENTATION.md +8 -4
- package/server/lib/opencode/config-paths.test.js +116 -0
- package/server/lib/opencode/feature-routes-runtime.js +2 -0
- package/server/lib/opencode/input-history-scope.js +14 -0
- 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 +4 -4
- package/server/lib/opencode/server-startup-runtime.js +1 -1
- package/server/lib/opencode/settings-helpers.js +28 -0
- package/server/lib/opencode/settings-helpers.test.js +177 -0
- 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/quota/utils/auth.js +1 -1
- package/server/lib/relay/host-client.test.js +9 -1
- package/server/lib/session-goal/DOCUMENTATION.md +20 -7
- package/server/lib/session-goal/runtime.js +76 -11
- 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/terminal/DOCUMENTATION.md +11 -7
- package/server/lib/terminal/runtime.js +150 -19
- package/server/lib/terminal/runtime.test.js +553 -26
- package/server/lib/terminal/shells.js +17 -0
- package/server/lib/terminal/shells.test.js +32 -1
- package/server/lib/walkthrough/routes.test.js +26 -5
- package/dist/assets/FilesView-8wdiG2mj.js +0 -17
- package/dist/assets/MarkdownRendererImpl-DxqdYDAx.js +0 -12
- package/dist/assets/SettingsView-xGONHFGS.js +0 -28
- package/dist/assets/index-CHUT_bDS.css +0 -1
- package/dist/assets/index-DDInLQDd.js +0 -40
- package/dist/assets/main-De8Z5w49.js +0 -928
- package/dist/assets/runtimeEndpointReset-gWt3Lb5D.js +0 -16
- package/dist/assets/tr-DBJcAv4y.js +0 -7
- package/dist/assets/useInlineCommentController-BkfXnjNZ.js +0 -2
- package/dist/assets/vendor-zod-DVWEh-IS.js +0 -39
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-CwIEELQq.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-CK21ihK-.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-B0aX0JeI.js">
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-prHos-tt.js">
|
|
521
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dl3xbAB_.css">
|
|
522
522
|
</head>
|
|
523
523
|
<body class="h-full bg-background text-foreground">
|
|
524
524
|
<div id="root" class="h-full">
|
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-CeXAoWiF.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-CK21ihK-.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-B0aX0JeI.js">
|
|
85
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dl3xbAB_.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-ilq39yLQ.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-CK21ihK-.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-B0aX0JeI.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dl3xbAB_.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.22.
|
|
3
|
+
"version": "1.22.2",
|
|
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.29",
|
|
29
29
|
"@simplewebauthn/server": "13.3.1",
|
|
30
30
|
"bun-pty": "^0.4.5",
|
|
31
31
|
"compression": "^1.8.1",
|
package/server/index.js
CHANGED
|
@@ -269,6 +269,11 @@ const sanitizeProjects = (...args) => settingsNormalizationRuntime.sanitizeProje
|
|
|
269
269
|
const OPENCHAMBER_USER_CONFIG_ROOT = path.join(os.homedir(), '.config', 'openchamber');
|
|
270
270
|
const OPENCHAMBER_USER_THEMES_DIR = path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'themes');
|
|
271
271
|
const OPENCHAMBER_PROJECTS_CONFIG_DIR = path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'projects');
|
|
272
|
+
// OPENCHAMBER_CHATS_DIR relocates managed chat worktrees — needed when the
|
|
273
|
+
// OpenCode server runs as a separate user that cannot traverse $HOME.
|
|
274
|
+
const OPENCHAMBER_CHATS_DIR = process.env.OPENCHAMBER_CHATS_DIR && process.env.OPENCHAMBER_CHATS_DIR.trim()
|
|
275
|
+
? path.resolve(process.env.OPENCHAMBER_CHATS_DIR.trim())
|
|
276
|
+
: path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats');
|
|
272
277
|
|
|
273
278
|
const MAX_THEME_JSON_BYTES = 512 * 1024;
|
|
274
279
|
|
|
@@ -1315,7 +1320,7 @@ const resolveMemoryProjectId = createMemoryProjectResolver({
|
|
|
1315
1320
|
return sanitizeProjects(settings?.projects || []).map((project) => project.path);
|
|
1316
1321
|
},
|
|
1317
1322
|
resolvePrimaryWorktreeRoot,
|
|
1318
|
-
managedProjectRoots: [path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats')],
|
|
1323
|
+
managedProjectRoots: [...new Set([path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats'), OPENCHAMBER_CHATS_DIR])],
|
|
1319
1324
|
});
|
|
1320
1325
|
|
|
1321
1326
|
/**
|
|
@@ -1903,6 +1908,7 @@ async function main(options = {}) {
|
|
|
1903
1908
|
createFsSearchRuntime: createFsSearchRuntimeFactory,
|
|
1904
1909
|
openchamberDataDir: OPENCHAMBER_DATA_DIR,
|
|
1905
1910
|
openchamberUserConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
1911
|
+
managedChatsRoot: OPENCHAMBER_CHATS_DIR,
|
|
1906
1912
|
normalizeDirectoryPath,
|
|
1907
1913
|
resolveProjectDirectory,
|
|
1908
1914
|
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
|
+
});
|
|
@@ -40,6 +40,8 @@ Own filesystem API behavior for the web server runtime, including workspace-boun
|
|
|
40
40
|
|
|
41
41
|
## Notes for contributors
|
|
42
42
|
- Keep filesystem policy (workspace root checks, error mapping, exec timeout behavior) inside this module, not in the composition root.
|
|
43
|
+
- 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.
|
|
44
|
+
- `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
45
|
- 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.
|
|
44
46
|
- 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
47
|
- If adding new `/api/fs/*` endpoints, add them in `routes.js` and extend this document.
|
package/server/lib/fs/routes.js
CHANGED
|
@@ -196,7 +196,7 @@ const isPathWithinRoot = (resolvedPath, rootPath, path, os) => {
|
|
|
196
196
|
return true;
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
-
const resolveWorkspacePath = ({ targetPath, baseDirectory, path, os, normalizeDirectoryPath,
|
|
199
|
+
const resolveWorkspacePath = ({ targetPath, baseDirectory, path, os, normalizeDirectoryPath, managedRoots }) => {
|
|
200
200
|
const normalized = normalizeDirectoryPath(targetPath);
|
|
201
201
|
if (!normalized || typeof normalized !== 'string') {
|
|
202
202
|
return { ok: false, error: 'Path is required' };
|
|
@@ -209,8 +209,12 @@ const resolveWorkspacePath = ({ targetPath, baseDirectory, path, os, normalizeDi
|
|
|
209
209
|
return { ok: true, base: resolvedBase, resolved };
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
// Managed roots (config root, relocated chats root) stay valid targets
|
|
213
|
+
// even outside the active workspace.
|
|
214
|
+
for (const root of managedRoots) {
|
|
215
|
+
if (isPathWithinRoot(resolved, root, path, os)) {
|
|
216
|
+
return { ok: true, base: path.resolve(root), resolved };
|
|
217
|
+
}
|
|
214
218
|
}
|
|
215
219
|
|
|
216
220
|
return { ok: false, error: 'Path is outside of active workspace' };
|
|
@@ -249,7 +253,7 @@ const resolveWorkspacePathFromWorktrees = async ({ targetPath, baseDirectory, pa
|
|
|
249
253
|
return { ok: false, error: 'Path is outside of active workspace' };
|
|
250
254
|
};
|
|
251
255
|
|
|
252
|
-
const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProjectDirectory, path, os, normalizeDirectoryPath,
|
|
256
|
+
const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProjectDirectory, path, os, normalizeDirectoryPath, managedRoots }) => {
|
|
253
257
|
const resolvedProject = await resolveProjectDirectory(req);
|
|
254
258
|
if (!resolvedProject.directory) {
|
|
255
259
|
return { ok: false, error: resolvedProject.error || 'Active workspace is required' };
|
|
@@ -261,7 +265,7 @@ const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProject
|
|
|
261
265
|
path,
|
|
262
266
|
os,
|
|
263
267
|
normalizeDirectoryPath,
|
|
264
|
-
|
|
268
|
+
managedRoots,
|
|
265
269
|
});
|
|
266
270
|
if (resolved.ok || resolved.error !== 'Path is outside of active workspace') {
|
|
267
271
|
return resolved;
|
|
@@ -281,7 +285,7 @@ const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProject
|
|
|
281
285
|
path,
|
|
282
286
|
os,
|
|
283
287
|
normalizeDirectoryPath,
|
|
284
|
-
|
|
288
|
+
managedRoots,
|
|
285
289
|
});
|
|
286
290
|
if (lexical.ok) {
|
|
287
291
|
return lexical;
|
|
@@ -412,7 +416,7 @@ const escapeCloneSshKeyPath = (sshKeyPath) => {
|
|
|
412
416
|
return `'${normalized.replace(/'/g, "'\\''")}'`;
|
|
413
417
|
};
|
|
414
418
|
|
|
415
|
-
const resolveReadPathFromContext = async ({ req, targetPath, scope, resolveProjectDirectory, path, os, fsPromises, normalizeDirectoryPath,
|
|
419
|
+
const resolveReadPathFromContext = async ({ req, targetPath, scope, resolveProjectDirectory, path, os, fsPromises, normalizeDirectoryPath, managedRoots }) => {
|
|
416
420
|
if (req.query?.allowOutsideWorkspace === 'true') {
|
|
417
421
|
const normalized = normalizeDirectoryPath(targetPath);
|
|
418
422
|
if (!normalized || typeof normalized !== 'string') {
|
|
@@ -434,7 +438,7 @@ const resolveReadPathFromContext = async ({ req, targetPath, scope, resolveProje
|
|
|
434
438
|
path,
|
|
435
439
|
os,
|
|
436
440
|
normalizeDirectoryPath,
|
|
437
|
-
|
|
441
|
+
managedRoots,
|
|
438
442
|
});
|
|
439
443
|
};
|
|
440
444
|
|
|
@@ -520,7 +524,14 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
520
524
|
buildAugmentedPath,
|
|
521
525
|
resolveGitBinaryForSpawn,
|
|
522
526
|
openchamberUserConfigRoot,
|
|
527
|
+
managedChatsRoot,
|
|
523
528
|
} = dependencies;
|
|
529
|
+
// Chat worktrees may live outside every project workspace; both managed
|
|
530
|
+
// roots stay valid filesystem targets.
|
|
531
|
+
const chatsRoot = typeof managedChatsRoot === 'string' && managedChatsRoot.trim()
|
|
532
|
+
? path.resolve(managedChatsRoot.trim())
|
|
533
|
+
: path.join(openchamberUserConfigRoot, 'chats');
|
|
534
|
+
const managedRoots = [path.resolve(openchamberUserConfigRoot), chatsRoot];
|
|
524
535
|
const realpathCache = createRealpathCache({
|
|
525
536
|
realpath: fsPromises.realpath.bind(fsPromises),
|
|
526
537
|
});
|
|
@@ -699,7 +710,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
699
710
|
if (!home || typeof home !== 'string' || home.length === 0) {
|
|
700
711
|
return res.status(500).json({ error: 'Failed to resolve home directory' });
|
|
701
712
|
}
|
|
702
|
-
return res.json({ home });
|
|
713
|
+
return res.json({ home, chatsRoot });
|
|
703
714
|
} catch (error) {
|
|
704
715
|
console.error('Failed to resolve home directory:', error);
|
|
705
716
|
return res.status(500).json({ error: (error && error.message) || 'Failed to resolve home directory' });
|
|
@@ -725,7 +736,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
725
736
|
path,
|
|
726
737
|
os,
|
|
727
738
|
normalizeDirectoryPath,
|
|
728
|
-
|
|
739
|
+
managedRoots,
|
|
729
740
|
});
|
|
730
741
|
if (!resolved.ok) {
|
|
731
742
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -870,7 +881,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
870
881
|
os,
|
|
871
882
|
fsPromises,
|
|
872
883
|
normalizeDirectoryPath,
|
|
873
|
-
|
|
884
|
+
managedRoots,
|
|
874
885
|
});
|
|
875
886
|
if (!resolved.ok) {
|
|
876
887
|
if (req.query?.allowOutsideWorkspace === 'true') {
|
|
@@ -920,7 +931,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
920
931
|
os,
|
|
921
932
|
fsPromises,
|
|
922
933
|
normalizeDirectoryPath,
|
|
923
|
-
|
|
934
|
+
managedRoots,
|
|
924
935
|
});
|
|
925
936
|
if (!resolved.ok) {
|
|
926
937
|
if (req.query?.allowOutsideWorkspace === 'true') {
|
|
@@ -984,7 +995,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
984
995
|
os,
|
|
985
996
|
fsPromises,
|
|
986
997
|
normalizeDirectoryPath,
|
|
987
|
-
|
|
998
|
+
managedRoots,
|
|
988
999
|
});
|
|
989
1000
|
if (!resolved.ok) {
|
|
990
1001
|
if (req.query?.allowOutsideWorkspace === 'true') {
|
|
@@ -1065,7 +1076,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1065
1076
|
path,
|
|
1066
1077
|
os,
|
|
1067
1078
|
normalizeDirectoryPath,
|
|
1068
|
-
|
|
1079
|
+
managedRoots,
|
|
1069
1080
|
});
|
|
1070
1081
|
if (!resolved.ok) {
|
|
1071
1082
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -1117,7 +1128,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1117
1128
|
path,
|
|
1118
1129
|
os,
|
|
1119
1130
|
normalizeDirectoryPath,
|
|
1120
|
-
|
|
1131
|
+
managedRoots,
|
|
1121
1132
|
});
|
|
1122
1133
|
if (!resolved.ok) {
|
|
1123
1134
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -1187,7 +1198,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1187
1198
|
path,
|
|
1188
1199
|
os,
|
|
1189
1200
|
normalizeDirectoryPath,
|
|
1190
|
-
|
|
1201
|
+
managedRoots,
|
|
1191
1202
|
});
|
|
1192
1203
|
if (!resolved.ok) {
|
|
1193
1204
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -1294,7 +1305,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1294
1305
|
path,
|
|
1295
1306
|
os,
|
|
1296
1307
|
normalizeDirectoryPath,
|
|
1297
|
-
|
|
1308
|
+
managedRoots,
|
|
1298
1309
|
});
|
|
1299
1310
|
if (!resolved.ok) {
|
|
1300
1311
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -1332,7 +1343,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1332
1343
|
path,
|
|
1333
1344
|
os,
|
|
1334
1345
|
normalizeDirectoryPath,
|
|
1335
|
-
|
|
1346
|
+
managedRoots,
|
|
1336
1347
|
});
|
|
1337
1348
|
if (!resolvedOld.ok) {
|
|
1338
1349
|
return res.status(400).json({ error: resolvedOld.error });
|
|
@@ -1345,7 +1356,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1345
1356
|
path,
|
|
1346
1357
|
os,
|
|
1347
1358
|
normalizeDirectoryPath,
|
|
1348
|
-
|
|
1359
|
+
managedRoots,
|
|
1349
1360
|
});
|
|
1350
1361
|
if (!resolvedNew.ok) {
|
|
1351
1362
|
return res.status(400).json({ error: resolvedNew.error });
|
|
@@ -1451,7 +1462,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1451
1462
|
path,
|
|
1452
1463
|
os,
|
|
1453
1464
|
normalizeDirectoryPath,
|
|
1454
|
-
|
|
1465
|
+
managedRoots,
|
|
1455
1466
|
});
|
|
1456
1467
|
if (!resolvedForWorkspace.ok) {
|
|
1457
1468
|
console.warn(`Rejected /api/fs/exec outside workspace: ${resolvedForWorkspace.error}`);
|
|
@@ -1689,7 +1700,7 @@ export const registerFsRoutes = (app, dependencies) => {
|
|
|
1689
1700
|
path,
|
|
1690
1701
|
os,
|
|
1691
1702
|
normalizeDirectoryPath,
|
|
1692
|
-
|
|
1703
|
+
managedRoots,
|
|
1693
1704
|
});
|
|
1694
1705
|
if (!resolved.ok) {
|
|
1695
1706
|
return res.status(400).json({ error: resolved.error });
|
|
@@ -1429,3 +1429,80 @@ describe('fs stat directory scope (issue 3019)', () => {
|
|
|
1429
1429
|
expect(res.body.isFile).toBe(true);
|
|
1430
1430
|
});
|
|
1431
1431
|
});
|
|
1432
|
+
|
|
1433
|
+
describe('fs managed chats root', () => {
|
|
1434
|
+
const registerWithChatsRoot = ({ managedChatsRoot, fsPromises = {} } = {}) => {
|
|
1435
|
+
const { app, getRoute } = createRouteRegistry();
|
|
1436
|
+
registerFsRoutes(app, {
|
|
1437
|
+
os: { homedir: () => '/home/user' },
|
|
1438
|
+
path: path.posix,
|
|
1439
|
+
fsPromises: {
|
|
1440
|
+
realpath: async (targetPath) => targetPath,
|
|
1441
|
+
mkdir: async () => undefined,
|
|
1442
|
+
...fsPromises,
|
|
1443
|
+
},
|
|
1444
|
+
spawn: vi.fn(),
|
|
1445
|
+
crypto: { randomUUID: () => 'job-0' },
|
|
1446
|
+
normalizeDirectoryPath: (p) => p,
|
|
1447
|
+
resolveProjectDirectory: async () => ({ directory: '/repo' }),
|
|
1448
|
+
buildAugmentedPath: () => '/usr/bin',
|
|
1449
|
+
resolveGitBinaryForSpawn: () => 'git',
|
|
1450
|
+
openchamberUserConfigRoot: '/home/user/.config/openchamber',
|
|
1451
|
+
managedChatsRoot,
|
|
1452
|
+
});
|
|
1453
|
+
return {
|
|
1454
|
+
home: getRoute('GET', '/api/fs/home'),
|
|
1455
|
+
mkdir: getRoute('POST', '/api/fs/mkdir'),
|
|
1456
|
+
};
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
it('exposes the default chats root next to the home directory', async () => {
|
|
1460
|
+
const { home } = registerWithChatsRoot();
|
|
1461
|
+
|
|
1462
|
+
const res = createMockResponse();
|
|
1463
|
+
await home(undefined, res);
|
|
1464
|
+
|
|
1465
|
+
expect(res.statusCode).toBe(200);
|
|
1466
|
+
expect(res.body.home).toBe('/home/user');
|
|
1467
|
+
expect(res.body.chatsRoot).toBe('/home/user/.config/openchamber/chats');
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
it('exposes a relocated chats root when OPENCHAMBER_CHATS_DIR is configured upstream', async () => {
|
|
1471
|
+
const { home } = registerWithChatsRoot({ managedChatsRoot: '/srv/openchamber-chats' });
|
|
1472
|
+
|
|
1473
|
+
const res = createMockResponse();
|
|
1474
|
+
await home(undefined, res);
|
|
1475
|
+
|
|
1476
|
+
expect(res.statusCode).toBe(200);
|
|
1477
|
+
expect(res.body.chatsRoot).toBe('/srv/openchamber-chats');
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
it('allows mkdir inside the relocated chats root outside the active workspace', async () => {
|
|
1481
|
+
const mkdirCalls = [];
|
|
1482
|
+
const { mkdir } = registerWithChatsRoot({
|
|
1483
|
+
managedChatsRoot: '/srv/openchamber-chats',
|
|
1484
|
+
fsPromises: {
|
|
1485
|
+
mkdir: async (targetPath) => {
|
|
1486
|
+
mkdirCalls.push(targetPath);
|
|
1487
|
+
},
|
|
1488
|
+
},
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
const res = createMockResponse();
|
|
1492
|
+
await mkdir({ body: { path: '/srv/openchamber-chats/2026-08-25/session-a' } }, res);
|
|
1493
|
+
|
|
1494
|
+
expect(res.statusCode).toBe(200);
|
|
1495
|
+
expect(res.body.success).toBe(true);
|
|
1496
|
+
expect(mkdirCalls).toEqual(['/srv/openchamber-chats/2026-08-25/session-a']);
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
it('still rejects mkdir outside the workspace and all managed roots', async () => {
|
|
1500
|
+
const { mkdir } = registerWithChatsRoot({ managedChatsRoot: '/srv/openchamber-chats' });
|
|
1501
|
+
|
|
1502
|
+
const res = createMockResponse();
|
|
1503
|
+
await mkdir({ body: { path: '/etc/passwd-holder' } }, res);
|
|
1504
|
+
|
|
1505
|
+
expect(res.statusCode).toBe(400);
|
|
1506
|
+
expect(res.body).toEqual({ error: 'Path is outside of active workspace' });
|
|
1507
|
+
});
|
|
1508
|
+
});
|
|
@@ -684,6 +684,15 @@ const parseWorktreePorcelain = (raw) => {
|
|
|
684
684
|
const branchRef = line.substring('branch '.length).trim();
|
|
685
685
|
current.branchRef = branchRef;
|
|
686
686
|
current.branch = cleanBranchName(branchRef);
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// git marks a worktree whose directory is gone (deleted outside git) as
|
|
691
|
+
// prunable; it stays registered until `git worktree prune`. The sidebar
|
|
692
|
+
// needs that distinction: the directory is missing, but the sessions that
|
|
693
|
+
// lived there are not.
|
|
694
|
+
if (line === 'prunable' || line.startsWith('prunable ')) {
|
|
695
|
+
current.prunable = true;
|
|
687
696
|
}
|
|
688
697
|
}
|
|
689
698
|
|
|
@@ -4036,6 +4045,7 @@ export async function getWorktrees(directory) {
|
|
|
4036
4045
|
name: path.basename(entry.worktree || ''),
|
|
4037
4046
|
branch: entry.branch || '',
|
|
4038
4047
|
path: entry.worktree,
|
|
4048
|
+
prunable: entry.prunable === true,
|
|
4039
4049
|
}));
|
|
4040
4050
|
} catch (error) {
|
|
4041
4051
|
// Worktrees are an optional feature. When the caller passes a directory
|
|
@@ -517,6 +517,24 @@ describe('getWorktrees', () => {
|
|
|
517
517
|
expect(Array.isArray(result)).toBe(true);
|
|
518
518
|
expect(warnSpy).not.toHaveBeenCalled();
|
|
519
519
|
});
|
|
520
|
+
it('flags a worktree whose directory was deleted outside git as prunable', async () => {
|
|
521
|
+
const repo = createTempDir();
|
|
522
|
+
runGit(repo, ['init', '-b', 'main']);
|
|
523
|
+
runGit(repo, ['config', 'user.email', 'test@example.com']);
|
|
524
|
+
runGit(repo, ['config', 'user.name', 'Test User']);
|
|
525
|
+
runGit(repo, ['commit', '--allow-empty', '-m', 'init']);
|
|
526
|
+
const worktreePath = path.join(createTempDir(), 'feature');
|
|
527
|
+
runGit(repo, ['worktree', 'add', worktreePath, '-b', 'feature']);
|
|
528
|
+
|
|
529
|
+
const before = await getWorktrees(repo);
|
|
530
|
+
expect(before.find((entry) => entry.branch === 'feature')).toMatchObject({ prunable: false });
|
|
531
|
+
|
|
532
|
+
fs.rmSync(worktreePath, { recursive: true, force: true });
|
|
533
|
+
|
|
534
|
+
const after = await getWorktrees(repo);
|
|
535
|
+
expect(after.find((entry) => entry.branch === 'feature')).toMatchObject({ path: expect.any(String), prunable: true });
|
|
536
|
+
expect(after.find((entry) => entry.branch === 'main')).toMatchObject({ prunable: false });
|
|
537
|
+
});
|
|
520
538
|
});
|
|
521
539
|
|
|
522
540
|
// ---------------------------------------------------------------------------
|
|
@@ -95,13 +95,19 @@ persisted "sending" flag would strand a message forever.
|
|
|
95
95
|
the tick re-arms with backoff.
|
|
96
96
|
5. The head is marked in flight (broadcast), then sent:
|
|
97
97
|
- text starting with `/` that names a command in OpenCode's `/command`
|
|
98
|
-
list (skills included)
|
|
99
|
-
captured model, agent, variant, and
|
|
98
|
+
list (skills included) and carries no captured context goes to
|
|
99
|
+
`POST /session/:id/command` with the captured model, agent, variant, and
|
|
100
|
+
file parts. That route accepts file parts only, so a command queued
|
|
101
|
+
**with** context takes the prompt route instead, the same rule the
|
|
102
|
+
composer applies: the command's template is expanded with its arguments
|
|
103
|
+
(`$ARGUMENTS`, `$1..$N`, or appended), a skill keeps its `/name args` text
|
|
104
|
+
and gets an explicit "the user invoked this skill" synthetic part after
|
|
105
|
+
the context;
|
|
100
106
|
- otherwise `POST /session/:id/prompt_async` with the parts in the same
|
|
101
|
-
order a UI send uses: text, files, the captured context,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
order a UI send uses: text, files, the captured context, the skill
|
|
108
|
+
invocation when there is one, pending project knowledge
|
|
109
|
+
(`sessionKnowledgeRuntime.resolvePendingForSession`, synthetic, recorded
|
|
110
|
+
as delivered only after the prompt is accepted), then the agent mention.
|
|
105
111
|
Success removes the item, persists, broadcasts, and marks the user
|
|
106
112
|
message sent for notifications. Failure keeps the item, backs off
|
|
107
113
|
2 s → 60 s (doubling per consecutive failure of that item), and re-arms.
|
|
@@ -134,7 +140,11 @@ allowlists.
|
|
|
134
140
|
|
|
135
141
|
Every mutation broadcasts `openchamber:message-queue.updated` with
|
|
136
142
|
`{ revision, session }` to all connected clients (SSE and WS), so several
|
|
137
|
-
devices on one server see one queue.
|
|
143
|
+
devices on one server see one queue. The session in that payload always names
|
|
144
|
+
its `directory`, including the broadcast that removes the last item: the UI
|
|
145
|
+
keys its projection by directory, and a broadcast without one left the
|
|
146
|
+
delivered message on screen (a session's directory is remembered until the
|
|
147
|
+
session is deleted or evicted).
|
|
138
148
|
|
|
139
149
|
Limits: 20 items per session, 50 sessions (oldest evicted, never one with an
|
|
140
150
|
item in flight), 200k characters of content; attachment payloads are bounded
|