@dotdrelle/wiki-manager 0.11.10 → 0.12.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.
Files changed (81) hide show
  1. package/README.md +32 -7
  2. package/agents.docker-compose.yml +3 -0
  3. package/docker-compose.yml +1 -0
  4. package/package.json +3 -2
  5. package/src/activity/activityAggregator.js +109 -0
  6. package/src/activity/activityAggregator.test.js +60 -0
  7. package/src/activity/activityDeduplicator.js +50 -0
  8. package/src/activity/progressCalculator.js +61 -0
  9. package/src/activity/runSynthesis.js +15 -0
  10. package/src/agent/graph.js +65 -30
  11. package/src/agent/graph.test.js +28 -5
  12. package/src/cli/wiki-manager.js +22 -0
  13. package/src/contracts/schemas.js +249 -13
  14. package/src/contracts/schemas.test.js +145 -0
  15. package/src/core/activity.js +8 -5
  16. package/src/core/agentEvents.js +260 -23
  17. package/src/core/agentEvents.test.js +53 -0
  18. package/src/core/compose.js +6 -1
  19. package/src/core/dockerCompose.test.js +12 -0
  20. package/src/core/documentIntake.js +33 -38
  21. package/src/core/documentIntake.test.js +25 -0
  22. package/src/core/env.js +11 -1
  23. package/src/core/jobQueue.js +26 -2
  24. package/src/core/mcp.js +1 -1
  25. package/src/core/plan.js +46 -4
  26. package/src/core/plan.test.js +16 -1
  27. package/src/core/planPatch.js +64 -3
  28. package/src/core/planPatch.test.js +110 -1
  29. package/src/core/queueStore.test.js +21 -0
  30. package/src/core/runtimeLog.js +119 -0
  31. package/src/core/runtimeLog.test.js +84 -0
  32. package/src/core/wikirc.js +22 -0
  33. package/src/core/wikirc.test.js +49 -1
  34. package/src/core/workflow.js +14 -3
  35. package/src/graph/graphAggregator.js +5 -0
  36. package/src/graph/graphPatch.js +8 -0
  37. package/src/graph/graphSnapshot.js +14 -0
  38. package/src/graph/graphVisibilityPolicy.js +40 -0
  39. package/src/graph/runGraphProjector.js +87 -0
  40. package/src/graph/runGraphProjector.test.js +111 -0
  41. package/src/orchestrator/agentRegistry.js +172 -0
  42. package/src/orchestrator/agentRegistry.test.js +114 -0
  43. package/src/orchestrator/approvalPolicy.js +126 -0
  44. package/src/orchestrator/approvalPolicy.test.js +78 -0
  45. package/src/orchestrator/assignmentManager.js +80 -0
  46. package/src/orchestrator/attemptManager.js +168 -0
  47. package/src/orchestrator/attemptManager.test.js +160 -0
  48. package/src/orchestrator/budgetManager.js +127 -0
  49. package/src/orchestrator/capabilityRegistry.js +64 -0
  50. package/src/orchestrator/capabilityRegistry.test.js +59 -0
  51. package/src/orchestrator/capabilityResolver.js +151 -0
  52. package/src/orchestrator/capabilityResolver.test.js +127 -0
  53. package/src/orchestrator/dependencyResolver.js +112 -0
  54. package/src/orchestrator/dispatcher.js +302 -0
  55. package/src/orchestrator/lockManager.js +51 -0
  56. package/src/orchestrator/planIntegrator.js +268 -0
  57. package/src/orchestrator/planIntegrator.test.js +213 -0
  58. package/src/orchestrator/planValidator.js +534 -0
  59. package/src/orchestrator/planValidator.test.js +262 -0
  60. package/src/orchestrator/resultAggregator.js +248 -0
  61. package/src/orchestrator/resultAggregator.test.js +211 -0
  62. package/src/orchestrator/scheduler.js +103 -0
  63. package/src/orchestrator/scheduler.test.js +138 -0
  64. package/src/runtime/approvals.js +130 -1
  65. package/src/runtime/donna-contract.test.js +293 -30
  66. package/src/runtime/recoveryManager.js +176 -0
  67. package/src/runtime/recoveryManager.test.js +162 -0
  68. package/src/runtime/runner.e2e.test.js +98 -12
  69. package/src/runtime/runner.js +261 -227
  70. package/src/runtime/runner.test.js +249 -452
  71. package/src/runtime/server.js +137 -20
  72. package/src/runtime/server.test.js +137 -7
  73. package/src/runtime/store.js +837 -2
  74. package/src/runtime/store.test.js +245 -4
  75. package/src/runtime/supervisor.js +33 -1
  76. package/src/runtime/supervisor.test.js +47 -1
  77. package/src/shell/RightPane.tsx +8 -5
  78. package/src/shell/repl.js +4 -9
  79. package/src/shell/repl.test.js +25 -4
  80. package/src/shell/tui.tsx +1 -0
  81. package/src/shell/useSession.ts +38 -10
@@ -3,10 +3,11 @@ import { isAbsolute, relative, resolve, sep } from 'node:path';
3
3
  import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';
4
4
  import { formatMcpToolResult, callMcpTool } from '../core/mcp.js';
5
5
  import { extractActivity, parseJsonText, sessionActivities } from '../core/activity.js';
6
- import { formatPlanStatus, formatCompletedActivities } from '../core/plan.js';
6
+ import { formatPlanStatus, formatCompletedActivities, formatPlanStep } from '../core/plan.js';
7
7
  import { createAgentEvent, dispatchAgentEvent } from '../core/agentEvents.js';
8
8
  import { projectQueue, queueCounts, startNextQueuedJob, syncQueueWithActivity } from '../core/jobQueue.js';
9
9
  import { queueStoreFor } from '../core/queueStore.js';
10
+ import { filterRuntimeLogs } from '../core/runtimeLog.js';
10
11
  import { fetchRuntimeState, streamRuntimeEvents } from '../runtime/client.js';
11
12
  import type { ActiveFileEditor } from './FileEditorDialog';
12
13
  import {
@@ -99,11 +100,13 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
99
100
  },
100
101
  });
101
102
  const runtimeRunStatus = createMemo(() => String(runtimeState()?.status ?? 'idle'));
102
- const agentBusy = createMemo(() =>
103
+ const conversationBusy = createMemo(() => agent.busy());
104
+ const executionActive = createMemo(() =>
103
105
  props.runtime?.url
104
- ? runtimeRunStatus() === 'running' || agent.busy()
105
- : agent.busy(),
106
+ ? runtimeRunStatus() === 'running'
107
+ : sessionActivities(session).some((activity) => !activity.terminal),
106
108
  );
109
+ const agentBusy = conversationBusy;
107
110
  const localFallbackActive = createMemo(() => !props.runtime?.url || runtimeStatus() === 'disconnected');
108
111
 
109
112
  // Runtime conversation entries are merged into conversationMessages(session)
@@ -182,6 +185,20 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
182
185
  let lastVisiblePlan: Array<{ step: number; description: string; status: string }> | null = null;
183
186
  const activities = createMemo(() => {
184
187
  version();
188
+ const activityLines = nonEmptyRuntimeArray(runtimeState()?.workflow?.activity?.lines);
189
+ if (activityLines) {
190
+ return activityLines.map((line: any, index: number) => ({
191
+ key: line.id ?? `activity-line-${index}`,
192
+ id: line.id ?? `activity-line-${index}`,
193
+ label: line.label,
194
+ status: line.status ?? 'running',
195
+ progress: line.progress ?? null,
196
+ terminal: ['done', 'failed', 'cancelled'].includes(String(line.status)),
197
+ _runtime: true,
198
+ _workflow: true,
199
+ _aggregated: true,
200
+ }));
201
+ }
185
202
  const workflowActivities = nonEmptyRuntimeArray(runtimeState()?.workflow?.nodes?.filter((node: any) => node.type === 'activity'));
186
203
  if (workflowActivities) {
187
204
  return workflowActivities.map((node: any) => ({
@@ -246,7 +263,7 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
246
263
  .sort((a: any, b: any) => Number(a.step ?? 0) - Number(b.step ?? 0))
247
264
  .map((node: any, index: number) => ({
248
265
  step: Number(node.step ?? index + 1),
249
- description: String(node.description ?? node.label ?? `Step ${index + 1}`),
266
+ description: formatPlanStep(node) || `Step ${index + 1}`,
250
267
  status: String(node.status ?? 'pending'),
251
268
  }));
252
269
  }
@@ -254,7 +271,7 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
254
271
  if (runtimePlan) {
255
272
  return runtimePlan.map((step: any, index: number) => ({
256
273
  step: Number(step.step ?? index + 1),
257
- description: String(step.description ?? step.label ?? step.name ?? `Step ${index + 1}`),
274
+ description: formatPlanStep(step) || `Step ${index + 1}`,
258
275
  status: String(step.status ?? 'pending'),
259
276
  }));
260
277
  }
@@ -272,8 +289,9 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
272
289
  version();
273
290
  const runtimeLogs = runtimeState()?.logs;
274
291
  if (!Array.isArray(runtimeLogs) || runtimeLogs.length === 0) return logs();
275
- const tagged = runtimeLogs.slice(-80).map((line: any) => `runtime ${String(line)}`);
276
- return [...logs(), ...tagged].slice(-200);
292
+ const filter = String((session as any).runtimeLogFilter ?? '').trim();
293
+ const tagged = filterRuntimeLogs(runtimeLogs.map((line: any) => `runtime ${String(line)}`), filter);
294
+ return [...logs(), ...tagged];
277
295
  });
278
296
 
279
297
  // Index-aligned with each workspace's runtimeConversation array — not just
@@ -291,6 +309,13 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
291
309
  const target = conversationMessages(session);
292
310
  const backed = runtimeConversationRefsByWorkspace.get(workspace) ?? [];
293
311
  runtimeConversationRefsByWorkspace.set(workspace, backed);
312
+ if (backed.length === 0 && target.length === 0 && !runtimeConversation.some((message: any) => message?._pending)) {
313
+ backed.push(...runtimeConversation.map((message: any) => ({
314
+ role: message.role === 'assistant' ? 'donna' : message.role,
315
+ content: String(message.content ?? ''),
316
+ })));
317
+ return;
318
+ }
294
319
  for (let i = 0; i < runtimeConversation.length; i += 1) {
295
320
  const message = runtimeConversation[i];
296
321
  const content = String(message.content ?? '');
@@ -437,7 +462,7 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
437
462
  const plan = (session as any).headlessPlan;
438
463
  const stillRunning = sessionActivities(session).filter((a) => !a.terminal && a.poll);
439
464
  const pendingSteps = (plan ?? []).filter((s: any) => s.status === 'pending');
440
- if (stillRunning.length === 0 && pendingSteps.length > 0 && !agentBusy()) {
465
+ if (stillRunning.length === 0 && pendingSteps.length > 0 && !conversationBusy()) {
441
466
  const completedAll = sessionActivities(session).filter((a) => a.terminal);
442
467
  const prompt = buildContinuationPrompt(session, completedAll);
443
468
  void agent.submit(prompt);
@@ -469,7 +494,7 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
469
494
 
470
495
  async function submitInput(submittedValue?: string) {
471
496
  const line = typeof submittedValue === 'string' && submittedValue.trim() ? submittedValue : input();
472
- if (agentBusy()) return { exit: false, busy: true };
497
+ if (conversationBusy()) return { exit: false, busy: true };
473
498
  setInput('');
474
499
  setConversationScroll(0);
475
500
  if (line.trim()) {
@@ -593,6 +618,7 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
593
618
  session,
594
619
  messages,
595
620
  logs: visibleLogs,
621
+ runtimeLogFilter: () => String((session as any).runtimeLogFilter ?? ''),
596
622
  input,
597
623
  setInput: updateInput,
598
624
  title,
@@ -613,6 +639,8 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
613
639
  plan,
614
640
  conversationScroll,
615
641
  scrollConversation,
642
+ conversationBusy,
643
+ executionActive,
616
644
  busy: agentBusy,
617
645
  abort,
618
646
  submitInput,