wi-chat 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +273 -261
  3. package/dist/core/useChat.d.ts +64 -15
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +46 -46
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +6 -6
  8. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  9. package/dist/mobile-ui/index.cjs +1 -1
  10. package/dist/mobile-ui/index.d.ts +1 -1
  11. package/dist/mobile-ui/index.js +104 -104
  12. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +5 -5
  13. package/dist/page-context/index.js +2 -4
  14. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
  15. package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
  16. package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
  17. package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
  18. package/dist/parser/answerCom/actionExecute/{parseAgentAction.d.ts → parseHostAction.d.ts} +9 -8
  19. package/dist/parser/answerCom/actionExecute/types.d.ts +12 -13
  20. package/dist/parser/index.cjs +2 -2
  21. package/dist/parser/index.d.ts +5 -5
  22. package/dist/parser/index.js +221 -263
  23. package/dist/parser/registry.d.ts +4 -4
  24. package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
  25. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +3 -3
  26. package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
  27. package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +19 -0
  28. package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
  29. package/dist/renderers/index.cjs +1 -1
  30. package/dist/renderers/index.d.ts +1 -1
  31. package/dist/renderers/index.js +471 -485
  32. package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
  33. package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
  34. package/dist/renderers/style.css +1 -1
  35. package/dist/request/index.cjs +2 -2
  36. package/dist/request/index.js +6 -13
  37. package/dist/request/ws.d.ts +3 -3
  38. package/dist/right-panel/RightPanel.vue.d.ts +6 -6
  39. package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
  40. package/dist/right-panel/RightPanelTabs.vue.d.ts +5 -5
  41. package/dist/right-panel/index.cjs +1 -1
  42. package/dist/right-panel/index.js +397 -416
  43. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
  44. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
  45. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
  46. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
  47. package/dist/theme/index.js +2 -4
  48. package/dist/tools/index.cjs +2 -2
  49. package/dist/tools/index.js +10 -19
  50. package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
  51. package/dist/tools/useAutoScroll.d.ts +3 -3
  52. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
  53. package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
  54. package/dist/web-ui/chat/ChatContainer.vue.d.ts +6 -6
  55. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  56. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +5 -5
  57. package/dist/web-ui/index.cjs +1 -1
  58. package/dist/web-ui/index.d.ts +1 -1
  59. package/dist/web-ui/index.js +630 -635
  60. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +7 -7
  61. package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
  62. package/package.json +2 -1
  63. package/dist/renderers/agentAction/AgentActionStatus.vue.d.ts +0 -19
@@ -1,9 +1,9 @@
1
- import { provideOutputFileConfig as q, createAnswerContentMap as $, DeepThinkingSteps as x, AiAnswerBubble as P } from "wi-chat/renderers";
2
- import { AgentActionStatus as ke, AiAnswerBubble as ve, ClarificationCard as Ce, DeepThinkingSteps as Te, IframePage as Ie, KnowledgeStreamResult as Se, OutputFile as Be, createAnswerContentMap as Ee, injectIframeResizerChild as Ae, provideIframePageConfig as Ve, provideOutputFileConfig as Fe, resolveIframePlaceholders as Oe, useIframePage as De } from "wi-chat/renderers";
3
- import { defineComponent as C, openBlock as i, createElementBlock as n, createVNode as f, unref as c, withKeys as U, withModifiers as K, withCtx as O, createTextVNode as N, toDisplayString as y, ref as z, computed as L, watch as A, createElementVNode as _, createCommentVNode as k, Fragment as v, renderList as V, Transition as R, pushScopeId as j, popScopeId as W, renderSlot as F } from "vue";
4
- import { Field as G, Button as H } from "vant";
5
- import { useAutoScroll as J } from "wi-chat/tools";
6
- const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
1
+ import { provideOutputFileConfig as M, createAnswerContentMap as q, DeepThinkingSteps as $, AiAnswerBubble as P } from "wi-chat/renderers";
2
+ import { AiAnswerBubble as he, ClarificationCard as ye, DeepThinkingSteps as we, HostActionStatus as ke, IframePage as ve, KnowledgeStreamResult as xe, OutputFile as Ce, createAnswerContentMap as Te, injectIframeResizerChild as Be, provideIframePageConfig as Ie, provideOutputFileConfig as Se, resolveIframePlaceholders as Ee, useIframePage as _e } from "wi-chat/renderers";
3
+ import { defineComponent as C, openBlock as n, createElementBlock as i, createVNode as f, unref as p, withKeys as U, withModifiers as K, withCtx as F, createTextVNode as N, toDisplayString as w, ref as z, computed as L, watch as _, createElementVNode as y, createCommentVNode as v, Fragment as x, renderList as V, Transition as R, renderSlot as A } from "vue";
4
+ import { Field as j, Button as H } from "vant";
5
+ import { useAutoScroll as W } from "wi-chat/tools";
6
+ const G = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ C({
7
7
  __name: "Inputbox",
8
8
  props: {
9
9
  modelValue: { default: "" },
@@ -17,62 +17,62 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
17
17
  buttonType: { default: "primary" }
18
18
  },
19
19
  emits: ["update:modelValue", "submit", "stop"],
20
- setup(l, { emit: u }) {
21
- const o = l, t = u, r = () => {
22
- if (o.talking) {
20
+ setup(e, { emit: u }) {
21
+ const a = e, t = u, l = () => {
22
+ if (a.talking) {
23
23
  t("stop");
24
24
  return;
25
25
  }
26
- o.disabled || o.disabledSend || t("submit");
27
- }, g = (e) => {
28
- e.isComposing || e.keyCode === 229 || !o.enterExact || o.talking || (e.preventDefault(), r());
26
+ a.disabled || a.disabledSend || t("submit");
27
+ }, g = (d) => {
28
+ d.isComposing || d.keyCode === 229 || !a.enterExact || a.talking || (d.preventDefault(), l());
29
29
  };
30
- return (e, a) => (i(), n("div", Q, [
31
- f(c(G), {
30
+ return (d, o) => (n(), i("div", G, [
31
+ f(p(j), {
32
32
  "model-value": e.modelValue,
33
33
  type: "textarea",
34
34
  rows: "2",
35
35
  autosize: "",
36
36
  placeholder: e.placeholder,
37
37
  disabled: e.disabled,
38
- "onUpdate:modelValue": a[0] || (a[0] = (p) => t("update:modelValue", String(p ?? ""))),
38
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => t("update:modelValue", String(r ?? ""))),
39
39
  onKeydown: U(K(g, ["exact"]), ["enter"])
40
40
  }, null, 8, ["model-value", "placeholder", "disabled", "onKeydown"]),
41
- f(c(H), {
41
+ f(p(H), {
42
42
  class: "wi-mobile-inputbox__btn",
43
43
  type: e.talking ? "danger" : e.buttonType,
44
44
  size: "small",
45
45
  disabled: e.disabled,
46
- onClick: r
46
+ onClick: l
47
47
  }, {
48
- default: O(() => [
49
- N(y(e.talking ? e.stopText : e.submitText), 1)
48
+ default: F(() => [
49
+ N(w(e.talking ? e.stopText : e.submitText), 1)
50
50
  ]),
51
51
  _: 1
52
52
  }, 8, ["type", "disabled"])
53
53
  ]));
54
54
  }
55
- }), T = (l, u) => {
56
- const o = l.__vccOpts || l;
57
- for (const [t, r] of u)
58
- o[t] = r;
59
- return o;
60
- }, Y = /* @__PURE__ */ T(X, [["__scopeId", "data-v-02f9c6a0"]]), Z = (l) => (j("data-v-04e966f6"), l = l(), W(), l), ee = {
55
+ }), T = (e, u) => {
56
+ const a = e.__vccOpts || e;
57
+ for (const [t, l] of u)
58
+ a[t] = l;
59
+ return a;
60
+ }, Q = /* @__PURE__ */ T(J, [["__scopeId", "data-v-02f9c6a0"]]), X = {
61
61
  key: 0,
62
62
  class: "wi-mobile-chat-messages__loading"
63
- }, te = {
63
+ }, Y = {
64
64
  key: 1,
65
65
  class: "wi-mobile-chat-messages__empty"
66
- }, se = /* @__PURE__ */ Z(() => /* @__PURE__ */ _("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)), oe = { class: "wi-mobile-chat-messages__empty-title" }, ae = { class: "wi-mobile-chat-messages__empty-description" }, ie = {
66
+ }, Z = { class: "wi-mobile-chat-messages__empty-title" }, ee = { class: "wi-mobile-chat-messages__empty-description" }, te = {
67
67
  key: 0,
68
68
  class: "wi-mobile-chat-messages__user"
69
- }, ne = { class: "wi-mobile-chat-messages__user-wrapper" }, le = {
69
+ }, se = { class: "wi-mobile-chat-messages__user-wrapper" }, ae = {
70
70
  key: 0,
71
71
  class: "wi-mobile-chat-messages__attachments"
72
- }, de = { class: "wi-mobile-chat-messages__user-bubble" }, re = {
72
+ }, oe = { class: "wi-mobile-chat-messages__user-bubble" }, ne = {
73
73
  key: 1,
74
74
  class: "wi-mobile-chat-messages__assistant"
75
- }, pe = /* @__PURE__ */ C({
75
+ }, ie = /* @__PURE__ */ C({
76
76
  __name: "ChatMessagesView",
77
77
  props: {
78
78
  messages: { default: () => [] },
@@ -83,86 +83,86 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
83
83
  emptyDescription: { default: "回答内容由共享渲染层统一分发" }
84
84
  },
85
85
  emits: ["loadOlder", "updateThinkingExpanded"],
86
- setup(l, { expose: u, emit: o }) {
87
- var B, E;
88
- const t = l, r = o;
89
- q(t.outputFileConfig ?? {});
90
- const g = z(), { showScrollToBottom: e, forceScrollToBottom: a, requestScrollToBottom: p, resetScrollState: w, onReachTop: D } = J(g), M = L(() => $(t.parsers));
91
- A(
86
+ setup(e, { expose: u, emit: a }) {
87
+ var S, E;
88
+ const t = e, l = a;
89
+ M(t.outputFileConfig ?? {});
90
+ const g = z(), { showScrollToBottom: d, forceScrollToBottom: o, requestScrollToBottom: r, resetScrollState: k, onReachTop: O } = W(g), D = L(() => q(t.parsers));
91
+ _(
92
92
  () => t.messages.length === 0,
93
- (d) => {
94
- d && w();
93
+ (b) => {
94
+ b && k();
95
95
  }
96
96
  );
97
- let I = ((B = t.messages[0]) == null ? void 0 : B.id) ?? "", S = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
98
- return A(
97
+ let B = ((S = t.messages[0]) == null ? void 0 : S.id) ?? "", I = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
98
+ return _(
99
99
  () => t.messages,
100
100
  () => {
101
- var b, m;
102
- const d = ((b = t.messages[0]) == null ? void 0 : b.id) ?? "", h = ((m = t.messages[t.messages.length - 1]) == null ? void 0 : m.id) ?? "", s = d !== I && h === S;
103
- I = d, S = h, !s && p();
101
+ var h, c;
102
+ const b = ((h = t.messages[0]) == null ? void 0 : h.id) ?? "", m = ((c = t.messages[t.messages.length - 1]) == null ? void 0 : c.id) ?? "", s = b !== B && m === I;
103
+ B = b, I = m, !s && r();
104
104
  },
105
105
  { deep: !0 }
106
- ), D(() => r("loadOlder")), u({
106
+ ), O(() => l("loadOlder")), u({
107
107
  /** 强制滚动到底部 */
108
- forceScrollToBottom: a,
108
+ forceScrollToBottom: o,
109
109
  /** 自动滚动开启时请求滚动到底部 */
110
- requestScrollToBottom: p
111
- }), (d, h) => (i(), n("div", {
110
+ requestScrollToBottom: r
111
+ }), (b, m) => (n(), i("div", {
112
112
  ref_key: "scrollEl",
113
113
  ref: g,
114
114
  class: "wi-mobile-chat-messages"
115
115
  }, [
116
- d.loading ? (i(), n("div", ee, "历史加载中...")) : d.messages.length === 0 ? (i(), n("div", te, [
117
- se,
118
- _("div", oe, y(d.emptyTitle), 1),
119
- _("div", ae, y(d.emptyDescription), 1)
120
- ])) : k("", !0),
121
- (i(!0), n(v, null, V(d.messages, (s) => {
122
- var b;
123
- return i(), n(v, {
116
+ e.loading ? (n(), i("div", X, "历史加载中...")) : e.messages.length === 0 ? (n(), i("div", Y, [
117
+ m[1] || (m[1] = y("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)),
118
+ y("div", Z, w(e.emptyTitle), 1),
119
+ y("div", ee, w(e.emptyDescription), 1)
120
+ ])) : v("", !0),
121
+ (n(!0), i(x, null, V(e.messages, (s) => {
122
+ var h;
123
+ return n(), i(x, {
124
124
  key: s.id
125
125
  }, [
126
- s.role === "user" ? (i(), n("div", ie, [
127
- _("div", ne, [
128
- (b = s.attachments) != null && b.length ? (i(), n("div", le, [
129
- (i(!0), n(v, null, V(s.attachments, (m) => (i(), n("span", {
130
- key: m.name,
126
+ s.role === "user" ? (n(), i("div", te, [
127
+ y("div", se, [
128
+ (h = s.attachments) != null && h.length ? (n(), i("div", ae, [
129
+ (n(!0), i(x, null, V(s.attachments, (c) => (n(), i("span", {
130
+ key: c.name,
131
131
  class: "wi-mobile-chat-messages__attachment"
132
- }, y(m.name), 1))), 128))
133
- ])) : k("", !0),
134
- _("div", de, y(s.content), 1)
132
+ }, w(c.name), 1))), 128))
133
+ ])) : v("", !0),
134
+ y("div", oe, w(s.content), 1)
135
135
  ])
136
- ])) : (i(), n("div", re, [
137
- f(c(x), {
136
+ ])) : (n(), i("div", ne, [
137
+ f(p($), {
138
138
  steps: s.thinking.steps,
139
139
  expanded: s.thinking.expanded,
140
- "onUpdate:expanded": (m) => r("updateThinkingExpanded", s, m)
140
+ "onUpdate:expanded": (c) => l("updateThinkingExpanded", s, c)
141
141
  }, null, 8, ["steps", "expanded", "onUpdate:expanded"]),
142
- f(c(P), {
142
+ f(p(P), {
143
143
  answer: s.answer,
144
144
  error: s.error,
145
145
  stopped: s.stopped,
146
- "content-map": M.value
146
+ "content-map": D.value
147
147
  }, null, 8, ["answer", "error", "stopped", "content-map"])
148
148
  ]))
149
149
  ], 64);
150
150
  }), 128)),
151
151
  f(R, { name: "wi-mobile-chat-messages-fade" }, {
152
- default: O(() => [
153
- c(e) ? (i(), n("button", {
152
+ default: F(() => [
153
+ p(d) ? (n(), i("button", {
154
154
  key: 0,
155
155
  type: "button",
156
156
  class: "wi-mobile-chat-messages__bottom",
157
- onClick: h[0] || (h[0] = //@ts-ignore
158
- (...s) => c(a) && c(a)(...s))
159
- }, " 回到底部 ")) : k("", !0)
157
+ onClick: m[0] || (m[0] = //@ts-ignore
158
+ (...s) => p(o) && p(o)(...s))
159
+ }, " 回到底部 ")) : v("", !0)
160
160
  ]),
161
161
  _: 1
162
162
  })
163
163
  ], 512));
164
164
  }
165
- }), ue = /* @__PURE__ */ T(pe, [["__scopeId", "data-v-04e966f6"]]), me = { class: "wi-mobile-chat-container" }, ce = /* @__PURE__ */ C({
165
+ }), le = /* @__PURE__ */ T(ie, [["__scopeId", "data-v-04e966f6"]]), de = { class: "wi-mobile-chat-container" }, re = /* @__PURE__ */ C({
166
166
  __name: "ChatContainer",
167
167
  props: {
168
168
  messages: { default: () => [] },
@@ -179,55 +179,55 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
179
179
  disabled: { type: Boolean, default: !1 }
180
180
  },
181
181
  emits: ["update:question", "submit", "stop", "loadOlder", "updateThinkingExpanded"],
182
- setup(l, { emit: u }) {
183
- const o = l, t = u, r = () => {
184
- o.hasMore && t("loadOlder");
182
+ setup(e, { emit: u }) {
183
+ const a = e, t = u, l = () => {
184
+ a.hasMore && t("loadOlder");
185
185
  }, g = () => {
186
- t("submit", { text: o.question });
186
+ t("submit", { text: a.question });
187
187
  };
188
- return (e, a) => (i(), n("section", me, [
189
- F(e.$slots, "messages", {}, () => [
190
- f(ue, {
188
+ return (d, o) => (n(), i("section", de, [
189
+ A(d.$slots, "messages", {}, () => [
190
+ f(le, {
191
191
  messages: e.messages,
192
192
  parsers: e.parsers,
193
193
  "output-file-config": e.outputFileConfig,
194
194
  loading: e.loading,
195
195
  "empty-title": e.emptyTitle,
196
196
  "empty-description": e.emptyDescription,
197
- onLoadOlder: r,
198
- onUpdateThinkingExpanded: a[0] || (a[0] = (p, w) => t("updateThinkingExpanded", p, w))
197
+ onLoadOlder: l,
198
+ onUpdateThinkingExpanded: o[0] || (o[0] = (r, k) => t("updateThinkingExpanded", r, k))
199
199
  }, null, 8, ["messages", "parsers", "output-file-config", "loading", "empty-title", "empty-description"])
200
200
  ], !0),
201
- F(e.$slots, "above-input", {}, void 0, !0),
202
- f(Y, {
201
+ A(d.$slots, "above-input", {}, void 0, !0),
202
+ f(Q, {
203
203
  "model-value": e.question,
204
204
  placeholder: e.placeholder,
205
205
  disabled: e.disabled || !e.session,
206
206
  "disabled-send": !e.question.trim(),
207
207
  talking: e.talking,
208
- "onUpdate:modelValue": a[1] || (a[1] = (p) => t("update:question", p)),
208
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => t("update:question", r)),
209
209
  onSubmit: g,
210
- onStop: a[2] || (a[2] = (p) => t("stop"))
210
+ onStop: o[2] || (o[2] = (r) => t("stop"))
211
211
  }, null, 8, ["model-value", "placeholder", "disabled", "disabled-send", "talking"])
212
212
  ]));
213
213
  }
214
- }), ye = /* @__PURE__ */ T(ce, [["__scopeId", "data-v-9bd22d00"]]);
214
+ }), fe = /* @__PURE__ */ T(re, [["__scopeId", "data-v-9bd22d00"]]);
215
215
  export {
216
- ke as AgentActionStatus,
217
- ve as AiAnswerBubble,
218
- ye as ChatContainer,
219
- ue as ChatMessagesView,
220
- Ce as ClarificationCard,
221
- Te as DeepThinkingSteps,
222
- Ie as IframePage,
223
- Y as Inputbox,
224
- Se as KnowledgeStreamResult,
225
- Be as OutputFile,
226
- Ee as createAnswerContentMap,
227
- Ae as injectIframeResizerChild,
228
- Ve as provideIframePageConfig,
229
- Fe as provideOutputFileConfig,
230
- Oe as resolveIframePlaceholders,
231
- De as useIframePage
216
+ he as AiAnswerBubble,
217
+ fe as ChatContainer,
218
+ le as ChatMessagesView,
219
+ ye as ClarificationCard,
220
+ we as DeepThinkingSteps,
221
+ ke as HostActionStatus,
222
+ ve as IframePage,
223
+ Q as Inputbox,
224
+ xe as KnowledgeStreamResult,
225
+ Ce as OutputFile,
226
+ Te as createAnswerContentMap,
227
+ Be as injectIframeResizerChild,
228
+ Ie as provideIframePageConfig,
229
+ Se as provideOutputFileConfig,
230
+ Ee as resolveIframePlaceholders,
231
+ _e as useIframePage
232
232
  };
233
233
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
2
  /** 输入框当前文本内容(v-model) */
3
3
  modelValue?: string;
4
4
  /** 占位符文本 */
@@ -27,7 +27,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
27
27
  stopText: string;
28
28
  talking: boolean;
29
29
  buttonType: string;
30
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
31
31
  "update:modelValue": (value: string) => void;
32
32
  submit: () => void;
33
33
  stop: () => void;
@@ -60,11 +60,11 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
60
60
  stopText: string;
61
61
  talking: boolean;
62
62
  buttonType: string;
63
- }>>> & {
63
+ }>>> & Readonly<{
64
64
  onSubmit?: () => any;
65
65
  onStop?: () => any;
66
66
  "onUpdate:modelValue"?: (value: string) => any;
67
- }, {
67
+ }>, {
68
68
  placeholder: string;
69
69
  disabled: boolean;
70
70
  modelValue: string;
@@ -74,7 +74,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
74
74
  stopText: string;
75
75
  talking: boolean;
76
76
  buttonType: 'primary' | 'danger' | 'success';
77
- }, {}>;
77
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
78
78
  export default _default;
79
79
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
80
80
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -12,8 +12,7 @@ const i = 100, n = (e = []) => e.map((t) => ({
12
12
  }), A = (e) => ({
13
13
  [r]: JSON.stringify(e)
14
14
  }), s = (e) => {
15
- if (!e || typeof e != "object" || Array.isArray(e))
16
- return !1;
15
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
17
16
  const t = e;
18
17
  return typeof t.schemaVersion == "string" && !!t.navigation && typeof t.navigation == "object" && Array.isArray(t.state) && Array.isArray(t.actions);
19
18
  }, g = (e) => {
@@ -24,8 +23,7 @@ const i = 100, n = (e = []) => e.map((t) => ({
24
23
  } catch {
25
24
  return;
26
25
  }
27
- if (!t || typeof t != "object" || Array.isArray(t))
28
- return;
26
+ if (!t || typeof t != "object" || Array.isArray(t)) return;
29
27
  let a = t[r];
30
28
  if (typeof a == "string")
31
29
  try {
@@ -1,5 +1,5 @@
1
1
  import { StreamChunk } from '../../sse';
2
- import { ActionExecuteCommand, ActionResult, ActionDefinition } from './types';
2
+ import { ActionExecuteCommand, ActionResult } from './types';
3
3
 
4
4
  /**
5
5
  * 创建失败结果
@@ -31,12 +31,6 @@ export declare const normalizeActionResult: (value: unknown, invalidMessage?: st
31
31
  * @returns 统一执行结果
32
32
  */
33
33
  export declare const wrapActionFrame: (frame: unknown) => ActionResult;
34
- /**
35
- * 归一化 Action 定义(外部可能传入任意对象,这里只保留 name / arguments)
36
- * @param action 原始 Action
37
- * @returns 仅含 name / arguments 的 Action
38
- */
39
- export declare const normalizeActionDefinition: (action: ActionDefinition) => ActionDefinition;
40
34
  /**
41
35
  * front_reply 帧内 action_execute 指令的读取结果(三态,供各 parser 精确分流):
42
36
  * - `ignored`:不是本协议(mode 不是 front_reply / type 不是 action_execute)→ parser 应 `return false`;
@@ -60,8 +60,20 @@ export declare const submitClarification: (requestId: string, answers: Clarifica
60
60
  */
61
61
  export declare const cancelClarification: (requestId: string) => boolean;
62
62
  /**
63
- * 清空全部在途请求(切换分组 / 停止回答时调用):
64
- * 先把仍在等待回答的卡片标为已失效,再清理登记表,避免卡片停留在「等待回答」却无法提交。
63
+ * 清理在途请求(切换分组 / 停止回答时调用):
64
+ * 先把仍在等待回答的卡片标为已失效,再从登记表移除,避免卡片停留在「等待回答」却无法提交。
65
+ *
66
+ * 登记表是模块级单例(跨 useChat 实例 / 跨连接共享),因此默认支持按回包通道收窄:
67
+ * 传 `reply` 时只处理该通道登记的请求,不影响其它实例 / 其它连接的卡片;
68
+ * 不传时全量清理(等价旧行为,仅建议在所有连接都已失效的收尾场景使用)。
69
+ * @param reply 该通道的 reply 函数(`registerClarification` 登记时的同一引用);缺省为全量清理
65
70
  */
66
- export declare const clearPendingClarifications: () => void;
71
+ export declare const clearPendingClarifications: (reply?: (payload: WaitReplyPayload) => boolean | void) => void;
72
+ /**
73
+ * 让某个回包通道(一次提问连接)关联的在途确认项失效。
74
+ * 连接关闭后这些卡片已无法回包:置为已失效并从登记表移除,避免停留在「等待回答」。
75
+ * 只处理该通道登记过的请求,不影响其它连接 / 其它 useChat 实例。
76
+ * @param reply 该通道的 reply 函数(registerClarification 登记时的同一引用)
77
+ */
78
+ export declare const expirePendingClarificationsForReply: (reply: (payload: WaitReplyPayload) => boolean | void) => void;
67
79
  export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * action_execute 相关 answer_type 常量
3
+ *
4
+ * 单独成文件:`clarification.ts`(在途确认项登记表)需要按 answer_type 精确定位报告,
5
+ * 而两个解析器又都依赖 `clarification.ts`;常量放在这里避免互相 import 形成循环依赖。
6
+ */
7
+ /** 确认卡片的回答类型(front_reply + action_execute + executor=agent + collect_clarifications) */
8
+ export declare const COLLECT_CLARIFICATIONS_ANSWER_TYPE = "collect_clarifications";
9
+ /** 宿主执行过程的回答类型(front_reply + action_execute + executor=host) */
10
+ export declare const HOST_ACTION_ANSWER_TYPE = "host_action";
@@ -1,10 +1,11 @@
1
1
  import { AiAnswerReport } from '../../answer';
2
2
  import { AnswerParser, AnswerParseOptions } from '../../registry';
3
3
  import { StreamChunk } from '../../sse';
4
+ import { COLLECT_CLARIFICATIONS_ANSWER_TYPE } from './constants';
4
5
  import { ClarificationViewModel } from './types';
5
6
 
6
- /** 确认卡片的回答类型(也是历史 report 的分发键) */
7
- export declare const COLLECT_CLARIFICATIONS_ANSWER_TYPE = "collect_clarifications";
7
+ /** 确认卡片的回答类型(也是历史 report 的分发键),常量定义见 ./constants */
8
+ export { COLLECT_CLARIFICATIONS_ANSWER_TYPE };
8
9
  /**
9
10
  * 处理实时流中的确认项指令
10
11
  * @param chunk 流式数据块
@@ -1,25 +1,26 @@
1
1
  import { AiAnswerReport } from '../../answer';
2
2
  import { AnswerParser, AnswerParseOptions } from '../../registry';
3
3
  import { StreamChunk } from '../../sse';
4
- import { AgentActionValue } from './types';
4
+ import { HOST_ACTION_ANSWER_TYPE } from './constants';
5
+ import { HostActionValue } from './types';
5
6
 
6
- /** agent 指令执行过程的回答类型(也是历史 report 的分发键) */
7
- export declare const AGENT_ACTION_ANSWER_TYPE = "agent_action";
7
+ /** 宿主执行过程的回答类型(也是历史 report 的分发键),常量定义见 ./constants */
8
+ export { HOST_ACTION_ANSWER_TYPE };
8
9
  /**
9
- * 处理实时流中的 agent 指令
10
+ * 处理实时流中的宿主执行指令
10
11
  * @param chunk 流式数据块
11
12
  * @param reports 回答 reports 数组(registry 预取的同一引用,push 即累积)
12
13
  * @param answerValues 回答整体结构(本 parser 不使用)
13
14
  * @param options 解析配置(actionExecute 提供宿主执行器与回包通道)
14
15
  * @returns 是否消费了该 chunk(只在自己负责的组合上返回 true)
15
16
  */
16
- export declare const applyAgentActionChunk: (chunk: StreamChunk, reports: AiAnswerReport<any>[], _answerValues?: unknown, options?: AnswerParseOptions) => boolean;
17
+ export declare const applyHostActionChunk: (chunk: StreamChunk, reports: AiAnswerReport<any>[], _answerValues?: unknown, options?: AnswerParseOptions) => boolean;
17
18
  /**
18
19
  * 历史归一化:历史里的执行过程卡片已无法确认执行结果,running 统一标为未知。
19
20
  * @param report 历史 reports 中的执行过程报告(就地修改)
20
21
  */
21
- export declare const normalizeAgentActionReport: (report: AiAnswerReport<AgentActionValue>) => void;
22
+ export declare const normalizeHostActionReport: (report: AiAnswerReport<HostActionValue>) => void;
22
23
  /**
23
- * agent_action 答案类型的注册表条目(registry 内置)
24
+ * host_action 答案类型的注册表条目(registry 内置)
24
25
  */
25
- export declare const agentActionParser: AnswerParser<AgentActionValue>;
26
+ export declare const hostActionParser: AnswerParser<HostActionValue>;
@@ -45,22 +45,21 @@ export interface WaitReplyPayload {
45
45
  values: unknown;
46
46
  }
47
47
  /**
48
- * action_execute 指令处理配置(只作用于 `executor === 'agent'` 的指令:
49
- * agent 下发命令、宿主执行)。`executor === 'host'` 的 `collect_clarifications`
50
- * 走确认卡片,不需要宿主注入执行器。
48
+ * action_execute 指令处理配置(只作用于 `executor === 'host'` 的指令:宿主执行命令)。
49
+ * `executor === 'agent'` 的 `collect_clarifications` 走确认卡片,不需要宿主注入执行器。
51
50
  */
52
51
  export interface ActionExecuteOptions {
53
52
  /**
54
- * 宿主执行器:`executor === 'agent'` 的 action 由宿主执行。
55
- * 未提供时一律回失败帧(避免后端一直等待 wait_reply)。
53
+ * 宿主执行器:`executor === 'host'` 的 action 由宿主执行。
54
+ * 未提供时不产出执行过程卡片(只回一帧失败结果,避免后端一直等待 wait_reply)。
56
55
  * @param action 待执行的 Action(name + arguments)
57
56
  * @returns 统一执行结果(同步或异步均可)
58
57
  */
59
58
  execute?: (action: ActionDefinition) => ActionResult | Promise<ActionResult>;
60
59
  /**
61
- * wait_reply 回传通道(useChat 内部注入 sendWsMessage,宿主一般不用传)。
60
+ * wait_reply 回传通道(useChat 内部注入“本次提问连接专用”的 reply,宿主一般不用传)。
62
61
  * @param payload wait_reply 载荷
63
- * @returns false 表示当前无在途连接(连接已关闭),回包失败
62
+ * @returns false 表示当前连接已关闭 / 无在途会话,回包未发出
64
63
  */
65
64
  reply?: (payload: WaitReplyPayload) => boolean | void;
66
65
  /**
@@ -69,13 +68,13 @@ export interface ActionExecuteOptions {
69
68
  */
70
69
  onError?: (error: unknown) => void;
71
70
  }
72
- /** agent 下发指令的执行状态:执行中 / 成功 / 失败 / 未知(历史回放,状态已无法确认) */
73
- export type AgentActionStatus = 'running' | 'success' | 'error' | 'unknown';
71
+ /** 宿主执行指令的状态:执行中 / 成功 / 失败 / 未知(历史回放,状态已无法确认) */
72
+ export type HostActionState = 'running' | 'success' | 'error' | 'unknown';
74
73
  /**
75
- * agent 指令的执行过程卡片(`answer_type = 'agent_action'` 的 values)
76
- * 对应 `front_reply + action_execute + executor='agent'`:agent 发出命令,宿主执行并回包。
74
+ * 宿主执行指令的过程卡片(`answer_type = 'host_action'` 的 values)
75
+ * 对应 `front_reply + action_execute + executor='host'`:命令下发给宿主,宿主执行并回包。
77
76
  */
78
- export interface AgentActionValue {
77
+ export interface HostActionValue {
79
78
  /** 卡片 id(取后端 reply_id,缺省时本地生成) */
80
79
  id: string;
81
80
  /** Action 名称 */
@@ -83,7 +82,7 @@ export interface AgentActionValue {
83
82
  /** Action 参数 */
84
83
  arguments: Record<string, unknown>;
85
84
  /** 当前执行状态 */
86
- status: AgentActionStatus;
85
+ status: HostActionState;
87
86
  /** 状态说明(执行中 / 成功结果 / 失败原因) */
88
87
  message: string;
89
88
  /** 业务数据(执行成功时原样回传的 data,供 UI 展示) */