@get-bb/plugin-sdk 0.4.24 → 0.4.28

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,15 +1264,14 @@ 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(
1327
1270
  systemThreadInterruptedReasonValues
1328
1271
  );
1329
1272
  var systemThreadInterruptedEventDataSchema = z10.object({
1330
- reason: systemThreadInterruptedReasonSchema
1273
+ reason: systemThreadInterruptedReasonSchema,
1274
+ cause: z10.literal("host-connection-lost").optional()
1331
1275
  });
1332
1276
  var provisioningTranscriptEntrySchema = z10.object({
1333
1277
  type: z10.enum(["step", "output"]),
@@ -1364,11 +1308,6 @@ var systemProviderTurnWatchdogEventDataSchema = z10.object({
1364
1308
  activeTurnId: z10.string().min(1),
1365
1309
  activeTurnStartedAt: z10.number().int().nonnegative(),
1366
1310
  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
1311
  lastActivityEventType: z10.string().min(1),
1373
1312
  lastActivityEventAt: z10.number().int().nonnegative(),
1374
1313
  providerId: z10.string().min(1),
@@ -1631,7 +1570,6 @@ var providerRateLimitStatusSchema = z13.enum([
1631
1570
  "unknown"
1632
1571
  ]);
1633
1572
  var providerRateLimitWindowSchema = z13.object({
1634
- /** Opaque provider-issued key. New provider windows must not break parsing. */
1635
1573
  providerKey: z13.string().min(1).nullable(),
1636
1574
  label: z13.string().min(1).nullable(),
1637
1575
  status: providerRateLimitStatusSchema,
@@ -1716,11 +1654,9 @@ var threadEventDelegationItemSchema = z13.object({
1716
1654
  type: z13.literal("delegation"),
1717
1655
  id: z13.string(),
1718
1656
  childRef: z13.string().min(1),
1719
- /** Human label for the delegated work (the child's description). */
1720
1657
  label: z13.string(),
1721
1658
  status: threadEventItemStatusSchema,
1722
1659
  background: z13.boolean(),
1723
- /** Terminal summary from the child; absent while it runs. */
1724
1660
  summary: z13.string().optional(),
1725
1661
  ...itemPresentationField,
1726
1662
  parentToolCallId: z13.string().optional()
@@ -1781,10 +1717,6 @@ var threadEventWarningCategorySchema = z13.enum([
1781
1717
  "deprecation",
1782
1718
  "config",
1783
1719
  "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
1720
  "compaction-skipped"
1789
1721
  ]);
1790
1722
  var providerRawEventSchema = z13.object({
@@ -1813,28 +1745,15 @@ var toolCallProgressEventSchema = z13.object({
1813
1745
  var threadEventBackgroundTaskItemSchema = z13.object({
1814
1746
  type: z13.literal("backgroundTask"),
1815
1747
  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
1748
  familyId: z13.string().optional(),
1824
- /** Raw SDK task discriminant (e.g. "local_workflow"); "unknown" when the provider omitted it. */
1825
1749
  taskType: z13.string(),
1826
1750
  description: z13.string(),
1827
1751
  status: threadEventItemStatusSchema,
1828
1752
  taskStatus: backgroundTaskStatusSchema,
1829
- /** Ambient/housekeeping task; consumers hide it from the inline transcript. */
1830
1753
  skipTranscript: z13.boolean(),
1831
- /** meta.name of the workflow script; only present for workflow tasks. */
1832
1754
  workflowName: z13.string().optional(),
1833
- /** Merged workflow tree; absent until the provider reports progress records. */
1834
1755
  workflow: workflowProgressSnapshotSchema.optional(),
1835
- /** Absent until the provider reports usage. */
1836
1756
  usage: backgroundTaskUsageSchema.optional(),
1837
- /** Terminal summary from the provider; absent while the task runs. */
1838
1757
  summary: z13.string().optional(),
1839
1758
  error: z13.string().optional(),
1840
1759
  outputFile: z13.string().optional(),
@@ -1842,7 +1761,6 @@ var threadEventBackgroundTaskItemSchema = z13.object({
1842
1761
  parentToolCallId: z13.string().optional()
1843
1762
  });
1844
1763
  var threadEventItemSchema = z13.discriminatedUnion("type", [
1845
- // bb authors user messages itself, so they carry no bridge presentation.
1846
1764
  z13.object({
1847
1765
  type: z13.literal("userMessage"),
1848
1766
  id: z13.string(),
@@ -1864,10 +1782,6 @@ var threadEventItemSchema = z13.discriminatedUnion("type", [
1864
1782
  cwd: z13.string(),
1865
1783
  status: threadEventItemStatusSchema,
1866
1784
  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
1785
  aggregatedOutput: z13.string().optional(),
1872
1786
  exitCode: z13.number().optional(),
1873
1787
  durationMs: z13.number().optional(),
@@ -1900,10 +1814,6 @@ var threadEventItemSchema = z13.discriminatedUnion("type", [
1900
1814
  error: z13.string().optional(),
1901
1815
  durationMs: z13.number().optional(),
1902
1816
  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
1817
  ...itemPresentationField,
1908
1818
  parentToolCallId: z13.string().optional()
1909
1819
  }),
@@ -1952,12 +1862,9 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
1952
1862
  z13.object({
1953
1863
  type: z13.literal("turn/completed"),
1954
1864
  threadId: z13.string(),
1955
- // Server reconciliation can synthesize interrupted completions when the
1956
- // original provider thread id was never persisted.
1957
1865
  providerThreadId: z13.string().nullable(),
1958
1866
  status: threadEventTurnStatusSchema,
1959
1867
  error: z13.object({ message: z13.string() }).optional(),
1960
- /** Provider-native point through which a replacement branch should retain history. */
1961
1868
  providerCheckpointId: z13.string().min(1).optional()
1962
1869
  }),
1963
1870
  z13.object({
@@ -2024,10 +1931,6 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2024
1931
  providerThreadId: z13.string(),
2025
1932
  itemId: z13.string(),
2026
1933
  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
1934
  reset: z13.boolean().optional(),
2032
1935
  parentToolCallId: z13.string().optional()
2033
1936
  }),
@@ -2072,49 +1975,24 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2072
1975
  parentToolCallId: z13.string().optional()
2073
1976
  }),
2074
1977
  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
1978
  z13.object({
2083
1979
  type: z13.literal("item/backgroundTask/progress"),
2084
1980
  threadId: z13.string(),
2085
1981
  providerThreadId: z13.string(),
2086
1982
  item: threadEventBackgroundTaskItemSchema
2087
1983
  }),
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
1984
  z13.object({
2094
1985
  type: z13.literal("item/backgroundTask/completed"),
2095
1986
  threadId: z13.string(),
2096
1987
  providerThreadId: z13.string(),
2097
1988
  item: threadEventBackgroundTaskItemSchema
2098
1989
  }),
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
1990
  z13.object({
2107
1991
  type: z13.literal("item/delegation/progress"),
2108
1992
  threadId: z13.string(),
2109
1993
  providerThreadId: z13.string(),
2110
1994
  item: threadEventDelegationItemSchema
2111
1995
  }),
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
1996
  z13.object({
2119
1997
  type: z13.literal("item/delegation/completed"),
2120
1998
  threadId: z13.string(),
@@ -2161,16 +2039,6 @@ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
2161
2039
  providerThreadId: z13.string(),
2162
2040
  rateLimits: providerRateLimitStateSchema
2163
2041
  }),
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
2042
  z13.object({
2175
2043
  type: z13.literal("thread/extensionState/updated"),
2176
2044
  threadId: z13.string(),
@@ -2326,8 +2194,6 @@ var availableModelSchema = z15.object({
2326
2194
  id: z15.string(),
2327
2195
  model: z15.string(),
2328
2196
  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
2197
  routeProviderId: z15.string().min(1).optional(),
2332
2198
  description: z15.string(),
2333
2199
  supportedReasoningEfforts: z15.array(modelReasoningEffortSchema),
@@ -2341,20 +2207,8 @@ var providerCapabilitiesSchema = z15.object({
2341
2207
  supportsServiceTier: z15.boolean(),
2342
2208
  supportsNativeUserQuestion: z15.boolean(),
2343
2209
  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
2210
  supportsSessionRewind: z15.boolean(),
2350
2211
  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
2212
  modelCatalogScope: providerModelCatalogScopeSchema
2359
2213
  });
2360
2214
  var providerComposerCommandSchema = z15.object({
@@ -2377,17 +2231,11 @@ var providerComposerActionSchema = z15.discriminatedUnion("kind", [
2377
2231
  })
2378
2232
  ]);
2379
2233
  var providerStringsSchema = z15.object({
2380
- /** How to sign in on the host ("Run `claude` on the machine to sign in."). */
2381
2234
  signInHint: z15.string().min(1),
2382
- /** Shown when a session's credentials expired. */
2383
2235
  expiredHint: z15.string().min(1),
2384
- /** Where to install the agent. */
2385
2236
  installUrl: z15.string().min(1),
2386
- /** Brand prefix stripped from model display names ("Claude "). */
2387
2237
  brandPrefix: z15.string().min(1).optional(),
2388
- /** Plan-mode banner copy for providers that declare the `plan` action. */
2389
2238
  planModeCopy: z15.string().min(1).optional(),
2390
- /** Per-theme tint for the provider icon. */
2391
2239
  iconTint: z15.object({ light: z15.string().min(1), dark: z15.string().min(1) }).optional()
2392
2240
  });
2393
2241
  var providerOptionDescriptorSchema = z15.object({
@@ -2405,31 +2253,11 @@ var providerExtensionKindsSchema = z15.record(
2405
2253
  );
2406
2254
  var providerInfoSchema = z15.object({
2407
2255
  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
2256
  pluginId: z15.string().min(1),
2414
2257
  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
2258
  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
2259
  icon: z15.object({ glyph: z15.string().min(1) }).optional(),
2431
2260
  logoUrl: z15.string().min(1).nullable(),
2432
- /** Sessionless maintenance requests the provider's bridge implements. */
2433
2261
  maintenance: z15.object({
2434
2262
  health: z15.boolean(),
2435
2263
  usage: z15.boolean(),
@@ -2438,13 +2266,6 @@ var providerInfoSchema = z15.object({
2438
2266
  capabilities: providerCapabilitiesSchema,
2439
2267
  composerActions: z15.array(providerComposerActionSchema),
2440
2268
  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
2269
  strings: providerStringsSchema.optional(),
2449
2270
  serviceTiers: z15.array(providerOptionDescriptorSchema).optional(),
2450
2271
  reasoningLevels: z15.array(providerOptionDescriptorSchema).optional(),
@@ -2585,88 +2406,22 @@ var bridgeGrammarVersionsSchema = z17.tuple([z17.number().int().positive(), z17.
2585
2406
  });
2586
2407
  var bridgeSteerModeSchema = z17.enum(["inject", "queue"]);
2587
2408
  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
2409
  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
2410
  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
2411
  threadRename: z17.boolean().default(false),
2607
- /** The bridge supports thread/goal/clear. */
2608
2412
  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
2413
  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
2414
  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
2415
  grammarVersions: bridgeGrammarVersionsSchema.default([
2636
2416
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
2637
2417
  PROVIDER_BRIDGE_PROTOCOL_VERSION
2638
2418
  ]),
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
2419
  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
2420
  skills: z17.object({ configure: z17.boolean().default(false) }).default({ configure: false })
2661
2421
  }).passthrough();
2662
2422
  var initializeParamsSchema = z17.object({
2663
2423
  protocolVersion: z17.number().int().positive(),
2664
2424
  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
2425
  grammarVersions: bridgeGrammarVersionsSchema.default([
2671
2426
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
2672
2427
  PROVIDER_BRIDGE_PROTOCOL_VERSION
@@ -2674,8 +2429,6 @@ var initializeParamsSchema = z17.object({
2674
2429
  }).passthrough();
2675
2430
  var initializeResultSchema = z17.object({
2676
2431
  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
2432
  capabilities: z17.preprocess(
2680
2433
  (value) => value ?? {},
2681
2434
  bridgeCapabilitiesSchema
@@ -2688,16 +2441,9 @@ var bridgeExecutionOptionsSchema = z18.object({
2688
2441
  model: z18.string().min(1).optional(),
2689
2442
  serviceTier: serviceTierSchema.optional(),
2690
2443
  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
2444
  promptMode: promptModeSchema.optional(),
2697
- /** Frozen for the life of a provider session; applied at construction. */
2698
2445
  instructions: z18.string().optional(),
2699
2446
  envVars: z18.record(z18.string(), z18.string()).optional(),
2700
- /** Provider-scoped session options. Opaque outside the owning bridge. */
2701
2447
  providerOptions: z18.record(z18.string(), z18.unknown()).optional()
2702
2448
  }).and(runtimePermissionPolicySchema);
2703
2449
 
@@ -2708,9 +2454,7 @@ var providerMaintenanceParamsSchema = z19.object({
2708
2454
  cwd: z19.string().min(1).optional(),
2709
2455
  providerOptions: z19.record(z19.string(), z19.unknown()).optional()
2710
2456
  }).passthrough();
2711
- var providerInstallationRequirementSchema = z19.enum([
2712
- "thread_rewind"
2713
- ]);
2457
+ var providerInstallationRequirementSchema = z19.enum(["thread_rewind"]);
2714
2458
  var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
2715
2459
  requirement: providerInstallationRequirementSchema.optional()
2716
2460
  });
@@ -2758,26 +2502,20 @@ var providerUsageSchema = z19.discriminatedUnion("status", [
2758
2502
  accountEmail: z19.string().nullable().default(null)
2759
2503
  }).passthrough()
2760
2504
  ]);
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
- );
2505
+ var providerHealthResultSchema = z19.discriminatedUnion("supported", [
2506
+ z19.object({ supported: z19.literal(false) }).passthrough(),
2507
+ z19.object({
2508
+ supported: z19.literal(true),
2509
+ health: providerHealthSchema
2510
+ }).passthrough()
2511
+ ]);
2512
+ var providerUsageResultSchema = z19.discriminatedUnion("supported", [
2513
+ z19.object({ supported: z19.literal(false) }).passthrough(),
2514
+ z19.object({
2515
+ supported: z19.literal(true),
2516
+ usage: providerUsageSchema
2517
+ }).passthrough()
2518
+ ]);
2781
2519
  var providerInstallationActionKindSchema = z19.enum([
2782
2520
  "install",
2783
2521
  "update"
@@ -2814,28 +2552,34 @@ var providerInstallationCommandSchema = z19.object({
2814
2552
  args: z19.array(z19.string()).max(64),
2815
2553
  displayCommand: z19.string().min(1)
2816
2554
  }).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
- ]);
2555
+ var providerInstallationVerificationSchema = z19.discriminatedUnion(
2556
+ "kind",
2557
+ [
2558
+ z19.object({ kind: z19.literal("installed") }).passthrough(),
2559
+ z19.object({
2560
+ kind: z19.literal("version_changed"),
2561
+ previousVersion: z19.string().min(1)
2562
+ }).passthrough(),
2563
+ z19.object({
2564
+ kind: z19.literal("version_at_least"),
2565
+ version: z19.string().min(1)
2566
+ }).passthrough()
2567
+ ]
2568
+ );
2569
+ var providerInstallationRunResultSchema = z19.discriminatedUnion(
2570
+ "available",
2571
+ [
2572
+ z19.object({
2573
+ available: z19.literal(false),
2574
+ message: z19.string().min(1)
2575
+ }).passthrough(),
2576
+ z19.object({
2577
+ available: z19.literal(true),
2578
+ command: providerInstallationCommandSchema,
2579
+ verification: providerInstallationVerificationSchema
2580
+ }).passthrough()
2581
+ ]
2582
+ );
2839
2583
 
2840
2584
  // ../provider-bridge-protocol/src/requests.ts
2841
2585
  import { z as z20 } from "zod";
@@ -2859,24 +2603,12 @@ var threadResumeParamsSchema = z20.object({
2859
2603
  var threadForkParamsSchema = z20.object({
2860
2604
  ...sessionConstructionFields,
2861
2605
  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
2606
  sourceProviderCheckpointId: z20.string().min(1).optional()
2868
2607
  }).passthrough();
2869
2608
  var threadStopParamsSchema = z20.object({
2870
2609
  threadId: z20.string().min(1),
2871
2610
  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
2611
  intent: z20.enum(["interrupt", "release"]),
2879
- /** Non-null when the stop interrupts an active provider turn. */
2880
2612
  activeTurnId: z20.string().min(1).nullable()
2881
2613
  }).passthrough();
2882
2614
  var threadRefParams = z20.object({
@@ -2916,7 +2648,6 @@ var skillsConfigureParamsSchema = z20.object({
2916
2648
  }).passthrough();
2917
2649
  var threadIdentityResultSchema = z20.object({
2918
2650
  providerThreadId: z20.string().min(1),
2919
- /** Refines the handshake's `sessionRestore` for this session. */
2920
2651
  sessionRestorable: z20.boolean().optional()
2921
2652
  }).passthrough();
2922
2653
  var modelListResultSchema = z20.object({
@@ -2930,17 +2661,11 @@ import { z as z22 } from "zod";
2930
2661
  // ../provider-bridge-protocol/src/errors.ts
2931
2662
  import { z as z21 } from "zod";
2932
2663
  var BRIDGE_JSON_RPC_ERRORS = {
2933
- /** Standard JSON-RPC: params failed schema validation. */
2934
2664
  INVALID_PARAMS: -32602,
2935
- /** Standard JSON-RPC: method not implemented by this bridge. */
2936
2665
  METHOD_NOT_FOUND: -32601,
2937
- /** Generic bridge failure. */
2938
2666
  BRIDGE_ERROR: -32e3,
2939
- /** A turn/steer arrived but the session has no active turn. */
2940
2667
  NO_ACTIVE_TURN: -32001,
2941
- /** thread/resume for a session the provider can no longer restore. */
2942
2668
  SESSION_NOT_RESTORABLE: -32002,
2943
- /** thread/fork with a checkpoint on a bridge that only forks at the tip. */
2944
2669
  FORK_CHECKPOINT_UNSUPPORTED: -32003
2945
2670
  };
2946
2671
  var providerRecoveryHintSchema = z21.object({
@@ -2961,16 +2686,12 @@ var BRIDGE_NOTIFICATION_METHODS = {
2961
2686
  var threadIdentityNotificationSchema = z22.object({
2962
2687
  threadId: z22.string().min(1),
2963
2688
  providerThreadId: z22.string().min(1),
2964
- /** Refines the handshake's `sessionRestore` for this session. */
2965
2689
  sessionRestorable: z22.boolean().optional()
2966
2690
  }).passthrough();
2967
2691
  var sessionReplacedNotificationSchema = z22.object({
2968
2692
  threadId: z22.string().min(1),
2969
- /** Identity of the replacement session (may equal the old identity). */
2970
2693
  providerThreadId: z22.string().min(1).nullable(),
2971
- /** Human-readable cause, shown in the timeline. */
2972
2694
  reason: z22.string().min(1),
2973
- /** True when provider-side context did not survive the replacement. */
2974
2695
  contextLost: z22.boolean().default(false)
2975
2696
  }).passthrough();
2976
2697
  var providerRawNotificationSchema = z22.object({
@@ -3018,14 +2739,6 @@ var interactionRequestParamsSchema = z23.object({
3018
2739
  threadId: z23.string().min(1).optional(),
3019
2740
  turnId: z23.union([z23.string().min(1), z23.null()]),
3020
2741
  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
2742
  providerNativeIds: z23.boolean().optional()
3030
2743
  }).passthrough();
3031
2744
 
@@ -3045,24 +2758,14 @@ var deltaItemKeySchema = z24.object({
3045
2758
  var providerTurnIdSchema = deltaKeyPartSchema;
3046
2759
  var deltaFileChangeSchema = z24.object({
3047
2760
  path: z24.string(),
3048
- /** The bridge states the change kind; the assembler never derives it. */
3049
2761
  kind: z24.enum(["add", "update", "delete"]),
3050
2762
  movePath: z24.string().optional(),
3051
- /** Provider-supplied unified diff; preferred over old/new text building. */
3052
2763
  diff: z24.string().optional(),
3053
2764
  oldText: z24.string().optional(),
3054
- /** When present the assembler builds the unified diff from old/new text. */
3055
2765
  newText: z24.string().optional()
3056
2766
  });
3057
2767
  var deltaBackgroundTaskShapeSchema = z24.object({
3058
2768
  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
2769
  familyId: z24.string().min(1),
3067
2770
  taskType: z24.string(),
3068
2771
  description: z24.string(),
@@ -3116,20 +2819,8 @@ var deltaItemShapeSchema = z24.discriminatedUnion("type", [
3116
2819
  }),
3117
2820
  z24.object({
3118
2821
  type: z24.literal("fileChange"),
3119
- /** Empty while a path is not yet known, including bare close fallbacks. */
3120
2822
  changes: z24.array(deltaFileChangeSchema)
3121
2823
  }),
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
2824
  z24.object({
3134
2825
  type: z24.literal("tool"),
3135
2826
  tool: z24.string(),
@@ -3159,7 +2850,6 @@ var deltaItemShapeSchema = z24.discriminatedUnion("type", [
3159
2850
  }),
3160
2851
  z24.object({ type: z24.literal("imageView"), path: z24.string() }),
3161
2852
  deltaBackgroundTaskShapeSchema,
3162
- // Grammar v3 shapes. Every existing shape above is kept unchanged.
3163
2853
  deltaFileReadShapeSchema,
3164
2854
  deltaSearchShapeSchema,
3165
2855
  deltaDelegationShapeSchema,
@@ -3193,51 +2883,21 @@ function requireExtensionPresentation(delta, ctx) {
3193
2883
  }
3194
2884
  }
3195
2885
  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
2886
  z24.object({
3203
2887
  kind: z24.literal("input.accepted"),
3204
2888
  clientRequestId: clientTurnRequestIdSchema,
3205
2889
  providerTurnId: providerTurnIdSchema.optional()
3206
2890
  }),
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
2891
  z24.object({
3217
2892
  kind: z24.literal("input.provider"),
3218
2893
  text: z24.string().min(1),
3219
2894
  parentRef: deltaKeyPartSchema.optional()
3220
2895
  }),
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
2896
  z24.object({
3229
2897
  kind: z24.literal("turn.open"),
3230
2898
  providerTurnId: providerTurnIdSchema.optional(),
3231
- /** Provider-native parent tool-call id for delegated child turns. */
3232
2899
  parentRef: deltaKeyPartSchema.optional()
3233
2900
  }),
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
2901
  z24.object({
3242
2902
  kind: z24.literal("turn.boundary"),
3243
2903
  status: threadEventTurnStatusSchema,
@@ -3246,40 +2906,15 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3246
2906
  claimIfIdle: z24.boolean().optional(),
3247
2907
  providerTurnId: providerTurnIdSchema.optional()
3248
2908
  }),
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
2909
  z24.object({
3257
2910
  kind: z24.literal("item.open"),
3258
2911
  key: deltaItemKeySchema,
3259
2912
  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
2913
  presentation: deltaPresentationSchema.optional(),
3266
2914
  attach: deltaAttachSchema.optional(),
3267
2915
  providerTurnId: providerTurnIdSchema.optional(),
3268
2916
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3269
2917
  }).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
2918
  z24.object({
3284
2919
  kind: z24.literal("item.close"),
3285
2920
  key: deltaItemKeySchema,
@@ -3287,32 +2922,12 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3287
2922
  resultText: z24.string().optional(),
3288
2923
  exitCode: z24.number().optional(),
3289
2924
  aggregatedOutput: z24.string().optional(),
3290
- /** Terminal approval verdict (codex declined → denied). Default null. */
3291
2925
  approvalStatus: z24.literal("denied").optional(),
3292
2926
  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
2927
  presentation: deltaPresentationSchema.optional(),
3300
2928
  providerTurnId: providerTurnIdSchema.optional(),
3301
2929
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3302
2930
  }).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
2931
  z24.object({
3317
2932
  kind: z24.literal("item.progress"),
3318
2933
  key: deltaItemKeySchema,
@@ -3322,17 +2937,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3322
2937
  providerTurnId: providerTurnIdSchema.optional(),
3323
2938
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3324
2939
  }),
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
2940
  z24.object({
3337
2941
  kind: z24.literal("item.textDelta"),
3338
2942
  key: deltaItemKeySchema,
@@ -3341,18 +2945,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3341
2945
  providerTurnId: providerTurnIdSchema.optional(),
3342
2946
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3343
2947
  }),
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
2948
  z24.object({
3357
2949
  kind: z24.literal("item.textClose"),
3358
2950
  key: deltaItemKeySchema,
@@ -3361,10 +2953,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3361
2953
  providerTurnId: providerTurnIdSchema.optional(),
3362
2954
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3363
2955
  }),
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
2956
  z24.object({
3369
2957
  kind: z24.literal("item.outputDelta"),
3370
2958
  key: deltaItemKeySchema,
@@ -3373,26 +2961,12 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3373
2961
  providerTurnId: providerTurnIdSchema.optional(),
3374
2962
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3375
2963
  }),
3376
- /**
3377
- * Cumulative command output snapshot (pi bash). The assembler diffs
3378
- * consecutive snapshots into `outputDelta`/`reset` events.
3379
- */
3380
2964
  z24.object({
3381
2965
  kind: z24.literal("command.outputSnapshot"),
3382
2966
  key: deltaItemKeySchema,
3383
2967
  text: z24.string(),
3384
2968
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3385
2969
  }),
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
2970
  z24.object({
3397
2971
  kind: z24.literal("usage"),
3398
2972
  total: threadEventTokenUsageBreakdownSchema,
@@ -3400,13 +2974,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3400
2974
  modelContextWindow: z24.number().nullable(),
3401
2975
  providerTurnId: providerTurnIdSchema.optional()
3402
2976
  }),
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
2977
  z24.object({
3411
2978
  kind: z24.literal("contextWindow"),
3412
2979
  used: z24.number().nullable(),
@@ -3421,54 +2988,26 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3421
2988
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
3422
2989
  }),
3423
2990
  z24.object({ kind: z24.literal("context.cleared") }),
3424
- /** The aggregate working-tree diff for a turn (codex turn/diff/updated). */
3425
2991
  z24.object({
3426
2992
  kind: z24.literal("turn.diff"),
3427
2993
  diff: z24.string(),
3428
2994
  providerTurnId: providerTurnIdSchema.optional()
3429
2995
  }),
3430
- // Thread metadata (codex thread lifecycle notifications).
3431
2996
  z24.object({ kind: z24.literal("thread.started") }),
3432
2997
  z24.object({
3433
2998
  kind: z24.literal("thread.identity"),
3434
2999
  providerThreadId: z24.string().min(1)
3435
3000
  }),
3436
3001
  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
3002
  z24.object({
3451
3003
  kind: z24.literal("extension.state"),
3452
3004
  extensionKind: extensionKindSchema,
3453
3005
  payload: jsonValueSchema
3454
3006
  }),
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
3007
  z24.object({
3462
3008
  kind: z24.literal("provider.rateLimits"),
3463
3009
  rateLimits: providerRateLimitStateSchema
3464
3010
  }),
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
3011
  z24.object({
3473
3012
  kind: z24.literal("provider.error"),
3474
3013
  message: z24.string(),
@@ -3480,13 +3019,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3480
3019
  providerTurnId: providerTurnIdSchema.optional(),
3481
3020
  threadScoped: z24.boolean().optional()
3482
3021
  }),
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
3022
  z24.object({
3491
3023
  kind: z24.literal("provider.modelFallback"),
3492
3024
  originalModel: z24.string().min(1),
@@ -3494,10 +3026,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3494
3026
  reason: z24.enum(["refusal", "provider"]),
3495
3027
  message: z24.string()
3496
3028
  }),
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
3029
  z24.object({
3502
3030
  kind: z24.literal("provider.warning"),
3503
3031
  summary: z24.string().optional(),
@@ -3505,15 +3033,6 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3505
3033
  category: threadEventWarningCategorySchema.optional(),
3506
3034
  vouchedTurn: z24.boolean().optional()
3507
3035
  }),
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
3036
  z24.object({
3518
3037
  kind: z24.literal("unhandled"),
3519
3038
  raw: providerRawEventSchema,
@@ -3523,18 +3042,7 @@ var threadDeltaSchema = z24.discriminatedUnion("kind", [
3523
3042
  parentRef: deltaKeyPartSchema.optional(),
3524
3043
  providerTurnId: providerTurnIdSchema.optional()
3525
3044
  }),
3526
- /**
3527
- * Lifecycle settlement: the session was interrupted. The assembler closes
3528
- * the open turn and open items as interrupted.
3529
- */
3530
3045
  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
3046
  z24.object({ kind: z24.literal("session.reset") })
3539
3047
  ]);
3540
3048
  var threadDeltaNotificationParamsSchema = z24.object({
@@ -3650,7 +3158,10 @@ var BridgeRecoveryError = class extends Error {
3650
3158
  code;
3651
3159
  recovery;
3652
3160
  constructor(args) {
3653
- super(args.message, args.cause === void 0 ? void 0 : { cause: args.cause });
3161
+ super(
3162
+ args.message,
3163
+ args.cause === void 0 ? void 0 : { cause: args.cause }
3164
+ );
3654
3165
  this.name = "BridgeRecoveryError";
3655
3166
  this.code = args.code;
3656
3167
  this.recovery = args.recovery;
@@ -3669,8 +3180,6 @@ function createBridgeIo({
3669
3180
  send2({
3670
3181
  jsonrpc: "2.0",
3671
3182
  id,
3672
- // Omitted rather than `undefined`: an error response without
3673
- // structured detail keeps the exact shape it has always had.
3674
3183
  error: { code, message, ...data === void 0 ? {} : { data } }
3675
3184
  });
3676
3185
  },
@@ -3708,12 +3217,7 @@ function runBridgeRequest(args) {
3708
3217
  }
3709
3218
 
3710
3219
  // ../provider-bridge-protocol/src/bridge-kit/bridge-recorder.ts
3711
- import {
3712
- closeSync,
3713
- mkdirSync,
3714
- openSync,
3715
- writeSync
3716
- } from "node:fs";
3220
+ import { closeSync, mkdirSync, openSync, writeSync } from "node:fs";
3717
3221
  import { join, resolve } from "node:path";
3718
3222
  import { StringDecoder } from "node:string_decoder";
3719
3223
  var PROVIDER_BRIDGE_RECORD_DIR_ENV = "BB_PROVIDER_BRIDGE_RECORD_DIR";
@@ -3796,7 +3300,10 @@ function createBridgeRecorder(args) {
3796
3300
  }
3797
3301
  const scopeDir = join(dir, scope);
3798
3302
  mkdirSync(scopeDir, { recursive: true });
3799
- const fd = openSync(join(scopeDir, bridgeRecordingFileName(direction)), "a");
3303
+ const fd = openSync(
3304
+ join(scopeDir, bridgeRecordingFileName(direction)),
3305
+ "a"
3306
+ );
3800
3307
  fds.set(key, fd);
3801
3308
  return fd;
3802
3309
  }
@@ -3847,13 +3354,21 @@ function createBridgeRecorder(args) {
3847
3354
  const { stdin, stdout } = child;
3848
3355
  if (stdout) {
3849
3356
  const splitter = createRecordingLineSplitter(
3850
- (line) => record({ direction: "provider\u2192bridge", line, threadId: scope.threadId })
3357
+ (line) => record({
3358
+ direction: "provider\u2192bridge",
3359
+ line,
3360
+ threadId: scope.threadId
3361
+ })
3851
3362
  );
3852
3363
  stdout.on("data", (chunk) => splitter.push(chunk));
3853
3364
  }
3854
3365
  if (stdin) {
3855
3366
  const splitter = createRecordingLineSplitter(
3856
- (line) => record({ direction: "bridge\u2192provider", line, threadId: scope.threadId })
3367
+ (line) => record({
3368
+ direction: "bridge\u2192provider",
3369
+ line,
3370
+ threadId: scope.threadId
3371
+ })
3857
3372
  );
3858
3373
  const originalWrite = stdin.write.bind(stdin);
3859
3374
  stdin.write = ((chunk, ...rest) => {
@@ -4018,9 +3533,6 @@ function decodeToolCallResponsePayload(result) {
4018
3533
  };
4019
3534
  }
4020
3535
  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
3536
  content: text,
4025
3537
  contentBlocks,
4026
3538
  images,
@@ -4243,16 +3755,10 @@ import { z as z30 } from "zod";
4243
3755
  var normalizedToolCallRequestSchema = z30.object({
4244
3756
  providerThreadId: z30.string().min(1),
4245
3757
  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
3758
  turnId: z30.union([z30.string().min(1), z30.null()]),
4249
3759
  callId: z30.string().min(1),
4250
3760
  tool: z30.string().min(1),
4251
3761
  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
3762
  providerNativeIds: z30.boolean().optional()
4257
3763
  });
4258
3764
 
@@ -4684,9 +4190,7 @@ var acpFsWriteNotificationParamsSchema = z33.object({
4684
4190
  threadId: z33.string().min(1),
4685
4191
  path: z33.string().min(1),
4686
4192
  kind: z33.enum(["add", "update"]),
4687
- /** Absent on `add`: the file did not exist before the write. */
4688
4193
  oldText: z33.string().optional(),
4689
- /** The written file content; the assembler builds the diff from it. */
4690
4194
  content: z33.string()
4691
4195
  }).passthrough();
4692
4196
  var acpWarningNotificationParamsSchema = z33.object({
@@ -5160,8 +4664,6 @@ function grokClassifyToolCall(event) {
5160
4664
  const label = input?.description ?? input?.prompt ?? event.title ?? "Subagent";
5161
4665
  const shape = {
5162
4666
  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
4667
  childRef: event.toolCallId,
5166
4668
  label,
5167
4669
  background: false
@@ -5253,8 +4755,6 @@ var ompBashRawOutputSchema = z35.object({
5253
4755
  signal: z35.unknown().optional(),
5254
4756
  async: z35.unknown().optional()
5255
4757
  }).passthrough(),
5256
- // If an OMP version emits generic ACP result fields, the shared parser
5257
- // owns those exit/output/timeout/signal semantics.
5258
4758
  exitCode: z35.number().int().nullable().optional(),
5259
4759
  exit_code: z35.number().int().nullable().optional(),
5260
4760
  stdout: z35.string().optional(),
@@ -5375,7 +4875,6 @@ var acpRawInputPathSchema = z36.object({
5375
4875
  path: z36.string().optional(),
5376
4876
  filePath: z36.string().optional(),
5377
4877
  file_path: z36.string().optional(),
5378
- /** grok's `read_file` / `search_replace` argument name. */
5379
4878
  target_file: z36.string().optional()
5380
4879
  }).passthrough();
5381
4880
  function resolveAcpToolCallPath(value, options) {
@@ -6512,8 +6011,6 @@ function createAcpDeltaTranslator(options = {}) {
6512
6011
  const status = params.data.status;
6513
6012
  return [
6514
6013
  ...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
6014
  ...status === "completed" ? [{ kind: "context.compacted" }] : [],
6518
6015
  {
6519
6016
  kind: "turn.boundary",
@@ -6713,12 +6210,6 @@ function buildToolUseSubject(toolCall, options, dialectClassify) {
6713
6210
  kind: "tool_use",
6714
6211
  itemId: toolCall.toolCallId,
6715
6212
  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
6213
  presentation: described.presentation
6723
6214
  };
6724
6215
  }
@@ -6759,9 +6250,6 @@ function buildAcpPermissionInteractionPayload(args) {
6759
6250
  subject: {
6760
6251
  kind: "file_change",
6761
6252
  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
6253
  writeScope: resolveAcpFileChangeWriteScope(
6766
6254
  ownPaths.length > 0 ? ownPaths : operation.paths
6767
6255
  ),
@@ -6924,8 +6412,6 @@ function buildAcpNativeReasoningSupport(thoughtLevelOption) {
6924
6412
  );
6925
6413
  if (supportedReasoningEfforts.length === 0) {
6926
6414
  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
6415
  supportedReasoningEfforts: thoughtLevelOption === void 0 ? ACP_NATIVE_REASONING_EFFORTS : [],
6930
6416
  defaultReasoningEffort: "medium"
6931
6417
  };
@@ -7109,7 +6595,6 @@ function buildAgentModelCatalog(rawModels) {
7109
6595
  description: nameByLevel.get(level) ?? ""
7110
6596
  })),
7111
6597
  defaultReasoningEffort: defaultEntry.level,
7112
- // The agent lists its default model first.
7113
6598
  isDefault: models.length === 0
7114
6599
  });
7115
6600
  variantsByFamilyId.set(defaultVariant.id, byLevel);
@@ -7297,7 +6782,6 @@ function buildAcpModelSelectionParam(launchSpec, options, parameterizedModelPick
7297
6782
  selectFlag: launchSpec.modelCli.selectFlag,
7298
6783
  model,
7299
6784
  ...options.reasoningLevel !== void 0 ? { reasoningLevel: options.reasoningLevel } : {},
7300
- // Only "fast" changes launch resolution; "default" is the normal id.
7301
6785
  ...options.serviceTier === "fast" ? { serviceTier: options.serviceTier } : {}
7302
6786
  }
7303
6787
  };
@@ -7462,6 +6946,9 @@ function createAcpAgentConnection(options) {
7462
6946
  terminal: false
7463
6947
  });
7464
6948
  stdoutLines.on("line", (line) => {
6949
+ if (stopping) {
6950
+ return;
6951
+ }
7465
6952
  const message = parseAgentLine(line);
7466
6953
  if (!message) {
7467
6954
  return;
@@ -7635,9 +7122,6 @@ var bridgeToolCallResponseSchema = z38.union([
7635
7122
  })
7636
7123
  ])
7637
7124
  ).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
7125
  images: z38.array(z38.object({ data: z38.string(), mimeType: z38.string() })).default([]),
7642
7126
  isError: z38.boolean().optional()
7643
7127
  }),
@@ -8124,6 +7608,8 @@ async function forwardDynamicToolCall(args) {
8124
7608
  function handleDynamicToolBridgeSocket(bridge, socket) {
8125
7609
  let buffer = "";
8126
7610
  socket.setEncoding("utf8");
7611
+ socket.on("error", () => {
7612
+ });
8127
7613
  socket.on("data", (chunk) => {
8128
7614
  buffer += chunk;
8129
7615
  const newlineIndex = buffer.indexOf("\n");
@@ -8169,6 +7655,8 @@ async function ensureDynamicToolBridge() {
8169
7655
  dynamicToolBridgePromise = new Promise((resolveBridge, rejectBridge) => {
8170
7656
  const host = "127.0.0.1";
8171
7657
  const server = createServer((socket) => {
7658
+ socket.on("error", () => {
7659
+ });
8172
7660
  void dynamicToolBridgePromise?.then((bridge) => {
8173
7661
  handleDynamicToolBridgeSocket(bridge, socket);
8174
7662
  });
@@ -8930,8 +8418,6 @@ function handlePermissionRequest(session, params, responder) {
8930
8418
  toolCall: normalizedToolCall,
8931
8419
  options: parsed.data.options,
8932
8420
  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
8421
  classifyToolCall: session.dialect.classifyToolCall
8936
8422
  });
8937
8423
  void sendRuntimeRequest(BRIDGE_INBOUND_REQUEST_METHODS.interactionRequest, {
@@ -9664,24 +9150,10 @@ function decodeLaunchSpec(providerOptions) {
9664
9150
  return launchSpec.success ? launchSpec.data : null;
9665
9151
  }
9666
9152
  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
9153
  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
9154
  acpDialect: z39.string().min(1).optional(),
9680
- /** Enables an agent's separate model configuration options. */
9681
9155
  parameterizedModelPicker: z39.boolean().optional(),
9682
- /** Bare model ids shown before the collapsed "More models" pool. */
9683
9156
  primaryModels: z39.array(z39.string().min(1)).optional(),
9684
- /** Model ids to probe first during bounded native discovery. */
9685
9157
  reasoningProbePriorityModelIds: z39.array(z39.string().min(1)).optional()
9686
9158
  }).passthrough();
9687
9159
  function decodeAcpModelPickerOptions(providerOptions) {
@@ -9720,16 +9192,8 @@ async function handleRequest2(request) {
9720
9192
  threadGoalClear: false,
9721
9193
  fork: "tip",
9722
9194
  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
9195
  grammarVersions: [THREAD_DELTA_GRAMMAR_V3, THREAD_DELTA_GRAMMAR_V3],
9729
9196
  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
9197
  skills: { configure: true }
9734
9198
  }
9735
9199
  };
@@ -10019,16 +9483,10 @@ async function probeAcpAgent(request) {
10019
9483
  command: request.command,
10020
9484
  args: [...request.args],
10021
9485
  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
9486
  env: withoutBridgeRuntimeEnv({ ...process.env, ...request.env ?? {} }),
10027
9487
  recordThreadId: null,
10028
9488
  onNotification: () => {
10029
9489
  },
10030
- // A probe is not a session: an agent that asks the client anything
10031
- // before initialize returns gets a plain "not supported".
10032
9490
  onRequest: (_method, _params, responder) => {
10033
9491
  responder.error(-32601, "bb is probing this agent's capabilities");
10034
9492
  },
@@ -10042,7 +9500,9 @@ async function probeAcpAgent(request) {
10042
9500
  const timeout = new Promise((_resolve, reject) => {
10043
9501
  setTimeout(
10044
9502
  () => reject(
10045
- new Error(`the agent did not answer initialize within ${timeoutMs}ms`)
9503
+ new Error(
9504
+ `the agent did not answer initialize within ${timeoutMs}ms`
9505
+ )
10046
9506
  ),
10047
9507
  timeoutMs
10048
9508
  ).unref?.();
@@ -10054,8 +9514,6 @@ async function probeAcpAgent(request) {
10054
9514
  params: {
10055
9515
  protocolVersion: ACP_PROTOCOL_VERSION,
10056
9516
  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
9517
  clientCapabilities: {
10060
9518
  fs: { readTextFile: true, writeTextFile: true },
10061
9519
  terminal: false