@hyperwindmill/caretaker-cli 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cli/index.d.ts.map +1 -1
  2. package/dist/cli/index.js +9 -1
  3. package/dist/cli/web/api_access.d.ts +38 -0
  4. package/dist/cli/web/api_access.d.ts.map +1 -0
  5. package/dist/cli/web/api_access.js +125 -0
  6. package/dist/cli/web/openapi.d.ts +7 -0
  7. package/dist/cli/web/openapi.d.ts.map +1 -0
  8. package/dist/cli/web/openapi.js +489 -0
  9. package/dist/cli/web/scheduler/cycle_events.d.ts +8 -3
  10. package/dist/cli/web/scheduler/cycle_events.d.ts.map +1 -1
  11. package/dist/cli/web/scheduler/cycle_events.js +2 -0
  12. package/dist/cli/web/scheduler/email_triage.d.ts +8 -1
  13. package/dist/cli/web/scheduler/email_triage.d.ts.map +1 -1
  14. package/dist/cli/web/scheduler/email_triage.js +19 -4
  15. package/dist/cli/web/scheduler/email_triage_agent.d.ts.map +1 -1
  16. package/dist/cli/web/scheduler/email_triage_agent.js +1 -0
  17. package/dist/cli/web/scheduler/heartbeat.d.ts +1 -1
  18. package/dist/cli/web/scheduler/heartbeat.d.ts.map +1 -1
  19. package/dist/cli/web/scheduler/heartbeat.js +9 -5
  20. package/dist/cli/web/scheduler/service_runs.d.ts +12 -0
  21. package/dist/cli/web/scheduler/service_runs.d.ts.map +1 -0
  22. package/dist/cli/web/scheduler/service_runs.js +39 -0
  23. package/dist/cli/web/scheduler/task_review.d.ts +8 -0
  24. package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
  25. package/dist/cli/web/scheduler/task_review.js +17 -1
  26. package/dist/cli/web/scheduler/task_strategy.js +41 -14
  27. package/dist/cli/web/scheduler.d.ts +9 -0
  28. package/dist/cli/web/scheduler.d.ts.map +1 -1
  29. package/dist/cli/web/scheduler.js +24 -2
  30. package/dist/cli/web/server.d.ts +4 -1
  31. package/dist/cli/web/server.d.ts.map +1 -1
  32. package/dist/cli/web/server.js +67 -13
  33. package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
  34. package/dist/harness/tools/builtin/task_tools.js +5 -17
  35. package/dist/lib/email.d.ts.map +1 -1
  36. package/dist/lib/email.js +2 -1
  37. package/dist/store/db.d.ts +12 -0
  38. package/dist/store/db.d.ts.map +1 -1
  39. package/dist/store/db.js +37 -0
  40. package/dist/store/json.d.ts +29 -0
  41. package/dist/store/json.d.ts.map +1 -1
  42. package/dist/store/json.js +54 -0
  43. package/dist/webview/standalone.js +1039 -768
  44. package/dist/webview/standalone.js.map +4 -4
  45. package/package.json +3 -3
@@ -14583,11 +14583,11 @@
14583
14583
  });
14584
14584
 
14585
14585
  // src/standalone.tsx
14586
- var import_react26 = __toESM(require_react(), 1);
14586
+ var import_react27 = __toESM(require_react(), 1);
14587
14587
  var import_client = __toESM(require_client(), 1);
14588
14588
 
14589
14589
  // src/App.tsx
14590
- var import_react25 = __toESM(require_react(), 1);
14590
+ var import_react26 = __toESM(require_react(), 1);
14591
14591
 
14592
14592
  // src/assistant_activation.ts
14593
14593
  function beginActivation(agentId, confirmedAgentId, knownAgentIds, current) {
@@ -17392,7 +17392,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
17392
17392
  }
17393
17393
 
17394
17394
  // src/SettingsPanel.tsx
17395
- var import_react21 = __toESM(require_react(), 1);
17395
+ var import_react23 = __toESM(require_react(), 1);
17396
17396
 
17397
17397
  // src/ProvidersTab.tsx
17398
17398
  var import_react7 = __toESM(require_react(), 1);
@@ -19848,7 +19848,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
19848
19848
  }
19849
19849
 
19850
19850
  // src/ServicesTab.tsx
19851
- var import_react14 = __toESM(require_react(), 1);
19851
+ var import_react15 = __toESM(require_react(), 1);
19852
19852
 
19853
19853
  // src/services_form_utils.ts
19854
19854
  function triageAccountOptions(services, agentId) {
@@ -19870,12 +19870,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
19870
19870
  }
19871
19871
  if (splitRecipients(f.recipients).length === 0) return "Add at least one recipient for the triage report.";
19872
19872
  const n = Number(f.maxEmails);
19873
- if (!/^\d+$/.test(f.maxEmails.trim()) || n < 1 || n > 50) return "Max emails must be a whole number between 1 and 50.";
19873
+ if (!/^\d+$/.test(f.maxEmails.trim()) || n < 1 || n > 200) return "Max emails must be a whole number between 1 and 200.";
19874
19874
  return null;
19875
19875
  }
19876
19876
 
19877
- // src/ServicesTab.tsx
19878
- var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
19877
+ // src/use_cycle_stream.ts
19878
+ var import_react14 = __toESM(require_react(), 1);
19879
+
19880
+ // src/chat_state.ts
19879
19881
  function closeStreamingAssistant(items) {
19880
19882
  const last = items[items.length - 1];
19881
19883
  if (!last || last.kind !== "assistant" || !last.streaming) return items;
@@ -19884,16 +19886,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
19884
19886
  function reconstructChatItems(messages) {
19885
19887
  let items = [];
19886
19888
  for (const msg of messages) {
19887
- if (msg.role === "user") {
19889
+ if (msg.recap) {
19888
19890
  items = closeStreamingAssistant(items);
19889
- items.push({ kind: "user", text: msg.content });
19891
+ items.push({ kind: "assistant", text: msg.content, streaming: false, label: "Cycle recap" });
19892
+ } else if (msg.role === "user") {
19893
+ items = closeStreamingAssistant(items);
19894
+ items.push({ kind: "user", text: msg.content, attachments: msg.attachments });
19890
19895
  } else if (msg.role === "assistant") {
19891
19896
  items = closeStreamingAssistant(items);
19892
19897
  if (msg.parts && msg.parts.length > 0) {
19893
19898
  for (const part of msg.parts) {
19894
19899
  if (part.type === "text") {
19895
19900
  items.push({ kind: "assistant", text: part.text, streaming: false });
19896
- } else if (part.type === "thinking") {
19901
+ } else if (part.type === "thinking" && part.text.trim().length > 0) {
19897
19902
  items.push({ kind: "thinking", text: part.text });
19898
19903
  } else if (part.type === "tool_use") {
19899
19904
  items.push({
@@ -19931,40 +19936,302 @@ Please report this to https://github.com/markedjs/marked.`, e) {
19931
19936
  }
19932
19937
  return closeStreamingAssistant(items);
19933
19938
  }
19939
+ function chatReducer(state, action) {
19940
+ switch (action.kind) {
19941
+ case "send-user":
19942
+ return {
19943
+ ...state,
19944
+ status: "streaming",
19945
+ errorText: null,
19946
+ items: [...state.items, { kind: "user", text: action.text, attachments: action.attachments }]
19947
+ };
19948
+ case "append-chunk": {
19949
+ const last = state.items[state.items.length - 1];
19950
+ if (last && last.kind === "assistant" && last.streaming) {
19951
+ const updated = { ...last, text: last.text + action.text };
19952
+ return { ...state, items: [...state.items.slice(0, -1), updated] };
19953
+ }
19954
+ return {
19955
+ ...state,
19956
+ items: [...state.items, { kind: "assistant", text: action.text, streaming: true }]
19957
+ };
19958
+ }
19959
+ case "append-thinking": {
19960
+ const last = state.items[state.items.length - 1];
19961
+ if (last && last.kind === "thinking") {
19962
+ const updated = { ...last, text: last.text + action.text };
19963
+ return { ...state, items: [...state.items.slice(0, -1), updated] };
19964
+ }
19965
+ return {
19966
+ ...state,
19967
+ items: [...state.items, { kind: "thinking", text: action.text }]
19968
+ };
19969
+ }
19970
+ case "tool-call":
19971
+ return {
19972
+ ...state,
19973
+ items: [
19974
+ ...closeStreamingAssistant(state.items),
19975
+ { kind: "tool", id: action.id, name: action.name, args: action.args, result: null }
19976
+ ]
19977
+ };
19978
+ case "tool-result": {
19979
+ const idx = state.items.findIndex(
19980
+ (it2) => it2.kind === "tool" && it2.id === action.id && it2.result === null
19981
+ );
19982
+ if (idx < 0) return state;
19983
+ const tool = state.items[idx];
19984
+ const updated = { ...tool, result: action.content };
19985
+ return {
19986
+ ...state,
19987
+ items: [...state.items.slice(0, idx), updated, ...state.items.slice(idx + 1)]
19988
+ };
19989
+ }
19990
+ case "permission-request":
19991
+ return {
19992
+ ...state,
19993
+ pendingConfirms: [
19994
+ ...state.pendingConfirms,
19995
+ { id: action.id, toolName: action.toolName, args: action.args }
19996
+ ]
19997
+ };
19998
+ case "permission-resolved":
19999
+ return {
20000
+ ...state,
20001
+ pendingConfirms: state.pendingConfirms.filter((p) => p.id !== action.id)
20002
+ };
20003
+ case "done":
20004
+ return {
20005
+ ...state,
20006
+ status: "idle",
20007
+ pendingConfirms: [],
20008
+ items: closeStreamingAssistant(state.items)
20009
+ };
20010
+ case "clear":
20011
+ return {
20012
+ ...state,
20013
+ items: [],
20014
+ status: "idle",
20015
+ errorText: null,
20016
+ pendingConfirms: [],
20017
+ contextUsage: null
20018
+ };
20019
+ case "error":
20020
+ return {
20021
+ ...state,
20022
+ status: "error",
20023
+ errorText: action.text,
20024
+ pendingConfirms: [],
20025
+ items: closeStreamingAssistant(state.items)
20026
+ };
20027
+ case "load-history": {
20028
+ const historyItems = reconstructChatItems(action.messages);
20029
+ return {
20030
+ ...state,
20031
+ items: historyItems,
20032
+ // A cycle opened mid-run keeps the stream indicator on until its `done`.
20033
+ status: action.streaming ? "streaming" : "idle",
20034
+ errorText: null,
20035
+ pendingConfirms: []
20036
+ };
20037
+ }
20038
+ case "context-usage":
20039
+ return {
20040
+ ...state,
20041
+ contextUsage: action.usage
20042
+ };
20043
+ }
20044
+ }
20045
+ var initialChatState = {
20046
+ items: [],
20047
+ status: "idle",
20048
+ errorText: null,
20049
+ pendingConfirms: [],
20050
+ contextUsage: null
20051
+ };
20052
+
20053
+ // src/use_cycle_stream.ts
20054
+ function useCycleStream(id, handlers) {
20055
+ const [chat, dispatch] = (0, import_react14.useReducer)(chatReducer, initialChatState);
20056
+ const ref = (0, import_react14.useRef)(handlers);
20057
+ ref.current = handlers;
20058
+ (0, import_react14.useEffect)(() => {
20059
+ function handle(event) {
20060
+ const msg = event.data;
20061
+ if (!msg || typeof msg !== "object" || !("type" in msg) || !("sessionId" in msg)) return;
20062
+ if (msg.sessionId !== id) return;
20063
+ if (msg.type === "cycleLoaded") {
20064
+ dispatch({ kind: "load-history", messages: msg.messages, streaming: msg.running });
20065
+ return;
20066
+ }
20067
+ if (msg.type !== "cycleEvent") return;
20068
+ const ev = msg.event;
20069
+ switch (ev.type) {
20070
+ case "user":
20071
+ dispatch({ kind: "send-user", text: ev.text });
20072
+ return;
20073
+ case "chunk":
20074
+ dispatch({ kind: "append-chunk", text: ev.text });
20075
+ return;
20076
+ case "thinking":
20077
+ dispatch({ kind: "append-thinking", text: ev.text });
20078
+ return;
20079
+ case "tool_call":
20080
+ dispatch({ kind: "tool-call", id: ev.id, name: ev.name, args: ev.args });
20081
+ return;
20082
+ case "tool_result":
20083
+ dispatch({ kind: "tool-result", id: ev.id, content: ev.content });
20084
+ return;
20085
+ case "done":
20086
+ dispatch({ kind: "done" });
20087
+ ref.current.onDone();
20088
+ return;
20089
+ case "error":
20090
+ dispatch({ kind: "error", text: ev.message });
20091
+ return;
20092
+ }
20093
+ }
20094
+ window.addEventListener("message", handle);
20095
+ ref.current.watch();
20096
+ return () => {
20097
+ window.removeEventListener("message", handle);
20098
+ ref.current.unwatch();
20099
+ };
20100
+ }, [id]);
20101
+ return chat;
20102
+ }
20103
+
20104
+ // src/ServicesTab.tsx
20105
+ var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
20106
+ function closeStreamingAssistant2(items) {
20107
+ const last = items[items.length - 1];
20108
+ if (!last || last.kind !== "assistant" || !last.streaming) return items;
20109
+ return [...items.slice(0, -1), { ...last, streaming: false }];
20110
+ }
20111
+ function reconstructChatItems2(messages) {
20112
+ let items = [];
20113
+ for (const msg of messages) {
20114
+ if (msg.role === "user") {
20115
+ items = closeStreamingAssistant2(items);
20116
+ items.push({ kind: "user", text: msg.content });
20117
+ } else if (msg.role === "assistant") {
20118
+ items = closeStreamingAssistant2(items);
20119
+ if (msg.parts && msg.parts.length > 0) {
20120
+ for (const part of msg.parts) {
20121
+ if (part.type === "text") {
20122
+ items.push({ kind: "assistant", text: part.text, streaming: false });
20123
+ } else if (part.type === "thinking") {
20124
+ items.push({ kind: "thinking", text: part.text });
20125
+ } else if (part.type === "tool_use") {
20126
+ items.push({
20127
+ kind: "tool",
20128
+ id: part.id,
20129
+ name: part.name,
20130
+ args: part.args,
20131
+ result: null
20132
+ });
20133
+ }
20134
+ }
20135
+ } else {
20136
+ items.push({ kind: "assistant", text: msg.content, streaming: false });
20137
+ }
20138
+ } else if (msg.role === "tool") {
20139
+ const toolCallId = msg.toolCallId;
20140
+ if (toolCallId) {
20141
+ const idx = items.findIndex(
20142
+ (it2) => it2.kind === "tool" && it2.id === toolCallId && it2.result === null
20143
+ );
20144
+ if (idx !== -1) {
20145
+ const toolItem = items[idx];
20146
+ items[idx] = { ...toolItem, result: msg.content };
20147
+ } else {
20148
+ items.push({
20149
+ kind: "tool",
20150
+ id: toolCallId,
20151
+ name: "unknown_tool",
20152
+ args: {},
20153
+ result: msg.content
20154
+ });
20155
+ }
20156
+ }
20157
+ }
20158
+ }
20159
+ return closeStreamingAssistant2(items);
20160
+ }
20161
+ function LiveServiceRun({
20162
+ runId,
20163
+ agentName,
20164
+ postMessage,
20165
+ onFinished
20166
+ }) {
20167
+ const chat = useCycleStream(runId, {
20168
+ watch: () => postMessage({ type: "watchServiceRun", runId }),
20169
+ unwatch: () => postMessage({ type: "unwatchCycle", sessionId: runId }),
20170
+ onDone: onFinished
20171
+ });
20172
+ const running = chat.status === "streaming";
20173
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
20174
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "execution-console__run-header", children: [
20175
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
20176
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: "12px", fontWeight: 700 }, children: [
20177
+ "Run: ",
20178
+ runId
20179
+ ] }),
20180
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", color: "var(--vscode-descriptionForeground)" }, children: running ? "Running\u2026" : "Finished without writing a log" })
20181
+ ] }),
20182
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: "11px", color: "var(--vscode-descriptionForeground)" }, children: [
20183
+ "Agent: ",
20184
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: agentName })
20185
+ ] })
20186
+ ] }),
20187
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "messages", style: { padding: "20px 24px", flex: 1, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MessageList, { items: chat.items, isStreaming: running, agentName }) }),
20188
+ chat.errorText && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "notice notice--block", children: chat.errorText })
20189
+ ] });
20190
+ }
19934
20191
  function ServicesTab({ config, agents, postMessage, taskRuns = {} }) {
19935
20192
  const tasks = config.scheduler?.tasks || [];
19936
- const [editingTask, setEditingTask] = (0, import_react14.useState)(null);
19937
- const [isCreating, setIsCreating] = (0, import_react14.useState)(false);
19938
- const [viewingTaskLogs, setViewingTaskLogs] = (0, import_react14.useState)(null);
19939
- const [selectedRunId, setSelectedRunId] = (0, import_react14.useState)(null);
19940
- const [name, setName] = (0, import_react14.useState)("");
19941
- const [type, setType] = (0, import_react14.useState)("heartbeat");
19942
- const [enabled, setEnabled] = (0, import_react14.useState)(true);
19943
- const [agentId, setAgentId] = (0, import_react14.useState)("");
19944
- const [workingDir, setWorkingDir] = (0, import_react14.useState)("");
19945
- const [prompt, setPrompt] = (0, import_react14.useState)("");
19946
- const [cron, setCron] = (0, import_react14.useState)("*/15 * * * *");
19947
- const [telegramBotToken, setTelegramBotToken] = (0, import_react14.useState)("");
19948
- const [telegramAllowedChats, setTelegramAllowedChats] = (0, import_react14.useState)("");
19949
- const [imapHost, setImapHost] = (0, import_react14.useState)("");
19950
- const [imapPort, setImapPort] = (0, import_react14.useState)("993");
19951
- const [imapUser, setImapUser] = (0, import_react14.useState)("");
19952
- const [imapPassword, setImapPassword] = (0, import_react14.useState)("");
19953
- const [imapSecure, setImapSecure] = (0, import_react14.useState)(true);
19954
- const [smtpHost, setSmtpHost] = (0, import_react14.useState)("");
19955
- const [smtpPort, setSmtpPort] = (0, import_react14.useState)("587");
19956
- const [smtpSecure, setSmtpSecure] = (0, import_react14.useState)(false);
19957
- const [smtpFrom, setSmtpFrom] = (0, import_react14.useState)("");
19958
- const [smtpUser, setSmtpUser] = (0, import_react14.useState)("");
19959
- const [smtpPassword, setSmtpPassword] = (0, import_react14.useState)("");
19960
- const [allowedSenders, setAllowedSenders] = (0, import_react14.useState)("");
19961
- const [allowedRecipients, setAllowedRecipients] = (0, import_react14.useState)("");
19962
- const [allowedAgents, setAllowedAgents] = (0, import_react14.useState)([]);
19963
- const [triageAccountId, setTriageAccountId] = (0, import_react14.useState)("");
19964
- const [triageRecipients, setTriageRecipients] = (0, import_react14.useState)("");
19965
- const [triageMaxEmails, setTriageMaxEmails] = (0, import_react14.useState)("50");
19966
- const [triageSubjectPrefix, setTriageSubjectPrefix] = (0, import_react14.useState)("");
19967
- const [errorMsg, setErrorMsg] = (0, import_react14.useState)(null);
20193
+ const [editingTask, setEditingTask] = (0, import_react15.useState)(null);
20194
+ const [isCreating, setIsCreating] = (0, import_react15.useState)(false);
20195
+ const [viewingTaskLogs, setViewingTaskLogs] = (0, import_react15.useState)(null);
20196
+ const [selectedRunId, setSelectedRunId] = (0, import_react15.useState)(null);
20197
+ const [liveRuns, setLiveRuns] = (0, import_react15.useState)({});
20198
+ (0, import_react15.useEffect)(() => {
20199
+ function handle(event) {
20200
+ const msg = event.data;
20201
+ if (!msg || typeof msg !== "object" || msg.type !== "serviceRunActive") return;
20202
+ setLiveRuns((prev) => ({ ...prev, [msg.serviceId]: { runId: msg.runId, finished: false } }));
20203
+ }
20204
+ window.addEventListener("message", handle);
20205
+ return () => window.removeEventListener("message", handle);
20206
+ }, []);
20207
+ const [name, setName] = (0, import_react15.useState)("");
20208
+ const [type, setType] = (0, import_react15.useState)("heartbeat");
20209
+ const [enabled, setEnabled] = (0, import_react15.useState)(true);
20210
+ const [agentId, setAgentId] = (0, import_react15.useState)("");
20211
+ const [workingDir, setWorkingDir] = (0, import_react15.useState)("");
20212
+ const [prompt, setPrompt] = (0, import_react15.useState)("");
20213
+ const [cron, setCron] = (0, import_react15.useState)("*/15 * * * *");
20214
+ const [telegramBotToken, setTelegramBotToken] = (0, import_react15.useState)("");
20215
+ const [telegramAllowedChats, setTelegramAllowedChats] = (0, import_react15.useState)("");
20216
+ const [imapHost, setImapHost] = (0, import_react15.useState)("");
20217
+ const [imapPort, setImapPort] = (0, import_react15.useState)("993");
20218
+ const [imapUser, setImapUser] = (0, import_react15.useState)("");
20219
+ const [imapPassword, setImapPassword] = (0, import_react15.useState)("");
20220
+ const [imapSecure, setImapSecure] = (0, import_react15.useState)(true);
20221
+ const [smtpHost, setSmtpHost] = (0, import_react15.useState)("");
20222
+ const [smtpPort, setSmtpPort] = (0, import_react15.useState)("587");
20223
+ const [smtpSecure, setSmtpSecure] = (0, import_react15.useState)(false);
20224
+ const [smtpFrom, setSmtpFrom] = (0, import_react15.useState)("");
20225
+ const [smtpUser, setSmtpUser] = (0, import_react15.useState)("");
20226
+ const [smtpPassword, setSmtpPassword] = (0, import_react15.useState)("");
20227
+ const [allowedSenders, setAllowedSenders] = (0, import_react15.useState)("");
20228
+ const [allowedRecipients, setAllowedRecipients] = (0, import_react15.useState)("");
20229
+ const [allowedAgents, setAllowedAgents] = (0, import_react15.useState)([]);
20230
+ const [triageAccountId, setTriageAccountId] = (0, import_react15.useState)("");
20231
+ const [triageRecipients, setTriageRecipients] = (0, import_react15.useState)("");
20232
+ const [triageMaxEmails, setTriageMaxEmails] = (0, import_react15.useState)("50");
20233
+ const [triageSubjectPrefix, setTriageSubjectPrefix] = (0, import_react15.useState)("");
20234
+ const [errorMsg, setErrorMsg] = (0, import_react15.useState)(null);
19968
20235
  const startEdit = (task) => {
19969
20236
  setEditingTask(task);
19970
20237
  setIsCreating(false);
@@ -20198,13 +20465,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20198
20465
  const openLogViewer = (task) => {
20199
20466
  setViewingTaskLogs(task);
20200
20467
  setSelectedRunId(null);
20468
+ setLiveRuns((prev) => {
20469
+ if (!prev[task.id]?.finished) return prev;
20470
+ const { [task.id]: _gone, ...rest } = prev;
20471
+ return rest;
20472
+ });
20201
20473
  postMessage({ type: "getTaskRuns", taskId: task.id });
20202
20474
  };
20475
+ const runNow = (task) => {
20476
+ postMessage({ type: "runService", serviceId: task.id });
20477
+ openLogViewer(task);
20478
+ };
20479
+ const onLiveRunFinished = (serviceId, runId) => {
20480
+ setLiveRuns(
20481
+ (prev) => prev[serviceId]?.runId === runId ? { ...prev, [serviceId]: { runId, finished: true } } : prev
20482
+ );
20483
+ postMessage({ type: "getTaskRuns", taskId: serviceId });
20484
+ };
20203
20485
  const showForm = isCreating || editingTask !== null;
20204
20486
  const runs = viewingTaskLogs ? taskRuns[viewingTaskLogs.id] || [] : [];
20205
- const activeRunId = selectedRunId || runs[0]?.runId;
20487
+ const live = viewingTaskLogs ? liveRuns[viewingTaskLogs.id] : void 0;
20488
+ const liveUnsaved = live && !runs.some((r) => r.runId === live.runId) ? live : void 0;
20489
+ const activeRunId = selectedRunId || liveUnsaved?.runId || runs[0]?.runId;
20206
20490
  const activeRun = runs.find((r) => r.runId === activeRunId);
20207
- const activeRunChatItems = (0, import_react14.useMemo)(() => activeRun ? reconstructChatItems(activeRun.messages || []) : [], [activeRun]);
20491
+ const activeRunChatItems = (0, import_react15.useMemo)(() => activeRun ? reconstructChatItems2(activeRun.messages || []) : [], [activeRun]);
20208
20492
  const selectedAgentName = viewingTaskLogs ? agents.find((a2) => a2.id === viewingTaskLogs.agentId)?.name : "";
20209
20493
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tab-pane services-tab", children: [
20210
20494
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tab-pane__header", children: [
@@ -20413,14 +20697,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20413
20697
  )
20414
20698
  ] }),
20415
20699
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
20416
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "triage-max", children: "Max emails per run (1-50)" }),
20700
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "triage-max", children: "Max emails per run (1-200)" }),
20417
20701
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
20418
20702
  "input",
20419
20703
  {
20420
20704
  id: "triage-max",
20421
20705
  type: "number",
20422
20706
  min: 1,
20423
- max: 50,
20707
+ max: 200,
20424
20708
  value: triageMaxEmails,
20425
20709
  onChange: (e) => setTriageMaxEmails(e.target.value)
20426
20710
  }
@@ -20855,6 +21139,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20855
21139
  ] })
20856
21140
  ] }),
20857
21141
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card__actions", children: [
21142
+ (task.type === "heartbeat" || task.type === "email_triage") && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
21143
+ "button",
21144
+ {
21145
+ className: "icon-btn",
21146
+ onClick: () => runNow(task),
21147
+ title: "Run now (ignores schedule and Off state)",
21148
+ "aria-label": "Run now",
21149
+ style: { fontSize: "12px", marginRight: "4px" },
21150
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Play, { size: 13 })
21151
+ }
21152
+ ),
20858
21153
  (task.type === "heartbeat" || task.type === "email_triage") && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
20859
21154
  "button",
20860
21155
  {
@@ -20910,9 +21205,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20910
21205
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "execution-console__body", children: [
20911
21206
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "execution-console__runs-list", children: [
20912
21207
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "app__sidebar-section-title", style: { paddingLeft: "4px", marginBottom: "8px" }, children: "Execution History" }),
20913
- runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "app__sidebar-empty-text", children: "No execution runs recorded yet." }) : runs.map((run) => {
20914
- const isSelected = run.runId === activeRunId;
20915
- const date = new Date(run.timestamp);
21208
+ liveUnsaved && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
21209
+ "button",
21210
+ {
21211
+ className: `execution-console__run-item ${liveUnsaved.runId === activeRunId ? "execution-console__run-item--active" : ""}`,
21212
+ onClick: () => setSelectedRunId(liveUnsaved.runId),
21213
+ children: [
21214
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%" }, children: [
21215
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", color: "var(--vscode-descriptionForeground)" }, children: liveUnsaved.runId }),
21216
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: {
21217
+ fontSize: "9px",
21218
+ fontWeight: 700,
21219
+ padding: "1px 5px",
21220
+ borderRadius: "10px",
21221
+ background: "oklch(0.72 0.14 230 / 0.12)",
21222
+ color: "oklch(0.72 0.14 230)",
21223
+ border: "1px solid oklch(0.72 0.14 230 / 0.3)"
21224
+ }, children: liveUnsaved.finished ? "ENDED" : "RUNNING" })
21225
+ ] }),
21226
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "11px", fontWeight: 600, marginTop: "2px" }, children: liveUnsaved.finished ? "No log written" : "In progress" })
21227
+ ]
21228
+ }
21229
+ ),
21230
+ runs.length === 0 ? !liveUnsaved && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "app__sidebar-empty-text", children: "No execution runs recorded yet." }) : runs.map((run) => {
21231
+ const isSelected = run.runId === activeRunId;
21232
+ const date = new Date(run.timestamp);
20916
21233
  const formattedDate = date.toLocaleString();
20917
21234
  const isSuccess = run.status === "success";
20918
21235
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
@@ -20940,7 +21257,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20940
21257
  );
20941
21258
  })
20942
21259
  ] }),
20943
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "execution-console__run-details", children: activeRun ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
21260
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "execution-console__run-details", children: liveUnsaved && activeRunId === liveUnsaved.runId ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
21261
+ LiveServiceRun,
21262
+ {
21263
+ runId: liveUnsaved.runId,
21264
+ agentName: selectedAgentName,
21265
+ postMessage,
21266
+ onFinished: () => onLiveRunFinished(viewingTaskLogs.id, liveUnsaved.runId)
21267
+ },
21268
+ liveUnsaved.runId
21269
+ ) : activeRun ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
20944
21270
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "execution-console__run-header", children: [
20945
21271
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
20946
21272
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: "12px", fontWeight: 700 }, children: [
@@ -20972,7 +21298,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
20972
21298
  }
20973
21299
 
20974
21300
  // src/VoiceTab.tsx
20975
- var import_react18 = __toESM(require_react(), 1);
21301
+ var import_react19 = __toESM(require_react(), 1);
20976
21302
 
20977
21303
  // src/voice_utils.ts
20978
21304
  var END_OF_TURN_MS = 1200;
@@ -21047,7 +21373,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21047
21373
  }
21048
21374
 
21049
21375
  // src/VoiceBackendBlock.tsx
21050
- var import_react15 = __toESM(require_react(), 1);
21376
+ var import_react16 = __toESM(require_react(), 1);
21051
21377
 
21052
21378
  // src/voice_backend_utils.ts
21053
21379
  function backendStatusText(status) {
@@ -21073,11 +21399,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21073
21399
  onStatusChange,
21074
21400
  hint
21075
21401
  }) {
21076
- const [busy, setBusy] = (0, import_react15.useState)(false);
21077
- const [progress, setProgress] = (0, import_react15.useState)(null);
21078
- const [error, setError] = (0, import_react15.useState)(null);
21079
- const [confirmingDelete, setConfirmingDelete] = (0, import_react15.useState)(false);
21080
- const confirmDeleteTimer = (0, import_react15.useRef)(null);
21402
+ const [busy, setBusy] = (0, import_react16.useState)(false);
21403
+ const [progress, setProgress] = (0, import_react16.useState)(null);
21404
+ const [error, setError] = (0, import_react16.useState)(null);
21405
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react16.useState)(false);
21406
+ const confirmDeleteTimer = (0, import_react16.useRef)(null);
21081
21407
  const disarmDelete = () => {
21082
21408
  if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
21083
21409
  confirmDeleteTimer.current = null;
@@ -21091,14 +21417,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21091
21417
  CONFIRM_DELETE_MS
21092
21418
  );
21093
21419
  };
21094
- (0, import_react15.useEffect)(
21420
+ (0, import_react16.useEffect)(
21095
21421
  () => () => {
21096
21422
  if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
21097
21423
  },
21098
21424
  []
21099
21425
  );
21100
- const lastContainer = (0, import_react15.useRef)(null);
21101
- (0, import_react15.useEffect)(() => {
21426
+ const lastContainer = (0, import_react16.useRef)(null);
21427
+ (0, import_react16.useEffect)(() => {
21102
21428
  if (status.container === "running" && lastContainer.current !== "running") {
21103
21429
  setError(null);
21104
21430
  }
@@ -21208,7 +21534,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21208
21534
  }
21209
21535
 
21210
21536
  // src/BuiltinVoiceBlock.tsx
21211
- var import_react16 = __toESM(require_react(), 1);
21537
+ var import_react17 = __toESM(require_react(), 1);
21212
21538
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
21213
21539
  var MB = 1024 * 1024;
21214
21540
  function sizeLabel(bytes) {
@@ -21228,10 +21554,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21228
21554
  voice,
21229
21555
  onVoiceChange
21230
21556
  }) {
21231
- const [busy, setBusy] = (0, import_react16.useState)(false);
21232
- const [progress, setProgress] = (0, import_react16.useState)(null);
21233
- const [error, setError] = (0, import_react16.useState)(null);
21234
- const [confirmingDelete, setConfirmingDelete] = (0, import_react16.useState)(false);
21557
+ const [busy, setBusy] = (0, import_react17.useState)(false);
21558
+ const [progress, setProgress] = (0, import_react17.useState)(null);
21559
+ const [error, setError] = (0, import_react17.useState)(null);
21560
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react17.useState)(false);
21235
21561
  const loadError = status.runtime.loadError;
21236
21562
  const selected = status.languages.find((l) => l.id === language);
21237
21563
  const query = `?language=${encodeURIComponent(language)}`;
@@ -21358,17 +21684,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21358
21684
  }
21359
21685
 
21360
21686
  // src/BuiltinSttBlock.tsx
21361
- var import_react17 = __toESM(require_react(), 1);
21687
+ var import_react18 = __toESM(require_react(), 1);
21362
21688
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
21363
21689
  var MB2 = 1024 * 1024;
21364
21690
  function sizeLabel2(bytes) {
21365
21691
  return `${Math.max(1, Math.round(bytes / MB2))} MB`;
21366
21692
  }
21367
21693
  function BuiltinSttBlock({ status, onStatusChange, model, onModelChange }) {
21368
- const [busy, setBusy] = (0, import_react17.useState)(false);
21369
- const [progress, setProgress] = (0, import_react17.useState)(null);
21370
- const [error, setError] = (0, import_react17.useState)(null);
21371
- const [confirmingDelete, setConfirmingDelete] = (0, import_react17.useState)(false);
21694
+ const [busy, setBusy] = (0, import_react18.useState)(false);
21695
+ const [progress, setProgress] = (0, import_react18.useState)(null);
21696
+ const [error, setError] = (0, import_react18.useState)(null);
21697
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react18.useState)(false);
21372
21698
  const loadError = status.runtime.loadError;
21373
21699
  const selected = status.stt.find((m2) => m2.id === model);
21374
21700
  const query = `?stt=${encodeURIComponent(model)}`;
@@ -21839,39 +22165,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21839
22165
  }
21840
22166
  function VoiceTab({ config, onSave, postMessage, sttCatalogResult, ttsCatalogResult }) {
21841
22167
  const current = config.voice ?? EMPTY;
21842
- const [enabled, setEnabled] = (0, import_react18.useState)(current.enabled);
21843
- const [endpoint, setEndpoint] = (0, import_react18.useState)(current.endpoint);
21844
- const [apiKey, setApiKey] = (0, import_react18.useState)(current.apiKey ?? "");
21845
- const [sttModel, setSttModel] = (0, import_react18.useState)(current.sttModel);
21846
- const [ttsEndpoint, setTtsEndpoint] = (0, import_react18.useState)(current.ttsEndpoint ?? "");
21847
- const [ttsApiKey, setTtsApiKey] = (0, import_react18.useState)(current.ttsApiKey ?? "");
21848
- const [ttsModel, setTtsModel] = (0, import_react18.useState)(current.ttsModel ?? "");
21849
- const [ttsVoice, setTtsVoice] = (0, import_react18.useState)(current.ttsVoice ?? "");
21850
- const [ttsSpeed, setTtsSpeed] = (0, import_react18.useState)(
22168
+ const [enabled, setEnabled] = (0, import_react19.useState)(current.enabled);
22169
+ const [endpoint, setEndpoint] = (0, import_react19.useState)(current.endpoint);
22170
+ const [apiKey, setApiKey] = (0, import_react19.useState)(current.apiKey ?? "");
22171
+ const [sttModel, setSttModel] = (0, import_react19.useState)(current.sttModel);
22172
+ const [ttsEndpoint, setTtsEndpoint] = (0, import_react19.useState)(current.ttsEndpoint ?? "");
22173
+ const [ttsApiKey, setTtsApiKey] = (0, import_react19.useState)(current.ttsApiKey ?? "");
22174
+ const [ttsModel, setTtsModel] = (0, import_react19.useState)(current.ttsModel ?? "");
22175
+ const [ttsVoice, setTtsVoice] = (0, import_react19.useState)(current.ttsVoice ?? "");
22176
+ const [ttsSpeed, setTtsSpeed] = (0, import_react19.useState)(
21851
22177
  current.ttsSpeed === void 0 ? "" : String(current.ttsSpeed)
21852
22178
  );
21853
- const [lang, setLang] = (0, import_react18.useState)(current.lang ?? "");
21854
- const [bufferMs, setBufferMs] = (0, import_react18.useState)(
22179
+ const [lang, setLang] = (0, import_react19.useState)(current.lang ?? "");
22180
+ const [bufferMs, setBufferMs] = (0, import_react19.useState)(
21855
22181
  current.playbackBufferMs === void 0 ? "" : String(current.playbackBufferMs)
21856
22182
  );
21857
- const [ttsEngine, setTtsEngine] = (0, import_react18.useState)(current.ttsEngine ?? "endpoint");
21858
- const [sttEngine, setSttEngine] = (0, import_react18.useState)(current.sttEngine ?? "endpoint");
21859
- const [sttBuiltinModel, setSttBuiltinModel] = (0, import_react18.useState)(current.sttBuiltinModel ?? "base");
21860
- const [ttsLanguage, setTtsLanguage] = (0, import_react18.useState)(current.ttsLanguage ?? "");
21861
- const [pronEnabled, setPronEnabled] = (0, import_react18.useState)(current.pronunciationEnabled ?? false);
21862
- const [pronunciation, setPronunciation] = (0, import_react18.useState)(
22183
+ const [ttsEngine, setTtsEngine] = (0, import_react19.useState)(current.ttsEngine ?? "endpoint");
22184
+ const [sttEngine, setSttEngine] = (0, import_react19.useState)(current.sttEngine ?? "endpoint");
22185
+ const [sttBuiltinModel, setSttBuiltinModel] = (0, import_react19.useState)(current.sttBuiltinModel ?? "base");
22186
+ const [ttsLanguage, setTtsLanguage] = (0, import_react19.useState)(current.ttsLanguage ?? "");
22187
+ const [pronEnabled, setPronEnabled] = (0, import_react19.useState)(current.pronunciationEnabled ?? false);
22188
+ const [pronunciation, setPronunciation] = (0, import_react19.useState)(
21863
22189
  current.pronunciation ?? {}
21864
22190
  );
21865
- const [builtinStatus, setBuiltinStatus] = (0, import_react18.useState)(null);
21866
- const [listening, setListening] = (0, import_react18.useState)(false);
21867
- const [listenError, setListenError] = (0, import_react18.useState)(null);
21868
- const listenAbort = (0, import_react18.useRef)(null);
21869
- const [fetching, setFetching] = (0, import_react18.useState)(false);
21870
- const [fetchingTts, setFetchingTts] = (0, import_react18.useState)(false);
21871
- const [saveState, setSaveState] = (0, import_react18.useState)("idle");
21872
- const pendingSave = (0, import_react18.useRef)(null);
21873
- const [autoStartBackend, setAutoStartBackend] = (0, import_react18.useState)(current.autoStartBackend ?? false);
21874
- const [backendStatuses, setBackendStatuses] = (0, import_react18.useState)(null);
22191
+ const [builtinStatus, setBuiltinStatus] = (0, import_react19.useState)(null);
22192
+ const [listening, setListening] = (0, import_react19.useState)(false);
22193
+ const [listenError, setListenError] = (0, import_react19.useState)(null);
22194
+ const listenAbort = (0, import_react19.useRef)(null);
22195
+ const [fetching, setFetching] = (0, import_react19.useState)(false);
22196
+ const [fetchingTts, setFetchingTts] = (0, import_react19.useState)(false);
22197
+ const [saveState, setSaveState] = (0, import_react19.useState)("idle");
22198
+ const pendingSave = (0, import_react19.useRef)(null);
22199
+ const [autoStartBackend, setAutoStartBackend] = (0, import_react19.useState)(current.autoStartBackend ?? false);
22200
+ const [backendStatuses, setBackendStatuses] = (0, import_react19.useState)(null);
21875
22201
  const fetchBackendStatuses = async () => {
21876
22202
  try {
21877
22203
  const res = await fetch("/api/voice/backend");
@@ -21881,12 +22207,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21881
22207
  } catch {
21882
22208
  }
21883
22209
  };
21884
- (0, import_react18.useEffect)(() => {
22210
+ (0, import_react19.useEffect)(() => {
21885
22211
  fetch("/api/voice/builtin").then((res) => res.ok ? res.json() : null).then((st2) => st2 && setBuiltinStatus(st2)).catch(() => {
21886
22212
  });
21887
22213
  return () => listenAbort.current?.abort();
21888
22214
  }, []);
21889
- (0, import_react18.useEffect)(() => {
22215
+ (0, import_react19.useEffect)(() => {
21890
22216
  fetchBackendStatuses();
21891
22217
  const interval = setInterval(fetchBackendStatuses, BACKEND_POLL_MS);
21892
22218
  return () => clearInterval(interval);
@@ -21896,23 +22222,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21896
22222
  (prev) => prev ? { ...prev, [target]: status } : { stt: status, tts: null }
21897
22223
  );
21898
22224
  };
21899
- (0, import_react18.useEffect)(() => {
22225
+ (0, import_react19.useEffect)(() => {
21900
22226
  if (sttCatalogResult) setFetching(false);
21901
22227
  }, [sttCatalogResult]);
21902
- (0, import_react18.useEffect)(() => {
22228
+ (0, import_react19.useEffect)(() => {
21903
22229
  if (ttsCatalogResult) setFetchingTts(false);
21904
22230
  }, [ttsCatalogResult]);
21905
- (0, import_react18.useEffect)(() => {
22231
+ (0, import_react19.useEffect)(() => {
21906
22232
  if (saveState !== "saving" || pendingSave.current === null) return;
21907
22233
  if (voiceSignature(config.voice) !== pendingSave.current) return;
21908
22234
  setSaveState("saved");
21909
22235
  }, [config.voice, saveState]);
21910
- (0, import_react18.useEffect)(() => {
22236
+ (0, import_react19.useEffect)(() => {
21911
22237
  if (saveState !== "saved") return;
21912
22238
  const clear = setTimeout(() => setSaveState("idle"), 2500);
21913
22239
  return () => clearTimeout(clear);
21914
22240
  }, [saveState]);
21915
- (0, import_react18.useEffect)(() => {
22241
+ (0, import_react19.useEffect)(() => {
21916
22242
  if (saveState !== "saving") return;
21917
22243
  const giveUp = setTimeout(() => setSaveState("idle"), 6e3);
21918
22244
  return () => clearTimeout(giveUp);
@@ -21957,7 +22283,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
21957
22283
  const builtin = ttsEngine === "builtin";
21958
22284
  const sttBuiltin = sttEngine === "builtin" && !!builtinStatus;
21959
22285
  const showEndpoint = !sttBuiltin || !builtin;
21960
- const synthCode = (0, import_react18.useMemo)(() => {
22286
+ const synthCode = (0, import_react19.useMemo)(() => {
21961
22287
  if (builtin) return builtinStatus?.languages.find((l) => l.id === ttsLanguage)?.code ?? null;
21962
22288
  return lang.trim().split(/[-_]/)[0].toLowerCase() || null;
21963
22289
  }, [builtin, builtinStatus, ttsLanguage, lang]);
@@ -22408,7 +22734,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22408
22734
  }
22409
22735
 
22410
22736
  // src/MemoryTab.tsx
22411
- var import_react19 = __toESM(require_react(), 1);
22737
+ var import_react20 = __toESM(require_react(), 1);
22412
22738
 
22413
22739
  // src/memory_tab_utils.ts
22414
22740
  function buildMemoryConfig(form) {
@@ -22430,23 +22756,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22430
22756
  var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
22431
22757
  function MemoryTab({ config, agents, onSave }) {
22432
22758
  const current = config.memory;
22433
- const [enabled, setEnabled] = (0, import_react19.useState)(!!current);
22434
- const [agentId, setAgentId] = (0, import_react19.useState)(current?.agentId ?? "");
22435
- const [sweepMinutes, setSweepMinutes] = (0, import_react19.useState)(
22759
+ const [enabled, setEnabled] = (0, import_react20.useState)(!!current);
22760
+ const [agentId, setAgentId] = (0, import_react20.useState)(current?.agentId ?? "");
22761
+ const [sweepMinutes, setSweepMinutes] = (0, import_react20.useState)(
22436
22762
  current?.sweepMinutes === void 0 ? "" : String(current.sweepMinutes)
22437
22763
  );
22438
- const [minNewMessages, setMinNewMessages] = (0, import_react19.useState)(
22764
+ const [minNewMessages, setMinNewMessages] = (0, import_react20.useState)(
22439
22765
  current?.minNewMessages === void 0 ? "" : String(current.minNewMessages)
22440
22766
  );
22441
- const [saveState, setSaveState] = (0, import_react19.useState)("idle");
22442
- const pendingSave = (0, import_react19.useRef)(null);
22443
- (0, import_react19.useEffect)(() => {
22767
+ const [saveState, setSaveState] = (0, import_react20.useState)("idle");
22768
+ const pendingSave = (0, import_react20.useRef)(null);
22769
+ (0, import_react20.useEffect)(() => {
22444
22770
  if (saveState !== "saving" || pendingSave.current === null) return;
22445
22771
  if (memorySignature(config.memory) !== pendingSave.current)
22446
22772
  return;
22447
22773
  setSaveState("saved");
22448
22774
  }, [config.memory, saveState]);
22449
- (0, import_react19.useEffect)(() => {
22775
+ (0, import_react20.useEffect)(() => {
22450
22776
  if (saveState !== "saved") return;
22451
22777
  const t = setTimeout(() => setSaveState("idle"), 2e3);
22452
22778
  return () => clearTimeout(t);
@@ -22533,7 +22859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22533
22859
  }
22534
22860
 
22535
22861
  // src/DesktopTab.tsx
22536
- var import_react20 = __toESM(require_react(), 1);
22862
+ var import_react21 = __toESM(require_react(), 1);
22537
22863
 
22538
22864
  // src/desktop_tab_utils.ts
22539
22865
  var DEFAULT_ASSISTANT_SHORTCUT = "CommandOrControl+Shift+Space";
@@ -22551,18 +22877,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22551
22877
  var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
22552
22878
  function DesktopTab({ config, agents, onSave }) {
22553
22879
  const current = config.desktopAssistant;
22554
- const [enabled, setEnabled] = (0, import_react20.useState)(!!current);
22555
- const [agentId, setAgentId] = (0, import_react20.useState)(current?.agentId ?? "");
22556
- const [shortcut, setShortcut] = (0, import_react20.useState)(current?.shortcut ?? "");
22557
- const [saveState, setSaveState] = (0, import_react20.useState)("idle");
22558
- const pendingSave = (0, import_react20.useRef)(null);
22559
- (0, import_react20.useEffect)(() => {
22880
+ const [enabled, setEnabled] = (0, import_react21.useState)(!!current);
22881
+ const [agentId, setAgentId] = (0, import_react21.useState)(current?.agentId ?? "");
22882
+ const [shortcut, setShortcut] = (0, import_react21.useState)(current?.shortcut ?? "");
22883
+ const [saveState, setSaveState] = (0, import_react21.useState)("idle");
22884
+ const pendingSave = (0, import_react21.useRef)(null);
22885
+ (0, import_react21.useEffect)(() => {
22560
22886
  if (saveState !== "saving" || pendingSave.current === null) return;
22561
22887
  if (desktopAssistantSignature(config.desktopAssistant) !== pendingSave.current)
22562
22888
  return;
22563
22889
  setSaveState("saved");
22564
22890
  }, [config.desktopAssistant, saveState]);
22565
- (0, import_react20.useEffect)(() => {
22891
+ (0, import_react21.useEffect)(() => {
22566
22892
  if (saveState !== "saved") return;
22567
22893
  const t = setTimeout(() => setSaveState("idle"), 2e3);
22568
22894
  return () => clearTimeout(t);
@@ -22644,8 +22970,156 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22644
22970
  ] });
22645
22971
  }
22646
22972
 
22647
- // src/SettingsPanel.tsx
22973
+ // src/ApiAccessTab.tsx
22974
+ var import_react22 = __toESM(require_react(), 1);
22648
22975
  var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
22976
+ function ApiAccessTab() {
22977
+ const [status, setStatus] = (0, import_react22.useState)(null);
22978
+ const [port, setPort] = (0, import_react22.useState)("");
22979
+ const [name, setName] = (0, import_react22.useState)("");
22980
+ const [created, setCreated] = (0, import_react22.useState)(null);
22981
+ const [copied, setCopied] = (0, import_react22.useState)(false);
22982
+ const [confirmId, setConfirmId] = (0, import_react22.useState)(null);
22983
+ const [error, setError] = (0, import_react22.useState)(null);
22984
+ const call = (0, import_react22.useCallback)(async (path, init) => {
22985
+ setError(null);
22986
+ try {
22987
+ const res = await fetch(path, {
22988
+ ...init,
22989
+ headers: init?.body ? { "content-type": "application/json" } : void 0
22990
+ });
22991
+ const data = await res.json();
22992
+ if (!res.ok) {
22993
+ setError(data?.error ?? `Request failed (${res.status})`);
22994
+ return null;
22995
+ }
22996
+ setStatus(data);
22997
+ return data;
22998
+ } catch {
22999
+ setError("The server did not answer.");
23000
+ return null;
23001
+ }
23002
+ }, []);
23003
+ (0, import_react22.useEffect)(() => {
23004
+ void call("/api/access").then((s) => {
23005
+ if (s) setPort(s.port === null ? "" : String(s.port));
23006
+ });
23007
+ }, [call]);
23008
+ const savePort = () => call("/api/access/port", { method: "PUT", body: JSON.stringify({ port: port.trim() === "" ? null : port }) });
23009
+ const createToken = async () => {
23010
+ const data = await call("/api/access/tokens", { method: "POST", body: JSON.stringify({ name }) });
23011
+ if (!data?.token) return;
23012
+ setCreated(data.token);
23013
+ setCopied(false);
23014
+ setName("");
23015
+ };
23016
+ const revoke = async (id) => {
23017
+ setConfirmId(null);
23018
+ await call(`/api/access/tokens/${encodeURIComponent(id)}`, { method: "DELETE" });
23019
+ };
23020
+ const copy = async () => {
23021
+ if (!created) return;
23022
+ try {
23023
+ await navigator.clipboard.writeText(created);
23024
+ setCopied(true);
23025
+ } catch {
23026
+ }
23027
+ };
23028
+ if (!status) {
23029
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "glass-form", children: [
23030
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h4", { children: "API access" }),
23031
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "glass-form__body", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { className: error ? "form-error" : void 0, children: error ?? "Loading\u2026" }) })
23032
+ ] });
23033
+ }
23034
+ const { listener, portOverride } = status;
23035
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "glass-form", children: [
23036
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h4", { children: "API access" }),
23037
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "glass-form__body", children: [
23038
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "form-group", children: [
23039
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { htmlFor: "api-access-port", children: "API port" }),
23040
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23041
+ "input",
23042
+ {
23043
+ id: "api-access-port",
23044
+ type: "number",
23045
+ min: 1,
23046
+ max: 65535,
23047
+ placeholder: "off",
23048
+ value: port,
23049
+ onChange: (e) => setPort(e.target.value)
23050
+ }
23051
+ ),
23052
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("small", { children: [
23053
+ "A second port that serves the REST API to scripts and other programs. Every request to it must carry ",
23054
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("code", { children: "Authorization: Bearer <token>" }),
23055
+ ". Leave empty to keep it off. The address you are using now is not affected: it stays without authentication, so keep it on this machine or behind an authenticating proxy."
23056
+ ] }),
23057
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("small", { children: [
23058
+ "The project and task routes are described at",
23059
+ " ",
23060
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("a", { href: "/api/docs", target: "_blank", rel: "noreferrer", children: "/api/docs" }),
23061
+ " ",
23062
+ "(OpenAPI document: ",
23063
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("code", { children: "/api/openapi.json" }),
23064
+ ")."
23065
+ ] }),
23066
+ portOverride !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("small", { children: [
23067
+ "This server was started with ",
23068
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("code", { children: [
23069
+ "--api-port ",
23070
+ portOverride
23071
+ ] }),
23072
+ ", which takes precedence over the saved port until it restarts without it."
23073
+ ] }),
23074
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { role: "status", "aria-live": "polite", className: listener?.error ? "form-error" : void 0, children: !listener ? "The API is off." : listener.error ? `The API could not start on port ${listener.port}: ${listener.error}` : `The API is listening on ${listener.host}:${listener.port}.` })
23075
+ ] }),
23076
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "form-actions", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", onClick: savePort, children: "Save port" }) }),
23077
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "form-group", children: [
23078
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { htmlFor: "api-access-token-name", children: "Tokens" }),
23079
+ status.tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { children: "No tokens yet. Without one, every request to the API port is refused." }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "settings-list", children: status.tokens.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-card", children: [
23080
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-card__body", children: [
23081
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "settings-card__title", children: t.name }),
23082
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-card__metadata", children: [
23083
+ "Created ",
23084
+ new Date(t.createdAt).toLocaleString()
23085
+ ] })
23086
+ ] }),
23087
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "settings-card__actions", children: confirmId === t.id ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
23088
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "btn btn--secondary btn--xs", onClick: () => revoke(t.id), children: "Confirm revoke" }),
23089
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "btn btn--secondary btn--xs", onClick: () => setConfirmId(null), children: "Cancel" })
23090
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "btn btn--secondary btn--xs", onClick: () => setConfirmId(t.id), children: "Revoke" }) })
23091
+ ] }, t.id)) })
23092
+ ] }),
23093
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "form-group", children: [
23094
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23095
+ "input",
23096
+ {
23097
+ id: "api-access-token-name",
23098
+ type: "text",
23099
+ placeholder: "Name, e.g. the program that will use it",
23100
+ maxLength: 80,
23101
+ value: name,
23102
+ onChange: (e) => setName(e.target.value)
23103
+ }
23104
+ ),
23105
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "form-actions", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", onClick: createToken, disabled: !name.trim(), children: "Create token" }) }),
23106
+ created && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
23107
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { children: "Copy this token now. It is not stored and cannot be shown again." }),
23108
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "text", readOnly: true, value: created, "aria-label": "New token", onFocus: (e) => e.target.select() }),
23109
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "form-actions", children: [
23110
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", onClick: copy, children: "Copy" }),
23111
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", onClick: () => setCreated(null), children: "Done" }),
23112
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "status", "aria-live": "polite", className: "form-save-state", children: copied ? "Copied \u2713" : "" })
23113
+ ] })
23114
+ ] })
23115
+ ] }),
23116
+ error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { role: "alert", className: "form-error", children: error })
23117
+ ] })
23118
+ ] });
23119
+ }
23120
+
23121
+ // src/SettingsPanel.tsx
23122
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
22649
23123
  function SettingsPanel({
22650
23124
  layout = "compact",
22651
23125
  postMessage,
@@ -22666,16 +23140,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22666
23140
  onClose,
22667
23141
  initialTab = "providers"
22668
23142
  }) {
22669
- const [activeTab, setActiveTab] = (0, import_react21.useState)(initialTab);
23143
+ const [activeTab, setActiveTab] = (0, import_react23.useState)(initialTab);
22670
23144
  if (!settingsData) {
22671
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
22672
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
22673
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArrowLeft, { size: 14 }),
23145
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
23146
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
23147
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArrowLeft, { size: 14 }),
22674
23148
  " Back to Chat"
22675
23149
  ] }),
22676
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-panel__loading-spinner", children: [
22677
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "spinner" }),
22678
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Loading configurations..." })
23150
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "settings-panel__loading-spinner", children: [
23151
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "spinner" }),
23152
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Loading configurations..." })
22679
23153
  ] })
22680
23154
  ] });
22681
23155
  }
@@ -22683,7 +23157,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22683
23157
  const renderTabContent = () => {
22684
23158
  switch (activeTab) {
22685
23159
  case "providers":
22686
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23160
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22687
23161
  ProvidersTab,
22688
23162
  {
22689
23163
  config,
@@ -22695,7 +23169,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22695
23169
  }
22696
23170
  );
22697
23171
  case "projects":
22698
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23172
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22699
23173
  ProjectsTabSettings,
22700
23174
  {
22701
23175
  config,
@@ -22704,7 +23178,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22704
23178
  }
22705
23179
  );
22706
23180
  case "agents":
22707
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23181
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22708
23182
  AgentsTab,
22709
23183
  {
22710
23184
  config,
@@ -22718,7 +23192,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22718
23192
  }
22719
23193
  );
22720
23194
  case "plugins":
22721
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23195
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22722
23196
  PluginsTab,
22723
23197
  {
22724
23198
  pluginsFile,
@@ -22729,7 +23203,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22729
23203
  }
22730
23204
  );
22731
23205
  case "mcp":
22732
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23206
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22733
23207
  McpTab,
22734
23208
  {
22735
23209
  mcpServersFile,
@@ -22739,7 +23213,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22739
23213
  }
22740
23214
  );
22741
23215
  case "services":
22742
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23216
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22743
23217
  ServicesTab,
22744
23218
  {
22745
23219
  config,
@@ -22749,7 +23223,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22749
23223
  }
22750
23224
  );
22751
23225
  case "voice":
22752
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23226
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22753
23227
  VoiceTab,
22754
23228
  {
22755
23229
  config,
@@ -22760,7 +23234,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22760
23234
  }
22761
23235
  );
22762
23236
  case "memory":
22763
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23237
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22764
23238
  MemoryTab,
22765
23239
  {
22766
23240
  config,
@@ -22769,7 +23243,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22769
23243
  }
22770
23244
  );
22771
23245
  case "desktop":
22772
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23246
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22773
23247
  DesktopTab,
22774
23248
  {
22775
23249
  config,
@@ -22777,18 +23251,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22777
23251
  onSave: (updatedConfig) => postMessage({ type: "saveConfig", config: updatedConfig })
22778
23252
  }
22779
23253
  );
23254
+ case "api":
23255
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ApiAccessTab, {});
22780
23256
  }
22781
23257
  };
22782
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-panel", children: [
22783
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { className: "settings-panel__header", children: [
22784
- layout !== "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
22785
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArrowLeft, { size: 14 }),
23258
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "settings-panel", children: [
23259
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("header", { className: "settings-panel__header", children: [
23260
+ layout !== "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, title: "Go back to chat", children: [
23261
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArrowLeft, { size: 14 }),
22786
23262
  " Chat"
22787
23263
  ] }),
22788
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h2", { className: "settings-panel__title", children: "Caretaker Config" })
23264
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "settings-panel__title", children: "Caretaker Config" })
22789
23265
  ] }),
22790
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("nav", { className: "settings-panel__tabs", children: [
22791
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23266
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("nav", { className: "settings-panel__tabs", children: [
23267
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22792
23268
  "button",
22793
23269
  {
22794
23270
  className: `settings-panel__tab-btn ${activeTab === "providers" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22796,7 +23272,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22796
23272
  children: "Providers"
22797
23273
  }
22798
23274
  ),
22799
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23275
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22800
23276
  "button",
22801
23277
  {
22802
23278
  className: `settings-panel__tab-btn ${activeTab === "projects" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22804,7 +23280,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22804
23280
  children: "Projects"
22805
23281
  }
22806
23282
  ),
22807
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23283
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22808
23284
  "button",
22809
23285
  {
22810
23286
  className: `settings-panel__tab-btn ${activeTab === "agents" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22812,7 +23288,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22812
23288
  children: "Agents"
22813
23289
  }
22814
23290
  ),
22815
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23291
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22816
23292
  "button",
22817
23293
  {
22818
23294
  className: `settings-panel__tab-btn ${activeTab === "plugins" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22820,7 +23296,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22820
23296
  children: "Plugins"
22821
23297
  }
22822
23298
  ),
22823
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23299
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22824
23300
  "button",
22825
23301
  {
22826
23302
  className: `settings-panel__tab-btn ${activeTab === "mcp" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22828,7 +23304,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22828
23304
  children: "MCP"
22829
23305
  }
22830
23306
  ),
22831
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23307
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22832
23308
  "button",
22833
23309
  {
22834
23310
  className: `settings-panel__tab-btn ${activeTab === "services" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22836,7 +23312,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22836
23312
  children: "Services"
22837
23313
  }
22838
23314
  ),
22839
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23315
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22840
23316
  "button",
22841
23317
  {
22842
23318
  className: `settings-panel__tab-btn ${activeTab === "voice" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22844,7 +23320,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22844
23320
  children: "Voice"
22845
23321
  }
22846
23322
  ),
22847
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23323
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22848
23324
  "button",
22849
23325
  {
22850
23326
  className: `settings-panel__tab-btn ${activeTab === "memory" ? "settings-panel__tab-btn--active" : ""}`,
@@ -22852,265 +23328,60 @@ Please report this to https://github.com/markedjs/marked.`, e) {
22852
23328
  children: "Memory"
22853
23329
  }
22854
23330
  ),
22855
- layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
23331
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22856
23332
  "button",
22857
23333
  {
22858
23334
  className: `settings-panel__tab-btn ${activeTab === "desktop" ? "settings-panel__tab-btn--active" : ""}`,
22859
23335
  onClick: () => setActiveTab("desktop"),
22860
23336
  children: "Desktop"
22861
23337
  }
23338
+ ),
23339
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
23340
+ "button",
23341
+ {
23342
+ className: `settings-panel__tab-btn ${activeTab === "api" ? "settings-panel__tab-btn--active" : ""}`,
23343
+ onClick: () => setActiveTab("api"),
23344
+ children: "API"
23345
+ }
22862
23346
  )
22863
23347
  ] }),
22864
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("main", { className: "settings-panel__content", children: renderTabContent() })
23348
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("main", { className: "settings-panel__content", children: renderTabContent() })
22865
23349
  ] });
22866
23350
  }
22867
23351
 
22868
23352
  // src/ProjectsTab.tsx
22869
- var import_react23 = __toESM(require_react(), 1);
22870
-
22871
- // src/TaskCycleView.tsx
22872
- var import_react22 = __toESM(require_react(), 1);
22873
-
22874
- // src/chat_state.ts
22875
- function closeStreamingAssistant2(items) {
22876
- const last = items[items.length - 1];
22877
- if (!last || last.kind !== "assistant" || !last.streaming) return items;
22878
- return [...items.slice(0, -1), { ...last, streaming: false }];
22879
- }
22880
- function reconstructChatItems2(messages) {
22881
- let items = [];
22882
- for (const msg of messages) {
22883
- if (msg.recap) {
22884
- items = closeStreamingAssistant2(items);
22885
- items.push({ kind: "assistant", text: msg.content, streaming: false, label: "Cycle recap" });
22886
- } else if (msg.role === "user") {
22887
- items = closeStreamingAssistant2(items);
22888
- items.push({ kind: "user", text: msg.content, attachments: msg.attachments });
22889
- } else if (msg.role === "assistant") {
22890
- items = closeStreamingAssistant2(items);
22891
- if (msg.parts && msg.parts.length > 0) {
22892
- for (const part of msg.parts) {
22893
- if (part.type === "text") {
22894
- items.push({ kind: "assistant", text: part.text, streaming: false });
22895
- } else if (part.type === "thinking" && part.text.trim().length > 0) {
22896
- items.push({ kind: "thinking", text: part.text });
22897
- } else if (part.type === "tool_use") {
22898
- items.push({
22899
- kind: "tool",
22900
- id: part.id,
22901
- name: part.name,
22902
- args: part.args,
22903
- result: null
22904
- });
22905
- }
22906
- }
22907
- } else {
22908
- items.push({ kind: "assistant", text: msg.content, streaming: false });
22909
- }
22910
- } else if (msg.role === "tool") {
22911
- const toolCallId = msg.toolCallId;
22912
- if (toolCallId) {
22913
- const idx = items.findIndex(
22914
- (it2) => it2.kind === "tool" && it2.id === toolCallId && it2.result === null
22915
- );
22916
- if (idx !== -1) {
22917
- const toolItem = items[idx];
22918
- items[idx] = { ...toolItem, result: msg.content };
22919
- } else {
22920
- items.push({
22921
- kind: "tool",
22922
- id: toolCallId,
22923
- name: "unknown_tool",
22924
- args: {},
22925
- result: msg.content
22926
- });
22927
- }
22928
- }
22929
- }
22930
- }
22931
- return closeStreamingAssistant2(items);
22932
- }
22933
- function chatReducer(state, action) {
22934
- switch (action.kind) {
22935
- case "send-user":
22936
- return {
22937
- ...state,
22938
- status: "streaming",
22939
- errorText: null,
22940
- items: [...state.items, { kind: "user", text: action.text, attachments: action.attachments }]
22941
- };
22942
- case "append-chunk": {
22943
- const last = state.items[state.items.length - 1];
22944
- if (last && last.kind === "assistant" && last.streaming) {
22945
- const updated = { ...last, text: last.text + action.text };
22946
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22947
- }
22948
- return {
22949
- ...state,
22950
- items: [...state.items, { kind: "assistant", text: action.text, streaming: true }]
22951
- };
22952
- }
22953
- case "append-thinking": {
22954
- const last = state.items[state.items.length - 1];
22955
- if (last && last.kind === "thinking") {
22956
- const updated = { ...last, text: last.text + action.text };
22957
- return { ...state, items: [...state.items.slice(0, -1), updated] };
22958
- }
22959
- return {
22960
- ...state,
22961
- items: [...state.items, { kind: "thinking", text: action.text }]
22962
- };
22963
- }
22964
- case "tool-call":
22965
- return {
22966
- ...state,
22967
- items: [
22968
- ...closeStreamingAssistant2(state.items),
22969
- { kind: "tool", id: action.id, name: action.name, args: action.args, result: null }
22970
- ]
22971
- };
22972
- case "tool-result": {
22973
- const idx = state.items.findIndex(
22974
- (it2) => it2.kind === "tool" && it2.id === action.id && it2.result === null
22975
- );
22976
- if (idx < 0) return state;
22977
- const tool = state.items[idx];
22978
- const updated = { ...tool, result: action.content };
22979
- return {
22980
- ...state,
22981
- items: [...state.items.slice(0, idx), updated, ...state.items.slice(idx + 1)]
22982
- };
22983
- }
22984
- case "permission-request":
22985
- return {
22986
- ...state,
22987
- pendingConfirms: [
22988
- ...state.pendingConfirms,
22989
- { id: action.id, toolName: action.toolName, args: action.args }
22990
- ]
22991
- };
22992
- case "permission-resolved":
22993
- return {
22994
- ...state,
22995
- pendingConfirms: state.pendingConfirms.filter((p) => p.id !== action.id)
22996
- };
22997
- case "done":
22998
- return {
22999
- ...state,
23000
- status: "idle",
23001
- pendingConfirms: [],
23002
- items: closeStreamingAssistant2(state.items)
23003
- };
23004
- case "clear":
23005
- return {
23006
- ...state,
23007
- items: [],
23008
- status: "idle",
23009
- errorText: null,
23010
- pendingConfirms: [],
23011
- contextUsage: null
23012
- };
23013
- case "error":
23014
- return {
23015
- ...state,
23016
- status: "error",
23017
- errorText: action.text,
23018
- pendingConfirms: [],
23019
- items: closeStreamingAssistant2(state.items)
23020
- };
23021
- case "load-history": {
23022
- const historyItems = reconstructChatItems2(action.messages);
23023
- return {
23024
- ...state,
23025
- items: historyItems,
23026
- // A cycle opened mid-run keeps the stream indicator on until its `done`.
23027
- status: action.streaming ? "streaming" : "idle",
23028
- errorText: null,
23029
- pendingConfirms: []
23030
- };
23031
- }
23032
- case "context-usage":
23033
- return {
23034
- ...state,
23035
- contextUsage: action.usage
23036
- };
23037
- }
23038
- }
23039
- var initialChatState = {
23040
- items: [],
23041
- status: "idle",
23042
- errorText: null,
23043
- pendingConfirms: [],
23044
- contextUsage: null
23045
- };
23353
+ var import_react24 = __toESM(require_react(), 1);
23046
23354
 
23047
23355
  // src/TaskCycleView.tsx
23048
- var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
23356
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
23049
23357
  function TaskCycleView({ item, postMessage, onBack }) {
23050
- const [chat, dispatch] = (0, import_react22.useReducer)(chatReducer, initialChatState);
23051
23358
  const { sessionId, agentId } = item;
23052
- const postRef = (0, import_react22.useRef)(postMessage);
23053
- postRef.current = postMessage;
23054
- (0, import_react22.useEffect)(() => {
23055
- function handle(event) {
23056
- const msg = event.data;
23057
- if (!msg || typeof msg !== "object" || !("type" in msg) || !("sessionId" in msg)) return;
23058
- if (msg.sessionId !== sessionId) return;
23059
- if (msg.type === "cycleLoaded") {
23060
- dispatch({ kind: "load-history", messages: msg.messages, streaming: msg.running });
23061
- return;
23062
- }
23063
- if (msg.type !== "cycleEvent") return;
23064
- const ev = msg.event;
23065
- switch (ev.type) {
23066
- case "chunk":
23067
- dispatch({ kind: "append-chunk", text: ev.text });
23068
- return;
23069
- case "thinking":
23070
- dispatch({ kind: "append-thinking", text: ev.text });
23071
- return;
23072
- case "tool_call":
23073
- dispatch({ kind: "tool-call", id: ev.id, name: ev.name, args: ev.args });
23074
- return;
23075
- case "tool_result":
23076
- dispatch({ kind: "tool-result", id: ev.id, content: ev.content });
23077
- return;
23078
- case "done":
23079
- dispatch({ kind: "done" });
23080
- postRef.current({ type: "watchCycle", agentId, sessionId });
23081
- return;
23082
- case "error":
23083
- dispatch({ kind: "error", text: ev.message });
23084
- return;
23085
- }
23086
- }
23087
- window.addEventListener("message", handle);
23088
- postRef.current({ type: "watchCycle", agentId, sessionId });
23089
- return () => {
23090
- window.removeEventListener("message", handle);
23091
- postRef.current({ type: "unwatchCycle", sessionId });
23092
- };
23093
- }, [sessionId, agentId]);
23359
+ const chat = useCycleStream(sessionId, {
23360
+ watch: () => postMessage({ type: "watchCycle", agentId, sessionId }),
23361
+ unwatch: () => postMessage({ type: "unwatchCycle", sessionId }),
23362
+ // The recap is persisted before `done`: reload the finished session from disk.
23363
+ onDone: () => postMessage({ type: "watchCycle", agentId, sessionId })
23364
+ });
23094
23365
  const running = chat.status === "streaming";
23095
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
23096
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "10px 14px" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
23097
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to the task thread", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArrowLeft, { size: 13 }) }),
23098
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "app__chat-header-info", children: [
23099
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
23366
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
23367
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "10px 14px" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
23368
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to the task thread", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowLeft, { size: 13 }) }),
23369
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app__chat-header-info", children: [
23370
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
23100
23371
  cycleRoleLabel(item.role),
23101
23372
  " cycle",
23102
23373
  item.label ? ` \xB7 ${item.label}` : ""
23103
23374
  ] }),
23104
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: running ? "running" : cycleOutcomeLabel(item.outcome) })
23375
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: running ? "running" : cycleOutcomeLabel(item.outcome) })
23105
23376
  ] })
23106
23377
  ] }) }),
23107
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MessageList, { items: chat.items, sessionId: null, isStreaming: running, agentName: item.label }),
23108
- chat.errorText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "notice notice--block", children: chat.errorText })
23378
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MessageList, { items: chat.items, sessionId: null, isStreaming: running, agentName: item.label }),
23379
+ chat.errorText && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "notice notice--block", children: chat.errorText })
23109
23380
  ] });
23110
23381
  }
23111
23382
 
23112
23383
  // src/ProjectsTab.tsx
23113
- var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
23384
+ var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
23114
23385
  var LS_ARCHIVED_KEY = "caretaker.taskView.showArchived";
23115
23386
  function persistLastProject(id) {
23116
23387
  void fetch("/api/ui-state", {
@@ -23135,15 +23406,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23135
23406
  }
23136
23407
  var PAGE_SIZE = 20;
23137
23408
  function ProjectsTab({ agents, onOpenSettings, postMessage }) {
23138
- const [projects, setProjects] = (0, import_react23.useState)([]);
23139
- const [selectedProjectId, setSelectedProjectId] = (0, import_react23.useState)(null);
23140
- const [tasks, setTasks] = (0, import_react23.useState)([]);
23141
- const [selectedTaskId, setSelectedTaskId] = (0, import_react23.useState)(null);
23142
- const [taskMessages, setTaskMessages] = (0, import_react23.useState)([]);
23143
- const [view, setView] = (0, import_react23.useState)("list");
23144
- const [page, setPage] = (0, import_react23.useState)(0);
23145
- const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react23.useState)(false);
23146
- const [newTask, setNewTask] = (0, import_react23.useState)({
23409
+ const [projects, setProjects] = (0, import_react24.useState)([]);
23410
+ const [selectedProjectId, setSelectedProjectId] = (0, import_react24.useState)(null);
23411
+ const [tasks, setTasks] = (0, import_react24.useState)([]);
23412
+ const [selectedTaskId, setSelectedTaskId] = (0, import_react24.useState)(null);
23413
+ const [taskMessages, setTaskMessages] = (0, import_react24.useState)([]);
23414
+ const [view, setView] = (0, import_react24.useState)("list");
23415
+ const [page, setPage] = (0, import_react24.useState)(0);
23416
+ const [isNewTaskOpen, setIsNewTaskOpen] = (0, import_react24.useState)(false);
23417
+ const [newTask, setNewTask] = (0, import_react24.useState)({
23147
23418
  title: "",
23148
23419
  objective: "",
23149
23420
  checklistText: "",
@@ -23152,12 +23423,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23152
23423
  plannerAgentId: "",
23153
23424
  reviewerAgentId: ""
23154
23425
  });
23155
- const [isSending, setIsSending] = (0, import_react23.useState)(false);
23156
- const [showArchived, setShowArchived] = (0, import_react23.useState)(loadShowArchived);
23157
- const [pendingConfirm, setPendingConfirm] = (0, import_react23.useState)(null);
23158
- const [taskError, setTaskError] = (0, import_react23.useState)(null);
23159
- const threadIntervalRef = (0, import_react23.useRef)(null);
23160
- (0, import_react23.useEffect)(() => {
23426
+ const [isSending, setIsSending] = (0, import_react24.useState)(false);
23427
+ const [showArchived, setShowArchived] = (0, import_react24.useState)(loadShowArchived);
23428
+ const [pendingConfirm, setPendingConfirm] = (0, import_react24.useState)(null);
23429
+ const [taskError, setTaskError] = (0, import_react24.useState)(null);
23430
+ const threadIntervalRef = (0, import_react24.useRef)(null);
23431
+ (0, import_react24.useEffect)(() => {
23161
23432
  void (async () => {
23162
23433
  try {
23163
23434
  const res = await fetch("/api/ui-state");
@@ -23173,7 +23444,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23173
23444
  stopThreadPolling();
23174
23445
  };
23175
23446
  }, []);
23176
- (0, import_react23.useEffect)(() => {
23447
+ (0, import_react24.useEffect)(() => {
23177
23448
  if (projects.length > 0 && selectedProjectId === null) {
23178
23449
  setSelectedProjectId(projects[0].id);
23179
23450
  }
@@ -23184,10 +23455,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23184
23455
  setSelectedProjectId(null);
23185
23456
  }
23186
23457
  }, [projects]);
23187
- (0, import_react23.useEffect)(() => {
23458
+ (0, import_react24.useEffect)(() => {
23188
23459
  saveShowArchived(showArchived);
23189
23460
  }, [showArchived]);
23190
- (0, import_react23.useEffect)(() => {
23461
+ (0, import_react24.useEffect)(() => {
23191
23462
  if (selectedProjectId !== null) {
23192
23463
  fetchTasks(selectedProjectId);
23193
23464
  setView("list");
@@ -23199,7 +23470,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23199
23470
  setTasks([]);
23200
23471
  }
23201
23472
  }, [selectedProjectId, showArchived]);
23202
- (0, import_react23.useEffect)(() => {
23473
+ (0, import_react24.useEffect)(() => {
23203
23474
  if (selectedTaskId !== null) {
23204
23475
  fetchTaskMessages(selectedTaskId);
23205
23476
  startThreadPolling(selectedTaskId);
@@ -23372,7 +23643,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23372
23643
  const cancelPendingAction = () => {
23373
23644
  setPendingConfirm(null);
23374
23645
  };
23375
- (0, import_react23.useEffect)(() => {
23646
+ (0, import_react24.useEffect)(() => {
23376
23647
  if (!pendingConfirm) return;
23377
23648
  function handleKeyDown(event) {
23378
23649
  if (event.key === "Escape") {
@@ -23382,7 +23653,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23382
23653
  window.addEventListener("keydown", handleKeyDown);
23383
23654
  return () => window.removeEventListener("keydown", handleKeyDown);
23384
23655
  }, [pendingConfirm]);
23385
- (0, import_react23.useEffect)(() => {
23656
+ (0, import_react24.useEffect)(() => {
23386
23657
  if (!taskError) return;
23387
23658
  const t = setTimeout(() => setTaskError(null), 5e3);
23388
23659
  return () => clearTimeout(t);
@@ -23513,7 +23784,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23513
23784
  const selectedProject = projects.find((p) => p.id === selectedProjectId);
23514
23785
  const selectedTask = tasks.find((t) => t.id === selectedTaskId);
23515
23786
  const selectedProjectAgentName = agents.find((a2) => a2.id === selectedProject?.agentId)?.name || "Default Agent";
23516
- const taskAgentLabels = (0, import_react23.useMemo)(() => {
23787
+ const taskAgentLabels = (0, import_react24.useMemo)(() => {
23517
23788
  if (!selectedTask) return void 0;
23518
23789
  const agentLabelFor = (agentId) => {
23519
23790
  const a2 = agents.find((x) => x.id === agentId);
@@ -23559,14 +23830,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23559
23830
  const safePage = Math.min(page, totalPages - 1);
23560
23831
  const pageStart = safePage * PAGE_SIZE;
23561
23832
  const pageTasks = tasks.slice(pageStart, pageStart + PAGE_SIZE);
23562
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
23563
- /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { children: [
23833
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app", style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
23834
+ /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { children: [
23564
23835
  "No projects registered.",
23565
23836
  " ",
23566
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "app__link-btn", onClick: onOpenSettings, children: "Create one in Settings" }),
23837
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "app__link-btn", onClick: onOpenSettings, children: "Create one in Settings" }),
23567
23838
  " ",
23568
23839
  "to get started."
23569
- ] }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23840
+ ] }) }) : selectedProject ? view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23570
23841
  TaskListView,
23571
23842
  {
23572
23843
  projects,
@@ -23591,7 +23862,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23591
23862
  onArchive: handleArchiveFromList,
23592
23863
  statusColor
23593
23864
  }
23594
- ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23865
+ ) : view === "log" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23595
23866
  TaskLogView,
23596
23867
  {
23597
23868
  task: selectedTask,
@@ -23607,7 +23878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23607
23878
  onToggleStatus: handleToggleTaskStatus,
23608
23879
  statusColor
23609
23880
  }
23610
- ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23881
+ ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23611
23882
  TaskEditView,
23612
23883
  {
23613
23884
  task: selectedTask,
@@ -23625,11 +23896,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23625
23896
  onOpenLog: () => setView("log"),
23626
23897
  statusColor
23627
23898
  }
23628
- ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app__empty-state", children: [
23629
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { children: "Task not found. Go back to the list." }),
23630
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
23899
+ ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__empty-state", children: [
23900
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: "Task not found. Go back to the list." }),
23901
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "settings-panel__back-btn", onClick: backToList, style: { marginTop: "12px" }, children: "\u2190 Back to list" })
23631
23902
  ] }) : null }),
23632
- isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23903
+ isNewTaskOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23633
23904
  "div",
23634
23905
  {
23635
23906
  style: {
@@ -23644,7 +23915,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23644
23915
  justifyContent: "center",
23645
23916
  zIndex: 999
23646
23917
  },
23647
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
23918
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23648
23919
  "form",
23649
23920
  {
23650
23921
  onSubmit: handleCreateTask,
@@ -23655,14 +23926,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23655
23926
  background: "var(--vscode-sideBar-background)"
23656
23927
  },
23657
23928
  children: [
23658
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "confirm__header", children: [
23659
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrench, { size: 18 }) }),
23660
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
23929
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "confirm__header", children: [
23930
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "18px", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Wrench, { size: 18 }) }),
23931
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "confirm__prompt", style: { fontSize: "14px" }, children: "Create New Task" })
23661
23932
  ] }),
23662
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
23663
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23933
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
23934
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23664
23935
  "Task Title",
23665
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23936
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23666
23937
  "input",
23667
23938
  {
23668
23939
  type: "text",
@@ -23682,9 +23953,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23682
23953
  }
23683
23954
  )
23684
23955
  ] }),
23685
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23956
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23686
23957
  "Objective (Extended markdown goal description)",
23687
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23958
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23688
23959
  "textarea",
23689
23960
  {
23690
23961
  required: true,
@@ -23705,9 +23976,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23705
23976
  }
23706
23977
  )
23707
23978
  ] }),
23708
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23979
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23709
23980
  "Checklist Items (One item per line)",
23710
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23981
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23711
23982
  "textarea",
23712
23983
  {
23713
23984
  placeholder: "Create route handler\nWrite unit tests\nUpdate documentation",
@@ -23727,9 +23998,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23727
23998
  }
23728
23999
  )
23729
24000
  ] }),
23730
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
24001
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23731
24002
  "Assigned Agent (optional \u2014 overrides project default)",
23732
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24003
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23733
24004
  "select",
23734
24005
  {
23735
24006
  value: newTask.agentId,
@@ -23744,8 +24015,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23744
24015
  outline: "none"
23745
24016
  },
23746
24017
  children: [
23747
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
23748
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24018
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24019
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
23749
24020
  a2.name,
23750
24021
  " (",
23751
24022
  a2.provider,
@@ -23755,9 +24026,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23755
24026
  }
23756
24027
  )
23757
24028
  ] }),
23758
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
24029
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23759
24030
  "Planner Agent Override (optional)",
23760
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24031
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23761
24032
  "select",
23762
24033
  {
23763
24034
  value: newTask.plannerAgentId,
@@ -23772,8 +24043,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23772
24043
  outline: "none"
23773
24044
  },
23774
24045
  children: [
23775
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
23776
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24046
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24047
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
23777
24048
  a2.name,
23778
24049
  " (",
23779
24050
  a2.provider,
@@ -23783,9 +24054,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23783
24054
  }
23784
24055
  )
23785
24056
  ] }),
23786
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
24057
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px" }, children: [
23787
24058
  "Reviewer Agent Override (optional)",
23788
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24059
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23789
24060
  "select",
23790
24061
  {
23791
24062
  value: newTask.reviewerAgentId,
@@ -23800,8 +24071,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23800
24071
  outline: "none"
23801
24072
  },
23802
24073
  children: [
23803
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
23804
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24074
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24075
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
23805
24076
  a2.name,
23806
24077
  " (",
23807
24078
  a2.provider,
@@ -23811,8 +24082,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23811
24082
  }
23812
24083
  )
23813
24084
  ] }),
23814
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
23815
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24085
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "12px", display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", marginTop: "4px" }, children: [
24086
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23816
24087
  "input",
23817
24088
  {
23818
24089
  type: "checkbox",
@@ -23821,24 +24092,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23821
24092
  style: { cursor: "pointer" }
23822
24093
  }
23823
24094
  ),
23824
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
24095
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Start active immediately (Heartbeat loop claims it)" })
23825
24096
  ] })
23826
24097
  ] }),
23827
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
23828
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
23829
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
24098
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "confirm__buttons", style: { justifyContent: "flex-end", marginTop: "10px" }, children: [
24099
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: "confirm__btn", onClick: () => setIsNewTaskOpen(false), children: "Cancel" }),
24100
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "submit", className: "confirm__btn confirm__btn--primary", children: "Create Task" })
23830
24101
  ] })
23831
24102
  ]
23832
24103
  }
23833
24104
  )
23834
24105
  }
23835
24106
  ),
23836
- pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
23837
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
23838
- /* @__PURE__ */ (0, import_jsx_runtime22.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.` }),
23839
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app__confirm-buttons", children: [
23840
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
23841
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24107
+ pendingConfirm && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__confirm-overlay", onClick: cancelPendingAction, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
24108
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__confirm-title", children: pendingConfirm.type === "delete" ? "Delete task" : pendingConfirm.type === "archive" ? "Archive task" : "Discard worktree" }),
24109
+ /* @__PURE__ */ (0, import_jsx_runtime23.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.` }),
24110
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__confirm-buttons", children: [
24111
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "app__confirm-btn", onClick: cancelPendingAction, children: "Cancel" }),
24112
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23842
24113
  "button",
23843
24114
  {
23844
24115
  className: `app__confirm-btn ${pendingConfirm.type === "delete" ? "app__confirm-btn--danger" : ""}`,
@@ -23848,7 +24119,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23848
24119
  )
23849
24120
  ] })
23850
24121
  ] }) }),
23851
- taskError && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
24122
+ taskError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__error-banner", onClick: () => setTaskError(null), title: "Click to dismiss", children: taskError })
23852
24123
  ] });
23853
24124
  }
23854
24125
  function TaskListView({
@@ -23871,10 +24142,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23871
24142
  onArchive,
23872
24143
  statusColor
23873
24144
  }) {
23874
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
23875
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "task-view__header", children: [
23876
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
23877
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24145
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
24146
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "task-view__header", children: [
24147
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
24148
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23878
24149
  "select",
23879
24150
  {
23880
24151
  className: "task-view__project-filter",
@@ -23891,17 +24162,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23891
24162
  outline: "none",
23892
24163
  cursor: "pointer"
23893
24164
  },
23894
- children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: p.id, children: p.name }, p.id))
24165
+ children: projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: p.id, children: p.name }, p.id))
23895
24166
  }
23896
24167
  ),
23897
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
24168
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: [
23898
24169
  "Agent: ",
23899
24170
  agentName
23900
24171
  ] })
23901
24172
  ] }),
23902
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
23903
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "task-view__archived-toggle", children: [
23904
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24173
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
24174
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "task-view__archived-toggle", children: [
24175
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23905
24176
  "input",
23906
24177
  {
23907
24178
  type: "checkbox",
@@ -23912,42 +24183,42 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23912
24183
  ),
23913
24184
  "Show archived"
23914
24185
  ] }),
23915
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
24186
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "app__new-chat-btn", onClick: onNewTask, style: { padding: "4px 10px", fontSize: "11px" }, children: "+ New Task" })
23916
24187
  ] })
23917
24188
  ] }),
23918
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { children: [
24189
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { flex: 1, overflowY: "auto", padding: "0 16px 16px" }, children: allTasksCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { children: [
23919
24190
  "No tasks created for ",
23920
24191
  project.name,
23921
24192
  '. Click "+ New Task" to start.'
23922
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("table", { className: "task-table", children: [
23923
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("tr", { children: [
23924
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
23925
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", children: "Title" }),
23926
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
23927
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
23928
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
23929
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
23930
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
23931
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
24193
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("table", { className: "task-table", children: [
24194
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("tr", { children: [
24195
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "60px" }, children: "#" }),
24196
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", children: "Title" }),
24197
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "90px" }, children: "Status" }),
24198
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "100px" }, children: "Agent" }),
24199
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "120px" }, children: "Checklist" }),
24200
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "180px" }, children: "Branch" }),
24201
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "150px" }, children: "Updated" }),
24202
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { className: "task-table__th", style: { width: "70px" } })
23932
24203
  ] }) }),
23933
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("tbody", { children: tasks.map((task) => {
24204
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: tasks.map((task) => {
23934
24205
  const completedCount = task.checklist.filter((c2) => c2.status === "done").length;
23935
24206
  const totalCount = task.checklist.length;
23936
24207
  const isArchived = !!task.archived;
23937
24208
  const updated = new Date(task.updatedAt);
23938
24209
  const updatedStr = isNaN(updated.getTime()) ? task.updatedAt : updated.toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
23939
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24210
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23940
24211
  "tr",
23941
24212
  {
23942
24213
  className: `task-table__row${isArchived ? " task-table__row--archived" : ""}`,
23943
24214
  onClick: () => onOpenLog(task),
23944
24215
  children: [
23945
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
23946
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "task-table__title", children: [
23947
- isArchived && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Archive, { size: 11 }),
24216
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td task-table__td--mono", children: task.id }),
24217
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "task-table__title", children: [
24218
+ isArchived && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Archive, { size: 11 }),
23948
24219
  task.title
23949
24220
  ] }) }),
23950
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24221
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23951
24222
  "span",
23952
24223
  {
23953
24224
  className: "task-table__badge",
@@ -23955,28 +24226,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23955
24226
  children: task.status
23956
24227
  }
23957
24228
  ) }),
23958
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", style: { fontSize: "11px" }, children: task.agentId ? agents.find((a2) => a2.id === task.agentId)?.name || task.agentId : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
23959
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "task-table__progress", children: [
23960
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24229
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", style: { fontSize: "11px" }, children: task.agentId ? agents.find((a2) => a2.id === task.agentId)?.name || task.agentId : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { opacity: 0.4 }, children: "default" }) }),
24230
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", children: totalCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "task-table__progress", children: [
24231
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "task-table__progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23961
24232
  "span",
23962
24233
  {
23963
24234
  className: "task-table__progress-fill",
23964
24235
  style: { width: `${completedCount / totalCount * 100}%` }
23965
24236
  }
23966
24237
  ) }),
23967
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "task-table__progress-text", children: [
24238
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "task-table__progress-text", children: [
23968
24239
  completedCount,
23969
24240
  "/",
23970
24241
  totalCount
23971
24242
  ] })
23972
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
23973
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "task-table__branch", children: [
23974
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GitBranch, { size: 11 }),
23975
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: task.branch })
23976
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
23977
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
23978
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
23979
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24243
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
24244
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", children: task.branch ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "task-table__branch", children: [
24245
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GitBranch, { size: 11 }),
24246
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { children: task.branch })
24247
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { opacity: 0.4, fontSize: "11px" }, children: "\u2014" }) }),
24248
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td task-table__td--muted", children: updatedStr }),
24249
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "task-table__td", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "inline-flex", gap: "2px" }, children: [
24250
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23980
24251
  "button",
23981
24252
  {
23982
24253
  className: "task-table__edit-btn",
@@ -23986,10 +24257,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23986
24257
  },
23987
24258
  title: task.archived ? "Unarchive task" : "Archive task",
23988
24259
  "aria-label": task.archived ? "Unarchive task" : "Archive task",
23989
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Archive, { size: 13 })
24260
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Archive, { size: 13 })
23990
24261
  }
23991
24262
  ),
23992
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24263
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23993
24264
  "button",
23994
24265
  {
23995
24266
  className: "task-table__edit-btn",
@@ -23999,7 +24270,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23999
24270
  },
24000
24271
  title: "Edit task",
24001
24272
  "aria-label": "Edit task",
24002
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pencil, { size: 13 })
24273
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pencil, { size: 13 })
24003
24274
  }
24004
24275
  )
24005
24276
  ] }) })
@@ -24009,8 +24280,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24009
24280
  );
24010
24281
  }) })
24011
24282
  ] }) }),
24012
- totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "task-table__pagination", children: [
24013
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24283
+ totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "task-table__pagination", children: [
24284
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24014
24285
  "button",
24015
24286
  {
24016
24287
  className: "task-table__page-btn",
@@ -24019,13 +24290,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24019
24290
  children: "\u2039 Prev"
24020
24291
  }
24021
24292
  ),
24022
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "task-table__page-info", children: [
24293
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "task-table__page-info", children: [
24023
24294
  "Page ",
24024
24295
  page + 1,
24025
24296
  " of ",
24026
24297
  totalPages
24027
24298
  ] }),
24028
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24299
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24029
24300
  "button",
24030
24301
  {
24031
24302
  className: "task-table__page-btn",
@@ -24053,31 +24324,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24053
24324
  }) {
24054
24325
  const completedCount = task.checklist.filter((c2) => c2.status === "done").length;
24055
24326
  const totalCount = task.checklist.length;
24056
- const chatItems = (0, import_react23.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
24057
- const [openCycle, setOpenCycle] = (0, import_react23.useState)(null);
24058
- const [draft, setDraft] = (0, import_react23.useState)("");
24059
- const openCycleItem = (0, import_react23.useCallback)((item) => setOpenCycle(item), []);
24060
- const autoOpenedFor = (0, import_react23.useRef)(null);
24061
- (0, import_react23.useEffect)(() => {
24327
+ const chatItems = (0, import_react24.useMemo)(() => taskMessagesToChatItems(taskMessages, agentLabels), [taskMessages, agentLabels]);
24328
+ const [openCycle, setOpenCycle] = (0, import_react24.useState)(null);
24329
+ const [draft, setDraft] = (0, import_react24.useState)("");
24330
+ const openCycleItem = (0, import_react24.useCallback)((item) => setOpenCycle(item), []);
24331
+ const autoOpenedFor = (0, import_react24.useRef)(null);
24332
+ (0, import_react24.useEffect)(() => {
24062
24333
  if (autoOpenedFor.current === task.id || taskMessages.length === 0) return;
24063
24334
  autoOpenedFor.current = task.id;
24064
24335
  const latest = [...chatItems].reverse().find((i) => i.kind === "cycle");
24065
24336
  if (latest && latest.outcome === "running") setOpenCycle(latest);
24066
24337
  }, [task.id, taskMessages.length, chatItems]);
24067
24338
  const liveCycle = openCycle ? chatItems.find((i) => i.kind === "cycle" && i.sessionId === openCycle.sessionId) ?? openCycle : null;
24068
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
24069
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
24070
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
24071
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowLeft, { size: 13 }) }),
24072
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "app__chat-header-info", children: [
24073
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
24339
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%" }, children: [
24340
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("header", { className: "app__chat-header task-view__sub-header", style: { padding: "12px 14px" }, children: [
24341
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
24342
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrowLeft, { size: 13 }) }),
24343
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__chat-header-info", children: [
24344
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h3", { className: "app__chat-header-title", style: { fontSize: "13px", margin: 0 }, children: [
24074
24345
  "Task #",
24075
24346
  task.id,
24076
24347
  ": ",
24077
24348
  task.title
24078
24349
  ] }),
24079
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
24080
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24350
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "app__chat-header-status", style: { fontSize: "10px" }, children: [
24351
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24081
24352
  "span",
24082
24353
  {
24083
24354
  className: `agent-status-dot agent-status-dot--active ${isActiveLike ? "agent-status-dot--pulsing" : ""}`,
@@ -24088,24 +24359,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24088
24359
  ] })
24089
24360
  ] })
24090
24361
  ] }),
24091
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
24092
- task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24362
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
24363
+ task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24093
24364
  "button",
24094
24365
  {
24095
24366
  className: "confirm__btn confirm__btn--primary",
24096
24367
  onClick: () => onToggleStatus(task),
24097
24368
  title: isActiveLike ? "Pause this task (aborts the running agent)" : "Activate this task",
24098
24369
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
24099
- children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
24100
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pause, { size: 12 }),
24370
+ children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
24371
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pause, { size: 12 }),
24101
24372
  " Pause"
24102
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
24103
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Play, { size: 12 }),
24373
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
24374
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Play, { size: 12 }),
24104
24375
  " Activate"
24105
24376
  ] })
24106
24377
  }
24107
24378
  ),
24108
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24379
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24109
24380
  "span",
24110
24381
  {
24111
24382
  className: "task-table__badge",
@@ -24115,8 +24386,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24115
24386
  )
24116
24387
  ] })
24117
24388
  ] }),
24118
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
24119
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24389
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
24390
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24120
24391
  "aside",
24121
24392
  {
24122
24393
  style: {
@@ -24129,19 +24400,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24129
24400
  background: "var(--vscode-sideBar-background, rgba(0,0,0,0.1))"
24130
24401
  },
24131
24402
  children: [
24132
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
24133
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
24134
- totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
24403
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { padding: "10px 12px", borderBottom: "1px solid var(--vscode-panel-border, rgba(255,255,255,0.05))" }, children: [
24404
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: 0, fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
24405
+ totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { fontSize: "10px", opacity: 0.5, marginTop: "2px" }, children: [
24135
24406
  completedCount,
24136
24407
  "/",
24137
24408
  totalCount,
24138
24409
  " done"
24139
24410
  ] })
24140
24411
  ] }),
24141
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
24412
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { padding: "8px 10px", display: "flex", flexDirection: "column", gap: "4px" }, children: totalCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "11px", opacity: 0.4, padding: "8px 4px" }, children: "No checklist items." }) : (task.checklist || []).map((item) => {
24142
24413
  const isDone = item.status === "done";
24143
24414
  const isInProgress = item.status === "in_progress";
24144
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24415
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24145
24416
  "label",
24146
24417
  {
24147
24418
  style: {
@@ -24158,7 +24429,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24158
24429
  },
24159
24430
  title: isInProgress ? "In progress" : isDone ? "Done" : "Pending",
24160
24431
  children: [
24161
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24432
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24162
24433
  "input",
24163
24434
  {
24164
24435
  type: "checkbox",
@@ -24167,7 +24438,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24167
24438
  style: { marginTop: "2px", cursor: "pointer", flexShrink: 0 }
24168
24439
  }
24169
24440
  ),
24170
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
24441
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { wordBreak: "break-word" }, children: item.text })
24171
24442
  ]
24172
24443
  },
24173
24444
  item.id
@@ -24176,8 +24447,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24176
24447
  ]
24177
24448
  }
24178
24449
  ),
24179
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
24180
- liveCycle ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24450
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
24451
+ liveCycle ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24181
24452
  TaskCycleView,
24182
24453
  {
24183
24454
  item: liveCycle,
@@ -24185,8 +24456,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24185
24456
  onBack: () => setOpenCycle(null)
24186
24457
  },
24187
24458
  liveCycle.sessionId
24188
- ) : taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MessageList, { items: chatItems, sessionId: null, compact: true, onOpenCycle: openCycleItem }),
24189
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24459
+ ) : taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MessageList, { items: chatItems, sessionId: null, compact: true, onOpenCycle: openCycleItem }),
24460
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24190
24461
  Composer,
24191
24462
  {
24192
24463
  disabled: isSending,
@@ -24223,12 +24494,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24223
24494
  statusColor
24224
24495
  }) {
24225
24496
  const isRunning = task.status === "active" || task.status === "reviewing" || task.status === "planning";
24226
- const [draftTitle, setDraftTitle] = (0, import_react23.useState)(task.title);
24227
- const [draftObjective, setDraftObjective] = (0, import_react23.useState)(task.objective);
24228
- const [lastTaskId, setLastTaskId] = (0, import_react23.useState)(task.id);
24497
+ const [draftTitle, setDraftTitle] = (0, import_react24.useState)(task.title);
24498
+ const [draftObjective, setDraftObjective] = (0, import_react24.useState)(task.objective);
24499
+ const [lastTaskId, setLastTaskId] = (0, import_react24.useState)(task.id);
24229
24500
  const trimmedTitle = draftTitle.trim();
24230
24501
  const isDirty = trimmedTitle !== task.title.trim() || draftObjective.trim() !== task.objective.trim();
24231
- (0, import_react23.useEffect)(() => {
24502
+ (0, import_react24.useEffect)(() => {
24232
24503
  if (task.id !== lastTaskId) {
24233
24504
  setDraftTitle(task.title);
24234
24505
  setDraftObjective(task.objective);
@@ -24243,16 +24514,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24243
24514
  setDraftTitle(task.title);
24244
24515
  setDraftObjective(task.objective);
24245
24516
  };
24246
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
24247
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
24248
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
24249
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowLeft, { size: 13 }) }),
24250
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
24251
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { style: { opacity: 0.6 }, children: [
24517
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", height: "100%", overflowY: "auto" }, children: [
24518
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "task-view__sub-header", style: { padding: "12px 14px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
24519
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
24520
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "settings-panel__back-btn", onClick: onBack, title: "Back to task list", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrowLeft, { size: 13 }) }),
24521
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 700, display: "flex", alignItems: "center", gap: "6px" }, children: [
24522
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { style: { opacity: 0.6 }, children: [
24252
24523
  "Task #",
24253
24524
  task.id
24254
24525
  ] }),
24255
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24526
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24256
24527
  "input",
24257
24528
  {
24258
24529
  value: draftTitle,
@@ -24273,7 +24544,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24273
24544
  }
24274
24545
  )
24275
24546
  ] }),
24276
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24547
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24277
24548
  "span",
24278
24549
  {
24279
24550
  className: "task-table__badge",
@@ -24282,8 +24553,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24282
24553
  }
24283
24554
  )
24284
24555
  ] }),
24285
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
24286
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24556
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "inline-flex", gap: "6px" }, children: [
24557
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24287
24558
  "button",
24288
24559
  {
24289
24560
  className: "confirm__btn",
@@ -24293,7 +24564,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24293
24564
  children: "View Log"
24294
24565
  }
24295
24566
  ),
24296
- task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24567
+ task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24297
24568
  "button",
24298
24569
  {
24299
24570
  className: "confirm__btn",
@@ -24301,12 +24572,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24301
24572
  title: `Commit pending changes to ${task.branch} and remove the worktree`,
24302
24573
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
24303
24574
  children: [
24304
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GitBranch, { size: 12 }),
24575
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GitBranch, { size: 12 }),
24305
24576
  " Discard worktree"
24306
24577
  ]
24307
24578
  }
24308
24579
  ),
24309
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24580
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24310
24581
  "button",
24311
24582
  {
24312
24583
  className: "confirm__btn",
@@ -24314,28 +24585,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24314
24585
  title: task.archived ? "Unarchive this task" : "Archive this task (hides it from the list, excludes from scheduler)",
24315
24586
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
24316
24587
  children: [
24317
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Archive, { size: 12 }),
24588
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Archive, { size: 12 }),
24318
24589
  " ",
24319
24590
  task.archived ? "Unarchive" : "Archive"
24320
24591
  ]
24321
24592
  }
24322
24593
  ),
24323
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24594
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24324
24595
  "button",
24325
24596
  {
24326
24597
  className: "confirm__btn confirm__btn--primary",
24327
24598
  onClick: () => onToggleStatus(task),
24328
24599
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
24329
- children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
24330
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pause, { size: 12 }),
24600
+ children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
24601
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pause, { size: 12 }),
24331
24602
  " Pause"
24332
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
24333
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Play, { size: 12 }),
24603
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
24604
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Play, { size: 12 }),
24334
24605
  " Activate"
24335
24606
  ] })
24336
24607
  }
24337
24608
  ),
24338
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24609
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24339
24610
  "button",
24340
24611
  {
24341
24612
  className: "confirm__btn",
@@ -24343,22 +24614,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24343
24614
  title: "Permanently delete this task and all its messages",
24344
24615
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px", color: "#ef4444" },
24345
24616
  children: [
24346
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Trash, { size: 12 }),
24617
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 12 }),
24347
24618
  " Delete"
24348
24619
  ]
24349
24620
  }
24350
24621
  )
24351
24622
  ] })
24352
24623
  ] }),
24353
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
24354
- task.branch && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
24355
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GitBranch, { size: 12 }),
24356
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
24357
- !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
24624
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { padding: "16px", maxWidth: "720px" }, children: [
24625
+ task.branch && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px", display: "flex", alignItems: "center", gap: "6px", fontSize: "11px", opacity: 0.75 }, children: [
24626
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GitBranch, { size: 12 }),
24627
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { style: { fontFamily: "monospace" }, children: task.branch }),
24628
+ !task.worktreePath && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { opacity: 0.6 }, children: "(worktree removed)" })
24358
24629
  ] }),
24359
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24360
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
24361
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24630
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24631
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Objective" }),
24632
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24362
24633
  "textarea",
24363
24634
  {
24364
24635
  value: draftObjective,
@@ -24382,8 +24653,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24382
24653
  }
24383
24654
  }
24384
24655
  ),
24385
- isDirty && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
24386
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24656
+ isDirty && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center", marginTop: "8px" }, children: [
24657
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24387
24658
  "button",
24388
24659
  {
24389
24660
  className: "confirm__btn confirm__btn--primary",
@@ -24396,13 +24667,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24396
24667
  children: "Save"
24397
24668
  }
24398
24669
  ),
24399
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
24400
- isRunning && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
24670
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "confirm__btn", onClick: resetDraft, style: { padding: "3px 10px", fontSize: "10px" }, children: "Cancel" }),
24671
+ isRunning && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "10px", opacity: 0.6 }, children: "Applies from the next cycle." })
24401
24672
  ] })
24402
24673
  ] }),
24403
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24404
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
24405
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24674
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24675
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Assigned Agent" }),
24676
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24406
24677
  "select",
24407
24678
  {
24408
24679
  value: task.agentId || "",
@@ -24422,8 +24693,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24422
24693
  },
24423
24694
  title: isRunning ? "Pause the task before changing its agent" : "Choose which agent runs this task",
24424
24695
  children: [
24425
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
24426
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24696
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24697
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
24427
24698
  a2.name,
24428
24699
  " (",
24429
24700
  a2.provider,
@@ -24433,9 +24704,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24433
24704
  }
24434
24705
  )
24435
24706
  ] }),
24436
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24437
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
24438
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24707
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24708
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Planner Agent" }),
24709
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24439
24710
  "select",
24440
24711
  {
24441
24712
  value: task.plannerAgentId || "",
@@ -24444,8 +24715,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24444
24715
  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 },
24445
24716
  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.",
24446
24717
  children: [
24447
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
24448
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24718
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24719
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
24449
24720
  a2.name,
24450
24721
  " (",
24451
24722
  a2.provider,
@@ -24455,9 +24726,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24455
24726
  }
24456
24727
  )
24457
24728
  ] }),
24458
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24459
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
24460
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24729
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24730
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Reviewer Agent" }),
24731
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24461
24732
  "select",
24462
24733
  {
24463
24734
  value: task.reviewerAgentId || "",
@@ -24466,8 +24737,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24466
24737
  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 },
24467
24738
  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.",
24468
24739
  children: [
24469
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Project default" }),
24470
- agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: a2.id, children: [
24740
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Project default" }),
24741
+ agents.map((a2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: a2.id, children: [
24471
24742
  a2.name,
24472
24743
  " (",
24473
24744
  a2.provider,
@@ -24477,31 +24748,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24477
24748
  }
24478
24749
  )
24479
24750
  ] }),
24480
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24481
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
24482
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
24751
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { marginBottom: "16px" }, children: [
24752
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 6px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Phases" }),
24753
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", gap: "12px" }, children: [
24483
24754
  { flag: "planningEnabled", label: "Planning phase", value: task.planningEnabled },
24484
24755
  { flag: "reviewEnabled", label: "Review at DONE", value: task.reviewEnabled },
24485
24756
  { flag: "sddEnabled", label: "SDD mode (.md specs)", value: task.sddEnabled }
24486
- ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
24757
+ ].map(({ flag, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", flex: 1 }, children: [
24487
24758
  label,
24488
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24759
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24489
24760
  "select",
24490
24761
  {
24491
24762
  value: value === true ? "on" : value === false ? "off" : "inherit",
24492
24763
  onChange: (e) => onSetFlag(task, flag, e.target.value === "inherit" ? null : e.target.value === "on"),
24493
24764
  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" },
24494
24765
  children: [
24495
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "inherit", children: "Project default" }),
24496
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "on", children: "On" }),
24497
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "off", children: "Off" })
24766
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "inherit", children: "Project default" }),
24767
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "on", children: "On" }),
24768
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "off", children: "Off" })
24498
24769
  ]
24499
24770
  }
24500
24771
  )
24501
24772
  ] }, flag)) }),
24502
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
24773
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
24503
24774
  "Max run seconds per cycle",
24504
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24775
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24505
24776
  "input",
24506
24777
  {
24507
24778
  type: "number",
@@ -24524,7 +24795,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24524
24795
  )
24525
24796
  ] })
24526
24797
  ] }),
24527
- task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24798
+ task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24528
24799
  "div",
24529
24800
  {
24530
24801
  style: {
@@ -24537,19 +24808,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24537
24808
  fontSize: "12px"
24538
24809
  },
24539
24810
  children: [
24540
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("strong", { children: [
24541
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TriangleAlert, { size: 13 }),
24811
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("strong", { children: [
24812
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TriangleAlert, { size: 13 }),
24542
24813
  " Blocked Reason:"
24543
24814
  ] }),
24544
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
24815
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { margin: "4px 0 0 0" }, children: task.blockedReason })
24545
24816
  ]
24546
24817
  }
24547
24818
  ),
24548
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
24549
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
24550
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
24819
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
24820
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h4", { style: { margin: "0 0 8px 0", fontSize: "10px", textTransform: "uppercase", letterSpacing: "0.08em", opacity: 0.6 }, children: "Checklist" }),
24821
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (task.checklist || []).map((item) => {
24551
24822
  const isDone = item.status === "done";
24552
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
24823
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
24553
24824
  "label",
24554
24825
  {
24555
24826
  style: {
@@ -24566,7 +24837,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24566
24837
  opacity: isDone ? 0.6 : 1
24567
24838
  },
24568
24839
  children: [
24569
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
24840
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
24570
24841
  "input",
24571
24842
  {
24572
24843
  type: "checkbox",
@@ -24575,7 +24846,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24575
24846
  style: { marginTop: "2px", cursor: "pointer" }
24576
24847
  }
24577
24848
  ),
24578
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: item.text })
24849
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: item.text })
24579
24850
  ]
24580
24851
  },
24581
24852
  item.id
@@ -24587,7 +24858,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24587
24858
  }
24588
24859
 
24589
24860
  // src/useVoice.ts
24590
- var import_react24 = __toESM(require_react(), 1);
24861
+ var import_react25 = __toESM(require_react(), 1);
24591
24862
 
24592
24863
  // src/pcm_wav.ts
24593
24864
  function encodeWavPcm16(samples, rate) {
@@ -24656,41 +24927,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24656
24927
  const { voice, chatStatus, pendingConfirmCount, items, onTranscript } = opts;
24657
24928
  const available = !!voice && voice.enabled && voice.configured && canCapture();
24658
24929
  const canSpeak = !!voice?.canSpeak;
24659
- const [phase, setPhase] = (0, import_react24.useState)("idle");
24660
- const [mode, setMode] = (0, import_react24.useState)("dictate");
24661
- const [error, setError] = (0, import_react24.useState)(null);
24662
- const voiceRef = (0, import_react24.useRef)(voice);
24930
+ const [phase, setPhase] = (0, import_react25.useState)("idle");
24931
+ const [mode, setMode] = (0, import_react25.useState)("dictate");
24932
+ const [error, setError] = (0, import_react25.useState)(null);
24933
+ const voiceRef = (0, import_react25.useRef)(voice);
24663
24934
  voiceRef.current = voice;
24664
- const bufferMsRef = (0, import_react24.useRef)(voice?.playbackBufferMs);
24935
+ const bufferMsRef = (0, import_react25.useRef)(voice?.playbackBufferMs);
24665
24936
  bufferMsRef.current = voice?.playbackBufferMs;
24666
- const phaseRef = (0, import_react24.useRef)(phase);
24937
+ const phaseRef = (0, import_react25.useRef)(phase);
24667
24938
  phaseRef.current = phase;
24668
- const modeRef = (0, import_react24.useRef)(mode);
24939
+ const modeRef = (0, import_react25.useRef)(mode);
24669
24940
  modeRef.current = mode;
24670
- const onTranscriptRef = (0, import_react24.useRef)(onTranscript);
24941
+ const onTranscriptRef = (0, import_react25.useRef)(onTranscript);
24671
24942
  onTranscriptRef.current = onTranscript;
24672
- const itemsRef = (0, import_react24.useRef)(items);
24943
+ const itemsRef = (0, import_react25.useRef)(items);
24673
24944
  itemsRef.current = items;
24674
- const chatStatusRef = (0, import_react24.useRef)(chatStatus);
24945
+ const chatStatusRef = (0, import_react25.useRef)(chatStatus);
24675
24946
  chatStatusRef.current = chatStatus;
24676
- const streamRef = (0, import_react24.useRef)(null);
24677
- const recorderRef = (0, import_react24.useRef)(null);
24678
- const chunksRef = (0, import_react24.useRef)([]);
24679
- const vadRef = (0, import_react24.useRef)(null);
24680
- const speechAbortRef = (0, import_react24.useRef)(null);
24681
- const idleTimerRef = (0, import_react24.useRef)(null);
24682
- const heardSpeechRef = (0, import_react24.useRef)(false);
24683
- const sawStreamingRef = (0, import_react24.useRef)(false);
24684
- const cursorRef = (0, import_react24.useRef)(0);
24685
- const queueRef = (0, import_react24.useRef)([]);
24686
- const apply = (0, import_react24.useCallback)((event) => {
24947
+ const streamRef = (0, import_react25.useRef)(null);
24948
+ const recorderRef = (0, import_react25.useRef)(null);
24949
+ const chunksRef = (0, import_react25.useRef)([]);
24950
+ const vadRef = (0, import_react25.useRef)(null);
24951
+ const speechAbortRef = (0, import_react25.useRef)(null);
24952
+ const idleTimerRef = (0, import_react25.useRef)(null);
24953
+ const heardSpeechRef = (0, import_react25.useRef)(false);
24954
+ const sawStreamingRef = (0, import_react25.useRef)(false);
24955
+ const cursorRef = (0, import_react25.useRef)(0);
24956
+ const queueRef = (0, import_react25.useRef)([]);
24957
+ const apply = (0, import_react25.useCallback)((event) => {
24687
24958
  setPhase((current) => nextPhase(current, event));
24688
24959
  }, []);
24689
24960
  const clearIdleTimer = () => {
24690
24961
  if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
24691
24962
  idleTimerRef.current = null;
24692
24963
  };
24693
- const teardownCapture = (0, import_react24.useCallback)(() => {
24964
+ const teardownCapture = (0, import_react25.useCallback)(() => {
24694
24965
  clearIdleTimer();
24695
24966
  try {
24696
24967
  vadRef.current?.destroy();
@@ -24707,11 +24978,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24707
24978
  chunksRef.current = [];
24708
24979
  heardSpeechRef.current = false;
24709
24980
  }, []);
24710
- const stopPlayback = (0, import_react24.useCallback)(() => {
24981
+ const stopPlayback = (0, import_react25.useCallback)(() => {
24711
24982
  speechAbortRef.current?.abort();
24712
24983
  speechAbortRef.current = null;
24713
24984
  }, []);
24714
- const fail = (0, import_react24.useCallback)(
24985
+ const fail = (0, import_react25.useCallback)(
24715
24986
  (message) => {
24716
24987
  teardownCapture();
24717
24988
  stopPlayback();
@@ -24720,7 +24991,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24720
24991
  },
24721
24992
  [apply, teardownCapture, stopPlayback]
24722
24993
  );
24723
- const finishRecording = (0, import_react24.useCallback)(() => {
24994
+ const finishRecording = (0, import_react25.useCallback)(() => {
24724
24995
  const recorder = recorderRef.current;
24725
24996
  if (!recorder || recorder.state === "inactive") return;
24726
24997
  recorder.onstop = async () => {
@@ -24750,7 +25021,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24750
25021
  };
24751
25022
  recorder.stop();
24752
25023
  }, [apply, fail, teardownCapture]);
24753
- const startRecording = (0, import_react24.useCallback)(async () => {
25024
+ const startRecording = (0, import_react25.useCallback)(async () => {
24754
25025
  setError(null);
24755
25026
  chunksRef.current = [];
24756
25027
  heardSpeechRef.current = false;
@@ -24795,7 +25066,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24795
25066
  fail(`Microphone unavailable: ${err}`);
24796
25067
  }
24797
25068
  }, [apply, fail, finishRecording, teardownCapture]);
24798
- const speakReply = (0, import_react24.useCallback)(async () => {
25069
+ const speakReply = (0, import_react25.useCallback)(async () => {
24799
25070
  const text = queueRef.current.shift();
24800
25071
  if (!text) {
24801
25072
  apply({
@@ -24834,10 +25105,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24834
25105
  fail(`Synthesis failed: ${err}`);
24835
25106
  }
24836
25107
  }, [apply, fail]);
24837
- (0, import_react24.useEffect)(() => {
25108
+ (0, import_react25.useEffect)(() => {
24838
25109
  if (chatStatus === "streaming") sawStreamingRef.current = true;
24839
25110
  }, [chatStatus]);
24840
- (0, import_react24.useEffect)(() => {
25111
+ (0, import_react25.useEffect)(() => {
24841
25112
  if (modeRef.current !== "conversation") return;
24842
25113
  if (phaseRef.current === "idle") return;
24843
25114
  const { texts, cursor } = takeFinalizedBubbles(items, cursorRef.current);
@@ -24846,7 +25117,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24846
25117
  queueRef.current.push(...texts);
24847
25118
  apply({ kind: "speechQueued", mode: "conversation", canSpeak });
24848
25119
  }, [items, canSpeak, apply]);
24849
- (0, import_react24.useEffect)(() => {
25120
+ (0, import_react25.useEffect)(() => {
24850
25121
  if (phase !== "awaiting") return;
24851
25122
  if (chatStatus === "error") {
24852
25123
  apply({ kind: "failed", mode: "conversation" });
@@ -24868,8 +25139,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24868
25139
  pendingSpeech: queueRef.current.length
24869
25140
  });
24870
25141
  }, [phase, chatStatus, pendingConfirmCount, canSpeak, apply]);
24871
- const prevPhase = (0, import_react24.useRef)("idle");
24872
- (0, import_react24.useEffect)(() => {
25142
+ const prevPhase = (0, import_react25.useRef)("idle");
25143
+ (0, import_react25.useEffect)(() => {
24873
25144
  const from = prevPhase.current;
24874
25145
  prevPhase.current = phase;
24875
25146
  if (from === phase) return;
@@ -24881,14 +25152,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24881
25152
  queueRef.current = [];
24882
25153
  }
24883
25154
  }, [phase, startRecording, speakReply, teardownCapture, stopPlayback]);
24884
- (0, import_react24.useEffect)(
25155
+ (0, import_react25.useEffect)(
24885
25156
  () => () => {
24886
25157
  teardownCapture();
24887
25158
  stopPlayback();
24888
25159
  },
24889
25160
  [teardownCapture, stopPlayback]
24890
25161
  );
24891
- const toggle = (0, import_react24.useCallback)(() => {
25162
+ const toggle = (0, import_react25.useCallback)(() => {
24892
25163
  if (!available) return;
24893
25164
  const current = phaseRef.current;
24894
25165
  if (current === "idle") {
@@ -24902,7 +25173,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24902
25173
  }
24903
25174
  apply({ kind: "userStop", mode: modeRef.current });
24904
25175
  }, [available, apply, finishRecording]);
24905
- const changeMode = (0, import_react24.useCallback)(
25176
+ const changeMode = (0, import_react25.useCallback)(
24906
25177
  (next) => {
24907
25178
  apply({ kind: "userStop", mode: modeRef.current });
24908
25179
  setMode(next);
@@ -24913,7 +25184,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24913
25184
  }
24914
25185
 
24915
25186
  // src/App.tsx
24916
- var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
25187
+ var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
24917
25188
  function takeInjectedActivation() {
24918
25189
  const w2 = window;
24919
25190
  const id = typeof w2.__caretakerAssistant === "string" ? w2.__caretakerAssistant : null;
@@ -24921,36 +25192,36 @@ Please report this to https://github.com/markedjs/marked.`, e) {
24921
25192
  return id;
24922
25193
  }
24923
25194
  function App({ postMessage, layout = "compact" }) {
24924
- const [chatState, dispatch] = (0, import_react25.useReducer)(chatReducer, initialChatState);
24925
- const [agents, setAgents] = (0, import_react25.useState)([]);
24926
- const [sessions, setSessions] = (0, import_react25.useState)([]);
24927
- const [selectedAgentId, setSelectedAgentId] = (0, import_react25.useState)(null);
24928
- const [selectedSessionId, setSelectedSessionId] = (0, import_react25.useState)(null);
24929
- const [showSessions, setShowSessions] = (0, import_react25.useState)(false);
24930
- const [showAllAgents, setShowAllAgents] = (0, import_react25.useState)(false);
24931
- const [pendingDelete, setPendingDelete] = (0, import_react25.useState)(null);
24932
- const [activeScreen, setActiveScreen] = (0, import_react25.useState)("chat");
24933
- const [settingsTab, setSettingsTab] = (0, import_react25.useState)();
24934
- const [settingsData, setSettingsData] = (0, import_react25.useState)(null);
24935
- const [modelsResult, setModelsResult] = (0, import_react25.useState)(null);
24936
- const [acpRegistry, setAcpRegistry] = (0, import_react25.useState)(null);
24937
- const [acpInstall, setAcpInstall] = (0, import_react25.useState)(null);
24938
- const [refreshingSourceId, setRefreshingSourceId] = (0, import_react25.useState)(null);
24939
- const [refreshOutcome, setRefreshOutcome] = (0, import_react25.useState)(null);
24940
- const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react25.useState)(null);
24941
- const [taskRuns, setTaskRuns] = (0, import_react25.useState)({});
24942
- const [voiceConfig, setVoiceConfig] = (0, import_react25.useState)(null);
24943
- const [sttCatalogResult, setSttCatalogResult] = (0, import_react25.useState)(null);
24944
- const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react25.useState)(null);
24945
- const [composerDraft, setComposerDraft] = (0, import_react25.useState)("");
24946
- const [activation, setActivation] = (0, import_react25.useState)(null);
24947
- const [confirmedAgentId, setConfirmedAgentId] = (0, import_react25.useState)(null);
24948
- const [pendingAssistantId, setPendingAssistantId] = (0, import_react25.useState)(() => takeInjectedActivation());
24949
- const [composerFocusToken, setComposerFocusToken] = (0, import_react25.useState)(0);
24950
- (0, import_react25.useEffect)(() => {
25195
+ const [chatState, dispatch] = (0, import_react26.useReducer)(chatReducer, initialChatState);
25196
+ const [agents, setAgents] = (0, import_react26.useState)([]);
25197
+ const [sessions, setSessions] = (0, import_react26.useState)([]);
25198
+ const [selectedAgentId, setSelectedAgentId] = (0, import_react26.useState)(null);
25199
+ const [selectedSessionId, setSelectedSessionId] = (0, import_react26.useState)(null);
25200
+ const [showSessions, setShowSessions] = (0, import_react26.useState)(false);
25201
+ const [showAllAgents, setShowAllAgents] = (0, import_react26.useState)(false);
25202
+ const [pendingDelete, setPendingDelete] = (0, import_react26.useState)(null);
25203
+ const [activeScreen, setActiveScreen] = (0, import_react26.useState)("chat");
25204
+ const [settingsTab, setSettingsTab] = (0, import_react26.useState)();
25205
+ const [settingsData, setSettingsData] = (0, import_react26.useState)(null);
25206
+ const [modelsResult, setModelsResult] = (0, import_react26.useState)(null);
25207
+ const [acpRegistry, setAcpRegistry] = (0, import_react26.useState)(null);
25208
+ const [acpInstall, setAcpInstall] = (0, import_react26.useState)(null);
25209
+ const [refreshingSourceId, setRefreshingSourceId] = (0, import_react26.useState)(null);
25210
+ const [refreshOutcome, setRefreshOutcome] = (0, import_react26.useState)(null);
25211
+ const [mcpAuthOutcome, setMcpAuthOutcome] = (0, import_react26.useState)(null);
25212
+ const [taskRuns, setTaskRuns] = (0, import_react26.useState)({});
25213
+ const [voiceConfig, setVoiceConfig] = (0, import_react26.useState)(null);
25214
+ const [sttCatalogResult, setSttCatalogResult] = (0, import_react26.useState)(null);
25215
+ const [ttsCatalogResult, setTtsCatalogResult] = (0, import_react26.useState)(null);
25216
+ const [composerDraft, setComposerDraft] = (0, import_react26.useState)("");
25217
+ const [activation, setActivation] = (0, import_react26.useState)(null);
25218
+ const [confirmedAgentId, setConfirmedAgentId] = (0, import_react26.useState)(null);
25219
+ const [pendingAssistantId, setPendingAssistantId] = (0, import_react26.useState)(() => takeInjectedActivation());
25220
+ const [composerFocusToken, setComposerFocusToken] = (0, import_react26.useState)(0);
25221
+ (0, import_react26.useEffect)(() => {
24951
25222
  postMessage({ type: "webviewReady" });
24952
25223
  }, []);
24953
- (0, import_react25.useEffect)(() => {
25224
+ (0, import_react26.useEffect)(() => {
24954
25225
  function handle(event) {
24955
25226
  const msg = event.data;
24956
25227
  if (!msg || typeof msg !== "object" || !("type" in msg)) return;
@@ -25082,15 +25353,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25082
25353
  if (voice2) msg.voice = true;
25083
25354
  postMessage(msg);
25084
25355
  };
25085
- const onConfirm = (0, import_react25.useCallback)((id, decision) => {
25356
+ const onConfirm = (0, import_react26.useCallback)((id, decision) => {
25086
25357
  dispatch({ kind: "permission-resolved", id });
25087
25358
  postMessage({ type: "permission_response", id, decision });
25088
25359
  }, [postMessage]);
25089
25360
  const onAbort = () => {
25090
25361
  postMessage({ type: "abort" });
25091
25362
  };
25092
- const confirmCards = (0, import_react25.useMemo)(
25093
- () => chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id)),
25363
+ const confirmCards = (0, import_react26.useMemo)(
25364
+ () => chatState.pendingConfirms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConfirmCard, { pending: p, onDecide: onConfirm }, p.id)),
25094
25365
  [chatState.pendingConfirms, onConfirm]
25095
25366
  );
25096
25367
  const onSelectAgent = (agentId) => {
@@ -25130,7 +25401,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25130
25401
  const cancelDeleteSession = () => {
25131
25402
  setPendingDelete(null);
25132
25403
  };
25133
- (0, import_react25.useEffect)(() => {
25404
+ (0, import_react26.useEffect)(() => {
25134
25405
  if (!pendingDelete) return;
25135
25406
  function handleKeyDown(event) {
25136
25407
  if (event.key === "Escape") {
@@ -25145,7 +25416,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25145
25416
  setShowSessions(!showSessions);
25146
25417
  }
25147
25418
  };
25148
- (0, import_react25.useEffect)(() => {
25419
+ (0, import_react26.useEffect)(() => {
25149
25420
  function handleClickOutside(event) {
25150
25421
  const target = event.target;
25151
25422
  if (showSessions && !target.closest(".app__sessions-dropdown")) {
@@ -25155,7 +25426,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25155
25426
  document.addEventListener("mousedown", handleClickOutside);
25156
25427
  return () => document.removeEventListener("mousedown", handleClickOutside);
25157
25428
  }, [showSessions]);
25158
- (0, import_react25.useEffect)(() => {
25429
+ (0, import_react26.useEffect)(() => {
25159
25430
  if (!pendingAssistantId) return;
25160
25431
  const r = resolvePending(pendingAssistantId, confirmedAgentId, agents.map((a2) => a2.id), activation);
25161
25432
  setPendingAssistantId(r.pending);
@@ -25164,7 +25435,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25164
25435
  if (r.activation?.step === "awaiting-agent") onSelectAgent(r.activation.agentId);
25165
25436
  setActivation(r.activation);
25166
25437
  }, [pendingAssistantId, agents]);
25167
- (0, import_react25.useEffect)(() => {
25438
+ (0, import_react26.useEffect)(() => {
25168
25439
  if (activation?.step !== "open") return;
25169
25440
  const adopt = localSelectionFor(activation, selectedAgentId);
25170
25441
  if (adopt) {
@@ -25180,7 +25451,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25180
25451
  setActivation(null);
25181
25452
  }
25182
25453
  }, [activation]);
25183
- (0, import_react25.useEffect)(() => {
25454
+ (0, import_react26.useEffect)(() => {
25184
25455
  if (activation?.step !== "mic") return;
25185
25456
  if (voice.mode !== "conversation" || voice.phase !== "idle") return;
25186
25457
  voice.toggle();
@@ -25199,30 +25470,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25199
25470
  { id: "projects", label: "Projects", Icon: FolderKanban },
25200
25471
  { id: "settings", label: "Settings", Icon: Settings }
25201
25472
  ];
25202
- const navRail = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("nav", { className: "app__nav", children: [
25203
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo app__nav-logo" }),
25204
- navItems.map(({ id, label, Icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25473
+ const navRail = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { className: "app__nav", children: [
25474
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo app__nav-logo" }),
25475
+ navItems.map(({ id, label, Icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25205
25476
  "button",
25206
25477
  {
25207
25478
  className: `app__nav-btn ${activeScreen === id ? "app__nav-btn--active" : ""}`,
25208
25479
  onClick: () => openScreen(id),
25209
25480
  title: label,
25210
25481
  children: [
25211
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon2, { size: 18 }),
25212
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: label })
25482
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon2, { size: 18 }),
25483
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: label })
25213
25484
  ]
25214
25485
  },
25215
25486
  id
25216
25487
  ))
25217
25488
  ] });
25218
25489
  if (activeScreen === "projects" && layout === "sidebar") {
25219
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app app--with-sidebar", children: [
25490
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app app--with-sidebar", children: [
25220
25491
  navRail,
25221
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__screen", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ProjectsTab, { agents, onOpenSettings: () => openScreen("settings", "projects"), postMessage }) })
25492
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__screen", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProjectsTab, { agents, onOpenSettings: () => openScreen("settings", "projects"), postMessage }) })
25222
25493
  ] });
25223
25494
  }
25224
25495
  if (activeScreen === "settings") {
25225
- const panel = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered app__screen" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25496
+ const panel = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `app ${layout === "sidebar" ? "app--settings-centered app__screen" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25226
25497
  SettingsPanel,
25227
25498
  {
25228
25499
  layout,
@@ -25245,44 +25516,44 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25245
25516
  onClose: () => setActiveScreen("chat")
25246
25517
  }
25247
25518
  ) });
25248
- return layout === "sidebar" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app app--with-sidebar", children: [
25519
+ return layout === "sidebar" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app app--with-sidebar", children: [
25249
25520
  navRail,
25250
25521
  panel
25251
25522
  ] }) : panel;
25252
25523
  }
25253
- const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
25254
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
25255
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "app__confirm-message", children: [
25524
+ const deleteOverlay = pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__confirm-overlay", onClick: cancelDeleteSession, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__confirm-dialog", onClick: (e) => e.stopPropagation(), children: [
25525
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__confirm-title", children: "Delete conversation" }),
25526
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { className: "app__confirm-message", children: [
25256
25527
  "Delete conversation \u201C",
25257
25528
  pendingDelete.title,
25258
25529
  "\u201D? This cannot be undone."
25259
25530
  ] }),
25260
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__confirm-buttons", children: [
25261
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
25262
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
25531
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__confirm-buttons", children: [
25532
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { className: "app__confirm-btn", onClick: cancelDeleteSession, children: "Cancel" }),
25533
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { className: "app__confirm-btn app__confirm-btn--danger", onClick: confirmDeleteSession, children: "Delete" })
25263
25534
  ] })
25264
25535
  ] }) });
25265
25536
  if (layout === "sidebar") {
25266
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app app--with-sidebar", children: [
25537
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app app--with-sidebar", children: [
25267
25538
  navRail,
25268
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("aside", { className: "app__sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sidebar-content", children: [
25269
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sidebar-section", children: [
25270
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
25271
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25539
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("aside", { className: "app__sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sidebar-content", children: [
25540
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sidebar-section", children: [
25541
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sidebar-section-title", children: "Agents" }),
25542
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sidebar-agents-list", children: selectedAgentId && !showAllAgents ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25272
25543
  "button",
25273
25544
  {
25274
25545
  className: "app__sidebar-agent-item app__sidebar-agent-item--collapsed-active",
25275
25546
  onClick: () => setShowAllAgents(true),
25276
25547
  title: "Switch Agent",
25277
25548
  children: [
25278
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
25279
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
25280
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
25549
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "agent-status-dot agent-status-dot--active" }),
25550
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__sidebar-agent-name", children: activeAgent?.name || selectedAgentId }),
25551
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronDown, { className: "app__sidebar-chevron", size: 10 })
25281
25552
  ]
25282
25553
  }
25283
- ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
25554
+ ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `app__sidebar-agents-list-expanded ${selectedAgentId ? "app__sidebar-agents-list-expanded--has-active" : ""}`, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sidebar-empty-text", children: "No agents found" }) : agents.map((agent) => {
25284
25555
  const isSelected = selectedAgentId === agent.id;
25285
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25556
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25286
25557
  "button",
25287
25558
  {
25288
25559
  className: `app__sidebar-agent-item ${isSelected ? "app__sidebar-agent-item--active" : ""}`,
@@ -25295,19 +25566,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25295
25566
  }
25296
25567
  },
25297
25568
  children: [
25298
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
25299
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
25300
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
25569
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: `agent-status-dot ${isSelected ? "agent-status-dot--active" : ""}` }),
25570
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__sidebar-agent-name", children: agent.name }),
25571
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronUp, { className: "app__sidebar-chevron app__sidebar-chevron--up", size: 10 })
25301
25572
  ]
25302
25573
  },
25303
25574
  agent.id
25304
25575
  );
25305
25576
  }) }) })
25306
25577
  ] }),
25307
- selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sidebar-section", children: [
25308
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sidebar-section-header", children: [
25309
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
25310
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25578
+ selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sidebar-section", children: [
25579
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sidebar-section-header", children: [
25580
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__sidebar-section-title", children: "Conversations" }),
25581
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25311
25582
  "button",
25312
25583
  {
25313
25584
  className: "app__sidebar-new-chat-btn",
@@ -25317,15 +25588,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25317
25588
  }
25318
25589
  )
25319
25590
  ] }),
25320
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25591
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sidebar-sessions-list", children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sidebar-empty-text", children: "No conversations yet" }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25321
25592
  "div",
25322
25593
  {
25323
25594
  className: `app__sidebar-session-item ${selectedSessionId === session.id ? "app__sidebar-session-item--active" : ""}`,
25324
25595
  onClick: () => onSelectSession(session.id),
25325
25596
  children: [
25326
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MessageSquare, { size: 13 }) }),
25327
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
25328
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25597
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__sidebar-session-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessageSquare, { size: 13 }) }),
25598
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__sidebar-session-title", title: session.title, children: session.title }),
25599
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25329
25600
  "button",
25330
25601
  {
25331
25602
  className: "app__sidebar-session-delete",
@@ -25334,7 +25605,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25334
25605
  e.stopPropagation();
25335
25606
  onDeleteSession(session.id, session.title);
25336
25607
  },
25337
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 12 })
25608
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Trash, { size: 12 })
25338
25609
  }
25339
25610
  )
25340
25611
  ]
@@ -25343,15 +25614,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25343
25614
  )) })
25344
25615
  ] })
25345
25616
  ] }) }),
25346
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
25347
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__chat-header-info", children: [
25348
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
25349
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "app__chat-header-status", children: [
25350
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
25617
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("main", { className: "app__chat-pane", children: selectedAgentId ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
25618
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("header", { className: "app__chat-header", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__chat-header-info", children: [
25619
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "app__chat-header-title", children: selectedAgentName }),
25620
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "app__chat-header-status", children: [
25621
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: `agent-status-dot agent-status-dot--active ${chatState.status === "streaming" ? "agent-status-dot--pulsing" : ""}` }),
25351
25622
  chatState.status === "streaming" ? "Streaming response..." : "Ready"
25352
25623
  ] })
25353
25624
  ] }) }),
25354
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25625
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25355
25626
  MessageList,
25356
25627
  {
25357
25628
  items: chatState.items,
@@ -25361,12 +25632,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25361
25632
  trailing: confirmCards
25362
25633
  }
25363
25634
  ),
25364
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__error", children: [
25365
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TriangleAlert, { size: 14 }),
25635
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__error", children: [
25636
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TriangleAlert, { size: 14 }),
25366
25637
  " ",
25367
25638
  chatState.errorText || voice.error
25368
25639
  ] }),
25369
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25640
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25370
25641
  Composer,
25371
25642
  {
25372
25643
  disabled: composerDisabled,
@@ -25386,18 +25657,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25386
25657
  onValueChange: setComposerDraft
25387
25658
  }
25388
25659
  )
25389
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
25660
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: "Select an agent from the sidebar to start chatting" }) }) }),
25390
25661
  deleteOverlay
25391
25662
  ] });
25392
25663
  }
25393
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app", children: [
25394
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__header-row", children: [
25395
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__logo-title-wrapper", children: [
25396
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
25397
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Caretaker" })
25664
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app", children: [
25665
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("header", { className: "app__header", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__header-row", children: [
25666
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__logo-title-wrapper", children: [
25667
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: caretaker_cli_default, alt: "Caretaker", className: "app__logo" }),
25668
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Caretaker" })
25398
25669
  ] }),
25399
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__controls", children: [
25400
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25670
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__controls", children: [
25671
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__agent-select-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25401
25672
  "select",
25402
25673
  {
25403
25674
  className: "app__agent-select",
@@ -25407,12 +25678,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25407
25678
  onSelectAgent(e.target.value);
25408
25679
  },
25409
25680
  children: [
25410
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
25411
- agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
25681
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", disabled: true, children: "-- Select Agent --" }),
25682
+ agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: agent.id, children: agent.name }, agent.id))
25412
25683
  ]
25413
25684
  }
25414
25685
  ) }),
25415
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25686
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25416
25687
  "button",
25417
25688
  {
25418
25689
  className: "app__sessions-btn",
@@ -25420,13 +25691,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25420
25691
  disabled: !selectedAgentId,
25421
25692
  title: "View conversations",
25422
25693
  children: [
25423
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MessageSquare, { size: 13 }),
25694
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessageSquare, { size: 13 }),
25424
25695
  " ",
25425
25696
  sessions.length
25426
25697
  ]
25427
25698
  }
25428
25699
  ),
25429
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25700
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25430
25701
  "button",
25431
25702
  {
25432
25703
  className: "app__new-chat-btn",
@@ -25436,7 +25707,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25436
25707
  children: "+ New"
25437
25708
  }
25438
25709
  ),
25439
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25710
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25440
25711
  "button",
25441
25712
  {
25442
25713
  className: "app__settings-btn",
@@ -25445,24 +25716,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25445
25716
  postMessage({ type: "getSettingsData" });
25446
25717
  },
25447
25718
  title: "Caretaker Settings",
25448
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Settings, { className: "app__settings-icon", size: 14 })
25719
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Settings, { className: "app__settings-icon", size: 14 })
25449
25720
  }
25450
25721
  )
25451
25722
  ] })
25452
25723
  ] }) }),
25453
- showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sessions-dropdown", children: [
25454
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sessions-title", children: [
25724
+ showSessions && sessions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sessions-dropdown", children: [
25725
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sessions-title", children: [
25455
25726
  "Conversations for ",
25456
25727
  selectedAgentName
25457
25728
  ] }),
25458
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
25729
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sessions-list", children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
25459
25730
  "div",
25460
25731
  {
25461
25732
  className: `app__session-item ${selectedSessionId === session.id ? "app__session-item--active" : ""}`,
25462
25733
  onClick: () => onSelectSession(session.id),
25463
25734
  children: [
25464
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "app__session-item-title", children: session.title }),
25465
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25735
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "app__session-item-title", children: session.title }),
25736
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25466
25737
  "button",
25467
25738
  {
25468
25739
  className: "app__session-item-delete",
@@ -25471,7 +25742,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25471
25742
  e.stopPropagation();
25472
25743
  onDeleteSession(session.id, session.title);
25473
25744
  },
25474
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 12 })
25745
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Trash, { size: 12 })
25475
25746
  }
25476
25747
  )
25477
25748
  ]
@@ -25479,12 +25750,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25479
25750
  session.id
25480
25751
  )) })
25481
25752
  ] }),
25482
- showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
25483
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
25484
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
25753
+ showSessions && sessions.length === 0 && selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__sessions-dropdown app__sessions-dropdown--empty", children: [
25754
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__sessions-title", children: "No conversations yet" }),
25755
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "app__sessions-empty", children: "Start a new chat to create a conversation" })
25485
25756
  ] }),
25486
- !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: "Select an agent to start chatting" }) }),
25487
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25757
+ !selectedAgentId && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "app__empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: "Select an agent to start chatting" }) }),
25758
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25488
25759
  MessageList,
25489
25760
  {
25490
25761
  items: chatState.items,
@@ -25494,12 +25765,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25494
25765
  trailing: confirmCards
25495
25766
  }
25496
25767
  ),
25497
- (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "app__error", children: [
25498
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TriangleAlert, { size: 14 }),
25768
+ (chatState.errorText || voice.error) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "app__error", children: [
25769
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TriangleAlert, { size: 14 }),
25499
25770
  " ",
25500
25771
  chatState.errorText || voice.error
25501
25772
  ] }),
25502
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
25773
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25503
25774
  Composer,
25504
25775
  {
25505
25776
  disabled: composerDisabled,
@@ -25524,12 +25795,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25524
25795
  }
25525
25796
 
25526
25797
  // src/standalone.tsx
25527
- var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
25798
+ var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
25528
25799
  function StandaloneApp() {
25529
- const [ws, setWs] = (0, import_react26.useState)(null);
25530
- const [connected, setConnected] = (0, import_react26.useState)(false);
25531
- const [error, setError] = (0, import_react26.useState)(null);
25532
- (0, import_react26.useEffect)(() => {
25800
+ const [ws, setWs] = (0, import_react27.useState)(null);
25801
+ const [connected, setConnected] = (0, import_react27.useState)(false);
25802
+ const [error, setError] = (0, import_react27.useState)(null);
25803
+ (0, import_react27.useEffect)(() => {
25533
25804
  let active = true;
25534
25805
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
25535
25806
  const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws`);
@@ -25575,7 +25846,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25575
25846
  }
25576
25847
  };
25577
25848
  if (error) {
25578
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: {
25849
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: {
25579
25850
  display: "flex",
25580
25851
  flexDirection: "column",
25581
25852
  alignItems: "center",
@@ -25587,9 +25858,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25587
25858
  padding: "20px",
25588
25859
  textAlign: "center"
25589
25860
  }, children: [
25590
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
25591
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: error }),
25592
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
25861
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { style: { color: "#ff6b6b" }, children: "Caretaker Connection Failed" }),
25862
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: error }),
25863
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
25593
25864
  "button",
25594
25865
  {
25595
25866
  onClick: () => setWs(null),
@@ -25608,7 +25879,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25608
25879
  ] });
25609
25880
  }
25610
25881
  if (!connected) {
25611
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: {
25882
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: {
25612
25883
  display: "flex",
25613
25884
  flexDirection: "column",
25614
25885
  alignItems: "center",
@@ -25618,7 +25889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25618
25889
  background: "#1e1e1e",
25619
25890
  color: "#f1f1f1"
25620
25891
  }, children: [
25621
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: {
25892
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: {
25622
25893
  border: "4px solid rgba(255,255,255,0.1)",
25623
25894
  width: "36px",
25624
25895
  height: "36px",
@@ -25627,8 +25898,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25627
25898
  animation: "spin 1s linear infinite",
25628
25899
  marginBottom: "16px"
25629
25900
  } }),
25630
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Connecting to Caretaker server..." }),
25631
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: `
25901
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Connecting to Caretaker server..." }),
25902
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("style", { children: `
25632
25903
  @keyframes spin {
25633
25904
  0% { transform: rotate(0deg); }
25634
25905
  100% { transform: rotate(360deg); }
@@ -25636,12 +25907,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
25636
25907
  ` })
25637
25908
  ] });
25638
25909
  }
25639
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(App, { postMessage, layout: "sidebar" });
25910
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(App, { postMessage, layout: "sidebar" });
25640
25911
  }
25641
25912
  var rootEl = document.getElementById("root");
25642
25913
  if (!rootEl) throw new Error("#root not found");
25643
25914
  (0, import_client.createRoot)(rootEl).render(
25644
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react26.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StandaloneApp, {}) })
25915
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react27.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StandaloneApp, {}) })
25645
25916
  );
25646
25917
  })();
25647
25918
  /*! Bundled license information: