@get-bb/plugin-sdk 0.4.40 → 0.4.45

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.
package/README.md CHANGED
@@ -117,17 +117,32 @@ npm install --save-dev react react-dom @testing-library/react jsdom # frontend t
117
117
  Backend example:
118
118
 
119
119
  ```ts
120
- import { createFakePluginHost } from "@get-bb/plugin-sdk/testing";
120
+ import {
121
+ createFakePluginHost,
122
+ makePluginAgentConfigurationContext,
123
+ } from "@get-bb/plugin-sdk/testing";
121
124
  import plugin from "./server.js";
122
125
 
123
126
  const host = createFakePluginHost({ pluginId: "notes" });
124
127
  await plugin(host.bb);
125
128
 
129
+ await host.harness.behavior.resolveAgentConfiguration(
130
+ makePluginAgentConfigurationContext({
131
+ provider: { id: "codex" },
132
+ }),
133
+ );
126
134
  await host.harness.behavior.callRpc("list", { query: "today" });
127
135
  expect(host.harness.inspection.registrations.rpcMethods).toContain("list");
128
136
  await host.harness.lifecycle.dispose();
129
137
  ```
130
138
 
139
+ `makePluginAgentConfigurationContext`, `makeMessageDispatchHookContext`,
140
+ `makeThreadResponse`, `makeQueueEntry`, and `makeTurnFailedEvent` return
141
+ complete deterministic SDK objects. Pass partial overrides so a behavioral
142
+ test shows only the values relevant to its scenario. Nested context
143
+ members merge partial overrides against complete defaults, so required contract
144
+ additions remain localized to the shared fixtures.
145
+
131
146
  `harness.behavior` contains deterministic host inputs (RPC/HTTP/CLI calls,
132
147
  events, settings, tools, interactions, and schedules), `harness.inspection`
133
148
  contains registrations and recorded state, and `harness.lifecycle` owns atomic
@@ -1073,6 +1073,14 @@ interface PluginProviderDeclaration {
1073
1073
  */
1074
1074
  deriveProviderOptions?: (context: PluginProviderOptionsContext) => Readonly<Record<string, JsonValue>>;
1075
1075
  }
1076
+ interface ExperimentalPluginProviderEnvEntry {
1077
+ name: string;
1078
+ value: string | {
1079
+ serverPath: string;
1080
+ };
1081
+ reason: string;
1082
+ secret: boolean;
1083
+ }
1076
1084
  type PluginMentionTrigger = "!" | "#" | "$" | "@" | "~";
1077
1085
  /**
1078
1086
  * What a plugin's AI service does. `inference` answers bb's server-side helper
@@ -1111,6 +1119,9 @@ declare const RPC_METHOD_PATTERN: RegExp;
1111
1119
  declare const BACKGROUND_NAME_PATTERN: RegExp;
1112
1120
  declare const CLI_COMMAND_NAME_PATTERN: RegExp;
1113
1121
  declare const AGENT_TOOL_NAME_PATTERN: RegExp;
1122
+ declare const PLUGIN_PROVIDER_ENV_NAME_PATTERN: RegExp;
1123
+ declare const PLUGIN_PROVIDER_ENV_MAX_ENTRIES = 32;
1124
+ declare function validatePluginProviderEnvEntries(value: unknown): ExperimentalPluginProviderEnvEntry[];
1114
1125
  declare const PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS = 4096;
1115
1126
  /** Status labels ride on every tool-call event and share one timeline row. */
1116
1127
  declare const PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS = 80;
@@ -1326,5 +1337,5 @@ declare function storePluginHook<K extends PluginHookName>(records: {
1326
1337
  /** The refusal a second handler for one hook from one plugin gets. */
1327
1338
  declare function pluginHookAlreadyRegisteredMessage(hook: PluginHookName): string;
1328
1339
 
1329
- export { AGENT_TOOL_NAME_PATTERN, BACKGROUND_NAME_PATTERN, CLI_COMMAND_NAME_PATTERN, KV_VALUE_MAX_BYTES, 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_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, undeclaredIconProblem, validatePluginAiServiceDeclaration, validatePluginProviderDeclaration, validateSettingsUpdate, zodSchemaToJsonSchema };
1340
+ export { AGENT_TOOL_NAME_PATTERN, BACKGROUND_NAME_PATTERN, CLI_COMMAND_NAME_PATTERN, KV_VALUE_MAX_BYTES, 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, undeclaredIconProblem, validatePluginAiServiceDeclaration, validatePluginProviderDeclaration, validatePluginProviderEnvEntries, validateSettingsUpdate, zodSchemaToJsonSchema };
1330
1341
  export type { AiServiceHostBinding, NormalizedPluginProviderDeclaration };
@@ -63,6 +63,15 @@ declare const availableModelSchema: z.ZodObject<{
63
63
  type AvailableModel = z.infer<typeof availableModelSchema>;
64
64
 
65
65
  declare const deltaPresentationSchema: z.ZodObject<{
66
+ badge: z.ZodOptional<z.ZodObject<{
67
+ glyph: z.ZodString;
68
+ hint: z.ZodString;
69
+ label: z.ZodString;
70
+ tone: z.ZodEnum<{
71
+ destructive: "destructive";
72
+ neutral: "neutral";
73
+ }>;
74
+ }, z.core.$strip>>;
66
75
  detail: z.ZodOptional<z.ZodString>;
67
76
  icon: z.ZodObject<{
68
77
  glyph: z.ZodString;