@robota-sdk/agent-cli 3.0.0-beta.35 → 3.0.0-beta.37
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/node/bin.cjs +138 -73
- package/dist/node/bin.js +1 -1
- package/dist/node/{chunk-27OPEZHA.js → chunk-P323ORQX.js} +137 -67
- package/dist/node/index.cjs +138 -73
- package/dist/node/index.js +1 -1
- package/package.json +1 -1
package/dist/node/bin.cjs
CHANGED
|
@@ -168,7 +168,8 @@ var import_ink14 = require("ink");
|
|
|
168
168
|
// src/ui/App.tsx
|
|
169
169
|
var import_react16 = require("react");
|
|
170
170
|
var import_ink13 = require("ink");
|
|
171
|
-
var
|
|
171
|
+
var import_agent_core6 = require("@robota-sdk/agent-core");
|
|
172
|
+
var import_agent_core7 = require("@robota-sdk/agent-core");
|
|
172
173
|
|
|
173
174
|
// src/ui/hooks/useSession.ts
|
|
174
175
|
var import_react = require("react");
|
|
@@ -264,6 +265,7 @@ var NOOP_TERMINAL = {
|
|
|
264
265
|
function useSession(props) {
|
|
265
266
|
const [permissionRequest, setPermissionRequest] = (0, import_react.useState)(null);
|
|
266
267
|
const [streamingText, setStreamingText] = (0, import_react.useState)("");
|
|
268
|
+
const streamingTextRef = (0, import_react.useRef)("");
|
|
267
269
|
const [activeTools, setActiveTools] = (0, import_react.useState)([]);
|
|
268
270
|
const permissionQueueRef = (0, import_react.useRef)([]);
|
|
269
271
|
const processingRef = (0, import_react.useRef)(false);
|
|
@@ -295,8 +297,15 @@ function useSession(props) {
|
|
|
295
297
|
processNextPermission();
|
|
296
298
|
});
|
|
297
299
|
};
|
|
300
|
+
let flushTimer = null;
|
|
298
301
|
const onTextDelta = (delta) => {
|
|
299
|
-
|
|
302
|
+
streamingTextRef.current += delta;
|
|
303
|
+
if (!flushTimer) {
|
|
304
|
+
flushTimer = setTimeout(() => {
|
|
305
|
+
setStreamingText(streamingTextRef.current);
|
|
306
|
+
flushTimer = null;
|
|
307
|
+
}, 16);
|
|
308
|
+
}
|
|
300
309
|
};
|
|
301
310
|
const onToolExecution = (event) => {
|
|
302
311
|
if (event.type === "start") {
|
|
@@ -375,6 +384,7 @@ function useSession(props) {
|
|
|
375
384
|
}
|
|
376
385
|
const clearStreamingText = (0, import_react.useCallback)(() => {
|
|
377
386
|
setStreamingText("");
|
|
387
|
+
streamingTextRef.current = "";
|
|
378
388
|
setActiveTools([]);
|
|
379
389
|
}, []);
|
|
380
390
|
return {
|
|
@@ -389,16 +399,11 @@ function useSession(props) {
|
|
|
389
399
|
// src/ui/hooks/useMessages.ts
|
|
390
400
|
var import_react2 = require("react");
|
|
391
401
|
var MAX_RENDERED_MESSAGES = 100;
|
|
392
|
-
var msgIdCounter = 0;
|
|
393
|
-
function nextId() {
|
|
394
|
-
msgIdCounter += 1;
|
|
395
|
-
return `msg_${msgIdCounter}`;
|
|
396
|
-
}
|
|
397
402
|
function useMessages() {
|
|
398
403
|
const [messages, setMessages] = (0, import_react2.useState)([]);
|
|
399
404
|
const addMessage = (0, import_react2.useCallback)((msg) => {
|
|
400
405
|
setMessages((prev) => {
|
|
401
|
-
const updated = [...prev,
|
|
406
|
+
const updated = [...prev, msg];
|
|
402
407
|
if (updated.length > MAX_RENDERED_MESSAGES) {
|
|
403
408
|
return updated.slice(-MAX_RENDERED_MESSAGES);
|
|
404
409
|
}
|
|
@@ -410,6 +415,7 @@ function useMessages() {
|
|
|
410
415
|
|
|
411
416
|
// src/ui/hooks/useSlashCommands.ts
|
|
412
417
|
var import_react3 = require("react");
|
|
418
|
+
var import_agent_core = require("@robota-sdk/agent-core");
|
|
413
419
|
|
|
414
420
|
// src/commands/slash-executor.ts
|
|
415
421
|
var VALID_MODES2 = ["plan", "default", "acceptEdits", "bypassPermissions"];
|
|
@@ -676,11 +682,14 @@ function useSlashCommands(session, addMessage, setMessages, exit, registry, pend
|
|
|
676
682
|
const cmd = parts[0]?.toLowerCase() ?? "";
|
|
677
683
|
const args = parts.slice(1).join(" ");
|
|
678
684
|
const clearMessages = () => setMessages([]);
|
|
685
|
+
const slashAddMessage = (msg) => {
|
|
686
|
+
addMessage((0, import_agent_core.createSystemMessage)(msg.content));
|
|
687
|
+
};
|
|
679
688
|
const result = await executeSlashCommand(
|
|
680
689
|
cmd,
|
|
681
690
|
args,
|
|
682
691
|
session,
|
|
683
|
-
|
|
692
|
+
slashAddMessage,
|
|
684
693
|
clearMessages,
|
|
685
694
|
registry,
|
|
686
695
|
pluginCallbacks
|
|
@@ -713,7 +722,9 @@ function useSlashCommands(session, addMessage, setMessages, exit, registry, pend
|
|
|
713
722
|
|
|
714
723
|
// src/ui/hooks/useSubmitHandler.ts
|
|
715
724
|
var import_react4 = require("react");
|
|
725
|
+
var import_node_crypto = require("crypto");
|
|
716
726
|
var import_agent_sdk2 = require("@robota-sdk/agent-sdk");
|
|
727
|
+
var import_agent_core2 = require("@robota-sdk/agent-core");
|
|
717
728
|
|
|
718
729
|
// src/utils/tool-call-extractor.ts
|
|
719
730
|
var TOOL_ARG_MAX_LENGTH = 80;
|
|
@@ -870,21 +881,50 @@ async function runSessionPrompt(prompt, session, addMessage, clearStreamingText,
|
|
|
870
881
|
historyBefore
|
|
871
882
|
);
|
|
872
883
|
if (toolSummaries.length > 0) {
|
|
873
|
-
addMessage(
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
884
|
+
addMessage(
|
|
885
|
+
(0, import_agent_core2.createToolMessage)(JSON.stringify(toolSummaries), {
|
|
886
|
+
toolCallId: (0, import_node_crypto.randomUUID)(),
|
|
887
|
+
name: `${toolSummaries.length} tools`
|
|
888
|
+
})
|
|
889
|
+
);
|
|
878
890
|
}
|
|
879
|
-
addMessage(
|
|
891
|
+
addMessage((0, import_agent_core2.createAssistantMessage)(response || "(empty response)"));
|
|
880
892
|
syncContextState(session, setContextState);
|
|
881
893
|
} catch (err) {
|
|
882
894
|
clearStreamingText();
|
|
883
|
-
|
|
884
|
-
|
|
895
|
+
const isAbortError = err instanceof DOMException && err.name === "AbortError" || err instanceof Error && (err.message.includes("aborted") || err.message.includes("abort"));
|
|
896
|
+
if (isAbortError) {
|
|
897
|
+
const history = session.getHistory();
|
|
898
|
+
const toolSummaries = extractToolCallsWithDiff(
|
|
899
|
+
history,
|
|
900
|
+
historyBefore
|
|
901
|
+
);
|
|
902
|
+
if (toolSummaries.length > 0) {
|
|
903
|
+
addMessage(
|
|
904
|
+
(0, import_agent_core2.createToolMessage)(JSON.stringify(toolSummaries), {
|
|
905
|
+
toolCallId: (0, import_node_crypto.randomUUID)(),
|
|
906
|
+
name: `${toolSummaries.length} tools`
|
|
907
|
+
})
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
const assistantParts = [];
|
|
911
|
+
let lastAssistantState = "complete";
|
|
912
|
+
for (let i = historyBefore; i < history.length; i++) {
|
|
913
|
+
const msg = history[i];
|
|
914
|
+
if (msg && msg.role === "assistant" && msg.content) {
|
|
915
|
+
assistantParts.push(msg.content);
|
|
916
|
+
if (msg.state === "interrupted") lastAssistantState = "interrupted";
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
if (assistantParts.length > 0) {
|
|
920
|
+
addMessage(
|
|
921
|
+
(0, import_agent_core2.createAssistantMessage)(assistantParts.join("\n\n"), { state: lastAssistantState })
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
addMessage((0, import_agent_core2.createSystemMessage)("Interrupted by user."));
|
|
885
925
|
} else {
|
|
886
926
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
887
|
-
addMessage(
|
|
927
|
+
addMessage((0, import_agent_core2.createSystemMessage)(`Error: ${errMsg}`));
|
|
888
928
|
}
|
|
889
929
|
} finally {
|
|
890
930
|
setIsThinking(false);
|
|
@@ -937,7 +977,7 @@ function useSubmitHandler(session, addMessage, handleSlashCommand, clearStreamin
|
|
|
937
977
|
const runInFork = createForkRunner(session);
|
|
938
978
|
const result = await executeSkill(skill, args, { runInFork });
|
|
939
979
|
if (result.mode === "fork") {
|
|
940
|
-
addMessage(
|
|
980
|
+
addMessage((0, import_agent_core2.createAssistantMessage)(result.result ?? "(empty response)"));
|
|
941
981
|
syncContextState(session, setContextState);
|
|
942
982
|
return;
|
|
943
983
|
}
|
|
@@ -972,7 +1012,7 @@ function useSubmitHandler(session, addMessage, handleSlashCommand, clearStreamin
|
|
|
972
1012
|
hookInput
|
|
973
1013
|
);
|
|
974
1014
|
}
|
|
975
|
-
addMessage(
|
|
1015
|
+
addMessage((0, import_agent_core2.createUserMessage)(input));
|
|
976
1016
|
return runSessionPrompt(
|
|
977
1017
|
input,
|
|
978
1018
|
session,
|
|
@@ -1039,16 +1079,16 @@ var CommandRegistry = class {
|
|
|
1039
1079
|
};
|
|
1040
1080
|
|
|
1041
1081
|
// src/commands/builtin-source.ts
|
|
1042
|
-
var
|
|
1082
|
+
var import_agent_core3 = require("@robota-sdk/agent-core");
|
|
1043
1083
|
function buildModelSubcommands() {
|
|
1044
1084
|
const seen = /* @__PURE__ */ new Set();
|
|
1045
1085
|
const commands = [];
|
|
1046
|
-
for (const model of Object.values(
|
|
1086
|
+
for (const model of Object.values(import_agent_core3.CLAUDE_MODELS)) {
|
|
1047
1087
|
if (seen.has(model.name)) continue;
|
|
1048
1088
|
seen.add(model.name);
|
|
1049
1089
|
commands.push({
|
|
1050
1090
|
name: model.id,
|
|
1051
|
-
description: `${model.name} (${(0,
|
|
1091
|
+
description: `${model.name} (${(0, import_agent_core3.formatTokenCount)(model.contextWindow).toUpperCase()})`,
|
|
1052
1092
|
source: "builtin"
|
|
1053
1093
|
});
|
|
1054
1094
|
}
|
|
@@ -1443,6 +1483,7 @@ function usePluginCallbacks(cwd) {
|
|
|
1443
1483
|
// src/ui/MessageList.tsx
|
|
1444
1484
|
var import_react7 = __toESM(require("react"), 1);
|
|
1445
1485
|
var import_ink2 = require("ink");
|
|
1486
|
+
var import_agent_core4 = require("@robota-sdk/agent-core");
|
|
1446
1487
|
|
|
1447
1488
|
// src/ui/render-markdown.ts
|
|
1448
1489
|
var import_marked = require("marked");
|
|
@@ -1528,9 +1569,14 @@ function RoleLabel({ role }) {
|
|
|
1528
1569
|
}
|
|
1529
1570
|
}
|
|
1530
1571
|
function ToolMessage({ message }) {
|
|
1572
|
+
if (!(0, import_agent_core4.isToolMessage)(message)) {
|
|
1573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
|
|
1574
|
+
}
|
|
1575
|
+
const toolName = message.name;
|
|
1576
|
+
const content = message.content;
|
|
1531
1577
|
let summaries = null;
|
|
1532
1578
|
try {
|
|
1533
|
-
const parsed = JSON.parse(
|
|
1579
|
+
const parsed = JSON.parse(content);
|
|
1534
1580
|
if (Array.isArray(parsed) && parsed.length > 0 && typeof parsed[0].line === "string") {
|
|
1535
1581
|
summaries = parsed;
|
|
1536
1582
|
}
|
|
@@ -1543,9 +1589,9 @@ function ToolMessage({ message }) {
|
|
|
1543
1589
|
"Tool:",
|
|
1544
1590
|
" "
|
|
1545
1591
|
] }),
|
|
1546
|
-
|
|
1592
|
+
toolName && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Text, { color: "white", dimColor: true, children: [
|
|
1547
1593
|
"[",
|
|
1548
|
-
|
|
1594
|
+
toolName,
|
|
1549
1595
|
"]"
|
|
1550
1596
|
] })
|
|
1551
1597
|
] }),
|
|
@@ -1561,16 +1607,16 @@ function ToolMessage({ message }) {
|
|
|
1561
1607
|
] }, i))
|
|
1562
1608
|
] });
|
|
1563
1609
|
}
|
|
1564
|
-
const lines =
|
|
1610
|
+
const lines = content.split("\n").filter((l) => l.trim());
|
|
1565
1611
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
1566
1612
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Box, { children: [
|
|
1567
1613
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Text, { color: "white", bold: true, children: [
|
|
1568
1614
|
"Tool:",
|
|
1569
1615
|
" "
|
|
1570
1616
|
] }),
|
|
1571
|
-
|
|
1617
|
+
toolName && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Text, { color: "white", dimColor: true, children: [
|
|
1572
1618
|
"[",
|
|
1573
|
-
|
|
1619
|
+
toolName,
|
|
1574
1620
|
"]"
|
|
1575
1621
|
] })
|
|
1576
1622
|
] }),
|
|
@@ -1586,21 +1632,15 @@ function ToolMessage({ message }) {
|
|
|
1586
1632
|
var MessageItem = import_react7.default.memo(function MessageItem2({
|
|
1587
1633
|
message
|
|
1588
1634
|
}) {
|
|
1589
|
-
if (
|
|
1635
|
+
if ((0, import_agent_core4.isToolMessage)(message)) {
|
|
1590
1636
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToolMessage, { message });
|
|
1591
1637
|
}
|
|
1638
|
+
const content = message.content ?? "";
|
|
1639
|
+
const isInterrupted = message.state === "interrupted";
|
|
1592
1640
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
1593
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1594
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RoleLabel, { role: message.role }),
|
|
1595
|
-
message.toolName && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink2.Text, { color: "magenta", dimColor: true, children: [
|
|
1596
|
-
"[",
|
|
1597
|
-
message.toolName,
|
|
1598
|
-
"]",
|
|
1599
|
-
" "
|
|
1600
|
-
] })
|
|
1601
|
-
] }),
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RoleLabel, { role: message.role }) }),
|
|
1602
1642
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Text, { children: " " }),
|
|
1603
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Box, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Text, { wrap: "wrap", children: message
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Box, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Text, { wrap: "wrap", children: (0, import_agent_core4.isAssistantMessage)(message) ? renderMarkdown(content + (isInterrupted ? "\n\n_(interrupted)_" : "")) : content }) })
|
|
1604
1644
|
] });
|
|
1605
1645
|
});
|
|
1606
1646
|
function MessageList({ messages }) {
|
|
@@ -1609,7 +1649,7 @@ function MessageList({ messages }) {
|
|
|
1609
1649
|
|
|
1610
1650
|
// src/ui/StatusBar.tsx
|
|
1611
1651
|
var import_ink3 = require("ink");
|
|
1612
|
-
var
|
|
1652
|
+
var import_agent_core5 = require("@robota-sdk/agent-core");
|
|
1613
1653
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1614
1654
|
var CONTEXT_YELLOW_THRESHOLD = 70;
|
|
1615
1655
|
var CONTEXT_RED_THRESHOLD = 90;
|
|
@@ -1649,9 +1689,9 @@ function StatusBar({
|
|
|
1649
1689
|
"Context: ",
|
|
1650
1690
|
Math.round(contextPercentage),
|
|
1651
1691
|
"% (",
|
|
1652
|
-
(0,
|
|
1692
|
+
(0, import_agent_core5.formatTokenCount)(contextUsedTokens),
|
|
1653
1693
|
"/",
|
|
1654
|
-
(0,
|
|
1694
|
+
(0, import_agent_core5.formatTokenCount)(contextMaxTokens),
|
|
1655
1695
|
")"
|
|
1656
1696
|
] })
|
|
1657
1697
|
] }),
|
|
@@ -1898,7 +1938,12 @@ function useAutocomplete(value, registry) {
|
|
|
1898
1938
|
}
|
|
1899
1939
|
};
|
|
1900
1940
|
}
|
|
1901
|
-
function InputArea({
|
|
1941
|
+
function InputArea({
|
|
1942
|
+
onSubmit,
|
|
1943
|
+
isDisabled,
|
|
1944
|
+
isAborting,
|
|
1945
|
+
registry
|
|
1946
|
+
}) {
|
|
1902
1947
|
const [value, setValue] = (0, import_react10.useState)("");
|
|
1903
1948
|
const pasteStore = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
1904
1949
|
const pasteIdRef = (0, import_react10.useRef)(0);
|
|
@@ -1979,19 +2024,27 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
1979
2024
|
isSubcommandMode
|
|
1980
2025
|
}
|
|
1981
2026
|
),
|
|
1982
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2028
|
+
import_ink7.Box,
|
|
2029
|
+
{
|
|
2030
|
+
borderStyle: "single",
|
|
2031
|
+
borderColor: isAborting ? "yellow" : isDisabled ? "gray" : "green",
|
|
2032
|
+
paddingLeft: 1,
|
|
2033
|
+
children: isDisabled ? isAborting ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "yellow", children: " Interrupting..." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { children: [
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "green", bold: true, children: "> " }),
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2036
|
+
CjkTextInput,
|
|
2037
|
+
{
|
|
2038
|
+
value,
|
|
2039
|
+
onChange: setValue,
|
|
2040
|
+
onSubmit: handleSubmit,
|
|
2041
|
+
onPaste: handlePaste,
|
|
2042
|
+
placeholder: "Type a message or /help"
|
|
2043
|
+
}
|
|
2044
|
+
)
|
|
2045
|
+
] })
|
|
2046
|
+
}
|
|
2047
|
+
)
|
|
1995
2048
|
] });
|
|
1996
2049
|
}
|
|
1997
2050
|
|
|
@@ -2115,7 +2168,7 @@ function StreamingIndicator({ text, activeTools }) {
|
|
|
2115
2168
|
const hasTools = activeTools.length > 0;
|
|
2116
2169
|
const hasText = text.length > 0;
|
|
2117
2170
|
if (!hasTools && !hasText) {
|
|
2118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, {});
|
|
2119
2172
|
}
|
|
2120
2173
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ink10.Box, { flexDirection: "column", children: [
|
|
2121
2174
|
hasTools && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ink10.Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
@@ -2639,6 +2692,7 @@ function App(props) {
|
|
|
2639
2692
|
const pendingModelChangeRef = (0, import_react16.useRef)(null);
|
|
2640
2693
|
const [pendingModelId, setPendingModelId] = (0, import_react16.useState)(null);
|
|
2641
2694
|
const [showPluginTUI, setShowPluginTUI] = (0, import_react16.useState)(false);
|
|
2695
|
+
const [isAborting, setIsAborting] = (0, import_react16.useState)(false);
|
|
2642
2696
|
const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
|
|
2643
2697
|
const handleSlashCommand = useSlashCommands(
|
|
2644
2698
|
session,
|
|
@@ -2662,11 +2716,16 @@ function App(props) {
|
|
|
2662
2716
|
);
|
|
2663
2717
|
(0, import_ink13.useInput)(
|
|
2664
2718
|
(_input, key) => {
|
|
2665
|
-
if (key.
|
|
2666
|
-
|
|
2719
|
+
if (key.escape && isThinking) {
|
|
2720
|
+
setIsAborting(true);
|
|
2721
|
+
session.abort();
|
|
2722
|
+
}
|
|
2667
2723
|
},
|
|
2668
2724
|
{ isActive: !permissionRequest && !showPluginTUI }
|
|
2669
2725
|
);
|
|
2726
|
+
(0, import_react16.useEffect)(() => {
|
|
2727
|
+
if (!isThinking) setIsAborting(false);
|
|
2728
|
+
}, [isThinking]);
|
|
2670
2729
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", children: [
|
|
2671
2730
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
|
|
2672
2731
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink13.Text, { color: "cyan", bold: true, children: `
|
|
@@ -2689,7 +2748,7 @@ function App(props) {
|
|
|
2689
2748
|
pendingModelId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2690
2749
|
ConfirmPrompt,
|
|
2691
2750
|
{
|
|
2692
|
-
message: `Change model to ${(0,
|
|
2751
|
+
message: `Change model to ${(0, import_agent_core6.getModelName)(pendingModelId)}? This will restart the session.`,
|
|
2693
2752
|
onSelect: (index) => {
|
|
2694
2753
|
setPendingModelId(null);
|
|
2695
2754
|
pendingModelChangeRef.current = null;
|
|
@@ -2697,19 +2756,21 @@ function App(props) {
|
|
|
2697
2756
|
try {
|
|
2698
2757
|
const settingsPath = getUserSettingsPath();
|
|
2699
2758
|
updateModelInSettings(settingsPath, pendingModelId);
|
|
2700
|
-
addMessage(
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2759
|
+
addMessage(
|
|
2760
|
+
(0, import_agent_core7.createSystemMessage)(
|
|
2761
|
+
`Model changed to ${(0, import_agent_core6.getModelName)(pendingModelId)}. Restarting...`
|
|
2762
|
+
)
|
|
2763
|
+
);
|
|
2704
2764
|
setTimeout(() => exit(), EXIT_DELAY_MS2);
|
|
2705
2765
|
} catch (err) {
|
|
2706
|
-
addMessage(
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2766
|
+
addMessage(
|
|
2767
|
+
(0, import_agent_core7.createSystemMessage)(
|
|
2768
|
+
`Failed: ${err instanceof Error ? err.message : String(err)}`
|
|
2769
|
+
)
|
|
2770
|
+
);
|
|
2710
2771
|
}
|
|
2711
2772
|
} else {
|
|
2712
|
-
addMessage(
|
|
2773
|
+
addMessage((0, import_agent_core7.createSystemMessage)("Model change cancelled."));
|
|
2713
2774
|
}
|
|
2714
2775
|
}
|
|
2715
2776
|
}
|
|
@@ -2719,14 +2780,14 @@ function App(props) {
|
|
|
2719
2780
|
{
|
|
2720
2781
|
callbacks: pluginCallbacks,
|
|
2721
2782
|
onClose: () => setShowPluginTUI(false),
|
|
2722
|
-
addMessage: (msg) => addMessage(msg)
|
|
2783
|
+
addMessage: (msg) => addMessage((0, import_agent_core7.createSystemMessage)(msg.content))
|
|
2723
2784
|
}
|
|
2724
2785
|
),
|
|
2725
2786
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2726
2787
|
StatusBar,
|
|
2727
2788
|
{
|
|
2728
2789
|
permissionMode: session.getPermissionMode(),
|
|
2729
|
-
modelName: (0,
|
|
2790
|
+
modelName: (0, import_agent_core6.getModelName)(props.config.provider.model),
|
|
2730
2791
|
sessionId: session.getSessionId(),
|
|
2731
2792
|
messageCount: messages.length,
|
|
2732
2793
|
isThinking,
|
|
@@ -2740,6 +2801,7 @@ function App(props) {
|
|
|
2740
2801
|
{
|
|
2741
2802
|
onSubmit: handleSubmit,
|
|
2742
2803
|
isDisabled: isThinking || !!permissionRequest || showPluginTUI,
|
|
2804
|
+
isAborting,
|
|
2743
2805
|
registry
|
|
2744
2806
|
}
|
|
2745
2807
|
),
|
|
@@ -2762,12 +2824,15 @@ function renderApp(options) {
|
|
|
2762
2824
|
const instance = (0, import_ink14.render)(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(App, { ...options }), {
|
|
2763
2825
|
exitOnCtrlC: true
|
|
2764
2826
|
});
|
|
2765
|
-
instance.waitUntilExit().
|
|
2827
|
+
instance.waitUntilExit().then(() => {
|
|
2828
|
+
process.exit(0);
|
|
2829
|
+
}).catch((err) => {
|
|
2766
2830
|
if (err) {
|
|
2767
2831
|
process.stderr.write(`
|
|
2768
2832
|
[EXIT ERROR] ${err}
|
|
2769
2833
|
`);
|
|
2770
2834
|
}
|
|
2835
|
+
process.exit(1);
|
|
2771
2836
|
});
|
|
2772
2837
|
}
|
|
2773
2838
|
|