nolo-cli 0.6.1 → 0.8.0-alpha.10

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 (175) hide show
  1. package/_executeModel-CPDNUUQV.js +198 -0
  2. package/action-PAXRPJJF.js +27 -0
  3. package/addContentAction-CZVWF3QZ.js +25 -0
  4. package/addDialogAgentAction-CCIDTPHC.js +67 -0
  5. package/agentDeleteCommand-OSUMJMZM.js +323 -0
  6. package/agentEmailCommands-OQTJIPQU.js +621 -0
  7. package/agentListCommands-FATQEUYT.js +219 -0
  8. package/agentMachineCommands-6LZWF4GL.js +421 -0
  9. package/agentPullCommand-O2MTUAFR.js +122 -0
  10. package/agentRecordCommands-TIHFU65Z.js +89 -0
  11. package/agentRunCommand-R64Y3HCH.js +102 -0
  12. package/agentRunControl-K4VKNEHF.js +57 -0
  13. package/agentRuntimeLocal-6PIWAHLQ.js +99 -0
  14. package/agentSlice-TP4VARJF.js +41 -0
  15. package/authCommand-WXMD3IPR.js +574 -0
  16. package/authCommands-X74AFDTC.js +26 -0
  17. package/chunk-2EISRLRC.js +238 -0
  18. package/chunk-2FTTDCD4.js +675 -0
  19. package/chunk-2MALU52L.js +51 -0
  20. package/chunk-2TPUKEU7.js +1078 -0
  21. package/chunk-3ASDTTEI.js +1774 -0
  22. package/chunk-3EUW3WEO.js +8 -0
  23. package/chunk-3LY4F7SV.js +9293 -0
  24. package/chunk-4CQLVGRV.js +50 -0
  25. package/chunk-4IJYA27C.js +342 -0
  26. package/chunk-4SN6J65J.js +38 -0
  27. package/chunk-4VNS5WPM.js +42 -0
  28. package/chunk-572EKYLF.js +792 -0
  29. package/chunk-5MIDPSSK.js +206 -0
  30. package/chunk-5MMAK75Q.js +15 -0
  31. package/chunk-5VV37AT4.js +222 -0
  32. package/chunk-63W5N6P3.js +150 -0
  33. package/chunk-6A5EF6IR.js +929 -0
  34. package/chunk-6HYVJV7B.js +102 -0
  35. package/chunk-6P2WX5IA.js +3631 -0
  36. package/chunk-6WD3OOJS.js +20 -0
  37. package/chunk-ATNTHIZI.js +13 -0
  38. package/chunk-AUGHVUFE.js +69 -0
  39. package/chunk-AVMKZHBC.js +85 -0
  40. package/chunk-AZPCASRE.js +36 -0
  41. package/chunk-BNMT7YY5.js +34 -0
  42. package/chunk-BR2WP3DF.js +548 -0
  43. package/chunk-BSTNFPHD.js +231 -0
  44. package/chunk-BU4OPIXC.js +171 -0
  45. package/chunk-CF2WZF4N.js +134 -0
  46. package/chunk-CF7PE763.js +10 -0
  47. package/chunk-CKOJQDKR.js +198 -0
  48. package/chunk-CM54RSSA.js +206 -0
  49. package/chunk-CWMSB67P.js +34 -0
  50. package/chunk-DA2OEKS6.js +27 -0
  51. package/chunk-DFFIZ25G.js +30 -0
  52. package/chunk-DWLEOOGR.js +8 -0
  53. package/chunk-DZ3XJVET.js +231 -0
  54. package/chunk-EHLHSX7R.js +1433 -0
  55. package/chunk-ELRRLDWI.js +478 -0
  56. package/chunk-EYEEHCU4.js +3066 -0
  57. package/chunk-FQZWM5YX.js +628 -0
  58. package/chunk-G3SUCT4W.js +8 -0
  59. package/chunk-G5H7RNFL.js +807 -0
  60. package/chunk-GAKEBQD6.js +30 -0
  61. package/chunk-GBRG75BQ.js +86 -0
  62. package/chunk-H2RMRZJE.js +113 -0
  63. package/chunk-H33743XH.js +25 -0
  64. package/chunk-HD63YREL.js +19 -0
  65. package/chunk-HEIIIZBX.js +104 -0
  66. package/chunk-HNMXYYJR.js +12 -0
  67. package/chunk-HOMYP7GZ.js +2152 -0
  68. package/chunk-HZFOMJRA.js +4300 -0
  69. package/chunk-IAXBCTTE.js +175 -0
  70. package/chunk-IDZTNRP2.js +85 -0
  71. package/chunk-IHHA5Y2S.js +9013 -0
  72. package/chunk-ISNCLGUZ.js +146 -0
  73. package/chunk-IYQV26RA.js +138 -0
  74. package/chunk-J4576WMJ.js +91 -0
  75. package/chunk-JBTJAPUF.js +35 -0
  76. package/chunk-JZPBVBIY.js +94 -0
  77. package/chunk-KQHGZWSV.js +63 -0
  78. package/chunk-KUG52IAP.js +8 -0
  79. package/chunk-KX6YBIHG.js +8 -0
  80. package/chunk-LCBAMY2M.js +60 -0
  81. package/chunk-LM25IZBJ.js +902 -0
  82. package/chunk-LM6IYQ3F.js +16 -0
  83. package/chunk-M76ECQRD.js +13658 -0
  84. package/chunk-MRC4Q34M.js +188 -0
  85. package/chunk-NEMRK4EK.js +944 -0
  86. package/chunk-NXZGF7F7.js +2878 -0
  87. package/chunk-OF5H3QWS.js +300 -0
  88. package/chunk-OLZBQWZU.js +6 -0
  89. package/chunk-OOYVBFM7.js +191 -0
  90. package/chunk-OWOHNGCN.js +50 -0
  91. package/chunk-PN7AFLOK.js +3401 -0
  92. package/chunk-POCFIDGQ.js +562 -0
  93. package/chunk-Q6WACBKB.js +1949 -0
  94. package/chunk-QFV2OAIM.js +421 -0
  95. package/chunk-QJ6V2NIN.js +1447 -0
  96. package/chunk-QSJ3HFEF.js +8 -0
  97. package/chunk-QUWDTOUP.js +190 -0
  98. package/chunk-QYXLLLGL.js +4519 -0
  99. package/chunk-ROWQEJRP.js +139 -0
  100. package/chunk-S7Z2HMCN.js +25 -0
  101. package/chunk-TDIQFT2F.js +301 -0
  102. package/chunk-TILFE6LV.js +381 -0
  103. package/chunk-TKOUBWBO.js +24674 -0
  104. package/chunk-TYH5JE6N.js +27158 -0
  105. package/chunk-U4TRT5V4.js +246 -0
  106. package/chunk-U6VC4MU4.js +8 -0
  107. package/chunk-UAD2WT54.js +64 -0
  108. package/chunk-USZMK5UT.js +105 -0
  109. package/chunk-VEJLAVTC.js +2052 -0
  110. package/chunk-VF4K2QE6.js +21 -0
  111. package/chunk-VHBWHNVT.js +59 -0
  112. package/chunk-VIDPVFP3.js +20 -0
  113. package/chunk-VP4WJWKW.js +8882 -0
  114. package/chunk-VQ2AJRGD.js +148 -0
  115. package/chunk-W4NVOSFF.js +37 -0
  116. package/chunk-WWC7I6TA.js +8 -0
  117. package/chunk-X7W4TNB4.js +1550 -0
  118. package/chunk-XDVAYP26.js +537 -0
  119. package/chunk-XKIMRZO2.js +221 -0
  120. package/chunk-Y5GCAMGP.js +9 -0
  121. package/chunk-YWPXYBY7.js +360 -0
  122. package/chunk-Z4NR32XR.js +50 -0
  123. package/chunk-ZNFJWEN4.js +56 -0
  124. package/cliExecutor-DNE7TCC4.js +36 -0
  125. package/clipboardy-BVE3LVEH.js +12001 -0
  126. package/createAgentAutomationAction-KLKS2HGU.js +864 -0
  127. package/createDialogAction-Z33JMBF5.js +52 -0
  128. package/createPageAction-AQVNOAAI.js +169 -0
  129. package/db-HCJ5PRB5.js +271 -0
  130. package/dbSlice-C4UJLRZP.js +59 -0
  131. package/deleteFile-4SKGPHOZ.js +41 -0
  132. package/dialogCommands-W5PD6MZU.js +59 -0
  133. package/dialogSlice-RBJYVSAR.js +146 -0
  134. package/docCreateCommands-MM34S4Z3.js +215 -0
  135. package/docDeleteCommands-JJTU722V.js +176 -0
  136. package/docReadCommands-GLYDMCTU.js +129 -0
  137. package/docStore-5TYME4DO.js +96 -0
  138. package/docUpdateCommands-ZCGQ7URR.js +313 -0
  139. package/fetchMessages-JOCYIFKL.js +16 -0
  140. package/getPricing-PWPJ6MNV.js +30 -0
  141. package/handleSendMessageAction-KA2MRW6E.js +183 -0
  142. package/index.js +184 -112254
  143. package/lib-FYYBQIXS.js +19839 -0
  144. package/localDialogRead-D3BELSTF.js +26 -0
  145. package/localFirstLog-DHNOY2NA.js +19 -0
  146. package/localRuntimeAuthority-TEGCOWX4.js +471 -0
  147. package/localRuntimeDb-LGDF6FQP.js +12 -0
  148. package/machineCommands-ZB5WUSPF.js +774 -0
  149. package/machineInfo-M6KB6HZN.js +10 -0
  150. package/machineWsRunDispatch-GWCAPPCM.js +105 -0
  151. package/memoryCommands-O4MIPIWQ.js +476 -0
  152. package/models-XLEOET3E.js +9 -0
  153. package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
  154. package/package.json +3 -25
  155. package/read-RIJCIVKX.js +17 -0
  156. package/readDocTool-GZD2N3LO.js +16 -0
  157. package/readlineWorkspace-FEDY44AA.js +5357 -0
  158. package/removeDialogAgentAction-CXLST3N6.js +72 -0
  159. package/runAgentClientLoop-W4NKE64V.js +288 -0
  160. package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
  161. package/setDialogExtraReferencesAction-LP6VYGU7.js +59 -0
  162. package/setPrimaryDialogAgentAction-D3GGH23T.js +79 -0
  163. package/settingSlice-J4I3Z5H7.js +198 -0
  164. package/skillSummaryMarker-42HKSXYY.js +9 -0
  165. package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
  166. package/slateUtils-2M7MUTWX.js +19 -0
  167. package/spaceCommands-LC4FDAKE.js +450 -0
  168. package/spaceSlice-32XOGBEF.js +145 -0
  169. package/streamAgentChatTurn-YQW32AQH.js +4503 -0
  170. package/tableCommands-GOFP7QKA.js +1286 -0
  171. package/toolApiClient-QI3YBNWB.js +26 -0
  172. package/tools-XGTFRYD7.js +83 -0
  173. package/understanding-HCSFPE7R.js +318 -0
  174. package/updateCommands-VOSPKXFF.js +31 -0
  175. package/updateDialogTitleAction-4LHQDNHQ.js +185 -0
@@ -0,0 +1,929 @@
1
+ import {
2
+ chooseMemoryOwners,
3
+ loadMemoryCandidatesFromDb
4
+ } from "./chunk-HEIIIZBX.js";
5
+ import {
6
+ addContentToSpace,
7
+ prepareAndPersistMessage,
8
+ uiAskChoiceFunc,
9
+ uiAskChoiceFunctionSchema
10
+ } from "./chunk-TKOUBWBO.js";
11
+ import {
12
+ require_date_fns
13
+ } from "./chunk-M76ECQRD.js";
14
+ import {
15
+ PLATFORM_HOSTED_GLM_52_MODEL,
16
+ PLATFORM_HOSTED_GLM_PRICE
17
+ } from "./chunk-572EKYLF.js";
18
+ import {
19
+ PLATFORM_HOSTED_KIMI_PROVIDER
20
+ } from "./chunk-BR2WP3DF.js";
21
+ import {
22
+ extractCustomId
23
+ } from "./chunk-DFFIZ25G.js";
24
+ import {
25
+ read,
26
+ readAndWait,
27
+ removeCachedEntity,
28
+ upsertSSREntity,
29
+ write
30
+ } from "./chunk-G5H7RNFL.js";
31
+ import {
32
+ createAgentKey,
33
+ createDialogKey,
34
+ createKey,
35
+ dialogMessageRange
36
+ } from "./chunk-PN7AFLOK.js";
37
+ import {
38
+ selectIdentityUserId
39
+ } from "./chunk-EYEEHCU4.js";
40
+ import {
41
+ asTrimmedString
42
+ } from "./chunk-3EUW3WEO.js";
43
+ import {
44
+ asOptionalPositiveFiniteNumber
45
+ } from "./chunk-U6VC4MU4.js";
46
+ import {
47
+ asOptionalTrimmedString
48
+ } from "./chunk-G3SUCT4W.js";
49
+ import {
50
+ isRecord
51
+ } from "./chunk-KUG52IAP.js";
52
+ import {
53
+ __toESM
54
+ } from "./chunk-4VNS5WPM.js";
55
+
56
+ // packages/chat/dialog/actions/createDialogAction.ts
57
+ var import_date_fns = __toESM(require_date_fns());
58
+
59
+ // packages/ai/skills/builtinObjectSkills.ts
60
+ var BUILTIN_OBJECT_SKILL_IDS = {
61
+ table: "builtin-table-skill-v1",
62
+ doc: "builtin-doc-skill-v1",
63
+ code: "builtin-code-skill-v1",
64
+ image: "builtin-image-skill-v1",
65
+ file: "builtin-file-skill-v1"
66
+ };
67
+ var SKILL_DEFS = {
68
+ doc: {
69
+ id: BUILTIN_OBJECT_SKILL_IDS.doc,
70
+ name: "\u6587\u6863\u7F16\u8F91\u6280\u80FD",
71
+ description: "\u63D0\u4F9B\u6587\u6863\u8BFB\u53D6\u4E0E\u66F4\u65B0\u80FD\u529B\uFF0C\u4F9B\u6587\u6863\u52A9\u624B\u4F7F\u7528\u3002",
72
+ toolNames: ["readDoc", "updateDoc"],
73
+ promptPatch: [
74
+ "\u6587\u6863\u7F16\u8F91\u6307\u5357\uFF1A",
75
+ "1. \u4FEE\u6539\u524D\u5148 readDoc \u8BFB\u53D6\u5F53\u524D\u6587\u6863\u771F\u503C\uFF0C\u518D\u57FA\u4E8E\u73B0\u6709\u5185\u5BB9\u7528 updateDoc \u505A\u5B9A\u70B9\u589E\u91CF\u7F16\u8F91\u3002",
76
+ "2. \u4E0D\u8981\u8131\u79BB\u73B0\u6709\u5185\u5BB9\u7A7A\u60F3\u91CD\u5199\uFF1B\u6DA6\u8272/\u6539\u5199/\u7EED\u5199\u90FD\u5E94\u4FDD\u7559\u7528\u6237\u539F\u6709\u7684\u7ED3\u6784\u4E0E\u4E8B\u5B9E\u3002"
77
+ ].join("\n"),
78
+ keywords: ["\u6587\u6863", "\u6DA6\u8272", "\u6539\u5199", "\u7EED\u5199", "\u6392\u7248", "\u6587\u7AE0", "document", "polish"]
79
+ },
80
+ table: {
81
+ id: BUILTIN_OBJECT_SKILL_IDS.table,
82
+ name: "\u8868\u683C\u7F16\u8F91\u6280\u80FD",
83
+ description: "\u63D0\u4F9B\u8868\u683C\u521B\u5EFA\u3001\u67E5\u8BE2\u3001\u65B0\u589E\u3001\u66F4\u65B0\u4E0E\u5220\u9664\u80FD\u529B\uFF0C\u4F9B\u8868\u683C\u52A9\u624B\u4F7F\u7528\u3002",
84
+ toolNames: [
85
+ "createTable",
86
+ "addTableRow",
87
+ "addTableRows",
88
+ "queryTableRows",
89
+ "updateTableRow",
90
+ "deleteTableRow"
91
+ ],
92
+ promptPatch: [
93
+ "\u8868\u683C\u64CD\u4F5C\u6307\u5357\uFF1A",
94
+ "1. \u7528\u6237\u8981\u65B0\u5EFA\u8868\u683C\u65F6\uFF0C\u8C03\u7528 createTable\uFF0C\u5E76\u4ECE\u9700\u6C42\u63A8\u65AD\u5408\u7406\u7684\u5B57\u6BB5\u8BBE\u8BA1\uFF08\u5B57\u6BB5\u540D\u3001\u7C7B\u578B\u3001\u5FC5\u586B\u3001\u53EF\u9009\u503C\uFF09\u3002",
95
+ "2. \u65B0\u589E\u8BB0\u5F55\u5FC5\u987B\u8C03\u7528 addTableRow / addTableRows\uFF0C\u4E0D\u8981\u53EA\u5728\u56DE\u7B54\u91CC\u53E3\u5934\u63CF\u8FF0\u3002",
96
+ "3. addTableRow \u7684 values \u662F\u5BF9\u8C61\uFF0Ckey \u5FC5\u987B\u7528\u5B57\u6BB5\u540D\uFF08name\uFF0C\u4E0D\u662F\u663E\u793A\u540D label\uFF09\uFF1B\u5C3D\u91CF\u4ECE\u7528\u6237\u81EA\u7136\u8BED\u8A00\u63A8\u65AD\u5E76\u586B\u6EE1\u76F8\u5173\u5B57\u6BB5\uFF0C\u5FC5\u586B\u5B57\u6BB5\u5C24\u5176\u6CE8\u610F\uFF1B\u7528\u6237\u6CA1\u63D0\u5230\u7684\u5B57\u6BB5\u53EF\u7528\u7A7A\u5B57\u7B26\u4E32\u6216 null \u5360\u4F4D\uFF1B\u7EDD\u4E0D\u8981\u4F20\u7A7A\u5BF9\u8C61 {}\u3002",
97
+ "4. \u66F4\u65B0\u6216\u5220\u9664\u524D\uFF0C\u5148\u7528 queryTableRows \u786E\u8BA4\u76EE\u6807\u884C\uFF0C\u5FC5\u8981\u65F6\u5411\u7528\u6237\u786E\u8BA4\u76EE\u6807\u884C/\u5B57\u6BB5\u3002"
98
+ ].join("\n"),
99
+ keywords: ["\u8868\u683C", "\u5EFA\u8868", "\u65B0\u589E\u4E00\u884C", "\u8BB0\u5F55", "\u5B57\u6BB5", "table", "spreadsheet", "csv"]
100
+ },
101
+ code: {
102
+ id: BUILTIN_OBJECT_SKILL_IDS.code,
103
+ name: "\u7F16\u7801\u98CE\u683C\u6280\u80FD",
104
+ description: "\u63D0\u4F9B\u7F16\u7801\u89C4\u8303\u4E0E\u98CE\u683C\u7EA6\u675F\uFF0C\u4F9B\u4EE3\u7801\u4EFB\u52A1\u4F7F\u7528\u3002",
105
+ toolNames: [],
106
+ promptPatch: [
107
+ "\u7F16\u7801\u98CE\u683C\u4E0E\u89C4\u8303\u6307\u5357\uFF1A",
108
+ "1. \u6587\u4EF6\u62C6\u5206\uFF1A\u4F18\u5148\u62C6\u5206\u4E3A\u591A\u6587\u4EF6\uFF08MANY SMALL FILES\uFF09\uFF0C\u5178\u578B\u957F\u5EA6 200-400 \u884C\uFF0C\u5355\u6587\u4EF6\u6700\u591A 800 \u884C\uFF08800 max\uFF09\u3002",
109
+ "2. \u51FD\u6570\u4E0E\u5D4C\u5957\uFF1A\u51FD\u6570\u4FDD\u6301\u77ED\u5C0F\uFF08<50 lines\uFF09\uFF0C\u4F18\u5148\u4F7F\u7528 early returns \u63D0\u524D\u8FD4\u56DE\uFF0C\u5D4C\u5957\u5C42\u7EA7\u4E0D\u8D85\u8FC7 4 \u5C42\uFF08nesting \u22644\uFF09\u3002",
110
+ "3. \u4E0D\u53EF\u53D8\u6027\uFF08immutability\uFF09\uFF1A\u4FDD\u6301\u6570\u636E\u4E0D\u53EF\u53D8\uFF0C\u4E0D\u8981\u539F\u5730 mutate \u73B0\u6709\u5BF9\u8C61\u6216\u6570\u7EC4\uFF0C\u5FC5\u987B\u8FD4\u56DE\u65B0\u5BF9\u8C61/\u6570\u7EC4\u3002",
111
+ "4. \u9519\u8BEF\u5904\u7406\u4E0E\u6821\u9A8C\uFF1A\u663E\u5F0F\u5904\u7406\u6240\u6709\u9519\u8BEF\uFF08explicit error handling\uFF09\uFF0C\u5728\u7CFB\u7EDF\u8FB9\u754C\u5B8C\u6210\u6821\u9A8C\uFF08validate at boundaries\uFF09\uFF0C\u4E0D\u9690\u5F0F\u541E\u9519\u3002",
112
+ "5. \u5B8C\u6210\u524D Checklist\uFF1A\u5B8C\u6210\u524D\u81EA\u67E5\u51FD\u6570/\u6587\u4EF6\u5C3A\u5BF8\u3001\u5D4C\u5957\u6DF1\u5EA6\u3001\u4E0D\u53EF\u53D8\u6027\u4E0E\u8FB9\u754C\u9519\u8BEF\u5904\u7406\u3002"
113
+ ].join("\n"),
114
+ keywords: ["\u4EE3\u7801", "\u7F16\u7801", "\u91CD\u6784", "\u4FEEbug", "code", "refactor", "bugfix", "coding-style"]
115
+ },
116
+ image: {
117
+ id: BUILTIN_OBJECT_SKILL_IDS.image,
118
+ name: "\u56FE\u7247\u5206\u6790\u6280\u80FD",
119
+ description: "\u63D0\u4F9B\u56FE\u7247\u7406\u89E3\u3001\u63CF\u8FF0\u4E0E\u6574\u7406\u5EFA\u8BAE\u80FD\u529B\uFF0C\u4F9B\u56FE\u7247\u52A9\u624B\u4F7F\u7528\u3002",
120
+ toolNames: [],
121
+ promptPatch: [
122
+ "\u56FE\u7247\u5206\u6790\u6307\u5357\uFF1A",
123
+ "1. \u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u56F4\u7ED5\u5F53\u524D\u56FE\u7247\u505A\u7406\u89E3\u3001\u63CF\u8FF0\u3001\u63D0\u70BC\u91CD\u70B9\u3001\u7ED9\u51FA\u547D\u540D/\u6574\u7406\u5EFA\u8BAE\u548C\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002",
124
+ "2. \u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5177\u5907\u590D\u6742\u56FE\u7247\u7F16\u8F91\u80FD\u529B\uFF1B\u5982\u679C\u7528\u6237\u8981\u66F4\u5F3A\u64CD\u4F5C\uFF0C\u660E\u786E\u8BF4\u660E\u5F53\u524D\u53EF\u505A\u7684\u662F\u5206\u6790\u4E0E\u7EC4\u7EC7\u3002"
125
+ ].join("\n"),
126
+ keywords: ["\u56FE\u7247", "\u56FE\u50CF", "\u5206\u6790", "\u63CF\u8FF0", "\u547D\u540D", "\u6574\u7406", "image", "photo", "picture"]
127
+ },
128
+ file: {
129
+ id: BUILTIN_OBJECT_SKILL_IDS.file,
130
+ name: "\u6587\u4EF6\u5904\u7406\u6280\u80FD",
131
+ description: "\u63D0\u4F9B\u6587\u4EF6\u7406\u89E3\u3001\u6574\u7406\u4E0E\u5904\u7406\u5EFA\u8BAE\u80FD\u529B\uFF0C\u4F9B\u6587\u4EF6\u52A9\u624B\u4F7F\u7528\u3002",
132
+ toolNames: [],
133
+ promptPatch: [
134
+ "\u6587\u4EF6\u5904\u7406\u6307\u5357\uFF1A",
135
+ "1. \u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u56F4\u7ED5\u5F53\u524D\u6587\u4EF6\u63D0\u4F9B\u7406\u89E3\u3001\u6574\u7406\u3001\u63D0\u53D6\u4E0E\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002",
136
+ "2. \u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5B8C\u6210\u6587\u4EF6\u5185\u5BB9\u89E3\u6790\uFF1B\u5FC5\u8981\u65F6\u660E\u786E\u544A\u8BC9\u7528\u6237\u5F53\u524D\u66F4\u591A\u662F\u5360\u4F4D\u578B\u5DE5\u4F5C\u6D41\u5165\u53E3\uFF0C\u7B49\u5F85\u540E\u7EED\u63A5\u5165\u66F4\u5B8C\u6574\u7684\u6587\u4EF6\u5904\u7406\u80FD\u529B\u3002"
137
+ ].join("\n"),
138
+ keywords: ["\u6587\u4EF6", "\u89E3\u6790", "\u63D0\u53D6", "\u6574\u7406", "\u5904\u7406", "file", "document", "pdf"]
139
+ }
140
+ };
141
+ function buildBuiltinObjectSkillDbKey(kind, userId) {
142
+ return createKey("page" /* DOC */, userId, BUILTIN_OBJECT_SKILL_IDS[kind]);
143
+ }
144
+ function buildBuiltinObjectSkillReference(kind, userId) {
145
+ return {
146
+ dbKey: buildBuiltinObjectSkillDbKey(kind, userId),
147
+ title: SKILL_DEFS[kind].name,
148
+ type: "instruction"
149
+ };
150
+ }
151
+
152
+ // packages/chat/dialog/objectAssistantRegistry.ts
153
+ var OBJECT_ASSISTANT_TO_SKILL = {
154
+ page: "doc",
155
+ table: "table",
156
+ image: "image",
157
+ file: "file"
158
+ };
159
+ var BUILTIN_OBJECT_ASSISTANT_IDS = {
160
+ page: "builtin-doc-assistant-v1",
161
+ table: "builtin-table-assistant-v1",
162
+ image: "builtin-image-assistant-v1",
163
+ file: "builtin-file-assistant-v1"
164
+ };
165
+ var resolveBuiltinObjectAssistantKindByKey = (agentKey, userId) => {
166
+ if (!agentKey || !userId) return null;
167
+ const entries = Object.entries(BUILTIN_OBJECT_ASSISTANT_IDS);
168
+ for (const [kind, id] of entries) {
169
+ if (agentKey === createAgentKey.private(userId, id)) {
170
+ return kind;
171
+ }
172
+ }
173
+ return null;
174
+ };
175
+ var buildBuiltinObjectAssistantAgent = (kind, userId) => {
176
+ const id = BUILTIN_OBJECT_ASSISTANT_IDS[kind];
177
+ const dbKey = createAgentKey.private(userId, id);
178
+ const now = Date.now();
179
+ const common = {
180
+ id,
181
+ dbKey,
182
+ type: "agent" /* AGENT */,
183
+ userId,
184
+ isPublic: false,
185
+ provider: PLATFORM_HOSTED_KIMI_PROVIDER,
186
+ model: PLATFORM_HOSTED_GLM_52_MODEL,
187
+ apiSource: "platform",
188
+ useServerProxy: true,
189
+ inputPrice: PLATFORM_HOSTED_GLM_PRICE.input,
190
+ outputPrice: PLATFORM_HOSTED_GLM_PRICE.output,
191
+ createdAt: now,
192
+ updatedAt: String(now),
193
+ dialogCount: 0,
194
+ messageCount: 0,
195
+ tokenCount: 0,
196
+ tags: ["builtin", "sidebar-assistant", kind],
197
+ references: [buildBuiltinObjectSkillReference(OBJECT_ASSISTANT_TO_SKILL[kind], userId)]
198
+ };
199
+ switch (kind) {
200
+ case "page":
201
+ return {
202
+ ...common,
203
+ name: "\u6587\u6863\u52A9\u624B",
204
+ introduction: "\u5E2E\u4F60\u6DA6\u8272\u3001\u6539\u5199\u3001\u7EED\u5199\u3001\u6574\u7406\u7ED3\u6784\u4E0E\u6392\u7248\u7684\u6587\u6863\u52A9\u624B\u3002",
205
+ greeting: {
206
+ text: "\u4F60\u597D\uFF0C\u6211\u662F\u6587\u6863\u52A9\u624B \u270D\uFE0F\n\n\u4F60\u53EF\u4EE5\u76F4\u63A5\u5BF9\u6211\u8BF4\uFF1A\n\u2022 \u5E2E\u6211\u6DA6\u8272\u8FD9\u7BC7\u6587\u7AE0\n\u2022 \u628A\u7ED3\u6784\u6574\u7406\u5F97\u66F4\u6E05\u695A\n\u2022 \u7ED9\u8FD9\u4E00\u6BB5\u6539\u6210\u66F4\u53E3\u8BED/\u66F4\u4E13\u4E1A\n\u2022 \u5E2E\u6211\u8865\u4E00\u4E2A\u5F00\u5934\u6216\u7ED3\u5C3E",
207
+ menu: [
208
+ { id: "polish", label: "\u6DA6\u8272\u5F53\u524D\u6587\u6863", userMessage: "\u5E2E\u6211\u6DA6\u8272\u5F53\u524D\u6587\u6863\uFF0C\u8BA9\u8868\u8FBE\u66F4\u987A" },
209
+ { id: "structure", label: "\u6574\u7406\u7ED3\u6784", userMessage: "\u5E2E\u6211\u6574\u7406\u5F53\u524D\u6587\u6863\u7ED3\u6784\uFF0C\u770B\u770B\u6807\u9898\u548C\u6BB5\u843D\u600E\u4E48\u66F4\u6E05\u695A" },
210
+ { id: "continue", label: "\u7EE7\u7EED\u5199", userMessage: "\u57FA\u4E8E\u5F53\u524D\u6587\u6863\u7EE7\u7EED\u5F80\u4E0B\u5199" }
211
+ ]
212
+ },
213
+ prompt: "\u4F60\u662F\u4E00\u4E2A\u6587\u6863\u7F16\u8F91\u52A9\u624B\u3002\u4F18\u5148\u57FA\u4E8E\u5F53\u524D\u6587\u6863\u505A\u589E\u91CF\u4FEE\u6539\uFF0C\u4E0D\u8981\u8131\u79BB\u73B0\u6709\u5185\u5BB9\u7A7A\u60F3\u91CD\u5199\u3002\u91CD\u70B9\u5E2E\u52A9\u7528\u6237\u6DA6\u8272\u3001\u6539\u5199\u3001\u7EED\u5199\u3001\u91CD\u7EC4\u7ED3\u6784\u3001\u751F\u6210\u6807\u9898\u548C\u6458\u8981\u3002\u6D89\u53CA\u4FEE\u6539\u65F6\uFF0C\u4F18\u5148\u8BFB\u53D6\u5F53\u524D\u6587\u6863\u771F\u503C\uFF0C\u518D\u8FDB\u884C\u5B9A\u70B9\u7F16\u8F91\u3002"
214
+ };
215
+ case "table":
216
+ return {
217
+ ...common,
218
+ name: "\u8868\u683C\u52A9\u624B",
219
+ introduction: "\u5E2E\u4F60\u7406\u89E3\u8868\u7ED3\u6784\u3001\u8865\u6570\u636E\u3001\u6539\u6570\u636E\u548C\u6574\u7406\u5B57\u6BB5\u7684\u8868\u683C\u52A9\u624B\u3002",
220
+ greeting: {
221
+ text: "\u4F60\u597D\uFF0C\u6211\u662F\u8868\u683C\u52A9\u624B \u{1F4CA}\n\n\u4F60\u53EF\u4EE5\u76F4\u63A5\u5BF9\u6211\u8BF4\uFF1A\n\u2022 \u5E2E\u6211\u770B\u770B\u8FD9\u5F20\u8868\u8FD8\u7F3A\u4EC0\u4E48\u5B57\u6BB5\n\u2022 \u7ED9\u8868\u91CC\u52A0\u4E00\u6761\u8BB0\u5F55\n\u2022 \u628A\u67D0\u4E00\u5217\u7EDF\u4E00\u6539\u4E00\u4E0B\n\u2022 \u6309\u8FD9\u4E2A\u6761\u4EF6\u5E2E\u6211\u6574\u7406\u6570\u636E",
222
+ menu: [
223
+ { id: "inspect", label: "\u770B\u770B\u8FD9\u5F20\u8868", userMessage: "\u5E2E\u6211\u770B\u770B\u5F53\u524D\u8FD9\u5F20\u8868\u7684\u7ED3\u6784\u548C\u53EF\u6539\u8FDB\u70B9" },
224
+ { id: "add-row", label: "\u65B0\u589E\u6570\u636E", userMessage: "\u6211\u60F3\u5F80\u5F53\u524D\u8868\u91CC\u65B0\u589E\u4E00\u6761\u6570\u636E" },
225
+ { id: "fix-data", label: "\u6279\u91CF\u6539\u6570\u636E", userMessage: "\u6211\u60F3\u4FEE\u6539\u5F53\u524D\u8868\u91CC\u7684\u90E8\u5206\u6570\u636E" }
226
+ ]
227
+ },
228
+ prompt: "\u4F60\u662F\u4E00\u4E2A\u8868\u683C\u7F16\u8F91\u52A9\u624B\u3002\u4F18\u5148\u5E2E\u52A9\u7528\u6237\u7406\u89E3\u5F53\u524D\u8868\u7684\u5B57\u6BB5\u3001\u8BB0\u5F55\u548C\u7ED3\u6784\uFF0C\u7136\u540E\u518D\u505A\u65B0\u589E\u3001\u67E5\u8BE2\u3001\u66F4\u65B0\u6216\u5220\u9664\u3002\u5BF9\u7528\u6237\u8BF4\u201C\u8FD9\u4E2A\u8868\u91CC\u7684 xxx \u600E\u4E48\u600E\u4E48\u6539\u201D\u65F6\uFF0C\u9ED8\u8BA4\u7406\u89E3\u4E3A\u5F53\u524D\u805A\u7126\u6216\u6700\u8FD1\u63D0\u5230\u7684\u8868\uFF1B\u5FC5\u8981\u65F6\u5148\u786E\u8BA4\u76EE\u6807\u884C/\u5B57\u6BB5\u3002"
229
+ };
230
+ case "image":
231
+ return {
232
+ ...common,
233
+ name: "\u56FE\u7247\u52A9\u624B",
234
+ introduction: "\u5F53\u524D\u5148\u4F5C\u4E3A\u56FE\u7247\u5206\u6790\u4E0E\u5904\u7406\u5EFA\u8BAE\u5165\u53E3\uFF0C\u540E\u7EED\u53EF\u6269\u5C55\u4E3A\u66F4\u5B8C\u6574\u7684\u56FE\u7247\u5DE5\u4F5C\u6D41\u52A9\u624B\u3002",
235
+ greeting: "\u4F60\u597D\uFF0C\u6211\u662F\u56FE\u7247\u52A9\u624B \u{1F5BC}\uFE0F\n\n\u76EE\u524D\u6211\u53EF\u4EE5\u5148\u5E2E\u4F60\u5206\u6790\u56FE\u7247\u5185\u5BB9\u3001\u63D0\u70BC\u91CD\u70B9\u3001\u7ED9\u51FA\u547D\u540D/\u6574\u7406\u5EFA\u8BAE\u3002\u540E\u7EED\u6211\u4EEC\u518D\u628A\u66F4\u6DF1\u7684\u56FE\u7247\u7F16\u8F91\u5DE5\u4F5C\u6D41\u63A5\u4E0A\u3002",
236
+ prompt: "\u4F60\u662F\u4E00\u4E2A\u56FE\u7247\u52A9\u624B\u3002\u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u662F\u56F4\u7ED5\u5F53\u524D\u56FE\u7247\u505A\u7406\u89E3\u3001\u63CF\u8FF0\u3001\u6574\u7406\u5EFA\u8BAE\u548C\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002\u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5177\u5907\u590D\u6742\u56FE\u7247\u7F16\u8F91\u80FD\u529B\uFF1B\u5982\u679C\u7528\u6237\u8981\u66F4\u5F3A\u64CD\u4F5C\uFF0C\u660E\u786E\u8BF4\u660E\u5F53\u524D\u53EF\u505A\u7684\u662F\u5206\u6790\u4E0E\u7EC4\u7EC7\u3002"
237
+ };
238
+ case "file":
239
+ return {
240
+ ...common,
241
+ name: "\u6587\u4EF6\u52A9\u624B",
242
+ introduction: "\u5F53\u524D\u5148\u4F5C\u4E3A\u6587\u4EF6\u7406\u89E3\u4E0E\u5904\u7406\u5EFA\u8BAE\u5165\u53E3\uFF0C\u540E\u7EED\u53EF\u6269\u5C55\u4E3A\u66F4\u5B8C\u6574\u7684\u6587\u4EF6\u5DE5\u4F5C\u6D41\u52A9\u624B\u3002",
243
+ greeting: "\u4F60\u597D\uFF0C\u6211\u662F\u6587\u4EF6\u52A9\u624B \u{1F4CE}\n\n\u76EE\u524D\u6211\u53EF\u4EE5\u5148\u5E2E\u4F60\u7406\u89E3\u8FD9\u4E2A\u6587\u4EF6\u9002\u5408\u600E\u4E48\u5904\u7406\u3001\u600E\u4E48\u63D0\u53D6\u4FE1\u606F\u3001\u4E0B\u4E00\u6B65\u5E94\u8BE5\u505A\u4EC0\u4E48\u3002\u540E\u7EED\u6211\u4EEC\u518D\u628A\u66F4\u5B8C\u6574\u7684\u6587\u4EF6\u5904\u7406\u6D41\u7A0B\u63A5\u4E0A\u3002",
244
+ prompt: "\u4F60\u662F\u4E00\u4E2A\u6587\u4EF6\u52A9\u624B\u3002\u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u662F\u56F4\u7ED5\u5F53\u524D\u6587\u4EF6\u63D0\u4F9B\u7406\u89E3\u3001\u6574\u7406\u3001\u63D0\u53D6\u4E0E\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002\u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5B8C\u6210\u6587\u4EF6\u5185\u5BB9\u89E3\u6790\uFF1B\u5FC5\u8981\u65F6\u660E\u786E\u544A\u8BC9\u7528\u6237\u5F53\u524D\u66F4\u591A\u662F\u5360\u4F4D\u578B\u5DE5\u4F5C\u6D41\u5165\u53E3\u3002"
245
+ };
246
+ }
247
+ };
248
+ var buildBuiltinObjectAssistantAgentFromKey = (agentKey, userId) => {
249
+ const kind = resolveBuiltinObjectAssistantKindByKey(agentKey, userId);
250
+ if (!kind || !userId) return null;
251
+ return buildBuiltinObjectAssistantAgent(kind, userId);
252
+ };
253
+
254
+ // packages/ai/memory/policy.ts
255
+ function isPublicAgentKey(agentKey) {
256
+ return typeof agentKey === "string" && /^agent-pub-/i.test(agentKey.trim());
257
+ }
258
+ function resolveAgentMemoryPolicy(input) {
259
+ const publicAgent = input.isPublicAgent === true || isPublicAgentKey(input.agentKey);
260
+ if (publicAgent) {
261
+ return {
262
+ includeUserSubject: false,
263
+ ownerFallback: "onSubjectMiss",
264
+ allowDynamicGreetingMemory: false
265
+ };
266
+ }
267
+ return {
268
+ includeUserSubject: true,
269
+ ownerFallback: "always",
270
+ allowDynamicGreetingMemory: true
271
+ };
272
+ }
273
+
274
+ // packages/ai/memory/recentRelationshipRecap.ts
275
+ var MIN_RECAP_LENGTH = 12;
276
+ var MIN_RECAP_GAP_MS = 30 * 60 * 1e3;
277
+ var shouldUseRecentRelationshipRecap = (input) => {
278
+ if (!input.userId || !input.agentKey) return false;
279
+ if (!resolveAgentMemoryPolicy({ agentKey: input.agentKey }).allowDynamicGreetingMemory) {
280
+ return false;
281
+ }
282
+ if ((input.agentsCount ?? 0) !== 1) return false;
283
+ if (input.inheritFromDialogKey) return false;
284
+ if (input.skipGreeting) return false;
285
+ if (input.triggerType && input.triggerType !== "user") return false;
286
+ return true;
287
+ };
288
+ var CONTINUATION_CUE_PATTERNS = [
289
+ "\u8FD8\u6CA1",
290
+ "\u8FD8\u5728",
291
+ "\u7EE7\u7EED",
292
+ "\u63A5\u7740",
293
+ "\u4E0B\u4E00\u6B65",
294
+ "\u540E\u9762",
295
+ "\u4E4B\u540E",
296
+ "\u6253\u7B97",
297
+ "\u51C6\u5907",
298
+ "\u60F3",
299
+ "\u7EA0\u7ED3",
300
+ "\u5361\u4F4F",
301
+ "\u6CA1\u60F3\u597D",
302
+ "\u4E0D\u786E\u5B9A",
303
+ "\u5982\u4F55",
304
+ "\u600E\u4E48",
305
+ "?",
306
+ "\uFF1F"
307
+ ];
308
+ var clip = (text, max = 140) => text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}\u2026`;
309
+ var normalizeText = (value) => asTrimmedString(value);
310
+ var contentToText = (content) => {
311
+ if (typeof content === "string") return content.trim();
312
+ if (Array.isArray(content)) {
313
+ return content.map(
314
+ (part) => part && typeof part === "object" && "text" in part ? normalizeText(part.text) : ""
315
+ ).filter(Boolean).join("\n").trim();
316
+ }
317
+ return "";
318
+ };
319
+ var toTimestamp = (record) => {
320
+ return asOptionalPositiveFiniteNumber(
321
+ Date.parse(normalizeText(record.updatedAt))
322
+ ) ?? asOptionalPositiveFiniteNumber(
323
+ Date.parse(normalizeText(record.createdAt))
324
+ ) ?? 0;
325
+ };
326
+ var chooseRecapText = (record) => {
327
+ const summary = normalizeText(record.summary);
328
+ if (isMeaningfulRecapText(summary)) return clip(summary, 160);
329
+ const title = normalizeText(record.title);
330
+ if (isMeaningfulRecapText(title)) return clip(title, 80);
331
+ return "";
332
+ };
333
+ var loadLastAssistantMessageText = async (db, dialogKey) => {
334
+ const dialogId = extractCustomId(dialogKey);
335
+ if (!dialogId) return "";
336
+ const range = dialogMessageRange(dialogId);
337
+ let iterator = db.iterator({
338
+ gte: range.start,
339
+ lte: range.end,
340
+ reverse: true
341
+ });
342
+ if (iterator && typeof iterator.then === "function") {
343
+ iterator = await iterator;
344
+ }
345
+ for await (const [, value] of iterator) {
346
+ const message = value ?? {};
347
+ const role = normalizeText(message.role ?? message.authorRole);
348
+ if (role !== "assistant") continue;
349
+ const text = contentToText(message.content);
350
+ if (isMeaningfulRecapText(text)) return clip(text, 160);
351
+ }
352
+ return "";
353
+ };
354
+ var isLikelyTimestampTitle = (text) => /^\d{1,2}-\d{1,2}\s+\d{1,2}:\d{2}$/.test(text);
355
+ var isMeaningfulRecapText = (text) => {
356
+ const normalized = normalizeText(text);
357
+ if (!normalized) return false;
358
+ if (normalized.length < MIN_RECAP_LENGTH) return false;
359
+ if (isLikelyTimestampTitle(normalized)) return false;
360
+ if (/^(继续|新对话|测试|test|hello|hi)$/i.test(normalized)) return false;
361
+ return true;
362
+ };
363
+ var resolveRecentRelationshipRecap = async (input) => {
364
+ const { db, userId, agentKey, currentSpaceId, limit = 40 } = input;
365
+ if (!db) return { recap: null, reason: "no-db" };
366
+ if (!userId || !agentKey) return { recap: null, reason: "missing-input" };
367
+ const range = createDialogKey.rangeOfUser(userId);
368
+ const matches = [];
369
+ let scanned = 0;
370
+ let iterator = db.iterator({
371
+ gte: range.start,
372
+ lte: range.end,
373
+ reverse: true
374
+ });
375
+ if (iterator && typeof iterator.then === "function") {
376
+ iterator = await iterator;
377
+ }
378
+ for await (const [, value] of iterator) {
379
+ scanned += 1;
380
+ const record = value ?? {};
381
+ if (!Array.isArray(record.cybots) || !record.cybots.includes(agentKey)) {
382
+ if (scanned >= limit && matches.length > 0) break;
383
+ continue;
384
+ }
385
+ matches.push(record);
386
+ if (matches.length >= limit) break;
387
+ }
388
+ if (matches.length === 0) return { recap: null, reason: "no-match" };
389
+ const sorted = [...matches].sort((a, b) => {
390
+ const aSameSpace = currentSpaceId && a.spaceId === currentSpaceId ? 1 : 0;
391
+ const bSameSpace = currentSpaceId && b.spaceId === currentSpaceId ? 1 : 0;
392
+ if (aSameSpace !== bSameSpace) return bSameSpace - aSameSpace;
393
+ return toTimestamp(b) - toTimestamp(a);
394
+ });
395
+ let sawTooRecent = false;
396
+ let sawLowQuality = false;
397
+ for (const record of sorted) {
398
+ const ts = toTimestamp(record);
399
+ if (ts > 0 && Date.now() - ts < MIN_RECAP_GAP_MS) {
400
+ sawTooRecent = true;
401
+ continue;
402
+ }
403
+ let recap = chooseRecapText(record);
404
+ if (!recap) {
405
+ const dialogKey = normalizeText(record.dbKey);
406
+ if (dialogKey) {
407
+ recap = await loadLastAssistantMessageText(db, dialogKey);
408
+ }
409
+ }
410
+ if (recap) {
411
+ return {
412
+ recap,
413
+ reason: "selected",
414
+ sourceDialogKey: normalizeText(record.dbKey) || void 0,
415
+ sourceUpdatedAt: normalizeText(record.updatedAt) || void 0
416
+ };
417
+ }
418
+ sawLowQuality = true;
419
+ }
420
+ if (sawTooRecent) return { recap: null, reason: "too-recent" };
421
+ if (sawLowQuality) return { recap: null, reason: "low-quality" };
422
+ return { recap: null, reason: "no-match" };
423
+ };
424
+ var mergeGreetingWithRelationshipRecap = (input) => {
425
+ const greetingText = normalizeText(input.greetingText);
426
+ const recentRecap = normalizeText(input.recentRecap);
427
+ if (!greetingText && !recentRecap) return null;
428
+ if (!recentRecap) return greetingText || null;
429
+ const continuationLike = CONTINUATION_CUE_PATTERNS.some(
430
+ (pattern) => recentRecap.includes(pattern)
431
+ );
432
+ if (!continuationLike) return greetingText || null;
433
+ if (!greetingText) {
434
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u5728\u804A\uFF1A${recentRecap}
435
+
436
+ \u5982\u679C\u4F60\u8FD8\u60F3\u63A5\u7740\u90A3\u4E2A\u70B9\u7EE7\u7EED\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4ECE\u90A3\u91CC\u5F80\u4E0B\u8D70\uFF1B\u5982\u679C\u60F3\u6362\u4E2A\u65B9\u5411\u4E5F\u53EF\u4EE5\u3002`;
437
+ }
438
+ return `${greetingText}
439
+
440
+ \u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u5728\u804A\uFF1A${recentRecap}
441
+ \u5982\u679C\u4F60\u8FD8\u60F3\u63A5\u7740\u90A3\u4E2A\u70B9\u7EE7\u7EED\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4ECE\u90A3\u91CC\u5F80\u4E0B\u8D70\uFF1B\u5982\u679C\u60F3\u6362\u4E2A\u65B9\u5411\u4E5F\u53EF\u4EE5\u3002`;
442
+ };
443
+
444
+ // packages/ai/memory/understandingGreeting.ts
445
+ var UNDERSTANDING_TAG = "understanding-memory";
446
+ var facetPriority = {
447
+ unfinished: 5,
448
+ tension: 4,
449
+ preference: 3,
450
+ style: 2,
451
+ goal: 1
452
+ };
453
+ var anchorFacetPriority = {
454
+ preference: 3,
455
+ style: 2,
456
+ goal: 1,
457
+ tension: 0,
458
+ unfinished: 0
459
+ };
460
+ var normalizeText2 = (value) => value.trim().replace(/[。!?!?]+$/u, "").trim();
461
+ var stripPrefix = (text, prefix) => text.startsWith(prefix) ? text.slice(prefix.length).trim() : text;
462
+ var toTimestamp2 = (item) => {
463
+ const parsed = Date.parse(item.lastActivatedAt || item.createdAt);
464
+ return Number.isFinite(parsed) ? parsed : 0;
465
+ };
466
+ var isUnderstandingItem = (item) => Array.isArray(item.tags) && item.tags.includes(UNDERSTANDING_TAG);
467
+ var GREETING_MIN_CONFIDENCE = 0.75;
468
+ var isGreetingEligible = (item) => item.kind === "semantic" && (item.confidence ?? 0) >= GREETING_MIN_CONFIDENCE;
469
+ var sortByKindAndTime = (left, right) => {
470
+ if (left.kind !== right.kind) return left.kind === "semantic" ? -1 : 1;
471
+ return toTimestamp2(right) - toTimestamp2(left);
472
+ };
473
+ var sameNormalizedContent = (left, right) => normalizeText2(left).toLowerCase() === normalizeText2(right).toLowerCase();
474
+ var pickAnchorItems = (items) => {
475
+ const ranked = [...items].filter((item) => item.facet ? anchorFacetPriority[item.facet] > 0 : false).sort((left, right) => {
476
+ const leftFacet = left.facet ? anchorFacetPriority[left.facet] ?? 0 : 0;
477
+ const rightFacet = right.facet ? anchorFacetPriority[right.facet] ?? 0 : 0;
478
+ if (leftFacet !== rightFacet) return rightFacet - leftFacet;
479
+ if (left.kind !== right.kind) return left.kind === "semantic" ? -1 : 1;
480
+ if (left.content.length !== right.content.length) {
481
+ return left.content.length - right.content.length;
482
+ }
483
+ return toTimestamp2(right) - toTimestamp2(left);
484
+ });
485
+ const selected = [];
486
+ for (const item of ranked) {
487
+ if (selected.some(
488
+ (existing) => sameNormalizedContent(existing.content, item.content) || existing.facet && item.facet && existing.facet === item.facet
489
+ )) {
490
+ continue;
491
+ }
492
+ selected.push(item);
493
+ if (selected.length >= 2) break;
494
+ }
495
+ return selected;
496
+ };
497
+ var pickFollowUpItem = (items) => [...items].filter((item) => item.facet === "unfinished" || item.facet === "tension").sort((left, right) => {
498
+ const leftFacet = left.facet ? facetPriority[left.facet] ?? 0 : 0;
499
+ const rightFacet = right.facet ? facetPriority[right.facet] ?? 0 : 0;
500
+ if (leftFacet !== rightFacet) return rightFacet - leftFacet;
501
+ return sortByKindAndTime(left, right);
502
+ })[0] ?? null;
503
+ var resolveUnderstandingGreetingMemory = async (input) => {
504
+ const owners = chooseMemoryOwners({
505
+ userId: input.userId,
506
+ spaceId: input.spaceId
507
+ });
508
+ if (owners.length === 0) {
509
+ return { item: null, anchorItems: [], followUpItem: null };
510
+ }
511
+ const items = await loadMemoryCandidatesFromDb(input.db, {
512
+ owners,
513
+ subjects: [{ subjectType: "agent", subjectId: input.agentKey }],
514
+ kinds: ["semantic", "episodic"],
515
+ ownerLimit: 40,
516
+ // Greeting memory must stay agent-scoped: a brand-new agent has zero
517
+ // subject hits, and the owner fallback would surface user-level memories
518
+ // from other agents/spaces as this agent's "memory".
519
+ ownerFallback: "never"
520
+ });
521
+ const understandingItems = items.filter(
522
+ (item2) => isUnderstandingItem(item2) && isGreetingEligible(item2)
523
+ );
524
+ if (understandingItems.length === 0) {
525
+ return { item: null, anchorItems: [], followUpItem: null };
526
+ }
527
+ const ranked = [...understandingItems].sort((left, right) => {
528
+ const leftFacet = left.facet ? facetPriority[left.facet] ?? 0 : 0;
529
+ const rightFacet = right.facet ? facetPriority[right.facet] ?? 0 : 0;
530
+ if (leftFacet !== rightFacet) return rightFacet - leftFacet;
531
+ return sortByKindAndTime(left, right);
532
+ });
533
+ const anchorItems = pickAnchorItems(understandingItems);
534
+ const followUpItem = pickFollowUpItem(understandingItems);
535
+ const item = followUpItem ?? anchorItems[0] ?? ranked[0] ?? null;
536
+ return {
537
+ item,
538
+ anchorItems,
539
+ followUpItem
540
+ };
541
+ };
542
+ var renderLeadClause = (item) => {
543
+ const content = normalizeText2(item.content);
544
+ switch (item.facet) {
545
+ case "unfinished":
546
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u8FD8\u6CA1\u5B9A\u4E0B\u6765\uFF1A${stripPrefix(content, "\u8FD8\u6CA1\u51B3\u5B9A")}`;
547
+ case "tension":
548
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u8FD8\u5728\u6743\u8861${stripPrefix(content, "\u5728\u6743\u8861")}`;
549
+ case "style":
550
+ case "preference":
551
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21${content}`;
552
+ case "goal":
553
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u60F3\u63A8\u8FDB\u7684\u662F${content}`;
554
+ default:
555
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21\u63D0\u8FC7${content}`;
556
+ }
557
+ };
558
+ var renderAnchorFragment = (item) => {
559
+ const content = normalizeText2(item.content);
560
+ switch (item.facet) {
561
+ case "preference":
562
+ if (content.startsWith("\u66F4\u5728\u610F")) {
563
+ return `\u66F4\u5728\u610F\u7684\u662F${stripPrefix(content, "\u66F4\u5728\u610F")}`;
564
+ }
565
+ if (content.startsWith("\u66F4\u5173\u5FC3")) {
566
+ return `\u66F4\u5173\u5FC3\u7684\u662F${stripPrefix(content, "\u66F4\u5173\u5FC3")}`;
567
+ }
568
+ if (content.startsWith("\u66F4\u6015")) {
569
+ return `\u66F4\u6015${stripPrefix(content, "\u66F4\u6015")}`;
570
+ }
571
+ if (content.startsWith("\u4E0D\u60F3")) {
572
+ return `\u4E0D\u60F3${stripPrefix(content, "\u4E0D\u60F3")}`;
573
+ }
574
+ if (content.startsWith("\u4E0D\u5E0C\u671B")) {
575
+ return `\u4E0D\u5E0C\u671B${stripPrefix(content, "\u4E0D\u5E0C\u671B")}`;
576
+ }
577
+ return content;
578
+ case "style":
579
+ if (content.startsWith("\u4E0D\u559C\u6B22")) {
580
+ return `\u4E0D\u592A\u559C\u6B22${stripPrefix(content, "\u4E0D\u559C\u6B22")}`;
581
+ }
582
+ if (content.startsWith("\u66F4\u559C\u6B22")) {
583
+ return `\u66F4\u559C\u6B22${stripPrefix(content, "\u66F4\u559C\u6B22")}`;
584
+ }
585
+ return content;
586
+ case "goal":
587
+ if (content.startsWith("\u60F3\u5148")) {
588
+ return `\u60F3\u5148${stripPrefix(content, "\u60F3\u5148")}`;
589
+ }
590
+ return `\u60F3\u63A8\u8FDB\u7684\u662F${content}`;
591
+ default:
592
+ return content;
593
+ }
594
+ };
595
+ var renderAnchorSentence = (items) => {
596
+ if (items.length === 0) return null;
597
+ const fragments = items.map(renderAnchorFragment).map((fragment) => fragment.trim()).filter(Boolean);
598
+ if (fragments.length === 0) return null;
599
+ if (fragments.length === 1) {
600
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21${fragments[0]}\u3002`;
601
+ }
602
+ return `\u6211\u8BB0\u5F97\u4F60\u4E0A\u6B21${fragments[0]}\uFF0C\u4E5F${fragments[1]}\u3002`;
603
+ };
604
+ var splitTradeoff = (value) => {
605
+ const normalized = normalizeText2(value).replace(/^在权衡/u, "").replace(/^还没决定/u, "").replace(/^还不确定/u, "").replace(/^还没想好/u, "").trim();
606
+ if (!normalized.includes("\u8FD8\u662F")) return null;
607
+ const [left, right] = normalized.split(/\s*还是/u, 2);
608
+ const normalizedLeft = normalizeText2((left ?? "").replace(/[,,::]+$/u, "").trim());
609
+ const normalizedRight = normalizeText2((right ?? "").trim());
610
+ if (!normalizedLeft || !normalizedRight) return null;
611
+ return [normalizedLeft, normalizedRight];
612
+ };
613
+ var renderFollowUpLine = (item) => {
614
+ if (!item) {
615
+ return "\u5982\u679C\u4F60\u60F3\uFF0C\u6211\u4EEC\u53EF\u4EE5\u63A5\u7740\u4E0A\u6B21\u90A3\u4E2A\u70B9\uFF1B\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002";
616
+ }
617
+ const tradeoff = splitTradeoff(item.content);
618
+ if (tradeoff) {
619
+ return `\u5982\u679C\u4F60\u613F\u610F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u63A5\u7740\u770B\uFF1A${tradeoff[0]}\uFF0C\u8FD8\u662F${tradeoff[1]}\u3002\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002`;
620
+ }
621
+ const content = normalizeText2(item.content);
622
+ switch (item.facet) {
623
+ case "unfinished":
624
+ return `\u5982\u679C\u4F60\u613F\u610F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u63A5\u7740\u628A${stripPrefix(content, "\u8FD8\u6CA1\u51B3\u5B9A")}\u5B9A\u4E0B\u6765\uFF1B\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002`;
625
+ case "tension":
626
+ return `\u5982\u679C\u4F60\u613F\u610F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u63A5\u7740\u770B${stripPrefix(content, "\u5728\u6743\u8861")}\uFF1B\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002`;
627
+ case "goal":
628
+ return `\u5982\u679C\u4F60\u613F\u610F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u7EE7\u7EED\u63A8\u8FDB${stripPrefix(content, "\u60F3\u5148")}\uFF1B\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002`;
629
+ default:
630
+ return "\u5982\u679C\u4F60\u60F3\uFF0C\u6211\u4EEC\u53EF\u4EE5\u63A5\u7740\u4E0A\u6B21\u90A3\u4E2A\u70B9\uFF1B\u5982\u679C\u4ECA\u5929\u662F\u65B0\u95EE\u9898\uFF0C\u4E5F\u76F4\u63A5\u8BF4\u3002";
631
+ }
632
+ };
633
+ var mergeGreetingWithUnderstandingMemory = (input) => {
634
+ const greetingText = asTrimmedString(input.greetingText);
635
+ const resolution = input.resolution ?? null;
636
+ const item = input.item ?? resolution?.item ?? null;
637
+ if (!greetingText && !item) return null;
638
+ if (!item) return greetingText || null;
639
+ const anchorItems = resolution?.anchorItems ?? [];
640
+ const followUpItem = resolution?.followUpItem ?? item;
641
+ const leadLine = renderAnchorSentence(anchorItems) ?? `${renderLeadClause(item)}\u3002`;
642
+ const suffix = renderFollowUpLine(followUpItem);
643
+ const memoryBlock = `\u6B22\u8FCE\u56DE\u6765\u3002${leadLine}
644
+ ${suffix}`;
645
+ if (!greetingText) {
646
+ return memoryBlock;
647
+ }
648
+ return `${greetingText}
649
+
650
+ ${memoryBlock}`;
651
+ };
652
+
653
+ // packages/chat/dialog/actions/createDialogAction.ts
654
+ var LOCAL_OWNER_DIALOG_PREFIXES = ["agent-local-", "cybot-local-"];
655
+ var isLocalOwnerDialogAgents = (cybots) => {
656
+ if (!Array.isArray(cybots)) return false;
657
+ for (const agentKey of cybots) {
658
+ if (typeof agentKey !== "string") continue;
659
+ for (const prefix of LOCAL_OWNER_DIALOG_PREFIXES) {
660
+ if (agentKey.startsWith(prefix)) return true;
661
+ }
662
+ }
663
+ return false;
664
+ };
665
+ var notifyUserDataUpdated = () => {
666
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof window.Event === "function") {
667
+ window.dispatchEvent(new window.Event("nolo-user-data-updated"));
668
+ }
669
+ };
670
+ var createDialogAction = async (args, thunkApi) => {
671
+ const {
672
+ cybots,
673
+ category,
674
+ spaceId: explicitSpaceId,
675
+ inheritFromDialogKey,
676
+ title: titleOverride,
677
+ triggerType,
678
+ schedule,
679
+ taskPrompt,
680
+ skipAgentConfigRead,
681
+ optimisticReturnBeforeWrite,
682
+ preferredServerOrigin
683
+ } = args;
684
+ const { dispatch: dispatchRaw, getState, extra } = thunkApi;
685
+ const dispatch = dispatchRaw;
686
+ const agentKey = cybots[0];
687
+ const currentUserId = selectIdentityUserId(getState()) ?? null;
688
+ const isDeviceLocalDialog = isLocalOwnerDialogAgents(cybots);
689
+ const userId = isDeviceLocalDialog ? "local" : currentUserId && currentUserId.trim().length > 0 ? currentUserId : "local";
690
+ try {
691
+ const { localFirstLog } = await import("./localFirstLog-DHNOY2NA.js");
692
+ localFirstLog("dialog.create", {
693
+ owner: userId,
694
+ agentKey: typeof agentKey === "string" ? agentKey : "",
695
+ isDeviceLocal: isDeviceLocalDialog,
696
+ hasSpace: Boolean(args.spaceId)
697
+ });
698
+ } catch {
699
+ }
700
+ const readAgentConfig = async () => {
701
+ const existing = await dispatch(
702
+ readAndWait({
703
+ dbKey: agentKey,
704
+ preferredServerOrigin
705
+ })
706
+ ).unwrap().catch(() => null);
707
+ if (existing) return existing;
708
+ const recoveredBuiltinAgent = buildBuiltinObjectAssistantAgentFromKey(
709
+ agentKey,
710
+ userId
711
+ );
712
+ if (!recoveredBuiltinAgent) {
713
+ return null;
714
+ }
715
+ await dispatch(
716
+ write({
717
+ data: recoveredBuiltinAgent,
718
+ customKey: recoveredBuiltinAgent.dbKey,
719
+ userId
720
+ })
721
+ ).unwrap();
722
+ return recoveredBuiltinAgent;
723
+ };
724
+ const canSkipAgentConfigRead = !!skipAgentConfigRead && !!args.skipGreeting && !!titleOverride;
725
+ const agentConfig = canSkipAgentConfigRead ? null : await readAgentConfig();
726
+ if (!agentConfig && !canSkipAgentConfigRead) {
727
+ throw new Error(`Agent with key ${agentKey} not found.`);
728
+ }
729
+ const shouldUseRelationshipGreeting = shouldUseRecentRelationshipRecap({
730
+ userId,
731
+ agentKey,
732
+ agentsCount: cybots.length,
733
+ inheritFromDialogKey,
734
+ skipGreeting: args.skipGreeting,
735
+ triggerType
736
+ });
737
+ const understandingGreetingResolution = shouldUseRelationshipGreeting ? await resolveUnderstandingGreetingMemory({
738
+ db: extra?.db,
739
+ userId,
740
+ spaceId: explicitSpaceId,
741
+ agentKey
742
+ }).catch(() => ({ item: null, anchorItems: [], followUpItem: null })) : { item: null, anchorItems: [], followUpItem: null };
743
+ const recentRelationshipRecapResolution = shouldUseRelationshipGreeting && !understandingGreetingResolution.item ? await resolveRecentRelationshipRecap({
744
+ db: extra?.db,
745
+ userId,
746
+ agentKey,
747
+ currentSpaceId: explicitSpaceId
748
+ }).catch(() => ({ recap: null, reason: "no-db", sourceDialogKey: void 0 })) : null;
749
+ if (typeof window !== "undefined" && recentRelationshipRecapResolution && process.env.NODE_ENV !== "production") {
750
+ console.debug("[dialog] recent relationship recap", {
751
+ agentKey,
752
+ userId,
753
+ reason: recentRelationshipRecapResolution.reason,
754
+ sourceDialogKey: recentRelationshipRecapResolution.sourceDialogKey ?? null,
755
+ preview: recentRelationshipRecapResolution.recap ?? null
756
+ });
757
+ }
758
+ const time = (0, import_date_fns.format)(/* @__PURE__ */ new Date(), "MM-dd HH:mm");
759
+ const title = titleOverride || (agentConfig?.name || "Agent") + " " + time;
760
+ const spaceId = explicitSpaceId;
761
+ const dialogPath = createDialogKey(userId);
762
+ const dialogId = extractCustomId(dialogPath);
763
+ let referenceKeys;
764
+ let inheritedFromDialogKey;
765
+ let inheritedFromDialogTitle;
766
+ if (inheritFromDialogKey) {
767
+ inheritedFromDialogKey = inheritFromDialogKey;
768
+ const sourceDialog = await dispatch(
769
+ read({
770
+ dbKey: inheritFromDialogKey
771
+ })
772
+ ).unwrap();
773
+ if (isRecord(sourceDialog)) {
774
+ const sourceDbKey = sourceDialog.dbKey;
775
+ if (typeof sourceDbKey === "string" && sourceDbKey.trim().length > 0) {
776
+ inheritedFromDialogKey = sourceDbKey;
777
+ }
778
+ const sourceTitle = asOptionalTrimmedString(
779
+ sourceDialog.title
780
+ );
781
+ if (sourceTitle) {
782
+ inheritedFromDialogTitle = sourceTitle;
783
+ }
784
+ const candidate = sourceDialog.referenceKeys;
785
+ if (Array.isArray(candidate) && candidate.every((key) => typeof key === "string")) {
786
+ referenceKeys = candidate;
787
+ }
788
+ }
789
+ }
790
+ const dialogData = {
791
+ id: dialogId,
792
+ dbKey: dialogPath,
793
+ userId,
794
+ cybots,
795
+ title,
796
+ type: "dialog" /* DIALOG */,
797
+ createdAt: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date()),
798
+ ...spaceId && { spaceId },
799
+ category,
800
+ referenceKeys,
801
+ ...args.extraReferences && args.extraReferences.length > 0 && { extraReferences: args.extraReferences },
802
+ ...inheritedFromDialogKey && { inheritedFromDialogKey },
803
+ ...inheritedFromDialogTitle && { inheritedFromDialogTitle },
804
+ inputTokens: 0,
805
+ outputTokens: 0,
806
+ totalCost: 0,
807
+ ...triggerType && { triggerType },
808
+ ...triggerType === "scheduled_run" || triggerType === "automation_run" ? {
809
+ executionMode: "background",
810
+ status: "pending"
811
+ } : {},
812
+ ...schedule && { schedule },
813
+ ...taskPrompt && { taskPrompt }
814
+ };
815
+ const canReturnBeforeWrite = canSkipAgentConfigRead && !!optimisticReturnBeforeWrite && !spaceId;
816
+ if (canReturnBeforeWrite) {
817
+ const optimisticDialogData = {
818
+ ...dialogData,
819
+ dbKey: dialogPath,
820
+ userId
821
+ };
822
+ dispatch(upsertSSREntity(optimisticDialogData));
823
+ notifyUserDataUpdated();
824
+ void dispatch(
825
+ write({
826
+ data: { ...dialogData, userId },
827
+ customKey: dialogPath,
828
+ userId
829
+ })
830
+ ).unwrap().catch((error) => {
831
+ console.error("[createDialogAction] optimistic dialog write failed", {
832
+ dialogPath,
833
+ error
834
+ });
835
+ dispatch(removeCachedEntity(dialogPath));
836
+ notifyUserDataUpdated();
837
+ });
838
+ return optimisticDialogData;
839
+ }
840
+ const result = await dispatch(
841
+ write({
842
+ data: { ...dialogData, userId },
843
+ customKey: dialogPath,
844
+ userId
845
+ })
846
+ ).unwrap();
847
+ if (spaceId) {
848
+ await dispatch(
849
+ addContentToSpace({
850
+ spaceId,
851
+ contentKey: dialogPath,
852
+ type: "dialog" /* DIALOG */,
853
+ title,
854
+ categoryId: category,
855
+ ...triggerType && { triggerType }
856
+ })
857
+ );
858
+ }
859
+ notifyUserDataUpdated();
860
+ const rawGreeting = agentConfig?.greeting;
861
+ if (rawGreeting && !args.skipGreeting) {
862
+ const cfg = typeof rawGreeting === "string" ? { text: rawGreeting } : isRecord(rawGreeting) ? rawGreeting : { text: String(rawGreeting) };
863
+ const mergedGreetingText = understandingGreetingResolution?.item ? mergeGreetingWithUnderstandingMemory({
864
+ greetingText: cfg.text,
865
+ resolution: understandingGreetingResolution
866
+ }) : mergeGreetingWithRelationshipRecap({
867
+ greetingText: cfg.text,
868
+ recentRecap: recentRelationshipRecapResolution?.recap
869
+ });
870
+ const effectiveCfg = {
871
+ ...cfg,
872
+ ...mergedGreetingText ? { text: mergedGreetingText } : {}
873
+ };
874
+ const hasMenu = Array.isArray(effectiveCfg.menu) && effectiveCfg.menu.length > 0;
875
+ if (hasMenu) {
876
+ const question = asOptionalTrimmedString(effectiveCfg.text) ?? "\u63A5\u4E0B\u6765\u4F60\u66F4\u5E0C\u671B\u6211\u5E2E\u4F60\u505A\u54EA\u4EF6\u4E8B\uFF1F";
877
+ const choices = effectiveCfg.menu.map((item, idx) => ({
878
+ id: item.id || `choice_${idx + 1}`,
879
+ label: item.label,
880
+ userMessage: item.userMessage ?? item.label
881
+ }));
882
+ const toolResult = await uiAskChoiceFunc(
883
+ {
884
+ question,
885
+ choices,
886
+ blocking: true
887
+ },
888
+ thunkApi
889
+ );
890
+ await dispatch(
891
+ prepareAndPersistMessage({
892
+ message: {
893
+ role: "tool",
894
+ toolName: uiAskChoiceFunctionSchema.name,
895
+ cybotKey: agentKey,
896
+ content: toolResult.rawData,
897
+ displayData: toolResult.displayData
898
+ },
899
+ dialogConfig: {
900
+ id: dialogId,
901
+ dbKey: dialogPath,
902
+ userId
903
+ }
904
+ })
905
+ );
906
+ } else if (effectiveCfg.text) {
907
+ await dispatch(
908
+ prepareAndPersistMessage({
909
+ message: {
910
+ content: effectiveCfg.text,
911
+ role: "assistant",
912
+ cybotKey: agentKey
913
+ },
914
+ dialogConfig: {
915
+ id: dialogId,
916
+ dbKey: dialogPath,
917
+ userId
918
+ }
919
+ })
920
+ );
921
+ }
922
+ }
923
+ return result;
924
+ };
925
+
926
+ export {
927
+ isLocalOwnerDialogAgents,
928
+ createDialogAction
929
+ };