@qfei-design/make-ai-assistant 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.mjs CHANGED
@@ -1,98 +1,98 @@
1
- import { jsxs as r, jsx as t, Fragment as C } from "react/jsx-runtime";
2
- import { resolveArtifactTemplate as Se, createArtifactTemplateRegistry as fe, createArtifactCapabilities as xe } from "./index.mjs";
3
- import { extendArtifactTemplateRegistry as ca } from "./index.mjs";
4
- import { useState as V, useRef as E, useMemo as Fe, useEffect as ae } from "react";
5
- import { a as X, c as se, M as w, b as De, p as Pe, r as ee } from "./conversation-Dy2Sghjv.js";
6
- import { d as ma, e as ua, f as pa, g as ha, v as fa } from "./conversation-Dy2Sghjv.js";
7
- function Ke({
1
+ import { jsxs as n, jsx as t, Fragment as L } from "react/jsx-runtime";
2
+ import { resolveArtifactTemplate as ia, createArtifactTemplateRegistry as Pe, createArtifactCapabilities as oa } from "./index.mjs";
3
+ import { extendArtifactTemplateRegistry as Ga } from "./index.mjs";
4
+ import { useState as E, useRef as S, useMemo as Fe, useEffect as ge } from "react";
5
+ import { a as ue, r as pe, c as he, M as A, b as ca, p as la } from "./conversation-B7eGUXi-.js";
6
+ import { d as ja, e as Ya, f as Ja, g as Qa, v as Wa } from "./conversation-B7eGUXi-.js";
7
+ function da({
8
8
  artifact: e,
9
9
  context: a,
10
10
  fallback: s,
11
11
  onAction: c,
12
- onActionError: n,
13
- registry: l
12
+ onActionError: o,
13
+ registry: d
14
14
  }) {
15
- const u = Se(l, e, a);
16
- if (!u)
17
- return s ? s(e) : /* @__PURE__ */ r("section", { className: "make-ai-artifact make-ai-artifact--unsupported", role: "status", children: [
15
+ const m = ia(d, e, a);
16
+ if (!m)
17
+ return s ? s(e) : /* @__PURE__ */ n("section", { className: "make-ai-artifact make-ai-artifact--unsupported", role: "status", children: [
18
18
  /* @__PURE__ */ t("strong", { children: "暂不支持展示此结果" }),
19
- /* @__PURE__ */ r("span", { children: [
19
+ /* @__PURE__ */ n("span", { children: [
20
20
  "结果类型:",
21
21
  e.kind
22
22
  ] })
23
23
  ] });
24
- const p = {
24
+ const h = {
25
25
  context: a,
26
26
  onAction: c,
27
- onActionError: n
27
+ onActionError: o
28
28
  };
29
- return u.template.render(e, a, p);
29
+ return m.template.render(e, a, h);
30
30
  }
31
- const $ = (e, a, s) => {
31
+ const D = (e, a, s) => {
32
32
  if (e == null || e === "") return "—";
33
33
  if (typeof e == "boolean") return e ? "是" : "否";
34
34
  if (typeof e != "number") return `${e}${a?.unit ?? ""}`;
35
- const c = a?.precision, n = {
35
+ const c = a?.precision, o = {
36
36
  maximumFractionDigits: c ?? 2,
37
37
  minimumFractionDigits: c
38
38
  };
39
- a?.style === "currency" && a.currency ? (n.style = "currency", n.currency = a.currency) : a?.style === "percent" && (n.style = "percent");
39
+ a?.style === "currency" && a.currency ? (o.style = "currency", o.currency = a.currency) : a?.style === "percent" && (o.style = "percent");
40
40
  try {
41
- const l = a?.style === "percent" ? e / 100 : e;
42
- return `${new Intl.NumberFormat(s, n).format(l)}${a?.unit ?? ""}`;
41
+ const d = a?.style === "percent" ? e / 100 : e;
42
+ return `${new Intl.NumberFormat(s, o).format(d)}${a?.unit ?? ""}`;
43
43
  } catch {
44
44
  return `${e}${a?.unit ?? ""}`;
45
45
  }
46
- }, ge = (e) => {
46
+ }, Ue = (e) => {
47
47
  let a = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
48
48
  for (const c of e)
49
49
  a = Math.min(a, c), s = Math.max(s, c);
50
50
  return Number.isFinite(a) && Number.isFinite(s) ? { min: a, max: s } : { min: 0, max: 0 };
51
- }, _e = (e, a, s) => {
51
+ }, qe = (e, a, s) => {
52
52
  if (!s.onAction) return;
53
- const c = (l) => {
53
+ const c = (d) => {
54
54
  console.error("[make-ai-assistant] host action error handler failed", {
55
55
  actionId: e.id,
56
56
  artifactId: a.artifact.id,
57
- errorType: l instanceof Error ? l.name : typeof l,
57
+ errorType: d instanceof Error ? d.name : typeof d,
58
58
  intent: e.intent
59
59
  });
60
- }, n = (l) => {
60
+ }, o = (d) => {
61
61
  if (s.onActionError) {
62
62
  try {
63
63
  Promise.resolve(
64
- s.onActionError(l, e, a)
64
+ s.onActionError(d, e, a)
65
65
  ).catch(c);
66
- } catch (u) {
67
- c(u);
66
+ } catch (m) {
67
+ c(m);
68
68
  }
69
69
  return;
70
70
  }
71
71
  console.error("[make-ai-assistant] host action failed", {
72
72
  actionId: e.id,
73
73
  artifactId: a.artifact.id,
74
- errorType: l instanceof Error ? l.name : typeof l,
74
+ errorType: d instanceof Error ? d.name : typeof d,
75
75
  intent: e.intent
76
76
  });
77
77
  };
78
78
  try {
79
- Promise.resolve(s.onAction(e, a)).catch(n);
80
- } catch (l) {
81
- n(l);
79
+ Promise.resolve(s.onAction(e, a)).catch(o);
80
+ } catch (d) {
81
+ o(d);
82
82
  }
83
- }, L = (e, a) => e.actions?.length && a.onAction ? /* @__PURE__ */ t("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */ r(
83
+ }, J = (e, a) => e.actions?.length && a.onAction ? /* @__PURE__ */ t("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */ n(
84
84
  "button",
85
85
  {
86
86
  className: `make-ai-artifact__action make-ai-artifact__action--${s.appearance ?? "link"}`,
87
87
  type: "button",
88
- onClick: () => _e(s, { artifact: e, context: a.context }, a),
88
+ onClick: () => qe(s, { artifact: e, context: a.context }, a),
89
89
  children: [
90
90
  s.label,
91
91
  /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "→" })
92
92
  ]
93
93
  },
94
94
  s.id
95
- )) }) : null, z = (e, a, s = "") => /* @__PURE__ */ r(
95
+ )) }) : null, Q = (e, a, s = "") => /* @__PURE__ */ n(
96
96
  "section",
97
97
  {
98
98
  "aria-label": e.title ?? `${e.kind} result`,
@@ -105,24 +105,24 @@ const $ = (e, a, s) => {
105
105
  a
106
106
  ]
107
107
  }
108
- ), Ve = ({
108
+ ), ma = ({
109
109
  artifact: e,
110
110
  renderContext: a
111
111
  }) => {
112
- const s = e.data.delta, c = s ? $(
112
+ const s = e.data.delta, c = s ? D(
113
113
  s.value,
114
114
  s.format === "percent" ? { style: "percent" } : void 0,
115
115
  a.context.locale
116
116
  ) : void 0;
117
- return z(
117
+ return Q(
118
118
  e,
119
- /* @__PURE__ */ r(C, { children: [
120
- /* @__PURE__ */ t("div", { className: "make-ai-artifact__metric-value", children: $(
119
+ /* @__PURE__ */ n(L, { children: [
120
+ /* @__PURE__ */ t("div", { className: "make-ai-artifact__metric-value", children: D(
121
121
  e.data.value,
122
122
  e.data.format,
123
123
  a.context.locale
124
124
  ) }),
125
- s ? /* @__PURE__ */ r(
125
+ s ? /* @__PURE__ */ n(
126
126
  "div",
127
127
  {
128
128
  className: `make-ai-artifact__delta make-ai-artifact__delta--${s.direction ?? "flat"}`,
@@ -134,108 +134,108 @@ const $ = (e, a, s) => {
134
134
  }
135
135
  ) : null,
136
136
  e.data.context ? /* @__PURE__ */ t("p", { className: "make-ai-artifact__context", children: e.data.context }) : null,
137
- L(e, a)
137
+ J(e, a)
138
138
  ] }),
139
139
  "make-ai-artifact--metric"
140
140
  );
141
- }, qe = ({
141
+ }, ua = ({
142
142
  artifact: e,
143
143
  renderContext: a
144
- }) => z(
144
+ }) => Q(
145
145
  e,
146
- /* @__PURE__ */ r(C, { children: [
147
- /* @__PURE__ */ t("div", { className: "make-ai-artifact__comparison", children: e.data.items.map((s) => /* @__PURE__ */ r("div", { className: "make-ai-artifact__comparison-item", children: [
146
+ /* @__PURE__ */ n(L, { children: [
147
+ /* @__PURE__ */ t("div", { className: "make-ai-artifact__comparison", children: e.data.items.map((s) => /* @__PURE__ */ n("div", { className: "make-ai-artifact__comparison-item", children: [
148
148
  /* @__PURE__ */ t("span", { children: s.label }),
149
- /* @__PURE__ */ t("strong", { children: $(s.value, s.format, a.context.locale) }),
149
+ /* @__PURE__ */ t("strong", { children: D(s.value, s.format, a.context.locale) }),
150
150
  s.hint ? /* @__PURE__ */ t("small", { children: s.hint }) : null
151
151
  ] }, s.id)) }),
152
- L(e, a)
152
+ J(e, a)
153
153
  ] }),
154
154
  "make-ai-artifact--comparison"
155
- ), Le = ({
155
+ ), pa = ({
156
156
  artifact: e,
157
157
  renderContext: a
158
158
  }) => {
159
- const s = e.data.series.flatMap((u) => u.points.map((p) => p.y)), { max: c, min: n } = ge(s), l = c - n || 1;
160
- return z(
159
+ const s = e.data.series.flatMap((m) => m.points.map((h) => h.y)), { max: c, min: o } = Ue(s), d = c - o || 1;
160
+ return Q(
161
161
  e,
162
- /* @__PURE__ */ r(C, { children: [
163
- /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend", children: e.data.series.map((u) => /* @__PURE__ */ r("div", { className: "make-ai-artifact__trend-series", children: [
164
- /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend-label", children: u.label }),
165
- /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend-bars", children: u.points.map((p, A) => {
166
- const f = 18 + (p.y - n) / l * 70;
167
- return /* @__PURE__ */ r("div", { className: "make-ai-artifact__trend-point", children: [
162
+ /* @__PURE__ */ n(L, { children: [
163
+ /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend", children: e.data.series.map((m) => /* @__PURE__ */ n("div", { className: "make-ai-artifact__trend-series", children: [
164
+ /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend-label", children: m.label }),
165
+ /* @__PURE__ */ t("div", { className: "make-ai-artifact__trend-bars", children: m.points.map((h, $) => {
166
+ const y = 18 + (h.y - o) / d * 70;
167
+ return /* @__PURE__ */ n("div", { className: "make-ai-artifact__trend-point", children: [
168
168
  /* @__PURE__ */ t(
169
169
  "span",
170
170
  {
171
- "aria-label": `${p.x}: ${$(
172
- p.y,
173
- u.format,
171
+ "aria-label": `${h.x}: ${D(
172
+ h.y,
173
+ m.format,
174
174
  a.context.locale
175
175
  )}`,
176
176
  className: "make-ai-artifact__trend-bar",
177
177
  role: "img",
178
- style: { height: `${f}%` },
179
- title: `${p.x}: ${$(
180
- p.y,
181
- u.format,
178
+ style: { height: `${y}%` },
179
+ title: `${h.x}: ${D(
180
+ h.y,
181
+ m.format,
182
182
  a.context.locale
183
183
  )}`
184
184
  }
185
185
  ),
186
- /* @__PURE__ */ t("small", { children: p.x })
187
- ] }, `${p.x}-${A}`);
186
+ /* @__PURE__ */ t("small", { children: h.x })
187
+ ] }, `${h.x}-${$}`);
188
188
  }) })
189
- ] }, u.id)) }),
190
- L(e, a)
189
+ ] }, m.id)) }),
190
+ J(e, a)
191
191
  ] }),
192
192
  "make-ai-artifact--trend"
193
193
  );
194
- }, ze = ({
194
+ }, ha = ({
195
195
  artifact: e,
196
196
  renderContext: a
197
197
  }) => {
198
- const { max: s } = ge(
199
- e.data.items.map((n) => Math.abs(n.value))
198
+ const { max: s } = Ue(
199
+ e.data.items.map((o) => Math.abs(o.value))
200
200
  ), c = Math.max(s, 1);
201
- return z(
201
+ return Q(
202
202
  e,
203
- /* @__PURE__ */ r(C, { children: [
204
- /* @__PURE__ */ t("ol", { className: "make-ai-artifact__ranking", children: e.data.items.map((n, l) => /* @__PURE__ */ r("li", { children: [
205
- /* @__PURE__ */ t("span", { className: "make-ai-artifact__rank", children: l + 1 }),
206
- /* @__PURE__ */ r("span", { className: "make-ai-artifact__ranking-label", children: [
207
- /* @__PURE__ */ t("span", { children: n.label }),
208
- n.description ? /* @__PURE__ */ t("small", { children: n.description }) : null
203
+ /* @__PURE__ */ n(L, { children: [
204
+ /* @__PURE__ */ t("ol", { className: "make-ai-artifact__ranking", children: e.data.items.map((o, d) => /* @__PURE__ */ n("li", { children: [
205
+ /* @__PURE__ */ t("span", { className: "make-ai-artifact__rank", children: d + 1 }),
206
+ /* @__PURE__ */ n("span", { className: "make-ai-artifact__ranking-label", children: [
207
+ /* @__PURE__ */ t("span", { children: o.label }),
208
+ o.description ? /* @__PURE__ */ t("small", { children: o.description }) : null
209
209
  ] }),
210
- /* @__PURE__ */ t("span", { className: "make-ai-artifact__ranking-track", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { style: { width: `${Math.abs(n.value) / c * 100}%` } }) }),
211
- /* @__PURE__ */ t("strong", { children: $(n.value, n.format, a.context.locale) })
212
- ] }, n.id)) }),
213
- L(e, a)
210
+ /* @__PURE__ */ t("span", { className: "make-ai-artifact__ranking-track", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { style: { width: `${Math.abs(o.value) / c * 100}%` } }) }),
211
+ /* @__PURE__ */ t("strong", { children: D(o.value, o.format, a.context.locale) })
212
+ ] }, o.id)) }),
213
+ J(e, a)
214
214
  ] }),
215
215
  "make-ai-artifact--ranking"
216
216
  );
217
- }, He = (e, a) => a.action ?? {
217
+ }, ga = (e, a) => a.action ?? {
218
218
  id: `open-${a.id}`,
219
219
  label: a.title ?? a.id,
220
220
  intent: "open-record",
221
221
  target: { entityKey: e.data.entity.key, recordId: a.id }
222
- }, Be = ({
222
+ }, fa = ({
223
223
  artifact: e,
224
224
  renderContext: a
225
- }) => z(
225
+ }) => Q(
226
226
  e,
227
- /* @__PURE__ */ r(C, { children: [
227
+ /* @__PURE__ */ n(L, { children: [
228
228
  /* @__PURE__ */ t("div", { className: "make-ai-artifact__record-list", children: e.data.records.length === 0 ? /* @__PURE__ */ t("p", { className: "make-ai-artifact__empty", children: "没有符合条件的记录" }) : e.data.records.map((s) => {
229
- const c = He(e, s), n = /* @__PURE__ */ r(C, { children: [
229
+ const c = ga(e, s), o = /* @__PURE__ */ n(L, { children: [
230
230
  /* @__PURE__ */ t("strong", { children: s.title ?? s.id }),
231
- /* @__PURE__ */ t("span", { className: "make-ai-artifact__record-values", children: e.data.columns.map((l) => /* @__PURE__ */ r("span", { children: [
232
- /* @__PURE__ */ t("small", { children: l.label }),
233
- $(
234
- s.values[l.key],
235
- l.format,
231
+ /* @__PURE__ */ t("span", { className: "make-ai-artifact__record-values", children: e.data.columns.map((d) => /* @__PURE__ */ n("span", { children: [
232
+ /* @__PURE__ */ t("small", { children: d.label }),
233
+ D(
234
+ s.values[d.key],
235
+ d.format,
236
236
  a.context.locale
237
237
  )
238
- ] }, l.key)) }),
238
+ ] }, d.key)) }),
239
239
  a.onAction ? /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "›" }) : null
240
240
  ] });
241
241
  return a.onAction ? /* @__PURE__ */ t(
@@ -243,47 +243,51 @@ const $ = (e, a, s) => {
243
243
  {
244
244
  className: "make-ai-artifact__record",
245
245
  type: "button",
246
- onClick: () => _e(c, {
246
+ onClick: () => qe(c, {
247
247
  artifact: e,
248
248
  context: a.context
249
249
  }, a),
250
- children: n
250
+ children: o
251
251
  },
252
252
  s.id
253
- ) : /* @__PURE__ */ t("div", { className: "make-ai-artifact__record", children: n }, s.id);
253
+ ) : /* @__PURE__ */ t("div", { className: "make-ai-artifact__record", children: o }, s.id);
254
254
  }) }),
255
- e.data.total !== void 0 ? /* @__PURE__ */ r("p", { className: "make-ai-artifact__record-total", children: [
255
+ e.data.total !== void 0 ? /* @__PURE__ */ n("p", { className: "make-ai-artifact__record-total", children: [
256
256
  "共 ",
257
257
  e.data.total,
258
258
  " 条"
259
259
  ] }) : null,
260
- L(e, a)
260
+ J(e, a)
261
261
  ] }),
262
262
  "make-ai-artifact--record-list"
263
- ), Oe = ({
263
+ ), _a = ({
264
264
  artifact: e,
265
265
  renderContext: a
266
- }) => z(
266
+ }) => Q(
267
267
  e,
268
- /* @__PURE__ */ r(C, { children: [
269
- /* @__PURE__ */ r("div", { className: `make-ai-artifact__notice make-ai-artifact__notice--${e.data.tone}`, children: [
268
+ /* @__PURE__ */ n(L, { children: [
269
+ /* @__PURE__ */ n("div", { className: `make-ai-artifact__notice make-ai-artifact__notice--${e.data.tone}`, children: [
270
270
  /* @__PURE__ */ t("span", { "aria-hidden": "true", children: e.data.tone === "success" ? "✓" : e.data.tone === "warning" ? "!" : e.data.tone === "danger" ? "×" : "i" }),
271
271
  /* @__PURE__ */ t("p", { children: e.data.body })
272
272
  ] }),
273
- L(e, a)
273
+ J(e, a)
274
274
  ] }),
275
275
  "make-ai-artifact--notice"
276
- ), K = (e, a, s) => ({ id: e, kinds: [a], priority: 0, render: s }), Ue = [
277
- K("platform.metric.default", "metric", (e, a, s) => /* @__PURE__ */ t(Ve, { artifact: e, renderContext: s })),
278
- K("platform.comparison.default", "comparison", (e, a, s) => /* @__PURE__ */ t(qe, { artifact: e, renderContext: s })),
279
- K("platform.trend.default", "trend", (e, a, s) => /* @__PURE__ */ t(Le, { artifact: e, renderContext: s })),
280
- K("platform.ranking.default", "ranking", (e, a, s) => /* @__PURE__ */ t(ze, { artifact: e, renderContext: s })),
281
- K("platform.record-list.default", "record-list", (e, a, s) => /* @__PURE__ */ t(Be, { artifact: e, renderContext: s })),
282
- K("platform.notice.default", "notice", (e, a, s) => /* @__PURE__ */ t(Oe, { artifact: e, renderContext: s }))
283
- ], Ze = fe(Ue).templates, je = (e = Ze) => fe(e), Ye = (e) => `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
284
- class h extends Error {
276
+ ), Y = (e, a, s) => ({ id: e, kinds: [a], priority: 0, render: s }), va = [
277
+ Y("platform.metric.default", "metric", (e, a, s) => /* @__PURE__ */ t(ma, { artifact: e, renderContext: s })),
278
+ Y("platform.comparison.default", "comparison", (e, a, s) => /* @__PURE__ */ t(ua, { artifact: e, renderContext: s })),
279
+ Y("platform.trend.default", "trend", (e, a, s) => /* @__PURE__ */ t(pa, { artifact: e, renderContext: s })),
280
+ Y("platform.ranking.default", "ranking", (e, a, s) => /* @__PURE__ */ t(ha, { artifact: e, renderContext: s })),
281
+ Y("platform.record-list.default", "record-list", (e, a, s) => /* @__PURE__ */ t(fa, { artifact: e, renderContext: s })),
282
+ Y("platform.notice.default", "notice", (e, a, s) => /* @__PURE__ */ t(_a, { artifact: e, renderContext: s }))
283
+ ], ka = Pe(va).templates, ya = (e = ka) => Pe(e), Aa = (e) => `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, ba = "Make", Ia = [
284
+ "总结当前页面数据",
285
+ "找出需要关注的记录",
286
+ "列出我有权限查看的数据对象"
287
+ ], Ke = (e, a) => a ?? `${e?.trim() || ba} AI 助手`, Na = (e) => e ?? Ia;
288
+ class u extends Error {
285
289
  }
286
- const pe = (e) => {
290
+ const Le = (e) => {
287
291
  try {
288
292
  const a = e?.return?.();
289
293
  if (!a) return;
@@ -297,33 +301,71 @@ const pe = (e) => {
297
301
  errorType: a instanceof Error ? a.name : typeof a
298
302
  });
299
303
  }
300
- }, ke = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
304
+ }, wa = async (e) => {
305
+ if (globalThis.navigator?.clipboard?.writeText) {
306
+ await globalThis.navigator.clipboard.writeText(e);
307
+ return;
308
+ }
309
+ if (typeof document > "u" || !document.body)
310
+ throw new Error("Clipboard API is unavailable");
311
+ const a = document.createElement("textarea");
312
+ a.value = e, a.setAttribute("readonly", ""), a.style.position = "fixed", a.style.inset = "0 auto auto 0", a.style.opacity = "0", document.body.append(a), a.select();
313
+ const s = document.execCommand("copy");
314
+ if (a.remove(), !s)
315
+ throw new Error("Clipboard copy failed");
316
+ }, Be = () => /* @__PURE__ */ n("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
301
317
  /* @__PURE__ */ t("path", { d: "M12 2.8c.5 4.4 2.8 6.8 7.2 7.2-4.4.5-6.8 2.8-7.2 7.2-.5-4.4-2.8-6.8-7.2-7.2 4.4-.5 6.8-2.8 7.2-7.2Z" }),
302
318
  /* @__PURE__ */ t("path", { d: "M18.3 16.1c.2 1.8 1.2 2.8 3 3-1.8.2-2.8 1.2-3 3-.2-1.8-1.2-2.8-3-3 1.8-.2 2.8-1.2 3-3Z" })
303
- ] }), Ge = () => /* @__PURE__ */ t("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { d: "m6 6 12 12M18 6 6 18" }) }), Je = () => /* @__PURE__ */ t("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { d: "M12 5v14M5 12h14" }) }), Qe = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
319
+ ] }), Ta = () => /* @__PURE__ */ t("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { d: "m6 6 12 12M18 6 6 18" }) }), Ma = () => /* @__PURE__ */ t("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { d: "M12 5v14M5 12h14" }) }), Ca = () => /* @__PURE__ */ n("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
304
320
  /* @__PURE__ */ t("path", { d: "m4 4 17 8-17 8 3-8-3-8Z" }),
305
321
  /* @__PURE__ */ t("path", { d: "M7 12h14" })
306
- ] }), q = () => /* @__PURE__ */ t("span", { className: "make-ai-assistant__avatar", "aria-hidden": "true", children: /* @__PURE__ */ t(ke, {}) }), ve = (e) => {
322
+ ] }), ae = ({ className: e = "" }) => /* @__PURE__ */ t("span", { className: `make-ai-assistant__avatar ${e}`.trim(), "aria-hidden": "true", children: /* @__PURE__ */ t(Be, {}) }), Ea = ({ src: e }) => e ? /* @__PURE__ */ t("span", { className: "make-ai-assistant__user-avatar", "aria-hidden": "true", children: /* @__PURE__ */ t("img", { alt: "", src: e }) }) : null, Ve = ({ assistantName: e }) => /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-identity", children: [
323
+ /* @__PURE__ */ t(ae, { className: "make-ai-assistant__avatar--message" }),
324
+ /* @__PURE__ */ t("span", { className: "make-ai-assistant__message-sender", children: e })
325
+ ] }), He = (e) => {
307
326
  for (let a = e.messages.length - 1; a >= 0; a -= 1) {
308
327
  const s = e.messages[a];
309
328
  if (s.role === "assistant" && s.status === "streaming")
310
329
  return s.id;
311
330
  }
312
- }, We = (e) => {
331
+ }, Sa = (e) => {
313
332
  for (let a = e.messages.length - 1; a >= 0; a -= 1)
314
333
  if (e.messages[a].role === "user") return a;
315
334
  return -1;
316
- }, ye = (e) => {
317
- const a = We(e);
335
+ }, Oe = (e) => {
336
+ const a = Sa(e);
318
337
  if (!(a < 0))
319
338
  for (let s = e.messages.length - 1; s > a; s -= 1) {
320
339
  const c = e.messages[s];
321
340
  if (c.role === "assistant") return c.id;
322
341
  }
323
- }, Ie = ({
342
+ }, $a = (e) => {
343
+ if (e.status === "idle")
344
+ for (let a = e.messages.length - 1; a >= 0; a -= 1) {
345
+ const s = e.messages[a];
346
+ if (s.role === "assistant" && s.status === "complete")
347
+ return s.id;
348
+ }
349
+ }, Ra = (e) => {
350
+ for (let a = e.messages.length - 1; a >= 0; a -= 1) {
351
+ const s = e.messages[a];
352
+ if (s.role === "user") return s;
353
+ }
354
+ }, xa = (e, a) => {
355
+ const s = e.messages.findIndex(
356
+ (c) => c.id === a && c.role === "user"
357
+ );
358
+ return {
359
+ ...e,
360
+ error: void 0,
361
+ progress: void 0,
362
+ status: "streaming",
363
+ messages: s < 0 ? e.messages : e.messages.slice(0, s + 1)
364
+ };
365
+ }, Fa = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= 48, La = (e = "smooth") => globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : e, ze = ({
324
366
  error: e,
325
367
  onRetry: a
326
- }) => /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-status make-ai-assistant__message-status--error", role: "alert", children: [
368
+ }) => /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-status make-ai-assistant__message-status--error", role: "alert", children: [
327
369
  /* @__PURE__ */ t("strong", { children: "本次请求未完成" }),
328
370
  /* @__PURE__ */ t("span", { children: e.message }),
329
371
  e.retryable && a ? /* @__PURE__ */ t(
@@ -335,316 +377,438 @@ const pe = (e) => {
335
377
  children: "重新发送"
336
378
  }
337
379
  ) : null
338
- ] }), he = ({
380
+ ] }), Ge = ({
381
+ active: e,
382
+ steps: a
383
+ }) => {
384
+ if (!a?.length) return null;
385
+ const s = a[a.length - 1] ?? "处理中";
386
+ return /* @__PURE__ */ n("details", { className: "make-ai-assistant__process", open: e, children: [
387
+ /* @__PURE__ */ n("summary", { children: [
388
+ e ? /* @__PURE__ */ n("span", { className: "make-ai-assistant__progress", role: "status", children: [
389
+ /* @__PURE__ */ t("span", { "aria-hidden": "true" }),
390
+ /* @__PURE__ */ t("span", { children: s })
391
+ ] }) : /* @__PURE__ */ t("span", { className: "make-ai-assistant__process-title", children: "处理过程" }),
392
+ /* @__PURE__ */ n("span", { className: "make-ai-assistant__process-count", children: [
393
+ a.length,
394
+ " 步"
395
+ ] })
396
+ ] }),
397
+ /* @__PURE__ */ t("ol", { children: a.map((c, o) => /* @__PURE__ */ n(
398
+ "li",
399
+ {
400
+ "data-step-active": e && o === a.length - 1 ? !0 : void 0,
401
+ children: [
402
+ /* @__PURE__ */ t("span", { "aria-hidden": "true" }),
403
+ /* @__PURE__ */ t("span", { children: c })
404
+ ]
405
+ },
406
+ `${o}-${c}`
407
+ )) })
408
+ ] });
409
+ }, Da = ({
410
+ copyFeedback: e,
411
+ onCopy: a,
412
+ onRegenerate: s
413
+ }) => !a && !s ? null : /* @__PURE__ */ n("div", { className: "make-ai-assistant__reply-actions", "aria-label": "回复操作", children: [
414
+ a ? /* @__PURE__ */ t("button", { type: "button", onClick: a, children: "复制回答" }) : null,
415
+ s ? /* @__PURE__ */ t("button", { type: "button", onClick: s, children: "重新生成" }) : null,
416
+ e ? /* @__PURE__ */ t(
417
+ "span",
418
+ {
419
+ className: "make-ai-assistant__reply-feedback",
420
+ "data-copy-status": e.status,
421
+ role: "status",
422
+ children: e.message
423
+ }
424
+ ) : null
425
+ ] }), De = ({
339
426
  assistantName: e,
340
427
  error: a,
341
428
  onRetry: s,
342
429
  progress: c
343
430
  }) => {
344
- const n = a ? "error" : "progress", l = a?.message ?? c;
345
- return l ? /* @__PURE__ */ r(
431
+ const o = a ? "error" : "progress";
432
+ return a?.message ?? c?.message ? /* @__PURE__ */ t(
346
433
  "article",
347
434
  {
348
- "aria-label": `${e}的${n === "error" ? "错误消息" : "状态消息"}`,
349
- className: `make-ai-assistant__message make-ai-assistant__message--assistant make-ai-assistant__message--${n}`,
435
+ "aria-label": `${e}的${o === "error" ? "错误消息" : "状态消息"}`,
436
+ className: `make-ai-assistant__message make-ai-assistant__message--assistant make-ai-assistant__message--${o}`,
350
437
  "data-message-role": "assistant",
351
- "data-message-state": n,
352
- children: [
353
- /* @__PURE__ */ t(q, {}),
354
- /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-stack", children: [
355
- /* @__PURE__ */ t("span", { className: "make-ai-assistant__message-sender", children: e }),
356
- a ? /* @__PURE__ */ t(Ie, { error: a, onRetry: s }) : /* @__PURE__ */ r("div", { className: "make-ai-assistant__progress", role: "status", children: [
357
- /* @__PURE__ */ t("span", { "aria-hidden": "true" }),
358
- /* @__PURE__ */ t("span", { children: l })
359
- ] })
360
- ] })
361
- ]
438
+ "data-message-state": o,
439
+ children: /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-turn", children: [
440
+ /* @__PURE__ */ t(Ve, { assistantName: e }),
441
+ /* @__PURE__ */ t("div", { className: "make-ai-assistant__message-stack", children: a ? /* @__PURE__ */ t(ze, { error: a, onRetry: s }) : /* @__PURE__ */ t(Ge, { active: !0, steps: c?.steps }) })
442
+ ] })
362
443
  }
363
444
  ) : null;
364
- }, Xe = (e, a, s, c, n, l, u, p) => {
365
- const A = ye(e), f = ve(e);
366
- return e.messages.map((d) => {
367
- const T = d.role === "assistant", _ = d.id === f, b = d.id === A && e.error, m = T ? l : p;
368
- return /* @__PURE__ */ r(
445
+ }, Pa = (e, a, s, c, o, d, m, h, $, y, k, f, P) => {
446
+ const N = Oe(e), U = He(e), R = $a(e);
447
+ let x;
448
+ return e.messages.map((i) => {
449
+ const _ = i.role === "assistant", q = x;
450
+ _ || (x = i);
451
+ const K = i.id === U, w = i.id === N ? e.error : void 0, B = i.error ?? w, T = _ ? d : h, fe = _ && i.status === "complete" && !B && (i.content.trim() || i.id === R);
452
+ return /* @__PURE__ */ t(
369
453
  "article",
370
454
  {
371
- "aria-label": `${m}的消息`,
372
- className: `make-ai-assistant__message make-ai-assistant__message--${d.role}`,
373
- "data-message-role": d.role,
374
- "data-message-state": b ? "error" : void 0,
375
- "data-message-status": d.status,
376
- children: [
377
- T ? /* @__PURE__ */ t(q, {}) : null,
378
- /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-stack", children: [
379
- /* @__PURE__ */ t("span", { className: "make-ai-assistant__message-sender", children: m }),
380
- d.content ? /* @__PURE__ */ t("div", { className: "make-ai-assistant__bubble", children: d.content }) : d.status === "streaming" ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__typing", "aria-label": `${l}正在思考`, children: [
455
+ "aria-label": `${T}的消息`,
456
+ className: `make-ai-assistant__message make-ai-assistant__message--${i.role}`,
457
+ "data-message-role": i.role,
458
+ "data-message-state": B ? "error" : void 0,
459
+ "data-message-status": i.status,
460
+ children: /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-turn", children: [
461
+ _ ? /* @__PURE__ */ t(Ve, { assistantName: d }) : /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-identity", children: [
462
+ /* @__PURE__ */ t("span", { className: "make-ai-assistant__message-sender", children: T }),
463
+ /* @__PURE__ */ t(Ea, { src: $ })
464
+ ] }),
465
+ /* @__PURE__ */ n("div", { className: "make-ai-assistant__message-stack", children: [
466
+ i.content ? /* @__PURE__ */ t("div", { className: "make-ai-assistant__bubble", children: i.content }) : i.status === "streaming" ? /* @__PURE__ */ n("div", { className: "make-ai-assistant__typing", "aria-label": `${d}正在思考`, children: [
381
467
  /* @__PURE__ */ t("span", {}),
382
468
  /* @__PURE__ */ t("span", {}),
383
469
  /* @__PURE__ */ t("span", {})
384
470
  ] }) : null,
385
- _ && e.progress ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__progress", role: "status", children: [
386
- /* @__PURE__ */ t("span", { "aria-hidden": "true" }),
387
- /* @__PURE__ */ t("span", { children: e.progress.message })
388
- ] }) : null,
389
- b ? /* @__PURE__ */ t(Ie, { error: b, onRetry: u }) : null,
390
- d.artifacts.map((y) => /* @__PURE__ */ t(
391
- Ke,
471
+ _ ? /* @__PURE__ */ t(
472
+ Ge,
473
+ {
474
+ active: K && e.status === "streaming",
475
+ steps: i.progressSteps
476
+ }
477
+ ) : null,
478
+ B ? /* @__PURE__ */ t(
479
+ ze,
392
480
  {
393
- artifact: y,
481
+ error: B,
482
+ onRetry: w ? m : void 0
483
+ }
484
+ ) : null,
485
+ i.artifacts.map((te) => /* @__PURE__ */ t(
486
+ da,
487
+ {
488
+ artifact: te,
394
489
  context: a,
395
490
  onAction: c,
396
- onActionError: n,
491
+ onActionError: o,
397
492
  registry: s
398
493
  },
399
- y.id
400
- ))
494
+ te.id
495
+ )),
496
+ fe ? /* @__PURE__ */ t(
497
+ Da,
498
+ {
499
+ copyFeedback: y?.messageId === i.id ? {
500
+ message: y.message,
501
+ status: y.status
502
+ } : void 0,
503
+ onCopy: i.content.trim() ? () => f(i.id, i.content) : void 0,
504
+ onRegenerate: k && i.id === R && q ? () => P({
505
+ userMessage: q,
506
+ assistantMessage: i
507
+ }) : void 0
508
+ }
509
+ ) : null
401
510
  ] })
402
- ]
511
+ ] })
403
512
  },
404
- d.id
513
+ i.id
405
514
  );
406
515
  });
407
516
  };
408
- function ea({
517
+ function Ua({
409
518
  assistantName: e = "AI 助手",
410
- context: a,
411
- onAction: s,
412
- onActionError: c,
413
- onClose: n,
414
- onNewConversation: l,
415
- registry: u,
416
- subtitle: p,
417
- suggestions: A = [],
418
- title: f = "Make AI 助手",
419
- transport: d,
420
- userName: T = "你"
519
+ brandName: a,
520
+ context: s,
521
+ onAction: c,
522
+ onActionError: o,
523
+ onClose: d,
524
+ onNewConversation: m,
525
+ registry: h,
526
+ subtitle: $,
527
+ suggestions: y,
528
+ title: k,
529
+ transport: f,
530
+ userAvatarUrl: P,
531
+ userName: N = "你"
421
532
  }) {
422
- const [_, b] = V(""), [m, y] = V(X), [Z, H] = V(void 0), [Ae, be] = V(0), [R, j] = V(() => d.loadConversation ? "loading" : "ready"), S = E(void 0), x = E(void 0), F = E(0), te = E(null), Y = E(!0), re = E(a.app.id), ne = Fe(
423
- () => u ?? je(),
424
- [u]
425
- ), G = (i) => {
426
- const v = S.current, k = x.current?.iterator;
427
- return !v && !k ? !1 : (F.current += 1, S.current = void 0, x.current = void 0, console.info("[make-ai-assistant] local run cancellation requested", { reason: i }), v?.abort(), pe(k), !0);
533
+ const U = Ke(a, k), [R, x] = E(""), [i, _] = E(ue), q = S(i);
534
+ q.current = i;
535
+ const [K, w] = E(void 0), [B, T] = E(void 0), [fe, te] = E(0), [V, se] = E(() => f.loadConversation ? "loading" : "ready"), [Ze, H] = E(!1), O = S(void 0), z = S(void 0), G = S(0), re = S(null), F = S(!0), ye = S(s.app.id), Ae = Fe(
536
+ () => h ?? ya(),
537
+ [h]
538
+ ), be = Fe(
539
+ () => Na(y),
540
+ [y]
541
+ ), ne = (r) => {
542
+ const p = O.current, g = z.current?.iterator;
543
+ return !p && !g ? !1 : (G.current += 1, O.current = void 0, z.current = void 0, console.info("[make-ai-assistant] local run cancellation requested", { reason: r }), p?.abort(), Le(g), !0);
428
544
  };
429
- ae(() => () => {
430
- G("unmount");
431
- }, []), ae(() => {
432
- const i = d.loadConversation, v = re.current !== a.app.id;
433
- if (re.current = a.app.id, G("reinitialize"), v && (b(""), Y.current = !0), H(void 0), y(X()), !i) {
434
- j("ready");
545
+ ge(() => () => {
546
+ ne("unmount");
547
+ }, []), ge(() => {
548
+ const r = f.loadConversation, p = ye.current !== s.app.id;
549
+ if (ye.current = s.app.id, ne("reinitialize"), p && (x(""), F.current = !0), w(void 0), T(void 0), H(!1), _(ue()), !r) {
550
+ se("ready");
435
551
  return;
436
552
  }
437
- const k = new AbortController();
438
- return j("loading"), console.info("[make-ai-assistant] conversation load start", {
439
- appId: a.app.id
440
- }), i.call(d, a, { signal: k.signal }).then((I) => {
441
- k.signal.aborted || (y(X(I)), j("ready"), console.info("[make-ai-assistant] conversation load success", {
442
- appId: a.app.id,
443
- messageCount: I.messages.length
553
+ const g = new AbortController();
554
+ return se("loading"), console.info("[make-ai-assistant] conversation load start", {
555
+ appId: s.app.id
556
+ }), r.call(f, s, { signal: g.signal }).then((b) => {
557
+ g.signal.aborted || (_(ue(b)), se("ready"), console.info("[make-ai-assistant] conversation load success", {
558
+ appId: s.app.id,
559
+ messageCount: b.messages.length
444
560
  }));
445
- }).catch((I) => {
446
- k.signal.aborted || (console.error("[make-ai-assistant] conversation load failed", {
447
- appId: a.app.id,
448
- errorType: I instanceof Error ? I.name : typeof I
449
- }), j("error"));
450
- }), () => k.abort();
451
- }, [a.app.id, Ae, d]), ae(() => {
452
- const i = te.current;
453
- if (!i || !Y.current) return;
454
- const v = requestAnimationFrame(() => {
455
- if (!Y.current) return;
456
- const k = m.status === "streaming" || window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
457
- typeof i.scrollTo == "function" ? i.scrollTo({ top: i.scrollHeight, behavior: k }) : i.scrollTop = i.scrollHeight;
561
+ }).catch((b) => {
562
+ g.signal.aborted || (console.error("[make-ai-assistant] conversation load failed", {
563
+ appId: s.app.id,
564
+ errorType: b instanceof Error ? b.name : typeof b
565
+ }), se("error"));
566
+ }), () => g.abort();
567
+ }, [s.app.id, fe, f]), ge(() => {
568
+ const r = re.current;
569
+ if (!r || !F.current) return;
570
+ H(!1);
571
+ const p = requestAnimationFrame(() => {
572
+ if (!F.current) return;
573
+ const g = i.status === "streaming" || globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
574
+ typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: g }) : r.scrollTop = r.scrollHeight;
458
575
  });
459
- return () => cancelAnimationFrame(v);
460
- }, [m.messages, m.status]);
461
- const Ne = () => {
462
- const i = te.current;
463
- i && (Y.current = i.scrollHeight - i.scrollTop - i.clientHeight <= 48);
464
- }, J = async (i) => {
465
- const v = i.trim();
466
- if (!v || R !== "ready" || m.status === "streaming" || S.current) return;
467
- if (se(
468
- v,
469
- w.messageCharacters
470
- ) > w.messageCharacters) {
471
- H(
472
- `输入内容过长,请控制在 ${w.messageCharacters} 个字符以内`
576
+ return () => cancelAnimationFrame(p);
577
+ }, [i.messages, i.progress, i.status]);
578
+ const je = () => {
579
+ const r = re.current;
580
+ if (!r) return;
581
+ const p = Fa(r);
582
+ F.current = p, H(!p && q.current.messages.length > 0);
583
+ }, Ye = () => {
584
+ const r = re.current;
585
+ if (!r) return;
586
+ F.current = !0, H(!1);
587
+ const p = La();
588
+ typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: p }) : r.scrollTop = r.scrollHeight;
589
+ }, Ie = async (r, p) => {
590
+ const g = r.trim(), b = q.current, M = p?.regenerateFrom, _e = f.regenerate;
591
+ if (!g || V !== "ready" || b.status === "streaming" || O.current || M && !_e) return;
592
+ if (he(
593
+ g,
594
+ A.messageCharacters
595
+ ) > A.messageCharacters) {
596
+ w(
597
+ `输入内容过长,请控制在 ${A.messageCharacters} 个字符以内`
473
598
  );
474
599
  return;
475
600
  }
476
- const k = { id: Ye("user"), content: v }, I = new AbortController(), D = F.current + 1;
477
- F.current = D, S.current = I, H(void 0), b(""), y((N) => De(N, k));
601
+ const ce = {
602
+ id: M?.userMessage.id ?? Aa("user"),
603
+ content: g
604
+ }, le = M ? xa(b, M.userMessage.id) : ca(b, ce), de = new AbortController(), Z = G.current + 1;
605
+ G.current = Z, O.current = de, w(void 0), T(void 0), H(!F.current && b.messages.length > 0), M || x(""), _(le);
478
606
  try {
479
- let N = !1, g, oe = 0, le = 0, B = 0;
480
- const O = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Set(), de = /* @__PURE__ */ new Set(
481
- [...m.messages.map((W) => W.id), k.id]
482
- ), U = /* @__PURE__ */ new Set(), me = d.run(
483
- {
484
- threadId: m.threadId,
485
- message: k,
486
- context: a,
487
- capabilities: xe(ne)
488
- },
489
- { signal: I.signal }
490
- )[Symbol.asyncIterator]();
491
- for (x.current = { iterator: me, requestVersion: D }; ; ) {
492
- const W = await me.next();
493
- if (F.current !== D || W.done) break;
494
- let o;
607
+ let C = !1, v, we = 0, Te = 0, Me = 0, ve = 0, W = 0;
608
+ const X = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new Set(), Ee = /* @__PURE__ */ new Set(
609
+ [
610
+ ...le.messages.map((me) => me.id),
611
+ ce.id
612
+ ]
613
+ ), ee = /* @__PURE__ */ new Set(), Se = oa(Ae), $e = { signal: de.signal };
614
+ let ke;
615
+ if (M) {
616
+ if (!_e)
617
+ throw new u("当前 AI 助手不支持重新生成");
618
+ ke = _e({
619
+ threadId: le.threadId,
620
+ message: ce,
621
+ assistantMessage: {
622
+ id: M.assistantMessage.id,
623
+ content: M.assistantMessage.content
624
+ },
625
+ context: s,
626
+ capabilities: Se
627
+ }, $e);
628
+ } else
629
+ ke = f.run(
630
+ {
631
+ threadId: le.threadId,
632
+ message: ce,
633
+ context: s,
634
+ capabilities: Se
635
+ },
636
+ $e
637
+ );
638
+ const Re = ke[Symbol.asyncIterator]();
639
+ for (z.current = { iterator: Re, requestVersion: Z }; ; ) {
640
+ const me = await Re.next();
641
+ if (G.current !== Z || me.done) break;
642
+ let l;
495
643
  try {
496
- o = Pe(W.value);
497
- } catch (M) {
498
- throw new h(
499
- M instanceof Error ? M.message : "Invalid assistant event"
644
+ l = la(me.value);
645
+ } catch (I) {
646
+ throw new u(
647
+ I instanceof Error ? I.message : "Invalid assistant event"
500
648
  );
501
649
  }
502
- if (o.type === "message.start") {
503
- if (g !== void 0 && g !== o.runId)
504
- throw new h("AI 助手响应 run id 不一致");
505
- if (g ??= o.runId, le += 1, le > w.assistantMessagesPerRun)
506
- throw new h("AI 助手单次响应消息数量超过限制");
507
- if (de.has(o.messageId))
508
- throw new h("AI 助手响应包含重复的 message id");
509
- de.add(o.messageId), U.add(o.messageId), O.set(o.messageId, 0);
650
+ if (l.type === "message.start") {
651
+ if (v !== void 0 && v !== l.runId)
652
+ throw new u("AI 助手响应 run id 不一致");
653
+ if (v ??= l.runId, Te += 1, Te > A.assistantMessagesPerRun)
654
+ throw new u("AI 助手单次响应消息数量超过限制");
655
+ if (Ee.has(l.messageId))
656
+ throw new u("AI 助手响应包含重复的 message id");
657
+ Ee.add(l.messageId), ee.add(l.messageId), X.set(l.messageId, 0);
510
658
  }
511
- if (o.type === "message.delta") {
512
- if (!U.has(o.messageId))
513
- throw new h("AI 助手响应事件顺序无效");
514
- const M = O.get(o.messageId) ?? 0, P = se(
515
- o.delta,
516
- w.messageCharacters - B
659
+ if (l.type === "message.delta") {
660
+ if (!ee.has(l.messageId))
661
+ throw new u("AI 助手响应事件顺序无效");
662
+ const I = X.get(l.messageId) ?? 0, j = he(
663
+ l.delta,
664
+ A.messageCharacters - W
517
665
  );
518
- if (B + P > w.messageCharacters)
519
- throw new h("AI 助手响应文本超过大小限制");
520
- B += P, O.set(
521
- o.messageId,
522
- M + P
666
+ if (W + j > A.messageCharacters)
667
+ throw new u("AI 助手响应文本超过大小限制");
668
+ W += j, X.set(
669
+ l.messageId,
670
+ I + j
523
671
  );
524
672
  }
525
- if (o.type === "message.replace") {
526
- if (!U.has(o.messageId))
527
- throw new h("AI 助手响应事件顺序无效");
528
- const M = O.get(o.messageId) ?? 0, P = se(
529
- o.content,
530
- w.messageCharacters
531
- ), ue = B - M + P;
532
- if (ue > w.messageCharacters)
533
- throw new h("AI 助手响应文本超过大小限制");
534
- B = ue, O.set(o.messageId, P);
673
+ if (l.type === "message.replace") {
674
+ if (!ee.has(l.messageId))
675
+ throw new u("AI 助手响应事件顺序无效");
676
+ const I = X.get(l.messageId) ?? 0, j = he(
677
+ l.content,
678
+ A.messageCharacters
679
+ ), xe = W - I + j;
680
+ if (xe > A.messageCharacters)
681
+ throw new u("AI 助手响应文本超过大小限制");
682
+ W = xe, X.set(l.messageId, j);
535
683
  }
536
- if (o.type === "run.progress") {
537
- if (g !== void 0 && g !== o.runId)
538
- throw new h("AI 助手响应 run id 不一致");
539
- g ??= o.runId;
684
+ if (l.type === "run.progress") {
685
+ if (v !== void 0 && v !== l.runId)
686
+ throw new u("AI 助手响应 run id 不一致");
687
+ if (v ??= l.runId, Me += 1, Me > A.progressStepsPerRun)
688
+ throw new u("AI 助手处理过程数量超过限制");
689
+ const I = he(
690
+ l.message,
691
+ A.progressCharactersPerRun - ve
692
+ );
693
+ if (ve + I > A.progressCharactersPerRun)
694
+ throw new u("AI 助手处理过程文本超过大小限制");
695
+ ve += I;
540
696
  }
541
- if (o.type === "artifact") {
542
- if (!U.has(o.messageId))
543
- throw new h("AI 助手响应事件顺序无效");
544
- if (oe += 1, oe > w.artifactsPerRun)
545
- throw new h("AI 助手单次响应 Artifact 数量超过限制");
546
- if (ce.has(o.artifact.id))
547
- throw new h("AI 助手响应包含重复的 Artifact id");
548
- ce.add(o.artifact.id);
697
+ if (l.type === "artifact") {
698
+ if (!ee.has(l.messageId))
699
+ throw new u("AI 助手响应事件顺序无效");
700
+ if (we += 1, we > A.artifactsPerRun)
701
+ throw new u("AI 助手单次响应 Artifact 数量超过限制");
702
+ if (Ce.has(l.artifact.id))
703
+ throw new u("AI 助手响应包含重复的 Artifact id");
704
+ Ce.add(l.artifact.id);
549
705
  }
550
- if (o.type === "message.complete" && !U.delete(o.messageId))
551
- throw new h("AI 助手响应事件顺序无效");
552
- if (o.type === "run.complete" && g !== void 0 && g !== o.runId)
553
- throw new h("AI 助手响应 run id 不一致");
554
- if (o.type === "run.cancelled" && o.runId !== void 0 && g !== void 0 && g !== o.runId)
555
- throw new h("AI 助手响应 run id 不一致");
556
- if (y((M) => ee(M, o)), o.type === "error" || o.type === "run.cancelled" || o.type === "run.complete") {
557
- N = !0;
706
+ if (l.type === "message.complete" && !ee.delete(l.messageId))
707
+ throw new u("AI 助手响应事件顺序无效");
708
+ if (l.type === "run.complete" && v !== void 0 && v !== l.runId)
709
+ throw new u("AI 助手响应 run id 不一致");
710
+ if (l.type === "run.cancelled" && l.runId !== void 0 && v !== void 0 && v !== l.runId)
711
+ throw new u("AI 助手响应 run id 不一致");
712
+ if (_((I) => pe(I, l)), l.type === "error" || l.type === "run.cancelled" || l.type === "run.complete") {
713
+ C = !0;
558
714
  break;
559
715
  }
560
716
  }
561
- if (!N)
562
- throw new h("AI 助手流式响应在终止事件前结束");
563
- } catch (N) {
564
- if (F.current !== D) return;
565
- if (I.signal.aborted) {
566
- y(
567
- (g) => ee(g, { type: "run.cancelled" })
717
+ if (!C)
718
+ throw new u("AI 助手流式响应在终止事件前结束");
719
+ } catch (C) {
720
+ if (G.current !== Z) return;
721
+ if (de.signal.aborted) {
722
+ _(
723
+ (v) => pe(v, { type: "run.cancelled" })
568
724
  );
569
725
  return;
570
726
  }
571
727
  console.error("[make-ai-assistant] assistant run failed", {
572
- appId: a.app.id,
573
- errorType: N instanceof Error ? N.name : typeof N
574
- }), y(
575
- (g) => ee(g, {
728
+ appId: s.app.id,
729
+ errorType: C instanceof Error ? C.name : typeof C
730
+ }), _(
731
+ (v) => pe(v, {
576
732
  type: "error",
577
733
  code: "TRANSPORT_ERROR",
578
- message: N instanceof h ? N.message : "连接失败,请重试",
734
+ message: C instanceof u ? C.message : "连接失败,请重试",
579
735
  retryable: !0
580
736
  })
581
737
  );
582
738
  } finally {
583
- F.current === D && S.current === I && (S.current = void 0), x.current?.requestVersion === D && (pe(x.current.iterator), x.current = void 0);
739
+ G.current === Z && O.current === de && (O.current = void 0), z.current?.requestVersion === Z && (Le(z.current.iterator), z.current = void 0);
584
740
  }
585
- }, we = (i) => {
586
- i.preventDefault(), J(_);
587
- }, Me = (i) => {
588
- i.key === "Enter" && !i.shiftKey && !i.nativeEvent.isComposing && (i.preventDefault(), J(_));
589
- }, Te = () => {
590
- G("stop") && y(
591
- (i) => ee(i, { type: "run.cancelled" })
741
+ }, ie = (r) => Ie(r), Je = (r) => Ie(r.userMessage.content, { regenerateFrom: r }), Qe = async (r, p) => {
742
+ try {
743
+ await wa(p), T({ messageId: r, message: "已复制", status: "success" });
744
+ } catch (g) {
745
+ console.error("[make-ai-assistant] copy answer failed", {
746
+ errorType: g instanceof Error ? g.name : typeof g
747
+ }), T({ messageId: r, message: "复制失败", status: "error" });
748
+ }
749
+ }, We = (r) => {
750
+ r.preventDefault(), ie(R);
751
+ }, Xe = (r) => {
752
+ r.key === "Enter" && !r.shiftKey && !r.nativeEvent.isComposing && (r.preventDefault(), ie(R));
753
+ }, ea = () => {
754
+ ne("stop") && _(
755
+ (r) => pe(r, { type: "run.cancelled" })
592
756
  );
593
- }, Ee = () => {
594
- G("new-conversation"), b(""), H(void 0), y(X()), l?.();
595
- }, Ce = d.features?.remoteCancellation === !1 ? "停止接收" : "停止生成", $e = ve(m), Re = ye(m), Q = [...m.messages].reverse().find((i) => i.role === "user"), ie = () => {
596
- Q && J(Q.content);
757
+ }, aa = () => {
758
+ ne("new-conversation"), x(""), w(void 0), T(void 0), H(!1), F.current = !0, _(ue()), m?.();
759
+ }, ta = f.features?.remoteCancellation === !1 ? "停止接收" : "停止生成", sa = He(i), ra = Oe(i), oe = Ra(i), na = typeof f.regenerate == "function" && f.features?.regeneration !== !1, Ne = () => {
760
+ oe && ie(oe.content);
597
761
  };
598
- return /* @__PURE__ */ r("section", { className: "make-ai-assistant make-ai-assistant__panel", children: [
599
- /* @__PURE__ */ r("header", { className: "make-ai-assistant__header", children: [
600
- /* @__PURE__ */ t(q, {}),
601
- /* @__PURE__ */ r("div", { children: [
602
- /* @__PURE__ */ t("h2", { children: f }),
603
- /* @__PURE__ */ t("p", { children: p ?? `当前应用:${a.app.name ?? "未命名应用"}` })
762
+ return /* @__PURE__ */ n("section", { className: "make-ai-assistant make-ai-assistant__panel", children: [
763
+ /* @__PURE__ */ n("header", { className: "make-ai-assistant__header", children: [
764
+ /* @__PURE__ */ t(ae, {}),
765
+ /* @__PURE__ */ n("div", { children: [
766
+ /* @__PURE__ */ t("h2", { children: U }),
767
+ /* @__PURE__ */ t("p", { children: $ ?? `当前应用:${s.app.name ?? "未命名应用"}` })
604
768
  ] }),
605
- /* @__PURE__ */ r("div", { className: "make-ai-assistant__header-actions", children: [
606
- d.features?.newConversation !== !1 ? /* @__PURE__ */ t(
769
+ /* @__PURE__ */ n("div", { className: "make-ai-assistant__header-actions", children: [
770
+ f.features?.newConversation !== !1 ? /* @__PURE__ */ t(
607
771
  "button",
608
772
  {
609
773
  "aria-label": "新建对话",
610
774
  className: "make-ai-assistant__icon-button",
611
775
  type: "button",
612
- onClick: Ee,
613
- children: /* @__PURE__ */ t(Je, {})
776
+ onClick: aa,
777
+ children: /* @__PURE__ */ t(Ma, {})
614
778
  }
615
779
  ) : null,
616
- n ? /* @__PURE__ */ t(
780
+ d ? /* @__PURE__ */ t(
617
781
  "button",
618
782
  {
619
- "aria-label": "关闭 Make AI 助手",
783
+ "aria-label": `关闭 ${U}`,
620
784
  className: "make-ai-assistant__icon-button",
621
785
  type: "button",
622
- onClick: n,
623
- children: /* @__PURE__ */ t(Ge, {})
786
+ onClick: d,
787
+ children: /* @__PURE__ */ t(Ta, {})
624
788
  }
625
789
  ) : null
626
790
  ] })
627
791
  ] }),
628
- /* @__PURE__ */ r("div", { className: "make-ai-assistant__privacy-note", role: "note", children: [
792
+ /* @__PURE__ */ n("div", { className: "make-ai-assistant__privacy-note", role: "note", children: [
629
793
  /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "◇" }),
630
794
  "当前页面上下文会随请求发送,数据权限以宿主服务端校验结果为准"
631
795
  ] }),
632
- /* @__PURE__ */ r(
796
+ /* @__PURE__ */ n(
633
797
  "div",
634
798
  {
635
799
  className: "make-ai-assistant__body",
636
800
  "aria-live": "polite",
637
801
  "aria-relevant": "additions text",
638
- ref: te,
802
+ ref: re,
639
803
  role: "log",
640
- onScroll: Ne,
804
+ onScroll: je,
641
805
  children: [
642
- R === "loading" ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__empty", role: "status", children: [
643
- /* @__PURE__ */ t(q, {}),
806
+ V === "loading" ? /* @__PURE__ */ n("div", { className: "make-ai-assistant__empty", role: "status", children: [
807
+ /* @__PURE__ */ t(ae, {}),
644
808
  /* @__PURE__ */ t("h3", { children: "正在恢复对话" }),
645
809
  /* @__PURE__ */ t("p", { children: "正在读取当前 App 的历史消息…" })
646
- ] }) : R === "error" ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__empty", role: "alert", children: [
647
- /* @__PURE__ */ t(q, {}),
810
+ ] }) : V === "error" ? /* @__PURE__ */ n("div", { className: "make-ai-assistant__empty", role: "alert", children: [
811
+ /* @__PURE__ */ t(ae, {}),
648
812
  /* @__PURE__ */ t("h3", { children: "暂时无法加载对话" }),
649
813
  /* @__PURE__ */ t("p", { children: "请检查网络后重试。" }),
650
814
  /* @__PURE__ */ t(
@@ -652,79 +816,98 @@ function ea({
652
816
  {
653
817
  className: "make-ai-assistant__retry",
654
818
  type: "button",
655
- onClick: () => be((i) => i + 1),
819
+ onClick: () => te((r) => r + 1),
656
820
  children: "重新加载"
657
821
  }
658
822
  )
659
- ] }) : m.messages.length === 0 ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__empty", children: [
660
- /* @__PURE__ */ t(q, {}),
823
+ ] }) : i.messages.length === 0 ? /* @__PURE__ */ n("div", { className: "make-ai-assistant__empty", children: [
824
+ /* @__PURE__ */ t(ae, {}),
661
825
  /* @__PURE__ */ t("h3", { children: "有什么可以帮你?" }),
662
- /* @__PURE__ */ t("p", { children: "我会结合当前 App 和页面上下文理解问题,并用适合的方式展示结果。" })
663
- ] }) : Xe(
664
- m,
665
- a,
666
- ne,
826
+ /* @__PURE__ */ t("p", { children: "我会结合当前 App、页面位置和宿主允许的上下文回答,并把过程与结果分开展示。" })
827
+ ] }) : Pa(
828
+ i,
667
829
  s,
830
+ Ae,
668
831
  c,
832
+ o,
669
833
  e,
670
- Q ? ie : void 0,
671
- T
834
+ oe ? Ne : void 0,
835
+ N,
836
+ P,
837
+ B,
838
+ na,
839
+ (r, p) => {
840
+ Qe(r, p);
841
+ },
842
+ (r) => {
843
+ Je(r);
844
+ }
672
845
  ),
673
- m.progress && !$e ? /* @__PURE__ */ t(
674
- he,
846
+ i.progress && !sa ? /* @__PURE__ */ t(
847
+ De,
675
848
  {
676
849
  assistantName: e,
677
- progress: m.progress.message
850
+ progress: i.progress
678
851
  }
679
852
  ) : null,
680
- m.error && !Re ? /* @__PURE__ */ t(
681
- he,
853
+ i.error && !ra ? /* @__PURE__ */ t(
854
+ De,
682
855
  {
683
856
  assistantName: e,
684
- error: m.error,
685
- onRetry: Q ? ie : void 0
857
+ error: i.error,
858
+ onRetry: oe ? Ne : void 0
686
859
  }
687
860
  ) : null
688
861
  ]
689
862
  }
690
863
  ),
691
- /* @__PURE__ */ r("footer", { className: "make-ai-assistant__composer-region", children: [
692
- R === "ready" && A.length > 0 && m.messages.length === 0 ? /* @__PURE__ */ t("div", { className: "make-ai-assistant__suggestions", "aria-label": "推荐问题", children: A.map((i, v) => /* @__PURE__ */ t(
864
+ Ze ? /* @__PURE__ */ t(
865
+ "button",
866
+ {
867
+ "aria-label": "回到最新消息",
868
+ className: "make-ai-assistant__back-to-latest",
869
+ type: "button",
870
+ onClick: Ye,
871
+ children: "回到最新消息"
872
+ }
873
+ ) : null,
874
+ /* @__PURE__ */ n("footer", { className: "make-ai-assistant__composer-region", children: [
875
+ V === "ready" && be.length > 0 && i.messages.length === 0 ? /* @__PURE__ */ t("div", { className: "make-ai-assistant__suggestions", "aria-label": "推荐问题", children: be.map((r, p) => /* @__PURE__ */ t(
693
876
  "button",
694
877
  {
695
878
  type: "button",
696
879
  onClick: () => {
697
- J(i);
880
+ ie(r);
698
881
  },
699
- children: i
882
+ children: r
700
883
  },
701
- `${v}-${i}`
884
+ `${p}-${r}`
702
885
  )) }) : null,
703
- /* @__PURE__ */ r("form", { className: "make-ai-assistant__composer", onSubmit: we, children: [
886
+ /* @__PURE__ */ n("form", { className: "make-ai-assistant__composer", onSubmit: We, children: [
704
887
  /* @__PURE__ */ t(
705
888
  "textarea",
706
889
  {
707
890
  "aria-label": `向 ${e} 提问`,
708
- "aria-describedby": Z ? "make-ai-composer-error" : void 0,
709
- "aria-invalid": Z ? !0 : void 0,
891
+ "aria-describedby": K ? "make-ai-composer-error" : void 0,
892
+ "aria-invalid": K ? !0 : void 0,
710
893
  autoFocus: !0,
711
- disabled: R !== "ready" || m.status === "streaming",
712
- placeholder: `询问当前 ${a.app.name ?? "App"} 中的数据…`,
894
+ disabled: V !== "ready" || i.status === "streaming",
895
+ placeholder: `询问当前 ${s.app.name ?? "App"} 中的数据…`,
713
896
  rows: 2,
714
- value: _,
715
- onChange: (i) => {
716
- b(i.currentTarget.value), H(void 0);
897
+ value: R,
898
+ onChange: (r) => {
899
+ x(r.currentTarget.value), w(void 0);
717
900
  },
718
- onKeyDown: Me
901
+ onKeyDown: Xe
719
902
  }
720
903
  ),
721
- m.status === "streaming" ? /* @__PURE__ */ t(
904
+ i.status === "streaming" ? /* @__PURE__ */ t(
722
905
  "button",
723
906
  {
724
- "aria-label": Ce,
907
+ "aria-label": ta,
725
908
  className: "make-ai-assistant__send make-ai-assistant__send--stop",
726
909
  type: "button",
727
- onClick: Te,
910
+ onClick: ea,
728
911
  children: /* @__PURE__ */ t("span", { "aria-hidden": "true" })
729
912
  }
730
913
  ) : /* @__PURE__ */ t(
@@ -732,81 +915,81 @@ function ea({
732
915
  {
733
916
  "aria-label": "发送",
734
917
  className: "make-ai-assistant__send",
735
- disabled: R !== "ready" || !_.trim(),
918
+ disabled: V !== "ready" || !R.trim(),
736
919
  type: "submit",
737
- children: /* @__PURE__ */ t(Qe, {})
920
+ children: /* @__PURE__ */ t(Ca, {})
738
921
  }
739
922
  )
740
923
  ] }),
741
- Z ? /* @__PURE__ */ t("p", { id: "make-ai-composer-error", role: "alert", children: Z }) : null,
924
+ K ? /* @__PURE__ */ t("p", { id: "make-ai-composer-error", role: "alert", children: K }) : null,
742
925
  /* @__PURE__ */ t("p", { children: "AI 生成的结果可能存在偏差,重要数据请核对明细。" })
743
926
  ] })
744
927
  ] });
745
928
  }
746
- function ia({
929
+ function Ha({
747
930
  defaultOpen: e = !1,
748
931
  hideLauncher: a = !1,
749
932
  launcher: s,
750
933
  onOpenChange: c,
751
- open: n,
752
- ...l
934
+ open: o,
935
+ ...d
753
936
  }) {
754
- const [u, p] = V(e), A = E(null), f = n ?? u, d = (_) => {
755
- n === void 0 && p(_), c?.(_), _ || requestAnimationFrame(() => A.current?.focus());
756
- }, T = () => d(!f);
757
- return ae(() => {
758
- if (!f) return;
759
- const _ = (b) => {
760
- b.key === "Escape" && (d(!1), requestAnimationFrame(() => A.current?.focus()));
937
+ const m = Ke(d.brandName, d.title), [h, $] = E(e), y = S(null), k = o ?? h, f = (N) => {
938
+ o === void 0 && $(N), c?.(N), N || requestAnimationFrame(() => y.current?.focus());
939
+ }, P = () => f(!k);
940
+ return ge(() => {
941
+ if (!k) return;
942
+ const N = (U) => {
943
+ U.key === "Escape" && (f(!1), requestAnimationFrame(() => y.current?.focus()));
761
944
  };
762
- return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
763
- }, [c, f]), /* @__PURE__ */ r("div", { className: "make-ai-assistant", "data-open": f || void 0, children: [
764
- !a && (!f || s) ? s ? s({ open: f, toggle: T }) : /* @__PURE__ */ r(
945
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
946
+ }, [c, k]), /* @__PURE__ */ n("div", { className: "make-ai-assistant", "data-open": k || void 0, children: [
947
+ !a && (!k || s) ? s ? s({ open: k, toggle: P }) : /* @__PURE__ */ n(
765
948
  "button",
766
949
  {
767
- "aria-label": f ? "关闭 Make AI 助手" : "打开 Make AI 助手",
768
- "aria-expanded": f,
950
+ "aria-label": k ? `关闭 ${m}` : `打开 ${m}`,
951
+ "aria-expanded": k,
769
952
  className: "make-ai-assistant__launcher",
770
- ref: A,
953
+ ref: y,
771
954
  type: "button",
772
- onClick: T,
955
+ onClick: P,
773
956
  children: [
774
957
  /* @__PURE__ */ t("span", { className: "make-ai-assistant__launcher-orbit", "aria-hidden": "true" }),
775
- /* @__PURE__ */ t(ke, {})
958
+ /* @__PURE__ */ t(Be, {})
776
959
  ]
777
960
  }
778
961
  ) : null,
779
- f ? /* @__PURE__ */ t(
962
+ k ? /* @__PURE__ */ t(
780
963
  "aside",
781
964
  {
782
- "aria-label": "Make AI 助手",
965
+ "aria-label": m,
783
966
  "aria-modal": "false",
784
967
  className: "make-ai-assistant__drawer",
785
968
  role: "dialog",
786
- children: /* @__PURE__ */ t(ea, { ...l, onClose: () => d(!1) })
969
+ children: /* @__PURE__ */ t(Ua, { ...d, onClose: () => f(!1) })
787
970
  }
788
971
  ) : null
789
972
  ] });
790
973
  }
791
974
  export {
792
- Ke as ArtifactRenderer,
793
- ea as AssistantPanel,
794
- ma as MAKE_AI_ARTIFACT_KINDS,
795
- ua as MAKE_AI_ARTIFACT_LIMITS,
796
- pa as MAKE_AI_ARTIFACT_SCHEMA_VERSION,
797
- w as MAKE_AI_CONVERSATION_LIMITS,
798
- ia as MakeAiAssistant,
799
- De as appendUserMessage,
800
- xe as createArtifactCapabilities,
801
- fe as createArtifactTemplateRegistry,
802
- X as createAssistantConversationState,
803
- je as createPlatformArtifactRegistry,
804
- ca as extendArtifactTemplateRegistry,
805
- $ as formatArtifactValue,
806
- ha as parseArtifact,
807
- Pe as parseAssistantEvent,
808
- Ze as platformArtifactTemplates,
809
- ee as reduceAssistantEvent,
810
- Se as resolveArtifactTemplate,
811
- fa as validateArtifact
975
+ da as ArtifactRenderer,
976
+ Ua as AssistantPanel,
977
+ ja as MAKE_AI_ARTIFACT_KINDS,
978
+ Ya as MAKE_AI_ARTIFACT_LIMITS,
979
+ Ja as MAKE_AI_ARTIFACT_SCHEMA_VERSION,
980
+ A as MAKE_AI_CONVERSATION_LIMITS,
981
+ Ha as MakeAiAssistant,
982
+ ca as appendUserMessage,
983
+ oa as createArtifactCapabilities,
984
+ Pe as createArtifactTemplateRegistry,
985
+ ue as createAssistantConversationState,
986
+ ya as createPlatformArtifactRegistry,
987
+ Ga as extendArtifactTemplateRegistry,
988
+ D as formatArtifactValue,
989
+ Qa as parseArtifact,
990
+ la as parseAssistantEvent,
991
+ ka as platformArtifactTemplates,
992
+ pe as reduceAssistantEvent,
993
+ ia as resolveArtifactTemplate,
994
+ Wa as validateArtifact
812
995
  };