@get-bb/plugin-sdk 0.4.6 → 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.
- package/README.md +8 -0
- package/bundled-types/bb-plugin-sdk-app.d.ts +213 -111
- package/bundled-types/bb-plugin-sdk-host.d.ts +124 -0
- package/bundled-types/bb-plugin-sdk-internal-composer-customization-validation.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +154 -2
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +37 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +6479 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-testing-host.d.ts +47 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +19 -2
- package/bundled-types/bb-plugin-sdk.d.ts +5801 -5192
- package/dist/host.js +13 -0
- package/dist/index.js +13 -1
- package/dist/internal/composer-customization-validation.js +9 -0
- package/dist/internal/host-policy.js +389 -18
- package/dist/internal/plugin-app-collector.js +519 -0
- package/dist/provider-bridge.js +7656 -0
- package/dist/testing/app.js +321 -257
- package/dist/testing/host.js +165 -0
- package/dist/testing/index.js +529 -26
- package/package.json +29 -1
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* The validator-neutral subset of Standard Schema v1 used by plugin RPC.
|
|
10
|
+
* Zod 4 schemas implement this interface directly; other validators can do
|
|
11
|
+
* the same without becoming part of BB's public protocol.
|
|
12
|
+
*/
|
|
13
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
14
|
+
readonly "~standard": {
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
readonly vendor: string;
|
|
17
|
+
readonly validate: (value: unknown) => StandardSchemaV1Result<Output> | Promise<StandardSchemaV1Result<Output>>;
|
|
18
|
+
readonly types?: {
|
|
19
|
+
readonly input: Input;
|
|
20
|
+
readonly output: Output;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
type StandardSchemaV1Result<Output> = {
|
|
25
|
+
readonly value: Output;
|
|
26
|
+
readonly issues?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
readonly issues: readonly StandardSchemaV1Issue[];
|
|
29
|
+
};
|
|
30
|
+
interface StandardSchemaV1Issue {
|
|
31
|
+
readonly message: string;
|
|
32
|
+
readonly path?: PropertyKey | readonly (PropertyKey | {
|
|
33
|
+
readonly key: PropertyKey;
|
|
34
|
+
})[];
|
|
35
|
+
}
|
|
36
|
+
type StandardSchemaV1InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
37
|
+
type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
38
|
+
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> {
|
|
39
|
+
readonly input: InputSchema;
|
|
40
|
+
readonly output: OutputSchema;
|
|
41
|
+
}
|
|
42
|
+
type PluginRpcContract = Readonly<Record<string, PluginRpcMethodContract>>;
|
|
43
|
+
|
|
44
|
+
interface ExperimentalHostSignalContract<PayloadSchema extends StandardSchemaV1 = StandardSchemaV1> {
|
|
45
|
+
readonly payload: PayloadSchema;
|
|
46
|
+
}
|
|
47
|
+
type ExperimentalHostSignals = Readonly<Record<string, ExperimentalHostSignalContract>>;
|
|
48
|
+
interface ExperimentalHostPaths {
|
|
49
|
+
/** Persistent directory scoped to this plugin on this daemon. */
|
|
50
|
+
readonly dataDir: string;
|
|
51
|
+
/** Temporary directory scoped to this worker process. */
|
|
52
|
+
readonly tempDir: string;
|
|
53
|
+
}
|
|
54
|
+
type ExperimentalHostWatchChangeType = "create" | "delete" | "update";
|
|
55
|
+
interface ExperimentalHostWatchChange {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly type: ExperimentalHostWatchChangeType;
|
|
58
|
+
}
|
|
59
|
+
type ExperimentalHostWatchEvent = {
|
|
60
|
+
readonly kind: "changed";
|
|
61
|
+
readonly changes: readonly ExperimentalHostWatchChange[];
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "rescan-required";
|
|
64
|
+
} | {
|
|
65
|
+
readonly kind: "watch-error";
|
|
66
|
+
readonly message: string;
|
|
67
|
+
};
|
|
68
|
+
interface ExperimentalHostWatchOptions {
|
|
69
|
+
/** Absolute directory observed by the daemon's native watcher service. */
|
|
70
|
+
readonly rootPath: string;
|
|
71
|
+
/** Root-relative ignore entries using the native watcher syntax. */
|
|
72
|
+
readonly ignoredPaths?: readonly string[];
|
|
73
|
+
/** Quiet period before one coalesced delivery. Defaults to 75 ms. */
|
|
74
|
+
readonly debounceMs?: number;
|
|
75
|
+
/** Maximum time changes may wait. Defaults to 500 ms. */
|
|
76
|
+
readonly maxWaitMs?: number;
|
|
77
|
+
}
|
|
78
|
+
interface ExperimentalHostWatchSubscription {
|
|
79
|
+
dispose(): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
interface ExperimentalHostWorkerLease {
|
|
82
|
+
/** Release this worker-retention lease. Safe to call more than once. */
|
|
83
|
+
dispose(): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
type ExperimentalHostWatchListener = (event: ExperimentalHostWatchEvent) => void | Promise<void>;
|
|
86
|
+
interface ExperimentalHostRpcContext<Signals extends ExperimentalHostSignals = {}> {
|
|
87
|
+
/** Aborted when this request is cancelled or its worker is disposed. */
|
|
88
|
+
readonly signal: AbortSignal;
|
|
89
|
+
/** Aborted once for the lifetime of this worker process. */
|
|
90
|
+
readonly lifecycle: {
|
|
91
|
+
readonly signal: AbortSignal;
|
|
92
|
+
};
|
|
93
|
+
readonly experimental_paths: ExperimentalHostPaths;
|
|
94
|
+
/** Publish a validated, ephemeral event to this plugin's server entry. */
|
|
95
|
+
experimental_emitSignal<SignalName extends keyof Signals & string>(signal: SignalName, payload: StandardSchemaV1InferInput<Signals[SignalName]["payload"]>): Promise<void>;
|
|
96
|
+
/** Observe raw filesystem changes through the daemon's native watcher. */
|
|
97
|
+
experimental_watch(options: ExperimentalHostWatchOptions, listener: ExperimentalHostWatchListener): Promise<ExperimentalHostWatchSubscription>;
|
|
98
|
+
/**
|
|
99
|
+
* Keep this worker alive after the current call finishes. Active calls and
|
|
100
|
+
* filesystem watches already retain it; use this only for other background
|
|
101
|
+
* work. The daemon may stop an unretained worker after an idle period.
|
|
102
|
+
*/
|
|
103
|
+
experimental_retainWorker(): ExperimentalHostWorkerLease;
|
|
104
|
+
}
|
|
105
|
+
type ExperimentalHostRpcHandlers<Contract extends PluginRpcContract, Signals extends ExperimentalHostSignals = {}> = {
|
|
106
|
+
[MethodName in keyof Contract]: (input: StandardSchemaV1InferOutput<Contract[MethodName]["input"]>, context: ExperimentalHostRpcContext<Signals>) => StandardSchemaV1InferInput<Contract[MethodName]["output"]> | Promise<StandardSchemaV1InferInput<Contract[MethodName]["output"]>>;
|
|
107
|
+
};
|
|
108
|
+
interface ExperimentalHostEntry<Contract extends PluginRpcContract = PluginRpcContract, Signals extends ExperimentalHostSignals = {}> {
|
|
109
|
+
readonly experimental_apiVersion: 1;
|
|
110
|
+
readonly contract: Contract;
|
|
111
|
+
readonly experimental_signals?: Signals;
|
|
112
|
+
readonly handlers: ExperimentalHostRpcHandlers<Contract, Signals>;
|
|
113
|
+
readonly dispose?: () => void | Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
/** Define the single host executable exported by `bb.host`. */
|
|
116
|
+
declare function experimental_defineHostEntry<const Contract extends PluginRpcContract, const Signals extends ExperimentalHostSignals = {}>(args: {
|
|
117
|
+
contract: Contract;
|
|
118
|
+
experimental_signals?: Signals;
|
|
119
|
+
handlers: ExperimentalHostRpcHandlers<Contract, Signals>;
|
|
120
|
+
dispose?: () => void | Promise<void>;
|
|
121
|
+
}): ExperimentalHostEntry<Contract, Signals>;
|
|
122
|
+
|
|
123
|
+
export { experimental_defineHostEntry };
|
|
124
|
+
export type { ExperimentalHostEntry, ExperimentalHostPaths, ExperimentalHostRpcContext, ExperimentalHostRpcHandlers, ExperimentalHostSignalContract, ExperimentalHostSignals, ExperimentalHostWatchChange, ExperimentalHostWatchChangeType, ExperimentalHostWatchEvent, ExperimentalHostWatchListener, ExperimentalHostWatchOptions, ExperimentalHostWatchSubscription, ExperimentalHostWorkerLease };
|
|
@@ -16,6 +16,11 @@ type RejectionReporter = (reason: string) => void;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function normalizePluginThreadRowStatus(value: unknown, onRejected: RejectionReporter): PluginComposerThreadRowStatus | null | undefined;
|
|
18
18
|
declare function requireSlotId(kind: string, value: unknown): string;
|
|
19
|
+
/**
|
|
20
|
+
* Provider ids follow the same character rules as slot ids, but they name a
|
|
21
|
+
* provider the host knows (`codex`, `acp-cursor`), not a per-plugin slot.
|
|
22
|
+
*/
|
|
23
|
+
declare function requireProviderId(kind: string, value: unknown): string;
|
|
19
24
|
declare function requireMessageDirectiveId(kind: string, value: unknown): string;
|
|
20
25
|
declare function requireNonEmptyString(kind: string, field: string, value: unknown): string;
|
|
21
26
|
declare function requireOptionalString(kind: string, field: string, value: unknown): string | undefined;
|
|
@@ -27,4 +32,4 @@ declare function requireUniqueId(kind: string, seen: Set<string>, id: string): v
|
|
|
27
32
|
*/
|
|
28
33
|
declare function collectComposerCustomization(registration: unknown, seenIds: Set<string>, onRejected: RejectionReporter): ComposerCustomization | null;
|
|
29
34
|
|
|
30
|
-
export { PLUGIN_SLOT_ID_PATTERN, collectComposerCustomization, normalizePluginThreadRowStatus, requireComponent, requireMessageDirectiveId, requireNonEmptyString, requireOptionalString, requireSlotId, requireUniqueId };
|
|
35
|
+
export { PLUGIN_SLOT_ID_PATTERN, collectComposerCustomization, normalizePluginThreadRowStatus, requireComponent, requireMessageDirectiveId, requireNonEmptyString, requireOptionalString, requireProviderId, requireSlotId, requireUniqueId };
|
|
@@ -16,6 +16,25 @@
|
|
|
16
16
|
*/
|
|
17
17
|
declare const RESERVED_BB_CLI_COMMANDS: readonly string[];
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* How completely a provider can clone one of its sessions — the single
|
|
21
|
+
* vocabulary shared by the provider declaration
|
|
22
|
+
* (`bb.agents.experimental_registerProvider`), the server→daemon
|
|
23
|
+
* `bridgeLaunch`, and the bridge's `initialize` handshake.
|
|
24
|
+
*
|
|
25
|
+
* - `"none"`: sessions cannot be cloned at all.
|
|
26
|
+
* - `"tip"`: only the current end of a session can be cloned (ACP
|
|
27
|
+
* `session/fork`), so thread fork works but edit-past-message rewind
|
|
28
|
+
* cannot.
|
|
29
|
+
* - `"checkpoint"`: a session can be recreated at an earlier point, which is
|
|
30
|
+
* what edit-past-message rewind needs.
|
|
31
|
+
*
|
|
32
|
+
* The values are ordered least to most capable: a declaration is a ceiling
|
|
33
|
+
* the handshake may narrow but never widen.
|
|
34
|
+
*/
|
|
35
|
+
declare const PROVIDER_FORK_VALUES: readonly ["none", "tip", "checkpoint"];
|
|
36
|
+
type ProviderFork = (typeof PROVIDER_FORK_VALUES)[number];
|
|
37
|
+
|
|
19
38
|
/**
|
|
20
39
|
* The validator-neutral subset of Standard Schema v1 used by plugin RPC.
|
|
21
40
|
* Zod 4 schemas implement this interface directly; other validators can do
|
|
@@ -94,7 +113,107 @@ interface PluginCliExecutionResult {
|
|
|
94
113
|
stderr: string;
|
|
95
114
|
error?: PluginCliOutputLimitError;
|
|
96
115
|
}
|
|
97
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Permission modes a provider can run a session in — BB's own permission
|
|
118
|
+
* vocabulary, ordered least ("accept-edits") to most ("full") privileged.
|
|
119
|
+
*/
|
|
120
|
+
type PluginProviderPermissionMode = "accept-edits" | "auto" | "full";
|
|
121
|
+
/**
|
|
122
|
+
* Coarse reasoning-effort ladder entries, ordered lowest to highest. The
|
|
123
|
+
* declared ladder is a fallback only: precise per-model reasoning sets come
|
|
124
|
+
* from the provider's model list at runtime.
|
|
125
|
+
*/
|
|
126
|
+
type PluginProviderReasoningLevel = "high" | "low" | "max" | "medium" | "none" | "ultra" | "ultracode" | "xhigh";
|
|
127
|
+
/**
|
|
128
|
+
* Composer actions a provider supports, by name only. The skills
|
|
129
|
+
* slash-command typeahead is universal — BB injects skills into every
|
|
130
|
+
* provider — so it is implicit and never declared, and the composer owns the
|
|
131
|
+
* trigger syntax (`/plan `, `/goal `) rather than each declaration repeating
|
|
132
|
+
* it.
|
|
133
|
+
*/
|
|
134
|
+
type PluginProviderComposerAction = "goal" | "plan";
|
|
135
|
+
/**
|
|
136
|
+
* Pre-session capability facts about a provider. A capability earns a field
|
|
137
|
+
* here only when it passes BOTH tests: (1) a consumer outside the provider's
|
|
138
|
+
* own plugin needs the fact, and (2) the fact is needed before / without a
|
|
139
|
+
* live session (picker rendering, route gating, cross-plugin tool
|
|
140
|
+
* composition — including with the host offline). Every boolean is a
|
|
141
|
+
* provider-native fact — the provider implements the feature; the flag only
|
|
142
|
+
* tells external consumers it exists. Everything else is a handshake fact the
|
|
143
|
+
* bridge reports at `initialize`, where it cannot drift from behavior.
|
|
144
|
+
*/
|
|
145
|
+
interface PluginProviderCapabilities {
|
|
146
|
+
/** The provider accepts a fast/priority service-tier choice — shows the
|
|
147
|
+
* service-tier toggle in the picker. */
|
|
148
|
+
supportsServiceTier: boolean;
|
|
149
|
+
/** The provider ships its own native ask-user-question tool — the
|
|
150
|
+
* ask-user-question plugin skips registering its duplicate. */
|
|
151
|
+
supportsNativeUserQuestion: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* How completely the provider can clone a session: `"none"` (not at all),
|
|
154
|
+
* `"tip"` (only the current end, so thread fork works but edit-past-message
|
|
155
|
+
* rewind cannot), or `"checkpoint"` (recreate the session at an earlier
|
|
156
|
+
* point, which rewind needs). Gates the fork and edit-past-message
|
|
157
|
+
* affordances. The bridge reports the same fact at `initialize`, where it
|
|
158
|
+
* may narrow this declaration but never widen it.
|
|
159
|
+
*/
|
|
160
|
+
fork: ProviderFork;
|
|
161
|
+
/** The provider accepts an explicit context-compaction request — gates the
|
|
162
|
+
* compact affordance. */
|
|
163
|
+
supportsManualCompaction: boolean;
|
|
164
|
+
/** The provider keeps its own thread archive, so BB mirrors archive and
|
|
165
|
+
* unarchive onto it instead of tracking the state only in bb's own rows. */
|
|
166
|
+
supportsThreadArchive: boolean;
|
|
167
|
+
/** The provider stores a thread name of its own, so BB forwards renames to
|
|
168
|
+
* it. */
|
|
169
|
+
supportsThreadRename: boolean;
|
|
170
|
+
/** The provider can run BB's Workflow tools — gates the workflows opt-in on
|
|
171
|
+
* new threads. */
|
|
172
|
+
supportsWorkflows: boolean;
|
|
173
|
+
/** Permission modes the provider can actually run in. Non-empty, no
|
|
174
|
+
* duplicates. */
|
|
175
|
+
permissionModes: readonly PluginProviderPermissionMode[];
|
|
176
|
+
/** The provider's coarse fallback reasoning ladder (see
|
|
177
|
+
* {@link PluginProviderReasoningLevel}). Non-empty, no duplicates. */
|
|
178
|
+
reasoningLevels: readonly PluginProviderReasoningLevel[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* One provider this plugin contributes to BB's provider registry.
|
|
182
|
+
*
|
|
183
|
+
* Ids are stable public identifiers — thread rows and routes reference them —
|
|
184
|
+
* and are collision-rejected: a declaration whose id matches another plugin's
|
|
185
|
+
* live registration, or reserves a first-party provider it does not own, is
|
|
186
|
+
* refused. Registrations are replaced wholesale on plugin reload, like every
|
|
187
|
+
* other plugin surface.
|
|
188
|
+
*
|
|
189
|
+
* A declaration is metadata only. The implementation is the plugin's own
|
|
190
|
+
* provider bridge, named by `bb.providerBridge` in the manifest and built into
|
|
191
|
+
* the artifact BB ships to hosts — declaring a provider without one is
|
|
192
|
+
* refused, because the picker entry would exist and no turn on it could ever
|
|
193
|
+
* run.
|
|
194
|
+
*/
|
|
195
|
+
interface PluginProviderDeclaration {
|
|
196
|
+
/** Stable provider id: 2–64 characters of lowercase letters, digits, and
|
|
197
|
+
* "-", starting with a letter or digit. Existing ids must never change —
|
|
198
|
+
* threads persist them. */
|
|
199
|
+
id: string;
|
|
200
|
+
/** Picker display name: 1–80 characters, non-blank. */
|
|
201
|
+
displayName: string;
|
|
202
|
+
/**
|
|
203
|
+
* Optional picker icon, in the same grammar as `bb.branding.icon`: either a
|
|
204
|
+
* named host glyph (`"Zap"`) or a plugin-relative path starting with `"./"`
|
|
205
|
+
* (`"./icons/agent.svg"`). Paths follow the manifest entry-path escape rules
|
|
206
|
+
* — no leading "/", no ".." segments, no backslashes.
|
|
207
|
+
*/
|
|
208
|
+
icon?: string;
|
|
209
|
+
/** Pre-session capability facts (see the declaration tests on
|
|
210
|
+
* {@link PluginProviderCapabilities}). */
|
|
211
|
+
capabilities: PluginProviderCapabilities;
|
|
212
|
+
/** Composer actions this provider supports. No duplicates; may be empty
|
|
213
|
+
* (the universal skills typeahead is implicit). */
|
|
214
|
+
composerActions: readonly PluginProviderComposerAction[];
|
|
215
|
+
}
|
|
216
|
+
type PluginMentionTrigger = "!" | "#" | "$" | "@" | "~";
|
|
98
217
|
|
|
99
218
|
/**
|
|
100
219
|
* Built-in dynamic tool names plugins may not shadow. Maintained by hand —
|
|
@@ -117,6 +236,7 @@ declare const PLUGIN_AGENT_SELECTION_MAX_IDS = 256;
|
|
|
117
236
|
declare const PLUGIN_AGENT_DYNAMIC_INSTRUCTIONS_MAX_CHARS = 4096;
|
|
118
237
|
declare const PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES: number;
|
|
119
238
|
declare const MENTION_PROVIDER_ID_PATTERN: RegExp;
|
|
239
|
+
declare const PROVIDER_ID_PATTERN: RegExp;
|
|
120
240
|
declare const SETTING_KEY_PATTERN: RegExp;
|
|
121
241
|
/**
|
|
122
242
|
* Validate freeform descriptors from plugin code and merge them into the
|
|
@@ -129,13 +249,45 @@ declare function validateSettingsUpdate(descriptors: PluginSettingDescriptors, v
|
|
|
129
249
|
declare const PLUGIN_MENTION_TRIGGER_VALUES: readonly ["@", "#", "$", "!", "~"];
|
|
130
250
|
declare function isPluginMentionTrigger(value: unknown): value is PluginMentionTrigger;
|
|
131
251
|
declare function normalizeMentionProviderTriggers(providerId: string, triggers: unknown): readonly PluginMentionTrigger[];
|
|
252
|
+
declare const PLUGIN_PROVIDER_DISPLAY_NAME_MAX_CHARS = 80;
|
|
253
|
+
declare const PLUGIN_PROVIDER_PERMISSION_MODE_VALUES: readonly ["accept-edits", "auto", "full"];
|
|
254
|
+
declare const PLUGIN_PROVIDER_REASONING_LEVEL_VALUES: readonly ["none", "low", "medium", "high", "xhigh", "ultracode", "max", "ultra"];
|
|
255
|
+
declare const PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES: readonly ["plan", "goal"];
|
|
256
|
+
/**
|
|
257
|
+
* Validate one `bb.agents.experimental_registerProvider` declaration. Plugin
|
|
258
|
+
* sources are untyped at runtime, so every field is checked; the production
|
|
259
|
+
* host and the fake host both call this, so they accept and reject provider
|
|
260
|
+
* declarations identically. Throws a descriptive error on the first problem;
|
|
261
|
+
* returns a normalized, deeply frozen copy carrying only contract fields.
|
|
262
|
+
*/
|
|
263
|
+
declare function validatePluginProviderDeclaration(declaration: PluginProviderDeclaration): PluginProviderDeclaration;
|
|
132
264
|
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
133
265
|
declare function readRpcMethodContract(method: string, value: unknown): PluginRpcMethodContract;
|
|
134
266
|
/** Duck-typed zod detection: plugin sources may carry their own zod copy,
|
|
135
267
|
* so instanceof is useless — anything with safeParse is treated as zod. */
|
|
136
268
|
declare function isZodSchemaLike(value: unknown): boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Reject recursive local references before a tool schema reaches a provider.
|
|
271
|
+
* Some providers reject the complete tool list when any one schema contains a
|
|
272
|
+
* recursive `$ref`, so this is a shared production/fake-host boundary rule.
|
|
273
|
+
*/
|
|
274
|
+
declare function assertNoRecursiveJsonSchemaReferences(schema: unknown, subject: string): void;
|
|
137
275
|
/** Compact issue summary from a (possibly foreign-instance) zod error. */
|
|
138
276
|
declare function summarizeParseIssues(error: unknown): string;
|
|
139
277
|
declare function enforcePluginCliOutputLimit(result: Omit<PluginCliExecutionResult, "error">, jsonOutput: boolean): PluginCliExecutionResult;
|
|
278
|
+
/**
|
|
279
|
+
* Adopt the value a plugin HTTP route handler returned.
|
|
280
|
+
*
|
|
281
|
+
* Plugin handlers can run in a different realm (jiti-loaded modules, bundled
|
|
282
|
+
* fetch polyfills), so a valid `Response` from a handler can fail
|
|
283
|
+
* `instanceof Response` in the host (#1661). Both the real host and the fake
|
|
284
|
+
* host accept a structurally valid Response from any realm and re-wrap it
|
|
285
|
+
* into a this-realm `Response`, so Hono always consumes a native object and a
|
|
286
|
+
* malformed return still fails at the invoke boundary with a pointed error.
|
|
287
|
+
*
|
|
288
|
+
* The body streams through: a foreign `body` stream is piped chunk by chunk
|
|
289
|
+
* with cancellation forwarded to the source, so no full-size buffer is made.
|
|
290
|
+
*/
|
|
291
|
+
declare function adoptHttpRouteResponse(value: unknown): Response;
|
|
140
292
|
|
|
141
|
-
export { AGENT_TOOL_NAME_PATTERN, BACKGROUND_NAME_PATTERN, CLI_COMMAND_NAME_PATTERN, KV_VALUE_MAX_BYTES, MENTION_PROVIDER_ID_PATTERN, PLUGIN_AGENT_DYNAMIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_SELECTION_MAX_IDS, PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS, PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES, PLUGIN_HTTP_METHODS, PLUGIN_MENTION_TRIGGER_VALUES, RESERVED_AGENT_TOOL_NAMES, RESERVED_BB_CLI_COMMANDS, RPC_METHOD_PATTERN, SETTING_KEY_PATTERN, enforcePluginCliOutputLimit, isPluginMentionTrigger, isStandardSchema, isZodSchemaLike, normalizeMentionProviderTriggers, readRpcMethodContract, registerSettingDescriptors, summarizeParseIssues, validateSettingsUpdate };
|
|
293
|
+
export { AGENT_TOOL_NAME_PATTERN, BACKGROUND_NAME_PATTERN, CLI_COMMAND_NAME_PATTERN, KV_VALUE_MAX_BYTES, MENTION_PROVIDER_ID_PATTERN, PLUGIN_AGENT_DYNAMIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_SELECTION_MAX_IDS, PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS, PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS, PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES, PLUGIN_HTTP_METHODS, PLUGIN_MENTION_TRIGGER_VALUES, PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES, PLUGIN_PROVIDER_DISPLAY_NAME_MAX_CHARS, PLUGIN_PROVIDER_PERMISSION_MODE_VALUES, PLUGIN_PROVIDER_REASONING_LEVEL_VALUES, PROVIDER_ID_PATTERN, RESERVED_AGENT_TOOL_NAMES, RESERVED_BB_CLI_COMMANDS, RPC_METHOD_PATTERN, SETTING_KEY_PATTERN, adoptHttpRouteResponse, assertNoRecursiveJsonSchemaReferences, enforcePluginCliOutputLimit, isPluginMentionTrigger, isStandardSchema, isZodSchemaLike, normalizeMentionProviderTriggers, readRpcMethodContract, registerSettingDescriptors, summarizeParseIssues, validatePluginProviderDeclaration, validateSettingsUpdate };
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
|
|
9
|
+
|
|
10
|
+
/** Validated registrations produced by one plugin app setup execution. */
|
|
11
|
+
interface CollectedPluginAppRegistrations {
|
|
12
|
+
homepageSections: PluginHomepageSectionRegistration[];
|
|
13
|
+
settingsSections: PluginSettingsSectionRegistration[];
|
|
14
|
+
navPanels: PluginNavPanelRegistration[];
|
|
15
|
+
threadPanelActions: PluginThreadPanelActionRegistration[];
|
|
16
|
+
newThreadPanelActions: PluginNewThreadPanelActionRegistration[];
|
|
17
|
+
composerCustomizations: ComposerCustomization[];
|
|
18
|
+
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
19
|
+
sidebarFooterActions: PluginSidebarFooterActionRegistration[];
|
|
20
|
+
threadLists: PluginThreadListRegistration[];
|
|
21
|
+
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
22
|
+
fileOpeners: PluginFileOpenerRegistration[];
|
|
23
|
+
messageDirectives: PluginMessageDirectiveRegistration[];
|
|
24
|
+
messageActions: PluginMessageActionRegistration[];
|
|
25
|
+
providerIcons: PluginProviderIconRegistration[];
|
|
26
|
+
contentScripts: PluginContentScriptRegistration[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Run a plugin app definition against the canonical validating collector.
|
|
30
|
+
* Both the BB app and the public test harness use this implementation so a
|
|
31
|
+
* registration accepted by one cannot be rejected or normalized differently
|
|
32
|
+
* by the other.
|
|
33
|
+
*/
|
|
34
|
+
declare function collectPluginAppRegistrations(definition: PluginAppDefinition, onComposerCustomizationRejected?: (reason: string) => void): CollectedPluginAppRegistrations;
|
|
35
|
+
|
|
36
|
+
export { collectPluginAppRegistrations };
|
|
37
|
+
export type { CollectedPluginAppRegistrations };
|