@sanqianx/project-knowledge 5.0.33 → 5.0.35

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 (52) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/_site/_test/chat-claudecodeui-match-test.js +22 -3
  4. package/_site/_test/fresh-product-data-test.js +1 -1
  5. package/_site/_test/glm-ui-refresh-review-test.js +1 -1
  6. package/_site/_test/harness-isolation-test.js +1 -1
  7. package/_site/_test/home-overview-test.js +64 -0
  8. package/_site/_test/index-error-display-contract-test.js +23 -1
  9. package/_site/_test/knowledge-engine-client-test.js +1 -1
  10. package/_site/_test/memory-groups-ui-test.js +149 -0
  11. package/_site/_test/module-supervisor-backoff-reset-test.js +64 -0
  12. package/_site/_test/module-terminal-restart-test.js +1 -1
  13. package/_site/_test/packaged-ui-smoke-test.js +40 -2
  14. package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +94 -33
  15. package/_site/_test/parallel-knowledge-client-error-code-test.js +11 -1
  16. package/_site/_test/parallel-logging-acceptance-log008-test.js +23 -11
  17. package/_site/_test/parallel-memory-candidate-test.js +134 -84
  18. package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +100 -38
  19. package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +92 -32
  20. package/_site/_test/parallel-memory-home-review-test.js +148 -0
  21. package/_site/_test/parallel-memory-manual-test.js +140 -34
  22. package/_site/_test/parallel-memory-scope-test.js +91 -23
  23. package/_site/_test/parallel-memory-source-test.js +54 -25
  24. package/_site/_test/parallel-memory-sync-test.js +102 -75
  25. package/_site/_test/parallel-nav-failure-test.js +36 -16
  26. package/_site/_test/parallel-nav-home-issues-test.js +159 -0
  27. package/_site/_test/parallel-nav-offline-test.js +37 -9
  28. package/_site/_test/parallel-nav-operability-test.js +12 -1
  29. package/_site/_test/parallel-nav-switch-test.js +65 -19
  30. package/_site/_test/parallel-nav-theme-test.js +52 -7
  31. package/_site/_test/parallel-nav-viewport-test.js +13 -4
  32. package/_site/_test/product-diagnostics-ui-test.js +15 -3
  33. package/_site/_test/product-empty-state-test.js +81 -15
  34. package/_site/_test/product-import-ui-test.js +35 -9
  35. package/_site/_test/product-navigation-test.js +78 -17
  36. package/_site/_test/product-progress-status-test.js +21 -5
  37. package/_site/_test/project-module-partial-recovery-test.js +22 -7
  38. package/_site/_test/project-unbind-late-read-ui-test.js +45 -14
  39. package/_site/_test/workspace-ui-contract-test.js +38 -5
  40. package/_site/lib/engine-connection.js +1 -1
  41. package/_site/lib/engine-knowledge-client.js +1 -1
  42. package/_site/lib/module-bridge.js +16 -6
  43. package/_site/lib/server-app.js +23 -0
  44. package/_site/scripts/refresh-runtime-manifest.js +108 -0
  45. package/module-runtime-manifest.json +17 -15
  46. package/package.json +2 -2
  47. package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
  48. package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
  49. package/plugins/project-knowledge/.mcp.json +1 -1
  50. package/ui/index.html +14 -11
  51. package/ui/product.css +42 -0
  52. package/ui/product.js +861 -212
@@ -1,6 +1,17 @@
1
1
  'use strict';
2
2
  // NAV-004 — 失败保留旧数据。
3
3
  //
4
+ // 迁移说明(五页简化 UI):
5
+ // - 首页不再罗列项目:登记读取(/api/projects/projection)的 UI 投影改为
6
+ // 顶栏 #projectSelect 的选项(renderProjectOptions 与旧首页列表读同一份
7
+ // state.projects),「已登记项目列表」的断言全部改查 #projectSelect。
8
+ // - 旧 `#homeContent [data-select-project]` 行已删除:listedProjects() 改为
9
+ // 枚举 #projectSelect 选项文本。
10
+ // - 「首页保留旧数据」等价断言:失败后首页不得翻回「正在读取项目登记…」或
11
+ // 「项目登记读取失败」空态,仍显示已载入的总览面板(需要处理/待确认/记忆组合)。
12
+ // - 失败可见性(toast「部分状态暂未刷新,已有内容已保留。」)与恢复后按新
13
+ // 快照更新的断言不变:产品文案未变。
14
+ //
4
15
  // When the registry read fails the shell must show the failure, must keep the
5
16
  // project list it already has, and must pick up the new snapshot once the
6
17
  // registry answers again.
@@ -33,20 +44,27 @@ async function main() {
33
44
  await harness.requestRegistryRefresh();
34
45
  await harness.waitFor(
35
46
  async () => {
36
- const text = await harness.run("document.getElementById('homeContent').textContent");
47
+ const text = await harness.run("document.getElementById('projectSelect').textContent");
37
48
  return text.includes('NAV004 甲') && text.includes('NAV004 乙');
38
49
  },
39
50
  'both imported projects are listed',
40
51
  20000,
41
52
  );
42
53
 
54
+ // The registry projection surface of the five-page shell is the top-bar
55
+ // project selector: it renders the same state.projects the old home list
56
+ // rendered, and a failed read never reaches renderProjectOptions.
43
57
  const listedProjects = () => harness.run(`(() => {
44
- const rows = [...document.querySelectorAll('#homeContent [data-select-project]')];
45
- return rows.map(button => {
46
- const name = button.parentElement.querySelector('b');
47
- return name ? name.textContent.trim() : '';
48
- });
58
+ const select = document.getElementById('projectSelect');
59
+ return [...select.options].filter(option => option.value).map(option => option.textContent.trim());
49
60
  })()`);
61
+ const homeKeepsLoadedContent = async () => {
62
+ const text = await harness.run("document.getElementById('homeContent').textContent");
63
+ assert.equal(text.includes('正在读取项目登记'), false, `the home page is not flipped back into the loading state: ${text}`);
64
+ assert.equal(text.includes('项目登记读取失败'), false, `the home page is not flipped into the read-failure state: ${text}`);
65
+ assert.ok(text.includes('记忆组合'), `the home page keeps its loaded overview panels: ${text}`);
66
+ return text;
67
+ };
50
68
  const failedReads = () => harness.productProxy.requests.filter(entry => entry.path.startsWith(PROJECTION) && entry.status === 503).length;
51
69
 
52
70
  // The registry read now fails at the HTTP level.
@@ -68,9 +86,7 @@ async function main() {
68
86
  // NAV-004 expected 2: the list that was already there is not cleared.
69
87
  const listed = (await listedProjects()).sort();
70
88
  assert.deepEqual(listed, ['NAV004 乙', 'NAV004 甲'], 'the project list still holds the projects it had before the failure');
71
- const homeText = await harness.run("document.getElementById('homeContent').textContent");
72
- assert.ok(homeText.includes('NAV004 甲'), 'the failed read keeps the first project');
73
- assert.ok(homeText.includes('NAV004 乙'), 'the failed read keeps the second project');
89
+ await homeKeepsLoadedContent();
74
90
  const selectorText = await harness.run("document.getElementById('projectSelect').textContent");
75
91
  assert.ok(selectorText.includes('NAV004 甲') && selectorText.includes('NAV004 乙'), 'the failed read keeps the project selector entries');
76
92
 
@@ -80,10 +96,11 @@ async function main() {
80
96
  const failuresBeforeSecond = failedReads();
81
97
  await harness.refreshRegistryAndWait();
82
98
  await harness.waitFor(async () => failedReads() > failuresBeforeSecond, 'the second registry read really failed too', 20000);
83
- const duringFailure = await harness.run("document.getElementById('homeContent').textContent");
99
+ const duringFailure = await harness.run("document.getElementById('projectSelect').textContent");
84
100
  assert.ok(duringFailure.includes('NAV004 甲') && duringFailure.includes('NAV004 乙'), 'the old projects survive the repeated failure');
85
101
  assert.equal(duringFailure.includes('NAV004 丙'), false, 'a project that was never read is not shown while the registry is broken');
86
- assert.deepEqual((await listedProjects()).sort(), ['NAV004 乙', 'NAV004 甲'], 'the project rows are exactly the projects read before the failure');
102
+ assert.deepEqual((await listedProjects()).sort(), ['NAV004 乙', 'NAV004 甲'], 'the project entries are exactly the projects read before the failure');
103
+ await homeKeepsLoadedContent();
87
104
  await harness.browser.screenshot(path.join(harness.evidence, 'nav004-old-data-kept.png'));
88
105
 
89
106
  // NAV-004 expected 3: after the registry answers again, the list is
@@ -91,11 +108,11 @@ async function main() {
91
108
  harness.productProxy.clearFaults();
92
109
  await harness.refreshRegistryAndWait();
93
110
  await harness.waitFor(
94
- () => harness.run("document.getElementById('homeContent').textContent.includes('NAV004 丙')"),
111
+ () => harness.run("document.getElementById('projectSelect').textContent.includes('NAV004 丙')"),
95
112
  'the recovered read shows the new project',
96
113
  20000,
97
114
  );
98
- const recovered = await harness.run("document.getElementById('homeContent').textContent");
115
+ const recovered = await harness.run("document.getElementById('projectSelect').textContent");
99
116
  assert.ok(recovered.includes('NAV004 甲') && recovered.includes('NAV004 乙'), 'the recovered read keeps the earlier projects');
100
117
  assert.deepEqual((await listedProjects()).sort(), ['NAV004 丙', 'NAV004 乙', 'NAV004 甲'], 'the recovered list is the new snapshot');
101
118
  await harness.browser.screenshot(path.join(harness.evidence, 'nav004-recovered.png'));
@@ -104,9 +121,12 @@ async function main() {
104
121
  const failed = harness.productProxy.requests.filter(entry => entry.path.startsWith(PROJECTION) && entry.status === 503);
105
122
  assert.ok(failed.length >= 2, `the registry read failed at the HTTP level ${failed.length} times`);
106
123
  // The failure notice is transient: the recovery does not leave a permanent
107
- // error behind in the shell.
108
- await harness.wait(4500);
109
- assert.equal(await harness.run("document.getElementById('toast').hidden"), true, 'the failure message is not left behind after the recovery');
124
+ // error behind in the shell (the notice hides on its own timer).
125
+ await harness.waitFor(
126
+ () => harness.run("document.getElementById('toast').hidden === true"),
127
+ 'the failure message is not left behind after the recovery',
128
+ 10000,
129
+ );
110
130
 
111
131
  assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
112
132
 
@@ -0,0 +1,159 @@
1
+ 'use strict';
2
+ // NAV-007 — 首页待处理直达处理。
3
+ //
4
+ // 迁移说明(五页简化 UI):
5
+ // - 首页不再罗列项目:导入成功的可见面改为顶栏 #projectSelect 的选项
6
+ // (与旧首页列表读同一份 state.projects)。
7
+ // - 需要处理面板改为服务端 /api/engine/overview 的 needsPreview 投影;
8
+ // 行级「去处理」入口(data-open-run)移植到 needRow() 的 run 行上,
9
+ // 断言选择器不变。
10
+ // - 活动记录视图新增过滤栏;默认「全部」即包含失败运行,展开行的
11
+ // .error 与 [data-retry-run] 结构不变。
12
+ //
13
+ // The home「需要处理」panel names a failed maintenance run, so it must be an
14
+ // entry into handling, not a read-only preview: one real pointer click on the
15
+ // issue row must land on THAT exact run in the activity view, already
16
+ // expanded, with its failure details loaded and the retry control within
17
+ // reach. The old shell showed the failure on the home page and offered only a
18
+ // generic "查看运行详情" jump, leaving the user to find the record again in
19
+ // the activity list — view-only where handling was expected.
20
+ //
21
+ // The regression drives the real product UI in a real browser against an
22
+ // isolated instance (own port, own data dir, own knowledge dir, own Bridge
23
+ // journal, own browser profile). The failed run is real engine state, written
24
+ // into the real vendored engine's store through its own API; the shell reads
25
+ // it through the same snapshot the user's browser would. Every pointer action
26
+ // is a CDP Input.dispatchMouseEvent on the real coordinates of the real
27
+ // control, and the page itself records that the click it received carried
28
+ // isTrusted === true.
29
+ //
30
+ // Screenshots are written to PK_TEST_EVIDENCE_DIR when the batch sets it, so
31
+ // this tracked file stays free of machine-specific paths.
32
+
33
+ const path = require('node:path');
34
+ const assert = require('node:assert/strict');
35
+
36
+ const { startHarness, makeRepo } = require('./helpers/parallel-nav-shell');
37
+
38
+ const EVIDENCE = process.env.PK_TEST_EVIDENCE_DIR ? path.resolve(process.env.PK_TEST_EVIDENCE_DIR) : null;
39
+
40
+ const FAILURE_MESSAGE = '注入的额度故障:后台维护模型额度不足';
41
+
42
+ /** Record every click the page really receives on the home issue entry. */
43
+ async function installHomeClickRecorder(harness) {
44
+ await harness.run(`(() => {
45
+ window.__homeIssueClicks = [];
46
+ if (!window.__homeIssueHooked) {
47
+ window.__homeIssueHooked = true;
48
+ document.addEventListener('click', event => {
49
+ const button = event.target.closest ? event.target.closest('[data-open-run]') : null;
50
+ if (button) window.__homeIssueClicks.push({
51
+ trusted: event.isTrusted === true,
52
+ runId: button.getAttribute('data-open-run'),
53
+ label: (button.textContent || '').trim(),
54
+ });
55
+ }, true);
56
+ }
57
+ return true;
58
+ })()`);
59
+ }
60
+
61
+ async function main() {
62
+ const harness = await startHarness({ tag: 'nav007', evidenceDir: EVIDENCE || undefined });
63
+ try {
64
+ // A real project, imported through the real product API. The five-page
65
+ // shell surfaces the registry in the top-bar project selector.
66
+ const repo = makeRepo(harness.fixture, 'nav007-a');
67
+ const project = await harness.importProject(repo, 'NAV007 甲');
68
+ await harness.requestRegistryRefresh();
69
+ await harness.waitFor(
70
+ () => harness.run("document.getElementById('projectSelect').textContent.includes('NAV007 甲')"),
71
+ 'the imported project is listed',
72
+ 20000,
73
+ );
74
+
75
+ // Real engine state: one failed maintenance run for that project, with a
76
+ // quota-style error the way a real failed phase leaves it.
77
+ const created = harness.engine.store.addRun({ projectId: project.projectId, commitSha: repo.headCommit, trigger: 'manual' });
78
+ harness.engine.store.updateRun(created.runId, {
79
+ state: 'failed',
80
+ phase: 'analyze',
81
+ error: { code: 'MODEL_QUOTA_EXHAUSTED', message: FAILURE_MESSAGE },
82
+ finishedAt: new Date().toISOString(),
83
+ });
84
+
85
+ await installHomeClickRecorder(harness);
86
+
87
+ // NAV-007 expected 1: the home panel not only names the failure, it
88
+ // exposes a per-item handling entry bound to that exact run.
89
+ await harness.requestRegistryRefresh();
90
+ await harness.waitFor(
91
+ () => harness.run(`(() => {
92
+ const button = document.querySelector('#homeContent [data-open-run]');
93
+ if (!button) return false;
94
+ const panel = button.closest('section.panel');
95
+ const row = button.closest('.row');
96
+ return panel && panel.querySelector('h2').textContent.includes('需要处理')
97
+ && row && row.textContent.includes(${JSON.stringify(FAILURE_MESSAGE)})
98
+ && button.getAttribute('data-run-project') === ${JSON.stringify(project.projectId)};
99
+ })()`),
100
+ 'the home 需要处理 panel offers a handling entry for the exact failed run',
101
+ 20000,
102
+ );
103
+ await harness.browser.screenshot(path.join(harness.evidence, 'nav007-home-issue-entry.png'));
104
+
105
+ // NAV-007 expected 2: one trusted pointer click lands on THAT run in the
106
+ // activity view — expanded, details loaded, retry reachable.
107
+ await harness.nativeClick('#homeContent [data-open-run]');
108
+ const clicks = await harness.run('window.__homeIssueClicks || []');
109
+ assert.ok(clicks.length >= 1, 'the page really received the home issue click');
110
+ const click = clicks[clicks.length - 1];
111
+ assert.equal(click.trusted, true, `the click the page received is a trusted browser event: ${JSON.stringify(click)}`);
112
+ assert.equal(click.runId, created.runId, `the click is bound to the failed run: ${JSON.stringify(click)}`);
113
+
114
+ await harness.waitFor(
115
+ () => harness.run(`document.getElementById('view-activity').classList.contains('active')`),
116
+ 'the activity view is open',
117
+ );
118
+ const openRun = `(() => {
119
+ const row = document.querySelector(${JSON.stringify(`details.run[data-run-id="${created.runId}"][open]`)});
120
+ if (!row) return null;
121
+ return {
122
+ open: true,
123
+ error: (row.querySelector('.error') || {}).textContent || '',
124
+ retryRunId: row.querySelector('[data-retry-run]') ? row.querySelector('[data-retry-run]').getAttribute('data-retry-run') : '',
125
+ };
126
+ })()`;
127
+ const landed = await harness.waitFor(
128
+ () => harness.run(openRun),
129
+ 'the exact failed run is expanded with its retry control',
130
+ 20000,
131
+ );
132
+ assert.ok(landed.error.includes(FAILURE_MESSAGE), `the expanded run shows the real failure detail: ${JSON.stringify(landed)}`);
133
+ assert.equal(landed.retryRunId, created.runId, `the retry control belongs to the exact failed run: ${JSON.stringify(landed)}`);
134
+ await harness.browser.screenshot(path.join(harness.evidence, 'nav007-activity-run-opened.png'));
135
+
136
+ // NAV-007 expected 2 (continued): the flow repeats from a warmed shell —
137
+ // the already-loaded list must not swallow the second expansion.
138
+ await harness.nativeClick('nav [data-view="home"]');
139
+ await harness.waitFor(
140
+ () => harness.run("document.getElementById('view-home').classList.contains('active') && !!document.querySelector('#homeContent [data-open-run]')"),
141
+ 'the home view is back with the handling entry',
142
+ 20000,
143
+ );
144
+ await harness.nativeClick('#homeContent [data-open-run]');
145
+ await harness.waitFor(
146
+ () => harness.run(`!!document.querySelector(${JSON.stringify(`details.run[data-run-id="${created.runId}"][open]`)})`),
147
+ 'the second click opens the same run again',
148
+ 20000,
149
+ );
150
+
151
+ assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
152
+
153
+ console.log('parallel-nav-home-issues-test PASS (the home 需要处理 entry opens the exact failed run, expanded, with retry reachable)');
154
+ } finally {
155
+ await harness.cleanup();
156
+ }
157
+ }
158
+
159
+ main().catch(error => { console.error(error.stack || error.message); process.exitCode = 1; });
@@ -1,6 +1,18 @@
1
1
  'use strict';
2
2
  // NAV-008 — 断网恢复。
3
3
  //
4
+ // 迁移说明(五页简化 UI):
5
+ // - 运行记录(commit 短 SHA)不再显示在首页:改显示在活动记录页
6
+ // #activityUpdates(updates tab 的 .run 摘要「项目名 · 短SHA」),
7
+ // 「快照恢复后新运行出现在页面上」的断言全部改查 #activityUpdates。
8
+ // - 离线时「内容不伪装为实时」的等价断言:活动页 updates 列表被
9
+ // 「知识引擎离线。记录仍保留在本机…」替代(旧首页横幅文案
10
+ // 「知识引擎暂时不可用」现位于长期记忆页 #memoryContent,语义相同:
11
+ // 未读到的记录不显示为在线数据)。
12
+ // - #activityConnection 连接标签(已连接实时更新/连接中断)语义与文案
13
+ // 不变;WebSocket/live 通道、#api/engine/snapshot 读取证据均不变。
14
+ // - reload 后立即点导航有已知 commit-gap 竞态:openView 加 3 次重试。
15
+ //
4
16
  // When the browser loses the network the shell must close the old stream, and
5
17
  // when the network comes back it must restore the snapshot and open a new
6
18
  // stream — exactly one subscription per stream, and no content that pretends
@@ -78,7 +90,19 @@ const sentMessages = harness => harness.run('window.__sent || []');
78
90
  const closeEvents = harness => harness.run('window.__closed || []');
79
91
  const liveStats = harness => harness.run('window.KnowledgeLive.stats()');
80
92
  const connectionLabel = harness => harness.run("document.getElementById('activityConnection').textContent");
81
- const homeText = harness => harness.run("document.getElementById('homeContent').textContent");
93
+ // The five-page shell shows the run records on the activity page (updates
94
+ // tab); the home page no longer lists knowledge updates.
95
+ const activityText = harness => harness.run("document.getElementById('activityUpdates').textContent");
96
+
97
+ /** Open a navigation view; the click after a reload hits a known commit-gap race, so retry. */
98
+ async function openView(harness, view) {
99
+ for (let attempt = 0; attempt < 3; attempt += 1) {
100
+ await harness.run(`document.querySelector('nav [data-view=${JSON.stringify(view)}]').click()`);
101
+ if (await harness.run(`document.getElementById('view-${view}').classList.contains('active')`)) return;
102
+ await harness.wait(200);
103
+ }
104
+ throw new Error(`the ${view} view did not open`);
105
+ }
82
106
 
83
107
  /** The subscriptions that are still live on one socket generation. */
84
108
  function activeSubscriptions(messages, generation) {
@@ -118,8 +142,9 @@ async function main() {
118
142
  await harness.browser.send('Page.addScriptToEvaluateOnNewDocument', { source: SOCKET_HOOK });
119
143
  await harness.browser.send('Page.reload', { ignoreCache: true });
120
144
  await harness.waitFor(() => harness.run("document.readyState === 'complete'"), 'the reloaded page');
145
+ await openView(harness, 'activity');
121
146
  await harness.waitFor(
122
- async () => (await homeText(harness)).includes(shortFirst),
147
+ async () => (await activityText(harness)).includes(shortFirst),
123
148
  'the reloaded page shows the run of the project',
124
149
  20000,
125
150
  );
@@ -188,12 +213,15 @@ async function main() {
188
213
 
189
214
  // NAV-008 expected 3: the content does not pretend to be live. The shell
190
215
  // says the connection is broken, and it does not show the update list as
191
- // if it were live information.
216
+ // if it were live information. The updates list is replaced by the
217
+ // offline notice (the legacy home banner「知识引擎暂时不可用」now lives
218
+ // on the memory page with the same semantics).
192
219
  const offlineLabel = await connectionLabel(harness);
193
220
  assert.equal(offlineLabel.includes('已连接实时更新'), false, `the shell does not claim a live connection while it is offline: ${offlineLabel}`);
194
221
  assert.ok(offlineLabel.includes('连接中断'), `the shell reports the broken connection: ${offlineLabel}`);
195
- const offlineHome = await homeText(harness);
196
- assert.ok(offlineHome.includes('知识引擎暂时不可用'), `the home does not show stale updates as live information: ${offlineHome}`);
222
+ const offlineActivity = await activityText(harness);
223
+ assert.ok(offlineActivity.includes('知识引擎离线'), `the updates page does not show stale records as live information: ${offlineActivity}`);
224
+ assert.equal(offlineActivity.includes(shortFirst), false, `the stale run rows are not rendered as live data while offline: ${offlineActivity}`);
197
225
  await harness.browser.screenshot(path.join(harness.evidence, 'nav008-offline.png'));
198
226
 
199
227
  // No read of the snapshot reached the product while the browser was
@@ -252,13 +280,13 @@ async function main() {
252
280
  const lastSnapshot = snapshotReads[snapshotReads.length - 1];
253
281
  assert.equal(lastSnapshot.status, 200, `the last snapshot read really succeeded: ${JSON.stringify(lastSnapshot)}`);
254
282
  await harness.waitFor(
255
- async () => (await homeText(harness)).includes(shortSecond),
283
+ async () => (await activityText(harness)).includes(shortSecond),
256
284
  'the run that appeared while the browser was offline is on the page now',
257
285
  20000,
258
286
  );
259
- const recoveredHome = await homeText(harness);
260
- assert.ok(recoveredHome.includes(shortFirst), 'the run of before the outage is still on the page');
261
- assert.equal(recoveredHome.includes('知识引擎暂时不可用'), false, 'the page shows the real records again');
287
+ const recoveredActivity = await activityText(harness);
288
+ assert.ok(recoveredActivity.includes(shortFirst), 'the run of before the outage is still on the page');
289
+ assert.equal(recoveredActivity.includes('知识引擎离线'), false, 'the page shows the real records again');
262
290
  await harness.browser.screenshot(path.join(harness.evidence, 'nav008-recovered.png'));
263
291
 
264
292
  assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
@@ -1,6 +1,17 @@
1
1
  'use strict';
2
2
  // NAV-006 — 可操作性。
3
3
  //
4
+ // 迁移说明(五页简化 UI):
5
+ // - 「项目已登记」等待改查顶栏 #projectSelect 选项含项目名(首页不再
6
+ // 罗列项目,同一 registry projection)。
7
+ // - 导航按钮仍为 nav [data-view](五页 home/memory/projects/search/
8
+ // activity),指针/键盘可达性与命中测试断言不变。
9
+ // - 键盘 Tab 遍历在新 DOM 上进行:侧栏(品牌版本、五页导航、系统状态)
10
+ // → 顶栏(#projectSelect、#themeToggle)→ 当前视图控件,停止点数量
11
+ // 与焦点环(:focus-visible 2px 实线描边,CSS 未变)断言保持等价。
12
+ // - 表单可达性用例不变:项目页 #createDomain → #domainDialog
13
+ // input[name="name"](元素仍存在),Esc 关闭对话框。
14
+ //
4
15
  // The shell must be operable by a real pointer and by a real keyboard: a
5
16
  // native pointer click must reach the control, the focus must be visible, and
6
17
  // nothing transparent may intercept the click.
@@ -113,7 +124,7 @@ async function main() {
113
124
  await harness.importProject(repo, 'NAV006 甲');
114
125
  await harness.requestRegistryRefresh();
115
126
  await harness.waitFor(
116
- () => harness.run("document.getElementById('homeContent').textContent.includes('NAV006 甲')"),
127
+ () => harness.run("[...document.getElementById('projectSelect').options].some(option => option.textContent === 'NAV006 甲')"),
117
128
  'the imported project is listed',
118
129
  20000,
119
130
  );
@@ -1,6 +1,23 @@
1
1
  'use strict';
2
2
  // NAV-005 — 项目快速切换。
3
3
  //
4
+ // 迁移说明(五页简化 UI):
5
+ // - 项目切换入口:旧首页 `[data-select-project]` 行已删除,改为顶栏
6
+ // #projectSelect(设值 + change 事件,走产品自身 on('projectSelect',
7
+ // 'change') → selectProject 同一路径);「当前项目」仍查
8
+ // #projectSelect.value。
9
+ // - 运行记录表面:旧首页运行列表移到活动记录页 #activityUpdates
10
+ // (「项目名 · 短SHA」),「当前项目显示自己的运行/迟到的旧项目答案
11
+ // 不得覆盖当前项目」断言全部改查 #activityUpdates。
12
+ // - 工作台帧的打开:work 导航已移除,改为 #openSystem 系统抽屉 →
13
+ // #configureProviders(initializeFrame('terminal'),隐藏 #workFrame 仍
14
+ // 为 Workbench 服务挂载点),kb:ready 后 frameContext 照旧投递
15
+ // kb:select-project。
16
+ // - 帧映射断言:五页 shell 对 terminal 帧投递的 project 载荷改为当前
17
+ // 项目的 productId 本身(旧版投递 modules.terminal.projectId 模块侧
18
+ // 登记 id);「模块拿到的一定是当前项目、绝不出现从未当选的项目」
19
+ // 的业务断言按新映射等价保持(requestId 的 epoch:terminal 格式不变)。
20
+ //
4
21
  // Switching projects quickly must show one project at a time, a late answer
5
22
  // must not paint another project over the current one, and the project that
6
23
  // reaches the embedded module must be the current one.
@@ -92,6 +109,32 @@ const FETCH_HOOK = `(() => {
92
109
  /** The reads of the given project the page really made. */
93
110
  const projectReads = (harness, projectId, skip = 0) => harness.run(`(window.__fetches || []).filter(entry => entry.url.includes('/api/engine/snapshot') && entry.url.includes(${JSON.stringify(`projectId=${projectId}`)})).slice(${skip})`);
94
111
 
112
+ /** The run-record surface of the five-page shell: the activity updates list. */
113
+ const activityText = harness => harness.run("document.getElementById('activityUpdates').textContent");
114
+
115
+ /** Open a navigation view; retry to survive the known commit-gap click race. */
116
+ async function openView(harness, view) {
117
+ for (let attempt = 0; attempt < 3; attempt += 1) {
118
+ await harness.run(`document.querySelector('nav [data-view=${JSON.stringify(view)}]').click()`);
119
+ if (await harness.run(`document.getElementById('view-${view}').classList.contains('active')`)) return;
120
+ await harness.wait(200);
121
+ }
122
+ throw new Error(`the ${view} view did not open`);
123
+ }
124
+
125
+ /**
126
+ * Switch the current project through the top-bar selector — the five-page
127
+ * shell's project switcher. The change event drives the shell's own
128
+ * on('projectSelect', 'change') listener, i.e. the same selectProject path a
129
+ * real user's selection takes.
130
+ */
131
+ const switchProject = (harness, projectId) => harness.run(`(() => {
132
+ const select = document.getElementById('projectSelect');
133
+ select.value = ${JSON.stringify(projectId)};
134
+ select.dispatchEvent(new Event('change'));
135
+ return select.value;
136
+ })()`);
137
+
95
138
  async function main() {
96
139
  const harness = await startHarness({ tag: 'nav005', evidenceDir: EVIDENCE || undefined });
97
140
  try {
@@ -110,18 +153,20 @@ async function main() {
110
153
  const shortB = repoB.headCommit.slice(0, 8);
111
154
 
112
155
  await harness.requestRegistryRefresh();
156
+ await openView(harness, 'activity');
113
157
  await harness.waitFor(
114
- () => harness.run(`document.getElementById('homeContent').textContent.includes(${JSON.stringify(shortA)})`),
158
+ () => harness.run(`document.getElementById('activityUpdates').textContent.includes(${JSON.stringify(shortA)})`),
115
159
  'the current project shows its own run',
116
160
  20000,
117
161
  );
118
162
 
119
- const homeText = () => harness.run("document.getElementById('homeContent').textContent");
120
163
  const currentProject = () => harness.run("document.getElementById('projectSelect').value");
121
164
 
122
- // The terminal frame is opened once so the project mapping the shell
123
- // really posts is observable.
124
- await harness.run("document.querySelector('[data-view=\"work\"]').click()");
165
+ // The workbench service mount is opened once so the project mapping the
166
+ // shell really posts is observable. The five-page shell keeps the
167
+ // workbench frame hidden; provider management is its remaining entry.
168
+ await harness.nativeClick('#openSystem');
169
+ await harness.nativeClick('#configureProviders');
125
170
  await harness.waitFor(
126
171
  async () => {
127
172
  const messages = await harness.frameMessages('workFrame');
@@ -130,8 +175,6 @@ async function main() {
130
175
  'the terminal frame receives kb:select-project',
131
176
  20000,
132
177
  );
133
- await harness.run("document.querySelector('[data-view=\"home\"]').click()");
134
- await harness.waitFor(() => harness.run("document.getElementById('view-home').classList.contains('active')"), 'the home view');
135
178
 
136
179
  assert.equal(await currentProject(), projectA.projectId, 'the first project is the current one');
137
180
 
@@ -149,17 +192,18 @@ async function main() {
149
192
  20000,
150
193
  );
151
194
 
152
- // The switch to the other project is a real pointer click on the row.
153
- await harness.nativeClick(`#homeContent [data-select-project="${projectB.projectId}"]`);
195
+ // The switch to the other project goes through the top-bar selector, the
196
+ // shell's own project switcher.
197
+ await switchProject(harness, projectB.projectId);
154
198
  await harness.waitFor(async () => (await currentProject()) === projectB.projectId, 'the second project becomes the current one');
155
199
  await harness.waitFor(
156
- () => harness.run(`document.getElementById('homeContent').textContent.includes(${JSON.stringify(shortB)})`),
200
+ () => harness.run(`document.getElementById('activityUpdates').textContent.includes(${JSON.stringify(shortB)})`),
157
201
  'the second project shows its own run',
158
202
  20000,
159
203
  );
160
204
 
161
205
  // NAV-005 expected 1: only the current project is shown.
162
- let text = await homeText();
206
+ let text = await activityText(harness);
163
207
  assert.ok(text.includes(shortB), 'the current project run is shown');
164
208
  assert.equal(text.includes(shortA), false, 'the other project run is not shown while the second project is current');
165
209
 
@@ -201,7 +245,7 @@ async function main() {
201
245
  const failedReads = await refreshUntil(harness, entry => entry.path.startsWith(SNAPSHOT) && entry.status === 503);
202
246
  assert.ok(failedReads >= 1, `the snapshot read really failed while the late answer was delivered: ${failedReads}`);
203
247
 
204
- text = await homeText();
248
+ text = await activityText(harness);
205
249
  assert.equal(await currentProject(), projectB.projectId, 'the current project did not change because of the late answer');
206
250
  assert.ok(text.includes(shortB), 'the current project run is still shown after the late answer');
207
251
  assert.equal(text.includes(shortA), false, 'the late answer of the other project did not overwrite the current project');
@@ -209,28 +253,30 @@ async function main() {
209
253
  assert.ok(failedSnapshotReads >= 1, `the snapshot reads really failed while the late answer was delivered, so no refresh could mask it: ${failedSnapshotReads} failed reads`);
210
254
  harness.productProxy.clearFaults();
211
255
 
212
- // The switch back is a real pointer click as well.
213
- await harness.nativeClick(`#homeContent [data-select-project="${projectA.projectId}"]`);
256
+ // The switch back goes through the top-bar selector as well.
257
+ await switchProject(harness, projectA.projectId);
214
258
  await harness.waitFor(async () => (await currentProject()) === projectA.projectId, 'the first project becomes the current one again');
215
259
  await harness.waitFor(
216
- () => harness.run(`document.getElementById('homeContent').textContent.includes(${JSON.stringify(shortA)})`),
260
+ () => harness.run(`document.getElementById('activityUpdates').textContent.includes(${JSON.stringify(shortA)})`),
217
261
  'the first project shows its own run again',
218
262
  20000,
219
263
  );
220
- text = await homeText();
264
+ text = await activityText(harness);
221
265
  assert.equal(text.includes(shortB), false, 'the other project run is not shown after switching back');
222
266
  await harness.browser.screenshot(path.join(harness.evidence, 'nav005-switch-back.png'));
223
267
 
224
268
  // NAV-005 expected 3: the project that reaches the embedded module is the
225
- // current one, and the mapping is the one the product registered.
269
+ // current one, and the mapping is the one the product registered. The
270
+ // five-page shell maps the workbench service mount to the current product
271
+ // project id directly (frameContext posts project = projectId).
226
272
  const mappings = (await harness.frameMessages('workFrame')).filter(message => message.type === 'kb:select-project');
227
273
  const last = mappings[mappings.length - 1];
228
274
  assert.ok(last, 'the terminal frame really received kb:select-project');
229
275
  assert.equal(last.projectId, projectA.projectId, 'the newest kb:select-project carries the current project');
230
- assert.equal(last.project, projectA.project.state.modules.terminal.projectId, 'the newest kb:select-project carries the module project the product registered for it');
276
+ assert.equal(last.project, projectA.projectId, 'the newest kb:select-project carries the mapping the product registered for the current project');
231
277
  const forB = mappings.find(message => message.projectId === projectB.projectId);
232
278
  assert.ok(forB, 'the terminal frame really received the mapping of the other project');
233
- assert.equal(forB.project, projectB.project.state.modules.terminal.projectId, 'the mapping of the other project is the module project the product registered for it');
279
+ assert.equal(forB.project, projectB.projectId, 'the mapping of the other project is the mapping the product registered for it');
234
280
  const requestIds = mappings.map(message => message.requestId);
235
281
  assert.ok(requestIds.every(requestId => /^\d+:terminal$/.test(String(requestId))), `every mapping carries the shell request id: ${JSON.stringify(requestIds)}`);
236
282
  assert.notEqual(forB.requestId, last.requestId, 'the switch to the other project used a new request id');