@synergenius/flow-weaver-pack-weaver 0.9.152 → 0.9.154

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 (104) hide show
  1. package/dist/ai-chat-provider.js +4 -4
  2. package/dist/ai-chat-provider.js.map +1 -1
  3. package/dist/bot/ai-client.d.ts +30 -0
  4. package/dist/bot/ai-client.d.ts.map +1 -1
  5. package/dist/bot/ai-client.js +37 -0
  6. package/dist/bot/ai-client.js.map +1 -1
  7. package/dist/bot/behavior-defaults.d.ts.map +1 -1
  8. package/dist/bot/behavior-defaults.js +7 -2
  9. package/dist/bot/behavior-defaults.js.map +1 -1
  10. package/dist/bot/capability-registry.d.ts.map +1 -1
  11. package/dist/bot/capability-registry.js +46 -33
  12. package/dist/bot/capability-registry.js.map +1 -1
  13. package/dist/bot/file-validator.d.ts +7 -0
  14. package/dist/bot/file-validator.d.ts.map +1 -1
  15. package/dist/bot/file-validator.js +76 -0
  16. package/dist/bot/file-validator.js.map +1 -1
  17. package/dist/bot/instance-manager.d.ts +22 -7
  18. package/dist/bot/instance-manager.d.ts.map +1 -1
  19. package/dist/bot/instance-manager.js +69 -7
  20. package/dist/bot/instance-manager.js.map +1 -1
  21. package/dist/bot/orchestrator.d.ts +11 -9
  22. package/dist/bot/orchestrator.d.ts.map +1 -1
  23. package/dist/bot/orchestrator.js +56 -107
  24. package/dist/bot/orchestrator.js.map +1 -1
  25. package/dist/bot/runner.d.ts +29 -0
  26. package/dist/bot/runner.d.ts.map +1 -1
  27. package/dist/bot/runner.js +114 -73
  28. package/dist/bot/runner.js.map +1 -1
  29. package/dist/bot/step-executor.d.ts.map +1 -1
  30. package/dist/bot/step-executor.js +28 -9
  31. package/dist/bot/step-executor.js.map +1 -1
  32. package/dist/bot/swarm-controller.d.ts +7 -6
  33. package/dist/bot/swarm-controller.d.ts.map +1 -1
  34. package/dist/bot/swarm-controller.js +64 -74
  35. package/dist/bot/swarm-controller.js.map +1 -1
  36. package/dist/bot/system-prompt.d.ts.map +1 -1
  37. package/dist/bot/system-prompt.js +2 -0
  38. package/dist/bot/system-prompt.js.map +1 -1
  39. package/dist/bot/task-types.d.ts +1 -0
  40. package/dist/bot/task-types.d.ts.map +1 -1
  41. package/dist/bot/weaver-tools.d.ts +1 -1
  42. package/dist/bot/weaver-tools.d.ts.map +1 -1
  43. package/dist/bot/weaver-tools.js +12 -1
  44. package/dist/bot/weaver-tools.js.map +1 -1
  45. package/dist/node-types/agent-execute.js +2 -2
  46. package/dist/node-types/agent-execute.js.map +1 -1
  47. package/dist/node-types/bot-report.d.ts.map +1 -1
  48. package/dist/node-types/bot-report.js +5 -2
  49. package/dist/node-types/bot-report.js.map +1 -1
  50. package/dist/node-types/build-context.d.ts.map +1 -1
  51. package/dist/node-types/build-context.js +13 -1
  52. package/dist/node-types/build-context.js.map +1 -1
  53. package/dist/node-types/exec-validate-retry.d.ts +3 -3
  54. package/dist/node-types/exec-validate-retry.d.ts.map +1 -1
  55. package/dist/node-types/exec-validate-retry.js +13 -184
  56. package/dist/node-types/exec-validate-retry.js.map +1 -1
  57. package/dist/node-types/load-config.d.ts +1 -0
  58. package/dist/node-types/load-config.d.ts.map +1 -1
  59. package/dist/node-types/load-config.js +1 -0
  60. package/dist/node-types/load-config.js.map +1 -1
  61. package/dist/node-types/plan-task.d.ts +7 -5
  62. package/dist/node-types/plan-task.d.ts.map +1 -1
  63. package/dist/node-types/plan-task.js +282 -83
  64. package/dist/node-types/plan-task.js.map +1 -1
  65. package/dist/ui/bot-panel.js +1 -1
  66. package/dist/ui/capability-editor.js +46 -33
  67. package/dist/ui/chat-task-result.js +7 -7
  68. package/dist/ui/profile-editor.js +44 -31
  69. package/dist/ui/swarm-dashboard.js +80 -47
  70. package/dist/ui/task-detail-view.js +31 -11
  71. package/dist/ui/task-editor.js +1 -1
  72. package/dist/ui/task-pool-list.js +1 -1
  73. package/dist/workflows/weaver-bot.d.ts +5 -4
  74. package/dist/workflows/weaver-bot.d.ts.map +1 -1
  75. package/dist/workflows/weaver-bot.js +8 -7
  76. package/dist/workflows/weaver-bot.js.map +1 -1
  77. package/flowweaver.manifest.json +1 -1
  78. package/package.json +1 -1
  79. package/src/ai-chat-provider.ts +4 -4
  80. package/src/bot/ai-client.ts +65 -0
  81. package/src/bot/behavior-defaults.ts +5 -2
  82. package/src/bot/capability-registry.ts +46 -33
  83. package/src/bot/file-validator.ts +97 -0
  84. package/src/bot/instance-manager.ts +77 -7
  85. package/src/bot/orchestrator.ts +63 -126
  86. package/src/bot/runner.ts +124 -70
  87. package/src/bot/step-executor.ts +30 -9
  88. package/src/bot/swarm-controller.ts +65 -76
  89. package/src/bot/system-prompt.ts +2 -0
  90. package/src/bot/task-types.ts +1 -0
  91. package/src/bot/weaver-tools.ts +14 -1
  92. package/src/node-types/agent-execute.ts +2 -2
  93. package/src/node-types/bot-report.ts +5 -2
  94. package/src/node-types/build-context.ts +13 -1
  95. package/src/node-types/exec-validate-retry.ts +14 -203
  96. package/src/node-types/load-config.ts +1 -0
  97. package/src/node-types/plan-task.ts +313 -88
  98. package/src/ui/bot-panel.tsx +1 -1
  99. package/src/ui/chat-task-result.tsx +10 -8
  100. package/src/ui/swarm-dashboard.tsx +4 -4
  101. package/src/ui/task-detail-view.tsx +35 -12
  102. package/src/ui/task-editor.tsx +2 -2
  103. package/src/ui/task-pool-list.tsx +2 -2
  104. package/src/workflows/weaver-bot.ts +8 -7
@@ -24,7 +24,7 @@ import type { HistoricalRun } from './trace-to-timeline';
24
24
  // Types
25
25
  // ---------------------------------------------------------------------------
26
26
 
27
- type TaskStatus = 'pending' | 'in-progress' | 'blocked' | 'done' | 'failed' | 'cancelled';
27
+ type TaskStatus = 'open' | 'pending' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
28
28
 
29
29
  interface TaskContext {
30
30
  files: string[];
@@ -89,19 +89,19 @@ interface TaskDetailViewProps {
89
89
  // ---------------------------------------------------------------------------
90
90
 
91
91
  const statusToIcon: Record<TaskStatus, string> = {
92
+ 'open': 'pending',
92
93
  'pending': 'pending',
93
94
  'in-progress': 'running',
94
95
  'done': 'completed',
95
- 'failed': 'failed',
96
96
  'blocked': 'pending',
97
97
  'cancelled': 'failed',
98
98
  };
99
99
 
100
100
  const statusToLabel: Record<TaskStatus, string> = {
101
- 'pending': 'Pending',
102
- 'in-progress': 'In Progress',
101
+ 'open': 'Open',
102
+ 'pending': 'Queued',
103
+ 'in-progress': 'Running',
103
104
  'done': 'Done',
104
- 'failed': 'Failed',
105
105
  'blocked': 'Blocked',
106
106
  'cancelled': 'Cancelled',
107
107
  };
@@ -223,6 +223,27 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
223
223
  const t = (data.task ?? data) as Task;
224
224
  setTask(t);
225
225
 
226
+ // Populate run history from task's runSummaries (RunStore may be empty for swarm tasks)
227
+ const rs = (t as unknown as Record<string, unknown>).context as Record<string, unknown> | undefined;
228
+ const summaries = rs?.runSummaries as Array<Record<string, unknown>> | undefined;
229
+ if (summaries?.length) {
230
+ setHistory(prev => {
231
+ if (prev.length > 0) return prev; // Don't overwrite if RunStore data exists
232
+ return summaries.map((s) => ({
233
+ id: s.runId as string,
234
+ runId: s.runId as string,
235
+ outcome: s.outcome as string,
236
+ summary: s.summary as string,
237
+ report: s.report as string | undefined,
238
+ filesModified: s.filesModified as string[],
239
+ durationMs: s.durationMs as number,
240
+ cost: s.cost as number,
241
+ tokensUsed: s.tokensUsed as number,
242
+ error: s.error as string | undefined,
243
+ } as unknown as HistoricalRun));
244
+ });
245
+ }
246
+
226
247
  // Subtasks from response or fetch separately
227
248
  if (data.subtasks && Array.isArray(data.subtasks)) {
228
249
  setSubtasks(data.subtasks as Subtask[]);
@@ -242,13 +263,14 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
242
263
  try {
243
264
  const raw = await callTool('fw_weaver_history', { taskId });
244
265
  const data = typeof raw === 'string' ? JSON.parse(raw) : raw;
245
- if (Array.isArray(data)) {
266
+ if (Array.isArray(data) && data.length > 0) {
246
267
  setHistory(
247
268
  data.map((r: Record<string, unknown>) => {
248
269
  const costObj = r.cost && typeof r.cost === 'object' ? (r.cost as Record<string, unknown>) : undefined;
249
270
  return { ...r, costDetail: costObj, cost: costObj?.totalCost } as unknown as HistoricalRun;
250
271
  }),
251
272
  );
273
+ return;
252
274
  }
253
275
  } catch {
254
276
  // Non-fatal
@@ -261,6 +283,7 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
261
283
  Promise.all([fetchTask(), fetchHistory()]).finally(() => setLoading(false));
262
284
  }, [fetchTask, fetchHistory]);
263
285
 
286
+
264
287
  // Poll while in-progress (every 5s)
265
288
  useEffect(() => {
266
289
  if (!task || task.status !== 'in-progress') return;
@@ -545,10 +568,10 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
545
568
  // Meta row: status tag, assigned profile, priority, attempts
546
569
  React.createElement(Flex, { variant: 'row-center-start-wrap-6' },
547
570
  React.createElement(Chip, {
548
- label: statusToLabel[task.status] || task.status || 'pending',
571
+ label: statusToLabel[task.status as TaskStatus] || task.status || 'open',
549
572
  size: 'small',
550
573
  color: task.status === 'done' ? 'color-status-positive'
551
- : task.status === 'failed' ? 'color-status-negative'
574
+ : task.status === 'cancelled' ? 'color-status-negative'
552
575
  : task.status === 'in-progress' ? 'color-status-info'
553
576
  : task.status === 'blocked' ? 'color-status-caution'
554
577
  : 'color-brand-alt',
@@ -560,10 +583,10 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
560
583
  label: `P${task.priority}`, size: 'small', color: task.priority >= 3 ? 'color-status-caution' : 'color-status-info',
561
584
  }),
562
585
 
563
- (task.attempt != null && task.maxAttempts != null) && React.createElement(Typography, {
586
+ task.maxAttempts != null && task.maxAttempts > 1 && React.createElement(Typography, {
564
587
  variant: 'smallCaption-regular',
565
588
  color: 'color-text-subtle',
566
- }, `Attempt ${task.attempt}/${task.maxAttempts}`),
589
+ }, `${task.runs?.length ?? 0}/${task.maxAttempts} runs`),
567
590
  ),
568
591
 
569
592
  // Description
@@ -673,14 +696,14 @@ function TaskDetailView({ taskId, onBack, onEdit }: TaskDetailViewProps) {
673
696
  React.createElement(Flex, { variant: 'column-stretch-start-nowrap-8' },
674
697
  React.createElement(Typography, { variant: 'caption-thick', color: 'color-text-medium' }, 'Status'),
675
698
  React.createElement(Flex, { variant: 'row-center-start-nowrap-6' },
676
- task.status === 'failed' && React.createElement(Button, {
699
+ (task.status === 'open' && (task.attempt ?? 0) > 0) && React.createElement(Button, {
677
700
  size: 'xs', variant: 'fill', color: 'primary',
678
701
  onClick: handleRetry,
679
702
  loading: actionLoading === 'retry',
680
703
  disabled: !!actionLoading,
681
704
  }, 'Retry Task'),
682
705
 
683
- (task.status === 'pending' || task.status === 'in-progress' || task.status === 'blocked') && React.createElement(Button, {
706
+ (task.status === 'open' || task.status === 'pending' || task.status === 'in-progress' || task.status === 'blocked') && React.createElement(Button, {
684
707
  size: 'xs', variant: 'outlined', color: 'danger',
685
708
  onClick: handleCancel,
686
709
  loading: actionLoading === 'cancel',
@@ -29,7 +29,7 @@ interface TaskEditorProps {
29
29
  onDelete?: () => void;
30
30
  }
31
31
 
32
- type TaskStatus = 'pending' | 'in-progress' | 'blocked' | 'done' | 'failed' | 'cancelled';
32
+ type TaskStatus = 'open' | 'pending' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
33
33
 
34
34
  interface TaskData {
35
35
  id: string;
@@ -77,11 +77,11 @@ const COMPLEXITY_OPTIONS = [
77
77
  ];
78
78
 
79
79
  const STATUS_COLOR: Record<string, string> = {
80
+ 'open': 'color-brand-alt',
80
81
  'pending': 'color-brand-alt',
81
82
  'in-progress': 'color-status-info',
82
83
  'blocked': 'color-status-caution',
83
84
  'done': 'color-status-positive',
84
- 'failed': 'color-status-negative',
85
85
  'cancelled': 'color-status-negative',
86
86
  };
87
87
 
@@ -11,7 +11,7 @@ const { Flex, Typography, Icon, StatusIcon, Chip, ScrollArea, Badge, EmptyState
11
11
 
12
12
  // --- Types ---
13
13
 
14
- type TaskStatus = 'pending' | 'in-progress' | 'blocked' | 'done' | 'failed' | 'cancelled';
14
+ type TaskStatus = 'open' | 'pending' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
15
15
 
16
16
  interface Task {
17
17
  id: string;
@@ -32,10 +32,10 @@ interface TaskPoolListProps {
32
32
  // --- Status mapping ---
33
33
 
34
34
  const statusToIcon: Record<TaskStatus, string> = {
35
+ 'open': 'pending',
35
36
  'pending': 'pending',
36
37
  'in-progress': 'running',
37
38
  'done': 'completed',
38
- 'failed': 'failed',
39
39
  'blocked': 'pending',
40
40
  'cancelled': 'failed',
41
41
  };
@@ -423,7 +423,7 @@ class GeneratedExecutionContext {
423
423
 
424
424
  /**
425
425
  * @flowWeaver workflow
426
- * @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [position: 200 200]
426
+ * @node cfg weaverLoadConfig [color: "teal"] [icon: "settings"] [suppress: "AGENT_UNGUARDED_TOOL_EXECUTOR"] [position: 200 200]
427
427
  * @node detect weaverDetectProvider [color: "cyan"] [icon: "search"] [suppress: "OBJECT_TYPE_MISMATCH", "ANNOTATION_SIGNATURE_TYPE_MISMATCH"] [position: 400 200]
428
428
  * @node receive weaverReceiveTask [color: "blue"] [icon: "send"] [position: 600 200]
429
429
  * @node route weaverRouteTask [color: "purple"] [icon: "flow"] [position: 800 200]
@@ -441,7 +441,7 @@ class GeneratedExecutionContext {
441
441
  * @node resolveReviewModel weaverResolveModel [label: "Review Model"] [expr: phaseName="'review'"] [minimized] [color: "green"] [icon: "tune"] [position: 1900 50]
442
442
  * @node review weaverReviewResult [color: "green"] [icon: "spellcheck"] [position: 1950 100]
443
443
  * @node mergeReview weaverCtxMerge [label: "Merge Review"] [minimized] [color: "teal"] [icon: "callMerge"] [position: 2050 200]
444
- * @node gitOps weaverGitOps [color: "green"] [icon: "code"] [position: 2150 100]
444
+ * @node gitOps weaverGitOps [color: "green"] [icon: "code"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 2150 100]
445
445
  * @node notify weaverSendNotify [color: "yellow"] [icon: "send"] [suppress: "UNUSED_OUTPUT_PORT"] [position: 2050 400]
446
446
  * @node report weaverBotReport [color: "green"] [icon: "description"] [suppress: "UNUSED_OUTPUT_PORT", "DESIGN_ASYNC_NO_ERROR_PATH"] [position: 2350 200]
447
447
  * @path Start -> cfg -> detect -> receive -> route -> context -> gatePlan -> resolvePlanModel -> plan -> mergePlan -> approve -> resolveExecModel -> execRetry -> gateReview -> resolveReviewModel -> review -> mergeReview -> gitOps -> report -> Exit
@@ -465,11 +465,12 @@ class GeneratedExecutionContext {
465
465
  * @connect readWf.onSuccess -> report.execute
466
466
  * @connect abort.onSuccess -> report.execute
467
467
  * @connect notify.onSuccess -> report.execute
468
- * @connect gitOps.ctx -> report.mainCtx
468
+ * @connect mergePlan.ctx -> report.mainCtx
469
469
  * @connect readWf.ctx -> report.readCtx
470
470
  * @connect abort.ctx -> report.abortCtx
471
- * @connect execRetry.ctx -> report.failCtx
471
+ * @connect plan.ctx -> report.failCtx
472
472
  * @connect report.summary -> Exit.summary
473
+ * @connect review.onFailure -> report.execute
473
474
  * @param execute [order:-1] - Execute
474
475
  * @param taskJson [order:0] - TaskJson
475
476
  * @param projectDir [order:1] - ProjectDir
@@ -2116,15 +2117,15 @@ export async function weaverBot(
2116
2117
  });
2117
2118
 
2118
2119
  try {
2119
- const report_execute = (readWfIdx !== undefined ? await ctx.getVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx }) as boolean : false) || (abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx }) as boolean : false) || (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) as boolean : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) as boolean : false) || (receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx }) as boolean : false) || (planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx }) as boolean : false) || (execRetryIdx !== undefined ? await ctx.getVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx }) as boolean : false);
2120
+ const report_execute = (readWfIdx !== undefined ? await ctx.getVariable({ id: 'readWf', portName: 'onSuccess', executionIndex: readWfIdx }) as boolean : false) || (abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'onSuccess', executionIndex: abortIdx }) as boolean : false) || (notifyIdx !== undefined ? await ctx.getVariable({ id: 'notify', portName: 'onSuccess', executionIndex: notifyIdx }) as boolean : false) || (gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'onSuccess', executionIndex: gitOpsIdx }) as boolean : false) || (receiveIdx !== undefined ? await ctx.getVariable({ id: 'receive', portName: 'onFailure', executionIndex: receiveIdx }) as boolean : false) || (planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'onFailure', executionIndex: planIdx }) as boolean : false) || (execRetryIdx !== undefined ? await ctx.getVariable({ id: 'execRetry', portName: 'onFailure', executionIndex: execRetryIdx }) as boolean : false) || (reviewIdx !== undefined ? await ctx.getVariable({ id: 'review', portName: 'onFailure', executionIndex: reviewIdx }) as boolean : false);
2120
2121
  await ctx.setVariable({ id: 'report', portName: 'execute', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_execute);
2121
- const report_mainCtx = gitOpsIdx !== undefined ? await ctx.getVariable({ id: 'gitOps', portName: 'ctx', executionIndex: gitOpsIdx }) as string : undefined;
2122
+ const report_mainCtx = mergePlanIdx !== undefined ? await ctx.getVariable({ id: 'mergePlan', portName: 'ctx', executionIndex: mergePlanIdx }) as string : undefined;
2122
2123
  await ctx.setVariable({ id: 'report', portName: 'mainCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_mainCtx);
2123
2124
  const report_readCtx = readWfIdx !== undefined ? await ctx.getVariable({ id: 'readWf', portName: 'ctx', executionIndex: readWfIdx }) as string : undefined;
2124
2125
  await ctx.setVariable({ id: 'report', portName: 'readCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_readCtx);
2125
2126
  const report_abortCtx = abortIdx !== undefined ? await ctx.getVariable({ id: 'abort', portName: 'ctx', executionIndex: abortIdx }) as string : undefined;
2126
2127
  await ctx.setVariable({ id: 'report', portName: 'abortCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_abortCtx);
2127
- const report_failCtx = execRetryIdx !== undefined ? await ctx.getVariable({ id: 'execRetry', portName: 'ctx', executionIndex: execRetryIdx }) as string : undefined;
2128
+ const report_failCtx = planIdx !== undefined ? await ctx.getVariable({ id: 'plan', portName: 'ctx', executionIndex: planIdx }) as string : undefined;
2128
2129
  await ctx.setVariable({ id: 'report', portName: 'failCtx', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, report_failCtx);
2129
2130
  const reportResult = await weaverBotReport(report_execute, report_mainCtx, report_readCtx, report_abortCtx, report_failCtx);
2130
2131
  await ctx.setVariable({ id: 'report', portName: 'summary', executionIndex: reportIdx, nodeTypeName: 'weaverBotReport' }, reportResult.summary);