nolo-cli 0.14.0 → 0.15.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-TURRLTZ2.js → _executeModel-QAUS6B7J.js} +24 -24
- package/{action-N3KXFO5V.js → action-GUOZYYGN.js} +4 -4
- package/{addContentAction-4Z762DMR.js → addContentAction-QDGHGUBH.js} +3 -3
- package/{addDialogAgentAction-FALLEKPR.js → addDialogAgentAction-Z4YCYZIV.js} +2 -2
- package/{agentDeleteCommand-AZDVM4HQ.js → agentDeleteCommand-QDO62EZA.js} +20 -20
- package/{agentEmailCommands-M4AHOEZ3.js → agentEmailCommands-UZ5BKX3P.js} +38 -38
- package/{agentGrantCommands-B4MB23VQ.js → agentGrantCommands-JNDE4RWR.js} +2 -2
- package/{agentListCommands-OJLOXSKL.js → agentListCommands-ZC33UDWT.js} +22 -22
- package/{agentMachineCommands-NPMM4Z53.js → agentMachineCommands-RZGZEZRL.js} +20 -20
- package/{agentPullCommand-KRBRIFIY.js → agentPullCommand-6HWUT3SW.js} +2 -2
- package/{agentRecordCommands-RVUH7XLZ.js → agentRecordCommands-DGDXE2VH.js} +33 -33
- package/{agentRunCommand-F6W2WKKZ.js → agentRunCommand-SRZWFOPH.js} +35 -35
- package/{agentRunControl-IX4F5W2C.js → agentRunControl-6ADXVYMR.js} +2 -2
- package/{agentRuntimeLocal-DSUBT77I.js → agentRuntimeLocal-4YCF6IRF.js} +11 -11
- package/{agentSlice-PCEL26Z7.js → agentSlice-IVE735EV.js} +3 -3
- package/appDeleteCommands-7I26L64I.js +124 -0
- package/appDeployCommands-TZLZNTJN.js +163 -0
- package/appDeployStatusCommands-OPPTLHRW.js +144 -0
- package/appGetCommands-N2S4HYKY.js +119 -0
- package/appListCommands-OBTPPKUM.js +122 -0
- package/{authCommand-66ME4KZX.js → authCommand-YFTR3347.js} +5 -5
- package/{authCommands-GH5T6RYV.js → authCommands-YXGOXNBZ.js} +3 -3
- package/{chunk-3B2LFO6R.js → browser-image-compression-MFDTD7K6.js} +4 -518
- package/{chunk-4UUJFFMK.js → chunk-472E5RMQ.js} +1 -1
- package/chunk-4QQFLN5C.js +552 -0
- package/{chunk-33K5FKRL.js → chunk-5VMYGIIL.js} +110 -39
- package/{chunk-LNSRTNH7.js → chunk-6565R2TI.js} +20 -16
- package/{chunk-VQFY3VXW.js → chunk-6MHDWKOT.js} +3 -2
- package/{chunk-5NBHQD4D.js → chunk-A7GB5UGH.js} +1 -1
- package/{chunk-NZFWHBW5.js → chunk-AWDOJBHW.js} +487 -441
- package/{chunk-MYE5X27Y.js → chunk-BFRVXJJJ.js} +43 -16
- package/{chunk-PYAJ6ZSK.js → chunk-G2MKOQCB.js} +1 -1
- package/chunk-GFUIQ4RY.js +136 -0
- package/{chunk-KTFJUPDW.js → chunk-HRQCKQA5.js} +31 -31
- package/{chunk-TQCONXQ3.js → chunk-IOQ7IBPU.js} +1 -1
- package/{chunk-OIMX7MM4.js → chunk-ISYE6GZB.js} +1 -1
- package/{chunk-RZALKBP4.js → chunk-IZ2QRVEU.js} +2 -2
- package/{chunk-XIDYAII4.js → chunk-JBKVPAYK.js} +7 -140
- package/{chunk-V6VXDXGY.js → chunk-JS33TCQ3.js} +2 -2
- package/{chunk-5R73BS7Y.js → chunk-K53477EY.js} +5 -5
- package/{chunk-7JJCGV7N.js → chunk-K6EUAOW3.js} +1 -1
- package/{chunk-OHEKYYJF.js → chunk-KMQPSTMJ.js} +6 -6
- package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
- package/{chunk-4ON5AV72.js → chunk-MYMMNKYL.js} +1 -1
- package/{chunk-BHK5ZAW7.js → chunk-N5424GSW.js} +1 -1
- package/chunk-NTC6I2FN.js +107 -0
- package/{chunk-7LAIOHOL.js → chunk-O53CP2QR.js} +3 -3
- package/{chunk-TLNEQI2R.js → chunk-OKSYPTDZ.js} +9 -9
- package/{chunk-IMZ7AFIJ.js → chunk-OQMPU2ML.js} +4 -4
- package/{chunk-IYGQF62W.js → chunk-P4MJQWWF.js} +3 -3
- package/{chunk-UW3WOIWJ.js → chunk-RKM3K52F.js} +1 -1
- package/{chunk-A5V7UEZJ.js → chunk-SFXYKGK2.js} +3 -3
- package/{chunk-S5UACFUP.js → chunk-TTGAVETO.js} +10 -2
- package/{chunk-BOJVWKNA.js → chunk-U7LEGLEB.js} +1 -1
- package/{chunk-E6KIDMTW.js → chunk-UXKQQ2MR.js} +9 -9
- package/{chunk-R5AOLZZV.js → chunk-VE6XMVKG.js} +203 -45
- package/{chunk-NJVPXLRY.js → chunk-VPTJB4HM.js} +1 -1
- package/{chunk-PB2DHBEQ.js → chunk-WA6KZL5V.js} +25 -6
- package/{chunk-T3X232L6.js → chunk-WNLPAOIT.js} +1 -1
- package/{chunk-NFPO7274.js → chunk-WRN5EQT7.js} +1 -1
- package/{chunk-4F4FJPFM.js → chunk-XGQZFBO5.js} +90 -209
- package/{chunk-3FCSMQAC.js → chunk-XVP3C2KY.js} +1 -1
- package/{chunk-TYRTLSGX.js → chunk-YNHQIXX5.js} +833 -5746
- package/{chunk-7TN6V43T.js → chunk-Z24FGIU2.js} +2 -2
- package/{cliEnvHelpers-VYC2OPTB.js → cliEnvHelpers-ZXNMX7VV.js} +1 -1
- package/{createAgentAutomationAction-VLNDOHSP.js → createAgentAutomationAction-TS6NNZ4X.js} +9 -9
- package/{createDialogAction-6WYTS62Z.js → createDialogAction-5HVQ33EX.js} +10 -10
- package/{createPageAction-YKHOC3LW.js → createPageAction-4F3ZGQJD.js} +9 -9
- package/{dbSlice-7Q23HSWH.js → dbSlice-OP6UPXKA.js} +2 -2
- package/{dialogCommands-BQDGLVMO.js → dialogCommands-3GEPXHFB.js} +16 -16
- package/{dialogSlice-2A2JOFZW.js → dialogSlice-FAWUQDJW.js} +9 -9
- package/{docCreateCommands-K2MPMXYF.js → docCreateCommands-ZE3S6BCP.js} +22 -20
- package/{docDeleteCommands-NBAARB77.js → docDeleteCommands-TW6PGTRT.js} +21 -19
- package/{docReadCommands-S3MO5RPS.js → docReadCommands-LDXL3B6J.js} +20 -18
- package/{docStore-JJP5PUR7.js → docStore-2UHVWLTV.js} +10 -10
- package/{docUpdateCommands-EHEI7FCE.js → docUpdateCommands-GYD6XI5O.js} +21 -19
- package/{handleSendMessageAction-UAXTF73I.js → handleSendMessageAction-LJPUYNOH.js} +15 -11
- package/index.js +109 -78
- package/{machineCommands-BQ46IS5M.js → machineCommands-OKNDYS3M.js} +36 -36
- package/{machineWsRunDispatch-R33NXNNI.js → machineWsRunDispatch-ZX5AJ6FJ.js} +32 -32
- package/{memoryCommands-AFMES3LN.js → memoryCommands-EBMICQR6.js} +1 -1
- package/package.json +1 -1
- package/{read-SIWMJRHC.js → read-HXHAZBKH.js} +1 -1
- package/{readDocTool-TCYJY4PP.js → readDocTool-VPBDTO4G.js} +1 -1
- package/{readlineWorkspace-KBG4DKLX.js → readlineWorkspace-MB3ANKHM.js} +123 -103
- package/{removeDialogAgentAction-WKHZT6VJ.js → removeDialogAgentAction-HUFVN35S.js} +4 -4
- package/{runAgentClientLoop-MUV5YIRK.js → runAgentClientLoop-A75BUU6D.js} +19 -19
- package/{runtimeDoctorCommands-QNF3J3UV.js → runtimeDoctorCommands-THIHX2SY.js} +1 -1
- package/{setDialogExtraReferencesAction-GCI5QU6E.js → setDialogExtraReferencesAction-2VLGWQKG.js} +2 -2
- package/{setPrimaryDialogAgentAction-NRO57AS6.js → setPrimaryDialogAgentAction-VB4UV2CC.js} +4 -4
- package/{settingSlice-FTWZ5ZHT.js → settingSlice-7JYPQNAC.js} +3 -3
- package/{spaceCommands-4R63UST3.js → spaceCommands-O3KJNCON.js} +21 -21
- package/{spaceSlice-VTC3QXP3.js → spaceSlice-444MFUP6.js} +11 -9
- package/{streamAgentChatTurn-43N7BNV2.js → streamAgentChatTurn-DJAE7USZ.js} +42 -39
- package/{tableCommands-E4SQWDOX.js → tableCommands-3P7MJ3PF.js} +4 -4
- package/{tools-PX6PEJLE.js → tools-YB6LXSVN.js} +14 -14
- package/{tuiSummaryLlmCaller-2D65LKWM.js → tuiSummaryLlmCaller-QQL3JA5I.js} +3 -3
- package/{updateCommands-XZDOOYFH.js → updateCommands-XTW55TOT.js} +2 -2
- package/{updateDialogTitleAction-NPQZWAKG.js → updateDialogTitleAction-6HGFBM64.js} +9 -9
- package/{chunk-3QAF2LTL.js → chunk-DZ3XJVET.js} +3 -3
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveMachineId
|
|
3
|
-
} from "./chunk-6HYVJV7B.js";
|
|
4
1
|
import {
|
|
5
2
|
buildLocalRunEnv,
|
|
6
3
|
isFullstackCodingAgentRef,
|
|
@@ -9,7 +6,10 @@ import {
|
|
|
9
6
|
resolveRawAgentInput,
|
|
10
7
|
resolveServerUrl,
|
|
11
8
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DZ3XJVET.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveMachineId
|
|
12
|
+
} from "./chunk-6HYVJV7B.js";
|
|
13
13
|
import {
|
|
14
14
|
agentRunCardLabels,
|
|
15
15
|
createCliCallAgentToolExecutor,
|
|
@@ -18,20 +18,17 @@ import {
|
|
|
18
18
|
isBuiltinNoloAgentRef,
|
|
19
19
|
t,
|
|
20
20
|
toolLabel
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import {
|
|
23
|
-
CliProviderQuotaError
|
|
24
|
-
} from "./chunk-CMKUBIGW.js";
|
|
21
|
+
} from "./chunk-AWDOJBHW.js";
|
|
25
22
|
import {
|
|
26
23
|
getReadableCliDb
|
|
27
24
|
} from "./chunk-W4NVOSFF.js";
|
|
28
25
|
import {
|
|
29
26
|
readDbRecord,
|
|
30
27
|
resolveAgentRecordFromHybridStore
|
|
31
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-K53477EY.js";
|
|
32
29
|
import {
|
|
33
30
|
normalizeAgentHandle
|
|
34
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-IOQ7IBPU.js";
|
|
35
32
|
import {
|
|
36
33
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
37
34
|
isLocalCliAgentKey
|
|
@@ -48,7 +45,7 @@ import {
|
|
|
48
45
|
formatStatusRunCard,
|
|
49
46
|
formatStopRunCard,
|
|
50
47
|
isAgentRunTerminalStatus
|
|
51
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-VE6XMVKG.js";
|
|
52
49
|
import {
|
|
53
50
|
isGatewayHttpStatus
|
|
54
51
|
} from "./chunk-RQSOAMPJ.js";
|
|
@@ -57,7 +54,7 @@ import {
|
|
|
57
54
|
chooseMemoryOwners,
|
|
58
55
|
loadMemoryCandidatesFromDb,
|
|
59
56
|
resolveAgentMemoryPolicy
|
|
60
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-Z24FGIU2.js";
|
|
61
58
|
import {
|
|
62
59
|
parseExternalSkillMarkdown,
|
|
63
60
|
parseSkillDocProtocol
|
|
@@ -66,14 +63,14 @@ import {
|
|
|
66
63
|
API_REPORTED_COST_MULTIPLIER,
|
|
67
64
|
normalizeUsage,
|
|
68
65
|
parseUiAskChoiceContent
|
|
69
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-YNHQIXX5.js";
|
|
70
67
|
import {
|
|
71
68
|
buildSkillDiscoveryContextBlock
|
|
72
69
|
} from "./chunk-AS3ZQ3O2.js";
|
|
73
70
|
import {
|
|
74
71
|
buildPlatformChatCompletionRequest,
|
|
75
72
|
parsePlatformChatCompletionData
|
|
76
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-WA6KZL5V.js";
|
|
77
74
|
import {
|
|
78
75
|
resolveAgentRuntimeConfigFromRecord
|
|
79
76
|
} from "./chunk-OIQPORYI.js";
|
|
@@ -82,14 +79,20 @@ import {
|
|
|
82
79
|
LOCAL_TURN_ABORTED_CODE,
|
|
83
80
|
readActionGate,
|
|
84
81
|
readCommandActionGatePayload
|
|
85
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-6MHDWKOT.js";
|
|
86
83
|
import {
|
|
84
|
+
createThinkParserState,
|
|
85
|
+
flushThinkParser,
|
|
86
|
+
processThinkChunk
|
|
87
|
+
} from "./chunk-LSFAWXKC.js";
|
|
88
|
+
import {
|
|
89
|
+
resolvePlatformAuthToken,
|
|
87
90
|
resolvePlatformChatCompletionsEndpoint
|
|
88
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-HRQCKQA5.js";
|
|
89
92
|
import {
|
|
90
93
|
DEFAULT_CONTEXT_WINDOW,
|
|
91
94
|
getModelContextWindow
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-4QQFLN5C.js";
|
|
93
96
|
import {
|
|
94
97
|
clipCompactText
|
|
95
98
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -107,7 +110,10 @@ import {
|
|
|
107
110
|
createRunActivityTracker,
|
|
108
111
|
finalizeRunRecord,
|
|
109
112
|
spawnLocalBackgroundRun
|
|
110
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-MYMMNKYL.js";
|
|
114
|
+
import {
|
|
115
|
+
CliProviderQuotaError
|
|
116
|
+
} from "./chunk-CMKUBIGW.js";
|
|
111
117
|
import {
|
|
112
118
|
toErrorMessage
|
|
113
119
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -118,6 +124,9 @@ import {
|
|
|
118
124
|
readPipeText,
|
|
119
125
|
spawnProcess
|
|
120
126
|
} from "./chunk-IDZTNRP2.js";
|
|
127
|
+
import {
|
|
128
|
+
resolveAuthToken
|
|
129
|
+
} from "./chunk-A7GB5UGH.js";
|
|
121
130
|
import {
|
|
122
131
|
parsePositiveFiniteNumberOrFallback
|
|
123
132
|
} from "./chunk-Y5GCAMGP.js";
|
|
@@ -131,13 +140,10 @@ import {
|
|
|
131
140
|
BUILTIN_NOLO_AGENT_KEY,
|
|
132
141
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
133
142
|
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
134
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-VPTJB4HM.js";
|
|
135
144
|
import {
|
|
136
145
|
asTrimmedString
|
|
137
146
|
} from "./chunk-3EUW3WEO.js";
|
|
138
|
-
import {
|
|
139
|
-
resolveAuthToken
|
|
140
|
-
} from "./chunk-5NBHQD4D.js";
|
|
141
147
|
import {
|
|
142
148
|
isLoopbackUrl
|
|
143
149
|
} from "./chunk-4SN6J65J.js";
|
|
@@ -1596,165 +1602,25 @@ function createRenderAwareStreamWriter(args) {
|
|
|
1596
1602
|
}
|
|
1597
1603
|
};
|
|
1598
1604
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
var THINK_OPEN = /<think>/i;
|
|
1602
|
-
var THINK_CLOSE = /<\/think>/i;
|
|
1603
|
-
var COLLAPSED_MARKER = /^\s*▸ 思考已折叠\s*$/;
|
|
1604
|
-
function normalizeThinkingDisplayMode(raw, fallback = "hide") {
|
|
1605
|
-
const normalized = asTrimmedLowercaseString(raw);
|
|
1606
|
-
if (normalized === "hide" || normalized === "off" || normalized === "false" || normalized === "0") {
|
|
1607
|
-
return "hide";
|
|
1608
|
-
}
|
|
1609
|
-
if (normalized === "marker" || normalized === "collapsed" || normalized === "fold") {
|
|
1610
|
-
return "marker";
|
|
1611
|
-
}
|
|
1612
|
-
if (normalized === "show" || normalized === "on" || normalized === "true" || normalized === "1") {
|
|
1613
|
-
return "show";
|
|
1614
|
-
}
|
|
1615
|
-
return fallback;
|
|
1616
|
-
}
|
|
1617
|
-
function resolveThinkingDisplayMode(env = process.env) {
|
|
1618
|
-
return normalizeThinkingDisplayMode(env.NOLO_CLI_THINKING ?? env.NOLO_THINKING, "hide");
|
|
1619
|
-
}
|
|
1620
|
-
function collapseThinkingBlocks(text, mode = "hide") {
|
|
1621
|
-
if (mode === "show") return text;
|
|
1622
|
-
const replacement = mode === "marker" ? "\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n" : "";
|
|
1623
|
-
return text.replace(/<think>[\s\S]*?<\/think>\s*/gi, replacement).replace(/\n{3,}/g, "\n\n").trim();
|
|
1624
|
-
}
|
|
1625
|
-
function stripCollapsedThinkingMarkers(text) {
|
|
1626
|
-
return text.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n").replace(/\n{2,}/g, "\n").trim();
|
|
1605
|
+
function formatAssistantTextForCli(text) {
|
|
1606
|
+
return text.replace(/\u003cthink\u003e[\s\S]*?\u003c\/think\u003e\s*/gi, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1627
1607
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
if (
|
|
1639
|
-
mode = arg2;
|
|
1640
|
-
}
|
|
1641
|
-
} else {
|
|
1642
|
-
mode = arg1;
|
|
1643
|
-
if (typeof arg2 === "function") {
|
|
1644
|
-
write = arg2;
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
if (mode === "hide") {
|
|
1648
|
-
return {
|
|
1649
|
-
push(_chunk) {
|
|
1650
|
-
}
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
if (mode === "show") {
|
|
1654
|
-
return {
|
|
1655
|
-
push(chunk) {
|
|
1656
|
-
if (chunk) write(chunk);
|
|
1657
|
-
}
|
|
1658
|
-
};
|
|
1659
|
-
}
|
|
1660
|
-
let markerEmitted = false;
|
|
1661
|
-
return {
|
|
1662
|
-
push(chunk) {
|
|
1663
|
-
if (!chunk || markerEmitted) return;
|
|
1664
|
-
write("\n\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n");
|
|
1665
|
-
markerEmitted = true;
|
|
1666
|
-
}
|
|
1667
|
-
};
|
|
1668
|
-
}
|
|
1669
|
-
function createThinkingAwareStreamFilter(write, mode = "hide") {
|
|
1670
|
-
if (mode === "show") {
|
|
1671
|
-
return {
|
|
1672
|
-
push(chunk) {
|
|
1673
|
-
write(chunk);
|
|
1674
|
-
},
|
|
1675
|
-
flush() {
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1608
|
+
|
|
1609
|
+
// packages/cli/client/formatReadPathTree.ts
|
|
1610
|
+
import { homedir as osHomedir } from "node:os";
|
|
1611
|
+
|
|
1612
|
+
// packages/core/foldHomePath.ts
|
|
1613
|
+
function foldHomePath(path, home) {
|
|
1614
|
+
if (!path) return path;
|
|
1615
|
+
if (home) {
|
|
1616
|
+
const cleanHome = home.endsWith("/") ? home.slice(0, -1) : home;
|
|
1617
|
+
if (path === cleanHome) return "~";
|
|
1618
|
+
if (path.startsWith(cleanHome + "/")) return `~${path.slice(cleanHome.length)}`;
|
|
1678
1619
|
}
|
|
1679
|
-
|
|
1680
|
-
let insideThink = false;
|
|
1681
|
-
let markerEmitted = false;
|
|
1682
|
-
const emit = (chunk) => {
|
|
1683
|
-
if (chunk) write(chunk);
|
|
1684
|
-
};
|
|
1685
|
-
const emitMarker = () => {
|
|
1686
|
-
if (mode !== "marker" || markerEmitted) return;
|
|
1687
|
-
emit("\n\u25B8 \u601D\u8003\u5DF2\u6298\u53E0\n");
|
|
1688
|
-
markerEmitted = true;
|
|
1689
|
-
};
|
|
1690
|
-
const consume = (input) => {
|
|
1691
|
-
pending += input;
|
|
1692
|
-
while (pending.length > 0) {
|
|
1693
|
-
if (insideThink) {
|
|
1694
|
-
const closeMatch = pending.match(THINK_CLOSE);
|
|
1695
|
-
if (!closeMatch || closeMatch.index == null) {
|
|
1696
|
-
emitMarker();
|
|
1697
|
-
pending = "";
|
|
1698
|
-
return;
|
|
1699
|
-
}
|
|
1700
|
-
emitMarker();
|
|
1701
|
-
pending = pending.slice(closeMatch.index + closeMatch[0].length);
|
|
1702
|
-
insideThink = false;
|
|
1703
|
-
markerEmitted = false;
|
|
1704
|
-
continue;
|
|
1705
|
-
}
|
|
1706
|
-
const openMatch = pending.match(THINK_OPEN);
|
|
1707
|
-
if (!openMatch || openMatch.index == null) {
|
|
1708
|
-
const nextMarker = pending.indexOf("<");
|
|
1709
|
-
if (nextMarker === -1) {
|
|
1710
|
-
const cleaned = mode === "hide" ? pending.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : pending;
|
|
1711
|
-
emit(cleaned);
|
|
1712
|
-
pending = "";
|
|
1713
|
-
return;
|
|
1714
|
-
}
|
|
1715
|
-
if (nextMarker > 0) {
|
|
1716
|
-
const head = pending.slice(0, nextMarker);
|
|
1717
|
-
const cleaned = mode === "hide" ? head.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : head;
|
|
1718
|
-
emit(cleaned);
|
|
1719
|
-
pending = pending.slice(nextMarker);
|
|
1720
|
-
continue;
|
|
1721
|
-
}
|
|
1722
|
-
if (pending.length < 7) return;
|
|
1723
|
-
emit(pending[0]);
|
|
1724
|
-
pending = pending.slice(1);
|
|
1725
|
-
continue;
|
|
1726
|
-
}
|
|
1727
|
-
if (openMatch.index > 0) {
|
|
1728
|
-
const head = pending.slice(0, openMatch.index);
|
|
1729
|
-
const cleaned = mode === "hide" ? head.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : head;
|
|
1730
|
-
emit(cleaned);
|
|
1731
|
-
pending = pending.slice(openMatch.index);
|
|
1732
|
-
continue;
|
|
1733
|
-
}
|
|
1734
|
-
pending = pending.slice(openMatch[0].length);
|
|
1735
|
-
insideThink = true;
|
|
1736
|
-
markerEmitted = false;
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
return {
|
|
1740
|
-
push(chunk) {
|
|
1741
|
-
consume(chunk);
|
|
1742
|
-
},
|
|
1743
|
-
flush() {
|
|
1744
|
-
if (insideThink) emitMarker();
|
|
1745
|
-
if (pending) {
|
|
1746
|
-
const cleaned = mode === "hide" ? pending.split("\n").filter((line) => !COLLAPSED_MARKER.test(line)).join("\n") : pending;
|
|
1747
|
-
emit(cleaned);
|
|
1748
|
-
}
|
|
1749
|
-
pending = "";
|
|
1750
|
-
insideThink = false;
|
|
1751
|
-
markerEmitted = false;
|
|
1752
|
-
}
|
|
1753
|
-
};
|
|
1620
|
+
return path.replace(/^(\/Users\/[^/]+|\/home\/[^/]+)(\/|$)/, "~$2");
|
|
1754
1621
|
}
|
|
1755
1622
|
|
|
1756
1623
|
// packages/cli/client/formatReadPathTree.ts
|
|
1757
|
-
import { homedir as osHomedir } from "node:os";
|
|
1758
1624
|
function clipPathAware(value, max = 72) {
|
|
1759
1625
|
const compact = compactWhitespace(value);
|
|
1760
1626
|
if (compact.length <= max) return compact;
|
|
@@ -1781,10 +1647,7 @@ function clipPathAware(value, max = 72) {
|
|
|
1781
1647
|
function formatHomePath(path, customHomedir) {
|
|
1782
1648
|
if (!path) return "";
|
|
1783
1649
|
const home = customHomedir || (typeof process !== "undefined" ? process.env?.HOME : void 0) || (typeof osHomedir === "function" ? osHomedir() : "");
|
|
1784
|
-
|
|
1785
|
-
return `~${path.slice(home.length)}`;
|
|
1786
|
-
}
|
|
1787
|
-
return path.replace(/^(\/Users\/[^\/]+\/|\/home\/[^\/]+\/)/, "~/");
|
|
1650
|
+
return foldHomePath(path, home);
|
|
1788
1651
|
}
|
|
1789
1652
|
function formatReadItemPath(rawPath, metadata, customHomedir) {
|
|
1790
1653
|
const inputPath = rawPath || (typeof metadata?.path === "string" ? metadata.path : void 0) || (typeof metadata?.filePath === "string" ? metadata.filePath : void 0) || "file";
|
|
@@ -3047,6 +2910,11 @@ function formatElapsed(totalSeconds) {
|
|
|
3047
2910
|
const mins = minutes % 60;
|
|
3048
2911
|
return `${hours}h ${mins}m`;
|
|
3049
2912
|
}
|
|
2913
|
+
function truncateThinkingHint(text, maxLen) {
|
|
2914
|
+
const cleaned = text.replace(/\n/g, " ").trim();
|
|
2915
|
+
if (cleaned.length <= maxLen) return cleaned;
|
|
2916
|
+
return "\u2026" + cleaned.slice(cleaned.length - maxLen + 1);
|
|
2917
|
+
}
|
|
3050
2918
|
var Spinner = class {
|
|
3051
2919
|
constructor(output, text, silent = false) {
|
|
3052
2920
|
this.output = output;
|
|
@@ -3060,6 +2928,7 @@ var Spinner = class {
|
|
|
3060
2928
|
frameIndex = 0;
|
|
3061
2929
|
frames = ["\xB7", "~", "\u2248", "\u223F", "\u2248", "~"];
|
|
3062
2930
|
isTTY;
|
|
2931
|
+
thinkingHint = "";
|
|
3063
2932
|
start() {
|
|
3064
2933
|
if (this.silent) {
|
|
3065
2934
|
this.startTime = Date.now();
|
|
@@ -3095,9 +2964,11 @@ ${this.text}
|
|
|
3095
2964
|
this.output.write("\r\x1B[K");
|
|
3096
2965
|
this.output.write("\x1B[?25h");
|
|
3097
2966
|
}
|
|
2967
|
+
this.thinkingHint = "";
|
|
3098
2968
|
}
|
|
3099
2969
|
show(text) {
|
|
3100
2970
|
this.text = text;
|
|
2971
|
+
this.thinkingHint = "";
|
|
3101
2972
|
if (this.silent) {
|
|
3102
2973
|
if (!this.startTime) {
|
|
3103
2974
|
this.startTime = Date.now();
|
|
@@ -3113,20 +2984,30 @@ ${this.text}
|
|
|
3113
2984
|
this.startTime = Date.now();
|
|
3114
2985
|
this.output.write(`\r${this.renderLine(this.frames[0])}`);
|
|
3115
2986
|
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Update the thinking hint displayed on the spinner line. The hint is
|
|
2989
|
+
* truncated to a reasonable length and shown as part of the spinner text.
|
|
2990
|
+
* Only meaningful while the spinner is active (TTY mode).
|
|
2991
|
+
*/
|
|
2992
|
+
setThinkingHint(text) {
|
|
2993
|
+
this.thinkingHint = text;
|
|
2994
|
+
if (this.silent || !this.isTTY || !this.timer) return;
|
|
2995
|
+
this.output.write(`\r${this.renderLine(this.frames[this.frameIndex])}`);
|
|
2996
|
+
}
|
|
3116
2997
|
renderLine(frame) {
|
|
3117
2998
|
const elapsedSeconds = Math.max(
|
|
3118
2999
|
0,
|
|
3119
3000
|
Math.floor((Date.now() - this.startTime) / 1e3)
|
|
3120
3001
|
);
|
|
3121
|
-
|
|
3002
|
+
const thinkingPart = this.thinkingHint ? `: ${truncateThinkingHint(this.thinkingHint, 60)}` : "";
|
|
3003
|
+
return `${themeColorSequence("accent")}${frame}\x1B[39m ${this.text}${thinkingPart} (${formatElapsed(elapsedSeconds)})`;
|
|
3122
3004
|
}
|
|
3123
3005
|
};
|
|
3124
3006
|
|
|
3125
3007
|
// packages/cli/client/agentRunOutput.ts
|
|
3126
|
-
function formatAssistantResponseForCli(text
|
|
3127
|
-
const thinkingMode = resolveThinkingDisplayMode(options.env);
|
|
3008
|
+
function formatAssistantResponseForCli(text) {
|
|
3128
3009
|
return formatAssistantDisplay(
|
|
3129
|
-
formatAssistantTextForCli(text
|
|
3010
|
+
formatAssistantTextForCli(text)
|
|
3130
3011
|
);
|
|
3131
3012
|
}
|
|
3132
3013
|
function resolveAgentEventMode(options) {
|
|
@@ -3159,12 +3040,19 @@ function createCliTurnOutput(params) {
|
|
|
3159
3040
|
let streamedAssistantText = false;
|
|
3160
3041
|
let everStreamedAnyText = false;
|
|
3161
3042
|
let printedAssistantLabel = false;
|
|
3162
|
-
|
|
3043
|
+
let thinkState = createThinkParserState();
|
|
3163
3044
|
const renderWriter = createRenderAwareStreamWriter({
|
|
3164
3045
|
write: (chunk) => options.output.write(chunk)
|
|
3165
3046
|
});
|
|
3166
3047
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
3167
3048
|
if (!chunk) return;
|
|
3049
|
+
const parsed = processThinkChunk(chunk, thinkState);
|
|
3050
|
+
thinkState = parsed.state;
|
|
3051
|
+
if (!parsed.content && !parsed.reasoning) return;
|
|
3052
|
+
if (parsed.reasoning) {
|
|
3053
|
+
spinner.setThinkingHint(parsed.reasoning);
|
|
3054
|
+
}
|
|
3055
|
+
if (!parsed.content) return;
|
|
3168
3056
|
spinner.stop();
|
|
3169
3057
|
options.activityReporter?.(null);
|
|
3170
3058
|
if (!printedAssistantLabel) {
|
|
@@ -3174,17 +3062,8 @@ ${options.agentName} > `);
|
|
|
3174
3062
|
}
|
|
3175
3063
|
streamedAssistantText = true;
|
|
3176
3064
|
everStreamedAnyText = true;
|
|
3177
|
-
renderWriter.push(
|
|
3065
|
+
renderWriter.push(parsed.content);
|
|
3178
3066
|
};
|
|
3179
|
-
const thinkingFilter = createThinkingAwareStreamFilter(
|
|
3180
|
-
writeVisibleAssistantChunk,
|
|
3181
|
-
thinkingMode
|
|
3182
|
-
);
|
|
3183
|
-
const thinkingSink = createThinkingEventSink((chunk) => {
|
|
3184
|
-
spinner.stop();
|
|
3185
|
-
options.activityReporter?.(null);
|
|
3186
|
-
options.output.write(chunk);
|
|
3187
|
-
}, thinkingMode);
|
|
3188
3067
|
const handleToolEvent = (event) => {
|
|
3189
3068
|
if (!traceLocalTools) return;
|
|
3190
3069
|
const chunk = eventMode === "jsonl" ? formatToolJsonEvent(event) : formatToolEvent(event);
|
|
@@ -3193,7 +3072,6 @@ ${options.agentName} > `);
|
|
|
3193
3072
|
return;
|
|
3194
3073
|
}
|
|
3195
3074
|
if (event.type === "tool-call") {
|
|
3196
|
-
thinkingFilter.flush();
|
|
3197
3075
|
renderWriter.flush();
|
|
3198
3076
|
}
|
|
3199
3077
|
spinner.stop();
|
|
@@ -3210,7 +3088,7 @@ ${options.agentName} > `);
|
|
|
3210
3088
|
spinner.show(activeLabel);
|
|
3211
3089
|
options.activityReporter?.(activeLabel);
|
|
3212
3090
|
}
|
|
3213
|
-
if (event.type === "tool-result" && options.onAgentRunStatus &&
|
|
3091
|
+
if (event.type === "tool-result" && options.onAgentRunStatus && event.toolName === "startAgentRun") {
|
|
3214
3092
|
const snapshot = extractAgentRunStatusSnapshot(event);
|
|
3215
3093
|
if (snapshot) {
|
|
3216
3094
|
options.onAgentRunStatus(snapshot);
|
|
@@ -3219,15 +3097,14 @@ ${options.agentName} > `);
|
|
|
3219
3097
|
};
|
|
3220
3098
|
return {
|
|
3221
3099
|
spinner,
|
|
3222
|
-
thinkingMode,
|
|
3223
3100
|
toolDisplayMode,
|
|
3224
3101
|
traceLocalTools,
|
|
3225
3102
|
eventMode,
|
|
3226
3103
|
pushText(chunk) {
|
|
3227
|
-
|
|
3104
|
+
writeVisibleAssistantChunk(chunk);
|
|
3228
3105
|
},
|
|
3229
3106
|
pushThinking(chunk) {
|
|
3230
|
-
|
|
3107
|
+
spinner.setThinkingHint(chunk);
|
|
3231
3108
|
},
|
|
3232
3109
|
handleToolEvent,
|
|
3233
3110
|
showWorking(label) {
|
|
@@ -3238,19 +3115,22 @@ ${options.agentName} > `);
|
|
|
3238
3115
|
finish(fallbackContent) {
|
|
3239
3116
|
spinner.stop();
|
|
3240
3117
|
options.activityReporter?.(null);
|
|
3118
|
+
const flushedThink = flushThinkParser(thinkState);
|
|
3119
|
+
thinkState = flushedThink.state;
|
|
3120
|
+
if (flushedThink.content) {
|
|
3121
|
+
writeVisibleAssistantChunk(flushedThink.content);
|
|
3122
|
+
}
|
|
3241
3123
|
const pendingToolOutput = formatToolEvent.flush ? formatToolEvent.flush() : "";
|
|
3242
3124
|
if (pendingToolOutput) {
|
|
3243
3125
|
options.output.write(pendingToolOutput);
|
|
3244
3126
|
}
|
|
3245
3127
|
if (streamedAssistantText) {
|
|
3246
|
-
thinkingFilter.flush();
|
|
3247
3128
|
renderWriter.flush();
|
|
3248
3129
|
options.output.write("\n");
|
|
3249
3130
|
} else if (everStreamedAnyText) {
|
|
3250
|
-
thinkingFilter.flush();
|
|
3251
3131
|
options.output.write("\n");
|
|
3252
3132
|
} else {
|
|
3253
|
-
const content = fallbackContent ? formatAssistantResponseForCli(fallbackContent.trim()
|
|
3133
|
+
const content = fallbackContent ? formatAssistantResponseForCli(fallbackContent.trim()) : "";
|
|
3254
3134
|
if (content) {
|
|
3255
3135
|
options.output.write(`
|
|
3256
3136
|
${options.agentName} > ${content}
|
|
@@ -3422,7 +3302,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
3422
3302
|
|
|
3423
3303
|
// packages/cli/client/agentRunTypes.ts
|
|
3424
3304
|
function resolveAuthToken2(env) {
|
|
3425
|
-
return env
|
|
3305
|
+
return resolvePlatformAuthToken(env);
|
|
3426
3306
|
}
|
|
3427
3307
|
function isMachineBoundLocalhostCustomProvider(agentConfig) {
|
|
3428
3308
|
const machineId = agentConfig?.runtimeBinding && typeof agentConfig.runtimeBinding === "object" ? String(agentConfig.runtimeBinding.machineId ?? "").trim() : "";
|
|
@@ -3670,7 +3550,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3670
3550
|
// packages/cli/client/agentRun.ts
|
|
3671
3551
|
import { ulid } from "ulid";
|
|
3672
3552
|
async function loadRunLocalAgentTurn() {
|
|
3673
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3553
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-4YCF6IRF.js");
|
|
3674
3554
|
return runLocalAgentTurn;
|
|
3675
3555
|
}
|
|
3676
3556
|
async function resolveCurrentMachineId(options) {
|
|
@@ -4037,8 +3917,7 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
4037
3917
|
return dialogIdText ? { exitCode: 1, dialogId: dialogIdText } : { exitCode: 1 };
|
|
4038
3918
|
}
|
|
4039
3919
|
const content = formatAssistantResponseForCli(
|
|
4040
|
-
String(data?.content ?? data?.message ?? "")
|
|
4041
|
-
options
|
|
3920
|
+
String(data?.content ?? data?.message ?? "")
|
|
4042
3921
|
);
|
|
4043
3922
|
if (content) {
|
|
4044
3923
|
options.output.write(`
|
|
@@ -4107,7 +3986,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
4107
3986
|
} : void 0;
|
|
4108
3987
|
const currentDialogId = options.continueDialogId ?? ulid();
|
|
4109
3988
|
const runChildTurn = async (input) => {
|
|
4110
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3989
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-4YCF6IRF.js");
|
|
4111
3990
|
return runLocalAgentTurn(input);
|
|
4112
3991
|
};
|
|
4113
3992
|
const createFreshChildBaseAdapter = () => {
|
|
@@ -4219,6 +4098,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
4219
4098
|
return {
|
|
4220
4099
|
exitCode: 0,
|
|
4221
4100
|
dialogId: result.dialogId,
|
|
4101
|
+
title: result.title,
|
|
4222
4102
|
turnTokens: buildTurnTokenUsage(result.usage, result.model)
|
|
4223
4103
|
};
|
|
4224
4104
|
} catch (error) {
|
|
@@ -4262,6 +4142,7 @@ async function runAgentTurn(options) {
|
|
|
4262
4142
|
return {
|
|
4263
4143
|
exitCode: localResult.exitCode,
|
|
4264
4144
|
...localResult.dialogId ? { dialogId: localResult.dialogId } : {},
|
|
4145
|
+
title: localResult.title,
|
|
4265
4146
|
...localResult.turnTokens ? { turnTokens: localResult.turnTokens } : {},
|
|
4266
4147
|
...localResult.streamInterrupted ? { streamInterrupted: localResult.streamInterrupted } : {},
|
|
4267
4148
|
...localResult.pendingToolName ? { pendingToolName: localResult.pendingToolName } : {}
|
|
@@ -4282,6 +4163,7 @@ async function runAgentTurn(options) {
|
|
|
4282
4163
|
return {
|
|
4283
4164
|
exitCode: retriedLocalResult.exitCode,
|
|
4284
4165
|
...retriedLocalResult.dialogId ? { dialogId: retriedLocalResult.dialogId } : {},
|
|
4166
|
+
title: retriedLocalResult.title,
|
|
4285
4167
|
...retriedLocalResult.turnTokens ? { turnTokens: retriedLocalResult.turnTokens } : {}
|
|
4286
4168
|
};
|
|
4287
4169
|
}
|
|
@@ -5458,7 +5340,6 @@ export {
|
|
|
5458
5340
|
themeColorSequence,
|
|
5459
5341
|
themeText,
|
|
5460
5342
|
formatAssistantDisplay,
|
|
5461
|
-
normalizeThinkingDisplayMode,
|
|
5462
5343
|
normalizeToolDisplayMode,
|
|
5463
5344
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
5464
5345
|
shouldCollapsePaste,
|