@sanqianx/project-knowledge 5.0.32 → 5.0.34

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 (56) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +15 -0
  3. package/_site/_test/automatic-context-test.js +19 -0
  4. package/_site/_test/chat-claudecodeui-match-test.js +22 -3
  5. package/_site/_test/context-session-index-test.js +244 -0
  6. package/_site/_test/fixtures/retrieval-gold-queries.json +4 -0
  7. package/_site/_test/fresh-product-data-test.js +1 -1
  8. package/_site/_test/glm-ui-refresh-review-test.js +1 -1
  9. package/_site/_test/harness-isolation-test.js +1 -1
  10. package/_site/_test/home-overview-test.js +64 -0
  11. package/_site/_test/index-error-display-contract-test.js +23 -1
  12. package/_site/_test/knowledge-engine-client-test.js +1 -1
  13. package/_site/_test/memory-groups-ui-test.js +149 -0
  14. package/_site/_test/module-terminal-restart-test.js +1 -1
  15. package/_site/_test/packaged-ui-smoke-test.js +40 -2
  16. package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +94 -33
  17. package/_site/_test/parallel-knowledge-client-error-code-test.js +11 -1
  18. package/_site/_test/parallel-logging-acceptance-log008-test.js +23 -11
  19. package/_site/_test/parallel-memory-candidate-test.js +134 -84
  20. package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +100 -38
  21. package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +92 -32
  22. package/_site/_test/parallel-memory-manual-test.js +140 -34
  23. package/_site/_test/parallel-memory-scope-test.js +91 -23
  24. package/_site/_test/parallel-memory-source-test.js +54 -25
  25. package/_site/_test/parallel-memory-sync-test.js +102 -75
  26. package/_site/_test/parallel-nav-failure-test.js +36 -16
  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/server-app.js +23 -0
  43. package/_site/scripts/ab-rank-v2-v3.js +142 -0
  44. package/_site/scripts/refresh-runtime-manifest.js +108 -0
  45. package/_site/scripts/run-retrieval-gold-isolated.js +221 -0
  46. package/_site/scripts/verify-retrieval-gold.js +57 -10
  47. package/module-runtime-manifest.json +22 -20
  48. package/package.json +2 -2
  49. package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
  50. package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
  51. package/plugins/project-knowledge/.mcp.json +1 -1
  52. package/plugins/project-knowledge/scripts/context-hook.cjs +9 -5
  53. package/plugins/project-knowledge/skills/project-knowledge/SKILL.md +39 -28
  54. package/ui/index.html +14 -11
  55. package/ui/product.css +42 -0
  56. package/ui/product.js +830 -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
 
@@ -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');
@@ -1,6 +1,18 @@
1
1
  'use strict';
2
2
  // NAV-002 — 主题同步。
3
3
  //
4
+ // 迁移说明(五页简化 UI):
5
+ // - nav [data-view] 契约:只有 home/memory/projects/search/activity 五页,
6
+ // work 导航按钮已移除;断言导航恰好五项且不含 work。
7
+ // - '#work' 与未知 hash 经 titles 检查回落 home(history.replaceState 归位
8
+ // '#home',#view-home active、标题「首页」)。
9
+ // - work 不再是导航页:#view-work 仍在 DOM 且永远 hidden,内部 #workFrame
10
+ // 保留为 Workbench 服务挂载点。终端帧的打开路径从「点击 work 导航」改为
11
+ // 「#openSystem 系统抽屉 → #configureProviders」(initializeFrame('terminal'))。
12
+ // - vectorHub/vectorFrame 已删除(检索页改为服务端检索),帧列表只剩
13
+ // terminal(workFrame) 与 eventBridge(bridgeFrame)。
14
+ // - 首页不再罗列项目:导入后的项目出现改为断言顶栏 #projectSelect 选项。
15
+ //
4
16
  // The shell owns the product theme: switching it must persist, every embedded
5
17
  // module that is already ready must be told about the new theme, and the
6
18
  // switch must not rebuild the module task.
@@ -23,10 +35,12 @@ const { startHarness, makeRepo } = require('./helpers/parallel-nav-shell');
23
35
 
24
36
  const EVIDENCE = process.env.PK_TEST_EVIDENCE_DIR ? path.resolve(process.env.PK_TEST_EVIDENCE_DIR) : null;
25
37
 
38
+ // The workbench frame survives only as a hidden service mount (opened from the
39
+ // system drawer), and the event bridge still lives on the activity page. The
40
+ // vector hub frame was removed with the work navigation page.
26
41
  const FRAMES = [
27
- { key: 'terminal', id: 'workFrame', view: 'work' },
28
- { key: 'vectorHub', id: 'vectorFrame', view: 'search' },
29
42
  { key: 'eventBridge', id: 'bridgeFrame', view: 'activity' },
43
+ { key: 'terminal', id: 'workFrame' },
30
44
  ];
31
45
 
32
46
  async function main() {
@@ -43,11 +57,36 @@ async function main() {
43
57
  );
44
58
  await harness.requestRegistryRefresh();
45
59
  await harness.waitFor(
46
- () => harness.run("document.getElementById('homeContent').textContent.includes('NAV002 项目')"),
60
+ () => harness.run("[...document.getElementById('projectSelect').options].some(option => option.textContent === 'NAV002 项目')"),
47
61
  'the imported project is listed',
48
62
  20000,
49
63
  );
50
64
 
65
+ // NAV-002 navigation contract (five-page UI): exactly the five pages, no
66
+ // work button, and the workbench survives as a hidden service mount.
67
+ assert.deepEqual(
68
+ await harness.run("[...document.querySelectorAll('nav [data-view]')].map(button => button.dataset.view)"),
69
+ ['home', 'memory', 'projects', 'search', 'activity'],
70
+ 'the navigation offers exactly the five pages',
71
+ );
72
+ assert.equal(await harness.run("document.querySelector('[data-view=\"work\"]') === null"), true, 'the work navigation button is removed');
73
+ assert.equal(await harness.run("document.getElementById('view-work') !== null"), true, 'the work section survives in the DOM');
74
+ assert.equal(await harness.run("document.getElementById('view-work').hidden"), true, 'the work section stays hidden');
75
+ assert.equal(await harness.run("document.getElementById('workFrame') !== null"), true, 'the workbench service mount (workFrame) survives');
76
+ // Unknown hashes fall back to home through the same titles guard the
77
+ // product uses; the workbench page itself is no longer reachable.
78
+ for (const hash of ['#work', '#anything']) {
79
+ await harness.run(`location.hash = ${JSON.stringify(hash)}`);
80
+ await harness.waitFor(
81
+ async () => (await harness.run("document.getElementById('view-home').classList.contains('active')"))
82
+ && (await harness.run("document.getElementById('pageTitle').textContent")) === '首页'
83
+ && (await harness.run("location.hash")) === '#home',
84
+ `the ${hash} hash falls back to home`,
85
+ 10000,
86
+ );
87
+ assert.equal(await harness.run("document.getElementById('view-work').hidden"), true, `the ${hash} fallback never reveals the work section`);
88
+ }
89
+
51
90
  const shellTheme = () => harness.run("document.documentElement.dataset.theme");
52
91
  const storedTheme = () => harness.run("localStorage.getItem('kb.theme')");
53
92
 
@@ -60,12 +99,18 @@ async function main() {
60
99
  await harness.browser.screenshot(path.join(harness.evidence, 'nav002-theme-dark.png'));
61
100
 
62
101
  // NAV-002 expected 2: a ready frame receives kb:theme.
63
- // The three embedded modules are opened one after another; each frame has
64
- // to be ready (the shell only talks to a frame that announced itself).
102
+ // The embedded modules are readied one after another; each frame has to
103
+ // be ready (the shell only talks to a frame that announced itself). The
104
+ // event bridge still opens from the activity navigation; the workbench
105
+ // frame now opens from the system drawer's provider management, which is
106
+ // the only remaining reason the hidden mount exists.
65
107
  for (const frame of FRAMES) {
66
- await harness.run(`document.querySelector('[data-view="${frame.view}"]').click()`);
67
108
  if (frame.key === 'eventBridge') {
109
+ await harness.run(`document.querySelector('[data-view="${frame.view}"]').click()`);
68
110
  await harness.run("document.querySelector('[data-activity-tab=\"sessions\"]').click()");
111
+ } else {
112
+ await harness.nativeClick('#openSystem');
113
+ await harness.nativeClick('#configureProviders');
69
114
  }
70
115
  await harness.waitFor(
71
116
  async () => {
@@ -121,7 +166,7 @@ async function main() {
121
166
 
122
167
  assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
123
168
 
124
- console.log('parallel-nav-theme-test PASS (theme persisted, ready frames receive kb:theme, no module task rebuilt)');
169
+ console.log('parallel-nav-theme-test PASS (five-page nav contract, #work falls back to home, hidden workFrame mount, theme persisted, ready frames receive kb:theme, no module task rebuilt)');
125
170
  } finally {
126
171
  await harness.cleanup();
127
172
  }
@@ -1,7 +1,15 @@
1
1
  'use strict';
2
2
  // NAV-007 — 分辨率矩阵。
3
3
  //
4
- // The six pages of the shell must render without unintended horizontal
4
+ // 迁移说明(五页简化 UI):
5
+ // - 页面矩阵从六页改为五页:home/memory/projects/search/activity
6
+ // (work 导航已移除;#view-work 常驻 hidden,不参与矩阵)。
7
+ // - 「项目已登记」等待改查顶栏 #projectSelect 选项含项目名(首页不再
8
+ // 罗列项目,同一 registry projection)。
9
+ // - 几何证据(容器横向溢出、控件可见矩形、elementFromPoint 命中)、
10
+ // 截图像素统计、明暗主题真实重绘的断言保持不变。
11
+ //
12
+ // The five pages of the shell must render without unintended horizontal
5
13
  // overflow and without a control being covered, in four desktop viewports
6
14
  // and in both themes.
7
15
  //
@@ -43,12 +51,13 @@ const VIEWPORTS = [
43
51
 
44
52
  const THEMES = ['light', 'dark'];
45
53
 
54
+ // The five-page navigation contract: home, memory, projects, search,
55
+ // activity. The workbench section stays hidden and is not a page.
46
56
  const PAGES = [
47
57
  { key: 'home', view: 'home' },
48
- { key: 'work', view: 'work' },
49
- { key: 'search', view: 'search' },
50
58
  { key: 'memory', view: 'memory' },
51
59
  { key: 'projects', view: 'projects' },
60
+ { key: 'search', view: 'search' },
52
61
  { key: 'activity', view: 'activity' },
53
62
  ];
54
63
 
@@ -198,7 +207,7 @@ async function main() {
198
207
  await harness.importProject(repo, 'NAV007 甲');
199
208
  await harness.requestRegistryRefresh();
200
209
  await harness.waitFor(
201
- () => harness.run("document.getElementById('homeContent').textContent.includes('NAV007 甲')"),
210
+ () => harness.run("[...document.getElementById('projectSelect').options].some(option => option.textContent === 'NAV007 甲')"),
202
211
  'the imported project is listed',
203
212
  20000,
204
213
  );
@@ -1,4 +1,7 @@
1
1
  'use strict';
2
+ // 迁移说明(五页 UI):#projectDetail 面板已由项目详情视图取代(#projectsContent 内
3
+ // .project-row 列表 + [data-action=project-detail] 进入详情);解绑按钮随详情页渲染
4
+ // ([data-action=unbind],对话框与安全语义不变)。导航循环不含 work(五页契约)。
2
5
  const assert = require('node:assert/strict');
3
6
  const fs = require('node:fs');
4
7
  const os = require('node:os');
@@ -38,7 +41,10 @@ async function main() {
38
41
  for (const view of ['home', 'memory', 'projects', 'activity']) {
39
42
  await click(`[data-view="${view}"]`); assert.equal(await run('document.documentElement.scrollWidth > innerWidth'), false, view);
40
43
  }
41
- assert.ok(await run("document.getElementById('projectDetail').textContent.includes('视觉检测知识库')"));
44
+ await click('[data-view="projects"]');
45
+ await waitFor(() => run("document.querySelectorAll('.project-row').length >= 1"), 'project list row');
46
+ await click('[data-action="project-detail"]');
47
+ await waitFor(() => run("document.getElementById('projectsContent').textContent.includes('视觉检测知识库') && document.getElementById('projectsContent').textContent.includes('使用的组合')"), 'project detail renders');
42
48
  assert.ok(await run("document.getElementById('activityUpdates').textContent.includes('离线')"), 'offline cannot masquerade as empty/success');
43
49
  await click('#openSystem'); await click('#openLogs');
44
50
  await waitFor(() => run("document.querySelectorAll('#logsContent .log-entry').length === 100"), 'bounded diagnostic rendering');
@@ -67,7 +73,13 @@ async function main() {
67
73
  assert.equal(entries.length, 1); assert.equal(entries[0].projectId, fixture.projectId);
68
74
  await click('[data-close="logsDialog"]'); await click('#themeToggle');
69
75
  await browser.send('Page.navigate', { url: base + '/#projects' });
70
- await waitFor(() => run("document.getElementById('projectDetail').textContent.includes('视觉检测知识库')"), 'reload');
76
+ // Same-document hash navigation keeps an open detail view; return to the
77
+ // list explicitly, then reopen the detail after the theme flip.
78
+ await waitFor(() => run("document.readyState === 'complete'"), 'document settles');
79
+ await run("(() => { const b = document.querySelector('[data-action=project-list]'); if (b) b.click(); return true; })()");
80
+ await waitFor(() => run("document.querySelectorAll('.project-row').length >= 1"), 'list after navigation', 20000);
81
+ await click('[data-action="project-detail"]');
82
+ await waitFor(() => run("document.getElementById('projectsContent').textContent.includes('视觉检测知识库')"), 'detail after navigation', 15000);
71
83
  assert.equal(await run('document.documentElement.dataset.theme'), 'dark');
72
84
  const codeFiles = fs.readdirSync(fixture.repo.path);
73
85
  // The registry does not own knowledge bytes. Use its actual double-directory binding.
@@ -80,7 +92,7 @@ async function main() {
80
92
  assert.equal(browser.exceptions.length, 0, JSON.stringify(browser.exceptions));
81
93
  console.log('product-diagnostics-ui-test PASS (1920x1080; XSS/filter/expanded failure/export/theme/offline writer protection)');
82
94
  } catch (error) {
83
- if (browser) console.error(await browser.evaluate("JSON.stringify({ toast:document.getElementById('toast').textContent, project:document.getElementById('projectSelect').value, detail:document.getElementById('projectDetail').textContent })"));
95
+ if (browser) console.error(await browser.evaluate("JSON.stringify({ toast:document.getElementById('toast').textContent, project:document.getElementById('projectSelect').value, detail:document.getElementById('projectsContent').textContent })"));
84
96
  throw error;
85
97
  } finally {
86
98
  try { await browser?.close(); }