@hyperwindmill/caretaker-cli 0.25.0 → 0.26.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 (41) hide show
  1. package/dist/cli/web/scheduler/cycle_events.d.ts +32 -0
  2. package/dist/cli/web/scheduler/cycle_events.d.ts.map +1 -0
  3. package/dist/cli/web/scheduler/cycle_events.js +42 -0
  4. package/dist/cli/web/scheduler/memory_sweep.d.ts.map +1 -1
  5. package/dist/cli/web/scheduler/memory_sweep.js +11 -4
  6. package/dist/cli/web/scheduler/task_cycle.d.ts +33 -0
  7. package/dist/cli/web/scheduler/task_cycle.d.ts.map +1 -0
  8. package/dist/cli/web/scheduler/task_cycle.js +137 -0
  9. package/dist/cli/web/scheduler/task_review.d.ts +5 -0
  10. package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
  11. package/dist/cli/web/scheduler/task_review.js +10 -1
  12. package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
  13. package/dist/cli/web/scheduler/task_strategy.js +39 -49
  14. package/dist/cli/web/server.d.ts.map +1 -1
  15. package/dist/cli/web/server.js +75 -11
  16. package/dist/harness/acp_pool.d.ts +1 -0
  17. package/dist/harness/acp_pool.d.ts.map +1 -1
  18. package/dist/harness/acp_pool.js +8 -2
  19. package/dist/harness/acp_runner.d.ts.map +1 -1
  20. package/dist/harness/acp_runner.js +39 -1
  21. package/dist/harness/memory_recall.d.ts.map +1 -1
  22. package/dist/harness/memory_recall.js +5 -0
  23. package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
  24. package/dist/harness/tools/builtin/task_tools.js +2 -1
  25. package/dist/session/store.d.ts +4 -0
  26. package/dist/session/store.d.ts.map +1 -1
  27. package/dist/session/store.js +6 -0
  28. package/dist/session/types.d.ts +8 -0
  29. package/dist/session/types.d.ts.map +1 -1
  30. package/dist/store/db.d.ts +13 -1
  31. package/dist/store/db.d.ts.map +1 -1
  32. package/dist/store/db.js +23 -0
  33. package/dist/store/json.d.ts +10 -0
  34. package/dist/store/json.d.ts.map +1 -1
  35. package/dist/store/json.js +9 -0
  36. package/dist/tui/providers.js +5 -5
  37. package/dist/webview/standalone.css +80 -25
  38. package/dist/webview/standalone.css.map +2 -2
  39. package/dist/webview/standalone.js +983 -855
  40. package/dist/webview/standalone.js.map +4 -4
  41. package/package.json +3 -3
@@ -447,11 +447,11 @@
447
447
  exports.useMemo = function(create, deps) {
448
448
  return ReactSharedInternals.H.useMemo(create, deps);
449
449
  };
450
- exports.useOptimistic = function(passthrough, reducer2) {
451
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer2);
450
+ exports.useOptimistic = function(passthrough, reducer) {
451
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
452
452
  };
453
- exports.useReducer = function(reducer2, initialArg, init) {
454
- return ReactSharedInternals.H.useReducer(reducer2, initialArg, init);
453
+ exports.useReducer = function(reducer, initialArg, init) {
454
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
455
455
  };
456
456
  exports.useRef = function(initialValue) {
457
457
  return ReactSharedInternals.H.useRef(initialValue);
@@ -4322,14 +4322,14 @@
4322
4322
  function basicStateReducer(state, action) {
4323
4323
  return "function" === typeof action ? action(state) : action;
4324
4324
  }
4325
- function updateReducer(reducer2) {
4325
+ function updateReducer(reducer) {
4326
4326
  var hook = updateWorkInProgressHook();
4327
- return updateReducerImpl(hook, currentHook, reducer2);
4327
+ return updateReducerImpl(hook, currentHook, reducer);
4328
4328
  }
4329
- function updateReducerImpl(hook, current, reducer2) {
4329
+ function updateReducerImpl(hook, current, reducer) {
4330
4330
  var queue = hook.queue;
4331
4331
  if (null === queue) throw Error(formatProdErrorMessage(311));
4332
- queue.lastRenderedReducer = reducer2;
4332
+ queue.lastRenderedReducer = reducer;
4333
4333
  var baseQueue = hook.baseQueue, pendingQueue = queue.pending;
4334
4334
  if (null !== pendingQueue) {
4335
4335
  if (null !== baseQueue) {
@@ -4374,8 +4374,8 @@
4374
4374
  next: null
4375
4375
  }, null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = updateLane, baseFirst = pendingQueue) : newBaseQueueLast = newBaseQueueLast.next = updateLane, currentlyRenderingFiber.lanes |= revertLane, workInProgressRootSkippedLanes |= revertLane;
4376
4376
  updateLane = update.action;
4377
- shouldDoubleInvokeUserFnsInHooksDEV && reducer2(pendingQueue, updateLane);
4378
- pendingQueue = update.hasEagerState ? update.eagerState : reducer2(pendingQueue, updateLane);
4377
+ shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane);
4378
+ pendingQueue = update.hasEagerState ? update.eagerState : reducer(pendingQueue, updateLane);
4379
4379
  } else
4380
4380
  revertLane = {
4381
4381
  lane: updateLane,
@@ -4389,8 +4389,8 @@
4389
4389
  update = update.next;
4390
4390
  } while (null !== update && update !== current);
4391
4391
  null === newBaseQueueLast ? baseFirst = pendingQueue : newBaseQueueLast.next = newBaseQueueFirst;
4392
- if (!objectIs(pendingQueue, hook.memoizedState) && (didReceiveUpdate = true, didReadFromEntangledAsyncAction$60 && (reducer2 = currentEntangledActionThenable, null !== reducer2)))
4393
- throw reducer2;
4392
+ if (!objectIs(pendingQueue, hook.memoizedState) && (didReceiveUpdate = true, didReadFromEntangledAsyncAction$60 && (reducer = currentEntangledActionThenable, null !== reducer)))
4393
+ throw reducer;
4394
4394
  hook.memoizedState = pendingQueue;
4395
4395
  hook.baseState = baseFirst;
4396
4396
  hook.baseQueue = newBaseQueueLast;
@@ -4399,16 +4399,16 @@
4399
4399
  null === baseQueue && (queue.lanes = 0);
4400
4400
  return [hook.memoizedState, queue.dispatch];
4401
4401
  }
4402
- function rerenderReducer(reducer2) {
4402
+ function rerenderReducer(reducer) {
4403
4403
  var hook = updateWorkInProgressHook(), queue = hook.queue;
4404
4404
  if (null === queue) throw Error(formatProdErrorMessage(311));
4405
- queue.lastRenderedReducer = reducer2;
4405
+ queue.lastRenderedReducer = reducer;
4406
4406
  var dispatch = queue.dispatch, lastRenderPhaseUpdate = queue.pending, newState = hook.memoizedState;
4407
4407
  if (null !== lastRenderPhaseUpdate) {
4408
4408
  queue.pending = null;
4409
4409
  var update = lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
4410
4410
  do
4411
- newState = reducer2(newState, update.action), update = update.next;
4411
+ newState = reducer(newState, update.action), update = update.next;
4412
4412
  while (update !== lastRenderPhaseUpdate);
4413
4413
  objectIs(newState, hook.memoizedState) || (didReceiveUpdate = true);
4414
4414
  hook.memoizedState = newState;
@@ -4505,12 +4505,12 @@
4505
4505
  };
4506
4506
  return hook;
4507
4507
  }
4508
- function updateOptimisticImpl(hook, current, passthrough, reducer2) {
4508
+ function updateOptimisticImpl(hook, current, passthrough, reducer) {
4509
4509
  hook.baseState = passthrough;
4510
4510
  return updateReducerImpl(
4511
4511
  hook,
4512
4512
  currentHook,
4513
- "function" === typeof reducer2 ? reducer2 : basicStateReducer
4513
+ "function" === typeof reducer ? reducer : basicStateReducer
4514
4514
  );
4515
4515
  }
4516
4516
  function dispatchActionState(fiber, actionQueue, setPendingState, setState, payload) {
@@ -5125,7 +5125,7 @@
5125
5125
  hook.memoizedState = [nextValue, deps];
5126
5126
  return nextValue;
5127
5127
  },
5128
- useReducer: function(reducer2, initialArg, init) {
5128
+ useReducer: function(reducer, initialArg, init) {
5129
5129
  var hook = mountWorkInProgressHook();
5130
5130
  if (void 0 !== init) {
5131
5131
  var initialState = init(initialArg);
@@ -5139,20 +5139,20 @@
5139
5139
  }
5140
5140
  } else initialState = initialArg;
5141
5141
  hook.memoizedState = hook.baseState = initialState;
5142
- reducer2 = {
5142
+ reducer = {
5143
5143
  pending: null,
5144
5144
  lanes: 0,
5145
5145
  dispatch: null,
5146
- lastRenderedReducer: reducer2,
5146
+ lastRenderedReducer: reducer,
5147
5147
  lastRenderedState: initialState
5148
5148
  };
5149
- hook.queue = reducer2;
5150
- reducer2 = reducer2.dispatch = dispatchReducerAction.bind(
5149
+ hook.queue = reducer;
5150
+ reducer = reducer.dispatch = dispatchReducerAction.bind(
5151
5151
  null,
5152
5152
  currentlyRenderingFiber,
5153
- reducer2
5153
+ reducer
5154
5154
  );
5155
- return [hook.memoizedState, reducer2];
5155
+ return [hook.memoizedState, reducer];
5156
5156
  },
5157
5157
  useRef: function(initialValue) {
5158
5158
  var hook = mountWorkInProgressHook();
@@ -5306,9 +5306,9 @@
5306
5306
  useHostTransitionStatus,
5307
5307
  useFormState: updateActionState,
5308
5308
  useActionState: updateActionState,
5309
- useOptimistic: function(passthrough, reducer2) {
5309
+ useOptimistic: function(passthrough, reducer) {
5310
5310
  var hook = updateWorkInProgressHook();
5311
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer2);
5311
+ return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
5312
5312
  },
5313
5313
  useMemoCache,
5314
5314
  useCacheRefresh: updateRefresh
@@ -5351,10 +5351,10 @@
5351
5351
  useHostTransitionStatus,
5352
5352
  useFormState: rerenderActionState,
5353
5353
  useActionState: rerenderActionState,
5354
- useOptimistic: function(passthrough, reducer2) {
5354
+ useOptimistic: function(passthrough, reducer) {
5355
5355
  var hook = updateWorkInProgressHook();
5356
5356
  if (null !== currentHook)
5357
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer2);
5357
+ return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
5358
5358
  hook.baseState = passthrough;
5359
5359
  return [passthrough, hook.queue.dispatch];
5360
5360
  },
@@ -12755,15 +12755,108 @@
12755
12755
  });
12756
12756
 
12757
12757
  // src/standalone.tsx
12758
- var import_react21 = __toESM(require_react(), 1);
12758
+ var import_react22 = __toESM(require_react(), 1);
12759
12759
  var import_client = __toESM(require_client(), 1);
12760
12760
 
12761
12761
  // src/App.tsx
12762
- var import_react20 = __toESM(require_react(), 1);
12762
+ var import_react21 = __toESM(require_react(), 1);
12763
12763
 
12764
12764
  // src/MessageList.tsx
12765
12765
  var import_react4 = __toESM(require_react(), 1);
12766
12766
 
12767
+ // src/task_timeline.ts
12768
+ var CYCLE_ROLE_LABELS = {
12769
+ developer: "Developer",
12770
+ planner: "Planner",
12771
+ reviewer: "Reviewer"
12772
+ };
12773
+ var CYCLE_OUTCOME_LABELS = {
12774
+ running: "running",
12775
+ handoff: "handed off",
12776
+ completed: "completed",
12777
+ blocked: "blocked",
12778
+ plan: "plan submitted",
12779
+ "review-pass": "review passed",
12780
+ "review-changes": "changes requested",
12781
+ aborted: "aborted",
12782
+ failed: "failed"
12783
+ };
12784
+ function cycleRoleLabel(role) {
12785
+ return CYCLE_ROLE_LABELS[role];
12786
+ }
12787
+ function cycleOutcomeLabel(outcome) {
12788
+ return CYCLE_OUTCOME_LABELS[outcome] ?? outcome;
12789
+ }
12790
+ function taskMessagesToChatItems(msgs, labels) {
12791
+ const items = [];
12792
+ for (const msg of msgs) {
12793
+ if (msg.messageType === "cycle") {
12794
+ const role = msg.cycleRole ?? "developer";
12795
+ items.push({
12796
+ kind: "cycle",
12797
+ sessionId: msg.sessionId ?? "",
12798
+ agentId: msg.sessionAgentId ?? "",
12799
+ role,
12800
+ outcome: msg.cycleOutcome ?? "running",
12801
+ label: msg.agentLabel || labels?.[role],
12802
+ createdAt: msg.createdAt
12803
+ });
12804
+ continue;
12805
+ }
12806
+ if (msg.messageType === "system" || msg.messageType === "block") {
12807
+ items.push({ kind: "notice", text: msg.content, variant: msg.messageType });
12808
+ continue;
12809
+ }
12810
+ if (msg.messageType === "tool_call") {
12811
+ const sp = msg.content.indexOf(" ");
12812
+ const name = sp === -1 ? msg.content : msg.content.slice(0, sp);
12813
+ let args = {};
12814
+ if (sp !== -1) {
12815
+ try {
12816
+ args = JSON.parse(msg.content.slice(sp + 1));
12817
+ } catch {
12818
+ args = msg.content.slice(sp + 1);
12819
+ }
12820
+ }
12821
+ items.push({ kind: "tool", id: msg.toolCallId || String(msg.id), name, args, result: "" });
12822
+ continue;
12823
+ }
12824
+ if (msg.messageType === "plan") {
12825
+ items.push({ kind: "assistant", text: `**\u{1F4CB} Plan submitted**
12826
+
12827
+ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.planner });
12828
+ continue;
12829
+ }
12830
+ if (msg.messageType === "review") {
12831
+ items.push({ kind: "assistant", text: `**\u{1F50E} Code review**
12832
+
12833
+ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
12834
+ continue;
12835
+ }
12836
+ if (msg.role === "user") {
12837
+ items.push({ kind: "user", text: msg.content });
12838
+ continue;
12839
+ }
12840
+ let text = msg.content;
12841
+ let thinking = "";
12842
+ if (msg.content.startsWith("[")) {
12843
+ try {
12844
+ const parsed = JSON.parse(msg.content);
12845
+ if (Array.isArray(parsed)) {
12846
+ const t = parsed.find((b) => b.type === "thinking");
12847
+ const x = parsed.find((b) => b.type === "text");
12848
+ if (t?.content) thinking = t.content;
12849
+ if (x?.content) text = x.content;
12850
+ }
12851
+ } catch {
12852
+ }
12853
+ }
12854
+ if (thinking) items.push({ kind: "thinking", text: thinking });
12855
+ items.push({ kind: "assistant", text, streaming: false, label: msg.agentLabel || labels?.developer });
12856
+ }
12857
+ return items;
12858
+ }
12859
+
12767
12860
  // src/MarkdownText.tsx
12768
12861
  var import_react = __toESM(require_react(), 1);
12769
12862
 
@@ -15380,7 +15473,8 @@ ${text}</tr>
15380
15473
  trailing,
15381
15474
  isStreaming,
15382
15475
  agentName,
15383
- compact = false
15476
+ compact = false,
15477
+ onOpenCycle
15384
15478
  }) {
15385
15479
  const containerRef = (0, import_react4.useRef)(null);
15386
15480
  const prevItemsLengthRef = (0, import_react4.useRef)(items.length);
@@ -15406,8 +15500,8 @@ ${text}</tr>
15406
15500
  }
15407
15501
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: containerRef, className: "messages", onScroll, children: [
15408
15502
  compact ? groupCompactItems(items).map(
15409
- (g) => g.kind === "tool-row" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool-bubble-row", children: g.items.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact }, g.key + j)) }, g.key) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item: g.item, sessionId, compact }, g.key)
15410
- ) : items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact }, i)),
15503
+ (g) => g.kind === "tool-row" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool-bubble-row", children: g.items.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact, onOpenCycle }, g.key + j)) }, g.key) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item: g.item, sessionId, compact, onOpenCycle }, g.key)
15504
+ ) : items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact, onOpenCycle }, i)),
15411
15505
  trailing,
15412
15506
  isStreaming && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "messages__loading-indicator", children: [
15413
15507
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: caretaker_cli_default, alt: "Loading", className: "messages__loading-logo" }),
@@ -15532,10 +15626,39 @@ ${text}</tr>
15532
15626
  )
15533
15627
  ] });
15534
15628
  });
15629
+ var CycleCard = (0, import_react4.memo)(function CycleCard2({ item, onOpen }) {
15630
+ const running = item.outcome === "running";
15631
+ const created = new Date(item.createdAt);
15632
+ const time = Number.isNaN(created.getTime()) ? "" : created.toLocaleTimeString();
15633
+ const open = onOpen ? () => onOpen(item) : void 0;
15634
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
15635
+ "div",
15636
+ {
15637
+ className: `cycle-card${open ? " cycle-card--clickable" : ""}${running ? " cycle-card--running" : ""}`,
15638
+ role: open ? "button" : void 0,
15639
+ tabIndex: open ? 0 : void 0,
15640
+ onClick: open,
15641
+ onKeyDown: open ? (e) => {
15642
+ if (e.key === "Enter" || e.key === " ") {
15643
+ e.preventDefault();
15644
+ open();
15645
+ }
15646
+ } : void 0,
15647
+ children: [
15648
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `agent-status-dot agent-status-dot--active${running ? " agent-status-dot--pulsing" : ""}` }),
15649
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cycle-card__role", children: cycleRoleLabel(item.role) }),
15650
+ item.label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cycle-card__label", children: item.label }),
15651
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cycle-card__outcome", children: cycleOutcomeLabel(item.outcome) }),
15652
+ time && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cycle-card__time", children: time })
15653
+ ]
15654
+ }
15655
+ );
15656
+ });
15535
15657
  var Item = (0, import_react4.memo)(function Item2({
15536
15658
  item,
15537
15659
  sessionId,
15538
- compact
15660
+ compact,
15661
+ onOpenCycle
15539
15662
  }) {
15540
15663
  switch (item.kind) {
15541
15664
  case "user":
@@ -15603,6 +15726,8 @@ ${text}</tr>
15603
15726
  item.variant === "block" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TriangleAlert, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Settings, { size: 12 }),
15604
15727
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text })
15605
15728
  ] });
15729
+ case "cycle":
15730
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CycleCard, { item, onOpen: onOpenCycle });
15606
15731
  }
15607
15732
  });
15608
15733
 
@@ -15624,7 +15749,8 @@ ${text}</tr>
15624
15749
  contextUsage,
15625
15750
  voice = null,
15626
15751
  value: propValue,
15627
- onValueChange: propOnValueChange
15752
+ onValueChange: propOnValueChange,
15753
+ allowAttachments = true
15628
15754
  }) {
15629
15755
  const [internalValue, setInternalValue] = (0, import_react5.useState)("");
15630
15756
  const value = propValue !== void 0 ? propValue : internalValue;
@@ -15660,7 +15786,7 @@ ${text}</tr>
15660
15786
  setAttachments((prev) => prev.filter((_, i) => i !== idx));
15661
15787
  };
15662
15788
  const handleFiles = (files) => {
15663
- if (!files) return;
15789
+ if (!allowAttachments || !files) return;
15664
15790
  for (let i = 0; i < files.length; i++) {
15665
15791
  const file = files[i];
15666
15792
  if (!file) continue;
@@ -15684,12 +15810,13 @@ ${text}</tr>
15684
15810
  }
15685
15811
  };
15686
15812
  const handlePaste = (e) => {
15687
- if (e.clipboardData.files && e.clipboardData.files.length > 0) {
15813
+ if (allowAttachments && e.clipboardData.files && e.clipboardData.files.length > 0) {
15688
15814
  handleFiles(e.clipboardData.files);
15689
15815
  }
15690
15816
  };
15691
15817
  const onDragEnter = (e) => {
15692
15818
  e.preventDefault();
15819
+ if (!allowAttachments) return;
15693
15820
  dragCounter.current++;
15694
15821
  if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
15695
15822
  setIsDragging(true);
@@ -15754,7 +15881,7 @@ ${text}</tr>
15754
15881
  ref: inputRef,
15755
15882
  className: "composer__input",
15756
15883
  value,
15757
- placeholder: "Message Caretaker (Drop/paste files/images)...",
15884
+ placeholder: allowAttachments ? "Message Caretaker (Drop/paste files/images)..." : "Message Caretaker...",
15758
15885
  rows: 2,
15759
15886
  disabled,
15760
15887
  onChange: (e) => setValue(e.target.value),
@@ -15763,31 +15890,33 @@ ${text}</tr>
15763
15890
  }
15764
15891
  ),
15765
15892
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__controls", children: [
15766
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
15767
- "button",
15768
- {
15769
- type: "button",
15770
- className: "composer__action-btn",
15771
- title: "Attach file or image",
15772
- "aria-label": "Attach file or image",
15773
- onClick: () => fileInputRef.current?.click(),
15774
- disabled,
15775
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Paperclip, { size: 16 })
15776
- }
15777
- ),
15778
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
15779
- "input",
15780
- {
15781
- type: "file",
15782
- ref: fileInputRef,
15783
- style: { display: "none" },
15784
- onChange: (e) => {
15785
- handleFiles(e.target.files);
15786
- e.target.value = "";
15787
- },
15788
- multiple: true
15789
- }
15790
- ),
15893
+ allowAttachments && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
15894
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
15895
+ "button",
15896
+ {
15897
+ type: "button",
15898
+ className: "composer__action-btn",
15899
+ title: "Attach file or image",
15900
+ "aria-label": "Attach file or image",
15901
+ onClick: () => fileInputRef.current?.click(),
15902
+ disabled,
15903
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Paperclip, { size: 16 })
15904
+ }
15905
+ ),
15906
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
15907
+ "input",
15908
+ {
15909
+ type: "file",
15910
+ ref: fileInputRef,
15911
+ style: { display: "none" },
15912
+ onChange: (e) => {
15913
+ handleFiles(e.target.files);
15914
+ e.target.value = "";
15915
+ },
15916
+ multiple: true
15917
+ }
15918
+ )
15919
+ ] }),
15791
15920
  voice && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__voice", children: [
15792
15921
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
15793
15922
  "button",
@@ -15968,13 +16097,8 @@ ${text}</tr>
15968
16097
  if (!preset || !preset.dist) return;
15969
16098
  setSelfLoaded(preset.selfLoadedContextFiles);
15970
16099
  setPresetEnv(preset.dist.env);
15971
- if (preset.dist.kind === "binary") {
15972
- setCommand("");
15973
- setArgs("");
15974
- } else {
15975
- setCommand(preset.dist.command);
15976
- setArgs(preset.dist.args.join(" "));
15977
- }
16100
+ setCommand(preset.dist.kind === "binary" ? "" : preset.dist.command);
16101
+ setArgs((preset.dist.args ?? []).join(" "));
15978
16102
  };
15979
16103
  const startEdit = (provider) => {
15980
16104
  setEditingProvider(provider);
@@ -20096,9 +20220,10 @@ ${text}</tr>
20096
20220
  mcpAuthOutcome,
20097
20221
  setMcpAuthOutcome,
20098
20222
  taskRuns = {},
20099
- onClose
20223
+ onClose,
20224
+ initialTab = "providers"
20100
20225
  }) {
20101
- const [activeTab, setActiveTab] = (0, import_react17.useState)("providers");
20226
+ const [activeTab, setActiveTab] = (0, import_react17.useState)(initialTab);
20102
20227
  if (!settingsData) {
20103
20228
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
20104
20229
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
@@ -20204,7 +20329,7 @@ ${text}</tr>
20204
20329
  };
20205
20330
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "settings-panel", children: [
20206
20331
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: "settings-panel__header", children: [
20207
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
20332
+ layout !== "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
20208
20333
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrowLeft, { size: 14 }),
20209
20334
  " Chat"
20210
20335
  ] }),
@@ -20281,144 +20406,329 @@ ${text}</tr>
20281
20406
  }
20282
20407
 
20283
20408
  // src/ProjectsTab.tsx
20409
+ var import_react19 = __toESM(require_react(), 1);
20410
+
20411
+ // src/TaskCycleView.tsx
20284
20412
  var import_react18 = __toESM(require_react(), 1);
20285
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
20286
- var LS_PROJECT_KEY = "caretaker.taskView.selectedProjectId";
20287
- var LS_ARCHIVED_KEY = "caretaker.taskView.showArchived";
20288
- function loadSavedProjectId() {
20289
- try {
20290
- const raw = localStorage.getItem(LS_PROJECT_KEY);
20291
- return raw && raw.trim() ? raw.trim() : null;
20292
- } catch {
20293
- return null;
20294
- }
20295
- }
20296
- function saveProjectId(id) {
20297
- try {
20298
- if (id === null) localStorage.removeItem(LS_PROJECT_KEY);
20299
- else localStorage.setItem(LS_PROJECT_KEY, id);
20300
- } catch {
20301
- }
20302
- }
20303
- function loadShowArchived() {
20304
- try {
20305
- return localStorage.getItem(LS_ARCHIVED_KEY) === "1";
20306
- } catch {
20307
- return false;
20308
- }
20309
- }
20310
- function saveShowArchived(v) {
20311
- try {
20312
- localStorage.setItem(LS_ARCHIVED_KEY, v ? "1" : "0");
20313
- } catch {
20314
- }
20413
+
20414
+ // src/chat_state.ts
20415
+ function closeStreamingAssistant2(items) {
20416
+ const last = items[items.length - 1];
20417
+ if (!last || last.kind !== "assistant" || !last.streaming) return items;
20418
+ return [...items.slice(0, -1), { ...last, streaming: false }];
20315
20419
  }
20316
- function taskMessagesToChatItems(msgs, labels) {
20317
- const items = [];
20318
- for (const msg of msgs) {
20319
- if (msg.messageType === "system" || msg.messageType === "block") {
20320
- items.push({ kind: "notice", text: msg.content, variant: msg.messageType });
20321
- continue;
20322
- }
20323
- if (msg.messageType === "tool_call") {
20324
- const sp = msg.content.indexOf(" ");
20325
- const name = sp === -1 ? msg.content : msg.content.slice(0, sp);
20326
- let args = {};
20327
- if (sp !== -1) {
20328
- try {
20329
- args = JSON.parse(msg.content.slice(sp + 1));
20330
- } catch {
20331
- args = msg.content.slice(sp + 1);
20420
+ function reconstructChatItems2(messages) {
20421
+ let items = [];
20422
+ for (const msg of messages) {
20423
+ if (msg.recap) {
20424
+ items = closeStreamingAssistant2(items);
20425
+ items.push({ kind: "assistant", text: msg.content, streaming: false, label: "Cycle recap" });
20426
+ } else if (msg.role === "user") {
20427
+ items = closeStreamingAssistant2(items);
20428
+ items.push({ kind: "user", text: msg.content, attachments: msg.attachments });
20429
+ } else if (msg.role === "assistant") {
20430
+ items = closeStreamingAssistant2(items);
20431
+ if (msg.parts && msg.parts.length > 0) {
20432
+ for (const part of msg.parts) {
20433
+ if (part.type === "text") {
20434
+ items.push({ kind: "assistant", text: part.text, streaming: false });
20435
+ } else if (part.type === "thinking" && part.text.trim().length > 0) {
20436
+ items.push({ kind: "thinking", text: part.text });
20437
+ } else if (part.type === "tool_use") {
20438
+ items.push({
20439
+ kind: "tool",
20440
+ id: part.id,
20441
+ name: part.name,
20442
+ args: part.args,
20443
+ result: null
20444
+ });
20445
+ }
20332
20446
  }
20447
+ } else {
20448
+ items.push({ kind: "assistant", text: msg.content, streaming: false });
20333
20449
  }
20334
- items.push({ kind: "tool", id: msg.toolCallId || String(msg.id), name, args, result: "" });
20335
- continue;
20336
- }
20337
- if (msg.messageType === "plan") {
20338
- items.push({ kind: "assistant", text: `**\u{1F4CB} Plan submitted**
20339
-
20340
- ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.planner });
20341
- continue;
20342
- }
20343
- if (msg.messageType === "review") {
20344
- items.push({ kind: "assistant", text: `**\u{1F50E} Code review**
20345
-
20346
- ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20347
- continue;
20348
- }
20349
- if (msg.role === "user") {
20350
- items.push({ kind: "user", text: msg.content });
20351
- continue;
20352
- }
20353
- let text = msg.content;
20354
- let thinking = "";
20355
- if (msg.content.startsWith("[")) {
20356
- try {
20357
- const parsed = JSON.parse(msg.content);
20358
- if (Array.isArray(parsed)) {
20359
- const t = parsed.find((b) => b.type === "thinking");
20360
- const x = parsed.find((b) => b.type === "text");
20361
- if (t?.content) thinking = t.content;
20362
- if (x?.content) text = x.content;
20450
+ } else if (msg.role === "tool") {
20451
+ const toolCallId = msg.toolCallId;
20452
+ if (toolCallId) {
20453
+ const idx = items.findIndex(
20454
+ (it) => it.kind === "tool" && it.id === toolCallId && it.result === null
20455
+ );
20456
+ if (idx !== -1) {
20457
+ const toolItem = items[idx];
20458
+ items[idx] = { ...toolItem, result: msg.content };
20459
+ } else {
20460
+ items.push({
20461
+ kind: "tool",
20462
+ id: toolCallId,
20463
+ name: "unknown_tool",
20464
+ args: {},
20465
+ result: msg.content
20466
+ });
20363
20467
  }
20364
- } catch {
20365
20468
  }
20366
20469
  }
20367
- if (thinking) items.push({ kind: "thinking", text: thinking });
20368
- items.push({ kind: "assistant", text, streaming: false, label: msg.agentLabel || labels?.developer });
20369
20470
  }
20370
- return items;
20471
+ return closeStreamingAssistant2(items);
20371
20472
  }
20372
- var PAGE_SIZE = 20;
20373
- function ProjectsTab({ agents }) {
20374
- const [projects, setProjects] = (0, import_react18.useState)([]);
20375
- const [selectedProjectId, setSelectedProjectId] = (0, import_react18.useState)(loadSavedProjectId);
20376
- const [tasks, setTasks] = (0, import_react18.useState)([]);
20377
- const [selectedTaskId, setSelectedTaskId] = (0, import_react18.useState)(null);
20378
- const [taskMessages, setTaskMessages] = (0, import_react18.useState)([]);
20379
- const [view, setView] = (0, import_react18.useState)("list");
20380
- const [page, setPage] = (0, import_react18.useState)(0);
20381
- const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react18.useState)(false);
20382
- const [newTask, setNewTask] = (0, import_react18.useState)({
20383
- title: "",
20384
- objective: "",
20385
- checklistText: "",
20386
- startActive: true,
20387
- agentId: "",
20388
- plannerAgentId: "",
20389
- reviewerAgentId: ""
20390
- });
20391
- const [composerText, setComposerText] = (0, import_react18.useState)("");
20392
- const [isSending, setIsSending] = (0, import_react18.useState)(false);
20393
- const [showArchived, setShowArchived] = (0, import_react18.useState)(loadShowArchived);
20394
- const [pendingConfirm, setPendingConfirm] = (0, import_react18.useState)(null);
20395
- const [taskError, setTaskError] = (0, import_react18.useState)(null);
20396
- const threadIntervalRef = (0, import_react18.useRef)(null);
20397
- (0, import_react18.useEffect)(() => {
20398
- fetchProjects();
20399
- return () => {
20400
- stopThreadPolling();
20401
- };
20402
- }, []);
20403
- (0, import_react18.useEffect)(() => {
20404
- if (projects.length > 0 && selectedProjectId === null) {
20405
- setSelectedProjectId(projects[0].id);
20406
- }
20407
- if (projects.length > 0 && selectedProjectId !== null && !projects.some((p) => p.id === selectedProjectId)) {
20408
- setSelectedProjectId(projects[0].id);
20409
- }
20410
- if (projects.length === 0) {
20411
- setSelectedProjectId(null);
20412
- }
20413
- }, [projects]);
20414
- (0, import_react18.useEffect)(() => {
20415
- saveProjectId(selectedProjectId);
20416
- }, [selectedProjectId]);
20417
- (0, import_react18.useEffect)(() => {
20418
- saveShowArchived(showArchived);
20419
- }, [showArchived]);
20420
- (0, import_react18.useEffect)(() => {
20421
- if (selectedProjectId !== null) {
20473
+ function chatReducer(state, action) {
20474
+ switch (action.kind) {
20475
+ case "send-user":
20476
+ return {
20477
+ ...state,
20478
+ status: "streaming",
20479
+ errorText: null,
20480
+ items: [...state.items, { kind: "user", text: action.text, attachments: action.attachments }]
20481
+ };
20482
+ case "append-chunk": {
20483
+ const last = state.items[state.items.length - 1];
20484
+ if (last && last.kind === "assistant" && last.streaming) {
20485
+ const updated = { ...last, text: last.text + action.text };
20486
+ return { ...state, items: [...state.items.slice(0, -1), updated] };
20487
+ }
20488
+ return {
20489
+ ...state,
20490
+ items: [...state.items, { kind: "assistant", text: action.text, streaming: true }]
20491
+ };
20492
+ }
20493
+ case "append-thinking": {
20494
+ const last = state.items[state.items.length - 1];
20495
+ if (last && last.kind === "thinking") {
20496
+ const updated = { ...last, text: last.text + action.text };
20497
+ return { ...state, items: [...state.items.slice(0, -1), updated] };
20498
+ }
20499
+ return {
20500
+ ...state,
20501
+ items: [...state.items, { kind: "thinking", text: action.text }]
20502
+ };
20503
+ }
20504
+ case "tool-call":
20505
+ return {
20506
+ ...state,
20507
+ items: [
20508
+ ...closeStreamingAssistant2(state.items),
20509
+ { kind: "tool", id: action.id, name: action.name, args: action.args, result: null }
20510
+ ]
20511
+ };
20512
+ case "tool-result": {
20513
+ const idx = state.items.findIndex(
20514
+ (it) => it.kind === "tool" && it.id === action.id && it.result === null
20515
+ );
20516
+ if (idx < 0) return state;
20517
+ const tool = state.items[idx];
20518
+ const updated = { ...tool, result: action.content };
20519
+ return {
20520
+ ...state,
20521
+ items: [...state.items.slice(0, idx), updated, ...state.items.slice(idx + 1)]
20522
+ };
20523
+ }
20524
+ case "permission-request":
20525
+ return {
20526
+ ...state,
20527
+ pendingConfirms: [
20528
+ ...state.pendingConfirms,
20529
+ { id: action.id, toolName: action.toolName, args: action.args }
20530
+ ]
20531
+ };
20532
+ case "permission-resolved":
20533
+ return {
20534
+ ...state,
20535
+ pendingConfirms: state.pendingConfirms.filter((p) => p.id !== action.id)
20536
+ };
20537
+ case "done":
20538
+ return {
20539
+ ...state,
20540
+ status: "idle",
20541
+ pendingConfirms: [],
20542
+ items: closeStreamingAssistant2(state.items)
20543
+ };
20544
+ case "clear":
20545
+ return {
20546
+ ...state,
20547
+ items: [],
20548
+ status: "idle",
20549
+ errorText: null,
20550
+ pendingConfirms: [],
20551
+ contextUsage: null
20552
+ };
20553
+ case "error":
20554
+ return {
20555
+ ...state,
20556
+ status: "error",
20557
+ errorText: action.text,
20558
+ pendingConfirms: [],
20559
+ items: closeStreamingAssistant2(state.items)
20560
+ };
20561
+ case "load-history": {
20562
+ const historyItems = reconstructChatItems2(action.messages);
20563
+ return {
20564
+ ...state,
20565
+ items: historyItems,
20566
+ // A cycle opened mid-run keeps the stream indicator on until its `done`.
20567
+ status: action.streaming ? "streaming" : "idle",
20568
+ errorText: null,
20569
+ pendingConfirms: []
20570
+ };
20571
+ }
20572
+ case "context-usage":
20573
+ return {
20574
+ ...state,
20575
+ contextUsage: action.usage
20576
+ };
20577
+ }
20578
+ }
20579
+ var initialChatState = {
20580
+ items: [],
20581
+ status: "idle",
20582
+ errorText: null,
20583
+ pendingConfirms: [],
20584
+ contextUsage: null
20585
+ };
20586
+
20587
+ // src/TaskCycleView.tsx
20588
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
20589
+ function TaskCycleView({ item, postMessage, onBack }) {
20590
+ const [chat, dispatch] = (0, import_react18.useReducer)(chatReducer, initialChatState);
20591
+ const { sessionId, agentId } = item;
20592
+ const postRef = (0, import_react18.useRef)(postMessage);
20593
+ postRef.current = postMessage;
20594
+ (0, import_react18.useEffect)(() => {
20595
+ function handle(event) {
20596
+ const msg = event.data;
20597
+ if (!msg || typeof msg !== "object" || !("type" in msg) || !("sessionId" in msg)) return;
20598
+ if (msg.sessionId !== sessionId) return;
20599
+ if (msg.type === "cycleLoaded") {
20600
+ dispatch({ kind: "load-history", messages: msg.messages, streaming: msg.running });
20601
+ return;
20602
+ }
20603
+ if (msg.type !== "cycleEvent") return;
20604
+ const ev = msg.event;
20605
+ switch (ev.type) {
20606
+ case "chunk":
20607
+ dispatch({ kind: "append-chunk", text: ev.text });
20608
+ return;
20609
+ case "thinking":
20610
+ dispatch({ kind: "append-thinking", text: ev.text });
20611
+ return;
20612
+ case "tool_call":
20613
+ dispatch({ kind: "tool-call", id: ev.id, name: ev.name, args: ev.args });
20614
+ return;
20615
+ case "tool_result":
20616
+ dispatch({ kind: "tool-result", id: ev.id, content: ev.content });
20617
+ return;
20618
+ case "done":
20619
+ dispatch({ kind: "done" });
20620
+ postRef.current({ type: "watchCycle", agentId, sessionId });
20621
+ return;
20622
+ case "error":
20623
+ dispatch({ kind: "error", text: ev.message });
20624
+ return;
20625
+ }
20626
+ }
20627
+ window.addEventListener("message", handle);
20628
+ postRef.current({ type: "watchCycle", agentId, sessionId });
20629
+ return () => {
20630
+ window.removeEventListener("message", handle);
20631
+ postRef.current({ type: "unwatchCycle", sessionId });
20632
+ };
20633
+ }, [sessionId, agentId]);
20634
+ const running = chat.status === "streaming";
20635
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
20636
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "10px 14px" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20637
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to the task thread", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrowLeft, { size: 13 }) }),
20638
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__chat-header-info", children: [
20639
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
20640
+ cycleRoleLabel(item.role),
20641
+ " cycle",
20642
+ item.label ? ` \xB7 ${item.label}` : ""
20643
+ ] }),
20644
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: running ? "running" : cycleOutcomeLabel(item.outcome) })
20645
+ ] })
20646
+ ] }) }),
20647
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MessageList, { items: chat.items, sessionId: null, isStreaming: running, agentName: item.label }),
20648
+ chat.errorText && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "notice notice--block", children: chat.errorText })
20649
+ ] });
20650
+ }
20651
+
20652
+ // src/ProjectsTab.tsx
20653
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
20654
+ var LS_ARCHIVED_KEY = "caretaker.taskView.showArchived";
20655
+ function persistLastProject(id) {
20656
+ void fetch("/api/ui-state", {
20657
+ method: "PUT",
20658
+ headers: { "Content-Type": "application/json" },
20659
+ body: JSON.stringify({ lastProjectId: id })
20660
+ }).catch(() => {
20661
+ });
20662
+ }
20663
+ function loadShowArchived() {
20664
+ try {
20665
+ return localStorage.getItem(LS_ARCHIVED_KEY) === "1";
20666
+ } catch {
20667
+ return false;
20668
+ }
20669
+ }
20670
+ function saveShowArchived(v) {
20671
+ try {
20672
+ localStorage.setItem(LS_ARCHIVED_KEY, v ? "1" : "0");
20673
+ } catch {
20674
+ }
20675
+ }
20676
+ var PAGE_SIZE = 20;
20677
+ function ProjectsTab({ agents, onOpenSettings, postMessage }) {
20678
+ const [projects, setProjects] = (0, import_react19.useState)([]);
20679
+ const [selectedProjectId, setSelectedProjectId] = (0, import_react19.useState)(null);
20680
+ const [tasks, setTasks] = (0, import_react19.useState)([]);
20681
+ const [selectedTaskId, setSelectedTaskId] = (0, import_react19.useState)(null);
20682
+ const [taskMessages, setTaskMessages] = (0, import_react19.useState)([]);
20683
+ const [view, setView] = (0, import_react19.useState)("list");
20684
+ const [page, setPage] = (0, import_react19.useState)(0);
20685
+ const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react19.useState)(false);
20686
+ const [newTask, setNewTask] = (0, import_react19.useState)({
20687
+ title: "",
20688
+ objective: "",
20689
+ checklistText: "",
20690
+ startActive: true,
20691
+ agentId: "",
20692
+ plannerAgentId: "",
20693
+ reviewerAgentId: ""
20694
+ });
20695
+ const [isSending, setIsSending] = (0, import_react19.useState)(false);
20696
+ const [showArchived, setShowArchived] = (0, import_react19.useState)(loadShowArchived);
20697
+ const [pendingConfirm, setPendingConfirm] = (0, import_react19.useState)(null);
20698
+ const [taskError, setTaskError] = (0, import_react19.useState)(null);
20699
+ const threadIntervalRef = (0, import_react19.useRef)(null);
20700
+ (0, import_react19.useEffect)(() => {
20701
+ void (async () => {
20702
+ try {
20703
+ const res = await fetch("/api/ui-state");
20704
+ if (res.ok) {
20705
+ const { lastProjectId } = await res.json();
20706
+ if (typeof lastProjectId === "string") setSelectedProjectId(lastProjectId);
20707
+ }
20708
+ } catch {
20709
+ }
20710
+ await fetchProjects();
20711
+ })();
20712
+ return () => {
20713
+ stopThreadPolling();
20714
+ };
20715
+ }, []);
20716
+ (0, import_react19.useEffect)(() => {
20717
+ if (projects.length > 0 && selectedProjectId === null) {
20718
+ setSelectedProjectId(projects[0].id);
20719
+ }
20720
+ if (projects.length > 0 && selectedProjectId !== null && !projects.some((p) => p.id === selectedProjectId)) {
20721
+ setSelectedProjectId(projects[0].id);
20722
+ }
20723
+ if (projects.length === 0) {
20724
+ setSelectedProjectId(null);
20725
+ }
20726
+ }, [projects]);
20727
+ (0, import_react19.useEffect)(() => {
20728
+ saveShowArchived(showArchived);
20729
+ }, [showArchived]);
20730
+ (0, import_react19.useEffect)(() => {
20731
+ if (selectedProjectId !== null) {
20422
20732
  fetchTasks(selectedProjectId);
20423
20733
  setView("list");
20424
20734
  setSelectedTaskId(null);
@@ -20429,7 +20739,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20429
20739
  setTasks([]);
20430
20740
  }
20431
20741
  }, [selectedProjectId, showArchived]);
20432
- (0, import_react18.useEffect)(() => {
20742
+ (0, import_react19.useEffect)(() => {
20433
20743
  if (selectedTaskId !== null) {
20434
20744
  fetchTaskMessages(selectedTaskId);
20435
20745
  startThreadPolling(selectedTaskId);
@@ -20602,7 +20912,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20602
20912
  const cancelPendingAction = () => {
20603
20913
  setPendingConfirm(null);
20604
20914
  };
20605
- (0, import_react18.useEffect)(() => {
20915
+ (0, import_react19.useEffect)(() => {
20606
20916
  if (!pendingConfirm) return;
20607
20917
  function handleKeyDown(event) {
20608
20918
  if (event.key === "Escape") {
@@ -20612,7 +20922,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20612
20922
  window.addEventListener("keydown", handleKeyDown);
20613
20923
  return () => window.removeEventListener("keydown", handleKeyDown);
20614
20924
  }, [pendingConfirm]);
20615
- (0, import_react18.useEffect)(() => {
20925
+ (0, import_react19.useEffect)(() => {
20616
20926
  if (!taskError) return;
20617
20927
  const t = setTimeout(() => setTaskError(null), 5e3);
20618
20928
  return () => clearTimeout(t);
@@ -20632,26 +20942,26 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20632
20942
  console.error("Failed to toggle checklist item:", err);
20633
20943
  }
20634
20944
  };
20635
- const handleSendMessage = async (e) => {
20636
- e.preventDefault();
20637
- if (!composerText.trim() || selectedTaskId === null || isSending) return;
20945
+ const handleSendMessage = async (text) => {
20946
+ if (!text.trim() || selectedTaskId === null || isSending) return false;
20638
20947
  setIsSending(true);
20639
20948
  try {
20640
20949
  const res = await fetch(`/api/tasks/${selectedTaskId}/messages`, {
20641
20950
  method: "POST",
20642
20951
  headers: { "Content-Type": "application/json" },
20643
- body: JSON.stringify({ content: composerText.trim() })
20952
+ body: JSON.stringify({ content: text.trim() })
20644
20953
  });
20645
20954
  if (res.ok) {
20646
- setComposerText("");
20647
20955
  fetchTaskMessages(selectedTaskId);
20648
20956
  if (selectedProjectId !== null) fetchTasks(selectedProjectId);
20957
+ return true;
20649
20958
  }
20650
20959
  } catch (err) {
20651
20960
  console.error("Failed to send message:", err);
20652
20961
  } finally {
20653
20962
  setIsSending(false);
20654
20963
  }
20964
+ return false;
20655
20965
  };
20656
20966
  const openTaskLog = (task) => {
20657
20967
  setSelectedTaskId(task.id);
@@ -20743,7 +21053,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20743
21053
  const selectedProject = projects.find((p) => p.id === selectedProjectId);
20744
21054
  const selectedTask = tasks.find((t) => t.id === selectedTaskId);
20745
21055
  const selectedProjectAgentName = agents.find((a) => a.id === selectedProject?.agentId)?.name || "Default Agent";
20746
- const taskAgentLabels = (0, import_react18.useMemo)(() => {
21056
+ const taskAgentLabels = (0, import_react19.useMemo)(() => {
20747
21057
  if (!selectedTask) return void 0;
20748
21058
  const agentLabelFor = (agentId) => {
20749
21059
  const a = agents.find((x) => x.id === agentId);
@@ -20789,13 +21099,22 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20789
21099
  const safePage = Math.min(page, totalPages - 1);
20790
21100
  const pageStart = safePage * PAGE_SIZE;
20791
21101
  const pageTasks = tasks.slice(pageStart, pageStart + PAGE_SIZE);
20792
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
20793
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("main", { className: "app__chat-pane", style: { flex: 1, display: "flex", flexDirection: "column", background: "var(--vscode-editor-background)" }, children: projects.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "No projects registered. Create one from the Settings panel to get started." }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21102
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
21103
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("main", { className: "app__chat-pane", style: { flex: 1, display: "flex", flexDirection: "column", background: "var(--vscode-editor-background)" }, children: projects.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { children: [
21104
+ "No projects registered.",
21105
+ " ",
21106
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__link-btn", onClick: onOpenSettings, children: "Create one in Settings" }),
21107
+ " ",
21108
+ "to get started."
21109
+ ] }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20794
21110
  TaskListView,
20795
21111
  {
20796
21112
  projects,
20797
21113
  selectedProjectId,
20798
- onProjectChange: setSelectedProjectId,
21114
+ onProjectChange: (id) => {
21115
+ setSelectedProjectId(id);
21116
+ persistLastProject(id);
21117
+ },
20799
21118
  project: selectedProject,
20800
21119
  agentName: selectedProjectAgentName,
20801
21120
  agents,
@@ -20812,7 +21131,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20812
21131
  onArchive: handleArchiveFromList,
20813
21132
  statusColor
20814
21133
  }
20815
- ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21134
+ ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20816
21135
  TaskLogView,
20817
21136
  {
20818
21137
  task: selectedTask,
@@ -20820,16 +21139,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20820
21139
  agentLabels: taskAgentLabels,
20821
21140
  isActiveLike,
20822
21141
  reviewRound,
20823
- composerText,
20824
- onComposerChange: setComposerText,
20825
21142
  onSend: handleSendMessage,
20826
21143
  isSending,
21144
+ postMessage,
20827
21145
  onBack: backToList,
20828
21146
  onToggleChecklistItem: handleToggleChecklistItem,
20829
21147
  onToggleStatus: handleToggleTaskStatus,
20830
21148
  statusColor
20831
21149
  }
20832
- ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21150
+ ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20833
21151
  TaskEditView,
20834
21152
  {
20835
21153
  task: selectedTask,
@@ -20847,11 +21165,11 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20847
21165
  onOpenLog: () => setView("log"),
20848
21166
  statusColor
20849
21167
  }
20850
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__empty-state", children: [
20851
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Task not found. Go back to the list." }),
20852
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
21168
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__empty-state", children: [
21169
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: "Task not found. Go back to the list." }),
21170
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
20853
21171
  ] }) : null }),
20854
- isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21172
+ isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20855
21173
  "div",
20856
21174
  {
20857
21175
  style: {
@@ -20866,7 +21184,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20866
21184
  justifyContent: "center",
20867
21185
  zIndex: 999
20868
21186
  },
20869
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21187
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20870
21188
  "form",
20871
21189
  {
20872
21190
  onSubmit: handleCreateTask,
@@ -20877,14 +21195,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20877
21195
  background: "var(--vscode-sideBar-background)"
20878
21196
  },
20879
21197
  children: [
20880
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "confirm__header", children: [
20881
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Wrench, { size: 18 }) }),
20882
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
21198
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "confirm__header", children: [
21199
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Wrench, { size: 18 }) }),
21200
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
20883
21201
  ] }),
20884
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
20885
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21202
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
21203
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20886
21204
  "Task Title",
20887
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21205
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20888
21206
  "input",
20889
21207
  {
20890
21208
  type: "text",
@@ -20904,9 +21222,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20904
21222
  }
20905
21223
  )
20906
21224
  ] }),
20907
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21225
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20908
21226
  "Objective (Extended markdown goal description)",
20909
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21227
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20910
21228
  "textarea",
20911
21229
  {
20912
21230
  required: true,
@@ -20927,9 +21245,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20927
21245
  }
20928
21246
  )
20929
21247
  ] }),
20930
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21248
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20931
21249
  "Checklist Items (One item per line)",
20932
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21250
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20933
21251
  "textarea",
20934
21252
  {
20935
21253
  placeholder: "Create route handler\nWrite unit tests\nUpdate documentation",
@@ -20949,9 +21267,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20949
21267
  }
20950
21268
  )
20951
21269
  ] }),
20952
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21270
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20953
21271
  "Assigned Agent (optional \u2014 overrides project default)",
20954
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21272
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20955
21273
  "select",
20956
21274
  {
20957
21275
  value: newTask.agentId,
@@ -20966,8 +21284,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20966
21284
  outline: "none"
20967
21285
  },
20968
21286
  children: [
20969
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
20970
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
21287
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
21288
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
20971
21289
  a.name,
20972
21290
  " (",
20973
21291
  a.provider,
@@ -20977,9 +21295,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20977
21295
  }
20978
21296
  )
20979
21297
  ] }),
20980
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21298
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20981
21299
  "Planner Agent Override (optional)",
20982
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21300
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20983
21301
  "select",
20984
21302
  {
20985
21303
  value: newTask.plannerAgentId,
@@ -20994,8 +21312,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20994
21312
  outline: "none"
20995
21313
  },
20996
21314
  children: [
20997
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
20998
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
21315
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
21316
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
20999
21317
  a.name,
21000
21318
  " (",
21001
21319
  a.provider,
@@ -21005,9 +21323,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21005
21323
  }
21006
21324
  )
21007
21325
  ] }),
21008
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21326
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
21009
21327
  "Reviewer Agent Override (optional)",
21010
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21328
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21011
21329
  "select",
21012
21330
  {
21013
21331
  value: newTask.reviewerAgentId,
@@ -21022,8 +21340,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21022
21340
  outline: "none"
21023
21341
  },
21024
21342
  children: [
21025
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21026
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
21343
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
21344
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
21027
21345
  a.name,
21028
21346
  " (",
21029
21347
  a.provider,
@@ -21033,8 +21351,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21033
21351
  }
21034
21352
  )
21035
21353
  ] }),
21036
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
21037
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21354
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
21355
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21038
21356
  "input",
21039
21357
  {
21040
21358
  type: "checkbox",
@@ -21043,24 +21361,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21043
21361
  style: { cursor: "pointer" }
21044
21362
  }
21045
21363
  ),
21046
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
21364
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
21047
21365
  ] })
21048
21366
  ] }),
21049
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
21050
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
21051
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
21367
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
21368
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
21369
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
21052
21370
  ] })
21053
21371
  ]
21054
21372
  }
21055
21373
  )
21056
21374
  }
21057
21375
  ),
21058
- pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
21059
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
21060
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "app__confirm-message", children: pendingConfirm.type === "delete" ? `Permanently delete task #${pendingConfirm.task.id} "${pendingConfirm.task.title}"? This removes the task and all its messages from the store. This action cannot be undone.` : pendingConfirm.type === "archive" ? `Archive task #${pendingConfirm.task.id} "${pendingConfirm.task.title}"? It will be hidden from the list and excluded from the scheduler. You can unarchive it later by enabling "Show archived".` : `Discard the worktree for task #${pendingConfirm.task.id}? Pending changes are committed to branch ${pendingConfirm.task.branch}; the branch is kept.` }),
21061
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__confirm-buttons", children: [
21062
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
21063
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21376
+ pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
21377
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
21378
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "app__confirm-message", children: pendingConfirm.type === "delete" ? `Permanently delete task #${pendingConfirm.task.id} "${pendingConfirm.task.title}"? This removes the task and all its messages from the store. This action cannot be undone.` : pendingConfirm.type === "archive" ? `Archive task #${pendingConfirm.task.id} "${pendingConfirm.task.title}"? It will be hidden from the list and excluded from the scheduler. You can unarchive it later by enabling "Show archived".` : `Discard the worktree for task #${pendingConfirm.task.id}? Pending changes are committed to branch ${pendingConfirm.task.branch}; the branch is kept.` }),
21379
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__confirm-buttons", children: [
21380
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
21381
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21064
21382
  "button",
21065
21383
  {
21066
21384
  className: `app__confirm-btn ${pendingConfirm.type === "delete" ? "app__confirm-btn--danger" : ""}`,
@@ -21070,7 +21388,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21070
21388
  )
21071
21389
  ] })
21072
21390
  ] }) }),
21073
- taskError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
21391
+ taskError && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
21074
21392
  ] });
21075
21393
  }
21076
21394
  function TaskListView({
@@ -21093,10 +21411,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21093
21411
  onArchive,
21094
21412
  statusColor
21095
21413
  }) {
21096
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21097
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-view__header", children: [
21098
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21099
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21414
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21415
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "task-view__header", children: [
21416
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21417
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21100
21418
  "select",
21101
21419
  {
21102
21420
  className: "task-view__project-filter",
@@ -21113,17 +21431,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21113
21431
  outline: "none",
21114
21432
  cursor: "pointer"
21115
21433
  },
21116
- children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: p.id, children: p.name }, p.id))
21434
+ children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: p.id, children: p.name }, p.id))
21117
21435
  }
21118
21436
  ),
21119
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
21437
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
21120
21438
  "Agent: ",
21121
21439
  agentName
21122
21440
  ] })
21123
21441
  ] }),
21124
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
21125
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "task-view__archived-toggle", children: [
21126
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21442
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
21443
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "task-view__archived-toggle", children: [
21444
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21127
21445
  "input",
21128
21446
  {
21129
21447
  type: "checkbox",
@@ -21134,42 +21452,42 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21134
21452
  ),
21135
21453
  "Show archived"
21136
21454
  ] }),
21137
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
21455
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
21138
21456
  ] })
21139
21457
  ] }),
21140
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { children: [
21458
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { children: [
21141
21459
  "No tasks created for ",
21142
21460
  project.name,
21143
21461
  '. Click "+ New Task" to start.'
21144
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { className: "task-table", children: [
21145
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { children: [
21146
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
21147
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", children: "Title" }),
21148
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
21149
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
21150
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
21151
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
21152
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
21153
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
21462
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: "task-table", children: [
21463
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("tr", { children: [
21464
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
21465
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", children: "Title" }),
21466
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
21467
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
21468
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
21469
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
21470
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
21471
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
21154
21472
  ] }) }),
21155
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: tasks.map((task) => {
21473
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: tasks.map((task) => {
21156
21474
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
21157
21475
  const totalCount = task.checklist.length;
21158
21476
  const isArchived = !!task.archived;
21159
21477
  const updated = new Date(task.updatedAt);
21160
21478
  const updatedStr = isNaN(updated.getTime()) ? task.updatedAt : updated.toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
21161
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21479
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21162
21480
  "tr",
21163
21481
  {
21164
21482
  className: `task-table__row${isArchived ? " task-table__row--archived" : ""}`,
21165
21483
  onClick: () => onOpenLog(task),
21166
21484
  children: [
21167
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
21168
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "task-table__title", children: [
21169
- isArchived && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Archive, { size: 11 }),
21485
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
21486
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "task-table__title", children: [
21487
+ isArchived && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Archive, { size: 11 }),
21170
21488
  task.title
21171
21489
  ] }) }),
21172
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21490
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21173
21491
  "span",
21174
21492
  {
21175
21493
  className: "task-table__badge",
@@ -21177,28 +21495,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21177
21495
  children: task.status
21178
21496
  }
21179
21497
  ) }),
21180
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", style: { fontSize: "11px" }, children: task.agentId ? agents.find((a) => a.id === task.agentId)?.name || task.agentId : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
21181
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-table__progress", children: [
21182
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21498
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", style: { fontSize: "11px" }, children: task.agentId ? agents.find((a) => a.id === task.agentId)?.name || task.agentId : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
21499
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "task-table__progress", children: [
21500
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21183
21501
  "span",
21184
21502
  {
21185
21503
  className: "task-table__progress-fill",
21186
21504
  style: { width: `${completedCount / totalCount * 100}%` }
21187
21505
  }
21188
21506
  ) }),
21189
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "task-table__progress-text", children: [
21507
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "task-table__progress-text", children: [
21190
21508
  completedCount,
21191
21509
  "/",
21192
21510
  totalCount
21193
21511
  ] })
21194
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21195
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "task-table__branch", children: [
21196
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 11 }),
21197
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { children: task.branch })
21198
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21199
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
21200
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
21201
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21512
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21513
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "task-table__branch", children: [
21514
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GitBranch, { size: 11 }),
21515
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { children: task.branch })
21516
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21517
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
21518
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
21519
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21202
21520
  "button",
21203
21521
  {
21204
21522
  className: "task-table__edit-btn",
@@ -21208,10 +21526,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21208
21526
  },
21209
21527
  title: task.archived ? "Unarchive task" : "Archive task",
21210
21528
  "aria-label": task.archived ? "Unarchive task" : "Archive task",
21211
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Archive, { size: 13 })
21529
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Archive, { size: 13 })
21212
21530
  }
21213
21531
  ),
21214
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21532
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21215
21533
  "button",
21216
21534
  {
21217
21535
  className: "task-table__edit-btn",
@@ -21221,7 +21539,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21221
21539
  },
21222
21540
  title: "Edit task",
21223
21541
  "aria-label": "Edit task",
21224
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Pencil, { size: 13 })
21542
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Pencil, { size: 13 })
21225
21543
  }
21226
21544
  )
21227
21545
  ] }) })
@@ -21231,8 +21549,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21231
21549
  );
21232
21550
  }) })
21233
21551
  ] }) }),
21234
- totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-table__pagination", children: [
21235
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21552
+ totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "task-table__pagination", children: [
21553
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21236
21554
  "button",
21237
21555
  {
21238
21556
  className: "task-table__page-btn",
@@ -21241,13 +21559,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21241
21559
  children: "\u2039 Prev"
21242
21560
  }
21243
21561
  ),
21244
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "task-table__page-info", children: [
21562
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "task-table__page-info", children: [
21245
21563
  "Page ",
21246
21564
  page + 1,
21247
21565
  " of ",
21248
21566
  totalPages
21249
21567
  ] }),
21250
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21568
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21251
21569
  "button",
21252
21570
  {
21253
21571
  className: "task-table__page-btn",
@@ -21265,10 +21583,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21265
21583
  agentLabels,
21266
21584
  isActiveLike,
21267
21585
  reviewRound,
21268
- composerText,
21269
- onComposerChange,
21270
21586
  onSend,
21271
21587
  isSending,
21588
+ postMessage,
21272
21589
  onBack,
21273
21590
  onToggleChecklistItem,
21274
21591
  onToggleStatus,
@@ -21276,20 +21593,31 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21276
21593
  }) {
21277
21594
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
21278
21595
  const totalCount = task.checklist.length;
21279
- const chatItems = (0, import_react18.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
21280
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21281
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
21282
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21283
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrowLeft, { size: 13 }) }),
21284
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__chat-header-info", children: [
21285
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
21596
+ const chatItems = (0, import_react19.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
21597
+ const [openCycle, setOpenCycle] = (0, import_react19.useState)(null);
21598
+ const [draft, setDraft] = (0, import_react19.useState)("");
21599
+ const openCycleItem = (0, import_react19.useCallback)((item) => setOpenCycle(item), []);
21600
+ const autoOpenedFor = (0, import_react19.useRef)(null);
21601
+ (0, import_react19.useEffect)(() => {
21602
+ if (autoOpenedFor.current === task.id || taskMessages.length === 0) return;
21603
+ autoOpenedFor.current = task.id;
21604
+ const latest = [...chatItems].reverse().find((i) => i.kind === "cycle");
21605
+ if (latest && latest.outcome === "running") setOpenCycle(latest);
21606
+ }, [task.id, taskMessages.length, chatItems]);
21607
+ const liveCycle = openCycle ? chatItems.find((i) => i.kind === "cycle" && i.sessionId === openCycle.sessionId) ?? openCycle : null;
21608
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21609
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
21610
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21611
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArrowLeft, { size: 13 }) }),
21612
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__chat-header-info", children: [
21613
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
21286
21614
  "Task #",
21287
21615
  task.id,
21288
21616
  ": ",
21289
21617
  task.title
21290
21618
  ] }),
21291
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
21292
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21619
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
21620
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21293
21621
  "span",
21294
21622
  {
21295
21623
  className: `agent-status-dot agent-status-dot--active ${isActiveLike ? "agent-status-dot--pulsing" : ""}`,
@@ -21300,24 +21628,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21300
21628
  ] })
21301
21629
  ] })
21302
21630
  ] }),
21303
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
21304
- task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21631
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
21632
+ task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21305
21633
  "button",
21306
21634
  {
21307
21635
  className: "confirm__btn confirm__btn--primary",
21308
21636
  onClick: () => onToggleStatus(task),
21309
21637
  title: isActiveLike ? "Pause this task (aborts the running agent)" : "Activate this task",
21310
21638
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21311
- children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21312
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Pause, { size: 12 }),
21639
+ children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
21640
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Pause, { size: 12 }),
21313
21641
  " Pause"
21314
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21315
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Play, { size: 12 }),
21642
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
21643
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Play, { size: 12 }),
21316
21644
  " Activate"
21317
21645
  ] })
21318
21646
  }
21319
21647
  ),
21320
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21648
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21321
21649
  "span",
21322
21650
  {
21323
21651
  className: "task-table__badge",
@@ -21327,8 +21655,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21327
21655
  )
21328
21656
  ] })
21329
21657
  ] }),
21330
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
21331
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21658
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
21659
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21332
21660
  "aside",
21333
21661
  {
21334
21662
  style: {
@@ -21341,19 +21669,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21341
21669
  background: "var(--vscode-sideBar-background, rgba(0,0,0,0.1))"
21342
21670
  },
21343
21671
  children: [
21344
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
21345
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
21346
- totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
21672
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
21673
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
21674
+ totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
21347
21675
  completedCount,
21348
21676
  "/",
21349
21677
  totalCount,
21350
21678
  " done"
21351
21679
  ] })
21352
21680
  ] }),
21353
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
21681
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
21354
21682
  const isDone = item.status === "done";
21355
21683
  const isInProgress = item.status === "in_progress";
21356
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21684
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21357
21685
  "label",
21358
21686
  {
21359
21687
  style: {
@@ -21370,7 +21698,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21370
21698
  },
21371
21699
  title: isInProgress ? "In progress" : isDone ? "Done" : "Pending",
21372
21700
  children: [
21373
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21701
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21374
21702
  "input",
21375
21703
  {
21376
21704
  type: "checkbox",
@@ -21379,7 +21707,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21379
21707
  style: { marginTop: "2px", cursor: "pointer", flexShrink: 0 }
21380
21708
  }
21381
21709
  ),
21382
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
21710
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
21383
21711
  ]
21384
21712
  },
21385
21713
  item.id
@@ -21388,36 +21716,32 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21388
21716
  ]
21389
21717
  }
21390
21718
  ),
21391
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
21392
- taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MessageList, { items: chatItems, sessionId: null, compact: true }),
21393
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("form", { className: "composer", onSubmit: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
21394
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21395
- "textarea",
21396
- {
21397
- className: "composer__input",
21398
- placeholder: "Provide feedback or ask the agent to resume...",
21399
- value: composerText,
21400
- onChange: (e) => onComposerChange(e.target.value),
21401
- onKeyDown: (e) => {
21402
- if (e.key === "Enter" && !e.shiftKey) {
21403
- e.preventDefault();
21404
- onSend(e);
21405
- }
21406
- },
21407
- style: { flex: 1, minHeight: "44px" }
21408
- }
21409
- ),
21410
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21411
- "button",
21412
- {
21413
- type: "submit",
21414
- className: "app__new-chat-btn",
21415
- disabled: !composerText.trim() || isSending,
21416
- style: { height: "40px", padding: "0 16px", display: "flex", alignItems: "center", justifyContent: "center" },
21417
- children: isSending ? "Sending..." : "Send"
21418
- }
21419
- )
21420
- ] }) })
21719
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
21720
+ liveCycle ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21721
+ TaskCycleView,
21722
+ {
21723
+ item: liveCycle,
21724
+ postMessage,
21725
+ onBack: () => setOpenCycle(null)
21726
+ },
21727
+ liveCycle.sessionId
21728
+ ) : taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageList, { items: chatItems, sessionId: null, compact: true, onOpenCycle: openCycleItem }),
21729
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21730
+ Composer,
21731
+ {
21732
+ disabled: isSending,
21733
+ canAbort: false,
21734
+ onAbort: () => {
21735
+ },
21736
+ onSend: async (text) => {
21737
+ if (!await onSend(text)) setDraft(text);
21738
+ },
21739
+ contextUsage: null,
21740
+ allowAttachments: false,
21741
+ value: draft,
21742
+ onValueChange: setDraft
21743
+ }
21744
+ )
21421
21745
  ] })
21422
21746
  ] })
21423
21747
  ] });
@@ -21439,12 +21763,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21439
21763
  statusColor
21440
21764
  }) {
21441
21765
  const isRunning = task.status === "active" || task.status === "reviewing" || task.status === "planning";
21442
- const [draftTitle, setDraftTitle] = (0, import_react18.useState)(task.title);
21443
- const [draftObjective, setDraftObjective] = (0, import_react18.useState)(task.objective);
21444
- const [lastTaskId, setLastTaskId] = (0, import_react18.useState)(task.id);
21766
+ const [draftTitle, setDraftTitle] = (0, import_react19.useState)(task.title);
21767
+ const [draftObjective, setDraftObjective] = (0, import_react19.useState)(task.objective);
21768
+ const [lastTaskId, setLastTaskId] = (0, import_react19.useState)(task.id);
21445
21769
  const trimmedTitle = draftTitle.trim();
21446
21770
  const isDirty = trimmedTitle !== task.title.trim() || draftObjective.trim() !== task.objective.trim();
21447
- (0, import_react18.useEffect)(() => {
21771
+ (0, import_react19.useEffect)(() => {
21448
21772
  if (task.id !== lastTaskId) {
21449
21773
  setDraftTitle(task.title);
21450
21774
  setDraftObjective(task.objective);
@@ -21459,16 +21783,16 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21459
21783
  setDraftTitle(task.title);
21460
21784
  setDraftObjective(task.objective);
21461
21785
  };
21462
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
21463
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
21464
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21465
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrowLeft, { size: 13 }) }),
21466
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
21467
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: { opacity: 0.6 }, children: [
21786
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
21787
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
21788
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21789
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArrowLeft, { size: 13 }) }),
21790
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
21791
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { opacity: 0.6 }, children: [
21468
21792
  "Task #",
21469
21793
  task.id
21470
21794
  ] }),
21471
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21795
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21472
21796
  "input",
21473
21797
  {
21474
21798
  value: draftTitle,
@@ -21489,7 +21813,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21489
21813
  }
21490
21814
  )
21491
21815
  ] }),
21492
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21816
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21493
21817
  "span",
21494
21818
  {
21495
21819
  className: "task-table__badge",
@@ -21498,8 +21822,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21498
21822
  }
21499
21823
  )
21500
21824
  ] }),
21501
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
21502
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21825
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
21826
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21503
21827
  "button",
21504
21828
  {
21505
21829
  className: "confirm__btn",
@@ -21509,7 +21833,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21509
21833
  children: "View Log"
21510
21834
  }
21511
21835
  ),
21512
- task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21836
+ task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21513
21837
  "button",
21514
21838
  {
21515
21839
  className: "confirm__btn",
@@ -21517,12 +21841,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21517
21841
  title: `Commit pending changes to ${task.branch} and remove the worktree`,
21518
21842
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21519
21843
  children: [
21520
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 12 }),
21844
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GitBranch, { size: 12 }),
21521
21845
  " Discard worktree"
21522
21846
  ]
21523
21847
  }
21524
21848
  ),
21525
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21849
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21526
21850
  "button",
21527
21851
  {
21528
21852
  className: "confirm__btn",
@@ -21530,28 +21854,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21530
21854
  title: task.archived ? "Unarchive this task" : "Archive this task (hides it from the list, excludes from scheduler)",
21531
21855
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21532
21856
  children: [
21533
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Archive, { size: 12 }),
21857
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Archive, { size: 12 }),
21534
21858
  " ",
21535
21859
  task.archived ? "Unarchive" : "Archive"
21536
21860
  ]
21537
21861
  }
21538
21862
  ),
21539
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21863
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21540
21864
  "button",
21541
21865
  {
21542
21866
  className: "confirm__btn confirm__btn--primary",
21543
21867
  onClick: () => onToggleStatus(task),
21544
21868
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21545
- children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21546
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Pause, { size: 12 }),
21869
+ children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
21870
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Pause, { size: 12 }),
21547
21871
  " Pause"
21548
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21549
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Play, { size: 12 }),
21872
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
21873
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Play, { size: 12 }),
21550
21874
  " Activate"
21551
21875
  ] })
21552
21876
  }
21553
21877
  ),
21554
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21878
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21555
21879
  "button",
21556
21880
  {
21557
21881
  className: "confirm__btn",
@@ -21559,22 +21883,22 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21559
21883
  title: "Permanently delete this task and all its messages",
21560
21884
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px", color: "#ef4444" },
21561
21885
  children: [
21562
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Trash2, { size: 12 }),
21886
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 }),
21563
21887
  " Delete"
21564
21888
  ]
21565
21889
  }
21566
21890
  )
21567
21891
  ] })
21568
21892
  ] }),
21569
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
21570
- task.branch && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
21571
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 12 }),
21572
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
21573
- !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
21893
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
21894
+ task.branch && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
21895
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GitBranch, { size: 12 }),
21896
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
21897
+ !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
21574
21898
  ] }),
21575
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21576
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
21577
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21899
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21900
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
21901
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21578
21902
  "textarea",
21579
21903
  {
21580
21904
  value: draftObjective,
@@ -21598,8 +21922,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21598
21922
  }
21599
21923
  }
21600
21924
  ),
21601
- isDirty && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
21602
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21925
+ isDirty && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
21926
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21603
21927
  "button",
21604
21928
  {
21605
21929
  className: "confirm__btn confirm__btn--primary",
@@ -21612,13 +21936,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21612
21936
  children: "Save"
21613
21937
  }
21614
21938
  ),
21615
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
21616
- isRunning && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
21939
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
21940
+ isRunning && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
21617
21941
  ] })
21618
21942
  ] }),
21619
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21620
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
21621
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21943
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21944
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
21945
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21622
21946
  "select",
21623
21947
  {
21624
21948
  value: task.agentId || "",
@@ -21638,8 +21962,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21638
21962
  },
21639
21963
  title: isRunning ? "Pause the task before changing its agent" : "Choose which agent runs this task",
21640
21964
  children: [
21641
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21642
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
21965
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
21966
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
21643
21967
  a.name,
21644
21968
  " (",
21645
21969
  a.provider,
@@ -21649,9 +21973,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21649
21973
  }
21650
21974
  )
21651
21975
  ] }),
21652
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21653
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
21654
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21976
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21977
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
21978
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21655
21979
  "select",
21656
21980
  {
21657
21981
  value: task.plannerAgentId || "",
@@ -21660,8 +21984,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21660
21984
  style: { background: "var(--vscode-input-background, #252526)", color: "var(--vscode-input-foreground)", border: "1px solid var(--vscode-input-border, #3c3c3c)", borderRadius: "4px", padding: "6px 8px", fontSize: "12px", outline: "none", width: "100%", cursor: isRunning ? "not-allowed" : "pointer", opacity: isRunning ? 0.6 : 1 },
21661
21985
  title: isRunning ? "Pause the task before changing its planner" : "Agent that runs the planning phase (read-only). Unset: falls back to the project planner, then the developer.",
21662
21986
  children: [
21663
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21664
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
21987
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
21988
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
21665
21989
  a.name,
21666
21990
  " (",
21667
21991
  a.provider,
@@ -21671,9 +21995,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21671
21995
  }
21672
21996
  )
21673
21997
  ] }),
21674
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21675
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
21676
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21998
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21999
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
22000
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21677
22001
  "select",
21678
22002
  {
21679
22003
  value: task.reviewerAgentId || "",
@@ -21682,8 +22006,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21682
22006
  style: { background: "var(--vscode-input-background, #252526)", color: "var(--vscode-input-foreground)", border: "1px solid var(--vscode-input-border, #3c3c3c)", borderRadius: "4px", padding: "6px 8px", fontSize: "12px", outline: "none", width: "100%", cursor: isRunning ? "not-allowed" : "pointer", opacity: isRunning ? 0.6 : 1 },
21683
22007
  title: isRunning ? "Pause the task before changing its reviewer" : "Agent that reviews the branch at DONE. Unset: falls back to the project reviewer, then the developer.",
21684
22008
  children: [
21685
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21686
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: a.id, children: [
22009
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Project default" }),
22010
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: a.id, children: [
21687
22011
  a.name,
21688
22012
  " (",
21689
22013
  a.provider,
@@ -21693,31 +22017,31 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21693
22017
  }
21694
22018
  )
21695
22019
  ] }),
21696
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21697
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
21698
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
22020
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginBottom: "16px" }, children: [
22021
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
22022
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
21699
22023
  { flag: "planningEnabled", label: "Planning phase", value: task.planningEnabled },
21700
22024
  { flag: "reviewEnabled", label: "Review at DONE", value: task.reviewEnabled },
21701
22025
  { flag: "sddEnabled", label: "SDD mode (.md specs)", value: task.sddEnabled }
21702
- ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
22026
+ ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
21703
22027
  label,
21704
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22028
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21705
22029
  "select",
21706
22030
  {
21707
22031
  value: value === true ? "on" : value === false ? "off" : "inherit",
21708
22032
  onChange: (e) => onSetFlag(task, flag, e.target.value === "inherit" ? null : e.target.value === "on"),
21709
22033
  style: { background: "var(--vscode-input-background, #252526)", color: "var(--vscode-input-foreground)", border: "1px solid var(--vscode-input-border, #3c3c3c)", borderRadius: "4px", padding: "6px 8px", fontSize: "12px", outline: "none" },
21710
22034
  children: [
21711
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "inherit", children: "Project default" }),
21712
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "on", children: "On" }),
21713
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "off", children: "Off" })
22035
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "inherit", children: "Project default" }),
22036
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "on", children: "On" }),
22037
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "off", children: "Off" })
21714
22038
  ]
21715
22039
  }
21716
22040
  )
21717
22041
  ] }, flag)) }),
21718
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
22042
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
21719
22043
  "Max run seconds per cycle",
21720
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
22044
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21721
22045
  "input",
21722
22046
  {
21723
22047
  type: "number",
@@ -21740,7 +22064,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21740
22064
  )
21741
22065
  ] })
21742
22066
  ] }),
21743
- task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22067
+ task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21744
22068
  "div",
21745
22069
  {
21746
22070
  style: {
@@ -21753,19 +22077,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21753
22077
  fontSize: "12px"
21754
22078
  },
21755
22079
  children: [
21756
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
21757
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TriangleAlert, { size: 13 }),
22080
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("strong", { children: [
22081
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TriangleAlert, { size: 13 }),
21758
22082
  " Blocked Reason:"
21759
22083
  ] }),
21760
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
22084
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
21761
22085
  ]
21762
22086
  }
21763
22087
  ),
21764
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
21765
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
21766
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
22088
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
22089
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
22090
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
21767
22091
  const isDone = item.status === "done";
21768
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22092
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21769
22093
  "label",
21770
22094
  {
21771
22095
  style: {
@@ -21782,7 +22106,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21782
22106
  opacity: isDone ? 0.6 : 1
21783
22107
  },
21784
22108
  children: [
21785
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
22109
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21786
22110
  "input",
21787
22111
  {
21788
22112
  type: "checkbox",
@@ -21791,7 +22115,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21791
22115
  style: { marginTop: "2px", cursor: "pointer" }
21792
22116
  }
21793
22117
  ),
21794
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: item.text })
22118
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: item.text })
21795
22119
  ]
21796
22120
  },
21797
22121
  item.id
@@ -21803,7 +22127,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21803
22127
  }
21804
22128
 
21805
22129
  // src/useVoice.ts
21806
- var import_react19 = __toESM(require_react(), 1);
22130
+ var import_react20 = __toESM(require_react(), 1);
21807
22131
  function canCapture() {
21808
22132
  return typeof window !== "undefined" && typeof MediaRecorder !== "undefined" && !!navigator.mediaDevices?.getUserMedia;
21809
22133
  }
@@ -21828,37 +22152,37 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21828
22152
  const { voice, chatStatus, pendingConfirmCount, items, onTranscript } = opts;
21829
22153
  const available = !!voice && voice.enabled && voice.configured && canCapture();
21830
22154
  const canSpeak = !!voice?.canSpeak;
21831
- const [phase, setPhase] = (0, import_react19.useState)("idle");
21832
- const [mode, setMode] = (0, import_react19.useState)("dictate");
21833
- const [error, setError] = (0, import_react19.useState)(null);
21834
- const phaseRef = (0, import_react19.useRef)(phase);
22155
+ const [phase, setPhase] = (0, import_react20.useState)("idle");
22156
+ const [mode, setMode] = (0, import_react20.useState)("dictate");
22157
+ const [error, setError] = (0, import_react20.useState)(null);
22158
+ const phaseRef = (0, import_react20.useRef)(phase);
21835
22159
  phaseRef.current = phase;
21836
- const modeRef = (0, import_react19.useRef)(mode);
22160
+ const modeRef = (0, import_react20.useRef)(mode);
21837
22161
  modeRef.current = mode;
21838
- const onTranscriptRef = (0, import_react19.useRef)(onTranscript);
22162
+ const onTranscriptRef = (0, import_react20.useRef)(onTranscript);
21839
22163
  onTranscriptRef.current = onTranscript;
21840
- const itemsRef = (0, import_react19.useRef)(items);
22164
+ const itemsRef = (0, import_react20.useRef)(items);
21841
22165
  itemsRef.current = items;
21842
- const chatStatusRef = (0, import_react19.useRef)(chatStatus);
22166
+ const chatStatusRef = (0, import_react20.useRef)(chatStatus);
21843
22167
  chatStatusRef.current = chatStatus;
21844
- const streamRef = (0, import_react19.useRef)(null);
21845
- const recorderRef = (0, import_react19.useRef)(null);
21846
- const chunksRef = (0, import_react19.useRef)([]);
21847
- const vadRef = (0, import_react19.useRef)(null);
21848
- const audioRef = (0, import_react19.useRef)(null);
21849
- const idleTimerRef = (0, import_react19.useRef)(null);
21850
- const heardSpeechRef = (0, import_react19.useRef)(false);
21851
- const sawStreamingRef = (0, import_react19.useRef)(false);
21852
- const cursorRef = (0, import_react19.useRef)(0);
21853
- const queueRef = (0, import_react19.useRef)([]);
21854
- const apply = (0, import_react19.useCallback)((event) => {
22168
+ const streamRef = (0, import_react20.useRef)(null);
22169
+ const recorderRef = (0, import_react20.useRef)(null);
22170
+ const chunksRef = (0, import_react20.useRef)([]);
22171
+ const vadRef = (0, import_react20.useRef)(null);
22172
+ const audioRef = (0, import_react20.useRef)(null);
22173
+ const idleTimerRef = (0, import_react20.useRef)(null);
22174
+ const heardSpeechRef = (0, import_react20.useRef)(false);
22175
+ const sawStreamingRef = (0, import_react20.useRef)(false);
22176
+ const cursorRef = (0, import_react20.useRef)(0);
22177
+ const queueRef = (0, import_react20.useRef)([]);
22178
+ const apply = (0, import_react20.useCallback)((event) => {
21855
22179
  setPhase((current) => nextPhase(current, event));
21856
22180
  }, []);
21857
22181
  const clearIdleTimer = () => {
21858
22182
  if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
21859
22183
  idleTimerRef.current = null;
21860
22184
  };
21861
- const teardownCapture = (0, import_react19.useCallback)(() => {
22185
+ const teardownCapture = (0, import_react20.useCallback)(() => {
21862
22186
  clearIdleTimer();
21863
22187
  try {
21864
22188
  vadRef.current?.destroy();
@@ -21875,14 +22199,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21875
22199
  chunksRef.current = [];
21876
22200
  heardSpeechRef.current = false;
21877
22201
  }, []);
21878
- const stopPlayback = (0, import_react19.useCallback)(() => {
22202
+ const stopPlayback = (0, import_react20.useCallback)(() => {
21879
22203
  if (audioRef.current) {
21880
22204
  audioRef.current.pause();
21881
22205
  audioRef.current.src = "";
21882
22206
  audioRef.current = null;
21883
22207
  }
21884
22208
  }, []);
21885
- const fail = (0, import_react19.useCallback)(
22209
+ const fail = (0, import_react20.useCallback)(
21886
22210
  (message) => {
21887
22211
  teardownCapture();
21888
22212
  stopPlayback();
@@ -21891,7 +22215,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21891
22215
  },
21892
22216
  [apply, teardownCapture, stopPlayback]
21893
22217
  );
21894
- const finishRecording = (0, import_react19.useCallback)(() => {
22218
+ const finishRecording = (0, import_react20.useCallback)(() => {
21895
22219
  const recorder = recorderRef.current;
21896
22220
  if (!recorder || recorder.state === "inactive") return;
21897
22221
  recorder.onstop = async () => {
@@ -21920,7 +22244,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21920
22244
  };
21921
22245
  recorder.stop();
21922
22246
  }, [apply, fail, teardownCapture]);
21923
- const startRecording = (0, import_react19.useCallback)(async () => {
22247
+ const startRecording = (0, import_react20.useCallback)(async () => {
21924
22248
  setError(null);
21925
22249
  chunksRef.current = [];
21926
22250
  heardSpeechRef.current = false;
@@ -21965,7 +22289,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21965
22289
  fail(`Microphone unavailable: ${err}`);
21966
22290
  }
21967
22291
  }, [apply, fail, finishRecording, teardownCapture]);
21968
- const speakReply = (0, import_react19.useCallback)(async () => {
22292
+ const speakReply = (0, import_react20.useCallback)(async () => {
21969
22293
  const text = queueRef.current.shift();
21970
22294
  if (!text) {
21971
22295
  apply({
@@ -22009,10 +22333,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22009
22333
  fail(`Synthesis failed: ${err}`);
22010
22334
  }
22011
22335
  }, [apply, fail]);
22012
- (0, import_react19.useEffect)(() => {
22336
+ (0, import_react20.useEffect)(() => {
22013
22337
  if (chatStatus === "streaming") sawStreamingRef.current = true;
22014
22338
  }, [chatStatus]);
22015
- (0, import_react19.useEffect)(() => {
22339
+ (0, import_react20.useEffect)(() => {
22016
22340
  if (modeRef.current !== "conversation") return;
22017
22341
  if (phaseRef.current === "idle") return;
22018
22342
  const { texts, cursor } = takeFinalizedBubbles(items, cursorRef.current);
@@ -22021,7 +22345,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22021
22345
  queueRef.current.push(...texts);
22022
22346
  apply({ kind: "speechQueued", mode: "conversation", canSpeak });
22023
22347
  }, [items, canSpeak, apply]);
22024
- (0, import_react19.useEffect)(() => {
22348
+ (0, import_react20.useEffect)(() => {
22025
22349
  if (phase !== "awaiting") return;
22026
22350
  if (chatStatus === "error") {
22027
22351
  apply({ kind: "failed", mode: "conversation" });
@@ -22043,8 +22367,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22043
22367
  pendingSpeech: queueRef.current.length
22044
22368
  });
22045
22369
  }, [phase, chatStatus, pendingConfirmCount, canSpeak, apply]);
22046
- const prevPhase = (0, import_react19.useRef)("idle");
22047
- (0, import_react19.useEffect)(() => {
22370
+ const prevPhase = (0, import_react20.useRef)("idle");
22371
+ (0, import_react20.useEffect)(() => {
22048
22372
  const from = prevPhase.current;
22049
22373
  prevPhase.current = phase;
22050
22374
  if (from === phase) return;
@@ -22056,14 +22380,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22056
22380
  queueRef.current = [];
22057
22381
  }
22058
22382
  }, [phase, startRecording, speakReply, teardownCapture, stopPlayback]);
22059
- (0, import_react19.useEffect)(
22383
+ (0, import_react20.useEffect)(
22060
22384
  () => () => {
22061
22385
  teardownCapture();
22062
22386
  stopPlayback();
22063
22387
  },
22064
22388
  [teardownCapture, stopPlayback]
22065
22389
  );
22066
- const toggle = (0, import_react19.useCallback)(() => {
22390
+ const toggle = (0, import_react20.useCallback)(() => {
22067
22391
  if (!available) return;
22068
22392
  const current = phaseRef.current;
22069
22393
  if (current === "idle") {
@@ -22077,7 +22401,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22077
22401
  }
22078
22402
  apply({ kind: "userStop", mode: modeRef.current });
22079
22403
  }, [available, apply, finishRecording]);
22080
- const changeMode = (0, import_react19.useCallback)(
22404
+ const changeMode = (0, import_react20.useCallback)(
22081
22405
  (next) => {
22082
22406
  apply({ kind: "userStop", mode: modeRef.current });
22083
22407
  setMode(next);
@@ -22088,199 +22412,34 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22088
22412
  }
22089
22413
 
22090
22414
  // src/App.tsx
22091
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
22092
- function closeStreamingAssistant2(items) {
22093
- const last = items[items.length - 1];
22094
- if (!last || last.kind !== "assistant" || !last.streaming) return items;
22095
- return [...items.slice(0, -1), { ...last, streaming: false }];
22096
- }
22097
- function reconstructChatItems2(messages) {
22098
- let items = [];
22099
- for (const msg of messages) {
22100
- if (msg.role === "user") {
22101
- items = closeStreamingAssistant2(items);
22102
- items.push({ kind: "user", text: msg.content, attachments: msg.attachments });
22103
- } else if (msg.role === "assistant") {
22104
- items = closeStreamingAssistant2(items);
22105
- if (msg.parts && msg.parts.length > 0) {
22106
- for (const part of msg.parts) {
22107
- if (part.type === "text") {
22108
- items.push({ kind: "assistant", text: part.text, streaming: false });
22109
- } else if (part.type === "thinking" && part.text.trim().length > 0) {
22110
- items.push({ kind: "thinking", text: part.text });
22111
- } else if (part.type === "tool_use") {
22112
- items.push({
22113
- kind: "tool",
22114
- id: part.id,
22115
- name: part.name,
22116
- args: part.args,
22117
- result: null
22118
- });
22119
- }
22120
- }
22121
- } else {
22122
- items.push({ kind: "assistant", text: msg.content, streaming: false });
22123
- }
22124
- } else if (msg.role === "tool") {
22125
- const toolCallId = msg.toolCallId;
22126
- if (toolCallId) {
22127
- const idx = items.findIndex(
22128
- (it) => it.kind === "tool" && it.id === toolCallId && it.result === null
22129
- );
22130
- if (idx !== -1) {
22131
- const toolItem = items[idx];
22132
- items[idx] = { ...toolItem, result: msg.content };
22133
- } else {
22134
- items.push({
22135
- kind: "tool",
22136
- id: toolCallId,
22137
- name: "unknown_tool",
22138
- args: {},
22139
- result: msg.content
22140
- });
22141
- }
22142
- }
22143
- }
22144
- }
22145
- return closeStreamingAssistant2(items);
22146
- }
22147
- function reducer(state, action) {
22148
- switch (action.kind) {
22149
- case "send-user":
22150
- return {
22151
- ...state,
22152
- status: "streaming",
22153
- errorText: null,
22154
- items: [...state.items, { kind: "user", text: action.text, attachments: action.attachments }]
22155
- };
22156
- case "append-chunk": {
22157
- const last = state.items[state.items.length - 1];
22158
- if (last && last.kind === "assistant" && last.streaming) {
22159
- const updated = { ...last, text: last.text + action.text };
22160
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22161
- }
22162
- return {
22163
- ...state,
22164
- items: [...state.items, { kind: "assistant", text: action.text, streaming: true }]
22165
- };
22166
- }
22167
- case "append-thinking": {
22168
- const last = state.items[state.items.length - 1];
22169
- if (last && last.kind === "thinking") {
22170
- const updated = { ...last, text: last.text + action.text };
22171
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22172
- }
22173
- return {
22174
- ...state,
22175
- items: [...state.items, { kind: "thinking", text: action.text }]
22176
- };
22177
- }
22178
- case "tool-call":
22179
- return {
22180
- ...state,
22181
- items: [
22182
- ...closeStreamingAssistant2(state.items),
22183
- { kind: "tool", id: action.id, name: action.name, args: action.args, result: null }
22184
- ]
22185
- };
22186
- case "tool-result": {
22187
- const idx = state.items.findIndex(
22188
- (it) => it.kind === "tool" && it.id === action.id && it.result === null
22189
- );
22190
- if (idx < 0) return state;
22191
- const tool = state.items[idx];
22192
- const updated = { ...tool, result: action.content };
22193
- return {
22194
- ...state,
22195
- items: [...state.items.slice(0, idx), updated, ...state.items.slice(idx + 1)]
22196
- };
22197
- }
22198
- case "permission-request":
22199
- return {
22200
- ...state,
22201
- pendingConfirms: [
22202
- ...state.pendingConfirms,
22203
- { id: action.id, toolName: action.toolName, args: action.args }
22204
- ]
22205
- };
22206
- case "permission-resolved":
22207
- return {
22208
- ...state,
22209
- pendingConfirms: state.pendingConfirms.filter((p) => p.id !== action.id)
22210
- };
22211
- case "done":
22212
- return {
22213
- ...state,
22214
- status: "idle",
22215
- pendingConfirms: [],
22216
- items: closeStreamingAssistant2(state.items)
22217
- };
22218
- case "clear":
22219
- return {
22220
- ...state,
22221
- items: [],
22222
- status: "idle",
22223
- errorText: null,
22224
- pendingConfirms: [],
22225
- contextUsage: null
22226
- };
22227
- case "error":
22228
- return {
22229
- ...state,
22230
- status: "error",
22231
- errorText: action.text,
22232
- pendingConfirms: [],
22233
- items: closeStreamingAssistant2(state.items)
22234
- };
22235
- case "load-history": {
22236
- const historyItems = reconstructChatItems2(action.messages);
22237
- return {
22238
- ...state,
22239
- items: historyItems,
22240
- status: "idle",
22241
- errorText: null,
22242
- pendingConfirms: []
22243
- };
22244
- }
22245
- case "context-usage":
22246
- return {
22247
- ...state,
22248
- contextUsage: action.usage
22249
- };
22250
- }
22251
- }
22415
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
22252
22416
  function App({ postMessage, layout = "compact" }) {
22253
- const [chatState, dispatch] = (0, import_react20.useReducer)(reducer, {
22254
- items: [],
22255
- status: "idle",
22256
- errorText: null,
22257
- pendingConfirms: [],
22258
- contextUsage: null
22259
- });
22260
- const [agents, setAgents] = (0, import_react20.useState)([]);
22261
- const [sessions, setSessions] = (0, import_react20.useState)([]);
22262
- const [selectedAgentId, setSelectedAgentId] = (0, import_react20.useState)(null);
22263
- const [selectedSessionId, setSelectedSessionId] = (0, import_react20.useState)(null);
22264
- const [showSessions, setShowSessions] = (0, import_react20.useState)(false);
22265
- const [showAllAgents, setShowAllAgents] = (0, import_react20.useState)(false);
22266
- const [pendingDelete, setPendingDelete] = (0, import_react20.useState)(null);
22267
- const [activeScreen, setActiveScreen] = (0, import_react20.useState)("chat");
22268
- const [settingsData, setSettingsData] = (0, import_react20.useState)(null);
22269
- const [modelsResult, setModelsResult] = (0, import_react20.useState)(null);
22270
- const [acpRegistry, setAcpRegistry] = (0, import_react20.useState)(null);
22271
- const [acpInstall, setAcpInstall] = (0, import_react20.useState)(null);
22272
- const [refreshingSourceId, setRefreshingSourceId] = (0, import_react20.useState)(null);
22273
- const [refreshOutcome, setRefreshOutcome] = (0, import_react20.useState)(null);
22274
- const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react20.useState)(null);
22275
- const [taskRuns, setTaskRuns] = (0, import_react20.useState)({});
22276
- const [voiceConfig, setVoiceConfig] = (0, import_react20.useState)(null);
22277
- const [sttCatalogResult, setSttCatalogResult] = (0, import_react20.useState)(null);
22278
- const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react20.useState)(null);
22279
- const [composerDraft, setComposerDraft] = (0, import_react20.useState)("");
22280
- (0, import_react20.useEffect)(() => {
22417
+ const [chatState, dispatch] = (0, import_react21.useReducer)(chatReducer, initialChatState);
22418
+ const [agents, setAgents] = (0, import_react21.useState)([]);
22419
+ const [sessions, setSessions] = (0, import_react21.useState)([]);
22420
+ const [selectedAgentId, setSelectedAgentId] = (0, import_react21.useState)(null);
22421
+ const [selectedSessionId, setSelectedSessionId] = (0, import_react21.useState)(null);
22422
+ const [showSessions, setShowSessions] = (0, import_react21.useState)(false);
22423
+ const [showAllAgents, setShowAllAgents] = (0, import_react21.useState)(false);
22424
+ const [pendingDelete, setPendingDelete] = (0, import_react21.useState)(null);
22425
+ const [activeScreen, setActiveScreen] = (0, import_react21.useState)("chat");
22426
+ const [settingsTab, setSettingsTab] = (0, import_react21.useState)();
22427
+ const [settingsData, setSettingsData] = (0, import_react21.useState)(null);
22428
+ const [modelsResult, setModelsResult] = (0, import_react21.useState)(null);
22429
+ const [acpRegistry, setAcpRegistry] = (0, import_react21.useState)(null);
22430
+ const [acpInstall, setAcpInstall] = (0, import_react21.useState)(null);
22431
+ const [refreshingSourceId, setRefreshingSourceId] = (0, import_react21.useState)(null);
22432
+ const [refreshOutcome, setRefreshOutcome] = (0, import_react21.useState)(null);
22433
+ const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react21.useState)(null);
22434
+ const [taskRuns, setTaskRuns] = (0, import_react21.useState)({});
22435
+ const [voiceConfig, setVoiceConfig] = (0, import_react21.useState)(null);
22436
+ const [sttCatalogResult, setSttCatalogResult] = (0, import_react21.useState)(null);
22437
+ const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react21.useState)(null);
22438
+ const [composerDraft, setComposerDraft] = (0, import_react21.useState)("");
22439
+ (0, import_react21.useEffect)(() => {
22281
22440
  postMessage({ type: "webviewReady" });
22282
22441
  }, []);
22283
- (0, import_react20.useEffect)(() => {
22442
+ (0, import_react21.useEffect)(() => {
22284
22443
  function handle(event) {
22285
22444
  const msg = event.data;
22286
22445
  if (!msg || typeof msg !== "object" || !("type" in msg)) return;
@@ -22403,15 +22562,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22403
22562
  if (voice2) msg.voice = true;
22404
22563
  postMessage(msg);
22405
22564
  };
22406
- const onConfirm = (0, import_react20.useCallback)((id, decision) => {
22565
+ const onConfirm = (0, import_react21.useCallback)((id, decision) => {
22407
22566
  dispatch({ kind: "permission-resolved", id });
22408
22567
  postMessage({ type: "permission_response", id, decision });
22409
22568
  }, [postMessage]);
22410
22569
  const onAbort = () => {
22411
22570
  postMessage({ type: "abort" });
22412
22571
  };
22413
- const confirmCards = (0, import_react20.useMemo)(
22414
- () => chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id)),
22572
+ const confirmCards = (0, import_react21.useMemo)(
22573
+ () => chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id)),
22415
22574
  [chatState.pendingConfirms, onConfirm]
22416
22575
  );
22417
22576
  const onSelectAgent = (agentId) => {
@@ -22451,7 +22610,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22451
22610
  const cancelDeleteSession = () => {
22452
22611
  setPendingDelete(null);
22453
22612
  };
22454
- (0, import_react20.useEffect)(() => {
22613
+ (0, import_react21.useEffect)(() => {
22455
22614
  if (!pendingDelete) return;
22456
22615
  function handleKeyDown(event) {
22457
22616
  if (event.key === "Escape") {
@@ -22466,7 +22625,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22466
22625
  setShowSessions(!showSessions);
22467
22626
  }
22468
22627
  };
22469
- (0, import_react20.useEffect)(() => {
22628
+ (0, import_react21.useEffect)(() => {
22470
22629
  function handleClickOutside(event) {
22471
22630
  const target = event.target;
22472
22631
  if (showSessions && !target.closest(".app__sessions-dropdown")) {
@@ -22479,45 +22638,46 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22479
22638
  const composerDisabled = chatState.status === "streaming" || chatState.pendingConfirms.length > 0 || !selectedAgentId;
22480
22639
  const selectedAgentName = agents.find((a) => a.id === selectedAgentId)?.name;
22481
22640
  const activeAgent = agents.find((a) => a.id === selectedAgentId);
22641
+ const openScreen = (screen, tab) => {
22642
+ setActiveScreen(screen);
22643
+ setSettingsTab(tab);
22644
+ if (screen === "settings") postMessage({ type: "getSettingsData" });
22645
+ };
22646
+ const navItems = [
22647
+ { id: "chat", label: "Chat", Icon: MessageSquare },
22648
+ { id: "projects", label: "Projects", Icon: FolderKanban },
22649
+ { id: "settings", label: "Settings", Icon: Settings }
22650
+ ];
22651
+ const navRail = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("nav", { className: "app__nav", children: [
22652
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo app__nav-logo" }),
22653
+ navItems.map(({ id, label, Icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22654
+ "button",
22655
+ {
22656
+ className: `app__nav-btn ${activeScreen === id ? "app__nav-btn--active" : ""}`,
22657
+ onClick: () => openScreen(id),
22658
+ title: label,
22659
+ children: [
22660
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon2, { size: 18 }),
22661
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: label })
22662
+ ]
22663
+ },
22664
+ id
22665
+ ))
22666
+ ] });
22482
22667
  if (activeScreen === "projects" && layout === "sidebar") {
22483
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app", style: { height: "100%" }, children: [
22484
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__header-row", children: [
22485
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__logo-title-wrapper", onClick: () => setActiveScreen("chat"), style: { cursor: "pointer" }, children: [
22486
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22487
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Caretaker" })
22488
- ] }),
22489
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__controls", children: [
22490
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("button", { className: "app__sessions-btn", onClick: () => setActiveScreen("chat"), children: [
22491
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }),
22492
- " Chat"
22493
- ] }),
22494
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22495
- "button",
22496
- {
22497
- className: "app__settings-btn",
22498
- onClick: () => {
22499
- setActiveScreen("settings");
22500
- postMessage({ type: "getSettingsData" });
22501
- },
22502
- title: "Caretaker Settings",
22503
- children: [
22504
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Settings, { size: 13 }),
22505
- " Settings"
22506
- ]
22507
- }
22508
- )
22509
- ] })
22510
- ] }) }),
22511
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ProjectsTab, { agents }) })
22668
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app app--with-sidebar", children: [
22669
+ navRail,
22670
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__screen", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ProjectsTab, { agents, onOpenSettings: () => openScreen("settings", "projects"), postMessage }) })
22512
22671
  ] });
22513
22672
  }
22514
22673
  if (activeScreen === "settings") {
22515
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22674
+ const panel = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered app__screen" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22516
22675
  SettingsPanel,
22517
22676
  {
22518
22677
  layout,
22519
22678
  postMessage,
22520
22679
  settingsData,
22680
+ initialTab: settingsTab,
22521
22681
  modelsResult,
22522
22682
  acpRegistry,
22523
22683
  acpInstall,
@@ -22534,144 +22694,112 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22534
22694
  onClose: () => setActiveScreen("chat")
22535
22695
  }
22536
22696
  ) });
22697
+ return layout === "sidebar" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app app--with-sidebar", children: [
22698
+ navRail,
22699
+ panel
22700
+ ] }) : panel;
22537
22701
  }
22538
- const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
22539
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
22540
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "app__confirm-message", children: [
22702
+ const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
22703
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
22704
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "app__confirm-message", children: [
22541
22705
  "Delete conversation \u201C",
22542
22706
  pendingDelete.title,
22543
22707
  "\u201D? This cannot be undone."
22544
22708
  ] }),
22545
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__confirm-buttons", children: [
22546
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
22547
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
22709
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__confirm-buttons", children: [
22710
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
22711
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
22548
22712
  ] })
22549
22713
  ] }) });
22550
22714
  if (layout === "sidebar") {
22551
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app app--with-sidebar", children: [
22552
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("aside", { className: "app__sidebar", children: [
22553
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__logo-title-wrapper", children: [
22554
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22555
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Caretaker" })
22556
- ] }) }),
22557
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-content", children: [
22558
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section", children: [
22559
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
22560
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22715
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app app--with-sidebar", children: [
22716
+ navRail,
22717
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("aside", { className: "app__sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sidebar-content", children: [
22718
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sidebar-section", children: [
22719
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
22720
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22721
+ "button",
22722
+ {
22723
+ className: "app__sidebar-agent-item app__sidebar-agent-item--collapsed-active",
22724
+ onClick: () => setShowAllAgents(true),
22725
+ title: "Switch Agent",
22726
+ children: [
22727
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
22728
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
22729
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
22730
+ ]
22731
+ }
22732
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
22733
+ const isSelected = selectedAgentId === agent.id;
22734
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22561
22735
  "button",
22562
22736
  {
22563
- className: "app__sidebar-agent-item app__sidebar-agent-item--collapsed-active",
22564
- onClick: () => setShowAllAgents(true),
22565
- title: "Switch Agent",
22566
- children: [
22567
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
22568
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
22569
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
22570
- ]
22571
- }
22572
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
22573
- const isSelected = selectedAgentId === agent.id;
22574
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22575
- "button",
22576
- {
22577
- className: `app__sidebar-agent-item ${isSelected ? "app__sidebar-agent-item--active" : ""}`,
22578
- onClick: () => {
22579
- if (isSelected) {
22580
- setShowAllAgents(false);
22581
- } else {
22582
- onSelectAgent(agent.id);
22583
- }
22584
- },
22585
- children: [
22586
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
22587
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
22588
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
22589
- ]
22737
+ className: `app__sidebar-agent-item ${isSelected ? "app__sidebar-agent-item--active" : ""}`,
22738
+ onClick: () => {
22739
+ if (isSelected) {
22740
+ setShowAllAgents(false);
22741
+ } else {
22742
+ onSelectAgent(agent.id);
22743
+ }
22590
22744
  },
22591
- agent.id
22592
- );
22593
- }) }) })
22594
- ] }),
22595
- selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section", children: [
22596
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section-header", children: [
22597
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
22598
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22599
- "button",
22600
- {
22601
- className: "app__sidebar-new-chat-btn",
22602
- onClick: onCreateSession,
22603
- title: "New Chat",
22604
- children: "+ New"
22605
- }
22606
- )
22607
- ] }),
22608
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22609
- "div",
22610
- {
22611
- className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
22612
- onClick: () => onSelectSession(session.id),
22613
22745
  children: [
22614
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }) }),
22615
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
22616
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22617
- "button",
22618
- {
22619
- className: "app__sidebar-session-delete",
22620
- title: "Delete conversation",
22621
- onClick: (e) => {
22622
- e.stopPropagation();
22623
- onDeleteSession(session.id, session.title);
22624
- },
22625
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 })
22626
- }
22627
- )
22746
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
22747
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
22748
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
22628
22749
  ]
22629
22750
  },
22630
- session.id
22631
- )) })
22632
- ] })
22751
+ agent.id
22752
+ );
22753
+ }) }) })
22633
22754
  ] }),
22634
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-footer", style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
22635
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22636
- "button",
22637
- {
22638
- className: "app__sidebar-settings-btn",
22639
- onClick: () => {
22640
- setActiveScreen("projects");
22641
- },
22642
- title: "Projects & Autonomous Tasks",
22643
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
22644
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FolderKanban, { size: 13 }),
22645
- " Projects"
22646
- ] })
22647
- }
22648
- ),
22649
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22650
- "button",
22755
+ selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sidebar-section", children: [
22756
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sidebar-section-header", children: [
22757
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
22758
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22759
+ "button",
22760
+ {
22761
+ className: "app__sidebar-new-chat-btn",
22762
+ onClick: onCreateSession,
22763
+ title: "New Chat",
22764
+ children: "+ New"
22765
+ }
22766
+ )
22767
+ ] }),
22768
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22769
+ "div",
22651
22770
  {
22652
- className: "app__sidebar-settings-btn",
22653
- onClick: () => {
22654
- setActiveScreen("settings");
22655
- postMessage({ type: "getSettingsData" });
22656
- },
22657
- title: "Caretaker Settings",
22771
+ className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
22772
+ onClick: () => onSelectSession(session.id),
22658
22773
  children: [
22659
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Settings, { className: "app__settings-icon", size: 14 }),
22660
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Settings" })
22774
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MessageSquare, { size: 13 }) }),
22775
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
22776
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22777
+ "button",
22778
+ {
22779
+ className: "app__sidebar-session-delete",
22780
+ title: "Delete conversation",
22781
+ onClick: (e) => {
22782
+ e.stopPropagation();
22783
+ onDeleteSession(session.id, session.title);
22784
+ },
22785
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Trash2, { size: 12 })
22786
+ }
22787
+ )
22661
22788
  ]
22662
- }
22663
- )
22789
+ },
22790
+ session.id
22791
+ )) })
22664
22792
  ] })
22665
- ] }),
22666
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
22667
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__chat-header-info", children: [
22668
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
22669
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "app__chat-header-status", children: [
22670
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
22793
+ ] }) }),
22794
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
22795
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__chat-header-info", children: [
22796
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
22797
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "app__chat-header-status", children: [
22798
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
22671
22799
  chatState.status === "streaming" ? "Streaming response..." : "Ready"
22672
22800
  ] })
22673
22801
  ] }) }),
22674
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22802
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22675
22803
  MessageList,
22676
22804
  {
22677
22805
  items: chatState.items,
@@ -22681,12 +22809,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22681
22809
  trailing: confirmCards
22682
22810
  }
22683
22811
  ),
22684
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__error", children: [
22685
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TriangleAlert, { size: 14 }),
22812
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__error", children: [
22813
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TriangleAlert, { size: 14 }),
22686
22814
  " ",
22687
22815
  chatState.errorText || voice.error
22688
22816
  ] }),
22689
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22817
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22690
22818
  Composer,
22691
22819
  {
22692
22820
  disabled: composerDisabled,
@@ -22705,30 +22833,30 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22705
22833
  onValueChange: setComposerDraft
22706
22834
  }
22707
22835
  )
22708
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
22836
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
22709
22837
  deleteOverlay
22710
22838
  ] });
22711
22839
  }
22712
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app", children: [
22713
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__header-row", children: [
22714
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__logo-title-wrapper", children: [
22715
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22716
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Caretaker" })
22840
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app", children: [
22841
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__header-row", children: [
22842
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__logo-title-wrapper", children: [
22843
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22844
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Caretaker" })
22717
22845
  ] }),
22718
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__controls", children: [
22719
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22846
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__controls", children: [
22847
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22720
22848
  "select",
22721
22849
  {
22722
22850
  className: "app__agent-select",
22723
22851
  value: selectedAgentId ?? "",
22724
22852
  onChange: (e) => onSelectAgent(e.target.value),
22725
22853
  children: [
22726
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
22727
- agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
22854
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
22855
+ agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
22728
22856
  ]
22729
22857
  }
22730
22858
  ) }),
22731
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22859
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22732
22860
  "button",
22733
22861
  {
22734
22862
  className: "app__sessions-btn",
@@ -22736,13 +22864,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22736
22864
  disabled: !selectedAgentId,
22737
22865
  title: "View conversations",
22738
22866
  children: [
22739
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }),
22867
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MessageSquare, { size: 13 }),
22740
22868
  " ",
22741
22869
  sessions.length
22742
22870
  ]
22743
22871
  }
22744
22872
  ),
22745
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22873
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22746
22874
  "button",
22747
22875
  {
22748
22876
  className: "app__new-chat-btn",
@@ -22752,7 +22880,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22752
22880
  children: "+ New"
22753
22881
  }
22754
22882
  ),
22755
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22883
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22756
22884
  "button",
22757
22885
  {
22758
22886
  className: "app__settings-btn",
@@ -22761,24 +22889,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22761
22889
  postMessage({ type: "getSettingsData" });
22762
22890
  },
22763
22891
  title: "Caretaker Settings",
22764
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Settings, { className: "app__settings-icon", size: 14 })
22892
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Settings, { className: "app__settings-icon", size: 14 })
22765
22893
  }
22766
22894
  )
22767
22895
  ] })
22768
22896
  ] }) }),
22769
- showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sessions-dropdown", children: [
22770
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sessions-title", children: [
22897
+ showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sessions-dropdown", children: [
22898
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sessions-title", children: [
22771
22899
  "Conversations for ",
22772
22900
  selectedAgentName
22773
22901
  ] }),
22774
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22902
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22775
22903
  "div",
22776
22904
  {
22777
22905
  className: `app__session-item ${selectedSessionId === session.id ? "app__session-item--active" : ""}`,
22778
22906
  onClick: () => onSelectSession(session.id),
22779
22907
  children: [
22780
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__session-item-title", children: session.title }),
22781
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22908
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "app__session-item-title", children: session.title }),
22909
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22782
22910
  "button",
22783
22911
  {
22784
22912
  className: "app__session-item-delete",
@@ -22787,7 +22915,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22787
22915
  e.stopPropagation();
22788
22916
  onDeleteSession(session.id, session.title);
22789
22917
  },
22790
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 })
22918
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Trash2, { size: 12 })
22791
22919
  }
22792
22920
  )
22793
22921
  ]
@@ -22795,12 +22923,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22795
22923
  session.id
22796
22924
  )) })
22797
22925
  ] }),
22798
- showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
22799
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
22800
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
22926
+ showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
22927
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
22928
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
22801
22929
  ] }),
22802
- !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: "Select an agent to start chatting" }) }),
22803
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22930
+ !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: "Select an agent to start chatting" }) }),
22931
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22804
22932
  MessageList,
22805
22933
  {
22806
22934
  items: chatState.items,
@@ -22810,12 +22938,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22810
22938
  trailing: confirmCards
22811
22939
  }
22812
22940
  ),
22813
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__error", children: [
22814
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TriangleAlert, { size: 14 }),
22941
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app__error", children: [
22942
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TriangleAlert, { size: 14 }),
22815
22943
  " ",
22816
22944
  chatState.errorText || voice.error
22817
22945
  ] }),
22818
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22946
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22819
22947
  Composer,
22820
22948
  {
22821
22949
  disabled: composerDisabled,
@@ -22839,12 +22967,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22839
22967
  }
22840
22968
 
22841
22969
  // src/standalone.tsx
22842
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
22970
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
22843
22971
  function StandaloneApp() {
22844
- const [ws, setWs] = (0, import_react21.useState)(null);
22845
- const [connected, setConnected] = (0, import_react21.useState)(false);
22846
- const [error, setError] = (0, import_react21.useState)(null);
22847
- (0, import_react21.useEffect)(() => {
22972
+ const [ws, setWs] = (0, import_react22.useState)(null);
22973
+ const [connected, setConnected] = (0, import_react22.useState)(false);
22974
+ const [error, setError] = (0, import_react22.useState)(null);
22975
+ (0, import_react22.useEffect)(() => {
22848
22976
  let active = true;
22849
22977
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
22850
22978
  const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws`);
@@ -22890,7 +23018,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22890
23018
  }
22891
23019
  };
22892
23020
  if (error) {
22893
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: {
23021
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: {
22894
23022
  display: "flex",
22895
23023
  flexDirection: "column",
22896
23024
  alignItems: "center",
@@ -22902,9 +23030,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22902
23030
  padding: "20px",
22903
23031
  textAlign: "center"
22904
23032
  }, children: [
22905
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
22906
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: error }),
22907
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
23033
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
23034
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { children: error }),
23035
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
22908
23036
  "button",
22909
23037
  {
22910
23038
  onClick: () => setWs(null),
@@ -22923,7 +23051,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22923
23051
  ] });
22924
23052
  }
22925
23053
  if (!connected) {
22926
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: {
23054
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: {
22927
23055
  display: "flex",
22928
23056
  flexDirection: "column",
22929
23057
  alignItems: "center",
@@ -22933,7 +23061,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22933
23061
  background: "#1e1e1e",
22934
23062
  color: "#f1f1f1"
22935
23063
  }, children: [
22936
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: {
23064
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: {
22937
23065
  border: "4px solid rgba(255,255,255,0.1)",
22938
23066
  width: "36px",
22939
23067
  height: "36px",
@@ -22942,8 +23070,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22942
23070
  animation: "spin 1s linear infinite",
22943
23071
  marginBottom: "16px"
22944
23072
  } }),
22945
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Connecting to Caretaker server..." }),
22946
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("style", { children: `
23073
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Connecting to Caretaker server..." }),
23074
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("style", { children: `
22947
23075
  @keyframes spin {
22948
23076
  0% { transform: rotate(0deg); }
22949
23077
  100% { transform: rotate(360deg); }
@@ -22951,12 +23079,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22951
23079
  ` })
22952
23080
  ] });
22953
23081
  }
22954
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(App, { postMessage, layout: "sidebar" });
23082
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(App, { postMessage, layout: "sidebar" });
22955
23083
  }
22956
23084
  var rootEl = document.getElementById("root");
22957
23085
  if (!rootEl) throw new Error("#root not found");
22958
23086
  (0, import_client.createRoot)(rootEl).render(
22959
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react21.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StandaloneApp, {}) })
23087
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react22.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StandaloneApp, {}) })
22960
23088
  );
22961
23089
  })();
22962
23090
  /*! Bundled license information: