@get-bb/plugin-sdk 0.4.24 → 0.4.27

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.
@@ -135,16 +135,7 @@ var canonicalPromptMentionResourceSchema = z2.discriminatedUnion("kind", [
135
135
  z2.object({
136
136
  kind: z2.literal("plugin"),
137
137
  pluginId: z2.string(),
138
- /**
139
- * Named shared-UI icon hint supplied by the plugin mention item. Omitted
140
- * by mentions persisted before icon hints were stored.
141
- */
142
138
  icon: z2.string().nullable().optional(),
143
- /**
144
- * Opaque item reference minted by the server's mention search
145
- * (`<providerId>:<provider item id>`); resolved back through the same
146
- * plugin's mention provider at send time (plugin design §4.9).
147
- */
148
139
  itemId: z2.string(),
149
140
  label: z2.string()
150
141
  })
@@ -183,21 +174,11 @@ var promptInputSchema = z2.discriminatedUnion("type", [
183
174
  }),
184
175
  z2.object({
185
176
  type: z2.literal("localImage"),
186
- /**
187
- * Absolute paths and URI-like values are passed through to the runtime.
188
- * Relative paths are server-managed attachment references, not workspace
189
- * relative files.
190
- */
191
177
  path: z2.string(),
192
178
  ...promptInputVisibilityFields
193
179
  }),
194
180
  z2.object({
195
181
  type: z2.literal("localFile"),
196
- /**
197
- * Absolute paths and URI-like values are passed through to the runtime.
198
- * Relative paths are server-managed attachment references, not workspace
199
- * relative files.
200
- */
201
182
  path: z2.string(),
202
183
  name: z2.string().optional(),
203
184
  sizeBytes: z2.number().int().nonnegative().optional(),
@@ -337,13 +318,7 @@ var runtimeThreadExecutionBaseOptionsSchema = z2.object({
337
318
  model: z2.string().min(1),
338
319
  serviceTier: serviceTierSchema,
339
320
  reasoningLevel: reasoningLevelSchema,
340
- /** Present only when the prompt entered a BB prompt mode. */
341
321
  promptMode: promptModeSchema.optional(),
342
- /**
343
- * Plugin-derived, provider-scoped options. Always present — an empty
344
- * object when the provider derives none — so the daemon never has to
345
- * guess whether the server ran the hook.
346
- */
347
322
  providerOptions: jsonObjectSchema
348
323
  });
349
324
  var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
@@ -642,7 +617,6 @@ var workflowAgentStateValues = [
642
617
  ];
643
618
  var workflowAgentStateSchema = z5.enum(workflowAgentStateValues);
644
619
  var workflowAgentSnapshotSchema = z5.object({
645
- /** 1-based agent counter; the stable identity for fold/replace semantics. */
646
620
  index: z5.number().int().positive(),
647
621
  label: z5.string(),
648
622
  state: workflowAgentStateSchema,
@@ -666,10 +640,8 @@ var workflowAgentSnapshotSchema = z5.object({
666
640
  durationMs: z5.number().optional()
667
641
  });
668
642
  var workflowPhaseSnapshotSchema = z5.object({
669
- /** 1-based phase counter; meta.phases are seeded before any agent runs. */
670
643
  index: z5.number().int().positive(),
671
644
  title: z5.string(),
672
- /** "child" marks a nested workflow() sub-run group. */
673
645
  kind: z5.string().optional()
674
646
  });
675
647
  var workflowProgressSnapshotSchema = z5.object({
@@ -702,9 +674,7 @@ function jsonByteLength(value) {
702
674
  import { z as z6 } from "zod";
703
675
  var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
704
676
  var threadEventItemPresentationLabelSchema = z6.object({
705
- /** Present-tense row title while the item is in flight ("Reading file"). */
706
677
  pending: z6.string().min(1),
707
- /** Past-tense row title once the item settled ("Read file"). */
708
678
  completed: z6.string().min(1)
709
679
  });
710
680
  var threadEventItemPresentationIconSchema = z6.object({
@@ -717,16 +687,9 @@ var threadEventItemPresentationTintSchema = z6.object({
717
687
  var threadEventItemPresentationSchema = z6.object({
718
688
  label: threadEventItemPresentationLabelSchema,
719
689
  icon: threadEventItemPresentationIconSchema,
720
- /** Row headline beside the label (a path, a query, a child thread title). */
721
690
  title: z6.string().optional(),
722
- /**
723
- * Short Markdown summary shown in the row body. Length-capped here so a
724
- * bridge cannot turn the persisted row into a transcript.
725
- */
726
691
  detail: z6.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
727
- /** Low-value rows (TodoWrite, ToolSearch) clients collapse by default. */
728
692
  suppress: z6.boolean().optional(),
729
- /** Accent colour per theme; omitted rows use the neutral row tint. */
730
693
  tint: threadEventItemPresentationTintSchema.optional()
731
694
  });
732
695
 
@@ -846,9 +809,7 @@ var pendingInteractionPermissionGrantApprovalSubjectSchema = z8.object({
846
809
  var pendingInteractionPlanApprovalSubjectSchema = z8.object({
847
810
  kind: z8.literal("plan"),
848
811
  itemId: z8.string().min(1),
849
- /** The plan body, as Markdown. */
850
812
  plan: z8.string().min(1),
851
- /** Where the provider saved the plan, or null when it kept it in memory. */
852
813
  planFilePath: z8.string().min(1).nullable()
853
814
  });
854
815
  var pendingInteractionToolUseApprovalSubjectSchema = z8.object({
@@ -1156,21 +1117,13 @@ var systemEventTypeValues = [
1156
1117
  "client/turn/rejected",
1157
1118
  "client/turn/start",
1158
1119
  "system/error",
1159
- // Legacy persisted user-visible system event from a removed runtime path.
1160
- // Retained for read/decode/render compatibility only.
1161
1120
  "system/manager/user_message",
1162
1121
  "system/thread/interrupted",
1163
1122
  "system/operation",
1164
1123
  "system/interaction/lifecycle",
1165
- // Legacy persisted per-shape interaction events; every status change now
1166
- // appends one `system/interaction/lifecycle`. Retained for read/decode
1167
- // only: `convertLegacyStoredThreadEvent` projects a stored row into the
1168
- // lifecycle event, so no consumer sees these types.
1169
1124
  "system/permissionGrant/lifecycle",
1170
1125
  "system/userQuestion/lifecycle",
1171
1126
  "system/thread-provisioning",
1172
- // Legacy persisted watchdog diagnostic; retained for read/decode/render
1173
- // only, with no current producer.
1174
1127
  "system/provider-turn-watchdog"
1175
1128
  ];
1176
1129
  var threadTurnInitiatorValues = ["user", "agent", "system"];
@@ -1222,18 +1175,10 @@ var clientTurnLifecycleEventDataSchema = z10.object({
1222
1175
  var turnRequestEventDataSchema = z10.object({
1223
1176
  direction: z10.literal("outbound"),
1224
1177
  requestId: clientTurnRequestIdSchema,
1225
- /** Failed request resumed by a guarded system continuation, when present. */
1226
1178
  continuationOfRequestId: clientTurnRequestIdSchema.optional(),
1227
1179
  source: z10.enum(["spawn", "tell"]),
1228
1180
  initiator: threadTurnInitiatorSchema,
1229
- // Non-null only when initiator === "agent". The invariant is enforced by
1230
- // writer typings rather than a schema refine so legacy persisted events
1231
- // (initiator: "agent", senderThreadId: null from before the field
1232
- // existed) still parse — the stored variant defaults both fields.
1233
1181
  senderThreadId: z10.string().nullable(),
1234
- // Family-B system-message taxonomy fields. Optional at the persisted-event
1235
- // level: legacy events (pre-taxonomy) lack them and must still parse. The
1236
- // projection defaults absent values to `unlabeled` / `null`.
1237
1182
  systemMessageKind: systemMessageKindSchema.optional(),
1238
1183
  systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
1239
1184
  input: z10.array(promptInputSchema),
@@ -1319,8 +1264,6 @@ var systemUserQuestionLifecycleEventDataSchema = z10.object({
1319
1264
  var systemThreadInterruptedReasonValues = [
1320
1265
  "manual-stop",
1321
1266
  "host-daemon-restarted",
1322
- // Legacy persisted watchdog interruption; retained for read/replay only,
1323
- // with no current producer.
1324
1267
  "provider-turn-idle"
1325
1268
  ];
1326
1269
  var systemThreadInterruptedReasonSchema = z10.enum(
@@ -1364,11 +1307,6 @@ var systemProviderTurnWatchdogEventDataSchema = z10.object({
1364
1307
  activeTurnId: z10.string().min(1),
1365
1308
  activeTurnStartedAt: z10.number().int().nonnegative(),
1366
1309
  lastActivityEventSequence: z10.number().int().positive(),
1367
- /**
1368
- * Diagnostic label only (the UI interpolates it verbatim). A plain string —
1369
- * not the activity enum — so editing event classifications never makes
1370
- * previously persisted watchdog events unparseable.
1371
- */
1372
1310
  lastActivityEventType: z10.string().min(1),
1373
1311
  lastActivityEventAt: z10.number().int().nonnegative(),
1374
1312
  providerId: z10.string().min(1),
@@ -1631,7 +1569,6 @@ var providerRateLimitStatusSchema = z13.enum([
1631
1569
  "unknown"
1632
1570
  ]);
1633
1571
  var providerRateLimitWindowSchema = z13.object({
1634
- /** Opaque provider-issued key. New provider windows must not break parsing. */
1635
1572
  providerKey: z13.string().min(1).nullable(),
1636
1573
  label: z13.string().min(1).nullable(),
1637
1574
  status: providerRateLimitStatusSchema,
@@ -1716,11 +1653,9 @@ var threadEventDelegationItemSchema = z13.object({
1716
1653
  type: z13.literal("delegation"),
1717
1654
  id: z13.string(),
1718
1655
  childRef: z13.string().min(1),
1719
- /** Human label for the delegated work (the child's description). */
1720
1656
  label: z13.string(),
1721
1657
  status: threadEventItemStatusSchema,
1722
1658
  background: z13.boolean(),
1723
- /** Terminal summary from the child; absent while it runs. */
1724
1659
  summary: z13.string().optional(),
1725
1660
  ...itemPresentationField,
1726
1661
  parentToolCallId: z13.string().optional()
@@ -1781,10 +1716,6 @@ var threadEventWarningCategorySchema = z13.enum([
1781
1716
  "deprecation",
1782
1717
  "config",
1783
1718
  "general",
1784
- /**
1785
- * The provider declined a compaction that bb asked for because there was
1786
- * nothing to compact. The warning settles the pending compaction row.
1787
- */
1788
1719
  "compaction-skipped"
1789
1720
  ]);
1790
1721
  var providerRawEventSchema = z13.object({
@@ -1813,28 +1744,15 @@ var toolCallProgressEventSchema = z13.object({
1813
1744
  var threadEventBackgroundTaskItemSchema = z13.object({
1814
1745
  type: z13.literal("backgroundTask"),
1815
1746
  id: z13.string(),
1816
- /**
1817
- * The provider's stable task id, shared by every generation (restart) of
1818
- * the same task; consumers use it to correlate a restarted task with its
1819
- * earlier generations. Absent only on events persisted before the field
1820
- * existed — those encoded the family in the item id's legacy `#N`
1821
- * generation suffix instead.
1822
- */
1823
1747
  familyId: z13.string().optional(),
1824
- /** Raw SDK task discriminant (e.g. "local_workflow"); "unknown" when the provider omitted it. */
1825
1748
  taskType: z13.string(),
1826
1749
  description: z13.string(),
1827
1750
  status: threadEventItemStatusSchema,
1828
1751
  taskStatus: backgroundTaskStatusSchema,
1829
- /** Ambient/housekeeping task; consumers hide it from the inline transcript. */
1830
1752
  skipTranscript: z13.boolean(),
1831
- /** meta.name of the workflow script; only present for workflow tasks. */
1832
1753
  workflowName: z13.string().optional(),
1833
- /** Merged workflow tree; absent until the provider reports progress records. */
1834
1754
  workflow: workflowProgressSnapshotSchema.optional(),
1835
- /** Absent until the provider reports usage. */
1836
1755
  usage: backgroundTaskUsageSchema.optional(),
1837
- /** Terminal summary from the provider; absent while the task runs. */
1838
1756
  summary: z13.string().optional(),
1839
1757
  error: z13.string().optional(),
1840
1758
  outputFile: z13.string().optional(),
@@ -1842,7 +1760,6 @@ var threadEventBackgroundTaskItemSchema = z13.object({
1842
1760
  parentToolCallId: z13.string().optional()
1843
1761
  });
1844
1762
  var threadEventItemSchema = z13.discriminatedUnion("type", [
1845
- // bb authors user messages itself, so they carry no bridge presentation.
1846
1763
  z13.object({
1847
1764
  type: z13.literal("userMessage"),
1848
1765
  id: z13.string(),
@@ -1864,10 +1781,6 @@ var threadEventItemSchema = z13.discriminatedUnion("type", [
1864
1781
  cwd: z13.string(),
1865
1782
  status: threadEventItemStatusSchema,
1866
1783
  approvalStatus: threadEventItemApprovalStatusSchema,
1867
- /**
1868
- * Omitted when the process produced no stdout/stderr. Adapters should omit
1869
- * this field instead of emitting an empty string placeholder.
1870
- */
1871
1784
  aggregatedOutput: z13.string().optional(),
1872
1785
  exitCode: z13.number().optional(),
1873
1786
  durationMs: z13.number().optional(),
@@ -1900,10 +1813,6 @@ var threadEventItemSchema = z13.discriminatedUnion("type", [
1900
1813
  error: z13.string().optional(),
1901
1814
  durationMs: z13.number().optional(),
1902
1815
  truncation: threadEventItemTruncationSchema.optional(),
1903
- /**
1904
- * The escape hatch for tools with no core kind: the bridge says how the
1905
- * row reads (label, glyph, headline, suppression).
1906
- */
1907
1816
  ...itemPresentationField,
1908
1817
  parentToolCallId: z13.string().optional()
1909
1818
  }),
@@ -1952,12 +1861,9 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
1952
1861
  z13.object({
1953
1862
  type: z13.literal("turn/completed"),
1954
1863
  threadId: z13.string(),
1955
- // Server reconciliation can synthesize interrupted completions when the
1956
- // original provider thread id was never persisted.
1957
1864
  providerThreadId: z13.string().nullable(),
1958
1865
  status: threadEventTurnStatusSchema,
1959
1866
  error: z13.object({ message: z13.string() }).optional(),
1960
- /** Provider-native point through which a replacement branch should retain history. */
1961
1867
  providerCheckpointId: z13.string().min(1).optional()
1962
1868
  }),
1963
1869
  z13.object({
@@ -2024,10 +1930,6 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2024
1930
  providerThreadId: z13.string(),
2025
1931
  itemId: z13.string(),
2026
1932
  delta: z13.string(),
2027
- /**
2028
- * When true, this delta replaces previously accumulated command output
2029
- * instead of appending to it. Omission means the delta appends.
2030
- */
2031
1933
  reset: z13.boolean().optional(),
2032
1934
  parentToolCallId: z13.string().optional()
2033
1935
  }),
@@ -2072,49 +1974,24 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2072
1974
  parentToolCallId: z13.string().optional()
2073
1975
  }),
2074
1976
  toolCallProgressEventSchema,
2075
- /**
2076
- * Superseding state snapshot for an in-flight background task. Thread-scoped
2077
- * (not turn-scoped) because tasks outlive their spawning turn: late events
2078
- * must not interleave into later turns' sequence-contiguous windows. Each
2079
- * progress event carries the full current item state; consumers replace, not
2080
- * merge. The item is placed in the timeline by its turn-scoped item/started.
2081
- */
2082
1977
  z13.object({
2083
1978
  type: z13.literal("item/backgroundTask/progress"),
2084
1979
  threadId: z13.string(),
2085
1980
  providerThreadId: z13.string(),
2086
1981
  item: threadEventBackgroundTaskItemSchema
2087
1982
  }),
2088
- /**
2089
- * Terminal state for a background task, carrying the full final item
2090
- * payload. Dedicated event (instead of the generic turn-scoped
2091
- * item/completed) because it may arrive turns after the item/started.
2092
- */
2093
1983
  z13.object({
2094
1984
  type: z13.literal("item/backgroundTask/completed"),
2095
1985
  threadId: z13.string(),
2096
1986
  providerThreadId: z13.string(),
2097
1987
  item: threadEventBackgroundTaskItemSchema
2098
1988
  }),
2099
- /**
2100
- * Superseding snapshot for an in-flight background delegation (`background:
2101
- * true`). Thread-scoped for the same reason as `item/backgroundTask/
2102
- * progress`: a background child outlives its spawning turn, and late events
2103
- * must not interleave into later turns' sequence-contiguous windows. The
2104
- * item is placed in the timeline by its turn-scoped `item/started`.
2105
- */
2106
1989
  z13.object({
2107
1990
  type: z13.literal("item/delegation/progress"),
2108
1991
  threadId: z13.string(),
2109
1992
  providerThreadId: z13.string(),
2110
1993
  item: threadEventDelegationItemSchema
2111
1994
  }),
2112
- /**
2113
- * Terminal state for a background delegation, carrying the full final item.
2114
- * Dedicated event (instead of the turn-scoped `item/completed`) because it
2115
- * may arrive turns after the `item/started`. Foreground delegations settle
2116
- * through `item/completed`.
2117
- */
2118
1995
  z13.object({
2119
1996
  type: z13.literal("item/delegation/completed"),
2120
1997
  threadId: z13.string(),
@@ -2161,16 +2038,6 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2161
2038
  providerThreadId: z13.string(),
2162
2039
  rateLimits: providerRateLimitStateSchema
2163
2040
  }),
2164
- /**
2165
- * Plugin-declared thread state (grammar v3): a `"<pluginId>/<name>"` kind
2166
- * beside the core thread-state family (usage, context window, rate limits,
2167
- * model fallback, context cleared). Latest snapshot wins per `kind`: a
2168
- * bridge re-sends the whole state, never a diff, and a consumer keeps one
2169
- * value per kind. The server validated `payload` against the owning
2170
- * plugin's declared `state` schema at ingest; a payload that failed that
2171
- * check was persisted as `provider/unhandled` instead, so every stored row
2172
- * of this type carries a payload its plugin vouched for.
2173
- */
2174
2041
  z13.object({
2175
2042
  type: z13.literal("thread/extensionState/updated"),
2176
2043
  threadId: z13.string(),
@@ -2326,8 +2193,6 @@ var availableModelSchema = z15.object({
2326
2193
  id: z15.string(),
2327
2194
  model: z15.string(),
2328
2195
  displayName: z15.string(),
2329
- /** Provider route used to run this model when it is distinct from the
2330
- * selected agent provider (for example, a model provider nested under Pi). */
2331
2196
  routeProviderId: z15.string().min(1).optional(),
2332
2197
  description: z15.string(),
2333
2198
  supportedReasoningEfforts: z15.array(modelReasoningEffortSchema),
@@ -2341,20 +2206,8 @@ var providerCapabilitiesSchema = z15.object({
2341
2206
  supportsServiceTier: z15.boolean(),
2342
2207
  supportsNativeUserQuestion: z15.boolean(),
2343
2208
  supportsFork: z15.boolean(),
2344
- /**
2345
- * The provider can recreate a session at an earlier point, which is what
2346
- * edit-past-message rewind needs. Separate from `supportsFork`: ACP clones
2347
- * whole sessions (tip-only) and cannot stop at a checkpoint.
2348
- */
2349
2209
  supportsSessionRewind: z15.boolean(),
2350
2210
  permissionModes: z15.array(permissionModeSchema).min(1),
2351
- /**
2352
- * How far one `model/list` answer travels: `"host"` when the bridge answers
2353
- * from account or agent state and ignores the workspace path, so bb probes
2354
- * once per machine; `"workspace"` when project configuration can change the
2355
- * answer. Declared by the provider's plugin — core never infers it from an
2356
- * id.
2357
- */
2358
2211
  modelCatalogScope: providerModelCatalogScopeSchema
2359
2212
  });
2360
2213
  var providerComposerCommandSchema = z15.object({
@@ -2377,17 +2230,11 @@ var providerComposerActionSchema = z15.discriminatedUnion("kind", [
2377
2230
  })
2378
2231
  ]);
2379
2232
  var providerStringsSchema = z15.object({
2380
- /** How to sign in on the host ("Run `claude` on the machine to sign in."). */
2381
2233
  signInHint: z15.string().min(1),
2382
- /** Shown when a session's credentials expired. */
2383
2234
  expiredHint: z15.string().min(1),
2384
- /** Where to install the agent. */
2385
2235
  installUrl: z15.string().min(1),
2386
- /** Brand prefix stripped from model display names ("Claude "). */
2387
2236
  brandPrefix: z15.string().min(1).optional(),
2388
- /** Plan-mode banner copy for providers that declare the `plan` action. */
2389
2237
  planModeCopy: z15.string().min(1).optional(),
2390
- /** Per-theme tint for the provider icon. */
2391
2238
  iconTint: z15.object({ light: z15.string().min(1), dark: z15.string().min(1) }).optional()
2392
2239
  });
2393
2240
  var providerOptionDescriptorSchema = z15.object({
@@ -2405,31 +2252,11 @@ var providerExtensionKindsSchema = z15.record(
2405
2252
  );
2406
2253
  var providerInfoSchema = z15.object({
2407
2254
  id: z15.string(),
2408
- /**
2409
- * The plugin that registered the provider (`bb.providers.register`). The
2410
- * owner of the provider's extension-kind namespace, and the bundle the
2411
- * app loads on the first thread of this provider.
2412
- */
2413
2255
  pluginId: z15.string().min(1),
2414
2256
  displayName: z15.string(),
2415
- /**
2416
- * Declared grouping key shared by related providers (the ACP agents).
2417
- * Absent when the provider declared none. Grouping only.
2418
- */
2419
2257
  family: z15.string().min(1).optional(),
2420
- /**
2421
- * The declared icon, projected by form. A plugin-relative asset path
2422
- * (`icon: "./icons/agent.svg"`) is served by the provider-logo route and
2423
- * arrives here as `logoUrl`; a named host glyph (`icon: "Zap"`) has no
2424
- * bytes to serve and arrives as `icon.glyph`, the same vocabulary an
2425
- * item presentation's `icon` uses. A declaration names at most one form,
2426
- * so at most one of the two is set; `icon` is absent when the declaration
2427
- * named a path or nothing. Clients draw a vendored brand mark first, then
2428
- * `logoUrl`, then `icon.glyph`, then the display name's initial.
2429
- */
2430
2258
  icon: z15.object({ glyph: z15.string().min(1) }).optional(),
2431
2259
  logoUrl: z15.string().min(1).nullable(),
2432
- /** Sessionless maintenance requests the provider's bridge implements. */
2433
2260
  maintenance: z15.object({
2434
2261
  health: z15.boolean(),
2435
2262
  usage: z15.boolean(),
@@ -2438,13 +2265,6 @@ var providerInfoSchema = z15.object({
2438
2265
  capabilities: providerCapabilitiesSchema,
2439
2266
  composerActions: z15.array(providerComposerActionSchema),
2440
2267
  available: z15.boolean(),
2441
- // -------------------------------------------------------------------------
2442
- // Target-state projection (docs/provider-plugin-api.md §1). Optional and
2443
- // unfilled until WS2a projects them from the plugin declaration; absence
2444
- // means "the provider declared none", never a default. The
2445
- // `capabilities.supports*` fields above stay until WS2a stabilizes the
2446
- // surface as one unit.
2447
- // -------------------------------------------------------------------------
2448
2268
  strings: providerStringsSchema.optional(),
2449
2269
  serviceTiers: z15.array(providerOptionDescriptorSchema).optional(),
2450
2270
  reasoningLevels: z15.array(providerOptionDescriptorSchema).optional(),
@@ -2585,88 +2405,22 @@ var bridgeGrammarVersionsSchema = z17.tuple([z17.number().int().positive(), z17.
2585
2405
  });
2586
2406
  var bridgeSteerModeSchema = z17.enum(["inject", "queue"]);
2587
2407
  var bridgeCapabilitiesSchema = z17.object({
2588
- /**
2589
- * A released session can be re-attached later from its persisted
2590
- * providerThreadId. The per-session `sessionRestorable` flag on
2591
- * thread-identity results refines this (an agent update can drop restore
2592
- * support mid-flight); this handshake value is the default for sessions
2593
- * that do not say.
2594
- */
2595
2408
  sessionRestore: z17.boolean().default(false),
2596
- /**
2597
- * The bridge mirrors bb archive state into the provider's own session
2598
- * list. When false the runtime never sends thread/archive or
2599
- * thread/unarchive.
2600
- */
2601
2409
  threadArchive: z17.boolean().default(false),
2602
- /**
2603
- * The bridge pushes bb thread titles to the provider. When false the
2604
- * runtime never sends thread/name/set.
2605
- */
2606
2410
  threadRename: z17.boolean().default(false),
2607
- /** The bridge supports thread/goal/clear. */
2608
2411
  threadGoalClear: z17.boolean().default(false),
2609
- /**
2610
- * Session cloning support ({@link providerForkSchema} — the same
2611
- * vocabulary the provider declaration uses). The declaration is a ceiling
2612
- * for UI affordances; this is the operative truth, and it may only narrow
2613
- * the declaration, never widen it.
2614
- */
2615
2412
  fork: providerForkSchema.default("none"),
2616
- /**
2617
- * Where the thread's approval policy is enforced. "runtime" bridges
2618
- * forward every approval request and the runtime applies the thread
2619
- * policy (including auto-deny). "provider" bridges enforce policy before
2620
- * forwarding, so every forwarded request is already known to need user
2621
- * input and the runtime must not reclassify it against mutable thread
2622
- * settings.
2623
- */
2624
2413
  approvalEnforcedBy: z17.enum(["runtime", "provider"]).default("runtime"),
2625
- /**
2626
- * The `thread/delta` grammar range this bridge speaks. A bridge that says
2627
- * nothing is read as speaking exactly the protocol version it negotiated,
2628
- * so the default is `[2, 2]` — never a wider range it never claimed.
2629
- * Every bridge in this repo emits v3 and reports `[3, 3]`, and the
2630
- * runtime's assembler speaks `[3, 3]` only (`ASSEMBLER_GRAMMAR_VERSIONS`),
2631
- * so a bridge that takes the default is refused at startup: the two
2632
- * ranges must intersect ({@link negotiateGrammarVersion}) and both sides
2633
- * emit the highest common version.
2634
- */
2635
2414
  grammarVersions: bridgeGrammarVersionsSchema.default([
2636
2415
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
2637
2416
  PROVIDER_BRIDGE_PROTOCOL_VERSION
2638
2417
  ]),
2639
- /**
2640
- * Mid-turn steer delivery ({@link bridgeSteerModeSchema}). Defaults to
2641
- * `queue`, the conservative reading: absence is the definite "no" the
2642
- * rest of this handshake uses, and `inject` is the stronger promise (the
2643
- * steer reaches the model before the turn ends) a bridge must make
2644
- * explicitly. Nothing in the runtime, server, or clients reads it today:
2645
- * `turn/steer` is sent either way, and a steer whose turn is gone is
2646
- * dropped on the bridge's `staleTurn` recovery hint or `NO_ACTIVE_TURN`
2647
- * error (`steerTurn` in @bb/agent-runtime), whatever the mode. claude,
2648
- * codex, and pi declare `inject`; ACP and the echo example declare
2649
- * `queue`.
2650
- */
2651
2418
  steerMode: bridgeSteerModeSchema.default("queue"),
2652
- /**
2653
- * Which optional requests the bridge handles. `skills.configure`: the
2654
- * bridge accepts `skills/configure` (bb's injected skill roots). When
2655
- * false the runtime never sends it, so a bridge that answers unknown
2656
- * methods with METHOD_NOT_FOUND — as the protocol instructs — still
2657
- * starts threads; it simply runs without injected skills. A bridge that
2658
- * handles the request declares it; the runtime never probes.
2659
- */
2660
2419
  skills: z17.object({ configure: z17.boolean().default(false) }).default({ configure: false })
2661
2420
  }).passthrough();
2662
2421
  var initializeParamsSchema = z17.object({
2663
2422
  protocolVersion: z17.number().int().positive(),
2664
2423
  client: z17.object({ name: z17.string().min(1), version: z17.string().min(1) }),
2665
- /**
2666
- * The `thread/delta` grammar range the runtime's assembler accepts (see
2667
- * {@link negotiateGrammarVersion}). A runtime that predates the field
2668
- * reads as speaking exactly its protocol version.
2669
- */
2670
2424
  grammarVersions: bridgeGrammarVersionsSchema.default([
2671
2425
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
2672
2426
  PROVIDER_BRIDGE_PROTOCOL_VERSION
@@ -2674,8 +2428,6 @@ var initializeParamsSchema = z17.object({
2674
2428
  }).passthrough();
2675
2429
  var initializeResultSchema = z17.object({
2676
2430
  protocolVersion: z17.number().int().positive(),
2677
- // An absent capabilities block reads as "no capabilities" via the inner
2678
- // per-field defaults, so older bridges parse to explicit values.
2679
2431
  capabilities: z17.preprocess(
2680
2432
  (value) => value ?? {},
2681
2433
  bridgeCapabilitiesSchema
@@ -2688,16 +2440,9 @@ var bridgeExecutionOptionsSchema = z18.object({
2688
2440
  model: z18.string().min(1).optional(),
2689
2441
  serviceTier: serviceTierSchema.optional(),
2690
2442
  reasoningLevel: reasoningLevelSchema.optional(),
2691
- /**
2692
- * BB prompt mode (`"plan"`), present only when the prompt entered one
2693
- * through the provider's declared composer action. Each bridge maps it
2694
- * onto the agent's native equivalent.
2695
- */
2696
2443
  promptMode: promptModeSchema.optional(),
2697
- /** Frozen for the life of a provider session; applied at construction. */
2698
2444
  instructions: z18.string().optional(),
2699
2445
  envVars: z18.record(z18.string(), z18.string()).optional(),
2700
- /** Provider-scoped session options. Opaque outside the owning bridge. */
2701
2446
  providerOptions: z18.record(z18.string(), z18.unknown()).optional()
2702
2447
  }).and(runtimePermissionPolicySchema);
2703
2448
 
@@ -2708,9 +2453,7 @@ var providerMaintenanceParamsSchema = z19.object({
2708
2453
  cwd: z19.string().min(1).optional(),
2709
2454
  providerOptions: z19.record(z19.string(), z19.unknown()).optional()
2710
2455
  }).passthrough();
2711
- var providerInstallationRequirementSchema = z19.enum([
2712
- "thread_rewind"
2713
- ]);
2456
+ var providerInstallationRequirementSchema = z19.enum(["thread_rewind"]);
2714
2457
  var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
2715
2458
  requirement: providerInstallationRequirementSchema.optional()
2716
2459
  });
@@ -2758,26 +2501,20 @@ var providerUsageSchema = z19.discriminatedUnion("status", [
2758
2501
  accountEmail: z19.string().nullable().default(null)
2759
2502
  }).passthrough()
2760
2503
  ]);
2761
- var providerHealthResultSchema = z19.discriminatedUnion(
2762
- "supported",
2763
- [
2764
- z19.object({ supported: z19.literal(false) }).passthrough(),
2765
- z19.object({
2766
- supported: z19.literal(true),
2767
- health: providerHealthSchema
2768
- }).passthrough()
2769
- ]
2770
- );
2771
- var providerUsageResultSchema = z19.discriminatedUnion(
2772
- "supported",
2773
- [
2774
- z19.object({ supported: z19.literal(false) }).passthrough(),
2775
- z19.object({
2776
- supported: z19.literal(true),
2777
- usage: providerUsageSchema
2778
- }).passthrough()
2779
- ]
2780
- );
2504
+ var providerHealthResultSchema = z19.discriminatedUnion("supported", [
2505
+ z19.object({ supported: z19.literal(false) }).passthrough(),
2506
+ z19.object({
2507
+ supported: z19.literal(true),
2508
+ health: providerHealthSchema
2509
+ }).passthrough()
2510
+ ]);
2511
+ var providerUsageResultSchema = z19.discriminatedUnion("supported", [
2512
+ z19.object({ supported: z19.literal(false) }).passthrough(),
2513
+ z19.object({
2514
+ supported: z19.literal(true),
2515
+ usage: providerUsageSchema
2516
+ }).passthrough()
2517
+ ]);
2781
2518
  var providerInstallationActionKindSchema = z19.enum([
2782
2519
  "install",
2783
2520
  "update"
@@ -2814,28 +2551,34 @@ var providerInstallationCommandSchema = z19.object({
2814
2551
  args: z19.array(z19.string()).max(64),
2815
2552
  displayCommand: z19.string().min(1)
2816
2553
  }).passthrough();
2817
- var providerInstallationVerificationSchema = z19.discriminatedUnion("kind", [
2818
- z19.object({ kind: z19.literal("installed") }).passthrough(),
2819
- z19.object({
2820
- kind: z19.literal("version_changed"),
2821
- previousVersion: z19.string().min(1)
2822
- }).passthrough(),
2823
- z19.object({
2824
- kind: z19.literal("version_at_least"),
2825
- version: z19.string().min(1)
2826
- }).passthrough()
2827
- ]);
2828
- var providerInstallationRunResultSchema = z19.discriminatedUnion("available", [
2829
- z19.object({
2830
- available: z19.literal(false),
2831
- message: z19.string().min(1)
2832
- }).passthrough(),
2833
- z19.object({
2834
- available: z19.literal(true),
2835
- command: providerInstallationCommandSchema,
2836
- verification: providerInstallationVerificationSchema
2837
- }).passthrough()
2838
- ]);
2554
+ var providerInstallationVerificationSchema = z19.discriminatedUnion(
2555
+ "kind",
2556
+ [
2557
+ z19.object({ kind: z19.literal("installed") }).passthrough(),
2558
+ z19.object({
2559
+ kind: z19.literal("version_changed"),
2560
+ previousVersion: z19.string().min(1)
2561
+ }).passthrough(),
2562
+ z19.object({
2563
+ kind: z19.literal("version_at_least"),
2564
+ version: z19.string().min(1)
2565
+ }).passthrough()
2566
+ ]
2567
+ );
2568
+ var providerInstallationRunResultSchema = z19.discriminatedUnion(
2569
+ "available",
2570
+ [
2571
+ z19.object({
2572
+ available: z19.literal(false),
2573
+ message: z19.string().min(1)
2574
+ }).passthrough(),
2575
+ z19.object({
2576
+ available: z19.literal(true),
2577
+ command: providerInstallationCommandSchema,
2578
+ verification: providerInstallationVerificationSchema
2579
+ }).passthrough()
2580
+ ]
2581
+ );
2839
2582
 
2840
2583
  // ../provider-bridge-protocol/src/requests.ts
2841
2584
  import { z as z20 } from "zod";
@@ -2859,24 +2602,12 @@ var threadResumeParamsSchema = z20.object({
2859
2602
  var threadForkParamsSchema = z20.object({
2860
2603
  ...sessionConstructionFields,
2861
2604
  sourceProviderThreadId: z20.string().min(1),
2862
- /**
2863
- * Absent means fork at the tip. Bridges whose handshake advertises
2864
- * `fork: "tip"` reject a request carrying a checkpoint instead of
2865
- * silently cloning more history than the bb timeline shows.
2866
- */
2867
2605
  sourceProviderCheckpointId: z20.string().min(1).optional()
2868
2606
  }).passthrough();
2869
2607
  var threadStopParamsSchema = z20.object({
2870
2608
  threadId: z20.string().min(1),
2871
2609
  providerThreadId: z20.string().min(1),
2872
- /**
2873
- * "interrupt" stops an active turn and settles it as interrupted.
2874
- * "release" detaches an idle session so its resources can be reclaimed;
2875
- * it must never fabricate an interruption. One verb serving both intents
2876
- * is the #1584 incident — the field is required.
2877
- */
2878
2610
  intent: z20.enum(["interrupt", "release"]),
2879
- /** Non-null when the stop interrupts an active provider turn. */
2880
2611
  activeTurnId: z20.string().min(1).nullable()
2881
2612
  }).passthrough();
2882
2613
  var threadRefParams = z20.object({
@@ -2916,7 +2647,6 @@ var skillsConfigureParamsSchema = z20.object({
2916
2647
  }).passthrough();
2917
2648
  var threadIdentityResultSchema = z20.object({
2918
2649
  providerThreadId: z20.string().min(1),
2919
- /** Refines the handshake's `sessionRestore` for this session. */
2920
2650
  sessionRestorable: z20.boolean().optional()
2921
2651
  }).passthrough();
2922
2652
  var modelListResultSchema = z20.object({
@@ -2930,17 +2660,11 @@ import { z as z22 } from "zod";
2930
2660
  // ../provider-bridge-protocol/src/errors.ts
2931
2661
  import { z as z21 } from "zod";
2932
2662
  var BRIDGE_JSON_RPC_ERRORS = {
2933
- /** Standard JSON-RPC: params failed schema validation. */
2934
2663
  INVALID_PARAMS: -32602,
2935
- /** Standard JSON-RPC: method not implemented by this bridge. */
2936
2664
  METHOD_NOT_FOUND: -32601,
2937
- /** Generic bridge failure. */
2938
2665
  BRIDGE_ERROR: -32e3,
2939
- /** A turn/steer arrived but the session has no active turn. */
2940
2666
  NO_ACTIVE_TURN: -32001,
2941
- /** thread/resume for a session the provider can no longer restore. */
2942
2667
  SESSION_NOT_RESTORABLE: -32002,
2943
- /** thread/fork with a checkpoint on a bridge that only forks at the tip. */
2944
2668
  FORK_CHECKPOINT_UNSUPPORTED: -32003
2945
2669
  };
2946
2670
  var providerRecoveryHintSchema = z21.object({
@@ -2961,16 +2685,12 @@ var BRIDGE_NOTIFICATION_METHODS = {
2961
2685
  var threadIdentityNotificationSchema = z22.object({
2962
2686
  threadId: z22.string().min(1),
2963
2687
  providerThreadId: z22.string().min(1),
2964
- /** Refines the handshake's `sessionRestore` for this session. */
2965
2688
  sessionRestorable: z22.boolean().optional()
2966
2689
  }).passthrough();
2967
2690
  var sessionReplacedNotificationSchema = z22.object({
2968
2691
  threadId: z22.string().min(1),
2969
- /** Identity of the replacement session (may equal the old identity). */
2970
2692
  providerThreadId: z22.string().min(1).nullable(),
2971
- /** Human-readable cause, shown in the timeline. */
2972
2693
  reason: z22.string().min(1),
2973
- /** True when provider-side context did not survive the replacement. */
2974
2694
  contextLost: z22.boolean().default(false)
2975
2695
  }).passthrough();
2976
2696
  var providerRawNotificationSchema = z22.object({
@@ -3018,14 +2738,6 @@ var interactionRequestParamsSchema = z23.object({
3018
2738
  threadId: z23.string().min(1).optional(),
3019
2739
  turnId: z23.union([z23.string().min(1), z23.null()]),
3020
2740
  payload: pendingInteractionPayloadSchema,
3021
- /**
3022
- * The request's turn id and approval-subject item ids are in the
3023
- * provider's native id space (a `thread/delta` bridge holds no bb ids):
3024
- * the runtime adapter translates them through the delta assembler's maps
3025
- * before the interaction reaches the app. Omission means the ids are
3026
- * already app-visible (bridges whose approval subjects never referenced
3027
- * timeline ids — ACP's approval ids never matched timeline ids).
3028
- */
3029
2741
  providerNativeIds: z23.boolean().optional()
3030
2742
  }).passthrough();
3031
2743
 
@@ -3045,24 +2757,14 @@ var deltaItemKeySchema = z24.object({
3045
2757
  var providerTurnIdSchema = deltaKeyPartSchema;
3046
2758
  var deltaFileChangeSchema = z24.object({
3047
2759
  path: z24.string(),
3048
- /** The bridge states the change kind; the assembler never derives it. */
3049
2760
  kind: z24.enum(["add", "update", "delete"]),
3050
2761
  movePath: z24.string().optional(),
3051
- /** Provider-supplied unified diff; preferred over old/new text building. */
3052
2762
  diff: z24.string().optional(),
3053
2763
  oldText: z24.string().optional(),
3054
- /** When present the assembler builds the unified diff from old/new text. */
3055
2764
  newText: z24.string().optional()
3056
2765
  });
3057
2766
  var deltaBackgroundTaskShapeSchema = z24.object({
3058
2767
  type: z24.literal("backgroundTask"),
3059
- /**
3060
- * The provider's stable task id, shared by every generation (restart) of
3061
- * the same task. Rides through to the canonical item so consumers can
3062
- * correlate a restarted task with its earlier generations — the assembler
3063
- * mints fresh item ids per generation, so identity must travel as data,
3064
- * never as id text.
3065
- */
3066
2768
  familyId: z24.string().min(1),
3067
2769
  taskType: z24.string(),
3068
2770
  description: z24.string(),
@@ -3116,20 +2818,8 @@ var deltaItemShapeSchema = z24.discriminatedUnion("type", [
3116
2818
  }),
3117
2819
  z24.object({
3118
2820
  type: z24.literal("fileChange"),
3119
- /** Empty while a path is not yet known, including bare close fallbacks. */
3120
2821
  changes: z24.array(deltaFileChangeSchema)
3121
2822
  }),
3122
- /**
3123
- * The generic tool call: the escape hatch for tools with no core kind. In
3124
- * grammar v3 the bridge says how the row reads through the delta's
3125
- * `presentation` (label, icon, suppression) instead of core keeping a
3126
- * tool-name table. A `tool` item without presentation is read as legacy
3127
- * data: `@bb/domain`'s `upgradeLegacyToolItem` reshapes read/grep/glob/
3128
- * find/ls by name and suppresses the Task- and Todo-family bookkeeping
3129
- * calls when the stored row is parsed, and any other name renders with
3130
- * the generic tool row — until the backfill migration, after which
3131
- * `presentation` is required.
3132
- */
3133
2823
  z24.object({
3134
2824
  type: z24.literal("tool"),
3135
2825
  tool: z24.string(),
@@ -3159,7 +2849,6 @@ var deltaItemShapeSchema = z24.discriminatedUnion("type", [
3159
2849
  }),
3160
2850
  z24.object({ type: z24.literal("imageView"), path: z24.string() }),
3161
2851
  deltaBackgroundTaskShapeSchema,
3162
- // Grammar v3 shapes. Every existing shape above is kept unchanged.
3163
2852
  deltaFileReadShapeSchema,
3164
2853
  deltaSearchShapeSchema,
3165
2854
  deltaDelegationShapeSchema,
@@ -3193,51 +2882,21 @@ function requireExtensionPresentation(delta, ctx) {
3193
2882
  }
3194
2883
  }
3195
2884
  var threadDeltaSchema = z24.discriminatedUnion("kind", [
3196
- /**
3197
- * The provider consumed an input (immediate or steered). The assembler owns
3198
- * the queue-until-turn-opens behavior and the terminal-turn invariant.
3199
- * With `providerTurnId` the acceptance is emitted against that vouched turn
3200
- * directly (codex correlates acceptance to a named native turn).
3201
- */
3202
2885
  z24.object({
3203
2886
  kind: z24.literal("input.accepted"),
3204
2887
  clientRequestId: clientTurnRequestIdSchema,
3205
2888
  providerTurnId: providerTurnIdSchema.optional()
3206
2889
  }),
3207
- /**
3208
- * Input the provider itself injected into the conversation, with no bb
3209
- * client request behind it (a pi extension's `sendMessage` custom message
3210
- * that triggered or steered a turn). The assembler records it as a
3211
- * `userMessage` item in the open turn so the transcript shows what the
3212
- * model was answering. Dropped silently when no turn is open: the provider
3213
- * appended it to its own context without running the agent, so there is no
3214
- * bb turn to attach it to.
3215
- */
3216
2890
  z24.object({
3217
2891
  kind: z24.literal("input.provider"),
3218
2892
  text: z24.string().min(1),
3219
2893
  parentRef: deltaKeyPartSchema.optional()
3220
2894
  }),
3221
- /**
3222
- * An explicit provider signal opened work (pi `agent_start`, codex
3223
- * `turn/started`). With `providerTurnId` the turn lives in the keyed
3224
- * provider-turn space: several may be open at once (codex multiplexes
3225
- * subagent child turns onto one thread) and none of the current-turn
3226
- * machinery is touched.
3227
- */
3228
2895
  z24.object({
3229
2896
  kind: z24.literal("turn.open"),
3230
2897
  providerTurnId: providerTurnIdSchema.optional(),
3231
- /** Provider-native parent tool-call id for delegated child turns. */
3232
2898
  parentRef: deltaKeyPartSchema.optional()
3233
2899
  }),
3234
- /**
3235
- * The bridge's conclusion that the turn settled. `claimIfIdle: true` marks
3236
- * fallback closers that own a turn only if accepted input is pending
3237
- * (the old bridge-kit terminal-turn rule, applied centrally); an open turn is
3238
- * always settled. A keyed boundary (`providerTurnId`) always emits — the
3239
- * provider named the turn — and settles only that turn.
3240
- */
3241
2900
  z24.object({
3242
2901
  kind: z24.literal("turn.boundary"),
3243
2902
  status: threadEventTurnStatusSchema,
@@ -3246,40 +2905,15 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3246
2905
  claimIfIdle: z24.boolean().optional(),
3247
2906
  providerTurnId: providerTurnIdSchema.optional()
3248
2907
  }),
3249
- /**
3250
- * A parsed item opened. `attach: "currentOrLast"` pins the item to the turn
3251
- * that is open or just closed without opening a new one (pi threshold
3252
- * compaction); the default attaches to the open turn only. A known
3253
- * `providerItemId` reuses its minted bb id (an explicit open reopens the
3254
- * same item, codex's settle/reopen rule).
3255
- */
3256
2908
  z24.object({
3257
2909
  kind: z24.literal("item.open"),
3258
2910
  key: deltaItemKeySchema,
3259
2911
  item: deltaItemShapeSchema,
3260
- /**
3261
- * Grammar v3: how the row reads, persisted with the opened item. The
3262
- * one place presentation travels. Optional for core shapes while v2
3263
- * deltas are accepted; REQUIRED for `extension` shapes.
3264
- */
3265
2912
  presentation: deltaPresentationSchema.optional(),
3266
2913
  attach: deltaAttachSchema.optional(),
3267
2914
  providerTurnId: providerTurnIdSchema.optional(),
3268
2915
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3269
2916
  }).superRefine(requireExtensionPresentation),
3270
- /**
3271
- * The item settled. `item` is REQUIRED and always carries the full terminal
3272
- * item shape (Michael's uniform close rule, 2026-08-18): the assembler
3273
- * builds the completed item from it. With a same-shaped item open under the
3274
- * key, the terminal shape wins and the opened item contributes only its
3275
- * minted id; with a different-shaped item open, the assembler closes the
3276
- * opened shape and then emits the terminal shape (ACP's dual-complete);
3277
- * with nothing open it builds the bare completed item.
3278
- *
3279
- * Provider-identified closes (`key.providerItemId`) dedup: a repeated close
3280
- * for a settled id is dropped and an explicit `item.open` reopens the id
3281
- * (codex retries the terminal notification after approvals).
3282
- */
3283
2917
  z24.object({
3284
2918
  kind: z24.literal("item.close"),
3285
2919
  key: deltaItemKeySchema,
@@ -3287,32 +2921,12 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3287
2921
  resultText: z24.string().optional(),
3288
2922
  exitCode: z24.number().optional(),
3289
2923
  aggregatedOutput: z24.string().optional(),
3290
- /** Terminal approval verdict (codex declined → denied). Default null. */
3291
2924
  approvalStatus: z24.literal("denied").optional(),
3292
2925
  item: deltaItemShapeSchema,
3293
- /**
3294
- * Grammar v3: the terminal presentation. Like `item`, the close carries
3295
- * the full terminal form; when absent the opened item's presentation
3296
- * survives onto the completed item (close-echo). REQUIRED for an
3297
- * `extension` shape, which has nothing to echo without it.
3298
- */
3299
2926
  presentation: deltaPresentationSchema.optional(),
3300
2927
  providerTurnId: providerTurnIdSchema.optional(),
3301
2928
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3302
2929
  }).superRefine(requireExtensionPresentation),
3303
- /**
3304
- * Free-form progress on an open item (non-command tool updates), or — with
3305
- * `snapshot` — a re-embedded snapshot of work that outlives its turn: a
3306
- * background task (`item/backgroundTask/progress`) or, in grammar v3, a
3307
- * background delegation (`item/delegation/progress`); both thread-scoped,
3308
- * no turn required.
3309
- *
3310
- * Progress is throttled centrally by the assembler (one emission per item
3311
- * key per policy interval, 500ms default; the newest suppressed snapshot is
3312
- * flushed trailing-edge on the thread's next traffic once the window
3313
- * elapses, and an `item.close` supersedes it). `flush: true` bypasses the
3314
- * throttle and resets the window — status transitions must land immediately.
3315
- */
3316
2930
  z24.object({
3317
2931
  kind: z24.literal("item.progress"),
3318
2932
  key: deltaItemKeySchema,
@@ -3322,17 +2936,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3322
2936
  providerTurnId: providerTurnIdSchema.optional(),
3323
2937
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3324
2938
  }),
3325
- /**
3326
- * Streamed text — the one streaming dialect. Every text stream is keyed
3327
- * like every other item: by the provider's own item id when the provider
3328
- * names its message items (codex), or by a bridge-chosen `key.channel`
3329
- * (`"assistant"`, `"thinking-2"`) plus `key.parentRef` for providers whose
3330
- * streams are anonymous (claude, pi, acp). The first delta for an unknown
3331
- * key synthesizes the channel's `item/started`; later deltas (and deltas
3332
- * for a provider id already opened or settled) reuse the mapped id. The
3333
- * assembler accumulates the stream text per open item so `item.textClose`
3334
- * can settle without a provider-final text.
3335
- */
3336
2939
  z24.object({
3337
2940
  kind: z24.literal("item.textDelta"),
3338
2941
  key: deltaItemKeySchema,
@@ -3341,18 +2944,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3341
2944
  providerTurnId: providerTurnIdSchema.optional(),
3342
2945
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3343
2946
  }),
3344
- /**
3345
- * Settle a text stream. `text` present: the provider's final text, preferred
3346
- * over the accumulated stream (and enough on its own — a close for a key
3347
- * nothing streamed under completes a fresh item). `text` absent: settle
3348
- * with the accumulated stream text, completing nothing when the stream only
3349
- * ever received whitespace. Either way the key is released, so later text
3350
- * mints a fresh item. `channel` says which item to mint for a bare close
3351
- * and where a provider-final `text` lands on a reasoning item. Providers
3352
- * that name their message items may instead settle through `item.close`
3353
- * with the full terminal shape (the uniform close rule) — that is the same
3354
- * item lifecycle, not a second streaming dialect.
3355
- */
3356
2947
  z24.object({
3357
2948
  kind: z24.literal("item.textClose"),
3358
2949
  key: deltaItemKeySchema,
@@ -3361,10 +2952,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3361
2952
  providerTurnId: providerTurnIdSchema.optional(),
3362
2953
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3363
2954
  }),
3364
- /**
3365
- * Item-keyed exact output append (codex command/fileChange output deltas).
3366
- * Never synthesizes an open and never diffs — the text is already a delta.
3367
- */
3368
2955
  z24.object({
3369
2956
  kind: z24.literal("item.outputDelta"),
3370
2957
  key: deltaItemKeySchema,
@@ -3373,26 +2960,12 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3373
2960
  providerTurnId: providerTurnIdSchema.optional(),
3374
2961
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3375
2962
  }),
3376
- /**
3377
- * Cumulative command output snapshot (pi bash). The assembler diffs
3378
- * consecutive snapshots into `outputDelta`/`reset` events.
3379
- */
3380
2963
  z24.object({
3381
2964
  kind: z24.literal("command.outputSnapshot"),
3382
2965
  key: deltaItemKeySchema,
3383
2966
  text: z24.string(),
3384
2967
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3385
2968
  }),
3386
- /**
3387
- * Provider-reported usage — the one usage dialect. `total` is the running
3388
- * session total and `last` the most recent turn's usage; a provider that
3389
- * reports exact cumulative totals (codex) forwards both verbatim, and a
3390
- * provider that reports per-turn usage (claude, pi) sums `last` into
3391
- * `total` itself (`addTokenUsage` in the bridge kit), resetting at every
3392
- * session construction alongside `session.reset`. Emits
3393
- * `thread/tokenUsage/updated` only: a provider whose usage also measures
3394
- * the context window sends the `contextWindow` delta beside it.
3395
- */
3396
2969
  z24.object({
3397
2970
  kind: z24.literal("usage"),
3398
2971
  total: threadEventTokenUsageBreakdownSchema,
@@ -3400,13 +2973,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3400
2973
  modelContextWindow: z24.number().nullable(),
3401
2974
  providerTurnId: providerTurnIdSchema.optional()
3402
2975
  }),
3403
- /**
3404
- * Context-window meter. `attach: "currentOrLast"` legalizes post-turn
3405
- * attachment (pi reports after `agent_end` for the turn that just closed);
3406
- * a `providerTurnId` scopes the reading to that vouched turn instead
3407
- * (codex measures the window per native turn) and `attach` is then
3408
- * irrelevant.
3409
- */
3410
2976
  z24.object({
3411
2977
  kind: z24.literal("contextWindow"),
3412
2978
  used: z24.number().nullable(),
@@ -3421,54 +2987,26 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3421
2987
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3422
2988
  }),
3423
2989
  z24.object({ kind: z24.literal("context.cleared") }),
3424
- /** The aggregate working-tree diff for a turn (codex turn/diff/updated). */
3425
2990
  z24.object({
3426
2991
  kind: z24.literal("turn.diff"),
3427
2992
  diff: z24.string(),
3428
2993
  providerTurnId: providerTurnIdSchema.optional()
3429
2994
  }),
3430
- // Thread metadata (codex thread lifecycle notifications).
3431
2995
  z24.object({ kind: z24.literal("thread.started") }),
3432
2996
  z24.object({
3433
2997
  kind: z24.literal("thread.identity"),
3434
2998
  providerThreadId: z24.string().min(1)
3435
2999
  }),
3436
3000
  z24.object({ kind: z24.literal("thread.name"), name: z24.string().min(1) }),
3437
- /**
3438
- * Plugin-declared thread state (grammar v3): `"<pluginId>/<name>"` kinds
3439
- * beside the core thread-state family (usage, context window, rate limits,
3440
- * model fallback, context cleared). Latest snapshot wins per kind — the
3441
- * assembler and the timeline keep one value per `kind`, so a bridge re-sends
3442
- * the whole state, never a diff. Codex goals ride this way (the codex
3443
- * plugin's `provider-codex/goal`, a null payload once cleared). The payload
3444
- * is opaque here; the server validates it against the plugin's declared
3445
- * `state` schema at ingest (the same site as extension items).
3446
- * The namespaced kind travels as `extensionKind` only because `kind` is
3447
- * this union's discriminator; the item shape and the persisted item call
3448
- * the same value `kind`.
3449
- */
3450
3001
  z24.object({
3451
3002
  kind: z24.literal("extension.state"),
3452
3003
  extensionKind: extensionKindSchema,
3453
3004
  payload: jsonValueSchema
3454
3005
  }),
3455
- /**
3456
- * Normalized rate-limit snapshot. The provider-dialect merge (codex's
3457
- * sticky rateLimitReachedType over sparse rolling updates) stays
3458
- * bridge-side — it is seeded from a per-child post-initialize read the
3459
- * assembler never sees.
3460
- */
3461
3006
  z24.object({
3462
3007
  kind: z24.literal("provider.rateLimits"),
3463
3008
  rateLimits: providerRateLimitStateSchema
3464
3009
  }),
3465
- /**
3466
- * Provider-reported error. `settlesTurn: true` also closes the turn that
3467
- * owns the error as failed (an open turn, or one claimed through pending
3468
- * accepted input). A `providerTurnId` scopes the error to that vouched
3469
- * turn; `threadScoped: true` pins thread scope (codex errors without a
3470
- * native turn id never attach to whatever turn happens to be open).
3471
- */
3472
3010
  z24.object({
3473
3011
  kind: z24.literal("provider.error"),
3474
3012
  message: z24.string(),
@@ -3480,13 +3018,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3480
3018
  providerTurnId: providerTurnIdSchema.optional(),
3481
3019
  threadScoped: z24.boolean().optional()
3482
3020
  }),
3483
- /**
3484
- * The provider switched models mid-flight (claude model fallback). Scoped to
3485
- * the open-or-just-closed turn when one exists, thread scope otherwise (the
3486
- * claude translator's currentOrLast rule). Cross-message dedup of the early
3487
- * assistant fallback block against the later system duplicate stays
3488
- * bridge-side — it is keyed by the bridge's own segment tracking.
3489
- */
3490
3021
  z24.object({
3491
3022
  kind: z24.literal("provider.modelFallback"),
3492
3023
  originalModel: z24.string().min(1),
@@ -3494,10 +3025,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3494
3025
  reason: z24.enum(["refusal", "provider"]),
3495
3026
  message: z24.string()
3496
3027
  }),
3497
- /**
3498
- * `vouchedTurn: true` scopes the warning to the open turn when one exists
3499
- * (ACP warnings are turn-scoped mid-turn); default is thread scope.
3500
- */
3501
3028
  z24.object({
3502
3029
  kind: z24.literal("provider.warning"),
3503
3030
  summary: z24.string().optional(),
@@ -3505,15 +3032,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3505
3032
  category: threadEventWarningCategorySchema.optional(),
3506
3033
  vouchedTurn: z24.boolean().optional()
3507
3034
  }),
3508
- /**
3509
- * The bridge's visibility classification decided this raw event is unknown.
3510
- * `vouchedTurn: true` scopes it to the open turn if one exists — the
3511
- * only-caller-vouched-turn-ids rule — and `providerTurnId` scopes it to
3512
- * that vouched provider turn. `onlyIfNoTurn: true` inverts the guard: the
3513
- * event surfaces only when NO turn is open (the old translators'
3514
- * "known event, no active turn" visibility fallback for events that
3515
- * otherwise translate to silence) and is dropped entirely mid-turn.
3516
- */
3517
3035
  z24.object({
3518
3036
  kind: z24.literal("unhandled"),
3519
3037
  raw: providerRawEventSchema,
@@ -3523,18 +3041,7 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3523
3041
  parentRef: deltaKeyPartSchema.optional(),
3524
3042
  providerTurnId: providerTurnIdSchema.optional()
3525
3043
  }),
3526
- /**
3527
- * Lifecycle settlement: the session was interrupted. The assembler closes
3528
- * the open turn and open items as interrupted.
3529
- */
3530
3044
  z24.object({ kind: z24.literal("session.ended") }),
3531
- /**
3532
- * Provider-native id-space boundary: a new provider session was constructed
3533
- * for this thread (start/resume/fork/rebuild), so its native turn/item ids
3534
- * may repeat. Drops ALL assembly state for the thread — id maps, settled
3535
- * sets, open items and streams; the bridge settles any open work first
3536
- * (nothing is in flight at any construction site).
3537
- */
3538
3045
  z24.object({ kind: z24.literal("session.reset") })
3539
3046
  ]);
3540
3047
  var threadDeltaNotificationParamsSchema = z24.object({
@@ -3650,7 +3157,10 @@ var BridgeRecoveryError = class extends Error {
3650
3157
  code;
3651
3158
  recovery;
3652
3159
  constructor(args) {
3653
- super(args.message, args.cause === void 0 ? void 0 : { cause: args.cause });
3160
+ super(
3161
+ args.message,
3162
+ args.cause === void 0 ? void 0 : { cause: args.cause }
3163
+ );
3654
3164
  this.name = "BridgeRecoveryError";
3655
3165
  this.code = args.code;
3656
3166
  this.recovery = args.recovery;
@@ -3669,8 +3179,6 @@ function createBridgeIo({
3669
3179
  send2({
3670
3180
  jsonrpc: "2.0",
3671
3181
  id,
3672
- // Omitted rather than `undefined`: an error response without
3673
- // structured detail keeps the exact shape it has always had.
3674
3182
  error: { code, message, ...data === void 0 ? {} : { data } }
3675
3183
  });
3676
3184
  },
@@ -3708,12 +3216,7 @@ function runBridgeRequest(args) {
3708
3216
  }
3709
3217
 
3710
3218
  // ../provider-bridge-protocol/src/bridge-kit/bridge-recorder.ts
3711
- import {
3712
- closeSync,
3713
- mkdirSync,
3714
- openSync,
3715
- writeSync
3716
- } from "node:fs";
3219
+ import { closeSync, mkdirSync, openSync, writeSync } from "node:fs";
3717
3220
  import { join, resolve } from "node:path";
3718
3221
  import { StringDecoder } from "node:string_decoder";
3719
3222
  var PROVIDER_BRIDGE_RECORD_DIR_ENV = "BB_PROVIDER_BRIDGE_RECORD_DIR";
@@ -3796,7 +3299,10 @@ function createBridgeRecorder(args) {
3796
3299
  }
3797
3300
  const scopeDir = join(dir, scope);
3798
3301
  mkdirSync(scopeDir, { recursive: true });
3799
- const fd = openSync(join(scopeDir, bridgeRecordingFileName(direction)), "a");
3302
+ const fd = openSync(
3303
+ join(scopeDir, bridgeRecordingFileName(direction)),
3304
+ "a"
3305
+ );
3800
3306
  fds.set(key, fd);
3801
3307
  return fd;
3802
3308
  }
@@ -3847,13 +3353,21 @@ function createBridgeRecorder(args) {
3847
3353
  const { stdin, stdout } = child;
3848
3354
  if (stdout) {
3849
3355
  const splitter = createRecordingLineSplitter(
3850
- (line) => record({ direction: "provider\u2192bridge", line, threadId: scope.threadId })
3356
+ (line) => record({
3357
+ direction: "provider\u2192bridge",
3358
+ line,
3359
+ threadId: scope.threadId
3360
+ })
3851
3361
  );
3852
3362
  stdout.on("data", (chunk) => splitter.push(chunk));
3853
3363
  }
3854
3364
  if (stdin) {
3855
3365
  const splitter = createRecordingLineSplitter(
3856
- (line) => record({ direction: "bridge\u2192provider", line, threadId: scope.threadId })
3366
+ (line) => record({
3367
+ direction: "bridge\u2192provider",
3368
+ line,
3369
+ threadId: scope.threadId
3370
+ })
3857
3371
  );
3858
3372
  const originalWrite = stdin.write.bind(stdin);
3859
3373
  stdin.write = ((chunk, ...rest) => {
@@ -4018,9 +3532,6 @@ function decodeToolCallResponsePayload(result) {
4018
3532
  };
4019
3533
  }
4020
3534
  return {
4021
- // Keep the legacy aggregate fields for provider bridges that already use
4022
- // this published helper. New consumers use contentBlocks so interleaved
4023
- // text and images retain the plugin result's order.
4024
3535
  content: text,
4025
3536
  contentBlocks,
4026
3537
  images,
@@ -4243,16 +3754,10 @@ import { z as z30 } from "zod";
4243
3754
  var normalizedToolCallRequestSchema = z30.object({
4244
3755
  providerThreadId: z30.string().min(1),
4245
3756
  threadId: z30.string().min(1).optional(),
4246
- // Canonical bridge wire form: required string when known, required null when
4247
- // the provider cannot resolve the BB turn id itself.
4248
3757
  turnId: z30.union([z30.string().min(1), z30.null()]),
4249
3758
  callId: z30.string().min(1),
4250
3759
  tool: z30.string().min(1),
4251
3760
  arguments: z30.unknown(),
4252
- /**
4253
- * turnId/callId are provider-native (thread/delta bridges hold no bb ids);
4254
- * the runtime adapter translates them through the delta assembler's maps.
4255
- */
4256
3761
  providerNativeIds: z30.boolean().optional()
4257
3762
  });
4258
3763
 
@@ -4684,9 +4189,7 @@ var acpFsWriteNotificationParamsSchema = z33.object({
4684
4189
  threadId: z33.string().min(1),
4685
4190
  path: z33.string().min(1),
4686
4191
  kind: z33.enum(["add", "update"]),
4687
- /** Absent on `add`: the file did not exist before the write. */
4688
4192
  oldText: z33.string().optional(),
4689
- /** The written file content; the assembler builds the diff from it. */
4690
4193
  content: z33.string()
4691
4194
  }).passthrough();
4692
4195
  var acpWarningNotificationParamsSchema = z33.object({
@@ -5160,8 +4663,6 @@ function grokClassifyToolCall(event) {
5160
4663
  const label = input?.description ?? input?.prompt ?? event.title ?? "Subagent";
5161
4664
  const shape = {
5162
4665
  type: "delegation",
5163
- // grok reports no child session id, so the tool call is the child ref:
5164
- // it is what its output and kill calls name.
5165
4666
  childRef: event.toolCallId,
5166
4667
  label,
5167
4668
  background: false
@@ -5253,8 +4754,6 @@ var ompBashRawOutputSchema = z35.object({
5253
4754
  signal: z35.unknown().optional(),
5254
4755
  async: z35.unknown().optional()
5255
4756
  }).passthrough(),
5256
- // If an OMP version emits generic ACP result fields, the shared parser
5257
- // owns those exit/output/timeout/signal semantics.
5258
4757
  exitCode: z35.number().int().nullable().optional(),
5259
4758
  exit_code: z35.number().int().nullable().optional(),
5260
4759
  stdout: z35.string().optional(),
@@ -5375,7 +4874,6 @@ var acpRawInputPathSchema = z36.object({
5375
4874
  path: z36.string().optional(),
5376
4875
  filePath: z36.string().optional(),
5377
4876
  file_path: z36.string().optional(),
5378
- /** grok's `read_file` / `search_replace` argument name. */
5379
4877
  target_file: z36.string().optional()
5380
4878
  }).passthrough();
5381
4879
  function resolveAcpToolCallPath(value, options) {
@@ -6512,8 +6010,6 @@ function createAcpDeltaTranslator(options = {}) {
6512
6010
  const status = params.data.status;
6513
6011
  return [
6514
6012
  ...flushOpenTurnWork(context, status),
6515
- // Only a completed maintenance prompt actually shrank the context; a
6516
- // failed or interrupted one must never report `thread/compacted`.
6517
6013
  ...status === "completed" ? [{ kind: "context.compacted" }] : [],
6518
6014
  {
6519
6015
  kind: "turn.boundary",
@@ -6713,12 +6209,6 @@ function buildToolUseSubject(toolCall, options, dialectClassify) {
6713
6209
  kind: "tool_use",
6714
6210
  itemId: toolCall.toolCallId,
6715
6211
  tool: described.item.type === "tool" ? described.item.tool : toolCall.kind ?? toolCall.startedToolCall?.kind ?? described.item.type,
6716
- // The reason is NOT stamped here. It rides the payload, where every
6717
- // surface reads it as the ask's title (`payload.reason ?? …`), while
6718
- // `presentation.detail` becomes a detail line beneath — so stamping it
6719
- // into both printed the agent's sentence twice on the app, mobile and
6720
- // the CLI. `detail` keeps only what the classification found that the
6721
- // reason does not already say (a delegation's report, say).
6722
6212
  presentation: described.presentation
6723
6213
  };
6724
6214
  }
@@ -6759,9 +6249,6 @@ function buildAcpPermissionInteractionPayload(args) {
6759
6249
  subject: {
6760
6250
  kind: "file_change",
6761
6251
  itemId: toolCall.toolCallId,
6762
- // The permission's own locations bound the write (opencode's
6763
- // external_directory names [file, parentDir]); the in-flight tool
6764
- // call's paths are the fallback.
6765
6252
  writeScope: resolveAcpFileChangeWriteScope(
6766
6253
  ownPaths.length > 0 ? ownPaths : operation.paths
6767
6254
  ),
@@ -6924,8 +6411,6 @@ function buildAcpNativeReasoningSupport(thoughtLevelOption) {
6924
6411
  );
6925
6412
  if (supportedReasoningEfforts.length === 0) {
6926
6413
  return {
6927
- // An omitted option preserves the legacy agent-managed fallback. A
6928
- // declared option is authoritative, even when bb cannot map its values.
6929
6414
  supportedReasoningEfforts: thoughtLevelOption === void 0 ? ACP_NATIVE_REASONING_EFFORTS : [],
6930
6415
  defaultReasoningEffort: "medium"
6931
6416
  };
@@ -7109,7 +6594,6 @@ function buildAgentModelCatalog(rawModels) {
7109
6594
  description: nameByLevel.get(level) ?? ""
7110
6595
  })),
7111
6596
  defaultReasoningEffort: defaultEntry.level,
7112
- // The agent lists its default model first.
7113
6597
  isDefault: models.length === 0
7114
6598
  });
7115
6599
  variantsByFamilyId.set(defaultVariant.id, byLevel);
@@ -7297,7 +6781,6 @@ function buildAcpModelSelectionParam(launchSpec, options, parameterizedModelPick
7297
6781
  selectFlag: launchSpec.modelCli.selectFlag,
7298
6782
  model,
7299
6783
  ...options.reasoningLevel !== void 0 ? { reasoningLevel: options.reasoningLevel } : {},
7300
- // Only "fast" changes launch resolution; "default" is the normal id.
7301
6784
  ...options.serviceTier === "fast" ? { serviceTier: options.serviceTier } : {}
7302
6785
  }
7303
6786
  };
@@ -7462,6 +6945,9 @@ function createAcpAgentConnection(options) {
7462
6945
  terminal: false
7463
6946
  });
7464
6947
  stdoutLines.on("line", (line) => {
6948
+ if (stopping) {
6949
+ return;
6950
+ }
7465
6951
  const message = parseAgentLine(line);
7466
6952
  if (!message) {
7467
6953
  return;
@@ -7635,9 +7121,6 @@ var bridgeToolCallResponseSchema = z38.union([
7635
7121
  })
7636
7122
  ])
7637
7123
  ).optional(),
7638
- // The initialized response and older text-only responses omit images.
7639
- // Parsing them as an empty list keeps the re-executed packaged artifact
7640
- // compatible with that legacy socket shape.
7641
7124
  images: z38.array(z38.object({ data: z38.string(), mimeType: z38.string() })).default([]),
7642
7125
  isError: z38.boolean().optional()
7643
7126
  }),
@@ -8124,6 +7607,8 @@ async function forwardDynamicToolCall(args) {
8124
7607
  function handleDynamicToolBridgeSocket(bridge, socket) {
8125
7608
  let buffer = "";
8126
7609
  socket.setEncoding("utf8");
7610
+ socket.on("error", () => {
7611
+ });
8127
7612
  socket.on("data", (chunk) => {
8128
7613
  buffer += chunk;
8129
7614
  const newlineIndex = buffer.indexOf("\n");
@@ -8169,6 +7654,8 @@ async function ensureDynamicToolBridge() {
8169
7654
  dynamicToolBridgePromise = new Promise((resolveBridge, rejectBridge) => {
8170
7655
  const host = "127.0.0.1";
8171
7656
  const server = createServer((socket) => {
7657
+ socket.on("error", () => {
7658
+ });
8172
7659
  void dynamicToolBridgePromise?.then((bridge) => {
8173
7660
  handleDynamicToolBridgeSocket(bridge, socket);
8174
7661
  });
@@ -8930,8 +8417,6 @@ function handlePermissionRequest(session, params, responder) {
8930
8417
  toolCall: normalizedToolCall,
8931
8418
  options: parsed.data.options,
8932
8419
  cwd: session.cwd,
8933
- // The dialect reads the same side channels for the ask as for the
8934
- // row: a Cursor sub-agent asking keeps its delegation reading.
8935
8420
  classifyToolCall: session.dialect.classifyToolCall
8936
8421
  });
8937
8422
  void sendRuntimeRequest(BRIDGE_INBOUND_REQUEST_METHODS.interactionRequest, {
@@ -9664,24 +9149,10 @@ function decodeLaunchSpec(providerOptions) {
9664
9149
  return launchSpec.success ? launchSpec.data : null;
9665
9150
  }
9666
9151
  var acpProviderOptionsSchema = z39.object({
9667
- /**
9668
- * Environment-level extra write roots. Rides the opaque provider-options
9669
- * bag (packed by the registry) because the wire has no core
9670
- * field for it — same delivery as the ACP launch spec.
9671
- */
9672
9152
  additionalWorkspaceWriteRoots: z39.array(z39.string()).optional(),
9673
- /**
9674
- * The agent's dialect: which vendor side channels this bridge should
9675
- * read for it (see `dialect.ts`). Declared by the plugin that registers
9676
- * the provider, so a third-party registration of a known agent gets the
9677
- * same reporting fidelity a first-party one does.
9678
- */
9679
9153
  acpDialect: z39.string().min(1).optional(),
9680
- /** Enables an agent's separate model configuration options. */
9681
9154
  parameterizedModelPicker: z39.boolean().optional(),
9682
- /** Bare model ids shown before the collapsed "More models" pool. */
9683
9155
  primaryModels: z39.array(z39.string().min(1)).optional(),
9684
- /** Model ids to probe first during bounded native discovery. */
9685
9156
  reasoningProbePriorityModelIds: z39.array(z39.string().min(1)).optional()
9686
9157
  }).passthrough();
9687
9158
  function decodeAcpModelPickerOptions(providerOptions) {
@@ -9720,16 +9191,8 @@ async function handleRequest2(request) {
9720
9191
  threadGoalClear: false,
9721
9192
  fork: "tip",
9722
9193
  approvalEnforcedBy: "runtime",
9723
- // grammarVersions [3, 3] — this bridge emits the v3 delta grammar
9724
- // (one streaming dialect; the v3 item shapes land per bridge in
9725
- // WS1b). steerMode "queue" — ACP v1 has no mid-loop inject: a hard
9726
- // steer cancels the live prompt and re-prompts with the queued text
9727
- // at the next boundary.
9728
9194
  grammarVersions: [THREAD_DELTA_GRAMMAR_V3, THREAD_DELTA_GRAMMAR_V3],
9729
9195
  steerMode: "queue",
9730
- // Single-site addition (WS4 L4): the bridge handles skills/configure
9731
- // (it lists the roots in the session instructions) and must say so,
9732
- // or the runtime sends it no injected skills.
9733
9196
  skills: { configure: true }
9734
9197
  }
9735
9198
  };
@@ -10019,16 +9482,10 @@ async function probeAcpAgent(request) {
10019
9482
  command: request.command,
10020
9483
  args: [...request.args],
10021
9484
  cwd: request.cwd,
10022
- // The same environment the bridge would launch this agent in. Raw
10023
- // process.env would hand the agent ELECTRON_RUN_AS_NODE (the packaged
10024
- // daemon runs in electron-node mode) and the record-dir variable, so a
10025
- // probed agent would run somewhere its real launch never does.
10026
9485
  env: withoutBridgeRuntimeEnv({ ...process.env, ...request.env ?? {} }),
10027
9486
  recordThreadId: null,
10028
9487
  onNotification: () => {
10029
9488
  },
10030
- // A probe is not a session: an agent that asks the client anything
10031
- // before initialize returns gets a plain "not supported".
10032
9489
  onRequest: (_method, _params, responder) => {
10033
9490
  responder.error(-32601, "bb is probing this agent's capabilities");
10034
9491
  },
@@ -10042,7 +9499,9 @@ async function probeAcpAgent(request) {
10042
9499
  const timeout = new Promise((_resolve, reject) => {
10043
9500
  setTimeout(
10044
9501
  () => reject(
10045
- new Error(`the agent did not answer initialize within ${timeoutMs}ms`)
9502
+ new Error(
9503
+ `the agent did not answer initialize within ${timeoutMs}ms`
9504
+ )
10046
9505
  ),
10047
9506
  timeoutMs
10048
9507
  ).unref?.();
@@ -10054,8 +9513,6 @@ async function probeAcpAgent(request) {
10054
9513
  params: {
10055
9514
  protocolVersion: ACP_PROTOCOL_VERSION,
10056
9515
  clientInfo: { name: "bb", version: "1.0.0" },
10057
- // The probe advertises what bb's bridge advertises, so an agent
10058
- // that varies its capabilities by client sees the same client.
10059
9516
  clientCapabilities: {
10060
9517
  fs: { readTextFile: true, writeTextFile: true },
10061
9518
  terminal: false