@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/chatkit.cjs CHANGED
@@ -48,7 +48,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
48
48
  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);
49
49
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
50
50
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
51
- 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;
51
+ 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;
52
52
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
53
53
  const chatkitTypes = require("@xpert-ai/chatkit-types");
54
54
  class EventEmitter {
@@ -699,6 +699,7 @@ const BASE_CAPABILITY_ALLOWLIST = [
699
699
  "command.setOptions",
700
700
  "command.sendUserMessage",
701
701
  "command.setComposerValue",
702
+ "command.setRuntimeCapabilities",
702
703
  "command.setThreadId",
703
704
  "command.focusComposer",
704
705
  "command.fetchUpdates",
@@ -2334,7 +2335,7 @@ function requireCommandCapability(value, context) {
2334
2335
  return value.apply(this, args);
2335
2336
  };
2336
2337
  }
2337
- 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) {
2338
+ 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) {
2338
2339
  constructor({ profile }) {
2339
2340
  super();
2340
2341
  __runInitializers(_init, 5, this);
@@ -2406,6 +2407,38 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2406
2407
  }
2407
2408
  return onClientTool({ name, params, id, tool_call_id });
2408
2409
  },
2410
+ onToolOutputAttachmentPreview: async (request) => {
2411
+ var _a2, _b2;
2412
+ const onRequestPreview = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.toolOutputAttachments) == null ? void 0 : _b2.onRequestPreview;
2413
+ if (!onRequestPreview) {
2414
+ __privateMethod(this, _ChatKitElementBase_instances, emitAndThrow_fn).call(this, new IntegrationError2(
2415
+ "No handler for tool-output attachment previews. Add toolOutputAttachments.onRequestPreview to your ChatKit options."
2416
+ ));
2417
+ }
2418
+ return onRequestPreview(request);
2419
+ },
2420
+ onWorkbenchClientCommand: async ({
2421
+ commandKey,
2422
+ payload,
2423
+ hostType,
2424
+ hostId,
2425
+ viewKey
2426
+ }) => {
2427
+ var _a2, _b2;
2428
+ const onClientCommand = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.workbench) == null ? void 0 : _b2.onClientCommand;
2429
+ if (!onClientCommand) {
2430
+ __privateMethod(this, _ChatKitElementBase_instances, emitAndThrow_fn).call(this, new IntegrationError2(
2431
+ `No handler for workbench client command "${commandKey}". Add workbench.onClientCommand to your ChatKit options.`
2432
+ ));
2433
+ }
2434
+ return onClientCommand({
2435
+ commandKey,
2436
+ payload,
2437
+ hostType,
2438
+ hostId,
2439
+ viewKey
2440
+ });
2441
+ },
2409
2442
  onWidgetAction: async ({
2410
2443
  action,
2411
2444
  widgetItem
@@ -2776,6 +2809,11 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2776
2809
  await __privateGet(this, _loaded);
2777
2810
  await ((_a2 = __privateGet(this, _messenger)) == null ? void 0 : _a2.commands.setComposerValue(params));
2778
2811
  }
2812
+ async setRuntimeCapabilities(selection) {
2813
+ var _a2;
2814
+ await __privateGet(this, _loaded);
2815
+ await ((_a2 = __privateGet(this, _messenger)) == null ? void 0 : _a2.commands.setRuntimeCapabilities(selection));
2816
+ }
2779
2817
  async setThreadId(threadId) {
2780
2818
  var _a2;
2781
2819
  await __privateGet(this, _loaded);
@@ -3043,6 +3081,7 @@ __decorateElement(_init, 1, "focusComposer", _focusComposer_dec, ChatKitElementB
3043
3081
  __decorateElement(_init, 1, "fetchUpdates", _fetchUpdates_dec, ChatKitElementBase);
3044
3082
  __decorateElement(_init, 1, "sendUserMessage", _sendUserMessage_dec, ChatKitElementBase);
3045
3083
  __decorateElement(_init, 1, "setComposerValue", _setComposerValue_dec, ChatKitElementBase);
3084
+ __decorateElement(_init, 1, "setRuntimeCapabilities", _setRuntimeCapabilities_dec, ChatKitElementBase);
3046
3085
  __decorateElement(_init, 1, "setThreadId", _setThreadId_dec, ChatKitElementBase);
3047
3086
  __decorateElement(_init, 1, "shareThread", _shareThread_dec, ChatKitElementBase);
3048
3087
  __decorateElement(_init, 1, "sendCustomAction", _sendCustomAction_dec, ChatKitElementBase);
@@ -3267,6 +3306,9 @@ const ChatKit = ControlBase.extend("xpertai.chatkit.ui5.ChatKit", {
3267
3306
  setComposerValue(...args) {
3268
3307
  return this._callMethod("setComposerValue", ...args);
3269
3308
  },
3309
+ setRuntimeCapabilities(...args) {
3310
+ return this._callMethod("setRuntimeCapabilities", ...args);
3311
+ },
3270
3312
  fetchUpdates(...args) {
3271
3313
  return this._callMethod("fetchUpdates", ...args);
3272
3314
  },