@hyperwindmill/caretaker-cli 0.32.0 → 0.33.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.
- package/dist/cli/web/scheduler/cycle_events.d.ts +8 -3
- package/dist/cli/web/scheduler/cycle_events.d.ts.map +1 -1
- package/dist/cli/web/scheduler/cycle_events.js +2 -0
- package/dist/cli/web/scheduler/email_triage.d.ts +8 -1
- package/dist/cli/web/scheduler/email_triage.d.ts.map +1 -1
- package/dist/cli/web/scheduler/email_triage.js +19 -4
- package/dist/cli/web/scheduler/email_triage_agent.d.ts.map +1 -1
- package/dist/cli/web/scheduler/email_triage_agent.js +1 -0
- package/dist/cli/web/scheduler/heartbeat.d.ts +1 -1
- package/dist/cli/web/scheduler/heartbeat.d.ts.map +1 -1
- package/dist/cli/web/scheduler/heartbeat.js +9 -5
- package/dist/cli/web/scheduler/service_runs.d.ts +12 -0
- package/dist/cli/web/scheduler/service_runs.d.ts.map +1 -0
- package/dist/cli/web/scheduler/service_runs.js +39 -0
- package/dist/cli/web/scheduler.d.ts +9 -0
- package/dist/cli/web/scheduler.d.ts.map +1 -1
- package/dist/cli/web/scheduler.js +24 -2
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +34 -1
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +2 -1
- package/dist/webview/standalone.js +456 -343
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +3 -3
|
@@ -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
|
|
17395
|
+
var import_react22 = __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
|
|
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 >
|
|
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/
|
|
19878
|
-
var
|
|
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.
|
|
19889
|
+
if (msg.recap) {
|
|
19888
19890
|
items = closeStreamingAssistant(items);
|
|
19889
|
-
items.push({ kind: "
|
|
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,
|
|
19937
|
-
const [isCreating, setIsCreating] = (0,
|
|
19938
|
-
const [viewingTaskLogs, setViewingTaskLogs] = (0,
|
|
19939
|
-
const [selectedRunId, setSelectedRunId] = (0,
|
|
19940
|
-
const [
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
const [
|
|
19951
|
-
const [
|
|
19952
|
-
const [
|
|
19953
|
-
const [
|
|
19954
|
-
const [
|
|
19955
|
-
const [
|
|
19956
|
-
const [
|
|
19957
|
-
const [
|
|
19958
|
-
const [
|
|
19959
|
-
const [
|
|
19960
|
-
const [
|
|
19961
|
-
const [
|
|
19962
|
-
const [
|
|
19963
|
-
const [
|
|
19964
|
-
const [
|
|
19965
|
-
const [
|
|
19966
|
-
const [
|
|
19967
|
-
const [
|
|
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
|
|
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,
|
|
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-
|
|
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:
|
|
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,12 +21205,34 @@ 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
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
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);
|
|
21233
|
+
const formattedDate = date.toLocaleString();
|
|
21234
|
+
const isSuccess = run.status === "success";
|
|
21235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
20919
21236
|
"button",
|
|
20920
21237
|
{
|
|
20921
21238
|
className: `execution-console__run-item ${isSelected ? "execution-console__run-item--active" : ""}`,
|
|
@@ -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:
|
|
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
|
|
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
|
|
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,
|
|
21077
|
-
const [progress, setProgress] = (0,
|
|
21078
|
-
const [error, setError] = (0,
|
|
21079
|
-
const [confirmingDelete, setConfirmingDelete] = (0,
|
|
21080
|
-
const confirmDeleteTimer = (0,
|
|
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,
|
|
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,
|
|
21101
|
-
(0,
|
|
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
|
|
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,
|
|
21232
|
-
const [progress, setProgress] = (0,
|
|
21233
|
-
const [error, setError] = (0,
|
|
21234
|
-
const [confirmingDelete, setConfirmingDelete] = (0,
|
|
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
|
|
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,
|
|
21369
|
-
const [progress, setProgress] = (0,
|
|
21370
|
-
const [error, setError] = (0,
|
|
21371
|
-
const [confirmingDelete, setConfirmingDelete] = (0,
|
|
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,
|
|
21843
|
-
const [endpoint, setEndpoint] = (0,
|
|
21844
|
-
const [apiKey, setApiKey] = (0,
|
|
21845
|
-
const [sttModel, setSttModel] = (0,
|
|
21846
|
-
const [ttsEndpoint, setTtsEndpoint] = (0,
|
|
21847
|
-
const [ttsApiKey, setTtsApiKey] = (0,
|
|
21848
|
-
const [ttsModel, setTtsModel] = (0,
|
|
21849
|
-
const [ttsVoice, setTtsVoice] = (0,
|
|
21850
|
-
const [ttsSpeed, setTtsSpeed] = (0,
|
|
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,
|
|
21854
|
-
const [bufferMs, setBufferMs] = (0,
|
|
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,
|
|
21858
|
-
const [sttEngine, setSttEngine] = (0,
|
|
21859
|
-
const [sttBuiltinModel, setSttBuiltinModel] = (0,
|
|
21860
|
-
const [ttsLanguage, setTtsLanguage] = (0,
|
|
21861
|
-
const [pronEnabled, setPronEnabled] = (0,
|
|
21862
|
-
const [pronunciation, setPronunciation] = (0,
|
|
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,
|
|
21866
|
-
const [listening, setListening] = (0,
|
|
21867
|
-
const [listenError, setListenError] = (0,
|
|
21868
|
-
const listenAbort = (0,
|
|
21869
|
-
const [fetching, setFetching] = (0,
|
|
21870
|
-
const [fetchingTts, setFetchingTts] = (0,
|
|
21871
|
-
const [saveState, setSaveState] = (0,
|
|
21872
|
-
const pendingSave = (0,
|
|
21873
|
-
const [autoStartBackend, setAutoStartBackend] = (0,
|
|
21874
|
-
const [backendStatuses, setBackendStatuses] = (0,
|
|
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,
|
|
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,
|
|
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,
|
|
22225
|
+
(0, import_react19.useEffect)(() => {
|
|
21900
22226
|
if (sttCatalogResult) setFetching(false);
|
|
21901
22227
|
}, [sttCatalogResult]);
|
|
21902
|
-
(0,
|
|
22228
|
+
(0, import_react19.useEffect)(() => {
|
|
21903
22229
|
if (ttsCatalogResult) setFetchingTts(false);
|
|
21904
22230
|
}, [ttsCatalogResult]);
|
|
21905
|
-
(0,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
22434
|
-
const [agentId, setAgentId] = (0,
|
|
22435
|
-
const [sweepMinutes, setSweepMinutes] = (0,
|
|
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,
|
|
22764
|
+
const [minNewMessages, setMinNewMessages] = (0, import_react20.useState)(
|
|
22439
22765
|
current?.minNewMessages === void 0 ? "" : String(current.minNewMessages)
|
|
22440
22766
|
);
|
|
22441
|
-
const [saveState, setSaveState] = (0,
|
|
22442
|
-
const pendingSave = (0,
|
|
22443
|
-
(0,
|
|
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,
|
|
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
|
|
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,
|
|
22555
|
-
const [agentId, setAgentId] = (0,
|
|
22556
|
-
const [shortcut, setShortcut] = (0,
|
|
22557
|
-
const [saveState, setSaveState] = (0,
|
|
22558
|
-
const pendingSave = (0,
|
|
22559
|
-
(0,
|
|
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,
|
|
22891
|
+
(0, import_react21.useEffect)(() => {
|
|
22566
22892
|
if (saveState !== "saved") return;
|
|
22567
22893
|
const t = setTimeout(() => setSaveState("idle"), 2e3);
|
|
22568
22894
|
return () => clearTimeout(t);
|
|
@@ -22666,7 +22992,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
22666
22992
|
onClose,
|
|
22667
22993
|
initialTab = "providers"
|
|
22668
22994
|
}) {
|
|
22669
|
-
const [activeTab, setActiveTab] = (0,
|
|
22995
|
+
const [activeTab, setActiveTab] = (0, import_react22.useState)(initialTab);
|
|
22670
22996
|
if (!settingsData) {
|
|
22671
22997
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "settings-panel settings-panel--loading", children: [
|
|
22672
22998
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { className: "settings-panel__back-btn", onClick: onClose, children: [
|
|
@@ -22868,229 +23194,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
22868
23194
|
// src/ProjectsTab.tsx
|
|
22869
23195
|
var import_react23 = __toESM(require_react(), 1);
|
|
22870
23196
|
|
|
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
|
-
};
|
|
23046
|
-
|
|
23047
23197
|
// src/TaskCycleView.tsx
|
|
23048
23198
|
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
23049
23199
|
function TaskCycleView({ item, postMessage, onBack }) {
|
|
23050
|
-
const [chat, dispatch] = (0, import_react22.useReducer)(chatReducer, initialChatState);
|
|
23051
23200
|
const { sessionId, agentId } = item;
|
|
23052
|
-
const
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
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]);
|
|
23201
|
+
const chat = useCycleStream(sessionId, {
|
|
23202
|
+
watch: () => postMessage({ type: "watchCycle", agentId, sessionId }),
|
|
23203
|
+
unwatch: () => postMessage({ type: "unwatchCycle", sessionId }),
|
|
23204
|
+
// The recap is persisted before `done`: reload the finished session from disk.
|
|
23205
|
+
onDone: () => postMessage({ type: "watchCycle", agentId, sessionId })
|
|
23206
|
+
});
|
|
23094
23207
|
const running = chat.status === "streaming";
|
|
23095
23208
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
23096
23209
|
/* @__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: [
|