@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.
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +0 -25
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +0 -200
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +0 -440
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +0 -665
- package/bundled-types/bb-plugin-sdk-testing.d.ts +0 -16
- package/bundled-types/bb-plugin-sdk.d.ts +25 -277
- package/dist/ai-services.js +5 -1
- package/dist/internal/host-policy.js +95 -108
- package/dist/provider-bridge-acp.js +72 -615
- package/dist/provider-bridge-testing.js +175 -579
- package/dist/provider-bridge-worker-entry.mjs +15 -9
- package/dist/provider-bridge.js +62 -557
- package/dist/testing/index.js +133 -114
- package/package.json +1 -1
|
@@ -111,16 +111,7 @@ var canonicalPromptMentionResourceSchema = z2.discriminatedUnion("kind", [
|
|
|
111
111
|
z2.object({
|
|
112
112
|
kind: z2.literal("plugin"),
|
|
113
113
|
pluginId: z2.string(),
|
|
114
|
-
/**
|
|
115
|
-
* Named shared-UI icon hint supplied by the plugin mention item. Omitted
|
|
116
|
-
* by mentions persisted before icon hints were stored.
|
|
117
|
-
*/
|
|
118
114
|
icon: z2.string().nullable().optional(),
|
|
119
|
-
/**
|
|
120
|
-
* Opaque item reference minted by the server's mention search
|
|
121
|
-
* (`<providerId>:<provider item id>`); resolved back through the same
|
|
122
|
-
* plugin's mention provider at send time (plugin design §4.9).
|
|
123
|
-
*/
|
|
124
115
|
itemId: z2.string(),
|
|
125
116
|
label: z2.string()
|
|
126
117
|
})
|
|
@@ -159,21 +150,11 @@ var promptInputSchema = z2.discriminatedUnion("type", [
|
|
|
159
150
|
}),
|
|
160
151
|
z2.object({
|
|
161
152
|
type: z2.literal("localImage"),
|
|
162
|
-
/**
|
|
163
|
-
* Absolute paths and URI-like values are passed through to the runtime.
|
|
164
|
-
* Relative paths are server-managed attachment references, not workspace
|
|
165
|
-
* relative files.
|
|
166
|
-
*/
|
|
167
153
|
path: z2.string(),
|
|
168
154
|
...promptInputVisibilityFields
|
|
169
155
|
}),
|
|
170
156
|
z2.object({
|
|
171
157
|
type: z2.literal("localFile"),
|
|
172
|
-
/**
|
|
173
|
-
* Absolute paths and URI-like values are passed through to the runtime.
|
|
174
|
-
* Relative paths are server-managed attachment references, not workspace
|
|
175
|
-
* relative files.
|
|
176
|
-
*/
|
|
177
158
|
path: z2.string(),
|
|
178
159
|
name: z2.string().optional(),
|
|
179
160
|
sizeBytes: z2.number().int().nonnegative().optional(),
|
|
@@ -241,13 +222,7 @@ var runtimeThreadExecutionBaseOptionsSchema = z2.object({
|
|
|
241
222
|
model: z2.string().min(1),
|
|
242
223
|
serviceTier: serviceTierSchema,
|
|
243
224
|
reasoningLevel: reasoningLevelSchema,
|
|
244
|
-
/** Present only when the prompt entered a BB prompt mode. */
|
|
245
225
|
promptMode: promptModeSchema.optional(),
|
|
246
|
-
/**
|
|
247
|
-
* Plugin-derived, provider-scoped options. Always present — an empty
|
|
248
|
-
* object when the provider derives none — so the daemon never has to
|
|
249
|
-
* guess whether the server ran the hook.
|
|
250
|
-
*/
|
|
251
226
|
providerOptions: jsonObjectSchema
|
|
252
227
|
});
|
|
253
228
|
var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
|
|
@@ -280,7 +255,6 @@ var workflowAgentStateValues = [
|
|
|
280
255
|
];
|
|
281
256
|
var workflowAgentStateSchema = z3.enum(workflowAgentStateValues);
|
|
282
257
|
var workflowAgentSnapshotSchema = z3.object({
|
|
283
|
-
/** 1-based agent counter; the stable identity for fold/replace semantics. */
|
|
284
258
|
index: z3.number().int().positive(),
|
|
285
259
|
label: z3.string(),
|
|
286
260
|
state: workflowAgentStateSchema,
|
|
@@ -304,10 +278,8 @@ var workflowAgentSnapshotSchema = z3.object({
|
|
|
304
278
|
durationMs: z3.number().optional()
|
|
305
279
|
});
|
|
306
280
|
var workflowPhaseSnapshotSchema = z3.object({
|
|
307
|
-
/** 1-based phase counter; meta.phases are seeded before any agent runs. */
|
|
308
281
|
index: z3.number().int().positive(),
|
|
309
282
|
title: z3.string(),
|
|
310
|
-
/** "child" marks a nested workflow() sub-run group. */
|
|
311
283
|
kind: z3.string().optional()
|
|
312
284
|
});
|
|
313
285
|
var workflowProgressSnapshotSchema = z3.object({
|
|
@@ -340,9 +312,7 @@ function jsonByteLength(value) {
|
|
|
340
312
|
import { z as z4 } from "zod";
|
|
341
313
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
342
314
|
var threadEventItemPresentationLabelSchema = z4.object({
|
|
343
|
-
/** Present-tense row title while the item is in flight ("Reading file"). */
|
|
344
315
|
pending: z4.string().min(1),
|
|
345
|
-
/** Past-tense row title once the item settled ("Read file"). */
|
|
346
316
|
completed: z4.string().min(1)
|
|
347
317
|
});
|
|
348
318
|
var threadEventItemPresentationIconSchema = z4.object({
|
|
@@ -355,16 +325,9 @@ var threadEventItemPresentationTintSchema = z4.object({
|
|
|
355
325
|
var threadEventItemPresentationSchema = z4.object({
|
|
356
326
|
label: threadEventItemPresentationLabelSchema,
|
|
357
327
|
icon: threadEventItemPresentationIconSchema,
|
|
358
|
-
/** Row headline beside the label (a path, a query, a child thread title). */
|
|
359
328
|
title: z4.string().optional(),
|
|
360
|
-
/**
|
|
361
|
-
* Short Markdown summary shown in the row body. Length-capped here so a
|
|
362
|
-
* bridge cannot turn the persisted row into a transcript.
|
|
363
|
-
*/
|
|
364
329
|
detail: z4.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
365
|
-
/** Low-value rows (TodoWrite, ToolSearch) clients collapse by default. */
|
|
366
330
|
suppress: z4.boolean().optional(),
|
|
367
|
-
/** Accent colour per theme; omitted rows use the neutral row tint. */
|
|
368
331
|
tint: threadEventItemPresentationTintSchema.optional()
|
|
369
332
|
});
|
|
370
333
|
|
|
@@ -484,9 +447,7 @@ var pendingInteractionPermissionGrantApprovalSubjectSchema = z6.object({
|
|
|
484
447
|
var pendingInteractionPlanApprovalSubjectSchema = z6.object({
|
|
485
448
|
kind: z6.literal("plan"),
|
|
486
449
|
itemId: z6.string().min(1),
|
|
487
|
-
/** The plan body, as Markdown. */
|
|
488
450
|
plan: z6.string().min(1),
|
|
489
|
-
/** Where the provider saved the plan, or null when it kept it in memory. */
|
|
490
451
|
planFilePath: z6.string().min(1).nullable()
|
|
491
452
|
});
|
|
492
453
|
var pendingInteractionToolUseApprovalSubjectSchema = z6.object({
|
|
@@ -788,21 +749,13 @@ var systemEventTypeValues = [
|
|
|
788
749
|
"client/turn/rejected",
|
|
789
750
|
"client/turn/start",
|
|
790
751
|
"system/error",
|
|
791
|
-
// Legacy persisted user-visible system event from a removed runtime path.
|
|
792
|
-
// Retained for read/decode/render compatibility only.
|
|
793
752
|
"system/manager/user_message",
|
|
794
753
|
"system/thread/interrupted",
|
|
795
754
|
"system/operation",
|
|
796
755
|
"system/interaction/lifecycle",
|
|
797
|
-
// Legacy persisted per-shape interaction events; every status change now
|
|
798
|
-
// appends one `system/interaction/lifecycle`. Retained for read/decode
|
|
799
|
-
// only: `convertLegacyStoredThreadEvent` projects a stored row into the
|
|
800
|
-
// lifecycle event, so no consumer sees these types.
|
|
801
756
|
"system/permissionGrant/lifecycle",
|
|
802
757
|
"system/userQuestion/lifecycle",
|
|
803
758
|
"system/thread-provisioning",
|
|
804
|
-
// Legacy persisted watchdog diagnostic; retained for read/decode/render
|
|
805
|
-
// only, with no current producer.
|
|
806
759
|
"system/provider-turn-watchdog"
|
|
807
760
|
];
|
|
808
761
|
var threadTurnInitiatorValues = ["user", "agent", "system"];
|
|
@@ -854,18 +807,10 @@ var clientTurnLifecycleEventDataSchema = z8.object({
|
|
|
854
807
|
var turnRequestEventDataSchema = z8.object({
|
|
855
808
|
direction: z8.literal("outbound"),
|
|
856
809
|
requestId: clientTurnRequestIdSchema,
|
|
857
|
-
/** Failed request resumed by a guarded system continuation, when present. */
|
|
858
810
|
continuationOfRequestId: clientTurnRequestIdSchema.optional(),
|
|
859
811
|
source: z8.enum(["spawn", "tell"]),
|
|
860
812
|
initiator: threadTurnInitiatorSchema,
|
|
861
|
-
// Non-null only when initiator === "agent". The invariant is enforced by
|
|
862
|
-
// writer typings rather than a schema refine so legacy persisted events
|
|
863
|
-
// (initiator: "agent", senderThreadId: null from before the field
|
|
864
|
-
// existed) still parse — the stored variant defaults both fields.
|
|
865
813
|
senderThreadId: z8.string().nullable(),
|
|
866
|
-
// Family-B system-message taxonomy fields. Optional at the persisted-event
|
|
867
|
-
// level: legacy events (pre-taxonomy) lack them and must still parse. The
|
|
868
|
-
// projection defaults absent values to `unlabeled` / `null`.
|
|
869
814
|
systemMessageKind: systemMessageKindSchema.optional(),
|
|
870
815
|
systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
|
|
871
816
|
input: z8.array(promptInputSchema),
|
|
@@ -951,8 +896,6 @@ var systemUserQuestionLifecycleEventDataSchema = z8.object({
|
|
|
951
896
|
var systemThreadInterruptedReasonValues = [
|
|
952
897
|
"manual-stop",
|
|
953
898
|
"host-daemon-restarted",
|
|
954
|
-
// Legacy persisted watchdog interruption; retained for read/replay only,
|
|
955
|
-
// with no current producer.
|
|
956
899
|
"provider-turn-idle"
|
|
957
900
|
];
|
|
958
901
|
var systemThreadInterruptedReasonSchema = z8.enum(
|
|
@@ -996,11 +939,6 @@ var systemProviderTurnWatchdogEventDataSchema = z8.object({
|
|
|
996
939
|
activeTurnId: z8.string().min(1),
|
|
997
940
|
activeTurnStartedAt: z8.number().int().nonnegative(),
|
|
998
941
|
lastActivityEventSequence: z8.number().int().positive(),
|
|
999
|
-
/**
|
|
1000
|
-
* Diagnostic label only (the UI interpolates it verbatim). A plain string —
|
|
1001
|
-
* not the activity enum — so editing event classifications never makes
|
|
1002
|
-
* previously persisted watchdog events unparseable.
|
|
1003
|
-
*/
|
|
1004
942
|
lastActivityEventType: z8.string().min(1),
|
|
1005
943
|
lastActivityEventAt: z8.number().int().nonnegative(),
|
|
1006
944
|
providerId: z8.string().min(1),
|
|
@@ -1272,7 +1210,6 @@ var providerRateLimitStatusSchema = z11.enum([
|
|
|
1272
1210
|
"unknown"
|
|
1273
1211
|
]);
|
|
1274
1212
|
var providerRateLimitWindowSchema = z11.object({
|
|
1275
|
-
/** Opaque provider-issued key. New provider windows must not break parsing. */
|
|
1276
1213
|
providerKey: z11.string().min(1).nullable(),
|
|
1277
1214
|
label: z11.string().min(1).nullable(),
|
|
1278
1215
|
status: providerRateLimitStatusSchema,
|
|
@@ -1357,11 +1294,9 @@ var threadEventDelegationItemSchema = z11.object({
|
|
|
1357
1294
|
type: z11.literal("delegation"),
|
|
1358
1295
|
id: z11.string(),
|
|
1359
1296
|
childRef: z11.string().min(1),
|
|
1360
|
-
/** Human label for the delegated work (the child's description). */
|
|
1361
1297
|
label: z11.string(),
|
|
1362
1298
|
status: threadEventItemStatusSchema,
|
|
1363
1299
|
background: z11.boolean(),
|
|
1364
|
-
/** Terminal summary from the child; absent while it runs. */
|
|
1365
1300
|
summary: z11.string().optional(),
|
|
1366
1301
|
...itemPresentationField,
|
|
1367
1302
|
parentToolCallId: z11.string().optional()
|
|
@@ -1422,10 +1357,6 @@ var threadEventWarningCategorySchema = z11.enum([
|
|
|
1422
1357
|
"deprecation",
|
|
1423
1358
|
"config",
|
|
1424
1359
|
"general",
|
|
1425
|
-
/**
|
|
1426
|
-
* The provider declined a compaction that bb asked for because there was
|
|
1427
|
-
* nothing to compact. The warning settles the pending compaction row.
|
|
1428
|
-
*/
|
|
1429
1360
|
"compaction-skipped"
|
|
1430
1361
|
]);
|
|
1431
1362
|
var providerRawEventSchema = z11.object({
|
|
@@ -1454,28 +1385,15 @@ var toolCallProgressEventSchema = z11.object({
|
|
|
1454
1385
|
var threadEventBackgroundTaskItemSchema = z11.object({
|
|
1455
1386
|
type: z11.literal("backgroundTask"),
|
|
1456
1387
|
id: z11.string(),
|
|
1457
|
-
/**
|
|
1458
|
-
* The provider's stable task id, shared by every generation (restart) of
|
|
1459
|
-
* the same task; consumers use it to correlate a restarted task with its
|
|
1460
|
-
* earlier generations. Absent only on events persisted before the field
|
|
1461
|
-
* existed — those encoded the family in the item id's legacy `#N`
|
|
1462
|
-
* generation suffix instead.
|
|
1463
|
-
*/
|
|
1464
1388
|
familyId: z11.string().optional(),
|
|
1465
|
-
/** Raw SDK task discriminant (e.g. "local_workflow"); "unknown" when the provider omitted it. */
|
|
1466
1389
|
taskType: z11.string(),
|
|
1467
1390
|
description: z11.string(),
|
|
1468
1391
|
status: threadEventItemStatusSchema,
|
|
1469
1392
|
taskStatus: backgroundTaskStatusSchema,
|
|
1470
|
-
/** Ambient/housekeeping task; consumers hide it from the inline transcript. */
|
|
1471
1393
|
skipTranscript: z11.boolean(),
|
|
1472
|
-
/** meta.name of the workflow script; only present for workflow tasks. */
|
|
1473
1394
|
workflowName: z11.string().optional(),
|
|
1474
|
-
/** Merged workflow tree; absent until the provider reports progress records. */
|
|
1475
1395
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
1476
|
-
/** Absent until the provider reports usage. */
|
|
1477
1396
|
usage: backgroundTaskUsageSchema.optional(),
|
|
1478
|
-
/** Terminal summary from the provider; absent while the task runs. */
|
|
1479
1397
|
summary: z11.string().optional(),
|
|
1480
1398
|
error: z11.string().optional(),
|
|
1481
1399
|
outputFile: z11.string().optional(),
|
|
@@ -1483,7 +1401,6 @@ var threadEventBackgroundTaskItemSchema = z11.object({
|
|
|
1483
1401
|
parentToolCallId: z11.string().optional()
|
|
1484
1402
|
});
|
|
1485
1403
|
var threadEventItemSchema = z11.discriminatedUnion("type", [
|
|
1486
|
-
// bb authors user messages itself, so they carry no bridge presentation.
|
|
1487
1404
|
z11.object({
|
|
1488
1405
|
type: z11.literal("userMessage"),
|
|
1489
1406
|
id: z11.string(),
|
|
@@ -1505,10 +1422,6 @@ var threadEventItemSchema = z11.discriminatedUnion("type", [
|
|
|
1505
1422
|
cwd: z11.string(),
|
|
1506
1423
|
status: threadEventItemStatusSchema,
|
|
1507
1424
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1508
|
-
/**
|
|
1509
|
-
* Omitted when the process produced no stdout/stderr. Adapters should omit
|
|
1510
|
-
* this field instead of emitting an empty string placeholder.
|
|
1511
|
-
*/
|
|
1512
1425
|
aggregatedOutput: z11.string().optional(),
|
|
1513
1426
|
exitCode: z11.number().optional(),
|
|
1514
1427
|
durationMs: z11.number().optional(),
|
|
@@ -1541,10 +1454,6 @@ var threadEventItemSchema = z11.discriminatedUnion("type", [
|
|
|
1541
1454
|
error: z11.string().optional(),
|
|
1542
1455
|
durationMs: z11.number().optional(),
|
|
1543
1456
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1544
|
-
/**
|
|
1545
|
-
* The escape hatch for tools with no core kind: the bridge says how the
|
|
1546
|
-
* row reads (label, glyph, headline, suppression).
|
|
1547
|
-
*/
|
|
1548
1457
|
...itemPresentationField,
|
|
1549
1458
|
parentToolCallId: z11.string().optional()
|
|
1550
1459
|
}),
|
|
@@ -1593,12 +1502,9 @@ var unscopedProviderEventSchema = z11.discriminatedUnion("type", [
|
|
|
1593
1502
|
z11.object({
|
|
1594
1503
|
type: z11.literal("turn/completed"),
|
|
1595
1504
|
threadId: z11.string(),
|
|
1596
|
-
// Server reconciliation can synthesize interrupted completions when the
|
|
1597
|
-
// original provider thread id was never persisted.
|
|
1598
1505
|
providerThreadId: z11.string().nullable(),
|
|
1599
1506
|
status: threadEventTurnStatusSchema,
|
|
1600
1507
|
error: z11.object({ message: z11.string() }).optional(),
|
|
1601
|
-
/** Provider-native point through which a replacement branch should retain history. */
|
|
1602
1508
|
providerCheckpointId: z11.string().min(1).optional()
|
|
1603
1509
|
}),
|
|
1604
1510
|
z11.object({
|
|
@@ -1665,10 +1571,6 @@ var unscopedProviderEventSchema = z11.discriminatedUnion("type", [
|
|
|
1665
1571
|
providerThreadId: z11.string(),
|
|
1666
1572
|
itemId: z11.string(),
|
|
1667
1573
|
delta: z11.string(),
|
|
1668
|
-
/**
|
|
1669
|
-
* When true, this delta replaces previously accumulated command output
|
|
1670
|
-
* instead of appending to it. Omission means the delta appends.
|
|
1671
|
-
*/
|
|
1672
1574
|
reset: z11.boolean().optional(),
|
|
1673
1575
|
parentToolCallId: z11.string().optional()
|
|
1674
1576
|
}),
|
|
@@ -1713,49 +1615,24 @@ var unscopedProviderEventSchema = z11.discriminatedUnion("type", [
|
|
|
1713
1615
|
parentToolCallId: z11.string().optional()
|
|
1714
1616
|
}),
|
|
1715
1617
|
toolCallProgressEventSchema,
|
|
1716
|
-
/**
|
|
1717
|
-
* Superseding state snapshot for an in-flight background task. Thread-scoped
|
|
1718
|
-
* (not turn-scoped) because tasks outlive their spawning turn: late events
|
|
1719
|
-
* must not interleave into later turns' sequence-contiguous windows. Each
|
|
1720
|
-
* progress event carries the full current item state; consumers replace, not
|
|
1721
|
-
* merge. The item is placed in the timeline by its turn-scoped item/started.
|
|
1722
|
-
*/
|
|
1723
1618
|
z11.object({
|
|
1724
1619
|
type: z11.literal("item/backgroundTask/progress"),
|
|
1725
1620
|
threadId: z11.string(),
|
|
1726
1621
|
providerThreadId: z11.string(),
|
|
1727
1622
|
item: threadEventBackgroundTaskItemSchema
|
|
1728
1623
|
}),
|
|
1729
|
-
/**
|
|
1730
|
-
* Terminal state for a background task, carrying the full final item
|
|
1731
|
-
* payload. Dedicated event (instead of the generic turn-scoped
|
|
1732
|
-
* item/completed) because it may arrive turns after the item/started.
|
|
1733
|
-
*/
|
|
1734
1624
|
z11.object({
|
|
1735
1625
|
type: z11.literal("item/backgroundTask/completed"),
|
|
1736
1626
|
threadId: z11.string(),
|
|
1737
1627
|
providerThreadId: z11.string(),
|
|
1738
1628
|
item: threadEventBackgroundTaskItemSchema
|
|
1739
1629
|
}),
|
|
1740
|
-
/**
|
|
1741
|
-
* Superseding snapshot for an in-flight background delegation (`background:
|
|
1742
|
-
* true`). Thread-scoped for the same reason as `item/backgroundTask/
|
|
1743
|
-
* progress`: a background child outlives its spawning turn, and late events
|
|
1744
|
-
* must not interleave into later turns' sequence-contiguous windows. The
|
|
1745
|
-
* item is placed in the timeline by its turn-scoped `item/started`.
|
|
1746
|
-
*/
|
|
1747
1630
|
z11.object({
|
|
1748
1631
|
type: z11.literal("item/delegation/progress"),
|
|
1749
1632
|
threadId: z11.string(),
|
|
1750
1633
|
providerThreadId: z11.string(),
|
|
1751
1634
|
item: threadEventDelegationItemSchema
|
|
1752
1635
|
}),
|
|
1753
|
-
/**
|
|
1754
|
-
* Terminal state for a background delegation, carrying the full final item.
|
|
1755
|
-
* Dedicated event (instead of the turn-scoped `item/completed`) because it
|
|
1756
|
-
* may arrive turns after the `item/started`. Foreground delegations settle
|
|
1757
|
-
* through `item/completed`.
|
|
1758
|
-
*/
|
|
1759
1636
|
z11.object({
|
|
1760
1637
|
type: z11.literal("item/delegation/completed"),
|
|
1761
1638
|
threadId: z11.string(),
|
|
@@ -1802,16 +1679,6 @@ var unscopedProviderEventSchema = z11.discriminatedUnion("type", [
|
|
|
1802
1679
|
providerThreadId: z11.string(),
|
|
1803
1680
|
rateLimits: providerRateLimitStateSchema
|
|
1804
1681
|
}),
|
|
1805
|
-
/**
|
|
1806
|
-
* Plugin-declared thread state (grammar v3): a `"<pluginId>/<name>"` kind
|
|
1807
|
-
* beside the core thread-state family (usage, context window, rate limits,
|
|
1808
|
-
* model fallback, context cleared). Latest snapshot wins per `kind`: a
|
|
1809
|
-
* bridge re-sends the whole state, never a diff, and a consumer keeps one
|
|
1810
|
-
* value per kind. The server validated `payload` against the owning
|
|
1811
|
-
* plugin's declared `state` schema at ingest; a payload that failed that
|
|
1812
|
-
* check was persisted as `provider/unhandled` instead, so every stored row
|
|
1813
|
-
* of this type carries a payload its plugin vouched for.
|
|
1814
|
-
*/
|
|
1815
1682
|
z11.object({
|
|
1816
1683
|
type: z11.literal("thread/extensionState/updated"),
|
|
1817
1684
|
threadId: z11.string(),
|
|
@@ -1997,8 +1864,6 @@ var availableModelSchema = z13.object({
|
|
|
1997
1864
|
id: z13.string(),
|
|
1998
1865
|
model: z13.string(),
|
|
1999
1866
|
displayName: z13.string(),
|
|
2000
|
-
/** Provider route used to run this model when it is distinct from the
|
|
2001
|
-
* selected agent provider (for example, a model provider nested under Pi). */
|
|
2002
1867
|
routeProviderId: z13.string().min(1).optional(),
|
|
2003
1868
|
description: z13.string(),
|
|
2004
1869
|
supportedReasoningEfforts: z13.array(modelReasoningEffortSchema),
|
|
@@ -2012,20 +1877,8 @@ var providerCapabilitiesSchema = z13.object({
|
|
|
2012
1877
|
supportsServiceTier: z13.boolean(),
|
|
2013
1878
|
supportsNativeUserQuestion: z13.boolean(),
|
|
2014
1879
|
supportsFork: z13.boolean(),
|
|
2015
|
-
/**
|
|
2016
|
-
* The provider can recreate a session at an earlier point, which is what
|
|
2017
|
-
* edit-past-message rewind needs. Separate from `supportsFork`: ACP clones
|
|
2018
|
-
* whole sessions (tip-only) and cannot stop at a checkpoint.
|
|
2019
|
-
*/
|
|
2020
1880
|
supportsSessionRewind: z13.boolean(),
|
|
2021
1881
|
permissionModes: z13.array(permissionModeSchema).min(1),
|
|
2022
|
-
/**
|
|
2023
|
-
* How far one `model/list` answer travels: `"host"` when the bridge answers
|
|
2024
|
-
* from account or agent state and ignores the workspace path, so bb probes
|
|
2025
|
-
* once per machine; `"workspace"` when project configuration can change the
|
|
2026
|
-
* answer. Declared by the provider's plugin — core never infers it from an
|
|
2027
|
-
* id.
|
|
2028
|
-
*/
|
|
2029
1882
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
2030
1883
|
});
|
|
2031
1884
|
var providerComposerCommandSchema = z13.object({
|
|
@@ -2048,17 +1901,11 @@ var providerComposerActionSchema = z13.discriminatedUnion("kind", [
|
|
|
2048
1901
|
})
|
|
2049
1902
|
]);
|
|
2050
1903
|
var providerStringsSchema = z13.object({
|
|
2051
|
-
/** How to sign in on the host ("Run `claude` on the machine to sign in."). */
|
|
2052
1904
|
signInHint: z13.string().min(1),
|
|
2053
|
-
/** Shown when a session's credentials expired. */
|
|
2054
1905
|
expiredHint: z13.string().min(1),
|
|
2055
|
-
/** Where to install the agent. */
|
|
2056
1906
|
installUrl: z13.string().min(1),
|
|
2057
|
-
/** Brand prefix stripped from model display names ("Claude "). */
|
|
2058
1907
|
brandPrefix: z13.string().min(1).optional(),
|
|
2059
|
-
/** Plan-mode banner copy for providers that declare the `plan` action. */
|
|
2060
1908
|
planModeCopy: z13.string().min(1).optional(),
|
|
2061
|
-
/** Per-theme tint for the provider icon. */
|
|
2062
1909
|
iconTint: z13.object({ light: z13.string().min(1), dark: z13.string().min(1) }).optional()
|
|
2063
1910
|
});
|
|
2064
1911
|
var providerOptionDescriptorSchema = z13.object({
|
|
@@ -2076,31 +1923,11 @@ var providerExtensionKindsSchema = z13.record(
|
|
|
2076
1923
|
);
|
|
2077
1924
|
var providerInfoSchema = z13.object({
|
|
2078
1925
|
id: z13.string(),
|
|
2079
|
-
/**
|
|
2080
|
-
* The plugin that registered the provider (`bb.providers.register`). The
|
|
2081
|
-
* owner of the provider's extension-kind namespace, and the bundle the
|
|
2082
|
-
* app loads on the first thread of this provider.
|
|
2083
|
-
*/
|
|
2084
1926
|
pluginId: z13.string().min(1),
|
|
2085
1927
|
displayName: z13.string(),
|
|
2086
|
-
/**
|
|
2087
|
-
* Declared grouping key shared by related providers (the ACP agents).
|
|
2088
|
-
* Absent when the provider declared none. Grouping only.
|
|
2089
|
-
*/
|
|
2090
1928
|
family: z13.string().min(1).optional(),
|
|
2091
|
-
/**
|
|
2092
|
-
* The declared icon, projected by form. A plugin-relative asset path
|
|
2093
|
-
* (`icon: "./icons/agent.svg"`) is served by the provider-logo route and
|
|
2094
|
-
* arrives here as `logoUrl`; a named host glyph (`icon: "Zap"`) has no
|
|
2095
|
-
* bytes to serve and arrives as `icon.glyph`, the same vocabulary an
|
|
2096
|
-
* item presentation's `icon` uses. A declaration names at most one form,
|
|
2097
|
-
* so at most one of the two is set; `icon` is absent when the declaration
|
|
2098
|
-
* named a path or nothing. Clients draw a vendored brand mark first, then
|
|
2099
|
-
* `logoUrl`, then `icon.glyph`, then the display name's initial.
|
|
2100
|
-
*/
|
|
2101
1929
|
icon: z13.object({ glyph: z13.string().min(1) }).optional(),
|
|
2102
1930
|
logoUrl: z13.string().min(1).nullable(),
|
|
2103
|
-
/** Sessionless maintenance requests the provider's bridge implements. */
|
|
2104
1931
|
maintenance: z13.object({
|
|
2105
1932
|
health: z13.boolean(),
|
|
2106
1933
|
usage: z13.boolean(),
|
|
@@ -2109,13 +1936,6 @@ var providerInfoSchema = z13.object({
|
|
|
2109
1936
|
capabilities: providerCapabilitiesSchema,
|
|
2110
1937
|
composerActions: z13.array(providerComposerActionSchema),
|
|
2111
1938
|
available: z13.boolean(),
|
|
2112
|
-
// -------------------------------------------------------------------------
|
|
2113
|
-
// Target-state projection (docs/provider-plugin-api.md §1). Optional and
|
|
2114
|
-
// unfilled until WS2a projects them from the plugin declaration; absence
|
|
2115
|
-
// means "the provider declared none", never a default. The
|
|
2116
|
-
// `capabilities.supports*` fields above stay until WS2a stabilizes the
|
|
2117
|
-
// surface as one unit.
|
|
2118
|
-
// -------------------------------------------------------------------------
|
|
2119
1939
|
strings: providerStringsSchema.optional(),
|
|
2120
1940
|
serviceTiers: z13.array(providerOptionDescriptorSchema).optional(),
|
|
2121
1941
|
reasoningLevels: z13.array(providerOptionDescriptorSchema).optional(),
|
|
@@ -2175,24 +1995,14 @@ var deltaItemKeySchema = z14.object({
|
|
|
2175
1995
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2176
1996
|
var deltaFileChangeSchema = z14.object({
|
|
2177
1997
|
path: z14.string(),
|
|
2178
|
-
/** The bridge states the change kind; the assembler never derives it. */
|
|
2179
1998
|
kind: z14.enum(["add", "update", "delete"]),
|
|
2180
1999
|
movePath: z14.string().optional(),
|
|
2181
|
-
/** Provider-supplied unified diff; preferred over old/new text building. */
|
|
2182
2000
|
diff: z14.string().optional(),
|
|
2183
2001
|
oldText: z14.string().optional(),
|
|
2184
|
-
/** When present the assembler builds the unified diff from old/new text. */
|
|
2185
2002
|
newText: z14.string().optional()
|
|
2186
2003
|
});
|
|
2187
2004
|
var deltaBackgroundTaskShapeSchema = z14.object({
|
|
2188
2005
|
type: z14.literal("backgroundTask"),
|
|
2189
|
-
/**
|
|
2190
|
-
* The provider's stable task id, shared by every generation (restart) of
|
|
2191
|
-
* the same task. Rides through to the canonical item so consumers can
|
|
2192
|
-
* correlate a restarted task with its earlier generations — the assembler
|
|
2193
|
-
* mints fresh item ids per generation, so identity must travel as data,
|
|
2194
|
-
* never as id text.
|
|
2195
|
-
*/
|
|
2196
2006
|
familyId: z14.string().min(1),
|
|
2197
2007
|
taskType: z14.string(),
|
|
2198
2008
|
description: z14.string(),
|
|
@@ -2246,20 +2056,8 @@ var deltaItemShapeSchema = z14.discriminatedUnion("type", [
|
|
|
2246
2056
|
}),
|
|
2247
2057
|
z14.object({
|
|
2248
2058
|
type: z14.literal("fileChange"),
|
|
2249
|
-
/** Empty while a path is not yet known, including bare close fallbacks. */
|
|
2250
2059
|
changes: z14.array(deltaFileChangeSchema)
|
|
2251
2060
|
}),
|
|
2252
|
-
/**
|
|
2253
|
-
* The generic tool call: the escape hatch for tools with no core kind. In
|
|
2254
|
-
* grammar v3 the bridge says how the row reads through the delta's
|
|
2255
|
-
* `presentation` (label, icon, suppression) instead of core keeping a
|
|
2256
|
-
* tool-name table. A `tool` item without presentation is read as legacy
|
|
2257
|
-
* data: `@bb/domain`'s `upgradeLegacyToolItem` reshapes read/grep/glob/
|
|
2258
|
-
* find/ls by name and suppresses the Task- and Todo-family bookkeeping
|
|
2259
|
-
* calls when the stored row is parsed, and any other name renders with
|
|
2260
|
-
* the generic tool row — until the backfill migration, after which
|
|
2261
|
-
* `presentation` is required.
|
|
2262
|
-
*/
|
|
2263
2061
|
z14.object({
|
|
2264
2062
|
type: z14.literal("tool"),
|
|
2265
2063
|
tool: z14.string(),
|
|
@@ -2289,7 +2087,6 @@ var deltaItemShapeSchema = z14.discriminatedUnion("type", [
|
|
|
2289
2087
|
}),
|
|
2290
2088
|
z14.object({ type: z14.literal("imageView"), path: z14.string() }),
|
|
2291
2089
|
deltaBackgroundTaskShapeSchema,
|
|
2292
|
-
// Grammar v3 shapes. Every existing shape above is kept unchanged.
|
|
2293
2090
|
deltaFileReadShapeSchema,
|
|
2294
2091
|
deltaSearchShapeSchema,
|
|
2295
2092
|
deltaDelegationShapeSchema,
|
|
@@ -2323,51 +2120,21 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2323
2120
|
}
|
|
2324
2121
|
}
|
|
2325
2122
|
var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
2326
|
-
/**
|
|
2327
|
-
* The provider consumed an input (immediate or steered). The assembler owns
|
|
2328
|
-
* the queue-until-turn-opens behavior and the terminal-turn invariant.
|
|
2329
|
-
* With `providerTurnId` the acceptance is emitted against that vouched turn
|
|
2330
|
-
* directly (codex correlates acceptance to a named native turn).
|
|
2331
|
-
*/
|
|
2332
2123
|
z14.object({
|
|
2333
2124
|
kind: z14.literal("input.accepted"),
|
|
2334
2125
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2335
2126
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2336
2127
|
}),
|
|
2337
|
-
/**
|
|
2338
|
-
* Input the provider itself injected into the conversation, with no bb
|
|
2339
|
-
* client request behind it (a pi extension's `sendMessage` custom message
|
|
2340
|
-
* that triggered or steered a turn). The assembler records it as a
|
|
2341
|
-
* `userMessage` item in the open turn so the transcript shows what the
|
|
2342
|
-
* model was answering. Dropped silently when no turn is open: the provider
|
|
2343
|
-
* appended it to its own context without running the agent, so there is no
|
|
2344
|
-
* bb turn to attach it to.
|
|
2345
|
-
*/
|
|
2346
2128
|
z14.object({
|
|
2347
2129
|
kind: z14.literal("input.provider"),
|
|
2348
2130
|
text: z14.string().min(1),
|
|
2349
2131
|
parentRef: deltaKeyPartSchema.optional()
|
|
2350
2132
|
}),
|
|
2351
|
-
/**
|
|
2352
|
-
* An explicit provider signal opened work (pi `agent_start`, codex
|
|
2353
|
-
* `turn/started`). With `providerTurnId` the turn lives in the keyed
|
|
2354
|
-
* provider-turn space: several may be open at once (codex multiplexes
|
|
2355
|
-
* subagent child turns onto one thread) and none of the current-turn
|
|
2356
|
-
* machinery is touched.
|
|
2357
|
-
*/
|
|
2358
2133
|
z14.object({
|
|
2359
2134
|
kind: z14.literal("turn.open"),
|
|
2360
2135
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2361
|
-
/** Provider-native parent tool-call id for delegated child turns. */
|
|
2362
2136
|
parentRef: deltaKeyPartSchema.optional()
|
|
2363
2137
|
}),
|
|
2364
|
-
/**
|
|
2365
|
-
* The bridge's conclusion that the turn settled. `claimIfIdle: true` marks
|
|
2366
|
-
* fallback closers that own a turn only if accepted input is pending
|
|
2367
|
-
* (the old bridge-kit terminal-turn rule, applied centrally); an open turn is
|
|
2368
|
-
* always settled. A keyed boundary (`providerTurnId`) always emits — the
|
|
2369
|
-
* provider named the turn — and settles only that turn.
|
|
2370
|
-
*/
|
|
2371
2138
|
z14.object({
|
|
2372
2139
|
kind: z14.literal("turn.boundary"),
|
|
2373
2140
|
status: threadEventTurnStatusSchema,
|
|
@@ -2376,40 +2143,15 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2376
2143
|
claimIfIdle: z14.boolean().optional(),
|
|
2377
2144
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2378
2145
|
}),
|
|
2379
|
-
/**
|
|
2380
|
-
* A parsed item opened. `attach: "currentOrLast"` pins the item to the turn
|
|
2381
|
-
* that is open or just closed without opening a new one (pi threshold
|
|
2382
|
-
* compaction); the default attaches to the open turn only. A known
|
|
2383
|
-
* `providerItemId` reuses its minted bb id (an explicit open reopens the
|
|
2384
|
-
* same item, codex's settle/reopen rule).
|
|
2385
|
-
*/
|
|
2386
2146
|
z14.object({
|
|
2387
2147
|
kind: z14.literal("item.open"),
|
|
2388
2148
|
key: deltaItemKeySchema,
|
|
2389
2149
|
item: deltaItemShapeSchema,
|
|
2390
|
-
/**
|
|
2391
|
-
* Grammar v3: how the row reads, persisted with the opened item. The
|
|
2392
|
-
* one place presentation travels. Optional for core shapes while v2
|
|
2393
|
-
* deltas are accepted; REQUIRED for `extension` shapes.
|
|
2394
|
-
*/
|
|
2395
2150
|
presentation: deltaPresentationSchema.optional(),
|
|
2396
2151
|
attach: deltaAttachSchema.optional(),
|
|
2397
2152
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2398
2153
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2399
2154
|
}).superRefine(requireExtensionPresentation),
|
|
2400
|
-
/**
|
|
2401
|
-
* The item settled. `item` is REQUIRED and always carries the full terminal
|
|
2402
|
-
* item shape (Michael's uniform close rule, 2026-08-18): the assembler
|
|
2403
|
-
* builds the completed item from it. With a same-shaped item open under the
|
|
2404
|
-
* key, the terminal shape wins and the opened item contributes only its
|
|
2405
|
-
* minted id; with a different-shaped item open, the assembler closes the
|
|
2406
|
-
* opened shape and then emits the terminal shape (ACP's dual-complete);
|
|
2407
|
-
* with nothing open it builds the bare completed item.
|
|
2408
|
-
*
|
|
2409
|
-
* Provider-identified closes (`key.providerItemId`) dedup: a repeated close
|
|
2410
|
-
* for a settled id is dropped and an explicit `item.open` reopens the id
|
|
2411
|
-
* (codex retries the terminal notification after approvals).
|
|
2412
|
-
*/
|
|
2413
2155
|
z14.object({
|
|
2414
2156
|
kind: z14.literal("item.close"),
|
|
2415
2157
|
key: deltaItemKeySchema,
|
|
@@ -2417,32 +2159,12 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2417
2159
|
resultText: z14.string().optional(),
|
|
2418
2160
|
exitCode: z14.number().optional(),
|
|
2419
2161
|
aggregatedOutput: z14.string().optional(),
|
|
2420
|
-
/** Terminal approval verdict (codex declined → denied). Default null. */
|
|
2421
2162
|
approvalStatus: z14.literal("denied").optional(),
|
|
2422
2163
|
item: deltaItemShapeSchema,
|
|
2423
|
-
/**
|
|
2424
|
-
* Grammar v3: the terminal presentation. Like `item`, the close carries
|
|
2425
|
-
* the full terminal form; when absent the opened item's presentation
|
|
2426
|
-
* survives onto the completed item (close-echo). REQUIRED for an
|
|
2427
|
-
* `extension` shape, which has nothing to echo without it.
|
|
2428
|
-
*/
|
|
2429
2164
|
presentation: deltaPresentationSchema.optional(),
|
|
2430
2165
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2431
2166
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2432
2167
|
}).superRefine(requireExtensionPresentation),
|
|
2433
|
-
/**
|
|
2434
|
-
* Free-form progress on an open item (non-command tool updates), or — with
|
|
2435
|
-
* `snapshot` — a re-embedded snapshot of work that outlives its turn: a
|
|
2436
|
-
* background task (`item/backgroundTask/progress`) or, in grammar v3, a
|
|
2437
|
-
* background delegation (`item/delegation/progress`); both thread-scoped,
|
|
2438
|
-
* no turn required.
|
|
2439
|
-
*
|
|
2440
|
-
* Progress is throttled centrally by the assembler (one emission per item
|
|
2441
|
-
* key per policy interval, 500ms default; the newest suppressed snapshot is
|
|
2442
|
-
* flushed trailing-edge on the thread's next traffic once the window
|
|
2443
|
-
* elapses, and an `item.close` supersedes it). `flush: true` bypasses the
|
|
2444
|
-
* throttle and resets the window — status transitions must land immediately.
|
|
2445
|
-
*/
|
|
2446
2168
|
z14.object({
|
|
2447
2169
|
kind: z14.literal("item.progress"),
|
|
2448
2170
|
key: deltaItemKeySchema,
|
|
@@ -2452,17 +2174,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2452
2174
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2453
2175
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2454
2176
|
}),
|
|
2455
|
-
/**
|
|
2456
|
-
* Streamed text — the one streaming dialect. Every text stream is keyed
|
|
2457
|
-
* like every other item: by the provider's own item id when the provider
|
|
2458
|
-
* names its message items (codex), or by a bridge-chosen `key.channel`
|
|
2459
|
-
* (`"assistant"`, `"thinking-2"`) plus `key.parentRef` for providers whose
|
|
2460
|
-
* streams are anonymous (claude, pi, acp). The first delta for an unknown
|
|
2461
|
-
* key synthesizes the channel's `item/started`; later deltas (and deltas
|
|
2462
|
-
* for a provider id already opened or settled) reuse the mapped id. The
|
|
2463
|
-
* assembler accumulates the stream text per open item so `item.textClose`
|
|
2464
|
-
* can settle without a provider-final text.
|
|
2465
|
-
*/
|
|
2466
2177
|
z14.object({
|
|
2467
2178
|
kind: z14.literal("item.textDelta"),
|
|
2468
2179
|
key: deltaItemKeySchema,
|
|
@@ -2471,18 +2182,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2471
2182
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2472
2183
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2473
2184
|
}),
|
|
2474
|
-
/**
|
|
2475
|
-
* Settle a text stream. `text` present: the provider's final text, preferred
|
|
2476
|
-
* over the accumulated stream (and enough on its own — a close for a key
|
|
2477
|
-
* nothing streamed under completes a fresh item). `text` absent: settle
|
|
2478
|
-
* with the accumulated stream text, completing nothing when the stream only
|
|
2479
|
-
* ever received whitespace. Either way the key is released, so later text
|
|
2480
|
-
* mints a fresh item. `channel` says which item to mint for a bare close
|
|
2481
|
-
* and where a provider-final `text` lands on a reasoning item. Providers
|
|
2482
|
-
* that name their message items may instead settle through `item.close`
|
|
2483
|
-
* with the full terminal shape (the uniform close rule) — that is the same
|
|
2484
|
-
* item lifecycle, not a second streaming dialect.
|
|
2485
|
-
*/
|
|
2486
2185
|
z14.object({
|
|
2487
2186
|
kind: z14.literal("item.textClose"),
|
|
2488
2187
|
key: deltaItemKeySchema,
|
|
@@ -2491,10 +2190,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2491
2190
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2492
2191
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2493
2192
|
}),
|
|
2494
|
-
/**
|
|
2495
|
-
* Item-keyed exact output append (codex command/fileChange output deltas).
|
|
2496
|
-
* Never synthesizes an open and never diffs — the text is already a delta.
|
|
2497
|
-
*/
|
|
2498
2193
|
z14.object({
|
|
2499
2194
|
kind: z14.literal("item.outputDelta"),
|
|
2500
2195
|
key: deltaItemKeySchema,
|
|
@@ -2503,26 +2198,12 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2503
2198
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2504
2199
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2505
2200
|
}),
|
|
2506
|
-
/**
|
|
2507
|
-
* Cumulative command output snapshot (pi bash). The assembler diffs
|
|
2508
|
-
* consecutive snapshots into `outputDelta`/`reset` events.
|
|
2509
|
-
*/
|
|
2510
2201
|
z14.object({
|
|
2511
2202
|
kind: z14.literal("command.outputSnapshot"),
|
|
2512
2203
|
key: deltaItemKeySchema,
|
|
2513
2204
|
text: z14.string(),
|
|
2514
2205
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2515
2206
|
}),
|
|
2516
|
-
/**
|
|
2517
|
-
* Provider-reported usage — the one usage dialect. `total` is the running
|
|
2518
|
-
* session total and `last` the most recent turn's usage; a provider that
|
|
2519
|
-
* reports exact cumulative totals (codex) forwards both verbatim, and a
|
|
2520
|
-
* provider that reports per-turn usage (claude, pi) sums `last` into
|
|
2521
|
-
* `total` itself (`addTokenUsage` in the bridge kit), resetting at every
|
|
2522
|
-
* session construction alongside `session.reset`. Emits
|
|
2523
|
-
* `thread/tokenUsage/updated` only: a provider whose usage also measures
|
|
2524
|
-
* the context window sends the `contextWindow` delta beside it.
|
|
2525
|
-
*/
|
|
2526
2207
|
z14.object({
|
|
2527
2208
|
kind: z14.literal("usage"),
|
|
2528
2209
|
total: threadEventTokenUsageBreakdownSchema,
|
|
@@ -2530,13 +2211,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2530
2211
|
modelContextWindow: z14.number().nullable(),
|
|
2531
2212
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2532
2213
|
}),
|
|
2533
|
-
/**
|
|
2534
|
-
* Context-window meter. `attach: "currentOrLast"` legalizes post-turn
|
|
2535
|
-
* attachment (pi reports after `agent_end` for the turn that just closed);
|
|
2536
|
-
* a `providerTurnId` scopes the reading to that vouched turn instead
|
|
2537
|
-
* (codex measures the window per native turn) and `attach` is then
|
|
2538
|
-
* irrelevant.
|
|
2539
|
-
*/
|
|
2540
2214
|
z14.object({
|
|
2541
2215
|
kind: z14.literal("contextWindow"),
|
|
2542
2216
|
used: z14.number().nullable(),
|
|
@@ -2551,54 +2225,26 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2551
2225
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2552
2226
|
}),
|
|
2553
2227
|
z14.object({ kind: z14.literal("context.cleared") }),
|
|
2554
|
-
/** The aggregate working-tree diff for a turn (codex turn/diff/updated). */
|
|
2555
2228
|
z14.object({
|
|
2556
2229
|
kind: z14.literal("turn.diff"),
|
|
2557
2230
|
diff: z14.string(),
|
|
2558
2231
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2559
2232
|
}),
|
|
2560
|
-
// Thread metadata (codex thread lifecycle notifications).
|
|
2561
2233
|
z14.object({ kind: z14.literal("thread.started") }),
|
|
2562
2234
|
z14.object({
|
|
2563
2235
|
kind: z14.literal("thread.identity"),
|
|
2564
2236
|
providerThreadId: z14.string().min(1)
|
|
2565
2237
|
}),
|
|
2566
2238
|
z14.object({ kind: z14.literal("thread.name"), name: z14.string().min(1) }),
|
|
2567
|
-
/**
|
|
2568
|
-
* Plugin-declared thread state (grammar v3): `"<pluginId>/<name>"` kinds
|
|
2569
|
-
* beside the core thread-state family (usage, context window, rate limits,
|
|
2570
|
-
* model fallback, context cleared). Latest snapshot wins per kind — the
|
|
2571
|
-
* assembler and the timeline keep one value per `kind`, so a bridge re-sends
|
|
2572
|
-
* the whole state, never a diff. Codex goals ride this way (the codex
|
|
2573
|
-
* plugin's `provider-codex/goal`, a null payload once cleared). The payload
|
|
2574
|
-
* is opaque here; the server validates it against the plugin's declared
|
|
2575
|
-
* `state` schema at ingest (the same site as extension items).
|
|
2576
|
-
* The namespaced kind travels as `extensionKind` only because `kind` is
|
|
2577
|
-
* this union's discriminator; the item shape and the persisted item call
|
|
2578
|
-
* the same value `kind`.
|
|
2579
|
-
*/
|
|
2580
2239
|
z14.object({
|
|
2581
2240
|
kind: z14.literal("extension.state"),
|
|
2582
2241
|
extensionKind: extensionKindSchema,
|
|
2583
2242
|
payload: jsonValueSchema
|
|
2584
2243
|
}),
|
|
2585
|
-
/**
|
|
2586
|
-
* Normalized rate-limit snapshot. The provider-dialect merge (codex's
|
|
2587
|
-
* sticky rateLimitReachedType over sparse rolling updates) stays
|
|
2588
|
-
* bridge-side — it is seeded from a per-child post-initialize read the
|
|
2589
|
-
* assembler never sees.
|
|
2590
|
-
*/
|
|
2591
2244
|
z14.object({
|
|
2592
2245
|
kind: z14.literal("provider.rateLimits"),
|
|
2593
2246
|
rateLimits: providerRateLimitStateSchema
|
|
2594
2247
|
}),
|
|
2595
|
-
/**
|
|
2596
|
-
* Provider-reported error. `settlesTurn: true` also closes the turn that
|
|
2597
|
-
* owns the error as failed (an open turn, or one claimed through pending
|
|
2598
|
-
* accepted input). A `providerTurnId` scopes the error to that vouched
|
|
2599
|
-
* turn; `threadScoped: true` pins thread scope (codex errors without a
|
|
2600
|
-
* native turn id never attach to whatever turn happens to be open).
|
|
2601
|
-
*/
|
|
2602
2248
|
z14.object({
|
|
2603
2249
|
kind: z14.literal("provider.error"),
|
|
2604
2250
|
message: z14.string(),
|
|
@@ -2610,13 +2256,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2610
2256
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2611
2257
|
threadScoped: z14.boolean().optional()
|
|
2612
2258
|
}),
|
|
2613
|
-
/**
|
|
2614
|
-
* The provider switched models mid-flight (claude model fallback). Scoped to
|
|
2615
|
-
* the open-or-just-closed turn when one exists, thread scope otherwise (the
|
|
2616
|
-
* claude translator's currentOrLast rule). Cross-message dedup of the early
|
|
2617
|
-
* assistant fallback block against the later system duplicate stays
|
|
2618
|
-
* bridge-side — it is keyed by the bridge's own segment tracking.
|
|
2619
|
-
*/
|
|
2620
2259
|
z14.object({
|
|
2621
2260
|
kind: z14.literal("provider.modelFallback"),
|
|
2622
2261
|
originalModel: z14.string().min(1),
|
|
@@ -2624,10 +2263,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2624
2263
|
reason: z14.enum(["refusal", "provider"]),
|
|
2625
2264
|
message: z14.string()
|
|
2626
2265
|
}),
|
|
2627
|
-
/**
|
|
2628
|
-
* `vouchedTurn: true` scopes the warning to the open turn when one exists
|
|
2629
|
-
* (ACP warnings are turn-scoped mid-turn); default is thread scope.
|
|
2630
|
-
*/
|
|
2631
2266
|
z14.object({
|
|
2632
2267
|
kind: z14.literal("provider.warning"),
|
|
2633
2268
|
summary: z14.string().optional(),
|
|
@@ -2635,15 +2270,6 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2635
2270
|
category: threadEventWarningCategorySchema.optional(),
|
|
2636
2271
|
vouchedTurn: z14.boolean().optional()
|
|
2637
2272
|
}),
|
|
2638
|
-
/**
|
|
2639
|
-
* The bridge's visibility classification decided this raw event is unknown.
|
|
2640
|
-
* `vouchedTurn: true` scopes it to the open turn if one exists — the
|
|
2641
|
-
* only-caller-vouched-turn-ids rule — and `providerTurnId` scopes it to
|
|
2642
|
-
* that vouched provider turn. `onlyIfNoTurn: true` inverts the guard: the
|
|
2643
|
-
* event surfaces only when NO turn is open (the old translators'
|
|
2644
|
-
* "known event, no active turn" visibility fallback for events that
|
|
2645
|
-
* otherwise translate to silence) and is dropped entirely mid-turn.
|
|
2646
|
-
*/
|
|
2647
2273
|
z14.object({
|
|
2648
2274
|
kind: z14.literal("unhandled"),
|
|
2649
2275
|
raw: providerRawEventSchema,
|
|
@@ -2653,18 +2279,7 @@ var threadDeltaSchema = z14.discriminatedUnion("kind", [
|
|
|
2653
2279
|
parentRef: deltaKeyPartSchema.optional(),
|
|
2654
2280
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2655
2281
|
}),
|
|
2656
|
-
/**
|
|
2657
|
-
* Lifecycle settlement: the session was interrupted. The assembler closes
|
|
2658
|
-
* the open turn and open items as interrupted.
|
|
2659
|
-
*/
|
|
2660
2282
|
z14.object({ kind: z14.literal("session.ended") }),
|
|
2661
|
-
/**
|
|
2662
|
-
* Provider-native id-space boundary: a new provider session was constructed
|
|
2663
|
-
* for this thread (start/resume/fork/rebuild), so its native turn/item ids
|
|
2664
|
-
* may repeat. Drops ALL assembly state for the thread — id maps, settled
|
|
2665
|
-
* sets, open items and streams; the bridge settles any open work first
|
|
2666
|
-
* (nothing is in flight at any construction site).
|
|
2667
|
-
*/
|
|
2668
2283
|
z14.object({ kind: z14.literal("session.reset") })
|
|
2669
2284
|
]);
|
|
2670
2285
|
var threadDeltaNotificationParamsSchema = z14.object({
|
|
@@ -4526,7 +4141,6 @@ var ConformanceClient = class {
|
|
|
4526
4141
|
collector;
|
|
4527
4142
|
nextId = 1;
|
|
4528
4143
|
log = [];
|
|
4529
|
-
/** Every assembled event, in wire order. */
|
|
4530
4144
|
events = [];
|
|
4531
4145
|
drainIntoLog() {
|
|
4532
4146
|
for (const raw of this.transport.takeMessages()) {
|
|
@@ -4570,7 +4184,6 @@ var ConformanceClient = class {
|
|
|
4570
4184
|
);
|
|
4571
4185
|
return id;
|
|
4572
4186
|
}
|
|
4573
|
-
/** Poll until `resolve` yields a value or the deadline passes (→ null). */
|
|
4574
4187
|
async waitFor(resolve3) {
|
|
4575
4188
|
const deadline = Date.now() + this.timeoutMs;
|
|
4576
4189
|
for (; ; ) {
|
|
@@ -4592,7 +4205,6 @@ var ConformanceClient = class {
|
|
|
4592
4205
|
)
|
|
4593
4206
|
);
|
|
4594
4207
|
}
|
|
4595
|
-
/** A settle window: drain for the given quiet period without expectations. */
|
|
4596
4208
|
async settle(quietMs) {
|
|
4597
4209
|
const deadline = Date.now() + quietMs;
|
|
4598
4210
|
while (Date.now() < deadline) {
|
|
@@ -4640,88 +4252,22 @@ function negotiateGrammarVersion(runtime, bridge) {
|
|
|
4640
4252
|
}
|
|
4641
4253
|
var bridgeSteerModeSchema = z18.enum(["inject", "queue"]);
|
|
4642
4254
|
var bridgeCapabilitiesSchema = z18.object({
|
|
4643
|
-
/**
|
|
4644
|
-
* A released session can be re-attached later from its persisted
|
|
4645
|
-
* providerThreadId. The per-session `sessionRestorable` flag on
|
|
4646
|
-
* thread-identity results refines this (an agent update can drop restore
|
|
4647
|
-
* support mid-flight); this handshake value is the default for sessions
|
|
4648
|
-
* that do not say.
|
|
4649
|
-
*/
|
|
4650
4255
|
sessionRestore: z18.boolean().default(false),
|
|
4651
|
-
/**
|
|
4652
|
-
* The bridge mirrors bb archive state into the provider's own session
|
|
4653
|
-
* list. When false the runtime never sends thread/archive or
|
|
4654
|
-
* thread/unarchive.
|
|
4655
|
-
*/
|
|
4656
4256
|
threadArchive: z18.boolean().default(false),
|
|
4657
|
-
/**
|
|
4658
|
-
* The bridge pushes bb thread titles to the provider. When false the
|
|
4659
|
-
* runtime never sends thread/name/set.
|
|
4660
|
-
*/
|
|
4661
4257
|
threadRename: z18.boolean().default(false),
|
|
4662
|
-
/** The bridge supports thread/goal/clear. */
|
|
4663
4258
|
threadGoalClear: z18.boolean().default(false),
|
|
4664
|
-
/**
|
|
4665
|
-
* Session cloning support ({@link providerForkSchema} — the same
|
|
4666
|
-
* vocabulary the provider declaration uses). The declaration is a ceiling
|
|
4667
|
-
* for UI affordances; this is the operative truth, and it may only narrow
|
|
4668
|
-
* the declaration, never widen it.
|
|
4669
|
-
*/
|
|
4670
4259
|
fork: providerForkSchema.default("none"),
|
|
4671
|
-
/**
|
|
4672
|
-
* Where the thread's approval policy is enforced. "runtime" bridges
|
|
4673
|
-
* forward every approval request and the runtime applies the thread
|
|
4674
|
-
* policy (including auto-deny). "provider" bridges enforce policy before
|
|
4675
|
-
* forwarding, so every forwarded request is already known to need user
|
|
4676
|
-
* input and the runtime must not reclassify it against mutable thread
|
|
4677
|
-
* settings.
|
|
4678
|
-
*/
|
|
4679
4260
|
approvalEnforcedBy: z18.enum(["runtime", "provider"]).default("runtime"),
|
|
4680
|
-
/**
|
|
4681
|
-
* The `thread/delta` grammar range this bridge speaks. A bridge that says
|
|
4682
|
-
* nothing is read as speaking exactly the protocol version it negotiated,
|
|
4683
|
-
* so the default is `[2, 2]` — never a wider range it never claimed.
|
|
4684
|
-
* Every bridge in this repo emits v3 and reports `[3, 3]`, and the
|
|
4685
|
-
* runtime's assembler speaks `[3, 3]` only (`ASSEMBLER_GRAMMAR_VERSIONS`),
|
|
4686
|
-
* so a bridge that takes the default is refused at startup: the two
|
|
4687
|
-
* ranges must intersect ({@link negotiateGrammarVersion}) and both sides
|
|
4688
|
-
* emit the highest common version.
|
|
4689
|
-
*/
|
|
4690
4261
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4691
4262
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4692
4263
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4693
4264
|
]),
|
|
4694
|
-
/**
|
|
4695
|
-
* Mid-turn steer delivery ({@link bridgeSteerModeSchema}). Defaults to
|
|
4696
|
-
* `queue`, the conservative reading: absence is the definite "no" the
|
|
4697
|
-
* rest of this handshake uses, and `inject` is the stronger promise (the
|
|
4698
|
-
* steer reaches the model before the turn ends) a bridge must make
|
|
4699
|
-
* explicitly. Nothing in the runtime, server, or clients reads it today:
|
|
4700
|
-
* `turn/steer` is sent either way, and a steer whose turn is gone is
|
|
4701
|
-
* dropped on the bridge's `staleTurn` recovery hint or `NO_ACTIVE_TURN`
|
|
4702
|
-
* error (`steerTurn` in @bb/agent-runtime), whatever the mode. claude,
|
|
4703
|
-
* codex, and pi declare `inject`; ACP and the echo example declare
|
|
4704
|
-
* `queue`.
|
|
4705
|
-
*/
|
|
4706
4265
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4707
|
-
/**
|
|
4708
|
-
* Which optional requests the bridge handles. `skills.configure`: the
|
|
4709
|
-
* bridge accepts `skills/configure` (bb's injected skill roots). When
|
|
4710
|
-
* false the runtime never sends it, so a bridge that answers unknown
|
|
4711
|
-
* methods with METHOD_NOT_FOUND — as the protocol instructs — still
|
|
4712
|
-
* starts threads; it simply runs without injected skills. A bridge that
|
|
4713
|
-
* handles the request declares it; the runtime never probes.
|
|
4714
|
-
*/
|
|
4715
4266
|
skills: z18.object({ configure: z18.boolean().default(false) }).default({ configure: false })
|
|
4716
4267
|
}).passthrough();
|
|
4717
4268
|
var initializeParamsSchema = z18.object({
|
|
4718
4269
|
protocolVersion: z18.number().int().positive(),
|
|
4719
4270
|
client: z18.object({ name: z18.string().min(1), version: z18.string().min(1) }),
|
|
4720
|
-
/**
|
|
4721
|
-
* The `thread/delta` grammar range the runtime's assembler accepts (see
|
|
4722
|
-
* {@link negotiateGrammarVersion}). A runtime that predates the field
|
|
4723
|
-
* reads as speaking exactly its protocol version.
|
|
4724
|
-
*/
|
|
4725
4271
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4726
4272
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4727
4273
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
@@ -4729,8 +4275,6 @@ var initializeParamsSchema = z18.object({
|
|
|
4729
4275
|
}).passthrough();
|
|
4730
4276
|
var initializeResultSchema = z18.object({
|
|
4731
4277
|
protocolVersion: z18.number().int().positive(),
|
|
4732
|
-
// An absent capabilities block reads as "no capabilities" via the inner
|
|
4733
|
-
// per-field defaults, so older bridges parse to explicit values.
|
|
4734
4278
|
capabilities: z18.preprocess(
|
|
4735
4279
|
(value) => value ?? {},
|
|
4736
4280
|
bridgeCapabilitiesSchema
|
|
@@ -4743,16 +4287,9 @@ var bridgeExecutionOptionsSchema = z19.object({
|
|
|
4743
4287
|
model: z19.string().min(1).optional(),
|
|
4744
4288
|
serviceTier: serviceTierSchema.optional(),
|
|
4745
4289
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4746
|
-
/**
|
|
4747
|
-
* BB prompt mode (`"plan"`), present only when the prompt entered one
|
|
4748
|
-
* through the provider's declared composer action. Each bridge maps it
|
|
4749
|
-
* onto the agent's native equivalent.
|
|
4750
|
-
*/
|
|
4751
4290
|
promptMode: promptModeSchema.optional(),
|
|
4752
|
-
/** Frozen for the life of a provider session; applied at construction. */
|
|
4753
4291
|
instructions: z19.string().optional(),
|
|
4754
4292
|
envVars: z19.record(z19.string(), z19.string()).optional(),
|
|
4755
|
-
/** Provider-scoped session options. Opaque outside the owning bridge. */
|
|
4756
4293
|
providerOptions: z19.record(z19.string(), z19.unknown()).optional()
|
|
4757
4294
|
}).and(runtimePermissionPolicySchema);
|
|
4758
4295
|
|
|
@@ -4763,9 +4300,7 @@ var providerMaintenanceParamsSchema = z20.object({
|
|
|
4763
4300
|
cwd: z20.string().min(1).optional(),
|
|
4764
4301
|
providerOptions: z20.record(z20.string(), z20.unknown()).optional()
|
|
4765
4302
|
}).passthrough();
|
|
4766
|
-
var providerInstallationRequirementSchema = z20.enum([
|
|
4767
|
-
"thread_rewind"
|
|
4768
|
-
]);
|
|
4303
|
+
var providerInstallationRequirementSchema = z20.enum(["thread_rewind"]);
|
|
4769
4304
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4770
4305
|
requirement: providerInstallationRequirementSchema.optional()
|
|
4771
4306
|
});
|
|
@@ -4813,26 +4348,20 @@ var providerUsageSchema = z20.discriminatedUnion("status", [
|
|
|
4813
4348
|
accountEmail: z20.string().nullable().default(null)
|
|
4814
4349
|
}).passthrough()
|
|
4815
4350
|
]);
|
|
4816
|
-
var providerHealthResultSchema = z20.discriminatedUnion(
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
z20.object({
|
|
4831
|
-
supported: z20.literal(true),
|
|
4832
|
-
usage: providerUsageSchema
|
|
4833
|
-
}).passthrough()
|
|
4834
|
-
]
|
|
4835
|
-
);
|
|
4351
|
+
var providerHealthResultSchema = z20.discriminatedUnion("supported", [
|
|
4352
|
+
z20.object({ supported: z20.literal(false) }).passthrough(),
|
|
4353
|
+
z20.object({
|
|
4354
|
+
supported: z20.literal(true),
|
|
4355
|
+
health: providerHealthSchema
|
|
4356
|
+
}).passthrough()
|
|
4357
|
+
]);
|
|
4358
|
+
var providerUsageResultSchema = z20.discriminatedUnion("supported", [
|
|
4359
|
+
z20.object({ supported: z20.literal(false) }).passthrough(),
|
|
4360
|
+
z20.object({
|
|
4361
|
+
supported: z20.literal(true),
|
|
4362
|
+
usage: providerUsageSchema
|
|
4363
|
+
}).passthrough()
|
|
4364
|
+
]);
|
|
4836
4365
|
var providerInstallationActionKindSchema = z20.enum([
|
|
4837
4366
|
"install",
|
|
4838
4367
|
"update"
|
|
@@ -4869,28 +4398,34 @@ var providerInstallationCommandSchema = z20.object({
|
|
|
4869
4398
|
args: z20.array(z20.string()).max(64),
|
|
4870
4399
|
displayCommand: z20.string().min(1)
|
|
4871
4400
|
}).passthrough();
|
|
4872
|
-
var providerInstallationVerificationSchema = z20.discriminatedUnion(
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
kind: z20.literal("
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4401
|
+
var providerInstallationVerificationSchema = z20.discriminatedUnion(
|
|
4402
|
+
"kind",
|
|
4403
|
+
[
|
|
4404
|
+
z20.object({ kind: z20.literal("installed") }).passthrough(),
|
|
4405
|
+
z20.object({
|
|
4406
|
+
kind: z20.literal("version_changed"),
|
|
4407
|
+
previousVersion: z20.string().min(1)
|
|
4408
|
+
}).passthrough(),
|
|
4409
|
+
z20.object({
|
|
4410
|
+
kind: z20.literal("version_at_least"),
|
|
4411
|
+
version: z20.string().min(1)
|
|
4412
|
+
}).passthrough()
|
|
4413
|
+
]
|
|
4414
|
+
);
|
|
4415
|
+
var providerInstallationRunResultSchema = z20.discriminatedUnion(
|
|
4416
|
+
"available",
|
|
4417
|
+
[
|
|
4418
|
+
z20.object({
|
|
4419
|
+
available: z20.literal(false),
|
|
4420
|
+
message: z20.string().min(1)
|
|
4421
|
+
}).passthrough(),
|
|
4422
|
+
z20.object({
|
|
4423
|
+
available: z20.literal(true),
|
|
4424
|
+
command: providerInstallationCommandSchema,
|
|
4425
|
+
verification: providerInstallationVerificationSchema
|
|
4426
|
+
}).passthrough()
|
|
4427
|
+
]
|
|
4428
|
+
);
|
|
4894
4429
|
|
|
4895
4430
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4896
4431
|
import { z as z21 } from "zod";
|
|
@@ -4934,24 +4469,12 @@ var threadResumeParamsSchema = z21.object({
|
|
|
4934
4469
|
var threadForkParamsSchema = z21.object({
|
|
4935
4470
|
...sessionConstructionFields,
|
|
4936
4471
|
sourceProviderThreadId: z21.string().min(1),
|
|
4937
|
-
/**
|
|
4938
|
-
* Absent means fork at the tip. Bridges whose handshake advertises
|
|
4939
|
-
* `fork: "tip"` reject a request carrying a checkpoint instead of
|
|
4940
|
-
* silently cloning more history than the bb timeline shows.
|
|
4941
|
-
*/
|
|
4942
4472
|
sourceProviderCheckpointId: z21.string().min(1).optional()
|
|
4943
4473
|
}).passthrough();
|
|
4944
4474
|
var threadStopParamsSchema = z21.object({
|
|
4945
4475
|
threadId: z21.string().min(1),
|
|
4946
4476
|
providerThreadId: z21.string().min(1),
|
|
4947
|
-
/**
|
|
4948
|
-
* "interrupt" stops an active turn and settles it as interrupted.
|
|
4949
|
-
* "release" detaches an idle session so its resources can be reclaimed;
|
|
4950
|
-
* it must never fabricate an interruption. One verb serving both intents
|
|
4951
|
-
* is the #1584 incident — the field is required.
|
|
4952
|
-
*/
|
|
4953
4477
|
intent: z21.enum(["interrupt", "release"]),
|
|
4954
|
-
/** Non-null when the stop interrupts an active provider turn. */
|
|
4955
4478
|
activeTurnId: z21.string().min(1).nullable()
|
|
4956
4479
|
}).passthrough();
|
|
4957
4480
|
var threadRefParams = z21.object({
|
|
@@ -4990,7 +4513,6 @@ var skillsConfigureParamsSchema = z21.object({
|
|
|
4990
4513
|
}).passthrough();
|
|
4991
4514
|
var threadIdentityResultSchema = z21.object({
|
|
4992
4515
|
providerThreadId: z21.string().min(1),
|
|
4993
|
-
/** Refines the handshake's `sessionRestore` for this session. */
|
|
4994
4516
|
sessionRestorable: z21.boolean().optional()
|
|
4995
4517
|
}).passthrough();
|
|
4996
4518
|
var modelListResultSchema = z21.object({
|
|
@@ -5004,17 +4526,11 @@ import { z as z23 } from "zod";
|
|
|
5004
4526
|
// ../provider-bridge-protocol/src/errors.ts
|
|
5005
4527
|
import { z as z22 } from "zod";
|
|
5006
4528
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
5007
|
-
/** Standard JSON-RPC: params failed schema validation. */
|
|
5008
4529
|
INVALID_PARAMS: -32602,
|
|
5009
|
-
/** Standard JSON-RPC: method not implemented by this bridge. */
|
|
5010
4530
|
METHOD_NOT_FOUND: -32601,
|
|
5011
|
-
/** Generic bridge failure. */
|
|
5012
4531
|
BRIDGE_ERROR: -32e3,
|
|
5013
|
-
/** A turn/steer arrived but the session has no active turn. */
|
|
5014
4532
|
NO_ACTIVE_TURN: -32001,
|
|
5015
|
-
/** thread/resume for a session the provider can no longer restore. */
|
|
5016
4533
|
SESSION_NOT_RESTORABLE: -32002,
|
|
5017
|
-
/** thread/fork with a checkpoint on a bridge that only forks at the tip. */
|
|
5018
4534
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
5019
4535
|
};
|
|
5020
4536
|
var providerRecoveryHintSchema = z22.object({
|
|
@@ -5028,16 +4544,12 @@ var bridgeErrorDataSchema = z22.object({ recovery: providerRecoveryHintSchema.op
|
|
|
5028
4544
|
var threadIdentityNotificationSchema = z23.object({
|
|
5029
4545
|
threadId: z23.string().min(1),
|
|
5030
4546
|
providerThreadId: z23.string().min(1),
|
|
5031
|
-
/** Refines the handshake's `sessionRestore` for this session. */
|
|
5032
4547
|
sessionRestorable: z23.boolean().optional()
|
|
5033
4548
|
}).passthrough();
|
|
5034
4549
|
var sessionReplacedNotificationSchema = z23.object({
|
|
5035
4550
|
threadId: z23.string().min(1),
|
|
5036
|
-
/** Identity of the replacement session (may equal the old identity). */
|
|
5037
4551
|
providerThreadId: z23.string().min(1).nullable(),
|
|
5038
|
-
/** Human-readable cause, shown in the timeline. */
|
|
5039
4552
|
reason: z23.string().min(1),
|
|
5040
|
-
/** True when provider-side context did not survive the replacement. */
|
|
5041
4553
|
contextLost: z23.boolean().default(false)
|
|
5042
4554
|
}).passthrough();
|
|
5043
4555
|
var providerRawNotificationSchema = z23.object({
|
|
@@ -5081,14 +4593,6 @@ var interactionRequestParamsSchema = z24.object({
|
|
|
5081
4593
|
threadId: z24.string().min(1).optional(),
|
|
5082
4594
|
turnId: z24.union([z24.string().min(1), z24.null()]),
|
|
5083
4595
|
payload: pendingInteractionPayloadSchema,
|
|
5084
|
-
/**
|
|
5085
|
-
* The request's turn id and approval-subject item ids are in the
|
|
5086
|
-
* provider's native id space (a `thread/delta` bridge holds no bb ids):
|
|
5087
|
-
* the runtime adapter translates them through the delta assembler's maps
|
|
5088
|
-
* before the interaction reaches the app. Omission means the ids are
|
|
5089
|
-
* already app-visible (bridges whose approval subjects never referenced
|
|
5090
|
-
* timeline ids — ACP's approval ids never matched timeline ids).
|
|
5091
|
-
*/
|
|
5092
4596
|
providerNativeIds: z24.boolean().optional()
|
|
5093
4597
|
}).passthrough();
|
|
5094
4598
|
|
|
@@ -5332,7 +4836,10 @@ function checkPresentationIconsDeclared(events, icons) {
|
|
|
5332
4836
|
"no item carried a presentation to inspect"
|
|
5333
4837
|
);
|
|
5334
4838
|
}
|
|
5335
|
-
return pass(
|
|
4839
|
+
return pass(
|
|
4840
|
+
PRESENTATION_ICONS_DECLARED_ID,
|
|
4841
|
+
PRESENTATION_ICONS_DECLARED_TITLE
|
|
4842
|
+
);
|
|
5336
4843
|
}
|
|
5337
4844
|
async function runRpcHygieneScenarios(client) {
|
|
5338
4845
|
const results = [];
|
|
@@ -5452,7 +4959,9 @@ async function runHandshakeScenario(client) {
|
|
|
5452
4959
|
const parsed = initializeResultSchema.safeParse(response.result);
|
|
5453
4960
|
if (!parsed.success) {
|
|
5454
4961
|
return failed(
|
|
5455
|
-
`result did not parse: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(
|
|
4962
|
+
`result did not parse: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(
|
|
4963
|
+
"; "
|
|
4964
|
+
)} (got ${JSON.stringify(response.result ?? response.error)})`
|
|
5456
4965
|
);
|
|
5457
4966
|
}
|
|
5458
4967
|
if (parsed.data.protocolVersion !== PROVIDER_BRIDGE_PROTOCOL_VERSION) {
|
|
@@ -5824,7 +5333,11 @@ async function runForkIdentityScenario(context, threadId) {
|
|
|
5824
5333
|
const response = await client.waitForResponse(forkId);
|
|
5825
5334
|
if (response === null) {
|
|
5826
5335
|
return [
|
|
5827
|
-
fail(
|
|
5336
|
+
fail(
|
|
5337
|
+
FORK_IDENTITY_ID,
|
|
5338
|
+
FORK_IDENTITY_TITLE,
|
|
5339
|
+
"thread/fork was not answered"
|
|
5340
|
+
)
|
|
5828
5341
|
];
|
|
5829
5342
|
}
|
|
5830
5343
|
if (response.error !== void 0) {
|
|
@@ -6018,7 +5531,11 @@ async function runInterruptStopScenario(context, threadId) {
|
|
|
6018
5531
|
const stopResponse = await client.waitForResponse(stopId);
|
|
6019
5532
|
if (stopResponse === null) {
|
|
6020
5533
|
return [
|
|
6021
|
-
fail(
|
|
5534
|
+
fail(
|
|
5535
|
+
INTERRUPT_SETTLES_ID,
|
|
5536
|
+
INTERRUPT_SETTLES_TITLE,
|
|
5537
|
+
"thread/stop was not answered"
|
|
5538
|
+
)
|
|
6022
5539
|
];
|
|
6023
5540
|
}
|
|
6024
5541
|
if (stopResponse.error !== void 0) {
|
|
@@ -6334,11 +5851,7 @@ async function runBridgeConformance(options) {
|
|
|
6334
5851
|
...await runSessionLifecycleScenarios({
|
|
6335
5852
|
client,
|
|
6336
5853
|
fixture: options.session,
|
|
6337
|
-
// The same reverse mapping the runtime applies when it names a turn
|
|
6338
|
-
// to the bridge: the assembler's provider↔bb turn-id map.
|
|
6339
5854
|
resolveProviderTurnId: (threadId, bbTurnId) => collector.assembler.getProviderTurnId(threadId, bbTurnId),
|
|
6340
|
-
// A failed handshake reads as the definite absences the schema
|
|
6341
|
-
// defaults to: no fork, so the fork rule is not attempted.
|
|
6342
5855
|
fork: handshake.capabilities?.fork ?? "none"
|
|
6343
5856
|
})
|
|
6344
5857
|
);
|
|
@@ -6556,7 +6069,13 @@ function describeCalibrationEvents(events) {
|
|
|
6556
6069
|
|
|
6557
6070
|
// ../provider-bridge-protocol/src/testing/parity.ts
|
|
6558
6071
|
import { spawn } from "node:child_process";
|
|
6559
|
-
import {
|
|
6072
|
+
import {
|
|
6073
|
+
existsSync as existsSync2,
|
|
6074
|
+
mkdtempSync,
|
|
6075
|
+
realpathSync,
|
|
6076
|
+
rmSync,
|
|
6077
|
+
writeFileSync
|
|
6078
|
+
} from "node:fs";
|
|
6560
6079
|
import { tmpdir } from "node:os";
|
|
6561
6080
|
import { isAbsolute, join as join2, resolve as resolve2 } from "node:path";
|
|
6562
6081
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -6632,7 +6151,10 @@ function bridgeRecordingFileName(direction) {
|
|
|
6632
6151
|
var COMMITTED_RECORDINGS_ROOT = fileURLToPath(
|
|
6633
6152
|
new URL("../../recordings", import.meta.url)
|
|
6634
6153
|
);
|
|
6635
|
-
var RECORDINGS_CHECKOUT_ROOT = resolve(
|
|
6154
|
+
var RECORDINGS_CHECKOUT_ROOT = resolve(
|
|
6155
|
+
COMMITTED_RECORDINGS_ROOT,
|
|
6156
|
+
"../../.."
|
|
6157
|
+
);
|
|
6636
6158
|
function compareRecordingEntries(left, right) {
|
|
6637
6159
|
return left.run - right.run || left.seq - right.seq;
|
|
6638
6160
|
}
|
|
@@ -6662,7 +6184,9 @@ function readBridgeRecordingLane(dir, direction) {
|
|
|
6662
6184
|
if (raw.length === 0) continue;
|
|
6663
6185
|
const entry = parseEntry(raw, file, index + 1);
|
|
6664
6186
|
if (entry.dir !== direction) {
|
|
6665
|
-
throw new Error(
|
|
6187
|
+
throw new Error(
|
|
6188
|
+
`${file}:${index + 1}: entry direction ${entry.dir} in the ${direction} lane`
|
|
6189
|
+
);
|
|
6666
6190
|
}
|
|
6667
6191
|
entries.push(entry);
|
|
6668
6192
|
}
|
|
@@ -6680,7 +6204,9 @@ function readCurrentBridgeLane(dir) {
|
|
|
6680
6204
|
if (raw.length === 0) continue;
|
|
6681
6205
|
const entry = parseEntry(raw, file, index + 1);
|
|
6682
6206
|
if (entry.dir !== "bridge\u2192runtime") {
|
|
6683
|
-
throw new Error(
|
|
6207
|
+
throw new Error(
|
|
6208
|
+
`${file}:${index + 1}: entry direction ${entry.dir} in the current bridge lane`
|
|
6209
|
+
);
|
|
6684
6210
|
}
|
|
6685
6211
|
entries.push(entry);
|
|
6686
6212
|
}
|
|
@@ -6700,7 +6226,9 @@ function withCurrentBridgeLane(recording) {
|
|
|
6700
6226
|
}
|
|
6701
6227
|
function readBridgeRecording(dir) {
|
|
6702
6228
|
const manifestPath = join(dir, "manifest.json");
|
|
6703
|
-
const manifest = existsSync(manifestPath) ? JSON.parse(
|
|
6229
|
+
const manifest = existsSync(manifestPath) ? JSON.parse(
|
|
6230
|
+
readFileSync(manifestPath, "utf8")
|
|
6231
|
+
) : null;
|
|
6704
6232
|
const entries = [];
|
|
6705
6233
|
for (const direction of BRIDGE_RECORDING_DIRECTIONS) {
|
|
6706
6234
|
entries.push(...readBridgeRecordingLane(dir, direction));
|
|
@@ -6731,8 +6259,12 @@ function listRecordedCells(root) {
|
|
|
6731
6259
|
}
|
|
6732
6260
|
|
|
6733
6261
|
// ../provider-bridge-protocol/src/testing/parity.ts
|
|
6734
|
-
var SOURCE_BOOTSTRAP = fileURLToPath2(
|
|
6735
|
-
|
|
6262
|
+
var SOURCE_BOOTSTRAP = fileURLToPath2(
|
|
6263
|
+
new URL("../bridge-worker-entry.ts", import.meta.url)
|
|
6264
|
+
);
|
|
6265
|
+
var BUNDLED_BOOTSTRAP = fileURLToPath2(
|
|
6266
|
+
new URL("./provider-bridge-worker-entry.mjs", import.meta.url)
|
|
6267
|
+
);
|
|
6736
6268
|
function resolveProviderBridgeBootstrapPath() {
|
|
6737
6269
|
if (existsSync2(SOURCE_BOOTSTRAP)) return SOURCE_BOOTSTRAP;
|
|
6738
6270
|
if (existsSync2(BUNDLED_BOOTSTRAP)) return BUNDLED_BOOTSTRAP;
|
|
@@ -6754,7 +6286,9 @@ function defaultNodeArgs(bootstrapPath, modulePath) {
|
|
|
6754
6286
|
}
|
|
6755
6287
|
function resolveProviderBridgeLaunch(options) {
|
|
6756
6288
|
if (!isAbsolute(options.modulePath)) {
|
|
6757
|
-
throw new Error(
|
|
6289
|
+
throw new Error(
|
|
6290
|
+
`bridge module path must be absolute: ${options.modulePath}`
|
|
6291
|
+
);
|
|
6758
6292
|
}
|
|
6759
6293
|
const bootstrapPath = options.bootstrapPath ?? resolveProviderBridgeBootstrapPath();
|
|
6760
6294
|
const dataDir = options.dataDir ?? mkdtempSync(join2(tmpdir(), "bb-parity-data-"));
|
|
@@ -6869,7 +6403,9 @@ function methodOfRecordedBridgeRequest(recording, response, id) {
|
|
|
6869
6403
|
}
|
|
6870
6404
|
return void 0;
|
|
6871
6405
|
}
|
|
6872
|
-
var REPLAY_CHILD_PATH = fileURLToPath2(
|
|
6406
|
+
var REPLAY_CHILD_PATH = fileURLToPath2(
|
|
6407
|
+
new URL("./replay-provider-child.mjs", import.meta.url)
|
|
6408
|
+
);
|
|
6873
6409
|
var PARITY_INITIALIZE_ID = "parity-initialize";
|
|
6874
6410
|
function sleep(ms) {
|
|
6875
6411
|
return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
|
|
@@ -6883,7 +6419,9 @@ async function replayRecording(options) {
|
|
|
6883
6419
|
const profile = options.profile ?? DEFAULT_REPLAY_PROFILE;
|
|
6884
6420
|
const recording = readBridgeRecording(options.recordingDir);
|
|
6885
6421
|
const stateDir = mkdtempSync(join2(tmpdir(), "bb-parity-replay-"));
|
|
6886
|
-
const workspaceDir = realpathSync(
|
|
6422
|
+
const workspaceDir = realpathSync(
|
|
6423
|
+
mkdtempSync(join2(tmpdir(), "bb-parity-ws-"))
|
|
6424
|
+
);
|
|
6887
6425
|
const replayCommand = [
|
|
6888
6426
|
process.execPath,
|
|
6889
6427
|
REPLAY_CHILD_PATH,
|
|
@@ -6951,7 +6489,11 @@ async function replayRecording(options) {
|
|
|
6951
6489
|
const recordedAnswers = /* @__PURE__ */ new Map();
|
|
6952
6490
|
for (const step of steps) {
|
|
6953
6491
|
if (step.message !== null && isResponse(step.message)) {
|
|
6954
|
-
const method = methodOfRecordedBridgeRequest(
|
|
6492
|
+
const method = methodOfRecordedBridgeRequest(
|
|
6493
|
+
recording,
|
|
6494
|
+
step.entry,
|
|
6495
|
+
step.message.id
|
|
6496
|
+
) ?? "?";
|
|
6955
6497
|
const queue = recordedAnswers.get(method) ?? [];
|
|
6956
6498
|
queue.push(step.message);
|
|
6957
6499
|
recordedAnswers.set(method, queue);
|
|
@@ -6976,7 +6518,9 @@ async function replayRecording(options) {
|
|
|
6976
6518
|
const queue = recordedAnswers.get(method);
|
|
6977
6519
|
const recorded = queue?.shift();
|
|
6978
6520
|
if (recorded === void 0) {
|
|
6979
|
-
stalls.push(
|
|
6521
|
+
stalls.push(
|
|
6522
|
+
`no recorded answer for bridge request ${method} (${String(message.id)})`
|
|
6523
|
+
);
|
|
6980
6524
|
write(
|
|
6981
6525
|
JSON.stringify({
|
|
6982
6526
|
jsonrpc: "2.0",
|
|
@@ -7003,7 +6547,10 @@ async function replayRecording(options) {
|
|
|
7003
6547
|
return;
|
|
7004
6548
|
}
|
|
7005
6549
|
if (isRequest(message)) {
|
|
7006
|
-
pendingBridgeRequests.push({
|
|
6550
|
+
pendingBridgeRequests.push({
|
|
6551
|
+
id: message.id,
|
|
6552
|
+
method: message.method
|
|
6553
|
+
});
|
|
7007
6554
|
answerBridgeRequest(message);
|
|
7008
6555
|
return;
|
|
7009
6556
|
}
|
|
@@ -7012,13 +6559,19 @@ async function replayRecording(options) {
|
|
|
7012
6559
|
try {
|
|
7013
6560
|
assembled = liveAssembler.assembleMessage(message);
|
|
7014
6561
|
} catch (error) {
|
|
7015
|
-
stalls.push(
|
|
6562
|
+
stalls.push(
|
|
6563
|
+
`invalid thread/delta: ${error instanceof Error ? error.message : String(error)}`
|
|
6564
|
+
);
|
|
7016
6565
|
return;
|
|
7017
6566
|
}
|
|
7018
6567
|
for (const event of assembled) {
|
|
7019
6568
|
const result2 = grammar.observe(event);
|
|
7020
6569
|
if (result2.kind === "violation") {
|
|
7021
|
-
grammarViolations.push({
|
|
6570
|
+
grammarViolations.push({
|
|
6571
|
+
rule: result2.rule,
|
|
6572
|
+
reason: result2.reason,
|
|
6573
|
+
eventType: event.type
|
|
6574
|
+
});
|
|
7022
6575
|
continue;
|
|
7023
6576
|
}
|
|
7024
6577
|
events.push(event);
|
|
@@ -7043,8 +6596,12 @@ async function replayRecording(options) {
|
|
|
7043
6596
|
await sleep(10);
|
|
7044
6597
|
}
|
|
7045
6598
|
}
|
|
7046
|
-
const firstStep = steps.find(
|
|
7047
|
-
|
|
6599
|
+
const firstStep = steps.find(
|
|
6600
|
+
(step) => step.message !== null && isRequest(step.message)
|
|
6601
|
+
);
|
|
6602
|
+
setCursor(
|
|
6603
|
+
firstStep === void 0 ? "end" : { run: firstStep.entry.run, seq: firstStep.entry.seq }
|
|
6604
|
+
);
|
|
7048
6605
|
write(
|
|
7049
6606
|
JSON.stringify({
|
|
7050
6607
|
jsonrpc: "2.0",
|
|
@@ -7061,7 +6618,11 @@ async function replayRecording(options) {
|
|
|
7061
6618
|
for (const step of steps) {
|
|
7062
6619
|
if (step.message === null || !isRequest(step.message)) {
|
|
7063
6620
|
if (step.message !== null && !isResponse(step.message)) {
|
|
7064
|
-
lastSentRuntimeEntry = {
|
|
6621
|
+
lastSentRuntimeEntry = {
|
|
6622
|
+
run: step.entry.run,
|
|
6623
|
+
seq: step.entry.seq,
|
|
6624
|
+
ts: step.entry.ts
|
|
6625
|
+
};
|
|
7065
6626
|
write(step.entry.line);
|
|
7066
6627
|
}
|
|
7067
6628
|
continue;
|
|
@@ -7096,23 +6657,40 @@ async function replayRecording(options) {
|
|
|
7096
6657
|
const threadId = request.params.threadId;
|
|
7097
6658
|
if (typeof threadId === "string") grammar.clearThread(threadId);
|
|
7098
6659
|
}
|
|
7099
|
-
const rewritten = rewriteRecordedMachineFacts(
|
|
6660
|
+
const rewritten = rewriteRecordedMachineFacts(
|
|
6661
|
+
step.entry.line,
|
|
6662
|
+
workspaceDir
|
|
6663
|
+
);
|
|
7100
6664
|
const line = profile.rewriteRuntimeLine === void 0 ? rewritten : profile.rewriteRuntimeLine(rewritten, { replayCommand });
|
|
7101
|
-
lastSentRuntimeEntry = {
|
|
6665
|
+
lastSentRuntimeEntry = {
|
|
6666
|
+
run: step.entry.run,
|
|
6667
|
+
seq: step.entry.seq,
|
|
6668
|
+
ts: step.entry.ts
|
|
6669
|
+
};
|
|
7102
6670
|
write(line);
|
|
7103
6671
|
sentRequestIds.push(String(request.id));
|
|
7104
|
-
const nextStep = steps.slice(steps.indexOf(step) + 1).find(
|
|
7105
|
-
|
|
6672
|
+
const nextStep = steps.slice(steps.indexOf(step) + 1).find(
|
|
6673
|
+
(candidate) => candidate.message !== null && isRequest(candidate.message)
|
|
6674
|
+
);
|
|
6675
|
+
setCursor(
|
|
6676
|
+
nextStep === void 0 ? "end" : { run: nextStep.entry.run, seq: nextStep.entry.seq }
|
|
6677
|
+
);
|
|
7106
6678
|
}
|
|
7107
6679
|
setCursor("end");
|
|
7108
|
-
await waitFor(
|
|
6680
|
+
await waitFor(
|
|
6681
|
+
"the last responses",
|
|
6682
|
+
() => sentRequestIds.every((id) => answeredIds.has(id))
|
|
6683
|
+
);
|
|
7109
6684
|
if (plannedEventCount !== null) {
|
|
7110
6685
|
await waitFor(
|
|
7111
6686
|
`all ${plannedEventCount} planned events before closing the bridge`,
|
|
7112
6687
|
() => events.length >= plannedEventCount
|
|
7113
6688
|
);
|
|
7114
6689
|
}
|
|
7115
|
-
await waitFor(
|
|
6690
|
+
await waitFor(
|
|
6691
|
+
"the stream to settle",
|
|
6692
|
+
() => Date.now() - lastOutputAt >= settleMs
|
|
6693
|
+
);
|
|
7116
6694
|
child.stdin?.end();
|
|
7117
6695
|
const exitCode = await Promise.race([
|
|
7118
6696
|
exited,
|
|
@@ -7154,18 +6732,25 @@ function assembleRecordedEvents(recording, createAssembler, providerId) {
|
|
|
7154
6732
|
}
|
|
7155
6733
|
if (entry.dir !== "bridge\u2192runtime") continue;
|
|
7156
6734
|
const message = parseWire(entry.line);
|
|
7157
|
-
if (message === null || message.method !== THREAD_DELTA_NOTIFICATION_METHOD)
|
|
6735
|
+
if (message === null || message.method !== THREAD_DELTA_NOTIFICATION_METHOD)
|
|
6736
|
+
continue;
|
|
7158
6737
|
let assembled;
|
|
7159
6738
|
try {
|
|
7160
6739
|
assembled = assembler.assembleMessage(message);
|
|
7161
6740
|
} catch (error) {
|
|
7162
|
-
invalidDeltas.push(
|
|
6741
|
+
invalidDeltas.push(
|
|
6742
|
+
error instanceof Error ? error.message : String(error)
|
|
6743
|
+
);
|
|
7163
6744
|
continue;
|
|
7164
6745
|
}
|
|
7165
6746
|
for (const event of assembled) {
|
|
7166
6747
|
const result2 = grammar.observe(event);
|
|
7167
6748
|
if (result2.kind === "violation") {
|
|
7168
|
-
grammarViolations.push({
|
|
6749
|
+
grammarViolations.push({
|
|
6750
|
+
rule: result2.rule,
|
|
6751
|
+
reason: result2.reason,
|
|
6752
|
+
eventType: event.type
|
|
6753
|
+
});
|
|
7169
6754
|
continue;
|
|
7170
6755
|
}
|
|
7171
6756
|
events.push(event);
|
|
@@ -7272,7 +6857,10 @@ function entryApplies(entry, provider, cell) {
|
|
|
7272
6857
|
}
|
|
7273
6858
|
function compareParity(oldRun, newRun, allowlist, scope) {
|
|
7274
6859
|
const layers = {
|
|
7275
|
-
events: [
|
|
6860
|
+
events: [
|
|
6861
|
+
normalizeParityEvents(oldRun.events),
|
|
6862
|
+
normalizeParityEvents(newRun.events)
|
|
6863
|
+
],
|
|
7276
6864
|
rows: [normalizeParityRows(oldRun.rows), normalizeParityRows(newRun.rows)]
|
|
7277
6865
|
};
|
|
7278
6866
|
const staleAllowlist = [];
|
|
@@ -7287,8 +6875,12 @@ function compareParity(oldRun, newRun, allowlist, scope) {
|
|
|
7287
6875
|
const events = diffLayer(layers.events[0], layers.events[1]);
|
|
7288
6876
|
const rows = diffLayer(layers.rows[0], layers.rows[1]);
|
|
7289
6877
|
const grammar = diffLayer(
|
|
7290
|
-
(oldRun.grammarViolations ?? []).map(
|
|
7291
|
-
|
|
6878
|
+
(oldRun.grammarViolations ?? []).map(
|
|
6879
|
+
(violation2) => `${violation2.rule}:${violation2.eventType}`
|
|
6880
|
+
),
|
|
6881
|
+
(newRun.grammarViolations ?? []).map(
|
|
6882
|
+
(violation2) => `${violation2.rule}:${violation2.eventType}`
|
|
6883
|
+
)
|
|
7292
6884
|
);
|
|
7293
6885
|
const clean = (diff) => diff.onlyInOld.length === 0 && diff.onlyInNew.length === 0;
|
|
7294
6886
|
return {
|
|
@@ -7322,7 +6914,12 @@ async function rerecordCurrentBridgeLane(options) {
|
|
|
7322
6914
|
const recording = readBridgeRecording(options.recordingDir);
|
|
7323
6915
|
const run = await replayRecording({ ...options, planFromCurrentLane: false });
|
|
7324
6916
|
if (run.stalls.length > 0) {
|
|
7325
|
-
return {
|
|
6917
|
+
return {
|
|
6918
|
+
file: null,
|
|
6919
|
+
lines: 0,
|
|
6920
|
+
events: run.events.length,
|
|
6921
|
+
stalls: run.stalls
|
|
6922
|
+
};
|
|
7326
6923
|
}
|
|
7327
6924
|
const firstRuntime = recording.entries.find(
|
|
7328
6925
|
(entry) => entry.dir === "runtime\u2192bridge"
|
|
@@ -7361,7 +6958,6 @@ async function rerecordCurrentBridgeLane(options) {
|
|
|
7361
6958
|
entries.push({
|
|
7362
6959
|
ts: anchor.ts + ordinal,
|
|
7363
6960
|
run: anchor.run,
|
|
7364
|
-
// Fractional: after the anchoring runtime entry, before the next one.
|
|
7365
6961
|
seq: anchor.seq + ordinal / (run.lines.length + 1),
|
|
7366
6962
|
dir: BRIDGE_TO_RUNTIME,
|
|
7367
6963
|
line
|