@firstpick/pi-package-webui 0.10.1 → 0.10.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/DEVELOPMENT.md +41 -19
- package/README.md +13 -3
- package/TECHNICAL.md +16 -2
- package/bin/pi-webui.mjs +257 -76
- package/index.ts +1 -256
- package/lib/append-system-selection.mjs +311 -0
- package/lib/git-workflow-preferences.mjs +6 -0
- package/lib/trust-boundaries.mjs +37 -0
- package/package.json +1 -1
- package/public/app.js +162 -7
- package/public/index.html +5 -2
- package/public/service-worker.js +1 -1
- package/tests/append-system-http.test.mjs +622 -0
- package/tests/append-system-selection.test.mjs +259 -0
- package/tests/append-system-selector-static.test.mjs +95 -0
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +4 -0
- package/tests/common-options-submenus-markup-static.test.mjs +2 -1
- package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
- package/tests/control-visibility-static.test.mjs +2 -2
- package/tests/controls-layout-static.test.mjs +2 -2
- package/tests/events-tree-context-menu-static.test.mjs +2 -2
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +2 -2
- package/tests/guided-git-activation-static.test.mjs +10 -3
- package/tests/guided-git-fallback-runtime.test.mjs +46 -21
- package/tests/guided-git-fallback-ui-static.test.mjs +3 -3
- package/tests/intercom-conversation-viewer-static.test.mjs +2 -2
- package/tests/main-output-loading-static.test.mjs +2 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
- package/tests/mobile-foundation-static.test.mjs +2 -2
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +3 -2
- package/tests/native-parity-harness.test.mjs +7 -0
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-prompt-impact-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +2 -2
- package/tests/prompt-input-vertical-scroll-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +2 -2
- package/tests/resource-tui-extension.test.mjs +4 -18
- package/tests/session-sampling-ui-static.test.mjs +2 -2
- package/tests/side-panel-section-height-removal-static.test.mjs +2 -2
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +2 -2
- package/tests/terminal-tab-prompt-tooltip-static.test.mjs +147 -0
- package/tests/terminal-tab-workspace-static.test.mjs +1 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/windows-drive-cwd-picker-static.test.mjs +2 -2
- package/lib/tui-model-profile-selector.mjs +0 -183
- package/lib/tui-resource-selector.mjs +0 -173
- package/tests/tui-model-profile-selector.test.mjs +0 -102
- package/tests/tui-resource-selector.test.mjs +0 -74
package/public/app.js
CHANGED
|
@@ -200,6 +200,7 @@ const elements = {
|
|
|
200
200
|
optionsNameButton: $("#optionsNameButton"),
|
|
201
201
|
optionsCloneButton: $("#optionsCloneButton"),
|
|
202
202
|
optionsSettingsButton: $("#optionsSettingsButton"),
|
|
203
|
+
optionsAppendSystemButton: $("#optionsAppendSystemButton"),
|
|
203
204
|
optionsSummarySetupButton: $("#optionsSummarySetupButton"),
|
|
204
205
|
optionsWorkflowSetupButton: $("#optionsWorkflowSetupButton"),
|
|
205
206
|
optionsSafetyGuardSetupButton: $("#optionsSafetyGuardSetupButton"),
|
|
@@ -1089,6 +1090,7 @@ let gitPanelRenderSignature = null;
|
|
|
1089
1090
|
let gitChangesRequestSerial = 0;
|
|
1090
1091
|
const gitChangesUntrackedContentRequests = new Set();
|
|
1091
1092
|
let nativeCommandTabId = null;
|
|
1093
|
+
let nativeCommandDialogGeneration = 0;
|
|
1092
1094
|
let nativeSettingsDirty = false;
|
|
1093
1095
|
let guidedGitSetupDialogOwner = null;
|
|
1094
1096
|
let sessionSummaryOverlayTabId = null;
|
|
@@ -17206,6 +17208,19 @@ function terminalTabActiveTooltip(tab) {
|
|
|
17206
17208
|
return active.join(" · ");
|
|
17207
17209
|
}
|
|
17208
17210
|
|
|
17211
|
+
function terminalTabPromptTooltip(tab) {
|
|
17212
|
+
const prompt = tab?.prompt;
|
|
17213
|
+
if (!prompt || typeof prompt !== "object" || Array.isArray(prompt) || Object.keys(prompt).length !== 2 || !Object.hasOwn(prompt, "kind") || !Object.hasOwn(prompt, "path") || prompt.kind !== "append-system") return "";
|
|
17214
|
+
const path = prompt.path;
|
|
17215
|
+
const absolute = typeof path === "string" && (path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path) || path.startsWith("\\\\"));
|
|
17216
|
+
if (!absolute || path.length > 4096 || /[\u0000-\u001f\u007f]/.test(path)) return "";
|
|
17217
|
+
return `Append-system prompt: ${path}`;
|
|
17218
|
+
}
|
|
17219
|
+
|
|
17220
|
+
function terminalTabGroupRepresentedTab(groupTabs = []) {
|
|
17221
|
+
return groupTabs.find((tab) => typeof activeTabId !== "undefined" && tab?.id === activeTabId) || groupTabs[0] || null;
|
|
17222
|
+
}
|
|
17223
|
+
|
|
17209
17224
|
function terminalTabTooltip(tab) {
|
|
17210
17225
|
const lines = [
|
|
17211
17226
|
`${tab?.title || "Terminal tab"} · ${tabIndicator(tab).label}`,
|
|
@@ -17215,6 +17230,8 @@ function terminalTabTooltip(tab) {
|
|
|
17215
17230
|
if (git) lines.push(`Git: ${git}`);
|
|
17216
17231
|
const active = terminalTabActiveTooltip(tab);
|
|
17217
17232
|
if (active) lines.push(`Active: ${active}`);
|
|
17233
|
+
const prompt = terminalTabPromptTooltip(tab);
|
|
17234
|
+
if (prompt) lines.push(prompt);
|
|
17218
17235
|
lines.push("Click to switch · Drag to group");
|
|
17219
17236
|
return lines.join("\n");
|
|
17220
17237
|
}
|
|
@@ -17261,6 +17278,8 @@ function terminalTabGroupTooltip(group, groupTitle = terminalDisplayGroupTitle(g
|
|
|
17261
17278
|
];
|
|
17262
17279
|
const active = terminalTabGroupActiveTooltip(groupTabs);
|
|
17263
17280
|
if (active) lines.push(`Active: ${active}`);
|
|
17281
|
+
const prompt = terminalTabPromptTooltip(terminalTabGroupRepresentedTab(groupTabs));
|
|
17282
|
+
if (prompt) lines.push(prompt);
|
|
17264
17283
|
lines.push(isMobileView() ? "Tap to open group terminals" : "Click to switch · Drop tabs here to add");
|
|
17265
17284
|
return lines.join("\n");
|
|
17266
17285
|
}
|
|
@@ -17319,7 +17338,7 @@ function renderTerminalTab(tab, { showCwdAdd = false } = {}) {
|
|
|
17319
17338
|
button.setAttribute("role", "tab");
|
|
17320
17339
|
button.setAttribute("aria-selected", isActive ? "true" : "false");
|
|
17321
17340
|
button.setAttribute("aria-label", `${tab.title}: ${indicator.label}${appRunnerLabel ? `, ${appRunnerLabel}` : ""}${conversationLabel}${workflowModeActive ? ", workflow mode active" : ""}${workflowCount ? `, ${workflowCount} workflow runs active` : ""}`);
|
|
17322
|
-
applyStyledTooltip(button, terminalTabTooltip(tab), { ariaLabel: false, align: "start", description: true, variant: "workspace", targetKey: `terminal-tab:${tab.id}:switch` });
|
|
17341
|
+
applyStyledTooltip(button, terminalTabTooltip(tab), { ariaLabel: false, align: "start", description: true, preserveInternalSpaces: true, variant: "workspace", targetKey: `terminal-tab:${tab.id}:switch` });
|
|
17323
17342
|
appendTerminalTabContent(button, { title: tab.title, indicator, meta: terminalTabMeta(tab, indicator), appRunnerRun, conversationModeActive, workflowModeActive, workflowCount });
|
|
17324
17343
|
button.addEventListener("click", () => switchTab(tab.id));
|
|
17325
17344
|
wrapper.append(button, createTerminalTabActions(tab));
|
|
@@ -17359,7 +17378,7 @@ function renderTerminalTabGroupItem(tab, group) {
|
|
|
17359
17378
|
button.setAttribute("role", "tab");
|
|
17360
17379
|
button.setAttribute("aria-selected", isActive ? "true" : "false");
|
|
17361
17380
|
button.setAttribute("aria-label", `${tab.title}: ${indicator.label}${appRunnerLabel ? `, ${appRunnerLabel}` : ""}${conversationLabel}${workflowModeActive ? ", workflow mode active" : ""}${workflowCount ? `, ${workflowCount} workflow runs active` : ""}`);
|
|
17362
|
-
applyStyledTooltip(button, terminalTabTooltip(tab), { ariaLabel: false, align: "start", description: true, variant: "workspace", targetKey: `terminal-tab:${tab.id}:switch` });
|
|
17381
|
+
applyStyledTooltip(button, terminalTabTooltip(tab), { ariaLabel: false, align: "start", description: true, preserveInternalSpaces: true, variant: "workspace", targetKey: `terminal-tab:${tab.id}:switch` });
|
|
17363
17382
|
appendTerminalTabContent(button, { title: tab.title, indicator, meta: terminalTabMeta(tab, indicator), appRunnerRun, conversationModeActive, workflowModeActive, workflowCount });
|
|
17364
17383
|
button.addEventListener("click", (event) => {
|
|
17365
17384
|
event.stopPropagation();
|
|
@@ -17390,7 +17409,7 @@ function shouldRenderTerminalTabGroup(group, groupCount) {
|
|
|
17390
17409
|
|
|
17391
17410
|
function renderTerminalTabGroup(group, groupCount = 1) {
|
|
17392
17411
|
const groupTabs = group.tabs;
|
|
17393
|
-
const activeGroupTab = groupTabs
|
|
17412
|
+
const activeGroupTab = terminalTabGroupRepresentedTab(groupTabs);
|
|
17394
17413
|
const isActive = !activeSubagentTerminalId && groupTabs.some((tab) => tab.id === activeTabId);
|
|
17395
17414
|
const isStopped = groupTabs.every((tab) => !tab.running);
|
|
17396
17415
|
const indicator = tabGroupIndicator(groupTabs);
|
|
@@ -17431,7 +17450,7 @@ function renderTerminalTabGroup(group, groupCount = 1) {
|
|
|
17431
17450
|
button.setAttribute("aria-haspopup", "true");
|
|
17432
17451
|
button.setAttribute("aria-expanded", group.key === openTerminalTabGroupKey ? "true" : "false");
|
|
17433
17452
|
button.setAttribute("aria-label", `${groupTitle} ${group.custom ? "custom" : "cwd"} group: ${groupTabs.length} tabs, ${indicator.label}${appRunnerSummary ? `, ${appRunnerSummary}` : ""}${workflowModeActive ? ", workflow mode active" : ""}${workflowCount ? `, ${workflowCount} workflow runs active` : ""}. Active ${activeTitle}. ${isMobileView() ? "Toggle group terminal list" : "Switch to the active group terminal"}`);
|
|
17434
|
-
applyStyledTooltip(button, terminalTabGroupTooltip(group, groupTitle), { ariaLabel: false, description: true, placement: "right", variant: "workspace", targetKey: `terminal-group:${group.key}:switch` });
|
|
17453
|
+
applyStyledTooltip(button, terminalTabGroupTooltip(group, groupTitle), { ariaLabel: false, description: true, placement: "right", preserveInternalSpaces: true, variant: "workspace", targetKey: `terminal-group:${group.key}:switch` });
|
|
17435
17454
|
appendTerminalTabContent(button, { title: activeTitle, indicator, meta: `${groupTitle} · ${indicator.meta}${groupAppRunnerMeta ? ` · ${groupAppRunnerMeta}` : ""}${workflowModeActive ? " · workflow mode" : ""}${workflowCount ? ` · ${workflowCount} workflows` : ""}`, appRunnerRun, count: groupTabs.length, workflowModeActive, workflowCount, dropdown: true });
|
|
17436
17455
|
button.addEventListener("click", () => {
|
|
17437
17456
|
if (isMobileView()) {
|
|
@@ -19425,8 +19444,12 @@ function textFromContent(content) {
|
|
|
19425
19444
|
.join("\n");
|
|
19426
19445
|
}
|
|
19427
19446
|
|
|
19428
|
-
function cleanTooltipText(value) {
|
|
19429
|
-
|
|
19447
|
+
function cleanTooltipText(value, { preserveInternalSpaces = false } = {}) {
|
|
19448
|
+
const normalized = stripAnsi(value).replace(/\r\n?/g, "\n");
|
|
19449
|
+
const whitespaceNormalized = preserveInternalSpaces
|
|
19450
|
+
? normalized.replace(/[^\S\n ]+/g, " ")
|
|
19451
|
+
: normalized.replace(/[^\S\n]+/g, " ");
|
|
19452
|
+
return whitespaceNormalized.replace(/\n{3,}/g, "\n\n").trim();
|
|
19430
19453
|
}
|
|
19431
19454
|
|
|
19432
19455
|
const TOOLTIP_HOVER_DELAY_MS = 500;
|
|
@@ -19557,7 +19580,7 @@ let styledTooltipDescriptionSerial = 0;
|
|
|
19557
19580
|
|
|
19558
19581
|
function applyStyledTooltip(node, tooltip, options = {}) {
|
|
19559
19582
|
if (!node) return node;
|
|
19560
|
-
const text = cleanTooltipText(tooltip);
|
|
19583
|
+
const text = cleanTooltipText(tooltip, { preserveInternalSpaces: options.preserveInternalSpaces === true });
|
|
19561
19584
|
if (!text) return node;
|
|
19562
19585
|
node.setAttribute("data-tooltip", text);
|
|
19563
19586
|
node.removeAttribute("title");
|
|
@@ -42689,6 +42712,8 @@ function slashCommandName(message) {
|
|
|
42689
42712
|
}
|
|
42690
42713
|
|
|
42691
42714
|
function openNativeCommandDialog({ title, message = "", searchPlaceholder = "" } = {}) {
|
|
42715
|
+
nativeCommandDialogGeneration += 1;
|
|
42716
|
+
const dialogGeneration = nativeCommandDialogGeneration;
|
|
42692
42717
|
nativeCommandTabId ||= activeTabId;
|
|
42693
42718
|
elements.nativeCommandTitle.textContent = title || "Pi command";
|
|
42694
42719
|
elements.nativeCommandMessage.textContent = message;
|
|
@@ -42696,6 +42721,7 @@ function openNativeCommandDialog({ title, message = "", searchPlaceholder = "" }
|
|
|
42696
42721
|
elements.nativeCommandSearch.value = "";
|
|
42697
42722
|
elements.nativeCommandSearch.placeholder = searchPlaceholder || "Filter choices…";
|
|
42698
42723
|
elements.nativeCommandSearch.hidden = !searchPlaceholder;
|
|
42724
|
+
elements.nativeCommandSearch.disabled = false;
|
|
42699
42725
|
elements.nativeCommandSearch.oninput = null;
|
|
42700
42726
|
elements.nativeCommandBody.replaceChildren();
|
|
42701
42727
|
elements.nativeCommandError.hidden = true;
|
|
@@ -42704,6 +42730,7 @@ function openNativeCommandDialog({ title, message = "", searchPlaceholder = "" }
|
|
|
42704
42730
|
addNativeCommandAction("Cancel", closeNativeCommandDialog);
|
|
42705
42731
|
if (!elements.nativeCommandDialog.open) elements.nativeCommandDialog.showModal();
|
|
42706
42732
|
if (searchPlaceholder) queueMicrotask(() => elements.nativeCommandSearch.focus());
|
|
42733
|
+
return dialogGeneration;
|
|
42707
42734
|
}
|
|
42708
42735
|
|
|
42709
42736
|
function closeNativeCommandDialog({ force = false } = {}) {
|
|
@@ -42721,6 +42748,7 @@ function closeNativeCommandDialog({ force = false } = {}) {
|
|
|
42721
42748
|
});
|
|
42722
42749
|
return;
|
|
42723
42750
|
}
|
|
42751
|
+
nativeCommandDialogGeneration += 1;
|
|
42724
42752
|
if (elements.nativeCommandDialog.open) elements.nativeCommandDialog.close();
|
|
42725
42753
|
elements.nativeCommandSearch.oninput = null;
|
|
42726
42754
|
nativeSettingsDirty = false;
|
|
@@ -43001,6 +43029,127 @@ function openNativeThemeSelector() {
|
|
|
43001
43029
|
});
|
|
43002
43030
|
}
|
|
43003
43031
|
|
|
43032
|
+
// The rollback choice is browser-only; the server contract represents it as path: null.
|
|
43033
|
+
const APPEND_SYSTEM_DEFAULT_CHOICE_ID = "__pi-default-discovery__";
|
|
43034
|
+
|
|
43035
|
+
async function openNativeAppendSystemSelector() {
|
|
43036
|
+
const dialogGeneration = openNativeCommandDialog({
|
|
43037
|
+
title: "/append-system",
|
|
43038
|
+
message: "Choose one global APPEND_SYSTEM.md append prompt for WebUI-managed Pi tabs. The bounded scan uses the active tab folder and ~/.pi up to depth 10, follows file and folder links even outside those roots, and never shows file contents. New tabs and reloaded tabs use this choice.",
|
|
43039
|
+
searchPlaceholder: "Filter APPEND_SYSTEM.md files…",
|
|
43040
|
+
});
|
|
43041
|
+
const ownsNativeCommandDialog = () => dialogGeneration === nativeCommandDialogGeneration && elements.nativeCommandDialog.open;
|
|
43042
|
+
let saveInFlight = false;
|
|
43043
|
+
renderNativeLoading("Scanning APPEND_SYSTEM.md candidates…");
|
|
43044
|
+
try {
|
|
43045
|
+
const response = await nativeCommandApi("/api/append-system-files");
|
|
43046
|
+
if (!ownsNativeCommandDialog()) return;
|
|
43047
|
+
const data = response.data || {};
|
|
43048
|
+
const savedPath = typeof data.appendSystemPromptPath === "string" && data.appendSystemPromptPath ? data.appendSystemPromptPath : "";
|
|
43049
|
+
const candidates = Array.isArray(data.candidates) ? data.candidates : [];
|
|
43050
|
+
const diagnostics = Array.isArray(data.diagnostics) ? data.diagnostics : [];
|
|
43051
|
+
const savedIsInvalid = !!savedPath && diagnostics.some((diagnostic) => diagnostic?.kind === "saved-selection-invalid" && diagnostic?.path === savedPath);
|
|
43052
|
+
const savedIsCandidate = !!savedPath && !savedIsInvalid && candidates.some((candidate) => candidate?.path === savedPath);
|
|
43053
|
+
const items = [];
|
|
43054
|
+
if (savedPath && !savedIsCandidate) {
|
|
43055
|
+
items.push({
|
|
43056
|
+
id: `__invalid-saved__:${savedPath}`,
|
|
43057
|
+
label: savedPath,
|
|
43058
|
+
description: "Saved choice is no longer a valid APPEND_SYSTEM.md candidate. See the diagnostics below; Pi falls back to default discovery.",
|
|
43059
|
+
badge: "invalid",
|
|
43060
|
+
badgeClass: "disabled",
|
|
43061
|
+
disabled: true,
|
|
43062
|
+
});
|
|
43063
|
+
}
|
|
43064
|
+
items.push({
|
|
43065
|
+
id: APPEND_SYSTEM_DEFAULT_CHOICE_ID,
|
|
43066
|
+
label: "Use Pi default discovery",
|
|
43067
|
+
description: "Remove the override. Pi finds APPEND_SYSTEM.md itself (project .pi/APPEND_SYSTEM.md or ~/.pi/agent/APPEND_SYSTEM.md).",
|
|
43068
|
+
badge: savedIsCandidate ? "" : "current",
|
|
43069
|
+
appendSystemPath: null,
|
|
43070
|
+
});
|
|
43071
|
+
for (const candidate of candidates) {
|
|
43072
|
+
if (!candidate?.path) continue;
|
|
43073
|
+
items.push({
|
|
43074
|
+
id: candidate.path,
|
|
43075
|
+
label: candidate.path,
|
|
43076
|
+
description: `Visible path${candidate.rootLabel ? ` found below ${candidate.rootLabel}` : ""}; linked targets may be outside that root.`,
|
|
43077
|
+
meta: candidate.rootLabel || "",
|
|
43078
|
+
badge: savedIsCandidate && candidate.path === savedPath ? "current" : "",
|
|
43079
|
+
appendSystemPath: candidate.path,
|
|
43080
|
+
});
|
|
43081
|
+
}
|
|
43082
|
+
const appendDiagnostics = () => {
|
|
43083
|
+
if (!diagnostics.length) return;
|
|
43084
|
+
const note = make("div", "native-settings-note");
|
|
43085
|
+
note.append(make("strong", undefined, "Scan diagnostics"));
|
|
43086
|
+
for (const diagnostic of diagnostics.slice(0, 20)) {
|
|
43087
|
+
const line = [diagnostic?.kind, diagnostic?.path, diagnostic?.message].filter(Boolean).join(" · ");
|
|
43088
|
+
if (line) note.append(make("span", undefined, line));
|
|
43089
|
+
}
|
|
43090
|
+
elements.nativeCommandBody.append(note);
|
|
43091
|
+
};
|
|
43092
|
+
const render = () => {
|
|
43093
|
+
renderNativeSelectorItems(items, {
|
|
43094
|
+
emptyText: "No APPEND_SYSTEM.md files match this filter.",
|
|
43095
|
+
activeId: savedIsCandidate ? savedPath : APPEND_SYSTEM_DEFAULT_CHOICE_ID,
|
|
43096
|
+
onSelect: async (item) => {
|
|
43097
|
+
if (!ownsNativeCommandDialog() || saveInFlight) return;
|
|
43098
|
+
saveInFlight = true;
|
|
43099
|
+
elements.nativeCommandSearch.disabled = true;
|
|
43100
|
+
for (const button of nativeSelectorItemButtons()) button.disabled = true;
|
|
43101
|
+
setNativeCommandError("");
|
|
43102
|
+
const tabId = nativeCommandTabId || activeTabId;
|
|
43103
|
+
try {
|
|
43104
|
+
const response = await nativeCommandApi("/api/append-system-selection", {
|
|
43105
|
+
method: "POST",
|
|
43106
|
+
body: { tabId, path: item.appendSystemPath ?? null },
|
|
43107
|
+
});
|
|
43108
|
+
if (!ownsNativeCommandDialog()) return;
|
|
43109
|
+
const result = response.data || {};
|
|
43110
|
+
addTransientMessage({
|
|
43111
|
+
role: "native",
|
|
43112
|
+
title: "/append-system",
|
|
43113
|
+
content: result.changed === true
|
|
43114
|
+
? `Append-system choice saved: ${item.label}.`
|
|
43115
|
+
: `Append-system choice unchanged: ${item.label}.`,
|
|
43116
|
+
level: "info",
|
|
43117
|
+
});
|
|
43118
|
+
closeNativeCommandDialog();
|
|
43119
|
+
if (result.changed === true && result.restartRequired === true) await confirmAppendSystemRestart(tabId);
|
|
43120
|
+
} catch (error) {
|
|
43121
|
+
if (!ownsNativeCommandDialog()) return;
|
|
43122
|
+
saveInFlight = false;
|
|
43123
|
+
elements.nativeCommandSearch.disabled = false;
|
|
43124
|
+
render();
|
|
43125
|
+
setNativeCommandError(error.message || String(error));
|
|
43126
|
+
}
|
|
43127
|
+
},
|
|
43128
|
+
});
|
|
43129
|
+
appendDiagnostics();
|
|
43130
|
+
};
|
|
43131
|
+
elements.nativeCommandSearch.oninput = render;
|
|
43132
|
+
render();
|
|
43133
|
+
} catch (error) {
|
|
43134
|
+
if (!ownsNativeCommandDialog()) return;
|
|
43135
|
+
setNativeCommandError(`Append-system scan failed: ${error.message || String(error)}`);
|
|
43136
|
+
elements.nativeCommandBody.replaceChildren();
|
|
43137
|
+
}
|
|
43138
|
+
}
|
|
43139
|
+
|
|
43140
|
+
async function confirmAppendSystemRestart(tabId) {
|
|
43141
|
+
const confirmed = await appConfirmText(
|
|
43142
|
+
"Restart the active Pi tab now to load the new append-system prompt?\n\nThe saved choice is global for WebUI tabs and already persists. Cancel keeps it for the next manual reload or new tab without restarting.",
|
|
43143
|
+
{ affected: "The active Pi tab", confirmLabel: "Restart tab", danger: false },
|
|
43144
|
+
);
|
|
43145
|
+
if (!confirmed) return;
|
|
43146
|
+
try {
|
|
43147
|
+
await sendPrompt("prompt", "/reload", { targetTabId: tabId, throwOnError: true });
|
|
43148
|
+
} catch (error) {
|
|
43149
|
+
addEvent(`Append-system tab restart failed: ${error.message || String(error)}`, "error");
|
|
43150
|
+
}
|
|
43151
|
+
}
|
|
43152
|
+
|
|
43004
43153
|
function nativeSettingsBadge(label, tone = "") {
|
|
43005
43154
|
return make("span", `native-settings-badge${tone ? ` native-settings-badge-${tone}` : ""}`, label);
|
|
43006
43155
|
}
|
|
@@ -47236,6 +47385,7 @@ function commandPaletteCoreItems() {
|
|
|
47236
47385
|
{ kind: "Pi", label: "/scoped-models", description: "Manage model cycling scope", keywords: "models cycle ctrl p", run: () => runNativeCommandMenu("/scoped-models") },
|
|
47237
47386
|
{ kind: "Pi", label: "/tools", description: "Manage active tools", keywords: "capabilities", run: () => runNativeCommandMenu("/tools") },
|
|
47238
47387
|
{ kind: "Pi", label: "/skills", description: "Manage active skills", keywords: "system prompt", run: () => runNativeCommandMenu("/skills") },
|
|
47388
|
+
{ kind: "Pi", label: "/append-system", description: "Choose the APPEND_SYSTEM.md append prompt", keywords: "append system prompt settings global", run: () => openNativeAppendSystemSelector() },
|
|
47239
47389
|
{ kind: "Pi", label: "/theme", description: "Choose the Web UI theme", keywords: "dark light colors appearance", run: () => openNativeThemeSelector() },
|
|
47240
47390
|
{ kind: "Git", label: "Guided Git workflow", description: "Stage, commit, push, or open a pull request step by step", keywords: "git commit push pr publish", run: () => launchGuidedGitWorkflow() },
|
|
47241
47391
|
{ kind: "Git", label: "Git changes", description: "Review and stage local changes with diffs", keywords: "git diff stage unstage discard status", run: () => openGitChangesDialog() },
|
|
@@ -49684,6 +49834,10 @@ elements.optionsRemoteButton.addEventListener("click", () => runNativeCommandMen
|
|
|
49684
49834
|
elements.optionsNameButton.addEventListener("click", () => runNativeCommandMenu("/name"));
|
|
49685
49835
|
elements.optionsCloneButton.addEventListener("click", () => runNativeCommandMenu("/clone"));
|
|
49686
49836
|
elements.optionsSettingsButton.addEventListener("click", () => runNativeCommandMenu("/settings"));
|
|
49837
|
+
elements.optionsAppendSystemButton?.addEventListener("click", () => {
|
|
49838
|
+
setOptionsMenuOpen(false);
|
|
49839
|
+
void openNativeAppendSystemSelector();
|
|
49840
|
+
});
|
|
49687
49841
|
elements.optionsSummarySetupButton?.addEventListener("click", () => runNativeCommandMenu("/summary-setup"));
|
|
49688
49842
|
elements.optionsWorkflowSetupButton?.addEventListener("click", () => runNativeCommandMenu("/workflow-setup"));
|
|
49689
49843
|
elements.optionsSafetyGuardSetupButton?.addEventListener("click", () => runNativeCommandMenu("/safety-guard-setup"));
|
|
@@ -49796,6 +49950,7 @@ elements.nativeCommandDialog.querySelector("form")?.addEventListener("submit", (
|
|
|
49796
49950
|
});
|
|
49797
49951
|
elements.nativeCommandSearch.addEventListener("keydown", handleNativeSelectorSearchKeydown);
|
|
49798
49952
|
elements.nativeCommandDialog.addEventListener("close", () => {
|
|
49953
|
+
nativeCommandDialogGeneration += 1;
|
|
49799
49954
|
elements.nativeCommandSearch.oninput = null;
|
|
49800
49955
|
nativeSettingsDirty = false;
|
|
49801
49956
|
nativeCommandTabId = null;
|
package/public/index.html
CHANGED
|
@@ -479,7 +479,7 @@
|
|
|
479
479
|
aria-haspopup="menu"
|
|
480
480
|
aria-expanded="false"
|
|
481
481
|
aria-controls="optionsMenu"
|
|
482
|
-
data-tooltip="Options: command palette, Workflow Permission Setup, Safety Guard Setup, Guided Git Setup, Git-footer Visibility, natural conversation, resume, reload, remote, name, clone, settings, export, fork, or tree."
|
|
482
|
+
data-tooltip="Options: command palette, Append-system Prompt, Workflow Permission Setup, Safety Guard Setup, Guided Git Setup, Git-footer Visibility, natural conversation, resume, reload, remote, name, clone, settings, export, fork, or tree."
|
|
483
483
|
><svg class="composer-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7h16M4 12h16M4 17h16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="8" cy="7" r="1.6" fill="currentColor"/><circle cx="16" cy="12" r="1.6" fill="currentColor"/><circle cx="11" cy="17" r="1.6" fill="currentColor"/></svg></button>
|
|
484
484
|
<div id="optionsMenu" class="composer-publish-menu-panel composer-options-menu-panel composer-auto-height-menu-panel" role="menu" aria-label="Common Pi options">
|
|
485
485
|
<button id="optionsCommandPaletteButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem">
|
|
@@ -527,6 +527,9 @@
|
|
|
527
527
|
<button class="composer-publish-menu-item composer-options-menu-item composer-options-submenu-back" type="button" role="menuitem" data-options-submenu-back>
|
|
528
528
|
<span aria-hidden="true">‹</span><span>Back</span>
|
|
529
529
|
</button>
|
|
530
|
+
<button id="optionsAppendSystemButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem">
|
|
531
|
+
<span>Append-system Prompt</span>
|
|
532
|
+
</button>
|
|
530
533
|
<button id="optionsSummarySetupButton" class="composer-publish-menu-item composer-options-menu-item" type="button" role="menuitem" data-command="/summary-setup" hidden>
|
|
531
534
|
<span>Session Summary Setup</span>
|
|
532
535
|
</button>
|
|
@@ -1892,7 +1895,7 @@
|
|
|
1892
1895
|
</form>
|
|
1893
1896
|
</dialog>
|
|
1894
1897
|
|
|
1895
|
-
<script id="webuiBootLoader" data-app-src="/app.js?v=
|
|
1898
|
+
<script id="webuiBootLoader" data-app-src="/app.js?v=183">
|
|
1896
1899
|
(() => {
|
|
1897
1900
|
"use strict";
|
|
1898
1901
|
|
package/public/service-worker.js
CHANGED