@get-bb/plugin-sdk 0.6.178 → 0.6.189

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.
@@ -2307,11 +2307,23 @@ function validatePluginMachineProviderDeclaration(declaration) {
2307
2307
  function validateServerAccessProviderDeclaration(declaration) {
2308
2308
  if (typeof declaration !== "object" || declaration === null)
2309
2309
  throw new Error("Invalid server access provider declaration");
2310
- if (typeof declaration.id !== "string" || !/^[a-z][a-z0-9-]*$/u.test(declaration.id) || declaration.id === "direct")
2310
+ if (typeof declaration.id !== "string" || !/^[a-z][a-z0-9-]*$/u.test(declaration.id) || declaration.id === "direct" || declaration.id === "local-network")
2311
2311
  throw new Error("Invalid or reserved server access provider id");
2312
+ if (declaration.routeKind !== void 0 && !["local-network", "private-overlay", "relay", "custom"].includes(
2313
+ declaration.routeKind
2314
+ ))
2315
+ throw new Error("Invalid server access route kind");
2312
2316
  if (typeof declaration.displayName !== "string" || !declaration.displayName.trim() || typeof declaration.description !== "string" || !declaration.description.trim() || typeof declaration.availability !== "function" || typeof declaration.acquire !== "function" || typeof declaration.release !== "function")
2313
2317
  throw new Error("Invalid server access provider declaration");
2314
- return declaration;
2318
+ return {
2319
+ id: declaration.id,
2320
+ displayName: declaration.displayName,
2321
+ description: declaration.description,
2322
+ routeKind: declaration.routeKind ?? "custom",
2323
+ availability: () => declaration.availability(),
2324
+ acquire: (context) => declaration.acquire(context),
2325
+ release: (context) => declaration.release(context)
2326
+ };
2315
2327
  }
2316
2328
  var LEGACY_UNKNOWN_MIGRATION_HASH = "legacy-unknown";
2317
2329
  function migrationStatementHash(statement) {
@@ -3738,7 +3750,8 @@ function createFakePluginHostInternal(options, sharedState) {
3738
3750
  return null;
3739
3751
  }
3740
3752
  const hooks = {
3741
- "message.dispatch": null
3753
+ "message.dispatch": null,
3754
+ "thread.delete_finalize": null
3742
3755
  };
3743
3756
  const environmentCompositions = /* @__PURE__ */ new Map();
3744
3757
  const environmentProviders = /* @__PURE__ */ new Map();
@@ -4052,12 +4065,12 @@ function createFakePluginHostInternal(options, sharedState) {
4052
4065
  experimental_serverAccess: {
4053
4066
  register(declaration) {
4054
4067
  assertLive();
4055
- validateServerAccessProviderDeclaration(declaration);
4068
+ const provider = validateServerAccessProviderDeclaration(declaration);
4056
4069
  if (serverAccessProviders.has(declaration.id))
4057
4070
  throw new Error(
4058
4071
  `Server access provider "${declaration.id}" is already registered`
4059
4072
  );
4060
- serverAccessProviders.set(declaration.id, declaration);
4073
+ serverAccessProviders.set(provider.id, provider);
4061
4074
  },
4062
4075
  recheck() {
4063
4076
  assertLive();
@@ -4676,6 +4689,54 @@ function createFakePluginHostInternal(options, sharedState) {
4676
4689
  return { bb, harness };
4677
4690
  }
4678
4691
 
4692
+ // src/testing/navigation-hrefs.ts
4693
+ var SETTINGS_SECTIONS = {
4694
+ general: true,
4695
+ providers: true,
4696
+ "ai-services": true,
4697
+ appearance: true,
4698
+ keyboard: true,
4699
+ browser: true,
4700
+ files: true,
4701
+ projects: true,
4702
+ machines: true,
4703
+ mobile: true,
4704
+ "environment-variables": true,
4705
+ updates: true,
4706
+ plugins: true,
4707
+ marketplaces: true,
4708
+ experiments: true,
4709
+ community: true,
4710
+ archived: true
4711
+ };
4712
+ function assertTestSettingsTarget(target) {
4713
+ if (target !== void 0 && !Object.hasOwn(SETTINGS_SECTIONS, target.section)) {
4714
+ throw new RangeError(
4715
+ `Unknown settings section "${String(target.section)}"`
4716
+ );
4717
+ }
4718
+ }
4719
+ function assertTestMessageSeq(messageSeq) {
4720
+ if (messageSeq !== void 0 && (!Number.isSafeInteger(messageSeq) || messageSeq < 0)) {
4721
+ throw new RangeError(
4722
+ `messageSeq must be a non-negative integer, got ${messageSeq}`
4723
+ );
4724
+ }
4725
+ }
4726
+ function testThreadHref(threadId, options) {
4727
+ const messageSeq = options?.messageSeq;
4728
+ assertTestMessageSeq(messageSeq);
4729
+ const path = `/threads/${threadId}`;
4730
+ return messageSeq === void 0 ? path : `${path}#msg=${messageSeq}`;
4731
+ }
4732
+ function testSettingsHref(target, pluginId) {
4733
+ assertTestSettingsTarget(target);
4734
+ if (target === void 0) {
4735
+ return `/settings/plugins/${encodeURIComponent(pluginId)}`;
4736
+ }
4737
+ return target.section === "general" ? "/settings" : `/settings/${target.section}`;
4738
+ }
4739
+
4679
4740
  // src/testing/fixtures.ts
4680
4741
  function makeHostResponse(overrides = {}) {
4681
4742
  return {
@@ -4692,6 +4753,7 @@ function makeHostResponse(overrides = {}) {
4692
4753
  teardown: null
4693
4754
  },
4694
4755
  maxPermissionMode: "full",
4756
+ route: null,
4695
4757
  lastSeenAt: null,
4696
4758
  lastRejectedProtocolVersion: null,
4697
4759
  createdAt: 0,
@@ -4823,6 +4885,7 @@ function makeMessageDispatchHookContext(overrides = {}) {
4823
4885
  projectId: "project-1",
4824
4886
  hostId: "host-1",
4825
4887
  path: "/tmp/test",
4888
+ additionalPaths: [],
4826
4889
  isGitRepo: true,
4827
4890
  isWorktree: false,
4828
4891
  branchName: "main",
@@ -4937,11 +5000,21 @@ function makeActionContext(overrides = {}) {
4937
5000
  const record = (member, args) => {
4938
5001
  calls.push({ member, args });
4939
5002
  };
4940
- const navigate = new Proxy({}, {
4941
- get: (_target, method) => (...args) => {
5003
+ const hrefs = {
5004
+ experimental_threadHref: (threadId, options) => {
5005
+ record("navigate.experimental_threadHref", [threadId, options]);
5006
+ return testThreadHref(threadId, options);
5007
+ },
5008
+ experimental_settingsHref: (target) => {
5009
+ record("navigate.experimental_settingsHref", [target]);
5010
+ return testSettingsHref(target, "test-plugin");
5011
+ }
5012
+ };
5013
+ const navigate = new Proxy(hrefs, {
5014
+ get: (target, method) => Reflect.get(target, method) ?? ((...args) => {
4942
5015
  record(`navigate.${String(method)}`, args);
4943
5016
  return false;
4944
- }
5017
+ })
4945
5018
  });
4946
5019
  const sdk = new Proxy({}, {
4947
5020
  get: (_target, area) => new Proxy(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.178",
3
+ "version": "0.6.189",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/get-bb/bb#readme",
6
6
  "bugs": {