nolo-cli 0.157.0-alpha.1 → 0.159.0-alpha.1
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-5WS2PA62.js → _executeModel-JISIM4PS.js} +41 -41
- package/{accountResolver-7RYB4D2P.js → accountResolver-55EDKEIK.js} +1 -1
- package/{action-ZJYUBXFC.js → action-GPPJC5TI.js} +4 -4
- package/{addContentAction-TVHB4526.js → addContentAction-BI6RDRTQ.js} +7 -7
- package/{addDialogAgentAction-FDPBU6K6.js → addDialogAgentAction-4RJYUSIK.js} +6 -6
- package/{agentDeleteCommand-Q6M4F3U6.js → agentDeleteCommand-2NMZDFL5.js} +54 -54
- package/{agentEmailCommands-FNH6FEHS.js → agentEmailCommands-VQ2QGKL4.js} +56 -56
- package/{agentListCommands-JUNMFS6E.js → agentListCommands-3CJ4GF6C.js} +21 -21
- package/{agentMachineCommands-VNLDEKNT.js → agentMachineCommands-BMOEPV5C.js} +20 -19
- package/{agentProviderCommands-X2HQE6HY.js → agentProviderCommands-CUBOAVPB.js} +2 -2
- package/{agentRecordCommands-47XXRVPI.js → agentRecordCommands-XRB7BLWV.js} +54 -54
- package/{agentRunCommand-QEXFJUXQ.js → agentRunCommand-VKCTAW55.js} +56 -55
- package/{agentRunControl-2C5GM3BW.js → agentRunControl-PPYWJRIJ.js} +4 -4
- package/{agentRuntimeLocal-O5GDAFTN.js → agentRuntimeLocal-7JDS3OAL.js} +14 -14
- package/{agentSlice-E3XS5FTQ.js → agentSlice-ST6QQ5FD.js} +7 -7
- package/{appDeleteCommands-C2J5RQ3I.js → appDeleteCommands-UVWHW4TJ.js} +19 -19
- package/{appDeployCommands-3YRK7PSU.js → appDeployCommands-67JPR4JU.js} +19 -19
- package/{appDeployStatusCommands-FPAX7MOK.js → appDeployStatusCommands-UTC6IR5V.js} +19 -19
- package/{appGetCommands-XAC2V766.js → appGetCommands-KLLIGWNC.js} +19 -19
- package/{appListCommands-ZJL2W5O7.js → appListCommands-AZKNWJUR.js} +19 -19
- package/{authCommand-J3XILHWW.js → authCommand-MSINEFHH.js} +12 -292
- package/{authCommands-77CHYBGF.js → authCommands-AMNIAKEG.js} +2 -2
- package/{builtinSkillRegistry-A6VSPJEJ.js → builtinSkillRegistry-H3AY27TR.js} +1 -1
- package/{chromeCommands-OBBNJCLS.js → chromeCommands-IY4NVSXZ.js} +17 -10
- package/{chunk-SW4S4XYB.js → chunk-2AB2HA4M.js} +84 -34
- package/{chunk-Z6KQDSZW.js → chunk-2SGAI64X.js} +2 -2
- package/{chunk-C5VPAHIU.js → chunk-32ZKZET7.js} +1 -1
- package/{chunk-XPWGOTBQ.js → chunk-3L2WKC3W.js} +1 -8
- package/{chunk-MM3662RS.js → chunk-42W7LKBM.js} +1 -1
- package/{chunk-FPWT3RH2.js → chunk-4CYTNZG3.js} +14 -14
- package/{chunk-L6EQV5OC.js → chunk-4JOZECCA.js} +3 -3
- package/{chunk-YBNHPX4S.js → chunk-4RJJDA57.js} +1 -1
- package/{chunk-B2EGWZJG.js → chunk-5MPS5OOY.js} +1 -1
- package/{chunk-TRW43TSC.js → chunk-6EQD4AQL.js} +41 -1
- package/{chunk-UUPR3TD7.js → chunk-7RF4O6AT.js} +1 -3
- package/{chunk-ZD2BLOY6.js → chunk-B5MSFO6R.js} +3 -3
- package/{chunk-2GGXHQIW.js → chunk-BLVSFYQ3.js} +4 -2
- package/{chunk-UTIMX333.js → chunk-C3WXTFRP.js} +1 -1
- package/{chunk-ROPSATAB.js → chunk-CON6SI7N.js} +1 -1
- package/{chunk-4Z245KOA.js → chunk-DC3SZCRR.js} +6 -2
- package/{chunk-X5SUT4CN.js → chunk-DD7BZWJ6.js} +6 -6
- package/{chunk-ANJTRG52.js → chunk-DFWLD7WU.js} +1 -38
- package/{chunk-PSJWPSKS.js → chunk-EWO77ZGF.js} +9 -43
- package/{chunk-DW7MGLMG.js → chunk-FUNTOSV3.js} +26 -22
- package/{chunk-MVJVF4ED.js → chunk-FVZVJA54.js} +7 -6
- package/{chunk-ZWG3C7VI.js → chunk-GB552UJS.js} +36 -1
- package/{chunk-EJU23ST5.js → chunk-GJNYJH7O.js} +682 -639
- package/{chunk-6MJNEXUU.js → chunk-HGDKT2D6.js} +4 -0
- package/{chunk-QDA4Y5O6.js → chunk-HXSN43Y5.js} +21 -17
- package/{chunk-7GC3EKUG.js → chunk-IE7G4BF5.js} +3 -3
- package/{chunk-T6CBQ6BN.js → chunk-INFHX73M.js} +1 -1
- package/{chunk-CE7PIHQD.js → chunk-IRTOYSA2.js} +3 -3
- package/{chunk-PEO24UB5.js → chunk-IULXURBL.js} +39 -12
- package/{chunk-WZ6OU4NX.js → chunk-J2ATF74A.js} +2 -2
- package/{chunk-SKPPKHD3.js → chunk-J4S44CSW.js} +2 -2
- package/{chunk-KOB75UNU.js → chunk-JKXXZUO4.js} +18 -2
- package/{chunk-K43ZF2C3.js → chunk-JPPQ3GUO.js} +1 -1
- package/{chunk-RUNKPFM5.js → chunk-JPSTJHGJ.js} +12 -8
- package/{chunk-I2ZMGXXF.js → chunk-KFHREHUQ.js} +1 -1
- package/{chunk-3C2QLERX.js → chunk-KMDDG73K.js} +1 -1
- package/{chunk-TZTWMGE3.js → chunk-M2P3OGXZ.js} +3 -3
- package/{chunk-IPAW7XLD.js → chunk-MFVOJ6KF.js} +2 -2
- package/{chunk-2MTE2PEH.js → chunk-MGSNS22D.js} +1 -1
- package/{chunk-FDT27L7S.js → chunk-MJKKEGF5.js} +8 -6
- package/{chunk-H4KACZMG.js → chunk-MNRZCEYU.js} +263 -128
- package/{chunk-CBHGZRCE.js → chunk-MYOH447Z.js} +1 -1
- package/{chunk-6MPAEODB.js → chunk-NDZOXXIM.js} +17 -3
- package/{chunk-VAZHH6FO.js → chunk-NJTXRGCJ.js} +18 -12
- package/{chunk-G47IPDOK.js → chunk-NUE735UT.js} +1 -1
- package/{chunk-HKT6QXP3.js → chunk-O4KVUI4W.js} +2 -2
- package/{chunk-36OMEXXR.js → chunk-OON4OBWI.js} +1 -1
- package/{chunk-7A4LJCDR.js → chunk-OVQFMCVI.js} +4 -4
- package/{chunk-SUKSWFLP.js → chunk-PIG2IUVZ.js} +1 -1
- package/{chunk-OH2M7WEU.js → chunk-PIYYH2LE.js} +3 -3
- package/{chunk-EM3YOZJ4.js → chunk-PKC7D6SX.js} +3 -3
- package/{chunk-SEJ5OS6F.js → chunk-PXYBUFDB.js} +4 -0
- package/{chunk-TYND6RDQ.js → chunk-QI2WVWXV.js} +73 -2
- package/{chunk-IYBIRCQV.js → chunk-QOYJE6NX.js} +1 -1
- package/{chunk-TNIX77YM.js → chunk-R5GO3YZP.js} +34 -1
- package/{chunk-XFKZ3MCV.js → chunk-R6ABE4UC.js} +223 -67
- package/{chunk-KX6LPG7W.js → chunk-RE5I35J7.js} +2 -2
- package/{chunk-VSOWPETY.js → chunk-RGYDJ352.js} +7 -7
- package/{chunk-D4OWHT5Y.js → chunk-SPKLALBU.js} +2 -2
- package/{chunk-JGRPBIZZ.js → chunk-SQX235S2.js} +1 -1
- package/{chunk-6TF64IF2.js → chunk-U6TTTB6V.js} +16 -2
- package/{chunk-3XZKV7QQ.js → chunk-US6MKPE7.js} +1 -1
- package/{chunk-I2RMFLLH.js → chunk-V7PCFWX3.js} +1 -1
- package/{chunk-HXHSTRGH.js → chunk-VYNMQ6HW.js} +0 -27
- package/{chunk-7BSQK2UC.js → chunk-WRCZXJ4N.js} +2 -2
- package/{chunk-ZEHTARJA.js → chunk-XEF4HW56.js} +42 -96
- package/chunk-Y5GCAMGP.js +9 -0
- package/{chunk-7KYVUFDG.js → chunk-YNCJYU4X.js} +2 -264
- package/{chunk-SCJD2PNK.js → chunk-YPG7TUQD.js} +3 -3
- package/{chunk-TJ2VPCBE.js → chunk-ZIGIN5IX.js} +2 -2
- package/{chunk-YANF2RR4.js → chunk-ZPKUJROL.js} +1 -1
- package/{chunk-HP6O6LTV.js → chunk-ZVQHBIWV.js} +6 -6
- package/{commandRegistry-OUBQIF62.js → commandRegistry-ROBNQFWA.js} +79 -87
- package/{contentThunks-B3FRQGP7.js → contentThunks-EWOJGG2I.js} +17 -16
- package/{createAgentAutomationAction-T2YFJ6MY.js → createAgentAutomationAction-I43ICGXU.js} +17 -16
- package/{createDialogAction-2NFGFBXW.js → createDialogAction-IIAHRXND.js} +18 -17
- package/{createPageAction-LDAVZDN7.js → createPageAction-OVK7PG4L.js} +17 -16
- package/{dbSlice-5QGKMQLO.js → dbSlice-DC2J53RC.js} +6 -6
- package/{deleteFile-EW6QNRRT.js → deleteFile-KYWEMNFX.js} +4 -4
- package/{dialogCommands-ZLBEAQHE.js → dialogCommands-K4OVKDYD.js} +22 -21
- package/{dialogSlice-64S3J6CP.js → dialogSlice-U22CFPRN.js} +16 -15
- package/{docCreateCommands-XOG5BBFQ.js → docCreateCommands-GI377ZFI.js} +17 -17
- package/{docDeleteCommands-NCW3BBRX.js → docDeleteCommands-NBQNTVHB.js} +18 -18
- package/{docReadCommands-OT7X44Y3.js → docReadCommands-6SKEW6AO.js} +17 -17
- package/{docStore-NIP7OO4I.js → docStore-SS2QUBG6.js} +7 -7
- package/{docUpdateCommands-JW7OWW2J.js → docUpdateCommands-NJ7JD6VA.js} +17 -17
- package/{getPricing-TX35D7PI.js → getPricing-XQ3N3RBP.js} +2 -2
- package/{handleSendMessageAction-TOKA7ED7.js → handleSendMessageAction-YVPRHPQR.js} +30 -29
- package/index.js +7 -7
- package/{localRuntimeAdapter-EQM6LFYC.js → localRuntimeAdapter-CC7ZPJRV.js} +54 -52
- package/{machineCommands-WJ7FZ67T.js → machineCommands-XEWIUHTY.js} +58 -56
- package/{machineWsRunDispatch-BQT4DEA2.js → machineWsRunDispatch-JYEWCXGP.js} +53 -53
- package/{memberThunks-KRV5YXOB.js → memberThunks-2DWKLE6W.js} +7 -7
- package/package.json +1 -1
- package/{profileConfig-ZGOFORWV.js → profileConfig-KN3N2BLF.js} +7 -1
- package/{providerPresetApply-CRZFMQD5.js → providerPresetApply-PKUOHQJT.js} +5 -5
- package/{providerRegistry-7IS43D3X.js → providerRegistry-HNQLIFN2.js} +5 -5
- package/{read-5KAZHHDM.js → read-L7QEJETH.js} +4 -4
- package/{readDocTool-5QO34OSX.js → readDocTool-QELXV2GW.js} +1 -1
- package/{readlineWorkspace-JHJSU5DS.js → readlineWorkspace-7MZPTN5U.js} +330 -117
- package/{removeDialogAgentAction-6X63HMI3.js → removeDialogAgentAction-376XSUP2.js} +8 -8
- package/{runAgentClientLoop-5QIGEALK.js → runAgentClientLoop-MLEVVWUH.js} +45 -40
- package/{runtimeDoctorCommands-56NWKNON.js → runtimeDoctorCommands-HEN5IPIH.js} +4 -4
- package/{secretCommands-ZXZRLR3R.js → secretCommands-DNY56NSU.js} +11 -1
- package/{setDialogExtraReferencesAction-4MAYKKYW.js → setDialogExtraReferencesAction-QBDSH63D.js} +7 -7
- package/{setPrimaryDialogAgentAction-EGBAMREH.js → setPrimaryDialogAgentAction-537QFGW3.js} +8 -8
- package/settingThunks-4Z43ZSAT.js +923 -0
- package/{spaceCommands-ZWDPTURU.js → spaceCommands-UM3ZQKJU.js} +17 -17
- package/{streamAgentChatTurn-456DWXNY.js → streamAgentChatTurn-J7HYND6V.js} +48 -48
- package/{switchDialogAgentAction-YBKTD6DO.js → switchDialogAgentAction-CSO6AKRL.js} +6 -6
- package/{tableCommands-U3QDY4L6.js → tableCommands-LBH3QPPO.js} +1 -1
- package/{toolApiClient-7WSJJJBV.js → toolApiClient-HGNO53TC.js} +2 -2
- package/{tools-IWNXKK4Y.js → tools-3CEH74XY.js} +34 -33
- package/{tuiSummaryLlmCaller-KLK6K3Q3.js → tuiSummaryLlmCaller-VSNIIH63.js} +6 -6
- package/{updateCommands-NQXAGFM7.js → updateCommands-LXZLG44Y.js} +2 -2
- package/{updateDialogTitleAction-SX53FZWO.js → updateDialogTitleAction-C557RTYG.js} +17 -16
- package/{workloadLifecycle-36DXRZKU.js → workloadLifecycle-6O6PMISX.js} +2 -2
- package/chunk-W4S6OTSC.js +0 -35
- package/settingThunks-FTDRZNSJ.js +0 -1371
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
anthropicRefresh,
|
|
3
3
|
cursorRefresh,
|
|
4
|
-
getWorkBuddyHeaders,
|
|
5
4
|
refreshAntigravityOAuthToken,
|
|
6
5
|
refreshOpenAiCodexToken,
|
|
7
6
|
resolveServerSyncConfig,
|
|
8
|
-
workbuddyRefresh,
|
|
9
7
|
xaiRefresh
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YNCJYU4X.js";
|
|
11
9
|
import {
|
|
12
10
|
clearCredentialAvailability,
|
|
13
11
|
markCredentialUnavailable,
|
|
@@ -18,14 +16,14 @@ import {
|
|
|
18
16
|
import {
|
|
19
17
|
agentRunCardLabels,
|
|
20
18
|
t
|
|
21
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2AB2HA4M.js";
|
|
22
20
|
import {
|
|
23
21
|
defaultLoopbackRequest
|
|
24
22
|
} from "./chunk-VP3BINY7.js";
|
|
25
23
|
import {
|
|
26
24
|
OAUTH_PROVIDER_REFS,
|
|
27
25
|
buildLocalAgentLookupKeys
|
|
28
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-7RF4O6AT.js";
|
|
29
27
|
import {
|
|
30
28
|
LOCAL_CODEX_AGENT_ID,
|
|
31
29
|
LOCAL_CODEX_AGENT_KEY,
|
|
@@ -41,10 +39,14 @@ import {
|
|
|
41
39
|
isCursorOAuthAgent
|
|
42
40
|
} from "./chunk-VIWDGTDA.js";
|
|
43
41
|
import {
|
|
42
|
+
SANDBOX_HELPER_PATH,
|
|
43
|
+
SANDBOX_OUTPUT_LIMITS,
|
|
44
44
|
SANDBOX_WORKSPACE_ROOT,
|
|
45
45
|
buildSandboxHelperUploadArgv,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
buildWorkspaceHelperSource,
|
|
47
|
+
dockerExecutionToolNames,
|
|
48
|
+
parseToolOutput
|
|
49
|
+
} from "./chunk-HGDKT2D6.js";
|
|
48
50
|
import {
|
|
49
51
|
createChromeConnectorClientResolver,
|
|
50
52
|
createVerifiedChromeConnectorClient,
|
|
@@ -52,17 +54,17 @@ import {
|
|
|
52
54
|
} from "./chunk-BU2YQBV4.js";
|
|
53
55
|
import {
|
|
54
56
|
applyPublicAgentCatalogOverride
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-MFVOJ6KF.js";
|
|
56
58
|
import {
|
|
57
59
|
buildCliPrompt
|
|
58
60
|
} from "./chunk-ATNTHIZI.js";
|
|
59
61
|
import {
|
|
60
62
|
inferCaptureIntent
|
|
61
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-INFHX73M.js";
|
|
62
64
|
import {
|
|
63
65
|
inlineImageUrlsForCustomProvider,
|
|
64
66
|
prepareTools
|
|
65
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-J4S44CSW.js";
|
|
66
68
|
import {
|
|
67
69
|
getServerProviderSecret
|
|
68
70
|
} from "./chunk-HS7MLR74.js";
|
|
@@ -84,18 +86,18 @@ import {
|
|
|
84
86
|
resolveCliLocalRuntimeKeyCapability,
|
|
85
87
|
resolveCliLocalSpawnDispatch,
|
|
86
88
|
resolveStartAgentRunCwd
|
|
87
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-R6ABE4UC.js";
|
|
88
90
|
import {
|
|
89
91
|
deriveCredentialGroup,
|
|
90
92
|
deriveCustomProviderCredentialGroup
|
|
91
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-RE5I35J7.js";
|
|
92
94
|
import {
|
|
93
95
|
fetchWithTransientRetry,
|
|
94
96
|
isTransientFetchError
|
|
95
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-KFHREHUQ.js";
|
|
96
98
|
import {
|
|
97
99
|
resolveAgentRequiredPackIds
|
|
98
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-JPSTJHGJ.js";
|
|
99
101
|
import {
|
|
100
102
|
applyBuiltinAgentRuntimeOverride,
|
|
101
103
|
applyTokenUsageToDayStats,
|
|
@@ -104,7 +106,7 @@ import {
|
|
|
104
106
|
resolveBuiltinPlatformAgentConfig,
|
|
105
107
|
runKeyed,
|
|
106
108
|
validateAskChoiceInput
|
|
107
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-MNRZCEYU.js";
|
|
108
110
|
import {
|
|
109
111
|
BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
|
|
110
112
|
BUILTIN_TITLE_LLM_CONFIG
|
|
@@ -114,7 +116,7 @@ import {
|
|
|
114
116
|
} from "./chunk-UKZX3NHN.js";
|
|
115
117
|
import {
|
|
116
118
|
fetchServerSyncedCredential
|
|
117
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-DD7BZWJ6.js";
|
|
118
120
|
import {
|
|
119
121
|
isTombstoneRecord
|
|
120
122
|
} from "./chunk-D2MDMY2M.js";
|
|
@@ -171,7 +173,7 @@ import {
|
|
|
171
173
|
runExecShellGates,
|
|
172
174
|
validateConfiguredRootExecutionLease,
|
|
173
175
|
verifyOwnerRouteAck
|
|
174
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-IULXURBL.js";
|
|
175
177
|
import {
|
|
176
178
|
accumulateGeminiChunks,
|
|
177
179
|
buildGeminiGenerateContentRequest,
|
|
@@ -183,7 +185,7 @@ import {
|
|
|
183
185
|
resolveAntigravityFinishReason,
|
|
184
186
|
resolveGeminiModelQuirks,
|
|
185
187
|
shouldUseGeminiNativeToolRoute
|
|
186
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-KMDDG73K.js";
|
|
187
189
|
import {
|
|
188
190
|
PlatformStreamInterruptedError,
|
|
189
191
|
buildPlatformChatCompletionRequest,
|
|
@@ -194,27 +196,24 @@ import {
|
|
|
194
196
|
readPlatformChatSseCompletion,
|
|
195
197
|
resolvePlatformChatProviderConfig,
|
|
196
198
|
shouldUsePlatformChatProvider
|
|
197
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-4JOZECCA.js";
|
|
198
200
|
import {
|
|
199
201
|
readSseDataValues,
|
|
200
202
|
readSseFrames
|
|
201
203
|
} from "./chunk-HNUWUO75.js";
|
|
202
204
|
import {
|
|
203
205
|
resolveAgentRuntimeConfigFromRecord
|
|
204
|
-
} from "./chunk-
|
|
205
|
-
import {
|
|
206
|
-
isDevinOAuthAgent
|
|
207
|
-
} from "./chunk-5ZUL4CUO.js";
|
|
206
|
+
} from "./chunk-DFWLD7WU.js";
|
|
208
207
|
import {
|
|
209
208
|
resolveHistoricalToolContentCap
|
|
210
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-QOYJE6NX.js";
|
|
211
210
|
import {
|
|
212
211
|
collectStablePromptPrefix,
|
|
213
212
|
convertMessagesToResponsesInput,
|
|
214
213
|
findAgentStatePairingIssues,
|
|
215
214
|
stablePromptCacheKey,
|
|
216
215
|
toResponsesTools
|
|
217
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-U6TTTB6V.js";
|
|
218
217
|
import {
|
|
219
218
|
buildNoloWorkspaceOpenAiTools,
|
|
220
219
|
parseNoloWorkspaceToolArguments,
|
|
@@ -232,14 +231,17 @@ import {
|
|
|
232
231
|
} from "./chunk-2MBTWINN.js";
|
|
233
232
|
import {
|
|
234
233
|
normalizeUsage
|
|
235
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-GB552UJS.js";
|
|
235
|
+
import {
|
|
236
|
+
isDevinOAuthAgent
|
|
237
|
+
} from "./chunk-5ZUL4CUO.js";
|
|
236
238
|
import {
|
|
237
239
|
createProviderCallTimingTracker,
|
|
238
240
|
finalizeProviderCallTiming,
|
|
239
241
|
observeMeaningfulProviderResponse,
|
|
240
242
|
observeMeaningfulProviderResponseAt,
|
|
241
243
|
withProviderCallTimingFields
|
|
242
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-MGSNS22D.js";
|
|
243
245
|
import {
|
|
244
246
|
clipCompactText
|
|
245
247
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -280,7 +282,7 @@ import {
|
|
|
280
282
|
} from "./chunk-5EMSBTQ6.js";
|
|
281
283
|
import {
|
|
282
284
|
isAntigravityOAuthAgent
|
|
283
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-SQX235S2.js";
|
|
284
286
|
import {
|
|
285
287
|
ackRunRecord,
|
|
286
288
|
appendRunQueue,
|
|
@@ -301,7 +303,7 @@ import {
|
|
|
301
303
|
terminateRunProcess,
|
|
302
304
|
transitionRunToTerminal,
|
|
303
305
|
withQueueLock
|
|
304
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-42W7LKBM.js";
|
|
305
307
|
import {
|
|
306
308
|
TASK_PREVIEW_MAX,
|
|
307
309
|
formatListRunsCard,
|
|
@@ -321,12 +323,12 @@ import {
|
|
|
321
323
|
import {
|
|
322
324
|
buildProviderSessionHeaders,
|
|
323
325
|
resolvePlatformAuthToken
|
|
324
|
-
} from "./chunk-
|
|
326
|
+
} from "./chunk-PIG2IUVZ.js";
|
|
325
327
|
import {
|
|
326
328
|
anthropicOAuthModelMaxOutputTokens,
|
|
327
329
|
findModelConfig,
|
|
328
330
|
isAdaptiveThinkingModelId
|
|
329
|
-
} from "./chunk-
|
|
331
|
+
} from "./chunk-6EQD4AQL.js";
|
|
330
332
|
import {
|
|
331
333
|
CLI_PROVIDER_VALUES,
|
|
332
334
|
isCliProvider
|
|
@@ -3301,447 +3303,6 @@ var resolveDevinTransport = async (ctx) => {
|
|
|
3301
3303
|
return null;
|
|
3302
3304
|
};
|
|
3303
3305
|
|
|
3304
|
-
// packages/agent-runtime/workbuddyRequestAdapter.ts
|
|
3305
|
-
var DEFAULT_SYSTEM = "You are a helpful assistant.";
|
|
3306
|
-
var SAFE_NAME = /^[A-Za-z0-9_-]{1,64}$/;
|
|
3307
|
-
function record(value) {
|
|
3308
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3309
|
-
}
|
|
3310
|
-
function safeName(name, reserved) {
|
|
3311
|
-
const stem = name.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 48) || "tool";
|
|
3312
|
-
let candidate = stem;
|
|
3313
|
-
if (reserved.has(candidate)) {
|
|
3314
|
-
let suffix = 1;
|
|
3315
|
-
do
|
|
3316
|
-
candidate = `${stem.slice(0, 64 - String(suffix).length - 1)}_${suffix++}`;
|
|
3317
|
-
while (reserved.has(candidate));
|
|
3318
|
-
}
|
|
3319
|
-
reserved.add(candidate);
|
|
3320
|
-
return candidate;
|
|
3321
|
-
}
|
|
3322
|
-
function adaptSchema(schema, path) {
|
|
3323
|
-
if (!record(schema)) throw new TypeError(`${path} must be a JSON Schema object`);
|
|
3324
|
-
if (schema.type !== "object" && schema.type !== "array" && schema.type !== "string" && schema.type !== "number" && schema.type !== "integer" && schema.type !== "boolean" && schema.type !== "null" && schema.type !== void 0) throw new TypeError(`${path}.type is unsupported`);
|
|
3325
|
-
if (schema.properties !== void 0) {
|
|
3326
|
-
if (!record(schema.properties)) throw new TypeError(`${path}.properties must be an object`);
|
|
3327
|
-
for (const [key, value] of Object.entries(schema.properties)) adaptSchema(value, `${path}.properties.${key}`);
|
|
3328
|
-
}
|
|
3329
|
-
for (const key of ["items", "additionalProperties", "not", "if", "then", "else"]) {
|
|
3330
|
-
const value = schema[key];
|
|
3331
|
-
if (value === false || value === true) continue;
|
|
3332
|
-
if (record(value)) adaptSchema(value, `${path}.${key}`);
|
|
3333
|
-
else if (Array.isArray(value)) value.forEach((item, i) => adaptSchema(item, `${path}.${key}[${i}]`));
|
|
3334
|
-
}
|
|
3335
|
-
for (const key of ["oneOf", "anyOf", "allOf", "prefixItems"]) {
|
|
3336
|
-
if (schema[key] !== void 0) {
|
|
3337
|
-
if (!Array.isArray(schema[key])) throw new TypeError(`${path}.${key} must be an array`);
|
|
3338
|
-
schema[key].forEach((item, i) => adaptSchema(item, `${path}.${key}[${i}]`));
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
function adaptWorkBuddyRequest(body) {
|
|
3343
|
-
const adapted = structuredClone(body);
|
|
3344
|
-
const originalNames = /* @__PURE__ */ Object.create(null);
|
|
3345
|
-
const safeToOriginal = /* @__PURE__ */ new Map();
|
|
3346
|
-
const tools = adapted.tools;
|
|
3347
|
-
if (tools !== void 0 && !Array.isArray(tools)) throw new TypeError("tools must be an array");
|
|
3348
|
-
const reserved = /* @__PURE__ */ new Set();
|
|
3349
|
-
for (const tool of tools ?? []) {
|
|
3350
|
-
if (!record(tool) || !record(tool.function) || typeof tool.function.name !== "string") throw new TypeError("Each tool must have a named function");
|
|
3351
|
-
if (SAFE_NAME.test(tool.function.name)) reserved.add(tool.function.name);
|
|
3352
|
-
}
|
|
3353
|
-
for (const tool of tools ?? []) {
|
|
3354
|
-
const fn = tool.function;
|
|
3355
|
-
const original = fn.name;
|
|
3356
|
-
if (!SAFE_NAME.test(original)) {
|
|
3357
|
-
const safe = safeName(original, reserved);
|
|
3358
|
-
Object.defineProperty(originalNames, safe, { value: original, enumerable: true, configurable: true, writable: true });
|
|
3359
|
-
safeToOriginal.set(safe, original);
|
|
3360
|
-
fn.name = safe;
|
|
3361
|
-
}
|
|
3362
|
-
if (fn.parameters !== void 0) {
|
|
3363
|
-
if (!record(fn.parameters)) throw new TypeError(`Tool ${original} parameters must be a JSON Schema object`);
|
|
3364
|
-
adaptSchema(fn.parameters, `Tool ${original} parameters`);
|
|
3365
|
-
if (fn.parameters.type !== "object") throw new TypeError(`Tool ${original} parameters root must be type object`);
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
|
-
const safeFor = (name) => typeof name === "string" ? [...safeToOriginal].find(([, original]) => original === name)?.[0] : void 0;
|
|
3369
|
-
if (Array.isArray(adapted.messages)) {
|
|
3370
|
-
for (const message of adapted.messages) {
|
|
3371
|
-
if (!record(message)) continue;
|
|
3372
|
-
if (message.role === "developer") message.role = "system";
|
|
3373
|
-
if (Array.isArray(message.tool_calls)) for (const call of message.tool_calls) {
|
|
3374
|
-
if (record(call) && record(call.function)) call.function.name = safeFor(call.function.name) ?? call.function.name;
|
|
3375
|
-
}
|
|
3376
|
-
if (message.role === "tool") message.name = safeFor(message.name) ?? message.name;
|
|
3377
|
-
}
|
|
3378
|
-
if (!adapted.messages.some((message) => record(message) && message.role === "system")) adapted.messages.unshift({ role: "system", content: DEFAULT_SYSTEM });
|
|
3379
|
-
} else adapted.messages = [{ role: "system", content: DEFAULT_SYSTEM }];
|
|
3380
|
-
const choice = adapted.tool_choice;
|
|
3381
|
-
if (choice === "none") delete adapted.tools;
|
|
3382
|
-
else if (record(choice) && record(choice.function)) choice.function.name = safeFor(choice.function.name) ?? choice.function.name;
|
|
3383
|
-
else if (typeof choice === "string" && !["auto", "required", "none"].includes(choice)) adapted.tool_choice = { type: "function", function: { name: safeFor(choice) ?? choice } };
|
|
3384
|
-
if (adapted.max_completion_tokens !== void 0) {
|
|
3385
|
-
if (adapted.max_tokens === void 0) adapted.max_tokens = adapted.max_completion_tokens;
|
|
3386
|
-
delete adapted.max_completion_tokens;
|
|
3387
|
-
}
|
|
3388
|
-
adapted.stream = true;
|
|
3389
|
-
return { body: adapted, originalNames };
|
|
3390
|
-
}
|
|
3391
|
-
function restoreWorkBuddyToolNames(payload, originalNames) {
|
|
3392
|
-
const copy = structuredClone(payload);
|
|
3393
|
-
if (!record(copy) || !Array.isArray(copy.choices)) return copy;
|
|
3394
|
-
for (const choice of copy.choices) for (const part of [choice?.delta, choice?.message]) {
|
|
3395
|
-
if (!record(part) || !Array.isArray(part.tool_calls)) continue;
|
|
3396
|
-
for (const call of part.tool_calls) {
|
|
3397
|
-
if (!record(call) || !record(call.function) || typeof call.function.name !== "string") continue;
|
|
3398
|
-
if (Object.prototype.hasOwnProperty.call(originalNames, call.function.name)) call.function.name = originalNames[call.function.name];
|
|
3399
|
-
}
|
|
3400
|
-
}
|
|
3401
|
-
return copy;
|
|
3402
|
-
}
|
|
3403
|
-
|
|
3404
|
-
// packages/cli/client/providerResolution/workbuddyTransport.ts
|
|
3405
|
-
var WORKBUDDY_ENDPOINTS = {
|
|
3406
|
-
workbuddy: "https://copilot.tencent.com/v2/chat/completions",
|
|
3407
|
-
"workbuddy-ai": "https://www.workbuddy.ai/v2/chat/completions"
|
|
3408
|
-
};
|
|
3409
|
-
function resolveWorkBuddySite(agentConfig) {
|
|
3410
|
-
const ref = agentConfig.apiKeyRef?.trim().toLowerCase();
|
|
3411
|
-
const prov = agentConfig.provider?.trim().toLowerCase();
|
|
3412
|
-
if (ref === "workbuddy-ai" || ref?.startsWith(["api-key", "workbuddy-ai"].join(":")) || prov === "workbuddy-ai") {
|
|
3413
|
-
return "workbuddy-ai";
|
|
3414
|
-
}
|
|
3415
|
-
if (ref === "workbuddy" || ref?.startsWith(["api-key", "workbuddy"].join(":")) || prov === "workbuddy") {
|
|
3416
|
-
return "workbuddy";
|
|
3417
|
-
}
|
|
3418
|
-
return null;
|
|
3419
|
-
}
|
|
3420
|
-
function record2(value) {
|
|
3421
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3422
|
-
}
|
|
3423
|
-
var QUOTA_EXCEEDED_MESSAGE = "WorkBuddy \u989D\u5EA6\u4E0D\u8DB3 (14018)\uFF1AWorkBuddy \u975E\u65E0\u9650\u514D\u8D39\u670D\u52A1\uFF0C\u5F53\u524D\u8D26\u53F7\u989D\u5EA6\u5DF2\u8017\u5C3D\u3002";
|
|
3424
|
-
function wrapWorkBuddySseResponse(response, names) {
|
|
3425
|
-
if (!response.body) return response;
|
|
3426
|
-
const decoder = new TextDecoder("utf-8");
|
|
3427
|
-
const encoder = new TextEncoder();
|
|
3428
|
-
let pending = "";
|
|
3429
|
-
let lines = [];
|
|
3430
|
-
const fragments = /* @__PURE__ */ new Map();
|
|
3431
|
-
const processEvent = () => {
|
|
3432
|
-
const dataLines = lines.filter((line) => line.startsWith("data:")).map((line) => line.slice(5).replace(/^ /, ""));
|
|
3433
|
-
const data = dataLines.join("\n");
|
|
3434
|
-
if (!data || data === "[DONE]") {
|
|
3435
|
-
const result = lines.join("\n") + "\n\n";
|
|
3436
|
-
lines = [];
|
|
3437
|
-
return result;
|
|
3438
|
-
}
|
|
3439
|
-
let payload;
|
|
3440
|
-
try {
|
|
3441
|
-
payload = JSON.parse(data);
|
|
3442
|
-
} catch {
|
|
3443
|
-
const result = lines.join("\n") + "\n\n";
|
|
3444
|
-
lines = [];
|
|
3445
|
-
return result;
|
|
3446
|
-
}
|
|
3447
|
-
if (record2(payload)) {
|
|
3448
|
-
if (payload.code === 14018 || payload.errcode === 14018 || record2(payload.error) && payload.error.code === 14018) {
|
|
3449
|
-
throw new Error(QUOTA_EXCEEDED_MESSAGE);
|
|
3450
|
-
}
|
|
3451
|
-
const choices = Array.isArray(payload.choices) ? payload.choices : [];
|
|
3452
|
-
for (const choice of choices) {
|
|
3453
|
-
if (!record2(choice)) continue;
|
|
3454
|
-
const delta = record2(choice.delta) ? choice.delta : void 0;
|
|
3455
|
-
const toolCalls = delta && Array.isArray(delta.tool_calls) ? delta.tool_calls : [];
|
|
3456
|
-
for (const call of toolCalls) {
|
|
3457
|
-
if (!record2(call) || !record2(call.function) || typeof call.function.name !== "string") {
|
|
3458
|
-
continue;
|
|
3459
|
-
}
|
|
3460
|
-
const key = `${choice.index ?? 0}:${call.index ?? 0}`;
|
|
3461
|
-
const accumulated = (fragments.get(key) ?? "") + call.function.name;
|
|
3462
|
-
if (Object.prototype.hasOwnProperty.call(names, accumulated)) {
|
|
3463
|
-
call.function.name = accumulated;
|
|
3464
|
-
fragments.delete(key);
|
|
3465
|
-
} else if (Object.keys(names).some((safe) => safe.startsWith(accumulated))) {
|
|
3466
|
-
fragments.set(key, accumulated);
|
|
3467
|
-
call.function.name = "";
|
|
3468
|
-
} else {
|
|
3469
|
-
call.function.name = accumulated;
|
|
3470
|
-
fragments.delete(key);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
}
|
|
3475
|
-
const restored = restoreWorkBuddyToolNames(payload, names);
|
|
3476
|
-
const nonDataFields = lines.filter((line) => !line.startsWith("data:"));
|
|
3477
|
-
lines = [];
|
|
3478
|
-
return [...nonDataFields, `data: ${JSON.stringify(restored)}`, "", ""].join(
|
|
3479
|
-
"\n"
|
|
3480
|
-
);
|
|
3481
|
-
};
|
|
3482
|
-
const drain = (final) => {
|
|
3483
|
-
let output = "";
|
|
3484
|
-
while (true) {
|
|
3485
|
-
const match = /[\r\n]/.exec(pending);
|
|
3486
|
-
if (!match) break;
|
|
3487
|
-
const i = match.index;
|
|
3488
|
-
if (!final && pending[i] === "\r" && i === pending.length - 1) break;
|
|
3489
|
-
const line = pending.slice(0, i);
|
|
3490
|
-
pending = pending.slice(
|
|
3491
|
-
i + (pending[i] === "\r" && pending[i + 1] === "\n" ? 2 : 1)
|
|
3492
|
-
);
|
|
3493
|
-
if (line === "") {
|
|
3494
|
-
output += processEvent();
|
|
3495
|
-
} else {
|
|
3496
|
-
lines.push(line);
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3499
|
-
if (final) {
|
|
3500
|
-
if (pending) {
|
|
3501
|
-
lines.push(pending);
|
|
3502
|
-
pending = "";
|
|
3503
|
-
}
|
|
3504
|
-
if (lines.length > 0) {
|
|
3505
|
-
output += processEvent();
|
|
3506
|
-
}
|
|
3507
|
-
}
|
|
3508
|
-
return output;
|
|
3509
|
-
};
|
|
3510
|
-
const transformStream = new TransformStream({
|
|
3511
|
-
transform: (chunk, controller) => {
|
|
3512
|
-
pending += decoder.decode(chunk, { stream: true });
|
|
3513
|
-
const output = drain(false);
|
|
3514
|
-
if (output) controller.enqueue(encoder.encode(output));
|
|
3515
|
-
},
|
|
3516
|
-
flush: (controller) => {
|
|
3517
|
-
pending += decoder.decode();
|
|
3518
|
-
const output = drain(true);
|
|
3519
|
-
if (output) controller.enqueue(encoder.encode(output));
|
|
3520
|
-
}
|
|
3521
|
-
});
|
|
3522
|
-
const body = response.body.pipeThrough(transformStream);
|
|
3523
|
-
const headers = new Headers(response.headers);
|
|
3524
|
-
headers.delete("content-length");
|
|
3525
|
-
headers.delete("content-encoding");
|
|
3526
|
-
return new Response(body, {
|
|
3527
|
-
status: response.status,
|
|
3528
|
-
statusText: response.statusText,
|
|
3529
|
-
headers
|
|
3530
|
-
});
|
|
3531
|
-
}
|
|
3532
|
-
async function wrapWorkBuddyJsonResponse(response, names) {
|
|
3533
|
-
const rawText = await response.text();
|
|
3534
|
-
let json;
|
|
3535
|
-
try {
|
|
3536
|
-
json = JSON.parse(rawText);
|
|
3537
|
-
} catch {
|
|
3538
|
-
return new Response(rawText, {
|
|
3539
|
-
status: response.status,
|
|
3540
|
-
statusText: response.statusText,
|
|
3541
|
-
headers: response.headers
|
|
3542
|
-
});
|
|
3543
|
-
}
|
|
3544
|
-
if (record2(json) && (json.code === 14018 || json.errcode === 14018 || record2(json.error) && json.error.code === 14018 || rawText.includes("14018"))) {
|
|
3545
|
-
throw new Error(QUOTA_EXCEEDED_MESSAGE);
|
|
3546
|
-
}
|
|
3547
|
-
const restored = restoreWorkBuddyToolNames(json, names);
|
|
3548
|
-
return new Response(JSON.stringify(restored), {
|
|
3549
|
-
status: response.status,
|
|
3550
|
-
statusText: response.statusText,
|
|
3551
|
-
headers: response.headers
|
|
3552
|
-
});
|
|
3553
|
-
}
|
|
3554
|
-
var resolveWorkbuddyTransport = async (ctx) => {
|
|
3555
|
-
const {
|
|
3556
|
-
agentConfig,
|
|
3557
|
-
deps,
|
|
3558
|
-
fetchImpl,
|
|
3559
|
-
additionalToolNames,
|
|
3560
|
-
buildProviderOpenAiTools,
|
|
3561
|
-
recordLocalAvailability,
|
|
3562
|
-
apiKeyRefResolver
|
|
3563
|
-
} = ctx;
|
|
3564
|
-
const site = resolveWorkBuddySite(agentConfig);
|
|
3565
|
-
if (!site) return null;
|
|
3566
|
-
const fixedEndpoint = WORKBUDDY_ENDPOINTS[site];
|
|
3567
|
-
if (agentConfig.customProviderUrl) {
|
|
3568
|
-
const trimmedUrl = agentConfig.customProviderUrl.trim();
|
|
3569
|
-
if (trimmedUrl && trimmedUrl !== fixedEndpoint) {
|
|
3570
|
-
throw new Error(
|
|
3571
|
-
`Custom provider URL "${trimmedUrl}" is forbidden for WorkBuddy (${site}). Requests must only target ${fixedEndpoint}.`
|
|
3572
|
-
);
|
|
3573
|
-
}
|
|
3574
|
-
}
|
|
3575
|
-
const rawRef = asTrimmedLowercaseString(agentConfig.apiKeyRef);
|
|
3576
|
-
const isApiKeyRef = rawRef.startsWith("api-key:");
|
|
3577
|
-
const providerRef = isApiKeyRef ? rawRef : site;
|
|
3578
|
-
const initialToken = await apiKeyRefResolver(providerRef);
|
|
3579
|
-
if (!initialToken) {
|
|
3580
|
-
throw new Error(
|
|
3581
|
-
`OAuth credential for "${site}" not found locally. Run \`nolo auth ${site}\`.`
|
|
3582
|
-
);
|
|
3583
|
-
}
|
|
3584
|
-
const legacyCredentialMigration = { enableLegacyMigration: true };
|
|
3585
|
-
let currentCredential = readOAuthCredential(
|
|
3586
|
-
site,
|
|
3587
|
-
void 0,
|
|
3588
|
-
legacyCredentialMigration
|
|
3589
|
-
);
|
|
3590
|
-
if (!currentCredential || !currentCredential.accessToken) {
|
|
3591
|
-
throw new Error(
|
|
3592
|
-
`OAuth credential for "${site}" not found locally. Run \`nolo auth ${site}\`.`
|
|
3593
|
-
);
|
|
3594
|
-
}
|
|
3595
|
-
const uid = typeof currentCredential.metadata?.uid === "string" && currentCredential.metadata.uid.trim() || typeof currentCredential.accountId === "string" && currentCredential.accountId.trim() || "";
|
|
3596
|
-
if (!uid) {
|
|
3597
|
-
throw new Error(
|
|
3598
|
-
`WorkBuddy credential for "${site}" is missing uid. Re-run \`nolo auth ${site}\`.`
|
|
3599
|
-
);
|
|
3600
|
-
}
|
|
3601
|
-
if (currentCredential.accessToken !== initialToken) {
|
|
3602
|
-
currentCredential = { ...currentCredential, accessToken: initialToken };
|
|
3603
|
-
}
|
|
3604
|
-
const { requestedToolNames, tools } = resolveProviderOpenAiToolBundle(
|
|
3605
|
-
agentConfig,
|
|
3606
|
-
deps.env,
|
|
3607
|
-
buildProviderOpenAiTools,
|
|
3608
|
-
additionalToolNames
|
|
3609
|
-
);
|
|
3610
|
-
const resolveRequestApiKey = async ({
|
|
3611
|
-
force
|
|
3612
|
-
}) => {
|
|
3613
|
-
if (isApiKeyRef && force) {
|
|
3614
|
-
return currentCredential.accessToken;
|
|
3615
|
-
}
|
|
3616
|
-
const before = readOAuthCredential(
|
|
3617
|
-
site,
|
|
3618
|
-
void 0,
|
|
3619
|
-
legacyCredentialMigration
|
|
3620
|
-
);
|
|
3621
|
-
if (before) {
|
|
3622
|
-
currentCredential = before;
|
|
3623
|
-
}
|
|
3624
|
-
if (!force) {
|
|
3625
|
-
return currentCredential.accessToken;
|
|
3626
|
-
}
|
|
3627
|
-
const refreshedToken = await apiKeyRefResolver(providerRef, {
|
|
3628
|
-
force: true
|
|
3629
|
-
});
|
|
3630
|
-
const after = readOAuthCredential(
|
|
3631
|
-
site,
|
|
3632
|
-
void 0,
|
|
3633
|
-
legacyCredentialMigration
|
|
3634
|
-
);
|
|
3635
|
-
if (after) {
|
|
3636
|
-
currentCredential = after;
|
|
3637
|
-
}
|
|
3638
|
-
if (refreshedToken && currentCredential.accessToken !== refreshedToken) {
|
|
3639
|
-
currentCredential = {
|
|
3640
|
-
...currentCredential,
|
|
3641
|
-
accessToken: refreshedToken
|
|
3642
|
-
};
|
|
3643
|
-
}
|
|
3644
|
-
return refreshedToken ?? currentCredential.accessToken;
|
|
3645
|
-
};
|
|
3646
|
-
const wrappedFetch = async (inputUrl, init) => {
|
|
3647
|
-
const targetUrl = typeof inputUrl === "string" ? inputUrl : inputUrl instanceof URL ? inputUrl.toString() : inputUrl.url;
|
|
3648
|
-
if (targetUrl !== fixedEndpoint) {
|
|
3649
|
-
throw new Error(
|
|
3650
|
-
`WorkBuddy request blocked: target URL "${targetUrl}" does not match fixed endpoint "${fixedEndpoint}". Token will not be sent.`
|
|
3651
|
-
);
|
|
3652
|
-
}
|
|
3653
|
-
let originalNames = {};
|
|
3654
|
-
let body = init?.body;
|
|
3655
|
-
if (typeof body === "string") {
|
|
3656
|
-
try {
|
|
3657
|
-
const parsed = JSON.parse(body);
|
|
3658
|
-
const adapted = adaptWorkBuddyRequest(parsed);
|
|
3659
|
-
originalNames = adapted.originalNames;
|
|
3660
|
-
body = JSON.stringify(adapted.body);
|
|
3661
|
-
} catch {
|
|
3662
|
-
}
|
|
3663
|
-
}
|
|
3664
|
-
const wbHeaders = getWorkBuddyHeaders(currentCredential);
|
|
3665
|
-
const mergedHeaders = new Headers(init?.headers);
|
|
3666
|
-
for (const [key, value] of Object.entries(wbHeaders)) {
|
|
3667
|
-
mergedHeaders.set(key, value);
|
|
3668
|
-
}
|
|
3669
|
-
mergedHeaders.set("Content-Type", "application/json");
|
|
3670
|
-
const upstreamRes = await fetchImpl(fixedEndpoint, {
|
|
3671
|
-
...init,
|
|
3672
|
-
body,
|
|
3673
|
-
headers: mergedHeaders,
|
|
3674
|
-
redirect: "error"
|
|
3675
|
-
});
|
|
3676
|
-
if (upstreamRes.status === 401) {
|
|
3677
|
-
return upstreamRes;
|
|
3678
|
-
}
|
|
3679
|
-
if (!upstreamRes.ok) {
|
|
3680
|
-
const clone = upstreamRes.clone();
|
|
3681
|
-
const errorText = await clone.text().catch(() => "");
|
|
3682
|
-
if (errorText.includes("14018")) {
|
|
3683
|
-
throw new Error(QUOTA_EXCEEDED_MESSAGE);
|
|
3684
|
-
}
|
|
3685
|
-
return upstreamRes;
|
|
3686
|
-
}
|
|
3687
|
-
const contentType = upstreamRes.headers.get("content-type") ?? "";
|
|
3688
|
-
if (contentType.includes("text/event-stream")) {
|
|
3689
|
-
return wrapWorkBuddySseResponse(upstreamRes, originalNames);
|
|
3690
|
-
} else {
|
|
3691
|
-
return wrapWorkBuddyJsonResponse(upstreamRes, originalNames);
|
|
3692
|
-
}
|
|
3693
|
-
};
|
|
3694
|
-
return {
|
|
3695
|
-
model: agentConfig.model || "gpt-4o",
|
|
3696
|
-
complete: async (messages, options) => {
|
|
3697
|
-
logLocalRuntimeDiagnostic("provider.request.start", {
|
|
3698
|
-
agentKey: agentConfig.key,
|
|
3699
|
-
transport: "workbuddy",
|
|
3700
|
-
model: agentConfig.model ?? "gpt-4o",
|
|
3701
|
-
messageCount: messages.length,
|
|
3702
|
-
toolCount: tools.length,
|
|
3703
|
-
requestedToolNames,
|
|
3704
|
-
openAiToolNames: summarizeOpenAiToolNames(tools),
|
|
3705
|
-
stream: true
|
|
3706
|
-
});
|
|
3707
|
-
try {
|
|
3708
|
-
const result = await executeOpenAiCompatibleChatCompletion({
|
|
3709
|
-
providerConfig: {
|
|
3710
|
-
endpoint: fixedEndpoint,
|
|
3711
|
-
apiKey: currentCredential.accessToken,
|
|
3712
|
-
model: agentConfig.model || "gpt-4o",
|
|
3713
|
-
provider: site
|
|
3714
|
-
},
|
|
3715
|
-
messages,
|
|
3716
|
-
tools,
|
|
3717
|
-
fetchImpl: wrappedFetch,
|
|
3718
|
-
stream: true,
|
|
3719
|
-
sessionId: asOptionalTrimmedString(options?.dialogId) ?? asOptionalTrimmedString(agentConfig.key),
|
|
3720
|
-
onTextDelta: options?.onTextDelta,
|
|
3721
|
-
onReasoningDelta: options?.onReasoningDelta,
|
|
3722
|
-
onHttpResult: ({ status, body }) => recordLocalAvailability(status, body),
|
|
3723
|
-
resolveApiKey: resolveRequestApiKey
|
|
3724
|
-
});
|
|
3725
|
-
await recordLocalAvailability(200);
|
|
3726
|
-
logLocalRuntimeDiagnostic("provider.request.result", {
|
|
3727
|
-
agentKey: agentConfig.key,
|
|
3728
|
-
transport: "workbuddy",
|
|
3729
|
-
ok: true,
|
|
3730
|
-
contentChars: result.content.length,
|
|
3731
|
-
toolCallCount: result.tool_calls?.length ?? 0
|
|
3732
|
-
});
|
|
3733
|
-
return result;
|
|
3734
|
-
} catch (error) {
|
|
3735
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3736
|
-
if (message.includes("14018")) {
|
|
3737
|
-
throw new Error(QUOTA_EXCEEDED_MESSAGE);
|
|
3738
|
-
}
|
|
3739
|
-
throw error;
|
|
3740
|
-
}
|
|
3741
|
-
}
|
|
3742
|
-
};
|
|
3743
|
-
};
|
|
3744
|
-
|
|
3745
3306
|
// packages/cli/client/providerResolution/directOpenAiCompatibleTransport.ts
|
|
3746
3307
|
var resolveDirectOpenAiCompatibleTransport = async (ctx) => {
|
|
3747
3308
|
const { agentConfig, deps, fetchImpl, loopbackRequest, additionalToolNames, buildProviderOpenAiTools, recordLocalAvailability, apiKeyRefResolver, credentialBroker, syncFetcher, serverUrl, authToken } = ctx;
|
|
@@ -4385,7 +3946,6 @@ var TRANSPORTS = [
|
|
|
4385
3946
|
resolveCodexOAuthTransport,
|
|
4386
3947
|
resolveCursorTransport,
|
|
4387
3948
|
resolveDevinTransport,
|
|
4388
|
-
resolveWorkbuddyTransport,
|
|
4389
3949
|
resolveGeminiNativeToolTransport,
|
|
4390
3950
|
// 三条 custom native wire(gemini / openai-responses / anthropic-messages)由
|
|
4391
3951
|
// 这一个 resolver 按目录 `nativeProtocol` 分派:三种 wire 互斥(一个模型的
|
|
@@ -4556,11 +4116,11 @@ function withProviderStreamRetry(provider, deps) {
|
|
|
4556
4116
|
|
|
4557
4117
|
// packages/cli/client/cliRemoteDialogSync.ts
|
|
4558
4118
|
function prepareRemoteDialogEvidenceRecord(key, value) {
|
|
4559
|
-
const
|
|
4560
|
-
if (key.includes("-msg-") && typeof
|
|
4561
|
-
|
|
4119
|
+
const record = isRecord(value) ? { ...value } : {};
|
|
4120
|
+
if (key.includes("-msg-") && typeof record.type !== "string") {
|
|
4121
|
+
record.type = "msg";
|
|
4562
4122
|
}
|
|
4563
|
-
return
|
|
4123
|
+
return record;
|
|
4564
4124
|
}
|
|
4565
4125
|
function normalizeRemoteSubjectRef(value) {
|
|
4566
4126
|
if (!isRecord(value)) return null;
|
|
@@ -4852,13 +4412,13 @@ function resolveBuiltinLocalCliAgentConfig(agentRef, userId) {
|
|
|
4852
4412
|
}
|
|
4853
4413
|
async function readAgentFromStore(args) {
|
|
4854
4414
|
for (const key of buildLocalAgentLookupKeys(args)) {
|
|
4855
|
-
const
|
|
4856
|
-
if (!
|
|
4415
|
+
const record = await args.store.read(key);
|
|
4416
|
+
if (!record || typeof record !== "object") continue;
|
|
4857
4417
|
return applyBuiltinAgentRuntimeOverride(
|
|
4858
4418
|
args.agentRef,
|
|
4859
4419
|
resolveAgentRuntimeConfigFromRecord(
|
|
4860
4420
|
key,
|
|
4861
|
-
applyPublicAgentCatalogOverride(
|
|
4421
|
+
applyPublicAgentCatalogOverride(record)
|
|
4862
4422
|
)
|
|
4863
4423
|
);
|
|
4864
4424
|
}
|
|
@@ -4893,8 +4453,8 @@ async function readDialogMessages(args) {
|
|
|
4893
4453
|
function createChildShellApprovalHostResolver(args) {
|
|
4894
4454
|
return async (agentKey) => {
|
|
4895
4455
|
const config = await args.readAgentConfig(agentKey);
|
|
4896
|
-
const
|
|
4897
|
-
const ownerUserId = asOptionalTrimmedString(
|
|
4456
|
+
const record = config?.rawRecord;
|
|
4457
|
+
const ownerUserId = asOptionalTrimmedString(record?.userId) ?? asOptionalTrimmedString(record?.ownerUserId);
|
|
4898
4458
|
if (!ownerUserId) return void 0;
|
|
4899
4459
|
const deviceId = asOptionalTrimmedString(await args.resolveDeviceId());
|
|
4900
4460
|
if (!deviceId) return void 0;
|
|
@@ -5161,8 +4721,8 @@ function describeIssues(issues) {
|
|
|
5161
4721
|
function asNonEmptyString(value) {
|
|
5162
4722
|
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
5163
4723
|
}
|
|
5164
|
-
function resolveCreatedAtMs(
|
|
5165
|
-
const raw =
|
|
4724
|
+
function resolveCreatedAtMs(record) {
|
|
4725
|
+
const raw = record.createdAt;
|
|
5166
4726
|
const ms = typeof raw === "number" ? raw : typeof raw === "string" ? Date.parse(raw) : Number.NaN;
|
|
5167
4727
|
return Number.isFinite(ms) ? ms : null;
|
|
5168
4728
|
}
|
|
@@ -5222,18 +4782,18 @@ function analyzeRemoteDialogRecords(args) {
|
|
|
5222
4782
|
}
|
|
5223
4783
|
seenIds.add(messageId);
|
|
5224
4784
|
const key = dialogMessageKey(args.dialogId, messageId);
|
|
5225
|
-
const
|
|
4785
|
+
const record = {
|
|
5226
4786
|
...raw,
|
|
5227
4787
|
id: messageId,
|
|
5228
4788
|
dbKey: key,
|
|
5229
4789
|
...asNonEmptyString(raw.dialogId) ? {} : { dialogId: args.dialogId }
|
|
5230
4790
|
};
|
|
5231
|
-
const message = dialogMessageRecordToAgentRuntimeMessage(
|
|
4791
|
+
const message = dialogMessageRecordToAgentRuntimeMessage(record);
|
|
5232
4792
|
if (!message) {
|
|
5233
4793
|
issues.push({ code: "unconvertible-record", detail: `${role} index ${index}` });
|
|
5234
4794
|
continue;
|
|
5235
4795
|
}
|
|
5236
|
-
entries.push({ key, messageId, record
|
|
4796
|
+
entries.push({ key, messageId, record, message });
|
|
5237
4797
|
}
|
|
5238
4798
|
const messages = entries.map((entry) => entry.message);
|
|
5239
4799
|
for (const detail of findAgentStatePairingIssues(messages)) {
|
|
@@ -5507,14 +5067,27 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
5507
5067
|
}
|
|
5508
5068
|
const body = {
|
|
5509
5069
|
query: parsed.query,
|
|
5510
|
-
numResults: parsed.numResults
|
|
5511
|
-
useAutoprompt: parsed.useAutoprompt ?? true,
|
|
5512
|
-
type: parsed.type ?? "neural",
|
|
5513
|
-
// Model schema uses `includeContent` (boolean); the Exa API
|
|
5514
|
-
// expects `contents: { text: true }`. Mirror exaSearchFunc's
|
|
5515
|
-
// conversion so CLI proxy results match web behavior.
|
|
5516
|
-
contents: parsed.includeContent !== false ? { text: true } : void 0
|
|
5070
|
+
...parsed.numResults !== void 0 ? { numResults: parsed.numResults } : {}
|
|
5517
5071
|
};
|
|
5072
|
+
if (typeof parsed.intent === "string" && parsed.intent) {
|
|
5073
|
+
body.intent = parsed.intent;
|
|
5074
|
+
}
|
|
5075
|
+
if (typeof parsed.category === "string" && parsed.category) {
|
|
5076
|
+
body.category = parsed.category;
|
|
5077
|
+
}
|
|
5078
|
+
if (typeof parsed.timeRange === "string" && parsed.timeRange) {
|
|
5079
|
+
body.timeRange = parsed.timeRange;
|
|
5080
|
+
}
|
|
5081
|
+
if (Array.isArray(parsed.includeDomains) && parsed.includeDomains.length > 0) {
|
|
5082
|
+
body.includeDomains = parsed.includeDomains;
|
|
5083
|
+
}
|
|
5084
|
+
if (Array.isArray(parsed.excludeDomains) && parsed.excludeDomains.length > 0) {
|
|
5085
|
+
body.excludeDomains = parsed.excludeDomains;
|
|
5086
|
+
}
|
|
5087
|
+
if (typeof parsed.includeContent === "boolean") {
|
|
5088
|
+
body.includeContent = parsed.includeContent;
|
|
5089
|
+
}
|
|
5090
|
+
if (call?.origin) body.origin = call.origin;
|
|
5518
5091
|
const content = await postServer("/api/exa-search", body);
|
|
5519
5092
|
return {
|
|
5520
5093
|
content,
|
|
@@ -6094,9 +5667,9 @@ var boundedOutputPage = (items, total, offset, budget = 8 * 1024) => {
|
|
|
6094
5667
|
return { items, hasMore: offset + items.length < total, nextOffset: offset + items.length };
|
|
6095
5668
|
};
|
|
6096
5669
|
var resolveNowMs = (deps) => typeof deps.nowMs === "function" ? deps.nowMs() : Date.now();
|
|
6097
|
-
function buildProgressField(
|
|
6098
|
-
const activity =
|
|
6099
|
-
if (!activity || isAgentRunTerminalStatus(
|
|
5670
|
+
function buildProgressField(record, nowMs) {
|
|
5671
|
+
const activity = record.activity;
|
|
5672
|
+
if (!activity || isAgentRunTerminalStatus(record.status)) return {};
|
|
6100
5673
|
const lastEventAt = Date.parse(activity.lastEventAt ?? "");
|
|
6101
5674
|
const inFlight = activity.inFlight;
|
|
6102
5675
|
const progress = {
|
|
@@ -6193,15 +5766,15 @@ async function assertCredentialFanoutAllowed(deps, args) {
|
|
|
6193
5766
|
}
|
|
6194
5767
|
const { batchId, parentDialogId } = args;
|
|
6195
5768
|
if (!batchId && !parentDialogId) return candidateGroup;
|
|
6196
|
-
const active = queryRunRecords({ limit: 500 }, deps).runs.filter((
|
|
6197
|
-
if (isRunTerminalStatus(
|
|
6198
|
-
if (batchId &&
|
|
6199
|
-
if (parentDialogId &&
|
|
5769
|
+
const active = queryRunRecords({ limit: 500 }, deps).runs.filter((record) => {
|
|
5770
|
+
if (isRunTerminalStatus(record.status)) return false;
|
|
5771
|
+
if (batchId && record.batchId === batchId) return true;
|
|
5772
|
+
if (parentDialogId && record.parentDialogId === parentDialogId) return true;
|
|
6200
5773
|
return false;
|
|
6201
|
-
}).map((
|
|
6202
|
-
runId:
|
|
6203
|
-
agentKey:
|
|
6204
|
-
credentialGroup:
|
|
5774
|
+
}).map((record) => ({
|
|
5775
|
+
runId: record.runId,
|
|
5776
|
+
agentKey: record.agentKey,
|
|
5777
|
+
credentialGroup: record.credentialGroup
|
|
6205
5778
|
}));
|
|
6206
5779
|
if (active.length === 0) return candidateGroup;
|
|
6207
5780
|
const verdict = checkCredentialFanout({
|
|
@@ -6230,6 +5803,12 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
6230
5803
|
// F1:runtimeKey=local 是「在宿主文件系统上改代码」,需要调用方的显式确认
|
|
6231
5804
|
// (allowHostWrites: true);缺失即派发前拒绝(零 spawn、零 run 记录)。
|
|
6232
5805
|
allowHostWrites: args.allowHostWrites,
|
|
5806
|
+
// 政策第 5 条:显式宿主 cwd × 沙盒落点必须在派发前失败(沙盒不兑现宿主
|
|
5807
|
+
// 路径,cwd 会被静默替换、改动随沙盒消失)。这里传的是调用方**原始**
|
|
5808
|
+
// args.cwd —— `requestedCwd` 走 resolveStartAgentRunCwd,要读 fs 探测,
|
|
5809
|
+
// 排在这条判定之后;守卫自己只认宿主绝对路径(相对/空白自行跳过,交给
|
|
5810
|
+
// resolveStartAgentRunCwd 报「必须是绝对路径」)。
|
|
5811
|
+
...typeof args.cwd === "string" && args.cwd.trim() ? { cwd: args.cwd } : {},
|
|
6233
5812
|
...bindingMachineId ? { bindingMachineId } : {},
|
|
6234
5813
|
...localMachineId ? { localMachineId } : {}
|
|
6235
5814
|
});
|
|
@@ -6438,16 +6017,16 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6438
6017
|
},
|
|
6439
6018
|
deps
|
|
6440
6019
|
);
|
|
6441
|
-
const runs = records.map((
|
|
6020
|
+
const runs = records.map((record2) => {
|
|
6442
6021
|
return {
|
|
6443
|
-
runId:
|
|
6444
|
-
status:
|
|
6445
|
-
agentKey:
|
|
6446
|
-
...
|
|
6447
|
-
...typeof
|
|
6448
|
-
...
|
|
6449
|
-
pid:
|
|
6450
|
-
startedAt:
|
|
6022
|
+
runId: record2.runId,
|
|
6023
|
+
status: record2.status,
|
|
6024
|
+
agentKey: record2.agentKey,
|
|
6025
|
+
...record2.agentName ? { agentName: record2.agentName.slice(0, 120) } : {},
|
|
6026
|
+
...typeof record2.title === "string" ? { title: record2.title.slice(0, 160) } : {},
|
|
6027
|
+
...record2.batchId ? { batchId: record2.batchId } : {},
|
|
6028
|
+
pid: record2.pid ?? null,
|
|
6029
|
+
startedAt: record2.startedAt
|
|
6451
6030
|
};
|
|
6452
6031
|
});
|
|
6453
6032
|
const outputBudgetBytes = 8 * 1024;
|
|
@@ -6533,15 +6112,15 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6533
6112
|
if (!args.runId) throw new Error(t("agentRunTool.appendMissingRunId"));
|
|
6534
6113
|
const userInput = typeof args.userInput === "string" ? args.userInput.trim() : "";
|
|
6535
6114
|
if (!userInput) throw new Error(t("agentRunTool.appendMissingUserInput"));
|
|
6536
|
-
const
|
|
6537
|
-
if (!
|
|
6115
|
+
const record2 = findRunRecord(String(args.runId), deps);
|
|
6116
|
+
if (!record2) {
|
|
6538
6117
|
const labels2 = agentRunCardLabels();
|
|
6539
6118
|
return {
|
|
6540
6119
|
content: JSON.stringify({ runId: args.runId, found: false }),
|
|
6541
6120
|
metadata: { displayData: formatNotFoundRunCard(labels2) }
|
|
6542
6121
|
};
|
|
6543
6122
|
}
|
|
6544
|
-
let reconciled2 = checkStaleRun(
|
|
6123
|
+
let reconciled2 = checkStaleRun(record2.runId, deps) ?? record2;
|
|
6545
6124
|
if (!isAgentRunTerminalStatus(reconciled2.status)) {
|
|
6546
6125
|
if (!reconciled2.queuePath) {
|
|
6547
6126
|
throw new Error(t("agentRunTool.appendQueueUnsupported"));
|
|
@@ -6621,8 +6200,8 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6621
6200
|
throw new Error(t("agentRunTool.unknownAction", String(action)));
|
|
6622
6201
|
}
|
|
6623
6202
|
if (!args.runId) throw new Error(t("agentRunTool.missingRunId", String(action)));
|
|
6624
|
-
const
|
|
6625
|
-
if (!
|
|
6203
|
+
const record = findRunRecord(String(args.runId), deps);
|
|
6204
|
+
if (!record) {
|
|
6626
6205
|
const labels2 = agentRunCardLabels();
|
|
6627
6206
|
return {
|
|
6628
6207
|
content: JSON.stringify({ runId: args.runId, found: false }),
|
|
@@ -6630,15 +6209,15 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6630
6209
|
};
|
|
6631
6210
|
}
|
|
6632
6211
|
if (action === "status") {
|
|
6633
|
-
const reconciled2 = checkStaleRun(
|
|
6634
|
-
const logTail = tailLines > 0 ? tailFile(
|
|
6212
|
+
const reconciled2 = checkStaleRun(record.runId, deps) ?? record;
|
|
6213
|
+
const logTail = tailLines > 0 ? tailFile(record.logPath, tailLines, resolveFs(deps)) : void 0;
|
|
6635
6214
|
return buildRunStatusPayload(reconciled2, deps, { logTail });
|
|
6636
6215
|
}
|
|
6637
6216
|
if (action === "wait") {
|
|
6638
6217
|
const timeoutMs = typeof args.timeoutMs === "number" && args.timeoutMs > 0 ? args.timeoutMs : DEFAULT_WAIT_TIMEOUT_MS;
|
|
6639
6218
|
let claimToken = null;
|
|
6640
6219
|
const result = await waitForRunTerminal({
|
|
6641
|
-
read: () => checkStaleRun(
|
|
6220
|
+
read: () => checkStaleRun(record.runId, deps) ?? record,
|
|
6642
6221
|
isTerminal: (state) => isAgentRunTerminalStatus(state.status),
|
|
6643
6222
|
pollIntervalMs: WAIT_POLL_INTERVAL_MS,
|
|
6644
6223
|
timeoutMs,
|
|
@@ -6646,28 +6225,28 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6646
6225
|
sleep: deps.sleep,
|
|
6647
6226
|
claim: {
|
|
6648
6227
|
acquire: () => {
|
|
6649
|
-
claimToken = claimRunRecord(
|
|
6228
|
+
claimToken = claimRunRecord(record.runId, { ...deps, ttlMs: timeoutMs + ACK_LEASE_GRACE_MS });
|
|
6650
6229
|
return claimToken;
|
|
6651
6230
|
},
|
|
6652
6231
|
commit: (token) => {
|
|
6653
|
-
if (token) commitRunRecordClaim(
|
|
6654
|
-
else ackRunRecord(
|
|
6232
|
+
if (token) commitRunRecordClaim(record.runId, token, deps);
|
|
6233
|
+
else ackRunRecord(record.runId, deps);
|
|
6655
6234
|
},
|
|
6656
6235
|
release: (token) => {
|
|
6657
|
-
if (token) releaseRunRecordAck(
|
|
6236
|
+
if (token) releaseRunRecordAck(record.runId, token, deps);
|
|
6658
6237
|
}
|
|
6659
6238
|
}
|
|
6660
6239
|
});
|
|
6661
6240
|
if (result.kind === "aborted") throw new Error(t("agentRunTool.waitAborted"));
|
|
6662
6241
|
if (result.kind === "failed") throw result.error;
|
|
6663
6242
|
if (result.kind === "timeout") {
|
|
6664
|
-
const reconciled2 = result.lastState ??
|
|
6243
|
+
const reconciled2 = result.lastState ?? record;
|
|
6665
6244
|
const nowMs = resolveNowMs(deps);
|
|
6666
6245
|
return { content: JSON.stringify({ runId: reconciled2.runId, found: true, status: "timeout", runStatus: reconciled2.status, pid: reconciled2.pid ?? null, agentKey: reconciled2.agentKey, ...reconciled2.agentName ? { agentName: reconciled2.agentName } : {}, startedAt: reconciled2.startedAt, waitedMs: result.waitedMs, timeoutMs, ...buildProgressField(reconciled2, nowMs) }), metadata: { displayData: t("agentRunWaitTimeout", String(Math.round(result.waitedMs / 1e3))) } };
|
|
6667
6246
|
}
|
|
6668
6247
|
return buildRunStatusPayload(result.state, deps);
|
|
6669
6248
|
}
|
|
6670
|
-
const reconciled = checkStaleRun(
|
|
6249
|
+
const reconciled = checkStaleRun(record.runId, deps) ?? record;
|
|
6671
6250
|
if (isAgentRunTerminalStatus(reconciled.status)) {
|
|
6672
6251
|
const labels2 = agentRunCardLabels();
|
|
6673
6252
|
return {
|
|
@@ -6686,13 +6265,13 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
6686
6265
|
if (!confirmed) {
|
|
6687
6266
|
return {
|
|
6688
6267
|
content: JSON.stringify({
|
|
6689
|
-
runId:
|
|
6268
|
+
runId: record.runId,
|
|
6690
6269
|
found: true,
|
|
6691
6270
|
status: reconciled.status,
|
|
6692
6271
|
stopConfirmed: false
|
|
6693
6272
|
}),
|
|
6694
6273
|
metadata: {
|
|
6695
|
-
displayData: t("agentRunStopFailedAlive", String(
|
|
6274
|
+
displayData: t("agentRunStopFailedAlive", String(record.pid))
|
|
6696
6275
|
}
|
|
6697
6276
|
};
|
|
6698
6277
|
}
|
|
@@ -7160,12 +6739,10 @@ var REFRESH_BY_PROVIDER = {
|
|
|
7160
6739
|
antigravity: refreshAntigravityOAuthToken,
|
|
7161
6740
|
xai: xaiRefresh,
|
|
7162
6741
|
claude: anthropicRefresh,
|
|
7163
|
-
cursor: cursorRefresh
|
|
7164
|
-
workbuddy: workbuddyRefresh,
|
|
7165
|
-
"workbuddy-ai": workbuddyRefresh
|
|
6742
|
+
cursor: cursorRefresh
|
|
7166
6743
|
};
|
|
7167
6744
|
function isOAuthProvider(value) {
|
|
7168
|
-
return value === "chatgpt" || value === "xai" || value === "antigravity" || value === "claude" || value === "cursor" || value === "devin"
|
|
6745
|
+
return value === "chatgpt" || value === "xai" || value === "antigravity" || value === "claude" || value === "cursor" || value === "devin";
|
|
7169
6746
|
}
|
|
7170
6747
|
function createOAuthApiKeyRefResolver(options = {}) {
|
|
7171
6748
|
const pullServerAccessToken = options.pullServerAccessToken ?? createServerAccessTokenPuller({
|
|
@@ -7212,10 +6789,10 @@ function encodeFailure(error, stderr) {
|
|
|
7212
6789
|
function readStreams(output) {
|
|
7213
6790
|
if (typeof output === "string") return { stdout: output, stderr: "" };
|
|
7214
6791
|
if (!output || typeof output !== "object") return { stdout: "", stderr: "" };
|
|
7215
|
-
const
|
|
6792
|
+
const record = output;
|
|
7216
6793
|
return {
|
|
7217
|
-
stdout: typeof
|
|
7218
|
-
stderr: typeof
|
|
6794
|
+
stdout: typeof record.stdout === "string" ? record.stdout : "",
|
|
6795
|
+
stderr: typeof record.stderr === "string" ? record.stderr : ""
|
|
7219
6796
|
};
|
|
7220
6797
|
}
|
|
7221
6798
|
function describeMessage(error) {
|
|
@@ -8622,8 +8199,8 @@ async function createLocalDockerWorkload(args) {
|
|
|
8622
8199
|
}
|
|
8623
8200
|
const createLifecycle = args.createLifecycle ?? (async () => {
|
|
8624
8201
|
const [{ DockerWorkloadLifecycle, createDockerBindingAuthorizer }, accounts] = await Promise.all([
|
|
8625
|
-
import("./workloadLifecycle-
|
|
8626
|
-
import("./accountResolver-
|
|
8202
|
+
import("./workloadLifecycle-6O6PMISX.js"),
|
|
8203
|
+
import("./accountResolver-55EDKEIK.js")
|
|
8627
8204
|
]);
|
|
8628
8205
|
const resolveAccount = args.resolveAccount ?? accounts.createDockerAccountResolver({
|
|
8629
8206
|
env: args.env,
|
|
@@ -8640,7 +8217,28 @@ async function createLocalDockerWorkload(args) {
|
|
|
8640
8217
|
resolveAccount
|
|
8641
8218
|
});
|
|
8642
8219
|
});
|
|
8643
|
-
const
|
|
8220
|
+
const phaseLogEnabled = () => {
|
|
8221
|
+
const env = args.env;
|
|
8222
|
+
return env.NOLO_DEBUG === "1" || env.NOLO_CLI_DEBUG_DETAIL === "1";
|
|
8223
|
+
};
|
|
8224
|
+
const phaseLog = (event, payload) => {
|
|
8225
|
+
if (!phaseLogEnabled()) return;
|
|
8226
|
+
console.warn(`[docker-workload-phase] ${event}`, payload);
|
|
8227
|
+
};
|
|
8228
|
+
const phase = async (name, operation) => {
|
|
8229
|
+
const startedAt = Date.now();
|
|
8230
|
+
phaseLog("start", { phase: name, runId: args.runId });
|
|
8231
|
+
try {
|
|
8232
|
+
const result = await operation();
|
|
8233
|
+
phaseLog("complete", { phase: name, runId: args.runId, elapsedMs: Date.now() - startedAt });
|
|
8234
|
+
return result;
|
|
8235
|
+
} catch (error) {
|
|
8236
|
+
const safeError = error && typeof error === "object" ? error : {};
|
|
8237
|
+
phaseLog("failed", { phase: name, runId: args.runId, elapsedMs: Date.now() - startedAt, errorCode: typeof safeError.code === "string" ? safeError.code : void 0, errorName: typeof safeError.name === "string" ? safeError.name : void 0 });
|
|
8238
|
+
throw error;
|
|
8239
|
+
}
|
|
8240
|
+
};
|
|
8241
|
+
const lifecycle = await phase("create-lifecycle", () => createLifecycle());
|
|
8644
8242
|
const grant = {
|
|
8645
8243
|
version: 1,
|
|
8646
8244
|
grantId: `grant-${args.runId}`,
|
|
@@ -8658,25 +8256,29 @@ async function createLocalDockerWorkload(args) {
|
|
|
8658
8256
|
}
|
|
8659
8257
|
};
|
|
8660
8258
|
const workspaceRoot = args.workspaceRoot ?? process.cwd();
|
|
8259
|
+
const workspaceMode = args.workspaceMode ?? "git";
|
|
8661
8260
|
const prepareDelivery = args.prepareWorkspaceDelivery ?? prepareHostWorkspaceDelivery;
|
|
8662
8261
|
const applyDelivery = args.applyWorkspaceDelivery ?? applyDockerWorkspaceDelivery;
|
|
8663
8262
|
let deliveryApplied = false;
|
|
8664
8263
|
const deliverWorkspace = async (runtime) => {
|
|
8665
8264
|
if (deliveryApplied) return;
|
|
8666
8265
|
deliveryApplied = true;
|
|
8667
|
-
const prepared =
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8266
|
+
const prepared = await phase("host-archive", () => {
|
|
8267
|
+
const result = prepareDelivery({ workspaceRoot });
|
|
8268
|
+
if (!result.ok) {
|
|
8269
|
+
throw new LocalWorkspaceDeliveryError(
|
|
8270
|
+
result.code,
|
|
8271
|
+
`${result.message}\uFF08\u5BBF\u4E3B\u4FA7\u6295\u9001\u51C6\u5907\u5931\u8D25\uFF0C\u672C run \u62D2\u7EDD\u8FDB\u5165\u5DE5\u5177\u5FAA\u73AF\uFF09`
|
|
8272
|
+
);
|
|
8273
|
+
}
|
|
8274
|
+
return result;
|
|
8275
|
+
});
|
|
8674
8276
|
if (args.signal?.aborted) {
|
|
8675
8277
|
await prepared.cleanup();
|
|
8676
8278
|
throw new LocalWorkspaceDeliveryError("delivery_cancelled", "run \u5DF2\u53D6\u6D88\uFF0C\u653E\u5F03\u5DE5\u4F5C\u533A\u6295\u9001\u3002");
|
|
8677
8279
|
}
|
|
8678
8280
|
try {
|
|
8679
|
-
await applyDelivery(runtime, prepared.selection);
|
|
8281
|
+
await phase("delivery", () => applyDelivery(runtime, prepared.selection));
|
|
8680
8282
|
} catch (error) {
|
|
8681
8283
|
const code = isDockerWorkspaceDeliveryError(error) ? error.code : "delivery_failed";
|
|
8682
8284
|
throw new LocalWorkspaceDeliveryError(
|
|
@@ -8725,11 +8327,39 @@ async function createLocalDockerWorkload(args) {
|
|
|
8725
8327
|
},
|
|
8726
8328
|
async (workload2, runtime) => {
|
|
8727
8329
|
if (runtime) {
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8330
|
+
await phase("sandbox-helper-upload", async () => {
|
|
8331
|
+
const uploaded = await runtime.exec(buildSandboxHelperUploadArgv());
|
|
8332
|
+
if (!uploaded.ok) {
|
|
8333
|
+
throw Object.assign(new Error("docker_helper_upload_failed"), { code: "docker_helper_upload_failed" });
|
|
8334
|
+
}
|
|
8335
|
+
});
|
|
8336
|
+
if (workspaceMode === "git") {
|
|
8337
|
+
await deliverWorkspace(runtime);
|
|
8338
|
+
} else {
|
|
8339
|
+
await phase("empty-workspace-root", async () => {
|
|
8340
|
+
const root = await runtime.exec([
|
|
8341
|
+
"bash",
|
|
8342
|
+
"-lc",
|
|
8343
|
+
`mkdir -p '${SANDBOX_WORKSPACE_ROOT}' && test -d '${SANDBOX_WORKSPACE_ROOT}' && test -w '${SANDBOX_WORKSPACE_ROOT}'`
|
|
8344
|
+
]);
|
|
8345
|
+
if (!root.ok) {
|
|
8346
|
+
throw Object.assign(new Error("docker_empty_workspace_root_failed"), { code: "docker_empty_workspace_root_failed" });
|
|
8347
|
+
}
|
|
8348
|
+
const gitInstall = await runtime.exec(buildInstallGitArgv());
|
|
8349
|
+
if (!gitInstall.ok) {
|
|
8350
|
+
throw Object.assign(
|
|
8351
|
+
new Error(`docker_empty_workspace_git_install_failed (exit ${gitInstall.exitCode})`),
|
|
8352
|
+
{ code: "docker_empty_workspace_git_install_failed" }
|
|
8353
|
+
);
|
|
8354
|
+
}
|
|
8355
|
+
const gitProbe = await runtime.exec(["bash", "-lc", "command -v git"]);
|
|
8356
|
+
if (!gitProbe.ok) {
|
|
8357
|
+
throw Object.assign(new Error("docker_empty_workspace_git_missing"), { code: "docker_empty_workspace_git_missing" });
|
|
8358
|
+
}
|
|
8359
|
+
});
|
|
8360
|
+
}
|
|
8731
8361
|
}
|
|
8732
|
-
resolveReady(workload2);
|
|
8362
|
+
await phase("ready", () => resolveReady(workload2));
|
|
8733
8363
|
await waitForReleaseOrAbort();
|
|
8734
8364
|
return void 0;
|
|
8735
8365
|
}
|
|
@@ -8786,6 +8416,7 @@ async function createLocalDockerWorkload(args) {
|
|
|
8786
8416
|
var INSTABOX_BACKEND_ID = "instabox";
|
|
8787
8417
|
var INSTABOX_DEFAULT_BASE_URL = "https://api.instabox.sh/v1";
|
|
8788
8418
|
var INSTABOX_MAX_EXEC_SECONDS = 600;
|
|
8419
|
+
var INSTABOX_MAX_STDIN_BYTES = 1024 * 1024;
|
|
8789
8420
|
var SAFE_MESSAGE3 = {
|
|
8790
8421
|
"instabox_invalid_config": "Rejected: instabox backend needs an apiKey and a templateId",
|
|
8791
8422
|
"instabox_invalid_ticket": "Rejected: execution ticket cannot be satisfied by the instabox backend",
|
|
@@ -8951,9 +8582,9 @@ var InstaboxBackend = class {
|
|
|
8951
8582
|
`create HTTP ${created.status}${created.transportError ? ` ${created.transportError}` : ""}`
|
|
8952
8583
|
);
|
|
8953
8584
|
}
|
|
8954
|
-
const
|
|
8955
|
-
const machineId = readString2(
|
|
8956
|
-
const operationId = readString2(
|
|
8585
|
+
const record = asRecord(created.payload);
|
|
8586
|
+
const machineId = readString2(record?.machineId);
|
|
8587
|
+
const operationId = readString2(record?.id);
|
|
8957
8588
|
if (!machineId || !operationId) {
|
|
8958
8589
|
throw new InstaboxBackendError(
|
|
8959
8590
|
"instabox_create_failed",
|
|
@@ -9019,12 +8650,7 @@ var InstaboxBackend = class {
|
|
|
9019
8650
|
"argv must be a non-empty array"
|
|
9020
8651
|
);
|
|
9021
8652
|
}
|
|
9022
|
-
|
|
9023
|
-
throw new InstaboxBackendError(
|
|
9024
|
-
"instabox_unsupported_request",
|
|
9025
|
-
"instabox exec has no stdin channel"
|
|
9026
|
-
);
|
|
9027
|
-
}
|
|
8653
|
+
const stdin = this.#resolveStdin(request.stdin);
|
|
9028
8654
|
const timeoutSeconds = this.#resolveExecTimeoutSeconds(request.timeoutMs);
|
|
9029
8655
|
const cmd = this.#buildCommand(request);
|
|
9030
8656
|
const executionId = `${entry.machineId}:${this.#now().toString(36)}`;
|
|
@@ -9033,7 +8659,7 @@ var InstaboxBackend = class {
|
|
|
9033
8659
|
const response = await this.#call({
|
|
9034
8660
|
method: "POST",
|
|
9035
8661
|
path: `/machines/${encodeURIComponent(entry.machineId)}/exec`,
|
|
9036
|
-
body: { cmd, timeoutSeconds }
|
|
8662
|
+
body: { cmd, timeoutSeconds, ...stdin === void 0 ? {} : { stdin } }
|
|
9037
8663
|
});
|
|
9038
8664
|
if (!isSuccess(response.status)) {
|
|
9039
8665
|
throw new InstaboxBackendError(
|
|
@@ -9161,6 +8787,27 @@ var InstaboxBackend = class {
|
|
|
9161
8787
|
}
|
|
9162
8788
|
return entry;
|
|
9163
8789
|
}
|
|
8790
|
+
/**
|
|
8791
|
+
* stdin 直通校验:`undefined` = 请求里没提供(body 里也不加字段,保持原报文兼容);
|
|
8792
|
+
* 字符串(含空串)在 1 MiB / UTF-8 字节以内原样透传;其他类型或超限立即拒绝,
|
|
8793
|
+
* 错误文案只带上限数字,**绝不回显输入内容**。
|
|
8794
|
+
*/
|
|
8795
|
+
#resolveStdin(stdin) {
|
|
8796
|
+
if (stdin === void 0) return void 0;
|
|
8797
|
+
if (typeof stdin !== "string") {
|
|
8798
|
+
throw new InstaboxBackendError(
|
|
8799
|
+
"instabox_unsupported_request",
|
|
8800
|
+
"stdin must be a string"
|
|
8801
|
+
);
|
|
8802
|
+
}
|
|
8803
|
+
if (utf8ByteLengthExceeds(stdin, INSTABOX_MAX_STDIN_BYTES)) {
|
|
8804
|
+
throw new InstaboxBackendError(
|
|
8805
|
+
"instabox_unsupported_request",
|
|
8806
|
+
`stdin exceeds the ${INSTABOX_MAX_STDIN_BYTES} byte limit`
|
|
8807
|
+
);
|
|
8808
|
+
}
|
|
8809
|
+
return stdin;
|
|
8810
|
+
}
|
|
9164
8811
|
#resolveExecTimeoutSeconds(timeoutMs) {
|
|
9165
8812
|
const boundMs = INSTABOX_MAX_EXEC_SECONDS * 1e3;
|
|
9166
8813
|
if (timeoutMs === void 0) return this.#execTimeoutSeconds;
|
|
@@ -9178,7 +8825,7 @@ var InstaboxBackend = class {
|
|
|
9178
8825
|
}
|
|
9179
8826
|
return clampExecSeconds(Math.ceil(timeoutMs / 1e3));
|
|
9180
8827
|
}
|
|
9181
|
-
/** cwd / env
|
|
8828
|
+
/** cwd / env 仍用 `cd` + 赋值前缀表达(exec body 只多一个可选 stdin,不承载 cwd/env)。 */
|
|
9182
8829
|
#buildCommand(request) {
|
|
9183
8830
|
const script = argvToInstaboxCommand(request.argv);
|
|
9184
8831
|
const segments = [];
|
|
@@ -9236,15 +8883,15 @@ var InstaboxBackend = class {
|
|
|
9236
8883
|
path: `/machines/${encodeURIComponent(machineId)}/usage`
|
|
9237
8884
|
});
|
|
9238
8885
|
if (!isSuccess(response.status)) return null;
|
|
9239
|
-
const
|
|
9240
|
-
const runningSeconds = readFiniteNumber(
|
|
8886
|
+
const record = asRecord(response.payload);
|
|
8887
|
+
const runningSeconds = readFiniteNumber(record?.runningSeconds);
|
|
9241
8888
|
if (runningSeconds === null) return null;
|
|
9242
8889
|
const sample = { runningSeconds };
|
|
9243
|
-
const vcpuSeconds = readFiniteNumber(
|
|
8890
|
+
const vcpuSeconds = readFiniteNumber(record?.vcpuSeconds);
|
|
9244
8891
|
if (vcpuSeconds !== null) sample.vcpuSeconds = vcpuSeconds;
|
|
9245
|
-
const memGiBSeconds = readFiniteNumber(
|
|
8892
|
+
const memGiBSeconds = readFiniteNumber(record?.memGiBSeconds);
|
|
9246
8893
|
if (memGiBSeconds !== null) sample.memGiBSeconds = memGiBSeconds;
|
|
9247
|
-
const diskGiBSeconds = readFiniteNumber(
|
|
8894
|
+
const diskGiBSeconds = readFiniteNumber(record?.diskGiBSeconds);
|
|
9248
8895
|
if (diskGiBSeconds !== null) sample.diskGiBSeconds = diskGiBSeconds;
|
|
9249
8896
|
return sample;
|
|
9250
8897
|
}
|
|
@@ -9264,13 +8911,13 @@ var InstaboxBackend = class {
|
|
|
9264
8911
|
path: `/operations/${encodeURIComponent(args.operationId)}?wait=${this.#operationWaitSeconds}s`
|
|
9265
8912
|
});
|
|
9266
8913
|
lastStatus = response.status;
|
|
9267
|
-
const
|
|
9268
|
-
const state = readString2(
|
|
8914
|
+
const record = isSuccess(response.status) ? asRecord(response.payload) : null;
|
|
8915
|
+
const state = readString2(record?.state);
|
|
9269
8916
|
if (state === "succeeded") return;
|
|
9270
8917
|
if (state === "failed") {
|
|
9271
8918
|
throw new InstaboxBackendError(
|
|
9272
8919
|
args.failCode,
|
|
9273
|
-
`operation ${args.operationId} failed${readString2(
|
|
8920
|
+
`operation ${args.operationId} failed${readString2(record?.error) ? `: ${readString2(record?.error)}` : ""}`,
|
|
9274
8921
|
args.cleanupPendingOnFailure
|
|
9275
8922
|
);
|
|
9276
8923
|
}
|
|
@@ -9294,6 +8941,10 @@ function truncateOutput(value, limitChars) {
|
|
|
9294
8941
|
if (value.length <= limitChars) return value;
|
|
9295
8942
|
return `${value.slice(0, limitChars)}\u2026[truncated ${value.length - limitChars} chars]`;
|
|
9296
8943
|
}
|
|
8944
|
+
function utf8ByteLengthExceeds(value, limit) {
|
|
8945
|
+
if (value.length > limit) return true;
|
|
8946
|
+
return new TextEncoder().encode(value).length > limit;
|
|
8947
|
+
}
|
|
9297
8948
|
function createInstaboxExecutionBackend(options) {
|
|
9298
8949
|
return new InstaboxBackend(options);
|
|
9299
8950
|
}
|
|
@@ -9308,6 +8959,213 @@ function asExecutionBackend(backend) {
|
|
|
9308
8959
|
};
|
|
9309
8960
|
}
|
|
9310
8961
|
|
|
8962
|
+
// packages/cli/client/localInstaboxFileBridge.ts
|
|
8963
|
+
var INSTABOX_HELPER_PATH = SANDBOX_HELPER_PATH;
|
|
8964
|
+
var INSTABOX_WORKSPACE_ROOT = "/data/home";
|
|
8965
|
+
var INSTABOX_FILE_TOOL_NAMES = [
|
|
8966
|
+
"readFile",
|
|
8967
|
+
"writeFile",
|
|
8968
|
+
"editFile",
|
|
8969
|
+
"globFiles"
|
|
8970
|
+
];
|
|
8971
|
+
var PROBE_FILE_NAME = "nolo-bridge-probe";
|
|
8972
|
+
function escapeForShell(value) {
|
|
8973
|
+
const cleaned = String(value).replace(/[^A-Za-z0-9._-]/g, "-").slice(0, 40);
|
|
8974
|
+
return cleaned || "run";
|
|
8975
|
+
}
|
|
8976
|
+
var PROBE_FILE_CONTENT = "nolo-bridge-ok";
|
|
8977
|
+
function posixQuote(value) {
|
|
8978
|
+
return `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
8979
|
+
}
|
|
8980
|
+
function buildInstaboxHelperSource(root) {
|
|
8981
|
+
const source = buildWorkspaceHelperSource();
|
|
8982
|
+
const rootLiteral = /const ROOT = "[^"]*";/;
|
|
8983
|
+
if (!rootLiteral.test(source)) {
|
|
8984
|
+
throw new Error("instabox_helper_root_patch_failed");
|
|
8985
|
+
}
|
|
8986
|
+
if (!root.startsWith("/") || root.includes('"') || root.includes("\\")) {
|
|
8987
|
+
throw new Error("instabox_invalid_workspace_root");
|
|
8988
|
+
}
|
|
8989
|
+
return source.replace(rootLiteral, `const ROOT = "${root}";`);
|
|
8990
|
+
}
|
|
8991
|
+
function buildInstaboxBridgeBootstrapScript(root, probeId) {
|
|
8992
|
+
let helperPayload;
|
|
8993
|
+
if (!root.startsWith("/") || root.includes('"') || root.includes("\\")) {
|
|
8994
|
+
return `printf 'NOLO_BRIDGE_REASON=root_unavailable
|
|
8995
|
+
'`;
|
|
8996
|
+
}
|
|
8997
|
+
try {
|
|
8998
|
+
helperPayload = Buffer.from(buildInstaboxHelperSource(root), "utf8").toString("base64");
|
|
8999
|
+
} catch (error) {
|
|
9000
|
+
return `printf 'NOLO_BRIDGE_REASON=helper_source_invalid
|
|
9001
|
+
'`;
|
|
9002
|
+
}
|
|
9003
|
+
const dir = INSTABOX_HELPER_PATH.slice(0, INSTABOX_HELPER_PATH.lastIndexOf("/"));
|
|
9004
|
+
return [
|
|
9005
|
+
`root=${posixQuote(root)}`,
|
|
9006
|
+
`mkdir -p "$root" 2>/dev/null || true`,
|
|
9007
|
+
`if [ ! -w "$root" ]; then printf 'NOLO_BRIDGE_REASON=root_unavailable\\n'; exit 0; fi`,
|
|
9008
|
+
`printf 'NOLO_BRIDGE_ROOT=%s\\n' "$root"`,
|
|
9009
|
+
"rt=''",
|
|
9010
|
+
`for cand in bun node; do if command -v "$cand" >/dev/null 2>&1; then rt="$cand"; break; fi; done`,
|
|
9011
|
+
`printf 'NOLO_BRIDGE_RUNTIME=%s\\n' "\${rt:-none}"`,
|
|
9012
|
+
`if [ -z "$rt" ]; then printf 'NOLO_BRIDGE_REASON=runtime_missing\\n'; exit 0; fi`,
|
|
9013
|
+
`mkdir -p ${posixQuote(dir)} 2>/dev/null || true`,
|
|
9014
|
+
`if ! printf %s ${posixQuote(helperPayload)} | base64 -d > ${posixQuote(INSTABOX_HELPER_PATH)}; then printf 'NOLO_BRIDGE_REASON=upload_failed\\n'; exit 0; fi`,
|
|
9015
|
+
`chmod 0644 ${posixQuote(INSTABOX_HELPER_PATH)} 2>/dev/null || true`,
|
|
9016
|
+
// 探针文件名带本次 run 的唯一 id:**只创建自己的**,绝不覆盖/删除同名既有文件
|
|
9017
|
+
`probe=$root/${escapeForShell(probeId)}-${PROBE_FILE_NAME}`,
|
|
9018
|
+
`if [ -e "$probe" ]; then printf 'NOLO_BRIDGE_REASON=probe_failed\\n'; exit 0; fi`,
|
|
9019
|
+
`printf %s ${posixQuote(PROBE_FILE_CONTENT)} > "$probe" || { printf 'NOLO_BRIDGE_REASON=upload_failed\\n'; exit 0; }`,
|
|
9020
|
+
`printf 'NOLO_BRIDGE_PROBE=%s\\n' "$probe"`,
|
|
9021
|
+
`printf 'NOLO_BRIDGE_UPLOAD=ok\\n'`
|
|
9022
|
+
].join("\n");
|
|
9023
|
+
}
|
|
9024
|
+
function parseInstaboxBootstrapOutput(stdout) {
|
|
9025
|
+
let root = null;
|
|
9026
|
+
let probePath = null;
|
|
9027
|
+
let runtime = null;
|
|
9028
|
+
let reason;
|
|
9029
|
+
let uploadOk = false;
|
|
9030
|
+
for (const rawLine of stdout.split(String.fromCharCode(10))) {
|
|
9031
|
+
const line = rawLine.trim();
|
|
9032
|
+
if (line.startsWith("NOLO_BRIDGE_ROOT=")) {
|
|
9033
|
+
const value = line.slice("NOLO_BRIDGE_ROOT=".length).trim();
|
|
9034
|
+
root = value.startsWith("/") ? value : null;
|
|
9035
|
+
} else if (line.startsWith("NOLO_BRIDGE_RUNTIME=")) {
|
|
9036
|
+
const value = line.slice("NOLO_BRIDGE_RUNTIME=".length).trim();
|
|
9037
|
+
runtime = value === "bun" || value === "node" ? value : null;
|
|
9038
|
+
} else if (line.startsWith("NOLO_BRIDGE_UPLOAD=")) {
|
|
9039
|
+
uploadOk = line.slice("NOLO_BRIDGE_UPLOAD=".length).trim() === "ok";
|
|
9040
|
+
} else if (line.startsWith("NOLO_BRIDGE_PROBE=")) {
|
|
9041
|
+
const value = line.slice("NOLO_BRIDGE_PROBE=".length).trim();
|
|
9042
|
+
probePath = value.startsWith("/") ? value : null;
|
|
9043
|
+
} else if (line.startsWith("NOLO_BRIDGE_REASON=")) {
|
|
9044
|
+
const value = line.slice("NOLO_BRIDGE_REASON=".length).trim();
|
|
9045
|
+
reason = value === "runtime_missing" || value === "root_unavailable" || value === "upload_failed" || value === "probe_failed" || value === "root_mismatch" || value === "helper_source_invalid" ? value : "probe_failed";
|
|
9046
|
+
}
|
|
9047
|
+
}
|
|
9048
|
+
if (!root) return { root: null, runtime: null, probePath: null, reason: reason ?? "root_unavailable" };
|
|
9049
|
+
if (!runtime) return { root, runtime: null, probePath, reason: reason ?? "runtime_missing" };
|
|
9050
|
+
if (!uploadOk) return { root, runtime, probePath, reason: reason ?? "upload_failed" };
|
|
9051
|
+
if (!probePath) return { root, runtime, probePath: null, reason: reason ?? "probe_failed" };
|
|
9052
|
+
return { root, runtime, probePath };
|
|
9053
|
+
}
|
|
9054
|
+
function resolveInstaboxPath(root, input) {
|
|
9055
|
+
if (typeof input !== "string" || !input.trim() || input.includes("\0")) {
|
|
9056
|
+
return { ok: false, error: "invalid_path" };
|
|
9057
|
+
}
|
|
9058
|
+
const normalizedRoot = root.endsWith("/") ? root.slice(0, -1) : root;
|
|
9059
|
+
const isAbs = input.startsWith("/");
|
|
9060
|
+
if (isAbs && input !== normalizedRoot && !input.startsWith(`${normalizedRoot}/`)) {
|
|
9061
|
+
return { ok: false, error: "path_outside_workspace" };
|
|
9062
|
+
}
|
|
9063
|
+
const resolved = isAbs ? posixNormalize(input) : posixNormalize(`${normalizedRoot}/${input}`);
|
|
9064
|
+
if (resolved !== normalizedRoot && !resolved.startsWith(`${normalizedRoot}/`)) {
|
|
9065
|
+
return { ok: false, error: "path_escape" };
|
|
9066
|
+
}
|
|
9067
|
+
return { ok: true, path: resolved };
|
|
9068
|
+
}
|
|
9069
|
+
function posixNormalize(input) {
|
|
9070
|
+
const parts = [];
|
|
9071
|
+
for (const segment of input.split("/")) {
|
|
9072
|
+
if (!segment || segment === ".") continue;
|
|
9073
|
+
if (segment === "..") {
|
|
9074
|
+
parts.pop();
|
|
9075
|
+
continue;
|
|
9076
|
+
}
|
|
9077
|
+
parts.push(segment);
|
|
9078
|
+
}
|
|
9079
|
+
return `/${parts.join("/")}`;
|
|
9080
|
+
}
|
|
9081
|
+
function buildInstaboxToolArgv(toolName, args, bridge) {
|
|
9082
|
+
const validated = {};
|
|
9083
|
+
let op;
|
|
9084
|
+
switch (toolName) {
|
|
9085
|
+
case "readFile": {
|
|
9086
|
+
const res = resolveInstaboxPath(bridge.root, String(args.path ?? ""));
|
|
9087
|
+
if (!res.ok) return { ok: false, error: res.error };
|
|
9088
|
+
op = "readFile";
|
|
9089
|
+
validated.path = res.path;
|
|
9090
|
+
if (typeof args.lines === "string") validated.lines = args.lines;
|
|
9091
|
+
break;
|
|
9092
|
+
}
|
|
9093
|
+
case "writeFile": {
|
|
9094
|
+
if (typeof args.content !== "string") return { ok: false, error: "missing_content" };
|
|
9095
|
+
if (Buffer.byteLength(args.content, "utf-8") > SANDBOX_OUTPUT_LIMITS.maxContentBytes) {
|
|
9096
|
+
return { ok: false, error: "content_too_large" };
|
|
9097
|
+
}
|
|
9098
|
+
const res = resolveInstaboxPath(bridge.root, String(args.path ?? ""));
|
|
9099
|
+
if (!res.ok) return { ok: false, error: res.error };
|
|
9100
|
+
op = "writeFile";
|
|
9101
|
+
validated.path = res.path;
|
|
9102
|
+
validated.content = args.content;
|
|
9103
|
+
break;
|
|
9104
|
+
}
|
|
9105
|
+
case "editFile": {
|
|
9106
|
+
if (typeof args.oldText !== "string" || typeof args.newText !== "string") {
|
|
9107
|
+
return { ok: false, error: "missing_edit_text" };
|
|
9108
|
+
}
|
|
9109
|
+
if (args.oldText === args.newText) return { ok: false, error: "edit_text_identical" };
|
|
9110
|
+
if (Buffer.byteLength(args.newText, "utf-8") > SANDBOX_OUTPUT_LIMITS.maxContentBytes) {
|
|
9111
|
+
return { ok: false, error: "content_too_large" };
|
|
9112
|
+
}
|
|
9113
|
+
const res = resolveInstaboxPath(bridge.root, String(args.path ?? ""));
|
|
9114
|
+
if (!res.ok) return { ok: false, error: res.error };
|
|
9115
|
+
op = "editFile";
|
|
9116
|
+
validated.path = res.path;
|
|
9117
|
+
validated.oldText = args.oldText;
|
|
9118
|
+
validated.newText = args.newText;
|
|
9119
|
+
break;
|
|
9120
|
+
}
|
|
9121
|
+
case "globFiles":
|
|
9122
|
+
case "glob": {
|
|
9123
|
+
if (typeof args.pattern !== "string" || !args.pattern.trim()) {
|
|
9124
|
+
return { ok: false, error: "missing_pattern" };
|
|
9125
|
+
}
|
|
9126
|
+
op = "glob";
|
|
9127
|
+
validated.pattern = args.pattern;
|
|
9128
|
+
if (typeof args.path === "string" && args.path.trim()) {
|
|
9129
|
+
const res = resolveInstaboxPath(bridge.root, args.path);
|
|
9130
|
+
if (!res.ok) return { ok: false, error: res.error };
|
|
9131
|
+
validated.path = res.path;
|
|
9132
|
+
}
|
|
9133
|
+
break;
|
|
9134
|
+
}
|
|
9135
|
+
default:
|
|
9136
|
+
return { ok: false, error: "unsupported_tool" };
|
|
9137
|
+
}
|
|
9138
|
+
const payload = Buffer.from(JSON.stringify({ op, args: validated }), "utf-8").toString("base64");
|
|
9139
|
+
if (payload.length > SANDBOX_OUTPUT_LIMITS.maxArgvBytes) {
|
|
9140
|
+
return { ok: false, error: "content_too_large" };
|
|
9141
|
+
}
|
|
9142
|
+
return { ok: true, argv: [bridge.runtime, INSTABOX_HELPER_PATH, payload] };
|
|
9143
|
+
}
|
|
9144
|
+
function buildInstaboxBridgeProbeRequest(bridge, probePath) {
|
|
9145
|
+
const payload = Buffer.from(
|
|
9146
|
+
JSON.stringify({ op: "readFile", args: { path: probePath } }),
|
|
9147
|
+
"utf-8"
|
|
9148
|
+
).toString("base64");
|
|
9149
|
+
return { kind: "command", argv: [bridge.runtime, INSTABOX_HELPER_PATH, payload] };
|
|
9150
|
+
}
|
|
9151
|
+
function readInstaboxProbeResult(stdout) {
|
|
9152
|
+
if (typeof stdout !== "string") return { ready: false, reason: "probe_failed" };
|
|
9153
|
+
const text = stdout.trim();
|
|
9154
|
+
if (!text) return { ready: false, reason: "probe_failed" };
|
|
9155
|
+
if (text.includes('"ok":false') || text.includes("'ok':false")) {
|
|
9156
|
+
return { ready: false, reason: "probe_failed" };
|
|
9157
|
+
}
|
|
9158
|
+
if (text.includes(PROBE_FILE_CONTENT)) return { ready: true };
|
|
9159
|
+
const parsed = parseToolOutput(text);
|
|
9160
|
+
if (!parsed.ok) return { ready: false, reason: "probe_failed" };
|
|
9161
|
+
const value = parsed.value;
|
|
9162
|
+
return typeof value === "object" && value !== null && typeof value.content === "string" && value.content.includes(PROBE_FILE_CONTENT) ? { ready: true } : { ready: false, reason: "probe_failed" };
|
|
9163
|
+
}
|
|
9164
|
+
function describeInstaboxBridgeUnavailable(bridge) {
|
|
9165
|
+
const detail = bridge.reason === "runtime_missing" ? "Instabox \u6A21\u677F\u5185\u65E2\u6CA1\u6709 bun \u4E5F\u6CA1\u6709 node\uFF0C\u5BB9\u5668\u5185 helper \u65E0\u6CD5\u6267\u884C" : bridge.reason === "root_unavailable" ? "Instabox \u5BB9\u5668\u5185\u65E0\u6CD5\u521B\u5EFA\u53EF\u5199\u5DE5\u4F5C\u76EE\u5F55" : bridge.reason === "upload_failed" ? "\u5BB9\u5668\u5185 helper \u4E0A\u4F20\u5931\u8D25" : bridge.reason === "root_mismatch" ? "\u5BB9\u5668\u5185\u56FA\u5B9A\u5DE5\u4F5C\u76EE\u5F55\u4E0E helper ROOT \u4E0D\u4E00\u81F4" : bridge.reason === "helper_source_invalid" ? "\u5171\u4EAB helper \u6E90\u7801\u5F62\u72B6\u53D8\u5316\uFF0C\u65E0\u6CD5\u5B89\u5168\u6539\u5199 ROOT" : "\u5BB9\u5668\u5185 helper \u63A2\u9488\u8BFB\u56DE\u5931\u8D25";
|
|
9166
|
+
return `instabox \u6587\u4EF6\u5DE5\u5177 bridge \u672A\u5C31\u7EEA\uFF08${bridge.reason ?? "probe_failed"}\uFF09\uFF1A${detail}\uFF1B\u6587\u4EF6\u5DE5\u5177\u5DF2\u663E\u5F0F\u62D2\u7EDD\uFF0C\u7EDD\u4E0D\u56DE\u843D\u5BBF\u4E3B\u6267\u884C\uFF08execShell \u4ECD\u53EF\u7528\uFF09\u3002`;
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9311
9169
|
// packages/cli/client/localInstaboxWorkload.ts
|
|
9312
9170
|
var LOCAL_INSTABOX_BACKEND_ID = INSTABOX_BACKEND_ID;
|
|
9313
9171
|
function resolveInstaboxApiKey(env) {
|
|
@@ -9328,6 +9186,35 @@ function assertInstaboxPrerequisites(env) {
|
|
|
9328
9186
|
}
|
|
9329
9187
|
return apiKey;
|
|
9330
9188
|
}
|
|
9189
|
+
function resolveInstaboxWorkspaceRoot(env) {
|
|
9190
|
+
const override = env.INSTABOX_WORKSPACE_ROOT?.trim();
|
|
9191
|
+
if (override && override.startsWith("/") && !override.includes('"')) return override;
|
|
9192
|
+
return INSTABOX_WORKSPACE_ROOT;
|
|
9193
|
+
}
|
|
9194
|
+
function posixQuote2(value) {
|
|
9195
|
+
return `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
9196
|
+
}
|
|
9197
|
+
async function prepareFileBridge(execDirect, root, probeId) {
|
|
9198
|
+
const bootstrapStdout = await execDirect({
|
|
9199
|
+
kind: "command",
|
|
9200
|
+
argv: ["bash", "-lc", buildInstaboxBridgeBootstrapScript(root, probeId)]
|
|
9201
|
+
});
|
|
9202
|
+
const parsed = parseInstaboxBootstrapOutput(bootstrapStdout);
|
|
9203
|
+
if (!parsed.root || !parsed.runtime || !parsed.probePath || parsed.reason) {
|
|
9204
|
+
return {
|
|
9205
|
+
root: parsed.root,
|
|
9206
|
+
runtime: parsed.runtime,
|
|
9207
|
+
ready: false,
|
|
9208
|
+
reason: parsed.reason ?? "probe_failed"
|
|
9209
|
+
};
|
|
9210
|
+
}
|
|
9211
|
+
const pinned = { root: parsed.root, runtime: parsed.runtime };
|
|
9212
|
+
const probeStdout = await execDirect(
|
|
9213
|
+
buildInstaboxBridgeProbeRequest(pinned, parsed.probePath)
|
|
9214
|
+
);
|
|
9215
|
+
const verdict = readInstaboxProbeResult(probeStdout);
|
|
9216
|
+
return verdict.ready ? { root: pinned.root, runtime: pinned.runtime, ready: true } : { root: pinned.root, runtime: pinned.runtime, ready: false, reason: verdict.reason ?? "probe_failed" };
|
|
9217
|
+
}
|
|
9331
9218
|
async function createLocalInstaboxWorkload(args) {
|
|
9332
9219
|
if (args.runtimeKey.trim() !== "instabox") {
|
|
9333
9220
|
throw new LocalRuntimeKeyUnsupportedError(
|
|
@@ -9342,6 +9229,7 @@ async function createLocalInstaboxWorkload(args) {
|
|
|
9342
9229
|
templateId: args.templateId ?? args.env.INSTABOX_TEMPLATE_ID?.trim() ?? "universal"
|
|
9343
9230
|
})
|
|
9344
9231
|
);
|
|
9232
|
+
const workspaceRoot = resolveInstaboxWorkspaceRoot(args.env);
|
|
9345
9233
|
const ticket = {
|
|
9346
9234
|
version: 1,
|
|
9347
9235
|
ticketId: `ticket-${args.runId}`,
|
|
@@ -9351,12 +9239,14 @@ async function createLocalInstaboxWorkload(args) {
|
|
|
9351
9239
|
callerUserId: args.authenticatedCaller || "local-caller",
|
|
9352
9240
|
executionClass: "session",
|
|
9353
9241
|
target: { kind: "server" },
|
|
9354
|
-
|
|
9242
|
+
// 本 workload 真的会执行这些工具(shell + 容器内结构化文件工具),授权声明必须一致
|
|
9243
|
+
toolNames: [EXECUTION_SHELL_TOOL, ...INSTABOX_FILE_TOOL_NAMES],
|
|
9355
9244
|
filesystem: {
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9245
|
+
// 钉住的固定工作目录:读写范围都声明成它,不写 "none" 再偷偷写文件
|
|
9246
|
+
readScope: "configured-roots",
|
|
9247
|
+
readableRoots: [workspaceRoot],
|
|
9248
|
+
writeScope: "configured-roots",
|
|
9249
|
+
writableRoots: [workspaceRoot]
|
|
9360
9250
|
},
|
|
9361
9251
|
shellAllowed: true,
|
|
9362
9252
|
requestedIsolation: "container",
|
|
@@ -9371,37 +9261,118 @@ async function createLocalInstaboxWorkload(args) {
|
|
|
9371
9261
|
`runtimeKey \u6307\u5411 instabox\uFF0C\u4F46\u4E91\u6C99\u76D2\u521D\u59CB\u5316\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}\u3002${instaboxFailureHint}`
|
|
9372
9262
|
);
|
|
9373
9263
|
}
|
|
9264
|
+
let releaseState = "active";
|
|
9265
|
+
let releasePromise = null;
|
|
9266
|
+
const releaseBackend = () => {
|
|
9267
|
+
if (releaseState === "released") return Promise.resolve();
|
|
9268
|
+
if (releasePromise) return releasePromise;
|
|
9269
|
+
releaseState = "releasing";
|
|
9270
|
+
let attempt;
|
|
9271
|
+
try {
|
|
9272
|
+
attempt = Promise.resolve(backend.release(lease, "completed"));
|
|
9273
|
+
} catch (error) {
|
|
9274
|
+
attempt = Promise.reject(error);
|
|
9275
|
+
}
|
|
9276
|
+
releasePromise = attempt.then(
|
|
9277
|
+
() => {
|
|
9278
|
+
releaseState = "released";
|
|
9279
|
+
},
|
|
9280
|
+
(error) => {
|
|
9281
|
+
releaseState = "cleanup_pending";
|
|
9282
|
+
throw error;
|
|
9283
|
+
}
|
|
9284
|
+
).finally(() => {
|
|
9285
|
+
releasePromise = null;
|
|
9286
|
+
});
|
|
9287
|
+
return releasePromise;
|
|
9288
|
+
};
|
|
9289
|
+
const describeReleaseFailure = (error) => {
|
|
9290
|
+
const record = error;
|
|
9291
|
+
const cleanupPending = record?.cleanupPending === true || record?.code === "instabox_cleanup_pending";
|
|
9292
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
9293
|
+
return cleanupPending ? `\u4E14\u673A\u5668\u5220\u9664\u672A\u786E\u8BA4\uFF1Acleanup_pending\uFF08${detail}\uFF09\u2014\u2014\u4E91\u7AEF\u53EF\u80FD\u4ECD\u6709\u5B58\u6D3B\u673A\u5668\uFF0C\u4E0D\u5F97\u5F53\u4F5C\u5DF2\u6E05\u7406\uFF0C\u9700\u4EBA\u5DE5\u6838\u5BF9\u540E\u5220\u9664` : `\u4E14 release \u4E5F\u5931\u8D25\uFF08${detail}\uFF09`;
|
|
9294
|
+
};
|
|
9295
|
+
const execDirect = async (request) => {
|
|
9296
|
+
const result = await backend.execute(lease, request);
|
|
9297
|
+
const streams = result.output;
|
|
9298
|
+
const stdout = typeof streams?.stdout === "string" ? streams.stdout : "";
|
|
9299
|
+
const stderr = typeof streams?.stderr === "string" ? streams.stderr : "";
|
|
9300
|
+
if (result.ok === false) {
|
|
9301
|
+
throw new Error(`instabox \u5BB9\u5668\u5185\u6267\u884C\u5931\u8D25\uFF1A${stderr || `exit_code:${result.exitCode ?? "unknown"}`}`);
|
|
9302
|
+
}
|
|
9303
|
+
return stdout;
|
|
9304
|
+
};
|
|
9305
|
+
let bridge;
|
|
9306
|
+
try {
|
|
9307
|
+
bridge = await prepareFileBridge(execDirect, workspaceRoot, args.runId);
|
|
9308
|
+
} catch (error) {
|
|
9309
|
+
let cleanupNote = "\u672C\u6B21 lease \u5DF2\u91CA\u653E";
|
|
9310
|
+
try {
|
|
9311
|
+
await releaseBackend();
|
|
9312
|
+
} catch (releaseError) {
|
|
9313
|
+
cleanupNote = describeReleaseFailure(releaseError);
|
|
9314
|
+
}
|
|
9315
|
+
throw new LocalRuntimeKeyUnsupportedError(
|
|
9316
|
+
"instabox_bridge_bootstrap_failed",
|
|
9317
|
+
`runtimeKey \u6307\u5411 instabox\uFF0C\u4F46\u5BB9\u5668\u5185\u6587\u4EF6\u5DE5\u5177\u6865 bootstrap \u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}\uFF1B${cleanupNote}\u3002${instaboxFailureHint}`
|
|
9318
|
+
);
|
|
9319
|
+
}
|
|
9374
9320
|
const rawChannel = createExecutionChannel({
|
|
9375
9321
|
backend,
|
|
9376
9322
|
lease,
|
|
9377
|
-
timeoutMs: 10 * 60 * 1e3
|
|
9323
|
+
timeoutMs: 10 * 60 * 1e3,
|
|
9324
|
+
...bridge.ready && bridge.root && bridge.runtime ? {
|
|
9325
|
+
helper: {
|
|
9326
|
+
path: INSTABOX_HELPER_PATH,
|
|
9327
|
+
buildArgv: (toolName, toolArgs) => buildInstaboxToolArgv(toolName, toolArgs, {
|
|
9328
|
+
root: bridge.root,
|
|
9329
|
+
runtime: bridge.runtime
|
|
9330
|
+
})
|
|
9331
|
+
}
|
|
9332
|
+
} : {}
|
|
9378
9333
|
});
|
|
9379
|
-
let released = false;
|
|
9380
9334
|
const release = async () => {
|
|
9381
|
-
|
|
9382
|
-
released = true;
|
|
9383
|
-
try {
|
|
9384
|
-
await backend.release(lease, "completed");
|
|
9385
|
-
} catch {
|
|
9386
|
-
}
|
|
9335
|
+
await releaseBackend();
|
|
9387
9336
|
};
|
|
9388
9337
|
const channel = async (toolName, toolArgs, signal) => {
|
|
9389
|
-
if (
|
|
9338
|
+
if (releaseState !== "active") {
|
|
9390
9339
|
throw new Error(
|
|
9391
|
-
"instabox workload \u5DF2\u91CA\u653E\uFF1A\u672C run \u7684 lease \u5DF2\u5931\u6548\uFF0C\u62D2\u7EDD\u5728\u5BBF\u4E3B\u6267\u884C\u5DE5\u5177"
|
|
9340
|
+
releaseState === "cleanup_pending" ? "instabox workload cleanup_pending\uFF1A\u4E0A\u4E00\u6B21\u6E05\u7406\u672A\u786E\u8BA4\uFF0Clease \u72B6\u6001\u4E0D\u53EF\u4FE1\uFF0C\u62D2\u7EDD\u6267\u884C\u5DE5\u5177" : "instabox workload \u5DF2\u91CA\u653E\uFF1A\u672C run \u7684 lease \u5DF2\u5931\u6548\uFF0C\u62D2\u7EDD\u5728\u5BBF\u4E3B\u6267\u884C\u5DE5\u5177"
|
|
9392
9341
|
);
|
|
9393
9342
|
}
|
|
9394
9343
|
if (toolName === "execShell") {
|
|
9344
|
+
const command = typeof toolArgs.command === "string" ? toolArgs.command : void 0;
|
|
9345
|
+
if (bridge.root && command !== void 0) {
|
|
9346
|
+
return await rawChannel(EXECUTION_SHELL_TOOL, {
|
|
9347
|
+
...toolArgs,
|
|
9348
|
+
command: `cd ${posixQuote2(bridge.root)} && ${command}`
|
|
9349
|
+
}, signal);
|
|
9350
|
+
}
|
|
9395
9351
|
return await rawChannel(EXECUTION_SHELL_TOOL, toolArgs, signal);
|
|
9396
9352
|
}
|
|
9353
|
+
if (INSTABOX_FILE_TOOL_NAMES.includes(toolName)) {
|
|
9354
|
+
if (!bridge.ready) {
|
|
9355
|
+
throw new Error(describeInstaboxBridgeUnavailable(bridge));
|
|
9356
|
+
}
|
|
9357
|
+
const output = await rawChannel(toolName, toolArgs, signal);
|
|
9358
|
+
const parsed = parseToolOutput(output);
|
|
9359
|
+
if (!parsed.ok) {
|
|
9360
|
+
return JSON.stringify({ ok: false, error: parsed.error, workloadLocation: "instabox" });
|
|
9361
|
+
}
|
|
9362
|
+
const value = parsed.value;
|
|
9363
|
+
const payload = typeof value === "object" && value !== null ? { ok: true, ...value, value, workloadLocation: "instabox" } : { ok: true, value, workloadLocation: "instabox" };
|
|
9364
|
+
return JSON.stringify(payload);
|
|
9365
|
+
}
|
|
9397
9366
|
throw new Error(
|
|
9398
|
-
`instabox workload \u6682\
|
|
9367
|
+
`instabox workload \u6682\u4E0D\u652F\u6301\u5DE5\u5177 "${toolName}"\uFF08\u672C\u5757\u53EA\u6865\u63A5 readFile/writeFile/editFile/globFiles\uFF09\uFF1B\u62D2\u7EDD\u5728\u5BBF\u4E3B\u6267\u884C\u3002`
|
|
9399
9368
|
);
|
|
9400
9369
|
};
|
|
9401
9370
|
return {
|
|
9402
9371
|
backendId: LOCAL_INSTABOX_BACKEND_ID,
|
|
9403
9372
|
runId: args.runId,
|
|
9404
9373
|
channel,
|
|
9374
|
+
workspaceRoot: bridge.root,
|
|
9375
|
+
fileBridge: bridge,
|
|
9405
9376
|
release
|
|
9406
9377
|
};
|
|
9407
9378
|
}
|
|
@@ -9608,12 +9579,12 @@ function parseExecShellChannelOutput(raw) {
|
|
|
9608
9579
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
9609
9580
|
return { stdout: text, exitCode: 0, ...isTruncated(text) ? { truncated: true } : {} };
|
|
9610
9581
|
}
|
|
9611
|
-
const
|
|
9612
|
-
const output =
|
|
9613
|
-
const stdout = firstString(output?.stdout,
|
|
9614
|
-
const truncated =
|
|
9615
|
-
const explicitFailure =
|
|
9616
|
-
const rawExit =
|
|
9582
|
+
const record = parsed;
|
|
9583
|
+
const output = record.output && typeof record.output === "object" ? record.output : void 0;
|
|
9584
|
+
const stdout = firstString(output?.stdout, record.stdout, record.output, record.content) ?? "";
|
|
9585
|
+
const truncated = record.truncated === true || output?.truncated === true || isTruncated(stdout) || isTruncated(firstString(output?.stderr, record.stderr) ?? "");
|
|
9586
|
+
const explicitFailure = record.ok === false || typeof record.error === "string";
|
|
9587
|
+
const rawExit = record.exitCode ?? record.exit_code;
|
|
9617
9588
|
const exitCode = typeof rawExit === "number" ? rawExit : explicitFailure ? 1 : 0;
|
|
9618
9589
|
if (explicitFailure && stdout.trim() === "") return { stdout: "", exitCode: exitCode === 0 ? 1 : exitCode, ...truncated ? { truncated: true } : {} };
|
|
9619
9590
|
return { stdout, exitCode, ...truncated ? { truncated: true } : {} };
|
|
@@ -9661,9 +9632,9 @@ async function exportRunDiffArtifact(args) {
|
|
|
9661
9632
|
return null;
|
|
9662
9633
|
}
|
|
9663
9634
|
if (args.writeAudit) {
|
|
9664
|
-
const
|
|
9635
|
+
const record = { runId: args.runId, kind: "diff", key, ref };
|
|
9665
9636
|
try {
|
|
9666
|
-
await args.writeAudit(
|
|
9637
|
+
await args.writeAudit(record);
|
|
9667
9638
|
} catch (error) {
|
|
9668
9639
|
warn(`run \u7EC8\u6001\u5BFC\u51FA\u5BA1\u8BA1\u5199\u5165\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD run \u7ED3\u679C\uFF09\uFF1A${describeError2(error)}`);
|
|
9669
9640
|
}
|
|
@@ -9740,8 +9711,8 @@ async function exportRunWorktreeDiffArtifacts(args) {
|
|
|
9740
9711
|
}
|
|
9741
9712
|
return summary;
|
|
9742
9713
|
}
|
|
9743
|
-
function serializeRunArtifactAudit(
|
|
9744
|
-
return `${JSON.stringify(
|
|
9714
|
+
function serializeRunArtifactAudit(record) {
|
|
9715
|
+
return `${JSON.stringify(record, null, 2)}
|
|
9745
9716
|
`;
|
|
9746
9717
|
}
|
|
9747
9718
|
|
|
@@ -10306,9 +10277,9 @@ async function writeLocalTokenRecord(args) {
|
|
|
10306
10277
|
function extractLastProviderInputTokens(input) {
|
|
10307
10278
|
if (input.usageRecords && input.usageRecords.length > 0) {
|
|
10308
10279
|
for (let i = input.usageRecords.length - 1; i >= 0; i--) {
|
|
10309
|
-
const
|
|
10310
|
-
if (!
|
|
10311
|
-
const normalized = normalizeUsage(
|
|
10280
|
+
const record = input.usageRecords[i];
|
|
10281
|
+
if (!record?.usage) continue;
|
|
10282
|
+
const normalized = normalizeUsage(record.usage);
|
|
10312
10283
|
if (normalized.input_tokens > 0) {
|
|
10313
10284
|
return normalized.input_tokens;
|
|
10314
10285
|
}
|
|
@@ -10491,21 +10462,21 @@ function resolveCliDialogRecordKey(userId, dialogId) {
|
|
|
10491
10462
|
}
|
|
10492
10463
|
async function loadCliDialogSummary(args) {
|
|
10493
10464
|
const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
|
|
10494
|
-
const
|
|
10495
|
-
if (!
|
|
10496
|
-
const summary = typeof
|
|
10465
|
+
const record = await args.store.read(dialogKey);
|
|
10466
|
+
if (!record || typeof record !== "object") return null;
|
|
10467
|
+
const summary = typeof record.summary === "string" ? record.summary.trim() : "";
|
|
10497
10468
|
if (!summary) return null;
|
|
10498
|
-
const summarizedBeforeId =
|
|
10499
|
-
const sourceHash =
|
|
10500
|
-
const sourceCount =
|
|
10501
|
-
const schemaVersion =
|
|
10469
|
+
const summarizedBeforeId = record.summarizedBeforeId;
|
|
10470
|
+
const sourceHash = record.sourceHash;
|
|
10471
|
+
const sourceCount = record.sourceCount;
|
|
10472
|
+
const schemaVersion = record.schemaVersion;
|
|
10502
10473
|
return {
|
|
10503
10474
|
summary,
|
|
10504
10475
|
...typeof summarizedBeforeId === "string" && summarizedBeforeId ? { summarizedBeforeId } : {},
|
|
10505
10476
|
...typeof sourceHash === "string" && sourceHash ? { sourceHash } : {},
|
|
10506
10477
|
...typeof sourceCount === "number" && sourceCount > 0 ? { sourceCount } : {},
|
|
10507
|
-
..."schemaVersion" in
|
|
10508
|
-
...Array.isArray(
|
|
10478
|
+
..."schemaVersion" in record ? { schemaVersion } : {},
|
|
10479
|
+
...Array.isArray(record.referenceKeys) ? { referenceKeys: record.referenceKeys.filter((key) => typeof key === "string") } : {}
|
|
10509
10480
|
};
|
|
10510
10481
|
}
|
|
10511
10482
|
async function saveCliDialogSummary(args) {
|
|
@@ -10534,9 +10505,9 @@ async function saveCliDialogSummary(args) {
|
|
|
10534
10505
|
}
|
|
10535
10506
|
async function loadCliDialogLastContextUsage(args) {
|
|
10536
10507
|
const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
|
|
10537
|
-
const
|
|
10538
|
-
if (!
|
|
10539
|
-
const lastInputTokens =
|
|
10508
|
+
const record = await args.store.read(dialogKey, { remote: false });
|
|
10509
|
+
if (!record || typeof record !== "object") return null;
|
|
10510
|
+
const lastInputTokens = record.lastInputTokens;
|
|
10540
10511
|
if (typeof lastInputTokens === "number" && Number.isFinite(lastInputTokens) && lastInputTokens > 0) {
|
|
10541
10512
|
return { inputTokens: lastInputTokens };
|
|
10542
10513
|
}
|
|
@@ -10553,6 +10524,36 @@ function parseTitleUpdatedAtMs(existingDialog) {
|
|
|
10553
10524
|
}
|
|
10554
10525
|
|
|
10555
10526
|
// packages/cli/client/localRuntimeAdapter.ts
|
|
10527
|
+
var LOCAL_INSTABOX_TOOL_NAMES = [
|
|
10528
|
+
EXECUTION_SHELL_TOOL,
|
|
10529
|
+
...INSTABOX_FILE_TOOL_NAMES
|
|
10530
|
+
];
|
|
10531
|
+
function resolveLocalInstaboxToolRoute(args) {
|
|
10532
|
+
const toolName = normalizeLocalToolName(args.toolName);
|
|
10533
|
+
if (!LOCAL_INSTABOX_TOOL_NAMES.includes(toolName)) {
|
|
10534
|
+
return WORKSPACE_TOOL_NAMES.includes(toolName) ? {
|
|
10535
|
+
action: "reject",
|
|
10536
|
+
toolName,
|
|
10537
|
+
reason: `instabox workload \u4E0D\u652F\u6301\u5DE5\u4F5C\u533A\u5DE5\u5177 "${toolName}"\uFF08instabox \u5DE5\u5177\u9762\uFF1A${LOCAL_INSTABOX_TOOL_NAMES.join(", ")}\uFF09\uFF1B\u62D2\u7EDD\u56DE\u843D\u5230\u5BBF\u4E3B\u6267\u884C`
|
|
10538
|
+
} : { action: "passthrough", toolName };
|
|
10539
|
+
}
|
|
10540
|
+
const agentToolNames = (args.agentToolNames ?? []).map(
|
|
10541
|
+
normalizeLocalToolName
|
|
10542
|
+
);
|
|
10543
|
+
const deniedBySurfaceOrPolicy = !agentToolNames.includes(toolName) || !resolveLocalToolPolicy({
|
|
10544
|
+
env: args.env ?? {},
|
|
10545
|
+
agentToolNames,
|
|
10546
|
+
toolName
|
|
10547
|
+
}).allowed;
|
|
10548
|
+
if (deniedBySurfaceOrPolicy) {
|
|
10549
|
+
return {
|
|
10550
|
+
action: "reject",
|
|
10551
|
+
toolName,
|
|
10552
|
+
reason: `${toolName} is outside the run tool surface / policy \u2014 instabox workload \u4E0D\u662F\u7ED5\u8FC7 deny \u7684\u901A\u9053\uFF1B\u62D2\u7EDD\u5728\u5BBF\u4E3B\u6267\u884C\u5DE5\u4F5C\u533A\u5DE5\u5177`
|
|
10553
|
+
};
|
|
10554
|
+
}
|
|
10555
|
+
return { action: "intercept", toolName };
|
|
10556
|
+
}
|
|
10556
10557
|
var currentMetaFile = fileURLToPath(import.meta.url);
|
|
10557
10558
|
var isJsBundle = extname(currentMetaFile) === ".js";
|
|
10558
10559
|
var SOURCE_CLI_DIR = isJsBundle ? dirname4(currentMetaFile) : dirname4(dirname4(currentMetaFile));
|
|
@@ -10592,13 +10593,13 @@ async function recordLocalAvailabilityForAgent(args) {
|
|
|
10592
10593
|
);
|
|
10593
10594
|
return typeof entry?.nextAvailableAt === "number" ? entry.nextAvailableAt : action.nextAvailableAt;
|
|
10594
10595
|
}
|
|
10595
|
-
const
|
|
10596
|
-
if (action.kind === "clear" && !("nextAvailableAt" in
|
|
10597
|
-
const next = { ...
|
|
10596
|
+
const record = current;
|
|
10597
|
+
if (action.kind === "clear" && !("nextAvailableAt" in record)) return void 0;
|
|
10598
|
+
const next = { ...record };
|
|
10598
10599
|
let effectiveNextAvailableAt;
|
|
10599
10600
|
if (action.kind === "mark") {
|
|
10600
10601
|
const merged = mergeAvailabilityDeadline(
|
|
10601
|
-
|
|
10602
|
+
record.nextAvailableAt,
|
|
10602
10603
|
action.nextAvailableAt
|
|
10603
10604
|
);
|
|
10604
10605
|
next.nextAvailableAt = merged;
|
|
@@ -10640,13 +10641,13 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10640
10641
|
const additionalToolNames = deps.pastedTextStore ? ["readPastedText"] : [];
|
|
10641
10642
|
const resolveAgentCredentialGroup = async (agentRef) => {
|
|
10642
10643
|
try {
|
|
10643
|
-
const
|
|
10644
|
+
const record = await readAgentFromStore({
|
|
10644
10645
|
agentRef,
|
|
10645
10646
|
store: await getOrCreateSharedStore(deps),
|
|
10646
10647
|
userId
|
|
10647
10648
|
});
|
|
10648
|
-
if (!
|
|
10649
|
-
const rec =
|
|
10649
|
+
if (!record || typeof record !== "object") return void 0;
|
|
10650
|
+
const rec = record;
|
|
10650
10651
|
const existing = typeof rec.credentialGroup === "string" && rec.credentialGroup.trim() ? rec.credentialGroup.trim() : void 0;
|
|
10651
10652
|
if (existing) return existing;
|
|
10652
10653
|
const ref = typeof rec.apiKeyRef === "string" && rec.apiKeyRef.trim() ? rec.apiKeyRef : typeof rec.credentialRef === "string" && rec.credentialRef.trim() ? rec.credentialRef : void 0;
|
|
@@ -10660,13 +10661,13 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10660
10661
|
};
|
|
10661
10662
|
const resolveAgentDisplayName = async (agentRef) => {
|
|
10662
10663
|
try {
|
|
10663
|
-
const
|
|
10664
|
+
const record = await readAgentFromStore({
|
|
10664
10665
|
agentRef,
|
|
10665
10666
|
store: await getOrCreateSharedStore(deps),
|
|
10666
10667
|
userId
|
|
10667
10668
|
});
|
|
10668
|
-
if (!
|
|
10669
|
-
const name =
|
|
10669
|
+
if (!record || typeof record !== "object") return void 0;
|
|
10670
|
+
const name = record.name;
|
|
10670
10671
|
return typeof name === "string" && name.trim() ? name.trim() : void 0;
|
|
10671
10672
|
} catch {
|
|
10672
10673
|
return void 0;
|
|
@@ -10674,12 +10675,12 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10674
10675
|
};
|
|
10675
10676
|
const resolveAgentRuntimeBindingMachineId = async (agentRef) => {
|
|
10676
10677
|
try {
|
|
10677
|
-
const
|
|
10678
|
+
const record = await readAgentFromStore({
|
|
10678
10679
|
agentRef,
|
|
10679
10680
|
store: await getOrCreateSharedStore(deps),
|
|
10680
10681
|
userId
|
|
10681
10682
|
});
|
|
10682
|
-
const rec =
|
|
10683
|
+
const rec = record;
|
|
10683
10684
|
const binding = asRecordOrEmpty(rec?.runtimeBinding);
|
|
10684
10685
|
return asOptionalTrimmedString(binding.machineId);
|
|
10685
10686
|
} catch {
|
|
@@ -10723,16 +10724,24 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10723
10724
|
authenticatedCaller: resolveLocalUserId(deps.env),
|
|
10724
10725
|
agentKey: "cli-local-run",
|
|
10725
10726
|
env: deps.env,
|
|
10726
|
-
workspaceRoot
|
|
10727
|
+
workspaceRoot,
|
|
10728
|
+
...deps.dockerWorkspaceMode ? { workspaceMode: deps.dockerWorkspaceMode } : {}
|
|
10727
10729
|
}))();
|
|
10728
10730
|
return dockerWorkloadLoad;
|
|
10729
10731
|
};
|
|
10730
10732
|
const instaboxRuntimeEnabled = runtimeKey === "instabox";
|
|
10731
10733
|
let instaboxWorkloadLoad = null;
|
|
10732
10734
|
let instaboxWorkloadReleased = false;
|
|
10735
|
+
let instaboxReleasePending = false;
|
|
10736
|
+
let instaboxReleasePromise = null;
|
|
10733
10737
|
const createInstaboxWorkload = deps.createLocalInstaboxWorkload ?? createLocalInstaboxWorkload;
|
|
10734
10738
|
const loadLocalInstaboxWorkload = () => {
|
|
10735
10739
|
if (!instaboxRuntimeEnabled) return Promise.resolve(null);
|
|
10740
|
+
if (instaboxReleasePending) {
|
|
10741
|
+
return Promise.reject(
|
|
10742
|
+
new Error("instabox workload cleanup_pending\uFF1Alease cleanup \u5C1A\u672A\u786E\u8BA4\uFF0C\u62D2\u7EDD\u6267\u884C\u5DE5\u5177")
|
|
10743
|
+
);
|
|
10744
|
+
}
|
|
10736
10745
|
if (instaboxWorkloadReleased) {
|
|
10737
10746
|
return Promise.reject(
|
|
10738
10747
|
new Error(
|
|
@@ -10759,7 +10768,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10759
10768
|
const recordRunExecutionIsolation = async () => {
|
|
10760
10769
|
try {
|
|
10761
10770
|
const { writeFileSync: writeFileSync4, mkdirSync: mkdirSync4 } = await import("node:fs");
|
|
10762
|
-
const { resolveRunsDir } = await import("./agentRunControl-
|
|
10771
|
+
const { resolveRunsDir } = await import("./agentRunControl-PPYWJRIJ.js");
|
|
10763
10772
|
const fact = resolveLocalRunExecutionIsolationFact({
|
|
10764
10773
|
// F1:显式点名宿主执行的 run 在审计里必须与 docker 沙盒区分开
|
|
10765
10774
|
// (reason: host-explicit-writes vs docker-workload)。
|
|
@@ -10791,7 +10800,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10791
10800
|
dockerWorkloadReleased = true;
|
|
10792
10801
|
dockerWorkloadLoad = null;
|
|
10793
10802
|
if (loaded) {
|
|
10794
|
-
const { resolveRunsDir } = await import("./agentRunControl-
|
|
10803
|
+
const { resolveRunsDir } = await import("./agentRunControl-PPYWJRIJ.js");
|
|
10795
10804
|
const exportRunDiff = deps.exportDockerRunDiffArtifact ?? exportDockerRunDiffArtifact;
|
|
10796
10805
|
const warn = (message) => process.stderr.write(`[nolo] ${message}
|
|
10797
10806
|
`);
|
|
@@ -10814,13 +10823,34 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10814
10823
|
const loadLocalSandboxWorkload = () => localSandboxLoad ??= createSandboxWorkload({ workspaceRoot }).catch(
|
|
10815
10824
|
() => null
|
|
10816
10825
|
);
|
|
10817
|
-
const releaseLocalInstaboxWorkload =
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10826
|
+
const releaseLocalInstaboxWorkload = () => {
|
|
10827
|
+
if (instaboxReleasePromise) return instaboxReleasePromise;
|
|
10828
|
+
const attempt = (async () => {
|
|
10829
|
+
const loaded = instaboxWorkloadLoad ? await instaboxWorkloadLoad.catch(() => null) : null;
|
|
10830
|
+
if (!loaded) {
|
|
10831
|
+
instaboxWorkloadReleased = true;
|
|
10832
|
+
instaboxWorkloadLoad = null;
|
|
10833
|
+
return;
|
|
10834
|
+
}
|
|
10835
|
+
try {
|
|
10836
|
+
await loaded.release();
|
|
10837
|
+
instaboxWorkloadReleased = true;
|
|
10838
|
+
instaboxReleasePending = false;
|
|
10839
|
+
instaboxWorkloadLoad = null;
|
|
10840
|
+
} catch (error) {
|
|
10841
|
+
instaboxReleasePending = true;
|
|
10842
|
+
const record = error;
|
|
10843
|
+
const code = record?.code === "instabox_cleanup_pending" || record?.cleanupPending === true ? "cleanup_pending" : "release_failed";
|
|
10844
|
+
process.stderr.write(`[nolo] instabox_release_${code}
|
|
10845
|
+
`);
|
|
10846
|
+
throw error;
|
|
10847
|
+
}
|
|
10848
|
+
})();
|
|
10849
|
+
instaboxReleasePromise = attempt;
|
|
10850
|
+
void attempt.finally(() => {
|
|
10851
|
+
if (instaboxReleasePromise === attempt) instaboxReleasePromise = null;
|
|
10852
|
+
}).catch(() => void 0);
|
|
10853
|
+
return attempt;
|
|
10824
10854
|
};
|
|
10825
10855
|
const releaseLocalSandboxWorkload = async () => {
|
|
10826
10856
|
await releaseLocalDockerWorkload();
|
|
@@ -11297,18 +11327,30 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11297
11327
|
}
|
|
11298
11328
|
}
|
|
11299
11329
|
if (instaboxRuntimeEnabled) {
|
|
11300
|
-
const
|
|
11301
|
-
|
|
11302
|
-
|
|
11330
|
+
const instaboxRoute = resolveLocalInstaboxToolRoute({
|
|
11331
|
+
toolName: call.name,
|
|
11332
|
+
env: deps.env,
|
|
11333
|
+
agentToolNames: activeAgentToolNames
|
|
11334
|
+
});
|
|
11335
|
+
if (instaboxRoute.action === "reject") {
|
|
11336
|
+
throw new Error(instaboxRoute.reason);
|
|
11337
|
+
}
|
|
11338
|
+
if (instaboxRoute.action === "intercept") {
|
|
11339
|
+
const instaboxHandle = await loadLocalInstaboxWorkload();
|
|
11340
|
+
if (!instaboxHandle) {
|
|
11341
|
+
throw new Error(
|
|
11342
|
+
`instabox workload \u4E0D\u53EF\u7528\uFF08\u65E0 handle\uFF09\uFF1A\u62D2\u7EDD\u5728\u5BBF\u4E3B\u6267\u884C\u5DE5\u4F5C\u533A\u5DE5\u5177 "${instaboxRoute.toolName}"`
|
|
11343
|
+
);
|
|
11344
|
+
}
|
|
11303
11345
|
const instaboxArgs = parseToolArgumentsObject(injectedCall.arguments) ?? {};
|
|
11304
11346
|
const instaboxOutput = await instaboxHandle.channel(
|
|
11305
|
-
|
|
11347
|
+
instaboxRoute.toolName,
|
|
11306
11348
|
instaboxArgs,
|
|
11307
11349
|
opts?.abortSignal
|
|
11308
11350
|
);
|
|
11309
11351
|
if (typeof instaboxOutput !== "string") {
|
|
11310
11352
|
throw new Error(
|
|
11311
|
-
`instabox workload \u672A\u8FD4\u56DE\u7ED3\u679C\uFF08tool=${
|
|
11353
|
+
`instabox workload \u672A\u8FD4\u56DE\u7ED3\u679C\uFF08tool=${instaboxRoute.toolName}\uFF09\uFF1A\u62D2\u7EDD\u56DE\u843D\u5230\u5BBF\u4E3B\u6267\u884C`
|
|
11312
11354
|
);
|
|
11313
11355
|
}
|
|
11314
11356
|
return { content: instaboxOutput };
|
|
@@ -11506,6 +11548,7 @@ export {
|
|
|
11506
11548
|
loadCliDialogSummary,
|
|
11507
11549
|
saveCliDialogSummary,
|
|
11508
11550
|
loadCliDialogLastContextUsage,
|
|
11551
|
+
resolveLocalInstaboxToolRoute,
|
|
11509
11552
|
recordLocalAvailabilityForAgent,
|
|
11510
11553
|
setCliAutoCompactionSummaryFallback,
|
|
11511
11554
|
getCliAutoCompactionSummaryFallback,
|