@xpert-ai/chatkit-ui5 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
47
47
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
48
48
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
49
49
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
50
- var _a, _b, _setTrainingOptOut_dec, _hideHistory_dec, _showHistory_dec, _sendCustomAction_dec, _shareThread_dec, _setThreadId_dec, _setComposerValue_dec, _sendUserMessage_dec, _fetchUpdates_dec, _focusComposer_dec, _c, _opts, _frameUrl, _frame, _wrapper, _launcherCloseButton, _launcherOpen, _chatMinimizedToPet, _framePetOptionsOverride, _petClosedByContextMenu, _shadow, _petOverlay, _resolveLoaded, _loaded, _messenger, _ChatKitElementBase_instances, emitAndThrow_fn, setOptionsDataAttributes_fn, getDisplayMode_fn, getConfiguredPetOptions_fn, mergeConfiguredPetPositionDefaults_fn, getOverlayPetOptions_fn, resolvePetAssetUrl_fn, resolveOverlayPetOptions_fn, getFrameOptions_fn, setLauncherOpen_fn, setChatMinimizedToPet_fn, syncPetOverlayOptions_fn, handlePetActivate_fn, handlePetClose_fn, handlePetReply_fn, handlePetThreadSummaryActivate_fn, _handleLauncherClose, getFrameUrl_fn, setFrameUrl_fn, consumeFrameUrl_fn, _handleFrameLoad, _initialized, maybeInit_fn, _init;
50
+ var _a, _b, _setTrainingOptOut_dec, _hideHistory_dec, _showHistory_dec, _sendCustomAction_dec, _shareThread_dec, _setThreadId_dec, _setRuntimeCapabilities_dec, _setComposerValue_dec, _sendUserMessage_dec, _fetchUpdates_dec, _focusComposer_dec, _c, _opts, _frameUrl, _frame, _wrapper, _launcherCloseButton, _launcherOpen, _chatMinimizedToPet, _framePetOptionsOverride, _petClosedByContextMenu, _shadow, _petOverlay, _resolveLoaded, _loaded, _messenger, _ChatKitElementBase_instances, emitAndThrow_fn, setOptionsDataAttributes_fn, getDisplayMode_fn, getConfiguredPetOptions_fn, mergeConfiguredPetPositionDefaults_fn, getOverlayPetOptions_fn, resolvePetAssetUrl_fn, resolveOverlayPetOptions_fn, getFrameOptions_fn, setLauncherOpen_fn, setChatMinimizedToPet_fn, syncPetOverlayOptions_fn, handlePetActivate_fn, handlePetClose_fn, handlePetReply_fn, handlePetThreadSummaryActivate_fn, _handleLauncherClose, getFrameUrl_fn, setFrameUrl_fn, consumeFrameUrl_fn, _handleFrameLoad, _initialized, maybeInit_fn, _init;
51
51
  import { normalizePetOptions, DEFAULT_PET_STORAGE_KEY, resolvePetCharacter, normalizeBoundsPadding, getPinnedPetPosition, clampPetPosition } from "@xpert-ai/chatkit-types";
52
52
  class EventEmitter {
53
53
  constructor() {
@@ -697,6 +697,7 @@ const BASE_CAPABILITY_ALLOWLIST = [
697
697
  "command.setOptions",
698
698
  "command.sendUserMessage",
699
699
  "command.setComposerValue",
700
+ "command.setRuntimeCapabilities",
700
701
  "command.setThreadId",
701
702
  "command.focusComposer",
702
703
  "command.fetchUpdates",
@@ -2332,7 +2333,7 @@ function requireCommandCapability(value, context) {
2332
2333
  return value.apply(this, args);
2333
2334
  };
2334
2335
  }
2335
- class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requireCommandCapability], _fetchUpdates_dec = [requireCommandCapability], _sendUserMessage_dec = [requireCommandCapability], _setComposerValue_dec = [requireCommandCapability], _setThreadId_dec = [requireCommandCapability], _shareThread_dec = [requireCommandCapability], _sendCustomAction_dec = [requireCommandCapability], _showHistory_dec = [requireCommandCapability], _hideHistory_dec = [requireCommandCapability], _setTrainingOptOut_dec = [requireCommandCapability], _c) {
2336
+ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requireCommandCapability], _fetchUpdates_dec = [requireCommandCapability], _sendUserMessage_dec = [requireCommandCapability], _setComposerValue_dec = [requireCommandCapability], _setRuntimeCapabilities_dec = [requireCommandCapability], _setThreadId_dec = [requireCommandCapability], _shareThread_dec = [requireCommandCapability], _sendCustomAction_dec = [requireCommandCapability], _showHistory_dec = [requireCommandCapability], _hideHistory_dec = [requireCommandCapability], _setTrainingOptOut_dec = [requireCommandCapability], _c) {
2336
2337
  constructor({ profile }) {
2337
2338
  super();
2338
2339
  __runInitializers(_init, 5, this);
@@ -2404,6 +2405,38 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2404
2405
  }
2405
2406
  return onClientTool({ name, params, id, tool_call_id });
2406
2407
  },
2408
+ onToolOutputAttachmentPreview: async (request) => {
2409
+ var _a2, _b2;
2410
+ const onRequestPreview = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.toolOutputAttachments) == null ? void 0 : _b2.onRequestPreview;
2411
+ if (!onRequestPreview) {
2412
+ __privateMethod(this, _ChatKitElementBase_instances, emitAndThrow_fn).call(this, new IntegrationError2(
2413
+ "No handler for tool-output attachment previews. Add toolOutputAttachments.onRequestPreview to your ChatKit options."
2414
+ ));
2415
+ }
2416
+ return onRequestPreview(request);
2417
+ },
2418
+ onWorkbenchClientCommand: async ({
2419
+ commandKey,
2420
+ payload,
2421
+ hostType,
2422
+ hostId,
2423
+ viewKey
2424
+ }) => {
2425
+ var _a2, _b2;
2426
+ const onClientCommand = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.workbench) == null ? void 0 : _b2.onClientCommand;
2427
+ if (!onClientCommand) {
2428
+ __privateMethod(this, _ChatKitElementBase_instances, emitAndThrow_fn).call(this, new IntegrationError2(
2429
+ `No handler for workbench client command "${commandKey}". Add workbench.onClientCommand to your ChatKit options.`
2430
+ ));
2431
+ }
2432
+ return onClientCommand({
2433
+ commandKey,
2434
+ payload,
2435
+ hostType,
2436
+ hostId,
2437
+ viewKey
2438
+ });
2439
+ },
2407
2440
  onWidgetAction: async ({
2408
2441
  action,
2409
2442
  widgetItem
@@ -2774,6 +2807,11 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2774
2807
  await __privateGet(this, _loaded);
2775
2808
  await ((_a2 = __privateGet(this, _messenger)) == null ? void 0 : _a2.commands.setComposerValue(params));
2776
2809
  }
2810
+ async setRuntimeCapabilities(selection) {
2811
+ var _a2;
2812
+ await __privateGet(this, _loaded);
2813
+ await ((_a2 = __privateGet(this, _messenger)) == null ? void 0 : _a2.commands.setRuntimeCapabilities(selection));
2814
+ }
2777
2815
  async setThreadId(threadId) {
2778
2816
  var _a2;
2779
2817
  await __privateGet(this, _loaded);
@@ -3041,6 +3079,7 @@ __decorateElement(_init, 1, "focusComposer", _focusComposer_dec, ChatKitElementB
3041
3079
  __decorateElement(_init, 1, "fetchUpdates", _fetchUpdates_dec, ChatKitElementBase);
3042
3080
  __decorateElement(_init, 1, "sendUserMessage", _sendUserMessage_dec, ChatKitElementBase);
3043
3081
  __decorateElement(_init, 1, "setComposerValue", _setComposerValue_dec, ChatKitElementBase);
3082
+ __decorateElement(_init, 1, "setRuntimeCapabilities", _setRuntimeCapabilities_dec, ChatKitElementBase);
3044
3083
  __decorateElement(_init, 1, "setThreadId", _setThreadId_dec, ChatKitElementBase);
3045
3084
  __decorateElement(_init, 1, "shareThread", _shareThread_dec, ChatKitElementBase);
3046
3085
  __decorateElement(_init, 1, "sendCustomAction", _sendCustomAction_dec, ChatKitElementBase);
@@ -3265,6 +3304,9 @@ const ChatKit = ControlBase.extend("xpertai.chatkit.ui5.ChatKit", {
3265
3304
  setComposerValue(...args) {
3266
3305
  return this._callMethod("setComposerValue", ...args);
3267
3306
  },
3307
+ setRuntimeCapabilities(...args) {
3308
+ return this._callMethod("setRuntimeCapabilities", ...args);
3309
+ },
3268
3310
  fetchUpdates(...args) {
3269
3311
  return this._callMethod("fetchUpdates", ...args);
3270
3312
  },