@get-bb/plugin-sdk 0.6.179 → 0.6.189

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.
@@ -14,6 +14,7 @@ interface JsonObject {
14
14
  type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
15
15
 
16
16
  declare const environmentSchema: z.ZodObject<{
17
+ additionalPaths: z.ZodArray<z.ZodString>;
17
18
  baseBranch: z.ZodNullable<z.ZodString>;
18
19
  branchName: z.ZodNullable<z.ZodString>;
19
20
  createdAt: z.ZodNumber;
@@ -31,7 +32,7 @@ declare const environmentSchema: z.ZodObject<{
31
32
  type: z.ZodLiteral<"new">;
32
33
  }, z.core.$strip>], "type">;
33
34
  }, z.core.$strip>>;
34
- heldBy: z.ZodNullable<z.ZodLiteral<"user">>;
35
+ heldBy: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodTemplateLiteral<`plugin:${string}`>]>>;
35
36
  hostId: z.ZodString;
36
37
  hostLifecycle: z.ZodEnum<{
37
38
  "cleanup-failed": "cleanup-failed";
@@ -119,6 +120,16 @@ declare const hostSchema: z.ZodObject<{
119
120
  full: "full";
120
121
  }>;
121
122
  name: z.ZodString;
123
+ route: z.ZodNullable<z.ZodObject<{
124
+ displayName: z.ZodString;
125
+ kind: z.ZodEnum<{
126
+ "local-network": "local-network";
127
+ "private-overlay": "private-overlay";
128
+ custom: "custom";
129
+ relay: "relay";
130
+ }>;
131
+ providerId: z.ZodString;
132
+ }, z.core.$strip>>;
122
133
  status: z.ZodEnum<{
123
134
  connected: "connected";
124
135
  disconnected: "disconnected";
@@ -220,6 +231,20 @@ interface PluginEnvironmentProviderSteps {
220
231
  * Without a call, core runs setup after create returns.
221
232
  */
222
233
  setup(path: string): Promise<void>;
234
+ /**
235
+ * Hands this operation a ready environment this plugin holds, at once and
236
+ * atomically: the environment becomes the one this create produces, keeps
237
+ * its setup, and takes `resource`, which `remove()` receives if create never
238
+ * returns. The hold is cleared when create returns. Rejects when the
239
+ * environment is not a ready one this plugin holds on the same project and
240
+ * machine; then nothing changed. Setup does not run again unless
241
+ * `setup(path)` is called afterwards with the adopted path, which starts it
242
+ * at once. A `created` result must name its path; any other outcome leaves
243
+ * the environment in error, and its thread fails. If bb restarts before
244
+ * create returns, the environment is removed and the thread is provisioned
245
+ * again.
246
+ */
247
+ adopt(environmentId: string, resource: JsonValue$1): Promise<void>;
223
248
  }
224
249
  interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProviderRequirements = PluginEnvironmentProviderRequirements, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S>, PluginEnvironmentProviderSteps {
225
250
  environment: PluginEnvironmentProviderEnvironment;
@@ -242,6 +267,14 @@ type PluginEnvironmentProviderCreateResult = {
242
267
  ownsPath: boolean;
243
268
  /** Ref the workspace's changes are compared against. Null clears the value recorded on a reused environment; omit to keep it. */
244
269
  mergeBaseBranch?: string | null;
270
+ /**
271
+ * Experimental: absolute paths of this environment's own extra folders,
272
+ * such as sibling checkouts it created next to `path`. Threads in the
273
+ * environment can read and write them. Core records them with the
274
+ * environment; omit on a reused environment to keep the recorded list.
275
+ * See docs/api_to_audit.md.
276
+ */
277
+ additionalPaths?: string[];
245
278
  resource?: JsonValue$1;
246
279
  } | {
247
280
  status: "failed";
@@ -6,7 +6,7 @@
6
6
  // and read the real source: https://github.com/get-bb/bb
7
7
 
8
8
  import { z } from 'zod';
9
- import { JsonValue as JsonValue$2, PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1, ComposerMention as ComposerMention$1, PluginComposerTextEffect as PluginComposerTextEffect$1 } from '@get-bb/plugin-sdk';
9
+ import { JsonValue as JsonValue$2, PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1, ComposerMention as ComposerMention$1, PluginComposerTextEffect as PluginComposerTextEffect$1, ComposerInsertPart as ComposerInsertPart$1 } from '@get-bb/plugin-sdk';
10
10
 
11
11
  interface JsonObject {
12
12
  [key: string]: JsonValue$1;
@@ -82,10 +82,18 @@ type JsonValue = string | number | boolean | null | JsonValue[] | {
82
82
  type PluginComposerScope = {
83
83
  kind: "thread";
84
84
  threadId: string;
85
+ /** The thread's project. */
86
+ projectId: string;
87
+ /** The thread's environment; null while the thread has none. */
88
+ environmentId: string | null;
85
89
  } | {
86
90
  kind: "queued-message";
87
91
  threadId: string;
88
92
  queuedMessageId: string;
93
+ /** The queued message's thread's project. */
94
+ projectId: string;
95
+ /** The queued message's thread's environment; null while it has none. */
96
+ environmentId: string | null;
89
97
  } | {
90
98
  kind: "new-thread";
91
99
  /** Root compose's effective selected project; null only while unresolved. */
@@ -274,8 +282,9 @@ interface PluginComposerApi {
274
282
  * Insert text and mentions. See {@link ComposerInsertOptions} for placement.
275
283
  * Mentions read from `draft` are recreated exactly; the calling plugin's
276
284
  * own `{ provider, id, label }` resolves through its mention provider.
277
- * Throws for another plugin's mention without `kind`, and for
278
- * `at: "cursor"` when the composer is not on screen.
285
+ * Throws for another plugin's mention without `kind`, for an empty provider
286
+ * id, one containing `:`, or an empty item id, and for `at: "cursor"` when
287
+ * the composer is not on screen.
279
288
  */
280
289
  insert(parts: ComposerInsertPart | readonly ComposerInsertPart[], options?: ComposerInsertOptions): void;
281
290
  /**
@@ -363,7 +372,8 @@ interface PluginComposerApi {
363
372
  * has, so a missing key means "no such picker here" and a value that
364
373
  * differs from the one passed was reconciled (a reasoning level the model
365
374
  * does not support, a service tier the model does not offer, a permission
366
- * mode above the machine's ceiling, a model the provider does not list). A provider the composer does not list is
375
+ * mode above the machine's ceiling, a model the provider does not list, a
376
+ * `reuse` of a missing or destroyed environment). A provider the composer does not list is
367
377
  * ignored together with the model and reasoning level meant for it, so the
368
378
  * stored provider preference never names something the picker could not
369
379
  * have chosen. `environment` is absent while the composer
@@ -486,7 +496,12 @@ interface ComposerHandleBinding {
486
496
  }
487
497
  declare const OFF_SCREEN_EDITOR_STATE: ComposerEditorState;
488
498
  declare function appendComposerDraft(current: ComposerDraft$1, value: ComposerDraft$1, block: boolean): ComposerDraft$1;
499
+ interface ComposerInsertContext {
500
+ pluginId: string | null;
501
+ mentionText(mention: ComposerMention$1): string;
502
+ }
503
+ declare function composerDraftFromInsertParts(parts: ComposerInsertPart$1 | readonly ComposerInsertPart$1[], context: ComposerInsertContext): ComposerDraft$1;
489
504
  declare function createComposerHandleBinding(key: string, initial: ComposerHandleController): ComposerHandleBinding;
490
505
 
491
- export { OFF_SCREEN_EDITOR_STATE, appendComposerDraft, createComposerDraftActions, createComposerHandleBinding, reconcileComposerMentions };
492
- export type { ComposerEditorState, ComposerEditorSubmission, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget, ComposerSubmitExtras };
506
+ export { OFF_SCREEN_EDITOR_STATE, appendComposerDraft, composerDraftFromInsertParts, createComposerDraftActions, createComposerHandleBinding, reconcileComposerMentions };
507
+ export type { ComposerEditorState, ComposerEditorSubmission, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget, ComposerInsertContext, ComposerSubmitExtras };
@@ -143,6 +143,7 @@ interface JsonObject {
143
143
  type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | JsonObject;
144
144
 
145
145
  declare const environmentSchema: z.ZodObject<{
146
+ additionalPaths: z.ZodArray<z.ZodString>;
146
147
  baseBranch: z.ZodNullable<z.ZodString>;
147
148
  branchName: z.ZodNullable<z.ZodString>;
148
149
  createdAt: z.ZodNumber;
@@ -160,7 +161,7 @@ declare const environmentSchema: z.ZodObject<{
160
161
  type: z.ZodLiteral<"new">;
161
162
  }, z.core.$strip>], "type">;
162
163
  }, z.core.$strip>>;
163
- heldBy: z.ZodNullable<z.ZodLiteral<"user">>;
164
+ heldBy: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodTemplateLiteral<`plugin:${string}`>]>>;
164
165
  hostId: z.ZodString;
165
166
  hostLifecycle: z.ZodEnum<{
166
167
  "cleanup-failed": "cleanup-failed";
@@ -248,6 +249,16 @@ declare const hostSchema: z.ZodObject<{
248
249
  full: "full";
249
250
  }>;
250
251
  name: z.ZodString;
252
+ route: z.ZodNullable<z.ZodObject<{
253
+ displayName: z.ZodString;
254
+ kind: z.ZodEnum<{
255
+ "local-network": "local-network";
256
+ "private-overlay": "private-overlay";
257
+ custom: "custom";
258
+ relay: "relay";
259
+ }>;
260
+ providerId: z.ZodString;
261
+ }, z.core.$strip>>;
251
262
  status: z.ZodEnum<{
252
263
  connected: "connected";
253
264
  disconnected: "disconnected";
@@ -701,6 +712,20 @@ interface PluginEnvironmentProviderSteps {
701
712
  * Without a call, core runs setup after create returns.
702
713
  */
703
714
  setup(path: string): Promise<void>;
715
+ /**
716
+ * Hands this operation a ready environment this plugin holds, at once and
717
+ * atomically: the environment becomes the one this create produces, keeps
718
+ * its setup, and takes `resource`, which `remove()` receives if create never
719
+ * returns. The hold is cleared when create returns. Rejects when the
720
+ * environment is not a ready one this plugin holds on the same project and
721
+ * machine; then nothing changed. Setup does not run again unless
722
+ * `setup(path)` is called afterwards with the adopted path, which starts it
723
+ * at once. A `created` result must name its path; any other outcome leaves
724
+ * the environment in error, and its thread fails. If bb restarts before
725
+ * create returns, the environment is removed and the thread is provisioned
726
+ * again.
727
+ */
728
+ adopt(environmentId: string, resource: JsonValue$2): Promise<void>;
704
729
  }
705
730
  interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S>, PluginEnvironmentProviderSteps {
706
731
  environment: PluginEnvironmentProviderEnvironment;
@@ -723,6 +748,14 @@ type PluginEnvironmentProviderCreateResult = {
723
748
  ownsPath: boolean;
724
749
  /** Ref the workspace's changes are compared against. Null clears the value recorded on a reused environment; omit to keep it. */
725
750
  mergeBaseBranch?: string | null;
751
+ /**
752
+ * Experimental: absolute paths of this environment's own extra folders,
753
+ * such as sibling checkouts it created next to `path`. Threads in the
754
+ * environment can read and write them. Core records them with the
755
+ * environment; omit on a reused environment to keep the recorded list.
756
+ * See docs/api_to_audit.md.
757
+ */
758
+ additionalPaths?: string[];
726
759
  resource?: JsonValue$2;
727
760
  } | {
728
761
  status: "failed";
@@ -1054,10 +1087,20 @@ interface ServerAccessGrant {
1054
1087
  serverUrl: string;
1055
1088
  headers?: Record<string, string>;
1056
1089
  }
1090
+ type ServerAccessRouteKind = "custom" | "local-network" | "private-overlay" | "relay";
1057
1091
  interface ServerAccessProviderDeclaration {
1058
1092
  id: string;
1059
1093
  displayName: string;
1060
1094
  description: string;
1095
+ /**
1096
+ * How machines and apps travel to this server over the provider's address.
1097
+ * Core ranks enabled routes by kind (local network, private overlay such as
1098
+ * a tailnet, relay, then custom) until the user orders them in Settings.
1099
+ * New machines install on a `"relay"` or `"custom"` route before a
1100
+ * `"local-network"` or `"private-overlay"` one. Plugins built against an SDK
1101
+ * before 0.6.188 may omit it; core treats those as `"custom"`.
1102
+ */
1103
+ routeKind: ServerAccessRouteKind;
1061
1104
  availability(): (PluginMachineProviderAvailability & {
1062
1105
  serverUrl?: string;
1063
1106
  }) | Promise<PluginMachineProviderAvailability & {
@@ -1276,19 +1319,50 @@ interface MessageDispatchHookContext {
1276
1319
  * derive from this map — and so does the server's hook registry — so a
1277
1320
  * half-added hook does not compile.
1278
1321
  *
1279
- * One hook today: `message.dispatch`, THE admission checkpoint, run identically
1280
- * for a thread's first message, a follow-up, a steer, a retry, and every
1281
- * re-attempt a drain makes. It replaced the earlier `thread.create` +
1282
- * `turn.submit` pair, whose split was an accident of where the code happened to
1283
- * branch rather than a difference a plugin needed to see — the attempt's own
1284
- * `attempt` kind carries what actually differs.
1322
+ * `message.dispatch` is THE admission checkpoint, run identically for a
1323
+ * thread's first message, a follow-up, a steer, a retry, and every re-attempt a
1324
+ * drain makes. It replaced the earlier `thread.create` + `turn.submit` pair,
1325
+ * whose split was an accident of where the code happened to branch rather than
1326
+ * a difference a plugin needed to see — the attempt's own `attempt` kind
1327
+ * carries what actually differs.
1328
+ *
1329
+ * `thread.delete_finalize` runs before core finishes deleting a thread by
1330
+ * removing its rows from the database, so a plugin can copy the thread first.
1285
1331
  */
1286
1332
  interface PluginHookSignatures {
1287
1333
  "message.dispatch": {
1288
1334
  context: MessageDispatchHookContext;
1289
1335
  decision: MessageDispatchHookDecision;
1290
1336
  };
1337
+ "thread.delete_finalize": {
1338
+ context: ThreadDeleteFinalizeHookContext;
1339
+ decision: ThreadDeleteFinalizeHookDecision;
1340
+ };
1341
+ }
1342
+ /**
1343
+ * A deleted thread core is about to remove from the database. The thread is
1344
+ * already hidden and can no longer change, and every read that works on a
1345
+ * thread id, such as `bb.sdk.threads.experimental_export`, still works until
1346
+ * the removal starts.
1347
+ */
1348
+ interface ThreadDeleteFinalizeHookContext {
1349
+ threadId: string;
1350
+ projectId: string;
1291
1351
  }
1352
+ /**
1353
+ * `proceed` lets core remove the rows. `wait` keeps them: core asks again
1354
+ * about every 10 seconds and on every restart, until every plugin answers
1355
+ * `proceed`. Once the removal starts core never asks about that thread again.
1356
+ *
1357
+ * A handler that throws, times out or returns something else counts as
1358
+ * `wait`. A plugin that is disabled or uninstalled is not asked, so its
1359
+ * threads are removed without it.
1360
+ */
1361
+ type ThreadDeleteFinalizeHookDecision = {
1362
+ action: "proceed";
1363
+ } | {
1364
+ action: "wait";
1365
+ };
1292
1366
  type PluginHookName = keyof PluginHookSignatures;
1293
1367
  type PluginHookHandler<K extends PluginHookName> = (context: PluginHookSignatures[K]["context"]) => PluginHookSignatures[K]["decision"] | Promise<PluginHookSignatures[K]["decision"]>;
1294
1368
  type PluginHttpAuthMode = "local" | "none" | "token";
@@ -1839,6 +1913,14 @@ interface PluginMentionSearchContext {
1839
1913
  query: string;
1840
1914
  projectId: string | null;
1841
1915
  threadId: string | null;
1916
+ /**
1917
+ * Aborts when the search is no longer wanted: the person typed past it and
1918
+ * the composer cancelled the request, the 2s time box ran out, or this
1919
+ * plugin instance is reloaded, disabled or removed. Pass it to `fetch` or
1920
+ * check it between steps; the host ignores whatever a search returns after
1921
+ * its signal aborts.
1922
+ */
1923
+ experimental_signal: AbortSignal;
1842
1924
  }
1843
1925
  /** One row a mention provider returns from `search`. `id` is the provider's
1844
1926
  * own item id — the host namespaces it before it reaches the wire. */
@@ -1880,7 +1962,11 @@ interface PluginMentionProviderRegistration {
1880
1962
  * Runs server-side as the user types after one of this provider's triggers
1881
1963
  * in the composer. Each call is time-boxed (2s) and failure-isolated: a slow
1882
1964
  * or throwing provider contributes an empty list — it can never break the
1883
- * mention menu.
1965
+ * mention menu. A provider runs one search at a time: a query typed while a
1966
+ * search is running waits for it, and only the newest waiting query runs.
1967
+ * A search still running after its time box keeps the provider out of
1968
+ * results until it settles. Stop work when `ctx.experimental_signal` aborts
1969
+ * so the next query starts sooner.
1884
1970
  */
1885
1971
  search(ctx: PluginMentionSearchContext): PluginMentionItem[] | Promise<PluginMentionItem[]>;
1886
1972
  /**
@@ -2261,7 +2347,10 @@ interface NormalizedPluginMachineProvider {
2261
2347
  remove: PluginMachineProviderDeclaration["remove"];
2262
2348
  }
2263
2349
  declare function validatePluginMachineProviderDeclaration(declaration: PluginMachineProviderDeclaration): NormalizedPluginMachineProvider;
2264
- declare function validateServerAccessProviderDeclaration(declaration: ServerAccessProviderDeclaration): ServerAccessProviderDeclaration;
2350
+ type RegisteredServerAccessProviderDeclaration = Omit<ServerAccessProviderDeclaration, "routeKind"> & {
2351
+ routeKind?: ServerAccessProviderDeclaration["routeKind"];
2352
+ };
2353
+ declare function validateServerAccessProviderDeclaration(declaration: RegisteredServerAccessProviderDeclaration): ServerAccessProviderDeclaration;
2265
2354
  declare function runPluginStorageMigrations(database: Database.Database, statements: string[]): void;
2266
2355
  declare function normalizeHttpRouteRegistration(method: string, path: string, handler: unknown, opts: {
2267
2356
  auth?: PluginHttpAuthMode;
@@ -48,6 +48,16 @@ declare const hostSchema: z.ZodObject<{
48
48
  full: "full";
49
49
  }>;
50
50
  name: z.ZodString;
51
+ route: z.ZodNullable<z.ZodObject<{
52
+ displayName: z.ZodString;
53
+ kind: z.ZodEnum<{
54
+ "local-network": "local-network";
55
+ "private-overlay": "private-overlay";
56
+ custom: "custom";
57
+ relay: "relay";
58
+ }>;
59
+ providerId: z.ZodString;
60
+ }, z.core.$strip>>;
51
61
  status: z.ZodEnum<{
52
62
  connected: "connected";
53
63
  disconnected: "disconnected";
@@ -232,6 +232,13 @@ interface PluginSidebarThread {
232
232
  updatedAt: number;
233
233
  lastReadAt: number | null;
234
234
  latestAttentionAt: number;
235
+ /**
236
+ * Epoch ms of the last durable status transition, or creation for a new
237
+ * thread (0 for legacy rows). Unlike updatedAt, reading or renaming a
238
+ * thread does not change it. Independent of unread attention: successful
239
+ * child completion advances this even when latestAttentionAt stays put.
240
+ */
241
+ experimental_statusChangedAt: number;
235
242
  }
236
243
  /**
237
244
  * The fields of a {@link PluginSidebarThread} that
@@ -6,7 +6,7 @@
6
6
  // and read the real source: https://github.com/get-bb/bb
7
7
 
8
8
  import * as _get_bb_plugin_sdk from '@get-bb/plugin-sdk';
9
- import { ExperimentalSidebarFooterItemRegistration, PluginNavPanelRegistration, ExperimentalThreadContextCardSectionRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, InternalDoNotUseSetupGuideSectionRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalThreadContextSegmentRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadRowMetadataRegistration, ExperimentalThreadInfoSectionRegistration, ExperimentalThreadHeaderRowRegistration, ExperimentalThreadHeaderTitleRegistration, ExperimentalThreadContextCardRowRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalMessageMetadataRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalThreadRequests, BbNavigate, ExperimentalFilePreviewOptions, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, ExperimentalPluginPanelPage, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, ExperimentalThreadContextKind, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalComposerRendererApi, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalLiveFileTarget, ExperimentalFilePreviewFile, ExperimentalServers, ExperimentalPanelController, ExperimentalPanelTabs, JsonValue, ExperimentalPageTitle, ExperimentalOpenTabOptions, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
9
+ import { ExperimentalSidebarFooterItemRegistration, PluginNavPanelRegistration, ExperimentalThreadContextCardSectionRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, InternalDoNotUseSetupGuideSectionRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalThreadContextSegmentRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadRowMetadataRegistration, ExperimentalThreadInfoSectionRegistration, ExperimentalThreadHeaderRowRegistration, ExperimentalThreadHeaderTitleRegistration, ExperimentalThreadContextCardRowRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalMessageMetadataRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalThreadRequests, PluginSdkApp, BbNavigate, ExperimentalFilePreviewOptions, ExperimentalFileOpenOptions, ExperimentalSettingsTarget, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, ExperimentalPluginPanelPage, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, ExperimentalThreadContextKind, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalComposerRendererApi, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalLiveFileTarget, ExperimentalFilePreviewFile, ExperimentalServers, ExperimentalPanelController, ExperimentalPanelTabs, ExperimentalShortcutPresentation, JsonValue, ExperimentalPageTitle, ExperimentalOpenTabOptions, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
10
10
  import { ComponentType, ReactNode } from 'react';
11
11
  import { RenderResult } from '@testing-library/react';
12
12
 
@@ -135,6 +135,9 @@ type NavigateCall = {
135
135
  } | {
136
136
  method: "experimental_openTerminal";
137
137
  options: Parameters<BbNavigate["experimental_openTerminal"]>[0];
138
+ } | {
139
+ method: "experimental_toSettings";
140
+ target?: ExperimentalSettingsTarget;
138
141
  };
139
142
  type ExperimentalPanelCall = {
140
143
  method: "openTab" | "toggleTab";
@@ -224,6 +227,7 @@ interface SidebarNavigationCall {
224
227
  target?: ExperimentalSidebarNavigationTarget;
225
228
  }
226
229
  type TestClipboard = (content: ExperimentalClipboardContent) => Promise<boolean>;
230
+ type TestErrorToast = Parameters<PluginSdkApp["experimental_showErrorToast"]>[0];
227
231
  /**
228
232
  * Install the test runtime at `globalThis.__bbPluginRuntime.pluginSdkApp`,
229
233
  * plus the React the `@get-bb/plugin-sdk/app` components render through.
@@ -320,6 +324,8 @@ interface MountedPluginContentScripts {
320
324
  getThreadRowStatus(threadId: string): PluginComposerThreadRowStatus | null;
321
325
  /** Every `experimental_copyToClipboard()` write, in order. */
322
326
  readonly experimental_clipboardWrites: readonly ExperimentalClipboardContent[];
327
+ /** Every `experimental_showErrorToast()` call, in order. */
328
+ readonly experimental_errorToasts: readonly TestErrorToast[];
323
329
  };
324
330
  lifecycle: {
325
331
  /** Abort, then run returned cleanup functions once in reverse order. */
@@ -361,6 +367,11 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
361
367
  text?: string;
362
368
  /** Mention pills already in `text`, with ranges into it. */
363
369
  mentions?: readonly ComposerMention[];
370
+ /**
371
+ * Omitted → a `thread` scope for `context.threadId` (project
372
+ * `context.projectId` or `project-test`, no environment), otherwise a
373
+ * `new-thread` scope for `context.projectId`.
374
+ */
364
375
  scope?: PluginComposerScope;
365
376
  attachmentCount?: number;
366
377
  attachments?: readonly ComposerAttachment[];
@@ -512,6 +523,11 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
512
523
  * no tabs.
513
524
  */
514
525
  experimental_panelTabs?: ExperimentalPanelTabs;
526
+ /**
527
+ * What `experimental_useCommandShortcut(id)` returns, by this plugin's
528
+ * command id. An omitted id → null, as for an unbound command.
529
+ */
530
+ experimental_commandShortcuts?: Readonly<Record<string, ExperimentalShortcutPresentation>>;
515
531
  /**
516
532
  * Initial session target visible to `experimental_useFixedTabTarget`.
517
533
  * Omit `panelId` for a thread fixed tab.
@@ -569,6 +585,8 @@ interface RenderedSlotInspectionState {
569
585
  readonly sdkCalls: SdkCall[];
570
586
  /** Every `experimental_copyToClipboard()` write, in order. */
571
587
  readonly experimental_clipboardWrites: ExperimentalClipboardContent[];
588
+ /** Every `experimental_showErrorToast()` call, in order. */
589
+ readonly experimental_errorToasts: TestErrorToast[];
572
590
  /** Everything written through `useComposer()`. */
573
591
  readonly composer: ComposerLog;
574
592
  }
@@ -143,6 +143,7 @@ interface JsonObject {
143
143
  type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | JsonObject;
144
144
 
145
145
  declare const environmentSchema: z.ZodObject<{
146
+ additionalPaths: z.ZodArray<z.ZodString>;
146
147
  baseBranch: z.ZodNullable<z.ZodString>;
147
148
  branchName: z.ZodNullable<z.ZodString>;
148
149
  createdAt: z.ZodNumber;
@@ -160,7 +161,7 @@ declare const environmentSchema: z.ZodObject<{
160
161
  type: z.ZodLiteral<"new">;
161
162
  }, z.core.$strip>], "type">;
162
163
  }, z.core.$strip>>;
163
- heldBy: z.ZodNullable<z.ZodLiteral<"user">>;
164
+ heldBy: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodTemplateLiteral<`plugin:${string}`>]>>;
164
165
  hostId: z.ZodString;
165
166
  hostLifecycle: z.ZodEnum<{
166
167
  "cleanup-failed": "cleanup-failed";
@@ -248,6 +249,16 @@ declare const hostSchema: z.ZodObject<{
248
249
  full: "full";
249
250
  }>;
250
251
  name: z.ZodString;
252
+ route: z.ZodNullable<z.ZodObject<{
253
+ displayName: z.ZodString;
254
+ kind: z.ZodEnum<{
255
+ "local-network": "local-network";
256
+ "private-overlay": "private-overlay";
257
+ custom: "custom";
258
+ relay: "relay";
259
+ }>;
260
+ providerId: z.ZodString;
261
+ }, z.core.$strip>>;
251
262
  status: z.ZodEnum<{
252
263
  connected: "connected";
253
264
  disconnected: "disconnected";
@@ -352,6 +363,20 @@ interface PluginEnvironmentProviderSteps {
352
363
  * Without a call, core runs setup after create returns.
353
364
  */
354
365
  setup(path: string): Promise<void>;
366
+ /**
367
+ * Hands this operation a ready environment this plugin holds, at once and
368
+ * atomically: the environment becomes the one this create produces, keeps
369
+ * its setup, and takes `resource`, which `remove()` receives if create never
370
+ * returns. The hold is cleared when create returns. Rejects when the
371
+ * environment is not a ready one this plugin holds on the same project and
372
+ * machine; then nothing changed. Setup does not run again unless
373
+ * `setup(path)` is called afterwards with the adopted path, which starts it
374
+ * at once. A `created` result must name its path; any other outcome leaves
375
+ * the environment in error, and its thread fails. If bb restarts before
376
+ * create returns, the environment is removed and the thread is provisioned
377
+ * again.
378
+ */
379
+ adopt(environmentId: string, resource: JsonValue$2): Promise<void>;
355
380
  }
356
381
  interface PluginEnvironmentProviderCreateContext<R extends PluginEnvironmentProviderRequirements$1 = PluginEnvironmentProviderRequirements$1, S extends PluginEnvironmentProviderInputsSchema = PluginEnvironmentProviderInputsSchema> extends PluginEnvironmentProviderValidateContext<R, S>, PluginEnvironmentProviderSteps {
357
382
  environment: PluginEnvironmentProviderEnvironment;
@@ -374,6 +399,14 @@ type PluginEnvironmentProviderCreateResult = {
374
399
  ownsPath: boolean;
375
400
  /** Ref the workspace's changes are compared against. Null clears the value recorded on a reused environment; omit to keep it. */
376
401
  mergeBaseBranch?: string | null;
402
+ /**
403
+ * Experimental: absolute paths of this environment's own extra folders,
404
+ * such as sibling checkouts it created next to `path`. Threads in the
405
+ * environment can read and write them. Core records them with the
406
+ * environment; omit on a reused environment to keep the recorded list.
407
+ * See docs/api_to_audit.md.
408
+ */
409
+ additionalPaths?: string[];
377
410
  resource?: JsonValue$2;
378
411
  } | {
379
412
  status: "failed";
@@ -643,10 +676,20 @@ interface ServerAccessGrant {
643
676
  serverUrl: string;
644
677
  headers?: Record<string, string>;
645
678
  }
679
+ type ServerAccessRouteKind = "custom" | "local-network" | "private-overlay" | "relay";
646
680
  interface ServerAccessProviderDeclaration {
647
681
  id: string;
648
682
  displayName: string;
649
683
  description: string;
684
+ /**
685
+ * How machines and apps travel to this server over the provider's address.
686
+ * Core ranks enabled routes by kind (local network, private overlay such as
687
+ * a tailnet, relay, then custom) until the user orders them in Settings.
688
+ * New machines install on a `"relay"` or `"custom"` route before a
689
+ * `"local-network"` or `"private-overlay"` one. Plugins built against an SDK
690
+ * before 0.6.188 may omit it; core treats those as `"custom"`.
691
+ */
692
+ routeKind: ServerAccessRouteKind;
650
693
  availability(): (PluginMachineProviderAvailability & {
651
694
  serverUrl?: string;
652
695
  }) | Promise<PluginMachineProviderAvailability & {
@@ -1695,9 +1738,10 @@ interface ExperimentalActionContextFixture extends ExperimentalPluginActionConte
1695
1738
  * A complete callback context for tests that call a command, thread action,
1696
1739
  * message action or composer callback directly, so a test lists only the
1697
1740
  * members it uses and keeps compiling when bb adds one. Defaults record each
1698
- * call in `calls`: `threadRequests` methods resolve, `composer` is null, `navigate`
1699
- * methods return false, `panel` is {@link makePanelController}'s, and `sdk`
1700
- * methods reject because a test that reads data should stub it. Spread the
1741
+ * call in `calls`: `threadRequests` methods resolve, `composer` is null,
1742
+ * `navigate` methods return false except the href builders, which return
1743
+ * `/threads/<id>` and settings paths, `panel` is
1744
+ * {@link makePanelController}'s, and `sdk` methods reject because a test that reads data should stub it. Spread the
1701
1745
  * result and add a context's own fields, such as a command's `threadId` or a
1702
1746
  * thread action's `thread`.
1703
1747
  */