@dotdrelle/wiki-manager 0.12.0 → 0.12.7

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 (40) hide show
  1. package/package.json +2 -2
  2. package/src/activity/activityAggregator.js +34 -3
  3. package/src/activity/activityAggregator.test.js +32 -0
  4. package/src/agent/graph.js +307 -29
  5. package/src/agent/graph.test.js +404 -1
  6. package/src/cli/wiki-manager.js +24 -1
  7. package/src/commands/slash.js +74 -1
  8. package/src/commands/slash.test.js +36 -0
  9. package/src/contracts/schemas.test.js +2 -2
  10. package/src/core/activity.js +4 -0
  11. package/src/core/activity.test.js +9 -1
  12. package/src/core/agentEvents.js +30 -0
  13. package/src/core/agentEvents.test.js +42 -1
  14. package/src/core/buildInfo.js +58 -0
  15. package/src/core/buildInfo.json +4 -0
  16. package/src/core/buildInfo.test.js +14 -0
  17. package/src/core/mcp.js +50 -3
  18. package/src/core/mcp.test.js +94 -1
  19. package/src/core/runtimeLog.js +6 -1
  20. package/src/core/runtimeLog.test.js +3 -1
  21. package/src/runtime/client.js +22 -0
  22. package/src/runtime/controlMessages.js +43 -0
  23. package/src/runtime/controlMessages.test.js +21 -0
  24. package/src/runtime/donna-contract.test.js +3 -3
  25. package/src/runtime/recoveryManager.js +54 -0
  26. package/src/runtime/recoveryManager.test.js +73 -0
  27. package/src/runtime/runner.js +49 -13
  28. package/src/runtime/runner.test.js +196 -0
  29. package/src/runtime/server.js +73 -13
  30. package/src/runtime/server.test.js +284 -67
  31. package/src/runtime/store.js +48 -3
  32. package/src/runtime/store.test.js +56 -24
  33. package/src/runtime/supervisor.js +77 -1
  34. package/src/shell/RightPane.tsx +124 -31
  35. package/src/shell/SetupWizard.tsx +13 -1
  36. package/src/shell/repl.js +81 -11
  37. package/src/shell/repl.test.js +115 -2
  38. package/src/shell/tui.tsx +4 -1
  39. package/src/shell/useAgent.ts +37 -4
  40. package/src/shell/useSession.ts +51 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdrelle/wiki-manager",
3
- "version": "0.12.0",
3
+ "version": "0.12.7",
4
4
  "description": "Agentic shell and orchestration cockpit for llm-wiki workspaces.",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "dotrelle",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "start": "bun ./bin/wiki-manager.js",
14
- "test": "node --test src/agent/graph.test.js src/contracts/schemas.test.js src/core/activity.test.js src/core/agentEvents.test.js src/core/runtimeLog.test.js src/activity/activityAggregator.test.js src/graph/runGraphProjector.test.js src/core/workflow.test.js src/core/planPatch.test.js src/core/agentLoop.test.js src/core/plan.test.js src/core/mcp.test.js src/core/documentIntake.test.js src/core/dockerCompose.test.js src/core/wikiWorkspace.test.js src/core/wikirc.test.js src/core/modelFetch.test.js src/core/startupCheck.test.js src/core/queueStore.test.js src/orchestrator/agentRegistry.test.js src/orchestrator/capabilityRegistry.test.js src/orchestrator/capabilityResolver.test.js src/orchestrator/planValidator.test.js src/orchestrator/planIntegrator.test.js src/orchestrator/scheduler.test.js src/orchestrator/attemptManager.test.js src/orchestrator/resultAggregator.test.js src/orchestrator/approvalPolicy.test.js src/commands/slash.test.js src/shell/repl.test.js src/runtime/store.test.js src/runtime/recoveryManager.test.js src/runtime/server.test.js src/runtime/supervisor.test.js src/runtime/runner.test.js src/runtime/runner.e2e.test.js src/runtime/donna-contract.test.js src/runtime/auth.test.js",
14
+ "test": "node --test src/agent/graph.test.js src/contracts/schemas.test.js src/core/activity.test.js src/core/buildInfo.test.js src/core/agentEvents.test.js src/core/runtimeLog.test.js src/activity/activityAggregator.test.js src/graph/runGraphProjector.test.js src/core/workflow.test.js src/core/planPatch.test.js src/core/agentLoop.test.js src/core/plan.test.js src/core/mcp.test.js src/core/documentIntake.test.js src/core/dockerCompose.test.js src/core/wikiWorkspace.test.js src/core/wikirc.test.js src/core/modelFetch.test.js src/core/startupCheck.test.js src/core/queueStore.test.js src/orchestrator/agentRegistry.test.js src/orchestrator/capabilityRegistry.test.js src/orchestrator/capabilityResolver.test.js src/orchestrator/planValidator.test.js src/orchestrator/planIntegrator.test.js src/orchestrator/scheduler.test.js src/orchestrator/attemptManager.test.js src/orchestrator/resultAggregator.test.js src/orchestrator/approvalPolicy.test.js src/commands/slash.test.js src/shell/repl.test.js src/runtime/store.test.js src/runtime/controlMessages.test.js src/runtime/recoveryManager.test.js src/runtime/server.test.js src/runtime/supervisor.test.js src/runtime/runner.test.js src/runtime/runner.e2e.test.js src/runtime/donna-contract.test.js src/runtime/auth.test.js",
15
15
  "check-versions": "node scripts/check-versions.js",
16
16
  "prepack": "node scripts/check-versions.js",
17
17
  "prepublishOnly": "node scripts/check-versions.js",
@@ -10,9 +10,18 @@ export function aggregateActivity(state = {}, events = []) {
10
10
  const activities = Array.isArray(state.activities) ? state.activities : [];
11
11
  const progress = calculateWeightedProgress(tasks, activities);
12
12
  const groups = groupTasks(tasks);
13
+ const deduped = deduplicateActivities(activities);
14
+ // Group lines only cover activities attached to plan tasks. An activity
15
+ // started OUTSIDE the plan (e.g. the agent calls production_start_job
16
+ // directly after a minimal one-step plan) must still be visible: without
17
+ // this, the panel showed a done "production_status" step while the actual
18
+ // ingest ran invisibly at 15%.
13
19
  const lines = groups.length > 0
14
- ? groups.map((group) => groupLine(group, activities))
15
- : deduplicateActivities(activities).map(activityLine);
20
+ ? [
21
+ ...groups.map((group) => groupLine(group, activities)),
22
+ ...unattachedActivities(tasks, deduped).map(activityLine),
23
+ ]
24
+ : deduped.map(activityLine);
16
25
  return {
17
26
  initialSynthesis: initialSynthesisFromState(state, events),
18
27
  progress,
@@ -20,6 +29,21 @@ export function aggregateActivity(state = {}, events = []) {
20
29
  };
21
30
  }
22
31
 
32
+ function unattachedActivities(tasks, activities) {
33
+ const attachedKeys = new Set(tasks
34
+ .flatMap((task) => [task.activityKey, task.ownerActivityKey, task._activityKey])
35
+ .filter(Boolean)
36
+ .map(String));
37
+ const taskIds = new Set(tasks.map((task) => String(task.id ?? task.step ?? '')).filter(Boolean));
38
+ return activities.filter((activity) => {
39
+ const keys = [activity.key, activity.id].filter(Boolean).map(String);
40
+ if (keys.some((value) => attachedKeys.has(value))) return false;
41
+ const stepId = String(activity?.progress?.stepId ?? '');
42
+ if (stepId && taskIds.has(stepId)) return false;
43
+ return true;
44
+ });
45
+ }
46
+
23
47
  function groupTasks(tasks) {
24
48
  const groups = new Map();
25
49
  for (const task of tasks) {
@@ -70,11 +94,18 @@ function groupLine(group, activities) {
70
94
  status = `${done}/${total}`;
71
95
  }
72
96
  const agents = activeAgents > 0 ? ` - ${activeAgents} agent${activeAgents > 1 ? 's' : ''}` : '';
97
+ // While a task is running, expose ITS live progress as the group percent.
98
+ // The completion ratio (done/total tasks) said 0% while the label showed
99
+ // the real activity progress ("— 1 %"), so the TUI badge contradicted the
100
+ // text. Fall back to the task-completion ratio when nothing is running.
101
+ const percent = running.length > 0 && activeProgress != null
102
+ ? Math.round(activeProgress)
103
+ : (total > 0 ? Math.round((done / total) * 100) : null);
73
104
  return {
74
105
  id: `group:${group.id}`,
75
106
  label: `${icon} ${group.label} - ${status}${agents}`,
76
107
  status,
77
- progress: { done, total, percent: total > 0 ? Math.round((done / total) * 100) : null },
108
+ progress: { done, total, percent },
78
109
  activeAgents,
79
110
  };
80
111
  }
@@ -58,3 +58,35 @@ test('aggregateActivity exposes initial synthesis and grouped display lines', ()
58
58
  assert.ok(activity.lines.some((line) => /\[\.\.\.\] customer-data\.enrich - 63 %/.test(line.label)));
59
59
  assert.ok(activity.lines.some((line) => /\[ \] publish - en attente/.test(line.label)));
60
60
  });
61
+
62
+ test('aggregateActivity keeps activities not attached to any plan task visible', () => {
63
+ // Regression: a done one-step minimal plan (production_status) masked the
64
+ // actually-running ingest activity started outside the plan.
65
+ const state = {
66
+ plan: [{
67
+ id: 'status-check',
68
+ step: 1,
69
+ description: 'production.production_status',
70
+ status: 'done',
71
+ groupId: '1',
72
+ }],
73
+ activities: [
74
+ {
75
+ key: 'production:prod_192444',
76
+ id: 'prod_192444',
77
+ label: 'Ingest b87acaf6-Comite.md',
78
+ source: 'production',
79
+ status: 'running',
80
+ terminal: false,
81
+ progress: { percent: 15, detail: 'LLM running' },
82
+ },
83
+ ],
84
+ };
85
+
86
+ const aggregated = aggregateActivity(state, []);
87
+ const labels = aggregated.lines.map((line) => line.label).join('\n');
88
+ assert.match(labels, /\[x\] .* done/, 'the done plan group stays visible');
89
+ assert.match(labels, /Ingest b87acaf6/, 'the unattached running ingest must appear');
90
+ const ingestLine = aggregated.lines.find((line) => /Ingest/.test(line.label));
91
+ assert.equal(ingestLine.status, 'running');
92
+ });