@sanqianx/project-knowledge 5.0.1 → 5.0.3
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 +25 -0
- package/README.md +5 -0
- package/_modules/knowledge-engine/README.md +2 -0
- package/_modules/knowledge-engine/package.json +1 -1
- package/_modules/knowledge-engine/src/analysis-contract.js +3 -1
- package/_modules/knowledge-engine/src/analysis-output.js +52 -0
- package/_modules/knowledge-engine/src/coordinator.js +14 -4
- package/_modules/knowledge-engine/src/diagnostics.js +37 -0
- package/_modules/knowledge-engine/src/headless-analyzer.js +4 -18
- package/_modules/knowledge-engine/src/runtime/commit-reconciler.js +1 -1
- package/_site/_test/agent-capture-ui-test.js +85 -0
- package/_site/_test/module-process-lifecycle-test.js +11 -0
- package/_site/_test/zcode-capture-integration-test.js +107 -0
- package/_site/lib/integration-installer.js +74 -33
- package/_site/lib/module-bridge.js +7 -0
- package/_site/lib/server-app.js +9 -8
- package/bin/project-knowledge-integrations.js +13 -2
- package/docs/README.zh-CN.md +17 -0
- package/module-runtime-manifest.json +28 -27
- package/package.json +3 -3
- 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/index.html +1 -0
- package/ui/product.css +1 -0
- package/ui/product.js +33 -1
- package/vendor-manifest.json +9 -7
package/ui/product.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
const label = run => ({ queued: '排队', running: '维护中', succeeded: '已更新 · 可检索', 'index-pending': '知识已更新 · 索引待修复', failed: '维护失败', cancelled: '已取消' })[run.state] || run.state;
|
|
20
20
|
const badge = (text, status = '') => `<span class="status ${esc(status)}">${esc(text)}</span>`;
|
|
21
21
|
let toastTimer, refreshTimer, preflightTimer, editingMemoryId, logStream, logEpoch = 0, referenceEpoch = 0, snapshotEpoch = 0, registryEpoch = 0, registryPromise = null, resumeImport = false, unbindProjectId = '', unbinding = false;
|
|
22
|
+
let captureEpoch = 0, captureBusy = false;
|
|
22
23
|
async function api(url, options = {}) {
|
|
23
24
|
const { allowNotReady, ...init } = options;
|
|
24
25
|
if (init.body && typeof init.body !== 'string') init.body = JSON.stringify(init.body);
|
|
@@ -182,7 +183,35 @@
|
|
|
182
183
|
async function openSystem() {
|
|
183
184
|
$('systemDrawer').hidden = false; $('drawerBackdrop').hidden = false;
|
|
184
185
|
$('brainName').value = state.brain.name; $('knowledgeRoot').value = state.root;
|
|
185
|
-
await loadMaintenance();
|
|
186
|
+
await Promise.all([loadMaintenance(), loadAgentCapture()]);
|
|
187
|
+
}
|
|
188
|
+
async function loadAgentCapture() {
|
|
189
|
+
const epoch = ++captureEpoch;
|
|
190
|
+
try {
|
|
191
|
+
const result = await api('/api/integrations/status?captureOnly=1');
|
|
192
|
+
if (epoch !== captureEpoch) return;
|
|
193
|
+
$('agentCaptureList').innerHTML = result.clients.map(agent => {
|
|
194
|
+
const capture = agent.developmentCapture;
|
|
195
|
+
const found = agent.available || agent.configFound;
|
|
196
|
+
const software = agent.available ? '检测到命令' : agent.configFound ? '检测到配置' : '未检测到';
|
|
197
|
+
const status = !capture.ok ? '接线异常' : capture.installed ? '已配置采集' : '未接入';
|
|
198
|
+
return `<div class="agent-capture-row"><div><b>${esc(agent.label)}</b><small>${esc(software)} · ${esc(status)}</small><small>${esc(capture.detail)}</small></div><div class="actions"><button data-agent-capture="install" data-agent-client="${esc(agent.client)}" ${!found || captureBusy ? 'disabled' : ''}>${capture.installed ? '修复' : '接入'}</button>${capture.installed ? `<button data-agent-capture="uninstall" data-agent-client="${esc(agent.client)}" ${captureBusy ? 'disabled' : ''}>移除采集</button>` : ''}</div></div>`;
|
|
199
|
+
}).join('');
|
|
200
|
+
} catch (error) { if (epoch === captureEpoch) $('agentCaptureList').textContent = `无法检查采集状态:${error.message}`; }
|
|
201
|
+
}
|
|
202
|
+
async function changeAgentCapture(client, operation) {
|
|
203
|
+
if (captureBusy) return;
|
|
204
|
+
captureBusy = true; captureEpoch++;
|
|
205
|
+
all('[data-agent-capture]').forEach(button => { button.disabled = true; });
|
|
206
|
+
$('agentCaptureFeedback').textContent = operation === 'install' ? '正在配置采集 Hook…' : '正在移除托管采集,已有记录保留…';
|
|
207
|
+
try {
|
|
208
|
+
const result = await api(`/api/integrations/${operation}`, { method: 'POST', body: { clients: [client], captureOnly: true } });
|
|
209
|
+
const capture = operation === 'install' ? result.clients[0]?.developmentCapture : result.capture[0];
|
|
210
|
+
const success = result.complete === true && capture?.ok;
|
|
211
|
+
$('agentCaptureFeedback').textContent = success ? operation === 'install' ? '采集配置已保存。请重新打开外部 Agent 会话,实际记录可在活动页面查看。' : '已移除托管采集,第三方配置与已有记录保留。' : `接入操作未完成:${capture?.detail || result.bridge?.detail || '请检查系统诊断记录。'}\n操作 ID:${result.operationId || '—'}`;
|
|
212
|
+
$('agentCaptureFeedback').classList.toggle('issue', !success);
|
|
213
|
+
} catch (error) { $('agentCaptureFeedback').textContent = `操作失败:${error.message}`; $('agentCaptureFeedback').classList.add('issue'); }
|
|
214
|
+
finally { captureBusy = false; await loadAgentCapture(); post('eventBridge', { type: 'kb:refresh-agents' }); }
|
|
186
215
|
}
|
|
187
216
|
async function loadLogs() {
|
|
188
217
|
const epoch = ++logEpoch;
|
|
@@ -307,6 +336,7 @@
|
|
|
307
336
|
if (button.dataset.action === 'import') openImport();
|
|
308
337
|
if (button.dataset.action === 'repair') await repair();
|
|
309
338
|
if (button.dataset.action === 'system') await openSystem();
|
|
339
|
+
if (button.dataset.agentCapture) await changeAgentCapture(button.dataset.agentClient, button.dataset.agentCapture);
|
|
310
340
|
if (button.dataset.action === 'unbind') { const p = activeProject(); if (p && !unbinding) { unbindProjectId = p.projectId; $('unbindProjectName').textContent = `解绑「${p.name}」?`; $('unbindFeedback').textContent = ''; $('unbindDialog').showModal(); } }
|
|
311
341
|
if (button.dataset.retryRun) { await api(`/api/engine/runs/${encodeURIComponent(button.dataset.retryRun)}/retry`, { method: 'POST', body: {} }); await refreshSnapshot(); }
|
|
312
342
|
if (button.dataset.contextIndex !== undefined) await openReference(state.contexts.get(state.projectId).references[Number(button.dataset.contextIndex)]);
|
|
@@ -325,6 +355,7 @@
|
|
|
325
355
|
if (event.origin !== location.origin || !event.data || typeof event.data !== 'object') return;
|
|
326
356
|
const key = Object.keys(frames).find(k => $(frames[k].id).contentWindow === event.source); if (!key) return;
|
|
327
357
|
const message = event.data;
|
|
358
|
+
if (message.type === 'kb:open-integrations' && key === 'eventBridge') { openSystem().then(() => $('agentCaptureSection').scrollIntoView({ block: 'start' })).catch(error => toast(error.message)); return; }
|
|
328
359
|
if (message.type === 'kb:ready') { frames[key].ready = true; frameContext(key); if (frames[key].openSettings) { post(key, { type: 'kb:open-settings' }); frames[key].openSettings = false; } }
|
|
329
360
|
if (message.requestId && message.requestId !== frames[key].requestId) return;
|
|
330
361
|
if (message.type === 'kb:knowledge' && key === 'terminal') {
|
|
@@ -336,6 +367,7 @@
|
|
|
336
367
|
on('themeToggle', 'click', () => { document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark'; localStorage.setItem('kb.theme', document.documentElement.dataset.theme); Object.keys(frames).forEach(key => post(key, { type: 'kb:theme', theme: document.documentElement.dataset.theme })); });
|
|
337
368
|
on('openSystem', 'click', openSystem); on('closeSystem', 'click', closeSystem); on('drawerBackdrop', 'click', closeSystem);
|
|
338
369
|
on('repairWiring', 'click', repair);
|
|
370
|
+
on('refreshAgentCapture', 'click', () => captureBusy ? undefined : loadAgentCapture());
|
|
339
371
|
on('configureProviders', 'click', () => { closeSystem(); setView('work'); initializeFrame('terminal'); if (frames.terminal.ready) post('terminal', { type: 'kb:open-settings' }); else frames.terminal.openSettings = true; });
|
|
340
372
|
on('saveMaintenance', 'click', async () => { await api('/api/terminal/maintenance-default', { method: 'PUT', body: { profileId: $('maintenanceModel').value || null } }); const result = await api('/api/modules/configure', { method: 'POST', body: {} }); $('configurationStatus').textContent = result.configuration.model ? '后台默认模型已保存并同步。' : '配置已保存,后台运行配置尚未同步,请检查模块连接。'; });
|
|
341
373
|
on('openEmbedding', 'click', openEmbedding);
|
package/vendor-manifest.json
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
"modules": {
|
|
4
4
|
"knowledge-engine": {
|
|
5
5
|
"name": "@sanqianx/ai-coding-knowledge-engine",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.1",
|
|
7
7
|
"root": "_modules/knowledge-engine",
|
|
8
8
|
"files": {
|
|
9
|
-
"README.md": "
|
|
10
|
-
"package.json": "
|
|
11
|
-
"src/analysis-contract.js": "
|
|
9
|
+
"README.md": "236dafd8092e13ab731d4a14548e04c4ad3126bdfa63c706a6afe6f9b1dc535d",
|
|
10
|
+
"package.json": "f7a91e96c77d62aeee4d0dc9b4da327bf615f07d18b1882c305de556cd9ffb65",
|
|
11
|
+
"src/analysis-contract.js": "fee063967d32eefc955cf0729f7dc8cb31bd690b85e22471c9059494a599c77a",
|
|
12
|
+
"src/analysis-output.js": "95a3c19dcc9ab85d1dba7fee5b9aec80f9c000dfba89da3fd0be25a81e2fb680",
|
|
12
13
|
"src/analysis-worker.js": "a105cabe6e1573b2d986b1e7a5aaf615e2fb53524156fc8e4e2c0a71f2c97e55",
|
|
13
14
|
"src/bin.js": "22208907431d0f3a971a669c7e5eb44b3b7af9bbb36fd7ba17c3b90c4288bd70",
|
|
14
15
|
"src/bridge-client.js": "ae0dba21e4286694bcd9e064ca36564ec997969ae1eb1ce4f8a6665e447cbffe",
|
|
15
|
-
"src/coordinator.js": "
|
|
16
|
-
"src/
|
|
16
|
+
"src/coordinator.js": "c31a7274cc808bc99f2aa15f2611e55f0d0096b9c1273f20de683f5102d83074",
|
|
17
|
+
"src/diagnostics.js": "1ad8b21e0f26d7c18861d51c711a6d36e5070658205cab19727494279f0801e4",
|
|
18
|
+
"src/headless-analyzer.js": "cfe54b392b2aff6e2c5157481dfeb5ccebc4ce83d1d74aa44f28cf2eb923b013",
|
|
17
19
|
"src/memories.js": "0a8667e6daba99fa5022393951a28e96cdadf98af85b6af9a6be96c7f4e896fc",
|
|
18
20
|
"src/retrieval.js": "acbf76bb93fd13dac391c2e918891a56ace869db5583d2a5994641b6782496d6",
|
|
19
21
|
"src/runtime/README.md": "9be676eca76a7857b34d7357194e6f0ee733c22e61d962d53984715dbec7f673",
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
"src/runtime/commit-conversation-binder.js": "4f5a7a13c3dfac3765ad70e54de351f5d81e0ed4b2b2d7ecb90ef77cb29e0c15",
|
|
23
25
|
"src/runtime/commit-processing-ledger.js": "455aa1ac4e212c0b63d9df99e49aa94703cd24145e41aa9794f16274b2ec2e18",
|
|
24
26
|
"src/runtime/commit-prompt.js": "11856175a405c00514add6a540324a0efe3d7e5dd872c9e8a0b77f9f40abc551",
|
|
25
|
-
"src/runtime/commit-reconciler.js": "
|
|
27
|
+
"src/runtime/commit-reconciler.js": "41d0bafe43692cf37ac4e9c4b81a8bcfd828ca849cbe20d9fede237b6d001c69",
|
|
26
28
|
"src/runtime/content-hash.js": "201ee7dcc054310f14097a00058cf9b28fa913367eef616e0fdd8facbf3c6c41",
|
|
27
29
|
"src/runtime/contracts.js": "567fbace85ad0534fb0119f5c0e57d73acc0b76cc799af93d778c5ecbade53df",
|
|
28
30
|
"src/runtime/conversation-exclusions.js": "ef8545034b862d384fb460140490bb531b58d94992f5e2222ebaaa079b44fa63",
|