nolo-cli 0.8.0-alpha.21 → 0.8.0-alpha.23
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-42U3VOVZ.js → _executeModel-YXTTYRXS.js} +44 -43
- package/{action-TLI3V62L.js → action-QM2ONPYZ.js} +9 -9
- package/{addContentAction-57RSIIMR.js → addContentAction-UXY3GM53.js} +8 -8
- package/{addDialogAgentAction-G3VWEA6E.js → addDialogAgentAction-MUBYOG65.js} +10 -10
- package/{agentDeleteCommand-5DD2IM3J.js → agentDeleteCommand-4NO7Y6UI.js} +28 -27
- package/{agentEmailCommands-6FACJBU4.js → agentEmailCommands-NPP5TGZV.js} +60 -58
- package/{agentListCommands-I6KZYCIG.js → agentListCommands-IP5BNB5W.js} +32 -30
- package/{agentMachineCommands-VKLIGMZA.js → agentMachineCommands-24NFTIKY.js} +27 -26
- package/{agentPullCommand-O2MTUAFR.js → agentPullCommand-N6UWRTVL.js} +3 -3
- package/{agentRecordCommands-7TZICYDT.js → agentRecordCommands-7AWSR46F.js} +51 -49
- package/{agentRunCommand-L4OM23KV.js → agentRunCommand-P46WCJ6P.js} +55 -52
- package/{agentRunControl-K4VKNEHF.js → agentRunControl-S3G62M6C.js} +3 -3
- package/{agentRuntimeLocal-ZYEIPTY4.js → agentRuntimeLocal-V5UV7S4R.js} +14 -12
- package/{agentSlice-BX7GXSNO.js → agentSlice-3CVAZZOP.js} +9 -9
- package/{authCommand-EB5JSOX5.js → authCommand-B6P2XYLN.js} +11 -11
- package/{authCommands-XPEHTKSM.js → authCommands-4YKA4GTU.js} +7 -7
- package/{chunk-AS4PVWA4.js → chunk-2CVZSC5L.js} +1 -1
- package/{chunk-VUW5FBDB.js → chunk-4VA3UQRF.js} +9 -9
- package/{chunk-2JCXITPK.js → chunk-5NYGMN4O.js} +15 -15
- package/{chunk-AGFH73SK.js → chunk-6KRA6AWI.js} +1 -1
- package/{chunk-P3PKED2I.js → chunk-6OHYC4BY.js} +9 -12
- package/{chunk-5KLGBAAR.js → chunk-6UUD2WES.js} +1 -1
- package/{chunk-ENOG22KJ.js → chunk-A4MYG3TR.js} +18 -20
- package/{chunk-2FTTDCD4.js → chunk-AMJ7LA5D.js} +1 -1
- package/chunk-AOKWJZ5N.js +4884 -0
- package/{chunk-JRKKFRAV.js → chunk-AWY2AFHN.js} +9 -5
- package/{chunk-RL776AGR.js → chunk-BB2PII22.js} +1 -1
- package/{chunk-I6XMPTMR.js → chunk-BFDWXLFF.js} +2 -2
- package/{chunk-VVX233PH.js → chunk-BT37DVDA.js} +9 -9
- package/chunk-BYXBJQAS.js +0 -0
- package/{chunk-C3RUNRHT.js → chunk-D55DXHXL.js} +1 -1
- package/{chunk-7DAJ4AI4.js → chunk-DSNLHTP3.js} +2 -2
- package/{chunk-SDJDLO5W.js → chunk-EUN3SYY7.js} +5 -5
- package/{chunk-FSO5B7GH.js → chunk-HAC6GPRE.js} +2 -2
- package/{chunk-CKOJQDKR.js → chunk-JEMATI63.js} +1 -1
- package/{chunk-7U44LYTR.js → chunk-JTINRTBT.js} +1 -1
- package/{chunk-YPRZSPF3.js → chunk-KLOCUWKZ.js} +1 -1
- package/{chunk-4O3CARJ4.js → chunk-KTHLAJEY.js} +1 -1
- package/{chunk-URUUZLPA.js → chunk-L3KWEH3V.js} +8 -8
- package/{chunk-O2ZNTTET.js → chunk-LBUTKV7S.js} +21 -12
- package/{chunk-GU3PEVGZ.js → chunk-LFFATN2M.js} +2632 -1578
- package/{chunk-UB6SN4NJ.js → chunk-LJCH34R2.js} +6 -6
- package/{chunk-5EFXE3O7.js → chunk-LTH6AVG7.js} +3 -3
- package/{chunk-7GNGZRLZ.js → chunk-LW6FJFCT.js} +45 -67
- package/{chunk-7KCUSYT2.js → chunk-MIQOUMSN.js} +7 -7
- package/{chunk-FVYY6MCS.js → chunk-O7VS7JLJ.js} +17 -17
- package/{chunk-RCSJFQPB.js → chunk-P7GAHW32.js} +361 -90
- package/{chunk-AL2KDGR2.js → chunk-PTT6KSYQ.js} +134 -84
- package/{chunk-4IJYA27C.js → chunk-PXZAAB4L.js} +4 -4
- package/{chunk-4XENYTF5.js → chunk-Q2WC4KGQ.js} +3 -3
- package/{chunk-4QEWT7KD.js → chunk-RBB43B5W.js} +367 -85
- package/chunk-RBCENBG7.js +36 -0
- package/{chunk-IWX4UW2E.js → chunk-RBCNBU2A.js} +88 -8
- package/{chunk-25LCXTML.js → chunk-RQPZX6KP.js} +2 -2
- package/{chunk-6KHNO3SK.js → chunk-RYMUT5JO.js} +23 -23
- package/{chunk-VX3SXJ3N.js → chunk-UBSKX3LP.js} +6 -6
- package/{chunk-4ZDM73SD.js → chunk-V2J635L5.js} +1 -1
- package/{chunk-DSZUWUYB.js → chunk-VBKJTOAW.js} +1 -1
- package/{chunk-XBUBEFNX.js → chunk-WESWWEVA.js} +1 -1
- package/{chunk-2ECQG4YX.js → chunk-ZAUDEKML.js} +253 -159
- package/{chunk-N54XAP77.js → chunk-ZJS64PZJ.js} +1 -1
- package/{createAgentAutomationAction-RJF3N2QY.js → createAgentAutomationAction-DYQOGAVE.js} +25 -24
- package/{createDialogAction-DRSPS6CE.js → createDialogAction-ETB3KQQE.js} +25 -24
- package/{createPageAction-6B2WMNO3.js → createPageAction-UF2RHA63.js} +25 -24
- package/{dbSlice-Q3TM2FJV.js → dbSlice-R5EJKZBW.js} +7 -7
- package/{deleteFile-OW53A6BX.js → deleteFile-WPWVZE4B.js} +5 -5
- package/{dialogCommands-4IX4XIZE.js → dialogCommands-LYYC7XHF.js} +23 -22
- package/{dialogSlice-3M7KX2TX.js → dialogSlice-IFBZ4IT2.js} +24 -23
- package/{docCreateCommands-SIL3NPGT.js → docCreateCommands-I66OI374.js} +22 -21
- package/{docDeleteCommands-7IOMLUS4.js → docDeleteCommands-OVRBCHMF.js} +23 -22
- package/{docReadCommands-FNFXUA5L.js → docReadCommands-YLWUMEH7.js} +22 -21
- package/{docStore-SV7E34D4.js → docStore-65WO7U36.js} +24 -23
- package/{docUpdateCommands-X2HNDVUC.js → docUpdateCommands-NSICS4IN.js} +22 -21
- package/fetchMessages-KTNM7QAR.js +1 -1
- package/{getPricing-3E6UNPKL.js → getPricing-7PUT44ZS.js} +7 -3
- package/{handleSendMessageAction-JYETO5RZ.js → handleSendMessageAction-T76HEDOP.js} +29 -28
- package/index.js +74 -74
- package/{localDialogRead-2VRI24F4.js → localDialogRead-YSKFFRTT.js} +1 -1
- package/{machineCommands-RIO3RP5Q.js → machineCommands-4HQY6UVZ.js} +57 -55
- package/{machineWsRunDispatch-W7UYLGB5.js → machineWsRunDispatch-7YW2M4FS.js} +49 -47
- package/{memoryCommands-O4MIPIWQ.js → memoryCommands-HG4WKTU7.js} +2 -2
- package/{models-4OPOOLFS.js → models-MFXNI3TF.js} +2 -2
- package/package.json +1 -1
- package/{read-GW7ZEI23.js → read-5ZMY7FKP.js} +5 -5
- package/{readDocTool-HUFU6OCT.js → readDocTool-2NXDK32S.js} +1 -1
- package/{readlineWorkspace-27JR7WPW.js → readlineWorkspace-FLQWOAUR.js} +759 -604
- package/{removeDialogAgentAction-CXKR4NJI.js → removeDialogAgentAction-KOLQ2R5W.js} +13 -12
- package/{runAgentClientLoop-HZFAPJHS.js → runAgentClientLoop-IUV2TR3X.js} +43 -42
- package/{runtimeDoctorCommands-LRHLPDRC.js → runtimeDoctorCommands-UWR5UDSM.js} +5 -5
- package/{setDialogExtraReferencesAction-6RKUSXHX.js → setDialogExtraReferencesAction-OMTEO7X6.js} +10 -10
- package/{setPrimaryDialogAgentAction-T3UTBEFG.js → setPrimaryDialogAgentAction-DOCIS6V4.js} +13 -12
- package/{settingSlice-IVKXJXMG.js → settingSlice-UWZJYDOA.js} +8 -8
- package/{spaceCommands-E7VOF4LO.js → spaceCommands-BDDAT4VU.js} +29 -28
- package/{spaceSlice-TSVROA5U.js → spaceSlice-HH633ZA4.js} +23 -22
- package/{streamAgentChatTurn-3C5RQZJF.js → streamAgentChatTurn-UBZOVFKV.js} +95 -72
- package/{tableCommands-O7O2LBEG.js → tableCommands-M3DJUETS.js} +10 -10
- package/{toolApiClient-QI3YBNWB.js → toolApiClient-C7P7YSE4.js} +2 -2
- package/{tools-EQDEKR6N.js → tools-OQZ34KCU.js} +31 -30
- package/{tuiSummaryLlmCaller-RV3THLZF.js → tuiSummaryLlmCaller-42AEL3LL.js} +8 -6
- package/{updateCommands-VOSPKXFF.js → updateCommands-TC5SX42Y.js} +3 -3
- package/{updateDialogTitleAction-3XV7VWSZ.js → updateDialogTitleAction-A3OOMSDO.js} +27 -26
- package/chunk-BBYVOSU2.js +0 -792
- package/chunk-DCOA4QSN.js +0 -105
- package/{chunk-DZ3XJVET.js → chunk-3QAF2LTL.js} +3 -3
- package/{chunk-EHLHSX7R.js → chunk-5MMZUWSG.js} +3 -3
- package/{chunk-ISNCLGUZ.js → chunk-AVMJVOQY.js} +3 -3
- package/{chunk-UTLZINAP.js → chunk-DVRHHFEA.js} +10 -10
- package/{chunk-4CQLVGRV.js → chunk-ID4G2MAR.js} +3 -3
- package/{chunk-5MIDPSSK.js → chunk-JK7VW2FN.js} +3 -3
- package/{chunk-TILFE6LV.js → chunk-YOCHZD7D.js} +3 -3
- package/{db-HCJ5PRB5.js → db-6QED3ZVO.js} +3 -3
- package/{understanding-3CUQQ6SV.js → understanding-ZOESBLF3.js} +3 -3
|
@@ -3,12 +3,16 @@ import {
|
|
|
3
3
|
refreshAntigravityOAuthToken,
|
|
4
4
|
refreshOpenAiCodexToken,
|
|
5
5
|
refreshXaiOAuthToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5MMZUWSG.js";
|
|
7
|
+
import {
|
|
8
|
+
CliProviderQuotaError,
|
|
9
|
+
executeCli
|
|
10
|
+
} from "./chunk-CMKUBIGW.js";
|
|
7
11
|
import {
|
|
8
12
|
buildLocalAgentLookupKeys,
|
|
9
13
|
normalizeAgentHandle,
|
|
10
14
|
shouldReadAgentKeyRemotely
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZJS64PZJ.js";
|
|
12
16
|
import {
|
|
13
17
|
LOCAL_CODEX_AGENT_ID,
|
|
14
18
|
LOCAL_CODEX_AGENT_KEY,
|
|
@@ -17,23 +21,19 @@ import {
|
|
|
17
21
|
} from "./chunk-VHBWHNVT.js";
|
|
18
22
|
import {
|
|
19
23
|
inferCaptureIntent
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
CliProviderQuotaError,
|
|
23
|
-
executeCli
|
|
24
|
-
} from "./chunk-CMKUBIGW.js";
|
|
24
|
+
} from "./chunk-KTHLAJEY.js";
|
|
25
25
|
import {
|
|
26
26
|
buildCliPrompt
|
|
27
27
|
} from "./chunk-ATNTHIZI.js";
|
|
28
28
|
import {
|
|
29
29
|
prepareTools
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HAC6GPRE.js";
|
|
31
31
|
import {
|
|
32
32
|
getAntigravityUserAgent,
|
|
33
33
|
isAntigravityOAuthAgent,
|
|
34
34
|
readAntigravityProjectId,
|
|
35
35
|
resolveAntigravityCloudCodeBaseUrl
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-D55DXHXL.js";
|
|
37
37
|
import {
|
|
38
38
|
FORCED_TOOLS,
|
|
39
39
|
addDefaultLightWebToolsForConfiguredAgents,
|
|
@@ -43,27 +43,19 @@ import {
|
|
|
43
43
|
readXPostFunctionSchema,
|
|
44
44
|
readXhsProfileFunc,
|
|
45
45
|
readXhsProfileFunctionSchema
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-PTT6KSYQ.js";
|
|
47
47
|
import {
|
|
48
48
|
normalizeDialogTitle
|
|
49
49
|
} from "./chunk-OWOHNGCN.js";
|
|
50
50
|
import {
|
|
51
51
|
BUILTIN_TITLE_LLM_CONFIG
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-V2J635L5.js";
|
|
53
53
|
import {
|
|
54
54
|
fetchServerSyncedCredential
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import {
|
|
57
|
-
isCompiledBinary,
|
|
58
|
-
parseUserIdFromAuthToken
|
|
59
|
-
} from "./chunk-ISNCLGUZ.js";
|
|
60
|
-
import {
|
|
61
|
-
DEFAULT_NOLO_SERVER_URL
|
|
62
|
-
} from "./chunk-OLZBQWZU.js";
|
|
55
|
+
} from "./chunk-4VA3UQRF.js";
|
|
63
56
|
import {
|
|
64
57
|
buildAgentRuntimeDialogWritePlan,
|
|
65
58
|
buildLocalWorkspaceOpenAiTools,
|
|
66
|
-
buildLocalWorkspacePolicyToolNames,
|
|
67
59
|
buildLocalWorkspaceToolset,
|
|
68
60
|
createHybridRecordStore,
|
|
69
61
|
createLocalWorkspaceToolExecutors,
|
|
@@ -73,7 +65,7 @@ import {
|
|
|
73
65
|
parseSseDataLineJson,
|
|
74
66
|
readOpenAiCompatibleSseCompletion,
|
|
75
67
|
resolveOpenAiCompatibleProviderConfig
|
|
76
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-LBUTKV7S.js";
|
|
77
69
|
import {
|
|
78
70
|
buildPlatformChatCompletionRequest,
|
|
79
71
|
canUsePlatformChatProvider,
|
|
@@ -82,23 +74,22 @@ import {
|
|
|
82
74
|
readSseDataValues,
|
|
83
75
|
resolvePlatformChatProviderConfig,
|
|
84
76
|
shouldUsePlatformChatProvider
|
|
85
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-6UUD2WES.js";
|
|
86
78
|
import {
|
|
87
79
|
resolveAgentRuntimeConfigFromRecord
|
|
88
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-YOCHZD7D.js";
|
|
89
81
|
import {
|
|
90
82
|
parseToolArgumentsJson,
|
|
91
83
|
summarizeToolArguments
|
|
92
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-RBB43B5W.js";
|
|
93
85
|
import {
|
|
94
86
|
buildLoadSkillExecutor,
|
|
95
87
|
buildNoloWorkspaceCliToolExecutors,
|
|
96
88
|
buildNoloWorkspaceOpenAiTools,
|
|
97
89
|
canonicalizeToolNames,
|
|
98
|
-
filterNoloWorkspaceToolNames,
|
|
99
90
|
parseNoloWorkspaceToolArguments,
|
|
100
91
|
resolveRuntimeToolSurfaceForAgent
|
|
101
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-6OHYC4BY.js";
|
|
102
93
|
import {
|
|
103
94
|
clipCompactText
|
|
104
95
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -114,12 +105,6 @@ import {
|
|
|
114
105
|
readOAuthCredential,
|
|
115
106
|
resolveFreshAccessToken
|
|
116
107
|
} from "./chunk-JZPBVBIY.js";
|
|
117
|
-
import {
|
|
118
|
-
toErrorMessage
|
|
119
|
-
} from "./chunk-HNMXYYJR.js";
|
|
120
|
-
import {
|
|
121
|
-
getDefaultCliLocalRuntimeDb
|
|
122
|
-
} from "./chunk-H33743XH.js";
|
|
123
108
|
import {
|
|
124
109
|
asRecordOrEmpty
|
|
125
110
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -132,6 +117,26 @@ import {
|
|
|
132
117
|
import {
|
|
133
118
|
asOptionalFiniteNumber
|
|
134
119
|
} from "./chunk-WWC7I6TA.js";
|
|
120
|
+
import {
|
|
121
|
+
checkStaleRun,
|
|
122
|
+
finalizeRunRecord,
|
|
123
|
+
findRunRecord,
|
|
124
|
+
listRunRecords,
|
|
125
|
+
spawnLocalBackgroundRun
|
|
126
|
+
} from "./chunk-AMJ7LA5D.js";
|
|
127
|
+
import {
|
|
128
|
+
isCompiledBinary,
|
|
129
|
+
parseUserIdFromAuthToken
|
|
130
|
+
} from "./chunk-AVMJVOQY.js";
|
|
131
|
+
import {
|
|
132
|
+
DEFAULT_NOLO_SERVER_URL
|
|
133
|
+
} from "./chunk-OLZBQWZU.js";
|
|
134
|
+
import {
|
|
135
|
+
toErrorMessage
|
|
136
|
+
} from "./chunk-HNMXYYJR.js";
|
|
137
|
+
import {
|
|
138
|
+
getDefaultCliLocalRuntimeDb
|
|
139
|
+
} from "./chunk-H33743XH.js";
|
|
135
140
|
import {
|
|
136
141
|
BUILTIN_NOLO_AGENT_KEY,
|
|
137
142
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
@@ -139,25 +144,25 @@ import {
|
|
|
139
144
|
PUBLIC_GLM_52_AGENT_KEY,
|
|
140
145
|
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
141
146
|
PUBLIC_KIMI_K27_CODING_AGENT_KEY
|
|
142
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-VBKJTOAW.js";
|
|
143
148
|
import {
|
|
144
|
-
|
|
145
|
-
} from "./chunk-
|
|
149
|
+
asTrimmedString
|
|
150
|
+
} from "./chunk-3EUW3WEO.js";
|
|
151
|
+
import {
|
|
152
|
+
isRecord
|
|
153
|
+
} from "./chunk-KUG52IAP.js";
|
|
146
154
|
import {
|
|
147
155
|
NOLO_CLUSTER_SERVERS
|
|
148
156
|
} from "./chunk-LCBAMY2M.js";
|
|
149
157
|
import {
|
|
150
|
-
|
|
151
|
-
} from "./chunk-
|
|
158
|
+
isLoopbackHostname
|
|
159
|
+
} from "./chunk-4SN6J65J.js";
|
|
152
160
|
import {
|
|
153
161
|
normalizeServerOrigin
|
|
154
162
|
} from "./chunk-CF7PE763.js";
|
|
155
163
|
import {
|
|
156
164
|
asOptionalTrimmedString
|
|
157
165
|
} from "./chunk-G3SUCT4W.js";
|
|
158
|
-
import {
|
|
159
|
-
isRecord
|
|
160
|
-
} from "./chunk-KUG52IAP.js";
|
|
161
166
|
|
|
162
167
|
// packages/cli/client/localRuntimeAdapter.ts
|
|
163
168
|
import { dirname, extname, join } from "node:path";
|
|
@@ -714,14 +719,14 @@ var BUILTIN_PLATFORM_AGENT_CONFIGS = {
|
|
|
714
719
|
[PUBLIC_KIMI_K26_IMAGE_AGENT_KEY]: {
|
|
715
720
|
key: PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
716
721
|
name: "Kimi K2.6",
|
|
717
|
-
provider: "
|
|
722
|
+
provider: "nolo",
|
|
718
723
|
model: "kimi-k2.6",
|
|
719
724
|
apiSource: "platform",
|
|
720
725
|
useServerProxy: true,
|
|
721
726
|
rawRecord: {
|
|
722
727
|
dbKey: PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
723
728
|
isPublic: true,
|
|
724
|
-
provider: "
|
|
729
|
+
provider: "nolo",
|
|
725
730
|
model: "kimi-k2.6",
|
|
726
731
|
apiSource: "platform",
|
|
727
732
|
useServerProxy: true
|
|
@@ -730,14 +735,14 @@ var BUILTIN_PLATFORM_AGENT_CONFIGS = {
|
|
|
730
735
|
[PUBLIC_KIMI_K27_CODING_AGENT_KEY]: {
|
|
731
736
|
key: PUBLIC_KIMI_K27_CODING_AGENT_KEY,
|
|
732
737
|
name: "Kimi K2.7 Coding",
|
|
733
|
-
provider: "
|
|
738
|
+
provider: "nolo",
|
|
734
739
|
model: "kimi-k2.7-code",
|
|
735
740
|
apiSource: "platform",
|
|
736
741
|
useServerProxy: true,
|
|
737
742
|
rawRecord: {
|
|
738
743
|
dbKey: PUBLIC_KIMI_K27_CODING_AGENT_KEY,
|
|
739
744
|
isPublic: true,
|
|
740
|
-
provider: "
|
|
745
|
+
provider: "nolo",
|
|
741
746
|
model: "kimi-k2.7-code",
|
|
742
747
|
apiSource: "platform",
|
|
743
748
|
useServerProxy: true
|
|
@@ -1042,12 +1047,6 @@ var LOCAL_SERVER_WEB_TOOL_NAMES = ["fetchWebpage", "exa_search"];
|
|
|
1042
1047
|
var LOCAL_SERVER_WEB_TOOL_NAME_SET = new Set(
|
|
1043
1048
|
LOCAL_SERVER_WEB_TOOL_NAMES
|
|
1044
1049
|
);
|
|
1045
|
-
var REGISTRY_INJECTED_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
1046
|
-
"callAgent",
|
|
1047
|
-
"ui_ask_choice",
|
|
1048
|
-
"read_x_post",
|
|
1049
|
-
"read_xhs_profile"
|
|
1050
|
-
]);
|
|
1051
1050
|
|
|
1052
1051
|
// packages/cli/client/cliServerPlatformToolExecutors.ts
|
|
1053
1052
|
function buildServerPlatformToolExecutors(args) {
|
|
@@ -1143,7 +1142,183 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
1143
1142
|
return { ...tableExecutors, ...webExecutors };
|
|
1144
1143
|
}
|
|
1145
1144
|
|
|
1145
|
+
// packages/cli/client/cliAgentRunToolExecutors.ts
|
|
1146
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
1147
|
+
var noopOutput = { write: () => {
|
|
1148
|
+
} };
|
|
1149
|
+
var parseCallArgs = (call) => {
|
|
1150
|
+
try {
|
|
1151
|
+
return JSON.parse(call?.arguments || "{}");
|
|
1152
|
+
} catch {
|
|
1153
|
+
return {};
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
var resolveFs = (deps) => deps.fs ?? { existsSync, readFileSync };
|
|
1157
|
+
var tailFile = (logPath, tailLines, fs) => {
|
|
1158
|
+
if (!fs.existsSync(logPath)) return void 0;
|
|
1159
|
+
try {
|
|
1160
|
+
const content = fs.readFileSync(logPath, "utf8");
|
|
1161
|
+
const lines = String(content).split(/\r?\n/);
|
|
1162
|
+
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
1163
|
+
return lines.slice(Math.max(0, lines.length - tailLines)).join("\n");
|
|
1164
|
+
} catch {
|
|
1165
|
+
return void 0;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
function createCliStartAgentRunExecutor(deps = {}) {
|
|
1169
|
+
return async (call) => {
|
|
1170
|
+
const args = parseCallArgs(call);
|
|
1171
|
+
const agentKey = typeof args.agentKey === "string" ? args.agentKey.trim() : "";
|
|
1172
|
+
const task = typeof args.task === "string" ? args.task.trim() : "";
|
|
1173
|
+
if (!agentKey) throw new Error("startAgentRun: \u7F3A\u5C11 agentKey \u53C2\u6570\u3002");
|
|
1174
|
+
if (!task) throw new Error("startAgentRun: \u7F3A\u5C11\u6709\u6548\u7684 task \u6587\u672C\u63CF\u8FF0\u3002");
|
|
1175
|
+
const message = typeof args.input === "undefined" ? task : `${task}
|
|
1176
|
+
|
|
1177
|
+
--- \u9644\u52A0\u8F93\u5165 ---
|
|
1178
|
+
${JSON.stringify(args.input)}`;
|
|
1179
|
+
const rawArgs = ["--agent", agentKey, "--msg-file", "PLACEHOLDER", "--bg"];
|
|
1180
|
+
const { runId, pid } = await spawnLocalBackgroundRun(
|
|
1181
|
+
{
|
|
1182
|
+
rawArgs,
|
|
1183
|
+
commandPath: ["agent", "run"],
|
|
1184
|
+
cliEntrypointPath: deps.cliEntrypoint,
|
|
1185
|
+
agentKey,
|
|
1186
|
+
cwd: deps.cwd ?? process.cwd(),
|
|
1187
|
+
message,
|
|
1188
|
+
output: noopOutput
|
|
1189
|
+
},
|
|
1190
|
+
deps
|
|
1191
|
+
);
|
|
1192
|
+
return {
|
|
1193
|
+
content: JSON.stringify({ runId, status: "running" }),
|
|
1194
|
+
metadata: {
|
|
1195
|
+
displayData: `\u23F3 \u540E\u53F0 run \u5DF2\u542F\u52A8\uFF0CrunId: ${runId}\uFF08pid ${pid ?? "-"}\uFF09\u3002\u7528 controlAgentRun(action:"status", runId:"${runId}") \u67E5\u8FDB\u5EA6\u3002`
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function createCliControlAgentRunExecutor(deps = {}) {
|
|
1201
|
+
return async (call) => {
|
|
1202
|
+
const args = parseCallArgs(call);
|
|
1203
|
+
const action = typeof args.action === "string" ? args.action : "";
|
|
1204
|
+
const tailLines = typeof args.tailLines === "number" ? args.tailLines : 0;
|
|
1205
|
+
if (action === "list") {
|
|
1206
|
+
const runs = listRunRecords(deps).map((record2) => ({
|
|
1207
|
+
runId: record2.runId,
|
|
1208
|
+
status: record2.status,
|
|
1209
|
+
agentKey: record2.agentKey,
|
|
1210
|
+
pid: record2.pid ?? null,
|
|
1211
|
+
startedAt: record2.startedAt
|
|
1212
|
+
}));
|
|
1213
|
+
return {
|
|
1214
|
+
content: JSON.stringify({ runs, count: runs.length }),
|
|
1215
|
+
metadata: {
|
|
1216
|
+
displayData: runs.length > 0 ? `\u{1F4CB} \u627E\u5230 ${runs.length} \u4E2A run\uFF1A
|
|
1217
|
+
${runs.map((r) => `${r.runId} [${r.status}] ${r.agentKey}`).join("\n")}` : "\u{1F4CB} \u6CA1\u6709\u627E\u5230 run\u3002"
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
if (action !== "status" && action !== "stop") {
|
|
1222
|
+
throw new Error(`controlAgentRun: \u672A\u77E5 action "${action}"\u3002`);
|
|
1223
|
+
}
|
|
1224
|
+
if (!args.runId) throw new Error(`controlAgentRun(action:"${action}"): \u7F3A\u5C11 runId\u3002`);
|
|
1225
|
+
const record = findRunRecord(String(args.runId), deps);
|
|
1226
|
+
if (!record) {
|
|
1227
|
+
return {
|
|
1228
|
+
content: JSON.stringify({ runId: args.runId, found: false }),
|
|
1229
|
+
metadata: { displayData: `\u2753 run ${args.runId} \u672A\u627E\u5230\u3002\u53EF\u80FD\u5DF2\u5B8C\u6210\u5E76\u88AB\u6E05\u7406\uFF0C\u6216 ID \u9519\u8BEF\u3002` }
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
if (action === "status") {
|
|
1233
|
+
const reconciled = checkStaleRun(record.runId, deps) ?? record;
|
|
1234
|
+
const logTail = tailLines > 0 ? tailFile(record.logPath, tailLines, resolveFs(deps)) : void 0;
|
|
1235
|
+
return {
|
|
1236
|
+
content: JSON.stringify({
|
|
1237
|
+
runId: reconciled.runId,
|
|
1238
|
+
found: true,
|
|
1239
|
+
status: reconciled.status,
|
|
1240
|
+
pid: reconciled.pid ?? null,
|
|
1241
|
+
agentKey: reconciled.agentKey,
|
|
1242
|
+
startedAt: reconciled.startedAt,
|
|
1243
|
+
endedAt: reconciled.endedAt ?? null,
|
|
1244
|
+
exitCode: reconciled.exitCode ?? null,
|
|
1245
|
+
...logTail !== void 0 ? { logTail } : {}
|
|
1246
|
+
}),
|
|
1247
|
+
metadata: {
|
|
1248
|
+
displayData: `\u{1F4CC} run ${reconciled.runId} status=${reconciled.status}` + (logTail ? `
|
|
1249
|
+
--- \u65E5\u5FD7\uFF08\u672B ${tailLines} \u884C\uFF09---
|
|
1250
|
+
${logTail}` : "")
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
if (typeof record.pid === "number") {
|
|
1255
|
+
try {
|
|
1256
|
+
(deps.kill ?? ((pid, signal) => process.kill(pid, signal)))(
|
|
1257
|
+
record.pid,
|
|
1258
|
+
"SIGTERM"
|
|
1259
|
+
);
|
|
1260
|
+
} catch {
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
finalizeRunRecord(record.runId, { status: "killed" }, deps);
|
|
1264
|
+
return {
|
|
1265
|
+
content: JSON.stringify({ runId: record.runId, found: true, status: "killed" }),
|
|
1266
|
+
metadata: { displayData: `\u{1F6D1} run ${record.runId} \u5DF2\u505C\u6B62\uFF08killed\uFF09\u3002` }
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1146
1271
|
// packages/cli/client/cliLocalToolExecutors.ts
|
|
1272
|
+
var MAX_PASTED_TEXT_LINES_PER_READ = 200;
|
|
1273
|
+
function createReadPastedTextExecutor(store) {
|
|
1274
|
+
return async (call) => {
|
|
1275
|
+
let parsed = {};
|
|
1276
|
+
try {
|
|
1277
|
+
const value = JSON.parse(call.arguments || "{}");
|
|
1278
|
+
if (value && typeof value === "object") parsed = value;
|
|
1279
|
+
} catch {
|
|
1280
|
+
return {
|
|
1281
|
+
content: "readPastedText requires a JSON object with pasteId.",
|
|
1282
|
+
metadata: { error: true, code: "invalid_arguments" }
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
const pasteId = Number(parsed.pasteId);
|
|
1286
|
+
if (!Number.isInteger(pasteId) || pasteId < 1) {
|
|
1287
|
+
return {
|
|
1288
|
+
content: "readPastedText requires a positive integer pasteId.",
|
|
1289
|
+
metadata: { error: true, code: "invalid_paste_id" }
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
const text = store.items.get(pasteId);
|
|
1293
|
+
if (text === void 0) {
|
|
1294
|
+
return {
|
|
1295
|
+
content: `pasted text #${pasteId} is no longer available in this TUI turn.`,
|
|
1296
|
+
metadata: { error: true, code: "paste_not_found", pasteId }
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
const lines = text.split("\n");
|
|
1300
|
+
const requestedStart = Number(parsed.startLine);
|
|
1301
|
+
const requestedEnd = Number(parsed.endLine);
|
|
1302
|
+
const startLine = Number.isInteger(requestedStart) && requestedStart > 0 ? Math.min(requestedStart, lines.length) : 1;
|
|
1303
|
+
const endLine = Math.min(
|
|
1304
|
+
lines.length,
|
|
1305
|
+
Number.isInteger(requestedEnd) && requestedEnd >= startLine ? requestedEnd : startLine + MAX_PASTED_TEXT_LINES_PER_READ - 1,
|
|
1306
|
+
startLine + MAX_PASTED_TEXT_LINES_PER_READ - 1
|
|
1307
|
+
);
|
|
1308
|
+
return {
|
|
1309
|
+
content: lines.slice(startLine - 1, endLine).join("\n"),
|
|
1310
|
+
metadata: {
|
|
1311
|
+
pasteId,
|
|
1312
|
+
startLine,
|
|
1313
|
+
endLine,
|
|
1314
|
+
totalLines: lines.length,
|
|
1315
|
+
totalChars: text.length,
|
|
1316
|
+
truncated: endLine < lines.length,
|
|
1317
|
+
source: "tui-paste-store"
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1147
1322
|
function buildCliWorkspaceToolExecutors(args) {
|
|
1148
1323
|
return buildNoloWorkspaceCliToolExecutors({
|
|
1149
1324
|
cliEntrypoint: args.cliEntrypoint ?? process.argv[1] ?? "",
|
|
@@ -1297,6 +1472,17 @@ function buildLocalToolExecutors(args) {
|
|
|
1297
1472
|
metadata: { uiAskChoice: true }
|
|
1298
1473
|
};
|
|
1299
1474
|
},
|
|
1475
|
+
// agent-orchestration 能力包:startAgentRun / controlAgentRun 本地 --bg 执行器
|
|
1476
|
+
// (复用 ~/.nolo/runs/ 注册表,MED-1 修复)。
|
|
1477
|
+
startAgentRun: createCliStartAgentRunExecutor({
|
|
1478
|
+
env: args.env,
|
|
1479
|
+
cliEntrypoint: args.cliEntrypoint,
|
|
1480
|
+
cwd: args.workspaceRoot
|
|
1481
|
+
}),
|
|
1482
|
+
controlAgentRun: createCliControlAgentRunExecutor({
|
|
1483
|
+
env: args.env
|
|
1484
|
+
}),
|
|
1485
|
+
...args.pastedTextStore ? { readPastedText: createReadPastedTextExecutor(args.pastedTextStore) } : {},
|
|
1300
1486
|
...args.localToolExecutors ?? {}
|
|
1301
1487
|
};
|
|
1302
1488
|
}
|
|
@@ -6920,6 +7106,7 @@ function toolResultText(result) {
|
|
|
6920
7106
|
function toolResultIsError(result) {
|
|
6921
7107
|
const meta = result.metadata;
|
|
6922
7108
|
if (!meta) return false;
|
|
7109
|
+
if (meta.error === true) return true;
|
|
6923
7110
|
if (typeof meta.error === "string" && meta.error.length > 0) return true;
|
|
6924
7111
|
if (typeof meta.exitCode === "number" && meta.exitCode !== 0) return true;
|
|
6925
7112
|
if (typeof meta.reason === "string" && meta.reason === "error") return true;
|
|
@@ -7226,6 +7413,28 @@ function synthesizeCursorExecToolCall(ctx, toolCallId, toolName, args) {
|
|
|
7226
7413
|
ctx.blocks.push(block);
|
|
7227
7414
|
return block;
|
|
7228
7415
|
}
|
|
7416
|
+
function toErrorMessage2(e) {
|
|
7417
|
+
if (e instanceof Error) return e.message;
|
|
7418
|
+
if (typeof e === "string") return e;
|
|
7419
|
+
try {
|
|
7420
|
+
return JSON.stringify(e);
|
|
7421
|
+
} catch {
|
|
7422
|
+
return String(e);
|
|
7423
|
+
}
|
|
7424
|
+
}
|
|
7425
|
+
function fillToolCallBlockError(toolCallBlock, error, extras) {
|
|
7426
|
+
const message = toErrorMessage2(error);
|
|
7427
|
+
const result = {
|
|
7428
|
+
content: message,
|
|
7429
|
+
metadata: {
|
|
7430
|
+
error: true,
|
|
7431
|
+
message,
|
|
7432
|
+
...extras ?? {}
|
|
7433
|
+
}
|
|
7434
|
+
};
|
|
7435
|
+
toolCallBlock.result = result;
|
|
7436
|
+
return result;
|
|
7437
|
+
}
|
|
7229
7438
|
function decodeMcpArgValue(value) {
|
|
7230
7439
|
try {
|
|
7231
7440
|
const parsed = fromBinary(ValueSchema, value);
|
|
@@ -7307,6 +7516,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7307
7516
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7308
7517
|
});
|
|
7309
7518
|
} catch (e) {
|
|
7519
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7310
7520
|
result = create(ReadResultSchema, {
|
|
7311
7521
|
result: {
|
|
7312
7522
|
case: "error",
|
|
@@ -7322,6 +7532,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7322
7532
|
});
|
|
7323
7533
|
}
|
|
7324
7534
|
} else {
|
|
7535
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7325
7536
|
result = create(ReadResultSchema, {
|
|
7326
7537
|
result: {
|
|
7327
7538
|
case: "rejected",
|
|
@@ -7375,6 +7586,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7375
7586
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7376
7587
|
});
|
|
7377
7588
|
} catch (e) {
|
|
7589
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7378
7590
|
result = create(ShellResultSchema, {
|
|
7379
7591
|
result: {
|
|
7380
7592
|
case: "failure",
|
|
@@ -7399,6 +7611,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7399
7611
|
});
|
|
7400
7612
|
}
|
|
7401
7613
|
} else {
|
|
7614
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7402
7615
|
result = create(ShellResultSchema, {
|
|
7403
7616
|
result: {
|
|
7404
7617
|
case: "rejected",
|
|
@@ -7474,6 +7687,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7474
7687
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7475
7688
|
});
|
|
7476
7689
|
} catch (e) {
|
|
7690
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7477
7691
|
result = create(GrepResultSchema, {
|
|
7478
7692
|
result: {
|
|
7479
7693
|
case: "error",
|
|
@@ -7489,6 +7703,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7489
7703
|
});
|
|
7490
7704
|
}
|
|
7491
7705
|
} else {
|
|
7706
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7492
7707
|
result = create(GrepResultSchema, {
|
|
7493
7708
|
result: {
|
|
7494
7709
|
case: "error",
|
|
@@ -7535,6 +7750,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7535
7750
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7536
7751
|
});
|
|
7537
7752
|
} catch (e) {
|
|
7753
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7538
7754
|
result = create(WriteResultSchema, {
|
|
7539
7755
|
result: {
|
|
7540
7756
|
case: "error",
|
|
@@ -7550,6 +7766,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7550
7766
|
});
|
|
7551
7767
|
}
|
|
7552
7768
|
} else {
|
|
7769
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7553
7770
|
result = create(WriteResultSchema, {
|
|
7554
7771
|
result: {
|
|
7555
7772
|
case: "rejected",
|
|
@@ -7592,6 +7809,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7592
7809
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7593
7810
|
});
|
|
7594
7811
|
} catch (e) {
|
|
7812
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7595
7813
|
result = create(DeleteResultSchema, {
|
|
7596
7814
|
result: {
|
|
7597
7815
|
case: "error",
|
|
@@ -7607,6 +7825,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7607
7825
|
});
|
|
7608
7826
|
}
|
|
7609
7827
|
} else {
|
|
7828
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7610
7829
|
result = create(DeleteResultSchema, {
|
|
7611
7830
|
result: {
|
|
7612
7831
|
case: "rejected",
|
|
@@ -7649,6 +7868,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7649
7868
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7650
7869
|
});
|
|
7651
7870
|
} catch (e) {
|
|
7871
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7652
7872
|
result = create(LsResultSchema, {
|
|
7653
7873
|
result: {
|
|
7654
7874
|
case: "error",
|
|
@@ -7664,6 +7884,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7664
7884
|
});
|
|
7665
7885
|
}
|
|
7666
7886
|
} else {
|
|
7887
|
+
fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
|
|
7667
7888
|
result = create(LsResultSchema, {
|
|
7668
7889
|
result: {
|
|
7669
7890
|
case: "rejected",
|
|
@@ -7710,6 +7931,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7710
7931
|
...toolResult.metadata ? { metadata: toolResult.metadata } : {}
|
|
7711
7932
|
});
|
|
7712
7933
|
} catch (e) {
|
|
7934
|
+
fillToolCallBlockError(toolCallBlock, e);
|
|
7713
7935
|
result = create(McpResultSchema, {
|
|
7714
7936
|
result: {
|
|
7715
7937
|
case: "error",
|
|
@@ -7725,6 +7947,10 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7725
7947
|
});
|
|
7726
7948
|
}
|
|
7727
7949
|
} else {
|
|
7950
|
+
fillToolCallBlockError(toolCallBlock, `Tool not found: ${toolName}`, {
|
|
7951
|
+
reason: "toolNotFound",
|
|
7952
|
+
toolName
|
|
7953
|
+
});
|
|
7728
7954
|
result = buildMcpToolNotFoundResult(toolName);
|
|
7729
7955
|
}
|
|
7730
7956
|
sendExecClientMessage(h2Request, execMsg, "mcpResult", result);
|
|
@@ -7736,15 +7962,6 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
|
|
|
7736
7962
|
}
|
|
7737
7963
|
}
|
|
7738
7964
|
}
|
|
7739
|
-
function toErrorMessage2(e) {
|
|
7740
|
-
if (e instanceof Error) return e.message;
|
|
7741
|
-
if (typeof e === "string") return e;
|
|
7742
|
-
try {
|
|
7743
|
-
return JSON.stringify(e);
|
|
7744
|
-
} catch {
|
|
7745
|
-
return String(e);
|
|
7746
|
-
}
|
|
7747
|
-
}
|
|
7748
7965
|
function clipArgumentsPreview(toolName, rawArgs) {
|
|
7749
7966
|
return summarizeToolArguments(toolName, rawArgs);
|
|
7750
7967
|
}
|
|
@@ -8039,9 +8256,41 @@ function buildOpenAiTools(args) {
|
|
|
8039
8256
|
const toolNameSet = new Set(args.toolNames ?? []);
|
|
8040
8257
|
const callAgentTools = toolNameSet.has("callAgent") ? prepareTools(["callAgent"]) : [];
|
|
8041
8258
|
const uiAskChoiceTools = toolNameSet.has("ui_ask_choice") ? prepareTools(["ui_ask_choice"]) : [];
|
|
8259
|
+
const readPastedTextTools = toolNameSet.has("readPastedText") ? [
|
|
8260
|
+
{
|
|
8261
|
+
type: "function",
|
|
8262
|
+
function: {
|
|
8263
|
+
name: "readPastedText",
|
|
8264
|
+
description: "Read a chunk of a large TUI paste by pasteId. Use startLine and endLine to page through the full content.",
|
|
8265
|
+
parameters: {
|
|
8266
|
+
type: "object",
|
|
8267
|
+
properties: {
|
|
8268
|
+
pasteId: {
|
|
8269
|
+
type: "integer",
|
|
8270
|
+
minimum: 1,
|
|
8271
|
+
description: "The paste id from the user message reference."
|
|
8272
|
+
},
|
|
8273
|
+
startLine: {
|
|
8274
|
+
type: "integer",
|
|
8275
|
+
minimum: 1,
|
|
8276
|
+
description: "First 1-based line to return; defaults to 1."
|
|
8277
|
+
},
|
|
8278
|
+
endLine: {
|
|
8279
|
+
type: "integer",
|
|
8280
|
+
minimum: 1,
|
|
8281
|
+
description: "Last 1-based line to return; each call is bounded to a 200-line chunk."
|
|
8282
|
+
}
|
|
8283
|
+
},
|
|
8284
|
+
required: ["pasteId"],
|
|
8285
|
+
additionalProperties: false
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
}
|
|
8289
|
+
] : [];
|
|
8042
8290
|
return [
|
|
8043
8291
|
...callAgentTools,
|
|
8044
8292
|
...uiAskChoiceTools,
|
|
8293
|
+
...readPastedTextTools,
|
|
8045
8294
|
...buildLocalWorkspaceOpenAiTools({
|
|
8046
8295
|
toolNames: toolset.toolNames,
|
|
8047
8296
|
exposeShellTools: toolset.exposeShellTools,
|
|
@@ -8057,7 +8306,13 @@ function buildOpenAiTools(args) {
|
|
|
8057
8306
|
searchFilesParameterVariant: resolveSearchFilesParameterVariant(args.env)
|
|
8058
8307
|
}),
|
|
8059
8308
|
...buildServerPlatformOpenAiTools({ toolNames: args.toolNames }),
|
|
8060
|
-
...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames })
|
|
8309
|
+
...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames }),
|
|
8310
|
+
// startAgentRun/controlAgentRun:CLI 本地 --bg 执行器已就绪(MED-1 修复,
|
|
8311
|
+
// cliAgentRunToolExecutors),只要 agent 声明(agent-orchestration 包展开)
|
|
8312
|
+
// 就注入 schema。
|
|
8313
|
+
...prepareTools(
|
|
8314
|
+
["startAgentRun", "controlAgentRun"].filter((name) => toolNameSet.has(name))
|
|
8315
|
+
)
|
|
8061
8316
|
];
|
|
8062
8317
|
}
|
|
8063
8318
|
var CLI_DEFAULT_TOOLS = ["exa_search", "fetchWebpage"];
|
|
@@ -8072,9 +8327,9 @@ function resolveCliEffectiveEnabledPacks(args) {
|
|
|
8072
8327
|
}
|
|
8073
8328
|
const base = args.enabledPacks ?? [];
|
|
8074
8329
|
if (base.length === 0) {
|
|
8075
|
-
return ["code"];
|
|
8330
|
+
return ["code", "agent-orchestration"];
|
|
8076
8331
|
}
|
|
8077
|
-
return base;
|
|
8332
|
+
return base.includes("agent-orchestration") ? base : [...base, "agent-orchestration"];
|
|
8078
8333
|
}
|
|
8079
8334
|
function resolveCliRequestedToolNames(agentConfig, env) {
|
|
8080
8335
|
const declaredOnly = shouldUseDeclaredOnlyLocalWorkspaceTools(env);
|
|
@@ -8101,8 +8356,13 @@ function resolveCliRequestedToolNames(agentConfig, env) {
|
|
|
8101
8356
|
agentConfig?.disabledTools
|
|
8102
8357
|
);
|
|
8103
8358
|
}
|
|
8104
|
-
function resolveProviderOpenAiToolBundle(agentConfig, env, buildTools = buildOpenAiTools) {
|
|
8105
|
-
const requestedToolNames =
|
|
8359
|
+
function resolveProviderOpenAiToolBundle(agentConfig, env, buildTools = buildOpenAiTools, additionalToolNames = []) {
|
|
8360
|
+
const requestedToolNames = [
|
|
8361
|
+
.../* @__PURE__ */ new Set([
|
|
8362
|
+
...resolveCliRequestedToolNames(agentConfig, env),
|
|
8363
|
+
...additionalToolNames
|
|
8364
|
+
])
|
|
8365
|
+
];
|
|
8106
8366
|
const tools = buildTools({
|
|
8107
8367
|
agentKey: agentConfig.key,
|
|
8108
8368
|
toolNames: requestedToolNames,
|
|
@@ -8121,25 +8381,17 @@ function buildLocalWorkspaceToolsetForEnv(args) {
|
|
|
8121
8381
|
return toolset;
|
|
8122
8382
|
}
|
|
8123
8383
|
function buildLocalPolicyToolNames(args) {
|
|
8384
|
+
const buildTools = args.buildTools ?? buildOpenAiTools;
|
|
8124
8385
|
return [
|
|
8125
|
-
...
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8386
|
+
...new Set(
|
|
8387
|
+
summarizeOpenAiToolNames(
|
|
8388
|
+
buildTools({
|
|
8389
|
+
agentKey: args.agentKey,
|
|
8390
|
+
toolNames: args.toolNames,
|
|
8391
|
+
env: args.env
|
|
8392
|
+
})
|
|
8130
8393
|
)
|
|
8131
|
-
|
|
8132
|
-
...(() => {
|
|
8133
|
-
const extra = [];
|
|
8134
|
-
const names = args.toolNames ?? [];
|
|
8135
|
-
for (const name of names) {
|
|
8136
|
-
if (REGISTRY_INJECTED_TOOL_NAMES.has(name)) extra.push(name);
|
|
8137
|
-
if (LOCAL_SERVER_TABLE_TOOL_NAME_SET.has(name)) extra.push(name);
|
|
8138
|
-
if (LOCAL_SERVER_WEB_TOOL_NAME_SET.has(name)) extra.push(name);
|
|
8139
|
-
}
|
|
8140
|
-
return extra;
|
|
8141
|
-
})(),
|
|
8142
|
-
...filterNoloWorkspaceToolNames(args.toolNames)
|
|
8394
|
+
)
|
|
8143
8395
|
];
|
|
8144
8396
|
}
|
|
8145
8397
|
function buildServerPlatformOpenAiTools(args) {
|
|
@@ -8464,6 +8716,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8464
8716
|
const localToolBudgets = parseLocalToolBudgets(deps.env);
|
|
8465
8717
|
const localToolUsage = /* @__PURE__ */ new Map();
|
|
8466
8718
|
const buildProviderOpenAiTools = deps.buildProviderOpenAiTools ?? buildOpenAiTools;
|
|
8719
|
+
const additionalToolNames = deps.pastedTextStore ? ["readPastedText"] : [];
|
|
8467
8720
|
let activeAgentToolNames = [];
|
|
8468
8721
|
const workspaceRoot = deps.cwd ?? process.cwd();
|
|
8469
8722
|
let runtimeToolExecutionLimits = {};
|
|
@@ -8477,6 +8730,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8477
8730
|
cliEntrypoint: CLI_ENTRYPOINT,
|
|
8478
8731
|
...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
|
|
8479
8732
|
...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
|
|
8733
|
+
...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
|
|
8480
8734
|
...runtimeToolExecutionLimits
|
|
8481
8735
|
});
|
|
8482
8736
|
return {
|
|
@@ -8493,7 +8747,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8493
8747
|
agentRef,
|
|
8494
8748
|
cwd: normalizeRuntimeCacheCwd(workspaceRoot)
|
|
8495
8749
|
});
|
|
8496
|
-
const cached = preparedAgentRuntimeCache.get(cacheKey);
|
|
8750
|
+
const cached = deps.pastedTextStore ? void 0 : preparedAgentRuntimeCache.get(cacheKey);
|
|
8497
8751
|
if (cached) {
|
|
8498
8752
|
activeAgentToolNames = cached.activeAgentToolNames;
|
|
8499
8753
|
runtimeToolExecutionLimits = cached.runtimeToolExecutionLimits;
|
|
@@ -8512,7 +8766,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8512
8766
|
);
|
|
8513
8767
|
const requestedToolNames = agentConfig ? resolveCliRequestedToolNames(agentConfig, deps.env) : [];
|
|
8514
8768
|
activeAgentToolNames = buildLocalPolicyToolNames({
|
|
8515
|
-
|
|
8769
|
+
agentKey: agentConfig?.key,
|
|
8770
|
+
toolNames: [...requestedToolNames, ...additionalToolNames],
|
|
8516
8771
|
env: deps.env
|
|
8517
8772
|
});
|
|
8518
8773
|
runtimeToolExecutionLimits = resolveLocalWorkspaceExecutorOptionsFromPolicy(
|
|
@@ -8528,9 +8783,10 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8528
8783
|
cliEntrypoint: CLI_ENTRYPOINT,
|
|
8529
8784
|
...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
|
|
8530
8785
|
...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
|
|
8786
|
+
...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
|
|
8531
8787
|
...runtimeToolExecutionLimits
|
|
8532
8788
|
});
|
|
8533
|
-
if (agentConfig) {
|
|
8789
|
+
if (agentConfig && !deps.pastedTextStore) {
|
|
8534
8790
|
preparedAgentRuntimeCache.set(cacheKey, {
|
|
8535
8791
|
agentConfig,
|
|
8536
8792
|
activeAgentToolNames,
|
|
@@ -8623,7 +8879,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8623
8879
|
const { requestedToolNames: requestedToolNames2, tools: tools2 } = resolveProviderOpenAiToolBundle(
|
|
8624
8880
|
agentConfig,
|
|
8625
8881
|
deps.env,
|
|
8626
|
-
buildProviderOpenAiTools
|
|
8882
|
+
buildProviderOpenAiTools,
|
|
8883
|
+
additionalToolNames
|
|
8627
8884
|
);
|
|
8628
8885
|
logLocalRuntimeDiagnostic("provider.selected", {
|
|
8629
8886
|
agentKey: agentConfig.key,
|
|
@@ -8703,7 +8960,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8703
8960
|
const { requestedToolNames: requestedToolNames2, tools: tools2 } = resolveProviderOpenAiToolBundle(
|
|
8704
8961
|
agentConfig,
|
|
8705
8962
|
deps.env,
|
|
8706
|
-
buildProviderOpenAiTools
|
|
8963
|
+
buildProviderOpenAiTools,
|
|
8964
|
+
additionalToolNames
|
|
8707
8965
|
);
|
|
8708
8966
|
logLocalRuntimeDiagnostic("provider.selected", {
|
|
8709
8967
|
agentKey: agentConfig.key,
|
|
@@ -8768,7 +9026,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8768
9026
|
const { requestedToolNames: requestedToolNames2, tools: tools2 } = resolveProviderOpenAiToolBundle(
|
|
8769
9027
|
agentConfig,
|
|
8770
9028
|
deps.env,
|
|
8771
|
-
buildProviderOpenAiTools
|
|
9029
|
+
buildProviderOpenAiTools,
|
|
9030
|
+
additionalToolNames
|
|
8772
9031
|
);
|
|
8773
9032
|
logLocalRuntimeDiagnostic("provider.selected", {
|
|
8774
9033
|
agentKey: agentConfig.key,
|
|
@@ -8850,7 +9109,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8850
9109
|
const { requestedToolNames: requestedToolNames2, tools: tools2 } = resolveProviderOpenAiToolBundle(
|
|
8851
9110
|
agentConfig,
|
|
8852
9111
|
deps.env,
|
|
8853
|
-
buildProviderOpenAiTools
|
|
9112
|
+
buildProviderOpenAiTools,
|
|
9113
|
+
additionalToolNames
|
|
8854
9114
|
);
|
|
8855
9115
|
return {
|
|
8856
9116
|
model: providerConfig2.model,
|
|
@@ -8889,8 +9149,18 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8889
9149
|
if (!res.ok) {
|
|
8890
9150
|
const raw2 = await res.text().catch(() => "");
|
|
8891
9151
|
const data2 = parsePlatformChatCompletionData(raw2);
|
|
9152
|
+
const rawPreview = raw2.length > 200 ? `${raw2.slice(0, 200)}\u2026(${raw2.length}b)` : raw2;
|
|
9153
|
+
const gatewayHeaders = [
|
|
9154
|
+
"server",
|
|
9155
|
+
"cf-ray",
|
|
9156
|
+
"cf-cache-status",
|
|
9157
|
+
"content-length"
|
|
9158
|
+
].map((h) => {
|
|
9159
|
+
const v = res.headers.get(h);
|
|
9160
|
+
return v ? `${h}=${v}` : null;
|
|
9161
|
+
}).filter(Boolean).join(" ");
|
|
8892
9162
|
throw new Error(
|
|
8893
|
-
`platform provider failed: HTTP ${res.status} ${JSON.stringify(data2)}`
|
|
9163
|
+
`platform provider failed: HTTP ${res.status} ${JSON.stringify(data2)}` + (rawPreview ? ` raw="${rawPreview}"` : "") + (gatewayHeaders ? ` headers=[${gatewayHeaders}]` : "")
|
|
8894
9164
|
);
|
|
8895
9165
|
}
|
|
8896
9166
|
const contentType = res.headers.get("content-type") ?? "";
|
|
@@ -8959,7 +9229,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
8959
9229
|
const { requestedToolNames, tools } = resolveProviderOpenAiToolBundle(
|
|
8960
9230
|
agentConfig,
|
|
8961
9231
|
deps.env,
|
|
8962
|
-
buildProviderOpenAiTools
|
|
9232
|
+
buildProviderOpenAiTools,
|
|
9233
|
+
additionalToolNames
|
|
8963
9234
|
);
|
|
8964
9235
|
return {
|
|
8965
9236
|
model: providerConfig.model,
|