@firstpick/pi-package-webui 0.8.5 → 0.8.7
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 +18 -584
- package/bin/pi-webui-launcher.mjs +22 -0
- package/bin/pi-webui-update-supervisor.mjs +86 -0
- package/bin/pi-webui.mjs +933 -554
- package/index.ts +16 -6
- package/lib/component-update-state.mjs +21 -0
- package/lib/git-workflow-preferences.mjs +20 -2
- package/lib/optional-feature-catalog.mjs +1 -0
- package/lib/sampling-parameter-capabilities.mjs +160 -0
- package/lib/session-summary-core.mjs +4 -3
- package/lib/session-summary-preferences.mjs +16 -1
- package/lib/subagent-launch-slots.mjs +14 -2
- package/lib/trust-boundaries.mjs +16 -0
- package/lib/update/executor.mjs +99 -0
- package/lib/update/journal.mjs +175 -0
- package/lib/update/owners.mjs +70 -0
- package/lib/update/plan.mjs +134 -0
- package/lib/update/resolver.mjs +168 -0
- package/lib/update/supervisor.mjs +238 -0
- package/lib/update/verify.mjs +52 -0
- package/lib/update-commands.mjs +25 -13
- package/lib/webui-workspaces.mjs +17 -1
- package/lib/workspace-session-summaries.mjs +400 -0
- package/package.json +4 -4
- package/public/app.js +2487 -349
- package/public/index.html +200 -51
- package/public/middle-button-drag-scroll.mjs +154 -0
- package/public/sampling-parameter-controls.mjs +361 -0
- package/public/service-worker.js +5 -1
- package/public/stream-output-controller.mjs +327 -0
- package/public/styles.css +666 -71
- package/public/theme-contract.mjs +244 -0
- package/session-summary.ts +164 -4
- package/tests/aur-review-widget-static.test.mjs +2 -1
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
- package/tests/browser/interaction-continuity.spec.mjs +2 -2
- package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
- package/tests/browser/sampling-tooltip.spec.mjs +228 -0
- package/tests/browser/session-summary.spec.mjs +131 -3
- package/tests/browser/stream-output-isolation.spec.mjs +510 -0
- package/tests/browser/update-reconnect.spec.mjs +92 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
- package/tests/common-options-submenus-markup-static.test.mjs +152 -0
- package/tests/component-update-api-static.test.mjs +22 -61
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +13 -237
- package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
- package/tests/fast-mode-client-static.test.mjs +3 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
- package/tests/fixtures/fake-pi.mjs +269 -2
- package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
- package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
- package/tests/git-footer-context-menu-static.test.mjs +58 -0
- package/tests/git-workflow-preferences.test.mjs +7 -1
- package/tests/guided-git-aur-review.test.mjs +4 -3
- package/tests/http-endpoints-harness.test.mjs +274 -23
- package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
- package/tests/middle-button-drag-scroll.test.mjs +170 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +5 -6
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +85 -50
- package/tests/native-parity.test.mjs +1 -1
- package/tests/open-issue-wizard-static.test.mjs +2 -3
- package/tests/optional-feature-migration-frontend.test.mjs +9 -5
- package/tests/persistent-ui-layout-static.test.mjs +13 -2
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +43 -0
- package/tests/rpc-supervisor-host.test.mjs +11 -2
- package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
- package/tests/safety-guard-auto-review-static.test.mjs +34 -0
- package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
- package/tests/sampling-parameter-capabilities.test.mjs +167 -0
- package/tests/sampling-parameter-controls.test.mjs +241 -0
- package/tests/session-sampling-helper.test.mjs +228 -0
- package/tests/session-sampling-http.test.mjs +168 -0
- package/tests/session-sampling-ui-static.test.mjs +370 -0
- package/tests/session-summary-core.test.mjs +205 -10
- package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
- package/tests/side-panel-section-reorder-static.test.mjs +3 -3
- package/tests/staged-content-hash-contract.test.mjs +52 -11
- package/tests/stream-lifecycle-core.test.mjs +134 -0
- package/tests/stream-output-controller.test.mjs +252 -0
- package/tests/stream-output-isolation-static.test.mjs +89 -0
- package/tests/streaming-ui-coupling.test.mjs +50 -0
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slots-static.test.mjs +1 -1
- package/tests/subagent-launch-slots.test.mjs +18 -1
- package/tests/theme-contract.test.mjs +104 -0
- package/tests/theme-customizer-static.test.mjs +82 -0
- package/tests/theme-scheme-mode.test.mjs +15 -0
- package/tests/ui-layout-settings.test.mjs +18 -1
- package/tests/update-api-harness.test.mjs +111 -0
- package/tests/update-commands.test.mjs +15 -45
- package/tests/update-executor-process-tree-harness.test.mjs +22 -0
- package/tests/update-journal-harness.test.mjs +59 -0
- package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
- package/tests/update-owners.test.mjs +27 -0
- package/tests/update-plan.test.mjs +58 -0
- package/tests/update-resolver.test.mjs +56 -0
- package/tests/update-supervisor-harness.test.mjs +57 -0
- package/tests/update-tab-restore-harness.test.mjs +24 -0
- package/tests/update-verify.test.mjs +31 -0
- package/tests/workspace-files-live-updates-static.test.mjs +13 -4
- package/tests/workspace-session-summaries.test.mjs +288 -0
- package/webui-rpc-helper.mjs +119 -0
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
import { createInterface } from "node:readline";
|
|
21
21
|
import { randomUUID } from "node:crypto";
|
|
22
22
|
import { appendFileSync } from "node:fs";
|
|
23
|
+
import {
|
|
24
|
+
BUILTIN_SAMPLING_APIS,
|
|
25
|
+
filterSupportedSamplingParameters,
|
|
26
|
+
resolveSamplingParameterCapabilities,
|
|
27
|
+
} from "../../lib/sampling-parameter-capabilities.mjs";
|
|
28
|
+
import { validateSamplingParameterObject } from "../../public/sampling-parameter-controls.mjs";
|
|
23
29
|
|
|
24
30
|
const sessionIndex = process.argv.indexOf("--session");
|
|
25
31
|
const sessionFile = sessionIndex !== -1
|
|
@@ -42,6 +48,38 @@ const fakeSkills = [
|
|
|
42
48
|
];
|
|
43
49
|
let enabledToolNames = new Set(fakeTools.map((tool) => tool.name));
|
|
44
50
|
let enabledSkillNames = new Set(fakeSkills.map((skill) => skill.name));
|
|
51
|
+
let fakeSessionSamplingParams = {};
|
|
52
|
+
const fakeSamplingModel = {
|
|
53
|
+
provider: "fake",
|
|
54
|
+
id: "fake-model",
|
|
55
|
+
name: "Fake Model",
|
|
56
|
+
api: "openai-completions",
|
|
57
|
+
samplingParams: { temperature: 0.7 },
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function fakeSamplingState() {
|
|
61
|
+
const parameters = resolveSamplingParameterCapabilities(fakeSamplingModel);
|
|
62
|
+
return {
|
|
63
|
+
session: { ...fakeSessionSamplingParams },
|
|
64
|
+
defaults: { ...fakeSamplingModel.samplingParams },
|
|
65
|
+
effective: {
|
|
66
|
+
...filterSupportedSamplingParameters(fakeSamplingModel.samplingParams, parameters),
|
|
67
|
+
...filterSupportedSamplingParameters(fakeSessionSamplingParams, parameters),
|
|
68
|
+
},
|
|
69
|
+
support: {
|
|
70
|
+
supported: Object.values(parameters).some((capability) => capability.supported),
|
|
71
|
+
api: fakeSamplingModel.api,
|
|
72
|
+
model: {
|
|
73
|
+
provider: fakeSamplingModel.provider,
|
|
74
|
+
id: fakeSamplingModel.id,
|
|
75
|
+
name: fakeSamplingModel.name,
|
|
76
|
+
},
|
|
77
|
+
parameters,
|
|
78
|
+
compatibleApis: [...BUILTIN_SAMPLING_APIS],
|
|
79
|
+
message: "Session sampling parameters apply to subsequent provider requests.",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
45
83
|
|
|
46
84
|
const voiceScriptsEnabled = process.env.FAKE_PI_VOICE_SCRIPTS === "1";
|
|
47
85
|
// The continuity harness opts into this behavior explicitly so existing fixture
|
|
@@ -50,6 +88,7 @@ const continuityModeEnabled = process.env.FAKE_PI_CONTINUITY_MODE === "1";
|
|
|
50
88
|
const largePayloadsEnabled = process.env.FAKE_PI_LARGE_PAYLOADS === "1";
|
|
51
89
|
const sseFloodEnabled = process.env.FAKE_PI_SSE_FLOOD === "1";
|
|
52
90
|
const statsPromptContextEnabled = process.env.FAKE_PI_STATS_PROMPT_CONTEXT === "1";
|
|
91
|
+
const streamIsolationEnabled = process.env.FAKE_PI_STREAM_ISOLATION === "1";
|
|
53
92
|
const commandLogFile = process.env.FAKE_PI_LOG_FILE || "";
|
|
54
93
|
const largeRpcText = "large-rpc-payload:" + "λ".repeat(70_000);
|
|
55
94
|
const largeTokenSamples = Array.from({ length: 300 }, (_, index) => ({ index, input: index + 1, output: index + 2 }));
|
|
@@ -63,6 +102,8 @@ const dynamicMessages = [];
|
|
|
63
102
|
let dynamicLeafId = "u0000002";
|
|
64
103
|
let scriptedStreaming = false;
|
|
65
104
|
let continuityRun = 0;
|
|
105
|
+
let streamIsolationRun = 0;
|
|
106
|
+
const pendingStreamIsolationRuns = new Map();
|
|
66
107
|
let largeTranscriptEnabled = false;
|
|
67
108
|
const fixtureSubagentRuns = [];
|
|
68
109
|
const fixtureSubagentGates = [];
|
|
@@ -203,7 +244,16 @@ function emitEvent(payload) {
|
|
|
203
244
|
}
|
|
204
245
|
|
|
205
246
|
function emitScriptedEvent(payload) {
|
|
206
|
-
logJsonLine({
|
|
247
|
+
logJsonLine({
|
|
248
|
+
direction: "event",
|
|
249
|
+
type: payload.type,
|
|
250
|
+
...(payload.toolName ? { toolName: payload.toolName } : {}),
|
|
251
|
+
...(payload.assistantMessageEvent?.type ? { assistantMessageEventType: payload.assistantMessageEvent.type } : {}),
|
|
252
|
+
...(payload.isolationRunId ? { isolationRunId: payload.isolationRunId } : {}),
|
|
253
|
+
...(payload.isolationMode ? { isolationMode: payload.isolationMode } : {}),
|
|
254
|
+
...(payload.isolationPhase ? { isolationPhase: payload.isolationPhase } : {}),
|
|
255
|
+
...(Number.isInteger(payload.isolationDeltaIndex) ? { isolationDeltaIndex: payload.isolationDeltaIndex } : {}),
|
|
256
|
+
});
|
|
207
257
|
emitEvent(payload);
|
|
208
258
|
}
|
|
209
259
|
|
|
@@ -597,6 +647,34 @@ function handleWebuiHelperPrompt(command, base) {
|
|
|
597
647
|
respondHelper({ requestId, ok: true, data: { skills: fakeSkills.map((skill) => ({ ...skill, enabled: enabledSkillNames.has(skill.name) })) } });
|
|
598
648
|
return true;
|
|
599
649
|
}
|
|
650
|
+
case "sampling-state":
|
|
651
|
+
respondHelper({ requestId, ok: true, data: fakeSamplingState() });
|
|
652
|
+
return true;
|
|
653
|
+
case "sampling-set": {
|
|
654
|
+
const samplingParams = request.payload?.samplingParams;
|
|
655
|
+
const plain = samplingParams && typeof samplingParams === "object" && !Array.isArray(samplingParams);
|
|
656
|
+
if (!plain || Object.keys(samplingParams).length > 128 || Buffer.byteLength(JSON.stringify(samplingParams), "utf8") > 16 * 1024) {
|
|
657
|
+
respondHelper({ requestId, ok: false, error: "Sampling parameters must be a bounded JSON object" });
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
660
|
+
const normalized = JSON.parse(JSON.stringify(samplingParams));
|
|
661
|
+
const validation = validateSamplingParameterObject(normalized);
|
|
662
|
+
if (!validation.valid) {
|
|
663
|
+
respondHelper({
|
|
664
|
+
requestId,
|
|
665
|
+
ok: false,
|
|
666
|
+
error: `Invalid sampling parameters: ${Object.values(validation.errors).join(" ")}`,
|
|
667
|
+
});
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
fakeSessionSamplingParams = normalized;
|
|
671
|
+
respondHelper({ requestId, ok: true, data: fakeSamplingState() });
|
|
672
|
+
return true;
|
|
673
|
+
}
|
|
674
|
+
case "sampling-reset":
|
|
675
|
+
fakeSessionSamplingParams = {};
|
|
676
|
+
respondHelper({ requestId, ok: true, data: fakeSamplingState() });
|
|
677
|
+
return true;
|
|
600
678
|
case "queue-mutate":
|
|
601
679
|
respondHelper({ requestId, ok: true, data: mutateRuntimeQueue(request.payload) });
|
|
602
680
|
return true;
|
|
@@ -773,6 +851,181 @@ function handleFastModeFixturePrompt(command, base) {
|
|
|
773
851
|
return true;
|
|
774
852
|
}
|
|
775
853
|
|
|
854
|
+
function streamIsolationTextDelta(index) {
|
|
855
|
+
const digit = String(index % 10);
|
|
856
|
+
if (index === 0) return `ISOLATION-TEXT-BEGIN ${digit}`;
|
|
857
|
+
if (index === 999) return `${digit} ISOLATION-TEXT-TAIL`;
|
|
858
|
+
return digit;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function logStreamIsolationPhase(runId, mode, scenario, phase) {
|
|
862
|
+
logJsonLine({ direction: "isolation-phase", isolationRunId: runId, isolationMode: mode, isolationScenario: scenario, isolationPhase: phase });
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
function runStreamIsolationFixtureFlow(mode, scenario = "standard") {
|
|
866
|
+
const runId = `stream-isolation-${mode}-${scenario}-${++streamIsolationRun}`;
|
|
867
|
+
const toolCallId = `${runId}-execution`;
|
|
868
|
+
const streamedToolCallId = `${runId}-call`;
|
|
869
|
+
const textDeltas = Array.from({ length: 1_000 }, (_, index) => streamIsolationTextDelta(index));
|
|
870
|
+
const finalText = textDeltas.join("");
|
|
871
|
+
const thinkingText = "ISOLATION-THINKING-PATH";
|
|
872
|
+
const toolCall = { type: "toolCall", id: streamedToolCallId, name: "read", arguments: { path: "isolation.txt" } };
|
|
873
|
+
const tagged = (payload, phase) => ({
|
|
874
|
+
...payload,
|
|
875
|
+
isolationRunId: runId,
|
|
876
|
+
isolationMode: mode,
|
|
877
|
+
isolationScenario: scenario,
|
|
878
|
+
isolationPhase: phase,
|
|
879
|
+
});
|
|
880
|
+
const emitTextRange = (start, end, { finish = false } = {}) => {
|
|
881
|
+
if (start === 0) emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "text_start", contentIndex: 1 } }, "raw"));
|
|
882
|
+
for (let index = start; index < end; index += 1) {
|
|
883
|
+
emitScriptedEvent({
|
|
884
|
+
...tagged({ type: "message_update", assistantMessageEvent: { type: "text_delta", contentIndex: 1, delta: textDeltas[index] } }, "raw"),
|
|
885
|
+
isolationDeltaIndex: index,
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
if (finish) emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "text_end", contentIndex: 1, text: finalText } }, "raw"));
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
scriptedStreaming = true;
|
|
892
|
+
const preburstStep = {
|
|
893
|
+
afterMs: 25,
|
|
894
|
+
run: () => {
|
|
895
|
+
emitScriptedEvent(tagged({ type: "agent_start" }, "pre-burst"));
|
|
896
|
+
if (mode === "compact") {
|
|
897
|
+
emitScriptedEvent(tagged({ type: "message_start", message: { role: "assistant" } }, "pre-burst"));
|
|
898
|
+
emitScriptedEvent(tagged({ type: "tool_execution_start", toolCallId, toolName: "read", args: { path: "isolation.txt" } }, "pre-burst"));
|
|
899
|
+
} else {
|
|
900
|
+
emitScriptedEvent(tagged({ type: "tool_execution_start", toolCallId, toolName: "read", args: { path: "isolation.txt" } }, "pre-burst"));
|
|
901
|
+
emitScriptedEvent(tagged({ type: "message_start", message: { role: "assistant" } }, "pre-burst"));
|
|
902
|
+
}
|
|
903
|
+
logStreamIsolationPhase(runId, mode, scenario, "ready");
|
|
904
|
+
},
|
|
905
|
+
};
|
|
906
|
+
const steps = [
|
|
907
|
+
{
|
|
908
|
+
afterMs: 0,
|
|
909
|
+
run: () => {
|
|
910
|
+
logStreamIsolationPhase(runId, mode, scenario, "raw-start");
|
|
911
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "thinking_start" } }, "raw"));
|
|
912
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "thinking_delta", delta: thinkingText } }, "raw"));
|
|
913
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "thinking_end", delta: thinkingText } }, "raw"));
|
|
914
|
+
},
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
afterMs: 100,
|
|
918
|
+
run: () => {
|
|
919
|
+
if (scenario === "abort") {
|
|
920
|
+
emitTextRange(0, 500);
|
|
921
|
+
logStreamIsolationPhase(runId, mode, scenario, "abort-ready");
|
|
922
|
+
} else {
|
|
923
|
+
emitTextRange(0, 1_000, { finish: true });
|
|
924
|
+
logStreamIsolationPhase(runId, mode, scenario, "text-complete");
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
},
|
|
928
|
+
];
|
|
929
|
+
|
|
930
|
+
if (scenario === "abort") {
|
|
931
|
+
// Keep a deterministic partial stream pending long enough for the browser
|
|
932
|
+
// proof to inspect it and issue Abort; cancelScriptedSteps() must prevent
|
|
933
|
+
// this fallback tail from ever being emitted after cancellation.
|
|
934
|
+
steps.push({ afterMs: 30_000, run: () => emitTextRange(500, 1_000, { finish: true }) });
|
|
935
|
+
}
|
|
936
|
+
const completionSteps = [];
|
|
937
|
+
steps.push(
|
|
938
|
+
{
|
|
939
|
+
afterMs: 1_500,
|
|
940
|
+
run: () => {
|
|
941
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "toolcall_start", contentIndex: 2, name: "read", toolCall: { ...toolCall, arguments: undefined } } }, "raw"));
|
|
942
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "toolcall_delta", contentIndex: 2, name: "read", toolCall: { ...toolCall, arguments: undefined }, delta: "{\"path\":\"isolation.txt\"}" } }, "raw"));
|
|
943
|
+
emitScriptedEvent(tagged({ type: "message_update", assistantMessageEvent: { type: "toolcall_end", contentIndex: 2, name: "read", toolCall } }, "raw"));
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
afterMs: 100,
|
|
948
|
+
run: () => {
|
|
949
|
+
emitScriptedEvent(tagged({
|
|
950
|
+
type: "tool_execution_update",
|
|
951
|
+
toolCallId,
|
|
952
|
+
toolName: "read",
|
|
953
|
+
partialResult: { content: [{ type: "text", text: "ISOLATION-TOOL-UPDATE-COMPLETE" }] },
|
|
954
|
+
}, "raw"));
|
|
955
|
+
if (scenario === "lifecycle") {
|
|
956
|
+
pendingStreamIsolationRuns.set(runId, () => {
|
|
957
|
+
pendingStreamIsolationRuns.delete(runId);
|
|
958
|
+
runScriptedSteps(completionSteps);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
logStreamIsolationPhase(runId, mode, scenario, "raw-end");
|
|
962
|
+
},
|
|
963
|
+
},
|
|
964
|
+
);
|
|
965
|
+
if (scenario === "lifecycle") {
|
|
966
|
+
completionSteps.push({
|
|
967
|
+
afterMs: 0,
|
|
968
|
+
run: () => {
|
|
969
|
+
emitScriptedEvent(tagged({ type: "auto_retry_start", attempt: 1, maxAttempts: 2, delayMs: 10, errorMessage: "fixture retry" }, "semantic"));
|
|
970
|
+
emitScriptedEvent(tagged({ type: "auto_retry_end", attempt: 1, success: true }, "semantic"));
|
|
971
|
+
emitScriptedEvent(tagged({ type: "compaction_start", reason: "fixture" }, "semantic"));
|
|
972
|
+
emitScriptedEvent(tagged({ type: "compaction_end", aborted: false }, "semantic"));
|
|
973
|
+
emitScriptedEvent(tagged({ type: "webui_supervisor_reconnected", supervisorScopeId: runId, supervisorEpoch: "1", supervisorSeq: "1" }, "semantic"));
|
|
974
|
+
logStreamIsolationPhase(runId, mode, scenario, "lifecycle-complete");
|
|
975
|
+
},
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
completionSteps.push(
|
|
979
|
+
{
|
|
980
|
+
afterMs: 1_200,
|
|
981
|
+
run: () => {
|
|
982
|
+
emitScriptedEvent(tagged({ type: "tool_execution_end", toolCallId, toolName: "read", isError: false, result: { content: [{ type: "text", text: "ISOLATION-TOOL-RESULT" }] } }, "post-burst"));
|
|
983
|
+
logStreamIsolationPhase(runId, mode, scenario, "tool-complete");
|
|
984
|
+
},
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
afterMs: 500,
|
|
988
|
+
run: () => {
|
|
989
|
+
const message = {
|
|
990
|
+
role: "assistant",
|
|
991
|
+
content: [{ type: "thinking", thinking: thinkingText }, toolCall, { type: "text", text: finalText }],
|
|
992
|
+
timestamp: Date.now(),
|
|
993
|
+
};
|
|
994
|
+
appendDynamicMessage(message);
|
|
995
|
+
emitScriptedEvent(tagged({ type: "message_end", message }, "post-burst"));
|
|
996
|
+
emitScriptedEvent(tagged({ type: "agent_end" }, "post-burst"));
|
|
997
|
+
scriptedStreaming = false;
|
|
998
|
+
emitScriptedEvent(tagged({ type: "agent_settled" }, "post-burst"));
|
|
999
|
+
logStreamIsolationPhase(runId, mode, scenario, "settled");
|
|
1000
|
+
},
|
|
1001
|
+
},
|
|
1002
|
+
);
|
|
1003
|
+
runScriptedSteps([preburstStep]);
|
|
1004
|
+
pendingStreamIsolationRuns.set(runId, () => {
|
|
1005
|
+
pendingStreamIsolationRuns.delete(runId);
|
|
1006
|
+
runScriptedSteps(scenario === "lifecycle" ? steps : [...steps, ...completionSteps]);
|
|
1007
|
+
});
|
|
1008
|
+
return { runId, finalText };
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
function continueStreamIsolationFixture(runId) {
|
|
1012
|
+
const start = pendingStreamIsolationRuns.get(runId);
|
|
1013
|
+
if (!start) return false;
|
|
1014
|
+
start();
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function handleStreamIsolationFixturePrompt(command, base) {
|
|
1019
|
+
if (!streamIsolationEnabled) return false;
|
|
1020
|
+
const match = String(command.message || "").trim().match(/^fixture stream isolation (normal|compact)(?: (standard|abort|lifecycle))?$/);
|
|
1021
|
+
if (!match) return false;
|
|
1022
|
+
const mode = match[1];
|
|
1023
|
+
const scenario = match[2] || "standard";
|
|
1024
|
+
const { runId, finalText } = runStreamIsolationFixtureFlow(mode, scenario);
|
|
1025
|
+
respond({ ...base, data: { output: "stream isolation fixture accepted", runId, deltaCount: 1_000, mode, scenario, finalText } });
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
776
1029
|
function handleTransportFixturePrompt(command, base) {
|
|
777
1030
|
const message = String(command.message || "").trim();
|
|
778
1031
|
if (message === "fixture stderr diagnostic") {
|
|
@@ -1163,6 +1416,7 @@ rl.on("line", (line) => {
|
|
|
1163
1416
|
if (handleStatsPromptContextFixturePrompt(command, base)) return;
|
|
1164
1417
|
if (handleWebuiHelperPrompt(command, base)) return;
|
|
1165
1418
|
if (handleFastModeFixturePrompt(command, base)) return;
|
|
1419
|
+
if (handleStreamIsolationFixturePrompt(command, base)) return;
|
|
1166
1420
|
if (handleTransportFixturePrompt(command, base)) return;
|
|
1167
1421
|
if (handleSubagentFixturePrompt(command, base)) return;
|
|
1168
1422
|
if (handleDocumentArtifactFixturePrompt(command, base)) return;
|
|
@@ -1177,9 +1431,22 @@ rl.on("line", (line) => {
|
|
|
1177
1431
|
if (handleVoiceScriptPrompt(command, base)) return;
|
|
1178
1432
|
respond({ ...base, data: { output: "fake prompt accepted" } });
|
|
1179
1433
|
return;
|
|
1180
|
-
case "steer":
|
|
1434
|
+
case "steer": {
|
|
1435
|
+
const match = String(command.message || "").trim().match(/^fixture stream isolation continue (stream-isolation-[A-Za-z0-9-]+)$/);
|
|
1436
|
+
if (match && continueStreamIsolationFixture(match[1])) {
|
|
1437
|
+
respond({ ...base, data: { output: "stream isolation raw phase started" } });
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1181
1440
|
respond({ ...base, data: { output: "fake steer accepted" } });
|
|
1182
1441
|
return;
|
|
1442
|
+
}
|
|
1443
|
+
case "abort":
|
|
1444
|
+
cancelScriptedSteps();
|
|
1445
|
+
respond({ ...base, data: { output: "fake abort accepted" } });
|
|
1446
|
+
emitScriptedEvent({ type: "agent_end", aborted: true });
|
|
1447
|
+
scriptedStreaming = false;
|
|
1448
|
+
emitScriptedEvent({ type: "agent_settled", aborted: true });
|
|
1449
|
+
return;
|
|
1183
1450
|
case "set_thinking_level":
|
|
1184
1451
|
thinkingLevel = String(command.level || "off");
|
|
1185
1452
|
respond({ ...base, data: { level: thinkingLevel } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const fixtureDir = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
spawn(process.execPath, [join(fixtureDir, "tree-timeout-descendant.mjs"), process.argv[2]], {
|
|
7
|
+
stdio: "ignore",
|
|
8
|
+
windowsHide: true,
|
|
9
|
+
});
|
|
10
|
+
console.log("descendant-started");
|
|
11
|
+
setInterval(() => {}, 1_000);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const [html, app] = await Promise.all([
|
|
8
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
assert.match(
|
|
13
|
+
html,
|
|
14
|
+
/id="gitFooterContextMenu"[^>]*role="menu"[^>]*aria-label="Git footer box actions"[^>]*hidden[\s\S]*data-git-footer-menu-action="disable"[\s\S]*Disable this box[\s\S]*data-git-footer-menu-action="visibility"[\s\S]*Open Git-footer Visibility/,
|
|
15
|
+
"the page should provide both requested Git footer context-menu actions",
|
|
16
|
+
);
|
|
17
|
+
assert.match(
|
|
18
|
+
app,
|
|
19
|
+
/function bindGitFooterContextMenu\(node, chip\)[\s\S]*aria-keyshortcuts", "ContextMenu Shift\+F10"[\s\S]*addEventListener\("contextmenu"[\s\S]*event\.key !== "ContextMenu"[\s\S]*event\.shiftKey && event\.key === "F10"/,
|
|
20
|
+
"every bound footer box should support pointer and keyboard context-menu activation",
|
|
21
|
+
);
|
|
22
|
+
assert.match(
|
|
23
|
+
app,
|
|
24
|
+
/function renderGitFooterPayloadMetric\(chip, payload\)[\s\S]*return bindGitFooterContextMenu\(node, chip\);/,
|
|
25
|
+
"metric boxes should receive the context menu",
|
|
26
|
+
);
|
|
27
|
+
assert.match(
|
|
28
|
+
app,
|
|
29
|
+
/function renderGitFooterPayloadMeta\(chip, tab, payload\)[\s\S]*return bindGitFooterContextMenu\(node, chip\);/,
|
|
30
|
+
"metadata boxes should receive the context menu",
|
|
31
|
+
);
|
|
32
|
+
assert.match(
|
|
33
|
+
app,
|
|
34
|
+
/function showGitFooterContextMenu\(event, chip, trigger\)[\s\S]*disableButton\.textContent = `Disable \$\{label\} box`[\s\S]*window\.innerWidth[\s\S]*window\.innerHeight/,
|
|
35
|
+
"the menu should name the clicked box and remain inside the viewport",
|
|
36
|
+
);
|
|
37
|
+
assert.match(
|
|
38
|
+
app,
|
|
39
|
+
/async function disableGitFooterContextChip\(key, label\)[\s\S]*runGitFooterVisibilityCommand\("hide", \[key\]\)[\s\S]*requestGitFooterWebuiPayload/,
|
|
40
|
+
"disabling a box should persist its matching WebUI visibility key and refresh the payload",
|
|
41
|
+
);
|
|
42
|
+
assert.match(
|
|
43
|
+
app,
|
|
44
|
+
/data-git-footer-menu-action[\s\S]*action === "disable"[\s\S]*disableGitFooterContextChip\(state\.key, state\.label\)[\s\S]*action === "visibility"[\s\S]*openGitFooterVisibilityDialog\(\)/,
|
|
45
|
+
"the menu should dispatch both requested actions",
|
|
46
|
+
);
|
|
47
|
+
assert.match(
|
|
48
|
+
app,
|
|
49
|
+
/gitFooterContextMenu[\s\S]*addEventListener\("keydown"[\s\S]*event\.key === "Escape"[\s\S]*event\.key === "ArrowDown" \|\| event\.key === "ArrowUp"[\s\S]*event\.key === "Home" \|\| event\.key === "End"/,
|
|
50
|
+
"the context menu should support standard keyboard navigation",
|
|
51
|
+
);
|
|
52
|
+
assert.match(
|
|
53
|
+
app,
|
|
54
|
+
/!elements\.gitFooterContextMenu\.hidden[\s\S]*!event\.target\?\.closest\?\.\("\.git-footer-context-menu"\)[\s\S]*closeGitFooterContextMenu\(\)/,
|
|
55
|
+
"clicking outside should close the Git footer context menu",
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
console.log("git-footer-context-menu-static.test.mjs passed");
|
|
@@ -43,6 +43,7 @@ try {
|
|
|
43
43
|
assert.equal(migrated.resourceDefaults.tools.enabledTools, null, "legacy settings should inherit Pi's normal tool defaults");
|
|
44
44
|
assert.equal(migrated.resourceDefaults.skills.enabledSkills, null, "legacy settings should inherit Pi's normal skill defaults");
|
|
45
45
|
assert.equal(migrated.gitWorkflow.stagingPolicy, "review");
|
|
46
|
+
assert.equal(migrated.gitWorkflow.reviewProcessEnabled, true, "legacy settings should preserve the existing review-process behavior");
|
|
46
47
|
assert.equal(migrated.gitWorkflow.generation.thinkingLevel, "low");
|
|
47
48
|
assert.equal(migrated.uiLayout.version, 1);
|
|
48
49
|
assert.equal(migrated.uiLayout.sidePanel.sectionOrder, null);
|
|
@@ -54,6 +55,7 @@ try {
|
|
|
54
55
|
generation: { provider: "fake", modelId: "fake-model", thinkingLevel: "off", unavailablePolicy: "ask" },
|
|
55
56
|
commit: { language: "de", defaultVariant: "long", scope: "required" },
|
|
56
57
|
stagingPolicy: "preserve",
|
|
58
|
+
reviewProcessEnabled: false,
|
|
57
59
|
deliveryMode: "pr-worktree",
|
|
58
60
|
verificationPolicy: "none",
|
|
59
61
|
}, settingsFile);
|
|
@@ -62,6 +64,7 @@ try {
|
|
|
62
64
|
assert.equal(saved.commit.language, "de");
|
|
63
65
|
assert.equal(saved.commit.defaultVariant, "long");
|
|
64
66
|
assert.equal(saved.stagingPolicy, "preserve");
|
|
67
|
+
assert.equal(saved.reviewProcessEnabled, false);
|
|
65
68
|
|
|
66
69
|
await writeWebuiSettings({
|
|
67
70
|
outputModeDefault: "compact-v1",
|
|
@@ -76,6 +79,7 @@ try {
|
|
|
76
79
|
assert.equal(partiallyUpdated.generation.modelId, "fake-model", "partial updates should preserve the selected model");
|
|
77
80
|
assert.equal(partiallyUpdated.commit.language, "de", "partial updates should preserve nested commit preferences");
|
|
78
81
|
assert.equal(partiallyUpdated.deliveryMode, "current");
|
|
82
|
+
assert.equal(partiallyUpdated.reviewProcessEnabled, false, "partial updates should preserve the review-process choice");
|
|
79
83
|
|
|
80
84
|
const persisted = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
81
85
|
assert.equal(persisted.version, 6);
|
|
@@ -86,7 +90,9 @@ try {
|
|
|
86
90
|
assert.deepEqual(persisted.resourceDefaults.skills.enabledSkills, ["repo-explorer", "code-security"], "global skill defaults should persist beside other Web UI settings");
|
|
87
91
|
assert.equal(persisted.interfacePreferences.sidePanelWidth, 612, "the user-scoped Control Deck width should persist beside other Web UI settings");
|
|
88
92
|
assert.equal((await readWebuiSettings(settingsFile)).interfacePreferences.sidePanelWidth, 612);
|
|
89
|
-
|
|
93
|
+
const summary = gitWorkflowPreferencesSummary(await readGitWorkflowPreferences(settingsFile));
|
|
94
|
+
assert.match(summary, /fake\/fake-model/);
|
|
95
|
+
assert.match(summary, /Review process: disabled/);
|
|
90
96
|
if (process.platform !== "win32") assert.equal((await stat(settingsFile)).mode & 0o777, 0o600);
|
|
91
97
|
|
|
92
98
|
console.log("git-workflow-preferences.test.mjs passed");
|
|
@@ -148,8 +148,8 @@ assert.equal(resolveRpcSlashCommandForTabCatalog(catalogByTab.get("tab-b"), "/au
|
|
|
148
148
|
|
|
149
149
|
const runGitAdd = app.slice(app.indexOf("async function runGitAdd"), app.indexOf("async function acceptCurrentGitStaging"));
|
|
150
150
|
const acceptStaging = app.slice(app.indexOf("async function acceptCurrentGitStaging"), app.indexOf("async function loadGitWorkflowDefaultCommitMessage"));
|
|
151
|
-
assert.match(runGitAdd, /guidedGitReviewAvailable\(tabId\)
|
|
152
|
-
assert.match(acceptStaging, /guidedGitReviewAvailable\(tabId\)
|
|
151
|
+
assert.match(runGitAdd, /workflow\.preferences\?\.reviewProcessEnabled !== false && guidedGitReviewAvailable\(tabId\)[\s\S]*\|\| workflow\.guidedReviewRequired === true[\s\S]*await requestGuidedGitReview\(tabId, \{ output \}\)/s, "git add . must honor the saved review-process option while keeping an already-required gate fail-closed");
|
|
152
|
+
assert.match(acceptStaging, /workflow\.preferences\?\.reviewProcessEnabled !== false && guidedGitReviewAvailable\(tabId\)[\s\S]*\|\| workflow\.guidedReviewRequired === true[\s\S]*await requestGuidedGitReview\(tabId, \{ output \}\)/s, "accepting a staged set must honor the saved review-process option while keeping an already-required gate fail-closed");
|
|
153
153
|
const reconcileReview = app.slice(app.indexOf("function reconcileGuidedGitReviewPayload"), app.indexOf("async function startGitWorkflow"));
|
|
154
154
|
assert.match(reconcileReview, /transition === "approved"[\s\S]*step: "generate"[\s\S]*guidedReviewDeclinedStagedContentHash: ""/s, "only approval advances to message generation and clears an older decline binding");
|
|
155
155
|
assert.match(reconcileReview, /transition === "pending"[\s\S]*guidedReviewDeclinedStagedContentHash[\s\S]*same staged content that was declined/s, "extension payload replay cannot retry an unchanged declined staged hash");
|
|
@@ -158,12 +158,13 @@ assert.match(reconcileReview, /function reconcileGuidedGitReviewWidgetRemoval[\s
|
|
|
158
158
|
const resetReviewToStaging = app.slice(app.indexOf("function resetGuidedGitReviewToStaging"), app.indexOf("function reconcileGuidedGitReviewPayload"));
|
|
159
159
|
assert.match(resetReviewToStaging, /step: "add"[\s\S]*stage: false/s, "decline and close return the flow to staging and require restaging");
|
|
160
160
|
const workflowRender = app.slice(app.indexOf("function renderGitWorkflow"), app.indexOf("async function gitWorkflowRequest"));
|
|
161
|
+
assert.match(workflowRender, /preferences\.reviewProcessEnabled !== false && guidedGitReviewAvailable\(activeTabId\)[\s\S]*\|\| gitWorkflow\.guidedReviewRequired === true/, "the Review process should be shown only when enabled and available, while an active required gate remains visible");
|
|
161
162
|
assert.match(workflowRender, /item\.disabled = !!gitWorkflow\.busy \|\| !guidedGitReviewProcessNavigationAllowed\(gitWorkflow, process\.value\);/, "the UI must disable later process buttons while the review gate is active");
|
|
162
163
|
const processSelection = app.slice(app.indexOf("function selectGitWorkflowProcess"), app.indexOf("function gitWorkflowTitle"));
|
|
163
164
|
assert.match(processSelection, /const guidedReviewPatch = guidedGitReviewProcessSelectionPatch\(workflow, process\);[\s\S]*if \(!guidedReviewPatch\) return;[\s\S]*\.\.\.guidedReviewPatch/s, "process selection must use the tested patch that preserves approval or re-arms review");
|
|
164
165
|
assert.doesNotMatch(processSelection, /resetGuidedGitReviewPatch/, "process selection must not share a reset that drops an approved binding during later navigation");
|
|
165
166
|
const startWorkflow = app.slice(app.indexOf("async function startGitWorkflow"), app.indexOf("async function startGitInitWorkflow"));
|
|
166
|
-
assert.match(startWorkflow, /guidedReviewRequired: guidedGitReviewAvailable\(tabId\)/, "a fresh standard flow must require review when aur-review is available in its originating tab");
|
|
167
|
+
assert.match(startWorkflow, /guidedReviewRequired: preferences\.reviewProcessEnabled !== false && guidedGitReviewAvailable\(tabId\)/, "a fresh standard flow must require review only when setup enables it and aur-review is available in its originating tab");
|
|
167
168
|
assert.match(app, /function guidedGitReviewAvailable\(tabId = activeTabId\)[\s\S]*commandCatalogForTab\(tabId\)/, "Guided Git availability must read the originating tab catalog");
|
|
168
169
|
assert.match(app, /resolveRpcSlashCommandMessage\(guidedGitReviewCommand\(\), \{ tabId \}\)/, "Guided Git review requests must resolve aliases from the originating tab catalog");
|
|
169
170
|
assert.match(app, /message = resolveRpcSlashCommandMessage\(message, \{ tabId: targetTabId \}\)/, "generic targeted slash-command dispatch must resolve aliases from its captured target tab");
|