nolo-cli 0.241.0-alpha.1 → 0.243.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.
Files changed (187) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-UCWDB72C.js → _executeModel-QLKALBXT.js} +75 -75
  3. package/{action-24MZYW2B.js → action-4V2UISXC.js} +9 -9
  4. package/{addContentAction-HEMCSSHT.js → addContentAction-5MZDMGI6.js} +14 -14
  5. package/{addDialogAgentAction-SQYDOXHA.js → addDialogAgentAction-ONVFHUOL.js} +17 -17
  6. package/{agentDeleteCommand-P7O3ACNJ.js → agentDeleteCommand-AUYYX4MU.js} +97 -97
  7. package/{agentEmailCommands-A5BRSYWK.js → agentEmailCommands-TZPXTTII.js} +98 -98
  8. package/{agentListCommands-LDRCOOMO.js → agentListCommands-7Z74VVSY.js} +198 -161
  9. package/{agentMachineCommands-AYL53KJV.js → agentMachineCommands-7JQ45EPE.js} +48 -46
  10. package/{agentProviderCommands-N5EA3ED2.js → agentProviderCommands-BQP2IK4C.js} +2 -2
  11. package/{agentRecordCommands-FICBZ57C.js → agentRecordCommands-OGOEBWLK.js} +95 -95
  12. package/{agentRunCommand-CTXQGDUM.js → agentRunCommand-ZKTHUSE5.js} +96 -96
  13. package/{agentRunControl-CO6BASZF.js → agentRunControl-CVCHDDDC.js} +10 -8
  14. package/{agentRuntimeLocal-5YN4D5WT.js → agentRuntimeLocal-ODDHRQ3M.js} +48 -41
  15. package/{agentSlice-DJ5D4DU4.js → agentSlice-ITLJEJAW.js} +14 -14
  16. package/{appDeleteCommands-B4E7N7M2.js → appDeleteCommands-QM6AWGQ5.js} +49 -47
  17. package/{appDeployCommands-E4DTXRRM.js → appDeployCommands-6XA2ONV6.js} +49 -47
  18. package/{appDeployStatusCommands-FCNHYHZM.js → appDeployStatusCommands-E75X542I.js} +49 -47
  19. package/{appGetCommands-4DXSQHUZ.js → appGetCommands-VKC2FHBH.js} +49 -47
  20. package/{appListCommands-2NN5E4F6.js → appListCommands-CICA4AQI.js} +49 -47
  21. package/{authCommand-47DR6GZT.js → authCommand-KVLFWXDS.js} +16 -16
  22. package/{authCommands-ZZ3L5IFM.js → authCommands-6AUYO65N.js} +3 -3
  23. package/{builtinSkillRegistry-AYWYQVA4.js → builtinSkillRegistry-LRVAQCPW.js} +8 -8
  24. package/{chromeCommands-G5UDKVSV.js → chromeCommands-S7AW3AOD.js} +383 -6
  25. package/{chromeOpsCommands-VZWAY2KR.js → chromeOpsCommands-TBPM6MR4.js} +1 -1
  26. package/{chunk-FPMPWNVQ.js → chunk-3IQ5GP5Y.js} +3 -3
  27. package/{chunk-NWWQY2J5.js → chunk-3S52WBJS.js} +7 -7
  28. package/chunk-4JFSDWTN.js +21 -0
  29. package/{chunk-C3GOEQJF.js → chunk-5PASH2MB.js} +2 -2
  30. package/{chunk-7Q7MKJZN.js → chunk-5UY2WQJ6.js} +323 -124
  31. package/{chunk-DVYAFH2Q.js → chunk-6PXFEPHL.js} +1 -1
  32. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  33. package/{chunk-H6CHPU6M.js → chunk-6ZQXUJGM.js} +4 -4
  34. package/{chunk-QGMIUVBT.js → chunk-76OIOVDN.js} +19 -19
  35. package/{chunk-KOIDLCAQ.js → chunk-7Y3L3IDA.js} +4 -4
  36. package/{chunk-DWWUVRB5.js → chunk-A4RK66EV.js} +1 -1
  37. package/{chunk-ZT3DYK5T.js → chunk-AERVJIZ2.js} +4 -4
  38. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  39. package/{chunk-TTEBPPUV.js → chunk-B5U64NZU.js} +1 -1
  40. package/{chunk-UKSKCDBG.js → chunk-BEJ243X3.js} +1 -1
  41. package/{chunk-TE2XH4KH.js → chunk-BZLF2LAP.js} +3 -3
  42. package/{chunk-ZVOL2MAJ.js → chunk-CO6E7YK6.js} +1 -1
  43. package/{chunk-NQQL2DKF.js → chunk-CQG24S2Q.js} +13 -6
  44. package/{chunk-25OCZXSX.js → chunk-CYAEPGKY.js} +23 -23
  45. package/{chunk-X37RQEA3.js → chunk-DEOPZE4S.js} +6 -6
  46. package/{chunk-B72AFRR2.js → chunk-DHRYMWMY.js} +4 -4
  47. package/{chunk-FXX6VFMV.js → chunk-DM323UA6.js} +84 -71
  48. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  49. package/{chunk-CT6GT2BG.js → chunk-DOCK6V3Z.js} +13 -13
  50. package/{chunk-ZTLTDUV6.js → chunk-FBVN3B5T.js} +4 -4
  51. package/{chunk-7NIBQ4HY.js → chunk-FDZ2GBWO.js} +30 -2
  52. package/{chunk-LMFMV5UC.js → chunk-FQFSLPNJ.js} +2 -2
  53. package/{chunk-ZQUCJBS4.js → chunk-G3SJCNHX.js} +2 -2
  54. package/{chunk-7U2TFUWW.js → chunk-GEKRDIMM.js} +5 -5
  55. package/{chunk-LT3DMEIB.js → chunk-GEY2UH2I.js} +17 -13
  56. package/{chunk-DLTMAXLF.js → chunk-GFBBHM53.js} +6 -6
  57. package/{chunk-OYHJ4TW7.js → chunk-HBO6UW3O.js} +4 -4
  58. package/{chunk-BDERPCJW.js → chunk-HKT7KOIX.js} +4 -4
  59. package/{chunk-3NFWMSTA.js → chunk-HTENYMO3.js} +5 -5
  60. package/{chunk-BWW6WRX6.js → chunk-HZN5VE32.js} +16 -13
  61. package/{chunk-G6OPRPXH.js → chunk-I27WRAPF.js} +37 -31
  62. package/{chunk-OJRTTERA.js → chunk-IBQHHCQE.js} +2 -1
  63. package/{chunk-LN4ZVSO7.js → chunk-JFGKVVLB.js} +8 -8
  64. package/{chunk-EIFSCI4C.js → chunk-JHHAIL34.js} +265 -102
  65. package/{chunk-JBWXPACD.js → chunk-JP2BH4NC.js} +1 -1
  66. package/{chunk-MM73SP4K.js → chunk-JV5FHHF7.js} +1 -1
  67. package/{chunk-NBB2EBQD.js → chunk-JVJ53XCH.js} +1 -1
  68. package/{chunk-Y5RN44VH.js → chunk-K3GJXP2N.js} +16 -16
  69. package/{chunk-OATIWAKN.js → chunk-KC2QVCI7.js} +1 -1
  70. package/{chunk-VP3BINY7.js → chunk-KMIDT4SW.js} +31 -1
  71. package/{chunk-IPRPYKBP.js → chunk-KOTJT7CY.js} +3 -3
  72. package/{chunk-4YFC3DWW.js → chunk-KQHEGELM.js} +1 -1
  73. package/{chunk-5TJE4QCL.js → chunk-KV5FDJOD.js} +2 -2
  74. package/{chunk-WRKMXMU7.js → chunk-KZAT2M2V.js} +12 -8
  75. package/{chunk-DGUUOHBF.js → chunk-LNFCR5IA.js} +4 -4
  76. package/{chunk-3V6JT6WN.js → chunk-MAURG3J4.js} +269 -112
  77. package/{chunk-WHO3LYDW.js → chunk-MEDPR36J.js} +2 -2
  78. package/{chunk-EW37CXCQ.js → chunk-NCJZUXRA.js} +6 -6
  79. package/{chunk-VS276URX.js → chunk-NEG5LYK5.js} +1 -1
  80. package/{chunk-6D25V6CB.js → chunk-NJJK3PDA.js} +4 -4
  81. package/{chunk-U4VSBDO5.js → chunk-O5MEXHJW.js} +65 -46
  82. package/{chunk-YFRJAE3R.js → chunk-OGZE6BZG.js} +12 -4
  83. package/{chunk-KGIIZXPL.js → chunk-ORVM574D.js} +7 -7
  84. package/{chunk-YUZ2DAIH.js → chunk-OXFJWWOT.js} +1 -1
  85. package/chunk-P27E22MA.js +203 -0
  86. package/{chunk-BIJTI5SX.js → chunk-Q25LWFGP.js} +2 -2
  87. package/{chunk-TFGGNRT6.js → chunk-QLUYDJST.js} +1 -1
  88. package/{chunk-IUXBKS5L.js → chunk-QXUVCIPB.js} +9 -9
  89. package/{chunk-XNEDFWT4.js → chunk-RRYDDDV7.js} +2 -2
  90. package/{chunk-24GVXSWK.js → chunk-RXCP7AIJ.js} +2 -2
  91. package/{chunk-UAOFSUG7.js → chunk-SEDJEJBH.js} +1 -1
  92. package/{chunk-LYDEFPQP.js → chunk-SF4GMDZO.js} +2 -2
  93. package/{chunk-CZLSTOVM.js → chunk-SGI2FIGK.js} +2 -2
  94. package/{chunk-FSIEHQNH.js → chunk-SMYUQDYW.js} +42 -5
  95. package/{chunk-7OTNBI77.js → chunk-T3CUXNV4.js} +1 -1
  96. package/{chunk-EBKHA63G.js → chunk-TKE4OJ4B.js} +179 -47
  97. package/{chunk-T444ENEC.js → chunk-TRN54YTP.js} +5 -5
  98. package/{chunk-2XMKW2OY.js → chunk-TT4JI6QR.js} +9 -9
  99. package/{chunk-I2OYPD3Y.js → chunk-U35UUM5K.js} +1 -0
  100. package/{chunk-6X3CS6NJ.js → chunk-V2COUWMQ.js} +8 -8
  101. package/{chunk-LCQJH7KN.js → chunk-VCU5GV42.js} +1 -1
  102. package/{chunk-ZBQ5UGYY.js → chunk-VF7F3ADU.js} +4 -4
  103. package/{chunk-HNWZJI4N.js → chunk-VNALJT32.js} +1 -1
  104. package/{chunk-TXFYIWAW.js → chunk-VTB6V4UF.js} +10 -10
  105. package/{chunk-QES2NCVM.js → chunk-VTDC64JY.js} +10 -10
  106. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  107. package/{chunk-YMCSR7PA.js → chunk-VVNP722P.js} +8 -8
  108. package/{chunk-N6EN3HK3.js → chunk-W4EAF272.js} +1 -1
  109. package/{chunk-X7IA2B7R.js → chunk-WBSJAIZP.js} +7 -3
  110. package/{chunk-LMZRXDWG.js → chunk-WDDZCQ6V.js} +3 -3
  111. package/{chunk-TXQVH72L.js → chunk-WIRH2ZLI.js} +3 -3
  112. package/{chunk-C646JEUV.js → chunk-WXZZQRAH.js} +4 -4
  113. package/{chunk-6BGJHJRN.js → chunk-X66UVBL3.js} +28 -28
  114. package/{chunk-UAHUJ4HH.js → chunk-XBWZ3SPO.js} +10 -37
  115. package/{chunk-4FE3IWRE.js → chunk-XRFUYUS7.js} +1 -1
  116. package/{chunk-XAFOLWLU.js → chunk-YDTLGWBU.js} +4 -4
  117. package/{chunk-FCAMGBLY.js → chunk-YDWMJOCW.js} +467 -279
  118. package/{chunk-GCVFX6ZL.js → chunk-YFDLRLW7.js} +3 -3
  119. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  120. package/{chunk-DIBQXNGW.js → chunk-YO4DCVD2.js} +2 -2
  121. package/{chunk-NL7J2J5Z.js → chunk-YTYVSOY4.js} +3 -3
  122. package/{chunk-6XBOPKUH.js → chunk-Z5C2EICZ.js} +16 -16
  123. package/{chunk-MDVP5TLI.js → chunk-ZCFOIOZ6.js} +1 -1
  124. package/{chunk-F3FQPVHE.js → chunk-ZGHHY2PV.js} +2 -2
  125. package/{cliAgentConfigHelpers-RFR7ZCSK.js → cliAgentConfigHelpers-H3VR6JID.js} +9 -9
  126. package/{cliLocalAgentRecordReader-AJ4UKHKT.js → cliLocalAgentRecordReader-SQCTHOXC.js} +50 -44
  127. package/{commandRegistry-IHWZVV4G.js → commandRegistry-6P4GP7SY.js} +99 -91
  128. package/{contentThunks-YQRCBDKF.js → contentThunks-74IO72TZ.js} +34 -34
  129. package/{cooldownCommands-W67DE765.js → cooldownCommands-QL6DWGVU.js} +1 -1
  130. package/{createAgentAutomationAction-ERSDNR4R.js → createAgentAutomationAction-KRNQVWCA.js} +35 -35
  131. package/{createDialogAction-QXC7JZPE.js → createDialogAction-TWFKJNUJ.js} +35 -35
  132. package/{createPageAction-RLZ7776F.js → createPageAction-2O2RMNQH.js} +39 -39
  133. package/{dbSlice-7M2ESEUO.js → dbSlice-JBLCCYKC.js} +13 -13
  134. package/{deleteFile-WO6WSSNK.js → deleteFile-KV5VTKAT.js} +8 -8
  135. package/{dialogCommands-UIRO4QNN.js → dialogCommands-OILEFOMW.js} +51 -50
  136. package/{dialogNotifyCommand-VDUFYBZV.js → dialogNotifyCommand-KOKWBD5H.js} +11 -11
  137. package/{dialogSlice-A4U3C76D.js → dialogSlice-BZKPV4FB.js} +34 -34
  138. package/{docCreateCommands-MHPYTJWR.js → docCreateCommands-43U55CVY.js} +48 -46
  139. package/{docDeleteCommands-VYULMBAQ.js → docDeleteCommands-BFTJFJAV.js} +50 -48
  140. package/{docReadCommands-FV3GGZ7V.js → docReadCommands-PU3VWGCG.js} +48 -46
  141. package/{docStore-AWWI72FA.js → docStore-JTAXVIUB.js} +15 -15
  142. package/{docUpdateCommands-JNS3HX7F.js → docUpdateCommands-7JRDXTSJ.js} +48 -46
  143. package/fetchMessages-TQEUZD7H.js +2 -2
  144. package/{getPricing-U5AR7ZHS.js → getPricing-XZXEWFPY.js} +4 -4
  145. package/{handleSendMessageAction-WDJOUDNV.js → handleSendMessageAction-BCNWPO3U.js} +67 -67
  146. package/{hostCredentialCreate-H3FF2SAO.js → hostCredentialCreate-LKNAX2SV.js} +95 -95
  147. package/index.js +8 -8
  148. package/keys-RWF7UCB4.js +1 -1
  149. package/{localRuntimeAdapter-JAQQXZJP.js → localRuntimeAdapter-I5HVICYM.js} +103 -103
  150. package/{machineCommands-WYOFNB5I.js → machineCommands-PUOM4XEL.js} +222 -313
  151. package/{machineWsRunDispatch-Y7UIAZNM.js → machineWsRunDispatch-SOAAV7PQ.js} +94 -94
  152. package/{mcpLocalAuthorizeCommand-SCYEFLRK.js → mcpLocalAuthorizeCommand-TMBUP7FX.js} +14 -14
  153. package/{memberThunks-DIITWU4M.js → memberThunks-TWB77UHJ.js} +17 -17
  154. package/{models-CINY5UZR.js → models-RIKQRH6B.js} +2 -2
  155. package/package.json +1 -1
  156. package/{projectArchive-IZJXBW5N.js → projectArchive-3V5DIVKP.js} +39 -39
  157. package/{providerPresetApply-2QWXPJXZ.js → providerPresetApply-JBCXP3JP.js} +6 -6
  158. package/{providerRegistry-W4LCKK6V.js → providerRegistry-AMR7WUWQ.js} +6 -6
  159. package/{read-OBLJNMA2.js → read-CO6HMH5W.js} +8 -8
  160. package/{readDocTool-QQZ4DAER.js → readDocTool-P4MDVRNW.js} +1 -1
  161. package/{readlineWorkspace-WF3SWZGR.js → readlineWorkspace-NHVNU4DY.js} +491 -383
  162. package/{removeDialogAgentAction-HC3SOY3G.js → removeDialogAgentAction-D3R3QNPD.js} +19 -19
  163. package/{runAgentClientLoop-Z7V6TA3O.js → runAgentClientLoop-EWZ4UOXT.js} +74 -74
  164. package/{runtimeDoctorCommands-KX6YLPWV.js → runtimeDoctorCommands-EQS62LQV.js} +5 -5
  165. package/{secretCommands-STRAX275.js → secretCommands-36BCE3UE.js} +2 -2
  166. package/{setDialogExtraReferencesAction-DDZUQPY6.js → setDialogExtraReferencesAction-VORDLM57.js} +16 -16
  167. package/{setPrimaryDialogAgentAction-EB67OMAJ.js → setPrimaryDialogAgentAction-P5A65M32.js} +19 -19
  168. package/{settingThunks-TN6GFASU.js → settingThunks-JGBSDOC6.js} +24 -24
  169. package/{spaceCommands-HBYQUVJI.js → spaceCommands-SRICYK6S.js} +51 -49
  170. package/{streamAgentChatTurn-CM7QQXOS.js → streamAgentChatTurn-GHPLOX5L.js} +140 -125
  171. package/{switchDialogAgentAction-XY5TKQQE.js → switchDialogAgentAction-DMMWH5FG.js} +17 -17
  172. package/{tableCommands-MXFL3JIT.js → tableCommands-UHEA5QNL.js} +6 -6
  173. package/{toolApiClient-53YMJ2G6.js → toolApiClient-N5PYW2R3.js} +2 -2
  174. package/{tools-AT6H73LD.js → tools-ZSQGRWKI.js} +59 -59
  175. package/{tuiRestart-272SAYSK.js → tuiRestart-RATR636G.js} +9 -9
  176. package/{tuiSummaryLlmCaller-K2OVRVHG.js → tuiSummaryLlmCaller-J5HB4XVS.js} +14 -14
  177. package/{updateCommands-O3BOVVVN.js → updateCommands-5OYND6EF.js} +3 -3
  178. package/{updateDialogTitleAction-PGY4UPLH.js → updateDialogTitleAction-MEKAI3YO.js} +36 -36
  179. package/{usageCommand-SCF3ROV2.js → usageCommand-WW22APZ6.js} +2 -2
  180. package/{usageRebuildCommand-K5WPIBA5.js → usageRebuildCommand-B3S67JXH.js} +3 -3
  181. package/{windowsSelfUpdate-WJDUZLEO.js → windowsSelfUpdate-HIYNL3VR.js} +2 -2
  182. package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-ZCSQCHG3.js} +2 -2
  183. package/chunk-776CXKMX.js +0 -134
  184. package/chunk-TUSTONB3.js +0 -81
  185. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
  186. package/{chunk-VMJVAJ6W.js → chunk-TB5KTLNB.js} +3 -3
  187. package/{dialogUsageCommand-SEC6UZWM.js → dialogUsageCommand-BZPKR3DW.js} +3 -3
@@ -7,7 +7,7 @@ import {
7
7
  parsePendingApprovalResult,
8
8
  runConnectorToolWithHostApproval,
9
9
  withHostApprovalRequest
10
- } from "./chunk-HNWZJI4N.js";
10
+ } from "./chunk-VNALJT32.js";
11
11
  import {
12
12
  BROWSER_SHELL_BRIDGE_ENV
13
13
  } from "./chunk-2YGBI2XB.js";
@@ -22,7 +22,7 @@ import {
22
22
  resolveClaudeCodeVersion,
23
23
  resolveServerSyncConfig,
24
24
  xaiRefresh
25
- } from "./chunk-3NFWMSTA.js";
25
+ } from "./chunk-HTENYMO3.js";
26
26
  import {
27
27
  clearCredentialAvailability,
28
28
  markCredentialUnavailable,
@@ -36,7 +36,7 @@ import {
36
36
  buildWorkspaceHelperSource,
37
37
  dockerExecutionToolNames,
38
38
  parseToolOutput
39
- } from "./chunk-HGDKT2D6.js";
39
+ } from "./chunk-VTHWBTRE.js";
40
40
  import {
41
41
  createChromeConnectorClientResolver,
42
42
  createVerifiedChromeConnectorClient,
@@ -54,16 +54,10 @@ import {
54
54
  DialogNotifyError,
55
55
  deliverDialogNotification,
56
56
  sha256Hex
57
- } from "./chunk-TE2XH4KH.js";
58
- import {
59
- extractLastUserText,
60
- localTurnHasSubjectRefs,
61
- resolveLocalUserId,
62
- withResolvedRuntimeToolSurface
63
- } from "./chunk-7U2TFUWW.js";
57
+ } from "./chunk-BZLF2LAP.js";
64
58
  import {
65
59
  createTuiSummaryLlmCaller
66
- } from "./chunk-BDERPCJW.js";
60
+ } from "./chunk-HKT7KOIX.js";
67
61
  import {
68
62
  CliProviderQuotaError,
69
63
  executeCli,
@@ -78,7 +72,7 @@ import {
78
72
  import {
79
73
  inlineImageUrlsForCustomProvider,
80
74
  prepareTools
81
- } from "./chunk-ZBQ5UGYY.js";
75
+ } from "./chunk-VF7F3ADU.js";
82
76
  import {
83
77
  getServerProviderSecret
84
78
  } from "./chunk-HS7MLR74.js";
@@ -101,25 +95,25 @@ import {
101
95
  resolveCliLocalSpawnDispatch,
102
96
  resolveRunContextFacts,
103
97
  resolveStartAgentRunCwd
104
- } from "./chunk-7Q7MKJZN.js";
98
+ } from "./chunk-5UY2WQJ6.js";
105
99
  import {
106
100
  deriveCredentialGroup,
107
101
  deriveCustomProviderCredentialGroup
108
- } from "./chunk-BWW6WRX6.js";
102
+ } from "./chunk-HZN5VE32.js";
109
103
  import {
110
104
  resolveUserSkillRuntime
111
- } from "./chunk-6D25V6CB.js";
105
+ } from "./chunk-NJJK3PDA.js";
112
106
  import {
113
107
  normalizeEnabledPromptSkills,
114
108
  resolveUserEnabledSkills
115
- } from "./chunk-DVYAFH2Q.js";
109
+ } from "./chunk-6PXFEPHL.js";
116
110
  import {
117
111
  validateAskChoiceInput
118
- } from "./chunk-KGIIZXPL.js";
112
+ } from "./chunk-ORVM574D.js";
119
113
  import {
120
114
  prepareTokenUsageData,
121
115
  runKeyed
122
- } from "./chunk-FXX6VFMV.js";
116
+ } from "./chunk-DM323UA6.js";
123
117
  import {
124
118
  applyTokenUsageToDayStats,
125
119
  require_format
@@ -130,22 +124,20 @@ import {
130
124
  } from "./chunk-523DITKR.js";
131
125
  import {
132
126
  fetchServerSyncedCredential
133
- } from "./chunk-DLTMAXLF.js";
127
+ } from "./chunk-GFBBHM53.js";
134
128
  import {
135
- defaultLoopbackRequest
136
- } from "./chunk-VP3BINY7.js";
129
+ defaultLoopbackRequest,
130
+ loadLocalRunChildDialogIds
131
+ } from "./chunk-KMIDT4SW.js";
137
132
  import {
138
133
  CREDENTIAL_STORE_SESSION_FALLBACK_WARNING,
139
134
  OAUTH_PROVIDER_REFS,
140
135
  getSharedSessionCredentialBroker
141
- } from "./chunk-QES2NCVM.js";
136
+ } from "./chunk-VTDC64JY.js";
142
137
  import {
143
138
  fetchWithTransientRetry,
144
139
  isTransientFetchError
145
140
  } from "./chunk-DXWGFL2Z.js";
146
- import {
147
- getDefaultCliLocalRuntimeDb
148
- } from "./chunk-LELADM5Q.js";
149
141
  import {
150
142
  _readQueueEntriesLocked,
151
143
  ackRunRecord,
@@ -154,6 +146,7 @@ import {
154
146
  checkStaleRun,
155
147
  claimRunRecord,
156
148
  commitRunRecordClaim,
149
+ defaultGenerateRunId,
157
150
  findRunRecord,
158
151
  gcRunRecords,
159
152
  isRunTerminalStatus,
@@ -170,12 +163,7 @@ import {
170
163
  terminateRunProcess,
171
164
  transitionRunToTerminal,
172
165
  withQueueLock
173
- } from "./chunk-FSIEHQNH.js";
174
- import {
175
- remoteDialogSyncTimeout,
176
- resolveRuntimeAuthToken,
177
- resolveRuntimeServerUrl
178
- } from "./chunk-4FE3IWRE.js";
166
+ } from "./chunk-SMYUQDYW.js";
179
167
  import {
180
168
  TASK_PREVIEW_MAX,
181
169
  formatControlRunMessageCard,
@@ -194,25 +182,20 @@ import {
194
182
  shortRunId
195
183
  } from "./chunk-S25VJYXV.js";
196
184
  import {
197
- isTombstoneRecord
198
- } from "./chunk-BV3FLP2L.js";
185
+ getDefaultCliLocalRuntimeDb
186
+ } from "./chunk-LELADM5Q.js";
199
187
  import {
200
188
  readAgentFromStore,
201
189
  readDialogMessageRecords,
202
190
  readDialogMessages,
203
191
  resolveBuiltinLocalCliAgentConfig
204
- } from "./chunk-2XMKW2OY.js";
192
+ } from "./chunk-TT4JI6QR.js";
205
193
  import {
206
194
  applyPublicAgentCatalogOverride
207
- } from "./chunk-LT3DMEIB.js";
195
+ } from "./chunk-GEY2UH2I.js";
208
196
  import {
209
197
  applyBuiltinAgentRuntimeOverride
210
- } from "./chunk-JBWXPACD.js";
211
- import {
212
- LOCAL_CODEX_AGENT_KEY,
213
- isLocalCliAgentKey,
214
- resolveCliAgentKeyInput
215
- } from "./chunk-BR3GT6MR.js";
198
+ } from "./chunk-JP2BH4NC.js";
216
199
  import {
217
200
  DEFAULT_HYBRID_READ_TIMEOUT_MS,
218
201
  Duration_exports,
@@ -263,7 +246,7 @@ import {
263
246
  runExecShellGates,
264
247
  validateConfiguredRootExecutionLease,
265
248
  verifyOwnerRouteAck
266
- } from "./chunk-EIFSCI4C.js";
249
+ } from "./chunk-JHHAIL34.js";
267
250
  import {
268
251
  createHostCredentialBrokerChain,
269
252
  createStrictHostCredentialBroker
@@ -280,7 +263,7 @@ import {
280
263
  resolveAntigravityFinishReason,
281
264
  resolveGeminiModelQuirks,
282
265
  shouldUseGeminiNativeToolRoute
283
- } from "./chunk-5TJE4QCL.js";
266
+ } from "./chunk-KV5FDJOD.js";
284
267
  import {
285
268
  readLocalImage
286
269
  } from "./chunk-AL3TYDIF.js";
@@ -295,23 +278,23 @@ import {
295
278
  readPlatformChatSseCompletion,
296
279
  resolvePlatformChatProviderConfig,
297
280
  shouldUsePlatformChatProvider
298
- } from "./chunk-OYHJ4TW7.js";
281
+ } from "./chunk-HBO6UW3O.js";
299
282
  import {
300
283
  readSseDataValues,
301
284
  readSseFrames
302
285
  } from "./chunk-HNUWUO75.js";
303
286
  import {
304
287
  resolveAgentRuntimeConfigFromRecord
305
- } from "./chunk-ZT3DYK5T.js";
288
+ } from "./chunk-AERVJIZ2.js";
306
289
  import {
307
290
  assertDispatchSelectionAdmission,
308
291
  buildNoloWorkspaceOpenAiTools,
309
292
  filterClientNoloWorkspaceToolNames,
310
293
  parseNoloWorkspaceToolArguments
311
- } from "./chunk-IUXBKS5L.js";
294
+ } from "./chunk-QXUVCIPB.js";
312
295
  import {
313
296
  MCP_TOOL_NAMES
314
- } from "./chunk-7NIBQ4HY.js";
297
+ } from "./chunk-FDZ2GBWO.js";
315
298
  import {
316
299
  extractQuotaSnapshot,
317
300
  isCapacitySaturatedRateLimit,
@@ -319,17 +302,13 @@ import {
319
302
  resolveAvailabilityAction,
320
303
  resolveCredentialKeyWithFallback
321
304
  } from "./chunk-QJTZ76CP.js";
322
- import {
323
- HIGH_RISK_MUTATION_TOOL_NAMES,
324
- resolveRequestToolSurface
325
- } from "./chunk-VS276URX.js";
326
305
  import {
327
306
  collectStablePromptPrefix,
328
307
  convertMessagesToResponsesInput,
329
308
  findAgentStatePairingIssues,
330
309
  stablePromptCacheKey,
331
310
  toResponsesTools
332
- } from "./chunk-NQQL2DKF.js";
311
+ } from "./chunk-CQG24S2Q.js";
333
312
  import {
334
313
  EMPTY_TOOL_RESULT_TEXT,
335
314
  MAX_TOOL_IMAGES_PER_REQUEST,
@@ -346,17 +325,17 @@ import {
346
325
  resolveCatalogImageSupport,
347
326
  resolveToolImagePolicy,
348
327
  withLiveImageSupport
349
- } from "./chunk-IPRPYKBP.js";
328
+ } from "./chunk-KOTJT7CY.js";
350
329
  import {
351
330
  resolveHistoricalToolContentCap
352
331
  } from "./chunk-WFGNWWJI.js";
353
332
  import {
354
333
  resolveAgentCallPlan
355
- } from "./chunk-NL7J2J5Z.js";
334
+ } from "./chunk-YTYVSOY4.js";
356
335
  import {
357
336
  resolveAgentRequiredPackIds,
358
337
  resolveAgentSkillConfig
359
- } from "./chunk-MM73SP4K.js";
338
+ } from "./chunk-JV5FHHF7.js";
360
339
  import {
361
340
  buildDialogFallbackTitleFromUserInput,
362
341
  normalizeDialogTitle
@@ -370,14 +349,14 @@ import {
370
349
  isCodexOAuthAgent,
371
350
  markCodexOAuthCatalogFailure,
372
351
  resolveCodexOAuthEffectiveModel
373
- } from "./chunk-ZTLTDUV6.js";
352
+ } from "./chunk-FBVN3B5T.js";
374
353
  import {
375
354
  isDevinOAuthAgent
376
355
  } from "./chunk-5ZUL4CUO.js";
377
356
  import {
378
357
  normalizeUsage,
379
358
  sanitizeSummarySourceSegments
380
- } from "./chunk-6X3CS6NJ.js";
359
+ } from "./chunk-V2COUWMQ.js";
381
360
  import {
382
361
  createProviderCallTimingTracker,
383
362
  finalizeProviderCallTiming,
@@ -402,21 +381,24 @@ import {
402
381
  import {
403
382
  asRecordOrEmpty
404
383
  } from "./chunk-KX6YBIHG.js";
405
- import {
406
- compactWhitespace
407
- } from "./chunk-DWLEOOGR.js";
408
384
  import {
409
385
  withShellChildEnvironment
410
- } from "./chunk-VMJVAJ6W.js";
386
+ } from "./chunk-TB5KTLNB.js";
411
387
  import {
412
388
  estimateTokenCount
413
389
  } from "./chunk-PSCNXBYA.js";
390
+ import {
391
+ compactWhitespace
392
+ } from "./chunk-DWLEOOGR.js";
414
393
  import {
415
394
  createOAuthTokenStore,
416
395
  isTokenExpired,
417
396
  readOAuthCredential,
418
397
  resolveFreshAccessToken
419
398
  } from "./chunk-G7Y4GXTY.js";
399
+ import {
400
+ isTombstoneRecord
401
+ } from "./chunk-BV3FLP2L.js";
420
402
  import {
421
403
  dialogMessageRecordToAgentRuntimeMessage
422
404
  } from "./chunk-4ZCTKB27.js";
@@ -431,12 +413,7 @@ import {
431
413
  expandEnabledPacks,
432
414
  resolveBuiltinSkillEntry,
433
415
  resolveEffectiveEnabledPacks
434
- } from "./chunk-EBKHA63G.js";
435
- import {
436
- CHROME_CONNECTOR_ACCEPTED_TOOL_NAMES,
437
- canonicalizeChromeConnectorToolNames,
438
- canonicalizeToolNames
439
- } from "./chunk-6OVNSQHN.js";
416
+ } from "./chunk-TKE4OJ4B.js";
440
417
  import {
441
418
  DIALOG_AGENT_LIST_INDEX_PREFIX,
442
419
  TOKEN_DIALOG_INDEX_PREFIX,
@@ -452,6 +429,31 @@ import {
452
429
  import {
453
430
  dialogIdFromKey
454
431
  } from "./chunk-YZMNK53S.js";
432
+ import {
433
+ extractLastUserText,
434
+ localTurnHasSubjectRefs,
435
+ resolveLocalUserId,
436
+ withResolvedRuntimeToolSurface
437
+ } from "./chunk-GEKRDIMM.js";
438
+ import {
439
+ LOCAL_CODEX_AGENT_KEY,
440
+ isLocalCliAgentKey,
441
+ resolveCliAgentKeyInput
442
+ } from "./chunk-BR3GT6MR.js";
443
+ import {
444
+ HIGH_RISK_MUTATION_TOOL_NAMES,
445
+ resolveRequestToolSurface
446
+ } from "./chunk-NEG5LYK5.js";
447
+ import {
448
+ remoteDialogSyncTimeout,
449
+ resolveRuntimeAuthToken,
450
+ resolveRuntimeServerUrl
451
+ } from "./chunk-XRFUYUS7.js";
452
+ import {
453
+ CHROME_CONNECTOR_ACCEPTED_TOOL_NAMES,
454
+ canonicalizeChromeConnectorToolNames,
455
+ canonicalizeToolNames
456
+ } from "./chunk-YLAHYLDQ.js";
455
457
  import {
456
458
  asOptionalPositiveFiniteNumber
457
459
  } from "./chunk-U6VC4MU4.js";
@@ -476,17 +478,17 @@ import {
476
478
  import {
477
479
  agentRunCardLabels,
478
480
  t
479
- } from "./chunk-YFRJAE3R.js";
481
+ } from "./chunk-OGZE6BZG.js";
480
482
  import {
481
483
  isAntigravityOAuthAgent
482
- } from "./chunk-LN4ZVSO7.js";
483
- import {
484
- buildProviderSessionHeaders,
485
- resolvePlatformAuthToken
486
- } from "./chunk-LMFMV5UC.js";
484
+ } from "./chunk-JFGKVVLB.js";
487
485
  import {
488
486
  toErrorMessage
489
487
  } from "./chunk-HNMXYYJR.js";
488
+ import {
489
+ buildProviderSessionHeaders,
490
+ resolvePlatformAuthToken
491
+ } from "./chunk-FQFSLPNJ.js";
490
492
  import {
491
493
  asTrimmedString
492
494
  } from "./chunk-3EUW3WEO.js";
@@ -494,7 +496,7 @@ import {
494
496
  anthropicOAuthModelMaxOutputTokens,
495
497
  findModelConfig,
496
498
  isAdaptiveThinkingModelId
497
- } from "./chunk-OJRTTERA.js";
499
+ } from "./chunk-IBQHHCQE.js";
498
500
  import {
499
501
  CLI_PROVIDER_VALUES,
500
502
  isCliProvider
@@ -528,9 +530,9 @@ function createLiveImageSupportResolver(userId, discover, timeoutMs = 5e3) {
528
530
  const raw = config.rawRecord ?? config;
529
531
  const owner = typeof raw.userId === "string" && raw.userId.trim() ? raw.userId.trim() : typeof raw.ownerUserId === "string" ? raw.ownerUserId.trim() : void 0;
530
532
  if (!userId || owner !== userId) return withLiveImageSupport(config, false);
531
- discovery ??= new Promise((resolve7) => {
532
- const timer = setTimeout(() => resolve7({}), timeoutMs);
533
- Promise.resolve().then(discover).then(resolve7, () => resolve7({})).finally(() => clearTimeout(timer));
533
+ discovery ??= new Promise((resolve8) => {
534
+ const timer = setTimeout(() => resolve8({}), timeoutMs);
535
+ Promise.resolve().then(discover).then(resolve8, () => resolve8({})).finally(() => clearTimeout(timer));
534
536
  });
535
537
  const models = await discovery;
536
538
  const model = config.model?.trim() ?? "";
@@ -2678,7 +2680,7 @@ function throwIfAborted(signal) {
2678
2680
  }
2679
2681
  function waitBackoff(ms, signal, injectedSleep) {
2680
2682
  throwIfAborted(signal);
2681
- return new Promise((resolve7, reject) => {
2683
+ return new Promise((resolve8, reject) => {
2682
2684
  let timer;
2683
2685
  const cleanup = () => {
2684
2686
  signal?.removeEventListener("abort", onAbort);
@@ -2693,7 +2695,7 @@ function waitBackoff(ms, signal, injectedSleep) {
2693
2695
  injectedSleep(ms).then(
2694
2696
  () => {
2695
2697
  cleanup();
2696
- resolve7();
2698
+ resolve8();
2697
2699
  },
2698
2700
  (error) => {
2699
2701
  cleanup();
@@ -2703,7 +2705,7 @@ function waitBackoff(ms, signal, injectedSleep) {
2703
2705
  } else {
2704
2706
  timer = setTimeout(() => {
2705
2707
  cleanup();
2706
- resolve7();
2708
+ resolve8();
2707
2709
  }, ms);
2708
2710
  }
2709
2711
  });
@@ -2956,14 +2958,14 @@ function countCodexInputChars(messages) {
2956
2958
  }
2957
2959
  function abortableSleep(sleepFn, ms, signal) {
2958
2960
  let timer;
2959
- const waitOnce = () => sleepFn ? Promise.resolve(sleepFn(ms)) : new Promise((resolve7) => {
2960
- timer = setTimeout(resolve7, ms);
2961
+ const waitOnce = () => sleepFn ? Promise.resolve(sleepFn(ms)) : new Promise((resolve8) => {
2962
+ timer = setTimeout(resolve8, ms);
2961
2963
  });
2962
2964
  if (!signal) return waitOnce().then(() => void 0);
2963
2965
  if (signal.aborted) {
2964
2966
  return Promise.reject(signal.reason ?? new DOMException("aborted", "AbortError"));
2965
2967
  }
2966
- return new Promise((resolve7, reject) => {
2968
+ return new Promise((resolve8, reject) => {
2967
2969
  let settled = false;
2968
2970
  const finish = (settle) => {
2969
2971
  if (settled) return;
@@ -2977,7 +2979,7 @@ function abortableSleep(sleepFn, ms, signal) {
2977
2979
  );
2978
2980
  signal.addEventListener("abort", onAbort, { once: true });
2979
2981
  waitOnce().then(
2980
- () => finish(resolve7),
2982
+ () => finish(resolve8),
2981
2983
  (error) => finish(() => reject(error))
2982
2984
  );
2983
2985
  });
@@ -3880,7 +3882,7 @@ function waitWithAbort(ms, signal) {
3880
3882
  if (signal?.aborted) {
3881
3883
  return Promise.reject(signal.reason ?? new Error("owner-required proxy aborted"));
3882
3884
  }
3883
- return new Promise((resolve7, reject) => {
3885
+ return new Promise((resolve8, reject) => {
3884
3886
  let timer;
3885
3887
  const cleanup = () => {
3886
3888
  if (timer !== void 0) clearTimeout(timer);
@@ -3892,7 +3894,7 @@ function waitWithAbort(ms, signal) {
3892
3894
  };
3893
3895
  timer = setTimeout(() => {
3894
3896
  cleanup();
3895
- resolve7();
3897
+ resolve8();
3896
3898
  }, ms);
3897
3899
  signal?.addEventListener("abort", onAbort, { once: true });
3898
3900
  });
@@ -4584,8 +4586,8 @@ function recordLocalRunExecutionIsolation(args) {
4584
4586
  }
4585
4587
  function joinPath(dir, name) {
4586
4588
  if (!dir) return name;
4587
- const sep2 = dir.includes("\\") && !dir.includes("/") ? "\\" : "/";
4588
- return dir.endsWith(sep2) ? `${dir}${name}` : `${dir}${sep2}${name}`;
4589
+ const sep3 = dir.includes("\\") && !dir.includes("/") ? "\\" : "/";
4590
+ return dir.endsWith(sep3) ? `${dir}${name}` : `${dir}${sep3}${name}`;
4589
4591
  }
4590
4592
 
4591
4593
  // packages/core/settingsSyncFreshness.ts
@@ -4652,7 +4654,7 @@ function isBusyProviderStreamError(error) {
4652
4654
  return BUSY_STREAM_ERROR_RE.test(toErrorMessage(error));
4653
4655
  }
4654
4656
  async function defaultSleep(ms) {
4655
- await new Promise((resolve7) => setTimeout(resolve7, ms));
4657
+ await new Promise((resolve8) => setTimeout(resolve8, ms));
4656
4658
  }
4657
4659
  function isRetryableProviderStreamError(error) {
4658
4660
  const message = toErrorMessage(error);
@@ -5352,7 +5354,7 @@ function buildLocalParentWakeMessage(args) {
5352
5354
  var EVIDENCE_WRITE_BATCH_SIZE = 4;
5353
5355
  var EVIDENCE_WRITE_BATCH_GAP_MS = 300;
5354
5356
  async function defaultEvidenceSleep(ms) {
5355
- await new Promise((resolve7) => setTimeout(resolve7, ms));
5357
+ await new Promise((resolve8) => setTimeout(resolve8, ms));
5356
5358
  }
5357
5359
  async function runThrottledBatches(items, run, options = {}) {
5358
5360
  const batchSize = options.batchSize ?? EVIDENCE_WRITE_BATCH_SIZE;
@@ -6078,13 +6080,13 @@ async function createBrowserShellApprovalBridge(args) {
6078
6080
  },
6079
6081
  ...args.awaitHostApproval ? { awaitHostApproval: async (card) => {
6080
6082
  requireActive();
6081
- const decision = await new Promise((resolve7, reject) => {
6083
+ const decision = await new Promise((resolve8, reject) => {
6082
6084
  const abort = () => reject(new Error("Browser approval bridge revoked"));
6083
6085
  lifetime.signal.addEventListener("abort", abort, { once: true });
6084
6086
  Promise.resolve().then(() => {
6085
6087
  requireActive();
6086
6088
  return args.awaitHostApproval(card, lifetime.signal);
6087
- }).then(resolve7, reject).finally(() => lifetime.signal.removeEventListener("abort", abort));
6089
+ }).then(resolve8, reject).finally(() => lifetime.signal.removeEventListener("abort", abort));
6088
6090
  });
6089
6091
  requireActive();
6090
6092
  if (decision !== "allow_once" && decision !== "deny") throw new Error("Invalid host decision");
@@ -6107,17 +6109,17 @@ async function createBrowserShellApprovalBridge(args) {
6107
6109
  clearTimeout(timer);
6108
6110
  args.signal?.removeEventListener("abort", onAbort);
6109
6111
  bindings.clear();
6110
- closing = new Promise((resolve7) => {
6111
- server.close(() => resolve7());
6112
+ closing = new Promise((resolve8) => {
6113
+ server.close(() => resolve8());
6112
6114
  server.closeAllConnections();
6113
6115
  });
6114
6116
  return closing;
6115
6117
  }
6116
- await new Promise((resolve7, reject) => {
6118
+ await new Promise((resolve8, reject) => {
6117
6119
  server.once("error", reject);
6118
6120
  server.listen(0, "127.0.0.1", () => {
6119
6121
  server.removeListener("error", reject);
6120
- resolve7();
6122
+ resolve8();
6121
6123
  });
6122
6124
  });
6123
6125
  const address = server.address();
@@ -6702,7 +6704,7 @@ function buildServerPlatformToolExecutors(args) {
6702
6704
  }
6703
6705
  const ctx = await localMemoryContext();
6704
6706
  if (!ctx) throw new Error("local work memory unavailable");
6705
- const { resolveLocalUserId: resolveLocalUserId2 } = await import("./cliAgentConfigHelpers-RFR7ZCSK.js");
6707
+ const { resolveLocalUserId: resolveLocalUserId2 } = await import("./cliAgentConfigHelpers-H3VR6JID.js");
6706
6708
  const localUserId = resolveLocalUserId2(args.env);
6707
6709
  const { resolveWorkContextAccess } = await import("./workContextAccess-UZHDLBUR.js");
6708
6710
  const { updateWorkContext, readWorkContexts } = await import("./workContext-Y3ADAPZU.js");
@@ -6950,11 +6952,160 @@ function buildServerPlatformToolExecutors(args) {
6950
6952
  };
6951
6953
  }
6952
6954
 
6955
+ // packages/cli/client/workspaceIsolation.ts
6956
+ import * as fs from "node:fs";
6957
+ import { execFileSync } from "node:child_process";
6958
+ import { createHash as createHash3 } from "node:crypto";
6959
+ import { homedir } from "node:os";
6960
+ import { basename, dirname as dirname2, isAbsolute, join as join2, relative, resolve, sep } from "node:path";
6961
+ var WorkspaceIsolationError = class extends Error {
6962
+ code = "workspace_isolation_refused";
6963
+ };
6964
+ var dependencies = /* @__PURE__ */ new Set(["node_modules", ".venv"]);
6965
+ var refuse = (reason) => {
6966
+ throw new WorkspaceIsolationError(`${reason}\uFF1B\u8BF7\u7F29\u5C0F\u5230\u5177\u4F53\u5B50\u6587\u4EF6\u5939\u540E\u91CD\u8BD5 workspaceIsolation:auto`);
6967
+ };
6968
+ function prepareWorkspaceIsolation(options) {
6969
+ const { baseCwd, runId, mode = "none", readOnly, platform = process.platform } = options;
6970
+ if (mode !== "auto" || readOnly === true) return { mode, kind: "none", effectiveCwd: baseCwd };
6971
+ if (!/^[a-zA-Z0-9_-]{1,128}$/.test(runId)) refuse("\u4E0D\u5B89\u5168\u7684 runId");
6972
+ const exec = options.execFile ?? execFileSync;
6973
+ const command = (file, args) => String(exec(file, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 3e4, env: { ...process.env, LC_ALL: "C", LANG: "C" } }));
6974
+ const source = fs.realpathSync(baseCwd);
6975
+ let repoRoot;
6976
+ try {
6977
+ repoRoot = command("git", ["-C", source, "rev-parse", "--show-toplevel"]).trim();
6978
+ } catch (error) {
6979
+ if (error.code === "ENOENT") {
6980
+ for (let ancestor = source; ; ancestor = dirname2(ancestor)) {
6981
+ try {
6982
+ fs.lstatSync(join2(ancestor, ".git"));
6983
+ throw new WorkspaceIsolationError("\u68C0\u6D4B\u5230 Git \u4ED3\u5E93\uFF0C\u4F46 Git \u547D\u4EE4\u672A\u5B89\u88C5\uFF1B\u8BF7\u5B89\u88C5 Git \u540E\u91CD\u8BD5");
6984
+ } catch (markerError) {
6985
+ if (markerError.code !== "ENOENT") throw markerError;
6986
+ }
6987
+ if (ancestor === dirname2(ancestor)) break;
6988
+ }
6989
+ } else if (!String(error.stderr).includes("not a git repository")) {
6990
+ throw error;
6991
+ }
6992
+ }
6993
+ const linkDependencies = (from, to) => {
6994
+ for (const name of dependencies) {
6995
+ const target = join2(from, name), link = join2(to, name);
6996
+ try {
6997
+ if (fs.statSync(target).isDirectory() && !fs.existsSync(link)) fs.symlinkSync(target, link, platform === "win32" ? "junction" : "dir");
6998
+ } catch {
6999
+ }
7000
+ }
7001
+ };
7002
+ if (repoRoot) {
7003
+ repoRoot = fs.realpathSync(repoRoot);
7004
+ const subRel = relative(repoRoot, source);
7005
+ if (isAbsolute(subRel) || subRel.split(/[\\/]/).includes("..")) refuse("\u76EE\u5F55\u4E0D\u5728\u4ED3\u5E93\u5185");
7006
+ const shortId = createHash3("sha256").update(runId).digest("hex").slice(0, 12);
7007
+ const commonDirOutput = command("git", ["-C", source, "rev-parse", "--git-common-dir"]).trim();
7008
+ const commonDir = fs.realpathSync(resolve(source, commonDirOutput));
7009
+ const worktreeHostRoot = basename(commonDir) === ".git" ? dirname2(commonDir) : repoRoot;
7010
+ const root2 = join2(worktreeHostRoot, ".worktrees", `run-${shortId}`), branch = `nolo/run-${shortId}`;
7011
+ if (platform === "win32" && root2.length > 210) refuse("\u9694\u79BB\u76EE\u5F55\u8DEF\u5F84\u8FC7\u957F");
7012
+ command("git", ["-C", repoRoot, "-c", "checkout.workers=0", "-c", "core.longpaths=true", "worktree", "add", root2, "-b", branch, "HEAD"]);
7013
+ linkDependencies(repoRoot, root2);
7014
+ if (worktreeHostRoot !== repoRoot) linkDependencies(worktreeHostRoot, root2);
7015
+ return { mode, kind: "git-worktree", effectiveCwd: join2(root2, subRel), root: root2, sourceRoot: repoRoot, branch };
7016
+ }
7017
+ if (source === dirname2(source) || source === fs.realpathSync(homedir())) refuse("\u4E0D\u80FD\u9694\u79BB\u6587\u4EF6\u7CFB\u7EDF\u6839\u76EE\u5F55\u6216\u7528\u6237\u4E3B\u76EE\u5F55");
7018
+ let files = 0, bytes = 0, entries = 0;
7019
+ const scan = (dir, top, depth = 0) => {
7020
+ if (depth > 64) refuse("\u76EE\u5F55\u5D4C\u5957\u8D85\u8FC7 64 \u5C42\u4E0A\u9650");
7021
+ const handle = fs.opendirSync(dir);
7022
+ try {
7023
+ let entry;
7024
+ while (entry = handle.readSync()) {
7025
+ if (top && dependencies.has(entry.name)) continue;
7026
+ if (++entries > 4e3) refuse("\u76EE\u5F55\u6761\u76EE\u8D85\u8FC7 4000 \u4E0A\u9650");
7027
+ const path = join2(dir, entry.name), stat = fs.lstatSync(path);
7028
+ if (stat.isSymbolicLink() || !stat.isDirectory() && !stat.isFile()) refuse("\u666E\u901A\u4E1A\u52A1\u76EE\u5F55\u542B\u7B26\u53F7\u94FE\u63A5\u6216\u7279\u6B8A\u6587\u4EF6\uFF0C\u4E0D\u80FD\u5B89\u5168\u590D\u5236");
7029
+ if (stat.isDirectory()) scan(path, false, depth + 1);
7030
+ else if (++files > (options.maxFiles ?? 2e3) || (bytes += stat.size) > (options.maxBytes ?? 200 * 1024 * 1024)) refuse("\u76EE\u5F55\u8D85\u8FC7\u6587\u4EF6\u6570\u6216\u603B\u5927\u5C0F\u4E0A\u9650\uFF082000 \u6587\u4EF6 / 200 MiB\uFF09");
7031
+ }
7032
+ } finally {
7033
+ handle.closeSync();
7034
+ }
7035
+ };
7036
+ scan(source, true);
7037
+ const root = resolve(options.noloHome ?? join2(homedir(), ".nolo"), "workspaces", runId);
7038
+ const rel = relative(source, root);
7039
+ if (!rel || !rel.startsWith(`..${sep}`) && rel !== ".." && !isAbsolute(rel)) refuse("\u5FEB\u7167\u76EE\u6807\u4E0D\u80FD\u4F4D\u4E8E\u6E90\u76EE\u5F55\u5185");
7040
+ fs.mkdirSync(dirname2(root), { recursive: true });
7041
+ fs.mkdirSync(root);
7042
+ try {
7043
+ for (const entry of fs.readdirSync(source)) {
7044
+ if (dependencies.has(entry)) continue;
7045
+ const from = join2(source, entry), to = join2(root, entry);
7046
+ let copied = false;
7047
+ try {
7048
+ if (platform === "darwin") {
7049
+ command("cp", ["-cR", from, to]);
7050
+ copied = true;
7051
+ } else if (platform === "linux") {
7052
+ command("cp", ["-a", "--reflink=always", "--", from, to]);
7053
+ copied = true;
7054
+ }
7055
+ } catch {
7056
+ }
7057
+ if (!copied) fs.cpSync(from, to, { recursive: true, force: true, dereference: false });
7058
+ }
7059
+ linkDependencies(source, root);
7060
+ } catch (error) {
7061
+ try {
7062
+ rollbackWorkspaceIsolation({ mode, kind: "directory-snapshot", effectiveCwd: root, root, sourceRoot: source });
7063
+ } catch (cleanupError) {
7064
+ throw new AggregateError([error, cleanupError], `\u590D\u5236\u5931\u8D25\uFF1B\u9694\u79BB\u76EE\u5F55\u4FDD\u7559\u5F85\u5904\u7406: ${root}`);
7065
+ }
7066
+ throw error;
7067
+ }
7068
+ return { mode, kind: "directory-snapshot", effectiveCwd: root, root, sourceRoot: source };
7069
+ }
7070
+ function rollbackWorkspaceIsolation(workspace) {
7071
+ const { root, sourceRoot, branch, kind } = workspace;
7072
+ if (!root || !sourceRoot) return;
7073
+ if (kind === "git-worktree") {
7074
+ const git = (args) => String(execFileSync("git", ["-C", sourceRoot, ...args], { encoding: "utf8" }));
7075
+ for (const name of dependencies) {
7076
+ const link = join2(root, name), original = join2(sourceRoot, name);
7077
+ if (!git(["-C", root, "ls-files", "--", name]).trim()) {
7078
+ try {
7079
+ if (fs.lstatSync(link).isSymbolicLink() && fs.realpathSync(link) === fs.realpathSync(original)) fs.unlinkSync(link);
7080
+ } catch (error) {
7081
+ if (error.code !== "ENOENT") throw error;
7082
+ }
7083
+ }
7084
+ }
7085
+ if (git(["-C", root, "status", "--porcelain", "--ignored"]).trim()) throw new Error(`\u9694\u79BB\u76EE\u5F55\u542B\u672A\u9A8C\u8BC1\u5185\u5BB9\uFF0C\u4FDD\u7559 ${root}`);
7086
+ execFileSync("git", ["-C", sourceRoot, "merge-base", "--is-ancestor", branch, "HEAD"]);
7087
+ git(["worktree", "remove", root]);
7088
+ git(["branch", "-d", branch]);
7089
+ } else if (kind === "directory-snapshot") {
7090
+ const verify = (path) => {
7091
+ for (const entry of fs.readdirSync(path)) {
7092
+ const target = join2(path, entry), original = join2(sourceRoot, relative(root, target));
7093
+ const stat = fs.lstatSync(target);
7094
+ if (path === root && dependencies.has(entry) && stat.isSymbolicLink() && fs.realpathSync(target) === fs.realpathSync(original)) continue;
7095
+ if (stat.isDirectory() && fs.statSync(original).isDirectory()) verify(target);
7096
+ else if (!stat.isFile() || !fs.statSync(original).isFile() || !fs.readFileSync(target).equals(fs.readFileSync(original))) throw new Error(`\u9694\u79BB\u526F\u672C\u6709\u552F\u4E00\u5185\u5BB9\uFF0C\u4FDD\u7559 ${root}`);
7097
+ }
7098
+ };
7099
+ verify(root);
7100
+ fs.rmSync(root, { recursive: true });
7101
+ }
7102
+ }
7103
+
6953
7104
  // packages/cli/client/childRunImages.ts
6954
- import { isAbsolute } from "node:path";
7105
+ import { isAbsolute as isAbsolute2 } from "node:path";
6955
7106
  function validateChildImagePaths(value) {
6956
7107
  if (value === void 0) return [];
6957
- if (!Array.isArray(value) || value.length < 1 || value.length > MAX_TOOL_IMAGES_PER_REQUEST || value.some((path) => typeof path !== "string" || !isAbsolute(path) || path.includes("\0"))) {
7108
+ if (!Array.isArray(value) || value.length < 1 || value.length > MAX_TOOL_IMAGES_PER_REQUEST || value.some((path) => typeof path !== "string" || !isAbsolute2(path) || path.includes("\0"))) {
6958
7109
  throw new Error("image_input_invalid: expected 1\u20134 absolute local image paths");
6959
7110
  }
6960
7111
  return value;
@@ -6987,8 +7138,8 @@ async function normalizeCliRunImages(inputs, normalizeRemote) {
6987
7138
  }
6988
7139
 
6989
7140
  // packages/cli/agentRunArgs.ts
6990
- import { readFileSync } from "node:fs";
6991
- import { isAbsolute as isAbsolute2 } from "node:path";
7141
+ import { readFileSync as readFileSync2 } from "node:fs";
7142
+ import { isAbsolute as isAbsolute3 } from "node:path";
6992
7143
  function readFlagValue(args, flag) {
6993
7144
  const index = args.indexOf(flag);
6994
7145
  if (index < 0) return void 0;
@@ -7129,7 +7280,7 @@ function parseAgentRunArgs(args, options = {}) {
7129
7280
  const agentKey = rawAgentKey ? resolveCliAgentKeyInput(rawAgentKey) : void 0;
7130
7281
  const explicitMsg = readFlagValue(args, "--msg");
7131
7282
  const msgFile = readFlagValue(args, "--msg-file");
7132
- const fileMessage = msgFile ? (options.readTextFile ?? ((path) => readFileSync(path, "utf8")))(msgFile) : void 0;
7283
+ const fileMessage = msgFile ? (options.readTextFile ?? ((path) => readFileSync2(path, "utf8")))(msgFile) : void 0;
7133
7284
  const rawMessage = explicitMsg ?? fileMessage ?? positional.slice(isNoLoginRunShorthand ? 0 : 1).join(" ");
7134
7285
  if (!agentKey || !rawMessage.trim()) return null;
7135
7286
  const message = rawMessage.trim();
@@ -7190,7 +7341,7 @@ function parseAgentRunArgs(args, options = {}) {
7190
7341
  if (!rawInstaboxArtifactDir) {
7191
7342
  throw new Error("--runtime-key instabox \u5FC5\u987B\u6307\u5B9A --instabox-artifact-dir <\u7EDD\u5BF9\u8DEF\u5F84>");
7192
7343
  }
7193
- if (!isAbsolute2(rawInstaboxArtifactDir) || rawInstaboxArtifactDir.includes("\0") || rawInstaboxArtifactDir.split("/").includes("..")) {
7344
+ if (!isAbsolute3(rawInstaboxArtifactDir) || rawInstaboxArtifactDir.includes("\0") || rawInstaboxArtifactDir.split("/").includes("..")) {
7194
7345
  throw new Error(`--instabox-artifact-dir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${rawInstaboxArtifactDir}"`);
7195
7346
  }
7196
7347
  if (rawInstaboxWorkspace === "snapshot" && !rawInstaboxManifest) {
@@ -7295,7 +7446,7 @@ function parseAgentRunArgs(args, options = {}) {
7295
7446
  }
7296
7447
 
7297
7448
  // packages/cli/client/cliAgentRunToolExecutors.ts
7298
- import { join as join3, resolve as resolve3 } from "node:path";
7449
+ import { dirname as dirname4, join as join4, resolve as resolve4 } from "node:path";
7299
7450
  import { randomUUID as randomUUID3 } from "node:crypto";
7300
7451
  import * as nodeFs2 from "node:fs";
7301
7452
 
@@ -7359,7 +7510,7 @@ function waitForRunTerminal(args) {
7359
7510
  }
7360
7511
 
7361
7512
  // packages/cli/client/cliAgentRunToolExecutors.ts
7362
- import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
7513
+ import { existsSync as existsSync4, readFileSync as readFileSync5 } from "node:fs";
7363
7514
 
7364
7515
  // packages/cli/client/agentRunSnapshot.ts
7365
7516
  function readString(value) {
@@ -7605,47 +7756,47 @@ function deriveAgentRunTodoStatus(input) {
7605
7756
  }
7606
7757
 
7607
7758
  // packages/cli/client/fileSystemStores.ts
7608
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
7759
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync } from "node:fs";
7609
7760
  import { homedir as nodeHomedir } from "node:os";
7610
- import { dirname as dirname2, join as join2 } from "node:path";
7761
+ import { dirname as dirname3, join as join3 } from "node:path";
7611
7762
  var nodeFs = {
7612
- mkdirSync,
7763
+ mkdirSync: mkdirSync2,
7613
7764
  writeFileSync,
7614
- readFileSync: readFileSync2,
7615
- existsSync: existsSync2
7765
+ readFileSync: readFileSync3,
7766
+ existsSync: existsSync3
7616
7767
  };
7617
- function resolveNoloHome(env, homedir2) {
7768
+ function resolveNoloHome(env, homedir3) {
7618
7769
  const custom = env?.NOLO_HOME;
7619
7770
  if (custom && custom.trim()) return custom.trim();
7620
7771
  const ambient = process.env.NOLO_HOME?.trim();
7621
7772
  if (ambient) return ambient;
7622
- return join2(homedir2(), ".nolo");
7773
+ return join3(homedir3(), ".nolo");
7623
7774
  }
7624
- function ensureDir(dir, fs) {
7625
- fs.mkdirSync(dir, { recursive: true });
7775
+ function ensureDir(dir, fs2) {
7776
+ fs2.mkdirSync(dir, { recursive: true });
7626
7777
  }
7627
- function readJson(path, fs) {
7628
- if (!fs.existsSync(path)) return void 0;
7778
+ function readJson(path, fs2) {
7779
+ if (!fs2.existsSync(path)) return void 0;
7629
7780
  try {
7630
- const raw = fs.readFileSync(path, "utf8");
7781
+ const raw = fs2.readFileSync(path, "utf8");
7631
7782
  return JSON.parse(String(raw));
7632
7783
  } catch {
7633
7784
  return void 0;
7634
7785
  }
7635
7786
  }
7636
- function writeJson(path, data, fs) {
7637
- fs.writeFileSync(path, JSON.stringify(data, null, 2));
7787
+ function writeJson(path, data, fs2) {
7788
+ fs2.writeFileSync(path, JSON.stringify(data, null, 2));
7638
7789
  }
7639
7790
  function createFileSystemTodoStore(opts = {}) {
7640
7791
  const env = opts.env ?? process.env;
7641
- const homedir2 = opts.homedir ?? nodeHomedir;
7642
- const fs = opts.fs ?? nodeFs;
7643
- const noloHome = resolveNoloHome(env, homedir2);
7644
- const filePath = opts.filePath ?? join2(noloHome, "agent_run_todos.json");
7645
- const oldFilePath = join2(noloHome, "todos.json");
7792
+ const homedir3 = opts.homedir ?? nodeHomedir;
7793
+ const fs2 = opts.fs ?? nodeFs;
7794
+ const noloHome = resolveNoloHome(env, homedir3);
7795
+ const filePath = opts.filePath ?? join3(noloHome, "agent_run_todos.json");
7796
+ const oldFilePath = join3(noloHome, "todos.json");
7646
7797
  const loadMap = () => {
7647
- if (!opts.filePath && !fs.existsSync(filePath) && fs.existsSync(oldFilePath)) {
7648
- const oldData = readJson(oldFilePath, fs);
7798
+ if (!opts.filePath && !fs2.existsSync(filePath) && fs2.existsSync(oldFilePath)) {
7799
+ const oldData = readJson(oldFilePath, fs2);
7649
7800
  const map2 = /* @__PURE__ */ new Map();
7650
7801
  if (oldData?.todos) {
7651
7802
  for (const item of oldData.todos) {
@@ -7667,11 +7818,11 @@ function createFileSystemTodoStore(opts = {}) {
7667
7818
  }
7668
7819
  }
7669
7820
  }
7670
- ensureDir(dirname2(filePath), fs);
7671
- writeJson(filePath, { todos: [...map2.values()] }, fs);
7821
+ ensureDir(dirname3(filePath), fs2);
7822
+ writeJson(filePath, { todos: [...map2.values()] }, fs2);
7672
7823
  return map2;
7673
7824
  }
7674
- const data = readJson(filePath, fs);
7825
+ const data = readJson(filePath, fs2);
7675
7826
  const map = /* @__PURE__ */ new Map();
7676
7827
  if (data?.todos) {
7677
7828
  for (const todo of data.todos) {
@@ -7681,8 +7832,8 @@ function createFileSystemTodoStore(opts = {}) {
7681
7832
  return map;
7682
7833
  };
7683
7834
  const persist = (map) => {
7684
- ensureDir(dirname2(filePath), fs);
7685
- writeJson(filePath, { todos: [...map.values()] }, fs);
7835
+ ensureDir(dirname3(filePath), fs2);
7836
+ writeJson(filePath, { todos: [...map.values()] }, fs2);
7686
7837
  };
7687
7838
  return {
7688
7839
  async getTodo(id) {
@@ -7712,13 +7863,13 @@ function createFileSystemTodoStore(opts = {}) {
7712
7863
  }
7713
7864
 
7714
7865
  // packages/cli/client/instaboxRunConfig.ts
7715
- import { lstatSync, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
7716
- import { isAbsolute as isAbsolute3, normalize, resolve as resolve2 } from "node:path";
7866
+ import { lstatSync as lstatSync2, readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
7867
+ import { isAbsolute as isAbsolute4, normalize, resolve as resolve3 } from "node:path";
7717
7868
 
7718
7869
  // packages/cli/client/localInstaboxWorkspaceDelivery.ts
7719
7870
  import { constants } from "node:fs";
7720
7871
  import { open, realpath } from "node:fs/promises";
7721
- import { createHash as createHash3 } from "node:crypto";
7872
+ import { createHash as createHash4 } from "node:crypto";
7722
7873
 
7723
7874
  // packages/agent-runtime/instaboxBackend.ts
7724
7875
  var INSTABOX_BACKEND_ID = "instabox";
@@ -7893,7 +8044,7 @@ var InstaboxBackend = class {
7893
8044
  ...rawBody === void 0 ? {} : { body: rawBody }
7894
8045
  });
7895
8046
  });
7896
- this.#sleep = options.sleepImpl ?? ((ms) => new Promise((resolve7) => setTimeout(resolve7, ms)));
8047
+ this.#sleep = options.sleepImpl ?? ((ms) => new Promise((resolve8) => setTimeout(resolve8, ms)));
7897
8048
  this.#machineTimeoutSeconds = options.machineTimeoutSeconds ?? 1800;
7898
8049
  this.#createTimeoutMs = options.createTimeoutMs ?? 18e4;
7899
8050
  this.#deleteTimeoutMs = options.deleteTimeoutMs ?? 12e4;
@@ -8450,8 +8601,8 @@ var InstaboxBackend = class {
8450
8601
  try {
8451
8602
  await Promise.race([
8452
8603
  this.#sleep(Math.min(this.#pollIntervalMs, remaining())),
8453
- new Promise((resolve7) => {
8454
- timer = setTimeout(resolve7, remaining());
8604
+ new Promise((resolve8) => {
8605
+ timer = setTimeout(resolve8, remaining());
8455
8606
  })
8456
8607
  ]);
8457
8608
  } finally {
@@ -8754,8 +8905,8 @@ var InstaboxBackend = class {
8754
8905
  try {
8755
8906
  return await Promise.race([
8756
8907
  this.#call({ ...args, timeoutMs: void 0 }),
8757
- new Promise((resolve7) => {
8758
- timer = setTimeout(() => resolve7({ status: 0, payload: null, transportError: "Timeout" }), args.timeoutMs);
8908
+ new Promise((resolve8) => {
8909
+ timer = setTimeout(() => resolve8({ status: 0, payload: null, transportError: "Timeout" }), args.timeoutMs);
8759
8910
  })
8760
8911
  ]);
8761
8912
  } finally {
@@ -8893,7 +9044,7 @@ function extractInstaboxErrorCode(payload) {
8893
9044
 
8894
9045
  // packages/cli/client/localInstaboxWorkspaceDelivery.ts
8895
9046
  var SNAPSHOT_LIMITS = { files: 256, fileBytes: 8 * 1024 * 1024, totalBytes: 32 * 1024 * 1024, chunkBytes: 384 * 1024 };
8896
- var hash = (bytes) => createHash3("sha256").update(bytes).digest("hex");
9047
+ var hash = (bytes) => createHash4("sha256").update(bytes).digest("hex");
8897
9048
  var fail = (code) => {
8898
9049
  throw new Error(`instabox_workspace_delivery:${code}`);
8899
9050
  };
@@ -9115,14 +9266,14 @@ function resolveInstaboxRunConfigPath(options) {
9115
9266
  fail2("missing_path", `\u73AF\u5883\u53D8\u91CF ${INSTABOX_RUN_CONFIG_ENV} \u672A\u8BBE\u7F6E\u6216\u4E3A\u7A7A`);
9116
9267
  }
9117
9268
  const runsDir = options?.runsDir ?? resolveRunsDir(env);
9118
- const normalizedRunsDir = normalize(resolve2(runsDir));
9119
- const resolvedTarget = isAbsolute3(explicitPath) ? normalize(explicitPath) : normalize(resolve2(normalizedRunsDir, explicitPath));
9269
+ const normalizedRunsDir = normalize(resolve3(runsDir));
9270
+ const resolvedTarget = isAbsolute4(explicitPath) ? normalize(explicitPath) : normalize(resolve3(normalizedRunsDir, explicitPath));
9120
9271
  if (resolvedTarget !== normalizedRunsDir && !resolvedTarget.startsWith(normalizedRunsDir.endsWith("/") ? normalizedRunsDir : `${normalizedRunsDir}/`)) {
9121
9272
  fail2("path_traversal", `\u914D\u7F6E\u8DEF\u5F84 "${explicitPath}" \u8D8A\u51FA\u4E86\u9650\u5B9A\u7684 runs \u76EE\u5F55 "${normalizedRunsDir}"`);
9122
9273
  }
9123
9274
  let stats;
9124
9275
  try {
9125
- stats = lstatSync(resolvedTarget);
9276
+ stats = lstatSync2(resolvedTarget);
9126
9277
  } catch (err) {
9127
9278
  fail2("file_unreadable", `\u914D\u7F6E\u6587\u4EF6\u4E0D\u53EF\u8BFB\u6216\u4E0D\u5B58\u5728: ${resolvedTarget}`);
9128
9279
  }
@@ -9136,8 +9287,8 @@ function resolveInstaboxRunConfigPath(options) {
9136
9287
  fail2("file_too_large", `\u914D\u7F6E\u6587\u4EF6\u5927\u5C0F (${stats.size} \u5B57\u8282) \u8D85\u8FC7\u4E0A\u9650 (${INSTABOX_RUN_CONFIG_MAX_BYTES} \u5B57\u8282)`);
9137
9288
  }
9138
9289
  try {
9139
- const realTarget = realpathSync2(resolvedTarget);
9140
- const realRuns = realpathSync2(normalizedRunsDir);
9290
+ const realTarget = realpathSync3(resolvedTarget);
9291
+ const realRuns = realpathSync3(normalizedRunsDir);
9141
9292
  if (realTarget !== realRuns && !realTarget.startsWith(realRuns.endsWith("/") ? realRuns : `${realRuns}/`)) {
9142
9293
  fail2("symlink_traversal", `\u914D\u7F6E\u771F\u5B9E\u8DEF\u5F84 "${realTarget}" \u8D8A\u51FA runs \u771F\u5B9E\u76EE\u5F55 "${realRuns}"`);
9143
9294
  }
@@ -9149,7 +9300,7 @@ function loadInstaboxRunConfig(options) {
9149
9300
  const { resolvedPath } = resolveInstaboxRunConfigPath(options);
9150
9301
  let rawText;
9151
9302
  try {
9152
- rawText = readFileSync3(resolvedPath, "utf8");
9303
+ rawText = readFileSync4(resolvedPath, "utf8");
9153
9304
  } catch (err) {
9154
9305
  fail2("file_read_failed", `\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
9155
9306
  }
@@ -9198,7 +9349,7 @@ function loadInstaboxRunConfig(options) {
9198
9349
  if (!artifactRootRaw) {
9199
9350
  fail2("missing_artifact_root", "artifactRoot (artifact\u76EE\u7684\u76EE\u5F55) \u5FC5\u987B\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u672A\u914D\u7F6E\u6216\u9ED8\u8BA4\u5747\u88AB\u62D2\u7EDD");
9200
9351
  }
9201
- if (!isAbsolute3(artifactRootRaw) || artifactRootRaw.includes("\0") || artifactRootRaw.split("/").includes("..")) {
9352
+ if (!isAbsolute4(artifactRootRaw) || artifactRootRaw.includes("\0") || artifactRootRaw.split("/").includes("..")) {
9202
9353
  fail2("invalid_artifact_root", `artifactRoot \u5FC5\u987B\u4E3A\u5408\u6CD5\u7EDD\u5BF9\u8DEF\u5F84: "${artifactRootRaw}"`);
9203
9354
  }
9204
9355
  const artifactRoot = normalize(artifactRootRaw);
@@ -9431,10 +9582,10 @@ var parseCallArgs = (call) => {
9431
9582
  return {};
9432
9583
  }
9433
9584
  };
9434
- var resolveFs = (deps) => deps.fs ?? { existsSync: existsSync3, readFileSync: readFileSync4 };
9585
+ var resolveFs = (deps) => deps.fs ?? { existsSync: existsSync4, readFileSync: readFileSync5 };
9435
9586
  var probeRunCwd = (deps) => {
9436
- const fs = deps.fs;
9437
- const stat = fs?.statSync ?? nodeFs2.statSync;
9587
+ const fs2 = deps.fs;
9588
+ const stat = fs2?.statSync ?? nodeFs2.statSync;
9438
9589
  return (absolutePath) => {
9439
9590
  try {
9440
9591
  return stat(absolutePath).isDirectory() ? "directory" : "not-a-directory";
@@ -9443,10 +9594,10 @@ var probeRunCwd = (deps) => {
9443
9594
  }
9444
9595
  };
9445
9596
  };
9446
- var tailFile = (logPath, tailLines, fs) => {
9447
- if (!fs.existsSync(logPath)) return void 0;
9597
+ var tailFile = (logPath, tailLines, fs2) => {
9598
+ if (!fs2.existsSync(logPath)) return void 0;
9448
9599
  try {
9449
- const content = fs.readFileSync(logPath, "utf8");
9600
+ const content = fs2.readFileSync(logPath, "utf8");
9450
9601
  const lines = String(content).split(/\r?\n/);
9451
9602
  if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
9452
9603
  return lines.slice(Math.max(0, lines.length - tailLines)).join("\n");
@@ -9608,36 +9759,36 @@ function createCliStartAgentRunExecutor(deps = {}) {
9608
9759
  let previousCacheHitRatio = previousRecord?.cacheHitRatio;
9609
9760
  if (previousRecord && previousCacheHitRatio === void 0 && previousRecord.resultFile) {
9610
9761
  try {
9611
- const fs = deps.fs ?? nodeFs2;
9612
- const runsDir = resolve3(resolveRunsDir(deps.env, deps.homedir));
9613
- const expected = resolve3(runsDir, `${previousRecord.runId}.result.md`);
9614
- if (previousRecord.runId.includes("/") || previousRecord.runId.includes("\\") || resolve3(previousRecord.resultFile) !== expected || !fs.realpathSync || !fs.lstatSync) throw new Error("Unverified result path");
9615
- const stat = fs.lstatSync(expected);
9762
+ const fs2 = deps.fs ?? nodeFs2;
9763
+ const runsDir = resolve4(resolveRunsDir(deps.env, deps.homedir));
9764
+ const expected = resolve4(runsDir, `${previousRecord.runId}.result.md`);
9765
+ if (previousRecord.runId.includes("/") || previousRecord.runId.includes("\\") || resolve4(previousRecord.resultFile) !== expected || !fs2.realpathSync || !fs2.lstatSync) throw new Error("Unverified result path");
9766
+ const stat = fs2.lstatSync(expected);
9616
9767
  if (!stat.isFile() || stat.isSymbolicLink()) throw new Error("Non-regular result file");
9617
- const canonicalDir = String(fs.realpathSync(runsDir));
9618
- if (String(fs.realpathSync(expected)) !== join3(canonicalDir, `${previousRecord.runId}.result.md`)) throw new Error("Result escapes runs directory");
9619
- if ((deps.platform ?? process.platform) !== "linux" || !fs.fstatSync || !fs.readSync || !fs.closeSync || !nodeFs2.constants.O_NOFOLLOW || !nodeFs2.constants.O_DIRECTORY) throw new Error("FD proof unavailable");
9768
+ const canonicalDir = String(fs2.realpathSync(runsDir));
9769
+ if (String(fs2.realpathSync(expected)) !== join4(canonicalDir, `${previousRecord.runId}.result.md`)) throw new Error("Result escapes runs directory");
9770
+ if ((deps.platform ?? process.platform) !== "linux" || !fs2.fstatSync || !fs2.readSync || !fs2.closeSync || !nodeFs2.constants.O_NOFOLLOW || !nodeFs2.constants.O_DIRECTORY) throw new Error("FD proof unavailable");
9620
9771
  let dirFd;
9621
9772
  let resultFd;
9622
9773
  let text = "";
9623
9774
  try {
9624
- dirFd = fs.openSync(runsDir, nodeFs2.constants.O_RDONLY | nodeFs2.constants.O_DIRECTORY | nodeFs2.constants.O_NOFOLLOW);
9625
- if (!fs.fstatSync(dirFd).isDirectory() || String(fs.realpathSync(`/proc/self/fd/${dirFd}`)) !== canonicalDir) throw new Error("Unverified directory fd");
9626
- resultFd = fs.openSync(`/proc/self/fd/${dirFd}/${previousRecord.runId}.result.md`, nodeFs2.constants.O_RDONLY | nodeFs2.constants.O_NOFOLLOW | nodeFs2.constants.O_NONBLOCK);
9627
- if (!fs.fstatSync(resultFd).isFile() || String(fs.realpathSync(`/proc/self/fd/${resultFd}`)) !== join3(canonicalDir, `${previousRecord.runId}.result.md`)) throw new Error("Unverified result fd");
9775
+ dirFd = fs2.openSync(runsDir, nodeFs2.constants.O_RDONLY | nodeFs2.constants.O_DIRECTORY | nodeFs2.constants.O_NOFOLLOW);
9776
+ if (!fs2.fstatSync(dirFd).isDirectory() || String(fs2.realpathSync(`/proc/self/fd/${dirFd}`)) !== canonicalDir) throw new Error("Unverified directory fd");
9777
+ resultFd = fs2.openSync(`/proc/self/fd/${dirFd}/${previousRecord.runId}.result.md`, nodeFs2.constants.O_RDONLY | nodeFs2.constants.O_NOFOLLOW | nodeFs2.constants.O_NONBLOCK);
9778
+ if (!fs2.fstatSync(resultFd).isFile() || String(fs2.realpathSync(`/proc/self/fd/${resultFd}`)) !== join4(canonicalDir, `${previousRecord.runId}.result.md`)) throw new Error("Unverified result fd");
9628
9779
  const bytes = Buffer.alloc(16 * 1024);
9629
9780
  let offset = 0;
9630
9781
  while (offset < bytes.length) {
9631
- const count2 = fs.readSync(resultFd, bytes, offset, bytes.length - offset, offset);
9782
+ const count2 = fs2.readSync(resultFd, bytes, offset, bytes.length - offset, offset);
9632
9783
  if (count2 === 0) break;
9633
9784
  offset += count2;
9634
9785
  }
9635
9786
  text = bytes.subarray(0, offset).toString("utf8");
9636
9787
  } finally {
9637
9788
  try {
9638
- if (resultFd !== void 0) fs.closeSync(resultFd);
9789
+ if (resultFd !== void 0) fs2.closeSync(resultFd);
9639
9790
  } finally {
9640
- if (dirFd !== void 0) fs.closeSync(dirFd);
9791
+ if (dirFd !== void 0) fs2.closeSync(dirFd);
9641
9792
  }
9642
9793
  }
9643
9794
  const header = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(text)?.[1];
@@ -9662,9 +9813,9 @@ function createCliStartAgentRunExecutor(deps = {}) {
9662
9813
  const bindingMachineId = agentKey && deps.resolveAgentRuntimeBindingMachineId ? await deps.resolveAgentRuntimeBindingMachineId(agentKey) : void 0;
9663
9814
  const localMachineId = deps.resolveLocalMachineId ? await deps.resolveLocalMachineId() : void 0;
9664
9815
  let memoryPlacementNote;
9665
- let effectiveRuntimeKey = args.runtimeKey;
9816
+ let effectiveRuntimeKey = args.workspaceIsolation === "auto" && args.readOnly !== true && !args.runtimeKey?.trim() ? "local" : args.runtimeKey;
9666
9817
  const autoPlacement = await evaluateAutoInstaboxPlacement({
9667
- runtimeKey: args.runtimeKey,
9818
+ runtimeKey: effectiveRuntimeKey,
9668
9819
  cwd: args.cwd,
9669
9820
  readOnly: args.readOnly === true,
9670
9821
  env: deps.env,
@@ -9696,6 +9847,8 @@ function createCliStartAgentRunExecutor(deps = {}) {
9696
9847
  ...bindingMachineId ? { bindingMachineId } : {},
9697
9848
  ...localMachineId ? { localMachineId } : {}
9698
9849
  });
9850
+ if (args.workspaceIsolation !== void 0 && args.workspaceIsolation !== "none" && args.workspaceIsolation !== "auto") throw new Error("workspaceIsolation \u5FC5\u987B\u4E3A none \u6216 auto");
9851
+ if (args.workspaceIsolation === "auto" && args.readOnly !== true && dispatch.target !== "host") throw new Error("workspaceIsolation:auto \u53EA\u652F\u6301\u672C\u5730 CLI \u5BBF\u4E3B\u5199\u578B\u4EFB\u52A1\uFF0C\u6C99\u76D2\u4E0D\u80FD\u5151\u73B0\u5BBF\u4E3B\u76EE\u5F55\u9694\u79BB");
9699
9852
  const task = typeof args.task === "string" ? args.task.trim() : "";
9700
9853
  const runTitle = normalizeRunTitle(args.title);
9701
9854
  if (!agentKey) throw new Error(t("agentRunTool.missingAgentKey"));
@@ -9738,7 +9891,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
9738
9891
  const manifest = typeof args.instaboxManifest === "string" ? args.instaboxManifest.trim() : "";
9739
9892
  if (workspace === "snapshot" && !manifest) throw new Error("instaboxWorkspace=snapshot \u5FC5\u987B\u63D0\u4F9B instaboxManifest");
9740
9893
  if (workspace === "empty" && args.instaboxManifest !== void 0) throw new Error("instaboxWorkspace=empty \u4E0D\u5F97\u63D0\u4F9B instaboxManifest");
9741
- const artifactDir = args.instaboxArtifactDir ?? join3(
9894
+ const artifactDir = args.instaboxArtifactDir ?? join4(
9742
9895
  resolveRunsDir(deps.env, deps.homedir),
9743
9896
  "instabox-artifacts",
9744
9897
  randomUUID3()
@@ -9791,44 +9944,64 @@ function createCliStartAgentRunExecutor(deps = {}) {
9791
9944
  });
9792
9945
  const dodCommands = Array.isArray(args.dodCommands) ? args.dodCommands.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : typeof args.dod === "string" && args.dod.trim().length > 0 ? [args.dod.trim()] : Array.isArray(args.dod) ? args.dod.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : void 0;
9793
9946
  const childPolicy = parseAgentRunArgs(rawArgs, { readTextFile: () => message });
9794
- const { runId, batchId: resolvedBatchId } = await spawnLocalBackgroundRun(
9795
- {
9796
- selectionCheck,
9797
- ...evidenceScope ? { evidenceScope } : {},
9798
- ...dispatchUserId ? { dispatchSpeedProvenance: {
9799
- version: 1,
9800
- source: "cli-startAgentRun",
9801
- userId: dispatchUserId
9802
- } } : {},
9803
- rawArgs,
9804
- commandPath: ["agent", "run"],
9805
- cliEntrypointPath: deps.cliEntrypoint,
9806
- agentKey,
9807
- ...agentName ? { agentName } : {},
9808
- ...runTitle ? { title: runTitle } : {},
9809
- ...batchId ? { batchId } : {},
9810
- ...credentialGroup ? { credentialGroup } : {},
9811
- ...parentDialogId ? { parentDialogId } : {},
9812
- // 续跑目标对话:spawn 时落盘,让"开着这条对话的 TUI"在 running 期间就能
9813
- // 看到另一边在跑(dock 按 dialogId 也能匹配到这条 run)。
9814
- ...continueDialogId ? { dialogId: continueDialogId } : {},
9815
- ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
9816
- cwd: requestedCwd ?? deps.cwd ?? process.cwd(),
9817
- ...dispatch.runtimeKey === "local" && !isReadOnlyTask ? { claimLocalWrites: true } : {},
9818
- ...dispatch.target === "host" ? { localExecution: {
9819
- runtimeKey: "local",
9820
- hostWritesAuthorized: args.allowHostWrites === true,
9821
- readOnly: isReadOnlyTask,
9822
- ...childPolicy?.allowedToolNames ? { allowedToolNames: childPolicy.allowedToolNames } : {},
9823
- ...childPolicy?.blockedToolNames ? { blockedToolNames: childPolicy.blockedToolNames } : {},
9824
- provenance: "cli-tool-dispatch-authorized"
9825
- } } : {},
9826
- message,
9827
- ...args.ephemeral === true ? { ephemeral: true } : {},
9828
- output: noopOutput
9829
- },
9830
- { ...deps, mcpApprovalHost: deps.mcpApprovalHostForAgent ? await deps.mcpApprovalHostForAgent(agentKey) : deps.mcpApprovalHost, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
9831
- );
9947
+ const isolationEnabled = args.workspaceIsolation === "auto" && !isReadOnlyTask;
9948
+ const isolationRunId = isolationEnabled ? (deps.generateRunId ?? defaultGenerateRunId)() : void 0;
9949
+ const baseCwd = requestedCwd ?? deps.cwd ?? process.cwd();
9950
+ const workspaceIsolation = isolationEnabled ? (deps.prepareIsolation ?? prepareWorkspaceIsolation)({
9951
+ baseCwd,
9952
+ runId: isolationRunId,
9953
+ mode: "auto",
9954
+ noloHome: dirname4(resolveRunsDir(deps.env, deps.homedir))
9955
+ }) : { mode: args.workspaceIsolation ?? "none", kind: "none", effectiveCwd: baseCwd };
9956
+ let spawned;
9957
+ try {
9958
+ spawned = await spawnLocalBackgroundRun(
9959
+ {
9960
+ selectionCheck,
9961
+ ...evidenceScope ? { evidenceScope } : {},
9962
+ ...dispatchUserId ? { dispatchSpeedProvenance: {
9963
+ version: 1,
9964
+ source: "cli-startAgentRun",
9965
+ userId: dispatchUserId
9966
+ } } : {},
9967
+ rawArgs,
9968
+ commandPath: ["agent", "run"],
9969
+ cliEntrypointPath: deps.cliEntrypoint,
9970
+ agentKey,
9971
+ ...agentName ? { agentName } : {},
9972
+ ...runTitle ? { title: runTitle } : {},
9973
+ ...batchId ? { batchId } : {},
9974
+ ...credentialGroup ? { credentialGroup } : {},
9975
+ ...parentDialogId ? { parentDialogId } : {},
9976
+ // 续跑目标对话:spawn 时落盘,让"开着这条对话的 TUI"在 running 期间就能
9977
+ // 看到另一边在跑(dock 按 dialogId 也能匹配到这条 run)。
9978
+ ...continueDialogId ? { dialogId: continueDialogId } : {},
9979
+ ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
9980
+ cwd: workspaceIsolation.effectiveCwd,
9981
+ ...dispatch.runtimeKey === "local" && !isReadOnlyTask ? { claimLocalWrites: true } : {},
9982
+ ...dispatch.target === "host" ? { localExecution: {
9983
+ runtimeKey: "local",
9984
+ hostWritesAuthorized: args.allowHostWrites === true,
9985
+ readOnly: isReadOnlyTask,
9986
+ ...childPolicy?.allowedToolNames ? { allowedToolNames: childPolicy.allowedToolNames } : {},
9987
+ ...childPolicy?.blockedToolNames ? { blockedToolNames: childPolicy.blockedToolNames } : {},
9988
+ provenance: "cli-tool-dispatch-authorized"
9989
+ } } : {},
9990
+ message,
9991
+ ...args.ephemeral === true ? { ephemeral: true } : {},
9992
+ output: noopOutput
9993
+ },
9994
+ { ...deps, ...isolationRunId !== void 0 ? { generateRunId: () => isolationRunId } : {}, mcpApprovalHost: deps.mcpApprovalHostForAgent ? await deps.mcpApprovalHostForAgent(agentKey) : deps.mcpApprovalHost, shellApprovalHost: deps.shellApprovalHostForAgent ? await deps.shellApprovalHostForAgent(agentKey) : deps.shellApprovalHost }
9995
+ );
9996
+ } catch (error) {
9997
+ try {
9998
+ if (isolationEnabled) (deps.rollbackIsolation ?? rollbackWorkspaceIsolation)(workspaceIsolation);
9999
+ } catch (cleanupError) {
10000
+ throw new AggregateError([error, cleanupError], `\u542F\u52A8\u5931\u8D25\uFF1B\u9694\u79BB\u76EE\u5F55\u4FDD\u7559\u5F85\u5904\u7406: ${workspaceIsolation.root}`);
10001
+ }
10002
+ throw error;
10003
+ }
10004
+ const { runId, batchId: resolvedBatchId } = spawned;
9832
10005
  const displayName = resolveRunLabel({ agentName, agentKey, runId });
9833
10006
  const labels = agentRunCardLabels();
9834
10007
  const taskPreview = typeof args.task === "string" ? args.task.replace(/\s+/g, " ").trim().slice(0, TASK_PREVIEW_MAX) : "";
@@ -9863,6 +10036,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
9863
10036
  agentKey,
9864
10037
  status: "running",
9865
10038
  selectionCheck,
10039
+ ...args.workspaceIsolation !== void 0 ? { workspaceIsolation } : {},
9866
10040
  ...contextFacts,
9867
10041
  ...continuationEvidence,
9868
10042
  // batchId is always returned so the caller can later filter by it —
@@ -10143,7 +10317,7 @@ function createCliControlAgentRunExecutor(deps = {}) {
10143
10317
  };
10144
10318
  }
10145
10319
  if (action === "append") {
10146
- if (["runtimeKey", "allowHostWrites", "readOnly", "allowedToolNames", "blockedToolNames", "cwd"].some((key) => args[key] !== void 0)) {
10320
+ if (["runtimeKey", "allowHostWrites", "readOnly", "allowedToolNames", "blockedToolNames", "cwd", "workspaceIsolation"].some((key) => args[key] !== void 0)) {
10147
10321
  throw new Error("[local-continuation] scope overrides are not supported; dispatch a fresh authorized run");
10148
10322
  }
10149
10323
  const dialogKeyArg = typeof args.dialogKey === "string" ? args.dialogKey.trim() : "";
@@ -10183,8 +10357,8 @@ ${userInput}` : userInput;
10183
10357
  const afterCheck = checkStaleRun(reconciled2.runId, deps) ?? reconciled2;
10184
10358
  if (isAgentRunTerminalStatus(afterCheck.status)) {
10185
10359
  return await withQueueLock(queuePath, deps, async () => {
10186
- const fs = deps.fs ?? nodeFs2;
10187
- const remainingEntries = _readQueueEntriesLocked(queuePath, fs);
10360
+ const fs2 = deps.fs ?? nodeFs2;
10361
+ const remainingEntries = _readQueueEntriesLocked(queuePath, fs2);
10188
10362
  const ourEntryFound = remainingEntries.some((e) => e.id === entryId);
10189
10363
  if (!ourEntryFound) {
10190
10364
  return {
@@ -10214,11 +10388,11 @@ ${userInput}` : userInput;
10214
10388
  ${entry.text}`).join("\n\n");
10215
10389
  const result = await spawnContinuationRun(afterCheck, mergedMessage, userInput, deps);
10216
10390
  const transferred = new Set(remainingEntries.map((entry) => entry.id));
10217
- const current = _readQueueEntriesLocked(queuePath, fs);
10218
- if (typeof fs.renameSync !== "function") throw new Error("atomic queue replacement requires renameSync");
10391
+ const current = _readQueueEntriesLocked(queuePath, fs2);
10392
+ if (typeof fs2.renameSync !== "function") throw new Error("atomic queue replacement requires renameSync");
10219
10393
  const pendingQueue = `${queuePath}.${randomUUID3()}.tmp`;
10220
- fs.writeFileSync(pendingQueue, serializeQueueEntries(current.filter((entry) => !transferred.has(entry.id))), { encoding: "utf8", flag: "wx" });
10221
- fs.renameSync(pendingQueue, queuePath);
10394
+ fs2.writeFileSync(pendingQueue, serializeQueueEntries(current.filter((entry) => !transferred.has(entry.id))), { encoding: "utf8", flag: "wx" });
10395
+ fs2.renameSync(pendingQueue, queuePath);
10222
10396
  return result;
10223
10397
  });
10224
10398
  }
@@ -10515,11 +10689,19 @@ function pickAgentRunResolverDeps(args) {
10515
10689
  };
10516
10690
  }
10517
10691
  function buildCliWorkspaceToolExecutors(args) {
10692
+ const resolveDialogStore = args.resolveDialogStore;
10518
10693
  return buildNoloWorkspaceCliToolExecutors({
10519
10694
  cliEntrypoint: args.cliEntrypoint ?? process.argv[1] ?? "",
10520
10695
  env: args.env,
10521
10696
  metadataKind: "cliWorkspaceTool",
10522
- planningCaller: args.planningCaller
10697
+ planningCaller: args.planningCaller,
10698
+ // 只放开 readDialog(本机独占对话)的进程内直读;listDialogs 一律保持
10699
+ // 权威跨端合并路径——本地库只是缓存,抢答会静默漏掉 Web/手机端新对话。
10700
+ ...resolveDialogStore ? {
10701
+ resolveDialogStore,
10702
+ resolveCurrentUserId: () => resolveLocalUserId(args.env),
10703
+ resolveLocalChildDialogIds: args.resolveLocalChildDialogIds ?? (() => loadLocalRunChildDialogIds({ env: args.env }))
10704
+ } : {}
10523
10705
  });
10524
10706
  }
10525
10707
  function buildLocalToolExecutors(args) {
@@ -10545,7 +10727,9 @@ function buildLocalToolExecutors(args) {
10545
10727
  ...buildCliWorkspaceToolExecutors({
10546
10728
  planningCaller: args.planningCaller,
10547
10729
  env: args.env,
10548
- cliEntrypoint: args.cliEntrypoint
10730
+ cliEntrypoint: args.cliEntrypoint,
10731
+ ...args.resolveDialogStore ? { resolveDialogStore: args.resolveDialogStore } : {},
10732
+ ...args.resolveLocalChildDialogIds ? { resolveLocalChildDialogIds: args.resolveLocalChildDialogIds } : {}
10549
10733
  }),
10550
10734
  // loadSkill resolves SKILL.md from the agent's workspace root (local-fs,
10551
10735
  // no `nolo` CLI subcommand), so it is wired here instead of inside
@@ -10886,8 +11070,8 @@ function createOAuthApiKeyRefResolver(options = {}) {
10886
11070
  }
10887
11071
 
10888
11072
  // packages/agent-runtime/localSandboxWorkload.ts
10889
- import { existsSync as existsSync4 } from "node:fs";
10890
- import { resolve as resolve5 } from "node:path";
11073
+ import { existsSync as existsSync5 } from "node:fs";
11074
+ import { resolve as resolve6 } from "node:path";
10891
11075
 
10892
11076
  // packages/agent-runtime/executionChannel.ts
10893
11077
  var EXECUTION_SHELL_TOOL = "execShell";
@@ -10973,12 +11157,12 @@ import {
10973
11157
  openSync,
10974
11158
  readlinkSync,
10975
11159
  rmdirSync,
10976
- unlinkSync,
11160
+ unlinkSync as unlinkSync2,
10977
11161
  writeSync
10978
11162
  } from "node:fs";
10979
11163
  import { access } from "node:fs/promises";
10980
11164
  import { tmpdir } from "node:os";
10981
- import { isAbsolute as isAbsolute4, join as join4, relative, resolve as resolve4 } from "node:path";
11165
+ import { isAbsolute as isAbsolute5, join as join5, relative as relative2, resolve as resolve5 } from "node:path";
10982
11166
 
10983
11167
  // packages/agent-runtime/linuxSandboxSeccomp.ts
10984
11168
  var AUDIT_ARCH_X86_64 = 3221225534;
@@ -11071,14 +11255,14 @@ var MAX_OUTPUT_BYTES = 1024 * 1024;
11071
11255
  var PSEUDO_FS = ["/proc", "/sys", "/dev", "/run"];
11072
11256
  var SANDBOX_MOUNTS = ["/", "/usr", "/bin", "/lib", "/lib64", "/tmp"];
11073
11257
  var inside = (parent, child) => {
11074
- const rel = relative(parent, child);
11075
- return rel === "" || rel !== ".." && !rel.startsWith("../") && !isAbsolute4(rel);
11258
+ const rel = relative2(parent, child);
11259
+ return rel === "" || rel !== ".." && !rel.startsWith("../") && !isAbsolute5(rel);
11076
11260
  };
11077
11261
  function openRootHandle(path) {
11078
- if (typeof path !== "string" || !isAbsolute4(path) || path.includes("\0")) {
11262
+ if (typeof path !== "string" || !isAbsolute5(path) || path.includes("\0")) {
11079
11263
  throw new Error("Sandbox root must be absolute");
11080
11264
  }
11081
- const expected = resolve4(path);
11265
+ const expected = resolve5(path);
11082
11266
  if (SANDBOX_MOUNTS.includes(expected) || PSEUDO_FS.some((reserved) => inside(reserved, expected))) {
11083
11267
  throw new Error("Sandbox root overlaps a reserved sandbox/pseudo filesystem path");
11084
11268
  }
@@ -11102,8 +11286,8 @@ function openRootHandle(path) {
11102
11286
  }
11103
11287
  var SECCOMP_TEMP_DIR_PREFIX = "nolo-bwrap-seccomp-";
11104
11288
  function openSeccompFd(program) {
11105
- const dir = mkdtempSync(join4(tmpdir(), SECCOMP_TEMP_DIR_PREFIX));
11106
- const file = join4(dir, "filter.bpf");
11289
+ const dir = mkdtempSync(join5(tmpdir(), SECCOMP_TEMP_DIR_PREFIX));
11290
+ const file = join5(dir, "filter.bpf");
11107
11291
  let writer = -1;
11108
11292
  let reader = -1;
11109
11293
  try {
@@ -11122,7 +11306,7 @@ function openSeccompFd(program) {
11122
11306
  } finally {
11123
11307
  if (writer >= 0) closeSync(writer);
11124
11308
  try {
11125
- unlinkSync(file);
11309
+ unlinkSync2(file);
11126
11310
  } catch {
11127
11311
  }
11128
11312
  try {
@@ -11261,7 +11445,7 @@ var LinuxBubblewrapBackend = class {
11261
11445
  if (request.timeoutMs !== void 0 && (!Number.isFinite(request.timeoutMs) || request.timeoutMs <= 0)) {
11262
11446
  throw new Error("Sandbox timeout must be finite and positive");
11263
11447
  }
11264
- if (request.cwd && !active.writable.some(({ path: root }) => isAbsolute4(request.cwd) && inside(root, resolve4(request.cwd)))) {
11448
+ if (request.cwd && !active.writable.some(({ path: root }) => isAbsolute5(request.cwd) && inside(root, resolve5(request.cwd)))) {
11265
11449
  throw new Error("Command cwd outside writable sandbox roots");
11266
11450
  }
11267
11451
  if (!validateConfiguredRootExecutionLease(active.ticket, active.lease)) {
@@ -11418,7 +11602,7 @@ async function createLocalSandboxWorkload(args) {
11418
11602
  const envRoots = typeof env.NOLO_LOCAL_SANDBOX_ROOTS === "string" ? env.NOLO_LOCAL_SANDBOX_ROOTS.split(":").map((entry) => entry.trim()) : [];
11419
11603
  const readableRoots = normalizeRoots(
11420
11604
  args.readableRoots && args.readableRoots.length > 0 ? args.readableRoots : [...DEFAULT_SANDBOX_READABLE_ROOTS, ...envRoots]
11421
- ).filter((root) => !FORBIDDEN_EXTRA_ROOTS.has(resolve5(root)));
11605
+ ).filter((root) => !FORBIDDEN_EXTRA_ROOTS.has(resolve6(root)));
11422
11606
  const backend = args.backend ?? new LinuxBubblewrapBackend();
11423
11607
  const ticket = {
11424
11608
  version: 1,
@@ -11466,7 +11650,7 @@ async function createLocalSandboxWorkload(args) {
11466
11650
  if (canonicalToolName(toolName) !== EXECUTION_SHELL_TOOL) return null;
11467
11651
  const callArgs = toolArgs ?? {};
11468
11652
  const command = typeof callArgs.command === "string" ? callArgs.command : "";
11469
- const mountedBins = readableRoots.map((root) => `${root}/bin`).filter((dir) => existsSync4(dir));
11653
+ const mountedBins = readableRoots.map((root) => `${root}/bin`).filter((dir) => existsSync5(dir));
11470
11654
  const sandboxPath = [
11471
11655
  ...mountedBins,
11472
11656
  process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin"
@@ -11896,12 +12080,12 @@ async function executeWorkspaceDelivery(plan, runtime, deps = {}) {
11896
12080
  }
11897
12081
  const tmpDir = deps.tmpDir ?? (await import("node:os")).tmpdir();
11898
12082
  const writeTempFile = deps.writeTempFile ?? (async (filePath, content) => {
11899
- const fs = await import("node:fs/promises");
11900
- await fs.writeFile(filePath, content, "utf8");
12083
+ const fs2 = await import("node:fs/promises");
12084
+ await fs2.writeFile(filePath, content, "utf8");
11901
12085
  });
11902
12086
  const removeTempFile = deps.removeTempFile ?? (async (filePath) => {
11903
- const fs = await import("node:fs/promises");
11904
- await fs.rm(filePath, { force: true });
12087
+ const fs2 = await import("node:fs/promises");
12088
+ await fs2.rm(filePath, { force: true });
11905
12089
  });
11906
12090
  let hostBaselineTemp = null;
11907
12091
  if (plan.baselineUpload) {
@@ -12001,10 +12185,10 @@ async function applyDockerWorkspaceDelivery(runtime, selection) {
12001
12185
 
12002
12186
  // packages/cli/client/localWorkspaceArchive.ts
12003
12187
  import { spawnSync } from "node:child_process";
12004
- import { mkdtempSync as mkdtempSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
12188
+ import { mkdtempSync as mkdtempSync2, statSync as statSync3, writeFileSync as writeFileSync2 } from "node:fs";
12005
12189
  import { rm } from "node:fs/promises";
12006
12190
  import { tmpdir as tmpdir2 } from "node:os";
12007
- import { join as join5 } from "node:path";
12191
+ import { join as join6 } from "node:path";
12008
12192
  var runHostCommand = (argv, { cwd }) => {
12009
12193
  const result = spawnSync(argv[0], argv.slice(1), {
12010
12194
  cwd,
@@ -12064,11 +12248,11 @@ function prepareHostWorkspaceDelivery(args) {
12064
12248
  `\u5DE5\u4F5C\u533A\u6587\u4EF6\u6570 ${tracked.length} \u8D85\u8FC7\u4E0A\u9650 ${MAX_DELIVERY_FILE_COUNT}\uFF1A\u7591\u4F3C\u628A node_modules / \u6784\u5EFA\u4EA7\u7269\u6253\u8FDB\u4E86\u5F52\u6863\uFF08\u5F52\u6863\u53EA\u53D6 git ls-files\uFF09\u3002`
12065
12249
  );
12066
12250
  }
12067
- const stagingDir = mkdtempSync2(join5(args.tmpDir ?? tmpdir2(), "nolo-workspace-delivery-"));
12251
+ const stagingDir = mkdtempSync2(join6(args.tmpDir ?? tmpdir2(), "nolo-workspace-delivery-"));
12068
12252
  const stamp = `${process.pid}-${Date.now()}`;
12069
- const archivePath = join5(stagingDir, `workspace-${stamp}.tar.gz`);
12070
- const bundlePath = join5(stagingDir, `workspace-${stamp}.bundle`);
12071
- const listPath = join5(stagingDir, `filelist-${stamp}.z`);
12253
+ const archivePath = join6(stagingDir, `workspace-${stamp}.tar.gz`);
12254
+ const bundlePath = join6(stagingDir, `workspace-${stamp}.bundle`);
12255
+ const listPath = join6(stagingDir, `filelist-${stamp}.z`);
12072
12256
  const removeFile = args.removeFile ?? (async (filePath) => {
12073
12257
  await rm(filePath, { force: true });
12074
12258
  });
@@ -12149,7 +12333,7 @@ function prepareHostWorkspaceDelivery(args) {
12149
12333
  }
12150
12334
  let archiveSizeBytes = 0;
12151
12335
  try {
12152
- archiveSizeBytes = statSync2(archivePath).size;
12336
+ archiveSizeBytes = statSync3(archivePath).size;
12153
12337
  } catch (error) {
12154
12338
  return fail3(
12155
12339
  "host_workspace_archive_failed",
@@ -12209,7 +12393,7 @@ function buildHostBundle(args) {
12209
12393
  }
12210
12394
  let sizeBytes = 0;
12211
12395
  try {
12212
- sizeBytes = statSync2(args.bundlePath).size;
12396
+ sizeBytes = statSync3(args.bundlePath).size;
12213
12397
  } catch (error) {
12214
12398
  return {
12215
12399
  ok: false,
@@ -12312,7 +12496,7 @@ async function createLocalDockerWorkload(args) {
12312
12496
  }
12313
12497
  const createLifecycle = args.createLifecycle ?? (async () => {
12314
12498
  const [{ DockerWorkloadLifecycle, createDockerBindingAuthorizer }, accounts] = await Promise.all([
12315
- import("./workloadLifecycle-HFJIN5IZ.js"),
12499
+ import("./workloadLifecycle-ZCSQCHG3.js"),
12316
12500
  import("./accountResolver-QETKNC7T.js")
12317
12501
  ]);
12318
12502
  const resolveAccount = args.resolveAccount ?? accounts.createDockerAccountResolver({
@@ -12408,28 +12592,28 @@ async function createLocalDockerWorkload(args) {
12408
12592
  };
12409
12593
  let rejectReady = () => {
12410
12594
  };
12411
- const ready = new Promise((resolve7, reject) => {
12412
- resolveReady = resolve7;
12595
+ const ready = new Promise((resolve8, reject) => {
12596
+ resolveReady = resolve8;
12413
12597
  rejectReady = reject;
12414
12598
  });
12415
12599
  let releaseRun = () => {
12416
12600
  };
12417
- const releaseGate = new Promise((resolve7) => {
12418
- releaseRun = resolve7;
12601
+ const releaseGate = new Promise((resolve8) => {
12602
+ releaseRun = resolve8;
12419
12603
  });
12420
12604
  const waitForReleaseOrAbort = () => {
12421
12605
  const signal = args.signal;
12422
12606
  if (!signal) return releaseGate;
12423
12607
  if (signal.aborted) return Promise.resolve();
12424
- return new Promise((resolve7) => {
12608
+ return new Promise((resolve8) => {
12425
12609
  const onAbort = () => {
12426
12610
  signal.removeEventListener("abort", onAbort);
12427
- resolve7();
12611
+ resolve8();
12428
12612
  };
12429
12613
  signal.addEventListener("abort", onAbort, { once: true });
12430
12614
  void releaseGate.then(() => {
12431
12615
  signal.removeEventListener("abort", onAbort);
12432
- resolve7();
12616
+ resolve8();
12433
12617
  });
12434
12618
  });
12435
12619
  };
@@ -12923,12 +13107,12 @@ function describeInstaboxBridgeUnavailable(bridge) {
12923
13107
  // packages/cli/client/localInstaboxWorkspaceRecovery.ts
12924
13108
  import { constants as constants3 } from "node:fs";
12925
13109
  import { open as open2 } from "node:fs/promises";
12926
- import { createHash as createHash5, randomUUID as randomUUID4 } from "node:crypto";
13110
+ import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
12927
13111
 
12928
13112
  // packages/agent-runtime/artifactStore.ts
12929
- import { createHash as createHash4, createHmac } from "node:crypto";
13113
+ import { createHash as createHash5, createHmac } from "node:crypto";
12930
13114
  import { mkdir, readFile, unlink, writeFile } from "node:fs/promises";
12931
- import { dirname as dirname3, resolve as resolve6, sep } from "node:path";
13115
+ import { dirname as dirname5, resolve as resolve7, sep as sep2 } from "node:path";
12932
13116
  var ArtifactStoreError = class extends Error {
12933
13117
  code;
12934
13118
  key;
@@ -12978,12 +13162,12 @@ function isNotFoundError(error) {
12978
13162
  return error?.code === "ENOENT";
12979
13163
  }
12980
13164
  function createLocalArtifactStore(options) {
12981
- const root = resolve6(options.rootDir);
13165
+ const root = resolve7(options.rootDir);
12982
13166
  const now = options.now ?? Date.now;
12983
13167
  const pathFor = (key) => {
12984
13168
  assertArtifactKey(key);
12985
- const target = resolve6(root, key);
12986
- if (target !== root && !target.startsWith(`${root}${sep}`)) {
13169
+ const target = resolve7(root, key);
13170
+ if (target !== root && !target.startsWith(`${root}${sep2}`)) {
12987
13171
  throw new ArtifactStoreError(
12988
13172
  "invalid_key",
12989
13173
  `artifact key \u89E3\u6790\u540E\u8D8A\u51FA rootDir\uFF1A${describeKey(key)}`,
@@ -12997,7 +13181,7 @@ function createLocalArtifactStore(options) {
12997
13181
  const bytes = toBytes(data);
12998
13182
  const target = pathFor(key);
12999
13183
  try {
13000
- await mkdir(dirname3(target), { recursive: true });
13184
+ await mkdir(dirname5(target), { recursive: true });
13001
13185
  await writeFile(target, bytes);
13002
13186
  } catch (error) {
13003
13187
  if (error instanceof ArtifactStoreError) throw error;
@@ -13053,12 +13237,12 @@ function createLocalArtifactStore(options) {
13053
13237
  };
13054
13238
  }
13055
13239
  function sha256Hex2(data) {
13056
- return createHash4("sha256").update(data).digest("hex");
13240
+ return createHash5("sha256").update(data).digest("hex");
13057
13241
  }
13058
13242
  var EMPTY_SHA256 = sha256Hex2("");
13059
13243
 
13060
13244
  // packages/cli/client/localInstaboxWorkspaceRecovery.ts
13061
- var sha = (b) => createHash5("sha256").update(b).digest("hex");
13245
+ var sha = (b) => createHash6("sha256").update(b).digest("hex");
13062
13246
  function fail4(code) {
13063
13247
  throw Object.assign(new Error(`instabox_workspace_recovery:${code}; cleanup_pending`), { code: "instabox_cleanup_pending", cleanupPending: true });
13064
13248
  }
@@ -13563,8 +13747,8 @@ async function createLocalInstaboxWorkload(args) {
13563
13747
  }
13564
13748
 
13565
13749
  // packages/cli/client/localRunArtifactExport.ts
13566
- import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "node:fs";
13567
- import { dirname as dirname4, join as join6 } from "node:path";
13750
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
13751
+ import { dirname as dirname6, join as join7 } from "node:path";
13568
13752
 
13569
13753
  // packages/agent-runtime/runArtifactExport.ts
13570
13754
  var RUN_DIFF_COMMAND = "git add -A && git diff --cached --binary";
@@ -13772,13 +13956,13 @@ function serializeRunArtifactAudit(record) {
13772
13956
  // packages/cli/client/localRunArtifactExport.ts
13773
13957
  function resolveRunArtifactsRootDir(runsDir) {
13774
13958
  const normalized = runsDir.replace(/[/\\]+$/, "");
13775
- return join6(dirname4(normalized || runsDir), "artifacts");
13959
+ return join7(dirname6(normalized || runsDir), "artifacts");
13776
13960
  }
13777
13961
  function writeRunArtifactAudit(args) {
13778
- const fs = args.fs ?? { mkdirSync: mkdirSync2, writeFileSync: writeFileSync3 };
13779
- const path = join6(args.runsDir, `${args.record.runId}.artifacts.json`);
13780
- fs.mkdirSync?.(args.runsDir, { recursive: true });
13781
- fs.writeFileSync(path, serializeRunArtifactAudit(args.record));
13962
+ const fs2 = args.fs ?? { mkdirSync: mkdirSync3, writeFileSync: writeFileSync3 };
13963
+ const path = join7(args.runsDir, `${args.record.runId}.artifacts.json`);
13964
+ fs2.mkdirSync?.(args.runsDir, { recursive: true });
13965
+ fs2.writeFileSync(path, serializeRunArtifactAudit(args.record));
13782
13966
  return path;
13783
13967
  }
13784
13968
  function createDockerRunTerminalExport(args) {
@@ -14128,9 +14312,9 @@ function buildTokenDialogIndexOps(args) {
14128
14312
 
14129
14313
  // packages/cli/client/localRuntimeDialog.ts
14130
14314
  var import_format = __toESM(require_format(), 1);
14131
- import { appendFileSync, mkdirSync as mkdirSync3 } from "fs";
14132
- import { homedir } from "os";
14133
- import { join as join7 } from "path";
14315
+ import { appendFileSync, mkdirSync as mkdirSync4 } from "fs";
14316
+ import { homedir as homedir2 } from "os";
14317
+ import { join as join8 } from "path";
14134
14318
 
14135
14319
  // packages/cli/client/cliCompletedTurnCapture.ts
14136
14320
  async function readCliCaptureSources(args) {
@@ -14250,11 +14434,11 @@ function projectRawUsage(usage) {
14250
14434
  function debugCaptureRawUsage(item) {
14251
14435
  if (!process.env.NOLO_DEBUG_RAW_USAGE) return;
14252
14436
  try {
14253
- const noloHome = process.env.NOLO_HOME?.trim() || join7(homedir(), ".nolo");
14254
- const dir = join7(noloHome, "logs");
14255
- mkdirSync3(dir, { recursive: true });
14437
+ const noloHome = process.env.NOLO_HOME?.trim() || join8(homedir2(), ".nolo");
14438
+ const dir = join8(noloHome, "logs");
14439
+ mkdirSync4(dir, { recursive: true });
14256
14440
  appendFileSync(
14257
- join7(dir, "raw-usage.jsonl"),
14441
+ join8(dir, "raw-usage.jsonl"),
14258
14442
  JSON.stringify({
14259
14443
  ts: Date.now(),
14260
14444
  model: item.model,
@@ -15159,15 +15343,15 @@ function createCliLocalRuntimeAdapter(deps) {
15159
15343
  const runId = asOptionalTrimmedString(deps.env?.NOLO_AGENT_RUN_ID) ?? "interactive";
15160
15344
  emitRunIsolationNotice(fact, { runId });
15161
15345
  try {
15162
- const { writeFileSync: writeFileSync4, mkdirSync: mkdirSync4 } = await import("node:fs");
15163
- const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-CO6BASZF.js");
15346
+ const { writeFileSync: writeFileSync4, mkdirSync: mkdirSync5 } = await import("node:fs");
15347
+ const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-CVCHDDDC.js");
15164
15348
  recordLocalRunExecutionIsolation({
15165
15349
  runId,
15166
15350
  runsDir: resolveRunsDir2(deps.env),
15167
15351
  fact,
15168
15352
  fs: {
15169
15353
  writeFileSync: (path, data) => writeFileSync4(path, data),
15170
- mkdirSync: (path, options) => mkdirSync4(path, options)
15354
+ mkdirSync: (path, options) => mkdirSync5(path, options)
15171
15355
  }
15172
15356
  });
15173
15357
  getLogger("cli.localRuntimeAdapter").info(
@@ -15185,7 +15369,7 @@ function createCliLocalRuntimeAdapter(deps) {
15185
15369
  dockerWorkloadReleased = true;
15186
15370
  dockerWorkloadLoad = null;
15187
15371
  if (loaded) {
15188
- const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-CO6BASZF.js");
15372
+ const { resolveRunsDir: resolveRunsDir2 } = await import("./agentRunControl-CVCHDDDC.js");
15189
15373
  const exportRunDiff = deps.exportDockerRunDiffArtifact ?? exportDockerRunDiffArtifact;
15190
15374
  const warn = (message) => process.stderr.write(`[nolo] ${message}
15191
15375
  `);
@@ -15285,6 +15469,10 @@ function createCliLocalRuntimeAdapter(deps) {
15285
15469
  readXPost: deps.readXPost,
15286
15470
  readXhsProfile: deps.readXhsProfile,
15287
15471
  cliEntrypoint: CLI_ENTRYPOINT,
15472
+ // 本地进程内直连:readDialog / listDialogs 走已在手的共享 store
15473
+ // (local-first,未命中才远端回退),不再 spawn `nolo` 子进程 + 试探
15474
+ // 多个 HTTP 端点;本地答不了时 executor 内部自行回退 CLI 桥。
15475
+ resolveDialogStore: () => getOrCreateSharedStore(deps),
15288
15476
  resolveAgentCredentialGroup,
15289
15477
  resolveAgentDisplayName,
15290
15478
  // α:spawn 前从 agent 配置回读真实 name(resolveAgentRunName 的读取来源)。