@hyperwindmill/caretaker-cli 0.15.1 → 0.17.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.
@@ -18492,27 +18492,33 @@ ${text}</tr>
18492
18492
  if (event.mode === "dictate") return "idle";
18493
18493
  return event.empty ? "recording" : "awaiting";
18494
18494
  case "awaiting":
18495
+ if (event.kind === "speechQueued") return event.canSpeak ? "speaking" : phase;
18495
18496
  if (event.kind !== "turnFinished") return phase;
18497
+ if (event.pendingSpeech > 0 && event.canSpeak) return "speaking";
18496
18498
  if (!event.turnComplete) return phase;
18497
18499
  if (!event.sawStreaming) return phase;
18498
18500
  if (event.confirmPending) return phase;
18499
18501
  return event.canSpeak ? "speaking" : "recording";
18500
18502
  case "speaking":
18501
- return event.kind === "playbackEnded" ? "recording" : phase;
18503
+ if (event.kind === "playbackEnded") return event.turnComplete ? "recording" : "awaiting";
18504
+ return phase;
18502
18505
  }
18503
18506
  }
18504
18507
  function stripMarkdownForSpeech(md) {
18505
18508
  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
18509
  }
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;
18510
+ function isFinal(items, i) {
18511
+ return i < items.length - 1 || items[i].streaming !== true;
18512
+ }
18513
+ function takeFinalizedBubbles(items, cursor) {
18514
+ const texts = [];
18515
+ let i = Math.max(0, Math.min(cursor, items.length));
18516
+ for (; i < items.length && isFinal(items, i); i += 1) {
18517
+ if (items[i].kind !== "assistant") continue;
18518
+ const text = (items[i].text ?? "").trim();
18519
+ if (text) texts.push(text);
18514
18520
  }
18515
- return null;
18521
+ return { texts, cursor: i };
18516
18522
  }
18517
18523
  function voiceSignature(v) {
18518
18524
  if (!v) return "";
@@ -18545,6 +18551,7 @@ ${text}</tr>
18545
18551
  // src/VoiceTab.tsx
18546
18552
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
18547
18553
  var BACKEND_POLL_MS = 1e4;
18554
+ var CONFIRM_DELETE_MS = 4e3;
18548
18555
  var EMPTY = { enabled: false, endpoint: "", sttModel: "" };
18549
18556
  var LOCAL_DEFAULTS = {
18550
18557
  endpoint: "http://127.0.0.1:8969/v1",
@@ -18581,6 +18588,24 @@ ${text}</tr>
18581
18588
  const [backendBusy, setBackendBusy] = (0, import_react12.useState)(false);
18582
18589
  const [backendProgress, setBackendProgress] = (0, import_react12.useState)(null);
18583
18590
  const [backendError, setBackendError] = (0, import_react12.useState)(null);
18591
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react12.useState)(false);
18592
+ const confirmDeleteTimer = (0, import_react12.useRef)(null);
18593
+ const disarmDelete = () => {
18594
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18595
+ confirmDeleteTimer.current = null;
18596
+ setConfirmingDelete(false);
18597
+ };
18598
+ const armDelete = () => {
18599
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18600
+ setConfirmingDelete(true);
18601
+ confirmDeleteTimer.current = setTimeout(() => setConfirmingDelete(false), CONFIRM_DELETE_MS);
18602
+ };
18603
+ (0, import_react12.useEffect)(
18604
+ () => () => {
18605
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18606
+ },
18607
+ []
18608
+ );
18584
18609
  const lastContainer = (0, import_react12.useRef)(null);
18585
18610
  const adoptBackendStatus = (status) => {
18586
18611
  lastContainer.current = status.container;
@@ -18660,6 +18685,20 @@ ${text}</tr>
18660
18685
  fetchBackendStatus();
18661
18686
  }
18662
18687
  };
18688
+ const deleteBackend = async () => {
18689
+ disarmDelete();
18690
+ setBackendBusy(true);
18691
+ setBackendError(null);
18692
+ try {
18693
+ const res = await fetch("/api/voice/backend/delete", { method: "POST" });
18694
+ if (res.ok) adoptBackendStatus(await res.json());
18695
+ else setBackendError(await res.text().catch(() => "") || "Delete failed.");
18696
+ } catch {
18697
+ } finally {
18698
+ setBackendBusy(false);
18699
+ fetchBackendStatus();
18700
+ }
18701
+ };
18663
18702
  (0, import_react12.useEffect)(() => {
18664
18703
  if (catalogResult) setFetching(false);
18665
18704
  }, [catalogResult]);
@@ -18729,7 +18768,16 @@ ${text}</tr>
18729
18768
  showBackendBlock && backendStatus && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18730
18769
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "voice-backend-status", children: [
18731
18770
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: backendProgress ?? backendStatusText(backendStatus) }),
18732
- 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" })
18771
+ 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" }),
18772
+ backendStatus.container !== "absent" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18773
+ "button",
18774
+ {
18775
+ type: "button",
18776
+ onClick: confirmingDelete ? deleteBackend : armDelete,
18777
+ disabled: backendBusy,
18778
+ children: confirmingDelete ? "Really delete?" : "Delete"
18779
+ }
18780
+ )
18733
18781
  ] }),
18734
18782
  backendError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { className: "form-error", children: backendError }),
18735
18783
  /* @__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: [
@@ -18744,7 +18792,7 @@ ${text}</tr>
18744
18792
  ),
18745
18793
  "Start automatically with caretaker"
18746
18794
  ] }) }),
18747
- /* @__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." })
18795
+ /* @__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." })
18748
18796
  ] }),
18749
18797
  /* @__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: [
18750
18798
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -19537,6 +19585,25 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19537
19585
  setTaskError("Failed to update task setting");
19538
19586
  }
19539
19587
  };
19588
+ const handleSaveTaskDetails = async (task, title, objective) => {
19589
+ setTaskError(null);
19590
+ try {
19591
+ const res = await fetch(`/api/tasks/${task.id}`, {
19592
+ method: "PATCH",
19593
+ headers: { "Content-Type": "application/json" },
19594
+ body: JSON.stringify({ title, objective })
19595
+ });
19596
+ if (res.ok) {
19597
+ if (selectedProjectId !== null) fetchTasks(selectedProjectId);
19598
+ } else {
19599
+ const data = await res.json().catch(() => ({}));
19600
+ setTaskError(data.error || "Failed to save task details");
19601
+ }
19602
+ } catch (err) {
19603
+ console.error("Failed to save task details:", err);
19604
+ setTaskError("Failed to save task details");
19605
+ }
19606
+ };
19540
19607
  const backToList = () => {
19541
19608
  setView("list");
19542
19609
  setSelectedTaskId(null);
@@ -19634,6 +19701,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
19634
19701
  onSetAgent: handleSetTaskAgent,
19635
19702
  onSetFlag: handleSetTaskFlag,
19636
19703
  onSetMaxRun: handleSetTaskMaxRun,
19704
+ onSaveDetails: handleSaveTaskDetails,
19637
19705
  onOpenLog: () => setView("log"),
19638
19706
  statusColor
19639
19707
  }
@@ -20223,19 +20291,60 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20223
20291
  onSetAgent,
20224
20292
  onSetFlag,
20225
20293
  onSetMaxRun,
20294
+ onSaveDetails,
20226
20295
  onOpenLog,
20227
20296
  statusColor
20228
20297
  }) {
20229
20298
  const isRunning = task.status === "active" || task.status === "reviewing" || task.status === "planning";
20299
+ const [draftTitle, setDraftTitle] = (0, import_react14.useState)(task.title);
20300
+ const [draftObjective, setDraftObjective] = (0, import_react14.useState)(task.objective);
20301
+ const [lastTaskId, setLastTaskId] = (0, import_react14.useState)(task.id);
20302
+ const trimmedTitle = draftTitle.trim();
20303
+ const isDirty = trimmedTitle !== task.title.trim() || draftObjective.trim() !== task.objective.trim();
20304
+ (0, import_react14.useEffect)(() => {
20305
+ if (task.id !== lastTaskId) {
20306
+ setDraftTitle(task.title);
20307
+ setDraftObjective(task.objective);
20308
+ setLastTaskId(task.id);
20309
+ } else if (!isDirty) {
20310
+ setDraftTitle(task.title);
20311
+ setDraftObjective(task.objective);
20312
+ }
20313
+ }, [task.id, task.title, task.objective]);
20314
+ const canSave = isDirty && trimmedTitle.length > 0;
20315
+ const resetDraft = () => {
20316
+ setDraftTitle(task.title);
20317
+ setDraftObjective(task.objective);
20318
+ };
20230
20319
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
20231
20320
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
20232
20321
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
20233
20322
  /* @__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 }) }),
20234
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700 }, children: [
20235
- "Task #",
20236
- task.id,
20237
- ": ",
20238
- task.title
20323
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
20324
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { opacity: 0.6 }, children: [
20325
+ "Task #",
20326
+ task.id
20327
+ ] }),
20328
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20329
+ "input",
20330
+ {
20331
+ value: draftTitle,
20332
+ onChange: (e) => setDraftTitle(e.target.value),
20333
+ "aria-label": "Task title",
20334
+ title: "Task title",
20335
+ style: {
20336
+ background: "var(--vscode-input-background, #252526)",
20337
+ color: "var(--vscode-input-foreground)",
20338
+ border: "1px solid var(--vscode-input-border, #3c3c3c)",
20339
+ borderRadius: "4px",
20340
+ padding: "3px 6px",
20341
+ fontSize: "14px",
20342
+ fontWeight: 700,
20343
+ outline: "none",
20344
+ minWidth: "240px"
20345
+ }
20346
+ }
20347
+ )
20239
20348
  ] }),
20240
20349
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20241
20350
  "span",
@@ -20322,7 +20431,47 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20322
20431
  ] }),
20323
20432
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20324
20433
  /* @__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" }),
20325
- /* @__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 })
20434
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20435
+ "textarea",
20436
+ {
20437
+ value: draftObjective,
20438
+ onChange: (e) => setDraftObjective(e.target.value),
20439
+ rows: 6,
20440
+ "aria-label": "Task objective",
20441
+ title: "What the agent should achieve. Read at the start of every cycle, so an edit applies from the next one.",
20442
+ style: {
20443
+ width: "100%",
20444
+ boxSizing: "border-box",
20445
+ fontSize: "12px",
20446
+ fontFamily: "inherit",
20447
+ lineHeight: 1.5,
20448
+ background: "var(--vscode-input-background, #252526)",
20449
+ color: "var(--vscode-input-foreground)",
20450
+ border: "1px solid var(--vscode-input-border, #3c3c3c)",
20451
+ borderRadius: "6px",
20452
+ padding: "10px",
20453
+ outline: "none",
20454
+ resize: "vertical"
20455
+ }
20456
+ }
20457
+ ),
20458
+ isDirty && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
20459
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
20460
+ "button",
20461
+ {
20462
+ className: "confirm__btn confirm__btn--primary",
20463
+ onClick: () => {
20464
+ void onSaveDetails(task, trimmedTitle, draftObjective.trim());
20465
+ },
20466
+ disabled: !canSave,
20467
+ title: canSave ? "Save title and objective" : "The title cannot be empty",
20468
+ style: { padding: "3px 10px", fontSize: "10px" },
20469
+ children: "Save"
20470
+ }
20471
+ ),
20472
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
20473
+ isRunning && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
20474
+ ] })
20326
20475
  ] }),
20327
20476
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginBottom: "16px" }, children: [
20328
20477
  /* @__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" }),
@@ -20547,6 +20696,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20547
20696
  onTranscriptRef.current = onTranscript;
20548
20697
  const itemsRef = (0, import_react15.useRef)(items);
20549
20698
  itemsRef.current = items;
20699
+ const chatStatusRef = (0, import_react15.useRef)(chatStatus);
20700
+ chatStatusRef.current = chatStatus;
20550
20701
  const streamRef = (0, import_react15.useRef)(null);
20551
20702
  const recorderRef = (0, import_react15.useRef)(null);
20552
20703
  const chunksRef = (0, import_react15.useRef)([]);
@@ -20555,7 +20706,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20555
20706
  const idleTimerRef = (0, import_react15.useRef)(null);
20556
20707
  const heardSpeechRef = (0, import_react15.useRef)(false);
20557
20708
  const sawStreamingRef = (0, import_react15.useRef)(false);
20558
- const spokenBaselineRef = (0, import_react15.useRef)(null);
20709
+ const cursorRef = (0, import_react15.useRef)(0);
20710
+ const queueRef = (0, import_react15.useRef)([]);
20559
20711
  const apply = (0, import_react15.useCallback)((event) => {
20560
20712
  setPhase((current) => nextPhase(current, event));
20561
20713
  }, []);
@@ -20613,7 +20765,8 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20613
20765
  if (trimmed) {
20614
20766
  if (currentMode === "conversation") {
20615
20767
  sawStreamingRef.current = false;
20616
- spokenBaselineRef.current = lastSpokenText(itemsRef.current);
20768
+ cursorRef.current = itemsRef.current.length;
20769
+ queueRef.current = [];
20617
20770
  }
20618
20771
  onTranscriptRef.current(trimmed, currentMode);
20619
20772
  }
@@ -20670,9 +20823,13 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20670
20823
  }
20671
20824
  }, [apply, fail, finishRecording, teardownCapture]);
20672
20825
  const speakReply = (0, import_react15.useCallback)(async () => {
20673
- const text = lastSpokenText(itemsRef.current);
20674
- if (!text || text === spokenBaselineRef.current) {
20675
- apply({ kind: "playbackEnded", mode: "conversation" });
20826
+ const text = queueRef.current.shift();
20827
+ if (!text) {
20828
+ apply({
20829
+ kind: "playbackEnded",
20830
+ mode: "conversation",
20831
+ turnComplete: chatStatusRef.current === "idle"
20832
+ });
20676
20833
  return;
20677
20834
  }
20678
20835
  try {
@@ -20688,7 +20845,17 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20688
20845
  audio.onended = () => {
20689
20846
  URL.revokeObjectURL(url);
20690
20847
  audioRef.current = null;
20691
- setTimeout(() => apply({ kind: "playbackEnded", mode: "conversation" }), POST_PLAYBACK_MS);
20848
+ setTimeout(() => {
20849
+ if (queueRef.current.length > 0) {
20850
+ void speakReply();
20851
+ } else {
20852
+ apply({
20853
+ kind: "playbackEnded",
20854
+ mode: "conversation",
20855
+ turnComplete: chatStatusRef.current === "idle"
20856
+ });
20857
+ }
20858
+ }, POST_PLAYBACK_MS);
20692
20859
  };
20693
20860
  audio.onerror = () => {
20694
20861
  URL.revokeObjectURL(url);
@@ -20702,6 +20869,15 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20702
20869
  (0, import_react15.useEffect)(() => {
20703
20870
  if (chatStatus === "streaming") sawStreamingRef.current = true;
20704
20871
  }, [chatStatus]);
20872
+ (0, import_react15.useEffect)(() => {
20873
+ if (modeRef.current !== "conversation") return;
20874
+ if (phaseRef.current === "idle") return;
20875
+ const { texts, cursor } = takeFinalizedBubbles(items, cursorRef.current);
20876
+ cursorRef.current = cursor;
20877
+ if (texts.length === 0) return;
20878
+ queueRef.current.push(...texts);
20879
+ apply({ kind: "speechQueued", mode: "conversation", canSpeak });
20880
+ }, [items, canSpeak, apply]);
20705
20881
  (0, import_react15.useEffect)(() => {
20706
20882
  if (phase !== "awaiting") return;
20707
20883
  if (chatStatus === "error") {
@@ -20717,7 +20893,11 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20717
20893
  // the loop advances mid-stream and speaks the previous reply.
20718
20894
  turnComplete: chatStatus === "idle",
20719
20895
  sawStreaming: sawStreamingRef.current,
20720
- confirmPending: pendingConfirmCount > 0
20896
+ confirmPending: pendingConfirmCount > 0,
20897
+ // Text queued but not yet played. Non-zero drives awaiting → speaking
20898
+ // regardless of turnComplete, so a bubble closed in the same commit as
20899
+ // the turn ending is never lost to effect ordering.
20900
+ pendingSpeech: queueRef.current.length
20721
20901
  });
20722
20902
  }, [phase, chatStatus, pendingConfirmCount, canSpeak, apply]);
20723
20903
  const prevPhase = (0, import_react15.useRef)("idle");
@@ -20730,6 +20910,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
20730
20910
  if (phase === "idle") {
20731
20911
  teardownCapture();
20732
20912
  stopPlayback();
20913
+ queueRef.current = [];
20733
20914
  }
20734
20915
  }, [phase, startRecording, speakReply, teardownCapture, stopPlayback]);
20735
20916
  (0, import_react15.useEffect)(
@@ -21041,11 +21222,11 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21041
21222
  pendingConfirmCount: chatState.pendingConfirms.length,
21042
21223
  items: chatState.items,
21043
21224
  onTranscript: (text, mode) => {
21044
- if (mode === "conversation") onSend(text);
21225
+ if (mode === "conversation") onSend(text, void 0, true);
21045
21226
  else setComposerDraft((draft) => draft ? `${draft} ${text}` : text);
21046
21227
  }
21047
21228
  });
21048
- const onSend = (text, attachments) => {
21229
+ const onSend = (text, attachments, voice2) => {
21049
21230
  const trimmed = text.trim();
21050
21231
  if (!trimmed && (!attachments || attachments.length === 0)) return;
21051
21232
  if (chatState.status === "streaming") return;
@@ -21056,7 +21237,9 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
21056
21237
  base64: att.base64
21057
21238
  }));
21058
21239
  dispatch({ kind: "send-user", text: trimmed, attachments: localAttachments });
21059
- postMessage({ type: "start", prompt: trimmed, attachments });
21240
+ const msg = { type: "start", prompt: trimmed, attachments };
21241
+ if (voice2) msg.voice = true;
21242
+ postMessage(msg);
21060
21243
  };
21061
21244
  const onConfirm = (id, decision) => {
21062
21245
  dispatch({ kind: "permission-resolved", id });