nolo-cli 0.107.0-alpha.4 → 0.107.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 (211) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-UDCSOTD2.js → _executeModel-M573MKVE.js} +78 -70
  3. package/action-GVA5ARSJ.js +20 -0
  4. package/{addContentAction-MB2HHMDZ.js → addContentAction-M2WOWZCL.js} +13 -12
  5. package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-QMAQ5Z6N.js} +19 -20
  6. package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-ZFHYRHBS.js} +118 -43
  7. package/{agentEmailCommands-AU5I4M4W.js → agentEmailCommands-X6AVPIVQ.js} +100 -90
  8. package/agentListCommands-PAD2CI2I.js +741 -0
  9. package/{agentMachineCommands-YMNME2L6.js → agentMachineCommands-UPH6RJCC.js} +50 -46
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-CMVTBY5X.js} +97 -2
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-UMACPRAF.js +138 -0
  13. package/agentRunCommand-H6KKHHMU.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-N4YGKL7M.js} +44 -40
  16. package/{agentSlice-R7PR6KYM.js → agentSlice-2LPP43XH.js} +15 -14
  17. package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-7DAF33AM.js} +46 -42
  18. package/{appDeployCommands-UTB76XFM.js → appDeployCommands-ZPZSMFGZ.js} +46 -42
  19. package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-FWBDSSS5.js} +46 -42
  20. package/{appGetCommands-PX2BFHOB.js → appGetCommands-SZZOHGEP.js} +46 -42
  21. package/{appListCommands-BSMPTWKC.js → appListCommands-FPMUBDPM.js} +46 -42
  22. package/{authCommand-YW42YZA4.js → authCommand-VL3G26NQ.js} +119 -25
  23. package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZK4K67Y5.js} +11 -9
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
  27. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  28. package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
  29. package/{chunk-QTGQ2LTL.js → chunk-3DQY5IFB.js} +6 -10
  30. package/{chunk-XT35TTFG.js → chunk-3IXAHOJS.js} +19 -21
  31. package/{chunk-UVA7OYO3.js → chunk-3W67RV75.js} +29 -9
  32. package/chunk-4LCOCOR5.js +50 -0
  33. package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
  34. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  35. package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
  36. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  37. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  38. package/{chunk-C3M4465B.js → chunk-5HYJ3DSZ.js} +404 -659
  39. package/chunk-5MMAK75Q.js +15 -0
  40. package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
  41. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  42. package/{chunk-4MK3I7Y4.js → chunk-6MAW4XOF.js} +5 -5
  43. package/{chunk-3UZPUAES.js → chunk-74PPKIY2.js} +1 -1
  44. package/chunk-76HO2DP6.js +15 -0
  45. package/{chunk-ASIFZ2WY.js → chunk-7BBP7ZX3.js} +66 -54
  46. package/{chunk-VLTIYV3X.js → chunk-7I25CBT5.js} +34 -8
  47. package/{chunk-IBOZNTG2.js → chunk-7X5XZ34C.js} +23 -28
  48. package/chunk-AGIM7IMJ.js +147 -0
  49. package/{chunk-5UTFL4QJ.js → chunk-APO5TOXO.js} +1 -1
  50. package/{chunk-EEGDMATE.js → chunk-AZOVPTL6.js} +91 -81
  51. package/{chunk-6OZ36FXI.js → chunk-BIPGGSJS.js} +22 -4
  52. package/{chunk-EYAQT56M.js → chunk-BNQMNUKZ.js} +9 -6
  53. package/{chunk-62CATUYY.js → chunk-CBUMFIFE.js} +834 -962
  54. package/{chunk-OIVSQH2O.js → chunk-CDEEFJXN.js} +308 -11
  55. package/chunk-CHOZJMJS.js +78 -0
  56. package/{chunk-ETI2NYVF.js → chunk-CIP3AAMT.js} +4 -4
  57. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  58. package/{chunk-W7HLWAQ7.js → chunk-DE45KZNH.js} +118 -90
  59. package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
  60. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  61. package/{chunk-HKNXJGEC.js → chunk-ECFHBYUW.js} +85 -50
  62. package/{chunk-ACTMNVHM.js → chunk-EHSYSKXV.js} +1 -1
  63. package/{chunk-WV42OMV7.js → chunk-ELUDRSRD.js} +8 -8
  64. package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
  65. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  66. package/{chunk-BFDFRLLQ.js → chunk-EZ4VZHAG.js} +5 -5
  67. package/{chunk-GO3Z72MT.js → chunk-FHLMQIU7.js} +65 -95
  68. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  69. package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
  70. package/chunk-GMZLP5DV.js +82 -0
  71. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  72. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  73. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  74. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  75. package/{chunk-BNGW5ASC.js → chunk-I2RGRVQ7.js} +22 -2
  76. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  77. package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
  78. package/{chunk-GQBOR3G6.js → chunk-JBKHQOYK.js} +8 -4
  79. package/{chunk-XD2MJFUG.js → chunk-JEFXP73H.js} +1 -1
  80. package/{chunk-PBA4UJBK.js → chunk-JIXGJTBU.js} +4 -4
  81. package/{chunk-AEOE4Z6Q.js → chunk-K6L5PNXK.js} +39 -15
  82. package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
  83. package/{chunk-GPCZ7UXG.js → chunk-KD6D6BLA.js} +1 -1
  84. package/{chunk-4CR5I7BD.js → chunk-KFWDYYSS.js} +47 -67
  85. package/{chunk-UZGQNTVW.js → chunk-KHKTDMYG.js} +8 -6
  86. package/{chunk-JDPFV2JV.js → chunk-KWUKOQM2.js} +20 -11
  87. package/{chunk-MRIHM22T.js → chunk-LBFL6RZG.js} +58 -9
  88. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  89. package/{chunk-DHDMC6FO.js → chunk-LUBFABMJ.js} +15 -14
  90. package/{chunk-NA35QHCF.js → chunk-LVBFKW65.js} +1 -1
  91. package/chunk-LWLNLZC5.js +265 -0
  92. package/chunk-N4NGJDT6.js +929 -0
  93. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  94. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  95. package/chunk-NWENLDMM.js +42 -0
  96. package/chunk-O7SVKKLY.js +875 -0
  97. package/chunk-OCZKATRC.js +129 -0
  98. package/{chunk-6Z7MY3V7.js → chunk-OEJLGVBL.js} +5 -5
  99. package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
  100. package/{chunk-GEPUP7OO.js → chunk-OR2UWD6X.js} +3 -3
  101. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  102. package/{chunk-J4MOO56S.js → chunk-PNXHPLRU.js} +10 -2
  103. package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
  104. package/{chunk-P5EVSOPA.js → chunk-R6EBQEQE.js} +22 -29
  105. package/chunk-RQ6CTX2E.js +164 -0
  106. package/{chunk-MS7TSPZR.js → chunk-RU36ZYSG.js} +19 -17
  107. package/{chunk-ALXHV7NK.js → chunk-RWXLPUKI.js} +40 -4
  108. package/{chunk-KQ4ONNQD.js → chunk-RXA3HAVW.js} +190 -8
  109. package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
  110. package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
  111. package/{chunk-JRQFUXY7.js → chunk-TBAXFWOS.js} +99 -22
  112. package/{chunk-PQFHGD77.js → chunk-TBM2RS3U.js} +161 -14
  113. package/{chunk-NOF3HDSN.js → chunk-TFOIJFCM.js} +11 -9
  114. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  115. package/chunk-TY3TIUJK.js +89 -0
  116. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  117. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  118. package/chunk-UM7TA3K4.js +1008 -0
  119. package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
  120. package/{chunk-GL3EHUR4.js → chunk-VHGYUYQ3.js} +69 -47
  121. package/chunk-VIWDGTDA.js +8 -0
  122. package/chunk-VJVNU77E.js +83 -0
  123. package/chunk-VM6IE2GN.js +8004 -0
  124. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  125. package/chunk-VZLO4XJD.js +17 -0
  126. package/chunk-W32HPLTL.js +13692 -0
  127. package/{chunk-AHAHBQMU.js → chunk-WDLSZMTA.js} +2 -2
  128. package/{chunk-53HEEOTT.js → chunk-WF5X57VW.js} +83 -16
  129. package/{chunk-VRTTFDBM.js → chunk-WPHY3VPF.js} +35 -22
  130. package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
  131. package/chunk-YV25TM3R.js +780 -0
  132. package/chunk-ZRAU6T47.js +56 -0
  133. package/{chunk-IBOOZVVD.js → chunk-ZTKZZY2A.js} +851 -279
  134. package/commandRegistry-ASW6IVZ3.js +833 -0
  135. package/{contentThunks-IV2T3EJC.js → contentThunks-4XNVOIR7.js} +39 -36
  136. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  137. package/{createAgentAutomationAction-JCOIEYY4.js → createAgentAutomationAction-NHHTCJMC.js} +40 -37
  138. package/createDialogAction-XEBTHDB3.js +70 -0
  139. package/{createPageAction-D2VOOLP3.js → createPageAction-VR3WW2AQ.js} +47 -43
  140. package/{chunk-FG3HKPQP.js → cursorProvider-YGGNMVWX.js} +2751 -10185
  141. package/{dbSlice-A6C6H32X.js → dbSlice-TG4MZ5EB.js} +12 -11
  142. package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
  143. package/{dialogCommands-H7FPUYUQ.js → dialogCommands-FJWQG3MX.js} +50 -47
  144. package/{dialogSlice-6JZOOTDS.js → dialogSlice-GVRDGCRG.js} +57 -37
  145. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  146. package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-AZSK4NAG.js} +48 -44
  147. package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-DDJMSMFZ.js} +49 -45
  148. package/{docReadCommands-WJN3WT6O.js → docReadCommands-5F5Q6EBZ.js} +47 -43
  149. package/{docStore-HUPQ2FSS.js → docStore-SUZUUWDI.js} +17 -13
  150. package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-XPNPVZOC.js} +48 -44
  151. package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
  152. package/{getPricing-LUSEABA6.js → getPricing-DOBBZLOK.js} +4 -4
  153. package/{handleSendMessageAction-DFPMQ7YM.js → handleSendMessageAction-VC6VTFKS.js} +109 -42
  154. package/index.js +87 -884
  155. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  156. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
  157. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  158. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  159. package/{machineCommands-M2T2I5NF.js → machineCommands-M634V2L3.js} +98 -89
  160. package/machineWsRunDispatch-Z3HUSTFI.js +154 -0
  161. package/{memberThunks-P2ECUJ56.js → memberThunks-5S5D3N4U.js} +20 -18
  162. package/{models-T3SG6MJ5.js → models-PQU25T6Q.js} +2 -2
  163. package/oauthTokenStore-ITEB663N.js +23 -0
  164. package/package.json +1 -1
  165. package/processSpawn-SOAV3FEV.js +11 -0
  166. package/profileConfig-ZGOFORWV.js +43 -0
  167. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-HAQWVAQX.js} +7 -7
  168. package/{providerRegistry-757OWH3O.js → providerRegistry-5FGWB3X5.js} +11 -7
  169. package/{read-COE3ZYR6.js → read-LSYFLSIM.js} +8 -7
  170. package/{readDocTool-5USN4A6V.js → readDocTool-XWRXV3DR.js} +5 -3
  171. package/{readlineWorkspace-XQRDGWRZ.js → readlineWorkspace-J3YD3DNW.js} +2596 -2032
  172. package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-4TEFC3VL.js} +22 -26
  173. package/{runAgentClientLoop-5ZA62FBA.js → runAgentClientLoop-APSMCLAF.js} +79 -72
  174. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  175. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  176. package/{setDialogExtraReferencesAction-WX5VTY6O.js → setDialogExtraReferencesAction-LSEN44OY.js} +16 -14
  177. package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-SR366X5A.js} +23 -27
  178. package/{chunk-GP5LKBUZ.js → settingThunks-CTVPPGIN.js} +226 -940
  179. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  180. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  181. package/{spaceCommands-5GLCWZPO.js → spaceCommands-3UK63WPE.js} +51 -47
  182. package/{streamAgentChatTurn-6UZJMYRB.js → streamAgentChatTurn-DNY2PSRW.js} +215 -115
  183. package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-M6NAFOOU.js} +19 -20
  184. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  185. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-AD7CXTA4.js} +4 -3
  186. package/tools-X5UWATZK.js +117 -0
  187. package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-DEH7ZEM6.js} +25 -23
  188. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  189. package/{updateDialogTitleAction-QTKNIURB.js → updateDialogTitleAction-YSY5BF5A.js} +84 -45
  190. package/action-P4TNFGAD.js +0 -31
  191. package/agentListCommands-B2V4YAC4.js +0 -410
  192. package/agentRecordCommands-G4KK4R7H.js +0 -128
  193. package/agentRunCommand-UTZJA23G.js +0 -156
  194. package/browser-image-compression-MFDTD7K6.js +0 -1763
  195. package/chatQueueReduxAdapter-2P6NFX64.js +0 -186
  196. package/chunk-CQ3WA2NE.js +0 -299
  197. package/chunk-M76ECQRD.js +0 -13658
  198. package/chunk-MEYIRKDN.js +0 -8967
  199. package/chunk-PUOC4YRO.js +0 -394
  200. package/chunk-Q5FJJ6XI.js +0 -103
  201. package/chunk-S7Z2HMCN.js +0 -25
  202. package/chunk-T75QD6AB.js +0 -20923
  203. package/chunk-Y5GCAMGP.js +0 -9
  204. package/chunk-YPREESF4.js +0 -225
  205. package/createDialogAction-NGG7YVNU.js +0 -65
  206. package/machineWsRunDispatch-ISBKOOD7.js +0 -144
  207. package/settingSlice-P4ZW7K5X.js +0 -204
  208. package/syncMapping-N6RGXGBW.js +0 -437
  209. package/tools-KMGFWO43.js +0 -110
  210. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  211. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -10,6 +10,114 @@ var GLOBAL_DIALOG_RUNTIME_KEY = "__global__";
10
10
 
11
11
  // packages/chat/dialog/dialogRuntimeStore.ts
12
12
  var import_react = __toESM(require_react());
13
+
14
+ // packages/app/utils/localStorageState.ts
15
+ function readStorageJSON(key) {
16
+ if (typeof window === "undefined") return null;
17
+ try {
18
+ const raw = window.localStorage.getItem(key);
19
+ if (!raw) return null;
20
+ return JSON.parse(raw);
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ function writeStorageJSON(key, value) {
26
+ if (typeof window === "undefined") return;
27
+ try {
28
+ window.localStorage.setItem(key, JSON.stringify(value));
29
+ } catch {
30
+ }
31
+ }
32
+
33
+ // packages/chat/dialog/mediaJobPendingPersistence.ts
34
+ var MEDIA_JOB_PENDING_STORAGE_KEY = "nolo:chat:media-job-pending:v1";
35
+ var MEDIA_JOB_PENDING_KEEP_PER_DIALOG = 10;
36
+ var currentActorId = null;
37
+ function setMediaJobPendingActor(actorId) {
38
+ currentActorId = actorId && actorId.length > 0 ? actorId : null;
39
+ }
40
+ function getMediaJobPendingActor() {
41
+ return currentActorId;
42
+ }
43
+ var actorKey = () => `@${currentActorId ?? "anon"}`;
44
+ var bucketKeyOf = (dialogKey) => dialogKey ?? GLOBAL_DIALOG_RUNTIME_KEY;
45
+ var isEntry = (value) => {
46
+ if (!value || typeof value !== "object") return false;
47
+ const entry = value;
48
+ return typeof entry.id === "string" && entry.id.length > 0 && typeof entry.name === "string";
49
+ };
50
+ var readAllActors = () => {
51
+ const raw = readStorageJSON(MEDIA_JOB_PENDING_STORAGE_KEY);
52
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
53
+ return raw;
54
+ };
55
+ var writeActorMap = (map) => {
56
+ const all = readAllActors();
57
+ all[actorKey()] = map;
58
+ writeStorageJSON(MEDIA_JOB_PENDING_STORAGE_KEY, all);
59
+ };
60
+ function readMediaJobPendingMap() {
61
+ const scoped = readAllActors()[actorKey()];
62
+ if (!scoped || typeof scoped !== "object" || Array.isArray(scoped)) return {};
63
+ const map = {};
64
+ for (const [dialogKey, entries] of Object.entries(scoped)) {
65
+ if (!Array.isArray(entries)) continue;
66
+ const valid = entries.filter(isEntry).map((entry) => ({
67
+ id: entry.id,
68
+ name: entry.name,
69
+ fileKey: typeof entry.fileKey === "string" ? entry.fileKey : void 0,
70
+ mimeType: typeof entry.mimeType === "string" ? entry.mimeType : void 0,
71
+ size: typeof entry.size === "number" ? entry.size : void 0,
72
+ durationSec: typeof entry.durationSec === "number" ? entry.durationSec : void 0,
73
+ savedAt: typeof entry.savedAt === "number" && Number.isFinite(entry.savedAt) ? entry.savedAt : 0
74
+ }));
75
+ if (valid.length) map[dialogKey] = valid;
76
+ }
77
+ return map;
78
+ }
79
+ function upsertMediaJobPendingEntry(entry) {
80
+ const map = readMediaJobPendingMap();
81
+ const dialogKey = bucketKeyOf(entry.dialogKey);
82
+ const kept = (map[dialogKey] ?? []).filter((item) => item.id !== entry.id);
83
+ kept.push({ ...entry, savedAt: Date.now() });
84
+ map[dialogKey] = kept.slice(-MEDIA_JOB_PENDING_KEEP_PER_DIALOG);
85
+ writeActorMap(map);
86
+ }
87
+ function removeMediaJobPendingEntryById(id) {
88
+ const map = readMediaJobPendingMap();
89
+ let changed = false;
90
+ for (const [dialogKey, entries] of Object.entries(map)) {
91
+ const kept = entries.filter((entry) => entry.id !== id);
92
+ if (kept.length !== entries.length) {
93
+ changed = true;
94
+ if (kept.length) map[dialogKey] = kept;
95
+ else delete map[dialogKey];
96
+ }
97
+ }
98
+ if (changed) writeActorMap(map);
99
+ }
100
+ function clearMediaJobPendingEntries(payload) {
101
+ if (payload?.all) {
102
+ writeStorageJSON(MEDIA_JOB_PENDING_STORAGE_KEY, {});
103
+ return;
104
+ }
105
+ const dialogKey = bucketKeyOf(payload?.dialogKey);
106
+ const map = readMediaJobPendingMap();
107
+ if (!(dialogKey in map)) return;
108
+ delete map[dialogKey];
109
+ writeActorMap(map);
110
+ }
111
+ function pruneMediaJobPendingEntries(dialogKey, keep = MEDIA_JOB_PENDING_KEEP_PER_DIALOG) {
112
+ const key = bucketKeyOf(dialogKey);
113
+ const map = readMediaJobPendingMap();
114
+ const entries = map[key];
115
+ if (!entries || entries.length <= keep) return;
116
+ map[key] = entries.slice(-keep);
117
+ writeActorMap(map);
118
+ }
119
+
120
+ // packages/chat/dialog/dialogRuntimeStore.ts
13
121
  var createEmptyTokenStats = () => ({
14
122
  inputTokens: 0,
15
123
  outputTokens: 0,
@@ -21,7 +129,10 @@ var createEmptyDialogRuntimeState = () => ({
21
129
  activeControllers: {},
22
130
  pendingRawData: {},
23
131
  loopStopReason: null,
24
- pendingUserInputQueue: []
132
+ turnPhase: null,
133
+ turnPhaseTurnId: null,
134
+ pendingUserInputQueue: [],
135
+ recoveredForegroundTurn: null
25
136
  });
26
137
  var activeDialogKey = null;
27
138
  var configError = null;
@@ -67,6 +178,8 @@ function resetDialogRuntimeSessionState(dialogKey) {
67
178
  const runtime = ensureDialogRuntimeState(dialogKey);
68
179
  runtime.tokens = createEmptyTokenStats();
69
180
  runtime.loopStopReason = null;
181
+ runtime.turnPhase = null;
182
+ runtime.turnPhaseTurnId = null;
70
183
  runtime.pendingUserInputQueue = [];
71
184
  notify();
72
185
  }
@@ -74,21 +187,49 @@ function addPendingFile(payload) {
74
187
  const targetRuntimeKey = payload.targetDialogKey ?? payload.runtimeDialogKey ?? (payload.type === "dialog" ? activeDialogKey : payload.dialogKey);
75
188
  const runtime = ensureDialogRuntimeState(targetRuntimeKey);
76
189
  if (!runtime.pendingFiles.some((f) => f.id === payload.id)) {
77
- runtime.pendingFiles.push(payload);
190
+ runtime.pendingFiles = [...runtime.pendingFiles, payload];
191
+ if (payload.type === "media_job") {
192
+ upsertMediaJobPendingEntry({
193
+ id: payload.id,
194
+ name: payload.name,
195
+ fileKey: payload.fileKey,
196
+ mimeType: payload.mimeType,
197
+ size: payload.size,
198
+ durationSec: payload.durationSec,
199
+ // 与写入侧 bucket 推导严格同源:`dialogKey || GLOBAL_DIALOG_RUNTIME_KEY`
200
+ // (useMessageInputFiles 的 effectiveDialogKey 同规则)。不依赖
201
+ // activeDialogKey 隐式回退,保证恢复时读到的就是当初写入的 bucket。
202
+ dialogKey: payload.dialogKey ?? GLOBAL_DIALOG_RUNTIME_KEY
203
+ });
204
+ }
78
205
  notify();
79
206
  }
80
207
  return action("dialogRuntime/addPendingFile", payload);
81
208
  }
82
209
  function removePendingFile(fileId) {
83
210
  const runtime = ensureDialogRuntimeState();
84
- const fileToRemove = runtime.pendingFiles.find((f) => f.id === fileId);
211
+ let fileToRemove = runtime.pendingFiles.find((f) => f.id === fileId);
212
+ let runtimeHoldingFile = runtime;
213
+ if (!fileToRemove) {
214
+ for (const candidate of Object.values(runtimeByKey)) {
215
+ const found = candidate.pendingFiles.find((f) => f.id === fileId);
216
+ if (found) {
217
+ fileToRemove = found;
218
+ runtimeHoldingFile = candidate;
219
+ break;
220
+ }
221
+ }
222
+ }
85
223
  if (fileToRemove) {
86
224
  if (fileToRemove.pageKey) {
87
- delete runtime.pendingRawData[fileToRemove.pageKey];
225
+ delete runtimeHoldingFile.pendingRawData[fileToRemove.pageKey];
88
226
  }
89
- runtime.pendingFiles = runtime.pendingFiles.filter(
227
+ runtimeHoldingFile.pendingFiles = runtimeHoldingFile.pendingFiles.filter(
90
228
  (file) => file.id !== fileId
91
229
  );
230
+ if (fileToRemove.type === "media_job") {
231
+ removeMediaJobPendingEntryById(fileToRemove.id);
232
+ }
92
233
  notify();
93
234
  }
94
235
  return action("dialogRuntime/removePendingFile", fileId);
@@ -99,10 +240,14 @@ function clearPendingAttachments(payload) {
99
240
  runtime2.pendingFiles = [];
100
241
  runtime2.pendingRawData = {};
101
242
  });
243
+ clearMediaJobPendingEntries({ all: true });
102
244
  notify();
103
245
  return action("dialogRuntime/clearPendingAttachments", payload);
104
246
  }
105
247
  const runtime = ensureDialogRuntimeState(payload?.dialogKey);
248
+ runtime.pendingFiles.forEach((file) => {
249
+ if (file.type === "media_job") removeMediaJobPendingEntryById(file.id);
250
+ });
106
251
  runtime.pendingFiles = [];
107
252
  runtime.pendingRawData = {};
108
253
  notify();
@@ -114,11 +259,89 @@ function setLoopStopReason(payload) {
114
259
  notify();
115
260
  return action("dialogRuntime/setLoopStopReason", payload);
116
261
  }
262
+ function setRecoveredForegroundTurn(payload) {
263
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
264
+ runtime.recoveredForegroundTurn = payload.status;
265
+ notify();
266
+ return action("dialogRuntime/setRecoveredForegroundTurn", payload);
267
+ }
268
+ function claimDialogTurnPhase(payload) {
269
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
270
+ runtime.turnPhaseTurnId = payload.turnId;
271
+ runtime.turnPhase = null;
272
+ notify();
273
+ return action("dialogRuntime/claimDialogTurnPhase", payload);
274
+ }
275
+ function setDialogTurnPhase(payload) {
276
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
277
+ if (typeof payload.turnId === "string" && runtime.turnPhaseTurnId !== null && runtime.turnPhaseTurnId !== payload.turnId) {
278
+ return action("dialogRuntime/setDialogTurnPhase:rejected", payload);
279
+ }
280
+ runtime.turnPhase = payload.phase;
281
+ runtime.turnPhaseTurnId = payload.phase === null ? null : payload.turnId ?? null;
282
+ notify();
283
+ return action("dialogRuntime/setDialogTurnPhase", payload);
284
+ }
285
+ function clearDialogTurnPhase(payload = {}) {
286
+ return setDialogTurnPhase({ phase: null, dialogKey: payload.dialogKey, turnId: payload.turnId });
287
+ }
117
288
  function clearDialogRuntimeState(payload) {
289
+ const runtime = runtimeByKey[payload.dialogKey];
290
+ runtime?.pendingFiles.forEach((file) => {
291
+ if (file.type === "media_job") removeMediaJobPendingEntryById(file.id);
292
+ });
118
293
  delete runtimeByKey[payload.dialogKey];
119
294
  notify();
120
295
  return action("dialogRuntime/clearDialogRuntimeState", payload);
121
296
  }
297
+ function restoreMediaJobPendingFiles(dialogKey) {
298
+ const runtimeKey = resolveDialogRuntimeKey(dialogKey);
299
+ const entries = (readMediaJobPendingMap()[runtimeKey] ?? []).slice(-MEDIA_JOB_PENDING_KEEP_PER_DIALOG);
300
+ if (!entries.length) return 0;
301
+ const runtime = ensureDialogRuntimeState(runtimeKey);
302
+ const existingIds = new Set(runtime.pendingFiles.map((file) => file.id));
303
+ let restored = 0;
304
+ for (const entry of entries) {
305
+ if (existingIds.has(entry.id)) continue;
306
+ addPendingFile({
307
+ id: entry.id,
308
+ name: entry.name,
309
+ type: "media_job",
310
+ fileKey: entry.fileKey,
311
+ mimeType: entry.mimeType,
312
+ size: entry.size,
313
+ durationSec: entry.durationSec,
314
+ trackingId: entry.id,
315
+ dialogKey: runtimeKey
316
+ });
317
+ restored += 1;
318
+ }
319
+ pruneMediaJobPendingEntries(runtimeKey);
320
+ return restored;
321
+ }
322
+ var MEDIA_NOTE_PAGE_KEY_PREFIX = "media-note:";
323
+ var isMediaNotePageReference = (pageKey) => typeof pageKey === "string" && pageKey.startsWith(MEDIA_NOTE_PAGE_KEY_PREFIX);
324
+ var getMediaJobRuntimeActor = () => getMediaJobPendingActor();
325
+ function setMediaJobRuntimeActor(actorId) {
326
+ const next = actorId && actorId.length ? actorId : null;
327
+ if (getMediaJobPendingActor() === next) return;
328
+ setMediaJobPendingActor(next);
329
+ for (const key of Object.keys(runtimeByKey)) {
330
+ const runtime = runtimeByKey[key];
331
+ const kept = runtime.pendingFiles.filter(
332
+ (f) => f.type !== "media_job" && !isMediaNotePageReference(f.pageKey)
333
+ );
334
+ if (kept.length !== runtime.pendingFiles.length) {
335
+ runtime.pendingFiles = kept;
336
+ }
337
+ for (const pageKey of Object.keys(runtime.pendingRawData)) {
338
+ if (isMediaNotePageReference(pageKey)) {
339
+ delete runtime.pendingRawData[pageKey];
340
+ }
341
+ }
342
+ }
343
+ notify();
344
+ }
122
345
  function addActiveController(payload) {
123
346
  const runtime = ensureDialogRuntimeState(payload.dialogKey);
124
347
  runtime.activeControllers[payload.messageId] = payload.controller;
@@ -181,7 +404,7 @@ function tokenUsageLiveUpdate(payload) {
181
404
  }
182
405
  function addPageReferenceToRuntime(payload) {
183
406
  const runtime = ensureDialogRuntimeState(payload.dialogKey);
184
- runtime.pendingFiles.push(payload.reference);
407
+ runtime.pendingFiles = [...runtime.pendingFiles, payload.reference];
185
408
  if (payload.rawData?.pageKey) {
186
409
  runtime.pendingRawData[payload.rawData.pageKey] = payload.rawData;
187
410
  }
@@ -258,6 +481,12 @@ function getPendingUserInputQueue(dialogKey) {
258
481
  function getLoopStopReason(dialogKey) {
259
482
  return getDialogRuntimeState(dialogKey).loopStopReason;
260
483
  }
484
+ function getDialogTurnPhase(dialogKey) {
485
+ return getDialogRuntimeState(dialogKey).turnPhase;
486
+ }
487
+ function getRecoveredForegroundTurn(dialogKey) {
488
+ return getDialogRuntimeState(dialogKey).recoveredForegroundTurn;
489
+ }
261
490
  var selectDialogRuntimeByKey = (_state, dialogKey) => getDialogRuntimeState(dialogKey);
262
491
  var selectPendingFiles = (_state, dialogKey) => getPendingFiles(dialogKey);
263
492
  var selectActiveControllers = (_state, dialogKey) => getActiveControllers(dialogKey);
@@ -293,6 +522,14 @@ function useLoopStopReason(dialogKey) {
293
522
  (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
294
523
  return getLoopStopReason(dialogKey);
295
524
  }
525
+ function useDialogTurnPhase(dialogKey) {
526
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
527
+ return getDialogTurnPhase(dialogKey);
528
+ }
529
+ function useRecoveredForegroundTurn(dialogKey) {
530
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
531
+ return getRecoveredForegroundTurn(dialogKey);
532
+ }
296
533
  function useDialogRuntimeTokens(dialogKey) {
297
534
  (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
298
535
  return getDialogRuntimeTokens(dialogKey);
@@ -316,7 +553,14 @@ export {
316
553
  removePendingFile,
317
554
  clearPendingAttachments,
318
555
  setLoopStopReason,
556
+ setRecoveredForegroundTurn,
557
+ claimDialogTurnPhase,
558
+ setDialogTurnPhase,
559
+ clearDialogTurnPhase,
319
560
  clearDialogRuntimeState,
561
+ restoreMediaJobPendingFiles,
562
+ getMediaJobRuntimeActor,
563
+ setMediaJobRuntimeActor,
320
564
  addActiveController,
321
565
  removeActiveController,
322
566
  clearActiveControllers,
@@ -330,8 +574,7 @@ export {
330
574
  deleteDialogRuntime,
331
575
  abortActiveControllers,
332
576
  getDialogRuntimeTokens,
333
- getPendingUserInputQueue,
334
- getLoopStopReason,
577
+ getRecoveredForegroundTurn,
335
578
  selectDialogRuntimeByKey,
336
579
  selectPendingFiles,
337
580
  selectActiveControllers,
@@ -346,6 +589,8 @@ export {
346
589
  useActiveControllers,
347
590
  usePendingUserInputQueue,
348
591
  useLoopStopReason,
592
+ useDialogTurnPhase,
593
+ useRecoveredForegroundTurn,
349
594
  useDialogRuntimeTokens,
350
595
  useCurrentDialogKey,
351
596
  useDialogConfigError
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-C3M4465B.js";
10
+ } from "./chunk-5HYJ3DSZ.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -16,106 +16,108 @@ import {
16
16
  isCoreDrainingBody,
17
17
  normalizeNonNegativeMs,
18
18
  parseRetryAfterHeaderMs
19
- } from "./chunk-3L2WKC3W.js";
19
+ } from "./chunk-XPWGOTBQ.js";
20
20
  import {
21
+ resolvePageReadMarkdown,
21
22
  slateToSimplifiedMarkdown
22
- } from "./chunk-J4MOO56S.js";
23
+ } from "./chunk-PNXHPLRU.js";
23
24
  import {
24
25
  waitForAbortableDelay
25
26
  } from "./chunk-N4G4PKQ6.js";
26
27
  import {
27
28
  extractCategorizedMentions
28
- } from "./chunk-MEYIRKDN.js";
29
+ } from "./chunk-AGIM7IMJ.js";
29
30
  import {
30
31
  fetchAndCacheMessages
31
- } from "./chunk-T75QD6AB.js";
32
+ } from "./chunk-W32HPLTL.js";
32
33
  import {
33
34
  shouldUseServerProxy
34
- } from "./chunk-YYLHWIW6.js";
35
+ } from "./chunk-UKZX3NHN.js";
35
36
  import {
36
37
  fetchServerSyncedCredential
37
- } from "./chunk-NOF3HDSN.js";
38
+ } from "./chunk-TFOIJFCM.js";
38
39
  import {
39
40
  buildSkillGuidancePromptBlock,
40
41
  extractRuntimePageCapabilities,
41
42
  resolveBuiltinSkillPage,
42
43
  resolveSkillGraphFromRoots
43
- } from "./chunk-JRQFUXY7.js";
44
+ } from "./chunk-TBAXFWOS.js";
44
45
  import {
46
+ DELETE_SAFETY_RED_LINE,
45
47
  buildIdentityBlock,
46
48
  buildRuntimeGuidanceBlocks,
47
49
  compileContextLayers,
48
50
  detectDispatchIntentFromMessages,
49
51
  normalizeChatCompletionsBodyForProvider,
50
52
  resolveToolGuidedSections
51
- } from "./chunk-MRIHM22T.js";
53
+ } from "./chunk-LBFL6RZG.js";
52
54
  import {
53
55
  convertMessagesToResponsesInput,
54
56
  getUsageRequestOptions,
55
57
  preserveAgentStateFields,
56
58
  stablePromptCacheKey
57
- } from "./chunk-PUOC4YRO.js";
59
+ } from "./chunk-UM7TA3K4.js";
60
+ import {
61
+ createFileCredentialBroker
62
+ } from "./chunk-2U3NHADM.js";
63
+ import {
64
+ estimateTokenCount
65
+ } from "./chunk-PSCNXBYA.js";
66
+ import {
67
+ createSpaceKey
68
+ } from "./chunk-UAD2WT54.js";
69
+ import {
70
+ read
71
+ } from "./chunk-WPHY3VPF.js";
72
+ import {
73
+ MEMORY_USE_GUIDANCE,
74
+ buildUserResponseLanguageContext,
75
+ wrapHistoricalSummaryWithReplayGuard
76
+ } from "./chunk-4VJAC32I.js";
77
+ import {
78
+ canonicalizeToolNames
79
+ } from "./chunk-IHPDK6UD.js";
58
80
  import {
59
81
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
60
82
  isAntigravityOAuthAgent
61
- } from "./chunk-UZGQNTVW.js";
83
+ } from "./chunk-KHKTDMYG.js";
62
84
  import {
63
85
  buildProviderAuthHeaders
64
- } from "./chunk-6OZ36FXI.js";
65
- import {
66
- estimateTokenCount
67
- } from "./chunk-PSCNXBYA.js";
86
+ } from "./chunk-BIPGGSJS.js";
68
87
  import {
69
88
  isOpenAiResponsesModel,
70
89
  resolvePlatformChatCompletionsEndpoint,
71
90
  resolvePlatformResponsesEndpoint
72
- } from "./chunk-GQBOR3G6.js";
91
+ } from "./chunk-JBKHQOYK.js";
73
92
  import {
74
93
  clampReasoningEffort,
75
94
  getModelConfig,
76
95
  isModelSupportReasoningEffort
77
- } from "./chunk-OIVSQH2O.js";
78
- import {
79
- createFileCredentialBroker
80
- } from "./chunk-HVURBGF3.js";
96
+ } from "./chunk-CDEEFJXN.js";
81
97
  import {
82
98
  toErrorMessage
83
99
  } from "./chunk-HNMXYYJR.js";
84
- import {
85
- MEMORY_USE_GUIDANCE,
86
- buildUserResponseLanguageContext,
87
- wrapHistoricalSummaryWithReplayGuard
88
- } from "./chunk-2GRGFCF6.js";
89
- import {
90
- canonicalizeToolNames
91
- } from "./chunk-O6OSWFZQ.js";
92
100
  import {
93
101
  isDeepInfraKimiModel,
94
102
  isFireworksKimiModel,
95
103
  isPlatformMimoProviderModel,
96
104
  resolveFireworksKimiModel
97
- } from "./chunk-Q67DOFOO.js";
98
- import {
99
- createSpaceKey
100
- } from "./chunk-UAD2WT54.js";
101
- import {
102
- read
103
- } from "./chunk-VRTTFDBM.js";
105
+ } from "./chunk-SZC4REES.js";
104
106
  import {
105
107
  asTrimmedLowercaseString
106
108
  } from "./chunk-QSJ3HFEF.js";
107
- import {
108
- extractCustomId
109
- } from "./chunk-M2EJHDJP.js";
110
109
  import {
111
110
  getRuntimeServerContext
112
- } from "./chunk-UKWGR5SS.js";
111
+ } from "./chunk-O7SVKKLY.js";
113
112
  import {
114
- isAbortError
115
- } from "./chunk-QOKAKDPE.js";
113
+ extractCustomId
114
+ } from "./chunk-M2EJHDJP.js";
116
115
  import {
117
116
  isRecord
118
117
  } from "./chunk-KUG52IAP.js";
118
+ import {
119
+ isAbortError
120
+ } from "./chunk-HIM3FCLF.js";
119
121
  import {
120
122
  asTrimmedString
121
123
  } from "./chunk-3EUW3WEO.js";
@@ -648,6 +650,14 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
648
650
  const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
649
651
  ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
650
652
  return compileContextLayers([
653
+ // 删除安全红线:系统层最高优先级约束,位于所有层之前(含身份信息),
654
+ // owner 要求常驻「根本提示词」的最顶部(2026-09-26 批量误删事故)。
655
+ {
656
+ id: "delete-safety-red-line",
657
+ owner: "platform",
658
+ cacheScope: "static",
659
+ content: DELETE_SAFETY_RED_LINE
660
+ },
651
661
  { id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
652
662
  { id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
653
663
  { id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
@@ -655,6 +665,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
655
665
  { id: "tool-round-economy", owner: "platform", cacheScope: "session", content: toolSections.toolRoundEconomy },
656
666
  { id: "tool-use-guidance", owner: "platform", cacheScope: "session", content: toolSections.toolUseGuidance },
657
667
  { id: "privilege-escalation", owner: "platform", cacheScope: "session", content: toolSections.privilegeEscalation },
668
+ { id: "shell-task-lifecycle", owner: "platform", cacheScope: "session", content: toolSections.shellTaskLifecycle },
658
669
  { id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
659
670
  { id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
660
671
  { id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
@@ -776,8 +787,13 @@ var buildRequestBody = (options) => {
776
787
  endpoint: customProviderUrl
777
788
  });
778
789
  Object.assign(bodyData, usageRequestOptions);
779
- if (reasoning_effort && isModelSupportReasoningEffort(model)) {
780
- const clamped = clampReasoningEffort(reasoning_effort, providerName);
790
+ const effectiveProviderForReasoning = providerName?.toLowerCase() === "openrouter" || customProviderUrl?.toLowerCase().includes("openrouter.ai") ? "openrouter" : providerName;
791
+ if (reasoning_effort && isModelSupportReasoningEffort(model, effectiveProviderForReasoning)) {
792
+ const clamped = clampReasoningEffort(
793
+ reasoning_effort,
794
+ effectiveProviderForReasoning,
795
+ model
796
+ );
781
797
  if (clamped) {
782
798
  bodyData.reasoning_effort = clamped;
783
799
  }
@@ -1208,7 +1224,7 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
1208
1224
  };
1209
1225
  };
1210
1226
  var fetchDirectly = async (params) => {
1211
- const { api, agentConfig, bodyData, signal, currentServer, token } = params;
1227
+ const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
1212
1228
  try {
1213
1229
  const apiKey = await resolveDirectRequestApiKey(agentConfig, {
1214
1230
  syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
@@ -1228,7 +1244,8 @@ var fetchDirectly = async (params) => {
1228
1244
  const authHeaders = buildProviderAuthHeaders({
1229
1245
  endpoint: api,
1230
1246
  apiKey: apiKey ?? "",
1231
- apiKeyHeader: agentConfig.apiKeyHeader
1247
+ apiKeyHeader: agentConfig.apiKeyHeader,
1248
+ sessionId: dialogId || agentConfig.dbKey || agentConfig.key
1232
1249
  });
1233
1250
  return await fetch(api, {
1234
1251
  method: "POST",
@@ -1794,12 +1811,17 @@ ${tableMd}
1794
1811
  `;
1795
1812
  };
1796
1813
  var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
1797
- if (!refContent?.slateData) return null;
1814
+ const hasSlate = Array.isArray(refContent?.slateData) && refContent.slateData.length > 0;
1815
+ const legacyContent = hasSlate ? null : resolvePageReadMarkdown(refContent).trim() || null;
1816
+ if (!hasSlate && !legacyContent) return null;
1798
1817
  const title = refContent.title || `Untitled (${dbKey})`;
1799
1818
  let contentString;
1800
1819
  let contentType;
1801
1820
  const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
1802
- switch (options.format) {
1821
+ if (legacyContent) {
1822
+ contentType = "Markdown (legacy content)";
1823
+ contentString = legacyContent;
1824
+ } else switch (options.format) {
1803
1825
  case "text":
1804
1826
  contentType = "Plain Text";
1805
1827
  contentString = slateToText(refContent.slateData);
@@ -0,0 +1,8 @@
1
+ // packages/agent-runtime/cursor/isCursorOAuthAgent.ts
2
+ function isCursorOAuthAgent(agent) {
3
+ return agent.apiKeyRef?.trim().toLowerCase() === "cursor";
4
+ }
5
+
6
+ export {
7
+ isCursorOAuthAgent
8
+ };
@@ -0,0 +1,83 @@
1
+ // packages/cli/secretScan.ts
2
+ var ASSIGNMENT_KEYS = [
3
+ { label: "password", keys: "password|passwd", min: 8 },
4
+ { label: "psk", keys: "psk", min: 8 },
5
+ { label: "api key", keys: "api[_-]?key|apikey", min: 12 },
6
+ { label: "token", keys: "token|secret", min: 12 }
7
+ ];
8
+ var ASSIGNMENT_PATTERNS = ASSIGNMENT_KEYS.map(
9
+ ({ label, keys, min }) => ({
10
+ label,
11
+ // 反向引用 \1 让引号成对成为必要条件:半截引号不算。值里允许空格与逗号——
12
+ // 写成带空格的口令是常见形态,旧的字符类会把这种值截成半截从而整条漏掉。
13
+ quoted: new RegExp(
14
+ `\\b(?:${keys})\\s*[:=]\\s*(["'])([^"']{${min},})\\1`,
15
+ "i"
16
+ ),
17
+ // 不带引号时只取到分隔符为止,是否算密钥交给 looksLikeBareSecret 判。
18
+ bare: new RegExp(
19
+ `\\b(?:${keys})\\s*[:=]\\s*([^\\s"',#]{${min},})`,
20
+ "i"
21
+ )
22
+ })
23
+ );
24
+ var PRIVATE_KEY_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
25
+ var EXPRESSION_CHARS = /[?(){};|&<>$]/;
26
+ var CONSTANT_CASE = /^[A-Z][A-Z0-9_]*$/;
27
+ var CAMEL_CASE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)+$/;
28
+ var PROPERTY_SEGMENT = /^[A-Za-z_$][\w$]*$/;
29
+ var NAME_FORM_MAX_CHARS = 48;
30
+ var PROPERTY_SEGMENT_MAX_CHARS = 24;
31
+ function looksLikeDottedName(value) {
32
+ const segments = value.split(".");
33
+ if (segments.length < 2) return false;
34
+ return segments.every(
35
+ (segment) => PROPERTY_SEGMENT.test(segment) && (segment.length <= PROPERTY_SEGMENT_MAX_CHARS || CONSTANT_CASE.test(segment) && segment.includes("_"))
36
+ );
37
+ }
38
+ function stripTrailingMarkdownFence(value) {
39
+ return value.replace(/`+$/, "");
40
+ }
41
+ function looksLikeBareSecret(rawValue) {
42
+ const value = stripTrailingMarkdownFence(rawValue);
43
+ if (EXPRESSION_CHARS.test(value)) return false;
44
+ if (CONSTANT_CASE.test(value) && value.includes("_")) return false;
45
+ if (looksLikeDottedName(value)) return false;
46
+ if (value.length > NAME_FORM_MAX_CHARS) {
47
+ return /\d/.test(value);
48
+ }
49
+ if (CAMEL_CASE.test(value)) return false;
50
+ return true;
51
+ }
52
+ function toPreview(line) {
53
+ return line.length > 120 ? `${line.slice(0, 117)}...` : line;
54
+ }
55
+ function findPotentialSecrets(text) {
56
+ const findings = [];
57
+ text.split(/\r?\n/).forEach((line, index) => {
58
+ const lineNumber = index + 1;
59
+ const preview = toPreview(line);
60
+ for (const { label, quoted, bare } of ASSIGNMENT_PATTERNS) {
61
+ if (quoted.test(line)) {
62
+ findings.push({ label, line: lineNumber, preview });
63
+ continue;
64
+ }
65
+ const bareMatch = bare.exec(line);
66
+ if (bareMatch && looksLikeBareSecret(bareMatch[1])) {
67
+ findings.push({ label, line: lineNumber, preview });
68
+ }
69
+ }
70
+ if (PRIVATE_KEY_PATTERN.test(line)) {
71
+ findings.push({ label: "private key", line: lineNumber, preview });
72
+ }
73
+ });
74
+ return findings;
75
+ }
76
+ function formatSecretFindings(findings) {
77
+ return findings.map((finding) => ` line ${finding.line} (${finding.label}): ${finding.preview}`).join("\n");
78
+ }
79
+
80
+ export {
81
+ findPotentialSecrets,
82
+ formatSecretFindings
83
+ };