@byok-sdk/protocol 0.20.0 → 0.21.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.
@@ -36,7 +36,7 @@ import { z } from 'zod';
36
36
  * below. See `INPUT_PREPARATION_VERSION` in the client for what each version
37
37
  * changed.
38
38
  */
39
- export declare const INPUT_PREPARATION_WIRE_VERSION: 5;
39
+ export declare const INPUT_PREPARATION_WIRE_VERSION: 6;
40
40
  /**
41
41
  * Capability required before a task-free remote input preparation — or a
42
42
  * prepared Execution — is admitted: `agent-input-preparation-v<N>`, where
@@ -59,7 +59,7 @@ export declare const INPUT_PREPARATION_WIRE_VERSION: 5;
59
59
  * devices as a pair is the operator precondition for the cut (`docs/spec.md`,
60
60
  * bounded admission); nothing here parses an older receipt.
61
61
  */
62
- export declare const AGENT_INPUT_PREPARATION_CAPABILITY: "agent-input-preparation-v5";
62
+ export declare const AGENT_INPUT_PREPARATION_CAPABILITY: "agent-input-preparation-v6";
63
63
  /** The preparation surface uses the package-wide lowercase `sha256:<hex>` transport form. */
64
64
  export declare const InputPreparationContentHashSchema: z.ZodString;
65
65
  /**
@@ -272,10 +272,11 @@ export declare const RequiredToolsetsSchema: z.ZodArray<z.ZodString>;
272
272
  /**
273
273
  * Additive v1 offer variant for tasks whose semantics require local MCP
274
274
  * tools. This is a distinct message type rather than an optional field on
275
- * `task.offer`: an older v1 daemon skips an unknown message type, whereas it
276
- * would legally strip an unknown optional control field and run the task
277
- * without its required tools. The whole payload is strict because every
278
- * field here affects execution authority.
275
+ * `task.offer`, so an older daemon can never strip an unknown optional control
276
+ * field and run the task without its required tools. An unknown type is not
277
+ * silently skipped either: on long-poll it freezes the cursor, so the enqueue
278
+ * capability gate is the real compatibility boundary. The whole payload is
279
+ * strict because every field here affects execution authority.
279
280
  */
280
281
  export declare const TaskOfferWithToolsetsPayloadSchema: z.ZodObject<{
281
282
  instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -656,11 +657,10 @@ export type TaskOfferForAgentWithEgressFreshPayload = z.infer<typeof TaskOfferFo
656
657
  *
657
658
  * A DISTINCT message type, not a `preparation` field added to
658
659
  * `task.offer_for_agent`, for the same N/N-1 reason the toolset and egress
659
- * variants are distinct: an older daemon skips a message type it does not know
660
- * (`UnknownMessageTypeError`, and the long-poll transport skips that entry
661
- * whole), whereas it would legally STRIP an unknown optional field and run the
662
- * task as an ordinary instruction offer — compiling a request of its own
663
- * against tokens that were already counted for a different one.
660
+ * variants are distinct. On long-poll, both an unknown message type and an
661
+ * unknown key on a strict payload freeze the cursor. The enqueue capability
662
+ * gate is the compatibility boundary: v6 requires a drain and paired upgrade,
663
+ * with no dual token or dual read.
664
664
  *
665
665
  * It carries no `instruction`: the user request is already inside the frozen
666
666
  * envelope the referenced record retained, and an offer that carried both would
@@ -737,6 +737,46 @@ export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
737
737
  requestDigest: z.ZodString;
738
738
  artifactDigest: z.ZodOptional<z.ZodString>;
739
739
  }, z.core.$strict>;
740
+ egressPolicy: z.ZodObject<{
741
+ policyRevision: z.ZodString;
742
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
743
+ mode: z.ZodLiteral<"metadata-status">;
744
+ delivery: z.ZodLiteral<"latest-value">;
745
+ }, z.core.$strict>, z.ZodObject<{
746
+ mode: z.ZodLiteral<"contentful-trajectory">;
747
+ delivery: z.ZodLiteral<"latest-value">;
748
+ maxCoalesceMs: z.ZodNumber;
749
+ maxEventBytes: z.ZodNumber;
750
+ }, z.core.$strict>], "mode">;
751
+ reliable: z.ZodObject<{
752
+ maxPendingEventsPerAgent: z.ZodNumber;
753
+ maxPendingBytesPerAgent: z.ZodNumber;
754
+ maxPendingBytesPerTenant: z.ZodNumber;
755
+ }, z.core.$strict>;
756
+ transfers: z.ZodObject<{
757
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
758
+ maxBytes: z.ZodNumber;
759
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
760
+ }, z.core.$strict>]>;
761
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
762
+ maxBytes: z.ZodNumber;
763
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
764
+ }, z.core.$strict>]>;
765
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
766
+ maxBytes: z.ZodNumber;
767
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
768
+ }, z.core.$strict>]>;
769
+ }, z.core.$strict>;
770
+ }, z.core.$strict>;
771
+ messageEgress: z.ZodOptional<z.ZodObject<{
772
+ mode: z.ZodLiteral<"required">;
773
+ contract: z.ZodString;
774
+ contentType: z.ZodEnum<{
775
+ "text/markdown": "text/markdown";
776
+ "text/plain": "text/plain";
777
+ }>;
778
+ maxBytes: z.ZodNumber;
779
+ }, z.core.$strict>>;
740
780
  }, z.core.$strict>;
741
781
  export type TaskOfferPreparedPayload = z.infer<typeof TaskOfferPreparedPayloadSchema>;
742
782
  /** Daemon -> cloud: one durable reliable-lane item after local sanitization. */
@@ -972,11 +1012,12 @@ export type AgentHomeProjectionPayload = z.infer<typeof AgentHomeProjectionPaylo
972
1012
  * Server -> daemon: one task-free, exact-device remote input preparation.
973
1013
  *
974
1014
  * Distinct message type rather than an optional field on an existing one, for
975
- * the same N/N-1 reason `task.offer_with_toolsets` is: a daemon that predates
976
- * this contract SKIPS an unknown type outright (`parseMessage` ->
977
- * `UnknownMessageTypeError`), whereas it would legally STRIP an unknown
978
- * optional field and then answer as though a preparation it never performed
979
- * had somehow been handled.
1015
+ * the same N/N-1 reason `task.offer_with_toolsets` is: an optional field could be
1016
+ * legally STRIPPED by a daemon that predates this contract, which would then
1017
+ * answer as though a preparation it never performed had somehow been handled.
1018
+ * An unknown type (`parseMessage` -> `UnknownMessageTypeError`) is not skipped
1019
+ * cleanly either: on long-poll it freezes the cursor, so the enqueue capability
1020
+ * gate is the compatibility boundary.
980
1021
  *
981
1022
  * What is deliberately NOT here (§17 B): `tools`, `toolExecutors`, runtime or
982
1023
  * compiler identity, `tenantId` and `deviceId`. The first three are local
@@ -2206,6 +2247,46 @@ declare const TASK_OFFER_PAYLOAD_SCHEMAS: {
2206
2247
  requestDigest: z.ZodString;
2207
2248
  artifactDigest: z.ZodOptional<z.ZodString>;
2208
2249
  }, z.core.$strict>;
2250
+ egressPolicy: z.ZodObject<{
2251
+ policyRevision: z.ZodString;
2252
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
2253
+ mode: z.ZodLiteral<"metadata-status">;
2254
+ delivery: z.ZodLiteral<"latest-value">;
2255
+ }, z.core.$strict>, z.ZodObject<{
2256
+ mode: z.ZodLiteral<"contentful-trajectory">;
2257
+ delivery: z.ZodLiteral<"latest-value">;
2258
+ maxCoalesceMs: z.ZodNumber;
2259
+ maxEventBytes: z.ZodNumber;
2260
+ }, z.core.$strict>], "mode">;
2261
+ reliable: z.ZodObject<{
2262
+ maxPendingEventsPerAgent: z.ZodNumber;
2263
+ maxPendingBytesPerAgent: z.ZodNumber;
2264
+ maxPendingBytesPerTenant: z.ZodNumber;
2265
+ }, z.core.$strict>;
2266
+ transfers: z.ZodObject<{
2267
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2268
+ maxBytes: z.ZodNumber;
2269
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2270
+ }, z.core.$strict>]>;
2271
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2272
+ maxBytes: z.ZodNumber;
2273
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2274
+ }, z.core.$strict>]>;
2275
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2276
+ maxBytes: z.ZodNumber;
2277
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2278
+ }, z.core.$strict>]>;
2279
+ }, z.core.$strict>;
2280
+ }, z.core.$strict>;
2281
+ messageEgress: z.ZodOptional<z.ZodObject<{
2282
+ mode: z.ZodLiteral<"required">;
2283
+ contract: z.ZodString;
2284
+ contentType: z.ZodEnum<{
2285
+ "text/markdown": "text/markdown";
2286
+ "text/plain": "text/plain";
2287
+ }>;
2288
+ maxBytes: z.ZodNumber;
2289
+ }, z.core.$strict>>;
2209
2290
  }, z.core.$strict>;
2210
2291
  };
2211
2292
  export type TaskOfferType = keyof typeof TASK_OFFER_PAYLOAD_SCHEMAS;
@@ -2693,6 +2774,46 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2693
2774
  requestDigest: z.ZodString;
2694
2775
  artifactDigest: z.ZodOptional<z.ZodString>;
2695
2776
  }, z.core.$strict>;
2777
+ egressPolicy: z.ZodObject<{
2778
+ policyRevision: z.ZodString;
2779
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
2780
+ mode: z.ZodLiteral<"metadata-status">;
2781
+ delivery: z.ZodLiteral<"latest-value">;
2782
+ }, z.core.$strict>, z.ZodObject<{
2783
+ mode: z.ZodLiteral<"contentful-trajectory">;
2784
+ delivery: z.ZodLiteral<"latest-value">;
2785
+ maxCoalesceMs: z.ZodNumber;
2786
+ maxEventBytes: z.ZodNumber;
2787
+ }, z.core.$strict>], "mode">;
2788
+ reliable: z.ZodObject<{
2789
+ maxPendingEventsPerAgent: z.ZodNumber;
2790
+ maxPendingBytesPerAgent: z.ZodNumber;
2791
+ maxPendingBytesPerTenant: z.ZodNumber;
2792
+ }, z.core.$strict>;
2793
+ transfers: z.ZodObject<{
2794
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2795
+ maxBytes: z.ZodNumber;
2796
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2797
+ }, z.core.$strict>]>;
2798
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2799
+ maxBytes: z.ZodNumber;
2800
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2801
+ }, z.core.$strict>]>;
2802
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2803
+ maxBytes: z.ZodNumber;
2804
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
2805
+ }, z.core.$strict>]>;
2806
+ }, z.core.$strict>;
2807
+ }, z.core.$strict>;
2808
+ messageEgress: z.ZodOptional<z.ZodObject<{
2809
+ mode: z.ZodLiteral<"required">;
2810
+ contract: z.ZodString;
2811
+ contentType: z.ZodEnum<{
2812
+ "text/markdown": "text/markdown";
2813
+ "text/plain": "text/plain";
2814
+ }>;
2815
+ maxBytes: z.ZodNumber;
2816
+ }, z.core.$strict>>;
2696
2817
  }, z.core.$strict>;
2697
2818
  readonly 'conn.hello': z.ZodObject<{
2698
2819
  protocolVersions: z.ZodArray<z.ZodNumber>;
package/dist/version.d.ts CHANGED
@@ -107,5 +107,5 @@ export declare const STRICT_AGENT_ONLY_CAPABILITY: 'strict-agent-only';
107
107
  * cannot accidentally execute the instruction without the required tools.
108
108
  */
109
109
  export declare const CUSTOM_HARNESS_CAPABILITY: 'custom-harness';
110
- export declare const CAPABILITY_FLAGS: readonly ['steer', 'blob-upload', 'interactive-approval', 'approval_resolved', 'approval-targeting', 'result-document', 'dispatch-selection', "provider-profile-binding", 'toolset-selection', 'agent-home-contract', "strict-agent-only", "agent-egress-policy", "agent-egress-reliable-ack", "agent-message-egress", "agent-egress-fresh-session", "agent-content-workspace-read", "agent-content-transcript-read", "agent-content-artifact-read", "agent-home-projection", "agent-input-preparation-v5", "terminal-projection-selection", "host-mcp-task-context", "custom-harness", "mailbox-read-ahead"];
110
+ export declare const CAPABILITY_FLAGS: readonly ['steer', 'blob-upload', 'interactive-approval', 'approval_resolved', 'approval-targeting', 'result-document', 'dispatch-selection', "provider-profile-binding", 'toolset-selection', 'agent-home-contract', "strict-agent-only", "agent-egress-policy", "agent-egress-reliable-ack", "agent-message-egress", "agent-egress-fresh-session", "agent-content-workspace-read", "agent-content-transcript-read", "agent-content-artifact-read", "agent-home-projection", "agent-input-preparation-v6", "terminal-projection-selection", "host-mcp-task-context", "custom-harness", "mailbox-read-ahead"];
111
111
  export type CapabilityFlag = (typeof CAPABILITY_FLAGS)[number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/protocol",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "BYOK SDK wire protocol: envelope schema, message types, and codec helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",