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

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 (181) hide show
  1. package/dist/ai-chat-provider.js +5 -5
  2. package/dist/ai-chat-provider.js.map +1 -1
  3. package/dist/bot/acceptance-merge.d.ts +21 -0
  4. package/dist/bot/acceptance-merge.d.ts.map +1 -0
  5. package/dist/bot/acceptance-merge.js +46 -0
  6. package/dist/bot/acceptance-merge.js.map +1 -0
  7. package/dist/bot/ai-client.d.ts +14 -2
  8. package/dist/bot/ai-client.d.ts.map +1 -1
  9. package/dist/bot/ai-client.js +71 -24
  10. package/dist/bot/ai-client.js.map +1 -1
  11. package/dist/bot/assistant-tools.js +3 -3
  12. package/dist/bot/assistant-tools.js.map +1 -1
  13. package/dist/bot/audit-logger.d.ts.map +1 -1
  14. package/dist/bot/audit-logger.js +34 -14
  15. package/dist/bot/audit-logger.js.map +1 -1
  16. package/dist/bot/audit-trail.d.ts +67 -0
  17. package/dist/bot/audit-trail.d.ts.map +1 -0
  18. package/dist/bot/audit-trail.js +153 -0
  19. package/dist/bot/audit-trail.js.map +1 -0
  20. package/dist/bot/behavior-defaults.d.ts +1 -1
  21. package/dist/bot/behavior-defaults.d.ts.map +1 -1
  22. package/dist/bot/behavior-defaults.js +7 -3
  23. package/dist/bot/behavior-defaults.js.map +1 -1
  24. package/dist/bot/capability-registry.d.ts +9 -0
  25. package/dist/bot/capability-registry.d.ts.map +1 -1
  26. package/dist/bot/capability-registry.js +81 -27
  27. package/dist/bot/capability-registry.js.map +1 -1
  28. package/dist/bot/capability-types.d.ts +10 -0
  29. package/dist/bot/capability-types.d.ts.map +1 -1
  30. package/dist/bot/cli-provider.d.ts.map +1 -1
  31. package/dist/bot/cli-provider.js +8 -7
  32. package/dist/bot/cli-provider.js.map +1 -1
  33. package/dist/bot/preflight.d.ts +48 -0
  34. package/dist/bot/preflight.d.ts.map +1 -0
  35. package/dist/bot/preflight.js +247 -0
  36. package/dist/bot/preflight.js.map +1 -0
  37. package/dist/bot/provider-shim.d.ts +74 -0
  38. package/dist/bot/provider-shim.d.ts.map +1 -0
  39. package/dist/bot/provider-shim.js +176 -0
  40. package/dist/bot/provider-shim.js.map +1 -0
  41. package/dist/bot/runner.d.ts +2 -0
  42. package/dist/bot/runner.d.ts.map +1 -1
  43. package/dist/bot/runner.js +60 -17
  44. package/dist/bot/runner.js.map +1 -1
  45. package/dist/bot/step-executor.d.ts.map +1 -1
  46. package/dist/bot/step-executor.js +72 -115
  47. package/dist/bot/step-executor.js.map +1 -1
  48. package/dist/bot/swarm-controller.d.ts +2 -0
  49. package/dist/bot/swarm-controller.d.ts.map +1 -1
  50. package/dist/bot/swarm-controller.js +92 -20
  51. package/dist/bot/swarm-controller.js.map +1 -1
  52. package/dist/bot/task-create-handler.d.ts +37 -0
  53. package/dist/bot/task-create-handler.d.ts.map +1 -0
  54. package/dist/bot/task-create-handler.js +124 -0
  55. package/dist/bot/task-create-handler.js.map +1 -0
  56. package/dist/bot/task-store.d.ts +1 -0
  57. package/dist/bot/task-store.d.ts.map +1 -1
  58. package/dist/bot/task-store.js +67 -0
  59. package/dist/bot/task-store.js.map +1 -1
  60. package/dist/bot/types.d.ts +1 -1
  61. package/dist/bot/types.d.ts.map +1 -1
  62. package/dist/bot/weaver-tools.d.ts.map +1 -1
  63. package/dist/bot/weaver-tools.js +7 -39
  64. package/dist/bot/weaver-tools.js.map +1 -1
  65. package/dist/node-types/agent-execute.d.ts +25 -8
  66. package/dist/node-types/agent-execute.d.ts.map +1 -1
  67. package/dist/node-types/agent-execute.js +89 -23
  68. package/dist/node-types/agent-execute.js.map +1 -1
  69. package/dist/node-types/bot-report.d.ts.map +1 -1
  70. package/dist/node-types/bot-report.js +24 -3
  71. package/dist/node-types/bot-report.js.map +1 -1
  72. package/dist/node-types/plan-task.d.ts +8 -17
  73. package/dist/node-types/plan-task.d.ts.map +1 -1
  74. package/dist/node-types/plan-task.js +217 -256
  75. package/dist/node-types/plan-task.js.map +1 -1
  76. package/dist/node-types/review-result.js +8 -6
  77. package/dist/node-types/review-result.js.map +1 -1
  78. package/dist/palindrome.d.ts +9 -0
  79. package/dist/palindrome.d.ts.map +1 -0
  80. package/dist/palindrome.js +14 -0
  81. package/dist/palindrome.js.map +1 -0
  82. package/dist/ui/approval-card.js +91 -82
  83. package/dist/ui/bot-activity.js +73 -56
  84. package/dist/ui/bot-config.js +48 -31
  85. package/dist/ui/bot-dashboard.js +52 -36
  86. package/dist/ui/bot-panel.js +230 -228
  87. package/dist/ui/bot-slot-card.js +100 -90
  88. package/dist/ui/bot-status.js +37 -15
  89. package/dist/ui/budget-bar.js +57 -31
  90. package/dist/ui/capability-editor.js +447 -378
  91. package/dist/ui/chat-task-result.js +78 -71
  92. package/dist/ui/decision-log.js +68 -81
  93. package/dist/ui/genesis-block.js +86 -95
  94. package/dist/ui/instance-stream-view.js +722 -0
  95. package/dist/ui/profile-card.js +96 -221
  96. package/dist/ui/profile-editor.js +532 -575
  97. package/dist/ui/settings-section.js +41 -45
  98. package/dist/ui/swarm-controls.js +212 -135
  99. package/dist/ui/swarm-dashboard.js +3992 -2715
  100. package/dist/ui/task-detail-view.js +415 -521
  101. package/dist/ui/task-editor.js +339 -390
  102. package/dist/ui/task-pool-list.js +60 -55
  103. package/dist/workflows/src/palindrome.d.ts +11 -0
  104. package/dist/workflows/src/palindrome.d.ts.map +1 -0
  105. package/dist/workflows/src/palindrome.js +16 -0
  106. package/dist/workflows/src/palindrome.js.map +1 -0
  107. package/dist/workflows/tests/palindrome.test.d.ts +2 -0
  108. package/dist/workflows/tests/palindrome.test.d.ts.map +1 -0
  109. package/dist/workflows/tests/palindrome.test.js +41 -0
  110. package/dist/workflows/tests/palindrome.test.js.map +1 -0
  111. package/dist/workflows/weaver-bot-batch.js +1 -1
  112. package/dist/workflows/weaver-bot-batch.js.map +1 -1
  113. package/dist/workflows/weaver-bot.js +1 -1
  114. package/dist/workflows/weaver-bot.js.map +1 -1
  115. package/flowweaver.manifest.json +1 -1
  116. package/package.json +8 -2
  117. package/src/ai-chat-provider.ts +5 -5
  118. package/src/bot/acceptance-merge.ts +62 -0
  119. package/src/bot/ai-client.ts +77 -21
  120. package/src/bot/assistant-tools.ts +3 -3
  121. package/src/bot/audit-logger.ts +42 -14
  122. package/src/bot/audit-trail.ts +211 -0
  123. package/src/bot/behavior-defaults.ts +7 -2
  124. package/src/bot/capability-registry.ts +84 -28
  125. package/src/bot/capability-types.ts +11 -0
  126. package/src/bot/cli-provider.ts +8 -7
  127. package/src/bot/preflight.ts +285 -0
  128. package/src/bot/provider-shim.ts +218 -0
  129. package/src/bot/runner.ts +68 -20
  130. package/src/bot/step-executor.ts +69 -127
  131. package/src/bot/swarm-controller.ts +94 -20
  132. package/src/bot/task-create-handler.ts +164 -0
  133. package/src/bot/task-store.ts +83 -0
  134. package/src/bot/types.ts +4 -1
  135. package/src/bot/weaver-tools.ts +7 -45
  136. package/src/node-types/agent-execute.ts +102 -16
  137. package/src/node-types/bot-report.ts +24 -3
  138. package/src/node-types/plan-task.ts +238 -280
  139. package/src/node-types/review-result.ts +8 -6
  140. package/src/palindrome.ts +14 -0
  141. package/src/ui/approval-card.tsx +78 -62
  142. package/src/ui/bot-activity.tsx +12 -10
  143. package/src/ui/bot-config.tsx +12 -10
  144. package/src/ui/bot-dashboard.tsx +13 -11
  145. package/src/ui/bot-panel.tsx +189 -171
  146. package/src/ui/bot-slot-card.tsx +125 -70
  147. package/src/ui/bot-status.tsx +4 -4
  148. package/src/ui/budget-bar.tsx +86 -25
  149. package/src/ui/capability-editor.tsx +392 -257
  150. package/src/ui/chat-task-result.tsx +81 -78
  151. package/src/ui/decision-log.tsx +76 -73
  152. package/src/ui/genesis-block.tsx +91 -61
  153. package/src/ui/instance-stream-view.tsx +861 -0
  154. package/src/ui/profile-card.tsx +195 -168
  155. package/src/ui/profile-editor.tsx +453 -370
  156. package/src/ui/settings-section.tsx +46 -39
  157. package/src/ui/swarm-controls.tsx +252 -123
  158. package/src/ui/swarm-dashboard.tsx +999 -466
  159. package/src/ui/task-detail-view.tsx +485 -428
  160. package/src/ui/task-editor.tsx +329 -271
  161. package/src/ui/task-pool-list.tsx +68 -62
  162. package/src/workflows/src/palindrome.ts +16 -0
  163. package/src/workflows/tests/palindrome.test.ts +49 -0
  164. package/src/workflows/weaver-bot-batch.ts +1 -1
  165. package/src/workflows/weaver-bot.ts +1 -1
  166. package/dist/ui/bot-constants.d.ts +0 -14
  167. package/dist/ui/bot-constants.d.ts.map +0 -1
  168. package/dist/ui/bot-constants.js +0 -189
  169. package/dist/ui/bot-constants.js.map +0 -1
  170. package/dist/ui/steer-api.d.ts +0 -7
  171. package/dist/ui/steer-api.d.ts.map +0 -1
  172. package/dist/ui/steer-api.js +0 -11
  173. package/dist/ui/steer-api.js.map +0 -1
  174. package/dist/ui/trace-to-timeline.d.ts +0 -91
  175. package/dist/ui/trace-to-timeline.d.ts.map +0 -1
  176. package/dist/ui/trace-to-timeline.js +0 -116
  177. package/dist/ui/trace-to-timeline.js.map +0 -1
  178. package/dist/ui/use-stream-timeline.d.ts +0 -50
  179. package/dist/ui/use-stream-timeline.d.ts.map +0 -1
  180. package/dist/ui/use-stream-timeline.js +0 -245
  181. package/dist/ui/use-stream-timeline.js.map +0 -1
@@ -24,6 +24,8 @@ __export(task_detail_view_exports, {
24
24
  default: () => task_detail_view_default
25
25
  });
26
26
  module.exports = __toCommonJS(task_detail_view_exports);
27
+ var import_react = require("react");
28
+ var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
27
29
 
28
30
  // src/ui/use-stream-timeline.ts
29
31
  var React = require("react");
@@ -325,28 +327,7 @@ function traceToTimeline(run) {
325
327
  }
326
328
 
327
329
  // src/ui/task-detail-view.tsx
328
- var React2 = require("react");
329
- var { useState: useState2, useEffect: useEffect2, useCallback, useRef: useRef2, useMemo: useMemo2 } = React2;
330
- var {
331
- Flex,
332
- Typography,
333
- ScrollArea,
334
- StatusIcon,
335
- Badge,
336
- Icon,
337
- IconButton,
338
- TaskBlock,
339
- Button,
340
- Card,
341
- Chip,
342
- Checkbox,
343
- Table,
344
- Tabs,
345
- EmptyState,
346
- toast,
347
- usePackWorkspace,
348
- useEventStream
349
- } = require("@fw/plugin-ui-kit");
330
+ var import_jsx_runtime = require("react/jsx-runtime");
350
331
  var statusToIcon = {
351
332
  "open": "pending",
352
333
  "in-progress": "running",
@@ -385,44 +366,45 @@ var subtaskRowHoverStyle = {
385
366
  backgroundColor: "var(--color-surface-elevated)"
386
367
  };
387
368
  function SubtaskRowItem({ sub, onBack }) {
388
- const [hovered, setHovered] = useState2(false);
389
- return React2.createElement(
390
- Flex,
369
+ const [hovered, setHovered] = (0, import_react.useState)(false);
370
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
371
+ import_plugin_ui_kit.Flex,
391
372
  {
392
373
  variant: "row-center-start-nowrap-8",
393
374
  style: hovered ? subtaskRowHoverStyle : subtaskRowStyle,
394
375
  onClick: () => onBack(),
395
376
  onMouseEnter: () => setHovered(true),
396
- onMouseLeave: () => setHovered(false)
397
- },
398
- React2.createElement(StatusIcon, {
399
- status: statusToIcon[sub.status] || "pending",
400
- size: "sm"
401
- }),
402
- React2.createElement(
403
- Flex,
404
- {
405
- variant: "row-center-start-nowrap-0",
406
- style: { flex: 1, minWidth: 0 }
407
- },
408
- React2.createElement(Typography, { variant: "caption-regular", truncate: true }, sub.title)
409
- ),
410
- sub.assignedProfile && React2.createElement(Chip, {
411
- label: sub.assignedProfile,
412
- size: "small",
413
- color: "color-status-info"
414
- })
377
+ onMouseLeave: () => setHovered(false),
378
+ children: [
379
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
380
+ import_plugin_ui_kit.StatusIcon,
381
+ {
382
+ status: statusToIcon[sub.status] || "pending",
383
+ size: "sm"
384
+ }
385
+ ),
386
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
387
+ import_plugin_ui_kit.Flex,
388
+ {
389
+ variant: "row-center-start-nowrap-0",
390
+ style: { flex: 1, minWidth: 0 },
391
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", truncate: true, children: sub.title })
392
+ }
393
+ ),
394
+ sub.assignedProfile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Chip, { label: sub.assignedProfile, size: "small", color: "color-status-info" })
395
+ ]
396
+ }
415
397
  );
416
398
  }
417
399
  function TaskDetailView({ taskId, onBack, onEdit }) {
418
- const ctx = usePackWorkspace();
400
+ const ctx = (0, import_plugin_ui_kit.usePackWorkspace)();
419
401
  const { callTool } = ctx;
420
402
  const packId = ctx.packId;
421
- const [task, setTask] = useState2(null);
422
- const [subtasks, setSubtasks] = useState2([]);
423
- const [history, setHistory] = useState2([]);
424
- const [loading, setLoading] = useState2(true);
425
- const fetchTask = useCallback(async () => {
403
+ const [task, setTask] = (0, import_react.useState)(null);
404
+ const [subtasks, setSubtasks] = (0, import_react.useState)([]);
405
+ const [history, setHistory] = (0, import_react.useState)([]);
406
+ const [loading, setLoading] = (0, import_react.useState)(true);
407
+ const fetchTask = (0, import_react.useCallback)(async () => {
426
408
  try {
427
409
  const raw = await callTool("fw_weaver_task_get", { id: taskId });
428
410
  const data = typeof raw === "string" ? JSON.parse(raw) : raw;
@@ -460,7 +442,7 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
460
442
  } catch (err) {
461
443
  }
462
444
  }, [callTool, taskId]);
463
- const fetchHistory = useCallback(async () => {
445
+ const fetchHistory = (0, import_react.useCallback)(async () => {
464
446
  try {
465
447
  const raw = await callTool("fw_weaver_history", { taskId });
466
448
  const data = typeof raw === "string" ? JSON.parse(raw) : raw;
@@ -476,11 +458,11 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
476
458
  } catch {
477
459
  }
478
460
  }, [callTool, taskId]);
479
- useEffect2(() => {
461
+ (0, import_react.useEffect)(() => {
480
462
  setLoading(true);
481
463
  Promise.all([fetchTask(), fetchHistory()]).finally(() => setLoading(false));
482
464
  }, [fetchTask, fetchHistory]);
483
- useEffect2(() => {
465
+ (0, import_react.useEffect)(() => {
484
466
  if (!task || task.status !== "in-progress") return;
485
467
  const interval = setInterval(() => {
486
468
  fetchTask();
@@ -488,7 +470,7 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
488
470
  }, 5e3);
489
471
  return () => clearInterval(interval);
490
472
  }, [task?.status, fetchTask, fetchHistory]);
491
- const stream = useEventStream();
473
+ const stream = (0, import_plugin_ui_kit.useEventStream)();
492
474
  const {
493
475
  timeline: liveTimeline,
494
476
  phase: livePhase,
@@ -501,33 +483,33 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
501
483
  } = useStreamTimeline(stream.events, stream.isDone);
502
484
  const activeRunId = task?.activeRunId;
503
485
  const isLive = task?.status === "in-progress" && !!activeRunId;
504
- useEffect2(() => {
486
+ (0, import_react.useEffect)(() => {
505
487
  if (!isLive || !activeRunId) return;
506
488
  stream.start(packId, "fw_weaver_events", activeRunId);
507
489
  return () => stream.stop();
508
490
  }, [isLive, activeRunId, packId]);
509
- const [detailTab, setDetailTab] = useState2("runs");
510
- const [actionLoading, setActionLoading] = useState2(null);
511
- const [availableProfiles, setAvailableProfiles] = useState2([]);
512
- useEffect2(() => {
491
+ const [detailTab, setDetailTab] = (0, import_react.useState)("runs");
492
+ const [actionLoading, setActionLoading] = (0, import_react.useState)(null);
493
+ const [availableProfiles, setAvailableProfiles] = (0, import_react.useState)([]);
494
+ (0, import_react.useEffect)(() => {
513
495
  callTool("fw_weaver_profile_list", {}).then((raw) => {
514
496
  const data = typeof raw === "string" ? JSON.parse(raw) : raw;
515
497
  if (Array.isArray(data)) setAvailableProfiles(data);
516
498
  }).catch(() => {
517
499
  });
518
500
  }, [callTool]);
519
- const handleRetry = useCallback(async () => {
501
+ const handleRetry = (0, import_react.useCallback)(async () => {
520
502
  setActionLoading("retry");
521
503
  try {
522
504
  await callTool("fw_weaver_task_retry", { id: taskId });
523
- toast("Task retried, back in pool", { type: "success" });
505
+ (0, import_plugin_ui_kit.toast)("Task retried, back in pool", { type: "success" });
524
506
  fetchTask();
525
507
  } catch (err) {
526
- toast(err instanceof Error ? err.message : "Failed to retry", { type: "error" });
508
+ (0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to retry", { type: "error" });
527
509
  }
528
510
  setActionLoading(null);
529
511
  }, [callTool, taskId, fetchTask]);
530
- const handleCancel = useCallback(async () => {
512
+ const handleCancel = (0, import_react.useCallback)(async () => {
531
513
  const ok = await ctx.confirm("Cancel this task? It cannot be undone.", {
532
514
  title: "Cancel Task",
533
515
  confirmLabel: "Cancel Task",
@@ -537,26 +519,26 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
537
519
  setActionLoading("cancel");
538
520
  try {
539
521
  await callTool("fw_weaver_task_cancel", { id: taskId });
540
- toast("Task cancelled", { type: "info" });
522
+ (0, import_plugin_ui_kit.toast)("Task cancelled", { type: "info" });
541
523
  fetchTask();
542
524
  } catch (err) {
543
- toast(err instanceof Error ? err.message : "Failed to cancel", { type: "error" });
525
+ (0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to cancel", { type: "error" });
544
526
  }
545
527
  setActionLoading(null);
546
528
  }, [callTool, taskId, fetchTask, ctx]);
547
- const handleAssignProfile = useCallback(async (profileId) => {
529
+ const handleAssignProfile = (0, import_react.useCallback)(async (profileId) => {
548
530
  setActionLoading("assign-profile");
549
531
  try {
550
532
  const newProfile = task?.assignedProfile === profileId ? void 0 : profileId;
551
533
  await callTool("fw_weaver_task_update", { id: taskId, assignedProfile: newProfile ?? null });
552
- toast(newProfile ? `Assigned profile ${profileId}` : `Unassigned profile`, { type: "success" });
534
+ (0, import_plugin_ui_kit.toast)(newProfile ? `Assigned profile ${profileId}` : `Unassigned profile`, { type: "success" });
553
535
  fetchTask();
554
536
  } catch (err) {
555
- toast(err instanceof Error ? err.message : "Failed to assign profile", { type: "error" });
537
+ (0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to assign profile", { type: "error" });
556
538
  }
557
539
  setActionLoading(null);
558
540
  }, [callTool, taskId, task, fetchTask]);
559
- const handlePriorityChange = useCallback(async (delta) => {
541
+ const handlePriorityChange = (0, import_react.useCallback)(async (delta) => {
560
542
  const newPriority = Math.max(0, (task?.priority ?? 0) + delta);
561
543
  try {
562
544
  await callTool("fw_weaver_task_update", { id: taskId, priority: newPriority });
@@ -564,47 +546,47 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
564
546
  } catch {
565
547
  }
566
548
  }, [callTool, taskId, task, fetchTask]);
567
- const [expandedRunId, setExpandedRunId] = useState2(null);
568
- const [liveExpanded, setLiveExpanded] = useState2(true);
569
- const toggleExpand = useCallback((id) => {
549
+ const [expandedRunId, setExpandedRunId] = (0, import_react.useState)(null);
550
+ const [liveExpanded, setLiveExpanded] = (0, import_react.useState)(true);
551
+ const toggleExpand = (0, import_react.useCallback)((id) => {
570
552
  setExpandedRunId((prev) => prev === id ? null : id);
571
553
  }, []);
572
- const scrollRef = useRef2(null);
573
- useEffect2(() => {
554
+ const scrollRef = (0, import_react.useRef)(null);
555
+ (0, import_react.useEffect)(() => {
574
556
  const el = scrollRef.current;
575
557
  if (el) el.scrollTop = el.scrollHeight;
576
558
  }, [liveTimeline.length, stream.events.length]);
577
- const [approvalStatus, setApprovalStatus] = useState2(null);
578
- const [approvalLoading, setApprovalLoading] = useState2(false);
579
- useEffect2(() => {
559
+ const [approvalStatus, setApprovalStatus] = (0, import_react.useState)(null);
560
+ const [approvalLoading, setApprovalLoading] = (0, import_react.useState)(false);
561
+ (0, import_react.useEffect)(() => {
580
562
  if (awaitingApproval) setApprovalStatus("pending");
581
563
  }, [awaitingApproval]);
582
- useEffect2(() => {
564
+ (0, import_react.useEffect)(() => {
583
565
  if (stream.events.length === 0) setApprovalStatus(null);
584
566
  }, [stream.events.length]);
585
- const handleApprove = useCallback(async () => {
567
+ const handleApprove = (0, import_react.useCallback)(async () => {
586
568
  setApprovalLoading(true);
587
569
  try {
588
570
  await callTool("fw_weaver_approve", { approved: true });
589
571
  setApprovalStatus("approved");
590
- toast("Plan approved", { type: "success" });
572
+ (0, import_plugin_ui_kit.toast)("Plan approved", { type: "success" });
591
573
  } catch (err) {
592
- toast(err instanceof Error ? err.message : "Failed to approve", { type: "error" });
574
+ (0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to approve", { type: "error" });
593
575
  }
594
576
  setApprovalLoading(false);
595
577
  }, [callTool]);
596
- const handleReject = useCallback(async () => {
578
+ const handleReject = (0, import_react.useCallback)(async () => {
597
579
  setApprovalLoading(true);
598
580
  try {
599
581
  await callTool("fw_weaver_approve", { approved: false });
600
582
  setApprovalStatus("rejected");
601
- toast("Plan rejected", { type: "info" });
583
+ (0, import_plugin_ui_kit.toast)("Plan rejected", { type: "info" });
602
584
  } catch (err) {
603
- toast(err instanceof Error ? err.message : "Failed to reject", { type: "error" });
585
+ (0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to reject", { type: "error" });
604
586
  }
605
587
  setApprovalLoading(false);
606
588
  }, [callTool]);
607
- const runItems = useMemo2(() => {
589
+ const runItems = (0, import_react.useMemo)(() => {
608
590
  return history.map((run) => ({
609
591
  run,
610
592
  runTimeline: traceToTimeline(run)
@@ -639,470 +621,382 @@ function TaskDetailView({ taskId, onBack, onEdit }) {
639
621
  return task?.title ?? "Bot run";
640
622
  }
641
623
  if (loading && !task) {
642
- return React2.createElement(
643
- Flex,
624
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
625
+ import_plugin_ui_kit.Flex,
644
626
  {
645
627
  variant: "column-stretch-start-nowrap-0",
646
- style: { width: "100%", height: "100%", overflow: "hidden" }
647
- },
648
- React2.createElement(
649
- Flex,
650
- {
651
- variant: "column-stretch-start-nowrap-8",
652
- style: headerStyle
653
- },
654
- React2.createElement(
655
- Button,
656
- { variant: "ghost", size: "sm", onClick: onBack },
657
- React2.createElement(Icon, { name: "arrowBack", size: 16 }),
658
- " Back"
659
- )
660
- ),
661
- React2.createElement(
662
- Flex,
663
- {
664
- variant: "column-center-center-nowrap-0",
665
- style: { flex: 1 }
666
- },
667
- React2.createElement(
668
- Typography,
669
- { variant: "caption-regular", color: "color-text-subtle" },
670
- "Loading task..."
671
- )
672
- )
628
+ style: { width: "100%", height: "100%", overflow: "hidden" },
629
+ children: [
630
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", style: headerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Button, { variant: "ghost", size: "sm", onClick: onBack, children: [
631
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "arrowBack", size: 16 }),
632
+ " Back"
633
+ ] }) }),
634
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "column-center-center-nowrap-0", style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: "Loading task..." }) })
635
+ ]
636
+ }
673
637
  );
674
638
  }
675
639
  if (!task) {
676
- return React2.createElement(
677
- Flex,
640
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
641
+ import_plugin_ui_kit.Flex,
678
642
  {
679
643
  variant: "column-stretch-start-nowrap-0",
680
- style: { width: "100%", height: "100%", overflow: "hidden" }
681
- },
682
- React2.createElement(
683
- Flex,
684
- {
685
- variant: "column-stretch-start-nowrap-8",
686
- style: headerStyle
687
- },
688
- React2.createElement(
689
- Button,
690
- { variant: "ghost", size: "sm", onClick: onBack },
691
- React2.createElement(Icon, { name: "arrowBack", size: 16 }),
692
- " Back"
693
- )
694
- ),
695
- React2.createElement(
696
- Flex,
697
- {
698
- variant: "column-center-center-nowrap-0",
699
- style: { flex: 1 }
700
- },
701
- React2.createElement(
702
- Typography,
703
- { variant: "caption-regular", color: "color-text-subtle" },
704
- "Task not found."
705
- )
706
- )
644
+ style: { width: "100%", height: "100%", overflow: "hidden" },
645
+ children: [
646
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", style: headerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Button, { variant: "ghost", size: "sm", onClick: onBack, children: [
647
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "arrowBack", size: 16 }),
648
+ " Back"
649
+ ] }) }),
650
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "column-center-center-nowrap-0", style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: "Task not found." }) })
651
+ ]
652
+ }
707
653
  );
708
654
  }
709
655
  const hasContext = task.context?.files?.length > 0 || task.context?.notes;
710
656
  const hasSubtasks = task.isParent && subtasks.length > 0;
711
657
  const hasRuns = runItems.length > 0 || isLive;
712
- return React2.createElement(
713
- Flex,
658
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
659
+ import_plugin_ui_kit.Flex,
714
660
  {
715
661
  variant: "column-stretch-start-nowrap-0",
716
- style: { width: "100%", height: "100%", overflow: "hidden" }
717
- },
718
- // ── Header ──
719
- React2.createElement(
720
- Flex,
721
- {
722
- variant: "column-stretch-start-nowrap-6",
723
- style: { ...headerStyle, padding: "12px 16px", borderBottom: "1px solid var(--color-border-default)" }
724
- },
725
- // Top row: back + title + status + edit
726
- React2.createElement(
727
- Flex,
728
- { variant: "row-center-space-between-nowrap-8" },
729
- React2.createElement(
730
- Flex,
731
- { variant: "row-center-start-nowrap-8", style: { flex: 1, minWidth: 0 } },
732
- React2.createElement(IconButton, {
733
- icon: "back",
734
- size: "xs",
735
- variant: "clear",
736
- onClick: onBack
737
- }),
738
- React2.createElement(StatusIcon, {
739
- status: statusToIcon[task.status] || "pending",
740
- size: "sm"
741
- }),
742
- React2.createElement(Typography, {
743
- variant: "caption-thick",
744
- color: "color-text-high",
745
- style: { flex: 1, minWidth: 0, wordBreak: "break-word" }
746
- }, task.title || "Untitled Task")
747
- ),
748
- onEdit && React2.createElement(IconButton, {
749
- icon: "edit",
750
- size: "xs",
751
- variant: "clear",
752
- onClick: () => onEdit(taskId),
753
- title: "Edit task"
754
- })
755
- ),
756
- // Meta row: status tag, assigned profile, priority, attempts
757
- React2.createElement(
758
- Flex,
759
- { variant: "row-center-start-wrap-6" },
760
- React2.createElement(Chip, {
761
- label: statusToLabel[task.status] || task.status || "open",
762
- size: "small",
763
- color: task.status === "done" ? "color-status-positive" : task.status === "cancelled" ? "color-status-negative" : task.status === "in-progress" ? "color-status-info" : "color-brand-alt"
764
- }),
765
- task.assignedProfile && React2.createElement(Chip, { key: `profile-${task.assignedProfile}`, label: task.assignedProfile, size: "small", color: "color-status-info" }),
766
- task.priority > 0 && React2.createElement(Chip, {
767
- label: `P${task.priority}`,
768
- size: "small",
769
- color: task.priority >= 3 ? "color-status-caution" : "color-status-info"
770
- }),
771
- (task.context?.runHistory?.length ?? 0) > 0 && React2.createElement(Typography, {
772
- variant: "smallCaption-regular",
773
- color: "color-text-subtle"
774
- }, `${task.context.runHistory.length} run${task.context.runHistory.length !== 1 ? "s" : ""}`)
775
- ),
776
- // Description
777
- task.description && React2.createElement(Typography, {
778
- variant: "smallCaption-regular",
779
- color: "color-text-medium"
780
- }, task.description),
781
- // Profile routing info
782
- task.assignedProfile && React2.createElement(
783
- Flex,
784
- { variant: "column-stretch-start-nowrap-2" },
785
- React2.createElement(Typography, {
786
- variant: "smallCaption-regular",
787
- color: "color-text-medium"
788
- }, `Profile: ${task.assignedProfile}`),
789
- task.routingReason && React2.createElement(Typography, {
790
- variant: "smallCaption-regular",
791
- color: "color-text-subtle"
792
- }, task.routingReason)
793
- )
794
- // (Actions moved to tab)
795
- ),
796
- // ── Tabs ──
797
- React2.createElement(Tabs, {
798
- tabs: [
799
- { id: "runs", title: `Runs (${runItems.length}${isLive ? "+1" : ""})` },
800
- ...hasSubtasks ? [{ id: "subtasks", title: `Subtasks (${subtasks.filter((s) => s.status === "done").length}/${subtasks.length})` }] : [],
801
- ...task.status !== "done" && task.status !== "cancelled" ? [{ id: "actions", title: "Actions" }] : [],
802
- ...hasContext ? [{ id: "context", title: "Context" }] : []
803
- ],
804
- activeTabId: detailTab,
805
- onSelectTab: (id) => setDetailTab(id),
806
- size: "sm"
807
- }),
808
- // ── Tab content ──
809
- React2.createElement(
810
- ScrollArea,
811
- { ref: scrollRef, style: { flex: 1 } },
812
- React2.createElement(
813
- Flex,
814
- { variant: "column-stretch-start-nowrap-8", style: { padding: "12px 16px" } },
815
- // ── Runs tab ──
816
- detailTab === "runs" && (hasRuns || (task.context?.runHistory?.length ?? 0) > 0) ? React2.createElement(
817
- Flex,
818
- { variant: "column-stretch-start-nowrap-8" },
819
- ...runItems.map(({ run, runTimeline }) => {
820
- const runId = run.id;
821
- const isExpanded = expandedRunId === runId;
822
- const isSuccess = run.outcome === "completed" || run.success === true;
823
- return React2.createElement(TaskBlock, {
824
- key: `run-${runId}`,
825
- state: isSuccess ? "completed" : "failed",
826
- instruction: extractInstruction(run),
827
- timeline: runTimeline,
828
- report: run.report ?? null,
829
- cost: typeof run.cost === "number" ? run.cost : run.costDetail?.totalCost ?? null,
830
- plan: run.plan,
831
- startedAt: run.startedAt,
832
- durationMs: run.durationMs ?? run.duration,
833
- expanded: isExpanded,
834
- onToggleExpand: () => toggleExpand(runId)
835
- });
836
- }),
837
- // Live run
838
- isLive && React2.createElement(TaskBlock, {
839
- key: "live-run",
840
- state: "running",
841
- instruction: liveInstruction ?? task.title,
842
- timeline: liveTimeline,
843
- report: liveReport,
844
- phase: livePhase,
845
- elapsed,
846
- cost: liveCost,
847
- plan,
848
- error: stream.error,
849
- approval: approvalStatus ?? void 0,
850
- approvalLoading,
851
- onApprove: handleApprove,
852
- onReject: handleReject,
853
- expanded: liveExpanded,
854
- onToggleExpand: () => setLiveExpanded((v) => !v)
855
- })
856
- ) : detailTab === "runs" && React2.createElement(EmptyState, {
857
- icon: "smartToy",
858
- message: "No runs yet",
859
- description: "This task has not been executed yet."
860
- }),
861
- // ── Subtasks tab ──
862
- detailTab === "subtasks" && hasSubtasks && React2.createElement(
863
- Flex,
662
+ style: { width: "100%", height: "100%", overflow: "hidden" },
663
+ children: [
664
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
665
+ import_plugin_ui_kit.Flex,
864
666
  {
865
- variant: "column-stretch-start-nowrap-0"
866
- },
867
- ...(subtasks ?? []).map(
868
- (sub) => React2.createElement(SubtaskRowItem, {
869
- key: sub.id,
870
- sub,
871
- onBack
872
- })
873
- )
874
- ),
875
- // ── Actions tab ──
876
- detailTab === "actions" && React2.createElement(
877
- Flex,
878
- {
879
- variant: "column-stretch-start-nowrap-16"
880
- },
881
- // Status actions
882
- React2.createElement(
883
- Flex,
884
- { variant: "column-stretch-start-nowrap-8" },
885
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Status"),
886
- React2.createElement(
887
- Flex,
888
- { variant: "row-center-start-nowrap-6" },
889
- task.status === "open" && (task.context?.runHistory?.length ?? 0) > 0 && React2.createElement(Button, {
890
- size: "xs",
891
- variant: "fill",
892
- color: "primary",
893
- onClick: handleRetry,
894
- loading: actionLoading === "retry",
895
- disabled: !!actionLoading
896
- }, "Retry Task"),
897
- (task.status === "open" || task.status === "in-progress") && React2.createElement(Button, {
898
- size: "xs",
899
- variant: "outlined",
900
- color: "danger",
901
- onClick: handleCancel,
902
- loading: actionLoading === "cancel",
903
- disabled: !!actionLoading
904
- }, "Cancel Task")
905
- )
906
- ),
907
- // Priority
908
- React2.createElement(
909
- Flex,
910
- { variant: "column-stretch-start-nowrap-8" },
911
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Priority"),
912
- React2.createElement(
913
- Flex,
914
- { variant: "row-center-start-nowrap-8" },
915
- React2.createElement(IconButton, {
916
- icon: "expandLess",
917
- size: "xs",
918
- variant: "outlined",
919
- onClick: () => handlePriorityChange(1),
920
- title: "Increase priority"
921
- }),
922
- React2.createElement(
923
- Typography,
924
- { variant: "smallCaption-regular", color: "color-text-high" },
925
- `P${task.priority ?? 0}`
926
- ),
927
- React2.createElement(IconButton, {
928
- icon: "expandMore",
929
- size: "xs",
930
- variant: "outlined",
931
- onClick: () => handlePriorityChange(-1),
932
- title: "Decrease priority"
933
- })
934
- )
935
- ),
936
- // Assign Profile
937
- availableProfiles.length > 0 && React2.createElement(
938
- Flex,
939
- { variant: "column-stretch-start-nowrap-8" },
940
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Assign Profile"),
941
- React2.createElement(Table, {
942
- size: "compact",
943
- getRowKey: (row) => row.id,
944
- columns: [
945
- {
946
- key: "icon",
947
- header: "",
948
- width: "30px",
949
- render: (_, row) => React2.createElement(Icon, {
950
- name: row.icon || "smartToy",
951
- size: 14,
952
- color: row.color || "color-text-medium"
953
- })
954
- },
955
- {
956
- key: "name",
957
- header: "Profile"
958
- },
959
- {
960
- key: "capabilities",
961
- header: "Capabilities",
962
- render: (_, row) => {
963
- const caps = row.capabilities || [];
964
- if (caps.length === 0) return null;
965
- return React2.createElement(
966
- Flex,
967
- { variant: "row-center-start-wrap-4" },
968
- ...caps.slice(0, 4).map(
969
- (cap) => React2.createElement(
970
- "span",
971
- { key: cap.name, title: cap.description },
972
- React2.createElement(Chip, { label: cap.name, size: "small", color: "color-brand-main" })
973
- )
974
- ),
975
- caps.length > 4 && React2.createElement(Typography, {
976
- variant: "smallCaption-regular",
977
- color: "color-text-subtle"
978
- }, `+${caps.length - 4}`)
979
- );
980
- }
981
- },
982
- {
983
- key: "assigned",
984
- header: "Assign",
985
- width: "50px",
986
- align: "right",
987
- render: (_, row) => {
988
- const isAssigned = task.assignedProfile === row.id;
989
- return React2.createElement(Checkbox, {
990
- checked: isAssigned,
991
- onChange: () => handleAssignProfile(row.id),
667
+ variant: "column-stretch-start-nowrap-6",
668
+ style: { ...headerStyle, padding: "12px 16px", borderBottom: "1px solid var(--color-border-default)" },
669
+ children: [
670
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-8", children: [
671
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-8", style: { flex: 1, minWidth: 0 }, children: [
672
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
673
+ import_plugin_ui_kit.IconButton,
674
+ {
675
+ icon: "back",
676
+ size: "xs",
677
+ variant: "clear",
678
+ onClick: onBack
679
+ }
680
+ ),
681
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
682
+ import_plugin_ui_kit.StatusIcon,
683
+ {
684
+ status: statusToIcon[task.status] || "pending",
992
685
  size: "sm"
993
- });
686
+ }
687
+ ),
688
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
689
+ import_plugin_ui_kit.Typography,
690
+ {
691
+ variant: "caption-thick",
692
+ color: "color-text-high",
693
+ style: { flex: 1, minWidth: 0, wordBreak: "break-word" },
694
+ children: task.title || "Untitled Task"
695
+ }
696
+ )
697
+ ] }),
698
+ onEdit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
699
+ import_plugin_ui_kit.IconButton,
700
+ {
701
+ icon: "edit",
702
+ size: "xs",
703
+ variant: "clear",
704
+ onClick: () => onEdit(taskId),
705
+ title: "Edit task"
994
706
  }
995
- }
996
- ],
997
- data: availableProfiles
998
- })
999
- )
707
+ )
708
+ ] }),
709
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-wrap-6", children: [
710
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
711
+ import_plugin_ui_kit.Chip,
712
+ {
713
+ label: statusToLabel[task.status] || task.status || "open",
714
+ size: "small",
715
+ color: task.status === "done" ? "color-status-positive" : task.status === "cancelled" ? "color-status-negative" : task.status === "in-progress" ? "color-status-info" : "color-brand-alt"
716
+ }
717
+ ),
718
+ task.assignedProfile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Chip, { label: task.assignedProfile, size: "small", color: "color-status-info" }, `profile-${task.assignedProfile}`),
719
+ task.priority > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
720
+ import_plugin_ui_kit.Chip,
721
+ {
722
+ label: `P${task.priority}`,
723
+ size: "small",
724
+ color: task.priority >= 3 ? "color-status-caution" : "color-status-info"
725
+ }
726
+ ),
727
+ (task.context?.runHistory?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: `${task.context.runHistory.length} run${task.context.runHistory.length !== 1 ? "s" : ""}` })
728
+ ] }),
729
+ task.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-medium", children: task.description }),
730
+ task.assignedProfile && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-2", children: [
731
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-medium", children: `Profile: ${task.assignedProfile}` }),
732
+ task.routingReason && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: task.routingReason })
733
+ ] })
734
+ ]
735
+ }
1000
736
  ),
1001
- // ── Context tab ──
1002
- detailTab === "context" && hasContext && React2.createElement(
1003
- Flex,
737
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
738
+ import_plugin_ui_kit.Tabs,
1004
739
  {
1005
- variant: "column-stretch-start-nowrap-12"
1006
- },
1007
- // Files
1008
- (task.context?.files?.length ?? 0) > 0 && React2.createElement(
1009
- Flex,
1010
- {
1011
- variant: "column-stretch-start-nowrap-4"
1012
- },
1013
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Files"),
1014
- ...(task.context?.files ?? []).map(
1015
- (file) => React2.createElement(Typography, {
1016
- key: file,
1017
- variant: "smallCaption-regular",
1018
- color: "color-text-high",
1019
- style: { fontFamily: "var(--font-mono, monospace)" }
1020
- }, file)
740
+ tabs: [
741
+ { id: "runs", title: `Runs (${runItems.length}${isLive ? "+1" : ""})` },
742
+ ...hasSubtasks ? [{ id: "subtasks", title: `Subtasks (${subtasks.filter((s) => s.status === "done").length}/${subtasks.length})` }] : [],
743
+ ...task.status !== "done" && task.status !== "cancelled" ? [{ id: "actions", title: "Actions" }] : [],
744
+ ...hasContext ? [{ id: "context", title: "Context" }] : []
745
+ ],
746
+ activeTabId: detailTab,
747
+ onSelectTab: (id) => setDetailTab(id),
748
+ size: "sm"
749
+ }
750
+ ),
751
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.ScrollArea, { ref: scrollRef, style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", style: { padding: "12px 16px" }, children: [
752
+ detailTab === "runs" && (hasRuns || (task.context?.runHistory?.length ?? 0) > 0) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", children: [
753
+ runItems.map(({ run, runTimeline }) => {
754
+ const runId = run.id;
755
+ const isExpanded = expandedRunId === runId;
756
+ const isSuccess = run.outcome === "completed" || run.success === true;
757
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
758
+ import_plugin_ui_kit.TaskBlock,
759
+ {
760
+ state: isSuccess ? "completed" : "failed",
761
+ instruction: extractInstruction(run),
762
+ timeline: runTimeline,
763
+ report: run.report ?? null,
764
+ cost: typeof run.cost === "number" ? run.cost : run.costDetail?.totalCost ?? null,
765
+ plan: run.plan,
766
+ startedAt: run.startedAt,
767
+ durationMs: run.durationMs ?? run.duration,
768
+ expanded: isExpanded,
769
+ onToggleExpand: () => toggleExpand(runId)
770
+ },
771
+ `run-${runId}`
772
+ );
773
+ }),
774
+ isLive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
775
+ import_plugin_ui_kit.TaskBlock,
776
+ {
777
+ state: "running",
778
+ instruction: liveInstruction ?? task.title,
779
+ timeline: liveTimeline,
780
+ report: liveReport,
781
+ phase: livePhase,
782
+ elapsed,
783
+ cost: liveCost,
784
+ plan,
785
+ error: stream.error,
786
+ approval: approvalStatus ?? void 0,
787
+ approvalLoading,
788
+ onApprove: handleApprove,
789
+ onReject: handleReject,
790
+ expanded: liveExpanded,
791
+ onToggleExpand: () => setLiveExpanded((v) => !v)
792
+ },
793
+ "live-run"
1021
794
  )
1022
- ),
1023
- // Notes
1024
- task.context?.notes && React2.createElement(
1025
- Flex,
795
+ ] }) : detailTab === "runs" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
796
+ import_plugin_ui_kit.EmptyState,
1026
797
  {
1027
- variant: "column-stretch-start-nowrap-4"
1028
- },
1029
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Notes"),
1030
- React2.createElement(Typography, {
1031
- variant: "smallCaption-regular",
1032
- color: "color-text-high",
1033
- style: { whiteSpace: "pre-wrap" }
1034
- }, task.context.notes)
798
+ icon: "smartToy",
799
+ message: "No runs yet",
800
+ description: "This task has not been executed yet."
801
+ }
1035
802
  ),
1036
- // Run history (accumulated context)
1037
- (task.context?.runHistory?.length ?? 0) > 0 && React2.createElement(
1038
- Flex,
803
+ detailTab === "subtasks" && hasSubtasks && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-0", children: (subtasks ?? []).map((sub) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
804
+ SubtaskRowItem,
1039
805
  {
1040
- variant: "column-stretch-start-nowrap-6"
806
+ sub,
807
+ onBack
1041
808
  },
1042
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Run History"),
1043
- ...(task.context?.runHistory ?? []).map(
1044
- (rs, i) => React2.createElement(
1045
- Card,
1046
- {
1047
- key: `rs-${i}`,
1048
- variant: "bordered",
1049
- padding: "compact",
1050
- style: { gap: "4px" }
1051
- },
1052
- React2.createElement(
1053
- Flex,
1054
- { variant: "row-center-space-between-nowrap-8" },
1055
- React2.createElement(Typography, {
1056
- variant: "smallCaption-thick",
1057
- color: rs.outcome === "success" ? "color-status-positive" : "color-status-negative"
1058
- }, `${rs.outcome === "success" ? "Success" : "Failed"} (${rs.botId ?? "unknown bot"})`),
1059
- React2.createElement(Typography, {
1060
- variant: "smallCaption-regular",
1061
- color: "color-text-subtle"
1062
- }, `${Math.round((rs.durationMs ?? 0) / 1e3)}s \xB7 ${rs.tokensUsed ?? 0} tok \xB7 $${(rs.cost ?? 0).toFixed(3)}`)
809
+ sub.id
810
+ )) }),
811
+ detailTab === "actions" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-16", children: [
812
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Status" }),
814
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-6", children: [
815
+ task.status === "open" && (task.context?.runHistory?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
816
+ import_plugin_ui_kit.Button,
817
+ {
818
+ size: "xs",
819
+ variant: "fill",
820
+ color: "primary",
821
+ onClick: handleRetry,
822
+ loading: actionLoading === "retry",
823
+ disabled: !!actionLoading,
824
+ children: "Retry Task"
825
+ }
1063
826
  ),
1064
- React2.createElement(Typography, {
1065
- variant: "smallCaption-regular",
1066
- color: "color-text-medium"
1067
- }, rs.summary ?? ""),
1068
- (rs.filesModified ?? []).length > 0 && React2.createElement(Typography, {
827
+ (task.status === "open" || task.status === "in-progress") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
828
+ import_plugin_ui_kit.Button,
829
+ {
830
+ size: "xs",
831
+ variant: "outlined",
832
+ color: "danger",
833
+ onClick: handleCancel,
834
+ loading: actionLoading === "cancel",
835
+ disabled: !!actionLoading,
836
+ children: "Cancel Task"
837
+ }
838
+ )
839
+ ] })
840
+ ] }),
841
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", children: [
842
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Priority" }),
843
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-8", children: [
844
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
845
+ import_plugin_ui_kit.IconButton,
846
+ {
847
+ icon: "expandLess",
848
+ size: "xs",
849
+ variant: "outlined",
850
+ onClick: () => handlePriorityChange(1),
851
+ title: "Increase priority"
852
+ }
853
+ ),
854
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-high", children: `P${task.priority ?? 0}` }),
855
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
856
+ import_plugin_ui_kit.IconButton,
857
+ {
858
+ icon: "expandMore",
859
+ size: "xs",
860
+ variant: "outlined",
861
+ onClick: () => handlePriorityChange(-1),
862
+ title: "Decrease priority"
863
+ }
864
+ )
865
+ ] })
866
+ ] }),
867
+ availableProfiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", children: [
868
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Assign Profile" }),
869
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
870
+ import_plugin_ui_kit.Table,
871
+ {
872
+ size: "compact",
873
+ getRowKey: (row) => row.id,
874
+ columns: [
875
+ {
876
+ key: "icon",
877
+ header: "",
878
+ width: "30px",
879
+ render: (_, row) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
880
+ import_plugin_ui_kit.Icon,
881
+ {
882
+ name: row.icon || "smartToy",
883
+ size: 14,
884
+ color: row.color || "color-text-medium"
885
+ }
886
+ )
887
+ },
888
+ {
889
+ key: "name",
890
+ header: "Profile"
891
+ },
892
+ {
893
+ key: "capabilities",
894
+ header: "Capabilities",
895
+ render: (_, row) => {
896
+ const caps = row.capabilities || [];
897
+ if (caps.length === 0) return null;
898
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-wrap-4", children: [
899
+ caps.slice(0, 4).map((cap) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { title: cap.description, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Chip, { label: cap.name, size: "small", color: "color-brand-main" }) }, cap.name)),
900
+ caps.length > 4 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: `+${caps.length - 4}` })
901
+ ] });
902
+ }
903
+ },
904
+ {
905
+ key: "assigned",
906
+ header: "Assign",
907
+ width: "50px",
908
+ align: "right",
909
+ render: (_, row) => {
910
+ const isAssigned = task.assignedProfile === row.id;
911
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
912
+ import_plugin_ui_kit.Checkbox,
913
+ {
914
+ checked: isAssigned,
915
+ onChange: () => handleAssignProfile(row.id),
916
+ size: "sm"
917
+ }
918
+ );
919
+ }
920
+ }
921
+ ],
922
+ data: availableProfiles
923
+ }
924
+ )
925
+ ] })
926
+ ] }),
927
+ detailTab === "context" && hasContext && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-12", children: [
928
+ (task.context?.files?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-4", children: [
929
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Files" }),
930
+ (task.context?.files ?? []).map((file) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
931
+ import_plugin_ui_kit.Typography,
932
+ {
1069
933
  variant: "smallCaption-regular",
1070
- color: "color-text-subtle",
1071
- style: { fontFamily: "var(--font-mono, monospace)" }
1072
- }, `Files: ${rs.filesModified.join(", ")}`),
1073
- rs.remainingWork && React2.createElement(Typography, {
934
+ color: "color-text-high",
935
+ style: { fontFamily: "var(--font-mono, monospace)" },
936
+ children: file
937
+ },
938
+ file
939
+ ))
940
+ ] }),
941
+ task.context?.notes && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-4", children: [
942
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Notes" }),
943
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
944
+ import_plugin_ui_kit.Typography,
945
+ {
1074
946
  variant: "smallCaption-regular",
1075
- color: "color-status-caution"
1076
- }, `Remaining: ${rs.remainingWork}`)
1077
- )
1078
- )
1079
- ),
1080
- // Budget
1081
- (task.tokensUsed > 0 || task.costUsed > 0) && React2.createElement(
1082
- Flex,
1083
- {
1084
- variant: "column-stretch-start-nowrap-4"
1085
- },
1086
- React2.createElement(Typography, { variant: "caption-thick", color: "color-text-medium" }, "Budget"),
1087
- React2.createElement(
1088
- Flex,
1089
- { variant: "row-center-start-nowrap-16" },
1090
- React2.createElement(
1091
- Typography,
1092
- { variant: "smallCaption-regular", color: "color-text-high" },
1093
- `Tokens: ${task.tokensUsed?.toLocaleString() ?? 0}`
1094
- ),
1095
- React2.createElement(
1096
- Typography,
1097
- { variant: "smallCaption-regular", color: "color-text-high" },
1098
- `Cost: $${(task.costUsed ?? 0).toFixed(3)}${task.budgetCost ? ` / $${task.budgetCost.toFixed(2)}` : ""}`
947
+ color: "color-text-high",
948
+ style: { whiteSpace: "pre-wrap" },
949
+ children: task.context.notes
950
+ }
1099
951
  )
1100
- )
1101
- )
1102
- )
1103
- )
1104
- )
952
+ ] }),
953
+ (task.context?.runHistory?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-6", children: [
954
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Run History" }),
955
+ (task.context?.runHistory ?? []).map((rs, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
956
+ import_plugin_ui_kit.Card,
957
+ {
958
+ variant: "bordered",
959
+ padding: "compact",
960
+ style: { gap: "4px" },
961
+ children: [
962
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-8", children: [
963
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
964
+ import_plugin_ui_kit.Typography,
965
+ {
966
+ variant: "smallCaption-thick",
967
+ color: rs.outcome === "success" ? "color-status-positive" : "color-status-negative",
968
+ children: `${rs.outcome === "success" ? "Success" : "Failed"} (${rs.botId ?? "unknown bot"})`
969
+ }
970
+ ),
971
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: `${Math.round((rs.durationMs ?? 0) / 1e3)}s \xB7 ${rs.tokensUsed ?? 0} tok \xB7 $${(rs.cost ?? 0).toFixed(3)}` })
972
+ ] }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-medium", children: rs.summary ?? "" }),
974
+ (rs.filesModified ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
975
+ import_plugin_ui_kit.Typography,
976
+ {
977
+ variant: "smallCaption-regular",
978
+ color: "color-text-subtle",
979
+ style: { fontFamily: "var(--font-mono, monospace)" },
980
+ children: `Files: ${rs.filesModified.join(", ")}`
981
+ }
982
+ ),
983
+ rs.remainingWork && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-status-caution", children: `Remaining: ${rs.remainingWork}` })
984
+ ]
985
+ },
986
+ `rs-${i}`
987
+ ))
988
+ ] }),
989
+ (task.tokensUsed > 0 || task.costUsed > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-4", children: [
990
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-medium", children: "Budget" }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-16", children: [
992
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-high", children: `Tokens: ${task.tokensUsed?.toLocaleString() ?? 0}` }),
993
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-high", children: `Cost: $${(task.costUsed ?? 0).toFixed(3)}${task.budgetCost ? ` / $${task.budgetCost.toFixed(2)}` : ""}` })
994
+ ] })
995
+ ] })
996
+ ] })
997
+ ] }) })
998
+ ]
999
+ }
1105
1000
  );
1106
1001
  }
1107
1002
  var task_detail_view_default = TaskDetailView;
1108
- module.exports = TaskDetailView;