@sanqianx/project-knowledge 5.0.34 → 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.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +5 -0
- package/_site/_test/module-supervisor-backoff-reset-test.js +64 -0
- package/_site/_test/parallel-memory-home-review-test.js +148 -0
- package/_site/_test/parallel-nav-home-issues-test.js +159 -0
- package/_site/lib/module-bridge.js +16 -6
- package/module-runtime-manifest.json +4 -4
- package/package.json +1 -1
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/ui/product.js +32 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.35] - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- 模块监督器退避计数在稳定运行后重置:连续健康运行 ≥60 秒的模块服务,其下一次退出按新事故计(计数归 1),只有持续快速崩溃才累计到放弃上限,快速崩溃循环的原有保护与退避节奏不变。消除「偶发退出的模块被监督器永久放弃、外壳持续向死端口反代、界面长时间 MODULE_UNREACHABLE 直到重启外壳」的故障模式(系统日志中 10-22→23、10-26→27 两波 24/20 小时级故障即此成因)。新增 `module-supervisor-backoff-reset-test.js` 回归(崩溃循环仍放弃 + 稳定退出必拉起且计数归 1)。
|
|
6
|
+
- 首页直达处理移植到五页外壳:「需要处理」的 overview 运行行提供「去处理」入口(绑定具体 runId),openRunDetail 落到活动记录中该次运行的展开行,pendingOpenRun 在快照/SSE/分页并发重渲染下保持展开不被吞掉;「待确认记忆」沿用五页共享的候选审核对话框,确认在原位完成。浏览器回归 `parallel-nav-home-issues-test.js` 与 `parallel-memory-home-review-test.js` 迁移到五页选择器(#projectSelect 登记面、review-candidate 入口、appDialog 审核流)。
|
|
7
|
+
|
|
3
8
|
## [5.0.34] - 2026-11-12
|
|
4
9
|
|
|
5
10
|
- 界面简化为五页(首页、长期记忆、项目、知识检索、活动记录),移除「开始工作」导航;Workbench 服务保留为隐藏挂载,模型供应商管理与默认维护模型仍从系统状态打开。首页集中展示全局人工待办(上限预览 + 总数)、自动恢复横幅、待确认记忆预览与最多 4 个记忆组合入口。
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Regression: the module supervisor's backoff counter must reset after a
|
|
3
|
+
// stable run. Before the fix, attempts accumulated for the whole shell
|
|
4
|
+
// lifetime, so one-off exits spread over weeks eventually hit the give-up
|
|
5
|
+
// cap and left the module dead while the shell kept proxying to its port —
|
|
6
|
+
// the endless MODULE_UNREACHABLE episodes in the shell UI.
|
|
7
|
+
const fs = require('node:fs');
|
|
8
|
+
const os = require('node:os');
|
|
9
|
+
const path = require('node:path');
|
|
10
|
+
const assert = require('node:assert/strict');
|
|
11
|
+
const { ModuleBridge } = require('../lib/module-bridge');
|
|
12
|
+
|
|
13
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
14
|
+
|
|
15
|
+
function supervisedBridge() {
|
|
16
|
+
const bridge = new ModuleBridge();
|
|
17
|
+
const events = [];
|
|
18
|
+
bridge.logger = {
|
|
19
|
+
info: () => {},
|
|
20
|
+
warn: (event, message) => events.push({ event, message }),
|
|
21
|
+
error: () => {},
|
|
22
|
+
};
|
|
23
|
+
return { bridge, events };
|
|
24
|
+
}
|
|
25
|
+
const restarted = events => events.filter(entry => entry.event === 'modules.supervisor' && /restarting/.test(entry.message)).length;
|
|
26
|
+
const gaveUp = events => events.filter(entry => entry.event === 'modules.supervisor' && /stopped/.test(entry.message)).length;
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'kb-supervisor-backoff-'));
|
|
30
|
+
|
|
31
|
+
// A quick crash loop must still be abandoned (the cap keeps its purpose).
|
|
32
|
+
// No _stableAfterMs override here: quick exits face the production default.
|
|
33
|
+
const crashLoop = supervisedBridge();
|
|
34
|
+
const quickExit = path.join(root, 'quick-exit.js');
|
|
35
|
+
fs.writeFileSync(quickExit, 'process.exit(0);');
|
|
36
|
+
crashLoop.bridge._spawnSupervised({ name: 'fixture', command: `node ${JSON.stringify(quickExit)}`, _attempts: 5 });
|
|
37
|
+
await sleep(300);
|
|
38
|
+
assert.equal(crashLoop.bridge.supervised.length, 0, 'the exited child must not linger as supervised');
|
|
39
|
+
assert.equal(restarted(crashLoop.events), 0, 'a sixth quick exit must not schedule a restart');
|
|
40
|
+
assert.equal(gaveUp(crashLoop.events), 1, 'a sixth quick exit must give up');
|
|
41
|
+
await crashLoop.bridge.stopSupervised();
|
|
42
|
+
|
|
43
|
+
// A service that ran stably before exiting must respawn with a fresh counter.
|
|
44
|
+
const stable = supervisedBridge();
|
|
45
|
+
const linger = path.join(root, 'linger.js');
|
|
46
|
+
fs.writeFileSync(linger, 'setTimeout(() => process.exit(0), 50);');
|
|
47
|
+
const spawnedSpecs = [];
|
|
48
|
+
const spawnOriginal = stable.bridge._spawnSupervised.bind(stable.bridge);
|
|
49
|
+
stable.bridge._spawnSupervised = spec => { spawnedSpecs.push(spec); return spawnOriginal(spec); };
|
|
50
|
+
stable.bridge._spawnSupervised({ name: 'fixture', command: `node ${JSON.stringify(linger)}`, _attempts: 5, _stableAfterMs: 0 });
|
|
51
|
+
await sleep(300);
|
|
52
|
+
assert.equal(spawnedSpecs.length, 1, 'the first child is the only spawn so far');
|
|
53
|
+
assert.equal(restarted(stable.events), 1, 'a stable exit at the attempt cap must schedule a restart, not give up');
|
|
54
|
+
assert.equal(gaveUp(stable.events), 0, 'a stable exit must never abandon the service');
|
|
55
|
+
await sleep(2000 + 400); // first backoff of a fresh incident: 1000 * 2^1 = 2s
|
|
56
|
+
assert.equal(spawnedSpecs.length, 2, 'the service must have been respawned');
|
|
57
|
+
assert.equal(spawnedSpecs[1]._attempts, 1, 'the respawn opens a fresh incident instead of inheriting the old count');
|
|
58
|
+
assert.equal(gaveUp(stable.events), 0, 'the respawned service must not be abandoned');
|
|
59
|
+
await stable.bridge.stopSupervised();
|
|
60
|
+
|
|
61
|
+
console.log('module supervisor backoff reset test PASS');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
main().catch(error => { console.error(error); process.exitCode = 1; });
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// MEM-HOME — 首页待确认记忆直达审核。
|
|
3
|
+
//
|
|
4
|
+
// 迁移说明(五页简化 UI):
|
|
5
|
+
// - 首页不再罗列项目:导入成功的可见面改为顶栏 #projectSelect 的选项。
|
|
6
|
+
// - 首页候选行的审核入口改为 data-action="review-candidate"(data-id 绑定
|
|
7
|
+
// 具体候选),与「长期记忆」页候选箱共用 reviewCandidate() 的
|
|
8
|
+
// #appDialog 审核对话框;确认动作为表单提交(reviewForm 的提交按钮)。
|
|
9
|
+
// - 冻结依据的展示从「原始总结」字段改为「查看原始依据(冻结原文)」
|
|
10
|
+
// 折叠块;确认后面板空态文案为「没有待确认的记忆」。
|
|
11
|
+
//
|
|
12
|
+
// The home「待确认记忆」panel names a candidate memory, so it must be an
|
|
13
|
+
// entry into review, not a read-only preview: one real pointer click on the
|
|
14
|
+
// candidate row must open the review dialog for THAT exact candidate — text,
|
|
15
|
+
// scope and frozen evidence included — and the confirm action in the dialog
|
|
16
|
+
// must complete the handling without ever visiting the memory view. The old
|
|
17
|
+
// shell offered only a generic「查看候选箱」jump, leaving the user to find
|
|
18
|
+
// the candidate again in the full list.
|
|
19
|
+
//
|
|
20
|
+
// The regression drives the real product UI in a real browser against an
|
|
21
|
+
// isolated instance (own port, own data dir, own knowledge dir, own Bridge
|
|
22
|
+
// journal, own browser profile). The candidate is produced by the REAL
|
|
23
|
+
// pipeline — a real follow-up commit, a real conversation event, a real
|
|
24
|
+
// maintenance run, the real eligibility gate — so the home panel lists what
|
|
25
|
+
// the engine really stored. Every pointer action is a CDP
|
|
26
|
+
// Input.dispatchMouseEvent on the real coordinates of the real control, and
|
|
27
|
+
// 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-memory-shell');
|
|
37
|
+
|
|
38
|
+
const EVIDENCE = process.env.PK_TEST_EVIDENCE_DIR ? path.resolve(process.env.PK_TEST_EVIDENCE_DIR) : null;
|
|
39
|
+
|
|
40
|
+
const CANDIDATE_TEXT = '对外错误信息使用中文表述,并优先复用已有模块。';
|
|
41
|
+
|
|
42
|
+
/** Record every click the page really receives on the home review entry. */
|
|
43
|
+
async function installHomeReviewClickRecorder(harness) {
|
|
44
|
+
await harness.run(`(() => {
|
|
45
|
+
window.__homeReviewClicks = [];
|
|
46
|
+
if (!window.__homeReviewHooked) {
|
|
47
|
+
window.__homeReviewHooked = true;
|
|
48
|
+
document.addEventListener('click', event => {
|
|
49
|
+
const button = event.target.closest ? event.target.closest('#homeContent [data-action="review-candidate"]') : null;
|
|
50
|
+
if (button) window.__homeReviewClicks.push({
|
|
51
|
+
trusted: event.isTrusted === true,
|
|
52
|
+
memoryId: button.getAttribute('data-id'),
|
|
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: 'memhome', 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, 'memhome-repo', { 'README.md': '# 首页候选\n' });
|
|
67
|
+
const { projectId } = await harness.importProject(repo, '首页候选甲');
|
|
68
|
+
await harness.requestRegistryRefresh();
|
|
69
|
+
await harness.waitFor(
|
|
70
|
+
() => harness.run("document.getElementById('projectSelect').textContent.includes('首页候选甲')"),
|
|
71
|
+
'the imported project is listed',
|
|
72
|
+
20000,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// A real candidate through the real pipeline (commit + event + run + gate).
|
|
76
|
+
const produced = await harness.produceCandidate({ repo, projectId, text: CANDIDATE_TEXT, scopeType: 'global' });
|
|
77
|
+
assert.equal(produced.capture.accepted, 1, `the real run admitted one candidate: ${JSON.stringify(produced.capture)}`);
|
|
78
|
+
const stored = (await harness.productMemories()).find(m => m.text === CANDIDATE_TEXT);
|
|
79
|
+
assert.ok(stored, 'the candidate really exists in the engine');
|
|
80
|
+
assert.equal(stored.status, 'candidate', 'the stored candidate is still pending review');
|
|
81
|
+
|
|
82
|
+
await installHomeReviewClickRecorder(harness);
|
|
83
|
+
|
|
84
|
+
// MEM-HOME expected 1: the home panel not only names the candidate, it
|
|
85
|
+
// exposes a per-item review entry bound to that exact memory.
|
|
86
|
+
await harness.requestRegistryRefresh();
|
|
87
|
+
await harness.waitFor(
|
|
88
|
+
() => harness.run(`(() => {
|
|
89
|
+
const button = document.querySelector('#homeContent [data-action="review-candidate"]');
|
|
90
|
+
if (!button) return false;
|
|
91
|
+
const panel = button.closest('section.panel');
|
|
92
|
+
const row = button.closest('.row');
|
|
93
|
+
return panel && panel.querySelector('h2').textContent.includes('待确认记忆')
|
|
94
|
+
&& row && row.textContent.includes(${JSON.stringify(CANDIDATE_TEXT)})
|
|
95
|
+
&& button.getAttribute('data-id') === ${JSON.stringify(stored.id)};
|
|
96
|
+
})()`),
|
|
97
|
+
'the home 待确认记忆 panel offers a review entry for the exact candidate',
|
|
98
|
+
20000,
|
|
99
|
+
);
|
|
100
|
+
await harness.browser.screenshot(path.join(harness.evidence, 'memhome-home-review-entry.png'));
|
|
101
|
+
|
|
102
|
+
// MEM-HOME expected 2: one trusted pointer click opens the review dialog
|
|
103
|
+
// for that exact candidate, straight from the home view.
|
|
104
|
+
await harness.nativeClick('#homeContent [data-action="review-candidate"]');
|
|
105
|
+
const clicks = await harness.run('window.__homeReviewClicks || []');
|
|
106
|
+
assert.ok(clicks.length >= 1, 'the page really received the home review click');
|
|
107
|
+
const click = clicks[clicks.length - 1];
|
|
108
|
+
assert.equal(click.trusted, true, `the click the page received is a trusted browser event: ${JSON.stringify(click)}`);
|
|
109
|
+
assert.equal(click.memoryId, stored.id, `the click is bound to the exact candidate: ${JSON.stringify(click)}`);
|
|
110
|
+
|
|
111
|
+
await harness.waitFor(
|
|
112
|
+
() => harness.run(`(() => document.getElementById('appDialog').open === true
|
|
113
|
+
&& document.getElementById('appDialogTitle').textContent.includes('审核候选记忆')
|
|
114
|
+
&& document.getElementById('appDialogBody').textContent.includes(${JSON.stringify(CANDIDATE_TEXT)}))()`),
|
|
115
|
+
'the review dialog opens with the exact candidate',
|
|
116
|
+
10000,
|
|
117
|
+
);
|
|
118
|
+
const dialogText = await harness.run("document.getElementById('appDialog').textContent");
|
|
119
|
+
assert.ok(dialogText.includes('原始依据'), `the dialog carries the frozen source evidence: ${dialogText.slice(0, 120)}`);
|
|
120
|
+
await harness.browser.screenshot(path.join(harness.evidence, 'memhome-review-dialog.png'));
|
|
121
|
+
|
|
122
|
+
// MEM-HOME expected 3: the handling completes in place — confirm inside
|
|
123
|
+
// the dialog, and the home panel itself reflects the resolved candidate.
|
|
124
|
+
await harness.nativeClick('#appDialogActions button[type="submit"]');
|
|
125
|
+
await harness.waitFor(
|
|
126
|
+
() => harness.run("document.getElementById('appDialog').open === false"),
|
|
127
|
+
'the review dialog closes after confirming',
|
|
128
|
+
10000,
|
|
129
|
+
);
|
|
130
|
+
await harness.waitFor(
|
|
131
|
+
() => harness.run(`(() => document.getElementById('homeContent').textContent.includes('没有待确认的记忆')
|
|
132
|
+
&& !document.querySelectorAll('#homeContent [data-action="review-candidate"]').length)()`),
|
|
133
|
+
'the home panel no longer offers the confirmed candidate for review',
|
|
134
|
+
20000,
|
|
135
|
+
);
|
|
136
|
+
const confirmed = (await harness.productMemories()).find(m => m.id === stored.id);
|
|
137
|
+
assert.equal(confirmed.status, 'confirmed', `the engine really holds the confirmed memory: ${JSON.stringify(confirmed.status)}`);
|
|
138
|
+
await harness.browser.screenshot(path.join(harness.evidence, 'memhome-confirmed-home.png'));
|
|
139
|
+
|
|
140
|
+
assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
|
|
141
|
+
|
|
142
|
+
console.log('parallel-memory-home-review-test PASS (the home 待确认记忆 entry opens the exact candidate for review and confirm completes in place)');
|
|
143
|
+
} finally {
|
|
144
|
+
await harness.cleanup();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
main().catch(error => { console.error(error.stack || error.message); process.exitCode = 1; });
|
|
@@ -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; });
|
|
@@ -48,6 +48,11 @@ const REGISTER_TIMEOUT_MS = 60000;
|
|
|
48
48
|
const INDEX_TIMEOUT_MS = 120000;
|
|
49
49
|
// Native folder dialogs wait for the user without a bound.
|
|
50
50
|
const PICKER_TIMEOUT_MS = 10 * 60 * 1000;
|
|
51
|
+
// A supervised service that stayed up this long proved a healthy run: its next
|
|
52
|
+
// exit opens a fresh incident instead of accumulating toward the restart cap.
|
|
53
|
+
// Without this, one-off exits spread over weeks eventually abandoned a module
|
|
54
|
+
// while the shell kept proxying to its dead port (endless MODULE_UNREACHABLE).
|
|
55
|
+
const SUPERVISOR_STABLE_MS = 60_000;
|
|
51
56
|
|
|
52
57
|
// All four services resolve through the host's pinned npm dependencies.
|
|
53
58
|
const MODULE_ENTRIES = {
|
|
@@ -799,6 +804,7 @@ class ModuleBridge {
|
|
|
799
804
|
const parts = (spec.command.match(/"[^"]+"|\S+/g) || [])
|
|
800
805
|
.map(part => { if (!part.startsWith('"') || !part.endsWith('"')) return part; try { return JSON.parse(part); } catch { return part.slice(1, -1); } });
|
|
801
806
|
const nodeProcess = parts[0] === 'node' || parts[0] === process.execPath;
|
|
807
|
+
const spawnedAt = Date.now();
|
|
802
808
|
const child = spawn(nodeProcess ? process.execPath : parts[0], parts.slice(1), {
|
|
803
809
|
// Module banners (ports, data roots) are diagnostics — inherit stdout
|
|
804
810
|
// so they land on the console in --fg mode and in launcher.log when the
|
|
@@ -822,14 +828,18 @@ class ModuleBridge {
|
|
|
822
828
|
child.on('exit', code => {
|
|
823
829
|
this.onStateChange?.(spec.name);
|
|
824
830
|
this.supervised = this.supervised.filter(existing => existing !== child);
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
831
|
+
// A stable run (see SUPERVISOR_STABLE_MS) means the prior exits belong to
|
|
832
|
+
// bygone incidents: count this exit as the first of a fresh one. Only a
|
|
833
|
+
// service that keeps dying quickly accumulates toward the give-up cap.
|
|
834
|
+
const stable = Date.now() - spawnedAt >= (spec._stableAfterMs ?? SUPERVISOR_STABLE_MS);
|
|
835
|
+
const incidentAttempts = stable ? 1 : attempts + 1;
|
|
836
|
+
if (incidentAttempts > 5 || this.stopped) {
|
|
837
|
+
this.logger.warn('modules.supervisor', 'Module service stopped.', { context: { name: spec.name, code, attempts: incidentAttempts } });
|
|
828
838
|
return;
|
|
829
839
|
}
|
|
830
|
-
const delay = Math.min(1000 * 2 **
|
|
831
|
-
this.logger.warn('modules.supervisor', 'Module service exited; restarting.', { context: { name: spec.name, code, retryInMs: delay } });
|
|
832
|
-
const timer = setTimeout(() => { this.restartTimers.delete(timer); this._spawnSupervised({ ...spec, _attempts:
|
|
840
|
+
const delay = Math.min(1000 * 2 ** incidentAttempts, 15000);
|
|
841
|
+
this.logger.warn('modules.supervisor', 'Module service exited; restarting.', { context: { name: spec.name, code, attempts: incidentAttempts, retryInMs: delay } });
|
|
842
|
+
const timer = setTimeout(() => { this.restartTimers.delete(timer); this._spawnSupervised({ ...spec, _attempts: incidentAttempts }); }, delay);
|
|
833
843
|
this.restartTimers = this.restartTimers || new Set(); this.restartTimers.add(timer);
|
|
834
844
|
});
|
|
835
845
|
this.supervised.push(child);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"productFiles": {
|
|
4
4
|
"ui/index.html": "2e89f6fc40b9c01098a536433aae62e9dbe4c72da0678ab1219d65c79e7a666c",
|
|
5
5
|
"ui/knowledge-panel.html": "dfd85f15759472252d797853263e9da0054b251c56bb9ccdc8a75e6301334ca8",
|
|
6
|
-
"ui/product.js": "
|
|
6
|
+
"ui/product.js": "952256f52aa4b371fd6756f5d4479086c9782fb16d66c6ee0235b0c0adee76d6",
|
|
7
7
|
"ui/live-client.js": "0d81fa894c629bb839e1931fc3c5ebad4d831aae8232d6ce8c0f542e9e3559e8",
|
|
8
8
|
"ui/product.css": "b7e2e6b1c1429078109e7742111f03a01a61f54895cf8ac733b83672cf31dca7",
|
|
9
9
|
"ui/favicon.svg": "c48be946b224112ebb0238b44263f7a61bda31e531afa895c2e9801c0ff24f32",
|
|
@@ -11,9 +11,9 @@
|
|
|
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": "
|
|
15
|
-
"plugins/project-knowledge/.codex-plugin/plugin.json": "
|
|
16
|
-
"plugins/project-knowledge/.mcp.json": "
|
|
14
|
+
"plugins/project-knowledge/.claude-plugin/plugin.json": "4f32f5320cd7a7152bd0ca7de5ccc5e5ebd4c162b13f91f9f5afc53c0592ff7c",
|
|
15
|
+
"plugins/project-knowledge/.codex-plugin/plugin.json": "531bec48f91696f416475bd99f05a77871a6b2996eaba9180e0a0289691f7528",
|
|
16
|
+
"plugins/project-knowledge/.mcp.json": "bc4ce08acb57097dfc21785150c0a37597f60c6ca98f320098ce1959b4a2bd09",
|
|
17
17
|
"ui/version-info.js": "01a82217b031de54b80d6c7974da9c70888c4c90a046bd4248a808f7989ddce7",
|
|
18
18
|
"ui/version-info.css": "209fad8e42b661f72d2aba3280e1ca47768b5cefb776fe5459538d34fbad120f"
|
|
19
19
|
},
|
package/package.json
CHANGED
|
@@ -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.
|
|
5
|
+
"version": "5.0.35",
|
|
6
6
|
"description": "Read durable project decisions and implementation history from Project Knowledge.",
|
|
7
7
|
"author": {
|
|
8
8
|
"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.
|
|
11
|
+
"KB_PLUGIN_VERSION": "5.0.35"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
package/ui/product.js
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
detailGroups: { detail: null, epoch: 0 },
|
|
27
27
|
search: { q: '', draft: '', projectId: '', scope: 'brain', type: 'all', done: false, results: [], page: 0, loading: false, epoch: 0 },
|
|
28
28
|
activityFilter: 'all', activityTab: 'updates', activityProject: null, activityBefore: null, activityPage: null, runDetails: new Map(),
|
|
29
|
+
pendingOpenRun: '',
|
|
29
30
|
};
|
|
30
31
|
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
31
32
|
const activeProject = () => state.projects.find(p => p.projectId === state.projectId);
|
|
@@ -275,7 +276,7 @@
|
|
|
275
276
|
render();
|
|
276
277
|
}
|
|
277
278
|
function needRow(item) {
|
|
278
|
-
if (item.kind === 'run') return `<div class="row"><div><b>${esc(item.title)} · ${esc(projectName(item.projectId))}</b><small>${esc(item.commitSha?.slice(0, 8) || '')} ${esc(item.error?.message || '')}</small></div>${badge(recoveryLabel(item) || '需要处理', 'issue')}
|
|
279
|
+
if (item.kind === 'run') return `<div class="row"><div><b>${esc(item.title)} · ${esc(projectName(item.projectId))}</b><small>${esc(item.commitSha?.slice(0, 8) || '')} ${esc(item.error?.message || '')}</small></div>${badge(recoveryLabel(item) || '需要处理', 'issue')}<button data-open-run="${esc(item.runId)}" data-run-project="${esc(item.projectId)}">去处理</button></div>`;
|
|
279
280
|
if (item.kind === 'journal') return `<div class="row"><div><b>提交事件消费受阻</b><small>${esc(item.journalId)} · ${esc(item.message)}</small></div>${badge('需要处理', 'issue')}</div>`;
|
|
280
281
|
if (item.kind === 'late-commit') return `<div class="row"><div><b>晚到的旧提交待受控处理</b><small>${esc(projectName(item.projectId))} · ${esc(String(item.commitSha || '').slice(0, 12))}</small></div>${badge('需要处理', 'issue')}</div>`;
|
|
281
282
|
if (item.kind === 'scope-index') return `<div class="row"><div><b>共享知识索引待恢复</b><small>${esc(item.name)} · ${esc(item.message)}</small></div>${badge('需要处理', 'issue')}</div>`;
|
|
@@ -585,8 +586,21 @@
|
|
|
585
586
|
body += nav;
|
|
586
587
|
}
|
|
587
588
|
$('activityUpdates').innerHTML = filterBar + body;
|
|
589
|
+
applyPendingOpenRun();
|
|
588
590
|
renderMaintenanceWarning();
|
|
589
591
|
}
|
|
592
|
+
// A home「去处理」click must land on its exact run even though the activity
|
|
593
|
+
// list re-renders from several async sources (snapshot refresh, SSE, older-
|
|
594
|
+
// page loads): the pending id survives those renders and is applied once
|
|
595
|
+
// the row really exists, so the race can never swallow the expansion.
|
|
596
|
+
function applyPendingOpenRun() {
|
|
597
|
+
if (!state.pendingOpenRun) return;
|
|
598
|
+
const row = document.querySelector(`details.run[data-run-id="${CSS.escape(state.pendingOpenRun)}"]`);
|
|
599
|
+
if (!row) return;
|
|
600
|
+
state.pendingOpenRun = '';
|
|
601
|
+
if (!row.open) row.open = true;
|
|
602
|
+
row.scrollIntoView({ block: 'center' });
|
|
603
|
+
}
|
|
590
604
|
function renderMaintenanceWarning() {
|
|
591
605
|
const warning = maintenanceWarning();
|
|
592
606
|
if (warning) {
|
|
@@ -603,6 +617,22 @@
|
|
|
603
617
|
}
|
|
604
618
|
}
|
|
605
619
|
let activityEpoch = 0;
|
|
620
|
+
// The home「需要处理」panel is an entry into handling, not a read-only
|
|
621
|
+
// preview: one click opens the exact failed run in the activity view —
|
|
622
|
+
// expanded, details loading, retry within reach — instead of leaving the
|
|
623
|
+
// user to hunt for the record the home page already named.
|
|
624
|
+
async function openRunDetail(runId, projectId) {
|
|
625
|
+
state.activityTab = 'updates';
|
|
626
|
+
state.pendingOpenRun = runId;
|
|
627
|
+
if (projectId && projectId !== state.projectId) selectProject(projectId);
|
|
628
|
+
setView('activity');
|
|
629
|
+
await loadActivityPage();
|
|
630
|
+
applyPendingOpenRun();
|
|
631
|
+
if (!document.querySelector(`details.run[data-run-id="${CSS.escape(runId)}"]`)) {
|
|
632
|
+
state.pendingOpenRun = '';
|
|
633
|
+
toast('这条记录不在最近一页运行中,请从活动记录列表手动查找。');
|
|
634
|
+
}
|
|
635
|
+
}
|
|
606
636
|
async function loadActivityPage(before = state.activityBefore) {
|
|
607
637
|
const epoch = ++activityEpoch, projectId = state.projectId;
|
|
608
638
|
if (!projectId) return;
|
|
@@ -1265,6 +1295,7 @@
|
|
|
1265
1295
|
if (button.dataset.agentSwitch) await changeAgentAccess(button.dataset.agentClient, button.dataset.agentSwitch);
|
|
1266
1296
|
if (button.dataset.agentRetry) await retryAgentRepair(button.dataset.agentClient);
|
|
1267
1297
|
if (button.dataset.action === 'unbind') { const p = activeProject(); if (p && !unbinding) { unbindProjectId = p.projectId; $('unbindProjectName').textContent = `解绑「${p.name}」?`; $('unbindFeedback').textContent = ''; $('unbindDialog').showModal(); } }
|
|
1298
|
+
if (button.dataset.openRun) await openRunDetail(button.dataset.openRun, button.dataset.runProject || '');
|
|
1268
1299
|
if (button.dataset.retryRun) { await api(`/api/engine/runs/${encodeURIComponent(button.dataset.retryRun)}/retry`, { method: 'POST', body: {} }); await refreshSnapshot(); toast('已重新执行失败阶段。'); }
|
|
1269
1300
|
if (button.dataset.runPage !== undefined) await loadActivityPage(button.dataset.runPage || null);
|
|
1270
1301
|
if (button.dataset.action === 'toast-undo') { const undo = toastUndo; toastUndo = null; $('toast').hidden = true; await undo?.(); }
|