@firstpick/pi-package-webui 0.9.4 → 0.9.6
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 +7 -2
- package/bin/pi-webui.mjs +90 -5
- package/lib/optional-feature-catalog.mjs +1 -1
- package/lib/session-actions.mjs +20 -2
- package/lib/ui-layout-settings.mjs +37 -6
- package/package.json +1 -1
- package/public/app.js +2311 -257
- package/public/index.html +82 -55
- package/public/service-worker.js +4 -1
- package/public/stream-derived-output.mjs +799 -0
- package/public/stream-markdown-tail.mjs +204 -0
- package/public/stream-output-controller.mjs +222 -51
- package/public/stream-render-scheduler.mjs +85 -0
- package/public/styles.css +276 -20
- package/public/transcript-renderer.mjs +73 -24
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/composer-action-grid-reorder.spec.mjs +114 -31
- package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
- package/tests/browser/control-visibility.spec.mjs +396 -0
- package/tests/browser/mobile-foundation.spec.mjs +28 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
- package/tests/browser/stream-output-isolation.spec.mjs +308 -3
- package/tests/browser/user-noticeable-fixes.spec.mjs +204 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +8 -7
- package/tests/control-deck-side-panels-static.test.mjs +3 -1
- package/tests/control-visibility-static.test.mjs +294 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/cwd-footer-reliability-static.test.mjs +1 -1
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/fixtures/fake-pi.mjs +57 -10
- package/tests/fixtures/streaming-workloads.mjs +167 -0
- package/tests/footer-provider-usage-visual-static.test.mjs +15 -0
- package/tests/foreground-transcript-catch-up-static.test.mjs +7 -1
- package/tests/git-workflow-preferences.test.mjs +2 -2
- package/tests/http-endpoints-harness.test.mjs +4 -4
- package/tests/interaction-state-stability-static.test.mjs +3 -1
- package/tests/intercom-conversation-viewer-static.test.mjs +4 -4
- package/tests/intercom-conversations-http.test.mjs +16 -0
- package/tests/main-output-loading-static.test.mjs +3 -3
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- 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 +77 -66
- package/tests/open-issue-wizard-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +7 -7
- package/tests/prompt-input-vertical-scroll-static.test.mjs +26 -0
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/runtime-error-visibility.test.mjs +3 -3
- package/tests/session-auth-harness.test.mjs +26 -1
- 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-derived-output.test.mjs +121 -0
- package/tests/stream-markdown-tail.test.mjs +218 -0
- package/tests/stream-output-controller.test.mjs +119 -4
- package/tests/stream-output-isolation-static.test.mjs +34 -6
- package/tests/stream-output-workloads.test.mjs +276 -0
- package/tests/stream-render-scheduler.test.mjs +115 -0
- package/tests/streaming-ui-coupling.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/thinking-format-parser.test.mjs +15 -0
- package/tests/todo-filter-static.test.mjs +148 -0
- package/tests/transcript-markdown-tail.test.mjs +137 -0
- package/tests/ui-layout-settings.test.mjs +54 -7
- package/tests/webui-settings-locking.test.mjs +3 -3
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic streaming workloads for the webui-output-streaming plan
|
|
3
|
+
* (Phase 0 baseline). Every generator is pure and seed-free: the same call
|
|
4
|
+
* always produces the same event sequence, so tests and profiling runs can
|
|
5
|
+
* compare results across revisions byte-for-byte.
|
|
6
|
+
*
|
|
7
|
+
* Events use the same shapes the SSE transport delivers to
|
|
8
|
+
* `createStreamOutputController()`:
|
|
9
|
+
* `{ type: "message_update", assistantMessageEvent: { type, delta, ... } }`
|
|
10
|
+
* and `{ type: "tool_execution_update", ... }`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const WORD_POOL = ["alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel"];
|
|
14
|
+
|
|
15
|
+
export function messageUpdateEvent(type, delta = "", extra = {}) {
|
|
16
|
+
return { type: "message_update", assistantMessageEvent: { type, delta, ...extra } };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 1,000-style small plain-text deltas: short deterministic words plus spaces. */
|
|
20
|
+
export function smallTextDeltaEvents(count = 1000) {
|
|
21
|
+
const events = [];
|
|
22
|
+
for (let index = 0; index < count; index += 1) {
|
|
23
|
+
events.push(messageUpdateEvent("text_delta", `${WORD_POOL[index % WORD_POOL.length]} `));
|
|
24
|
+
}
|
|
25
|
+
return events;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function deterministicChunk(index, chunkBytes) {
|
|
29
|
+
// No blank lines and no fence markers: a single growing paragraph tail.
|
|
30
|
+
const seed = `p${index.toString(36)} `;
|
|
31
|
+
return seed.repeat(Math.ceil(chunkBytes / seed.length)).slice(0, chunkBytes);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A long unbroken paragraph (no blank lines) streamed in fixed-size chunks. */
|
|
35
|
+
export function longParagraphDeltaEvents(totalBytes, chunkBytes = 64) {
|
|
36
|
+
const events = [];
|
|
37
|
+
let produced = 0;
|
|
38
|
+
let index = 0;
|
|
39
|
+
while (produced < totalBytes) {
|
|
40
|
+
const size = Math.min(chunkBytes, totalBytes - produced);
|
|
41
|
+
events.push(messageUpdateEvent("text_delta", deterministicChunk(index, size)));
|
|
42
|
+
produced += size;
|
|
43
|
+
index += 1;
|
|
44
|
+
}
|
|
45
|
+
return events;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An open fenced code block streamed in chunks. The fence is never closed, so
|
|
50
|
+
* every publish keeps the whole fence in the mutable Markdown tail.
|
|
51
|
+
* `codeBytes` under ~50,000 with short lines stays inside the syntax-highlight
|
|
52
|
+
* bounds (repeated tokenization case); larger sizes exercise the plain-token
|
|
53
|
+
* fallback plus full-tail re-render case.
|
|
54
|
+
*/
|
|
55
|
+
export function openFenceDeltaEvents(codeBytes, { language = "js", chunkBytes = 64, lineLength = 40 } = {}) {
|
|
56
|
+
const events = [messageUpdateEvent("text_delta", "```" + language + "\n")];
|
|
57
|
+
let produced = 0;
|
|
58
|
+
let index = 0;
|
|
59
|
+
while (produced < codeBytes) {
|
|
60
|
+
const size = Math.min(chunkBytes, codeBytes - produced);
|
|
61
|
+
let chunk = "";
|
|
62
|
+
while (chunk.length < size) {
|
|
63
|
+
const line = `const v${index.toString(36)} = ${index % 97};`;
|
|
64
|
+
chunk += line.slice(0, Math.min(lineLength, size - chunk.length));
|
|
65
|
+
if (chunk.length < size) chunk += "\n";
|
|
66
|
+
index += 1;
|
|
67
|
+
}
|
|
68
|
+
events.push(messageUpdateEvent("text_delta", chunk));
|
|
69
|
+
produced += size;
|
|
70
|
+
}
|
|
71
|
+
return events;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** A long thinking stream of deterministic reasoning-style deltas. */
|
|
75
|
+
export function thinkingStreamEvents(count = 500) {
|
|
76
|
+
const events = [messageUpdateEvent("thinking_start")];
|
|
77
|
+
for (let index = 0; index < count; index += 1) {
|
|
78
|
+
events.push(messageUpdateEvent("thinking_delta", `step ${index}: ${WORD_POOL[index % WORD_POOL.length]}. `));
|
|
79
|
+
}
|
|
80
|
+
events.push(messageUpdateEvent("thinking_end"));
|
|
81
|
+
return events;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Mixed semantic burst: interleaved thinking, text, tool-call, tool-execution,
|
|
86
|
+
* error, and end barriers in a fixed order for exact-order assertions.
|
|
87
|
+
*/
|
|
88
|
+
export function mixedSemanticBurstEvents() {
|
|
89
|
+
return [
|
|
90
|
+
messageUpdateEvent("thinking_start"),
|
|
91
|
+
messageUpdateEvent("thinking_delta", "planning "),
|
|
92
|
+
messageUpdateEvent("thinking_delta", "steps"),
|
|
93
|
+
messageUpdateEvent("thinking_end"),
|
|
94
|
+
messageUpdateEvent("text_start"),
|
|
95
|
+
messageUpdateEvent("text_delta", "Running the "),
|
|
96
|
+
messageUpdateEvent("text_delta", "command now."),
|
|
97
|
+
messageUpdateEvent("toolcall_start", "", { toolCallId: "tool-1" }),
|
|
98
|
+
messageUpdateEvent("toolcall_delta", '{"cmd":', { toolCallId: "tool-1" }),
|
|
99
|
+
messageUpdateEvent("toolcall_delta", '"ls"}', { toolCallId: "tool-1" }),
|
|
100
|
+
messageUpdateEvent("toolcall_end", "", { toolCallId: "tool-1" }),
|
|
101
|
+
{ type: "tool_execution_update", toolCallId: "tool-1", partialResult: { content: "file-a\n" } },
|
|
102
|
+
{ type: "tool_execution_update", toolCallId: "tool-1", partialResult: { content: "file-a\nfile-b\n" } },
|
|
103
|
+
messageUpdateEvent("text_delta", " Done."),
|
|
104
|
+
messageUpdateEvent("error", "", { error: "deterministic-error" }),
|
|
105
|
+
messageUpdateEvent("text_end"),
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Queue-overflow burst: strictly alternating text/thinking deltas defeat
|
|
111
|
+
* adjacent coalescing, so `pairs * 2` events exercise the entry-limit path of
|
|
112
|
+
* the bounded frame queue.
|
|
113
|
+
*/
|
|
114
|
+
export function overflowBurstEvents({ pairs = 200 } = {}) {
|
|
115
|
+
const events = [];
|
|
116
|
+
for (let index = 0; index < pairs; index += 1) {
|
|
117
|
+
events.push(messageUpdateEvent("text_delta", `t${index} `));
|
|
118
|
+
events.push(messageUpdateEvent("thinking_delta", `h${index} `));
|
|
119
|
+
}
|
|
120
|
+
return events;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Hidden-tab workload. The browser suppresses these live events while hidden
|
|
125
|
+
* and uses `authoritativeText` when it returns to the foreground.
|
|
126
|
+
*/
|
|
127
|
+
export function backgroundForegroundReconciliationScenario(deltaCount = 1000) {
|
|
128
|
+
const hiddenEvents = smallTextDeltaEvents(deltaCount).map((event, index) => ({
|
|
129
|
+
...event,
|
|
130
|
+
baselineIndex: index,
|
|
131
|
+
}));
|
|
132
|
+
return {
|
|
133
|
+
hiddenEvents,
|
|
134
|
+
authoritativeText: concatenatedDeltaText(hiddenEvents),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Deterministic retained messages used by the long-transcript browser baseline. */
|
|
139
|
+
export function longTranscriptMessages(messageCount = 1000) {
|
|
140
|
+
return Array.from({ length: messageCount }, (_, index) => {
|
|
141
|
+
const role = index % 2 === 0 ? "user" : "assistant";
|
|
142
|
+
const text = `LONG-TRANSCRIPT-${String(index).padStart(4, "0")} ${WORD_POOL[index % WORD_POOL.length]} ${"x".repeat(80)}`;
|
|
143
|
+
return {
|
|
144
|
+
role,
|
|
145
|
+
content: role === "assistant" ? [{ type: "text", text }] : text,
|
|
146
|
+
timestamp: 10_000 + index,
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Thousands of retained messages plus a simultaneous deterministic stream. */
|
|
152
|
+
export function longTranscriptActiveStreamScenario({ messageCount = 1000, deltaCount = 1000 } = {}) {
|
|
153
|
+
return {
|
|
154
|
+
retainedMessages: longTranscriptMessages(messageCount),
|
|
155
|
+
activeEvents: smallTextDeltaEvents(deltaCount),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Concatenate every delta of one assistant-message-event type, in order. */
|
|
160
|
+
export function concatenatedDeltaText(events, type = "text_delta") {
|
|
161
|
+
let text = "";
|
|
162
|
+
for (const event of events) {
|
|
163
|
+
const update = event?.assistantMessageEvent;
|
|
164
|
+
if (update?.type === type && typeof update.delta === "string") text += update.delta;
|
|
165
|
+
}
|
|
166
|
+
return text;
|
|
167
|
+
}
|
|
@@ -21,6 +21,9 @@ const usageNormalization = normalizeChip.slice(normalizeChip.indexOf("if (value.
|
|
|
21
21
|
const applyUsage = between(app, "function applyFooterUsageWindows", "const FOOTER_MIDDLE_TRUNCATION_END_CHARS");
|
|
22
22
|
const shapeKey = between(app, "function gitFooterChipShapeKey", "function footerBranchPickerRenderKey");
|
|
23
23
|
const inPlaceUpdate = between(app, "function updateGitFooterChipNodeValue", "let gitFooterRenderCache");
|
|
24
|
+
const providerUsageNormalization = between(app, "function normalizeFooterProviderUsageWindow", "function currentGitFooterCacheCwd");
|
|
25
|
+
const claudeUsageSync = between(app, "function claudeUsageWindowFromProvider", "function claudeUsageResetDate");
|
|
26
|
+
const claudeUsageRefresh = between(app, "async function refreshClaudeUsage", "function scheduleRefreshClaudeUsage");
|
|
24
27
|
|
|
25
28
|
assert.match(parser, /x-codex-primary-window-minutes/, "Codex parser should read the primary window duration");
|
|
26
29
|
assert.match(parser, /x-codex-secondary-window-minutes/, "Codex parser should read the secondary window duration");
|
|
@@ -31,8 +34,20 @@ assert.match(parser, /providerUsageWindows\(usage\)[\s\S]*\.map\(\(window\)/, "f
|
|
|
31
34
|
assert.match(producer, /usageWindows\?:\s*\{\s*primaryPercent\?:\s*number;\s*secondaryPercent\?:\s*number;/s, "producer should type each usage window as independently optional");
|
|
32
35
|
assert.match(producer, /providerUsage\.primary \? \{ primaryPercent: providerUsage\.primary\.usedPercent \}/, "Usage chip should publish an available primary percentage");
|
|
33
36
|
assert.match(producer, /providerUsage\.secondary \? \{ secondaryPercent: providerUsage\.secondary\.usedPercent \}/, "Usage chip should publish an available secondary percentage");
|
|
37
|
+
assert.match(producer, /\.\.\.\(providerUsage \? \{ providerUsage \} : \{\}\)/, "footer payload should publish structured provider usage independently of Usage-chip visibility");
|
|
38
|
+
assert.match(producer, /latestProviderUsage = usage \? \{ \.\.\.usage, capturedAt: Date\.now\(\) \} : null;/, "provider-response capture should timestamp fresh usage snapshots");
|
|
34
39
|
assert.match(app, /usage:\s*"Provider subscription usage\.[^"]*every available provider-reported rate window\./, "Usage tooltip should explain that partial provider windows remain visible");
|
|
35
40
|
|
|
41
|
+
assert.match(providerUsageNormalization, /value\.provider !== "anthropic" && value\.provider !== "openai-codex"/, "consumer should allow only supported provider-usage sources");
|
|
42
|
+
assert.match(providerUsageNormalization, /normalizeFooterProviderUsageWindow\(value\.primary\)[\s\S]*normalizeFooterProviderUsageWindow\(value\.secondary\)/, "consumer should normalize both structured provider windows without parsing display text");
|
|
43
|
+
assert.match(app, /const providerUsage = normalizeFooterProviderUsage\(parsed\.providerUsage\);[\s\S]*\{ providerUsage \}/, "footer payload parsing should retain normalized provider usage metadata");
|
|
44
|
+
assert.match(claudeUsageSync, /providerUsage\?\.provider !== "anthropic"[\s\S]*source: "git-footer-status-provider-headers"[\s\S]*windows/, "Claude Usage should consume the same live Anthropic header snapshot as the footer");
|
|
45
|
+
assert.match(claudeUsageSync, /capturedAt \+ resetAfterSeconds \* 1000/, "relative reset times should be anchored to provider capture time instead of drifting on each render");
|
|
46
|
+
assert.match(claudeUsageRefresh, /if \(!forceCli && syncClaudeUsageFromGitFooterPayload\(\)\) return;/, "scheduled Claude refreshes should prefer the live footer snapshot");
|
|
47
|
+
assert.match(app, /if \(footerPayload\) syncClaudeUsageFromGitFooterPayload\(footerPayload\);/, "incoming footer status should update the Claude Usage panel immediately");
|
|
48
|
+
assert.match(app, /function applyOptimisticGitFooterBranch[\s\S]*payload\.providerUsage \? \{ providerUsage: payload\.providerUsage \}/, "optimistic branch updates should preserve the provider snapshot used by Claude Usage");
|
|
49
|
+
assert.match(app, /refreshClaudeUsage\(\{ forceCli: true \}\)/, "the explicit Refresh usage button should retain the CLI fallback path");
|
|
50
|
+
|
|
36
51
|
assert.match(usageNormalization, /value\.usageWindows\.primaryPercent/, "consumer should read structured primary metadata");
|
|
37
52
|
assert.match(usageNormalization, /value\.usageWindows\.secondaryPercent/, "consumer should read structured secondary metadata");
|
|
38
53
|
assert.match(usageNormalization, /Number\.isFinite\(primaryPercent\)\s*\|\|\s*Number\.isFinite\(secondaryPercent\)/, "consumer should accept either finite window value");
|
|
@@ -68,7 +68,7 @@ assert.match(
|
|
|
68
68
|
assert.match(app, /case "webui_connected":[\s\S]*?resumedWithFreshSnapshot[\s\S]*?if \(!resumedWithFreshSnapshot\) scheduleForegroundReconcile/, "the deliberate reconnect must not immediately trigger a second full refresh");
|
|
69
69
|
assert.match(app, /case "webui_supervisor_reconnected":[\s\S]*?foregroundReconnectSnapshotFreshUntil/, "initial supervisor replay must reuse the fresh foreground snapshot");
|
|
70
70
|
|
|
71
|
-
const executeBeginCatchUp = new Function("eventSource", "streamOutputController", `
|
|
71
|
+
const executeBeginCatchUp = new Function("eventSource", "streamOutputController", "flushNormalStreamRenders", `
|
|
72
72
|
let foregroundTranscriptCatchUpRequired = false;
|
|
73
73
|
let backgroundReconnectSnapshotFresh = true;
|
|
74
74
|
let eventStreamPausedForBackground = false;
|
|
@@ -77,10 +77,16 @@ const executeBeginCatchUp = new Function("eventSource", "streamOutputController"
|
|
|
77
77
|
`);
|
|
78
78
|
let closeCount = 0;
|
|
79
79
|
let cancelCount = 0;
|
|
80
|
+
let normalRenderFlushCount = 0;
|
|
80
81
|
const pausedState = executeBeginCatchUp(
|
|
81
82
|
{ close() { closeCount += 1; } },
|
|
82
83
|
{ cancel() { cancelCount += 1; } },
|
|
84
|
+
(reason) => {
|
|
85
|
+
assert.equal(reason, "visibility-hidden");
|
|
86
|
+
normalRenderFlushCount += 1;
|
|
87
|
+
},
|
|
83
88
|
);
|
|
89
|
+
assert.equal(normalRenderFlushCount, 1, "backgrounding should flush pending normal formatting exactly once before pausing");
|
|
84
90
|
assert.equal(cancelCount, 1, "backgrounding should cancel pending transcript work exactly once");
|
|
85
91
|
assert.equal(closeCount, 1, "backgrounding should close the active EventSource exactly once");
|
|
86
92
|
assert.equal(pausedState.eventSource, null, "the closed EventSource must be detached so no queued message handler remains current");
|
|
@@ -69,7 +69,7 @@ try {
|
|
|
69
69
|
assert.equal(migrated.gitWorkflow.stagingPolicy, "review");
|
|
70
70
|
assert.equal(migrated.gitWorkflow.reviewProcessEnabled, true, "legacy settings should preserve the existing review-process behavior");
|
|
71
71
|
assert.equal(migrated.gitWorkflow.generation.thinkingLevel, "low");
|
|
72
|
-
assert.equal(migrated.uiLayout.version,
|
|
72
|
+
assert.equal(migrated.uiLayout.version, 3);
|
|
73
73
|
assert.equal(migrated.uiLayout.sidePanel.placement, "right");
|
|
74
74
|
assert.deepEqual(migrated.uiLayout.sidePanel.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: [] });
|
|
75
75
|
assert.deepEqual(migrated.uiLayout.sidePanel.collapsedSectionIds, ["git"]);
|
|
@@ -128,7 +128,7 @@ try {
|
|
|
128
128
|
|
|
129
129
|
const persisted = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
130
130
|
assert.equal(persisted.version, 8);
|
|
131
|
-
assert.equal(persisted.uiLayout.version,
|
|
131
|
+
assert.equal(persisted.uiLayout.version, 3, "the first unrelated locked write must persist the migrated v3 envelope");
|
|
132
132
|
assert.deepEqual(persisted.uiLayout.sidePanel.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: [] });
|
|
133
133
|
assert.deepEqual(persisted.uiLayout.composerActions, completeV1Layout.composerActions, "unchanged v1 composer fields must survive persistence");
|
|
134
134
|
assert.deepEqual(persisted.uiLayout.terminalTabs, { ...completeV1Layout.terminalTabs, sidebarWidth: null }, "unchanged v1 terminal fields must survive persistence while new width state defaults safely");
|
|
@@ -810,7 +810,7 @@ try {
|
|
|
810
810
|
const initialInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences");
|
|
811
811
|
assert.equal(initialInterfacePreferences.status, 200);
|
|
812
812
|
assert.equal(initialInterfacePreferences.body?.data?.preferences?.sidePanelWidth, null, "a user without a saved width should receive the default preference");
|
|
813
|
-
assert.equal(initialInterfacePreferences.body?.data?.layout?.version,
|
|
813
|
+
assert.equal(initialInterfacePreferences.body?.data?.layout?.version, 3);
|
|
814
814
|
assert.deepEqual(initialInterfacePreferences.body?.data?.layout?.sidePanel?.sectionLayout, { order: null, leftSectionIds: null });
|
|
815
815
|
assert.match(initialInterfacePreferences.body?.data?.layoutRevision || "", /^[a-f0-9]{64}$/);
|
|
816
816
|
assert.equal(Object.hasOwn(initialInterfacePreferences.body?.data || {}, "path"), false, "preference responses must not disclose the user's settings-file path");
|
|
@@ -839,7 +839,7 @@ try {
|
|
|
839
839
|
sidePanelWidth: 620,
|
|
840
840
|
expectedLayoutRevision: initialLayoutRevision,
|
|
841
841
|
layout: {
|
|
842
|
-
version:
|
|
842
|
+
version: 3,
|
|
843
843
|
sidePanel: {
|
|
844
844
|
placement: "both",
|
|
845
845
|
sectionLayout: { order: ["files", "controls", "git"], leftSectionIds: ["files"] },
|
|
@@ -857,7 +857,7 @@ try {
|
|
|
857
857
|
});
|
|
858
858
|
assert.equal(savedLayout.status, 200, savedLayout.body?.error);
|
|
859
859
|
assert.equal(savedLayout.body?.data?.preferences?.sidePanelWidth, 620);
|
|
860
|
-
assert.equal(savedLayout.body?.data?.layout?.sidePanel?.panelWidths?.right, 620, "one locked PUT must expose matching
|
|
860
|
+
assert.equal(savedLayout.body?.data?.layout?.sidePanel?.panelWidths?.right, 620, "one locked PUT must expose matching v3 right and legacy widths");
|
|
861
861
|
assert.deepEqual(savedLayout.body?.data?.layout?.sidePanel?.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: ["files"] });
|
|
862
862
|
assert.deepEqual(savedLayout.body?.data?.layout?.composerActions?.order, ["new", "git", "send"]);
|
|
863
863
|
assert.equal(savedLayout.body?.data?.layout?.terminalTabs?.layout, "left");
|
|
@@ -868,7 +868,7 @@ try {
|
|
|
868
868
|
const persistedLayoutSettings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
869
869
|
assert.equal(persistedLayoutSettings.version, 8);
|
|
870
870
|
assert.equal(persistedLayoutSettings.interfacePreferences.sidePanelWidth, 620);
|
|
871
|
-
assert.equal(persistedLayoutSettings.uiLayout.sidePanel.panelWidths.right, 620, "the
|
|
871
|
+
assert.equal(persistedLayoutSettings.uiLayout.sidePanel.panelWidths.right, 620, "the v3 right width and legacy mirror must persist atomically");
|
|
872
872
|
assert.equal(persistedLayoutSettings.uiLayout.fileViewerWidth, 560);
|
|
873
873
|
assert.deepEqual(persistedLayoutSettings.uiLayout.composerActions.grid.positions, { new: 0, git: 1, send: 10 });
|
|
874
874
|
|
|
@@ -227,7 +227,9 @@ assert.match(updateTextSurface, /_transcriptTextNode[\s\S]*node\.appendData\(val
|
|
|
227
227
|
// Stable committed blocks and a bounded mutable tail.
|
|
228
228
|
assert.match(reconcileMarkdownSurface, /if \(boundary > state\.stableText\.length\)/, "committed blocks must never be re-rendered for append-only input");
|
|
229
229
|
assert.match(reconcileMarkdownSurface, /for \(const node of state\.tailNodes\) node\.remove\(\)/, "only the mutable tail may be detached during streaming");
|
|
230
|
-
assert.match(reconcileMarkdownSurface, /const diverged = !!state && !value\.startsWith\(state\.
|
|
230
|
+
assert.match(reconcileMarkdownSurface, /const diverged = !!state && !value\.startsWith\(state\.value\);[\s\S]*invalidateSelection: diverged/, "authoritative divergence must compare the whole previous value and explicitly invalidate selection");
|
|
231
|
+
assert.match(reconcileMarkdownSurface, /canReuseLiveTail[\s\S]*appendLiveTail\(state\.tailNodes, state\.tailText, tail, boundaryInfo\)/, "open fences and bounded plain tails must append into their mounted live nodes");
|
|
232
|
+
assert.match(reconcileMarkdownSurface, /promotesMountedTail[\s\S]*ownBlocks\(state\.tailNodes[\s\S]*state\.tailNodes = \[\]/, "a newly stable mounted tail must be promoted without detaching its DOM");
|
|
231
233
|
|
|
232
234
|
// Live settlement adoption.
|
|
233
235
|
assert.match(authoritativeAssistantTextForAdoption, /if \(finalParts\.length !== 1\) return null;/, "multi-part settlement must not be fuzzy-adopted onto a single live surface");
|
|
@@ -41,7 +41,7 @@ for (const id of [
|
|
|
41
41
|
|
|
42
42
|
assert.match(
|
|
43
43
|
html,
|
|
44
|
-
/<div class="composer-context-tags">[\s\S]*<div id="intercomConversationTags" class="composer-intercom-tags" role="group" aria-label="Agent conversations" aria-live="polite" hidden><\/div>/,
|
|
44
|
+
/<div class="composer-context-tags">[\s\S]*<div id="intercomConversationTags" class="composer-intercom-tags" role="group" aria-label="Agent conversations" aria-live="polite" data-visibility-key="tag\.agent-conversations" hidden><\/div>/,
|
|
45
45
|
"the dedicated conversation-tag list should live beneath the composer input in the existing context-tag surface",
|
|
46
46
|
);
|
|
47
47
|
assert.match(
|
|
@@ -95,9 +95,9 @@ assert.match(css, /\.composer-intercom-tag:hover,[\s\S]*\.composer-intercom-tag:
|
|
|
95
95
|
assert.match(css, /\.extension-dialog\.intercom-conversation-dialog \{[\s\S]*width: min\(76rem,[\s\S]*height: min\(54rem,/, "the viewer should use a large in-app modal");
|
|
96
96
|
assert.match(css, /@media \(max-width: 720px\)[\s\S]*\.composer-intercom-tag \{ min-height: 44px;[\s\S]*\.extension-dialog\.intercom-conversation-dialog[\s\S]*width: calc\(100vw - 0\.7rem\)/, "tags and the dialog should remain reachable on narrow and coarse-pointer layouts");
|
|
97
97
|
|
|
98
|
-
assert.match(html, /\/styles\.css\?v=
|
|
99
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
100
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
98
|
+
assert.match(html, /\/styles\.css\?v=132/, "the stylesheet URL should advance for the bounded conversation tags");
|
|
99
|
+
assert.match(html, /data-app-src="\/app\.js\?v=157"/, "the guarded app URL should advance for current browser wiring");
|
|
100
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123"/, "the PWA cache identity should advance with browser assets");
|
|
101
101
|
|
|
102
102
|
assert.match(readme, /one compact tag per conversation appears beneath the composer/i, "the README should explain the user-visible entry point");
|
|
103
103
|
assert.match(technical, /## Agent conversation viewer[\s\S]*Attachments, tool calls and results, thinking, stdout\/stderr, filesystem paths, raw session records/i, "the advanced guide should document privacy exclusions");
|
|
@@ -244,6 +244,22 @@ try {
|
|
|
244
244
|
const outsideResponse = await request(server.port, `/api/intercom/conversations?tab=${encodeURIComponent(outsideTabId)}`);
|
|
245
245
|
assert.equal(outsideResponse.status, 403, "server-derived session files outside allowed Pi roots must be rejected");
|
|
246
246
|
assert.equal(JSON.stringify(outsideResponse.body).includes(outsideSessionFile), false, "confinement errors must not expose the rejected path");
|
|
247
|
+
await stopServer(server.child);
|
|
248
|
+
server = undefined;
|
|
249
|
+
|
|
250
|
+
// Fresh/empty session: the file is only created on first persist, so the
|
|
251
|
+
// endpoint must answer with an empty projection instead of erroring out
|
|
252
|
+
// every poll for the tab (regression for "Persisted session is unavailable").
|
|
253
|
+
const pendingSessionFile = path.join(sessionDir, "not-created-yet.jsonl");
|
|
254
|
+
server = await startServer(pendingSessionFile);
|
|
255
|
+
const pendingTabId = await startupTabId(server);
|
|
256
|
+
const pendingBasePath = `/api/intercom/conversations?tab=${encodeURIComponent(pendingTabId)}`;
|
|
257
|
+
const pendingSummary = await request(server.port, pendingBasePath);
|
|
258
|
+
assert.equal(pendingSummary.status, 200, pendingSummary.body?.error);
|
|
259
|
+
assert.deepEqual(pendingSummary.body?.data?.conversations, [], "a not-yet-persisted session must project zero conversations");
|
|
260
|
+
const pendingMissingConversation = await request(server.port, `${pendingBasePath}&conversation=conv_${"b".repeat(24)}`);
|
|
261
|
+
assert.equal(pendingMissingConversation.status, 404, "an explicit unknown conversation on an unpersisted session must still 404");
|
|
262
|
+
assert.equal(JSON.stringify(pendingMissingConversation.body).includes(pendingSessionFile), false, "the 404 must not expose the pending session path");
|
|
247
263
|
|
|
248
264
|
console.log("intercom-conversations-http: ok");
|
|
249
265
|
} finally {
|
|
@@ -50,9 +50,9 @@ assert.match(css, /@media \(prefers-reduced-motion: reduce\)[\s\S]*?animation-du
|
|
|
50
50
|
assert.match(css, /body\.terminal-tabs-left \.main-output-loading,[\s\S]*?body\.terminal-tabs-left \.chat \{ grid-row: 4; \}/, "sidebar tab placement should keep the status inside the transcript grid row");
|
|
51
51
|
assert.match(css, /body\.subagent-terminal-active \.main-output-loading,/, "main-output loading feedback should stay hidden in the dedicated subagent view");
|
|
52
52
|
|
|
53
|
-
assert.match(html, /styles\.css\?v=
|
|
54
|
-
assert.match(html, /app\.js\?v=
|
|
55
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
53
|
+
assert.match(html, /styles\.css\?v=132/, "the stylesheet cache query should advance");
|
|
54
|
+
assert.match(html, /app\.js\?v=157/, "the app cache query should advance");
|
|
55
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123"/, "the PWA cache identity should advance with browser assets");
|
|
56
56
|
assert.match(readme, /Loading agent output/, "user documentation should describe the visible loading feedback");
|
|
57
57
|
assert.match(development, /main output loading/i, "developer documentation should preserve the request-ownership contract");
|
|
58
58
|
|
|
@@ -16,9 +16,9 @@ assert.match(app, /import \{ installMiddleButtonDragScroll \} from "\.\/middle-b
|
|
|
16
16
|
assert.match(app, /installMiddleButtonDragScroll\(\{[\s\S]*onDirection: \(\{ target, offsetY \}\)[\s\S]*noteChatUserScrollIntent\(\{ type: "middle-drag", deltaY: offsetY \}\)/, "chat auto-scroll direction should feed the existing follow/pause intent state");
|
|
17
17
|
assert.match(app, /event\?\.type === "middle-drag"\) return event\.deltaY > 0;/, "moving below the press point should be recognized as intent to read later chat output");
|
|
18
18
|
assert.match(css, /body\.middle-button-auto-scrolling,[\s\S]*cursor: all-scroll !important;[\s\S]*user-select: none !important;/, "active automatic scrolling should expose a directional-scroll affordance and suppress accidental selection");
|
|
19
|
-
assert.match(html, /styles\.css\?v=
|
|
20
|
-
assert.match(html, /app\.js\?v=
|
|
21
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
19
|
+
assert.match(html, /styles\.css\?v=132/, "changed drag-scroll styles should advance the stylesheet revision");
|
|
20
|
+
assert.match(html, /app\.js\?v=157/, "changed drag-scroll wiring should advance the app revision");
|
|
21
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123";[\s\S]*"\/middle-button-drag-scroll\.mjs"/, "offline PWA installs should refresh and cache the new controller module");
|
|
22
22
|
assert.match(JSON.parse(packageJson).scripts.check, /node --check public\/middle-button-drag-scroll\.mjs/, "the package check should parse the startup-critical controller module");
|
|
23
23
|
|
|
24
24
|
console.log("middle-button-drag-scroll-static.test.mjs passed");
|
|
@@ -47,9 +47,9 @@ assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-nav[\s\S]*?widt
|
|
|
47
47
|
assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-surface[\s\S]*?width: min\(30rem, 72vw\)/, "tablet inspector must be a bounded right-side sheet");
|
|
48
48
|
assert.match(css, /html\[data-tablet-shell="v2"\] \.file-viewer-pane[\s\S]*?position: fixed[\s\S]*?inset: 0/, "tablet files must default to full-screen replacement");
|
|
49
49
|
assert.match(css, /and \(pointer: coarse\)[\s\S]*?min-height: 44px/, "coarse tablet pointers must retain the 44px target floor");
|
|
50
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
51
|
-
assert.match(html, /styles\.css\?v=
|
|
52
|
-
assert.match(html, /app\.js\?v=
|
|
50
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123"/, "continuity/tablet assets need a coherent cache identity");
|
|
51
|
+
assert.match(html, /styles\.css\?v=132/, "tablet CSS must have a coherent HTML revision");
|
|
52
|
+
assert.match(html, /app\.js\?v=157/, "continuity app logic must have a coherent HTML revision");
|
|
53
53
|
assert.match(technical, /tabletShell=v2[\s\S]*tabletShell=legacy/, "technical reference should document tablet preview and rollback");
|
|
54
54
|
|
|
55
55
|
console.log("mobile-continuity-tablet-static.test.mjs passed");
|
|
@@ -37,9 +37,9 @@ assert.match(pkg.scripts.check, /node --check public\/transcript-renderer\.mjs/,
|
|
|
37
37
|
assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server must serve typed startup modules from the public asset boundary");
|
|
38
38
|
assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
|
|
39
39
|
assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
|
|
40
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
41
|
-
assert.match(html, /styles\.css\?v=
|
|
42
|
-
assert.match(html, /app\.js\?v=
|
|
40
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123"/, "the cache identity must change with the startup graph");
|
|
41
|
+
assert.match(html, /styles\.css\?v=132/, "the stylesheet revision must change with mobile/tablet CSS fixes");
|
|
42
|
+
assert.match(html, /app\.js\?v=157/, "the app revision must change with continuity/tablet wiring");
|
|
43
43
|
assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;[\s\S]*?event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)[\s\S]*?return networkResponse;/, "runtime cache writes must extend the event lifetime without blocking bounded network responses");
|
|
44
44
|
assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
|
|
45
45
|
assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
|
|
@@ -60,6 +60,6 @@ assert.match(css, /data-mobile-presentation="essential"/, "Essential presentatio
|
|
|
60
60
|
assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
|
|
61
61
|
assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
|
|
62
62
|
assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v123"/, "browser asset changes need a coherent cache tuple");
|
|
64
64
|
|
|
65
65
|
console.log("mobile-phone-experience-static.test.mjs passed");
|