@aleph-alpha/chat-kit 1.3.0 → 1.4.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 (60) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-BoUxOQbH.js → CkInput.vue_vue_type_script_setup_true_lang-C5C09u0z.js} +13 -12
  2. package/dist/adapters/index.d.ts +18 -0
  3. package/dist/adapters/index.d.ts.map +1 -0
  4. package/dist/adapters/index.js +4 -0
  5. package/dist/adapters/responses-api.d.ts +180 -0
  6. package/dist/adapters/responses-api.d.ts.map +1 -0
  7. package/dist/adapters/responses-api.js +153 -0
  8. package/dist/chat-kit.css +2 -11
  9. package/dist/components/base/CkFeedbackButton/CkFeedbackButton.vue.d.ts.map +1 -1
  10. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts +1 -1
  11. package/dist/components/composed/CkConversation/CkConversation.stories.d.ts +11 -3
  12. package/dist/components/composed/CkConversation/CkConversation.stories.d.ts.map +1 -1
  13. package/dist/components/composed/CkConversation/CkConversation.vue.d.ts +5 -1
  14. package/dist/components/composed/CkConversation/CkConversation.vue.d.ts.map +1 -1
  15. package/dist/components/index.js +1 -1
  16. package/dist/composables/index.js +1 -1
  17. package/dist/composables/useConversations.d.ts +12 -0
  18. package/dist/composables/useConversations.d.ts.map +1 -1
  19. package/dist/favicon.ico +0 -0
  20. package/dist/generateId-BHf0W4Rq.js +6 -0
  21. package/dist/handlers/index.js +1 -1
  22. package/dist/handlers/useMessageHandler.d.ts +2 -2
  23. package/dist/handlers/useMessageHandler.d.ts.map +1 -1
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +6 -8
  27. package/dist/services/index.d.ts +0 -2
  28. package/dist/services/index.d.ts.map +1 -1
  29. package/dist/services/index.js +1 -37
  30. package/dist/services/types.d.ts +2 -2
  31. package/dist/services/types.d.ts.map +1 -1
  32. package/dist/types.d.ts +47 -2
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/{useConversationSessions-ulFhtpQr.js → useConversationSessions-GLZV_Ctr.js} +18 -2
  35. package/dist/{useMessageHandler-BmBdu2EW.js → useMessageHandler-ZRC-gIOJ.js} +5 -5
  36. package/package.json +11 -2
  37. package/src/adapters/index.ts +17 -0
  38. package/src/adapters/responses-api.spec.ts +365 -0
  39. package/src/adapters/responses-api.ts +444 -0
  40. package/src/components/base/CkFeedbackButton/CkFeedbackButton.vue +8 -24
  41. package/src/components/composed/CkConversation/CkConversation.spec.ts +171 -25
  42. package/src/components/composed/CkConversation/CkConversation.stories.ts +266 -46
  43. package/src/components/composed/CkConversation/CkConversation.vue +19 -7
  44. package/src/composables/useConversations.spec.ts +118 -0
  45. package/src/composables/useConversations.ts +32 -0
  46. package/src/handlers/useChatKitLabels.spec.ts +16 -2
  47. package/src/handlers/useMessageHandler.spec.ts +112 -44
  48. package/src/handlers/useMessageHandler.ts +16 -2
  49. package/src/helpers/conversationTree.spec.ts +46 -19
  50. package/src/index.ts +11 -2
  51. package/src/services/index.ts +0 -2
  52. package/src/services/types.ts +2 -2
  53. package/src/types.ts +55 -2
  54. package/dist/ChatService-LogwJNxh.js +0 -9
  55. package/dist/services/ChatService.d.ts +0 -42
  56. package/dist/services/ChatService.d.ts.map +0 -1
  57. package/dist/services/MockChatService.d.ts +0 -10
  58. package/dist/services/MockChatService.d.ts.map +0 -1
  59. package/src/services/ChatService.ts +0 -60
  60. package/src/services/MockChatService.ts +0 -47
@@ -422,7 +422,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
422
422
  return openBlock(), createElementBlock("div", {
423
423
  role: "group",
424
424
  "aria-label": groupLabel.value,
425
- class: "ck-feedback-button flex items-center gap-1"
425
+ class: "ck-feedback-button flex items-center gap-4"
426
426
  }, [
427
427
  createVNode(unref(UiTooltip), {
428
428
  content: thumbsUpLabel.value,
@@ -437,7 +437,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
437
437
  disabled: isUpDisabled.value,
438
438
  class: [
439
439
  "ck-feedback-button__thumb",
440
- { "ck-feedback-button__thumb--selected": isUpSelected.value }
440
+ { "bg-core-bg-tertiary": isUpSelected.value }
441
441
  ],
442
442
  onClick: _cache[0] || (_cache[0] = ($event) => handleClick("up"))
443
443
  }), {
@@ -467,7 +467,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
467
467
  disabled: isDownDisabled.value,
468
468
  class: [
469
469
  "ck-feedback-button__thumb",
470
- { "ck-feedback-button__thumb--selected": isDownSelected.value }
470
+ { "bg-core-bg-tertiary": isDownSelected.value }
471
471
  ],
472
472
  onClick: _cache[1] || (_cache[1] = ($event) => handleClick("down"))
473
473
  }), {
@@ -488,7 +488,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
488
488
  };
489
489
  }
490
490
  });
491
- const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-c452d66c"]]);
491
+ const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-245705b8"]]);
492
492
  const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = 'before:absolute before:z-10 before:top-1/2 before:left-0 before:h-1/2 before:w-0.5 before:-translate-y-1/2 before:origin-left before:scale-x-0 before:rounded-full before:bg-background-accent-default before:opacity-0 before:transition-[transform,opacity] before:duration-200 before:ease-linear before:content-[""] data-[active=true]:before:scale-x-100 data-[active=true]:before:opacity-100';
493
493
  const _hoisted_1$3 = ["data-active"];
494
494
  const _hoisted_2$2 = { class: "min-w-0 flex-1" };
@@ -1062,6 +1062,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1062
1062
  () => Boolean(props.agentAvatarImage) || Boolean(props.agentAvatarFallback) || Boolean(slots["agent-message-icon"])
1063
1063
  );
1064
1064
  const isLoading = (message) => message.status === "started" || message.status === "sending";
1065
+ function getMessageText(message) {
1066
+ return message.content.filter((c) => c.type === "text").map((c) => c.text).join("");
1067
+ }
1065
1068
  return (_ctx, _cache) => {
1066
1069
  return openBlock(), createBlock(_sfc_main$e, { messages: __props.messages }, {
1067
1070
  "user-message": withCtx(({ message }) => [
@@ -1069,16 +1072,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1069
1072
  class: normalizeClass({ "ml-8": hasIcon.value })
1070
1073
  }, [
1071
1074
  renderSlot(_ctx.$slots, "user-message", { message }, () => [
1072
- createVNode(_sfc_main$3, {
1073
- message: message.content
1074
- }, {
1075
+ createVNode(_sfc_main$3, null, {
1075
1076
  default: withCtx(() => [
1076
1077
  renderSlot(_ctx.$slots, "user-message-content", { message }, () => [
1077
- createTextVNode(toDisplayString(message.content), 1)
1078
+ createTextVNode(toDisplayString(getMessageText(message)), 1)
1078
1079
  ])
1079
1080
  ]),
1080
1081
  _: 2
1081
- }, 1032, ["message"])
1082
+ }, 1024)
1082
1083
  ])
1083
1084
  ], 2)
1084
1085
  ]),
@@ -1087,9 +1088,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1087
1088
  createVNode(_sfc_main$f, null, createSlots({
1088
1089
  footer: withCtx(() => [
1089
1090
  renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
1090
- message.content && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
1091
+ getMessageText(message) && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
1091
1092
  key: 0,
1092
- text: message.content,
1093
+ text: getMessageText(message),
1093
1094
  "aria-label-copy": unref(labels).copyMessageAction,
1094
1095
  "aria-label-copied": unref(labels).copyMessageActionCopied
1095
1096
  }, null, 8, ["text", "aria-label-copy", "aria-label-copied"])) : createCommentVNode("", true)
@@ -1098,7 +1099,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1098
1099
  default: withCtx(() => [
1099
1100
  renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
1100
1101
  createVNode(_sfc_main$8, {
1101
- content: message.content,
1102
+ content: getMessageText(message),
1102
1103
  classes: __props.agentMarkdownClasses
1103
1104
  }, createSlots({ _: 2 }, [
1104
1105
  _ctx.$slots["agent-message-code-block"] ? {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Format adapters for chat-kit.
3
+ *
4
+ * Adapters convert a transport-specific transcript shape into chat-kit's
5
+ * domain model (`ConversationTree`). They are intentionally optional — the
6
+ * message handler only knows about `setTree(tree)`, so apps that use a
7
+ * different format can write their own adapter (or skip the concept
8
+ * entirely and build trees by hand).
9
+ *
10
+ * Currently shipped:
11
+ * - `responses-api` — OpenAI-style `GET /conversations/{id}/responses`.
12
+ *
13
+ * Re-exported via `@aleph-alpha/chat-kit/adapters`. Use the more granular
14
+ * `@aleph-alpha/chat-kit/adapters/responses-api` subpath when you only
15
+ * need a specific adapter.
16
+ */
17
+ export * from './responses-api';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { responsesToTree } from "./responses-api.js";
2
+ export {
3
+ responsesToTree
4
+ };
@@ -0,0 +1,180 @@
1
+ import type { ConversationTree } from '../types';
2
+ /**
3
+ * Annotation attached to a Responses-API content part (citations, file
4
+ * references, etc.). chat-kit does not render annotations itself; the shape
5
+ * is kept open so consumers can downcast to a more specific schema.
6
+ */
7
+ export interface ResponseAnnotation {
8
+ type: string;
9
+ [key: string]: unknown;
10
+ }
11
+ /**
12
+ * Plain text fragment inside a `ResponseOutputMessage`. Streamed by the
13
+ * Responses API as `output_text` (or the historical `text` alias).
14
+ */
15
+ export interface ResponseOutputTextPart {
16
+ type: 'output_text' | 'text';
17
+ text: string;
18
+ annotations?: ResponseAnnotation[];
19
+ }
20
+ /**
21
+ * One reasoning fragment inside a `ResponseOutputReasoning`. The Responses
22
+ * API streams chain-of-thought under `reasoning_text`; the body is exposed
23
+ * for consumers that want to render it (chat-kit itself only surfaces a
24
+ * "thinking" indicator).
25
+ */
26
+ export interface ResponseReasoningTextPart {
27
+ type: 'reasoning_text';
28
+ text: string;
29
+ annotations?: ResponseAnnotation[];
30
+ }
31
+ /**
32
+ * Forward-compatible catch-all for content parts whose `type` chat-kit does
33
+ * not yet model (e.g. refusals, future part kinds). Consumers narrow on
34
+ * `type` themselves when they need richer handling.
35
+ */
36
+ export interface ResponseUnknownContentPart {
37
+ type: string;
38
+ text?: string;
39
+ annotations?: ResponseAnnotation[];
40
+ [key: string]: unknown;
41
+ }
42
+ /**
43
+ * Discriminated union of content parts that can appear inside a Responses-
44
+ * API output item. `ResponseOutputTextPart` and `ResponseReasoningTextPart`
45
+ * cover the rendered shapes; the catch-all keeps the union open.
46
+ */
47
+ export type OutputContentPart = ResponseOutputTextPart | ResponseReasoningTextPart | ResponseUnknownContentPart;
48
+ /**
49
+ * Visible message produced by a Responses-API turn (assistant reply or
50
+ * echoed user input). Carries the renderable text content; `responsesToTree`
51
+ * extracts text from `content` to build the chat tree.
52
+ */
53
+ export interface ResponseOutputMessage {
54
+ type: 'message';
55
+ id: string;
56
+ status: string;
57
+ role: 'assistant' | 'user';
58
+ content: string | OutputContentPart[];
59
+ }
60
+ /**
61
+ * Chain-of-thought trail produced by the assistant during a turn. Surfaced
62
+ * in chat-kit only as a "thinking" indicator; consumers may render the
63
+ * underlying `reasoning_text` parts directly when desired.
64
+ */
65
+ export interface ResponseOutputReasoning {
66
+ type: 'reasoning';
67
+ id: string;
68
+ status: string;
69
+ role?: 'assistant' | null;
70
+ content: OutputContentPart[];
71
+ }
72
+ /**
73
+ * Single tool entry returned inside `mcp_list_tools` (and similar tool-
74
+ * discovery outputs). Schema fields are passed through verbatim because
75
+ * chat-kit does not model JSON Schema itself.
76
+ */
77
+ export interface ResponseToolDescriptor {
78
+ name: string;
79
+ description?: string;
80
+ annotations?: Record<string, unknown>;
81
+ input_schema?: unknown;
82
+ }
83
+ /**
84
+ * Wire-level Responses-API output kinds that represent tool activity rather
85
+ * than visible content. The list enumerates the values chat-kit recognises
86
+ * today; extend it as new tool kinds are introduced upstream.
87
+ */
88
+ export type ResponseOutputToolType = 'mcp_list_tools' | 'mcp_call' | 'tool_call' | 'function_call' | 'web_search_call' | 'file_search_call' | 'code_interpreter_call' | 'image_generation_call' | 'local_shell_call';
89
+ /**
90
+ * Tool-related output produced during a Responses-API turn. Covers tool
91
+ * discovery (`mcp_list_tools`), invocation (`mcp_call`, `function_call`,
92
+ * etc.) and the various built-in tool kinds. Common fields are typed; the
93
+ * rest is passed through so consumers can read kind-specific data without
94
+ * redefining the shape.
95
+ */
96
+ export interface ResponseOutputTool {
97
+ type: ResponseOutputToolType;
98
+ id: string;
99
+ status?: string;
100
+ /** `mcp_list_tools` / `mcp_call`: server identifier. */
101
+ server_label?: string;
102
+ /** `mcp_list_tools`: catalog of tools exposed by the server. */
103
+ tools?: ResponseToolDescriptor[];
104
+ /** `function_call` / `mcp_call`: invoked tool name. */
105
+ name?: string;
106
+ /** `function_call` / `mcp_call`: serialized JSON arguments. */
107
+ arguments?: string;
108
+ /** `function_call` / `tool_call`: correlation id for a paired result. */
109
+ call_id?: string;
110
+ /** Tool result payload (shape depends on the tool kind). */
111
+ output?: unknown;
112
+ [key: string]: unknown;
113
+ }
114
+ /**
115
+ * One output item produced by a Responses-API response, discriminated by
116
+ * `type`. Modelled in the same spirit as `MessageContent`: visible
117
+ * `'message'`, optional `'reasoning'` trail, and `tool` activity.
118
+ */
119
+ export type ResponseOutput = ResponseOutputMessage | ResponseOutputReasoning | ResponseOutputTool;
120
+ /**
121
+ * Attachment metadata stored under `metadata.attachments` on a Responses-API
122
+ * response. chat-kit does not render attachments itself; this type exists so
123
+ * consumers can read them off `StoredResponse.metadata` without redeclaring
124
+ * the shape.
125
+ */
126
+ export interface ResponseAttachment {
127
+ fileId: string;
128
+ fileName: string;
129
+ searchStoreId: string;
130
+ }
131
+ /**
132
+ * One stored response from the OpenAI-style Responses API, as returned by
133
+ * `GET /conversations/:id/responses`. `previous_response_id` chains
134
+ * responses into a tree; `responsesToTree` walks that chain to produce a
135
+ * `ConversationTree`.
136
+ */
137
+ export interface StoredResponse {
138
+ id: string;
139
+ object: 'response';
140
+ created_at: number;
141
+ completed_at: number;
142
+ status: string;
143
+ model: string;
144
+ previous_response_id?: string | null;
145
+ output: ResponseOutput[];
146
+ request_input: Record<string, unknown>[];
147
+ metadata?: Record<string, unknown> & {
148
+ attachments?: ResponseAttachment[];
149
+ };
150
+ conversation?: {
151
+ id: string;
152
+ };
153
+ ancestor_ids?: string[];
154
+ depth?: number;
155
+ }
156
+ /**
157
+ * Raw envelope returned by the Responses list endpoint. The endpoint is not
158
+ * paginated, so chat-kit unwraps `data` and exposes `StoredResponse[]` to
159
+ * callers; this type is kept exported for users implementing or mocking the
160
+ * `HttpClient`.
161
+ */
162
+ export interface ResponseList {
163
+ object: 'list';
164
+ data: StoredResponse[];
165
+ }
166
+ /**
167
+ * Convert an OpenAI Responses API list (already ordered by `created_at`
168
+ * ascending) into a chat-kit `ConversationTree`.
169
+ *
170
+ * The caller guarantees ordering, which lets us build the tree in a single
171
+ * pass: each response's `previous_response_id` always points to a response
172
+ * we have already processed, so we can wire its messages onto the parent's
173
+ * last message immediately. Sibling responses (same `previous_response_id`)
174
+ * surface as branches; the latest one wins as the active branch.
175
+ *
176
+ * Pair with `useMessageHandler().setTree(responsesToTree(responses))` when
177
+ * you want to hydrate a handler.
178
+ */
179
+ export declare function responsesToTree(responses: StoredResponse[]): ConversationTree;
180
+ //# sourceMappingURL=responses-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses-api.d.ts","sourceRoot":"","sources":["../../src/adapters/responses-api.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,gBAAgB,EAIjB,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb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,MAAM,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QACnC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;KACpC,CAAC;IACF,YAAY,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB;AA8ID;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,gBAAgB,CAkE7E"}
@@ -0,0 +1,153 @@
1
+ import { g as generateId } from "../generateId-BHf0W4Rq.js";
2
+ function extractMessageText(content) {
3
+ if (typeof content === "string") return content.trim();
4
+ return extractTextFromParts(content);
5
+ }
6
+ function extractTextFromParts(parts) {
7
+ let text = "";
8
+ for (const part of parts) {
9
+ if (part.type === "output_text" || part.type === "text") {
10
+ text += part.text ?? "";
11
+ }
12
+ }
13
+ return text.trim();
14
+ }
15
+ function extractReasoningText(parts) {
16
+ let text = "";
17
+ for (const part of parts) {
18
+ if (part.type === "reasoning_text") {
19
+ text += part.text ?? "";
20
+ }
21
+ }
22
+ return text.trim();
23
+ }
24
+ function textPart(text, id) {
25
+ return { type: "text", id: id ?? generateId(), text, status: "completed" };
26
+ }
27
+ function toAssistantParts(resp) {
28
+ const parts = [];
29
+ for (const out of resp.output ?? []) {
30
+ switch (out.type) {
31
+ case "reasoning": {
32
+ const text = extractReasoningText(out.content);
33
+ parts.push({
34
+ type: "reasoning",
35
+ id: out.id,
36
+ ...text ? { text } : {},
37
+ status: "completed"
38
+ });
39
+ break;
40
+ }
41
+ case "message": {
42
+ if (out.role !== "assistant") break;
43
+ const text = extractMessageText(out.content);
44
+ if (!text) break;
45
+ parts.push(textPart(text, out.id || void 0));
46
+ break;
47
+ }
48
+ // Actual tool invocations surface as tool parts. `mcp_list_tools` is
49
+ // informational discovery (the server advertising tools) rather than
50
+ // a call the assistant made, so it is intentionally skipped.
51
+ case "mcp_call":
52
+ case "function_call":
53
+ case "tool_call": {
54
+ parts.push({
55
+ type: "tool",
56
+ id: out.id,
57
+ name: out.name ?? out.type
58
+ });
59
+ break;
60
+ }
61
+ }
62
+ }
63
+ return parts;
64
+ }
65
+ function getAssistantNodeId(resp) {
66
+ for (const out of resp.output ?? []) {
67
+ if (out.type === "message" && out.role === "assistant" && out.id) {
68
+ return out.id;
69
+ }
70
+ }
71
+ return `assistant-${resp.id}`;
72
+ }
73
+ function extractInputText(rawContent) {
74
+ if (typeof rawContent === "string") return rawContent.trim();
75
+ if (Array.isArray(rawContent)) {
76
+ return extractTextFromParts(rawContent);
77
+ }
78
+ return "";
79
+ }
80
+ function responseToMessageNodes(resp) {
81
+ const nodes = [];
82
+ if (resp.request_input) {
83
+ for (const [idx, input] of resp.request_input.entries()) {
84
+ const role = input.role;
85
+ const rawContent = input.content;
86
+ const text = extractInputText(rawContent);
87
+ if (role === "user" && text) {
88
+ nodes.push({
89
+ id: `user-${resp.id}-${idx}`,
90
+ role: "user",
91
+ content: [textPart(text)],
92
+ createdAt: new Date(resp.created_at * 1e3)
93
+ });
94
+ }
95
+ }
96
+ }
97
+ const assistantParts = toAssistantParts(resp);
98
+ if (assistantParts.length > 0) {
99
+ nodes.push({
100
+ id: getAssistantNodeId(resp),
101
+ role: "assistant",
102
+ content: assistantParts,
103
+ createdAt: new Date((resp.completed_at ?? resp.created_at) * 1e3)
104
+ });
105
+ }
106
+ return nodes;
107
+ }
108
+ function responsesToTree(responses) {
109
+ if (responses.length === 0) {
110
+ return { nodes: {}, rootId: null };
111
+ }
112
+ const treeNodes = {};
113
+ const tailMessageByResponse = /* @__PURE__ */ new Map();
114
+ let rootMessageId = null;
115
+ function appendNode(node, parentId) {
116
+ treeNodes[node.id] = {
117
+ id: node.id,
118
+ parentId,
119
+ childrenIds: [],
120
+ activeChildIndex: 0,
121
+ role: node.role,
122
+ content: node.content,
123
+ status: "completed",
124
+ createdAt: node.createdAt
125
+ };
126
+ if (parentId !== null) {
127
+ const parent = treeNodes[parentId];
128
+ if (parent) {
129
+ parent.childrenIds.push(node.id);
130
+ parent.activeChildIndex = parent.childrenIds.length - 1;
131
+ }
132
+ }
133
+ }
134
+ for (const resp of responses) {
135
+ const parentResponseId = resp.previous_response_id && tailMessageByResponse.has(resp.previous_response_id) ? resp.previous_response_id : null;
136
+ let chainParent = parentResponseId !== null ? tailMessageByResponse.get(parentResponseId) ?? null : null;
137
+ const messageNodes = responseToMessageNodes(resp);
138
+ let firstId = null;
139
+ for (const node of messageNodes) {
140
+ appendNode(node, chainParent);
141
+ if (firstId === null) firstId = node.id;
142
+ chainParent = node.id;
143
+ }
144
+ if (rootMessageId === null && firstId !== null) {
145
+ rootMessageId = firstId;
146
+ }
147
+ tailMessageByResponse.set(resp.id, chainParent);
148
+ }
149
+ return { nodes: treeNodes, rootId: rootMessageId };
150
+ }
151
+ export {
152
+ responsesToTree
153
+ };
package/dist/chat-kit.css CHANGED
@@ -14,20 +14,11 @@
14
14
  }
15
15
  }
16
16
 
17
- .ck-feedback-button__thumb[data-v-c452d66c] button {
17
+ .ck-feedback-button__thumb[data-v-245705b8] {
18
18
  transition: background-color 0.15s ease-out;
19
19
  }
20
-
21
- /* Selected thumbs stay visually emphasised on top of the default ghost
22
- variant: the filled icon (via `fill-current`) carries the primary
23
- affordance; the tinted background reinforces it without competing with
24
- neighbouring action buttons. The token matches `bg-core-bg-tertiary`
25
- used elsewhere in chat-kit. */
26
- .ck-feedback-button__thumb--selected[data-v-c452d66c] button {
27
- background-color: var(--core-bg-tertiary);
28
- }
29
20
  @media (prefers-reduced-motion: reduce) {
30
- .ck-feedback-button__thumb[data-v-c452d66c] button {
21
+ .ck-feedback-button__thumb[data-v-245705b8] {
31
22
  transition-duration: 0.01ms;
32
23
  }
33
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CkFeedbackButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackButton/CkFeedbackButton.vue"],"names":[],"mappings":"AAqKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAyRtE,QAAA,MAAM,YAAY;;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"CkFeedbackButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackButton/CkFeedbackButton.vue"],"names":[],"mappings":"AAqJA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiRtE,QAAA,MAAM,YAAY;;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -4,8 +4,8 @@ type __VLS_Slots = {} & {
4
4
  default?: (props: typeof __VLS_8) => any;
5
5
  };
6
6
  declare const __VLS_base: import("vue").DefineComponent<CkPromptActionButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CkPromptActionButtonProps> & Readonly<{}>, {
7
- disabled: boolean;
8
7
  type: "button" | "submit";
8
+ disabled: boolean;
9
9
  loading: boolean;
10
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
11
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -4,11 +4,19 @@ declare const meta: Meta<typeof CkConversation>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  /**
7
- * Drop-in conversation UI. Pass `messages` with `role`, `content`, and `status`
8
- * fields and CkConversation renders user bubbles, assistant markdown, avatars,
9
- * and a copy button on each reply.
7
+ * Drop-in conversation UI. Pass `messages` with `role`, `content` (a list of
8
+ * text / tool / reasoning parts), and `status` fields and CkConversation
9
+ * renders user bubbles, assistant markdown, avatars, and a copy button on
10
+ * each reply.
10
11
  */
11
12
  export declare const Default: Story;
13
+ /**
14
+ * Demonstrates a chain-of-thought assistant turn with reasoning and tool
15
+ * calls in `message.content`. By default only text parts are rendered, so
16
+ * use `#agent-message-content` to opt-in to a custom rendering of the
17
+ * non-text parts. The host owns the visual treatment for those segments.
18
+ */
19
+ export declare const ChainOfThought: Story;
12
20
  /**
13
21
  * Uses a remote avatar image (with fallback text). Use when you want a
14
22
  * branded agent identity in each reply.
@@ -1 +1 @@
1
- {"version":3,"file":"CkConversation.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkConversation/CkConversation.stories.ts"],"names":[],"mappings":"AAIA,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA8D3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAkCrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAiNnC;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAYtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,KASpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA8B/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAiBnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAiBpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAsFjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAmBvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAgDjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC"}
1
+ {"version":3,"file":"CkConversation.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkConversation/CkConversation.stories.ts"],"names":[],"mappings":"AAQA,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAiH3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAkCrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqTnC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAyB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAYtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,KASpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAmC/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAiBnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAiBpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA4GjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAmBvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAoDjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC"}
@@ -25,7 +25,11 @@ type __VLS_Slots = {
25
25
  'agent-message-header': (props: {
26
26
  message: BaseMessage;
27
27
  }) => void;
28
- /** Replace the agent message body */
28
+ /**
29
+ * Replace the agent message body. Receives the full `BaseMessage` so the
30
+ * consumer can inspect every content part (text, tool calls, reasoning)
31
+ * and render them however they want.
32
+ */
29
33
  'agent-message-content': (props: {
30
34
  message: BaseMessage;
31
35
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CkConversation.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkConversation/CkConversation.vue"],"names":[],"mappings":"AAsJA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAkBnD,KAAK,WAAW,GAAG;IACjB,gDAAgD;IAChD,cAAc,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1D,yDAAyD;IACzD,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,iDAAiD;IACjD,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,oCAAoC;IACpC,oBAAoB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,8EAA8E;IAC9E,4BAA4B,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,uCAAuC;IACvC,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,qCAAqC;IACrC,uBAAuB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,mDAAmD;IACnD,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,qEAAqE;IACrE,0BAA0B,EAAE,CAAC,KAAK,EAAE;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ,CAAC;AAoRF,QAAA,MAAM,UAAU;;;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CkConversation.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkConversation/CkConversation.vue"],"names":[],"mappings":"AAkKA,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAC;AAMtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAkBnD,KAAK,WAAW,GAAG;IACjB,gDAAgD;IAChD,cAAc,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1D,yDAAyD;IACzD,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAA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d, e, f, g, h, i, j, k, l, m, n, o, p } from "../CkInput.vue_vue_type_script_setup_true_lang-C5C09u0z.js";
2
2
  export {
3
3
  _ as CkAgentMessage,
4
4
  a as CkConversation,
@@ -1,4 +1,4 @@
1
- import { u, a, b } from "../useConversationSessions-ulFhtpQr.js";
1
+ import { u, a, b } from "../useConversationSessions-GLZV_Ctr.js";
2
2
  export {
3
3
  u as useChat,
4
4
  a as useConversationSessions,
@@ -1,3 +1,4 @@
1
+ import type { StoredResponse } from '../adapters/responses-api';
1
2
  import type { ConversationSummary, HttpClient } from '../services/types';
2
3
  import { type Ref } from 'vue';
3
4
  export interface UseConversationsOptions {
@@ -58,6 +59,17 @@ export interface UseConversationsReturn {
58
59
  remove(id: string, options?: MutationOptions): Promise<void>;
59
60
  /** Local lookup. Does not fetch — only checks the in-memory list. */
60
61
  getById(id: string): ConversationSummary | undefined;
62
+ /**
63
+ * List the OpenAI Responses-API records attached to a conversation. Pure
64
+ * fetch: it does not touch the conversations list. The endpoint is not
65
+ * paginated, so the returned array is the full timeline ordered by
66
+ * `created_at` (ascending by default). Pair with `responsesToTree` from
67
+ * `@aleph-alpha/chat-kit/adapters/responses-api` to hydrate a chat
68
+ * handler: `setTree(responsesToTree(await fetchResponses(id)))`.
69
+ */
70
+ fetchResponses(id: string, options?: {
71
+ order?: 'asc' | 'desc';
72
+ }): Promise<StoredResponse[]>;
61
73
  }
62
74
  /**
63
75
  * Reactive list of past conversations backed by an OpenAI-style REST API.
@@ -1 +1 @@
1
- {"version":3,"file":"useConversations.d.ts","sourceRoot":"","sources":["../../src/composables/useConversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAuC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAcpE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,UAAU,CAAC;IACvB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;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IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,qEAAqE;IACrE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;CACtD;AAID;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAgMxB"}
1
+ {"version":3,"file":"useConversations.d.ts","sourceRoot":"","sources":["../../src/composables/useConversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAuC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAcpE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,UAAU,CAAC;IACvB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC;2EACuE;IACvE,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC,CAAC;IAC7D;;;;OAIG;IACH,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,qEAAqE;IACrE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAChC,0EAA0E;IAC1E,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IACnC,oEAAoE;IACpE,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,kFAAkF;IAClF,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpD,oDAAoD;IACpD,MAAM,CACJ,KAAK,CAAC,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,+DAA+D;IAC/D,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,qDAAqD;IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,qEAAqE;IACrE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IACrD;;;;;;;OAOG;IACH,cAAc,CACZ,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,GACnC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAC9B;AAID;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAmNxB"}
Binary file
@@ -0,0 +1,6 @@
1
+ function generateId() {
2
+ return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : String(Date.now());
3
+ }
4
+ export {
5
+ generateId as g
6
+ };
@@ -1,4 +1,4 @@
1
- import { u } from "../useMessageHandler-BmBdu2EW.js";
1
+ import { u } from "../useMessageHandler-ZRC-gIOJ.js";
2
2
  import { C, d, p, u as u2, a } from "../useChatKitLabels-ftC52m7f.js";
3
3
  export {
4
4
  C as CHAT_KIT_LABELS,
@@ -1,4 +1,4 @@
1
- import type { BaseMessage, ConversationTree, MessageRole, MessageStatus } from '../types';
1
+ import type { BaseMessage, ConversationTree, MessageContent, MessageRole, MessageStatus } from '../types';
2
2
  import { type Ref } from 'vue';
3
3
  export declare const useMessageHandler: () => {
4
4
  messages: Ref<BaseMessage[]>;
@@ -6,7 +6,7 @@ export declare const useMessageHandler: () => {
6
6
  currentLeafId: import("vue").ComputedRef<string | null>;
7
7
  updateMessage: (message: {
8
8
  id: string;
9
- content: string;
9
+ content: MessageContent[];
10
10
  role: MessageRole;
11
11
  status: MessageStatus;
12
12
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/useMessageHandler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAElE,eAAO,MAAM,iBAAiB;cA0GJ,GAAG,CAAC,WAAW,EAAE,CAAC;;;6BA3DV;QAC9B,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,aAAa,CAAC;KACvB;kCAzCoC,MAAM;yBAiEf,MAAM,KAAG,WAAW,GAAG,SAAS;;6BAzD9B,WAAW;6BAqET,MAAM,SAAS,MAAM;;wBAQ1B,gBAAgB;yBAKf,MAAM;CAkBnC,CAAC"}
1
+ {"version":3,"file":"useMessageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/useMessageHandler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAElE,eAAO,MAAM,iBAAiB;cAuHJ,GAAG,CAAC,WAAW,EAAE,CAAC;;;6BApEV;QAC9B,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,IAAI,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,aAAa,CAAC;KACvB;kCA7CoC,MAAM;yBAqEf,MAAM,KAAG,WAAW,GAAG,SAAS;;6BA7D9B,WAAW;6BAyET,MAAM,SAAS,MAAM;;wBAiB1B,gBAAgB;yBAKf,MAAM;CAkBnC,CAAC"}