nolo-cli 0.240.0-alpha.3 → 0.241.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/{_executeModel-5NA4USGG.js → _executeModel-UCWDB72C.js} +50 -50
  2. package/{action-X75O3XPH.js → action-24MZYW2B.js} +6 -6
  3. package/{addContentAction-GVC77QSN.js → addContentAction-HEMCSSHT.js} +9 -9
  4. package/{addDialogAgentAction-KKDVAMW3.js → addDialogAgentAction-SQYDOXHA.js} +8 -8
  5. package/{agentDeleteCommand-2RFGKFAB.js → agentDeleteCommand-P7O3ACNJ.js} +76 -77
  6. package/{agentEmailCommands-GQCQKKOR.js → agentEmailCommands-A5BRSYWK.js} +80 -81
  7. package/{agentListCommands-HSGLDPDQ.js → agentListCommands-LDRCOOMO.js} +37 -36
  8. package/{agentMachineCommands-BISF6PVV.js → agentMachineCommands-AYL53KJV.js} +31 -30
  9. package/{agentProviderCommands-O3Q25PKU.js → agentProviderCommands-N5EA3ED2.js} +2 -2
  10. package/{agentPullCommand-G6U2LHMW.js → agentPullCommand-QQQZSC6S.js} +1 -1
  11. package/{agentRecordCommands-AOXPGYAJ.js → agentRecordCommands-FICBZ57C.js} +75 -76
  12. package/{agentRunCommand-AFAIP7U7.js → agentRunCommand-CTXQGDUM.js} +81 -80
  13. package/{agentRunControl-VBL7UFSG.js → agentRunControl-CO6BASZF.js} +7 -7
  14. package/{agentRuntimeLocal-T7BX2WGL.js → agentRuntimeLocal-5YN4D5WT.js} +26 -25
  15. package/{agentSlice-XJNKE3PG.js → agentSlice-DJ5D4DU4.js} +9 -9
  16. package/{appDeleteCommands-LURUSPY7.js → appDeleteCommands-B4E7N7M2.js} +32 -31
  17. package/{appDeployCommands-SMEW4AK2.js → appDeployCommands-E4DTXRRM.js} +32 -31
  18. package/{appDeployStatusCommands-VYPJTBJK.js → appDeployStatusCommands-FCNHYHZM.js} +32 -31
  19. package/{appGetCommands-N4NI5GGJ.js → appGetCommands-4DXSQHUZ.js} +32 -31
  20. package/{appListCommands-5C6ONN3Z.js → appListCommands-2NN5E4F6.js} +32 -31
  21. package/{authCommand-4CVBDADE.js → authCommand-47DR6GZT.js} +22 -18
  22. package/{authCommands-EHU2BHOX.js → authCommands-ZZ3L5IFM.js} +10 -6
  23. package/builtinSkillRegistry-AYWYQVA4.js +1 -1
  24. package/{chromeOpsCommands-CSDG2HYN.js → chromeOpsCommands-VZWAY2KR.js} +1 -1
  25. package/{chunk-UFC4J7OY.js → chunk-24GVXSWK.js} +3 -3
  26. package/{chunk-4IQVE43Z.js → chunk-25OCZXSX.js} +15 -15
  27. package/{chunk-4X5AVCM7.js → chunk-2BSLGODA.js} +258 -23
  28. package/{chunk-U3G7RRXJ.js → chunk-2XMKW2OY.js} +4 -4
  29. package/{chunk-MYOSN6BT.js → chunk-3NFWMSTA.js} +31 -10
  30. package/{chunk-A74QP4FI.js → chunk-3V6JT6WN.js} +343 -136
  31. package/{chunk-2X7WFDT6.js → chunk-4FE3IWRE.js} +1 -1
  32. package/{chunk-XS5A3EKX.js → chunk-4YFC3DWW.js} +75 -1
  33. package/chunk-53W5BXLN.js +340 -0
  34. package/{chunk-H7ZYKHAZ.js → chunk-5TJE4QCL.js} +102 -31
  35. package/{chunk-FZKA3XFA.js → chunk-6BGJHJRN.js} +9 -9
  36. package/{chunk-6WOLPIPY.js → chunk-6RSNVJGO.js} +2 -102
  37. package/{chunk-L32W3PRP.js → chunk-6X3CS6NJ.js} +161 -12
  38. package/{chunk-3FBAVU2Y.js → chunk-6XBOPKUH.js} +11 -76
  39. package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
  40. package/{chunk-7TTMMOKH.js → chunk-7OTNBI77.js} +1 -1
  41. package/{chunk-BGGV6B5O.js → chunk-7Q7MKJZN.js} +83 -50
  42. package/{chunk-2574ANSV.js → chunk-7U2TFUWW.js} +1 -1
  43. package/{chunk-A3LUWRQK.js → chunk-B72AFRR2.js} +4 -4
  44. package/{chunk-P3IZUMIC.js → chunk-BDERPCJW.js} +4 -4
  45. package/{chunk-MYPKBJJO.js → chunk-BIJTI5SX.js} +2 -2
  46. package/{chunk-ZEKUFJLW.js → chunk-BWW6WRX6.js} +3 -3
  47. package/chunk-C5A54QS7.js +108 -0
  48. package/{chunk-IUTUWIKE.js → chunk-C646JEUV.js} +1 -1
  49. package/{chunk-FFYE5ATM.js → chunk-CT6GT2BG.js} +7 -7
  50. package/{chunk-T6VROBY7.js → chunk-CZLSTOVM.js} +2 -2
  51. package/{chunk-SRCCSTIM.js → chunk-DGUUOHBF.js} +2 -2
  52. package/{chunk-A5EVA6HU.js → chunk-DIBQXNGW.js} +2 -2
  53. package/{chunk-AVJDELEA.js → chunk-DLT2DN4M.js} +1 -1
  54. package/{chunk-IJTXNLQE.js → chunk-DLTMAXLF.js} +6 -6
  55. package/{chunk-5QZSEQSK.js → chunk-DWWUVRB5.js} +1 -1
  56. package/{chunk-TRHJ4NJB.js → chunk-EIFSCI4C.js} +381 -155
  57. package/{chunk-DXW5WDHZ.js → chunk-EW37CXCQ.js} +3 -3
  58. package/{chunk-GXXY2NL3.js → chunk-F3FQPVHE.js} +37 -2
  59. package/{chunk-7AJRJGSQ.js → chunk-FCAMGBLY.js} +378 -146
  60. package/{chunk-YGCOJNFZ.js → chunk-FPMPWNVQ.js} +3 -3
  61. package/{chunk-MECDGHLK.js → chunk-FSIEHQNH.js} +2 -2
  62. package/{chunk-B7DE5XJW.js → chunk-FXX6VFMV.js} +208 -25
  63. package/{chunk-Z2WZAE4P.js → chunk-G6OPRPXH.js} +11 -11
  64. package/{chunk-VSRISJXZ.js → chunk-GAHJLSDO.js} +1 -1
  65. package/{chunk-PGKA77TZ.js → chunk-GCVFX6ZL.js} +169 -106
  66. package/{chunk-E5KJOZWY.js → chunk-H6CHPU6M.js} +3 -3
  67. package/{chunk-RETQOQ4D.js → chunk-HNWZJI4N.js} +1 -1
  68. package/{chunk-BGGAY6OK.js → chunk-IPRPYKBP.js} +3 -3
  69. package/{chunk-G22P367E.js → chunk-IUXBKS5L.js} +57 -13
  70. package/{chunk-PRMEU7BT.js → chunk-KGIIZXPL.js} +4 -4
  71. package/chunk-KK3FCYZM.js +647 -0
  72. package/{chunk-4Q6HQORG.js → chunk-KOIDLCAQ.js} +1 -1
  73. package/{chunk-PROOOQZ3.js → chunk-LCQJH7KN.js} +1 -1
  74. package/{chunk-Y2MF4DCJ.js → chunk-LELADM5Q.js} +1 -1
  75. package/{chunk-RTHFJZ6M.js → chunk-LMFMV5UC.js} +2 -2
  76. package/{chunk-ANJRDS6U.js → chunk-LMZRXDWG.js} +3 -3
  77. package/{chunk-6CKUO32A.js → chunk-LN4ZVSO7.js} +6 -3
  78. package/{chunk-N2JROHD3.js → chunk-LT3DMEIB.js} +3 -3
  79. package/{chunk-F6YWDVIB.js → chunk-MDVP5TLI.js} +1 -1
  80. package/chunk-MVOZ22RZ.js +26 -0
  81. package/{chunk-CBUZ6DKA.js → chunk-N6EN3HK3.js} +1 -1
  82. package/{chunk-3EMIEC27.js → chunk-NBB2EBQD.js} +1 -1
  83. package/{chunk-TWTJV35S.js → chunk-NL7J2J5Z.js} +3 -3
  84. package/{chunk-EEOOBRA7.js → chunk-NQQL2DKF.js} +2 -2
  85. package/{chunk-AEQMKYZN.js → chunk-NWWQY2J5.js} +4 -4
  86. package/{chunk-AH5R7BYW.js → chunk-OATIWAKN.js} +5 -5
  87. package/{chunk-CD3RU7XL.js → chunk-OJRTTERA.js} +62 -2
  88. package/{chunk-HOM6LTEW.js → chunk-OYHJ4TW7.js} +6 -6
  89. package/{chunk-BXSMFPTG.js → chunk-QES2NCVM.js} +3 -3
  90. package/{chunk-Y5OWZQMJ.js → chunk-QGMIUVBT.js} +5 -5
  91. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  92. package/chunk-SR4FE5VD.js +9 -0
  93. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  94. package/{chunk-CKZPMJNU.js → chunk-T444ENEC.js} +3 -3
  95. package/{chunk-TEMLHVGX.js → chunk-TE2XH4KH.js} +1 -1
  96. package/{chunk-4FIO2S7Z.js → chunk-TFGGNRT6.js} +1 -1
  97. package/{chunk-HCNOO374.js → chunk-TTEBPPUV.js} +1 -1
  98. package/{chunk-RM4UMFY4.js → chunk-TXFYIWAW.js} +7 -7
  99. package/{chunk-6WZVM33D.js → chunk-TXQVH72L.js} +2 -2
  100. package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
  101. package/{chunk-OX6GNNVT.js → chunk-U5LOKQ2R.js} +24 -13
  102. package/{chunk-VM72HKW2.js → chunk-UAHUJ4HH.js} +11 -11
  103. package/{chunk-BIABIPGW.js → chunk-UAOFSUG7.js} +1 -1
  104. package/{chunk-D374I563.js → chunk-UKSKCDBG.js} +1 -1
  105. package/{chunk-IUMS6F53.js → chunk-WHO3LYDW.js} +9 -5
  106. package/{chunk-F3XI6WQP.js → chunk-X37RQEA3.js} +2 -2
  107. package/{chunk-B5SV4H3J.js → chunk-XAFOLWLU.js} +1 -1
  108. package/{chunk-HBRDSQ3M.js → chunk-XNEDFWT4.js} +2 -2
  109. package/{chunk-VREG6ANQ.js → chunk-Y5RN44VH.js} +8 -8
  110. package/{chunk-S2MHR4PU.js → chunk-YFRJAE3R.js} +178 -114
  111. package/{chunk-GDUC4VS2.js → chunk-YMCSR7PA.js} +7 -7
  112. package/{chunk-5ZUOVCKT.js → chunk-YUZ2DAIH.js} +3 -1
  113. package/{chunk-CVJRVBJL.js → chunk-ZBQ5UGYY.js} +3 -3
  114. package/{chunk-O6IPRAVV.js → chunk-ZQUCJBS4.js} +2 -2
  115. package/{chunk-KZPEGO6D.js → chunk-ZT3DYK5T.js} +3 -3
  116. package/{chunk-DNZ4JJ7C.js → chunk-ZTLTDUV6.js} +16 -3
  117. package/{cliAgentConfigHelpers-U5OAVAKQ.js → cliAgentConfigHelpers-RFR7ZCSK.js} +6 -6
  118. package/{cliAuthorityBrokerClient-S42VMGB6.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  119. package/{cliLocalAgentRecordReader-HVZAQCUD.js → cliLocalAgentRecordReader-AJ4UKHKT.js} +30 -29
  120. package/{commandRegistry-TME7INFU.js → commandRegistry-IHWZVV4G.js} +86 -86
  121. package/{contentThunks-U6OC4R2N.js → contentThunks-YQRCBDKF.js} +22 -21
  122. package/{cooldownCommands-U7XSRVJP.js → cooldownCommands-W67DE765.js} +1 -1
  123. package/{createAgentAutomationAction-IP4LFN3W.js → createAgentAutomationAction-ERSDNR4R.js} +22 -21
  124. package/{createDialogAction-IAGQJ3LH.js → createDialogAction-QXC7JZPE.js} +23 -22
  125. package/{createPageAction-AZ3UIFKA.js → createPageAction-RLZ7776F.js} +24 -23
  126. package/{db-M7FU2GNK.js → db-6NRZLEW2.js} +1 -1
  127. package/{dbSlice-DKKMJJYY.js → dbSlice-7M2ESEUO.js} +8 -8
  128. package/{deleteFile-TQSONMVU.js → deleteFile-WO6WSSNK.js} +5 -5
  129. package/{dialogCommands-PCDRMBWG.js → dialogCommands-UIRO4QNN.js} +37 -36
  130. package/{dialogNotifyCommand-O35MWMOS.js → dialogNotifyCommand-VDUFYBZV.js} +8 -8
  131. package/{dialogSlice-QAKYN4DE.js → dialogSlice-A4U3C76D.js} +20 -19
  132. package/{dialogUsageCommand-2SSLTXKO.js → dialogUsageCommand-SEC6UZWM.js} +2 -2
  133. package/{docCreateCommands-CFQFZOAD.js → docCreateCommands-MHPYTJWR.js} +31 -30
  134. package/{docDeleteCommands-5CPNTIIS.js → docDeleteCommands-VYULMBAQ.js} +32 -31
  135. package/{docReadCommands-XQILYSAJ.js → docReadCommands-FV3GGZ7V.js} +31 -30
  136. package/{docStore-GIVRT7TQ.js → docStore-AWWI72FA.js} +9 -9
  137. package/{docUpdateCommands-VETKSUDD.js → docUpdateCommands-JNS3HX7F.js} +31 -30
  138. package/fetchMessages-TQEUZD7H.js +1 -1
  139. package/{getPricing-LF5C4XSI.js → getPricing-U5AR7ZHS.js} +3 -3
  140. package/{handleSendMessageAction-HKIW4ZNO.js → handleSendMessageAction-WDJOUDNV.js} +41 -40
  141. package/{hostCredentialCreate-6VDJFNDO.js → hostCredentialCreate-H3FF2SAO.js} +75 -76
  142. package/index.js +8 -8
  143. package/keys-RWF7UCB4.js +1 -1
  144. package/{localDialogRead-AV2VKKPG.js → localDialogRead-3T2KMCRC.js} +1 -1
  145. package/{localRuntimeAdapter-BQ4F5PZV.js → localRuntimeAdapter-JAQQXZJP.js} +74 -73
  146. package/{localRuntimeAuthority-WCNA4A3G.js → localRuntimeAuthority-7DKIT7UH.js} +2 -2
  147. package/{localRuntimeDb-CRNIBOOM.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  148. package/{machineCommands-K6XIGOAD.js → machineCommands-WYOFNB5I.js} +73 -74
  149. package/{machineWsRunDispatch-4OO7Z6UM.js → machineWsRunDispatch-Y7UIAZNM.js} +73 -74
  150. package/markdownToSlate-KIYM7B3P.js +8 -0
  151. package/{mcpLocalAuthorizeCommand-ZP6ESAGE.js → mcpLocalAuthorizeCommand-SCYEFLRK.js} +9 -9
  152. package/{memberThunks-PBJPZ2JU.js → memberThunks-DIITWU4M.js} +10 -10
  153. package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
  154. package/package.json +1 -1
  155. package/{projectArchive-G7AOQPRW.js → projectArchive-IZJXBW5N.js} +26 -25
  156. package/{providerPresetApply-OPBCAONX.js → providerPresetApply-2QWXPJXZ.js} +5 -5
  157. package/{providerRegistry-J2HCVTHE.js → providerRegistry-W4LCKK6V.js} +5 -5
  158. package/{read-JEGPITEW.js → read-OBLJNMA2.js} +5 -5
  159. package/{readDocTool-TE3XIU4Y.js → readDocTool-QQZ4DAER.js} +1 -1
  160. package/{readlineWorkspace-SOW5QUGZ.js → readlineWorkspace-WF3SWZGR.js} +2914 -1240
  161. package/rememberExplicit-CPAPONSI.js +15 -0
  162. package/{removeDialogAgentAction-CX3OAH4Y.js → removeDialogAgentAction-HC3SOY3G.js} +10 -10
  163. package/{runAgentClientLoop-HQJPDFGQ.js → runAgentClientLoop-Z7V6TA3O.js} +48 -48
  164. package/{runtimeDoctorCommands-GUH2YGMH.js → runtimeDoctorCommands-KX6YLPWV.js} +8 -8
  165. package/{secretCommands-NJXFVHZU.js → secretCommands-STRAX275.js} +2 -2
  166. package/{setDialogExtraReferencesAction-CGM67EEQ.js → setDialogExtraReferencesAction-DDZUQPY6.js} +9 -9
  167. package/{setPrimaryDialogAgentAction-3ABWPPXR.js → setPrimaryDialogAgentAction-EB67OMAJ.js} +10 -10
  168. package/{settingThunks-AY76OHYX.js → settingThunks-TN6GFASU.js} +8 -8
  169. package/{spaceCommands-G63QGYQO.js → spaceCommands-HBYQUVJI.js} +30 -29
  170. package/{streamAgentChatTurn-E3XH2KFD.js → streamAgentChatTurn-CM7QQXOS.js} +78 -78
  171. package/{switchDialogAgentAction-G6EZRKCQ.js → switchDialogAgentAction-XY5TKQQE.js} +8 -8
  172. package/{tableCommands-JI75ZHDI.js → tableCommands-MXFL3JIT.js} +2 -2
  173. package/{toolApiClient-62UUPDUA.js → toolApiClient-53YMJ2G6.js} +7 -3
  174. package/{tools-7RSX22FT.js → tools-AT6H73LD.js} +39 -40
  175. package/{tuiRestart-KAAA7TND.js → tuiRestart-272SAYSK.js} +8 -8
  176. package/{tuiSummaryLlmCaller-BVNHMWLR.js → tuiSummaryLlmCaller-K2OVRVHG.js} +13 -12
  177. package/{updateCommands-ASK5XYPH.js → updateCommands-O3BOVVVN.js} +3 -3
  178. package/{updateDialogTitleAction-SEWV252V.js → updateDialogTitleAction-PGY4UPLH.js} +22 -21
  179. package/{usageCommand-JVT5J3DC.js → usageCommand-SCF3ROV2.js} +3 -3
  180. package/{usageRebuildCommand-IZYYUTEW.js → usageRebuildCommand-K5WPIBA5.js} +4 -4
  181. package/{windowsSelfUpdate-BSDIS2J5.js → windowsSelfUpdate-WJDUZLEO.js} +2 -2
  182. package/{workContext-MM3P5GP5.js → workContext-Y3ADAPZU.js} +2 -1
  183. package/chunk-XBAEM4RI.js +0 -272
  184. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  185. package/{chunk-ULLHVDTZ.js → chunk-C3GOEQJF.js} +3 -3
  186. package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
  187. package/{workloadLifecycle-YIZ7KLUP.js → workloadLifecycle-HFJIN5IZ.js} +5 -5
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolvePlatformAuthToken
3
- } from "./chunk-RTHFJZ6M.js";
3
+ } from "./chunk-LMFMV5UC.js";
4
4
 
5
5
  // packages/cli/client/localRuntimeHelpers.ts
6
6
  var REMOTE_DIALOG_SYNC_TIMEOUT_MS = 1e4;
@@ -1,12 +1,21 @@
1
1
  import {
2
2
  normalizeMediaConfirmExecutionRevision
3
3
  } from "./chunk-QYPE3TS3.js";
4
+ import {
5
+ getActiveDialogKey
6
+ } from "./chunk-I2OYPD3Y.js";
4
7
  import {
5
8
  selectIdentityToken
6
9
  } from "./chunk-PXYBUFDB.js";
7
10
  import {
8
11
  compactWhitespace
9
12
  } from "./chunk-DWLEOOGR.js";
13
+ import {
14
+ splitDialogKeyIdentity
15
+ } from "./chunk-YZMNK53S.js";
16
+ import {
17
+ isRecord
18
+ } from "./chunk-KUG52IAP.js";
10
19
  import {
11
20
  asTrimmedLowercaseString
12
21
  } from "./chunk-QSJ3HFEF.js";
@@ -32,6 +41,55 @@ var selectCurrentTokenFromState = (state) => {
32
41
  const token = selectIdentityToken(state);
33
42
  return typeof token === "string" ? token : null;
34
43
  };
44
+ var selectCurrentDialogKeyFromState = (_state) => getActiveDialogKey();
45
+ var CONTROL_OR_WHITESPACE_RE = /[\u0000-\u001f\u007f\s]/;
46
+ var hasSuppliedDialogValue = (value) => value != null && (typeof value !== "string" || value.trim().length > 0);
47
+ var normalizeToolDialogId = (value) => {
48
+ if (typeof value !== "string") return null;
49
+ if (/[\u0000-\u001f\u007f]/.test(value)) return null;
50
+ const trimmed = value.trim();
51
+ if (!trimmed || CONTROL_OR_WHITESPACE_RE.test(trimmed)) return null;
52
+ if (trimmed.includes("-msg-")) return null;
53
+ if (trimmed.startsWith("dialog-")) {
54
+ const identity = splitDialogKeyIdentity(trimmed);
55
+ const parsedId = identity?.dialogId?.trim();
56
+ if (!parsedId || CONTROL_OR_WHITESPACE_RE.test(parsedId) || parsedId.includes("-msg-")) {
57
+ return null;
58
+ }
59
+ return parsedId;
60
+ }
61
+ return trimmed;
62
+ };
63
+ var resolveToolDialogId = (thunkApi, options = {}) => {
64
+ if (hasSuppliedDialogValue(options?.dialogId)) {
65
+ return normalizeToolDialogId(options.dialogId);
66
+ }
67
+ if (hasSuppliedDialogValue(options?.dialogKey)) {
68
+ return normalizeToolDialogId(options.dialogKey);
69
+ }
70
+ if (hasSuppliedDialogValue(thunkApi?.extra?.dialogId)) {
71
+ return normalizeToolDialogId(thunkApi.extra.dialogId);
72
+ }
73
+ if (hasSuppliedDialogValue(thunkApi?.extra?.dialogKey)) {
74
+ return normalizeToolDialogId(thunkApi.extra.dialogKey);
75
+ }
76
+ if (hasSuppliedDialogValue(thunkApi?.dialogId)) {
77
+ return normalizeToolDialogId(thunkApi.dialogId);
78
+ }
79
+ if (hasSuppliedDialogValue(thunkApi?.dialogKey)) {
80
+ return normalizeToolDialogId(thunkApi.dialogKey);
81
+ }
82
+ let state;
83
+ try {
84
+ state = typeof thunkApi?.getState === "function" ? thunkApi.getState() : void 0;
85
+ } catch {
86
+ state = void 0;
87
+ }
88
+ if (hasSuppliedDialogValue(state?.dialog?.currentDialogKey)) {
89
+ return normalizeToolDialogId(state.dialog.currentDialogKey);
90
+ }
91
+ return normalizeToolDialogId(selectCurrentDialogKeyFromState(state));
92
+ };
35
93
  var resolveToolBaseUrl = (currentServer) => {
36
94
  const _window = globalThis.window;
37
95
  if (!_window) return (currentServer || "").replace(/\/+$/, "");
@@ -127,11 +185,26 @@ var buildToolRequestHeaders = (thunkApi, options = {}) => {
127
185
  if (agentKey && typeof agentKey === "string" && agentKey.trim()) {
128
186
  headers["X-Nolo-Agent-Key"] = agentKey.trim();
129
187
  }
188
+ const dialogId = resolveToolDialogId(thunkApi, options);
189
+ if (dialogId) {
190
+ headers["X-Nolo-Dialog-Id"] = dialogId;
191
+ }
130
192
  if (typeof window !== "undefined" && window.__NOLO_DESKTOP__) {
131
193
  headers["X-Nolo-Desktop-Tool"] = "1";
132
194
  }
133
195
  return headers;
134
196
  };
197
+ var buildToolRequestBody = (thunkApi, body, options) => {
198
+ if (!options.injectDialogId) return body;
199
+ if (!isRecord(body)) return body;
200
+ if ("dialogId" in body) return body;
201
+ const dialogId = resolveToolDialogId(thunkApi, options);
202
+ if (!dialogId) return body;
203
+ return {
204
+ ...body,
205
+ dialogId
206
+ };
207
+ };
135
208
  var buildResponsePreview = (text) => compactWhitespace(text).slice(0, 240);
136
209
  var looksLikeHtmlResponse = (text, contentType) => {
137
210
  if (contentType?.toLowerCase().includes("text/html")) return true;
@@ -149,7 +222,7 @@ async function callToolApi(thunkApi, path, body, options = {}) {
149
222
  method,
150
223
  headers,
151
224
  ...options.signal ? { signal: options.signal } : {},
152
- ...method === "GET" ? {} : { body: JSON.stringify(body) }
225
+ ...method === "GET" ? {} : { body: JSON.stringify(buildToolRequestBody(thunkApi, body, options)) }
153
226
  });
154
227
  const contentType = response.headers.get("content-type");
155
228
  const responseText = await response.text();
@@ -204,6 +277,7 @@ async function callToolApi(thunkApi, path, body, options = {}) {
204
277
  }
205
278
 
206
279
  export {
280
+ resolveToolDialogId,
207
281
  resolveToolBaseUrl,
208
282
  resolveToolApiBaseUrl,
209
283
  getRequestConfig,
@@ -0,0 +1,340 @@
1
+ import {
2
+ applyMemoryInterpreterMutation
3
+ } from "./chunk-6RSNVJGO.js";
4
+ import {
5
+ getMemoryEntityVNext,
6
+ getMemoryEvidenceVNextStrict,
7
+ getMemoryStateVNext,
8
+ listMemoryStatesForEntityVNext
9
+ } from "./chunk-324FWHUA.js";
10
+ import {
11
+ normalizeTopicKey
12
+ } from "./chunk-MVOZ22RZ.js";
13
+ import {
14
+ sha256Hex
15
+ } from "./chunk-SR4FE5VD.js";
16
+
17
+ // packages/ai/memory/vnext/rememberExplicit.ts
18
+ async function rememberExplicitVNext(db, item) {
19
+ const ownerId = `${item.ownerType}:${encodeURIComponent(item.ownerId)}`;
20
+ const topicKey = normalizeTopicKey(item.topicKey);
21
+ if (!topicKey) {
22
+ const digest = sha256Hex(
23
+ JSON.stringify([
24
+ ownerId,
25
+ item.subjectType,
26
+ item.subjectId,
27
+ item.kind,
28
+ item.content
29
+ ])
30
+ );
31
+ const entityId2 = `explicit-${digest}`;
32
+ const stateId = `explicit-${digest}`;
33
+ let saved2;
34
+ await applyMemoryInterpreterMutation(db, ownerId, async () => {
35
+ const existing = await getMemoryStateVNext(db, ownerId, stateId);
36
+ if (existing?.retiredAt)
37
+ throw new Error("Explicit memory conflicts with a retired state");
38
+ const entity = await getMemoryEntityVNext(db, ownerId, entityId2);
39
+ const createdAt = existing?.createdAt ?? item.createdAt;
40
+ const oldValue = existing?.value && typeof existing.value === "object" ? existing.value : {};
41
+ const confidence = Math.max(
42
+ Number(oldValue.confidence) || 0,
43
+ item.confidence ?? 0
44
+ );
45
+ const resident = oldValue.resident === true || item.resident === true;
46
+ const evidenceId = `explicit-${digest}-${sha256Hex(
47
+ JSON.stringify([
48
+ item.confidence,
49
+ item.sourceDialogId ?? null,
50
+ item.provenance ?? null
51
+ ])
52
+ ).slice(0, 24)}`;
53
+ const evidence = await getMemoryEvidenceVNextStrict(
54
+ db,
55
+ ownerId,
56
+ evidenceId
57
+ );
58
+ saved2 = {
59
+ ...item,
60
+ id: `vnext-state-${stateId}`,
61
+ createdAt,
62
+ confidence,
63
+ ...resident ? { resident: true } : {}
64
+ };
65
+ return {
66
+ action: existing ? "update" : "create",
67
+ reason: "Explicit memory save",
68
+ entities: entity ? [] : [
69
+ {
70
+ id: entityId2,
71
+ ownerId,
72
+ type: "concept",
73
+ name: item.content,
74
+ createdAt,
75
+ updatedAt: createdAt
76
+ }
77
+ ],
78
+ evidence: evidence ? [] : [
79
+ {
80
+ id: evidenceId,
81
+ ownerId,
82
+ text: item.content,
83
+ confidence: item.confidence,
84
+ ...item.provenance ? { provenance: item.provenance } : {},
85
+ sourceRef: item.sourceDialogId ? `dialog:${item.sourceDialogId}` : `explicit:${digest}`,
86
+ createdAt
87
+ }
88
+ ],
89
+ states: [
90
+ {
91
+ id: stateId,
92
+ ownerId,
93
+ entityId: entityId2,
94
+ facet: "explicit-memory",
95
+ text: item.content,
96
+ value: {
97
+ ...oldValue,
98
+ kind: item.kind,
99
+ subjectType: item.subjectType,
100
+ subjectId: item.subjectId,
101
+ confidence,
102
+ resident,
103
+ visibility: item.visibility,
104
+ tags: item.tags,
105
+ importance: item.importance,
106
+ patternKey: item.patternKey,
107
+ recurrenceEvidence: item.recurrenceEvidence,
108
+ provenance: item.provenance,
109
+ sourceKind: item.sourceKind,
110
+ sourceDialogId: item.sourceDialogId
111
+ },
112
+ evidenceIds: [
113
+ .../* @__PURE__ */ new Set([...existing?.evidenceIds ?? [], evidenceId])
114
+ ],
115
+ createdAt,
116
+ updatedAt: item.createdAt
117
+ }
118
+ ]
119
+ };
120
+ });
121
+ return saved2;
122
+ }
123
+ const topicDigest = sha256Hex(
124
+ JSON.stringify([
125
+ ownerId,
126
+ item.subjectType,
127
+ item.subjectId,
128
+ item.kind,
129
+ topicKey
130
+ ])
131
+ );
132
+ const entityId = `explicit-topic-${topicDigest}`;
133
+ const contentDigest = sha256Hex(
134
+ JSON.stringify([
135
+ ownerId,
136
+ item.subjectType,
137
+ item.subjectId,
138
+ item.kind,
139
+ item.content
140
+ ])
141
+ );
142
+ let saved;
143
+ await applyMemoryInterpreterMutation(db, ownerId, async () => {
144
+ const entity = await getMemoryEntityVNext(db, ownerId, entityId);
145
+ const entityStates = (await listMemoryStatesForEntityVNext(db, ownerId, entityId)).filter((state) => state.facet === "explicit-memory");
146
+ const activeStates = entityStates.filter((state) => !state.retiredAt);
147
+ const matchingCurrent = activeStates.find(
148
+ (state) => state.text === item.content
149
+ );
150
+ if (matchingCurrent) {
151
+ const stateId2 = matchingCurrent.id;
152
+ const createdAt2 = matchingCurrent.createdAt;
153
+ const oldValue = matchingCurrent.value && typeof matchingCurrent.value === "object" ? matchingCurrent.value : {};
154
+ const confidence2 = Math.max(
155
+ Number(oldValue.confidence) || 0,
156
+ item.confidence ?? 0
157
+ );
158
+ const resident2 = oldValue.resident === true || item.resident === true;
159
+ const existingSupersedes = Array.isArray(oldValue.supersedesStateIds) ? oldValue.supersedesStateIds.map(String) : void 0;
160
+ const evidenceId2 = `${stateId2}-${sha256Hex(
161
+ JSON.stringify([
162
+ item.confidence,
163
+ item.sourceDialogId ?? null,
164
+ item.provenance ?? null
165
+ ])
166
+ ).slice(0, 24)}`;
167
+ const evidence2 = await getMemoryEvidenceVNextStrict(
168
+ db,
169
+ ownerId,
170
+ evidenceId2
171
+ );
172
+ saved = {
173
+ ...item,
174
+ topicKey,
175
+ ...existingSupersedes?.length ? { supersedesStateIds: existingSupersedes } : {},
176
+ id: `vnext-state-${stateId2}`,
177
+ createdAt: createdAt2,
178
+ confidence: confidence2,
179
+ ...resident2 ? { resident: true } : {}
180
+ };
181
+ return {
182
+ action: "update",
183
+ reason: "Explicit memory save (topicKey idempotent update)",
184
+ entities: entity ? [] : [
185
+ {
186
+ id: entityId,
187
+ ownerId,
188
+ type: "concept",
189
+ subtype: "explicit-topic",
190
+ name: topicKey,
191
+ createdAt: createdAt2,
192
+ updatedAt: createdAt2
193
+ }
194
+ ],
195
+ evidence: evidence2 ? [] : [
196
+ {
197
+ id: evidenceId2,
198
+ ownerId,
199
+ text: item.content,
200
+ confidence: item.confidence,
201
+ ...item.provenance ? { provenance: item.provenance } : {},
202
+ sourceRef: item.sourceDialogId ? `dialog:${item.sourceDialogId}` : `explicit:${topicDigest}`,
203
+ createdAt: item.createdAt
204
+ }
205
+ ],
206
+ states: [
207
+ {
208
+ id: stateId2,
209
+ ownerId,
210
+ entityId,
211
+ facet: "explicit-memory",
212
+ text: item.content,
213
+ value: {
214
+ ...oldValue,
215
+ kind: item.kind,
216
+ subjectType: item.subjectType,
217
+ subjectId: item.subjectId,
218
+ confidence: confidence2,
219
+ resident: resident2,
220
+ visibility: item.visibility,
221
+ tags: item.tags,
222
+ importance: item.importance,
223
+ patternKey: item.patternKey,
224
+ recurrenceEvidence: item.recurrenceEvidence,
225
+ provenance: item.provenance,
226
+ sourceKind: item.sourceKind,
227
+ sourceDialogId: item.sourceDialogId,
228
+ topicKey,
229
+ ...existingSupersedes?.length ? { supersedesStateIds: existingSupersedes } : {}
230
+ },
231
+ evidenceIds: [
232
+ .../* @__PURE__ */ new Set([...matchingCurrent.evidenceIds, evidenceId2])
233
+ ],
234
+ createdAt: createdAt2,
235
+ updatedAt: item.createdAt
236
+ }
237
+ ]
238
+ };
239
+ }
240
+ const supersededIds = activeStates.map((state) => state.id);
241
+ const isSupersede = supersededIds.length > 0;
242
+ const version = entityStates.length + 1;
243
+ const stateId = `explicit-topic-${topicDigest.slice(0, 24)}-v${version}-${contentDigest.slice(0, 16)}`;
244
+ const createdAt = item.createdAt;
245
+ const confidence = item.confidence ?? 0;
246
+ const resident = item.resident === true;
247
+ const evidenceId = `${stateId}-${sha256Hex(
248
+ JSON.stringify([
249
+ item.confidence,
250
+ item.sourceDialogId ?? null,
251
+ item.provenance ?? null
252
+ ])
253
+ ).slice(0, 24)}`;
254
+ const evidence = await getMemoryEvidenceVNextStrict(
255
+ db,
256
+ ownerId,
257
+ evidenceId
258
+ );
259
+ const relations = supersededIds.map(
260
+ (oldId, idx) => ({
261
+ id: `rel-supersedes-${stateId}-${idx}`,
262
+ ownerId,
263
+ from: stateId,
264
+ type: "supersedes",
265
+ to: oldId,
266
+ createdAt
267
+ })
268
+ );
269
+ saved = {
270
+ ...item,
271
+ topicKey,
272
+ ...isSupersede ? { supersedesStateIds: supersededIds } : {},
273
+ id: `vnext-state-${stateId}`,
274
+ createdAt,
275
+ confidence,
276
+ ...resident ? { resident: true } : {}
277
+ };
278
+ return {
279
+ action: isSupersede ? "supersede" : "create",
280
+ reason: isSupersede ? "Explicit memory topicKey supersede" : "Explicit memory save (topicKey)",
281
+ entities: entity ? [] : [
282
+ {
283
+ id: entityId,
284
+ ownerId,
285
+ type: "concept",
286
+ subtype: "explicit-topic",
287
+ name: topicKey,
288
+ createdAt,
289
+ updatedAt: createdAt
290
+ }
291
+ ],
292
+ evidence: evidence ? [] : [
293
+ {
294
+ id: evidenceId,
295
+ ownerId,
296
+ text: item.content,
297
+ confidence: item.confidence,
298
+ ...item.provenance ? { provenance: item.provenance } : {},
299
+ sourceRef: item.sourceDialogId ? `dialog:${item.sourceDialogId}` : `explicit:${topicDigest}`,
300
+ createdAt
301
+ }
302
+ ],
303
+ states: [
304
+ {
305
+ id: stateId,
306
+ ownerId,
307
+ entityId,
308
+ facet: "explicit-memory",
309
+ text: item.content,
310
+ value: {
311
+ kind: item.kind,
312
+ subjectType: item.subjectType,
313
+ subjectId: item.subjectId,
314
+ confidence,
315
+ resident,
316
+ visibility: item.visibility,
317
+ tags: item.tags,
318
+ importance: item.importance,
319
+ patternKey: item.patternKey,
320
+ recurrenceEvidence: item.recurrenceEvidence,
321
+ provenance: item.provenance,
322
+ sourceKind: item.sourceKind,
323
+ sourceDialogId: item.sourceDialogId,
324
+ topicKey,
325
+ ...isSupersede ? { supersedesStateIds: supersededIds } : {}
326
+ },
327
+ evidenceIds: [evidenceId],
328
+ createdAt,
329
+ updatedAt: item.createdAt
330
+ }
331
+ ],
332
+ ...isSupersede ? { supersededStateIds: supersededIds, relations } : {}
333
+ };
334
+ });
335
+ return saved;
336
+ }
337
+
338
+ export {
339
+ rememberExplicitVNext
340
+ };