@openchamber/web 2.0.0 → 2.0.1
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/dist/assets/{CodeMirrorCommentWidgets-hJbl3JX4.js → CodeMirrorCommentWidgets-zm3C1FvM.js} +1 -1
- package/dist/assets/DiffView-DNExNi1z.js +4 -0
- package/dist/assets/FilesView-DUCLmHBi.js +17 -0
- package/dist/assets/{GitView-DY4pelsO.js → GitView-Bz9z6gZA.js} +4 -4
- package/dist/assets/{GuestAttachDialog-D6mHDTB2.js → GuestAttachDialog-UGp4KDlK.js} +1 -1
- package/dist/assets/GuestSurfacePane-B3pdB_2u.js +1 -0
- package/dist/assets/{JsonTreeView-DEXI2NvJ.js → JsonTreeView-7lVecnZl.js} +1 -1
- package/dist/assets/{LinearIssuesView-BTNc-4dN.js → LinearIssuesView-CTGRS9Vq.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-wcUUcf8l.js → MarkdownImageGallery-DQk5adUs.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-DPF8fZpX.js +12 -0
- package/dist/assets/{OnboardingScreen-FJUreEgI.js → OnboardingScreen-CBx6cXPP.js} +1 -1
- package/dist/assets/{PatchDiff-C0oOkKnO.js → PatchDiff-D7VVpR_l.js} +1 -1
- package/dist/assets/{PierreDiffViewer-asuSQAsf.js → PierreDiffViewer-Gbfks1pk.js} +3 -3
- package/dist/assets/{PlanView-DGbasNHP.js → PlanView-CPSK0x97.js} +4 -4
- package/dist/assets/PluginPane-BIGsUx69.js +3 -0
- package/dist/assets/SettingsView-Dql7z6Ww.js +30 -0
- package/dist/assets/{SettingsWindow-By4cqnqy.js → SettingsWindow-D6oi-UmV.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-C0P2tXLU.js → SubmoduleDiffSummary-BXA0FAWj.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Cayc-yIM.js → ToolOutputDialog-BQJsSbDm.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-B0jmpPQz.js → ToolPartDiffPreview-FY9w0TVT.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DsOpvWZD.js → VirtualizedFileDiff-B9YhAya5.js} +1 -1
- package/dist/assets/{WalkthroughView-CCakjyn9.js → WalkthroughView-CmFgOUFN.js} +2 -2
- package/dist/assets/{appThemeRegistry-Bw5oTm41.js → appThemeRegistry-BebxalUt.js} +1 -1
- package/dist/assets/changesTree-CePHbFcj.js +1 -0
- package/dist/assets/commitAndPush-Wfxng_IK.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-B-4aLf4A.js → computeVirtualFileMetrics-BCOqgixN.js} +2 -2
- package/dist/assets/de-CMA45TC-.js +10 -0
- package/dist/assets/es-DPL4fBtl.js +16 -0
- package/dist/assets/fr-OHBKBseP.js +14 -0
- package/dist/assets/{index-B6r0Kv-B.js → index-3TiDNtfN.js} +1 -1
- package/dist/assets/index-BLUZa5u0.js +41 -0
- package/dist/assets/index-Cm2rrq69.css +1 -0
- package/dist/assets/{isDiffPlainText-Ok-kgtJA.js → isDiffPlainText-DnDYQmWK.js} +1 -1
- package/dist/assets/{isFilePlainText-0dLnkYm8.js → isFilePlainText-BA_AHX7d.js} +1 -1
- package/dist/assets/ja-DvX4WSRf.js +16 -0
- package/dist/assets/ko-BUcLd8YZ.js +16 -0
- package/dist/assets/main-B_jri4i-.js +896 -0
- package/dist/assets/{main-CjXBM_Xe.js → main-DtUmJp9B.js} +2 -2
- package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
- package/dist/assets/markdownCore-BSnlUXBf.js +7 -0
- package/dist/assets/{miniChat-DZ3OAeLN.js → miniChat-BYfLUnDK.js} +2 -2
- package/dist/assets/{mobile-CH0LOIF-.js → mobile-DH3hI6gd.js} +2 -2
- package/dist/assets/patchFileDiff--L7lt_GZ.js +13 -0
- package/dist/assets/pl-BkI_xHqz.js +16 -0
- package/dist/assets/pt-BR-7wFtQlV9.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-CB1uLYvh.js → renderElectronMiniChatApp-C7kpNW_-.js} +2 -2
- package/dist/assets/renderMobileApp-i0nq7Dwy.js +25 -0
- package/dist/assets/runtimeEndpointReset-CfEYbcCc.js +27 -0
- package/dist/assets/scheduledTasksApi-Cy7uZCaI.js +1 -0
- package/dist/assets/{shikiHighlight-CocY80VR.js → shikiHighlight-D4vxipfr.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-CF77r8FA.js → textMateThemeFromAppTheme-BYAHtJwQ.js} +1 -1
- package/dist/assets/tr-TsD-AqEH.js +7 -0
- package/dist/assets/uk-B-qspCmD.js +16 -0
- package/dist/assets/{useAppFontEffects-Dc5nTHi8.js → useAppFontEffects-DHZ9-L30.js} +158 -157
- package/dist/assets/{useInlineCommentController-Dbza5c8l.js → useInlineCommentController-CvpOMK-R.js} +2 -2
- package/dist/assets/{useRootScrollLock-CSCLv396.js → useRootScrollLock-DzNFi-fn.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-CkmYWcRI.js → vendor-codemirror-language-data-j3fhlwUM.js} +2 -2
- package/dist/assets/{vendor-opencode-client-_BAHQo4R.js → vendor-opencode-client-DYdsLbCM.js} +2 -2
- package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
- package/dist/assets/{web-components-nsStrYq9.js → web-components-BvHNFSEG.js} +1 -1
- package/dist/assets/zh-CN-DYuPJV5i.js +16 -0
- package/dist/assets/zh-TW-BX_2D_lV.js +16 -0
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +4 -4
- package/server/index.js +18 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +5 -0
- package/server/lib/agent-tool/runtime.js +34 -6
- package/server/lib/agent-tool/runtime.test.js +15 -0
- package/server/lib/browser-control/DOCUMENTATION.md +14 -2
- package/server/lib/git/DOCUMENTATION.md +1 -1
- package/server/lib/git/service.js +22 -0
- package/server/lib/git/service.test.js +8 -0
- package/server/lib/guests/DOCUMENTATION.md +4 -3
- package/server/lib/guests/catalog.js +19 -1
- package/server/lib/guests/catalog.test.js +22 -0
- package/server/lib/guests/html-styles.js +5 -3
- package/server/lib/guests/html-styles.test.js +3 -1
- package/server/lib/guests/routes.js +11 -3
- package/server/lib/guests/service.js +5 -0
- package/server/lib/guests/surface.js +55 -9
- package/server/lib/guests/surface.test.js +56 -6
- package/server/lib/notifications/DOCUMENTATION.md +10 -0
- package/server/lib/notifications/emit-route.js +118 -0
- package/server/lib/notifications/emit-route.test.js +112 -0
- package/server/lib/openchamber-control/actions.js +16 -2
- package/server/lib/openchamber-control/service.js +23 -0
- package/server/lib/openchamber-control/service.test.js +31 -0
- package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
- package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
- package/server/lib/openchamber-sessions/routes.js +11 -0
- package/server/lib/openchamber-sessions/routes.test.js +18 -0
- package/server/lib/opencode/DOCUMENTATION.md +31 -22
- package/server/lib/opencode/bootstrap-runtime.js +12 -0
- package/server/lib/opencode/compatibility.js +6 -3
- package/server/lib/opencode/compatibility.test.js +8 -0
- package/server/lib/opencode/config-v2.d.ts +2 -0
- package/server/lib/opencode/config-v2.js +42 -0
- package/server/lib/opencode/config-v2.test.js +17 -0
- package/server/lib/opencode/core-routes.js +3 -0
- package/server/lib/opencode/core-routes.test.js +15 -0
- package/server/lib/opencode/env-runtime.js +1 -8
- package/server/lib/opencode/feature-routes-runtime.js +2 -1
- package/server/lib/opencode/lifecycle.js +30 -2
- package/server/lib/opencode/lifecycle.test.js +27 -0
- package/server/lib/opencode/managed-config-file.js +18 -6
- package/server/lib/opencode/managed-config-file.test.js +23 -7
- package/server/lib/opencode/openchamber-routes.js +29 -11
- package/server/lib/opencode/openchamber-routes.test.js +18 -0
- package/server/lib/opencode/provider-source-route.test.js +59 -0
- package/server/lib/opencode/providers.js +3 -0
- package/server/lib/opencode/providers.test.js +62 -0
- package/server/lib/opencode/routes-upgrade.test.js +1 -1
- package/server/lib/opencode/routes.js +18 -1
- package/server/lib/opencode/settings-helpers.js +7 -0
- package/server/lib/opencode/settings-helpers.test.js +2 -2
- package/server/lib/opencode/settings-registry.json +14 -0
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shared.js +32 -2
- package/server/lib/opencode/shared.test.js +79 -1
- package/server/lib/opencode/skill-routes.js +28 -12
- package/server/lib/opencode/skill-routes.test.js +121 -1
- package/server/lib/opencode/upgrade-capability.js +0 -14
- package/server/lib/opencode/v1-migration-topup.js +21 -15
- package/server/lib/opencode/v1-migration-topup.test.js +14 -6
- package/server/lib/opencode/v2-install.d.ts +1 -0
- package/server/lib/opencode/v2-install.js +8 -7
- package/server/lib/opencode/v2-install.test.js +13 -4
- package/server/lib/opencode/websearch-config.js +13 -1
- package/server/lib/quota/providers/kimi.js +1 -1
- package/server/lib/session-assist/DOCUMENTATION.md +17 -5
- package/server/lib/session-assist/runtime.js +19 -2
- package/server/lib/session-assist/runtime.test.js +8 -0
- package/server/lib/session-goal/DOCUMENTATION.md +11 -0
- package/dist/assets/DiffView-BucGEJYa.js +0 -4
- package/dist/assets/FilesView-CQcaaAVP.js +0 -17
- package/dist/assets/GuestSurfacePane--DJ7rsmY.js +0 -1
- package/dist/assets/MarkdownRendererImpl-BPe2TVV2.js +0 -12
- package/dist/assets/PluginPane-DImv8hV2.js +0 -3
- package/dist/assets/SettingsView-DOjuOljf.js +0 -29
- package/dist/assets/commitAndPush-sGEelpjh.js +0 -1
- package/dist/assets/de-CD9utsNj.js +0 -10
- package/dist/assets/es-NNum2rX8.js +0 -16
- package/dist/assets/fr-CJLGmduQ.js +0 -14
- package/dist/assets/index-DjGPR5vW.js +0 -41
- package/dist/assets/index-fCXJ-8Qt.css +0 -1
- package/dist/assets/ja-BuddHNi6.js +0 -16
- package/dist/assets/ko-BrwMbHmf.js +0 -16
- package/dist/assets/main-CxVyUDU_.js +0 -896
- package/dist/assets/markdownCore-B6PpX409.js +0 -5
- package/dist/assets/patchFileDiff-BFRGKaGH.js +0 -13
- package/dist/assets/pl-BwN4TNlP.js +0 -16
- package/dist/assets/pt-BR-BhMtownO.js +0 -16
- package/dist/assets/renderMobileApp-nQ4sjQtb.js +0 -25
- package/dist/assets/runtimeEndpointReset-9ZGlXU4J.js +0 -27
- package/dist/assets/scheduledTasksApi-6DsL_SwM.js +0 -1
- package/dist/assets/tr-DRzvqMdi.js +0 -7
- package/dist/assets/uk-b2aYOSNh.js +0 -16
- package/dist/assets/vendor-zod-Gea9uBlY.js +0 -39
- package/dist/assets/zh-CN-DZeUThm_.js +0 -16
- package/dist/assets/zh-TW-2fRE7uc6.js +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readOpenCodeInfo, isSupportedOpenCodeVersion, requireOpenCodeV2, UnsupportedOpenCodeVersionError } from './compatibility.js';
|
|
1
|
+
import { readOpenCodeInfo, readExternalOpenCodeVersion, isSupportedOpenCodeVersion, requireOpenCodeV2, UnsupportedOpenCodeVersionError } from './compatibility.js';
|
|
2
2
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
3
|
import net from 'node:net';
|
|
4
4
|
import { stripAppImageArgv0Leak } from '../inherited-env.js';
|
|
@@ -677,6 +677,16 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
679
|
|
|
680
|
+
// The version of an explicitly configured server that answered but is not a
|
|
681
|
+
// supported OpenCode (v1, or 2.x below the minimum); null for anything else,
|
|
682
|
+
// including a server that is down.
|
|
683
|
+
const readUnsupportedExternalOpenCodeVersion = async (port, origin) => {
|
|
684
|
+
if (!port || port <= 0) return null;
|
|
685
|
+
const version = await readExternalOpenCodeVersion(origin ?? `http://127.0.0.1:${port}`, getOpenCodeAuthHeaders())
|
|
686
|
+
.catch(() => null);
|
|
687
|
+
return version && !isSupportedOpenCodeVersion(version) ? version : null;
|
|
688
|
+
};
|
|
689
|
+
|
|
680
690
|
const waitForOpenCodePort = async (timeoutMs = 15000) => {
|
|
681
691
|
if (state.openCodePort !== null) {
|
|
682
692
|
return state.openCodePort;
|
|
@@ -991,7 +1001,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
991
1001
|
}
|
|
992
1002
|
|
|
993
1003
|
const info = await readOpenCodeInfo(response);
|
|
994
|
-
if (!info) throw new Error('
|
|
1004
|
+
if (!info) throw new Error('The server did not identify itself as OpenCode 2.x. OpenChamber requires OpenCode 2.x; if the server runs an older OpenCode, upgrade it.');
|
|
995
1005
|
if (!isSupportedOpenCodeVersion(info.version)) throw new UnsupportedOpenCodeVersionError(info.version);
|
|
996
1006
|
state.isOpenCodeReady = true;
|
|
997
1007
|
state.lastOpenCodeError = null;
|
|
@@ -1090,6 +1100,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
1090
1100
|
const bootstrapOpenCodeAtStartup = async () => {
|
|
1091
1101
|
const bootstrapStartedAt = performance.now();
|
|
1092
1102
|
let bootstrapError = null;
|
|
1103
|
+
let unsupportedExternalVersion = null;
|
|
1093
1104
|
recordStartupPerformance('opencode.bootstrap.start');
|
|
1094
1105
|
try {
|
|
1095
1106
|
// Before doing anything, reap any OpenCode process WE spawned in a prior
|
|
@@ -1130,6 +1141,20 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
1130
1141
|
state.lastOpenCodeError = null;
|
|
1131
1142
|
state.openCodeNotReadySince = 0;
|
|
1132
1143
|
syncToHmrState();
|
|
1144
|
+
} else if (env.ENV_EFFECTIVE_PORT && (unsupportedExternalVersion = await readUnsupportedExternalOpenCodeVersion(
|
|
1145
|
+
env.ENV_EFFECTIVE_PORT,
|
|
1146
|
+
env.ENV_CONFIGURED_OPENCODE_HOST?.origin,
|
|
1147
|
+
))) {
|
|
1148
|
+
// The configured server is an OpenCode this OpenChamber cannot use.
|
|
1149
|
+
// Attach to it anyway, not ready, so the compatibility check reports
|
|
1150
|
+
// its version instead of a managed instance silently replacing it.
|
|
1151
|
+
const label = env.ENV_CONFIGURED_OPENCODE_HOST ? env.ENV_CONFIGURED_OPENCODE_HOST.origin : `http://localhost:${env.ENV_EFFECTIVE_PORT}`;
|
|
1152
|
+
console.warn(`OpenCode ${unsupportedExternalVersion} at ${label} is not supported by this OpenChamber`);
|
|
1153
|
+
state.openCodeBaseUrl = env.ENV_CONFIGURED_OPENCODE_HOST?.origin ?? null;
|
|
1154
|
+
setOpenCodePort(env.ENV_EFFECTIVE_PORT);
|
|
1155
|
+
state.isExternalOpenCode = true;
|
|
1156
|
+
syncToHmrState();
|
|
1157
|
+
throw new UnsupportedOpenCodeVersionError(unsupportedExternalVersion);
|
|
1133
1158
|
} else {
|
|
1134
1159
|
// We never auto-attach to an arbitrary pre-existing OpenCode instance.
|
|
1135
1160
|
// Attaching to an external server requires explicit opt-in via env
|
|
@@ -1156,6 +1181,9 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|
|
1156
1181
|
await waitForOpenCodeReady();
|
|
1157
1182
|
} catch (error) {
|
|
1158
1183
|
bootstrapError = error;
|
|
1184
|
+
// Skip-start mode assumed readiness up front; a server that never
|
|
1185
|
+
// proved itself must not keep reporting ready to startup diagnostics.
|
|
1186
|
+
state.isOpenCodeReady = false;
|
|
1159
1187
|
console.error(`OpenCode readiness check failed: ${error.message}`);
|
|
1160
1188
|
}
|
|
1161
1189
|
} catch (error) {
|
|
@@ -240,6 +240,33 @@ describe('OpenCode lifecycle', () => {
|
|
|
240
240
|
expect(runtime.testState.openCodeBaseUrl).toBe('http://seamus:4095');
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
+
it('attaches to an OPENCODE_HOST running OpenCode v1 instead of starting a managed server', async () => {
|
|
244
|
+
const requested = [];
|
|
245
|
+
globalThis.fetch = vi.fn(async (url) => {
|
|
246
|
+
const href = String(url);
|
|
247
|
+
requested.push(href);
|
|
248
|
+
if (href.endsWith('/global/health')) return Response.json({ healthy: true, version: '1.18.32' });
|
|
249
|
+
return new Response('<html>OpenCode</html>', { headers: { 'content-type': 'text/html' } });
|
|
250
|
+
});
|
|
251
|
+
const runtime = createRuntime({
|
|
252
|
+
reapManagedOrphanedProcesses: vi.fn(async () => ({ reaped: 0 })),
|
|
253
|
+
}, {}, {
|
|
254
|
+
ENV_CONFIGURED_OPENCODE_PORT: null,
|
|
255
|
+
ENV_CONFIGURED_OPENCODE_HOST: { origin: 'http://seamus:4095', port: 4095 },
|
|
256
|
+
ENV_EFFECTIVE_PORT: 4095,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
await runtime.bootstrapOpenCodeAtStartup();
|
|
260
|
+
|
|
261
|
+
expect(spawnMock).not.toHaveBeenCalled();
|
|
262
|
+
expect(requested).toContain('http://seamus:4095/global/health');
|
|
263
|
+
expect(runtime.testState.isExternalOpenCode).toBe(true);
|
|
264
|
+
expect(runtime.testState.isOpenCodeReady).toBe(false);
|
|
265
|
+
expect(runtime.testState.openCodeBaseUrl).toBe('http://seamus:4095');
|
|
266
|
+
expect(runtime.testState.openCodePort).toBe(4095);
|
|
267
|
+
expect(runtime.testState.lastOpenCodeError).toContain('1.18.32');
|
|
268
|
+
});
|
|
269
|
+
|
|
243
270
|
it('warms recently used directories after a successful bootstrap', async () => {
|
|
244
271
|
const fetchMock = vi.fn(async () => ({
|
|
245
272
|
ok: true,
|
|
@@ -2,6 +2,17 @@ import { appendManagedPlugin } from './managed-plugin-config.js';
|
|
|
2
2
|
|
|
3
3
|
export const MANAGED_CONFIG_FILE_NAME = 'opencode.managed.json';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Built-in OpenCode plugins OpenChamber switches off for its managed child.
|
|
7
|
+
*
|
|
8
|
+
* `opencode.browser` only works when OpenCode's own desktop app attaches a
|
|
9
|
+
* browser to the session; OpenChamber does not implement that protocol, so its
|
|
10
|
+
* tools always fail with `browser.disconnected` and agents conclude browsing is
|
|
11
|
+
* unavailable instead of using `openchamber_web`. A project config that lists
|
|
12
|
+
* `opencode.browser` still re-enables it, because that layer sits above ours.
|
|
13
|
+
*/
|
|
14
|
+
const DISABLED_BUILTIN_PLUGINS = ['-opencode.browser'];
|
|
15
|
+
|
|
5
16
|
/**
|
|
6
17
|
* The managed OpenCode config layer.
|
|
7
18
|
*
|
|
@@ -12,7 +23,8 @@ export const MANAGED_CONFIG_FILE_NAME = 'opencode.managed.json';
|
|
|
12
23
|
* process — where `OPENCODE_CONFIG_CONTENT` (an environment variable) could
|
|
13
24
|
* only ever change across a restart.
|
|
14
25
|
*
|
|
15
|
-
* The file is OpenChamber-owned and holds nothing but `plugins
|
|
26
|
+
* The file is OpenChamber-owned and holds nothing but `plugins`: the built-in
|
|
27
|
+
* plugins OpenChamber disables, then its own plugin directories. It sits above
|
|
16
28
|
* the user's global `opencode.json` and below their project config, so it never
|
|
17
29
|
* shadows a project-level choice.
|
|
18
30
|
*
|
|
@@ -46,7 +58,7 @@ export const createManagedConfigRuntime = ({
|
|
|
46
58
|
|
|
47
59
|
const writeConfigFile = async (pluginDirectories) => {
|
|
48
60
|
await fsPromises.mkdir(dataDir, { recursive: true });
|
|
49
|
-
const text = `${JSON.stringify({ plugins: pluginDirectories }, null, 2)}\n`;
|
|
61
|
+
const text = `${JSON.stringify({ plugins: [...DISABLED_BUILTIN_PLUGINS, ...pluginDirectories] }, null, 2)}\n`;
|
|
50
62
|
// Temp + rename: OpenCode reacts to the write immediately, and a partial
|
|
51
63
|
// read would make it drop every managed plugin until the next change.
|
|
52
64
|
const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -69,10 +81,11 @@ export const createManagedConfigRuntime = ({
|
|
|
69
81
|
const includeControl = settings?.agentControlToolEnabled !== false;
|
|
70
82
|
const includeWeb = settings?.agentWebToolEnabled !== false;
|
|
71
83
|
const includeMemory = isAgentMemoryAvailable() && settings?.agentMemoryToolEnabled === true;
|
|
84
|
+
const includeNotify = settings?.agentNotifyToolEnabled === true;
|
|
72
85
|
|
|
73
86
|
const directories = [];
|
|
74
|
-
if (agentToolRuntime && (includeControl || includeWeb || includeMemory)) {
|
|
75
|
-
directories.push(await agentToolRuntime.materializePlugin({ includeControl, includeWeb, includeMemory }));
|
|
87
|
+
if (agentToolRuntime && (includeControl || includeWeb || includeMemory || includeNotify)) {
|
|
88
|
+
directories.push(await agentToolRuntime.materializePlugin({ includeControl, includeWeb, includeMemory, includeNotify }));
|
|
76
89
|
}
|
|
77
90
|
return directories;
|
|
78
91
|
};
|
|
@@ -89,9 +102,8 @@ export const createManagedConfigRuntime = ({
|
|
|
89
102
|
await writeConfigFile(directories);
|
|
90
103
|
return { ...childEnv, OPENCODE_CONFIG: filePath };
|
|
91
104
|
}
|
|
92
|
-
if (directories.length === 0) return childEnv;
|
|
93
105
|
let content = env.OPENCODE_CONFIG_CONTENT;
|
|
94
|
-
for (const directory of directories) {
|
|
106
|
+
for (const directory of [...DISABLED_BUILTIN_PLUGINS, ...directories]) {
|
|
95
107
|
content = appendManagedPlugin(content, directory, 'managed plugin');
|
|
96
108
|
}
|
|
97
109
|
return { ...childEnv, OPENCODE_CONFIG_CONTENT: content };
|
|
@@ -52,7 +52,7 @@ describe('managed OpenCode config file', () => {
|
|
|
52
52
|
expect(childEnv.OPENCODE_CONFIG_CONTENT).toBeUndefined();
|
|
53
53
|
expect(childEnv.OPENCHAMBER_AGENT_TOOL_TOKEN).toBe('token');
|
|
54
54
|
expect(await readConfigFile()).toEqual({
|
|
55
|
-
plugins: [path.join(dataDir, 'agent-tool', 'openchamber-agent-tool')],
|
|
55
|
+
plugins: ['-opencode.browser', path.join(dataDir, 'agent-tool', 'openchamber-agent-tool')],
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ describe('managed OpenCode config file', () => {
|
|
|
61
61
|
|
|
62
62
|
await runtime.buildManagedChildEnv();
|
|
63
63
|
|
|
64
|
-
for (const directory of (await readConfigFile()).plugins) {
|
|
64
|
+
for (const directory of (await readConfigFile()).plugins.filter((entry) => !entry.startsWith('-'))) {
|
|
65
65
|
expect((await fs.stat(directory)).isDirectory()).toBe(true);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
@@ -74,7 +74,7 @@ describe('managed OpenCode config file', () => {
|
|
|
74
74
|
const childEnv = await runtime.buildManagedChildEnv();
|
|
75
75
|
|
|
76
76
|
expect(agentToolRuntime.materializePlugin).not.toHaveBeenCalled();
|
|
77
|
-
expect(await readConfigFile()).toEqual({ plugins: [] });
|
|
77
|
+
expect(await readConfigFile()).toEqual({ plugins: ['-opencode.browser'] });
|
|
78
78
|
// A tool switched on later reaches a process that can already call back.
|
|
79
79
|
expect(childEnv.OPENCHAMBER_AGENT_TOOL_TOKEN).toBe('token');
|
|
80
80
|
});
|
|
@@ -89,7 +89,7 @@ describe('managed OpenCode config file', () => {
|
|
|
89
89
|
expect(await runtime.refreshManagedConfigFile()).toEqual({ updated: true });
|
|
90
90
|
|
|
91
91
|
const { plugins } = await readConfigFile();
|
|
92
|
-
expect(plugins).toEqual([]);
|
|
92
|
+
expect(plugins).toEqual(['-opencode.browser']);
|
|
93
93
|
expect(agentToolRuntime.createChildEnv).toHaveBeenCalledTimes(1);
|
|
94
94
|
});
|
|
95
95
|
|
|
@@ -102,11 +102,27 @@ describe('managed OpenCode config file', () => {
|
|
|
102
102
|
current.settings = { agentControlToolEnabled: false, agentWebToolEnabled: true };
|
|
103
103
|
await runtime.refreshManagedConfigFile();
|
|
104
104
|
|
|
105
|
-
expect((await readConfigFile()).plugins).toHaveLength(
|
|
105
|
+
expect((await readConfigFile()).plugins).toHaveLength(2);
|
|
106
106
|
expect(agentToolRuntime.materializePlugin).toHaveBeenCalledWith({
|
|
107
107
|
includeControl: false,
|
|
108
108
|
includeWeb: true,
|
|
109
109
|
includeMemory: false,
|
|
110
|
+
includeNotify: false,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('injects the notify tool only when it is switched on', async () => {
|
|
115
|
+
const { runtime, agentToolRuntime } = await createHarness({
|
|
116
|
+
settings: { agentControlToolEnabled: false, agentWebToolEnabled: false, agentNotifyToolEnabled: true },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
await runtime.buildManagedChildEnv();
|
|
120
|
+
|
|
121
|
+
expect(agentToolRuntime.materializePlugin).toHaveBeenCalledWith({
|
|
122
|
+
includeControl: false,
|
|
123
|
+
includeWeb: false,
|
|
124
|
+
includeMemory: false,
|
|
125
|
+
includeNotify: true,
|
|
110
126
|
});
|
|
111
127
|
});
|
|
112
128
|
|
|
@@ -121,7 +137,7 @@ describe('managed OpenCode config file', () => {
|
|
|
121
137
|
expect(childEnv.OPENCODE_CONFIG).toBeUndefined();
|
|
122
138
|
expect(JSON.parse(childEnv.OPENCODE_CONFIG_CONTENT)).toEqual({
|
|
123
139
|
model: 'test/model',
|
|
124
|
-
plugins: [path.join(dataDir, 'agent-tool', 'openchamber-agent-tool')],
|
|
140
|
+
plugins: ['-opencode.browser', path.join(dataDir, 'agent-tool', 'openchamber-agent-tool')],
|
|
125
141
|
});
|
|
126
142
|
await expect(fs.stat(path.join(dataDir, MANAGED_CONFIG_FILE_NAME))).rejects.toThrow();
|
|
127
143
|
expect(await runtime.refreshManagedConfigFile()).toEqual({ updated: false, reason: 'external-config' });
|
|
@@ -147,6 +163,6 @@ describe('managed OpenCode config file', () => {
|
|
|
147
163
|
await runtime.buildManagedChildEnv();
|
|
148
164
|
|
|
149
165
|
expect(agentToolRuntime.materializePlugin).not.toHaveBeenCalled();
|
|
150
|
-
expect(await readConfigFile()).toEqual({ plugins: [] });
|
|
166
|
+
expect(await readConfigFile()).toEqual({ plugins: ['-opencode.browser'] });
|
|
151
167
|
});
|
|
152
168
|
});
|
|
@@ -71,6 +71,26 @@ export const registerOpenChamberRoutes = (app, dependencies) => {
|
|
|
71
71
|
|
|
72
72
|
let desktopRestartError = null;
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* How this server was launched, read from its instance file. A foreground
|
|
76
|
+
* server outside systemd has no process that can restart it after an
|
|
77
|
+
* install, so it cannot update itself.
|
|
78
|
+
*/
|
|
79
|
+
const readLaunchState = async () => {
|
|
80
|
+
const currentPort = server.address()?.port || 3000;
|
|
81
|
+
const instanceFilePath = path.join(openchamberDataDir, 'run', `openchamber-${currentPort}.json`);
|
|
82
|
+
let storedOptions = { port: currentPort, daemon: true };
|
|
83
|
+
try {
|
|
84
|
+
const content = await fs.promises.readFile(instanceFilePath, 'utf8');
|
|
85
|
+
storedOptions = JSON.parse(content);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
const launchMode = storedOptions.launchMode === 'foreground' ? 'foreground' : 'daemon';
|
|
89
|
+
const isForegroundService = launchMode === 'foreground';
|
|
90
|
+
const systemdServiceUnit = isForegroundService ? resolveSystemdServiceUnit(process.env) : null;
|
|
91
|
+
return { storedOptions, launchMode, isForegroundService, systemdServiceUnit };
|
|
92
|
+
};
|
|
93
|
+
|
|
74
94
|
app.get('/api/openchamber/update-check', async (req, res) => {
|
|
75
95
|
try {
|
|
76
96
|
const parseString = (value) => (typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined);
|
|
@@ -121,6 +141,14 @@ export const registerOpenChamberRoutes = (app, dependencies) => {
|
|
|
121
141
|
} else {
|
|
122
142
|
const { checkForUpdates } = await import('../package-manager.js');
|
|
123
143
|
updateInfo = await checkForUpdates(updateRequest);
|
|
144
|
+
// Tell clients up front that the install route will refuse, so they
|
|
145
|
+
// show the manual command instead of an Update button that fails.
|
|
146
|
+
if (updateInfo?.available && updateRequest.appType === 'web') {
|
|
147
|
+
const { isForegroundService, systemdServiceUnit } = await readLaunchState();
|
|
148
|
+
if (isForegroundService && !systemdServiceUnit) {
|
|
149
|
+
updateInfo = { ...updateInfo, installBlocked: 'service-manager' };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
124
152
|
}
|
|
125
153
|
res.json(updateInfo);
|
|
126
154
|
} catch (error) {
|
|
@@ -215,17 +243,7 @@ export const registerOpenChamberRoutes = (app, dependencies) => {
|
|
|
215
243
|
return;
|
|
216
244
|
}
|
|
217
245
|
|
|
218
|
-
const
|
|
219
|
-
const instanceFilePath = path.join(openchamberDataDir, 'run', `openchamber-${currentPort}.json`);
|
|
220
|
-
let storedOptions = { port: currentPort, daemon: true };
|
|
221
|
-
try {
|
|
222
|
-
const content = await fs.promises.readFile(instanceFilePath, 'utf8');
|
|
223
|
-
storedOptions = JSON.parse(content);
|
|
224
|
-
} catch {
|
|
225
|
-
}
|
|
226
|
-
const launchMode = storedOptions.launchMode === 'foreground' ? 'foreground' : 'daemon';
|
|
227
|
-
const isForegroundService = launchMode === 'foreground';
|
|
228
|
-
const systemdServiceUnit = isForegroundService ? resolveSystemdServiceUnit(process.env) : null;
|
|
246
|
+
const { storedOptions, launchMode, isForegroundService, systemdServiceUnit } = await readLaunchState();
|
|
229
247
|
|
|
230
248
|
if (isForegroundService) {
|
|
231
249
|
if (!systemdServiceUnit) {
|
|
@@ -203,6 +203,24 @@ describe('OpenChamber desktop host update route', () => {
|
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
describe('OpenChamber foreground update route', () => {
|
|
206
|
+
it('marks an available update as blocked when the foreground server has no service manager', async () => {
|
|
207
|
+
const { app } = createApp();
|
|
208
|
+
|
|
209
|
+
const response = await request(app).get('/api/openchamber/update-check?appType=web').expect(200);
|
|
210
|
+
|
|
211
|
+
expect(response.body).toMatchObject({ available: true, installBlocked: 'service-manager' });
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('leaves the update installable for a systemd-owned or daemon server', async () => {
|
|
215
|
+
const systemd = createApp({ environment: { INVOCATION_ID: 'systemd-invocation' } });
|
|
216
|
+
const daemon = createApp({ storedOptions: { launchMode: 'daemon' } });
|
|
217
|
+
|
|
218
|
+
for (const { app } of [systemd, daemon]) {
|
|
219
|
+
const response = await request(app).get('/api/openchamber/update-check?appType=web').expect(200);
|
|
220
|
+
expect(response.body.installBlocked).toBeUndefined();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
206
224
|
it('rejects a foreground update when the server is not owned by systemd', async () => {
|
|
207
225
|
const { app } = createApp();
|
|
208
226
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import request from 'supertest';
|
|
4
|
+
import { registerOpenCodeRoutes } from './routes.js';
|
|
5
|
+
|
|
6
|
+
const createApp = (getProviderSources) => {
|
|
7
|
+
const app = express();
|
|
8
|
+
app.use(express.json());
|
|
9
|
+
registerOpenCodeRoutes(app, {
|
|
10
|
+
resolveProjectDirectory: vi.fn(async () => ({ directory: '/projects/app' })),
|
|
11
|
+
getProviderSources,
|
|
12
|
+
});
|
|
13
|
+
return app;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
describe('GET /api/provider/:providerId/source', () => {
|
|
17
|
+
it('returns the stored config entry next to the layer sources', async () => {
|
|
18
|
+
const stored = {
|
|
19
|
+
name: 'Stored',
|
|
20
|
+
package: 'aisdk:@ai-sdk/openai-compatible',
|
|
21
|
+
env: ['STORED_KEY'],
|
|
22
|
+
settings: { baseURL: 'https://stored.example.com/v1' },
|
|
23
|
+
models: { m: { modelID: 'm', name: 'M' } },
|
|
24
|
+
};
|
|
25
|
+
const getProviderSources = vi.fn(() => ({
|
|
26
|
+
sources: {
|
|
27
|
+
auth: { exists: false },
|
|
28
|
+
user: { exists: false, path: '/user.json' },
|
|
29
|
+
project: { exists: true, path: '/projects/app/opencode.json' },
|
|
30
|
+
custom: { exists: false, path: null },
|
|
31
|
+
},
|
|
32
|
+
config: stored,
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
const response = await request(createApp(getProviderSources))
|
|
36
|
+
.get('/api/provider/stored-llm/source?directory=/projects/app')
|
|
37
|
+
.expect(200);
|
|
38
|
+
|
|
39
|
+
expect(getProviderSources).toHaveBeenCalledWith('stored-llm', '/projects/app');
|
|
40
|
+
expect(response.body.config).toEqual(stored);
|
|
41
|
+
expect(response.body.sources.project.exists).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('returns null config when no layer defines the provider', async () => {
|
|
45
|
+
const response = await request(createApp(() => ({
|
|
46
|
+
sources: {
|
|
47
|
+
auth: { exists: false },
|
|
48
|
+
user: { exists: false, path: '/user.json' },
|
|
49
|
+
project: { exists: false, path: null },
|
|
50
|
+
custom: { exists: false, path: null },
|
|
51
|
+
},
|
|
52
|
+
config: null,
|
|
53
|
+
})))
|
|
54
|
+
.get('/api/provider/other/source')
|
|
55
|
+
.expect(200);
|
|
56
|
+
|
|
57
|
+
expect(response.body.config).toBeNull();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
deleteSectionEntry,
|
|
12
12
|
toModelVariants,
|
|
13
13
|
toProviderEntity,
|
|
14
|
+
readStoredProviderEntry,
|
|
14
15
|
toProviderPackage,
|
|
15
16
|
toNpmPackage,
|
|
16
17
|
} from './config-v2.js';
|
|
@@ -43,6 +44,8 @@ function getProviderSources(providerId, workingDirectory) {
|
|
|
43
44
|
project: { exists: providerExistsIn(projectConfig, providerId), path: paths.projectPath || null },
|
|
44
45
|
custom: { exists: providerExistsIn(customConfig, providerId), path: paths.customPath },
|
|
45
46
|
},
|
|
47
|
+
// Same precedence as the edit scope: custom > project > user.
|
|
48
|
+
config: readStoredProviderEntry([customConfig, projectConfig, userConfig], providerId),
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
51
|
|
|
@@ -436,6 +436,68 @@ describe('custom provider config persistence', () => {
|
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
+
test('getProviderSources returns the stored entry from a JSONC config, v2 shape, without the key', () => {
|
|
440
|
+
const configPath = path.join(projectDir, '.opencode', 'opencode.jsonc');
|
|
441
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
442
|
+
fs.writeFileSync(configPath, `{
|
|
443
|
+
// v1 spelling, still decoded by OpenCode 2
|
|
444
|
+
"provider": {
|
|
445
|
+
"stored-llm": {
|
|
446
|
+
"name": "Stored",
|
|
447
|
+
"npm": "@ai-sdk/openai-compatible",
|
|
448
|
+
"env": ["STORED_KEY"],
|
|
449
|
+
"options": { "baseURL": "https://stored.example.com/v1", "apiKey": "sk-secret", "timeout": 5 },
|
|
450
|
+
"models": { "m": { "name": "M", "variants": { "high": { "reasoningEffort": "high" } } } },
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
}`, 'utf8');
|
|
454
|
+
|
|
455
|
+
const { config } = getProviderSources('stored-llm', projectDir);
|
|
456
|
+
expect(config).toEqual({
|
|
457
|
+
name: 'Stored',
|
|
458
|
+
package: 'aisdk:@ai-sdk/openai-compatible',
|
|
459
|
+
env: ['STORED_KEY'],
|
|
460
|
+
settings: { baseURL: 'https://stored.example.com/v1', timeout: 5 },
|
|
461
|
+
models: { m: { name: 'M', variants: [{ id: 'high', settings: { reasoningEffort: 'high' } }] } },
|
|
462
|
+
});
|
|
463
|
+
expect(getProviderSources('missing-llm', projectDir).config).toBeNull();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
test('saving the stored entry back keeps env, settings and model fields it does not edit', () => {
|
|
467
|
+
const providerId = 'keep-llm';
|
|
468
|
+
const configPath = path.join(projectDir, '.opencode', 'opencode.json');
|
|
469
|
+
writeJson(configPath, {
|
|
470
|
+
providers: {
|
|
471
|
+
[providerId]: {
|
|
472
|
+
name: 'Keep',
|
|
473
|
+
package: 'aisdk:@ai-sdk/openai-compatible',
|
|
474
|
+
env: ['KEEP_KEY'],
|
|
475
|
+
settings: { baseURL: 'https://keep.example.com/v1', timeout: 5 },
|
|
476
|
+
body: { store: false },
|
|
477
|
+
models: { m: { modelID: 'm', name: 'M', limit: { context: 1000 } } },
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
const { config } = getProviderSources(providerId, projectDir);
|
|
483
|
+
upsertProviderConfig(providerId, {
|
|
484
|
+
name: config.name,
|
|
485
|
+
package: config.package,
|
|
486
|
+
env: config.env,
|
|
487
|
+
settings: { baseURL: config.settings.baseURL },
|
|
488
|
+
models: { m: { name: 'M renamed' } },
|
|
489
|
+
}, projectDir, 'project', { hasStoredAuth: true });
|
|
490
|
+
|
|
491
|
+
expect(readJson(configPath).providers[providerId]).toEqual({
|
|
492
|
+
name: 'Keep',
|
|
493
|
+
package: 'aisdk:@ai-sdk/openai-compatible',
|
|
494
|
+
env: ['KEEP_KEY'],
|
|
495
|
+
settings: { baseURL: 'https://keep.example.com/v1', timeout: 5 },
|
|
496
|
+
body: { store: false },
|
|
497
|
+
models: { m: { modelID: 'm', name: 'M renamed', limit: { context: 1000 } } },
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
|
|
439
501
|
test('custom-scope edit updates custom layer without creating a user entry', () => {
|
|
440
502
|
const providerId = `custom-scope-${Date.now()}`;
|
|
441
503
|
const customPath = path.join(projectDir, 'custom-opencode.json');
|
|
@@ -86,7 +86,7 @@ describe('OpenCode upgrade routes', () => {
|
|
|
86
86
|
expect(globalThis.fetch).not.toHaveBeenCalled();
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
it.each(['external', 'unavailable'
|
|
89
|
+
it.each(['external', 'unavailable'])('rejects %s on the server', async (reason) => {
|
|
90
90
|
const { app, dependencies } = createApp({ getOpenCodeUpgradeCapability: () => ({ supported: false, reason }) });
|
|
91
91
|
await request(app).post('/api/opencode/upgrade').send({}).expect(409);
|
|
92
92
|
expect(dependencies.upgradeOpenCodeCli).not.toHaveBeenCalled();
|
|
@@ -10,7 +10,7 @@ import { getClaudeCliAuthStatus } from './claude-cli-auth.js';
|
|
|
10
10
|
import { OPENCODE_CONFIG_DIR } from './shared.js';
|
|
11
11
|
import { settingsSurfaceOf } from './settings-files.js';
|
|
12
12
|
import { parseWebSearchSelection } from './config-v2.js';
|
|
13
|
-
import { getWebSearchSource, setWebSearchSelection } from './websearch-config.js';
|
|
13
|
+
import { getWebSearchSource, setWarmingEnabled, setWebSearchSelection } from './websearch-config.js';
|
|
14
14
|
|
|
15
15
|
export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
16
16
|
const {
|
|
@@ -287,6 +287,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
287
287
|
return res.json({
|
|
288
288
|
providerId,
|
|
289
289
|
sources: sources.sources,
|
|
290
|
+
config: sources.config,
|
|
290
291
|
});
|
|
291
292
|
} catch (error) {
|
|
292
293
|
console.error('Failed to get provider sources:', error);
|
|
@@ -379,6 +380,22 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
379
380
|
}
|
|
380
381
|
});
|
|
381
382
|
|
|
383
|
+
// Session warming (`warming` in OpenCode config), written like the web
|
|
384
|
+
// search choice above. Settings reads the effective value from OpenCode.
|
|
385
|
+
app.put('/api/config/warming', (req, res) => {
|
|
386
|
+
const enabled = req.body?.enabled;
|
|
387
|
+
if (typeof enabled !== 'boolean') {
|
|
388
|
+
return res.status(400).json({ error: 'enabled must be a boolean' });
|
|
389
|
+
}
|
|
390
|
+
try {
|
|
391
|
+
const result = setWarmingEnabled(enabled);
|
|
392
|
+
return res.json({ success: true, changed: result.changed });
|
|
393
|
+
} catch (error) {
|
|
394
|
+
console.error('Failed to save session warming:', error);
|
|
395
|
+
return res.status(500).json({ error: error.message || 'Failed to save session warming' });
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
382
399
|
app.delete('/api/provider/:providerId/auth', async (req, res) => {
|
|
383
400
|
try {
|
|
384
401
|
const { providerId } = req.params;
|
|
@@ -65,6 +65,7 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
65
65
|
const SIDEBAR_PROJECT_DISPLAY_MODE_VALUES = new Set(['all', 'single']);
|
|
66
66
|
const SIDEBAR_VIEW_MODE_VALUES = new Set(['projects', 'timeline']);
|
|
67
67
|
const SIDEBAR_PROJECT_SORT_ORDER_VALUES = new Set(['manual', 'a-z', 'z-a', 'date-added', 'recent']);
|
|
68
|
+
const SIDEBAR_WORKTREE_SORT_ORDER_VALUES = new Set(['recent', 'manual', 'a-z']);
|
|
68
69
|
const HIDDEN_MODELS_MAX = 1024;
|
|
69
70
|
const RECENT_EFFORTS_MAX_KEYS = 128;
|
|
70
71
|
const RECENT_EFFORTS_MAX_VARIANTS_PER_KEY = 5;
|
|
@@ -302,6 +303,9 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
302
303
|
if (SIDEBAR_PROJECT_SORT_ORDER_VALUES.has(candidate.sidebarProjectSortOrder)) {
|
|
303
304
|
result.sidebarProjectSortOrder = candidate.sidebarProjectSortOrder;
|
|
304
305
|
}
|
|
306
|
+
if (SIDEBAR_WORKTREE_SORT_ORDER_VALUES.has(candidate.sidebarWorktreeSortOrder)) {
|
|
307
|
+
result.sidebarWorktreeSortOrder = candidate.sidebarWorktreeSortOrder;
|
|
308
|
+
}
|
|
305
309
|
if (typeof candidate.sidebarShowRecentSection === 'boolean') {
|
|
306
310
|
result.sidebarShowRecentSection = candidate.sidebarShowRecentSection;
|
|
307
311
|
}
|
|
@@ -607,6 +611,9 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
607
611
|
if (typeof candidate.agentMemoryToolEnabled === 'boolean') {
|
|
608
612
|
result.agentMemoryToolEnabled = candidate.agentMemoryToolEnabled;
|
|
609
613
|
}
|
|
614
|
+
if (typeof candidate.agentNotifyToolEnabled === 'boolean') {
|
|
615
|
+
result.agentNotifyToolEnabled = candidate.agentNotifyToolEnabled;
|
|
616
|
+
}
|
|
610
617
|
if (typeof candidate.openCodeUpdateToastDismissedVersion === 'string') {
|
|
611
618
|
const version = candidate.openCodeUpdateToastDismissedVersion.trim();
|
|
612
619
|
result.openCodeUpdateToastDismissedVersion = version.slice(0, VERSION_STRING_MAX_LENGTH);
|
|
@@ -764,13 +764,13 @@ describe('settings registry gate', () => {
|
|
|
764
764
|
desktopLanAccessEnabled: true, desktopKeepAwakeEnabled: true, desktopMinimizeToTrayEnabled: true, desktopMacMenuBarEnabled: true,
|
|
765
765
|
desktopUiPassword: 'secret', githubClientId: 'client', githubScopes: 'repo', skillCatalogs: [{ id: 'c', label: 'C', source: 'https://x' }],
|
|
766
766
|
defaultGitIdentityId: 'global', permissionAutoAccept: { sessions: { s: true }, revision: 1 },
|
|
767
|
-
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
767
|
+
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, agentNotifyToolEnabled: true, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
768
768
|
autoDeleteEnabled: true, autoDeleteAfterDays: 30, sessionRetentionOnlyArchived: false, sessionRetentionAction: 'archive', terminalShell: 'zsh', terminalLoginShells: ['zsh'],
|
|
769
769
|
openInAppId: 'vscode', dictationEnabled: true, sttProvider: 'local', sttServerUrl: 'http://localhost:8001/v1', sttModel: 'm', sttLocalModel: 'm', sttLanguage: 'en',
|
|
770
770
|
tunnelProvider: 'cloudflare', tunnelMode: 'quick', tunnelBootstrapTtlMs: 600000, tunnelSessionTtlMs: 86400000, managedLocalTunnelConfigPath: '/tmp/x',
|
|
771
771
|
managedRemoteTunnelHostname: 'x.example', managedRemoteTunnelToken: 'token', managedRemoteTunnelPresets: [{ id: 'a', name: 'A', hostname: 'a.example' }],
|
|
772
772
|
managedRemoteTunnelSelectedPresetId: 'a', managedRemoteTunnelPresetTokens: { a: 'token' },
|
|
773
|
-
sidebarProjectDisplayMode: 'all', sidebarViewMode: 'timeline', sidebarProjectSortOrder: 'manual', sidebarShowRecentSection: true,
|
|
773
|
+
sidebarProjectDisplayMode: 'all', sidebarViewMode: 'timeline', sidebarProjectSortOrder: 'manual', sidebarWorktreeSortOrder: 'recent', sidebarShowRecentSection: true,
|
|
774
774
|
workStatusPanelEnabled: true, workStatusHiddenSections: ['mcp'], workStatusHiddenSectionsExplicit: true, workStatusSectionOrder: ['mcp', 'session'],
|
|
775
775
|
showReasoningTraces: true, streamingAutoFollowEnabled: true, collapsibleThinkingBlocks: true, showTextJustificationActivity: true,
|
|
776
776
|
chatRenderMode: 'live', activityRenderMode: 'summary', mermaidRenderingMode: 'svg', userMessageRenderingMode: 'markdown', collapsibleUserMessages: true,
|
|
@@ -123,6 +123,9 @@
|
|
|
123
123
|
"browserProvider": {
|
|
124
124
|
"scope": "instance"
|
|
125
125
|
},
|
|
126
|
+
"agentNotifyToolEnabled": {
|
|
127
|
+
"scope": "instance"
|
|
128
|
+
},
|
|
126
129
|
"agentMemoryToolEnabled": {
|
|
127
130
|
"scope": "instance"
|
|
128
131
|
},
|
|
@@ -222,6 +225,9 @@
|
|
|
222
225
|
"sidebarProjectSortOrder": {
|
|
223
226
|
"scope": "profile"
|
|
224
227
|
},
|
|
228
|
+
"sidebarWorktreeSortOrder": {
|
|
229
|
+
"scope": "profile"
|
|
230
|
+
},
|
|
225
231
|
"sidebarShowRecentSection": {
|
|
226
232
|
"scope": "profile"
|
|
227
233
|
},
|
|
@@ -674,6 +680,14 @@
|
|
|
674
680
|
"scope": "device",
|
|
675
681
|
"local": true
|
|
676
682
|
},
|
|
683
|
+
"diffFileListMode": {
|
|
684
|
+
"scope": "device",
|
|
685
|
+
"local": true
|
|
686
|
+
},
|
|
687
|
+
"diffFileTreeWidth": {
|
|
688
|
+
"scope": "device",
|
|
689
|
+
"local": true
|
|
690
|
+
},
|
|
677
691
|
"linearIssueListStatus": {
|
|
678
692
|
"scope": "device",
|
|
679
693
|
"local": true
|