@openchamber/web 1.14.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.test.js +8 -0
- package/bin/lib/DOCUMENTATION.md +3 -0
- package/bin/lib/cli-args.js +10 -0
- package/bin/lib/commands-connect-url.js +169 -22
- package/dist/assets/{DiagramView-Cb58svCq.js → DiagramView-he_RFVx5.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-CdBIHSPZ.js +11 -0
- package/dist/assets/{MultiRunWindow-BPSxV_B7.js → MultiRunWindow-B_C-tvVq.js} +1 -1
- package/dist/assets/OnboardingScreen-BBnTt-9w.js +1 -0
- package/dist/assets/SessionSwitcherDropdown-CWWrCFzr.js +1 -0
- package/dist/assets/SettingsWindow-CjqLdpTE.js +1 -0
- package/dist/assets/{TerminalView-fTYjnQkh.js → TerminalView-DQcdegHp.js} +1 -1
- package/dist/assets/es-r0_jT91q.js +15 -0
- package/dist/assets/fr-Bo8rtAJ1.js +13 -0
- package/dist/assets/index-8J6waVO6.js +2 -0
- package/dist/assets/index-DEMqM4Lz.css +1 -0
- package/dist/assets/ja-BPWtkG-c.js +15 -0
- package/dist/assets/ko-Bv0k-0E3.js +15 -0
- package/dist/assets/main-B-GA5Tg5.js +237 -0
- package/dist/assets/main-Dfm-VKZ9.js +2 -0
- package/dist/assets/miniChat-CfmCFFfu.js +2 -0
- package/dist/assets/mobile-CXJqeDlm.js +2 -0
- package/dist/assets/pl-CiTP50bz.js +15 -0
- package/dist/assets/pt-BR-DadIjX5L.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-DS7Dy2ii.js +2 -0
- package/dist/assets/renderMobileApp-o7Fs9EBx.js +16 -0
- package/dist/assets/runtimeEndpointReset-MTaPPm4F.js +167 -0
- package/dist/assets/uk-2RpsWGoZ.js +15 -0
- package/dist/assets/{useAppFontEffects-BUUJYbAZ.js → useAppFontEffects-DkPuAMXD.js} +196 -133
- package/dist/assets/{vendor-.bun-C6iL44L9.js → vendor-.bun-BE757pvp.js} +1 -1
- package/dist/assets/zh-CN-BwKWaTuz.js +15 -0
- package/dist/assets/zh-TW--f_BqBpD.js +15 -0
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +2 -2
- package/server/index.js +236 -2
- package/server/lib/client-auth/pairing.js +308 -0
- package/server/lib/client-auth/pairing.test.js +142 -0
- package/server/lib/client-auth/remote-clients.js +65 -3
- package/server/lib/notifications/DOCUMENTATION.md +1 -1
- package/server/lib/notifications/apns-runtime.js +11 -16
- package/server/lib/notifications/runtime.js +135 -33
- package/server/lib/opencode/DOCUMENTATION.md +1 -0
- package/server/lib/opencode/agents.js +3 -0
- package/server/lib/opencode/bootstrap-runtime.js +15 -0
- package/server/lib/opencode/core-routes.js +321 -8
- package/server/lib/opencode/core-routes.test.js +329 -9
- package/server/lib/opencode/feature-routes-runtime.js +6 -0
- package/server/lib/opencode/network-runtime.js +14 -1
- package/server/lib/opencode/network-runtime.test.js +29 -9
- package/server/lib/opencode/proxy.js +47 -6
- package/server/lib/opencode/settings-helpers.js +24 -0
- package/server/lib/opencode/settings-helpers.test.js +25 -0
- package/server/lib/opencode/settings-normalization-runtime.js +21 -4
- package/server/lib/opencode/settings-normalization-runtime.test.js +21 -0
- package/server/lib/opencode/settings-runtime.js +25 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/opencode/tunnel-auth.js +4 -9
- package/server/lib/package-manager.js +18 -5
- package/server/lib/permission-auto-accept/DOCUMENTATION.md +34 -0
- package/server/lib/permission-auto-accept/runtime.js +263 -0
- package/server/lib/permission-auto-accept/runtime.test.js +137 -0
- package/server/lib/projects/project-config.js +8 -0
- package/server/lib/quota/DOCUMENTATION.md +5 -2
- package/server/lib/quota/credentials/providers.js +43 -0
- package/server/lib/quota/credentials/store.js +48 -0
- package/server/lib/quota/credentials/store.test.js +26 -0
- package/server/lib/quota/opencode-go-credentials.js +11 -0
- package/server/lib/quota/opencode-go-credentials.test.js +32 -0
- package/server/lib/quota/providers/codex.js +7 -4
- package/server/lib/quota/providers/codex.test.js +48 -0
- package/server/lib/quota/providers/cursor.js +28 -39
- package/server/lib/quota/providers/index.js +7 -0
- package/server/lib/quota/providers/ollama-cloud.js +23 -42
- package/server/lib/quota/providers/ollama-cloud.test.js +12 -0
- package/server/lib/quota/providers/opencode-go.js +70 -0
- package/server/lib/quota/providers/opencode-go.test.js +17 -0
- package/server/lib/quota/routes.js +78 -7
- package/server/lib/quota/routes.test.js +40 -0
- package/server/lib/relay/DOCUMENTATION.md +98 -0
- package/server/lib/relay/cross-compat.test.js +135 -0
- package/server/lib/relay/e2ee.js +341 -0
- package/server/lib/relay/e2ee.test.js +124 -0
- package/server/lib/relay/host-client.js +389 -0
- package/server/lib/relay/host-client.test.js +280 -0
- package/server/lib/relay/host-lock.js +101 -0
- package/server/lib/relay/host-lock.test.js +129 -0
- package/server/lib/relay/identity.js +93 -0
- package/server/lib/relay/identity.test.js +78 -0
- package/server/lib/relay/service.js +334 -0
- package/server/lib/relay/signing-key.js +73 -0
- package/server/lib/relay/tunnel-codec.js +373 -0
- package/server/lib/relay/tunnel-codec.test.js +58 -0
- package/server/lib/relay/tunnel-host.js +462 -0
- package/server/lib/scheduled-tasks/runtime.js +104 -0
- package/server/lib/session-goal/DOCUMENTATION.md +176 -0
- package/server/lib/session-goal/objectives.js +61 -0
- package/server/lib/session-goal/routes.js +36 -0
- package/server/lib/session-goal/runtime.js +764 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +6 -0
- package/server/lib/ui-auth/ui-auth.js +10 -0
- package/server/opencode-proxy.test.js +38 -0
- package/dist/assets/MarkdownRendererImpl-D2yCDL5A.js +0 -7
- package/dist/assets/OnboardingScreen-Sl-6JgaP.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-4FWg9xMC.js +0 -1
- package/dist/assets/SettingsWindow-CY8q4msv.js +0 -1
- package/dist/assets/es-bWcuDy_2.js +0 -15
- package/dist/assets/fr-DzRs3OzV.js +0 -13
- package/dist/assets/index-KnWk9fmM.css +0 -1
- package/dist/assets/index-ZJTzZ0_U.js +0 -2
- package/dist/assets/ja-BqUX_UD3.js +0 -15
- package/dist/assets/ko-BQo10SNx.js +0 -15
- package/dist/assets/main-BDoqLlQB.js +0 -236
- package/dist/assets/main-DUGyTrDt.js +0 -2
- package/dist/assets/miniChat-DNDiX8GA.js +0 -2
- package/dist/assets/mobile-DnghtOCb.js +0 -2
- package/dist/assets/pl-Bgx_ATJT.js +0 -15
- package/dist/assets/pt-BR-B1yXRvoX.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-BB4C1K7t.js +0 -2
- package/dist/assets/renderMobileApp-CZgaXKi5.js +0 -16
- package/dist/assets/runtimeEndpointReset-By39StyB.js +0 -167
- package/dist/assets/uk-C9k8SP8q.js +0 -15
- package/dist/assets/zh-CN-Bri-Vo5y.js +0 -15
- package/dist/assets/zh-TW-DAUGzmYG.js +0 -15
|
@@ -68,13 +68,28 @@ export const createSettingsNormalizationRuntime = (dependencies) => {
|
|
|
68
68
|
return trimmed;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// Normalize Windows drive letter to uppercase to ensure consistent
|
|
72
|
+
// case across all path representations on Windows. NTFS is case-insensitive
|
|
73
|
+
// but case-preserving, so a path like "c:\\Users\\..." and "C:\\Users\\..."
|
|
74
|
+
// would be stored differently in settings.json across sessions.
|
|
75
|
+
const uppercaseDriveLetter = (p) =>
|
|
76
|
+
p.replace(/^([a-z]):/, (_, letter) => letter.toUpperCase() + ':');
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
const isWindows = processLike.platform === 'win32';
|
|
79
|
+
const caseNormalized = isWindows ? uppercaseDriveLetter(trimmed) : trimmed;
|
|
80
|
+
const resolved = options.resolveRealpath === false ? caseNormalized : safeRealpathSync(caseNormalized);
|
|
81
|
+
|
|
82
|
+
// Re-normalize after realpath — safeRealpathSync may return a
|
|
83
|
+
// lowercase drive letter on some Windows environments.
|
|
84
|
+
const finalResolved = isWindows && typeof resolved === 'string'
|
|
85
|
+
? uppercaseDriveLetter(resolved)
|
|
86
|
+
: resolved;
|
|
87
|
+
|
|
88
|
+
if (!isWindows) {
|
|
89
|
+
return finalResolved;
|
|
75
90
|
}
|
|
76
91
|
|
|
77
|
-
return
|
|
92
|
+
return finalResolved.replace(/\//g, '\\');
|
|
78
93
|
};
|
|
79
94
|
|
|
80
95
|
const areStringArraysEqual = (a, b) => {
|
|
@@ -139,6 +154,7 @@ export const createSettingsNormalizationRuntime = (dependencies) => {
|
|
|
139
154
|
: null;
|
|
140
155
|
const iconBackground = normalizeIconBackground(candidate.iconBackground);
|
|
141
156
|
const color = typeof candidate.color === 'string' ? candidate.color.trim() : '';
|
|
157
|
+
const defaultModel = typeof candidate.defaultModel === 'string' ? candidate.defaultModel.trim() : '';
|
|
142
158
|
const addedAt = Number.isFinite(candidate.addedAt) ? Number(candidate.addedAt) : null;
|
|
143
159
|
const lastOpenedAt = Number.isFinite(candidate.lastOpenedAt)
|
|
144
160
|
? Number(candidate.lastOpenedAt)
|
|
@@ -158,6 +174,7 @@ export const createSettingsNormalizationRuntime = (dependencies) => {
|
|
|
158
174
|
...(icon ? { icon } : {}),
|
|
159
175
|
...(iconBackground ? { iconBackground } : {}),
|
|
160
176
|
...(color ? { color } : {}),
|
|
177
|
+
...(defaultModel && defaultModel.includes('/') ? { defaultModel } : {}),
|
|
161
178
|
...(Number.isFinite(addedAt) && addedAt >= 0 ? { addedAt } : {}),
|
|
162
179
|
...(Number.isFinite(lastOpenedAt) && lastOpenedAt >= 0 ? { lastOpenedAt } : {}),
|
|
163
180
|
};
|
|
@@ -52,6 +52,27 @@ describe('settings normalization runtime - symlink resolution', () => {
|
|
|
52
52
|
const result = runtime.normalizePathForPersistence('/some/path');
|
|
53
53
|
expect(result).toBe('/some/path');
|
|
54
54
|
});
|
|
55
|
+
|
|
56
|
+
it('preserves lowercase colon-prefixed paths on non-Windows platforms', () => {
|
|
57
|
+
const runtime = createTestRuntime({ realpathSync: undefined });
|
|
58
|
+
|
|
59
|
+
expect(runtime.normalizePathForPersistence('c:project')).toBe('c:project');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('uppercases Windows drive letter before and after realpath resolution', () => {
|
|
63
|
+
const runtime = createTestRuntime({
|
|
64
|
+
processLike: { platform: 'win32', env: {} },
|
|
65
|
+
realpathSync: (p) => {
|
|
66
|
+
// Simulate safeRealpathSync returning a lowercase drive letter
|
|
67
|
+
if (p === 'C:\\Users\\me\\project') return 'c:\\real\\project';
|
|
68
|
+
return p;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const result = runtime.normalizePathForPersistence('c:\\Users\\me\\project');
|
|
73
|
+
// Drive letter uppercased on input AND after realpath
|
|
74
|
+
expect(result).toBe('C:\\real\\project');
|
|
75
|
+
});
|
|
55
76
|
});
|
|
56
77
|
|
|
57
78
|
describe('sanitizeProjects', () => {
|
|
@@ -438,6 +438,30 @@ export const createSettingsRuntime = (deps) => {
|
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
+
// Strict variant for callers that REGENERATE persisted identity when a key is
|
|
442
|
+
// absent (relay signing/encryption keys). The lenient reader above maps every
|
|
443
|
+
// failure — corrupt JSON, EACCES, transient I/O — to `{}`, which such callers
|
|
444
|
+
// cannot distinguish from "first run": they would mint a NEW identity, orphan
|
|
445
|
+
// every paired device and push binding, and overwrite the settings file with
|
|
446
|
+
// the empty spread. Here only a genuinely missing file means "no settings";
|
|
447
|
+
// any other failure (including a non-object payload) throws.
|
|
448
|
+
const readSettingsFromDiskStrict = async () => {
|
|
449
|
+
let raw;
|
|
450
|
+
try {
|
|
451
|
+
raw = await fsPromises.readFile(SETTINGS_FILE_PATH, 'utf8');
|
|
452
|
+
} catch (error) {
|
|
453
|
+
if (error && typeof error === 'object' && error.code === 'ENOENT') {
|
|
454
|
+
return {};
|
|
455
|
+
}
|
|
456
|
+
throw error;
|
|
457
|
+
}
|
|
458
|
+
const parsed = JSON.parse(raw);
|
|
459
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
460
|
+
throw new Error('Settings file is malformed (non-object payload)');
|
|
461
|
+
}
|
|
462
|
+
return parsed;
|
|
463
|
+
};
|
|
464
|
+
|
|
441
465
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
442
466
|
|
|
443
467
|
const isTransientWindowsReplaceError = (error) => {
|
|
@@ -870,6 +894,7 @@ export const createSettingsRuntime = (deps) => {
|
|
|
870
894
|
|
|
871
895
|
return {
|
|
872
896
|
readSettingsFromDisk,
|
|
897
|
+
readSettingsFromDiskStrict,
|
|
873
898
|
readSettingsFromDiskMigrated,
|
|
874
899
|
writeSettingsToDisk,
|
|
875
900
|
persistSettings,
|
|
@@ -9,6 +9,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
9
9
|
openCodeWatcherRuntime,
|
|
10
10
|
sessionRuntime,
|
|
11
11
|
sessionAssistRuntime,
|
|
12
|
+
sessionGoalRuntime,
|
|
12
13
|
scheduledTasksRuntime,
|
|
13
14
|
getHealthCheckInterval,
|
|
14
15
|
clearHealthCheckInterval,
|
|
@@ -43,6 +44,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
43
44
|
openCodeWatcherRuntime.stop();
|
|
44
45
|
sessionRuntime.dispose();
|
|
45
46
|
sessionAssistRuntime?.stop?.();
|
|
47
|
+
sessionGoalRuntime?.stop?.();
|
|
46
48
|
scheduledTasksRuntime?.stop?.();
|
|
47
49
|
|
|
48
50
|
const healthCheckInterval = getHealthCheckInterval();
|
|
@@ -172,15 +172,10 @@ const isLocalHost = (host, req) => {
|
|
|
172
172
|
return false;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (host === 'host.docker.internal') {
|
|
180
|
-
return isPrivateOrLoopbackIp(getSocketRemoteIp(req));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return false;
|
|
175
|
+
const isLocalHostname = host === 'localhost'
|
|
176
|
+
|| host === 'host.docker.internal'
|
|
177
|
+
|| isPrivateOrLoopbackIp(host);
|
|
178
|
+
return isLocalHostname && isPrivateOrLoopbackIp(getSocketRemoteIp(req));
|
|
184
179
|
};
|
|
185
180
|
|
|
186
181
|
const getClientIp = (req) => {
|
|
@@ -12,6 +12,7 @@ const PACKAGE_NAME = '@openchamber/web';
|
|
|
12
12
|
const PACKAGE_PATH_SEGMENTS = PACKAGE_NAME.split('/');
|
|
13
13
|
const NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
14
14
|
const CHANGELOG_URL = 'https://raw.githubusercontent.com/btriapitsyn/openchamber/main/CHANGELOG.md';
|
|
15
|
+
const GITHUB_RELEASES_URL = 'https://github.com/openchamber/openchamber/releases';
|
|
15
16
|
let cachedDetectedPm = null;
|
|
16
17
|
|
|
17
18
|
function getSpawnSyncBaseOptions() {
|
|
@@ -29,7 +30,7 @@ function getOpenChamberConfigDir() {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
function sanitizeInstallScope(scope) {
|
|
32
|
-
if (scope === 'desktop-electron' || scope === 'vscode' || scope === 'web') return scope;
|
|
33
|
+
if (scope === 'desktop-electron' || scope === 'vscode' || scope === 'web' || scope === 'mobile-capacitor') return scope;
|
|
33
34
|
return 'web';
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -65,7 +66,7 @@ function mapArch(value) {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
function normalizeAppType(value) {
|
|
68
|
-
if (value === 'web' || value === 'desktop-electron' || value === 'vscode') return value;
|
|
69
|
+
if (value === 'web' || value === 'desktop-electron' || value === 'vscode' || value === 'mobile-capacitor') return value;
|
|
69
70
|
return 'web';
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -75,7 +76,7 @@ function normalizeDeviceClass(value) {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
function normalizePlatform(value) {
|
|
78
|
-
if (value === 'macos' || value === 'windows' || value === 'linux' || value === 'web') return value;
|
|
79
|
+
if (value === 'macos' || value === 'windows' || value === 'linux' || value === 'web' || value === 'android' || value === 'ios') return value;
|
|
79
80
|
return mapPlatform(process.platform);
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -89,8 +90,9 @@ async function checkForUpdatesFromApi(currentVersion, options = {}) {
|
|
|
89
90
|
const appType = normalizeAppType(options.appType);
|
|
90
91
|
const hostPlatform = mapPlatform(process.platform);
|
|
91
92
|
const hostArch = mapArch(process.arch);
|
|
92
|
-
const
|
|
93
|
-
const
|
|
93
|
+
const shouldTrustClientPlatform = appType === 'vscode' || appType === 'mobile-capacitor';
|
|
94
|
+
const platform = shouldTrustClientPlatform ? normalizePlatform(options.platform) : hostPlatform;
|
|
95
|
+
const arch = shouldTrustClientPlatform ? normalizeArch(options.arch) : hostArch;
|
|
94
96
|
const payload = {
|
|
95
97
|
appType,
|
|
96
98
|
deviceClass: normalizeDeviceClass(options.deviceClass),
|
|
@@ -120,11 +122,19 @@ async function checkForUpdatesFromApi(currentVersion, options = {}) {
|
|
|
120
122
|
const versionComparison = compareVersions(data.latestVersion, currentVersion);
|
|
121
123
|
if (versionComparison < 0) return null;
|
|
122
124
|
|
|
125
|
+
const releaseUrl = `${GITHUB_RELEASES_URL}/tag/v${data.latestVersion}`;
|
|
126
|
+
const downloadUrl = typeof data.downloadUrl === 'string'
|
|
127
|
+
? data.downloadUrl
|
|
128
|
+
: typeof data.download?.url === 'string'
|
|
129
|
+
? data.download.url
|
|
130
|
+
: undefined;
|
|
123
131
|
return {
|
|
124
132
|
available: Boolean(data.updateAvailable) && versionComparison > 0,
|
|
125
133
|
version: data.latestVersion,
|
|
126
134
|
currentVersion,
|
|
127
135
|
body: typeof data.releaseNotes === 'string' ? data.releaseNotes : undefined,
|
|
136
|
+
releaseUrl: typeof data.releaseNotesUrl === 'string' ? data.releaseNotesUrl : releaseUrl,
|
|
137
|
+
downloadUrl: appType === 'mobile-capacitor' ? (downloadUrl || releaseUrl) : undefined,
|
|
128
138
|
nextSuggestedCheckInSec:
|
|
129
139
|
typeof data.nextSuggestedCheckInSec === 'number' && Number.isFinite(data.nextSuggestedCheckInSec)
|
|
130
140
|
? data.nextSuggestedCheckInSec
|
|
@@ -721,6 +731,7 @@ export async function checkForUpdates(options = {}) {
|
|
|
721
731
|
const currentVersion = options.currentVersion || getCurrentVersion();
|
|
722
732
|
const pm = detectPackageManager();
|
|
723
733
|
const appType = normalizeAppType(options.appType);
|
|
734
|
+
const platform = normalizePlatform(options.platform);
|
|
724
735
|
|
|
725
736
|
if (currentVersion !== 'unknown') {
|
|
726
737
|
const remote = await checkForUpdatesFromApi(currentVersion, options);
|
|
@@ -760,6 +771,8 @@ export async function checkForUpdates(options = {}) {
|
|
|
760
771
|
version: latestVersion,
|
|
761
772
|
currentVersion,
|
|
762
773
|
body: changelog,
|
|
774
|
+
releaseUrl: `${GITHUB_RELEASES_URL}/tag/v${latestVersion}`,
|
|
775
|
+
downloadUrl: appType === 'mobile-capacitor' && platform === 'android' ? `${GITHUB_RELEASES_URL}/tag/v${latestVersion}` : undefined,
|
|
763
776
|
packageManager: pm,
|
|
764
777
|
// Show our CLI command, not raw package manager command
|
|
765
778
|
updateCommand: 'openchamber update',
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Permission Auto-Accept
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This module owns the authoritative permission auto-accept policy for web, desktop, and mobile runtimes. Policy is persisted in OpenChamber settings so permission handling survives UI disconnects and server restarts.
|
|
6
|
+
|
|
7
|
+
## Policy
|
|
8
|
+
|
|
9
|
+
`permissionAutoAccept.sessions` contains explicit per-session boolean policies.
|
|
10
|
+
|
|
11
|
+
Policy inheritance uses the nearest explicit session value. A child `false` therefore overrides a parent `true`; descendants without an explicit value inherit from their nearest configured ancestor.
|
|
12
|
+
|
|
13
|
+
## Runtime
|
|
14
|
+
|
|
15
|
+
`createPermissionAutoAcceptRuntime` loads and serializes policy writes, subscribes to the global OpenCode event hub, caches session lineage, retries transient replies, and reconciles pending permissions after startup, reconnect, and policy enablement. Enabling Auto-Accept for a session immediately accepts matching pending requests and keeps handling future requests without requiring a connected UI.
|
|
16
|
+
|
|
17
|
+
Unknown lineage and failed policy loads fail closed. A failed pending-permission fetch is distinct from an empty successful response and never clears policy state.
|
|
18
|
+
|
|
19
|
+
## Routes
|
|
20
|
+
|
|
21
|
+
- `GET /api/permission-auto-accept`
|
|
22
|
+
- `PUT /api/permission-auto-accept/sessions/:sessionId`
|
|
23
|
+
|
|
24
|
+
These are normal authenticated OpenChamber runtime routes. They must not be added to browser URL-token allowlists.
|
|
25
|
+
|
|
26
|
+
## UI ownership
|
|
27
|
+
|
|
28
|
+
`packages/ui/src/stores/permissionStore.ts` is a projection of server policy and does not persist an independent policy. The server is the sole responder and the UI renders pending requests until the authoritative `permission.replied` event arrives.
|
|
29
|
+
|
|
30
|
+
VS Code retains its foreground-only implementation because it does not run the web server runtime.
|
|
31
|
+
|
|
32
|
+
## Tests
|
|
33
|
+
|
|
34
|
+
`runtime.test.js` covers restart persistence, nearest explicit subagent inheritance, missing-lineage lookup, retry/deduplication, and reconnect reconciliation.
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
const SETTINGS_KEY = 'permissionAutoAccept';
|
|
2
|
+
const RETRY_DELAYS_MS = [0, 250, 1000];
|
|
3
|
+
const REQUEST_TIMEOUT_MS = 5000;
|
|
4
|
+
const SESSION_CACHE_LIMIT = 10000;
|
|
5
|
+
|
|
6
|
+
const normalizePolicy = (value) => {
|
|
7
|
+
const source = value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
8
|
+
const sessions = {};
|
|
9
|
+
const entries = source.sessions && typeof source.sessions === 'object' && !Array.isArray(source.sessions)
|
|
10
|
+
? Object.entries(source.sessions)
|
|
11
|
+
: [];
|
|
12
|
+
for (const [sessionId, enabled] of entries) {
|
|
13
|
+
if (sessionId && typeof enabled === 'boolean') sessions[sessionId] = enabled;
|
|
14
|
+
}
|
|
15
|
+
return { sessions };
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
19
|
+
|
|
20
|
+
export function createPermissionAutoAcceptRuntime({
|
|
21
|
+
globalEventHub,
|
|
22
|
+
buildOpenCodeUrl,
|
|
23
|
+
getOpenCodeAuthHeaders,
|
|
24
|
+
readSettingsFromDiskMigrated,
|
|
25
|
+
persistSettings,
|
|
26
|
+
broadcastGlobalUiEvent,
|
|
27
|
+
fetchImpl = fetch,
|
|
28
|
+
retryDelaysMs = RETRY_DELAYS_MS,
|
|
29
|
+
requestTimeoutMs = REQUEST_TIMEOUT_MS,
|
|
30
|
+
}) {
|
|
31
|
+
let policy = normalizePolicy();
|
|
32
|
+
let loaded = false;
|
|
33
|
+
let loadPromise = null;
|
|
34
|
+
let writePromise = Promise.resolve();
|
|
35
|
+
const sessions = new Map();
|
|
36
|
+
const inFlight = new Map();
|
|
37
|
+
const reconcilePromises = new Map();
|
|
38
|
+
|
|
39
|
+
const snapshot = () => ({
|
|
40
|
+
sessions: { ...policy.sessions },
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const load = async () => {
|
|
44
|
+
if (loaded) return snapshot();
|
|
45
|
+
if (!loadPromise) {
|
|
46
|
+
loadPromise = readSettingsFromDiskMigrated()
|
|
47
|
+
.then((settings) => {
|
|
48
|
+
policy = normalizePolicy(settings?.[SETTINGS_KEY]);
|
|
49
|
+
loaded = true;
|
|
50
|
+
return snapshot();
|
|
51
|
+
})
|
|
52
|
+
.finally(() => { loadPromise = null; });
|
|
53
|
+
}
|
|
54
|
+
return loadPromise;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const persistUpdate = (update) => {
|
|
58
|
+
writePromise = writePromise.then(async () => {
|
|
59
|
+
const next = update(policy);
|
|
60
|
+
await persistSettings({ [SETTINGS_KEY]: next });
|
|
61
|
+
policy = next;
|
|
62
|
+
loaded = true;
|
|
63
|
+
broadcastGlobalUiEvent?.({
|
|
64
|
+
type: 'openchamber:permission-auto-accept.updated',
|
|
65
|
+
properties: snapshot(),
|
|
66
|
+
});
|
|
67
|
+
return snapshot();
|
|
68
|
+
});
|
|
69
|
+
return writePromise;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const setSessionPolicy = async (sessionId, enabled, directory) => {
|
|
73
|
+
if (typeof sessionId !== 'string' || !sessionId.trim()) throw new TypeError('sessionId is required');
|
|
74
|
+
if (typeof enabled !== 'boolean') throw new TypeError('enabled must be a boolean');
|
|
75
|
+
await load();
|
|
76
|
+
const result = await persistUpdate((current) => ({
|
|
77
|
+
...current,
|
|
78
|
+
sessions: { ...current.sessions, [sessionId.trim()]: enabled },
|
|
79
|
+
}));
|
|
80
|
+
if (enabled) await reconcilePending({ directories: [directory] });
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const rememberSession = (info, directoryHint) => {
|
|
85
|
+
if (!info || typeof info.id !== 'string' || !info.id) return;
|
|
86
|
+
sessions.set(info.id, {
|
|
87
|
+
parentID: typeof info.parentID === 'string' && info.parentID ? info.parentID : null,
|
|
88
|
+
directory: typeof info.directory === 'string' && info.directory ? info.directory : directoryHint,
|
|
89
|
+
});
|
|
90
|
+
if (sessions.size > SESSION_CACHE_LIMIT) {
|
|
91
|
+
sessions.delete(sessions.keys().next().value);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const request = async (path, { directory, method = 'GET', body } = {}) => {
|
|
96
|
+
const url = new URL(buildOpenCodeUrl(path, ''));
|
|
97
|
+
if (directory) url.searchParams.set('directory', directory);
|
|
98
|
+
const response = await fetchImpl(url, {
|
|
99
|
+
method,
|
|
100
|
+
headers: {
|
|
101
|
+
Accept: 'application/json',
|
|
102
|
+
...(body ? { 'Content-Type': 'application/json' } : {}),
|
|
103
|
+
...getOpenCodeAuthHeaders(),
|
|
104
|
+
},
|
|
105
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
106
|
+
signal: AbortSignal.timeout(requestTimeoutMs),
|
|
107
|
+
});
|
|
108
|
+
if (!response.ok) {
|
|
109
|
+
const error = new Error(`OpenCode request failed (${response.status})`);
|
|
110
|
+
error.status = response.status;
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
return response.json().catch(() => null);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const getSession = async (sessionId, directory) => {
|
|
117
|
+
const cached = sessions.get(sessionId);
|
|
118
|
+
if (cached) return cached;
|
|
119
|
+
const info = await request(`/session/${encodeURIComponent(sessionId)}`, { directory });
|
|
120
|
+
rememberSession(info?.data ?? info, directory);
|
|
121
|
+
return sessions.get(sessionId) ?? null;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const isSessionAutoAccepting = async (sessionId, directory) => {
|
|
125
|
+
await load();
|
|
126
|
+
const seen = new Set();
|
|
127
|
+
let current = sessionId;
|
|
128
|
+
let currentDirectory = directory;
|
|
129
|
+
while (current && !seen.has(current)) {
|
|
130
|
+
if (Object.hasOwn(policy.sessions, current)) return policy.sessions[current] === true;
|
|
131
|
+
seen.add(current);
|
|
132
|
+
let info;
|
|
133
|
+
try {
|
|
134
|
+
info = await getSession(current, currentDirectory);
|
|
135
|
+
} catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
current = info?.parentID ?? null;
|
|
139
|
+
currentDirectory = info?.directory ?? currentDirectory;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const replyOnce = async (permission, directory) => {
|
|
145
|
+
if (!permission?.id || !permission?.sessionID) return false;
|
|
146
|
+
await load();
|
|
147
|
+
if (!(await isSessionAutoAccepting(permission.sessionID, directory))) return false;
|
|
148
|
+
await request(`/permission/${encodeURIComponent(permission.id)}/reply`, {
|
|
149
|
+
directory,
|
|
150
|
+
method: 'POST',
|
|
151
|
+
body: { reply: 'once' },
|
|
152
|
+
});
|
|
153
|
+
return true;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const processPermission = (permission, directory) => {
|
|
157
|
+
if (!permission?.id) return Promise.resolve(false);
|
|
158
|
+
const key = permission.id;
|
|
159
|
+
const existing = inFlight.get(key);
|
|
160
|
+
if (existing) return existing;
|
|
161
|
+
const task = (async () => {
|
|
162
|
+
for (const delay of retryDelaysMs) {
|
|
163
|
+
if (delay > 0) await wait(delay);
|
|
164
|
+
try {
|
|
165
|
+
return await replyOnce(permission, directory);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (error?.status === 404) return true;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
})().finally(() => inFlight.delete(key));
|
|
172
|
+
inFlight.set(key, task);
|
|
173
|
+
return task;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
async function reconcilePending({ directories = [] } = {}) {
|
|
177
|
+
const normalizedDirectories = Array.from(new Set(
|
|
178
|
+
directories.filter((directory) => typeof directory === 'string' && directory.trim()).map((directory) => directory.trim()),
|
|
179
|
+
));
|
|
180
|
+
const key = normalizedDirectories.length > 0 ? normalizedDirectories.join('\n') : 'all';
|
|
181
|
+
const existing = reconcilePromises.get(key);
|
|
182
|
+
if (existing) return existing;
|
|
183
|
+
const task = (async () => {
|
|
184
|
+
await load();
|
|
185
|
+
const scopes = [undefined, ...normalizedDirectories];
|
|
186
|
+
const pendingById = new Map();
|
|
187
|
+
for (const directory of scopes) {
|
|
188
|
+
let payload;
|
|
189
|
+
try {
|
|
190
|
+
payload = await request('/permission', { directory });
|
|
191
|
+
} catch {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const pending = Array.isArray(payload) ? payload : Array.isArray(payload?.data) ? payload.data : null;
|
|
195
|
+
if (!pending) continue;
|
|
196
|
+
for (const permission of pending) {
|
|
197
|
+
if (!permission?.id) continue;
|
|
198
|
+
pendingById.set(permission.id, { permission, directory: permission.directory ?? directory });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
await Promise.all(Array.from(pendingById.values()).map(({ permission, directory }) =>
|
|
202
|
+
processPermission(permission, directory)));
|
|
203
|
+
})().finally(() => { reconcilePromises.delete(key); });
|
|
204
|
+
reconcilePromises.set(key, task);
|
|
205
|
+
return task;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const processEvent = (event) => {
|
|
209
|
+
const raw = event?.payload;
|
|
210
|
+
const payload = raw?.payload && typeof raw.payload === 'object' ? raw.payload : raw;
|
|
211
|
+
const directory = typeof event?.directory === 'string' && event.directory !== 'global' ? event.directory : undefined;
|
|
212
|
+
if (payload?.type === 'session.created' || payload?.type === 'session.updated') {
|
|
213
|
+
rememberSession(payload.properties?.info, directory);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (payload?.type === 'permission.asked') {
|
|
217
|
+
void processPermission(payload.properties, directory);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const start = () => {
|
|
222
|
+
const unsubscribeEvent = globalEventHub.subscribeEvent(processEvent);
|
|
223
|
+
const unsubscribeStatus = globalEventHub.subscribeStatus((status) => {
|
|
224
|
+
if (status?.type === 'connect') void reconcilePending();
|
|
225
|
+
});
|
|
226
|
+
void load().then(() => reconcilePending()).catch((error) => {
|
|
227
|
+
console.warn('[permission-auto-accept] failed to load policy:', error?.message ?? error);
|
|
228
|
+
});
|
|
229
|
+
return () => {
|
|
230
|
+
unsubscribeEvent();
|
|
231
|
+
unsubscribeStatus();
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
snapshot,
|
|
237
|
+
load,
|
|
238
|
+
setSessionPolicy,
|
|
239
|
+
isSessionAutoAccepting,
|
|
240
|
+
processPermission,
|
|
241
|
+
reconcilePending,
|
|
242
|
+
start,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function registerPermissionAutoAcceptRoutes(app, runtime) {
|
|
247
|
+
app.get('/api/permission-auto-accept', async (_req, res) => {
|
|
248
|
+
try {
|
|
249
|
+
res.json(await runtime.load());
|
|
250
|
+
} catch (error) {
|
|
251
|
+
res.status(500).json({ error: error?.message ?? 'Failed to load permission auto-accept policy' });
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
app.put('/api/permission-auto-accept/sessions/:sessionId', async (req, res) => {
|
|
256
|
+
try {
|
|
257
|
+
const directory = typeof req.body?.directory === 'string' ? req.body.directory : undefined;
|
|
258
|
+
res.json(await runtime.setSessionPolicy(req.params.sessionId, req.body?.enabled, directory));
|
|
259
|
+
} catch (error) {
|
|
260
|
+
res.status(error instanceof TypeError ? 400 : 500).json({ error: error?.message });
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createPermissionAutoAcceptRuntime } from './runtime.js';
|
|
3
|
+
|
|
4
|
+
const createRuntime = ({ stored, fetchImpl, retryDelaysMs = [0] } = {}) => {
|
|
5
|
+
let settings = stored ?? { permissionAutoAccept: { sessions: {} } };
|
|
6
|
+
let eventHandler;
|
|
7
|
+
let statusHandler;
|
|
8
|
+
const runtime = createPermissionAutoAcceptRuntime({
|
|
9
|
+
globalEventHub: {
|
|
10
|
+
subscribeEvent(handler) { eventHandler = handler; return () => {}; },
|
|
11
|
+
subscribeStatus(handler) { statusHandler = handler; return () => {}; },
|
|
12
|
+
},
|
|
13
|
+
buildOpenCodeUrl: (path) => `http://opencode.test${path}`,
|
|
14
|
+
getOpenCodeAuthHeaders: () => ({}),
|
|
15
|
+
readSettingsFromDiskMigrated: async () => settings,
|
|
16
|
+
persistSettings: async (changes) => { settings = { ...settings, ...changes }; },
|
|
17
|
+
fetchImpl: fetchImpl ?? vi.fn(async () => new Response('[]')),
|
|
18
|
+
retryDelaysMs,
|
|
19
|
+
});
|
|
20
|
+
runtime.start();
|
|
21
|
+
return {
|
|
22
|
+
runtime,
|
|
23
|
+
getSettings: () => settings,
|
|
24
|
+
emit: (payload, directory = '/project') => eventHandler({ payload, directory }),
|
|
25
|
+
connect: () => statusHandler({ type: 'connect' }),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const flush = async () => {
|
|
30
|
+
for (let index = 0; index < 20; index += 1) await Promise.resolve();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
describe('permission auto-accept runtime', () => {
|
|
34
|
+
it('persists explicit session policies across runtime restarts', async () => {
|
|
35
|
+
const first = createRuntime();
|
|
36
|
+
await first.runtime.setSessionPolicy('root', true);
|
|
37
|
+
|
|
38
|
+
const second = createRuntime({ stored: first.getSettings() });
|
|
39
|
+
await expect(second.runtime.load()).resolves.toEqual({
|
|
40
|
+
sessions: { root: true },
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('uses nearest explicit ancestor policy for subagents', async () => {
|
|
45
|
+
const { runtime, emit } = createRuntime({
|
|
46
|
+
stored: { permissionAutoAccept: { sessions: { root: true, child: false } } },
|
|
47
|
+
});
|
|
48
|
+
emit({ type: 'session.created', properties: { info: { id: 'child', parentID: 'root' } } });
|
|
49
|
+
emit({ type: 'session.created', properties: { info: { id: 'grandchild', parentID: 'child' } } });
|
|
50
|
+
await expect(runtime.isSessionAutoAccepting('grandchild', '/project')).resolves.toBe(false);
|
|
51
|
+
await runtime.setSessionPolicy('child', true);
|
|
52
|
+
await expect(runtime.isSessionAutoAccepting('grandchild', '/project')).resolves.toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('fetches missing subagent lineage before replying', async () => {
|
|
56
|
+
const fetchImpl = vi.fn(async (url, init = {}) => {
|
|
57
|
+
const path = new URL(url).pathname;
|
|
58
|
+
if (path === '/permission') return new Response('[]');
|
|
59
|
+
if (path === '/session/child') return Response.json({ id: 'child', parentID: 'root', directory: '/project' });
|
|
60
|
+
if (init.method === 'POST') return Response.json({});
|
|
61
|
+
return new Response('', { status: 404 });
|
|
62
|
+
});
|
|
63
|
+
const { runtime } = createRuntime({
|
|
64
|
+
stored: { permissionAutoAccept: { sessions: { root: true } } },
|
|
65
|
+
fetchImpl,
|
|
66
|
+
});
|
|
67
|
+
await expect(runtime.processPermission({ id: 'perm', sessionID: 'child' }, '/project')).resolves.toBe(true);
|
|
68
|
+
expect(fetchImpl.mock.calls.some(([url, init]) => new URL(url).pathname === '/permission/perm/reply' && init.method === 'POST')).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('retries a transient reply failure and deduplicates concurrent events', async () => {
|
|
72
|
+
let replyAttempts = 0;
|
|
73
|
+
const fetchImpl = vi.fn(async (url, init = {}) => {
|
|
74
|
+
const path = new URL(url).pathname;
|
|
75
|
+
if (path === '/permission') return new Response('[]');
|
|
76
|
+
if (path === '/permission/perm/reply' && init.method === 'POST') {
|
|
77
|
+
replyAttempts += 1;
|
|
78
|
+
return replyAttempts === 1 ? new Response('', { status: 503 }) : Response.json({});
|
|
79
|
+
}
|
|
80
|
+
return Response.json({ id: 'root' });
|
|
81
|
+
});
|
|
82
|
+
const { runtime } = createRuntime({
|
|
83
|
+
stored: { permissionAutoAccept: { sessions: { root: true } } },
|
|
84
|
+
fetchImpl,
|
|
85
|
+
retryDelaysMs: [0, 0],
|
|
86
|
+
});
|
|
87
|
+
const permission = { id: 'perm', sessionID: 'root' };
|
|
88
|
+
const first = runtime.processPermission(permission, '/project');
|
|
89
|
+
const second = runtime.processPermission(permission, '/project');
|
|
90
|
+
await expect(Promise.all([first, second])).resolves.toEqual([true, true]);
|
|
91
|
+
expect(replyAttempts).toBe(2);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('reconciles pending permissions after reconnect', async () => {
|
|
95
|
+
const fetchImpl = vi.fn(async (url, init = {}) => {
|
|
96
|
+
const path = new URL(url).pathname;
|
|
97
|
+
if (path === '/permission') return Response.json([{ id: 'pending', sessionID: 'root' }]);
|
|
98
|
+
if (path === '/permission/pending/reply' && init.method === 'POST') return Response.json({});
|
|
99
|
+
return Response.json({ id: 'root' });
|
|
100
|
+
});
|
|
101
|
+
const { connect } = createRuntime({
|
|
102
|
+
stored: { permissionAutoAccept: { sessions: { root: true } } },
|
|
103
|
+
fetchImpl,
|
|
104
|
+
});
|
|
105
|
+
connect();
|
|
106
|
+
await flush();
|
|
107
|
+
expect(fetchImpl.mock.calls.some(([url]) => new URL(url).pathname === '/permission/pending/reply')).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('accepts existing pending permissions when a session policy is enabled', async () => {
|
|
111
|
+
const fetchImpl = vi.fn(async (url, init = {}) => {
|
|
112
|
+
const parsed = new URL(url);
|
|
113
|
+
const path = parsed.pathname;
|
|
114
|
+
if (path === '/permission') {
|
|
115
|
+
return parsed.searchParams.get('directory') === '/project'
|
|
116
|
+
? Response.json([
|
|
117
|
+
{ id: 'root-pending', sessionID: 'root' },
|
|
118
|
+
{ id: 'other-pending', sessionID: 'other' },
|
|
119
|
+
])
|
|
120
|
+
: Response.json([]);
|
|
121
|
+
}
|
|
122
|
+
if (path === '/permission/root-pending/reply' && init.method === 'POST') return Response.json({});
|
|
123
|
+
if (path === '/session/other') return Response.json({ id: 'other' });
|
|
124
|
+
return new Response('', { status: 404 });
|
|
125
|
+
});
|
|
126
|
+
const { runtime } = createRuntime({ fetchImpl });
|
|
127
|
+
|
|
128
|
+
await runtime.setSessionPolicy('root', true, '/project');
|
|
129
|
+
|
|
130
|
+
const replyPaths = fetchImpl.mock.calls
|
|
131
|
+
.filter(([, init]) => init?.method === 'POST')
|
|
132
|
+
.map(([url]) => new URL(url).pathname);
|
|
133
|
+
expect(replyPaths).toEqual(['/permission/root-pending/reply']);
|
|
134
|
+
expect(fetchImpl.mock.calls.some(([url]) => new URL(url).searchParams.get('directory') === '/project')).toBe(true);
|
|
135
|
+
expect(await runtime.load()).toEqual({ sessions: { root: true } });
|
|
136
|
+
});
|
|
137
|
+
});
|