nolo-cli 0.229.0-alpha.1 → 0.240.0-alpha.2
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-VYCHHZVT.js → _executeModel-5NA4USGG.js} +56 -51
- package/{action-GDZDXPMB.js → action-X75O3XPH.js} +7 -4
- package/{addContentAction-7RO4AMRI.js → addContentAction-GVC77QSN.js} +9 -8
- package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-KKDVAMW3.js} +12 -11
- package/{agentDeleteCommand-QWQKT54A.js → agentDeleteCommand-2RFGKFAB.js} +78 -70
- package/{agentEmailCommands-EISMBIRE.js → agentEmailCommands-GQCQKKOR.js} +85 -73
- package/{agentListCommands-4WLG32IW.js → agentListCommands-HSGLDPDQ.js} +40 -47
- package/{agentMachineCommands-DC6NKWTU.js → agentMachineCommands-BISF6PVV.js} +26 -22
- package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-O3Q25PKU.js} +2 -2
- package/{agentPullCommand-KHV4EELF.js → agentPullCommand-G6U2LHMW.js} +1 -1
- package/{agentRecordCommands-IZYUVHME.js → agentRecordCommands-AOXPGYAJ.js} +80 -68
- package/{agentRunCommand-QM7ETUTX.js → agentRunCommand-YTZJCRAL.js} +86 -73
- package/{agentRunControl-MBG4U6SL.js → agentRunControl-VBL7UFSG.js} +1 -1
- package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-T7BX2WGL.js} +24 -19
- package/{agentSlice-UG76KEBH.js → agentSlice-XJNKE3PG.js} +10 -9
- package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-LURUSPY7.js} +27 -23
- package/{appDeployCommands-AU4IUN33.js → appDeployCommands-SMEW4AK2.js} +27 -23
- package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-VYPJTBJK.js} +27 -23
- package/{appGetCommands-BGTLIQ4K.js → appGetCommands-N4NI5GGJ.js} +27 -23
- package/{appListCommands-CUCPRUXW.js → appListCommands-5C6ONN3Z.js} +27 -23
- package/{authCommand-OZ2KTP4Z.js → authCommand-4CVBDADE.js} +15 -13
- package/{authCommands-55OGQGCR.js → authCommands-EHU2BHOX.js} +7 -5
- package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-AYWYQVA4.js} +3 -3
- package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-CSDG2HYN.js} +1 -1
- package/{chunk-HHFGE2WF.js → chunk-2574ANSV.js} +1 -1
- package/chunk-2SXN7LAY.js +15 -0
- package/{chunk-S6FDXXZV.js → chunk-3EMIEC27.js} +1 -1
- package/{chunk-XTJKU3Z4.js → chunk-3FBAVU2Y.js} +11 -9
- package/{chunk-ZH3KXFHS.js → chunk-4FIO2S7Z.js} +1 -1
- package/{chunk-MJI3UAXN.js → chunk-4IQVE43Z.js} +30 -26
- package/{chunk-VQ5N5GSV.js → chunk-4Q6HQORG.js} +1 -1
- package/{chunk-P2ZLUIW2.js → chunk-4X5AVCM7.js} +94 -4
- package/chunk-4ZCTKB27.js +31 -0
- package/{chunk-42OKN2LI.js → chunk-5HUO7SEX.js} +9 -107
- package/{chunk-QYB23WUH.js → chunk-5QZSEQSK.js} +1 -1
- package/{chunk-7JGMNKKG.js → chunk-6CKUO32A.js} +8 -0
- package/chunk-6D25V6CB.js +133 -0
- package/{chunk-ZOHO6MOF.js → chunk-6WOLPIPY.js} +93 -90
- package/{chunk-6QHKRARD.js → chunk-6WZVM33D.js} +9 -4
- package/{chunk-DLXMMTGM.js → chunk-7AJRJGSQ.js} +260 -359
- package/chunk-7NIBQ4HY.js +138 -0
- package/{chunk-7Z6EW7AH.js → chunk-7TTMMOKH.js} +13 -6
- package/{chunk-CNMY2XM6.js → chunk-A3LUWRQK.js} +4 -4
- package/{chunk-4ZGPHFLE.js → chunk-A5EVA6HU.js} +2 -2
- package/{chunk-YVFH2MFB.js → chunk-AEQMKYZN.js} +4 -4
- package/{chunk-YKY4OVOX.js → chunk-AH5R7BYW.js} +13 -167
- package/{chunk-7FEP5USX.js → chunk-ANJRDS6U.js} +3 -3
- package/{chunk-YFLVRVYK.js → chunk-AVJDELEA.js} +1 -1
- package/{chunk-HYLRQDEE.js → chunk-B5SV4H3J.js} +6 -6
- package/{chunk-7BCG67EI.js → chunk-B7DE5XJW.js} +137 -290
- package/chunk-BEM6LPD2.js +734 -0
- package/{chunk-DUUDXSLX.js → chunk-BGGAY6OK.js} +27 -3
- package/{chunk-GAYNXB6T.js → chunk-BGGV6B5O.js} +416 -232
- package/{chunk-BP5ZJ6B4.js → chunk-BIABIPGW.js} +1 -1
- package/{chunk-TQEKUOTI.js → chunk-BXSMFPTG.js} +4 -4
- package/{chunk-RG2DGNL6.js → chunk-CKZPMJNU.js} +3 -3
- package/{chunk-OTKSESZR.js → chunk-CVJRVBJL.js} +2 -2
- package/{chunk-BIWI5M4E.js → chunk-D374I563.js} +1 -1
- package/{chunk-QRGDJA4B.js → chunk-DNZ4JJ7C.js} +1 -1
- package/chunk-DVYAFH2Q.js +103 -0
- package/{chunk-LYD6C7OU.js → chunk-DXW5WDHZ.js} +4 -4
- package/{chunk-MZG5CETE.js → chunk-E5KJOZWY.js} +3 -3
- package/{chunk-45CAVC35.js → chunk-E5KY7RAY.js} +565 -103
- package/{chunk-G7IUT2V3.js → chunk-EBKHA63G.js} +103 -12
- package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
- package/{chunk-DGYCDA6W.js → chunk-F3XI6WQP.js} +17 -10
- package/{chunk-M3OZRQNH.js → chunk-F6YWDVIB.js} +1 -1
- package/{chunk-3VZLEKV2.js → chunk-FFYE5ATM.js} +4 -4
- package/{chunk-HXB4VDGK.js → chunk-FZKA3XFA.js} +11 -11
- package/{chunk-MNEZUL5S.js → chunk-G22P367E.js} +31 -14
- package/{chunk-WFDNADFX.js → chunk-GDUC4VS2.js} +7 -7
- package/{chunk-R6Z5S5GA.js → chunk-GXXY2NL3.js} +16 -14
- package/{chunk-U2HBB7RS.js → chunk-H7ZYKHAZ.js} +27 -7
- package/{chunk-3U44JB3O.js → chunk-HCNOO374.js} +1 -1
- package/{chunk-HSSBDZLD.js → chunk-HOM6LTEW.js} +1 -1
- package/{chunk-S2NTVGA2.js → chunk-I2OYPD3Y.js} +1 -1
- package/{chunk-WCFFRBL5.js → chunk-IJTXNLQE.js} +9 -9
- package/{chunk-ALAES342.js → chunk-IUMS6F53.js} +2 -2
- package/{chunk-547ENH5T.js → chunk-IUTUWIKE.js} +2 -2
- package/{chunk-S6K5F3KP.js → chunk-JBWXPACD.js} +1 -1
- package/{chunk-XAG3FWBE.js → chunk-KZPEGO6D.js} +1 -1
- package/{chunk-RBPUNSG5.js → chunk-LYDEFPQP.js} +18 -108
- package/{chunk-OWKNSIXL.js → chunk-MECDGHLK.js} +271 -66
- package/{chunk-FJSNBZXR.js → chunk-MM73SP4K.js} +1 -1
- package/{chunk-XSW4EXQV.js → chunk-MYOSN6BT.js} +2 -2
- package/{chunk-ZEVQHCLM.js → chunk-MYPKBJJO.js} +2 -2
- package/{chunk-DBUR22G5.js → chunk-N2JROHD3.js} +4 -4
- package/{chunk-ATEKLSLR.js → chunk-O6IPRAVV.js} +14 -9
- package/{chunk-PPJYZRSQ.js → chunk-OX6GNNVT.js} +6 -1
- package/{chunk-TSPMLCWI.js → chunk-P3IZUMIC.js} +2 -2
- package/{chunk-FPBJM2BW.js → chunk-PGKA77TZ.js} +26 -20
- package/{chunk-4QYJPWHH.js → chunk-PRMEU7BT.js} +229 -7
- package/{chunk-OJ45MEEI.js → chunk-PROOOQZ3.js} +1 -1
- package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/chunk-RETQOQ4D.js +33394 -0
- package/{chunk-CMMI3DAT.js → chunk-RM4UMFY4.js} +33 -26
- package/{chunk-262R3XNN.js → chunk-S2MHR4PU.js} +151 -5
- package/{chunk-DEA37IUY.js → chunk-T6VROBY7.js} +2 -2
- package/{chunk-M4SFKP5L.js → chunk-TEMLHVGX.js} +1 -1
- package/{chunk-3QIYD3VM.js → chunk-TRHJ4NJB.js} +61 -792
- package/{chunk-OBIC6EG7.js → chunk-TWTJV35S.js} +1 -1
- package/{chunk-TCZ2VJZQ.js → chunk-U3G7RRXJ.js} +5 -5
- package/{chunk-F6Z6ZCUV.js → chunk-UFC4J7OY.js} +3 -3
- package/{chunk-5YMA6DDZ.js → chunk-UHW6SCVK.js} +1 -1
- package/{chunk-4N6G2CKP.js → chunk-ULLHVDTZ.js} +46 -1
- package/{chunk-XFXFPUO7.js → chunk-VM72HKW2.js} +7 -7
- package/{chunk-HF7BLF3F.js → chunk-VREG6ANQ.js} +102 -99
- package/chunk-VSRISJXZ.js +107 -0
- package/chunk-WDWZPASX.js +29 -0
- package/{chunk-ILHQ2AXT.js → chunk-WRKMXMU7.js} +2 -0
- package/chunk-X7IA2B7R.js +166 -0
- package/{chunk-5ZMIIR23.js → chunk-XBAEM4RI.js} +7 -0
- package/{chunk-4JVNURX4.js → chunk-XS5A3EKX.js} +1 -23
- package/{chunk-N5Z2V73W.js → chunk-Y2MF4DCJ.js} +1 -1
- package/{chunk-EGHP7KOY.js → chunk-Y5OWZQMJ.js} +28 -19
- package/{chunk-TI2EPRHE.js → chunk-YGCOJNFZ.js} +3 -3
- package/{chunk-JQZRSXS5.js → chunk-YGDYYFRX.js} +9 -13
- package/{chunk-X3E6EHJW.js → chunk-Z2WZAE4P.js} +128 -150
- package/chunk-Z6YTCDU4.js +24 -0
- package/{chunk-RRDRQOEC.js → chunk-ZEKUFJLW.js} +81 -66
- package/{chunk-EVGU5P4U.js → chunk-ZVOL2MAJ.js} +1 -1
- package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-U5OAVAKQ.js} +2 -2
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-S42VMGB6.js} +1 -1
- package/{cliLocalAgentRecordReader-H3HYQRRR.js → cliLocalAgentRecordReader-HVZAQCUD.js} +29 -25
- package/{commandRegistry-FVYPE2IN.js → commandRegistry-FIXBZJHE.js} +89 -85
- package/{contentThunks-GNFPG32S.js → contentThunks-U6OC4R2N.js} +23 -22
- package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-U7XSRVJP.js} +1 -1
- package/{createAgentAutomationAction-PB4QIFQ4.js → createAgentAutomationAction-IP4LFN3W.js} +23 -22
- package/{createDialogAction-EVTOPY7A.js → createDialogAction-IAGQJ3LH.js} +24 -23
- package/{createPageAction-2UYF2IDZ.js → createPageAction-AZ3UIFKA.js} +24 -23
- package/{dbSlice-XRUZOGSU.js → dbSlice-DKKMJJYY.js} +8 -7
- package/{deleteFile-6URDHYRB.js → deleteFile-TQSONMVU.js} +7 -4
- package/{dialogCommands-6SZD4TYP.js → dialogCommands-PCDRMBWG.js} +30 -26
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-O35MWMOS.js} +3 -3
- package/{dialogSlice-5EQ2A6LY.js → dialogSlice-QAKYN4DE.js} +22 -21
- package/{dialogUsageCommand-W2WCSGKF.js → dialogUsageCommand-2SSLTXKO.js} +2 -2
- package/{docCreateCommands-25E6PGN3.js → docCreateCommands-CFQFZOAD.js} +26 -22
- package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-5CPNTIIS.js} +27 -23
- package/{docReadCommands-JY2E5XEN.js → docReadCommands-XQILYSAJ.js} +26 -22
- package/{docStore-OKKIKLT3.js → docStore-GIVRT7TQ.js} +10 -9
- package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-VETKSUDD.js} +26 -22
- package/{handleSendMessageAction-LNT7SZND.js → handleSendMessageAction-HKIW4ZNO.js} +48 -45
- package/{hostCredentialCreate-XUU2CSHI.js → hostCredentialCreate-6VDJFNDO.js} +82 -69
- package/index.js +8 -8
- package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
- package/{localRuntimeAdapter-IBSTMSX7.js → localRuntimeAdapter-BQ4F5PZV.js} +81 -69
- package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-WCNA4A3G.js} +4 -2
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-CRNIBOOM.js} +1 -1
- package/{machineCommands-HSQHDHOT.js → machineCommands-K6XIGOAD.js} +78 -66
- package/{machineWsRunDispatch-L6H7J66T.js → machineWsRunDispatch-4OO7Z6UM.js} +78 -66
- package/mcpLocalAuthorizeCommand-ZP6ESAGE.js +106 -0
- package/{memberThunks-7Y3OYSJQ.js → memberThunks-PBJPZ2JU.js} +15 -10
- package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
- package/package.json +1 -1
- package/{projectArchive-FQO654Z3.js → projectArchive-G7AOQPRW.js} +24 -23
- package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-OPBCAONX.js} +1 -1
- package/{providerRegistry-ZI2KORJ7.js → providerRegistry-J2HCVTHE.js} +1 -1
- package/{read-TYMBGEXO.js → read-JEGPITEW.js} +6 -5
- package/{readDocTool-SKQVHBLO.js → readDocTool-TE3XIU4Y.js} +1 -1
- package/{readlineWorkspace-7U272DSA.js → readlineWorkspace-XMPGXR77.js} +2946 -2367
- package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-CX3OAH4Y.js} +14 -13
- package/{runAgentClientLoop-AF4JQIJ7.js → runAgentClientLoop-HQJPDFGQ.js} +65 -45
- package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-GUH2YGMH.js} +3 -3
- package/{secretCommands-KZWBZIYS.js → secretCommands-NJXFVHZU.js} +2 -2
- package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-CGM67EEQ.js} +11 -10
- package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-3ABWPPXR.js} +14 -13
- package/{settingThunks-ZRGWVGZD.js → settingThunks-AY76OHYX.js} +176 -57
- package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-MDDKPTW3.js} +4 -3
- package/{spaceCommands-5VNWMDBE.js → spaceCommands-G63QGYQO.js} +26 -22
- package/{streamAgentChatTurn-YSPEFY4K.js → streamAgentChatTurn-E3XH2KFD.js} +127 -85
- package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-G6EZRKCQ.js} +12 -11
- package/{tableCommands-FTAOCBTX.js → tableCommands-JI75ZHDI.js} +4 -1
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-62UUPDUA.js} +3 -5
- package/{tools-M35PTIFB.js → tools-7RSX22FT.js} +41 -37
- package/{tuiRestart-2IL37YIB.js → tuiRestart-KAAA7TND.js} +2 -2
- package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-BVNHMWLR.js} +6 -6
- package/{updateCommands-CPATDG6J.js → updateCommands-ASK5XYPH.js} +3 -3
- package/{updateDialogTitleAction-IMIRJRQQ.js → updateDialogTitleAction-SEWV252V.js} +23 -22
- package/{usageCommand-2BF74MKF.js → usageCommand-JVT5J3DC.js} +2 -2
- package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-IZYYUTEW.js} +3 -3
- package/webapi-24RZDIIQ.js +2488 -0
- package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-BSDIS2J5.js} +2 -2
- package/workContext-MM3P5GP5.js +13 -0
- package/workContextAccess-UZHDLBUR.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/chunk-ZXF6D3I6.js +0 -359
- package/{accountResolver-QETKNC7T.js → accountResolver-EK2S4PWF.js} +3 -3
- package/{localDialogRead-CCOCVGAP.js → localDialogRead-AV2VKKPG.js} +0 -0
- package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-YIZ7KLUP.js} +5 -5
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BROWSER_SHELL_BRIDGE_ENV
|
|
3
3
|
} from "./chunk-2YGBI2XB.js";
|
|
4
|
+
import {
|
|
5
|
+
confirmMcpOnHost,
|
|
6
|
+
createConnectorApprovalPort,
|
|
7
|
+
createMcpLocalRuntimeAdapter,
|
|
8
|
+
getHostApprovalRenderer,
|
|
9
|
+
openMcpLocalRuntimeManagement,
|
|
10
|
+
parsePendingApprovalResult,
|
|
11
|
+
runConnectorToolWithHostApproval,
|
|
12
|
+
withHostApprovalRequest
|
|
13
|
+
} from "./chunk-RETQOQ4D.js";
|
|
14
|
+
import {
|
|
15
|
+
clearCredentialAvailability,
|
|
16
|
+
markCredentialUnavailable,
|
|
17
|
+
readCredentialEntry
|
|
18
|
+
} from "./chunk-WWTSEBDF.js";
|
|
19
|
+
import {
|
|
20
|
+
customNativeAuthHeaders,
|
|
21
|
+
detectDeclaredCustomNativeWire,
|
|
22
|
+
isCallerCancellation,
|
|
23
|
+
resolveCustomNativeApiKeyHeader,
|
|
24
|
+
resolveCustomNativeEndpoint
|
|
25
|
+
} from "./chunk-WOAZVUSN.js";
|
|
4
26
|
import {
|
|
5
27
|
adoptRequiredClaudeCodeVersion,
|
|
6
28
|
anthropicRefresh,
|
|
@@ -12,17 +34,12 @@ import {
|
|
|
12
34
|
resolveClaudeCodeVersion,
|
|
13
35
|
resolveServerSyncConfig,
|
|
14
36
|
xaiRefresh
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
clearCredentialAvailability,
|
|
18
|
-
markCredentialUnavailable,
|
|
19
|
-
readCredentialEntry
|
|
20
|
-
} from "./chunk-WWTSEBDF.js";
|
|
37
|
+
} from "./chunk-MYOSN6BT.js";
|
|
21
38
|
import {
|
|
22
39
|
DialogNotifyError,
|
|
23
40
|
deliverDialogNotification,
|
|
24
41
|
sha256Hex
|
|
25
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-TEMLHVGX.js";
|
|
26
43
|
import {
|
|
27
44
|
SANDBOX_HELPER_PATH,
|
|
28
45
|
SANDBOX_OUTPUT_LIMITS,
|
|
@@ -39,15 +56,14 @@ import {
|
|
|
39
56
|
validateChromeConnectorPayload
|
|
40
57
|
} from "./chunk-UAIHKQIA.js";
|
|
41
58
|
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} from "./chunk-WOAZVUSN.js";
|
|
59
|
+
extractLastUserText,
|
|
60
|
+
localTurnHasSubjectRefs,
|
|
61
|
+
resolveLocalUserId,
|
|
62
|
+
withResolvedRuntimeToolSurface
|
|
63
|
+
} from "./chunk-2574ANSV.js";
|
|
48
64
|
import {
|
|
49
65
|
createTuiSummaryLlmCaller
|
|
50
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-P3IZUMIC.js";
|
|
51
67
|
import {
|
|
52
68
|
CliProviderQuotaError,
|
|
53
69
|
executeCli,
|
|
@@ -60,19 +76,12 @@ import {
|
|
|
60
76
|
buildCliPrompt
|
|
61
77
|
} from "./chunk-ATNTHIZI.js";
|
|
62
78
|
import {
|
|
63
|
-
extractLastUserText,
|
|
64
|
-
localTurnHasSubjectRefs,
|
|
65
|
-
resolveLocalUserId,
|
|
66
|
-
withResolvedRuntimeToolSurface
|
|
67
|
-
} from "./chunk-HHFGE2WF.js";
|
|
68
|
-
import {
|
|
69
|
-
inferCaptureIntent,
|
|
70
79
|
resolveUserSkillRuntime
|
|
71
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-6D25V6CB.js";
|
|
72
81
|
import {
|
|
73
82
|
inlineImageUrlsForCustomProvider,
|
|
74
83
|
prepareTools
|
|
75
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-CVJRVBJL.js";
|
|
76
85
|
import {
|
|
77
86
|
getServerProviderSecret
|
|
78
87
|
} from "./chunk-HS7MLR74.js";
|
|
@@ -95,20 +104,22 @@ import {
|
|
|
95
104
|
resolveCliLocalSpawnDispatch,
|
|
96
105
|
resolveRunContextFacts,
|
|
97
106
|
resolveStartAgentRunCwd
|
|
98
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-BGGV6B5O.js";
|
|
99
108
|
import {
|
|
100
109
|
deriveCredentialGroup,
|
|
101
110
|
deriveCustomProviderCredentialGroup
|
|
102
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-ZEKUFJLW.js";
|
|
103
112
|
import {
|
|
104
113
|
normalizeEnabledPromptSkills,
|
|
105
114
|
resolveUserEnabledSkills
|
|
106
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-DVYAFH2Q.js";
|
|
107
116
|
import {
|
|
108
|
-
prepareTokenUsageData,
|
|
109
|
-
runKeyed,
|
|
110
117
|
validateAskChoiceInput
|
|
111
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-PRMEU7BT.js";
|
|
119
|
+
import {
|
|
120
|
+
prepareTokenUsageData,
|
|
121
|
+
runKeyed
|
|
122
|
+
} from "./chunk-B7DE5XJW.js";
|
|
112
123
|
import {
|
|
113
124
|
applyTokenUsageToDayStats,
|
|
114
125
|
require_format
|
|
@@ -119,7 +130,7 @@ import {
|
|
|
119
130
|
} from "./chunk-523DITKR.js";
|
|
120
131
|
import {
|
|
121
132
|
fetchServerSyncedCredential
|
|
122
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-IJTXNLQE.js";
|
|
123
134
|
import {
|
|
124
135
|
defaultLoopbackRequest
|
|
125
136
|
} from "./chunk-VP3BINY7.js";
|
|
@@ -127,14 +138,14 @@ import {
|
|
|
127
138
|
CREDENTIAL_STORE_SESSION_FALLBACK_WARNING,
|
|
128
139
|
OAUTH_PROVIDER_REFS,
|
|
129
140
|
getSharedSessionCredentialBroker
|
|
130
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-BXSMFPTG.js";
|
|
131
142
|
import {
|
|
132
143
|
fetchWithTransientRetry,
|
|
133
144
|
isTransientFetchError
|
|
134
145
|
} from "./chunk-DXWGFL2Z.js";
|
|
135
146
|
import {
|
|
136
147
|
getDefaultCliLocalRuntimeDb
|
|
137
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-Y2MF4DCJ.js";
|
|
138
149
|
import {
|
|
139
150
|
_readQueueEntriesLocked,
|
|
140
151
|
ackRunRecord,
|
|
@@ -159,7 +170,7 @@ import {
|
|
|
159
170
|
terminateRunProcess,
|
|
160
171
|
transitionRunToTerminal,
|
|
161
172
|
withQueueLock
|
|
162
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-MECDGHLK.js";
|
|
163
174
|
import {
|
|
164
175
|
remoteDialogSyncTimeout,
|
|
165
176
|
resolveRuntimeAuthToken,
|
|
@@ -190,7 +201,7 @@ import {
|
|
|
190
201
|
readDialogMessageRecords,
|
|
191
202
|
readDialogMessages,
|
|
192
203
|
resolveBuiltinLocalCliAgentConfig
|
|
193
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-U3G7RRXJ.js";
|
|
194
205
|
import {
|
|
195
206
|
LOCAL_CODEX_AGENT_KEY,
|
|
196
207
|
isLocalCliAgentKey,
|
|
@@ -212,14 +223,11 @@ import {
|
|
|
212
223
|
buildNoloWorkspaceCliToolExecutors,
|
|
213
224
|
codexStreamFailureStatus,
|
|
214
225
|
createDevinProvider,
|
|
215
|
-
createHostCredentialBrokerChain,
|
|
216
226
|
createHybridRecordStore,
|
|
217
227
|
createLocalWorkspaceToolExecutors,
|
|
218
228
|
createResponsesStreamCollector,
|
|
219
|
-
createStrictHostCredentialBroker,
|
|
220
229
|
deriveStableUuid,
|
|
221
230
|
describeOpenAiCompatibleRequestBudget,
|
|
222
|
-
dialogMessageRecordToAgentRuntimeMessage,
|
|
223
231
|
executeLocalToolWithPolicy,
|
|
224
232
|
executeOpenAiCompatibleChatCompletion,
|
|
225
233
|
filterRetainedLedgerRecords,
|
|
@@ -246,11 +254,16 @@ import {
|
|
|
246
254
|
runExecShellGates,
|
|
247
255
|
validateConfiguredRootExecutionLease,
|
|
248
256
|
verifyOwnerRouteAck
|
|
249
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-TRHJ4NJB.js";
|
|
258
|
+
import {
|
|
259
|
+
createHostCredentialBrokerChain,
|
|
260
|
+
createStrictHostCredentialBroker
|
|
261
|
+
} from "./chunk-BEM6LPD2.js";
|
|
250
262
|
import {
|
|
251
263
|
accumulateGeminiChunks,
|
|
252
264
|
buildGeminiGenerateContentRequest,
|
|
253
265
|
fetchAntigravityCloudCodeCompletion,
|
|
266
|
+
hasAssembledAgentPrompt,
|
|
254
267
|
isGemini3Model,
|
|
255
268
|
parseSseDataLineJson,
|
|
256
269
|
parseSseDataLineObject,
|
|
@@ -258,7 +271,7 @@ import {
|
|
|
258
271
|
resolveAntigravityFinishReason,
|
|
259
272
|
resolveGeminiModelQuirks,
|
|
260
273
|
shouldUseGeminiNativeToolRoute
|
|
261
|
-
} from "./chunk-
|
|
274
|
+
} from "./chunk-H7ZYKHAZ.js";
|
|
262
275
|
import {
|
|
263
276
|
readLocalImage
|
|
264
277
|
} from "./chunk-AL3TYDIF.js";
|
|
@@ -273,7 +286,7 @@ import {
|
|
|
273
286
|
readPlatformChatSseCompletion,
|
|
274
287
|
resolvePlatformChatProviderConfig,
|
|
275
288
|
shouldUsePlatformChatProvider
|
|
276
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-HOM6LTEW.js";
|
|
277
290
|
import {
|
|
278
291
|
readSseDataValues,
|
|
279
292
|
readSseFrames
|
|
@@ -283,7 +296,7 @@ import {
|
|
|
283
296
|
resolveCatalogImageSupport,
|
|
284
297
|
resolveToolImagePolicy,
|
|
285
298
|
withLiveImageSupport
|
|
286
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-BGGAY6OK.js";
|
|
287
300
|
import {
|
|
288
301
|
collectStablePromptPrefix,
|
|
289
302
|
convertMessagesToResponsesInput,
|
|
@@ -307,7 +320,7 @@ import {
|
|
|
307
320
|
buildNoloWorkspaceOpenAiTools,
|
|
308
321
|
filterClientNoloWorkspaceToolNames,
|
|
309
322
|
parseNoloWorkspaceToolArguments
|
|
310
|
-
} from "./chunk-
|
|
323
|
+
} from "./chunk-G22P367E.js";
|
|
311
324
|
import {
|
|
312
325
|
extractQuotaSnapshot,
|
|
313
326
|
isCapacitySaturatedRateLimit,
|
|
@@ -315,20 +328,23 @@ import {
|
|
|
315
328
|
resolveAvailabilityAction,
|
|
316
329
|
resolveCredentialKeyWithFallback
|
|
317
330
|
} from "./chunk-QJTZ76CP.js";
|
|
331
|
+
import {
|
|
332
|
+
MCP_TOOL_NAMES
|
|
333
|
+
} from "./chunk-7NIBQ4HY.js";
|
|
318
334
|
import {
|
|
319
335
|
HIGH_RISK_MUTATION_TOOL_NAMES,
|
|
320
336
|
resolveRequestToolSurface
|
|
321
337
|
} from "./chunk-VS276URX.js";
|
|
322
338
|
import {
|
|
323
339
|
resolveAgentCallPlan
|
|
324
|
-
} from "./chunk-
|
|
340
|
+
} from "./chunk-TWTJV35S.js";
|
|
325
341
|
import {
|
|
326
342
|
resolveHistoricalToolContentCap
|
|
327
343
|
} from "./chunk-WFGNWWJI.js";
|
|
328
344
|
import {
|
|
329
345
|
resolveAgentRequiredPackIds,
|
|
330
346
|
resolveAgentSkillConfig
|
|
331
|
-
} from "./chunk-
|
|
347
|
+
} from "./chunk-MM73SP4K.js";
|
|
332
348
|
import {
|
|
333
349
|
buildDialogFallbackTitleFromUserInput,
|
|
334
350
|
normalizeDialogTitle
|
|
@@ -342,7 +358,7 @@ import {
|
|
|
342
358
|
isCodexOAuthAgent,
|
|
343
359
|
markCodexOAuthCatalogFailure,
|
|
344
360
|
resolveCodexOAuthEffectiveModel
|
|
345
|
-
} from "./chunk-
|
|
361
|
+
} from "./chunk-DNZ4JJ7C.js";
|
|
346
362
|
import {
|
|
347
363
|
isDevinOAuthAgent
|
|
348
364
|
} from "./chunk-5ZUL4CUO.js";
|
|
@@ -367,12 +383,12 @@ import {
|
|
|
367
383
|
resolveLocalWorkspaceExecutorOptionsFromPolicy,
|
|
368
384
|
resolveRequestedRuntimeToolNames
|
|
369
385
|
} from "./chunk-USGHJSGO.js";
|
|
370
|
-
import {
|
|
371
|
-
asRecordOrEmpty
|
|
372
|
-
} from "./chunk-KX6YBIHG.js";
|
|
373
386
|
import {
|
|
374
387
|
createFileCredentialBroker
|
|
375
388
|
} from "./chunk-OQHIVPG4.js";
|
|
389
|
+
import {
|
|
390
|
+
asRecordOrEmpty
|
|
391
|
+
} from "./chunk-KX6YBIHG.js";
|
|
376
392
|
import {
|
|
377
393
|
compactWhitespace
|
|
378
394
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -388,6 +404,9 @@ import {
|
|
|
388
404
|
readOAuthCredential,
|
|
389
405
|
resolveFreshAccessToken
|
|
390
406
|
} from "./chunk-G7Y4GXTY.js";
|
|
407
|
+
import {
|
|
408
|
+
dialogMessageRecordToAgentRuntimeMessage
|
|
409
|
+
} from "./chunk-4ZCTKB27.js";
|
|
391
410
|
import {
|
|
392
411
|
FORCED_TOOLS,
|
|
393
412
|
addDefaultLightWebToolsForConfiguredAgents,
|
|
@@ -399,7 +418,7 @@ import {
|
|
|
399
418
|
expandEnabledPacks,
|
|
400
419
|
resolveBuiltinSkillEntry,
|
|
401
420
|
resolveEffectiveEnabledPacks
|
|
402
|
-
} from "./chunk-
|
|
421
|
+
} from "./chunk-EBKHA63G.js";
|
|
403
422
|
import {
|
|
404
423
|
CHROME_CONNECTOR_ACCEPTED_TOOL_NAMES,
|
|
405
424
|
canonicalizeChromeConnectorToolNames,
|
|
@@ -441,10 +460,10 @@ import {
|
|
|
441
460
|
import {
|
|
442
461
|
agentRunCardLabels,
|
|
443
462
|
t
|
|
444
|
-
} from "./chunk-
|
|
463
|
+
} from "./chunk-S2MHR4PU.js";
|
|
445
464
|
import {
|
|
446
465
|
isAntigravityOAuthAgent
|
|
447
|
-
} from "./chunk-
|
|
466
|
+
} from "./chunk-6CKUO32A.js";
|
|
448
467
|
import {
|
|
449
468
|
buildProviderSessionHeaders,
|
|
450
469
|
resolvePlatformAuthToken
|
|
@@ -891,7 +910,7 @@ function buildAnthropicMessagesBody(args) {
|
|
|
891
910
|
const mode = resolveCacheMode();
|
|
892
911
|
const rawMessages = Array.isArray(args.openAiBody.messages) ? args.openAiBody.messages : [];
|
|
893
912
|
const system = [];
|
|
894
|
-
if (args.agentConfig.prompt?.trim()) {
|
|
913
|
+
if (!hasAssembledAgentPrompt(rawMessages) && args.agentConfig.prompt?.trim()) {
|
|
895
914
|
system.push({ type: "text", text: args.agentConfig.prompt.trim() });
|
|
896
915
|
}
|
|
897
916
|
const messages = [];
|
|
@@ -1502,7 +1521,7 @@ function resolveCliRequestedToolNames(agentConfig, env, systemBuiltinSkills) {
|
|
|
1502
1521
|
filtered,
|
|
1503
1522
|
agentConfig?.disabledTools
|
|
1504
1523
|
);
|
|
1505
|
-
return filterToolNamesForRunKind(afterDisabled, isSubtask);
|
|
1524
|
+
return filterToolNamesForRunKind(afterDisabled.filter((name) => !MCP_TOOL_NAMES.includes(name) || agentConfig.key === "agent-0e95801d90-gpt-6-1-sol" && Array.isArray(agentConfig.toolNames) && agentConfig.toolNames.includes(name)), isSubtask);
|
|
1506
1525
|
}
|
|
1507
1526
|
function resolveProviderOpenAiToolBundle(agentConfig, env, buildTools = buildOpenAiTools, additionalToolNames = []) {
|
|
1508
1527
|
const requestedToolNames = [
|
|
@@ -1530,6 +1549,7 @@ function buildLocalWorkspaceToolsetForEnv(args) {
|
|
|
1530
1549
|
return toolset;
|
|
1531
1550
|
}
|
|
1532
1551
|
function buildLocalPolicyToolNames(args) {
|
|
1552
|
+
if (args.toolNames?.length === 0) return [];
|
|
1533
1553
|
const schemaBuilder = args.buildProviderOpenAiTools ?? buildOpenAiTools;
|
|
1534
1554
|
const tools = schemaBuilder({
|
|
1535
1555
|
agentKey: args.agentKey,
|
|
@@ -2575,8 +2595,9 @@ function buildCodexRequestBody(args, identity = createCodexRequestIdentity(), se
|
|
|
2575
2595
|
routeKind: "codex/responses",
|
|
2576
2596
|
legacySupportsToolImages: false
|
|
2577
2597
|
}));
|
|
2578
|
-
const
|
|
2579
|
-
const
|
|
2598
|
+
const fallbackPrompt = hasAssembledAgentPrompt(rawMessages) ? void 0 : args.agentConfig.prompt;
|
|
2599
|
+
const instructions = collectInstructions(rawMessages, fallbackPrompt);
|
|
2600
|
+
const stableInstructions = collectStablePromptPrefix(rawMessages, fallbackPrompt);
|
|
2580
2601
|
const tools = toResponsesTools(
|
|
2581
2602
|
Array.isArray(args.openAiBody.tools) ? args.openAiBody.tools : void 0
|
|
2582
2603
|
);
|
|
@@ -4463,7 +4484,7 @@ function resolveLocalRunExecutionIsolationFact(args) {
|
|
|
4463
4484
|
isolation: "none",
|
|
4464
4485
|
sandbox: "host",
|
|
4465
4486
|
reason: "host-no-sandbox",
|
|
4466
|
-
note: "\u672C run \u5728\u5BBF\u4E3B\u6267\u884C\u4E14**\u65E0\u9694\u79BB**\uFF08\u672A\u8D70 docker \u901A\u9053\uFF0C\u4E5F\u6CA1\u6709\u53EF\u7528\u7684 bwrap workload\uFF09\u3002\u5199\u64CD\u4F5C\u76F4\u63A5\u4F5C\u7528\u4E8E\u5BBF\u4E3B\u5DE5\u4F5C\u533A\
|
|
4487
|
+
note: "\u672C run \u5728\u5BBF\u4E3B\u6267\u884C\u4E14**\u65E0\u9694\u79BB**\uFF08\u672A\u8D70 docker \u901A\u9053\uFF0C\u4E5F\u6CA1\u6709\u53EF\u7528\u7684 bwrap workload\uFF09\u3002\u5199\u64CD\u4F5C\u76F4\u63A5\u4F5C\u7528\u4E8E\u5BBF\u4E3B\u5DE5\u4F5C\u533A\uFF1BCLI \u672A\u70B9\u540D\u5199\u578B\u6D3E\u53D1\u9ED8\u8BA4\u5BBF\u4E3B\u4E14\u987B allowHostWrites: true\uFF0C\u4EA4\u4E92\u5F0F run \u53EF\u7528 --runtime-key docker\uFF08\u6216 --local \u663E\u5F0F\u58F0\u660E\u672C\u673A\u6267\u884C\uFF09\u3002",
|
|
4467
4488
|
recordedAt
|
|
4468
4489
|
});
|
|
4469
4490
|
}
|
|
@@ -4794,6 +4815,8 @@ function parseBackgroundRuns(text) {
|
|
|
4794
4815
|
tasks.push({
|
|
4795
4816
|
title: title || agent || runId || SUBJECT_RUN.label,
|
|
4796
4817
|
...runId ? { identifier: runId } : {},
|
|
4818
|
+
...status ? { runStatus: status } : {},
|
|
4819
|
+
...attrValue(attrs, "childDialogId") && attrValue(attrs, "childDialogId") !== "missing" ? { childDialogId: decodeXmlAttribute(attrValue(attrs, "childDialogId")) } : {},
|
|
4797
4820
|
outcome,
|
|
4798
4821
|
outcomeLabel: OUTCOME_LABEL[outcome],
|
|
4799
4822
|
...duration ? { duration } : {},
|
|
@@ -5397,25 +5420,24 @@ async function syncLocalDialogEvidenceToRemote(args) {
|
|
|
5397
5420
|
// packages/cli/client/childShellApprovalHostResolver.ts
|
|
5398
5421
|
function createChildShellApprovalHostResolver(args) {
|
|
5399
5422
|
return async (agentKey) => {
|
|
5400
|
-
const
|
|
5401
|
-
|
|
5402
|
-
const ownerUserId = asOptionalTrimmedString(record?.userId) ?? asOptionalTrimmedString(record?.ownerUserId);
|
|
5403
|
-
if (!ownerUserId) return void 0;
|
|
5404
|
-
const deviceId = asOptionalTrimmedString(await args.resolveDeviceId());
|
|
5405
|
-
if (!deviceId) return void 0;
|
|
5423
|
+
const binding = await resolveChildApprovalBinding({ ...args, agentKey });
|
|
5424
|
+
if (!binding) return void 0;
|
|
5406
5425
|
return {
|
|
5407
|
-
binding
|
|
5408
|
-
runId: "pending-spawn",
|
|
5409
|
-
agentKey,
|
|
5410
|
-
ownerUserId,
|
|
5411
|
-
deviceId,
|
|
5412
|
-
workspaceRoot: args.workspaceRoot
|
|
5413
|
-
},
|
|
5426
|
+
binding,
|
|
5414
5427
|
confirm: args.session.confirm,
|
|
5415
5428
|
signal: args.session.signal
|
|
5416
5429
|
};
|
|
5417
5430
|
};
|
|
5418
5431
|
}
|
|
5432
|
+
async function resolveChildApprovalBinding(args) {
|
|
5433
|
+
const config = await args.readAgentConfig(args.agentKey);
|
|
5434
|
+
const record = config?.rawRecord;
|
|
5435
|
+
const ownerUserId = asOptionalTrimmedString(record?.userId) ?? asOptionalTrimmedString(record?.ownerUserId);
|
|
5436
|
+
if (!ownerUserId) return void 0;
|
|
5437
|
+
const deviceId = asOptionalTrimmedString(await args.resolveDeviceId());
|
|
5438
|
+
if (!deviceId) return void 0;
|
|
5439
|
+
return { runId: "pending-spawn", agentKey: args.agentKey, ownerUserId, deviceId, workspaceRoot: args.workspaceRoot };
|
|
5440
|
+
}
|
|
5419
5441
|
|
|
5420
5442
|
// packages/cli/client/cliDialogHistoryState.ts
|
|
5421
5443
|
var STATE_KEY_PREFIX = "cli-dialog-history-state";
|
|
@@ -5839,253 +5861,6 @@ async function fetchRemoteDialogMessageRecordsViaBridge(args) {
|
|
|
5839
5861
|
// packages/cli/client/browserShellApprovalBridge.ts
|
|
5840
5862
|
import { createServer } from "node:http";
|
|
5841
5863
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
5842
|
-
|
|
5843
|
-
// packages/cli/client/hostApprovalFlow.ts
|
|
5844
|
-
var HOST_APPROVAL_SUMMARY_LIMIT = 2500;
|
|
5845
|
-
function clipApprovalSummary(text, limit = HOST_APPROVAL_SUMMARY_LIMIT) {
|
|
5846
|
-
const value = String(text ?? "").replace(/\r\n?/g, "\n").trim();
|
|
5847
|
-
if (value.length <= limit) return value;
|
|
5848
|
-
const tailChars = Math.max(1, Math.round(limit * 0.3));
|
|
5849
|
-
const headChars = Math.max(1, limit - tailChars);
|
|
5850
|
-
const head = value.slice(0, headChars);
|
|
5851
|
-
const tail = value.slice(value.length - tailChars);
|
|
5852
|
-
const omitted = value.length - head.length - tail.length;
|
|
5853
|
-
return `${head}
|
|
5854
|
-
\u2026\uFF08\u4E2D\u95F4 ${omitted} \u5B57\u7B26\u672A\u663E\u793A\uFF0C\u4EE5\u4E0B\u662F\u7ED3\u5C3E\uFF1B\u5168\u6587 ${value.length} \u5B57\u7B26\uFF09\u2026
|
|
5855
|
-
${tail}`;
|
|
5856
|
-
}
|
|
5857
|
-
function toEpochMs(value) {
|
|
5858
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
5859
|
-
return value < 1e11 ? Math.round(value * 1e3) : Math.round(value);
|
|
5860
|
-
}
|
|
5861
|
-
if (typeof value === "string" && value.trim()) {
|
|
5862
|
-
const asNumber = Number(value);
|
|
5863
|
-
if (Number.isFinite(asNumber)) return toEpochMs(asNumber);
|
|
5864
|
-
const parsed = Date.parse(value);
|
|
5865
|
-
if (Number.isFinite(parsed)) return parsed;
|
|
5866
|
-
}
|
|
5867
|
-
return void 0;
|
|
5868
|
-
}
|
|
5869
|
-
function remainingApprovalMs(expiresAt, now) {
|
|
5870
|
-
return Math.max(0, expiresAt - now);
|
|
5871
|
-
}
|
|
5872
|
-
function formatApprovalRemaining(expiresAt, now) {
|
|
5873
|
-
const totalSeconds = Math.ceil(remainingApprovalMs(expiresAt, now) / 1e3);
|
|
5874
|
-
if (totalSeconds <= 0) return "0s";
|
|
5875
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
5876
|
-
const seconds = totalSeconds % 60;
|
|
5877
|
-
return minutes > 0 ? `${minutes}m${seconds}s` : `${seconds}s`;
|
|
5878
|
-
}
|
|
5879
|
-
function isRecordLike(value) {
|
|
5880
|
-
return typeof value === "object" && value !== null;
|
|
5881
|
-
}
|
|
5882
|
-
function asTrimmedString2(value) {
|
|
5883
|
-
return typeof value === "string" ? value.trim() : "";
|
|
5884
|
-
}
|
|
5885
|
-
function normalizePendingApproval(raw) {
|
|
5886
|
-
if (!isRecordLike(raw)) return null;
|
|
5887
|
-
const approvalId = asTrimmedString2(raw.approvalId);
|
|
5888
|
-
const expiresAt = toEpochMs(raw.expiresAt ?? raw.expiresAtMs);
|
|
5889
|
-
if (!approvalId || expiresAt === void 0) return null;
|
|
5890
|
-
const tabId = asTrimmedString2(raw.tabId);
|
|
5891
|
-
return {
|
|
5892
|
-
approvalId,
|
|
5893
|
-
actionLabel: asTrimmedString2(raw.action) || "unknown",
|
|
5894
|
-
...asTrimmedString2(raw.target) ? { target: asTrimmedString2(raw.target) } : {},
|
|
5895
|
-
origin: asTrimmedString2(raw.origin),
|
|
5896
|
-
// Passed through verbatim (the connector's preview already has the identity line, the head and
|
|
5897
|
-
// the stated tail); only an upper-bound guard may touch it, see clipApprovalSummary.
|
|
5898
|
-
summary: clipApprovalSummary(asTrimmedString2(raw.summary)),
|
|
5899
|
-
expiresAt,
|
|
5900
|
-
...tabId ? { tabId } : {}
|
|
5901
|
-
};
|
|
5902
|
-
}
|
|
5903
|
-
function parsePendingApprovalResult(result) {
|
|
5904
|
-
let parsed;
|
|
5905
|
-
try {
|
|
5906
|
-
parsed = JSON.parse(result.content);
|
|
5907
|
-
} catch {
|
|
5908
|
-
return null;
|
|
5909
|
-
}
|
|
5910
|
-
if (!isRecordLike(parsed)) return null;
|
|
5911
|
-
const errorBlock = isRecordLike(parsed.error) ? parsed.error : void 0;
|
|
5912
|
-
const details = isRecordLike(errorBlock?.details) ? errorBlock.details : void 0;
|
|
5913
|
-
const verdict = isRecordLike(parsed.result) ? parsed.result : void 0;
|
|
5914
|
-
const candidates = [verdict, errorBlock, details].filter(isRecordLike);
|
|
5915
|
-
const pending = candidates.find((entry) => entry.code === "USER_APPROVAL_PENDING");
|
|
5916
|
-
if (!pending) return null;
|
|
5917
|
-
const ordered = [pending, details, verdict].filter(isRecordLike);
|
|
5918
|
-
const readField = (key) => {
|
|
5919
|
-
for (const entry of ordered) {
|
|
5920
|
-
const value = asTrimmedString2(entry[key]);
|
|
5921
|
-
if (value) return value;
|
|
5922
|
-
}
|
|
5923
|
-
return "";
|
|
5924
|
-
};
|
|
5925
|
-
const approvalId = readField("approvalId");
|
|
5926
|
-
if (!approvalId) return null;
|
|
5927
|
-
let expiresAt;
|
|
5928
|
-
for (const entry of ordered) {
|
|
5929
|
-
const candidate = toEpochMs(entry.expiresAt ?? entry.expiresAtMs);
|
|
5930
|
-
if (candidate !== void 0) {
|
|
5931
|
-
expiresAt = candidate;
|
|
5932
|
-
break;
|
|
5933
|
-
}
|
|
5934
|
-
}
|
|
5935
|
-
const message = readField("message");
|
|
5936
|
-
return {
|
|
5937
|
-
approvalId,
|
|
5938
|
-
action: readField("action"),
|
|
5939
|
-
...expiresAt !== void 0 ? { expiresAt } : {},
|
|
5940
|
-
...message ? { message } : {}
|
|
5941
|
-
};
|
|
5942
|
-
}
|
|
5943
|
-
function withApprovalId(call, approvalId) {
|
|
5944
|
-
let payload;
|
|
5945
|
-
try {
|
|
5946
|
-
const parsed = JSON.parse(call.arguments || "{}");
|
|
5947
|
-
payload = isRecordLike(parsed) ? { ...parsed } : {};
|
|
5948
|
-
} catch {
|
|
5949
|
-
return call;
|
|
5950
|
-
}
|
|
5951
|
-
payload.approvalId = approvalId;
|
|
5952
|
-
return { ...call, arguments: JSON.stringify(payload) };
|
|
5953
|
-
}
|
|
5954
|
-
function withHostApprovalRequest(call) {
|
|
5955
|
-
let payload;
|
|
5956
|
-
try {
|
|
5957
|
-
const parsed = JSON.parse(call.arguments || "{}");
|
|
5958
|
-
payload = isRecordLike(parsed) ? { ...parsed } : {};
|
|
5959
|
-
} catch {
|
|
5960
|
-
return call;
|
|
5961
|
-
}
|
|
5962
|
-
payload.hostApproval = true;
|
|
5963
|
-
return { ...call, arguments: JSON.stringify(payload) };
|
|
5964
|
-
}
|
|
5965
|
-
function createConnectorApprovalPort(getClient) {
|
|
5966
|
-
return {
|
|
5967
|
-
async listPendingApprovals() {
|
|
5968
|
-
const raw = await getClient().request("list_pending_approvals", {});
|
|
5969
|
-
const list = isRecordLike(raw) && Array.isArray(raw.approvals) ? raw.approvals : [];
|
|
5970
|
-
return list.map(normalizePendingApproval).filter((entry) => entry !== null);
|
|
5971
|
-
},
|
|
5972
|
-
async submitApprovalDecision(approvalId, decision) {
|
|
5973
|
-
try {
|
|
5974
|
-
const raw = await getClient().request("submit_approval_decision", {
|
|
5975
|
-
approvalId,
|
|
5976
|
-
decision
|
|
5977
|
-
});
|
|
5978
|
-
if (isRecordLike(raw) && raw.ok === false) {
|
|
5979
|
-
return { failed: asTrimmedString2(raw.code) || "USER_APPROVAL_REJECTED" };
|
|
5980
|
-
}
|
|
5981
|
-
const status = isRecordLike(raw) && raw.status === "denied" ? "denied" : "allowed";
|
|
5982
|
-
return { status };
|
|
5983
|
-
} catch (error) {
|
|
5984
|
-
const code = asTrimmedString2(error?.code);
|
|
5985
|
-
return { failed: code || "CHROME_CONNECTOR_ERROR" };
|
|
5986
|
-
}
|
|
5987
|
-
}
|
|
5988
|
-
};
|
|
5989
|
-
}
|
|
5990
|
-
function approvalFailure(code, message, action, extra) {
|
|
5991
|
-
return {
|
|
5992
|
-
content: JSON.stringify({ ok: false, error: { code, message } }),
|
|
5993
|
-
metadata: { chromeConnector: true, error: true, code, action, ...extra ?? {} }
|
|
5994
|
-
};
|
|
5995
|
-
}
|
|
5996
|
-
async function runConnectorToolWithHostApproval(args) {
|
|
5997
|
-
const first = await args.execute(
|
|
5998
|
-
withHostApprovalRequest(args.call)
|
|
5999
|
-
);
|
|
6000
|
-
const pending = parsePendingApprovalResult(first);
|
|
6001
|
-
if (!pending || !args.awaitHostApproval) return first;
|
|
6002
|
-
const now = args.now ?? Date.now;
|
|
6003
|
-
let listed;
|
|
6004
|
-
try {
|
|
6005
|
-
listed = await args.connector.listPendingApprovals();
|
|
6006
|
-
} catch {
|
|
6007
|
-
return first;
|
|
6008
|
-
}
|
|
6009
|
-
const card = listed.find((entry) => entry.approvalId === pending.approvalId);
|
|
6010
|
-
if (!card) {
|
|
6011
|
-
return approvalFailure(
|
|
6012
|
-
"USER_APPROVAL_EXPIRED",
|
|
6013
|
-
"\u5BA1\u6279\u5DF2\u8FC7\u671F\u6216\u4E0D\u518D\u5F85\u6279\uFF0C\u52A8\u4F5C\u672A\u6267\u884C\u3002",
|
|
6014
|
-
args.call.name
|
|
6015
|
-
);
|
|
6016
|
-
}
|
|
6017
|
-
if (card.expiresAt <= now()) {
|
|
6018
|
-
return approvalFailure("USER_APPROVAL_EXPIRED", "\u5BA1\u6279\u5DF2\u8FC7\u671F\uFF0C\u52A8\u4F5C\u672A\u6267\u884C\u3002", args.call.name);
|
|
6019
|
-
}
|
|
6020
|
-
const decision = await args.awaitHostApproval(card);
|
|
6021
|
-
if (decision === "deny") {
|
|
6022
|
-
await args.connector.submitApprovalDecision(card.approvalId, "deny");
|
|
6023
|
-
return approvalFailure("USER_APPROVAL_DENIED", "\u7528\u6237\u5DF2\u62D2\u7EDD", args.call.name, {
|
|
6024
|
-
approvalId: card.approvalId
|
|
6025
|
-
});
|
|
6026
|
-
}
|
|
6027
|
-
const submitted = await args.connector.submitApprovalDecision(card.approvalId, "allow_once");
|
|
6028
|
-
if ("failed" in submitted) {
|
|
6029
|
-
return approvalFailure(
|
|
6030
|
-
submitted.failed,
|
|
6031
|
-
submitted.failed === "USER_APPROVAL_EXPIRED" ? "\u5BA1\u6279\u5DF2\u8FC7\u671F\uFF0C\u52A8\u4F5C\u672A\u6267\u884C\u3002" : "\u5BA1\u6279\u51B3\u5B9A\u672A\u88AB\u8FDE\u63A5\u5668\u63A5\u53D7\uFF0C\u52A8\u4F5C\u672A\u6267\u884C\u3002",
|
|
6032
|
-
args.call.name,
|
|
6033
|
-
{ approvalId: card.approvalId }
|
|
6034
|
-
);
|
|
6035
|
-
}
|
|
6036
|
-
if (submitted.status === "denied") {
|
|
6037
|
-
return approvalFailure("USER_APPROVAL_DENIED", "\u7528\u6237\u5DF2\u62D2\u7EDD", args.call.name, {
|
|
6038
|
-
approvalId: card.approvalId
|
|
6039
|
-
});
|
|
6040
|
-
}
|
|
6041
|
-
return args.execute(withApprovalId(args.call, card.approvalId));
|
|
6042
|
-
}
|
|
6043
|
-
function createHostApprovalCardQueue() {
|
|
6044
|
-
const waiting = [];
|
|
6045
|
-
let active = false;
|
|
6046
|
-
const drain = async () => {
|
|
6047
|
-
if (active) return;
|
|
6048
|
-
active = true;
|
|
6049
|
-
try {
|
|
6050
|
-
while (waiting.length > 0) {
|
|
6051
|
-
waiting.sort((a, b) => a.card.expiresAt - b.card.expiresAt);
|
|
6052
|
-
const entry = waiting.shift();
|
|
6053
|
-
let decision = "deny";
|
|
6054
|
-
try {
|
|
6055
|
-
decision = await entry.present(entry.card);
|
|
6056
|
-
} catch {
|
|
6057
|
-
decision = "deny";
|
|
6058
|
-
}
|
|
6059
|
-
entry.resolve(decision);
|
|
6060
|
-
}
|
|
6061
|
-
} finally {
|
|
6062
|
-
active = false;
|
|
6063
|
-
}
|
|
6064
|
-
};
|
|
6065
|
-
return {
|
|
6066
|
-
/** Resolves with the user's answer once this card reaches the head of the queue. */
|
|
6067
|
-
present(card, present) {
|
|
6068
|
-
return new Promise((resolve7) => {
|
|
6069
|
-
waiting.push({ card, present, resolve: resolve7 });
|
|
6070
|
-
void Promise.resolve().then(drain);
|
|
6071
|
-
});
|
|
6072
|
-
},
|
|
6073
|
-
/** Cards currently queued or being shown (tests/telemetry). */
|
|
6074
|
-
size: () => waiting.length + (active ? 1 : 0)
|
|
6075
|
-
};
|
|
6076
|
-
}
|
|
6077
|
-
var registeredRenderer = null;
|
|
6078
|
-
function registerHostApprovalRenderer(renderer) {
|
|
6079
|
-
registeredRenderer = renderer;
|
|
6080
|
-
return () => {
|
|
6081
|
-
if (registeredRenderer === renderer) registeredRenderer = null;
|
|
6082
|
-
};
|
|
6083
|
-
}
|
|
6084
|
-
function getHostApprovalRenderer() {
|
|
6085
|
-
return registeredRenderer ?? void 0;
|
|
6086
|
-
}
|
|
6087
|
-
|
|
6088
|
-
// packages/cli/client/browserShellApprovalBridge.ts
|
|
6089
5864
|
async function createBrowserShellApprovalBridge(args) {
|
|
6090
5865
|
const timeoutMs = args.timeoutMs ?? 6e4;
|
|
6091
5866
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 6e4) throw new Error("Invalid bridge timeout");
|
|
@@ -6136,6 +5911,7 @@ async function createBrowserShellApprovalBridge(args) {
|
|
|
6136
5911
|
let retry = false;
|
|
6137
5912
|
await runConnectorToolWithHostApproval({
|
|
6138
5913
|
call: current.call,
|
|
5914
|
+
signal: lifetime.signal,
|
|
6139
5915
|
execute: async () => {
|
|
6140
5916
|
requireActive();
|
|
6141
5917
|
if (calls++ === 0) return current.pending;
|
|
@@ -6427,11 +6203,9 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6427
6203
|
return text;
|
|
6428
6204
|
};
|
|
6429
6205
|
const guardExplicitTableCapture = (call) => {
|
|
6430
|
-
if (inferCaptureIntent(String(call.userInput ?? "")) === "strong")
|
|
6431
|
-
return null;
|
|
6432
6206
|
return JSON.stringify({
|
|
6433
6207
|
error: "knowledge_capture_requires_confirmation",
|
|
6434
|
-
message: "\u5F53\u524D\
|
|
6208
|
+
message: "\u5F53\u524D\u6267\u884C\u9762\u6CA1\u6709\u53EF\u4FE1\u786E\u8BA4\u91CD\u653E\u80FD\u529B\uFF1B\u8BF7\u5728\u652F\u6301\u786E\u8BA4\u7684\u754C\u9762\u6838\u5BF9\u5177\u4F53\u5185\u5BB9\u548C\u76EE\u6807\u540E\u4FDD\u5B58\u3002",
|
|
6435
6209
|
policy: {
|
|
6436
6210
|
capability: "knowledge_capture",
|
|
6437
6211
|
target: "table",
|
|
@@ -6535,7 +6309,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6535
6309
|
const shortHash = (value, len) => createHash2("sha256").update(value).digest("hex").slice(0, len);
|
|
6536
6310
|
const localMemoryContext = async () => {
|
|
6537
6311
|
const openCliLocalRuntimeDb = async () => {
|
|
6538
|
-
const { getDefaultCliLocalRuntimeDb: getDefaultCliLocalRuntimeDb2 } = await import("./localRuntimeDb-
|
|
6312
|
+
const { getDefaultCliLocalRuntimeDb: getDefaultCliLocalRuntimeDb2 } = await import("./localRuntimeDb-CRNIBOOM.js");
|
|
6539
6313
|
return getDefaultCliLocalRuntimeDb2({ env: args.env });
|
|
6540
6314
|
};
|
|
6541
6315
|
try {
|
|
@@ -6566,7 +6340,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6566
6340
|
const hits = recallMemoryVNextLocal({
|
|
6567
6341
|
query,
|
|
6568
6342
|
entities: catalog.entities,
|
|
6569
|
-
states: catalog.states.filter((s) => !s.retiredAt && s.text.trim())
|
|
6343
|
+
states: catalog.states.filter((s) => !s.retiredAt && s.facet !== "work-context" && s.text.trim())
|
|
6570
6344
|
});
|
|
6571
6345
|
if (hits.length === 0) return null;
|
|
6572
6346
|
const { mergeAndDedupUserData } = await import("./userDataMerge-HT2ZVHBJ.js");
|
|
@@ -6589,6 +6363,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6589
6363
|
activationCount: 1,
|
|
6590
6364
|
importance: typeof value.importance === "number" ? value.importance : 0.9,
|
|
6591
6365
|
...typeof value.confidence === "number" && Number.isFinite(value.confidence) ? { confidence: value.confidence } : {},
|
|
6366
|
+
...["verified", "stated", "inferred"].includes(value.provenance) ? { provenance: value.provenance } : {},
|
|
6592
6367
|
...typeof value.sourceKind === "string" ? { sourceKind: value.sourceKind } : {},
|
|
6593
6368
|
...typeof value.sourceDialogId === "string" ? { sourceDialogId: value.sourceDialogId } : {},
|
|
6594
6369
|
evidence,
|
|
@@ -6616,7 +6391,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6616
6391
|
for (let i = ordered.length - 1; i >= 0; i -= 1) {
|
|
6617
6392
|
if (isTombstoneRecord2(ordered[i])) ordered.splice(i, 1);
|
|
6618
6393
|
}
|
|
6619
|
-
const { buildMemoryOverlay, DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET } = await import("./overlay-
|
|
6394
|
+
const { buildMemoryOverlay, DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET } = await import("./overlay-JA3SPVUS.js");
|
|
6620
6395
|
const promptBlock = buildMemoryOverlay(ordered, {
|
|
6621
6396
|
maxTokens: DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET
|
|
6622
6397
|
});
|
|
@@ -6667,6 +6442,8 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6667
6442
|
kind: input.kind,
|
|
6668
6443
|
contentKey,
|
|
6669
6444
|
origin: "cli-local",
|
|
6445
|
+
...input.provenance ? { provenance: input.provenance } : {},
|
|
6446
|
+
...input.sourceKind ? { sourceKind: input.sourceKind } : {},
|
|
6670
6447
|
...input.tags?.length ? { tags: input.tags } : {}
|
|
6671
6448
|
},
|
|
6672
6449
|
text: input.content,
|
|
@@ -6722,8 +6499,47 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6722
6499
|
}
|
|
6723
6500
|
return { retired, localOnlyRetired, skippedRemoteMiss };
|
|
6724
6501
|
};
|
|
6502
|
+
const workMemory = async (call, parsed, write) => {
|
|
6503
|
+
const context = call.runtimeContext;
|
|
6504
|
+
const dialogId = context?.dialogId;
|
|
6505
|
+
const userMessageId = context?.userMessageId;
|
|
6506
|
+
if (typeof dialogId !== "string" || write && typeof userMessageId !== "string") throw new Error("work memory requires host dialogId and persisted userMessageId");
|
|
6507
|
+
const fields = write ? ["itemKey", "activityId", "expectedRevision", "changeId", "patch"] : ["activityId", "status", "query", "limit", "discovery"];
|
|
6508
|
+
const payload = Object.fromEntries(fields.filter((k) => parsed[k] !== void 0 && parsed[k] !== "").map((k) => [k, parsed[k]]));
|
|
6509
|
+
if (parsed.storage !== void 0 && parsed.storage !== "server" && parsed.storage !== "local") throw new Error("invalid work storage");
|
|
6510
|
+
const { formatWorkContextWriteNotice } = await import("./workContextWriteNotice-YCSSMHN4.js");
|
|
6511
|
+
const writeResult = (result2, priorNotice, storage) => ({
|
|
6512
|
+
...result2,
|
|
6513
|
+
notice: [formatWorkContextWriteNotice(result2, storage ? { storage } : void 0), priorNotice].filter((v) => typeof v === "string" && v !== "").join("\n")
|
|
6514
|
+
});
|
|
6515
|
+
const workMetadata = { serverPlatformTool: true, memoryWrite: write, memoryRead: !write };
|
|
6516
|
+
if (parsed.storage === "server") {
|
|
6517
|
+
const content2 = await postServer(write ? "/api/memory/remember" : "/api/memory/query", { mode: "work", ...payload, dialogId, ...write ? { userMessageId } : {} });
|
|
6518
|
+
if (!write) return { content: content2, metadata: workMetadata };
|
|
6519
|
+
let served;
|
|
6520
|
+
try {
|
|
6521
|
+
served = JSON.parse(content2);
|
|
6522
|
+
} catch {
|
|
6523
|
+
return { content: content2, metadata: workMetadata };
|
|
6524
|
+
}
|
|
6525
|
+
return { content: JSON.stringify(writeResult(served, typeof served?.notice === "string" ? served.notice : void 0, "server")), metadata: workMetadata };
|
|
6526
|
+
}
|
|
6527
|
+
const ctx = await localMemoryContext();
|
|
6528
|
+
if (!ctx) throw new Error("local work memory unavailable");
|
|
6529
|
+
const { resolveLocalUserId: resolveLocalUserId2 } = await import("./cliAgentConfigHelpers-U5OAVAKQ.js");
|
|
6530
|
+
const localUserId = resolveLocalUserId2(args.env);
|
|
6531
|
+
const { resolveWorkContextAccess } = await import("./workContextAccess-UZHDLBUR.js");
|
|
6532
|
+
const { updateWorkContext, readWorkContexts } = await import("./workContext-MM3P5GP5.js");
|
|
6533
|
+
const { scope, sourceRef } = await resolveWorkContextAccess(ctx.db, localUserId, dialogId, write ? userMessageId : void 0);
|
|
6534
|
+
if (scope.spaceId) throw new Error("local work memory cannot verify space membership");
|
|
6535
|
+
const result = write ? await updateWorkContext(ctx.db, scope, { ...payload.activityId !== void 0 ? { activityId: payload.activityId, expectedRevision: payload.expectedRevision } : { itemKey: payload.itemKey, originRef: sourceRef }, changeId: payload.changeId, sourceRefs: [sourceRef], patch: payload.patch }) : await readWorkContexts(ctx.db, scope, payload);
|
|
6536
|
+
const storageNotice = "Local and server stores are independent; changeId deduplication covers actual changes only.";
|
|
6537
|
+
const content = write ? { ...writeResult(result, storageNotice, "local"), storage: "local" } : { ...result, storage: "local", notice: storageNotice };
|
|
6538
|
+
return { content: JSON.stringify(content), metadata: workMetadata };
|
|
6539
|
+
};
|
|
6725
6540
|
const queryMemory = async (call) => {
|
|
6726
6541
|
const parsed = parseNoloWorkspaceToolArguments(call.arguments);
|
|
6542
|
+
if (parsed.mode === "work") return workMemory(call, parsed, false);
|
|
6727
6543
|
const query = typeof parsed.query === "string" ? parsed.query.trim() : "";
|
|
6728
6544
|
if (!query) {
|
|
6729
6545
|
return {
|
|
@@ -6760,6 +6576,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6760
6576
|
};
|
|
6761
6577
|
const rememberMemory = async (call) => {
|
|
6762
6578
|
const parsed = parseNoloWorkspaceToolArguments(call.arguments);
|
|
6579
|
+
if (parsed.mode === "work") return workMemory(call, parsed, true);
|
|
6763
6580
|
const content = typeof parsed.content === "string" ? parsed.content.trim() : "";
|
|
6764
6581
|
if (!content) {
|
|
6765
6582
|
return {
|
|
@@ -6775,6 +6592,7 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6775
6592
|
kind: parsed.kind ?? "episodic",
|
|
6776
6593
|
source: "agent-inferred"
|
|
6777
6594
|
};
|
|
6595
|
+
if (["verified", "stated", "inferred"].includes(parsed.provenance)) body.provenance = parsed.provenance;
|
|
6778
6596
|
if (typeof parsed.recurrenceEvidence === "string" && parsed.recurrenceEvidence.trim()) {
|
|
6779
6597
|
body.recurrenceEvidence = parsed.recurrenceEvidence.trim();
|
|
6780
6598
|
}
|
|
@@ -6795,6 +6613,8 @@ function buildServerPlatformToolExecutors(args) {
|
|
|
6795
6613
|
kind: String(saved?.kind ?? serverResult?.savedKind ?? body.kind ?? "episodic"),
|
|
6796
6614
|
createdAt: typeof saved?.createdAt === "string" && saved.createdAt ? saved.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
6797
6615
|
confidence: typeof saved?.confidence === "number" ? saved.confidence : 0.8,
|
|
6616
|
+
provenance: typeof saved?.provenance === "string" ? saved.provenance : void 0,
|
|
6617
|
+
sourceKind: typeof saved?.sourceKind === "string" ? saved.sourceKind : void 0,
|
|
6798
6618
|
tags: Array.isArray(saved?.tags) ? saved.tags.map(String) : void 0
|
|
6799
6619
|
});
|
|
6800
6620
|
} catch {
|
|
@@ -7458,13 +7278,13 @@ function isFailureStatus(status) {
|
|
|
7458
7278
|
function isOrphanedStatus(status) {
|
|
7459
7279
|
return status === "orphaned";
|
|
7460
7280
|
}
|
|
7461
|
-
function
|
|
7281
|
+
function toEpochMs(iso) {
|
|
7462
7282
|
if (!iso) return void 0;
|
|
7463
7283
|
const ms = Date.parse(iso);
|
|
7464
7284
|
return Number.isFinite(ms) ? ms : void 0;
|
|
7465
7285
|
}
|
|
7466
7286
|
function isOverTimeout(run, nowMs, timeoutMs) {
|
|
7467
|
-
const startedMs =
|
|
7287
|
+
const startedMs = toEpochMs(run.startedAt);
|
|
7468
7288
|
if (startedMs === void 0) return false;
|
|
7469
7289
|
return nowMs - startedMs >= timeoutMs;
|
|
7470
7290
|
}
|
|
@@ -7510,7 +7330,7 @@ function aggregateBatch(input) {
|
|
|
7510
7330
|
const { batchId, runs, now } = input;
|
|
7511
7331
|
const timeoutMs = input.timeoutMs ?? DEFAULT_BATCH_TIMEOUT_MS;
|
|
7512
7332
|
const notified = new Set(input.notifiedReasons ?? []);
|
|
7513
|
-
const nowMs =
|
|
7333
|
+
const nowMs = toEpochMs(now) ?? 0;
|
|
7514
7334
|
let success = 0;
|
|
7515
7335
|
let failed = 0;
|
|
7516
7336
|
let orphaned = 0;
|
|
@@ -9296,7 +9116,7 @@ async function evaluateAutoInstaboxPlacement(input) {
|
|
|
9296
9116
|
}
|
|
9297
9117
|
}
|
|
9298
9118
|
if (effectiveAvailableMb === null) {
|
|
9299
|
-
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u63A2\u6D4B\u5931\u8D25\u6216\u672A\u77E5\uFF08${memoryDiagnosis}\uFF09\uFF1B\u65E0\u6CD5\u5224\u65AD\u662F\u5426\u4F4E\u4E8E\u9884\u7B97\uFF08${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u4FDD\u6301\u9ED8\u8BA4\
|
|
9119
|
+
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u63A2\u6D4B\u5931\u8D25\u6216\u672A\u77E5\uFF08${memoryDiagnosis}\uFF09\uFF1B\u65E0\u6CD5\u5224\u65AD\u662F\u5426\u4F4E\u4E8E\u9884\u7B97\uFF08${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u4FDD\u6301\u9ED8\u8BA4\u5BBF\u4E3B\uFF08\u5199\u578B\u6D3E\u53D1\u4ECD\u987B allowHostWrites: true\uFF09\uFF0C\u4E0D\u81EA\u52A8\u8FC1\u79FB\u3002`;
|
|
9300
9120
|
return {
|
|
9301
9121
|
selectedRuntimeKey: void 0,
|
|
9302
9122
|
reason: "memory_unknown",
|
|
@@ -9313,7 +9133,7 @@ async function evaluateAutoInstaboxPlacement(input) {
|
|
|
9313
9133
|
}
|
|
9314
9134
|
const autoEnabled = input.autoEnabled === true || input.env?.NOLO_INSTABOX_AUTO === "1" || typeof process !== "undefined" && process.env?.NOLO_INSTABOX_AUTO === "1";
|
|
9315
9135
|
if (!autoEnabled) {
|
|
9316
|
-
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u4F46\u672A\u542F\u7528\u81EA\u52A8 Instabox\uFF08\u9700\u8BBE\u7F6E NOLO_INSTABOX_AUTO=1 \u6216\u914D\u7F6E\u5F00\u542F\uFF09\uFF1B\u4FDD\u6301\u9ED8\u8BA4
|
|
9136
|
+
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u4F46\u672A\u542F\u7528\u81EA\u52A8 Instabox\uFF08\u9700\u8BBE\u7F6E NOLO_INSTABOX_AUTO=1 \u6216\u914D\u7F6E\u5F00\u542F\uFF09\uFF1B\u4FDD\u6301\u9ED8\u8BA4\u5BBF\u4E3B\uFF08\u5199\u578B\u6D3E\u53D1\u4ECD\u987B allowHostWrites: true\uFF09\u3002`;
|
|
9317
9137
|
return {
|
|
9318
9138
|
selectedRuntimeKey: void 0,
|
|
9319
9139
|
reason: "auto_disabled",
|
|
@@ -9328,7 +9148,7 @@ async function evaluateAutoInstaboxPlacement(input) {
|
|
|
9328
9148
|
});
|
|
9329
9149
|
} catch (error) {
|
|
9330
9150
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
9331
|
-
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u53D7\u963B\uFF1A${errorMsg}\uFF1B\u4FDD\u6301\u9ED8\u8BA4
|
|
9151
|
+
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u53D7\u963B\uFF1A${errorMsg}\uFF1B\u4FDD\u6301\u9ED8\u8BA4\u5BBF\u4E3B\uFF08\u5199\u578B\u6D3E\u53D1\u4ECD\u987B allowHostWrites: true\uFF09\u3002`;
|
|
9332
9152
|
return {
|
|
9333
9153
|
selectedRuntimeKey: void 0,
|
|
9334
9154
|
reason: "config_unavailable",
|
|
@@ -9340,7 +9160,7 @@ async function evaluateAutoInstaboxPlacement(input) {
|
|
|
9340
9160
|
try {
|
|
9341
9161
|
const readiness = await input.checkReadiness();
|
|
9342
9162
|
if (readiness && readiness.ready === false) {
|
|
9343
|
-
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u4F46\u88AB\u670D\u52A1\u7AEF\u51C6\u5165/\u5C31\u7EEA\u660E\u786E\u62D2\u7EDD\uFF1A${readiness.reason ?? "\u670D\u52A1\u7AEF\u672A\u5C31\u7EEA"}\uFF1B\u4FDD\u6301\u9ED8\u8BA4
|
|
9163
|
+
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u4F46\u88AB\u670D\u52A1\u7AEF\u51C6\u5165/\u5C31\u7EEA\u660E\u786E\u62D2\u7EDD\uFF1A${readiness.reason ?? "\u670D\u52A1\u7AEF\u672A\u5C31\u7EEA"}\uFF1B\u4FDD\u6301\u9ED8\u8BA4\u5BBF\u4E3B\uFF08\u5199\u578B\u6D3E\u53D1\u4ECD\u987B allowHostWrites: true\uFF09\u3002`;
|
|
9344
9164
|
return {
|
|
9345
9165
|
selectedRuntimeKey: void 0,
|
|
9346
9166
|
reason: "readiness_rejected",
|
|
@@ -9350,7 +9170,7 @@ async function evaluateAutoInstaboxPlacement(input) {
|
|
|
9350
9170
|
}
|
|
9351
9171
|
} catch (error) {
|
|
9352
9172
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
9353
|
-
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u4F46\u5C31\u7EEA\u68C0\u67E5\u629B\u9519\uFF1A${errorMsg}\uFF1B\u4FDD\u6301\u9ED8\u8BA4
|
|
9173
|
+
const note2 = `\u5BBF\u4E3B\u53EF\u7528\u5185\u5B58\u7D27\u7F3A\uFF08${effectiveAvailableMb}MB < ${LOCAL_TOOL_MEMORY_BUDGET_MB}MB\uFF09\uFF0C\u5C1D\u8BD5\u81EA\u52A8\u6539\u7528 Instabox \u4F46\u5C31\u7EEA\u68C0\u67E5\u629B\u9519\uFF1A${errorMsg}\uFF1B\u4FDD\u6301\u9ED8\u8BA4\u5BBF\u4E3B\uFF08\u5199\u578B\u6D3E\u53D1\u4ECD\u987B allowHostWrites: true\uFF09\u3002`;
|
|
9354
9174
|
return {
|
|
9355
9175
|
selectedRuntimeKey: void 0,
|
|
9356
9176
|
reason: "readiness_error",
|
|
@@ -9663,7 +9483,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
9663
9483
|
const dispatch = resolveCliLocalSpawnDispatch({
|
|
9664
9484
|
runtimeKey: effectiveRuntimeKey,
|
|
9665
9485
|
readOnly: args.readOnly === true,
|
|
9666
|
-
// F1
|
|
9486
|
+
// F1:默认写型派发及 runtimeKey=local 是「在宿主文件系统上改代码」,需要调用方的显式确认
|
|
9667
9487
|
// (allowHostWrites: true);缺失即派发前拒绝(零 spawn、零 run 记录)。
|
|
9668
9488
|
allowHostWrites: args.allowHostWrites,
|
|
9669
9489
|
// 政策第 5 条:显式宿主 cwd × 沙盒落点必须在派发前失败(沙盒不兑现宿主
|
|
@@ -9745,7 +9565,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
9745
9565
|
...args.ephemeral === true ? ["--ephemeral"] : [],
|
|
9746
9566
|
// 只读角色安全收敛:审查类任务物理剥离写/改/删工具,遵循最小特权原则。
|
|
9747
9567
|
...isReadOnlyTask ? ["--read-only"] : [],
|
|
9748
|
-
//
|
|
9568
|
+
// 执行后端(默认宿主;写型须确认,沙盒须显式指定):唯一产出 `--runtime-key`
|
|
9749
9569
|
// 的地方,成对不变式在 buildCliLocalRuntimeForwardArgs 内机械断言。
|
|
9750
9570
|
...buildCliLocalRuntimeForwardArgs(dispatch),
|
|
9751
9571
|
...instaboxArgs,
|
|
@@ -9806,7 +9626,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
9806
9626
|
...args.ephemeral === true ? { ephemeral: true } : {},
|
|
9807
9627
|
output: noopOutput
|
|
9808
9628
|
},
|
|
9809
|
-
{ ...deps, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
|
|
9629
|
+
{ ...deps, mcpApprovalHost: deps.mcpApprovalHostForAgent ? await deps.mcpApprovalHostForAgent(agentKey) : deps.mcpApprovalHost, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
|
|
9810
9630
|
);
|
|
9811
9631
|
const displayName = resolveRunLabel({ agentName, agentKey, runId });
|
|
9812
9632
|
const labels = agentRunCardLabels();
|
|
@@ -9914,7 +9734,7 @@ async function spawnContinuationRun(reconciled, message, userInput, deps) {
|
|
|
9914
9734
|
continuedFrom,
|
|
9915
9735
|
output: noopOutput
|
|
9916
9736
|
},
|
|
9917
|
-
{ ...deps, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
|
|
9737
|
+
{ ...deps, mcpApprovalHost: deps.mcpApprovalHostForAgent ? await deps.mcpApprovalHostForAgent(agentKey) : deps.mcpApprovalHost, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
|
|
9918
9738
|
);
|
|
9919
9739
|
const taskPreview = userInput.replace(/\s+/g, " ").trim().slice(0, TASK_PREVIEW_MAX);
|
|
9920
9740
|
return {
|
|
@@ -10348,11 +10168,21 @@ function buildCliChromeConnectorToolExecutors(args) {
|
|
|
10348
10168
|
return Object.fromEntries(
|
|
10349
10169
|
CHROME_CONNECTOR_ACCEPTED_TOOL_NAMES.map((toolName) => [
|
|
10350
10170
|
toolName,
|
|
10351
|
-
(call) => {
|
|
10171
|
+
(call, options) => {
|
|
10352
10172
|
const target = approvalTargetForCall(call);
|
|
10353
10173
|
const connector = createConnectorApprovalPort(() => clientForTarget(target));
|
|
10354
10174
|
return runConnectorToolWithHostApproval({
|
|
10355
10175
|
call,
|
|
10176
|
+
signal: options?.abortSignal,
|
|
10177
|
+
// Foreground TUI turns have dialogId/turnId, not a persisted runId.
|
|
10178
|
+
// Preserve runId only when supplied by a real host owner; never mint
|
|
10179
|
+
// one from call.id or turnId (neither identifies a background run).
|
|
10180
|
+
context: {
|
|
10181
|
+
requestId: call.id,
|
|
10182
|
+
dialogId: call.runtimeContext?.dialogId,
|
|
10183
|
+
turnId: call.runtimeContext?.turnId,
|
|
10184
|
+
runId: call.runtimeContext?.runId
|
|
10185
|
+
},
|
|
10356
10186
|
execute: (nextCall) => executeChromeConnectorTool({ clientForTarget, call: nextCall }),
|
|
10357
10187
|
connector,
|
|
10358
10188
|
// Read the registry per call so a TUI that installs its renderer after the table is
|
|
@@ -10662,6 +10492,7 @@ function buildLocalToolExecutors(args) {
|
|
|
10662
10492
|
// (复用 ~/.nolo/runs/ 注册表,MED-1 修复)。
|
|
10663
10493
|
startAgentRun: createCliStartAgentRunExecutor({
|
|
10664
10494
|
shellApprovalHostForAgent: args.shellApprovalHostForAgent,
|
|
10495
|
+
mcpApprovalHostForAgent: args.mcpApprovalHostForAgent,
|
|
10665
10496
|
...pickAgentRunResolverDeps(args),
|
|
10666
10497
|
// α:展示名回读器——resolveAgentRunName 的读取来源(显式 agentName 优先,绝不覆盖)。
|
|
10667
10498
|
resolveAgentName: args.resolveAgentName,
|
|
@@ -10673,6 +10504,7 @@ function buildLocalToolExecutors(args) {
|
|
|
10673
10504
|
controlAgentRun: createCliControlAgentRunExecutor({
|
|
10674
10505
|
source: { parentDialogId: args.sourceParentDialogId, agentKey: args.agentKey },
|
|
10675
10506
|
shellApprovalHostForAgent: args.shellApprovalHostForAgent,
|
|
10507
|
+
mcpApprovalHostForAgent: args.mcpApprovalHostForAgent,
|
|
10676
10508
|
cwd: args.workspaceRoot,
|
|
10677
10509
|
cliEntrypoint: args.cliEntrypoint,
|
|
10678
10510
|
env: args.env
|
|
@@ -12279,8 +12111,8 @@ async function createLocalDockerWorkload(args) {
|
|
|
12279
12111
|
}
|
|
12280
12112
|
const createLifecycle = args.createLifecycle ?? (async () => {
|
|
12281
12113
|
const [{ DockerWorkloadLifecycle, createDockerBindingAuthorizer }, accounts] = await Promise.all([
|
|
12282
|
-
import("./workloadLifecycle-
|
|
12283
|
-
import("./accountResolver-
|
|
12114
|
+
import("./workloadLifecycle-YIZ7KLUP.js"),
|
|
12115
|
+
import("./accountResolver-EK2S4PWF.js")
|
|
12284
12116
|
]);
|
|
12285
12117
|
const resolveAccount = args.resolveAccount ?? accounts.createDockerAccountResolver({
|
|
12286
12118
|
env: args.env,
|
|
@@ -14921,6 +14753,17 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
14921
14753
|
const defaultCompactionSummary = createTuiSummaryLlmCaller(deps.env, { fetchImpl, platformPrimary: true });
|
|
14922
14754
|
const loopbackRequest = deps.loopbackRequest ?? (deps.fetchImpl ? void 0 : defaultLoopbackRequest);
|
|
14923
14755
|
const userId = resolveLocalUserId(deps.env);
|
|
14756
|
+
const prependManualCompactHistory = async (dialogId, history) => {
|
|
14757
|
+
const record = await (await getOrCreateSharedStore(deps)).read(`dialog-${userId}-${dialogId}`);
|
|
14758
|
+
if (!Array.isArray(record?.manualCompactHistory)) return history;
|
|
14759
|
+
const { dialogMessageRecordToAgentRuntimeMessage: dialogMessageRecordToAgentRuntimeMessage2 } = await import("./dialogMessageRecord-OAV77LT7.js");
|
|
14760
|
+
const seed = record.manualCompactHistory.map((message) => {
|
|
14761
|
+
const parsed = dialogMessageRecordToAgentRuntimeMessage2(message);
|
|
14762
|
+
if (!parsed) throw new Error("Invalid manual compact history");
|
|
14763
|
+
return parsed;
|
|
14764
|
+
});
|
|
14765
|
+
return [...seed, ...history];
|
|
14766
|
+
};
|
|
14924
14767
|
const resolveLiveImageSupport = createLiveImageSupportResolver(userId, async () => {
|
|
14925
14768
|
const token = await createOAuthApiKeyRefResolver({
|
|
14926
14769
|
migration: { enableLegacyMigration: true },
|
|
@@ -15097,7 +14940,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15097
14940
|
emitRunIsolationNotice(fact, { runId });
|
|
15098
14941
|
try {
|
|
15099
14942
|
const { writeFileSync: writeFileSync4, mkdirSync: mkdirSync4 } = await import("node:fs");
|
|
15100
|
-
const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-
|
|
14943
|
+
const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-VBL7UFSG.js");
|
|
15101
14944
|
recordLocalRunExecutionIsolation({
|
|
15102
14945
|
runId,
|
|
15103
14946
|
runsDir: resolveRunsDir2(deps.env),
|
|
@@ -15122,7 +14965,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15122
14965
|
dockerWorkloadReleased = true;
|
|
15123
14966
|
dockerWorkloadLoad = null;
|
|
15124
14967
|
if (loaded) {
|
|
15125
|
-
const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-
|
|
14968
|
+
const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-VBL7UFSG.js");
|
|
15126
14969
|
const exportRunDiff = deps.exportDockerRunDiffArtifact ?? exportDockerRunDiffArtifact;
|
|
15127
14970
|
const warn = (message) => process.stderr.write(`[nolo] ${message}
|
|
15128
14971
|
`);
|
|
@@ -15249,6 +15092,20 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15249
15092
|
},
|
|
15250
15093
|
resolveAgentRuntimeBindingMachineId,
|
|
15251
15094
|
resolveLocalMachineId,
|
|
15095
|
+
mcpApprovalHostForAgent: async (childAgentKey) => {
|
|
15096
|
+
const approvalSignal = deps.mcpApprovalSignal ?? deps.shellApprovalSession?.signal;
|
|
15097
|
+
if (!getHostApprovalRenderer() || !approvalSignal || approvalSignal.aborted) return void 0;
|
|
15098
|
+
const binding = await resolveChildApprovalBinding({
|
|
15099
|
+
readAgentConfig: async (key) => readAgentFromStore({ agentRef: key, store: await getOrCreateSharedStore(deps), userId }),
|
|
15100
|
+
resolveDeviceId: async () => {
|
|
15101
|
+
const { detectMachineInfo } = await import("./machineInfo-LWHTEBHJ.js");
|
|
15102
|
+
return (await detectMachineInfo({ probeLaunchable: false }))?.machineId;
|
|
15103
|
+
},
|
|
15104
|
+
workspaceRoot,
|
|
15105
|
+
agentKey: childAgentKey
|
|
15106
|
+
});
|
|
15107
|
+
return binding ? { binding, signal: approvalSignal, confirm: confirmMcpOnHost } : void 0;
|
|
15108
|
+
},
|
|
15252
15109
|
...deps.shellApprovalSession ? {
|
|
15253
15110
|
shellApprovalHostForAgent: createChildShellApprovalHostResolver({
|
|
15254
15111
|
readAgentConfig: async (childAgentKey) => readAgentFromStore({
|
|
@@ -15281,6 +15138,13 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15281
15138
|
} } : {},
|
|
15282
15139
|
...runtimeToolExecutionLimits
|
|
15283
15140
|
});
|
|
15141
|
+
let localMcpManagement;
|
|
15142
|
+
const getLocalMcpManagement = () => localMcpManagement ??= openMcpLocalRuntimeManagement({
|
|
15143
|
+
authenticatedUserId: userId,
|
|
15144
|
+
env: deps.env,
|
|
15145
|
+
createOAuthManager: deps.createMcpOAuthManager
|
|
15146
|
+
});
|
|
15147
|
+
const localMcpSessions = /* @__PURE__ */ new Map();
|
|
15284
15148
|
let localToolExecutors = buildCurrentToolExecutors();
|
|
15285
15149
|
const credentialBroker = createHostCredentialBrokerChain({
|
|
15286
15150
|
strict: createStrictHostCredentialBroker(),
|
|
@@ -15458,10 +15322,10 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15458
15322
|
const userPromptPatches = accountAutoReviewPrompt ? [...userSkills.skillPromptPatches, accountAutoReviewPrompt] : userSkills.skillPromptPatches;
|
|
15459
15323
|
const agentConfig = packAgentConfig && userPromptPatches.length ? {
|
|
15460
15324
|
...packAgentConfig,
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
].filter(Boolean).join("\n\n")
|
|
15325
|
+
// Patches are admitted by the account skill graph and arrive once per
|
|
15326
|
+
// canonical skill identity. Keep them separate from arbitrary prompt
|
|
15327
|
+
// text: substring matching cannot establish runtime contribution ownership.
|
|
15328
|
+
prompt: [packAgentConfig.prompt, ...userPromptPatches].filter(Boolean).join("\n\n")
|
|
15465
15329
|
} : packAgentConfig;
|
|
15466
15330
|
const requestedToolNames = agentConfig ? resolveCliRequestedToolNames(
|
|
15467
15331
|
agentConfig,
|
|
@@ -15521,21 +15385,25 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15521
15385
|
env: deps.env,
|
|
15522
15386
|
fetchImpl
|
|
15523
15387
|
});
|
|
15524
|
-
return loaded.messages;
|
|
15388
|
+
return prependManualCompactHistory(dialogId, loaded.messages);
|
|
15525
15389
|
},
|
|
15526
15390
|
// Source-aware variant so a cross-machine resume that could not load the
|
|
15527
15391
|
// remote history reports `none` instead of looking like a new dialog.
|
|
15528
|
-
loadDialogHistoryWithSource: async (dialogId, options) =>
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15392
|
+
loadDialogHistoryWithSource: async (dialogId, options) => {
|
|
15393
|
+
const loaded = await loadCliDialogHistoryWithSource({
|
|
15394
|
+
strictContinueHistory: options?.strictContinueHistory,
|
|
15395
|
+
freshDialog: options?.freshDialog,
|
|
15396
|
+
dialogId,
|
|
15397
|
+
store: await getOrCreateSharedStore(deps),
|
|
15398
|
+
env: deps.env,
|
|
15399
|
+
fetchImpl,
|
|
15400
|
+
log: (message) => {
|
|
15401
|
+
logLocalRuntimeDiagnostic("dialog-history", { dialogId, message });
|
|
15402
|
+
}
|
|
15403
|
+
});
|
|
15404
|
+
const messages = await prependManualCompactHistory(dialogId, loaded.messages);
|
|
15405
|
+
return { ...loaded, messages };
|
|
15406
|
+
},
|
|
15539
15407
|
loadDialogSummary: async (dialogId) => loadCliDialogSummary({
|
|
15540
15408
|
store: await getOrCreateSharedStore(deps),
|
|
15541
15409
|
userId,
|
|
@@ -15905,7 +15773,43 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
15905
15773
|
workspaceRoot,
|
|
15906
15774
|
execShellApproval: deps.execShellApproval,
|
|
15907
15775
|
...runtimeToolExecutionLimits,
|
|
15908
|
-
executors: localToolExecutors,
|
|
15776
|
+
executors: call.name === "listMcpConnections" || call.name === "listMcpTools" || call.name === "callMcpTool" ? { ...localToolExecutors, [call.name]: async (mcpCall) => {
|
|
15777
|
+
const dialogId = opts?.runtimeContext?.dialogId ?? deps.parentDialogId;
|
|
15778
|
+
const agentKey = planningCaller.agentKey;
|
|
15779
|
+
const signal = opts?.abortSignal;
|
|
15780
|
+
if (!userId || !agentKey || typeof dialogId !== "string" || !dialogId || !signal) {
|
|
15781
|
+
return { content: JSON.stringify({ ok: false, error: { code: "forbidden" } }) };
|
|
15782
|
+
}
|
|
15783
|
+
try {
|
|
15784
|
+
let entries = localMcpSessions.get(signal);
|
|
15785
|
+
if (!entries) {
|
|
15786
|
+
entries = /* @__PURE__ */ new Map();
|
|
15787
|
+
localMcpSessions.set(signal, entries);
|
|
15788
|
+
signal.addEventListener("abort", () => {
|
|
15789
|
+
localMcpSessions.delete(signal);
|
|
15790
|
+
for (const pending2 of entries.values()) void pending2.then((mcp2) => mcp2.close()).catch(() => {
|
|
15791
|
+
});
|
|
15792
|
+
}, { once: true });
|
|
15793
|
+
}
|
|
15794
|
+
const key = JSON.stringify([agentKey, dialogId]);
|
|
15795
|
+
let pending = entries.get(key);
|
|
15796
|
+
if (!pending) {
|
|
15797
|
+
pending = getLocalMcpManagement().then((repository) => createMcpLocalRuntimeAdapter({
|
|
15798
|
+
repository,
|
|
15799
|
+
identity: { authenticatedUserId: userId, agentKey, dialogId },
|
|
15800
|
+
signal: deps.mcpApprovalSignal ? AbortSignal.any([signal, deps.mcpApprovalSignal]) : signal,
|
|
15801
|
+
confirm: deps.mcpConfirmation
|
|
15802
|
+
}));
|
|
15803
|
+
entries.set(key, pending);
|
|
15804
|
+
}
|
|
15805
|
+
const mcp = await pending;
|
|
15806
|
+
const input = JSON.parse(mcpCall.arguments);
|
|
15807
|
+
const output = call.name === "listMcpConnections" ? await mcp.listMcpConnections() : call.name === "listMcpTools" ? await mcp.listMcpTools(input) : await mcp.callMcpTool(input);
|
|
15808
|
+
return { content: JSON.stringify(output) };
|
|
15809
|
+
} catch {
|
|
15810
|
+
return { content: JSON.stringify({ ok: false, error: { code: signal.aborted ? "cancelled" : "transport_error" } }) };
|
|
15811
|
+
}
|
|
15812
|
+
} } : localToolExecutors,
|
|
15909
15813
|
// 沙盒分支的 gate 已经跑过(channel 未接管才会落回这里):把
|
|
15910
15814
|
// confirmed 传下去,避免破坏性确认在同一调用里弹第二次。
|
|
15911
15815
|
...sandboxGatePassed ? { confirmed: true } : {},
|
|
@@ -15986,9 +15890,6 @@ export {
|
|
|
15986
15890
|
readTimestamp,
|
|
15987
15891
|
parseAgentRunEvent,
|
|
15988
15892
|
isLiveAgentRunObservation,
|
|
15989
|
-
formatApprovalRemaining,
|
|
15990
|
-
createHostApprovalCardQueue,
|
|
15991
|
-
registerHostApprovalRenderer,
|
|
15992
15893
|
isSubtaskRun,
|
|
15993
15894
|
RUN_WAKE_CHANNEL_ENV,
|
|
15994
15895
|
createOriginShellGrant,
|