@aheart-ui/ai 0.0.0-stage → 1.0.0

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -2
  3. package/es/actions.vue.d.ts +34 -0
  4. package/es/actions.vue.js +27 -0
  5. package/es/actions.vue2.js +4 -0
  6. package/es/agent-execution.vue.d.ts +106 -0
  7. package/es/agent-execution.vue.js +441 -0
  8. package/es/agent-execution.vue2.js +4 -0
  9. package/es/agent-workbench.vue.d.ts +186 -0
  10. package/es/agent-workbench.vue.js +537 -0
  11. package/es/agent-workbench.vue2.js +4 -0
  12. package/es/attachments.vue.d.ts +39 -0
  13. package/es/attachments.vue.js +39 -0
  14. package/es/attachments.vue2.js +4 -0
  15. package/es/bubble.vue.d.ts +27 -0
  16. package/es/bubble.vue.js +82 -0
  17. package/es/bubble.vue2.js +4 -0
  18. package/es/chat-panel.vue.d.ts +108 -0
  19. package/es/chat-panel.vue.js +330 -0
  20. package/es/chat-panel.vue2.js +4 -0
  21. package/es/conversations.vue.d.ts +39 -0
  22. package/es/conversations.vue.js +29 -0
  23. package/es/conversations.vue2.js +4 -0
  24. package/es/form-field.vue.d.ts +28 -0
  25. package/es/form-field.vue.js +176 -0
  26. package/es/form-field.vue2.js +4 -0
  27. package/es/form-schema.d.ts +73 -0
  28. package/es/form-schema.js +105 -0
  29. package/es/form.vue.d.ts +81 -0
  30. package/es/form.vue.js +376 -0
  31. package/es/form.vue2.js +4 -0
  32. package/es/index.d.ts +20 -0
  33. package/es/index.js +42 -0
  34. package/es/package.json +3 -0
  35. package/es/process.vue.d.ts +30 -0
  36. package/es/process.vue.js +29 -0
  37. package/es/process.vue2.js +4 -0
  38. package/es/prompts.vue.d.ts +39 -0
  39. package/es/prompts.vue.js +33 -0
  40. package/es/prompts.vue2.js +4 -0
  41. package/es/safe-markdown.d.ts +3 -0
  42. package/es/safe-markdown.js +23 -0
  43. package/es/sender.vue.d.ts +52 -0
  44. package/es/sender.vue.js +46 -0
  45. package/es/sender.vue2.js +4 -0
  46. package/es/sources.vue.d.ts +30 -0
  47. package/es/sources.vue.js +34 -0
  48. package/es/sources.vue2.js +4 -0
  49. package/es/stream-reducer.d.ts +35 -0
  50. package/es/stream-reducer.js +85 -0
  51. package/es/style.css +1586 -0
  52. package/es/thought-chain.vue.d.ts +30 -0
  53. package/es/thought-chain.vue.js +15 -0
  54. package/es/thought-chain.vue2.js +4 -0
  55. package/es/types.d.ts +203 -0
  56. package/es/welcome.vue.d.ts +41 -0
  57. package/es/welcome.vue.js +27 -0
  58. package/es/welcome.vue2.js +4 -0
  59. package/lib/actions.vue.d.ts +34 -0
  60. package/lib/actions.vue.js +1 -0
  61. package/lib/actions.vue2.js +1 -0
  62. package/lib/agent-execution.vue.d.ts +106 -0
  63. package/lib/agent-execution.vue.js +1 -0
  64. package/lib/agent-execution.vue2.js +1 -0
  65. package/lib/agent-workbench.vue.d.ts +186 -0
  66. package/lib/agent-workbench.vue.js +1 -0
  67. package/lib/agent-workbench.vue2.js +1 -0
  68. package/lib/attachments.vue.d.ts +39 -0
  69. package/lib/attachments.vue.js +1 -0
  70. package/lib/attachments.vue2.js +1 -0
  71. package/lib/bubble.vue.d.ts +27 -0
  72. package/lib/bubble.vue.js +1 -0
  73. package/lib/bubble.vue2.js +1 -0
  74. package/lib/chat-panel.vue.d.ts +108 -0
  75. package/lib/chat-panel.vue.js +1 -0
  76. package/lib/chat-panel.vue2.js +1 -0
  77. package/lib/conversations.vue.d.ts +39 -0
  78. package/lib/conversations.vue.js +1 -0
  79. package/lib/conversations.vue2.js +1 -0
  80. package/lib/form-field.vue.d.ts +28 -0
  81. package/lib/form-field.vue.js +1 -0
  82. package/lib/form-field.vue2.js +1 -0
  83. package/lib/form-schema.d.ts +73 -0
  84. package/lib/form-schema.js +1 -0
  85. package/lib/form.vue.d.ts +81 -0
  86. package/lib/form.vue.js +1 -0
  87. package/lib/form.vue2.js +1 -0
  88. package/lib/index.d.ts +20 -0
  89. package/lib/index.js +1 -0
  90. package/lib/package.json +3 -0
  91. package/lib/process.vue.d.ts +30 -0
  92. package/lib/process.vue.js +1 -0
  93. package/lib/process.vue2.js +1 -0
  94. package/lib/prompts.vue.d.ts +39 -0
  95. package/lib/prompts.vue.js +1 -0
  96. package/lib/prompts.vue2.js +1 -0
  97. package/lib/safe-markdown.d.ts +3 -0
  98. package/lib/safe-markdown.js +2 -0
  99. package/lib/sender.vue.d.ts +52 -0
  100. package/lib/sender.vue.js +1 -0
  101. package/lib/sender.vue2.js +1 -0
  102. package/lib/sources.vue.d.ts +30 -0
  103. package/lib/sources.vue.js +1 -0
  104. package/lib/sources.vue2.js +1 -0
  105. package/lib/stream-reducer.d.ts +35 -0
  106. package/lib/stream-reducer.js +1 -0
  107. package/lib/style.css +1586 -0
  108. package/lib/thought-chain.vue.d.ts +30 -0
  109. package/lib/thought-chain.vue.js +1 -0
  110. package/lib/thought-chain.vue2.js +1 -0
  111. package/lib/types.d.ts +203 -0
  112. package/lib/welcome.vue.d.ts +41 -0
  113. package/lib/welcome.vue.js +1 -0
  114. package/lib/welcome.vue2.js +1 -0
  115. package/package.json +70 -3
@@ -0,0 +1,537 @@
1
+ import { defineComponent as Be, ref as R, getCurrentInstance as Ve, useId as De, computed as I, onMounted as He, nextTick as Le, onBeforeUnmount as Ie, watch as ee, onBeforeUpdate as Pe, h as te, openBlock as h, createElementBlock as g, createElementVNode as u, toDisplayString as $, createCommentVNode as C, normalizeClass as Ne, createVNode as m, unref as y, withCtx as k, createTextVNode as P, createBlock as ae, Teleport as $e, mergeProps as Fe, renderSlot as _, createSlots as Je, withDirectives as oe, Fragment as Ze, renderList as qe, vShow as se } from "vue";
2
+ import { Splitter as We, SplitterPanel as ne, Button as N, Tabs as Ge, Drawer as Xe } from "aheart-ui";
3
+ import { SortableList as Ye } from "@aheart-ui/dnd";
4
+ import Ce from "./attachments.vue.js";
5
+ import Qe from "./chat-panel.vue.js";
6
+ import xe from "./conversations.vue.js";
7
+ import Se from "./sources.vue.js";
8
+ import et from "./agent-execution.vue.js";
9
+ const tt = {
10
+ class: "aheart-ai-workbench",
11
+ "aria-label": "AI 工作台"
12
+ }, at = { class: "aheart-ai-workbench__header" }, ot = { key: 0 }, st = { class: "aheart-ai-workbench__header-status" }, nt = { class: "aheart-ai-workbench__progress" }, rt = ["aria-label"], it = { class: "aheart-ai-workbench__desktop" }, lt = { class: "aheart-ai-workbench__sidebar" }, dt = {
13
+ key: 0,
14
+ class: "aheart-ai-workbench__context",
15
+ "aria-label": "上下文"
16
+ }, ct = ["data-context-id"], ut = { key: 0 }, vt = { class: "aheart-ai-workbench__move-actions" }, pt = { class: "aheart-ai-workbench__chat" }, ft = {
17
+ key: 1,
18
+ class: "aheart-ai-workbench__empty"
19
+ }, mt = {
20
+ class: "aheart-ai-workbench__execution",
21
+ "aria-label": "执行与产物"
22
+ }, bt = {
23
+ key: 0,
24
+ class: "aheart-ai-workbench__task-order-error",
25
+ role: "alert"
26
+ }, ht = { class: "aheart-ai-workbench__mobile" }, kt = { class: "aheart-ai-workbench__mobile-panel" }, gt = {
27
+ key: 0,
28
+ class: "aheart-ai-workbench__context",
29
+ "aria-label": "上下文"
30
+ }, yt = { class: "aheart-ai-workbench__context-list-mobile" }, wt = ["data-context-id"], It = { key: 0 }, $t = { class: "aheart-ai-workbench__move-actions" }, Ct = { class: "aheart-ai-workbench__mobile-panel" }, xt = { class: "aheart-ai-workbench__mobile-panel--chat" }, St = ["id"], At = {
31
+ key: 0,
32
+ class: "aheart-ai-workbench__empty"
33
+ }, Tt = { class: "aheart-ai-workbench__mobile-panel" }, Ut = /* @__PURE__ */ Be({
34
+ name: "AAIAgentWorkbench",
35
+ __name: "agent-workbench",
36
+ props: {
37
+ title: { default: "AI 工作台" },
38
+ description: { default: "编排对话、任务、审批与产物。" },
39
+ panelSizes: { default: () => [150, "auto", 200] },
40
+ conversations: { default: () => [] },
41
+ activeConversation: { default: void 0 },
42
+ messages: { default: () => [] },
43
+ prompts: { default: () => [] },
44
+ transport: { default: void 0 },
45
+ tasks: { default: () => [] },
46
+ contextItems: { default: () => [] },
47
+ sources: { default: () => [] },
48
+ attachments: { default: () => [] },
49
+ artifacts: { default: () => [] },
50
+ activeArtifact: { default: void 0 },
51
+ disabled: { type: Boolean, default: !1 },
52
+ actionHandler: {},
53
+ reorderable: { type: Boolean, default: !0 },
54
+ tasksRevision: { default: void 0 },
55
+ scopeKey: { default: void 0 }
56
+ },
57
+ emits: ["update:panelSizes", "update:activeConversation", "update:messages", "update:activeArtifact", "update:tasks", "update:contextItems", "approve", "reject", "cancel", "retry", "move-task", "move-context", "stop", "chat-retry", "chat-regenerate", "chat-edit", "chat-copy", "error", "operation-start", "operation-success", "operation-error", "task-move-reject"],
58
+ setup(l, { emit: Ae }) {
59
+ const s = l, v = Ae, j = R("chat"), D = R(!1), W = R(), G = R(), re = R(!1), K = R(!1), U = R(!1);
60
+ let S, F;
61
+ const B = Ve(), X = `scope-${De().replace(/[^a-zA-Z0-9_-]/g, "-")}`, Y = X.replace(/^scope-/, ""), Te = `aheart-ai-${Y}-chat-target`, ie = `aheart-ai-${Y}-execution-target`, Q = I(() => s.scopeKey === void 0 ? X : `scope-${String(s.scopeKey).replace(/[^a-zA-Z0-9_-]/g, "-")}-${X.replace(/^scope-/, "")}`);
62
+ He(async () => {
63
+ var a, o, r;
64
+ re.value = !0;
65
+ const t = (o = (a = B == null ? void 0 : B.proxy) == null ? void 0 : a.$el) == null ? void 0 : o.ownerDocument, e = t == null ? void 0 : t.defaultView;
66
+ e != null && e.matchMedia ? (S = e.matchMedia("(max-width: 760px)"), U.value = S.matches, F = (d) => {
67
+ U.value = d.matches;
68
+ }, (r = S.addEventListener) == null || r.call(S, "change", F)) : U.value = !0, K.value = !0, await Le();
69
+ }), Ie(() => {
70
+ var t;
71
+ S && F && ((t = S.removeEventListener) == null || t.call(S, "change", F));
72
+ }), ee(U, (t) => {
73
+ t || (D.value = !1);
74
+ });
75
+ const f = R({}), A = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
76
+ let le = 0;
77
+ const E = /* @__PURE__ */ new Set(), de = () => Object.prototype.hasOwnProperty.call((B == null ? void 0 : B.vnode.props) ?? {}, "messages"), ce = R(de());
78
+ Pe(() => {
79
+ ce.value = de();
80
+ });
81
+ const Me = I(() => ce.value ? { messages: s.messages } : { defaultMessages: s.messages }), ue = I(() => s.tasks.filter(
82
+ (t) => t.approval && (!t.approval.status || t.approval.status === "pending")
83
+ )), z = I(() => ue.value.length), ve = I(() => {
84
+ const t = ue.value[0], e = s.artifacts.find((o) => {
85
+ var r;
86
+ return o.id === ((r = t == null ? void 0 : t.approval) == null ? void 0 : r.artifactId);
87
+ });
88
+ return e ? `${z.value > 1 ? `${z.value} 项待审批` : "待审批"}:${e.title}` : `${z.value} 项待审批`;
89
+ }), Re = () => {
90
+ j.value = "execution", D.value = !0;
91
+ }, je = I(() => [
92
+ { key: J("conversations"), label: "会话" },
93
+ { key: J("chat"), label: "对话" },
94
+ {
95
+ key: J("execution"),
96
+ label: te("span", { class: "aheart-ai-workbench__mobile-tab-label" }, [
97
+ te("span", "执行"),
98
+ z.value > 0 ? te("span", { class: "aheart-ai-workbench__pending-badge", "aria-label": `${z.value} 项待审批` }, String(z.value)) : null
99
+ ])
100
+ }
101
+ ]), J = (t) => `${t}--${Y}`, ze = I(() => Object.fromEntries(Object.entries(f.value).map(([t, e]) => [t, e.message ?? (e.status === "pending" ? "处理中…" : e.status === "success" ? "成功" : "")]))), V = (t) => {
102
+ var e;
103
+ return `${t.id}:${String(t.revision ?? "")}:${((e = t.approval) == null ? void 0 : e.id) ?? ""}`;
104
+ }, pe = (t, e) => {
105
+ const a = V(t), o = f.value[a];
106
+ return E.has(a) || [...E].some((d) => d.startsWith(`${t.id}:`)) || (o == null ? void 0 : o.status) === "pending" || (o == null ? void 0 : o.status) === "success" || s.disabled || s.actionHandler && t.revision === void 0 ? !0 : t.approval ? (o == null ? void 0 : o.status) === "error" && o.outcome !== "not-applied" && e !== "retry" || s.actionHandler && (t.revision === void 0 || t.approval.artifactId && (!s.artifacts.find((d) => {
107
+ var n;
108
+ return d.id === ((n = t.approval) == null ? void 0 : n.artifactId);
109
+ }) || s.artifacts.some((d) => {
110
+ var n;
111
+ return d.id === ((n = t.approval) == null ? void 0 : n.artifactId) && d.revision === void 0;
112
+ }))) ? !0 : t.status === "running" && e !== "cancel" : (o == null ? void 0 : o.status) === "error" ? e !== "retry" : !(t.status === "running" && e === "cancel" || t.status === "error" && e === "retry");
113
+ }, Z = async (t, e) => {
114
+ var c, p, b, M, L, ye;
115
+ if (pe(e, t)) return;
116
+ if (!s.actionHandler) {
117
+ v(t === "approve" ? "approve" : t === "reject" ? "reject" : t === "cancel" ? "cancel" : "retry", e);
118
+ return;
119
+ }
120
+ const a = (c = e.approval) != null && c.artifactId ? s.artifacts.find((x) => {
121
+ var w;
122
+ return x.id === ((w = e.approval) == null ? void 0 : w.artifactId);
123
+ }) : void 0, o = V(e), r = f.value[o];
124
+ (r == null ? void 0 : r.status) === "error" && r.outcome === "not-applied" && O.delete(o);
125
+ const d = O.get(o) ?? `${o}:${Date.now()}:${++le}`;
126
+ O.set(o, d);
127
+ const n = {
128
+ operationId: `${d}:attempt-${++le}`,
129
+ idempotencyKey: d,
130
+ conversationId: s.activeConversation,
131
+ taskId: e.id,
132
+ taskRevision: e.revision,
133
+ action: (r == null ? void 0 : r.status) === "error" && r.outcome === "unknown" && t === "retry" ? r.action : t,
134
+ ...(p = e.approval) != null && p.id ? { approvalId: e.approval.id } : {},
135
+ artifactId: ((b = e.approval) == null ? void 0 : b.artifactId) ?? (a == null ? void 0 : a.id),
136
+ ...(a == null ? void 0 : a.revision) === void 0 ? {} : { artifactRevision: a.revision }
137
+ }, i = new AbortController();
138
+ E.add(o), A.set(o, i), f.value = { ...f.value, [o]: { status: "pending", operationId: n.operationId, idempotencyKey: d, action: n.action, taskRevision: e.revision, taskStatus: e.status, approvalStatus: (M = e.approval) == null ? void 0 : M.status, approvalId: (L = e.approval) == null ? void 0 : L.id, artifactId: (a == null ? void 0 : a.id) ?? ((ye = e.approval) == null ? void 0 : ye.artifactId), artifactRevision: a == null ? void 0 : a.revision, conversationId: s.activeConversation } }, v("operation-start", n);
139
+ try {
140
+ const x = await s.actionHandler(n, i.signal), w = f.value[o];
141
+ if (i.signal.aborted || !w || w.operationId !== n.operationId || x.operationId !== n.operationId) return;
142
+ x.status === "success" ? (f.value = { ...f.value, [o]: { ...w, status: "success", message: "成功" } }, v("operation-success", n)) : (f.value = { ...f.value, [o]: { ...w, status: "error", message: x.error, outcome: x.outcome ?? "unknown" } }, v("operation-error", n, x.error));
143
+ } catch (x) {
144
+ if (i.signal.aborted) return;
145
+ const w = f.value[o];
146
+ if (!w || w.operationId !== n.operationId) return;
147
+ const we = x instanceof Error ? x.message : "操作失败";
148
+ f.value = { ...f.value, [o]: { ...w, status: "error", message: we, outcome: "unknown" } }, v("operation-error", n, we);
149
+ } finally {
150
+ E.delete(o), A.get(o) === i && A.delete(o);
151
+ }
152
+ }, fe = (t) => {
153
+ const e = new Set(t.map((i) => i.id)), a = new Set(s.tasks.map((i) => i.id));
154
+ if (e.size !== t.length || e.size !== a.size || [...e].some((i) => !a.has(i)) || t.some((i) => {
155
+ var c;
156
+ return (c = i.dependsOn) == null ? void 0 : c.some((p) => !e.has(p));
157
+ })) return "任务集合或依赖无效,无法排序";
158
+ const o = new Map(t.map((i, c) => [i.id, c]));
159
+ if (t.some((i) => {
160
+ var c;
161
+ return (c = i.dependsOn) == null ? void 0 : c.some((p) => (o.get(p) ?? 1 / 0) >= o.get(i.id));
162
+ })) return "依赖任务必须排在前面";
163
+ const r = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), n = (i) => {
164
+ var p;
165
+ if (r.has(i)) return !0;
166
+ if (d.has(i)) return !1;
167
+ r.add(i);
168
+ const c = t.find((b) => b.id === i);
169
+ return (p = c == null ? void 0 : c.dependsOn) != null && p.some(n) ? !0 : (r.delete(i), d.add(i), !1);
170
+ };
171
+ if (t.some((i) => n(i.id))) return "任务依赖存在循环";
172
+ }, me = I(() => fe(s.tasks)), be = (t) => {
173
+ var o;
174
+ const e = fe(t);
175
+ if (e) return e;
176
+ const a = new Map(s.tasks.map((r, d) => [r.id, d]));
177
+ for (const [r, d] of t.entries()) {
178
+ const n = s.tasks[a.get(d.id) ?? -1];
179
+ if (!n) return "任务集合发生变化,无法排序";
180
+ if (JSON.stringify(d) !== JSON.stringify(n)) return "任务数据在排序期间发生变化";
181
+ if ((n.lockedReason || n.reorderable === !1 || ["running", "waiting-approval"].includes(n.status)) && a.get(d.id) !== r) return n.lockedReason ?? "任务当前不可移动";
182
+ if (((o = f.value[V(n)]) == null ? void 0 : o.status) === "pending" && a.get(d.id) !== r) return "任务操作进行中,无法移动";
183
+ }
184
+ }, Oe = (t) => {
185
+ const e = t, a = be(e);
186
+ if (a) {
187
+ v("task-move-reject", a);
188
+ return;
189
+ }
190
+ v("update:tasks", e);
191
+ }, he = I(() => s.contextItems), ke = I(() => s.tasks.filter((t) => t.status === "complete").length), ge = I(() => s.tasks.some((t) => t.status === "error") ? { key: "error", label: "需要处理" } : z.value > 0 ? { key: "waiting", label: "等待人工审批" } : s.tasks.some((t) => t.status === "running") ? { key: "running", label: "执行中" } : s.tasks.length && ke.value === s.tasks.length ? { key: "complete", label: "已完成" } : { key: "idle", label: "待开始" }), T = (t) => t, Ee = (t, e, a) => {
192
+ const o = e + a;
193
+ if (o < 0 || o >= t.length) return t;
194
+ const r = [...t], [d] = r.splice(e, 1);
195
+ return r.splice(o, 0, d), r;
196
+ }, H = (t, e) => {
197
+ var o, r;
198
+ const a = t + e;
199
+ return !!(s.disabled || a < 0 || a >= s.contextItems.length || (o = s.contextItems[t]) != null && o.disabled || (r = s.contextItems[a]) != null && r.disabled);
200
+ }, q = (t, e) => {
201
+ if (H(t, e)) return;
202
+ const a = s.contextItems[t];
203
+ !a || t + e < 0 || t + e >= s.contextItems.length || (v("update:contextItems", Ee(s.contextItems, t, e)), v("move-context", a.id, e < 0 ? "up" : "down"));
204
+ }, _e = (t) => {
205
+ if (s.disabled) return;
206
+ const e = t;
207
+ s.contextItems.some((o, r) => {
208
+ var d;
209
+ return o.disabled && ((d = e[r]) == null ? void 0 : d.id) !== o.id;
210
+ }) || v("update:contextItems", e);
211
+ }, Ke = (t, e) => v("move-task", t, e), Ue = (t, e) => v("chat-edit", t, e);
212
+ return ee(() => [s.tasks, s.artifacts, s.activeConversation, s.actionHandler], () => {
213
+ var t, e, a, o, r, d;
214
+ for (const [n, i] of A) {
215
+ const c = s.tasks.find((M) => V(M) === n);
216
+ if (!c) {
217
+ i.abort(), A.delete(n), E.delete(n), O.delete(n);
218
+ continue;
219
+ }
220
+ const p = f.value[n], b = (t = c.approval) != null && t.artifactId ? s.artifacts.find((M) => {
221
+ var L;
222
+ return M.id === ((L = c.approval) == null ? void 0 : L.artifactId);
223
+ }) : void 0;
224
+ p && (p.taskRevision !== c.revision || p.approvalId !== ((e = c.approval) == null ? void 0 : e.id) || p.artifactId !== ((b == null ? void 0 : b.id) ?? ((a = c.approval) == null ? void 0 : a.artifactId)) || p.artifactRevision !== (b == null ? void 0 : b.revision) || p.conversationId !== s.activeConversation) && (i == null || i.abort(), i && A.delete(n), E.delete(n), O.delete(n), delete f.value[n]);
225
+ }
226
+ for (const n of Object.keys(f.value)) s.tasks.some((i) => V(i) === n) || delete f.value[n];
227
+ for (const [n, i] of Object.entries(f.value)) {
228
+ const c = s.tasks.find((b) => V(b) === n), p = (o = c == null ? void 0 : c.approval) != null && o.artifactId ? s.artifacts.find((b) => {
229
+ var M;
230
+ return b.id === ((M = c.approval) == null ? void 0 : M.artifactId);
231
+ }) : void 0;
232
+ (!c || i.conversationId !== s.activeConversation || i.taskStatus !== c.status || i.approvalStatus !== ((r = c.approval) == null ? void 0 : r.status) || i.artifactId !== ((p == null ? void 0 : p.id) ?? ((d = c.approval) == null ? void 0 : d.artifactId)) || i.artifactRevision !== (p == null ? void 0 : p.revision)) && (O.delete(n), delete f.value[n]);
233
+ }
234
+ }, { deep: !0 }), ee(() => s.actionHandler, (t, e) => {
235
+ if (t !== e) {
236
+ for (const a of A.values()) a.abort();
237
+ A.clear(), E.clear(), f.value = {}, O.clear();
238
+ }
239
+ }), Ie(() => {
240
+ for (const t of A.values()) t.abort();
241
+ }), (t, e) => (h(), g("section", tt, [
242
+ u("header", at, [
243
+ u("div", null, [
244
+ e[18] || (e[18] = u("span", { class: "aheart-ai-workbench__eyebrow" }, "智能工作区", -1)),
245
+ u("h2", null, $(l.title), 1),
246
+ l.description ? (h(), g("p", ot, $(l.description), 1)) : C("", !0)
247
+ ]),
248
+ u("div", st, [
249
+ u("span", {
250
+ "data-workbench-status": "",
251
+ class: Ne(`is-${ge.value.key}`)
252
+ }, $(ge.value.label), 3),
253
+ u("small", nt, $(ke.value) + " / " + $(l.tasks.length) + " 已完成", 1),
254
+ z.value > 0 ? (h(), g("button", {
255
+ key: 0,
256
+ type: "button",
257
+ "data-pending-approval-summary": "",
258
+ class: "aheart-ai-workbench__pending-summary",
259
+ "aria-label": ve.value,
260
+ onClick: Re
261
+ }, $(ve.value), 9, rt)) : C("", !0)
262
+ ])
263
+ ]),
264
+ u("div", it, [
265
+ m(y(We), {
266
+ sizes: l.panelSizes,
267
+ "default-sizes": [150, "auto", 200],
268
+ "onUpdate:sizes": e[13] || (e[13] = (a) => v("update:panelSizes", a))
269
+ }, {
270
+ default: k(() => [
271
+ m(y(ne), {
272
+ min: 140,
273
+ collapsible: ""
274
+ }, {
275
+ default: k(() => [
276
+ u("aside", lt, [
277
+ e[22] || (e[22] = u("h2", null, "会话", -1)),
278
+ m(xe, {
279
+ "model-value": l.activeConversation,
280
+ conversations: l.conversations,
281
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => v("update:activeConversation", a))
282
+ }, null, 8, ["model-value", "conversations"]),
283
+ l.contextItems.length ? (h(), g("section", dt, [
284
+ e[21] || (e[21] = u("h3", null, "上下文", -1)),
285
+ m(y(Ye), {
286
+ items: he.value,
287
+ "item-key": "id",
288
+ group: `agent-context-${Q.value}`,
289
+ disabled: l.disabled,
290
+ "onUpdate:items": _e
291
+ }, {
292
+ item: k(({ item: a, index: o }) => [
293
+ u("div", {
294
+ class: "aheart-ai-workbench__context-item",
295
+ "data-context-id": T(a).id
296
+ }, [
297
+ u("span", null, $(T(a).label), 1),
298
+ T(a).description ? (h(), g("small", ut, $(T(a).description), 1)) : C("", !0),
299
+ u("div", vt, [
300
+ m(y(N), {
301
+ type: "text",
302
+ disabled: H(o, -1),
303
+ onClick: (r) => q(o, -1)
304
+ }, {
305
+ default: k(() => [...e[19] || (e[19] = [
306
+ P("上移", -1)
307
+ ])]),
308
+ _: 1
309
+ }, 8, ["disabled", "onClick"]),
310
+ m(y(N), {
311
+ type: "text",
312
+ disabled: H(o, 1),
313
+ onClick: (r) => q(o, 1)
314
+ }, {
315
+ default: k(() => [...e[20] || (e[20] = [
316
+ P("下移", -1)
317
+ ])]),
318
+ _: 1
319
+ }, 8, ["disabled", "onClick"])
320
+ ])
321
+ ], 8, ct)
322
+ ]),
323
+ _: 1
324
+ }, 8, ["items", "group", "disabled"])
325
+ ])) : C("", !0)
326
+ ])
327
+ ]),
328
+ _: 1
329
+ }),
330
+ m(y(ne), { min: 230 }, {
331
+ default: k(() => [
332
+ u("main", pt, [
333
+ l.transport ? (h(), ae($e, {
334
+ key: 0,
335
+ to: K.value ? W.value : `#${Te}`,
336
+ disabled: !K.value || !U.value || j.value !== "chat" || !W.value && K.value
337
+ }, [
338
+ l.transport ? (h(), ae(Qe, Fe({ key: "chat-owner" }, Me.value, {
339
+ transport: l.transport,
340
+ "conversation-id": l.activeConversation,
341
+ prompts: l.prompts,
342
+ disabled: l.disabled,
343
+ "onUpdate:messages": e[1] || (e[1] = (a) => v("update:messages", a)),
344
+ onError: e[2] || (e[2] = (a) => v("error", a)),
345
+ onStop: e[3] || (e[3] = (a) => v("stop")),
346
+ onRetry: e[4] || (e[4] = (a) => v("chat-retry", a)),
347
+ onRegenerate: e[5] || (e[5] = (a) => v("chat-regenerate", a)),
348
+ onEdit: Ue,
349
+ onCopy: e[6] || (e[6] = (a) => v("chat-copy", a))
350
+ }), null, 16, ["transport", "conversation-id", "prompts", "disabled"])) : C("", !0)
351
+ ], 8, ["to", "disabled"])) : C("", !0),
352
+ l.transport ? C("", !0) : (h(), g("p", ft, "业务层尚未提供对话传输适配器。")),
353
+ _(t.$slots, "sources", { sources: l.sources }, () => [
354
+ m(Se, { sources: l.sources }, null, 8, ["sources"])
355
+ ]),
356
+ _(t.$slots, "attachments", { attachments: l.attachments }, () => [
357
+ m(Ce, { items: l.attachments }, null, 8, ["items"])
358
+ ])
359
+ ])
360
+ ]),
361
+ _: 3
362
+ }),
363
+ m(y(ne), {
364
+ min: 180,
365
+ collapsible: ""
366
+ }, {
367
+ default: k(() => [
368
+ u("aside", mt, [
369
+ (h(), ae($e, {
370
+ to: K.value ? G.value : `#${ie}`,
371
+ disabled: !K.value || !U.value || j.value !== "execution" || !G.value
372
+ }, [
373
+ m(et, {
374
+ key: "execution-owner",
375
+ tasks: l.tasks,
376
+ artifacts: l.artifacts,
377
+ "active-artifact": l.activeArtifact,
378
+ disabled: l.disabled,
379
+ reorderable: l.reorderable,
380
+ "tasks-revision": l.tasksRevision,
381
+ "scope-key": Q.value,
382
+ "action-disabled": pe,
383
+ "operation-messages": ze.value,
384
+ "validate-candidate": be,
385
+ "onUpdate:tasks": Oe,
386
+ onApprove: e[7] || (e[7] = (a) => Z("approve", a)),
387
+ onReject: e[8] || (e[8] = (a) => Z("reject", a)),
388
+ onCancel: e[9] || (e[9] = (a) => Z("cancel", a)),
389
+ onRetry: e[10] || (e[10] = (a) => Z("retry", a)),
390
+ onMoveTask: Ke,
391
+ onMoveTaskReject: e[11] || (e[11] = (a) => v("task-move-reject", a)),
392
+ onSelectArtifact: e[12] || (e[12] = (a) => v("update:activeArtifact", a.id))
393
+ }, Je({ _: 2 }, [
394
+ t.$slots.task ? {
395
+ name: "task",
396
+ fn: k(({ task: a, index: o }) => [
397
+ _(t.$slots, "task", {
398
+ task: a,
399
+ index: o
400
+ })
401
+ ]),
402
+ key: "0"
403
+ } : void 0,
404
+ t.$slots.artifact ? {
405
+ name: "artifact",
406
+ fn: k(({ artifact: a }) => [
407
+ _(t.$slots, "artifact", { artifact: a })
408
+ ]),
409
+ key: "1"
410
+ } : void 0,
411
+ t.$slots["artifact-preview"] ? {
412
+ name: "artifact-preview",
413
+ fn: k(({ artifact: a }) => [
414
+ _(t.$slots, "artifact-preview", { artifact: a })
415
+ ]),
416
+ key: "2"
417
+ } : void 0
418
+ ]), 1032, ["tasks", "artifacts", "active-artifact", "disabled", "reorderable", "tasks-revision", "scope-key", "operation-messages"])
419
+ ], 8, ["to", "disabled"])),
420
+ me.value ? (h(), g("p", bt, "无法排序:" + $(me.value), 1)) : C("", !0)
421
+ ])
422
+ ]),
423
+ _: 3
424
+ })
425
+ ]),
426
+ _: 3
427
+ }, 8, ["sizes"])
428
+ ]),
429
+ u("div", ht, [
430
+ m(y(Ge), {
431
+ items: je.value,
432
+ "active-key": J(j.value),
433
+ "onUpdate:activeKey": e[14] || (e[14] = (a) => j.value = String(a).split("--")[0])
434
+ }, null, 8, ["items", "active-key"]),
435
+ oe(u("section", kt, [
436
+ m(xe, {
437
+ "model-value": l.activeConversation,
438
+ conversations: l.conversations,
439
+ "onUpdate:modelValue": e[15] || (e[15] = (a) => v("update:activeConversation", a))
440
+ }, null, 8, ["model-value", "conversations"]),
441
+ l.contextItems.length ? (h(), g("section", gt, [
442
+ e[25] || (e[25] = u("h3", null, "上下文", -1)),
443
+ u("div", yt, [
444
+ (h(!0), g(Ze, null, qe(he.value, (a, o) => (h(), g("div", {
445
+ key: T(a).id,
446
+ class: "aheart-ai-workbench__context-item",
447
+ "data-context-id": T(a).id
448
+ }, [
449
+ u("span", null, $(T(a).label), 1),
450
+ T(a).description ? (h(), g("small", It, $(T(a).description), 1)) : C("", !0),
451
+ u("div", $t, [
452
+ m(y(N), {
453
+ type: "text",
454
+ disabled: H(o, -1),
455
+ onClick: (r) => q(o, -1)
456
+ }, {
457
+ default: k(() => [...e[23] || (e[23] = [
458
+ P("上移", -1)
459
+ ])]),
460
+ _: 1
461
+ }, 8, ["disabled", "onClick"]),
462
+ m(y(N), {
463
+ type: "text",
464
+ disabled: H(o, 1),
465
+ onClick: (r) => q(o, 1)
466
+ }, {
467
+ default: k(() => [...e[24] || (e[24] = [
468
+ P("下移", -1)
469
+ ])]),
470
+ _: 1
471
+ }, 8, ["disabled", "onClick"])
472
+ ])
473
+ ], 8, wt))), 128))
474
+ ])
475
+ ])) : C("", !0)
476
+ ], 512), [
477
+ [se, j.value === "conversations"]
478
+ ]),
479
+ oe(u("section", Ct, [
480
+ u("div", xt, [
481
+ u("div", {
482
+ id: `${Q.value}-chat-target`,
483
+ ref_key: "mobileChatTarget",
484
+ ref: W,
485
+ class: "aheart-ai-workbench__mobile-owner-target"
486
+ }, null, 8, St)
487
+ ]),
488
+ l.transport ? C("", !0) : (h(), g("p", At, "业务层尚未提供对话传输适配器。")),
489
+ _(t.$slots, "sources", { sources: l.sources }, () => [
490
+ m(Se, { sources: l.sources }, null, 8, ["sources"])
491
+ ]),
492
+ _(t.$slots, "attachments", { attachments: l.attachments }, () => [
493
+ m(Ce, { items: l.attachments }, null, 8, ["items"])
494
+ ])
495
+ ], 512), [
496
+ [se, j.value === "chat"]
497
+ ]),
498
+ oe(u("section", Tt, [
499
+ m(y(N), {
500
+ "data-action": "open-execution-drawer",
501
+ type: "primary",
502
+ onClick: e[16] || (e[16] = (a) => D.value = !0)
503
+ }, {
504
+ default: k(() => [...e[26] || (e[26] = [
505
+ P("查看执行与产物", -1)
506
+ ])]),
507
+ _: 1
508
+ })
509
+ ], 512), [
510
+ [se, j.value === "execution"]
511
+ ]),
512
+ m(y(Xe), {
513
+ open: D.value,
514
+ "onUpdate:open": e[17] || (e[17] = (a) => D.value = a),
515
+ title: "执行与产物",
516
+ "get-container": !1,
517
+ "force-render": re.value,
518
+ "destroy-on-close": !1,
519
+ placement: "right"
520
+ }, {
521
+ default: k(() => [
522
+ u("div", {
523
+ id: ie,
524
+ ref_key: "mobileExecutionTarget",
525
+ ref: G,
526
+ class: "aheart-ai-workbench__mobile-owner-target"
527
+ }, null, 512)
528
+ ]),
529
+ _: 1
530
+ }, 8, ["open", "force-render"])
531
+ ])
532
+ ]));
533
+ }
534
+ });
535
+ export {
536
+ Ut as default
537
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./agent-workbench.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,39 @@
1
+ import type { AIAttachment } from './types';
2
+ declare const _default: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ items?: AIAttachment[] | undefined;
4
+ removable?: boolean | undefined;
5
+ }>, {
6
+ items: () => never[];
7
+ removable: boolean;
8
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
9
+ remove: (item: AIAttachment) => void;
10
+ }, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
11
+ items?: AIAttachment[] | undefined;
12
+ removable?: boolean | undefined;
13
+ }>, {
14
+ items: () => never[];
15
+ removable: boolean;
16
+ }>>> & Readonly<{
17
+ onRemove?: ((item: AIAttachment) => any) | undefined;
18
+ }>, {
19
+ items: AIAttachment[];
20
+ removable: boolean;
21
+ }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
22
+ export default _default;
23
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
+ type __VLS_TypePropsToRuntimeProps<T> = {
25
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
26
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
+ } : {
28
+ type: import('vue').PropType<T[K]>;
29
+ required: true;
30
+ };
31
+ };
32
+ type __VLS_WithDefaults<P, D> = {
33
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
+ default: D[K];
35
+ }> : P[K];
36
+ };
37
+ type __VLS_Prettify<T> = {
38
+ [K in keyof T]: T[K];
39
+ } & {};
@@ -0,0 +1,39 @@
1
+ import { defineComponent as i, openBlock as t, createElementBlock as a, Fragment as u, renderList as f, unref as r, toDisplayString as o, createCommentVNode as l } from "vue";
2
+ import { getSafeUrl as s } from "./safe-markdown.js";
3
+ const h = {
4
+ key: 0,
5
+ class: "aheart-ai-attachments",
6
+ "aria-label": "附件"
7
+ }, d = ["href"], _ = { key: 1 }, k = ["aria-label", "onClick"], C = /* @__PURE__ */ i({
8
+ name: "AAIAttachments",
9
+ __name: "attachments",
10
+ props: {
11
+ items: { default: () => [] },
12
+ removable: { type: Boolean, default: !1 }
13
+ },
14
+ emits: ["remove"],
15
+ setup(n, { emit: m }) {
16
+ const c = m;
17
+ return (b, p) => n.items.length ? (t(), a("ul", h, [
18
+ (t(!0), a(u, null, f(n.items, (e) => (t(), a("li", {
19
+ key: e.id
20
+ }, [
21
+ r(s)(e.url) ? (t(), a("a", {
22
+ key: 0,
23
+ href: r(s)(e.url),
24
+ target: "_blank",
25
+ rel: "noreferrer"
26
+ }, o(e.name), 9, d)) : (t(), a("span", _, o(e.name), 1)),
27
+ n.removable ? (t(), a("button", {
28
+ key: 2,
29
+ type: "button",
30
+ "aria-label": `移除 ${e.name}`,
31
+ onClick: (y) => c("remove", e)
32
+ }, "移除", 8, k)) : l("", !0)
33
+ ]))), 128))
34
+ ])) : l("", !0);
35
+ }
36
+ });
37
+ export {
38
+ C as default
39
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./attachments.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,27 @@
1
+ import type { AIContentRenderer, AIMessage } from './types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ message: AIMessage;
4
+ contentRenderer?: AIContentRenderer | undefined;
5
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ message: AIMessage;
7
+ contentRenderer?: AIContentRenderer | undefined;
8
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>, {
9
+ actions?(_: {
10
+ message: AIMessage;
11
+ }): any;
12
+ }>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: import('vue').PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
23
+ type __VLS_WithTemplateSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };