@get-bb/plugin-sdk 0.6.169 → 0.6.179
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 +3 -1
- package/bundled-types/bb-plugin-sdk-app.d.ts +165 -22
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +75 -84
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +308 -185
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +19 -5
- package/bundled-types/bb-plugin-sdk-testing.d.ts +226 -93
- package/bundled-types/bb-plugin-sdk.d.ts +281 -58
- package/dist/app.js +12 -0
- package/dist/index.js +20 -0
- package/dist/internal/host-policy.js +46 -5
- package/dist/internal/rpc-query-host.js +12 -0
- package/dist/provider-bridge-acp-next.js +28 -10
- package/dist/provider-bridge-acp.js +28 -10
- package/dist/provider-bridge-testing.js +9 -0
- package/dist/provider-bridge.js +9 -0
- package/dist/testing/app.js +54 -2
- package/dist/testing/index.js +101 -10
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ declare const environmentSchema: z.ZodObject<{
|
|
|
31
31
|
type: z.ZodLiteral<"new">;
|
|
32
32
|
}, z.core.$strip>], "type">;
|
|
33
33
|
}, z.core.$strip>>;
|
|
34
|
+
heldBy: z.ZodNullable<z.ZodLiteral<"user">>;
|
|
34
35
|
hostId: z.ZodString;
|
|
35
36
|
hostLifecycle: z.ZodEnum<{
|
|
36
37
|
"cleanup-failed": "cleanup-failed";
|
|
@@ -72,6 +73,7 @@ declare const environmentSchema: z.ZodObject<{
|
|
|
72
73
|
provisioning: "provisioning";
|
|
73
74
|
ready: "ready";
|
|
74
75
|
}>;
|
|
76
|
+
statusMessage: z.ZodNullable<z.ZodString>;
|
|
75
77
|
updatedAt: z.ZodNumber;
|
|
76
78
|
workspaceProvisionType: z.ZodNullable<z.ZodEnum<{
|
|
77
79
|
"managed-worktree": "managed-worktree";
|
|
@@ -142,78 +144,18 @@ declare const projectSchema: z.ZodObject<{
|
|
|
142
144
|
}, z.core.$strip>;
|
|
143
145
|
type Project = z.infer<typeof projectSchema>;
|
|
144
146
|
|
|
145
|
-
declare const threadResponseSchema: z.ZodObject<{
|
|
146
|
-
activeBackgroundAgentCount: z.ZodNumber;
|
|
147
|
-
archivedAt: z.ZodNullable<z.ZodNumber>;
|
|
148
|
-
canEditMessages: z.ZodBoolean;
|
|
149
|
-
canRestoreEnvironment: z.ZodBoolean;
|
|
150
|
-
canSpawnChild: z.ZodBoolean;
|
|
151
|
-
createdAt: z.ZodNumber;
|
|
152
|
-
deletedAt: z.ZodNullable<z.ZodNumber>;
|
|
153
|
-
environmentId: z.ZodNullable<z.ZodString>;
|
|
154
|
-
id: z.ZodString;
|
|
155
|
-
lastReadAt: z.ZodNullable<z.ZodNumber>;
|
|
156
|
-
latestAttentionAt: z.ZodNumber;
|
|
157
|
-
lifecycleOwnerThreadId: z.ZodNullable<z.ZodString>;
|
|
158
|
-
originKind: z.ZodNullable<z.ZodEnum<{
|
|
159
|
-
fork: "fork";
|
|
160
|
-
}>>;
|
|
161
|
-
originPluginId: z.ZodNullable<z.ZodString>;
|
|
162
|
-
parentNotifications: z.ZodEnum<{
|
|
163
|
-
auto: "auto";
|
|
164
|
-
off: "off";
|
|
165
|
-
stuck: "stuck";
|
|
166
|
-
}>;
|
|
167
|
-
parentThreadId: z.ZodNullable<z.ZodString>;
|
|
168
|
-
pinnedAt: z.ZodNullable<z.ZodNumber>;
|
|
169
|
-
projectId: z.ZodString;
|
|
170
|
-
providerId: z.ZodString;
|
|
171
|
-
queuedMessageCount: z.ZodNumber;
|
|
172
|
-
runtime: z.ZodObject<{
|
|
173
|
-
displayStatus: z.ZodEnum<{
|
|
174
|
-
"waiting-for-host": "waiting-for-host";
|
|
175
|
-
active: "active";
|
|
176
|
-
error: "error";
|
|
177
|
-
idle: "idle";
|
|
178
|
-
pending: "pending";
|
|
179
|
-
provisioning: "provisioning";
|
|
180
|
-
starting: "starting";
|
|
181
|
-
stopping: "stopping";
|
|
182
|
-
}>;
|
|
183
|
-
}, z.core.$strip>;
|
|
184
|
-
sectionId: z.ZodNullable<z.ZodString>;
|
|
185
|
-
sourceThreadId: z.ZodNullable<z.ZodString>;
|
|
186
|
-
status: z.ZodEnum<{
|
|
187
|
-
active: "active";
|
|
188
|
-
error: "error";
|
|
189
|
-
idle: "idle";
|
|
190
|
-
pending: "pending";
|
|
191
|
-
starting: "starting";
|
|
192
|
-
stopping: "stopping";
|
|
193
|
-
}>;
|
|
194
|
-
title: z.ZodNullable<z.ZodString>;
|
|
195
|
-
titleFallback: z.ZodNullable<z.ZodString>;
|
|
196
|
-
updatedAt: z.ZodNumber;
|
|
197
|
-
visibility: z.ZodEnum<{
|
|
198
|
-
hidden: "hidden";
|
|
199
|
-
visible: "visible";
|
|
200
|
-
}>;
|
|
201
|
-
}, z.core.$strip>;
|
|
202
|
-
type ThreadResponse = z.infer<typeof threadResponseSchema>;
|
|
203
|
-
|
|
204
147
|
type PluginEnvironmentProviderInputsSchema = StandardSchemaV1 | undefined;
|
|
205
148
|
type Fact<R, K extends PropertyKey, T> = R extends Record<K, true> ? T : T | null;
|
|
149
|
+
/** `ownsPath`: bb cloned this checkout, so a provider may own work there. */
|
|
150
|
+
interface ProjectCheckout {
|
|
151
|
+
path: string;
|
|
152
|
+
ownsPath: boolean;
|
|
153
|
+
}
|
|
206
154
|
type Checkout<R> = R extends {
|
|
207
155
|
projectCheckout: true;
|
|
208
156
|
} | {
|
|
209
157
|
gitCheckout: true;
|
|
210
|
-
} ?
|
|
211
|
-
path: string;
|
|
212
|
-
experimental_ownsPath: boolean;
|
|
213
|
-
} : {
|
|
214
|
-
path: string;
|
|
215
|
-
experimental_ownsPath: boolean;
|
|
216
|
-
} | null;
|
|
158
|
+
} ? ProjectCheckout : ProjectCheckout | null;
|
|
217
159
|
type InputsValue<S> = S extends StandardSchemaV1 ? StandardSchemaV1InferOutput<S> : null;
|
|
218
160
|
/** Attempt-scoped updates; core persists each update before this call returns. */
|
|
219
161
|
interface PluginEnvironmentProviderProgress {
|
|
@@ -227,6 +169,15 @@ interface PluginEnvironmentProviderValidateContext<R extends PluginEnvironmentPr
|
|
|
227
169
|
gitRemote: Fact<R, "gitRemote", string>;
|
|
228
170
|
inputs: InputsValue<S>;
|
|
229
171
|
}
|
|
172
|
+
interface PluginEnvironmentProviderLocation {
|
|
173
|
+
path: string;
|
|
174
|
+
reuse: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface PluginEnvironmentProviderLocateContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> {
|
|
177
|
+
host: Host;
|
|
178
|
+
projectCheckout: Checkout<R>;
|
|
179
|
+
inputs: InputsValue<S>;
|
|
180
|
+
}
|
|
230
181
|
interface PluginEnvironmentProviderAvailabilityContext {
|
|
231
182
|
project: Project;
|
|
232
183
|
host: Host;
|
|
@@ -244,28 +195,46 @@ type PluginEnvironmentProviderAvailability = {
|
|
|
244
195
|
status: "unavailable";
|
|
245
196
|
message: string;
|
|
246
197
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
198
|
+
/** The environment a create or restore produces a workspace for. */
|
|
199
|
+
interface PluginEnvironmentProviderEnvironment {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string | null;
|
|
202
|
+
projectId: string;
|
|
203
|
+
}
|
|
204
|
+
/** Core's create steps, which a provider calls in the order it needs. */
|
|
205
|
+
interface PluginEnvironmentProviderSteps {
|
|
206
|
+
/**
|
|
207
|
+
* The name for a branch this operation makes. A thread's environment
|
|
208
|
+
* resolves to `<prefix><slug(title)>-<threadId>` once the thread's title
|
|
209
|
+
* settles (generated, provided, or the fallback); a thread-less one resolves
|
|
210
|
+
* at once to `<prefix><slug(name)>-<id>`, or `<prefix><id>` without a name.
|
|
211
|
+
* Core generates the title while create runs, so await it as late as
|
|
212
|
+
* possible. Repeated calls return the same name.
|
|
213
|
+
*/
|
|
214
|
+
branchName(): Promise<string>;
|
|
215
|
+
/**
|
|
216
|
+
* Claims `path` as this environment's provider-owned workspace and asks core
|
|
217
|
+
* to run setup there; resolves once the request is recorded, while setup
|
|
218
|
+
* runs alongside the rest of create. The environment becomes ready only
|
|
219
|
+
* after create returns `created` with the same path and `ownsPath: true`.
|
|
220
|
+
* Without a call, core runs setup after create returns.
|
|
221
|
+
*/
|
|
222
|
+
setup(path: string): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S>, PluginEnvironmentProviderSteps {
|
|
225
|
+
environment: PluginEnvironmentProviderEnvironment;
|
|
250
226
|
attempt: number;
|
|
251
227
|
pathKey: string;
|
|
252
|
-
experimental_claimPath(path: string): Promise<boolean>;
|
|
253
228
|
report: PluginEnvironmentProviderProgress;
|
|
254
229
|
signal: AbortSignal;
|
|
255
230
|
}
|
|
256
231
|
/** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
|
|
257
|
-
interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends
|
|
258
|
-
thread: ThreadResponse;
|
|
259
|
-
attempt: number;
|
|
260
|
-
pathKey: string;
|
|
261
|
-
experimental_claimPath(path: string): Promise<boolean>;
|
|
232
|
+
interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderCreateContext<R, S> {
|
|
262
233
|
/** Resource is private to this provider; null after completed removal. */
|
|
263
234
|
previous: {
|
|
264
235
|
environment: Environment;
|
|
265
236
|
resource: JsonValue$1 | null;
|
|
266
237
|
};
|
|
267
|
-
report: PluginEnvironmentProviderProgress;
|
|
268
|
-
signal: AbortSignal;
|
|
269
238
|
}
|
|
270
239
|
type PluginEnvironmentProviderCreateResult = {
|
|
271
240
|
status: "created";
|
|
@@ -298,11 +267,25 @@ type PluginEnvironmentProviderRemoveResult = {
|
|
|
298
267
|
interface PluginEnvironmentProviderPolicy {
|
|
299
268
|
/** Default five minutes; null keeps the environment indefinitely. */
|
|
300
269
|
retireGraceMs: number | null;
|
|
301
|
-
/**
|
|
302
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Default per-environment: one key for the environment's workspace, stable
|
|
272
|
+
* across retries. Core derives it from the driving thread when there is one
|
|
273
|
+
* and from the environment otherwise, so thread workspaces keep their
|
|
274
|
+
* names. Replacement environments use a fresh key to avoid dead paths.
|
|
275
|
+
*/
|
|
276
|
+
pathKeys: "per-attempt" | "per-environment";
|
|
303
277
|
}
|
|
304
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Resource operations only. Core owns durable launches, retries and
|
|
280
|
+
* retirement. Contexts carry the `environment` being created rather than a
|
|
281
|
+
* thread, so core can also create environments before any thread exists.
|
|
282
|
+
*/
|
|
305
283
|
interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> {
|
|
284
|
+
/**
|
|
285
|
+
* The context shape `create` and `restore` receive. Required: bb still runs
|
|
286
|
+
* providers built before it with the earlier, thread-based contexts.
|
|
287
|
+
*/
|
|
288
|
+
apiVersion: 2;
|
|
306
289
|
id: string;
|
|
307
290
|
displayName: string;
|
|
308
291
|
/** Short explanation shown in environment choices. */
|
|
@@ -315,12 +298,20 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
|
|
|
315
298
|
/** Experimental per-machine availability, probed in the background for pickers and again at thread creation: see docs/api_to_audit.md. */
|
|
316
299
|
availability?(context: PluginEnvironmentProviderAvailabilityContext): PluginEnvironmentProviderAvailability | Promise<PluginEnvironmentProviderAvailability>;
|
|
317
300
|
validate?(context: PluginEnvironmentProviderValidateContext<R, S>): PluginEnvironmentValidateDecision | Promise<PluginEnvironmentValidateDecision>;
|
|
318
|
-
/**
|
|
319
|
-
|
|
301
|
+
/**
|
|
302
|
+
* Where an environment for these inputs lives, if the provider knows before
|
|
303
|
+
* creating anything; null asks for a new environment. Core claims the path
|
|
304
|
+
* for the operation. With `reuse: true`, a thread joins the environment
|
|
305
|
+
* recorded at `path` as it is. Otherwise create runs on a fresh
|
|
306
|
+
* reservation, which core refuses while another live thread uses an
|
|
307
|
+
* environment at `path`, and core folds the result into that environment
|
|
308
|
+
* when create returns the same path.
|
|
309
|
+
*/
|
|
310
|
+
locate?(context: PluginEnvironmentProviderLocateContext<R, S>): PluginEnvironmentProviderLocation | null | Promise<PluginEnvironmentProviderLocation | null>;
|
|
320
311
|
create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
|
|
321
|
-
/** Experimental: rebuild a destroyed environment when
|
|
312
|
+
/** Experimental: rebuild a destroyed environment when a thread asks for it back. Without it, core never rebuilds this provider's destroyed environments: see docs/api_to_audit.md. */
|
|
322
313
|
restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
|
|
323
314
|
remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
|
|
324
315
|
}
|
|
325
316
|
|
|
326
|
-
export type { PluginEnvironmentProviderAvailability, PluginEnvironmentProviderAvailabilityContext, PluginEnvironmentProviderCreateContext, PluginEnvironmentProviderCreateResult, PluginEnvironmentProviderDefinition, PluginEnvironmentProviderInputsSchema, PluginEnvironmentProviderPolicy, PluginEnvironmentProviderProgress, PluginEnvironmentProviderRemoveContext, PluginEnvironmentProviderRemoveResult, PluginEnvironmentProviderRestoreContext, PluginEnvironmentProviderValidateContext };
|
|
317
|
+
export type { PluginEnvironmentProviderAvailability, PluginEnvironmentProviderAvailabilityContext, PluginEnvironmentProviderCreateContext, PluginEnvironmentProviderCreateResult, PluginEnvironmentProviderDefinition, PluginEnvironmentProviderEnvironment, PluginEnvironmentProviderInputsSchema, PluginEnvironmentProviderLocateContext, PluginEnvironmentProviderLocation, PluginEnvironmentProviderPolicy, PluginEnvironmentProviderProgress, PluginEnvironmentProviderRemoveContext, PluginEnvironmentProviderRemoveResult, PluginEnvironmentProviderRestoreContext, PluginEnvironmentProviderSteps, PluginEnvironmentProviderValidateContext };
|