nolo-cli 0.105.0-alpha.2 → 0.105.0

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 (208) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-4W7C3ACS.js → _executeModel-JXG5TLPE.js} +75 -68
  3. package/action-GVA5ARSJ.js +20 -0
  4. package/{addContentAction-O7R66HEX.js → addContentAction-J3DLDV64.js} +12 -11
  5. package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-PHIXJCF2.js} +18 -19
  6. package/{agentDeleteCommand-YB3S2LPY.js → agentDeleteCommand-2AWJGHXG.js} +117 -42
  7. package/{agentEmailCommands-J6YBHL42.js → agentEmailCommands-VV5OSILE.js} +98 -88
  8. package/agentListCommands-OQMRBDWP.js +742 -0
  9. package/{agentMachineCommands-2RWGEBA3.js → agentMachineCommands-3VLLR6RL.js} +48 -43
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-XPJYZSCE.js} +97 -2
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
  12. package/agentRecordCommands-GPIARVOW.js +138 -0
  13. package/agentRunCommand-LRJTZ7IM.js +167 -0
  14. package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
  15. package/{agentRuntimeLocal-FRUE5P2V.js → agentRuntimeLocal-PV6AZOEU.js} +44 -39
  16. package/{agentSlice-6LBOYNKN.js → agentSlice-6R3JKS6I.js} +14 -13
  17. package/{appDeleteCommands-JPWTSFID.js → appDeleteCommands-WEX73P5R.js} +46 -41
  18. package/{appDeployCommands-YCVY2UYO.js → appDeployCommands-7BAXWA4M.js} +46 -41
  19. package/{appDeployStatusCommands-JMCEIKTI.js → appDeployStatusCommands-EJ6A2U4X.js} +46 -41
  20. package/{appGetCommands-EXWT3QAE.js → appGetCommands-SB355OEX.js} +46 -41
  21. package/{appListCommands-PKRLSWRE.js → appListCommands-TSZDPIKJ.js} +46 -41
  22. package/{authCommand-F4EFRRX6.js → authCommand-5PB3YRVV.js} +118 -24
  23. package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-SBBWTANC.js} +10 -8
  25. package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
  26. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
  27. package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
  28. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  29. package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
  30. package/{chunk-53HEEOTT.js → chunk-2WJ57RJA.js} +83 -16
  31. package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
  32. package/{chunk-V4MJDUSR.js → chunk-3F424ASC.js} +2 -2
  33. package/{chunk-HJUYAD4A.js → chunk-3Q7NEHAR.js} +5 -5
  34. package/chunk-44CU7CKA.js +13545 -0
  35. package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
  36. package/chunk-4LCOCOR5.js +50 -0
  37. package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
  38. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  39. package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
  40. package/{chunk-H62HCIUP.js → chunk-4WMMIL66.js} +35 -22
  41. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  42. package/{chunk-ZCYXJSTU.js → chunk-54VPQTOA.js} +66 -94
  43. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  44. package/chunk-5MMAK75Q.js +15 -0
  45. package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
  46. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  47. package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
  48. package/chunk-A4SQRTZ6.js +15 -0
  49. package/{chunk-L5UXH3B2.js → chunk-AFH5QC6R.js} +58 -9
  50. package/{chunk-AEOE4Z6Q.js → chunk-AFSY3ZMB.js} +39 -15
  51. package/chunk-AGIM7IMJ.js +147 -0
  52. package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
  53. package/{chunk-NA35QHCF.js → chunk-AWVP7PPG.js} +1 -1
  54. package/{chunk-EEGDMATE.js → chunk-B7APRSPS.js} +86 -81
  55. package/{chunk-W324THOB.js → chunk-BB7LVBTS.js} +20 -11
  56. package/{chunk-6YTOJY35.js → chunk-BZ7NPA6G.js} +35 -2
  57. package/{chunk-5H7KJX7J.js → chunk-CFHWVEUJ.js} +5 -5
  58. package/chunk-CHOZJMJS.js +78 -0
  59. package/{chunk-ETI2NYVF.js → chunk-CNA27EMD.js} +4 -4
  60. package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
  61. package/{chunk-WV42OMV7.js → chunk-D2GQE6AF.js} +8 -8
  62. package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
  63. package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
  64. package/chunk-DZ7R5V3Y.js +164 -0
  65. package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
  66. package/{chunk-KQ4ONNQD.js → chunk-EKPKW6RM.js} +155 -8
  67. package/{chunk-2J5Y72GY.js → chunk-EP7BWZ4B.js} +1 -1
  68. package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
  69. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  70. package/{chunk-3ZW5ZJMM.js → chunk-FGSJ3YMD.js} +23 -28
  71. package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
  72. package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
  73. package/chunk-GMZLP5DV.js +82 -0
  74. package/{chunk-DHDMC6FO.js → chunk-GSKPJIHY.js} +14 -9
  75. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  76. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  77. package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
  78. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  79. package/{chunk-VLTIYV3X.js → chunk-HP57OUJO.js} +4 -4
  80. package/{chunk-NXUYQBDZ.js → chunk-HYXABXCZ.js} +29 -78
  81. package/{chunk-DNCEALKX.js → chunk-IEJ5YDA4.js} +22 -29
  82. package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
  83. package/{chunk-BP4XNZRM.js → chunk-JIXGJTBU.js} +4 -4
  84. package/{chunk-GPCZ7UXG.js → chunk-K6U4NKFJ.js} +1 -1
  85. package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
  86. package/{chunk-4OEFYTWL.js → chunk-L5WOICCV.js} +67 -48
  87. package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
  88. package/chunk-LWLNLZC5.js +265 -0
  89. package/{chunk-H66KLASO.js → chunk-LWXE6IFU.js} +567 -519
  90. package/{chunk-PUOC4YRO.js → chunk-M7VLQGQP.js} +11 -0
  91. package/chunk-NKWIS6G2.js +442 -0
  92. package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
  93. package/{chunk-DJWMIXDZ.js → chunk-NSAFG343.js} +10 -10
  94. package/{chunk-UKZDAFYT.js → chunk-NSBID7PR.js} +6 -10
  95. package/{chunk-U7ISRJQO.js → chunk-NTR4SD3P.js} +845 -240
  96. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  97. package/chunk-NWENLDMM.js +42 -0
  98. package/chunk-O7SVKKLY.js +875 -0
  99. package/chunk-OCZKATRC.js +129 -0
  100. package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
  101. package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
  102. package/{chunk-JRQFUXY7.js → chunk-P5GCTVGV.js} +99 -22
  103. package/{chunk-PQFHGD77.js → chunk-QKTESDWK.js} +161 -14
  104. package/{chunk-U3JZVWIB.js → chunk-QMXJ5KDJ.js} +68 -46
  105. package/{chunk-GEPUP7OO.js → chunk-QYUBY3OZ.js} +3 -3
  106. package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
  107. package/{chunk-J4MOO56S.js → chunk-RILRSUGC.js} +10 -2
  108. package/{chunk-OEVAY4J6.js → chunk-RWX7AY7J.js} +18 -20
  109. package/{chunk-YY7I6GQ3.js → chunk-S2NSK7AZ.js} +11 -9
  110. package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
  111. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  112. package/chunk-TY3TIUJK.js +89 -0
  113. package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
  114. package/{chunk-UZGQNTVW.js → chunk-UA324D4O.js} +8 -6
  115. package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
  116. package/chunk-UWXDA7L5.js +8005 -0
  117. package/{chunk-3DII57IT.js → chunk-VCAQFMVN.js} +1 -1
  118. package/chunk-VIWDGTDA.js +8 -0
  119. package/chunk-VJVNU77E.js +83 -0
  120. package/{chunk-A6FMKU7M.js → chunk-VVJ2ENLY.js} +47 -67
  121. package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
  122. package/{chunk-QDSINZM3.js → chunk-WJ3B6FX6.js} +1 -14
  123. package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
  124. package/chunk-YK5MHOWM.js +915 -0
  125. package/chunk-YV25TM3R.js +780 -0
  126. package/{chunk-TOP2VXOR.js → chunk-YVU4XVJD.js} +5 -5
  127. package/{chunk-HVP6P5FV.js → chunk-Z5NGE5DH.js} +29 -9
  128. package/{chunk-LC43IGO4.js → chunk-ZBHR642M.js} +704 -950
  129. package/chunk-ZRAU6T47.js +56 -0
  130. package/{chunk-XPVRVN4U.js → chunk-ZSUDOTPL.js} +19 -17
  131. package/commandRegistry-QU62WJQX.js +833 -0
  132. package/{contentThunks-LXOZUD2Y.js → contentThunks-VGV3JJVB.js} +37 -35
  133. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  134. package/{createAgentAutomationAction-M5NDEIC6.js → createAgentAutomationAction-ZNVLI4WV.js} +39 -37
  135. package/createDialogAction-TTUA46DT.js +69 -0
  136. package/{createPageAction-WY5ZKP2M.js → createPageAction-KUFSC5XW.js} +46 -43
  137. package/{chunk-OWS6OYF4.js → cursorProvider-YGGNMVWX.js} +2751 -10172
  138. package/{dbSlice-XVWBAGYN.js → dbSlice-MYEETO73.js} +11 -10
  139. package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
  140. package/{dialogCommands-YVMHDEOX.js → dialogCommands-DRDPEOTL.js} +49 -45
  141. package/{dialogSlice-HSGREZGA.js → dialogSlice-V2SVSTIV.js} +41 -34
  142. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  143. package/{docCreateCommands-7UTWDYJU.js → docCreateCommands-M26CFDDQ.js} +48 -43
  144. package/{docDeleteCommands-GG6BJ4PS.js → docDeleteCommands-LRZHCKVX.js} +49 -44
  145. package/{docReadCommands-QHMQVSLP.js → docReadCommands-6QJSISHK.js} +47 -42
  146. package/{docStore-IIS36NGG.js → docStore-4RWAFNDM.js} +16 -12
  147. package/{docUpdateCommands-QPL6IVUK.js → docUpdateCommands-W4KU4U5T.js} +48 -43
  148. package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
  149. package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +4 -4
  150. package/{handleSendMessageAction-FEHCWMN2.js → handleSendMessageAction-VEWLGB5Z.js} +107 -41
  151. package/index.js +87 -884
  152. package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
  153. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
  154. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
  155. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
  156. package/{machineCommands-ERCXIPJC.js → machineCommands-AEHHCJEW.js} +92 -82
  157. package/machineWsRunDispatch-MY2KHS36.js +154 -0
  158. package/{memberThunks-QGFLFVCI.js → memberThunks-EE6TI3TV.js} +20 -18
  159. package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
  160. package/oauthTokenStore-ITEB663N.js +23 -0
  161. package/package.json +1 -1
  162. package/pdf-U6KSUEZZ.js +26435 -0
  163. package/processSpawn-SOAV3FEV.js +11 -0
  164. package/profileConfig-ZGOFORWV.js +43 -0
  165. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-TEBH7FDX.js} +7 -7
  166. package/{providerRegistry-757OWH3O.js → providerRegistry-CBJLNCET.js} +11 -7
  167. package/{read-COE3ZYR6.js → read-PJIT2YEJ.js} +7 -6
  168. package/{readDocTool-5USN4A6V.js → readDocTool-DRSXHGNL.js} +5 -3
  169. package/{readlineWorkspace-PXATJOED.js → readlineWorkspace-7Q6MITLV.js} +2605 -2031
  170. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-IN4WUKJJ.js} +21 -25
  171. package/{runAgentClientLoop-UY76PPZM.js → runAgentClientLoop-H2JALUVD.js} +76 -70
  172. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
  173. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  174. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-VDRF7LPK.js} +15 -13
  175. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-RO6LIWJ4.js} +22 -26
  176. package/{chunk-AFUORTY4.js → settingThunks-3OPOLOIA.js} +226 -940
  177. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  178. package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
  179. package/{spaceCommands-BMXKR7H6.js → spaceCommands-UBLL5EF2.js} +51 -46
  180. package/{streamAgentChatTurn-3YVIO4KE.js → streamAgentChatTurn-FFJWW3FD.js} +214 -108
  181. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-MVF2JNE7.js} +18 -19
  182. package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
  183. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-EJT6TMFG.js} +3 -3
  184. package/tools-AZRYLYNK.js +116 -0
  185. package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-7S5HJ3MT.js} +25 -22
  186. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  187. package/{updateDialogTitleAction-GF5T3VMK.js → updateDialogTitleAction-5WXTRUJM.js} +82 -44
  188. package/action-YVYQEAAV.js +0 -31
  189. package/agentListCommands-3GWH4E4G.js +0 -410
  190. package/agentRecordCommands-UOF6YM5M.js +0 -128
  191. package/agentRunCommand-AVBWVTAJ.js +0 -156
  192. package/browser-image-compression-MFDTD7K6.js +0 -1763
  193. package/chatQueueReduxAdapter-WFROMKD3.js +0 -186
  194. package/chunk-CQ3WA2NE.js +0 -299
  195. package/chunk-FQUHIG5X.js +0 -20782
  196. package/chunk-M76ECQRD.js +0 -13658
  197. package/chunk-MEYIRKDN.js +0 -8967
  198. package/chunk-Q5FJJ6XI.js +0 -103
  199. package/chunk-S7Z2HMCN.js +0 -25
  200. package/chunk-Y5GCAMGP.js +0 -9
  201. package/chunk-YPREESF4.js +0 -225
  202. package/createDialogAction-TDFOINOY.js +0 -65
  203. package/machineWsRunDispatch-OVA3G76V.js +0 -144
  204. package/settingSlice-ZQZVUPKK.js +0 -204
  205. package/syncMapping-N6RGXGBW.js +0 -437
  206. package/tools-Q6IBBG33.js +0 -110
  207. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  208. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -96,6 +96,10 @@ function preserveAgentStateFields(source, target, options) {
96
96
  }
97
97
  if (Array.isArray(source.tool_calls)) {
98
98
  mutableTarget.tool_calls = source.tool_calls;
99
+ const replayPlaceholder = options?.replayReasoningPlaceholder;
100
+ if (typeof replayPlaceholder === "string" && replayPlaceholder.length > 0 && !options?.stripReasoningContent && source.tool_calls.length > 0 && !(typeof mutableTarget.reasoning_content === "string" && mutableTarget.reasoning_content.length > 0)) {
101
+ mutableTarget.reasoning_content = replayPlaceholder;
102
+ }
99
103
  }
100
104
  }
101
105
  if (source.role === "tool") {
@@ -121,6 +125,12 @@ function shouldStripReasoningContentForOutbound(provider, model) {
121
125
  }
122
126
  return false;
123
127
  }
128
+ function shouldReplayReasoningContentForOutbound(provider, model) {
129
+ const p = provider?.trim().toLowerCase();
130
+ const m = model?.trim().toLowerCase();
131
+ if (!p || !m) return false;
132
+ return p === "opencode-go" && m.includes("deepseek");
133
+ }
124
134
 
125
135
  // packages/integrations/openai/responsesHelpers.ts
126
136
  var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
@@ -383,6 +393,7 @@ export {
383
393
  preserveAgentStateFields,
384
394
  toOpenAiCompatibleMessages,
385
395
  shouldStripReasoningContentForOutbound,
396
+ shouldReplayReasoningContentForOutbound,
386
397
  toResponsesTools,
387
398
  convertMessagesToResponsesInput,
388
399
  extractTextFromResponseOutput,
@@ -0,0 +1,442 @@
1
+ // packages/agent-runtime/declaredToolNames.ts
2
+ function extractDeclaredToolNames(tools) {
3
+ if (!Array.isArray(tools)) return void 0;
4
+ const names = /* @__PURE__ */ new Set();
5
+ for (const t of tools) {
6
+ const fn = t?.function;
7
+ if (fn && typeof fn.name === "string" && fn.name) names.add(fn.name);
8
+ }
9
+ return names;
10
+ }
11
+
12
+ // packages/agent-runtime/outboundHistorySanitize.ts
13
+ function sanitizeForOutbound(messages, tools) {
14
+ return sanitizeOutboundHistory(messages, {
15
+ declaredToolNames: extractDeclaredToolNames(tools)
16
+ });
17
+ }
18
+ function stableToolCallId(assistantIndex, callIndex) {
19
+ return `call_sanitize_${assistantIndex}_${callIndex}`;
20
+ }
21
+ function isString(v) {
22
+ return typeof v === "string";
23
+ }
24
+ function isNonEmptyString(v) {
25
+ return typeof v === "string" && v.length > 0;
26
+ }
27
+ function joinLines(...parts) {
28
+ return parts.filter(isNonEmptyString).join("\n");
29
+ }
30
+ function jsonStringifyArguments(args) {
31
+ if (typeof args === "string") return args;
32
+ try {
33
+ return JSON.stringify(args ?? "");
34
+ } catch {
35
+ return "";
36
+ }
37
+ }
38
+ function renderToolCallAsText(call) {
39
+ const c = call && typeof call === "object" ? call : {};
40
+ const name = isString(c.function?.name) && c.function.name.length > 0 ? c.function.name : "unknown";
41
+ const rawArgs = c.function?.arguments;
42
+ const args = jsonStringifyArguments(rawArgs);
43
+ return `[tool_call: ${name}(${args})]`;
44
+ }
45
+ function renderToolResultAsText(message) {
46
+ const name = isNonEmptyString(message.toolName) ? message.toolName : "tool";
47
+ const body = typeof message.content === "string" ? message.content : "";
48
+ return `[tool_result: ${name}: ${body}]`;
49
+ }
50
+ function normalizeToolCall(call, assistantIndex, callIndex) {
51
+ if (!call || typeof call !== "object") return null;
52
+ const c = call;
53
+ const fn = c.function;
54
+ if (!fn || typeof fn !== "object" || !isString(fn.name) || fn.name.length === 0) return null;
55
+ const id = isNonEmptyString(c.id) ? c.id : stableToolCallId(assistantIndex, callIndex);
56
+ return {
57
+ id,
58
+ type: isString(c.type) && c.type ? c.type : "function",
59
+ function: { name: fn.name, arguments: jsonStringifyArguments(fn.arguments) },
60
+ ...typeof c.thought_signature === "string" ? { thought_signature: c.thought_signature } : {}
61
+ };
62
+ }
63
+ function classifyAssistantCalls(toolCalls, assistantIndex) {
64
+ const callIds = [];
65
+ const idCounts = /* @__PURE__ */ new Map();
66
+ const unparsableIndices = /* @__PURE__ */ new Set();
67
+ const unparsableIds = /* @__PURE__ */ new Set();
68
+ toolCalls.forEach((rawCall, callIndex) => {
69
+ const c = rawCall && typeof rawCall === "object" ? rawCall : {};
70
+ const id = isNonEmptyString(c.id) ? c.id : stableToolCallId(assistantIndex, callIndex);
71
+ callIds.push(id);
72
+ idCounts.set(id, (idCounts.get(id) ?? 0) + 1);
73
+ if (!hasParsableObjectArguments(c.function?.arguments)) {
74
+ unparsableIndices.add(callIndex);
75
+ unparsableIds.add(id);
76
+ }
77
+ });
78
+ const duplicateIds = /* @__PURE__ */ new Set();
79
+ for (const [id, count] of idCounts) {
80
+ if (count > 1) duplicateIds.add(id);
81
+ }
82
+ return { callIds, duplicateIds, unparsableIndices, unparsableIds };
83
+ }
84
+ function sanitizeOutboundHistory(messages, options) {
85
+ if (!Array.isArray(messages) || messages.length === 0) return messages;
86
+ const declared = options?.declaredToolNames;
87
+ const keptCallIndicesPerAssistant = /* @__PURE__ */ new Map();
88
+ const keptToolIndices = /* @__PURE__ */ new Set();
89
+ let i = 0;
90
+ while (i < messages.length) {
91
+ const m = messages[i];
92
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
93
+ const asstIdx = i;
94
+ const { callIds, duplicateIds, unparsableIndices } = classifyAssistantCalls(m.tool_calls, asstIdx);
95
+ const candidateCallMap = /* @__PURE__ */ new Map();
96
+ m.tool_calls.forEach((call, callIndex) => {
97
+ const id = callIds[callIndex];
98
+ if (duplicateIds.has(id)) return;
99
+ if (unparsableIndices.has(callIndex)) return;
100
+ const name = call?.function?.name;
101
+ if (!isString(name) || name.length === 0) return;
102
+ const declaredAllows = !declared || declared.has(name);
103
+ if (!declaredAllows) return;
104
+ candidateCallMap.set(id, callIndex);
105
+ });
106
+ let j = i + 1;
107
+ const matchedCallIndices = /* @__PURE__ */ new Set();
108
+ const matchedToolIds = /* @__PURE__ */ new Set();
109
+ while (j < messages.length && messages[j].role === "tool") {
110
+ const toolMsg = messages[j];
111
+ const toolCallId = isNonEmptyString(toolMsg.tool_call_id) ? toolMsg.tool_call_id : "";
112
+ if (toolCallId && candidateCallMap.has(toolCallId) && !matchedToolIds.has(toolCallId)) {
113
+ matchedToolIds.add(toolCallId);
114
+ matchedCallIndices.add(candidateCallMap.get(toolCallId));
115
+ keptToolIndices.add(j);
116
+ }
117
+ j++;
118
+ }
119
+ keptCallIndicesPerAssistant.set(asstIdx, matchedCallIndices);
120
+ i = j;
121
+ } else {
122
+ i++;
123
+ }
124
+ }
125
+ const out = [];
126
+ let k = 0;
127
+ while (k < messages.length) {
128
+ const m = messages[k];
129
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
130
+ const asstIdx = k;
131
+ const keptIndices = keptCallIndicesPerAssistant.get(asstIdx) ?? /* @__PURE__ */ new Set();
132
+ const keptToolCalls = [];
133
+ const downgradedCallLines = [];
134
+ m.tool_calls.forEach((call, callIndex) => {
135
+ const name = call?.function?.name;
136
+ const declaredAllows = !declared || isString(name) && declared.has(name);
137
+ const keep = keptIndices.has(callIndex) && declaredAllows && hasParsableObjectArguments(call?.function?.arguments);
138
+ if (keep) {
139
+ const normalized = normalizeToolCall(call, asstIdx, callIndex);
140
+ if (normalized) {
141
+ keptToolCalls.push(normalized);
142
+ } else {
143
+ downgradedCallLines.push(renderToolCallAsText(call));
144
+ }
145
+ } else {
146
+ downgradedCallLines.push(renderToolCallAsText(call));
147
+ }
148
+ });
149
+ if (keptToolCalls.length === 0) {
150
+ const downgradedText = joinLines(...downgradedCallLines);
151
+ const contentWithDowngrade = downgradedText.length > 0 ? combineContentWithText(m.content, downgradedText) : m.content;
152
+ const sanitizedAssistant2 = {
153
+ ...m,
154
+ content: contentWithDowngrade
155
+ };
156
+ delete sanitizedAssistant2.tool_calls;
157
+ out.push(sanitizedAssistant2);
158
+ let nextIdx2 = k + 1;
159
+ while (nextIdx2 < messages.length && messages[nextIdx2].role === "tool") {
160
+ out.push({
161
+ role: "assistant",
162
+ content: renderToolResultAsText(messages[nextIdx2])
163
+ });
164
+ nextIdx2++;
165
+ }
166
+ k = nextIdx2;
167
+ continue;
168
+ }
169
+ const sanitizedAssistant = {
170
+ ...m,
171
+ tool_calls: keptToolCalls
172
+ };
173
+ out.push(sanitizedAssistant);
174
+ let nextIdx = k + 1;
175
+ const deferredResultLines = [];
176
+ while (nextIdx < messages.length && messages[nextIdx].role === "tool") {
177
+ if (keptToolIndices.has(nextIdx)) {
178
+ const toolMsg = messages[nextIdx];
179
+ out.push({
180
+ ...toolMsg,
181
+ content: toolMsg.content ?? "",
182
+ tool_call_id: toolMsg.tool_call_id
183
+ });
184
+ } else {
185
+ deferredResultLines.push(renderToolResultAsText(messages[nextIdx]));
186
+ }
187
+ nextIdx++;
188
+ }
189
+ const deferredLines = [...downgradedCallLines, ...deferredResultLines];
190
+ if (deferredLines.length > 0) {
191
+ out.push({
192
+ role: "assistant",
193
+ content: joinLines(...deferredLines)
194
+ });
195
+ }
196
+ k = nextIdx;
197
+ continue;
198
+ }
199
+ if (m.role === "tool") {
200
+ out.push({
201
+ role: "assistant",
202
+ content: renderToolResultAsText(m)
203
+ });
204
+ k++;
205
+ continue;
206
+ }
207
+ out.push({ ...m });
208
+ k++;
209
+ }
210
+ return out;
211
+ }
212
+ function combineContentWithText(base, extra) {
213
+ if (typeof base === "string") {
214
+ return base ? `${base}
215
+ ${extra}` : extra;
216
+ }
217
+ if (Array.isArray(base)) {
218
+ return [...base, { type: "text", text: extra }];
219
+ }
220
+ return extra;
221
+ }
222
+ function hasParsableObjectArguments(raw) {
223
+ if (raw === void 0) return true;
224
+ if (raw === null || typeof raw === "number" || typeof raw === "boolean") {
225
+ return false;
226
+ }
227
+ if (typeof raw !== "string") return true;
228
+ if (raw.trim() === "") return true;
229
+ try {
230
+ const parsed = JSON.parse(raw);
231
+ return parsed !== null && typeof parsed === "object";
232
+ } catch {
233
+ return false;
234
+ }
235
+ }
236
+ var STRICT_JSON_STRING_TOKEN = /^"(?:[^"\\\u0000-\u001F]|\\["\\/bfnrt]|\\u[0-9A-Fa-f]{4})*"$/;
237
+ function isStrictJsonStringToken(value) {
238
+ if (!STRICT_JSON_STRING_TOKEN.test(value)) return false;
239
+ try {
240
+ return typeof JSON.parse(value) === "string";
241
+ } catch {
242
+ return false;
243
+ }
244
+ }
245
+ function closersOf(openStack) {
246
+ return openStack.slice().reverse().map((ch) => ch === "{" ? "}" : "]").join("");
247
+ }
248
+ function scanJsonForTailRepair(input) {
249
+ const stack = [];
250
+ let inString = false;
251
+ let escaped = false;
252
+ let lastCommaOutsideString = null;
253
+ for (let i = 0; i < input.length; i += 1) {
254
+ const ch = input[i];
255
+ if (inString) {
256
+ if (escaped) escaped = false;
257
+ else if (ch === "\\") escaped = true;
258
+ else if (ch === '"') inString = false;
259
+ continue;
260
+ }
261
+ if (ch === '"') {
262
+ inString = true;
263
+ continue;
264
+ }
265
+ if (ch === "{" || ch === "[") {
266
+ stack.push(ch);
267
+ continue;
268
+ }
269
+ if (ch === "}" || ch === "]") {
270
+ const open = stack.pop();
271
+ if (open !== (ch === "}" ? "{" : "[")) return null;
272
+ continue;
273
+ }
274
+ if (ch === ",") {
275
+ lastCommaOutsideString = { index: i, closers: closersOf(stack) };
276
+ continue;
277
+ }
278
+ }
279
+ return { inString, closers: closersOf(stack), lastCommaOutsideString };
280
+ }
281
+ function repairTruncatedToolArguments(raw) {
282
+ if (typeof raw !== "string") return null;
283
+ const withoutTrailingSpace = raw.replace(/\s+$/, "");
284
+ const endsWithComma = withoutTrailingSpace.endsWith(",");
285
+ const trimmed = endsWithComma ? withoutTrailingSpace.slice(0, -1).replace(/\s+$/, "") : withoutTrailingSpace;
286
+ if (trimmed === "" || trimmed.endsWith(",")) return null;
287
+ const scan = scanJsonForTailRepair(trimmed);
288
+ if (!scan || scan.inString) return null;
289
+ const lastChar = trimmed[trimmed.length - 1];
290
+ const tailIsCompleteToken = endsWithComma || lastChar === '"' || lastChar === "}" || lastChar === "]";
291
+ if (!tailIsCompleteToken) return null;
292
+ const candidates = [trimmed + scan.closers];
293
+ const lastComma = scan.lastCommaOutsideString;
294
+ if (lastComma && lastComma.index > 0) {
295
+ const tailAfterComma = trimmed.slice(lastComma.index + 1).trim();
296
+ if (isStrictJsonStringToken(tailAfterComma)) {
297
+ const head = trimmed.slice(0, lastComma.index);
298
+ candidates.push(head + lastComma.closers);
299
+ }
300
+ }
301
+ for (const candidate of candidates) {
302
+ try {
303
+ const parsed = JSON.parse(candidate);
304
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && Object.keys(parsed).length > 0) {
305
+ return candidate;
306
+ }
307
+ } catch {
308
+ }
309
+ }
310
+ return null;
311
+ }
312
+ function downgradeUnparsableToolCalls(messages) {
313
+ if (!Array.isArray(messages) || messages.length === 0) {
314
+ return { messages, downgraded: 0 };
315
+ }
316
+ let hasAnyPoison = false;
317
+ for (const m of messages) {
318
+ if (m.role === "assistant" && Array.isArray(m.tool_calls)) {
319
+ for (const call of m.tool_calls) {
320
+ if (!hasParsableObjectArguments(call?.function?.arguments)) {
321
+ hasAnyPoison = true;
322
+ break;
323
+ }
324
+ }
325
+ }
326
+ if (hasAnyPoison) break;
327
+ }
328
+ if (!hasAnyPoison) return { messages, downgraded: 0 };
329
+ const poisonedCallsPerAssistant = /* @__PURE__ */ new Map();
330
+ const poisonedToolIndices = /* @__PURE__ */ new Set();
331
+ let i = 0;
332
+ while (i < messages.length) {
333
+ const m = messages[i];
334
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
335
+ const asstIdx = i;
336
+ const { unparsableIds } = classifyAssistantCalls(m.tool_calls, asstIdx);
337
+ let j = i + 1;
338
+ while (j < messages.length && messages[j].role === "tool") {
339
+ const toolMsg = messages[j];
340
+ const toolCallId = isNonEmptyString(toolMsg.tool_call_id) ? toolMsg.tool_call_id : "";
341
+ if (toolCallId && unparsableIds.has(toolCallId)) {
342
+ poisonedToolIndices.add(j);
343
+ }
344
+ j++;
345
+ }
346
+ if (unparsableIds.size > 0) {
347
+ poisonedCallsPerAssistant.set(asstIdx, unparsableIds);
348
+ }
349
+ i = j;
350
+ } else {
351
+ i++;
352
+ }
353
+ }
354
+ let downgraded = 0;
355
+ const out = [];
356
+ let k = 0;
357
+ while (k < messages.length) {
358
+ const m = messages[k];
359
+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
360
+ const badIds = poisonedCallsPerAssistant.get(k);
361
+ if (!badIds || badIds.size === 0) {
362
+ out.push(m);
363
+ k++;
364
+ continue;
365
+ }
366
+ const kept = [];
367
+ const lines = [];
368
+ const { callIds } = classifyAssistantCalls(m.tool_calls, k);
369
+ m.tool_calls.forEach((call, callIndex) => {
370
+ const id = callIds[callIndex];
371
+ if (badIds.has(id)) {
372
+ lines.push(renderToolCallAsText(call));
373
+ downgraded++;
374
+ } else {
375
+ kept.push(call);
376
+ }
377
+ });
378
+ if (kept.length === 0) {
379
+ const sanitized2 = {
380
+ ...m,
381
+ content: combineContentWithText(m.content, joinLines(...lines))
382
+ };
383
+ delete sanitized2.tool_calls;
384
+ out.push(sanitized2);
385
+ let nextIdx2 = k + 1;
386
+ while (nextIdx2 < messages.length && messages[nextIdx2].role === "tool") {
387
+ if (poisonedToolIndices.has(nextIdx2)) {
388
+ out.push({ role: "assistant", content: renderToolResultAsText(messages[nextIdx2]) });
389
+ } else {
390
+ out.push(messages[nextIdx2]);
391
+ }
392
+ nextIdx2++;
393
+ }
394
+ k = nextIdx2;
395
+ continue;
396
+ }
397
+ const sanitized = {
398
+ ...m,
399
+ content: lines.length > 0 ? combineContentWithText(m.content, joinLines(...lines)) : m.content,
400
+ tool_calls: kept
401
+ };
402
+ out.push(sanitized);
403
+ let nextIdx = k + 1;
404
+ const deferredResultLines = [];
405
+ while (nextIdx < messages.length && messages[nextIdx].role === "tool") {
406
+ if (poisonedToolIndices.has(nextIdx)) {
407
+ deferredResultLines.push(renderToolResultAsText(messages[nextIdx]));
408
+ } else {
409
+ out.push(messages[nextIdx]);
410
+ }
411
+ nextIdx++;
412
+ }
413
+ if (deferredResultLines.length > 0) {
414
+ out.push({
415
+ role: "assistant",
416
+ content: joinLines(...deferredResultLines)
417
+ });
418
+ }
419
+ k = nextIdx;
420
+ continue;
421
+ }
422
+ if (m.role === "tool") {
423
+ if (poisonedToolIndices.has(k)) {
424
+ out.push({ role: "assistant", content: renderToolResultAsText(m) });
425
+ } else {
426
+ out.push(m);
427
+ }
428
+ k++;
429
+ continue;
430
+ }
431
+ out.push(m);
432
+ k++;
433
+ }
434
+ return { messages: out, downgraded };
435
+ }
436
+
437
+ export {
438
+ sanitizeForOutbound,
439
+ hasParsableObjectArguments,
440
+ repairTruncatedToolArguments,
441
+ downgradeUnparsableToolCalls
442
+ };
@@ -37,7 +37,7 @@ function resolveCliAuthorityBrokerPort(options = {}) {
37
37
  ...options,
38
38
  env: options.env ?? {}
39
39
  });
40
- return 47e3 + hashString(noloHome) % 2e3;
40
+ return 24e3 + hashString(noloHome) % 2e3;
41
41
  }
42
42
  function resolveCliAuthorityStoreDriver(options = {}) {
43
43
  return readCliAuthorityDriver(options.env ?? {}).driver;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-H66KLASO.js";
3
+ } from "./chunk-LWXE6IFU.js";
4
4
  import {
5
- i18n_default
6
- } from "./chunk-FQUHIG5X.js";
5
+ runtime_default
6
+ } from "./chunk-44CU7CKA.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
- } from "./chunk-O6OSWFZQ.js";
9
+ } from "./chunk-IHPDK6UD.js";
10
10
  import {
11
11
  isNoloHostedProvider
12
- } from "./chunk-Q67DOFOO.js";
12
+ } from "./chunk-Y3PMXGLH.js";
13
13
  import {
14
14
  asTrimmedLowercaseString
15
15
  } from "./chunk-QSJ3HFEF.js";
@@ -151,12 +151,12 @@ var PREPARE_TOOLS_CACHE_LIMIT = 128;
151
151
  var warnedUnknownToolNames = /* @__PURE__ */ new Set();
152
152
  function getTranslation(keys, defaultVal) {
153
153
  for (const key of keys) {
154
- if (i18n_default.exists(key)) {
155
- return i18n_default.t(key);
154
+ if (runtime_default.exists(key)) {
155
+ return runtime_default.t(key);
156
156
  }
157
157
  const aiKey = key.startsWith("ai:") ? key : `ai:${key}`;
158
- if (i18n_default.exists(aiKey)) {
159
- return i18n_default.t(aiKey);
158
+ if (runtime_default.exists(aiKey)) {
159
+ return runtime_default.t(aiKey);
160
160
  }
161
161
  }
162
162
  return defaultVal;
@@ -203,7 +203,7 @@ function translateSchema(schema) {
203
203
  return nextSchema;
204
204
  }
205
205
  function currentI18nLanguage() {
206
- return typeof i18n_default.language === "string" ? i18n_default.language : "";
206
+ return typeof runtime_default.language === "string" ? runtime_default.language : "";
207
207
  }
208
208
  function translateSchemaCached(schema) {
209
209
  if (!schema || typeof schema !== "object") return schema;
@@ -1,19 +1,15 @@
1
1
  import {
2
- getActiveDialogKey
3
- } from "./chunk-6YTOJY35.js";
2
+ formatISO
3
+ } from "./chunk-ZRAU6T47.js";
4
4
  import {
5
- require_date_fns
6
- } from "./chunk-M76ECQRD.js";
5
+ getActiveDialogKey
6
+ } from "./chunk-BZ7NPA6G.js";
7
7
  import {
8
8
  patch,
9
9
  selectById
10
- } from "./chunk-H62HCIUP.js";
11
- import {
12
- __toESM
13
- } from "./chunk-4VNS5WPM.js";
10
+ } from "./chunk-4WMMIL66.js";
14
11
 
15
12
  // packages/chat/dialog/actions/setDialogExtraReferencesAction.ts
16
- var import_date_fns = __toESM(require_date_fns());
17
13
  var setDialogExtraReferencesAction = async (extraReferences, thunkApi) => {
18
14
  const { dispatch, getState } = thunkApi;
19
15
  const state = getState();
@@ -33,7 +29,7 @@ var setDialogExtraReferencesAction = async (extraReferences, thunkApi) => {
33
29
  dbKey: currentDialogKey,
34
30
  changes: {
35
31
  extraReferences: extraReferences ?? [],
36
- updatedAt: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date())
32
+ updatedAt: formatISO(/* @__PURE__ */ new Date())
37
33
  }
38
34
  })
39
35
  ).unwrap();