@get-bb/plugin-sdk 0.4.30 → 0.4.35
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/bundled-types/bb-plugin-sdk-app.d.ts +124 -3
- package/bundled-types/bb-plugin-sdk-host.d.ts +1 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +563 -8
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +10 -1
- package/bundled-types/bb-plugin-sdk-testing.d.ts +31 -3
- package/bundled-types/bb-plugin-sdk.d.ts +903 -21
- package/dist/internal/host-policy.js +72 -1
- package/dist/internal/plugin-app-collector.js +18 -0
- package/dist/provider-bridge-acp.js +1382 -1369
- package/dist/provider-bridge-testing.js +1014 -1001
- package/dist/provider-bridge.js +1047 -1034
- package/dist/testing/app.js +33 -1
- package/dist/testing/index.js +186 -34
- package/package.json +1 -1
|
@@ -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, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginTimelineRendererRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
|
|
10
|
+
import { PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginTimelineRendererRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, 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
|
|
@@ -91,6 +91,14 @@ interface ComposerLog {
|
|
|
91
91
|
quotes: string[];
|
|
92
92
|
mentions: PluginComposerMention[];
|
|
93
93
|
focusCount: number;
|
|
94
|
+
/**
|
|
95
|
+
* Every `experimental_submit` the plugin ran, in order. The harness composer
|
|
96
|
+
* has no submit pipeline of its own, so it records the options and clears the
|
|
97
|
+
* draft — enough to assert what a picker scheduled and that it tidied up.
|
|
98
|
+
*/
|
|
99
|
+
submits: Array<{
|
|
100
|
+
sendAt: number;
|
|
101
|
+
}>;
|
|
94
102
|
}
|
|
95
103
|
/** One recorded `experimental_useSidebarThreadActions()` call. */
|
|
96
104
|
interface SidebarActionCall {
|
|
@@ -116,6 +124,7 @@ interface CapturedPluginApp {
|
|
|
116
124
|
composerCustomizations: ComposerCustomization[];
|
|
117
125
|
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
118
126
|
sidebarFooterActions: PluginSidebarFooterActionRegistration[];
|
|
127
|
+
experimentalSidebarNavigations: ExperimentalSidebarNavigationRegistration[];
|
|
119
128
|
threadLists: PluginThreadListRegistration[];
|
|
120
129
|
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
121
130
|
fileOpeners: PluginFileOpenerRegistration[];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginAgentToolPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, JsonValue as JsonValue$1, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, PluginSettingDescriptors, PluginAgentConfiguration, PluginAiServiceDeclaration, PluginInteractionRequest } from '@get-bb/plugin-sdk';
|
|
9
|
+
import { BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginAgentToolPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, JsonValue as JsonValue$1, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, PluginSettingDescriptors, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, PluginInteractionRequest } from '@get-bb/plugin-sdk';
|
|
10
10
|
|
|
11
11
|
/** Input-form entry: a path, or a path with options. */
|
|
12
12
|
declare const providerNativeRootInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -74,7 +74,7 @@ type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* The validator-neutral subset of Standard Schema v1 used by plugin
|
|
77
|
+
* The validator-neutral subset of Standard Schema v1 used by plugin contracts.
|
|
78
78
|
* Zod 4 schemas implement this interface directly; other validators can do
|
|
79
79
|
* the same without becoming part of BB's public protocol.
|
|
80
80
|
*/
|
|
@@ -631,6 +631,10 @@ interface FakePluginRegistrations {
|
|
|
631
631
|
projectId: string;
|
|
632
632
|
}) => string | null) | null;
|
|
633
633
|
threadEventHandlers: Record<PluginThreadEventName, number>;
|
|
634
|
+
/** The handler registered per hook by `bb.experimental_hooks.on`. */
|
|
635
|
+
hooks: {
|
|
636
|
+
[K in PluginHookName]: PluginHookHandler<K> | null;
|
|
637
|
+
};
|
|
634
638
|
mentionProviders: FakeMentionProviderRecord[];
|
|
635
639
|
/** Live provider registrations from `bb.providers.register`
|
|
636
640
|
* (normalized declarations, registration order; dispose removes). */
|
|
@@ -648,6 +652,12 @@ interface FakePluginInspectionState {
|
|
|
648
652
|
readonly realtimeSignals: FakeRealtimeSignal[];
|
|
649
653
|
/** Every `bb.status.needsConfiguration` message, in order. */
|
|
650
654
|
readonly needsConfigurationMessages: string[];
|
|
655
|
+
/**
|
|
656
|
+
* How many times the plugin called
|
|
657
|
+
* `bb.experimental_hooks.recheck()` — the wake it asks core for when a
|
|
658
|
+
* condition its own waits depend on has changed.
|
|
659
|
+
*/
|
|
660
|
+
readonly recheckCount: number;
|
|
651
661
|
/** Recorded `bb.sdk` calls + stub control. */
|
|
652
662
|
readonly sdk: FakeSdkHarness;
|
|
653
663
|
readonly registrations: FakePluginRegistrations;
|
|
@@ -811,6 +821,8 @@ interface FakePluginHost {
|
|
|
811
821
|
declare function createFakePluginHost(options?: CreateFakePluginHostOptions): FakePluginHost;
|
|
812
822
|
|
|
813
823
|
type ThreadResponse = PluginThreadEventPayloads["thread.created"]["thread"];
|
|
824
|
+
type QueueEntry = PluginThreadEventPayloads["message.queued"]["entry"];
|
|
825
|
+
type TurnFailedEvent = PluginThreadEventPayloads["turn.failed"];
|
|
814
826
|
/**
|
|
815
827
|
* A complete, deterministic `ThreadResponse` for thread lifecycle event
|
|
816
828
|
* payloads (`harness.emitThreadEvent`). Defaults are the minimal idle
|
|
@@ -818,6 +830,22 @@ type ThreadResponse = PluginThreadEventPayloads["thread.created"]["thread"];
|
|
|
818
830
|
* required field, this builder fails typecheck — update the default here.
|
|
819
831
|
*/
|
|
820
832
|
declare function makeThreadResponse(overrides?: Partial<ThreadResponse>): ThreadResponse;
|
|
833
|
+
/**
|
|
834
|
+
* A complete, deterministic queued row for the `message.*` event payloads
|
|
835
|
+
* and for faking `sdk.threads.queuedMessages.list`. Defaults are a live inline
|
|
836
|
+
* row on this plugin's wait; override what the test is about. If the
|
|
837
|
+
* contract grows a required field, this builder fails typecheck — update the
|
|
838
|
+
* default here.
|
|
839
|
+
*/
|
|
840
|
+
declare function makeQueueEntry(overrides?: Partial<QueueEntry>): QueueEntry;
|
|
841
|
+
/**
|
|
842
|
+
* A complete, deterministic `turn.failed` payload. Defaults are a first attempt
|
|
843
|
+
* that failed inside a provider turn with neither structured error info nor
|
|
844
|
+
* rate limits — the shape a retry policy must handle before it handles the
|
|
845
|
+
* interesting ones. If the contract grows a required field, this builder fails
|
|
846
|
+
* typecheck — update the default here.
|
|
847
|
+
*/
|
|
848
|
+
declare function makeTurnFailedEvent(overrides?: Partial<TurnFailedEvent>): TurnFailedEvent;
|
|
821
849
|
|
|
822
850
|
interface PublicSdkOnlyScanOptions {
|
|
823
851
|
/**
|
|
@@ -848,5 +876,5 @@ interface PublicSdkOnlyScan {
|
|
|
848
876
|
*/
|
|
849
877
|
declare function scanPublicSdkOnly(packageRoot: string, options?: PublicSdkOnlyScanOptions): PublicSdkOnlyScan;
|
|
850
878
|
|
|
851
|
-
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeThreadResponse };
|
|
879
|
+
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeQueueEntry, makeThreadResponse, makeTurnFailedEvent };
|
|
852
880
|
export type { CreateFakePluginHostOptions, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|