@freecallai/pro 0.0.0-stage → 0.0.2
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.
- package/LICENSE +21 -0
- package/README.md +16 -2
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js +4416 -0
- package/dist/KnowledgeArea-BkRVWFrg.js +1224 -0
- package/dist/ToolForm-BSJxTJ7U.js +185 -0
- package/dist/choice-DDg5gNtS.js +29 -0
- package/dist/index-BVHYCLDv.js +5 -0
- package/dist/index-BnFTr8u9.js +49 -0
- package/dist/index-CG2j9Znw.js +41 -0
- package/dist/index-CJlAseSN.js +15 -0
- package/dist/index-CzpY61Qj.js +6 -0
- package/dist/index-D8bcFtWR.js +6 -0
- package/dist/index-DSgEWJGP.js +6 -0
- package/dist/index-DxxX09iY.js +6 -0
- package/dist/index-kOPLn4DD.js +5 -0
- package/dist/index-nnvfy5q0.js +31 -0
- package/dist/index-urNonkMH.js +6 -0
- package/dist/index.js +16 -0
- package/dist/inline-TT_dl8Y3.js +17 -0
- package/dist/knowledge-BZCmalF_.js +6 -0
- package/dist/knowledge-DnYGicjn.js +13 -0
- package/dist/media-extensions-ZoxmhIhH.js +276 -0
- package/dist/media-migration-Cj-3xrxd.js +59 -0
- package/dist/media-upload-D7DpMJYx.js +69 -0
- package/dist/operations-JgnjGx3H.js +19 -0
- package/dist/question-D1--acV8.js +10 -0
- package/dist/question-DGC6JHy5.js +6 -0
- package/dist/rich-text/index.js +224 -0
- package/dist/rich-text/legacy-converter/index.js +930 -0
- package/dist/rules-CC6NoltX.js +811 -0
- package/dist/selection-state-D47jhx0U.js +20 -0
- package/dist/state-KfOqha3d.js +16 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +253 -0
- package/dist/types/rich-text/MediaView.vue.d.ts +92 -0
- package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +35 -0
- package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +12 -0
- package/dist/types/rich-text/config/catalog.d.ts +3 -0
- package/dist/types/rich-text/config/descriptor.d.ts +58 -0
- package/dist/types/rich-text/config/media-options.d.ts +6 -0
- package/dist/types/rich-text/config/resolve.d.ts +17 -0
- package/dist/types/rich-text/config/selection-options.d.ts +6 -0
- package/dist/types/rich-text/extensions.d.ts +6 -0
- package/dist/types/rich-text/index.d.ts +17 -0
- package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +32 -0
- package/dist/types/rich-text/legacy-converter/index.d.ts +46 -0
- package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +5 -0
- package/dist/types/rich-text/media-extensions.d.ts +4 -0
- package/dist/types/rich-text/media-id.d.ts +2 -0
- package/dist/types/rich-text/model/agent-context.d.ts +7 -0
- package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
- package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
- package/dist/types/rich-text/model/convert.d.ts +6 -0
- package/dist/types/rich-text/model/guard.d.ts +7 -0
- package/dist/types/rich-text/model/json-value.d.ts +2 -0
- package/dist/types/rich-text/model/media-migration.d.ts +8 -0
- package/dist/types/rich-text/model/node-contract.d.ts +10 -0
- package/dist/types/rich-text/model/node-identity.d.ts +8 -0
- package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
- package/dist/types/rich-text/model/preview.d.ts +2 -0
- package/dist/types/rich-text/model/question-text.d.ts +15 -0
- package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
- package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
- package/dist/types/rich-text/model/validate.d.ts +19 -0
- package/dist/types/rich-text/model/web-url.d.ts +2 -0
- package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/block.d.ts +3 -0
- package/dist/types/rich-text/plugins/choice.d.ts +4 -0
- package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/inline.d.ts +3 -0
- package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
- package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/operations.d.ts +86 -0
- package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/registry.d.ts +14 -0
- package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
- package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/state.d.ts +3 -0
- package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
- package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
- package/dist/types/rich-text/plugins/tool/rules.d.ts +34 -0
- package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +598 -0
- package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
- package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
- package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
- package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
- package/dist/types/rich-text/runtime/media-target.d.ts +9 -0
- package/dist/types/rich-text/runtime/media-upload-session.d.ts +63 -0
- package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
- package/dist/types/rich-text/runtime/operations.d.ts +48 -0
- package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
- package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
- package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
- package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
- package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
- package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
- package/dist/types/rich-text/types.d.ts +40 -0
- package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +124 -0
- package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
- package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
- package/package.json +70 -3
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
const ot = [
|
|
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
|
+
], st = [
|
|
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
|
+
], at = [
|
|
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
|
+
], lt = [
|
|
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
|
+
], ct = [
|
|
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
|
+
], pt = [
|
|
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
|
+
], dt = [
|
|
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
|
+
], ut = [
|
|
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 Kt = {
|
|
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
|
+
}, gt = [
|
|
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
|
+
], ft = [
|
|
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
|
+
], yt = [
|
|
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
|
+
], mt = [
|
|
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
|
+
], bt = [
|
|
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
|
+
], Z = [
|
|
267
|
+
...ot,
|
|
268
|
+
...st,
|
|
269
|
+
...at,
|
|
270
|
+
...lt,
|
|
271
|
+
...ct,
|
|
272
|
+
...pt,
|
|
273
|
+
...dt,
|
|
274
|
+
...ut,
|
|
275
|
+
...gt,
|
|
276
|
+
...ft,
|
|
277
|
+
...yt,
|
|
278
|
+
...mt,
|
|
279
|
+
...kt,
|
|
280
|
+
...bt
|
|
281
|
+
];
|
|
282
|
+
function tt(r, n = "") {
|
|
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 c = Object.getPrototypeOf(o);
|
|
292
|
+
if (c !== Object.prototype && c !== null) return t;
|
|
293
|
+
}
|
|
294
|
+
const u = Reflect.ownKeys(o);
|
|
295
|
+
if (u.some((c) => typeof c == "symbol")) return t;
|
|
296
|
+
if (Array.isArray(o)) {
|
|
297
|
+
if (u.length !== o.length + 1) return t;
|
|
298
|
+
for (let c = 0; c < o.length; c++)
|
|
299
|
+
if (!Object.prototype.hasOwnProperty.call(o, c))
|
|
300
|
+
return `${t}[${c}]`;
|
|
301
|
+
}
|
|
302
|
+
e.add(o);
|
|
303
|
+
for (const c of u) {
|
|
304
|
+
if (Array.isArray(o) && c === "length") continue;
|
|
305
|
+
const a = Object.getOwnPropertyDescriptor(o, c), l = Array.isArray(o) ? `${t}[${String(c)}]` : t ? `${t}.${String(c)}` : String(c);
|
|
306
|
+
if (!a || !("value" in a) || !Array.isArray(o) && !a.enumerable)
|
|
307
|
+
return l;
|
|
308
|
+
const d = s(a.value, l, i + 1);
|
|
309
|
+
if (d !== null) return d;
|
|
310
|
+
}
|
|
311
|
+
return e.delete(o), null;
|
|
312
|
+
};
|
|
313
|
+
try {
|
|
314
|
+
return s(r, n, 0);
|
|
315
|
+
} catch {
|
|
316
|
+
return n;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function $(r) {
|
|
320
|
+
if (typeof r != "string" || !/^https?:\/\/[^\s]+$/i.test(r))
|
|
321
|
+
return !1;
|
|
322
|
+
try {
|
|
323
|
+
const n = new URL(r);
|
|
324
|
+
return (n.protocol === "http:" || n.protocol === "https:") && !!n.hostname && !n.username && !n.password;
|
|
325
|
+
} catch {
|
|
326
|
+
return !1;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const wt = [
|
|
330
|
+
"todo",
|
|
331
|
+
"ticket",
|
|
332
|
+
"variable",
|
|
333
|
+
"attribute",
|
|
334
|
+
"tool",
|
|
335
|
+
"separator"
|
|
336
|
+
], St = ["todo", "ticket", "attribute"], At = ["image", "video"], $t = new Set(wt), It = new Set(St), ht = new Set(At), et = (r) => typeof r == "string" && $t.has(r), Nt = (r) => typeof r == "string" && It.has(r), rt = (r) => typeof r == "string" && ht.has(r), Tt = /* @__PURE__ */ new Set([
|
|
337
|
+
"businessToken",
|
|
338
|
+
"originalReply",
|
|
339
|
+
"messageSeparator",
|
|
340
|
+
"mediaBlock"
|
|
341
|
+
]), I = (r) => Tt.has(r);
|
|
342
|
+
function _t(r, n) {
|
|
343
|
+
return r === "businessToken" ? et(n == null ? void 0 : n.kind) ? n.kind : null : r === "mediaBlock" ? rt(n == null ? void 0 : n.kind) ? n.kind : null : r === "originalReply" ? "originalReply" : r === "messageSeparator" ? "separator" : null;
|
|
344
|
+
}
|
|
345
|
+
function Vt(r) {
|
|
346
|
+
var n;
|
|
347
|
+
return !!((n = r.content) != null && n.some(
|
|
348
|
+
(e) => typeof e.type == "string" && I(e.type) || Vt(e)
|
|
349
|
+
));
|
|
350
|
+
}
|
|
351
|
+
const Lt = "fkpTrustedNodeIds";
|
|
352
|
+
function Mt(r) {
|
|
353
|
+
const n = [], e = (s) => {
|
|
354
|
+
var o, t;
|
|
355
|
+
s.type && I(s.type) && typeof ((o = s.attrs) == null ? void 0 : o.id) == "string" && s.attrs.id && n.push(s.attrs.id), (t = s.content) == null || t.forEach(e);
|
|
356
|
+
};
|
|
357
|
+
return Array.isArray(r) ? r.forEach(e) : e(r), n;
|
|
358
|
+
}
|
|
359
|
+
function Ct(r, n) {
|
|
360
|
+
for (let t = 0; t < 8; t++) {
|
|
361
|
+
const i = n();
|
|
362
|
+
if (i && !r.has(i)) return i;
|
|
363
|
+
}
|
|
364
|
+
const e = n() || "node";
|
|
365
|
+
let s = e, o = 1;
|
|
366
|
+
for (; r.has(s); ) s = `${e}-${o++}`;
|
|
367
|
+
return s;
|
|
368
|
+
}
|
|
369
|
+
const Q = {
|
|
370
|
+
todo: "待办",
|
|
371
|
+
tagged: "顾客标签"
|
|
372
|
+
};
|
|
373
|
+
function Pt(r) {
|
|
374
|
+
return r.includes("[") || r.includes("]") || /[【】\r\n]/u.test(r);
|
|
375
|
+
}
|
|
376
|
+
function nt(r) {
|
|
377
|
+
return /[{}\r\n]/u.test(r);
|
|
378
|
+
}
|
|
379
|
+
function qt(r, n) {
|
|
380
|
+
var i;
|
|
381
|
+
const e = (i = r.extensionState[n]) == 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 xt(r) {
|
|
389
|
+
return ["todo", "tagged"].flatMap((n) => {
|
|
390
|
+
var t;
|
|
391
|
+
if (n === "todo" && r.type !== "normal") return [];
|
|
392
|
+
const e = (t = r.extensionState[n]) == null ? void 0 : t.data, s = e && typeof e == "object" && !Array.isArray(e) ? e.enabled === !0 : !1, o = s ? qt(r, n) : null;
|
|
393
|
+
if (s && !o)
|
|
394
|
+
throw new Error(`${Q[n]}已开启但未选择方案`);
|
|
395
|
+
if (o && nt(o.label))
|
|
396
|
+
throw new Error("方案名称包含协议保留字符");
|
|
397
|
+
return o ? [`{${Q[n]}@${o.label}}`] : [];
|
|
398
|
+
}).join("");
|
|
399
|
+
}
|
|
400
|
+
function Ft(r) {
|
|
401
|
+
var n;
|
|
402
|
+
if (typeof ((n = r.question) == null ? void 0 : n.text) != "string" || Pt(r.question.text))
|
|
403
|
+
throw new Error("意图文字中不可填写方括号或换行,请修改");
|
|
404
|
+
return `[${r.question.text}]${xt(r)}`;
|
|
405
|
+
}
|
|
406
|
+
const it = /* @__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
|
+
]), Ut = (r) => it.has(r), Ot = /* @__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
|
+
}, vt = {
|
|
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(r) {
|
|
474
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
475
|
+
const n = r;
|
|
476
|
+
if (typeof n.type != "string" || !Ot.has(n.type) || Object.keys(n).some((o) => !["type", "attrs"].includes(o)) || n.attrs !== void 0 && (!n.attrs || typeof n.attrs != "object" || Array.isArray(n.attrs)))
|
|
477
|
+
return !1;
|
|
478
|
+
const e = n.attrs || {};
|
|
479
|
+
if (n.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 k(r, n, e = "") {
|
|
488
|
+
const s = Object.keys(r).find(
|
|
489
|
+
(o) => !n.includes(o)
|
|
490
|
+
);
|
|
491
|
+
return s ? e ? `${e}.${s}` : s : null;
|
|
492
|
+
}
|
|
493
|
+
function Y(r, n = "knowledge.doc") {
|
|
494
|
+
if (r === null) return null;
|
|
495
|
+
const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new WeakSet();
|
|
496
|
+
function o(t, i, u, c = !1) {
|
|
497
|
+
var l, d, f, g, m, y, b, h, T, V, P, q, x, O, v, j, R, D, B, K, N, _, L, M, C, F, U, E, z, H;
|
|
498
|
+
if (!t || typeof t != "object" || !t.type || !it.has(t.type) || s.has(t) || (s.add(t), u ? !((l = J[u]) != null && l.has(t.type)) : t.type !== "doc") || c && t.type === "businessToken" && ((d = t.attrs) == null ? void 0 : d.kind) === "attribute")
|
|
499
|
+
return i;
|
|
500
|
+
for (const p of Object.keys(t))
|
|
501
|
+
if (!["type", "attrs", "content", "marks", "text"].includes(p))
|
|
502
|
+
return `${i}.${p}`;
|
|
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
|
+
) && !((f = t.content) != null && f.length))
|
|
508
|
+
return `${i}.content`;
|
|
509
|
+
if (t.type === "listItem" && ((m = (g = t.content) == null ? void 0 : g[0]) == null ? void 0 : m.type) !== "paragraph")
|
|
510
|
+
return (y = t.content) != null && y.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 = vt[t.type] || /* @__PURE__ */ new Set();
|
|
521
|
+
for (const p of Object.keys(t.attrs || {}))
|
|
522
|
+
if (!a.has(p)) return `${i}.attrs.${p}`;
|
|
523
|
+
if (t.type === "businessToken" && !et((h = t.attrs) == null ? void 0 : h.kind))
|
|
524
|
+
return `${i}.attrs.kind`;
|
|
525
|
+
if (t.type === "businessToken" && (typeof ((T = t.attrs) == null ? void 0 : T.key) != "string" || !t.attrs.key))
|
|
526
|
+
return `${i}.attrs.key`;
|
|
527
|
+
if (t.type === "businessToken" && ((V = t.attrs) == null ? void 0 : V.label) !== void 0 && typeof t.attrs.label != "string")
|
|
528
|
+
return `${i}.attrs.label`;
|
|
529
|
+
if (t.type === "businessToken" && ((P = t.attrs) == null ? void 0 : P.token) !== void 0 && t.attrs.token !== null && typeof t.attrs.token != "string")
|
|
530
|
+
return `${i}.attrs.token`;
|
|
531
|
+
if (t.type === "businessToken" && ((q = t.attrs) == null ? void 0 : q.params) != null && (t.attrs.kind !== "tool" || typeof t.attrs.params != "object" || Array.isArray(t.attrs.params) || tt(t.attrs.params) !== null || JSON.stringify(t.attrs.params).length > 8192))
|
|
532
|
+
return `${i}.attrs.params`;
|
|
533
|
+
if (t.type === "mediaBlock" && !rt((x = t.attrs) == null ? void 0 : x.kind))
|
|
534
|
+
return `${i}.attrs.kind`;
|
|
535
|
+
if (t.type === "mediaBlock") {
|
|
536
|
+
if (((O = t.attrs) == null ? void 0 : O.assetId) !== void 0 && t.attrs.assetId !== null && typeof t.attrs.assetId != "string")
|
|
537
|
+
return `${i}.attrs.assetId`;
|
|
538
|
+
if (((v = t.attrs) == null ? void 0 : v.name) !== void 0 && typeof t.attrs.name != "string")
|
|
539
|
+
return `${i}.attrs.name`;
|
|
540
|
+
if (((j = t.attrs) == null ? void 0 : j.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 p = (((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) && !p)
|
|
546
|
+
return `${i}.attrs.src`;
|
|
547
|
+
if (((_ = t.attrs) == null ? void 0 : _.poster) !== void 0 && t.attrs.poster !== null && !$(t.attrs.poster))
|
|
548
|
+
return `${i}.attrs.poster`;
|
|
549
|
+
}
|
|
550
|
+
if (I(t.type)) {
|
|
551
|
+
const p = (L = t.attrs) == null ? void 0 : L.id;
|
|
552
|
+
if ((t.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || e.has(p)))
|
|
553
|
+
return `${i}.attrs.id`;
|
|
554
|
+
if (typeof p == "string" && e.add(p), ((M = t.attrs) == null ? void 0 : M.nodeVersion) !== void 0 && (!Number.isSafeInteger(t.attrs.nodeVersion) || t.attrs.nodeVersion < 0))
|
|
555
|
+
return `${i}.attrs.nodeVersion`;
|
|
556
|
+
}
|
|
557
|
+
if (t.type === "orderedList" && ((C = t.attrs) == null ? void 0 : C.start) !== void 0 && (!Number.isSafeInteger(t.attrs.start) || t.attrs.start < 1))
|
|
558
|
+
return `${i}.attrs.start`;
|
|
559
|
+
if (t.type === "orderedList" && ((F = t.attrs) == null ? void 0 : F.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" && ((U = t.attrs) == null ? void 0 : U.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" && ((E = t.marks) != null && E.length)) return `${i}.marks`;
|
|
566
|
+
if ((z = t.marks) != null && z.some((p) => !jt(p)))
|
|
567
|
+
return `${i}.marks`;
|
|
568
|
+
if ((H = t.marks) != null && H.length) {
|
|
569
|
+
const p = t.marks.map((S) => S.type);
|
|
570
|
+
if (new Set(p).size !== p.length || p.includes("code") && p.length > 1)
|
|
571
|
+
return `${i}.marks`;
|
|
572
|
+
}
|
|
573
|
+
for (const [p, S] of (t.content || []).entries()) {
|
|
574
|
+
const W = o(
|
|
575
|
+
S,
|
|
576
|
+
`${i}.content[${p}]`,
|
|
577
|
+
t.type,
|
|
578
|
+
c || t.type === "originalReply"
|
|
579
|
+
);
|
|
580
|
+
if (W) return W;
|
|
581
|
+
}
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
return o(r, n);
|
|
585
|
+
}
|
|
586
|
+
function G(r, n, e = "knowledge.doc") {
|
|
587
|
+
if (!r) return null;
|
|
588
|
+
const s = /* @__PURE__ */ new WeakSet(), o = (t, i) => {
|
|
589
|
+
var a, l;
|
|
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((l = t.attrs) == null ? void 0 : l.kind) : t.type === "originalReply" ? "originalReply" : t.type === "messageSeparator" ? "separator" : null, c = t.type === "businessToken" ? "knowledgeInline" : u ? "knowledgeBlock" : null;
|
|
593
|
+
if (t.type === "messageSeparator" && n === "agent" || u && t.type !== "messageSeparator" && !Z.some(
|
|
594
|
+
(d) => d.id === u && d.slot === c && d.types.includes(n)
|
|
595
|
+
))
|
|
596
|
+
return i;
|
|
597
|
+
for (const [d, f] of (t.content || []).entries()) {
|
|
598
|
+
const g = o(f, `${i}.content[${d}]`);
|
|
599
|
+
if (g) return g;
|
|
600
|
+
}
|
|
601
|
+
return null;
|
|
602
|
+
};
|
|
603
|
+
return o(r, e);
|
|
604
|
+
}
|
|
605
|
+
function Et(r) {
|
|
606
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
607
|
+
const n = r, e = n.question, s = n.knowledge;
|
|
608
|
+
return ["normal", "reasoning", "agent"].includes(String(n.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") && !!n.extensionState && typeof n.extensionState == "object" && !Array.isArray(n.extensionState);
|
|
609
|
+
}
|
|
610
|
+
function zt(r) {
|
|
611
|
+
if (!r || typeof r != "object" || Array.isArray(r))
|
|
612
|
+
return "modelValue";
|
|
613
|
+
const n = tt(r);
|
|
614
|
+
if (n !== null) return n || "modelValue";
|
|
615
|
+
const e = r;
|
|
616
|
+
if (e.schemaVersion !== 1) return "schemaVersion";
|
|
617
|
+
const s = k(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 = k(
|
|
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 = k(
|
|
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 l = k(
|
|
656
|
+
a,
|
|
657
|
+
["id", "name"],
|
|
658
|
+
"knowledge.agentRef"
|
|
659
|
+
);
|
|
660
|
+
if (l) return l;
|
|
661
|
+
}
|
|
662
|
+
const i = Y(e.knowledge.doc);
|
|
663
|
+
if (i) return i;
|
|
664
|
+
const u = G(
|
|
665
|
+
e.knowledge.doc,
|
|
666
|
+
e.type
|
|
667
|
+
);
|
|
668
|
+
if (u) return u;
|
|
669
|
+
const c = Y(
|
|
670
|
+
e.knowledge.retainedDoc ?? null,
|
|
671
|
+
"knowledge.retainedDoc"
|
|
672
|
+
);
|
|
673
|
+
if (c) return c;
|
|
674
|
+
if (e.type === "agent") {
|
|
675
|
+
const a = G(
|
|
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, l] of Object.entries(e.extensionState)) {
|
|
685
|
+
const d = Z.find(
|
|
686
|
+
(g) => g.id === a && g.types.includes(e.type) && g.implementation === "plugin"
|
|
687
|
+
);
|
|
688
|
+
if (!d) return `extensionState.${a}`;
|
|
689
|
+
if (!l || typeof l != "object" || l.version !== d.dataVersion)
|
|
690
|
+
return `extensionState.${a}.version`;
|
|
691
|
+
const f = k(
|
|
692
|
+
l,
|
|
693
|
+
["version", "data"],
|
|
694
|
+
`extensionState.${a}`
|
|
695
|
+
);
|
|
696
|
+
if (f) return f;
|
|
697
|
+
if (!l.data || typeof l.data != "object" || Array.isArray(l.data))
|
|
698
|
+
return `extensionState.${a}.data`;
|
|
699
|
+
if (d.slot === "questionAction" && typeof l.data.enabled != "boolean")
|
|
700
|
+
return `extensionState.${a}.data.enabled`;
|
|
701
|
+
if (d.slot === "questionAction" && (a === "todo" || a === "tagged")) {
|
|
702
|
+
const g = l.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: m } = g;
|
|
707
|
+
if (!m || typeof m != "object" || Array.isArray(m))
|
|
708
|
+
return `extensionState.${a}.data.tag`;
|
|
709
|
+
const y = m;
|
|
710
|
+
if (typeof y.id != "string" || !y.id.trim())
|
|
711
|
+
return `extensionState.${a}.data.tag.id`;
|
|
712
|
+
if (typeof y.label != "string" || !y.label.trim() || nt(y.label))
|
|
713
|
+
return `extensionState.${a}.data.tag.label`;
|
|
714
|
+
const b = k(
|
|
715
|
+
y,
|
|
716
|
+
["id", "label"],
|
|
717
|
+
`extensionState.${a}.data.tag`
|
|
718
|
+
);
|
|
719
|
+
if (b) return b;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
const Rt = (r) => typeof r == "string" && /^(?:[1-9]|[1-9]\d)$/.test(r), Dt = {
|
|
726
|
+
none: "不标记",
|
|
727
|
+
red: "红色",
|
|
728
|
+
yellow: "黄色",
|
|
729
|
+
green: "绿色",
|
|
730
|
+
blue: "蓝色",
|
|
731
|
+
purple: "紫色"
|
|
732
|
+
}, Ht = {
|
|
733
|
+
none: "",
|
|
734
|
+
red: "#f53f3f",
|
|
735
|
+
yellow: "#ff7d00",
|
|
736
|
+
green: "#00b42a",
|
|
737
|
+
blue: "#165dff",
|
|
738
|
+
purple: "#722ed1"
|
|
739
|
+
};
|
|
740
|
+
function Bt(r) {
|
|
741
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
742
|
+
const n = r;
|
|
743
|
+
return typeof n.id == "string" && /^rmk_[a-z0-9]{8}$/.test(n.id) && (n.contentMode === "fixed" || n.contentMode === "smart") && typeof n.content == "string" && !!n.content.trim() && [...n.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(n.content) && !n.content.endsWith("^") && Object.hasOwn(Dt, String(n.flag)) && typeof n.preserveFlag == "boolean" && (n.position === "first" || n.position === "last");
|
|
744
|
+
}
|
|
745
|
+
function X() {
|
|
746
|
+
return `rmk_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
|
|
747
|
+
}
|
|
748
|
+
function Wt(r, n, e, s, o) {
|
|
749
|
+
if (r !== "small_payment" && r !== "order_note")
|
|
750
|
+
return { ok: !0, params: n };
|
|
751
|
+
let t = 0;
|
|
752
|
+
const i = /* @__PURE__ */ new Set(), u = (l) => {
|
|
753
|
+
var d, f, g;
|
|
754
|
+
l.type === "businessToken" && ((d = l.attrs) == null ? void 0 : d.kind) === "tool" && (!o || l.attrs.id !== o) && (l.attrs.key === "small_payment" && t++, l.attrs.key === "order_note" && i.add(String(((f = l.attrs.params) == null ? void 0 : f.id) || ""))), (g = l.content) == null || g.forEach(u);
|
|
755
|
+
};
|
|
756
|
+
if (s && u(s), r === "small_payment")
|
|
757
|
+
return Rt(n.amount) ? t ? {
|
|
758
|
+
ok: !1,
|
|
759
|
+
code: "TOOL_LIMIT_REACHED",
|
|
760
|
+
message: "最多配置一个小额打款工具"
|
|
761
|
+
} : { ok: !0, params: n } : {
|
|
762
|
+
ok: !1,
|
|
763
|
+
code: "TOOL_PARAMS_INVALID",
|
|
764
|
+
message: "打款金额必须是1-99的整数元"
|
|
765
|
+
};
|
|
766
|
+
let c = typeof e.id == "string" && /^rmk_[a-z0-9]{8}$/.test(e.id) ? e.id : X();
|
|
767
|
+
if (!o)
|
|
768
|
+
for (; i.has(c); ) c = X();
|
|
769
|
+
if (i.has(c))
|
|
770
|
+
return {
|
|
771
|
+
ok: !1,
|
|
772
|
+
code: "TOOL_PARAMS_INVALID",
|
|
773
|
+
message: "订单备注编号重复"
|
|
774
|
+
};
|
|
775
|
+
const a = { ...n, id: c };
|
|
776
|
+
return Bt(a) ? { ok: !0, params: { ...a } } : {
|
|
777
|
+
ok: !1,
|
|
778
|
+
code: "TOOL_PARAMS_INVALID",
|
|
779
|
+
message: "订单备注内容或配置不合法"
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
export {
|
|
783
|
+
wt as B,
|
|
784
|
+
St as C,
|
|
785
|
+
At as M,
|
|
786
|
+
xt as a,
|
|
787
|
+
zt as b,
|
|
788
|
+
Z as c,
|
|
789
|
+
Et as d,
|
|
790
|
+
I as e,
|
|
791
|
+
tt as f,
|
|
792
|
+
Y as g,
|
|
793
|
+
Pt as h,
|
|
794
|
+
Ut as i,
|
|
795
|
+
$ as j,
|
|
796
|
+
nt as k,
|
|
797
|
+
_t as l,
|
|
798
|
+
Vt as m,
|
|
799
|
+
qt as n,
|
|
800
|
+
Kt as o,
|
|
801
|
+
Wt as p,
|
|
802
|
+
Rt as q,
|
|
803
|
+
Bt as r,
|
|
804
|
+
Ft as s,
|
|
805
|
+
Dt as t,
|
|
806
|
+
Lt as u,
|
|
807
|
+
Ct as v,
|
|
808
|
+
Nt as w,
|
|
809
|
+
Mt as x,
|
|
810
|
+
Ht as y
|
|
811
|
+
};
|