@get-bb/plugin-sdk 0.4.8 → 0.4.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.
@@ -265,6 +265,8 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
265
265
  threadLists: [],
266
266
  threadHeaderActions: [],
267
267
  fileOpeners: [],
268
+ sourceCodeRenderers: [],
269
+ diffRenderers: [],
268
270
  messageDirectives: [],
269
271
  messageActions: [],
270
272
  providerIcons: [],
@@ -282,6 +284,8 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
282
284
  threadList: /* @__PURE__ */ new Set(),
283
285
  threadHeaderAction: /* @__PURE__ */ new Set(),
284
286
  fileOpener: /* @__PURE__ */ new Set(),
287
+ sourceCodeRenderer: /* @__PURE__ */ new Set(),
288
+ diffRenderer: /* @__PURE__ */ new Set(),
285
289
  messageDirective: /* @__PURE__ */ new Set(),
286
290
  messageAction: /* @__PURE__ */ new Set(),
287
291
  providerIcon: /* @__PURE__ */ new Set(),
@@ -501,6 +505,38 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
501
505
  component: requireComponent(kind, registration.component)
502
506
  });
503
507
  },
508
+ experimental_sourceCodeRenderer(registration) {
509
+ const kind = "slots.experimental_sourceCodeRenderer";
510
+ const id = requireSlotId(kind, registration?.id);
511
+ requireUniqueId(kind, seenIds.sourceCodeRenderer, id);
512
+ const description = requireOptionalString(
513
+ kind,
514
+ "description",
515
+ registration.description
516
+ );
517
+ collected.sourceCodeRenderers.push({
518
+ id,
519
+ title: requireNonEmptyString(kind, "title", registration.title),
520
+ ...description !== void 0 ? { description } : {},
521
+ component: requireComponent(kind, registration.component)
522
+ });
523
+ },
524
+ experimental_diffRenderer(registration) {
525
+ const kind = "slots.experimental_diffRenderer";
526
+ const id = requireSlotId(kind, registration?.id);
527
+ requireUniqueId(kind, seenIds.diffRenderer, id);
528
+ const description = requireOptionalString(
529
+ kind,
530
+ "description",
531
+ registration.description
532
+ );
533
+ collected.diffRenderers.push({
534
+ id,
535
+ title: requireNonEmptyString(kind, "title", registration.title),
536
+ ...description !== void 0 ? { description } : {},
537
+ component: requireComponent(kind, registration.component)
538
+ });
539
+ },
504
540
  messageDirective(registration) {
505
541
  const kind = "slots.messageDirective";
506
542
  const id = requireMessageDirectiveId(kind, registration?.id);
@@ -710,6 +746,46 @@ function TestNewThreadComposer({
710
746
  }
711
747
  );
712
748
  }
749
+ function TestSourceCode({
750
+ content,
751
+ path,
752
+ overflow = "scroll",
753
+ highlightedLines = null,
754
+ className
755
+ }) {
756
+ return /* @__PURE__ */ jsx(
757
+ "pre",
758
+ {
759
+ "data-testid": "bb-source-code",
760
+ "data-path": path,
761
+ "data-overflow": overflow,
762
+ "data-highlighted-lines": highlightedLines === null ? "" : `${highlightedLines.start}-${highlightedLines.end}`,
763
+ className,
764
+ children: content
765
+ }
766
+ );
767
+ }
768
+ function TestDiff({
769
+ patch,
770
+ path,
771
+ view = "unified",
772
+ overflow = "scroll",
773
+ showLineNumbers = true,
774
+ className
775
+ }) {
776
+ return /* @__PURE__ */ jsx(
777
+ "pre",
778
+ {
779
+ "data-testid": "bb-diff",
780
+ "data-path": path,
781
+ "data-view": view,
782
+ "data-overflow": overflow,
783
+ "data-show-line-numbers": showLineNumbers ? "true" : "false",
784
+ className,
785
+ children: patch
786
+ }
787
+ );
788
+ }
713
789
  var testPluginSdkApp = {
714
790
  definePluginApp,
715
791
  useRpc() {
@@ -772,6 +848,8 @@ var testPluginSdkApp = {
772
848
  ThreadChat: TestThreadChat,
773
849
  Markdown: TestMarkdown,
774
850
  experimental_NewThreadComposer: TestNewThreadComposer,
851
+ experimental_SourceCode: TestSourceCode,
852
+ experimental_Diff: TestDiff,
775
853
  experimental_useSidebarThreads() {
776
854
  return useSlotEnv("experimental_useSidebarThreads").sidebarThreads;
777
855
  },
@@ -1047,7 +1047,7 @@ function createFakePluginHostInternal(options, sharedState) {
1047
1047
  kv,
1048
1048
  database() {
1049
1049
  assertLive();
1050
- if (!databaseHandle) {
1050
+ if (!databaseHandle?.open) {
1051
1051
  databaseHandle = new Database(join(storageRoot, "data.db"));
1052
1052
  databaseHandle.pragma("busy_timeout = 5000");
1053
1053
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"
@@ -89,12 +89,13 @@
89
89
  },
90
90
  "types": "./bundled-types/bb-plugin-sdk.d.ts",
91
91
  "scripts": {
92
- "build": "node scripts/build-bundled-dts.mjs && node scripts/build-runtime.mjs",
92
+ "build": "node scripts/build-runtime.mjs",
93
93
  "build:runtime": "node scripts/build-runtime.mjs",
94
- "clean": "rimraf dist tsconfig.tsbuildinfo",
94
+ "build:types": "node scripts/build-bundled-dts.mjs",
95
+ "clean": "rimraf bundled-types dist tsconfig.tsbuildinfo",
95
96
  "prepack": "node scripts/build-bundled-dts.mjs && node scripts/build-runtime.mjs",
96
97
  "test": "vitest run --config vitest.config.ts",
97
- "typecheck": "node scripts/build-bundled-dts.mjs --check && tsc --noEmit"
98
+ "typecheck": "tsc --noEmit"
98
99
  },
99
100
  "devDependencies": {
100
101
  "@bb/domain": "workspace:*",