@firstpick/pi-package-webui 0.9.2 → 0.9.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/README.md +14 -8
- package/bin/pi-webui.mjs +256 -39
- package/index.ts +266 -1
- package/lib/git-workflow-preferences.mjs +8 -25
- package/lib/intercom-conversations.mjs +491 -0
- package/lib/intercom-transcript-filter.mjs +99 -0
- package/lib/resource-selection.mjs +140 -0
- package/package.json +2 -2
- package/public/app.js +1061 -119
- package/public/index.html +31 -6
- package/public/service-worker.js +2 -1
- package/public/stream-output-controller.mjs +15 -0
- package/public/styles.css +426 -1
- package/public/syntax-highlight.mjs +622 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +34 -0
- package/tests/browser/intercom-conversation-viewer.spec.mjs +357 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +61 -0
- package/tests/browser/resource-profiles.spec.mjs +200 -0
- package/tests/browser/subagent-observability.spec.mjs +29 -0
- package/tests/codex-fast-mode-static.test.mjs +7 -6
- package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
- package/tests/common-options-submenus-markup-static.test.mjs +1 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/composer-skill-tag-layout.test.mjs +32 -2
- package/tests/control-deck-component-updates-static.test.mjs +4 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +2 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
- package/tests/file-viewer-image-static.test.mjs +69 -0
- package/tests/fixtures/fake-pi.mjs +105 -6
- package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
- package/tests/git-panel-file-preview-static.test.mjs +5 -5
- package/tests/git-panel-live-updates-static.test.mjs +3 -3
- package/tests/git-workflow-preferences.test.mjs +4 -4
- package/tests/http-endpoints-harness.test.mjs +124 -2
- package/tests/intercom-conversation-viewer-static.test.mjs +106 -0
- package/tests/intercom-conversations-http.test.mjs +252 -0
- package/tests/intercom-conversations.test.mjs +374 -0
- package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
- package/tests/intercom-tag-layout-static.test.mjs +46 -0
- package/tests/intercom-transcript-filter.test.mjs +98 -0
- package/tests/main-output-loading-static.test.mjs +59 -0
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +2 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +66 -42
- package/tests/native-parity.test.mjs +8 -7
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +5 -5
- package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/resource-defaults-helper.test.mjs +60 -6
- package/tests/resource-selection.test.mjs +114 -0
- package/tests/resource-tui-extension.test.mjs +23 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-controller.test.mjs +8 -0
- package/tests/stream-output-isolation-static.test.mjs +2 -2
- package/tests/streaming-ui-coupling.test.mjs +5 -0
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slots.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +5 -3
- package/tests/subagent-reliability-integration.test.mjs +23 -1
- package/tests/subagent-workflow-section-static.test.mjs +67 -0
- package/tests/subagents-helper.test.mjs +313 -1
- package/tests/syntax-highlight.test.mjs +235 -0
- package/tests/syntax-highlighting-static.test.mjs +84 -0
- package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
- package/tests/theme-customizer-static.test.mjs +5 -5
- package/tests/thinking-format-parser.test.mjs +64 -0
- package/tests/webui-settings-locking.test.mjs +1 -1
- package/webui-rpc-helper.mjs +417 -74
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const MAX_RESOURCE_NAME_LENGTH = 256;
|
|
2
|
+
const MAX_PROVIDER_LENGTH = 160;
|
|
3
|
+
const MAX_MODEL_ID_LENGTH = 512;
|
|
4
|
+
const MAX_MODEL_PROFILES = 512;
|
|
5
|
+
|
|
6
|
+
export function cleanResourceString(value, maxLength) {
|
|
7
|
+
return typeof value === "string" ? value.trim().slice(0, maxLength) : "";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function normalizeResourceNameList(value) {
|
|
11
|
+
if (!Array.isArray(value)) return null;
|
|
12
|
+
const names = [];
|
|
13
|
+
const seen = new Set();
|
|
14
|
+
for (const item of value) {
|
|
15
|
+
const name = cleanResourceString(item, MAX_RESOURCE_NAME_LENGTH);
|
|
16
|
+
if (!name || seen.has(name)) continue;
|
|
17
|
+
seen.add(name);
|
|
18
|
+
names.push(name);
|
|
19
|
+
}
|
|
20
|
+
return names;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resourceObject(value) {
|
|
24
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizeResourceSelection(value, key) {
|
|
28
|
+
const source = resourceObject(value);
|
|
29
|
+
return { ...source, [key]: normalizeResourceNameList(source[key]) };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeModelProfiles(value) {
|
|
33
|
+
if (!Array.isArray(value)) return [];
|
|
34
|
+
const profiles = [];
|
|
35
|
+
const indexes = new Map();
|
|
36
|
+
for (const candidate of value.slice(0, MAX_MODEL_PROFILES)) {
|
|
37
|
+
const source = resourceObject(candidate);
|
|
38
|
+
const provider = cleanResourceString(source.provider, MAX_PROVIDER_LENGTH);
|
|
39
|
+
const modelId = cleanResourceString(source.modelId, MAX_MODEL_ID_LENGTH);
|
|
40
|
+
if (!provider || !modelId) continue;
|
|
41
|
+
const profile = {
|
|
42
|
+
...source,
|
|
43
|
+
provider,
|
|
44
|
+
modelId,
|
|
45
|
+
tools: normalizeResourceSelection(source.tools, "enabledTools"),
|
|
46
|
+
skills: normalizeResourceSelection(source.skills, "enabledSkills"),
|
|
47
|
+
};
|
|
48
|
+
if (profile.tools.enabledTools === null && profile.skills.enabledSkills === null) {
|
|
49
|
+
const existingIndex = indexes.get(`${provider}\0${modelId}`);
|
|
50
|
+
if (existingIndex !== undefined) {
|
|
51
|
+
profiles.splice(existingIndex, 1);
|
|
52
|
+
indexes.clear();
|
|
53
|
+
profiles.forEach((entry, index) => indexes.set(`${entry.provider}\0${entry.modelId}`, index));
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const key = `${provider}\0${modelId}`;
|
|
58
|
+
const existingIndex = indexes.get(key);
|
|
59
|
+
if (existingIndex === undefined) {
|
|
60
|
+
indexes.set(key, profiles.length);
|
|
61
|
+
profiles.push(profile);
|
|
62
|
+
} else {
|
|
63
|
+
profiles[existingIndex] = profile;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return profiles;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function normalizeResourceDefaults(value) {
|
|
70
|
+
const source = resourceObject(value);
|
|
71
|
+
return {
|
|
72
|
+
...source,
|
|
73
|
+
tools: normalizeResourceSelection(source.tools, "enabledTools"),
|
|
74
|
+
skills: normalizeResourceSelection(source.skills, "enabledSkills"),
|
|
75
|
+
modelProfiles: normalizeModelProfiles(source.modelProfiles),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function exactModelProfile(resourceDefaults, provider, modelId) {
|
|
80
|
+
if (!provider || !modelId) return null;
|
|
81
|
+
return normalizeModelProfiles(resourceDefaults?.modelProfiles)
|
|
82
|
+
.find((profile) => profile.provider === provider && profile.modelId === modelId) || null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function resolveResourceSelection(resourceDefaults, resourceType, provider, modelId, runtimeDefault = null) {
|
|
86
|
+
const selectionKey = resourceType === "tools" ? "enabledTools" : "enabledSkills";
|
|
87
|
+
const profile = exactModelProfile(resourceDefaults, provider, modelId);
|
|
88
|
+
const modelSelection = normalizeResourceNameList(profile?.[resourceType]?.[selectionKey]);
|
|
89
|
+
if (modelSelection !== null) return { names: modelSelection, source: "model" };
|
|
90
|
+
const globalSelection = normalizeResourceNameList(resourceDefaults?.[resourceType]?.[selectionKey]);
|
|
91
|
+
if (globalSelection !== null) return { names: globalSelection, source: "global" };
|
|
92
|
+
return { names: normalizeResourceNameList(runtimeDefault), source: "runtime" };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function branchResourceDirective(entryData, resourceType) {
|
|
96
|
+
const data = entryData && typeof entryData === "object" ? entryData : {};
|
|
97
|
+
if (data.version === 2 && data.mode === "inherit") return { pinned: false, names: null, legacyDisabledNames: null };
|
|
98
|
+
const selectionKey = resourceType === "tools" ? "enabledTools" : "enabledSkills";
|
|
99
|
+
const names = normalizeResourceNameList(data[selectionKey]);
|
|
100
|
+
if (names !== null) return { pinned: true, names, legacyDisabledNames: null };
|
|
101
|
+
if (resourceType === "skills") {
|
|
102
|
+
const disabled = normalizeResourceNameList(data.disabledSkills);
|
|
103
|
+
if (disabled !== null) return { pinned: true, names: null, legacyDisabledNames: disabled };
|
|
104
|
+
}
|
|
105
|
+
return { pinned: false, names: null, legacyDisabledNames: null };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function setExactModelProfile(resourceDefaults, providerValue, modelIdValue, resourceType, enabledNames) {
|
|
109
|
+
const provider = cleanResourceString(providerValue, MAX_PROVIDER_LENGTH);
|
|
110
|
+
const modelId = cleanResourceString(modelIdValue, MAX_MODEL_ID_LENGTH);
|
|
111
|
+
if (!provider || !modelId) throw new Error("Model resource profile requires an exact provider and model ID");
|
|
112
|
+
const selectionKey = resourceType === "tools" ? "enabledTools" : "enabledSkills";
|
|
113
|
+
const nextSelection = normalizeResourceNameList(enabledNames);
|
|
114
|
+
const normalized = normalizeResourceDefaults(resourceDefaults);
|
|
115
|
+
const profiles = normalized.modelProfiles.map((profile) => ({
|
|
116
|
+
...profile,
|
|
117
|
+
tools: { ...profile.tools },
|
|
118
|
+
skills: { ...profile.skills },
|
|
119
|
+
}));
|
|
120
|
+
const index = profiles.findIndex((profile) => profile.provider === provider && profile.modelId === modelId);
|
|
121
|
+
const profile = index >= 0 ? profiles[index] : {
|
|
122
|
+
provider,
|
|
123
|
+
modelId,
|
|
124
|
+
tools: { enabledTools: null },
|
|
125
|
+
skills: { enabledSkills: null },
|
|
126
|
+
};
|
|
127
|
+
profile[resourceType][selectionKey] = nextSelection;
|
|
128
|
+
if (profile.tools.enabledTools === null && profile.skills.enabledSkills === null) {
|
|
129
|
+
if (index >= 0) profiles.splice(index, 1);
|
|
130
|
+
} else if (index >= 0) profiles[index] = profile;
|
|
131
|
+
else profiles.push(profile);
|
|
132
|
+
return normalizeModelProfiles(profiles);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function preserveUnavailableResourceNames(previousNames, visibleNames, selectedVisibleNames) {
|
|
136
|
+
const visible = new Set(normalizeResourceNameList(visibleNames) || []);
|
|
137
|
+
const selected = normalizeResourceNameList(selectedVisibleNames) || [];
|
|
138
|
+
const unavailable = (normalizeResourceNameList(previousNames) || []).filter((name) => !visible.has(name));
|
|
139
|
+
return normalizeResourceNameList([...selected, ...unavailable]) || [];
|
|
140
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstpick/pi-package-webui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Pi Web UI companion package with a local browser UI CLI plus /webui-start and /webui-status commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-package-webui#readme",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"pi-webui": "./bin/pi-webui-launcher.mjs"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"check": "node --check public/app.js && node --check lib/app-runner-terminal.mjs && node --check public/middle-button-drag-scroll.mjs && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-launcher.mjs && node --check bin/pi-webui-update-supervisor.mjs && node --check lib/update/supervisor.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
33
|
+
"check": "node --check public/app.js && node --check lib/app-runner-terminal.mjs && node --check public/middle-button-drag-scroll.mjs && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/syntax-highlight.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-launcher.mjs && node --check bin/pi-webui-update-supervisor.mjs && node --check lib/update/supervisor.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
34
34
|
"test": "node tests/run-all.mjs",
|
|
35
35
|
"test:browser": "playwright test"
|
|
36
36
|
},
|