@get-bb/plugin-sdk 0.5.27 → 0.5.29

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.
@@ -528,6 +528,7 @@ type Environment = z$1.infer<typeof environmentSchema>;
528
528
 
529
529
  declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
530
530
  changelogPreview: "changelogPreview";
531
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
531
532
  mobileApp: "mobileApp";
532
533
  serverMove: "serverMove";
533
534
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -7813,6 +7814,22 @@ declare const hostDaemonCommandRegistry: {
7813
7814
  sha256: z$1.ZodString;
7814
7815
  sizeBytes: z$1.ZodNumber;
7815
7816
  }, z$1.core.$strip>]>, "onlineRpc", true>;
7817
+ "host.read_file_chunk": HostDaemonCommandDescriptor<"host.read_file_chunk", z$1.ZodObject<{
7818
+ length: z$1.ZodNumber;
7819
+ offset: z$1.ZodNumber;
7820
+ path: z$1.ZodString;
7821
+ revision: z$1.ZodNullable<z$1.ZodString>;
7822
+ rootPath: z$1.ZodString;
7823
+ type: z$1.ZodLiteral<"host.read_file_chunk">;
7824
+ }, z$1.core.$strict>, z$1.ZodObject<{
7825
+ content: z$1.ZodString;
7826
+ mimeType: z$1.ZodNullable<z$1.ZodString>;
7827
+ modifiedAtMs: z$1.ZodNumber;
7828
+ offset: z$1.ZodNumber;
7829
+ path: z$1.ZodString;
7830
+ revision: z$1.ZodString;
7831
+ sizeBytes: z$1.ZodNumber;
7832
+ }, z$1.core.$strict>, "onlineRpc", true>;
7816
7833
  "host.read_file_relative": HostDaemonCommandDescriptor<"host.read_file_relative", z$1.ZodObject<{
7817
7834
  dotfiles: z$1.ZodEnum<{
7818
7835
  allow: "allow";
@@ -10114,6 +10131,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10114
10131
  }, z$1.core.$strict>>;
10115
10132
  experiments: z$1.ZodRecord<z$1.ZodEnum<{
10116
10133
  changelogPreview: "changelogPreview";
10134
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
10117
10135
  mobileApp: "mobileApp";
10118
10136
  serverMove: "serverMove";
10119
10137
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -13469,6 +13487,7 @@ type ThreadSearchResponse = z$1.infer<typeof threadSearchResponseSchema>;
13469
13487
  declare const threadResponseSchema: z$1.ZodObject<{
13470
13488
  activeBackgroundAgentCount: z$1.ZodNumber;
13471
13489
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13490
+ canRestoreEnvironment: z$1.ZodBoolean;
13472
13491
  canSpawnChild: z$1.ZodBoolean;
13473
13492
  createdAt: z$1.ZodNumber;
13474
13493
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13527,6 +13546,7 @@ type ThreadPluginMetadataResponse = z$1.infer<typeof pluginMetadataSchema>;
13527
13546
  declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13528
13547
  activeBackgroundAgentCount: z$1.ZodNumber;
13529
13548
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13549
+ canRestoreEnvironment: z$1.ZodBoolean;
13530
13550
  canSpawnChild: z$1.ZodBoolean;
13531
13551
  createdAt: z$1.ZodNumber;
13532
13552
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -16419,6 +16439,7 @@ type ThreadUnarchiveResult = {
16419
16439
  };
16420
16440
  type ThreadArchiveAllResult = ThreadArchiveAllResponse;
16421
16441
  type ThreadReadStateResult = ThreadResponse;
16442
+ type ThreadRestoreEnvironmentResult = ThreadResponse;
16422
16443
  type ThreadPinOrderResult = ThreadListResponse;
16423
16444
  type ThreadPromptHistoryResult = PromptHistoryResponse;
16424
16445
  type ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;
@@ -16711,6 +16732,14 @@ interface ThreadsArea {
16711
16732
  * `sendAt` in the future queues it on the clock and a `message.dispatch` hook
16712
16733
  * can still hold it; the response says which of the two happened.
16713
16734
  */
16735
+ /**
16736
+ * Ask the environment provider to restore the destroyed workspace of a
16737
+ * thread and attach it; the provider decides what restoring means, such as
16738
+ * checking the recorded branch out again. Sends fail until this runs. Starts
16739
+ * no turn: the thread settles back to `idle` once the workspace is ready.
16740
+ * Refused unless the thread's `canRestoreEnvironment` is true.
16741
+ */
16742
+ restoreEnvironment(args: ThreadActionArgs): Promise<ThreadRestoreEnvironmentResult>;
16714
16743
  retry(args: ThreadRetryArgs): Promise<ThreadRetryResult>;
16715
16744
  search(args: ThreadSearchArgs): Promise<ThreadSearchResult>;
16716
16745
  send(args: ThreadSendArgs): Promise<ThreadSendResult>;
@@ -17866,6 +17895,10 @@ interface PluginSidebarThreadsState {
17866
17895
  } | null;
17867
17896
  status: "error" | "loading" | "ready";
17868
17897
  threads: readonly PluginSidebarThread[];
17898
+ experimental_hosts?: readonly {
17899
+ id: string;
17900
+ name: string;
17901
+ }[];
17869
17902
  projects: readonly PluginSidebarProject[];
17870
17903
  /** Every section, in the server's order (creation order). */
17871
17904
  sections: readonly PluginSidebarSection[];
@@ -18031,11 +18064,15 @@ interface PluginSidebarThreadActions {
18031
18064
  * `sectionId` files the new thread under that section, and
18032
18065
  * `environmentId` reuses that environment (the "New thread in
18033
18066
  * environment" affordance), both exactly as bb's own list does.
18067
+ * `hostId` selects a machine for a new environment when it
18068
+ * is known and supports an environment provider. `environmentId` wins when
18069
+ * both are supplied.
18034
18070
  */
18035
18071
  openNewThread(options?: {
18036
18072
  projectId?: string;
18037
18073
  sectionId?: string;
18038
18074
  environmentId?: string;
18075
+ hostId?: string;
18039
18076
  focusPrompt?: boolean;
18040
18077
  }): void;
18041
18078
  setPinned(threadId: string, pinned: boolean): Promise<void>;
@@ -142,6 +142,7 @@ type Project = z.infer<typeof projectSchema>;
142
142
  declare const threadResponseSchema: z.ZodObject<{
143
143
  activeBackgroundAgentCount: z.ZodNumber;
144
144
  archivedAt: z.ZodNullable<z.ZodNumber>;
145
+ canRestoreEnvironment: z.ZodBoolean;
145
146
  canSpawnChild: z.ZodBoolean;
146
147
  createdAt: z.ZodNumber;
147
148
  deletedAt: z.ZodNullable<z.ZodNumber>;
@@ -241,13 +242,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
241
242
  suggestedBranchName: string;
242
243
  attempt: number;
243
244
  pathKey: string;
244
- rebuild: boolean;
245
+ experimental_claimPath(path: string): Promise<boolean>;
246
+ report: PluginEnvironmentProviderProgress;
247
+ signal: AbortSignal;
248
+ }
249
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
250
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
251
+ thread: ThreadResponse;
252
+ attempt: number;
253
+ pathKey: string;
245
254
  experimental_claimPath(path: string): Promise<boolean>;
246
255
  /** Resource is private to this provider; null after completed removal. */
247
256
  previous: {
248
257
  environment: Environment;
249
258
  resource: JsonValue$1 | null;
250
- } | null;
259
+ };
251
260
  report: PluginEnvironmentProviderProgress;
252
261
  signal: AbortSignal;
253
262
  }
@@ -281,7 +290,7 @@ type PluginEnvironmentProviderRemoveResult = {
281
290
  interface PluginEnvironmentProviderPolicy {
282
291
  /** Default five minutes; null keeps the environment indefinitely. */
283
292
  retireGraceMs: number | null;
284
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
293
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
285
294
  pathKeys: "per-attempt" | "per-thread";
286
295
  }
287
296
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -301,7 +310,9 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
301
310
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
302
311
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
303
312
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
313
+ /** 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. */
314
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
304
315
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
305
316
  }
306
317
 
307
- export type { PluginEnvironmentProviderAvailability, PluginEnvironmentProviderAvailabilityContext, PluginEnvironmentProviderCreateContext, PluginEnvironmentProviderCreateResult, PluginEnvironmentProviderDefinition, PluginEnvironmentProviderInputsSchema, PluginEnvironmentProviderPolicy, PluginEnvironmentProviderProgress, PluginEnvironmentProviderRemoveContext, PluginEnvironmentProviderRemoveResult, PluginEnvironmentProviderValidateContext };
318
+ export type { PluginEnvironmentProviderAvailability, PluginEnvironmentProviderAvailabilityContext, PluginEnvironmentProviderCreateContext, PluginEnvironmentProviderCreateResult, PluginEnvironmentProviderDefinition, PluginEnvironmentProviderInputsSchema, PluginEnvironmentProviderPolicy, PluginEnvironmentProviderProgress, PluginEnvironmentProviderRemoveContext, PluginEnvironmentProviderRemoveResult, PluginEnvironmentProviderRestoreContext, PluginEnvironmentProviderValidateContext };
@@ -480,6 +480,7 @@ 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>;
@@ -579,13 +580,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
579
580
  suggestedBranchName: string;
580
581
  attempt: number;
581
582
  pathKey: string;
582
- rebuild: boolean;
583
+ experimental_claimPath(path: string): Promise<boolean>;
584
+ report: PluginEnvironmentProviderProgress;
585
+ signal: AbortSignal;
586
+ }
587
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
588
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
589
+ thread: ThreadResponse;
590
+ attempt: number;
591
+ pathKey: string;
583
592
  experimental_claimPath(path: string): Promise<boolean>;
584
593
  /** Resource is private to this provider; null after completed removal. */
585
594
  previous: {
586
595
  environment: Environment;
587
596
  resource: JsonValue$2 | null;
588
- } | null;
597
+ };
589
598
  report: PluginEnvironmentProviderProgress;
590
599
  signal: AbortSignal;
591
600
  }
@@ -619,7 +628,7 @@ type PluginEnvironmentProviderRemoveResult = {
619
628
  interface PluginEnvironmentProviderPolicy {
620
629
  /** Default five minutes; null keeps the environment indefinitely. */
621
630
  retireGraceMs: number | null;
622
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
631
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
623
632
  pathKeys: "per-attempt" | "per-thread";
624
633
  }
625
634
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -639,6 +648,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
639
648
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
640
649
  experimental_existingPath?(inputs: InputsValue$1<S>): string | null;
641
650
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
651
+ /** 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. */
652
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
642
653
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
643
654
  }
644
655
 
@@ -1953,6 +1964,7 @@ interface NormalizedPluginEnvironmentProvider {
1953
1964
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
1954
1965
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
1955
1966
  create: PluginEnvironmentProviderDeclaration["create"];
1967
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
1956
1968
  remove: PluginEnvironmentProviderDeclaration["remove"];
1957
1969
  policy: PluginEnvironmentProviderPolicy;
1958
1970
  }
@@ -273,6 +273,7 @@ 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>;
@@ -372,13 +373,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
372
373
  suggestedBranchName: string;
373
374
  attempt: number;
374
375
  pathKey: string;
375
- rebuild: boolean;
376
+ experimental_claimPath(path: string): Promise<boolean>;
377
+ report: PluginEnvironmentProviderProgress;
378
+ signal: AbortSignal;
379
+ }
380
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
381
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
382
+ thread: ThreadResponse$1;
383
+ attempt: number;
384
+ pathKey: string;
376
385
  experimental_claimPath(path: string): Promise<boolean>;
377
386
  /** Resource is private to this provider; null after completed removal. */
378
387
  previous: {
379
388
  environment: Environment;
380
389
  resource: JsonValue$2 | null;
381
- } | null;
390
+ };
382
391
  report: PluginEnvironmentProviderProgress;
383
392
  signal: AbortSignal;
384
393
  }
@@ -412,7 +421,7 @@ type PluginEnvironmentProviderRemoveResult = {
412
421
  interface PluginEnvironmentProviderPolicy {
413
422
  /** Default five minutes; null keeps the environment indefinitely. */
414
423
  retireGraceMs: number | null;
415
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
424
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
416
425
  pathKeys: "per-attempt" | "per-thread";
417
426
  }
418
427
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -432,6 +441,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
432
441
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
433
442
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
434
443
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
444
+ /** 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. */
445
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
435
446
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
436
447
  }
437
448
 
@@ -990,6 +1001,7 @@ interface NormalizedPluginEnvironmentProvider {
990
1001
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
991
1002
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
992
1003
  create: PluginEnvironmentProviderDeclaration["create"];
1004
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
993
1005
  remove: PluginEnvironmentProviderDeclaration["remove"];
994
1006
  policy: PluginEnvironmentProviderPolicy;
995
1007
  }
@@ -483,6 +483,7 @@ type Environment = z$1.infer<typeof environmentSchema>;
483
483
 
484
484
  declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
485
485
  changelogPreview: "changelogPreview";
486
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
486
487
  mobileApp: "mobileApp";
487
488
  serverMove: "serverMove";
488
489
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -7864,6 +7865,22 @@ declare const hostDaemonCommandRegistry: {
7864
7865
  sha256: z$1.ZodString;
7865
7866
  sizeBytes: z$1.ZodNumber;
7866
7867
  }, z$1.core.$strip>]>, "onlineRpc", true>;
7868
+ "host.read_file_chunk": HostDaemonCommandDescriptor<"host.read_file_chunk", z$1.ZodObject<{
7869
+ length: z$1.ZodNumber;
7870
+ offset: z$1.ZodNumber;
7871
+ path: z$1.ZodString;
7872
+ revision: z$1.ZodNullable<z$1.ZodString>;
7873
+ rootPath: z$1.ZodString;
7874
+ type: z$1.ZodLiteral<"host.read_file_chunk">;
7875
+ }, z$1.core.$strict>, z$1.ZodObject<{
7876
+ content: z$1.ZodString;
7877
+ mimeType: z$1.ZodNullable<z$1.ZodString>;
7878
+ modifiedAtMs: z$1.ZodNumber;
7879
+ offset: z$1.ZodNumber;
7880
+ path: z$1.ZodString;
7881
+ revision: z$1.ZodString;
7882
+ sizeBytes: z$1.ZodNumber;
7883
+ }, z$1.core.$strict>, "onlineRpc", true>;
7867
7884
  "host.read_file_relative": HostDaemonCommandDescriptor<"host.read_file_relative", z$1.ZodObject<{
7868
7885
  dotfiles: z$1.ZodEnum<{
7869
7886
  allow: "allow";
@@ -10165,6 +10182,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10165
10182
  }, z$1.core.$strict>>;
10166
10183
  experiments: z$1.ZodRecord<z$1.ZodEnum<{
10167
10184
  changelogPreview: "changelogPreview";
10185
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
10168
10186
  mobileApp: "mobileApp";
10169
10187
  serverMove: "serverMove";
10170
10188
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -13521,6 +13539,7 @@ type ThreadSearchResponse = z$1.infer<typeof threadSearchResponseSchema>;
13521
13539
  declare const threadResponseSchema: z$1.ZodObject<{
13522
13540
  activeBackgroundAgentCount: z$1.ZodNumber;
13523
13541
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13542
+ canRestoreEnvironment: z$1.ZodBoolean;
13524
13543
  canSpawnChild: z$1.ZodBoolean;
13525
13544
  createdAt: z$1.ZodNumber;
13526
13545
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13579,6 +13598,7 @@ type ThreadPluginMetadataResponse = z$1.infer<typeof pluginMetadataSchema>;
13579
13598
  declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13580
13599
  activeBackgroundAgentCount: z$1.ZodNumber;
13581
13600
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13601
+ canRestoreEnvironment: z$1.ZodBoolean;
13582
13602
  canSpawnChild: z$1.ZodBoolean;
13583
13603
  createdAt: z$1.ZodNumber;
13584
13604
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -16482,6 +16502,7 @@ type ThreadUnarchiveResult = {
16482
16502
  };
16483
16503
  type ThreadArchiveAllResult = ThreadArchiveAllResponse;
16484
16504
  type ThreadReadStateResult = ThreadResponse;
16505
+ type ThreadRestoreEnvironmentResult = ThreadResponse;
16485
16506
  type ThreadPinOrderResult = ThreadListResponse;
16486
16507
  type ThreadPromptHistoryResult = PromptHistoryResponse;
16487
16508
  type ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;
@@ -16774,6 +16795,14 @@ interface ThreadsArea {
16774
16795
  * `sendAt` in the future queues it on the clock and a `message.dispatch` hook
16775
16796
  * can still hold it; the response says which of the two happened.
16776
16797
  */
16798
+ /**
16799
+ * Ask the environment provider to restore the destroyed workspace of a
16800
+ * thread and attach it; the provider decides what restoring means, such as
16801
+ * checking the recorded branch out again. Sends fail until this runs. Starts
16802
+ * no turn: the thread settles back to `idle` once the workspace is ready.
16803
+ * Refused unless the thread's `canRestoreEnvironment` is true.
16804
+ */
16805
+ restoreEnvironment(args: ThreadActionArgs): Promise<ThreadRestoreEnvironmentResult>;
16777
16806
  retry(args: ThreadRetryArgs): Promise<ThreadRetryResult>;
16778
16807
  search(args: ThreadSearchArgs): Promise<ThreadSearchResult>;
16779
16808
  send(args: ThreadSendArgs): Promise<ThreadSendResult>;
@@ -18018,6 +18047,10 @@ interface PluginSidebarThreadsState {
18018
18047
  } | null;
18019
18048
  status: "error" | "loading" | "ready";
18020
18049
  threads: readonly PluginSidebarThread[];
18050
+ experimental_hosts?: readonly {
18051
+ id: string;
18052
+ name: string;
18053
+ }[];
18021
18054
  projects: readonly PluginSidebarProject[];
18022
18055
  /** Every section, in the server's order (creation order). */
18023
18056
  sections: readonly PluginSidebarSection[];
@@ -18183,11 +18216,15 @@ interface PluginSidebarThreadActions {
18183
18216
  * `sectionId` files the new thread under that section, and
18184
18217
  * `environmentId` reuses that environment (the "New thread in
18185
18218
  * environment" affordance), both exactly as bb's own list does.
18219
+ * `hostId` selects a machine for a new environment when it
18220
+ * is known and supports an environment provider. `environmentId` wins when
18221
+ * both are supplied.
18186
18222
  */
18187
18223
  openNewThread(options?: {
18188
18224
  projectId?: string;
18189
18225
  sectionId?: string;
18190
18226
  environmentId?: string;
18227
+ hostId?: string;
18191
18228
  focusPrompt?: boolean;
18192
18229
  }): void;
18193
18230
  setPinned(threadId: string, pinned: boolean): Promise<void>;
@@ -20148,13 +20185,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
20148
20185
  suggestedBranchName: string;
20149
20186
  attempt: number;
20150
20187
  pathKey: string;
20151
- rebuild: boolean;
20188
+ experimental_claimPath(path: string): Promise<boolean>;
20189
+ report: PluginEnvironmentProviderProgress;
20190
+ signal: AbortSignal;
20191
+ }
20192
+ /** Rebuilds a thread's destroyed environment; `inputs` are the ones it was created with. */
20193
+ interface PluginEnvironmentProviderRestoreContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S> {
20194
+ thread: ThreadResponse;
20195
+ attempt: number;
20196
+ pathKey: string;
20152
20197
  experimental_claimPath(path: string): Promise<boolean>;
20153
20198
  /** Resource is private to this provider; null after completed removal. */
20154
20199
  previous: {
20155
20200
  environment: Environment;
20156
20201
  resource: JsonValue$2 | null;
20157
- } | null;
20202
+ };
20158
20203
  report: PluginEnvironmentProviderProgress;
20159
20204
  signal: AbortSignal;
20160
20205
  }
@@ -20188,7 +20233,7 @@ type PluginEnvironmentProviderRemoveResult = {
20188
20233
  interface PluginEnvironmentProviderPolicy {
20189
20234
  /** Default five minutes; null keeps the environment indefinitely. */
20190
20235
  retireGraceMs: number | null;
20191
- /** Default per-thread; rebuilds use a fresh key to avoid dead paths. */
20236
+ /** Default per-thread; replacement environments use a fresh key to avoid dead paths. */
20192
20237
  pathKeys: "per-attempt" | "per-thread";
20193
20238
  }
20194
20239
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -20208,6 +20253,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
20208
20253
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
20209
20254
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
20210
20255
  create(context: PluginEnvironmentProviderCreateContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
20256
+ /** 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. */
20257
+ restore?(context: PluginEnvironmentProviderRestoreContext<R, S>): Promise<PluginEnvironmentProviderCreateResult>;
20211
20258
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
20212
20259
  }
20213
20260
 
@@ -1943,6 +1943,12 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1943
1943
  declaration.experimental_existingPath,
1944
1944
  "experimental_existingPath"
1945
1945
  );
1946
+ assertOptionalFunction(
1947
+ "environment provider",
1948
+ id,
1949
+ declaration.restore,
1950
+ "a restore"
1951
+ );
1946
1952
  return {
1947
1953
  id,
1948
1954
  displayName,
@@ -1955,6 +1961,7 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1955
1961
  validate: declaration.validate ?? null,
1956
1962
  experimental_existingPath: declaration.experimental_existingPath ?? null,
1957
1963
  create: declaration.create,
1964
+ restore: declaration.restore ?? null,
1958
1965
  remove: declaration.remove,
1959
1966
  policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
1960
1967
  };
@@ -2073,6 +2073,7 @@ function renderSlot(registration, props, options = {}) {
2073
2073
  experimental_archived: options.sidebarThreads?.experimental_archived ?? null,
2074
2074
  status: options.sidebarThreads?.status ?? "ready",
2075
2075
  threads: options.sidebarThreads?.threads ?? [],
2076
+ experimental_hosts: options.sidebarThreads?.experimental_hosts ?? [],
2076
2077
  projects: options.sidebarThreads?.projects ?? [],
2077
2078
  sections: options.sidebarThreads?.sections ?? []
2078
2079
  };
@@ -1968,6 +1968,12 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1968
1968
  declaration.experimental_existingPath,
1969
1969
  "experimental_existingPath"
1970
1970
  );
1971
+ assertOptionalFunction(
1972
+ "environment provider",
1973
+ id,
1974
+ declaration.restore,
1975
+ "a restore"
1976
+ );
1971
1977
  return {
1972
1978
  id,
1973
1979
  displayName,
@@ -1980,6 +1986,7 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1980
1986
  validate: declaration.validate ?? null,
1981
1987
  experimental_existingPath: declaration.experimental_existingPath ?? null,
1982
1988
  create: declaration.create,
1989
+ restore: declaration.restore ?? null,
1983
1990
  remove: declaration.remove,
1984
1991
  policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
1985
1992
  };
@@ -4253,6 +4260,7 @@ function makeThreadResponse(overrides = {}) {
4253
4260
  updatedAt: 0,
4254
4261
  runtime: { displayStatus: "idle", hostReconnectGraceExpiresAt: null },
4255
4262
  activeBackgroundAgentCount: 0,
4263
+ canRestoreEnvironment: false,
4256
4264
  canSpawnChild: true,
4257
4265
  queuedMessageCount: 0,
4258
4266
  ...overrides
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.5.27",
3
+ "version": "0.5.29",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"