@byok-sdk/protocol 0.11.0 → 0.13.0

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/README.md CHANGED
@@ -3,6 +3,12 @@
3
3
  The frozen v1 BYOK device wire contract: envelope schemas, message payloads,
4
4
  codecs, version negotiation, and golden fixtures.
5
5
 
6
+ `provider-profile-binding` is an additive v1 capability for exact device-local
7
+ BYOK routing. Its `byok-profile` selection contains only `profileRef`, canonical
8
+ decimal `profileRevision`, SHA-256 `profileHash`, `modelId`, and bounded
9
+ `requiredCapabilities`. Endpoint, auth configuration, and credential material
10
+ remain outside the protocol.
11
+
6
12
  `TaskOfferPayload.dispatchSelection` is the optional strict dual-lane target
7
13
  contract: subscription selects Claude/Codex + model, while BYOK selects Pi +
8
14
  provider + model. When present it is authoritative and runtime disagreement
package/dist/codec.d.ts CHANGED
@@ -11,7 +11,7 @@ import { MESSAGE_PAYLOAD_SCHEMAS, type MessageType } from './messages';
11
11
  export declare function parseMessage(data: unknown): Envelope;
12
12
  /**
13
13
  * Decode a single NDJSON line into a validated {@link Envelope}. Accepts a
14
- * string or raw bytes (e.g. a WebSocket binary frame) — isomorphic, no
14
+ * string or raw bytes (e.g. a binary transport frame) — isomorphic, no
15
15
  * stream handling required of the caller.
16
16
  */
17
17
  export declare function decodeEnvelope(line: string | Uint8Array): Envelope;
@@ -110,6 +110,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
110
110
  runtimeId: z.ZodLiteral<"pi">;
111
111
  providerId: z.ZodString;
112
112
  modelId: z.ZodString;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ lane: z.ZodLiteral<"byok-profile">;
115
+ runtimeId: z.ZodLiteral<"pi">;
116
+ providerProfile: z.ZodObject<{
117
+ profileRef: z.ZodString;
118
+ profileRevision: z.ZodString;
119
+ profileHash: z.ZodString;
120
+ modelId: z.ZodString;
121
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
122
+ "image-input": "image-input";
123
+ }>>;
124
+ }, z.core.$strict>;
113
125
  }, z.core.$strict>], "lane">>;
114
126
  sessionRef: z.ZodOptional<z.ZodString>;
115
127
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -166,6 +178,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
166
178
  runtimeId: z.ZodLiteral<"pi">;
167
179
  providerId: z.ZodString;
168
180
  modelId: z.ZodString;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ lane: z.ZodLiteral<"byok-profile">;
183
+ runtimeId: z.ZodLiteral<"pi">;
184
+ providerProfile: z.ZodObject<{
185
+ profileRef: z.ZodString;
186
+ profileRevision: z.ZodString;
187
+ profileHash: z.ZodString;
188
+ modelId: z.ZodString;
189
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
190
+ "image-input": "image-input";
191
+ }>>;
192
+ }, z.core.$strict>;
169
193
  }, z.core.$strict>], "lane">>;
170
194
  sessionRef: z.ZodOptional<z.ZodString>;
171
195
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -228,6 +252,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
228
252
  runtimeId: z.ZodLiteral<"pi">;
229
253
  providerId: z.ZodString;
230
254
  modelId: z.ZodString;
255
+ }, z.core.$strict>, z.ZodObject<{
256
+ lane: z.ZodLiteral<"byok-profile">;
257
+ runtimeId: z.ZodLiteral<"pi">;
258
+ providerProfile: z.ZodObject<{
259
+ profileRef: z.ZodString;
260
+ profileRevision: z.ZodString;
261
+ profileHash: z.ZodString;
262
+ modelId: z.ZodString;
263
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
264
+ "image-input": "image-input";
265
+ }>>;
266
+ }, z.core.$strict>;
231
267
  }, z.core.$strict>], "lane">>;
232
268
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
233
269
  mode: z.ZodLiteral<"none">;
@@ -294,6 +330,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
294
330
  runtimeId: z.ZodLiteral<"pi">;
295
331
  providerId: z.ZodString;
296
332
  modelId: z.ZodString;
333
+ }, z.core.$strict>, z.ZodObject<{
334
+ lane: z.ZodLiteral<"byok-profile">;
335
+ runtimeId: z.ZodLiteral<"pi">;
336
+ providerProfile: z.ZodObject<{
337
+ profileRef: z.ZodString;
338
+ profileRevision: z.ZodString;
339
+ profileHash: z.ZodString;
340
+ modelId: z.ZodString;
341
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
342
+ "image-input": "image-input";
343
+ }>>;
344
+ }, z.core.$strict>;
297
345
  }, z.core.$strict>], "lane">>;
298
346
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
299
347
  mode: z.ZodLiteral<"none">;
@@ -400,6 +448,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
400
448
  runtimeId: z.ZodLiteral<"pi">;
401
449
  providerId: z.ZodString;
402
450
  modelId: z.ZodString;
451
+ }, z.core.$strict>, z.ZodObject<{
452
+ lane: z.ZodLiteral<"byok-profile">;
453
+ runtimeId: z.ZodLiteral<"pi">;
454
+ providerProfile: z.ZodObject<{
455
+ profileRef: z.ZodString;
456
+ profileRevision: z.ZodString;
457
+ profileHash: z.ZodString;
458
+ modelId: z.ZodString;
459
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
460
+ "image-input": "image-input";
461
+ }>>;
462
+ }, z.core.$strict>;
403
463
  }, z.core.$strict>], "lane">>;
404
464
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
405
465
  mode: z.ZodLiteral<"none">;
@@ -3,12 +3,12 @@ import { z } from 'zod';
3
3
  * HTTP-side request/response shapes for the reference server's auth and blob
4
4
  * endpoints (M1 Part B). These are plain HTTP bodies, not wire envelopes —
5
5
  * kept in a separate module from `envelope.ts`/`messages.ts` because they
6
- * never travel over the WSS connection. Documented in full in
7
- * docs/protocol.md ("Auth flows", "Blob flows", "Long-poll fallback").
6
+ * are HTTP request/response bodies rather than mailbox envelopes. Documented
7
+ * in full in docs/protocol.md ("Auth flows", "Blob flows", "Long-poll").
8
8
  *
9
9
  * The wire protocol version (`v:1`) is unaffected by any of this: pairing,
10
- * token renewal, and blob transfer are out-of-band HTTP calls that happen
11
- * before/alongside the WSS connection, not envelope types.
10
+ * token renewal, and blob transfer are separate HTTP calls around the
11
+ * long-poll mailbox lifecycle, not envelope types.
12
12
  */
13
13
  export declare const PairRequestSchema: z.ZodObject<{
14
14
  pairingCode: z.ZodString;
@@ -83,7 +83,7 @@ export type PresencePublishRequest = z.infer<typeof PresencePublishRequestSchema
83
83
  /**
84
84
  * Revocation is server-side only (dashboard/API call on the SaaS's own
85
85
  * device registry) — there is no wire message for it. A revoked device's
86
- * next `/byok/challenge` or `/byok/token` call (or WSS connect) gets a 401;
86
+ * next `/byok/challenge`, `/byok/token`, or authenticated mailbox call gets a 401;
87
87
  * the daemon's only recourse is to re-run `/byok/pair` from scratch.
88
88
  */
89
89
  /** POST /byok/blobs request: declare a blob before uploading it. `contentHash` must be the canonical `sha256:<64 lowercase hex>` form (finding F9) — the server rejects anything else outright, no normalization. */
@@ -203,6 +203,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
203
203
  runtimeId: z.ZodLiteral<"pi">;
204
204
  providerId: z.ZodString;
205
205
  modelId: z.ZodString;
206
+ }, z.core.$strict>, z.ZodObject<{
207
+ lane: z.ZodLiteral<"byok-profile">;
208
+ runtimeId: z.ZodLiteral<"pi">;
209
+ providerProfile: z.ZodObject<{
210
+ profileRef: z.ZodString;
211
+ profileRevision: z.ZodString;
212
+ profileHash: z.ZodString;
213
+ modelId: z.ZodString;
214
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
215
+ "image-input": "image-input";
216
+ }>>;
217
+ }, z.core.$strict>;
206
218
  }, z.core.$strict>], "lane">>;
207
219
  sessionRef: z.ZodOptional<z.ZodString>;
208
220
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -259,6 +271,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
259
271
  runtimeId: z.ZodLiteral<"pi">;
260
272
  providerId: z.ZodString;
261
273
  modelId: z.ZodString;
274
+ }, z.core.$strict>, z.ZodObject<{
275
+ lane: z.ZodLiteral<"byok-profile">;
276
+ runtimeId: z.ZodLiteral<"pi">;
277
+ providerProfile: z.ZodObject<{
278
+ profileRef: z.ZodString;
279
+ profileRevision: z.ZodString;
280
+ profileHash: z.ZodString;
281
+ modelId: z.ZodString;
282
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
283
+ "image-input": "image-input";
284
+ }>>;
285
+ }, z.core.$strict>;
262
286
  }, z.core.$strict>], "lane">>;
263
287
  sessionRef: z.ZodOptional<z.ZodString>;
264
288
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -321,6 +345,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
321
345
  runtimeId: z.ZodLiteral<"pi">;
322
346
  providerId: z.ZodString;
323
347
  modelId: z.ZodString;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ lane: z.ZodLiteral<"byok-profile">;
350
+ runtimeId: z.ZodLiteral<"pi">;
351
+ providerProfile: z.ZodObject<{
352
+ profileRef: z.ZodString;
353
+ profileRevision: z.ZodString;
354
+ profileHash: z.ZodString;
355
+ modelId: z.ZodString;
356
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
357
+ "image-input": "image-input";
358
+ }>>;
359
+ }, z.core.$strict>;
324
360
  }, z.core.$strict>], "lane">>;
325
361
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
326
362
  mode: z.ZodLiteral<"none">;
@@ -387,6 +423,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
387
423
  runtimeId: z.ZodLiteral<"pi">;
388
424
  providerId: z.ZodString;
389
425
  modelId: z.ZodString;
426
+ }, z.core.$strict>, z.ZodObject<{
427
+ lane: z.ZodLiteral<"byok-profile">;
428
+ runtimeId: z.ZodLiteral<"pi">;
429
+ providerProfile: z.ZodObject<{
430
+ profileRef: z.ZodString;
431
+ profileRevision: z.ZodString;
432
+ profileHash: z.ZodString;
433
+ modelId: z.ZodString;
434
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
435
+ "image-input": "image-input";
436
+ }>>;
437
+ }, z.core.$strict>;
390
438
  }, z.core.$strict>], "lane">>;
391
439
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
392
440
  mode: z.ZodLiteral<"none">;
@@ -493,6 +541,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
493
541
  runtimeId: z.ZodLiteral<"pi">;
494
542
  providerId: z.ZodString;
495
543
  modelId: z.ZodString;
544
+ }, z.core.$strict>, z.ZodObject<{
545
+ lane: z.ZodLiteral<"byok-profile">;
546
+ runtimeId: z.ZodLiteral<"pi">;
547
+ providerProfile: z.ZodObject<{
548
+ profileRef: z.ZodString;
549
+ profileRevision: z.ZodString;
550
+ profileHash: z.ZodString;
551
+ modelId: z.ZodString;
552
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
553
+ "image-input": "image-input";
554
+ }>>;
555
+ }, z.core.$strict>;
496
556
  }, z.core.$strict>], "lane">>;
497
557
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
498
558
  mode: z.ZodLiteral<"none">;
@@ -1213,6 +1273,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1213
1273
  runtimeId: z.ZodLiteral<"pi">;
1214
1274
  providerId: z.ZodString;
1215
1275
  modelId: z.ZodString;
1276
+ }, z.core.$strict>, z.ZodObject<{
1277
+ lane: z.ZodLiteral<"byok-profile">;
1278
+ runtimeId: z.ZodLiteral<"pi">;
1279
+ providerProfile: z.ZodObject<{
1280
+ profileRef: z.ZodString;
1281
+ profileRevision: z.ZodString;
1282
+ profileHash: z.ZodString;
1283
+ modelId: z.ZodString;
1284
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1285
+ "image-input": "image-input";
1286
+ }>>;
1287
+ }, z.core.$strict>;
1216
1288
  }, z.core.$strict>], "lane">>;
1217
1289
  sessionRef: z.ZodOptional<z.ZodString>;
1218
1290
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -1269,6 +1341,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1269
1341
  runtimeId: z.ZodLiteral<"pi">;
1270
1342
  providerId: z.ZodString;
1271
1343
  modelId: z.ZodString;
1344
+ }, z.core.$strict>, z.ZodObject<{
1345
+ lane: z.ZodLiteral<"byok-profile">;
1346
+ runtimeId: z.ZodLiteral<"pi">;
1347
+ providerProfile: z.ZodObject<{
1348
+ profileRef: z.ZodString;
1349
+ profileRevision: z.ZodString;
1350
+ profileHash: z.ZodString;
1351
+ modelId: z.ZodString;
1352
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1353
+ "image-input": "image-input";
1354
+ }>>;
1355
+ }, z.core.$strict>;
1272
1356
  }, z.core.$strict>], "lane">>;
1273
1357
  sessionRef: z.ZodOptional<z.ZodString>;
1274
1358
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -1331,6 +1415,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1331
1415
  runtimeId: z.ZodLiteral<"pi">;
1332
1416
  providerId: z.ZodString;
1333
1417
  modelId: z.ZodString;
1418
+ }, z.core.$strict>, z.ZodObject<{
1419
+ lane: z.ZodLiteral<"byok-profile">;
1420
+ runtimeId: z.ZodLiteral<"pi">;
1421
+ providerProfile: z.ZodObject<{
1422
+ profileRef: z.ZodString;
1423
+ profileRevision: z.ZodString;
1424
+ profileHash: z.ZodString;
1425
+ modelId: z.ZodString;
1426
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1427
+ "image-input": "image-input";
1428
+ }>>;
1429
+ }, z.core.$strict>;
1334
1430
  }, z.core.$strict>], "lane">>;
1335
1431
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1336
1432
  mode: z.ZodLiteral<"none">;
@@ -1397,6 +1493,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1397
1493
  runtimeId: z.ZodLiteral<"pi">;
1398
1494
  providerId: z.ZodString;
1399
1495
  modelId: z.ZodString;
1496
+ }, z.core.$strict>, z.ZodObject<{
1497
+ lane: z.ZodLiteral<"byok-profile">;
1498
+ runtimeId: z.ZodLiteral<"pi">;
1499
+ providerProfile: z.ZodObject<{
1500
+ profileRef: z.ZodString;
1501
+ profileRevision: z.ZodString;
1502
+ profileHash: z.ZodString;
1503
+ modelId: z.ZodString;
1504
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1505
+ "image-input": "image-input";
1506
+ }>>;
1507
+ }, z.core.$strict>;
1400
1508
  }, z.core.$strict>], "lane">>;
1401
1509
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1402
1510
  mode: z.ZodLiteral<"none">;
@@ -1503,6 +1611,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1503
1611
  runtimeId: z.ZodLiteral<"pi">;
1504
1612
  providerId: z.ZodString;
1505
1613
  modelId: z.ZodString;
1614
+ }, z.core.$strict>, z.ZodObject<{
1615
+ lane: z.ZodLiteral<"byok-profile">;
1616
+ runtimeId: z.ZodLiteral<"pi">;
1617
+ providerProfile: z.ZodObject<{
1618
+ profileRef: z.ZodString;
1619
+ profileRevision: z.ZodString;
1620
+ profileHash: z.ZodString;
1621
+ modelId: z.ZodString;
1622
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1623
+ "image-input": "image-input";
1624
+ }>>;
1625
+ }, z.core.$strict>;
1506
1626
  }, z.core.$strict>], "lane">>;
1507
1627
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1508
1628
  mode: z.ZodLiteral<"none">;
@@ -2119,12 +2239,10 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
2119
2239
  export type MessagesSendRequest = z.infer<typeof MessagesSendRequestSchema>;
2120
2240
  /**
2121
2241
  * `accepted` counts every envelope `ConnectionHub.handleInbound` returned
2122
- * `'accepted'` *or* `'duplicate'` for (finding P2) — a dedup'd replay is a
2123
- * wire-level success (§9's idempotency window), even though no handler ran
2124
- * for it a second time. `rejected` (a type outside `DAEMON_TO_SERVER_TYPES`,
2125
- * or an ownership mismatch — N2) is a separate, additive count: omitted
2126
- * entirely when zero, so a batch with nothing rejected keeps the pre-P2
2127
- * `{ accepted }` shape callers already depend on.
2242
+ * `'accepted'` *or* `'duplicate'` for — a deduped replay is a wire-level
2243
+ * success even though the business mutation did not run a second time.
2244
+ * `rejected` is additive and omitted when zero, preserving frozen v1's
2245
+ * `{ accepted }` response shape.
2128
2246
  */
2129
2247
  export declare const MessagesSendResponseSchema: z.ZodObject<{
2130
2248
  accepted: z.ZodNumber;
@@ -2229,8 +2347,6 @@ export declare const AgentMemoryProjectionCommitResponseSchema: z.ZodObject<{
2229
2347
  }, z.core.$strict>;
2230
2348
  }, z.core.$strict>;
2231
2349
  export type AgentMemoryProjectionCommitResponse = z.infer<typeof AgentMemoryProjectionCommitResponseSchema>;
2232
- /** `GET /byok/ws` — WebSocket upgrade path. */
2233
- export declare const BYOK_WS_PATH = "/byok/ws";
2234
2350
  /** `POST /byok/pair` — one-time device pairing (§6). */
2235
2351
  export declare const BYOK_PAIR_PATH = "/byok/pair";
2236
2352
  /** `POST /byok/challenge` — token-renewal challenge (§6.3). */
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export { BlobRefSchema, CONTENT_HASH_RE } from './blob';
4
4
  export type { BlobRef } from './blob';
5
5
  export { PermissionPolicySchema, PERMISSION_MODES } from './permission';
6
6
  export type { PermissionPolicy, PermissionMode } from './permission';
7
+ export { PROVIDER_PROFILE_BINDING_CAPABILITY, PROVIDER_MODEL_CAPABILITIES, ProviderProfileRefSchema, ProviderProfileRevisionSchema, ProviderProfileHashSchema, ProviderModelCapabilitySchema, ProviderProfileBindingSchema, } from './provider-profile-binding';
8
+ export type { ProviderProfileRef, ProviderProfileRevision, ProviderProfileHash, ProviderModelCapability, ProviderProfileBinding, } from './provider-profile-binding';
7
9
  export { AgentEventSchema, UnknownAgentEventSchema, AgentEventOrUnknownSchema, KNOWN_AGENT_EVENT_TYPES, isKnownAgentEvent, partitionAgentEvents, } from './agent-event';
8
10
  export type { AgentEvent, UnknownAgentEvent, AgentEventOrUnknown } from './agent-event';
9
11
  export { AgentEgressPolicySchema, AgentEgressActivityPolicySchema, AgentReliableQuotaPolicySchema, ContentReadPolicySchema, AgentEgressLaneSchema, AgentEgressDropReasonSchema, AgentContentReadSurfaceSchema, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentEgressContentHashSchema, AgentEgressPolicyRevisionSchema, AgentMessageContractSchema, AgentMessageContentTypeSchema, AgentMessageDestinationBindingSchema, AgentMessageFreshnessCursorSchema, AgentMessageServerContextSchema, AgentMessageEgressRequirementSchema, AGENT_MESSAGE_MAX_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, } from './agent-egress';
@@ -23,5 +25,5 @@ export type { Envelope } from './envelope';
23
25
  export { ProtocolError, EnvelopeParseError, UnknownMessageTypeError, EnvelopeValidationError, } from './errors';
24
26
  export { encodeEnvelope, decodeEnvelope, createEnvelope, parseMessage } from './codec';
25
27
  export type { CreateEnvelopeOptions } from './codec';
26
- export { PairRequestSchema, PairResponseTenantIdSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PairResponseSchema, ChallengeRequestSchema, ChallengeResponseSchema, TokenRequestSchema, TokenResponseSchema, PresencePublishRequestSchema, CreateBlobRequestSchema, CreateBlobResponseSchema, BlobDownloadUrlResponseSchema, EventsPollQuerySchema, EventsPollResponseSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionReadbackSchema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, MAX_MESSAGES_PER_BATCH, BYOK_WS_PATH, BYOK_PAIR_PATH, BYOK_CHALLENGE_PATH, BYOK_TOKEN_PATH, BYOK_CAPABILITIES_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, byokAgentHomeProjectionCompletionPath, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_PRESENCE_PATH, BYOK_ACTIVITY_PATH, BYOK_BOARD_PATH, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_BOARD_STATUS_ROUTE, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, byokRecordPath, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, byokSkillPackFilePath, BYOK_BLOBS_PATH, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BLOB_CONTENT_ROUTE, byokBlobFinalizePath, byokBlobUrlPath, byokBlobContentPath, } from './http-api';
28
+ export { PairRequestSchema, PairResponseTenantIdSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PairResponseSchema, ChallengeRequestSchema, ChallengeResponseSchema, TokenRequestSchema, TokenResponseSchema, PresencePublishRequestSchema, CreateBlobRequestSchema, CreateBlobResponseSchema, BlobDownloadUrlResponseSchema, EventsPollQuerySchema, EventsPollResponseSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionReadbackSchema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, MAX_MESSAGES_PER_BATCH, BYOK_PAIR_PATH, BYOK_CHALLENGE_PATH, BYOK_TOKEN_PATH, BYOK_CAPABILITIES_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, byokAgentHomeProjectionCompletionPath, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_PRESENCE_PATH, BYOK_ACTIVITY_PATH, BYOK_BOARD_PATH, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_BOARD_STATUS_ROUTE, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, byokRecordPath, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, byokSkillPackFilePath, BYOK_BLOBS_PATH, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BLOB_CONTENT_ROUTE, byokBlobFinalizePath, byokBlobUrlPath, byokBlobContentPath, } from './http-api';
27
29
  export type { PairRequest, PairResponse, ChallengeRequest, ChallengeResponse, TokenRequest, TokenResponse, PresencePublishRequest, CreateBlobRequest, CreateBlobResponse, BlobDownloadUrlResponse, EventsPollQuery, EventsPollResponse, MessagesSendRequest, MessagesSendResponse, AgentHomeProjectionCompletionRequest, AgentHomeProjectionStatus, AgentHomeProjectionReadback, AgentMemoryProjectionCommitRequest, AgentMemoryProjectionCommitResponse, } from './http-api';
package/dist/index.js CHANGED
@@ -122,6 +122,23 @@ var TerminalProjectionSelectionSchema = z.discriminatedUnion("mode", [
122
122
  contract: TerminalProjectionContractSchema
123
123
  }).strict()
124
124
  ]);
125
+ var PROVIDER_PROFILE_BINDING_CAPABILITY = "provider-profile-binding";
126
+ var ProviderProfileRefSchema = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u, "provider profile refs must be lowercase portable identifiers");
127
+ var ProviderProfileRevisionSchema = z.string().regex(/^(?:0|[1-9][0-9]{0,19})$/u, "provider profile revision must be canonical decimal");
128
+ var ProviderProfileHashSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "provider profile hash must be lowercase sha256");
129
+ var PROVIDER_MODEL_CAPABILITIES = ["image-input"];
130
+ var ProviderModelCapabilitySchema = z.enum(PROVIDER_MODEL_CAPABILITIES);
131
+ var ProviderProfileBindingSchema = z.object({
132
+ profileRef: ProviderProfileRefSchema,
133
+ profileRevision: ProviderProfileRevisionSchema,
134
+ profileHash: ProviderProfileHashSchema,
135
+ modelId: z.string().min(1).max(160).regex(/^[^\u0000\r\n]+$/u),
136
+ requiredCapabilities: z.array(ProviderModelCapabilitySchema).max(8)
137
+ }).strict().superRefine((binding, ctx) => {
138
+ if (new Set(binding.requiredCapabilities).size !== binding.requiredCapabilities.length) {
139
+ ctx.addIssue({ code: "custom", path: ["requiredCapabilities"], message: "duplicate provider capability" });
140
+ }
141
+ });
125
142
 
126
143
  // src/version.ts
127
144
  var PROTOCOL_VERSION = 1;
@@ -134,6 +151,7 @@ var CAPABILITY_FLAGS = [
134
151
  "approval-targeting",
135
152
  "result-document",
136
153
  "dispatch-selection",
154
+ PROVIDER_PROFILE_BINDING_CAPABILITY,
137
155
  "toolset-selection",
138
156
  "agent-home-contract",
139
157
  STRICT_AGENT_ONLY_CAPABILITY,
@@ -307,6 +325,11 @@ var DispatchSelectionSchema = z.discriminatedUnion("lane", [
307
325
  runtimeId: z.literal("pi"),
308
326
  providerId: DispatchTargetIdSchema,
309
327
  modelId: DispatchTargetIdSchema
328
+ }).strict(),
329
+ z.object({
330
+ lane: z.literal("byok-profile"),
331
+ runtimeId: z.literal("pi"),
332
+ providerProfile: ProviderProfileBindingSchema
310
333
  }).strict()
311
334
  ]);
312
335
  var TaskOfferPayloadSchema = z.object({
@@ -1044,7 +1067,6 @@ var AgentHomeProjectionReadbackSchema = z.object({
1044
1067
  }).strict();
1045
1068
  var AgentMemoryProjectionCommitRequestSchema = AgentMemoryProjectionMutationSchema;
1046
1069
  var AgentMemoryProjectionCommitResponseSchema = AgentMemoryProjectionReceiptSchema;
1047
- var BYOK_WS_PATH = "/byok/ws";
1048
1070
  var BYOK_PAIR_PATH = "/byok/pair";
1049
1071
  var BYOK_CHALLENGE_PATH = "/byok/challenge";
1050
1072
  var BYOK_TOKEN_PATH = "/byok/token";
@@ -1088,6 +1110,6 @@ function byokBlobContentPath(blobId) {
1088
1110
  return `/byok/blobs/${blobId}/content`;
1089
1111
  }
1090
1112
 
1091
- export { AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_HOME_PROJECTION_CAPABILITY, AGENT_HOME_PROJECTION_MAX_BYTES, AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM, AGENT_MEMORY_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_MESSAGE_MAX_BYTES, AGENT_REF_MAX_BYTES, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentHomeProjectionAgentRefSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionHashSchema, AgentHomeProjectionOutcomeSchema, AgentHomeProjectionPayloadSchema, AgentHomeProjectionProfileRevisionSchema, AgentHomeProjectionReadbackSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionValueSchema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, AgentMemoryProjectionEraseResultSchema, AgentMemoryProjectionGrantRefSchema, AgentMemoryProjectionMeteringReceiptSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AgentMemoryProjectionSessionRefSchema, AgentMemoryProjectionSnapshotSchema, AgentMemoryProjectionSourceSeqSchema, AgentMemoryProjectionWriterEpochSchema, AgentMessageContentTypeSchema, AgentMessageContractSchema, AgentMessageDestinationBindingSchema, AgentMessageDispositionPayloadSchema, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BYOK_ACTIVITY_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_BLOBS_PATH, BYOK_BLOB_CONTENT_ROUTE, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_CAPABILITIES_PATH, BYOK_CHALLENGE_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_PAIR_PATH, BYOK_PRESENCE_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_TOKEN_PATH, BYOK_WS_PATH, BlobDownloadUrlResponseSchema, BlobRefSchema, CAPABILITY_FLAGS, CONFIGURED_TOOLSETS_MAX_ITEMS, CONTENT_HASH_RE, ChallengeRequestSchema, ChallengeResponseSchema, ConfiguredToolsetsSchema, ConnAckPayloadSchema, ConnHelloPayloadSchema, ContentReadPolicySchema, CreateBlobRequestSchema, CreateBlobResponseSchema, DAEMON_TO_SERVER_TYPES, DispatchSelectionSchema, EnvelopeParseError, EnvelopeSchema, EnvelopeValidationError, EventsPollQuerySchema, EventsPollResponseSchema, KNOWN_AGENT_EVENT_TYPES, MAX_MESSAGES_PER_BATCH, MESSAGE_PAYLOAD_SCHEMAS, MESSAGE_TYPES, MessagesSendRequestSchema, MessagesSendResponseSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PERMISSION_MODES, PROTOCOL_VERSION, PairRequestSchema, PairResponseSchema, PairResponseTenantIdSchema, PermissionPolicySchema, PresencePublishRequestSchema, ProtocolError, ProtocolVersionNumberSchema, RESULT_DOCUMENT_MAX_BYTES, RequiredToolsetsSchema, RuntimeCapabilitiesSchema, RuntimeIdSchema, RuntimeInfoSchema, SERVER_TO_DAEMON_TYPES, STRICT_AGENT_ONLY_CAPABILITY, TASK_STATES, TASK_TRANSITIONS, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalInferenceUsageSchema, TerminalProjectionContractSchema, TerminalProjectionSelectionSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, agentMemoryProjectionBase64UrlByteLength, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isServerToDaemonType, parseMessage, partitionAgentEvents };
1113
+ export { AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_HOME_PROJECTION_CAPABILITY, AGENT_HOME_PROJECTION_MAX_BYTES, AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM, AGENT_MEMORY_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_MESSAGE_MAX_BYTES, AGENT_REF_MAX_BYTES, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentHomeProjectionAgentRefSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionHashSchema, AgentHomeProjectionOutcomeSchema, AgentHomeProjectionPayloadSchema, AgentHomeProjectionProfileRevisionSchema, AgentHomeProjectionReadbackSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionValueSchema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, AgentMemoryProjectionEraseResultSchema, AgentMemoryProjectionGrantRefSchema, AgentMemoryProjectionMeteringReceiptSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AgentMemoryProjectionSessionRefSchema, AgentMemoryProjectionSnapshotSchema, AgentMemoryProjectionSourceSeqSchema, AgentMemoryProjectionWriterEpochSchema, AgentMessageContentTypeSchema, AgentMessageContractSchema, AgentMessageDestinationBindingSchema, AgentMessageDispositionPayloadSchema, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BYOK_ACTIVITY_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_BLOBS_PATH, BYOK_BLOB_CONTENT_ROUTE, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_CAPABILITIES_PATH, BYOK_CHALLENGE_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_PAIR_PATH, BYOK_PRESENCE_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_TOKEN_PATH, BlobDownloadUrlResponseSchema, BlobRefSchema, CAPABILITY_FLAGS, CONFIGURED_TOOLSETS_MAX_ITEMS, CONTENT_HASH_RE, ChallengeRequestSchema, ChallengeResponseSchema, ConfiguredToolsetsSchema, ConnAckPayloadSchema, ConnHelloPayloadSchema, ContentReadPolicySchema, CreateBlobRequestSchema, CreateBlobResponseSchema, DAEMON_TO_SERVER_TYPES, DispatchSelectionSchema, EnvelopeParseError, EnvelopeSchema, EnvelopeValidationError, EventsPollQuerySchema, EventsPollResponseSchema, KNOWN_AGENT_EVENT_TYPES, MAX_MESSAGES_PER_BATCH, MESSAGE_PAYLOAD_SCHEMAS, MESSAGE_TYPES, MessagesSendRequestSchema, MessagesSendResponseSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PERMISSION_MODES, PROTOCOL_VERSION, PROVIDER_MODEL_CAPABILITIES, PROVIDER_PROFILE_BINDING_CAPABILITY, PairRequestSchema, PairResponseSchema, PairResponseTenantIdSchema, PermissionPolicySchema, PresencePublishRequestSchema, ProtocolError, ProtocolVersionNumberSchema, ProviderModelCapabilitySchema, ProviderProfileBindingSchema, ProviderProfileHashSchema, ProviderProfileRefSchema, ProviderProfileRevisionSchema, RESULT_DOCUMENT_MAX_BYTES, RequiredToolsetsSchema, RuntimeCapabilitiesSchema, RuntimeIdSchema, RuntimeInfoSchema, SERVER_TO_DAEMON_TYPES, STRICT_AGENT_ONLY_CAPABILITY, TASK_STATES, TASK_TRANSITIONS, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalInferenceUsageSchema, TerminalProjectionContractSchema, TerminalProjectionSelectionSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, agentMemoryProjectionBase64UrlByteLength, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isServerToDaemonType, parseMessage, partitionAgentEvents };
1092
1114
  //# sourceMappingURL=index.js.map
1093
1115
  //# sourceMappingURL=index.js.map