@pi-chamber/web 1.0.4-rc.1 → 1.0.4-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DiagramView-DfZMQkXY.js → DiagramView-GKGxPczP.js} +1 -1
- package/dist/assets/{DiffView-BjWUdbL5.js → DiffView-Cay8VAqL.js} +1 -1
- package/dist/assets/{FileSaveConflictDialog-u5L4k_5k.js → FileSaveConflictDialog-BRM9TJo0.js} +1 -1
- package/dist/assets/{FilesView-qP1ypN9J.js → FilesView-CEeQzjc6.js} +1 -1
- package/dist/assets/{GitHubDetailScaffold-zCKCy5OJ.js → GitHubDetailScaffold-q4YP8iyJ.js} +1 -1
- package/dist/assets/{GitHubLinkPicker-CwxKY3lN.js → GitHubLinkPicker-B9xgIW8y.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-Ck3zllel.js → GitHubListPrimitives-XkALat1v.js} +1 -1
- package/dist/assets/{GitView-y2k2i4gR.js → GitView-DV3d0oSJ.js} +3 -3
- package/dist/assets/{IssuesSurface-HWgR87N3.js → IssuesSurface-OTyt9f3A.js} +3 -3
- package/dist/assets/{JsonTreeView-DSuC4naV.js → JsonTreeView-X2Auiy_q.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-CT5ln9em.js → MarkdownRendererImpl-1HameF6j.js} +12 -12
- package/dist/assets/{PatchDiff-DArTeWeK.js → PatchDiff-GMQAv4en.js} +1 -1
- package/dist/assets/{PierreDiffViewer-DQKujzLb.js → PierreDiffViewer-0X__nypk.js} +2 -2
- package/dist/assets/PullRequestsSurface-Dec20SIg.js +2 -0
- package/dist/assets/{SessionSwitcherContent-DEGJyZBl.js → SessionSwitcherContent-DEw4nz7K.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-cC9wVBH7.js → SessionSwitcherDropdown-DmLhbRzE.js} +2 -2
- package/dist/assets/SessionUnreadDot-CJFawQpo.js +1 -0
- package/dist/assets/SettingsView-CwSspvq-.js +6 -0
- package/dist/assets/{SettingsWindow-CZM1dmVb.js → SettingsWindow-DkPv9MaU.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DClOSbJc.js → ToolOutputDialog-DDwbOpTO.js} +3 -3
- package/dist/assets/{ToolPartDiffPreview-BaFiGUDE.js → ToolPartDiffPreview-DZRP7p-Q.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-D6KbvKc6.js → VirtualizedFileDiff-CUWx7JVZ.js} +1 -1
- package/dist/assets/{collapsible-DhV9d4dT.js → collapsible-Ce85nuXX.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-CeMpF2xC.js → computeVirtualFileMetrics-3PpRLd5B.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-Ck5u_kAP.js → contextFileOpenGuard-PoBklHMz.js} +1 -1
- package/dist/assets/{gitStatusPredicates-DEBSqUNE.js → gitStatusPredicates-BvzxqidP.js} +1 -1
- package/dist/assets/{githubLink-DT7i2NlH.js → githubLink-iQ51wqRa.js} +1 -1
- package/dist/assets/{index-eDf4LKLY.js → index-CkMnC_GK.js} +1 -1
- package/dist/assets/{index-6IO1AcJI.js → index-Dd2OcIUY.js} +9 -9
- package/dist/assets/index-DvN8zlLT.css +1 -0
- package/dist/assets/{main-BczEScAA.js → main-FasHq7Ck.js} +2 -2
- package/dist/assets/{main-CHLNMYeJ.js → main-PSCt716b.js} +8 -8
- package/dist/assets/{markdownCore-C4Gk5Zht.js → markdownCore-BH56o6Wu.js} +1 -1
- package/dist/assets/{miniChat-Do3hE87Z.js → miniChat-BzfobBDq.js} +2 -2
- package/dist/assets/{mobile-CTnihwfa.js → mobile-DAzZE2EL.js} +2 -2
- package/dist/assets/{pi-session-focus-preference-LDVCJ_YR.js → pi-session-focus-preference-D2-1HWmY.js} +3 -3
- package/dist/assets/{renderDiffWithHighlighter-CDsgOnkH.js → renderDiffWithHighlighter-l8hZWWBO.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-DSa3gYqR.js → renderElectronMiniChatApp-DGYSIihR.js} +2 -2
- package/dist/assets/{renderFileWithHighlighter-TpKRyfCY.js → renderFileWithHighlighter-BvDoP7ob.js} +1 -1
- package/dist/assets/renderMobileApp-CwgWG0lU.js +11 -0
- package/dist/assets/runtimeEndpointReset-CmI6dBKM.js +62 -0
- package/dist/assets/{runtimeSurface-DW_Ia4q3.js → runtimeSurface-B1GRkkKC.js} +1 -1
- package/dist/assets/{useAppFontEffects-CG3_yteE.js → useAppFontEffects--lKKtKVo.js} +62 -62
- package/dist/assets/{useFilesViewSearch-C_LzYIgD.js → useFilesViewSearch-D1jsGQrN.js} +3 -3
- package/dist/assets/{useGitHubRemoteSearch-DsxWOzKZ.js → useGitHubRemoteSearch-zNgy2bSt.js} +1 -1
- package/dist/assets/{useSwitcherItems-BmoCnS9W.js → useSwitcherItems-OCRYcHeu.js} +1 -1
- package/dist/assets/{web-components-CH3-XV-n.js → web-components-v9fuidaX.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 +2 -2
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +21 -8
- package/server/lib/pi/session-daemon/builtin-extensions.js +37 -0
- package/server/lib/pi/session-daemon/daemon-process.js +6 -0
- package/server/lib/pi/session-daemon/extension-theme.js +75 -0
- package/server/lib/pi/session-daemon/extension-theme.test.js +47 -0
- package/server/lib/pi/session-daemon/prompt-operations.test.js +3 -3
- package/server/lib/pi/session-daemon/prompt-preflight.test.js +12 -14
- package/server/lib/pi/session-daemon/sdk-upgrade.test.js +118 -2
- package/server/lib/pi/session-daemon/send-operation-dedup.test.js +1 -1
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +1 -1
- package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +638 -0
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +437 -0
- package/server/lib/pi/session-daemon/session-daemon.js +61 -42
- package/server/lib/pi/session-daemon/session-daemon.test.js +53 -5
- package/server/lib/pi/session-daemon/session-idle-residency.test.js +1 -1
- package/server/lib/pi/session-daemon/session-replay.test.js +1 -1
- package/server/lib/pi/session-persistence-gap.test.js +2 -3
- package/server/lib/pi/ui-settings-store.js +1 -0
- package/server/lib/pi/ui-settings-store.test.js +27 -0
- package/dist/assets/PullRequestsSurface-Cfb1wSvC.js +0 -2
- package/dist/assets/SessionUnreadDot-CELKNVIM.js +0 -1
- package/dist/assets/SettingsView-CZvRRgJe.js +0 -6
- package/dist/assets/index-BAmzAlNx.css +0 -1
- package/dist/assets/renderMobileApp-CPE-3uMl.js +0 -11
- package/dist/assets/runtimeEndpointReset-CzJfovWI.js +0 -62
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { createServer } from 'node:http';
|
|
2
2
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
6
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
7
|
import { ModelRuntime, SessionManager } from '@earendil-works/pi-coding-agent';
|
|
7
8
|
|
|
9
|
+
import {
|
|
10
|
+
getBuiltinExtensionFactories,
|
|
11
|
+
LOADED_BUILTIN_EXTENSIONS,
|
|
12
|
+
SKIPPED_BUILTIN_EXTENSIONS,
|
|
13
|
+
} from './builtin-extensions.js';
|
|
8
14
|
import { createPiSessionRuntime } from './session-daemon.js';
|
|
9
15
|
import { getPiSessionDirectory } from './session-jsonl.js';
|
|
10
16
|
|
|
@@ -71,7 +77,7 @@ describe('pinned SDK upgrade compatibility', () => {
|
|
|
71
77
|
remoteModels = [{ ...flash, id: 'upgrade-remote-model', name: 'Remote model' }];
|
|
72
78
|
const refresh = () => models.refresh({ providers: ['opencode'], allowNetwork: true, force: true, signal: AbortSignal.timeout(5000) });
|
|
73
79
|
expect((await refresh()).errors.size).toBe(0);
|
|
74
|
-
expect(requests).toEqual([{ url: '/api/models/providers/opencode', etag: '"old-catalog"' }]);
|
|
80
|
+
expect(requests).toEqual([{ url: '/api/models/providers/opencode?types=chat%2Cimage%2Cclassifier', etag: '"old-catalog"' }]);
|
|
75
81
|
expect(models.getModel('opencode', cached.id)).toBeUndefined();
|
|
76
82
|
expect(models.getModel('opencode', remoteModels[0].id)).toBeDefined();
|
|
77
83
|
|
|
@@ -154,4 +160,114 @@ describe('pinned SDK upgrade compatibility', () => {
|
|
|
154
160
|
expect(reopened.getEntries().slice(0, entries.length - 1)).toEqual(entries.slice(1));
|
|
155
161
|
expect(await readFile(settingsFile, 'utf8')).toBe(settings);
|
|
156
162
|
}, 30_000);
|
|
163
|
+
|
|
164
|
+
it('opens a session with context_edit and usage entries without producing extra transcript messages', async () => {
|
|
165
|
+
root = await mkdtemp(join(tmpdir(), 'pichamber-sdk-entries-'));
|
|
166
|
+
const cwd = join(root, 'project');
|
|
167
|
+
const agentDir = join(root, 'agent');
|
|
168
|
+
const sessionDir = getPiSessionDirectory({ cwd, agentDir });
|
|
169
|
+
await mkdir(cwd, { recursive: true });
|
|
170
|
+
await mkdir(sessionDir, { recursive: true });
|
|
171
|
+
const timestamp = '2026-08-07T12:00:00.000Z';
|
|
172
|
+
const sessionId = '37f7e593-0c7e-4c37-bd91-2b7c24c3d98e';
|
|
173
|
+
const sessionFile = join(sessionDir, `2026-08-07T12-00-00-000Z_${sessionId}.jsonl`);
|
|
174
|
+
const entries = [
|
|
175
|
+
{ type: 'session', version: 3, id: sessionId, timestamp, cwd },
|
|
176
|
+
{ type: 'model_change', id: '00000001', parentId: null, timestamp, provider: 'opencode', modelId: 'deepseek-v4-flash' },
|
|
177
|
+
{ type: 'message', id: '00000002', parentId: '00000001', timestamp, message: { role: 'user', content: 'What is 2+2?', timestamp: Date.parse(timestamp) } },
|
|
178
|
+
{ type: 'message', id: '00000003', parentId: '00000002', timestamp, message: {
|
|
179
|
+
role: 'assistant', content: [{ type: 'text', text: '4' }], provider: 'opencode', model: 'deepseek-v4-flash', api: 'openai-completions', stopReason: 'stop', timestamp: Date.parse(timestamp),
|
|
180
|
+
usage: { input: 10, output: 2, cacheRead: 0, cacheWrite: 0, totalTokens: 12, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
181
|
+
} },
|
|
182
|
+
{ type: 'context_edit', id: '00000004', parentId: '00000003', timestamp, targetId: '00000002', replacement: { content: 'What is 2+2 (edited)?' } },
|
|
183
|
+
{ type: 'usage', id: '00000005', parentId: '00000004', timestamp, kind: 'cache_warm', provider: 'opencode', model: 'deepseek-v4-flash', usage: { input: 100, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 100, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } } },
|
|
184
|
+
];
|
|
185
|
+
await writeFile(sessionFile, entries.map((entry) => JSON.stringify(entry)).join('\n') + '\n');
|
|
186
|
+
|
|
187
|
+
runtime = await createPiSessionRuntime({ cwd, agentDir, sessionFile });
|
|
188
|
+
expect(runtime.session.sessionId).toBe(sessionId);
|
|
189
|
+
// Transcript messages contain only user and assistant messages; context_edit and usage are not transcript rows.
|
|
190
|
+
expect(runtime.session.messages).toHaveLength(2);
|
|
191
|
+
expect(runtime.session.messages[0].role).toBe('user');
|
|
192
|
+
expect(runtime.session.messages[0].content).toBe('What is 2+2 (edited)?');
|
|
193
|
+
expect(runtime.session.messages[1].role).toBe('assistant');
|
|
194
|
+
|
|
195
|
+
const manager = runtime.session.sessionManager;
|
|
196
|
+
expect(manager.getEntry('00000004')?.type).toBe('context_edit');
|
|
197
|
+
expect(manager.getEntry('00000005')?.type).toBe('usage');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('filters getModels() and getAvailableSnapshot() to chat models when catalog contains image and classifier models', async () => {
|
|
201
|
+
root = await mkdtemp(join(tmpdir(), 'pichamber-sdk-model-types-'));
|
|
202
|
+
let remoteModels = [];
|
|
203
|
+
server = createServer((_request, response) => {
|
|
204
|
+
response.writeHead(200, {
|
|
205
|
+
'content-type': 'application/json',
|
|
206
|
+
etag: '"types-catalog"',
|
|
207
|
+
'last-modified': 'Wed, 01 Jan 2031 00:00:00 GMT',
|
|
208
|
+
});
|
|
209
|
+
response.end(JSON.stringify(remoteModels));
|
|
210
|
+
});
|
|
211
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
212
|
+
const options = {
|
|
213
|
+
authPath: join(root, 'auth.json'),
|
|
214
|
+
modelsPath: join(root, 'models.json'),
|
|
215
|
+
modelsStorePath: join(root, 'models-store.json'),
|
|
216
|
+
catalogBaseUrl: `http://127.0.0.1:${server.address().port}`,
|
|
217
|
+
allowModelNetwork: true,
|
|
218
|
+
};
|
|
219
|
+
const baseline = await ModelRuntime.create(options);
|
|
220
|
+
const flash = baseline.getModel('opencode', 'deepseek-v4-flash');
|
|
221
|
+
remoteModels = [
|
|
222
|
+
{ ...flash, id: 'chat-model-1', name: 'Chat Model', type: 'chat' },
|
|
223
|
+
{ ...flash, id: 'image-model-1', name: 'Image Model', type: 'image' },
|
|
224
|
+
{ ...flash, id: 'classifier-model-1', name: 'Classifier Model', type: 'classifier' },
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
const models = await ModelRuntime.create(options);
|
|
228
|
+
await models.setRuntimeApiKey('opencode', 'pichamber-test-api-key');
|
|
229
|
+
await models.refresh({ providers: ['opencode'], allowNetwork: true, force: true });
|
|
230
|
+
|
|
231
|
+
const chatModels = models.getModels('opencode');
|
|
232
|
+
expect(chatModels.map((m) => m.id)).toContain('chat-model-1');
|
|
233
|
+
expect(chatModels.map((m) => m.id)).not.toContain('image-model-1');
|
|
234
|
+
expect(chatModels.map((m) => m.id)).not.toContain('classifier-model-1');
|
|
235
|
+
|
|
236
|
+
const availableSnapshot = models.getAvailableSnapshot();
|
|
237
|
+
const opencodeAvailable = availableSnapshot.filter((m) => m.provider === 'opencode' || m.providerId === 'opencode');
|
|
238
|
+
expect(opencodeAvailable.map((m) => m.id)).toContain('chat-model-1');
|
|
239
|
+
expect(opencodeAvailable.map((m) => m.id)).not.toContain('image-model-1');
|
|
240
|
+
expect(opencodeAvailable.map((m) => m.id)).not.toContain('classifier-model-1');
|
|
241
|
+
|
|
242
|
+
// getAllModels returns all types
|
|
243
|
+
const allModels = models.getAllModels('opencode');
|
|
244
|
+
expect(allModels.map((m) => m.id)).toContain('chat-model-1');
|
|
245
|
+
expect(allModels.map((m) => m.id)).toContain('image-model-1');
|
|
246
|
+
expect(allModels.map((m) => m.id)).toContain('classifier-model-1');
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('accounts for every built-in extension the Pi CLI loads', async () => {
|
|
250
|
+
// The CLI's list is not part of the SDK's public exports, so read it from
|
|
251
|
+
// the installed package. A new upstream built-in must be either loaded or
|
|
252
|
+
// listed as skipped with a reason.
|
|
253
|
+
const sdkEntry = fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent'));
|
|
254
|
+
const { builtInExtensions } = await import(pathToFileURL(join(dirname(sdkEntry), 'extensions', 'index.js')).href);
|
|
255
|
+
const upstream = builtInExtensions.map((extension) => extension.name).sort();
|
|
256
|
+
expect(upstream.length).toBeGreaterThan(0);
|
|
257
|
+
|
|
258
|
+
const loaded = LOADED_BUILTIN_EXTENSIONS.map((extension) => extension.name);
|
|
259
|
+
const accounted = [...loaded, ...Object.keys(SKIPPED_BUILTIN_EXTENSIONS)].sort();
|
|
260
|
+
expect(accounted).toEqual(upstream);
|
|
261
|
+
|
|
262
|
+
// Each loaded entry keeps the flags the CLI gives it.
|
|
263
|
+
const factories = getBuiltinExtensionFactories();
|
|
264
|
+
expect(factories.map((factory) => factory.name)).toEqual(loaded);
|
|
265
|
+
for (const factory of factories) {
|
|
266
|
+
const cli = builtInExtensions.find((extension) => extension.name === factory.name);
|
|
267
|
+
expect(typeof factory.factory).toBe('function');
|
|
268
|
+
expect({ builtin: factory.builtin, replaceable: factory.replaceable })
|
|
269
|
+
.toEqual({ builtin: cli.builtin === true, replaceable: cli.replaceable === true });
|
|
270
|
+
}
|
|
271
|
+
expect(getBuiltinExtensionFactories({})).toEqual([]);
|
|
272
|
+
});
|
|
157
273
|
});
|
|
@@ -58,7 +58,7 @@ class FakeSession {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
async prompt(text, options) {
|
|
61
|
-
options?.preflightResult?.(
|
|
61
|
+
options?.preflightResult?.('started');
|
|
62
62
|
const deliverAs = options?.streamingBehavior;
|
|
63
63
|
this.sent.push({ text, options: deliverAs ? { deliverAs } : undefined });
|
|
64
64
|
}
|