@get-bb/plugin-sdk 0.6.94 → 0.6.99

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.
@@ -987,13 +987,13 @@ async function invalidateTags(client, scope, tags) {
987
987
  }
988
988
  async function executeTaggedMutation(invalidate, call, prediction) {
989
989
  const { result, invalidated } = await call();
990
- prediction?.accept(result);
990
+ prediction.accept(result);
991
991
  const refresh = async () => {
992
992
  try {
993
993
  if (invalidate !== void 0 && invalidated.length > 0)
994
994
  await invalidate(invalidated);
995
995
  } finally {
996
- prediction?.settle();
996
+ prediction.settle();
997
997
  }
998
998
  };
999
999
  void refresh().catch(() => {
@@ -1508,7 +1508,7 @@ var sessionOptionSelectionsSchema = z2.record(
1508
1508
  var runtimeThreadExecutionBaseOptionsSchema = z2.object({
1509
1509
  model: z2.string().min(1),
1510
1510
  serviceTier: serviceTierSchema,
1511
- reasoningLevel: reasoningLevelSchema,
1511
+ reasoningLevel: reasoningLevelSchema.optional(),
1512
1512
  promptMode: promptModeSchema.optional(),
1513
1513
  sessionOptions: sessionOptionSelectionsSchema.optional(),
1514
1514
  providerOptions: jsonObjectSchema
@@ -2034,6 +2034,7 @@ var SYSTEM_CHANGE_KINDS = [
2034
2034
  "plugin-install-jobs-changed",
2035
2035
  "plugin-update-jobs-changed",
2036
2036
  "provider-registrations-changed",
2037
+ "ui-preferences-changed",
2037
2038
  "environment-availability-changed",
2038
2039
  "server-move-changed",
2039
2040
  "app-update-changed"
@@ -2191,11 +2192,6 @@ var systemChangedMessageSchema = z17.object({
2191
2192
  entity: z17.literal("system"),
2192
2193
  changes: z17.array(systemChangeKindSchema).readonly()
2193
2194
  }).strict();
2194
- var tagsChangedMessageSchema = z17.object({
2195
- type: z17.literal("changed"),
2196
- entity: z17.literal("tags"),
2197
- tags: z17.array(z17.string().min(1)).min(1)
2198
- }).strict();
2199
2195
  var pluginChangedMessageSchema = z17.object({
2200
2196
  type: z17.literal("changed"),
2201
2197
  entity: z17.literal("plugin"),
@@ -2208,7 +2204,6 @@ var changedMessageSchema = z17.discriminatedUnion("entity", [
2208
2204
  environmentChangedMessageSchema,
2209
2205
  hostChangedMessageSchema,
2210
2206
  systemChangedMessageSchema,
2211
- tagsChangedMessageSchema,
2212
2207
  pluginChangedMessageSchema
2213
2208
  ]);
2214
2209
  function lenientKinds(kinds) {
@@ -2268,7 +2263,6 @@ var changedMessageLenientSchema = z17.discriminatedUnion("entity", [
2268
2263
  environmentChangedMessageLenientSchema,
2269
2264
  hostChangedMessageLenientSchema,
2270
2265
  systemChangedMessageLenientSchema,
2271
- tagsChangedMessageSchema.strip(),
2272
2266
  pluginChangedMessageSchema.strip()
2273
2267
  ]);
2274
2268
 
@@ -3865,6 +3859,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
3865
3859
  messageDirectives: [],
3866
3860
  codeFenceRenderers: [],
3867
3861
  messageActions: [],
3862
+ messageMetadata: [],
3868
3863
  commandPaletteActions: [],
3869
3864
  providerIcons: [],
3870
3865
  icons: [],
@@ -3903,6 +3898,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
3903
3898
  codeFenceRenderer: /* @__PURE__ */ new Set(),
3904
3899
  codeFenceLanguage: /* @__PURE__ */ new Set(),
3905
3900
  messageAction: /* @__PURE__ */ new Set(),
3901
+ messageMetadata: /* @__PURE__ */ new Set(),
3906
3902
  command: /* @__PURE__ */ new Set(),
3907
3903
  providerIcon: /* @__PURE__ */ new Set(),
3908
3904
  timelineRenderer: /* @__PURE__ */ new Set(),
@@ -4442,6 +4438,22 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
4442
4438
  run: registration.run
4443
4439
  });
4444
4440
  },
4441
+ experimental_messageMetadata(registration) {
4442
+ const kind = "slots.experimental_messageMetadata";
4443
+ const id = requireSlotId(kind, registration?.id);
4444
+ requireUniqueId(kind, seenIds.messageMetadata, id);
4445
+ const placement = registration.placement ?? "above";
4446
+ if (placement !== "above" && placement !== "actionRow") {
4447
+ throw new Error(
4448
+ `${kind}: "placement" must be "above" or "actionRow"`
4449
+ );
4450
+ }
4451
+ collected.messageMetadata.push({
4452
+ id,
4453
+ placement,
4454
+ component: requireComponent(kind, registration.component)
4455
+ });
4456
+ },
4445
4457
  commandPaletteAction(registration) {
4446
4458
  registerCommand(registration);
4447
4459
  },
@@ -5640,6 +5652,9 @@ var testPluginSdkApp = {
5640
5652
  experimental_useTabVisible() {
5641
5653
  return useSlotEnv("experimental_useTabVisible").tabVisible;
5642
5654
  },
5655
+ experimental_useServers() {
5656
+ return useSlotEnv("experimental_useServers").servers;
5657
+ },
5643
5658
  experimental_copyToClipboard(content) {
5644
5659
  return activeClipboard?.(content) ?? Promise.resolve(true);
5645
5660
  },
@@ -6612,6 +6627,7 @@ ${block}
6612
6627
  codeTheme,
6613
6628
  canOpenFileExternally: options.canOpenFileExternally ?? (() => false),
6614
6629
  tabVisible: options.tabVisible ?? true,
6630
+ servers: options.servers ?? null,
6615
6631
  branchesState: {
6616
6632
  branches: options.branchesState?.branches ?? [],
6617
6633
  remoteBranches: options.branchesState?.remoteBranches ?? [],
@@ -2255,9 +2255,7 @@ function runPluginStorageMigrations(database, statements) {
2255
2255
  if (!migrationColumns.some((column) => column.name === "statement_hash")) {
2256
2256
  database.exec("ALTER TABLE _bb_migrations ADD COLUMN statement_hash TEXT");
2257
2257
  }
2258
- const rows = database.prepare(
2259
- "SELECT id, statement_hash FROM _bb_migrations ORDER BY id"
2260
- ).all();
2258
+ const rows = database.prepare("SELECT id, statement_hash FROM _bb_migrations ORDER BY id").all();
2261
2259
  const applied = /* @__PURE__ */ new Map();
2262
2260
  for (const row of rows) applied.set(row.id, row.statement_hash);
2263
2261
  const statementHashes = statements.map(migrationStatementHash);
@@ -3905,9 +3903,11 @@ function createFakePluginHostInternal(options, sharedState) {
3905
3903
  installHandlers.push(handler);
3906
3904
  }
3907
3905
  };
3906
+ const hostLifetime = new AbortController();
3908
3907
  async function disposeHost(cleanupStorage) {
3909
3908
  if (disposed) return;
3910
3909
  disposed = true;
3910
+ hostLifetime.abort();
3911
3911
  for (const [id, pending] of pendingInteractions) {
3912
3912
  clearTimeout(pending.timer);
3913
3913
  pendingInteractions.delete(id);
@@ -4170,7 +4170,8 @@ function createFakePluginHostInternal(options, sharedState) {
4170
4170
  result = await record.handler(validatedInput, {
4171
4171
  experimental_caller: options2.experimental_caller ?? {
4172
4172
  kind: "client"
4173
- }
4173
+ },
4174
+ experimental_signal: options2.signal === void 0 ? hostLifetime.signal : AbortSignal.any([options2.signal, hostLifetime.signal])
4174
4175
  });
4175
4176
  } catch (error) {
4176
4177
  const refusal = readPluginRpcRefusal(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.94",
3
+ "version": "0.6.99",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"