@get-bb/plugin-sdk 0.6.60 → 0.6.68
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 +477 -169
- package/bundled-types/bb-plugin-sdk-host.d.ts +196 -214
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +60 -35
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +17 -7
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +5 -11
- 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 +8 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +29 -5
- package/bundled-types/bb-plugin-sdk.d.ts +622 -195
- package/dist/app.js +98 -0
- package/dist/host.js +12 -0
- package/dist/index.js +81 -0
- package/dist/internal/composer-handle.js +13 -14
- package/dist/internal/host-policy.js +33 -1
- package/dist/internal/plugin-app-collector.js +104 -85
- package/dist/internal/rpc-query-host.js +1574 -0
- package/dist/internal/rpc-tags.js +18 -0
- package/dist/provider-bridge-acp-next.js +2636 -2653
- package/dist/provider-bridge-acp.js +2636 -2653
- package/dist/provider-bridge-testing.js +1210 -1238
- package/dist/provider-bridge.js +1279 -1306
- package/dist/replay-provider-child.mjs +6 -2
- package/dist/testing/app.js +1826 -163
- package/dist/testing/index.js +302 -104
- package/package.json +16 -2
|
@@ -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 { StandardSchemaV1 as StandardSchemaV1$1, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, StandardSchemaV1InferOutput, PluginEnvironmentValidateDecision, JsonValue as JsonValue$2, PluginMachineValidateDecision } from '@get-bb/plugin-sdk';
|
|
9
|
+
import { StandardSchemaV1 as StandardSchemaV1$1, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, StandardSchemaV1InferOutput as StandardSchemaV1InferOutput$1, PluginEnvironmentValidateDecision, JsonValue as JsonValue$2, PluginMachineValidateDecision } from '@get-bb/plugin-sdk';
|
|
10
10
|
import Database from 'better-sqlite3';
|
|
11
11
|
|
|
12
12
|
/** Input-form entry: a path, or a path with options. */
|
|
@@ -476,6 +476,12 @@ declare const threadQueuedMessageSchema: z.ZodObject<{
|
|
|
476
476
|
}, z.core.$strip>;
|
|
477
477
|
type ThreadQueuedMessage = z.infer<typeof threadQueuedMessageSchema>;
|
|
478
478
|
|
|
479
|
+
interface ContractTagDeclarations<Input, Output> {
|
|
480
|
+
tags?(input: Input, output: Output): readonly string[];
|
|
481
|
+
keyTags?(key: string, value: Output extends Readonly<Record<string, infer Value>> ? Value : unknown): readonly string[];
|
|
482
|
+
invalidates?(input: Input, output: Output): readonly string[];
|
|
483
|
+
}
|
|
484
|
+
|
|
479
485
|
type ExecutionInputFieldSource = CallerExecutionInputSource;
|
|
480
486
|
declare const threadResponseSchema: z.ZodObject<{
|
|
481
487
|
activeBackgroundAgentCount: z.ZodNumber;
|
|
@@ -549,7 +555,7 @@ type Checkout<R> = R extends {
|
|
|
549
555
|
path: string;
|
|
550
556
|
experimental_ownsPath: boolean;
|
|
551
557
|
} | null;
|
|
552
|
-
type InputsValue$1<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
|
|
558
|
+
type InputsValue$1<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput$1<S> : null;
|
|
553
559
|
/** Attempt-scoped updates; core persists each update before this call returns. */
|
|
554
560
|
interface PluginEnvironmentProviderProgress {
|
|
555
561
|
step(text: string): void;
|
|
@@ -662,7 +668,7 @@ declare const RESERVED_BB_CLI_COMMANDS: readonly string[];
|
|
|
662
668
|
|
|
663
669
|
type PluginMachineProviderResource = Exclude<JsonValue$2, null>;
|
|
664
670
|
type PluginMachineProviderInputsSchema = StandardSchemaV1$1 | undefined;
|
|
665
|
-
type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
|
|
671
|
+
type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput$1<S> : null;
|
|
666
672
|
interface PluginMachineProviderProgress {
|
|
667
673
|
step(text: string): void;
|
|
668
674
|
log(text: string): void;
|
|
@@ -753,8 +759,9 @@ interface PluginRpcValidationIssue {
|
|
|
753
759
|
message: string;
|
|
754
760
|
path?: PluginRpcIssuePathSegment[];
|
|
755
761
|
}
|
|
756
|
-
|
|
757
|
-
|
|
762
|
+
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"];
|
|
763
|
+
/** RPC categories may grow. Handle unknown_error as a fallback for newer server codes. */
|
|
764
|
+
type PluginRpcErrorCode = (typeof rpcErrorCodes)[number];
|
|
758
765
|
/** Structured RPC failure returned as `{ ok: false, error }`. */
|
|
759
766
|
interface PluginRpcError {
|
|
760
767
|
code: PluginRpcErrorCode;
|
|
@@ -797,7 +804,8 @@ interface StandardSchemaV1Issue {
|
|
|
797
804
|
readonly key: PropertyKey;
|
|
798
805
|
})[];
|
|
799
806
|
}
|
|
800
|
-
|
|
807
|
+
type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
808
|
+
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> extends ContractTagDeclarations<StandardSchemaV1InferOutput<InputSchema>, StandardSchemaV1InferOutput<OutputSchema>> {
|
|
801
809
|
readonly experimental_description?: string;
|
|
802
810
|
readonly input: InputSchema;
|
|
803
811
|
readonly output: OutputSchema;
|
|
@@ -2038,6 +2046,7 @@ declare function normalizeWebSocketRouteRegistration(path: string, handler: unkn
|
|
|
2038
2046
|
auth: PluginHttpAuthMode;
|
|
2039
2047
|
};
|
|
2040
2048
|
type RpcRegistrationRecord = {
|
|
2049
|
+
declarations: ContractTagDeclarations<unknown, unknown>;
|
|
2041
2050
|
publication: ReturnType<typeof publishRpcMethod>;
|
|
2042
2051
|
inputSchema: StandardSchemaV1;
|
|
2043
2052
|
outputSchema: StandardSchemaV1;
|
|
@@ -2126,8 +2135,9 @@ declare function normalizePluginAgentConfiguration(args: {
|
|
|
2126
2135
|
skillIds: string[];
|
|
2127
2136
|
instructions: string | null;
|
|
2128
2137
|
};
|
|
2138
|
+
declare function readPluginRpcRefusal(error: unknown): PluginRpcError | null;
|
|
2129
2139
|
declare function validateRpcValue(schema: StandardSchemaV1, value: unknown, phase: "input" | "output", fail: (error: PluginRpcError) => never): Promise<unknown>;
|
|
2130
2140
|
declare function normalizeRpcJsonResult(value: unknown, fail: (error: PluginRpcError) => never): JsonValue;
|
|
2131
2141
|
|
|
2132
|
-
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, SETTING_KEY_PATTERN, adoptHttpRouteResponse, aiServiceAlreadyRegisteredMessage, coerceStoredPluginSettingValue, deriveValidatedProviderOptions, enforcePluginCliOutputLimit, environmentCompositionSchema, isPluginMentionTrigger, isStandardSchema, normalizeAgentToolRegistration, normalizeCliRegistration, normalizeHttpRouteRegistration, normalizeInteractionRequest, normalizeMentionProviderRegistration, normalizePluginAgentConfiguration, normalizeRealtimePayload, normalizeRpcJsonResult, normalizeRpcRegistration, normalizeWebSocketRouteRegistration, parsePluginRowPresentation, pluginCliCollisionWarning, pluginHookAlreadyRegisteredMessage, providerAlreadyRegisteredMessage, providerIconRefusalMessage, providerWithoutBridgeMessage, publishRpcMethod, readRpcPublicationOptions, registerSettingDescriptors, runPluginStorageMigrations, storePluginHook, summarizeStandardIssues, undeclaredIconProblem, validateBackgroundServiceRegistration, validatePluginAiServiceDeclaration, validatePluginEnvironmentProviderDeclaration, validatePluginMachineProviderDeclaration, validatePluginProviderDeclaration, validatePluginProviderEnvEntries, validateProviderEnvContribution, validateRpcValue, validateScheduleRegistration, validateServerAccessProviderDeclaration, validateSettingsUpdate };
|
|
2142
|
+
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, SETTING_KEY_PATTERN, adoptHttpRouteResponse, aiServiceAlreadyRegisteredMessage, coerceStoredPluginSettingValue, deriveValidatedProviderOptions, enforcePluginCliOutputLimit, environmentCompositionSchema, isPluginMentionTrigger, isStandardSchema, normalizeAgentToolRegistration, normalizeCliRegistration, normalizeHttpRouteRegistration, normalizeInteractionRequest, normalizeMentionProviderRegistration, normalizePluginAgentConfiguration, normalizeRealtimePayload, normalizeRpcJsonResult, normalizeRpcRegistration, normalizeWebSocketRouteRegistration, parsePluginRowPresentation, pluginCliCollisionWarning, pluginHookAlreadyRegisteredMessage, providerAlreadyRegisteredMessage, providerIconRefusalMessage, providerWithoutBridgeMessage, publishRpcMethod, readPluginRpcRefusal, readRpcPublicationOptions, registerSettingDescriptors, runPluginStorageMigrations, storePluginHook, summarizeStandardIssues, undeclaredIconProblem, validateBackgroundServiceRegistration, validatePluginAiServiceDeclaration, validatePluginEnvironmentProviderDeclaration, validatePluginMachineProviderDeclaration, validatePluginProviderDeclaration, validatePluginProviderEnvEntries, validateProviderEnvContribution, validateRpcValue, validateScheduleRegistration, validateServerAccessProviderDeclaration, validateSettingsUpdate };
|
|
2133
2143
|
export type { NormalizedPluginAiService, NormalizedPluginEnvironmentComposition, NormalizedPluginEnvironmentProvider, NormalizedPluginEnvironmentProviderRequirements, NormalizedPluginInteractionRequest, NormalizedPluginMachineProvider, NormalizedPluginProviderDeclaration };
|
|
@@ -5,8 +5,8 @@
|
|
|
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, PluginSidebarFooterActionRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationPlacement, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, PluginCommandRegistration, ExperimentalComposerCommandRegistration, PluginProviderIconRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
|
|
8
9
|
import { z } from 'zod';
|
|
9
|
-
import { ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationPlacement, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, PluginCommandRegistration, ExperimentalComposerCommandRegistration, PluginProviderIconRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
|
|
10
10
|
|
|
11
11
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
12
12
|
interface ExperimentalSidebarFooterRuntimeSnapshot {
|
|
@@ -37,11 +37,12 @@ interface CollectedCompatibilitySidebarFooterItem {
|
|
|
37
37
|
}
|
|
38
38
|
type CollectedSidebarFooterItem = CollectedCompatibilitySidebarFooterItem | CollectedManagedSidebarFooterItem;
|
|
39
39
|
declare function adaptSidebarFooterAction(registration: PluginSidebarFooterActionRegistration): CollectedCompatibilitySidebarFooterItem;
|
|
40
|
+
declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
|
|
41
|
+
|
|
40
42
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
41
43
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
42
44
|
};
|
|
43
|
-
|
|
44
|
-
declare const commandShortcutSchema: z.ZodObject<{
|
|
45
|
+
declare function createCommandShortcutSchema(): z.ZodObject<{
|
|
45
46
|
alt: z.ZodDefault<z.ZodBoolean>;
|
|
46
47
|
control: z.ZodDefault<z.ZodBoolean>;
|
|
47
48
|
key: z.ZodString;
|
|
@@ -49,7 +50,7 @@ declare const commandShortcutSchema: z.ZodObject<{
|
|
|
49
50
|
mod: z.ZodDefault<z.ZodBoolean>;
|
|
50
51
|
shift: z.ZodDefault<z.ZodBoolean>;
|
|
51
52
|
}, z.core.$strict>;
|
|
52
|
-
type CollectedCommandShortcut = z.infer<typeof
|
|
53
|
+
type CollectedCommandShortcut = z.infer<ReturnType<typeof createCommandShortcutSchema>> | null;
|
|
53
54
|
type CollectedPluginCommandRegistration = (Omit<PluginCommandRegistration, "defaultShortcut"> & {
|
|
54
55
|
target: "app";
|
|
55
56
|
defaultShortcut: CollectedCommandShortcut;
|
|
@@ -90,13 +91,6 @@ interface CollectedPluginAppRegistrations {
|
|
|
90
91
|
interface CollectedSidebarNavigationRegistration extends ExperimentalSidebarNavigationRegistration {
|
|
91
92
|
placement: ExperimentalSidebarNavigationPlacement;
|
|
92
93
|
}
|
|
93
|
-
declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
|
|
94
|
-
/**
|
|
95
|
-
* Run a plugin app definition against the canonical validating collector.
|
|
96
|
-
* Both the BB app and the public test harness use this implementation so a
|
|
97
|
-
* registration accepted by one cannot be rejected or normalized differently
|
|
98
|
-
* by the other.
|
|
99
|
-
*/
|
|
100
94
|
declare function collectPluginAppRegistrations(definition: PluginAppDefinition, onWarning?: (message: string) => void): CollectedPluginAppRegistrations;
|
|
101
95
|
|
|
102
96
|
export { adaptSidebarFooterAction, collectPluginAppRegistrations, getCollectedSidebarFooterItems };
|
|
@@ -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 {
|
|
@@ -24,6 +24,7 @@ interface ExperimentalSidebarFooterItemRuntime {
|
|
|
24
24
|
type CollectedExperimentalSidebarFooterItem = ExperimentalSidebarFooterItemRegistration & {
|
|
25
25
|
runtime: ExperimentalSidebarFooterItemRuntime;
|
|
26
26
|
};
|
|
27
|
+
|
|
27
28
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
28
29
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
29
30
|
};
|
|
@@ -172,7 +173,7 @@ interface SidebarNavigationCall {
|
|
|
172
173
|
itemId?: string;
|
|
173
174
|
itemIds?: string[];
|
|
174
175
|
isVisible?: boolean;
|
|
175
|
-
|
|
176
|
+
target?: ExperimentalSidebarNavigationTarget;
|
|
176
177
|
}
|
|
177
178
|
type TestClipboard = (content: ExperimentalClipboardContent) => Promise<boolean>;
|
|
178
179
|
/**
|
|
@@ -275,6 +276,7 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
275
276
|
* message (what the real rpc client surfaces).
|
|
276
277
|
*/
|
|
277
278
|
rpc?: PluginRpcTestHandlers<Contract>;
|
|
279
|
+
experimental_rpcContract?: NoInfer<Contract>;
|
|
278
280
|
/** `useSettings()` values; omitted → `{ values: undefined, isLoading: false }`. */
|
|
279
281
|
settings?: Record<string, string | number | boolean>;
|
|
280
282
|
/** `useBbContext()` selection; both default to null. */
|
|
@@ -411,6 +413,7 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
411
413
|
* Push a realtime event to `useRealtime(channel, …)` subscribers, wrapped
|
|
412
414
|
* in act. The payload is JSON-round-tripped like `bb.realtime.publish`.
|
|
413
415
|
*/
|
|
416
|
+
experimental_invalidateRpc(tags: readonly string[] | null): Promise<void>;
|
|
414
417
|
emitRealtime(channel: string, payload: unknown): Promise<void>;
|
|
415
418
|
/** Drive the lifecycle of the same connection used by realtime events. */
|
|
416
419
|
setRealtimeConnectionState(state: PluginRealtimeConnectionState): Promise<void>;
|
|
@@ -421,6 +424,8 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
421
424
|
}
|
|
422
425
|
/** Read-only call/write logs produced while the slot is mounted. */
|
|
423
426
|
interface RenderedSlotInspectionState {
|
|
427
|
+
/** The registered page title hook's current result; null after unmount. */
|
|
428
|
+
readonly experimental_pageTitle: ExperimentalPageTitle | null;
|
|
424
429
|
/** Every `useRpc().call`, in order. */
|
|
425
430
|
readonly rpcCalls: RpcCall[];
|
|
426
431
|
/** Every `useBbNavigate()` call, in order. */
|
|
@@ -460,6 +465,7 @@ interface RenderedSlot extends RenderResult, RenderedSlotBehaviorDrivers, Render
|
|
|
460
465
|
}
|
|
461
466
|
declare function renderSlot<Props extends object, Contract extends PluginRpcContract = PluginRpcContract>(registration: {
|
|
462
467
|
component: ComponentType<Props>;
|
|
468
|
+
experimental_usePageTitle?: (props: Props) => ExperimentalPageTitle | null;
|
|
463
469
|
}, props: Props, options?: RenderSlotOptions<Contract>): RenderedSlot;
|
|
464
470
|
|
|
465
471
|
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, InternalDoNotUsePluginNextTunnelConfig, InternalDoNotUsePluginHostNextTunnelStatus, 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;
|
|
@@ -1229,12 +1236,20 @@ interface FakePluginRegistrations {
|
|
|
1229
1236
|
* (normalized declarations, registration order; dispose removes). */
|
|
1230
1237
|
aiServiceRegistrations: PluginAiServiceDeclaration[];
|
|
1231
1238
|
}
|
|
1239
|
+
/** One handle opened through `bb.server.internal_DO_NOT_USE_openTunnelIngress`. */
|
|
1240
|
+
interface InternalDoNotUseFakeTunnelIngress {
|
|
1241
|
+
readonly audience: string;
|
|
1242
|
+
readonly baseUrl: string;
|
|
1243
|
+
/** True once the plugin closed the handle or the host disposed it. */
|
|
1244
|
+
readonly closed: boolean;
|
|
1245
|
+
}
|
|
1232
1246
|
/** Read-only state for assertions after a plugin registers or handles work. */
|
|
1233
1247
|
interface FakePluginInspectionState {
|
|
1234
1248
|
readonly pluginId: string;
|
|
1235
1249
|
/** Every `bb.log` line, in order. */
|
|
1236
1250
|
readonly logEntries: FakeLogEntry[];
|
|
1237
1251
|
/** Every `bb.realtime.publish`, payload normalized like the wire. */
|
|
1252
|
+
readonly experimental_rpcInvalidations: (readonly string[] | null)[];
|
|
1238
1253
|
readonly realtimeSignals: FakeRealtimeSignal[];
|
|
1239
1254
|
/** Every `bb.status.needsConfiguration` message, in order. */
|
|
1240
1255
|
readonly needsConfigurationMessages: string[];
|
|
@@ -1247,10 +1262,19 @@ interface FakePluginInspectionState {
|
|
|
1247
1262
|
/** Recorded `bb.sdk` calls + stub control. */
|
|
1248
1263
|
readonly sdk: FakeSdkHarness;
|
|
1249
1264
|
readonly registrations: FakePluginRegistrations;
|
|
1265
|
+
/** Every `bb.server.internal_DO_NOT_USE_openTunnelIngress` handle, in order. */
|
|
1266
|
+
readonly internal_DO_NOT_USE_tunnelIngresses: readonly InternalDoNotUseFakeTunnelIngress[];
|
|
1250
1267
|
readonly sharedPortDeclarations: Array<{
|
|
1251
1268
|
hostId: string;
|
|
1252
1269
|
ports: number[];
|
|
1253
1270
|
}>;
|
|
1271
|
+
/** The last `bb.hosts.internal_DO_NOT_USE_setNextTunnels` config, or null. */
|
|
1272
|
+
readonly internal_DO_NOT_USE_nextTunnelConfig: InternalDoNotUsePluginNextTunnelConfig | null;
|
|
1273
|
+
/**
|
|
1274
|
+
* Replace what `bb.hosts.internal_DO_NOT_USE_nextTunnelStatuses` returns and call
|
|
1275
|
+
* every `internal_DO_NOT_USE_onNextTunnelStatusChange` listener.
|
|
1276
|
+
*/
|
|
1277
|
+
internal_DO_NOT_USE_setNextTunnelStatuses(statuses: readonly InternalDoNotUsePluginHostNextTunnelStatus[]): void;
|
|
1254
1278
|
/** Calls made through bb.hosts.experimental_client, after input validation. */
|
|
1255
1279
|
readonly experimental_hostRpcCalls: readonly ExperimentalFakeHostRpcCall[];
|
|
1256
1280
|
readonly pendingInteractions: readonly (PluginInteractionRequest & {
|
|
@@ -1528,4 +1552,4 @@ interface PublicSdkOnlyScan {
|
|
|
1528
1552
|
declare function scanPublicSdkOnly(packageRoot: string, options?: PublicSdkOnlyScanOptions): PublicSdkOnlyScan;
|
|
1529
1553
|
|
|
1530
1554
|
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeHostResponse, makeMessageDispatchHookContext, makePluginAgentConfigurationContext, makeQueueEntry, makeThreadResponse, makeTurnFailedEvent };
|
|
1531
|
-
export type { CreateFakePluginHostOptions, ExperimentalFakeHostRpcCall, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|
|
1555
|
+
export type { CreateFakePluginHostOptions, ExperimentalFakeHostRpcCall, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, InternalDoNotUseFakeTunnelIngress, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|