@get-bb/plugin-sdk 0.4.48 → 0.4.53
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 +14 -1
- package/bundled-types/bb-plugin-sdk-app.d.ts +203 -28
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +266 -0
- package/bundled-types/bb-plugin-sdk-host.d.ts +33 -2
- package/bundled-types/bb-plugin-sdk-internal-composer-customization-validation.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +230 -8
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +7 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +195 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +202 -167
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +5 -1
- package/bundled-types/bb-plugin-sdk-testing.d.ts +316 -4
- package/bundled-types/bb-plugin-sdk.d.ts +1843 -912
- package/dist/app.js +6 -0
- package/dist/environment-provider.js +0 -0
- package/dist/host.js +734 -30
- package/dist/internal/composer-customization-validation.js +9 -0
- package/dist/internal/host-policy.js +232 -64
- package/dist/internal/plugin-app-collector.js +26 -0
- package/dist/provider-bridge-acp.js +46 -2
- package/dist/provider-bridge-testing.js +62 -1
- package/dist/provider-bridge.js +23 -1
- package/dist/testing/app.js +86 -1
- package/dist/testing/index.js +268 -72
- package/package.json +7 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { ReactNode, ComponentType } from 'react';
|
|
9
9
|
import { RenderResult } from '@testing-library/react';
|
|
10
|
-
import { ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginTimelineRendererRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
|
|
10
|
+
import { ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, PluginProviderIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
|
|
11
11
|
|
|
12
12
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
13
13
|
interface ExperimentalSidebarFooterRuntimeSnapshot {
|
|
@@ -152,6 +152,7 @@ interface CapturedPluginApp {
|
|
|
152
152
|
messageActions: PluginMessageActionRegistration[];
|
|
153
153
|
providerIcons: PluginProviderIconRegistration[];
|
|
154
154
|
timelineRenderers: PluginTimelineRendererRegistration[];
|
|
155
|
+
environmentProviderInputs: PluginEnvironmentProviderInputsRegistration[];
|
|
155
156
|
contentScripts: PluginContentScriptRegistration[];
|
|
156
157
|
}
|
|
157
158
|
type PluginAppModule = {
|
|
@@ -239,6 +240,9 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
239
240
|
* mode with no resolved document, the state a plugin sees on first paint.
|
|
240
241
|
*/
|
|
241
242
|
codeTheme?: Partial<PluginCodeThemeState>;
|
|
243
|
+
branchesState?: Partial<BranchesState>;
|
|
244
|
+
/** Checkout facts `experimental_useCheckoutState()` reports. */
|
|
245
|
+
checkoutState?: Partial<CheckoutState>;
|
|
242
246
|
/**
|
|
243
247
|
* Pull requests `experimental_useSidebarThreadPullRequest()` reports, keyed
|
|
244
248
|
* by thread id. Omitted → every thread reports none.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginAgentToolPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem,
|
|
9
|
+
import { StandardSchemaV1 as StandardSchemaV1$1, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, StandardSchemaV1InferOutput, PluginEnvironmentValidateDecision, JsonValue as JsonValue$2, BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginAgentToolPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginProviderEnvHealth, PluginSettingDescriptors, ExperimentalPluginWebSocketHandler, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, PluginInteractionRequest, MessageDispatchHookContext } from '@get-bb/plugin-sdk';
|
|
10
10
|
|
|
11
11
|
/** Input-form entry: a path, or a path with options. */
|
|
12
12
|
declare const providerNativeRootInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -60,9 +60,264 @@ interface ProviderNativeRootsInputLike {
|
|
|
60
60
|
readonly project?: readonly ProviderNativeRootInput[];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
interface JsonObject {
|
|
64
|
+
[key: string]: JsonValue$1;
|
|
65
|
+
}
|
|
66
|
+
type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | JsonObject;
|
|
67
|
+
|
|
68
|
+
declare const environmentSchema: z.ZodObject<{
|
|
69
|
+
baseBranch: z.ZodNullable<z.ZodString>;
|
|
70
|
+
branchName: z.ZodNullable<z.ZodString>;
|
|
71
|
+
createdAt: z.ZodNumber;
|
|
72
|
+
defaultBranch: z.ZodNullable<z.ZodString>;
|
|
73
|
+
environmentProviderId: z.ZodNullable<z.ZodString>;
|
|
74
|
+
environmentProviderInstanceKey: z.ZodNullable<z.ZodString>;
|
|
75
|
+
environmentProviderSelection: z.ZodNullable<z.ZodObject<{
|
|
76
|
+
inputs: z.ZodNullable<z.ZodType<JsonValue$1, unknown, z.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
|
|
77
|
+
machine: z.ZodObject<{
|
|
78
|
+
hostId: z.ZodString;
|
|
79
|
+
type: z.ZodLiteral<"existing">;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
hostId: z.ZodString;
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
isGitRepo: z.ZodBoolean;
|
|
85
|
+
isWorktree: z.ZodBoolean;
|
|
86
|
+
lifecycle: z.ZodObject<{
|
|
87
|
+
phase: z.ZodEnum<{
|
|
88
|
+
active: "active";
|
|
89
|
+
destroyed: "destroyed";
|
|
90
|
+
retiring: "retiring";
|
|
91
|
+
teardown: "teardown";
|
|
92
|
+
}>;
|
|
93
|
+
retireAt: z.ZodNullable<z.ZodNumber>;
|
|
94
|
+
teardown: z.ZodNullable<z.ZodObject<{
|
|
95
|
+
attempt: z.ZodNumber;
|
|
96
|
+
message: z.ZodOptional<z.ZodString>;
|
|
97
|
+
status: z.ZodEnum<{
|
|
98
|
+
failed: "failed";
|
|
99
|
+
removed: "removed";
|
|
100
|
+
running: "running";
|
|
101
|
+
}>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
managed: z.ZodBoolean;
|
|
105
|
+
mergeBaseBranch: z.ZodNullable<z.ZodString>;
|
|
106
|
+
name: z.ZodNullable<z.ZodString>;
|
|
107
|
+
path: z.ZodNullable<z.ZodString>;
|
|
108
|
+
projectId: z.ZodString;
|
|
109
|
+
status: z.ZodEnum<{
|
|
110
|
+
destroyed: "destroyed";
|
|
111
|
+
error: "error";
|
|
112
|
+
provisioning: "provisioning";
|
|
113
|
+
ready: "ready";
|
|
114
|
+
}>;
|
|
115
|
+
updatedAt: z.ZodNumber;
|
|
116
|
+
workspaceProvisionType: z.ZodNullable<z.ZodEnum<{
|
|
117
|
+
"managed-worktree": "managed-worktree";
|
|
118
|
+
personal: "personal";
|
|
119
|
+
unmanaged: "unmanaged";
|
|
120
|
+
}>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
type Environment = z.infer<typeof environmentSchema>;
|
|
123
|
+
|
|
124
|
+
declare const hostSchema: z.ZodObject<{
|
|
125
|
+
createdAt: z.ZodNumber;
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
lastRejectedProtocolVersion: z.ZodNullable<z.ZodNumber>;
|
|
128
|
+
lastSeenAt: z.ZodNullable<z.ZodNumber>;
|
|
129
|
+
maxPermissionMode: z.ZodEnum<{
|
|
130
|
+
"accept-edits": "accept-edits";
|
|
131
|
+
auto: "auto";
|
|
132
|
+
full: "full";
|
|
133
|
+
}>;
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
status: z.ZodEnum<{
|
|
136
|
+
connected: "connected";
|
|
137
|
+
disconnected: "disconnected";
|
|
138
|
+
}>;
|
|
139
|
+
type: z.ZodEnum<{
|
|
140
|
+
persistent: "persistent";
|
|
141
|
+
}>;
|
|
142
|
+
updatedAt: z.ZodNumber;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
type Host = z.infer<typeof hostSchema>;
|
|
145
|
+
|
|
146
|
+
declare const projectSchema: z.ZodObject<{
|
|
147
|
+
createdAt: z.ZodNumber;
|
|
148
|
+
gitRemoteUrl: z.ZodNullable<z.ZodString>;
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
kind: z.ZodEnum<{
|
|
151
|
+
personal: "personal";
|
|
152
|
+
standard: "standard";
|
|
153
|
+
}>;
|
|
154
|
+
name: z.ZodString;
|
|
155
|
+
updatedAt: z.ZodNumber;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
type Project = z.infer<typeof projectSchema>;
|
|
158
|
+
|
|
63
159
|
declare const PROVIDER_FORK_VALUES: readonly ["none", "tip", "checkpoint"];
|
|
64
160
|
type ProviderFork = (typeof PROVIDER_FORK_VALUES)[number];
|
|
65
161
|
|
|
162
|
+
declare const threadResponseSchema: z.ZodObject<{
|
|
163
|
+
activeBackgroundAgentCount: z.ZodNumber;
|
|
164
|
+
archivedAt: z.ZodNullable<z.ZodNumber>;
|
|
165
|
+
canSpawnChild: z.ZodBoolean;
|
|
166
|
+
createdAt: z.ZodNumber;
|
|
167
|
+
deletedAt: z.ZodNullable<z.ZodNumber>;
|
|
168
|
+
environmentId: z.ZodNullable<z.ZodString>;
|
|
169
|
+
id: z.ZodString;
|
|
170
|
+
lastReadAt: z.ZodNullable<z.ZodNumber>;
|
|
171
|
+
latestAttentionAt: z.ZodNumber;
|
|
172
|
+
originKind: z.ZodNullable<z.ZodEnum<{
|
|
173
|
+
fork: "fork";
|
|
174
|
+
}>>;
|
|
175
|
+
originPluginId: z.ZodNullable<z.ZodString>;
|
|
176
|
+
parentThreadId: z.ZodNullable<z.ZodString>;
|
|
177
|
+
pinnedAt: z.ZodNullable<z.ZodNumber>;
|
|
178
|
+
projectId: z.ZodString;
|
|
179
|
+
providerId: z.ZodString;
|
|
180
|
+
queuedMessageCount: z.ZodNumber;
|
|
181
|
+
runtime: z.ZodObject<{
|
|
182
|
+
displayStatus: z.ZodEnum<{
|
|
183
|
+
"host-reconnecting": "host-reconnecting";
|
|
184
|
+
"waiting-for-host": "waiting-for-host";
|
|
185
|
+
active: "active";
|
|
186
|
+
error: "error";
|
|
187
|
+
idle: "idle";
|
|
188
|
+
pending: "pending";
|
|
189
|
+
provisioning: "provisioning";
|
|
190
|
+
starting: "starting";
|
|
191
|
+
stopping: "stopping";
|
|
192
|
+
}>;
|
|
193
|
+
hostReconnectGraceExpiresAt: z.ZodNullable<z.ZodNumber>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
sectionId: z.ZodNullable<z.ZodString>;
|
|
196
|
+
sourceThreadId: z.ZodNullable<z.ZodString>;
|
|
197
|
+
status: z.ZodEnum<{
|
|
198
|
+
active: "active";
|
|
199
|
+
error: "error";
|
|
200
|
+
idle: "idle";
|
|
201
|
+
pending: "pending";
|
|
202
|
+
starting: "starting";
|
|
203
|
+
stopping: "stopping";
|
|
204
|
+
}>;
|
|
205
|
+
title: z.ZodNullable<z.ZodString>;
|
|
206
|
+
titleFallback: z.ZodNullable<z.ZodString>;
|
|
207
|
+
updatedAt: z.ZodNumber;
|
|
208
|
+
visibility: z.ZodEnum<{
|
|
209
|
+
hidden: "hidden";
|
|
210
|
+
visible: "visible";
|
|
211
|
+
}>;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
type ThreadResponse$1 = z.infer<typeof threadResponseSchema>;
|
|
214
|
+
|
|
215
|
+
type PluginEnvironmentProviderInputsSchema = StandardSchemaV1$1 | undefined;
|
|
216
|
+
type Fact<R, K extends PropertyKey, T> = R extends Record<K, true> ? T : T | null;
|
|
217
|
+
type Checkout<R> = R extends {
|
|
218
|
+
projectCheckout: true;
|
|
219
|
+
} | {
|
|
220
|
+
gitCheckout: true;
|
|
221
|
+
} ? {
|
|
222
|
+
path: string;
|
|
223
|
+
} : {
|
|
224
|
+
path: string;
|
|
225
|
+
} | null;
|
|
226
|
+
type InputsValue<S> = S extends StandardSchemaV1$1 ? StandardSchemaV1InferOutput<S> : null;
|
|
227
|
+
/** Attempt-scoped updates; core persists each update before this call returns. */
|
|
228
|
+
interface PluginEnvironmentProviderProgress {
|
|
229
|
+
step(text: string): void;
|
|
230
|
+
log(text: string): void;
|
|
231
|
+
}
|
|
232
|
+
interface PluginEnvironmentProviderValidateContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> {
|
|
233
|
+
project: Project;
|
|
234
|
+
host: Host;
|
|
235
|
+
projectCheckout: Checkout<R>;
|
|
236
|
+
gitRemote: Fact<R, "gitRemote", string>;
|
|
237
|
+
inputs: InputsValue<S>;
|
|
238
|
+
}
|
|
239
|
+
interface PluginEnvironmentProviderAvailabilityContext {
|
|
240
|
+
project: Project;
|
|
241
|
+
host: Host;
|
|
242
|
+
projectCheckout: {
|
|
243
|
+
path: string;
|
|
244
|
+
} | null;
|
|
245
|
+
gitRemote: string | null;
|
|
246
|
+
}
|
|
247
|
+
type PluginEnvironmentProviderAvailability = {
|
|
248
|
+
status: "available";
|
|
249
|
+
} | {
|
|
250
|
+
status: "setup-required";
|
|
251
|
+
message: string;
|
|
252
|
+
} | {
|
|
253
|
+
status: "unavailable";
|
|
254
|
+
message: string;
|
|
255
|
+
};
|
|
256
|
+
interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
|
|
257
|
+
thread: ThreadResponse$1;
|
|
258
|
+
suggestedBranchName: string;
|
|
259
|
+
attempt: number;
|
|
260
|
+
pathKey: string;
|
|
261
|
+
rebuild: boolean;
|
|
262
|
+
experimental_claimPath(path: string): Promise<boolean>;
|
|
263
|
+
/** Resource is private to this provider; null after completed removal. */
|
|
264
|
+
previous: {
|
|
265
|
+
environment: Environment;
|
|
266
|
+
resource: JsonValue$2 | null;
|
|
267
|
+
} | null;
|
|
268
|
+
report: PluginEnvironmentProviderProgress;
|
|
269
|
+
signal: AbortSignal;
|
|
270
|
+
}
|
|
271
|
+
type PluginEnvironmentProviderCreateResult = {
|
|
272
|
+
status: "created";
|
|
273
|
+
path: string;
|
|
274
|
+
ownsPath: boolean;
|
|
275
|
+
mergeBaseBranch?: string;
|
|
276
|
+
resource?: JsonValue$2;
|
|
277
|
+
} | {
|
|
278
|
+
status: "failed";
|
|
279
|
+
failure: "terminal" | "transient";
|
|
280
|
+
message: string;
|
|
281
|
+
};
|
|
282
|
+
interface PluginEnvironmentProviderRemoveContext {
|
|
283
|
+
environment: Environment | null;
|
|
284
|
+
hostId: string | null;
|
|
285
|
+
path: string | null;
|
|
286
|
+
pathKey: string;
|
|
287
|
+
resource: JsonValue$2 | null;
|
|
288
|
+
attempt: number;
|
|
289
|
+
report: PluginEnvironmentProviderProgress;
|
|
290
|
+
signal: AbortSignal;
|
|
291
|
+
}
|
|
292
|
+
type PluginEnvironmentProviderRemoveResult = {
|
|
293
|
+
status: "removed";
|
|
294
|
+
} | {
|
|
295
|
+
status: "failed";
|
|
296
|
+
message: string;
|
|
297
|
+
};
|
|
298
|
+
/** Core normalizes omitted policy members once at registration. */
|
|
299
|
+
interface PluginEnvironmentProviderPolicy {
|
|
300
|
+
/** Default five minutes; null keeps the environment indefinitely. */
|
|
301
|
+
retireGraceMs: number | null;
|
|
302
|
+
/** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
|
|
303
|
+
pathKeys: "per-attempt" | "per-thread";
|
|
304
|
+
}
|
|
305
|
+
/** Resource operations only. Core owns durable launches, retries and retirement. */
|
|
306
|
+
interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> {
|
|
307
|
+
id: string;
|
|
308
|
+
displayName: string;
|
|
309
|
+
/** Host glyph, plugin-relative icon path, or this plugin’s declared namespaced icon. */
|
|
310
|
+
icon?: string;
|
|
311
|
+
requires?: R;
|
|
312
|
+
inputs?: S;
|
|
313
|
+
policy?: Partial<PluginEnvironmentProviderPolicy>;
|
|
314
|
+
/** Experimental create-time preflight: see docs/api_to_audit.md. */
|
|
315
|
+
availability?(context: PluginEnvironmentProviderAvailabilityContext): PluginEnvironmentProviderAvailability | Promise<PluginEnvironmentProviderAvailability>;
|
|
316
|
+
validate?(context: PluginEnvironmentProviderValidateContext<R, S>): PluginEnvironmentValidateDecision | Promise<PluginEnvironmentValidateDecision>;
|
|
317
|
+
create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
|
|
318
|
+
remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
|
|
319
|
+
}
|
|
320
|
+
|
|
66
321
|
/**
|
|
67
322
|
* A value that survives a JSON round trip without coercion or data loss.
|
|
68
323
|
*
|
|
@@ -103,6 +358,37 @@ interface StandardSchemaV1Issue {
|
|
|
103
358
|
}
|
|
104
359
|
|
|
105
360
|
type PluginSettingValue = string | number | boolean;
|
|
361
|
+
/**
|
|
362
|
+
* The facts this provider consumes, in one declaration. Every member is
|
|
363
|
+
* something core can evaluate before the thread exists and supply to
|
|
364
|
+
* `create`, so it is also the whole of what decides where the provider is
|
|
365
|
+
* offered, and the picker needs to know no provider by name. Every member
|
|
366
|
+
* defaults to false.
|
|
367
|
+
*
|
|
368
|
+
* - `projectCheckout` — the provider works from this project's directory on
|
|
369
|
+
* that machine, git or not, so core refuses a machine with no checkout of
|
|
370
|
+
* the project at create time and `context.projectCheckout` is non-null.
|
|
371
|
+
* - `gitCheckout` — that directory must also be a git repository with at
|
|
372
|
+
* least one commit. Core inspects the selected machine and rejects an
|
|
373
|
+
* invalid selection before creating the thread. Implies `projectCheckout`.
|
|
374
|
+
* - `gitRemote` — the provider clones the project itself, so an explicit
|
|
375
|
+
* selection is rejected when the project has no git remote.
|
|
376
|
+
* - `projectless` — this provider serves only threads that have no project,
|
|
377
|
+
* so it is offered for those and nowhere else. It cannot be combined with
|
|
378
|
+
* `projectCheckout`, `gitCheckout` or `gitRemote`, which need a project.
|
|
379
|
+
*/
|
|
380
|
+
interface PluginEnvironmentProviderRequirements {
|
|
381
|
+
projectCheckout?: boolean;
|
|
382
|
+
gitCheckout?: boolean;
|
|
383
|
+
gitRemote?: boolean;
|
|
384
|
+
projectless?: boolean;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Resource operations for one place a thread can run. Core persists progress,
|
|
388
|
+
* retries, cancellation and retirement. Operations must be idempotent for the
|
|
389
|
+
* supplied pathKey. Provider ids are unique across running plugins.
|
|
390
|
+
*/
|
|
391
|
+
type PluginEnvironmentProviderDeclaration<Requires extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, Inputs extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> = PluginEnvironmentProviderDefinition<Requires, Inputs>;
|
|
106
392
|
/**
|
|
107
393
|
* Permission modes a provider can run a session in — BB's own permission
|
|
108
394
|
* vocabulary, ordered least ("accept-edits") to most ("full") privileged.
|
|
@@ -471,6 +757,23 @@ type NormalizedPluginProviderDeclaration = Omit<PluginProviderDeclaration, "expe
|
|
|
471
757
|
readonly scope: PluginProviderModelCatalogScope;
|
|
472
758
|
};
|
|
473
759
|
};
|
|
760
|
+
declare const ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES: readonly ["projectCheckout", "gitCheckout", "gitRemote", "projectless"];
|
|
761
|
+
type NormalizedPluginEnvironmentProviderRequirements = {
|
|
762
|
+
[K in (typeof ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES)[number]]: boolean;
|
|
763
|
+
};
|
|
764
|
+
interface NormalizedPluginEnvironmentProvider {
|
|
765
|
+
id: string;
|
|
766
|
+
displayName: string;
|
|
767
|
+
icon: string | null;
|
|
768
|
+
requires: NormalizedPluginEnvironmentProviderRequirements;
|
|
769
|
+
inputs: StandardSchemaV1 | null;
|
|
770
|
+
inputsJsonSchema: JsonValue | null;
|
|
771
|
+
availability: NonNullable<PluginEnvironmentProviderDeclaration["availability"]> | null;
|
|
772
|
+
validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
|
|
773
|
+
create: PluginEnvironmentProviderDeclaration["create"];
|
|
774
|
+
remove: PluginEnvironmentProviderDeclaration["remove"];
|
|
775
|
+
policy: PluginEnvironmentProviderPolicy;
|
|
776
|
+
}
|
|
474
777
|
|
|
475
778
|
type BbSdk = BbPluginApi["sdk"];
|
|
476
779
|
/**
|
|
@@ -652,6 +955,7 @@ interface FakePluginRegistrations {
|
|
|
652
955
|
hooks: {
|
|
653
956
|
[K in PluginHookName]: PluginHookHandler<K> | null;
|
|
654
957
|
};
|
|
958
|
+
environmentProviders: ReadonlyMap<string, NormalizedPluginEnvironmentProvider>;
|
|
655
959
|
mentionProviders: FakeMentionProviderRecord[];
|
|
656
960
|
/** Live provider registrations from `bb.providers.register`
|
|
657
961
|
* (normalized declarations, registration order; dispose removes). */
|
|
@@ -696,7 +1000,7 @@ interface FakePluginBehaviorDrivers {
|
|
|
696
1000
|
experimental_emitHostWorkerExit(hostId: string): Promise<void>;
|
|
697
1001
|
/** Deliver a host signal through its registered payload schema. */
|
|
698
1002
|
experimental_emitHostSignal(hostId: string, signal: string, payload: unknown): Promise<void>;
|
|
699
|
-
submitInteraction(id: string, value: JsonValue$
|
|
1003
|
+
submitInteraction(id: string, value: JsonValue$2): void;
|
|
700
1004
|
cancelInteraction(id: string): void;
|
|
701
1005
|
/**
|
|
702
1006
|
* Apply a settings update the way the host's settings save does:
|
|
@@ -847,6 +1151,7 @@ interface FakePluginHost {
|
|
|
847
1151
|
}
|
|
848
1152
|
declare function createFakePluginHost(options?: CreateFakePluginHostOptions): FakePluginHost;
|
|
849
1153
|
|
|
1154
|
+
type HostResponse = Awaited<ReturnType<BbPluginApi["sdk"]["hosts"]["list"]>>[number];
|
|
850
1155
|
type ThreadResponse = PluginThreadEventPayloads["thread.created"]["thread"];
|
|
851
1156
|
type QueueEntry = PluginThreadEventPayloads["message.queued"]["entry"];
|
|
852
1157
|
type TurnFailedEvent = PluginThreadEventPayloads["turn.failed"];
|
|
@@ -870,6 +1175,13 @@ type MessageDispatchHookContextOverrides = Omit<Partial<MessageDispatchHookConte
|
|
|
870
1175
|
executionSources?: Partial<MessageDispatchHookContext["executionSources"]>;
|
|
871
1176
|
queuedMessage?: Partial<NonNullable<MessageDispatchHookContext["queuedMessage"]>> | null;
|
|
872
1177
|
};
|
|
1178
|
+
/**
|
|
1179
|
+
* A complete, deterministic host response for faking `bb.sdk.hosts.list()`
|
|
1180
|
+
* and environment-provider contexts. Override only the fields the test cares
|
|
1181
|
+
* about. If the contract grows a required field, this builder fails
|
|
1182
|
+
* typecheck — update the default here.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function makeHostResponse(overrides?: Partial<HostResponse>): HostResponse;
|
|
873
1185
|
/**
|
|
874
1186
|
* A complete, deterministic `ThreadResponse` for thread lifecycle event
|
|
875
1187
|
* payloads (`harness.emitThreadEvent`). Defaults are the minimal idle
|
|
@@ -937,5 +1249,5 @@ interface PublicSdkOnlyScan {
|
|
|
937
1249
|
*/
|
|
938
1250
|
declare function scanPublicSdkOnly(packageRoot: string, options?: PublicSdkOnlyScanOptions): PublicSdkOnlyScan;
|
|
939
1251
|
|
|
940
|
-
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeMessageDispatchHookContext, makePluginAgentConfigurationContext, makeQueueEntry, makeThreadResponse, makeTurnFailedEvent };
|
|
941
|
-
export type { CreateFakePluginHostOptions, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|
|
1252
|
+
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeHostResponse, makeMessageDispatchHookContext, makePluginAgentConfigurationContext, makeQueueEntry, makeThreadResponse, makeTurnFailedEvent };
|
|
1253
|
+
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 };
|