@hyperwindmill/caretaker-cli 0.25.1 → 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 (35) 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/memory_recall.d.ts.map +1 -1
  17. package/dist/harness/memory_recall.js +5 -0
  18. package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
  19. package/dist/harness/tools/builtin/task_tools.js +2 -1
  20. package/dist/session/store.d.ts +4 -0
  21. package/dist/session/store.d.ts.map +1 -1
  22. package/dist/session/store.js +6 -0
  23. package/dist/session/types.d.ts +8 -0
  24. package/dist/session/types.d.ts.map +1 -1
  25. package/dist/store/db.d.ts +13 -1
  26. package/dist/store/db.d.ts.map +1 -1
  27. package/dist/store/db.js +23 -0
  28. package/dist/store/json.d.ts +10 -0
  29. package/dist/store/json.d.ts.map +1 -1
  30. package/dist/store/json.js +9 -0
  31. package/dist/webview/standalone.css +80 -25
  32. package/dist/webview/standalone.css.map +2 -2
  33. package/dist/webview/standalone.js +983 -850
  34. package/dist/webview/standalone.js.map +4 -4
  35. 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",
@@ -20091,9 +20220,10 @@ ${text}</tr>
20091
20220
  mcpAuthOutcome,
20092
20221
  setMcpAuthOutcome,
20093
20222
  taskRuns = {},
20094
- onClose
20223
+ onClose,
20224
+ initialTab = "providers"
20095
20225
  }) {
20096
- const [activeTab, setActiveTab] = (0, import_react17.useState)("providers");
20226
+ const [activeTab, setActiveTab] = (0, import_react17.useState)(initialTab);
20097
20227
  if (!settingsData) {
20098
20228
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
20099
20229
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
@@ -20199,7 +20329,7 @@ ${text}</tr>
20199
20329
  };
20200
20330
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "settings-panel", children: [
20201
20331
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: "settings-panel__header", children: [
20202
- /* @__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: [
20203
20333
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrowLeft, { size: 14 }),
20204
20334
  " Chat"
20205
20335
  ] }),
@@ -20276,146 +20406,331 @@ ${text}</tr>
20276
20406
  }
20277
20407
 
20278
20408
  // src/ProjectsTab.tsx
20409
+ var import_react19 = __toESM(require_react(), 1);
20410
+
20411
+ // src/TaskCycleView.tsx
20279
20412
  var import_react18 = __toESM(require_react(), 1);
20280
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
20281
- var LS_PROJECT_KEY = "caretaker.taskView.selectedProjectId";
20282
- var LS_ARCHIVED_KEY = "caretaker.taskView.showArchived";
20283
- function loadSavedProjectId() {
20284
- try {
20285
- const raw = localStorage.getItem(LS_PROJECT_KEY);
20286
- return raw && raw.trim() ? raw.trim() : null;
20287
- } catch {
20288
- return null;
20289
- }
20290
- }
20291
- function saveProjectId(id) {
20292
- try {
20293
- if (id === null) localStorage.removeItem(LS_PROJECT_KEY);
20294
- else localStorage.setItem(LS_PROJECT_KEY, id);
20295
- } catch {
20296
- }
20297
- }
20298
- function loadShowArchived() {
20299
- try {
20300
- return localStorage.getItem(LS_ARCHIVED_KEY) === "1";
20301
- } catch {
20302
- return false;
20303
- }
20304
- }
20305
- function saveShowArchived(v) {
20306
- try {
20307
- localStorage.setItem(LS_ARCHIVED_KEY, v ? "1" : "0");
20308
- } catch {
20309
- }
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 }];
20310
20419
  }
20311
- function taskMessagesToChatItems(msgs, labels) {
20312
- const items = [];
20313
- for (const msg of msgs) {
20314
- if (msg.messageType === "system" || msg.messageType === "block") {
20315
- items.push({ kind: "notice", text: msg.content, variant: msg.messageType });
20316
- continue;
20317
- }
20318
- if (msg.messageType === "tool_call") {
20319
- const sp = msg.content.indexOf(" ");
20320
- const name = sp === -1 ? msg.content : msg.content.slice(0, sp);
20321
- let args = {};
20322
- if (sp !== -1) {
20323
- try {
20324
- args = JSON.parse(msg.content.slice(sp + 1));
20325
- } catch {
20326
- 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
+ }
20327
20446
  }
20447
+ } else {
20448
+ items.push({ kind: "assistant", text: msg.content, streaming: false });
20328
20449
  }
20329
- items.push({ kind: "tool", id: msg.toolCallId || String(msg.id), name, args, result: "" });
20330
- continue;
20331
- }
20332
- if (msg.messageType === "plan") {
20333
- items.push({ kind: "assistant", text: `**\u{1F4CB} Plan submitted**
20334
-
20335
- ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.planner });
20336
- continue;
20337
- }
20338
- if (msg.messageType === "review") {
20339
- items.push({ kind: "assistant", text: `**\u{1F50E} Code review**
20340
-
20341
- ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20342
- continue;
20343
- }
20344
- if (msg.role === "user") {
20345
- items.push({ kind: "user", text: msg.content });
20346
- continue;
20347
- }
20348
- let text = msg.content;
20349
- let thinking = "";
20350
- if (msg.content.startsWith("[")) {
20351
- try {
20352
- const parsed = JSON.parse(msg.content);
20353
- if (Array.isArray(parsed)) {
20354
- const t = parsed.find((b) => b.type === "thinking");
20355
- const x = parsed.find((b) => b.type === "text");
20356
- if (t?.content) thinking = t.content;
20357
- 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
+ });
20358
20467
  }
20359
- } catch {
20360
20468
  }
20361
20469
  }
20362
- if (thinking) items.push({ kind: "thinking", text: thinking });
20363
- items.push({ kind: "assistant", text, streaming: false, label: msg.agentLabel || labels?.developer });
20364
20470
  }
20365
- return items;
20471
+ return closeStreamingAssistant2(items);
20366
20472
  }
20367
- var PAGE_SIZE = 20;
20368
- function ProjectsTab({ agents }) {
20369
- const [projects, setProjects] = (0, import_react18.useState)([]);
20370
- const [selectedProjectId, setSelectedProjectId] = (0, import_react18.useState)(loadSavedProjectId);
20371
- const [tasks, setTasks] = (0, import_react18.useState)([]);
20372
- const [selectedTaskId, setSelectedTaskId] = (0, import_react18.useState)(null);
20373
- const [taskMessages, setTaskMessages] = (0, import_react18.useState)([]);
20374
- const [view, setView] = (0, import_react18.useState)("list");
20375
- const [page, setPage] = (0, import_react18.useState)(0);
20376
- const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react18.useState)(false);
20377
- const [newTask, setNewTask] = (0, import_react18.useState)({
20378
- title: "",
20379
- objective: "",
20380
- checklistText: "",
20381
- startActive: true,
20382
- agentId: "",
20383
- plannerAgentId: "",
20384
- reviewerAgentId: ""
20385
- });
20386
- const [composerText, setComposerText] = (0, import_react18.useState)("");
20387
- const [isSending, setIsSending] = (0, import_react18.useState)(false);
20388
- const [showArchived, setShowArchived] = (0, import_react18.useState)(loadShowArchived);
20389
- const [pendingConfirm, setPendingConfirm] = (0, import_react18.useState)(null);
20390
- const [taskError, setTaskError] = (0, import_react18.useState)(null);
20391
- const threadIntervalRef = (0, import_react18.useRef)(null);
20392
- (0, import_react18.useEffect)(() => {
20393
- fetchProjects();
20394
- return () => {
20395
- stopThreadPolling();
20396
- };
20397
- }, []);
20398
- (0, import_react18.useEffect)(() => {
20399
- if (projects.length > 0 && selectedProjectId === null) {
20400
- setSelectedProjectId(projects[0].id);
20401
- }
20402
- if (projects.length > 0 && selectedProjectId !== null && !projects.some((p) => p.id === selectedProjectId)) {
20403
- setSelectedProjectId(projects[0].id);
20404
- }
20405
- if (projects.length === 0) {
20406
- setSelectedProjectId(null);
20407
- }
20408
- }, [projects]);
20409
- (0, import_react18.useEffect)(() => {
20410
- saveProjectId(selectedProjectId);
20411
- }, [selectedProjectId]);
20412
- (0, import_react18.useEffect)(() => {
20413
- saveShowArchived(showArchived);
20414
- }, [showArchived]);
20415
- (0, import_react18.useEffect)(() => {
20416
- if (selectedProjectId !== null) {
20417
- fetchTasks(selectedProjectId);
20418
- setView("list");
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) {
20732
+ fetchTasks(selectedProjectId);
20733
+ setView("list");
20419
20734
  setSelectedTaskId(null);
20420
20735
  setTaskMessages([]);
20421
20736
  setPage(0);
@@ -20424,7 +20739,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20424
20739
  setTasks([]);
20425
20740
  }
20426
20741
  }, [selectedProjectId, showArchived]);
20427
- (0, import_react18.useEffect)(() => {
20742
+ (0, import_react19.useEffect)(() => {
20428
20743
  if (selectedTaskId !== null) {
20429
20744
  fetchTaskMessages(selectedTaskId);
20430
20745
  startThreadPolling(selectedTaskId);
@@ -20597,7 +20912,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20597
20912
  const cancelPendingAction = () => {
20598
20913
  setPendingConfirm(null);
20599
20914
  };
20600
- (0, import_react18.useEffect)(() => {
20915
+ (0, import_react19.useEffect)(() => {
20601
20916
  if (!pendingConfirm) return;
20602
20917
  function handleKeyDown(event) {
20603
20918
  if (event.key === "Escape") {
@@ -20607,7 +20922,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20607
20922
  window.addEventListener("keydown", handleKeyDown);
20608
20923
  return () => window.removeEventListener("keydown", handleKeyDown);
20609
20924
  }, [pendingConfirm]);
20610
- (0, import_react18.useEffect)(() => {
20925
+ (0, import_react19.useEffect)(() => {
20611
20926
  if (!taskError) return;
20612
20927
  const t = setTimeout(() => setTaskError(null), 5e3);
20613
20928
  return () => clearTimeout(t);
@@ -20627,26 +20942,26 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20627
20942
  console.error("Failed to toggle checklist item:", err);
20628
20943
  }
20629
20944
  };
20630
- const handleSendMessage = async (e) => {
20631
- e.preventDefault();
20632
- if (!composerText.trim() || selectedTaskId === null || isSending) return;
20945
+ const handleSendMessage = async (text) => {
20946
+ if (!text.trim() || selectedTaskId === null || isSending) return false;
20633
20947
  setIsSending(true);
20634
20948
  try {
20635
20949
  const res = await fetch(`/api/tasks/${selectedTaskId}/messages`, {
20636
20950
  method: "POST",
20637
20951
  headers: { "Content-Type": "application/json" },
20638
- body: JSON.stringify({ content: composerText.trim() })
20952
+ body: JSON.stringify({ content: text.trim() })
20639
20953
  });
20640
20954
  if (res.ok) {
20641
- setComposerText("");
20642
20955
  fetchTaskMessages(selectedTaskId);
20643
20956
  if (selectedProjectId !== null) fetchTasks(selectedProjectId);
20957
+ return true;
20644
20958
  }
20645
20959
  } catch (err) {
20646
20960
  console.error("Failed to send message:", err);
20647
20961
  } finally {
20648
20962
  setIsSending(false);
20649
20963
  }
20964
+ return false;
20650
20965
  };
20651
20966
  const openTaskLog = (task) => {
20652
20967
  setSelectedTaskId(task.id);
@@ -20738,7 +21053,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20738
21053
  const selectedProject = projects.find((p) => p.id === selectedProjectId);
20739
21054
  const selectedTask = tasks.find((t) => t.id === selectedTaskId);
20740
21055
  const selectedProjectAgentName = agents.find((a) => a.id === selectedProject?.agentId)?.name || "Default Agent";
20741
- const taskAgentLabels = (0, import_react18.useMemo)(() => {
21056
+ const taskAgentLabels = (0, import_react19.useMemo)(() => {
20742
21057
  if (!selectedTask) return void 0;
20743
21058
  const agentLabelFor = (agentId) => {
20744
21059
  const a = agents.find((x) => x.id === agentId);
@@ -20784,13 +21099,22 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20784
21099
  const safePage = Math.min(page, totalPages - 1);
20785
21100
  const pageStart = safePage * PAGE_SIZE;
20786
21101
  const pageTasks = tasks.slice(pageStart, pageStart + PAGE_SIZE);
20787
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
20788
- /* @__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)(
20789
21110
  TaskListView,
20790
21111
  {
20791
21112
  projects,
20792
21113
  selectedProjectId,
20793
- onProjectChange: setSelectedProjectId,
21114
+ onProjectChange: (id) => {
21115
+ setSelectedProjectId(id);
21116
+ persistLastProject(id);
21117
+ },
20794
21118
  project: selectedProject,
20795
21119
  agentName: selectedProjectAgentName,
20796
21120
  agents,
@@ -20807,7 +21131,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20807
21131
  onArchive: handleArchiveFromList,
20808
21132
  statusColor
20809
21133
  }
20810
- ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21134
+ ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20811
21135
  TaskLogView,
20812
21136
  {
20813
21137
  task: selectedTask,
@@ -20815,16 +21139,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20815
21139
  agentLabels: taskAgentLabels,
20816
21140
  isActiveLike,
20817
21141
  reviewRound,
20818
- composerText,
20819
- onComposerChange: setComposerText,
20820
21142
  onSend: handleSendMessage,
20821
21143
  isSending,
21144
+ postMessage,
20822
21145
  onBack: backToList,
20823
21146
  onToggleChecklistItem: handleToggleChecklistItem,
20824
21147
  onToggleStatus: handleToggleTaskStatus,
20825
21148
  statusColor
20826
21149
  }
20827
- ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21150
+ ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20828
21151
  TaskEditView,
20829
21152
  {
20830
21153
  task: selectedTask,
@@ -20842,11 +21165,11 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20842
21165
  onOpenLog: () => setView("log"),
20843
21166
  statusColor
20844
21167
  }
20845
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__empty-state", children: [
20846
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Task not found. Go back to the list." }),
20847
- /* @__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" })
20848
21171
  ] }) : null }),
20849
- isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21172
+ isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20850
21173
  "div",
20851
21174
  {
20852
21175
  style: {
@@ -20861,7 +21184,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20861
21184
  justifyContent: "center",
20862
21185
  zIndex: 999
20863
21186
  },
20864
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21187
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20865
21188
  "form",
20866
21189
  {
20867
21190
  onSubmit: handleCreateTask,
@@ -20872,14 +21195,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20872
21195
  background: "var(--vscode-sideBar-background)"
20873
21196
  },
20874
21197
  children: [
20875
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "confirm__header", children: [
20876
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Wrench, { size: 18 }) }),
20877
- /* @__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" })
20878
21201
  ] }),
20879
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
20880
- /* @__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: [
20881
21204
  "Task Title",
20882
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21205
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20883
21206
  "input",
20884
21207
  {
20885
21208
  type: "text",
@@ -20899,9 +21222,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20899
21222
  }
20900
21223
  )
20901
21224
  ] }),
20902
- /* @__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: [
20903
21226
  "Objective (Extended markdown goal description)",
20904
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21227
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20905
21228
  "textarea",
20906
21229
  {
20907
21230
  required: true,
@@ -20922,9 +21245,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20922
21245
  }
20923
21246
  )
20924
21247
  ] }),
20925
- /* @__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: [
20926
21249
  "Checklist Items (One item per line)",
20927
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21250
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
20928
21251
  "textarea",
20929
21252
  {
20930
21253
  placeholder: "Create route handler\nWrite unit tests\nUpdate documentation",
@@ -20944,9 +21267,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20944
21267
  }
20945
21268
  )
20946
21269
  ] }),
20947
- /* @__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: [
20948
21271
  "Assigned Agent (optional \u2014 overrides project default)",
20949
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21272
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20950
21273
  "select",
20951
21274
  {
20952
21275
  value: newTask.agentId,
@@ -20961,8 +21284,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20961
21284
  outline: "none"
20962
21285
  },
20963
21286
  children: [
20964
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
20965
- 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: [
20966
21289
  a.name,
20967
21290
  " (",
20968
21291
  a.provider,
@@ -20972,9 +21295,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20972
21295
  }
20973
21296
  )
20974
21297
  ] }),
20975
- /* @__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: [
20976
21299
  "Planner Agent Override (optional)",
20977
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21300
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20978
21301
  "select",
20979
21302
  {
20980
21303
  value: newTask.plannerAgentId,
@@ -20989,8 +21312,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20989
21312
  outline: "none"
20990
21313
  },
20991
21314
  children: [
20992
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
20993
- 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: [
20994
21317
  a.name,
20995
21318
  " (",
20996
21319
  a.provider,
@@ -21000,9 +21323,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21000
21323
  }
21001
21324
  )
21002
21325
  ] }),
21003
- /* @__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: [
21004
21327
  "Reviewer Agent Override (optional)",
21005
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21328
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21006
21329
  "select",
21007
21330
  {
21008
21331
  value: newTask.reviewerAgentId,
@@ -21017,8 +21340,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21017
21340
  outline: "none"
21018
21341
  },
21019
21342
  children: [
21020
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21021
- 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: [
21022
21345
  a.name,
21023
21346
  " (",
21024
21347
  a.provider,
@@ -21028,8 +21351,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21028
21351
  }
21029
21352
  )
21030
21353
  ] }),
21031
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
21032
- /* @__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)(
21033
21356
  "input",
21034
21357
  {
21035
21358
  type: "checkbox",
@@ -21038,24 +21361,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21038
21361
  style: { cursor: "pointer" }
21039
21362
  }
21040
21363
  ),
21041
- /* @__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)" })
21042
21365
  ] })
21043
21366
  ] }),
21044
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
21045
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
21046
- /* @__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" })
21047
21370
  ] })
21048
21371
  ]
21049
21372
  }
21050
21373
  )
21051
21374
  }
21052
21375
  ),
21053
- 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: [
21054
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
21055
- /* @__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.` }),
21056
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__confirm-buttons", children: [
21057
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
21058
- /* @__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)(
21059
21382
  "button",
21060
21383
  {
21061
21384
  className: `app__confirm-btn ${pendingConfirm.type === "delete" ? "app__confirm-btn--danger" : ""}`,
@@ -21065,7 +21388,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21065
21388
  )
21066
21389
  ] })
21067
21390
  ] }) }),
21068
- 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 })
21069
21392
  ] });
21070
21393
  }
21071
21394
  function TaskListView({
@@ -21088,10 +21411,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21088
21411
  onArchive,
21089
21412
  statusColor
21090
21413
  }) {
21091
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21092
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-view__header", children: [
21093
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21094
- /* @__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)(
21095
21418
  "select",
21096
21419
  {
21097
21420
  className: "task-view__project-filter",
@@ -21108,17 +21431,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21108
21431
  outline: "none",
21109
21432
  cursor: "pointer"
21110
21433
  },
21111
- 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))
21112
21435
  }
21113
21436
  ),
21114
- /* @__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: [
21115
21438
  "Agent: ",
21116
21439
  agentName
21117
21440
  ] })
21118
21441
  ] }),
21119
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
21120
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "task-view__archived-toggle", children: [
21121
- /* @__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)(
21122
21445
  "input",
21123
21446
  {
21124
21447
  type: "checkbox",
@@ -21129,42 +21452,42 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21129
21452
  ),
21130
21453
  "Show archived"
21131
21454
  ] }),
21132
- /* @__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" })
21133
21456
  ] })
21134
21457
  ] }),
21135
- /* @__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: [
21136
21459
  "No tasks created for ",
21137
21460
  project.name,
21138
21461
  '. Click "+ New Task" to start.'
21139
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { className: "task-table", children: [
21140
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { children: [
21141
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
21142
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", children: "Title" }),
21143
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
21144
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
21145
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
21146
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
21147
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
21148
- /* @__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" } })
21149
21472
  ] }) }),
21150
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: tasks.map((task) => {
21473
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: tasks.map((task) => {
21151
21474
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
21152
21475
  const totalCount = task.checklist.length;
21153
21476
  const isArchived = !!task.archived;
21154
21477
  const updated = new Date(task.updatedAt);
21155
21478
  const updatedStr = isNaN(updated.getTime()) ? task.updatedAt : updated.toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
21156
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21479
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21157
21480
  "tr",
21158
21481
  {
21159
21482
  className: `task-table__row${isArchived ? " task-table__row--archived" : ""}`,
21160
21483
  onClick: () => onOpenLog(task),
21161
21484
  children: [
21162
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
21163
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "task-table__title", children: [
21164
- 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 }),
21165
21488
  task.title
21166
21489
  ] }) }),
21167
- /* @__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)(
21168
21491
  "span",
21169
21492
  {
21170
21493
  className: "task-table__badge",
@@ -21172,28 +21495,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21172
21495
  children: task.status
21173
21496
  }
21174
21497
  ) }),
21175
- /* @__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" }) }),
21176
- /* @__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: [
21177
- /* @__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)(
21178
21501
  "span",
21179
21502
  {
21180
21503
  className: "task-table__progress-fill",
21181
21504
  style: { width: `${completedCount / totalCount * 100}%` }
21182
21505
  }
21183
21506
  ) }),
21184
- /* @__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: [
21185
21508
  completedCount,
21186
21509
  "/",
21187
21510
  totalCount
21188
21511
  ] })
21189
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21190
- /* @__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: [
21191
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 11 }),
21192
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { children: task.branch })
21193
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
21194
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
21195
- /* @__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: [
21196
- /* @__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)(
21197
21520
  "button",
21198
21521
  {
21199
21522
  className: "task-table__edit-btn",
@@ -21203,10 +21526,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21203
21526
  },
21204
21527
  title: task.archived ? "Unarchive task" : "Archive task",
21205
21528
  "aria-label": task.archived ? "Unarchive task" : "Archive task",
21206
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Archive, { size: 13 })
21529
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Archive, { size: 13 })
21207
21530
  }
21208
21531
  ),
21209
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21532
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21210
21533
  "button",
21211
21534
  {
21212
21535
  className: "task-table__edit-btn",
@@ -21216,7 +21539,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21216
21539
  },
21217
21540
  title: "Edit task",
21218
21541
  "aria-label": "Edit task",
21219
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Pencil, { size: 13 })
21542
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Pencil, { size: 13 })
21220
21543
  }
21221
21544
  )
21222
21545
  ] }) })
@@ -21226,8 +21549,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21226
21549
  );
21227
21550
  }) })
21228
21551
  ] }) }),
21229
- totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-table__pagination", children: [
21230
- /* @__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)(
21231
21554
  "button",
21232
21555
  {
21233
21556
  className: "task-table__page-btn",
@@ -21236,13 +21559,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21236
21559
  children: "\u2039 Prev"
21237
21560
  }
21238
21561
  ),
21239
- /* @__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: [
21240
21563
  "Page ",
21241
21564
  page + 1,
21242
21565
  " of ",
21243
21566
  totalPages
21244
21567
  ] }),
21245
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21568
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21246
21569
  "button",
21247
21570
  {
21248
21571
  className: "task-table__page-btn",
@@ -21260,10 +21583,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21260
21583
  agentLabels,
21261
21584
  isActiveLike,
21262
21585
  reviewRound,
21263
- composerText,
21264
- onComposerChange,
21265
21586
  onSend,
21266
21587
  isSending,
21588
+ postMessage,
21267
21589
  onBack,
21268
21590
  onToggleChecklistItem,
21269
21591
  onToggleStatus,
@@ -21271,20 +21593,31 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21271
21593
  }) {
21272
21594
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
21273
21595
  const totalCount = task.checklist.length;
21274
- const chatItems = (0, import_react18.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
21275
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
21276
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
21277
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21278
- /* @__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 }) }),
21279
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "app__chat-header-info", children: [
21280
- /* @__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: [
21281
21614
  "Task #",
21282
21615
  task.id,
21283
21616
  ": ",
21284
21617
  task.title
21285
21618
  ] }),
21286
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
21287
- /* @__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)(
21288
21621
  "span",
21289
21622
  {
21290
21623
  className: `agent-status-dot agent-status-dot--active ${isActiveLike ? "agent-status-dot--pulsing" : ""}`,
@@ -21295,24 +21628,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21295
21628
  ] })
21296
21629
  ] })
21297
21630
  ] }),
21298
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
21299
- 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)(
21300
21633
  "button",
21301
21634
  {
21302
21635
  className: "confirm__btn confirm__btn--primary",
21303
21636
  onClick: () => onToggleStatus(task),
21304
21637
  title: isActiveLike ? "Pause this task (aborts the running agent)" : "Activate this task",
21305
21638
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21306
- children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21307
- /* @__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 }),
21308
21641
  " Pause"
21309
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21310
- /* @__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 }),
21311
21644
  " Activate"
21312
21645
  ] })
21313
21646
  }
21314
21647
  ),
21315
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21648
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21316
21649
  "span",
21317
21650
  {
21318
21651
  className: "task-table__badge",
@@ -21322,8 +21655,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21322
21655
  )
21323
21656
  ] })
21324
21657
  ] }),
21325
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
21326
- /* @__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)(
21327
21660
  "aside",
21328
21661
  {
21329
21662
  style: {
@@ -21336,19 +21669,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21336
21669
  background: "var(--vscode-sideBar-background, rgba(0,0,0,0.1))"
21337
21670
  },
21338
21671
  children: [
21339
- /* @__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: [
21340
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
21341
- 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: [
21342
21675
  completedCount,
21343
21676
  "/",
21344
21677
  totalCount,
21345
21678
  " done"
21346
21679
  ] })
21347
21680
  ] }),
21348
- /* @__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) => {
21349
21682
  const isDone = item.status === "done";
21350
21683
  const isInProgress = item.status === "in_progress";
21351
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21684
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21352
21685
  "label",
21353
21686
  {
21354
21687
  style: {
@@ -21365,7 +21698,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21365
21698
  },
21366
21699
  title: isInProgress ? "In progress" : isDone ? "Done" : "Pending",
21367
21700
  children: [
21368
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21701
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21369
21702
  "input",
21370
21703
  {
21371
21704
  type: "checkbox",
@@ -21374,7 +21707,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21374
21707
  style: { marginTop: "2px", cursor: "pointer", flexShrink: 0 }
21375
21708
  }
21376
21709
  ),
21377
- /* @__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 })
21378
21711
  ]
21379
21712
  },
21380
21713
  item.id
@@ -21383,36 +21716,32 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21383
21716
  ]
21384
21717
  }
21385
21718
  ),
21386
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
21387
- 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 }),
21388
- /* @__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: [
21389
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21390
- "textarea",
21391
- {
21392
- className: "composer__input",
21393
- placeholder: "Provide feedback or ask the agent to resume...",
21394
- value: composerText,
21395
- onChange: (e) => onComposerChange(e.target.value),
21396
- onKeyDown: (e) => {
21397
- if (e.key === "Enter" && !e.shiftKey) {
21398
- e.preventDefault();
21399
- onSend(e);
21400
- }
21401
- },
21402
- style: { flex: 1, minHeight: "44px" }
21403
- }
21404
- ),
21405
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21406
- "button",
21407
- {
21408
- type: "submit",
21409
- className: "app__new-chat-btn",
21410
- disabled: !composerText.trim() || isSending,
21411
- style: { height: "40px", padding: "0 16px", display: "flex", alignItems: "center", justifyContent: "center" },
21412
- children: isSending ? "Sending..." : "Send"
21413
- }
21414
- )
21415
- ] }) })
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
+ )
21416
21745
  ] })
21417
21746
  ] })
21418
21747
  ] });
@@ -21434,12 +21763,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21434
21763
  statusColor
21435
21764
  }) {
21436
21765
  const isRunning = task.status === "active" || task.status === "reviewing" || task.status === "planning";
21437
- const [draftTitle, setDraftTitle] = (0, import_react18.useState)(task.title);
21438
- const [draftObjective, setDraftObjective] = (0, import_react18.useState)(task.objective);
21439
- 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);
21440
21769
  const trimmedTitle = draftTitle.trim();
21441
21770
  const isDirty = trimmedTitle !== task.title.trim() || draftObjective.trim() !== task.objective.trim();
21442
- (0, import_react18.useEffect)(() => {
21771
+ (0, import_react19.useEffect)(() => {
21443
21772
  if (task.id !== lastTaskId) {
21444
21773
  setDraftTitle(task.title);
21445
21774
  setDraftObjective(task.objective);
@@ -21454,16 +21783,16 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21454
21783
  setDraftTitle(task.title);
21455
21784
  setDraftObjective(task.objective);
21456
21785
  };
21457
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
21458
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
21459
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
21460
- /* @__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 }) }),
21461
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
21462
- /* @__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: [
21463
21792
  "Task #",
21464
21793
  task.id
21465
21794
  ] }),
21466
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21795
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21467
21796
  "input",
21468
21797
  {
21469
21798
  value: draftTitle,
@@ -21484,7 +21813,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21484
21813
  }
21485
21814
  )
21486
21815
  ] }),
21487
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21816
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21488
21817
  "span",
21489
21818
  {
21490
21819
  className: "task-table__badge",
@@ -21493,8 +21822,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21493
21822
  }
21494
21823
  )
21495
21824
  ] }),
21496
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
21497
- /* @__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)(
21498
21827
  "button",
21499
21828
  {
21500
21829
  className: "confirm__btn",
@@ -21504,7 +21833,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21504
21833
  children: "View Log"
21505
21834
  }
21506
21835
  ),
21507
- task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21836
+ task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21508
21837
  "button",
21509
21838
  {
21510
21839
  className: "confirm__btn",
@@ -21512,12 +21841,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21512
21841
  title: `Commit pending changes to ${task.branch} and remove the worktree`,
21513
21842
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21514
21843
  children: [
21515
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 12 }),
21844
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GitBranch, { size: 12 }),
21516
21845
  " Discard worktree"
21517
21846
  ]
21518
21847
  }
21519
21848
  ),
21520
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21849
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21521
21850
  "button",
21522
21851
  {
21523
21852
  className: "confirm__btn",
@@ -21525,28 +21854,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21525
21854
  title: task.archived ? "Unarchive this task" : "Archive this task (hides it from the list, excludes from scheduler)",
21526
21855
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21527
21856
  children: [
21528
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Archive, { size: 12 }),
21857
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Archive, { size: 12 }),
21529
21858
  " ",
21530
21859
  task.archived ? "Unarchive" : "Archive"
21531
21860
  ]
21532
21861
  }
21533
21862
  ),
21534
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21863
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21535
21864
  "button",
21536
21865
  {
21537
21866
  className: "confirm__btn confirm__btn--primary",
21538
21867
  onClick: () => onToggleStatus(task),
21539
21868
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
21540
- children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21541
- /* @__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 }),
21542
21871
  " Pause"
21543
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
21544
- /* @__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 }),
21545
21874
  " Activate"
21546
21875
  ] })
21547
21876
  }
21548
21877
  ),
21549
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
21878
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21550
21879
  "button",
21551
21880
  {
21552
21881
  className: "confirm__btn",
@@ -21554,22 +21883,22 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21554
21883
  title: "Permanently delete this task and all its messages",
21555
21884
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px", color: "#ef4444" },
21556
21885
  children: [
21557
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Trash2, { size: 12 }),
21886
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 }),
21558
21887
  " Delete"
21559
21888
  ]
21560
21889
  }
21561
21890
  )
21562
21891
  ] })
21563
21892
  ] }),
21564
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
21565
- task.branch && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
21566
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GitBranch, { size: 12 }),
21567
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
21568
- !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)" })
21569
21898
  ] }),
21570
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21571
- /* @__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" }),
21572
- /* @__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)(
21573
21902
  "textarea",
21574
21903
  {
21575
21904
  value: draftObjective,
@@ -21593,8 +21922,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21593
21922
  }
21594
21923
  }
21595
21924
  ),
21596
- isDirty && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
21597
- /* @__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)(
21598
21927
  "button",
21599
21928
  {
21600
21929
  className: "confirm__btn confirm__btn--primary",
@@ -21607,13 +21936,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21607
21936
  children: "Save"
21608
21937
  }
21609
21938
  ),
21610
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
21611
- 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." })
21612
21941
  ] })
21613
21942
  ] }),
21614
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21615
- /* @__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" }),
21616
- /* @__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)(
21617
21946
  "select",
21618
21947
  {
21619
21948
  value: task.agentId || "",
@@ -21633,8 +21962,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21633
21962
  },
21634
21963
  title: isRunning ? "Pause the task before changing its agent" : "Choose which agent runs this task",
21635
21964
  children: [
21636
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21637
- 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: [
21638
21967
  a.name,
21639
21968
  " (",
21640
21969
  a.provider,
@@ -21644,9 +21973,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21644
21973
  }
21645
21974
  )
21646
21975
  ] }),
21647
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21648
- /* @__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" }),
21649
- /* @__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)(
21650
21979
  "select",
21651
21980
  {
21652
21981
  value: task.plannerAgentId || "",
@@ -21655,8 +21984,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21655
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 },
21656
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.",
21657
21986
  children: [
21658
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21659
- 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: [
21660
21989
  a.name,
21661
21990
  " (",
21662
21991
  a.provider,
@@ -21666,9 +21995,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21666
21995
  }
21667
21996
  )
21668
21997
  ] }),
21669
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21670
- /* @__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" }),
21671
- /* @__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)(
21672
22001
  "select",
21673
22002
  {
21674
22003
  value: task.reviewerAgentId || "",
@@ -21677,8 +22006,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21677
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 },
21678
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.",
21679
22008
  children: [
21680
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Project default" }),
21681
- 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: [
21682
22011
  a.name,
21683
22012
  " (",
21684
22013
  a.provider,
@@ -21688,31 +22017,31 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21688
22017
  }
21689
22018
  )
21690
22019
  ] }),
21691
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { marginBottom: "16px" }, children: [
21692
- /* @__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" }),
21693
- /* @__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: [
21694
22023
  { flag: "planningEnabled", label: "Planning phase", value: task.planningEnabled },
21695
22024
  { flag: "reviewEnabled", label: "Review at DONE", value: task.reviewEnabled },
21696
22025
  { flag: "sddEnabled", label: "SDD mode (.md specs)", value: task.sddEnabled }
21697
- ].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: [
21698
22027
  label,
21699
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22028
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21700
22029
  "select",
21701
22030
  {
21702
22031
  value: value === true ? "on" : value === false ? "off" : "inherit",
21703
22032
  onChange: (e) => onSetFlag(task, flag, e.target.value === "inherit" ? null : e.target.value === "on"),
21704
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" },
21705
22034
  children: [
21706
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "inherit", children: "Project default" }),
21707
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "on", children: "On" }),
21708
- /* @__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" })
21709
22038
  ]
21710
22039
  }
21711
22040
  )
21712
22041
  ] }, flag)) }),
21713
- /* @__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: [
21714
22043
  "Max run seconds per cycle",
21715
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
22044
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21716
22045
  "input",
21717
22046
  {
21718
22047
  type: "number",
@@ -21735,7 +22064,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21735
22064
  )
21736
22065
  ] })
21737
22066
  ] }),
21738
- task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22067
+ task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21739
22068
  "div",
21740
22069
  {
21741
22070
  style: {
@@ -21748,19 +22077,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21748
22077
  fontSize: "12px"
21749
22078
  },
21750
22079
  children: [
21751
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
21752
- /* @__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 }),
21753
22082
  " Blocked Reason:"
21754
22083
  ] }),
21755
- /* @__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 })
21756
22085
  ]
21757
22086
  }
21758
22087
  ),
21759
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
21760
- /* @__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" }),
21761
- /* @__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) => {
21762
22091
  const isDone = item.status === "done";
21763
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
22092
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21764
22093
  "label",
21765
22094
  {
21766
22095
  style: {
@@ -21777,7 +22106,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21777
22106
  opacity: isDone ? 0.6 : 1
21778
22107
  },
21779
22108
  children: [
21780
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
22109
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
21781
22110
  "input",
21782
22111
  {
21783
22112
  type: "checkbox",
@@ -21786,7 +22115,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21786
22115
  style: { marginTop: "2px", cursor: "pointer" }
21787
22116
  }
21788
22117
  ),
21789
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: item.text })
22118
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: item.text })
21790
22119
  ]
21791
22120
  },
21792
22121
  item.id
@@ -21798,7 +22127,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21798
22127
  }
21799
22128
 
21800
22129
  // src/useVoice.ts
21801
- var import_react19 = __toESM(require_react(), 1);
22130
+ var import_react20 = __toESM(require_react(), 1);
21802
22131
  function canCapture() {
21803
22132
  return typeof window !== "undefined" && typeof MediaRecorder !== "undefined" && !!navigator.mediaDevices?.getUserMedia;
21804
22133
  }
@@ -21823,37 +22152,37 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21823
22152
  const { voice, chatStatus, pendingConfirmCount, items, onTranscript } = opts;
21824
22153
  const available = !!voice && voice.enabled && voice.configured && canCapture();
21825
22154
  const canSpeak = !!voice?.canSpeak;
21826
- const [phase, setPhase] = (0, import_react19.useState)("idle");
21827
- const [mode, setMode] = (0, import_react19.useState)("dictate");
21828
- const [error, setError] = (0, import_react19.useState)(null);
21829
- 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);
21830
22159
  phaseRef.current = phase;
21831
- const modeRef = (0, import_react19.useRef)(mode);
22160
+ const modeRef = (0, import_react20.useRef)(mode);
21832
22161
  modeRef.current = mode;
21833
- const onTranscriptRef = (0, import_react19.useRef)(onTranscript);
22162
+ const onTranscriptRef = (0, import_react20.useRef)(onTranscript);
21834
22163
  onTranscriptRef.current = onTranscript;
21835
- const itemsRef = (0, import_react19.useRef)(items);
22164
+ const itemsRef = (0, import_react20.useRef)(items);
21836
22165
  itemsRef.current = items;
21837
- const chatStatusRef = (0, import_react19.useRef)(chatStatus);
22166
+ const chatStatusRef = (0, import_react20.useRef)(chatStatus);
21838
22167
  chatStatusRef.current = chatStatus;
21839
- const streamRef = (0, import_react19.useRef)(null);
21840
- const recorderRef = (0, import_react19.useRef)(null);
21841
- const chunksRef = (0, import_react19.useRef)([]);
21842
- const vadRef = (0, import_react19.useRef)(null);
21843
- const audioRef = (0, import_react19.useRef)(null);
21844
- const idleTimerRef = (0, import_react19.useRef)(null);
21845
- const heardSpeechRef = (0, import_react19.useRef)(false);
21846
- const sawStreamingRef = (0, import_react19.useRef)(false);
21847
- const cursorRef = (0, import_react19.useRef)(0);
21848
- const queueRef = (0, import_react19.useRef)([]);
21849
- 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) => {
21850
22179
  setPhase((current) => nextPhase(current, event));
21851
22180
  }, []);
21852
22181
  const clearIdleTimer = () => {
21853
22182
  if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
21854
22183
  idleTimerRef.current = null;
21855
22184
  };
21856
- const teardownCapture = (0, import_react19.useCallback)(() => {
22185
+ const teardownCapture = (0, import_react20.useCallback)(() => {
21857
22186
  clearIdleTimer();
21858
22187
  try {
21859
22188
  vadRef.current?.destroy();
@@ -21870,14 +22199,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21870
22199
  chunksRef.current = [];
21871
22200
  heardSpeechRef.current = false;
21872
22201
  }, []);
21873
- const stopPlayback = (0, import_react19.useCallback)(() => {
22202
+ const stopPlayback = (0, import_react20.useCallback)(() => {
21874
22203
  if (audioRef.current) {
21875
22204
  audioRef.current.pause();
21876
22205
  audioRef.current.src = "";
21877
22206
  audioRef.current = null;
21878
22207
  }
21879
22208
  }, []);
21880
- const fail = (0, import_react19.useCallback)(
22209
+ const fail = (0, import_react20.useCallback)(
21881
22210
  (message) => {
21882
22211
  teardownCapture();
21883
22212
  stopPlayback();
@@ -21886,7 +22215,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21886
22215
  },
21887
22216
  [apply, teardownCapture, stopPlayback]
21888
22217
  );
21889
- const finishRecording = (0, import_react19.useCallback)(() => {
22218
+ const finishRecording = (0, import_react20.useCallback)(() => {
21890
22219
  const recorder = recorderRef.current;
21891
22220
  if (!recorder || recorder.state === "inactive") return;
21892
22221
  recorder.onstop = async () => {
@@ -21915,7 +22244,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21915
22244
  };
21916
22245
  recorder.stop();
21917
22246
  }, [apply, fail, teardownCapture]);
21918
- const startRecording = (0, import_react19.useCallback)(async () => {
22247
+ const startRecording = (0, import_react20.useCallback)(async () => {
21919
22248
  setError(null);
21920
22249
  chunksRef.current = [];
21921
22250
  heardSpeechRef.current = false;
@@ -21960,7 +22289,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21960
22289
  fail(`Microphone unavailable: ${err}`);
21961
22290
  }
21962
22291
  }, [apply, fail, finishRecording, teardownCapture]);
21963
- const speakReply = (0, import_react19.useCallback)(async () => {
22292
+ const speakReply = (0, import_react20.useCallback)(async () => {
21964
22293
  const text = queueRef.current.shift();
21965
22294
  if (!text) {
21966
22295
  apply({
@@ -22004,10 +22333,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22004
22333
  fail(`Synthesis failed: ${err}`);
22005
22334
  }
22006
22335
  }, [apply, fail]);
22007
- (0, import_react19.useEffect)(() => {
22336
+ (0, import_react20.useEffect)(() => {
22008
22337
  if (chatStatus === "streaming") sawStreamingRef.current = true;
22009
22338
  }, [chatStatus]);
22010
- (0, import_react19.useEffect)(() => {
22339
+ (0, import_react20.useEffect)(() => {
22011
22340
  if (modeRef.current !== "conversation") return;
22012
22341
  if (phaseRef.current === "idle") return;
22013
22342
  const { texts, cursor } = takeFinalizedBubbles(items, cursorRef.current);
@@ -22016,7 +22345,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22016
22345
  queueRef.current.push(...texts);
22017
22346
  apply({ kind: "speechQueued", mode: "conversation", canSpeak });
22018
22347
  }, [items, canSpeak, apply]);
22019
- (0, import_react19.useEffect)(() => {
22348
+ (0, import_react20.useEffect)(() => {
22020
22349
  if (phase !== "awaiting") return;
22021
22350
  if (chatStatus === "error") {
22022
22351
  apply({ kind: "failed", mode: "conversation" });
@@ -22038,8 +22367,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22038
22367
  pendingSpeech: queueRef.current.length
22039
22368
  });
22040
22369
  }, [phase, chatStatus, pendingConfirmCount, canSpeak, apply]);
22041
- const prevPhase = (0, import_react19.useRef)("idle");
22042
- (0, import_react19.useEffect)(() => {
22370
+ const prevPhase = (0, import_react20.useRef)("idle");
22371
+ (0, import_react20.useEffect)(() => {
22043
22372
  const from = prevPhase.current;
22044
22373
  prevPhase.current = phase;
22045
22374
  if (from === phase) return;
@@ -22051,14 +22380,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22051
22380
  queueRef.current = [];
22052
22381
  }
22053
22382
  }, [phase, startRecording, speakReply, teardownCapture, stopPlayback]);
22054
- (0, import_react19.useEffect)(
22383
+ (0, import_react20.useEffect)(
22055
22384
  () => () => {
22056
22385
  teardownCapture();
22057
22386
  stopPlayback();
22058
22387
  },
22059
22388
  [teardownCapture, stopPlayback]
22060
22389
  );
22061
- const toggle = (0, import_react19.useCallback)(() => {
22390
+ const toggle = (0, import_react20.useCallback)(() => {
22062
22391
  if (!available) return;
22063
22392
  const current = phaseRef.current;
22064
22393
  if (current === "idle") {
@@ -22072,7 +22401,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22072
22401
  }
22073
22402
  apply({ kind: "userStop", mode: modeRef.current });
22074
22403
  }, [available, apply, finishRecording]);
22075
- const changeMode = (0, import_react19.useCallback)(
22404
+ const changeMode = (0, import_react20.useCallback)(
22076
22405
  (next) => {
22077
22406
  apply({ kind: "userStop", mode: modeRef.current });
22078
22407
  setMode(next);
@@ -22083,199 +22412,34 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22083
22412
  }
22084
22413
 
22085
22414
  // src/App.tsx
22086
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
22087
- function closeStreamingAssistant2(items) {
22088
- const last = items[items.length - 1];
22089
- if (!last || last.kind !== "assistant" || !last.streaming) return items;
22090
- return [...items.slice(0, -1), { ...last, streaming: false }];
22091
- }
22092
- function reconstructChatItems2(messages) {
22093
- let items = [];
22094
- for (const msg of messages) {
22095
- if (msg.role === "user") {
22096
- items = closeStreamingAssistant2(items);
22097
- items.push({ kind: "user", text: msg.content, attachments: msg.attachments });
22098
- } else if (msg.role === "assistant") {
22099
- items = closeStreamingAssistant2(items);
22100
- if (msg.parts && msg.parts.length > 0) {
22101
- for (const part of msg.parts) {
22102
- if (part.type === "text") {
22103
- items.push({ kind: "assistant", text: part.text, streaming: false });
22104
- } else if (part.type === "thinking" && part.text.trim().length > 0) {
22105
- items.push({ kind: "thinking", text: part.text });
22106
- } else if (part.type === "tool_use") {
22107
- items.push({
22108
- kind: "tool",
22109
- id: part.id,
22110
- name: part.name,
22111
- args: part.args,
22112
- result: null
22113
- });
22114
- }
22115
- }
22116
- } else {
22117
- items.push({ kind: "assistant", text: msg.content, streaming: false });
22118
- }
22119
- } else if (msg.role === "tool") {
22120
- const toolCallId = msg.toolCallId;
22121
- if (toolCallId) {
22122
- const idx = items.findIndex(
22123
- (it) => it.kind === "tool" && it.id === toolCallId && it.result === null
22124
- );
22125
- if (idx !== -1) {
22126
- const toolItem = items[idx];
22127
- items[idx] = { ...toolItem, result: msg.content };
22128
- } else {
22129
- items.push({
22130
- kind: "tool",
22131
- id: toolCallId,
22132
- name: "unknown_tool",
22133
- args: {},
22134
- result: msg.content
22135
- });
22136
- }
22137
- }
22138
- }
22139
- }
22140
- return closeStreamingAssistant2(items);
22141
- }
22142
- function reducer(state, action) {
22143
- switch (action.kind) {
22144
- case "send-user":
22145
- return {
22146
- ...state,
22147
- status: "streaming",
22148
- errorText: null,
22149
- items: [...state.items, { kind: "user", text: action.text, attachments: action.attachments }]
22150
- };
22151
- case "append-chunk": {
22152
- const last = state.items[state.items.length - 1];
22153
- if (last && last.kind === "assistant" && last.streaming) {
22154
- const updated = { ...last, text: last.text + action.text };
22155
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22156
- }
22157
- return {
22158
- ...state,
22159
- items: [...state.items, { kind: "assistant", text: action.text, streaming: true }]
22160
- };
22161
- }
22162
- case "append-thinking": {
22163
- const last = state.items[state.items.length - 1];
22164
- if (last && last.kind === "thinking") {
22165
- const updated = { ...last, text: last.text + action.text };
22166
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22167
- }
22168
- return {
22169
- ...state,
22170
- items: [...state.items, { kind: "thinking", text: action.text }]
22171
- };
22172
- }
22173
- case "tool-call":
22174
- return {
22175
- ...state,
22176
- items: [
22177
- ...closeStreamingAssistant2(state.items),
22178
- { kind: "tool", id: action.id, name: action.name, args: action.args, result: null }
22179
- ]
22180
- };
22181
- case "tool-result": {
22182
- const idx = state.items.findIndex(
22183
- (it) => it.kind === "tool" && it.id === action.id && it.result === null
22184
- );
22185
- if (idx < 0) return state;
22186
- const tool = state.items[idx];
22187
- const updated = { ...tool, result: action.content };
22188
- return {
22189
- ...state,
22190
- items: [...state.items.slice(0, idx), updated, ...state.items.slice(idx + 1)]
22191
- };
22192
- }
22193
- case "permission-request":
22194
- return {
22195
- ...state,
22196
- pendingConfirms: [
22197
- ...state.pendingConfirms,
22198
- { id: action.id, toolName: action.toolName, args: action.args }
22199
- ]
22200
- };
22201
- case "permission-resolved":
22202
- return {
22203
- ...state,
22204
- pendingConfirms: state.pendingConfirms.filter((p) => p.id !== action.id)
22205
- };
22206
- case "done":
22207
- return {
22208
- ...state,
22209
- status: "idle",
22210
- pendingConfirms: [],
22211
- items: closeStreamingAssistant2(state.items)
22212
- };
22213
- case "clear":
22214
- return {
22215
- ...state,
22216
- items: [],
22217
- status: "idle",
22218
- errorText: null,
22219
- pendingConfirms: [],
22220
- contextUsage: null
22221
- };
22222
- case "error":
22223
- return {
22224
- ...state,
22225
- status: "error",
22226
- errorText: action.text,
22227
- pendingConfirms: [],
22228
- items: closeStreamingAssistant2(state.items)
22229
- };
22230
- case "load-history": {
22231
- const historyItems = reconstructChatItems2(action.messages);
22232
- return {
22233
- ...state,
22234
- items: historyItems,
22235
- status: "idle",
22236
- errorText: null,
22237
- pendingConfirms: []
22238
- };
22239
- }
22240
- case "context-usage":
22241
- return {
22242
- ...state,
22243
- contextUsage: action.usage
22244
- };
22245
- }
22246
- }
22415
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
22247
22416
  function App({ postMessage, layout = "compact" }) {
22248
- const [chatState, dispatch] = (0, import_react20.useReducer)(reducer, {
22249
- items: [],
22250
- status: "idle",
22251
- errorText: null,
22252
- pendingConfirms: [],
22253
- contextUsage: null
22254
- });
22255
- const [agents, setAgents] = (0, import_react20.useState)([]);
22256
- const [sessions, setSessions] = (0, import_react20.useState)([]);
22257
- const [selectedAgentId, setSelectedAgentId] = (0, import_react20.useState)(null);
22258
- const [selectedSessionId, setSelectedSessionId] = (0, import_react20.useState)(null);
22259
- const [showSessions, setShowSessions] = (0, import_react20.useState)(false);
22260
- const [showAllAgents, setShowAllAgents] = (0, import_react20.useState)(false);
22261
- const [pendingDelete, setPendingDelete] = (0, import_react20.useState)(null);
22262
- const [activeScreen, setActiveScreen] = (0, import_react20.useState)("chat");
22263
- const [settingsData, setSettingsData] = (0, import_react20.useState)(null);
22264
- const [modelsResult, setModelsResult] = (0, import_react20.useState)(null);
22265
- const [acpRegistry, setAcpRegistry] = (0, import_react20.useState)(null);
22266
- const [acpInstall, setAcpInstall] = (0, import_react20.useState)(null);
22267
- const [refreshingSourceId, setRefreshingSourceId] = (0, import_react20.useState)(null);
22268
- const [refreshOutcome, setRefreshOutcome] = (0, import_react20.useState)(null);
22269
- const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react20.useState)(null);
22270
- const [taskRuns, setTaskRuns] = (0, import_react20.useState)({});
22271
- const [voiceConfig, setVoiceConfig] = (0, import_react20.useState)(null);
22272
- const [sttCatalogResult, setSttCatalogResult] = (0, import_react20.useState)(null);
22273
- const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react20.useState)(null);
22274
- const [composerDraft, setComposerDraft] = (0, import_react20.useState)("");
22275
- (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)(() => {
22276
22440
  postMessage({ type: "webviewReady" });
22277
22441
  }, []);
22278
- (0, import_react20.useEffect)(() => {
22442
+ (0, import_react21.useEffect)(() => {
22279
22443
  function handle(event) {
22280
22444
  const msg = event.data;
22281
22445
  if (!msg || typeof msg !== "object" || !("type" in msg)) return;
@@ -22398,15 +22562,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22398
22562
  if (voice2) msg.voice = true;
22399
22563
  postMessage(msg);
22400
22564
  };
22401
- const onConfirm = (0, import_react20.useCallback)((id, decision) => {
22565
+ const onConfirm = (0, import_react21.useCallback)((id, decision) => {
22402
22566
  dispatch({ kind: "permission-resolved", id });
22403
22567
  postMessage({ type: "permission_response", id, decision });
22404
22568
  }, [postMessage]);
22405
22569
  const onAbort = () => {
22406
22570
  postMessage({ type: "abort" });
22407
22571
  };
22408
- const confirmCards = (0, import_react20.useMemo)(
22409
- () => 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)),
22410
22574
  [chatState.pendingConfirms, onConfirm]
22411
22575
  );
22412
22576
  const onSelectAgent = (agentId) => {
@@ -22446,7 +22610,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22446
22610
  const cancelDeleteSession = () => {
22447
22611
  setPendingDelete(null);
22448
22612
  };
22449
- (0, import_react20.useEffect)(() => {
22613
+ (0, import_react21.useEffect)(() => {
22450
22614
  if (!pendingDelete) return;
22451
22615
  function handleKeyDown(event) {
22452
22616
  if (event.key === "Escape") {
@@ -22461,7 +22625,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22461
22625
  setShowSessions(!showSessions);
22462
22626
  }
22463
22627
  };
22464
- (0, import_react20.useEffect)(() => {
22628
+ (0, import_react21.useEffect)(() => {
22465
22629
  function handleClickOutside(event) {
22466
22630
  const target = event.target;
22467
22631
  if (showSessions && !target.closest(".app__sessions-dropdown")) {
@@ -22474,45 +22638,46 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22474
22638
  const composerDisabled = chatState.status === "streaming" || chatState.pendingConfirms.length > 0 || !selectedAgentId;
22475
22639
  const selectedAgentName = agents.find((a) => a.id === selectedAgentId)?.name;
22476
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
+ ] });
22477
22667
  if (activeScreen === "projects" && layout === "sidebar") {
22478
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app", style: { height: "100%" }, children: [
22479
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__header-row", children: [
22480
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__logo-title-wrapper", onClick: () => setActiveScreen("chat"), style: { cursor: "pointer" }, children: [
22481
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22482
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Caretaker" })
22483
- ] }),
22484
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__controls", children: [
22485
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("button", { className: "app__sessions-btn", onClick: () => setActiveScreen("chat"), children: [
22486
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }),
22487
- " Chat"
22488
- ] }),
22489
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22490
- "button",
22491
- {
22492
- className: "app__settings-btn",
22493
- onClick: () => {
22494
- setActiveScreen("settings");
22495
- postMessage({ type: "getSettingsData" });
22496
- },
22497
- title: "Caretaker Settings",
22498
- children: [
22499
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Settings, { size: 13 }),
22500
- " Settings"
22501
- ]
22502
- }
22503
- )
22504
- ] })
22505
- ] }) }),
22506
- /* @__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 }) })
22507
22671
  ] });
22508
22672
  }
22509
22673
  if (activeScreen === "settings") {
22510
- 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)(
22511
22675
  SettingsPanel,
22512
22676
  {
22513
22677
  layout,
22514
22678
  postMessage,
22515
22679
  settingsData,
22680
+ initialTab: settingsTab,
22516
22681
  modelsResult,
22517
22682
  acpRegistry,
22518
22683
  acpInstall,
@@ -22529,144 +22694,112 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22529
22694
  onClose: () => setActiveScreen("chat")
22530
22695
  }
22531
22696
  ) });
22697
+ return layout === "sidebar" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "app app--with-sidebar", children: [
22698
+ navRail,
22699
+ panel
22700
+ ] }) : panel;
22532
22701
  }
22533
- 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: [
22534
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
22535
- /* @__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: [
22536
22705
  "Delete conversation \u201C",
22537
22706
  pendingDelete.title,
22538
22707
  "\u201D? This cannot be undone."
22539
22708
  ] }),
22540
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__confirm-buttons", children: [
22541
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
22542
- /* @__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" })
22543
22712
  ] })
22544
22713
  ] }) });
22545
22714
  if (layout === "sidebar") {
22546
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app app--with-sidebar", children: [
22547
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("aside", { className: "app__sidebar", children: [
22548
- /* @__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: [
22549
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22550
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Caretaker" })
22551
- ] }) }),
22552
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-content", children: [
22553
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section", children: [
22554
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
22555
- /* @__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)(
22556
22735
  "button",
22557
22736
  {
22558
- className: "app__sidebar-agent-item app__sidebar-agent-item--collapsed-active",
22559
- onClick: () => setShowAllAgents(true),
22560
- title: "Switch Agent",
22561
- children: [
22562
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
22563
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
22564
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
22565
- ]
22566
- }
22567
- ) : /* @__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) => {
22568
- const isSelected = selectedAgentId === agent.id;
22569
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22570
- "button",
22571
- {
22572
- className: `app__sidebar-agent-item ${isSelected ? "app__sidebar-agent-item--active" : ""}`,
22573
- onClick: () => {
22574
- if (isSelected) {
22575
- setShowAllAgents(false);
22576
- } else {
22577
- onSelectAgent(agent.id);
22578
- }
22579
- },
22580
- children: [
22581
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
22582
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
22583
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
22584
- ]
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
+ }
22585
22744
  },
22586
- agent.id
22587
- );
22588
- }) }) })
22589
- ] }),
22590
- selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section", children: [
22591
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-section-header", children: [
22592
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
22593
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22594
- "button",
22595
- {
22596
- className: "app__sidebar-new-chat-btn",
22597
- onClick: onCreateSession,
22598
- title: "New Chat",
22599
- children: "+ New"
22600
- }
22601
- )
22602
- ] }),
22603
- /* @__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)(
22604
- "div",
22605
- {
22606
- className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
22607
- onClick: () => onSelectSession(session.id),
22608
22745
  children: [
22609
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }) }),
22610
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
22611
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22612
- "button",
22613
- {
22614
- className: "app__sidebar-session-delete",
22615
- title: "Delete conversation",
22616
- onClick: (e) => {
22617
- e.stopPropagation();
22618
- onDeleteSession(session.id, session.title);
22619
- },
22620
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 })
22621
- }
22622
- )
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 })
22623
22749
  ]
22624
22750
  },
22625
- session.id
22626
- )) })
22627
- ] })
22751
+ agent.id
22752
+ );
22753
+ }) }) })
22628
22754
  ] }),
22629
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sidebar-footer", style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
22630
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22631
- "button",
22632
- {
22633
- className: "app__sidebar-settings-btn",
22634
- onClick: () => {
22635
- setActiveScreen("projects");
22636
- },
22637
- title: "Projects & Autonomous Tasks",
22638
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
22639
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FolderKanban, { size: 13 }),
22640
- " Projects"
22641
- ] })
22642
- }
22643
- ),
22644
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22645
- "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",
22646
22770
  {
22647
- className: "app__sidebar-settings-btn",
22648
- onClick: () => {
22649
- setActiveScreen("settings");
22650
- postMessage({ type: "getSettingsData" });
22651
- },
22652
- title: "Caretaker Settings",
22771
+ className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
22772
+ onClick: () => onSelectSession(session.id),
22653
22773
  children: [
22654
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Settings, { className: "app__settings-icon", size: 14 }),
22655
- /* @__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
+ )
22656
22788
  ]
22657
- }
22658
- )
22789
+ },
22790
+ session.id
22791
+ )) })
22659
22792
  ] })
22660
- ] }),
22661
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
22662
- /* @__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: [
22663
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
22664
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "app__chat-header-status", children: [
22665
- /* @__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" : ""}` }),
22666
22799
  chatState.status === "streaming" ? "Streaming response..." : "Ready"
22667
22800
  ] })
22668
22801
  ] }) }),
22669
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22802
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22670
22803
  MessageList,
22671
22804
  {
22672
22805
  items: chatState.items,
@@ -22676,12 +22809,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22676
22809
  trailing: confirmCards
22677
22810
  }
22678
22811
  ),
22679
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__error", children: [
22680
- /* @__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 }),
22681
22814
  " ",
22682
22815
  chatState.errorText || voice.error
22683
22816
  ] }),
22684
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22817
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22685
22818
  Composer,
22686
22819
  {
22687
22820
  disabled: composerDisabled,
@@ -22700,30 +22833,30 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22700
22833
  onValueChange: setComposerDraft
22701
22834
  }
22702
22835
  )
22703
- ] }) : /* @__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" }) }) }),
22704
22837
  deleteOverlay
22705
22838
  ] });
22706
22839
  }
22707
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app", children: [
22708
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__header-row", children: [
22709
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__logo-title-wrapper", children: [
22710
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
22711
- /* @__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" })
22712
22845
  ] }),
22713
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__controls", children: [
22714
- /* @__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)(
22715
22848
  "select",
22716
22849
  {
22717
22850
  className: "app__agent-select",
22718
22851
  value: selectedAgentId ?? "",
22719
22852
  onChange: (e) => onSelectAgent(e.target.value),
22720
22853
  children: [
22721
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
22722
- 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))
22723
22856
  ]
22724
22857
  }
22725
22858
  ) }),
22726
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
22859
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
22727
22860
  "button",
22728
22861
  {
22729
22862
  className: "app__sessions-btn",
@@ -22731,13 +22864,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22731
22864
  disabled: !selectedAgentId,
22732
22865
  title: "View conversations",
22733
22866
  children: [
22734
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageSquare, { size: 13 }),
22867
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MessageSquare, { size: 13 }),
22735
22868
  " ",
22736
22869
  sessions.length
22737
22870
  ]
22738
22871
  }
22739
22872
  ),
22740
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22873
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22741
22874
  "button",
22742
22875
  {
22743
22876
  className: "app__new-chat-btn",
@@ -22747,7 +22880,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22747
22880
  children: "+ New"
22748
22881
  }
22749
22882
  ),
22750
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22883
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22751
22884
  "button",
22752
22885
  {
22753
22886
  className: "app__settings-btn",
@@ -22756,24 +22889,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22756
22889
  postMessage({ type: "getSettingsData" });
22757
22890
  },
22758
22891
  title: "Caretaker Settings",
22759
- 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 })
22760
22893
  }
22761
22894
  )
22762
22895
  ] })
22763
22896
  ] }) }),
22764
- showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sessions-dropdown", children: [
22765
- /* @__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: [
22766
22899
  "Conversations for ",
22767
22900
  selectedAgentName
22768
22901
  ] }),
22769
- /* @__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)(
22770
22903
  "div",
22771
22904
  {
22772
22905
  className: `app__session-item ${selectedSessionId === session.id ? "app__session-item--active" : ""}`,
22773
22906
  onClick: () => onSelectSession(session.id),
22774
22907
  children: [
22775
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "app__session-item-title", children: session.title }),
22776
- /* @__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)(
22777
22910
  "button",
22778
22911
  {
22779
22912
  className: "app__session-item-delete",
@@ -22782,7 +22915,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22782
22915
  e.stopPropagation();
22783
22916
  onDeleteSession(session.id, session.title);
22784
22917
  },
22785
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Trash2, { size: 12 })
22918
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Trash2, { size: 12 })
22786
22919
  }
22787
22920
  )
22788
22921
  ]
@@ -22790,12 +22923,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22790
22923
  session.id
22791
22924
  )) })
22792
22925
  ] }),
22793
- showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
22794
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
22795
- /* @__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" })
22796
22929
  ] }),
22797
- !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" }) }),
22798
- /* @__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)(
22799
22932
  MessageList,
22800
22933
  {
22801
22934
  items: chatState.items,
@@ -22805,12 +22938,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22805
22938
  trailing: confirmCards
22806
22939
  }
22807
22940
  ),
22808
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "app__error", children: [
22809
- /* @__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 }),
22810
22943
  " ",
22811
22944
  chatState.errorText || voice.error
22812
22945
  ] }),
22813
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
22946
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
22814
22947
  Composer,
22815
22948
  {
22816
22949
  disabled: composerDisabled,
@@ -22834,12 +22967,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22834
22967
  }
22835
22968
 
22836
22969
  // src/standalone.tsx
22837
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
22970
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
22838
22971
  function StandaloneApp() {
22839
- const [ws, setWs] = (0, import_react21.useState)(null);
22840
- const [connected, setConnected] = (0, import_react21.useState)(false);
22841
- const [error, setError] = (0, import_react21.useState)(null);
22842
- (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)(() => {
22843
22976
  let active = true;
22844
22977
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
22845
22978
  const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws`);
@@ -22885,7 +23018,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22885
23018
  }
22886
23019
  };
22887
23020
  if (error) {
22888
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: {
23021
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: {
22889
23022
  display: "flex",
22890
23023
  flexDirection: "column",
22891
23024
  alignItems: "center",
@@ -22897,9 +23030,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22897
23030
  padding: "20px",
22898
23031
  textAlign: "center"
22899
23032
  }, children: [
22900
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
22901
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: error }),
22902
- /* @__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)(
22903
23036
  "button",
22904
23037
  {
22905
23038
  onClick: () => setWs(null),
@@ -22918,7 +23051,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22918
23051
  ] });
22919
23052
  }
22920
23053
  if (!connected) {
22921
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: {
23054
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: {
22922
23055
  display: "flex",
22923
23056
  flexDirection: "column",
22924
23057
  alignItems: "center",
@@ -22928,7 +23061,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22928
23061
  background: "#1e1e1e",
22929
23062
  color: "#f1f1f1"
22930
23063
  }, children: [
22931
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: {
23064
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: {
22932
23065
  border: "4px solid rgba(255,255,255,0.1)",
22933
23066
  width: "36px",
22934
23067
  height: "36px",
@@ -22937,8 +23070,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22937
23070
  animation: "spin 1s linear infinite",
22938
23071
  marginBottom: "16px"
22939
23072
  } }),
22940
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Connecting to Caretaker server..." }),
22941
- /* @__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: `
22942
23075
  @keyframes spin {
22943
23076
  0% { transform: rotate(0deg); }
22944
23077
  100% { transform: rotate(360deg); }
@@ -22946,12 +23079,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
22946
23079
  ` })
22947
23080
  ] });
22948
23081
  }
22949
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(App, { postMessage, layout: "sidebar" });
23082
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(App, { postMessage, layout: "sidebar" });
22950
23083
  }
22951
23084
  var rootEl = document.getElementById("root");
22952
23085
  if (!rootEl) throw new Error("#root not found");
22953
23086
  (0, import_client.createRoot)(rootEl).render(
22954
- /* @__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, {}) })
22955
23088
  );
22956
23089
  })();
22957
23090
  /*! Bundled license information: