@synergenius/flow-weaver-pack-weaver 0.9.201 → 0.9.203

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 (38) hide show
  1. package/dist/bot/preflight.d.ts.map +1 -1
  2. package/dist/bot/preflight.js +26 -0
  3. package/dist/bot/preflight.js.map +1 -1
  4. package/dist/bot/task-create-handler.d.ts +9 -0
  5. package/dist/bot/task-create-handler.d.ts.map +1 -1
  6. package/dist/bot/task-create-handler.js +26 -0
  7. package/dist/bot/task-create-handler.js.map +1 -1
  8. package/dist/node-types/agent-execute.d.ts.map +1 -1
  9. package/dist/node-types/agent-execute.js +26 -9
  10. package/dist/node-types/agent-execute.js.map +1 -1
  11. package/dist/node-types/plan-task.d.ts.map +1 -1
  12. package/dist/node-types/plan-task.js +28 -2
  13. package/dist/node-types/plan-task.js.map +1 -1
  14. package/dist/ui/bot-slot-card.js +10 -0
  15. package/dist/ui/budget-bar.js +5 -3
  16. package/dist/ui/budget-strip.js +156 -0
  17. package/dist/ui/chat-task-result.js +22 -27
  18. package/dist/ui/instance-stream-view.js +36 -0
  19. package/dist/ui/swarm-dashboard.js +1596 -1654
  20. package/dist/ui/task-detail-view.js +973 -485
  21. package/dist/ui/task-editor.js +32 -34
  22. package/dist/ui/task-pool-list.js +11 -3
  23. package/flowweaver.manifest.json +1 -1
  24. package/package.json +3 -2
  25. package/src/bot/preflight.ts +26 -0
  26. package/src/bot/task-create-handler.ts +39 -0
  27. package/src/node-types/agent-execute.ts +27 -10
  28. package/src/node-types/plan-task.ts +25 -2
  29. package/src/ui/bot-slot-card.tsx +23 -0
  30. package/src/ui/budget-bar.tsx +13 -5
  31. package/src/ui/budget-strip.tsx +199 -0
  32. package/src/ui/chat-task-result.tsx +5 -25
  33. package/src/ui/instance-stream-view.tsx +50 -1
  34. package/src/ui/swarm-dashboard.tsx +89 -84
  35. package/src/ui/task-detail-view.tsx +376 -442
  36. package/src/ui/task-editor.tsx +65 -96
  37. package/src/ui/task-pool-list.tsx +3 -12
  38. package/src/ui/task-status.ts +60 -0
@@ -12,6 +12,7 @@ import {
12
12
  Flex, Typography, Input, Button, IconButton, Chip, Field,
13
13
  toast, usePackWorkspace,
14
14
  } from '@fw/plugin-ui-kit';
15
+ import { TaskStatus, TASK_STATUS_COLOR } from './task-status';
15
16
 
16
17
  // ---------------------------------------------------------------------------
17
18
  // Types
@@ -23,10 +24,10 @@ interface TaskEditorProps {
23
24
  onSave: () => void;
24
25
  onCancel: () => void;
25
26
  onDelete?: () => void;
27
+ /** When true, hides the header bar and footer — just renders the form body. */
28
+ embedded?: boolean;
26
29
  }
27
30
 
28
- type TaskStatus = 'open' | 'in-progress' | 'done' | 'cancelled';
29
-
30
31
  interface TaskData {
31
32
  id: string;
32
33
  title: string;
@@ -70,18 +71,11 @@ const COMPLEXITY_OPTIONS = [
70
71
  { id: 'complex', label: 'Complex' },
71
72
  ];
72
73
 
73
- const STATUS_COLOR: Record<string, string> = {
74
- 'open': 'color-brand-alt',
75
- 'in-progress': 'color-status-info',
76
- 'done': 'color-status-positive',
77
- 'cancelled': 'color-status-negative',
78
- };
79
-
80
74
  // ---------------------------------------------------------------------------
81
75
  // Component
82
76
  // ---------------------------------------------------------------------------
83
77
 
84
- function TaskEditor({ mode, taskId, onSave, onCancel, onDelete }: TaskEditorProps) {
78
+ function TaskEditor({ mode, taskId, onSave, onCancel, onDelete, embedded }: TaskEditorProps) {
85
79
  const ctx = usePackWorkspace();
86
80
  const { callTool } = ctx;
87
81
 
@@ -337,34 +331,36 @@ function TaskEditor({ mode, taskId, onSave, onCancel, onDelete }: TaskEditorProp
337
331
  variant="column-stretch-start-nowrap-0"
338
332
  style={{ width: '100%', height: '100%', overflow: 'hidden' }}
339
333
  >
340
- {/* -- Header bar -- */}
341
- <Flex
342
- variant="row-center-space-between-nowrap-8"
343
- style={{ padding: '8px 16px', flexShrink: 0, borderBottom: '1px solid var(--color-border-default)' }}
344
- >
345
- <Flex variant="row-center-start-nowrap-8">
346
- <IconButton
347
- icon="back"
348
- size="xs"
349
- variant="clear"
350
- onClick={handleBack}
351
- title="Back"
352
- />
353
- <Typography variant="caption-thick" color="color-text-high">
354
- {mode === 'create' ? 'Create Task' : 'Edit Task'}
355
- </Typography>
334
+ {/* -- Header bar (hidden when embedded) -- */}
335
+ {!embedded && (
336
+ <Flex
337
+ variant="row-center-space-between-nowrap-8"
338
+ style={{ padding: '8px 16px', flexShrink: 0, borderBottom: '1px solid var(--color-border-default)' }}
339
+ >
340
+ <Flex variant="row-center-start-nowrap-8">
341
+ <IconButton
342
+ icon="back"
343
+ size="xs"
344
+ variant="clear"
345
+ onClick={handleBack}
346
+ title="Back"
347
+ />
348
+ <Typography variant="caption-thick" color="color-text-high">
349
+ {mode === 'create' ? 'Create Task' : 'Edit Task'}
350
+ </Typography>
351
+ </Flex>
352
+ {mode === 'edit' && onDelete && (
353
+ <IconButton
354
+ icon="outlinedDelete"
355
+ size="sm"
356
+ variant="clear"
357
+ color="danger"
358
+ onClick={handleDelete}
359
+ title="Cancel task"
360
+ />
361
+ )}
356
362
  </Flex>
357
- {mode === 'edit' && onDelete && (
358
- <IconButton
359
- icon="outlinedDelete"
360
- size="sm"
361
- variant="clear"
362
- color="danger"
363
- onClick={handleDelete}
364
- title="Cancel task"
365
- />
366
- )}
367
- </Flex>
363
+ )}
368
364
 
369
365
  {/* -- Scrollable form body -- */}
370
366
  <Flex
@@ -377,7 +373,7 @@ function TaskEditor({ mode, taskId, onSave, onCancel, onDelete }: TaskEditorProp
377
373
  <Chip
378
374
  label={taskData.status}
379
375
  size="small"
380
- color={STATUS_COLOR[taskData.status] || 'color-brand-alt'}
376
+ color={TASK_STATUS_COLOR[taskData.status] || 'color-brand-alt'}
381
377
  />
382
378
  </Field>
383
379
  )}
@@ -590,67 +586,40 @@ function TaskEditor({ mode, taskId, onSave, onCancel, onDelete }: TaskEditorProp
590
586
  </Flex>
591
587
  </Field>
592
588
 
593
- {/* -- Edit-only: read-only metadata -- */}
594
- {mode === 'edit' && taskData && (
595
- <Flex
596
- variant="column-stretch-start-nowrap-10"
597
- style={{ marginTop: 8, paddingTop: 12, borderTop: '1px solid var(--color-border-default)' }}
598
- >
599
- <Field label="Created by">
600
- <Typography variant="smallCaption-regular" color="color-text-medium">
601
- {taskData.createdBy || 'unknown'}
602
- </Typography>
603
- </Field>
604
- <Field label="Created at">
605
- <Typography variant="smallCaption-regular" color="color-text-medium">
606
- {taskData.createdAt ? new Date(taskData.createdAt).toLocaleString() : '-'}
607
- </Typography>
608
- </Field>
609
- <Field label="Updated at">
610
- <Typography variant="smallCaption-regular" color="color-text-medium">
611
- {taskData.updatedAt ? new Date(taskData.updatedAt).toLocaleString() : '-'}
612
- </Typography>
613
- </Field>
614
- <Field label="Tokens used">
615
- <Typography variant="smallCaption-regular" color="color-text-medium">
616
- {(taskData.tokensUsed ?? 0).toLocaleString()}
617
- </Typography>
618
- </Field>
619
- <Field label="Cost used">
620
- <Typography variant="smallCaption-regular" color="color-text-medium">
621
- {`$${(taskData.costUsed ?? 0).toFixed(3)}`}
622
- </Typography>
623
- </Field>
624
- {(taskData.context?.runHistory as Array<{ remainingWork?: string }> | undefined)?.slice(-1)?.[0]?.remainingWork && (
625
- <Field label="Remaining work" align="start">
626
- <Typography
627
- variant="smallCaption-regular"
628
- color="color-status-caution"
629
- style={{ fontFamily: 'var(--font-mono, monospace)', whiteSpace: 'pre-wrap' }}
630
- >
631
- {(taskData.context.runHistory as Array<{ remainingWork?: string }>).slice(-1)[0]?.remainingWork}
632
- </Typography>
633
- </Field>
634
- )}
635
- </Flex>
636
- )}
637
589
  </Flex>
638
590
 
639
- {/* -- Footer bar with save button -- */}
640
- <Flex
641
- variant="row-center-end-nowrap-8"
642
- style={{ padding: '8px 16px', flexShrink: 0, borderTop: '1px solid var(--color-border-default)' }}
643
- >
644
- <Button
645
- size="xs"
646
- variant="fill"
647
- color="primary"
648
- onClick={handleSave}
649
- disabled={!title.trim()}
591
+ {/* -- Footer bar with save button (hidden when embedded — save inline) -- */}
592
+ {!embedded ? (
593
+ <Flex
594
+ variant="row-center-end-nowrap-8"
595
+ style={{ padding: '8px 16px', flexShrink: 0, borderTop: '1px solid var(--color-border-default)' }}
650
596
  >
651
- {mode === 'create' ? 'Create' : 'Save'}
652
- </Button>
653
- </Flex>
597
+ <Button
598
+ size="xs"
599
+ variant="fill"
600
+ color="primary"
601
+ onClick={handleSave}
602
+ disabled={!title.trim()}
603
+ >
604
+ {mode === 'create' ? 'Create' : 'Save'}
605
+ </Button>
606
+ </Flex>
607
+ ) : (
608
+ <Flex
609
+ variant="row-center-end-nowrap-8"
610
+ style={{ padding: '8px 16px', flexShrink: 0 }}
611
+ >
612
+ <Button
613
+ size="xs"
614
+ variant="fill"
615
+ color="primary"
616
+ onClick={handleSave}
617
+ disabled={!title.trim()}
618
+ >
619
+ Save
620
+ </Button>
621
+ </Flex>
622
+ )}
654
623
  </Flex>
655
624
  );
656
625
  }
@@ -7,11 +7,10 @@
7
7
  */
8
8
  import React, { useState } from 'react';
9
9
  import { Flex, Typography, Icon, StatusIcon, Chip, ScrollArea, Badge, EmptyState } from '@fw/plugin-ui-kit';
10
+ import { TaskStatus, TASK_STATUS_ICON, TASK_STATUS_ICON_OVERRIDE } from './task-status';
10
11
 
11
12
  // --- Types ---
12
13
 
13
- type TaskStatus = 'open' | 'in-progress' | 'done' | 'cancelled';
14
-
15
14
  interface Task {
16
15
  id: string;
17
16
  title: string;
@@ -28,15 +27,6 @@ interface TaskPoolListProps {
28
27
  onTaskClick: (taskId: string) => void;
29
28
  }
30
29
 
31
- // --- Status mapping ---
32
-
33
- const statusToIcon: Record<TaskStatus, string> = {
34
- 'open': 'pending',
35
- 'in-progress': 'running',
36
- 'done': 'completed',
37
- 'cancelled': 'failed',
38
- };
39
-
40
30
  // --- Row styles ---
41
31
 
42
32
  const rowBaseStyle: React.CSSProperties = {
@@ -118,7 +108,8 @@ function TaskRowItem({ task, indent, onClick }: { key?: string; task: Task; inde
118
108
  onMouseLeave={() => setHovered(false)}
119
109
  >
120
110
  <StatusIcon
121
- status={statusToIcon[task.status] || 'pending'}
111
+ status={TASK_STATUS_ICON[task.status] || 'pending'}
112
+ icon={TASK_STATUS_ICON_OVERRIDE[task.status]}
122
113
  size="sm"
123
114
  />
124
115
 
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Centralized task status mappings — icons, labels, colors, chip variants.
3
+ *
4
+ * Import from here instead of duplicating in every UI file.
5
+ */
6
+
7
+ export type TaskStatus = 'open' | 'in-progress' | 'done' | 'cancelled';
8
+
9
+ /** StatusIcon `status` prop value for each task state. */
10
+ export const TASK_STATUS_ICON: Record<TaskStatus, string> = {
11
+ 'open': 'pending',
12
+ 'in-progress': 'running',
13
+ 'done': 'completed',
14
+ 'cancelled': 'failed',
15
+ };
16
+
17
+ /** Override the default icon rendered by StatusIcon (e.g. replace playArrow). */
18
+ export const TASK_STATUS_ICON_OVERRIDE: Partial<Record<TaskStatus, string>> = {
19
+ 'in-progress': 'pendingActions',
20
+ };
21
+
22
+ /** Human-readable labels. */
23
+ export const TASK_STATUS_LABEL: Record<TaskStatus, string> = {
24
+ 'open': 'Open',
25
+ 'in-progress': 'In Progress',
26
+ 'done': 'Done',
27
+ 'cancelled': 'Cancelled',
28
+ };
29
+
30
+ /** StatusChip variant for each task state. */
31
+ export const TASK_STATUS_CHIP: Record<TaskStatus, 'info' | 'warning' | 'error' | 'success'> = {
32
+ 'open': 'info',
33
+ 'in-progress': 'warning',
34
+ 'done': 'success',
35
+ 'cancelled': 'error',
36
+ };
37
+
38
+ /** Semantic color token for each task state. */
39
+ export const TASK_STATUS_COLOR: Record<TaskStatus, string> = {
40
+ 'open': 'color-brand-alt',
41
+ 'in-progress': 'color-status-info',
42
+ 'done': 'color-status-positive',
43
+ 'cancelled': 'color-status-negative',
44
+ };
45
+
46
+ /** Kanban board column color (used in swarm dashboard). */
47
+ export const TASK_STATUS_BOARD_COLOR: Record<TaskStatus, string> = {
48
+ 'open': 'color-text-subtle',
49
+ 'in-progress': 'color-brand-main',
50
+ 'done': 'color-status-positive',
51
+ 'cancelled': 'color-status-negative',
52
+ };
53
+
54
+ /** Kanban board column label (may differ from status label). */
55
+ export const TASK_STATUS_BOARD_LABEL: Record<TaskStatus, string> = {
56
+ 'open': 'Ready',
57
+ 'in-progress': 'In Progress',
58
+ 'done': 'Done',
59
+ 'cancelled': 'Cancelled',
60
+ };