@sanqianx/project-knowledge 5.0.35 → 5.1.0
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/_site/_test/chat-claudecodeui-match-test.js +1 -1
- package/_site/_test/integration-runtime-binding-test.js +1 -1
- package/_site/_test/mcp-server-test.js +149 -149
- package/_site/_test/packaged-ui-smoke-test.js +1 -1
- package/_site/_test/parallel-nav-theme-test.js +5 -4
- package/_site/_test/parallel-nav-viewport-test.js +4 -2
- package/_site/_test/product-empty-state-test.js +2 -2
- package/_site/_test/product-navigation-test.js +2 -2
- package/_site/_test/workflow-module-wiring-test.js +102 -0
- package/_site/_test/workflow-tools-test.js +97 -0
- package/_site/_test/workspace-ui-contract-test.js +16 -3
- package/_site/lib/integration-installer.js +3 -1
- package/_site/lib/module-bridge.js +42 -4
- package/_site/lib/server-app.js +12 -0
- package/_site/lib/workflow-tool-runtime.js +209 -0
- package/bin/project-knowledge-mcp.js +282 -201
- package/module-runtime-manifest.json +5 -5
- 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/plugins/project-knowledge/skills/pk-team/SKILL.md +35 -0
- package/ui/index.html +6 -0
- package/ui/product.js +81 -11
package/ui/product.js
CHANGED
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
const $ = id => document.getElementById(id);
|
|
4
4
|
const ProgressSource = window.KnowledgeLive?.EventSource || EventSource;
|
|
5
5
|
const all = selector => [...document.querySelectorAll(selector)];
|
|
6
|
-
const titles = { home: '首页', memory: '长期记忆', projects: '项目', search: '知识检索', activity: '活动记录' };
|
|
6
|
+
const titles = { home: '首页', team: 'AI 团队', memory: '长期记忆', projects: '项目', search: '知识检索', activity: '活动记录' };
|
|
7
7
|
const modules = { terminal: 'Agent 工作台', vectorHub: '知识索引', eventBridge: '开发事件', engine: '知识引擎' };
|
|
8
|
+
// The workflow module is optional until its public release is pinned: an
|
|
9
|
+
// absent package is "未安装" (informational), never a service failure of
|
|
10
|
+
// the four pinned runtimes, so it renders separately from `modules`.
|
|
8
11
|
// The workbench frame stays as a hidden service mount for provider/model
|
|
9
12
|
// configuration from the system drawer; it is no longer a navigation page.
|
|
10
13
|
const frames = {
|
|
11
14
|
terminal: { id: 'workFrame', url: '/modules/terminal/agent-terminal/?embed=1&apiBase=/api/terminal&transport=live', view: '', ready: false },
|
|
12
15
|
eventBridge: { id: 'bridgeFrame', url: '/modules/eventbridge/?embed=1&apiBase=/api/eventbridge', view: 'activity', ready: false },
|
|
13
16
|
engine: { id: 'engineFrame', url: '/modules/engine/?embed=1&apiBase=/api/engine', ready: false },
|
|
17
|
+
workflow: { id: 'workflowFrame', url: '/workflow-ui/?embed=1&apiBase=/api/workflow', view: 'team', ready: false },
|
|
14
18
|
};
|
|
15
19
|
const knowledgePanel = { providerId: 'kb.knowledge.references', version: 0, registered: false, registering: false, failed: false, error: null, panelId: '', pending: null, sending: null, queued: false, deliveredPanelId: '' };
|
|
16
20
|
const panelRequests = new Map();
|
|
@@ -27,6 +31,7 @@
|
|
|
27
31
|
search: { q: '', draft: '', projectId: '', scope: 'brain', type: 'all', done: false, results: [], page: 0, loading: false, epoch: 0 },
|
|
28
32
|
activityFilter: 'all', activityTab: 'updates', activityProject: null, activityBefore: null, activityPage: null, runDetails: new Map(),
|
|
29
33
|
pendingOpenRun: '',
|
|
34
|
+
teamSummary: { data: null, error: null, loading: false, epoch: 0 },
|
|
30
35
|
};
|
|
31
36
|
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
32
37
|
const activeProject = () => state.projects.find(p => p.projectId === state.projectId);
|
|
@@ -217,9 +222,10 @@
|
|
|
217
222
|
all('.view').forEach(section => section.classList.toggle('active', section.id === `view-${view}`));
|
|
218
223
|
$('pageTitle').textContent = titles[view];
|
|
219
224
|
if (view === 'activity' && state.activityTab === 'sessions' && activeProject()) initializeFrame('eventBridge');
|
|
225
|
+
if (view === 'team') initializeFrame('workflow');
|
|
220
226
|
Object.keys(frames).forEach(key => post(key, { type: 'kb:visibility', visible: frameVisible(key) }));
|
|
221
227
|
render();
|
|
222
|
-
if (view === 'home') void loadOverview();
|
|
228
|
+
if (view === 'home') { void loadOverview(); void loadTeamSummary(); }
|
|
223
229
|
if (view === 'memory') { void loadGroups(); void loadMemoryPage(); void loadCandidates(); }
|
|
224
230
|
if (view === 'projects' && !state.projectsPage.detail) void loadProjectsPage();
|
|
225
231
|
if (view === 'search') renderSearch();
|
|
@@ -275,6 +281,60 @@
|
|
|
275
281
|
if (state.view === 'home') renderHome();
|
|
276
282
|
render();
|
|
277
283
|
}
|
|
284
|
+
// AI 团队跨项目摘要(独立工作流模块)。不可达与未安装分开呈现:未安装
|
|
285
|
+
// 是中性提示(第五模块在正式发布前是可选依赖),不冒充服务故障。
|
|
286
|
+
async function loadTeamSummary() {
|
|
287
|
+
const epoch = ++state.teamSummary.epoch;
|
|
288
|
+
state.teamSummary.loading = true;
|
|
289
|
+
try {
|
|
290
|
+
const [data, activeTasks] = await Promise.all([
|
|
291
|
+
api('/api/workflow/overview'),
|
|
292
|
+
api('/api/workflow/workflow-tasks?limit=5').catch(() => null),
|
|
293
|
+
]);
|
|
294
|
+
if (epoch !== state.teamSummary.epoch) return;
|
|
295
|
+
state.teamSummary.data = data;
|
|
296
|
+
state.teamSummary.tasks = activeTasks && activeTasks.tasks ? activeTasks.tasks.filter(t => !['done', 'cancelled'].includes(t.status)).slice(0, 4) : [];
|
|
297
|
+
state.teamSummary.error = null;
|
|
298
|
+
} catch (error) {
|
|
299
|
+
if (epoch !== state.teamSummary.epoch) return;
|
|
300
|
+
state.teamSummary.data = null; state.teamSummary.tasks = [];
|
|
301
|
+
state.teamSummary.error = error.code === 'MODULE_UNREACHABLE' ? 'MODULE_UNREACHABLE' : error.message;
|
|
302
|
+
} finally {
|
|
303
|
+
if (epoch === state.teamSummary.epoch) state.teamSummary.loading = false;
|
|
304
|
+
}
|
|
305
|
+
if (state.view === 'home') renderHome();
|
|
306
|
+
}
|
|
307
|
+
const TEAM_PHASE_LABEL = { clarify: '明确任务', plan: '规划', implement: '实现', verify: '程序验证', review: '审查', rework: '整改', deliver: '交付' };
|
|
308
|
+
const TEAM_STATUS_LABEL = { draft: '草稿', ready: '就绪', in_progress: '进行中', verifying: '验证中', in_review: '审查中', done: '已交付', blocked: '受阻', cancelled: '已取消' };
|
|
309
|
+
const TEAM_OBS_LABEL = { connected: '有活动', stale: '久无活动', disconnected: '断开', partial: '部分采集', unknown: '未观测' };
|
|
310
|
+
function teamWorkflowRow(task) {
|
|
311
|
+
const satisfied = task.acceptance ? task.acceptance.filter(a => a.status === 'satisfied' || a.status === 'waived').length : 0;
|
|
312
|
+
const rework = task.reworkItems && task.reworkItems.length ? `<span class="badge warn">整改 ${task.reworkItems.length}</span>` : '';
|
|
313
|
+
const obs = task.observation ? TEAM_OBS_LABEL[task.observation.state] || task.observation.state : '';
|
|
314
|
+
return `<div class="row"><div><b>${esc(task.title)}</b><small>${esc(projectName(task.projectId))} · ${TEAM_PHASE_LABEL[task.phase] || task.phase} · 验收 ${satisfied}/${task.acceptance ? task.acceptance.length : 0} · ${esc(obs)}${task.updatedAt ? ' · ' + time(task.updatedAt) : ''}${task.nextAction ? `<br>下一步:${esc(String(task.nextAction).slice(0, 90))}` : ''}</small></div><div class="actions-row">${rework}<span class="badge ${task.status === 'blocked' ? 'warn' : task.status === 'done' ? 'ok' : 'info'}">${TEAM_STATUS_LABEL[task.status] || task.status}</span></div></div>`;
|
|
315
|
+
}
|
|
316
|
+
function teamSummaryCard() {
|
|
317
|
+
const summary = state.teamSummary;
|
|
318
|
+
const installed = state.health?.workflow?.installed !== false;
|
|
319
|
+
if (summary.error === 'MODULE_UNREACHABLE' && !installed) {
|
|
320
|
+
return `<section class="panel" style="margin-top:24px"><div class="section-heading"><h2>AI 团队工作流</h2></div><p class="small-empty">独立工作流模块尚未安装(可选模块)。安装后这里会显示正在工作的任务、检查与审查状态。</p></section>`;
|
|
321
|
+
}
|
|
322
|
+
if (summary.error) {
|
|
323
|
+
return `<section class="panel" style="margin-top:24px"><div class="section-heading"><h2>AI 团队工作流</h2></div><p class="small-empty">工作流服务不可达(${esc(summary.error)}),任务状态暂不可用;不影响其他知识功能。<button data-action="reload-team-summary">重试</button></p></section>`;
|
|
324
|
+
}
|
|
325
|
+
if (summary.loading && !summary.data) {
|
|
326
|
+
return `<section class="panel" style="margin-top:24px"><div class="section-heading"><h2>AI 团队工作流</h2></div><p class="small-empty">正在读取工作流状态…</p></section>`;
|
|
327
|
+
}
|
|
328
|
+
const data = summary.data;
|
|
329
|
+
if (!data) return '';
|
|
330
|
+
if (!data.team) {
|
|
331
|
+
return `<section class="panel" style="margin-top:24px"><div class="section-heading"><h2>AI 团队工作流</h2><button data-go="team">创建我的团队</button></div><p class="small-empty">还没有 AI 开发团队。创建后这里会实时显示正在工作的任务、程序检查与审查状态。</p></section>`;
|
|
332
|
+
}
|
|
333
|
+
const rows = (summary.tasks || []).map(teamWorkflowRow).join('') || '<p class="small-empty">当前没有进行中的任务。在原生客户端用 pk-team 开始任务,或到 AI 团队页新建。</p>';
|
|
334
|
+
return `<section class="panel" style="margin-top:24px"><div class="section-heading"><h2>AI 团队工作流 · ${esc(data.team.name)}</h2><button data-go="team">查看全部任务</button></div>
|
|
335
|
+
<p class="small-empty">${data.tasks.active} 个进行中 · ${data.tasks.blocked} 个受阻 · ${data.members.enabled}/${data.members.total} 名成员启用</p>
|
|
336
|
+
${rows}</section>`;
|
|
337
|
+
}
|
|
278
338
|
function needRow(item) {
|
|
279
339
|
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>`;
|
|
280
340
|
if (item.kind === 'journal') return `<div class="row"><div><b>提交事件消费受阻</b><small>${esc(item.journalId)} · ${esc(item.message)}</small></div>${badge('需要处理', 'issue')}</div>`;
|
|
@@ -283,13 +343,15 @@
|
|
|
283
343
|
return '';
|
|
284
344
|
}
|
|
285
345
|
function renderHome() {
|
|
286
|
-
|
|
346
|
+
// The team summary belongs on every home variant: a missing engine or an
|
|
347
|
+
// empty registry must not hide the cross-project task entry.
|
|
348
|
+
if (!state.projectsLoaded) { $('homeContent').innerHTML = (state.projectsError ? '<div class="empty">项目登记读取失败,未把失败当作空知识库。<button data-action="refresh">重试读取</button></div>' : '<div class="empty">正在读取项目登记…</div>') + teamSummaryCard(); return; }
|
|
287
349
|
if (state.overviewError) {
|
|
288
|
-
$('homeContent').innerHTML = `<div class="empty">全局状态读取失败:${esc(state.overviewError)}<br>已保存的待办与记忆不受影响,也不会显示为零待办。<button data-action="reload-overview">重试</button></div
|
|
350
|
+
$('homeContent').innerHTML = `<div class="empty">全局状态读取失败:${esc(state.overviewError)}<br>已保存的待办与记忆不受影响,也不会显示为零待办。<button data-action="reload-overview">重试</button></div>${teamSummaryCard()}`;
|
|
289
351
|
return;
|
|
290
352
|
}
|
|
291
|
-
if (!state.overview) { $('homeContent').innerHTML = '<div class="empty">正在读取全局待办…</div>'; return; }
|
|
292
|
-
if (!state.projects.length) { $('homeContent').innerHTML =
|
|
353
|
+
if (!state.overview) { $('homeContent').innerHTML = '<div class="empty">正在读取全局待办…</div>' + teamSummaryCard(); return; }
|
|
354
|
+
if (!state.projects.length) { $('homeContent').innerHTML = `<div class="empty"><h2>从第一个项目开始</h2><p>选择代码目录和知识目录,保留项目原有文件。</p><button class="primary" data-action="import">导入第一个项目</button></div>${teamSummaryCard()}`; return; }
|
|
293
355
|
const overview = state.overview;
|
|
294
356
|
const needs = overview.needsPreview || [];
|
|
295
357
|
const candidates = overview.candidatesPreview || [];
|
|
@@ -302,12 +364,13 @@
|
|
|
302
364
|
<div class="grid2">
|
|
303
365
|
<section class="panel"><h2>需要处理 ${overview.needsTotal ? badge(overview.needsTotal, 'issue') : ''}</h2>${needsRows}
|
|
304
366
|
${overview.needsTotal > needs.length ? '<button data-action="activity-needs">查看全部待办</button>' : ''}
|
|
305
|
-
${overview.totals
|
|
367
|
+
${overview.totals?.recovering ? `<div class="recovery-banner">${overview.totals?.recovering} 项正在自动恢复,无需操作<button data-action="activity-recovering">查看</button></div>` : ''}
|
|
306
368
|
</section>
|
|
307
|
-
<section class="panel"><h2>待确认记忆 ${overview.totals
|
|
308
|
-
${overview.totals
|
|
369
|
+
<section class="panel"><h2>待确认记忆 ${overview.totals?.candidates ? badge(overview.totals?.candidates, '') : ''}</h2>${candidateRows}
|
|
370
|
+
${overview.totals?.candidates > candidates.length ? '<button data-go="memory">查看候选箱</button>' : ''}
|
|
309
371
|
</section>
|
|
310
372
|
</div>
|
|
373
|
+
${teamSummaryCard()}
|
|
311
374
|
<section class="panel" style="margin-top:24px"><div class="section-heading" style="margin-bottom:12px"><h2>记忆组合</h2><button data-go="memory">管理记忆</button></div><div class="combo-grid">${comboCards}</div></section>`;
|
|
312
375
|
}
|
|
313
376
|
// ============ 长期记忆:组合 + 独立小记忆 + 候选 ============
|
|
@@ -737,7 +800,13 @@
|
|
|
737
800
|
if (state.root && state.scopeStatus?.status === 'pending' && !pending && !down.length) { $('systemDot').className = 'dot issue'; $('systemTitle').textContent = '共享知识接线待恢复'; $('systemDetail').textContent = '已有知识与长期记忆保留,请在系统状态中修复接线。'; }
|
|
738
801
|
const maintenance = maintenanceWarning();
|
|
739
802
|
if (maintenance && state.health.engine?.up && !pending) { $('systemDot').className = 'dot issue'; $('systemTitle').textContent = maintenance.title; $('systemDetail').textContent = maintenance.message; }
|
|
740
|
-
|
|
803
|
+
const workflowInstalled = state.health.workflow?.installed !== false;
|
|
804
|
+
const workflowRow = state.health.workflow
|
|
805
|
+
? `<div class="row"><div><b>AI 团队工作流</b><small>${esc(state.health.workflow.url || '')}</small></div>${workflowInstalled
|
|
806
|
+
? badge(state.health.workflow.up ? '在线' : '离线', state.health.workflow.up ? 'up' : 'issue')
|
|
807
|
+
: badge('未安装', '')}</div>`
|
|
808
|
+
: '';
|
|
809
|
+
$('moduleHealth').innerHTML = Object.entries(modules).map(([key, name]) => `<div class="row"><div><b>${esc(name)}</b><small>${esc(state.health[key]?.url || '')}</small></div>${badge(state.health[key]?.up ? '在线' : '离线', state.health[key]?.up ? 'up' : 'issue')}</div>`).join('') + workflowRow;
|
|
741
810
|
if (!navigator.onLine) {
|
|
742
811
|
$('systemDot').className = 'dot issue'; $('systemTitle').textContent = '网页连接中断';
|
|
743
812
|
$('systemDetail').textContent = '恢复连接后自动读取状态,后台维护不受影响。';
|
|
@@ -1287,7 +1356,8 @@
|
|
|
1287
1356
|
}
|
|
1288
1357
|
if (button.dataset.action === 'import') openImport();
|
|
1289
1358
|
if (button.dataset.action === 'refresh') await refreshRegistry(true);
|
|
1290
|
-
if (button.dataset.action === 'reload-overview') await loadOverview(true);
|
|
1359
|
+
if (button.dataset.action === 'reload-overview') { await loadOverview(true); await loadTeamSummary(); }
|
|
1360
|
+
if (button.dataset.action === 'reload-team-summary') await loadTeamSummary();
|
|
1291
1361
|
if (button.dataset.action === 'repair') await repair();
|
|
1292
1362
|
if (button.dataset.action === 'system') await openSystem();
|
|
1293
1363
|
if (button.dataset.action === 'activity-needs') { state.activityFilter = 'needs'; setView('activity'); renderActivity(); }
|