@firstpick/pi-package-webui 0.6.1 β 0.6.3
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 +6 -1
- package/bin/pi-webui.mjs +459 -1
- package/package.json +13 -9
- package/public/app.js +341 -2
- package/public/index.html +14 -0
- package/public/styles.css +38 -13
- package/tests/mobile-static.test.mjs +41 -6
- package/tests/native-parity.test.mjs +1 -0
- package/webui-rpc-helper.mjs +29 -0
|
@@ -23,16 +23,22 @@ const [pkgRaw, html, css, app, server, extension, readme, startScript, manifestR
|
|
|
23
23
|
]);
|
|
24
24
|
const pkg = JSON.parse(pkgRaw);
|
|
25
25
|
const manifest = JSON.parse(manifestRaw);
|
|
26
|
+
const lock = JSON.parse(await readFile(join(root, "package-lock.json"), "utf8"));
|
|
27
|
+
const helper = await readFile(join(root, "webui-rpc-helper.mjs"), "utf8");
|
|
26
28
|
const companionDependencies = {
|
|
27
|
-
"@firstpick/pi-extension-
|
|
28
|
-
"@firstpick/pi-extension-
|
|
29
|
-
"@firstpick/pi-extension-
|
|
29
|
+
"@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
|
|
30
|
+
"@firstpick/pi-extension-btw": "^0.1.2",
|
|
31
|
+
"@firstpick/pi-extension-fish-user-bash": "^0.2.0",
|
|
32
|
+
"@firstpick/pi-extension-git-footer-status": "^0.3.6",
|
|
33
|
+
"@firstpick/pi-extension-release-aur": "^0.1.7",
|
|
30
34
|
"@firstpick/pi-extension-release-npm": "^0.4.0",
|
|
31
35
|
"@firstpick/pi-extension-safety-guard": "^0.2.3",
|
|
32
36
|
"@firstpick/pi-extension-setup-skills": "^0.1.8",
|
|
33
|
-
"@firstpick/pi-extension-stats": "^0.2.
|
|
34
|
-
"@firstpick/pi-extension-todo-progress": "^0.2.
|
|
37
|
+
"@firstpick/pi-extension-stats": "^0.2.8",
|
|
38
|
+
"@firstpick/pi-extension-todo-progress": "^0.2.7",
|
|
35
39
|
"@firstpick/pi-extension-tools": "^0.1.6",
|
|
40
|
+
"@firstpick/pi-extension-workflows": "^0.1.2",
|
|
41
|
+
"@firstpick/pi-package-remote-webui": "^0.1.5",
|
|
36
42
|
"@firstpick/pi-prompts-git-pr": "^0.1.2",
|
|
37
43
|
"@firstpick/pi-themes-bundle": "^0.1.4",
|
|
38
44
|
};
|
|
@@ -753,7 +759,10 @@ assert.match(css, /\.composer-remote-mic-consent[\s\S]*\.composer-remote-mic-con
|
|
|
753
759
|
assert.match(css, /\.composer-conversation-mode-chip\[data-voice-state="speaking"\]/, "conversation chip should style voice states");
|
|
754
760
|
assert.match(serviceWorker.toString(), /\/voice-conversation\.mjs/, "service worker app shell should include the voice module");
|
|
755
761
|
assert.ok(pkg.scripts.check.includes("node --check public/voice-conversation.mjs"), "npm run check should parse the voice module");
|
|
756
|
-
assert.match(app, /
|
|
762
|
+
assert.match(app, /id: "bangCommandAutocomplete"[\s\S]*packageName: "@firstpick\/pi-extension-bang-command-autocomplete"[\s\S]*capabilityLabel: "\/bang-status or \/bang-refresh"/, "optional features should list bang-command autocomplete by loaded command capability");
|
|
763
|
+
assert.match(app, /id: "fishUserBash"[\s\S]*packageName: "@firstpick\/pi-extension-fish-user-bash"[\s\S]*capabilityLabel: "\/user-bash-shell"/, "optional features should list fish user-bash by loaded command capability");
|
|
764
|
+
assert.match(app, /OPTIONAL_COMMAND_FEATURES = new Map\(\[[\s\S]*\["bang-refresh", "bangCommandAutocomplete"\][\s\S]*\["bang-status", "bangCommandAutocomplete"\][\s\S]*\["user-bash-shell", "fishUserBash"\]/, "optional command mapping should gate bang and fish companion commands");
|
|
765
|
+
assert.match(app, /function updateOptionalFeatureAvailability\(\)[\s\S]*hasAvailableCommand\("bang-status"\) \|\| hasAvailableCommand\("bang-refresh"\)[\s\S]*hasAvailableCommand\("user-bash-shell"\)[\s\S]*hasAvailableCommand\("git-staged-msg"\)[\s\S]*hasAvailableCommand\("release-npm"\)[\s\S]*hasAvailableCommand\("release-aur"\)[\s\S]*hasAvailableCommand\("safety-guard"\)[\s\S]*hasLoadedRpcCommand\("skills"\)[\s\S]*hasAvailableCommand\("todo-progress-status"\)[\s\S]*hasLoadedRpcCommand\("tools"\)[\s\S]*hasAvailableCommand\("remote"\)[\s\S]*NATURAL_CONVERSATION_COMMAND_NAMES\.some\(\(name\) => hasAvailableCommand\(name\)\)/, "optional feature detection should call RPC-visible commands directly and distinguish native resource selectors from TUI companions");
|
|
757
766
|
assert.match(app, /hasRemoteWebuiCommand = isOptionalFeatureEnabled\("remoteWebui"\) && hasAvailableCommand\("remote"\)[\s\S]*optionsRemoteButton\.hidden = !hasRemoteWebuiCommand[\s\S]*syncRemoteWebuiControlVisibility\(hasRemoteWebuiCommand\)/, "Options menu should track /remote availability and delegate network card visibility");
|
|
758
767
|
assert.match(app, /function syncRemoteWebuiControlVisibility[\s\S]*networkControlField\.hidden = !hasRemoteWebuiCommand/, "Remote WebUI network card should render whenever the optional feature and /remote command are enabled");
|
|
759
768
|
assert.match(app, /if \(featureId === "remoteWebui"\) syncRemoteWebuiControlVisibility\(false\)/, "Disabling Remote WebUI should immediately hide browser network controls before broader rerendering");
|
|
@@ -981,9 +990,16 @@ assert.match(app, /let pathSuggestActiveQuery = null/, "@ autocomplete should tr
|
|
|
981
990
|
assert.match(app, /pathSuggestActiveQuery === trigger\.query[\s\S]*?return;/, "@ autocomplete should skip duplicate same-query fetches from input and keyup events");
|
|
982
991
|
assert.match(app, /const keepExistingPathMenu = suggestionMode === "path"[\s\S]*?if \(!keepExistingPathMenu\) \{[\s\S]*?Finding pathsβ¦/, "@ autocomplete should keep the existing menu visible while refreshing a new path query");
|
|
983
992
|
assert.match(app, /elements\.commandSuggest\.setAttribute\("aria-busy", "true"\)/, "@ autocomplete should mark async path refreshes busy without clearing rendered suggestions");
|
|
993
|
+
assert.match(app, /function getBangTrigger\(\)/, "prompt composer should detect leading ! and !! shell command triggers");
|
|
994
|
+
assert.match(app, /function renderBangSuggestions\(trigger[\s\S]*api\(`\/api\/bang-suggestions\?query=\$\{encodeURIComponent\(trigger\.query\)\}`/, "bang autocomplete should load suggestions from the Web UI server as the user types");
|
|
995
|
+
assert.match(app, /function renderBangSuggestionItems\(trigger[\s\S]*insertBangSuggestion\(index\)/, "bang autocomplete should render clickable shell command suggestions");
|
|
996
|
+
assert.match(app, /function insertBangSuggestion\(index = commandSuggestIndex\)/, "accepting a bang suggestion should insert a shell command after the ! or !! prefix");
|
|
997
|
+
assert.match(app, /if \(suggestionMode === "bang"\) return insertBangSuggestion\(index\)/, "generic autocomplete insertion should route bang suggestions to the bang inserter");
|
|
998
|
+
assert.match(app, /isOptionalFeatureEnabled\("bangCommandAutocomplete"\)[\s\S]*renderBangSuggestions\(bangTrigger/, "bang autocomplete should only render when the optional companion is detected and enabled");
|
|
984
999
|
assert.match(app, /function setActiveCommandSuggestionFromPointerMove\(index, event\)/, "command and path autocomplete should route pointer selection through movement detection");
|
|
985
1000
|
assert.match(app, /item\.addEventListener\("pointermove", \(event\) => setActiveCommandSuggestionFromPointerMove\(index, event\)\);[\s\S]*?item\.addEventListener\("click", \(\) => insertCommandSuggestion\(index\)\);/, "slash command autocomplete should only follow pointer movement before click insertion");
|
|
986
1001
|
assert.match(app, /item\.addEventListener\("pointermove", \(event\) => setActiveCommandSuggestionFromPointerMove\(index, event\)\);[\s\S]*?item\.addEventListener\("click", \(\) => insertPathSuggestion\(index\)\);/, "path autocomplete should only follow pointer movement before click insertion");
|
|
1002
|
+
assert.match(app, /item\.addEventListener\("pointermove", \(event\) => setActiveCommandSuggestionFromPointerMove\(index, event\)\);[\s\S]*?item\.addEventListener\("click", \(\) => insertBangSuggestion\(index\)\);/, "bang autocomplete should only follow pointer movement before click insertion");
|
|
987
1003
|
assert.doesNotMatch(app, /addEventListener\("mouseenter", \(\) => setActiveCommandSuggestion\(index\)\)/, "autocomplete should not change active selection on stationary mouseenter");
|
|
988
1004
|
assert.match(app, /function resizePromptInput\(\)/, "prompt textarea should auto-resize from a one-line default");
|
|
989
1005
|
assert.match(app, /elements\.promptInput\.addEventListener\("input", \(\) => \{[\s\S]*?resizePromptInput\(\);/, "prompt textarea should resize whenever the user edits it");
|
|
@@ -1314,6 +1330,10 @@ assert.match(server, /function fastPicksStorageFile\(/, "server should define a
|
|
|
1314
1330
|
assert.match(server, /PI_WEBUI_FAST_PICKS_FILE/, "server should allow overriding the fast-picks storage path");
|
|
1315
1331
|
assert.match(server, /async function getPathSuggestionData\(tab, rawQuery\)/, "server should compute @ file\/path reference suggestions for the active tab cwd");
|
|
1316
1332
|
assert.match(server, /url\.pathname === "\/api\/path-suggestions" && req\.method === "GET"/, "server should expose GET /api/path-suggestions for @ reference autocomplete");
|
|
1333
|
+
assert.match(server, /async function getBangSuggestionData\(tab, rawQuery\)/, "server should compute ! and !! shell command suggestions for the active tab cwd");
|
|
1334
|
+
assert.match(server, /PI_BANG_AUTOCOMPLETE_INCLUDE_HISTORY/, "server bang suggestions should support the companion's history knob");
|
|
1335
|
+
assert.match(server, /PI_BANG_AUTOCOMPLETE_RUNTIME_STORE_PATH/, "server bang suggestions should support the companion's runtime-store knob");
|
|
1336
|
+
assert.match(server, /url\.pathname === "\/api\/bang-suggestions" && req\.method === "GET"/, "server should expose GET /api/bang-suggestions for bang-command autocomplete");
|
|
1317
1337
|
assert.match(server, /url\.pathname === "\/api\/path-fast-picks" && req\.method === "GET"/, "server should expose GET /api/path-fast-picks");
|
|
1318
1338
|
assert.match(server, /url\.pathname === "\/api\/path-fast-picks" && req\.method === "POST"/, "server should expose POST /api/path-fast-picks");
|
|
1319
1339
|
assert.match(server, /url\.pathname === "\/api\/scoped-models" && req\.method === "GET"/, "server should expose GET /api/scoped-models");
|
|
@@ -1329,6 +1349,8 @@ assert.match(server, /type: "set_follow_up_mode"/, "server should expose follow-
|
|
|
1329
1349
|
assert.match(server, /type: "set_auto_compaction"/, "server should expose auto-compaction changes for native /settings");
|
|
1330
1350
|
assert.match(server, /@firstpick\/pi-themes-bundle/, "server should discover themes from the optional theme package");
|
|
1331
1351
|
assert.match(server, /const OPTIONAL_FEATURE_PACKAGES = new Map/, "server should whitelist optional feature packages for install actions");
|
|
1352
|
+
assert.match(server, /\["bangCommandAutocomplete", "@firstpick\/pi-extension-bang-command-autocomplete"\]/, "server should allow installing the bang autocomplete optional feature");
|
|
1353
|
+
assert.match(server, /\["fishUserBash", "@firstpick\/pi-extension-fish-user-bash"\]/, "server should allow installing the fish user-bash optional feature");
|
|
1332
1354
|
assert.match(server, /\["btwCommand", "@firstpick\/pi-extension-btw"\]/, "server should allow installing the /btw optional feature");
|
|
1333
1355
|
assert.match(server, /\["safetyGuard", "@firstpick\/pi-extension-safety-guard"\]/, "server should allow installing the safety guard optional feature");
|
|
1334
1356
|
assert.match(server, /\["tuiSkillsCommand", "@firstpick\/pi-extension-setup-skills"\]/, "server should allow installing the TUI skills optional feature");
|
|
@@ -1376,6 +1398,8 @@ assert.match(readme, /Automatic tab naming from the first prompt/, "README shoul
|
|
|
1376
1398
|
assert.match(readme, /Feedback reactions \(`π`, `π`, `\?`\) on final assistant output plus tool\/bash action cards/, "README should describe final-output and action feedback reactions");
|
|
1377
1399
|
assert.match(readme, /POST \/api\/action-feedback\?tab=<tabId>/, "README should document the action-feedback endpoint");
|
|
1378
1400
|
assert.match(readme, /`@` file\/path references with live suggestions/, "README should describe @ file/path reference autocomplete");
|
|
1401
|
+
assert.match(readme, /optional `@firstpick\/pi-extension-bang-command-autocomplete` companion[\s\S]*GET \/api\/bang-suggestions\?tab=<tabId>&query=<command>/, "README should document optional bang-command autocomplete and its endpoint");
|
|
1402
|
+
assert.match(readme, /optional `@firstpick\/pi-extension-fish-user-bash` companion/, "README should document optional fish user-bash integration");
|
|
1379
1403
|
assert.match(readme, /GET \/api\/path-suggestions\?tab=<tabId>&query=<path>/, "README should document the path-suggestions endpoint");
|
|
1380
1404
|
assert.match(readme, /GET \/api\/optional-features/, "README should document optional feature status endpoint");
|
|
1381
1405
|
assert.match(readme, /POST \/api\/optional-feature-install/, "README should document optional feature install endpoint");
|
|
@@ -1407,12 +1431,17 @@ assert.ok(!pkg.files?.some((entry) => entry === "dev/scripts" || entry.startsWit
|
|
|
1407
1431
|
for (const [name, range] of Object.entries(companionDependencies)) {
|
|
1408
1432
|
assert.equal(pkg.optionalDependencies?.[name], range, `webui package should optionally depend on ${name}`);
|
|
1409
1433
|
assert.equal(pkg.dependencies?.[name], undefined, `webui package should not require optional companion ${name}`);
|
|
1434
|
+
assert.equal(lock.packages?.[""]?.optionalDependencies?.[name], range, `package-lock root should optionally depend on ${name}`);
|
|
1435
|
+
assert.equal(lock.packages?.[""]?.dependencies?.[name], undefined, `package-lock root should not require optional companion ${name}`);
|
|
1436
|
+
assert.ok(lock.packages?.[`node_modules/${name}`], `package-lock should include resolved optional companion ${name}`);
|
|
1410
1437
|
}
|
|
1411
1438
|
assert.equal(pkg.bundledDependencies, undefined, "webui optional companion packages should not be bundled into the tarball");
|
|
1412
1439
|
assert.equal(pkg.optionalDependencies?.["@firstpick/pi-package-natural-conversation"], undefined, "webui package should not optionally depend on the standalone Natural Conversation package");
|
|
1413
1440
|
assert.ok(!pkg.pi?.extensions?.some((entry) => String(entry).includes("pi-package-natural-conversation")), "webui Pi manifest should not load Natural Conversation directly; /talk must come from the standalone package");
|
|
1414
1441
|
assert.ok(pkg.pi?.extensions?.includes("./index.ts"), "webui Pi manifest should load its own extension");
|
|
1415
1442
|
for (const extensionPath of [
|
|
1443
|
+
"node_modules/@firstpick/pi-extension-bang-command-autocomplete/index.ts",
|
|
1444
|
+
"node_modules/@firstpick/pi-extension-fish-user-bash/index.ts",
|
|
1416
1445
|
"node_modules/@firstpick/pi-extension-git-footer-status/index.ts",
|
|
1417
1446
|
"node_modules/@firstpick/pi-extension-release-aur/index.ts",
|
|
1418
1447
|
"node_modules/@firstpick/pi-extension-release-npm/index.ts",
|
|
@@ -1425,6 +1454,8 @@ for (const extensionPath of [
|
|
|
1425
1454
|
assert.ok(pkg.pi?.extensions?.includes(extensionPath), `webui Pi manifest should load ${extensionPath} when present`);
|
|
1426
1455
|
}
|
|
1427
1456
|
for (const siblingExtensionPath of [
|
|
1457
|
+
"../pi-extension-bang-command-autocomplete/index.ts",
|
|
1458
|
+
"../pi-extension-fish-user-bash/index.ts",
|
|
1428
1459
|
"../pi-extension-git-footer-status/index.ts",
|
|
1429
1460
|
"../pi-extension-release-aur/index.ts",
|
|
1430
1461
|
"../pi-extension-release-npm/index.ts",
|
|
@@ -1436,6 +1467,10 @@ for (const siblingExtensionPath of [
|
|
|
1436
1467
|
]) {
|
|
1437
1468
|
assert.ok(!pkg.pi?.extensions?.includes(siblingExtensionPath), `webui Pi manifest should avoid duplicate sibling load path ${siblingExtensionPath}`);
|
|
1438
1469
|
}
|
|
1470
|
+
assert.match(helper, /function installRpcUserBashSupport\(\)/, "Web UI RPC helper should patch RPC bash execution for user_bash events");
|
|
1471
|
+
assert.match(helper, /runner\?\.hasHandlers\?\.\("user_bash"\)[\s\S]*runner\.emitUserBash/, "Web UI RPC helper should emit user_bash before default bash execution");
|
|
1472
|
+
assert.match(helper, /eventResult\?\.operations[\s\S]*original\.call\(this, command, onChunk, nextOptions\)/, "Web UI RPC helper should pass extension-provided bash operations to Pi execution");
|
|
1473
|
+
assert.match(helper, /eventResult\?\.result[\s\S]*recordBashResult/, "Web UI RPC helper should preserve extension-provided bash results in session history");
|
|
1439
1474
|
assert.ok(pkg.pi?.skills?.includes("node_modules/@firstpick/pi-extension-release-aur/skills"), "webui Pi manifest should load release-aur nested skills when present");
|
|
1440
1475
|
assert.ok(!pkg.pi?.skills?.includes("../pi-extension-release-aur/skills"), "webui Pi manifest should avoid duplicate release-aur sibling skills");
|
|
1441
1476
|
assert.ok(pkg.pi?.prompts?.includes("node_modules/@firstpick/pi-prompts-git-pr/prompts"), "webui Pi manifest should load guided-git nested prompts when present");
|
|
@@ -162,6 +162,7 @@ assert.match(server, /case "\/api\/abort-bash":[\s\S]*?return \{ type: "abort_ba
|
|
|
162
162
|
assert.match(app, /function parseUserBashInput\(message\)[\s\S]*?text\.startsWith\("!!"\)/, "frontend should detect !! bash commands before prompt forwarding");
|
|
163
163
|
assert.match(app, /const userBash = kind === "prompt" && attachments\.length === 0 \? parseUserBashInput\(originalMessage\) : null/, "prompt sending should intercept user bash only for plain prompt input");
|
|
164
164
|
assert.match(app, /api\("\/api\/bash", \{ method: "POST", body: \{ command, excludeFromContext \}/, "frontend should send user bash commands to the bash endpoint");
|
|
165
|
+
assert.match(app, /function isCompleteUserBashMessage\(message\)[\s\S]*?title\.includes\("complete"\)[\s\S]*?function shouldOpenMessageCollapseByDefault\(message\)[\s\S]*?isCompleteUserBashMessage\(message\)/, "frontend should expand completed user bash cards by default without toggling all tool output");
|
|
165
166
|
assert.match(app, /api\("\/api\/abort-bash", \{ method: "POST", body: \{\}, tabId: tabContext\.tabId \}\)/, "abort should target active user bash before agent abort");
|
|
166
167
|
assert.match(server, /async function cycleTabModel\(tab, direction = "forward"\)/, "server should provide scoped\/all model cycling helper");
|
|
167
168
|
assert.match(server, /url\.pathname === "\/api\/model-cycle" && req\.method === "POST"/, "server should expose model-cycle endpoint for shortcuts");
|
package/webui-rpc-helper.mjs
CHANGED
|
@@ -36,6 +36,35 @@ function installActiveCommandSessionCapture() {
|
|
|
36
36
|
|
|
37
37
|
installActiveCommandSessionCapture();
|
|
38
38
|
|
|
39
|
+
function installRpcUserBashSupport() {
|
|
40
|
+
const proto = AgentSession?.prototype;
|
|
41
|
+
if (!proto || proto.__webuiHelperUserBashSupportInstalled) return;
|
|
42
|
+
const original = proto.executeBash;
|
|
43
|
+
if (typeof original !== "function") return;
|
|
44
|
+
Object.defineProperty(proto, "__webuiHelperUserBashSupportInstalled", { value: true });
|
|
45
|
+
proto.executeBash = async function webuiHelperExecuteBash(command, onChunk, options = {}) {
|
|
46
|
+
const runner = this.extensionRunner;
|
|
47
|
+
const eventResult = runner?.hasHandlers?.("user_bash")
|
|
48
|
+
? await runner.emitUserBash({
|
|
49
|
+
type: "user_bash",
|
|
50
|
+
command,
|
|
51
|
+
excludeFromContext: options?.excludeFromContext === true,
|
|
52
|
+
cwd: this.sessionManager?.getCwd?.() || this._cwd || process.cwd(),
|
|
53
|
+
})
|
|
54
|
+
: undefined;
|
|
55
|
+
|
|
56
|
+
if (eventResult?.result) {
|
|
57
|
+
this.recordBashResult(command, eventResult.result, { excludeFromContext: options?.excludeFromContext === true });
|
|
58
|
+
return eventResult.result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const nextOptions = eventResult?.operations ? { ...options, operations: eventResult.operations } : options;
|
|
62
|
+
return original.call(this, command, onChunk, nextOptions);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
installRpcUserBashSupport();
|
|
67
|
+
|
|
39
68
|
function responseMessage(payload) {
|
|
40
69
|
return `${RESPONSE_PREFIX}${JSON.stringify(payload)}`;
|
|
41
70
|
}
|