@get-bb/plugin-sdk 0.4.4 → 0.4.8

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.
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { ReactNode, ComponentType } from 'react';
9
9
  import { RenderResult } from '@testing-library/react';
10
- import { PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, BbNavigate, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
10
+ import { PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, BbNavigate, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
11
11
 
12
12
  /**
13
13
  * `@get-bb/plugin-sdk/testing/app` — the frontend plugin test harness. Tests a
@@ -106,6 +106,7 @@ interface CapturedPluginApp {
106
106
  fileOpeners: PluginFileOpenerRegistration[];
107
107
  messageDirectives: PluginMessageDirectiveRegistration[];
108
108
  messageActions: PluginMessageActionRegistration[];
109
+ providerIcons: PluginProviderIconRegistration[];
109
110
  contentScripts: PluginContentScriptRegistration[];
110
111
  }
111
112
  type PluginAppModule = {
@@ -0,0 +1,47 @@
1
+ // Portable type declarations for `@get-bb/plugin-sdk`. Unpublished BB
2
+ // workspace contracts are flattened; public subpaths may reuse the
3
+ // package root without requiring any other @bb/* package.
4
+ //
5
+ // Confused by the API, or need a symbol that isn't here? Clone the BB repo
6
+ // and read the real source: https://github.com/get-bb/bb
7
+
8
+ import { ExperimentalHostWatchOptions, ExperimentalHostWatchListener, ExperimentalHostWatchSubscription, PluginRpcContract, ExperimentalHostSignals, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, ExperimentalHostEntry } from '@get-bb/plugin-sdk';
9
+
10
+ type HostMethodName<Contract extends PluginRpcContract> = keyof Contract & string;
11
+ type HostSignalName<Signals extends ExperimentalHostSignals> = keyof Signals & string;
12
+ type ExperimentalHostHarnessSignal<Signals extends ExperimentalHostSignals> = {
13
+ [SignalName in HostSignalName<Signals>]: {
14
+ readonly signal: SignalName;
15
+ readonly payload: StandardSchemaV1InferOutput<Signals[SignalName]["payload"]>;
16
+ };
17
+ }[HostSignalName<Signals>];
18
+ interface ExperimentalCreateHostEntryHarnessOptions {
19
+ readonly experimental_paths?: {
20
+ readonly dataDir: string;
21
+ readonly tempDir: string;
22
+ };
23
+ readonly experimental_watch?: (options: ExperimentalHostWatchOptions, listener: ExperimentalHostWatchListener) => ExperimentalHostWatchSubscription | Promise<ExperimentalHostWatchSubscription>;
24
+ }
25
+ interface ExperimentalHostEntryHarness<Contract extends PluginRpcContract, Signals extends ExperimentalHostSignals> {
26
+ /** Invoke one handler through the same validation boundaries as the daemon. */
27
+ experimental_call<MethodName extends HostMethodName<Contract>>(method: MethodName, input: StandardSchemaV1InferInput<Contract[MethodName]["input"]>, options?: {
28
+ readonly signal?: AbortSignal;
29
+ }): Promise<StandardSchemaV1InferOutput<Contract[MethodName]["output"]>>;
30
+ /** Validated signals emitted by handlers, in emission order. */
31
+ experimental_getSignals(): readonly ExperimentalHostHarnessSignal<Signals>[];
32
+ /** Number of worker-retention leases currently held by the entry. */
33
+ experimental_getRetainedWorkerLeaseCount(): number;
34
+ /** Aborted before the entry's dispose hook runs. */
35
+ readonly experimental_lifecycleSignal: AbortSignal;
36
+ /** Abort active calls and run the entry's dispose hook once. */
37
+ experimental_dispose(): Promise<void>;
38
+ }
39
+ /**
40
+ * Test one host entry in-process with the same validation, JSON transport,
41
+ * cancellation, lifecycle, and output-size boundaries as the daemon worker.
42
+ * Process crashes remain an integration concern for PluginHostManager tests.
43
+ */
44
+ declare function experimental_createHostEntryHarness<Contract extends PluginRpcContract, Signals extends ExperimentalHostSignals>(entry: ExperimentalHostEntry<Contract, Signals>, harnessOptions?: ExperimentalCreateHostEntryHarnessOptions): ExperimentalHostEntryHarness<Contract, Signals>;
45
+
46
+ export { experimental_createHostEntryHarness };
47
+ export type { ExperimentalCreateHostEntryHarnessOptions, ExperimentalHostEntryHarness, ExperimentalHostHarnessSignal };
@@ -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 { BbPluginApi, PluginSettingValue, PluginSharedPortTunnelIdentity, PluginAgentToolExperimentalStatusLabels, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, JsonValue, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, PluginSettingDescriptors, PluginAgentConfiguration, PluginInteractionRequest } from '@get-bb/plugin-sdk';
8
+ import { BbPluginApi, PluginSettingValue, PluginSharedPortTunnelIdentity, PluginAgentToolExperimentalStatusLabels, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, JsonValue, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, PluginSettingDescriptors, PluginAgentConfiguration, PluginProviderDeclaration, PluginInteractionRequest } from '@get-bb/plugin-sdk';
9
9
 
10
10
  type BbSdk = BbPluginApi["sdk"];
11
11
  /**
@@ -79,7 +79,7 @@ declare function createFakeSdk(options: {
79
79
  declare class PluginContextStaleError extends Error {
80
80
  constructor(pluginId: string);
81
81
  }
82
- type FakeLogLevel = "debug" | "info" | "warn" | "error";
82
+ type FakeLogLevel = "debug" | "error" | "info" | "warn";
83
83
  interface FakeLogEntry {
84
84
  level: FakeLogLevel;
85
85
  message: string;
@@ -137,6 +137,12 @@ interface FakeRealtimeSignal {
137
137
  /** JSON-round-tripped, like the WS broadcast; `undefined` → `null`. */
138
138
  payload: unknown;
139
139
  }
140
+ interface ExperimentalFakeHostRpcCall {
141
+ method: string;
142
+ input: unknown;
143
+ hostId: string;
144
+ signal?: AbortSignal;
145
+ }
140
146
  /** Everything the plugin registered, exposed raw for assertions. */
141
147
  interface FakePluginRegistrations {
142
148
  settingsDescriptors: PluginSettingDescriptors;
@@ -155,6 +161,9 @@ interface FakePluginRegistrations {
155
161
  }) => string | null) | null;
156
162
  threadEventHandlers: Record<PluginThreadEventName, number>;
157
163
  mentionProviders: FakeMentionProviderRecord[];
164
+ /** Live provider registrations from `experimental_registerProvider`
165
+ * (normalized declarations, registration order; dispose removes). */
166
+ providerRegistrations: PluginProviderDeclaration[];
158
167
  }
159
168
  /** Read-only state for assertions after a plugin registers or handles work. */
160
169
  interface FakePluginInspectionState {
@@ -172,12 +181,18 @@ interface FakePluginInspectionState {
172
181
  hostId: string;
173
182
  ports: number[];
174
183
  }>;
184
+ /** Calls made through bb.hosts.experimental_client, after input validation. */
185
+ readonly experimental_hostRpcCalls: readonly ExperimentalFakeHostRpcCall[];
175
186
  readonly pendingInteractions: readonly (PluginInteractionRequest & {
176
187
  id: string;
177
188
  })[];
178
189
  }
179
190
  /** Deterministic inputs that stand in for behavior normally driven by BB. */
180
191
  interface FakePluginBehaviorDrivers {
192
+ /** Deliver an unexpected host-worker exit to every registered client. */
193
+ experimental_emitHostWorkerExit(hostId: string): Promise<void>;
194
+ /** Deliver a host signal through its registered payload schema. */
195
+ experimental_emitHostSignal(hostId: string, signal: string, payload: unknown): Promise<void>;
181
196
  submitInteraction(id: string, value: JsonValue): void;
182
197
  cancelInteraction(id: string): void;
183
198
  /**
@@ -289,6 +304,8 @@ interface CreateFakePluginHostOptions {
289
304
  agentSkillIds?: readonly string[];
290
305
  /** Read-only identities returned by bb.hosts.ensureSharedPortTunnel. */
291
306
  sharedPortTunnelIdentities?: Record<string, PluginSharedPortTunnelIdentity>;
307
+ /** Deterministic stand-in for the targeted daemon host entry. */
308
+ experimental_callHostRpc?: (call: ExperimentalFakeHostRpcCall) => unknown | Promise<unknown>;
292
309
  }
293
310
  interface FakePluginHost {
294
311
  bb: BbPluginApi;