nolo-cli 0.158.0-alpha.1 → 0.158.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-6BMU3URY.js → _executeModel-AGVQAILR.js} +47 -47
- package/accountResolver-55EDKEIK.js +1 -1
- package/action-GPPJC5TI.js +1 -1
- package/{addContentAction-BI6RDRTQ.js → addContentAction-XJQEJ4XW.js} +6 -6
- package/{addDialogAgentAction-4RJYUSIK.js → addDialogAgentAction-5WZX5CAY.js} +5 -5
- package/{agentDeleteCommand-Q2XWGBC2.js → agentDeleteCommand-56DO7V2R.js} +66 -67
- package/{agentEmailCommands-XFBE2A3F.js → agentEmailCommands-BPUATKQ6.js} +69 -70
- package/{agentListCommands-OROMT4P3.js → agentListCommands-KS5VUGOW.js} +63 -40
- package/{agentMachineCommands-ULK5YKKJ.js → agentMachineCommands-HSJS7IQK.js} +32 -30
- package/{agentProviderCommands-MKG2OOEY.js → agentProviderCommands-CXBHNONN.js} +5 -5
- package/{agentPullCommand-FA43RBRU.js → agentPullCommand-GXXEDOSA.js} +4 -4
- package/{agentRecordCommands-3VHBLS6P.js → agentRecordCommands-IDGVLDMB.js} +63 -64
- package/{agentRunCommand-LCIMEAQY.js → agentRunCommand-LGMDPPPA.js} +65 -66
- package/{agentRunControl-2C5GM3BW.js → agentRunControl-QWFFIAQY.js} +9 -7
- package/{agentRuntimeLocal-NPJS2QDP.js → agentRuntimeLocal-QL4SHNJJ.js} +21 -19
- package/{agentSlice-VRAPG6CH.js → agentSlice-WPXWY6BV.js} +6 -6
- package/{appDeleteCommands-AZ3KS4HK.js → appDeleteCommands-FLCTFYZB.js} +31 -29
- package/{appDeployCommands-BTV22ICJ.js → appDeployCommands-UU4Z7DT3.js} +31 -29
- package/{appDeployStatusCommands-JSW3HPIW.js → appDeployStatusCommands-GKLZTHTX.js} +31 -29
- package/{appGetCommands-5KTTFIMV.js → appGetCommands-DPQ2MVJC.js} +31 -29
- package/{appListCommands-3BJPAE2U.js → appListCommands-J6QMEBNL.js} +31 -29
- package/{authCommand-NIV3DKPF.js → authCommand-OVBMDPIF.js} +20 -20
- package/{authCommands-AMNIAKEG.js → authCommands-QOCKVPX3.js} +5 -5
- package/{builtinSkillRegistry-H3AY27TR.js → builtinSkillRegistry-LJV7FHNI.js} +4 -4
- package/{chunk-O4ZERG3M.js → chunk-2HG7O7QF.js} +8 -8
- package/{chunk-EQGFFDNA.js → chunk-323QA7RW.js} +3 -3
- package/{chunk-2SOS7OSQ.js → chunk-3GCLICFW.js} +37 -4
- package/{chunk-US6MKPE7.js → chunk-3L5MSPWX.js} +1 -1
- package/{chunk-QLQ573SU.js → chunk-3M52COK5.js} +120 -0
- package/{chunk-2BKUVRC5.js → chunk-4VDSF5NQ.js} +9 -9
- package/{chunk-NKPAHRMA.js → chunk-4XHZ4QXL.js} +15 -15
- package/{chunk-ZEY4NJRE.js → chunk-5IKRTRRR.js} +5 -5
- package/{chunk-P5QACQDK.js → chunk-62TBKWTV.js} +1 -1
- package/{chunk-IYBIRCQV.js → chunk-6BNW7WC4.js} +29 -11
- package/{chunk-TRW43TSC.js → chunk-6EQD4AQL.js} +41 -1
- package/{chunk-YLMMECCH.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-JPJGMOIM.js → chunk-7JO3ZACS.js} +2 -2
- package/{chunk-L6EQV5OC.js → chunk-7NKZA46B.js} +3 -3
- package/{chunk-WXFZ4P6O.js → chunk-AO2T6MWY.js} +12 -12
- package/{chunk-2MTE2PEH.js → chunk-ASSNAASW.js} +5 -739
- package/{chunk-J2ATF74A.js → chunk-BAWAKW7X.js} +1 -1
- package/{chunk-7RF4O6AT.js → chunk-BL4HFN6L.js} +1 -1
- package/{chunk-ICRRXBRN.js → chunk-BWIR5QBI.js} +6 -3
- package/{chunk-ZVQHBIWV.js → chunk-CDLP56BS.js} +7 -7
- package/{chunk-6TF64IF2.js → chunk-DI7ZFGDQ.js} +16 -2
- package/{chunk-C3OK72G3.js → chunk-DJ2BOPJY.js} +1 -1
- package/{chunk-OON4OBWI.js → chunk-DLV3H464.js} +7 -7
- package/{chunk-LV4LV2B4.js → chunk-DOBOKBKS.js} +7 -5
- package/{chunk-IRTOYSA2.js → chunk-ESMZW5PE.js} +1 -1
- package/{chunk-HB4XPBC7.js → chunk-EWO77ZGF.js} +9 -11
- package/{chunk-FY4SDK2E.js → chunk-FDLDMJTM.js} +1 -1
- package/{chunk-IE5PXKVU.js → chunk-G3VYRPTV.js} +5 -5
- package/{chunk-AJ4V34SG.js → chunk-HCZOSYTL.js} +19 -19
- package/{chunk-C6FY7HWI.js → chunk-HEC32F3G.js} +46 -1
- package/{chunk-WTFRBJT5.js → chunk-HSY7F4PP.js} +32 -34
- package/{chunk-UFYBYB26.js → chunk-I7S63QUU.js} +1 -1
- package/{chunk-CON6SI7N.js → chunk-IF7V3CBU.js} +1 -1
- package/{chunk-4RJJDA57.js → chunk-IW64YHXL.js} +154 -30
- package/chunk-JLR5NWP2.js +548 -0
- package/{chunk-K43ZF2C3.js → chunk-JPPQ3GUO.js} +1 -1
- package/{chunk-M2P3OGXZ.js → chunk-JWEXJ573.js} +2 -2
- package/{chunk-3C2QLERX.js → chunk-KMDDG73K.js} +1 -1
- package/{chunk-KKKHAF3P.js → chunk-KMKVQNFH.js} +3 -3
- package/{chunk-ZBXIKCZ4.js → chunk-KQT46A27.js} +368 -91
- package/{chunk-5MM7NNO6.js → chunk-KSTEXKL6.js} +78 -39
- package/{chunk-MM3662RS.js → chunk-LPO6AMQU.js} +780 -64
- package/{chunk-YTXQ2U2X.js → chunk-M3IBEHBT.js} +144 -44
- package/{chunk-SPKLALBU.js → chunk-MAYW6V3E.js} +1 -1
- package/{chunk-IPAW7XLD.js → chunk-MFVOJ6KF.js} +2 -2
- package/{chunk-UCLSOLX4.js → chunk-MLEANT7D.js} +13 -13
- package/{chunk-NDZOXXIM.js → chunk-NHEWV5FD.js} +1 -1
- package/{chunk-4UOEOHY3.js → chunk-OE4FM66I.js} +5 -5
- package/chunk-OHRQXEON.js +2685 -0
- package/{chunk-SUKSWFLP.js → chunk-PIG2IUVZ.js} +1 -1
- package/{chunk-6MXDOUMH.js → chunk-R4BMKAR5.js} +70 -8
- package/{chunk-S72LMV7T.js → chunk-RCZMREV2.js} +4793 -3390
- package/chunk-SAZSXMTR.js +188 -0
- package/{chunk-DC3SZCRR.js → chunk-SH3XD4E2.js} +2 -2
- package/{chunk-JGRPBIZZ.js → chunk-SQX235S2.js} +1 -1
- package/{chunk-2AB2HA4M.js → chunk-TDX2L4W2.js} +8 -2
- package/{chunk-G476FQ7Q.js → chunk-TSTLLGAC.js} +4 -4
- package/{chunk-3TBHZPNG.js → chunk-TTVMMYVH.js} +295 -55
- package/{chunk-I2RMFLLH.js → chunk-V7PCFWX3.js} +1 -1
- package/{chunk-QPY264HO.js → chunk-W7FGZRLK.js} +1 -1
- package/{chunk-BYQOCH75.js → chunk-XYW6JSRD.js} +2 -2
- package/{chunk-KLA62VVE.js → chunk-Y45LLH6C.js} +42 -11
- package/{chunk-CDWHHLK5.js → chunk-Y7F4Q7YP.js} +4 -4
- package/{chunk-JZX2XLKC.js → chunk-YCRROBDY.js} +1 -1
- package/{chunk-GAVUTXM5.js → chunk-YFEVODB4.js} +18 -194
- package/{chunk-G2WP7VPD.js → chunk-YKTAUOS7.js} +18 -6
- package/{chunk-YANF2RR4.js → chunk-ZPKUJROL.js} +1 -1
- package/{commandRegistry-D6JTVYKG.js → commandRegistry-HHTMBO55.js} +85 -85
- package/{contentThunks-DYQO4CTI.js → contentThunks-ZSKJTGS7.js} +17 -18
- package/{cooldownCommands-JFKTYS2D.js → cooldownCommands-NS63RGBO.js} +2 -2
- package/{createAgentAutomationAction-LW26KIBP.js → createAgentAutomationAction-KYHXEVZF.js} +17 -18
- package/{createDialogAction-VLLBRD52.js → createDialogAction-JKB3V4YP.js} +21 -22
- package/{createPageAction-PDACOLI6.js → createPageAction-CRVW6Z65.js} +20 -22
- package/{dbSlice-DC2J53RC.js → dbSlice-6PVPY44C.js} +5 -5
- package/{deleteFile-KYWEMNFX.js → deleteFile-YM6NDPAR.js} +3 -3
- package/{dialogCommands-F3Y4KCPZ.js → dialogCommands-2NVLHDZP.js} +32 -30
- package/{dialogSlice-ERMZYMS6.js → dialogSlice-SOEMTPH4.js} +16 -17
- package/{dist-NJC2W7I4.js → dist-Q2JSMAKA.js} +7 -361
- package/{docCreateCommands-YMWZLW64.js → docCreateCommands-BL4YBQOD.js} +32 -30
- package/{docDeleteCommands-6KJ3ESK4.js → docDeleteCommands-NTRYV5OH.js} +33 -31
- package/{docReadCommands-YQGFVLWI.js → docReadCommands-MJGISD7D.js} +32 -30
- package/{docStore-HXKI6W5D.js → docStore-YXIN3UVQ.js} +6 -6
- package/{docUpdateCommands-QLSGXUEX.js → docUpdateCommands-C2AIMWBR.js} +32 -30
- package/{getPricing-TX35D7PI.js → getPricing-XQ3N3RBP.js} +2 -2
- package/{handleSendMessageAction-2XCOZPXY.js → handleSendMessageAction-JXA7PBY2.js} +35 -32
- package/index.js +7 -7
- package/{localRuntimeAdapter-VOFUPXNF.js → localRuntimeAdapter-QAXXJCDM.js} +61 -60
- package/{localRuntimeAuthority-JDAD7CB6.js → localRuntimeAuthority-BPN5OAQG.js} +2 -2
- package/{localRuntimeDb-CVC62PM5.js → localRuntimeDb-QIVAXMUL.js} +1 -1
- package/{machineCommands-IN5O7CIO.js → machineCommands-TKOOPU7X.js} +66 -67
- package/{machineWsRunDispatch-TH3GMSR3.js → machineWsRunDispatch-AQ3KTB7U.js} +61 -62
- package/{memberThunks-2DWKLE6W.js → memberThunks-AZINUM4S.js} +8 -8
- package/package.json +6 -2
- package/{providerPresetApply-GSJI4JBJ.js → providerPresetApply-PKUOHQJT.js} +5 -5
- package/{providerRegistry-TSSTPGWF.js → providerRegistry-HNQLIFN2.js} +5 -5
- package/{read-L7QEJETH.js → read-7JPIWRBQ.js} +3 -3
- package/{readDocTool-QELXV2GW.js → readDocTool-AAQTB2Y3.js} +1 -1
- package/{readlineWorkspace-EIEQUTEZ.js → readlineWorkspace-7G2FBC53.js} +96 -134
- package/{removeDialogAgentAction-376XSUP2.js → removeDialogAgentAction-RMVRILLK.js} +6 -6
- package/{runAgentClientLoop-3KHKKBZI.js → runAgentClientLoop-NKCVEOOU.js} +45 -45
- package/{runtimeDoctorCommands-56NWKNON.js → runtimeDoctorCommands-MMCP4B4U.js} +12 -12
- package/{setDialogExtraReferencesAction-QBDSH63D.js → setDialogExtraReferencesAction-L3V7JTMG.js} +6 -6
- package/{setPrimaryDialogAgentAction-537QFGW3.js → setPrimaryDialogAgentAction-X52JQGTJ.js} +6 -6
- package/{settingThunks-4Z43ZSAT.js → settingThunks-N6XFWPOU.js} +5 -5
- package/{spaceCommands-T5Z4U7HP.js → spaceCommands-44R7DU34.js} +29 -27
- package/{streamAgentChatTurn-DMXXSEVX.js → streamAgentChatTurn-V7GZPMO4.js} +143 -84
- package/{switchDialogAgentAction-CSO6AKRL.js → switchDialogAgentAction-ZJ5CGU7J.js} +5 -5
- package/{tools-RMT7NAMC.js → tools-SNXGTJMT.js} +35 -37
- package/{tuiSummaryLlmCaller-KLK6K3Q3.js → tuiSummaryLlmCaller-FQOEF4IE.js} +7 -7
- package/{updateCommands-LXZLG44Y.js → updateCommands-FJHGWD3Q.js} +5 -3
- package/{updateDialogTitleAction-Z4WNUH6Y.js → updateDialogTitleAction-QKWRDIK3.js} +17 -18
- package/chunk-3MZAGMYY.js +0 -239
- package/chunk-IA7TRNNR.js +0 -11
- package/chunk-UKZX3NHN.js +0 -48
- package/chunk-VDEVDGEM.js +0 -7018
- package/clipboardy-GCO3GT3I.js +0 -11793
- package/{agentGrantCommands-HOJ3JBBQ.js → agentGrantCommands-5DPHYEKP.js} +3 -3
- package/{chromeOpsCommands-3Z34RKSE.js → chromeOpsCommands-GZVVK7HU.js} +4 -4
- package/{chunk-2SGAI64X.js → chunk-43OFVLWJ.js} +4 -4
- package/{chunk-XETG4RIX.js → chunk-AETZ7AD6.js} +4 -4
- package/{chunk-2IXDJNZI.js → chunk-GAGGEA7D.js} +3 -3
- package/{memoryCommands-CUNBFRVS.js → memoryCommands-ZS3VQJAL.js} +3 -3
- package/{offlineMarxistsAgentCommand-2QTHJCHV.js → offlineMarxistsAgentCommand-3GLX4QQY.js} +3 -3
- package/{tableCommands-LBH3QPPO.js → tableCommands-IVC5S7Y3.js} +11 -11
|
@@ -9,16 +9,19 @@ import {
|
|
|
9
9
|
resolveRawAgentInput,
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3GCLICFW.js";
|
|
13
13
|
import {
|
|
14
14
|
getReadableCliDb
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-62TBKWTV.js";
|
|
16
16
|
import {
|
|
17
|
+
INSTABOX_RUN_CONFIG_ENV,
|
|
17
18
|
createCliLocalRuntimeAdapter,
|
|
18
19
|
detectCurrentMachineId,
|
|
20
|
+
hashInstaboxDeliveryManifest,
|
|
19
21
|
isBuiltinNoloAgentRef,
|
|
20
22
|
isCliProviderAgentConfig,
|
|
21
23
|
isDockerRuntimeKey,
|
|
24
|
+
isInstaboxBillingPolicy,
|
|
22
25
|
isLiveAgentRunObservation,
|
|
23
26
|
isMachineBoundLocalhostCustomProvider,
|
|
24
27
|
isSubtaskRun,
|
|
@@ -26,20 +29,21 @@ import {
|
|
|
26
29
|
resolveAuthToken as resolveAuthToken2,
|
|
27
30
|
resolveBoundMachineId,
|
|
28
31
|
resolveFileWriteGateEnabled,
|
|
29
|
-
resolveLocalUserId
|
|
30
|
-
|
|
32
|
+
resolveLocalUserId,
|
|
33
|
+
validateInstaboxWorkspaceSelection
|
|
34
|
+
} from "./chunk-RCZMREV2.js";
|
|
31
35
|
import {
|
|
32
36
|
clearCredentialAvailability,
|
|
33
|
-
|
|
37
|
+
readEffectiveCredentialEntry,
|
|
34
38
|
recordCredentialProbe
|
|
35
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-R4BMKAR5.js";
|
|
36
40
|
import {
|
|
37
41
|
agentRunCardLabels,
|
|
38
42
|
getCliLocale,
|
|
39
43
|
t,
|
|
40
44
|
toolLabel,
|
|
41
45
|
toolLabelVariants
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TDX2L4W2.js";
|
|
43
47
|
import {
|
|
44
48
|
_appendEntityBatch,
|
|
45
49
|
_appendEvidenceBatch,
|
|
@@ -60,7 +64,7 @@ import {
|
|
|
60
64
|
import {
|
|
61
65
|
readDbRecord,
|
|
62
66
|
resolveAgentRecordFromHybridStore
|
|
63
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-5IKRTRRR.js";
|
|
64
68
|
import {
|
|
65
69
|
isLocalCliAgentKey
|
|
66
70
|
} from "./chunk-NBTY7YJF.js";
|
|
@@ -75,14 +79,14 @@ import {
|
|
|
75
79
|
} from "./chunk-BMQ2MJUK.js";
|
|
76
80
|
import {
|
|
77
81
|
resolveCliLocalRuntimeKeyCapability
|
|
78
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-M3IBEHBT.js";
|
|
79
83
|
import {
|
|
80
84
|
isTransientFetchError
|
|
81
85
|
} from "./chunk-KFHREHUQ.js";
|
|
82
86
|
import {
|
|
83
87
|
parseUiCard,
|
|
84
88
|
uiCardFallback
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-Y7F4Q7YP.js";
|
|
86
90
|
import {
|
|
87
91
|
isGatewayHttpStatus
|
|
88
92
|
} from "./chunk-NF64D32W.js";
|
|
@@ -91,7 +95,7 @@ import {
|
|
|
91
95
|
chooseMemoryOwners,
|
|
92
96
|
loadMemoryCandidatesFromDb,
|
|
93
97
|
resolveAgentMemoryPolicy
|
|
94
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-TSTLLGAC.js";
|
|
95
99
|
import {
|
|
96
100
|
API_REPORTED_COST_MULTIPLIER,
|
|
97
101
|
estimateMessagesTokens,
|
|
@@ -99,22 +103,22 @@ import {
|
|
|
99
103
|
resolveAgentContextWindow,
|
|
100
104
|
resolveOccupancy,
|
|
101
105
|
resolveOccupancyWindow
|
|
102
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-HSY7F4PP.js";
|
|
103
107
|
import {
|
|
104
|
-
|
|
105
|
-
} from "./chunk-
|
|
108
|
+
buildSkillDiscoveryContextLayer
|
|
109
|
+
} from "./chunk-AU7AXHUL.js";
|
|
106
110
|
import {
|
|
107
111
|
parseExternalSkillMarkdown,
|
|
108
112
|
parseSkillDocProtocol
|
|
109
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-AETZ7AD6.js";
|
|
110
114
|
import {
|
|
111
115
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
112
116
|
LOCAL_TURN_ABORTED_CODE,
|
|
113
117
|
readActionGate
|
|
114
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-TTVMMYVH.js";
|
|
115
119
|
import {
|
|
116
120
|
resolveAgentRuntimeConfigFromRecord
|
|
117
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-YKTAUOS7.js";
|
|
118
122
|
import {
|
|
119
123
|
createThinkParserState,
|
|
120
124
|
flushThinkParser,
|
|
@@ -129,15 +133,18 @@ import {
|
|
|
129
133
|
import {
|
|
130
134
|
PROBE_INTERVAL_MS,
|
|
131
135
|
QUOTA_ERROR_PATTERNS,
|
|
136
|
+
classifyFailureSubclass,
|
|
137
|
+
isCapacitySaturatedRateLimit,
|
|
132
138
|
isQuotaExhaustedError,
|
|
133
|
-
|
|
139
|
+
isQuotaExhaustedText,
|
|
134
140
|
mergeAvailabilityDeadline,
|
|
135
141
|
resolveCooldownGate,
|
|
136
142
|
resolveCredentialKeyWithFallback
|
|
137
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-JLR5NWP2.js";
|
|
138
144
|
import {
|
|
145
|
+
isOAuthApiKeyRef,
|
|
139
146
|
normalizeUsage
|
|
140
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-HEC32F3G.js";
|
|
141
148
|
import {
|
|
142
149
|
clipCompactText
|
|
143
150
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -148,6 +155,13 @@ import {
|
|
|
148
155
|
normalizeRuntimeToolPolicyOverride,
|
|
149
156
|
resolveEffectiveRuntimeToolPolicy
|
|
150
157
|
} from "./chunk-LIQJTQRN.js";
|
|
158
|
+
import {
|
|
159
|
+
buildAgentsMdLayer,
|
|
160
|
+
buildMemoryOverlayLayer,
|
|
161
|
+
buildMemoryUseGuidanceLayer,
|
|
162
|
+
partitionScopedBlocks,
|
|
163
|
+
renderTurnContextBlocksWithScope
|
|
164
|
+
} from "./chunk-VEA7H5FG.js";
|
|
151
165
|
import {
|
|
152
166
|
BUILTIN_NOLO_AGENT_KEY,
|
|
153
167
|
BUILTIN_NOLO_AGENT_NAME,
|
|
@@ -161,9 +175,6 @@ import {
|
|
|
161
175
|
createMemoryKey,
|
|
162
176
|
ulid
|
|
163
177
|
} from "./chunk-5EMSBTQ6.js";
|
|
164
|
-
import {
|
|
165
|
-
isAntigravityOAuthAgent
|
|
166
|
-
} from "./chunk-JGRPBIZZ.js";
|
|
167
178
|
import {
|
|
168
179
|
createRunActivityTracker,
|
|
169
180
|
createShellApprovalChild,
|
|
@@ -173,10 +184,11 @@ import {
|
|
|
173
184
|
recordRunResultHeaderMeta,
|
|
174
185
|
resolveResultServerMeta,
|
|
175
186
|
resolveRunQueuePath,
|
|
187
|
+
resolveRunsDir,
|
|
176
188
|
serverOriginForDialog,
|
|
177
189
|
settleRunTerminalAuthoritatively,
|
|
178
190
|
spawnLocalBackgroundRun
|
|
179
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-LPO6AMQU.js";
|
|
180
192
|
import {
|
|
181
193
|
formatAgentListCard,
|
|
182
194
|
formatFinishedRunCard,
|
|
@@ -187,26 +199,14 @@ import {
|
|
|
187
199
|
formatStopRunCard,
|
|
188
200
|
isAgentRunTerminalStatus
|
|
189
201
|
} from "./chunk-PJNFNEJE.js";
|
|
190
|
-
import {
|
|
191
|
-
resolveClientVersion
|
|
192
|
-
} from "./chunk-SUKSWFLP.js";
|
|
193
|
-
import {
|
|
194
|
-
findModelConfig
|
|
195
|
-
} from "./chunk-TRW43TSC.js";
|
|
196
|
-
import {
|
|
197
|
-
asTrimmedString
|
|
198
|
-
} from "./chunk-3EUW3WEO.js";
|
|
199
202
|
import {
|
|
200
203
|
isCliAuthorityBrokerProtocolError,
|
|
201
204
|
isCliAuthorityBrokerTimeoutError,
|
|
202
205
|
isCliAuthorityBrokerUnavailableError
|
|
203
206
|
} from "./chunk-EXAJ6DCR.js";
|
|
204
|
-
import {
|
|
205
|
-
toErrorMessage
|
|
206
|
-
} from "./chunk-HNMXYYJR.js";
|
|
207
207
|
import {
|
|
208
208
|
getDefaultCliLocalRuntimeDb
|
|
209
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-FDLDMJTM.js";
|
|
210
210
|
import {
|
|
211
211
|
getLogger,
|
|
212
212
|
normalizeError
|
|
@@ -214,13 +214,28 @@ import {
|
|
|
214
214
|
import {
|
|
215
215
|
resolveAuthToken
|
|
216
216
|
} from "./chunk-A7GB5UGH.js";
|
|
217
|
-
import {
|
|
218
|
-
asOptionalTrimmedString
|
|
219
|
-
} from "./chunk-G3SUCT4W.js";
|
|
220
217
|
import {
|
|
221
218
|
readPipeText,
|
|
222
219
|
spawnProcess
|
|
223
220
|
} from "./chunk-Y6ROFCZO.js";
|
|
221
|
+
import {
|
|
222
|
+
isAntigravityOAuthAgent
|
|
223
|
+
} from "./chunk-SQX235S2.js";
|
|
224
|
+
import {
|
|
225
|
+
resolveClientVersion
|
|
226
|
+
} from "./chunk-PIG2IUVZ.js";
|
|
227
|
+
import {
|
|
228
|
+
findModelConfig
|
|
229
|
+
} from "./chunk-6EQD4AQL.js";
|
|
230
|
+
import {
|
|
231
|
+
asTrimmedString
|
|
232
|
+
} from "./chunk-3EUW3WEO.js";
|
|
233
|
+
import {
|
|
234
|
+
toErrorMessage
|
|
235
|
+
} from "./chunk-HNMXYYJR.js";
|
|
236
|
+
import {
|
|
237
|
+
asOptionalTrimmedString
|
|
238
|
+
} from "./chunk-G3SUCT4W.js";
|
|
224
239
|
import {
|
|
225
240
|
CLIENT_VERSION_TOO_OLD_CODE,
|
|
226
241
|
NOLO_CLIENT_VERSION_HEADER,
|
|
@@ -229,16 +244,148 @@ import {
|
|
|
229
244
|
import {
|
|
230
245
|
asTrimmedLowercaseString
|
|
231
246
|
} from "./chunk-QSJ3HFEF.js";
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
} from "
|
|
235
|
-
import {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
247
|
+
|
|
248
|
+
// packages/cli/client/instaboxRunConfigWrite.ts
|
|
249
|
+
import { randomUUID } from "node:crypto";
|
|
250
|
+
import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
251
|
+
import { isAbsolute, join, normalize, resolve } from "node:path";
|
|
252
|
+
var InstaboxRunConfigWriteError = class extends Error {
|
|
253
|
+
code;
|
|
254
|
+
constructor(code, message) {
|
|
255
|
+
super(`instabox_run_config_write:${code}: ${message}`);
|
|
256
|
+
this.name = "InstaboxRunConfigWriteError";
|
|
257
|
+
this.code = `instabox_run_config_write:${code}`;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
var fail = (code, msg) => {
|
|
261
|
+
throw new InstaboxRunConfigWriteError(code, msg);
|
|
262
|
+
};
|
|
263
|
+
function writeInstaboxRunConfig(options) {
|
|
264
|
+
const { workspaceMode, artifactDir, manifestPath, allowRemoteRelease } = options;
|
|
265
|
+
if (workspaceMode !== "empty" && workspaceMode !== "snapshot") {
|
|
266
|
+
fail("invalid_workspace_mode", 'workspaceMode \u5FC5\u987B\u662F "empty" \u6216 "snapshot"');
|
|
267
|
+
}
|
|
268
|
+
const trimmedArtifactDir = artifactDir?.trim();
|
|
269
|
+
if (!trimmedArtifactDir) {
|
|
270
|
+
fail("missing_artifact_dir", "artifactDir \u5FC5\u987B\u662F\u975E\u7A7A\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u672A\u914D\u7F6E\u6216\u9ED8\u8BA4\u5747\u88AB\u62D2\u7EDD");
|
|
271
|
+
}
|
|
272
|
+
if (!isAbsolute(trimmedArtifactDir) || trimmedArtifactDir.includes("\0") || trimmedArtifactDir.split("/").includes("..")) {
|
|
273
|
+
fail("invalid_artifact_dir", `artifactDir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u7EDD\u5BF9\u8DEF\u5F84\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${trimmedArtifactDir}"`);
|
|
274
|
+
}
|
|
275
|
+
const approvalId = `appr-${randomUUID()}`;
|
|
276
|
+
const bindingId = `bind-${randomUUID()}`;
|
|
277
|
+
const freeCreateEvidenceId = `fce-${randomUUID()}`;
|
|
278
|
+
const workspaceAuthorizationId = `wauth-${randomUUID()}`;
|
|
279
|
+
const recoverySupportId = `rcv-${randomUUID()}`;
|
|
280
|
+
let manifest = null;
|
|
281
|
+
let manifestSha256 = null;
|
|
282
|
+
let allowedPaths = [];
|
|
283
|
+
if (workspaceMode === "snapshot") {
|
|
284
|
+
const rawPath = manifestPath ? manifestPath.trim() : "";
|
|
285
|
+
if (!rawPath) {
|
|
286
|
+
fail("missing_manifest_path", 'workspaceMode \u4E3A "snapshot" \u65F6\u5FC5\u987B\u63D0\u4F9B manifest \u6587\u4EF6\u8DEF\u5F84');
|
|
287
|
+
}
|
|
288
|
+
const resolvedManifestPath = resolve(rawPath);
|
|
289
|
+
let rawText = "";
|
|
290
|
+
try {
|
|
291
|
+
const reader = options.readTextFile ?? ((p) => readFileSync(p, "utf8"));
|
|
292
|
+
rawText = reader(resolvedManifestPath);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
fail(
|
|
295
|
+
"manifest_read_failed",
|
|
296
|
+
`\u8BFB\u53D6 manifest \u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
let parsedManifest;
|
|
300
|
+
try {
|
|
301
|
+
parsedManifest = JSON.parse(rawText);
|
|
302
|
+
} catch (err) {
|
|
303
|
+
fail(
|
|
304
|
+
"invalid_manifest_json",
|
|
305
|
+
`manifest \u6587\u4EF6 JSON \u89E3\u6790\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
manifestSha256 = hashInstaboxDeliveryManifest(parsedManifest);
|
|
310
|
+
validateInstaboxWorkspaceSelection({
|
|
311
|
+
workspaceMode: "approved-snapshot",
|
|
312
|
+
manifest: parsedManifest,
|
|
313
|
+
approval: {
|
|
314
|
+
id: approvalId,
|
|
315
|
+
manifestSha256
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
} catch (err) {
|
|
319
|
+
fail(
|
|
320
|
+
"invalid_manifest_selection",
|
|
321
|
+
`manifest \u6821\u9A8C\u672A\u901A\u8FC7: ${err instanceof Error ? err.message : String(err)}`
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
manifest = parsedManifest;
|
|
325
|
+
allowedPaths = parsedManifest.files.map((f) => f.path);
|
|
326
|
+
} else {
|
|
327
|
+
if (manifestPath && manifestPath.trim()) {
|
|
328
|
+
fail("unexpected_manifest", 'workspaceMode \u4E3A "empty" \u65F6\u4E0D\u5F97\u63D0\u4F9B manifest');
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const rawBillingPolicy = options.billingPolicy ?? (options.allowPaid ? "allow-paid" : "free-only");
|
|
332
|
+
if (!isInstaboxBillingPolicy(rawBillingPolicy)) {
|
|
333
|
+
fail("invalid_billing_policy", `billingPolicy \u5FC5\u987B\u4E3A "free-only" \u6216 "allow-paid"\uFF0C\u6536\u5230 "${rawBillingPolicy}"`);
|
|
334
|
+
}
|
|
335
|
+
const billingPolicy = rawBillingPolicy;
|
|
336
|
+
const env = options.env ?? process.env;
|
|
337
|
+
const isPaid = options.isPaidAccount === true || options.account?.isPaid === true || options.account?.kind === "paid" || options.account?.accountKind === "paid" || env?.INSTABOX_ACCOUNT_KIND === "paid" || env?.INSTABOX_ACCOUNT_TYPE === "paid" || env?.INSTABOX_PAID_ACCOUNT === "true" || env?.INSTABOX_PAID_ACCOUNT === "1";
|
|
338
|
+
if (isPaid && billingPolicy !== "allow-paid") {
|
|
339
|
+
fail("paid_account_disallowed", "\u4ED8\u8D39 Instabox \u8D26\u53F7\u9700\u663E\u5F0F --instabox-allow-paid");
|
|
340
|
+
}
|
|
341
|
+
const config = {
|
|
342
|
+
bindingId,
|
|
343
|
+
freeCreateEvidenceId,
|
|
344
|
+
workspaceAuthorizationId,
|
|
345
|
+
recoverySupportId,
|
|
346
|
+
workspaceMode: workspaceMode === "snapshot" ? "approved-snapshot" : "empty",
|
|
347
|
+
billingPolicy,
|
|
348
|
+
approvalId,
|
|
349
|
+
artifactRoot: trimmedArtifactDir,
|
|
350
|
+
allowRemoteRelease: Boolean(allowRemoteRelease),
|
|
351
|
+
allowedPaths
|
|
352
|
+
};
|
|
353
|
+
if (workspaceMode === "snapshot" && manifest && manifestSha256) {
|
|
354
|
+
config.manifest = manifest;
|
|
355
|
+
config.manifestSha256 = manifestSha256;
|
|
356
|
+
}
|
|
357
|
+
const runsDir = options.runsDir ?? resolveRunsDir(env);
|
|
358
|
+
const normalizedRunsDir = normalize(resolve(runsDir));
|
|
359
|
+
try {
|
|
360
|
+
mkdirSync(normalizedRunsDir, { recursive: true, mode: 448 });
|
|
361
|
+
} catch (err) {
|
|
362
|
+
fail("mkdir_failed", `\u521B\u5EFA runs \u76EE\u5F55\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
363
|
+
}
|
|
364
|
+
const fileName = `instabox-run-${randomUUID()}.json`;
|
|
365
|
+
const targetPath = join(normalizedRunsDir, fileName);
|
|
366
|
+
try {
|
|
367
|
+
writeFileSync(targetPath, JSON.stringify(config, null, 2), {
|
|
368
|
+
flag: "wx",
|
|
369
|
+
mode: 384
|
|
370
|
+
});
|
|
371
|
+
} catch (err) {
|
|
372
|
+
fail("file_write_failed", `\u72EC\u5360\u521B\u5EFA\u53D7\u63A7\u914D\u7F6E\u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const stats = lstatSync(targetPath);
|
|
376
|
+
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
377
|
+
fail("symlink_rejected", `\u914D\u7F6E\u6587\u4EF6\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\u6216\u975E\u5E38\u89C4\u6587\u4EF6: ${targetPath}`);
|
|
378
|
+
}
|
|
379
|
+
} catch (err) {
|
|
380
|
+
if (err instanceof InstaboxRunConfigWriteError) throw err;
|
|
381
|
+
fail("file_stat_failed", `\u68C0\u9A8C\u914D\u7F6E\u6587\u4EF6\u72B6\u6001\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
382
|
+
}
|
|
383
|
+
process.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
|
|
384
|
+
if (options.env) {
|
|
385
|
+
options.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
|
|
386
|
+
}
|
|
387
|
+
return { configPath: targetPath, config };
|
|
388
|
+
}
|
|
242
389
|
|
|
243
390
|
// packages/agent-runtime/modelLayerOverride.ts
|
|
244
391
|
var MODEL_LAYER_KEYS = [
|
|
@@ -11140,6 +11287,51 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
11140
11287
|
return null;
|
|
11141
11288
|
}
|
|
11142
11289
|
|
|
11290
|
+
// packages/cli/idleHeapRelease.ts
|
|
11291
|
+
var IDLE_HEAP_RELEASE_DELAY_MS = 2e3;
|
|
11292
|
+
function releaseHeapPages(options = {}) {
|
|
11293
|
+
const env = options.env ?? process.env;
|
|
11294
|
+
if (env.NOLO_TUI_IDLE_HEAP_RELEASE === "0") return;
|
|
11295
|
+
const bun = "bun" in options ? options.bun : globalThis.Bun;
|
|
11296
|
+
if (typeof bun?.gc !== "function" || typeof bun?.shrink !== "function") return;
|
|
11297
|
+
try {
|
|
11298
|
+
bun.gc(true);
|
|
11299
|
+
bun.shrink();
|
|
11300
|
+
} catch {
|
|
11301
|
+
}
|
|
11302
|
+
}
|
|
11303
|
+
function createIdleHeapReleaser(options = {}) {
|
|
11304
|
+
const env = options.env ?? process.env;
|
|
11305
|
+
const bun = "bun" in options ? options.bun : globalThis.Bun;
|
|
11306
|
+
const disabled = env.NOLO_TUI_IDLE_HEAP_RELEASE === "0" || typeof bun?.gc !== "function" || typeof bun?.shrink !== "function";
|
|
11307
|
+
if (disabled) return { schedule() {
|
|
11308
|
+
}, cancel() {
|
|
11309
|
+
} };
|
|
11310
|
+
const delayMs = options.delayMs ?? IDLE_HEAP_RELEASE_DELAY_MS;
|
|
11311
|
+
const setTimer = options.setTimer ?? ((fn, ms) => {
|
|
11312
|
+
const handle = setTimeout(fn, ms);
|
|
11313
|
+
handle.unref?.();
|
|
11314
|
+
return handle;
|
|
11315
|
+
});
|
|
11316
|
+
const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
11317
|
+
let pending = null;
|
|
11318
|
+
const release = () => {
|
|
11319
|
+
pending = null;
|
|
11320
|
+
releaseHeapPages({ env, bun });
|
|
11321
|
+
};
|
|
11322
|
+
return {
|
|
11323
|
+
schedule() {
|
|
11324
|
+
if (pending !== null) clearTimer(pending);
|
|
11325
|
+
pending = setTimer(release, delayMs);
|
|
11326
|
+
},
|
|
11327
|
+
cancel() {
|
|
11328
|
+
if (pending === null) return;
|
|
11329
|
+
clearTimer(pending);
|
|
11330
|
+
pending = null;
|
|
11331
|
+
}
|
|
11332
|
+
};
|
|
11333
|
+
}
|
|
11334
|
+
|
|
11143
11335
|
// packages/cli/client/agentRun.ts
|
|
11144
11336
|
import { ulid as ulid2 } from "ulid";
|
|
11145
11337
|
|
|
@@ -11181,7 +11373,7 @@ function isBalanceExhaustedError(error) {
|
|
|
11181
11373
|
|
|
11182
11374
|
// packages/cli/client/agentRun.ts
|
|
11183
11375
|
async function loadRunLocalAgentTurn() {
|
|
11184
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
11376
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-QL4SHNJJ.js");
|
|
11185
11377
|
return runLocalAgentTurn;
|
|
11186
11378
|
}
|
|
11187
11379
|
var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
|
|
@@ -11453,7 +11645,7 @@ function looksLikeRateLimitedText(message) {
|
|
|
11453
11645
|
var AUTH_TEXT_SIGNAL_RE = /\b401\b|unauthori[sz]ed|invalid[_\s-]?(?:api[_\s-]?key|token|credential)s?|(?:api[_\s-]?key|token|credential)s?[_\s-](?:invalid|expired|rejected|missing|not[_\s-]?found)|authentication[_\s-]?(?:error|failed|required)/i;
|
|
11454
11646
|
var QUOTA_EXHAUSTED_EXTRA_RE = /insufficient[_\s-]?(?:quota|balance|credits?)|余额不足|额度已?用尽/i;
|
|
11455
11647
|
function looksLikeQuotaExhaustedText(message) {
|
|
11456
|
-
return
|
|
11648
|
+
return isQuotaExhaustedText(message) || QUOTA_EXHAUSTED_EXTRA_RE.test(message);
|
|
11457
11649
|
}
|
|
11458
11650
|
var BARE_UPSTREAM_5XX_RE = /\bHTTP[:\s]+(5\d\d)\b|\bstatus[:\s=]+(5\d\d)\b|\breturned error\s+(5\d\d)\b/i;
|
|
11459
11651
|
function classifyLocalRunError(message) {
|
|
@@ -11700,7 +11892,7 @@ function formatRateLimitResetHint(hint, locale) {
|
|
|
11700
11892
|
return parts.join(" ");
|
|
11701
11893
|
}
|
|
11702
11894
|
function buildRateLimitFailure(ctx) {
|
|
11703
|
-
const headlineKey = ctx.quotaExhausted ? "localRunRateLimitQuota" : "localRunRateLimitThrottled";
|
|
11895
|
+
const headlineKey = isCapacitySaturatedRateLimit(ctx.message, Date.now()) ? "localRunRateLimitCapacity" : ctx.quotaExhausted ? "localRunRateLimitQuota" : "localRunRateLimitThrottled";
|
|
11704
11896
|
const lines = [
|
|
11705
11897
|
t(
|
|
11706
11898
|
headlineKey,
|
|
@@ -12038,8 +12230,15 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12038
12230
|
if (options.abortSignal?.aborted) {
|
|
12039
12231
|
return { exitCode: 0, streamInterrupted: true };
|
|
12040
12232
|
}
|
|
12233
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12234
|
+
message: toErrorMessage(error),
|
|
12235
|
+
body: error
|
|
12236
|
+
});
|
|
12041
12237
|
options.output.write(buildTransportErrorHint(options.serverUrl, error));
|
|
12042
|
-
return {
|
|
12238
|
+
return {
|
|
12239
|
+
exitCode: 1,
|
|
12240
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12241
|
+
};
|
|
12043
12242
|
}
|
|
12044
12243
|
if (shouldStream && isGatewayHttpStatus(res.status)) {
|
|
12045
12244
|
const failureMeta = await readAgentRunFailureMetadata(res);
|
|
@@ -12054,8 +12253,15 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12054
12253
|
res = await postAgentRun(false);
|
|
12055
12254
|
} catch (error) {
|
|
12056
12255
|
spinner.stop();
|
|
12256
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12257
|
+
message: toErrorMessage(error),
|
|
12258
|
+
body: error
|
|
12259
|
+
});
|
|
12057
12260
|
options.output.write(buildTransportErrorHint(options.serverUrl, error));
|
|
12058
|
-
return {
|
|
12261
|
+
return {
|
|
12262
|
+
exitCode: 1,
|
|
12263
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12264
|
+
};
|
|
12059
12265
|
}
|
|
12060
12266
|
}
|
|
12061
12267
|
}
|
|
@@ -12103,7 +12309,16 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12103
12309
|
`
|
|
12104
12310
|
);
|
|
12105
12311
|
}
|
|
12106
|
-
|
|
12312
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12313
|
+
status: res.status,
|
|
12314
|
+
message: `${errorText || messageText} ${reasonText || ""} ${codeText || ""}`.trim(),
|
|
12315
|
+
body: data
|
|
12316
|
+
});
|
|
12317
|
+
return {
|
|
12318
|
+
exitCode: 1,
|
|
12319
|
+
...dialogIdText ? { dialogId: dialogIdText } : {},
|
|
12320
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12321
|
+
};
|
|
12107
12322
|
}
|
|
12108
12323
|
const content = formatAssistantResponseForCli(
|
|
12109
12324
|
String(data?.content ?? data?.message ?? "")
|
|
@@ -12185,6 +12400,24 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
12185
12400
|
}
|
|
12186
12401
|
}
|
|
12187
12402
|
async function runLocalAgentTurnForCliWithAdapter(options, settings, resolvedBaseAdapter) {
|
|
12403
|
+
try {
|
|
12404
|
+
return await executeLocalAgentTurnForCliWithAdapter(
|
|
12405
|
+
options,
|
|
12406
|
+
settings,
|
|
12407
|
+
resolvedBaseAdapter
|
|
12408
|
+
);
|
|
12409
|
+
} finally {
|
|
12410
|
+
try {
|
|
12411
|
+
if (typeof options.releaseHeapPages === "function") {
|
|
12412
|
+
options.releaseHeapPages();
|
|
12413
|
+
} else {
|
|
12414
|
+
releaseHeapPages({ env: options.env });
|
|
12415
|
+
}
|
|
12416
|
+
} catch {
|
|
12417
|
+
}
|
|
12418
|
+
}
|
|
12419
|
+
}
|
|
12420
|
+
async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolvedBaseAdapter) {
|
|
12188
12421
|
const baseAdapter = (() => {
|
|
12189
12422
|
let adapter2 = resolvedBaseAdapter && options.modelOverride ? wrapLoadAgentConfigWithModelOverride(
|
|
12190
12423
|
resolvedBaseAdapter,
|
|
@@ -12396,6 +12629,10 @@ async function runLocalAgentTurnForCliWithAdapter(options, settings, resolvedBas
|
|
|
12396
12629
|
return {
|
|
12397
12630
|
exitCode: 1,
|
|
12398
12631
|
localError: error,
|
|
12632
|
+
failureSubclass: classifyFailureSubclass({
|
|
12633
|
+
message: toErrorMessage(error),
|
|
12634
|
+
body: error
|
|
12635
|
+
}),
|
|
12399
12636
|
...savedDialogId ? { dialogId: savedDialogId } : {},
|
|
12400
12637
|
...abortedTurnCredits !== void 0 ? { turnCredits: abortedTurnCredits } : {},
|
|
12401
12638
|
...abortedUsageRecords?.length ? { usageRecords: abortedUsageRecords } : {}
|
|
@@ -12414,7 +12651,9 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12414
12651
|
}
|
|
12415
12652
|
if (!config || typeof config !== "object") return null;
|
|
12416
12653
|
const baseRecord = config.rawRecord ?? config;
|
|
12417
|
-
let credentialKey = resolveCredentialKeyWithFallback(
|
|
12654
|
+
let credentialKey = resolveCredentialKeyWithFallback(
|
|
12655
|
+
baseRecord.agentKey || baseRecord.key ? baseRecord : { ...baseRecord, agentKey: options.agentKey }
|
|
12656
|
+
);
|
|
12418
12657
|
if (credentialKey && resolveOAuthChannelOwnerSkip(
|
|
12419
12658
|
config,
|
|
12420
12659
|
options
|
|
@@ -12428,19 +12667,30 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12428
12667
|
}
|
|
12429
12668
|
const env = options.env;
|
|
12430
12669
|
const now = Date.now();
|
|
12431
|
-
|
|
12670
|
+
let entry;
|
|
12671
|
+
let matchedKey;
|
|
12672
|
+
if (credentialKey) {
|
|
12673
|
+
const effective = await readEffectiveCredentialEntry(credentialKey, env, now).catch(() => void 0);
|
|
12674
|
+
if (effective) {
|
|
12675
|
+
entry = effective;
|
|
12676
|
+
matchedKey = effective.matchedKey;
|
|
12677
|
+
}
|
|
12678
|
+
}
|
|
12432
12679
|
const entryAt = entry?.nextAvailableAt;
|
|
12433
12680
|
const effectiveNextAvailableAt = typeof entryAt === "number" ? mergeAvailabilityDeadline(agentLevelNextAvailableAt, entryAt) : agentLevelNextAvailableAt;
|
|
12434
|
-
|
|
12681
|
+
const activeKey = matchedKey || credentialKey;
|
|
12682
|
+
if (typeof effectiveNextAvailableAt !== "number") {
|
|
12683
|
+
return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12684
|
+
}
|
|
12435
12685
|
const gateDecision = resolveCooldownGate(
|
|
12436
12686
|
{ nextAvailableAt: effectiveNextAvailableAt, lastProbeAt: entry?.lastProbeAt },
|
|
12437
12687
|
now
|
|
12438
12688
|
);
|
|
12439
|
-
if (gateDecision === "probe" &&
|
|
12440
|
-
await recordCredentialProbe(
|
|
12441
|
-
return { credentialKey };
|
|
12689
|
+
if (gateDecision === "probe" && activeKey) {
|
|
12690
|
+
await recordCredentialProbe(activeKey, env, now).catch(() => void 0);
|
|
12691
|
+
return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12442
12692
|
}
|
|
12443
|
-
if (gateDecision !== "blocked") return { credentialKey };
|
|
12693
|
+
if (gateDecision !== "blocked") return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12444
12694
|
options.output.write(
|
|
12445
12695
|
`${t(
|
|
12446
12696
|
"agentCooldownBlocked",
|
|
@@ -12451,7 +12701,7 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12451
12701
|
)}
|
|
12452
12702
|
`
|
|
12453
12703
|
);
|
|
12454
|
-
return { exitCode: 1 };
|
|
12704
|
+
return { exitCode: 1, failureSubclass: "rate_limit" };
|
|
12455
12705
|
}
|
|
12456
12706
|
function foldLocalResultForTui(localResult) {
|
|
12457
12707
|
const folded = {
|
|
@@ -12477,7 +12727,8 @@ function foldLocalResultForTui(localResult) {
|
|
|
12477
12727
|
// 上 finalText 永远到不了结算点 → agentRunCommand 的 settleRunTerminal-
|
|
12478
12728
|
// Authoritatively 拿不到 lastAssistantText → `.result.md` 不写、status 无
|
|
12479
12729
|
// resultFile,编排者只能去啃带 ANSI 的 .log(同坑位历史:turnCredits)。
|
|
12480
|
-
...localResult.finalText ? { finalText: localResult.finalText } : {}
|
|
12730
|
+
...localResult.finalText ? { finalText: localResult.finalText } : {},
|
|
12731
|
+
...localResult.failureSubclass ? { failureSubclass: localResult.failureSubclass } : {}
|
|
12481
12732
|
};
|
|
12482
12733
|
const headerMeta = getRunResultHeaderMeta(localResult);
|
|
12483
12734
|
recordRunResultHeaderMeta(folded, headerMeta);
|
|
@@ -12552,9 +12803,14 @@ async function runAgentTurn(options) {
|
|
|
12552
12803
|
}
|
|
12553
12804
|
}
|
|
12554
12805
|
const localErrorMessage = localResult.localError ? toErrorMessage(localResult.localError) : "local runtime failed";
|
|
12806
|
+
const failureSubclass = localResult.failureSubclass ?? classifyFailureSubclass({
|
|
12807
|
+
message: localErrorMessage,
|
|
12808
|
+
body: localResult.localError
|
|
12809
|
+
});
|
|
12555
12810
|
options.output.write(describeLocalRunFailure(localErrorMessage, localResult.localError));
|
|
12556
12811
|
return {
|
|
12557
12812
|
exitCode: 1,
|
|
12813
|
+
failureSubclass,
|
|
12558
12814
|
...localResult.dialogId ? { dialogId: localResult.dialogId } : {},
|
|
12559
12815
|
// Keep localError so TUI can show balance/quota/dialog-preserved hints
|
|
12560
12816
|
// instead of only the raw auto-runtime line.
|
|
@@ -12574,12 +12830,16 @@ async function runAgentTurn(options) {
|
|
|
12574
12830
|
}
|
|
12575
12831
|
const localAvailability = await checkLocalAvailabilityBeforeHttpDispatch(options);
|
|
12576
12832
|
if (localAvailability?.exitCode) {
|
|
12577
|
-
return {
|
|
12833
|
+
return {
|
|
12834
|
+
exitCode: localAvailability.exitCode,
|
|
12835
|
+
failureSubclass: localAvailability.failureSubclass ?? "rate_limit"
|
|
12836
|
+
};
|
|
12578
12837
|
}
|
|
12579
12838
|
const httpResult = await runHttpAgentTurn(options, authToken);
|
|
12580
|
-
if (httpResult.exitCode === 0 && !httpResult.streamInterrupted && localAvailability?.credentialKey) {
|
|
12839
|
+
if (httpResult.exitCode === 0 && !httpResult.streamInterrupted && (localAvailability?.credentialKey || localAvailability?.matchedKey)) {
|
|
12840
|
+
const keyToClear = localAvailability.credentialKey || localAvailability.matchedKey;
|
|
12581
12841
|
await clearCredentialAvailability(
|
|
12582
|
-
|
|
12842
|
+
keyToClear,
|
|
12583
12843
|
options.env
|
|
12584
12844
|
).catch(() => void 0);
|
|
12585
12845
|
}
|
|
@@ -12667,7 +12927,7 @@ import * as nodeFs from "node:fs";
|
|
|
12667
12927
|
var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY;
|
|
12668
12928
|
|
|
12669
12929
|
// packages/agent-runtime/hostEnvironment.ts
|
|
12670
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
12930
|
+
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
12671
12931
|
import os from "node:os";
|
|
12672
12932
|
function parseLinuxOsRelease(content) {
|
|
12673
12933
|
let prettyName;
|
|
@@ -12706,9 +12966,9 @@ function probeHostEnvironment(options) {
|
|
|
12706
12966
|
if (osReleaseText === void 0) {
|
|
12707
12967
|
try {
|
|
12708
12968
|
if (existsSync("/etc/os-release")) {
|
|
12709
|
-
osReleaseText =
|
|
12969
|
+
osReleaseText = readFileSync2("/etc/os-release", "utf8");
|
|
12710
12970
|
} else if (existsSync("/usr/lib/os-release")) {
|
|
12711
|
-
osReleaseText =
|
|
12971
|
+
osReleaseText = readFileSync2("/usr/lib/os-release", "utf8");
|
|
12712
12972
|
}
|
|
12713
12973
|
} catch {
|
|
12714
12974
|
}
|
|
@@ -12774,16 +13034,16 @@ function buildHostEnvironmentLayer(options) {
|
|
|
12774
13034
|
}
|
|
12775
13035
|
|
|
12776
13036
|
// packages/agent-runtime/agentsMd.ts
|
|
12777
|
-
import { existsSync as existsSync2, readFileSync as
|
|
12778
|
-
import { join } from "node:path";
|
|
13037
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
13038
|
+
import { join as join2 } from "node:path";
|
|
12779
13039
|
var AGENTS_MD_MAX_BYTES = 8192;
|
|
12780
13040
|
var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
|
|
12781
13041
|
function readAgentsMdLayerFromDisk(cwd) {
|
|
12782
13042
|
for (const name of AGENTS_MD_CANDIDATES) {
|
|
12783
|
-
const filePath =
|
|
13043
|
+
const filePath = join2(cwd, name);
|
|
12784
13044
|
if (!existsSync2(filePath)) continue;
|
|
12785
13045
|
try {
|
|
12786
|
-
let content =
|
|
13046
|
+
let content = readFileSync3(filePath, "utf8").trim();
|
|
12787
13047
|
if (!content) continue;
|
|
12788
13048
|
if (Buffer.byteLength(content, "utf8") > AGENTS_MD_MAX_BYTES) {
|
|
12789
13049
|
content = Buffer.from(content, "utf8").subarray(0, AGENTS_MD_MAX_BYTES).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
|
|
@@ -12853,17 +13113,17 @@ function runDoDCommands(commands, cwd, deps = {}) {
|
|
|
12853
13113
|
}
|
|
12854
13114
|
|
|
12855
13115
|
// packages/cli/agentRunPrompts.ts
|
|
12856
|
-
import { existsSync as existsSync3, readFileSync as
|
|
12857
|
-
import { dirname, extname, isAbsolute, join as
|
|
13116
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync, statSync as statSync2 } from "node:fs";
|
|
13117
|
+
import { dirname, extname, isAbsolute as isAbsolute2, join as join3, relative as relativePath, resolve as resolve2, sep } from "node:path";
|
|
12858
13118
|
function workflowRefToCandidatePath(cwd, ref) {
|
|
12859
13119
|
const normalized = ref.trim();
|
|
12860
13120
|
if (!normalized) return "";
|
|
12861
13121
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
12862
|
-
const directPath =
|
|
13122
|
+
const directPath = resolve2(cwd, normalized);
|
|
12863
13123
|
if (existsSync3(directPath)) return directPath;
|
|
12864
13124
|
}
|
|
12865
13125
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
12866
|
-
return
|
|
13126
|
+
return resolve2(cwd, "docs", "workflows", `${fileName}.md`);
|
|
12867
13127
|
}
|
|
12868
13128
|
var SKILL_SEARCH_DIRS = [
|
|
12869
13129
|
".agents/skills"
|
|
@@ -12872,22 +13132,22 @@ function skillRefToCandidatePath(cwd, ref) {
|
|
|
12872
13132
|
const normalized = ref.trim();
|
|
12873
13133
|
if (!normalized) return "";
|
|
12874
13134
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
12875
|
-
const directPath =
|
|
13135
|
+
const directPath = resolve2(cwd, normalized);
|
|
12876
13136
|
if (existsSync3(directPath)) return directPath;
|
|
12877
13137
|
}
|
|
12878
13138
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
12879
13139
|
for (const dir of SKILL_SEARCH_DIRS) {
|
|
12880
|
-
const skillMdPath =
|
|
13140
|
+
const skillMdPath = resolve2(cwd, dir, fileName, "SKILL.md");
|
|
12881
13141
|
if (existsSync3(skillMdPath)) return skillMdPath;
|
|
12882
13142
|
}
|
|
12883
|
-
return
|
|
13143
|
+
return resolve2(cwd, ".agents", "skills", fileName, "SKILL.md");
|
|
12884
13144
|
}
|
|
12885
13145
|
async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
12886
13146
|
const path2 = workflowRefToCandidatePath(cwd, ref);
|
|
12887
13147
|
if (!path2 || !existsSync3(path2)) {
|
|
12888
13148
|
throw new Error(`Workflow reference not found: ${ref}`);
|
|
12889
13149
|
}
|
|
12890
|
-
const markdown =
|
|
13150
|
+
const markdown = readFileSync4(path2, "utf8");
|
|
12891
13151
|
const parsed = parseSkillDocProtocol(markdown);
|
|
12892
13152
|
return {
|
|
12893
13153
|
ref,
|
|
@@ -12897,15 +13157,15 @@ async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
|
12897
13157
|
}
|
|
12898
13158
|
function inlineRelativeRefs(body, skillDir) {
|
|
12899
13159
|
const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
|
|
12900
|
-
const normalizedSkillDir =
|
|
13160
|
+
const normalizedSkillDir = resolve2(skillDir) + sep;
|
|
12901
13161
|
return body.replace(refPattern, (match, label, relPath) => {
|
|
12902
13162
|
const cleaned = relPath.trim();
|
|
12903
13163
|
if (!cleaned.startsWith("./") && !cleaned.startsWith("../")) return match;
|
|
12904
|
-
const absPath =
|
|
13164
|
+
const absPath = resolve2(skillDir, cleaned);
|
|
12905
13165
|
const relative = relativePath(normalizedSkillDir, absPath);
|
|
12906
|
-
if (relative.startsWith("..") ||
|
|
13166
|
+
if (relative.startsWith("..") || isAbsolute2(relative)) return match;
|
|
12907
13167
|
if (!existsSync3(absPath) || !absPath.endsWith(".md")) return match;
|
|
12908
|
-
const refContent =
|
|
13168
|
+
const refContent = readFileSync4(absPath, "utf8");
|
|
12909
13169
|
return `
|
|
12910
13170
|
|
|
12911
13171
|
### ${label}
|
|
@@ -12916,7 +13176,7 @@ ${refContent}
|
|
|
12916
13176
|
});
|
|
12917
13177
|
}
|
|
12918
13178
|
function listSkillScripts(skillDir) {
|
|
12919
|
-
const scriptsDir =
|
|
13179
|
+
const scriptsDir = join3(skillDir, "scripts");
|
|
12920
13180
|
if (!existsSync3(scriptsDir) || !statSync2(scriptsDir).isDirectory()) return null;
|
|
12921
13181
|
const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
|
|
12922
13182
|
if (entries.length === 0) return null;
|
|
@@ -12947,7 +13207,7 @@ async function resolveSkillReference(ref, options = {}) {
|
|
|
12947
13207
|
if (!path2 || !existsSync3(path2)) {
|
|
12948
13208
|
throw new Error(`Skill reference not found: ${ref}`);
|
|
12949
13209
|
}
|
|
12950
|
-
markdown =
|
|
13210
|
+
markdown = readFileSync4(path2, "utf8");
|
|
12951
13211
|
filePath = path2;
|
|
12952
13212
|
skillDir = dirname(path2);
|
|
12953
13213
|
}
|
|
@@ -13051,9 +13311,9 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
|
|
|
13051
13311
|
}
|
|
13052
13312
|
function normalizeCliImageInput(input) {
|
|
13053
13313
|
if (/^(https?:|data:|file:)/i.test(input)) return input;
|
|
13054
|
-
const absolutePath =
|
|
13314
|
+
const absolutePath = resolve2(input);
|
|
13055
13315
|
if (!existsSync3(absolutePath)) return input;
|
|
13056
|
-
const base64 =
|
|
13316
|
+
const base64 = readFileSync4(absolutePath).toString("base64");
|
|
13057
13317
|
return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
|
|
13058
13318
|
}
|
|
13059
13319
|
function imageMimeTypeForPath(path2) {
|
|
@@ -15597,6 +15857,22 @@ async function runAgentRunCommand(args, deps) {
|
|
|
15597
15857
|
if (!localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal)) {
|
|
15598
15858
|
localRuntimeCwd = process.cwd();
|
|
15599
15859
|
}
|
|
15860
|
+
if (parsed.runtimeKey === "instabox") {
|
|
15861
|
+
try {
|
|
15862
|
+
writeInstaboxRunConfig({
|
|
15863
|
+
workspaceMode: parsed.instaboxWorkspace,
|
|
15864
|
+
artifactDir: parsed.instaboxArtifactDir,
|
|
15865
|
+
manifestPath: parsed.instaboxManifestPath,
|
|
15866
|
+
allowRemoteRelease: parsed.instaboxAllowRemoteRelease,
|
|
15867
|
+
allowPaid: parsed.instaboxAllowPaid,
|
|
15868
|
+
env
|
|
15869
|
+
});
|
|
15870
|
+
} catch (err) {
|
|
15871
|
+
output.write(`[nolo] instabox \u914D\u7F6E\u751F\u6210\u5931\u8D25: ${toErrorMessage(err)}
|
|
15872
|
+
`);
|
|
15873
|
+
return 1;
|
|
15874
|
+
}
|
|
15875
|
+
}
|
|
15600
15876
|
const runEnv = buildLocalRunEnv({
|
|
15601
15877
|
env,
|
|
15602
15878
|
allowShell: parsed.allowShell
|
|
@@ -16016,6 +16292,7 @@ export {
|
|
|
16016
16292
|
computeBaselineContextTokens,
|
|
16017
16293
|
resolveContextUsage,
|
|
16018
16294
|
renderTokenStatus,
|
|
16295
|
+
createIdleHeapReleaser,
|
|
16019
16296
|
COLLAPSED_PASTE_PLACEHOLDER_RE,
|
|
16020
16297
|
shouldCollapsePaste,
|
|
16021
16298
|
createCollapsedPasteStore,
|