@hyperwindmill/caretaker-cli 0.16.0 → 0.18.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.
@@ -3276,10 +3276,10 @@
3276
3276
  refCount: 0
3277
3277
  };
3278
3278
  }
3279
- function releaseCache(cache) {
3280
- cache.refCount--;
3281
- 0 === cache.refCount && scheduleCallback$2(NormalPriority, function() {
3282
- cache.controller.abort();
3279
+ function releaseCache(cache2) {
3280
+ cache2.refCount--;
3281
+ 0 === cache2.refCount && scheduleCallback$2(NormalPriority, function() {
3282
+ cache2.controller.abort();
3283
3283
  });
3284
3284
  }
3285
3285
  var currentEntangledListeners = null;
@@ -8639,21 +8639,21 @@
8639
8639
  case 23:
8640
8640
  case 22:
8641
8641
  if (null !== fiber.memoizedState && null !== fiber.memoizedState.cachePool) {
8642
- var cache = fiber.memoizedState.cachePool.pool;
8643
- null != cache && cache.refCount++;
8642
+ var cache2 = fiber.memoizedState.cachePool.pool;
8643
+ null != cache2 && cache2.refCount++;
8644
8644
  }
8645
8645
  break;
8646
8646
  case 24:
8647
8647
  releaseCache(fiber.memoizedState.cache);
8648
8648
  }
8649
- cache = fiber.child;
8650
- if (null !== cache) cache.return = fiber, nextEffect = cache;
8649
+ cache2 = fiber.child;
8650
+ if (null !== cache2) cache2.return = fiber, nextEffect = cache2;
8651
8651
  else
8652
8652
  a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) {
8653
- cache = nextEffect;
8654
- var sibling = cache.sibling, returnFiber = cache.return;
8655
- detachFiberAfterEffects(cache);
8656
- if (cache === fiber) {
8653
+ cache2 = nextEffect;
8654
+ var sibling = cache2.sibling, returnFiber = cache2.return;
8655
+ detachFiberAfterEffects(cache2);
8656
+ if (cache2 === fiber) {
8657
8657
  nextEffect = null;
8658
8658
  break a;
8659
8659
  }
@@ -8668,8 +8668,8 @@
8668
8668
  }
8669
8669
  var DefaultAsyncDispatcher = {
8670
8670
  getCacheForType: function(resourceType) {
8671
- var cache = readContext(CacheContext), cacheForType = cache.data.get(resourceType);
8672
- void 0 === cacheForType && (cacheForType = resourceType(), cache.data.set(resourceType, cacheForType));
8671
+ var cache2 = readContext(CacheContext), cacheForType = cache2.data.get(resourceType);
8672
+ void 0 === cacheForType && (cacheForType = resourceType(), cache2.data.set(resourceType, cacheForType));
8673
8673
  return cacheForType;
8674
8674
  },
8675
8675
  cacheSignal: function() {
@@ -11808,24 +11808,24 @@
11808
11808
  var tagCaches = null;
11809
11809
  function getHydratableHoistableCache(type, keyAttribute, ownerDocument) {
11810
11810
  if (null === tagCaches) {
11811
- var cache = /* @__PURE__ */ new Map();
11811
+ var cache2 = /* @__PURE__ */ new Map();
11812
11812
  var caches = tagCaches = /* @__PURE__ */ new Map();
11813
- caches.set(ownerDocument, cache);
11813
+ caches.set(ownerDocument, cache2);
11814
11814
  } else
11815
- caches = tagCaches, cache = caches.get(ownerDocument), cache || (cache = /* @__PURE__ */ new Map(), caches.set(ownerDocument, cache));
11816
- if (cache.has(type)) return cache;
11817
- cache.set(type, null);
11815
+ caches = tagCaches, cache2 = caches.get(ownerDocument), cache2 || (cache2 = /* @__PURE__ */ new Map(), caches.set(ownerDocument, cache2));
11816
+ if (cache2.has(type)) return cache2;
11817
+ cache2.set(type, null);
11818
11818
  ownerDocument = ownerDocument.getElementsByTagName(type);
11819
11819
  for (caches = 0; caches < ownerDocument.length; caches++) {
11820
11820
  var node = ownerDocument[caches];
11821
11821
  if (!(node[internalHoistableMarker] || node[internalInstanceKey] || "link" === type && "stylesheet" === node.getAttribute("rel")) && "http://www.w3.org/2000/svg" !== node.namespaceURI) {
11822
11822
  var nodeKey = node.getAttribute(keyAttribute) || "";
11823
11823
  nodeKey = type + nodeKey;
11824
- var existing = cache.get(nodeKey);
11825
- existing ? existing.push(node) : cache.set(nodeKey, [node]);
11824
+ var existing = cache2.get(nodeKey);
11825
+ existing ? existing.push(node) : cache2.set(nodeKey, [node]);
11826
11826
  }
11827
11827
  }
11828
- return cache;
11828
+ return cache2;
11829
11829
  }
11830
11830
  function mountHoistable(hoistableRoot, type, instance) {
11831
11831
  hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot;
@@ -12755,14 +12755,17 @@
12755
12755
  });
12756
12756
 
12757
12757
  // src/standalone.tsx
12758
- var import_react17 = __toESM(require_react(), 1);
12758
+ var import_react19 = __toESM(require_react(), 1);
12759
12759
  var import_client = __toESM(require_client(), 1);
12760
12760
 
12761
12761
  // src/App.tsx
12762
- var import_react16 = __toESM(require_react(), 1);
12762
+ var import_react18 = __toESM(require_react(), 1);
12763
12763
 
12764
12764
  // src/MessageList.tsx
12765
- var import_react3 = __toESM(require_react(), 1);
12765
+ var import_react4 = __toESM(require_react(), 1);
12766
+
12767
+ // src/MarkdownText.tsx
12768
+ var import_react = __toESM(require_react(), 1);
12766
12769
 
12767
12770
  // ../../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js
12768
12771
  function _getDefaults() {
@@ -14900,8 +14903,7 @@ ${text}</tr>
14900
14903
  var parser = _Parser.parse;
14901
14904
  var lexer = _Lexer.lex;
14902
14905
 
14903
- // src/MarkdownText.tsx
14904
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
14906
+ // src/markdown.ts
14905
14907
  function sanitize(html2) {
14906
14908
  const dangerous = /<(script|style|iframe|object|embed|form|input|button|textarea)[^>]*>.*?<\/\1>|<(script|style|iframe|object|embed|form|input|button|textarea)[^>]*>/gi;
14907
14909
  const sanitized = html2.replace(dangerous, "");
@@ -14910,18 +14912,38 @@ ${text}</tr>
14910
14912
  const jsUrls = /href\s*=\s*["']\s*javascript:[^"']*["']/gi;
14911
14913
  return noEvents.replace(jsUrls, 'href="#"');
14912
14914
  }
14913
- function MarkdownText({ content, inline: inline2 = false }) {
14914
- const html2 = marked.parse(content, {
14915
- breaks: true,
14916
- gfm: true
14917
- });
14918
- const sanitized = sanitize(html2);
14919
- if (inline2) {
14920
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { dangerouslySetInnerHTML: { __html: sanitized } });
14915
+ var cacheLimit = 2e3;
14916
+ var cache = /* @__PURE__ */ new Map();
14917
+ function renderMarkdown(content, useCache = true) {
14918
+ if (useCache) {
14919
+ const hit = cache.get(content);
14920
+ if (hit !== void 0) {
14921
+ cache.delete(content);
14922
+ cache.set(content, hit);
14923
+ return hit;
14924
+ }
14925
+ }
14926
+ const html2 = sanitize(marked.parse(content, { breaks: true, gfm: true }));
14927
+ if (useCache) {
14928
+ cache.set(content, html2);
14929
+ if (cache.size > cacheLimit) {
14930
+ const oldest = cache.keys().next();
14931
+ if (!oldest.done) cache.delete(oldest.value);
14932
+ }
14921
14933
  }
14922
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "markdown-body", dangerouslySetInnerHTML: { __html: sanitized } });
14934
+ return html2;
14923
14935
  }
14924
14936
 
14937
+ // src/MarkdownText.tsx
14938
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
14939
+ var MarkdownText = (0, import_react.memo)(function MarkdownText2({ content, inline: inline2 = false, cache: cache2 = true }) {
14940
+ const html2 = renderMarkdown(content, cache2);
14941
+ if (inline2) {
14942
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { dangerouslySetInnerHTML: { __html: html2 } });
14943
+ }
14944
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "markdown-body", dangerouslySetInnerHTML: { __html: html2 } });
14945
+ });
14946
+
14925
14947
  // src/toolFormat.ts
14926
14948
  var PATH_KEYS = ["path", "file_path", "filePath"];
14927
14949
  function toolSummary(args, max = 80) {
@@ -14970,7 +14992,7 @@ ${text}</tr>
14970
14992
  }
14971
14993
 
14972
14994
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/createLucideIcon.js
14973
- var import_react2 = __toESM(require_react());
14995
+ var import_react3 = __toESM(require_react());
14974
14996
 
14975
14997
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/shared/src/utils.js
14976
14998
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
@@ -14994,7 +15016,7 @@ ${text}</tr>
14994
15016
  };
14995
15017
 
14996
15018
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/Icon.js
14997
- var import_react = __toESM(require_react());
15019
+ var import_react2 = __toESM(require_react());
14998
15020
 
14999
15021
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/defaultAttributes.js
15000
15022
  var defaultAttributes = {
@@ -15010,7 +15032,7 @@ ${text}</tr>
15010
15032
  };
15011
15033
 
15012
15034
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/Icon.js
15013
- var Icon = (0, import_react.forwardRef)(
15035
+ var Icon = (0, import_react2.forwardRef)(
15014
15036
  ({
15015
15037
  color = "currentColor",
15016
15038
  size = 24,
@@ -15020,7 +15042,7 @@ ${text}</tr>
15020
15042
  children,
15021
15043
  iconNode,
15022
15044
  ...rest
15023
- }, ref) => (0, import_react.createElement)(
15045
+ }, ref) => (0, import_react2.createElement)(
15024
15046
  "svg",
15025
15047
  {
15026
15048
  ref,
@@ -15034,7 +15056,7 @@ ${text}</tr>
15034
15056
  ...rest
15035
15057
  },
15036
15058
  [
15037
- ...iconNode.map(([tag2, attrs]) => (0, import_react.createElement)(tag2, attrs)),
15059
+ ...iconNode.map(([tag2, attrs]) => (0, import_react2.createElement)(tag2, attrs)),
15038
15060
  ...Array.isArray(children) ? children : [children]
15039
15061
  ]
15040
15062
  )
@@ -15042,8 +15064,8 @@ ${text}</tr>
15042
15064
 
15043
15065
  // ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/createLucideIcon.js
15044
15066
  var createLucideIcon = (iconName, iconNode) => {
15045
- const Component = (0, import_react2.forwardRef)(
15046
- ({ className, ...props }, ref) => (0, import_react2.createElement)(Icon, {
15067
+ const Component = (0, import_react3.forwardRef)(
15068
+ ({ className, ...props }, ref) => (0, import_react3.createElement)(Icon, {
15047
15069
  ref,
15048
15070
  iconNode,
15049
15071
  className: mergeClasses(
@@ -15324,16 +15346,22 @@ ${text}</tr>
15324
15346
  // src/MessageList.tsx
15325
15347
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
15326
15348
  var STICK_THRESHOLD = 100;
15327
- function MessageList({ items, sessionId = null, trailing, isStreaming, agentName }) {
15328
- const containerRef = (0, import_react3.useRef)(null);
15329
- const prevItemsLengthRef = (0, import_react3.useRef)(items.length);
15330
- const stickRef = (0, import_react3.useRef)(true);
15349
+ var MessageList = (0, import_react4.memo)(function MessageList2({
15350
+ items,
15351
+ sessionId = null,
15352
+ trailing,
15353
+ isStreaming,
15354
+ agentName
15355
+ }) {
15356
+ const containerRef = (0, import_react4.useRef)(null);
15357
+ const prevItemsLengthRef = (0, import_react4.useRef)(items.length);
15358
+ const stickRef = (0, import_react4.useRef)(true);
15331
15359
  const onScroll = () => {
15332
15360
  const c = containerRef.current;
15333
15361
  if (!c) return;
15334
15362
  stickRef.current = c.scrollHeight - c.scrollTop - c.clientHeight <= STICK_THRESHOLD;
15335
15363
  };
15336
- (0, import_react3.useEffect)(() => {
15364
+ (0, import_react4.useEffect)(() => {
15337
15365
  const container = containerRef.current;
15338
15366
  if (!container) return;
15339
15367
  const grew = items.length > prevItemsLengthRef.current;
@@ -15358,8 +15386,29 @@ ${text}</tr>
15358
15386
  ] })
15359
15387
  ] })
15360
15388
  ] });
15361
- }
15362
- function Item({ item, sessionId }) {
15389
+ });
15390
+ var ToolBlock = (0, import_react4.memo)(function ToolBlock2({ item }) {
15391
+ const [open, setOpen] = (0, import_react4.useState)(false);
15392
+ const summary = toolSummary(item.args);
15393
+ const fullArgs = prettyArgs(item.args);
15394
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: "tool", open, onToggle: (e) => setOpen(e.currentTarget.open), children: [
15395
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { className: "tool__header", children: [
15396
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrench, { size: 14 }) }),
15397
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__name", children: item.name }),
15398
+ summary && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__args", children: summary }),
15399
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__status", children: item.result === null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoaderCircle, { className: "tool__spinner", size: 14 }) : item.result === "" ? null : resultMetric(item.result) }),
15400
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__chevron" })
15401
+ ] }),
15402
+ open && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tool__body", children: [
15403
+ fullArgs && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "tool__args-full", children: fullArgs }),
15404
+ item.result !== null && item.result !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tool__result", children: [
15405
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__arrow", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CornerDownRight, { size: 13 }) }),
15406
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool__result-content", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.result }) })
15407
+ ] })
15408
+ ] })
15409
+ ] });
15410
+ });
15411
+ var Item = (0, import_react4.memo)(function Item2({ item, sessionId }) {
15363
15412
  switch (item.kind) {
15364
15413
  case "user":
15365
15414
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble bubble--user", children: [
@@ -15406,7 +15455,7 @@ ${text}</tr>
15406
15455
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble bubble--assistant", children: [
15407
15456
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "bubble__role", children: item.label || "assistant" }),
15408
15457
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble__text", children: [
15409
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text }),
15458
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text, cache: !item.streaming }),
15410
15459
  item.streaming && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "bubble__caret", children: "\u258C" })
15411
15460
  ] })
15412
15461
  ] });
@@ -15417,38 +15466,20 @@ ${text}</tr>
15417
15466
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "thinking__title", children: "Thinking Process" }),
15418
15467
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "thinking__chevron" })
15419
15468
  ] }),
15420
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "thinking__content", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text }) })
15421
- ] });
15422
- case "tool": {
15423
- const summary = toolSummary(item.args);
15424
- const fullArgs = prettyArgs(item.args);
15425
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: "tool", children: [
15426
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { className: "tool__header", children: [
15427
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrench, { size: 14 }) }),
15428
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__name", children: item.name }),
15429
- summary && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__args", children: summary }),
15430
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__status", children: item.result === null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoaderCircle, { className: "tool__spinner", size: 14 }) : item.result === "" ? null : resultMetric(item.result) }),
15431
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__chevron" })
15432
- ] }),
15433
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tool__body", children: [
15434
- fullArgs && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "tool__args-full", children: fullArgs }),
15435
- item.result !== null && item.result !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tool__result", children: [
15436
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool__arrow", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CornerDownRight, { size: 13 }) }),
15437
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool__result-content", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.result }) })
15438
- ] })
15439
- ] })
15469
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "thinking__content", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text, cache: false }) })
15440
15470
  ] });
15441
- }
15471
+ case "tool":
15472
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToolBlock, { item });
15442
15473
  case "notice":
15443
15474
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `notice${item.variant === "block" ? " notice--block" : ""}`, children: [
15444
15475
  item.variant === "block" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TriangleAlert, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Settings, { size: 12 }),
15445
15476
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text })
15446
15477
  ] });
15447
15478
  }
15448
- }
15479
+ });
15449
15480
 
15450
15481
  // src/Composer.tsx
15451
- var import_react4 = __toESM(require_react(), 1);
15482
+ var import_react5 = __toESM(require_react(), 1);
15452
15483
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
15453
15484
  function Composer({
15454
15485
  disabled,
@@ -15460,7 +15491,7 @@ ${text}</tr>
15460
15491
  value: propValue,
15461
15492
  onValueChange: propOnValueChange
15462
15493
  }) {
15463
- const [internalValue, setInternalValue] = (0, import_react4.useState)("");
15494
+ const [internalValue, setInternalValue] = (0, import_react5.useState)("");
15464
15495
  const value = propValue !== void 0 ? propValue : internalValue;
15465
15496
  const setValue = (val) => {
15466
15497
  if (propOnValueChange) {
@@ -15473,10 +15504,10 @@ ${text}</tr>
15473
15504
  setInternalValue(val);
15474
15505
  }
15475
15506
  };
15476
- const [attachments, setAttachments] = (0, import_react4.useState)([]);
15477
- const [isDragging, setIsDragging] = (0, import_react4.useState)(false);
15478
- const fileInputRef = (0, import_react4.useRef)(null);
15479
- const dragCounter = (0, import_react4.useRef)(0);
15507
+ const [attachments, setAttachments] = (0, import_react5.useState)([]);
15508
+ const [isDragging, setIsDragging] = (0, import_react5.useState)(false);
15509
+ const fileInputRef = (0, import_react5.useRef)(null);
15510
+ const dragCounter = (0, import_react5.useRef)(0);
15480
15511
  const send = () => {
15481
15512
  onSend(value, attachments.length > 0 ? attachments : void 0);
15482
15513
  setValue("");
@@ -15736,20 +15767,20 @@ ${text}</tr>
15736
15767
  }
15737
15768
 
15738
15769
  // src/SettingsPanel.tsx
15739
- var import_react13 = __toESM(require_react(), 1);
15770
+ var import_react15 = __toESM(require_react(), 1);
15740
15771
 
15741
15772
  // src/ProvidersTab.tsx
15742
- var import_react5 = __toESM(require_react(), 1);
15773
+ var import_react6 = __toESM(require_react(), 1);
15743
15774
  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
15744
15775
  function ProvidersTab({ config, agents, postMessage }) {
15745
- const [editingProvider, setEditingProvider] = (0, import_react5.useState)(null);
15746
- const [isCreating, setIsCreating] = (0, import_react5.useState)(false);
15747
- const [name, setName] = (0, import_react5.useState)("");
15748
- const [type, setType] = (0, import_react5.useState)("openai");
15749
- const [endpoint, setEndpoint] = (0, import_react5.useState)("");
15750
- const [apiKey, setApiKey] = (0, import_react5.useState)("");
15751
- const [command, setCommand] = (0, import_react5.useState)("");
15752
- const [errorMsg, setErrorMsg] = (0, import_react5.useState)(null);
15776
+ const [editingProvider, setEditingProvider] = (0, import_react6.useState)(null);
15777
+ const [isCreating, setIsCreating] = (0, import_react6.useState)(false);
15778
+ const [name, setName] = (0, import_react6.useState)("");
15779
+ const [type, setType] = (0, import_react6.useState)("openai");
15780
+ const [endpoint, setEndpoint] = (0, import_react6.useState)("");
15781
+ const [apiKey, setApiKey] = (0, import_react6.useState)("");
15782
+ const [command, setCommand] = (0, import_react6.useState)("");
15783
+ const [errorMsg, setErrorMsg] = (0, import_react6.useState)(null);
15753
15784
  const startEdit = (provider) => {
15754
15785
  setEditingProvider(provider);
15755
15786
  setIsCreating(false);
@@ -15975,17 +16006,17 @@ ${text}</tr>
15975
16006
  }
15976
16007
 
15977
16008
  // src/ProjectsTabSettings.tsx
15978
- var import_react7 = __toESM(require_react(), 1);
16009
+ var import_react8 = __toESM(require_react(), 1);
15979
16010
 
15980
16011
  // src/FolderPicker.tsx
15981
- var import_react6 = __toESM(require_react(), 1);
16012
+ var import_react7 = __toESM(require_react(), 1);
15982
16013
  var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
15983
16014
  function FolderPicker({ id, value, onChange, placeholder }) {
15984
- const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
15985
- const [currentPath, setCurrentPath] = (0, import_react6.useState)(null);
15986
- const [directories, setDirectories] = (0, import_react6.useState)([]);
15987
- const [loading, setLoading] = (0, import_react6.useState)(false);
15988
- const [error, setError] = (0, import_react6.useState)(null);
16015
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
16016
+ const [currentPath, setCurrentPath] = (0, import_react7.useState)(null);
16017
+ const [directories, setDirectories] = (0, import_react7.useState)([]);
16018
+ const [loading, setLoading] = (0, import_react7.useState)(false);
16019
+ const [error, setError] = (0, import_react7.useState)(null);
15989
16020
  const fetchDir = async (path) => {
15990
16021
  setLoading(true);
15991
16022
  setError(null);
@@ -16197,21 +16228,21 @@ ${text}</tr>
16197
16228
  // src/ProjectsTabSettings.tsx
16198
16229
  var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
16199
16230
  function ProjectsTabSettings({ config, agents, postMessage }) {
16200
- const [editingProject, setEditingProject] = (0, import_react7.useState)(null);
16201
- const [isCreating, setIsCreating] = (0, import_react7.useState)(false);
16202
- const [name, setName] = (0, import_react7.useState)("");
16203
- const [description, setDescription] = (0, import_react7.useState)("");
16204
- const [workingDir, setWorkingDir] = (0, import_react7.useState)("");
16205
- const [agentId, setAgentId] = (0, import_react7.useState)("");
16206
- const [plannerAgentId, setPlannerAgentId] = (0, import_react7.useState)("");
16207
- const [reviewerAgentId, setReviewerAgentId] = (0, import_react7.useState)("");
16208
- const [planningEnabled, setPlanningEnabled] = (0, import_react7.useState)(null);
16209
- const [reviewEnabled, setReviewEnabled] = (0, import_react7.useState)(null);
16210
- const [sddEnabled, setSddEnabled] = (0, import_react7.useState)(null);
16211
- const [bootstrapText, setBootstrapText] = (0, import_react7.useState)("");
16212
- const [maxRunSecondsText, setMaxRunSecondsText] = (0, import_react7.useState)("");
16213
- const [dockerImage, setDockerImage] = (0, import_react7.useState)("");
16214
- const [errorMsg, setErrorMsg] = (0, import_react7.useState)(null);
16231
+ const [editingProject, setEditingProject] = (0, import_react8.useState)(null);
16232
+ const [isCreating, setIsCreating] = (0, import_react8.useState)(false);
16233
+ const [name, setName] = (0, import_react8.useState)("");
16234
+ const [description, setDescription] = (0, import_react8.useState)("");
16235
+ const [workingDir, setWorkingDir] = (0, import_react8.useState)("");
16236
+ const [agentId, setAgentId] = (0, import_react8.useState)("");
16237
+ const [plannerAgentId, setPlannerAgentId] = (0, import_react8.useState)("");
16238
+ const [reviewerAgentId, setReviewerAgentId] = (0, import_react8.useState)("");
16239
+ const [planningEnabled, setPlanningEnabled] = (0, import_react8.useState)(null);
16240
+ const [reviewEnabled, setReviewEnabled] = (0, import_react8.useState)(null);
16241
+ const [sddEnabled, setSddEnabled] = (0, import_react8.useState)(null);
16242
+ const [bootstrapText, setBootstrapText] = (0, import_react8.useState)("");
16243
+ const [maxRunSecondsText, setMaxRunSecondsText] = (0, import_react8.useState)("");
16244
+ const [dockerImage, setDockerImage] = (0, import_react8.useState)("");
16245
+ const [errorMsg, setErrorMsg] = (0, import_react8.useState)(null);
16215
16246
  const projects = config.projects || [];
16216
16247
  const startEdit = (proj) => {
16217
16248
  setEditingProject(proj);
@@ -16635,7 +16666,7 @@ ${text}</tr>
16635
16666
  }
16636
16667
 
16637
16668
  // src/AgentsTab.tsx
16638
- var import_react8 = __toESM(require_react(), 1);
16669
+ var import_react9 = __toESM(require_react(), 1);
16639
16670
  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
16640
16671
  function AgentsTab({
16641
16672
  config,
@@ -16647,25 +16678,25 @@ ${text}</tr>
16647
16678
  setModelsResult,
16648
16679
  postMessage
16649
16680
  }) {
16650
- const [editingAgent, setEditingAgent] = (0, import_react8.useState)(null);
16651
- const [isCreating, setIsCreating] = (0, import_react8.useState)(false);
16652
- const [name, setName] = (0, import_react8.useState)("");
16653
- const [systemPrompt, setSystemPrompt] = (0, import_react8.useState)("");
16654
- const [provider, setProvider] = (0, import_react8.useState)("");
16655
- const [model, setModel] = (0, import_react8.useState)("");
16656
- const [maxTurns, setMaxTurns] = (0, import_react8.useState)(30);
16657
- const [workingDir, setWorkingDir] = (0, import_react8.useState)("");
16658
- const [permissionMode, setPermissionMode] = (0, import_react8.useState)("");
16659
- const [strictMcp, setStrictMcp] = (0, import_react8.useState)(false);
16660
- const [selectedTools, setSelectedTools] = (0, import_react8.useState)({});
16661
- const [confirmTools, setConfirmTools] = (0, import_react8.useState)({});
16662
- const [selectedPlugins, setSelectedPlugins] = (0, import_react8.useState)({});
16663
- const [selectedMcpServers, setSelectedMcpServers] = (0, import_react8.useState)({});
16664
- const [fetchingModels, setFetchingModels] = (0, import_react8.useState)(false);
16665
- const [errorMsg, setErrorMsg] = (0, import_react8.useState)(null);
16681
+ const [editingAgent, setEditingAgent] = (0, import_react9.useState)(null);
16682
+ const [isCreating, setIsCreating] = (0, import_react9.useState)(false);
16683
+ const [name, setName] = (0, import_react9.useState)("");
16684
+ const [systemPrompt, setSystemPrompt] = (0, import_react9.useState)("");
16685
+ const [provider, setProvider] = (0, import_react9.useState)("");
16686
+ const [model, setModel] = (0, import_react9.useState)("");
16687
+ const [maxTurns, setMaxTurns] = (0, import_react9.useState)(30);
16688
+ const [workingDir, setWorkingDir] = (0, import_react9.useState)("");
16689
+ const [permissionMode, setPermissionMode] = (0, import_react9.useState)("");
16690
+ const [strictMcp, setStrictMcp] = (0, import_react9.useState)(false);
16691
+ const [selectedTools, setSelectedTools] = (0, import_react9.useState)({});
16692
+ const [confirmTools, setConfirmTools] = (0, import_react9.useState)({});
16693
+ const [selectedPlugins, setSelectedPlugins] = (0, import_react9.useState)({});
16694
+ const [selectedMcpServers, setSelectedMcpServers] = (0, import_react9.useState)({});
16695
+ const [fetchingModels, setFetchingModels] = (0, import_react9.useState)(false);
16696
+ const [errorMsg, setErrorMsg] = (0, import_react9.useState)(null);
16666
16697
  const providerType = config.providers.find((p) => p.name === provider)?.type ?? "openai";
16667
16698
  const isClaudeCode = providerType === "claude-code";
16668
- (0, import_react8.useEffect)(() => {
16699
+ (0, import_react9.useEffect)(() => {
16669
16700
  if (modelsResult) {
16670
16701
  setFetchingModels(false);
16671
16702
  if (!modelsResult.ok) {
@@ -17151,7 +17182,7 @@ ${text}</tr>
17151
17182
  }
17152
17183
 
17153
17184
  // src/PluginsTab.tsx
17154
- var import_react9 = __toESM(require_react(), 1);
17185
+ var import_react10 = __toESM(require_react(), 1);
17155
17186
  var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
17156
17187
  function PluginsTab({
17157
17188
  pluginsFile,
@@ -17160,15 +17191,15 @@ ${text}</tr>
17160
17191
  setRefreshOutcome,
17161
17192
  postMessage
17162
17193
  }) {
17163
- const [editingSource, setEditingSource] = (0, import_react9.useState)(null);
17164
- const [isCreating, setIsCreating] = (0, import_react9.useState)(false);
17165
- const [kind, setKind] = (0, import_react9.useState)("git");
17166
- const [url, setUrl] = (0, import_react9.useState)("");
17167
- const [ref, setRef] = (0, import_react9.useState)("");
17168
- const [authToken, setAuthToken] = (0, import_react9.useState)("");
17169
- const [refreshOnStart, setRefreshOnStart] = (0, import_react9.useState)(true);
17170
- const [errorMsg, setErrorMsg] = (0, import_react9.useState)(null);
17171
- (0, import_react9.useEffect)(() => {
17194
+ const [editingSource, setEditingSource] = (0, import_react10.useState)(null);
17195
+ const [isCreating, setIsCreating] = (0, import_react10.useState)(false);
17196
+ const [kind, setKind] = (0, import_react10.useState)("git");
17197
+ const [url, setUrl] = (0, import_react10.useState)("");
17198
+ const [ref, setRef] = (0, import_react10.useState)("");
17199
+ const [authToken, setAuthToken] = (0, import_react10.useState)("");
17200
+ const [refreshOnStart, setRefreshOnStart] = (0, import_react10.useState)(true);
17201
+ const [errorMsg, setErrorMsg] = (0, import_react10.useState)(null);
17202
+ (0, import_react10.useEffect)(() => {
17172
17203
  return () => {
17173
17204
  setRefreshOutcome(null);
17174
17205
  };
@@ -17447,25 +17478,25 @@ ${text}</tr>
17447
17478
  }
17448
17479
 
17449
17480
  // src/McpTab.tsx
17450
- var import_react10 = __toESM(require_react(), 1);
17481
+ var import_react11 = __toESM(require_react(), 1);
17451
17482
  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
17452
17483
  function McpTab({ mcpServersFile, mcpAuthOutcome, setMcpAuthOutcome, postMessage }) {
17453
- const [editingServer, setEditingServer] = (0, import_react10.useState)(null);
17454
- const [isCreating, setIsCreating] = (0, import_react10.useState)(false);
17455
- (0, import_react10.useEffect)(() => {
17484
+ const [editingServer, setEditingServer] = (0, import_react11.useState)(null);
17485
+ const [isCreating, setIsCreating] = (0, import_react11.useState)(false);
17486
+ (0, import_react11.useEffect)(() => {
17456
17487
  return () => {
17457
17488
  setMcpAuthOutcome(null);
17458
17489
  };
17459
17490
  }, []);
17460
- const [name, setName] = (0, import_react10.useState)("");
17461
- const [transport, setTransport] = (0, import_react10.useState)("stdio");
17462
- const [enabled, setEnabled] = (0, import_react10.useState)(true);
17463
- const [command, setCommand] = (0, import_react10.useState)("");
17464
- const [argsStr, setArgsStr] = (0, import_react10.useState)("");
17465
- const [envStr, setEnvStr] = (0, import_react10.useState)("");
17466
- const [url, setUrl] = (0, import_react10.useState)("");
17467
- const [headersStr, setHeadersStr] = (0, import_react10.useState)("");
17468
- const [errorMsg, setErrorMsg] = (0, import_react10.useState)(null);
17491
+ const [name, setName] = (0, import_react11.useState)("");
17492
+ const [transport, setTransport] = (0, import_react11.useState)("stdio");
17493
+ const [enabled, setEnabled] = (0, import_react11.useState)(true);
17494
+ const [command, setCommand] = (0, import_react11.useState)("");
17495
+ const [argsStr, setArgsStr] = (0, import_react11.useState)("");
17496
+ const [envStr, setEnvStr] = (0, import_react11.useState)("");
17497
+ const [url, setUrl] = (0, import_react11.useState)("");
17498
+ const [headersStr, setHeadersStr] = (0, import_react11.useState)("");
17499
+ const [errorMsg, setErrorMsg] = (0, import_react11.useState)(null);
17469
17500
  const startCreate = () => {
17470
17501
  setIsCreating(true);
17471
17502
  setEditingServer(null);
@@ -17846,7 +17877,7 @@ ${text}</tr>
17846
17877
  }
17847
17878
 
17848
17879
  // src/SchedulerTab.tsx
17849
- var import_react11 = __toESM(require_react(), 1);
17880
+ var import_react12 = __toESM(require_react(), 1);
17850
17881
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
17851
17882
  function closeStreamingAssistant(items) {
17852
17883
  const last = items[items.length - 1];
@@ -17905,20 +17936,20 @@ ${text}</tr>
17905
17936
  }
17906
17937
  function SchedulerTab({ config, agents, postMessage, taskRuns = {} }) {
17907
17938
  const tasks = config.scheduler?.tasks || [];
17908
- const [editingTask, setEditingTask] = (0, import_react11.useState)(null);
17909
- const [isCreating, setIsCreating] = (0, import_react11.useState)(false);
17910
- const [viewingTaskLogs, setViewingTaskLogs] = (0, import_react11.useState)(null);
17911
- const [selectedRunId, setSelectedRunId] = (0, import_react11.useState)(null);
17912
- const [name, setName] = (0, import_react11.useState)("");
17913
- const [type, setType] = (0, import_react11.useState)("heartbeat");
17914
- const [enabled, setEnabled] = (0, import_react11.useState)(true);
17915
- const [agentId, setAgentId] = (0, import_react11.useState)("");
17916
- const [workingDir, setWorkingDir] = (0, import_react11.useState)("");
17917
- const [prompt, setPrompt] = (0, import_react11.useState)("");
17918
- const [cron, setCron] = (0, import_react11.useState)("*/15 * * * *");
17919
- const [telegramBotToken, setTelegramBotToken] = (0, import_react11.useState)("");
17920
- const [telegramAllowedChats, setTelegramAllowedChats] = (0, import_react11.useState)("");
17921
- const [errorMsg, setErrorMsg] = (0, import_react11.useState)(null);
17939
+ const [editingTask, setEditingTask] = (0, import_react12.useState)(null);
17940
+ const [isCreating, setIsCreating] = (0, import_react12.useState)(false);
17941
+ const [viewingTaskLogs, setViewingTaskLogs] = (0, import_react12.useState)(null);
17942
+ const [selectedRunId, setSelectedRunId] = (0, import_react12.useState)(null);
17943
+ const [name, setName] = (0, import_react12.useState)("");
17944
+ const [type, setType] = (0, import_react12.useState)("heartbeat");
17945
+ const [enabled, setEnabled] = (0, import_react12.useState)(true);
17946
+ const [agentId, setAgentId] = (0, import_react12.useState)("");
17947
+ const [workingDir, setWorkingDir] = (0, import_react12.useState)("");
17948
+ const [prompt, setPrompt] = (0, import_react12.useState)("");
17949
+ const [cron, setCron] = (0, import_react12.useState)("*/15 * * * *");
17950
+ const [telegramBotToken, setTelegramBotToken] = (0, import_react12.useState)("");
17951
+ const [telegramAllowedChats, setTelegramAllowedChats] = (0, import_react12.useState)("");
17952
+ const [errorMsg, setErrorMsg] = (0, import_react12.useState)(null);
17922
17953
  const startEdit = (task) => {
17923
17954
  setEditingTask(task);
17924
17955
  setIsCreating(false);
@@ -18072,7 +18103,7 @@ ${text}</tr>
18072
18103
  const runs = viewingTaskLogs ? taskRuns[viewingTaskLogs.id] || [] : [];
18073
18104
  const activeRunId = selectedRunId || runs[0]?.runId;
18074
18105
  const activeRun = runs.find((r) => r.runId === activeRunId);
18075
- const activeRunChatItems = activeRun ? reconstructChatItems(activeRun.messages || []) : [];
18106
+ const activeRunChatItems = (0, import_react12.useMemo)(() => activeRun ? reconstructChatItems(activeRun.messages || []) : [], [activeRun]);
18076
18107
  const selectedAgentName = viewingTaskLogs ? agents.find((a) => a.id === viewingTaskLogs.agentId)?.name : "";
18077
18108
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tab-pane scheduler-tab", children: [
18078
18109
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tab-pane__header", children: [
@@ -18468,7 +18499,7 @@ ${text}</tr>
18468
18499
  }
18469
18500
 
18470
18501
  // src/VoiceTab.tsx
18471
- var import_react12 = __toESM(require_react(), 1);
18502
+ var import_react14 = __toESM(require_react(), 1);
18472
18503
 
18473
18504
  // src/voice_utils.ts
18474
18505
  var END_OF_TURN_MS = 1200;
@@ -18492,27 +18523,33 @@ ${text}</tr>
18492
18523
  if (event.mode === "dictate") return "idle";
18493
18524
  return event.empty ? "recording" : "awaiting";
18494
18525
  case "awaiting":
18526
+ if (event.kind === "speechQueued") return event.canSpeak ? "speaking" : phase;
18495
18527
  if (event.kind !== "turnFinished") return phase;
18528
+ if (event.pendingSpeech > 0 && event.canSpeak) return "speaking";
18496
18529
  if (!event.turnComplete) return phase;
18497
18530
  if (!event.sawStreaming) return phase;
18498
18531
  if (event.confirmPending) return phase;
18499
18532
  return event.canSpeak ? "speaking" : "recording";
18500
18533
  case "speaking":
18501
- return event.kind === "playbackEnded" ? "recording" : phase;
18534
+ if (event.kind === "playbackEnded") return event.turnComplete ? "recording" : "awaiting";
18535
+ return phase;
18502
18536
  }
18503
18537
  }
18504
18538
  function stripMarkdownForSpeech(md) {
18505
18539
  return md.replace(/```[\s\S]*?```\n?/g, "").replace(/`([^`]+)`/g, "$1").replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/^\s*[-*+]\s+/gm, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/\n{3,}/g, "\n\n").trim();
18506
18540
  }
18507
- function lastSpokenText(items) {
18508
- for (let i = items.length - 1; i >= 0; i -= 1) {
18509
- const item = items[i];
18510
- if (item.kind !== "assistant") continue;
18511
- if (item.streaming) continue;
18512
- const text = (item.text ?? "").trim();
18513
- return text.length > 0 ? text : null;
18541
+ function isFinal(items, i) {
18542
+ return i < items.length - 1 || items[i].streaming !== true;
18543
+ }
18544
+ function takeFinalizedBubbles(items, cursor) {
18545
+ const texts = [];
18546
+ let i = Math.max(0, Math.min(cursor, items.length));
18547
+ for (; i < items.length && isFinal(items, i); i += 1) {
18548
+ if (items[i].kind !== "assistant") continue;
18549
+ const text = (items[i].text ?? "").trim();
18550
+ if (text) texts.push(text);
18514
18551
  }
18515
- return null;
18552
+ return { texts, cursor: i };
18516
18553
  }
18517
18554
  function voiceSignature(v) {
18518
18555
  if (!v) return "";
@@ -18520,6 +18557,7 @@ ${text}</tr>
18520
18557
  v.enabled === true,
18521
18558
  v.endpoint ?? "",
18522
18559
  v.sttModel ?? "",
18560
+ v.ttsEndpoint ?? "",
18523
18561
  v.ttsModel ?? "",
18524
18562
  v.ttsVoice ?? "",
18525
18563
  v.ttsSpeed ?? "",
@@ -18528,6 +18566,9 @@ ${text}</tr>
18528
18566
  ]);
18529
18567
  }
18530
18568
 
18569
+ // src/VoiceBackendBlock.tsx
18570
+ var import_react13 = __toESM(require_react(), 1);
18571
+
18531
18572
  // src/voice_backend_utils.ts
18532
18573
  function backendStatusText(status) {
18533
18574
  if (status.docker === "denied") return "your user needs to be in the docker group";
@@ -18542,48 +18583,21 @@ ${text}</tr>
18542
18583
  return { lines: parts.filter((line) => line.length > 0), remainder };
18543
18584
  }
18544
18585
 
18545
- // src/VoiceTab.tsx
18586
+ // src/VoiceBackendBlock.tsx
18546
18587
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
18547
- var BACKEND_POLL_MS = 1e4;
18548
18588
  var CONFIRM_DELETE_MS = 4e3;
18549
- var EMPTY = { enabled: false, endpoint: "", sttModel: "" };
18550
- var LOCAL_DEFAULTS = {
18551
- endpoint: "http://127.0.0.1:8969/v1",
18552
- sttModel: "Systran/faster-whisper-small",
18553
- ttsModel: "speaches-ai/Kokoro-82M-v1.0-ONNX",
18554
- ttsVoice: "af_heart"
18555
- };
18556
- function withCurrent(ids, current) {
18557
- const trimmed = current.trim();
18558
- if (!trimmed || ids.includes(trimmed)) return ids;
18559
- return [trimmed, ...ids];
18560
- }
18561
- function voiceLabel(v) {
18562
- const meta = [v.language, v.gender].filter(Boolean).join(", ");
18563
- return meta ? `${v.id} \u2014 ${meta}` : v.id;
18564
- }
18565
- function VoiceTab({ config, onSave, postMessage, catalogResult }) {
18566
- const current = config.voice ?? EMPTY;
18567
- const [enabled, setEnabled] = (0, import_react12.useState)(current.enabled);
18568
- const [endpoint, setEndpoint] = (0, import_react12.useState)(current.endpoint);
18569
- const [apiKey, setApiKey] = (0, import_react12.useState)(current.apiKey ?? "");
18570
- const [sttModel, setSttModel] = (0, import_react12.useState)(current.sttModel);
18571
- const [ttsModel, setTtsModel] = (0, import_react12.useState)(current.ttsModel ?? "");
18572
- const [ttsVoice, setTtsVoice] = (0, import_react12.useState)(current.ttsVoice ?? "");
18573
- const [ttsSpeed, setTtsSpeed] = (0, import_react12.useState)(
18574
- current.ttsSpeed === void 0 ? "" : String(current.ttsSpeed)
18575
- );
18576
- const [lang, setLang] = (0, import_react12.useState)(current.lang ?? "");
18577
- const [fetching, setFetching] = (0, import_react12.useState)(false);
18578
- const [saveState, setSaveState] = (0, import_react12.useState)("idle");
18579
- const pendingSave = (0, import_react12.useRef)(null);
18580
- const [autoStartBackend, setAutoStartBackend] = (0, import_react12.useState)(current.autoStartBackend ?? false);
18581
- const [backendStatus, setBackendStatus] = (0, import_react12.useState)(null);
18582
- const [backendBusy, setBackendBusy] = (0, import_react12.useState)(false);
18583
- const [backendProgress, setBackendProgress] = (0, import_react12.useState)(null);
18584
- const [backendError, setBackendError] = (0, import_react12.useState)(null);
18585
- const [confirmingDelete, setConfirmingDelete] = (0, import_react12.useState)(false);
18586
- const confirmDeleteTimer = (0, import_react12.useRef)(null);
18589
+ function VoiceBackendBlock({
18590
+ target,
18591
+ label,
18592
+ status,
18593
+ onStatusChange,
18594
+ hint
18595
+ }) {
18596
+ const [busy, setBusy] = (0, import_react13.useState)(false);
18597
+ const [progress, setProgress] = (0, import_react13.useState)(null);
18598
+ const [error, setError] = (0, import_react13.useState)(null);
18599
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react13.useState)(false);
18600
+ const confirmDeleteTimer = (0, import_react13.useRef)(null);
18587
18601
  const disarmDelete = () => {
18588
18602
  if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18589
18603
  confirmDeleteTimer.current = null;
@@ -18592,44 +18606,33 @@ ${text}</tr>
18592
18606
  const armDelete = () => {
18593
18607
  if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18594
18608
  setConfirmingDelete(true);
18595
- confirmDeleteTimer.current = setTimeout(() => setConfirmingDelete(false), CONFIRM_DELETE_MS);
18609
+ confirmDeleteTimer.current = setTimeout(
18610
+ () => setConfirmingDelete(false),
18611
+ CONFIRM_DELETE_MS
18612
+ );
18596
18613
  };
18597
- (0, import_react12.useEffect)(
18614
+ (0, import_react13.useEffect)(
18598
18615
  () => () => {
18599
18616
  if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18600
18617
  },
18601
18618
  []
18602
18619
  );
18603
- const lastContainer = (0, import_react12.useRef)(null);
18604
- const adoptBackendStatus = (status) => {
18605
- lastContainer.current = status.container;
18606
- setBackendStatus(status);
18607
- };
18608
- const fetchBackendStatus = async () => {
18609
- try {
18610
- const res = await fetch("/api/voice/backend");
18611
- if (!res.ok) return;
18612
- const status = await res.json();
18613
- if (status.container === "running" && lastContainer.current !== "running") {
18614
- setBackendError(null);
18615
- }
18616
- adoptBackendStatus(status);
18617
- } catch {
18620
+ const lastContainer = (0, import_react13.useRef)(null);
18621
+ (0, import_react13.useEffect)(() => {
18622
+ if (status.container === "running" && lastContainer.current !== "running") {
18623
+ setError(null);
18618
18624
  }
18619
- };
18620
- (0, import_react12.useEffect)(() => {
18621
- fetchBackendStatus();
18622
- const interval = setInterval(fetchBackendStatus, BACKEND_POLL_MS);
18623
- return () => clearInterval(interval);
18624
- }, []);
18625
- const startBackend = async () => {
18626
- setBackendBusy(true);
18627
- setBackendError(null);
18628
- setBackendProgress("Starting\u2026");
18625
+ lastContainer.current = status.container;
18626
+ }, [status]);
18627
+ const query = `?target=${target}`;
18628
+ const start = async () => {
18629
+ setBusy(true);
18630
+ setError(null);
18631
+ setProgress("Starting\u2026");
18629
18632
  try {
18630
- const res = await fetch("/api/voice/backend/start", { method: "POST" });
18633
+ const res = await fetch(`/api/voice/backend/start${query}`, { method: "POST" });
18631
18634
  if (!res.ok || !res.body) {
18632
- setBackendError(await res.text().catch(() => "") || "Start failed.");
18635
+ setError(await res.text().catch(() => "") || "Start failed.");
18633
18636
  return;
18634
18637
  }
18635
18638
  const reader = res.body.getReader();
@@ -18644,76 +18647,175 @@ ${text}</tr>
18644
18647
  );
18645
18648
  buffer = remainder;
18646
18649
  for (const line of lines) {
18647
- let progress;
18650
+ let p;
18648
18651
  try {
18649
- progress = JSON.parse(line);
18652
+ p = JSON.parse(line);
18650
18653
  } catch {
18651
18654
  continue;
18652
18655
  }
18653
- if (progress.status) {
18654
- adoptBackendStatus(progress.status);
18655
- setBackendProgress(null);
18656
- if (progress.step === "error") setBackendError(progress.message);
18656
+ if (p.status) {
18657
+ lastContainer.current = p.status.container;
18658
+ onStatusChange(p.status);
18659
+ setProgress(null);
18660
+ if (p.step === "error") setError(p.message);
18657
18661
  } else {
18658
- setBackendProgress(progress.message);
18662
+ setProgress(p.message);
18659
18663
  }
18660
18664
  }
18661
18665
  }
18662
18666
  } catch (err) {
18663
- setBackendError(err instanceof Error ? err.message : String(err));
18667
+ setError(err instanceof Error ? err.message : String(err));
18664
18668
  } finally {
18665
- setBackendBusy(false);
18666
- setBackendProgress(null);
18667
- fetchBackendStatus();
18669
+ setBusy(false);
18670
+ setProgress(null);
18668
18671
  }
18669
18672
  };
18670
- const stopBackend = async () => {
18671
- setBackendBusy(true);
18672
- setBackendError(null);
18673
+ const stop = async () => {
18674
+ setBusy(true);
18675
+ setError(null);
18673
18676
  try {
18674
- const res = await fetch("/api/voice/backend/stop", { method: "POST" });
18675
- if (res.ok) adoptBackendStatus(await res.json());
18677
+ const res = await fetch(`/api/voice/backend/stop${query}`, { method: "POST" });
18678
+ if (res.ok) {
18679
+ const status2 = await res.json();
18680
+ lastContainer.current = status2.container;
18681
+ onStatusChange(status2);
18682
+ }
18676
18683
  } catch {
18677
18684
  } finally {
18678
- setBackendBusy(false);
18679
- fetchBackendStatus();
18685
+ setBusy(false);
18680
18686
  }
18681
18687
  };
18682
- const deleteBackend = async () => {
18688
+ const remove = async () => {
18683
18689
  disarmDelete();
18684
- setBackendBusy(true);
18685
- setBackendError(null);
18690
+ setBusy(true);
18691
+ setError(null);
18686
18692
  try {
18687
- const res = await fetch("/api/voice/backend/delete", { method: "POST" });
18688
- if (res.ok) adoptBackendStatus(await res.json());
18689
- else setBackendError(await res.text().catch(() => "") || "Delete failed.");
18693
+ const res = await fetch(`/api/voice/backend/delete${query}`, { method: "POST" });
18694
+ if (res.ok) {
18695
+ const status2 = await res.json();
18696
+ lastContainer.current = status2.container;
18697
+ onStatusChange(status2);
18698
+ } else setError(await res.text().catch(() => "") || "Delete failed.");
18690
18699
  } catch {
18691
18700
  } finally {
18692
- setBackendBusy(false);
18693
- fetchBackendStatus();
18701
+ setBusy(false);
18694
18702
  }
18695
18703
  };
18696
- (0, import_react12.useEffect)(() => {
18697
- if (catalogResult) setFetching(false);
18698
- }, [catalogResult]);
18699
- (0, import_react12.useEffect)(() => {
18704
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18705
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "voice-backend-status", children: [
18706
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: progress ?? backendStatusText(status) }),
18707
+ status.container === "running" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: stop, disabled: busy, children: busy ? "Stopping\u2026" : "Stop" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: start, disabled: busy, children: busy ? "Starting\u2026" : "Start" }),
18708
+ status.container !== "absent" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18709
+ "button",
18710
+ {
18711
+ type: "button",
18712
+ onClick: confirmingDelete ? remove : armDelete,
18713
+ disabled: busy,
18714
+ children: confirmingDelete ? "Really delete?" : "Delete"
18715
+ }
18716
+ )
18717
+ ] }),
18718
+ error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { className: "form-error", children: error }),
18719
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("small", { children: [
18720
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
18721
+ label,
18722
+ "."
18723
+ ] }),
18724
+ " ",
18725
+ hint
18726
+ ] })
18727
+ ] });
18728
+ }
18729
+
18730
+ // src/VoiceTab.tsx
18731
+ var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
18732
+ var BACKEND_POLL_MS = 1e4;
18733
+ var EMPTY = { enabled: false, endpoint: "", sttModel: "" };
18734
+ var LOCAL_DEFAULTS = {
18735
+ endpoint: "http://127.0.0.1:8969/v1",
18736
+ sttModel: "Systran/faster-whisper-small",
18737
+ ttsModel: "speaches-ai/Kokoro-82M-v1.0-ONNX",
18738
+ ttsVoice: "af_heart"
18739
+ };
18740
+ var EDGE_TTS_DEFAULTS = {
18741
+ ttsEndpoint: "http://127.0.0.1:5050/v1",
18742
+ ttsModel: "tts-1",
18743
+ ttsVoice: "it-IT-ElsaNeural"
18744
+ };
18745
+ function withCurrent(ids, current) {
18746
+ const trimmed = current.trim();
18747
+ if (!trimmed || ids.includes(trimmed)) return ids;
18748
+ return [trimmed, ...ids];
18749
+ }
18750
+ function voiceLabel(v) {
18751
+ const meta = [v.language, v.gender].filter(Boolean).join(", ");
18752
+ return meta ? `${v.id} \u2014 ${meta}` : v.id;
18753
+ }
18754
+ function VoiceTab({ config, onSave, postMessage, sttCatalogResult, ttsCatalogResult }) {
18755
+ const current = config.voice ?? EMPTY;
18756
+ const [enabled, setEnabled] = (0, import_react14.useState)(current.enabled);
18757
+ const [endpoint, setEndpoint] = (0, import_react14.useState)(current.endpoint);
18758
+ const [apiKey, setApiKey] = (0, import_react14.useState)(current.apiKey ?? "");
18759
+ const [sttModel, setSttModel] = (0, import_react14.useState)(current.sttModel);
18760
+ const [ttsEndpoint, setTtsEndpoint] = (0, import_react14.useState)(current.ttsEndpoint ?? "");
18761
+ const [ttsApiKey, setTtsApiKey] = (0, import_react14.useState)(current.ttsApiKey ?? "");
18762
+ const [ttsModel, setTtsModel] = (0, import_react14.useState)(current.ttsModel ?? "");
18763
+ const [ttsVoice, setTtsVoice] = (0, import_react14.useState)(current.ttsVoice ?? "");
18764
+ const [ttsSpeed, setTtsSpeed] = (0, import_react14.useState)(
18765
+ current.ttsSpeed === void 0 ? "" : String(current.ttsSpeed)
18766
+ );
18767
+ const [lang, setLang] = (0, import_react14.useState)(current.lang ?? "");
18768
+ const [fetching, setFetching] = (0, import_react14.useState)(false);
18769
+ const [fetchingTts, setFetchingTts] = (0, import_react14.useState)(false);
18770
+ const [saveState, setSaveState] = (0, import_react14.useState)("idle");
18771
+ const pendingSave = (0, import_react14.useRef)(null);
18772
+ const [autoStartBackend, setAutoStartBackend] = (0, import_react14.useState)(current.autoStartBackend ?? false);
18773
+ const [backendStatuses, setBackendStatuses] = (0, import_react14.useState)(null);
18774
+ const fetchBackendStatuses = async () => {
18775
+ try {
18776
+ const res = await fetch("/api/voice/backend");
18777
+ if (!res.ok) return;
18778
+ const statuses = await res.json();
18779
+ setBackendStatuses(statuses);
18780
+ } catch {
18781
+ }
18782
+ };
18783
+ (0, import_react14.useEffect)(() => {
18784
+ fetchBackendStatuses();
18785
+ const interval = setInterval(fetchBackendStatuses, BACKEND_POLL_MS);
18786
+ return () => clearInterval(interval);
18787
+ }, []);
18788
+ const adoptStatus = (target) => (status) => {
18789
+ setBackendStatuses(
18790
+ (prev) => prev ? { ...prev, [target]: status } : { stt: status, tts: null }
18791
+ );
18792
+ };
18793
+ (0, import_react14.useEffect)(() => {
18794
+ if (sttCatalogResult) setFetching(false);
18795
+ }, [sttCatalogResult]);
18796
+ (0, import_react14.useEffect)(() => {
18797
+ if (ttsCatalogResult) setFetchingTts(false);
18798
+ }, [ttsCatalogResult]);
18799
+ (0, import_react14.useEffect)(() => {
18700
18800
  if (saveState !== "saving" || pendingSave.current === null) return;
18701
18801
  if (voiceSignature(config.voice) !== pendingSave.current) return;
18702
18802
  setSaveState("saved");
18703
18803
  }, [config.voice, saveState]);
18704
- (0, import_react12.useEffect)(() => {
18804
+ (0, import_react14.useEffect)(() => {
18705
18805
  if (saveState !== "saved") return;
18706
18806
  const clear = setTimeout(() => setSaveState("idle"), 2500);
18707
18807
  return () => clearTimeout(clear);
18708
18808
  }, [saveState]);
18709
- (0, import_react12.useEffect)(() => {
18809
+ (0, import_react14.useEffect)(() => {
18710
18810
  if (saveState !== "saving") return;
18711
18811
  const giveUp = setTimeout(() => setSaveState("idle"), 6e3);
18712
18812
  return () => clearTimeout(giveUp);
18713
18813
  }, [saveState]);
18714
- const catalog = catalogResult?.ok ? catalogResult.catalog : null;
18715
- const fetchError = catalogResult && !catalogResult.ok ? catalogResult.error : null;
18716
- const fetchCatalog = () => {
18814
+ const sttCatalog = sttCatalogResult?.ok ? sttCatalogResult.catalog : null;
18815
+ const sttFetchError = sttCatalogResult && !sttCatalogResult.ok ? sttCatalogResult.error : null;
18816
+ const ttsCatalog = ttsCatalogResult?.ok ? ttsCatalogResult.catalog : !ttsEndpoint.trim() ? sttCatalog : null;
18817
+ const ttsFetchError = ttsCatalogResult && !ttsCatalogResult.ok ? ttsCatalogResult.error : null;
18818
+ const fetchSttCatalog = () => {
18717
18819
  if (!endpoint.trim()) return;
18718
18820
  setFetching(true);
18719
18821
  postMessage({
@@ -18722,10 +18824,22 @@ ${text}</tr>
18722
18824
  apiKey: apiKey.trim() || void 0
18723
18825
  });
18724
18826
  };
18725
- const voicesForModel = catalog?.tts.find((m) => m.id === ttsModel.trim())?.voices ?? [];
18827
+ const fetchTtsCatalog = () => {
18828
+ const ep = ttsEndpoint.trim();
18829
+ setFetchingTts(true);
18830
+ postMessage({
18831
+ type: "fetchVoiceModels",
18832
+ endpoint: ep,
18833
+ apiKey: ttsApiKey.trim() || void 0,
18834
+ target: "tts"
18835
+ });
18836
+ };
18837
+ const voicesForModel = ttsCatalog?.tts.find((m) => m.id === ttsModel.trim())?.voices ?? [];
18726
18838
  const save = () => {
18727
18839
  const voice = { enabled, endpoint: endpoint.trim(), sttModel: sttModel.trim() };
18728
18840
  if (apiKey.trim()) voice.apiKey = apiKey.trim();
18841
+ if (ttsEndpoint.trim()) voice.ttsEndpoint = ttsEndpoint.trim();
18842
+ if (ttsApiKey.trim()) voice.ttsApiKey = ttsApiKey.trim();
18729
18843
  if (ttsModel.trim()) voice.ttsModel = ttsModel.trim();
18730
18844
  if (ttsVoice.trim()) voice.ttsVoice = ttsVoice.trim();
18731
18845
  const speed = Number.parseFloat(ttsSpeed);
@@ -18738,12 +18852,13 @@ ${text}</tr>
18738
18852
  setSaveState("saving");
18739
18853
  onSave({ ...config, voice });
18740
18854
  };
18741
- const showBackendBlock = backendStatus !== null && backendStatus.docker !== "absent" && backendStatus.port !== null;
18742
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "glass-form", children: [
18743
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h4", { children: "Voice" }),
18744
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "glass-form__body", children: [
18745
- !endpoint.trim() && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18746
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18855
+ const showSttBackend = backendStatuses !== null && backendStatuses.stt.docker !== "absent" && backendStatuses.stt.port !== null;
18856
+ const showTtsBackend = backendStatuses !== null && backendStatuses.tts !== null && backendStatuses.tts.docker !== "absent" && backendStatuses.tts.port !== null;
18857
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "glass-form", children: [
18858
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h4", { children: "Voice" }),
18859
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "glass-form__body", children: [
18860
+ !endpoint.trim() && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18861
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18747
18862
  "button",
18748
18863
  {
18749
18864
  type: "button",
@@ -18757,25 +18872,31 @@ ${text}</tr>
18757
18872
  children: "Use local defaults"
18758
18873
  }
18759
18874
  ),
18760
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Fills the form for a fully local backend (a Speaches container on port 8969) that caretaker can run for you if Docker is installed. Nothing is saved yet \u2014 adjust anything, including the port in the endpoint, then press Save; a Start button appears below afterwards." })
18875
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Fills the form for a fully local backend (a Speaches container on port 8969) that caretaker can run for you if Docker is installed. Nothing is saved yet \u2014 adjust anything, including the port in the endpoint, then press Save; a Start button appears below afterwards." })
18761
18876
  ] }),
18762
- showBackendBlock && backendStatus && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18763
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "voice-backend-status", children: [
18764
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: backendProgress ?? backendStatusText(backendStatus) }),
18765
- backendStatus.container === "running" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: stopBackend, disabled: backendBusy, children: backendBusy ? "Stopping\u2026" : "Stop" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: startBackend, disabled: backendBusy, children: backendBusy ? "Starting\u2026" : "Start" }),
18766
- backendStatus.container !== "absent" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18767
- "button",
18768
- {
18769
- type: "button",
18770
- onClick: confirmingDelete ? deleteBackend : armDelete,
18771
- disabled: backendBusy,
18772
- children: confirmingDelete ? "Really delete?" : "Delete"
18773
- }
18774
- )
18775
- ] }),
18776
- backendError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { className: "form-error", children: backendError }),
18777
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "form-group form-group--checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: "voice-backend-autostart", children: [
18778
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18877
+ showSttBackend && backendStatuses && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18878
+ VoiceBackendBlock,
18879
+ {
18880
+ target: "stt",
18881
+ label: "Speech backend (Speaches)",
18882
+ status: backendStatuses.stt,
18883
+ onStatusChange: adoptStatus("stt"),
18884
+ hint: "The first start downloads about 2 GB. The container publishes on the port in your endpoint \u2014 if that port is taken, change it there and save; caretaker never picks a port for you. Delete removes the container but keeps the downloaded models \u2014 try it when the backend misbehaves after switching networks."
18885
+ }
18886
+ ),
18887
+ showTtsBackend && backendStatuses?.tts && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18888
+ VoiceBackendBlock,
18889
+ {
18890
+ target: "tts",
18891
+ label: "Synthesis backend (edge-tts)",
18892
+ status: backendStatuses.tts,
18893
+ onStatusChange: adoptStatus("tts"),
18894
+ hint: "A small image. The container publishes on the port in your synthesis endpoint. Delete removes the container; the image stays cached."
18895
+ }
18896
+ ),
18897
+ (showSttBackend || showTtsBackend) && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group form-group--checkbox", children: [
18898
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: "voice-backend-autostart", children: [
18899
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18779
18900
  "input",
18780
18901
  {
18781
18902
  id: "voice-backend-autostart",
@@ -18785,11 +18906,11 @@ ${text}</tr>
18785
18906
  }
18786
18907
  ),
18787
18908
  "Start automatically with caretaker"
18788
- ] }) }),
18789
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "The first start downloads about 2 GB. The container publishes on the port in your endpoint \u2014 if that port is taken, change it there and save; caretaker never picks a port for you. Delete removes the container but keeps the downloaded models \u2014 try it when the backend misbehaves after switching networks." })
18909
+ ] }),
18910
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Applies to both containers: a Speaches pull does not block the edge-tts start \u2014 they are independent." })
18790
18911
  ] }),
18791
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "form-group form-group--checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: "voice-enabled", children: [
18792
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18912
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "form-group form-group--checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: "voice-enabled", children: [
18913
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18793
18914
  "input",
18794
18915
  {
18795
18916
  id: "voice-enabled",
@@ -18800,9 +18921,9 @@ ${text}</tr>
18800
18921
  ),
18801
18922
  "Enable voice mode"
18802
18923
  ] }) }),
18803
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18804
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-endpoint", children: "Speech Endpoint" }),
18805
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18924
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18925
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-endpoint", children: "Speech Endpoint" }),
18926
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18806
18927
  "input",
18807
18928
  {
18808
18929
  id: "voice-endpoint",
@@ -18812,18 +18933,18 @@ ${text}</tr>
18812
18933
  onChange: (e) => setEndpoint(e.target.value)
18813
18934
  }
18814
18935
  ),
18815
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("small", { children: [
18936
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
18816
18937
  "OpenAI-compatible speech endpoint \u2014 e.g. a local Speaches container. Transcription posts to ",
18817
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "/audio/transcriptions" }),
18818
- ", synthesis to",
18938
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "/audio/transcriptions" }),
18939
+ ". When no separate synthesis endpoint is set below, synthesis also posts to",
18819
18940
  " ",
18820
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "/audio/speech" }),
18821
- ". Leave the synthesis fields empty for dictation only. Voice is unavailable in the VSCode sidebar."
18941
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "/audio/speech" }),
18942
+ " here. Voice is unavailable in the VSCode sidebar."
18822
18943
  ] })
18823
18944
  ] }),
18824
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18825
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-key", children: "API Key (optional)" }),
18826
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18945
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18946
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-key", children: "API Key (optional)" }),
18947
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18827
18948
  "input",
18828
18949
  {
18829
18950
  id: "voice-key",
@@ -18833,30 +18954,30 @@ ${text}</tr>
18833
18954
  onChange: (e) => setApiKey(e.target.value)
18834
18955
  }
18835
18956
  ),
18836
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Stored encrypted. Never sent to the browser \u2014 requests are proxied." })
18957
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Stored encrypted. Never sent to the browser \u2014 requests are proxied." })
18837
18958
  ] }),
18838
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18839
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: fetchCatalog, disabled: fetching || !endpoint.trim(), children: fetching ? "Fetching\u2026" : "Fetch models" }),
18840
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Reads the endpoint's installed models so the fields below become lists. Endpoints that do not report a task per model still work \u2014 the fields stay free text." }),
18841
- fetchError && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("small", { className: "form-error", children: [
18959
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18960
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: fetchSttCatalog, disabled: fetching || !endpoint.trim(), children: fetching ? "Fetching\u2026" : "Fetch models" }),
18961
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Reads the endpoint's installed models so the transcription field below becomes a list. Endpoints that do not report a task per model still work \u2014 the field stays free text." }),
18962
+ sttFetchError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { className: "form-error", children: [
18842
18963
  "Fetch failed: ",
18843
- fetchError
18964
+ sttFetchError
18844
18965
  ] })
18845
18966
  ] }),
18846
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18847
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-stt", children: "Transcription Model" }),
18848
- catalog && catalog.stt.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
18967
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18968
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-stt", children: "Transcription Model" }),
18969
+ sttCatalog && sttCatalog.stt.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
18849
18970
  "select",
18850
18971
  {
18851
18972
  id: "voice-stt",
18852
18973
  value: sttModel,
18853
18974
  onChange: (e) => setSttModel(e.target.value),
18854
18975
  children: [
18855
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "-- Select a model --" }),
18856
- withCurrent(catalog.stt, sttModel).map((id) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: id, children: id }, id))
18976
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "-- Select a model --" }),
18977
+ withCurrent(sttCatalog.stt, sttModel).map((id) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: id, children: id }, id))
18857
18978
  ]
18858
18979
  }
18859
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18980
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18860
18981
  "input",
18861
18982
  {
18862
18983
  id: "voice-stt",
@@ -18867,68 +18988,136 @@ ${text}</tr>
18867
18988
  }
18868
18989
  )
18869
18990
  ] }),
18870
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18871
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-tts", children: "Synthesis Model (optional)" }),
18872
- catalog && catalog.tts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
18991
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
18992
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-tts-endpoint", children: "Synthesis Endpoint (optional)" }),
18993
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18994
+ "input",
18995
+ {
18996
+ id: "voice-tts-endpoint",
18997
+ type: "text",
18998
+ placeholder: "Leave empty when one server does both",
18999
+ value: ttsEndpoint,
19000
+ onChange: (e) => setTtsEndpoint(e.target.value)
19001
+ }
19002
+ ),
19003
+ !ttsEndpoint.trim() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19004
+ "button",
19005
+ {
19006
+ type: "button",
19007
+ onClick: () => {
19008
+ setTtsEndpoint(EDGE_TTS_DEFAULTS.ttsEndpoint);
19009
+ setTtsModel(EDGE_TTS_DEFAULTS.ttsModel);
19010
+ setTtsVoice(EDGE_TTS_DEFAULTS.ttsVoice);
19011
+ },
19012
+ style: { marginTop: "0.4em" },
19013
+ children: "Use Microsoft Edge voices"
19014
+ }
19015
+ ),
19016
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
19017
+ "Leave empty when one server does both. A local openai-edge-tts container gives you Microsoft Neural voices such as",
19018
+ " ",
19019
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "it-IT-ElsaNeural" }),
19020
+ " or ",
19021
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "it-IT-DiegoNeural" }),
19022
+ ", but cannot transcribe \u2014 transcription always uses the endpoint above. Nothing is saved yet \u2014 press Save after adjusting."
19023
+ ] })
19024
+ ] }),
19025
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19026
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-tts-key", children: "Synthesis API Key (optional)" }),
19027
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19028
+ "input",
19029
+ {
19030
+ id: "voice-tts-key",
19031
+ type: "password",
19032
+ placeholder: "Leave empty for a local server with no auth",
19033
+ value: ttsApiKey,
19034
+ onChange: (e) => setTtsApiKey(e.target.value)
19035
+ }
19036
+ ),
19037
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Stored encrypted. Only sent to the synthesis endpoint \u2014 the transcription key is never sent there, and vice versa." })
19038
+ ] }),
19039
+ ttsEndpoint.trim() && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19040
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19041
+ "button",
19042
+ {
19043
+ type: "button",
19044
+ onClick: fetchTtsCatalog,
19045
+ disabled: fetchingTts,
19046
+ children: fetchingTts ? "Fetching\u2026" : "Fetch synthesis models"
19047
+ }
19048
+ ),
19049
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
19050
+ "Reads the synthesis endpoint's models and voices. For edge-tts, the voice list comes from ",
19051
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "/voices/all" }),
19052
+ "."
19053
+ ] }),
19054
+ ttsFetchError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { className: "form-error", children: [
19055
+ "Fetch failed: ",
19056
+ ttsFetchError
19057
+ ] })
19058
+ ] }),
19059
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19060
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-tts", children: "Synthesis Model (optional)" }),
19061
+ ttsCatalog && ttsCatalog.tts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
18873
19062
  "select",
18874
19063
  {
18875
19064
  id: "voice-tts",
18876
19065
  value: ttsModel,
18877
19066
  onChange: (e) => {
18878
19067
  setTtsModel(e.target.value);
18879
- const next = catalog.tts.find((m) => m.id === e.target.value);
19068
+ const next = ttsCatalog.tts.find((m) => m.id === e.target.value);
18880
19069
  if (next && !next.voices.some((v) => v.id === ttsVoice)) {
18881
19070
  setTtsVoice(next.voices.length === 1 ? next.voices[0].id : "");
18882
19071
  }
18883
19072
  },
18884
19073
  children: [
18885
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "-- None (dictation only) --" }),
19074
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "-- None (dictation only) --" }),
18886
19075
  withCurrent(
18887
- catalog.tts.map((m) => m.id),
19076
+ ttsCatalog.tts.map((m) => m.id),
18888
19077
  ttsModel
18889
- ).map((id) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: id, children: id }, id))
19078
+ ).map((id) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: id, children: id }, id))
18890
19079
  ]
18891
19080
  }
18892
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
19081
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18893
19082
  "input",
18894
19083
  {
18895
19084
  id: "voice-tts",
18896
19085
  type: "text",
18897
- placeholder: "e.g. speaches-ai/Kokoro-82M-v1.0-ONNX",
19086
+ placeholder: "e.g. speaches-ai/Kokoro-82M-v1.0-ONNX or tts-1",
18898
19087
  value: ttsModel,
18899
19088
  onChange: (e) => setTtsModel(e.target.value)
18900
19089
  }
18901
19090
  ),
18902
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Required for conversation mode. Without it, only dictation is offered." })
19091
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Required for conversation mode. Without it, only dictation is offered." })
18903
19092
  ] }),
18904
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18905
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-voice", children: "Voice (optional)" }),
18906
- voicesForModel.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
19093
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19094
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-voice", children: "Voice (optional)" }),
19095
+ voicesForModel.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
18907
19096
  "select",
18908
19097
  {
18909
19098
  id: "voice-voice",
18910
19099
  value: ttsVoice,
18911
19100
  onChange: (e) => setTtsVoice(e.target.value),
18912
19101
  children: [
18913
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "-- Select a voice --" }),
18914
- voicesForModel.map((v) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: v.id, children: voiceLabel(v) }, v.id))
19102
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "-- Select a voice --" }),
19103
+ voicesForModel.map((v) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: v.id, children: voiceLabel(v) }, v.id))
18915
19104
  ]
18916
19105
  }
18917
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
19106
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18918
19107
  "input",
18919
19108
  {
18920
19109
  id: "voice-voice",
18921
19110
  type: "text",
18922
- placeholder: "e.g. if_sara",
19111
+ placeholder: "e.g. af_heart or it-IT-ElsaNeural",
18923
19112
  value: ttsVoice,
18924
19113
  onChange: (e) => setTtsVoice(e.target.value)
18925
19114
  }
18926
19115
  ),
18927
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Pick one whose language matches yours. A model trained mostly on English keeps an English inflection even on its other-language voices." })
19116
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Pick one whose language matches yours. A model trained mostly on English keeps an English inflection even on its other-language voices." })
18928
19117
  ] }),
18929
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18930
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-speed", children: "Speaking Rate (optional)" }),
18931
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
19118
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19119
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-speed", children: "Speaking Rate (optional)" }),
19120
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18932
19121
  "input",
18933
19122
  {
18934
19123
  id: "voice-speed",
@@ -18941,11 +19130,11 @@ ${text}</tr>
18941
19130
  onChange: (e) => setTtsSpeed(e.target.value)
18942
19131
  }
18943
19132
  ),
18944
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "Multiplier, clamped to 0.5\u20132. Useful because some voices are just slow: raise it if the reply drags. Piper responds less to this than Kokoro, since for Piper it stretches phoneme durations." })
19133
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: "Multiplier, clamped to 0.5\u20132. Useful because some voices are just slow: raise it if the reply drags. Piper responds less to this than Kokoro, since for Piper it stretches phoneme durations." })
18945
19134
  ] }),
18946
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18947
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "voice-lang", children: "Language (optional)" }),
18948
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
19135
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-group", children: [
19136
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "voice-lang", children: "Language (optional)" }),
19137
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
18949
19138
  "input",
18950
19139
  {
18951
19140
  id: "voice-lang",
@@ -18957,21 +19146,22 @@ ${text}</tr>
18957
19146
  )
18958
19147
  ] })
18959
19148
  ] }),
18960
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-actions", children: [
18961
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: save, children: "Save" }),
18962
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { role: "status", "aria-live": "polite", className: "form-save-state", children: saveState === "saving" ? "Saving\u2026" : saveState === "saved" ? "Saved \u2713" : "" })
19149
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "form-actions", children: [
19150
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: save, children: "Save" }),
19151
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { role: "status", "aria-live": "polite", className: "form-save-state", children: saveState === "saving" ? "Saving\u2026" : saveState === "saved" ? "Saved \u2713" : "" })
18963
19152
  ] })
18964
19153
  ] });
18965
19154
  }
18966
19155
 
18967
19156
  // src/SettingsPanel.tsx
18968
- var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
19157
+ var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
18969
19158
  function SettingsPanel({
18970
19159
  layout = "compact",
18971
19160
  postMessage,
18972
19161
  settingsData,
18973
19162
  modelsResult,
18974
- voiceCatalogResult,
19163
+ sttCatalogResult,
19164
+ ttsCatalogResult,
18975
19165
  setModelsResult,
18976
19166
  refreshingSourceId,
18977
19167
  refreshOutcome,
@@ -18981,16 +19171,16 @@ ${text}</tr>
18981
19171
  taskRuns = {},
18982
19172
  onClose
18983
19173
  }) {
18984
- const [activeTab, setActiveTab] = (0, import_react13.useState)("providers");
19174
+ const [activeTab, setActiveTab] = (0, import_react15.useState)("providers");
18985
19175
  if (!settingsData) {
18986
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
18987
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
18988
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArrowLeft, { size: 14 }),
19176
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
19177
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
19178
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { size: 14 }),
18989
19179
  " Back to Chat"
18990
19180
  ] }),
18991
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "settings-panel__loading-spinner", children: [
18992
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "spinner" }),
18993
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Loading configurations..." })
19181
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "settings-panel__loading-spinner", children: [
19182
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "spinner" }),
19183
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Loading configurations..." })
18994
19184
  ] })
18995
19185
  ] });
18996
19186
  }
@@ -18998,7 +19188,7 @@ ${text}</tr>
18998
19188
  const renderTabContent = () => {
18999
19189
  switch (activeTab) {
19000
19190
  case "providers":
19001
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19191
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19002
19192
  ProvidersTab,
19003
19193
  {
19004
19194
  config,
@@ -19007,7 +19197,7 @@ ${text}</tr>
19007
19197
  }
19008
19198
  );
19009
19199
  case "projects":
19010
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19200
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19011
19201
  ProjectsTabSettings,
19012
19202
  {
19013
19203
  config,
@@ -19016,7 +19206,7 @@ ${text}</tr>
19016
19206
  }
19017
19207
  );
19018
19208
  case "agents":
19019
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19209
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19020
19210
  AgentsTab,
19021
19211
  {
19022
19212
  config,
@@ -19030,7 +19220,7 @@ ${text}</tr>
19030
19220
  }
19031
19221
  );
19032
19222
  case "plugins":
19033
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19223
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19034
19224
  PluginsTab,
19035
19225
  {
19036
19226
  pluginsFile,
@@ -19041,7 +19231,7 @@ ${text}</tr>
19041
19231
  }
19042
19232
  );
19043
19233
  case "mcp":
19044
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19234
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19045
19235
  McpTab,
19046
19236
  {
19047
19237
  mcpServersFile,
@@ -19051,7 +19241,7 @@ ${text}</tr>
19051
19241
  }
19052
19242
  );
19053
19243
  case "scheduler":
19054
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19244
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19055
19245
  SchedulerTab,
19056
19246
  {
19057
19247
  config,
@@ -19061,27 +19251,28 @@ ${text}</tr>
19061
19251
  }
19062
19252
  );
19063
19253
  case "voice":
19064
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19254
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19065
19255
  VoiceTab,
19066
19256
  {
19067
19257
  config,
19068
19258
  onSave: (updatedConfig) => postMessage({ type: "saveConfig", config: updatedConfig }),
19069
19259
  postMessage,
19070
- catalogResult: voiceCatalogResult
19260
+ sttCatalogResult,
19261
+ ttsCatalogResult
19071
19262
  }
19072
19263
  );
19073
19264
  }
19074
19265
  };
19075
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "settings-panel", children: [
19076
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: "settings-panel__header", children: [
19077
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
19078
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArrowLeft, { size: 14 }),
19266
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "settings-panel", children: [
19267
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: "settings-panel__header", children: [
19268
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
19269
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { size: 14 }),
19079
19270
  " Chat"
19080
19271
  ] }),
19081
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "settings-panel__title", children: "Caretaker Config" })
19272
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { className: "settings-panel__title", children: "Caretaker Config" })
19082
19273
  ] }),
19083
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("nav", { className: "settings-panel__tabs", children: [
19084
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19274
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("nav", { className: "settings-panel__tabs", children: [
19275
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19085
19276
  "button",
19086
19277
  {
19087
19278
  className: `settings-panel__tab-btn ${activeTab === "providers" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19089,7 +19280,7 @@ ${text}</tr>
19089
19280
  children: "Providers"
19090
19281
  }
19091
19282
  ),
19092
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19283
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19093
19284
  "button",
19094
19285
  {
19095
19286
  className: `settings-panel__tab-btn ${activeTab === "projects" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19097,7 +19288,7 @@ ${text}</tr>
19097
19288
  children: "Projects"
19098
19289
  }
19099
19290
  ),
19100
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19291
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19101
19292
  "button",
19102
19293
  {
19103
19294
  className: `settings-panel__tab-btn ${activeTab === "agents" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19105,7 +19296,7 @@ ${text}</tr>
19105
19296
  children: "Agents"
19106
19297
  }
19107
19298
  ),
19108
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19299
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19109
19300
  "button",
19110
19301
  {
19111
19302
  className: `settings-panel__tab-btn ${activeTab === "plugins" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19113,7 +19304,7 @@ ${text}</tr>
19113
19304
  children: "Plugins"
19114
19305
  }
19115
19306
  ),
19116
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19307
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19117
19308
  "button",
19118
19309
  {
19119
19310
  className: `settings-panel__tab-btn ${activeTab === "mcp" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19121,7 +19312,7 @@ ${text}</tr>
19121
19312
  children: "MCP"
19122
19313
  }
19123
19314
  ),
19124
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19315
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19125
19316
  "button",
19126
19317
  {
19127
19318
  className: `settings-panel__tab-btn ${activeTab === "scheduler" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19129,7 +19320,7 @@ ${text}</tr>
19129
19320
  children: "Scheduler"
19130
19321
  }
19131
19322
  ),
19132
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19323
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19133
19324
  "button",
19134
19325
  {
19135
19326
  className: `settings-panel__tab-btn ${activeTab === "voice" ? "settings-panel__tab-btn--active" : ""}`,
@@ -19138,13 +19329,13 @@ ${text}</tr>
19138
19329
  }
19139
19330
  )
19140
19331
  ] }),
19141
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("main", { className: "settings-panel__content", children: renderTabContent() })
19332
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("main", { className: "settings-panel__content", children: renderTabContent() })
19142
19333
  ] });
19143
19334
  }
19144
19335
 
19145
19336
  // src/ProjectsTab.tsx
19146
- var import_react14 = __toESM(require_react(), 1);
19147
- var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
19337
+ var import_react16 = __toESM(require_react(), 1);
19338
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
19148
19339
  var LS_PROJECT_KEY = "caretaker.taskView.selectedProjectId";
19149
19340
  var LS_ARCHIVED_KEY = "caretaker.taskView.showArchived";
19150
19341
  function loadSavedProjectId() {
@@ -19235,15 +19426,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19235
19426
  }
19236
19427
  var PAGE_SIZE = 20;
19237
19428
  function ProjectsTab({ agents }) {
19238
- const [projects, setProjects] = (0, import_react14.useState)([]);
19239
- const [selectedProjectId, setSelectedProjectId] = (0, import_react14.useState)(loadSavedProjectId);
19240
- const [tasks, setTasks] = (0, import_react14.useState)([]);
19241
- const [selectedTaskId, setSelectedTaskId] = (0, import_react14.useState)(null);
19242
- const [taskMessages, setTaskMessages] = (0, import_react14.useState)([]);
19243
- const [view, setView] = (0, import_react14.useState)("list");
19244
- const [page, setPage] = (0, import_react14.useState)(0);
19245
- const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react14.useState)(false);
19246
- const [newTask, setNewTask] = (0, import_react14.useState)({
19429
+ const [projects, setProjects] = (0, import_react16.useState)([]);
19430
+ const [selectedProjectId, setSelectedProjectId] = (0, import_react16.useState)(loadSavedProjectId);
19431
+ const [tasks, setTasks] = (0, import_react16.useState)([]);
19432
+ const [selectedTaskId, setSelectedTaskId] = (0, import_react16.useState)(null);
19433
+ const [taskMessages, setTaskMessages] = (0, import_react16.useState)([]);
19434
+ const [view, setView] = (0, import_react16.useState)("list");
19435
+ const [page, setPage] = (0, import_react16.useState)(0);
19436
+ const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react16.useState)(false);
19437
+ const [newTask, setNewTask] = (0, import_react16.useState)({
19247
19438
  title: "",
19248
19439
  objective: "",
19249
19440
  checklistText: "",
@@ -19252,19 +19443,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19252
19443
  plannerAgentId: "",
19253
19444
  reviewerAgentId: ""
19254
19445
  });
19255
- const [composerText, setComposerText] = (0, import_react14.useState)("");
19256
- const [isSending, setIsSending] = (0, import_react14.useState)(false);
19257
- const [showArchived, setShowArchived] = (0, import_react14.useState)(loadShowArchived);
19258
- const [pendingConfirm, setPendingConfirm] = (0, import_react14.useState)(null);
19259
- const [taskError, setTaskError] = (0, import_react14.useState)(null);
19260
- const threadIntervalRef = (0, import_react14.useRef)(null);
19261
- (0, import_react14.useEffect)(() => {
19446
+ const [composerText, setComposerText] = (0, import_react16.useState)("");
19447
+ const [isSending, setIsSending] = (0, import_react16.useState)(false);
19448
+ const [showArchived, setShowArchived] = (0, import_react16.useState)(loadShowArchived);
19449
+ const [pendingConfirm, setPendingConfirm] = (0, import_react16.useState)(null);
19450
+ const [taskError, setTaskError] = (0, import_react16.useState)(null);
19451
+ const threadIntervalRef = (0, import_react16.useRef)(null);
19452
+ (0, import_react16.useEffect)(() => {
19262
19453
  fetchProjects();
19263
19454
  return () => {
19264
19455
  stopThreadPolling();
19265
19456
  };
19266
19457
  }, []);
19267
- (0, import_react14.useEffect)(() => {
19458
+ (0, import_react16.useEffect)(() => {
19268
19459
  if (projects.length > 0 && selectedProjectId === null) {
19269
19460
  setSelectedProjectId(projects[0].id);
19270
19461
  }
@@ -19275,13 +19466,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19275
19466
  setSelectedProjectId(null);
19276
19467
  }
19277
19468
  }, [projects]);
19278
- (0, import_react14.useEffect)(() => {
19469
+ (0, import_react16.useEffect)(() => {
19279
19470
  saveProjectId(selectedProjectId);
19280
19471
  }, [selectedProjectId]);
19281
- (0, import_react14.useEffect)(() => {
19472
+ (0, import_react16.useEffect)(() => {
19282
19473
  saveShowArchived(showArchived);
19283
19474
  }, [showArchived]);
19284
- (0, import_react14.useEffect)(() => {
19475
+ (0, import_react16.useEffect)(() => {
19285
19476
  if (selectedProjectId !== null) {
19286
19477
  fetchTasks(selectedProjectId);
19287
19478
  setView("list");
@@ -19293,7 +19484,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19293
19484
  setTasks([]);
19294
19485
  }
19295
19486
  }, [selectedProjectId, showArchived]);
19296
- (0, import_react14.useEffect)(() => {
19487
+ (0, import_react16.useEffect)(() => {
19297
19488
  if (selectedTaskId !== null) {
19298
19489
  fetchTaskMessages(selectedTaskId);
19299
19490
  startThreadPolling(selectedTaskId);
@@ -19466,7 +19657,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19466
19657
  const cancelPendingAction = () => {
19467
19658
  setPendingConfirm(null);
19468
19659
  };
19469
- (0, import_react14.useEffect)(() => {
19660
+ (0, import_react16.useEffect)(() => {
19470
19661
  if (!pendingConfirm) return;
19471
19662
  function handleKeyDown(event) {
19472
19663
  if (event.key === "Escape") {
@@ -19476,7 +19667,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19476
19667
  window.addEventListener("keydown", handleKeyDown);
19477
19668
  return () => window.removeEventListener("keydown", handleKeyDown);
19478
19669
  }, [pendingConfirm]);
19479
- (0, import_react14.useEffect)(() => {
19670
+ (0, import_react16.useEffect)(() => {
19480
19671
  if (!taskError) return;
19481
19672
  const t = setTimeout(() => setTaskError(null), 5e3);
19482
19673
  return () => clearTimeout(t);
@@ -19579,6 +19770,25 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19579
19770
  setTaskError("Failed to update task setting");
19580
19771
  }
19581
19772
  };
19773
+ const handleSaveTaskDetails = async (task, title, objective) => {
19774
+ setTaskError(null);
19775
+ try {
19776
+ const res = await fetch(`/api/tasks/${task.id}`, {
19777
+ method: "PATCH",
19778
+ headers: { "Content-Type": "application/json" },
19779
+ body: JSON.stringify({ title, objective })
19780
+ });
19781
+ if (res.ok) {
19782
+ if (selectedProjectId !== null) fetchTasks(selectedProjectId);
19783
+ } else {
19784
+ const data = await res.json().catch(() => ({}));
19785
+ setTaskError(data.error || "Failed to save task details");
19786
+ }
19787
+ } catch (err) {
19788
+ console.error("Failed to save task details:", err);
19789
+ setTaskError("Failed to save task details");
19790
+ }
19791
+ };
19582
19792
  const backToList = () => {
19583
19793
  setView("list");
19584
19794
  setSelectedTaskId(null);
@@ -19588,16 +19798,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19588
19798
  const selectedProject = projects.find((p) => p.id === selectedProjectId);
19589
19799
  const selectedTask = tasks.find((t) => t.id === selectedTaskId);
19590
19800
  const selectedProjectAgentName = agents.find((a) => a.id === selectedProject?.agentId)?.name || "Default Agent";
19591
- const agentLabelFor = (agentId) => {
19592
- const a = agents.find((x) => x.id === agentId);
19593
- return a ? `${a.name} \xB7 ${a.model}` : void 0;
19594
- };
19595
- const developerId = selectedTask?.agentId || selectedProject?.agentId || agents[0]?.id;
19596
- const taskAgentLabels = selectedTask ? {
19597
- developer: agentLabelFor(developerId),
19598
- planner: agentLabelFor(selectedTask.plannerAgentId || selectedProject?.plannerAgentId || developerId),
19599
- reviewer: agentLabelFor(selectedTask.reviewerAgentId || selectedProject?.reviewerAgentId || developerId)
19600
- } : void 0;
19801
+ const taskAgentLabels = (0, import_react16.useMemo)(() => {
19802
+ if (!selectedTask) return void 0;
19803
+ const agentLabelFor = (agentId) => {
19804
+ const a = agents.find((x) => x.id === agentId);
19805
+ return a ? `${a.name} \xB7 ${a.model}` : void 0;
19806
+ };
19807
+ const developerId = selectedTask.agentId || selectedProject?.agentId || agents[0]?.id;
19808
+ return {
19809
+ developer: agentLabelFor(developerId),
19810
+ planner: agentLabelFor(selectedTask.plannerAgentId || selectedProject?.plannerAgentId || developerId),
19811
+ reviewer: agentLabelFor(selectedTask.reviewerAgentId || selectedProject?.reviewerAgentId || developerId)
19812
+ };
19813
+ }, [
19814
+ selectedTask?.agentId,
19815
+ selectedTask?.plannerAgentId,
19816
+ selectedTask?.reviewerAgentId,
19817
+ selectedProject?.agentId,
19818
+ selectedProject?.plannerAgentId,
19819
+ selectedProject?.reviewerAgentId,
19820
+ selectedTask,
19821
+ agents
19822
+ ]);
19601
19823
  const reviewRound = selectedTask ? taskMessages.filter((m) => m.messageType === "review").length + 1 : 1;
19602
19824
  const isActiveLike = selectedTask ? selectedTask.status === "active" || selectedTask.status === "reviewing" || selectedTask.status === "planning" : false;
19603
19825
  const statusColor = (status) => {
@@ -19622,8 +19844,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19622
19844
  const safePage = Math.min(page, totalPages - 1);
19623
19845
  const pageStart = safePage * PAGE_SIZE;
19624
19846
  const pageTasks = tasks.slice(pageStart, pageStart + PAGE_SIZE);
19625
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
19626
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "No projects registered. Create one from the Settings panel to get started." }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19847
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
19848
+ /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: "No projects registered. Create one from the Settings panel to get started." }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19627
19849
  TaskListView,
19628
19850
  {
19629
19851
  projects,
@@ -19645,7 +19867,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19645
19867
  onArchive: handleArchiveFromList,
19646
19868
  statusColor
19647
19869
  }
19648
- ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19870
+ ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19649
19871
  TaskLogView,
19650
19872
  {
19651
19873
  task: selectedTask,
@@ -19662,7 +19884,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19662
19884
  onToggleStatus: handleToggleTaskStatus,
19663
19885
  statusColor
19664
19886
  }
19665
- ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19887
+ ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19666
19888
  TaskEditView,
19667
19889
  {
19668
19890
  task: selectedTask,
@@ -19676,14 +19898,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19676
19898
  onSetAgent: handleSetTaskAgent,
19677
19899
  onSetFlag: handleSetTaskFlag,
19678
19900
  onSetMaxRun: handleSetTaskMaxRun,
19901
+ onSaveDetails: handleSaveTaskDetails,
19679
19902
  onOpenLog: () => setView("log"),
19680
19903
  statusColor
19681
19904
  }
19682
- ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "app__empty-state", children: [
19683
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "Task not found. Go back to the list." }),
19684
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
19905
+ ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__empty-state", children: [
19906
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: "Task not found. Go back to the list." }),
19907
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
19685
19908
  ] }) : null }),
19686
- isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19909
+ isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19687
19910
  "div",
19688
19911
  {
19689
19912
  style: {
@@ -19698,7 +19921,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19698
19921
  justifyContent: "center",
19699
19922
  zIndex: 999
19700
19923
  },
19701
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
19924
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
19702
19925
  "form",
19703
19926
  {
19704
19927
  onSubmit: handleCreateTask,
@@ -19709,14 +19932,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19709
19932
  background: "var(--vscode-sideBar-background)"
19710
19933
  },
19711
19934
  children: [
19712
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "confirm__header", children: [
19713
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Wrench, { size: 18 }) }),
19714
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
19935
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "confirm__header", children: [
19936
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Wrench, { size: 18 }) }),
19937
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
19715
19938
  ] }),
19716
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
19717
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19939
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
19940
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19718
19941
  "Task Title",
19719
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19942
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19720
19943
  "input",
19721
19944
  {
19722
19945
  type: "text",
@@ -19736,9 +19959,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19736
19959
  }
19737
19960
  )
19738
19961
  ] }),
19739
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19962
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19740
19963
  "Objective (Extended markdown goal description)",
19741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19964
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19742
19965
  "textarea",
19743
19966
  {
19744
19967
  required: true,
@@ -19759,9 +19982,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19759
19982
  }
19760
19983
  )
19761
19984
  ] }),
19762
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19985
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19763
19986
  "Checklist Items (One item per line)",
19764
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19987
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19765
19988
  "textarea",
19766
19989
  {
19767
19990
  placeholder: "Create route handler\nWrite unit tests\nUpdate documentation",
@@ -19781,9 +20004,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19781
20004
  }
19782
20005
  )
19783
20006
  ] }),
19784
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20007
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19785
20008
  "Assigned Agent (optional \u2014 overrides project default)",
19786
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20009
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
19787
20010
  "select",
19788
20011
  {
19789
20012
  value: newTask.agentId,
@@ -19798,8 +20021,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19798
20021
  outline: "none"
19799
20022
  },
19800
20023
  children: [
19801
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
19802
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20024
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20025
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
19803
20026
  a.name,
19804
20027
  " (",
19805
20028
  a.provider,
@@ -19809,9 +20032,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19809
20032
  }
19810
20033
  )
19811
20034
  ] }),
19812
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20035
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19813
20036
  "Planner Agent Override (optional)",
19814
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20037
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
19815
20038
  "select",
19816
20039
  {
19817
20040
  value: newTask.plannerAgentId,
@@ -19826,8 +20049,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19826
20049
  outline: "none"
19827
20050
  },
19828
20051
  children: [
19829
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
19830
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20052
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20053
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
19831
20054
  a.name,
19832
20055
  " (",
19833
20056
  a.provider,
@@ -19837,9 +20060,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19837
20060
  }
19838
20061
  )
19839
20062
  ] }),
19840
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
20063
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
19841
20064
  "Reviewer Agent Override (optional)",
19842
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20065
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
19843
20066
  "select",
19844
20067
  {
19845
20068
  value: newTask.reviewerAgentId,
@@ -19854,8 +20077,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19854
20077
  outline: "none"
19855
20078
  },
19856
20079
  children: [
19857
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
19858
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20080
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20081
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
19859
20082
  a.name,
19860
20083
  " (",
19861
20084
  a.provider,
@@ -19865,8 +20088,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19865
20088
  }
19866
20089
  )
19867
20090
  ] }),
19868
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
19869
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20091
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
20092
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19870
20093
  "input",
19871
20094
  {
19872
20095
  type: "checkbox",
@@ -19875,24 +20098,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19875
20098
  style: { cursor: "pointer" }
19876
20099
  }
19877
20100
  ),
19878
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
20101
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
19879
20102
  ] })
19880
20103
  ] }),
19881
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
19882
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
19883
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
20104
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
20105
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
20106
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
19884
20107
  ] })
19885
20108
  ]
19886
20109
  }
19887
20110
  )
19888
20111
  }
19889
20112
  ),
19890
- pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
19891
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
19892
- /* @__PURE__ */ (0, import_jsx_runtime14.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.` }),
19893
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "app__confirm-buttons", children: [
19894
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
19895
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20113
+ pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
20114
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
20115
+ /* @__PURE__ */ (0, import_jsx_runtime15.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.` }),
20116
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__confirm-buttons", children: [
20117
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
20118
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19896
20119
  "button",
19897
20120
  {
19898
20121
  className: `app__confirm-btn ${pendingConfirm.type === "delete" ? "app__confirm-btn--danger" : ""}`,
@@ -19902,7 +20125,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19902
20125
  )
19903
20126
  ] })
19904
20127
  ] }) }),
19905
- taskError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
20128
+ taskError && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
19906
20129
  ] });
19907
20130
  }
19908
20131
  function TaskListView({
@@ -19925,10 +20148,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19925
20148
  onArchive,
19926
20149
  statusColor
19927
20150
  }) {
19928
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
19929
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "task-view__header", children: [
19930
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
19931
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20151
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
20152
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "task-view__header", children: [
20153
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20154
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19932
20155
  "select",
19933
20156
  {
19934
20157
  className: "task-view__project-filter",
@@ -19945,17 +20168,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19945
20168
  outline: "none",
19946
20169
  cursor: "pointer"
19947
20170
  },
19948
- children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: p.id, children: p.name }, p.id))
20171
+ children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: p.id, children: p.name }, p.id))
19949
20172
  }
19950
20173
  ),
19951
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
20174
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
19952
20175
  "Agent: ",
19953
20176
  agentName
19954
20177
  ] })
19955
20178
  ] }),
19956
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
19957
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "task-view__archived-toggle", children: [
19958
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20179
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
20180
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "task-view__archived-toggle", children: [
20181
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19959
20182
  "input",
19960
20183
  {
19961
20184
  type: "checkbox",
@@ -19966,42 +20189,42 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19966
20189
  ),
19967
20190
  "Show archived"
19968
20191
  ] }),
19969
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
20192
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
19970
20193
  ] })
19971
20194
  ] }),
19972
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { children: [
20195
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { children: [
19973
20196
  "No tasks created for ",
19974
20197
  project.name,
19975
20198
  '. Click "+ New Task" to start.'
19976
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "task-table", children: [
19977
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { children: [
19978
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
19979
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", children: "Title" }),
19980
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
19981
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
19982
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
19983
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
19984
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
19985
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
20199
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: "task-table", children: [
20200
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tr", { children: [
20201
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
20202
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", children: "Title" }),
20203
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
20204
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
20205
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
20206
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
20207
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
20208
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
19986
20209
  ] }) }),
19987
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: tasks.map((task) => {
20210
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { children: tasks.map((task) => {
19988
20211
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
19989
20212
  const totalCount = task.checklist.length;
19990
20213
  const isArchived = !!task.archived;
19991
20214
  const updated = new Date(task.updatedAt);
19992
20215
  const updatedStr = isNaN(updated.getTime()) ? task.updatedAt : updated.toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
19993
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20216
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
19994
20217
  "tr",
19995
20218
  {
19996
20219
  className: `task-table__row${isArchived ? " task-table__row--archived" : ""}`,
19997
20220
  onClick: () => onOpenLog(task),
19998
20221
  children: [
19999
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
20000
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "task-table__title", children: [
20001
- isArchived && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Archive, { size: 11 }),
20222
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
20223
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "task-table__title", children: [
20224
+ isArchived && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Archive, { size: 11 }),
20002
20225
  task.title
20003
20226
  ] }) }),
20004
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20227
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20005
20228
  "span",
20006
20229
  {
20007
20230
  className: "task-table__badge",
@@ -20009,28 +20232,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20009
20232
  children: task.status
20010
20233
  }
20011
20234
  ) }),
20012
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
20013
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "task-table__progress", children: [
20014
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20235
+ /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
20236
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "task-table__progress", children: [
20237
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20015
20238
  "span",
20016
20239
  {
20017
20240
  className: "task-table__progress-fill",
20018
20241
  style: { width: `${completedCount / totalCount * 100}%` }
20019
20242
  }
20020
20243
  ) }),
20021
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "task-table__progress-text", children: [
20244
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "task-table__progress-text", children: [
20022
20245
  completedCount,
20023
20246
  "/",
20024
20247
  totalCount
20025
20248
  ] })
20026
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
20027
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "task-table__branch", children: [
20028
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GitBranch, { size: 11 }),
20029
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: task.branch })
20030
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
20031
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
20032
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
20033
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20249
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
20250
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "task-table__branch", children: [
20251
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GitBranch, { size: 11 }),
20252
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: task.branch })
20253
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
20254
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
20255
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
20256
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20034
20257
  "button",
20035
20258
  {
20036
20259
  className: "task-table__edit-btn",
@@ -20040,10 +20263,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20040
20263
  },
20041
20264
  title: task.archived ? "Unarchive task" : "Archive task",
20042
20265
  "aria-label": task.archived ? "Unarchive task" : "Archive task",
20043
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Archive, { size: 13 })
20266
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Archive, { size: 13 })
20044
20267
  }
20045
20268
  ),
20046
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20269
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20047
20270
  "button",
20048
20271
  {
20049
20272
  className: "task-table__edit-btn",
@@ -20053,7 +20276,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20053
20276
  },
20054
20277
  title: "Edit task",
20055
20278
  "aria-label": "Edit task",
20056
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Pencil, { size: 13 })
20279
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Pencil, { size: 13 })
20057
20280
  }
20058
20281
  )
20059
20282
  ] }) })
@@ -20063,8 +20286,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20063
20286
  );
20064
20287
  }) })
20065
20288
  ] }) }),
20066
- totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "task-table__pagination", children: [
20067
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20289
+ totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "task-table__pagination", children: [
20290
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20068
20291
  "button",
20069
20292
  {
20070
20293
  className: "task-table__page-btn",
@@ -20073,13 +20296,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20073
20296
  children: "\u2039 Prev"
20074
20297
  }
20075
20298
  ),
20076
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "task-table__page-info", children: [
20299
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "task-table__page-info", children: [
20077
20300
  "Page ",
20078
20301
  page + 1,
20079
20302
  " of ",
20080
20303
  totalPages
20081
20304
  ] }),
20082
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20305
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20083
20306
  "button",
20084
20307
  {
20085
20308
  className: "task-table__page-btn",
@@ -20108,19 +20331,20 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20108
20331
  }) {
20109
20332
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
20110
20333
  const totalCount = task.checklist.length;
20111
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
20112
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
20113
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20114
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { size: 13 }) }),
20115
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "app__chat-header-info", children: [
20116
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
20334
+ const chatItems = (0, import_react16.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
20335
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
20336
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
20337
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20338
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrowLeft, { size: 13 }) }),
20339
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__chat-header-info", children: [
20340
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
20117
20341
  "Task #",
20118
20342
  task.id,
20119
20343
  ": ",
20120
20344
  task.title
20121
20345
  ] }),
20122
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
20123
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20346
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
20347
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20124
20348
  "span",
20125
20349
  {
20126
20350
  className: `agent-status-dot agent-status-dot--active ${isActiveLike ? "agent-status-dot--pulsing" : ""}`,
@@ -20131,24 +20355,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20131
20355
  ] })
20132
20356
  ] })
20133
20357
  ] }),
20134
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
20135
- task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20358
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
20359
+ task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20136
20360
  "button",
20137
20361
  {
20138
20362
  className: "confirm__btn confirm__btn--primary",
20139
20363
  onClick: () => onToggleStatus(task),
20140
20364
  title: isActiveLike ? "Pause this task (aborts the running agent)" : "Activate this task",
20141
20365
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
20142
- children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
20143
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Pause, { size: 12 }),
20366
+ children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
20367
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Pause, { size: 12 }),
20144
20368
  " Pause"
20145
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
20146
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Play, { size: 12 }),
20369
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
20370
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Play, { size: 12 }),
20147
20371
  " Activate"
20148
20372
  ] })
20149
20373
  }
20150
20374
  ),
20151
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20375
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20152
20376
  "span",
20153
20377
  {
20154
20378
  className: "task-table__badge",
@@ -20158,8 +20382,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20158
20382
  )
20159
20383
  ] })
20160
20384
  ] }),
20161
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
20162
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20385
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
20386
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20163
20387
  "aside",
20164
20388
  {
20165
20389
  style: {
@@ -20172,19 +20396,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20172
20396
  background: "var(--vscode-sideBar-background, rgba(0,0,0,0.1))"
20173
20397
  },
20174
20398
  children: [
20175
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
20176
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
20177
- totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
20399
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
20400
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
20401
+ totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
20178
20402
  completedCount,
20179
20403
  "/",
20180
20404
  totalCount,
20181
20405
  " done"
20182
20406
  ] })
20183
20407
  ] }),
20184
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
20408
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
20185
20409
  const isDone = item.status === "done";
20186
20410
  const isInProgress = item.status === "in_progress";
20187
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20411
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20188
20412
  "label",
20189
20413
  {
20190
20414
  style: {
@@ -20201,7 +20425,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20201
20425
  },
20202
20426
  title: isInProgress ? "In progress" : isDone ? "Done" : "Pending",
20203
20427
  children: [
20204
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20428
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20205
20429
  "input",
20206
20430
  {
20207
20431
  type: "checkbox",
@@ -20210,7 +20434,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20210
20434
  style: { marginTop: "2px", cursor: "pointer", flexShrink: 0 }
20211
20435
  }
20212
20436
  ),
20213
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
20437
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
20214
20438
  ]
20215
20439
  },
20216
20440
  item.id
@@ -20219,10 +20443,10 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20219
20443
  ]
20220
20444
  }
20221
20445
  ),
20222
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
20223
- taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageList, { items: taskMessagesToChatItems(taskMessages, agentLabels), sessionId: null }),
20224
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("form", { className: "composer", onSubmit: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
20225
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20446
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
20447
+ taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageList, { items: chatItems, sessionId: null }),
20448
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("form", { className: "composer", onSubmit: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
20449
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20226
20450
  "textarea",
20227
20451
  {
20228
20452
  className: "composer__input",
@@ -20238,7 +20462,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20238
20462
  style: { flex: 1, minHeight: "44px" }
20239
20463
  }
20240
20464
  ),
20241
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20465
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20242
20466
  "button",
20243
20467
  {
20244
20468
  type: "submit",
@@ -20265,21 +20489,62 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20265
20489
  onSetAgent,
20266
20490
  onSetFlag,
20267
20491
  onSetMaxRun,
20492
+ onSaveDetails,
20268
20493
  onOpenLog,
20269
20494
  statusColor
20270
20495
  }) {
20271
20496
  const isRunning = task.status === "active" || task.status === "reviewing" || task.status === "planning";
20272
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
20273
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
20274
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20275
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { size: 13 }) }),
20276
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700 }, children: [
20277
- "Task #",
20278
- task.id,
20279
- ": ",
20280
- task.title
20497
+ const [draftTitle, setDraftTitle] = (0, import_react16.useState)(task.title);
20498
+ const [draftObjective, setDraftObjective] = (0, import_react16.useState)(task.objective);
20499
+ const [lastTaskId, setLastTaskId] = (0, import_react16.useState)(task.id);
20500
+ const trimmedTitle = draftTitle.trim();
20501
+ const isDirty = trimmedTitle !== task.title.trim() || draftObjective.trim() !== task.objective.trim();
20502
+ (0, import_react16.useEffect)(() => {
20503
+ if (task.id !== lastTaskId) {
20504
+ setDraftTitle(task.title);
20505
+ setDraftObjective(task.objective);
20506
+ setLastTaskId(task.id);
20507
+ } else if (!isDirty) {
20508
+ setDraftTitle(task.title);
20509
+ setDraftObjective(task.objective);
20510
+ }
20511
+ }, [task.id, task.title, task.objective]);
20512
+ const canSave = isDirty && trimmedTitle.length > 0;
20513
+ const resetDraft = () => {
20514
+ setDraftTitle(task.title);
20515
+ setDraftObjective(task.objective);
20516
+ };
20517
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
20518
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
20519
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20520
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrowLeft, { size: 13 }) }),
20521
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
20522
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { opacity: 0.6 }, children: [
20523
+ "Task #",
20524
+ task.id
20525
+ ] }),
20526
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20527
+ "input",
20528
+ {
20529
+ value: draftTitle,
20530
+ onChange: (e) => setDraftTitle(e.target.value),
20531
+ "aria-label": "Task title",
20532
+ title: "Task title",
20533
+ style: {
20534
+ background: "var(--vscode-input-background, #252526)",
20535
+ color: "var(--vscode-input-foreground)",
20536
+ border: "1px solid var(--vscode-input-border, #3c3c3c)",
20537
+ borderRadius: "4px",
20538
+ padding: "3px 6px",
20539
+ fontSize: "14px",
20540
+ fontWeight: 700,
20541
+ outline: "none",
20542
+ minWidth: "240px"
20543
+ }
20544
+ }
20545
+ )
20281
20546
  ] }),
20282
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20547
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20283
20548
  "span",
20284
20549
  {
20285
20550
  className: "task-table__badge",
@@ -20288,8 +20553,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20288
20553
  }
20289
20554
  )
20290
20555
  ] }),
20291
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
20292
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20556
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
20557
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20293
20558
  "button",
20294
20559
  {
20295
20560
  className: "confirm__btn",
@@ -20299,7 +20564,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20299
20564
  children: "View Log"
20300
20565
  }
20301
20566
  ),
20302
- task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20567
+ task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20303
20568
  "button",
20304
20569
  {
20305
20570
  className: "confirm__btn",
@@ -20307,12 +20572,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20307
20572
  title: `Commit pending changes to ${task.branch} and remove the worktree`,
20308
20573
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
20309
20574
  children: [
20310
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GitBranch, { size: 12 }),
20575
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GitBranch, { size: 12 }),
20311
20576
  " Discard worktree"
20312
20577
  ]
20313
20578
  }
20314
20579
  ),
20315
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20580
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20316
20581
  "button",
20317
20582
  {
20318
20583
  className: "confirm__btn",
@@ -20320,28 +20585,28 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20320
20585
  title: task.archived ? "Unarchive this task" : "Archive this task (hides it from the list, excludes from scheduler)",
20321
20586
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
20322
20587
  children: [
20323
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Archive, { size: 12 }),
20588
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Archive, { size: 12 }),
20324
20589
  " ",
20325
20590
  task.archived ? "Unarchive" : "Archive"
20326
20591
  ]
20327
20592
  }
20328
20593
  ),
20329
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20594
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20330
20595
  "button",
20331
20596
  {
20332
20597
  className: "confirm__btn confirm__btn--primary",
20333
20598
  onClick: () => onToggleStatus(task),
20334
20599
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
20335
- children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
20336
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Pause, { size: 12 }),
20600
+ children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
20601
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Pause, { size: 12 }),
20337
20602
  " Pause"
20338
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
20339
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Play, { size: 12 }),
20603
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
20604
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Play, { size: 12 }),
20340
20605
  " Activate"
20341
20606
  ] })
20342
20607
  }
20343
20608
  ),
20344
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20609
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20345
20610
  "button",
20346
20611
  {
20347
20612
  className: "confirm__btn",
@@ -20349,26 +20614,66 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20349
20614
  title: "Permanently delete this task and all its messages",
20350
20615
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px", color: "#ef4444" },
20351
20616
  children: [
20352
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Trash2, { size: 12 }),
20617
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash2, { size: 12 }),
20353
20618
  " Delete"
20354
20619
  ]
20355
20620
  }
20356
20621
  )
20357
20622
  ] })
20358
20623
  ] }),
20359
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
20360
- task.branch && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
20361
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GitBranch, { size: 12 }),
20362
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
20363
- !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
20624
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
20625
+ task.branch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
20626
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GitBranch, { size: 12 }),
20627
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
20628
+ !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
20364
20629
  ] }),
20365
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20366
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
20367
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: "12px", background: "rgba(255,255,255,0.02)", padding: "10px", borderRadius: "6px", border: "1px solid rgba(255,255,255,0.05)", whiteSpace: "pre-wrap" }, children: task.objective })
20630
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20631
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
20632
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20633
+ "textarea",
20634
+ {
20635
+ value: draftObjective,
20636
+ onChange: (e) => setDraftObjective(e.target.value),
20637
+ rows: 6,
20638
+ "aria-label": "Task objective",
20639
+ title: "What the agent should achieve. Read at the start of every cycle, so an edit applies from the next one.",
20640
+ style: {
20641
+ width: "100%",
20642
+ boxSizing: "border-box",
20643
+ fontSize: "12px",
20644
+ fontFamily: "inherit",
20645
+ lineHeight: 1.5,
20646
+ background: "var(--vscode-input-background, #252526)",
20647
+ color: "var(--vscode-input-foreground)",
20648
+ border: "1px solid var(--vscode-input-border, #3c3c3c)",
20649
+ borderRadius: "6px",
20650
+ padding: "10px",
20651
+ outline: "none",
20652
+ resize: "vertical"
20653
+ }
20654
+ }
20655
+ ),
20656
+ isDirty && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
20657
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20658
+ "button",
20659
+ {
20660
+ className: "confirm__btn confirm__btn--primary",
20661
+ onClick: () => {
20662
+ void onSaveDetails(task, trimmedTitle, draftObjective.trim());
20663
+ },
20664
+ disabled: !canSave,
20665
+ title: canSave ? "Save title and objective" : "The title cannot be empty",
20666
+ style: { padding: "3px 10px", fontSize: "10px" },
20667
+ children: "Save"
20668
+ }
20669
+ ),
20670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
20671
+ isRunning && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
20672
+ ] })
20368
20673
  ] }),
20369
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20370
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
20371
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20674
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20675
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
20676
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20372
20677
  "select",
20373
20678
  {
20374
20679
  value: task.agentId || "",
@@ -20388,8 +20693,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20388
20693
  },
20389
20694
  title: isRunning ? "Pause the task before changing its agent" : "Choose which agent runs this task",
20390
20695
  children: [
20391
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
20392
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20696
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20697
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
20393
20698
  a.name,
20394
20699
  " (",
20395
20700
  a.provider,
@@ -20399,9 +20704,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20399
20704
  }
20400
20705
  )
20401
20706
  ] }),
20402
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20403
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
20404
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20707
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
20709
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20405
20710
  "select",
20406
20711
  {
20407
20712
  value: task.plannerAgentId || "",
@@ -20410,8 +20715,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20410
20715
  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 },
20411
20716
  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.",
20412
20717
  children: [
20413
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
20414
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20718
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20719
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
20415
20720
  a.name,
20416
20721
  " (",
20417
20722
  a.provider,
@@ -20421,9 +20726,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20421
20726
  }
20422
20727
  )
20423
20728
  ] }),
20424
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20425
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
20426
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20729
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20730
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
20731
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20427
20732
  "select",
20428
20733
  {
20429
20734
  value: task.reviewerAgentId || "",
@@ -20432,8 +20737,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20432
20737
  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 },
20433
20738
  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.",
20434
20739
  children: [
20435
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Project default" }),
20436
- agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("option", { value: a.id, children: [
20740
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Project default" }),
20741
+ agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.id, children: [
20437
20742
  a.name,
20438
20743
  " (",
20439
20744
  a.provider,
@@ -20443,31 +20748,31 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20443
20748
  }
20444
20749
  )
20445
20750
  ] }),
20446
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20447
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
20448
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
20751
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20752
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
20753
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
20449
20754
  { flag: "planningEnabled", label: "Planning phase", value: task.planningEnabled },
20450
20755
  { flag: "reviewEnabled", label: "Review at DONE", value: task.reviewEnabled },
20451
20756
  { flag: "sddEnabled", label: "SDD mode (.md specs)", value: task.sddEnabled }
20452
- ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
20757
+ ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
20453
20758
  label,
20454
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20759
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20455
20760
  "select",
20456
20761
  {
20457
20762
  value: value === true ? "on" : value === false ? "off" : "inherit",
20458
20763
  onChange: (e) => onSetFlag(task, flag, e.target.value === "inherit" ? null : e.target.value === "on"),
20459
20764
  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" },
20460
20765
  children: [
20461
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "inherit", children: "Project default" }),
20462
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "on", children: "On" }),
20463
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "off", children: "Off" })
20766
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "inherit", children: "Project default" }),
20767
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "on", children: "On" }),
20768
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "off", children: "Off" })
20464
20769
  ]
20465
20770
  }
20466
20771
  )
20467
20772
  ] }, flag)) }),
20468
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
20773
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
20469
20774
  "Max run seconds per cycle",
20470
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20775
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20471
20776
  "input",
20472
20777
  {
20473
20778
  type: "number",
@@ -20490,7 +20795,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20490
20795
  )
20491
20796
  ] })
20492
20797
  ] }),
20493
- task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20798
+ task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20494
20799
  "div",
20495
20800
  {
20496
20801
  style: {
@@ -20503,19 +20808,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20503
20808
  fontSize: "12px"
20504
20809
  },
20505
20810
  children: [
20506
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { children: [
20507
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TriangleAlert, { size: 13 }),
20811
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("strong", { children: [
20812
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TriangleAlert, { size: 13 }),
20508
20813
  " Blocked Reason:"
20509
20814
  ] }),
20510
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
20815
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
20511
20816
  ]
20512
20817
  }
20513
20818
  ),
20514
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
20515
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
20516
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
20819
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
20820
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
20821
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
20517
20822
  const isDone = item.status === "done";
20518
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
20823
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
20519
20824
  "label",
20520
20825
  {
20521
20826
  style: {
@@ -20532,7 +20837,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20532
20837
  opacity: isDone ? 0.6 : 1
20533
20838
  },
20534
20839
  children: [
20535
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20840
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
20536
20841
  "input",
20537
20842
  {
20538
20843
  type: "checkbox",
@@ -20541,7 +20846,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20541
20846
  style: { marginTop: "2px", cursor: "pointer" }
20542
20847
  }
20543
20848
  ),
20544
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: item.text })
20849
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: item.text })
20545
20850
  ]
20546
20851
  },
20547
20852
  item.id
@@ -20553,7 +20858,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20553
20858
  }
20554
20859
 
20555
20860
  // src/useVoice.ts
20556
- var import_react15 = __toESM(require_react(), 1);
20861
+ var import_react17 = __toESM(require_react(), 1);
20557
20862
  function canCapture() {
20558
20863
  return typeof window !== "undefined" && typeof MediaRecorder !== "undefined" && !!navigator.mediaDevices?.getUserMedia;
20559
20864
  }
@@ -20578,34 +20883,37 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20578
20883
  const { voice, chatStatus, pendingConfirmCount, items, onTranscript } = opts;
20579
20884
  const available = !!voice && voice.enabled && voice.configured && canCapture();
20580
20885
  const canSpeak = !!voice?.canSpeak;
20581
- const [phase, setPhase] = (0, import_react15.useState)("idle");
20582
- const [mode, setMode] = (0, import_react15.useState)("dictate");
20583
- const [error, setError] = (0, import_react15.useState)(null);
20584
- const phaseRef = (0, import_react15.useRef)(phase);
20886
+ const [phase, setPhase] = (0, import_react17.useState)("idle");
20887
+ const [mode, setMode] = (0, import_react17.useState)("dictate");
20888
+ const [error, setError] = (0, import_react17.useState)(null);
20889
+ const phaseRef = (0, import_react17.useRef)(phase);
20585
20890
  phaseRef.current = phase;
20586
- const modeRef = (0, import_react15.useRef)(mode);
20891
+ const modeRef = (0, import_react17.useRef)(mode);
20587
20892
  modeRef.current = mode;
20588
- const onTranscriptRef = (0, import_react15.useRef)(onTranscript);
20893
+ const onTranscriptRef = (0, import_react17.useRef)(onTranscript);
20589
20894
  onTranscriptRef.current = onTranscript;
20590
- const itemsRef = (0, import_react15.useRef)(items);
20895
+ const itemsRef = (0, import_react17.useRef)(items);
20591
20896
  itemsRef.current = items;
20592
- const streamRef = (0, import_react15.useRef)(null);
20593
- const recorderRef = (0, import_react15.useRef)(null);
20594
- const chunksRef = (0, import_react15.useRef)([]);
20595
- const vadRef = (0, import_react15.useRef)(null);
20596
- const audioRef = (0, import_react15.useRef)(null);
20597
- const idleTimerRef = (0, import_react15.useRef)(null);
20598
- const heardSpeechRef = (0, import_react15.useRef)(false);
20599
- const sawStreamingRef = (0, import_react15.useRef)(false);
20600
- const spokenBaselineRef = (0, import_react15.useRef)(null);
20601
- const apply = (0, import_react15.useCallback)((event) => {
20897
+ const chatStatusRef = (0, import_react17.useRef)(chatStatus);
20898
+ chatStatusRef.current = chatStatus;
20899
+ const streamRef = (0, import_react17.useRef)(null);
20900
+ const recorderRef = (0, import_react17.useRef)(null);
20901
+ const chunksRef = (0, import_react17.useRef)([]);
20902
+ const vadRef = (0, import_react17.useRef)(null);
20903
+ const audioRef = (0, import_react17.useRef)(null);
20904
+ const idleTimerRef = (0, import_react17.useRef)(null);
20905
+ const heardSpeechRef = (0, import_react17.useRef)(false);
20906
+ const sawStreamingRef = (0, import_react17.useRef)(false);
20907
+ const cursorRef = (0, import_react17.useRef)(0);
20908
+ const queueRef = (0, import_react17.useRef)([]);
20909
+ const apply = (0, import_react17.useCallback)((event) => {
20602
20910
  setPhase((current) => nextPhase(current, event));
20603
20911
  }, []);
20604
20912
  const clearIdleTimer = () => {
20605
20913
  if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
20606
20914
  idleTimerRef.current = null;
20607
20915
  };
20608
- const teardownCapture = (0, import_react15.useCallback)(() => {
20916
+ const teardownCapture = (0, import_react17.useCallback)(() => {
20609
20917
  clearIdleTimer();
20610
20918
  try {
20611
20919
  vadRef.current?.destroy();
@@ -20622,14 +20930,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20622
20930
  chunksRef.current = [];
20623
20931
  heardSpeechRef.current = false;
20624
20932
  }, []);
20625
- const stopPlayback = (0, import_react15.useCallback)(() => {
20933
+ const stopPlayback = (0, import_react17.useCallback)(() => {
20626
20934
  if (audioRef.current) {
20627
20935
  audioRef.current.pause();
20628
20936
  audioRef.current.src = "";
20629
20937
  audioRef.current = null;
20630
20938
  }
20631
20939
  }, []);
20632
- const fail = (0, import_react15.useCallback)(
20940
+ const fail = (0, import_react17.useCallback)(
20633
20941
  (message) => {
20634
20942
  teardownCapture();
20635
20943
  stopPlayback();
@@ -20638,7 +20946,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20638
20946
  },
20639
20947
  [apply, teardownCapture, stopPlayback]
20640
20948
  );
20641
- const finishRecording = (0, import_react15.useCallback)(() => {
20949
+ const finishRecording = (0, import_react17.useCallback)(() => {
20642
20950
  const recorder = recorderRef.current;
20643
20951
  if (!recorder || recorder.state === "inactive") return;
20644
20952
  recorder.onstop = async () => {
@@ -20655,7 +20963,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20655
20963
  if (trimmed) {
20656
20964
  if (currentMode === "conversation") {
20657
20965
  sawStreamingRef.current = false;
20658
- spokenBaselineRef.current = lastSpokenText(itemsRef.current);
20966
+ cursorRef.current = itemsRef.current.length;
20967
+ queueRef.current = [];
20659
20968
  }
20660
20969
  onTranscriptRef.current(trimmed, currentMode);
20661
20970
  }
@@ -20666,7 +20975,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20666
20975
  };
20667
20976
  recorder.stop();
20668
20977
  }, [apply, fail, teardownCapture]);
20669
- const startRecording = (0, import_react15.useCallback)(async () => {
20978
+ const startRecording = (0, import_react17.useCallback)(async () => {
20670
20979
  setError(null);
20671
20980
  chunksRef.current = [];
20672
20981
  heardSpeechRef.current = false;
@@ -20711,10 +21020,14 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20711
21020
  fail(`Microphone unavailable: ${err}`);
20712
21021
  }
20713
21022
  }, [apply, fail, finishRecording, teardownCapture]);
20714
- const speakReply = (0, import_react15.useCallback)(async () => {
20715
- const text = lastSpokenText(itemsRef.current);
20716
- if (!text || text === spokenBaselineRef.current) {
20717
- apply({ kind: "playbackEnded", mode: "conversation" });
21023
+ const speakReply = (0, import_react17.useCallback)(async () => {
21024
+ const text = queueRef.current.shift();
21025
+ if (!text) {
21026
+ apply({
21027
+ kind: "playbackEnded",
21028
+ mode: "conversation",
21029
+ turnComplete: chatStatusRef.current === "idle"
21030
+ });
20718
21031
  return;
20719
21032
  }
20720
21033
  try {
@@ -20730,7 +21043,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20730
21043
  audio.onended = () => {
20731
21044
  URL.revokeObjectURL(url);
20732
21045
  audioRef.current = null;
20733
- setTimeout(() => apply({ kind: "playbackEnded", mode: "conversation" }), POST_PLAYBACK_MS);
21046
+ setTimeout(() => {
21047
+ if (queueRef.current.length > 0) {
21048
+ void speakReply();
21049
+ } else {
21050
+ apply({
21051
+ kind: "playbackEnded",
21052
+ mode: "conversation",
21053
+ turnComplete: chatStatusRef.current === "idle"
21054
+ });
21055
+ }
21056
+ }, POST_PLAYBACK_MS);
20734
21057
  };
20735
21058
  audio.onerror = () => {
20736
21059
  URL.revokeObjectURL(url);
@@ -20741,10 +21064,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20741
21064
  fail(`Synthesis failed: ${err}`);
20742
21065
  }
20743
21066
  }, [apply, fail]);
20744
- (0, import_react15.useEffect)(() => {
21067
+ (0, import_react17.useEffect)(() => {
20745
21068
  if (chatStatus === "streaming") sawStreamingRef.current = true;
20746
21069
  }, [chatStatus]);
20747
- (0, import_react15.useEffect)(() => {
21070
+ (0, import_react17.useEffect)(() => {
21071
+ if (modeRef.current !== "conversation") return;
21072
+ if (phaseRef.current === "idle") return;
21073
+ const { texts, cursor } = takeFinalizedBubbles(items, cursorRef.current);
21074
+ cursorRef.current = cursor;
21075
+ if (texts.length === 0) return;
21076
+ queueRef.current.push(...texts);
21077
+ apply({ kind: "speechQueued", mode: "conversation", canSpeak });
21078
+ }, [items, canSpeak, apply]);
21079
+ (0, import_react17.useEffect)(() => {
20748
21080
  if (phase !== "awaiting") return;
20749
21081
  if (chatStatus === "error") {
20750
21082
  apply({ kind: "failed", mode: "conversation" });
@@ -20759,11 +21091,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20759
21091
  // the loop advances mid-stream and speaks the previous reply.
20760
21092
  turnComplete: chatStatus === "idle",
20761
21093
  sawStreaming: sawStreamingRef.current,
20762
- confirmPending: pendingConfirmCount > 0
21094
+ confirmPending: pendingConfirmCount > 0,
21095
+ // Text queued but not yet played. Non-zero drives awaiting → speaking
21096
+ // regardless of turnComplete, so a bubble closed in the same commit as
21097
+ // the turn ending is never lost to effect ordering.
21098
+ pendingSpeech: queueRef.current.length
20763
21099
  });
20764
21100
  }, [phase, chatStatus, pendingConfirmCount, canSpeak, apply]);
20765
- const prevPhase = (0, import_react15.useRef)("idle");
20766
- (0, import_react15.useEffect)(() => {
21101
+ const prevPhase = (0, import_react17.useRef)("idle");
21102
+ (0, import_react17.useEffect)(() => {
20767
21103
  const from = prevPhase.current;
20768
21104
  prevPhase.current = phase;
20769
21105
  if (from === phase) return;
@@ -20772,16 +21108,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20772
21108
  if (phase === "idle") {
20773
21109
  teardownCapture();
20774
21110
  stopPlayback();
21111
+ queueRef.current = [];
20775
21112
  }
20776
21113
  }, [phase, startRecording, speakReply, teardownCapture, stopPlayback]);
20777
- (0, import_react15.useEffect)(
21114
+ (0, import_react17.useEffect)(
20778
21115
  () => () => {
20779
21116
  teardownCapture();
20780
21117
  stopPlayback();
20781
21118
  },
20782
21119
  [teardownCapture, stopPlayback]
20783
21120
  );
20784
- const toggle = (0, import_react15.useCallback)(() => {
21121
+ const toggle = (0, import_react17.useCallback)(() => {
20785
21122
  if (!available) return;
20786
21123
  const current = phaseRef.current;
20787
21124
  if (current === "idle") {
@@ -20795,7 +21132,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20795
21132
  }
20796
21133
  apply({ kind: "userStop", mode: modeRef.current });
20797
21134
  }, [available, apply, finishRecording]);
20798
- const changeMode = (0, import_react15.useCallback)(
21135
+ const changeMode = (0, import_react17.useCallback)(
20799
21136
  (next) => {
20800
21137
  apply({ kind: "userStop", mode: modeRef.current });
20801
21138
  setMode(next);
@@ -20806,7 +21143,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20806
21143
  }
20807
21144
 
20808
21145
  // src/App.tsx
20809
- var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
21146
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
20810
21147
  function closeStreamingAssistant2(items) {
20811
21148
  const last = items[items.length - 1];
20812
21149
  if (!last || last.kind !== "assistant" || !last.streaming) return items;
@@ -20968,34 +21305,35 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20968
21305
  }
20969
21306
  }
20970
21307
  function App({ postMessage, layout = "compact" }) {
20971
- const [chatState, dispatch] = (0, import_react16.useReducer)(reducer, {
21308
+ const [chatState, dispatch] = (0, import_react18.useReducer)(reducer, {
20972
21309
  items: [],
20973
21310
  status: "idle",
20974
21311
  errorText: null,
20975
21312
  pendingConfirms: [],
20976
21313
  contextUsage: null
20977
21314
  });
20978
- const [agents, setAgents] = (0, import_react16.useState)([]);
20979
- const [sessions, setSessions] = (0, import_react16.useState)([]);
20980
- const [selectedAgentId, setSelectedAgentId] = (0, import_react16.useState)(null);
20981
- const [selectedSessionId, setSelectedSessionId] = (0, import_react16.useState)(null);
20982
- const [showSessions, setShowSessions] = (0, import_react16.useState)(false);
20983
- const [showAllAgents, setShowAllAgents] = (0, import_react16.useState)(false);
20984
- const [pendingDelete, setPendingDelete] = (0, import_react16.useState)(null);
20985
- const [activeScreen, setActiveScreen] = (0, import_react16.useState)("chat");
20986
- const [settingsData, setSettingsData] = (0, import_react16.useState)(null);
20987
- const [modelsResult, setModelsResult] = (0, import_react16.useState)(null);
20988
- const [refreshingSourceId, setRefreshingSourceId] = (0, import_react16.useState)(null);
20989
- const [refreshOutcome, setRefreshOutcome] = (0, import_react16.useState)(null);
20990
- const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react16.useState)(null);
20991
- const [taskRuns, setTaskRuns] = (0, import_react16.useState)({});
20992
- const [voiceConfig, setVoiceConfig] = (0, import_react16.useState)(null);
20993
- const [voiceCatalogResult, setVoiceCatalogResult] = (0, import_react16.useState)(null);
20994
- const [composerDraft, setComposerDraft] = (0, import_react16.useState)("");
20995
- (0, import_react16.useEffect)(() => {
21315
+ const [agents, setAgents] = (0, import_react18.useState)([]);
21316
+ const [sessions, setSessions] = (0, import_react18.useState)([]);
21317
+ const [selectedAgentId, setSelectedAgentId] = (0, import_react18.useState)(null);
21318
+ const [selectedSessionId, setSelectedSessionId] = (0, import_react18.useState)(null);
21319
+ const [showSessions, setShowSessions] = (0, import_react18.useState)(false);
21320
+ const [showAllAgents, setShowAllAgents] = (0, import_react18.useState)(false);
21321
+ const [pendingDelete, setPendingDelete] = (0, import_react18.useState)(null);
21322
+ const [activeScreen, setActiveScreen] = (0, import_react18.useState)("chat");
21323
+ const [settingsData, setSettingsData] = (0, import_react18.useState)(null);
21324
+ const [modelsResult, setModelsResult] = (0, import_react18.useState)(null);
21325
+ const [refreshingSourceId, setRefreshingSourceId] = (0, import_react18.useState)(null);
21326
+ const [refreshOutcome, setRefreshOutcome] = (0, import_react18.useState)(null);
21327
+ const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react18.useState)(null);
21328
+ const [taskRuns, setTaskRuns] = (0, import_react18.useState)({});
21329
+ const [voiceConfig, setVoiceConfig] = (0, import_react18.useState)(null);
21330
+ const [sttCatalogResult, setSttCatalogResult] = (0, import_react18.useState)(null);
21331
+ const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react18.useState)(null);
21332
+ const [composerDraft, setComposerDraft] = (0, import_react18.useState)("");
21333
+ (0, import_react18.useEffect)(() => {
20996
21334
  postMessage({ type: "webviewReady" });
20997
21335
  }, []);
20998
- (0, import_react16.useEffect)(() => {
21336
+ (0, import_react18.useEffect)(() => {
20999
21337
  function handle(event) {
21000
21338
  const msg = event.data;
21001
21339
  if (!msg || typeof msg !== "object" || !("type" in msg)) return;
@@ -21053,7 +21391,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21053
21391
  setModelsResult(msg.result);
21054
21392
  return;
21055
21393
  case "voiceModelsFetched":
21056
- setVoiceCatalogResult(msg.result);
21394
+ if (msg.target === "tts") setTtsCatalogResult(msg.result);
21395
+ else setSttCatalogResult(msg.result);
21057
21396
  return;
21058
21397
  case "refreshingPlugin":
21059
21398
  setRefreshingSourceId(msg.sourceId);
@@ -21083,11 +21422,11 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21083
21422
  pendingConfirmCount: chatState.pendingConfirms.length,
21084
21423
  items: chatState.items,
21085
21424
  onTranscript: (text, mode) => {
21086
- if (mode === "conversation") onSend(text);
21425
+ if (mode === "conversation") onSend(text, void 0, true);
21087
21426
  else setComposerDraft((draft) => draft ? `${draft} ${text}` : text);
21088
21427
  }
21089
21428
  });
21090
- const onSend = (text, attachments) => {
21429
+ const onSend = (text, attachments, voice2) => {
21091
21430
  const trimmed = text.trim();
21092
21431
  if (!trimmed && (!attachments || attachments.length === 0)) return;
21093
21432
  if (chatState.status === "streaming") return;
@@ -21098,15 +21437,21 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21098
21437
  base64: att.base64
21099
21438
  }));
21100
21439
  dispatch({ kind: "send-user", text: trimmed, attachments: localAttachments });
21101
- postMessage({ type: "start", prompt: trimmed, attachments });
21440
+ const msg = { type: "start", prompt: trimmed, attachments };
21441
+ if (voice2) msg.voice = true;
21442
+ postMessage(msg);
21102
21443
  };
21103
- const onConfirm = (id, decision) => {
21444
+ const onConfirm = (0, import_react18.useCallback)((id, decision) => {
21104
21445
  dispatch({ kind: "permission-resolved", id });
21105
21446
  postMessage({ type: "permission_response", id, decision });
21106
- };
21447
+ }, [postMessage]);
21107
21448
  const onAbort = () => {
21108
21449
  postMessage({ type: "abort" });
21109
21450
  };
21451
+ const confirmCards = (0, import_react18.useMemo)(
21452
+ () => chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id)),
21453
+ [chatState.pendingConfirms, onConfirm]
21454
+ );
21110
21455
  const onSelectAgent = (agentId) => {
21111
21456
  if (!agentId) return;
21112
21457
  setSelectedAgentId(agentId);
@@ -21144,7 +21489,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21144
21489
  const cancelDeleteSession = () => {
21145
21490
  setPendingDelete(null);
21146
21491
  };
21147
- (0, import_react16.useEffect)(() => {
21492
+ (0, import_react18.useEffect)(() => {
21148
21493
  if (!pendingDelete) return;
21149
21494
  function handleKeyDown(event) {
21150
21495
  if (event.key === "Escape") {
@@ -21159,7 +21504,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21159
21504
  setShowSessions(!showSessions);
21160
21505
  }
21161
21506
  };
21162
- (0, import_react16.useEffect)(() => {
21507
+ (0, import_react18.useEffect)(() => {
21163
21508
  function handleClickOutside(event) {
21164
21509
  const target = event.target;
21165
21510
  if (showSessions && !target.closest(".app__sessions-dropdown")) {
@@ -21173,18 +21518,18 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21173
21518
  const selectedAgentName = agents.find((a) => a.id === selectedAgentId)?.name;
21174
21519
  const activeAgent = agents.find((a) => a.id === selectedAgentId);
21175
21520
  if (activeScreen === "projects" && layout === "sidebar") {
21176
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app", style: { height: "100%" }, children: [
21177
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__header-row", children: [
21178
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__logo-title-wrapper", onClick: () => setActiveScreen("chat"), style: { cursor: "pointer" }, children: [
21179
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21180
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Caretaker" })
21521
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app", style: { height: "100%" }, children: [
21522
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__header-row", children: [
21523
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__logo-title-wrapper", onClick: () => setActiveScreen("chat"), style: { cursor: "pointer" }, children: [
21524
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21525
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Caretaker" })
21181
21526
  ] }),
21182
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__controls", children: [
21183
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { className: "app__sessions-btn", onClick: () => setActiveScreen("chat"), children: [
21184
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageSquare, { size: 13 }),
21527
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__controls", children: [
21528
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "app__sessions-btn", onClick: () => setActiveScreen("chat"), children: [
21529
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MessageSquare, { size: 13 }),
21185
21530
  " Chat"
21186
21531
  ] }),
21187
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21532
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21188
21533
  "button",
21189
21534
  {
21190
21535
  className: "app__settings-btn",
@@ -21194,25 +21539,26 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21194
21539
  },
21195
21540
  title: "Caretaker Settings",
21196
21541
  children: [
21197
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Settings, { size: 13 }),
21542
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Settings, { size: 13 }),
21198
21543
  " Settings"
21199
21544
  ]
21200
21545
  }
21201
21546
  )
21202
21547
  ] })
21203
21548
  ] }) }),
21204
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ProjectsTab, { agents }) })
21549
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ProjectsTab, { agents }) })
21205
21550
  ] });
21206
21551
  }
21207
21552
  if (activeScreen === "settings") {
21208
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21553
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21209
21554
  SettingsPanel,
21210
21555
  {
21211
21556
  layout,
21212
21557
  postMessage,
21213
21558
  settingsData,
21214
21559
  modelsResult,
21215
- voiceCatalogResult,
21560
+ sttCatalogResult,
21561
+ ttsCatalogResult,
21216
21562
  setModelsResult,
21217
21563
  refreshingSourceId,
21218
21564
  refreshOutcome,
@@ -21224,43 +21570,43 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21224
21570
  }
21225
21571
  ) });
21226
21572
  }
21227
- const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
21228
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
21229
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "app__confirm-message", children: [
21573
+ const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
21574
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
21575
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "app__confirm-message", children: [
21230
21576
  "Delete conversation \u201C",
21231
21577
  pendingDelete.title,
21232
21578
  "\u201D? This cannot be undone."
21233
21579
  ] }),
21234
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__confirm-buttons", children: [
21235
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
21236
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
21580
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__confirm-buttons", children: [
21581
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
21582
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
21237
21583
  ] })
21238
21584
  ] }) });
21239
21585
  if (layout === "sidebar") {
21240
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app app--with-sidebar", children: [
21241
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: "app__sidebar", children: [
21242
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__logo-title-wrapper", children: [
21243
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21244
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Caretaker" })
21586
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app app--with-sidebar", children: [
21587
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("aside", { className: "app__sidebar", children: [
21588
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__logo-title-wrapper", children: [
21589
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21590
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Caretaker" })
21245
21591
  ] }) }),
21246
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sidebar-content", children: [
21247
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sidebar-section", children: [
21248
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
21249
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21592
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sidebar-content", children: [
21593
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sidebar-section", children: [
21594
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
21595
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21250
21596
  "button",
21251
21597
  {
21252
21598
  className: "app__sidebar-agent-item app__sidebar-agent-item--collapsed-active",
21253
21599
  onClick: () => setShowAllAgents(true),
21254
21600
  title: "Switch Agent",
21255
21601
  children: [
21256
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
21257
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
21258
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
21602
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
21603
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
21604
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
21259
21605
  ]
21260
21606
  }
21261
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
21607
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
21262
21608
  const isSelected = selectedAgentId === agent.id;
21263
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21609
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21264
21610
  "button",
21265
21611
  {
21266
21612
  className: `app__sidebar-agent-item ${isSelected ? "app__sidebar-agent-item--active" : ""}`,
@@ -21272,19 +21618,19 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21272
21618
  }
21273
21619
  },
21274
21620
  children: [
21275
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
21276
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
21277
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
21621
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
21622
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
21623
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
21278
21624
  ]
21279
21625
  },
21280
21626
  agent.id
21281
21627
  );
21282
21628
  }) }) })
21283
21629
  ] }),
21284
- selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sidebar-section", children: [
21285
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sidebar-section-header", children: [
21286
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
21287
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21630
+ selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sidebar-section", children: [
21631
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sidebar-section-header", children: [
21632
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
21633
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21288
21634
  "button",
21289
21635
  {
21290
21636
  className: "app__sidebar-new-chat-btn",
@@ -21294,15 +21640,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21294
21640
  }
21295
21641
  )
21296
21642
  ] }),
21297
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21643
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21298
21644
  "div",
21299
21645
  {
21300
21646
  className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
21301
21647
  onClick: () => onSelectSession(session.id),
21302
21648
  children: [
21303
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageSquare, { size: 13 }) }),
21304
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
21305
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21649
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MessageSquare, { size: 13 }) }),
21650
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
21651
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21306
21652
  "button",
21307
21653
  {
21308
21654
  className: "app__sidebar-session-delete",
@@ -21311,7 +21657,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21311
21657
  e.stopPropagation();
21312
21658
  onDeleteSession(session.id, session.title);
21313
21659
  },
21314
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash2, { size: 12 })
21660
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trash2, { size: 12 })
21315
21661
  }
21316
21662
  )
21317
21663
  ]
@@ -21320,8 +21666,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21320
21666
  )) })
21321
21667
  ] })
21322
21668
  ] }),
21323
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sidebar-footer", style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
21324
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21669
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sidebar-footer", style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
21670
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21325
21671
  "button",
21326
21672
  {
21327
21673
  className: "app__sidebar-settings-btn",
@@ -21329,13 +21675,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21329
21675
  setActiveScreen("projects");
21330
21676
  },
21331
21677
  title: "Projects & Autonomous Tasks",
21332
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
21333
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FolderKanban, { size: 13 }),
21678
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
21679
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FolderKanban, { size: 13 }),
21334
21680
  " Projects"
21335
21681
  ] })
21336
21682
  }
21337
21683
  ),
21338
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21684
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21339
21685
  "button",
21340
21686
  {
21341
21687
  className: "app__sidebar-settings-btn",
@@ -21345,37 +21691,37 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21345
21691
  },
21346
21692
  title: "Caretaker Settings",
21347
21693
  children: [
21348
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Settings, { className: "app__settings-icon", size: 14 }),
21349
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Settings" })
21694
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Settings, { className: "app__settings-icon", size: 14 }),
21695
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Settings" })
21350
21696
  ]
21351
21697
  }
21352
21698
  )
21353
21699
  ] })
21354
21700
  ] }),
21355
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
21356
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__chat-header-info", children: [
21357
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
21358
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "app__chat-header-status", children: [
21359
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
21701
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
21702
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__chat-header-info", children: [
21703
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
21704
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "app__chat-header-status", children: [
21705
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
21360
21706
  chatState.status === "streaming" ? "Streaming response..." : "Ready"
21361
21707
  ] })
21362
21708
  ] }) }),
21363
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21709
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21364
21710
  MessageList,
21365
21711
  {
21366
21712
  items: chatState.items,
21367
21713
  sessionId: selectedSessionId,
21368
21714
  isStreaming: chatState.status === "streaming",
21369
21715
  agentName: selectedAgentName,
21370
- trailing: chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id))
21716
+ trailing: confirmCards
21371
21717
  }
21372
21718
  ),
21373
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__error", children: [
21374
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TriangleAlert, { size: 14 }),
21719
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__error", children: [
21720
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TriangleAlert, { size: 14 }),
21375
21721
  " ",
21376
21722
  chatState.errorText || voice.error
21377
21723
  ] }),
21378
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21724
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21379
21725
  Composer,
21380
21726
  {
21381
21727
  disabled: composerDisabled,
@@ -21394,30 +21740,30 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21394
21740
  onValueChange: setComposerDraft
21395
21741
  }
21396
21742
  )
21397
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
21743
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
21398
21744
  deleteOverlay
21399
21745
  ] });
21400
21746
  }
21401
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app", children: [
21402
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__header-row", children: [
21403
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__logo-title-wrapper", children: [
21404
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21405
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Caretaker" })
21747
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app", children: [
21748
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__header-row", children: [
21749
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__logo-title-wrapper", children: [
21750
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
21751
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Caretaker" })
21406
21752
  ] }),
21407
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__controls", children: [
21408
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21753
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__controls", children: [
21754
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21409
21755
  "select",
21410
21756
  {
21411
21757
  className: "app__agent-select",
21412
21758
  value: selectedAgentId ?? "",
21413
21759
  onChange: (e) => onSelectAgent(e.target.value),
21414
21760
  children: [
21415
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
21416
- agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
21761
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
21762
+ agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
21417
21763
  ]
21418
21764
  }
21419
21765
  ) }),
21420
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21766
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21421
21767
  "button",
21422
21768
  {
21423
21769
  className: "app__sessions-btn",
@@ -21425,13 +21771,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21425
21771
  disabled: !selectedAgentId,
21426
21772
  title: "View conversations",
21427
21773
  children: [
21428
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageSquare, { size: 13 }),
21774
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MessageSquare, { size: 13 }),
21429
21775
  " ",
21430
21776
  sessions.length
21431
21777
  ]
21432
21778
  }
21433
21779
  ),
21434
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21780
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21435
21781
  "button",
21436
21782
  {
21437
21783
  className: "app__new-chat-btn",
@@ -21441,7 +21787,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21441
21787
  children: "+ New"
21442
21788
  }
21443
21789
  ),
21444
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21790
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21445
21791
  "button",
21446
21792
  {
21447
21793
  className: "app__settings-btn",
@@ -21450,24 +21796,24 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21450
21796
  postMessage({ type: "getSettingsData" });
21451
21797
  },
21452
21798
  title: "Caretaker Settings",
21453
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Settings, { className: "app__settings-icon", size: 14 })
21799
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Settings, { className: "app__settings-icon", size: 14 })
21454
21800
  }
21455
21801
  )
21456
21802
  ] })
21457
21803
  ] }) }),
21458
- showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sessions-dropdown", children: [
21459
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sessions-title", children: [
21804
+ showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sessions-dropdown", children: [
21805
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sessions-title", children: [
21460
21806
  "Conversations for ",
21461
21807
  selectedAgentName
21462
21808
  ] }),
21463
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
21809
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
21464
21810
  "div",
21465
21811
  {
21466
21812
  className: `app__session-item ${selectedSessionId === session.id ? "app__session-item--active" : ""}`,
21467
21813
  onClick: () => onSelectSession(session.id),
21468
21814
  children: [
21469
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "app__session-item-title", children: session.title }),
21470
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21815
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "app__session-item-title", children: session.title }),
21816
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21471
21817
  "button",
21472
21818
  {
21473
21819
  className: "app__session-item-delete",
@@ -21476,7 +21822,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21476
21822
  e.stopPropagation();
21477
21823
  onDeleteSession(session.id, session.title);
21478
21824
  },
21479
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash2, { size: 12 })
21825
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trash2, { size: 12 })
21480
21826
  }
21481
21827
  )
21482
21828
  ]
@@ -21484,27 +21830,27 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21484
21830
  session.id
21485
21831
  )) })
21486
21832
  ] }),
21487
- showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
21488
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
21489
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
21833
+ showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
21834
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
21835
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
21490
21836
  ] }),
21491
- !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: "Select an agent to start chatting" }) }),
21492
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21837
+ !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: "Select an agent to start chatting" }) }),
21838
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21493
21839
  MessageList,
21494
21840
  {
21495
21841
  items: chatState.items,
21496
21842
  sessionId: selectedSessionId,
21497
21843
  isStreaming: chatState.status === "streaming",
21498
21844
  agentName: selectedAgentName,
21499
- trailing: chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id))
21845
+ trailing: confirmCards
21500
21846
  }
21501
21847
  ),
21502
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "app__error", children: [
21503
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TriangleAlert, { size: 14 }),
21848
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "app__error", children: [
21849
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TriangleAlert, { size: 14 }),
21504
21850
  " ",
21505
21851
  chatState.errorText || voice.error
21506
21852
  ] }),
21507
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
21853
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21508
21854
  Composer,
21509
21855
  {
21510
21856
  disabled: composerDisabled,
@@ -21528,12 +21874,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21528
21874
  }
21529
21875
 
21530
21876
  // src/standalone.tsx
21531
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
21877
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
21532
21878
  function StandaloneApp() {
21533
- const [ws, setWs] = (0, import_react17.useState)(null);
21534
- const [connected, setConnected] = (0, import_react17.useState)(false);
21535
- const [error, setError] = (0, import_react17.useState)(null);
21536
- (0, import_react17.useEffect)(() => {
21879
+ const [ws, setWs] = (0, import_react19.useState)(null);
21880
+ const [connected, setConnected] = (0, import_react19.useState)(false);
21881
+ const [error, setError] = (0, import_react19.useState)(null);
21882
+ (0, import_react19.useEffect)(() => {
21537
21883
  let active = true;
21538
21884
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
21539
21885
  const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws`);
@@ -21579,7 +21925,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21579
21925
  }
21580
21926
  };
21581
21927
  if (error) {
21582
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: {
21928
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: {
21583
21929
  display: "flex",
21584
21930
  flexDirection: "column",
21585
21931
  alignItems: "center",
@@ -21591,9 +21937,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21591
21937
  padding: "20px",
21592
21938
  textAlign: "center"
21593
21939
  }, children: [
21594
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
21595
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: error }),
21596
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
21940
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
21941
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: error }),
21942
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
21597
21943
  "button",
21598
21944
  {
21599
21945
  onClick: () => setWs(null),
@@ -21612,7 +21958,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21612
21958
  ] });
21613
21959
  }
21614
21960
  if (!connected) {
21615
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: {
21961
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: {
21616
21962
  display: "flex",
21617
21963
  flexDirection: "column",
21618
21964
  alignItems: "center",
@@ -21622,7 +21968,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21622
21968
  background: "#1e1e1e",
21623
21969
  color: "#f1f1f1"
21624
21970
  }, children: [
21625
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: {
21971
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: {
21626
21972
  border: "4px solid rgba(255,255,255,0.1)",
21627
21973
  width: "36px",
21628
21974
  height: "36px",
@@ -21631,8 +21977,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21631
21977
  animation: "spin 1s linear infinite",
21632
21978
  marginBottom: "16px"
21633
21979
  } }),
21634
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Connecting to Caretaker server..." }),
21635
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("style", { children: `
21980
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Connecting to Caretaker server..." }),
21981
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("style", { children: `
21636
21982
  @keyframes spin {
21637
21983
  0% { transform: rotate(0deg); }
21638
21984
  100% { transform: rotate(360deg); }
@@ -21640,12 +21986,12 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21640
21986
  ` })
21641
21987
  ] });
21642
21988
  }
21643
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(App, { postMessage, layout: "sidebar" });
21989
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(App, { postMessage, layout: "sidebar" });
21644
21990
  }
21645
21991
  var rootEl = document.getElementById("root");
21646
21992
  if (!rootEl) throw new Error("#root not found");
21647
21993
  (0, import_client.createRoot)(rootEl).render(
21648
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react17.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StandaloneApp, {}) })
21994
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StandaloneApp, {}) })
21649
21995
  );
21650
21996
  })();
21651
21997
  /*! Bundled license information: