@freecallai/pro 0.0.0-stage → 0.0.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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +4115 -0
  4. package/dist/KnowledgeArea-OPR7smbt.js +923 -0
  5. package/dist/ToolForm-CWpUIVTl.js +185 -0
  6. package/dist/choice-DDg5gNtS.js +29 -0
  7. package/dist/guard-BCatAeT4.js +749 -0
  8. package/dist/index-5a9mHHzg.js +41 -0
  9. package/dist/index-BsQLwz91.js +5 -0
  10. package/dist/index-CJlAseSN.js +15 -0
  11. package/dist/index-CzpY61Qj.js +6 -0
  12. package/dist/index-D8bcFtWR.js +6 -0
  13. package/dist/index-DOEijEGU.js +49 -0
  14. package/dist/index-DSgEWJGP.js +6 -0
  15. package/dist/index-DxxX09iY.js +6 -0
  16. package/dist/index-nnvfy5q0.js +31 -0
  17. package/dist/index-urNonkMH.js +6 -0
  18. package/dist/index-xAjlBylT.js +5 -0
  19. package/dist/index.js +16 -0
  20. package/dist/inline-TT_dl8Y3.js +17 -0
  21. package/dist/knowledge-BZCmalF_.js +6 -0
  22. package/dist/knowledge-DnYGicjn.js +13 -0
  23. package/dist/media-extensions-ZoxmhIhH.js +276 -0
  24. package/dist/media-migration-CGOFwdYm.js +59 -0
  25. package/dist/media-upload-Dx45yv6a.js +69 -0
  26. package/dist/operations-JgnjGx3H.js +19 -0
  27. package/dist/question-D1--acV8.js +10 -0
  28. package/dist/question-DGC6JHy5.js +6 -0
  29. package/dist/rich-text/index.js +224 -0
  30. package/dist/rich-text/legacy-converter/index.js +485 -0
  31. package/dist/selection-state-D47jhx0U.js +20 -0
  32. package/dist/state-KfOqha3d.js +16 -0
  33. package/dist/style.css +1 -0
  34. package/dist/types/index.d.ts +10 -0
  35. package/dist/types/rich-text/FkpRichText.vue.d.ts +242 -0
  36. package/dist/types/rich-text/MediaView.vue.d.ts +92 -0
  37. package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +35 -0
  38. package/dist/types/rich-text/config/catalog.d.ts +3 -0
  39. package/dist/types/rich-text/config/descriptor.d.ts +58 -0
  40. package/dist/types/rich-text/config/media-options.d.ts +6 -0
  41. package/dist/types/rich-text/config/resolve.d.ts +17 -0
  42. package/dist/types/rich-text/config/selection-options.d.ts +6 -0
  43. package/dist/types/rich-text/extensions.d.ts +6 -0
  44. package/dist/types/rich-text/index.d.ts +17 -0
  45. package/dist/types/rich-text/legacy-converter/index.d.ts +45 -0
  46. package/dist/types/rich-text/media-extensions.d.ts +4 -0
  47. package/dist/types/rich-text/media-id.d.ts +2 -0
  48. package/dist/types/rich-text/model/agent-context.d.ts +7 -0
  49. package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
  50. package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
  51. package/dist/types/rich-text/model/convert.d.ts +6 -0
  52. package/dist/types/rich-text/model/guard.d.ts +7 -0
  53. package/dist/types/rich-text/model/json-value.d.ts +2 -0
  54. package/dist/types/rich-text/model/media-migration.d.ts +8 -0
  55. package/dist/types/rich-text/model/node-contract.d.ts +10 -0
  56. package/dist/types/rich-text/model/node-identity.d.ts +8 -0
  57. package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
  58. package/dist/types/rich-text/model/preview.d.ts +2 -0
  59. package/dist/types/rich-text/model/question-text.d.ts +15 -0
  60. package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
  61. package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
  62. package/dist/types/rich-text/model/validate.d.ts +19 -0
  63. package/dist/types/rich-text/model/web-url.d.ts +2 -0
  64. package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
  65. package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
  66. package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
  67. package/dist/types/rich-text/plugins/block.d.ts +3 -0
  68. package/dist/types/rich-text/plugins/choice.d.ts +4 -0
  69. package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
  70. package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
  71. package/dist/types/rich-text/plugins/inline.d.ts +3 -0
  72. package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
  73. package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
  74. package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
  75. package/dist/types/rich-text/plugins/operations.d.ts +86 -0
  76. package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
  77. package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
  78. package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
  79. package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
  80. package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
  81. package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
  82. package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
  83. package/dist/types/rich-text/plugins/registry.d.ts +14 -0
  84. package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
  85. package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
  86. package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
  87. package/dist/types/rich-text/plugins/state.d.ts +3 -0
  88. package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
  89. package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
  90. package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
  91. package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
  92. package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
  93. package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
  94. package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
  95. package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
  96. package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
  97. package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
  98. package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
  99. package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
  100. package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
  101. package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
  102. package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
  103. package/dist/types/rich-text/public/types.d.ts +588 -0
  104. package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
  105. package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
  106. package/dist/types/rich-text/runtime/media-target.d.ts +8 -0
  107. package/dist/types/rich-text/runtime/media-upload-session.d.ts +59 -0
  108. package/dist/types/rich-text/runtime/operations.d.ts +48 -0
  109. package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
  110. package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
  111. package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
  112. package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
  113. package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
  114. package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
  115. package/dist/types/rich-text/types.d.ts +40 -0
  116. package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
  117. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +117 -0
  118. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
  119. package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
  120. package/package.json +70 -3
@@ -0,0 +1,749 @@
1
+ const it = [
2
+ {
3
+ id: "todo",
4
+ apiVersion: 1,
5
+ dataVersion: 1,
6
+ implementation: "plugin",
7
+ label: "待办",
8
+ slot: "questionAction",
9
+ actions: [{ id: "todo.questionAction.apply", requiredPorts: [] }],
10
+ order: 10,
11
+ types: ["normal"],
12
+ icon: "todo",
13
+ optionKind: "selection",
14
+ optionSource: "flatTags",
15
+ optionTrigger: "hover",
16
+ questionTag: { kind: "todo" }
17
+ },
18
+ {
19
+ id: "todo",
20
+ apiVersion: 1,
21
+ dataVersion: 1,
22
+ implementation: "plugin",
23
+ label: "待办",
24
+ slot: "knowledgeInline",
25
+ actions: [{ id: "todo.knowledgeInline.apply", requiredPorts: [] }],
26
+ order: 10,
27
+ types: ["reasoning"],
28
+ icon: "todo",
29
+ optionKind: "selection",
30
+ optionSource: "flatTags",
31
+ optionTrigger: "hover"
32
+ }
33
+ ], ot = [
34
+ {
35
+ id: "ticket",
36
+ apiVersion: 1,
37
+ dataVersion: 1,
38
+ implementation: "plugin",
39
+ label: "工单",
40
+ slot: "knowledgeInline",
41
+ actions: [{ id: "ticket.knowledgeInline.apply", requiredPorts: [] }],
42
+ order: 25,
43
+ types: ["reasoning"],
44
+ icon: "ticket",
45
+ optionKind: "selection",
46
+ optionSource: "flatTags",
47
+ optionTrigger: "hover"
48
+ }
49
+ ], st = [
50
+ {
51
+ id: "originalReply",
52
+ apiVersion: 1,
53
+ dataVersion: 1,
54
+ implementation: "plugin",
55
+ label: "原话",
56
+ slot: "questionAction",
57
+ actions: [{ id: "originalReply.questionAction.apply", requiredPorts: [] }],
58
+ order: 20,
59
+ types: ["normal"],
60
+ icon: "original"
61
+ },
62
+ {
63
+ id: "originalReply",
64
+ apiVersion: 1,
65
+ dataVersion: 1,
66
+ implementation: "plugin",
67
+ label: "原话",
68
+ slot: "knowledgeBlock",
69
+ actions: [{ id: "originalReply.knowledgeBlock.apply", requiredPorts: [] }],
70
+ order: 20,
71
+ types: ["reasoning"],
72
+ icon: "original"
73
+ }
74
+ ], at = [
75
+ {
76
+ id: "memory",
77
+ apiVersion: 1,
78
+ dataVersion: 1,
79
+ implementation: "plugin",
80
+ label: "记忆",
81
+ slot: "questionAction",
82
+ actions: [{ id: "memory.questionAction.apply", requiredPorts: [] }],
83
+ order: 30,
84
+ types: ["normal", "reasoning", "agent"],
85
+ icon: "memory"
86
+ }
87
+ ], lt = [
88
+ {
89
+ id: "tagged",
90
+ apiVersion: 1,
91
+ dataVersion: 1,
92
+ implementation: "plugin",
93
+ label: "打标",
94
+ slot: "questionAction",
95
+ actions: [{ id: "tagged.questionAction.apply", requiredPorts: [] }],
96
+ order: 40,
97
+ types: ["normal", "reasoning", "agent"],
98
+ icon: "tag",
99
+ optionKind: "selection",
100
+ optionSource: "flatTags",
101
+ optionTrigger: "hover",
102
+ questionTag: { kind: "default" }
103
+ }
104
+ ], ct = [
105
+ {
106
+ id: "attribute",
107
+ apiVersion: 1,
108
+ dataVersion: 1,
109
+ implementation: "plugin",
110
+ label: "属性",
111
+ slot: "knowledgeInline",
112
+ actions: [{ id: "attribute.knowledgeInline.apply", requiredPorts: [] }],
113
+ order: 30,
114
+ types: ["reasoning"],
115
+ icon: "attribute",
116
+ optionKind: "selection",
117
+ optionSource: "capabilities",
118
+ optionTrigger: "hover",
119
+ optionHierarchy: "tree"
120
+ }
121
+ ], pt = [
122
+ {
123
+ id: "tool",
124
+ apiVersion: 1,
125
+ dataVersion: 1,
126
+ implementation: "plugin",
127
+ label: "工具",
128
+ slot: "knowledgeInline",
129
+ actions: [{ id: "tool.knowledgeInline.apply", requiredPorts: [] }],
130
+ order: 40,
131
+ types: ["reasoning"],
132
+ icon: "tool",
133
+ optionKind: "selection",
134
+ optionSource: "capabilities",
135
+ optionTrigger: "hover",
136
+ optionHierarchy: "tree",
137
+ uiPorts: ["getToolForm"]
138
+ }
139
+ ], dt = [
140
+ {
141
+ id: "variable",
142
+ apiVersion: 1,
143
+ dataVersion: 1,
144
+ implementation: "plugin",
145
+ label: "变量",
146
+ slot: "knowledgeInline",
147
+ actions: [{ id: "variable.knowledgeInline.apply", requiredPorts: [] }],
148
+ order: 50,
149
+ types: ["normal", "reasoning"],
150
+ icon: "variable",
151
+ optionKind: "selection",
152
+ optionSource: "variables"
153
+ }
154
+ ];
155
+ const Ot = {
156
+ agents: "searchAgents",
157
+ variables: "listVariables",
158
+ flatTags: "listCapabilityOptions",
159
+ capabilities: "listCapabilityOptions"
160
+ };
161
+ const w = {
162
+ agentOpenConfig: {
163
+ id: "agentSelect.openConfig",
164
+ requiredPorts: ["openAgentConfig"]
165
+ },
166
+ imageUpload: { id: "image.upload", requiredPorts: ["uploadMedia"] },
167
+ videoUpload: { id: "video.upload", requiredPorts: ["uploadMedia"] },
168
+ reasoningPolishPropose: {
169
+ id: "reasoningPolish.propose",
170
+ requiredPorts: ["proposeReasoning"]
171
+ },
172
+ reasoningTemplateLoad: {
173
+ id: "reasoningTemplate.load",
174
+ requiredPorts: ["getReasoningTemplate"]
175
+ }
176
+ }, ut = [
177
+ {
178
+ id: "image",
179
+ apiVersion: 1,
180
+ dataVersion: 1,
181
+ implementation: "plugin",
182
+ label: "图片",
183
+ slot: "knowledgeBlock",
184
+ actions: [w.imageUpload],
185
+ primaryActionId: "image.upload",
186
+ order: 60,
187
+ types: ["normal", "reasoning"],
188
+ icon: "image",
189
+ optionKind: "media"
190
+ }
191
+ ], gt = [
192
+ {
193
+ id: "video",
194
+ apiVersion: 1,
195
+ dataVersion: 1,
196
+ implementation: "plugin",
197
+ label: "视频",
198
+ slot: "knowledgeBlock",
199
+ actions: [w.videoUpload],
200
+ primaryActionId: "video.upload",
201
+ order: 70,
202
+ types: ["normal", "reasoning"],
203
+ icon: "video",
204
+ optionKind: "media"
205
+ }
206
+ ], ft = [
207
+ {
208
+ id: "separator",
209
+ apiVersion: 1,
210
+ dataVersion: 1,
211
+ implementation: "plugin",
212
+ label: "分隔符",
213
+ slot: "knowledgeInline",
214
+ actions: [{ id: "separator.knowledgeInline.apply", requiredPorts: [] }],
215
+ order: 80,
216
+ types: ["normal", "reasoning"],
217
+ icon: "separator"
218
+ }
219
+ ], yt = [
220
+ {
221
+ id: "reasoningPolish",
222
+ apiVersion: 1,
223
+ dataVersion: 1,
224
+ implementation: "plugin",
225
+ label: "润色",
226
+ slot: "sceneAction",
227
+ actions: [w.reasoningPolishPropose],
228
+ primaryActionId: "reasoningPolish.propose",
229
+ order: 90,
230
+ types: ["reasoning"],
231
+ icon: "polish"
232
+ }
233
+ ], kt = [
234
+ {
235
+ id: "reasoningTemplate",
236
+ apiVersion: 1,
237
+ dataVersion: 1,
238
+ implementation: "plugin",
239
+ label: "模板",
240
+ slot: "sceneAction",
241
+ actions: [w.reasoningTemplateLoad],
242
+ primaryActionId: "reasoningTemplate.load",
243
+ order: 100,
244
+ types: ["reasoning"],
245
+ icon: "template",
246
+ optionKind: "selection",
247
+ optionSource: "capabilities"
248
+ }
249
+ ], mt = [
250
+ {
251
+ id: "agentSelect",
252
+ apiVersion: 1,
253
+ dataVersion: 1,
254
+ implementation: "host",
255
+ label: "选择 Agent",
256
+ slot: "sceneAction",
257
+ actions: [w.agentOpenConfig],
258
+ readPorts: ["getAgentPrompt"],
259
+ order: 10,
260
+ types: ["agent"],
261
+ icon: "agent",
262
+ optionKind: "selection",
263
+ optionSource: "agents",
264
+ optionTrigger: "hover"
265
+ }
266
+ ], Y = [
267
+ ...it,
268
+ ...ot,
269
+ ...st,
270
+ ...at,
271
+ ...lt,
272
+ ...ct,
273
+ ...pt,
274
+ ...dt,
275
+ ...ut,
276
+ ...gt,
277
+ ...ft,
278
+ ...yt,
279
+ ...kt,
280
+ ...mt
281
+ ];
282
+ function Z(n, r = "") {
283
+ const e = /* @__PURE__ */ new Set(), s = (o, t, i) => {
284
+ if (o === null || typeof o == "string" || typeof o == "boolean")
285
+ return null;
286
+ if (typeof o == "number")
287
+ return Number.isFinite(o) ? null : t;
288
+ if (typeof o != "object" || i > 64 || e.has(o))
289
+ return t;
290
+ if (!Array.isArray(o)) {
291
+ const l = Object.getPrototypeOf(o);
292
+ if (l !== Object.prototype && l !== null) return t;
293
+ }
294
+ const u = Reflect.ownKeys(o);
295
+ if (u.some((l) => typeof l == "symbol")) return t;
296
+ if (Array.isArray(o)) {
297
+ if (u.length !== o.length + 1) return t;
298
+ for (let l = 0; l < o.length; l++)
299
+ if (!Object.prototype.hasOwnProperty.call(o, l))
300
+ return `${t}[${l}]`;
301
+ }
302
+ e.add(o);
303
+ for (const l of u) {
304
+ if (Array.isArray(o) && l === "length") continue;
305
+ const a = Object.getOwnPropertyDescriptor(o, l), p = Array.isArray(o) ? `${t}[${String(l)}]` : t ? `${t}.${String(l)}` : String(l);
306
+ if (!a || !("value" in a) || !Array.isArray(o) && !a.enumerable)
307
+ return p;
308
+ const d = s(a.value, p, i + 1);
309
+ if (d !== null) return d;
310
+ }
311
+ return e.delete(o), null;
312
+ };
313
+ try {
314
+ return s(n, r, 0);
315
+ } catch {
316
+ return r;
317
+ }
318
+ }
319
+ function $(n) {
320
+ if (typeof n != "string" || !/^https?:\/\/[^\s]+$/i.test(n))
321
+ return !1;
322
+ try {
323
+ const r = new URL(n);
324
+ return (r.protocol === "http:" || r.protocol === "https:") && !!r.hostname && !r.username && !r.password;
325
+ } catch {
326
+ return !1;
327
+ }
328
+ }
329
+ const bt = [
330
+ "todo",
331
+ "ticket",
332
+ "variable",
333
+ "attribute",
334
+ "tool",
335
+ "separator"
336
+ ], wt = ["todo", "ticket", "attribute"], St = ["image", "video"], At = new Set(bt), $t = new Set(wt), qt = new Set(St), tt = (n) => typeof n == "string" && At.has(n), Rt = (n) => typeof n == "string" && $t.has(n), et = (n) => typeof n == "string" && qt.has(n), Vt = /* @__PURE__ */ new Set([
337
+ "businessToken",
338
+ "originalReply",
339
+ "messageSeparator",
340
+ "mediaBlock"
341
+ ]), q = (n) => Vt.has(n);
342
+ function Dt(n, r) {
343
+ return n === "businessToken" ? tt(r == null ? void 0 : r.kind) ? r.kind : null : n === "mediaBlock" ? et(r == null ? void 0 : r.kind) ? r.kind : null : n === "originalReply" ? "originalReply" : n === "messageSeparator" ? "separator" : null;
344
+ }
345
+ function ht(n) {
346
+ var r;
347
+ return !!((r = n.content) != null && r.some(
348
+ (e) => typeof e.type == "string" && q(e.type) || ht(e)
349
+ ));
350
+ }
351
+ const Bt = "fkpTrustedNodeIds";
352
+ function Kt(n) {
353
+ const r = [], e = (s) => {
354
+ var o, t;
355
+ s.type && q(s.type) && typeof ((o = s.attrs) == null ? void 0 : o.id) == "string" && s.attrs.id && r.push(s.attrs.id), (t = s.content) == null || t.forEach(e);
356
+ };
357
+ return Array.isArray(n) ? n.forEach(e) : e(n), r;
358
+ }
359
+ function Nt(n, r) {
360
+ for (let t = 0; t < 8; t++) {
361
+ const i = r();
362
+ if (i && !n.has(i)) return i;
363
+ }
364
+ const e = r() || "node";
365
+ let s = e, o = 1;
366
+ for (; n.has(s); ) s = `${e}-${o++}`;
367
+ return s;
368
+ }
369
+ const W = {
370
+ todo: "待办",
371
+ tagged: "顾客标签"
372
+ };
373
+ function xt(n) {
374
+ return n.includes("[") || n.includes("]") || /[【】\r\n]/u.test(n);
375
+ }
376
+ function nt(n) {
377
+ return /[{}\r\n]/u.test(n);
378
+ }
379
+ function It(n, r) {
380
+ var i;
381
+ const e = (i = n.extensionState[r]) == null ? void 0 : i.data;
382
+ if (!e || typeof e != "object" || Array.isArray(e)) return null;
383
+ const { tag: s } = e;
384
+ if (!s || typeof s != "object" || Array.isArray(s)) return null;
385
+ const { id: o, label: t } = s;
386
+ return typeof o != "string" || !o.trim() || typeof t != "string" || !t.trim() ? null : { id: o, label: t };
387
+ }
388
+ function Tt(n) {
389
+ return ["todo", "tagged"].flatMap((r) => {
390
+ var t;
391
+ if (r === "todo" && n.type !== "normal") return [];
392
+ const e = (t = n.extensionState[r]) == null ? void 0 : t.data, s = e && typeof e == "object" && !Array.isArray(e) ? e.enabled === !0 : !1, o = s ? It(n, r) : null;
393
+ if (s && !o)
394
+ throw new Error(`${W[r]}已开启但未选择方案`);
395
+ if (o && nt(o.label))
396
+ throw new Error("方案名称包含协议保留字符");
397
+ return o ? [`{${W[r]}@${o.label}}`] : [];
398
+ }).join("");
399
+ }
400
+ function Lt(n) {
401
+ var r;
402
+ if (typeof ((r = n.question) == null ? void 0 : r.text) != "string" || xt(n.question.text))
403
+ throw new Error("意图文字中不可填写方括号或换行,请修改");
404
+ return `[${n.question.text}]${Tt(n)}`;
405
+ }
406
+ const rt = /* @__PURE__ */ new Set([
407
+ "doc",
408
+ "paragraph",
409
+ "text",
410
+ "bulletList",
411
+ "orderedList",
412
+ "listItem",
413
+ "blockquote",
414
+ "codeBlock",
415
+ "hardBreak",
416
+ "horizontalRule",
417
+ "businessToken",
418
+ "originalReply",
419
+ "messageSeparator",
420
+ "mediaBlock"
421
+ ]), Ct = (n) => rt.has(n), vt = /* @__PURE__ */ new Set([
422
+ "bold",
423
+ "italic",
424
+ "strike",
425
+ "code",
426
+ "link",
427
+ "underline"
428
+ ]), A = /* @__PURE__ */ new Set([
429
+ "paragraph",
430
+ "bulletList",
431
+ "orderedList",
432
+ "blockquote",
433
+ "codeBlock",
434
+ "horizontalRule",
435
+ "originalReply",
436
+ "messageSeparator",
437
+ "mediaBlock"
438
+ ]), J = {
439
+ doc: A,
440
+ paragraph: /* @__PURE__ */ new Set(["text", "hardBreak", "businessToken"]),
441
+ bulletList: /* @__PURE__ */ new Set(["listItem"]),
442
+ orderedList: /* @__PURE__ */ new Set(["listItem"]),
443
+ listItem: /* @__PURE__ */ new Set(["paragraph", ...A]),
444
+ blockquote: A,
445
+ codeBlock: /* @__PURE__ */ new Set(["text"]),
446
+ originalReply: /* @__PURE__ */ new Set(["paragraph", "mediaBlock", "messageSeparator"])
447
+ }, Pt = {
448
+ orderedList: /* @__PURE__ */ new Set(["start", "type"]),
449
+ codeBlock: /* @__PURE__ */ new Set(["language"]),
450
+ businessToken: /* @__PURE__ */ new Set([
451
+ "id",
452
+ "nodeVersion",
453
+ "kind",
454
+ "key",
455
+ "label",
456
+ "token",
457
+ "params"
458
+ ]),
459
+ originalReply: /* @__PURE__ */ new Set(["id", "nodeVersion"]),
460
+ messageSeparator: /* @__PURE__ */ new Set(["id", "nodeVersion"]),
461
+ mediaBlock: /* @__PURE__ */ new Set([
462
+ "id",
463
+ "nodeVersion",
464
+ "assetId",
465
+ "src",
466
+ "kind",
467
+ "name",
468
+ "poster",
469
+ "status",
470
+ "error"
471
+ ])
472
+ };
473
+ function jt(n) {
474
+ if (!n || typeof n != "object" || Array.isArray(n)) return !1;
475
+ const r = n;
476
+ if (typeof r.type != "string" || !vt.has(r.type) || Object.keys(r).some((o) => !["type", "attrs"].includes(o)) || r.attrs !== void 0 && (!r.attrs || typeof r.attrs != "object" || Array.isArray(r.attrs)))
477
+ return !1;
478
+ const e = r.attrs || {};
479
+ if (r.type !== "link") return Object.keys(e).length === 0;
480
+ if (Object.keys(e).some(
481
+ (o) => !["href", "target", "rel", "class", "title"].includes(o)
482
+ ) || !$(e.href))
483
+ return !1;
484
+ const s = (o) => o == null || typeof o == "string";
485
+ return !s(e.rel) || !s(e.class) || !s(e.title) || e.target !== void 0 && e.target !== null && !["_blank", "_self"].includes(String(e.target)) ? !1 : e.target !== "_blank" || typeof e.rel == "string" && e.rel.split(/\s+/).includes("noopener");
486
+ }
487
+ function m(n, r, e = "") {
488
+ const s = Object.keys(n).find(
489
+ (o) => !r.includes(o)
490
+ );
491
+ return s ? e ? `${e}.${s}` : s : null;
492
+ }
493
+ function G(n, r = "knowledge.doc") {
494
+ if (n === null) return null;
495
+ const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new WeakSet();
496
+ function o(t, i, u, l = !1) {
497
+ var p, d, y, g, k, f, b, V, h, x, I, T, v, P, j, O, R, D, B, K, N, L, C, U, F, M, E, _, z, H;
498
+ if (!t || typeof t != "object" || !t.type || !rt.has(t.type) || s.has(t) || (s.add(t), u ? !((p = J[u]) != null && p.has(t.type)) : t.type !== "doc") || l && t.type === "businessToken" && ((d = t.attrs) == null ? void 0 : d.kind) === "attribute")
499
+ return i;
500
+ for (const c of Object.keys(t))
501
+ if (!["type", "attrs", "content", "marks", "text"].includes(c))
502
+ return `${i}.${c}`;
503
+ if (t.content !== void 0 && !Array.isArray(t.content))
504
+ return `${i}.content`;
505
+ if (["bulletList", "orderedList", "blockquote", "originalReply"].includes(
506
+ t.type
507
+ ) && !((y = t.content) != null && y.length))
508
+ return `${i}.content`;
509
+ if (t.type === "listItem" && ((k = (g = t.content) == null ? void 0 : g[0]) == null ? void 0 : k.type) !== "paragraph")
510
+ return (f = t.content) != null && f.length ? `${i}.content[0]` : `${i}.content`;
511
+ if (t.text !== void 0 && t.type !== "text") return `${i}.text`;
512
+ if (t.type === "text" && (typeof t.text != "string" || t.text.length === 0))
513
+ return `${i}.text`;
514
+ if (t.type === "text" && t.content !== void 0)
515
+ return `${i}.content`;
516
+ if ((b = t.content) != null && b.length && !J[t.type])
517
+ return `${i}.content`;
518
+ if (t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
519
+ return `${i}.attrs`;
520
+ const a = Pt[t.type] || /* @__PURE__ */ new Set();
521
+ for (const c of Object.keys(t.attrs || {}))
522
+ if (!a.has(c)) return `${i}.attrs.${c}`;
523
+ if (t.type === "businessToken" && !tt((V = t.attrs) == null ? void 0 : V.kind))
524
+ return `${i}.attrs.kind`;
525
+ if (t.type === "businessToken" && (typeof ((h = t.attrs) == null ? void 0 : h.key) != "string" || !t.attrs.key))
526
+ return `${i}.attrs.key`;
527
+ if (t.type === "businessToken" && ((x = t.attrs) == null ? void 0 : x.label) !== void 0 && typeof t.attrs.label != "string")
528
+ return `${i}.attrs.label`;
529
+ if (t.type === "businessToken" && ((I = t.attrs) == null ? void 0 : I.token) !== void 0 && t.attrs.token !== null && typeof t.attrs.token != "string")
530
+ return `${i}.attrs.token`;
531
+ if (t.type === "businessToken" && ((T = t.attrs) == null ? void 0 : T.params) != null && (t.attrs.kind !== "tool" || typeof t.attrs.params != "object" || Array.isArray(t.attrs.params) || Z(t.attrs.params) !== null || JSON.stringify(t.attrs.params).length > 8192))
532
+ return `${i}.attrs.params`;
533
+ if (t.type === "mediaBlock" && !et((v = t.attrs) == null ? void 0 : v.kind))
534
+ return `${i}.attrs.kind`;
535
+ if (t.type === "mediaBlock") {
536
+ if (((P = t.attrs) == null ? void 0 : P.assetId) !== void 0 && t.attrs.assetId !== null && typeof t.attrs.assetId != "string")
537
+ return `${i}.attrs.assetId`;
538
+ if (((j = t.attrs) == null ? void 0 : j.name) !== void 0 && typeof t.attrs.name != "string")
539
+ return `${i}.attrs.name`;
540
+ if (((O = t.attrs) == null ? void 0 : O.error) !== void 0 && typeof t.attrs.error != "string")
541
+ return `${i}.attrs.error`;
542
+ if (((R = t.attrs) == null ? void 0 : R.status) !== void 0 && !["ready", "uploading", "error"].includes(String(t.attrs.status)))
543
+ return `${i}.attrs.status`;
544
+ const c = (((D = t.attrs) == null ? void 0 : D.status) === "uploading" || ((B = t.attrs) == null ? void 0 : B.status) === "error") && typeof ((K = t.attrs) == null ? void 0 : K.src) == "string" && t.attrs.src.startsWith("blob:");
545
+ if (!$((N = t.attrs) == null ? void 0 : N.src) && !c)
546
+ return `${i}.attrs.src`;
547
+ if (((L = t.attrs) == null ? void 0 : L.poster) !== void 0 && t.attrs.poster !== null && !$(t.attrs.poster))
548
+ return `${i}.attrs.poster`;
549
+ }
550
+ if (q(t.type)) {
551
+ const c = (C = t.attrs) == null ? void 0 : C.id;
552
+ if ((t.type === "mediaBlock" || c !== void 0) && (typeof c != "string" || !c.trim() || e.has(c)))
553
+ return `${i}.attrs.id`;
554
+ if (typeof c == "string" && e.add(c), ((U = t.attrs) == null ? void 0 : U.nodeVersion) !== void 0 && (!Number.isSafeInteger(t.attrs.nodeVersion) || t.attrs.nodeVersion < 0))
555
+ return `${i}.attrs.nodeVersion`;
556
+ }
557
+ if (t.type === "orderedList" && ((F = t.attrs) == null ? void 0 : F.start) !== void 0 && (!Number.isSafeInteger(t.attrs.start) || t.attrs.start < 1))
558
+ return `${i}.attrs.start`;
559
+ if (t.type === "orderedList" && ((M = t.attrs) == null ? void 0 : M.type) !== void 0 && t.attrs.type !== null && !["1", "a", "A", "i", "I"].includes(t.attrs.type))
560
+ return `${i}.attrs.type`;
561
+ if (t.type === "codeBlock" && ((E = t.attrs) == null ? void 0 : E.language) !== void 0 && t.attrs.language !== null && typeof t.attrs.language != "string")
562
+ return `${i}.attrs.language`;
563
+ if (t.marks !== void 0 && !Array.isArray(t.marks))
564
+ return `${i}.marks`;
565
+ if (u === "codeBlock" && ((_ = t.marks) != null && _.length)) return `${i}.marks`;
566
+ if ((z = t.marks) != null && z.some((c) => !jt(c)))
567
+ return `${i}.marks`;
568
+ if ((H = t.marks) != null && H.length) {
569
+ const c = t.marks.map((S) => S.type);
570
+ if (new Set(c).size !== c.length || c.includes("code") && c.length > 1)
571
+ return `${i}.marks`;
572
+ }
573
+ for (const [c, S] of (t.content || []).entries()) {
574
+ const Q = o(
575
+ S,
576
+ `${i}.content[${c}]`,
577
+ t.type,
578
+ l || t.type === "originalReply"
579
+ );
580
+ if (Q) return Q;
581
+ }
582
+ return null;
583
+ }
584
+ return o(n, r);
585
+ }
586
+ function X(n, r, e = "knowledge.doc") {
587
+ if (!n) return null;
588
+ const s = /* @__PURE__ */ new WeakSet(), o = (t, i) => {
589
+ var a, p;
590
+ if (s.has(t)) return i;
591
+ s.add(t);
592
+ const u = t.type === "businessToken" ? String((a = t.attrs) == null ? void 0 : a.kind) : t.type === "mediaBlock" ? String((p = t.attrs) == null ? void 0 : p.kind) : t.type === "originalReply" ? "originalReply" : t.type === "messageSeparator" ? "separator" : null, l = t.type === "businessToken" ? "knowledgeInline" : u ? "knowledgeBlock" : null;
593
+ if (t.type === "messageSeparator" && r === "agent" || u && t.type !== "messageSeparator" && !Y.some(
594
+ (d) => d.id === u && d.slot === l && d.types.includes(r)
595
+ ))
596
+ return i;
597
+ for (const [d, y] of (t.content || []).entries()) {
598
+ const g = o(y, `${i}.content[${d}]`);
599
+ if (g) return g;
600
+ }
601
+ return null;
602
+ };
603
+ return o(n, e);
604
+ }
605
+ function Ut(n) {
606
+ if (!n || typeof n != "object" || Array.isArray(n)) return !1;
607
+ const r = n, e = r.question, s = r.knowledge;
608
+ return ["normal", "reasoning", "agent"].includes(String(r.type)) && !!e && typeof e == "object" && !Array.isArray(e) && typeof e.text == "string" && !!s && typeof s == "object" && !Array.isArray(s) && Object.prototype.hasOwnProperty.call(s, "doc") && !!r.extensionState && typeof r.extensionState == "object" && !Array.isArray(r.extensionState);
609
+ }
610
+ function Ft(n) {
611
+ if (!n || typeof n != "object" || Array.isArray(n))
612
+ return "modelValue";
613
+ const r = Z(n);
614
+ if (r !== null) return r || "modelValue";
615
+ const e = n;
616
+ if (e.schemaVersion !== 1) return "schemaVersion";
617
+ const s = m(e, [
618
+ "schemaVersion",
619
+ "id",
620
+ "type",
621
+ "question",
622
+ "knowledge",
623
+ "extensionState"
624
+ ]);
625
+ if (s) return s;
626
+ if (e.id !== void 0 && typeof e.id != "string") return "id";
627
+ if (!["normal", "reasoning", "agent"].includes(e.type)) return "type";
628
+ if (!e.question || typeof e.question != "object" || Array.isArray(e.question) || typeof e.question.text != "string")
629
+ return "question.text";
630
+ const o = m(
631
+ e.question,
632
+ ["text"],
633
+ "question"
634
+ );
635
+ if (o) return o;
636
+ if (!e.knowledge || typeof e.knowledge != "object" || Array.isArray(e.knowledge))
637
+ return "knowledge";
638
+ const t = m(
639
+ e.knowledge,
640
+ ["doc", "retainedDoc", "agentRef"],
641
+ "knowledge"
642
+ );
643
+ if (t) return t;
644
+ if (!Object.prototype.hasOwnProperty.call(e.knowledge, "doc") || e.type === "agent" && e.knowledge.doc !== null)
645
+ return "knowledge.doc";
646
+ if (e.type !== "agent") {
647
+ if (e.knowledge.agentRef != null) return "knowledge.agentRef";
648
+ if (Object.prototype.hasOwnProperty.call(e.knowledge, "retainedDoc"))
649
+ return "knowledge.retainedDoc";
650
+ }
651
+ if (e.knowledge.agentRef !== void 0 && e.knowledge.agentRef !== null) {
652
+ const { agentRef: a } = e.knowledge;
653
+ if (typeof a != "object" || Array.isArray(a) || typeof a.id != "string" || !a.id || typeof a.name != "string")
654
+ return "knowledge.agentRef";
655
+ const p = m(
656
+ a,
657
+ ["id", "name"],
658
+ "knowledge.agentRef"
659
+ );
660
+ if (p) return p;
661
+ }
662
+ const i = G(e.knowledge.doc);
663
+ if (i) return i;
664
+ const u = X(
665
+ e.knowledge.doc,
666
+ e.type
667
+ );
668
+ if (u) return u;
669
+ const l = G(
670
+ e.knowledge.retainedDoc ?? null,
671
+ "knowledge.retainedDoc"
672
+ );
673
+ if (l) return l;
674
+ if (e.type === "agent") {
675
+ const a = X(
676
+ e.knowledge.retainedDoc ?? null,
677
+ "normal",
678
+ "knowledge.retainedDoc"
679
+ );
680
+ if (a) return a;
681
+ }
682
+ if (!e.extensionState || typeof e.extensionState != "object" || Array.isArray(e.extensionState))
683
+ return "extensionState";
684
+ for (const [a, p] of Object.entries(e.extensionState)) {
685
+ const d = Y.find(
686
+ (g) => g.id === a && g.types.includes(e.type) && g.implementation === "plugin"
687
+ );
688
+ if (!d) return `extensionState.${a}`;
689
+ if (!p || typeof p != "object" || p.version !== d.dataVersion)
690
+ return `extensionState.${a}.version`;
691
+ const y = m(
692
+ p,
693
+ ["version", "data"],
694
+ `extensionState.${a}`
695
+ );
696
+ if (y) return y;
697
+ if (!p.data || typeof p.data != "object" || Array.isArray(p.data))
698
+ return `extensionState.${a}.data`;
699
+ if (d.slot === "questionAction" && typeof p.data.enabled != "boolean")
700
+ return `extensionState.${a}.data.enabled`;
701
+ if (d.slot === "questionAction" && (a === "todo" || a === "tagged")) {
702
+ const g = p.data;
703
+ if (g.enabled === !0 && g.tag === void 0)
704
+ return `extensionState.${a}.data.tag`;
705
+ if (g.tag !== void 0) {
706
+ const { tag: k } = g;
707
+ if (!k || typeof k != "object" || Array.isArray(k))
708
+ return `extensionState.${a}.data.tag`;
709
+ const f = k;
710
+ if (typeof f.id != "string" || !f.id.trim())
711
+ return `extensionState.${a}.data.tag.id`;
712
+ if (typeof f.label != "string" || !f.label.trim() || nt(f.label))
713
+ return `extensionState.${a}.data.tag.label`;
714
+ const b = m(
715
+ f,
716
+ ["id", "label"],
717
+ `extensionState.${a}.data.tag`
718
+ );
719
+ if (b) return b;
720
+ }
721
+ }
722
+ }
723
+ return null;
724
+ }
725
+ export {
726
+ bt as B,
727
+ wt as C,
728
+ St as M,
729
+ Tt as a,
730
+ Ft as b,
731
+ Y as c,
732
+ Ut as d,
733
+ q as e,
734
+ Z as f,
735
+ G as g,
736
+ xt as h,
737
+ Ct as i,
738
+ $ as j,
739
+ nt as k,
740
+ Dt as l,
741
+ ht as m,
742
+ It as n,
743
+ Ot as o,
744
+ Nt as p,
745
+ Rt as q,
746
+ Kt as r,
747
+ Lt as s,
748
+ Bt as t
749
+ };