@aleph-alpha/chat-kit 1.0.0 → 1.2.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 (133) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-744ZHsQU.js → CkInput.vue_vue_type_script_setup_true_lang-CRymGkQs.js} +24 -69
  2. package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts +3 -4
  3. package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts.map +1 -1
  4. package/dist/components/base/CkHistoryItem/types.d.ts +3 -2
  5. package/dist/components/base/CkHistoryItem/types.d.ts.map +1 -1
  6. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
  7. package/dist/components/index.js +1 -1
  8. package/dist/composables/index.d.ts +2 -0
  9. package/dist/composables/index.d.ts.map +1 -1
  10. package/dist/composables/index.js +3 -2
  11. package/dist/composables/useConversationSessions.d.ts +29 -0
  12. package/dist/composables/useConversationSessions.d.ts.map +1 -0
  13. package/dist/handlers/index.js +2 -2
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +7 -6
  17. package/dist/purify.es-md74IFlY.js +1081 -0
  18. package/dist/{useChatKitLabels-Dvi2FmjE.js → useChatKitLabels-BmWmMyqX.js} +75 -1152
  19. package/dist/{useConversations-Ca242D2P.js → useConversationSessions-ulFhtpQr.js} +50 -2
  20. package/dist/{useMessageHandler-uLHNac39.js → useMessageHandler-BmBdu2EW.js} +4 -1
  21. package/package.json +5 -5
  22. package/src/components/base/CkAgentMessage/CkAgentMessage.spec.ts +91 -0
  23. package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +215 -0
  24. package/src/components/base/CkAgentMessage/CkAgentMessage.vue +25 -0
  25. package/src/components/base/CkAgentMessage/index.ts +2 -0
  26. package/src/components/base/CkAgentMessage/types.ts +11 -0
  27. package/src/components/base/CkConversationLayout/CkConversationLayout.spec.ts +129 -0
  28. package/src/components/base/CkConversationLayout/CkConversationLayout.stories.ts +251 -0
  29. package/src/components/base/CkConversationLayout/CkConversationLayout.vue +206 -0
  30. package/src/components/base/CkConversationLayout/index.ts +2 -0
  31. package/src/components/base/CkConversationLayout/types.ts +18 -0
  32. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.spec.ts +89 -0
  33. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts +70 -0
  34. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue +110 -0
  35. package/src/components/base/CkCopyMessageActionButton/index.ts +2 -0
  36. package/src/components/base/CkCopyMessageActionButton/types.ts +43 -0
  37. package/src/components/base/CkHistoryItem/CkHistoryItem.spec.ts +42 -0
  38. package/src/components/base/CkHistoryItem/CkHistoryItem.stories.ts +230 -0
  39. package/src/components/base/CkHistoryItem/CkHistoryItem.vue +285 -0
  40. package/src/components/base/CkHistoryItem/activeIndicator.ts +15 -0
  41. package/src/components/base/CkHistoryItem/index.ts +2 -0
  42. package/src/components/base/CkHistoryItem/types.ts +111 -0
  43. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.spec.ts +26 -0
  44. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.ts +149 -0
  45. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.vue +36 -0
  46. package/src/components/base/CkHistoryWrapper/index.ts +2 -0
  47. package/src/components/base/CkHistoryWrapper/types.ts +16 -0
  48. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +348 -0
  49. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +382 -0
  50. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +89 -0
  51. package/src/components/base/CkMarkdownRenderer/defaultMarkdownClasses.ts +19 -0
  52. package/src/components/base/CkMarkdownRenderer/index.ts +5 -0
  53. package/src/components/base/CkMarkdownRenderer/types.ts +53 -0
  54. package/src/components/base/CkMessageActionButton/CkMessageActionButton.spec.ts +40 -0
  55. package/src/components/base/CkMessageActionButton/CkMessageActionButton.stories.ts +56 -0
  56. package/src/components/base/CkMessageActionButton/CkMessageActionButton.vue +23 -0
  57. package/src/components/base/CkMessageActionButton/index.ts +2 -0
  58. package/src/components/base/CkMessageActionButton/types.ts +21 -0
  59. package/src/components/base/CkPromptActionButton/CkPromptActionButton.spec.ts +52 -0
  60. package/src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts +126 -0
  61. package/src/components/base/CkPromptActionButton/CkPromptActionButton.vue +25 -0
  62. package/src/components/base/CkPromptActionButton/index.ts +2 -0
  63. package/src/components/base/CkPromptActionButton/types.ts +32 -0
  64. package/src/components/base/CkPromptInput/CkPromptInput.spec.ts +181 -0
  65. package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +224 -0
  66. package/src/components/base/CkPromptInput/CkPromptInput.vue +104 -0
  67. package/src/components/base/CkPromptInput/index.ts +2 -0
  68. package/src/components/base/CkPromptInput/types.ts +39 -0
  69. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.spec.ts +40 -0
  70. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.ts +103 -0
  71. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue +16 -0
  72. package/src/components/base/CkPromptInputDisclaimer/index.ts +2 -0
  73. package/src/components/base/CkPromptInputDisclaimer/types.ts +17 -0
  74. package/src/components/base/CkPromptStopButton/CkPromptStopButton.spec.ts +64 -0
  75. package/src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts +81 -0
  76. package/src/components/base/CkPromptStopButton/CkPromptStopButton.vue +27 -0
  77. package/src/components/base/CkPromptStopButton/index.ts +2 -0
  78. package/src/components/base/CkPromptStopButton/types.ts +28 -0
  79. package/src/components/base/CkUserMessage/CkUserMessage.spec.ts +20 -0
  80. package/src/components/base/CkUserMessage/CkUserMessage.stories.ts +112 -0
  81. package/src/components/base/CkUserMessage/CkUserMessage.vue +19 -0
  82. package/src/components/base/CkUserMessage/index.ts +2 -0
  83. package/src/components/base/CkUserMessage/types.ts +14 -0
  84. package/src/components/base/icons/CkSendIcon.vue +22 -0
  85. package/src/components/base/icons/CkStopIcon.vue +18 -0
  86. package/src/components/base/icons/index.ts +2 -0
  87. package/src/components/base/index.ts +21 -0
  88. package/src/components/composed/CkConversation/CkConversation.spec.ts +439 -0
  89. package/src/components/composed/CkConversation/CkConversation.stories.ts +642 -0
  90. package/src/components/composed/CkConversation/CkConversation.vue +146 -0
  91. package/src/components/composed/CkConversation/index.ts +2 -0
  92. package/src/components/composed/CkConversation/types.ts +37 -0
  93. package/src/components/composed/CkHistory/CkHistory.spec.ts +327 -0
  94. package/src/components/composed/CkHistory/CkHistory.stories.ts +373 -0
  95. package/src/components/composed/CkHistory/CkHistory.vue +126 -0
  96. package/src/components/composed/CkHistory/index.ts +2 -0
  97. package/src/components/composed/CkHistory/types.ts +72 -0
  98. package/src/components/composed/CkInput/CkInput.spec.ts +191 -0
  99. package/src/components/composed/CkInput/CkInput.stories.ts +438 -0
  100. package/src/components/composed/CkInput/CkInput.vue +104 -0
  101. package/src/components/composed/CkInput/index.ts +2 -0
  102. package/src/components/composed/CkInput/types.ts +60 -0
  103. package/src/components/composed/index.ts +5 -0
  104. package/src/components/index.ts +34 -0
  105. package/src/composables/index.ts +15 -0
  106. package/src/composables/types.ts +36 -0
  107. package/src/composables/useChat.ts +18 -0
  108. package/src/composables/useConversationSessions.spec.ts +86 -0
  109. package/src/composables/useConversationSessions.ts +85 -0
  110. package/src/composables/useConversations.spec.ts +557 -0
  111. package/src/composables/useConversations.ts +321 -0
  112. package/src/handlers/index.ts +9 -0
  113. package/src/handlers/useChatKitLabels.spec.ts +290 -0
  114. package/src/handlers/useChatKitLabels.ts +96 -0
  115. package/src/handlers/useMarkdownParser.spec.ts +112 -0
  116. package/src/handlers/useMarkdownParser.ts +47 -0
  117. package/src/handlers/useMessageHandler.spec.ts +535 -0
  118. package/src/handlers/useMessageHandler.ts +138 -0
  119. package/src/helpers/conversationTree.spec.ts +423 -0
  120. package/src/helpers/conversationTree.ts +117 -0
  121. package/src/helpers/generateId.ts +5 -0
  122. package/src/helpers/index.ts +4 -0
  123. package/src/helpers/secondsToDate.ts +7 -0
  124. package/src/helpers/toError.ts +8 -0
  125. package/src/index.ts +86 -0
  126. package/src/services/ChatService.ts +60 -0
  127. package/src/services/MockChatService.ts +47 -0
  128. package/src/services/index.ts +12 -0
  129. package/src/services/types.ts +92 -0
  130. package/src/test-setup.ts +12 -0
  131. package/src/test-utils/createTextPlugin.ts +9 -0
  132. package/src/types.ts +47 -0
  133. package/dist/generateId-BHf0W4Rq.js +0 -6
@@ -1,6 +1,6 @@
1
- import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, Comment, cloneVNode, h, useAttrs, useSlots, computed, normalizeClass, withModifiers, resolveDynamicComponent, toRefs, useId, useTemplateRef, createTextVNode, createSlots, normalizeProps, guardReactiveProps } from "vue";
2
- import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-Dvi2FmjE.js";
3
- import { UiButton, UiTooltip, UiIcon, UiPopover, UiPopoverTrigger, UiPopoverContent, UiIconButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, useAttrs, useSlots, computed, normalizeClass, withModifiers, resolveDynamicComponent, toRefs, h, useId, useTemplateRef, createTextVNode, createSlots, normalizeProps, guardReactiveProps } from "vue";
2
+ import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-BmWmMyqX.js";
3
+ import { UiButton, UiTooltip, UiIcon, Primitive, UiPopover, UiPopoverTrigger, UiPopoverContent, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
4
4
  const _hoisted_1$8 = {
5
5
  xmlns: "http://www.w3.org/2000/svg",
6
6
  width: "16",
@@ -375,60 +375,6 @@ const _export_sfc = (sfc, props) => {
375
375
  return target;
376
376
  };
377
377
  const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-f77a1193"]]);
378
- function renderSlotFragments(children) {
379
- if (!children) return [];
380
- return children.flatMap((child) => {
381
- if (child.type === Fragment) return renderSlotFragments(child.children);
382
- return [child];
383
- });
384
- }
385
- const Slot = defineComponent({
386
- name: "PrimitiveSlot",
387
- inheritAttrs: false,
388
- setup(_, { attrs, slots }) {
389
- return () => {
390
- if (!slots.default) return null;
391
- const children = renderSlotFragments(slots.default());
392
- const firstNonCommentChildrenIndex = children.findIndex((child) => child.type !== Comment);
393
- if (firstNonCommentChildrenIndex === -1) return children;
394
- const firstNonCommentChildren = children[firstNonCommentChildrenIndex];
395
- delete firstNonCommentChildren.props?.ref;
396
- const mergedProps = firstNonCommentChildren.props ? mergeProps(attrs, firstNonCommentChildren.props) : attrs;
397
- const cloned = cloneVNode({
398
- ...firstNonCommentChildren,
399
- props: {}
400
- }, mergedProps);
401
- if (children.length === 1) return cloned;
402
- children[firstNonCommentChildrenIndex] = cloned;
403
- return children;
404
- };
405
- }
406
- });
407
- const SELF_CLOSING_TAGS = [
408
- "area",
409
- "img",
410
- "input"
411
- ];
412
- const Primitive = defineComponent({
413
- name: "Primitive",
414
- inheritAttrs: false,
415
- props: {
416
- asChild: {
417
- type: Boolean,
418
- default: false
419
- },
420
- as: {
421
- type: [String, Object],
422
- default: "div"
423
- }
424
- },
425
- setup(props, { attrs, slots }) {
426
- const asTag = props.asChild ? "template" : props.as;
427
- if (typeof asTag === "string" && SELF_CLOSING_TAGS.includes(asTag)) return () => h(asTag, attrs);
428
- if (asTag !== "template") return () => h(props.as, attrs, { default: slots.default });
429
- return () => h(Slot, attrs, { default: slots.default });
430
- }
431
- });
432
378
  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';
433
379
  const _hoisted_1$3 = ["data-active"];
434
380
  const _hoisted_2$2 = { class: "min-w-0 flex-1" };
@@ -472,9 +418,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
472
418
  actionPopoverSide: { default: "right" },
473
419
  actionPopoverAlign: { default: "start" },
474
420
  actionPopoverSideOffset: { default: 8 },
475
- actionPopoverContentClass: {},
476
- asChild: { type: Boolean },
477
- as: { default: "button" }
421
+ actionPopoverContentClass: {}
478
422
  },
479
423
  emits: ["action-click"],
480
424
  setup(__props, { emit: __emit }) {
@@ -512,10 +456,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
512
456
  // Whole-row focus ring: first tab lands on the main row control; second tab on the action button — both are inside this container.
513
457
  // `:has(:focus-visible)` instead of `:focus-within` so mouse clicks on the row don't flash a keyboard focus ring.
514
458
  "has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50",
515
- // Row hover/active tint — flat `default` hover-mix color. Hover is suppressed while the
516
- // pointer/focus is on the action column so the icon's own tint does not stack on top.
517
- props.isActive ? "bg-background-surface-primary-hover-default" : "",
518
- !pointerOnAction.value ? "hover:bg-background-surface-primary-hover-default" : "",
459
+ // Row hover/active fill. Hover is suppressed while the
460
+ // pointer/focus is on the action column so the icon's own fill does not stack on top.
461
+ (props.isActive || !pointerOnAction.value) && "hover:bg-background-surface-muted-subtle",
462
+ props.isActive && "bg-background-surface-muted-subtle",
519
463
  CHAT_HISTORY_ACTIVE_INDICATOR_CLASS
520
464
  ]);
521
465
  const itemClass = computed(() => [
@@ -541,16 +485,26 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
541
485
  "relative z-10 inline-flex size-8 shrink-0 items-center justify-center rounded-sm border border-transparent text-content-on-surface-primary outline-hidden transition-colors",
542
486
  "[&_svg]:size-4 [&_svg]:shrink-0",
543
487
  "focus-visible:ring-0 focus-visible:outline-none",
544
- pointerOnAction.value ? "bg-background-surface-primary-hover-default border-border-button-outlined" : ""
488
+ pointerOnAction.value && "bg-background-surface-muted-subtle border-border-button-outlined"
545
489
  ]);
546
490
  const actionPopoverPanelClass = computed(() => [
547
491
  "w-auto min-w-48 max-w-sm p-0 bg-background-surface-secondary",
548
492
  props.actionPopoverContentClass
549
493
  ]);
550
494
  const passthroughAttrs = computed(() => {
551
- const { class: _class, ...rest } = attrs;
495
+ const {
496
+ class: _class,
497
+ as: _as,
498
+ asChild: _asChild,
499
+ "as-child": _asChildAttr,
500
+ ...rest
501
+ } = attrs;
552
502
  return rest;
553
503
  });
504
+ const primitiveAs = computed(() => attrs.as ?? "button");
505
+ const primitiveAsChild = computed(
506
+ () => attrs.asChild === true || attrs.asChild === "" || attrs["as-child"] === true || attrs["as-child"] === ""
507
+ );
554
508
  function onActionClick(event) {
555
509
  event.stopPropagation();
556
510
  const el = event.currentTarget;
@@ -567,8 +521,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
567
521
  class: normalizeClass(containerClass.value)
568
522
  }, [
569
523
  createVNode(unref(Primitive), mergeProps(passthroughAttrs.value, {
570
- as: props.as,
571
- "as-child": props.asChild,
524
+ as: primitiveAs.value,
525
+ "as-child": primitiveAsChild.value,
572
526
  "data-active": props.isActive,
573
527
  class: itemClass.value
574
528
  }), {
@@ -823,7 +777,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
823
777
  setup(__props) {
824
778
  const props = __props;
825
779
  return (_ctx, _cache) => {
826
- return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
780
+ return openBlock(), createBlock(unref(UiButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
781
+ size: "icon-sm",
827
782
  disabled: props.disabled,
828
783
  class: "!bg-brand-bg-brand hover:!bg-brand-bg-brand-hover !text-brand-content-default !rounded-md",
829
784
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
@@ -1,13 +1,13 @@
1
- import type { CkHistoryItemProps } from './types';
1
+ import type { CkHistoryItemOwnProps } from './types';
2
2
  declare var __VLS_7: {}, __VLS_37: {};
3
3
  type __VLS_Slots = {} & {
4
4
  meta?: (props: typeof __VLS_7) => any;
5
5
  } & {
6
6
  'action-popover'?: (props: typeof __VLS_37) => any;
7
7
  };
8
- declare const __VLS_base: import("vue").DefineComponent<CkHistoryItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ declare const __VLS_base: import("vue").DefineComponent<CkHistoryItemOwnProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  "action-click": (event: MouseEvent) => any;
10
- }, string, import("vue").PublicProps, Readonly<CkHistoryItemProps> & Readonly<{
10
+ }, string, import("vue").PublicProps, Readonly<CkHistoryItemOwnProps> & Readonly<{
11
11
  "onAction-click"?: ((event: MouseEvent) => any) | undefined;
12
12
  }>, {
13
13
  isActive: boolean;
@@ -19,7 +19,6 @@ declare const __VLS_base: import("vue").DefineComponent<CkHistoryItemProps, {},
19
19
  actionPopoverSide: "top" | "right" | "bottom" | "left";
20
20
  actionPopoverAlign: "start" | "center" | "end";
21
21
  actionPopoverSideOffset: number;
22
- as: import("reka-ui").AsTag | import("vue").Component;
23
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
23
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
24
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"CkHistoryItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.vue"],"names":[],"mappings":"AA8RA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA6ctE,QAAA,IAAI,OAAO,IAAU,EAAE,QAAQ,IAAY,CAAE;AAC7C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACzC;IAAE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKzD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;6EAId,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":"CkHistoryItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.vue"],"names":[],"mappings":"AA0SA,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA0dzE,QAAA,IAAI,OAAO,IAAU,EAAE,QAAQ,IAAY,CAAE;AAC7C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACzC;IAAE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKzD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;6EAId,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,5 +1,5 @@
1
1
  import type { Component, HTMLAttributes } from 'vue';
2
- import type { PrimitiveProps } from 'reka-ui';
2
+ import type { PrimitiveProps } from '@aleph-alpha/ui-library';
3
3
  /**
4
4
  * A single chat history entry with title, optional meta line, active
5
5
  * indicator, and a trailing action control (plain button or popover).
@@ -10,7 +10,8 @@ import type { PrimitiveProps } from 'reka-ui';
10
10
  * @keywords chat, history, item, row, conversation, thread
11
11
  * @related CkHistoryWrapper
12
12
  */
13
- export interface CkHistoryItemProps extends PrimitiveProps {
13
+ export type CkHistoryItemProps = PrimitiveProps & CkHistoryItemOwnProps;
14
+ export interface CkHistoryItemOwnProps {
14
15
  /**
15
16
  * Main title of the history item.
16
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAExD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEhD;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,yBAAyB,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACrC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAExE,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAExD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEhD;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,yBAAyB,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CkPromptStopButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptStopButton/CkPromptStopButton.vue"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AA2EvD,QAAA,IAAI,QAAQ,IAAW,CAAE;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU;;;;;;;6EAId,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":"CkPromptStopButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptStopButton/CkPromptStopButton.vue"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AA6EvD,QAAA,IAAI,QAAQ,IAAW,CAAE;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU;;;;;;;6EAId,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,4 +1,4 @@
1
- import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o } from "../CkInput.vue_vue_type_script_setup_true_lang-744ZHsQU.js";
1
+ import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o } from "../CkInput.vue_vue_type_script_setup_true_lang-CRymGkQs.js";
2
2
  export {
3
3
  _ as CkAgentMessage,
4
4
  a as CkConversation,
@@ -1,5 +1,7 @@
1
1
  export { useChat } from './useChat';
2
2
  export { useConversations } from './useConversations';
3
3
  export type { CreateConversationInput, MutationOptions, UseConversationsOptions, UseConversationsReturn, } from './useConversations';
4
+ export { useConversationSessions } from './useConversationSessions';
5
+ export type { ConversationSession, MessageHandler, UseConversationSessionsReturn, } from './useConversationSessions';
4
6
  export type { ChatActions, ChatState, UseChatReturn } from './types';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -1,5 +1,6 @@
1
- import { u, a } from "../useConversations-Ca242D2P.js";
1
+ import { u, a, b } from "../useConversationSessions-ulFhtpQr.js";
2
2
  export {
3
3
  u as useChat,
4
- a as useConversations
4
+ a as useConversationSessions,
5
+ b as useConversations
5
6
  };
@@ -0,0 +1,29 @@
1
+ import { useMessageHandler } from '../handlers';
2
+ import { type ComputedRef } from 'vue';
3
+ export type MessageHandler = ReturnType<typeof useMessageHandler>;
4
+ /** One conversation’s runtime message tree (`useMessageHandler` per id). */
5
+ export interface ConversationSession {
6
+ readonly id: string;
7
+ readonly messageHandler: MessageHandler;
8
+ }
9
+ /**
10
+ * Per-conversation `useMessageHandler` instances; `setActiveConversation` picks
11
+ * which session is exposed as `activeSession` / `messageHandler`.
12
+ */
13
+ export interface UseConversationSessionsReturn {
14
+ /** Focused session, or `null`. */
15
+ activeSession: ComputedRef<ConversationSession | null>;
16
+ /** `activeSession?.messageHandler`, or `null`. */
17
+ messageHandler: ComputedRef<MessageHandler | null>;
18
+ /** Get or create a session for `conversationId` (idempotent). */
19
+ createSession: (conversationId: string) => ConversationSession;
20
+ /** Session if it exists; does not create. */
21
+ getSession: (conversationId: string) => ConversationSession | undefined;
22
+ /** Focus `conversationId` (creates session if needed), or `null` to unfocus. */
23
+ setActiveConversation: (conversationId: string | null) => void;
24
+ /** Remove session; clears focus if it was active. */
25
+ removeSession: (conversationId: string) => void;
26
+ }
27
+ /** Registry of sessions by id (plain `Map` so nested refs stay valid). */
28
+ export declare function useConversationSessions(): UseConversationSessionsReturn;
29
+ //# sourceMappingURL=useConversationSessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConversationSessions.d.ts","sourceRoot":"","sources":["../../src/composables/useConversationSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAiB,KAAK,WAAW,EAAY,MAAM,KAAK,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,kCAAkC;IAClC,aAAa,EAAE,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACvD,kDAAkD;IAClD,cAAc,EAAE,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,iEAAiE;IACjE,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,mBAAmB,CAAC;IAC/D,6CAA6C;IAC7C,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,mBAAmB,GAAG,SAAS,CAAC;IACxE,gFAAgF;IAChF,qBAAqB,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/D,qDAAqD;IACrD,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,0EAA0E;AAC1E,wBAAgB,uBAAuB,IAAI,6BAA6B,CAqDvE"}
@@ -1,5 +1,5 @@
1
- import { u } from "../useMessageHandler-uLHNac39.js";
2
- import { C, d, p, u as u2, a } from "../useChatKitLabels-Dvi2FmjE.js";
1
+ import { u } from "../useMessageHandler-BmBdu2EW.js";
2
+ import { C, d, p, u as u2, a } from "../useChatKitLabels-BmWmMyqX.js";
3
3
  export {
4
4
  C as CHAT_KIT_LABELS,
5
5
  d as defaultChatKitLabels,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { ChatService, type IChatService, type ChatConfig, type ChatMessage, type ChatResponse, type ConversationSummary, type HttpClient, type RawConversation, type RawConversationList, type StreamEvent, } from './services';
2
2
  export { useMessageHandler, useMarkdownParser, provideChatKitLabels, useChatKitLabels, defaultChatKitLabels, CHAT_KIT_LABELS, } from './handlers';
3
3
  export type { ChatKitLabels } from './handlers';
4
- export { useChat, useConversations } from './composables';
5
- export type { ChatActions, ChatState, CreateConversationInput, MutationOptions, UseChatReturn, UseConversationsOptions, UseConversationsReturn, } from './composables';
4
+ export { useChat, useConversationSessions, useConversations, } from './composables';
5
+ export type { ChatActions, ChatState, ConversationSession, CreateConversationInput, MessageHandler, MutationOptions, UseChatReturn, UseConversationSessionsReturn, UseConversationsOptions, UseConversationsReturn, } from './composables';
6
6
  export { CkAgentMessage, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
7
7
  export type { CkConversationLayoutProps, CkConversationProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './components';
8
8
  export type { BaseMessage, Conversation, ConversationTree, MessageRole, MessageStatus, TreeMessage, } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EACV,WAAW,EACX,SAAS,EACT,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { C } from "./ChatService-LogwJNxh.js";
2
- import { u } from "./useMessageHandler-uLHNac39.js";
3
- import { C as C2, d, p, u as u2, a } from "./useChatKitLabels-Dvi2FmjE.js";
4
- import { u as u3, a as a2 } from "./useConversations-Ca242D2P.js";
5
- import { _, a as a3, b, C as C3, c, d as d2, e, f, g, h, i, j, k, l, m, n, o } from "./CkInput.vue_vue_type_script_setup_true_lang-744ZHsQU.js";
2
+ import { u } from "./useMessageHandler-BmBdu2EW.js";
3
+ import { C as C2, d, p, u as u2, a } from "./useChatKitLabels-BmWmMyqX.js";
4
+ import { u as u3, a as a2, b } from "./useConversationSessions-ulFhtpQr.js";
5
+ import { _, a as a3, b as b2, C as C3, c, d as d2, e, f, g, h, i, j, k, l, m, n, o } from "./CkInput.vue_vue_type_script_setup_true_lang-CRymGkQs.js";
6
6
  export {
7
7
  C2 as CHAT_KIT_LABELS,
8
8
  C as ChatService,
9
9
  _ as CkAgentMessage,
10
10
  a3 as CkConversation,
11
- b as CkConversationLayout,
11
+ b2 as CkConversationLayout,
12
12
  C3 as CkCopyMessageActionButton,
13
13
  c as CkHistory,
14
14
  d2 as CkHistoryItem,
@@ -27,7 +27,8 @@ export {
27
27
  p as provideChatKitLabels,
28
28
  u3 as useChat,
29
29
  u2 as useChatKitLabels,
30
- a2 as useConversations,
30
+ a2 as useConversationSessions,
31
+ b as useConversations,
31
32
  a as useMarkdownParser,
32
33
  u as useMessageHandler
33
34
  };