@openchamber/web 2.0.2 → 2.0.4
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/lib/DOCUMENTATION.md +1 -1
- package/bin/lib/commands-connect-url.js +6 -5
- package/bin/lib/commands-tunnel.js +24 -5
- package/dist/assets/{CodeMirrorCommentWidgets-CmKmyb9T.js → CodeMirrorCommentWidgets-C_zL-eri.js} +1 -1
- package/dist/assets/{DiffView-8-PFpZ2p.js → DiffView-BeN2_YYF.js} +3 -3
- package/dist/assets/FilesView-CN34wm_N.js +17 -0
- package/dist/assets/{GitView-DNUSu00w.js → GitView-DLDazOo1.js} +4 -4
- package/dist/assets/{GuestAttachDialog-Cv6QzjHC.js → GuestAttachDialog-C0xe_Lyy.js} +1 -1
- package/dist/assets/{GuestSurfacePane-Bt3jB_Ye.js → GuestSurfacePane-BdaurnDr.js} +1 -1
- package/dist/assets/{JsonTreeView-BlyHTRhM.js → JsonTreeView-B1Xq-k2t.js} +1 -1
- package/dist/assets/LinearIssuesView-BryoAHow.js +1 -0
- package/dist/assets/{MarkdownImageGallery-2UXJF-5B.js → MarkdownImageGallery-DfuEoaGq.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-B_ZcWOvX.js +12 -0
- package/dist/assets/OnboardingScreen-C22bGmnP.js +1 -0
- package/dist/assets/{PatchDiff-ByvnbG5T.js → PatchDiff-0xd6UeFB.js} +1 -1
- package/dist/assets/{PierreDiffViewer-BXieg0mH.js → PierreDiffViewer-BC950e3F.js} +3 -3
- package/dist/assets/PlanView-B7Xgihqk.js +5 -0
- package/dist/assets/PluginPane-2C71F8uF.js +3 -0
- package/dist/assets/SettingsView-m_zoFiaT.js +30 -0
- package/dist/assets/{SettingsWindow-BIz224xs.js → SettingsWindow-CofS020b.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CXKmlps9.js → SubmoduleDiffSummary-BSA9gnIO.js} +1 -1
- package/dist/assets/{ToolOutputDialog-BsgAK8xu.js → ToolOutputDialog-DprkVKcj.js} +7 -7
- package/dist/assets/{ToolPartDiffPreview-vdPObXOf.js → ToolPartDiffPreview-Dq0go_fX.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-BkFNKWS5.js → VirtualizedFileDiff-Kp8hKJdT.js} +1 -1
- package/dist/assets/WalkthroughView-DGnTzqIU.js +4 -0
- package/dist/assets/{appThemeRegistry-aHUNHoqP.js → appThemeRegistry-BdEHBA4s.js} +1 -1
- package/dist/assets/{commitAndPush-Bon9r94r.js → commitAndPush-LwtVa2Oc.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-DKqr_1AQ.js → computeVirtualFileMetrics-6V1xNpO9.js} +2 -2
- package/dist/assets/de-DlgBHUAI.js +10 -0
- package/dist/assets/es-BC8G41U8.js +16 -0
- package/dist/assets/fr-I0z3vVjy.js +14 -0
- package/dist/assets/index-CgR5rJq_.js +41 -0
- package/dist/assets/{index-DpFttslC.js → index-CmNPYddV.js} +1 -1
- package/dist/assets/index-adyy_sEk.css +1 -0
- package/dist/assets/{isDiffPlainText-kzAgpIgi.js → isDiffPlainText-1bXcWCrw.js} +1 -1
- package/dist/assets/{isFilePlainText-Uj6y-jzz.js → isFilePlainText-CBAppvy1.js} +1 -1
- package/dist/assets/ja-BIElEsY8.js +16 -0
- package/dist/assets/ko-DRnnHetA.js +16 -0
- package/dist/assets/{main-CbfMxn-I.js → main-CzjTMTfW.js} +2 -2
- package/dist/assets/main-DVX34beR.js +886 -0
- package/dist/assets/markdownCore-Cxbkn5NR.js +7 -0
- package/dist/assets/{miniChat-CiAKBC10.js → miniChat-CP68IL8Q.js} +2 -2
- package/dist/assets/{mobile-CsT4sJwC.js → mobile-BrlBrNfZ.js} +2 -2
- package/dist/assets/nl-DzUV-kwp.js +16 -0
- package/dist/assets/{patchFileDiff-DeaE08W0.js → patchFileDiff-pqRSHLHI.js} +2 -2
- package/dist/assets/pl-Bb-cb7k7.js +16 -0
- package/dist/assets/pt-BR-CyIWrTcE.js +16 -0
- package/dist/assets/renderElectronMiniChatApp-DKIilR7N.js +2 -0
- package/dist/assets/renderMobileApp-B0z6-x58.js +25 -0
- package/dist/assets/runtimeEndpointReset-uu1DBwLL.js +52 -0
- package/dist/assets/{scheduledTasksApi-BZCNJ588.js → scheduledTasksApi-BuzWT445.js} +1 -1
- package/dist/assets/{shikiHighlight-BSUEa3yF.js → shikiHighlight-BWGrY5YU.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-CsATFZIV.js → textMateThemeFromAppTheme-BSUFChBY.js} +1 -1
- package/dist/assets/tr-DXEDSoYO.js +7 -0
- package/dist/assets/uk-C8hN--q_.js +16 -0
- package/dist/assets/useAppFontEffects-Dsl_sLrj.js +7366 -0
- package/dist/assets/useInlineCommentController-d5vntsQ_.js +2 -0
- package/dist/assets/{useRootScrollLock-Cp1eFoM2.js → useRootScrollLock-2rd5Y6gR.js} +2 -2
- package/dist/assets/{vendor-base-ui-CsXYnR5c.js → vendor-base-ui-DnNniUWp.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BwwommM0.js → vendor-codemirror-language-data-B1EetJur.js} +2 -2
- package/dist/assets/vendor-opencode-client-DSZl7jSi.js +12 -0
- package/dist/assets/{vendor-tanstack-react-virtual-ClYN8CzB.js → vendor-tanstack-react-virtual--0sBrLRh.js} +1 -1
- package/dist/assets/{vendor-tanstack-virtual-core-BewVQryB.js → vendor-tanstack-virtual-core-BoA4iGMw.js} +1 -1
- package/dist/assets/{vendor-zod-BSoePkpP.js → vendor-zod-CxRSdNoV.js} +4 -4
- package/dist/assets/{web-components-D3Yjr4Zx.js → web-components-ngpHPEDU.js} +1 -1
- package/dist/assets/zh-CN-CtzXdjMZ.js +16 -0
- package/dist/assets/zh-TW-Ds0CADSz.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 +5 -5
- package/server/index.js +82 -4
- package/server/lib/agent-tool/DOCUMENTATION.md +8 -1
- package/server/lib/agent-tool/runtime.js +13 -4
- package/server/lib/agent-tool/runtime.test.js +15 -0
- package/server/lib/context-obligatory/DOCUMENTATION.md +10 -7
- package/server/lib/context-obligatory/runtime.js +2 -1
- package/server/lib/context-obligatory/runtime.test.js +76 -30
- package/server/lib/dictation/DOCUMENTATION.md +4 -1
- package/server/lib/dictation/openai-compatible-session.js +7 -0
- package/server/lib/enterprise-mode.d.ts +30 -0
- package/server/lib/enterprise-mode.js +253 -0
- package/server/lib/enterprise-mode.test.js +247 -0
- package/server/lib/event-stream/translate-v2.js +6 -0
- package/server/lib/event-stream/translate-v2.test.js +6 -0
- package/server/lib/git/DOCUMENTATION.md +2 -1
- package/server/lib/git/routes.js +44 -1
- package/server/lib/git/routes.test.js +98 -1
- package/server/lib/git/service.js +146 -11
- package/server/lib/git/service.test.js +195 -0
- package/server/lib/github/routes.js +9 -19
- package/server/lib/github/routes.test.js +112 -0
- package/server/lib/guests/DOCUMENTATION.md +4 -2
- package/server/lib/guests/background.test.js +1 -1
- package/server/lib/guests/catalog.js +56 -2
- package/server/lib/guests/catalog.test.js +24 -1
- package/server/lib/guests/clone-network.test.js +52 -0
- package/server/lib/guests/clone.js +30 -4
- package/server/lib/guests/enterprise.js +68 -0
- package/server/lib/guests/enterprise.test.js +106 -0
- package/server/lib/guests/grant-scope.js +8 -2
- package/server/lib/guests/grant-scope.test.js +9 -0
- package/server/lib/guests/html-styles.js +16 -2
- package/server/lib/guests/html-styles.test.js +53 -4
- package/server/lib/guests/install.js +10 -0
- package/server/lib/guests/persist.js +1 -0
- package/server/lib/guests/routes.js +40 -5
- package/server/lib/guests/updates.js +9 -2
- package/server/lib/notifications/DOCUMENTATION.md +1 -1
- package/server/lib/notifications/runtime.js +22 -8
- package/server/lib/notifications/trigger-runtime.test.js +45 -0
- package/server/lib/openchamber-sessions/session-metadata-store.js +27 -0
- package/server/lib/openchamber-sessions/session-metadata-store.test.js +18 -0
- package/server/lib/opencode/DOCUMENTATION.md +13 -9
- package/server/lib/opencode/auth-state-runtime.js +2 -2
- package/server/lib/opencode/config-paths.test.js +1 -0
- package/server/lib/opencode/env-runtime.js +26 -3
- package/server/lib/opencode/env-runtime.test.js +57 -0
- package/server/lib/opencode/feature-routes-runtime.js +2 -0
- package/server/lib/opencode/hmr-state-runtime.js +4 -3
- package/server/lib/opencode/lifecycle.js +10 -5
- package/server/lib/opencode/lifecycle.test.js +6 -2
- package/server/lib/opencode/managed-config-file.js +2 -1
- package/server/lib/opencode/managed-config-file.test.js +18 -0
- package/server/lib/opencode/npm-registry-config.d.ts +1 -0
- package/server/lib/opencode/npm-registry-config.js +123 -0
- package/server/lib/opencode/npm-registry-config.test.js +167 -0
- package/server/lib/opencode/npm-registry.js +5 -6
- package/server/lib/opencode/npm-registry.test.js +30 -0
- package/server/lib/opencode/openchamber-routes.js +8 -0
- package/server/lib/opencode/project-icon-routes.js +2 -2
- package/server/lib/opencode/project-icon-routes.test.js +44 -0
- package/server/lib/opencode/provider-source-route.test.js +32 -0
- package/server/lib/opencode/routes.js +17 -2
- package/server/lib/opencode/settings-helpers.js +26 -3
- package/server/lib/opencode/settings-helpers.test.js +12 -5
- package/server/lib/opencode/settings-registry.json +35 -1
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/opencode/static-routes-runtime.js +9 -1
- package/server/lib/opencode/static-routes-runtime.test.js +58 -1
- package/server/lib/package-manager.js +4 -1
- package/server/lib/package-manager.test.js +24 -0
- package/server/lib/permission-auto-accept/DOCUMENTATION.md +23 -15
- package/server/lib/permission-auto-accept/modes.js +26 -0
- package/server/lib/permission-auto-accept/runtime.js +146 -40
- package/server/lib/permission-auto-accept/runtime.test.js +93 -9
- package/server/lib/quota/DOCUMENTATION.md +6 -0
- package/server/lib/quota/providers/zhipuai-coding-plan.js +74 -30
- package/server/lib/quota/providers/zhipuai-coding-plan.test.js +124 -0
- package/server/lib/relay/DOCUMENTATION.md +1 -1
- package/server/lib/relay/service.js +32 -12
- package/server/lib/relay/service.test.js +30 -0
- package/server/lib/routing/DOCUMENTATION.md +150 -41
- package/server/lib/routing/classifier.js +156 -0
- package/server/lib/routing/defaults.js +27 -0
- package/server/lib/routing/jev.js +5 -17
- package/server/lib/routing/routes.http.test.js +9 -0
- package/server/lib/routing/routes.js +27 -1
- package/server/lib/routing/runtime.js +199 -33
- package/server/lib/routing/runtime.test.js +299 -15
- package/server/lib/routing/store.js +57 -0
- package/server/lib/routing/store.test.js +37 -0
- package/server/lib/session-assist/DOCUMENTATION.md +17 -7
- package/server/lib/session-assist/context.js +42 -2
- package/server/lib/session-assist/context.test.js +38 -1
- package/server/lib/session-assist/runtime.js +57 -13
- package/server/lib/session-assist/runtime.test.js +45 -0
- package/server/lib/session-goal/DOCUMENTATION.md +47 -22
- package/server/lib/session-goal/audit.js +112 -0
- package/server/lib/session-goal/audit.test.js +58 -0
- package/server/lib/session-goal/runtime.js +113 -134
- package/server/lib/session-goal/runtime.test.js +146 -13
- package/server/lib/session-lineage.js +52 -0
- package/server/lib/session-lineage.test.js +45 -0
- package/server/lib/session-work/DOCUMENTATION.md +108 -0
- package/server/lib/session-work/questions.js +126 -0
- package/server/lib/session-work/runtime.js +278 -0
- package/server/lib/session-work/runtime.test.js +255 -0
- package/server/lib/session-work/state.js +48 -0
- package/server/lib/session-work/state.test.js +34 -0
- package/server/lib/small-model/DOCUMENTATION.md +14 -7
- package/server/lib/small-model/client.js +7 -4
- package/server/lib/small-model/index.js +11 -21
- package/server/lib/small-model/index.test.js +13 -26
- package/server/lib/spaces/DOCUMENTATION.md +79 -25
- package/server/lib/spaces/gatekeeper-channel.js +63 -11
- package/server/lib/spaces/gatekeeper-channel.test.js +34 -4
- package/server/lib/spaces/gatekeeper-program.cjs +64 -13
- package/server/lib/spaces/gatekeeper-program.test.js +115 -3
- package/server/lib/spaces/host.js +58 -13
- package/server/lib/spaces/host.test.js +34 -1
- package/server/lib/spaces/idle-stop.js +98 -0
- package/server/lib/spaces/idle-stop.test.js +130 -0
- package/server/lib/spaces/journey.js +427 -17
- package/server/lib/spaces/journey.test.js +592 -5
- package/server/lib/spaces/layout.js +27 -6
- package/server/lib/spaces/manager.test.js +1 -1
- package/server/lib/spaces/places/contract-suite.js +4 -2
- package/server/lib/spaces/places/docker-live-support.js +27 -4
- package/server/lib/spaces/places/docker.js +32 -5
- package/server/lib/spaces/places/docker.test.js +38 -8
- package/server/lib/spaces/places/escape-suite.js +32 -0
- package/server/lib/spaces/places/fake-docker.js +3 -1
- package/server/lib/spaces/places/grants.docker.live.test.js +197 -0
- package/server/lib/spaces/places/memory-place.js +3 -3
- package/server/lib/spaces/places/sessions.docker.live.test.js +4 -2
- package/server/lib/spaces/routes.js +49 -1
- package/server/lib/spaces/routes.test.js +31 -3
- package/server/lib/spaces/space-opencode.js +52 -0
- package/server/lib/spaces/space-opencode.test.js +41 -0
- package/server/lib/spaces/space-records.js +90 -2
- package/server/lib/spaces/space-records.test.js +58 -1
- package/server/lib/spaces/space-server.js +13 -1
- package/server/lib/spaces/space-server.test.js +13 -0
- package/server/lib/spaces/space-setup.js +173 -0
- package/server/lib/spaces/space-setup.test.js +174 -0
- package/server/lib/tts/DOCUMENTATION.md +3 -0
- package/server/lib/tts/base-url.js +8 -0
- package/server/lib/tts/routes.js +13 -1
- package/server/lib/tts/routes.test.js +26 -0
- package/server/lib/tunnels/DOCUMENTATION.md +2 -0
- package/server/lib/tunnels/routes.js +14 -0
- package/server/lib/tunnels/routes.test.js +26 -0
- package/server/lib/walkthrough/index.js +11 -7
- package/server/lib/walkthrough/jobs.test.js +8 -0
- package/server/lib/walkthrough/languages.js +1 -0
- package/server/lib/walkthrough/routes.js +7 -1
- package/dist/assets/FilesView-0Ie20mEk.js +0 -17
- package/dist/assets/LinearIssuesView-CSl2MUfA.js +0 -1
- package/dist/assets/MarkdownRendererImpl-DVHqZoug.js +0 -12
- package/dist/assets/OnboardingScreen-CIdXJpfc.js +0 -1
- package/dist/assets/PlanView-DEIi3Q7M.js +0 -5
- package/dist/assets/PluginPane-BEPUWVho.js +0 -3
- package/dist/assets/SettingsView-CiNh-RbW.js +0 -30
- package/dist/assets/WalkthroughView-6oE-MuDL.js +0 -4
- package/dist/assets/de-CgAJ51z7.js +0 -10
- package/dist/assets/es-zGi_ravM.js +0 -16
- package/dist/assets/fr-CPfogrWx.js +0 -14
- package/dist/assets/index-CHfphYL3.js +0 -41
- package/dist/assets/index-DvMJ3w6V.css +0 -1
- package/dist/assets/ja-DMk6wd-U.js +0 -16
- package/dist/assets/ko-BFpzJ8jc.js +0 -16
- package/dist/assets/main-anyZFMIs.js +0 -896
- package/dist/assets/markdownCore-CmM47cAE.js +0 -7
- package/dist/assets/pl-VdRPcZrB.js +0 -16
- package/dist/assets/pt-BR-BRys_lOW.js +0 -16
- package/dist/assets/renderElectronMiniChatApp-C5677jy0.js +0 -2
- package/dist/assets/renderMobileApp-D4dBBAqQ.js +0 -25
- package/dist/assets/runtimeEndpointReset-5r0hkd-2.js +0 -27
- package/dist/assets/tr-CA9ckNnm.js +0 -7
- package/dist/assets/uk-byjR-y8D.js +0 -16
- package/dist/assets/useAppFontEffects-BWQZ5DeI.js +0 -7341
- package/dist/assets/useInlineCommentController-DlFyVfBu.js +0 -2
- package/dist/assets/vendor-opencode-client-DYdsLbCM.js +0 -12
- package/dist/assets/zh-CN-DRabgxdG.js +0 -16
- package/dist/assets/zh-TW-rbY5c9UK.js +0 -16
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
5
|
+
|
|
6
|
+
import { resolveNpmRegistryRequest } from './npm-registry-config.js';
|
|
7
|
+
|
|
8
|
+
const originalLowerRegistry = process.env.npm_config_registry;
|
|
9
|
+
const originalUpperRegistry = process.env.NPM_CONFIG_REGISTRY;
|
|
10
|
+
const originalUserConfig = process.env.NPM_CONFIG_USERCONFIG;
|
|
11
|
+
const originalLowerUserConfig = process.env.npm_config_userconfig;
|
|
12
|
+
const originalPrivateRegistry = process.env.PRIVATE_NPM_REGISTRY;
|
|
13
|
+
const originalPrivateToken = process.env.PRIVATE_NPM_TOKEN;
|
|
14
|
+
const originalScopedRegistry = process.env['npm_config_@scope:registry'];
|
|
15
|
+
let userConfigPath;
|
|
16
|
+
|
|
17
|
+
describe('npm registry configuration', () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
userConfigPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'openchamber-npmrc-')), '.npmrc');
|
|
20
|
+
process.env.NPM_CONFIG_USERCONFIG = userConfigPath;
|
|
21
|
+
delete process.env.npm_config_userconfig;
|
|
22
|
+
delete process.env.npm_config_registry;
|
|
23
|
+
delete process.env.NPM_CONFIG_REGISTRY;
|
|
24
|
+
delete process.env.PRIVATE_NPM_REGISTRY;
|
|
25
|
+
delete process.env.PRIVATE_NPM_TOKEN;
|
|
26
|
+
delete process.env['npm_config_@scope:registry'];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
fs.rmSync(path.dirname(userConfigPath), { recursive: true, force: true });
|
|
31
|
+
if (originalLowerRegistry === undefined) delete process.env.npm_config_registry;
|
|
32
|
+
else process.env.npm_config_registry = originalLowerRegistry;
|
|
33
|
+
if (originalUpperRegistry === undefined) delete process.env.NPM_CONFIG_REGISTRY;
|
|
34
|
+
else process.env.NPM_CONFIG_REGISTRY = originalUpperRegistry;
|
|
35
|
+
if (originalUserConfig === undefined) delete process.env.NPM_CONFIG_USERCONFIG;
|
|
36
|
+
else process.env.NPM_CONFIG_USERCONFIG = originalUserConfig;
|
|
37
|
+
if (originalLowerUserConfig === undefined) delete process.env.npm_config_userconfig;
|
|
38
|
+
else process.env.npm_config_userconfig = originalLowerUserConfig;
|
|
39
|
+
if (originalPrivateRegistry === undefined) delete process.env.PRIVATE_NPM_REGISTRY;
|
|
40
|
+
else process.env.PRIVATE_NPM_REGISTRY = originalPrivateRegistry;
|
|
41
|
+
if (originalPrivateToken === undefined) delete process.env.PRIVATE_NPM_TOKEN;
|
|
42
|
+
else process.env.PRIVATE_NPM_TOKEN = originalPrivateToken;
|
|
43
|
+
if (originalScopedRegistry === undefined) delete process.env['npm_config_@scope:registry'];
|
|
44
|
+
else process.env['npm_config_@scope:registry'] = originalScopedRegistry;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('uses the default public registry without npm configuration', () => {
|
|
48
|
+
expect(resolveNpmRegistryRequest('@scope/pkg')).toEqual({
|
|
49
|
+
url: 'https://registry.npmjs.org/@scope%2Fpkg',
|
|
50
|
+
headers: {},
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('uses the user npm registry for an unscoped package', () => {
|
|
55
|
+
fs.writeFileSync(userConfigPath, 'registry=https://mirror.example.com/custom/npm/\n');
|
|
56
|
+
|
|
57
|
+
expect(resolveNpmRegistryRequest('private-plugin')).toEqual({
|
|
58
|
+
url: 'https://mirror.example.com/custom/npm/private-plugin',
|
|
59
|
+
headers: {},
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('prefers a scoped user registry', () => {
|
|
64
|
+
fs.writeFileSync(userConfigPath, [
|
|
65
|
+
'registry=https://mirror.example.com/npm/',
|
|
66
|
+
'@scope:registry=https://packages.example.com/npm/',
|
|
67
|
+
].join('\n'));
|
|
68
|
+
|
|
69
|
+
expect(resolveNpmRegistryRequest('@scope/plugin').url).toBe('https://packages.example.com/npm/@scope%2Fplugin');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('prefers a scoped user registry over an inherited general registry', () => {
|
|
73
|
+
fs.writeFileSync(userConfigPath, '@scope:registry=https://packages.example.com/npm/\n');
|
|
74
|
+
process.env.NPM_CONFIG_REGISTRY = 'https://inherited.example.com/npm/';
|
|
75
|
+
|
|
76
|
+
expect(resolveNpmRegistryRequest('@scope/plugin').url).toBe('https://packages.example.com/npm/@scope%2Fplugin');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('prefers a scoped inherited registry over user npm configuration', () => {
|
|
80
|
+
fs.writeFileSync(userConfigPath, 'registry=https://mirror.example.com/npm/\n');
|
|
81
|
+
process.env['npm_config_@scope:registry'] = 'https://packages.example.com/npm/';
|
|
82
|
+
|
|
83
|
+
expect(resolveNpmRegistryRequest('@scope/plugin').url).toBe('https://packages.example.com/npm/@scope%2Fplugin');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('prefers an inherited npm registry over user configuration', () => {
|
|
87
|
+
fs.writeFileSync(userConfigPath, 'registry=https://mirror.example.com/npm/\n');
|
|
88
|
+
process.env.NPM_CONFIG_REGISTRY = 'https://inherited.example.com/npm/';
|
|
89
|
+
|
|
90
|
+
expect(resolveNpmRegistryRequest('plugin').url).toBe('https://inherited.example.com/npm/plugin');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('uses a matching npm token without exposing it in the request URL', () => {
|
|
94
|
+
fs.writeFileSync(userConfigPath, [
|
|
95
|
+
'registry=https://packages.example.com/npm/',
|
|
96
|
+
'//packages.example.com/npm/:_authToken=private-token',
|
|
97
|
+
].join('\n'));
|
|
98
|
+
|
|
99
|
+
const request = resolveNpmRegistryRequest('private-plugin');
|
|
100
|
+
|
|
101
|
+
expect(request.url).toBe('https://packages.example.com/npm/private-plugin');
|
|
102
|
+
expect(request.url).not.toContain('private-token');
|
|
103
|
+
expect(request.headers).toEqual({ Authorization: 'Bearer private-token' });
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('uses npm basic authentication with its base64-encoded password', () => {
|
|
107
|
+
fs.writeFileSync(userConfigPath, [
|
|
108
|
+
'registry=https://packages.example.com/npm/',
|
|
109
|
+
'//packages.example.com/npm/:username=registry-user',
|
|
110
|
+
'//packages.example.com/npm/:_password=c2VjcmV0',
|
|
111
|
+
].join('\n'));
|
|
112
|
+
|
|
113
|
+
expect(resolveNpmRegistryRequest('private-plugin').headers).toEqual({
|
|
114
|
+
Authorization: 'Basic cmVnaXN0cnktdXNlcjpzZWNyZXQ=',
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('expands environment variables in user npm configuration', () => {
|
|
119
|
+
process.env.PRIVATE_NPM_TOKEN = 'expanded-token';
|
|
120
|
+
fs.writeFileSync(userConfigPath, [
|
|
121
|
+
'registry=${PRIVATE_NPM_REGISTRY}',
|
|
122
|
+
'//packages.example.com/npm/:_authToken=${PRIVATE_NPM_TOKEN}',
|
|
123
|
+
].join('\n'));
|
|
124
|
+
process.env.PRIVATE_NPM_REGISTRY = 'https://packages.example.com/npm/';
|
|
125
|
+
|
|
126
|
+
expect(resolveNpmRegistryRequest('private-plugin')).toEqual({
|
|
127
|
+
url: 'https://packages.example.com/npm/private-plugin',
|
|
128
|
+
headers: { Authorization: 'Bearer expanded-token' },
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('reads quoted values the way npm does', () => {
|
|
133
|
+
fs.writeFileSync(userConfigPath, [
|
|
134
|
+
'@scope:registry = "https://packages.example.com/npm/"',
|
|
135
|
+
"//packages.example.com/npm/:_authToken='quoted-token'",
|
|
136
|
+
].join('\n'));
|
|
137
|
+
|
|
138
|
+
expect(resolveNpmRegistryRequest('@scope/plugin')).toEqual({
|
|
139
|
+
url: 'https://packages.example.com/npm/@scope%2Fplugin',
|
|
140
|
+
headers: { Authorization: 'Bearer quoted-token' },
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('honors the lowercase userconfig variable npm sets for child processes', () => {
|
|
145
|
+
delete process.env.NPM_CONFIG_USERCONFIG;
|
|
146
|
+
process.env.npm_config_userconfig = userConfigPath;
|
|
147
|
+
fs.writeFileSync(userConfigPath, 'registry=https://mirror.example.com/npm/\n');
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
expect(resolveNpmRegistryRequest('plugin').url).toBe('https://mirror.example.com/npm/plugin');
|
|
151
|
+
} finally {
|
|
152
|
+
delete process.env.npm_config_userconfig;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('rejects unresolved npm configuration environment variables', () => {
|
|
157
|
+
fs.writeFileSync(userConfigPath, 'registry=${MISSING_NPM_REGISTRY}\n');
|
|
158
|
+
|
|
159
|
+
expect(() => resolveNpmRegistryRequest('private-plugin')).toThrow('Invalid npm registry URL');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('rejects malformed registry values without exposing their contents', () => {
|
|
163
|
+
fs.writeFileSync(userConfigPath, 'registry=not-a-url-private-token\n');
|
|
164
|
+
|
|
165
|
+
expect(() => resolveNpmRegistryRequest('plugin')).toThrow('Invalid npm registry URL');
|
|
166
|
+
});
|
|
167
|
+
});
|
|
@@ -2,9 +2,10 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
|
+
import { resolveNpmRegistryRequest } from './npm-registry-config.js';
|
|
6
|
+
|
|
5
7
|
const NPM_CACHE_TTL_MS = 3_600_000;
|
|
6
8
|
const NPM_FETCH_TIMEOUT_MS = 5_000;
|
|
7
|
-
const NPM_REGISTRY_BASE = 'https://registry.npmjs.org';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @typedef {Object} NpmPackagePayload
|
|
@@ -50,10 +51,6 @@ function _getUserAgent() {
|
|
|
50
51
|
return _userAgent;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
function encodeName(name) {
|
|
54
|
-
return encodeURIComponent(name).replace(/^%40/, '@');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
54
|
function parseDistTags(value) {
|
|
58
55
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
59
56
|
return {};
|
|
@@ -87,10 +84,12 @@ function cacheResult(name, payload) {
|
|
|
87
84
|
*/
|
|
88
85
|
export async function lookupNpmPackage(name) {
|
|
89
86
|
try {
|
|
90
|
-
const
|
|
87
|
+
const request = resolveNpmRegistryRequest(name);
|
|
88
|
+
const response = await fetch(request.url, {
|
|
91
89
|
headers: {
|
|
92
90
|
'User-Agent': _getUserAgent(),
|
|
93
91
|
Accept: 'application/json',
|
|
92
|
+
...request.headers,
|
|
94
93
|
},
|
|
95
94
|
signal: AbortSignal.timeout(NPM_FETCH_TIMEOUT_MS),
|
|
96
95
|
});
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import path from 'path';
|
|
2
5
|
import * as npm from './npm-registry.js';
|
|
3
6
|
|
|
4
7
|
const originalFetch = globalThis.fetch;
|
|
5
8
|
const originalDateNow = Date.now;
|
|
9
|
+
const originalUserConfig = process.env.NPM_CONFIG_USERCONFIG;
|
|
10
|
+
const originalLowerUserConfig = process.env.npm_config_userconfig;
|
|
11
|
+
const originalLowerRegistry = process.env.npm_config_registry;
|
|
12
|
+
const originalUpperRegistry = process.env.NPM_CONFIG_REGISTRY;
|
|
6
13
|
|
|
7
14
|
let fetchMock;
|
|
15
|
+
let userConfigPath;
|
|
8
16
|
|
|
9
17
|
function jsonResponse(body, status = 200) {
|
|
10
18
|
return Promise.resolve(new Response(JSON.stringify(body), {
|
|
@@ -17,6 +25,11 @@ describe('npm registry client', () => {
|
|
|
17
25
|
beforeEach(() => {
|
|
18
26
|
npm.clearCache();
|
|
19
27
|
Date.now = originalDateNow;
|
|
28
|
+
userConfigPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'openchamber-npmrc-')), '.npmrc');
|
|
29
|
+
process.env.NPM_CONFIG_USERCONFIG = userConfigPath;
|
|
30
|
+
delete process.env.npm_config_userconfig;
|
|
31
|
+
delete process.env.npm_config_registry;
|
|
32
|
+
delete process.env.NPM_CONFIG_REGISTRY;
|
|
20
33
|
fetchMock = mock(() => jsonResponse({}));
|
|
21
34
|
globalThis.fetch = fetchMock;
|
|
22
35
|
});
|
|
@@ -25,6 +38,15 @@ describe('npm registry client', () => {
|
|
|
25
38
|
npm.clearCache();
|
|
26
39
|
globalThis.fetch = originalFetch;
|
|
27
40
|
Date.now = originalDateNow;
|
|
41
|
+
fs.rmSync(path.dirname(userConfigPath), { recursive: true, force: true });
|
|
42
|
+
if (originalUserConfig === undefined) delete process.env.NPM_CONFIG_USERCONFIG;
|
|
43
|
+
else process.env.NPM_CONFIG_USERCONFIG = originalUserConfig;
|
|
44
|
+
if (originalLowerUserConfig === undefined) delete process.env.npm_config_userconfig;
|
|
45
|
+
else process.env.npm_config_userconfig = originalLowerUserConfig;
|
|
46
|
+
if (originalLowerRegistry === undefined) delete process.env.npm_config_registry;
|
|
47
|
+
else process.env.npm_config_registry = originalLowerRegistry;
|
|
48
|
+
if (originalUpperRegistry === undefined) delete process.env.NPM_CONFIG_REGISTRY;
|
|
49
|
+
else process.env.NPM_CONFIG_REGISTRY = originalUpperRegistry;
|
|
28
50
|
});
|
|
29
51
|
|
|
30
52
|
test('200 success returns latest versions and dist tags', async () => {
|
|
@@ -171,6 +193,14 @@ describe('npm registry client', () => {
|
|
|
171
193
|
expect(fetchMock.mock.calls[0][0]).toBe('https://registry.npmjs.org/@scope%2Fpkg');
|
|
172
194
|
});
|
|
173
195
|
|
|
196
|
+
test('user npm configuration changes the package metadata registry', async () => {
|
|
197
|
+
fs.writeFileSync(userConfigPath, 'registry=https://mirror.example.com/npm/\n');
|
|
198
|
+
|
|
199
|
+
await npm.getNpmInfo('private-plugin');
|
|
200
|
+
|
|
201
|
+
expect(fetchMock.mock.calls[0][0]).toBe('https://mirror.example.com/npm/private-plugin');
|
|
202
|
+
});
|
|
203
|
+
|
|
174
204
|
test('user-agent header is present', async () => {
|
|
175
205
|
await npm.getNpmInfo('foo');
|
|
176
206
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { publicEnterprisePolicy } from '../enterprise-mode.js';
|
|
2
|
+
|
|
1
3
|
const SYSTEMD_SERVICE_UNIT_PATTERN = /^[A-Za-z0-9:_.@-]+\.service$/;
|
|
2
4
|
|
|
3
5
|
function resolveSystemdServiceUnit(environment) {
|
|
@@ -91,6 +93,12 @@ export const registerOpenChamberRoutes = (app, dependencies) => {
|
|
|
91
93
|
return { storedOptions, launchMode, isForegroundService, systemdServiceUnit };
|
|
92
94
|
};
|
|
93
95
|
|
|
96
|
+
// Whether an administrator turned on enterprise mode, and by which source.
|
|
97
|
+
// Pinned endpoints and keys never leave the server.
|
|
98
|
+
app.get('/api/openchamber/enterprise-policy', (_req, res) => {
|
|
99
|
+
res.json(publicEnterprisePolicy());
|
|
100
|
+
});
|
|
101
|
+
|
|
94
102
|
app.get('/api/openchamber/update-check', async (req, res) => {
|
|
95
103
|
try {
|
|
96
104
|
const parseString = (value) => (typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined);
|
|
@@ -346,8 +346,8 @@ export const registerProjectIconRoutes = (app, dependencies) => {
|
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
const filtered = faviconCandidates
|
|
349
|
-
.filter((entry) => /(^|\/)favicon\.(ico|png|svg|jpg|jpeg|webp)$/i.test(entry.
|
|
350
|
-
.sort((a, b) => a.
|
|
349
|
+
.filter((entry) => /(^|\/)favicon\.(ico|png|svg|jpg|jpeg|webp)$/i.test(entry.relativePath))
|
|
350
|
+
.sort((a, b) => a.relativePath.length - b.relativePath.length);
|
|
351
351
|
|
|
352
352
|
const selected = filtered[0];
|
|
353
353
|
if (!selected) {
|
|
@@ -104,4 +104,48 @@ describe('project icon routes', () => {
|
|
|
104
104
|
expect(res.getHeader('Content-Type')).toBe('image/jpeg');
|
|
105
105
|
expect(res.body).toBe(jpgBytes);
|
|
106
106
|
});
|
|
107
|
+
|
|
108
|
+
it('discovers a favicon at a Windows project root', async () => {
|
|
109
|
+
const { app, getRoute } = createRouteRegistry();
|
|
110
|
+
const svgBytes = Buffer.from('svg-bytes');
|
|
111
|
+
const fsPromises = {
|
|
112
|
+
readFile: vi.fn(async () => svgBytes),
|
|
113
|
+
mkdir: vi.fn(async () => {}),
|
|
114
|
+
writeFile: vi.fn(async () => {}),
|
|
115
|
+
unlink: vi.fn(async () => {}),
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
registerProjectIconRoutes(app, {
|
|
119
|
+
fsPromises,
|
|
120
|
+
path,
|
|
121
|
+
crypto,
|
|
122
|
+
openchamberDataDir: '/tmp/openchamber-test',
|
|
123
|
+
sanitizeProjects: (projects) => projects,
|
|
124
|
+
readSettingsFromDiskMigrated: async () => ({
|
|
125
|
+
projects: [{ id: 'proj-1', path: 'C:\\repo' }],
|
|
126
|
+
}),
|
|
127
|
+
persistSettings: async () => ({ projects: [] }),
|
|
128
|
+
createFsSearchRuntime: () => ({
|
|
129
|
+
searchFilesystemFiles: async () => [
|
|
130
|
+
{
|
|
131
|
+
name: 'favicon.svg',
|
|
132
|
+
path: 'C:\\repo\\favicon.svg',
|
|
133
|
+
relativePath: 'favicon.svg',
|
|
134
|
+
extension: 'svg',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
}),
|
|
138
|
+
spawn: vi.fn(),
|
|
139
|
+
resolveGitBinaryForSpawn: vi.fn(),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const res = createMockResponse();
|
|
143
|
+
await getRoute('POST', '/api/projects/:projectId/icon/discover')({
|
|
144
|
+
params: { projectId: 'proj-1' },
|
|
145
|
+
body: {},
|
|
146
|
+
}, res);
|
|
147
|
+
|
|
148
|
+
expect(res.statusCode).toBe(200);
|
|
149
|
+
expect(res.body.discoveredPath).toBe('C:\\repo\\favicon.svg');
|
|
150
|
+
});
|
|
107
151
|
});
|
|
@@ -13,6 +13,38 @@ const createApp = (getProviderSources) => {
|
|
|
13
13
|
return app;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
describe('provider writes in enterprise mode', () => {
|
|
17
|
+
const writes = (agent) => [
|
|
18
|
+
agent.post('/api/integration/openai/connect/key').send({ key: 'sk-test' }),
|
|
19
|
+
agent.post('/api/integration/anthropic/connect/oauth').send({ methodID: 'claude-pro' }),
|
|
20
|
+
agent.post('/api/integration/anthropic/connect/oauth/att_1/complete').send({ code: 'x' }),
|
|
21
|
+
agent.post('/api/integration/github-copilot/connect/command').send({ methodID: 'cli' }),
|
|
22
|
+
agent.post('/api/experimental/integration/wellknown').send({ url: 'https://example.test' }),
|
|
23
|
+
agent.put('/api/provider').send({ providerID: 'company-ai', config: {}, scope: 'user' }),
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
it('refuses connecting a provider, adding a key, or creating a custom provider', async () => {
|
|
27
|
+
process.env.OPENCHAMBER_ENTERPRISE_MODE = '1';
|
|
28
|
+
try {
|
|
29
|
+
const agent = request(createApp(vi.fn()));
|
|
30
|
+
for (const response of await Promise.all(writes(agent))) {
|
|
31
|
+
expect(response.status).toBe(403);
|
|
32
|
+
expect(response.body.code).toBe('enterprise_mode');
|
|
33
|
+
}
|
|
34
|
+
// Removing an account only narrows access and still reaches OpenCode.
|
|
35
|
+
expect((await agent.delete('/api/credential/cred_1')).status).toBe(404);
|
|
36
|
+
} finally {
|
|
37
|
+
delete process.env.OPENCHAMBER_ENTERPRISE_MODE;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('passes the OpenCode writes on to the proxy otherwise', async () => {
|
|
42
|
+
const connect = await request(createApp(vi.fn())).post('/api/integration/openai/connect/key').send({ key: 'sk-test' });
|
|
43
|
+
// No proxy in this app: falling through reads as Express's 404.
|
|
44
|
+
expect(connect.status).toBe(404);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
16
48
|
describe('GET /api/provider/:providerId/source', () => {
|
|
17
49
|
it('returns the stored config entry next to the layer sources', async () => {
|
|
18
50
|
const stored = {
|
|
@@ -11,6 +11,7 @@ import { OPENCODE_CONFIG_DIR } from './shared.js';
|
|
|
11
11
|
import { settingsSurfaceOf } from './settings-files.js';
|
|
12
12
|
import { parseWebSearchSelection } from './config-v2.js';
|
|
13
13
|
import { getWebSearchSource, setWarmingEnabled, setWebSearchSelection } from './websearch-config.js';
|
|
14
|
+
import { ENTERPRISE_MODE_ERROR, isEnterpriseMode, isProviderConnectRequest } from '../enterprise-mode.js';
|
|
14
15
|
|
|
15
16
|
export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
16
17
|
const {
|
|
@@ -295,7 +296,19 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
295
296
|
}
|
|
296
297
|
});
|
|
297
298
|
|
|
298
|
-
|
|
299
|
+
// Enterprise mode: model providers come from the OpenCode config the
|
|
300
|
+
// administrator controls, so nothing in the app may connect a new one or
|
|
301
|
+
// add a key. These OpenCode routes otherwise reach it through the generic
|
|
302
|
+
// proxy; removing or switching an existing account stays allowed, it only
|
|
303
|
+
// narrows access. The real lock is OpenCode's `provider.use` policy.
|
|
304
|
+
const refuseInEnterpriseMode = (_req, res, next) => (
|
|
305
|
+
isEnterpriseMode() ? res.status(403).json({ error: ENTERPRISE_MODE_ERROR, code: 'enterprise_mode' }) : next()
|
|
306
|
+
);
|
|
307
|
+
app.use((req, res, next) => (
|
|
308
|
+
isProviderConnectRequest(req.method, req.path) ? refuseInEnterpriseMode(req, res, next) : next()
|
|
309
|
+
));
|
|
310
|
+
|
|
311
|
+
app.put('/api/provider', refuseInEnterpriseMode, async (req, res) => {
|
|
299
312
|
try {
|
|
300
313
|
const providerID = typeof req.body?.providerID === 'string'
|
|
301
314
|
? req.body.providerID.trim()
|
|
@@ -333,8 +346,10 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
333
346
|
}
|
|
334
347
|
}
|
|
335
348
|
|
|
349
|
+
// OpenCode 2 keeps credentials in its own store, out of this server's
|
|
350
|
+
// sight, so the form states whether one exists or follows this write.
|
|
336
351
|
const { getProviderAuth } = await getAuthLibrary();
|
|
337
|
-
const hasStoredAuth = Boolean(getProviderAuth(providerID));
|
|
352
|
+
const hasStoredAuth = req.body?.hasCredential === true || Boolean(getProviderAuth(providerID));
|
|
338
353
|
const upsertResult = upsertProviderConfig(providerID, config, directory, scope, { hasStoredAuth });
|
|
339
354
|
|
|
340
355
|
return res.json({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
|
|
3
3
|
import { isAgentMemoryFeatureAvailable } from '../agent-memory/feature-flag.js';
|
|
4
|
+
import { isPermissionMode } from '../permission-auto-accept/modes.js';
|
|
5
|
+
import { idleStopSchema } from '../spaces/idle-stop.js';
|
|
4
6
|
|
|
5
7
|
// Generated from packages/ui/src/lib/settings/registry.ts by
|
|
6
8
|
// `bun run settings-registry:generate`; `registry.test.ts` fails when stale.
|
|
@@ -270,8 +272,10 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
270
272
|
const sessions = {};
|
|
271
273
|
const sourceSessions = candidate.permissionAutoAccept.sessions;
|
|
272
274
|
if (sourceSessions && typeof sourceSessions === 'object' && !Array.isArray(sourceSessions)) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
// A mode, or a boolean from a policy written before the modes existed;
|
|
276
|
+
// the permission runtime converts those on its first read.
|
|
277
|
+
for (const [sessionId, mode] of Object.entries(sourceSessions)) {
|
|
278
|
+
if (sessionId && (typeof mode === 'boolean' || isPermissionMode(mode))) sessions[sessionId] = mode;
|
|
275
279
|
}
|
|
276
280
|
}
|
|
277
281
|
result.permissionAutoAccept = {
|
|
@@ -282,6 +286,9 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
282
286
|
: 0,
|
|
283
287
|
};
|
|
284
288
|
}
|
|
289
|
+
if (isPermissionMode(candidate.permissionDefaultMode)) {
|
|
290
|
+
result.permissionDefaultMode = candidate.permissionDefaultMode;
|
|
291
|
+
}
|
|
285
292
|
if (typeof candidate.desktopUiPassword === 'string') {
|
|
286
293
|
result.desktopUiPassword = candidate.desktopUiPassword.trim();
|
|
287
294
|
}
|
|
@@ -412,9 +419,18 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
412
419
|
if (typeof candidate.sessionSuggestionEnabled === 'boolean') {
|
|
413
420
|
result.sessionSuggestionEnabled = candidate.sessionSuggestionEnabled;
|
|
414
421
|
}
|
|
422
|
+
if (typeof candidate.sessionWorkEnabled === 'boolean') {
|
|
423
|
+
result.sessionWorkEnabled = candidate.sessionWorkEnabled;
|
|
424
|
+
}
|
|
425
|
+
if (typeof candidate.sessionWorkAutoOpen === 'boolean') {
|
|
426
|
+
result.sessionWorkAutoOpen = candidate.sessionWorkAutoOpen;
|
|
427
|
+
}
|
|
415
428
|
if (typeof candidate.sessionGoalEnabled === 'boolean') {
|
|
416
429
|
result.sessionGoalEnabled = candidate.sessionGoalEnabled;
|
|
417
430
|
}
|
|
431
|
+
if (candidate.sessionGoalChecker === 'classifier' || candidate.sessionGoalChecker === 'small-model') {
|
|
432
|
+
result.sessionGoalChecker = candidate.sessionGoalChecker;
|
|
433
|
+
}
|
|
418
434
|
if (typeof candidate.sessionGoalDefaultBudgetEnabled === 'boolean') {
|
|
419
435
|
result.sessionGoalDefaultBudgetEnabled = candidate.sessionGoalDefaultBudgetEnabled;
|
|
420
436
|
}
|
|
@@ -614,9 +630,15 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
614
630
|
if (typeof candidate.agentNotifyToolEnabled === 'boolean') {
|
|
615
631
|
result.agentNotifyToolEnabled = candidate.agentNotifyToolEnabled;
|
|
616
632
|
}
|
|
633
|
+
if (typeof candidate.agentToolsCodeMode === 'boolean') {
|
|
634
|
+
result.agentToolsCodeMode = candidate.agentToolsCodeMode;
|
|
635
|
+
}
|
|
617
636
|
if (typeof candidate.isolatedSpacesEnabled === 'boolean') {
|
|
618
637
|
result.isolatedSpacesEnabled = candidate.isolatedSpacesEnabled;
|
|
619
638
|
}
|
|
639
|
+
if (idleStopSchema.safeParse(candidate.isolatedSpacesIdleStop).success) {
|
|
640
|
+
result.isolatedSpacesIdleStop = { ...candidate.isolatedSpacesIdleStop };
|
|
641
|
+
}
|
|
620
642
|
if (typeof candidate.openCodeUpdateToastDismissedVersion === 'string') {
|
|
621
643
|
const version = candidate.openCodeUpdateToastDismissedVersion.trim();
|
|
622
644
|
result.openCodeUpdateToastDismissedVersion = version.slice(0, VERSION_STRING_MAX_LENGTH);
|
|
@@ -1038,7 +1060,8 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
1038
1060
|
desktopLanAccessActive: process.env.OPENCHAMBER_DESKTOP_LAN_ACCESS_ACTIVE === 'true',
|
|
1039
1061
|
desktopLanAccessBlockedReason:
|
|
1040
1062
|
process.env.OPENCHAMBER_DESKTOP_LAN_ACCESS_BLOCKED_REASON === 'missing-password'
|
|
1041
|
-
|
|
1063
|
+
|| process.env.OPENCHAMBER_DESKTOP_LAN_ACCESS_BLOCKED_REASON === 'enterprise-mode'
|
|
1064
|
+
? process.env.OPENCHAMBER_DESKTOP_LAN_ACCESS_BLOCKED_REASON
|
|
1042
1065
|
: null,
|
|
1043
1066
|
}
|
|
1044
1067
|
: {}),
|
|
@@ -408,16 +408,23 @@ describe('settings helpers', () => {
|
|
|
408
408
|
|
|
409
409
|
expect(helpers.sanitizeSettingsUpdate({
|
|
410
410
|
permissionAutoAccept: {
|
|
411
|
-
sessions: { root: true, child: false, invalid: 'true' },
|
|
411
|
+
sessions: { root: true, child: false, guarded: 'safety', open: 'auto', manual: 'ask', invalid: 'true' },
|
|
412
412
|
},
|
|
413
413
|
})).toEqual({
|
|
414
414
|
permissionAutoAccept: {
|
|
415
|
-
sessions: { root: true, child: false },
|
|
415
|
+
sessions: { root: true, child: false, guarded: 'safety', open: 'auto', manual: 'ask' },
|
|
416
416
|
revision: 0,
|
|
417
417
|
},
|
|
418
418
|
});
|
|
419
419
|
});
|
|
420
420
|
|
|
421
|
+
it('accepts only a known default permission mode', () => {
|
|
422
|
+
const helpers = createTestHelpers();
|
|
423
|
+
|
|
424
|
+
expect(helpers.sanitizeSettingsUpdate({ permissionDefaultMode: 'safety' })).toEqual({ permissionDefaultMode: 'safety' });
|
|
425
|
+
expect(helpers.sanitizeSettingsUpdate({ permissionDefaultMode: 'always' })).toEqual({});
|
|
426
|
+
});
|
|
427
|
+
|
|
421
428
|
it('accepts desktopUiPassword as a persisted shared setting', () => {
|
|
422
429
|
const helpers = createTestHelpers();
|
|
423
430
|
|
|
@@ -763,8 +770,8 @@ describe('settings registry gate', () => {
|
|
|
763
770
|
securityScopedBookmarks: ['bookmark'], pinnedDirectories: ['/home/testuser/project'],
|
|
764
771
|
desktopLanAccessEnabled: true, desktopKeepAwakeEnabled: true, desktopMinimizeToTrayEnabled: true, desktopMacMenuBarEnabled: true,
|
|
765
772
|
desktopUiPassword: 'secret', githubClientId: 'client', githubScopes: 'repo', skillCatalogs: [{ id: 'c', label: 'C', source: 'https://x' }],
|
|
766
|
-
defaultGitIdentityId: 'global', permissionAutoAccept: { sessions: { s: true }, revision: 1 },
|
|
767
|
-
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, agentNotifyToolEnabled: true, isolatedSpacesEnabled: true, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
773
|
+
defaultGitIdentityId: 'global', permissionAutoAccept: { sessions: { s: true }, revision: 1 }, permissionDefaultMode: 'safety',
|
|
774
|
+
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, agentNotifyToolEnabled: true, agentToolsCodeMode: true, isolatedSpacesEnabled: true, isolatedSpacesIdleStop: { enabled: true, hours: 4 }, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
768
775
|
autoDeleteEnabled: true, autoDeleteAfterDays: 30, sessionRetentionOnlyArchived: false, sessionRetentionAction: 'archive', terminalShell: 'zsh', terminalLoginShells: ['zsh'],
|
|
769
776
|
openInAppId: 'vscode', dictationEnabled: true, sttProvider: 'local', sttServerUrl: 'http://localhost:8001/v1', sttModel: 'm', sttLocalModel: 'm', sttLanguage: 'en',
|
|
770
777
|
tunnelProvider: 'cloudflare', tunnelMode: 'quick', tunnelBootstrapTtlMs: 600000, tunnelSessionTtlMs: 86400000, managedLocalTunnelConfigPath: '/tmp/x',
|
|
@@ -788,7 +795,7 @@ describe('settings registry gate', () => {
|
|
|
788
795
|
walkthroughModelOverride: 'anthropic/claude', zenModel: 'zen/model',
|
|
789
796
|
favoriteModels: [{ providerID: 'anthropic', modelID: 'claude' }], hiddenModels: [{ providerID: 'openai', modelID: 'gpt' }], collapsedModelProviders: ['openai'],
|
|
790
797
|
recentModels: [{ providerID: 'anthropic', modelID: 'claude' }], recentAgents: ['build'], recentEfforts: { 'anthropic/claude': ['high'] }, providerOrder: ['anthropic'],
|
|
791
|
-
sessionRecapEnabled: true, sessionSuggestionEnabled: true, sessionGoalEnabled: true, sessionGoalDefaultBudgetEnabled: true, sessionGoalDefaultBudget: 5,
|
|
798
|
+
sessionRecapEnabled: true, sessionSuggestionEnabled: true, sessionWorkEnabled: true, sessionWorkAutoOpen: true, sessionGoalEnabled: true, sessionGoalChecker: 'small-model', sessionGoalDefaultBudgetEnabled: true, sessionGoalDefaultBudget: 5,
|
|
792
799
|
summarizeLastMessage: true, summaryThreshold: 100, summaryLength: 50, maxLastMessageLength: 200, showDeletionDialog: true,
|
|
793
800
|
nativeNotificationsEnabled: true, notificationMode: 'always', notifyOnSubtasks: true, notifyOnCompletion: true, notifyOnError: true, notifyOnQuestion: true,
|
|
794
801
|
notificationTemplates: { completion: { title: 't', message: 'm' } }, showOpenCodeUpdateNotifications: true, reportUsage: true,
|
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"permissionAutoAccept": {
|
|
115
115
|
"scope": "instance"
|
|
116
116
|
},
|
|
117
|
+
"permissionDefaultMode": {
|
|
118
|
+
"scope": "instance",
|
|
119
|
+
"surfaces": [
|
|
120
|
+
"web",
|
|
121
|
+
"desktop",
|
|
122
|
+
"mobile"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
117
125
|
"agentControlToolEnabled": {
|
|
118
126
|
"scope": "instance"
|
|
119
127
|
},
|
|
@@ -126,12 +134,18 @@
|
|
|
126
134
|
"agentNotifyToolEnabled": {
|
|
127
135
|
"scope": "instance"
|
|
128
136
|
},
|
|
137
|
+
"agentToolsCodeMode": {
|
|
138
|
+
"scope": "instance"
|
|
139
|
+
},
|
|
129
140
|
"agentMemoryToolEnabled": {
|
|
130
141
|
"scope": "instance"
|
|
131
142
|
},
|
|
132
143
|
"isolatedSpacesEnabled": {
|
|
133
144
|
"scope": "instance"
|
|
134
145
|
},
|
|
146
|
+
"isolatedSpacesIdleStop": {
|
|
147
|
+
"scope": "instance"
|
|
148
|
+
},
|
|
135
149
|
"agentMemoryFeatureAvailable": {
|
|
136
150
|
"scope": "instance",
|
|
137
151
|
"computed": true
|
|
@@ -232,7 +246,8 @@
|
|
|
232
246
|
"scope": "profile"
|
|
233
247
|
},
|
|
234
248
|
"sidebarShowRecentSection": {
|
|
235
|
-
"scope": "profile"
|
|
249
|
+
"scope": "profile",
|
|
250
|
+
"perSurface": true
|
|
236
251
|
},
|
|
237
252
|
"workStatusSectionOrder": {
|
|
238
253
|
"scope": "profile"
|
|
@@ -473,9 +488,28 @@
|
|
|
473
488
|
"sessionSuggestionEnabled": {
|
|
474
489
|
"scope": "profile"
|
|
475
490
|
},
|
|
491
|
+
"sessionWorkEnabled": {
|
|
492
|
+
"scope": "profile"
|
|
493
|
+
},
|
|
494
|
+
"sessionWorkAutoOpen": {
|
|
495
|
+
"scope": "profile",
|
|
496
|
+
"surfaces": [
|
|
497
|
+
"web",
|
|
498
|
+
"desktop",
|
|
499
|
+
"mobile"
|
|
500
|
+
]
|
|
501
|
+
},
|
|
476
502
|
"sessionGoalEnabled": {
|
|
477
503
|
"scope": "profile"
|
|
478
504
|
},
|
|
505
|
+
"sessionGoalChecker": {
|
|
506
|
+
"scope": "profile",
|
|
507
|
+
"surfaces": [
|
|
508
|
+
"web",
|
|
509
|
+
"desktop",
|
|
510
|
+
"mobile"
|
|
511
|
+
]
|
|
512
|
+
},
|
|
479
513
|
"sessionGoalDefaultBudgetEnabled": {
|
|
480
514
|
"scope": "profile"
|
|
481
515
|
},
|
|
@@ -9,6 +9,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
9
9
|
openCodeWatcherRuntime,
|
|
10
10
|
sessionRuntime,
|
|
11
11
|
sessionAssistRuntime,
|
|
12
|
+
sessionWorkRuntime,
|
|
12
13
|
sessionGoalRuntime,
|
|
13
14
|
contextObligatoryRuntime,
|
|
14
15
|
messageQueueRuntime,
|
|
@@ -82,6 +83,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
82
83
|
() => openCodeWatcherRuntime.stop(),
|
|
83
84
|
() => sessionRuntime.dispose(),
|
|
84
85
|
() => sessionAssistRuntime?.stop?.(),
|
|
86
|
+
() => sessionWorkRuntime?.stop?.(),
|
|
85
87
|
() => sessionGoalRuntime?.stop?.(),
|
|
86
88
|
() => contextObligatoryRuntime?.stop?.(),
|
|
87
89
|
() => messageQueueRuntime?.stop?.(),
|