@get-bb/plugin-sdk 0.6.42 → 0.6.49

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.
@@ -501,12 +501,14 @@ declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
501
501
  changelogPreview: "changelogPreview";
502
502
  performanceDiagnostics: "performanceDiagnostics";
503
503
  serverMove: "serverMove";
504
+ timelinePush: "timelinePush";
504
505
  }>, z$1.ZodBoolean>;
505
506
  type Experiments = z$1.infer<typeof experimentsSchema>;
506
507
  declare const experimentUpdatesSchema: z$1.ZodRecord<z$1.ZodEnum<{
507
508
  changelogPreview: "changelogPreview";
508
509
  performanceDiagnostics: "performanceDiagnostics";
509
510
  serverMove: "serverMove";
511
+ timelinePush: "timelinePush";
510
512
  }> & z$1.core.$partial, z$1.ZodBoolean>;
511
513
  type ExperimentUpdates = z$1.infer<typeof experimentUpdatesSchema>;
512
514
 
@@ -4393,6 +4395,14 @@ declare const threadQueuedMessageSchema: z$1.ZodObject<{
4393
4395
  sendAt: z$1.ZodNullable<z$1.ZodNumber>;
4394
4396
  senderThreadId: z$1.ZodNullable<z$1.ZodString>;
4395
4397
  serviceTier: z$1.ZodString;
4398
+ state: z$1.ZodEnum<{
4399
+ claimed: "claimed";
4400
+ failed_exhausted: "failed_exhausted";
4401
+ failed_retrying: "failed_retrying";
4402
+ queued: "queued";
4403
+ scheduled: "scheduled";
4404
+ waiting: "waiting";
4405
+ }>;
4396
4406
  threadId: z$1.ZodString;
4397
4407
  updatedAt: z$1.ZodNumber;
4398
4408
  waitingOn: z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -5577,6 +5587,7 @@ declare const environmentStatusResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.Zo
5577
5587
  subject: z$1.ZodString;
5578
5588
  }, z$1.core.$strip>>;
5579
5589
  deletions: z$1.ZodNumber;
5590
+ fileCount: z$1.ZodNumber;
5580
5591
  files: z$1.ZodArray<z$1.ZodObject<{
5581
5592
  deletions: z$1.ZodNullable<z$1.ZodNumber>;
5582
5593
  insertions: z$1.ZodNullable<z$1.ZodNumber>;
@@ -5599,6 +5610,7 @@ declare const environmentStatusResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.Zo
5599
5610
  }, z$1.core.$strip>>;
5600
5611
  workingTree: z$1.ZodObject<{
5601
5612
  deletions: z$1.ZodNumber;
5613
+ fileCount: z$1.ZodNumber;
5602
5614
  files: z$1.ZodArray<z$1.ZodObject<{
5603
5615
  deletions: z$1.ZodNullable<z$1.ZodNumber>;
5604
5616
  insertions: z$1.ZodNullable<z$1.ZodNumber>;
@@ -8419,6 +8431,7 @@ declare const hostDaemonCommandRegistry: {
8419
8431
  }, z$1.core.$strict>, "onlineRpc", true>;
8420
8432
  "workspace.status": HostDaemonCommandDescriptor<"workspace.status", z$1.ZodObject<{
8421
8433
  environmentId: z$1.ZodString;
8434
+ maxFiles: z$1.ZodNumber;
8422
8435
  maxUntrackedLineStatBytes: z$1.ZodNumber;
8423
8436
  maxUntrackedLineStatFiles: z$1.ZodNumber;
8424
8437
  mergeBaseBranch: z$1.ZodOptional<z$1.ZodString>;
@@ -8459,6 +8472,7 @@ declare const hostDaemonCommandRegistry: {
8459
8472
  subject: z$1.ZodString;
8460
8473
  }, z$1.core.$strip>>;
8461
8474
  deletions: z$1.ZodNumber;
8475
+ fileCount: z$1.ZodNumber;
8462
8476
  files: z$1.ZodArray<z$1.ZodObject<{
8463
8477
  deletions: z$1.ZodNullable<z$1.ZodNumber>;
8464
8478
  insertions: z$1.ZodNullable<z$1.ZodNumber>;
@@ -8481,6 +8495,7 @@ declare const hostDaemonCommandRegistry: {
8481
8495
  }, z$1.core.$strip>>;
8482
8496
  workingTree: z$1.ZodObject<{
8483
8497
  deletions: z$1.ZodNumber;
8498
+ fileCount: z$1.ZodNumber;
8484
8499
  files: z$1.ZodArray<z$1.ZodObject<{
8485
8500
  deletions: z$1.ZodNullable<z$1.ZodNumber>;
8486
8501
  insertions: z$1.ZodNullable<z$1.ZodNumber>;
@@ -10411,6 +10426,7 @@ type SystemProvidersQuery = z$1.infer<typeof systemProvidersQuerySchema>;
10411
10426
  declare const systemExecutionOptionsQuerySchema: z$1.ZodObject<{
10412
10427
  environmentId: z$1.ZodOptional<z$1.ZodString>;
10413
10428
  hostId: z$1.ZodOptional<z$1.ZodString>;
10429
+ projectId: z$1.ZodOptional<z$1.ZodString>;
10414
10430
  providerId: z$1.ZodOptional<z$1.ZodString>;
10415
10431
  }, z$1.core.$strip>;
10416
10432
  type SystemExecutionOptionsQuery = z$1.infer<typeof systemExecutionOptionsQuerySchema>;
@@ -10791,6 +10807,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10791
10807
  changelogPreview: "changelogPreview";
10792
10808
  performanceDiagnostics: "performanceDiagnostics";
10793
10809
  serverMove: "serverMove";
10810
+ timelinePush: "timelinePush";
10794
10811
  }>, z$1.ZodBoolean>;
10795
10812
  featureFlags: z$1.ZodObject<{
10796
10813
  placeholder: z$1.ZodBoolean;
@@ -11136,6 +11153,20 @@ declare const systemVersionResponseSchema: z$1.ZodObject<{
11136
11153
  upgradeCommand: z$1.ZodString;
11137
11154
  }, z$1.core.$strip>;
11138
11155
  type SystemVersionResponse = z$1.infer<typeof systemVersionResponseSchema>;
11156
+ declare const systemCliCommandStatusSchema: z$1.ZodObject<{
11157
+ installedPath: z$1.ZodNullable<z$1.ZodString>;
11158
+ onPath: z$1.ZodBoolean;
11159
+ shadowedBy: z$1.ZodNullable<z$1.ZodObject<{
11160
+ path: z$1.ZodString;
11161
+ source: z$1.ZodEnum<{
11162
+ machine: "machine";
11163
+ npm: "npm";
11164
+ other: "other";
11165
+ }>;
11166
+ }, z$1.core.$strip>>;
11167
+ supported: z$1.ZodBoolean;
11168
+ }, z$1.core.$strip>;
11169
+ type SystemCliCommandStatus = z$1.infer<typeof systemCliCommandStatusSchema>;
11139
11170
  declare const systemAppUpdateStatusSchema: z$1.ZodObject<{
11140
11171
  activity: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
11141
11172
  phase: z$1.ZodLiteral<"idle">;
@@ -11176,6 +11207,7 @@ declare const systemAppUpdateStatusSchema: z$1.ZodObject<{
11176
11207
  commit: z$1.ZodNullable<z$1.ZodString>;
11177
11208
  version: z$1.ZodString;
11178
11209
  }, z$1.core.$strip>;
11210
+ desktopUpdateSupported: z$1.ZodOptional<z$1.ZodLiteral<true>>;
11179
11211
  lastResult: z$1.ZodNullable<z$1.ZodObject<{
11180
11212
  acknowledged: z$1.ZodBoolean;
11181
11213
  finishedAt: z$1.ZodString;
@@ -13486,6 +13518,14 @@ declare const sendMessageResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObjec
13486
13518
  sendAt: z$1.ZodNullable<z$1.ZodNumber>;
13487
13519
  senderThreadId: z$1.ZodNullable<z$1.ZodString>;
13488
13520
  serviceTier: z$1.ZodString;
13521
+ state: z$1.ZodEnum<{
13522
+ claimed: "claimed";
13523
+ failed_exhausted: "failed_exhausted";
13524
+ failed_retrying: "failed_retrying";
13525
+ queued: "queued";
13526
+ scheduled: "scheduled";
13527
+ waiting: "waiting";
13528
+ }>;
13489
13529
  threadId: z$1.ZodString;
13490
13530
  updatedAt: z$1.ZodNumber;
13491
13531
  waitingOn: z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -14048,6 +14088,14 @@ declare const sendQueuedMessageResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.Zo
14048
14088
  sendAt: z$1.ZodNullable<z$1.ZodNumber>;
14049
14089
  senderThreadId: z$1.ZodNullable<z$1.ZodString>;
14050
14090
  serviceTier: z$1.ZodString;
14091
+ state: z$1.ZodEnum<{
14092
+ claimed: "claimed";
14093
+ failed_exhausted: "failed_exhausted";
14094
+ failed_retrying: "failed_retrying";
14095
+ queued: "queued";
14096
+ scheduled: "scheduled";
14097
+ waiting: "waiting";
14098
+ }>;
14051
14099
  threadId: z$1.ZodString;
14052
14100
  updatedAt: z$1.ZodNumber;
14053
14101
  waitingOn: z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -14995,6 +15043,14 @@ declare const threadQueuedMessageListResponseSchema: z$1.ZodArray<z$1.ZodObject<
14995
15043
  sendAt: z$1.ZodNullable<z$1.ZodNumber>;
14996
15044
  senderThreadId: z$1.ZodNullable<z$1.ZodString>;
14997
15045
  serviceTier: z$1.ZodString;
15046
+ state: z$1.ZodEnum<{
15047
+ claimed: "claimed";
15048
+ failed_exhausted: "failed_exhausted";
15049
+ failed_retrying: "failed_retrying";
15050
+ queued: "queued";
15051
+ scheduled: "scheduled";
15052
+ waiting: "waiting";
15053
+ }>;
14998
15054
  threadId: z$1.ZodString;
14999
15055
  updatedAt: z$1.ZodNumber;
15000
15056
  waitingOn: z$1.ZodNullable<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -16101,26 +16157,14 @@ declare const threadTimelineResponseSchema: z$1.ZodObject<{
16101
16157
  value: z$1.ZodBoolean;
16102
16158
  }, z$1.core.$strip>], "type">>>;
16103
16159
  timelinePage: z$1.ZodObject<{
16104
- contentPage: z$1.ZodOptional<z$1.ZodObject<{
16105
- anchorSeq: z$1.ZodNumber;
16106
- end: z$1.ZodNumber;
16107
- start: z$1.ZodNumber;
16108
- total: z$1.ZodNumber;
16109
- }, z$1.core.$strip>>;
16110
- hasOlderRows: z$1.ZodBoolean;
16111
- historySnapshot: z$1.ZodOptional<z$1.ZodString>;
16112
- kind: z$1.ZodEnum<{
16113
- latest: "latest";
16114
- older: "older";
16115
- }>;
16160
+ historySnapshot: z$1.ZodString;
16116
16161
  olderCursor: z$1.ZodNullable<z$1.ZodObject<{
16117
16162
  anchorId: z$1.ZodString;
16118
16163
  anchorSeq: z$1.ZodNumber;
16119
16164
  }, z$1.core.$strict>>;
16120
16165
  olderRowUpdates: z$1.ZodOptional<z$1.ZodArray<z$1.ZodType<TimelineRow, unknown, z$1.core.$ZodTypeInternals<TimelineRow, unknown>>>>;
16121
- olderRowsSourceSeqEnd: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
16166
+ olderRowsSourceSeqEnd: z$1.ZodNullable<z$1.ZodNumber>;
16122
16167
  returnedSegmentCount: z$1.ZodNumber;
16123
- segmentLimit: z$1.ZodNumber;
16124
16168
  }, z$1.core.$strict>;
16125
16169
  }, z$1.core.$strip>;
16126
16170
  type ThreadTimelineResponse = z$1.infer<typeof threadTimelineResponseSchema>;
@@ -17307,7 +17351,19 @@ type ProviderListArgs = ProviderHostRoutingArgs & {
17307
17351
  capability?: SystemProvidersQuery["capability"];
17308
17352
  signal?: AbortSignal;
17309
17353
  };
17310
- type ProviderModelsArgs = ProviderHostRoutingArgs & {
17354
+ type ProviderModelsArgs = ({
17355
+ environmentId: string;
17356
+ hostId?: never;
17357
+ projectId?: never;
17358
+ } | {
17359
+ environmentId?: never;
17360
+ hostId: string;
17361
+ projectId?: string;
17362
+ } | {
17363
+ environmentId?: never;
17364
+ hostId?: never;
17365
+ projectId?: string;
17366
+ }) & {
17311
17367
  providerId?: string;
17312
17368
  signal?: AbortSignal;
17313
17369
  };
@@ -17711,6 +17767,10 @@ interface SystemAppUpdateArgs {
17711
17767
  type SystemApplyAppUpdateArgs = SystemAppUpdateApplyRequest;
17712
17768
  type SystemAcknowledgeAppUpdateArgs = SystemAppUpdateAcknowledgeRequest;
17713
17769
  type SystemAppUpdateStatusResult = SystemAppUpdateStatus;
17770
+ interface SystemCliCommandArgs {
17771
+ signal?: AbortSignal;
17772
+ }
17773
+ type SystemCliCommandStatusResult = SystemCliCommandStatus;
17714
17774
  interface SystemVoiceTranscriptionArgs {
17715
17775
  file: Blob;
17716
17776
  prompt?: string;
@@ -17798,6 +17858,9 @@ interface SystemArea {
17798
17858
  appUpdate(args?: SystemAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
17799
17859
  applyAppUpdate(args: SystemApplyAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
17800
17860
  acknowledgeAppUpdate(args: SystemAcknowledgeAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
17861
+ experimental_cliCommand(args?: SystemCliCommandArgs): Promise<SystemCliCommandStatusResult>;
17862
+ experimental_installCliCommand(): Promise<SystemCliCommandStatusResult>;
17863
+ experimental_removeCliCommand(): Promise<SystemCliCommandStatusResult>;
17801
17864
  }
17802
17865
 
17803
17866
  interface TerminalThreadScope {
@@ -19589,6 +19652,25 @@ interface ExperimentalClipboardContent {
19589
19652
  text: string;
19590
19653
  html?: string;
19591
19654
  }
19655
+ /**
19656
+ * What {@link PluginSdkApp.experimental_saveFile} saves: a URL on the bb
19657
+ * server (such as one of the plugin's own HTTP routes), or bytes already in
19658
+ * the page, plus the file name the user sees.
19659
+ */
19660
+ type ExperimentalSaveFileRequest = {
19661
+ fileName: string;
19662
+ url: string;
19663
+ } | {
19664
+ fileName: string;
19665
+ blob: Blob;
19666
+ };
19667
+ /**
19668
+ * How {@link PluginSdkApp.experimental_saveFile} started. `started` means
19669
+ * the browser or native shell took over the download; completion and share
19670
+ * cancellation are not reported to the page. `failed` means the download
19671
+ * could not start; bb already showed an error toast.
19672
+ */
19673
+ type ExperimentalSaveFileOutcome = "failed" | "started";
19592
19674
  /**
19593
19675
  * The `threads` area of {@link PluginBrowserBbSdk}: bb's public thread API
19594
19676
  * with the calling plugin's identity filled in. `spawn` and `fork` stamp
@@ -19785,8 +19867,9 @@ interface PluginThreadActionRunInput {
19785
19867
  interface PluginThreadAction {
19786
19868
  label: string;
19787
19869
  /**
19788
- * Short secondary text on a muted second line under the label, e.g. the
19789
- * current value of a choice list.
19870
+ * Short secondary text, e.g. the current value of a choice list. Shown on
19871
+ * a muted second line under the label, except on rows with `choices`,
19872
+ * where only tooltips and screen readers include it.
19790
19873
  */
19791
19874
  detail?: string;
19792
19875
  icon: BbIconName;
@@ -19829,7 +19912,7 @@ interface PluginThreadActionItemInput<Data> {
19829
19912
  * Add an action to every thread actions menu: the thread header's menu, the
19830
19913
  * sidebar row's menu and right-click menu, the compact long-press drawer, and,
19831
19914
  * when the user picks it, a sidebar row's quick-action buttons. bb's own
19832
- * actions (Open in split, Copy thread link, Mark read, Pin, Rename, Archive,
19915
+ * actions (Open in split, Copy link, Mark read, Pin, Rename, Archive,
19833
19916
  * Delete, …) are registrations of this same shape.
19834
19917
  *
19835
19918
  * `useData` is a React hook the host calls once for the whole app, never per
@@ -21786,11 +21869,13 @@ interface PluginSdkApp {
21786
21869
  experimental_ThreadActionsContextMenu: ComponentType<PluginThreadActionsContextMenuProps>;
21787
21870
  /**
21788
21871
  * bb's thread menu groups, for a registration that joins one:
21789
- * `open` (split), `organize` (copy, read, pin, move, rename), `settings`,
21790
- * and `lifecycle` (archive, delete). Experimental: see docs/api_to_audit.md.
21872
+ * `open` (split, copy link, new thread in environment), `state` (pin,
21873
+ * read, notifications), `organize` (rename, move), `settings`, and
21874
+ * `lifecycle` (archive, delete). Experimental: see docs/api_to_audit.md.
21791
21875
  */
21792
21876
  experimental_THREAD_ACTION_GROUPS: {
21793
21877
  readonly open: "1_open";
21878
+ readonly state: "1_state";
21794
21879
  readonly organize: "2_organize";
21795
21880
  readonly settings: "3_settings";
21796
21881
  readonly lifecycle: "4_lifecycle";
@@ -21918,6 +22003,19 @@ interface PluginSdkApp {
21918
22003
  * failure feedback. Experimental: see docs/api_to_audit.md.
21919
22004
  */
21920
22005
  experimental_copyToClipboard(content: ExperimentalClipboardContent): Promise<boolean>;
22006
+ /**
22007
+ * Saves a file through bb's own download path, the one bb's file preview
22008
+ * and attachment downloads use. Browsers and bb Desktop start an ordinary
22009
+ * download. In the bb iOS app, where a download link would otherwise
22010
+ * replace the app, the file goes to the system share sheet (Save to Files,
22011
+ * AirDrop, other apps). A plain function: call it from a click handler and
22012
+ * keep a real `href` on the link for copy-link and accessibility. Resolves
22013
+ * with `started` or `failed` and never rejects. Completion and share-sheet
22014
+ * cancellation are not reported. The native shell shows download errors;
22015
+ * bb shows an error toast when the download cannot start.
22016
+ * Experimental: see docs/api_to_audit.md.
22017
+ */
22018
+ experimental_saveFile(request: ExperimentalSaveFileRequest): Promise<ExperimentalSaveFileOutcome>;
21921
22019
  /**
21922
22020
  * The host-owned chat component (see {@link ThreadChatProps}). Together
21923
22021
  * with `Markdown`, the only components the SDK ships — everything else
@@ -24438,10 +24536,11 @@ declare function defineCli(spec: PluginCliSpec): PluginCliRegistration;
24438
24536
 
24439
24537
  declare const experimental_THREAD_ACTION_GROUPS: {
24440
24538
  readonly open: "1_open";
24539
+ readonly state: "1_state";
24441
24540
  readonly organize: "2_organize";
24442
24541
  readonly settings: "3_settings";
24443
24542
  readonly lifecycle: "4_lifecycle";
24444
24543
  };
24445
24544
 
24446
24545
  export { PLUGIN_CLI_OUTPUT_MAX_BYTES, PluginCliError, cliCommand, defineCli, defineRpcContract, experimental_THREAD_ACTION_GROUPS, experimental_defineHostEntry };
24447
- export type { BbContext, BbNavigate, BbPluginApi, BranchPickerProps, BranchesState, CheckoutState, CodeOverflowMode, ComposerAttachment, ComposerCustomization, ComposerDraft, ComposerDraftReplacement, ComposerDraftSnapshot, ComposerInsertOptions, ComposerInsertPart, ComposerMention, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerSelection, ComposerSendMenuItem, ComposerSubmitOptions, DiffProps, DiffViewMode, ExperimentalAppIcons, ExperimentalAppOverlayProps, ExperimentalAppOverlayRegistration, ExperimentalAppPanel, ExperimentalAppPanelSurface, ExperimentalClipboardContent, ExperimentalCodeFenceRendererProps, ExperimentalCodeFenceRendererRegistration, ExperimentalCodeFenceStatus, ExperimentalComposerCommandRegistration, ExperimentalComposerPopupRegistration, 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, ExperimentalPluginRpcCaller, ExperimentalPluginRpcHandlerContext, ExperimentalPluginRpcHandlersWithContext, ExperimentalPluginWebSocket, ExperimentalPluginWebSocketContext, ExperimentalPluginWebSocketHandler, ExperimentalPluginWebSocketHandlers, ExperimentalProviderIconProps, ExperimentalProviderModelPickerProps, ExperimentalProviderModelPickerRouting, ExperimentalProviderModelPickerValue, ExperimentalQuestionFormHost, ExperimentalQuestionShortcut, ExperimentalSidebarFooter, ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterActionRegistration, ExperimentalSidebarFooterDisclosureController, ExperimentalSidebarFooterDisclosureProps, ExperimentalSidebarFooterDisclosureRegistration, ExperimentalSidebarFooterItemBase, ExperimentalSidebarFooterItemRegistration, ExperimentalVoiceInputTextareaProps, JsonValue, MachineBootstrapApi, MachineBootstrapRequest, MachineExecutor, MachineExecutorRequest, MarkdownProps, MessageDispatchHookContext, MessageDispatchHookDecision, NewThreadComposerProps, NewThreadRequest, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgentToolSelection, PluginAgents, PluginAiCompleteOptions, PluginAiServiceDeclaration, PluginAiServiceStatus, PluginAiServices, PluginAiTranscribeOptions, PluginAppBuilder, PluginAppCommands, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginBbSdk, PluginBoundThreadAction, PluginBoundThreadsArea, PluginBrowserBbSdk, 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, PluginEnvironmentProvider, PluginEnvironmentProviderDeclaration, PluginEnvironmentProviderInputsChange, PluginEnvironmentProviderInputsProps, PluginEnvironmentProviderInputsRegistration, PluginEnvironmentProviderRequirements, PluginEnvironmentProvidersState, 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, PluginSidebarSection, PluginSidebarSplitLayout, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActivity, PluginSidebarThreadDraftState, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginStatusApi, PluginStorage, PluginTargetedPanelActionOpenOptions, PluginThreadAction, PluginThreadActionChoice, PluginThreadActionChoices, PluginThreadActionDataInput, PluginThreadActionEntry, PluginThreadActionItemInput, PluginThreadActionRegistration, PluginThreadActionRegistrationInfo, PluginThreadActionRunInput, PluginThreadActionTarget, PluginThreadActionsContextMenuProps, PluginThreadActionsInlineItem, PluginThreadActionsMenuProps, PluginThreadActionsOptions, PluginThreadActionsTriggerProps, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginThreadStatusGlyphProps, PluginThreadTitleProps, PluginTimelineRendererProps, PluginTimelineRendererRegistration, PluginTimelineRendererRow, PluginTimelineRowPresentation, PluginTimelineRowStatus, PluginTurnFailedEvent, PluginUi, ReadonlyJsonValue, ServerAccessGrant, ServerAccessProviderDeclaration, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps, UrlLinkProps, UseBranchesArgs, UseCheckoutStateArgs };
24546
+ export type { BbContext, BbNavigate, BbPluginApi, BranchPickerProps, BranchesState, CheckoutState, CodeOverflowMode, ComposerAttachment, ComposerCustomization, ComposerDraft, ComposerDraftReplacement, ComposerDraftSnapshot, ComposerInsertOptions, ComposerInsertPart, ComposerMention, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerSelection, ComposerSendMenuItem, ComposerSubmitOptions, DiffProps, DiffViewMode, ExperimentalAppIcons, ExperimentalAppOverlayProps, ExperimentalAppOverlayRegistration, ExperimentalAppPanel, ExperimentalAppPanelSurface, ExperimentalClipboardContent, ExperimentalCodeFenceRendererProps, ExperimentalCodeFenceRendererRegistration, ExperimentalCodeFenceStatus, ExperimentalComposerCommandRegistration, ExperimentalComposerPopupRegistration, 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, ExperimentalPluginRpcCaller, ExperimentalPluginRpcHandlerContext, ExperimentalPluginRpcHandlersWithContext, ExperimentalPluginWebSocket, ExperimentalPluginWebSocketContext, ExperimentalPluginWebSocketHandler, ExperimentalPluginWebSocketHandlers, ExperimentalProviderIconProps, ExperimentalProviderModelPickerProps, ExperimentalProviderModelPickerRouting, ExperimentalProviderModelPickerValue, ExperimentalQuestionFormHost, ExperimentalQuestionShortcut, ExperimentalSaveFileOutcome, ExperimentalSaveFileRequest, ExperimentalSidebarFooter, ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterActionRegistration, ExperimentalSidebarFooterDisclosureController, ExperimentalSidebarFooterDisclosureProps, ExperimentalSidebarFooterDisclosureRegistration, ExperimentalSidebarFooterItemBase, ExperimentalSidebarFooterItemRegistration, ExperimentalVoiceInputTextareaProps, JsonValue, MachineBootstrapApi, MachineBootstrapRequest, MachineExecutor, MachineExecutorRequest, MarkdownProps, MessageDispatchHookContext, MessageDispatchHookDecision, NewThreadComposerProps, NewThreadRequest, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgentToolSelection, PluginAgents, PluginAiCompleteOptions, PluginAiServiceDeclaration, PluginAiServiceStatus, PluginAiServices, PluginAiTranscribeOptions, PluginAppBuilder, PluginAppCommands, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginBbSdk, PluginBoundThreadAction, PluginBoundThreadsArea, PluginBrowserBbSdk, 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, PluginEnvironmentProvider, PluginEnvironmentProviderDeclaration, PluginEnvironmentProviderInputsChange, PluginEnvironmentProviderInputsProps, PluginEnvironmentProviderInputsRegistration, PluginEnvironmentProviderRequirements, PluginEnvironmentProvidersState, 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, PluginSidebarSection, PluginSidebarSplitLayout, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActivity, PluginSidebarThreadDraftState, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginStatusApi, PluginStorage, PluginTargetedPanelActionOpenOptions, PluginThreadAction, PluginThreadActionChoice, PluginThreadActionChoices, PluginThreadActionDataInput, PluginThreadActionEntry, PluginThreadActionItemInput, PluginThreadActionRegistration, PluginThreadActionRegistrationInfo, PluginThreadActionRunInput, PluginThreadActionTarget, PluginThreadActionsContextMenuProps, PluginThreadActionsInlineItem, PluginThreadActionsMenuProps, PluginThreadActionsOptions, PluginThreadActionsTriggerProps, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginThreadStatusGlyphProps, PluginThreadTitleProps, PluginTimelineRendererProps, PluginTimelineRendererRegistration, PluginTimelineRendererRow, PluginTimelineRowPresentation, PluginTimelineRowStatus, PluginTurnFailedEvent, PluginUi, ReadonlyJsonValue, ServerAccessGrant, ServerAccessProviderDeclaration, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps, UrlLinkProps, UseBranchesArgs, UseCheckoutStateArgs };
package/dist/app.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/thread-action-groups.ts
2
2
  var experimental_THREAD_ACTION_GROUPS = {
3
3
  open: "1_open",
4
+ state: "1_state",
4
5
  organize: "2_organize",
5
6
  settings: "3_settings",
6
7
  lifecycle: "4_lifecycle"
@@ -161,6 +162,7 @@ var experimental_useCodeTheme = runtimeFunction(
161
162
  var experimental_copyToClipboard = runtimeFunction(
162
163
  "experimental_copyToClipboard"
163
164
  );
165
+ var experimental_saveFile = runtimeFunction("experimental_saveFile");
164
166
  export {
165
167
  Markdown,
166
168
  ThreadChat,
@@ -182,6 +184,7 @@ export {
182
184
  experimental_ThreadStatusGlyph,
183
185
  experimental_VoiceInputTextarea,
184
186
  experimental_copyToClipboard,
187
+ experimental_saveFile,
185
188
  experimental_useAppPanel,
186
189
  experimental_useArchiveEnvironmentThreads,
187
190
  experimental_useBranches,
package/dist/index.js CHANGED
@@ -816,6 +816,7 @@ function defineRpcContract(contract) {
816
816
  // src/thread-action-groups.ts
817
817
  var experimental_THREAD_ACTION_GROUPS = {
818
818
  open: "1_open",
819
+ state: "1_state",
819
820
  organize: "2_organize",
820
821
  settings: "3_settings",
821
822
  lifecycle: "4_lifecycle"
@@ -21678,7 +21678,64 @@ function rememberDeclaredSessionOptions(key, sessionSetup) {
21678
21678
  function freshDeclaredSessionOptions(key) {
21679
21679
  return cachedDeclaredSessionOptions?.key === key && Date.now() - cachedDeclaredSessionOptions.fetchedAt < SESSION_MODEL_DISCOVERY_TTL_MS ? cachedDeclaredSessionOptions.options : null;
21680
21680
  }
21681
- async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
21681
+ var ACP_DISCOVERY_SESSION_DELETE_TIMEOUT_MS = 2e3;
21682
+ var ACP_DISCOVERY_SESSION_CLI_DELETE_TIMEOUT_MS = 15e3;
21683
+ function discoverySessionCliDeleteArgs(args) {
21684
+ if (args.dialectId !== "opencode" || args.agentArgs.at(-1) !== "acp" || !/^[A-Za-z0-9_-]+$/u.test(args.sessionId)) {
21685
+ return null;
21686
+ }
21687
+ return [...args.agentArgs.slice(0, -1), "session", "delete", args.sessionId];
21688
+ }
21689
+ async function endDiscoveryConnection(args) {
21690
+ const { connection, agent, session } = args;
21691
+ const agentDeletes = session?.capabilities.session.delete === true;
21692
+ if (session !== null && agentDeletes) {
21693
+ await connection.request({
21694
+ method: "session/delete",
21695
+ params: { sessionId: session.sessionId },
21696
+ resultSchema: z48.unknown(),
21697
+ timeoutMs: ACP_DISCOVERY_SESSION_DELETE_TIMEOUT_MS
21698
+ }).catch(() => void 0);
21699
+ }
21700
+ await connection.kill();
21701
+ if (session === null || agentDeletes) {
21702
+ return;
21703
+ }
21704
+ const cliArgs = discoverySessionCliDeleteArgs({
21705
+ dialectId: args.dialectId,
21706
+ agentArgs: agent.args,
21707
+ sessionId: session.sessionId
21708
+ });
21709
+ if (cliArgs === null) {
21710
+ return;
21711
+ }
21712
+ void execPortableFile(agent.command, cliArgs, {
21713
+ cwd: agent.cwd ?? process.cwd(),
21714
+ env: args.env,
21715
+ maxBuffer: 64 * 1024,
21716
+ timeout: ACP_DISCOVERY_SESSION_CLI_DELETE_TIMEOUT_MS
21717
+ }).catch(() => void 0);
21718
+ }
21719
+ async function resolveModelListWorkspace(cwd) {
21720
+ if (cwd === void 0) {
21721
+ return void 0;
21722
+ }
21723
+ const stats = await fs4.stat(cwd).catch(() => null);
21724
+ return stats?.isDirectory() === true ? cwd : void 0;
21725
+ }
21726
+ function inModelListWorkspace(params, workspace) {
21727
+ if (workspace === void 0) {
21728
+ return params;
21729
+ }
21730
+ const place = (command) => command.cwd === void 0 ? { ...command, cwd: workspace } : command;
21731
+ return {
21732
+ ...params,
21733
+ ...params.listCommand === void 0 ? {} : { listCommand: place(params.listCommand) },
21734
+ ...params.agent === void 0 ? {} : { agent: place(params.agent) },
21735
+ ...params.optionsAgent === void 0 ? {} : { optionsAgent: place(params.optionsAgent) }
21736
+ };
21737
+ }
21738
+ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker, dialectId) {
21682
21739
  const key = declaredSessionOptionsKey(agent, parameterizedModelPicker);
21683
21740
  const cached = freshDeclaredSessionOptions(key);
21684
21741
  if (cached !== null) {
@@ -21718,6 +21775,7 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
21718
21775
  );
21719
21776
  }, MODEL_LIST_TIMEOUT_MS);
21720
21777
  });
21778
+ let discoverySession = null;
21721
21779
  try {
21722
21780
  await Promise.race([
21723
21781
  (async () => {
@@ -21730,11 +21788,15 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
21730
21788
  env: childEnv,
21731
21789
  capabilities
21732
21790
  });
21733
- await connection.request({
21791
+ const newSession = await connection.request({
21734
21792
  method: "session/new",
21735
21793
  params: { cwd: agent.cwd ?? process.cwd(), mcpServers: [] },
21736
21794
  resultSchema: z48.unknown()
21737
21795
  });
21796
+ const sessionId = isJsonObject(newSession) ? newSession["sessionId"] : void 0;
21797
+ if (typeof sessionId === "string") {
21798
+ discoverySession = { capabilities, sessionId };
21799
+ }
21738
21800
  })(),
21739
21801
  timeoutReached
21740
21802
  ]);
@@ -21747,7 +21809,13 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
21747
21809
  if (timeout !== void 0) {
21748
21810
  clearTimeout(timeout);
21749
21811
  }
21750
- await connection.kill();
21812
+ await endDiscoveryConnection({
21813
+ connection,
21814
+ agent,
21815
+ env: childEnv,
21816
+ dialectId,
21817
+ session: discoverySession
21818
+ });
21751
21819
  }
21752
21820
  return settleDeclaredSessionOptions(key);
21753
21821
  }
@@ -21759,7 +21827,7 @@ function settleDeclaredSessionOptions(key) {
21759
21827
  cachedDeclaredSessionOptions = { key, options: [], fetchedAt: Date.now() };
21760
21828
  return [];
21761
21829
  }
21762
- async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds, parameterizedModelPicker) {
21830
+ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds, parameterizedModelPicker, dialectId) {
21763
21831
  const key = JSON.stringify({
21764
21832
  agent,
21765
21833
  reasoningProbePriorityModelIds,
@@ -21806,6 +21874,7 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
21806
21874
  }, MODEL_LIST_TIMEOUT_MS);
21807
21875
  });
21808
21876
  let discoveredCapabilities = null;
21877
+ let discoverySession = null;
21809
21878
  try {
21810
21879
  const newSession = await Promise.race([
21811
21880
  (async () => {
@@ -21819,11 +21888,13 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
21819
21888
  env: childEnv,
21820
21889
  capabilities
21821
21890
  });
21822
- return await connection.request({
21891
+ const created = await connection.request({
21823
21892
  method: "session/new",
21824
21893
  params: { cwd: agent.cwd ?? process.cwd(), mcpServers: [] },
21825
21894
  resultSchema: acpSessionNewResultSchema
21826
21895
  });
21896
+ discoverySession = { capabilities, sessionId: created.sessionId };
21897
+ return created;
21827
21898
  })(),
21828
21899
  timeoutReached
21829
21900
  ]);
@@ -21875,7 +21946,13 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
21875
21946
  if (timeout !== void 0) {
21876
21947
  clearTimeout(timeout);
21877
21948
  }
21878
- await connection.kill();
21949
+ await endDiscoveryConnection({
21950
+ connection,
21951
+ agent,
21952
+ env: childEnv,
21953
+ dialectId,
21954
+ session: discoverySession
21955
+ });
21879
21956
  settleDeclaredSessionOptions(
21880
21957
  declaredSessionOptionsKey(agent, parameterizedModelPicker)
21881
21958
  );
@@ -23570,9 +23647,14 @@ function decodeAcpBridgeJsonRpcRequest(raw) {
23570
23647
  };
23571
23648
  }
23572
23649
  async function handleModelList(id, params, dialectId) {
23650
+ const resolvedDialectId = resolveAcpDialect({
23651
+ dialectId,
23652
+ command: params.optionsAgent?.command ?? params.agent?.command ?? ""
23653
+ }).id;
23573
23654
  const declaredOptions = () => params.optionsAgent ? loadDeclaredSessionOptions(
23574
23655
  params.optionsAgent,
23575
- params.parameterizedModelPicker
23656
+ params.parameterizedModelPicker,
23657
+ resolvedDialectId
23576
23658
  ) : Promise.resolve([]);
23577
23659
  function withDeclaredOptions(models, options) {
23578
23660
  return options.length === 0 ? [...models] : models.map((model) => ({ ...model, sessionOptions: [...options] }));
@@ -23599,10 +23681,16 @@ async function handleModelList(id, params, dialectId) {
23599
23681
  );
23600
23682
  return;
23601
23683
  }
23602
- const sessionDiscoveredModels = params.listCommand === void 0 && params.agent ? await loadSessionDiscoveredModels(
23684
+ if (params.listCommand) {
23685
+ throw new Error(
23686
+ "ACP model list command failed to provide a model catalog."
23687
+ );
23688
+ }
23689
+ const sessionDiscoveredModels = params.agent ? await loadSessionDiscoveredModels(
23603
23690
  params.agent,
23604
23691
  params.reasoningProbePriorityModelIds,
23605
- params.parameterizedModelPicker
23692
+ params.parameterizedModelPicker,
23693
+ resolvedDialectId
23606
23694
  ) : null;
23607
23695
  if (sessionDiscoveredModels) {
23608
23696
  await sendModels(sessionDiscoveredModels);
@@ -23689,9 +23777,12 @@ async function handleRequest2(request) {
23689
23777
  );
23690
23778
  await handleModelList(
23691
23779
  request.id,
23692
- buildAcpModelListParams(
23693
- decodeLaunchSpec(request.params.providerOptions),
23694
- modelPicker
23780
+ inModelListWorkspace(
23781
+ buildAcpModelListParams(
23782
+ decodeLaunchSpec(request.params.providerOptions),
23783
+ modelPicker
23784
+ ),
23785
+ await resolveModelListWorkspace(request.params.cwd)
23695
23786
  ),
23696
23787
  decodeDialectId(request.params.providerOptions)
23697
23788
  );