nolo-cli 0.16.0-alpha.9 → 0.16.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/{_executeModel-ABTND4KZ.js → _executeModel-AVCA2NAV.js} +18 -19
- package/{agentDeleteCommand-ARMAV46L.js → agentDeleteCommand-QW5PUMDQ.js} +12 -13
- package/{agentEmailCommands-BKPZP4UP.js → agentEmailCommands-4ORVLGVQ.js} +23 -24
- package/{agentListCommands-5J7RRXUO.js → agentListCommands-YWBYRTYC.js} +14 -15
- package/{agentMachineCommands-VXWJXXPF.js → agentMachineCommands-JSQW4FOA.js} +12 -13
- package/{agentRecordCommands-INDJINPN.js → agentRecordCommands-AASIWOBT.js} +22 -23
- package/{agentRunCommand-KBN6HBY4.js → agentRunCommand-TB5BHXUH.js} +22 -23
- package/{agentRuntimeLocal-AH2RYWGP.js → agentRuntimeLocal-QNPNJRVH.js} +10 -11
- package/{agentSlice-R4PELU57.js → agentSlice-RUNXC62Y.js} +1 -1
- package/{authCommand-QU5BXRBH.js → authCommand-YFTR3347.js} +2 -8
- package/{chunk-ZVC2PCZN.js → chunk-33BJUVK4.js} +2 -2
- package/{chunk-BG7AP3Q7.js → chunk-3663CXZN.js} +11 -38
- package/{chunk-IFPY2BIE.js → chunk-3OIRVWXA.js} +10 -1
- package/{chunk-LSFAWXKC.js → chunk-3WGLLTK4.js} +3 -100
- package/{chunk-5Y5KEB7V.js → chunk-4FX6NVDW.js} +134 -1
- package/{chunk-QLWU2KOT.js → chunk-4IJYA27C.js} +1 -1
- package/{chunk-OELQ67TN.js → chunk-4L2OJPCU.js} +1 -1
- package/{chunk-HSLJ7QER.js → chunk-55NSNCFM.js} +1 -1
- package/{chunk-ZVDRAEZL.js → chunk-6EVITP2G.js} +250 -1
- package/{chunk-AFNJWHKL.js → chunk-7UKFVQ5W.js} +27 -84
- package/{chunk-VK2HVKAO.js → chunk-AUURUT6L.js} +193 -64
- package/{chunk-4N7QA72L.js → chunk-AVVZUXXC.js} +13 -34
- package/{chunk-2XA3QGOH.js → chunk-BEBNFWDU.js} +3 -3
- package/{chunk-4EME3YTO.js → chunk-DGEYDWEZ.js} +3 -3
- package/{chunk-XECKIDGJ.js → chunk-DPAB4FQ7.js} +126 -646
- package/{chunk-J3VQSU5W.js → chunk-EHLHSX7R.js} +2 -9
- package/{chunk-PEDT43JF.js → chunk-FRV6A633.js} +2 -2
- package/{chunk-VAT72PDP.js → chunk-FY233ZFU.js} +12 -13
- package/{chunk-LZYEWFPK.js → chunk-GSINCD4P.js} +4 -8
- package/{chunk-ZPPTWRPT.js → chunk-IGXREZW2.js} +1 -1
- package/{chunk-B4KT7RN2.js → chunk-JTMNCCWF.js} +2 -2
- package/{chunk-ASZ2C44S.js → chunk-LPEUV5RE.js} +2 -2
- package/{chunk-WVDAUR2S.js → chunk-M43KDE25.js} +1 -1
- package/{chunk-GWESD7AS.js → chunk-MR6ISAGB.js} +2 -2
- package/{chunk-LSHKV3S7.js → chunk-NSCHQQPU.js} +9 -9
- package/{chunk-F6JSVFHX.js → chunk-NVEWUJVX.js} +1 -1
- package/{chunk-R6ALN5F5.js → chunk-P3RIAYGG.js} +1 -1
- package/{chunk-FMYTM25W.js → chunk-PCTUYVUM.js} +1 -1
- package/{chunk-BHVBFI6B.js → chunk-S2LXHNHG.js} +3 -3
- package/{chunk-SGRDLYRZ.js → chunk-Z5JQNBNY.js} +1 -1
- package/{chunk-7HECYFOI.js → chunk-ZQBL7LIC.js} +22 -17
- package/{createAgentAutomationAction-3KKRAYGE.js → createAgentAutomationAction-FNHPSKKO.js} +4 -4
- package/{createDialogAction-S7NMQ4TZ.js → createDialogAction-TZCVQ3NU.js} +5 -5
- package/{createPageAction-2EFBT4LQ.js → createPageAction-EIGZ3BKT.js} +4 -4
- package/{dialogCommands-J7XFIQRD.js → dialogCommands-FO77J5DQ.js} +13 -14
- package/{dialogSlice-LNRRBUIC.js → dialogSlice-MM5U4KE2.js} +4 -4
- package/{docCreateCommands-MKO5WB34.js → docCreateCommands-I3BS3AZI.js} +15 -18
- package/{docDeleteCommands-RCBHRKUE.js → docDeleteCommands-Q2OPV52P.js} +14 -17
- package/{docReadCommands-66527P4G.js → docReadCommands-YOOFACYZ.js} +13 -16
- package/{docStore-67MYPX7P.js → docStore-NGYQ2JTR.js} +5 -5
- package/{docUpdateCommands-UT5HSLOJ.js → docUpdateCommands-2B32ITHN.js} +14 -17
- package/{handleSendMessageAction-VZ7226PB.js → handleSendMessageAction-JRZWWBKP.js} +4 -4
- package/index.js +43 -74
- package/{machineCommands-ATA7OSBJ.js → machineCommands-WRWF2ICZ.js} +21 -22
- package/{machineWsRunDispatch-ZDCZ645H.js → machineWsRunDispatch-ZX7Q3TWZ.js} +21 -22
- package/{models-5K5G2CZI.js → models-WQ5N4OJM.js} +1 -1
- package/package.json +1 -1
- package/{readlineWorkspace-UUNABTLB.js → readlineWorkspace-ZTGRGW46.js} +74 -75
- package/{runAgentClientLoop-2A577WBM.js → runAgentClientLoop-JZCOP7LG.js} +14 -15
- package/{spaceCommands-UNZVR2OS.js → spaceCommands-VV4GTPQK.js} +12 -13
- package/{spaceSlice-MC7FYPMZ.js → spaceSlice-DRWWZJP7.js} +4 -4
- package/{streamAgentChatTurn-IEKPNM33.js → streamAgentChatTurn-Y6WGATQR.js} +23 -21
- package/{tools-E6FHKTCF.js → tools-PUNBY3AH.js} +9 -9
- package/{tuiSummaryLlmCaller-QHPDD4WP.js → tuiSummaryLlmCaller-F64WLSAF.js} +3 -4
- package/{updateDialogTitleAction-SQJEEW2K.js → updateDialogTitleAction-YSR4TCMB.js} +4 -4
- package/appDeleteCommands-FRWMPQNS.js +0 -125
- package/appDeployCommands-IRF3T35Z.js +0 -164
- package/appDeployStatusCommands-ADFERYPU.js +0 -145
- package/appGetCommands-FTEOXWMS.js +0 -120
- package/appListCommands-WBY7UWYD.js +0 -123
- package/chunk-G63IH3ZK.js +0 -107
- package/chunk-GFUIQ4RY.js +0 -136
- package/chunk-KFEVY3ST.js +0 -255
- /package/{chunk-RK5NYQEL.js → chunk-XBS2WYJ2.js} +0 -0
|
@@ -18,17 +18,17 @@ import {
|
|
|
18
18
|
isBuiltinNoloAgentRef,
|
|
19
19
|
t,
|
|
20
20
|
toolLabel
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-DPAB4FQ7.js";
|
|
22
22
|
import {
|
|
23
23
|
getReadableCliDb
|
|
24
24
|
} from "./chunk-W4NVOSFF.js";
|
|
25
25
|
import {
|
|
26
26
|
readDbRecord,
|
|
27
27
|
resolveAgentRecordFromHybridStore
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PCTUYVUM.js";
|
|
29
29
|
import {
|
|
30
30
|
normalizeAgentHandle
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-M43KDE25.js";
|
|
32
32
|
import {
|
|
33
33
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
34
34
|
isLocalCliAgentKey
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
isAgentNameFallback,
|
|
48
48
|
isAgentRunTerminalStatus,
|
|
49
49
|
resolveRunLabel
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-ZQBL7LIC.js";
|
|
51
51
|
import {
|
|
52
52
|
isGatewayHttpStatus
|
|
53
53
|
} from "./chunk-RQSOAMPJ.js";
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
chooseMemoryOwners,
|
|
57
57
|
loadMemoryCandidatesFromDb,
|
|
58
58
|
resolveAgentMemoryPolicy
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-Z5JQNBNY.js";
|
|
60
60
|
import {
|
|
61
61
|
parseExternalSkillMarkdown,
|
|
62
62
|
parseSkillDocProtocol
|
|
@@ -65,14 +65,14 @@ import {
|
|
|
65
65
|
API_REPORTED_COST_MULTIPLIER,
|
|
66
66
|
normalizeUsage,
|
|
67
67
|
parseUiAskChoiceContent
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-NSCHQQPU.js";
|
|
69
69
|
import {
|
|
70
70
|
buildSkillDiscoveryContextBlock
|
|
71
71
|
} from "./chunk-AS3ZQ3O2.js";
|
|
72
72
|
import {
|
|
73
73
|
buildPlatformChatCompletionRequest,
|
|
74
74
|
parsePlatformChatCompletionData
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-AVVZUXXC.js";
|
|
76
76
|
import {
|
|
77
77
|
resolveAgentRuntimeConfigFromRecord
|
|
78
78
|
} from "./chunk-OIQPORYI.js";
|
|
@@ -81,20 +81,15 @@ import {
|
|
|
81
81
|
LOCAL_TURN_ABORTED_CODE,
|
|
82
82
|
readActionGate,
|
|
83
83
|
readCommandActionGatePayload
|
|
84
|
-
} from "./chunk-
|
|
85
|
-
import {
|
|
86
|
-
createThinkParserState,
|
|
87
|
-
flushThinkParser,
|
|
88
|
-
processThinkChunk
|
|
89
|
-
} from "./chunk-LSFAWXKC.js";
|
|
84
|
+
} from "./chunk-GSINCD4P.js";
|
|
90
85
|
import {
|
|
91
86
|
resolvePlatformAuthToken,
|
|
92
87
|
resolvePlatformChatCompletionsEndpoint
|
|
93
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-6EVITP2G.js";
|
|
94
89
|
import {
|
|
95
90
|
DEFAULT_CONTEXT_WINDOW,
|
|
96
91
|
getModelContextWindow
|
|
97
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-4L2OJPCU.js";
|
|
98
93
|
import {
|
|
99
94
|
clipCompactText
|
|
100
95
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -1611,8 +1606,161 @@ function createRenderAwareStreamWriter(args) {
|
|
|
1611
1606
|
}
|
|
1612
1607
|
};
|
|
1613
1608
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1609
|
+
|
|
1610
|
+
// packages/cli/client/thinkingOutput.ts
|
|
1611
|
+
var THINK_OPEN = /<think>/i;
|
|
1612
|
+
var THINK_CLOSE = /<\/think>/i;
|
|
1613
|
+
var COLLAPSED_MARKER = /^\s*▸ 思考已折叠\s*$/;
|
|
1614
|
+
function normalizeThinkingDisplayMode(raw, fallback = "hide") {
|
|
1615
|
+
const normalized = asTrimmedLowercaseString(raw);
|
|
1616
|
+
if (normalized === "hide" || normalized === "off" || normalized === "false" || normalized === "0") {
|
|
1617
|
+
return "hide";
|
|
1618
|
+
}
|
|
1619
|
+
if (normalized === "marker" || normalized === "collapsed" || normalized === "fold") {
|
|
1620
|
+
return "marker";
|
|
1621
|
+
}
|
|
1622
|
+
if (normalized === "show" || normalized === "on" || normalized === "true" || normalized === "1") {
|
|
1623
|
+
return "show";
|
|
1624
|
+
}
|
|
1625
|
+
return fallback;
|
|
1626
|
+
}
|
|
1627
|
+
function resolveThinkingDisplayMode(env = process.env) {
|
|
1628
|
+
return normalizeThinkingDisplayMode(env.NOLO_CLI_THINKING ?? env.NOLO_THINKING, "hide");
|
|
1629
|
+
}
|
|
1630
|
+
function collapseThinkingBlocks(text, mode = "hide") {
|
|
1631
|
+
if (mode === "show") return text;
|
|
1632
|
+
const replacement = mode === "marker" ? "\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n" : "";
|
|
1633
|
+
return text.replace(/<think>[\s\S]*?<\/think>\s*/gi, replacement).replace(/\n{3,}/g, "\n\n").trim();
|
|
1634
|
+
}
|
|
1635
|
+
function stripCollapsedThinkingMarkers(text) {
|
|
1636
|
+
return text.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n").replace(/\n{2,}/g, "\n").trim();
|
|
1637
|
+
}
|
|
1638
|
+
function formatAssistantTextForCli(text, mode = "hide") {
|
|
1639
|
+
const collapsed = collapseThinkingBlocks(text, mode);
|
|
1640
|
+
return mode === "hide" ? stripCollapsedThinkingMarkers(collapsed) : collapsed;
|
|
1641
|
+
}
|
|
1642
|
+
function createThinkingEventSink(arg1, arg2) {
|
|
1643
|
+
let mode = "hide";
|
|
1644
|
+
let write = () => {
|
|
1645
|
+
};
|
|
1646
|
+
if (typeof arg1 === "function") {
|
|
1647
|
+
write = arg1;
|
|
1648
|
+
if (typeof arg2 === "string") {
|
|
1649
|
+
mode = arg2;
|
|
1650
|
+
}
|
|
1651
|
+
} else {
|
|
1652
|
+
mode = arg1;
|
|
1653
|
+
if (typeof arg2 === "function") {
|
|
1654
|
+
write = arg2;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (mode === "hide") {
|
|
1658
|
+
return {
|
|
1659
|
+
push(_chunk) {
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
if (mode === "show") {
|
|
1664
|
+
return {
|
|
1665
|
+
push(chunk) {
|
|
1666
|
+
if (chunk) write(chunk);
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1670
|
+
let markerEmitted = false;
|
|
1671
|
+
return {
|
|
1672
|
+
push(chunk) {
|
|
1673
|
+
if (!chunk || markerEmitted) return;
|
|
1674
|
+
write("\n\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n");
|
|
1675
|
+
markerEmitted = true;
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
function createThinkingAwareStreamFilter(write, mode = "hide") {
|
|
1680
|
+
if (mode === "show") {
|
|
1681
|
+
return {
|
|
1682
|
+
push(chunk) {
|
|
1683
|
+
write(chunk);
|
|
1684
|
+
},
|
|
1685
|
+
flush() {
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
let pending = "";
|
|
1690
|
+
let insideThink = false;
|
|
1691
|
+
let markerEmitted = false;
|
|
1692
|
+
const emit = (chunk) => {
|
|
1693
|
+
if (chunk) write(chunk);
|
|
1694
|
+
};
|
|
1695
|
+
const emitMarker = () => {
|
|
1696
|
+
if (mode !== "marker" || markerEmitted) return;
|
|
1697
|
+
emit("\n\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n");
|
|
1698
|
+
markerEmitted = true;
|
|
1699
|
+
};
|
|
1700
|
+
const consume = (input) => {
|
|
1701
|
+
pending += input;
|
|
1702
|
+
while (pending.length > 0) {
|
|
1703
|
+
if (insideThink) {
|
|
1704
|
+
const closeMatch = pending.match(THINK_CLOSE);
|
|
1705
|
+
if (!closeMatch || closeMatch.index == null) {
|
|
1706
|
+
emitMarker();
|
|
1707
|
+
pending = "";
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
emitMarker();
|
|
1711
|
+
pending = pending.slice(closeMatch.index + closeMatch[0].length);
|
|
1712
|
+
insideThink = false;
|
|
1713
|
+
markerEmitted = false;
|
|
1714
|
+
continue;
|
|
1715
|
+
}
|
|
1716
|
+
const openMatch = pending.match(THINK_OPEN);
|
|
1717
|
+
if (!openMatch || openMatch.index == null) {
|
|
1718
|
+
const nextMarker = pending.indexOf("<");
|
|
1719
|
+
if (nextMarker === -1) {
|
|
1720
|
+
const cleaned = mode === "hide" ? pending.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : pending;
|
|
1721
|
+
emit(cleaned);
|
|
1722
|
+
pending = "";
|
|
1723
|
+
return;
|
|
1724
|
+
}
|
|
1725
|
+
if (nextMarker > 0) {
|
|
1726
|
+
const head = pending.slice(0, nextMarker);
|
|
1727
|
+
const cleaned = mode === "hide" ? head.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : head;
|
|
1728
|
+
emit(cleaned);
|
|
1729
|
+
pending = pending.slice(nextMarker);
|
|
1730
|
+
continue;
|
|
1731
|
+
}
|
|
1732
|
+
if (pending.length < 7) return;
|
|
1733
|
+
emit(pending[0]);
|
|
1734
|
+
pending = pending.slice(1);
|
|
1735
|
+
continue;
|
|
1736
|
+
}
|
|
1737
|
+
if (openMatch.index > 0) {
|
|
1738
|
+
const head = pending.slice(0, openMatch.index);
|
|
1739
|
+
const cleaned = mode === "hide" ? head.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : head;
|
|
1740
|
+
emit(cleaned);
|
|
1741
|
+
pending = pending.slice(openMatch.index);
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
pending = pending.slice(openMatch[0].length);
|
|
1745
|
+
insideThink = true;
|
|
1746
|
+
markerEmitted = false;
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
return {
|
|
1750
|
+
push(chunk) {
|
|
1751
|
+
consume(chunk);
|
|
1752
|
+
},
|
|
1753
|
+
flush() {
|
|
1754
|
+
if (insideThink) emitMarker();
|
|
1755
|
+
if (pending) {
|
|
1756
|
+
const cleaned = mode === "hide" ? pending.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : pending;
|
|
1757
|
+
emit(cleaned);
|
|
1758
|
+
}
|
|
1759
|
+
pending = "";
|
|
1760
|
+
insideThink = false;
|
|
1761
|
+
markerEmitted = false;
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1616
1764
|
}
|
|
1617
1765
|
|
|
1618
1766
|
// packages/cli/client/formatReadPathTree.ts
|
|
@@ -2913,11 +3061,6 @@ function formatElapsed(totalSeconds) {
|
|
|
2913
3061
|
const mins = minutes % 60;
|
|
2914
3062
|
return `${hours}h ${mins}m`;
|
|
2915
3063
|
}
|
|
2916
|
-
function truncateThinkingHint(text, maxLen) {
|
|
2917
|
-
const cleaned = text.replace(/\n/g, " ").trim();
|
|
2918
|
-
if (cleaned.length <= maxLen) return cleaned;
|
|
2919
|
-
return "\u2026" + cleaned.slice(cleaned.length - maxLen + 1);
|
|
2920
|
-
}
|
|
2921
3064
|
var Spinner = class {
|
|
2922
3065
|
constructor(output, text, silent = false) {
|
|
2923
3066
|
this.output = output;
|
|
@@ -2931,7 +3074,6 @@ var Spinner = class {
|
|
|
2931
3074
|
frameIndex = 0;
|
|
2932
3075
|
frames = ["\xB7", "~", "\u2248", "\u223F", "\u2248", "~"];
|
|
2933
3076
|
isTTY;
|
|
2934
|
-
thinkingHint = "";
|
|
2935
3077
|
start() {
|
|
2936
3078
|
if (this.silent) {
|
|
2937
3079
|
this.startTime = Date.now();
|
|
@@ -2967,11 +3109,9 @@ ${this.text}
|
|
|
2967
3109
|
this.output.write("\r\x1B[K");
|
|
2968
3110
|
this.output.write("\x1B[?25h");
|
|
2969
3111
|
}
|
|
2970
|
-
this.thinkingHint = "";
|
|
2971
3112
|
}
|
|
2972
3113
|
show(text) {
|
|
2973
3114
|
this.text = text;
|
|
2974
|
-
this.thinkingHint = "";
|
|
2975
3115
|
if (this.silent) {
|
|
2976
3116
|
if (!this.startTime) {
|
|
2977
3117
|
this.startTime = Date.now();
|
|
@@ -2987,30 +3127,20 @@ ${this.text}
|
|
|
2987
3127
|
this.startTime = Date.now();
|
|
2988
3128
|
this.output.write(`\r${this.renderLine(this.frames[0])}`);
|
|
2989
3129
|
}
|
|
2990
|
-
/**
|
|
2991
|
-
* Update the thinking hint displayed on the spinner line. The hint is
|
|
2992
|
-
* truncated to a reasonable length and shown as part of the spinner text.
|
|
2993
|
-
* Only meaningful while the spinner is active (TTY mode).
|
|
2994
|
-
*/
|
|
2995
|
-
setThinkingHint(text) {
|
|
2996
|
-
this.thinkingHint = text;
|
|
2997
|
-
if (this.silent || !this.isTTY || !this.timer) return;
|
|
2998
|
-
this.output.write(`\r${this.renderLine(this.frames[this.frameIndex])}`);
|
|
2999
|
-
}
|
|
3000
3130
|
renderLine(frame) {
|
|
3001
3131
|
const elapsedSeconds = Math.max(
|
|
3002
3132
|
0,
|
|
3003
3133
|
Math.floor((Date.now() - this.startTime) / 1e3)
|
|
3004
3134
|
);
|
|
3005
|
-
|
|
3006
|
-
return `${themeColorSequence("accent")}${frame}\x1B[39m ${this.text}${thinkingPart} (${formatElapsed(elapsedSeconds)})`;
|
|
3135
|
+
return `${themeColorSequence("accent")}${frame}\x1B[39m ${this.text} (${formatElapsed(elapsedSeconds)})`;
|
|
3007
3136
|
}
|
|
3008
3137
|
};
|
|
3009
3138
|
|
|
3010
3139
|
// packages/cli/client/agentRunOutput.ts
|
|
3011
|
-
function formatAssistantResponseForCli(text) {
|
|
3140
|
+
function formatAssistantResponseForCli(text, options) {
|
|
3141
|
+
const thinkingMode = resolveThinkingDisplayMode(options.env);
|
|
3012
3142
|
return formatAssistantDisplay(
|
|
3013
|
-
formatAssistantTextForCli(text)
|
|
3143
|
+
formatAssistantTextForCli(text, thinkingMode)
|
|
3014
3144
|
);
|
|
3015
3145
|
}
|
|
3016
3146
|
function resolveAgentEventMode(options) {
|
|
@@ -3043,19 +3173,12 @@ function createCliTurnOutput(params) {
|
|
|
3043
3173
|
let streamedAssistantText = false;
|
|
3044
3174
|
let everStreamedAnyText = false;
|
|
3045
3175
|
let printedAssistantLabel = false;
|
|
3046
|
-
|
|
3176
|
+
const thinkingMode = resolveThinkingDisplayMode(options.env);
|
|
3047
3177
|
const renderWriter = createRenderAwareStreamWriter({
|
|
3048
3178
|
write: (chunk) => options.output.write(chunk)
|
|
3049
3179
|
});
|
|
3050
3180
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
3051
3181
|
if (!chunk) return;
|
|
3052
|
-
const parsed = processThinkChunk(chunk, thinkState);
|
|
3053
|
-
thinkState = parsed.state;
|
|
3054
|
-
if (!parsed.content && !parsed.reasoning) return;
|
|
3055
|
-
if (parsed.reasoning) {
|
|
3056
|
-
spinner.setThinkingHint(parsed.reasoning);
|
|
3057
|
-
}
|
|
3058
|
-
if (!parsed.content) return;
|
|
3059
3182
|
spinner.stop();
|
|
3060
3183
|
options.activityReporter?.(null);
|
|
3061
3184
|
if (!printedAssistantLabel) {
|
|
@@ -3065,8 +3188,17 @@ ${options.agentName} > `);
|
|
|
3065
3188
|
}
|
|
3066
3189
|
streamedAssistantText = true;
|
|
3067
3190
|
everStreamedAnyText = true;
|
|
3068
|
-
renderWriter.push(
|
|
3191
|
+
renderWriter.push(chunk);
|
|
3069
3192
|
};
|
|
3193
|
+
const thinkingFilter = createThinkingAwareStreamFilter(
|
|
3194
|
+
writeVisibleAssistantChunk,
|
|
3195
|
+
thinkingMode
|
|
3196
|
+
);
|
|
3197
|
+
const thinkingSink = createThinkingEventSink((chunk) => {
|
|
3198
|
+
spinner.stop();
|
|
3199
|
+
options.activityReporter?.(null);
|
|
3200
|
+
options.output.write(chunk);
|
|
3201
|
+
}, thinkingMode);
|
|
3070
3202
|
const handleToolEvent = (event) => {
|
|
3071
3203
|
if (!traceLocalTools) return;
|
|
3072
3204
|
const chunk = eventMode === "jsonl" ? formatToolJsonEvent(event) : formatToolEvent(event);
|
|
@@ -3075,6 +3207,7 @@ ${options.agentName} > `);
|
|
|
3075
3207
|
return;
|
|
3076
3208
|
}
|
|
3077
3209
|
if (event.type === "tool-call") {
|
|
3210
|
+
thinkingFilter.flush();
|
|
3078
3211
|
renderWriter.flush();
|
|
3079
3212
|
}
|
|
3080
3213
|
spinner.stop();
|
|
@@ -3100,6 +3233,7 @@ ${options.agentName} > `);
|
|
|
3100
3233
|
};
|
|
3101
3234
|
return {
|
|
3102
3235
|
spinner,
|
|
3236
|
+
thinkingMode,
|
|
3103
3237
|
toolDisplayMode,
|
|
3104
3238
|
traceLocalTools,
|
|
3105
3239
|
eventMode,
|
|
@@ -3110,10 +3244,10 @@ ${options.agentName} > `);
|
|
|
3110
3244
|
options.output.write(pendingToolOutput);
|
|
3111
3245
|
}
|
|
3112
3246
|
}
|
|
3113
|
-
|
|
3247
|
+
thinkingFilter.push(chunk);
|
|
3114
3248
|
},
|
|
3115
3249
|
pushThinking(chunk) {
|
|
3116
|
-
|
|
3250
|
+
thinkingSink.push(chunk);
|
|
3117
3251
|
},
|
|
3118
3252
|
handleToolEvent,
|
|
3119
3253
|
showWorking(label) {
|
|
@@ -3124,22 +3258,19 @@ ${options.agentName} > `);
|
|
|
3124
3258
|
finish(fallbackContent) {
|
|
3125
3259
|
spinner.stop();
|
|
3126
3260
|
options.activityReporter?.(null);
|
|
3127
|
-
const flushedThink = flushThinkParser(thinkState);
|
|
3128
|
-
thinkState = flushedThink.state;
|
|
3129
|
-
if (flushedThink.content) {
|
|
3130
|
-
writeVisibleAssistantChunk(flushedThink.content);
|
|
3131
|
-
}
|
|
3132
3261
|
const pendingToolOutput = formatToolEvent.flush ? formatToolEvent.flush() : "";
|
|
3133
3262
|
if (pendingToolOutput) {
|
|
3134
3263
|
options.output.write(pendingToolOutput);
|
|
3135
3264
|
}
|
|
3136
3265
|
if (streamedAssistantText) {
|
|
3266
|
+
thinkingFilter.flush();
|
|
3137
3267
|
renderWriter.flush();
|
|
3138
3268
|
options.output.write("\n");
|
|
3139
3269
|
} else if (everStreamedAnyText) {
|
|
3270
|
+
thinkingFilter.flush();
|
|
3140
3271
|
options.output.write("\n");
|
|
3141
3272
|
} else {
|
|
3142
|
-
const content = fallbackContent ? formatAssistantResponseForCli(fallbackContent.trim()) : "";
|
|
3273
|
+
const content = fallbackContent ? formatAssistantResponseForCli(fallbackContent.trim(), options) : "";
|
|
3143
3274
|
if (content) {
|
|
3144
3275
|
options.output.write(`
|
|
3145
3276
|
${options.agentName} > ${content}
|
|
@@ -3564,7 +3695,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3564
3695
|
// packages/cli/client/agentRun.ts
|
|
3565
3696
|
import { ulid } from "ulid";
|
|
3566
3697
|
async function loadRunLocalAgentTurn() {
|
|
3567
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3698
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-QNPNJRVH.js");
|
|
3568
3699
|
return runLocalAgentTurn;
|
|
3569
3700
|
}
|
|
3570
3701
|
async function resolveCurrentMachineId(options) {
|
|
@@ -3841,6 +3972,7 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
3841
3972
|
...options.inheritedFromDialogKey ? { inheritedFromDialogKey: options.inheritedFromDialogKey } : {},
|
|
3842
3973
|
...options.parentDialogId ? { parentDialogId: options.parentDialogId } : {},
|
|
3843
3974
|
...options.background ? { background: true } : {},
|
|
3975
|
+
...options.ephemeral ? { ephemeral: true } : {},
|
|
3844
3976
|
...typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {},
|
|
3845
3977
|
...options.modelOverride ? { runtimeOptions: { quickChatModelOverride: options.modelOverride } } : {},
|
|
3846
3978
|
...serverContextBlockScopes ? { contextBlockScopes: serverContextBlockScopes } : {},
|
|
@@ -3931,7 +4063,8 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
3931
4063
|
return dialogIdText ? { exitCode: 1, dialogId: dialogIdText } : { exitCode: 1 };
|
|
3932
4064
|
}
|
|
3933
4065
|
const content = formatAssistantResponseForCli(
|
|
3934
|
-
String(data?.content ?? data?.message ?? "")
|
|
4066
|
+
String(data?.content ?? data?.message ?? ""),
|
|
4067
|
+
options
|
|
3935
4068
|
);
|
|
3936
4069
|
if (content) {
|
|
3937
4070
|
options.output.write(`
|
|
@@ -4000,7 +4133,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
4000
4133
|
} : void 0;
|
|
4001
4134
|
const currentDialogId = options.continueDialogId ?? ulid();
|
|
4002
4135
|
const runChildTurn = async (input) => {
|
|
4003
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
4136
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-QNPNJRVH.js");
|
|
4004
4137
|
return runLocalAgentTurn(input);
|
|
4005
4138
|
};
|
|
4006
4139
|
const createFreshChildBaseAdapter = () => {
|
|
@@ -4202,11 +4335,6 @@ async function runAgentTurn(options) {
|
|
|
4202
4335
|
);
|
|
4203
4336
|
return { exitCode: 1 };
|
|
4204
4337
|
}
|
|
4205
|
-
if (options.ephemeral) {
|
|
4206
|
-
options.output.write(
|
|
4207
|
-
"[nolo] --ephemeral/--memory-only is only effective with the local runtime (--local); the server stores dialogs on its own and cannot run memory-only.\n"
|
|
4208
|
-
);
|
|
4209
|
-
}
|
|
4210
4338
|
return runHttpAgentTurn(options, authToken);
|
|
4211
4339
|
}
|
|
4212
4340
|
|
|
@@ -5355,6 +5483,7 @@ export {
|
|
|
5355
5483
|
themeColorSequence,
|
|
5356
5484
|
themeText,
|
|
5357
5485
|
formatAssistantDisplay,
|
|
5486
|
+
normalizeThinkingDisplayMode,
|
|
5358
5487
|
normalizeToolDisplayMode,
|
|
5359
5488
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
5360
5489
|
shouldCollapsePaste,
|
|
@@ -2,28 +2,24 @@ import {
|
|
|
2
2
|
accumulateToolCallDelta,
|
|
3
3
|
extractThinkContent,
|
|
4
4
|
flushThinkParser,
|
|
5
|
-
flushToolCallTextParserIntoCallback,
|
|
6
|
-
processContentChunkWithToolCallStripping,
|
|
7
5
|
processThinkChunk
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3WGLLTK4.js";
|
|
9
7
|
import {
|
|
8
|
+
buildProviderExecutionPlan,
|
|
9
|
+
canUsePlatformChatProvider,
|
|
10
10
|
convertMessagesToResponsesInput,
|
|
11
11
|
extractTextFromResponseOutput,
|
|
12
12
|
extractToolCallsFromResponseOutput,
|
|
13
|
-
hasImageParts,
|
|
14
|
-
shouldStripReasoningContentForOutbound,
|
|
15
|
-
toOpenAiCompatibleMessages,
|
|
16
|
-
toResponsesTools
|
|
17
|
-
} from "./chunk-KFEVY3ST.js";
|
|
18
|
-
import {
|
|
19
|
-
buildProviderExecutionPlan,
|
|
20
|
-
canUsePlatformChatProvider,
|
|
21
13
|
hasDirectOpenAiCompatibleProvider,
|
|
14
|
+
hasImageParts,
|
|
22
15
|
resolveAgentRuntimeLocation,
|
|
23
16
|
resolvePlatformAuthToken,
|
|
24
17
|
resolvePlatformServerUrl,
|
|
25
|
-
resolveProviderTransportDecision
|
|
26
|
-
|
|
18
|
+
resolveProviderTransportDecision,
|
|
19
|
+
shouldStripReasoningContentForOutbound,
|
|
20
|
+
toOpenAiCompatibleMessages,
|
|
21
|
+
toResponsesTools
|
|
22
|
+
} from "./chunk-6EVITP2G.js";
|
|
27
23
|
import {
|
|
28
24
|
clipCompactText
|
|
29
25
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -108,16 +104,7 @@ function applyChatCompletionDelta(parsed, state) {
|
|
|
108
104
|
}
|
|
109
105
|
const textChunk = typeof delta.content === "string" ? delta.content : "";
|
|
110
106
|
if (textChunk) {
|
|
111
|
-
const
|
|
112
|
-
textChunk,
|
|
113
|
-
state.toolCallTextState,
|
|
114
|
-
(name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
|
|
115
|
-
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
116
|
-
])
|
|
117
|
-
);
|
|
118
|
-
state.toolCallTextState = newState;
|
|
119
|
-
if (!cleanedContent) return true;
|
|
120
|
-
const parsedChunk = processThinkChunk(cleanedContent, state.thinkState);
|
|
107
|
+
const parsedChunk = processThinkChunk(textChunk, state.thinkState);
|
|
121
108
|
state.thinkState = parsedChunk.state;
|
|
122
109
|
if (parsedChunk.content) {
|
|
123
110
|
state.content += parsedChunk.content;
|
|
@@ -131,19 +118,11 @@ function applyChatCompletionDelta(parsed, state) {
|
|
|
131
118
|
return true;
|
|
132
119
|
}
|
|
133
120
|
function flushChatCompletionStream(state) {
|
|
134
|
-
const { residualContent, state: tcState } = flushToolCallTextParserIntoCallback(
|
|
135
|
-
state.toolCallTextState,
|
|
136
|
-
(name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
|
|
137
|
-
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
138
|
-
])
|
|
139
|
-
);
|
|
140
|
-
state.toolCallTextState = tcState;
|
|
141
121
|
const flushed = flushThinkParser(state.thinkState);
|
|
142
122
|
state.thinkState = flushed.state;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
state.content
|
|
146
|
-
state.onTextDelta?.(combinedContent);
|
|
123
|
+
if (flushed.content) {
|
|
124
|
+
state.content += flushed.content;
|
|
125
|
+
state.onTextDelta?.(flushed.content);
|
|
147
126
|
}
|
|
148
127
|
if (flushed.reasoning) {
|
|
149
128
|
state.reasoning += flushed.reasoning;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NVEWUJVX.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PCTUYVUM.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3OIRVWXA.js";
|
|
11
11
|
|
|
12
12
|
// packages/cli/agentListHelpers.ts
|
|
13
13
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DPAB4FQ7.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZQBL7LIC.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GSINCD4P.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
13
|
} from "./chunk-5CS33IBL.js";
|