@get-bb/plugin-sdk 0.5.24 → 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.
@@ -248,6 +248,8 @@ declare const appKeybindingOverridesSchema: z$1.ZodArray<z$1.ZodObject<{
248
248
  "panel.previousTab": "panel.previousTab";
249
249
  "panel.reopenClosedTab": "panel.reopenClosedTab";
250
250
  "panel.toggle": "panel.toggle";
251
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
252
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
251
253
  "question.select.1": "question.select.1";
252
254
  "question.select.2": "question.select.2";
253
255
  "question.select.3": "question.select.3";
@@ -476,6 +478,12 @@ declare const environmentSchema: z$1.ZodObject<{
476
478
  }, z$1.core.$strip>], "type">;
477
479
  }, z$1.core.$strip>>;
478
480
  hostId: z$1.ZodString;
481
+ hostLifecycle: z$1.ZodEnum<{
482
+ "cleanup-failed": "cleanup-failed";
483
+ active: "active";
484
+ removed: "removed";
485
+ removing: "removing";
486
+ }>;
479
487
  id: z$1.ZodString;
480
488
  isGitRepo: z$1.ZodBoolean;
481
489
  isWorktree: z$1.ZodBoolean;
@@ -520,6 +528,7 @@ type Environment = z$1.infer<typeof environmentSchema>;
520
528
 
521
529
  declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
522
530
  changelogPreview: "changelogPreview";
531
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
523
532
  mobileApp: "mobileApp";
524
533
  serverMove: "serverMove";
525
534
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -547,6 +556,11 @@ declare const workspaceGitOperationSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObj
547
556
  }, z$1.core.$strip>], "kind">;
548
557
  type WorkspaceGitOperation = z$1.infer<typeof workspaceGitOperationSchema>;
549
558
 
559
+ declare const hostTypeSchema: z$1.ZodEnum<{
560
+ ephemeral: "ephemeral";
561
+ persistent: "persistent";
562
+ }>;
563
+ type HostType = z$1.infer<typeof hostTypeSchema>;
550
564
  declare const hostSchema: z$1.ZodObject<{
551
565
  createdAt: z$1.ZodNumber;
552
566
  id: z$1.ZodString;
@@ -3092,6 +3106,7 @@ declare const threadEventSchema: z$1.ZodPipe<z$1.ZodUnknown, z$1.ZodUnion<readon
3092
3106
  cause: z$1.ZodOptional<z$1.ZodLiteral<"host-connection-lost">>;
3093
3107
  reason: z$1.ZodEnum<{
3094
3108
  "host-daemon-restarted": "host-daemon-restarted";
3109
+ "host-removed": "host-removed";
3095
3110
  "manual-stop": "manual-stop";
3096
3111
  "provider-turn-idle": "provider-turn-idle";
3097
3112
  }>;
@@ -7799,6 +7814,22 @@ declare const hostDaemonCommandRegistry: {
7799
7814
  sha256: z$1.ZodString;
7800
7815
  sizeBytes: z$1.ZodNumber;
7801
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>;
7802
7833
  "host.read_file_relative": HostDaemonCommandDescriptor<"host.read_file_relative", z$1.ZodObject<{
7803
7834
  dotfiles: z$1.ZodEnum<{
7804
7835
  allow: "allow";
@@ -9462,6 +9493,15 @@ declare const pluginSettingsResponseSchema: z$1.ZodObject<{
9462
9493
  values: z$1.ZodRecord<z$1.ZodString, z$1.ZodType<JsonValue, unknown, z$1.core.$ZodTypeInternals<JsonValue, unknown>>>;
9463
9494
  }, z$1.core.$strip>;
9464
9495
  type PluginSettingsResponse = z$1.infer<typeof pluginSettingsResponseSchema>;
9496
+ declare const pluginSafeModeResponseSchema: z$1.ZodObject<{
9497
+ enabled: z$1.ZodBoolean;
9498
+ }, z$1.core.$strip>;
9499
+ type PluginSafeModeResponse = z$1.infer<typeof pluginSafeModeResponseSchema>;
9500
+ declare const pluginSafeModeUpdateResponseSchema: z$1.ZodObject<{
9501
+ enabled: z$1.ZodBoolean;
9502
+ problems: z$1.ZodArray<z$1.ZodString>;
9503
+ }, z$1.core.$strip>;
9504
+ type PluginSafeModeUpdateResponse = z$1.infer<typeof pluginSafeModeUpdateResponseSchema>;
9465
9505
  declare const pluginTokenResponseSchema: z$1.ZodObject<{
9466
9506
  ok: z$1.ZodLiteral<true>;
9467
9507
  token: z$1.ZodString;
@@ -10017,6 +10057,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10017
10057
  "panel.previousTab": "panel.previousTab";
10018
10058
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10019
10059
  "panel.toggle": "panel.toggle";
10060
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10061
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10020
10062
  "question.select.1": "question.select.1";
10021
10063
  "question.select.2": "question.select.2";
10022
10064
  "question.select.3": "question.select.3";
@@ -10089,6 +10131,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10089
10131
  }, z$1.core.$strict>>;
10090
10132
  experiments: z$1.ZodRecord<z$1.ZodEnum<{
10091
10133
  changelogPreview: "changelogPreview";
10134
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
10092
10135
  mobileApp: "mobileApp";
10093
10136
  serverMove: "serverMove";
10094
10137
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -10160,6 +10203,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10160
10203
  "panel.previousTab": "panel.previousTab";
10161
10204
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10162
10205
  "panel.toggle": "panel.toggle";
10206
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10207
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10163
10208
  "question.select.1": "question.select.1";
10164
10209
  "question.select.2": "question.select.2";
10165
10210
  "question.select.3": "question.select.3";
@@ -10245,6 +10290,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10245
10290
  "panel.previousTab": "panel.previousTab";
10246
10291
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10247
10292
  "panel.toggle": "panel.toggle";
10293
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10294
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10248
10295
  "question.select.1": "question.select.1";
10249
10296
  "question.select.2": "question.select.2";
10250
10297
  "question.select.3": "question.select.3";
@@ -13440,6 +13487,7 @@ type ThreadSearchResponse = z$1.infer<typeof threadSearchResponseSchema>;
13440
13487
  declare const threadResponseSchema: z$1.ZodObject<{
13441
13488
  activeBackgroundAgentCount: z$1.ZodNumber;
13442
13489
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13490
+ canRestoreEnvironment: z$1.ZodBoolean;
13443
13491
  canSpawnChild: z$1.ZodBoolean;
13444
13492
  createdAt: z$1.ZodNumber;
13445
13493
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13498,6 +13546,7 @@ type ThreadPluginMetadataResponse = z$1.infer<typeof pluginMetadataSchema>;
13498
13546
  declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13499
13547
  activeBackgroundAgentCount: z$1.ZodNumber;
13500
13548
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13549
+ canRestoreEnvironment: z$1.ZodBoolean;
13501
13550
  canSpawnChild: z$1.ZodBoolean;
13502
13551
  createdAt: z$1.ZodNumber;
13503
13552
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13520,6 +13569,12 @@ declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13520
13569
  }, z$1.core.$strip>], "type">;
13521
13570
  }, z$1.core.$strip>>;
13522
13571
  hostId: z$1.ZodString;
13572
+ hostLifecycle: z$1.ZodEnum<{
13573
+ "cleanup-failed": "cleanup-failed";
13574
+ active: "active";
13575
+ removed: "removed";
13576
+ removing: "removing";
13577
+ }>;
13523
13578
  id: z$1.ZodString;
13524
13579
  isGitRepo: z$1.ZodBoolean;
13525
13580
  isWorktree: z$1.ZodBoolean;
@@ -13560,6 +13615,7 @@ declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13560
13615
  unmanaged: "unmanaged";
13561
13616
  }>>;
13562
13617
  }, z$1.core.$strip>>>;
13618
+ environmentHostName: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
13563
13619
  environmentId: z$1.ZodNullable<z$1.ZodString>;
13564
13620
  host: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
13565
13621
  createdAt: z$1.ZodNumber;
@@ -14173,6 +14229,7 @@ declare const threadListQuerySchema: z$1.ZodObject<{
14173
14229
  false: "false";
14174
14230
  true: "true";
14175
14231
  }>>;
14232
+ hostId: z$1.ZodOptional<z$1.ZodString>;
14176
14233
  includeHidden: z$1.ZodOptional<z$1.ZodEnum<{
14177
14234
  false: "false";
14178
14235
  true: "true";
@@ -15481,6 +15538,7 @@ interface HostProviderCliInstallArgs extends HostProviderCliInstallRequest {
15481
15538
  }
15482
15539
  interface HostListArgs {
15483
15540
  includeCreating?: boolean;
15541
+ type?: HostType;
15484
15542
  signal?: AbortSignal;
15485
15543
  }
15486
15544
  interface MachineCreateArgs extends CreateMachineRequest {
@@ -15821,6 +15879,12 @@ interface PluginListArgs {
15821
15879
  interface PluginListUpdateResultsArgs {
15822
15880
  signal?: AbortSignal;
15823
15881
  }
15882
+ interface PluginGetSafeModeArgs {
15883
+ signal?: AbortSignal;
15884
+ }
15885
+ interface PluginSetSafeModeArgs {
15886
+ enabled: boolean;
15887
+ }
15824
15888
  type PluginDisableResult = InstalledPlugin;
15825
15889
  type PluginEnableResult = InstalledPlugin;
15826
15890
  type PluginGetSettingsResult = PluginSettingsResponse;
@@ -15828,6 +15892,8 @@ type PluginInstallResult = InstalledPlugin;
15828
15892
  type PluginListResult = PluginListResponse;
15829
15893
  type PluginReloadResult = PluginReloadResponse;
15830
15894
  type PluginRemoveResult = PluginRemoveResponse;
15895
+ type PluginSafeModeResult = PluginSafeModeResponse;
15896
+ type PluginSetSafeModeResult = PluginSafeModeUpdateResponse;
15831
15897
  type PluginTokenResult = PluginTokenResponse;
15832
15898
  type PluginUpdateSettingsResult = PluginSettingsResponse;
15833
15899
  type PluginGetSourceResult = PluginSourceDetail;
@@ -15856,6 +15922,8 @@ interface PluginMarketplacesArea {
15856
15922
  }
15857
15923
  interface PluginsArea {
15858
15924
  experimental_discoverRpc(args?: PluginRpcDiscoveryQuery): Promise<PublishedPluginRpcMethod[]>;
15925
+ experimental_getSafeMode(args?: PluginGetSafeModeArgs): Promise<PluginSafeModeResult>;
15926
+ experimental_setSafeMode(args: PluginSetSafeModeArgs): Promise<PluginSetSafeModeResult>;
15859
15927
  applyUpdate(args: PluginIdArgs): Promise<PluginApplyUpdateResult>;
15860
15928
  callRpc<TOutput>(args: PluginRpcArgs<TOutput>): Promise<TOutput>;
15861
15929
  checkUpdates(args?: PluginCheckUpdatesArgs): Promise<PluginCheckUpdatesResult>;
@@ -16259,6 +16327,7 @@ interface TerminalsArea {
16259
16327
  interface ThreadListArgs {
16260
16328
  archived?: boolean;
16261
16329
  environmentId?: string;
16330
+ hostId?: string;
16262
16331
  sectionId?: string;
16263
16332
  hasParent?: boolean;
16264
16333
  includeHidden?: boolean;
@@ -16370,6 +16439,7 @@ type ThreadUnarchiveResult = {
16370
16439
  };
16371
16440
  type ThreadArchiveAllResult = ThreadArchiveAllResponse;
16372
16441
  type ThreadReadStateResult = ThreadResponse;
16442
+ type ThreadRestoreEnvironmentResult = ThreadResponse;
16373
16443
  type ThreadPinOrderResult = ThreadListResponse;
16374
16444
  type ThreadPromptHistoryResult = PromptHistoryResponse;
16375
16445
  type ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;
@@ -16662,6 +16732,14 @@ interface ThreadsArea {
16662
16732
  * `sendAt` in the future queues it on the clock and a `message.dispatch` hook
16663
16733
  * can still hold it; the response says which of the two happened.
16664
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>;
16665
16743
  retry(args: ThreadRetryArgs): Promise<ThreadRetryResult>;
16666
16744
  search(args: ThreadSearchArgs): Promise<ThreadSearchResult>;
16667
16745
  send(args: ThreadSendArgs): Promise<ThreadSendResult>;
@@ -17817,6 +17895,10 @@ interface PluginSidebarThreadsState {
17817
17895
  } | null;
17818
17896
  status: "error" | "loading" | "ready";
17819
17897
  threads: readonly PluginSidebarThread[];
17898
+ experimental_hosts?: readonly {
17899
+ id: string;
17900
+ name: string;
17901
+ }[];
17820
17902
  projects: readonly PluginSidebarProject[];
17821
17903
  /** Every section, in the server's order (creation order). */
17822
17904
  sections: readonly PluginSidebarSection[];
@@ -17982,11 +18064,15 @@ interface PluginSidebarThreadActions {
17982
18064
  * `sectionId` files the new thread under that section, and
17983
18065
  * `environmentId` reuses that environment (the "New thread in
17984
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.
17985
18070
  */
17986
18071
  openNewThread(options?: {
17987
18072
  projectId?: string;
17988
18073
  sectionId?: string;
17989
18074
  environmentId?: string;
18075
+ hostId?: string;
17990
18076
  focusPrompt?: boolean;
17991
18077
  }): void;
17992
18078
  setPinned(threadId: string, pinned: boolean): Promise<void>;
@@ -18104,12 +18190,13 @@ interface PluginSidebarThreadSplit {
18104
18190
  * Replace the sidebar's thread list with a plugin component.
18105
18191
  *
18106
18192
  * Unlike every other slot, this one is EXCLUSIVE: two lists cannot share one
18107
- * scroll area. Registering activates the replacement while the plugin is
18108
- * enabled. If multiple plugins register one, the first in deterministic slot
18109
- * order is active by default; removing it reveals the next. The user can pin
18110
- * BB's list or a specific provider under Settings → Appearance. A plugin can
18111
- * also use its own setting and render `Original` conditionally.
18112
- * An absent or crashing replacement falls back to BB's list rather than
18193
+ * scroll area. bb ships its own list as the bundled Thread list plugin
18194
+ * (`thread-list/thread-list`). Registering activates the replacement while the
18195
+ * plugin is enabled: by default the first registered list other than the
18196
+ * bundled one, in deterministic slot order, is active, falling back to the
18197
+ * bundled list; removing it reveals the next. The user can pin a specific
18198
+ * provider, including the bundled one, under Settings → Appearance → Sidebar.
18199
+ * A missing pinned provider or a crashing list shows a placeholder rather than
18113
18200
  * leaving the user with no sidebar.
18114
18201
  *
18115
18202
  * The plugin gets the scrolling list and nothing else. The New-thread button,
@@ -18128,11 +18215,12 @@ interface PluginThreadListRegistration {
18128
18215
  }
18129
18216
  /**
18130
18217
  * Replace the navigation controls above the sidebar thread list. Exclusive:
18131
- * the user picks one provider under Settings → Appearance → Navigation, and
18132
18218
  * bb ships its own rows as the bundled Navigation plugin
18133
- * (`navigation/navigation`, the default). A picked provider that is disabled
18134
- * or removed falls back to Navigation; a crashing provider is replaced by a
18135
- * placeholder with a Reload button.
18219
+ * (`navigation/navigation`). By default the first registered provider other
18220
+ * than Navigation is active, falling back to Navigation; the user can pin one
18221
+ * provider under Settings → Appearance → Navigation. A pinned provider that is
18222
+ * disabled or removed falls back to Navigation; a crashing provider is
18223
+ * replaced by a placeholder with a Reload button.
18136
18224
  */
18137
18225
  interface ExperimentalSidebarNavigationRegistration {
18138
18226
  /** Unique within the plugin; letters, digits, `-`, `_`. */
@@ -32,6 +32,12 @@ declare const environmentSchema: z.ZodObject<{
32
32
  }, z.core.$strip>], "type">;
33
33
  }, z.core.$strip>>;
34
34
  hostId: z.ZodString;
35
+ hostLifecycle: z.ZodEnum<{
36
+ "cleanup-failed": "cleanup-failed";
37
+ active: "active";
38
+ removed: "removed";
39
+ removing: "removing";
40
+ }>;
35
41
  id: z.ZodString;
36
42
  isGitRepo: z.ZodBoolean;
37
43
  isWorktree: z.ZodBoolean;
@@ -136,6 +142,7 @@ type Project = z.infer<typeof projectSchema>;
136
142
  declare const threadResponseSchema: z.ZodObject<{
137
143
  activeBackgroundAgentCount: z.ZodNumber;
138
144
  archivedAt: z.ZodNullable<z.ZodNumber>;
145
+ canRestoreEnvironment: z.ZodBoolean;
139
146
  canSpawnChild: z.ZodBoolean;
140
147
  createdAt: z.ZodNumber;
141
148
  deletedAt: z.ZodNullable<z.ZodNumber>;
@@ -235,13 +242,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
235
242
  suggestedBranchName: string;
236
243
  attempt: number;
237
244
  pathKey: string;
238
- 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;
239
254
  experimental_claimPath(path: string): Promise<boolean>;
240
255
  /** Resource is private to this provider; null after completed removal. */
241
256
  previous: {
242
257
  environment: Environment;
243
258
  resource: JsonValue$1 | null;
244
- } | null;
259
+ };
245
260
  report: PluginEnvironmentProviderProgress;
246
261
  signal: AbortSignal;
247
262
  }
@@ -275,7 +290,7 @@ type PluginEnvironmentProviderRemoveResult = {
275
290
  interface PluginEnvironmentProviderPolicy {
276
291
  /** Default five minutes; null keeps the environment indefinitely. */
277
292
  retireGraceMs: number | null;
278
- /** 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. */
279
294
  pathKeys: "per-attempt" | "per-thread";
280
295
  }
281
296
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -295,7 +310,9 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
295
310
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
296
311
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
297
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>;
298
315
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
299
316
  }
300
317
 
301
- 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 };
@@ -85,6 +85,12 @@ declare const environmentSchema: z.ZodObject<{
85
85
  }, z.core.$strip>], "type">;
86
86
  }, z.core.$strip>>;
87
87
  hostId: z.ZodString;
88
+ hostLifecycle: z.ZodEnum<{
89
+ "cleanup-failed": "cleanup-failed";
90
+ active: "active";
91
+ removed: "removed";
92
+ removing: "removing";
93
+ }>;
88
94
  id: z.ZodString;
89
95
  isGitRepo: z.ZodBoolean;
90
96
  isWorktree: z.ZodBoolean;
@@ -474,6 +480,7 @@ type ExecutionInputFieldSource = CallerExecutionInputSource;
474
480
  declare const threadResponseSchema: z.ZodObject<{
475
481
  activeBackgroundAgentCount: z.ZodNumber;
476
482
  archivedAt: z.ZodNullable<z.ZodNumber>;
483
+ canRestoreEnvironment: z.ZodBoolean;
477
484
  canSpawnChild: z.ZodBoolean;
478
485
  createdAt: z.ZodNumber;
479
486
  deletedAt: z.ZodNullable<z.ZodNumber>;
@@ -573,13 +580,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
573
580
  suggestedBranchName: string;
574
581
  attempt: number;
575
582
  pathKey: string;
576
- 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;
577
592
  experimental_claimPath(path: string): Promise<boolean>;
578
593
  /** Resource is private to this provider; null after completed removal. */
579
594
  previous: {
580
595
  environment: Environment;
581
596
  resource: JsonValue$2 | null;
582
- } | null;
597
+ };
583
598
  report: PluginEnvironmentProviderProgress;
584
599
  signal: AbortSignal;
585
600
  }
@@ -613,7 +628,7 @@ type PluginEnvironmentProviderRemoveResult = {
613
628
  interface PluginEnvironmentProviderPolicy {
614
629
  /** Default five minutes; null keeps the environment indefinitely. */
615
630
  retireGraceMs: number | null;
616
- /** 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. */
617
632
  pathKeys: "per-attempt" | "per-thread";
618
633
  }
619
634
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -633,6 +648,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
633
648
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
634
649
  experimental_existingPath?(inputs: InputsValue$1<S>): string | null;
635
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>;
636
653
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
637
654
  }
638
655
 
@@ -1947,6 +1964,7 @@ interface NormalizedPluginEnvironmentProvider {
1947
1964
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
1948
1965
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
1949
1966
  create: PluginEnvironmentProviderDeclaration["create"];
1967
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
1950
1968
  remove: PluginEnvironmentProviderDeclaration["remove"];
1951
1969
  policy: PluginEnvironmentProviderPolicy;
1952
1970
  }
@@ -3661,6 +3661,7 @@ declare const threadEventSchema: z.ZodPipe<z.ZodUnknown, z.ZodUnion<readonly [z.
3661
3661
  cause: z.ZodOptional<z.ZodLiteral<"host-connection-lost">>;
3662
3662
  reason: z.ZodEnum<{
3663
3663
  "host-daemon-restarted": "host-daemon-restarted";
3664
+ "host-removed": "host-removed";
3664
3665
  "manual-stop": "manual-stop";
3665
3666
  "provider-turn-idle": "provider-turn-idle";
3666
3667
  }>;
@@ -160,6 +160,12 @@ declare const environmentSchema: z.ZodObject<{
160
160
  }, z.core.$strip>], "type">;
161
161
  }, z.core.$strip>>;
162
162
  hostId: z.ZodString;
163
+ hostLifecycle: z.ZodEnum<{
164
+ "cleanup-failed": "cleanup-failed";
165
+ active: "active";
166
+ removed: "removed";
167
+ removing: "removing";
168
+ }>;
163
169
  id: z.ZodString;
164
170
  isGitRepo: z.ZodBoolean;
165
171
  isWorktree: z.ZodBoolean;
@@ -267,6 +273,7 @@ type ProviderFork = (typeof PROVIDER_FORK_VALUES)[number];
267
273
  declare const threadResponseSchema: z.ZodObject<{
268
274
  activeBackgroundAgentCount: z.ZodNumber;
269
275
  archivedAt: z.ZodNullable<z.ZodNumber>;
276
+ canRestoreEnvironment: z.ZodBoolean;
270
277
  canSpawnChild: z.ZodBoolean;
271
278
  createdAt: z.ZodNumber;
272
279
  deletedAt: z.ZodNullable<z.ZodNumber>;
@@ -366,13 +373,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
366
373
  suggestedBranchName: string;
367
374
  attempt: number;
368
375
  pathKey: string;
369
- 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;
370
385
  experimental_claimPath(path: string): Promise<boolean>;
371
386
  /** Resource is private to this provider; null after completed removal. */
372
387
  previous: {
373
388
  environment: Environment;
374
389
  resource: JsonValue$2 | null;
375
- } | null;
390
+ };
376
391
  report: PluginEnvironmentProviderProgress;
377
392
  signal: AbortSignal;
378
393
  }
@@ -406,7 +421,7 @@ type PluginEnvironmentProviderRemoveResult = {
406
421
  interface PluginEnvironmentProviderPolicy {
407
422
  /** Default five minutes; null keeps the environment indefinitely. */
408
423
  retireGraceMs: number | null;
409
- /** 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. */
410
425
  pathKeys: "per-attempt" | "per-thread";
411
426
  }
412
427
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -426,6 +441,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
426
441
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
427
442
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
428
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>;
429
446
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
430
447
  }
431
448
 
@@ -984,6 +1001,7 @@ interface NormalizedPluginEnvironmentProvider {
984
1001
  validate: NonNullable<PluginEnvironmentProviderDeclaration["validate"]> | null;
985
1002
  experimental_existingPath: NonNullable<PluginEnvironmentProviderDeclaration["experimental_existingPath"]> | null;
986
1003
  create: PluginEnvironmentProviderDeclaration["create"];
1004
+ restore: NonNullable<PluginEnvironmentProviderDeclaration["restore"]> | null;
987
1005
  remove: PluginEnvironmentProviderDeclaration["remove"];
988
1006
  policy: PluginEnvironmentProviderPolicy;
989
1007
  }
@@ -197,6 +197,8 @@ declare const appKeybindingOverridesSchema: z$1.ZodArray<z$1.ZodObject<{
197
197
  "panel.previousTab": "panel.previousTab";
198
198
  "panel.reopenClosedTab": "panel.reopenClosedTab";
199
199
  "panel.toggle": "panel.toggle";
200
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
201
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
200
202
  "question.select.1": "question.select.1";
201
203
  "question.select.2": "question.select.2";
202
204
  "question.select.3": "question.select.3";
@@ -431,6 +433,12 @@ declare const environmentSchema: z$1.ZodObject<{
431
433
  }, z$1.core.$strip>], "type">;
432
434
  }, z$1.core.$strip>>;
433
435
  hostId: z$1.ZodString;
436
+ hostLifecycle: z$1.ZodEnum<{
437
+ "cleanup-failed": "cleanup-failed";
438
+ active: "active";
439
+ removed: "removed";
440
+ removing: "removing";
441
+ }>;
434
442
  id: z$1.ZodString;
435
443
  isGitRepo: z$1.ZodBoolean;
436
444
  isWorktree: z$1.ZodBoolean;
@@ -475,6 +483,7 @@ type Environment = z$1.infer<typeof environmentSchema>;
475
483
 
476
484
  declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
477
485
  changelogPreview: "changelogPreview";
486
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
478
487
  mobileApp: "mobileApp";
479
488
  serverMove: "serverMove";
480
489
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -502,6 +511,11 @@ declare const workspaceGitOperationSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObj
502
511
  }, z$1.core.$strip>], "kind">;
503
512
  type WorkspaceGitOperation = z$1.infer<typeof workspaceGitOperationSchema>;
504
513
 
514
+ declare const hostTypeSchema: z$1.ZodEnum<{
515
+ ephemeral: "ephemeral";
516
+ persistent: "persistent";
517
+ }>;
518
+ type HostType = z$1.infer<typeof hostTypeSchema>;
505
519
  declare const hostSchema: z$1.ZodObject<{
506
520
  createdAt: z$1.ZodNumber;
507
521
  id: z$1.ZodString;
@@ -3108,6 +3122,7 @@ declare const threadEventSchema: z$1.ZodPipe<z$1.ZodUnknown, z$1.ZodUnion<readon
3108
3122
  cause: z$1.ZodOptional<z$1.ZodLiteral<"host-connection-lost">>;
3109
3123
  reason: z$1.ZodEnum<{
3110
3124
  "host-daemon-restarted": "host-daemon-restarted";
3125
+ "host-removed": "host-removed";
3111
3126
  "manual-stop": "manual-stop";
3112
3127
  "provider-turn-idle": "provider-turn-idle";
3113
3128
  }>;
@@ -7850,6 +7865,22 @@ declare const hostDaemonCommandRegistry: {
7850
7865
  sha256: z$1.ZodString;
7851
7866
  sizeBytes: z$1.ZodNumber;
7852
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>;
7853
7884
  "host.read_file_relative": HostDaemonCommandDescriptor<"host.read_file_relative", z$1.ZodObject<{
7854
7885
  dotfiles: z$1.ZodEnum<{
7855
7886
  allow: "allow";
@@ -9513,6 +9544,15 @@ declare const pluginSettingsResponseSchema: z$1.ZodObject<{
9513
9544
  values: z$1.ZodRecord<z$1.ZodString, z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
9514
9545
  }, z$1.core.$strip>;
9515
9546
  type PluginSettingsResponse = z$1.infer<typeof pluginSettingsResponseSchema>;
9547
+ declare const pluginSafeModeResponseSchema: z$1.ZodObject<{
9548
+ enabled: z$1.ZodBoolean;
9549
+ }, z$1.core.$strip>;
9550
+ type PluginSafeModeResponse = z$1.infer<typeof pluginSafeModeResponseSchema>;
9551
+ declare const pluginSafeModeUpdateResponseSchema: z$1.ZodObject<{
9552
+ enabled: z$1.ZodBoolean;
9553
+ problems: z$1.ZodArray<z$1.ZodString>;
9554
+ }, z$1.core.$strip>;
9555
+ type PluginSafeModeUpdateResponse = z$1.infer<typeof pluginSafeModeUpdateResponseSchema>;
9516
9556
  declare const pluginTokenResponseSchema: z$1.ZodObject<{
9517
9557
  ok: z$1.ZodLiteral<true>;
9518
9558
  token: z$1.ZodString;
@@ -10068,6 +10108,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10068
10108
  "panel.previousTab": "panel.previousTab";
10069
10109
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10070
10110
  "panel.toggle": "panel.toggle";
10111
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10112
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10071
10113
  "question.select.1": "question.select.1";
10072
10114
  "question.select.2": "question.select.2";
10073
10115
  "question.select.3": "question.select.3";
@@ -10140,6 +10182,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10140
10182
  }, z$1.core.$strict>>;
10141
10183
  experiments: z$1.ZodRecord<z$1.ZodEnum<{
10142
10184
  changelogPreview: "changelogPreview";
10185
+ legacyJitiPluginLoader: "legacyJitiPluginLoader";
10143
10186
  mobileApp: "mobileApp";
10144
10187
  serverMove: "serverMove";
10145
10188
  sidebarProgressiveDisclosure: "sidebarProgressiveDisclosure";
@@ -10211,6 +10254,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10211
10254
  "panel.previousTab": "panel.previousTab";
10212
10255
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10213
10256
  "panel.toggle": "panel.toggle";
10257
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10258
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10214
10259
  "question.select.1": "question.select.1";
10215
10260
  "question.select.2": "question.select.2";
10216
10261
  "question.select.3": "question.select.3";
@@ -10296,6 +10341,8 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10296
10341
  "panel.previousTab": "panel.previousTab";
10297
10342
  "panel.reopenClosedTab": "panel.reopenClosedTab";
10298
10343
  "panel.toggle": "panel.toggle";
10344
+ "plugins.enterSafeMode": "plugins.enterSafeMode";
10345
+ "plugins.exitSafeMode": "plugins.exitSafeMode";
10299
10346
  "question.select.1": "question.select.1";
10300
10347
  "question.select.2": "question.select.2";
10301
10348
  "question.select.3": "question.select.3";
@@ -13492,6 +13539,7 @@ type ThreadSearchResponse = z$1.infer<typeof threadSearchResponseSchema>;
13492
13539
  declare const threadResponseSchema: z$1.ZodObject<{
13493
13540
  activeBackgroundAgentCount: z$1.ZodNumber;
13494
13541
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13542
+ canRestoreEnvironment: z$1.ZodBoolean;
13495
13543
  canSpawnChild: z$1.ZodBoolean;
13496
13544
  createdAt: z$1.ZodNumber;
13497
13545
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13550,6 +13598,7 @@ type ThreadPluginMetadataResponse = z$1.infer<typeof pluginMetadataSchema>;
13550
13598
  declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13551
13599
  activeBackgroundAgentCount: z$1.ZodNumber;
13552
13600
  archivedAt: z$1.ZodNullable<z$1.ZodNumber>;
13601
+ canRestoreEnvironment: z$1.ZodBoolean;
13553
13602
  canSpawnChild: z$1.ZodBoolean;
13554
13603
  createdAt: z$1.ZodNumber;
13555
13604
  deletedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -13572,6 +13621,12 @@ declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13572
13621
  }, z$1.core.$strip>], "type">;
13573
13622
  }, z$1.core.$strip>>;
13574
13623
  hostId: z$1.ZodString;
13624
+ hostLifecycle: z$1.ZodEnum<{
13625
+ "cleanup-failed": "cleanup-failed";
13626
+ active: "active";
13627
+ removed: "removed";
13628
+ removing: "removing";
13629
+ }>;
13575
13630
  id: z$1.ZodString;
13576
13631
  isGitRepo: z$1.ZodBoolean;
13577
13632
  isWorktree: z$1.ZodBoolean;
@@ -13612,6 +13667,7 @@ declare const threadWithIncludesResponseSchema: z$1.ZodObject<{
13612
13667
  unmanaged: "unmanaged";
13613
13668
  }>>;
13614
13669
  }, z$1.core.$strip>>>;
13670
+ environmentHostName: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
13615
13671
  environmentId: z$1.ZodNullable<z$1.ZodString>;
13616
13672
  host: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
13617
13673
  createdAt: z$1.ZodNumber;
@@ -14225,6 +14281,7 @@ declare const threadListQuerySchema: z$1.ZodObject<{
14225
14281
  false: "false";
14226
14282
  true: "true";
14227
14283
  }>>;
14284
+ hostId: z$1.ZodOptional<z$1.ZodString>;
14228
14285
  includeHidden: z$1.ZodOptional<z$1.ZodEnum<{
14229
14286
  false: "false";
14230
14287
  true: "true";
@@ -15544,6 +15601,7 @@ interface HostProviderCliInstallArgs extends HostProviderCliInstallRequest {
15544
15601
  }
15545
15602
  interface HostListArgs {
15546
15603
  includeCreating?: boolean;
15604
+ type?: HostType;
15547
15605
  signal?: AbortSignal;
15548
15606
  }
15549
15607
  interface MachineCreateArgs extends CreateMachineRequest {
@@ -15884,6 +15942,12 @@ interface PluginListArgs {
15884
15942
  interface PluginListUpdateResultsArgs {
15885
15943
  signal?: AbortSignal;
15886
15944
  }
15945
+ interface PluginGetSafeModeArgs {
15946
+ signal?: AbortSignal;
15947
+ }
15948
+ interface PluginSetSafeModeArgs {
15949
+ enabled: boolean;
15950
+ }
15887
15951
  type PluginDisableResult = InstalledPlugin;
15888
15952
  type PluginEnableResult = InstalledPlugin;
15889
15953
  type PluginGetSettingsResult = PluginSettingsResponse;
@@ -15891,6 +15955,8 @@ type PluginInstallResult = InstalledPlugin;
15891
15955
  type PluginListResult = PluginListResponse;
15892
15956
  type PluginReloadResult = PluginReloadResponse;
15893
15957
  type PluginRemoveResult = PluginRemoveResponse;
15958
+ type PluginSafeModeResult = PluginSafeModeResponse;
15959
+ type PluginSetSafeModeResult = PluginSafeModeUpdateResponse;
15894
15960
  type PluginTokenResult = PluginTokenResponse;
15895
15961
  type PluginUpdateSettingsResult = PluginSettingsResponse;
15896
15962
  type PluginGetSourceResult = PluginSourceDetail;
@@ -15919,6 +15985,8 @@ interface PluginMarketplacesArea {
15919
15985
  }
15920
15986
  interface PluginsArea {
15921
15987
  experimental_discoverRpc(args?: PluginRpcDiscoveryQuery): Promise<PublishedPluginRpcMethod[]>;
15988
+ experimental_getSafeMode(args?: PluginGetSafeModeArgs): Promise<PluginSafeModeResult>;
15989
+ experimental_setSafeMode(args: PluginSetSafeModeArgs): Promise<PluginSetSafeModeResult>;
15922
15990
  applyUpdate(args: PluginIdArgs): Promise<PluginApplyUpdateResult>;
15923
15991
  callRpc<TOutput>(args: PluginRpcArgs<TOutput>): Promise<TOutput>;
15924
15992
  checkUpdates(args?: PluginCheckUpdatesArgs): Promise<PluginCheckUpdatesResult>;
@@ -16322,6 +16390,7 @@ interface TerminalsArea {
16322
16390
  interface ThreadListArgs {
16323
16391
  archived?: boolean;
16324
16392
  environmentId?: string;
16393
+ hostId?: string;
16325
16394
  sectionId?: string;
16326
16395
  hasParent?: boolean;
16327
16396
  includeHidden?: boolean;
@@ -16433,6 +16502,7 @@ type ThreadUnarchiveResult = {
16433
16502
  };
16434
16503
  type ThreadArchiveAllResult = ThreadArchiveAllResponse;
16435
16504
  type ThreadReadStateResult = ThreadResponse;
16505
+ type ThreadRestoreEnvironmentResult = ThreadResponse;
16436
16506
  type ThreadPinOrderResult = ThreadListResponse;
16437
16507
  type ThreadPromptHistoryResult = PromptHistoryResponse;
16438
16508
  type ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;
@@ -16725,6 +16795,14 @@ interface ThreadsArea {
16725
16795
  * `sendAt` in the future queues it on the clock and a `message.dispatch` hook
16726
16796
  * can still hold it; the response says which of the two happened.
16727
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>;
16728
16806
  retry(args: ThreadRetryArgs): Promise<ThreadRetryResult>;
16729
16807
  search(args: ThreadSearchArgs): Promise<ThreadSearchResult>;
16730
16808
  send(args: ThreadSendArgs): Promise<ThreadSendResult>;
@@ -17969,6 +18047,10 @@ interface PluginSidebarThreadsState {
17969
18047
  } | null;
17970
18048
  status: "error" | "loading" | "ready";
17971
18049
  threads: readonly PluginSidebarThread[];
18050
+ experimental_hosts?: readonly {
18051
+ id: string;
18052
+ name: string;
18053
+ }[];
17972
18054
  projects: readonly PluginSidebarProject[];
17973
18055
  /** Every section, in the server's order (creation order). */
17974
18056
  sections: readonly PluginSidebarSection[];
@@ -18134,11 +18216,15 @@ interface PluginSidebarThreadActions {
18134
18216
  * `sectionId` files the new thread under that section, and
18135
18217
  * `environmentId` reuses that environment (the "New thread in
18136
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.
18137
18222
  */
18138
18223
  openNewThread(options?: {
18139
18224
  projectId?: string;
18140
18225
  sectionId?: string;
18141
18226
  environmentId?: string;
18227
+ hostId?: string;
18142
18228
  focusPrompt?: boolean;
18143
18229
  }): void;
18144
18230
  setPinned(threadId: string, pinned: boolean): Promise<void>;
@@ -18256,12 +18342,13 @@ interface PluginSidebarThreadSplit {
18256
18342
  * Replace the sidebar's thread list with a plugin component.
18257
18343
  *
18258
18344
  * Unlike every other slot, this one is EXCLUSIVE: two lists cannot share one
18259
- * scroll area. Registering activates the replacement while the plugin is
18260
- * enabled. If multiple plugins register one, the first in deterministic slot
18261
- * order is active by default; removing it reveals the next. The user can pin
18262
- * BB's list or a specific provider under Settings → Appearance. A plugin can
18263
- * also use its own setting and render `Original` conditionally.
18264
- * An absent or crashing replacement falls back to BB's list rather than
18345
+ * scroll area. bb ships its own list as the bundled Thread list plugin
18346
+ * (`thread-list/thread-list`). Registering activates the replacement while the
18347
+ * plugin is enabled: by default the first registered list other than the
18348
+ * bundled one, in deterministic slot order, is active, falling back to the
18349
+ * bundled list; removing it reveals the next. The user can pin a specific
18350
+ * provider, including the bundled one, under Settings → Appearance → Sidebar.
18351
+ * A missing pinned provider or a crashing list shows a placeholder rather than
18265
18352
  * leaving the user with no sidebar.
18266
18353
  *
18267
18354
  * The plugin gets the scrolling list and nothing else. The New-thread button,
@@ -18280,11 +18367,12 @@ interface PluginThreadListRegistration {
18280
18367
  }
18281
18368
  /**
18282
18369
  * Replace the navigation controls above the sidebar thread list. Exclusive:
18283
- * the user picks one provider under Settings → Appearance → Navigation, and
18284
18370
  * bb ships its own rows as the bundled Navigation plugin
18285
- * (`navigation/navigation`, the default). A picked provider that is disabled
18286
- * or removed falls back to Navigation; a crashing provider is replaced by a
18287
- * placeholder with a Reload button.
18371
+ * (`navigation/navigation`). By default the first registered provider other
18372
+ * than Navigation is active, falling back to Navigation; the user can pin one
18373
+ * provider under Settings → Appearance → Navigation. A pinned provider that is
18374
+ * disabled or removed falls back to Navigation; a crashing provider is
18375
+ * replaced by a placeholder with a Reload button.
18288
18376
  */
18289
18377
  interface ExperimentalSidebarNavigationRegistration {
18290
18378
  /** Unique within the plugin; letters, digits, `-`, `_`. */
@@ -20097,13 +20185,21 @@ interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProv
20097
20185
  suggestedBranchName: string;
20098
20186
  attempt: number;
20099
20187
  pathKey: string;
20100
- 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;
20101
20197
  experimental_claimPath(path: string): Promise<boolean>;
20102
20198
  /** Resource is private to this provider; null after completed removal. */
20103
20199
  previous: {
20104
20200
  environment: Environment;
20105
20201
  resource: JsonValue$2 | null;
20106
- } | null;
20202
+ };
20107
20203
  report: PluginEnvironmentProviderProgress;
20108
20204
  signal: AbortSignal;
20109
20205
  }
@@ -20137,7 +20233,7 @@ type PluginEnvironmentProviderRemoveResult = {
20137
20233
  interface PluginEnvironmentProviderPolicy {
20138
20234
  /** Default five minutes; null keeps the environment indefinitely. */
20139
20235
  retireGraceMs: number | null;
20140
- /** 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. */
20141
20237
  pathKeys: "per-attempt" | "per-thread";
20142
20238
  }
20143
20239
  /** Resource operations only. Core owns durable launches, retries and retirement. */
@@ -20157,6 +20253,8 @@ interface PluginEnvironmentProviderDefinition<R extends PluginEnvironmentProvide
20157
20253
  /** Pure path selection from parsed inputs. Core reuses a recorded environment on the selected host before calling create; null requests normal creation. */
20158
20254
  experimental_existingPath?(inputs: InputsValue<S>): string | null;
20159
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>;
20160
20258
  remove(context: PluginEnvironmentProviderRemoveContext): Promise<PluginEnvironmentProviderRemoveResult>;
20161
20259
  }
20162
20260
 
@@ -20478,6 +20576,15 @@ interface PluginThreadEventPayloads {
20478
20576
  "experimental_terminal.input": {
20479
20577
  terminal: TerminalSession;
20480
20578
  };
20579
+ /**
20580
+ * Fired once after a machine is removed, whether a user removed it or its
20581
+ * machine provider finished tearing it down. `host` is the record as it was
20582
+ * when it was removed; `bb.sdk.hosts.get` answers 404 for it from now on, so
20583
+ * this is the moment to drop anything the plugin keeps per host.
20584
+ */
20585
+ "experimental_host.deleted": {
20586
+ host: Host;
20587
+ };
20481
20588
  /** Fired after a thread row is created. */
20482
20589
  "thread.created": {
20483
20590
  thread: ThreadResponse;
@@ -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
  };
@@ -1876,6 +1876,7 @@ var systemUserQuestionLifecycleEventDataSchema = z13.object({
1876
1876
  var systemThreadInterruptedReasonValues = [
1877
1877
  "manual-stop",
1878
1878
  "host-daemon-restarted",
1879
+ "host-removed",
1879
1880
  "provider-turn-idle"
1880
1881
  ];
1881
1882
  var systemThreadInterruptedReasonSchema = z13.enum(
@@ -965,6 +965,7 @@ var systemUserQuestionLifecycleEventDataSchema = z11.object({
965
965
  var systemThreadInterruptedReasonValues = [
966
966
  "manual-stop",
967
967
  "host-daemon-restarted",
968
+ "host-removed",
968
969
  "provider-turn-idle"
969
970
  ];
970
971
  var systemThreadInterruptedReasonSchema = z11.enum(
@@ -2403,6 +2403,7 @@ var systemUserQuestionLifecycleEventDataSchema = z15.object({
2403
2403
  var systemThreadInterruptedReasonValues = [
2404
2404
  "manual-stop",
2405
2405
  "host-daemon-restarted",
2406
+ "host-removed",
2406
2407
  "provider-turn-idle"
2407
2408
  ];
2408
2409
  var systemThreadInterruptedReasonSchema = z15.enum(
@@ -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
  };
@@ -3295,6 +3302,7 @@ function createFakePluginHostInternal(options, sharedState) {
3295
3302
  const threadEventHandlers = {
3296
3303
  "experimental_thread.events": [],
3297
3304
  "experimental_terminal.input": [],
3305
+ "experimental_host.deleted": [],
3298
3306
  "thread.created": [],
3299
3307
  "thread.active": [],
3300
3308
  "thread.idle": [],
@@ -3732,6 +3740,7 @@ function createFakePluginHostInternal(options, sharedState) {
3732
3740
  return {
3733
3741
  "experimental_thread.events": threadEventHandlers["experimental_thread.events"].length,
3734
3742
  "experimental_terminal.input": threadEventHandlers["experimental_terminal.input"].length,
3743
+ "experimental_host.deleted": threadEventHandlers["experimental_host.deleted"].length,
3735
3744
  "thread.created": threadEventHandlers["thread.created"].length,
3736
3745
  "thread.active": threadEventHandlers["thread.active"].length,
3737
3746
  "thread.idle": threadEventHandlers["thread.idle"].length,
@@ -4251,6 +4260,7 @@ function makeThreadResponse(overrides = {}) {
4251
4260
  updatedAt: 0,
4252
4261
  runtime: { displayStatus: "idle", hostReconnectGraceExpiresAt: null },
4253
4262
  activeBackgroundAgentCount: 0,
4263
+ canRestoreEnvironment: false,
4254
4264
  canSpawnChild: true,
4255
4265
  queuedMessageCount: 0,
4256
4266
  ...overrides
@@ -4357,6 +4367,7 @@ function makeMessageDispatchHookContext(overrides = {}) {
4357
4367
  environmentProviderSelection: null,
4358
4368
  environmentProviderInstanceKey: null,
4359
4369
  lifecycle: { phase: "active", retireAt: null, teardown: null },
4370
+ hostLifecycle: "active",
4360
4371
  managed: false,
4361
4372
  workspaceProvisionType: null,
4362
4373
  status: "ready",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.5.24",
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"