nolo-cli 0.226.0-alpha.1 → 0.227.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-UE2NJPZD.js → _executeModel-JKQGZ3HU.js} +60 -60
- package/accountResolver-EK2S4PWF.js +1 -1
- package/action-CK64LS6S.js +3 -3
- package/{addContentAction-EQXMFNPR.js → addContentAction-CARFID6E.js} +11 -11
- package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-APLZLFW5.js} +10 -10
- package/{agentDeleteCommand-SOI25WK7.js → agentDeleteCommand-NVR2V2HH.js} +86 -87
- package/{agentEmailCommands-UGWQQNKM.js → agentEmailCommands-UCVOWD3S.js} +86 -87
- package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-4PDOP3GW.js} +3 -3
- package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-FLCEXLUH.js} +4 -4
- package/{agentListCommands-YBNOQ5T3.js → agentListCommands-C65UESYM.js} +70 -57
- package/{agentMachineCommands-M6IKO7XE.js → agentMachineCommands-V3DGEJU4.js} +43 -43
- package/{agentProviderCommands-7BSJH7TO.js → agentProviderCommands-7QBFRFRK.js} +4 -4
- package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-E6JBGBVG.js} +3 -3
- package/{agentRecordCommands-3HL7Z4X6.js → agentRecordCommands-6RCJS2EY.js} +83 -84
- package/{agentRunCommand-C64A6MPL.js → agentRunCommand-P3GRKXKS.js} +86 -86
- package/{agentRunControl-DFEEOFC7.js → agentRunControl-SNZZ5XP4.js} +10 -10
- package/{agentRuntimeLocal-GSTYFEX4.js → agentRuntimeLocal-GOX2DIY7.js} +38 -38
- package/{agentSlice-7PTNWEED.js → agentSlice-N7H2FRJA.js} +15 -15
- package/{appDeleteCommands-L7HL4AWF.js → appDeleteCommands-LZDN26FU.js} +47 -47
- package/{appDeployCommands-SGSUNFZR.js → appDeployCommands-6IO6TTZH.js} +47 -47
- package/{appDeployStatusCommands-AAA3XD54.js → appDeployStatusCommands-FG3LX24J.js} +47 -47
- package/{appGetCommands-LN72GAOA.js → appGetCommands-NAKVDVD4.js} +47 -47
- package/{appListCommands-IJQQ3VND.js → appListCommands-KL56RN73.js} +47 -47
- package/{authCommand-7JXW54U4.js → authCommand-AUN5MXV2.js} +20 -20
- package/{authCommands-YDNAIDEY.js → authCommands-D2IPS6ES.js} +7 -7
- package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-UQGLKRYP.js} +5 -5
- package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-UJWN5HWH.js} +5 -5
- package/{chunk-3QFLXA24.js → chunk-2G3YSVO6.js} +1 -1
- package/{chunk-TUIWP2LF.js → chunk-2SKTCNWO.js} +2 -2
- package/{chunk-KNIIRXHF.js → chunk-3HTP4WZQ.js} +2 -2
- package/{chunk-2TIQO6TC.js → chunk-3VFYQH3I.js} +21 -170
- package/{chunk-AZQZ5XPM.js → chunk-4OKTPFNX.js} +27 -27
- package/{chunk-UYOICCYG.js → chunk-5HL4KC4A.js} +9 -9
- package/{chunk-2VA6TU4I.js → chunk-5LQDHFBN.js} +14 -14
- package/{chunk-QLFCTYRH.js → chunk-5RKRXQ2H.js} +2 -2
- package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-HYHIAM6T.js → chunk-7Z3WUZ4Q.js} +27 -24
- package/{chunk-X4OVEYPX.js → chunk-ABGULE7H.js} +13 -13
- package/{chunk-VQUWV3YR.js → chunk-AXYH4734.js} +12 -12
- package/{chunk-UEKXWO7A.js → chunk-C2B7M567.js} +4 -4
- package/{chunk-2ZKFCIJJ.js → chunk-CLCXHIBS.js} +1 -1
- package/{chunk-GBZ4YKEO.js → chunk-CQVGR3MX.js} +2 -2
- package/{chunk-KC4SCKXO.js → chunk-CVERLOJM.js} +51 -52
- package/{chunk-KN3HEZIQ.js → chunk-EVGU5P4U.js} +1 -1
- package/{chunk-QZI44GWV.js → chunk-F5AY2UZL.js} +145 -4
- package/{chunk-JIADJPUV.js → chunk-FKEZOMIF.js} +426 -2459
- package/{chunk-PVZY6P3S.js → chunk-G6HJUMST.js} +2 -2
- package/{chunk-TD6QCQ5G.js → chunk-GOLPOTG5.js} +3 -3
- package/{chunk-GVGOEMNV.js → chunk-GOQ6ZVTN.js} +1 -1
- package/{chunk-5NC6A2RZ.js → chunk-GRXSJR2Z.js} +19 -19
- package/{chunk-GGKNJ42M.js → chunk-GUVXQSFZ.js} +2 -2
- package/{chunk-UKS7D2NL.js → chunk-HYKGIXNO.js} +9 -9
- package/{chunk-GS4OTYCH.js → chunk-IAJJYHIB.js} +5 -5
- package/{chunk-SOF4OWDM.js → chunk-IC2I373Q.js} +3 -5
- package/{chunk-UJKTI5PG.js → chunk-ILHQ2AXT.js} +0 -1
- package/{chunk-VV7TXWOC.js → chunk-IX2BXN2K.js} +3 -3
- package/{chunk-FS3RA7D2.js → chunk-JHF6VLVL.js} +29 -29
- package/{chunk-DISQCYPE.js → chunk-KJAAPGBE.js} +1 -1
- package/{chunk-N5PQJKCY.js → chunk-KMRKZNGT.js} +5 -5
- package/{chunk-GNHMRBYZ.js → chunk-KRRE4A7D.js} +3 -3
- package/{chunk-6J4TTPS2.js → chunk-L42CBKBZ.js} +4 -4
- package/{chunk-4PMZVBDU.js → chunk-LA7JYAKF.js} +3 -3
- package/{chunk-X7YC2OHB.js → chunk-LXTC53TN.js} +84 -72
- package/{chunk-67BE44IS.js → chunk-M3Y4IBIR.js} +4 -4
- package/{chunk-GIABSSWQ.js → chunk-MWHOH4RJ.js} +1 -1
- package/{chunk-3KNEE64G.js → chunk-NAOO4PVX.js} +16 -16
- package/{chunk-MOMR7NMG.js → chunk-NO3VBWTL.js} +1 -1
- package/{chunk-YDBMZ7FV.js → chunk-OXA5GWHU.js} +2 -2
- package/{chunk-FTQWYWUI.js → chunk-PHOSZT3E.js} +1 -1
- package/{chunk-C4WTX5TU.js → chunk-PLPLH2XZ.js} +1 -1
- package/{chunk-HJAO2NAL.js → chunk-PVAWNHP5.js} +52 -52
- package/{chunk-652XYZGP.js → chunk-PXKF5CV4.js} +9 -4
- package/{chunk-ZH6MUQEO.js → chunk-RU6DULV4.js} +1 -1
- package/{chunk-JVRQ6YVK.js → chunk-S6K5F3KP.js} +1 -1
- package/{chunk-AVHRSJUH.js → chunk-SFTTXGPM.js} +10 -10
- package/{chunk-4HFTBHBF.js → chunk-SRG5CNLC.js} +4 -4
- package/{chunk-ZZ4M2I3R.js → chunk-SW6OD4KE.js} +6 -6
- package/{chunk-TXGQ4O5S.js → chunk-T43K75CK.js} +13 -13
- package/{chunk-KZU52OJ5.js → chunk-T5N6NHAT.js} +6 -6
- package/{chunk-CVS5IMJ5.js → chunk-TINJKQSO.js} +11 -11
- package/{chunk-JM5C4EUA.js → chunk-TOKPHZ55.js} +1 -1
- package/{chunk-GSAS72AN.js → chunk-UAPNPNSG.js} +892 -625
- package/{chunk-BGGHA5DV.js → chunk-UCFPVYP7.js} +1 -1
- package/{chunk-SOG7OEXX.js → chunk-ULAQPRHX.js} +1 -1
- package/{chunk-SBVTHMEG.js → chunk-UN7HIYMH.js} +1 -1
- package/{chunk-GOAPXKQU.js → chunk-UVUVQVZ6.js} +4 -4
- package/{chunk-VTW7VKZX.js → chunk-VIHDJ3FK.js} +5 -5
- package/{chunk-EWPDMS4N.js → chunk-VPAZ6BEN.js} +1 -1
- package/{chunk-XN23AUVU.js → chunk-VZW34YUL.js} +3 -3
- package/{chunk-D726I5AZ.js → chunk-WJP4TH6U.js} +1 -1
- package/{chunk-EOWLBDY6.js → chunk-X2KRQP7V.js} +1 -1
- package/{chunk-F7DU25CE.js → chunk-XIEYGCN6.js} +4 -10
- package/{chunk-KOXKKHFE.js → chunk-XZODOEKU.js} +1 -1
- package/{chunk-QVBXJNZ2.js → chunk-YGILMZ7N.js} +1 -1
- package/{chunk-C4VAR65S.js → chunk-YOT437BH.js} +5 -5
- package/{chunk-VFBVA3U2.js → chunk-YPPKC6FL.js} +2 -2
- package/{chunk-LM2PS3YS.js → chunk-YQETUZ5V.js} +5 -5
- package/{chunk-OWH2BLNU.js → chunk-ZADGPNTV.js} +24 -24
- package/{chunk-BRW24CTE.js → chunk-ZI5SZ3MV.js} +11 -11
- package/{chunk-EVPIBQ5I.js → chunk-ZYA2YDB6.js} +18 -18
- package/{cliAgentConfigHelpers-KICKKNYQ.js → cliAgentConfigHelpers-QVSQYTKC.js} +10 -10
- package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-D6HMC46Z.js} +2 -2
- package/{cliLocalAgentRecordReader-6FXGFBI3.js → cliLocalAgentRecordReader-SPKAJYME.js} +45 -45
- package/{commandRegistry-XSMTI5PG.js → commandRegistry-TKR6OWXP.js} +91 -91
- package/{contentThunks-S4NNC7R2.js → contentThunks-BQWRPCTM.js} +29 -29
- package/{createAgentAutomationAction-TH7ZEACJ.js → createAgentAutomationAction-GFI6SJZV.js} +32 -32
- package/{createDialogAction-SYZAYIIQ.js → createDialogAction-MMBIHFFU.js} +30 -30
- package/{createPageAction-7Y4U6TXO.js → createPageAction-EEYUE5FB.js} +32 -32
- package/{dbSlice-ZJPDIFER.js → dbSlice-X4Z4E4QU.js} +10 -10
- package/{deleteFile-Q3YDB4ML.js → deleteFile-QOOP2UK7.js} +5 -5
- package/{dialogCommands-V5IYEOQP.js → dialogCommands-OXBQ73DD.js} +48 -48
- package/{dialogNotifyCommand-77B57PL6.js → dialogNotifyCommand-VWS5G4OO.js} +13 -13
- package/{dialogSlice-O3RHDAWK.js → dialogSlice-KGYIABDY.js} +27 -27
- package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-FEWCN7IA.js} +6 -6
- package/{docCreateCommands-36WS33BK.js → docCreateCommands-LS32VKY3.js} +47 -47
- package/{docDeleteCommands-C4CS4XLF.js → docDeleteCommands-JTYR5RPH.js} +48 -48
- package/{docReadCommands-QZMSFMPN.js → docReadCommands-E5LTVKWN.js} +47 -47
- package/{docStore-PYNEODAH.js → docStore-TVS2FNER.js} +12 -12
- package/{docUpdateCommands-BYI64HVV.js → docUpdateCommands-I3J3JDZ2.js} +47 -47
- package/{fetchMessages-TQEUZD7H.js → fetchMessages-Q3INLN5F.js} +2 -2
- package/getPricing-VNGFM4PN.js +2 -2
- package/{handleSendMessageAction-Z43FP2E2.js → handleSendMessageAction-SSON36TJ.js} +54 -54
- package/{hostCredentialCreate-Y7YIGKP4.js → hostCredentialCreate-WTW4THJF.js} +83 -84
- package/index.js +12 -12
- package/{localDialogRead-SVTPA5GY.js → localDialogRead-V36DX2Q2.js} +1 -1
- package/{localRuntimeAdapter-ZLJONQZS.js → localRuntimeAdapter-MI2JGXSF.js} +83 -84
- package/{machineCommands-4ZLMRIA3.js → machineCommands-3LROJZDK.js} +86 -87
- package/{machineWsRunDispatch-L7Z3ULDF.js → machineWsRunDispatch-BUUJRUUB.js} +82 -83
- package/{memberThunks-JRYNONYV.js → memberThunks-CFEPHAND.js} +14 -14
- package/{memoryCommands-5WC3T66U.js → memoryCommands-JQMEJO7J.js} +3 -3
- package/package.json +1 -1
- package/{projectArchive-JBX6HNK6.js → projectArchive-3X54XFVN.js} +32 -32
- package/{providerPresetApply-J3WMRPD2.js → providerPresetApply-FO36N5TX.js} +5 -5
- package/{providerRegistry-KJGB5XWS.js → providerRegistry-U2BSFE6K.js} +5 -5
- package/{read-Q7GOHGNP.js → read-KA3L2V7O.js} +6 -6
- package/{readDocTool-Z5OQ6422.js → readDocTool-AMAZAPAW.js} +1 -1
- package/{readlineWorkspace-WFPIAAAT.js → readlineWorkspace-Z3YUH4SX.js} +599 -1264
- package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-JQOJSUM7.js} +12 -12
- package/{runAgentClientLoop-STI5TKDJ.js → runAgentClientLoop-4FCFLMDJ.js} +63 -59
- package/{runtimeDoctorCommands-UXKXYBW6.js → runtimeDoctorCommands-CXOCVDPU.js} +5 -5
- package/{secretCommands-LJXOOYA7.js → secretCommands-GGUAWAE7.js} +3 -3
- package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-YXQTGXIN.js} +11 -11
- package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-YNLB66WE.js} +12 -12
- package/{settingThunks-AXTBX3Q5.js → settingThunks-E6N7RSSS.js} +16 -16
- package/{spaceCommands-GUKMDRWN.js → spaceCommands-DB5DKC2J.js} +43 -43
- package/{streamAgentChatTurn-A2WL5OOF.js → streamAgentChatTurn-FCBGMD4D.js} +84 -123
- package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-LAHLUECU.js} +10 -10
- package/{tools-6NU5E6BN.js → tools-6JD36D6K.js} +49 -49
- package/{tuiSummaryLlmCaller-7WLUKNP2.js → tuiSummaryLlmCaller-UHZIPGAX.js} +14 -14
- package/{updateCommands-RJVCRSBP.js → updateCommands-KZ54HCU5.js} +6 -6
- package/{updateDialogTitleAction-VMKU2Y67.js → updateDialogTitleAction-RV3EUEN3.js} +32 -32
- package/{usageCommand-YPJ2ZI2F.js → usageCommand-KFVV6UL3.js} +1 -1
- package/{usageRebuildCommand-FERQO74C.js → usageRebuildCommand-HHFSNK46.js} +2 -2
- package/{chunk-4NA3YTBC.js → chunk-6EDAMVG6.js} +6 -6
- package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
- package/{chunk-2VUZSVAS.js → chunk-CSW7IPVD.js} +9 -9
- package/{chunk-KEN3N2TN.js → chunk-HVUDBOQG.js} +7 -7
- package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
- package/{chunk-47ITIXO7.js → chunk-SSGTV4FC.js} +3 -3
- package/{chunk-IZIN2UNJ.js → chunk-T2BEPTAG.js} +6 -6
- package/{chunk-HXER7YJF.js → chunk-VXL2FZTP.js} +3 -3
- package/{chunk-2THCNKE4.js → chunk-WACI5I6V.js} +3 -3
- package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-FZYQOWI5.js} +1 -1
- package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-AGA2X5E4.js} +6 -6
- package/{tableCommands-HITDSLHS.js → tableCommands-VNSXHAMG.js} +9 -9
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findPotentialSecrets
|
|
3
|
+
} from "./chunk-6QDYSCPW.js";
|
|
1
4
|
import {
|
|
2
5
|
parsePositiveFiniteNumberOrFallback
|
|
3
6
|
} from "./chunk-Y5GCAMGP.js";
|
|
@@ -6,19 +9,11 @@ import {
|
|
|
6
9
|
} from "./chunk-YFLVRVYK.js";
|
|
7
10
|
import {
|
|
8
11
|
INSTABOX_RUN_CONFIG_ENV,
|
|
9
|
-
attachLocalCommandObservations,
|
|
10
12
|
buildLocalRunEnv,
|
|
11
|
-
captureLocalRunBase,
|
|
12
|
-
collectHostTaskPlannedWorkspace,
|
|
13
|
-
collectHostTaskWorkspace,
|
|
14
13
|
createCliLocalRuntimeAdapter,
|
|
15
|
-
createHostAuthorExecution,
|
|
16
14
|
detectCurrentMachineId,
|
|
17
|
-
formatLocalRunSummary,
|
|
18
15
|
getOrCreateSharedStore,
|
|
19
16
|
hashInstaboxDeliveryManifest,
|
|
20
|
-
hostTaskEventsRoot,
|
|
21
|
-
inspectLocalRunWorkspace,
|
|
22
17
|
isCliProviderAgentConfig,
|
|
23
18
|
isDockerRuntimeKey,
|
|
24
19
|
isFullstackCodingAgentRef,
|
|
@@ -26,30 +21,17 @@ import {
|
|
|
26
21
|
isLiveAgentRunObservation,
|
|
27
22
|
isMachineBoundLocalhostCustomProvider,
|
|
28
23
|
isSubtaskRun,
|
|
29
|
-
matchesHostReviewDispatch,
|
|
30
|
-
observeLocalCommandResult,
|
|
31
24
|
parseAgentRunArgs,
|
|
32
25
|
parseAgentRunEvent,
|
|
33
26
|
readFlagValue,
|
|
34
|
-
readHostTask,
|
|
35
|
-
readHostTaskAcceptancePlan,
|
|
36
|
-
redactSecrets,
|
|
37
27
|
resolveAuthToken as resolveAuthToken2,
|
|
38
28
|
resolveBoundMachineId,
|
|
39
29
|
resolveFileWriteGateEnabled,
|
|
40
30
|
resolveRawAgentInput,
|
|
41
31
|
resolveServerUrl,
|
|
42
|
-
safeAskText,
|
|
43
|
-
settleHostReviewsForScope,
|
|
44
|
-
shouldPrintLocalRunSummary,
|
|
45
|
-
unknownLocalRunAcceptance,
|
|
46
|
-
unknownTaskCompletion,
|
|
47
32
|
validateInstaboxWorkspaceSelection,
|
|
48
|
-
withHostReviewDispatch,
|
|
49
|
-
withholdIfSecretLike,
|
|
50
|
-
wrapLocalCommandWorkspaceObservation,
|
|
51
33
|
writeUsage
|
|
52
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FKEZOMIF.js";
|
|
53
35
|
import {
|
|
54
36
|
clearCredentialAvailability,
|
|
55
37
|
readEffectiveCredentialEntry
|
|
@@ -57,7 +39,7 @@ import {
|
|
|
57
39
|
import {
|
|
58
40
|
readDbRecord,
|
|
59
41
|
resolveAgentRecordFromHybridStore
|
|
60
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-5LQDHFBN.js";
|
|
61
43
|
import {
|
|
62
44
|
boxGlyphs,
|
|
63
45
|
displayWidth,
|
|
@@ -65,7 +47,7 @@ import {
|
|
|
65
47
|
stripAnsi,
|
|
66
48
|
tokenizeAnsiLine,
|
|
67
49
|
visibleWidth
|
|
68
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-HYKGIXNO.js";
|
|
69
51
|
import {
|
|
70
52
|
deriveStateResident,
|
|
71
53
|
resolvePureVNextRuntime,
|
|
@@ -101,7 +83,7 @@ import {
|
|
|
101
83
|
import {
|
|
102
84
|
isBuiltinNoloAgentRef,
|
|
103
85
|
resolveLocalUserId
|
|
104
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-T5N6NHAT.js";
|
|
105
87
|
import {
|
|
106
88
|
CliProviderQuotaError
|
|
107
89
|
} from "./chunk-MK2Q7ZJD.js";
|
|
@@ -113,21 +95,21 @@ import {
|
|
|
113
95
|
} from "./chunk-BMQ2MJUK.js";
|
|
114
96
|
import {
|
|
115
97
|
resolveCliLocalRuntimeKeyCapability
|
|
116
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-LXTC53TN.js";
|
|
117
99
|
import {
|
|
118
100
|
isTransientFetchError
|
|
119
101
|
} from "./chunk-KFHREHUQ.js";
|
|
120
102
|
import {
|
|
121
103
|
parseUiCard,
|
|
122
104
|
uiCardFallback
|
|
123
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-GRXSJR2Z.js";
|
|
124
106
|
import {
|
|
125
107
|
isGatewayHttpStatus
|
|
126
108
|
} from "./chunk-NF64D32W.js";
|
|
127
109
|
import {
|
|
128
110
|
buildMemorySubjectsForAgent,
|
|
129
111
|
resolveAgentMemoryPolicy
|
|
130
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-SW6OD4KE.js";
|
|
131
113
|
import {
|
|
132
114
|
chooseMemoryOwners,
|
|
133
115
|
loadMemoryCandidatesFromDb,
|
|
@@ -142,7 +124,36 @@ import {
|
|
|
142
124
|
resolveAgentContextWindow,
|
|
143
125
|
resolveOccupancy,
|
|
144
126
|
resolveOccupancyWindow
|
|
145
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-PVAWNHP5.js";
|
|
128
|
+
import {
|
|
129
|
+
awaitLocalWriterChild,
|
|
130
|
+
createRunActivityTracker,
|
|
131
|
+
createShellApprovalChild,
|
|
132
|
+
getRunResultHeaderMeta,
|
|
133
|
+
isHistoryIntegrityFailure,
|
|
134
|
+
popSingleQueueMessage,
|
|
135
|
+
readRunRecord,
|
|
136
|
+
recordRunResultHeaderMeta,
|
|
137
|
+
registerLocalForegroundWriter,
|
|
138
|
+
reportRunProcessIdentity,
|
|
139
|
+
resolveResultServerMeta,
|
|
140
|
+
resolveRunQueuePath,
|
|
141
|
+
resolveRunsDir,
|
|
142
|
+
serverOriginForDialog,
|
|
143
|
+
settleRunTerminalAuthoritatively,
|
|
144
|
+
spawnLocalBackgroundRun
|
|
145
|
+
} from "./chunk-XIEYGCN6.js";
|
|
146
|
+
import {
|
|
147
|
+
formatAgentListCard,
|
|
148
|
+
formatFinishedRunCard,
|
|
149
|
+
formatIdentityRow,
|
|
150
|
+
formatListRunsCard,
|
|
151
|
+
formatNotFoundRunCard,
|
|
152
|
+
formatStatusRunCard,
|
|
153
|
+
formatStopRunCard,
|
|
154
|
+
getAgentRunStatusIcon,
|
|
155
|
+
isAgentRunTerminalStatus
|
|
156
|
+
} from "./chunk-AXYH4734.js";
|
|
146
157
|
import {
|
|
147
158
|
isCliAuthorityBrokerProtocolError,
|
|
148
159
|
isCliAuthorityBrokerTimeoutError,
|
|
@@ -154,16 +165,18 @@ import {
|
|
|
154
165
|
import {
|
|
155
166
|
isLocalCliAgentKey
|
|
156
167
|
} from "./chunk-BR3GT6MR.js";
|
|
168
|
+
import {
|
|
169
|
+
buildSkillDiscoveryContextLayer
|
|
170
|
+
} from "./chunk-CKT6QUE2.js";
|
|
157
171
|
import {
|
|
158
172
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
159
173
|
LOCAL_TURN_ABORTED_CODE,
|
|
160
|
-
evaluateTaskExecutionContract,
|
|
161
174
|
markCliUserBatchPhase,
|
|
162
175
|
readActionGate
|
|
163
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-CVERLOJM.js";
|
|
164
177
|
import {
|
|
165
178
|
resolveAgentRuntimeConfigFromRecord
|
|
166
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-C2B7M567.js";
|
|
167
180
|
import {
|
|
168
181
|
createThinkParserState,
|
|
169
182
|
flushThinkParser,
|
|
@@ -181,12 +194,12 @@ import {
|
|
|
181
194
|
ATTACHMENT_PART_VERSION,
|
|
182
195
|
describeAttachmentForModel,
|
|
183
196
|
normalizeAttachmentPart
|
|
184
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-YQETUZ5V.js";
|
|
185
198
|
import {
|
|
186
199
|
findCodexOAuthPinnedContextWindow,
|
|
187
200
|
normalizeUsage,
|
|
188
201
|
readCacheReadInputTokensOrNull
|
|
189
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-T2BEPTAG.js";
|
|
190
203
|
import {
|
|
191
204
|
isOAuthApiKeyRef
|
|
192
205
|
} from "./chunk-UKZX3NHN.js";
|
|
@@ -196,32 +209,47 @@ import {
|
|
|
196
209
|
import {
|
|
197
210
|
normalizeRuntimeToolPolicyOverride,
|
|
198
211
|
resolveEffectiveRuntimeToolPolicy
|
|
199
|
-
} from "./chunk-
|
|
212
|
+
} from "./chunk-SSGTV4FC.js";
|
|
200
213
|
import {
|
|
201
214
|
compactWhitespace
|
|
202
215
|
} from "./chunk-DWLEOOGR.js";
|
|
216
|
+
import {
|
|
217
|
+
QUOTA_ERROR_PATTERNS,
|
|
218
|
+
isQuotaExhaustedError
|
|
219
|
+
} from "./chunk-EWQ3HGNZ.js";
|
|
203
220
|
import {
|
|
204
221
|
isAntigravityOAuthAgent
|
|
205
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-VPAZ6BEN.js";
|
|
223
|
+
import {
|
|
224
|
+
resolveClientVersion
|
|
225
|
+
} from "./chunk-6EDAMVG6.js";
|
|
226
|
+
import {
|
|
227
|
+
toErrorMessage
|
|
228
|
+
} from "./chunk-HNMXYYJR.js";
|
|
206
229
|
import {
|
|
207
230
|
parseExternalSkillMarkdown,
|
|
208
231
|
parseSkillDocProtocol
|
|
209
|
-
} from "./chunk-
|
|
232
|
+
} from "./chunk-AETZ7AD6.js";
|
|
210
233
|
import {
|
|
211
234
|
BUILTIN_NOLO_AGENT_KEY,
|
|
212
235
|
BUILTIN_NOLO_AGENT_NAME,
|
|
213
236
|
builtinAgentCatalogEntryById,
|
|
214
237
|
parseBuiltinPlatformAgentId
|
|
215
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-ILHQ2AXT.js";
|
|
216
239
|
import {
|
|
217
240
|
parsePublicAgentId
|
|
218
241
|
} from "./chunk-M2EJHDJP.js";
|
|
219
242
|
import {
|
|
220
|
-
|
|
221
|
-
} from "./chunk-
|
|
243
|
+
findModelConfig
|
|
244
|
+
} from "./chunk-KYH7XW3K.js";
|
|
222
245
|
import {
|
|
223
|
-
|
|
224
|
-
|
|
246
|
+
CLIENT_VERSION_TOO_OLD_CODE,
|
|
247
|
+
NOLO_CLIENT_VERSION_HEADER,
|
|
248
|
+
buildClientVersionUpgradeMessage
|
|
249
|
+
} from "./chunk-OBSEKCVK.js";
|
|
250
|
+
import {
|
|
251
|
+
asTrimmedLowercaseString
|
|
252
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
225
253
|
import {
|
|
226
254
|
buildAgentsMdLayer,
|
|
227
255
|
buildAgentsMdLayerHeader,
|
|
@@ -235,6 +263,13 @@ import {
|
|
|
235
263
|
getLogger,
|
|
236
264
|
normalizeError
|
|
237
265
|
} from "./chunk-YGMBIXCF.js";
|
|
266
|
+
import {
|
|
267
|
+
resolveAuthToken
|
|
268
|
+
} from "./chunk-WACI5I6V.js";
|
|
269
|
+
import {
|
|
270
|
+
readPipeText,
|
|
271
|
+
spawnProcess
|
|
272
|
+
} from "./chunk-4O22PGNQ.js";
|
|
238
273
|
import {
|
|
239
274
|
agentRunCardLabels,
|
|
240
275
|
getCliLocale,
|
|
@@ -243,72 +278,380 @@ import {
|
|
|
243
278
|
toolLabelVariants
|
|
244
279
|
} from "./chunk-OB6DVWPF.js";
|
|
245
280
|
import {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
createShellApprovalChild,
|
|
249
|
-
getRunResultHeaderMeta,
|
|
250
|
-
isHistoryIntegrityFailure,
|
|
251
|
-
popSingleQueueMessage,
|
|
252
|
-
readRunRecord,
|
|
253
|
-
recordRunResultHeaderMeta,
|
|
254
|
-
registerLocalForegroundWriter,
|
|
255
|
-
reportRunProcessIdentity,
|
|
256
|
-
resolveResultServerMeta,
|
|
257
|
-
resolveRunQueuePath,
|
|
258
|
-
resolveRunsDir,
|
|
259
|
-
serverOriginForDialog,
|
|
260
|
-
settleRunTerminalAuthoritatively,
|
|
261
|
-
spawnLocalBackgroundRun
|
|
262
|
-
} from "./chunk-F7DU25CE.js";
|
|
263
|
-
import {
|
|
264
|
-
formatAgentListCard,
|
|
265
|
-
formatFinishedRunCard,
|
|
266
|
-
formatIdentityRow,
|
|
267
|
-
formatListRunsCard,
|
|
268
|
-
formatNotFoundRunCard,
|
|
269
|
-
formatStatusRunCard,
|
|
270
|
-
formatStopRunCard,
|
|
271
|
-
getAgentRunStatusIcon,
|
|
272
|
-
isAgentRunTerminalStatus
|
|
273
|
-
} from "./chunk-VQUWV3YR.js";
|
|
274
|
-
import {
|
|
275
|
-
QUOTA_ERROR_PATTERNS,
|
|
276
|
-
isQuotaExhaustedError
|
|
277
|
-
} from "./chunk-EWQ3HGNZ.js";
|
|
278
|
-
import {
|
|
279
|
-
resolveClientVersion
|
|
280
|
-
} from "./chunk-4NA3YTBC.js";
|
|
281
|
-
import {
|
|
282
|
-
toErrorMessage
|
|
283
|
-
} from "./chunk-HNMXYYJR.js";
|
|
281
|
+
ulid
|
|
282
|
+
} from "./chunk-OJKUU3LP.js";
|
|
284
283
|
import {
|
|
285
284
|
asTrimmedString
|
|
286
285
|
} from "./chunk-3EUW3WEO.js";
|
|
287
|
-
import {
|
|
288
|
-
findModelConfig
|
|
289
|
-
} from "./chunk-KYH7XW3K.js";
|
|
290
|
-
import {
|
|
291
|
-
CLIENT_VERSION_TOO_OLD_CODE,
|
|
292
|
-
NOLO_CLIENT_VERSION_HEADER,
|
|
293
|
-
buildClientVersionUpgradeMessage
|
|
294
|
-
} from "./chunk-OBSEKCVK.js";
|
|
295
|
-
import {
|
|
296
|
-
asTrimmedLowercaseString
|
|
297
|
-
} from "./chunk-QSJ3HFEF.js";
|
|
298
|
-
import {
|
|
299
|
-
resolveAuthToken
|
|
300
|
-
} from "./chunk-2THCNKE4.js";
|
|
301
286
|
import {
|
|
302
287
|
asOptionalTrimmedString
|
|
303
288
|
} from "./chunk-G3SUCT4W.js";
|
|
304
289
|
|
|
305
290
|
// packages/cli/agentRunCommand.ts
|
|
291
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
292
|
+
|
|
293
|
+
// packages/cli/agentRunLocalWorkspace.ts
|
|
306
294
|
import { createHash } from "node:crypto";
|
|
295
|
+
import { constants } from "node:fs";
|
|
296
|
+
import { lstat, open } from "node:fs/promises";
|
|
297
|
+
import { resolve } from "node:path";
|
|
298
|
+
function unknownLocalRunAcceptance(cwd, base) {
|
|
299
|
+
return {
|
|
300
|
+
schemaVersion: 1,
|
|
301
|
+
source: "local-runtime",
|
|
302
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
303
|
+
cwd,
|
|
304
|
+
base,
|
|
305
|
+
deliveryHead: null,
|
|
306
|
+
workspace: { status: "unknown", fingerprint: null, changedPaths: null, atomic: false },
|
|
307
|
+
checks: { status: "unknown", reason: "No version-bound command execution evidence collected" },
|
|
308
|
+
review: { status: "unknown" }
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
async function runGitForLocalSummary(args, deps = {}) {
|
|
312
|
+
const spawn = deps.spawnProcess ?? spawnProcess;
|
|
313
|
+
const read = deps.readPipeText ?? readPipeText;
|
|
314
|
+
const proc = spawn({
|
|
315
|
+
cmd: ["git", ...args.gitArgs],
|
|
316
|
+
cwd: args.cwd,
|
|
317
|
+
stdout: "pipe",
|
|
318
|
+
stderr: "pipe"
|
|
319
|
+
});
|
|
320
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
321
|
+
read(proc.stdout),
|
|
322
|
+
read(proc.stderr),
|
|
323
|
+
proc.exited
|
|
324
|
+
]);
|
|
325
|
+
if (exitCode !== 0) {
|
|
326
|
+
throw new Error((stderr || stdout || `git ${args.gitArgs.join(" ")} failed`).trim());
|
|
327
|
+
}
|
|
328
|
+
return args.gitArgs.includes("-z") || args.gitArgs.includes("--binary") ? stdout : stdout.trim();
|
|
329
|
+
}
|
|
330
|
+
async function inspectLocalRunWorkspace(cwd, deps = {}, acceptanceBase) {
|
|
331
|
+
if (acceptanceBase !== void 0) {
|
|
332
|
+
const acceptance = unknownLocalRunAcceptance(cwd, acceptanceBase);
|
|
333
|
+
const sample = acceptanceBase === null ? null : await captureBoundedWorkspace(cwd, {
|
|
334
|
+
spawn: deps.spawnProcess,
|
|
335
|
+
signal: deps.signal,
|
|
336
|
+
limits: deps.sampleLimits,
|
|
337
|
+
base: acceptanceBase
|
|
338
|
+
});
|
|
339
|
+
if (sample) {
|
|
340
|
+
acceptance.deliveryHead = sample.head;
|
|
341
|
+
acceptance.workspace = {
|
|
342
|
+
status: "observed",
|
|
343
|
+
fingerprint: sample.fingerprint,
|
|
344
|
+
changedPaths: sample.changedPaths,
|
|
345
|
+
atomic: false
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
cwd,
|
|
350
|
+
clean: sample ? sample.status.trim() === "" : false,
|
|
351
|
+
status: sample?.status ?? "workspace inspection unavailable (unknown)",
|
|
352
|
+
acceptance,
|
|
353
|
+
...sample?.commit ? { commit: sample.commit } : {}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
const run = (gitArgs) => runGitForLocalSummary({ cwd, gitArgs }, deps);
|
|
357
|
+
const status = await run(["status", "--short"]);
|
|
358
|
+
const rawCommit = await run(["log", "-1", "--format=%h%x00%s"]).catch(() => "");
|
|
359
|
+
const [hash, subject] = rawCommit.split("\0");
|
|
360
|
+
return {
|
|
361
|
+
cwd,
|
|
362
|
+
clean: status.trim() === "",
|
|
363
|
+
status,
|
|
364
|
+
...hash ? { commit: { hash, subject: subject ?? "" } } : {}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function shouldPrintLocalRunSummary(args) {
|
|
368
|
+
return Boolean(args.localRuntimeCwd && args.parsed.runtimeMode === "local");
|
|
369
|
+
}
|
|
370
|
+
function formatLocalRunSummary(args) {
|
|
371
|
+
return [
|
|
372
|
+
"",
|
|
373
|
+
"[nolo] local run summary",
|
|
374
|
+
`workspace: ${args.inspection.cwd}`,
|
|
375
|
+
...args.dialogId ? [`dialog: ${args.dialogId}`] : [],
|
|
376
|
+
...args.inspection.commit ? [`commit: ${args.inspection.commit.hash} ${args.inspection.commit.subject}`] : [],
|
|
377
|
+
`dirty: ${args.inspection.clean ? "clean" : "dirty"}`,
|
|
378
|
+
...!args.inspection.clean && args.inspection.status.trim() ? [`status:
|
|
379
|
+
${args.inspection.status.trim()}`] : [],
|
|
380
|
+
""
|
|
381
|
+
].join("\n");
|
|
382
|
+
}
|
|
383
|
+
async function captureLocalRunBase(cwd, options = {}) {
|
|
384
|
+
if (options.signal?.aborted) return null;
|
|
385
|
+
const controller = new AbortController();
|
|
386
|
+
const abort = () => controller.abort();
|
|
387
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
388
|
+
const timer = setTimeout(abort, options.timeoutMs ?? 2e3);
|
|
389
|
+
let child;
|
|
390
|
+
let bytesRead = 0;
|
|
391
|
+
let onAbort;
|
|
392
|
+
const stop = () => {
|
|
393
|
+
child?.kill();
|
|
394
|
+
child?.stdout?.destroy();
|
|
395
|
+
child?.stderr?.destroy();
|
|
396
|
+
};
|
|
397
|
+
controller.signal.addEventListener("abort", stop, { once: true });
|
|
398
|
+
const work = async () => {
|
|
399
|
+
child = (options.spawn ?? spawnProcess)({
|
|
400
|
+
cmd: ["git", "rev-parse", "HEAD"],
|
|
401
|
+
cwd,
|
|
402
|
+
stdin: "ignore",
|
|
403
|
+
stdout: "pipe",
|
|
404
|
+
stderr: "pipe",
|
|
405
|
+
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0", GIT_TERMINAL_PROMPT: "0" }
|
|
406
|
+
});
|
|
407
|
+
const read = async (stream) => {
|
|
408
|
+
const chunks = [];
|
|
409
|
+
if (stream) for await (const chunk of stream) {
|
|
410
|
+
if (controller.signal.aborted) throw new Error("base capture cancelled");
|
|
411
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
412
|
+
bytesRead += bytes.length;
|
|
413
|
+
if (bytesRead > (options.outputBytes ?? 4096)) {
|
|
414
|
+
controller.abort();
|
|
415
|
+
throw new Error("base output budget");
|
|
416
|
+
}
|
|
417
|
+
chunks.push(bytes);
|
|
418
|
+
}
|
|
419
|
+
return Buffer.concat(chunks).toString("utf8").trim();
|
|
420
|
+
};
|
|
421
|
+
const [head, , code] = await Promise.all([read(child.stdout), read(child.stderr), child.exited]);
|
|
422
|
+
if (controller.signal.aborted || code !== 0 || !/^[a-f0-9]{40,64}$/.test(head)) return null;
|
|
423
|
+
return head;
|
|
424
|
+
};
|
|
425
|
+
try {
|
|
426
|
+
return await Promise.race([work(), new Promise((resolve5) => {
|
|
427
|
+
onAbort = () => resolve5(null);
|
|
428
|
+
controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
429
|
+
if (controller.signal.aborted) resolve5(null);
|
|
430
|
+
})]);
|
|
431
|
+
} catch {
|
|
432
|
+
return null;
|
|
433
|
+
} finally {
|
|
434
|
+
controller.abort();
|
|
435
|
+
clearTimeout(timer);
|
|
436
|
+
options.signal?.removeEventListener("abort", abort);
|
|
437
|
+
controller.signal.removeEventListener("abort", stop);
|
|
438
|
+
if (onAbort) controller.signal.removeEventListener("abort", onAbort);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function observeLocalCommandResult(event, cwd) {
|
|
442
|
+
if (event.type !== "tool-result" || event.toolName !== "execShell") return;
|
|
443
|
+
const meta = event.metadata;
|
|
444
|
+
if (!meta || meta.executionState !== "synchronous-complete" || meta.detached === true || meta.aborted === true || typeof meta.command !== "string" || typeof meta.timedOut !== "boolean" || !meta.timedOut && (typeof meta.exitCode !== "number" || !Number.isInteger(meta.exitCode))) return;
|
|
445
|
+
return {
|
|
446
|
+
commandFingerprint: `sha256:${createHash("sha256").update(meta.command).digest("hex")}`,
|
|
447
|
+
cwd,
|
|
448
|
+
cwdSource: "configured-workspace",
|
|
449
|
+
exitCode: meta.timedOut ? "timeout" : meta.exitCode,
|
|
450
|
+
// Settlement replaces this with the containing result-file JSON pointer.
|
|
451
|
+
evidence: "runtime-tool-result",
|
|
452
|
+
versionBinding: "unknown",
|
|
453
|
+
source: "execShell-tool-result",
|
|
454
|
+
toolCallId: event.toolCallId,
|
|
455
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function attachLocalCommandObservations(acceptance, observations, resultReference) {
|
|
459
|
+
if (!observations.length) return;
|
|
460
|
+
const existing = acceptance.checks.observations ?? [];
|
|
461
|
+
acceptance.checks.observations = [...existing, ...observations.map((observation, index) => ({
|
|
462
|
+
...observation,
|
|
463
|
+
evidence: `${resultReference}#/acceptance/checks/observations/${existing.length + index}`
|
|
464
|
+
}))];
|
|
465
|
+
acceptance.checks.reason = "Command exits observed; execution cwd is configured only and execution-time version stability is unproven";
|
|
466
|
+
}
|
|
467
|
+
var COMMAND_WORKSPACE_SAMPLE_LIMITS = {
|
|
468
|
+
timeoutMs: 2e3,
|
|
469
|
+
gitOutputBytes: 1024 * 1024,
|
|
470
|
+
files: 128,
|
|
471
|
+
fileBytes: 1024 * 1024,
|
|
472
|
+
totalFileBytes: 4 * 1024 * 1024,
|
|
473
|
+
concurrentSamples: 1
|
|
474
|
+
};
|
|
475
|
+
var activeCommandWorkspaceSamples = 0;
|
|
476
|
+
async function captureBoundedWorkspace(cwd, options = {}) {
|
|
477
|
+
if (options.signal?.aborted || activeCommandWorkspaceSamples >= COMMAND_WORKSPACE_SAMPLE_LIMITS.concurrentSamples) return null;
|
|
478
|
+
activeCommandWorkspaceSamples++;
|
|
479
|
+
const limits = { ...COMMAND_WORKSPACE_SAMPLE_LIMITS, ...options.limits };
|
|
480
|
+
const controller = new AbortController();
|
|
481
|
+
const abort = () => controller.abort();
|
|
482
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
483
|
+
const timer = setTimeout(abort, limits.timeoutMs);
|
|
484
|
+
let outputBytes = 0;
|
|
485
|
+
let fileBytes = 0;
|
|
486
|
+
const check = () => {
|
|
487
|
+
if (controller.signal.aborted) throw new Error("sample cancelled");
|
|
488
|
+
};
|
|
489
|
+
const git = async (args) => {
|
|
490
|
+
check();
|
|
491
|
+
const child = (options.spawn ?? spawnProcess)({
|
|
492
|
+
cmd: ["git", ...args],
|
|
493
|
+
cwd,
|
|
494
|
+
stdin: "ignore",
|
|
495
|
+
stdout: "pipe",
|
|
496
|
+
stderr: "pipe",
|
|
497
|
+
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0", GIT_TERMINAL_PROMPT: "0" }
|
|
498
|
+
});
|
|
499
|
+
const stop = () => {
|
|
500
|
+
child.kill();
|
|
501
|
+
child.stdout?.destroy();
|
|
502
|
+
child.stderr?.destroy();
|
|
503
|
+
};
|
|
504
|
+
controller.signal.addEventListener("abort", stop, { once: true });
|
|
505
|
+
const read = async (stream) => {
|
|
506
|
+
const chunks = [];
|
|
507
|
+
if (stream) for await (const chunk of stream) {
|
|
508
|
+
check();
|
|
509
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
510
|
+
outputBytes += bytes.length;
|
|
511
|
+
if (outputBytes > limits.gitOutputBytes) {
|
|
512
|
+
controller.abort();
|
|
513
|
+
throw new Error("git output budget");
|
|
514
|
+
}
|
|
515
|
+
chunks.push(bytes);
|
|
516
|
+
}
|
|
517
|
+
return Buffer.concat(chunks);
|
|
518
|
+
};
|
|
519
|
+
try {
|
|
520
|
+
const [stdout, , code] = await Promise.all([read(child.stdout), read(child.stderr), child.exited]);
|
|
521
|
+
check();
|
|
522
|
+
if (code !== 0) throw new Error("git inspection failed");
|
|
523
|
+
return stdout;
|
|
524
|
+
} finally {
|
|
525
|
+
controller.signal.removeEventListener("abort", stop);
|
|
526
|
+
stop();
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
const work = async () => {
|
|
530
|
+
const head = await git(["rev-parse", "HEAD"]);
|
|
531
|
+
const root = (await git(["rev-parse", "--show-toplevel"])).toString("utf8").trim();
|
|
532
|
+
const digest = createHash("sha256").update(head);
|
|
533
|
+
const summary = options.base !== void 0 ? (await git(["log", "-1", "--format=%h%x00%s"])).toString("utf8").trim() : "";
|
|
534
|
+
const paths = options.base !== void 0 ? (await git(["-C", root, "diff", "--name-only", "-z", options.base, "--"])).toString("utf8").split("\0").filter(Boolean) : [];
|
|
535
|
+
if (paths.length > limits.files) throw new Error("base changed file count budget");
|
|
536
|
+
const status = await git(["-C", root, "status", "--porcelain=v1", "-z", "--untracked-files=all"]);
|
|
537
|
+
if (status.toString("utf8").split("\0").filter(Boolean).length > limits.files) throw new Error("changed file count budget");
|
|
538
|
+
digest.update(status);
|
|
539
|
+
for (const args of [
|
|
540
|
+
["diff", "--no-ext-diff", "--no-textconv", "--binary", "HEAD", "--"],
|
|
541
|
+
["diff", "--cached", "--no-ext-diff", "--no-textconv", "--binary", "HEAD", "--"]
|
|
542
|
+
]) digest.update(await git(["-C", root, ...args]));
|
|
543
|
+
const names = (await git(["-C", root, "ls-files", "--others", "--exclude-standard", "-z"])).toString("utf8").split("\0").filter(Boolean).sort();
|
|
544
|
+
if (names.length > limits.files) throw new Error("file count budget");
|
|
545
|
+
for (const name of names) {
|
|
546
|
+
check();
|
|
547
|
+
const path2 = resolve(root, name);
|
|
548
|
+
const stat = await lstat(path2);
|
|
549
|
+
check();
|
|
550
|
+
if (!stat.isFile() || stat.size > limits.fileBytes || fileBytes + stat.size > limits.totalFileBytes) throw new Error("file budget");
|
|
551
|
+
digest.update(JSON.stringify([name, stat.mode, stat.size]));
|
|
552
|
+
if (stat.size === 0) {
|
|
553
|
+
const after2 = await lstat(path2);
|
|
554
|
+
check();
|
|
555
|
+
if (!after2.isFile() || after2.size !== 0 || after2.ino !== stat.ino || after2.mtimeMs !== stat.mtimeMs) throw new Error("racing empty file");
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
let readBytes = 0;
|
|
559
|
+
const file = await open(path2, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
560
|
+
try {
|
|
561
|
+
check();
|
|
562
|
+
const opened = await file.stat();
|
|
563
|
+
check();
|
|
564
|
+
if (!opened.isFile() || opened.ino !== stat.ino || opened.size !== stat.size) throw new Error("racing open");
|
|
565
|
+
const stream = file.createReadStream({
|
|
566
|
+
autoClose: false,
|
|
567
|
+
highWaterMark: Math.min(32 * 1024, stat.size),
|
|
568
|
+
end: stat.size - 1,
|
|
569
|
+
signal: controller.signal
|
|
570
|
+
});
|
|
571
|
+
try {
|
|
572
|
+
for await (const chunk of stream) {
|
|
573
|
+
check();
|
|
574
|
+
const bytes = chunk;
|
|
575
|
+
readBytes += bytes.length;
|
|
576
|
+
fileBytes += bytes.length;
|
|
577
|
+
if (readBytes > limits.fileBytes || fileBytes > limits.totalFileBytes) throw new Error("read budget");
|
|
578
|
+
digest.update(bytes);
|
|
579
|
+
}
|
|
580
|
+
} finally {
|
|
581
|
+
stream.destroy();
|
|
582
|
+
}
|
|
583
|
+
} finally {
|
|
584
|
+
await file.close();
|
|
585
|
+
}
|
|
586
|
+
const after = await lstat(path2);
|
|
587
|
+
check();
|
|
588
|
+
if (readBytes !== stat.size || after.size !== stat.size || after.mtimeMs !== stat.mtimeMs || after.ino !== stat.ino || !after.isFile()) throw new Error("racing file");
|
|
589
|
+
}
|
|
590
|
+
check();
|
|
591
|
+
const [hash, subject] = summary.split("\0");
|
|
592
|
+
return {
|
|
593
|
+
fingerprint: `sha256:${digest.digest("hex")}`,
|
|
594
|
+
head: head.toString("utf8").trim(),
|
|
595
|
+
status: status.toString("utf8").replace(/\0/g, "\n"),
|
|
596
|
+
changedPaths: [.../* @__PURE__ */ new Set([...paths, ...names])].sort(),
|
|
597
|
+
...hash ? { commit: { hash, subject: subject ?? "" } } : {}
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
let onAbort;
|
|
601
|
+
try {
|
|
602
|
+
const pending = work().finally(() => {
|
|
603
|
+
activeCommandWorkspaceSamples--;
|
|
604
|
+
});
|
|
605
|
+
return await Promise.race([pending, new Promise((resolve5) => {
|
|
606
|
+
onAbort = () => resolve5(null);
|
|
607
|
+
controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
608
|
+
if (controller.signal.aborted) resolve5(null);
|
|
609
|
+
})]);
|
|
610
|
+
} catch {
|
|
611
|
+
return null;
|
|
612
|
+
} finally {
|
|
613
|
+
controller.abort();
|
|
614
|
+
clearTimeout(timer);
|
|
615
|
+
options.signal?.removeEventListener("abort", abort);
|
|
616
|
+
if (onAbort) controller.signal.removeEventListener("abort", onAbort);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
async function captureCommandWorkspaceFingerprint(cwd, options = {}) {
|
|
620
|
+
return (await captureBoundedWorkspace(cwd, options))?.fingerprint ?? null;
|
|
621
|
+
}
|
|
622
|
+
function wrapLocalCommandWorkspaceObservation(adapter, cwd, bindings, capture = captureCommandWorkspaceFingerprint, signal) {
|
|
623
|
+
const safeCapture = (callSignal) => capture(cwd, { signal: signal ?? callSignal }).catch(() => null);
|
|
624
|
+
return {
|
|
625
|
+
...adapter,
|
|
626
|
+
async executeTool(call, options) {
|
|
627
|
+
if (call.name !== "execShell") return adapter.executeTool.call(adapter, call, options);
|
|
628
|
+
try {
|
|
629
|
+
if (JSON.parse(call.arguments).background === true) return adapter.executeTool.call(adapter, call, options);
|
|
630
|
+
} catch {
|
|
631
|
+
}
|
|
632
|
+
const before = await safeCapture(options?.abortSignal);
|
|
633
|
+
const result = await adapter.executeTool.call(adapter, call, options);
|
|
634
|
+
if (result.metadata?.executionState === "synchronous-complete" && result.metadata.detached !== true && result.metadata.aborted !== true) {
|
|
635
|
+
const after = await safeCapture(options?.abortSignal);
|
|
636
|
+
bindings.set(call.id, {
|
|
637
|
+
versionBinding: !before || !after ? "unknown" : before === after ? "observed-unchanged" : "stale",
|
|
638
|
+
executionWorkspace: {
|
|
639
|
+
before,
|
|
640
|
+
after,
|
|
641
|
+
atomic: false,
|
|
642
|
+
limitation: "ABA and external concurrent writes are not excluded"
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
return result;
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
}
|
|
307
650
|
|
|
308
651
|
// packages/cli/client/instaboxRunConfigWrite.ts
|
|
309
652
|
import { randomUUID } from "node:crypto";
|
|
310
653
|
import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
311
|
-
import { isAbsolute, join, normalize, resolve } from "node:path";
|
|
654
|
+
import { isAbsolute, join, normalize, resolve as resolve2 } from "node:path";
|
|
312
655
|
var InstaboxRunConfigWriteError = class extends Error {
|
|
313
656
|
code;
|
|
314
657
|
constructor(code, message) {
|
|
@@ -345,7 +688,7 @@ function writeInstaboxRunConfig(options) {
|
|
|
345
688
|
if (!rawPath) {
|
|
346
689
|
fail("missing_manifest_path", 'workspaceMode \u4E3A "snapshot" \u65F6\u5FC5\u987B\u63D0\u4F9B manifest \u6587\u4EF6\u8DEF\u5F84');
|
|
347
690
|
}
|
|
348
|
-
const resolvedManifestPath =
|
|
691
|
+
const resolvedManifestPath = resolve2(rawPath);
|
|
349
692
|
let rawText = "";
|
|
350
693
|
try {
|
|
351
694
|
const reader = options.readTextFile ?? ((p) => readFileSync(p, "utf8"));
|
|
@@ -415,7 +758,7 @@ function writeInstaboxRunConfig(options) {
|
|
|
415
758
|
config.manifestSha256 = manifestSha256;
|
|
416
759
|
}
|
|
417
760
|
const runsDir = options.runsDir ?? resolveRunsDir(env);
|
|
418
|
-
const normalizedRunsDir = normalize(
|
|
761
|
+
const normalizedRunsDir = normalize(resolve2(runsDir));
|
|
419
762
|
try {
|
|
420
763
|
mkdirSync(normalizedRunsDir, { recursive: true, mode: 448 });
|
|
421
764
|
} catch (err) {
|
|
@@ -520,78 +863,6 @@ function resolveCliBatchIdentity(options) {
|
|
|
520
863
|
return { batchId, messageIds };
|
|
521
864
|
}
|
|
522
865
|
|
|
523
|
-
// packages/cli/client/agentRun.ts
|
|
524
|
-
import { resolve as resolveHostReviewPath } from "node:path";
|
|
525
|
-
|
|
526
|
-
// packages/cli/client/hostTaskBinding.ts
|
|
527
|
-
import { resolve as resolve2 } from "node:path";
|
|
528
|
-
function bindHostTask(args) {
|
|
529
|
-
let latest;
|
|
530
|
-
let completion;
|
|
531
|
-
function load() {
|
|
532
|
-
if (!args.reference) return void 0;
|
|
533
|
-
if (resolve2(args.reference.workspace) !== resolve2(args.workspace) || args.reference.dialogId !== args.dialogId) {
|
|
534
|
-
return { authorization: "unknown", reason: "scope_mismatch" };
|
|
535
|
-
}
|
|
536
|
-
return readHostTask(hostTaskEventsRoot(args.env), args.reference);
|
|
537
|
-
}
|
|
538
|
-
latest = load();
|
|
539
|
-
const contract = args.completionEvidenceProvider && latest && latest.authorization !== "unknown" ? latest.contract : void 0;
|
|
540
|
-
const adapter = !args.reference ? args.adapter : {
|
|
541
|
-
...args.adapter,
|
|
542
|
-
// Re-read authority before each protected action. A review-only binding owns
|
|
543
|
-
// typed review tools, not ordinary chat tools or their existing permission gates.
|
|
544
|
-
// Explicit completion tasks retain their all-tool stop semantics; unknown scope
|
|
545
|
-
// fails closed. Already running tools are not cancelled by this entry guard.
|
|
546
|
-
executeTool: async (call, opts) => {
|
|
547
|
-
latest = load();
|
|
548
|
-
const authorization = latest?.authorization ?? "unknown";
|
|
549
|
-
const protectedTool = call.name === "requestTaskReview" || call.name === "recordTaskReviewDecision";
|
|
550
|
-
if (authorization !== "active" && (args.completionEvidenceProvider || protectedTool || authorization === "unknown")) {
|
|
551
|
-
const code = authorization === "paused" ? "authorization_paused" : authorization === "revoked" ? "authorization_revoked" : "authorization_unknown";
|
|
552
|
-
throw Object.assign(new Error(`host task authority ${authorization}: tool "${call.name}" was not executed`), { code });
|
|
553
|
-
}
|
|
554
|
-
return args.adapter.executeTool(call, opts);
|
|
555
|
-
},
|
|
556
|
-
saveTurn: async (input) => {
|
|
557
|
-
latest = load();
|
|
558
|
-
const stopped = args.signal?.aborted || input.result.businessCompletion?.reasons.includes("stopped");
|
|
559
|
-
if (args.completionEvidenceProvider) {
|
|
560
|
-
const snapshot = latest && latest.authorization !== "unknown" ? latest.contract : void 0;
|
|
561
|
-
let evidence;
|
|
562
|
-
try {
|
|
563
|
-
evidence = snapshot ? await args.completionEvidenceProvider(snapshot) : void 0;
|
|
564
|
-
} catch {
|
|
565
|
-
}
|
|
566
|
-
latest = load();
|
|
567
|
-
const current = latest && latest.authorization !== "unknown" ? latest.contract : void 0;
|
|
568
|
-
completion = !current || !evidence || evidence.taskId !== current.taskId ? stopped ? { taskId: args.reference.taskId, status: "blocked", reasons: ["stopped"] } : unknownTaskCompletion(args.reference.taskId) : evaluateTaskExecutionContract({ ...evidence, authorization: current.authorization }, {
|
|
569
|
-
stopped,
|
|
570
|
-
executionFailed: input.result.error === true || !!input.result.runtimeProviderFailure || !!input.result.emptyAssistantFallbackReason,
|
|
571
|
-
budgetExhausted: input.result.businessCompletion?.reasons.includes("budget_exhausted")
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
const result = { ...input.result };
|
|
575
|
-
delete result.businessCompletion;
|
|
576
|
-
if (completion) result.businessCompletion = completion;
|
|
577
|
-
try {
|
|
578
|
-
return await args.adapter.saveTurn({ ...input, result });
|
|
579
|
-
} catch (error) {
|
|
580
|
-
if (args.completionEvidenceProvider) completion = { taskId: args.reference.taskId, status: "blocked", reasons: ["execution_failed"] };
|
|
581
|
-
throw error;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
return {
|
|
586
|
-
adapter,
|
|
587
|
-
contract,
|
|
588
|
-
result: () => args.reference ? {
|
|
589
|
-
taskAuthorization: latest?.authorization ?? "unknown",
|
|
590
|
-
...args.completionEvidenceProvider ? { businessCompletion: completion ?? unknownTaskCompletion(args.reference.taskId) } : {}
|
|
591
|
-
} : {}
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
866
|
// packages/agent-runtime/modelLayerOverride.ts
|
|
596
867
|
var MODEL_LAYER_KEYS = [
|
|
597
868
|
"provider",
|
|
@@ -2652,8 +2923,8 @@ function stripHtmlTags(s) {
|
|
|
2652
2923
|
}
|
|
2653
2924
|
return out;
|
|
2654
2925
|
}
|
|
2655
|
-
function unwrap(s,
|
|
2656
|
-
return s.length >=
|
|
2926
|
+
function unwrap(s, open2, close) {
|
|
2927
|
+
return s.length >= open2.length + close.length && s.startsWith(open2) && s.endsWith(close) ? s.slice(open2.length, s.length - close.length) : null;
|
|
2657
2928
|
}
|
|
2658
2929
|
function cleanLabel(raw) {
|
|
2659
2930
|
const trimmed = stripHtmlTags(raw.trim()).trim();
|
|
@@ -2663,11 +2934,11 @@ function cleanLabel(raw) {
|
|
|
2663
2934
|
}
|
|
2664
2935
|
function displayGenerics(s) {
|
|
2665
2936
|
let out = "";
|
|
2666
|
-
let
|
|
2937
|
+
let open2 = false;
|
|
2667
2938
|
for (const c of s) {
|
|
2668
2939
|
if (c === "~") {
|
|
2669
|
-
out +=
|
|
2670
|
-
|
|
2940
|
+
out += open2 ? ">" : "<";
|
|
2941
|
+
open2 = !open2;
|
|
2671
2942
|
} else {
|
|
2672
2943
|
out += c;
|
|
2673
2944
|
}
|
|
@@ -4748,15 +5019,15 @@ function parseClass(src) {
|
|
|
4748
5019
|
}
|
|
4749
5020
|
if (first === "class") {
|
|
4750
5021
|
const rest = st.slice("class".length).trim();
|
|
4751
|
-
const
|
|
4752
|
-
let name =
|
|
5022
|
+
const open2 = rest.endsWith("{");
|
|
5023
|
+
let name = open2 ? rest.slice(0, -1).trim() : rest;
|
|
4753
5024
|
let label = null;
|
|
4754
5025
|
const labeled = /^(\S+?)\[(.+)\](:::\S+)?$/.exec(name);
|
|
4755
5026
|
if (labeled) {
|
|
4756
5027
|
name = labeled[1] + (labeled[3] ?? "");
|
|
4757
5028
|
label = nonEmpty(cleanLabel(labeled[2]));
|
|
4758
5029
|
}
|
|
4759
|
-
if (!
|
|
5030
|
+
if (!open2 && /\s/.test(name)) {
|
|
4760
5031
|
const assign = parseClassAssign(name);
|
|
4761
5032
|
if (assign)
|
|
4762
5033
|
classAssignments.push(assign);
|
|
@@ -4764,7 +5035,7 @@ function parseClass(src) {
|
|
|
4764
5035
|
graph.drop(st);
|
|
4765
5036
|
} else if (name === "" || /\s/.test(name)) {
|
|
4766
5037
|
graph.drop(st);
|
|
4767
|
-
if (
|
|
5038
|
+
if (open2)
|
|
4768
5039
|
curClass = "skip";
|
|
4769
5040
|
} else {
|
|
4770
5041
|
const idx = declare(name);
|
|
@@ -4775,7 +5046,7 @@ function parseClass(src) {
|
|
|
4775
5046
|
if (title)
|
|
4776
5047
|
title[title.length - 1] = label;
|
|
4777
5048
|
}
|
|
4778
|
-
if (
|
|
5049
|
+
if (open2)
|
|
4779
5050
|
curClass = idx ?? "skip";
|
|
4780
5051
|
}
|
|
4781
5052
|
} else if (st.startsWith("<<")) {
|
|
@@ -4960,15 +5231,15 @@ function parseEr(src) {
|
|
|
4960
5231
|
});
|
|
4961
5232
|
}
|
|
4962
5233
|
} else {
|
|
4963
|
-
const
|
|
4964
|
-
const decl =
|
|
5234
|
+
const open2 = st.endsWith("{");
|
|
5235
|
+
const decl = open2 ? st.slice(0, -1).trim() : st;
|
|
4965
5236
|
if (decl === "" || erTokens(decl).length !== 1) {
|
|
4966
5237
|
graph.drop(st);
|
|
4967
|
-
if (
|
|
5238
|
+
if (open2)
|
|
4968
5239
|
curEntity = "skip";
|
|
4969
5240
|
} else {
|
|
4970
5241
|
const idx = erEntity(graph, decl);
|
|
4971
|
-
if (
|
|
5242
|
+
if (open2)
|
|
4972
5243
|
curEntity = idx ?? "skip";
|
|
4973
5244
|
}
|
|
4974
5245
|
}
|
|
@@ -4980,14 +5251,14 @@ function parseEr(src) {
|
|
|
4980
5251
|
return graph.nodes.length === 0 ? null : graph;
|
|
4981
5252
|
}
|
|
4982
5253
|
function erEntity(graph, token) {
|
|
4983
|
-
const
|
|
5254
|
+
const open2 = token.startsWith('"') ? -1 : token.indexOf("[");
|
|
4984
5255
|
let idx;
|
|
4985
|
-
if (
|
|
4986
|
-
const id = token.slice(0,
|
|
5256
|
+
if (open2 !== -1) {
|
|
5257
|
+
const id = token.slice(0, open2);
|
|
4987
5258
|
if (!token.endsWith("]")) {
|
|
4988
5259
|
graph.warnings.push(`entity "${id}": alias is missing its closing \`]\``);
|
|
4989
5260
|
}
|
|
4990
|
-
const label = cleanLabel(token.slice(
|
|
5261
|
+
const label = cleanLabel(token.slice(open2 + 1).replace(/\]+$/, ""));
|
|
4991
5262
|
if (id === "" || label === "")
|
|
4992
5263
|
return null;
|
|
4993
5264
|
idx = graph.nodeLabel(id, label);
|
|
@@ -5169,10 +5440,10 @@ function parseSubgraphDecl(rest) {
|
|
|
5169
5440
|
return [label, decodeHtmlEntities(label)];
|
|
5170
5441
|
}
|
|
5171
5442
|
}
|
|
5172
|
-
const
|
|
5173
|
-
if (
|
|
5174
|
-
const id = rest.slice(0,
|
|
5175
|
-
const label = cleanLabel(rest.slice(
|
|
5443
|
+
const open2 = rest.indexOf("[");
|
|
5444
|
+
if (open2 !== -1) {
|
|
5445
|
+
const id = rest.slice(0, open2).trim();
|
|
5446
|
+
const label = cleanLabel(rest.slice(open2 + 1).replace(/\]+$/, "").trim());
|
|
5176
5447
|
if (id !== "" && label !== "")
|
|
5177
5448
|
return [id, label];
|
|
5178
5449
|
}
|
|
@@ -5733,10 +6004,10 @@ var SHAPES = [
|
|
|
5733
6004
|
["(", ")"]
|
|
5734
6005
|
];
|
|
5735
6006
|
function nodeText(body) {
|
|
5736
|
-
for (const [
|
|
5737
|
-
const at = body.indexOf(
|
|
5738
|
-
if (at !== -1 && body.endsWith(close) && body.length > at +
|
|
5739
|
-
return cleanLabel(body.slice(at +
|
|
6007
|
+
for (const [open2, close] of SHAPES) {
|
|
6008
|
+
const at = body.indexOf(open2);
|
|
6009
|
+
if (at !== -1 && body.endsWith(close) && body.length > at + open2.length + close.length - 1) {
|
|
6010
|
+
return cleanLabel(body.slice(at + open2.length, body.length - close.length));
|
|
5740
6011
|
}
|
|
5741
6012
|
}
|
|
5742
6013
|
return cleanLabel(body);
|
|
@@ -6310,9 +6581,9 @@ function parseState(src) {
|
|
|
6310
6581
|
inNote = true;
|
|
6311
6582
|
} else if (first === "state") {
|
|
6312
6583
|
const rest = st.slice(firstWord(st).length).trim();
|
|
6313
|
-
const
|
|
6314
|
-
const body =
|
|
6315
|
-
if (!
|
|
6584
|
+
const open2 = rest.endsWith("{");
|
|
6585
|
+
const body = open2 ? rest.slice(0, -1).trim() : rest;
|
|
6586
|
+
if (!open2) {
|
|
6316
6587
|
if (parseStateDecl(body, graph) === null)
|
|
6317
6588
|
graph.drop(st);
|
|
6318
6589
|
} else {
|
|
@@ -8768,6 +9039,18 @@ function resolveHistoryViewportHeight(terminalRows, composerRows, foregroundRese
|
|
|
8768
9039
|
return Math.max(0, rows - composer - reserved);
|
|
8769
9040
|
}
|
|
8770
9041
|
|
|
9042
|
+
// packages/cli/tui/redactSecrets.ts
|
|
9043
|
+
var REDACTED = "\u27E8redacted\u27E9";
|
|
9044
|
+
function redactSecrets(text) {
|
|
9045
|
+
return text.replace(/\b(?:sk|pk)-[A-Za-z0-9_-]{10,}/g, REDACTED).replace(/\b(Bearer\s+)[A-Za-z0-9._~+/=-]{12,}/gi, `$1${REDACTED}`).replace(
|
|
9046
|
+
/\b((?:api[_-]?key|apikey|access[_-]?token|auth[_-]?token|token|secret|password|passwd|credential)s?\s*[=:]\s*["']?)[^\s"',;]{8,}/gi,
|
|
9047
|
+
`$1${REDACTED}`
|
|
9048
|
+
).replace(
|
|
9049
|
+
/\b((?:--[a-z-]*(?:token|key|secret|password|credential)[a-z-]*)\s+)[^\s"']{8,}/gi,
|
|
9050
|
+
`$1${REDACTED}`
|
|
9051
|
+
);
|
|
9052
|
+
}
|
|
9053
|
+
|
|
8771
9054
|
// packages/cli/tui/shellCommandGist.ts
|
|
8772
9055
|
function baseName(path2) {
|
|
8773
9056
|
const cleaned = path2.replace(/^['"]|['"]$/g, "").replace(/\/+$/, "");
|
|
@@ -9136,6 +9419,42 @@ function summarizeShellCommand(command) {
|
|
|
9136
9419
|
return { summary, foldedSegments: segments.length };
|
|
9137
9420
|
}
|
|
9138
9421
|
|
|
9422
|
+
// packages/cli/tui/askTextSanitize.ts
|
|
9423
|
+
var ASK_SECRET_PLACEHOLDER = "\u27E8redacted\u27E9";
|
|
9424
|
+
var C0_C1_CONTROL_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
|
|
9425
|
+
var NORMAL_GIST_SECRET_PATTERNS = [
|
|
9426
|
+
/\bbearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
9427
|
+
/\bsk-(?:ant-)?(?:api)?[0-9a-zA-Z-]{10,}/,
|
|
9428
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{10,}/,
|
|
9429
|
+
/\bxox[baprs]-[A-Za-z0-9-]{10,}/
|
|
9430
|
+
];
|
|
9431
|
+
function withholdIfSecretLike(gist) {
|
|
9432
|
+
if (!gist) return "";
|
|
9433
|
+
if (findPotentialSecrets(gist).length > 0) return "";
|
|
9434
|
+
if (NORMAL_GIST_SECRET_PATTERNS.some((pattern) => pattern.test(gist))) return "";
|
|
9435
|
+
return gist;
|
|
9436
|
+
}
|
|
9437
|
+
function toText(value) {
|
|
9438
|
+
return typeof value === "string" ? value : String(value ?? "");
|
|
9439
|
+
}
|
|
9440
|
+
function cleanAskText(value) {
|
|
9441
|
+
return stripAnsi(toText(value)).replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").replace(C0_C1_CONTROL_REGEX, "").replace(/\s+/g, " ").trim();
|
|
9442
|
+
}
|
|
9443
|
+
function safeAskText(value, max) {
|
|
9444
|
+
const cleaned = redactSecrets(cleanAskText(value));
|
|
9445
|
+
if (!cleaned) return "";
|
|
9446
|
+
const guarded = withholdIfSecretLike(cleaned) || ASK_SECRET_PLACEHOLDER;
|
|
9447
|
+
return max === void 0 ? guarded : clipCompactText(guarded, max, "\u2026");
|
|
9448
|
+
}
|
|
9449
|
+
function safeApprovalMultilineText(value) {
|
|
9450
|
+
const lines = stripAnsi(String(value ?? "")).replace(/\r\n?|\u2028|\u2029/g, "\n").split("\n");
|
|
9451
|
+
return lines.map((line) => {
|
|
9452
|
+
const cleaned = line.replace(/\t/g, " ").replace(C0_C1_CONTROL_REGEX, "");
|
|
9453
|
+
const redacted = redactSecrets(cleaned);
|
|
9454
|
+
return redacted ? withholdIfSecretLike(redacted) || ASK_SECRET_PLACEHOLDER : "";
|
|
9455
|
+
}).join("\n");
|
|
9456
|
+
}
|
|
9457
|
+
|
|
9139
9458
|
// node_modules/diff/libesm/diff/base.js
|
|
9140
9459
|
var Diff = class {
|
|
9141
9460
|
diff(oldStr, newStr, options = {}) {
|
|
@@ -9483,10 +9802,20 @@ function isRunToolName(name) {
|
|
|
9483
9802
|
return name === "execShell" || name === "runCommand" || name === "launchProcess";
|
|
9484
9803
|
}
|
|
9485
9804
|
function isFailedToolResult(event) {
|
|
9486
|
-
|
|
9487
|
-
|
|
9805
|
+
if (event.type === "tool-error") return true;
|
|
9806
|
+
const metadata = event.metadata ?? {};
|
|
9807
|
+
if (metadata.actionGate) return false;
|
|
9808
|
+
const exitCode = metadata.exitCode;
|
|
9488
9809
|
if (typeof exitCode === "number" && exitCode !== 0) return true;
|
|
9489
|
-
|
|
9810
|
+
if (Boolean(metadata.timedOut) || Boolean(metadata.failed) || Boolean(event.metadata?.failed)) return true;
|
|
9811
|
+
if (metadata.success === false) return true;
|
|
9812
|
+
if (typeof metadata.error === "string" && metadata.error.trim().length > 0) return true;
|
|
9813
|
+
if (typeof metadata.errorMessage === "string" && metadata.errorMessage.trim().length > 0) return true;
|
|
9814
|
+
if (typeof event.content === "string") {
|
|
9815
|
+
const trimmed = event.content.trim();
|
|
9816
|
+
if (/^\[工具\s*"[^"]+"\s*执行失败:\s*[^\]]+\]$/.test(trimmed)) return true;
|
|
9817
|
+
}
|
|
9818
|
+
return false;
|
|
9490
9819
|
}
|
|
9491
9820
|
function parseUiAskChoiceForCli(event) {
|
|
9492
9821
|
if (event.toolName !== "ask_user" && !event.metadata?.uiAskChoice) {
|
|
@@ -9526,9 +9855,9 @@ function formatUiAskChoiceBlock(event, colorEnabled) {
|
|
|
9526
9855
|
lines.push("");
|
|
9527
9856
|
const questionText = safeAskText(parsed.question, 200);
|
|
9528
9857
|
if (colorEnabled) {
|
|
9529
|
-
lines.push(`${themeText("
|
|
9858
|
+
lines.push(`${themeText("? ", "info", true)}${styleCliText(questionText, "cyan", true)}`);
|
|
9530
9859
|
} else {
|
|
9531
|
-
lines.push(
|
|
9860
|
+
lines.push(`? ${questionText}`);
|
|
9532
9861
|
}
|
|
9533
9862
|
if (parsed.resolved) {
|
|
9534
9863
|
if (parsed.cancelled) {
|
|
@@ -9949,6 +10278,7 @@ function snippetLinesWithKind(snippet, kind, maxWidth = resolveEditSnippetMaxWid
|
|
|
9949
10278
|
return lines.slice(0, EDIT_SNIPPET_MAX_LINES).map((line) => buildEditLine(kind, line, maxWidth));
|
|
9950
10279
|
}
|
|
9951
10280
|
function truncateByDisplayWidth(line, maxWidth) {
|
|
10281
|
+
if (maxWidth <= 0) return "";
|
|
9952
10282
|
if (displayWidth(line) <= maxWidth) return line;
|
|
9953
10283
|
let width = 0;
|
|
9954
10284
|
let kept = "";
|
|
@@ -10075,7 +10405,7 @@ function memoryToolGist(toolName, metadata) {
|
|
|
10075
10405
|
function normalToolGistRaw(event) {
|
|
10076
10406
|
const metadata = event.metadata ?? {};
|
|
10077
10407
|
const toolName = event.toolName || "";
|
|
10078
|
-
if (toolName === "readFile") {
|
|
10408
|
+
if (toolName === "readFile" || toolName === "writeFile" || toolName === "editFile") {
|
|
10079
10409
|
const path3 = typeof metadata.path === "string" ? metadata.path : typeof metadata.filePath === "string" ? metadata.filePath : "";
|
|
10080
10410
|
if (path3) return gistClip(formatReadItemPath(path3, metadata), 52);
|
|
10081
10411
|
}
|
|
@@ -10118,6 +10448,21 @@ function formatNormalToolDuration(elapsedMs) {
|
|
|
10118
10448
|
if (elapsedMs < 1e3) return `${Math.round(elapsedMs)}ms`;
|
|
10119
10449
|
return `${(elapsedMs / 1e3).toFixed(1)}s`;
|
|
10120
10450
|
}
|
|
10451
|
+
function normalResultSummary(event) {
|
|
10452
|
+
const m = event.metadata ?? {};
|
|
10453
|
+
const count = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
|
|
10454
|
+
if (event.toolName === "readFile" && count(m.startLine) && count(m.endLine))
|
|
10455
|
+
return `${Math.max(0, m.endLine - m.startLine + 1)} lines${m.truncated ? " \xB7 truncated" : ""}`;
|
|
10456
|
+
if (event.toolName === "writeFile" && count(m.bytes)) return `${m.bytes} bytes written`;
|
|
10457
|
+
if (event.toolName === "editFile" && count(m.replacements)) return `${m.replacements} replacements`;
|
|
10458
|
+
if (event.toolName === "searchText" && count(m.matchCount)) return `${m.matchCount} matches${m.truncated ? " \xB7 truncated" : ""}`;
|
|
10459
|
+
return "";
|
|
10460
|
+
}
|
|
10461
|
+
function fitNormalLine(head, tail, budget) {
|
|
10462
|
+
const status = budget === 1 ? tail.trimStart().slice(0, 1) : truncateByDisplayWidth(tail.trimStart(), budget);
|
|
10463
|
+
const room = Math.max(0, budget - displayWidth(status) - 2);
|
|
10464
|
+
return room ? `${truncateByDisplayWidth(head, room)} ${status}` : status;
|
|
10465
|
+
}
|
|
10121
10466
|
function formatNormalToolLine(event, pending, colorEnabled, opts) {
|
|
10122
10467
|
if (event.type === "tool-call") return "";
|
|
10123
10468
|
const toolName = event.toolName || pending?.toolName || "tool";
|
|
@@ -10138,27 +10483,41 @@ function formatNormalToolLine(event, pending, colorEnabled, opts) {
|
|
|
10138
10483
|
return formatShowInteractionBlock(event, colorEnabled);
|
|
10139
10484
|
}
|
|
10140
10485
|
const label = toolLabel(toolName);
|
|
10486
|
+
const cols = typeof process !== "undefined" && typeof process.stdout?.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : 80;
|
|
10487
|
+
const totalBudget = Math.max(1, resolveHistoryLayoutGeometry(cols).contentWidth - displayWidth("\u25C8 "));
|
|
10141
10488
|
if (readActionGate(event.metadata?.actionGate)) {
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10489
|
+
const actionText = t("toolNeedsAction");
|
|
10490
|
+
const prefix = `\u25B8 ${label} ! `;
|
|
10491
|
+
const maxActionWidth = Math.max(0, totalBudget - displayWidth(prefix));
|
|
10492
|
+
const fittedAction = maxActionWidth > 0 && displayWidth(actionText) > maxActionWidth ? truncateByDisplayWidth(actionText, maxActionWidth) : maxActionWidth > 0 ? actionText : "";
|
|
10493
|
+
return formatToolTraceLine(fitNormalLine(`\u25B8 ${label}`, `! ${fittedAction}`, totalBudget), colorEnabled, "error");
|
|
10494
|
+
}
|
|
10495
|
+
if (event.type === "tool-error" || event.metadata?.timedOut || isFailedToolResult(event)) {
|
|
10496
|
+
const reason = event.metadata?.timedOut ? t("toolTimedOut") : toolFailureReason(event) || t("toolFailed");
|
|
10497
|
+
const prefix = `\u25B8 ${label} \u2717 `;
|
|
10498
|
+
const maxReasonWidth = Math.max(0, totalBudget - displayWidth(prefix));
|
|
10499
|
+
const fittedReason = maxReasonWidth > 0 && displayWidth(reason) > maxReasonWidth ? truncateByDisplayWidth(reason, maxReasonWidth) : maxReasonWidth > 0 ? reason : "";
|
|
10500
|
+
return formatToolTraceLine(fitNormalLine(`\u25B8 ${label}`, `\u2717 ${fittedReason}`, totalBudget), colorEnabled, "error");
|
|
10501
|
+
}
|
|
10502
|
+
const resultSummary = normalResultSummary(event);
|
|
10503
|
+
const gist = [normalToolGist(event), resultSummary].filter(Boolean).join(" \xB7 ");
|
|
10154
10504
|
const hint = editFileResultHint(event);
|
|
10155
10505
|
const statsInline = hint?.inline ? ` ${hint.inline}` : "";
|
|
10156
10506
|
const durationInline = formatNormalToolDuration(event.elapsedMs);
|
|
10157
10507
|
const tail = durationInline ? ` \u2713 ${durationInline}` : " \u2713";
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10508
|
+
let fittedGist = gist;
|
|
10509
|
+
if (gist) {
|
|
10510
|
+
const prefix = `\u25B8 ${label} \xB7 `;
|
|
10511
|
+
const suffix = `${statsInline}${tail}`;
|
|
10512
|
+
const prefixWidth = displayWidth(prefix);
|
|
10513
|
+
const suffixWidth = displayWidth(suffix);
|
|
10514
|
+
const maxGistWidth = Math.max(0, totalBudget - prefixWidth - suffixWidth);
|
|
10515
|
+
if (displayWidth(gist) > maxGistWidth) {
|
|
10516
|
+
fittedGist = maxGistWidth > 0 ? truncateByDisplayWidth(gist, maxGistWidth) : "";
|
|
10517
|
+
}
|
|
10518
|
+
}
|
|
10519
|
+
const lineContent = fittedGist ? `\u25B8 ${label} \xB7 ${fittedGist}${statsInline}${tail}` : `\u25B8 ${label}${statsInline}${tail}`;
|
|
10520
|
+
const mainLine = formatToolTraceLine(fitNormalLine(lineContent.slice(0, -tail.length), tail, totalBudget), colorEnabled);
|
|
10162
10521
|
if (hint?.detail?.length) {
|
|
10163
10522
|
const filePath = typeof event.metadata?.path === "string" ? event.metadata.path : void 0;
|
|
10164
10523
|
return `${mainLine}${formatEditDetailBlock(hint.detail, colorEnabled, filePath)}`;
|
|
@@ -10257,19 +10616,21 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10257
10616
|
const label = kind === "Run" ? toolLabel("execShell") : kind === "Read" ? toolLabel("readFile") : kind === "Fetch" ? toolLabel("fetchWebpage") : toolLabel("exa_search");
|
|
10258
10617
|
const header = `${label} (${items.length}) \xB7 `;
|
|
10259
10618
|
const columns = resolveHistoryLayoutGeometry(process.stdout.columns).contentWidth - displayWidth("\u25C8 ");
|
|
10619
|
+
const budget = Math.max(1, columns);
|
|
10260
10620
|
let shown = 1;
|
|
10261
10621
|
for (let count = 2; count <= items.length; count++) {
|
|
10262
|
-
const
|
|
10263
|
-
|
|
10264
|
-
if (displayWidth(`\u2022 ${header}${items.slice(0, count).join(", ")}${suffix} \u2713`) > columns) break;
|
|
10622
|
+
const suffix = count < items.length ? ", \u2026" : "";
|
|
10623
|
+
if (displayWidth(`\u25B8 ${header}${items.slice(0, count).join(", ")}${suffix} \u2713`) > budget) break;
|
|
10265
10624
|
shown = count;
|
|
10266
10625
|
}
|
|
10267
|
-
const
|
|
10626
|
+
const summary = fitNormalLine(`${header}${items.slice(0, shown).join(", ")}${shown < items.length ? ", \u2026" : ""}`, "\u2713", Math.max(1, budget - 2));
|
|
10268
10627
|
const payload = {
|
|
10269
10628
|
kind,
|
|
10270
|
-
summary
|
|
10271
|
-
fallback
|
|
10629
|
+
summary,
|
|
10630
|
+
fallback,
|
|
10631
|
+
previousRow: tree?.lastRow
|
|
10272
10632
|
};
|
|
10633
|
+
if (tree) tree.lastRow = `\u25B8 ${summary}`;
|
|
10273
10634
|
return `${TUI_TREE_MARKER}${JSON.stringify(payload)}${TUI_TREE_END}
|
|
10274
10635
|
`;
|
|
10275
10636
|
};
|
|
@@ -10297,7 +10658,11 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
|
|
|
10297
10658
|
item = withholdIfSecretLike(item) || toolLabel(name);
|
|
10298
10659
|
if (tree?.kind !== kind) tree = { kind, items: [] };
|
|
10299
10660
|
tree.items.push(item);
|
|
10300
|
-
if (tree.items.length < 2)
|
|
10661
|
+
if (tree.items.length < 2) {
|
|
10662
|
+
const line = formatNormalToolLine(event, call, colorEnabled, opts);
|
|
10663
|
+
tree.lastRow = stripAnsi(line).trimEnd();
|
|
10664
|
+
return line;
|
|
10665
|
+
}
|
|
10301
10666
|
return treeLine(kind, tree.items, formatNormalToolLine(event, call, colorEnabled, opts));
|
|
10302
10667
|
};
|
|
10303
10668
|
const format = (event) => {
|
|
@@ -11347,57 +11712,9 @@ function isBalanceExhaustedError(error) {
|
|
|
11347
11712
|
return matchesBalanceError(message);
|
|
11348
11713
|
}
|
|
11349
11714
|
|
|
11350
|
-
// packages/cli/client/hostTaskWorkspaceAssessment.ts
|
|
11351
|
-
import { resolve as resolve3 } from "node:path";
|
|
11352
|
-
var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
11353
|
-
var present = (value) => typeof value === "string" && value.trim().length > 0;
|
|
11354
|
-
function resolveCurrentHostTaskReference(input) {
|
|
11355
|
-
const ref = input.reference;
|
|
11356
|
-
if (!ref || !present(ref.taskId) || !present(ref.workspace) || !present(ref.dialogId) || ref.dialogId !== input.dialogId || resolve3(ref.workspace) !== resolve3(input.workspace) || readHostTask(hostTaskEventsRoot(input.env), ref).authorization === "unknown") return void 0;
|
|
11357
|
-
return structuredClone(ref);
|
|
11358
|
-
}
|
|
11359
|
-
async function assessHostTaskWorkspace(input) {
|
|
11360
|
-
const ref = resolveCurrentHostTaskReference(input);
|
|
11361
|
-
if (!ref) return void 0;
|
|
11362
|
-
const root = hostTaskEventsRoot(input.env);
|
|
11363
|
-
const blocked = (reason, businessReason = "invalid_contract") => ({
|
|
11364
|
-
exitCode: 1,
|
|
11365
|
-
hostTaskWorkspaceBlocker: reason,
|
|
11366
|
-
businessCompletion: { taskId: ref.taskId, status: "blocked", reasons: [businessReason] }
|
|
11367
|
-
});
|
|
11368
|
-
const fresh = await collectHostTaskWorkspace(ref, input.env);
|
|
11369
|
-
const plan = readHostTaskAcceptancePlan(ref, input.env);
|
|
11370
|
-
let planned;
|
|
11371
|
-
if (plan) {
|
|
11372
|
-
try {
|
|
11373
|
-
planned = { status: "ready", context: await collectHostTaskPlannedWorkspace(ref, input.env) };
|
|
11374
|
-
} catch {
|
|
11375
|
-
planned = { status: "blocked", reason: "task_planned_workspace_unavailable" };
|
|
11376
|
-
}
|
|
11377
|
-
}
|
|
11378
|
-
const authority = readHostTask(root, ref).authorization;
|
|
11379
|
-
if (authority === "paused" || authority === "revoked") return blocked(`authorization_${authority}`, `authorization_${authority}`);
|
|
11380
|
-
if (authority !== "active") return blocked("task_authority_unavailable");
|
|
11381
|
-
const supplied = object(input.evidence);
|
|
11382
|
-
if (supplied?.status === "blocked") return blocked(present(supplied.reason) ? supplied.reason : "workspace_blocked");
|
|
11383
|
-
if (fresh.status === "blocked") return blocked(fresh.reason);
|
|
11384
|
-
if (planned?.status === "blocked") return blocked(planned.reason);
|
|
11385
|
-
if (planned?.status === "ready" && planned.context.baseline !== fresh.context.baseline) {
|
|
11386
|
-
return blocked("task_plan_baseline_mismatch");
|
|
11387
|
-
}
|
|
11388
|
-
const context = object(supplied?.context);
|
|
11389
|
-
const scope = object(context?.scope);
|
|
11390
|
-
if (supplied?.status !== "ready" || !context || !scope || scope.taskId !== ref.taskId || scope.dialogId !== ref.dialogId || scope.taskInstanceId !== ref.taskInstanceId || !present(scope.workspace) || resolve3(scope.workspace) !== resolve3(ref.workspace)) return blocked("workspace_evidence_mismatch");
|
|
11391
|
-
const matches = (canonical) => context.baseline === canonical.baseline && context.revision === canonical.revision && Array.isArray(context.taskPaths) && context.taskPaths.length === canonical.taskPaths.length && context.taskPaths.every((path2, index) => path2 === canonical.taskPaths[index]);
|
|
11392
|
-
if (!matches(fresh.context) && !(planned?.status === "ready" && matches(planned.context))) {
|
|
11393
|
-
return blocked("workspace_evidence_mismatch");
|
|
11394
|
-
}
|
|
11395
|
-
return void 0;
|
|
11396
|
-
}
|
|
11397
|
-
|
|
11398
11715
|
// packages/cli/client/agentRun.ts
|
|
11399
11716
|
async function loadRunLocalAgentTurn() {
|
|
11400
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
11717
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-GOX2DIY7.js");
|
|
11401
11718
|
return runLocalAgentTurn;
|
|
11402
11719
|
}
|
|
11403
11720
|
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();
|
|
@@ -11829,9 +12146,9 @@ function isStandaloneResetSentence(text, index) {
|
|
|
11829
12146
|
var RATE_LIMIT_DETAIL_MAX_CHARS = 140;
|
|
11830
12147
|
var UPSTREAM_TAG_MAX_CHARS = 64;
|
|
11831
12148
|
function findJsonObjectEnd(text, from) {
|
|
11832
|
-
const
|
|
11833
|
-
if (
|
|
11834
|
-
const close =
|
|
12149
|
+
const open2 = text[from];
|
|
12150
|
+
if (open2 !== "{" && open2 !== "[") return -1;
|
|
12151
|
+
const close = open2 === "{" ? "}" : "]";
|
|
11835
12152
|
let depth = 0;
|
|
11836
12153
|
let inString = false;
|
|
11837
12154
|
let escaped = false;
|
|
@@ -11844,7 +12161,7 @@ function findJsonObjectEnd(text, from) {
|
|
|
11844
12161
|
continue;
|
|
11845
12162
|
}
|
|
11846
12163
|
if (ch === '"') inString = true;
|
|
11847
|
-
else if (ch ===
|
|
12164
|
+
else if (ch === open2) depth += 1;
|
|
11848
12165
|
else if (ch === close) {
|
|
11849
12166
|
depth -= 1;
|
|
11850
12167
|
if (depth === 0) return i + 1;
|
|
@@ -12567,12 +12884,6 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12567
12884
|
} : void 0;
|
|
12568
12885
|
const currentDialogId = options.continueDialogId ?? ulid2();
|
|
12569
12886
|
const freshDialog = options.freshDialog ?? !options.continueDialogId;
|
|
12570
|
-
options = { ...options, hostTaskRef: resolveCurrentHostTaskReference({
|
|
12571
|
-
reference: options.hostTaskRef,
|
|
12572
|
-
workspace: options.localRuntimeCwd ?? process.cwd(),
|
|
12573
|
-
dialogId: currentDialogId,
|
|
12574
|
-
env: options.env
|
|
12575
|
-
}) };
|
|
12576
12887
|
const turnId = `turn-${ulid2()}`;
|
|
12577
12888
|
const runtimeContextWithOwnership = {
|
|
12578
12889
|
...runtimeContext ?? {},
|
|
@@ -12580,80 +12891,8 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12580
12891
|
turnId,
|
|
12581
12892
|
getProcessCausalDepth: options.getProcessCausalDepth
|
|
12582
12893
|
};
|
|
12583
|
-
const installReviewHost = baseAdapter.installTaskReviewHost;
|
|
12584
|
-
if (options.hostTaskRef && installReviewHost) {
|
|
12585
|
-
const scope = structuredClone(options.hostTaskRef);
|
|
12586
|
-
const authorExecutionId = createHostAuthorExecution(options.env, scope, turnId);
|
|
12587
|
-
installReviewHost({ scope, authorExecutionId, authorize: async () => {
|
|
12588
|
-
if (!scope.taskId?.trim() || !scope.workspace?.trim() || !scope.dialogId?.trim() || scope.dialogId !== currentDialogId || resolveHostReviewPath(scope.workspace) !== resolveHostReviewPath(options.localRuntimeCwd ?? process.cwd())) throw new Error("task_review_host_scope_mismatch");
|
|
12589
|
-
} });
|
|
12590
|
-
}
|
|
12591
|
-
let reviewContext;
|
|
12592
|
-
const requestedReview = options.hostReviewDispatch;
|
|
12593
|
-
if (requestedReview && options.hostTaskRef && requestedReview.scope.taskId === options.hostTaskRef.taskId && requestedReview.scope.dialogId === currentDialogId && resolveHostReviewPath(requestedReview.scope.workspace) === resolveHostReviewPath(options.hostTaskRef.workspace)) {
|
|
12594
|
-
reviewContext = { ...requestedReview, authorExecutionId: createHostAuthorExecution(options.env, options.hostTaskRef, turnId) };
|
|
12595
|
-
}
|
|
12596
12894
|
const commandVersionBindings = /* @__PURE__ */ new Map();
|
|
12597
12895
|
const commandAdapter = !options.runtimeKey || options.runtimeKey === "local" ? wrapLocalCommandWorkspaceObservation(baseAdapter, options.localRuntimeCwd ?? process.cwd(), commandVersionBindings, void 0, options.abortSignal) : baseAdapter;
|
|
12598
|
-
const reviewAdapter = {
|
|
12599
|
-
...commandAdapter,
|
|
12600
|
-
executeTool: async (call, opts) => {
|
|
12601
|
-
let args = {};
|
|
12602
|
-
try {
|
|
12603
|
-
args = typeof call.arguments === "string" ? JSON.parse(call.arguments) : call.arguments ?? {};
|
|
12604
|
-
} catch {
|
|
12605
|
-
}
|
|
12606
|
-
const matched = call.name === "startAgentRun" && matchesHostReviewDispatch(reviewContext, call, args);
|
|
12607
|
-
const result = await withHostReviewDispatch(matched ? reviewContext : void 0, () => commandAdapter.executeTool(call, opts));
|
|
12608
|
-
return result;
|
|
12609
|
-
}
|
|
12610
|
-
};
|
|
12611
|
-
const completionEvidenceProvider = options.hostTaskRef ? options.hostTaskCompletionEvidenceProvider : void 0;
|
|
12612
|
-
let hostTask = bindHostTask({
|
|
12613
|
-
adapter: reviewAdapter,
|
|
12614
|
-
reference: options.hostTaskRef,
|
|
12615
|
-
workspace: options.localRuntimeCwd ?? process.cwd(),
|
|
12616
|
-
dialogId: currentDialogId,
|
|
12617
|
-
env: options.env,
|
|
12618
|
-
signal: options.abortSignal,
|
|
12619
|
-
completionEvidenceProvider
|
|
12620
|
-
});
|
|
12621
|
-
if (options.hostTaskRef && options.hostTaskWorkspaceEvidence !== void 0 && readHostTask(hostTaskEventsRoot(options.env), options.hostTaskRef).authorization === "active") {
|
|
12622
|
-
const blocker = await assessHostTaskWorkspace({
|
|
12623
|
-
reference: options.hostTaskRef,
|
|
12624
|
-
workspace: options.localRuntimeCwd ?? process.cwd(),
|
|
12625
|
-
dialogId: currentDialogId,
|
|
12626
|
-
env: options.env,
|
|
12627
|
-
evidence: options.hostTaskWorkspaceEvidence
|
|
12628
|
-
});
|
|
12629
|
-
if (blocker) {
|
|
12630
|
-
options.output.write(`[auto-review] blocked: ${blocker.hostTaskWorkspaceBlocker}
|
|
12631
|
-
`);
|
|
12632
|
-
try {
|
|
12633
|
-
const saved = await reviewAdapter.saveTurn({
|
|
12634
|
-
agentKey: options.agentKey,
|
|
12635
|
-
messages: [{ role: "user", content: options.message }],
|
|
12636
|
-
continueDialogId: currentDialogId,
|
|
12637
|
-
runtimeContext: runtimeContextWithOwnership,
|
|
12638
|
-
result: {
|
|
12639
|
-
model: "host-workspace-assessment",
|
|
12640
|
-
content: "",
|
|
12641
|
-
error: true,
|
|
12642
|
-
businessCompletion: blocker.businessCompletion
|
|
12643
|
-
}
|
|
12644
|
-
});
|
|
12645
|
-
return {
|
|
12646
|
-
...blocker,
|
|
12647
|
-
hostTaskRef: options.hostTaskRef,
|
|
12648
|
-
dialogId: saved.dialogId,
|
|
12649
|
-
taskAuthorization: readHostTask(hostTaskEventsRoot(options.env), options.hostTaskRef).authorization
|
|
12650
|
-
};
|
|
12651
|
-
} catch (localError) {
|
|
12652
|
-
return { ...blocker, hostTaskRef: options.hostTaskRef, localError };
|
|
12653
|
-
}
|
|
12654
|
-
}
|
|
12655
|
-
}
|
|
12656
|
-
let usedReviewTool = false;
|
|
12657
12896
|
let batchProviderStarted = false;
|
|
12658
12897
|
let mainProviderStarted = false;
|
|
12659
12898
|
let refusalModel = "";
|
|
@@ -12676,9 +12915,9 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12676
12915
|
}
|
|
12677
12916
|
};
|
|
12678
12917
|
const adapter = {
|
|
12679
|
-
...
|
|
12918
|
+
...commandAdapter,
|
|
12680
12919
|
resolveProvider: async (...args) => {
|
|
12681
|
-
const provider = await
|
|
12920
|
+
const provider = await commandAdapter.resolveProvider(...args);
|
|
12682
12921
|
const isTextOnly = Boolean(args[1]?.textOnly);
|
|
12683
12922
|
if (!isTextOnly) refusalModel = provider.model;
|
|
12684
12923
|
return {
|
|
@@ -12695,26 +12934,8 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12695
12934
|
}
|
|
12696
12935
|
};
|
|
12697
12936
|
},
|
|
12698
|
-
|
|
12699
|
-
const protectedReview = call.name === "requestTaskReview" || call.name === "recordTaskReviewDecision";
|
|
12700
|
-
if (!protectedReview) return reviewAdapter.executeTool(call, opts);
|
|
12701
|
-
usedReviewTool = true;
|
|
12702
|
-
if (options.hostTaskRef?.taskInstanceId) {
|
|
12703
|
-
const authorize = baseAdapter.authorizeAccountTask;
|
|
12704
|
-
if (!authorize) throw new Error("task_review_account_authorization_unavailable");
|
|
12705
|
-
await authorize(options.hostTaskRef);
|
|
12706
|
-
}
|
|
12707
|
-
if (!options.hostTaskRef && ["requestTaskReview", "recordTaskReviewDecision"].includes(call.name)) {
|
|
12708
|
-
const admit = baseAdapter.admitAccountReviewTurn;
|
|
12709
|
-
if (!admit) throw new Error("task_review_account_admission_unavailable");
|
|
12710
|
-
const reference = await admit(currentDialogId, turnId);
|
|
12711
|
-
options = { ...options, hostTaskRef: reference };
|
|
12712
|
-
hostTask = bindHostTask({ adapter: reviewAdapter, reference, workspace: options.localRuntimeCwd ?? process.cwd(), dialogId: currentDialogId, env: options.env, signal: options.abortSignal });
|
|
12713
|
-
}
|
|
12714
|
-
return hostTask.adapter.executeTool(call, opts);
|
|
12715
|
-
},
|
|
12937
|
+
// 工具执行直接走 ...commandAdapter 展开(无需再写一行透传)。
|
|
12716
12938
|
saveTurn: async (input) => {
|
|
12717
|
-
if (usedReviewTool && options.hostTaskRef) await settleHostReviewsForScope(options.hostTaskRef, options.env, options.hostReviewContentAcceptance);
|
|
12718
12939
|
const completeBatch = Boolean(batchIdentity && batchProviderStarted && !input.result.error);
|
|
12719
12940
|
const injectedBatches = options.drainInjectedBatches ?? [];
|
|
12720
12941
|
const injectedMessageIds = new Set(injectedBatches.flatMap((batch) => batch.messageIds));
|
|
@@ -12723,7 +12944,7 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12723
12944
|
...!input.result.error ? injectedBatches.map((batch) => batch.batchId) : []
|
|
12724
12945
|
];
|
|
12725
12946
|
try {
|
|
12726
|
-
const saved = await
|
|
12947
|
+
const saved = await commandAdapter.saveTurn({
|
|
12727
12948
|
...input,
|
|
12728
12949
|
messages: input.messages.filter((message) => {
|
|
12729
12950
|
const cliMessageId = message.cliMessageId;
|
|
@@ -12771,7 +12992,6 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12771
12992
|
const runLocalAgentTurn = await loadRunLocalAgentTurn();
|
|
12772
12993
|
const result = await runLocalAgentTurn({
|
|
12773
12994
|
adapter,
|
|
12774
|
-
...hostTask.contract ? { taskExecutionContract: hostTask.contract } : {},
|
|
12775
12995
|
agentRef: options.agentKey,
|
|
12776
12996
|
userLanguage: options.userLanguage ?? options.env.NOLO_LANG ?? null,
|
|
12777
12997
|
input: buildUserInputContent(messageForLocal, options.imageUrls),
|
|
@@ -12864,8 +13084,6 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12864
13084
|
mainProviderAttempted: mainProviderStarted,
|
|
12865
13085
|
exitCode: 0,
|
|
12866
13086
|
stopReason: result.stopReason,
|
|
12867
|
-
...hostTask.result(),
|
|
12868
|
-
...options.hostTaskRef ? { hostTaskRef: options.hostTaskRef } : {},
|
|
12869
13087
|
dialogId: result.dialogId,
|
|
12870
13088
|
...typeof result.content === "string" && result.content.trim() ? { finalText: result.content } : {},
|
|
12871
13089
|
...result.title !== void 0 ? { title: result.title } : {},
|
|
@@ -12903,10 +13121,8 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12903
13121
|
const pendingToolName = error?.pendingToolName;
|
|
12904
13122
|
return retainCommandObservations({
|
|
12905
13123
|
exitCode: 0,
|
|
12906
|
-
...hostTask.result(),
|
|
12907
13124
|
savedTurnPersisted: turnPersisted,
|
|
12908
13125
|
mainProviderAttempted: mainProviderStarted,
|
|
12909
|
-
...options.hostTaskRef ? { hostTaskRef: options.hostTaskRef } : {},
|
|
12910
13126
|
streamInterrupted: true,
|
|
12911
13127
|
...savedDialogId ? { dialogId: savedDialogId } : {},
|
|
12912
13128
|
...pendingToolName ? { pendingToolName } : {},
|
|
@@ -12952,7 +13168,6 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12952
13168
|
}
|
|
12953
13169
|
return retainCommandObservations({
|
|
12954
13170
|
exitCode: 1,
|
|
12955
|
-
...hostTask.result(),
|
|
12956
13171
|
localError: error,
|
|
12957
13172
|
savedTurnPersisted: persisted,
|
|
12958
13173
|
mainProviderAttempted: mainProviderStarted,
|
|
@@ -13020,7 +13235,6 @@ function foldLocalResultForTui(localResult) {
|
|
|
13020
13235
|
const folded = {
|
|
13021
13236
|
exitCode: localResult.exitCode,
|
|
13022
13237
|
...projectLocalTurnFacts(localResult),
|
|
13023
|
-
...localResult.hostTaskRef ? { hostTaskRef: localResult.hostTaskRef } : {},
|
|
13024
13238
|
...localResult.dialogId ? { dialogId: localResult.dialogId } : {},
|
|
13025
13239
|
title: localResult.title,
|
|
13026
13240
|
...localResult.titlePatchPromise ? { titlePatchPromise: localResult.titlePatchPromise } : {},
|
|
@@ -13364,7 +13578,7 @@ function buildHostEnvironmentLayer(options) {
|
|
|
13364
13578
|
|
|
13365
13579
|
// packages/agent-runtime/agentsMd.ts
|
|
13366
13580
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
13367
|
-
import { resolve as
|
|
13581
|
+
import { resolve as resolve3 } from "node:path";
|
|
13368
13582
|
var AGENTS_MD_MAX_BYTES = 8192;
|
|
13369
13583
|
var AGENTS_MD_MARKER_RESERVE_BYTES = 512;
|
|
13370
13584
|
var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
|
|
@@ -13565,7 +13779,7 @@ ${entry.line}`;
|
|
|
13565
13779
|
};
|
|
13566
13780
|
function readAgentsMdLayerFromDisk(cwd) {
|
|
13567
13781
|
for (const name of AGENTS_MD_CANDIDATES) {
|
|
13568
|
-
const filePath =
|
|
13782
|
+
const filePath = resolve3(cwd, name);
|
|
13569
13783
|
if (!existsSync2(filePath)) continue;
|
|
13570
13784
|
try {
|
|
13571
13785
|
const raw = readFileSync3(filePath, "utf8");
|
|
@@ -13707,16 +13921,16 @@ function runDoDCommands(commands, cwd, deps = {}) {
|
|
|
13707
13921
|
|
|
13708
13922
|
// packages/cli/agentRunPrompts.ts
|
|
13709
13923
|
import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync, statSync as statSync2 } from "node:fs";
|
|
13710
|
-
import { dirname, extname, isAbsolute as isAbsolute2, join as join2, relative as relativePath, resolve as
|
|
13924
|
+
import { dirname, extname, isAbsolute as isAbsolute2, join as join2, relative as relativePath, resolve as resolve4, sep } from "node:path";
|
|
13711
13925
|
function workflowRefToCandidatePath(cwd, ref) {
|
|
13712
13926
|
const normalized = ref.trim();
|
|
13713
13927
|
if (!normalized) return "";
|
|
13714
13928
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
13715
|
-
const directPath =
|
|
13929
|
+
const directPath = resolve4(cwd, normalized);
|
|
13716
13930
|
if (existsSync3(directPath)) return directPath;
|
|
13717
13931
|
}
|
|
13718
13932
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
13719
|
-
return
|
|
13933
|
+
return resolve4(cwd, "docs", "workflows", `${fileName}.md`);
|
|
13720
13934
|
}
|
|
13721
13935
|
var SKILL_SEARCH_DIRS = [
|
|
13722
13936
|
".agents/skills"
|
|
@@ -13725,15 +13939,15 @@ function skillRefToCandidatePath(cwd, ref) {
|
|
|
13725
13939
|
const normalized = ref.trim();
|
|
13726
13940
|
if (!normalized) return "";
|
|
13727
13941
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
13728
|
-
const directPath =
|
|
13942
|
+
const directPath = resolve4(cwd, normalized);
|
|
13729
13943
|
if (existsSync3(directPath)) return directPath;
|
|
13730
13944
|
}
|
|
13731
13945
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
13732
13946
|
for (const dir of SKILL_SEARCH_DIRS) {
|
|
13733
|
-
const skillMdPath =
|
|
13947
|
+
const skillMdPath = resolve4(cwd, dir, fileName, "SKILL.md");
|
|
13734
13948
|
if (existsSync3(skillMdPath)) return skillMdPath;
|
|
13735
13949
|
}
|
|
13736
|
-
return
|
|
13950
|
+
return resolve4(cwd, ".agents", "skills", fileName, "SKILL.md");
|
|
13737
13951
|
}
|
|
13738
13952
|
async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
13739
13953
|
const path2 = workflowRefToCandidatePath(cwd, ref);
|
|
@@ -13750,11 +13964,11 @@ async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
|
13750
13964
|
}
|
|
13751
13965
|
function inlineRelativeRefs(body, skillDir) {
|
|
13752
13966
|
const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
|
|
13753
|
-
const normalizedSkillDir =
|
|
13967
|
+
const normalizedSkillDir = resolve4(skillDir) + sep;
|
|
13754
13968
|
return body.replace(refPattern, (match, label, relPath) => {
|
|
13755
13969
|
const cleaned = relPath.trim();
|
|
13756
13970
|
if (!cleaned.startsWith("./") && !cleaned.startsWith("../")) return match;
|
|
13757
|
-
const absPath =
|
|
13971
|
+
const absPath = resolve4(skillDir, cleaned);
|
|
13758
13972
|
const relative = relativePath(normalizedSkillDir, absPath);
|
|
13759
13973
|
if (relative.startsWith("..") || isAbsolute2(relative)) return match;
|
|
13760
13974
|
if (!existsSync3(absPath) || !absPath.endsWith(".md")) return match;
|
|
@@ -13904,7 +14118,7 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
|
|
|
13904
14118
|
}
|
|
13905
14119
|
function normalizeCliImageInput(input) {
|
|
13906
14120
|
if (/^(https?:|data:|file:)/i.test(input)) return input;
|
|
13907
|
-
const absolutePath =
|
|
14121
|
+
const absolutePath = resolve4(input);
|
|
13908
14122
|
if (!existsSync3(absolutePath)) return input;
|
|
13909
14123
|
const base64 = readFileSync4(absolutePath).toString("base64");
|
|
13910
14124
|
return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
|
|
@@ -14436,7 +14650,7 @@ async function validateMutation(db, ownerId, mutation) {
|
|
|
14436
14650
|
}
|
|
14437
14651
|
}
|
|
14438
14652
|
}
|
|
14439
|
-
var
|
|
14653
|
+
var applyMutationWithoutCoordination = async (db, ownerId, mutation) => {
|
|
14440
14654
|
await validateMutation(db, ownerId, mutation);
|
|
14441
14655
|
const batch = db.batch();
|
|
14442
14656
|
for (const ev of mutation.evidence ?? []) {
|
|
@@ -14469,6 +14683,25 @@ var applyMemoryInterpreterMutation = async (db, ownerId, mutation) => {
|
|
|
14469
14683
|
}
|
|
14470
14684
|
await batch.write();
|
|
14471
14685
|
};
|
|
14686
|
+
var pendingByDb = /* @__PURE__ */ new WeakMap();
|
|
14687
|
+
var applyMemoryInterpreterMutation = async (db, ownerId, mutation) => {
|
|
14688
|
+
let owners = pendingByDb.get(db);
|
|
14689
|
+
if (!owners) {
|
|
14690
|
+
owners = /* @__PURE__ */ new Map();
|
|
14691
|
+
pendingByDb.set(db, owners);
|
|
14692
|
+
}
|
|
14693
|
+
const previous = owners.get(ownerId) ?? Promise.resolve();
|
|
14694
|
+
const operation = previous.then(() => applyMutationWithoutCoordination(db, ownerId, mutation));
|
|
14695
|
+
const settled = operation.then(() => {
|
|
14696
|
+
}, () => {
|
|
14697
|
+
});
|
|
14698
|
+
owners.set(ownerId, settled);
|
|
14699
|
+
try {
|
|
14700
|
+
await operation;
|
|
14701
|
+
} finally {
|
|
14702
|
+
if (owners.get(ownerId) === settled) owners.delete(ownerId);
|
|
14703
|
+
}
|
|
14704
|
+
};
|
|
14472
14705
|
|
|
14473
14706
|
// packages/ai/memory/vnext/legacyMigrationApply.ts
|
|
14474
14707
|
var isSameLegacyMemoryEvidence = (left, right) => left.id === right.id && left.ownerId === right.ownerId && left.text === right.text && left.sourceRef === right.sourceRef && left.confidence === right.confidence && left.createdAt === right.createdAt;
|
|
@@ -15277,245 +15510,275 @@ var selectRuntimeMemoryItems = (items, context, userInput = "") => {
|
|
|
15277
15510
|
return selected;
|
|
15278
15511
|
};
|
|
15279
15512
|
var resolveMemoryRuntime = async (input) => {
|
|
15280
|
-
const
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
});
|
|
15298
|
-
}
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15513
|
+
const configuredPure = isMemoryVNextPureReadEnabled();
|
|
15514
|
+
const configuredPrimary = isMemoryVNextPrimaryReadEnabled();
|
|
15515
|
+
let branch = "no_owner";
|
|
15516
|
+
let outcome = "error";
|
|
15517
|
+
let errorKind = "runtime_error";
|
|
15518
|
+
let fallbackKind = "none";
|
|
15519
|
+
const finish = (result) => {
|
|
15520
|
+
outcome = fallbackKind === "none" ? result.promptBlock ? "result" : "empty" : "fallback";
|
|
15521
|
+
errorKind = fallbackKind;
|
|
15522
|
+
return result;
|
|
15523
|
+
};
|
|
15524
|
+
try {
|
|
15525
|
+
const owners = chooseMemoryOwners({
|
|
15526
|
+
userId: input.userId,
|
|
15527
|
+
spaceId: input.spaceId
|
|
15528
|
+
});
|
|
15529
|
+
if (owners.length === 0) {
|
|
15530
|
+
return finish({ selectedItems: [], promptBlock: null });
|
|
15531
|
+
}
|
|
15532
|
+
if (configuredPure) {
|
|
15533
|
+
branch = "pure";
|
|
15534
|
+
const pureStartedAt = performance.now();
|
|
15535
|
+
let pure;
|
|
15536
|
+
let pureFailed = false;
|
|
15304
15537
|
try {
|
|
15305
|
-
|
|
15306
|
-
input.
|
|
15307
|
-
|
|
15308
|
-
input.
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15538
|
+
pure = await resolvePureVNextRuntime({
|
|
15539
|
+
db: input.db,
|
|
15540
|
+
owners,
|
|
15541
|
+
userInput: input.userInput,
|
|
15542
|
+
maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET
|
|
15543
|
+
});
|
|
15544
|
+
} catch (error) {
|
|
15545
|
+
pureFailed = true;
|
|
15546
|
+
pure = { selectedItems: [], promptBlock: null, recalledStateCount: 0 };
|
|
15547
|
+
}
|
|
15548
|
+
const pureLatencyMs = Math.round((performance.now() - pureStartedAt) * 10) / 10;
|
|
15549
|
+
const emitPureRead = (observation) => {
|
|
15550
|
+
try {
|
|
15551
|
+
if (input.pureReadEmit) {
|
|
15552
|
+
input.pureReadEmit(observation);
|
|
15553
|
+
} else if (input.primaryReadEmit) {
|
|
15554
|
+
input.primaryReadEmit({
|
|
15555
|
+
source: observation.source === "vnext" ? "vnext" : "none",
|
|
15556
|
+
legacyHitCount: 0,
|
|
15557
|
+
recalledStateCount: observation.vnextItemCount,
|
|
15558
|
+
vnextLatencyMs: observation.vnextLatencyMs,
|
|
15559
|
+
legacyLatencyMs: 0,
|
|
15560
|
+
contextChars: observation.contextChars,
|
|
15561
|
+
fallbackReason: observation.fallbackReason,
|
|
15562
|
+
error: observation.error
|
|
15563
|
+
});
|
|
15564
|
+
} else {
|
|
15565
|
+
console.info("[memory] vnext pure read", {
|
|
15566
|
+
event: "memory_vnext_pure_read",
|
|
15567
|
+
...observation
|
|
15568
|
+
});
|
|
15569
|
+
}
|
|
15570
|
+
} catch {
|
|
15571
|
+
}
|
|
15572
|
+
};
|
|
15573
|
+
if (pureFailed) {
|
|
15574
|
+
emitPureRead({
|
|
15575
|
+
source: "none",
|
|
15576
|
+
itemCount: 0,
|
|
15577
|
+
vnextItemCount: 0,
|
|
15578
|
+
vnextLatencyMs: pureLatencyMs,
|
|
15579
|
+
contextChars: 0,
|
|
15580
|
+
fallbackReason: "vnext_error",
|
|
15581
|
+
error: "runtime_error"
|
|
15582
|
+
});
|
|
15583
|
+
} else if (pure.selectedItems.length === 0) {
|
|
15584
|
+
emitPureRead({
|
|
15585
|
+
source: "none",
|
|
15586
|
+
itemCount: 0,
|
|
15587
|
+
vnextItemCount: 0,
|
|
15588
|
+
vnextLatencyMs: pureLatencyMs,
|
|
15589
|
+
contextChars: 0,
|
|
15590
|
+
fallbackReason: "no_vnext_context"
|
|
15591
|
+
});
|
|
15592
|
+
} else {
|
|
15593
|
+
emitPureRead({
|
|
15594
|
+
source: "vnext",
|
|
15595
|
+
itemCount: pure.selectedItems.length,
|
|
15596
|
+
vnextItemCount: pure.recalledStateCount,
|
|
15597
|
+
vnextLatencyMs: pureLatencyMs,
|
|
15598
|
+
contextChars: pure.promptBlock?.length ?? 0
|
|
15599
|
+
});
|
|
15600
|
+
}
|
|
15601
|
+
const lazyPromotionEnabled2 = input.vNextShadowProvider != null && isMemoryVNextLazyPromotionEnabled();
|
|
15602
|
+
if (lazyPromotionEnabled2) {
|
|
15603
|
+
void (async () => {
|
|
15604
|
+
const ownerItems = await Promise.all(
|
|
15605
|
+
owners.map(
|
|
15606
|
+
(owner) => loadOwnerItemsFromDb(
|
|
15607
|
+
input.db,
|
|
15608
|
+
owner,
|
|
15609
|
+
input.ownerLimit ?? DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT
|
|
15610
|
+
)
|
|
15611
|
+
)
|
|
15612
|
+
);
|
|
15613
|
+
const legacyCandidates = ownerItems.flat();
|
|
15614
|
+
if (legacyCandidates.length > 0) {
|
|
15615
|
+
const promotionPick = await pickFirstUncoveredLazyPromotionItem(
|
|
15616
|
+
input.db,
|
|
15617
|
+
legacyCandidates
|
|
15618
|
+
);
|
|
15619
|
+
if (promotionPick) {
|
|
15620
|
+
await runMemoryVNextLazyPromotion({
|
|
15621
|
+
db: input.db,
|
|
15622
|
+
item: promotionPick.item,
|
|
15623
|
+
selectedIndex: promotionPick.selectedIndex,
|
|
15624
|
+
skippedCoveredCount: promotionPick.skippedCoveredCount,
|
|
15625
|
+
skippedNoOpCount: promotionPick.skippedNoOpCount,
|
|
15626
|
+
provider: input.vNextShadowProvider,
|
|
15627
|
+
...input.lazyPromotionEmit ? { emit: input.lazyPromotionEmit } : {}
|
|
15628
|
+
});
|
|
15629
|
+
}
|
|
15630
|
+
}
|
|
15631
|
+
})().catch(() => {
|
|
15632
|
+
});
|
|
15633
|
+
}
|
|
15634
|
+
const result = finish({ selectedItems: pure.selectedItems, promptBlock: pure.promptBlock });
|
|
15635
|
+
if (pureFailed) {
|
|
15636
|
+
outcome = "error";
|
|
15637
|
+
errorKind = "runtime_error";
|
|
15638
|
+
}
|
|
15639
|
+
return result;
|
|
15640
|
+
}
|
|
15641
|
+
branch = "legacy";
|
|
15642
|
+
const policy = resolveAgentMemoryPolicy({ agentKey: input.agentKey });
|
|
15643
|
+
const legacyStartedAt = performance.now();
|
|
15644
|
+
const candidates = await loadMemoryCandidatesFromDb(input.db, {
|
|
15645
|
+
owners,
|
|
15646
|
+
subjects: buildMemorySubjectsForAgent({
|
|
15647
|
+
userId: input.userId,
|
|
15648
|
+
spaceId: input.spaceId,
|
|
15649
|
+
agentKey: input.agentKey,
|
|
15650
|
+
memorySubjectId: input.memorySubjectId,
|
|
15651
|
+
policy
|
|
15652
|
+
}),
|
|
15653
|
+
kinds: ["episodic", "semantic", "procedural"],
|
|
15654
|
+
ownerLimit: input.ownerLimit ?? DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT,
|
|
15655
|
+
ownerFallback: policy.ownerFallback,
|
|
15656
|
+
corroboratedProceduralReserve: input.corroboratedProceduralReserve ?? CORROBORATED_PROCEDURAL_RESERVE
|
|
15657
|
+
});
|
|
15658
|
+
const rankContext = {
|
|
15659
|
+
currentOwner: input.spaceId ? { ownerType: "space", ownerId: input.spaceId } : input.userId ? { ownerType: "user", ownerId: input.userId } : null,
|
|
15660
|
+
currentSubject: input.spaceId ? { subjectType: "space", subjectId: input.spaceId } : input.userId ? { subjectType: "user", subjectId: input.userId } : null
|
|
15661
|
+
};
|
|
15662
|
+
const residentItems = candidates.filter((item) => item.resident === true).sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, RESIDENT_MEMORY_RUNTIME_LIMIT);
|
|
15663
|
+
const retrievalCandidates = candidates.filter((item) => item.resident !== true);
|
|
15664
|
+
const ranked = selectRuntimeMemoryItems(
|
|
15665
|
+
rankMemoryCandidates(retrievalCandidates, input.userInput, rankContext),
|
|
15666
|
+
rankContext,
|
|
15667
|
+
input.userInput
|
|
15668
|
+
);
|
|
15669
|
+
const selected = [...residentItems, ...ranked];
|
|
15670
|
+
const legacyLatencyMs = Math.round((performance.now() - legacyStartedAt) * 10) / 10;
|
|
15671
|
+
const renderOverlay = (items) => items.length === 0 ? null : buildMemoryOverlay(items, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET });
|
|
15672
|
+
let promptBlock = renderOverlay(selected);
|
|
15673
|
+
const primaryRead = configuredPrimary;
|
|
15674
|
+
let allCoveredByVNext = false;
|
|
15675
|
+
if (primaryRead) {
|
|
15676
|
+
branch = "primary";
|
|
15677
|
+
const emitPrimary = (observation) => {
|
|
15678
|
+
try {
|
|
15679
|
+
(input.primaryReadEmit ?? ((o) => console.info("[memory] vnext primary read", { event: "memory_vnext_primary_read", ...o })))(observation);
|
|
15680
|
+
} catch {
|
|
15681
|
+
}
|
|
15682
|
+
};
|
|
15683
|
+
const base = { legacyHitCount: selected.length, legacyLatencyMs };
|
|
15684
|
+
const vnextStartedAt = performance.now();
|
|
15685
|
+
const vnextLatency = () => Math.round((performance.now() - vnextStartedAt) * 10) / 10;
|
|
15686
|
+
if (selected.length === 0) {
|
|
15687
|
+
emitPrimary({ ...base, source: "none" });
|
|
15688
|
+
} else {
|
|
15689
|
+
const timeoutMarker = {};
|
|
15690
|
+
try {
|
|
15691
|
+
let timer;
|
|
15692
|
+
const m4 = await Promise.race([
|
|
15693
|
+
resolveMemoryVNextM4Selection({ db: input.db, owners, query: input.userInput, selected }),
|
|
15694
|
+
new Promise((_, reject) => {
|
|
15695
|
+
timer = setTimeout(
|
|
15696
|
+
() => reject(timeoutMarker),
|
|
15697
|
+
MEMORY_VNEXT_PRIMARY_READ_TIMEOUT_MS
|
|
15698
|
+
);
|
|
15699
|
+
})
|
|
15700
|
+
]).finally(() => clearTimeout(timer));
|
|
15701
|
+
promptBlock = renderOverlay(m4.renderItems);
|
|
15702
|
+
allCoveredByVNext = m4.uncoveredLegacyCount === 0 && m4.recalledStateCount > 0;
|
|
15703
|
+
const source = m4.recalledStateCount > 0 ? m4.uncoveredLegacyCount === 0 ? "vnext" : "hybrid" : m4.uncoveredLegacyCount > 0 ? "legacy_fallback" : "none";
|
|
15704
|
+
emitPrimary({
|
|
15705
|
+
...base,
|
|
15706
|
+
source,
|
|
15707
|
+
uncoveredLegacyCount: m4.uncoveredLegacyCount,
|
|
15708
|
+
coveredSuppressedCount: m4.coveredSuppressedCount,
|
|
15709
|
+
recalledStateCount: m4.recalledStateCount,
|
|
15710
|
+
vnextLatencyMs: vnextLatency(),
|
|
15711
|
+
contextChars: promptBlock?.length ?? 0,
|
|
15712
|
+
...source === "legacy_fallback" ? { fallbackReason: "no_vnext_context" } : {}
|
|
15317
15713
|
});
|
|
15318
|
-
}
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
...
|
|
15714
|
+
} catch (error) {
|
|
15715
|
+
fallbackKind = error === timeoutMarker ? "timeout" : "runtime_error";
|
|
15716
|
+
emitPrimary({
|
|
15717
|
+
...base,
|
|
15718
|
+
source: "legacy_fallback",
|
|
15719
|
+
vnextLatencyMs: vnextLatency(),
|
|
15720
|
+
contextChars: promptBlock?.length ?? 0,
|
|
15721
|
+
fallbackReason: "vnext_error",
|
|
15722
|
+
error: error === timeoutMarker ? "TimeoutError" : "UnknownError"
|
|
15322
15723
|
});
|
|
15323
15724
|
}
|
|
15324
|
-
} catch {
|
|
15325
15725
|
}
|
|
15326
|
-
}
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
itemCount: 0,
|
|
15341
|
-
vnextItemCount: 0,
|
|
15342
|
-
vnextLatencyMs: pureLatencyMs,
|
|
15343
|
-
contextChars: 0,
|
|
15344
|
-
fallbackReason: "no_vnext_context"
|
|
15345
|
-
});
|
|
15346
|
-
} else {
|
|
15347
|
-
emitPureRead({
|
|
15348
|
-
source: "vnext",
|
|
15349
|
-
itemCount: pure.selectedItems.length,
|
|
15350
|
-
vnextItemCount: pure.recalledStateCount,
|
|
15351
|
-
vnextLatencyMs: pureLatencyMs,
|
|
15352
|
-
contextChars: pure.promptBlock?.length ?? 0
|
|
15726
|
+
}
|
|
15727
|
+
const shadowEnabled = !primaryRead && input.vNextShadowProvider != null && isMemoryVNextShadowReadEnabled();
|
|
15728
|
+
if (shadowEnabled) {
|
|
15729
|
+
void runMemoryVNextShadowRead({
|
|
15730
|
+
ctx: {
|
|
15731
|
+
db: input.db,
|
|
15732
|
+
owners,
|
|
15733
|
+
query: input.userInput,
|
|
15734
|
+
provider: input.vNextShadowProvider
|
|
15735
|
+
},
|
|
15736
|
+
legacyItems: selected,
|
|
15737
|
+
legacyLatencyMs,
|
|
15738
|
+
legacyContextChars: promptBlock?.length ?? 0
|
|
15739
|
+
}).catch(() => {
|
|
15353
15740
|
});
|
|
15354
15741
|
}
|
|
15355
|
-
const
|
|
15356
|
-
if (
|
|
15742
|
+
const lazyPromotionEnabled = input.vNextShadowProvider != null && isMemoryVNextLazyPromotionEnabled();
|
|
15743
|
+
if (lazyPromotionEnabled && selected.length > 0 && !allCoveredByVNext) {
|
|
15357
15744
|
void (async () => {
|
|
15358
|
-
const
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
input.db,
|
|
15362
|
-
owner,
|
|
15363
|
-
input.ownerLimit ?? DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT
|
|
15364
|
-
)
|
|
15365
|
-
)
|
|
15745
|
+
const promotionPick = await pickFirstUncoveredLazyPromotionItem(
|
|
15746
|
+
input.db,
|
|
15747
|
+
selected
|
|
15366
15748
|
);
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
selectedIndex: promotionPick.selectedIndex,
|
|
15378
|
-
skippedCoveredCount: promotionPick.skippedCoveredCount,
|
|
15379
|
-
skippedNoOpCount: promotionPick.skippedNoOpCount,
|
|
15380
|
-
provider: input.vNextShadowProvider,
|
|
15381
|
-
...input.lazyPromotionEmit ? { emit: input.lazyPromotionEmit } : {}
|
|
15382
|
-
});
|
|
15383
|
-
}
|
|
15749
|
+
if (promotionPick) {
|
|
15750
|
+
await runMemoryVNextLazyPromotion({
|
|
15751
|
+
db: input.db,
|
|
15752
|
+
item: promotionPick.item,
|
|
15753
|
+
selectedIndex: promotionPick.selectedIndex,
|
|
15754
|
+
skippedCoveredCount: promotionPick.skippedCoveredCount,
|
|
15755
|
+
skippedNoOpCount: promotionPick.skippedNoOpCount,
|
|
15756
|
+
provider: input.vNextShadowProvider,
|
|
15757
|
+
...input.lazyPromotionEmit ? { emit: input.lazyPromotionEmit } : {}
|
|
15758
|
+
});
|
|
15384
15759
|
}
|
|
15385
15760
|
})().catch(() => {
|
|
15386
15761
|
});
|
|
15387
15762
|
}
|
|
15388
|
-
return {
|
|
15389
|
-
selectedItems: pure.selectedItems,
|
|
15390
|
-
promptBlock: pure.promptBlock
|
|
15391
|
-
};
|
|
15392
|
-
}
|
|
15393
|
-
const policy = resolveAgentMemoryPolicy({ agentKey: input.agentKey });
|
|
15394
|
-
const legacyStartedAt = performance.now();
|
|
15395
|
-
const candidates = await loadMemoryCandidatesFromDb(input.db, {
|
|
15396
|
-
owners,
|
|
15397
|
-
subjects: buildMemorySubjectsForAgent({
|
|
15398
|
-
userId: input.userId,
|
|
15399
|
-
spaceId: input.spaceId,
|
|
15400
|
-
agentKey: input.agentKey,
|
|
15401
|
-
memorySubjectId: input.memorySubjectId,
|
|
15402
|
-
policy
|
|
15403
|
-
}),
|
|
15404
|
-
kinds: ["episodic", "semantic", "procedural"],
|
|
15405
|
-
ownerLimit: input.ownerLimit ?? DEFAULT_MEMORY_RUNTIME_OWNER_LIMIT,
|
|
15406
|
-
ownerFallback: policy.ownerFallback,
|
|
15407
|
-
corroboratedProceduralReserve: input.corroboratedProceduralReserve ?? CORROBORATED_PROCEDURAL_RESERVE
|
|
15408
|
-
});
|
|
15409
|
-
const rankContext = {
|
|
15410
|
-
currentOwner: input.spaceId ? { ownerType: "space", ownerId: input.spaceId } : input.userId ? { ownerType: "user", ownerId: input.userId } : null,
|
|
15411
|
-
currentSubject: input.spaceId ? { subjectType: "space", subjectId: input.spaceId } : input.userId ? { subjectType: "user", subjectId: input.userId } : null
|
|
15412
|
-
};
|
|
15413
|
-
const residentItems = candidates.filter((item) => item.resident === true).sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, RESIDENT_MEMORY_RUNTIME_LIMIT);
|
|
15414
|
-
const retrievalCandidates = candidates.filter((item) => item.resident !== true);
|
|
15415
|
-
const ranked = selectRuntimeMemoryItems(
|
|
15416
|
-
rankMemoryCandidates(retrievalCandidates, input.userInput, rankContext),
|
|
15417
|
-
rankContext,
|
|
15418
|
-
input.userInput
|
|
15419
|
-
);
|
|
15420
|
-
const selected = [...residentItems, ...ranked];
|
|
15421
|
-
const legacyLatencyMs = Math.round((performance.now() - legacyStartedAt) * 10) / 10;
|
|
15422
|
-
const renderOverlay = (items) => items.length === 0 ? null : buildMemoryOverlay(items, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET });
|
|
15423
|
-
let promptBlock = renderOverlay(selected);
|
|
15424
|
-
const primaryRead = isMemoryVNextPrimaryReadEnabled();
|
|
15425
|
-
let allCoveredByVNext = false;
|
|
15426
|
-
if (primaryRead) {
|
|
15427
|
-
const emitPrimary = (observation) => {
|
|
15428
|
-
try {
|
|
15429
|
-
(input.primaryReadEmit ?? ((o) => console.info("[memory] vnext primary read", { event: "memory_vnext_primary_read", ...o })))(observation);
|
|
15430
|
-
} catch {
|
|
15431
|
-
}
|
|
15432
|
-
};
|
|
15433
|
-
const base = { legacyHitCount: selected.length, legacyLatencyMs };
|
|
15434
|
-
const vnextStartedAt = performance.now();
|
|
15435
|
-
const vnextLatency = () => Math.round((performance.now() - vnextStartedAt) * 10) / 10;
|
|
15436
15763
|
if (selected.length === 0) {
|
|
15437
|
-
|
|
15438
|
-
}
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
emitPrimary({
|
|
15454
|
-
...base,
|
|
15455
|
-
source,
|
|
15456
|
-
uncoveredLegacyCount: m4.uncoveredLegacyCount,
|
|
15457
|
-
coveredSuppressedCount: m4.coveredSuppressedCount,
|
|
15458
|
-
recalledStateCount: m4.recalledStateCount,
|
|
15459
|
-
vnextLatencyMs: vnextLatency(),
|
|
15460
|
-
contextChars: promptBlock?.length ?? 0,
|
|
15461
|
-
...source === "legacy_fallback" ? { fallbackReason: "no_vnext_context" } : {}
|
|
15462
|
-
});
|
|
15463
|
-
} catch (error) {
|
|
15464
|
-
emitPrimary({
|
|
15465
|
-
...base,
|
|
15466
|
-
source: "legacy_fallback",
|
|
15467
|
-
vnextLatencyMs: vnextLatency(),
|
|
15468
|
-
contextChars: promptBlock?.length ?? 0,
|
|
15469
|
-
fallbackReason: "vnext_error",
|
|
15470
|
-
error: error instanceof Error ? error.name : "UnknownError"
|
|
15471
|
-
});
|
|
15472
|
-
}
|
|
15764
|
+
return finish({ selectedItems: [], promptBlock: null });
|
|
15765
|
+
}
|
|
15766
|
+
await touchMemoryItemsInDb(input.db, selected);
|
|
15767
|
+
return finish({ selectedItems: selected, promptBlock });
|
|
15768
|
+
} finally {
|
|
15769
|
+
const observation = {
|
|
15770
|
+
event: "memory_runtime_result",
|
|
15771
|
+
configuredPure,
|
|
15772
|
+
configuredPrimary,
|
|
15773
|
+
branch,
|
|
15774
|
+
outcome,
|
|
15775
|
+
errorKind
|
|
15776
|
+
};
|
|
15777
|
+
try {
|
|
15778
|
+
(input.runtimeResultEmit ?? ((event) => console.info("[memory] runtime result", event)))(observation);
|
|
15779
|
+
} catch {
|
|
15473
15780
|
}
|
|
15474
15781
|
}
|
|
15475
|
-
const shadowEnabled = !primaryRead && input.vNextShadowProvider != null && isMemoryVNextShadowReadEnabled();
|
|
15476
|
-
if (shadowEnabled) {
|
|
15477
|
-
void runMemoryVNextShadowRead({
|
|
15478
|
-
ctx: {
|
|
15479
|
-
db: input.db,
|
|
15480
|
-
owners,
|
|
15481
|
-
query: input.userInput,
|
|
15482
|
-
provider: input.vNextShadowProvider
|
|
15483
|
-
},
|
|
15484
|
-
legacyItems: selected,
|
|
15485
|
-
legacyLatencyMs,
|
|
15486
|
-
legacyContextChars: promptBlock?.length ?? 0
|
|
15487
|
-
}).catch(() => {
|
|
15488
|
-
});
|
|
15489
|
-
}
|
|
15490
|
-
const lazyPromotionEnabled = input.vNextShadowProvider != null && isMemoryVNextLazyPromotionEnabled();
|
|
15491
|
-
if (lazyPromotionEnabled && selected.length > 0 && !allCoveredByVNext) {
|
|
15492
|
-
void (async () => {
|
|
15493
|
-
const promotionPick = await pickFirstUncoveredLazyPromotionItem(
|
|
15494
|
-
input.db,
|
|
15495
|
-
selected
|
|
15496
|
-
);
|
|
15497
|
-
if (promotionPick) {
|
|
15498
|
-
await runMemoryVNextLazyPromotion({
|
|
15499
|
-
db: input.db,
|
|
15500
|
-
item: promotionPick.item,
|
|
15501
|
-
selectedIndex: promotionPick.selectedIndex,
|
|
15502
|
-
skippedCoveredCount: promotionPick.skippedCoveredCount,
|
|
15503
|
-
skippedNoOpCount: promotionPick.skippedNoOpCount,
|
|
15504
|
-
provider: input.vNextShadowProvider,
|
|
15505
|
-
...input.lazyPromotionEmit ? { emit: input.lazyPromotionEmit } : {}
|
|
15506
|
-
});
|
|
15507
|
-
}
|
|
15508
|
-
})().catch(() => {
|
|
15509
|
-
});
|
|
15510
|
-
}
|
|
15511
|
-
if (selected.length === 0) {
|
|
15512
|
-
return { selectedItems: [], promptBlock: null };
|
|
15513
|
-
}
|
|
15514
|
-
await touchMemoryItemsInDb(input.db, selected);
|
|
15515
|
-
return {
|
|
15516
|
-
selectedItems: selected,
|
|
15517
|
-
promptBlock
|
|
15518
|
-
};
|
|
15519
15782
|
};
|
|
15520
15783
|
|
|
15521
15784
|
// packages/cli/memoryRecall.ts
|
|
@@ -15742,8 +16005,8 @@ async function runAgentRunCommand(args, deps) {
|
|
|
15742
16005
|
try {
|
|
15743
16006
|
return await Promise.race([
|
|
15744
16007
|
activeRunner.then(() => true, () => true),
|
|
15745
|
-
new Promise((
|
|
15746
|
-
timer = setTimeout(() =>
|
|
16008
|
+
new Promise((resolve5) => {
|
|
16009
|
+
timer = setTimeout(() => resolve5(false), 100);
|
|
15747
16010
|
})
|
|
15748
16011
|
]);
|
|
15749
16012
|
} finally {
|
|
@@ -16411,7 +16674,7 @@ async function runAgentRunCommand(args, deps) {
|
|
|
16411
16674
|
acceptance.checks.observations = dodResults.map((check, index) => ({
|
|
16412
16675
|
// Command lines/output can contain credentials. Persist only a digest
|
|
16413
16676
|
// here; the pre-existing registry is the execution evidence reference.
|
|
16414
|
-
commandFingerprint: `sha256:${
|
|
16677
|
+
commandFingerprint: `sha256:${createHash2("sha256").update(check.command).digest("hex")}`,
|
|
16415
16678
|
cwd: childRecordForDoD?.cwd || process.cwd(),
|
|
16416
16679
|
exitCode: check.exitCode,
|
|
16417
16680
|
evidence: `${childRunId}.json#/dodResults/${index}`,
|
|
@@ -16506,6 +16769,9 @@ export {
|
|
|
16506
16769
|
formatAssistantDisplay,
|
|
16507
16770
|
resolveHistoryLayoutGeometry,
|
|
16508
16771
|
resolveHistoryViewportHeight,
|
|
16772
|
+
redactSecrets,
|
|
16773
|
+
safeAskText,
|
|
16774
|
+
safeApprovalMultilineText,
|
|
16509
16775
|
TUI_TREE_MARKER,
|
|
16510
16776
|
TUI_TREE_TOOLS,
|
|
16511
16777
|
resolveAgentModelIdentity,
|
|
@@ -16533,6 +16799,7 @@ export {
|
|
|
16533
16799
|
emitTerminalProgramStatus,
|
|
16534
16800
|
contextRefusalDiagnostics,
|
|
16535
16801
|
describeContextRefusal,
|
|
16802
|
+
inspectLocalRunWorkspace,
|
|
16536
16803
|
isBalanceExhaustedError,
|
|
16537
16804
|
OWNER_OAUTH_UNAVAILABLE_HINT,
|
|
16538
16805
|
isOwnerOAuthUnavailableError,
|