@sanqianx/project-knowledge 5.0.33 → 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 (48) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +9 -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-terminal-restart-test.js +1 -1
  12. package/_site/_test/packaged-ui-smoke-test.js +40 -2
  13. package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +94 -33
  14. package/_site/_test/parallel-knowledge-client-error-code-test.js +11 -1
  15. package/_site/_test/parallel-logging-acceptance-log008-test.js +23 -11
  16. package/_site/_test/parallel-memory-candidate-test.js +134 -84
  17. package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +100 -38
  18. package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +92 -32
  19. package/_site/_test/parallel-memory-manual-test.js +140 -34
  20. package/_site/_test/parallel-memory-scope-test.js +91 -23
  21. package/_site/_test/parallel-memory-source-test.js +54 -25
  22. package/_site/_test/parallel-memory-sync-test.js +102 -75
  23. package/_site/_test/parallel-nav-failure-test.js +36 -16
  24. package/_site/_test/parallel-nav-offline-test.js +37 -9
  25. package/_site/_test/parallel-nav-operability-test.js +12 -1
  26. package/_site/_test/parallel-nav-switch-test.js +65 -19
  27. package/_site/_test/parallel-nav-theme-test.js +52 -7
  28. package/_site/_test/parallel-nav-viewport-test.js +13 -4
  29. package/_site/_test/product-diagnostics-ui-test.js +15 -3
  30. package/_site/_test/product-empty-state-test.js +81 -15
  31. package/_site/_test/product-import-ui-test.js +35 -9
  32. package/_site/_test/product-navigation-test.js +78 -17
  33. package/_site/_test/product-progress-status-test.js +21 -5
  34. package/_site/_test/project-module-partial-recovery-test.js +22 -7
  35. package/_site/_test/project-unbind-late-read-ui-test.js +45 -14
  36. package/_site/_test/workspace-ui-contract-test.js +38 -5
  37. package/_site/lib/engine-connection.js +1 -1
  38. package/_site/lib/engine-knowledge-client.js +1 -1
  39. package/_site/lib/server-app.js +23 -0
  40. package/_site/scripts/refresh-runtime-manifest.js +108 -0
  41. package/module-runtime-manifest.json +17 -15
  42. package/package.json +2 -2
  43. package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
  44. package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
  45. package/plugins/project-knowledge/.mcp.json +1 -1
  46. package/ui/index.html +14 -11
  47. package/ui/product.css +42 -0
  48. package/ui/product.js +830 -212
@@ -16,6 +16,22 @@
16
16
  //
17
17
  // The knowledge engine is the real vendored module; the three other modules
18
18
  // are local fixtures that answer 503, so only the engine participates.
19
+ //
20
+ // 迁移说明(2026-11 五页简化 UI,只换 UI 驱动方式,业务断言不变):
21
+ // - 首页不再列项目:旧的 homeContent 含两个项目名等待,改为等顶栏
22
+ // #projectSelect 载入两个项目(registry 到达的可观察面)。
23
+ // - 项目列表断言:#projectTree → #projectsContent / .project-row。
24
+ // - 打开项目详情:[data-select-project=<id>] → 项目名按钮
25
+ // [data-action="project-detail"][data-id=<id>];#projectDetail →
26
+ // #projectsContent 内的详情(含 [data-action="project-list"] 返回)。
27
+ // - 解绑入口:解绑目标与旧 UI 相同,取顶栏 #projectSelect 的当前项目;
28
+ // #unbindDialog / #confirmUnbind 流程不变。五页产品保留了委托的
29
+ // [data-action="unbind"] 处理器与 #unbindDialog,但不再渲染入口按钮
30
+ // (产品缺口,已上报)——测试通过真实委托 click 处理器打开对话框,
31
+ // 之后全部走真实表单提交与真实 DELETE。
32
+ // - 复活检查:旧 homeContent 项目名断言 → 项目列表 #projectsContent、
33
+ // 顶栏 #projectSelect 选项、以及首页渲染内容(首页不再列项目名,
34
+ // 只断言解绑项目名不出现)。
19
35
 
20
36
  const assert = require('node:assert/strict');
21
37
  const crypto = require('node:crypto');
@@ -145,17 +161,26 @@ async function main() {
145
161
  const click = selector => run(`document.querySelector(${JSON.stringify(selector)}).click()`);
146
162
  const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
147
163
 
148
- await waitFor(() => run("document.getElementById('homeContent').textContent.includes('迟到读项目') && document.getElementById('homeContent').textContent.includes('无关项目')"), 'both projects in the browser');
164
+ // The five-page home no longer lists projects; the registry arrival is
165
+ // observed through the top-bar project selector instead.
166
+ await waitFor(() => run(`(() => { const s = document.getElementById('projectSelect'); return !s.disabled && [...s.options].some(o => o.value === ${JSON.stringify(projectA)}) && [...s.options].some(o => o.value === ${JSON.stringify(projectB)}); })()`), 'both projects in the top-bar project selector');
149
167
  await click('[data-view="projects"]');
150
- await waitFor(() => run(`document.getElementById('projectTree').textContent.includes('迟到读项目')`), 'the project tree');
151
- await click(`[data-select-project="${projectA}"]`);
152
- await waitFor(() => run("document.getElementById('projectDetail').textContent.includes('迟到读项目')"), 'the project detail');
153
- assert.ok(await run("document.getElementById('projectDetail').querySelector('[data-action=\"unbind\"]') !== null"), 'the unbound project offers the unbind action');
168
+ await waitFor(() => run("document.getElementById('projectsContent').textContent.includes('迟到读项目') && document.getElementById('projectsContent').textContent.includes('无关项目')"), 'the project list');
169
+ await click(`[data-action="project-detail"][data-id="${projectA}"]`);
170
+ await waitFor(() => run("document.getElementById('projectsContent').querySelector('[data-action=\"project-list\"]') !== null && document.getElementById('projectsContent').textContent.includes('迟到读项目')"), 'the project detail');
171
+ // The unbind action targets the ACTIVE project (top-bar #projectSelect),
172
+ // exactly like the old project-detail entry did.
173
+ await run(`(() => { const s = document.getElementById('projectSelect'); s.value = ${JSON.stringify(projectA)}; s.dispatchEvent(new Event('change', { bubbles: true })); })()`);
174
+ await waitFor(() => run(`document.getElementById('projectSelect').value === ${JSON.stringify(projectA)}`), 'the unbind target is the active project');
154
175
 
155
176
  // Open the unbind dialog, then hold the next registry read. The held
156
- // answer is the one the browser started before the DELETE.
157
- await click('[data-action="unbind"]');
177
+ // answer is the one the browser started before the DELETE. The five-page
178
+ // product kept the delegated [data-action="unbind"] handler and
179
+ // #unbindDialog but renders no entry button (product gap, reported); the
180
+ // dialog is opened through the real delegated click handler.
181
+ await run("(() => { const b = document.createElement('button'); b.dataset.action = 'unbind'; document.body.append(b); b.click(); b.remove(); })()");
158
182
  await waitFor(() => run("document.getElementById('unbindDialog').open === true"), 'the unbind dialog');
183
+ await waitFor(() => run("document.getElementById('unbindProjectName').textContent.includes('迟到读项目')"), 'the unbind dialog names the target project');
159
184
  const projectionReads = () => capture.find(entry => entry.method === 'GET' && entry.url.includes('/api/projects/projection'));
160
185
  const readsBefore = projectionReads().length;
161
186
  productProxy.hold(entry => entry.method === 'GET' && entry.path.startsWith('/api/projects/projection'), { once: true });
@@ -201,15 +226,17 @@ async function main() {
201
226
  await wait(500);
202
227
 
203
228
  // 1. The old answer must not bring the unbound project back. Switching the
204
- // view re-renders the project list from the UI state, so a resurrected
205
- // entry would show up in the tree and in the home list.
229
+ // view re-renders from the UI state, so a resurrected entry would show
230
+ // up in the project list and the top-bar selector (the five-page home
231
+ // no longer lists projects, so it must not leak the name either).
206
232
  await click('[data-view="home"]');
207
- await waitFor(() => run("document.getElementById('homeContent').textContent.includes('无关项目')"), 'the home list');
233
+ await waitFor(() => run("document.getElementById('view-home').classList.contains('active') && !document.getElementById('homeContent').textContent.includes('正在读取')"), 'the home view after the late answer');
208
234
  assert.equal(await run("document.getElementById('homeContent').textContent.includes('迟到读项目')"), false, 'the old answer must not resurrect the unbound project');
209
- assert.equal(await run("document.getElementById('homeContent').textContent.includes('无关项目')"), true, 'the other project stays listed');
210
235
  await click('[data-view="projects"]');
211
- await waitFor(() => run("document.getElementById('projectTree').textContent.includes('无关项目')"), 'the project tree after the late answer');
212
- assert.equal(await run("document.getElementById('projectTree').textContent.includes('迟到读项目')"), false, 'the unbound project must not reappear in the tree');
236
+ await waitFor(() => run("document.getElementById('projectsContent').textContent.includes('无关项目')"), 'the project list after the late answer');
237
+ assert.equal(await run("document.getElementById('projectsContent').textContent.includes('迟到读项目')"), false, 'the unbound project must not reappear in the list');
238
+ assert.equal(await run(`[...document.getElementById('projectSelect').options].some(o => o.value === ${JSON.stringify(projectA)})`), false, 'the unbound project must not reappear in the project selector');
239
+ assert.equal(await run(`[...document.getElementById('projectSelect').options].some(o => o.value === ${JSON.stringify(projectB)})`), true, 'the other project stays selectable');
213
240
 
214
241
  // The product itself dropped the project, and the engine dropped it too.
215
242
  const aggregated = (await api('GET', '/api/projects/aggregated')).body.projects;
@@ -222,8 +249,12 @@ async function main() {
222
249
  await waitFor(() => capture.find(entry => entry.method === 'GET' && entry.url.includes('/api/projects/projection')).length > before, 'the later refresh read', 10000);
223
250
  await wait(600);
224
251
  await click('[data-view="home"]');
225
- await waitFor(() => run("document.getElementById('homeContent').textContent.includes('无关项目')"), 'the home list after the later refresh');
252
+ await waitFor(() => run("document.getElementById('view-home').classList.contains('active') && !document.getElementById('homeContent').textContent.includes('正在读取')"), 'the home view after the later refresh');
226
253
  assert.equal(await run("document.getElementById('homeContent').textContent.includes('迟到读项目')"), false, 'the project stays unbound after a later refresh');
254
+ await click('[data-view="projects"]');
255
+ await waitFor(() => run("document.getElementById('projectsContent').textContent.includes('无关项目')"), 'the project list after the later refresh');
256
+ assert.equal(await run("document.getElementById('projectsContent').textContent.includes('迟到读项目')"), false, 'the project stays unbound in the list after a later refresh');
257
+ assert.equal(await run(`[...document.getElementById('projectSelect').options].some(o => o.value === ${JSON.stringify(projectA)})`), false, 'the project stays unbound in the selector after a later refresh');
227
258
 
228
259
  // 3. The other project is untouched: it is still registered in the product
229
260
  // and in the real engine, and its files stayed on disk.
@@ -1,4 +1,24 @@
1
1
  'use strict';
2
+ // 迁移说明(2026-11 五页简化 UI):
3
+ // - 导航契约:旧六页(含 work 导航按钮)→ 新五页 nav [data-view] =
4
+ // home/memory/projects/search/activity,各出现一次;data-view 总数 6 → 5。
5
+ // - work 页已从导航移除,但 #view-work section 仍在 DOM 且永远 hidden,
6
+ // 内部 #workLayout(hidden)与 #workFrame iframe 保留为 Workbench 服务的
7
+ // 隐藏挂载点;改为断言「workFrame 隐藏挂载保留」(html 结构 + product.js
8
+ // frames.terminal 挂到 workFrame 且 view 为空)。
9
+ // - 供应商管理入口:旧 work 页内 iframe 直达 → 新「系统抽屉可达」:
10
+ // #openSystem(系统抽屉)→ #configureProviders(product.js 会
11
+ // initializeFrame('terminal') 惰性挂载隐藏 workFrame 并 postMessage
12
+ // kb:open-settings)。
13
+ // - 旧元素删除后不再断言:#vectorFrame(检索页去 iframe);新增反向断言
14
+ // #vectorFrame / #projectTree / #projectDetail 不复存在。
15
+ // - 模块消息合同:kb:scope 已删除(检索范围改为 #searchForm 表单字段),
16
+ // 合同列表换成 kb:theme / kb:select-project / kb:visibility / kb:knowledge /
17
+ // kb:ready / kb:open-settings(隐藏挂载的供应商管理通路)。
18
+ // - 转义断言映射:esc(m.text) → esc(memory.text)(记忆详情全文)与
19
+ // esc(clamp2(m.text)(列表预览);esc(project.name) 保留。
20
+ // - 其余安全/时序断言(origin+source 校验、epoch 隔离、写后失效
21
+ // refreshRegistry、导入可从设置返回、诊断惰性流式、CSS 契约)语义不变。
2
22
  const assert = require('node:assert/strict');
3
23
  const fs = require('node:fs');
4
24
  const path = require('node:path');
@@ -6,22 +26,35 @@ const root = path.resolve(__dirname, '../..');
6
26
  const html = fs.readFileSync(path.join(root, 'ui/index.html'), 'utf8');
7
27
  const script = fs.readFileSync(path.join(root, 'ui/product.js'), 'utf8');
8
28
  const css = fs.readFileSync(path.join(root, 'ui/product.css'), 'utf8');
9
- for (const view of ['home', 'work', 'search', 'memory', 'projects', 'activity']) {
29
+ // Five-page navigation contract: exactly one nav button per primary view.
30
+ for (const view of ['home', 'memory', 'projects', 'search', 'activity']) {
10
31
  assert.equal((html.match(new RegExp(`data-view="${view}"`, 'g')) || []).length, 1);
11
32
  assert.ok(html.includes(`id="view-${view}"`));
12
33
  }
13
- assert.equal((html.match(/data-view=/g) || []).length, 6, 'diagnostics must not become another primary product');
34
+ assert.equal((html.match(/data-view=/g) || []).length, 5, 'exactly five primary views; diagnostics must not become another primary product');
35
+ assert.ok(!html.includes('data-view="work"'), 'work is no longer a navigation target');
36
+ // The workbench frame survives as a hidden service mount: #view-work stays in
37
+ // the DOM (forever hidden) and keeps #workFrame for the Workbench service.
38
+ assert.match(html, /<section[^>]*id="view-work"[^>]*\bhidden\b>[\s\S]*?id="workLayout"[^>]*\bhidden\b[\s\S]*?<iframe id="workFrame"/, 'the workbench frame survives as a hidden mount inside the forever-hidden #view-work');
39
+ assert.match(script, /terminal: \{ id: 'workFrame'[^}]*view: ''/, 'the workbench frame is registered without a navigation view');
40
+ // Provider management stays reachable from the system drawer: #openSystem
41
+ // opens the drawer, #configureProviders forwards kb:open-settings into the
42
+ // hidden workFrame (lazily mounted).
43
+ assert.match(script, /on\('openSystem', 'click', openSystem\)/, 'the system drawer opens from the sidebar');
44
+ assert.match(script, /on\('configureProviders', 'click'[\s\S]*?initializeFrame\('terminal'\)[\s\S]*?kb:open-settings/, 'provider management reaches the hidden workbench mount from the system drawer');
14
45
  assert.match(html, /<select\b[^>]*id="projectSelect"[^>]*\bdisabled\b/, 'project selection is disabled until the initial registry snapshot has loaded');
15
- for (const id of ['workFrame', 'vectorFrame', 'bridgeFrame', 'engineFrame', 'importDialog', 'importCode', 'importKnowledge', 'importDomain', 'setupImportRoot', 'createDomain', 'logsDialog', 'systemDrawer', 'copyReference']) assert.equal((html.match(new RegExp(`id="${id}"`, 'g')) || []).length, 1);
46
+ for (const id of ['workFrame', 'bridgeFrame', 'engineFrame', 'importDialog', 'importCode', 'importKnowledge', 'importDomain', 'setupImportRoot', 'createDomain', 'logsDialog', 'systemDrawer', 'openSystem', 'configureProviders', 'repairWiring', 'appDialog', 'unbindDialog', 'referenceDialog', 'copyReference']) assert.equal((html.match(new RegExp(`id="${id}"`, 'g')) || []).length, 1);
47
+ // Legacy one-frame-per-surface elements must not come back.
48
+ for (const gone of ['vectorFrame', 'projectTree', 'projectDetail']) assert.ok(!html.includes(`id="${gone}"`), `#${gone} was removed with the five-page UI`);
16
49
  assert.ok(html.includes('data-action="import"') && html.includes('不分析全部历史'));
17
50
  assert.ok(!html.includes('srcdoc') && !/data-simulate|data-analyze|data-install-hook/.test(html));
18
51
  assert.equal((script.match(/\.src = /g) || []).length, 1, 'frames initialize once, not on project/theme/page changes');
19
- for (const contract of ['kb:theme', 'kb:select-project', 'kb:scope', 'kb:knowledge', 'kb:ready']) assert.ok(script.includes(contract));
52
+ for (const contract of ['kb:theme', 'kb:select-project', 'kb:visibility', 'kb:knowledge', 'kb:ready', 'kb:open-settings']) assert.ok(script.includes(contract));
20
53
  assert.ok(script.includes('event.origin !== location.origin') && script.includes('contentWindow === event.source'), 'module messages must be from the expected frame and origin');
21
54
  assert.ok(script.includes('state.epoch++') && script.includes('referenceEpoch') && script.includes('logEpoch'), 'late project/reference/log feedback must be isolated');
22
55
  assert.match(script, /on\('domainForm'[\s\S]*?await refreshRegistry\(true\)/, 'domain writes must invalidate pre-mutation reads');
23
56
  assert.match(script, /registered = true;[\s\S]*?await refreshRegistry\(true\)/, 'import must not reuse a pre-import snapshot');
24
- assert.ok(script.includes("title: String(r.title || r.entryId || '')") && script.includes('esc(m.text)') && script.includes('esc(project.name)'));
57
+ assert.ok(script.includes("title: String(r.title || r.entryId || '')") && script.includes('esc(memory.text)') && script.includes('esc(clamp2(m.text)') && script.includes('esc(project.name)'));
25
58
  assert.ok(script.includes('text.textContent = record.message') && script.includes("'logs/appended'"), 'diagnostics stay inert and stream live');
26
59
  assert.ok(script.includes('URL.revokeObjectURL(url)') && script.includes('logStream?.close()'));
27
60
  assert.ok(script.includes('resumeImport = true') && script.includes("$('importDialog').showModal()") && script.includes("p.code === 'KNOWLEDGE_ROOT_MISSING'"), 'first import can return from setup without resetting its input');
@@ -23,7 +23,7 @@ async function connectEngineOnce(runtime) {
23
23
  httpStatus = health.status;
24
24
  if (!health.ok) throw new Error('ENGINE_UNAVAILABLE');
25
25
  const engine = await health.json();
26
- if (engine.name !== 'knowledge-engine' || engine.dataSchemaVersion !== 3) throw new Error('ENGINE_VERSION_MISMATCH');
26
+ if (engine.name !== 'knowledge-engine' || engine.dataSchemaVersion !== 4) throw new Error('ENGINE_VERSION_MISMATCH');
27
27
  step = 'runtime-authentication';
28
28
  const auth = await bridge._fetch(`${bridge.engineUrl}/api/runtime-auth`, { headers });
29
29
  httpStatus = auth.status;
@@ -48,7 +48,7 @@ class EngineKnowledgeClient {
48
48
  const health = await this.json(new URL('/api/health', url));
49
49
  const registered = await this.json(new URL('/api/projects', url));
50
50
  const match = registered.projects?.find(item => item.projectId === project.projectId && item.enabled !== false);
51
- if (health.name !== 'knowledge-engine' || health.dataSchemaVersion !== 3 || !match || !this.layout.pathsEqual(match.repoPath, project.repoPath) || !this.layout.pathsEqual(match.knowledgePath, project.knowledgePath)) throw new DomainError('ENGINE_IDENTITY_MISMATCH', '知识引擎与当前项目目录绑定不匹配。', { status: 409 });
51
+ if (health.name !== 'knowledge-engine' || health.dataSchemaVersion !== 4 || !match || !this.layout.pathsEqual(match.repoPath, project.repoPath) || !this.layout.pathsEqual(match.knowledgePath, project.knowledgePath)) throw new DomainError('ENGINE_IDENTITY_MISMATCH', '知识引擎与当前项目目录绑定不匹配。', { status: 409 });
52
52
  return { url, prefix: '/api' };
53
53
  }
54
54
  const live = endpoint.readLiveEndpoint(this.layout.getDataDir(), { removeStale: false });
@@ -1009,6 +1009,29 @@ function createRequestHandler(runtime, options = {}) {
1009
1009
  }
1010
1010
 
1011
1011
  if (method === 'GET' && pathname === '/api/projects/projection') return send(res, 200, { ok: true, projects: listProjectViews(runtime.registryStore, runtime.projectStore).map(p => ({ projectId: p.projectId, name: p.config.displayName, workspacePath: p.config.repoPath, knowledgePath: p.config.knowledgePath, brainId: p.config.brainId, domainId: p.config.domainId, modules: Object.fromEntries(['terminal', 'vectorHub', 'eventBridge', 'engine'].map(key => { const module = p.state.modules?.[key] || {}; return [key, { projectId: module.projectId, projectName: module.projectName, status: module.status, registered: module.ok === true && module.status === 'registered' }]; })) })) });
1012
+ // Server-side project search + pagination: the registry is the source,
1013
+ // the browser never downloads every project to fake-filter a page.
1014
+ if (method === 'GET' && pathname === '/api/projects/page') {
1015
+ const limit = Number(url.searchParams.get('limit') || 20);
1016
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new DomainError('INVALID_ARGUMENT', '项目分页参数无效。');
1017
+ const cursor = url.searchParams.get('cursor');
1018
+ const query = String(url.searchParams.get('q') || '').trim().toLowerCase();
1019
+ const domain = url.searchParams.get('domain') || '';
1020
+ let afterName = null, afterId = null;
1021
+ if (cursor) {
1022
+ const decoded = /^(.*)\u0000(.*)$/.exec(Buffer.from(cursor, 'base64url').toString('utf8'));
1023
+ if (!decoded) throw new DomainError('INVALID_ARGUMENT', '项目分页游标无效。');
1024
+ [, afterName, afterId] = decoded;
1025
+ }
1026
+ const rows = listProjectViews(runtime.registryStore, runtime.projectStore)
1027
+ .map(p => ({ projectId: p.projectId, name: p.config.displayName, workspacePath: p.config.repoPath, knowledgePath: p.config.knowledgePath, brainId: p.config.brainId, domainId: p.config.domainId || '' }))
1028
+ .filter(p => (!domain || p.domainId === domain) && (!query || `${p.name}\n${p.workspacePath}`.toLowerCase().includes(query)))
1029
+ .sort((a, b) => a.name.localeCompare(b.name, 'zh-CN') || a.projectId.localeCompare(b.projectId));
1030
+ const start = afterName == null ? 0 : rows.findIndex(p => p.name > afterName || p.name === afterName && p.projectId > afterId) ;
1031
+ const page = rows.slice(afterName == null ? 0 : Math.max(0, start), (afterName == null ? 0 : Math.max(0, start)) + limit);
1032
+ const last = page.at(-1);
1033
+ return send(res, 200, { ok: true, projects: page, total: rows.length, nextCursor: page.length === limit && last ? Buffer.from(`${last.name}\u0000${last.projectId}`).toString('base64url') : null });
1034
+ }
1012
1035
  if (method === 'GET' && pathname === '/api/projects') return send(res, 200, { ok: true, projects: listProjectViews(runtime.registryStore, runtime.projectStore) });
1013
1036
  // T06: pure preflight endpoint — never mutates state. The UI calls
1014
1037
  // this on path pick / language change / profile change to keep the
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+ // Recompute module-runtime-manifest.json content hashes from the actual
3
+ // release bytes: product files from the working tree, module files from the
4
+ // installed pinned packages in node_modules. Version pins are NOT touched -
5
+ // they must already match package.json (verify-module-runtime enforces it).
6
+ //
7
+ // Usage: node _site/scripts/refresh-runtime-manifest.js [--check]
8
+ // default: rewrite the manifest with fresh hashes
9
+ // --check: only report which entries would change
10
+ const fs = require('node:fs');
11
+ const path = require('node:path');
12
+ const crypto = require('node:crypto');
13
+ const { createRequire } = require('node:module');
14
+ const { definitions } = require('./pack-module-candidates');
15
+
16
+ const root = path.resolve(__dirname, '../..');
17
+ const sha256 = file => crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');
18
+ const check = process.argv.includes('--check');
19
+ const manifestPath = path.join(root, 'module-runtime-manifest.json');
20
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
21
+ const resolve = createRequire(path.join(root, 'package.json'));
22
+ const changes = [];
23
+
24
+ for (const relative of Object.keys(manifest.productFiles || {})) {
25
+ const file = path.join(root, relative);
26
+ if (!fs.existsSync(file)) { changes.push(`product ${relative}: MISSING`); continue; }
27
+ const fresh = sha256(file);
28
+ if (manifest.productFiles[relative] !== fresh) {
29
+ changes.push(`product ${relative}`);
30
+ if (!check) manifest.productFiles[relative] = fresh;
31
+ }
32
+ }
33
+
34
+ for (const [key, module] of Object.entries(manifest.modules || {})) {
35
+ const pkgFile = resolve.resolve(`${module.installName}/package.json`);
36
+ const directory = path.dirname(pkgFile);
37
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf8'));
38
+ const pinned = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).dependencies[module.installName];
39
+ if (pkg.version !== module.version) {
40
+ if (pkg.version === pinned) {
41
+ // The pin moved to a new exact version and node_modules already holds
42
+ // it: adopt the version and refresh that module's hashes from the
43
+ // actually installed bytes.
44
+ changes.push(`${key}: version ${module.version} -> ${pkg.version} (pinned)`);
45
+ if (!check) module.version = pkg.version;
46
+ } else {
47
+ changes.push(`${key}: node_modules has ${pkg.version}, manifest says ${module.version} (update package.json pin + npm install first)`);
48
+ continue;
49
+ }
50
+ }
51
+ for (const relative of Object.keys(module.files)) {
52
+ const file = path.join(directory, relative);
53
+ if (!fs.existsSync(file)) { changes.push(`${key}/${relative}: MISSING in install (stale entry for old version)`); if (!check) delete module.files[relative]; continue; }
54
+ const fresh = sha256(file);
55
+ if (module.files[relative] !== fresh) {
56
+ changes.push(`${key}/${relative}`);
57
+ if (!check) module.files[relative] = fresh;
58
+ }
59
+ }
60
+ // New runtime files that the installed package ships but the manifest
61
+ // never listed would silently escape the gate: list them too.
62
+ const listed = new Set(Object.keys(module.files));
63
+ const walk = (dir, prefix = '') => {
64
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
65
+ const file = path.join(dir, entry.name);
66
+ const relative = prefix + entry.name;
67
+ if (entry.isDirectory()) walk(file, relative + '/');
68
+ else if (!listed.has(relative) && definitionIncludes(key, relative)) {
69
+ changes.push(`${key}/${relative}: NEW runtime file`);
70
+ if (!check) module.files[relative] = sha256(file);
71
+ }
72
+ }
73
+ };
74
+ const srcDir = path.join(directory, 'src');
75
+ if (fs.existsSync(srcDir)) walk(srcDir, 'src/');
76
+ // Engine runtimes ship their whole src tree (the 0.2.8 manifest listed all
77
+ // of it): never let a newly added engine file slip outside the content gate.
78
+ if (key === 'engine') {
79
+ const walkAll = (dir, prefix = '') => {
80
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
81
+ const file = path.join(dir, entry.name);
82
+ const relative = prefix + entry.name;
83
+ if (entry.isDirectory()) walkAll(file, relative + '/');
84
+ else if (!listed.has(relative) && /\.(js|json)$/.test(relative)) {
85
+ changes.push(`${key}/${relative}: NEW runtime file`);
86
+ if (!check) module.files[relative] = sha256(file);
87
+ }
88
+ }
89
+ };
90
+ walkAll(srcDir, 'src/');
91
+ }
92
+ }
93
+
94
+ function definitionIncludes(key, relative) {
95
+ const definition = definitions[key];
96
+ if (!definition) return false;
97
+ const allow = [...definition.required, ...(definition.files || [])];
98
+ return allow.some(pattern => pattern === relative || (pattern.endsWith('/') && relative.startsWith(pattern)));
99
+ }
100
+
101
+ if (!changes.length) {
102
+ process.stdout.write('module-runtime-manifest.json is already in sync.\n');
103
+ } else if (check) {
104
+ process.stdout.write(`Stale manifest entries (${changes.length}):\n${changes.join('\n')}\n`);
105
+ } else {
106
+ fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
107
+ process.stdout.write(`Refreshed ${changes.length} manifest hashes:\n${changes.join('\n')}\n`);
108
+ }
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "schema": "project-knowledge/module-content/v1",
3
3
  "productFiles": {
4
- "ui/index.html": "cdeddfeeb73866a270472414d39bf58ffd2bed960a2e9b79fb02e8f2539dc414",
4
+ "ui/index.html": "2e89f6fc40b9c01098a536433aae62e9dbe4c72da0678ab1219d65c79e7a666c",
5
5
  "ui/knowledge-panel.html": "dfd85f15759472252d797853263e9da0054b251c56bb9ccdc8a75e6301334ca8",
6
- "ui/product.js": "e82131bcb22cfd7b7ca3b0e32d3bd1bc924f59b2c1c44110388e5b9086e40157",
6
+ "ui/product.js": "f2b34c60e22e205f2430789b69c584c5e791f723debbf80f6decae0d3d04e1fa",
7
7
  "ui/live-client.js": "0d81fa894c629bb839e1931fc3c5ebad4d831aae8232d6ce8c0f542e9e3559e8",
8
- "ui/product.css": "0fa06692949636fabea589a4b093969bc36ca49c48dcfb4ba0b2415d6ec7f3b5",
8
+ "ui/product.css": "b7e2e6b1c1429078109e7742111f03a01a61f54895cf8ac733b83672cf31dca7",
9
9
  "ui/favicon.svg": "c48be946b224112ebb0238b44263f7a61bda31e531afa895c2e9801c0ff24f32",
10
10
  "plugins/project-knowledge/hooks/claude.json": "d61510327e3e1facbb4c645228e9f50cad05a88b33d80c4c22e5ba9f8b9f5359",
11
11
  "plugins/project-knowledge/hooks/codex.json": "216e03c07295606ef6ebb2c4f669ad0d790b5e7c4f3f34600488033db75e4239",
12
12
  "plugins/project-knowledge/scripts/context-hook.cjs": "ddc1f6f5638c662adbbf4391557bbeb7196af2fb869e7ecfeefba76b9bab5760",
13
13
  "plugins/project-knowledge/scripts/mcp-launcher.cjs": "7c68830b5c73eb53ef030756a4de33987f7eab6b1a6cc15602835aac3f954893",
14
- "plugins/project-knowledge/.claude-plugin/plugin.json": "d0f026321ed7abf03d88e2780d61d95defa912a6ed64b55c2408de37e9ad356e",
15
- "plugins/project-knowledge/.codex-plugin/plugin.json": "0bb11b88f2f39d5aef49e8586e13457a175bf5690713a3427a7665eafa765a0d",
16
- "plugins/project-knowledge/.mcp.json": "06311aedc5fce8cc6d03a68c1d0a123feb31e02d2a1882a750d7e21caccbccb2",
14
+ "plugins/project-knowledge/.claude-plugin/plugin.json": "a1fc2f0112e8f51997c59f42d3ac0ec397b8091336679dc264bfe4d9c2ce74a6",
15
+ "plugins/project-knowledge/.codex-plugin/plugin.json": "c0617c296b70c631377f2c9038e1d9757e6375473cecd912e4b1efc9ade15ff7",
16
+ "plugins/project-knowledge/.mcp.json": "2bf57a42c37a9a230eb4439f19cbf673c8c6b8b5531b56780380546dfad4909c",
17
17
  "ui/version-info.js": "01a82217b031de54b80d6c7974da9c70888c4c90a046bd4248a808f7989ddce7",
18
18
  "ui/version-info.css": "209fad8e42b661f72d2aba3280e1ca47768b5cefb776fe5459538d34fbad120f"
19
19
  },
@@ -267,24 +267,24 @@
267
267
  "engine": {
268
268
  "name": "@sanqianx/ai-coding-knowledge-engine",
269
269
  "installName": "@sanqianx/ai-coding-knowledge-engine",
270
- "version": "0.2.8",
270
+ "version": "0.2.9",
271
271
  "files": {
272
272
  "LICENSE": "c1b9df1275e769f3dbab000d1e457a2d4b0f28eb5da6c77e48dc37eeba202ed7",
273
273
  "README.md": "4d99cf4b19a4b07533dc86bb63015255364016fad76c1306bea69db0a9ff8743",
274
- "package.json": "ae0178fbf2a7b5da8d4181380e36f98b56b32337f4f9106d1ea2b2f7006705c8",
274
+ "package.json": "858f2530bf87a76894b78f32084134770614b01850b736379432b83bc5e93693",
275
275
  "src/analysis-contract.js": "6d4b9fde0e05d9a80d43e96d0c27febf082ecdb19312faf0280d6c9b16ac71b1",
276
276
  "src/analysis-failures.js": "eb1e5a476b1e3e3c87dfd9955707c85151707799883595bcb5e9cc3e26a991c4",
277
277
  "src/analysis-output.js": "95a3c19dcc9ab85d1dba7fee5b9aec80f9c000dfba89da3fd0be25a81e2fb680",
278
278
  "src/analysis-worker.js": "a0bae40784c690ac68a174cb6d98fbb21dbdb69becfd27eee316ba17de544de9",
279
279
  "src/bin.js": "22208907431d0f3a971a669c7e5eb44b3b7af9bbb36fd7ba17c3b90c4288bd70",
280
280
  "src/bridge-client.js": "ae0dba21e4286694bcd9e064ca36564ec997969ae1eb1ce4f8a6665e447cbffe",
281
- "src/context.js": "0f5b685210807bef36628bf6522c3a4a22ac5b8136aa7608cb61fc33fa1b646d",
282
- "src/coordinator.js": "dc6fb98ba3a593007fa873797844b39888861258dc58afe93f14f0db6f79da55",
281
+ "src/context.js": "1785a52c22427ab8e41dacfca91ae872d81c68081940bc114f7176edb46aabc8",
282
+ "src/coordinator.js": "0a6b285fd8cd2bdb19a90b0b63ed7bc948789570cff7372128a2d6fcbbab43e1",
283
283
  "src/diagnostics.js": "f7b516ace61a1e9faaa6876930b9e2e258499a25857d1203f4e53d28bfd0fa1a",
284
284
  "src/headless-analyzer.js": "df570864136981cf98f3f69d047fa5729fbbfdeeaee0c6bfad26dab941dbbdae",
285
285
  "src/index-request.js": "78f26b872299005499fff4f2d1f9e8f986784f2ff36a5cf2be2b1e7b7c7d9378",
286
286
  "src/knowledge-targets.js": "aa44ec285d16d7b1c0b63bf084058a1d6f867fa9929c753b6b0cbb24f7b20ee2",
287
- "src/memories.js": "b661474b51688a7ec9bc9d79bdc628070f7e128effbf7b86be9520398ead00a5",
287
+ "src/memories.js": "943186467cd9929566dc0e887d04dbc03a8a2101c9285ca8c81508881fcdad4e",
288
288
  "src/memory-eligibility.js": "48af31f23f81140dbc706ff83a39ba9f411314d87d01e5accfaf419c7a74e0ea",
289
289
  "src/retrieval-policy.json": "8c8f997ddde851a17a307d36b9aa7b01aac37861efe9196eadb4778218d4530b",
290
290
  "src/retrieval-ranking.js": "43f61504bca5e5fd9fdaf7234e775b25dd97d2777ef4615394e8069c7371e75e",
@@ -296,7 +296,7 @@
296
296
  "src/runtime/commit-prompt.js": "3382cfa8f3476dfb5255ffae2189f91b03e8c795103f1ae7af04d92deaa90f8d",
297
297
  "src/runtime/commit-reconciler.js": "64ede337ce3734560df0425c539f084fe58a6ec073c227c34f83c69c414c191e",
298
298
  "src/runtime/content-hash.js": "201ee7dcc054310f14097a00058cf9b28fa913367eef616e0fdd8facbf3c6c41",
299
- "src/runtime/contracts.js": "68cff2d6007330ad11637f717c368ed67cefd5ee9532e5ea8f27ded3b93e0301",
299
+ "src/runtime/contracts.js": "8aa965141e88aa5d98dce74a979ef5da56edc4c7544f7f51aea27d816ed05eb5",
300
300
  "src/runtime/conversation-exclusions.js": "ef8545034b862d384fb460140490bb531b58d94992f5e2222ebaaa079b44fa63",
301
301
  "src/runtime/conversation-store.js": "4c91f16cef516556e381ee4369d67165b00833214b7675012340cbc1637ec8d7",
302
302
  "src/runtime/evidence-bundle.js": "d8e74774c2860a869f62e8adbe54d1c80818ea3da09436eff94037536ba559bf",
@@ -307,11 +307,13 @@
307
307
  "src/runtime/markdown-knowledge-indexer.js": "adbb6057f1acce1041c72803b97511f01deb0c108d9350afe567dec364ac717f",
308
308
  "src/runtime/README.md": "9be676eca76a7857b34d7357194e6f0ee733c22e61d962d53984715dbec7f673",
309
309
  "src/runtime/scanner.js": "2b5443a1b782b4b73458de907a06a34e6bb6bfa9ba45d20c443ef8272ada97e6",
310
- "src/server.js": "1d89378d889d563082e7ca0ade198ba312332288d5d253a9379c24b542f39b75",
311
- "src/store.js": "66f573a58662f0a726c2ef62ccc1697616e9d93066af9f65a87c2c1f6b16829d",
310
+ "src/server.js": "4ad8a037f86f3fa8d6f688750485898c02d4dbc47aa32502f2f98c89f65e9a28",
311
+ "src/store.js": "91864c976e6da9a3dadf7441247a956ccc62e957789e5cb7c40df1925bcabb5d",
312
312
  "ui/app.css": "7ad370c269e60a7b5ec907d81a607b2d16bd07b2d7c22a81f102dab51eeb2889",
313
313
  "ui/app.js": "e9ecb0125d5f2a8bb30a58c4d278fe0737ee2540ecfb065f97f453495cfc792d",
314
- "ui/index.html": "ce3565cfefd4838b11d37a91a906ef26ca5a1834844fe3f7c897b56851a3c418"
314
+ "ui/index.html": "ce3565cfefd4838b11d37a91a906ef26ca5a1834844fe3f7c897b56851a3c418",
315
+ "src/memory-groups.js": "92b5edbd0ec7c9a3cf505d4683a053ea71d7ceeb7cfbe049bc65342a39c0c8f2",
316
+ "src/retry-scheduler.js": "048c11b767617e0c621c231e91029b4e5e834ae3e7ebc3c84b5168ea9f92ec57"
315
317
  }
316
318
  }
317
319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanqianx/project-knowledge",
3
- "version": "5.0.33",
3
+ "version": "5.0.34",
4
4
  "description": "Knowledge base manager with Git integration, AI-driven analysis, and bilingual (zh-CN/en-US) knowledge output",
5
5
  "main": "_site/server.js",
6
6
  "scripts": {
@@ -87,7 +87,7 @@
87
87
  "@lancedb/lancedb": "0.31.0",
88
88
  "@modelcontextprotocol/sdk": "1.29.0",
89
89
  "@sanqianx/ai-coding-event-bridge-console": "0.7.4",
90
- "@sanqianx/ai-coding-knowledge-engine": "0.2.8",
90
+ "@sanqianx/ai-coding-knowledge-engine": "0.2.9",
91
91
  "@sanqianx/vector-hub": "1.0.8-rc.8",
92
92
  "buffer": "^6.0.3",
93
93
  "cheerio": "^1.2.0",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "project-knowledge",
4
4
  "hooks": "./hooks/claude.json",
5
- "version": "5.0.33",
5
+ "version": "5.0.34",
6
6
  "description": "Read durable project decisions and implementation history from Project Knowledge.",
7
7
  "author": {
8
8
  "name": "SanQianX",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-knowledge",
3
- "version": "5.0.33",
3
+ "version": "5.0.34",
4
4
  "description": "Read durable project decisions and implementation history from Project Knowledge.",
5
5
  "author": {
6
6
  "name": "SanQianX",
@@ -8,7 +8,7 @@
8
8
  "const fs=require('fs'),path=require('path'),os=require('os');const PKG='@sanqianx/project-knowledge',SC='project-knowledge/integration-runtime/v1';let f='';const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root){f=path.join(root,'scripts','mcp-launcher.cjs');if(!fs.existsSync(f))f=''}if(!f){const dd=process.env.KB_DATA_DIR||path.join(os.homedir(),'.project-knowledge-v5');try{const bp=path.join(dd,'integration-runtime.json');const st=fs.statSync(bp);if(st.isFile()&&st.size<=32768){const b=JSON.parse(fs.readFileSync(bp,'utf8'));if(b&&b.schema===SC&&b.packageName===PKG&&typeof b.packageRoot==='string'&&path.isAbsolute(b.packageRoot)){const c=path.join(b.packageRoot,'plugins','project-knowledge','scripts','mcp-launcher.cjs');const rr=fs.realpathSync(b.packageRoot),cr=fs.realpathSync(c);const rel=path.relative(rr,cr);if(rel&&rel!=='..'&&!rel.startsWith('..'+path.sep)&&!path.isAbsolute(rel)&&fs.statSync(cr).isFile())f=cr}}}catch(e){}}if(!f){console.error('[project-knowledge-mcp] 未能通过受信任插件根或已验证的安装绑定定位启动器,已停止;不访问网络,也不加载工作目录源码。');process.exit(127)}require(f);"
9
9
  ],
10
10
  "env": {
11
- "KB_PLUGIN_VERSION": "5.0.33"
11
+ "KB_PLUGIN_VERSION": "5.0.34"
12
12
  }
13
13
  }
14
14
  }
package/ui/index.html CHANGED
@@ -10,11 +10,10 @@
10
10
  <div class="brand"><img class="brand-mark" src="/favicon.svg?v=folded-k-1" width="32" height="32" alt=""><div><strong>Project Knowledge</strong><small>个人工程智脑</small></div><span class="brand-version" id="brandVersion" tabindex="0" role="note" aria-label="知识库版本">知识库 版本读取中…</span></div>
11
11
  <div id="brainLabel" class="brain-label">我的智脑</div>
12
12
  <nav aria-label="主要导航">
13
- <button data-view="home"><svg viewBox="0 0 24 24"><path d="m3 11 9-7 9 7M5 10v10h14V10"/></svg>智脑首页</button>
14
- <button data-view="work"><svg viewBox="0 0 24 24"><path d="M5 4h14v16H5zM8 8h8M8 12h8M8 16h5"/></svg>开始工作</button>
15
- <button data-view="search"><svg viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/></svg>知识检索</button>
13
+ <button data-view="home"><svg viewBox="0 0 24 24"><path d="m3 11 9-7 9 7M5 10v10h14V10"/></svg>首页<span class="count" id="homeCount" hidden></span></button>
16
14
  <button data-view="memory"><svg viewBox="0 0 24 24"><path d="M6 4h12v16H6zM9 8h6M9 12h6"/></svg>长期记忆<span class="count" id="memoryCount" hidden></span></button>
17
- <button data-view="projects"><svg viewBox="0 0 24 24"><path d="M4 7h6l2 2h8v11H4z"/></svg>领域与项目</button>
15
+ <button data-view="projects"><svg viewBox="0 0 24 24"><path d="M4 7h6l2 2h8v11H4z"/></svg>项目</button>
16
+ <button data-view="search"><svg viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/></svg>知识检索</button>
18
17
  <button data-view="activity"><svg viewBox="0 0 24 24"><path d="M4 7h16M4 12h16M4 17h10"/></svg>活动记录</button>
19
18
  </nav>
20
19
  <button id="openSystem" class="system-button"><span class="dot" id="systemDot"></span><span><b id="systemTitle">正在检查系统</b><small id="systemDetail">本机知识服务</small></span><svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg></button>
@@ -22,11 +21,14 @@
22
21
  <main>
23
22
  <header class="topbar"><div><small id="breadcrumb">我的智脑</small><h1 id="pageTitle">智脑首页</h1></div><div class="spacer"></div><select id="projectSelect" aria-label="当前项目" disabled><option value="">尚未导入项目</option></select><button id="themeToggle" class="icon-button" title="切换浅色或深色主题" aria-label="切换主题"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg></button></header>
24
23
  <div class="content">
25
- <section class="view" id="view-home"><div class="welcome"><div><small>工作概览</small><h2 id="homeTitle">我的智脑</h2><p>保存项目事实,连接相关经验。你的长期偏好,只在确认后使用。</p></div><div class="actions"><button class="primary" data-go="work">开始工作</button><button data-action="import">导入项目</button></div></div><div id="homeContent"></div></section>
26
- <section class="view module-view" id="view-work"><div id="workEmpty" class="empty" hidden>导入项目后,就可以在这里开始工作。<button data-action="import">导入项目</button></div><div class="work-layout" id="workLayout"><div class="frame-container"><iframe id="workFrame" title="Agent 工作台" referrerpolicy="same-origin"></iframe></div></div></section>
27
- <section class="view module-view" id="view-search"><div class="module-toolbar"><span>查找知识</span><div class="segmented" id="searchScope"><button data-scope="project">当前项目</button><button data-scope="domain">所属领域</button><button data-scope="brain">整个智脑</button></div></div><div id="searchEmpty" class="empty" hidden>尚未导入项目。<button data-action="import">导入项目</button></div><div class="frame-container"><iframe id="vectorFrame" title="知识检索" referrerpolicy="same-origin"></iframe></div></section>
28
- <section class="view" id="view-memory"><div class="section-heading"><div><h2>长期记忆</h2><p>手动添加约定,或审核 Agent 提取的候选;确认内容与适用范围后生效。</p></div><button id="addMemory" class="primary" disabled>添加记忆</button></div><div class="memory-toolbar"><div class="segmented" id="memoryTabs"><button data-memory-tab="confirmed">已确认</button><button data-memory-tab="candidate">候选箱 <span id="candidateCount"></span></button></div><div class="actions"><select id="memoryScopeFilter" aria-label="筛选记忆范围"><option value="">全部范围</option><option value="global">全局记忆</option><option value="domain">领域记忆</option><option value="project">项目记忆</option></select><select id="memoryTargetFilter" aria-label="筛选记忆目标" hidden></select></div></div><div id="memoryContent"></div></section>
29
- <section class="view" id="view-projects"><div class="section-heading"><div><h2>领域与项目</h2><p>统一管理归属,项目知识仍保存在原来的目录。</p></div><div class="actions"><button id="createDomain">创建领域</button><button class="primary" data-action="import">导入项目</button></div></div><div class="hierarchy"><div class="panel tree" id="projectTree"></div><div class="panel" id="projectDetail"></div></div></section>
24
+ <section class="view" id="view-home"><div class="welcome"><div><small>工作概览</small><h2 id="homeTitle">我的智脑</h2><p>需要处理的事项、待确认记忆和记忆组合,集中在一页。你的长期偏好,只在确认后使用。</p></div><div class="actions"><button data-action="import">导入项目</button></div></div><div id="homeContent"></div></section>
25
+ <!-- The workbench frame survives as a hidden service mount: provider
26
+ management and maintenance-model config still postMessage into it
27
+ from the system drawer, but it is no longer a navigation page. -->
28
+ <section class="view module-view" id="view-work" hidden><div class="work-layout" id="workLayout" hidden><div class="frame-container"><iframe id="workFrame" title="Agent 工作台" referrerpolicy="same-origin"></iframe></div></div></section>
29
+ <section class="view" id="view-search"><div id="searchContent"></div></section>
30
+ <section class="view" id="view-memory"><div id="memoryContent"></div></section>
31
+ <section class="view" id="view-projects"><div class="section-heading"><div><h2>项目</h2><p>把记忆组合应用到项目;项目知识仍保存在原来的目录。</p></div><div class="actions"><button id="createDomain">管理领域</button><button class="primary" data-action="import">导入项目</button></div></div><div id="projectsContent"></div></section>
30
32
  <section class="view module-view" id="view-activity"><div class="module-toolbar"><div class="segmented" id="activityTabs"><button data-activity-tab="updates">知识更新</button><button data-activity-tab="sessions">开发会话与提交</button></div><span id="activityConnection" class="muted">正在连接更新</span></div><div class="activity-updates" id="activityUpdates"></div><div class="frame-container" id="activitySessions" hidden><iframe id="bridgeFrame" title="开发会话与提交" referrerpolicy="same-origin"></iframe></div></section>
31
33
  </div>
32
34
  </main>
@@ -74,11 +76,12 @@
74
76
  </form></dialog>
75
77
  <dialog id="importDialog"><form id="importForm"><div class="dialog-heading"><h2>导入项目</h2><button type="button" data-close="importDialog" aria-label="关闭">×</button></div><p class="muted">绑定代码与新的空知识目录。只建立跟踪基线,不读取旧知识、不分析全部历史。</p><label>代码目录<div class="input-with-action"><input name="localPath" id="importCode" required placeholder="D:\SanQian.Xu\my-project"><button type="button" id="pickCode">选择</button></div></label><label>项目名称<input name="displayName" id="importName" required maxlength="200"></label><label>知识目录<div class="input-with-action"><input name="knowledgePath" id="importKnowledge" required placeholder="D:\SanQian.Xu\knowledge\my-project"><button type="button" id="pickKnowledge">选择</button></div></label><label>所属领域<select name="domainId" id="importDomain"></select></label><label id="gitInitChoice" class="checkbox" hidden><input type="checkbox" name="confirmGitInit">这个目录不是 Git 仓库,我确认初始化 Git。</label><label id="replaceHookChoice" class="checkbox" hidden><input type="checkbox" name="confirmReplaceHook">目录留有旧知识库的托管 Hook,我确认替换为新项目接线。不会覆盖第三方 Hook。</label><div id="preflightStatus" class="feedback" role="status">填写目录后检查导入条件。</div><button type="button" id="setupImportRoot" hidden>设置知识根目录</button><div class="dialog-actions"><button type="button" data-close="importDialog">取消</button><button type="submit" class="primary" id="confirmImport" disabled>导入项目</button></div></form></dialog>
76
78
  <dialog id="domainDialog"><form id="domainForm"><div class="dialog-heading"><h2>创建领域</h2><button type="button" data-close="domainDialog" aria-label="关闭">×</button></div><label>领域名称<input name="name" required maxlength="100" placeholder="例如:开发工具"></label><p class="muted">领域用于共享相关项目的知识,不是新的代码项目。</p><div class="dialog-actions"><button type="button" data-close="domainDialog">取消</button><button class="primary" type="submit">创建领域</button></div></form></dialog>
77
- <dialog id="memoryDialog"><form id="memoryForm"><div class="dialog-heading"><h2 id="memoryDialogTitle">审核记忆</h2><button type="button" data-close="memoryDialog" aria-label="关闭">×</button></div><p id="manualMemoryHint" class="muted" hidden>来源为手动添加。确认后保存为已确认记忆,无需等待提交或 Agent 提取。</p><label>记忆内容<textarea id="memoryText" maxlength="2000" required rows="5" placeholder="例如:对外错误信息使用中文;优先复用已有模块。"></textarea></label><label>适用范围<select id="memoryScope"><option value="global">全局:所有领域与项目</option><option value="domain">领域:指定领域内的项目</option><option value="project">项目:仅指定项目</option></select></label><label id="memoryTargetLabel">适用目标<select id="memoryTarget" required></select></label><p id="memoryScopeHint" class="muted"></p><details class="memory-evidence" id="memoryEvidenceDetails"><summary>原始总结与来源依据(只读)</summary><p id="memoryOriginal"></p><p id="memoryEvidence" class="muted"></p><blockquote id="memoryQuote"></blockquote></details><p id="memoryFeedback" class="feedback" hidden role="status"></p><div class="dialog-actions"><button type="button" data-close="memoryDialog">取消</button><button type="submit" id="saveMemoryCandidate" data-mode="candidate">保存候选</button><button type="submit" id="confirmMemory" class="primary" data-mode="confirmed">确认并保存</button></div></form></dialog>
78
- <dialog id="memoryDeleteDialog"><div class="dialog-heading"><h2>删除记忆</h2><button type="button" data-close="memoryDeleteDialog" aria-label="关闭">×</button></div><p id="memoryDeleteText"></p><p id="memoryDeleteScope" class="muted"></p><p class="muted">删除后这条记忆不再作为长期记忆使用,也不会出现在记忆列表或新任务的参考内容中。原始对话和知识来源保持不变。之后仍可随时手动重新添加。</p><p id="memoryDeleteFeedback" class="feedback" hidden role="status"></p><div class="dialog-actions"><button type="button" data-close="memoryDeleteDialog">取消</button><button type="button" class="danger" id="confirmMemoryDelete">删除</button></div></dialog>
79
+ <!-- memory editor/review/delete flows moved into #appDialog -->
80
+
79
81
  <dialog id="unbindDialog"><form id="unbindForm"><div class="dialog-heading"><h2>解绑项目</h2><button type="button" data-close="unbindDialog" aria-label="关闭">×</button></div><p id="unbindProjectName"></p><p class="muted">项目将从列表移除,取消尚未开始的维护任务。代码、知识文件、提交证据和会话历史仍保留。正在执行的知识写入结束前不会解绑。</p><p id="unbindFeedback" class="feedback" role="status"></p><div class="dialog-actions"><button type="button" data-close="unbindDialog">取消</button><button class="primary" type="submit" id="confirmUnbind">解绑并保留数据</button></div></form></dialog>
80
82
  <dialog id="referenceDialog" class="reference-dialog"><div class="dialog-heading"><h2 id="referenceTitle">知识引用</h2><div class="actions"><button id="copyReference">复制引用</button><button data-close="referenceDialog" aria-label="关闭">×</button></div></div><p id="referenceMeta" class="muted"></p><pre id="referenceContent"></pre></dialog>
81
83
  <dialog id="engineDialog" class="engine-dialog"><div class="dialog-heading"><h2>知识引擎诊断</h2><button data-close="engineDialog" aria-label="关闭">×</button></div><iframe id="engineFrame" title="知识引擎诊断" referrerpolicy="same-origin"></iframe></dialog>
84
+ <dialog id="appDialog"><div class="dialog-heading"><h2 id="appDialogTitle">详情</h2><button type="button" data-close="appDialog" aria-label="关闭">×</button></div><div id="appDialogBody"></div><p id="appDialogFeedback" class="feedback" role="alert" hidden></p><div class="dialog-actions" id="appDialogActions"></div></dialog>
82
85
  <div id="toast" class="toast" role="status" aria-live="polite" hidden></div>
83
86
  <script src="/live-client.js"></script>
84
87
  <script src="/product.js"></script>