@get-bb/plugin-sdk 0.4.101 → 0.4.104

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.
@@ -3025,6 +3025,7 @@ declare const threadEventSchema: z$1.ZodPipe<z$1.ZodUnknown, z$1.ZodUnion<readon
3025
3025
  "child-outcome-batch": "child-outcome-batch";
3026
3026
  "ownership-assigned": "ownership-assigned";
3027
3027
  "ownership-removed": "ownership-removed";
3028
+ "tool-result-delivered": "tool-result-delivered";
3028
3029
  unlabeled: "unlabeled";
3029
3030
  }>>;
3030
3031
  systemMessageSubject: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -3034,6 +3035,10 @@ declare const threadEventSchema: z$1.ZodPipe<z$1.ZodUnknown, z$1.ZodUnion<readon
3034
3035
  }, z$1.core.$strip>, z$1.ZodObject<{
3035
3036
  count: z$1.ZodNumber;
3036
3037
  kind: z$1.ZodLiteral<"thread-batch">;
3038
+ }, z$1.core.$strip>, z$1.ZodObject<{
3039
+ kind: z$1.ZodLiteral<"tool-call">;
3040
+ suppress: z$1.ZodBoolean;
3041
+ toolName: z$1.ZodString;
3037
3042
  }, z$1.core.$strip>], "kind">>>;
3038
3043
  target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
3039
3044
  kind: z$1.ZodLiteral<"thread-start">;
@@ -3287,9 +3292,39 @@ declare const threadEventSchema: z$1.ZodPipe<z$1.ZodUnknown, z$1.ZodUnion<readon
3287
3292
  }, z$1.core.$strip>;
3288
3293
  payload: z$1.ZodObject<{
3289
3294
  kind: z$1.ZodLiteral<"plugin">;
3295
+ presentation: z$1.ZodOptional<z$1.ZodObject<{
3296
+ badge: z$1.ZodOptional<z$1.ZodObject<{
3297
+ glyph: z$1.ZodString;
3298
+ hint: z$1.ZodString;
3299
+ label: z$1.ZodString;
3300
+ tone: z$1.ZodEnum<{
3301
+ destructive: "destructive";
3302
+ neutral: "neutral";
3303
+ }>;
3304
+ }, z$1.core.$strip>>;
3305
+ detail: z$1.ZodOptional<z$1.ZodString>;
3306
+ icon: z$1.ZodObject<{
3307
+ glyph: z$1.ZodString;
3308
+ }, z$1.core.$strip>;
3309
+ label: z$1.ZodObject<{
3310
+ completed: z$1.ZodString;
3311
+ pending: z$1.ZodString;
3312
+ }, z$1.core.$strip>;
3313
+ suppress: z$1.ZodOptional<z$1.ZodBoolean>;
3314
+ tint: z$1.ZodOptional<z$1.ZodObject<{
3315
+ dark: z$1.ZodString;
3316
+ light: z$1.ZodString;
3317
+ }, z$1.core.$strip>>;
3318
+ title: z$1.ZodOptional<z$1.ZodString>;
3319
+ }, z$1.core.$strip>>;
3290
3320
  title: z$1.ZodString;
3291
3321
  }, z$1.core.$strip>;
3292
3322
  resolution: z$1.ZodNullable<z$1.ZodObject<{
3323
+ description: z$1.ZodOptional<z$1.ZodObject<{
3324
+ detail: z$1.ZodOptional<z$1.ZodString>;
3325
+ payload: z$1.ZodOptional<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
3326
+ title: z$1.ZodOptional<z$1.ZodString>;
3327
+ }, z$1.core.$strip>>;
3293
3328
  kind: z$1.ZodLiteral<"plugin_submitted">;
3294
3329
  }, z$1.core.$strip>>;
3295
3330
  status: z$1.ZodEnum<{
@@ -3492,6 +3527,11 @@ declare const pendingInteractionResolutionSchema: z$1.ZodUnion<readonly [z$1.Zod
3492
3527
  }, z$1.core.$strip>>;
3493
3528
  kind: z$1.ZodLiteral<"user_answer">;
3494
3529
  }, z$1.core.$strip>, z$1.ZodObject<{
3530
+ description: z$1.ZodOptional<z$1.ZodObject<{
3531
+ detail: z$1.ZodOptional<z$1.ZodString>;
3532
+ payload: z$1.ZodOptional<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
3533
+ title: z$1.ZodOptional<z$1.ZodString>;
3534
+ }, z$1.core.$strip>>;
3495
3535
  kind: z$1.ZodLiteral<"plugin_submitted">;
3496
3536
  }, z$1.core.$strip>, z$1.ZodObject<{
3497
3537
  kind: z$1.ZodLiteral<"request_answer">;
@@ -3739,9 +3779,39 @@ declare const pluginPendingInteractionSchema: z$1.ZodObject<{
3739
3779
  payload: z$1.ZodObject<{
3740
3780
  data: z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>;
3741
3781
  kind: z$1.ZodLiteral<"plugin">;
3782
+ presentation: z$1.ZodOptional<z$1.ZodObject<{
3783
+ badge: z$1.ZodOptional<z$1.ZodObject<{
3784
+ glyph: z$1.ZodString;
3785
+ hint: z$1.ZodString;
3786
+ label: z$1.ZodString;
3787
+ tone: z$1.ZodEnum<{
3788
+ destructive: "destructive";
3789
+ neutral: "neutral";
3790
+ }>;
3791
+ }, z$1.core.$strip>>;
3792
+ detail: z$1.ZodOptional<z$1.ZodString>;
3793
+ icon: z$1.ZodObject<{
3794
+ glyph: z$1.ZodString;
3795
+ }, z$1.core.$strip>;
3796
+ label: z$1.ZodObject<{
3797
+ completed: z$1.ZodString;
3798
+ pending: z$1.ZodString;
3799
+ }, z$1.core.$strip>;
3800
+ suppress: z$1.ZodOptional<z$1.ZodBoolean>;
3801
+ tint: z$1.ZodOptional<z$1.ZodObject<{
3802
+ dark: z$1.ZodString;
3803
+ light: z$1.ZodString;
3804
+ }, z$1.core.$strip>>;
3805
+ title: z$1.ZodOptional<z$1.ZodString>;
3806
+ }, z$1.core.$strip>>;
3742
3807
  title: z$1.ZodString;
3743
3808
  }, z$1.core.$strip>;
3744
3809
  resolution: z$1.ZodNullable<z$1.ZodObject<{
3810
+ description: z$1.ZodOptional<z$1.ZodObject<{
3811
+ detail: z$1.ZodOptional<z$1.ZodString>;
3812
+ payload: z$1.ZodOptional<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
3813
+ title: z$1.ZodOptional<z$1.ZodString>;
3814
+ }, z$1.core.$strip>>;
3745
3815
  kind: z$1.ZodLiteral<"plugin_submitted">;
3746
3816
  }, z$1.core.$strip>>;
3747
3817
  resolvedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -5828,6 +5898,7 @@ declare const hostDaemonCommandRegistry: {
5828
5898
  chromium: "chromium";
5829
5899
  edge: "edge";
5830
5900
  firefox: "firefox";
5901
+ helium: "helium";
5831
5902
  opera: "opera";
5832
5903
  safari: "safari";
5833
5904
  vivaldi: "vivaldi";
@@ -5864,6 +5935,7 @@ declare const hostDaemonCommandRegistry: {
5864
5935
  chromium: "chromium";
5865
5936
  edge: "edge";
5866
5937
  firefox: "firefox";
5938
+ helium: "helium";
5867
5939
  opera: "opera";
5868
5940
  safari: "safari";
5869
5941
  vivaldi: "vivaldi";
@@ -7076,6 +7148,11 @@ declare const hostDaemonCommandRegistry: {
7076
7148
  }, z$1.core.$strip>>;
7077
7149
  kind: z$1.ZodLiteral<"user_answer">;
7078
7150
  }, z$1.core.$strip>, z$1.ZodObject<{
7151
+ description: z$1.ZodOptional<z$1.ZodObject<{
7152
+ detail: z$1.ZodOptional<z$1.ZodString>;
7153
+ payload: z$1.ZodOptional<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
7154
+ title: z$1.ZodOptional<z$1.ZodString>;
7155
+ }, z$1.core.$strip>>;
7079
7156
  kind: z$1.ZodLiteral<"plugin_submitted">;
7080
7157
  }, z$1.core.$strip>, z$1.ZodObject<{
7081
7158
  kind: z$1.ZodLiteral<"request_answer">;
@@ -8706,6 +8783,7 @@ declare const desktopBrowserCommandSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObj
8706
8783
  chromium: "chromium";
8707
8784
  edge: "edge";
8708
8785
  firefox: "firefox";
8786
+ helium: "helium";
8709
8787
  opera: "opera";
8710
8788
  safari: "safari";
8711
8789
  vivaldi: "vivaldi";
@@ -8803,6 +8881,7 @@ declare const desktopBrowserResultSchemas: {
8803
8881
  chromium: "chromium";
8804
8882
  edge: "edge";
8805
8883
  firefox: "firefox";
8884
+ helium: "helium";
8806
8885
  opera: "opera";
8807
8886
  safari: "safari";
8808
8887
  vivaldi: "vivaldi";
@@ -10438,7 +10517,23 @@ declare const terminalOutputResponseSchema: z$1.ZodObject<{
10438
10517
  dataBase64: z$1.ZodString;
10439
10518
  seq: z$1.ZodNumber;
10440
10519
  }, z$1.core.$strict>>;
10520
+ closeReason: z$1.ZodNullable<z$1.ZodEnum<{
10521
+ "daemon-disconnect": "daemon-disconnect";
10522
+ "environment-destroyed": "environment-destroyed";
10523
+ "open-timeout": "open-timeout";
10524
+ "process-exit": "process-exit";
10525
+ "thread-archived": "thread-archived";
10526
+ "thread-deleted": "thread-deleted";
10527
+ user: "user";
10528
+ }>>;
10529
+ exitCode: z$1.ZodNullable<z$1.ZodNumber>;
10441
10530
  nextSeq: z$1.ZodNumber;
10531
+ status: z$1.ZodEnum<{
10532
+ disconnected: "disconnected";
10533
+ exited: "exited";
10534
+ running: "running";
10535
+ starting: "starting";
10536
+ }>;
10442
10537
  truncated: z$1.ZodBoolean;
10443
10538
  }, z$1.core.$strict>;
10444
10539
  type TerminalOutputResponse = z$1.infer<typeof terminalOutputResponseSchema>;
@@ -10544,6 +10639,7 @@ declare const timelineConversationRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodO
10544
10639
  "child-outcome-batch": "child-outcome-batch";
10545
10640
  "ownership-assigned": "ownership-assigned";
10546
10641
  "ownership-removed": "ownership-removed";
10642
+ "tool-result-delivered": "tool-result-delivered";
10547
10643
  unlabeled: "unlabeled";
10548
10644
  }>;
10549
10645
  systemMessageSubject: z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -10553,6 +10649,10 @@ declare const timelineConversationRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodO
10553
10649
  }, z$1.core.$strip>, z$1.ZodObject<{
10554
10650
  count: z$1.ZodNumber;
10555
10651
  kind: z$1.ZodLiteral<"thread-batch">;
10652
+ }, z$1.core.$strip>, z$1.ZodObject<{
10653
+ kind: z$1.ZodLiteral<"tool-call">;
10654
+ suppress: z$1.ZodBoolean;
10655
+ toolName: z$1.ZodString;
10556
10656
  }, z$1.core.$strip>], "kind">>;
10557
10657
  text: z$1.ZodString;
10558
10658
  threadId: z$1.ZodString;
@@ -11335,6 +11435,60 @@ declare const timelineApprovalWorkRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodO
11335
11435
  workKind: z$1.ZodLiteral<"approval">;
11336
11436
  }, z$1.core.$strip>], "approvalKind">;
11337
11437
  type TimelineApprovalWorkRow = z$1.infer<typeof timelineApprovalWorkRowSchema>;
11438
+ declare const timelineFormWorkRowSchema: z$1.ZodObject<{
11439
+ createdAt: z$1.ZodNumber;
11440
+ id: z$1.ZodString;
11441
+ interactionId: z$1.ZodString;
11442
+ kind: z$1.ZodLiteral<"work">;
11443
+ lifecycle: z$1.ZodEnum<{
11444
+ cancelled: "cancelled";
11445
+ pending: "pending";
11446
+ submitted: "submitted";
11447
+ }>;
11448
+ payload: z$1.ZodNullable<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
11449
+ pluginId: z$1.ZodString;
11450
+ presentation: z$1.ZodObject<{
11451
+ badge: z$1.ZodOptional<z$1.ZodObject<{
11452
+ glyph: z$1.ZodString;
11453
+ hint: z$1.ZodString;
11454
+ label: z$1.ZodString;
11455
+ tone: z$1.ZodEnum<{
11456
+ destructive: "destructive";
11457
+ neutral: "neutral";
11458
+ }>;
11459
+ }, z$1.core.$strip>>;
11460
+ detail: z$1.ZodOptional<z$1.ZodString>;
11461
+ icon: z$1.ZodObject<{
11462
+ glyph: z$1.ZodString;
11463
+ }, z$1.core.$strip>;
11464
+ label: z$1.ZodObject<{
11465
+ completed: z$1.ZodString;
11466
+ pending: z$1.ZodString;
11467
+ }, z$1.core.$strip>;
11468
+ suppress: z$1.ZodOptional<z$1.ZodBoolean>;
11469
+ tint: z$1.ZodOptional<z$1.ZodObject<{
11470
+ dark: z$1.ZodString;
11471
+ light: z$1.ZodString;
11472
+ }, z$1.core.$strip>>;
11473
+ title: z$1.ZodOptional<z$1.ZodString>;
11474
+ }, z$1.core.$strip>;
11475
+ rendererId: z$1.ZodString;
11476
+ sourceSeqEnd: z$1.ZodNumber;
11477
+ sourceSeqStart: z$1.ZodNumber;
11478
+ startedAt: z$1.ZodNumber;
11479
+ status: z$1.ZodEnum<{
11480
+ completed: "completed";
11481
+ error: "error";
11482
+ interrupted: "interrupted";
11483
+ pending: "pending";
11484
+ }>;
11485
+ statusReason: z$1.ZodNullable<z$1.ZodString>;
11486
+ threadId: z$1.ZodString;
11487
+ title: z$1.ZodString;
11488
+ turnId: z$1.ZodNullable<z$1.ZodString>;
11489
+ workKind: z$1.ZodLiteral<"form">;
11490
+ }, z$1.core.$strip>;
11491
+ type TimelineFormWorkRow = z$1.infer<typeof timelineFormWorkRowSchema>;
11338
11492
  declare const timelineQuestionWorkRowSchema: z$1.ZodObject<{
11339
11493
  answers: z$1.ZodNullable<z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
11340
11494
  freeText: z$1.ZodOptional<z$1.ZodString>;
@@ -11491,7 +11645,7 @@ declare const timelineWorkflowWorkRowSchema: z$1.ZodObject<{
11491
11645
  workflowName: z$1.ZodNullable<z$1.ZodString>;
11492
11646
  }, z$1.core.$strip>;
11493
11647
  type TimelineWorkflowWorkRow = z$1.infer<typeof timelineWorkflowWorkRowSchema>;
11494
- type TimelineWorkRow = TimelineCommandWorkRow | TimelineToolWorkRow | TimelineFileChangeWorkRow | TimelineWebSearchWorkRow | TimelineWebFetchWorkRow | TimelineImageGenerationWorkRow | TimelineImageViewWorkRow | TimelineFileReadWorkRow | TimelineSearchWorkRow | TimelinePlanStepsWorkRow | TimelineExtensionWorkRow | TimelineApprovalWorkRow | TimelineQuestionWorkRow | TimelineDelegationWorkRow | TimelineWorkflowWorkRow;
11648
+ type TimelineWorkRow = TimelineCommandWorkRow | TimelineToolWorkRow | TimelineFileChangeWorkRow | TimelineWebSearchWorkRow | TimelineWebFetchWorkRow | TimelineImageGenerationWorkRow | TimelineImageViewWorkRow | TimelineFileReadWorkRow | TimelineSearchWorkRow | TimelinePlanStepsWorkRow | TimelineExtensionWorkRow | TimelineApprovalWorkRow | TimelineQuestionWorkRow | TimelineFormWorkRow | TimelineDelegationWorkRow | TimelineWorkflowWorkRow;
11495
11649
  interface TimelineTurnRow extends TimelineRowBase {
11496
11650
  kind: "turn";
11497
11651
  turnId: string;
@@ -13556,9 +13710,39 @@ declare const threadPendingInteractionsResponseSchema: z$1.ZodArray<z$1.ZodUnion
13556
13710
  payload: z$1.ZodObject<{
13557
13711
  data: z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>;
13558
13712
  kind: z$1.ZodLiteral<"plugin">;
13713
+ presentation: z$1.ZodOptional<z$1.ZodObject<{
13714
+ badge: z$1.ZodOptional<z$1.ZodObject<{
13715
+ glyph: z$1.ZodString;
13716
+ hint: z$1.ZodString;
13717
+ label: z$1.ZodString;
13718
+ tone: z$1.ZodEnum<{
13719
+ destructive: "destructive";
13720
+ neutral: "neutral";
13721
+ }>;
13722
+ }, z$1.core.$strip>>;
13723
+ detail: z$1.ZodOptional<z$1.ZodString>;
13724
+ icon: z$1.ZodObject<{
13725
+ glyph: z$1.ZodString;
13726
+ }, z$1.core.$strip>;
13727
+ label: z$1.ZodObject<{
13728
+ completed: z$1.ZodString;
13729
+ pending: z$1.ZodString;
13730
+ }, z$1.core.$strip>;
13731
+ suppress: z$1.ZodOptional<z$1.ZodBoolean>;
13732
+ tint: z$1.ZodOptional<z$1.ZodObject<{
13733
+ dark: z$1.ZodString;
13734
+ light: z$1.ZodString;
13735
+ }, z$1.core.$strip>>;
13736
+ title: z$1.ZodOptional<z$1.ZodString>;
13737
+ }, z$1.core.$strip>>;
13559
13738
  title: z$1.ZodString;
13560
13739
  }, z$1.core.$strip>;
13561
13740
  resolution: z$1.ZodNullable<z$1.ZodObject<{
13741
+ description: z$1.ZodOptional<z$1.ZodObject<{
13742
+ detail: z$1.ZodOptional<z$1.ZodString>;
13743
+ payload: z$1.ZodOptional<z$1.ZodType<JsonValue$1, unknown, z$1.core.$ZodTypeInternals<JsonValue$1, unknown>>>;
13744
+ title: z$1.ZodOptional<z$1.ZodString>;
13745
+ }, z$1.core.$strip>>;
13562
13746
  kind: z$1.ZodLiteral<"plugin_submitted">;
13563
13747
  }, z$1.core.$strip>>;
13564
13748
  resolvedAt: z$1.ZodNullable<z$1.ZodNumber>;
@@ -14336,6 +14520,7 @@ declare const desktopBrowserImportCookiesRequestSchema: z$1.ZodObject<{
14336
14520
  chromium: "chromium";
14337
14521
  edge: "edge";
14338
14522
  firefox: "firefox";
14523
+ helium: "helium";
14339
14524
  opera: "opera";
14340
14525
  safari: "safari";
14341
14526
  vivaldi: "vivaldi";
@@ -16191,10 +16376,6 @@ interface PluginCommandRegistration {
16191
16376
  */
16192
16377
  run(context: PluginCommandContext): void | Promise<void>;
16193
16378
  }
16194
- /** @deprecated Use PluginCommandContext. */
16195
- type PluginCommandPaletteActionContext = PluginCommandContext;
16196
- /** @deprecated Use PluginCommandRegistration. */
16197
- type PluginCommandPaletteActionRegistration = PluginCommandRegistration;
16198
16379
  /** Registers commands for bb's command palette. */
16199
16380
  interface PluginAppCommands {
16200
16381
  /** Register a command. IDs are unique within this plugin, including legacy slot registrations. */
@@ -16832,6 +17013,82 @@ interface PluginComposerApi {
16832
17013
  * Experimental: see docs/api_to_audit.md.
16833
17014
  */
16834
17015
  experimental_submit(options: ExperimentalComposerSubmitOptions): Promise<void>;
17016
+ /**
17017
+ * Set this composer's pickers as if each value had been picked by hand.
17018
+ *
17019
+ * Every field is optional. An omitted field is left alone. A field this
17020
+ * composer has no picker for is ignored rather than rejected: a thread
17021
+ * composer has no project or environment; a provider without service tiers
17022
+ * has no tier; a fork draft locks its project, provider and environment.
17023
+ * Values travel through the same paths the pickers use, so in the
17024
+ * new-thread composer they become the remembered defaults for the next
17025
+ * thread and are reported as the user's explicit choices, and in a thread
17026
+ * composer a provider change starts the same handoff the picker starts:
17027
+ * the handoff block is prepended to the draft and the next send creates a
17028
+ * new thread. A same-provider model change in a thread does not start a
17029
+ * handoff, exactly like the picker.
17030
+ *
17031
+ * In the new-thread composer the project is switched first and awaited
17032
+ * (attachments are copied to the new project), then the environment and
17033
+ * machine are applied to the new project, then provider, model, reasoning
17034
+ * level, service tier and permission mode. A provider change reloads the
17035
+ * model catalog before the model and reasoning level are applied to it.
17036
+ * Because the project switch remounts plugin surfaces, the returned
17037
+ * promise is owned by the composer and still resolves after the calling
17038
+ * component has unmounted.
17039
+ *
17040
+ * Resolves with the composer's own selection once it has settled: the
17041
+ * applied values have committed and the model catalog for the selected
17042
+ * provider and machine has finished loading, so model, reasoning level and
17043
+ * permission mode have reconciled against it. The catalog wait is bounded;
17044
+ * if it has not finished after 15 seconds the promise resolves with the
17045
+ * selection as it stands. The result carries only the fields this composer
17046
+ * has, so a missing key means "no such picker here" and a value that
17047
+ * differs from the one passed was reconciled (a reasoning level the model
17048
+ * does not support, a permission mode above the machine's ceiling, a model
17049
+ * the provider does not list). A provider the composer does not list is
17050
+ * ignored together with the model and reasoning level meant for it, so the
17051
+ * stored provider preference never names something the picker could not
17052
+ * have chosen. `environment` is absent while the composer
17053
+ * has no submittable environment; `providerId` and `model` are absent
17054
+ * while nothing is selected; `serviceTier` is present only when the
17055
+ * selected provider has tiers and one is chosen.
17056
+ *
17057
+ * Rejects, with a message safe to show to the user, in a composer with no
17058
+ * pickers at all (a queued-message editor, a side chat, a plugin surface
17059
+ * mounted outside any composer), when the calling surface is no longer
17060
+ * active, and when a value is not a known reasoning level, service tier or
17061
+ * permission mode.
17062
+ *
17063
+ * Experimental: see docs/api_to_audit.md.
17064
+ */
17065
+ experimental_setSelection(selection: ExperimentalComposerSelection): Promise<ExperimentalComposerSelection>;
17066
+ }
17067
+ /**
17068
+ * Picker values for `experimental_setSelection`, and the shape it resolves
17069
+ * with. Field names match `NewThreadRequest` and the `default*` props of
17070
+ * `experimental_NewThreadComposer`, so one routed decision can feed the
17071
+ * composer, the embedded composer and `bb.sdk.threads.spawn` alike.
17072
+ */
17073
+ interface ExperimentalComposerSelection {
17074
+ /** New-thread composers only. BB's personal-project id means "Don't work in a project". */
17075
+ projectId?: string;
17076
+ /**
17077
+ * New-thread composers only. `{ type: "project-default" }` and a `host`
17078
+ * environment without a `hostId` seed nothing and are ignored. Provider
17079
+ * `inputs` are not applied; the provider's own inputs control keeps its
17080
+ * value, and the result reports what the composer would submit.
17081
+ */
17082
+ environment?: CreateThreadEnvironmentArgs;
17083
+ /** A provider the composer does not list is ignored, and `model` and `reasoningLevel` with it. */
17084
+ providerId?: string;
17085
+ /** Applied only when the composer ends up on the requested provider (or none was requested). */
17086
+ model?: string;
17087
+ /** Applied only when the composer ends up on the requested provider (or none was requested). */
17088
+ reasoningLevel?: ReasoningLevel;
17089
+ /** Ignored by a provider with no service tiers. */
17090
+ serviceTier?: ServiceTier;
17091
+ permissionMode?: PermissionMode;
16835
17092
  }
16836
17093
  /**
16837
17094
  * What `experimental_submit` does differently from pressing Enter.
@@ -20046,6 +20303,23 @@ type PluginInteractionResult = {
20046
20303
  outcome: "cancelled";
20047
20304
  reason: PluginInteractionCancelReason;
20048
20305
  };
20306
+ /**
20307
+ * What a submitted form leaves in the thread timeline, chosen by the plugin.
20308
+ * bb never stores the form's payload or the submitted value; it stores only
20309
+ * this description, so a plugin decides what the transcript keeps.
20310
+ */
20311
+ interface PluginInteractionDescription {
20312
+ /** Row title once submitted; defaults to the presentation's completed label. */
20313
+ title?: string;
20314
+ /** Short Markdown for the expanded row. */
20315
+ detail?: string;
20316
+ /**
20317
+ * Persisted with the row and handed to this plugin's
20318
+ * `experimental_timelineRenderer` registered for `"<pluginId>/<rendererId>"`.
20319
+ * Omit anything the transcript must not keep.
20320
+ */
20321
+ payload?: JsonValue;
20322
+ }
20049
20323
  interface PluginInteractionRequest {
20050
20324
  threadId: string;
20051
20325
  rendererId: string;
@@ -20053,6 +20327,19 @@ interface PluginInteractionRequest {
20053
20327
  payload: JsonValue;
20054
20328
  /** Defaults to ten minutes; capped at one hour. */
20055
20329
  timeoutMs?: number;
20330
+ /**
20331
+ * How the form reads as a timeline row while it waits and once it settles,
20332
+ * in the same shape as a native tool's presentation. bb fills what is left
20333
+ * out: "Waiting for <title>" / "Submitted <title>" and the plugin's glyph.
20334
+ */
20335
+ presentation?: PluginRowPresentation;
20336
+ /**
20337
+ * Called once with the submitted value, before the waiting `requestInput`
20338
+ * promise resolves; never for a cancellation, which bb titles itself. Its
20339
+ * return is persisted on the row. A throw or a slow return leaves the row
20340
+ * with its completed label and nothing more.
20341
+ */
20342
+ describeSubmission?(value: JsonValue): PluginInteractionDescription | Promise<PluginInteractionDescription>;
20056
20343
  }
20057
20344
  interface PluginCliResult {
20058
20345
  exitCode: number;
@@ -20088,6 +20375,15 @@ interface PluginCliRegistration {
20088
20375
  /** Subcommand metadata rendered in help and the plugin-commands skill
20089
20376
  * without executing plugin code. Parsing argv is plugin-owned. */
20090
20377
  commands?: PluginCliCommandInfo[];
20378
+ /**
20379
+ * Set when `run` answers `--help` / `-h` itself, at every level, without
20380
+ * executing a command. The `bb` CLI then forwards help requests to the
20381
+ * plugin instead of printing the one-line `usage` from `commands`.
20382
+ * `defineCli` sets it. Leave it unset for a hand-written `run`:
20383
+ * the host cannot know that such a parser will not act on the other
20384
+ * arguments.
20385
+ */
20386
+ rendersHelp?: boolean;
20091
20387
  run(argv: string[], ctx: PluginCliContext): PluginCliResult | Promise<PluginCliResult>;
20092
20388
  }
20093
20389
  interface PluginCli {
@@ -20116,30 +20412,37 @@ type PluginAgentToolResult = string | {
20116
20412
  interface PluginAgentToolContext {
20117
20413
  threadId: string;
20118
20414
  projectId: string;
20119
- /** The tool-call request's abort signal (aborts if the daemon round-trip
20120
- * is torn down mid-call). */
20415
+ /**
20416
+ * Aborts when the tool-call request is cancelled, the thread is stopped or
20417
+ * deleted, or this plugin is disposed. Opening a form with `bb.ui.requestInput`
20418
+ * detaches the call from its request: the agent receives a waiting notice,
20419
+ * and request cancellation no longer aborts this signal. The tool's eventual
20420
+ * result is delivered as a system message (success steers a running turn or
20421
+ * starts a new one; an `isError` result only steers). Thread stop/delete and
20422
+ * plugin disposal still abort the signal after detachment.
20423
+ */
20121
20424
  signal: AbortSignal;
20122
20425
  }
20123
20426
  /**
20124
- * The row title of a plugin tool call while it is pending and once it
20427
+ * The title of a plugin-owned timeline row while it is pending and once it
20125
20428
  * settled. Each label is capped at 80 characters and rendered as plain text.
20126
20429
  */
20127
- interface PluginAgentToolLabels {
20128
- /** Label shown while the tool call is pending. */
20430
+ interface PluginRowLabels {
20431
+ /** Label shown while the row is pending. */
20129
20432
  pending: string;
20130
- /** Label shown after the tool call completes successfully. */
20433
+ /** Label shown after the row completes successfully. */
20131
20434
  completed: string;
20132
20435
  }
20133
20436
  /**
20134
- * How calls to a native plugin tool read as a timeline row (grammar v3). Every
20135
- * field is optional at registration: the server fills what the plugin leaves
20136
- * out (a generic `Running <name>` / `Ran <name>` label; the plugin's branding
20137
- * glyph, then `Toolbox`) and hands one complete presentation to the provider
20138
- * bridge with the tool definition.
20437
+ * How something a plugin owns reads as a timeline row (grammar v3): a native
20438
+ * tool's calls, or the row a `bb.ui.requestInput` form leaves behind. Every
20439
+ * field is optional: the server fills what the plugin leaves out (a generic
20440
+ * label; the plugin's branding glyph, then `Toolbox`) and hands one complete
20441
+ * presentation to whatever renders the row.
20139
20442
  */
20140
- interface PluginAgentToolPresentation {
20141
- /** Row title while the call is pending and once it settled. */
20142
- label?: PluginAgentToolLabels;
20443
+ interface PluginRowPresentation {
20444
+ /** Row title while the row is pending and once it settled. */
20445
+ label?: PluginRowLabels;
20143
20446
  /**
20144
20447
  * A named host glyph (`{ glyph: "Workflow" }`), or one of this plugin's
20145
20448
  * own declared icons by its namespaced glyph (`{ glyph: "<pluginId>/<name>" }`,
@@ -20177,7 +20480,7 @@ interface PluginAgentToolRegistrationBase {
20177
20480
  * plugin's branding glyph. Approval, error, and interruption states keep
20178
20481
  * BB's standard rendering. See docs/api_to_audit.md.
20179
20482
  */
20180
- presentation?: PluginAgentToolPresentation;
20483
+ presentation?: PluginRowPresentation;
20181
20484
  }
20182
20485
  /** Stable, plain-data context resolved by the server for one agent session. */
20183
20486
  interface PluginAgentConfigurationContext {
@@ -20785,7 +21088,14 @@ interface PluginMentionProviderRegistration {
20785
21088
  }>;
20786
21089
  }
20787
21090
  interface PluginUi {
20788
- /** Block until the app submits or cancels a plugin-owned composer form. */
21091
+ /**
21092
+ * Block until the user submits or cancels this plugin's form in the
21093
+ * thread composer. Inside a native tool's `execute`, calling this answers
21094
+ * the tool call at once with a waiting notice and the eventual return value
21095
+ * reaches the agent as a message; see {@link PluginAgentToolContext.signal}.
21096
+ * The form leaves a timeline row described by `presentation` and
21097
+ * `describeSubmission`.
21098
+ */
20789
21099
  requestInput(request: PluginInteractionRequest, options?: {
20790
21100
  signal?: AbortSignal;
20791
21101
  }): Promise<PluginInteractionResult>;
@@ -21005,5 +21315,237 @@ interface BbPluginApi {
21005
21315
  onDispose(hook: () => void | Promise<void>): void;
21006
21316
  }
21007
21317
 
21008
- export { PLUGIN_CLI_OUTPUT_MAX_BYTES, defineRpcContract, experimental_defineHostEntry };
21009
- export type { BbContext, BbNavigate, BbPluginApi, BranchPickerProps, BranchesState, CheckoutState, CodeOverflowMode, ComposerCustomization, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerStructuredDraft, ComposerView, DiffProps, DiffViewMode, ExperimentalAppIcons, ExperimentalAppOverlayProps, ExperimentalAppOverlayRegistration, ExperimentalAppPanel, ExperimentalAppPanelSurface, ExperimentalComposerSubmitOptions, ExperimentalDesktopBrowserAcquireInput, ExperimentalDesktopBrowserCreateInput, ExperimentalDesktopBrowserLease, ExperimentalDesktopBrowserScope, ExperimentalDesktopBrowsersArea, ExperimentalDiffFileContent, ExperimentalDiffFullFileContents, ExperimentalFileLinkProps, ExperimentalFileLocation, ExperimentalFileOpenOptions, ExperimentalFixedTabTargetContract, ExperimentalFixedTabTargetState, ExperimentalHostCallOptions, ExperimentalHostClient, ExperimentalHostEntry, ExperimentalHostPaths, ExperimentalHostRpcContext, ExperimentalHostRpcHandlers, ExperimentalHostSignalContract, ExperimentalHostSignalEvent, ExperimentalHostSignals, ExperimentalHostWatchChange, ExperimentalHostWatchChangeType, ExperimentalHostWatchEvent, ExperimentalHostWatchListener, ExperimentalHostWatchOptions, ExperimentalHostWatchSubscription, ExperimentalHostWorkerLease, ExperimentalIconProps, ExperimentalIconRegistration, ExperimentalLiveFileTarget, ExperimentalOpenFixedTabOptions, ExperimentalPermissionModePickerProps, ExperimentalPluginBrowserPage, ExperimentalPluginBrowserPageEvaluateOptions, ExperimentalPluginBrowserPageWorld, ExperimentalPluginBrowserToolbarActionProps, ExperimentalPluginBrowserToolbarActionRegistration, ExperimentalPluginFixedTabReference, ExperimentalPluginMentionImage, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealth, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginWebSocket, ExperimentalPluginWebSocketContext, ExperimentalPluginWebSocketHandler, ExperimentalPluginWebSocketHandlers, ExperimentalProviderIconProps, ExperimentalProviderModelPickerProps, ExperimentalProviderModelPickerRouting, ExperimentalProviderModelPickerValue, ExperimentalSidebarFooter, ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterActionRegistration, ExperimentalSidebarFooterDisclosureController, ExperimentalSidebarFooterDisclosureProps, ExperimentalSidebarFooterDisclosureRegistration, ExperimentalSidebarFooterItemBase, ExperimentalSidebarFooterItemRegistration, ExperimentalSidebarNavigationAction, ExperimentalSidebarNavigationActivationOptions, ExperimentalSidebarNavigationIcon, ExperimentalSidebarNavigationItem, ExperimentalSidebarNavigationProps, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationShortcut, JsonValue, MachineBootstrapApi, MachineBootstrapRequest, MachineExecutor, MachineExecutorRequest, MarkdownProps, MessageDispatchHookContext, MessageDispatchHookDecision, NewThreadComposerProps, NewThreadRequest, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolLabels, PluginAgentToolPresentation, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgentToolSelection, PluginAgents, PluginAiServiceDeclaration, PluginAiServiceKind, PluginAiServices, PluginAppBuilder, PluginAppCommands, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginBbSdk, PluginCli, PluginCliCommandInfo, PluginCliContext, PluginCliExecutionResult, PluginCliOutputLimitError, PluginCliRegistration, PluginCliResult, PluginCodeThemeData, PluginCodeThemeState, PluginCodeThemeTokenRule, PluginCommandContext, PluginCommandPaletteActionContext, PluginCommandPaletteActionRegistration, PluginCommandRegistration, PluginCommandShortcut, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginComposerTextEffect, PluginComposerThreadRowStatus, PluginContentScriptContext, PluginContentScriptDisposer, PluginContentScriptRegistration, PluginDiffRendererProps, PluginDiffRendererRegistration, PluginDispatchAttemptKind, PluginDispatchEnvironmentIntent, PluginDispatchExecution, PluginDispatchExecutionSources, PluginDispatchInput, PluginEnvironmentProviderDeclaration, PluginEnvironmentProviderInputsChange, PluginEnvironmentProviderInputsProps, PluginEnvironmentProviderInputsRegistration, PluginEnvironmentProviderRequirements, PluginEnvironmentValidateDecision, PluginEnvironments, PluginEvents, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginFixedTabDeclaration, PluginFixedTabRegistration, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginHookHandler, PluginHookName, PluginHookSignatures, PluginHooks, PluginHosts, PluginHttp, PluginHttpAuthMode, PluginHttpHandler, PluginInteractionCancelReason, PluginInteractionRequest, PluginInteractionResult, PluginKvStorage, PluginLogger, PluginMachineProviderDeclaration, PluginMachineProviderInputsChange, PluginMachineProviderInputsProps, PluginMachineProviderInputsRegistration, PluginMachineValidateDecision, PluginMachines, PluginMentionItem, PluginMentionProviderRegistration, PluginMentionSearchContext, PluginMentionTrigger, PluginMessageActionContext, PluginMessageActionRegistration, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginNavPanelProps, PluginNavPanelRegistration, PluginNewThreadPanelActionContext, PluginNewThreadPanelActionRegistration, PluginNewThreadPanelProps, PluginPanelActionOpenOptions, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginProviderCapabilities, PluginProviderCompletedTurnDisplay, PluginProviderComposerAction, PluginProviderDeclaration, PluginProviderExtensionKindDeclaration, PluginProviderFallbackModel, PluginProviderIconRegistration, PluginProviderMaintenance, PluginProviderModelCatalogScope, PluginProviderNativeRootEntry, PluginProviderNativeRoots, PluginProviderOptionDescriptor, PluginProviderOptionsContext, PluginProviderPermissionMode, PluginProviderReasoningLevel, PluginProviderStrings, PluginProviders, PluginProvidersState, PluginRealtime, PluginRealtimeConnectionState, PluginRpc, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginServerAccess, PluginServerApi, PluginSettingDescriptor, PluginSettingDescriptors, PluginSettingValue, PluginSettings, PluginSettingsHandle, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSettingsValues, PluginSharedPortTunnelIdentity, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginSidebarProject, PluginSidebarPullRequest, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActions, PluginSidebarThreadActivity, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginStatusApi, PluginStorage, PluginTargetedPanelActionOpenOptions, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginTimelineRendererProps, PluginTimelineRendererRegistration, PluginTimelineRendererRow, PluginTimelineRowPresentation, PluginTimelineRowStatus, PluginTurnFailedEvent, PluginUi, ReadonlyJsonValue, ServerAccessGrant, ServerAccessProviderDeclaration, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps, UrlLinkProps, UseBranchesArgs, UseCheckoutStateArgs };
21318
+ /** Duration suffixes, shared with the core `bb` CLI grammar. */
21319
+ type PluginCliDurationUnit = "d" | "h" | "m" | "ms" | "s";
21320
+ /**
21321
+ * Failure codes the parser itself emits in the `--json` error envelope.
21322
+ * A command raising `PluginCliError` may use any snake_case code.
21323
+ */
21324
+ type PluginCliErrorCode = "invalid_value" | "missing_command" | "missing_required" | "unexpected_argument" | "unknown_command" | "unknown_option";
21325
+ interface PluginCliOptionBase {
21326
+ /** One line shown in `--help`; state the limits agents keep hitting. */
21327
+ description: string;
21328
+ /** Extra spellings accepted silently and mapped onto this option. */
21329
+ aliases?: readonly string[];
21330
+ /** Single-character form: `"f"` (or `"-f"`) accepts `-f`. */
21331
+ short?: string;
21332
+ /** Kept out of `--help` and the generated usage line. */
21333
+ hidden?: boolean;
21334
+ /** Value placeholder in help and usage; defaults to the value type. */
21335
+ placeholder?: string;
21336
+ /**
21337
+ * Recognize `--<name>-stdin`. The `bb` CLI reads that value from stdin and
21338
+ * rewrites it to `--<name> <value>` before the plugin runs, so a command
21339
+ * that still sees it reports that instead of "unknown option".
21340
+ */
21341
+ stdin?: boolean;
21342
+ }
21343
+ /** A valueless flag; absent means `false`. */
21344
+ interface PluginCliBooleanOption extends PluginCliOptionBase {
21345
+ type: "boolean";
21346
+ }
21347
+ interface PluginCliStringOption extends PluginCliOptionBase {
21348
+ type: "string";
21349
+ required?: boolean;
21350
+ repeatable?: boolean;
21351
+ /**
21352
+ * Split each value on this separator, so `--tag a,b` is two tags. Only valid
21353
+ * with `repeatable: true`; `defineCli` rejects it otherwise, because a
21354
+ * single-valued option would silently drop every value after the first.
21355
+ */
21356
+ split?: string;
21357
+ default?: string;
21358
+ }
21359
+ interface PluginCliIntegerOption extends PluginCliOptionBase {
21360
+ type: "integer";
21361
+ min: number;
21362
+ max: number;
21363
+ required?: boolean;
21364
+ default?: number;
21365
+ }
21366
+ interface PluginCliEnumOption extends PluginCliOptionBase {
21367
+ type: "enum";
21368
+ values: readonly string[];
21369
+ required?: boolean;
21370
+ repeatable?: boolean;
21371
+ /** Split each value on this separator, so `--kind a,b` is two values. */
21372
+ split?: string;
21373
+ default?: string;
21374
+ }
21375
+ /** A duration parsed to milliseconds with the core CLI's grammar. */
21376
+ interface PluginCliDurationOption extends PluginCliOptionBase {
21377
+ type: "duration";
21378
+ /** Unit assumed for a bare number when `bareUnits` is absent. */
21379
+ defaultUnit: PluginCliDurationUnit;
21380
+ /**
21381
+ * Units tried in order for a bare number, taking the first whose
21382
+ * milliseconds fall inside `min`/`max`. Declare it when two units are
21383
+ * plausible and their valid ranges do not overlap (`90` seconds versus
21384
+ * `1500` milliseconds); a number matching neither is rejected with both
21385
+ * forms named.
21386
+ */
21387
+ bareUnits?: readonly PluginCliDurationUnit[];
21388
+ /** Inclusive bounds in milliseconds. */
21389
+ min?: number;
21390
+ max?: number;
21391
+ required?: boolean;
21392
+ /** Default in milliseconds. */
21393
+ default?: number;
21394
+ }
21395
+ type PluginCliOption = PluginCliBooleanOption | PluginCliStringOption | PluginCliIntegerOption | PluginCliEnumOption | PluginCliDurationOption;
21396
+ interface PluginCliPositional {
21397
+ name: string;
21398
+ description: string;
21399
+ required?: boolean;
21400
+ /** Collects every remaining bare token into a string array. */
21401
+ variadic?: boolean;
21402
+ }
21403
+ /**
21404
+ * Relationships between options that the parser enforces before `run`.
21405
+ * Rules that depend on a value (which options a `--backend` choice allows)
21406
+ * belong in `run`, raised as `PluginCliError`.
21407
+ */
21408
+ type PluginCliConstraint = {
21409
+ kind: "exactly-one";
21410
+ options: readonly string[];
21411
+ } | {
21412
+ kind: "at-most-one";
21413
+ options: readonly string[];
21414
+ } | {
21415
+ kind: "at-least-one";
21416
+ options: readonly string[];
21417
+ } | {
21418
+ kind: "requires";
21419
+ option: string;
21420
+ needs: readonly string[];
21421
+ };
21422
+ type CliOptions = Record<string, PluginCliOption>;
21423
+ type CliPositionals = readonly PluginCliPositional[];
21424
+ type OptionValue<TOption> = TOption extends {
21425
+ type: "boolean";
21426
+ } ? boolean : TOption extends {
21427
+ type: "enum";
21428
+ values: readonly (infer TValue)[];
21429
+ } ? TValue : TOption extends {
21430
+ type: "string";
21431
+ } ? string : number;
21432
+ type OptionResolved<TOption> = TOption extends {
21433
+ type: "boolean";
21434
+ } ? boolean : TOption extends {
21435
+ repeatable: true;
21436
+ } ? OptionValue<TOption>[] : TOption extends {
21437
+ required: true;
21438
+ } ? OptionValue<TOption> : TOption extends {
21439
+ default: unknown;
21440
+ } ? OptionValue<TOption> : OptionValue<TOption> | undefined;
21441
+ /** Validated option values, keyed by the spec's option names. */
21442
+ type PluginCliOptionValues<TOptions extends CliOptions> = {
21443
+ [TName in keyof TOptions]: OptionResolved<TOptions[TName]>;
21444
+ };
21445
+ /** Validated positional values, keyed by the spec's positional names. */
21446
+ type PluginCliPositionalValues<TPositionals extends CliPositionals> = {
21447
+ [TEntry in TPositionals[number] as TEntry["name"]]: TEntry extends {
21448
+ variadic: true;
21449
+ } ? string[] : TEntry extends {
21450
+ required: true;
21451
+ } ? string : string | undefined;
21452
+ };
21453
+ /** What a command's `run` receives once every value has been validated. */
21454
+ interface PluginCliRunInput<TOptions extends CliOptions = CliOptions, TPositionals extends CliPositionals = CliPositionals> {
21455
+ options: PluginCliOptionValues<TOptions>;
21456
+ positionals: PluginCliPositionalValues<TPositionals>;
21457
+ /** Tokens after `--` when the command declares `passthrough`. */
21458
+ passthrough: string[];
21459
+ /** This command's rendered `--help` text. */
21460
+ help: string;
21461
+ }
21462
+ type ErasedOptionValue = string | number | boolean | string[] | undefined;
21463
+ interface ErasedRunInput {
21464
+ options: Record<string, ErasedOptionValue>;
21465
+ positionals: Record<string, string | string[] | undefined>;
21466
+ passthrough: string[];
21467
+ help: string;
21468
+ }
21469
+ /**
21470
+ * One command as `defineCli` consumes it. Build it with
21471
+ * `cliCommand` so `run` receives typed values. The declaration
21472
+ * is inert data: help and usage render from it without running the command.
21473
+ */
21474
+ interface PluginCliCommand {
21475
+ summary: string;
21476
+ description?: string;
21477
+ /** Extra invocation paths that run this command, hidden from help. */
21478
+ aliases?: readonly string[];
21479
+ /** Mistyped command names that should suggest this command. */
21480
+ suggestFor?: readonly string[];
21481
+ hidden?: boolean;
21482
+ options?: CliOptions;
21483
+ positionals?: CliPositionals;
21484
+ constraints?: readonly PluginCliConstraint[];
21485
+ /** Put tokens after `--` in `input.passthrough` instead of positionals. */
21486
+ passthrough?: boolean;
21487
+ /** Hint added when an unexpected bare token is passed. */
21488
+ unexpectedPositionalHint?: string;
21489
+ run(input: ErasedRunInput, ctx: PluginCliContext): PluginCliResult | Promise<PluginCliResult>;
21490
+ }
21491
+ /** The declarative CLI a plugin hands to `bb.cli.register`. */
21492
+ interface PluginCliSpec {
21493
+ /** Top-level command name (`bb <name> …`): lowercase `[a-z0-9-]+`. */
21494
+ name: string;
21495
+ summary: string;
21496
+ /** Prose printed under the summary in top-level help. */
21497
+ description?: string;
21498
+ /** Runs when the invocation names no command (`bb connect --code …`). */
21499
+ root?: PluginCliCommand;
21500
+ /** Commands keyed by invocation path (`"add"`, `"account add"`). */
21501
+ commands: Record<string, PluginCliCommand>;
21502
+ /** Exit code for usage errors; defaults to 1. */
21503
+ usageErrorExitCode?: number;
21504
+ }
21505
+ /**
21506
+ * A failure a command raises itself, reported exactly like a parse error:
21507
+ * human text on stderr, plus the `{ ok: false, error }` envelope on stdout
21508
+ * when the invocation carries `--json`.
21509
+ */
21510
+ declare class PluginCliError extends Error {
21511
+ readonly code: string;
21512
+ readonly hint: string | undefined;
21513
+ readonly exitCode: number;
21514
+ constructor(message: string, options?: {
21515
+ code?: string;
21516
+ hint?: string;
21517
+ exitCode?: number;
21518
+ });
21519
+ }
21520
+ /**
21521
+ * Declares one command. Inference flows from `options` and `positionals`
21522
+ * into `run`, so `input.options.scope` is the declared enum union and a
21523
+ * required option is never `undefined`.
21524
+ */
21525
+ declare function cliCommand<const TOptions extends CliOptions = Record<string, never>, const TPositionals extends CliPositionals = readonly []>(command: {
21526
+ summary: string;
21527
+ description?: string;
21528
+ aliases?: readonly string[];
21529
+ suggestFor?: readonly string[];
21530
+ hidden?: boolean;
21531
+ options?: TOptions;
21532
+ positionals?: TPositionals;
21533
+ constraints?: readonly PluginCliConstraint[];
21534
+ passthrough?: boolean;
21535
+ unexpectedPositionalHint?: string;
21536
+ run(input: PluginCliRunInput<TOptions, TPositionals>, ctx: PluginCliContext): PluginCliResult | Promise<PluginCliResult>;
21537
+ }): PluginCliCommand;
21538
+ /**
21539
+ * Turns a declarative spec into a `PluginCliRegistration`, so every plugin
21540
+ * CLI parses argv, renders `--help`, and fails the same way.
21541
+ *
21542
+ * `--help`, `-h` and a leading `help` word exit 0 at any level and never run
21543
+ * a command. Unknown commands and options suggest the nearest declared name,
21544
+ * every missing required value is reported in one error, and an invocation
21545
+ * carrying `--json` adds the `{ ok: false, error: { code, message, hint? } }`
21546
+ * envelope on stdout while stderr keeps the human-readable text.
21547
+ */
21548
+ declare function defineCli(spec: PluginCliSpec): PluginCliRegistration;
21549
+
21550
+ export { PLUGIN_CLI_OUTPUT_MAX_BYTES, PluginCliError, cliCommand, defineCli, defineRpcContract, experimental_defineHostEntry };
21551
+ export type { BbContext, BbNavigate, BbPluginApi, BranchPickerProps, BranchesState, CheckoutState, CodeOverflowMode, ComposerCustomization, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerStructuredDraft, ComposerView, DiffProps, DiffViewMode, ExperimentalAppIcons, ExperimentalAppOverlayProps, ExperimentalAppOverlayRegistration, ExperimentalAppPanel, ExperimentalAppPanelSurface, ExperimentalComposerSelection, ExperimentalComposerSubmitOptions, ExperimentalDesktopBrowserAcquireInput, ExperimentalDesktopBrowserCreateInput, ExperimentalDesktopBrowserLease, ExperimentalDesktopBrowserScope, ExperimentalDesktopBrowsersArea, ExperimentalDiffFileContent, ExperimentalDiffFullFileContents, ExperimentalFileLinkProps, ExperimentalFileLocation, ExperimentalFileOpenOptions, ExperimentalFixedTabTargetContract, ExperimentalFixedTabTargetState, ExperimentalHostCallOptions, ExperimentalHostClient, ExperimentalHostEntry, ExperimentalHostPaths, ExperimentalHostRpcContext, ExperimentalHostRpcHandlers, ExperimentalHostSignalContract, ExperimentalHostSignalEvent, ExperimentalHostSignals, ExperimentalHostWatchChange, ExperimentalHostWatchChangeType, ExperimentalHostWatchEvent, ExperimentalHostWatchListener, ExperimentalHostWatchOptions, ExperimentalHostWatchSubscription, ExperimentalHostWorkerLease, ExperimentalIconProps, ExperimentalIconRegistration, ExperimentalLiveFileTarget, ExperimentalOpenFixedTabOptions, ExperimentalPermissionModePickerProps, ExperimentalPluginBrowserPage, ExperimentalPluginBrowserPageEvaluateOptions, ExperimentalPluginBrowserPageWorld, ExperimentalPluginBrowserToolbarActionProps, ExperimentalPluginBrowserToolbarActionRegistration, ExperimentalPluginFixedTabReference, ExperimentalPluginMentionImage, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealth, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginWebSocket, ExperimentalPluginWebSocketContext, ExperimentalPluginWebSocketHandler, ExperimentalPluginWebSocketHandlers, ExperimentalProviderIconProps, ExperimentalProviderModelPickerProps, ExperimentalProviderModelPickerRouting, ExperimentalProviderModelPickerValue, ExperimentalSidebarFooter, ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterActionRegistration, ExperimentalSidebarFooterDisclosureController, ExperimentalSidebarFooterDisclosureProps, ExperimentalSidebarFooterDisclosureRegistration, ExperimentalSidebarFooterItemBase, ExperimentalSidebarFooterItemRegistration, ExperimentalSidebarNavigationAction, ExperimentalSidebarNavigationActivationOptions, ExperimentalSidebarNavigationIcon, ExperimentalSidebarNavigationItem, ExperimentalSidebarNavigationProps, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationShortcut, JsonValue, MachineBootstrapApi, MachineBootstrapRequest, MachineExecutor, MachineExecutorRequest, MarkdownProps, MessageDispatchHookContext, MessageDispatchHookDecision, NewThreadComposerProps, NewThreadRequest, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgentToolSelection, PluginAgents, PluginAiServiceDeclaration, PluginAiServiceKind, PluginAiServices, PluginAppBuilder, PluginAppCommands, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginBbSdk, PluginCli, PluginCliBooleanOption, PluginCliCommand, PluginCliCommandInfo, PluginCliConstraint, PluginCliContext, PluginCliDurationOption, PluginCliDurationUnit, PluginCliEnumOption, PluginCliErrorCode, PluginCliExecutionResult, PluginCliIntegerOption, PluginCliOption, PluginCliOptionValues, PluginCliOutputLimitError, PluginCliPositional, PluginCliPositionalValues, PluginCliRegistration, PluginCliResult, PluginCliRunInput, PluginCliSpec, PluginCliStringOption, PluginCodeThemeData, PluginCodeThemeState, PluginCodeThemeTokenRule, PluginCommandContext, PluginCommandRegistration, PluginCommandShortcut, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginComposerTextEffect, PluginComposerThreadRowStatus, PluginContentScriptContext, PluginContentScriptDisposer, PluginContentScriptRegistration, PluginDiffRendererProps, PluginDiffRendererRegistration, PluginDispatchAttemptKind, PluginDispatchEnvironmentIntent, PluginDispatchExecution, PluginDispatchExecutionSources, PluginDispatchInput, PluginEnvironmentProviderDeclaration, PluginEnvironmentProviderInputsChange, PluginEnvironmentProviderInputsProps, PluginEnvironmentProviderInputsRegistration, PluginEnvironmentProviderRequirements, PluginEnvironmentValidateDecision, PluginEnvironments, PluginEvents, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginFixedTabDeclaration, PluginFixedTabRegistration, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginHookHandler, PluginHookName, PluginHookSignatures, PluginHooks, PluginHosts, PluginHttp, PluginHttpAuthMode, PluginHttpHandler, PluginInteractionCancelReason, PluginInteractionDescription, PluginInteractionRequest, PluginInteractionResult, PluginKvStorage, PluginLogger, PluginMachineProviderDeclaration, PluginMachineProviderInputsChange, PluginMachineProviderInputsProps, PluginMachineProviderInputsRegistration, PluginMachineValidateDecision, PluginMachines, PluginMentionItem, PluginMentionProviderRegistration, PluginMentionSearchContext, PluginMentionTrigger, PluginMessageActionContext, PluginMessageActionRegistration, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginNavPanelProps, PluginNavPanelRegistration, PluginNewThreadPanelActionContext, PluginNewThreadPanelActionRegistration, PluginNewThreadPanelProps, PluginPanelActionOpenOptions, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginProviderCapabilities, PluginProviderCompletedTurnDisplay, PluginProviderComposerAction, PluginProviderDeclaration, PluginProviderExtensionKindDeclaration, PluginProviderFallbackModel, PluginProviderIconRegistration, PluginProviderMaintenance, PluginProviderModelCatalogScope, PluginProviderNativeRootEntry, PluginProviderNativeRoots, PluginProviderOptionDescriptor, PluginProviderOptionsContext, PluginProviderPermissionMode, PluginProviderReasoningLevel, PluginProviderStrings, PluginProviders, PluginProvidersState, PluginRealtime, PluginRealtimeConnectionState, PluginRowLabels, PluginRowPresentation, PluginRpc, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginServerAccess, PluginServerApi, PluginSettingDescriptor, PluginSettingDescriptors, PluginSettingValue, PluginSettings, PluginSettingsHandle, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSettingsValues, PluginSharedPortTunnelIdentity, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginSidebarProject, PluginSidebarPullRequest, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActions, PluginSidebarThreadActivity, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginStatusApi, PluginStorage, PluginTargetedPanelActionOpenOptions, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginTimelineRendererProps, PluginTimelineRendererRegistration, PluginTimelineRendererRow, PluginTimelineRowPresentation, PluginTimelineRowStatus, PluginTurnFailedEvent, PluginUi, ReadonlyJsonValue, ServerAccessGrant, ServerAccessProviderDeclaration, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps, UrlLinkProps, UseBranchesArgs, UseCheckoutStateArgs };