@pi-chamber/web 1.0.0 → 1.0.2-rc.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/README.md +3 -1
- package/bin/cli.js +7 -32
- package/bin/dev-server.js +185 -0
- package/bin/dev-server.test.js +252 -0
- package/bin/lib/DOCUMENTATION.md +19 -0
- package/bin/lib/cli-startup.js +9 -1
- package/bin/lib/cli-startup.test.js +30 -0
- package/bin/lib/commands-serve.js +9 -5
- package/bin/lib/server-runtime.js +6 -0
- package/bin/lib/server-runtime.test.js +313 -0
- package/dist/assets/{DiagramView-CbSxUe1D.js → DiagramView-GUJij-1P.js} +1 -1
- package/dist/assets/{DiffView-VyBf4ilo.js → DiffView-BZ487Bhh.js} +1 -1
- package/dist/assets/{FileSaveConflictDialog-BCvbQ234.js → FileSaveConflictDialog-Ci6WdSiS.js} +1 -1
- package/dist/assets/{FilesView-DasA5EU2.js → FilesView-DBiWEo71.js} +1 -1
- package/dist/assets/{GitView-DU3mOECp.js → GitView-DVyhqN5s.js} +3 -3
- package/dist/assets/{JsonTreeView-xZiWDwua.js → JsonTreeView-BaU7aAUq.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-BBwdI2OF.js → MarkdownRendererImpl-6NBJLtEr.js} +1 -1
- package/dist/assets/{PatchDiff-BhKm_JPT.js → PatchDiff-CvptevA2.js} +1 -1
- package/dist/assets/{SessionSwitcherContent-DTGSP_RB.js → SessionSwitcherContent-Cqp5FVCP.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-CedOB-xC.js → SessionSwitcherDropdown-CRVJU16x.js} +2 -2
- package/dist/assets/{SessionUnreadDot-CZSNKram.js → SessionUnreadDot-CsFxImPI.js} +1 -1
- package/dist/assets/SettingsView-ppaIrPry.js +2 -0
- package/dist/assets/{SettingsWindow-y33YrpBE.js → SettingsWindow-geMUhnxd.js} +1 -1
- package/dist/assets/{ToolOutputDialog-JqIXJWAH.js → ToolOutputDialog-BLGl2mNt.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CRi_33jE.js → ToolPartDiffPreview-BVeL1IuE.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-ehLQSR5W.js → VirtualizedFileDiff-9kAZ96se.js} +1 -1
- package/dist/assets/{collapsible-Vypq-nMP.js → collapsible-BencOwkW.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BTfrj_fR.js → computeVirtualFileMetrics-C8vH0vcM.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-Dl6mFfD1.js → contextFileOpenGuard-B6e3cTcl.js} +1 -1
- package/dist/assets/{gitStatusPredicates-LAsJAhCL.js → gitStatusPredicates-B6w5GMNU.js} +1 -1
- package/dist/assets/{index-OveFsNBm.js → index-BifnX1Mp.js} +1 -1
- package/dist/assets/{index-DvNeSFO9.js → index-CpSdU-d4.js} +7 -7
- package/dist/assets/index-Dwz16owi.css +1 -0
- package/dist/assets/{isDiffPlainText-CNZohQ4q.js → isDiffPlainText-BepQ1JHv.js} +1 -1
- package/dist/assets/{isFilePlainText-Dz8UubRT.js → isFilePlainText-CA1KFaTm.js} +1 -1
- package/dist/assets/{main-BsDkATRV.js → main-TzeSIx1W.js} +3 -3
- package/dist/assets/{main-C393Ywhx.js → main-dhVDQIHu.js} +2 -2
- package/dist/assets/{markdownCore-Bz9-Y75q.js → markdownCore-BztwD2c9.js} +1 -1
- package/dist/assets/{miniChat-CWEerp3c.js → miniChat-smqdx0Y7.js} +2 -2
- package/dist/assets/{mobile-YxV9KcxF.js → mobile-BV-WCEiE.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-GrLmBQRb.js → renderElectronMiniChatApp-DKmb9oa7.js} +2 -2
- package/dist/assets/renderMobileApp-D3dtjeaE.js +11 -0
- package/dist/assets/runtimeEndpointReset-C1EENUlq.js +53 -0
- package/dist/assets/{runtimeSurface-DUXw4-oa.js → runtimeSurface-Bm6cRkok.js} +1 -1
- package/dist/assets/{useAppFontEffects-ad-lZJ6o.js → useAppFontEffects-Dq7xKVjh.js} +77 -77
- package/dist/assets/{useFilesViewSearch-C4oOHPml.js → useFilesViewSearch-Bvlo7C3a.js} +1 -1
- package/dist/assets/{usePushVisibilityBeacon-xd8Q10cI.js → usePushVisibilityBeacon-BY4xtozp.js} +1 -1
- package/dist/assets/{useSwitcherItems-B6VC7tug.js → useSwitcherItems-CkE242zK.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-B4j3gkaT.js → vendor-codemirror-language-data-Bv6kN79m.js} +2 -2
- package/dist/assets/{web-components-B0RFakat.js → web-components-CCiRgoOw.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +8 -3
- package/server/index.js +48 -6
- package/server/lib/notifications/DOCUMENTATION.md +39 -0
- package/server/lib/notifications/delivery-runtime.js +314 -0
- package/server/lib/notifications/delivery-runtime.test.js +85 -0
- package/server/lib/notifications/pi-notification-watcher.js +154 -0
- package/server/lib/notifications/pi-notification-watcher.test.js +84 -0
- package/server/lib/notifications/routes.js +74 -0
- package/server/lib/package-manager.js +3 -2
- package/server/lib/package-manager.test.js +7 -2
- package/server/lib/pi/routes.test.js +24 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +1 -0
- package/server/lib/pi/session-daemon/pi-runtime-smoke.test.js +466 -0
- package/server/lib/pi/ui-settings-store.js +15 -2
- package/server/lib/pi/ui-settings-store.test.js +47 -1
- package/server/lib/server/core-routes.js +18 -0
- package/server/lib/server/linux-distribution.js +47 -0
- package/server/lib/server/linux-distribution.test.js +22 -0
- package/server/lib/server/runtime-requirements.js +193 -0
- package/server/lib/server/runtime-requirements.test.js +295 -0
- package/server/lib/server/tunnel-service.DOCUMENTATION.md +1 -1
- package/dist/assets/SettingsView-B5nmu8x4.js +0 -2
- package/dist/assets/index-BXX8l7mM.css +0 -1
- package/dist/assets/renderMobileApp-C29wquBe.js +0 -11
- package/dist/assets/runtimeEndpointReset-DHARMv9w.js +0 -53
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import net from 'net';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import {
|
|
7
|
+
assertCurrentRuntimeSupported,
|
|
8
|
+
isSupportedNodeVersion,
|
|
9
|
+
resolveServerExecutable,
|
|
10
|
+
} from './server-runtime.js';
|
|
11
|
+
|
|
12
|
+
function fakeSpawnSync({ nodeVersion = null, nodeStatus = 0, bunVersion = '1.4.2', bunStatus = 0 } = {}) {
|
|
13
|
+
return (bin) => {
|
|
14
|
+
const normalized = String(bin);
|
|
15
|
+
if (normalized === 'node' || normalized.endsWith('/node') || normalized === '/mock/node') {
|
|
16
|
+
if (nodeVersion === null || nodeStatus !== 0) return { status: 1, stdout: '' };
|
|
17
|
+
return { status: 0, stdout: `${nodeVersion}\n` };
|
|
18
|
+
}
|
|
19
|
+
if (normalized.includes('bun')) {
|
|
20
|
+
if (bunStatus !== 0 || bunVersion === null) return { status: 1, stdout: '' };
|
|
21
|
+
return { status: 0, stdout: `${bunVersion}\n` };
|
|
22
|
+
}
|
|
23
|
+
return { status: 1, stdout: '' };
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function withTempPiChamberDataDir(fn) {
|
|
28
|
+
const previous = process.env.PICHAMBER_DATA_DIR;
|
|
29
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pichamber-runtime-test-'));
|
|
30
|
+
process.env.PICHAMBER_DATA_DIR = dir;
|
|
31
|
+
try {
|
|
32
|
+
return await fn(dir);
|
|
33
|
+
} finally {
|
|
34
|
+
if (typeof previous === 'string') {
|
|
35
|
+
process.env.PICHAMBER_DATA_DIR = previous;
|
|
36
|
+
} else {
|
|
37
|
+
delete process.env.PICHAMBER_DATA_DIR;
|
|
38
|
+
}
|
|
39
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function allocateLoopbackPort() {
|
|
44
|
+
const server = net.createServer();
|
|
45
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
46
|
+
const address = server.address();
|
|
47
|
+
const port = typeof address === 'object' && address ? address.port : 0;
|
|
48
|
+
await new Promise((resolve) => server.close(resolve));
|
|
49
|
+
return port;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function createReadyChild(pid, readyPort, delayMs = 10) {
|
|
53
|
+
const handlers = new Map();
|
|
54
|
+
const child = {
|
|
55
|
+
pid,
|
|
56
|
+
connected: true,
|
|
57
|
+
disconnect() {
|
|
58
|
+
child.connected = false;
|
|
59
|
+
},
|
|
60
|
+
unref() {},
|
|
61
|
+
on(event, callback) {
|
|
62
|
+
if (!handlers.has(event)) handlers.set(event, []);
|
|
63
|
+
handlers.get(event).push(callback);
|
|
64
|
+
return child;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
for (const callback of handlers.get('message') || []) {
|
|
69
|
+
callback({ type: 'pichamber:ready', port: readyPort });
|
|
70
|
+
}
|
|
71
|
+
}, delayMs);
|
|
72
|
+
return child;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe('stable version checks', () => {
|
|
76
|
+
it('accepts stable Node 22.19.0 and newer', () => {
|
|
77
|
+
expect(isSupportedNodeVersion('v22.19.0')).toBe(true);
|
|
78
|
+
expect(isSupportedNodeVersion('v22.19.1')).toBe(true);
|
|
79
|
+
expect(isSupportedNodeVersion('v24.14.1')).toBe(true);
|
|
80
|
+
expect(isSupportedNodeVersion('v22.18.9')).toBe(false);
|
|
81
|
+
expect(isSupportedNodeVersion('v22.14.0')).toBe(false);
|
|
82
|
+
expect(isSupportedNodeVersion('v20.19.0')).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('rejects malformed and prerelease shapes', () => {
|
|
86
|
+
expect(isSupportedNodeVersion('v22')).toBe(false);
|
|
87
|
+
expect(isSupportedNodeVersion('not-a-version')).toBe(false);
|
|
88
|
+
expect(isSupportedNodeVersion('v22.19.0-rc.1')).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('background runtime selection', () => {
|
|
93
|
+
it('prefers the current Node executable without probing PATH', () => {
|
|
94
|
+
const spawnSyncFn = () => {
|
|
95
|
+
throw new Error('should not probe when current Node is supported');
|
|
96
|
+
};
|
|
97
|
+
expect(resolveServerExecutable({
|
|
98
|
+
isBun: false,
|
|
99
|
+
nodeVersion: 'v24.14.1',
|
|
100
|
+
execPath: '/usr/bin/node',
|
|
101
|
+
spawnSyncFn,
|
|
102
|
+
env: {},
|
|
103
|
+
})).toEqual({ runtime: 'node', executable: '/usr/bin/node' });
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('selects PATH Node under a Bun parent when Node is available', () => {
|
|
107
|
+
const spawnSyncFn = fakeSpawnSync({ nodeVersion: 'v22.19.0', bunVersion: '1.4.2', bunStatus: 0 });
|
|
108
|
+
const resolved = resolveServerExecutable({
|
|
109
|
+
isBun: true,
|
|
110
|
+
nodeVersion: 'v26.3.0',
|
|
111
|
+
bunVersion: '1.4.2',
|
|
112
|
+
execPath: '/mock/bun',
|
|
113
|
+
bunBin: '/mock/bun',
|
|
114
|
+
spawnSyncFn,
|
|
115
|
+
env: {},
|
|
116
|
+
});
|
|
117
|
+
expect(resolved).toEqual({ runtime: 'node', executable: 'node' });
|
|
118
|
+
expect(resolved.executable).not.toContain('bun');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('falls back to current Bun with no runtimes on PATH', () => {
|
|
122
|
+
const spawnSyncFn = () => ({ status: 1, stdout: '' });
|
|
123
|
+
expect(resolveServerExecutable({
|
|
124
|
+
isBun: true,
|
|
125
|
+
nodeVersion: 'v26.3.0',
|
|
126
|
+
bunVersion: '1.4.2',
|
|
127
|
+
execPath: '/mock/current-bun',
|
|
128
|
+
spawnSyncFn,
|
|
129
|
+
env: {},
|
|
130
|
+
})).toEqual({ runtime: 'bun', executable: '/mock/current-bun' });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('falls back to Bun when Node is older than 22.19.0', () => {
|
|
134
|
+
const spawnSyncFn = fakeSpawnSync({ nodeVersion: 'v20.19.0', bunVersion: '1.4.2', bunStatus: 0 });
|
|
135
|
+
expect(resolveServerExecutable({
|
|
136
|
+
isBun: false,
|
|
137
|
+
nodeVersion: 'v20.19.0',
|
|
138
|
+
execPath: '/usr/bin/node',
|
|
139
|
+
bunBin: 'bun',
|
|
140
|
+
spawnSyncFn,
|
|
141
|
+
env: {},
|
|
142
|
+
})).toEqual({ runtime: 'bun', executable: 'bun' });
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('fails deterministically when neither runtime is usable', () => {
|
|
146
|
+
const spawnSyncFn = fakeSpawnSync({ nodeVersion: null, bunStatus: 1, bunVersion: null });
|
|
147
|
+
expect(() => resolveServerExecutable({
|
|
148
|
+
isBun: false,
|
|
149
|
+
nodeVersion: 'v20.19.0',
|
|
150
|
+
execPath: '/usr/bin/node',
|
|
151
|
+
bunBin: '/mock/bun',
|
|
152
|
+
spawnSyncFn,
|
|
153
|
+
env: {},
|
|
154
|
+
})).toThrow(/No supported server runtime/);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('rejects old Bun even when it emulates new Node', () => {
|
|
158
|
+
expect(() => assertCurrentRuntimeSupported({
|
|
159
|
+
isBun: true,
|
|
160
|
+
nodeVersion: 'v26.3.0',
|
|
161
|
+
bunVersion: '1.3.14',
|
|
162
|
+
execPath: '/mock/bun',
|
|
163
|
+
})).toThrow(/Bun 1\.3\.14/);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
describe('serve executable selection', () => {
|
|
168
|
+
it('spawns the resolved Node executable in background mode', async () => {
|
|
169
|
+
await withTempPiChamberDataDir(async () => {
|
|
170
|
+
const { createServeCommand } = await import('./commands-serve.js');
|
|
171
|
+
const port = await allocateLoopbackPort();
|
|
172
|
+
let spawnedBin = null;
|
|
173
|
+
let spawnedArgs = null;
|
|
174
|
+
const spawnFn = (bin, args) => {
|
|
175
|
+
spawnedBin = bin;
|
|
176
|
+
spawnedArgs = args;
|
|
177
|
+
return createReadyChild(process.pid, port);
|
|
178
|
+
};
|
|
179
|
+
const serve = createServeCommand({
|
|
180
|
+
serverPath: path.join(os.tmpdir(), 'fake-server-index.js'),
|
|
181
|
+
resolveServerExecutable: () => ({ runtime: 'node', executable: '/mock/node' }),
|
|
182
|
+
spawnFn,
|
|
183
|
+
setForegroundServerActive() {},
|
|
184
|
+
setForegroundShutdown() {},
|
|
185
|
+
});
|
|
186
|
+
const result = await serve({
|
|
187
|
+
explicitPort: true,
|
|
188
|
+
port,
|
|
189
|
+
host: '127.0.0.1',
|
|
190
|
+
quiet: true,
|
|
191
|
+
suppressQuietOutput: true,
|
|
192
|
+
suppressUiPasswordWarning: true,
|
|
193
|
+
suppressStartupSummary: true,
|
|
194
|
+
});
|
|
195
|
+
expect(result).toBe(port);
|
|
196
|
+
expect(spawnedBin).toBe('/mock/node');
|
|
197
|
+
expect(spawnedArgs[0]).toContain('fake-server-index.js');
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('spawns the Bun fallback executable when Node is unavailable', async () => {
|
|
202
|
+
await withTempPiChamberDataDir(async () => {
|
|
203
|
+
const { createServeCommand } = await import('./commands-serve.js');
|
|
204
|
+
const port = await allocateLoopbackPort();
|
|
205
|
+
let spawnedBin = null;
|
|
206
|
+
const spawnFn = (bin) => {
|
|
207
|
+
spawnedBin = bin;
|
|
208
|
+
return createReadyChild(process.pid, port);
|
|
209
|
+
};
|
|
210
|
+
const serve = createServeCommand({
|
|
211
|
+
serverPath: path.join(os.tmpdir(), 'fake-server-index.js'),
|
|
212
|
+
resolveServerExecutable: () => ({ runtime: 'bun', executable: '/mock/bun' }),
|
|
213
|
+
spawnFn,
|
|
214
|
+
setForegroundServerActive() {},
|
|
215
|
+
setForegroundShutdown() {},
|
|
216
|
+
});
|
|
217
|
+
await serve({
|
|
218
|
+
explicitPort: true,
|
|
219
|
+
port,
|
|
220
|
+
host: '127.0.0.1',
|
|
221
|
+
quiet: true,
|
|
222
|
+
suppressQuietOutput: true,
|
|
223
|
+
suppressUiPasswordWarning: true,
|
|
224
|
+
suppressStartupSummary: true,
|
|
225
|
+
});
|
|
226
|
+
expect(spawnedBin).toBe('/mock/bun');
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('surfaces the deterministic error when neither runtime is usable', async () => {
|
|
231
|
+
await withTempPiChamberDataDir(async () => {
|
|
232
|
+
const { createServeCommand } = await import('./commands-serve.js');
|
|
233
|
+
const port = await allocateLoopbackPort();
|
|
234
|
+
const serve = createServeCommand({
|
|
235
|
+
serverPath: path.join(os.tmpdir(), 'fake-server-index.js'),
|
|
236
|
+
resolveServerExecutable: () => {
|
|
237
|
+
throw new Error('No supported server runtime found. Install Node.js 22.19.0 or newer, or Bun 1.4.0 or newer.');
|
|
238
|
+
},
|
|
239
|
+
spawnFn: () => {
|
|
240
|
+
throw new Error('should not spawn without a runtime');
|
|
241
|
+
},
|
|
242
|
+
setForegroundServerActive() {},
|
|
243
|
+
setForegroundShutdown() {},
|
|
244
|
+
});
|
|
245
|
+
await expect(serve({
|
|
246
|
+
explicitPort: true,
|
|
247
|
+
port,
|
|
248
|
+
host: '127.0.0.1',
|
|
249
|
+
quiet: true,
|
|
250
|
+
suppressQuietOutput: true,
|
|
251
|
+
suppressUiPasswordWarning: true,
|
|
252
|
+
suppressStartupSummary: true,
|
|
253
|
+
})).rejects.toThrow(/No supported server runtime/);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
describe('foreground current-runtime validation', () => {
|
|
259
|
+
it('rejects unsupported current runtime without probing PATH', async () => {
|
|
260
|
+
await withTempPiChamberDataDir(async () => {
|
|
261
|
+
const { createServeCommand } = await import('./commands-serve.js');
|
|
262
|
+
const port = await allocateLoopbackPort();
|
|
263
|
+
let resolveCalls = 0;
|
|
264
|
+
let spawnCalls = 0;
|
|
265
|
+
const serve = createServeCommand({
|
|
266
|
+
serverPath: path.join(os.tmpdir(), 'fake-server-index.js'),
|
|
267
|
+
resolveServerExecutable: () => {
|
|
268
|
+
resolveCalls += 1;
|
|
269
|
+
throw new Error('foreground must not probe PATH runtimes');
|
|
270
|
+
},
|
|
271
|
+
assertCurrentRuntime: () => {
|
|
272
|
+
throw new Error('Unsupported server runtime: Node.js v20.19.0 is not supported. Install Node.js 22.19.0 or newer, or Bun 1.4.0 or newer.');
|
|
273
|
+
},
|
|
274
|
+
spawnFn: () => {
|
|
275
|
+
spawnCalls += 1;
|
|
276
|
+
throw new Error('foreground must stay inline and never spawn');
|
|
277
|
+
},
|
|
278
|
+
setForegroundServerActive() {},
|
|
279
|
+
setForegroundShutdown() {},
|
|
280
|
+
});
|
|
281
|
+
await expect(serve({
|
|
282
|
+
explicitPort: true,
|
|
283
|
+
port,
|
|
284
|
+
host: '127.0.0.1',
|
|
285
|
+
foreground: true,
|
|
286
|
+
quiet: true,
|
|
287
|
+
suppressQuietOutput: true,
|
|
288
|
+
suppressUiPasswordWarning: true,
|
|
289
|
+
suppressStartupSummary: true,
|
|
290
|
+
})).rejects.toThrow(/Unsupported server runtime/);
|
|
291
|
+
expect(resolveCalls).toBe(0);
|
|
292
|
+
expect(spawnCalls).toBe(0);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it('validates supported absolute Bun exec without PATH runtimes', () => {
|
|
297
|
+
expect(assertCurrentRuntimeSupported({
|
|
298
|
+
isBun: true,
|
|
299
|
+
nodeVersion: 'v26.3.0',
|
|
300
|
+
bunVersion: '1.4.2',
|
|
301
|
+
execPath: '/mock/current-bun',
|
|
302
|
+
})).toEqual({ runtime: 'bun', executable: '/mock/current-bun' });
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('rejects old Bun foreground even when emulated Node looks new', () => {
|
|
306
|
+
expect(() => assertCurrentRuntimeSupported({
|
|
307
|
+
isBun: true,
|
|
308
|
+
nodeVersion: 'v26.3.0',
|
|
309
|
+
bunVersion: '1.3.14',
|
|
310
|
+
execPath: '/mock/old-bun',
|
|
311
|
+
})).toThrow(/Bun 1\.3\.14/);
|
|
312
|
+
});
|
|
313
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as t,j as c}from"./vendor-react-B5Z1Mdn3.js";import{ab as $,t as m,I as B}from"./useAppFontEffects-
|
|
1
|
+
import{R as t,j as c}from"./vendor-react-B5Z1Mdn3.js";import{ab as $,t as m,I as B}from"./useAppFontEffects-Dq7xKVjh.js";import{t as W,a as A,z as ee,bW as T}from"./index-CpSdU-d4.js";import{b as te,D as re,F as ie}from"./FileSaveConflictDialog-Ci6WdSiS.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-DXSHfszQ.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-BZOGXAGe.js";import"./vendor-use-sync-external-store-D0AXkdQC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-sonner-BDtm25td.js";import"./vendor-codemirror-view-Ct4T37Ue.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./runtimeSurface-Bm6cRkok.js";import"./vendor-dnd-kit-core-C9qcAm_1.js";import"./vendor-dnd-kit-utilities-DTY1C6ST.js";import"./vendor-dnd-kit-accessibility-DZKKhs9S.js";import"./vendor-dnd-kit-sortable-D8ozj8M-.js";import"./vendor-cmdk-zXx6sGnS.js";import"./vendor-radix-ui-react-dialog-D2yhEu2p.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-8xy6TJML.js";import"./vendor-radix-ui-react-context-CFsX-AUC.js";import"./vendor-radix-ui-react-id-D2kS9K1j.js";import"./vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js";import"./vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js";import"./vendor-radix-ui-react-dismissable-layer-DrorBNg9.js";import"./vendor-radix-ui-react-primitive-DkH8dMOR.js";import"./vendor-radix-ui-react-slot-BIDFZX0-.js";import"./vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js";import"./vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js";import"./vendor-radix-ui-react-focus-scope-D2BkImwt.js";import"./vendor-radix-ui-react-portal-YgCRIyi7.js";import"./vendor-radix-ui-react-presence-D432pCMB.js";import"./vendor-radix-ui-react-focus-guards-BfdFmL7c.js";import"./vendor-react-remove-scroll-vR1dy1aP.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-CSAHp1YF.js";import"./vendor-react-style-singleton-Ctw6HnYx.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-Vv4V8Nd1.js";import"./vendor-use-callback-ref-CVVuCyLj.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BByA_dGF.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-DuOEwJ3f.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-wd6iRebq.js";import"./vendor-codemirror-lang-json-CZ07HmNC.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-djiuoTi8.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CKHqhW5R.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-DtcZDGqe.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-Bv6kN79m.js";import"./vendor-codemirror-lang-python-DzzokVau.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-CNlncqrr.js";import"./vendor-tanstack-react-virtual-2skouoFw.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-CfplGuM0.js";import"./vendor-motion-dom-DhJ-sYS5.js";import"./vendor-motion-utils-CKEGc_YG.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-react-drawio-BYDptOsj.js";const ne=l=>l.split("/").pop()||l;function Dt(){const{files:l}=$(),[x,k]=t.useState(null),[L,R]=t.useState(""),[M,E]=t.useState(!0),[b,h]=t.useState(null),[p,F]=t.useState(!1),[U,v]=t.useState(!1),[j,P]=t.useState(!1),[q,H]=t.useState(0),g=t.useRef(void 0),C=t.useRef(""),d=t.useRef(0),S=t.useRef(0),y=t.useRef(0),D=t.useRef(null),I=t.useRef(!0),w=t.useRef(null),G=W(e=>e.pendingDiagramFile);t.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const o=t.useCallback((e,i,n)=>I.current&&d.current===e&&A()===i&&w.current===n,[]),z=t.useCallback(async e=>{const i=d.current+1;d.current=i;const n=A(),u=l?.readFile;S.current+=1,y.current+=1,E(!0),k(e),w.current=e,h(null),v(!1),P(!1),F(!1);try{const r=await u?.(e);if(!o(i,n,e))return;if(!r){m.error("Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}C.current=r.content,R(r.content),g.current=r.revision}catch(r){if(!o(i,n,e))return;m.error(r instanceof Error?r.message:"Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}finally{o(i,n,e)&&E(!1)}},[l,o]);t.useEffect(()=>ee(()=>{if(d.current+=1,g.current=void 0,S.current+=1,y.current+=1,!I.current)return;h(null),v(!1),P(!1),F(!1);const e=w.current;e&&z(e)}),[z]),t.useEffect(()=>{if(!G)return;const e=W.getState().consumePendingDiagramFile();e&&z(e)},[z,G]);const K=t.useCallback(async(e,i,n,u,r,s)=>{let a=null,f=n,V=u;try{if(V){const N=await l?.readFile?.(e);if(!o(r,s,e))return;N&&(a=N.content??null,typeof N.revision=="string"&&(f=N.revision),V=N.exists!==!1)}}catch{if(!o(r,s,e))return}o(r,s,e)&&(h({path:e,displayPath:ne(e),exists:V,currentRevision:f,currentContent:a,dirtyContent:i,runtimeKey:s}),v(!1))},[l,o]),X=t.useCallback(async(e,i,n,u,r)=>{const s=await l?.writeFile?.(e,i,te(g.current,n?!0:void 0));return o(u,r,e)?{stale:!1,success:!!s?.success,revision:s?.revision}:{stale:!0}},[l,o]),O=t.useCallback((e,i)=>{C.current=e,typeof i<"u"&&(g.current=i),D.current?.getXml()===e&&R(e)},[]),J=t.useCallback(async()=>{const e=D.current?.getXml();if(!x||!l?.writeFile||!e||e===C.current||j||p)return;const i=d.current,n=A(),u=x,r=e,s=S.current+1;S.current=s,P(!0);try{const a=await X(u,r,!1,i,n);if(a.stale)return;if(!a.success){m.error("Failed to write file");return}O(r,a.revision)}catch(a){if(!o(i,n,u))return;if(T(a)){await K(u,r,a.currentRevision??null,a.exists,i,n);return}m.error(a instanceof Error?a.message:"Save failed")}finally{S.current===s&&P(!1)}},[O,x,l,o,p,j,K,X]),Q=t.useCallback(async()=>{const e=b;if(!e||p||!o(d.current,e.runtimeKey,e.path))return;const i=d.current,n=e.runtimeKey;if(!e.exists){k(null),w.current=null,C.current="",R(""),g.current=void 0,h(null),v(!1);return}const u=y.current+1;y.current=u,F(!0);try{const r=await l?.readFile?.(e.path);if(!o(i,n,e.path))return;if(!r){m.error("Failed to read file");return}C.current=r.content??"",R(r.content??""),g.current=r.revision,H(s=>s+1),h(null),v(!1)}catch(r){if(!o(i,n,e.path))return;m.error(r instanceof Error?r.message:"Failed to read file")}finally{y.current===u&&F(!1)}},[l,o,p,b]),Y=t.useCallback(async()=>{const e=b;if(!e||p||!o(d.current,e.runtimeKey,e.path))return;const i=d.current,n=e.runtimeKey;if(!l?.writeFile){m.error("Saving not supported");return}const s=D.current?.getXml()??e.dirtyContent;if(!s){m.error("Failed to write file");return}const a=y.current+1;y.current=a,F(!0);try{const f=await X(e.path,s,!0,i,n);if(f.stale)return;if(!f.success){m.error("Failed to write file");return}O(s,f.revision),h(null),v(!1)}catch(f){if(!o(i,n,e.path))return;if(T(f)){await K(e.path,s,f.currentRevision??e.currentRevision,f.exists,i,n);return}m.error(f instanceof Error?f.message:"Save failed")}finally{y.current===a&&F(!1)}},[O,l,o,p,K,X,b]),Z=t.useCallback(()=>{p||j||(h(null),v(!1))},[p,j]),_=x?x.split("/").pop()||x:"";return x?M?c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx(B,{name:"loader-4",className:"size-4 animate-spin"})}):c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 px-3 py-1.5",children:[c.jsx(B,{name:"file",className:"size-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"typography-ui text-muted-foreground truncate flex-1",children:_}),c.jsx("button",{type:"button",onClick:()=>{J()},className:"size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Save diagram",children:c.jsx(B,{name:"save-3",className:"size-4"})}),c.jsx("button",{type:"button",onClick:()=>W.getState().setActiveMainTab("chat"),className:"size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Close diagram view",children:c.jsx(B,{name:"close",className:"size-4"})})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(re,{ref:D,xml:L,className:"h-full"},q)}),c.jsx(ie,{open:!!b,conflict:b,isResolving:p||j,showCompare:U,onToggleCompare:()=>v(e=>!e),onReload:()=>{Q()},onOverwrite:()=>{Y()},onClose:Z})]}):c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx("div",{className:"typography-ui text-muted-foreground",children:"Pick a file from the tree."})})}export{Dt as DiagramView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n,R as r,b as St}from"./vendor-react-B5Z1Mdn3.js";import{o as te,
|
|
1
|
+
import{j as n,R as r,b as St}from"./vendor-react-B5Z1Mdn3.js";import{o as te,t as J,a as Ze,B as ze}from"./index-CpSdU-d4.js";import{dt as vt,dm as Ct,dr as jt,af as et,a1 as tt,c6 as Nt,c7 as Ne,B as Le,I as q,ab as nt,ay as re,t as st,cw as it,c0 as Lt,du as Dt,dv as kt,ac as Rt,_ as Et,au as At,ad as Tt,cq as Mt,f as It,ap as $t,aG as Pt,a3 as _t,a4 as Wt,a6 as Bt}from"./useAppFontEffects-Dq7xKVjh.js";import{d as rt,P as Ot,i as Ge,a as He,b as zt,C as Gt}from"./gitStatusPredicates-B6w5GMNU.js";import{p as Ht}from"./VirtualizedFileDiff-9kAZ96se.js";import{v as Ut,g as Vt}from"./contextFileOpenGuard-B6e3cTcl.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-base-ui-DXSHfszQ.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-BZOGXAGe.js";import"./vendor-use-sync-external-store-D0AXkdQC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-sonner-BDtm25td.js";import"./vendor-codemirror-view-Ct4T37Ue.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./runtimeSurface-Bm6cRkok.js";import"./vendor-dnd-kit-core-C9qcAm_1.js";import"./vendor-dnd-kit-utilities-DTY1C6ST.js";import"./vendor-dnd-kit-accessibility-DZKKhs9S.js";import"./vendor-dnd-kit-sortable-D8ozj8M-.js";import"./vendor-cmdk-zXx6sGnS.js";import"./vendor-radix-ui-react-dialog-D2yhEu2p.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-8xy6TJML.js";import"./vendor-radix-ui-react-context-CFsX-AUC.js";import"./vendor-radix-ui-react-id-D2kS9K1j.js";import"./vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js";import"./vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js";import"./vendor-radix-ui-react-dismissable-layer-DrorBNg9.js";import"./vendor-radix-ui-react-primitive-DkH8dMOR.js";import"./vendor-radix-ui-react-slot-BIDFZX0-.js";import"./vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js";import"./vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js";import"./vendor-radix-ui-react-focus-scope-D2BkImwt.js";import"./vendor-radix-ui-react-portal-YgCRIyi7.js";import"./vendor-radix-ui-react-presence-D432pCMB.js";import"./vendor-radix-ui-react-focus-guards-BfdFmL7c.js";import"./vendor-react-remove-scroll-vR1dy1aP.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-CSAHp1YF.js";import"./vendor-react-style-singleton-Ctw6HnYx.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-Vv4V8Nd1.js";import"./vendor-use-callback-ref-CVVuCyLj.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BByA_dGF.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-DuOEwJ3f.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-wd6iRebq.js";import"./vendor-codemirror-lang-json-CZ07HmNC.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-djiuoTi8.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CKHqhW5R.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-DtcZDGqe.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-Bv6kN79m.js";import"./vendor-codemirror-lang-python-DzzokVau.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-CNlncqrr.js";import"./vendor-tanstack-react-virtual-2skouoFw.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-CfplGuM0.js";import"./vendor-motion-dom-DhJ-sYS5.js";import"./vendor-motion-utils-CKEGc_YG.js";import"./web-components-CCiRgoOw.js";import"./computeVirtualFileMetrics-C8vH0vcM.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./runtimeEndpointReset-C1EENUlq.js";import"./SessionUnreadDot-CsFxImPI.js";import"./vendor-xterm-xterm-CrXqRur4.js";import"./permissionStore-iKN1K2_x.js";import"./appThemeRegistry-gegrE2dq.js";import"./registerCustomTheme-DmolaWWZ.js";import"./isDiffPlainText-BepQ1JHv.js";import"./vendor-diff-C3JhlQdm.js";function Kt(t,s=10){const e=[];let i;for(const l of t.split(`
|
|
2
2
|
`)){const p=l.match(vt);if(p!=null){i!=null&&(i.hunkLines.length>0&&(Re(i,s,"trailing"),Ie(i,e)),i=void 0);const u=parseInt(p[3]),b=parseInt(p[1]),h=parseInt(p[4]??"1"),c=parseInt(p[2]??"1");isNaN(u)||isNaN(b)||isNaN(h)||isNaN(c)?e.push(l):i={additionStart:u,deletionStart:b,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(i==null){e.push(l);continue}if(l.startsWith(" "))i.contextLines.push(l);else if(l!==""){if(i.hunkLines.length>0&&i.contextLines.length>s*2){const u=i.contextLines.length-s*2,b=i.contextLines.slice(-s);Re(i,s,"trailing");const{additionCount:h,deletionCount:c}=i;Ie(i,e),i={additionStart:i.additionStart+h+u,deletionStart:i.deletionStart+c+u,deletionCount:0,additionCount:0,contextLines:b,hunkLines:[]}}Re(i,s,i.hunkLines.length===0?"leading":"before-change"),i.hunkLines.push(l),l.startsWith("+")?i.additionCount+=1:l.startsWith("-")&&(i.deletionCount+=1)}}i!=null&&i.hunkLines.length>0&&(Re(i,s,"trailing"),Ie(i,e));const a=e.join(`
|
|
3
3
|
`);return t.endsWith(`
|
|
4
4
|
`)?`${a}
|
package/dist/assets/{FileSaveConflictDialog-BCvbQ234.js → FileSaveConflictDialog-Ci6WdSiS.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{R as a,j as r}from"./vendor-react-B5Z1Mdn3.js";import{D}from"./vendor-react-drawio-BYDptOsj.js";import{o as C}from"./index-
|
|
1
|
+
import{R as a,j as r}from"./vendor-react-B5Z1Mdn3.js";import{D}from"./vendor-react-drawio-BYDptOsj.js";import{o as C}from"./index-CpSdU-d4.js";import{ag as E,ah as S,ai as N,aj as B,ak as F,al as H,B as h}from"./useAppFontEffects-Dq7xKVjh.js";const A='<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>';function w(){if(typeof document>"u")return!1;const t=document.documentElement.getAttribute("data-theme");return t==="dark"||!t&&window.matchMedia("(prefers-color-scheme: dark)").matches}const P=a.forwardRef(function({xml:e,readOnly:s,className:d,onChange:u},m){const l=a.useRef(e),c=a.useRef(null),i=a.useRef(!1),[o,j]=a.useState(w),f=a.useRef(e),p=a.useRef(e);p.current!==e&&(p.current=e,f.current=e,l.current=e);const v=a.useRef(o);v.current!==o&&(v.current=o,f.current=l.current);const g=a.useRef(null);a.useEffect(()=>{const n=()=>j(w());n();const x=new MutationObserver(n);return x.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>x.disconnect()},[]),a.useEffect(()=>{const n=setTimeout(()=>{g.current?.querySelector(".diagrams-iframe")?.focus()},600);return()=>clearTimeout(n)},[]),a.useImperativeHandle(m,()=>({getXml:()=>l.current}));const y=a.useCallback(()=>{!e&&!i.current&&(i.current=!0,setTimeout(()=>{c.current?.template({})},500))},[e]),R=a.useCallback(n=>{l.current=n.xml,u?.(n.xml)},[u]);return r.jsx("div",{ref:g,className:C("h-full w-full",d),children:r.jsx(D,{ref:c,xml:f.current||A,autosave:!0,urlParameters:{ui:s?"simple":o?"dark":"kennedy",spin:!0,libraries:!s,chrome:s,nav:s,layers:s,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:y,onAutoSave:R},o?"dark":"light")})}),T=(t,e)=>!t||t.runtimeKey!==e.runtimeKey||t.root!==e.root||t.path!==e.path||t.generation!==e.generation,b=t=>{if(typeof t=="string")return t;if(t===null)return null},X=(t,e)=>{if(e===!0)return t!==void 0?{expectedRevision:b(t),overwrite:!0}:{overwrite:!0};if(t!==void 0)return{expectedRevision:b(t)}},G=(t,e)=>!!(t&&e&&t.runtimeKey===e.runtimeKey&&t.root===e.root&&t.path===e.path&&t.generation===e.generation),k=(t,e=4e3)=>t.length>e?`${t.slice(0,e)}
|
|
2
2
|
|
|
3
3
|
… truncated …`:t,W=({open:t,conflict:e,isResolving:s,showCompare:d,onToggleCompare:u,onReload:m,onOverwrite:l,onClose:c})=>{if(!e)return null;const i=!e.exists;return r.jsx(E,{open:t,onOpenChange:o=>{o||c()},children:r.jsxs(S,{showCloseButton:!1,className:"max-w-lg",children:[r.jsxs(N,{children:[r.jsx(B,{children:i?"File deleted on disk":"File changed on disk"}),r.jsx(F,{children:i?`“${e.displayPath}” was deleted since you opened it. Your edits are preserved. Reload to discard them, or overwrite to recreate the file.`:`“${e.displayPath}” changed since you opened it. Your edits are preserved. Reload to discard them and load the current version, or overwrite to keep your edits.`})]}),d&&!i?r.jsxs("div",{className:"grid max-h-64 grid-cols-1 gap-2 overflow-auto py-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Current version on disk"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.currentContent??"")})]}),r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Your edits"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.dirtyContent)})]})]}):null,r.jsxs(H,{className:"flex flex-wrap gap-2",children:[i?null:r.jsx(h,{variant:"outline",onClick:u,disabled:s,"aria-label":d?"Hide version comparison":"Compare versions",title:d?"Hide version comparison":"Compare versions",children:d?"Hide compare":"Compare"}),r.jsx(h,{variant:"outline",onClick:m,disabled:s,"aria-label":i?"Discard edits and close":"Reload current version",title:i?"Discard edits and close":"Reload current version",children:i?"Discard edits":"Reload"}),r.jsx(h,{variant:"destructive",onClick:l,disabled:s,"aria-label":i?"Recreate file with my edits":"Overwrite with my edits",title:i?"Recreate file with my edits":"Overwrite with my edits",children:s?"Working…":"Overwrite"})]})]})})};export{P as D,W as F,X as b,G as i,T as s};
|