@get-bb/plugin-sdk 0.6.60 → 0.6.65
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 +341 -83
- package/bundled-types/bb-plugin-sdk-host.d.ts +196 -214
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +17 -7
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +192 -0
- package/bundled-types/bb-plugin-sdk-internal-rpc-tags.d.ts +23 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +7 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +12 -4
- package/bundled-types/bb-plugin-sdk.d.ts +392 -109
- package/dist/app.js +98 -0
- package/dist/host.js +12 -0
- package/dist/index.js +81 -0
- package/dist/internal/host-policy.js +33 -1
- package/dist/internal/plugin-app-collector.js +16 -0
- package/dist/internal/rpc-query-host.js +922 -0
- package/dist/internal/rpc-tags.js +18 -0
- package/dist/provider-bridge-acp-next.js +37 -26
- package/dist/provider-bridge-acp.js +37 -26
- package/dist/provider-bridge.js +21 -20
- package/dist/replay-provider-child.mjs +6 -2
- package/dist/testing/app.js +1128 -100
- package/dist/testing/index.js +247 -104
- package/package.json +16 -2
|
@@ -0,0 +1,192 @@
|
|
|
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 { QueryClient } from '@tanstack/react-query';
|
|
9
|
+
|
|
10
|
+
interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
14
|
+
|
|
15
|
+
interface ContractTagDeclarations<Input, Output> {
|
|
16
|
+
tags?(input: Input, output: Output): readonly string[];
|
|
17
|
+
keyTags?(key: string, value: Output extends Readonly<Record<string, infer Value>> ? Value : unknown): readonly string[];
|
|
18
|
+
invalidates?(input: Input, output: Output): readonly string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A JSON-safe path segment reported by a Standard Schema validation issue. */
|
|
22
|
+
type PluginRpcIssuePathSegment = string | number;
|
|
23
|
+
/** Validator-neutral validation detail carried by an RPC error envelope. */
|
|
24
|
+
interface PluginRpcValidationIssue {
|
|
25
|
+
message: string;
|
|
26
|
+
path?: PluginRpcIssuePathSegment[];
|
|
27
|
+
}
|
|
28
|
+
declare const rpcErrorCodes: readonly ["forbidden", "not_found", "conflict", "invalid", "invalid_json", "invalid_input", "handler_error", "invalid_output", "non_json_result", "unknown_method", "transport_error", "invalid_response", "unknown_error"];
|
|
29
|
+
/** RPC categories may grow. Handle unknown_error as a fallback for newer server codes. */
|
|
30
|
+
type PluginRpcErrorCode = (typeof rpcErrorCodes)[number];
|
|
31
|
+
/** A client RPC failure. Unknown server codes become unknown_error and remain in serverCode. */
|
|
32
|
+
declare class experimental_PluginRpcCallError extends Error {
|
|
33
|
+
/** Recognizes errors across the packed SDK's separately bundled entries. */
|
|
34
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
35
|
+
readonly code: PluginRpcErrorCode;
|
|
36
|
+
readonly issues?: PluginRpcValidationIssue[];
|
|
37
|
+
readonly status?: number;
|
|
38
|
+
readonly serverCode?: string;
|
|
39
|
+
constructor(args: PluginRpcError & {
|
|
40
|
+
status?: number;
|
|
41
|
+
serverCode?: string;
|
|
42
|
+
});
|
|
43
|
+
/** Normalize failures at the RPC boundary; preserves an existing client error. */
|
|
44
|
+
static from(error: unknown, fallback?: PluginRpcErrorCode): experimental_PluginRpcCallError;
|
|
45
|
+
}
|
|
46
|
+
/** Structured RPC failure returned as `{ ok: false, error }`. */
|
|
47
|
+
interface PluginRpcError {
|
|
48
|
+
code: PluginRpcErrorCode;
|
|
49
|
+
message: string;
|
|
50
|
+
issues?: PluginRpcValidationIssue[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The validator-neutral subset of Standard Schema v1 used by plugin contracts.
|
|
54
|
+
* Zod 4 schemas implement this interface directly; other validators can do
|
|
55
|
+
* the same without becoming part of BB's public protocol.
|
|
56
|
+
*/
|
|
57
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
58
|
+
readonly "~standard": {
|
|
59
|
+
readonly version: 1;
|
|
60
|
+
readonly vendor: string;
|
|
61
|
+
readonly validate: (value: unknown) => StandardSchemaV1Result<Output> | Promise<StandardSchemaV1Result<Output>>;
|
|
62
|
+
readonly jsonSchema?: {
|
|
63
|
+
readonly input: (options: {
|
|
64
|
+
target: string;
|
|
65
|
+
}) => Record<string, unknown>;
|
|
66
|
+
readonly output: (options: {
|
|
67
|
+
target: string;
|
|
68
|
+
}) => Record<string, unknown>;
|
|
69
|
+
};
|
|
70
|
+
readonly types?: {
|
|
71
|
+
readonly input: Input;
|
|
72
|
+
readonly output: Output;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
type StandardSchemaV1Result<Output> = {
|
|
77
|
+
readonly value: Output;
|
|
78
|
+
readonly issues?: undefined;
|
|
79
|
+
} | {
|
|
80
|
+
readonly issues: readonly StandardSchemaV1Issue[];
|
|
81
|
+
};
|
|
82
|
+
interface StandardSchemaV1Issue {
|
|
83
|
+
readonly message: string;
|
|
84
|
+
readonly path?: PropertyKey | readonly (PropertyKey | {
|
|
85
|
+
readonly key: PropertyKey;
|
|
86
|
+
})[];
|
|
87
|
+
}
|
|
88
|
+
type StandardSchemaV1InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
89
|
+
type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
90
|
+
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> extends ContractTagDeclarations<StandardSchemaV1InferOutput<InputSchema>, StandardSchemaV1InferOutput<OutputSchema>> {
|
|
91
|
+
readonly experimental_description?: string;
|
|
92
|
+
readonly input: InputSchema;
|
|
93
|
+
readonly output: OutputSchema;
|
|
94
|
+
}
|
|
95
|
+
type PluginRpcContract = Readonly<Record<string, PluginRpcMethodContract>>;
|
|
96
|
+
/** Methods callable with only keys and returning one value per string key. */
|
|
97
|
+
type ExperimentalRpcKeyedMethod<Contract extends PluginRpcContract> = {
|
|
98
|
+
[Method in keyof Contract & string]: {
|
|
99
|
+
keys: string[];
|
|
100
|
+
} extends StandardSchemaV1InferInput<Contract[Method]["input"]> ? StandardSchemaV1InferOutput<Contract[Method]["input"]> extends {
|
|
101
|
+
keys: string[];
|
|
102
|
+
} ? string extends keyof PluginRpcResult<Contract[Method]> ? Method : never : never : never;
|
|
103
|
+
}[keyof Contract & string];
|
|
104
|
+
/** One keyed method's inferred row value. */
|
|
105
|
+
type ExperimentalRpcKeyedValue<Method extends PluginRpcMethodContract> = PluginRpcResult<Method> extends Record<string, infer Value> ? Value : never;
|
|
106
|
+
type PluginRpcCallInput<Method extends PluginRpcMethodContract> = StandardSchemaV1InferInput<Method["input"]>;
|
|
107
|
+
type PluginRpcCallArgs<Method extends PluginRpcMethodContract> = null extends PluginRpcCallInput<Method> ? [input?: PluginRpcCallInput<Method>] : [input: PluginRpcCallInput<Method>];
|
|
108
|
+
type PluginRpcResult<Method extends PluginRpcMethodContract> = StandardSchemaV1InferOutput<Method["output"]>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* BB live reads are fresh for two seconds, with no polling when freshness expires.
|
|
112
|
+
* Focus does not refetch while BB's realtime connection is healthy. While
|
|
113
|
+
* disconnected, focus/browser-online events recheck stale active reads; BB
|
|
114
|
+
* reconnect invalidates all plugin reads regardless of freshness. Page hiding
|
|
115
|
+
* cancels active attempts; resuming restarts those cancelled reads.
|
|
116
|
+
* Invalidations refresh immediately. Network/abort failures retry twice at
|
|
117
|
+
* 250 ms; HTTP failures, including refusals, do not retry. Writes never retry
|
|
118
|
+
* automatically.
|
|
119
|
+
*/
|
|
120
|
+
interface ExperimentalRpcQueryState<T> {
|
|
121
|
+
/** Latest successful value plus shared predictions; retained during refresh and refresh errors. Plain reads are undefined before first success; keyed reads expose loaded rows (initially an empty record) through select. */
|
|
122
|
+
data: T | undefined;
|
|
123
|
+
/** Last completed read failure, or null. Success clears it; retrying a first load clears the old error while loading. Refresh errors preserve data. */
|
|
124
|
+
error: experimental_PluginRpcCallError | null;
|
|
125
|
+
/** An enabled read is fetching data it has never loaded. For keyed reads this includes missing requested rows; empty/disabled keyed reads are not loading. */
|
|
126
|
+
isLoading: boolean;
|
|
127
|
+
/** A read attempt is active, including background refreshes. Keyed consumers share this activity for their method; offline-paused reads are not fetching. */
|
|
128
|
+
isFetching: boolean;
|
|
129
|
+
/** Force a read regardless of freshness and wait for its attempt/retries. Keyed reads refresh the method's subscribed keys. Failures update error and retain data; this promise resolves rather than rejecting. */
|
|
130
|
+
refetch(): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
interface ExperimentalRpcKeyedQueryState<T, Selection = Record<string, T>> extends ExperimentalRpcQueryState<Selection> {
|
|
133
|
+
}
|
|
134
|
+
interface ExperimentalRpcQueryOptions<Contract extends PluginRpcContract, Method extends keyof Contract & string> {
|
|
135
|
+
contract: Contract;
|
|
136
|
+
pluginId?: string;
|
|
137
|
+
method: Method;
|
|
138
|
+
input: StandardSchemaV1InferInput<Contract[Method]["input"]>;
|
|
139
|
+
enabled?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Predict loaded reads with pure, synchronous update callbacks. Callbacks passed
|
|
143
|
+
* to `update` and `updateKey` may run many times as pending predictions replay
|
|
144
|
+
* over a new confirmed base or another prediction rolls back. Return a new
|
|
145
|
+
* value without mutating `current` or captured inputs, performing side effects,
|
|
146
|
+
* or generating IDs, timestamps, or random values. Generate any such values
|
|
147
|
+
* once before calling `mutate` and include them in the mutation input.
|
|
148
|
+
*/
|
|
149
|
+
interface ExperimentalRpcOptimisticCache<Contract extends PluginRpcContract> {
|
|
150
|
+
update<Method extends keyof Contract & string>(method: Method, input: StandardSchemaV1InferInput<Contract[Method]["input"]>, update: (current: PluginRpcResult<Contract[Method]>) => PluginRpcResult<Contract[Method]>): void;
|
|
151
|
+
updateKey<Method extends ExperimentalRpcKeyedMethod<Contract>>(method: Method, key: string, update: (current: PluginRpcResult<Contract[Method]> extends Record<string, infer Value> ? Value : never) => PluginRpcResult<Contract[Method]> extends Record<string, infer Value> ? Value : never): void;
|
|
152
|
+
}
|
|
153
|
+
interface ExperimentalRpcMutationOptions<Contract extends PluginRpcContract, Method extends keyof Contract & string> {
|
|
154
|
+
contract: Contract;
|
|
155
|
+
pluginId?: string;
|
|
156
|
+
method: Method;
|
|
157
|
+
/** Predict loaded reads synchronously; shared predictions survive accepted writes whose refresh fails. */
|
|
158
|
+
optimistic?(input: StandardSchemaV1InferInput<Contract[Method]["input"]>, cache: ExperimentalRpcOptimisticCache<Contract>): void;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface RpcQueryHost {
|
|
162
|
+
pluginId: string;
|
|
163
|
+
queryClient: QueryClient;
|
|
164
|
+
call(pluginId: string, method: string, input: JsonValue): Promise<unknown>;
|
|
165
|
+
subscribe(pluginId: string): () => void;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare function createRpcQueryHooks(useHost: () => RpcQueryHost): {
|
|
169
|
+
experimental_useRpcQuery: <Contract extends PluginRpcContract, Method extends keyof Contract & string>(options: ExperimentalRpcQueryOptions<Contract, Method>) => ExperimentalRpcQueryState<PluginRpcResult<Contract[Method]>>;
|
|
170
|
+
experimental_useRpcKeyedQuery: <Contract extends PluginRpcContract, Method extends ExperimentalRpcKeyedMethod<Contract>, Selection = Record<string, ExperimentalRpcKeyedValue<Contract[Method]>>>(options: {
|
|
171
|
+
contract: Contract;
|
|
172
|
+
pluginId?: string;
|
|
173
|
+
method: Method;
|
|
174
|
+
keys: readonly string[];
|
|
175
|
+
enabled?: boolean;
|
|
176
|
+
select?(data: Record<string, ExperimentalRpcKeyedValue<Contract[Method]>>): Selection;
|
|
177
|
+
}) => ExperimentalRpcKeyedQueryState<ExperimentalRpcKeyedValue<Contract[Method]>, Selection>;
|
|
178
|
+
experimental_useRpcMutation: <Contract extends PluginRpcContract = Readonly<Record<string, PluginRpcMethodContract<StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>>>>, Method extends keyof Contract & string = keyof Contract & string>(options: ExperimentalRpcMutationOptions<Contract, Method>) => {
|
|
179
|
+
error: experimental_PluginRpcCallError | null;
|
|
180
|
+
mutate: (...args: PluginRpcCallArgs<Contract[Method]>) => Promise<PluginRpcResult<Contract[Method]>>;
|
|
181
|
+
pendingInputs: StandardSchemaV1InferInput<Contract[Method]["input"]>[];
|
|
182
|
+
isPending: boolean;
|
|
183
|
+
reset: () => void;
|
|
184
|
+
};
|
|
185
|
+
experimental_useRpcRefresh: () => {
|
|
186
|
+
isRefreshing: boolean;
|
|
187
|
+
refresh: () => void;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export { createRpcQueryHooks };
|
|
192
|
+
export type { RpcQueryHost };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
interface ContractTagDeclarations<Input, Output> {
|
|
11
|
+
tags?(input: Input, output: Output): readonly string[];
|
|
12
|
+
keyTags?(key: string, value: Output extends Readonly<Record<string, infer Value>> ? Value : unknown): readonly string[];
|
|
13
|
+
invalidates?(input: Input, output: Output): readonly string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const rpcInvalidationTags: z.ZodArray<z.ZodString>;
|
|
17
|
+
declare function rpcResponseTags<Input, Output>(declarations: ContractTagDeclarations<Input, Output>, input: Input, output: Output): {
|
|
18
|
+
tags: string[];
|
|
19
|
+
keyTags: Record<string, string[]>;
|
|
20
|
+
invalidated: string[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { rpcInvalidationTags, rpcResponseTags };
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { ReactNode, ComponentType } from 'react';
|
|
9
9
|
import { RenderResult } from '@testing-library/react';
|
|
10
|
-
import { ExperimentalSidebarFooterItemRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalSidebarNavigationActions } from '@get-bb/plugin-sdk';
|
|
10
|
+
import { ExperimentalSidebarFooterItemRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalPageTitle, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
|
|
11
11
|
|
|
12
12
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
13
13
|
interface ExperimentalSidebarFooterRuntimeSnapshot {
|
|
@@ -172,7 +172,7 @@ interface SidebarNavigationCall {
|
|
|
172
172
|
itemId?: string;
|
|
173
173
|
itemIds?: string[];
|
|
174
174
|
isVisible?: boolean;
|
|
175
|
-
|
|
175
|
+
target?: ExperimentalSidebarNavigationTarget;
|
|
176
176
|
}
|
|
177
177
|
type TestClipboard = (content: ExperimentalClipboardContent) => Promise<boolean>;
|
|
178
178
|
/**
|
|
@@ -275,6 +275,7 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
275
275
|
* message (what the real rpc client surfaces).
|
|
276
276
|
*/
|
|
277
277
|
rpc?: PluginRpcTestHandlers<Contract>;
|
|
278
|
+
experimental_rpcContract?: NoInfer<Contract>;
|
|
278
279
|
/** `useSettings()` values; omitted → `{ values: undefined, isLoading: false }`. */
|
|
279
280
|
settings?: Record<string, string | number | boolean>;
|
|
280
281
|
/** `useBbContext()` selection; both default to null. */
|
|
@@ -411,6 +412,7 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
411
412
|
* Push a realtime event to `useRealtime(channel, …)` subscribers, wrapped
|
|
412
413
|
* in act. The payload is JSON-round-tripped like `bb.realtime.publish`.
|
|
413
414
|
*/
|
|
415
|
+
experimental_invalidateRpc(tags: readonly string[] | null): Promise<void>;
|
|
414
416
|
emitRealtime(channel: string, payload: unknown): Promise<void>;
|
|
415
417
|
/** Drive the lifecycle of the same connection used by realtime events. */
|
|
416
418
|
setRealtimeConnectionState(state: PluginRealtimeConnectionState): Promise<void>;
|
|
@@ -421,6 +423,8 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
421
423
|
}
|
|
422
424
|
/** Read-only call/write logs produced while the slot is mounted. */
|
|
423
425
|
interface RenderedSlotInspectionState {
|
|
426
|
+
/** The registered page title hook's current result; null after unmount. */
|
|
427
|
+
readonly experimental_pageTitle: ExperimentalPageTitle | null;
|
|
424
428
|
/** Every `useRpc().call`, in order. */
|
|
425
429
|
readonly rpcCalls: RpcCall[];
|
|
426
430
|
/** Every `useBbNavigate()` call, in order. */
|
|
@@ -460,6 +464,7 @@ interface RenderedSlot extends RenderResult, RenderedSlotBehaviorDrivers, Render
|
|
|
460
464
|
}
|
|
461
465
|
declare function renderSlot<Props extends object, Contract extends PluginRpcContract = PluginRpcContract>(registration: {
|
|
462
466
|
component: ComponentType<Props>;
|
|
467
|
+
experimental_usePageTitle?: (props: Props) => ExperimentalPageTitle | null;
|
|
463
468
|
}, props: Props, options?: RenderSlotOptions<Contract>): RenderedSlot;
|
|
464
469
|
|
|
465
470
|
export { installTestPluginRuntime, loadPluginApp, mountPluginContentScripts, renderSlot };
|
|
@@ -5,12 +5,12 @@
|
|
|
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 { StandardSchemaV1 as StandardSchemaV1$1, StandardSchemaV1InferOutput, PluginMachineValidateDecision, JsonValue as JsonValue$2, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, PluginEnvironmentValidateDecision, BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginRowPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, PluginMentionProviderRegistration, ExperimentalPluginRpcCaller, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginProviderEnvHealth, PluginSettingDescriptors, ExperimentalPluginWebSocketHandler, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, PluginInteractionRequest, MessageDispatchHookContext } from '@get-bb/plugin-sdk';
|
|
8
|
+
import { StandardSchemaV1 as StandardSchemaV1$1, StandardSchemaV1InferOutput as StandardSchemaV1InferOutput$1, PluginMachineValidateDecision, JsonValue as JsonValue$2, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, PluginEnvironmentValidateDecision, BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginRowPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, PluginMentionProviderRegistration, ExperimentalPluginRpcCaller, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginProviderEnvHealth, PluginSettingDescriptors, ExperimentalPluginWebSocketHandler, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, PluginInteractionRequest, MessageDispatchHookContext } from '@get-bb/plugin-sdk';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type PluginMachineProviderResource = Exclude<JsonValue$2, null>;
|
|
12
12
|
type PluginMachineProviderInputsSchema = StandardSchemaV1$1 | undefined;
|
|
13
|
-
type InputsValue$1<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
|
|
13
|
+
type InputsValue$1<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput$1<S> : null;
|
|
14
14
|
interface PluginMachineProviderProgress {
|
|
15
15
|
step(text: string): void;
|
|
16
16
|
log(text: string): void;
|
|
@@ -270,6 +270,12 @@ type Project = z.infer<typeof projectSchema>;
|
|
|
270
270
|
declare const PROVIDER_FORK_VALUES: readonly ["none", "tip", "checkpoint"];
|
|
271
271
|
type ProviderFork = (typeof PROVIDER_FORK_VALUES)[number];
|
|
272
272
|
|
|
273
|
+
interface ContractTagDeclarations<Input, Output> {
|
|
274
|
+
tags?(input: Input, output: Output): readonly string[];
|
|
275
|
+
keyTags?(key: string, value: Output extends Readonly<Record<string, infer Value>> ? Value : unknown): readonly string[];
|
|
276
|
+
invalidates?(input: Input, output: Output): readonly string[];
|
|
277
|
+
}
|
|
278
|
+
|
|
273
279
|
declare const threadResponseSchema: z.ZodObject<{
|
|
274
280
|
activeBackgroundAgentCount: z.ZodNumber;
|
|
275
281
|
archivedAt: z.ZodNullable<z.ZodNumber>;
|
|
@@ -342,7 +348,7 @@ type Checkout<R> = R extends {
|
|
|
342
348
|
path: string;
|
|
343
349
|
experimental_ownsPath: boolean;
|
|
344
350
|
} | null;
|
|
345
|
-
type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
|
|
351
|
+
type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput$1<S> : null;
|
|
346
352
|
/** Attempt-scoped updates; core persists each update before this call returns. */
|
|
347
353
|
interface PluginEnvironmentProviderProgress {
|
|
348
354
|
step(text: string): void;
|
|
@@ -521,7 +527,8 @@ interface StandardSchemaV1Issue {
|
|
|
521
527
|
readonly key: PropertyKey;
|
|
522
528
|
})[];
|
|
523
529
|
}
|
|
524
|
-
|
|
530
|
+
type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
531
|
+
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> extends ContractTagDeclarations<StandardSchemaV1InferOutput<InputSchema>, StandardSchemaV1InferOutput<OutputSchema>> {
|
|
525
532
|
readonly experimental_description?: string;
|
|
526
533
|
readonly input: InputSchema;
|
|
527
534
|
readonly output: OutputSchema;
|
|
@@ -1235,6 +1242,7 @@ interface FakePluginInspectionState {
|
|
|
1235
1242
|
/** Every `bb.log` line, in order. */
|
|
1236
1243
|
readonly logEntries: FakeLogEntry[];
|
|
1237
1244
|
/** Every `bb.realtime.publish`, payload normalized like the wire. */
|
|
1245
|
+
readonly experimental_rpcInvalidations: (readonly string[] | null)[];
|
|
1238
1246
|
readonly realtimeSignals: FakeRealtimeSignal[];
|
|
1239
1247
|
/** Every `bb.status.needsConfiguration` message, in order. */
|
|
1240
1248
|
readonly needsConfigurationMessages: string[];
|