@get-bb/plugin-sdk 0.5.27 → 0.5.30

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.
@@ -480,9 +480,92 @@ type ExecutionInputFieldSource = CallerExecutionInputSource;
480
480
  declare const threadResponseSchema: z.ZodObject<{
481
481
  activeBackgroundAgentCount: z.ZodNumber;
482
482
  archivedAt: z.ZodNullable<z.ZodNumber>;
483
+ canRestoreEnvironment: z.ZodBoolean;
483
484
  canSpawnChild: z.ZodBoolean;
484
485
  createdAt: z.ZodNumber;
485
486
  deletedAt: z.ZodNullable<z.ZodNumber>;
487
+ draft: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
488
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
489
+ end: z.ZodNumber;
490
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
491
+ kind: z.ZodLiteral<"thread">;
492
+ label: z.ZodString;
493
+ projectId: z.ZodOptional<z.ZodString>;
494
+ threadId: z.ZodString;
495
+ }, z.core.$strip>, z.ZodObject<{
496
+ kind: z.ZodLiteral<"project">;
497
+ label: z.ZodString;
498
+ projectId: z.ZodString;
499
+ }, z.core.$strip>, z.ZodObject<{
500
+ kind: z.ZodLiteral<"section">;
501
+ label: z.ZodString;
502
+ sectionId: z.ZodString;
503
+ }, z.core.$strip>, z.ZodObject<{
504
+ entryKind: z.ZodEnum<{
505
+ directory: "directory";
506
+ file: "file";
507
+ }>;
508
+ kind: z.ZodLiteral<"path">;
509
+ label: z.ZodString;
510
+ path: z.ZodString;
511
+ source: z.ZodEnum<{
512
+ "thread-storage": "thread-storage";
513
+ workspace: "workspace";
514
+ }>;
515
+ }, z.core.$strip>, z.ZodObject<{
516
+ argumentHint: z.ZodNullable<z.ZodString>;
517
+ kind: z.ZodLiteral<"command">;
518
+ label: z.ZodString;
519
+ name: z.ZodString;
520
+ origin: z.ZodEnum<{
521
+ builtin: "builtin";
522
+ project: "project";
523
+ user: "user";
524
+ }>;
525
+ source: z.ZodEnum<{
526
+ command: "command";
527
+ skill: "skill";
528
+ }>;
529
+ trigger: z.ZodEnum<{
530
+ "/": "/";
531
+ $: "$";
532
+ }>;
533
+ }, z.core.$strip>, z.ZodObject<{
534
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
535
+ itemId: z.ZodString;
536
+ kind: z.ZodLiteral<"plugin">;
537
+ label: z.ZodString;
538
+ pluginId: z.ZodString;
539
+ }, z.core.$strip>], "kind">>;
540
+ start: z.ZodNumber;
541
+ }, z.core.$strip>>>;
542
+ text: z.ZodString;
543
+ type: z.ZodLiteral<"text">;
544
+ visibility: z.ZodOptional<z.ZodEnum<{
545
+ "agent-only": "agent-only";
546
+ }>>;
547
+ }, z.core.$strip>, z.ZodObject<{
548
+ type: z.ZodLiteral<"image">;
549
+ url: z.ZodString;
550
+ visibility: z.ZodOptional<z.ZodEnum<{
551
+ "agent-only": "agent-only";
552
+ }>>;
553
+ }, z.core.$strip>, z.ZodObject<{
554
+ path: z.ZodString;
555
+ type: z.ZodLiteral<"localImage">;
556
+ visibility: z.ZodOptional<z.ZodEnum<{
557
+ "agent-only": "agent-only";
558
+ }>>;
559
+ }, z.core.$strip>, z.ZodObject<{
560
+ mimeType: z.ZodOptional<z.ZodString>;
561
+ name: z.ZodOptional<z.ZodString>;
562
+ path: z.ZodString;
563
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
564
+ type: z.ZodLiteral<"localFile">;
565
+ visibility: z.ZodOptional<z.ZodEnum<{
566
+ "agent-only": "agent-only";
567
+ }>>;
568
+ }, z.core.$strip>], "type">>>;
486
569
  environmentId: z.ZodNullable<z.ZodString>;
487
570
  id: z.ZodString;
488
571
  lastReadAt: z.ZodNullable<z.ZodNumber>;
@@ -579,13 +662,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
579
662
  suggestedBranchName: string;
580
663
  attempt: number;
581
664
  pathKey: string;
582
- rebuild: boolean;
665
+ experimental_claimPath(path: string): Promise<boolean>;
666
+ report: PluginEnvironmentProviderProgress;
667
+ signal: AbortSignal;
668
+ }
669
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
670
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
671
+ thread: ThreadResponse;
672
+ attempt: number;
673
+ pathKey: string;
583
674
  experimental_claimPath(path: string): Promise<boolean>;
584
675
  /** Resource is private to this provider; null after completed removal. */
585
676
  previous: {
586
677
  environment: Environment;
587
678
  resource: JsonValue$2 | null;
588
- } | null;
679
+ };
589
680
  report: PluginEnvironmentProviderProgress;
590
681
  signal: AbortSignal;
591
682
  }
@@ -619,7 +710,7 @@ type PluginEnvironmentProviderRemoveResult = {
619
710
  interface PluginEnvironmentProviderPolicy {
620
711
  /** Default five minutes; null keeps the environment indefinitely. */
621
712
  retireGraceMs: number | null;
622
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
713
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
623
714
  pathKeys: "per-attempt" | "per-thread";
624
715
  }
625
716
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -639,6 +730,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
639
730
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
640
731
  experimental_existingPath?(inputs: InputsValue$1<S>): string | null;
641
732
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
733
+ /** Experimental: rebuild a destroyed environment when its thread asks for it back. Without it, core never rebuilds this provider's destroyed environments: see docs/api_to_audit.md. */
734
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
642
735
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
643
736
  }
644
737
 
@@ -1953,6 +2046,7 @@ interface NormalizedPluginEnvironmentProvider {
1953
2046
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
1954
2047
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
1955
2048
  create: PluginEnvironmentProviderDeclaration["create"];
2049
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
1956
2050
  remove: PluginEnvironmentProviderDeclaration["remove"];
1957
2051
  policy: PluginEnvironmentProviderPolicy;
1958
2052
  }
@@ -3594,11 +3594,45 @@ declare const threadEventSchema: z.ZodPipe<z.ZodUnknown, z.ZodUnion<readonly [z.
3594
3594
  }>>;
3595
3595
  systemMessageSubject: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
3596
3596
  kind: z.ZodLiteral<"thread">;
3597
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3598
+ interruption: z.ZodOptional<z.ZodObject<{
3599
+ cause: z.ZodOptional<z.ZodLiteral<"host-connection-lost">>;
3600
+ reason: z.ZodEnum<{
3601
+ "host-daemon-restarted": "host-daemon-restarted";
3602
+ "host-removed": "host-removed";
3603
+ "manual-stop": "manual-stop";
3604
+ "provider-turn-idle": "provider-turn-idle";
3605
+ }>;
3606
+ }, z.core.$strip>>;
3607
+ status: z.ZodEnum<{
3608
+ completed: "completed";
3609
+ failed: "failed";
3610
+ interrupted: "interrupted";
3611
+ }>;
3612
+ threadId: z.ZodString;
3613
+ }, z.core.$strip>>>;
3597
3614
  threadId: z.ZodString;
3598
3615
  threadName: z.ZodString;
3599
3616
  }, z.core.$strip>, z.ZodObject<{
3600
3617
  count: z.ZodNumber;
3601
3618
  kind: z.ZodLiteral<"thread-batch">;
3619
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3620
+ interruption: z.ZodOptional<z.ZodObject<{
3621
+ cause: z.ZodOptional<z.ZodLiteral<"host-connection-lost">>;
3622
+ reason: z.ZodEnum<{
3623
+ "host-daemon-restarted": "host-daemon-restarted";
3624
+ "host-removed": "host-removed";
3625
+ "manual-stop": "manual-stop";
3626
+ "provider-turn-idle": "provider-turn-idle";
3627
+ }>;
3628
+ }, z.core.$strip>>;
3629
+ status: z.ZodEnum<{
3630
+ completed: "completed";
3631
+ failed: "failed";
3632
+ interrupted: "interrupted";
3633
+ }>;
3634
+ threadId: z.ZodString;
3635
+ }, z.core.$strip>>>;
3602
3636
  }, z.core.$strip>, z.ZodObject<{
3603
3637
  kind: z.ZodLiteral<"tool-call">;
3604
3638
  suppress: z.ZodBoolean;
@@ -273,9 +273,92 @@ type ProviderFork = (typeof PROVIDER_FORK_VALUES)[number];
273
273
  declare const threadResponseSchema: z.ZodObject<{
274
274
  activeBackgroundAgentCount: z.ZodNumber;
275
275
  archivedAt: z.ZodNullable<z.ZodNumber>;
276
+ canRestoreEnvironment: z.ZodBoolean;
276
277
  canSpawnChild: z.ZodBoolean;
277
278
  createdAt: z.ZodNumber;
278
279
  deletedAt: z.ZodNullable<z.ZodNumber>;
280
+ draft: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
281
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
282
+ end: z.ZodNumber;
283
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
284
+ kind: z.ZodLiteral<"thread">;
285
+ label: z.ZodString;
286
+ projectId: z.ZodOptional<z.ZodString>;
287
+ threadId: z.ZodString;
288
+ }, z.core.$strip>, z.ZodObject<{
289
+ kind: z.ZodLiteral<"project">;
290
+ label: z.ZodString;
291
+ projectId: z.ZodString;
292
+ }, z.core.$strip>, z.ZodObject<{
293
+ kind: z.ZodLiteral<"section">;
294
+ label: z.ZodString;
295
+ sectionId: z.ZodString;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ entryKind: z.ZodEnum<{
298
+ directory: "directory";
299
+ file: "file";
300
+ }>;
301
+ kind: z.ZodLiteral<"path">;
302
+ label: z.ZodString;
303
+ path: z.ZodString;
304
+ source: z.ZodEnum<{
305
+ "thread-storage": "thread-storage";
306
+ workspace: "workspace";
307
+ }>;
308
+ }, z.core.$strip>, z.ZodObject<{
309
+ argumentHint: z.ZodNullable<z.ZodString>;
310
+ kind: z.ZodLiteral<"command">;
311
+ label: z.ZodString;
312
+ name: z.ZodString;
313
+ origin: z.ZodEnum<{
314
+ builtin: "builtin";
315
+ project: "project";
316
+ user: "user";
317
+ }>;
318
+ source: z.ZodEnum<{
319
+ command: "command";
320
+ skill: "skill";
321
+ }>;
322
+ trigger: z.ZodEnum<{
323
+ "/": "/";
324
+ $: "$";
325
+ }>;
326
+ }, z.core.$strip>, z.ZodObject<{
327
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ itemId: z.ZodString;
329
+ kind: z.ZodLiteral<"plugin">;
330
+ label: z.ZodString;
331
+ pluginId: z.ZodString;
332
+ }, z.core.$strip>], "kind">>;
333
+ start: z.ZodNumber;
334
+ }, z.core.$strip>>>;
335
+ text: z.ZodString;
336
+ type: z.ZodLiteral<"text">;
337
+ visibility: z.ZodOptional<z.ZodEnum<{
338
+ "agent-only": "agent-only";
339
+ }>>;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ type: z.ZodLiteral<"image">;
342
+ url: z.ZodString;
343
+ visibility: z.ZodOptional<z.ZodEnum<{
344
+ "agent-only": "agent-only";
345
+ }>>;
346
+ }, z.core.$strip>, z.ZodObject<{
347
+ path: z.ZodString;
348
+ type: z.ZodLiteral<"localImage">;
349
+ visibility: z.ZodOptional<z.ZodEnum<{
350
+ "agent-only": "agent-only";
351
+ }>>;
352
+ }, z.core.$strip>, z.ZodObject<{
353
+ mimeType: z.ZodOptional<z.ZodString>;
354
+ name: z.ZodOptional<z.ZodString>;
355
+ path: z.ZodString;
356
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
357
+ type: z.ZodLiteral<"localFile">;
358
+ visibility: z.ZodOptional<z.ZodEnum<{
359
+ "agent-only": "agent-only";
360
+ }>>;
361
+ }, z.core.$strip>], "type">>>;
279
362
  environmentId: z.ZodNullable<z.ZodString>;
280
363
  id: z.ZodString;
281
364
  lastReadAt: z.ZodNullable<z.ZodNumber>;
@@ -372,13 +455,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
372
455
  suggestedBranchName: string;
373
456
  attempt: number;
374
457
  pathKey: string;
375
- rebuild: boolean;
458
+ experimental_claimPath(path: string): Promise<boolean>;
459
+ report: PluginEnvironmentProviderProgress;
460
+ signal: AbortSignal;
461
+ }
462
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
463
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
464
+ thread: ThreadResponse$1;
465
+ attempt: number;
466
+ pathKey: string;
376
467
  experimental_claimPath(path: string): Promise<boolean>;
377
468
  /** Resource is private to this provider; null after completed removal. */
378
469
  previous: {
379
470
  environment: Environment;
380
471
  resource: JsonValue$2 | null;
381
- } | null;
472
+ };
382
473
  report: PluginEnvironmentProviderProgress;
383
474
  signal: AbortSignal;
384
475
  }
@@ -412,7 +503,7 @@ type PluginEnvironmentProviderRemoveResult = {
412
503
  interface PluginEnvironmentProviderPolicy {
413
504
  /** Default five minutes; null keeps the environment indefinitely. */
414
505
  retireGraceMs: number | null;
415
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
506
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
416
507
  pathKeys: "per-attempt" | "per-thread";
417
508
  }
418
509
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -432,6 +523,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
432
523
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
433
524
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
434
525
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
526
+ /** Experimental: rebuild a destroyed environment when its thread asks for it back. Without it, core never rebuilds this provider's destroyed environments: see docs/api_to_audit.md. */
527
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
435
528
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
436
529
  }
437
530
 
@@ -990,6 +1083,7 @@ interface NormalizedPluginEnvironmentProvider {
990
1083
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
991
1084
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
992
1085
  create: PluginEnvironmentProviderDeclaration["create"];
1086
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
993
1087
  remove: PluginEnvironmentProviderDeclaration["remove"];
994
1088
  policy: PluginEnvironmentProviderPolicy;
995
1089
  }