@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.
Files changed (78) hide show
  1. package/README.md +14 -8
  2. package/bin/pi-webui.mjs +256 -39
  3. package/index.ts +266 -1
  4. package/lib/git-workflow-preferences.mjs +8 -25
  5. package/lib/intercom-conversations.mjs +491 -0
  6. package/lib/intercom-transcript-filter.mjs +99 -0
  7. package/lib/resource-selection.mjs +140 -0
  8. package/package.json +2 -2
  9. package/public/app.js +1061 -119
  10. package/public/index.html +31 -6
  11. package/public/service-worker.js +2 -1
  12. package/public/stream-output-controller.mjs +15 -0
  13. package/public/styles.css +426 -1
  14. package/public/syntax-highlight.mjs +622 -0
  15. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  16. package/tests/browser/interaction-continuity.spec.mjs +34 -0
  17. package/tests/browser/intercom-conversation-viewer.spec.mjs +357 -0
  18. package/tests/browser/persistent-ui-layout.spec.mjs +61 -0
  19. package/tests/browser/resource-profiles.spec.mjs +200 -0
  20. package/tests/browser/subagent-observability.spec.mjs +29 -0
  21. package/tests/codex-fast-mode-static.test.mjs +7 -6
  22. package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
  23. package/tests/common-options-submenus-markup-static.test.mjs +1 -0
  24. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  25. package/tests/composer-skill-tag-layout.test.mjs +32 -2
  26. package/tests/control-deck-component-updates-static.test.mjs +4 -0
  27. package/tests/controls-layout-static.test.mjs +3 -3
  28. package/tests/fast-mode-client-static.test.mjs +2 -2
  29. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  30. package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
  31. package/tests/file-viewer-image-static.test.mjs +69 -0
  32. package/tests/fixtures/fake-pi.mjs +105 -6
  33. package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
  34. package/tests/git-panel-file-preview-static.test.mjs +5 -5
  35. package/tests/git-panel-live-updates-static.test.mjs +3 -3
  36. package/tests/git-workflow-preferences.test.mjs +4 -4
  37. package/tests/http-endpoints-harness.test.mjs +124 -2
  38. package/tests/intercom-conversation-viewer-static.test.mjs +106 -0
  39. package/tests/intercom-conversations-http.test.mjs +252 -0
  40. package/tests/intercom-conversations.test.mjs +374 -0
  41. package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
  42. package/tests/intercom-tag-layout-static.test.mjs +46 -0
  43. package/tests/intercom-transcript-filter.test.mjs +98 -0
  44. package/tests/main-output-loading-static.test.mjs +59 -0
  45. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  46. package/tests/mobile-compact-layout.test.mjs +2 -3
  47. package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
  48. package/tests/mobile-foundation-static.test.mjs +3 -3
  49. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  50. package/tests/mobile-static.test.mjs +66 -42
  51. package/tests/native-parity.test.mjs +8 -7
  52. package/tests/open-issue-wizard-static.test.mjs +1 -1
  53. package/tests/optional-feature-migration-frontend.test.mjs +5 -5
  54. package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
  55. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  56. package/tests/questionnaire-dialog.test.mjs +3 -3
  57. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  58. package/tests/resource-defaults-helper.test.mjs +60 -6
  59. package/tests/resource-selection.test.mjs +114 -0
  60. package/tests/resource-tui-extension.test.mjs +23 -0
  61. package/tests/session-sampling-ui-static.test.mjs +3 -3
  62. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  63. package/tests/stream-output-controller.test.mjs +8 -0
  64. package/tests/stream-output-isolation-static.test.mjs +2 -2
  65. package/tests/streaming-ui-coupling.test.mjs +5 -0
  66. package/tests/subagent-gate-visibility.test.mjs +1 -1
  67. package/tests/subagent-launch-slots.test.mjs +1 -1
  68. package/tests/subagent-observability-static.test.mjs +5 -3
  69. package/tests/subagent-reliability-integration.test.mjs +23 -1
  70. package/tests/subagent-workflow-section-static.test.mjs +67 -0
  71. package/tests/subagents-helper.test.mjs +313 -1
  72. package/tests/syntax-highlight.test.mjs +235 -0
  73. package/tests/syntax-highlighting-static.test.mjs +84 -0
  74. package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
  75. package/tests/theme-customizer-static.test.mjs +5 -5
  76. package/tests/thinking-format-parser.test.mjs +64 -0
  77. package/tests/webui-settings-locking.test.mjs +1 -1
  78. package/webui-rpc-helper.mjs +417 -74
@@ -27,13 +27,18 @@ const previousSettingsFile = process.env.PI_WEBUI_SETTINGS_FILE;
27
27
  process.env.PI_WEBUI_SETTINGS_FILE = settingsFile;
28
28
 
29
29
  try {
30
- await writeFile(settingsFile, `${JSON.stringify({
31
- version: 3,
30
+ const settingsPayload = {
31
+ version: 8,
32
32
  resourceDefaults: {
33
33
  tools: { enabledTools: ["read", "write"] },
34
34
  skills: { enabledSkills: ["skill-a", "skill-c"] },
35
+ modelProfiles: [
36
+ { provider: "provider", modelId: "model-a", tools: { enabledTools: ["bash"] }, skills: { enabledSkills: ["skill-b"] } },
37
+ { provider: "provider", modelId: "model-b", tools: { enabledTools: ["write"] }, skills: { enabledSkills: [] } },
38
+ ],
35
39
  },
36
- }, null, 2)}\n`, "utf8");
40
+ };
41
+ await writeFile(settingsFile, "{ invalid settings\n", "utf8");
37
42
 
38
43
  const extensionHandlers = new Map();
39
44
  const registeredCommands = new Map();
@@ -43,6 +48,7 @@ try {
43
48
  let activeTools = ["read", "bash", "write"];
44
49
  let branchEntries = [];
45
50
  let availableSkills = [];
51
+ let runtimeReady = false;
46
52
 
47
53
  const pi = {
48
54
  events: bus,
@@ -55,15 +61,22 @@ try {
55
61
  getAllTools() {
56
62
  return ["read", "bash", "write"].map((name) => ({ name, description: `${name} tool`, sourceInfo: { source: "builtin" } }));
57
63
  },
58
- getActiveTools() { return [...activeTools]; },
64
+ getActiveTools() {
65
+ assert.equal(runtimeReady, true, "extension action methods must not run while the extension factory is loading");
66
+ return [...activeTools];
67
+ },
59
68
  setActiveTools(names) { activeTools = [...names]; },
60
- appendEntry(customType, data) { appendedEntries.push({ customType, data }); },
69
+ appendEntry(customType, data) {
70
+ appendedEntries.push({ customType, data });
71
+ branchEntries.push({ type: "custom", customType, data });
72
+ },
61
73
  };
62
74
 
63
75
  const ctx = {
64
76
  mode: "rpc",
65
77
  hasUI: true,
66
78
  cwd: root,
79
+ model: { provider: "provider", id: "unconfigured" },
67
80
  sessionManager: {
68
81
  getBranch() { return branchEntries; },
69
82
  },
@@ -79,6 +92,7 @@ try {
79
92
  };
80
93
 
81
94
  webuiRpcHelper(pi);
95
+ runtimeReady = true;
82
96
  const helperCommand = registeredCommands.get("webui-helper");
83
97
  assert.ok(helperCommand?.handler, "resource defaults test requires the hidden helper command");
84
98
 
@@ -93,6 +107,11 @@ try {
93
107
  }
94
108
 
95
109
  for (const handler of extensionHandlers.get("session_start") || []) await handler({ reason: "startup" }, ctx);
110
+ assert.deepEqual(activeTools, ["read", "bash", "write"], "an initial settings-read failure must leave Pi's runtime tools unchanged");
111
+ assert.ok(notifications.some((entry) => /tools and skills remain unchanged/i.test(entry.message)), "initial settings failure should emit a bounded warning");
112
+
113
+ await writeFile(settingsFile, `${JSON.stringify(settingsPayload, null, 2)}\n`, "utf8");
114
+ for (const handler of extensionHandlers.get("session_start") || []) await handler({ reason: "settings-restored" }, ctx);
96
115
  availableSkills = ["skill-a", "skill-b", "skill-c"];
97
116
  assert.deepEqual(activeTools, ["read", "write"], "a new session should inherit the global tool allowlist");
98
117
  assert.deepEqual(
@@ -113,9 +132,44 @@ try {
113
132
  "session skill choices should override the global default",
114
133
  );
115
134
 
135
+ branchEntries = [];
136
+ ctx.model = { provider: "provider", id: "model-a" };
137
+ for (const handler of extensionHandlers.get("model_select") || []) await handler({ model: ctx.model, source: "set" }, ctx);
138
+ assert.deepEqual(activeTools, ["bash"], "model selection should immediately apply the exact tool profile");
139
+ assert.deepEqual((await runHelper("skills-state")).enabledSkills, ["skill-b"], "model selection should immediately apply the exact skill profile");
140
+
141
+ await writeFile(settingsFile, "{ invalid settings\n", "utf8");
142
+ ctx.model = { provider: "provider", id: "model-b" };
143
+ for (const handler of extensionHandlers.get("model_select") || []) await handler({ model: ctx.model, source: "set" }, ctx);
144
+ assert.deepEqual(activeTools, ["bash"], "a later settings-read failure must retain the last safely applied tools");
145
+ assert.deepEqual((await runHelper("skills-state")).enabledSkills, ["skill-b"], "a later settings-read failure must retain the last safely applied skills");
146
+ await writeFile(settingsFile, `${JSON.stringify(settingsPayload, null, 2)}\n`, "utf8");
147
+ ctx.model = { provider: "provider", id: "model-a" };
148
+
116
149
  await runHelper("tools-set", { enabledTools: ["read"] });
150
+ ctx.model = { provider: "provider", id: "model-b" };
151
+ for (const handler of extensionHandlers.get("model_select") || []) await handler({ model: ctx.model, source: "set" }, ctx);
152
+ assert.deepEqual(activeTools, ["read"], "a session-pinned tool selection should survive model changes");
153
+ assert.deepEqual((await runHelper("skills-state")).enabledSkills, [], "an unpinned skill selection should follow the new model independently");
154
+ const blockedSkill = await (extensionHandlers.get("input") || [])[0]({ text: "/skill:skill-a" }, ctx);
155
+ assert.deepEqual(blockedSkill, { action: "handled" }, "an explicit invocation of a model-disabled skill should be blocked");
156
+
157
+ await runHelper("tools-set", { mode: "inherit" });
158
+ assert.deepEqual(activeTools, ["write"], "unpinning tools should immediately restore the active model profile");
117
159
  await runHelper("skills-set", { enabledSkills: ["skill-a", "skill-c"] });
118
- assert.deepEqual(appendedEntries.map((entry) => entry.customType), ["webui-tools-config", "webui-skills-config"], "session updates should remain branch-persisted");
160
+ const filteredPrompt = await (extensionHandlers.get("before_agent_start") || [])[0]({
161
+ systemPrompt: "The following skills provide guidance.\n<available_skills>\nold\n</available_skills>\n",
162
+ systemPromptOptions: {
163
+ skills: [
164
+ { name: "skill-a", description: "normal", filePath: "/tmp/a/SKILL.md" },
165
+ { name: "skill-c", description: "user only", filePath: "/tmp/c/SKILL.md", disableModelInvocation: true },
166
+ ],
167
+ },
168
+ }, ctx);
169
+ assert.doesNotMatch(filteredPrompt.systemPrompt, /skill-c/, "disableModelInvocation skills must not be exposed to automatic model invocation");
170
+ assert.deepEqual(appendedEntries.map((entry) => entry.customType), ["webui-tools-config", "webui-tools-config", "webui-skills-config"], "session updates and inherit resets should remain branch-persisted");
171
+ assert.deepEqual(appendedEntries[0].data, { version: 2, mode: "explicit", enabledTools: ["read"] });
172
+ assert.deepEqual(appendedEntries[1].data, { version: 2, mode: "inherit" });
119
173
 
120
174
  for (const handler of extensionHandlers.get("session_shutdown") || []) await handler({ reason: "quit" }, ctx);
121
175
  console.log("resource-defaults-helper.test.mjs passed");
@@ -0,0 +1,114 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+ import {
6
+ branchResourceDirective,
7
+ normalizeResourceDefaults,
8
+ preserveUnavailableResourceNames,
9
+ resolveResourceSelection,
10
+ setExactModelProfile,
11
+ } from "../lib/resource-selection.mjs";
12
+ import { normalizeWebuiSettings, readWebuiSettings, writeWebuiSettings } from "../lib/git-workflow-preferences.mjs";
13
+
14
+ const normalized = normalizeWebuiSettings({
15
+ version: 8,
16
+ retained: { ok: true },
17
+ resourceDefaults: {
18
+ tools: { enabledTools: ["read", "read", ""] },
19
+ skills: { enabledSkills: null },
20
+ modelProfiles: [
21
+ { provider: "p", modelId: "m/one", tools: { enabledTools: ["bash"] }, skills: { enabledSkills: null } },
22
+ { provider: "p", modelId: "m/one", tools: { enabledTools: [] }, skills: { enabledSkills: ["skill-a"] } },
23
+ { provider: "", modelId: "bad", tools: { enabledTools: ["write"] } },
24
+ { provider: "p", modelId: "empty", tools: { enabledTools: null }, skills: { enabledSkills: null } },
25
+ ],
26
+ },
27
+ });
28
+ assert.equal(normalized.version, 8);
29
+ assert.deepEqual(normalized.retained, { ok: true });
30
+ assert.deepEqual(normalized.resourceDefaults.tools.enabledTools, ["read"]);
31
+ assert.equal(normalized.resourceDefaults.modelProfiles.length, 1);
32
+ assert.deepEqual(resolveResourceSelection(normalized.resourceDefaults, "tools", "p", "m/one", ["runtime"]), { names: [], source: "model" });
33
+ assert.deepEqual(resolveResourceSelection(normalized.resourceDefaults, "skills", "p", "m/one", null), { names: ["skill-a"], source: "model" });
34
+ assert.deepEqual(resolveResourceSelection(normalized.resourceDefaults, "skills", "p", "other", null), { names: null, source: "runtime" });
35
+
36
+ const legacyWithProfiles = normalizeWebuiSettings({
37
+ version: 7,
38
+ resourceDefaults: {
39
+ tools: { enabledTools: ["global"] },
40
+ modelProfiles: [{ provider: "p", modelId: "legacy", tools: { enabledTools: ["bash"] } }],
41
+ },
42
+ });
43
+ assert.deepEqual(legacyWithProfiles.resourceDefaults.modelProfiles, [], "version-7 settings must ignore model profiles");
44
+ assert.deepEqual(resolveResourceSelection(legacyWithProfiles.resourceDefaults, "tools", "p", "legacy", ["runtime"]), { names: ["global"], source: "global" });
45
+
46
+ const future = normalizeWebuiSettings({
47
+ version: 9,
48
+ resourceDefaults: {
49
+ futurePolicy: { keep: true },
50
+ tools: { enabledTools: ["read"], futureToolField: "keep" },
51
+ skills: { enabledSkills: null, futureSkillField: 3 },
52
+ modelProfiles: [{
53
+ provider: "p",
54
+ modelId: "future",
55
+ futureProfileField: ["keep"],
56
+ tools: { enabledTools: ["bash"], futureSelectionField: true },
57
+ skills: { enabledSkills: null },
58
+ }],
59
+ },
60
+ });
61
+ assert.deepEqual(future.resourceDefaults.futurePolicy, { keep: true });
62
+ assert.equal(future.resourceDefaults.tools.futureToolField, "keep");
63
+ assert.equal(future.resourceDefaults.skills.futureSkillField, 3);
64
+ assert.deepEqual(future.resourceDefaults.modelProfiles[0].futureProfileField, ["keep"]);
65
+ assert.equal(future.resourceDefaults.modelProfiles[0].tools.futureSelectionField, true);
66
+
67
+ const defaults = normalizeResourceDefaults({
68
+ tools: { enabledTools: ["global"] },
69
+ skills: { enabledSkills: ["global-skill"] },
70
+ modelProfiles: [],
71
+ });
72
+ let profiles = setExactModelProfile(defaults, "provider", "model/id", "tools", ["read"]);
73
+ profiles = setExactModelProfile({ ...defaults, modelProfiles: profiles }, "provider", "model/id", "skills", []);
74
+ assert.deepEqual(profiles[0], {
75
+ provider: "provider",
76
+ modelId: "model/id",
77
+ tools: { enabledTools: ["read"] },
78
+ skills: { enabledSkills: [] },
79
+ });
80
+ profiles = setExactModelProfile({ ...defaults, modelProfiles: profiles }, "provider", "model/id", "tools", null);
81
+ assert.equal(profiles.length, 1, "independent skill selection should retain the profile");
82
+ profiles = setExactModelProfile({ ...defaults, modelProfiles: profiles }, "provider", "model/id", "skills", null);
83
+ assert.deepEqual(profiles, [], "both inherited resources should remove the profile");
84
+
85
+ assert.deepEqual(branchResourceDirective({ enabledTools: ["read"] }, "tools"), { pinned: true, names: ["read"], legacyDisabledNames: null });
86
+ assert.deepEqual(branchResourceDirective({ disabledSkills: ["a"] }, "skills"), { pinned: true, names: null, legacyDisabledNames: ["a"] });
87
+ assert.deepEqual(branchResourceDirective({ version: 2, mode: "inherit" }, "tools"), { pinned: false, names: null, legacyDisabledNames: null });
88
+ assert.deepEqual(preserveUnavailableResourceNames(["read", "missing"], ["read", "bash"], ["bash"]), ["bash", "missing"]);
89
+
90
+ const root = await mkdtemp(path.join(tmpdir(), "pi-resource-settings-"));
91
+ try {
92
+ const file = path.join(root, "settings.json");
93
+ await writeFile(file, `${JSON.stringify({ version: 7, retained: { ok: true }, resourceDefaults: { tools: { enabledTools: ["read"] } } })}\n`);
94
+ const read = await readWebuiSettings(file);
95
+ assert.equal(read.version, 8, "legacy settings should normalize to v8 in memory");
96
+ assert.equal(JSON.parse(await readFile(file, "utf8")).version, 7, "reading should not eagerly rewrite legacy settings");
97
+ await writeWebuiSettings({ resourceDefaults: { skills: { enabledSkills: [] } } }, file);
98
+ const persisted = JSON.parse(await readFile(file, "utf8"));
99
+ assert.equal(persisted.version, 8, "the next normal write should persist v8");
100
+ assert.deepEqual(persisted.retained, { ok: true }, "migration writes should preserve unrelated fields");
101
+ assert.deepEqual(persisted.resourceDefaults.tools.enabledTools, ["read"]);
102
+
103
+ await writeFile(file, `${JSON.stringify({ version: 9, resourceDefaults: future.resourceDefaults })}\n`);
104
+ await writeWebuiSettings({ remoteAuthEnabled: true }, file);
105
+ const futurePersisted = JSON.parse(await readFile(file, "utf8"));
106
+ assert.deepEqual(futurePersisted.resourceDefaults.futurePolicy, { keep: true }, "future resource-default fields must survive writes");
107
+ assert.equal(futurePersisted.resourceDefaults.tools.futureToolField, "keep");
108
+ assert.equal(futurePersisted.resourceDefaults.modelProfiles[0].futureProfileField[0], "keep");
109
+ assert.equal(futurePersisted.resourceDefaults.modelProfiles[0].tools.futureSelectionField, true);
110
+ } finally {
111
+ await rm(root, { recursive: true, force: true });
112
+ }
113
+
114
+ console.log("resource-selection.test.mjs passed");
@@ -0,0 +1,23 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+
4
+ const source = await readFile(new URL("../index.ts", import.meta.url), "utf8");
5
+ assert.match(source, /pi\.registerCommand\("tools"/);
6
+ assert.match(source, /pi\.registerCommand\("skills"/);
7
+ assert.doesNotMatch(
8
+ source,
9
+ /const runtimeToolBaseline\s*=\s*normalizeResourceNameList\(pi\.getActiveTools\(\)\)/,
10
+ "extension action methods must not run while the extension factory is loading",
11
+ );
12
+ assert.match(source, /const runtimeTools = \(\): string\[\] => runtimeToolBaseline \?\?=/, "the tool baseline should be captured lazily after runtime binding");
13
+ assert.match(source, /ctx\.mode !== "tui"/);
14
+ assert.match(source, /pi\.on\("model_select"/);
15
+ assert.match(source, /await recompute\(ctx, event\.model\)/, "model selection should immediately recompute exact-model resources");
16
+ assert.match(source, /"Session only", "Global default", "Model default"/);
17
+ assert.match(source, /"Use inherited defaults"/);
18
+ assert.match(source, /ctx\.ui\.select\(/, "resource lists should use Pi's native selector");
19
+ assert.match(source, /preserveUnavailableResourceNames\(/);
20
+ assert.match(source, /setExactModelProfile\(/);
21
+ assert.match(source, /skill\.disableModelInvocation !== true/);
22
+
23
+ console.log("resource-tui-extension.test.mjs passed");
@@ -57,10 +57,10 @@ assert.match(css, /\.sampling-parameter-control\.unsupported:hover:not\(\.sampli
57
57
  assert.match(css, /\.sampling-parameter-control\.unsupported:focus-visible:not\(\.sampling-tooltip-dismissed\) > \.sampling-parameter-unsupported-tooltip/, "keyboard focus should reveal dismissible unsupported reasons");
58
58
  assert.match(css, /\.sampling-parameter-unsupported-tooltip\.sampling-tooltip-below/, "bounded placement should support flipping below top-edge rows");
59
59
  assert.match(css, /pointer-events: auto;/, "a visible unsupported tooltip should remain pointer-hoverable");
60
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v94"/, "native-control assets should advance the cache identity");
60
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "native-control assets should advance the cache identity");
61
61
  assert.match(serviceWorker, /"\/sampling-parameter-controls\.mjs"/, "the pure sampling module should be part of the offline app shell");
62
- assert.match(html, /styles\.css\?v=115/, "the changed stylesheet should have a new revision");
63
- assert.match(html, /app\.js\?v=132/, "the changed app module should have a new revision");
62
+ assert.match(html, /styles\.css\?v=126/, "the changed stylesheet should have a new revision");
63
+ assert.match(html, /app\.js\?v=148/, "the changed app module should have a new revision");
64
64
 
65
65
  // --- Browser state behavior -------------------------------------------------
66
66
 
@@ -27,8 +27,8 @@ assert.doesNotMatch(layout, /sectionHeightMin|sectionHeightMax|validateSectionHe
27
27
  assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLayout", "collapsedSectionIds", "hiddenSectionIds", "collapsedPanels", "panelWidths"\];/, "the browser durable layout field list should omit section heights");
28
28
  assert.match(app, /function clearRemovedSidePanelSectionHeightState\(\)[\s\S]*localStorage\.removeItem\(REMOVED_SIDE_PANEL_SECTION_HEIGHT_STORAGE_KEY\)[\s\S]*record\.field === "sidePanel" && record\.subfield === "sectionHeights"/, "startup should remove the retired cache and pending mutations");
29
29
  assert.match(app, /clearRemovedSidePanelSectionHeightState\(\);\s*restoreDurableUiLayoutPendingJournal\(\);/, "retired height state should be cleared before pending layout restoration");
30
- assert.match(html, /styles\.css\?v=115/, "removing section resize styles should advance the stylesheet revision");
31
- assert.match(html, /app\.js\?v=132/, "removing section resize behavior should advance the app revision");
32
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v94"/, "removing browser assets should advance the PWA cache identity");
30
+ assert.match(html, /styles\.css\?v=126/, "removing section resize styles should advance the stylesheet revision");
31
+ assert.match(html, /app\.js\?v=148/, "removing section resize behavior should advance the app revision");
32
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "removing browser assets should advance the PWA cache identity");
33
33
 
34
34
  console.log("side-panel-section-height-removal-static.test.mjs passed");
@@ -5,6 +5,7 @@ import {
5
5
  TRANSCRIPT_STREAM_MESSAGE_UPDATE_TYPES,
6
6
  classifyTranscriptStreamEvent,
7
7
  createStreamOutputController,
8
+ reconcileTranscriptThinkingSnapshot,
8
9
  } from "../public/stream-output-controller.mjs";
9
10
 
10
11
  function messageUpdate(type, delta = "", extra = {}) {
@@ -53,6 +54,13 @@ assert.deepEqual(classifyTranscriptStreamEvent(messageUpdate("future_delta")), {
53
54
  assert.equal(classifyTranscriptStreamEvent({ type: "agent_start" }), null);
54
55
  assert.equal(DEFAULT_STREAM_PENDING_ENTRY_LIMIT, 128);
55
56
  assert.equal(DEFAULT_STREAM_PENDING_BYTE_LIMIT, 256 * 1024);
57
+ assert.equal(
58
+ reconcileTranscriptThinkingSnapshot("first\n\nsecond\n\nthird\n\nfourth", "first\n\nsecond\n\nthird"),
59
+ "first\n\nsecond\n\nthird\n\nfourth",
60
+ "a regressive final thinking snapshot must not remove an already-rendered tail",
61
+ );
62
+ assert.equal(reconcileTranscriptThinkingSnapshot("short", "shorter complete"), "shorter complete", "a longer compatible final snapshot should win");
63
+ assert.equal(reconcileTranscriptThinkingSnapshot("draft reasoning", "provider correction"), "provider correction", "divergent provider corrections must remain authoritative");
56
64
 
57
65
  // Adjacent compatible deltas coalesce, while kind changes retain exact order.
58
66
  {
@@ -37,7 +37,7 @@ const forbiddenSinks = [
37
37
  ".focus(", "scrollIntoView", "fetch(", "api(",
38
38
  ];
39
39
 
40
- assert.match(app, /import \{ classifyTranscriptStreamEvent, createStreamOutputController \} from "\.\/stream-output-controller\.mjs";/);
40
+ assert.match(app, /import \{[^}]*classifyTranscriptStreamEvent[^}]*createStreamOutputController[^}]*\} from "\.\/stream-output-controller\.mjs";/);
41
41
  assert.match(controller, /export function classifyTranscriptStreamEvent/);
42
42
  assert.match(controller, /export function createStreamOutputController/);
43
43
  assert.match(controller, /let frameHandle = null;[\s\S]*?let pending = \[\];[\s\S]*?let pendingBytes = 0;/, "controller should retain one cancellable bounded queue");
@@ -70,7 +70,7 @@ assert.doesNotMatch(rawMessageHandler, /setRunIndicatorActivity|scheduleLiveTodo
70
70
  assert.match(rawMessageHandler, /compactOutputActive\(\) && handleCompactMessageUpdate\(event\)/, "normal and compact modes should share the isolated controller sink");
71
71
  assert.match(toolUpdate, /renderLiveToolRun\(run, \{ scroll: false \}\)/, "isolated tool updates should render in the controller frame rather than queue another tool frame");
72
72
  assert.doesNotMatch(toolUpdate, /scheduleLiveToolRunRender/, "isolated tool updates must not create a parallel render queue");
73
- assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\)\) applyTranscriptToolExecutionUpdate\(event\);/, "raw tool execution updates should use only the transcript sink");
73
+ assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\) && !isIntercomTransportToolName\(event\?\.toolName\)\) applyTranscriptToolExecutionUpdate\(event\);/, "raw non-Intercom tool execution updates should use only the transcript sink");
74
74
  assert.doesNotMatch(app.slice(app.indexOf("const streamOutputController"), app.indexOf("let assistantErrorSurfacedThisRun")), /renderWidgets|renderFooter|renderTabs|renderStatus|renderFeedbackTray|setRunIndicatorActivity|scheduleLiveTodoProgressWidgetSync|addEvent|fetch\(|api\(/, "controller integration must inject transcript-only sinks");
75
75
  const connectEvents = functionBody(app, "connectEvents");
76
76
  assert.match(connectEvents, /streamOutputController\.cancel\(\);[\s\S]*?resetCompactLiveOutput\(\);/, "reconnect and tab switches should cancel retained raw frames before resetting live output");
@@ -92,6 +92,8 @@ const scrollChatToBottom = findFunctionBody(app, "scrollChatToBottom");
92
92
  const stripTodoProgressLines = findFunctionBody(app, "stripTodoProgressLines");
93
93
  const liveTodoProgressWidgetLinesFromText = findFunctionBody(app, "liveTodoProgressWidgetLinesFromText");
94
94
  const syncStreamingThinkingFormat = findFunctionBody(app, "syncStreamingThinkingFormat");
95
+ const setStreamThinkingRawText = findFunctionBody(app, "setStreamThinkingRawText");
96
+ const syncStreamingThinkingFromUpdate = findFunctionBody(app, "syncStreamingThinkingFromUpdate");
95
97
  const renderStreamingAssistantText = findFunctionBody(app, "renderStreamingAssistantText");
96
98
  const renderStreamingMarkdown = findFunctionBody(app, "renderStreamingMarkdown");
97
99
  const setRunIndicatorActivity = findFunctionBody(app, "setRunIndicatorActivity");
@@ -133,6 +135,9 @@ assert.match(styles, /\.chat > \.message:first-of-type \{ margin-top:\s*0; \}/,
133
135
  assert.doesNotMatch(styles, /\.chat > \.message:first-of-type \{ margin-top:\s*auto; \}/, "short transcripts must not follow the moving composer edge while the user types");
134
136
  assert.match(appendOptimisticUserPrompt, /renderAllMessages\(\);[\s\S]*?scrollChatToBottom\(\{ force:\s*true \}\);/, "submitting a prompt should explicitly resume bottom-follow for the new turn");
135
137
  assert.doesNotMatch(appendOptimisticUserPrompt, /if \(autoFollowChat \|\| isChatNearBottom\(\)\)/, "a paused reader position should not leave a newly submitted turn off-screen");
138
+ assert.match(app, /import \{[^}]*reconcileTranscriptThinkingSnapshot[^}]*\} from "\.\/stream-output-controller\.mjs";/, "the browser should import the tested thinking-snapshot reconciler");
139
+ assert.match(setStreamThinkingRawText, /reconcile\s*\?\s*reconcileTranscriptThinkingSnapshot\(streamThinkingRawText, snapshot\)/, "thinking state should support prefix-safe snapshot reconciliation");
140
+ assert.match(syncStreamingThinkingFromUpdate, /update\.type === "thinking_end"[\s\S]*?setStreamThinkingRawText\(delta, \{ reconcile: true \}\)[\s\S]*?setStreamThinkingRawText\(fallback, \{ reconcile: true \}\)/, "thinking_end snapshots and fallbacks must not cut off an already-rendered compatible tail");
136
141
 
137
142
  futureInvariant("theory #1: message_update streaming hot path must not call immediate scroll/layout work", () => {
138
143
  assert.doesNotMatch(handleMessageUpdate, /scrollChatToBottom\s*\(/, "handleMessageUpdate should schedule/coalesce follow-scroll instead of calling scrollChatToBottom() directly");
@@ -72,7 +72,7 @@ const pkg = JSON.parse(pkgRaw);
72
72
 
73
73
  assert.match(app, /from "\.\/subagent-gate-visibility\.mjs"/, "the browser should load the retry-gate visibility policy");
74
74
  assert.match(app, /function subagentOverviewGroups[\s\S]*Number\(data\?\.version\) === 2[\s\S]*displayRuns: runs/, "the side panel should render canonical v2 runs without recounting gate references");
75
- assert.match(app, /const gates = visibleSubagentGates\(tab, dismissedSubagentGateKeys, now\);[\s\S]*displayRuns: ungatedSubagentRuns\(tab\)/, "the v1 fallback should retain gate-owned run filtering");
75
+ assert.match(app, /const gates = visibleSubagentGates\(tab, dismissedSubagentGateKeys, now\);[\s\S]*const displayRuns = ungatedSubagentRuns\(tab\);[\s\S]*displayRuns,/, "the v1 fallback should retain gate-owned run filtering before deriving count-neutral workflow totals");
76
76
  assert.match(app, /function renderSubagentGate\(tab, gate\)[\s\S]*subagentGateIsTerminal\(gate\)[\s\S]*Hide finished retry gate[\s\S]*dismissedSubagentGateKeys\.add\(key\)[\s\S]*renderSubagents\(\)[\s\S]*event\.detail === 0[\s\S]*focusTarget\?\.focus/, "terminal gate cards should expose an accessible hide button and preserve keyboard focus after rerendering");
77
77
  assert.match(app, /pruneDismissedSubagentGateKeys\(latestSubagents\?\.tabs, dismissedSubagentGateKeys\)/, "polling should prune stale dismissal keys");
78
78
  assert.match(css, /\.subagent-gate-actions[\s\S]*\.subagent-gate-close[\s\S]*min-width:\s*1\.45rem[\s\S]*background:\s*transparent[\s\S]*\.subagent-gate-close:hover,[\s\S]*\.subagent-gate-close:focus-visible/, "the close control should remain minimal, compact, and keyboard-visible");
@@ -125,7 +125,7 @@ try {
125
125
  await writeFile(settingsFile, `${JSON.stringify({ version: 4, unrelated: { preserve: true }, remoteAuthEnabled: true }, null, 2)}\n`, "utf8");
126
126
  await writeWebuiSettings({ subagentLaunchSlots: config }, settingsFile);
127
127
  const persisted = JSON.parse(await readFile(settingsFile, "utf8"));
128
- assert.equal(persisted.version, 7, "persisted launch-slot settings must retain the current version-7 envelope");
128
+ assert.equal(persisted.version, 8, "persisted launch-slot settings must retain the current version-8 envelope");
129
129
  assert.deepEqual(persisted.unrelated, { preserve: true }, "launch-slot saves must preserve unrelated WebUI settings");
130
130
  assert.deepEqual((await readWebuiSettings(settingsFile)).subagentLaunchSlots.projects[projectKey].roles, defaultRoles);
131
131
 
@@ -17,16 +17,18 @@ for (const state of ["queued", "running", "stale", "lost", "done", "failed", "ca
17
17
  assert.ok(app.includes(`"${state}"`), `lifecycle ${state} should be normalized`);
18
18
  assert.match(css, new RegExp(`\\.subagent-state-dot\\.${state}`), `lifecycle ${state} should have a distinct CSS state`);
19
19
  }
20
- assert.match(app, /counts\?\.totalAgents[\s\S]*counts\?\.runningAgents[\s\S]*counts\?\.staleAgents/, "canonical retained-inclusive total and running/stale breakdown should drive status");
20
+ assert.match(app, /function subagentRunAgentCounts[\s\S]*function renderSubagents\(\)[\s\S]*activeTabs\.reduce\(\(count, tab\) => count \+ Number\(tab\.agentCount \|\| 0\), 0\)[\s\S]*activeTabs\.reduce\(\(count, tab\) => count \+ Number\(tab\.runningAgents \|\| 0\), 0\)[\s\S]*activeTabs\.reduce\(\(count, tab\) => count \+ Number\(tab\.staleAgents \|\| 0\), 0\)/, "visible retained-inclusive agent totals should exclude count-neutral workflow controllers while preserving running and stale breakdowns");
21
21
  assert.match(app, /URLSearchParams\(\{ group: selection\.groupId, run: selection\.runId, agent: selection\.agentId \}\)/, "overlay should use the unified group/run/agent output query");
22
22
  assert.match(app, /URLSearchParams\(\{ group: view\.groupId, run: view\.runId, agent: view\.agentId \}\)/, "view-only tab should use the unified group/run/agent output query");
23
23
  assert.match(app, /subagentRunCanRefresh[\s\S]*subagentRunCanCancel[\s\S]*subagentRunCanDismiss/, "controls should be capability-aware");
24
24
  assert.match(app, /function subagentRunIsAttachedProjection[\s\S]*source === "explicit-attach"[\s\S]*function subagentRunCanDismiss[\s\S]*provider === "webui-registry"/, "terminal registry rows should clear while stale explicit attaches remain manually detachable");
25
25
  assert.match(app, /function finishedSubagentRunSelections[\s\S]*subagentRunIsTerminal\(run\) && subagentRunCanDismiss\(run\)/, "Auto-Clear should not immediately remove stale attached sessions");
26
26
  assert.match(app, /agent\.unavailableReason[\s\S]*Output is unavailable for this registered agent/, "output views should show truthful unavailable evidence");
27
+ assert.match(app, /const SUBAGENT_ASYNC_WIDGET_KEY = "subagent-async"[\s\S]*case "setWidget":[\s\S]*widgetKey === SUBAGENT_ASYNC_WIDGET_KEY[\s\S]*widgetLines: undefined[\s\S]*return;/, "native async-status widget updates should be discarded before reaching the generic main-output renderer");
28
+ assert.match(app, /for \(const \[key, value\] of widgets\)[\s\S]*if \(key === SUBAGENT_ASYNC_WIDGET_KEY\) continue;/, "stale cached async-status widgets should remain hidden defensively");
27
29
  assert.match(css, /\.subagent-source-badge[\s\S]*text-overflow: ellipsis[\s\S]*@media \(max-width: 720px\)/, "source badges should remain compact and responsive");
28
30
  assert.match(html, /Managed and registered Pi agent runs[\s\S]*External agents/, "help should explain managed, registered, and external groups");
29
- assert.match(html, /styles\.css\?v=115[\s\S]*app\.js\?v=132/, "browser assets should use the WS-D revisions");
30
- assert.match(worker, /pi-webui-pwa-v94/, "PWA cache identity should advance with WS-D browser assets");
31
+ assert.match(html, /styles\.css\?v=126[\s\S]*app\.js\?v=148/, "browser assets should use the current subagent-observability revisions");
32
+ assert.match(worker, /pi-webui-pwa-v112/, "PWA cache identity should advance with subagent widget suppression");
31
33
 
32
34
  console.log("subagent-observability-static.test.mjs passed");
@@ -29,7 +29,7 @@ const normalizationContext = {
29
29
  WEBUI_SUBAGENT_GATE_LIMIT: 32,
30
30
  WEBUI_SUBAGENT_GATE_ATTEMPT_LIMIT: 100,
31
31
  };
32
- vm.runInNewContext(`${normalizationSource}\nthis.normalizePayload = normalizeWebuiSubagentPayload;`, normalizationContext);
32
+ vm.runInNewContext(`${normalizationSource}\nthis.normalizePayload = normalizeWebuiSubagentPayload; this.filterStartup = filterStartupInactiveRows;`, normalizationContext);
33
33
  const normalized = normalizationContext.normalizePayload({
34
34
  version: 1,
35
35
  available: true,
@@ -60,6 +60,26 @@ const ordinary = normalizationContext.normalizePayload({
60
60
  });
61
61
  assert.equal(Object.hasOwn(ordinary.runs[0], "provisional"), false, "ordinary payload v1 rows should not gain recovery-only provisional metadata");
62
62
  assert.equal(Object.hasOwn(ordinary.runs[0], "controllable"), false, "ordinary payload v1 rows should not gain recovery-only control metadata");
63
+ const startupTab = {};
64
+ const firstStartupSnapshot = normalizationContext.filterStartup(startupTab, {
65
+ runs: [
66
+ { id: "active-before-start", status: "running" },
67
+ { id: "done-before-start", status: "done" },
68
+ ],
69
+ }, { rowsKey: "runs", stateKey: "fixtureStartup" });
70
+ assert.deepEqual(Array.from(firstStartupSnapshot.runs, (run) => run.id), ["active-before-start"], "the first helper snapshot should suppress pre-existing inactive runs");
71
+ const currentGenerationSnapshot = normalizationContext.filterStartup(startupTab, {
72
+ runs: [
73
+ { id: "done-before-start", status: "done" },
74
+ { id: "done-after-start", status: "done" },
75
+ ],
76
+ }, { rowsKey: "runs", stateKey: "fixtureStartup" });
77
+ assert.deepEqual(Array.from(currentGenerationSnapshot.runs, (run) => run.id), ["done-after-start"], "later terminal runs should remain visible while startup-suppressed identities stay hidden");
78
+ const reactivatedSnapshot = normalizationContext.filterStartup(startupTab, {
79
+ runs: [{ id: "done-before-start", status: "running" }],
80
+ }, { rowsKey: "runs", stateKey: "fixtureStartup" });
81
+ assert.deepEqual(Array.from(reactivatedSnapshot.runs, (run) => run.id), ["done-before-start"], "an active transition should release startup suppression");
82
+ assert.match(server, /filterStartupInactiveRows\(tab, payload,[\s\S]*rowsKey: "instances"[\s\S]*filterStartupInactiveRows\(tab, payload,[\s\S]*rowsKey: "runs"[\s\S]*startupSuppressedAgentRunProjectionKeys\.has\(key\)[\s\S]*!agentRunIsActive\(record\.instance\)/, "helper snapshots and startup registry records should both exclude pre-existing inactive rows");
63
83
  assert.deepEqual(JSON.parse(JSON.stringify(normalized.runs[0])), {
64
84
  id: "fleet:opaque",
65
85
  source: "recovered",
@@ -87,6 +107,8 @@ const canonicalProjectionSource = sourceBetween(
87
107
  );
88
108
  assert.match(canonicalProjectionSource, /Number\.isFinite\(run\.endedAt\) \? run\.endedAt : startedAt/, "a terminal run without endedAt should use one stable fallback timestamp");
89
109
  assert.doesNotMatch(canonicalProjectionSource, /endedAt[^\n]*Date\.now\(\)/, "terminal projection timestamps must not change on every status poll");
110
+ assert.match(canonicalProjectionSource, /open: true,[\s\S]*refresh: true,[\s\S]*cancel: status === "running" && !workflow && !recovered[\s\S]*outputRef: \{ kind: "helper"/, "recovered fleet rows should expose a read-only helper output view while lifecycle control remains blocked");
111
+ assert.match(server, /unavailable: rawAgent\.unavailable === true[\s\S]*unavailableReason: rawAgent\.unavailable === true/, "server normalization should preserve truthful recovered-output unavailability metadata");
90
112
 
91
113
  const interactionSource = sourceBetween(
92
114
  server,
@@ -0,0 +1,67 @@
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
+ import vm from "node:vm";
6
+
7
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
8
+ const [app, css, readme, technical] = await Promise.all([
9
+ readFile(join(root, "public", "app.js"), "utf8"),
10
+ readFile(join(root, "public", "styles.css"), "utf8"),
11
+ readFile(join(root, "README.md"), "utf8"),
12
+ readFile(join(root, "TECHNICAL.md"), "utf8"),
13
+ ]);
14
+
15
+ function appFunctionSource(name, nextName) {
16
+ const start = app.indexOf(`function ${name}(`);
17
+ const nextStarts = [
18
+ app.indexOf(`\nfunction ${nextName}(`, start),
19
+ app.indexOf(`\nasync function ${nextName}(`, start),
20
+ ].filter((index) => index > start);
21
+ const end = nextStarts.length ? Math.min(...nextStarts) : -1;
22
+ assert.ok(start >= 0 && end > start, `${name} should remain a standalone frontend helper`);
23
+ return app.slice(start, end);
24
+ }
25
+
26
+ const workflowControllerSource = appFunctionSource("subagentIsWorkflowController", "subagentCapabilities");
27
+ const workflowRenderSource = appFunctionSource("renderSubagentWorkflow", "renderSubagentAgent");
28
+ const renderRunSource = appFunctionSource("renderSubagentRun", "subagentGateStatusLabel");
29
+ const renderOverviewSource = appFunctionSource("renderSubagents", "refreshSubagents");
30
+ const retainedMaterializationSource = appFunctionSource("materializeRetainedSubagentTerminalViews", "subagentTerminalViewGroups");
31
+
32
+ assert.match(workflowControllerSource, /launcher === "pi-subagents"[\s\S]*function subagentRunAgents[\s\S]*function subagentRunAgentCounts/, "pi-subagents workflow controllers should be separated from model-powered child agents");
33
+ const workflowCountContext = {
34
+ subagentAgentStatus(run, agent) { return String(agent?.status || run?.status || "running").toLowerCase(); },
35
+ };
36
+ vm.runInNewContext(`${workflowControllerSource}\nthis.isWorkflowController = subagentIsWorkflowController; this.workflowAgents = subagentRunAgents; this.workflowCounts = subagentRunAgentCounts; this.runPresentations = subagentRunPresentations; this.workflowStatus = subagentWorkflowPresentationStatus;`, workflowCountContext);
37
+ const syntheticWorkflowRun = {
38
+ launcher: "pi-subagents",
39
+ status: "running",
40
+ agents: [
41
+ { id: "run:workflow", name: "workflow", status: "running" },
42
+ { id: "run:worker", name: "worker", status: "running", model: "openai-codex/gpt-5.6-sol", thinking: "high" },
43
+ ],
44
+ };
45
+ assert.equal(workflowCountContext.isWorkflowController(syntheticWorkflowRun, syntheticWorkflowRun.agents[0]), true);
46
+ assert.deepEqual(JSON.parse(JSON.stringify(workflowCountContext.workflowAgents(syntheticWorkflowRun).map((agent) => agent.name))), ["worker"]);
47
+ assert.deepEqual(JSON.parse(JSON.stringify(workflowCountContext.workflowCounts([syntheticWorkflowRun]))), { total: 1, running: 1, stale: 0 });
48
+ assert.equal(workflowCountContext.isWorkflowController(syntheticWorkflowRun, { name: "workflow", launcher: "pi-subagents", model: "provider/real-model", thinking: "high" }), false, "a real model-powered agent named workflow must remain an agent row");
49
+
50
+ const recoveredWorkflowRuns = [
51
+ { id: "fleet:23", source: "recovered", launcher: "pi-subagents", status: "done", agents: [{ id: "fleet:23:agent", name: "workflow", status: "done" }] },
52
+ { id: "fleet:24", source: "recovered", launcher: "pi-subagents", status: "running", agents: [{ id: "fleet:24:agent", name: "worker", status: "running", model: "openai-codex/gpt-5.6-sol", thinking: "high" }] },
53
+ ];
54
+ const recoveredPresentations = workflowCountContext.runPresentations(recoveredWorkflowRuns);
55
+ assert.equal(recoveredPresentations.length, 1, "adjacent recovered workflow controller and worker runs should form one presentation section");
56
+ assert.equal(recoveredPresentations[0].agents[0].run.id, "fleet:24", "nested recovered workers should retain their original run for output selection");
57
+ assert.equal(workflowCountContext.workflowStatus(recoveredPresentations[0].run, recoveredPresentations[0].agents), "running", "a running recovered worker should keep its workflow section running");
58
+
59
+ assert.match(workflowRenderSource, /const status = subagentWorkflowPresentationStatus\(run, agents\);[\s\S]*make\("details", `subagent-workflow[\s\S]*details\.open = !collapsedSubagentWorkflowRunKeys\.has\(key\)[\s\S]*make\("summary", "subagent-workflow-header"\)[\s\S]*renderSubagentAgent\(tab, entry\.run, entry\.agent\)/, "workflow controllers should render as native disclosures using the aggregate presentation lifecycle while preserving each child run");
60
+ assert.match(renderRunSource, /subagentWorkflowController\(run\)[\s\S]*subagentRunAgents\(run\)[\s\S]*renderSubagentWorkflow\(tab, run, controller, presentedAgents\)/, "workflow runs should route through the hierarchical renderer");
61
+ assert.match(renderOverviewSource, /activeTabs\.reduce\(\(count, tab\) => count \+ Number\(tab\.agentCount \|\| 0\), 0\)[\s\S]*activeTabs\.reduce\(\(count, tab\) => count \+ Number\(tab\.runningAgents \|\| 0\), 0\)/, "overview totals should use count-neutral workflow projections");
62
+ assert.match(retainedMaterializationSource, /for \(const agent of subagentRunAgents\(run\)\)/, "retained terminal views should materialize child agents without creating a view for the workflow controller");
63
+ assert.match(css, /\.subagent-workflow \{[\s\S]*\.subagent-workflow-header \{[\s\S]*list-style: none;[\s\S]*\.subagent-workflow:not\(\[open\]\)[\s\S]*\.subagent-workflow-agents \{[\s\S]*border-left:/, "workflow disclosures should have a distinct header and nested child-agent rail");
64
+ assert.match(readme, /workflow[^\n]*collapsible/i, "the user guide should explain collapsible workflow groups");
65
+ assert.match(technical, /workflow controller[^\n]*count/i, "the technical reference should explain count-neutral workflow controllers");
66
+
67
+ console.log("subagent workflow section static tests passed");