@freecallai/pro 0.0.4 → 0.0.5

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 (94) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +23 -23
  3. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang--MPtqZY_.js +193 -0
  4. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-bw74hFS9.js +4980 -0
  5. package/dist/KnowledgeArea-CEX1esVZ.js +4 -0
  6. package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-Bg1e7xYT.js +1653 -0
  7. package/dist/ToolForm-DA-EFBhw.js +196 -0
  8. package/dist/agent-prompt-editor/index.js +917 -0
  9. package/dist/agent-prompt-editor/legacy-converter/index.js +490 -0
  10. package/dist/{choice-C1SxozNA.js → choice-2dbddjJU.js} +1 -1
  11. package/dist/edition-info/index.js +1 -1
  12. package/dist/filters/index.js +1 -1
  13. package/dist/{guard-CXpVx8UR.js → guard-Cr_ny-sR.js} +226 -213
  14. package/dist/index-7x1OTv0m.js +98 -0
  15. package/dist/{index-CM0MN2DT.js → index-BBxrpF3v.js} +1 -1
  16. package/dist/{index-UjI4WA5F.js → index-CgRisH4B.js} +1 -1
  17. package/dist/index-Ck8RYpuE.js +816 -0
  18. package/dist/index-CnjG7Mj4.js +5 -0
  19. package/dist/{index-lNhA3N9x.js → index-DBQsQ1ZK.js} +1 -0
  20. package/dist/index-DCZKt14c.js +5 -0
  21. package/dist/{index-BqXNMfLG.js → index-DiaPY8Db.js} +2 -2
  22. package/dist/{index-bSNw0XAf.js → index-DmdrsEvk.js} +1 -1
  23. package/dist/index-DnmCPdCI.js +168 -0
  24. package/dist/{index-Cy4DqT8R.js → index-DwDYy2lj.js} +1 -1
  25. package/dist/{index-B8jg37Wj.js → index-FQQfN6nm.js} +1 -1
  26. package/dist/{index-CZc2Gyjb.js → index-aic1yCBs.js} +1 -1
  27. package/dist/index.js +13 -13
  28. package/dist/{inline-Zj7Hqg-_.js → inline-8aNfINLF.js} +1 -1
  29. package/dist/knowledge-type-picker/index.js +1 -1
  30. package/dist/{knowledge-DaTnF2IW.js → knowledge-y2j0ijgx.js} +1 -1
  31. package/dist/media-id-b2dgniSy.js +15 -0
  32. package/dist/{media-migration-C2QLMSpd.js → media-migration-Dy_rbdkK.js} +1 -1
  33. package/dist/media-policy-BwKjZPWt.js +158 -0
  34. package/dist/{media-upload-D9MYBbLg.js → media-upload-NzWYyCm3.js} +1 -1
  35. package/dist/model-DvukseoR.js +146 -0
  36. package/dist/navigation/index.js +1 -1
  37. package/dist/rich-text/index.js +75 -73
  38. package/dist/rich-text/legacy-converter/index.js +822 -799
  39. package/dist/style.css +1 -1
  40. package/dist/switcher/index.js +1 -1
  41. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +550 -0
  42. package/dist/types/agent-prompt-editor/agent-size-chart.d.ts +3 -0
  43. package/dist/types/agent-prompt-editor/document-adapter.d.ts +3 -0
  44. package/dist/types/agent-prompt-editor/index.d.ts +6 -0
  45. package/dist/types/agent-prompt-editor/legacy-converter-index.d.ts +2 -0
  46. package/dist/types/agent-prompt-editor/legacy-converter.d.ts +26 -0
  47. package/dist/types/agent-prompt-editor/model.d.ts +21 -0
  48. package/dist/types/agent-prompt-editor/types.d.ts +56 -0
  49. package/dist/types/edition-info/FkpEditionInfo.vue.d.ts +1 -3
  50. package/dist/types/edition-info/presets.d.ts +8 -0
  51. package/dist/types/edition-info/types.d.ts +1 -0
  52. package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
  53. package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
  54. package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
  55. package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
  56. package/dist/types/index.d.ts +4 -1
  57. package/dist/types/navigation/FkpNavigation.vue.d.ts +20 -29
  58. package/dist/types/navigation/NavigationButton.vue.d.ts +26 -0
  59. package/dist/types/navigation/NavigationGroup.vue.d.ts +45 -0
  60. package/dist/types/navigation/NavigationIcon.vue.d.ts +28 -0
  61. package/dist/types/navigation/NavigationNodes.vue.d.ts +40 -0
  62. package/dist/types/navigation/index.d.ts +1 -1
  63. package/dist/types/navigation/types.d.ts +43 -5
  64. package/dist/types/navigation/use-navigation-tree.d.ts +13 -0
  65. package/dist/types/rich-text/FkpRichText.vue.d.ts +28 -8
  66. package/dist/types/rich-text/config/descriptor.d.ts +1 -0
  67. package/dist/types/rich-text/config/resolve.d.ts +1 -1
  68. package/dist/types/rich-text/index.d.ts +4 -1
  69. package/dist/types/rich-text/knowledge-document-adapter.d.ts +2 -0
  70. package/dist/types/rich-text/model/question-text.d.ts +1 -1
  71. package/dist/types/rich-text/plugins/registry.d.ts +2 -1
  72. package/dist/types/rich-text/public/types.d.ts +12 -0
  73. package/dist/types/rich-text/runtime/document-adapter.d.ts +9 -0
  74. package/dist/types/rich-text/runtime/knowledge-clipboard.d.ts +9 -3
  75. package/dist/types/rich-text/runtime/media-sources.d.ts +7 -0
  76. package/dist/types/rich-text/runtime/media-upload-session.d.ts +2 -0
  77. package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +3 -3
  78. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +18 -3
  79. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +190 -0
  80. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
  81. package/dist/types/rich-text/ui/token-renderer.d.ts +3 -0
  82. package/dist/types/rich-text/ui/useMediaHint.d.ts +6 -0
  83. package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
  84. package/dist/types-PvYB5e85.js +14 -0
  85. package/package.json +13 -5
  86. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang-DYwu7oQs.js +0 -187
  87. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BowbZoTQ.js +0 -4885
  88. package/dist/KnowledgeArea-BH-_uF6R.js +0 -1438
  89. package/dist/ToolForm-C6XW31Y7.js +0 -185
  90. package/dist/index-CS2xQQ8W.js +0 -168
  91. package/dist/index-D0bJAQSN.js +0 -327
  92. package/dist/index-DAZ1ulyA.js +0 -5
  93. package/dist/index-DCmHHi07.js +0 -71
  94. package/dist/index-F7lDP1lI.js +0 -5
@@ -0,0 +1,490 @@
1
+ import { c as L } from "../../media-id-b2dgniSy.js";
2
+ import { i as N, f as x } from "../../guard-Cr_ny-sR.js";
3
+ import { f as I, v as U } from "../../model-DvukseoR.js";
4
+ const O = 1024 * 1024, z = 1e4, _ = /[\u200b-\u200d\ufeff]/gu, R = /#@|##|\$\$小额打款@|\{(?:待办|业务属性|属性|分隔符|原话复述|变量|自定义Agent|推理)|\[sep\]|<\s*(?:img|video)\b/iu, A = /* @__PURE__ */ new Set(["DIV", "P", "LI", "SECTION", "ARTICLE"]), M = /* @__PURE__ */ new Set([
5
+ "SPAN",
6
+ "B",
7
+ "STRONG",
8
+ "I",
9
+ "EM",
10
+ "U",
11
+ "S",
12
+ "STRIKE",
13
+ "FONT",
14
+ "A",
15
+ "CODE"
16
+ ]);
17
+ function m(t, e, a) {
18
+ return { code: t, message: e, path: a, source: "migration", severity: "error" };
19
+ }
20
+ function g(t) {
21
+ return t.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/>/gu, "&gt;").replace(/"/gu, "&quot;");
22
+ }
23
+ function V(t) {
24
+ return t.replace(
25
+ /<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
26
+ "<video$1></video>"
27
+ );
28
+ }
29
+ function k(t, e = []) {
30
+ return {
31
+ type: "text",
32
+ text: t,
33
+ ...e != null && e.length ? { marks: e } : {}
34
+ };
35
+ }
36
+ function T(t, e, a, n) {
37
+ return {
38
+ type: "businessToken",
39
+ attrs: { kind: t, key: e, label: a, ...n ? { token: n } : {} }
40
+ };
41
+ }
42
+ function G(t, e) {
43
+ const a = t.getAttribute("data-attr-key") || e, n = t.getAttribute("data-attr-id");
44
+ return T(
45
+ "attribute",
46
+ a,
47
+ e,
48
+ n ? `legacy-id:${n}` : void 0
49
+ );
50
+ }
51
+ function v(t) {
52
+ var u, l, i, s;
53
+ const e = t.getAttribute("data-tag-type") || (t.getAttribute("data-size") === "true" ? "size_chart" : "") || (t.getAttribute("data-tableknowledge") === "true" ? "table_knowledge" : "") || (t.getAttribute("data-variable") === "true" ? "variable" : "") || (t.getAttribute("data-divider") === "true" ? "separator" : "") || (t.getAttribute("data-tag") === "true" ? "biz_attribute" : "");
54
+ if (!e) return null;
55
+ const a = ((u = t.textContent) == null ? void 0 : u.replace(_, "").trim()) || "", n = (r, o) => {
56
+ var b, h;
57
+ return (r == null ? void 0 : r.trim()) || ((h = (b = o.exec(a)) == null ? void 0 : b[1]) == null ? void 0 : h.trim()) || "";
58
+ };
59
+ switch (e) {
60
+ case "table_knowledge": {
61
+ const r = n(
62
+ t.getAttribute("data-table-name"),
63
+ /^##([^#]+)##$/u
64
+ );
65
+ return r && a === `##${r}##` ? T("tableKnowledge", r, r) : null;
66
+ }
67
+ case "size_chart": {
68
+ const r = n(
69
+ t.getAttribute("data-size-name"),
70
+ /^#@([^@#]+)@#$/u
71
+ );
72
+ return r && a === `#@${r}@#` ? { type: "agentSizeChart", attrs: { name: r } } : null;
73
+ }
74
+ case "biz_attribute": {
75
+ const r = ((l = t.getAttribute("data-attr-name")) == null ? void 0 : l.trim()) || ((s = (i = /^\{业务属性@([^}]+)\}$/u.exec(a)) == null ? void 0 : i[1]) == null ? void 0 : s.trim()) || a;
76
+ return r && (a === r || a === `{业务属性@${r}}`) ? G(t, r) : null;
77
+ }
78
+ case "variable": {
79
+ const r = n(
80
+ t.getAttribute("data-variable-name"),
81
+ /^#([^#]+)#$/u
82
+ );
83
+ return r && a === `#${r}#` ? T("variable", r, r, `#${r}#`) : null;
84
+ }
85
+ case "todo": {
86
+ const r = n(t.getAttribute("data-tag-name"), /^\{待办@([^}]+)\}$/u) || (a === "{待办}" ? "默认" : "");
87
+ return r && a === (r === "默认" ? "{待办}" : `{待办@${r}}`) ? T(
88
+ "todo",
89
+ t.getAttribute("plan_id") || r,
90
+ r,
91
+ r === "默认" ? "{待办}" : void 0
92
+ ) : null;
93
+ }
94
+ case "separator":
95
+ return a === "{分隔符}" || a === "[sep]" ? T("separator", "separator", "分隔符", "{分隔符}") : null;
96
+ case "small_payment": {
97
+ const r = Number(t.getAttribute("data-max-amount-cent"));
98
+ return !Number.isInteger(r) || r < 100 || r > 9900 || r % 100 !== 0 || a !== `$$小额打款@${r}$$` ? null : {
99
+ type: "businessToken",
100
+ attrs: {
101
+ kind: "tool",
102
+ key: "small_payment",
103
+ label: "小额打款",
104
+ params: { amount: String(r / 100) }
105
+ }
106
+ };
107
+ }
108
+ default:
109
+ return null;
110
+ }
111
+ }
112
+ function C(t) {
113
+ var u;
114
+ const e = t.tagName === "VIDEO" ? "video" : "image", a = t.getAttribute("src") || ((u = t.querySelector("source[src]")) == null ? void 0 : u.getAttribute("src")), n = t.getAttribute("poster");
115
+ return !N(a) || n && !N(n) ? null : {
116
+ type: "mediaBlock",
117
+ attrs: {
118
+ id: L(),
119
+ nodeVersion: 0,
120
+ kind: e,
121
+ src: a,
122
+ name: t.getAttribute("data-media-name") || "",
123
+ assetId: t.getAttribute("data-asset-id"),
124
+ poster: n || null,
125
+ status: "ready"
126
+ }
127
+ };
128
+ }
129
+ function w(t) {
130
+ const e = (n, u) => {
131
+ const l = (i) => {
132
+ var s;
133
+ return ((s = new RegExp(`\\b${i}=["']([^"']*)["']`, "iu").exec(n)) == null ? void 0 : s[1]) || "";
134
+ };
135
+ return `${u}:${JSON.stringify([
136
+ l("src"),
137
+ l("data-asset-id"),
138
+ l("data-media-name"),
139
+ l("poster")
140
+ ])}`;
141
+ };
142
+ return t.replace(/&nbsp;|&#160;|&#xa0;/giu, " ").replace(/&amp;/giu, "&").replace(/&lt;/giu, "<").replace(/&gt;/giu, ">").replace(/&quot;/giu, '"').replace(/&#39;/giu, "'").replace(/<img\b[^>]*>/giu, (n) => e(n, "img")).replace(
143
+ /<video\b[^>]*\/?>(?:<\/video>)?/giu,
144
+ (n) => e(n, "video")
145
+ ).replace(/\[sep\]|\{分隔符\}/gu, "sep").replace(_, "").replace(/\r\n?/gu, `
146
+ `).replace(/[\t\u00a0 ]+/gu, " ").replace(/ *\n */gu, `
147
+ `).trim();
148
+ }
149
+ function B(t) {
150
+ const e = [];
151
+ let a = [], n = !1;
152
+ const u = (i = !1) => {
153
+ (a.length || i) && (e.push({
154
+ type: "paragraph",
155
+ ...a.length ? { content: a } : {}
156
+ }), a = []);
157
+ }, l = (i, s = []) => {
158
+ if (n) return;
159
+ if (i.nodeType === Node.TEXT_NODE) {
160
+ (i.textContent || "").replace(_, "").split(/\r\n?|\n/u).forEach((b, h) => {
161
+ h && u(!0), b && a.push(k(b, s));
162
+ });
163
+ return;
164
+ }
165
+ if (!(i instanceof Element) || i.getAttribute("data-tag-icon") === "true") return;
166
+ if (i.tagName === "BR") {
167
+ u(!0);
168
+ return;
169
+ }
170
+ if (i.tagName === "IMG" || i.tagName === "VIDEO") {
171
+ const o = C(i);
172
+ o ? (u(), e.push(o)) : n = !0;
173
+ return;
174
+ }
175
+ if (i.hasAttribute("data-tag-type")) {
176
+ const o = v(i);
177
+ !o || o.type === "agentSizeChart" ? n = !0 : a.push(o);
178
+ return;
179
+ }
180
+ if (!M.has(i.tagName) && !A.has(i.tagName)) {
181
+ n = !0;
182
+ return;
183
+ }
184
+ A.has(i.tagName) && u();
185
+ const r = [...s || []];
186
+ if ((i.tagName === "B" || i.tagName === "STRONG") && r.push({ type: "bold" }), (i.tagName === "I" || i.tagName === "EM") && r.push({ type: "italic" }), i.tagName === "U" && r.push({ type: "underline" }), (i.tagName === "S" || i.tagName === "STRIKE") && r.push({ type: "strike" }), i.tagName === "CODE" && r.push({ type: "code" }), i.tagName === "A") {
187
+ const o = i.getAttribute("href");
188
+ if (!N(o)) {
189
+ n = !0;
190
+ return;
191
+ }
192
+ r.push({ type: "link", attrs: { href: o, target: "_self" } });
193
+ }
194
+ i.childNodes.forEach((o) => l(o, r)), A.has(i.tagName) && u();
195
+ };
196
+ return t.childNodes.forEach((i) => l(i)), u(), n ? null : e.length ? e : [{ type: "paragraph" }];
197
+ }
198
+ function Y(t) {
199
+ const e = { clues: t.clues || "", webClues: t.webClues || "" }, a = (c, f, $) => ({
200
+ ok: !1,
201
+ raw: e,
202
+ issues: [m(c, f, $)]
203
+ });
204
+ if (typeof t.clues != "string" || typeof t.webClues != "string")
205
+ return a("PROMPT_FIELDS_INVALID", "提示词字段必须为字符串", "clues");
206
+ if (e.webClues.length > O || e.clues.length > O)
207
+ return a("PROMPT_TOO_LARGE", "历史提示词过大", "webClues");
208
+ if (typeof DOMParser > "u")
209
+ return a("DOM_UNAVAILABLE", "当前环境无法解析旧提示词", "webClues");
210
+ if (!e.webClues.trim())
211
+ return R.test(e.clues) ? a(
212
+ "PROMPT_STRUCTURE_MISSING",
213
+ "缺少可恢复业务标签的展示字段",
214
+ "webClues"
215
+ ) : {
216
+ ok: !0,
217
+ value: {
218
+ schemaVersion: 1,
219
+ doc: {
220
+ type: "doc",
221
+ content: e.clues.split(/\r\n?|\n/u).map((f) => ({
222
+ type: "paragraph",
223
+ ...f ? { content: [k(f)] } : {}
224
+ }))
225
+ }
226
+ },
227
+ warnings: []
228
+ };
229
+ const n = new DOMParser().parseFromString(
230
+ V(e.webClues),
231
+ "text/html"
232
+ ), u = [];
233
+ let l = [], i = 0;
234
+ const s = [], r = (c, f, $) => {
235
+ if (R.test(c)) {
236
+ s.push(
237
+ m(
238
+ "PROMPT_UNTAGGED_MARKER",
239
+ "历史提示词含无法确认的普通文本标记",
240
+ $
241
+ )
242
+ );
243
+ return;
244
+ }
245
+ for (const [p, y] of c.replace(_, "").split(/\r\n?|\n/u).entries())
246
+ p && o(!0), y && l.push(k(y, f));
247
+ }, o = (c = !1) => {
248
+ (l.length || c) && (u.push({
249
+ type: "paragraph",
250
+ ...l.length ? { content: l } : {}
251
+ }), l = []);
252
+ }, b = (c, f, $ = []) => {
253
+ if (++i > z) {
254
+ s.push(m("PROMPT_TOO_LARGE", "历史提示词节点过多", f));
255
+ return;
256
+ }
257
+ if (c.nodeType === Node.TEXT_NODE) {
258
+ r(c.textContent || "", $, f);
259
+ return;
260
+ }
261
+ if (!(c instanceof Element)) return;
262
+ const p = c.tagName;
263
+ if (c.getAttribute("data-tag-icon") === "true") return;
264
+ if (["SCRIPT", "STYLE", "IFRAME", "OBJECT", "SVG", "TEMPLATE"].includes(p)) {
265
+ s.push(
266
+ m("PROMPT_HTML_UNSUPPORTED", "旧提示词含无法编辑的 HTML", f)
267
+ );
268
+ return;
269
+ }
270
+ if (p === "BR") {
271
+ o(!0);
272
+ return;
273
+ }
274
+ if (p === "IMG" || p === "VIDEO") {
275
+ const d = C(c);
276
+ d ? (o(), u.push(d)) : s.push(m("PROMPT_MEDIA_INVALID", "媒体地址或类型无效", f));
277
+ return;
278
+ }
279
+ if (c.hasAttribute("data-original-repeat-template") || c.getAttribute("data-tag-type") === "original_repeat") {
280
+ const d = c.querySelector(
281
+ "[data-original-repeat-input], .original-repeat-input"
282
+ ), E = d && B(d);
283
+ if (!E) {
284
+ s.push(
285
+ m("PROMPT_REPLY_UNSUPPORTED", "原话复述模板无法无损恢复", f)
286
+ );
287
+ return;
288
+ }
289
+ o(), u.push({
290
+ type: "originalReply",
291
+ content: E
292
+ });
293
+ return;
294
+ }
295
+ if (c.hasAttribute("data-tag-type") || c.hasAttribute("data-size") || c.hasAttribute("data-tableknowledge") || c.hasAttribute("data-variable") || c.hasAttribute("data-divider") || c.getAttribute("data-tag") === "true") {
296
+ const d = v(c);
297
+ d ? l.push(d) : s.push(
298
+ m("PROMPT_TAG_UNSUPPORTED", "业务标签无法无损恢复", f)
299
+ );
300
+ return;
301
+ }
302
+ if (!M.has(p) && !A.has(p)) {
303
+ s.push(
304
+ m("PROMPT_HTML_UNSUPPORTED", "旧提示词含不支持的排版节点", f)
305
+ );
306
+ return;
307
+ }
308
+ A.has(p) && o();
309
+ const y = [...$ || []];
310
+ if ((p === "B" || p === "STRONG") && y.push({ type: "bold" }), (p === "I" || p === "EM") && y.push({ type: "italic" }), p === "U" && y.push({ type: "underline" }), (p === "S" || p === "STRIKE") && y.push({ type: "strike" }), p === "CODE" && y.push({ type: "code" }), p === "A") {
311
+ const d = c.getAttribute("href");
312
+ if (!N(d)) {
313
+ s.push(m("PROMPT_LINK_INVALID", "链接地址无效", f));
314
+ return;
315
+ }
316
+ y.push({ type: "link", attrs: { href: d, target: "_self" } });
317
+ }
318
+ c.childNodes.forEach(
319
+ (d, E) => b(d, `${f}.childNodes[${E}]`, y)
320
+ ), A.has(p) && o();
321
+ };
322
+ if (n.body.childNodes.forEach(
323
+ (c, f) => b(c, `webClues.childNodes[${f}]`)
324
+ ), o(), s.length) return { ok: !1, raw: e, issues: s };
325
+ const h = {
326
+ schemaVersion: 1,
327
+ doc: {
328
+ type: "doc",
329
+ content: u.length ? u : [{ type: "paragraph" }]
330
+ }
331
+ }, S = I(h);
332
+ if (S)
333
+ return a("PROMPT_DOCUMENT_INVALID", "历史提示词结构无效", S);
334
+ const P = q(h);
335
+ return P.ok ? w(P.clues) !== w(e.clues) ? a(
336
+ "PROMPT_FIELDS_MISMATCH",
337
+ "展示内容与算法提示词不一致",
338
+ "clues"
339
+ ) : { ok: !0, value: h, warnings: [] } : { ok: !1, raw: e, issues: P.issues };
340
+ }
341
+ function K(t) {
342
+ var a;
343
+ let e = g(t.text || "");
344
+ for (const n of t.marks || [])
345
+ n.type === "bold" && (e = `<strong>${e}</strong>`), n.type === "italic" && (e = `<em>${e}</em>`), n.type === "strike" && (e = `<s>${e}</s>`), n.type === "underline" && (e = `<u>${e}</u>`), n.type === "code" && (e = `<code>${e}</code>`), n.type === "link" && (e = `<a href="${g(
346
+ String(((a = n.attrs) == null ? void 0 : a.href) || "")
347
+ )}">${e}</a>`);
348
+ return e;
349
+ }
350
+ function F(t) {
351
+ const { kind: e, key: a, label: n, token: u, params: l } = t.attrs || {}, i = String(n || "");
352
+ if (e === "tableKnowledge") {
353
+ const s = `##${i}##`;
354
+ return {
355
+ clues: s,
356
+ web: `<span data-tableKnowledge="true" data-tag-type="table_knowledge" data-table-name="${g(
357
+ i
358
+ )}">${g(s)}</span>`
359
+ };
360
+ }
361
+ if (e === "attribute") {
362
+ const s = `{业务属性@${i}}`, r = typeof u == "string" && u.startsWith("legacy-id:") ? u.slice(10) : "";
363
+ return {
364
+ clues: s,
365
+ web: `<span data-tag="true" data-tag-type="biz_attribute" data-attr-name="${g(
366
+ i
367
+ )}" data-attr-key="${g(String(a || i))}"${r ? ` data-attr-id="${g(r)}"` : ""}>${g(i)}</span>`
368
+ };
369
+ }
370
+ if (e === "variable") {
371
+ const s = typeof u == "string" && u.trim() ? u : `#${i}#`;
372
+ return {
373
+ clues: s,
374
+ web: `<span data-variable="true" data-tag-type="variable" data-variable-name="${g(
375
+ i
376
+ )}">${g(s)}</span>`
377
+ };
378
+ }
379
+ if (e === "todo") {
380
+ const s = i === "默认" && u === "{待办}" ? "{待办}" : `{待办@${i}}`;
381
+ return {
382
+ clues: s,
383
+ web: `<span data-tag="true" data-tag-type="todo"${i === "默认" ? "" : ` data-tag-name="${g(i)}"`}${a && a !== i ? ` plan_id="${g(String(a))}"` : ""}>${g(s)}</span>`
384
+ };
385
+ }
386
+ if (e === "separator")
387
+ return {
388
+ clues: "[sep]",
389
+ web: '<span data-divider="true" data-tag-type="separator">{分隔符}</span>'
390
+ };
391
+ if (e === "tool" && a === "small_payment") {
392
+ const s = x(t);
393
+ if (!s) return null;
394
+ const r = Number(l == null ? void 0 : l.amount) * 100;
395
+ return {
396
+ clues: s,
397
+ web: `<span contenteditable="false" data-tag="true" data-tag-type="small_payment" data-max-amount-cent="${r}">${s}</span>`
398
+ };
399
+ }
400
+ return null;
401
+ }
402
+ function H(t) {
403
+ const { kind: e, src: a, assetId: n, name: u, poster: l, status: i } = t.attrs || {};
404
+ if (i !== "ready" || e !== "image" && e !== "video" || !N(a))
405
+ return null;
406
+ const s = `src="${g(a)}"${n ? ` data-asset-id="${g(String(n))}"` : ""}${u ? ` data-media-name="${g(String(u))}"` : ""}${l ? ` poster="${g(String(l))}"` : ""}`, r = e === "image" ? `<img ${s} width="120"/>` : `<video ${s} width="240" controls/>`;
407
+ return { clues: r, web: r };
408
+ }
409
+ function X(t) {
410
+ var e;
411
+ if (t.type === "text")
412
+ return { clues: t.text || "", web: K(t) };
413
+ if (t.type === "hardBreak") return { clues: `
414
+ `, web: "<br>" };
415
+ if (t.type === "agentSizeChart") {
416
+ const a = String(((e = t.attrs) == null ? void 0 : e.name) || ""), n = `#@${a}@#`;
417
+ return {
418
+ clues: n,
419
+ web: `<span data-size="true" data-tag-type="size_chart" data-size-name="${g(
420
+ a
421
+ )}">${g(n)}</span>`
422
+ };
423
+ }
424
+ return t.type === "businessToken" ? F(t) : null;
425
+ }
426
+ function D(t) {
427
+ if (t.type === "mediaBlock") return H(t);
428
+ if (t.type === "originalReply") {
429
+ const a = (t.content || []).map(D);
430
+ if (a.some((i) => !i)) return null;
431
+ let n = "", u = "", l = !1;
432
+ return (t.content || []).forEach((i, s) => {
433
+ const r = a[s];
434
+ l && i.type === "paragraph" && (n += `
435
+ `, u += "<br>"), n += r.clues, u += i.type === "paragraph" ? r.web.replace(/^<div>/u, "").replace(/<\/div>$/u, "") : r.web, l = i.type === "paragraph";
436
+ }), {
437
+ clues: `<{原话复述}${n}>`,
438
+ web: `<span data-original-repeat-template="true" data-tag-type="original_repeat"><span data-original-repeat-input="true">${u}</span></span>`
439
+ };
440
+ }
441
+ if (t.type === "messageSeparator")
442
+ return {
443
+ clues: "[sep]",
444
+ web: '<span data-divider="true" data-tag-type="separator">{分隔符}</span>'
445
+ };
446
+ if (t.type !== "paragraph") return null;
447
+ const e = (t.content || []).map(X);
448
+ return e.some((a) => !a) ? null : {
449
+ clues: e.map((a) => a.clues).join(""),
450
+ web: `<div>${e.map((a) => a.web).join("") || "<br>"}</div>`
451
+ };
452
+ }
453
+ function q(t, e = 1e4) {
454
+ const a = I(t);
455
+ if (a)
456
+ return {
457
+ ok: !1,
458
+ issues: [
459
+ m("PROMPT_DOCUMENT_INVALID", "提示词文档包含无效内容", a)
460
+ ]
461
+ };
462
+ const n = U(t, e);
463
+ if (n.length) return { ok: !1, issues: n };
464
+ const u = (t.doc.content || []).map(D), l = u.findIndex((s) => !s);
465
+ if (l >= 0)
466
+ return {
467
+ ok: !1,
468
+ issues: [
469
+ m(
470
+ "PROMPT_NODE_UNSUPPORTED",
471
+ "提示词包含旧接口不能保存的内容",
472
+ `doc.content[${l}]`
473
+ )
474
+ ]
475
+ };
476
+ let i = "";
477
+ return (t.doc.content || []).forEach((s, r) => {
478
+ var o, b;
479
+ r > 0 && s.type !== "originalReply" && ((b = (o = t.doc.content) == null ? void 0 : o[r - 1]) == null ? void 0 : b.type) !== "originalReply" && (i += `
480
+ `), i += u[r].clues;
481
+ }), {
482
+ ok: !0,
483
+ clues: i.trim(),
484
+ webClues: u.map((s) => s.web).join("")
485
+ };
486
+ }
487
+ export {
488
+ q as exportLegacyAgentPrompt,
489
+ Y as importLegacyAgentPrompt
490
+ };
@@ -1,4 +1,4 @@
1
- import { m as r } from "./inline-Zj7Hqg-_.js";
1
+ import { m as r } from "./inline-8aNfINLF.js";
2
2
  const s = {
3
3
  execute(o, e, t) {
4
4
  if (!e.option) return [];
@@ -1,4 +1,4 @@
1
- import { _ as i } from "../index-DCmHHi07.js";
1
+ import { _ as i } from "../index-7x1OTv0m.js";
2
2
  export {
3
3
  i as FkpEditionInfo
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as r, a as t, b as F, c as l } from "../index-lNhA3N9x.js";
1
+ import { _ as r, a as t, b as F, c as l } from "../index-DBQsQ1ZK.js";
2
2
  export {
3
3
  r as FkpFilter,
4
4
  t as FkpFilterDateRange,