@get-bb/plugin-sdk 0.4.108 → 0.5.9

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.
@@ -4282,6 +4282,23 @@ function shouldAutoDenyInteractiveRequest(policy) {
4282
4282
  return policy.permissionEscalation === "deny";
4283
4283
  }
4284
4284
 
4285
+ // ../text-utils/src/utf16.ts
4286
+ function isHighSurrogateAt(value, index) {
4287
+ const code = value.charCodeAt(index);
4288
+ return code >= 55296 && code <= 56319;
4289
+ }
4290
+ function isLowSurrogateAt(value, index) {
4291
+ const code = value.charCodeAt(index);
4292
+ return code >= 56320 && code <= 57343;
4293
+ }
4294
+ function sliceUtf16Head(value, maxChars) {
4295
+ let end = Math.min(value.length, Math.max(0, maxChars));
4296
+ if (isHighSurrogateAt(value, end - 1) && isLowSurrogateAt(value, end)) {
4297
+ end -= 1;
4298
+ }
4299
+ return value.slice(0, end);
4300
+ }
4301
+
4285
4302
  // ../provider-bridge-protocol/src/bridge-kit/presentation.ts
4286
4303
  var PRESENTATION_TITLE_MAX_LENGTH = 160;
4287
4304
  function presentationTitle(text) {
@@ -4289,10 +4306,10 @@ function presentationTitle(text) {
4289
4306
  if (firstLine2.length === 0) {
4290
4307
  return void 0;
4291
4308
  }
4292
- return firstLine2.length > PRESENTATION_TITLE_MAX_LENGTH ? `${firstLine2.slice(0, PRESENTATION_TITLE_MAX_LENGTH - 1)}\u2026` : firstLine2;
4309
+ return firstLine2.length > PRESENTATION_TITLE_MAX_LENGTH ? `${sliceUtf16Head(firstLine2, PRESENTATION_TITLE_MAX_LENGTH - 1)}\u2026` : firstLine2;
4293
4310
  }
4294
4311
  function presentationDetail(text) {
4295
- return text.length > THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH ? `${text.slice(0, THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH - 1)}\u2026` : text;
4312
+ return text.length > THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH ? `${sliceUtf16Head(text, THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH - 1)}\u2026` : text;
4296
4313
  }
4297
4314
  function withTitle(presentation, title) {
4298
4315
  return title === void 0 ? presentation : { ...presentation, title };