@get-bb/plugin-sdk 0.6.164 → 0.6.169

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.
@@ -2529,20 +2529,19 @@ function normalizeInteractionRequest(request) {
2529
2529
  `ui.requestInput title must be 1-${PLUGIN_INTERACTION_MAX_TITLE_LENGTH} characters`
2530
2530
  );
2531
2531
  }
2532
- let payload;
2532
+ let json;
2533
2533
  try {
2534
- const json = JSON.stringify(request.payload);
2535
- if (json === void 0) throw new Error();
2536
- if (Buffer.byteLength(json, "utf8") > PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES) {
2537
- throw new Error("ui.requestInput payload exceeds 64 KiB");
2538
- }
2539
- payload = JSON.parse(json);
2540
- } catch (error) {
2541
- if (error instanceof Error && error.message.includes("64 KiB")) {
2542
- throw error;
2543
- }
2534
+ json = JSON.stringify(request.payload);
2535
+ } catch {
2544
2536
  throw new Error("ui.requestInput payload must be JSON-serializable");
2545
2537
  }
2538
+ if (json === void 0) {
2539
+ throw new Error("ui.requestInput payload must be JSON-serializable");
2540
+ }
2541
+ if (Buffer.byteLength(json, "utf8") > PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES) {
2542
+ throw new Error("ui.requestInput payload exceeds 64 KiB");
2543
+ }
2544
+ const payload = JSON.parse(json);
2546
2545
  const timeoutMs = request.timeoutMs ?? 10 * 60 * 1e3;
2547
2546
  if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > PLUGIN_INTERACTION_MAX_TIMEOUT_MS) {
2548
2547
  throw new Error(
@@ -41,7 +41,7 @@ function adaptSidebarFooterAction(registration) {
41
41
  label: registration.title,
42
42
  icon: registration.icon,
43
43
  kind: "action",
44
- onActivate: ({ openPluginDetails }) => registration.run({ openSettings: openPluginDetails }),
44
+ onActivate: ({ openPluginDetails, ...context }) => registration.run({ ...context, openSettings: openPluginDetails }),
45
45
  runtime: new SidebarFooterItemRuntime()
46
46
  };
47
47
  }
@@ -416,6 +416,14 @@ function checkStaleNavPanelKeys(kind, registration, onWarning) {
416
416
  }
417
417
  }
418
418
  }
419
+ function readLegacyCardSectionTitle(kind, registration, onWarning) {
420
+ const title = "title" in registration ? registration.title : void 0;
421
+ if (typeof title !== "string" || title === "") return null;
422
+ onWarning(
423
+ `${kind}: "title" is retired; render experimental_InfoSection from the component instead.`
424
+ );
425
+ return title;
426
+ }
419
427
  function createCommandShortcutSchema() {
420
428
  return z.object({
421
429
  key: z.string().min(1).max(32).refine(
@@ -1031,10 +1039,14 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
1031
1039
  requireUniqueId(kind, seenIds.threadContextCardSection, id);
1032
1040
  collected.threadContextCardSections.push({
1033
1041
  id,
1034
- title: requireNonEmptyString(kind, "title", registration.title),
1035
1042
  group: requireNonEmptyString(kind, "group", registration.group),
1036
1043
  ...requireOptionalOrder(kind, registration.order),
1037
- component: requireComponent(kind, registration.component)
1044
+ component: requireComponent(kind, registration.component),
1045
+ legacyTitle: readLegacyCardSectionTitle(
1046
+ kind,
1047
+ registration,
1048
+ onWarning
1049
+ )
1038
1050
  });
1039
1051
  },
1040
1052
  experimental_threadAction(registration) {
@@ -4043,7 +4043,7 @@ function adaptSidebarFooterAction(registration) {
4043
4043
  label: registration.title,
4044
4044
  icon: registration.icon,
4045
4045
  kind: "action",
4046
- onActivate: ({ openPluginDetails }) => registration.run({ openSettings: openPluginDetails }),
4046
+ onActivate: ({ openPluginDetails, ...context }) => registration.run({ ...context, openSettings: openPluginDetails }),
4047
4047
  runtime: new SidebarFooterItemRuntime()
4048
4048
  };
4049
4049
  }
@@ -4167,6 +4167,14 @@ function checkStaleNavPanelKeys(kind, registration, onWarning) {
4167
4167
  }
4168
4168
  }
4169
4169
  }
4170
+ function readLegacyCardSectionTitle(kind, registration, onWarning) {
4171
+ const title = "title" in registration ? registration.title : void 0;
4172
+ if (typeof title !== "string" || title === "") return null;
4173
+ onWarning(
4174
+ `${kind}: "title" is retired; render experimental_InfoSection from the component instead.`
4175
+ );
4176
+ return title;
4177
+ }
4170
4178
  function createCommandShortcutSchema() {
4171
4179
  return z22.object({
4172
4180
  key: z22.string().min(1).max(32).refine(
@@ -4782,10 +4790,14 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
4782
4790
  requireUniqueId(kind, seenIds.threadContextCardSection, id);
4783
4791
  collected.threadContextCardSections.push({
4784
4792
  id,
4785
- title: requireNonEmptyString(kind, "title", registration.title),
4786
4793
  group: requireNonEmptyString(kind, "group", registration.group),
4787
4794
  ...requireOptionalOrder(kind, registration.order),
4788
- component: requireComponent(kind, registration.component)
4795
+ component: requireComponent(kind, registration.component),
4796
+ legacyTitle: readLegacyCardSectionTitle(
4797
+ kind,
4798
+ registration,
4799
+ onWarning
4800
+ )
4789
4801
  });
4790
4802
  },
4791
4803
  experimental_threadAction(registration) {
@@ -7197,7 +7209,11 @@ ${block}
7197
7209
  realtimeHandlers,
7198
7210
  realtimeConnection,
7199
7211
  settingsState: { values: options.settings, isLoading: false },
7200
- bbContext: { projectId, threadId },
7212
+ bbContext: {
7213
+ projectId,
7214
+ threadId,
7215
+ experimental_pluginPanel: options.context?.experimental_pluginPanel ?? null
7216
+ },
7201
7217
  pluginId: options.pluginId ?? "test-plugin",
7202
7218
  questionFormHost: {
7203
7219
  shortcuts: /* @__PURE__ */ new Map(),
@@ -2650,20 +2650,19 @@ function normalizeInteractionRequest(request) {
2650
2650
  `ui.requestInput title must be 1-${PLUGIN_INTERACTION_MAX_TITLE_LENGTH} characters`
2651
2651
  );
2652
2652
  }
2653
- let payload;
2653
+ let json;
2654
2654
  try {
2655
- const json = JSON.stringify(request.payload);
2656
- if (json === void 0) throw new Error();
2657
- if (Buffer.byteLength(json, "utf8") > PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES) {
2658
- throw new Error("ui.requestInput payload exceeds 64 KiB");
2659
- }
2660
- payload = JSON.parse(json);
2661
- } catch (error) {
2662
- if (error instanceof Error && error.message.includes("64 KiB")) {
2663
- throw error;
2664
- }
2655
+ json = JSON.stringify(request.payload);
2656
+ } catch {
2665
2657
  throw new Error("ui.requestInput payload must be JSON-serializable");
2666
2658
  }
2659
+ if (json === void 0) {
2660
+ throw new Error("ui.requestInput payload must be JSON-serializable");
2661
+ }
2662
+ if (Buffer.byteLength(json, "utf8") > PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES) {
2663
+ throw new Error("ui.requestInput payload exceeds 64 KiB");
2664
+ }
2665
+ const payload = JSON.parse(json);
2667
2666
  const timeoutMs = request.timeoutMs ?? 10 * 60 * 1e3;
2668
2667
  if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > PLUGIN_INTERACTION_MAX_TIMEOUT_MS) {
2669
2668
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.164",
3
+ "version": "0.6.169",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/get-bb/bb#readme",
6
6
  "bugs": {