nolo-cli 0.54.0 → 0.61.0-alpha.3
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/README.md +3 -3
- package/{_executeModel-OPTKYHJA.js → _executeModel-R26QYY66.js} +50 -46
- package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
- package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
- package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
- package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-6GNQA4J4.js} +30 -27
- package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-HH67CYKD.js} +61 -57
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
- package/{agentListCommands-VJNKULIK.js → agentListCommands-23XW3OPZ.js} +61 -31
- package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-HXHASEWO.js} +31 -28
- package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
- package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-UHTQJVGC.js} +59 -55
- package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-OAMT77EX.js} +63 -59
- package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
- package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-QBK4H3T2.js} +26 -23
- package/{agentSlice-ODKF4J6M.js → agentSlice-7XJH5WQF.js} +8 -7
- package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-AX2O6VDV.js} +30 -27
- package/{appDeployCommands-37F4GPCU.js → appDeployCommands-L5ZR26CB.js} +30 -27
- package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-5HQHELRA.js} +30 -27
- package/{appGetCommands-YLOBA3EM.js → appGetCommands-HVSYOS57.js} +30 -27
- package/{appListCommands-UD62R5ME.js → appListCommands-XV2FPTWX.js} +30 -27
- package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
- package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
- package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-F3R253JE.js} +20 -18
- package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
- package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
- package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
- package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
- package/chunk-3BLB7QKO.js +433 -0
- package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
- package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
- package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
- package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
- package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
- package/{chunk-6HIGYUBQ.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
- package/{chunk-6COJEAYH.js → chunk-7KELZLC2.js} +44 -37
- package/chunk-AETZ7AD6.js +274 -0
- package/chunk-BFU6C242.js +66 -0
- package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
- package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
- package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
- package/{chunk-TR4DXUYX.js → chunk-CQ2OZMLQ.js} +1181 -737
- package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
- package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
- package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
- package/{chunk-FJHMLRDQ.js → chunk-DWYSDNOH.js} +22 -28
- package/{chunk-AA564GBL.js → chunk-E3YVTQWT.js} +2 -2
- package/chunk-E4MARS3Q.js +114 -0
- package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
- package/chunk-EDKF7RX4.js +30 -0
- package/{chunk-TC6P4NDR.js → chunk-F44FAXP2.js} +6 -6
- package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
- package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
- package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
- package/{chunk-6HDYSFLO.js → chunk-GSXDRMDO.js} +3 -3
- package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
- package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
- package/{chunk-EY7V7REW.js → chunk-KHCLMKZZ.js} +6 -280
- package/{chunk-EJE33XNR.js → chunk-KSCXMC6U.js} +1521 -565
- package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
- package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
- package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
- package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
- package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
- package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
- package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
- package/chunk-N4G4PKQ6.js +23 -0
- package/{chunk-WQHGJHAL.js → chunk-N6HLMLKE.js} +732 -726
- package/{chunk-YQBXOHE6.js → chunk-NO42UD73.js} +1 -1
- package/{chunk-MLEZPE3U.js → chunk-NRRPKMM7.js} +4 -4
- package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
- package/chunk-ONXOABJR.js +215 -0
- package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
- package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
- package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
- package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
- package/chunk-PSCNXBYA.js +11 -0
- package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
- package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
- package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
- package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
- package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
- package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
- package/chunk-SEJ5OS6F.js +49 -0
- package/{chunk-JXIP6ZWH.js → chunk-SKIRVYEI.js} +18 -5
- package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
- package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
- package/{chunk-RHMDMTDK.js → chunk-SYNKICCB.js} +2 -2
- package/{chunk-YBFJQC2M.js → chunk-TBHAHL33.js} +65 -42
- package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
- package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
- package/{chunk-7FAS3NEF.js → chunk-VAKVNHK5.js} +19 -15
- package/{chunk-UOWXD4VN.js → chunk-VHO3TMQZ.js} +336 -244
- package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
- package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
- package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
- package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
- package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
- package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
- package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
- package/{chunk-5FCIPEKT.js → chunk-Z5MHFBJZ.js} +1051 -926
- package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
- package/{codingSkills-BCQXRZOI.js → codingSkills-TKROLCBA.js} +4 -3
- package/{contentThunks-KNI6VXLT.js → contentThunks-OZPK5B4Z.js} +21 -19
- package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
- package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-LCIBGE5T.js} +23 -21
- package/{createDialogAction-JDSMY4AY.js → createDialogAction-JPJZMHJE.js} +25 -22
- package/{createPageAction-T7RA3HCG.js → createPageAction-6P2WLNHO.js} +26 -23
- package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
- package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
- package/{dialogCommands-UQZYWOOV.js → dialogCommands-WAFKC3KK.js} +30 -27
- package/{dialogSlice-TYW2G7IL.js → dialogSlice-R5RZHFTU.js} +20 -18
- package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-GHGB42S7.js} +32 -28
- package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-Y5I7ZEX4.js} +33 -29
- package/{docReadCommands-ZLMFVC67.js → docReadCommands-BMXM6J7T.js} +32 -28
- package/{docStore-2URPBVCS.js → docStore-DKWZ6XJ5.js} +6 -5
- package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-QNABH3M2.js} +32 -28
- package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
- package/handleSendMessageAction-UQGKM4UX.js +675 -0
- package/index.js +79 -88
- package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
- package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
- package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
- package/{machineCommands-RK6L7ZWL.js → machineCommands-YDAIPYU5.js} +298 -80
- package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-O6RM2ECT.js} +57 -53
- package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
- package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
- package/package.json +3 -2
- package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
- package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
- package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-5DP3AJWN.js} +4367 -2796
- package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
- package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-Y6HWP2PT.js} +51 -46
- package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
- package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
- package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
- package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
- package/{skillDiscovery-2QTZINON.js → skillDiscovery-CYUCJMAG.js} +2 -1
- package/{spaceCommands-S5YJJXL7.js → spaceCommands-CLN45IE3.js} +33 -215
- package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-6WFQJ4DY.js} +107 -74
- package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
- package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
- package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
- package/{tools-SSXSTC3O.js → tools-RR53D65Q.js} +39 -35
- package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
- package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
- package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-WXS3AKOL.js} +23 -21
- package/agentSuperviseCommands-5AR3DKNN.js +0 -640
- package/chunk-6IGD47IC.js +0 -19
- package/chunk-FD36SCCD.js +0 -105
- package/chunk-GRFK2XP4.js +0 -230
- package/chunk-HJTAGT3W.js +0 -370
- package/chunk-SUEIAK5N.js +0 -2574
- package/handleSendMessageAction-GO53TY7U.js +0 -409
|
@@ -9,58 +9,61 @@ import {
|
|
|
9
9
|
resolveRawAgentInput,
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
resolveMachineId
|
|
15
|
-
} from "./chunk-ESHYE7WU.js";
|
|
12
|
+
} from "./chunk-JYYZCK2Z.js";
|
|
16
13
|
import {
|
|
17
14
|
agentRunCardLabels,
|
|
18
15
|
createCliLocalRuntimeAdapter,
|
|
16
|
+
detectCurrentMachineId,
|
|
19
17
|
getCliLocale,
|
|
20
18
|
isBuiltinNoloAgentRef,
|
|
19
|
+
isCliProviderAgentConfig,
|
|
20
|
+
isLiveAgentRunObservation,
|
|
21
|
+
isMachineBoundLocalhostCustomProvider,
|
|
21
22
|
isSubtaskRun,
|
|
22
23
|
parseAgentRunEvent,
|
|
24
|
+
resolveAuthToken as resolveAuthToken2,
|
|
25
|
+
resolveBoundMachineId,
|
|
26
|
+
resolveFileWriteGateEnabled,
|
|
27
|
+
resolveLocalUserId,
|
|
23
28
|
t,
|
|
24
29
|
toolLabel
|
|
25
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-Z5MHFBJZ.js";
|
|
31
|
+
import {
|
|
32
|
+
createRunActivityTracker,
|
|
33
|
+
popSingleQueueMessage,
|
|
34
|
+
readRunRecord,
|
|
35
|
+
resolveRunQueuePath,
|
|
36
|
+
settleRunTerminalAuthoritatively,
|
|
37
|
+
spawnLocalBackgroundRun
|
|
38
|
+
} from "./chunk-45YO6H7P.js";
|
|
26
39
|
import {
|
|
27
40
|
readCredentialEntry,
|
|
28
41
|
recordCredentialProbe,
|
|
29
42
|
resolveCredentialKeyWithFallback
|
|
30
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-DWUCB2A3.js";
|
|
31
44
|
import {
|
|
32
45
|
getReadableCliDb
|
|
33
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-RXX4GDIH.js";
|
|
34
47
|
import {
|
|
35
|
-
normalizeAgentHandle,
|
|
36
48
|
readDbRecord,
|
|
37
49
|
resolveAgentRecordFromHybridStore
|
|
38
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-FHAGENAS.js";
|
|
39
51
|
import {
|
|
40
|
-
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
41
52
|
isLocalCliAgentKey
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import {
|
|
44
|
-
generateRunReport
|
|
45
|
-
} from "./chunk-HJTAGT3W.js";
|
|
53
|
+
} from "./chunk-SPAQ4PVV.js";
|
|
46
54
|
import {
|
|
47
55
|
CliProviderQuotaError
|
|
48
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-MP64VFGD.js";
|
|
49
57
|
import {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
popSingleQueueMessage,
|
|
53
|
-
readRunRecord,
|
|
54
|
-
resolveRunQueuePath,
|
|
55
|
-
spawnLocalBackgroundRun
|
|
56
|
-
} from "./chunk-SSXTSPSG.js";
|
|
58
|
+
resolveMachineId
|
|
59
|
+
} from "./chunk-ESHYE7WU.js";
|
|
57
60
|
import {
|
|
58
61
|
applyModelLayerOverride,
|
|
59
62
|
buildModelLayerOverride
|
|
60
63
|
} from "./chunk-LTRXGFMS.js";
|
|
61
64
|
import {
|
|
62
65
|
formatAgentListCard
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-CQ2OZMLQ.js";
|
|
64
67
|
import {
|
|
65
68
|
isTransientFetchError
|
|
66
69
|
} from "./chunk-5XTOKQLW.js";
|
|
@@ -75,60 +78,71 @@ import {
|
|
|
75
78
|
formatStatusRunCard,
|
|
76
79
|
formatStopRunCard,
|
|
77
80
|
isAgentRunTerminalStatus
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-NTW5GWDM.js";
|
|
79
82
|
import {
|
|
80
83
|
buildMemorySubjectsForAgent,
|
|
81
84
|
chooseMemoryOwners,
|
|
82
85
|
loadMemoryCandidatesFromDb,
|
|
83
86
|
resolveAgentMemoryPolicy
|
|
84
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-DWYSDNOH.js";
|
|
85
88
|
import {
|
|
86
89
|
API_REPORTED_COST_MULTIPLIER,
|
|
87
90
|
normalizeUsage,
|
|
88
91
|
parseUiAskChoiceContent
|
|
89
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-TBHAHL33.js";
|
|
93
|
+
import {
|
|
94
|
+
isOAuthApiKeyRef
|
|
95
|
+
} from "./chunk-YYLHWIW6.js";
|
|
96
|
+
import {
|
|
97
|
+
isCliAuthorityBrokerProtocolError,
|
|
98
|
+
isCliAuthorityBrokerTimeoutError,
|
|
99
|
+
isCliAuthorityBrokerUnavailableError
|
|
100
|
+
} from "./chunk-TRV2MIDW.js";
|
|
90
101
|
import {
|
|
91
102
|
getDefaultCliLocalRuntimeDb
|
|
92
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-C3FZR5EC.js";
|
|
93
104
|
import {
|
|
94
105
|
buildSkillDiscoveryContextLayer
|
|
95
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-E4MARS3Q.js";
|
|
96
107
|
import {
|
|
97
108
|
parseExternalSkillMarkdown,
|
|
98
109
|
parseSkillDocProtocol
|
|
99
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-AETZ7AD6.js";
|
|
100
111
|
import {
|
|
101
112
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
102
113
|
LOCAL_TURN_ABORTED_CODE,
|
|
103
114
|
readActionGate
|
|
104
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-KSCXMC6U.js";
|
|
105
116
|
import {
|
|
106
117
|
resolveAgentRuntimeConfigFromRecord
|
|
107
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-XOKOSO35.js";
|
|
108
119
|
import {
|
|
109
120
|
createThinkParserState,
|
|
110
121
|
flushThinkParser,
|
|
111
122
|
processThinkChunk
|
|
112
123
|
} from "./chunk-N7J63Q6C.js";
|
|
113
124
|
import {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
isAntigravityOAuthAgent
|
|
126
|
+
} from "./chunk-QEW2MFDQ.js";
|
|
127
|
+
import {
|
|
128
|
+
resolveClientVersion
|
|
129
|
+
} from "./chunk-RDBARW6T.js";
|
|
117
130
|
import {
|
|
118
131
|
isQuotaExhaustedError,
|
|
132
|
+
isQuotaLimited403Body,
|
|
119
133
|
mergeAvailabilityDeadline,
|
|
120
134
|
resolveCooldownGate
|
|
121
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-CJCJF5XB.js";
|
|
122
136
|
import {
|
|
123
137
|
DEFAULT_CONTEXT_WINDOW,
|
|
124
138
|
getModelContextWindow
|
|
125
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-5ZYA4JJ3.js";
|
|
126
140
|
import {
|
|
127
141
|
clipCompactText
|
|
128
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-Z4QSJILV.js";
|
|
129
143
|
import {
|
|
130
144
|
findModelConfig
|
|
131
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-MMZ6ZTVO.js";
|
|
132
146
|
import {
|
|
133
147
|
compactWhitespace
|
|
134
148
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -153,7 +167,7 @@ import {
|
|
|
153
167
|
CLIENT_VERSION_TOO_OLD_CODE,
|
|
154
168
|
NOLO_CLIENT_VERSION_HEADER,
|
|
155
169
|
buildClientVersionUpgradeMessage
|
|
156
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-22BTGNSP.js";
|
|
157
171
|
import {
|
|
158
172
|
parsePositiveFiniteNumberOrFallback
|
|
159
173
|
} from "./chunk-Y5GCAMGP.js";
|
|
@@ -167,16 +181,13 @@ import {
|
|
|
167
181
|
BUILTIN_NOLO_AGENT_KEY,
|
|
168
182
|
BUILTIN_NOLO_AGENT_NAME,
|
|
169
183
|
builtinAgentCatalogEntryById
|
|
170
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-L7B47JXR.js";
|
|
171
185
|
import {
|
|
172
186
|
parsePublicAgentId
|
|
173
187
|
} from "./chunk-BJIRLHJR.js";
|
|
174
188
|
import {
|
|
175
189
|
asTrimmedString
|
|
176
190
|
} from "./chunk-3EUW3WEO.js";
|
|
177
|
-
import {
|
|
178
|
-
isLoopbackUrl
|
|
179
|
-
} from "./chunk-4SN6J65J.js";
|
|
180
191
|
import {
|
|
181
192
|
asOptionalTrimmedString
|
|
182
193
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -1132,7 +1143,7 @@ var THEME_PALETTES = {
|
|
|
1132
1143
|
// denser slate — 687584 read too blue in dense prose (inline code/tool labels); 5E6A78 pulls blue down while staying darker than the old value
|
|
1133
1144
|
},
|
|
1134
1145
|
dark: {
|
|
1135
|
-
accent: { hex: "5BA3D9", ansiFallback: "\x1B[
|
|
1146
|
+
accent: { hex: "5BA3D9", ansiFallback: "\x1B[94m" },
|
|
1136
1147
|
// trail dark primary (was wrongly copied from catppuccin 89B4FA)
|
|
1137
1148
|
chrome: { hex: "6C7086", ansiFallback: "\x1B[90m" },
|
|
1138
1149
|
success: { hex: "5CB87A", ansiFallback: "\x1B[32m" },
|
|
@@ -1158,7 +1169,7 @@ var THEME_PALETTES = {
|
|
|
1158
1169
|
muted: { hex: "6E7781", ansiFallback: "\x1B[90m" }
|
|
1159
1170
|
},
|
|
1160
1171
|
dark: {
|
|
1161
|
-
accent: { hex: "89B4FA", ansiFallback: "\x1B[
|
|
1172
|
+
accent: { hex: "89B4FA", ansiFallback: "\x1B[94m" },
|
|
1162
1173
|
// Catppuccin Mocha Blue
|
|
1163
1174
|
chrome: { hex: "6C7086", ansiFallback: "\x1B[90m" },
|
|
1164
1175
|
success: { hex: "A6E3A1", ansiFallback: "\x1B[32m" },
|
|
@@ -1180,7 +1191,7 @@ var THEME_PALETTES = {
|
|
|
1180
1191
|
muted: { hex: "716E61", ansiFallback: "\x1B[90m" }
|
|
1181
1192
|
},
|
|
1182
1193
|
dark: {
|
|
1183
|
-
accent: { hex: "7E9CD8", ansiFallback: "\x1B[
|
|
1194
|
+
accent: { hex: "7E9CD8", ansiFallback: "\x1B[94m" },
|
|
1184
1195
|
// crystalBlue
|
|
1185
1196
|
chrome: { hex: "727169", ansiFallback: "\x1B[90m" },
|
|
1186
1197
|
success: { hex: "98BB6C", ansiFallback: "\x1B[32m" },
|
|
@@ -1201,7 +1212,7 @@ var THEME_PALETTES = {
|
|
|
1201
1212
|
muted: { hex: "6E6A8A", ansiFallback: "\x1B[90m" }
|
|
1202
1213
|
},
|
|
1203
1214
|
dark: {
|
|
1204
|
-
accent: { hex: "8B9CF4", ansiFallback: "\x1B[
|
|
1215
|
+
accent: { hex: "8B9CF4", ansiFallback: "\x1B[94m" },
|
|
1205
1216
|
chrome: { hex: "5A5772", ansiFallback: "\x1B[90m" },
|
|
1206
1217
|
success: { hex: "26BD6C", ansiFallback: "\x1B[32m" },
|
|
1207
1218
|
warning: { hex: "F5A623", ansiFallback: "\x1B[33m" },
|
|
@@ -1221,7 +1232,7 @@ var THEME_PALETTES = {
|
|
|
1221
1232
|
muted: { hex: "797593", ansiFallback: "\x1B[90m" }
|
|
1222
1233
|
},
|
|
1223
1234
|
dark: {
|
|
1224
|
-
accent: { hex: "EB6F92", ansiFallback: "\x1B[
|
|
1235
|
+
accent: { hex: "EB6F92", ansiFallback: "\x1B[95m" },
|
|
1225
1236
|
chrome: { hex: "6E6A86", ansiFallback: "\x1B[90m" },
|
|
1226
1237
|
success: { hex: "9CCFD8", ansiFallback: "\x1B[32m" },
|
|
1227
1238
|
warning: { hex: "F6C177", ansiFallback: "\x1B[33m" },
|
|
@@ -1305,6 +1316,9 @@ function detectSystemBrightnessFromEnv(env = process.env) {
|
|
|
1305
1316
|
return null;
|
|
1306
1317
|
}
|
|
1307
1318
|
function resolveTuiBrightness(env = process.env) {
|
|
1319
|
+
return resolveTuiBrightnessSignal(env) ?? "dark";
|
|
1320
|
+
}
|
|
1321
|
+
function resolveTuiBrightnessSignal(env = process.env) {
|
|
1308
1322
|
const explicit = (env.NOLO_TUI_THEME ?? "").trim().toLowerCase();
|
|
1309
1323
|
if (explicit === "light") return "light";
|
|
1310
1324
|
if (explicit === "dark") return "dark";
|
|
@@ -1317,9 +1331,7 @@ function resolveTuiBrightness(env = process.env) {
|
|
|
1317
1331
|
if (!Number.isNaN(bg) && bg >= 0 && bg <= 6) return "dark";
|
|
1318
1332
|
if (!Number.isNaN(bg) && bg >= 7 && bg <= 15) return "light";
|
|
1319
1333
|
}
|
|
1320
|
-
|
|
1321
|
-
if (sys) return sys;
|
|
1322
|
-
return "dark";
|
|
1334
|
+
return detectSystemBrightnessFromEnv(env);
|
|
1323
1335
|
}
|
|
1324
1336
|
function resolveTuiThemeMode(env = process.env, fallback = activeThemeMode) {
|
|
1325
1337
|
const explicit = (env.NOLO_TUI_THEME ?? "").trim().toLowerCase();
|
|
@@ -4374,6 +4386,17 @@ ${items.map((item, i) => `${i === items.length - 1 ? "\u2514\u2500\u2500 " : "\u
|
|
|
4374
4386
|
format.reset = () => {
|
|
4375
4387
|
tree = null;
|
|
4376
4388
|
};
|
|
4389
|
+
format.consume = (event) => {
|
|
4390
|
+
if (event.type === "tool-call") {
|
|
4391
|
+
pending.set(event.toolCallId, {
|
|
4392
|
+
toolName: event.toolName,
|
|
4393
|
+
argumentsPreview: event.argumentsPreview
|
|
4394
|
+
});
|
|
4395
|
+
return;
|
|
4396
|
+
}
|
|
4397
|
+
pending.delete(event.toolCallId);
|
|
4398
|
+
tree = null;
|
|
4399
|
+
};
|
|
4377
4400
|
return format;
|
|
4378
4401
|
}
|
|
4379
4402
|
function createSseToolEventAdapter(onEvent) {
|
|
@@ -4542,6 +4565,13 @@ ${this.text}
|
|
|
4542
4565
|
|
|
4543
4566
|
// packages/cli/client/agentRunOutput.ts
|
|
4544
4567
|
var IDENTITY_LABEL_SEPARATOR = " > ";
|
|
4568
|
+
var THINKING_PREVIEW_BUFFER_LIMIT = 512;
|
|
4569
|
+
function appendThinkingPreview(current, chunk, limit = THINKING_PREVIEW_BUFFER_LIMIT) {
|
|
4570
|
+
if (limit <= 0) return "";
|
|
4571
|
+
const combined = current + chunk;
|
|
4572
|
+
if (combined.length <= limit) return combined;
|
|
4573
|
+
return combined.slice(combined.length - limit);
|
|
4574
|
+
}
|
|
4545
4575
|
function formatCompactionSummaryLine(event) {
|
|
4546
4576
|
if (!event) return "";
|
|
4547
4577
|
const action = event.reason === "tool_stub" ? "stub \u5DE5\u5177\u8F93\u51FA" : "\u751F\u6210\u5386\u53F2\u6458\u8981";
|
|
@@ -4602,19 +4632,35 @@ function createCliTurnOutput(params) {
|
|
|
4602
4632
|
let printedAssistantLabel = false;
|
|
4603
4633
|
let thinkState = createThinkParserState();
|
|
4604
4634
|
let thinkingFirstAt = null;
|
|
4605
|
-
let
|
|
4606
|
-
const
|
|
4607
|
-
|
|
4608
|
-
if (
|
|
4609
|
-
|
|
4635
|
+
let thinkingPreview = "";
|
|
4636
|
+
const markThinkingDelta = (chunk) => {
|
|
4637
|
+
if (!showThinking) return;
|
|
4638
|
+
if (streamedAssistantText) return;
|
|
4639
|
+
if (thinkingFirstAt === null) {
|
|
4640
|
+
thinkingFirstAt = Date.now();
|
|
4641
|
+
thinkingPreview = "";
|
|
4642
|
+
}
|
|
4643
|
+
thinkingPreview = appendThinkingPreview(thinkingPreview, chunk);
|
|
4644
|
+
spinner.setThinkingHint(thinkingPreview);
|
|
4645
|
+
reportThinkingProgress();
|
|
4646
|
+
};
|
|
4647
|
+
const reportThinkingProgress = () => {
|
|
4648
|
+
if (!showThinking) return;
|
|
4649
|
+
const preview = truncateThinkingHint(thinkingPreview, 60);
|
|
4650
|
+
const label = preview ? t("thinkingActivePreview", preview) : t("thinkingActive");
|
|
4651
|
+
options.activityReporter?.(label);
|
|
4610
4652
|
};
|
|
4611
|
-
const
|
|
4653
|
+
const endThinkingPhase = () => {
|
|
4612
4654
|
if (thinkingFirstAt === null) return;
|
|
4613
|
-
const seconds = Math.max(0, Math.round((
|
|
4655
|
+
const seconds = Math.max(0, Math.round((Date.now() - thinkingFirstAt) / 1e3));
|
|
4614
4656
|
thinkingFirstAt = null;
|
|
4615
|
-
|
|
4616
|
-
|
|
4657
|
+
thinkingPreview = "";
|
|
4658
|
+
spinner.stop();
|
|
4659
|
+
options.activityReporter?.(null);
|
|
4660
|
+
if (seconds >= 1) {
|
|
4661
|
+
options.output.write(`${dimCliText(t("thinkingTraceLine", formatElapsed(seconds)))}
|
|
4617
4662
|
`);
|
|
4663
|
+
}
|
|
4618
4664
|
};
|
|
4619
4665
|
let compactionEvent = null;
|
|
4620
4666
|
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
@@ -4635,14 +4681,11 @@ function createCliTurnOutput(params) {
|
|
|
4635
4681
|
const parsed = processThinkChunk(chunk, thinkState);
|
|
4636
4682
|
thinkState = parsed.state;
|
|
4637
4683
|
if (!parsed.content && !parsed.reasoning) return;
|
|
4638
|
-
if (
|
|
4639
|
-
|
|
4640
|
-
spinner.setThinkingHint(parsed.reasoning);
|
|
4684
|
+
if (parsed.reasoning) {
|
|
4685
|
+
markThinkingDelta(parsed.reasoning);
|
|
4641
4686
|
}
|
|
4642
4687
|
if (!parsed.content) return;
|
|
4643
|
-
|
|
4644
|
-
spinner.stop();
|
|
4645
|
-
options.activityReporter?.(null);
|
|
4688
|
+
endThinkingPhase();
|
|
4646
4689
|
if (!printedAssistantLabel) {
|
|
4647
4690
|
if (!assistantLabelManaged) {
|
|
4648
4691
|
options.output.write(`
|
|
@@ -4655,34 +4698,44 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
4655
4698
|
renderWriter.push(parsed.content);
|
|
4656
4699
|
};
|
|
4657
4700
|
const handleToolEvent = (event) => {
|
|
4658
|
-
const chunk = eventMode === "jsonl" ? formatToolJsonEvent(event) : formatToolEvent(event);
|
|
4659
4701
|
if (eventMode === "jsonl") {
|
|
4660
|
-
|
|
4702
|
+
const chunk2 = formatToolJsonEvent(event);
|
|
4703
|
+
options.output.write(chunk2);
|
|
4704
|
+
if (options.onAgentRunStatus) {
|
|
4705
|
+
const parsed = parseAgentRunEvent(event);
|
|
4706
|
+
if (parsed) {
|
|
4707
|
+
options.onAgentRunStatus(parsed.snapshot);
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4661
4710
|
return;
|
|
4662
4711
|
}
|
|
4663
4712
|
if (event.type === "tool-call") {
|
|
4664
4713
|
renderWriter.flush();
|
|
4714
|
+
formatToolEvent(event);
|
|
4715
|
+
endThinkingPhase();
|
|
4716
|
+
if (streamedAssistantText) {
|
|
4717
|
+
options.output.write("\n");
|
|
4718
|
+
streamedAssistantText = false;
|
|
4719
|
+
}
|
|
4720
|
+
const activeLabel = formatConservativeActiveToolLabel(event);
|
|
4721
|
+
spinner.show(activeLabel);
|
|
4722
|
+
options.activityReporter?.(activeLabel);
|
|
4723
|
+
return;
|
|
4724
|
+
}
|
|
4725
|
+
const parsedRunEvent = parseAgentRunEvent(event);
|
|
4726
|
+
if (options.onAgentRunStatus && parsedRunEvent) {
|
|
4727
|
+
options.onAgentRunStatus(parsedRunEvent.snapshot);
|
|
4665
4728
|
}
|
|
4666
4729
|
spinner.stop();
|
|
4667
4730
|
options.activityReporter?.(null);
|
|
4668
|
-
if (event
|
|
4669
|
-
|
|
4670
|
-
|
|
4731
|
+
if (isLiveAgentRunObservation(event, parsedRunEvent)) {
|
|
4732
|
+
formatToolEvent.consume?.(event);
|
|
4733
|
+
return;
|
|
4671
4734
|
}
|
|
4735
|
+
const chunk = formatToolEvent(event);
|
|
4672
4736
|
if (chunk) {
|
|
4673
4737
|
writeToolOutput(chunk);
|
|
4674
4738
|
}
|
|
4675
|
-
if (event.type === "tool-call") {
|
|
4676
|
-
const activeLabel = formatConservativeActiveToolLabel(event);
|
|
4677
|
-
spinner.show(activeLabel);
|
|
4678
|
-
options.activityReporter?.(activeLabel);
|
|
4679
|
-
}
|
|
4680
|
-
if (options.onAgentRunStatus) {
|
|
4681
|
-
const parsed = parseAgentRunEvent(event);
|
|
4682
|
-
if (parsed) {
|
|
4683
|
-
options.onAgentRunStatus(parsed.snapshot);
|
|
4684
|
-
}
|
|
4685
|
-
}
|
|
4686
4739
|
};
|
|
4687
4740
|
return {
|
|
4688
4741
|
spinner,
|
|
@@ -4691,10 +4744,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
4691
4744
|
writeVisibleAssistantChunk(chunk);
|
|
4692
4745
|
},
|
|
4693
4746
|
pushThinking(chunk) {
|
|
4694
|
-
|
|
4695
|
-
markThinkingActivity();
|
|
4696
|
-
spinner.setThinkingHint(chunk);
|
|
4697
|
-
}
|
|
4747
|
+
markThinkingDelta(chunk);
|
|
4698
4748
|
},
|
|
4699
4749
|
handleToolEvent,
|
|
4700
4750
|
/** 记录一条 compaction 观测事件(TUI 在 turn 结束时渲染一行 dim 摘要)。 */
|
|
@@ -4707,14 +4757,14 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
4707
4757
|
options.activityReporter?.(activeLabel);
|
|
4708
4758
|
},
|
|
4709
4759
|
finish(fallbackContent) {
|
|
4710
|
-
spinner.stop();
|
|
4711
|
-
options.activityReporter?.(null);
|
|
4712
|
-
writeThinkingTrace();
|
|
4713
4760
|
const flushedThink = flushThinkParser(thinkState);
|
|
4714
4761
|
thinkState = flushedThink.state;
|
|
4715
4762
|
if (flushedThink.content) {
|
|
4716
4763
|
writeVisibleAssistantChunk(flushedThink.content);
|
|
4717
4764
|
}
|
|
4765
|
+
endThinkingPhase();
|
|
4766
|
+
spinner.stop();
|
|
4767
|
+
options.activityReporter?.(null);
|
|
4718
4768
|
if (streamedAssistantText) {
|
|
4719
4769
|
renderWriter.flush();
|
|
4720
4770
|
options.output.write("\n");
|
|
@@ -4924,51 +4974,6 @@ ${describeClientVersionTooOldFailure(message, error)}`);
|
|
|
4924
4974
|
};
|
|
4925
4975
|
}
|
|
4926
4976
|
|
|
4927
|
-
// packages/cli/client/agentRunTypes.ts
|
|
4928
|
-
function resolveAuthToken2(env) {
|
|
4929
|
-
return resolvePlatformAuthToken(env);
|
|
4930
|
-
}
|
|
4931
|
-
function resolveFileWriteGateEnabled(env) {
|
|
4932
|
-
const raw = (env.NOLO_CLI_WRITE_GATE ?? "").trim().toLowerCase();
|
|
4933
|
-
return raw !== "off" && raw !== "0" && raw !== "false";
|
|
4934
|
-
}
|
|
4935
|
-
function isMachineBoundLocalhostCustomProvider(agentConfig) {
|
|
4936
|
-
const machineId = agentConfig?.runtimeBinding && typeof agentConfig.runtimeBinding === "object" ? String(agentConfig.runtimeBinding.machineId ?? "").trim() : "";
|
|
4937
|
-
const providerUrl = asTrimmedString(agentConfig?.customProviderUrl);
|
|
4938
|
-
if (!machineId || !providerUrl) return false;
|
|
4939
|
-
return isLoopbackUrl(providerUrl);
|
|
4940
|
-
}
|
|
4941
|
-
function resolveBoundMachineId(agentConfig) {
|
|
4942
|
-
return agentConfig?.runtimeBinding && typeof agentConfig.runtimeBinding === "object" ? String(agentConfig.runtimeBinding.machineId ?? "").trim() : "";
|
|
4943
|
-
}
|
|
4944
|
-
var CLI_PROVIDER_NAMES = /* @__PURE__ */ new Set([
|
|
4945
|
-
"agy",
|
|
4946
|
-
"claude",
|
|
4947
|
-
"codex",
|
|
4948
|
-
"copilot",
|
|
4949
|
-
"gemini",
|
|
4950
|
-
"grok",
|
|
4951
|
-
"kimi",
|
|
4952
|
-
"opencode",
|
|
4953
|
-
"qoder"
|
|
4954
|
-
]);
|
|
4955
|
-
function isCliProviderAgentConfig(agentConfig) {
|
|
4956
|
-
const cliProvider = asTrimmedLowercaseString(agentConfig?.cliProvider);
|
|
4957
|
-
const provider = asTrimmedLowercaseString(agentConfig?.provider);
|
|
4958
|
-
return Boolean(cliProvider) || CLI_PROVIDER_NAMES.has(provider);
|
|
4959
|
-
}
|
|
4960
|
-
async function detectCurrentMachineId(env) {
|
|
4961
|
-
const fromEnv = (env.NOLO_CURRENT_MACHINE_ID || env.NOLO_MACHINE_ID || "").trim();
|
|
4962
|
-
if (fromEnv) return fromEnv;
|
|
4963
|
-
try {
|
|
4964
|
-
const { detectMachineInfo } = await import("./machineInfo-66ZFUMLE.js");
|
|
4965
|
-
const machine = await detectMachineInfo({ probeLaunchable: true });
|
|
4966
|
-
return asOptionalTrimmedString(machine?.machineId);
|
|
4967
|
-
} catch {
|
|
4968
|
-
return void 0;
|
|
4969
|
-
}
|
|
4970
|
-
}
|
|
4971
|
-
|
|
4972
4977
|
// packages/cli/client/agentRunPlatformTools.ts
|
|
4973
4978
|
var SERVER_PLATFORM_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
4974
4979
|
"addTableRow",
|
|
@@ -4978,28 +4983,6 @@ var SERVER_PLATFORM_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
4978
4983
|
"updateTableRow",
|
|
4979
4984
|
"updateTableRows"
|
|
4980
4985
|
]);
|
|
4981
|
-
var KNOWN_SERVER_PLATFORM_AGENT_KEYS = /* @__PURE__ */ new Set([NOLO_PROJECT_MANAGER_AGENT_KEY]);
|
|
4982
|
-
var KNOWN_SERVER_PLATFORM_AGENT_ALIASES = /* @__PURE__ */ new Set([
|
|
4983
|
-
"code-review",
|
|
4984
|
-
"frontend",
|
|
4985
|
-
"frontend-agent",
|
|
4986
|
-
"frontend-implementer",
|
|
4987
|
-
"full-stack",
|
|
4988
|
-
"fullstack",
|
|
4989
|
-
"nolo code review",
|
|
4990
|
-
"nolo fullstack",
|
|
4991
|
-
"nolo project manager",
|
|
4992
|
-
"nolo reviewer",
|
|
4993
|
-
"nolo-code-review",
|
|
4994
|
-
"nolo-fullstack",
|
|
4995
|
-
"nolo-pm",
|
|
4996
|
-
"nolo-project-manager",
|
|
4997
|
-
"nolo-reviewer",
|
|
4998
|
-
"pm",
|
|
4999
|
-
"project-manager",
|
|
5000
|
-
"review",
|
|
5001
|
-
"reviewer"
|
|
5002
|
-
]);
|
|
5003
4986
|
function findServerPlatformTools(toolNames) {
|
|
5004
4987
|
if (!Array.isArray(toolNames)) return [];
|
|
5005
4988
|
return toolNames.filter(
|
|
@@ -5012,13 +4995,6 @@ function resolveServerPlatformToolNames(agentConfig) {
|
|
|
5012
4995
|
...Array.isArray(agentConfig?.runtimeToolPolicy?.agentTools) ? agentConfig.runtimeToolPolicy.agentTools : []
|
|
5013
4996
|
]);
|
|
5014
4997
|
}
|
|
5015
|
-
function isKnownServerPlatformAgent(options) {
|
|
5016
|
-
if (KNOWN_SERVER_PLATFORM_AGENT_KEYS.has(options.agentKey)) return true;
|
|
5017
|
-
const normalizedKey = normalizeAgentHandle(options.agentKey);
|
|
5018
|
-
return Boolean(
|
|
5019
|
-
normalizedKey && KNOWN_SERVER_PLATFORM_AGENT_ALIASES.has(normalizedKey)
|
|
5020
|
-
);
|
|
5021
|
-
}
|
|
5022
4998
|
|
|
5023
4999
|
// packages/core/collapsedPaste.ts
|
|
5024
5000
|
var COLLAPSE_PASTE_MIN_LINES = 8;
|
|
@@ -5200,7 +5176,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
5200
5176
|
// packages/cli/client/agentRun.ts
|
|
5201
5177
|
import { ulid } from "ulid";
|
|
5202
5178
|
async function loadRunLocalAgentTurn() {
|
|
5203
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
5179
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-QBK4H3T2.js");
|
|
5204
5180
|
return runLocalAgentTurn;
|
|
5205
5181
|
}
|
|
5206
5182
|
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();
|
|
@@ -5322,25 +5298,44 @@ function wrapLoadAgentConfigWithModelOverride(adapter, targetAgentKey, override)
|
|
|
5322
5298
|
}
|
|
5323
5299
|
};
|
|
5324
5300
|
}
|
|
5301
|
+
var oauthChannelSkipReportedOutputs = /* @__PURE__ */ new WeakSet();
|
|
5302
|
+
function resolveOAuthChannelOwnerSkip(agentConfig, options) {
|
|
5303
|
+
if (!agentConfig) return null;
|
|
5304
|
+
const apiKeyRef = typeof agentConfig.apiKeyRef === "string" ? agentConfig.apiKeyRef : void 0;
|
|
5305
|
+
if (!isOAuthApiKeyRef(apiKeyRef) && !isAntigravityOAuthAgent(agentConfig)) {
|
|
5306
|
+
return null;
|
|
5307
|
+
}
|
|
5308
|
+
const rawRecord = agentConfig.rawRecord ?? {};
|
|
5309
|
+
const ownerUserId = asOptionalTrimmedString(rawRecord.userId) ?? asOptionalTrimmedString(rawRecord.ownerUserId);
|
|
5310
|
+
if (!ownerUserId) return null;
|
|
5311
|
+
const localUserId = resolveLocalUserId(options.env);
|
|
5312
|
+
if (ownerUserId === localUserId) return null;
|
|
5313
|
+
return `[nolo] auto runtime: skipping local runtime because ${options.agentKey} runs on its owner's OAuth subscription channel (owner ${ownerUserId}, this machine runs as ${localUserId}). Use --local explicitly to force this machine's own subscription.
|
|
5314
|
+
`;
|
|
5315
|
+
}
|
|
5325
5316
|
async function shouldSkipAutoLocalForServerPlatformTools(options) {
|
|
5326
5317
|
if (isBuiltinNoloAgentRef(options.agentKey)) return false;
|
|
5327
|
-
|
|
5318
|
+
const adapter = resolveLocalRuntimeAdapter(options);
|
|
5319
|
+
if (!adapter) {
|
|
5328
5320
|
return false;
|
|
5329
5321
|
}
|
|
5330
|
-
const knownServerPlatformAgent = isKnownServerPlatformAgent(options);
|
|
5331
|
-
const adapter = resolveLocalRuntimeAdapter(options);
|
|
5332
|
-
if (!adapter) return knownServerPlatformAgent;
|
|
5333
5322
|
let agentConfig;
|
|
5334
5323
|
try {
|
|
5335
5324
|
agentConfig = await adapter.loadAgentConfig(options.agentKey);
|
|
5336
5325
|
} catch {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5326
|
+
return false;
|
|
5327
|
+
}
|
|
5328
|
+
const oauthChannelOwnerSkip = resolveOAuthChannelOwnerSkip(agentConfig, options);
|
|
5329
|
+
if (oauthChannelOwnerSkip) {
|
|
5330
|
+
if (!options.output || typeof options.output !== "object" || !oauthChannelSkipReportedOutputs.has(options.output)) {
|
|
5331
|
+
if (options.output && typeof options.output === "object") {
|
|
5332
|
+
oauthChannelSkipReportedOutputs.add(options.output);
|
|
5333
|
+
}
|
|
5334
|
+
options.output.write(oauthChannelOwnerSkip);
|
|
5343
5335
|
}
|
|
5336
|
+
return true;
|
|
5337
|
+
}
|
|
5338
|
+
if (options.localRuntimeCwd) {
|
|
5344
5339
|
return false;
|
|
5345
5340
|
}
|
|
5346
5341
|
if (isCliProviderAgentConfig(agentConfig)) {
|
|
@@ -5353,10 +5348,12 @@ async function shouldSkipAutoLocalForServerPlatformTools(options) {
|
|
|
5353
5348
|
);
|
|
5354
5349
|
return true;
|
|
5355
5350
|
}
|
|
5356
|
-
if (
|
|
5351
|
+
if (resolveBoundMachineId(agentConfig)) {
|
|
5352
|
+
const currentMachineId = (await resolveCurrentMachineId(options))?.trim() || "";
|
|
5353
|
+
const boundMachineId = resolveBoundMachineId(agentConfig);
|
|
5354
|
+
if (currentMachineId && currentMachineId === boundMachineId) return false;
|
|
5357
5355
|
options.output.write(
|
|
5358
|
-
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a
|
|
5359
|
-
`
|
|
5356
|
+
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a platform agent bound to machine ${boundMachineId}` + (currentMachineId ? ` (this machine is ${currentMachineId}).` : ".") + " The server will dispatch it to the bound machine connector.\n"
|
|
5360
5357
|
);
|
|
5361
5358
|
return true;
|
|
5362
5359
|
}
|
|
@@ -5434,9 +5431,12 @@ function classifyLocalRunError(message) {
|
|
|
5434
5431
|
if (!m) return { kind: "generic" };
|
|
5435
5432
|
const status = Number(m[2]);
|
|
5436
5433
|
const transport = PLATFORM_TRANSPORT_RE.test(message) ? "platform" : "local";
|
|
5437
|
-
if (status === 401
|
|
5434
|
+
if (status === 401) {
|
|
5438
5435
|
return { kind: "auth", transport, status };
|
|
5439
5436
|
}
|
|
5437
|
+
if (status === 403) {
|
|
5438
|
+
return isQuotaLimited403Body(message) ? { kind: "rate-limit", transport, status } : { kind: "auth", transport, status };
|
|
5439
|
+
}
|
|
5440
5440
|
if (status === 400 || status === 422) {
|
|
5441
5441
|
return { kind: "rejected-payload", transport, status };
|
|
5442
5442
|
}
|
|
@@ -5453,10 +5453,14 @@ var RUN_UNAVAILABLE_PREFIX = "[nolo] auto runtime: local run unavailable";
|
|
|
5453
5453
|
var NO_FALLBACK = "Not falling back to server.";
|
|
5454
5454
|
var SERVER_FALLBACK_HINT = "or use --server to run on the server explicitly.";
|
|
5455
5455
|
function buildAuthFailure(ctx) {
|
|
5456
|
-
const
|
|
5456
|
+
const platformNoToken = ctx.where === "server chat proxy" && isAuthNoTokenBody(ctx.message);
|
|
5457
|
+
const fix = platformNoToken ? `This install is not logged in \u2014 run \`nolo login\`, or set AUTH_TOKEN / NOLO_SERVER` : ctx.where === "server chat proxy" ? `Check the agent's provider/api-key settings on nolo.chat` : `Fix the local credential/config and retry`;
|
|
5457
5458
|
return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}, auth rejected). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
|
|
5458
5459
|
`;
|
|
5459
5460
|
}
|
|
5461
|
+
function isAuthNoTokenBody(message) {
|
|
5462
|
+
return /"authCode"\s*:\s*"AUTH_NO_TOKEN"/i.test(message) || /no authentication token provided/i.test(message);
|
|
5463
|
+
}
|
|
5460
5464
|
function buildRejectedPayloadFailure(ctx) {
|
|
5461
5465
|
const looksLikeHistoryReplay = HISTORY_REPLAY_REJECTION_RE.test(ctx.message);
|
|
5462
5466
|
const cause = looksLikeHistoryReplay ? ` This usually happens when the dialog history contains tool_calls or reasoning produced by a different model/provider (e.g. after /switch); the new provider rejects that history. Start a fresh dialog, or clean the offending history.` : "";
|
|
@@ -5485,6 +5489,9 @@ var FAILURE_BUILDERS = {
|
|
|
5485
5489
|
upstream: buildUpstreamFailure
|
|
5486
5490
|
};
|
|
5487
5491
|
function describeLocalRunFailure(message, rawError) {
|
|
5492
|
+
if (rawError && typeof rawError === "object" && "code" in rawError && rawError.code === "PLATFORM_STREAM_INTERRUPTED") {
|
|
5493
|
+
return "[nolo] The platform LLM stream was interrupted before the turn completed. Your conversation was preserved. Send another message to continue.\n";
|
|
5494
|
+
}
|
|
5488
5495
|
if (isClientVersionTooOldFailure(message, rawError)) {
|
|
5489
5496
|
return describeClientVersionTooOldFailure(message, rawError);
|
|
5490
5497
|
}
|
|
@@ -5515,6 +5522,26 @@ function describeLocalRunFailure(message, rawError) {
|
|
|
5515
5522
|
balanceDetails.current
|
|
5516
5523
|
) : extractEmbeddedErrorMessage(cleanedMessage) ?? fallback;
|
|
5517
5524
|
return `[nolo] ${shownMessage}
|
|
5525
|
+
`;
|
|
5526
|
+
}
|
|
5527
|
+
if (isCliAuthorityBrokerTimeoutError(rawError) || /CLI authority broker .* timed out/i.test(message)) {
|
|
5528
|
+
const cleaned = stripDebugNoise(message);
|
|
5529
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} The local authority broker timed out and did not respond in time (an existing broker process may be unresponsive). Check the local broker process or retry, ${SERVER_FALLBACK_HINT}.
|
|
5530
|
+
`;
|
|
5531
|
+
}
|
|
5532
|
+
if (/CLI authority broker could not attach or take ownership/i.test(message)) {
|
|
5533
|
+
const cleaned = stripDebugNoise(message);
|
|
5534
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} The local runtime could not attach to an existing broker or take database ownership. Check running broker processes holding the local authority store or retry, ${SERVER_FALLBACK_HINT}.
|
|
5535
|
+
`;
|
|
5536
|
+
}
|
|
5537
|
+
if (isCliAuthorityBrokerUnavailableError(rawError) || /CLI authority broker unavailable at/i.test(message)) {
|
|
5538
|
+
const cleaned = stripDebugNoise(message);
|
|
5539
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} The local authority broker is unavailable. Start or restart the local authority broker and retry, ${SERVER_FALLBACK_HINT}.
|
|
5540
|
+
`;
|
|
5541
|
+
}
|
|
5542
|
+
if (isCliAuthorityBrokerProtocolError(rawError) || /CLI authority broker protocol|CLI authority broker .* returned malformed response/i.test(message)) {
|
|
5543
|
+
const cleaned = stripDebugNoise(message);
|
|
5544
|
+
return `${RUN_UNAVAILABLE_PREFIX} (${cleaned}). ${NO_FALLBACK} The local authority broker returned a protocol or malformed response error. Check the running broker process and retry, ${SERVER_FALLBACK_HINT}.
|
|
5518
5545
|
`;
|
|
5519
5546
|
}
|
|
5520
5547
|
const cls = classifyLocalRunError(message);
|
|
@@ -5559,7 +5586,7 @@ function shouldAttemptAutoLocal(options) {
|
|
|
5559
5586
|
if (options.env.NOLO_DISABLE_CLI_WORKSPACE_TOOLS !== "1" && isBuiltinNoloAgentRef(options.agentKey) && resolveAuthToken2(options.env)) {
|
|
5560
5587
|
return true;
|
|
5561
5588
|
}
|
|
5562
|
-
if (options.env.NOLO_DISABLE_CLI_WORKSPACE_TOOLS !== "1" && resolveAuthToken2(options.env)
|
|
5589
|
+
if (options.env.NOLO_DISABLE_CLI_WORKSPACE_TOOLS !== "1" && resolveAuthToken2(options.env)) {
|
|
5563
5590
|
return true;
|
|
5564
5591
|
}
|
|
5565
5592
|
return Boolean(
|
|
@@ -5601,9 +5628,6 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
5601
5628
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
5602
5629
|
const clientVersionHeader = resolveClientVersion(options.env ?? {});
|
|
5603
5630
|
const subjectRefs = buildSubjectRefs(options);
|
|
5604
|
-
const allowedChildAgentKeys = options.allowedChildAgentKeys?.filter(
|
|
5605
|
-
(key) => key.trim()
|
|
5606
|
-
);
|
|
5607
5631
|
const allowedToolNames = options.allowedToolNames?.filter(
|
|
5608
5632
|
(name) => name.trim()
|
|
5609
5633
|
);
|
|
@@ -5627,9 +5651,8 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
5627
5651
|
capabilities: ["text-io", "streaming", "slash-commands"],
|
|
5628
5652
|
...options.dialogAgentMode ? { dialogAgentMode: options.dialogAgentMode } : {},
|
|
5629
5653
|
...subjectRefs ? { subjectRefs } : {},
|
|
5630
|
-
...
|
|
5631
|
-
...
|
|
5632
|
-
...allowedToolNames?.length ? { allowedToolNames } : {}
|
|
5654
|
+
...blockedToolNames !== void 0 ? { blockedToolNames } : {},
|
|
5655
|
+
...allowedToolNames !== void 0 ? { allowedToolNames } : {}
|
|
5633
5656
|
},
|
|
5634
5657
|
...options.continueDialogId ? { continueDialogId: options.continueDialogId } : {},
|
|
5635
5658
|
...options.spaceId ? { spaceId: options.spaceId } : {},
|
|
@@ -5785,21 +5808,17 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
5785
5808
|
return { exitCode: 1 };
|
|
5786
5809
|
}
|
|
5787
5810
|
const subjectRefs = buildSubjectRefs(options);
|
|
5788
|
-
const allowedChildAgentKeys = options.allowedChildAgentKeys?.filter(
|
|
5789
|
-
(key) => key.trim()
|
|
5790
|
-
);
|
|
5791
5811
|
const allowedToolNames = options.allowedToolNames?.filter(
|
|
5792
5812
|
(name) => name.trim()
|
|
5793
5813
|
);
|
|
5794
5814
|
const blockedToolNames = options.blockedToolNames?.filter(
|
|
5795
5815
|
(name) => name.trim()
|
|
5796
5816
|
);
|
|
5797
|
-
const runtimeContext = subjectRefs ||
|
|
5817
|
+
const runtimeContext = subjectRefs || allowedToolNames !== void 0 || blockedToolNames !== void 0 || options.parentWakeOnTerminal || options.dialogAgentMode ? {
|
|
5798
5818
|
...subjectRefs ? { subjectRefs } : {},
|
|
5799
5819
|
...options.dialogAgentMode ? { dialogAgentMode: options.dialogAgentMode } : {},
|
|
5800
|
-
...
|
|
5801
|
-
...
|
|
5802
|
-
...blockedToolNames?.length ? { blockedToolNames } : {},
|
|
5820
|
+
...allowedToolNames !== void 0 ? { allowedToolNames } : {},
|
|
5821
|
+
...blockedToolNames !== void 0 ? { blockedToolNames } : {},
|
|
5803
5822
|
...options.parentWakeOnTerminal ? { parentWakeOnTerminal: true } : {},
|
|
5804
5823
|
...options.parentDialogId ? { parentThreadId: options.parentDialogId } : {}
|
|
5805
5824
|
} : void 0;
|
|
@@ -5839,6 +5858,8 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
5839
5858
|
category: options.category,
|
|
5840
5859
|
inheritedFromDialogKey: options.inheritedFromDialogKey,
|
|
5841
5860
|
parentDialogId: options.parentDialogId,
|
|
5861
|
+
runtimeContext,
|
|
5862
|
+
runKind: options.env.NOLO_AGENT_RUN_CHILD === "1" ? "subtask" : "interactive",
|
|
5842
5863
|
background: options.background,
|
|
5843
5864
|
noStream: options.noStream,
|
|
5844
5865
|
...runtimeContext ? { runtimeContext } : {},
|
|
@@ -5851,7 +5872,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
5851
5872
|
}
|
|
5852
5873
|
if (event.kind === "image-downgraded") {
|
|
5853
5874
|
options.output.write(
|
|
5854
|
-
"[nolo] \u5F53\u524D agent \u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\
|
|
5875
|
+
"[nolo] \u5F53\u524D agent \u88AB\u914D\u7F6E\u4E3A\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u56FE\u7247\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\u8BF7\u68C0\u67E5\u6A21\u578B\u7684\u56FE\u7247\u80FD\u529B\u914D\u7F6E\uFF0C\u6216\u7528 /switch \u9009\u62E9\u652F\u6301\u56FE\u7247\u7684 agent \u540E\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002\n"
|
|
5855
5876
|
);
|
|
5856
5877
|
}
|
|
5857
5878
|
if (event.kind === "compaction") {
|
|
@@ -5948,7 +5969,13 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
5948
5969
|
}
|
|
5949
5970
|
if (!config || typeof config !== "object") return null;
|
|
5950
5971
|
const baseRecord = config.rawRecord ?? config;
|
|
5951
|
-
|
|
5972
|
+
let credentialKey = resolveCredentialKeyWithFallback(baseRecord);
|
|
5973
|
+
if (credentialKey && resolveOAuthChannelOwnerSkip(
|
|
5974
|
+
config,
|
|
5975
|
+
options
|
|
5976
|
+
)) {
|
|
5977
|
+
credentialKey = void 0;
|
|
5978
|
+
}
|
|
5952
5979
|
const agentLevelAt = baseRecord.nextAvailableAt;
|
|
5953
5980
|
const agentLevelNextAvailableAt = typeof agentLevelAt === "number" && Number.isFinite(agentLevelAt) ? agentLevelAt : void 0;
|
|
5954
5981
|
if (!credentialKey && agentLevelNextAvailableAt === void 0) return null;
|
|
@@ -6084,6 +6111,63 @@ function readAgentsMdLayerFromDisk(cwd) {
|
|
|
6084
6111
|
return null;
|
|
6085
6112
|
}
|
|
6086
6113
|
|
|
6114
|
+
// packages/cli/agentRunDoD.ts
|
|
6115
|
+
import { spawnSync as nodeSpawnSync } from "node:child_process";
|
|
6116
|
+
var DOD_COMMAND_TIMEOUT_MS = 12e4;
|
|
6117
|
+
function extractTailLines(text, count) {
|
|
6118
|
+
if (!text) return [];
|
|
6119
|
+
const lines = String(text).split("\n");
|
|
6120
|
+
while (lines.length > 0 && lines[lines.length - 1].trim() === "") lines.pop();
|
|
6121
|
+
return lines.slice(-count);
|
|
6122
|
+
}
|
|
6123
|
+
function executeDoDCommand(cmd, cwd, deps = {}) {
|
|
6124
|
+
const spawnSync = deps.spawnSync ?? nodeSpawnSync;
|
|
6125
|
+
try {
|
|
6126
|
+
const res = spawnSync(cmd, {
|
|
6127
|
+
shell: true,
|
|
6128
|
+
cwd: cwd || process.cwd(),
|
|
6129
|
+
timeout: DOD_COMMAND_TIMEOUT_MS,
|
|
6130
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
6131
|
+
encoding: "utf8"
|
|
6132
|
+
});
|
|
6133
|
+
if (res.error) {
|
|
6134
|
+
const errCode = res.error.code;
|
|
6135
|
+
const timedOut = errCode === "ETIMEDOUT" || res.signal === "SIGTERM" || res.signal === "SIGKILL";
|
|
6136
|
+
return {
|
|
6137
|
+
command: cmd,
|
|
6138
|
+
exitCode: timedOut ? "timeout" : "error",
|
|
6139
|
+
stdoutTail: extractTailLines(res.stdout, 20),
|
|
6140
|
+
stderrTail: extractTailLines(res.stderr || res.error.message, 10)
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
if (res.status === null && (res.signal === "SIGTERM" || res.signal === "SIGKILL")) {
|
|
6144
|
+
return {
|
|
6145
|
+
command: cmd,
|
|
6146
|
+
exitCode: "timeout",
|
|
6147
|
+
stdoutTail: extractTailLines(res.stdout, 20),
|
|
6148
|
+
stderrTail: extractTailLines(res.stderr, 10)
|
|
6149
|
+
};
|
|
6150
|
+
}
|
|
6151
|
+
return {
|
|
6152
|
+
command: cmd,
|
|
6153
|
+
exitCode: typeof res.status === "number" ? res.status : "error",
|
|
6154
|
+
stdoutTail: extractTailLines(res.stdout, 20),
|
|
6155
|
+
stderrTail: extractTailLines(res.stderr, 10)
|
|
6156
|
+
};
|
|
6157
|
+
} catch (err) {
|
|
6158
|
+
return {
|
|
6159
|
+
command: cmd,
|
|
6160
|
+
exitCode: "error",
|
|
6161
|
+
stdoutTail: [],
|
|
6162
|
+
stderrTail: extractTailLines(err instanceof Error ? err.message : String(err), 10)
|
|
6163
|
+
};
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
function runDoDCommands(commands, cwd, deps = {}) {
|
|
6167
|
+
if (!commands || commands.length === 0) return void 0;
|
|
6168
|
+
return commands.map((cmd) => executeDoDCommand(cmd, cwd, deps));
|
|
6169
|
+
}
|
|
6170
|
+
|
|
6087
6171
|
// packages/cli/agentRunPrompts.ts
|
|
6088
6172
|
import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync, statSync } from "node:fs";
|
|
6089
6173
|
import { dirname, extname, isAbsolute, join as join2, relative as relativePath, resolve, sep } from "node:path";
|
|
@@ -6352,14 +6436,16 @@ ${args.inspection.status.trim()}`] : [],
|
|
|
6352
6436
|
}
|
|
6353
6437
|
|
|
6354
6438
|
// packages/ai/memory/storeShared.ts
|
|
6439
|
+
var retrievalCountOf = (item) => item.activationCount ?? 0;
|
|
6355
6440
|
var touchMemoryItemsInDb = async (db, items, now = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
6356
6441
|
if (items.length === 0) return;
|
|
6357
6442
|
const batch = db.batch();
|
|
6358
6443
|
for (const item of items) {
|
|
6359
6444
|
batch.put(createMemoryKey(item.ownerType, item.ownerId, item.id), {
|
|
6360
6445
|
...item,
|
|
6446
|
+
// retrieval bookkeeping on legacy storage names — see doc comment above
|
|
6361
6447
|
lastActivatedAt: now,
|
|
6362
|
-
activationCount: (item
|
|
6448
|
+
activationCount: retrievalCountOf(item) + 1
|
|
6363
6449
|
});
|
|
6364
6450
|
}
|
|
6365
6451
|
await batch.write();
|
|
@@ -6588,27 +6674,27 @@ var identifierScore = (query, item) => {
|
|
|
6588
6674
|
return matches / identifiers.length;
|
|
6589
6675
|
};
|
|
6590
6676
|
var DAY_MS = 864e5;
|
|
6591
|
-
var
|
|
6592
|
-
var
|
|
6593
|
-
var
|
|
6594
|
-
var
|
|
6595
|
-
const
|
|
6596
|
-
const ageDays = Math.max(0, (nowMs -
|
|
6677
|
+
var UNRETRIEVED_MEMORY_GRACE_DAYS = 3;
|
|
6678
|
+
var MIN_UNRETRIEVED_SCORE_FACTOR = 0.3;
|
|
6679
|
+
var UNRETRIEVED_DECAY_HALF_LIFE_DAYS = 7;
|
|
6680
|
+
var retrievalFrequencyScore = (item, nowMs) => {
|
|
6681
|
+
const lastRetrievedMs = Date.parse(item.lastActivatedAt || item.createdAt);
|
|
6682
|
+
const ageDays = Math.max(0, (nowMs - lastRetrievedMs) / DAY_MS);
|
|
6597
6683
|
const recency = 1 / (1 + ageDays / 7);
|
|
6598
|
-
const
|
|
6599
|
-
return 0.7 * recency + 0.3 *
|
|
6684
|
+
const frequency = Math.min(1, Math.log1p(item.activationCount ?? 0) / 3);
|
|
6685
|
+
return 0.7 * recency + 0.3 * frequency;
|
|
6600
6686
|
};
|
|
6601
|
-
var
|
|
6687
|
+
var unretrievedDecayFactor = (item, nowMs) => {
|
|
6602
6688
|
if ((item.activationCount ?? 0) !== 0) return 1;
|
|
6603
6689
|
const createdAgeDays = Math.max(0, (nowMs - Date.parse(item.createdAt)) / DAY_MS);
|
|
6604
|
-
if (createdAgeDays <=
|
|
6605
|
-
const overdue = createdAgeDays -
|
|
6690
|
+
if (createdAgeDays <= UNRETRIEVED_MEMORY_GRACE_DAYS) return 1;
|
|
6691
|
+
const overdue = createdAgeDays - UNRETRIEVED_MEMORY_GRACE_DAYS;
|
|
6606
6692
|
return Math.max(
|
|
6607
|
-
|
|
6608
|
-
1 / (1 + overdue /
|
|
6693
|
+
MIN_UNRETRIEVED_SCORE_FACTOR,
|
|
6694
|
+
1 / (1 + overdue / UNRETRIEVED_DECAY_HALF_LIFE_DAYS)
|
|
6609
6695
|
);
|
|
6610
6696
|
};
|
|
6611
|
-
var
|
|
6697
|
+
var retrievalScore = (item, nowMs) => retrievalFrequencyScore(item, nowMs) * unretrievedDecayFactor(item, nowMs);
|
|
6612
6698
|
var creationRecencyScore = (item, nowMs) => {
|
|
6613
6699
|
const createdMs = Date.parse(item.createdAt);
|
|
6614
6700
|
const ageDays = Math.max(0, (nowMs - createdMs) / 864e5);
|
|
@@ -6640,14 +6726,15 @@ var pathScore = (item, context) => {
|
|
|
6640
6726
|
var scoreMemoryItem = (item, query, nowMs = Date.now(), context) => {
|
|
6641
6727
|
const queryMatch = keywordScore(query, item);
|
|
6642
6728
|
const identifierMatch = identifierScore(query, item);
|
|
6643
|
-
const
|
|
6729
|
+
const retrieval = retrievalScore(item, nowMs);
|
|
6644
6730
|
const createdRecency = creationRecencyScore(item, nowMs);
|
|
6645
6731
|
const importance = item.importance ?? 0;
|
|
6646
6732
|
const confidence = item.confidence ?? 0;
|
|
6647
6733
|
const typeFit = typeFitScore(item);
|
|
6648
6734
|
const understanding = understandingScore(item);
|
|
6649
6735
|
const path = pathScore(item, context);
|
|
6650
|
-
return 0.25 * queryMatch + 0.2 * identifierMatch + 0.2 * path + 0.09 *
|
|
6736
|
+
return 0.25 * queryMatch + 0.2 * identifierMatch + 0.2 * path + 0.09 * retrieval + // weak retrieval signal, NOT successful-use reinforcement
|
|
6737
|
+
0.16 * createdRecency + 0.06 * importance + 0.03 * confidence + 0.02 * typeFit + 0.01 * understanding;
|
|
6651
6738
|
};
|
|
6652
6739
|
var rankMemoryCandidates = (items, query, context) => {
|
|
6653
6740
|
const nowMs = Date.now();
|
|
@@ -6665,6 +6752,8 @@ var rankMemoryCandidates = (items, query, context) => {
|
|
|
6665
6752
|
// packages/ai/memory/runtime.ts
|
|
6666
6753
|
var COLD_STORAGE_CONFIDENCE = 0.3;
|
|
6667
6754
|
var MEMORY_OVERLAY_TOKEN_BUDGET = DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
|
|
6755
|
+
var DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT = 20;
|
|
6756
|
+
var CORROBORATED_PROCEDURAL_RESERVE = 5;
|
|
6668
6757
|
var normalizeSelectedContent = (text) => text.trim().replace(EXPLICIT_REMEMBER_PREFIX_REGEX, "").replace(/[。!?!?]+$/u, "").trim();
|
|
6669
6758
|
var STACK_TERMS = [
|
|
6670
6759
|
"typescript",
|
|
@@ -6792,8 +6881,9 @@ var resolveMemoryRuntime = async (input) => {
|
|
|
6792
6881
|
policy
|
|
6793
6882
|
}),
|
|
6794
6883
|
kinds: ["episodic", "semantic", "procedural"],
|
|
6795
|
-
ownerLimit:
|
|
6796
|
-
ownerFallback: policy.ownerFallback
|
|
6884
|
+
ownerLimit: input.ownerLimit ?? DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT,
|
|
6885
|
+
ownerFallback: policy.ownerFallback,
|
|
6886
|
+
corroboratedProceduralReserve: input.corroboratedProceduralReserve ?? CORROBORATED_PROCEDURAL_RESERVE
|
|
6797
6887
|
});
|
|
6798
6888
|
const rankContext = {
|
|
6799
6889
|
currentOwner: input.spaceId ? { ownerType: "space", ownerId: input.spaceId } : input.userId ? { ownerType: "user", ownerId: input.userId } : null,
|
|
@@ -6981,16 +7071,18 @@ async function runAgentRunCommand(args, deps) {
|
|
|
6981
7071
|
} catch {
|
|
6982
7072
|
}
|
|
6983
7073
|
};
|
|
6984
|
-
const finalizeWatchdogOutcome = (outcome, note) => {
|
|
7074
|
+
const finalizeWatchdogOutcome = async (outcome, note) => {
|
|
6985
7075
|
if (!hasRegistry) return;
|
|
6986
|
-
|
|
7076
|
+
await settleRunTerminalAuthoritatively(
|
|
6987
7077
|
childRunId,
|
|
6988
7078
|
{ status: outcome.status, exitCode: outcome.exitCode, note },
|
|
6989
|
-
{ env, homedir: deps.homedir, fs: deps.fs, now: deps.now }
|
|
7079
|
+
{ env, homedir: deps.homedir, fs: deps.fs, now: deps.now, sleep: deps.sleep },
|
|
7080
|
+
// Test seam: stubbed transitions keep their single-attempt semantics.
|
|
7081
|
+
deps.transitionRunToTerminal
|
|
6990
7082
|
);
|
|
6991
7083
|
};
|
|
6992
7084
|
if (armStallWatchdog) {
|
|
6993
|
-
stallTimer = setInterval(() => {
|
|
7085
|
+
stallTimer = setInterval(async () => {
|
|
6994
7086
|
if (timedOut || stalled) return;
|
|
6995
7087
|
const activity = activityTracker?.getActivity();
|
|
6996
7088
|
const lastEventAtMs = activity ? new Date(activity.lastEventAt).getTime() : nowMs();
|
|
@@ -7008,21 +7100,21 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7008
7100
|
output.write(`[nolo] local run ${note}
|
|
7009
7101
|
`);
|
|
7010
7102
|
const outcome = resolveRunOutcome({ kind: "stall" });
|
|
7011
|
-
finalizeWatchdogOutcome(outcome, note);
|
|
7103
|
+
await finalizeWatchdogOutcome(outcome, note);
|
|
7012
7104
|
rejectOnWatchdogFailure?.(new Error(`[nolo] local run ${note}`));
|
|
7013
7105
|
exitFromWatchdog(outcome.exitCode);
|
|
7014
7106
|
}
|
|
7015
7107
|
}, Math.min(stallTimeoutMs, 1e4));
|
|
7016
7108
|
}
|
|
7017
7109
|
if (armTimeoutWatchdog) {
|
|
7018
|
-
timeoutTimer = setTimeout(() => {
|
|
7110
|
+
timeoutTimer = setTimeout(async () => {
|
|
7019
7111
|
timedOut = true;
|
|
7020
7112
|
clearWatchdogs();
|
|
7021
7113
|
const note = `timed out after ${parsed.timeoutMs}ms`;
|
|
7022
7114
|
output.write(`[nolo] local run ${note}
|
|
7023
7115
|
`);
|
|
7024
7116
|
const outcome = resolveRunOutcome({ kind: "timeout" });
|
|
7025
|
-
finalizeWatchdogOutcome(outcome, note);
|
|
7117
|
+
await finalizeWatchdogOutcome(outcome, note);
|
|
7026
7118
|
rejectOnWatchdogFailure?.(new Error(`[nolo] local run ${note}`));
|
|
7027
7119
|
exitFromWatchdog(outcome.exitCode);
|
|
7028
7120
|
}, parsed.timeoutMs);
|
|
@@ -7121,7 +7213,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7121
7213
|
(acc, tools) => acc.filter((t2) => tools.includes(t2))
|
|
7122
7214
|
);
|
|
7123
7215
|
if (skillAllowed.length === 0) {
|
|
7124
|
-
output.write(`[nolo] warning: attached skills declare incompatible allowed-tools;
|
|
7216
|
+
output.write(`[nolo] warning: attached skills declare incompatible allowed-tools; this run has no tools
|
|
7125
7217
|
`);
|
|
7126
7218
|
}
|
|
7127
7219
|
skillAllowedToolOverride = parsed.allowedToolNames?.length ? parsed.allowedToolNames.filter((t2) => skillAllowed.includes(t2)) : skillAllowed;
|
|
@@ -7242,7 +7334,6 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7242
7334
|
...parsed.parentWakeOnTerminal ? { parentWakeOnTerminal: true } : {},
|
|
7243
7335
|
...parsed.subjectDialogKey ? { subjectDialogKey: parsed.subjectDialogKey } : {},
|
|
7244
7336
|
...parsed.subjectRefs?.length ? { subjectRefs: parsed.subjectRefs } : {},
|
|
7245
|
-
...parsed.allowedChildAgentKeys?.length ? { allowedChildAgentKeys: parsed.allowedChildAgentKeys } : {},
|
|
7246
7337
|
...skillAllowedToolOverride !== void 0 ? { allowedToolNames: skillAllowedToolOverride } : parsed.allowedToolNames?.length ? { allowedToolNames: parsed.allowedToolNames } : {},
|
|
7247
7338
|
...parsed.blockedToolNames?.length ? { blockedToolNames: parsed.blockedToolNames } : {},
|
|
7248
7339
|
...activityTracker ? { onLoopEvent: activityTracker.onLoopEvent } : {},
|
|
@@ -7378,6 +7469,11 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7378
7469
|
}
|
|
7379
7470
|
}
|
|
7380
7471
|
if (typeof childRunId === "string" && childRunId.length > 0) {
|
|
7472
|
+
const childRecordForDoD = (deps.readRunRecord ?? readRunRecord)(childRunId, {
|
|
7473
|
+
env,
|
|
7474
|
+
homedir: deps.homedir,
|
|
7475
|
+
fs: deps.fs
|
|
7476
|
+
});
|
|
7381
7477
|
const isStalledOrTruncated = isRunResultStalledOrTruncated(result);
|
|
7382
7478
|
const truncationNote = resolveRunSettlementNote(result);
|
|
7383
7479
|
const outcome = resolveRunOutcome({
|
|
@@ -7385,12 +7481,22 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7385
7481
|
exitCode: result.exitCode,
|
|
7386
7482
|
isStalledOrTruncated
|
|
7387
7483
|
});
|
|
7388
|
-
|
|
7484
|
+
let dodResults;
|
|
7485
|
+
try {
|
|
7486
|
+
dodResults = (deps.runDoDCommands ?? runDoDCommands)(
|
|
7487
|
+
childRecordForDoD?.dodCommands,
|
|
7488
|
+
childRecordForDoD?.cwd
|
|
7489
|
+
);
|
|
7490
|
+
} catch (dodError) {
|
|
7491
|
+
console.warn(`[nolo] DoD verification failed to run for ${childRunId}:`, dodError);
|
|
7492
|
+
}
|
|
7493
|
+
await settleRunTerminalAuthoritatively(
|
|
7389
7494
|
childRunId,
|
|
7390
7495
|
{
|
|
7391
7496
|
status: outcome.status,
|
|
7392
7497
|
exitCode: outcome.exitCode,
|
|
7393
7498
|
dialogId: result.dialogId,
|
|
7499
|
+
...dodResults ? { dodResults } : {},
|
|
7394
7500
|
// run 级累计的平台积分(主轮 + fallback + drain 轮):dock 行据此显示
|
|
7395
7501
|
// 「⚡ x.xx」,让派发任务的消耗可见。undefined = 全程无平台计费。
|
|
7396
7502
|
...runCreditsTotal !== void 0 ? { credits: runCreditsTotal } : {},
|
|
@@ -7400,26 +7506,11 @@ async function runAgentRunCommand(args, deps) {
|
|
|
7400
7506
|
env,
|
|
7401
7507
|
homedir: deps.homedir,
|
|
7402
7508
|
fs: deps.fs,
|
|
7403
|
-
now: deps.now
|
|
7404
|
-
|
|
7509
|
+
now: deps.now,
|
|
7510
|
+
sleep: deps.sleep
|
|
7511
|
+
},
|
|
7512
|
+
deps.transitionRunToTerminal
|
|
7405
7513
|
);
|
|
7406
|
-
try {
|
|
7407
|
-
const record = (deps.readRunRecord ?? readRunRecord)(childRunId, {
|
|
7408
|
-
env,
|
|
7409
|
-
homedir: deps.homedir,
|
|
7410
|
-
fs: deps.fs
|
|
7411
|
-
});
|
|
7412
|
-
if (record) {
|
|
7413
|
-
await (deps.generateRunReport ?? generateRunReport)(record, {
|
|
7414
|
-
env,
|
|
7415
|
-
homedir: deps.homedir,
|
|
7416
|
-
fs: deps.fs,
|
|
7417
|
-
now: deps.now
|
|
7418
|
-
});
|
|
7419
|
-
}
|
|
7420
|
-
} catch (reportError) {
|
|
7421
|
-
console.warn(`[nolo] failed to generate run report for ${childRunId}:`, reportError);
|
|
7422
|
-
}
|
|
7423
7514
|
}
|
|
7424
7515
|
return result.exitCode;
|
|
7425
7516
|
}
|
|
@@ -7438,6 +7529,7 @@ function isBalanceExhaustedError(error) {
|
|
|
7438
7529
|
export {
|
|
7439
7530
|
resolveAgentModelIdentity,
|
|
7440
7531
|
resolveAgentContextWindow,
|
|
7532
|
+
platformCreditsFromUsage,
|
|
7441
7533
|
formatCreditsChip,
|
|
7442
7534
|
formatTokenCount,
|
|
7443
7535
|
renderTokenStatus,
|
|
@@ -7466,7 +7558,7 @@ export {
|
|
|
7466
7558
|
setActiveThemeMode,
|
|
7467
7559
|
setActiveBrightness,
|
|
7468
7560
|
detectSystemBrightnessFromEnv,
|
|
7469
|
-
|
|
7561
|
+
resolveTuiBrightnessSignal,
|
|
7470
7562
|
resolveTuiThemeMode,
|
|
7471
7563
|
resetWorkspaceThemeState,
|
|
7472
7564
|
applyDetectedBackground,
|