@byok-sdk/protocol 0.6.1 → 0.8.0-beta.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.
@@ -2,6 +2,8 @@ import { z } from 'zod';
2
2
  /** Additive daemon capability names. Server/cloud admission consumes these exactly. */
3
3
  export declare const AGENT_EGRESS_POLICY_CAPABILITY: 'agent-egress-policy';
4
4
  export declare const AGENT_EGRESS_RELIABLE_ACK_CAPABILITY: 'agent-egress-reliable-ack';
5
+ /** Admits the distinct offer whose runtime mints its session only after start. */
6
+ export declare const AGENT_EGRESS_FRESH_SESSION_CAPABILITY: 'agent-egress-fresh-session';
5
7
  export declare const AGENT_CONTENT_WORKSPACE_READ_CAPABILITY: 'agent-content-workspace-read';
6
8
  export declare const AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY: 'agent-content-transcript-read';
7
9
  export declare const AGENT_CONTENT_ARTIFACT_READ_CAPABILITY: 'agent-content-artifact-read';
package/dist/codec.d.ts CHANGED
@@ -42,6 +42,10 @@ interface EnvelopeShapeOptions {
42
42
  taskId: string;
43
43
  seq: number;
44
44
  };
45
+ 'task.offer_for_agent_with_egress_fresh': {
46
+ taskId: string;
47
+ seq: number;
48
+ };
45
49
  'agent.egress.reliable': {
46
50
  taskId?: string;
47
51
  seq?: number;
@@ -326,6 +326,96 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
326
326
  }, z.core.$strict>;
327
327
  }, z.core.$strict>;
328
328
  }, z.core.$strict>;
329
+ }, z.core.$strip>, z.ZodObject<{
330
+ v: z.ZodNumber;
331
+ id: z.ZodUUID;
332
+ ts: z.ZodISODateTime;
333
+ type: z.ZodLiteral<"task.offer_for_agent_with_egress_fresh">;
334
+ task_id: z.ZodString;
335
+ session_ref: z.ZodOptional<z.ZodString>;
336
+ seq: z.ZodNumber;
337
+ payload: z.ZodObject<{
338
+ instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
339
+ blobRef: z.ZodObject<{
340
+ blobId: z.ZodString;
341
+ contentHash: z.ZodString;
342
+ size: z.ZodNumber;
343
+ contentType: z.ZodString;
344
+ url: z.ZodOptional<z.ZodString>;
345
+ }, z.core.$strip>;
346
+ }, z.core.$strict>]>;
347
+ policy: z.ZodObject<{
348
+ mode: z.ZodEnum<{
349
+ auto: "auto";
350
+ confirm: "confirm";
351
+ plan: "plan";
352
+ readonly: "readonly";
353
+ }>;
354
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
355
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
356
+ workspaceRoot: z.ZodOptional<z.ZodString>;
357
+ network: z.ZodOptional<z.ZodBoolean>;
358
+ }, z.core.$strict>;
359
+ agentRef: z.ZodObject<{
360
+ agentId: z.ZodString;
361
+ profileRevision: z.ZodString;
362
+ }, z.core.$strict>;
363
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
364
+ runtime: z.ZodOptional<z.ZodEnum<{
365
+ claude: "claude";
366
+ codex: "codex";
367
+ pi: "pi";
368
+ }>>;
369
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
370
+ lane: z.ZodLiteral<"subscription">;
371
+ runtimeId: z.ZodEnum<{
372
+ claude: "claude";
373
+ codex: "codex";
374
+ }>;
375
+ providerId: z.ZodNull;
376
+ modelId: z.ZodString;
377
+ }, z.core.$strict>, z.ZodObject<{
378
+ lane: z.ZodLiteral<"byok">;
379
+ runtimeId: z.ZodLiteral<"pi">;
380
+ providerId: z.ZodString;
381
+ modelId: z.ZodString;
382
+ }, z.core.$strict>], "lane">>;
383
+ limits: z.ZodOptional<z.ZodObject<{
384
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
385
+ maxTokens: z.ZodOptional<z.ZodNumber>;
386
+ }, z.core.$strip>>;
387
+ egressPolicy: z.ZodObject<{
388
+ policyRevision: z.ZodString;
389
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
390
+ mode: z.ZodLiteral<"metadata-status">;
391
+ delivery: z.ZodLiteral<"latest-value">;
392
+ }, z.core.$strict>, z.ZodObject<{
393
+ mode: z.ZodLiteral<"contentful-trajectory">;
394
+ delivery: z.ZodLiteral<"latest-value">;
395
+ maxCoalesceMs: z.ZodNumber;
396
+ maxEventBytes: z.ZodNumber;
397
+ }, z.core.$strict>], "mode">;
398
+ reliable: z.ZodObject<{
399
+ maxPendingEventsPerAgent: z.ZodNumber;
400
+ maxPendingBytesPerAgent: z.ZodNumber;
401
+ maxPendingBytesPerTenant: z.ZodNumber;
402
+ }, z.core.$strict>;
403
+ transfers: z.ZodObject<{
404
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
405
+ maxBytes: z.ZodNumber;
406
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
407
+ }, z.core.$strict>]>;
408
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
409
+ maxBytes: z.ZodNumber;
410
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
411
+ }, z.core.$strict>]>;
412
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
413
+ maxBytes: z.ZodNumber;
414
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
415
+ }, z.core.$strict>]>;
416
+ }, z.core.$strict>;
417
+ }, z.core.$strict>;
418
+ }, z.core.$strict>;
329
419
  }, z.core.$strip>, z.ZodObject<{
330
420
  v: z.ZodNumber;
331
421
  id: z.ZodUUID;
@@ -16,10 +16,22 @@ export declare const PairRequestSchema: z.ZodObject<{
16
16
  devicePublicKey: z.ZodString;
17
17
  }, z.core.$strip>;
18
18
  export type PairRequest = z.infer<typeof PairRequestSchema>;
19
+ /**
20
+ * The authenticated tenant projection is opaque to the wire protocol. It is
21
+ * bounded so a malformed control-plane value cannot become an unbounded local
22
+ * key prefix, while deliberately imposing no product-specific format.
23
+ *
24
+ * Keep these runtime checks aligned with `@byok-sdk/core`'s TenantId mint
25
+ * point: trimming or normalizing here would make the response disagree with
26
+ * the authenticated device row that authored it.
27
+ */
28
+ export declare const PAIR_RESPONSE_TENANT_ID_MAX_LENGTH = 200;
29
+ export declare const PairResponseTenantIdSchema: z.ZodString;
19
30
  export declare const PairResponseSchema: z.ZodObject<{
20
31
  deviceId: z.ZodString;
21
32
  accessToken: z.ZodString;
22
33
  refreshHint: z.ZodOptional<z.ZodString>;
34
+ tenantId: z.ZodString;
23
35
  }, z.core.$strip>;
24
36
  export type PairResponse = z.infer<typeof PairResponseSchema>;
25
37
  export declare const ChallengeRequestSchema: z.ZodObject<{
@@ -406,6 +418,96 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
406
418
  }, z.core.$strict>;
407
419
  }, z.core.$strict>;
408
420
  }, z.core.$strict>;
421
+ }, z.core.$strip>, z.ZodObject<{
422
+ v: z.ZodNumber;
423
+ id: z.ZodUUID;
424
+ ts: z.ZodISODateTime;
425
+ type: z.ZodLiteral<"task.offer_for_agent_with_egress_fresh">;
426
+ task_id: z.ZodString;
427
+ session_ref: z.ZodOptional<z.ZodString>;
428
+ seq: z.ZodNumber;
429
+ payload: z.ZodObject<{
430
+ instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
431
+ blobRef: z.ZodObject<{
432
+ blobId: z.ZodString;
433
+ contentHash: z.ZodString;
434
+ size: z.ZodNumber;
435
+ contentType: z.ZodString;
436
+ url: z.ZodOptional<z.ZodString>;
437
+ }, z.core.$strip>;
438
+ }, z.core.$strict>]>;
439
+ policy: z.ZodObject<{
440
+ mode: z.ZodEnum<{
441
+ auto: "auto";
442
+ confirm: "confirm";
443
+ plan: "plan";
444
+ readonly: "readonly";
445
+ }>;
446
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
447
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
448
+ workspaceRoot: z.ZodOptional<z.ZodString>;
449
+ network: z.ZodOptional<z.ZodBoolean>;
450
+ }, z.core.$strict>;
451
+ agentRef: z.ZodObject<{
452
+ agentId: z.ZodString;
453
+ profileRevision: z.ZodString;
454
+ }, z.core.$strict>;
455
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
456
+ runtime: z.ZodOptional<z.ZodEnum<{
457
+ claude: "claude";
458
+ codex: "codex";
459
+ pi: "pi";
460
+ }>>;
461
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
462
+ lane: z.ZodLiteral<"subscription">;
463
+ runtimeId: z.ZodEnum<{
464
+ claude: "claude";
465
+ codex: "codex";
466
+ }>;
467
+ providerId: z.ZodNull;
468
+ modelId: z.ZodString;
469
+ }, z.core.$strict>, z.ZodObject<{
470
+ lane: z.ZodLiteral<"byok">;
471
+ runtimeId: z.ZodLiteral<"pi">;
472
+ providerId: z.ZodString;
473
+ modelId: z.ZodString;
474
+ }, z.core.$strict>], "lane">>;
475
+ limits: z.ZodOptional<z.ZodObject<{
476
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
477
+ maxTokens: z.ZodOptional<z.ZodNumber>;
478
+ }, z.core.$strip>>;
479
+ egressPolicy: z.ZodObject<{
480
+ policyRevision: z.ZodString;
481
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
482
+ mode: z.ZodLiteral<"metadata-status">;
483
+ delivery: z.ZodLiteral<"latest-value">;
484
+ }, z.core.$strict>, z.ZodObject<{
485
+ mode: z.ZodLiteral<"contentful-trajectory">;
486
+ delivery: z.ZodLiteral<"latest-value">;
487
+ maxCoalesceMs: z.ZodNumber;
488
+ maxEventBytes: z.ZodNumber;
489
+ }, z.core.$strict>], "mode">;
490
+ reliable: z.ZodObject<{
491
+ maxPendingEventsPerAgent: z.ZodNumber;
492
+ maxPendingBytesPerAgent: z.ZodNumber;
493
+ maxPendingBytesPerTenant: z.ZodNumber;
494
+ }, z.core.$strict>;
495
+ transfers: z.ZodObject<{
496
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
497
+ maxBytes: z.ZodNumber;
498
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
499
+ }, z.core.$strict>]>;
500
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
501
+ maxBytes: z.ZodNumber;
502
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
503
+ }, z.core.$strict>]>;
504
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
505
+ maxBytes: z.ZodNumber;
506
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
507
+ }, z.core.$strict>]>;
508
+ }, z.core.$strict>;
509
+ }, z.core.$strict>;
510
+ }, z.core.$strict>;
409
511
  }, z.core.$strip>, z.ZodObject<{
410
512
  v: z.ZodNumber;
411
513
  id: z.ZodUUID;
@@ -1222,6 +1324,96 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1222
1324
  }, z.core.$strict>;
1223
1325
  }, z.core.$strict>;
1224
1326
  }, z.core.$strict>;
1327
+ }, z.core.$strip>, z.ZodObject<{
1328
+ v: z.ZodNumber;
1329
+ id: z.ZodUUID;
1330
+ ts: z.ZodISODateTime;
1331
+ type: z.ZodLiteral<"task.offer_for_agent_with_egress_fresh">;
1332
+ task_id: z.ZodString;
1333
+ session_ref: z.ZodOptional<z.ZodString>;
1334
+ seq: z.ZodNumber;
1335
+ payload: z.ZodObject<{
1336
+ instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1337
+ blobRef: z.ZodObject<{
1338
+ blobId: z.ZodString;
1339
+ contentHash: z.ZodString;
1340
+ size: z.ZodNumber;
1341
+ contentType: z.ZodString;
1342
+ url: z.ZodOptional<z.ZodString>;
1343
+ }, z.core.$strip>;
1344
+ }, z.core.$strict>]>;
1345
+ policy: z.ZodObject<{
1346
+ mode: z.ZodEnum<{
1347
+ auto: "auto";
1348
+ confirm: "confirm";
1349
+ plan: "plan";
1350
+ readonly: "readonly";
1351
+ }>;
1352
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1353
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1354
+ workspaceRoot: z.ZodOptional<z.ZodString>;
1355
+ network: z.ZodOptional<z.ZodBoolean>;
1356
+ }, z.core.$strict>;
1357
+ agentRef: z.ZodObject<{
1358
+ agentId: z.ZodString;
1359
+ profileRevision: z.ZodString;
1360
+ }, z.core.$strict>;
1361
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
1362
+ runtime: z.ZodOptional<z.ZodEnum<{
1363
+ claude: "claude";
1364
+ codex: "codex";
1365
+ pi: "pi";
1366
+ }>>;
1367
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1368
+ lane: z.ZodLiteral<"subscription">;
1369
+ runtimeId: z.ZodEnum<{
1370
+ claude: "claude";
1371
+ codex: "codex";
1372
+ }>;
1373
+ providerId: z.ZodNull;
1374
+ modelId: z.ZodString;
1375
+ }, z.core.$strict>, z.ZodObject<{
1376
+ lane: z.ZodLiteral<"byok">;
1377
+ runtimeId: z.ZodLiteral<"pi">;
1378
+ providerId: z.ZodString;
1379
+ modelId: z.ZodString;
1380
+ }, z.core.$strict>], "lane">>;
1381
+ limits: z.ZodOptional<z.ZodObject<{
1382
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
1383
+ maxTokens: z.ZodOptional<z.ZodNumber>;
1384
+ }, z.core.$strip>>;
1385
+ egressPolicy: z.ZodObject<{
1386
+ policyRevision: z.ZodString;
1387
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
1388
+ mode: z.ZodLiteral<"metadata-status">;
1389
+ delivery: z.ZodLiteral<"latest-value">;
1390
+ }, z.core.$strict>, z.ZodObject<{
1391
+ mode: z.ZodLiteral<"contentful-trajectory">;
1392
+ delivery: z.ZodLiteral<"latest-value">;
1393
+ maxCoalesceMs: z.ZodNumber;
1394
+ maxEventBytes: z.ZodNumber;
1395
+ }, z.core.$strict>], "mode">;
1396
+ reliable: z.ZodObject<{
1397
+ maxPendingEventsPerAgent: z.ZodNumber;
1398
+ maxPendingBytesPerAgent: z.ZodNumber;
1399
+ maxPendingBytesPerTenant: z.ZodNumber;
1400
+ }, z.core.$strict>;
1401
+ transfers: z.ZodObject<{
1402
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
1403
+ maxBytes: z.ZodNumber;
1404
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
1405
+ }, z.core.$strict>]>;
1406
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
1407
+ maxBytes: z.ZodNumber;
1408
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
1409
+ }, z.core.$strict>]>;
1410
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
1411
+ maxBytes: z.ZodNumber;
1412
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
1413
+ }, z.core.$strict>]>;
1414
+ }, z.core.$strict>;
1415
+ }, z.core.$strict>;
1416
+ }, z.core.$strict>;
1225
1417
  }, z.core.$strip>, z.ZodObject<{
1226
1418
  v: z.ZodNumber;
1227
1419
  id: z.ZodUUID;
package/dist/index.d.ts CHANGED
@@ -6,16 +6,16 @@ export { PermissionPolicySchema, PERMISSION_MODES } from './permission';
6
6
  export type { PermissionPolicy, PermissionMode } from './permission';
7
7
  export { AgentEventSchema, UnknownAgentEventSchema, AgentEventOrUnknownSchema, KNOWN_AGENT_EVENT_TYPES, isKnownAgentEvent, partitionAgentEvents, } from './agent-event';
8
8
  export type { AgentEvent, UnknownAgentEvent, AgentEventOrUnknown } from './agent-event';
9
- export { AgentEgressPolicySchema, AgentEgressActivityPolicySchema, AgentReliableQuotaPolicySchema, ContentReadPolicySchema, AgentEgressLaneSchema, AgentEgressDropReasonSchema, AgentContentReadSurfaceSchema, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentEgressContentHashSchema, AgentEgressPolicyRevisionSchema, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, } from './agent-egress';
9
+ export { AgentEgressPolicySchema, AgentEgressActivityPolicySchema, AgentReliableQuotaPolicySchema, ContentReadPolicySchema, AgentEgressLaneSchema, AgentEgressDropReasonSchema, AgentContentReadSurfaceSchema, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentEgressContentHashSchema, AgentEgressPolicyRevisionSchema, 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';
10
10
  export type { AgentEgressPolicy, AgentEgressActivityPolicy, AgentReliableQuotaPolicy, ContentReadPolicy, AgentEgressLane, AgentEgressDropReason, AgentContentReadSurface, AgentContentActorKind, AgentContentActor, AgentContentDecodeAs, AgentContentReadDecision, AgentContentReadDenialReason, } from './agent-egress';
11
11
  export { TASK_STATES, TASK_TRANSITIONS, canTransition } from './task-state';
12
12
  export type { TaskState } from './task-state';
13
- export { MESSAGE_TYPES, MESSAGE_PAYLOAD_SCHEMAS, SERVER_TO_DAEMON_TYPES, DAEMON_TO_SERVER_TYPES, RuntimeIdSchema, ProtocolVersionNumberSchema, RuntimeInfoSchema, RuntimeCapabilitiesSchema, AgentRefSchema, AGENT_REF_MAX_BYTES, DispatchSelectionSchema, ToolsetIdSchema, ConfiguredToolsetsSchema, RequiredToolsetsSchema, CONFIGURED_TOOLSETS_MAX_ITEMS, ConnHelloPayloadSchema, ConnAckPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, AgentEgressReliablePayloadSchema, AgentEgressAckPayloadSchema, AgentContentReadPayloadSchema, AgentContentReceiptPayloadSchema, TaskApprovePayloadSchema, TaskRejectPayloadSchema, TaskCancelPayloadSchema, TaskSteerPayloadSchema, TaskClaimPayloadSchema, TaskStartedPayloadSchema, TaskDeclinePayloadSchema, TaskProgressPayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCompletePayloadSchema, TaskFailPayloadSchema, TaskCancelledPayloadSchema, TaskApprovalResolvedPayloadSchema, RESULT_DOCUMENT_MAX_BYTES, checkResultDocument, TerminalInferenceUsageSchema, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, } from './messages';
14
- export type { ResultDocumentCheck, MessageType, RuntimeId, RuntimeInfo, RuntimeCapabilities, AgentRef, DispatchSelection, ToolsetId, ConnHelloPayload, ConnAckPayload, TaskOfferPayload, TaskOfferWithToolsetsPayload, TaskOfferForAgentPayload, TaskOfferForAgentWithEgressPayload, AgentEgressReliablePayload, AgentEgressAckPayload, AgentContentReadPayload, AgentContentReceiptPayload, TaskApprovePayload, TaskRejectPayload, TaskCancelPayload, TaskSteerPayload, TaskClaimPayload, TaskStartedPayload, TaskDeclinePayload, TaskProgressPayload, TaskArtifactPayload, TaskAwaitApprovalPayload, TaskCompletePayload, TaskFailPayload, TaskCancelledPayload, TaskApprovalResolvedPayload, TerminalInferenceUsage, } from './messages';
13
+ export { MESSAGE_TYPES, MESSAGE_PAYLOAD_SCHEMAS, SERVER_TO_DAEMON_TYPES, DAEMON_TO_SERVER_TYPES, RuntimeIdSchema, ProtocolVersionNumberSchema, RuntimeInfoSchema, RuntimeCapabilitiesSchema, AgentRefSchema, AGENT_REF_MAX_BYTES, DispatchSelectionSchema, ToolsetIdSchema, ConfiguredToolsetsSchema, RequiredToolsetsSchema, CONFIGURED_TOOLSETS_MAX_ITEMS, ConnHelloPayloadSchema, ConnAckPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, AgentEgressReliablePayloadSchema, AgentEgressAckPayloadSchema, AgentContentReadPayloadSchema, AgentContentReceiptPayloadSchema, TaskApprovePayloadSchema, TaskRejectPayloadSchema, TaskCancelPayloadSchema, TaskSteerPayloadSchema, TaskClaimPayloadSchema, TaskStartedPayloadSchema, TaskDeclinePayloadSchema, TaskProgressPayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCompletePayloadSchema, TaskFailPayloadSchema, TaskCancelledPayloadSchema, TaskApprovalResolvedPayloadSchema, RESULT_DOCUMENT_MAX_BYTES, checkResultDocument, TerminalInferenceUsageSchema, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, } from './messages';
14
+ export type { ResultDocumentCheck, MessageType, RuntimeId, RuntimeInfo, RuntimeCapabilities, AgentRef, DispatchSelection, ToolsetId, ConnHelloPayload, ConnAckPayload, TaskOfferPayload, TaskOfferWithToolsetsPayload, TaskOfferForAgentPayload, TaskOfferForAgentWithEgressPayload, TaskOfferForAgentWithEgressFreshPayload, AgentEgressReliablePayload, AgentEgressAckPayload, AgentContentReadPayload, AgentContentReceiptPayload, TaskApprovePayload, TaskRejectPayload, TaskCancelPayload, TaskSteerPayload, TaskClaimPayload, TaskStartedPayload, TaskDeclinePayload, TaskProgressPayload, TaskArtifactPayload, TaskAwaitApprovalPayload, TaskCompletePayload, TaskFailPayload, TaskCancelledPayload, TaskApprovalResolvedPayload, TerminalInferenceUsage, } from './messages';
15
15
  export { EnvelopeSchema, isServerToDaemonType } from './envelope';
16
16
  export type { Envelope } from './envelope';
17
17
  export { ProtocolError, EnvelopeParseError, UnknownMessageTypeError, EnvelopeValidationError, } from './errors';
18
18
  export { encodeEnvelope, decodeEnvelope, createEnvelope, parseMessage } from './codec';
19
19
  export type { CreateEnvelopeOptions } from './codec';
20
- export { PairRequestSchema, PairResponseSchema, ChallengeRequestSchema, ChallengeResponseSchema, TokenRequestSchema, TokenResponseSchema, PresencePublishRequestSchema, CreateBlobRequestSchema, CreateBlobResponseSchema, BlobDownloadUrlResponseSchema, EventsPollQuerySchema, EventsPollResponseSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, 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_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';
20
+ export { PairRequestSchema, PairResponseTenantIdSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PairResponseSchema, ChallengeRequestSchema, ChallengeResponseSchema, TokenRequestSchema, TokenResponseSchema, PresencePublishRequestSchema, CreateBlobRequestSchema, CreateBlobResponseSchema, BlobDownloadUrlResponseSchema, EventsPollQuerySchema, EventsPollResponseSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, 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_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';
21
21
  export type { PairRequest, PairResponse, ChallengeRequest, ChallengeResponse, TokenRequest, TokenResponse, PresencePublishRequest, CreateBlobRequest, CreateBlobResponse, BlobDownloadUrlResponse, EventsPollQuery, EventsPollResponse, MessagesSendRequest, MessagesSendResponse, } from './http-api';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  // src/agent-egress.ts
4
4
  var AGENT_EGRESS_POLICY_CAPABILITY = "agent-egress-policy";
5
5
  var AGENT_EGRESS_RELIABLE_ACK_CAPABILITY = "agent-egress-reliable-ack";
6
+ var AGENT_EGRESS_FRESH_SESSION_CAPABILITY = "agent-egress-fresh-session";
6
7
  var AGENT_CONTENT_WORKSPACE_READ_CAPABILITY = "agent-content-workspace-read";
7
8
  var AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY = "agent-content-transcript-read";
8
9
  var AGENT_CONTENT_ARTIFACT_READ_CAPABILITY = "agent-content-artifact-read";
@@ -98,6 +99,7 @@ var CAPABILITY_FLAGS = [
98
99
  "agent-home-contract",
99
100
  AGENT_EGRESS_POLICY_CAPABILITY,
100
101
  AGENT_EGRESS_RELIABLE_ACK_CAPABILITY,
102
+ AGENT_EGRESS_FRESH_SESSION_CAPABILITY,
101
103
  AGENT_CONTENT_WORKSPACE_READ_CAPABILITY,
102
104
  AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY,
103
105
  AGENT_CONTENT_ARTIFACT_READ_CAPABILITY
@@ -317,6 +319,9 @@ var TaskOfferForAgentWithEgressPayloadSchema = TaskOfferForAgentPayloadSchema.ex
317
319
  sessionRef: z.string().min(1).max(512),
318
320
  egressPolicy: AgentEgressPolicySchema
319
321
  }).strict();
322
+ var TaskOfferForAgentWithEgressFreshPayloadSchema = TaskOfferForAgentPayloadSchema.omit({
323
+ sessionRef: true
324
+ }).extend({ egressPolicy: AgentEgressPolicySchema }).strict();
320
325
  var EGRESS_SAFE_VALUE = z.json().refine(
321
326
  (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 256 * 1024,
322
327
  "sanitized egress payload exceeds 256KiB"
@@ -561,6 +566,7 @@ var MESSAGE_PAYLOAD_SCHEMAS = {
561
566
  "task.offer_with_toolsets": TaskOfferWithToolsetsPayloadSchema,
562
567
  "task.offer_for_agent": TaskOfferForAgentPayloadSchema,
563
568
  "task.offer_for_agent_with_egress": TaskOfferForAgentWithEgressPayloadSchema,
569
+ "task.offer_for_agent_with_egress_fresh": TaskOfferForAgentWithEgressFreshPayloadSchema,
564
570
  "agent.egress.reliable": AgentEgressReliablePayloadSchema,
565
571
  "agent.egress.ack": AgentEgressAckPayloadSchema,
566
572
  "agent.content.read": AgentContentReadPayloadSchema,
@@ -587,6 +593,7 @@ var SERVER_TO_DAEMON_TYPES = [
587
593
  "task.offer_with_toolsets",
588
594
  "task.offer_for_agent",
589
595
  "task.offer_for_agent_with_egress",
596
+ "task.offer_for_agent_with_egress_fresh",
590
597
  "agent.egress.ack",
591
598
  "agent.content.read",
592
599
  "task.approve",
@@ -636,6 +643,7 @@ var EnvelopeSchema = z.discriminatedUnion("type", [
636
643
  envelopeShape("task.offer_with_toolsets", REQUIRED_TASK_ID, REQUIRED_SEQ),
637
644
  envelopeShape("task.offer_for_agent", REQUIRED_TASK_ID, REQUIRED_SEQ),
638
645
  envelopeShape("task.offer_for_agent_with_egress", REQUIRED_TASK_ID, REQUIRED_SEQ),
646
+ envelopeShape("task.offer_for_agent_with_egress_fresh", REQUIRED_TASK_ID, REQUIRED_SEQ),
639
647
  envelopeShape("agent.egress.ack", OPTIONAL_TASK_ID, REQUIRED_SEQ),
640
648
  envelopeShape("agent.content.read", OPTIONAL_TASK_ID, REQUIRED_SEQ),
641
649
  envelopeShape("task.approve", REQUIRED_TASK_ID, REQUIRED_SEQ),
@@ -749,12 +757,20 @@ var PairRequestSchema = z.object({
749
757
  /** Ed25519 public key, base64url-encoded. Private key stays device-local (OS keychain or 0600 file). */
750
758
  devicePublicKey: z.string()
751
759
  });
760
+ var PAIR_RESPONSE_TENANT_ID_MAX_LENGTH = 200;
761
+ var PairResponseTenantIdSchema = z.string().min(1).max(PAIR_RESPONSE_TENANT_ID_MAX_LENGTH).refine((value) => value.trim() === value, {
762
+ message: "tenantId must not have leading or trailing whitespace"
763
+ }).refine((value) => !value.includes("\0"), {
764
+ message: "tenantId must not contain a NUL character"
765
+ });
752
766
  var PairResponseSchema = z.object({
753
767
  deviceId: z.string(),
754
768
  /** JWT, ~1h lifetime. */
755
769
  accessToken: z.string(),
756
770
  /** Opaque hint for when/how to renew (e.g. an ISO timestamp); not itself a credential. */
757
- refreshHint: z.string().optional()
771
+ refreshHint: z.string().optional(),
772
+ /** Exact opaque, non-secret tenant binding from the authenticated device row. */
773
+ tenantId: PairResponseTenantIdSchema
758
774
  });
759
775
  var ChallengeRequestSchema = z.object({
760
776
  deviceId: z.string()
@@ -863,6 +879,6 @@ function byokBlobContentPath(blobId) {
863
879
  return `/byok/blobs/${blobId}/content`;
864
880
  }
865
881
 
866
- export { AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_REF_MAX_BYTES, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BYOK_ACTIVITY_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, PERMISSION_MODES, PROTOCOL_VERSION, PairRequestSchema, PairResponseSchema, PermissionPolicySchema, PresencePublishRequestSchema, ProtocolError, ProtocolVersionNumberSchema, RESULT_DOCUMENT_MAX_BYTES, RequiredToolsetsSchema, RuntimeCapabilitiesSchema, RuntimeIdSchema, RuntimeInfoSchema, SERVER_TO_DAEMON_TYPES, 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, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalInferenceUsageSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isServerToDaemonType, parseMessage, partitionAgentEvents };
882
+ 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_REF_MAX_BYTES, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BYOK_ACTIVITY_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, 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, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalInferenceUsageSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isServerToDaemonType, parseMessage, partitionAgentEvents };
867
883
  //# sourceMappingURL=index.js.map
868
884
  //# sourceMappingURL=index.js.map