@get-bb/plugin-sdk 0.4.56 → 0.4.87

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.
@@ -6,7 +6,8 @@
6
6
  // and read the real source: https://github.com/get-bb/bb
7
7
 
8
8
  import { z } from 'zod';
9
- import { StandardSchemaV1 as StandardSchemaV1$1, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, StandardSchemaV1InferOutput, PluginEnvironmentValidateDecision, JsonValue as JsonValue$2 } from '@get-bb/plugin-sdk';
9
+ import { StandardSchemaV1 as StandardSchemaV1$1, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, StandardSchemaV1InferOutput, PluginEnvironmentValidateDecision, JsonValue as JsonValue$2, PluginMachineValidateDecision } from '@get-bb/plugin-sdk';
10
+ import Database from 'better-sqlite3';
10
11
 
11
12
  /** Input-form entry: a path, or a path with options. */
12
13
  declare const providerNativeRootInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -74,10 +75,14 @@ declare const environmentSchema: z.ZodObject<{
74
75
  environmentProviderInstanceKey: z.ZodNullable<z.ZodString>;
75
76
  environmentProviderSelection: z.ZodNullable<z.ZodObject<{
76
77
  inputs: z.ZodNullable<z.ZodType<JsonValue$1, unknown, z.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
77
- machine: z.ZodObject<{
78
+ machine: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
79
  hostId: z.ZodString;
79
80
  type: z.ZodLiteral<"existing">;
80
- }, z.core.$strip>;
81
+ }, z.core.$strip>, z.ZodObject<{
82
+ inputs: z.ZodNullable<z.ZodType<JsonValue$1, unknown, z.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
83
+ machineProviderId: z.ZodString;
84
+ type: z.ZodLiteral<"new">;
85
+ }, z.core.$strip>], "type">;
81
86
  }, z.core.$strip>>;
82
87
  hostId: z.ZodString;
83
88
  id: z.ZodString;
@@ -127,6 +132,29 @@ declare const hostSchema: z.ZodObject<{
127
132
  id: z.ZodString;
128
133
  lastRejectedProtocolVersion: z.ZodNullable<z.ZodNumber>;
129
134
  lastSeenAt: z.ZodNullable<z.ZodNumber>;
135
+ lifecycle: z.ZodObject<{
136
+ message: z.ZodNullable<z.ZodString>;
137
+ pendingLog: z.ZodString;
138
+ phase: z.ZodEnum<{
139
+ active: "active";
140
+ creating: "creating";
141
+ destroyed: "destroyed";
142
+ removing: "removing";
143
+ resuming: "resuming";
144
+ suspended: "suspended";
145
+ suspending: "suspending";
146
+ }>;
147
+ suspendedAt: z.ZodNullable<z.ZodNumber>;
148
+ teardown: z.ZodNullable<z.ZodObject<{
149
+ attempt: z.ZodNumber;
150
+ status: z.ZodEnum<{
151
+ failed: "failed";
152
+ removed: "removed";
153
+ running: "running";
154
+ }>;
155
+ }, z.core.$strip>>;
156
+ }, z.core.$strip>;
157
+ machineProviderId: z.ZodNullable<z.ZodString>;
130
158
  maxPermissionMode: z.ZodEnum<{
131
159
  "accept-edits": "accept-edits";
132
160
  auto: "auto";
@@ -138,6 +166,7 @@ declare const hostSchema: z.ZodObject<{
138
166
  disconnected: "disconnected";
139
167
  }>;
140
168
  type: z.ZodEnum<{
169
+ ephemeral: "ephemeral";
141
170
  persistent: "persistent";
142
171
  }>;
143
172
  updatedAt: z.ZodNumber;
@@ -492,10 +521,12 @@ type Checkout<R> = R extends {
492
521
  gitCheckout: true;
493
522
  } ? {
494
523
  path: string;
524
+ experimental_ownsPath: boolean;
495
525
  } : {
496
526
  path: string;
527
+ experimental_ownsPath: boolean;
497
528
  } | null;
498
- type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
529
+ type InputsValue$1<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
499
530
  /** Attempt-scoped updates; core persists each update before this call returns. */
500
531
  interface PluginEnvironmentProviderProgress {
501
532
  step(text: string): void;
@@ -506,7 +537,7 @@ interface PluginEnvironmentProviderValidateContext<R extends PluginEnvironmentPr
506
537
  host: Host;
507
538
  projectCheckout: Checkout<R>;
508
539
  gitRemote: Fact<R, "gitRemote", string>;
509
- inputs: InputsValue<S>;
540
+ inputs: InputsValue$1<S>;
510
541
  }
511
542
  interface PluginEnvironmentProviderAvailabilityContext {
512
543
  project: Project;
@@ -577,8 +608,10 @@ interface PluginEnvironmentProviderPolicy {
577
608
  interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> {
578
609
  id: string;
579
610
  displayName: string;
611
+ /** Short explanation shown in environment choices. */
612
+ description: string;
580
613
  /** Host glyph, plugin-relative icon path, or this plugin’s declared namespaced icon. */
581
- icon?: string;
614
+ icon: string;
582
615
  requires?: R;
583
616
  inputs?: S;
584
617
  policy?: Partial<PluginEnvironmentProviderPolicy>;
@@ -591,6 +624,80 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
591
624
 
592
625
  declare const RESERVED_BB_CLI_COMMANDS: readonly string[];
593
626
 
627
+ type PluginMachineProviderResource = Exclude<JsonValue$2, null>;
628
+ type PluginMachineProviderInputsSchema = StandardSchemaV1$1 | undefined;
629
+ type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
630
+ interface PluginMachineProviderProgress {
631
+ step(text: string): void;
632
+ log(text: string): void;
633
+ }
634
+ type PluginMachineProviderAvailability = {
635
+ status: "available";
636
+ } | {
637
+ status: "setup-required";
638
+ message: string;
639
+ } | {
640
+ status: "unavailable";
641
+ message: string;
642
+ };
643
+ type PluginMachineProviderValidateContext<S extends PluginMachineProviderInputsSchema = PluginMachineProviderInputsSchema> = {
644
+ inputs: InputsValue<S>;
645
+ };
646
+ interface PluginMachineProviderLifecycleContext {
647
+ checkpoint(resource: PluginMachineProviderResource): Promise<void>;
648
+ report: PluginMachineProviderProgress;
649
+ signal: AbortSignal;
650
+ }
651
+ type PluginMachineProviderCreateContext<S extends PluginMachineProviderInputsSchema = PluginMachineProviderInputsSchema> = PluginMachineProviderValidateContext<S> & PluginMachineProviderLifecycleContext & {
652
+ key: string;
653
+ attempt: number;
654
+ };
655
+ type PluginMachineProviderCreateResult = {
656
+ status: "created";
657
+ name: string;
658
+ resource: PluginMachineProviderResource;
659
+ } | {
660
+ status: "failed";
661
+ message: string;
662
+ };
663
+ type PluginMachineProviderResourceLifecycleContext = PluginMachineProviderLifecycleContext & {
664
+ hostId: string;
665
+ resource: PluginMachineProviderResource;
666
+ };
667
+ type PluginMachineProviderRemoveContext = Omit<PluginMachineProviderResourceLifecycleContext, "checkpoint">;
668
+ interface PluginMachineProviderResourceResult {
669
+ resource: PluginMachineProviderResource;
670
+ }
671
+ type PluginMachineProviderRemoveResult = {
672
+ status: "removed";
673
+ } | {
674
+ status: "failed";
675
+ message: string;
676
+ };
677
+ interface PluginMachineProviderDefinition<S extends PluginMachineProviderInputsSchema = PluginMachineProviderInputsSchema> {
678
+ id: string;
679
+ displayName: string;
680
+ /** One line telling a user what choosing this provider gets them, shown wherever a machine is added. */
681
+ description: string;
682
+ /** Provider glyph, declared icon, or plugin-relative icon path. */
683
+ icon: string;
684
+ ephemeral?: boolean;
685
+ /** Persisted and readable by every plugin. Store secret references, never secrets. */
686
+ inputs?: S;
687
+ availability?(): PluginMachineProviderAvailability | Promise<PluginMachineProviderAvailability>;
688
+ validate?(context: PluginMachineProviderValidateContext<S>): PluginMachineValidateDecision | Promise<PluginMachineValidateDecision>;
689
+ create(context: PluginMachineProviderCreateContext<S>): Promise<PluginMachineProviderCreateResult>;
690
+ /** Reconcile and remove an uncertain allocation by durable key without creating or bootstrapping. Return failed while allocation intent remains unresolved. */
691
+ reconcileCleanup(context: {
692
+ key: string;
693
+ report: PluginMachineProviderProgress;
694
+ signal: AbortSignal;
695
+ }): Promise<PluginMachineProviderRemoveResult>;
696
+ suspend?(context: PluginMachineProviderResourceLifecycleContext): Promise<PluginMachineProviderResourceResult>;
697
+ resume?(context: PluginMachineProviderResourceLifecycleContext): Promise<PluginMachineProviderResourceResult>;
698
+ remove(context: PluginMachineProviderRemoveContext): Promise<PluginMachineProviderRemoveResult>;
699
+ }
700
+
594
701
  /**
595
702
  * A value that survives a JSON round trip without coercion or data loss.
596
703
  *
@@ -601,6 +708,21 @@ type JsonValue = string | number | boolean | null | JsonValue[] | {
601
708
  [key: string]: JsonValue;
602
709
  };
603
710
 
711
+ /** A JSON-safe path segment reported by a Standard Schema validation issue. */
712
+ type PluginRpcIssuePathSegment = string | number;
713
+ /** Validator-neutral validation detail carried by an RPC error envelope. */
714
+ interface PluginRpcValidationIssue {
715
+ message: string;
716
+ path?: PluginRpcIssuePathSegment[];
717
+ }
718
+ /** Stable wire error categories for plugin RPC. */
719
+ type PluginRpcErrorCode = "handler_error" | "invalid_input" | "invalid_json" | "invalid_output" | "non_json_result" | "unknown_method";
720
+ /** Structured RPC failure returned as `{ ok: false, error }`. */
721
+ interface PluginRpcError {
722
+ code: PluginRpcErrorCode;
723
+ message: string;
724
+ issues?: PluginRpcValidationIssue[];
725
+ }
604
726
  /**
605
727
  * The validator-neutral subset of Standard Schema v1 used by plugin contracts.
606
728
  * Zod 4 schemas implement this interface directly; other validators can do
@@ -629,10 +751,6 @@ interface StandardSchemaV1Issue {
629
751
  readonly key: PropertyKey;
630
752
  })[];
631
753
  }
632
- interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> {
633
- readonly input: InputSchema;
634
- readonly output: OutputSchema;
635
- }
636
754
 
637
755
  type PluginSettingDescriptor = {
638
756
  type: "string";
@@ -710,6 +828,36 @@ interface PluginEnvironmentProviderRequirements {
710
828
  * supplied pathKey. Provider ids are unique across running plugins.
711
829
  */
712
830
  type PluginEnvironmentProviderDeclaration<Requires extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, Inputs extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> = PluginEnvironmentProviderDefinition<Requires, Inputs>;
831
+ type PluginMachineProviderDeclaration<Inputs extends PluginMachineProviderInputsSchema = PluginMachineProviderInputsSchema> = PluginMachineProviderDefinition<Inputs>;
832
+ interface ServerAccessGrant {
833
+ id: string;
834
+ serverUrl: string;
835
+ headers?: Record<string, string>;
836
+ }
837
+ interface ServerAccessProviderDeclaration {
838
+ id: string;
839
+ displayName: string;
840
+ description: string;
841
+ availability(): (PluginMachineProviderAvailability & {
842
+ serverUrl?: string;
843
+ }) | Promise<PluginMachineProviderAvailability & {
844
+ serverUrl?: string;
845
+ }>;
846
+ acquire(context: {
847
+ key: string;
848
+ hostId: string;
849
+ signal: AbortSignal;
850
+ }): Promise<ServerAccessGrant | {
851
+ status: "failed";
852
+ message: string;
853
+ }>;
854
+ release(context: {
855
+ key: string;
856
+ hostId: string;
857
+ /** Null when acquisition was interrupted before a grant was returned. Reconcile using key and hostId. */
858
+ grantId: string | null;
859
+ }): Promise<void>;
860
+ }
713
861
  /**
714
862
  * Where a thread is going to run, as far as core knows at the checkpoint.
715
863
  * Before provisioning attaches an environment this is the start intent the
@@ -726,6 +874,10 @@ type PluginDispatchEnvironmentIntent = {
726
874
  machine: {
727
875
  type: "existing";
728
876
  hostId: string;
877
+ } | {
878
+ type: "new";
879
+ machineProviderId: string;
880
+ inputs: JsonValue | null;
729
881
  };
730
882
  inputs: JsonValue | null;
731
883
  };
@@ -881,6 +1033,33 @@ interface PluginHookSignatures {
881
1033
  }
882
1034
  type PluginHookName = keyof PluginHookSignatures;
883
1035
  type PluginHookHandler<K extends PluginHookName> = (context: PluginHookSignatures[K]["context"]) => PluginHookSignatures[K]["decision"] | Promise<PluginHookSignatures[K]["decision"]>;
1036
+ type PluginHttpAuthMode = "local" | "none" | "token";
1037
+ interface PluginCliCommandInfo {
1038
+ name: string;
1039
+ summary: string;
1040
+ usage: string;
1041
+ }
1042
+ /** Context forwarded from the invoking CLI when known; all fields optional. */
1043
+ interface PluginCliContext {
1044
+ cwd?: string;
1045
+ threadId?: string;
1046
+ projectId?: string;
1047
+ /** Aborted when the invoking CLI HTTP request disconnects. */
1048
+ signal?: AbortSignal;
1049
+ }
1050
+ interface PluginInteractionRequest {
1051
+ threadId: string;
1052
+ rendererId: string;
1053
+ title: string;
1054
+ payload: JsonValue;
1055
+ /** Defaults to ten minutes; capped at one hour. */
1056
+ timeoutMs?: number;
1057
+ }
1058
+ interface PluginCliResult {
1059
+ exitCode: number;
1060
+ stdout?: string;
1061
+ stderr?: string;
1062
+ }
884
1063
  interface PluginCliOutputLimitError {
885
1064
  code: "plugin_cli_output_too_large";
886
1065
  message: string;
@@ -896,6 +1075,39 @@ interface PluginCliExecutionResult {
896
1075
  stderr: string;
897
1076
  error?: PluginCliOutputLimitError;
898
1077
  }
1078
+ interface PluginCliRegistration {
1079
+ /** Preferred top-level command name (`bb <name> …`): lowercase [a-z0-9-]+.
1080
+ * A core collision logs an activation warning and remains available through
1081
+ * `bb plugin run <plugin-id>`. */
1082
+ name: string;
1083
+ summary: string;
1084
+ /** Subcommand metadata rendered in help and the plugin-commands skill
1085
+ * without executing plugin code. Parsing argv is plugin-owned. */
1086
+ commands?: PluginCliCommandInfo[];
1087
+ run(argv: string[], ctx: PluginCliContext): PluginCliResult | Promise<PluginCliResult>;
1088
+ }
1089
+ /** Per-turn context handed to bb.agents context providers (design §4.4). */
1090
+ /** MCP-style content parts a native tool may return (design §4.4). */
1091
+ type PluginAgentToolContentPart = {
1092
+ type: "text";
1093
+ text: string;
1094
+ } | {
1095
+ type: "image";
1096
+ data: string;
1097
+ mimeType: string;
1098
+ };
1099
+ type PluginAgentToolResult = string | {
1100
+ content: PluginAgentToolContentPart[];
1101
+ isError?: boolean;
1102
+ };
1103
+ /** Per-call context handed to a native tool's execute (design §4.4). */
1104
+ interface PluginAgentToolContext {
1105
+ threadId: string;
1106
+ projectId: string;
1107
+ /** The tool-call request's abort signal (aborts if the daemon round-trip
1108
+ * is torn down mid-call). */
1109
+ signal: AbortSignal;
1110
+ }
899
1111
  /**
900
1112
  * The row title of a plugin tool call while it is pending and once it
901
1113
  * settled. Each label is capped at 80 characters and rendered as plain text.
@@ -1279,9 +1491,54 @@ interface ExperimentalPluginProviderEnvEntry {
1279
1491
  serverPath: string;
1280
1492
  };
1281
1493
  reason: string;
1282
- secret: boolean;
1283
1494
  }
1284
1495
  type PluginMentionTrigger = "!" | "#" | "$" | "@" | "~";
1496
+ /** Search context handed to a mention provider (design §4.9). `projectId`/
1497
+ * `threadId` are null when the composer has not committed one yet. */
1498
+ interface PluginMentionSearchContext {
1499
+ trigger: PluginMentionTrigger;
1500
+ query: string;
1501
+ projectId: string | null;
1502
+ threadId: string | null;
1503
+ }
1504
+ /** One row a mention provider returns from `search`. `id` is the provider's
1505
+ * own item id — the host namespaces it before it reaches the wire. */
1506
+ interface PluginMentionItem {
1507
+ id: string;
1508
+ title: string;
1509
+ subtitle?: string;
1510
+ icon?: string;
1511
+ }
1512
+ interface PluginMentionProviderRegistration {
1513
+ /** Unique within this plugin: [a-zA-Z0-9_-]+ (no ":" — the host composes
1514
+ * wire item ids as "<providerId>:<itemId>"). */
1515
+ id: string;
1516
+ /** Section label shown above this provider's rows in the mention menu. */
1517
+ label: string;
1518
+ /**
1519
+ * Composer trigger characters this provider should answer. Omit to use the
1520
+ * default `@` mention trigger. Valid triggers are `@`, `#`, `$`, `!`, and `~`.
1521
+ */
1522
+ triggers?: readonly PluginMentionTrigger[];
1523
+ /**
1524
+ * Runs server-side as the user types after one of this provider's triggers
1525
+ * in the composer. Each call is time-boxed (2s) and failure-isolated: a slow
1526
+ * or throwing provider contributes an empty list — it can never break the
1527
+ * mention menu.
1528
+ */
1529
+ search(ctx: PluginMentionSearchContext): PluginMentionItem[] | Promise<PluginMentionItem[]>;
1530
+ /**
1531
+ * Resolves one picked item into agent context, called once per unique
1532
+ * item at message send time. The returned `context` is attached to the
1533
+ * message as an agent-visible (user-hidden) prompt input. Throwing blocks
1534
+ * the send with a visible error.
1535
+ */
1536
+ resolve(itemId: string): {
1537
+ context: string;
1538
+ } | Promise<{
1539
+ context: string;
1540
+ }>;
1541
+ }
1285
1542
  /**
1286
1543
  * What a plugin's AI service does. `inference` answers bb's server-side helper
1287
1544
  * completions (thread titles, commit messages: a prompt and a JSON Schema in,
@@ -1314,21 +1571,11 @@ declare function pluginCliCollisionWarning(pluginId: string, commandName: string
1314
1571
  declare const RESERVED_AGENT_TOOL_NAMES: readonly string[];
1315
1572
  /** JSON values ≤256KB; larger writes are rejected with a clear error. */
1316
1573
  declare const KV_VALUE_MAX_BYTES: number;
1317
- declare const PLUGIN_HTTP_METHODS: ReadonlySet<string>;
1318
- declare const RPC_METHOD_PATTERN: RegExp;
1319
- declare const BACKGROUND_NAME_PATTERN: RegExp;
1320
- declare const CLI_COMMAND_NAME_PATTERN: RegExp;
1321
- declare const AGENT_TOOL_NAME_PATTERN: RegExp;
1322
1574
  declare const PLUGIN_PROVIDER_ENV_NAME_PATTERN: RegExp;
1323
1575
  declare const PLUGIN_PROVIDER_ENV_MAX_ENTRIES = 32;
1324
1576
  declare function validatePluginProviderEnvEntries(value: unknown): ExperimentalPluginProviderEnvEntry[];
1325
- declare const PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS = 4096;
1326
1577
  /** Status labels ride on every tool-call event and share one timeline row. */
1327
1578
  declare const PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS = 80;
1328
- declare const PLUGIN_AGENT_SELECTION_MAX_IDS = 256;
1329
- declare const PLUGIN_AGENT_DYNAMIC_INSTRUCTIONS_MAX_CHARS = 4096;
1330
- declare const PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES: number;
1331
- declare const MENTION_PROVIDER_ID_PATTERN: RegExp;
1332
1579
  declare const PROVIDER_ID_PATTERN: RegExp;
1333
1580
  declare const PLUGIN_PROVIDER_BRIDGE_OPTIONS_MAX_BYTES: number;
1334
1581
  declare const SETTING_KEY_PATTERN: RegExp;
@@ -1340,9 +1587,9 @@ declare const SETTING_KEY_PATTERN: RegExp;
1340
1587
  declare function registerSettingDescriptors(target: PluginSettingDescriptors, added: Record<string, unknown>): PluginSettingDescriptors;
1341
1588
  /** Validate a settings update. `null` means unset. */
1342
1589
  declare function validateSettingsUpdate(descriptors: PluginSettingDescriptors, values: Record<string, unknown>): string[];
1590
+ declare function coerceStoredPluginSettingValue(descriptor: PluginSettingDescriptor, value: unknown): PluginSettingValue | undefined;
1343
1591
  declare const PLUGIN_MENTION_TRIGGER_VALUES: readonly ["@", "#", "$", "!", "~"];
1344
1592
  declare function isPluginMentionTrigger(value: unknown): value is PluginMentionTrigger;
1345
- declare function normalizeMentionProviderTriggers(providerId: string, triggers: unknown): readonly PluginMentionTrigger[];
1346
1593
  declare const PLUGIN_PROVIDER_DISPLAY_NAME_MAX_CHARS = 80;
1347
1594
  declare const PLUGIN_PROVIDER_PERMISSION_MODE_VALUES: readonly ["accept-edits", "auto", "full"];
1348
1595
  declare const PLUGIN_PROVIDER_REASONING_LEVEL_VALUES: readonly ["none", "low", "medium", "high", "xhigh", "ultracode", "max", "ultra"];
@@ -1444,30 +1691,6 @@ declare function deriveValidatedProviderOptions(args: {
1444
1691
  context: Parameters<NonNullable<PluginProviderDeclaration["deriveProviderOptions"]>>[0];
1445
1692
  }): Readonly<Record<string, JsonValue>>;
1446
1693
  declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
1447
- declare function readRpcMethodContract(method: string, value: unknown): PluginRpcMethodContract;
1448
- /** Duck-typed zod detection: plugin sources may carry their own zod copy,
1449
- * so instanceof is useless — anything with safeParse is treated as zod. */
1450
- type ZodSchemaLike = {
1451
- safeParse: z.ZodType["safeParse"];
1452
- toJSONSchema?: z.ZodType["toJSONSchema"];
1453
- };
1454
- declare function isZodSchemaLike(value: unknown): value is ZodSchemaLike;
1455
- declare function zodSchemaToJsonSchema(schema: ZodSchemaLike): unknown;
1456
- /**
1457
- * Reject recursive local references before a tool schema reaches a provider.
1458
- * Some providers reject the complete tool list when any one schema contains a
1459
- * recursive `$ref`, so this is a shared production/fake-host boundary rule.
1460
- */
1461
- declare function assertNoRecursiveJsonSchemaReferences(schema: unknown, subject: string): void;
1462
- /**
1463
- * Reject the fields a registration never reads. Renamed fields get the
1464
- * message above; any other `experimental_` field is unknown (the same
1465
- * rule configure() output follows in the plugin service). The production
1466
- * host and the fake host both call this before parsing `presentation`, so
1467
- * a registration built against an older SDK fails a plugin's own unit test
1468
- * with the message bb would give it.
1469
- */
1470
- declare function rejectStaleAgentToolFields(toolName: string, tool: object): void;
1471
1694
  /**
1472
1695
  * The declared shape of `presentation`, copied field by field so
1473
1696
  * a plugin's object cannot smuggle prototypes or extra markup into the
@@ -1479,7 +1702,6 @@ declare function rejectStaleAgentToolFields(toolName: string, tool: object): voi
1479
1702
  declare function parsePluginAgentToolPresentation(toolName: string, value: unknown): PluginAgentToolPresentation | null;
1480
1703
  /** Compact issue summary from a (possibly foreign-instance) zod error. */
1481
1704
  declare function summarizeStandardIssues(issues: readonly StandardSchemaV1Issue[]): string;
1482
- declare function summarizeParseIssues(error: unknown): string;
1483
1705
  declare function enforcePluginCliOutputLimit(result: Omit<PluginCliExecutionResult, "error">, jsonOutput: boolean): PluginCliExecutionResult;
1484
1706
  /**
1485
1707
  * Adopt the value a plugin HTTP route handler returned.
@@ -1511,8 +1733,6 @@ declare function adoptHttpRouteResponse(value: unknown): Response;
1511
1733
  declare function undeclaredIconProblem(pluginId: string, declaredIconNames: ReadonlySet<string>, glyph: string): string | null;
1512
1734
  /** `bb.providers.register` refusal for an icon {@link undeclaredIconProblem} rejects. */
1513
1735
  declare function providerIconRefusalMessage(providerId: string, problem: string): string;
1514
- /** `bb.agents.registerTool` refusal for a glyph {@link undeclaredIconProblem} rejects. */
1515
- declare function agentToolIconRefusalMessage(toolName: string, problem: string): string;
1516
1736
  /**
1517
1737
  * `bb.providers.register` refusal for a plugin whose manifest declares no
1518
1738
  * `bb.host` entry: a declaration is metadata, and the bridge it runs on is
@@ -1539,13 +1759,24 @@ declare function storePluginHook<K extends PluginHookName>(records: {
1539
1759
  declare function pluginHookAlreadyRegisteredMessage(hook: PluginHookName): string;
1540
1760
  declare const ENVIRONMENT_PROVIDER_ID_PATTERN: RegExp;
1541
1761
  declare const ENVIRONMENT_PROVIDER_DISPLAY_NAME_MAX_CHARS = 80;
1762
+ declare const ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS = 200;
1542
1763
  declare const ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES: readonly ["projectCheckout", "gitCheckout", "gitRemote", "projectless"];
1543
1764
  type NormalizedPluginEnvironmentProviderRequirements = {
1544
1765
  [K in (typeof ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES)[number]]: boolean;
1545
1766
  };
1767
+ declare const environmentCompositionSchema: z.ZodObject<{
1768
+ description: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | null, string | undefined>>;
1769
+ displayName: z.ZodString;
1770
+ environmentProviderId: z.ZodString;
1771
+ icon: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>, z.ZodTransform<string | null, string | undefined>>;
1772
+ id: z.ZodString;
1773
+ machineProviderId: z.ZodString;
1774
+ }, z.core.$strict>;
1775
+ type NormalizedPluginEnvironmentComposition = z.infer<typeof environmentCompositionSchema>;
1546
1776
  interface NormalizedPluginEnvironmentProvider {
1547
1777
  id: string;
1548
1778
  displayName: string;
1779
+ description: string | null;
1549
1780
  icon: string | null;
1550
1781
  requires: NormalizedPluginEnvironmentProviderRequirements;
1551
1782
  inputs: StandardSchemaV1 | null;
@@ -1557,7 +1788,130 @@ interface NormalizedPluginEnvironmentProvider {
1557
1788
  policy: PluginEnvironmentProviderPolicy;
1558
1789
  }
1559
1790
  declare function validatePluginEnvironmentProviderDeclaration(declaration: PluginEnvironmentProviderDeclaration): NormalizedPluginEnvironmentProvider;
1560
- declare const MACHINE_PROVIDER_REQUIREMENT_NAMES: readonly ["gitRemote"];
1791
+ declare const MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS = 200;
1792
+ interface NormalizedPluginMachineProvider {
1793
+ id: string;
1794
+ displayName: string;
1795
+ description: string;
1796
+ icon: string;
1797
+ ephemeral: boolean;
1798
+ inputs: StandardSchemaV1 | null;
1799
+ inputsJsonSchema: JsonValue | null;
1800
+ availability: NonNullable<PluginMachineProviderDeclaration["availability"]> | null;
1801
+ validate: NonNullable<PluginMachineProviderDeclaration["validate"]> | null;
1802
+ reconcileCleanup: PluginMachineProviderDeclaration["reconcileCleanup"];
1803
+ create: PluginMachineProviderDeclaration["create"];
1804
+ suspend: NonNullable<PluginMachineProviderDeclaration["suspend"]> | null;
1805
+ resume: NonNullable<PluginMachineProviderDeclaration["resume"]> | null;
1806
+ remove: PluginMachineProviderDeclaration["remove"];
1807
+ }
1808
+ declare function validatePluginMachineProviderDeclaration(declaration: PluginMachineProviderDeclaration): NormalizedPluginMachineProvider;
1809
+ declare function validateServerAccessProviderDeclaration(declaration: ServerAccessProviderDeclaration): ServerAccessProviderDeclaration;
1810
+ declare function runPluginStorageMigrations(database: Database.Database, statements: string[]): void;
1811
+ declare function normalizeHttpRouteRegistration(method: string, path: string, handler: unknown, opts: {
1812
+ auth?: PluginHttpAuthMode;
1813
+ } | undefined, existingRoutes: readonly {
1814
+ method: string;
1815
+ path: string;
1816
+ }[]): {
1817
+ method: string;
1818
+ path: string;
1819
+ auth: PluginHttpAuthMode;
1820
+ };
1821
+ declare function normalizeWebSocketRouteRegistration(path: string, handler: unknown, opts: {
1822
+ auth?: PluginHttpAuthMode;
1823
+ } | undefined, existingRoutes: readonly {
1824
+ path: string;
1825
+ }[]): {
1826
+ path: string;
1827
+ auth: PluginHttpAuthMode;
1828
+ };
1829
+ type RpcRegistrationRecord = {
1830
+ inputSchema: StandardSchemaV1;
1831
+ outputSchema: StandardSchemaV1;
1832
+ handler: (input: unknown) => unknown;
1833
+ };
1834
+ declare function normalizeRpcRegistration(contract: unknown, handlers: unknown, registered: ReadonlyMap<string, unknown>): Array<[string, RpcRegistrationRecord]>;
1835
+ declare function normalizeRealtimePayload(channel: string, payload: unknown): unknown;
1836
+ declare function validateBackgroundServiceRegistration(name: string, service: {
1837
+ start(signal: AbortSignal): void | Promise<void>;
1838
+ }, existing: readonly {
1839
+ name: string;
1840
+ }[]): {
1841
+ name: string;
1842
+ start: (signal: AbortSignal) => void | Promise<void>;
1843
+ };
1844
+ declare function validateScheduleRegistration(name: string, cron: string, fn: () => void | Promise<void>, existing: readonly {
1845
+ name: string;
1846
+ }[], parseCron: (cron: string) => void): {
1847
+ name: string;
1848
+ cron: string;
1849
+ fn: () => void | Promise<void>;
1850
+ };
1851
+ declare function normalizeCliRegistration(registration: PluginCliRegistration, alreadyRegistered: boolean): {
1852
+ name: string;
1853
+ summary: string;
1854
+ commands: PluginCliCommandInfo[];
1855
+ run: PluginCliRegistration["run"];
1856
+ };
1857
+ type AgentToolExecute = (params: unknown, ctx: PluginAgentToolContext) => PluginAgentToolResult | Promise<PluginAgentToolResult>;
1858
+ type AgentToolParse = (input: unknown) => {
1859
+ ok: true;
1860
+ value: unknown;
1861
+ } | {
1862
+ ok: false;
1863
+ error: string;
1864
+ };
1865
+ declare function normalizeAgentToolRegistration(args: {
1866
+ pluginId: string;
1867
+ declaredIconNames: ReadonlySet<string>;
1868
+ tool: {
1869
+ name: string;
1870
+ description: string;
1871
+ instructions?: string;
1872
+ presentation?: PluginAgentToolPresentation;
1873
+ parameters: unknown;
1874
+ execute(params: never, ctx: PluginAgentToolContext): PluginAgentToolResult | Promise<PluginAgentToolResult>;
1875
+ };
1876
+ }): {
1877
+ name: string;
1878
+ description: string;
1879
+ presentation: PluginAgentToolPresentation | null;
1880
+ instructions: string | null;
1881
+ inputSchema: unknown;
1882
+ parse: AgentToolParse;
1883
+ execute: AgentToolExecute;
1884
+ };
1885
+ declare function normalizeMentionProviderRegistration(provider: PluginMentionProviderRegistration, existing: readonly {
1886
+ id: string;
1887
+ }[]): {
1888
+ id: string;
1889
+ label: string;
1890
+ triggers: readonly PluginMentionTrigger[];
1891
+ search: PluginMentionProviderRegistration["search"];
1892
+ resolve: PluginMentionProviderRegistration["resolve"];
1893
+ };
1894
+ declare function normalizeInteractionRequest(request: PluginInteractionRequest): {
1895
+ threadId: string;
1896
+ rendererId: string;
1897
+ title: string;
1898
+ payload: JsonValue;
1899
+ timeoutMs: number;
1900
+ };
1901
+ declare function validateProviderEnvContribution(label: "provider environment contribution" | "provider environment health contribution", providerId: string, resolve: unknown, registered: ReadonlyMap<string, unknown>): void;
1902
+ declare function normalizePluginAgentConfiguration(args: {
1903
+ knownSkillIds: ReadonlySet<string>;
1904
+ knownToolIds: ReadonlySet<string>;
1905
+ pluginId: string;
1906
+ value: unknown;
1907
+ }): {
1908
+ toolIds: string[];
1909
+ toolParameterOverrides: Map<string, Record<string, unknown>>;
1910
+ skillIds: string[];
1911
+ instructions: string | null;
1912
+ };
1913
+ declare function validateRpcValue(schema: StandardSchemaV1, value: unknown, phase: "input" | "output", fail: (error: PluginRpcError) => never): Promise<unknown>;
1914
+ declare function normalizeRpcJsonResult(value: unknown, fail: (error: PluginRpcError) => never): JsonValue;
1561
1915
 
1562
- export { AGENT_TOOL_NAME_PATTERN, BACKGROUND_NAME_PATTERN, CLI_COMMAND_NAME_PATTERN, ENVIRONMENT_PROVIDER_DISPLAY_NAME_MAX_CHARS, ENVIRONMENT_PROVIDER_ID_PATTERN, ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES, KV_VALUE_MAX_BYTES, MACHINE_PROVIDER_REQUIREMENT_NAMES, MENTION_PROVIDER_ID_PATTERN, PLUGIN_AGENT_DYNAMIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_SELECTION_MAX_IDS, PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS, PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES, PLUGIN_HTTP_METHODS, PLUGIN_MENTION_TRIGGER_VALUES, PLUGIN_PROVIDER_BRIDGE_OPTIONS_MAX_BYTES, PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES, PLUGIN_PROVIDER_DISPLAY_NAME_MAX_CHARS, PLUGIN_PROVIDER_ENV_MAX_ENTRIES, PLUGIN_PROVIDER_ENV_NAME_PATTERN, PLUGIN_PROVIDER_PERMISSION_MODE_VALUES, PLUGIN_PROVIDER_REASONING_LEVEL_VALUES, PROVIDER_ID_PATTERN, RESERVED_AGENT_TOOL_NAMES, RESERVED_BB_CLI_COMMANDS, RPC_METHOD_PATTERN, SERVER_DIRECT_AI_SERVICE_IDS, SETTING_KEY_PATTERN, adoptHttpRouteResponse, agentToolIconRefusalMessage, aiServiceAlreadyRegisteredMessage, assertAiServiceRegistrable, assertNoRecursiveJsonSchemaReferences, deriveValidatedProviderOptions, enforcePluginCliOutputLimit, isPluginMentionTrigger, isStandardSchema, isZodSchemaLike, normalizeMentionProviderTriggers, parsePluginAgentToolPresentation, pluginCliCollisionWarning, pluginHookAlreadyRegisteredMessage, providerAlreadyRegisteredMessage, providerIconRefusalMessage, providerWithoutBridgeMessage, readRpcMethodContract, registerSettingDescriptors, rejectStaleAgentToolFields, storePluginHook, summarizeParseIssues, summarizeStandardIssues, undeclaredIconProblem, validatePluginAiServiceDeclaration, validatePluginEnvironmentProviderDeclaration, validatePluginProviderDeclaration, validatePluginProviderEnvEntries, validateSettingsUpdate, zodSchemaToJsonSchema };
1563
- export type { AiServiceHostBinding, NormalizedPluginEnvironmentProvider, NormalizedPluginEnvironmentProviderRequirements, NormalizedPluginProviderDeclaration };
1916
+ export { ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS, ENVIRONMENT_PROVIDER_DISPLAY_NAME_MAX_CHARS, ENVIRONMENT_PROVIDER_ID_PATTERN, ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES, KV_VALUE_MAX_BYTES, MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS, PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS, PLUGIN_MENTION_TRIGGER_VALUES, PLUGIN_PROVIDER_BRIDGE_OPTIONS_MAX_BYTES, PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES, PLUGIN_PROVIDER_DISPLAY_NAME_MAX_CHARS, PLUGIN_PROVIDER_ENV_MAX_ENTRIES, PLUGIN_PROVIDER_ENV_NAME_PATTERN, PLUGIN_PROVIDER_PERMISSION_MODE_VALUES, PLUGIN_PROVIDER_REASONING_LEVEL_VALUES, PROVIDER_ID_PATTERN, RESERVED_AGENT_TOOL_NAMES, RESERVED_BB_CLI_COMMANDS, SERVER_DIRECT_AI_SERVICE_IDS, SETTING_KEY_PATTERN, adoptHttpRouteResponse, aiServiceAlreadyRegisteredMessage, assertAiServiceRegistrable, coerceStoredPluginSettingValue, deriveValidatedProviderOptions, enforcePluginCliOutputLimit, environmentCompositionSchema, isPluginMentionTrigger, isStandardSchema, normalizeAgentToolRegistration, normalizeCliRegistration, normalizeHttpRouteRegistration, normalizeInteractionRequest, normalizeMentionProviderRegistration, normalizePluginAgentConfiguration, normalizeRealtimePayload, normalizeRpcJsonResult, normalizeRpcRegistration, normalizeWebSocketRouteRegistration, parsePluginAgentToolPresentation, pluginCliCollisionWarning, pluginHookAlreadyRegisteredMessage, providerAlreadyRegisteredMessage, providerIconRefusalMessage, providerWithoutBridgeMessage, registerSettingDescriptors, runPluginStorageMigrations, storePluginHook, summarizeStandardIssues, undeclaredIconProblem, validateBackgroundServiceRegistration, validatePluginAiServiceDeclaration, validatePluginEnvironmentProviderDeclaration, validatePluginMachineProviderDeclaration, validatePluginProviderDeclaration, validatePluginProviderEnvEntries, validateProviderEnvContribution, validateRpcValue, validateScheduleRegistration, validateServerAccessProviderDeclaration, validateSettingsUpdate };
1917
+ export type { AiServiceHostBinding, NormalizedPluginEnvironmentComposition, NormalizedPluginEnvironmentProvider, NormalizedPluginEnvironmentProviderRequirements, NormalizedPluginMachineProvider, NormalizedPluginProviderDeclaration };
@@ -5,7 +5,7 @@
5
5
  // Confused by the API, or need a symbol that isn't here? Clone the BB repo
6
6
  // and read the real source: https://github.com/get-bb/bb
7
7
 
8
- import { ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginCommandPaletteActionRegistration, PluginProviderIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
8
+ import { ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginCommandPaletteActionRegistration, PluginProviderIconRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
9
9
 
10
10
  type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
11
11
  interface ExperimentalSidebarFooterRuntimeSnapshot {
@@ -36,6 +36,9 @@ interface CollectedCompatibilitySidebarFooterItem {
36
36
  }
37
37
  type CollectedSidebarFooterItem = CollectedCompatibilitySidebarFooterItem | CollectedManagedSidebarFooterItem;
38
38
  declare function adaptSidebarFooterAction(registration: PluginSidebarFooterActionRegistration): CollectedCompatibilitySidebarFooterItem;
39
+ type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
40
+ providerKind: PluginProviderIconRegistration["providerKind"] | "all";
41
+ };
39
42
  /** Validated registrations produced by one plugin app setup execution. */
40
43
  interface CollectedPluginAppRegistrations {
41
44
  homepageSections: PluginHomepageSectionRegistration[];
@@ -57,9 +60,11 @@ interface CollectedPluginAppRegistrations {
57
60
  messageDirectives: PluginMessageDirectiveRegistration[];
58
61
  messageActions: PluginMessageActionRegistration[];
59
62
  commandPaletteActions: PluginCommandPaletteActionRegistration[];
60
- providerIcons: PluginProviderIconRegistration[];
63
+ providerIcons: CollectedPluginProviderIconRegistration[];
64
+ icons: ExperimentalIconRegistration[];
61
65
  timelineRenderers: PluginTimelineRendererRegistration[];
62
66
  environmentProviderInputs: PluginEnvironmentProviderInputsRegistration[];
67
+ machineProviderInputs: PluginMachineProviderInputsRegistration[];
63
68
  contentScripts: PluginContentScriptRegistration[];
64
69
  }
65
70
  declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
@@ -72,4 +77,4 @@ declare function getCollectedSidebarFooterItems(registrations: object): readonly
72
77
  declare function collectPluginAppRegistrations(definition: PluginAppDefinition, onComposerCustomizationRejected?: (reason: string) => void): CollectedPluginAppRegistrations;
73
78
 
74
79
  export { adaptSidebarFooterAction, collectPluginAppRegistrations, getCollectedSidebarFooterItems };
75
- export type { CollectedCompatibilitySidebarFooterItem, CollectedExperimentalSidebarFooterItem, CollectedManagedSidebarFooterItem, CollectedPluginAppRegistrations, CollectedSidebarFooterItem, ExperimentalSidebarFooterCommandKind, ExperimentalSidebarFooterItemRuntime, ExperimentalSidebarFooterRuntimeSnapshot };
80
+ export type { CollectedCompatibilitySidebarFooterItem, CollectedExperimentalSidebarFooterItem, CollectedManagedSidebarFooterItem, CollectedPluginAppRegistrations, CollectedPluginProviderIconRegistration, CollectedSidebarFooterItem, ExperimentalSidebarFooterCommandKind, ExperimentalSidebarFooterItemRuntime, ExperimentalSidebarFooterRuntimeSnapshot };