@pi-chamber/web 1.0.8-rc.3 → 1.0.8-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentsSurface-wsW9VCRp.js → AgentsSurface-DbCBygRD.js} +1 -1
- package/dist/assets/{ChoicesArtifact-EwCf4Yxu.js → ChoicesArtifact-DUqhCvXh.js} +1 -1
- package/dist/assets/{DiagramView-BX6N99cQ.js → DiagramView-CnVOyJd2.js} +1 -1
- package/dist/assets/{DiffView-CI0eSnPP.js → DiffView-Db8JXsvA.js} +1 -1
- package/dist/assets/{FileSaveConflictDialog-GLj2W7VE.js → FileSaveConflictDialog-D6xyf709.js} +1 -1
- package/dist/assets/{FilesView-CI0tfZQL.js → FilesView-Cir0Wl9F.js} +1 -1
- package/dist/assets/{GitHubDetailScaffold-B85tZ9m7.js → GitHubDetailScaffold-US37Di_K.js} +1 -1
- package/dist/assets/{GitHubLinkPicker-Y6AuNiGl.js → GitHubLinkPicker-k_D-sk-e.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-BJHBud6i.js → GitHubListPrimitives-DuUXrJGk.js} +1 -1
- package/dist/assets/{GitView-DueE69kW.js → GitView-BdX_3XRr.js} +3 -3
- package/dist/assets/{IssuesSurface-Cg-xkdIu.js → IssuesSurface-Cw93HC0G.js} +2 -2
- package/dist/assets/{JsonTreeView-Cvg6lc40.js → JsonTreeView-Bze4htWt.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DExPx-QM.js → MarkdownRendererImpl-Ch7NDkF9.js} +1 -1
- package/dist/assets/{PatchDiff-_c3HZ34I.js → PatchDiff-l68Yz45X.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CZnaqO-_.js → PierreDiffViewer-BHBySiXQ.js} +1 -1
- package/dist/assets/{PullRequestsSurface-C9AYPiwo.js → PullRequestsSurface-CGD4_ljc.js} +2 -2
- package/dist/assets/{SessionSwitcherContent-DOpnN-8S.js → SessionSwitcherContent-DqP8OWzB.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-CmHMPZ69.js → SessionSwitcherDropdown-BkTg-cVd.js} +2 -2
- package/dist/assets/{SessionUnreadDot-CZCQ4t1J.js → SessionUnreadDot-CgvC3F5e.js} +1 -1
- package/dist/assets/{SettingsView-D5PO5M3z.js → SettingsView-CkIxCYhs.js} +3 -3
- package/dist/assets/{SettingsWindow-DXV5UOE8.js → SettingsWindow-DSdhzapT.js} +1 -1
- package/dist/assets/{SubagentsArtifact-CO1ZiI1x.js → SubagentsArtifact-BN3aX_8M.js} +1 -1
- package/dist/assets/{ToolOutputDialog-GOwNLj-y.js → ToolOutputDialog-CLwm4TjA.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-BoaiZji6.js → ToolPartDiffPreview-ERAStEKA.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-Chq1X8nw.js → VirtualizedFileDiff-DwR2fZHv.js} +1 -1
- package/dist/assets/{VisualFrame-u7aRcX7O.js → VisualFrame-Dwp7B_st.js} +1 -1
- package/dist/assets/{VisualsArtifact-D9vPjihW.js → VisualsArtifact-DlOxifHd.js} +1 -1
- package/dist/assets/{collapsible-BjpDEohv.js → collapsible-CW-_qd6v.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-DmPCxbok.js → computeVirtualFileMetrics-SlBfr8LB.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-CukNcUeY.js → contextFileOpenGuard-CHoFT50j.js} +1 -1
- package/dist/assets/{fileTreeStatus-CDyfNPYO.js → fileTreeStatus-D0uiC1D0.js} +1 -1
- package/dist/assets/{gitStatusPredicates-uI7Y7L5k.js → gitStatusPredicates-Bj3pkh2e.js} +1 -1
- package/dist/assets/{githubLink-B9Mxac4R.js → githubLink-CheLNuP0.js} +1 -1
- package/dist/assets/{index-BxKPJ9uG.js → index-BFkW-BPM.js} +3 -3
- package/dist/assets/{index-BWq2ibCw.js → index-C8zaLvup.js} +1 -1
- package/dist/assets/{main-ckQ0ciIN.js → main-CUEqZRu1.js} +2 -2
- package/dist/assets/{main-CWfC-9xT.js → main-V66ie29o.js} +4 -4
- package/dist/assets/{markdownCore-p2q2Kxwo.js → markdownCore-BRedKgCo.js} +1 -1
- package/dist/assets/{miniChat-x2TrwRYA.js → miniChat-BXwuEQhz.js} +2 -2
- package/dist/assets/{mobile-B0x2G8h1.js → mobile-7s-xLDG3.js} +2 -2
- package/dist/assets/{nativeFileSave-D542OJlG.js → nativeFileSave-Bj-V_9ae.js} +1 -1
- package/dist/assets/{pi-session-focus-preference-Q_RZUCnt.js → pi-session-focus-preference-clbekCjz.js} +1 -1
- package/dist/assets/{renderDiffWithHighlighter-CSFGSknx.js → renderDiffWithHighlighter-g9eKWi78.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-CFIdesZT.js → renderElectronMiniChatApp-B6BN8YgC.js} +2 -2
- package/dist/assets/{renderFileWithHighlighter-C5JE0mRX.js → renderFileWithHighlighter-DKl6vubK.js} +1 -1
- package/dist/assets/{renderMobileApp-B1ybjcGM.js → renderMobileApp-Bp735rW7.js} +3 -3
- package/dist/assets/{runtimeEndpointReset-DyZSKCYM.js → runtimeEndpointReset-CtHv_OMT.js} +7 -7
- package/dist/assets/{runtimeSurface-BR_dhe7_.js → runtimeSurface-DD4Vn4HC.js} +1 -1
- package/dist/assets/{selection-CfOpW4rA.js → selection-DDT954wY.js} +1 -1
- package/dist/assets/useAppFontEffects-DJCrUN2D.js +226 -0
- package/dist/assets/{useGitHubRemoteSearch-M1AE2YuX.js → useGitHubRemoteSearch-B77fMiwQ.js} +1 -1
- package/dist/assets/{useSwitcherItems-D0i2BYYP.js → useSwitcherItems-CFY3mP06.js} +1 -1
- package/dist/assets/{web-components-wOQkOurQ.js → web-components-XIP_3VZv.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +2 -1
- package/pichamber.d.ts +139 -0
- package/plugins/subagents/extension.js +5 -5
- package/plugins/subagents/package.json +3 -2
- package/plugins/visuals/choices.js +8 -7
- package/plugins/visuals/extension.js +4 -4
- package/plugins/visuals/package.json +1 -1
- package/server/lib/marketplace/DOCUMENTATION.md +2 -2
- package/server/lib/marketplace/npm-registry.js +1 -1
- package/server/lib/marketplace/npm-registry.test.js +1 -1
- package/server/lib/marketplace/service.test.js +4 -4
- package/server/lib/open-url/DOCUMENTATION.md +1 -1
- package/server/lib/pi/extension-card.js +48 -0
- package/server/lib/pi/extension-card.test.js +35 -0
- package/server/lib/pi/extension-commands.js +49 -0
- package/server/lib/pi/extension-commands.test.js +38 -0
- package/server/lib/pi/extension-protocol.js +1 -2
- package/server/lib/pi/fixtures/pichamber-gui-demo.ts +52 -223
- package/server/lib/pi/routes-extension-events.test.js +35 -48
- package/server/lib/pi/routes.js +44 -54
- package/server/lib/pi/routes.test.js +32 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +7 -7
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +0 -54
- package/server/lib/pi/session-daemon/extension-bridge.js +39 -162
- package/server/lib/pi/session-daemon/extension-controls.js +12 -57
- package/server/lib/pi/session-daemon/extension-controls.test.js +4 -34
- package/server/lib/pi/session-daemon/pichamber-api.js +38 -0
- package/server/lib/pi/session-daemon/pichamber-api.test.js +24 -0
- package/server/lib/pi/session-daemon/plugin-host.js +5 -7
- package/server/lib/pi/session-daemon/plugin-host.test.js +2 -3
- package/server/lib/pi/session-daemon/session-daemon-controls.e2e.test.js +53 -7
- package/server/lib/pi/session-daemon/session-daemon-drafts.e2e.test.js +5 -5
- package/server/lib/pi/session-daemon/session-daemon-extensions.e2e.test.js +9 -4
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +28 -71
- package/server/lib/pi/session-daemon/session-daemon-plugins.e2e.test.js +1 -1
- package/server/lib/pi/session-daemon/session-daemon.js +138 -78
- package/server/lib/pi/session-daemon/session-daemon.test.js +68 -0
- package/server/lib/plugins/DOCUMENTATION.md +3 -3
- package/server/lib/plugins/impact.js +2 -4
- package/server/lib/plugins/impact.test.js +0 -1
- package/server/lib/plugins/manifest.js +9 -5
- package/server/lib/plugins/manifest.test.js +5 -4
- package/server/lib/plugins/store.test.js +1 -1
- package/server/lib/plugins/visuals-extension.test.js +16 -14
- package/dist/assets/useAppFontEffects-COMvkffC.js +0 -226
- package/server/lib/pi/session-daemon/pichamber-ui.js +0 -44
|
@@ -20,7 +20,7 @@ const MAX_TOGGLES = 4;
|
|
|
20
20
|
const FORBIDDEN_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
|
|
21
21
|
// Discovery keywords every Pi package or PiChamber plugin carries; they say
|
|
22
22
|
// nothing about what one plugin does, so they are left out of its keywords.
|
|
23
|
-
const DISCOVERY_KEYWORDS = new Set(['pi-package', 'pichamber
|
|
23
|
+
const DISCOVERY_KEYWORDS = new Set(['pi-package', 'pichamber']);
|
|
24
24
|
const MAX_KEYWORDS = 16;
|
|
25
25
|
const MAX_KEYWORD_LENGTH = 40;
|
|
26
26
|
|
|
@@ -99,12 +99,16 @@ const parseState = (value) => {
|
|
|
99
99
|
const parseContributes = (value, stateSchema) => {
|
|
100
100
|
if (value === undefined) return { composerToggles: [], settings: [] };
|
|
101
101
|
if (!isRecord(value)) fail('contributes is invalid');
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
// `contributes.controls` are composer controls whose value PiChamber
|
|
103
|
+
// stores (`state`), where `pichamber.control()` declares ones the
|
|
104
|
+
// extension stores (`command`). Only toggles can be stored today.
|
|
105
|
+
const toggles = value.controls ?? [];
|
|
106
|
+
if (!Array.isArray(toggles) || toggles.length > MAX_TOGGLES) fail('contributes.controls is invalid');
|
|
104
107
|
const toggleIds = new Set();
|
|
105
108
|
const composerToggles = toggles.map((toggle, index) => {
|
|
106
|
-
const field = `contributes.
|
|
109
|
+
const field = `contributes.controls[${index}]`;
|
|
107
110
|
if (!isRecord(toggle)) fail(`${field} is invalid`);
|
|
111
|
+
if (toggle.kind !== 'toggle') fail(`${field}.kind must be toggle`);
|
|
108
112
|
const id = pluginId(toggle.id, `${field}.id`);
|
|
109
113
|
if (toggleIds.has(id)) fail(`${field}.id repeats`);
|
|
110
114
|
toggleIds.add(id);
|
|
@@ -128,7 +132,7 @@ const parseContributes = (value, stateSchema) => {
|
|
|
128
132
|
if (settings.includes(key)) fail(`contributes.settings repeats ${key}`);
|
|
129
133
|
// A composer switch's default is the plugin's own switch in Settings; a
|
|
130
134
|
// second Settings control for it would be a confusing duplicate.
|
|
131
|
-
if (composerToggles.some((toggle) => toggle.state === key)) fail(`contributes.settings lists ${key}, which a composer
|
|
135
|
+
if (composerToggles.some((toggle) => toggle.state === key)) fail(`contributes.settings lists ${key}, which a composer control sets`);
|
|
132
136
|
settings.push(key);
|
|
133
137
|
}
|
|
134
138
|
const contributes = { composerToggles, settings };
|
|
@@ -29,7 +29,7 @@ const validPackage = (pichamber = {}, extra = {}) => ({
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
contributes: {
|
|
32
|
-
|
|
32
|
+
controls: [{ id: 'demo', kind: 'toggle', state: 'on', label: 'Demo', icon: 'artboard', description: 'Toggle it' }],
|
|
33
33
|
settings: ['mode'],
|
|
34
34
|
ui: 'demo',
|
|
35
35
|
},
|
|
@@ -82,7 +82,7 @@ describe('parsePluginPackage', () => {
|
|
|
82
82
|
|
|
83
83
|
it('keeps package keywords that say what it does', () => {
|
|
84
84
|
const manifest = parsePluginPackage(validPackage({}, {
|
|
85
|
-
keywords: ['pi-package', 'PiChamber
|
|
85
|
+
keywords: ['pi-package', 'PiChamber', 'Chart', 'chart', '', 7, 'x'.repeat(41), 'diagram'],
|
|
86
86
|
}), { packageDir });
|
|
87
87
|
expect(manifest.packageName).toBe('demo');
|
|
88
88
|
expect(manifest.keywords).toEqual(['chart', 'diagram']);
|
|
@@ -100,10 +100,11 @@ describe('parsePluginPackage', () => {
|
|
|
100
100
|
expect(reason(validPackage({ state: { on: { type: 'boolean', scope: 'global', default: 'yes', label: 'x' } } }))).toMatch(/default/);
|
|
101
101
|
expect(reason(validPackage({ state: { m: { type: 'enum', scope: 'global', default: 'z', label: 'x', options: [{ value: 'a', label: 'A' }] } } }))).toMatch(/default/);
|
|
102
102
|
expect(reason(validPackage({ state: { constructor: { type: 'boolean', scope: 'global', default: true, label: 'x' } } }))).toMatch(/constructor/);
|
|
103
|
-
expect(reason(validPackage({ contributes: {
|
|
103
|
+
expect(reason(validPackage({ contributes: { controls: [{ id: 'demo', kind: 'toggle', state: 'mode', label: 'x', icon: 'artboard' }] } }))).toMatch(/boolean/);
|
|
104
|
+
expect(reason(validPackage({ contributes: { controls: [{ id: 'demo', state: 'on', label: 'x', icon: 'artboard' }] } }))).toMatch(/kind/);
|
|
104
105
|
expect(reason(validPackage({ contributes: { settings: ['missing'] } }))).toMatch(/unknown/);
|
|
105
106
|
expect(reason(validPackage({ contributes: { settings: ['mode', 'mode'] } }))).toMatch(/repeats/);
|
|
106
|
-
expect(reason(validPackage({ contributes: {
|
|
107
|
+
expect(reason(validPackage({ contributes: { controls: [{ id: 'demo', kind: 'toggle', state: 'on', label: 'Demo', icon: 'artboard' }], settings: ['on'] } }))).toMatch(/composer control/);
|
|
107
108
|
expect(reason({ ...validPackage(), version: 'latest' })).toMatch(/version/);
|
|
108
109
|
expect(reason(validPackage({}, {}), { packageDir: 'relative' })).toMatch(/folder/);
|
|
109
110
|
});
|
|
@@ -32,7 +32,7 @@ const manifest = parsePluginPackage({
|
|
|
32
32
|
options: [{ value: 'a', label: 'A' }, { value: 'b', label: 'B' }],
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
-
contributes: {
|
|
35
|
+
contributes: { controls: [{ id: 'demo', kind: 'toggle', state: 'on', label: 'Demo', icon: 'artboard' }] },
|
|
36
36
|
},
|
|
37
37
|
}, { packageDir: '/plugins/demo', bundled: true });
|
|
38
38
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
2
|
import { mkdir, mkdtemp, symlink, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
@@ -37,6 +37,9 @@ const fakePi = (activeTools = ['read', 'bash']) => {
|
|
|
37
37
|
return pi;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
// The tests that need PiChamber install their own `globalThis.pichamber`.
|
|
41
|
+
afterEach(() => { delete globalThis.pichamber; });
|
|
42
|
+
|
|
40
43
|
describe('Visuals render_html', () => {
|
|
41
44
|
it('returns a short line and the page in details', async () => {
|
|
42
45
|
await expect(renderHtml({ title: ' Sales ', html: '<p>x</p>', height: 300 })).resolves.toEqual({
|
|
@@ -105,21 +108,19 @@ describe('Visuals extension', () => {
|
|
|
105
108
|
expect(pi.active).toEqual(['read', 'bash', TOOL_NAME, CHOICES_TOOL_NAME]);
|
|
106
109
|
});
|
|
107
110
|
|
|
108
|
-
it('shows the options, then asks through pichamber.
|
|
111
|
+
it('shows the options, then asks through pichamber.choose with its own tool call id', async () => {
|
|
109
112
|
const pi = fakePi();
|
|
110
113
|
const order = [];
|
|
111
114
|
const asked = [];
|
|
112
115
|
const ctx = { cwd: '/p', ui: {} };
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return { id: 'b', note: 'darker header' };
|
|
119
|
-
},
|
|
116
|
+
globalThis.pichamber = {
|
|
117
|
+
choose: async (askedCtx, title, choices, opts) => {
|
|
118
|
+
order.push('asked');
|
|
119
|
+
asked.push({ ctx: askedCtx, title, choices, opts });
|
|
120
|
+
return { id: 'b', note: 'darker header' };
|
|
120
121
|
},
|
|
121
122
|
};
|
|
122
|
-
visuals(pi
|
|
123
|
+
visuals(pi);
|
|
123
124
|
const tool = pi.tools.find((entry) => entry.name === CHOICES_TOOL_NAME);
|
|
124
125
|
const signal = new AbortController().signal;
|
|
125
126
|
const result = await tool.execute('call-9', {
|
|
@@ -213,12 +214,13 @@ describe('Visuals render_choices', () => {
|
|
|
213
214
|
const choices = await renderChoices({ title: 'Which?', options: two });
|
|
214
215
|
const listed = [];
|
|
215
216
|
const withSelect = { hasUI: true, ui: { select: async (title, names) => { listed.push({ title, names }); return 'B: Two'; } } };
|
|
216
|
-
await expect(askChoice(
|
|
217
|
+
await expect(askChoice(withSelect, 'call-1', choices)).resolves.toEqual({ asked: true, id: 'b' });
|
|
217
218
|
expect(listed).toEqual([{ title: 'Which?', names: ['A: One', 'B: Two'] }]);
|
|
218
|
-
await expect(askChoice(
|
|
219
|
-
await expect(askChoice(
|
|
219
|
+
await expect(askChoice({ hasUI: true, ui: { select: async () => undefined } }, 'call-1', choices)).resolves.toEqual({ asked: true });
|
|
220
|
+
await expect(askChoice({ hasUI: false, ui: {} }, 'call-1', choices)).resolves.toEqual({ asked: false });
|
|
220
221
|
// An id the question never offered counts as no answer.
|
|
221
|
-
|
|
222
|
+
globalThis.pichamber = { choose: async () => ({ id: 'z' }) };
|
|
223
|
+
await expect(askChoice({}, 'call-1', choices)).resolves.toEqual({ asked: true });
|
|
222
224
|
});
|
|
223
225
|
|
|
224
226
|
it('tells the agent what happened and keeps the answer in details', async () => {
|