@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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js +4416 -0
  4. package/dist/KnowledgeArea-BkRVWFrg.js +1224 -0
  5. package/dist/ToolForm-BSJxTJ7U.js +185 -0
  6. package/dist/choice-DDg5gNtS.js +29 -0
  7. package/dist/index-BVHYCLDv.js +5 -0
  8. package/dist/index-BnFTr8u9.js +49 -0
  9. package/dist/index-CG2j9Znw.js +41 -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-DSgEWJGP.js +6 -0
  14. package/dist/index-DxxX09iY.js +6 -0
  15. package/dist/index-kOPLn4DD.js +5 -0
  16. package/dist/index-nnvfy5q0.js +31 -0
  17. package/dist/index-urNonkMH.js +6 -0
  18. package/dist/index.js +16 -0
  19. package/dist/inline-TT_dl8Y3.js +17 -0
  20. package/dist/knowledge-BZCmalF_.js +6 -0
  21. package/dist/knowledge-DnYGicjn.js +13 -0
  22. package/dist/media-extensions-ZoxmhIhH.js +276 -0
  23. package/dist/media-migration-Cj-3xrxd.js +59 -0
  24. package/dist/media-upload-D7DpMJYx.js +69 -0
  25. package/dist/operations-JgnjGx3H.js +19 -0
  26. package/dist/question-D1--acV8.js +10 -0
  27. package/dist/question-DGC6JHy5.js +6 -0
  28. package/dist/rich-text/index.js +224 -0
  29. package/dist/rich-text/legacy-converter/index.js +930 -0
  30. package/dist/rules-CC6NoltX.js +811 -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 +253 -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/__demo__/reasoning-template-examples.d.ts +12 -0
  39. package/dist/types/rich-text/config/catalog.d.ts +3 -0
  40. package/dist/types/rich-text/config/descriptor.d.ts +58 -0
  41. package/dist/types/rich-text/config/media-options.d.ts +6 -0
  42. package/dist/types/rich-text/config/resolve.d.ts +17 -0
  43. package/dist/types/rich-text/config/selection-options.d.ts +6 -0
  44. package/dist/types/rich-text/extensions.d.ts +6 -0
  45. package/dist/types/rich-text/index.d.ts +17 -0
  46. package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +32 -0
  47. package/dist/types/rich-text/legacy-converter/index.d.ts +46 -0
  48. package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +5 -0
  49. package/dist/types/rich-text/media-extensions.d.ts +4 -0
  50. package/dist/types/rich-text/media-id.d.ts +2 -0
  51. package/dist/types/rich-text/model/agent-context.d.ts +7 -0
  52. package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
  53. package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
  54. package/dist/types/rich-text/model/convert.d.ts +6 -0
  55. package/dist/types/rich-text/model/guard.d.ts +7 -0
  56. package/dist/types/rich-text/model/json-value.d.ts +2 -0
  57. package/dist/types/rich-text/model/media-migration.d.ts +8 -0
  58. package/dist/types/rich-text/model/node-contract.d.ts +10 -0
  59. package/dist/types/rich-text/model/node-identity.d.ts +8 -0
  60. package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
  61. package/dist/types/rich-text/model/preview.d.ts +2 -0
  62. package/dist/types/rich-text/model/question-text.d.ts +15 -0
  63. package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
  64. package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
  65. package/dist/types/rich-text/model/validate.d.ts +19 -0
  66. package/dist/types/rich-text/model/web-url.d.ts +2 -0
  67. package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
  68. package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
  69. package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
  70. package/dist/types/rich-text/plugins/block.d.ts +3 -0
  71. package/dist/types/rich-text/plugins/choice.d.ts +4 -0
  72. package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
  73. package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
  74. package/dist/types/rich-text/plugins/inline.d.ts +3 -0
  75. package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
  76. package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
  77. package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
  78. package/dist/types/rich-text/plugins/operations.d.ts +86 -0
  79. package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
  80. package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
  81. package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
  82. package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
  83. package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
  84. package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
  85. package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
  86. package/dist/types/rich-text/plugins/registry.d.ts +14 -0
  87. package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
  88. package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
  89. package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
  90. package/dist/types/rich-text/plugins/state.d.ts +3 -0
  91. package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
  92. package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
  93. package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
  94. package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
  95. package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
  96. package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
  97. package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
  98. package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
  99. package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
  100. package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
  101. package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
  102. package/dist/types/rich-text/plugins/tool/rules.d.ts +34 -0
  103. package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
  104. package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
  105. package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
  106. package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
  107. package/dist/types/rich-text/public/types.d.ts +598 -0
  108. package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
  109. package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
  110. package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
  111. package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
  112. package/dist/types/rich-text/runtime/media-target.d.ts +9 -0
  113. package/dist/types/rich-text/runtime/media-upload-session.d.ts +63 -0
  114. package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
  115. package/dist/types/rich-text/runtime/operations.d.ts +48 -0
  116. package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
  117. package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
  118. package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
  119. package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
  120. package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
  121. package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
  122. package/dist/types/rich-text/types.d.ts +40 -0
  123. package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
  124. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +124 -0
  125. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
  126. package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
  127. package/package.json +70 -3
@@ -0,0 +1,276 @@
1
+ import { Node as S, mergeAttributes as A } from "@tiptap/core";
2
+ import { nodeViewProps as D, NodeViewWrapper as I, VueNodeViewRenderer as L } from "@tiptap/vue-3";
3
+ import { defineComponent as T, ref as w, watch as N, onMounted as H, onBeforeUnmount as P, openBlock as s, createBlock as l, unref as i, normalizeClass as U, withCtx as f, createElementVNode as k, createElementBlock as p, createVNode as u, createTextVNode as E, createCommentVNode as m, toDisplayString as V } from "vue";
4
+ import { Button as C, ImagePreview as q, Modal as F } from "@freecallai/ui";
5
+ import { closeHistory as O } from "@tiptap/pm/history";
6
+ import g from "@freecallai/icons";
7
+ import { IconDragDotVertical as R, IconDelete as W } from "@freecallai/ui/es/icon/index.js";
8
+ const j = {
9
+ key: 0,
10
+ class: "fk-media-failed"
11
+ }, G = ["draggable", "src", "alt"], J = ["draggable", "src", "poster", "controls"], K = { class: "fk-media-actions" }, Q = {
12
+ key: 0,
13
+ "data-drag-handle": "",
14
+ class: "fk-media-handle",
15
+ title: "拖动调整位置"
16
+ }, X = {
17
+ key: 4,
18
+ class: "fk-upload-state"
19
+ }, Y = { class: "fk-media-caption" }, Z = {
20
+ key: 1,
21
+ class: "fk-error"
22
+ }, h = ["src"], x = /* @__PURE__ */ T({
23
+ __name: "MediaView",
24
+ props: D,
25
+ setup(r) {
26
+ const a = r, o = a.extension.options.sceneStyle === !0, n = w(!1), v = w(!1), b = w(null), c = w(a.editor.isEditable);
27
+ function z(e) {
28
+ const { detail: t } = e;
29
+ (t == null ? void 0 : t.id) === a.node.attrs.id && a.node.attrs.status === "uploading" && typeof t.percent == "number" && Number.isFinite(t.percent) && (b.value = t.percent);
30
+ }
31
+ const y = () => {
32
+ c.value = a.editor.isEditable;
33
+ };
34
+ a.editor.on("update", y), a.editor.on("transaction", y);
35
+ function M() {
36
+ a.editor.isEditable && (a.editor.view.dispatch(O(a.editor.state.tr)), a.deleteNode());
37
+ }
38
+ function $() {
39
+ a.editor.view.dom.dispatchEvent(
40
+ new CustomEvent("fkp-media-retry", {
41
+ bubbles: !0,
42
+ detail: { id: a.node.attrs.id }
43
+ })
44
+ );
45
+ }
46
+ function B(e) {
47
+ !o || a.node.attrs.kind !== "video" || e.target instanceof Element && e.target.closest(".fk-media-actions") || (n.value = !0);
48
+ }
49
+ return N(
50
+ () => a.node.attrs.src,
51
+ () => {
52
+ v.value = !1;
53
+ }
54
+ ), N(
55
+ () => a.node.attrs.status,
56
+ (e) => {
57
+ e !== "uploading" && (b.value = null);
58
+ }
59
+ ), H(() => {
60
+ a.editor.view.dom.addEventListener("fkp-media-progress", z);
61
+ }), P(() => {
62
+ a.editor.view.dom.removeEventListener("fkp-media-progress", z), a.editor.off("update", y), a.editor.off("transaction", y);
63
+ }), (e, t) => (s(), l(i(I), {
64
+ class: U(["fk-media", {
65
+ "is-selected": e.selected,
66
+ "is-scene-media": o,
67
+ "is-video": e.node.attrs.kind === "video",
68
+ "is-error": e.node.attrs.status === "error"
69
+ }]),
70
+ "data-media-id": e.node.attrs.id,
71
+ "data-drag-handle": o && c.value ? "" : void 0,
72
+ contenteditable: "false"
73
+ }, {
74
+ default: f(() => [
75
+ k("div", {
76
+ class: "fk-media-surface",
77
+ onClick: B
78
+ }, [
79
+ v.value ? (s(), p("div", j, [
80
+ u(i(g), {
81
+ name: "fail",
82
+ size: 24
83
+ }),
84
+ t[7] || (t[7] = E("媒体无法加载"))
85
+ ])) : e.node.attrs.kind === "image" ? (s(), p("img", {
86
+ key: 1,
87
+ draggable: o ? !1 : void 0,
88
+ src: e.node.attrs.src,
89
+ alt: e.node.attrs.name,
90
+ onError: t[0] || (t[0] = (d) => v.value = !0),
91
+ onDblclick: t[1] || (t[1] = (d) => n.value = !0)
92
+ }, null, 40, G)) : (s(), p("video", {
93
+ key: 2,
94
+ draggable: o ? !1 : void 0,
95
+ src: e.node.attrs.src,
96
+ poster: e.node.attrs.poster || void 0,
97
+ controls: !o,
98
+ muted: o,
99
+ playsinline: "",
100
+ preload: "metadata",
101
+ onError: t[2] || (t[2] = (d) => v.value = !0)
102
+ }, null, 40, J)),
103
+ o && e.node.attrs.kind === "video" && !v.value ? (s(), l(i(C), {
104
+ key: 3,
105
+ class: "fk-media-play",
106
+ type: "text",
107
+ "aria-label": "播放视频",
108
+ style: { "pointer-events": "none" },
109
+ onClick: t[3] || (t[3] = (d) => n.value = !0)
110
+ }, {
111
+ default: f(() => [
112
+ u(i(g), {
113
+ name: "visible",
114
+ size: 14
115
+ }),
116
+ t[8] || (t[8] = E("点击播放视频"))
117
+ ]),
118
+ _: 1
119
+ })) : m("", !0),
120
+ k("div", K, [
121
+ c.value ? (s(), p("span", Q, [
122
+ u(i(R), { size: 15 })
123
+ ])) : m("", !0),
124
+ u(i(C), {
125
+ type: "text",
126
+ size: "mini",
127
+ title: "预览媒体",
128
+ "aria-label": "预览媒体",
129
+ onClick: t[4] || (t[4] = (d) => n.value = !0)
130
+ }, {
131
+ default: f(() => [
132
+ u(i(g), {
133
+ name: "open",
134
+ size: 15
135
+ })
136
+ ]),
137
+ _: 1
138
+ }),
139
+ c.value && e.node.attrs.status === "error" ? (s(), l(i(C), {
140
+ key: 1,
141
+ type: "text",
142
+ size: "mini",
143
+ title: "重试上传",
144
+ "aria-label": "重试上传",
145
+ onClick: $
146
+ }, {
147
+ default: f(() => t[9] || (t[9] = [
148
+ E("重试")
149
+ ])),
150
+ _: 1
151
+ })) : m("", !0),
152
+ c.value ? (s(), l(i(C), {
153
+ key: 2,
154
+ type: "text",
155
+ size: "mini",
156
+ title: "删除媒体",
157
+ "aria-label": "删除媒体",
158
+ onClick: M
159
+ }, {
160
+ default: f(() => [
161
+ u(i(W), { size: 15 })
162
+ ]),
163
+ _: 1
164
+ })) : m("", !0)
165
+ ]),
166
+ e.node.attrs.status === "uploading" ? (s(), p("div", X, [
167
+ u(i(g), {
168
+ name: "sync",
169
+ size: 17,
170
+ class: "fk-spin"
171
+ }),
172
+ E("正在上传" + V(b.value === null ? "…" : ` ${b.value}%`), 1)
173
+ ])) : m("", !0)
174
+ ]),
175
+ k("div", Y, [
176
+ e.node.attrs.kind === "video" ? (s(), l(i(g), {
177
+ key: 0,
178
+ name: "video2",
179
+ size: 12
180
+ })) : m("", !0),
181
+ k("span", null, V(e.node.attrs.name), 1),
182
+ e.node.attrs.status === "error" ? (s(), p("span", Z, V(e.node.attrs.error), 1)) : m("", !0)
183
+ ]),
184
+ e.node.attrs.kind === "image" ? (s(), l(i(q), {
185
+ key: 0,
186
+ visible: n.value,
187
+ "onUpdate:visible": t[5] || (t[5] = (d) => n.value = d),
188
+ src: e.node.attrs.src,
189
+ "mask-closable": !0
190
+ }, null, 8, ["visible", "src"])) : (s(), l(i(F), {
191
+ key: 1,
192
+ visible: n.value,
193
+ "onUpdate:visible": t[6] || (t[6] = (d) => n.value = d),
194
+ title: e.node.attrs.name,
195
+ footer: !1,
196
+ width: "min(960px, 90vw)",
197
+ "unmount-on-close": ""
198
+ }, {
199
+ default: f(() => [
200
+ k("video", {
201
+ class: "fk-video-preview",
202
+ src: e.node.attrs.src,
203
+ controls: "",
204
+ autoplay: ""
205
+ }, null, 8, h)
206
+ ]),
207
+ _: 1
208
+ }, 8, ["visible", "title"]))
209
+ ]),
210
+ _: 1
211
+ }, 8, ["class", "data-media-id", "data-drag-handle"]));
212
+ }
213
+ }), oe = S.create({
214
+ name: "mediaBlock",
215
+ group: "block",
216
+ atom: !0,
217
+ draggable: !0,
218
+ selectable: !0,
219
+ addOptions() {
220
+ return { sceneStyle: !1 };
221
+ },
222
+ addAttributes() {
223
+ return {
224
+ id: { default: "" },
225
+ nodeVersion: { default: 0 },
226
+ assetId: { default: null },
227
+ src: { default: "" },
228
+ kind: { default: "image" },
229
+ name: { default: "" },
230
+ poster: { default: null },
231
+ status: { default: "ready" },
232
+ error: { default: "" }
233
+ };
234
+ },
235
+ parseHTML() {
236
+ return [
237
+ {
238
+ tag: "figure[data-media-block]",
239
+ getAttrs: (r) => {
240
+ var a, o;
241
+ return {
242
+ id: r.getAttribute("data-id"),
243
+ kind: r.getAttribute("data-kind"),
244
+ src: (a = r.querySelector("img,video")) == null ? void 0 : a.getAttribute("src"),
245
+ name: (o = r.querySelector("figcaption")) == null ? void 0 : o.textContent,
246
+ status: "ready"
247
+ };
248
+ }
249
+ }
250
+ ];
251
+ },
252
+ renderHTML({ node: r, HTMLAttributes: a }) {
253
+ return [
254
+ "figure",
255
+ A(a, {
256
+ "data-media-block": "",
257
+ "data-id": r.attrs.id,
258
+ "data-kind": r.attrs.kind
259
+ }),
260
+ r.attrs.kind === "video" ? [
261
+ "video",
262
+ { src: r.attrs.src, controls: "", poster: r.attrs.poster }
263
+ ] : ["img", { src: r.attrs.src, alt: r.attrs.name }],
264
+ ["figcaption", {}, r.attrs.name]
265
+ ];
266
+ },
267
+ renderText({ node: r }) {
268
+ return `[${r.attrs.kind === "video" ? "视频" : "图片"}:${r.attrs.name}]`;
269
+ },
270
+ addNodeView() {
271
+ return L(x);
272
+ }
273
+ });
274
+ export {
275
+ oe as MediaBlock
276
+ };
@@ -0,0 +1,59 @@
1
+ import { f as m, e as A } from "./rules-CC6NoltX.js";
2
+ function b(i) {
3
+ let s = 2166136261;
4
+ for (let a = 0; a < i.length; a++)
5
+ s = Math.imul(s ^ i.charCodeAt(a), 16777619);
6
+ return `legacy-${(s >>> 0).toString(16).padStart(8, "0")}`;
7
+ }
8
+ function N(i, s) {
9
+ if (typeof s != "string" || !s.trim())
10
+ throw new Error("旧知识迁移需要稳定的来源记录键");
11
+ if (!i || typeof i != "object" || Array.isArray(i) || m(i) !== null || i.type !== "doc")
12
+ throw new Error("旧知识包含非 JSON 内容");
13
+ const a = JSON.parse(JSON.stringify(i)), o = (t) => {
14
+ if (!t || typeof t != "object" || Array.isArray(t) || typeof t.type != "string" || !t.type)
15
+ throw new Error("旧知识节点格式不正确");
16
+ if (t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
17
+ throw new Error("旧知识节点属性格式不正确");
18
+ if (t.content !== void 0) {
19
+ if (!Array.isArray(t.content))
20
+ throw new Error("旧知识节点内容格式不正确");
21
+ t.content.forEach(o);
22
+ }
23
+ };
24
+ o(a);
25
+ const l = /* @__PURE__ */ new Set(), p = (t) => {
26
+ var e, n;
27
+ t.type && A(t.type) && typeof ((e = t.attrs) == null ? void 0 : e.id) == "string" && t.attrs.id.trim() && l.add(t.attrs.id), (n = t.content) == null || n.forEach(p);
28
+ };
29
+ p(a);
30
+ const y = /* @__PURE__ */ new Set();
31
+ let c = !1;
32
+ const g = (t, e) => {
33
+ var n, h, w, $, E;
34
+ if (t.type && A(t.type)) {
35
+ let r = typeof ((n = t.attrs) == null ? void 0 : n.id) == "string" ? t.attrs.id : "";
36
+ if (!r.trim() || y.has(r)) {
37
+ const f = b(
38
+ t.type === "mediaBlock" ? `${s}:${e}:${String(((h = t.attrs) == null ? void 0 : h.src) || "")}` : `${s}:${e}:${t.type}:${String(
39
+ ((w = t.attrs) == null ? void 0 : w.key) || ""
40
+ )}`
41
+ );
42
+ r = f;
43
+ let S = 1;
44
+ for (; l.has(r) || y.has(r); ) r = `${f}-${S++}`;
45
+ t.attrs = { ...t.attrs, id: r, nodeVersion: 0 }, c = !0;
46
+ } else (($ = t.attrs) == null ? void 0 : $.nodeVersion) === void 0 && (t.attrs = { ...t.attrs, nodeVersion: 0 }, c = !0);
47
+ y.add(r);
48
+ }
49
+ (E = t.content) == null || E.forEach(
50
+ (r, f) => g(r, `${e}.content[${f}]`)
51
+ );
52
+ };
53
+ return g(a, "knowledge.doc"), { doc: a, changed: c };
54
+ }
55
+ const I = N;
56
+ export {
57
+ N as a,
58
+ I as b
59
+ };
@@ -0,0 +1,69 @@
1
+ import { p as l, f as c } from "./FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js";
2
+ function u(o) {
3
+ return {
4
+ id: o,
5
+ slot: "knowledgeBlock",
6
+ apiVersion: 1,
7
+ dataVersion: 1,
8
+ actions: {
9
+ [`${o}.upload`]: {
10
+ async execute(d, s) {
11
+ const { upload: e } = d;
12
+ if (!e || !(e.file instanceof File) || typeof e.nodeId != "string" || !e.nodeId || !Number.isSafeInteger(e.expectedNodeVersion) || e.expectedNodeVersion < 0 || e.expectedNodeVersion >= Number.MAX_SAFE_INTEGER)
13
+ return {
14
+ ok: !1,
15
+ error: {
16
+ code: "INVALID_RESPONSE",
17
+ message: "媒体上传参数无效",
18
+ retryable: !1
19
+ }
20
+ };
21
+ const a = s.ports.uploadMedia;
22
+ if (!a)
23
+ return {
24
+ ok: !1,
25
+ error: {
26
+ code: "UNAVAILABLE",
27
+ message: "宿主未提供媒体上传接口",
28
+ retryable: !1
29
+ }
30
+ };
31
+ const n = await a({ file: e.file, kind: o }, s.request), r = l(
32
+ n,
33
+ (i) => c(o, i)
34
+ );
35
+ if (!r.ok) return r;
36
+ const t = r.data;
37
+ return {
38
+ ok: !0,
39
+ data: [
40
+ {
41
+ kind: "updateOwnNode",
42
+ capabilityId: o,
43
+ nodeId: e.nodeId,
44
+ expectedNodeVersion: e.expectedNodeVersion,
45
+ node: {
46
+ type: "mediaBlock",
47
+ attrs: {
48
+ id: e.nodeId,
49
+ nodeVersion: e.expectedNodeVersion + 1,
50
+ assetId: t.id || null,
51
+ src: t.url,
52
+ kind: o,
53
+ name: e.file.name,
54
+ poster: t.posterUrl || null,
55
+ status: "ready",
56
+ error: ""
57
+ }
58
+ }
59
+ }
60
+ ]
61
+ };
62
+ }
63
+ }
64
+ }
65
+ };
66
+ }
67
+ export {
68
+ u as c
69
+ };
@@ -0,0 +1,19 @@
1
+ function i(e, a, n) {
2
+ return {
3
+ id: e,
4
+ slot: a,
5
+ apiVersion: 1,
6
+ dataVersion: 1,
7
+ actions: {
8
+ [`${e}.${a}.apply`]: {
9
+ execute: async (t, c) => ({
10
+ ok: !0,
11
+ data: n.execute(e, t, c.scene)
12
+ })
13
+ }
14
+ }
15
+ };
16
+ }
17
+ export {
18
+ i as b
19
+ };
@@ -0,0 +1,10 @@
1
+ import { b as o } from "./operations-JgnjGx3H.js";
2
+ import { m as i } from "./state-KfOqha3d.js";
3
+ const e = o(
4
+ "originalReply",
5
+ "questionAction",
6
+ i
7
+ );
8
+ export {
9
+ e as default
10
+ };
@@ -0,0 +1,6 @@
1
+ import { b as t } from "./operations-JgnjGx3H.js";
2
+ import { s as o } from "./selection-state-D47jhx0U.js";
3
+ const a = t("todo", "questionAction", o);
4
+ export {
5
+ a as default
6
+ };
@@ -0,0 +1,224 @@
1
+ import { p as S, v as C, c as b, i as E } from "../FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js";
2
+ import { _ as B, _ as G, a as H, e as V, r as W } from "../FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js";
3
+ import { f as v, b as x } from "../rules-CC6NoltX.js";
4
+ import { s as Y, a as Z } from "../rules-CC6NoltX.js";
5
+ import { a as ne, b as te } from "../media-migration-Cj-3xrxd.js";
6
+ const O = (e) => !!e && typeof e == "object" && !Array.isArray(e);
7
+ function m(e) {
8
+ let n;
9
+ try {
10
+ const i = v(e);
11
+ if (i !== null) return { ok: !1, path: i || "condition" };
12
+ n = JSON.parse(JSON.stringify(e));
13
+ } catch {
14
+ return { ok: !1, path: "condition" };
15
+ }
16
+ if (!O(n)) return { ok: !1, path: "condition" };
17
+ if (n.schemaVersion !== 1) return { ok: !1, path: "schemaVersion" };
18
+ const t = Object.keys(n).find(
19
+ (i) => !["schemaVersion", "id", "scenes"].includes(i)
20
+ );
21
+ if (t) return { ok: !1, path: t };
22
+ if (n.id !== void 0 && (typeof n.id != "string" || !n.id.trim()))
23
+ return { ok: !1, path: "id" };
24
+ if (!Array.isArray(n.scenes)) return { ok: !1, path: "scenes" };
25
+ const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
26
+ for (const [i, s] of n.scenes.entries()) {
27
+ const c = `scenes[${i}]`;
28
+ if (!O(s)) return { ok: !1, path: c };
29
+ const p = Object.keys(s).find(
30
+ (h) => !["sceneKey", "scene"].includes(h)
31
+ );
32
+ if (p) return { ok: !1, path: `${c}.${p}` };
33
+ if (typeof s.sceneKey != "string" || !s.sceneKey.trim() || o.has(s.sceneKey))
34
+ return { ok: !1, path: `${c}.sceneKey` };
35
+ o.add(s.sceneKey);
36
+ const r = x(s.scene);
37
+ if (r) return { ok: !1, path: `${c}.scene.${r}` };
38
+ const u = s.scene;
39
+ if (u.id !== void 0) {
40
+ if (!u.id.trim() || a.has(u.id))
41
+ return { ok: !1, path: `${c}.scene.id` };
42
+ a.add(u.id);
43
+ }
44
+ }
45
+ return { ok: !0, data: n };
46
+ }
47
+ const y = (e) => !!e && typeof e == "object" && !Array.isArray(e), d = (e) => typeof e == "string" && !!e.trim();
48
+ function A(e, n) {
49
+ return Object.keys(e).every((t) => n.includes(t));
50
+ }
51
+ function N(e) {
52
+ var i;
53
+ let n;
54
+ try {
55
+ const s = v(e);
56
+ if (s !== null) return { ok: !1, path: s || "input" };
57
+ n = JSON.parse(JSON.stringify(e));
58
+ } catch {
59
+ return { ok: !1, path: "input" };
60
+ }
61
+ if (!y(n)) return { ok: !1, path: "input" };
62
+ const t = Object.keys(n).find(
63
+ (s) => !["condition", "expectedRevision", "idempotencyKey"].includes(s)
64
+ );
65
+ if (t) return { ok: !1, path: t };
66
+ const o = m(n.condition);
67
+ if (!o.ok) return { ok: !1, path: `condition.${o.path}` };
68
+ if (o.data.id === void 0 && n.expectedRevision !== null || o.data.id !== void 0 && !d(n.expectedRevision))
69
+ return { ok: !1, path: "expectedRevision" };
70
+ if (!d(n.idempotencyKey))
71
+ return { ok: !1, path: "idempotencyKey" };
72
+ const a = C(
73
+ o.data.scenes.map((s) => s.scene)
74
+ );
75
+ if (!a.ok) {
76
+ const s = (i = a.issues[0]) == null ? void 0 : i.sceneIndex;
77
+ return {
78
+ ok: !1,
79
+ path: s == null ? "condition.scenes" : `condition.scenes[${s}].scene`
80
+ };
81
+ }
82
+ return {
83
+ ok: !0,
84
+ data: {
85
+ condition: o.data,
86
+ expectedRevision: n.expectedRevision,
87
+ idempotencyKey: n.idempotencyKey
88
+ }
89
+ };
90
+ }
91
+ const J = (e) => {
92
+ if (!y(e) || !A(e, ["condition", "revision", "migrationIssues"]) || !d(e.revision) || !Array.isArray(e.migrationIssues) || !e.migrationIssues.every(
93
+ (t) => E(t) && t.source === "migration" && t.severity !== "error" && d(t.path)
94
+ ))
95
+ return !1;
96
+ const n = m(e.condition);
97
+ return n.ok && d(n.data.id) && n.data.scenes.length > 0 && n.data.scenes.every((t) => d(t.scene.id));
98
+ }, j = (e) => y(e) && A(e, [
99
+ "kind",
100
+ "conditionId",
101
+ "rawCondition",
102
+ "migrationIssues"
103
+ ]) && e.kind === "legacyReadonly" && d(e.conditionId) && y(e.rawCondition) && Array.isArray(e.migrationIssues) && e.migrationIssues.length > 0 && e.migrationIssues.every(
104
+ (n) => E(n) && n.source === "migration" && d(n.path)
105
+ ) && e.migrationIssues.some((n) => n.severity === "error"), L = (e) => {
106
+ if (!y(e) || !A(e, ["condition", "revision"]) || !d(e.revision))
107
+ return !1;
108
+ const n = m(e.condition);
109
+ return n.ok && d(n.data.id) && n.data.scenes.every((t) => d(t.scene.id)) && C(n.data.scenes.map((t) => t.scene)).ok;
110
+ };
111
+ function M(e) {
112
+ return S(e, J);
113
+ }
114
+ function z(e) {
115
+ return S(
116
+ e,
117
+ (n) => J(n) || j(n)
118
+ );
119
+ }
120
+ function T(e) {
121
+ return S(e, L);
122
+ }
123
+ function P(e, n) {
124
+ const t = N(e);
125
+ if (!t.ok) return { ok: !1, path: t.path };
126
+ const o = t.data.condition, a = T({ ok: !0, data: n });
127
+ if (!a.ok) {
128
+ const s = (() => {
129
+ try {
130
+ return y(n) && v(n) === null ? m(n.condition) : null;
131
+ } catch {
132
+ return null;
133
+ }
134
+ })();
135
+ return s != null && s.ok && o.scenes.length !== s.data.scenes.length ? { ok: !1, path: "scenes" } : { ok: !1, path: "saved" };
136
+ }
137
+ const i = a.data.condition;
138
+ if (t.data.expectedRevision !== null && a.data.revision === t.data.expectedRevision)
139
+ return { ok: !1, path: "revision" };
140
+ if (o.id !== void 0 && o.id !== i.id)
141
+ return { ok: !1, path: "id" };
142
+ if (o.scenes.length !== i.scenes.length)
143
+ return { ok: !1, path: "scenes" };
144
+ for (const [s, c] of o.scenes.entries()) {
145
+ const p = i.scenes[s];
146
+ if (c.sceneKey !== p.sceneKey)
147
+ return { ok: !1, path: `scenes[${s}].sceneKey` };
148
+ const r = { ...p.scene };
149
+ if (c.scene.id === void 0 && delete r.id, b(c.scene) !== b(r))
150
+ return { ok: !1, path: `scenes[${s}].scene` };
151
+ }
152
+ return { ok: !0 };
153
+ }
154
+ function Q(e, n) {
155
+ var c, p;
156
+ if (e.type !== "reasoning")
157
+ throw new Error("只有推理知识可以构造推理引用上下文");
158
+ const t = x(e);
159
+ if (t) throw new Error(`知识内容无效:${t}`);
160
+ if (!n || typeof n != "object" || Array.isArray(n) || v(n) !== null)
161
+ throw new Error("属性值不是合法的 JSON 对象");
162
+ const o = [], a = [], i = [], s = (r) => {
163
+ var u, h, K, R, I, $;
164
+ if (r.type === "businessToken") {
165
+ const l = String((u = r.attrs) == null ? void 0 : u.kind), f = String((h = r.attrs) == null ? void 0 : h.key), k = String(((K = r.attrs) == null ? void 0 : K.id) || ""), w = String(((R = r.attrs) == null ? void 0 : R.label) || f);
166
+ if ((l === "ticket" || l === "attribute" || l === "tool") && !k.trim())
167
+ throw new Error(`引用缺少稳定节点 ID:${f}`);
168
+ if (l === "ticket")
169
+ a.push({ nodeId: k, key: f, label: w });
170
+ else if (l === "attribute") {
171
+ if (!Object.prototype.hasOwnProperty.call(n, f))
172
+ throw new Error(`缺少属性值:${f}`);
173
+ o.push({
174
+ nodeId: k,
175
+ key: f,
176
+ label: w,
177
+ value: JSON.parse(JSON.stringify(n[f]))
178
+ });
179
+ } else if (l === "tool") {
180
+ const g = (I = r.attrs) == null ? void 0 : I.params;
181
+ if (!g || typeof g != "object" || Array.isArray(g))
182
+ throw new Error(`工具缺少配置参数:${f}`);
183
+ i.push({
184
+ nodeId: k,
185
+ key: f,
186
+ label: w,
187
+ params: JSON.parse(JSON.stringify(g))
188
+ });
189
+ }
190
+ }
191
+ ($ = r.content) == null || $.forEach(s);
192
+ };
193
+ return (p = (c = e.knowledge.doc) == null ? void 0 : c.content) == null || p.forEach(s), { knowledgeType: "reasoning", tickets: a, attributes: o, tools: i };
194
+ }
195
+ function _(e) {
196
+ var o;
197
+ if (e.type !== "agent")
198
+ throw new Error("只有Agent知识可以构造Agent调用上下文");
199
+ const n = x(e);
200
+ if (n) throw new Error(`知识内容无效:${n}`);
201
+ const t = (o = e.knowledge.agentRef) == null ? void 0 : o.id;
202
+ if (!(t != null && t.trim())) throw new Error("请选择Agent");
203
+ return { knowledgeType: "agent", agentId: t };
204
+ }
205
+ export {
206
+ B as FkpRichText,
207
+ ne as assignLegacyExtensionIds,
208
+ te as assignLegacyMediaIds,
209
+ _ as buildAgentInvocationContext,
210
+ Q as buildReasoningReferenceContext,
211
+ G as default,
212
+ H as emptyDoc,
213
+ V as emptyScene,
214
+ z as parseConditionLoadResult,
215
+ m as parseKnowledgeConditionV1,
216
+ M as parseLoadedConditionResult,
217
+ N as parseSaveConditionInput,
218
+ T as parseSavedConditionResult,
219
+ W as resolveSceneConfig,
220
+ Y as serializeQuestionForModel,
221
+ Z as serializeQuestionTagsForModel,
222
+ C as validateKnowledgeScenes,
223
+ P as verifySavedConditionEcho
224
+ };