@byok-sdk/protocol 0.18.0 → 0.20.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.
@@ -651,6 +651,94 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
651
651
  }, z.core.$strict>>;
652
652
  }, z.core.$strict>;
653
653
  export type TaskOfferForAgentWithEgressFreshPayload = z.infer<typeof TaskOfferForAgentWithEgressFreshPayloadSchema>;
654
+ /**
655
+ * Strict offer for an already-counted prepared Execution.
656
+ *
657
+ * A DISTINCT message type, not a `preparation` field added to
658
+ * `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.
664
+ *
665
+ * It carries no `instruction`: the user request is already inside the frozen
666
+ * envelope the referenced record retained, and an offer that carried both would
667
+ * have two answers to what the runtime is about to send. `sessionRef` is absent
668
+ * for the same structural reason the adapter refuses the pair — a prepared
669
+ * Execution never resumes.
670
+ *
671
+ * Every value under `preparation` is the Host RE-PRESENTING what the device
672
+ * already told it. The device compares each one against its own durable record
673
+ * and declines non-retryably on any difference; nothing here is authority.
674
+ */
675
+ export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
676
+ policy: z.ZodObject<{
677
+ mode: z.ZodEnum<{
678
+ auto: "auto";
679
+ confirm: "confirm";
680
+ plan: "plan";
681
+ readonly: "readonly";
682
+ }>;
683
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
684
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
685
+ workspaceRoot: z.ZodOptional<z.ZodString>;
686
+ network: z.ZodOptional<z.ZodBoolean>;
687
+ }, z.core.$strict>;
688
+ agentRef: z.ZodObject<{
689
+ agentId: z.ZodString;
690
+ profileRevision: z.ZodString;
691
+ }, z.core.$strict>;
692
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
693
+ runtime: z.ZodOptional<z.ZodEnum<{
694
+ claude: "claude";
695
+ codex: "codex";
696
+ pi: "pi";
697
+ }>>;
698
+ harnessId: z.ZodOptional<z.ZodString>;
699
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
700
+ lane: z.ZodLiteral<"subscription">;
701
+ runtimeId: z.ZodEnum<{
702
+ claude: "claude";
703
+ codex: "codex";
704
+ }>;
705
+ providerId: z.ZodNull;
706
+ modelId: z.ZodString;
707
+ }, z.core.$strict>, z.ZodObject<{
708
+ lane: z.ZodLiteral<"byok">;
709
+ runtimeId: z.ZodLiteral<"pi">;
710
+ providerId: z.ZodString;
711
+ modelId: z.ZodString;
712
+ }, z.core.$strict>, z.ZodObject<{
713
+ lane: z.ZodLiteral<"byok-profile">;
714
+ runtimeId: z.ZodLiteral<"pi">;
715
+ providerProfile: z.ZodObject<{
716
+ profileRef: z.ZodString;
717
+ profileRevision: z.ZodString;
718
+ profileHash: z.ZodString;
719
+ modelId: z.ZodString;
720
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
721
+ "image-input": "image-input";
722
+ }>>;
723
+ }, z.core.$strict>;
724
+ }, z.core.$strict>], "lane">>;
725
+ terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
726
+ mode: z.ZodLiteral<"none">;
727
+ }, z.core.$strict>, z.ZodObject<{
728
+ mode: z.ZodLiteral<"result-document">;
729
+ contract: z.ZodString;
730
+ }, z.core.$strict>], "mode">>;
731
+ limits: z.ZodOptional<z.ZodObject<{
732
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
733
+ maxTokens: z.ZodOptional<z.ZodNumber>;
734
+ }, z.core.$strip>>;
735
+ preparation: z.ZodObject<{
736
+ reference: z.ZodString;
737
+ requestDigest: z.ZodString;
738
+ artifactDigest: z.ZodOptional<z.ZodString>;
739
+ }, z.core.$strict>;
740
+ }, z.core.$strict>;
741
+ export type TaskOfferPreparedPayload = z.infer<typeof TaskOfferPreparedPayloadSchema>;
654
742
  /** Daemon -> cloud: one durable reliable-lane item after local sanitization. */
655
743
  export declare const AgentEgressReliablePayloadSchema: z.ZodObject<{
656
744
  agentRef: z.ZodObject<{
@@ -880,6 +968,153 @@ export declare const AgentHomeProjectionPayloadSchema: z.ZodObject<{
880
968
  projection: z.ZodType<import("./agent-home-projection").AgentHomeProjectionValue, unknown, z.core.$ZodTypeInternals<import("./agent-home-projection").AgentHomeProjectionValue, unknown>>;
881
969
  }, z.core.$strict>;
882
970
  export type AgentHomeProjectionPayload = z.infer<typeof AgentHomeProjectionPayloadSchema>;
971
+ /**
972
+ * Server -> daemon: one task-free, exact-device remote input preparation.
973
+ *
974
+ * 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.
980
+ *
981
+ * What is deliberately NOT here (§17 B): `tools`, `toolExecutors`, runtime or
982
+ * compiler identity, `tenantId` and `deviceId`. The first three are local
983
+ * observations; the last two come from the device's own authenticated record,
984
+ * never from the payload — a sender that could name them could redirect a
985
+ * preparation's binding to a device it does not own.
986
+ *
987
+ * `deadlineAt` may only ever be TIGHTENED locally: the device clamps to
988
+ * `min(deadlineAt - now, limits.preparationDeadlineMs)`, so a generous Host
989
+ * deadline cannot enlarge a configured local bound.
990
+ *
991
+ * `permissionMode` is DECLARED by the requester and validated by the device;
992
+ * the device never infers it. A preparation counts tokens for one concrete
993
+ * tool manifest, and that manifest is the policy-filtered set for exactly one
994
+ * mode (`mcp/projection.ts`'s `filterMcpObservationForPolicy`) — so a
995
+ * preparation whose mode is unstated is a count of a manifest nobody named.
996
+ * The device applies the declared mode to its own observation and records it
997
+ * in the artifact binding; it is not a grant, and it authorizes nothing.
998
+ */
999
+ export declare const AgentInputPreparationPayloadSchema: z.ZodObject<{
1000
+ requestId: z.ZodUUID;
1001
+ agentRef: z.ZodObject<{
1002
+ agentId: z.ZodString;
1003
+ profileRevision: z.ZodString;
1004
+ }, z.core.$strict>;
1005
+ profileId: z.ZodString;
1006
+ policyRevision: z.ZodString;
1007
+ source: z.ZodObject<{
1008
+ revision: z.ZodString;
1009
+ digest: z.ZodString;
1010
+ }, z.core.$strict>;
1011
+ selection: z.ZodObject<{
1012
+ model: z.ZodObject<{
1013
+ id: z.ZodString;
1014
+ name: z.ZodString;
1015
+ api: z.ZodLiteral<"openai-completions">;
1016
+ provider: z.ZodString;
1017
+ baseUrl: z.ZodString;
1018
+ reasoning: z.ZodBoolean;
1019
+ input: z.ZodArray<z.ZodEnum<{
1020
+ image: "image";
1021
+ text: "text";
1022
+ }>>;
1023
+ cost: z.ZodObject<{
1024
+ input: z.ZodNumber;
1025
+ output: z.ZodNumber;
1026
+ cacheRead: z.ZodNumber;
1027
+ cacheWrite: z.ZodNumber;
1028
+ }, z.core.$strict>;
1029
+ contextWindow: z.ZodNumber;
1030
+ maxTokens: z.ZodNumber;
1031
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
1032
+ off: z.ZodNullable<z.ZodString>;
1033
+ minimal: z.ZodNullable<z.ZodString>;
1034
+ low: z.ZodNullable<z.ZodString>;
1035
+ medium: z.ZodNullable<z.ZodString>;
1036
+ high: z.ZodNullable<z.ZodString>;
1037
+ xhigh: z.ZodNullable<z.ZodString>;
1038
+ max: z.ZodNullable<z.ZodString>;
1039
+ }, z.core.$strict>>;
1040
+ compat: z.ZodOptional<z.ZodObject<{
1041
+ supportsStore: z.ZodOptional<z.ZodBoolean>;
1042
+ supportsDeveloperRole: z.ZodOptional<z.ZodBoolean>;
1043
+ supportsReasoningEffort: z.ZodOptional<z.ZodBoolean>;
1044
+ supportsUsageInStreaming: z.ZodOptional<z.ZodBoolean>;
1045
+ maxTokensField: z.ZodOptional<z.ZodEnum<{
1046
+ max_completion_tokens: "max_completion_tokens";
1047
+ max_tokens: "max_tokens";
1048
+ }>>;
1049
+ thinkingFormat: z.ZodOptional<z.ZodEnum<{
1050
+ "ant-ling": "ant-ling";
1051
+ baseten: "baseten";
1052
+ "chat-template": "chat-template";
1053
+ deepseek: "deepseek";
1054
+ openai: "openai";
1055
+ openrouter: "openrouter";
1056
+ qwen: "qwen";
1057
+ "qwen-chat-template": "qwen-chat-template";
1058
+ "string-thinking": "string-thinking";
1059
+ together: "together";
1060
+ zai: "zai";
1061
+ }>>;
1062
+ zaiToolStream: z.ZodOptional<z.ZodBoolean>;
1063
+ }, z.core.$strict>>;
1064
+ }, z.core.$strict>;
1065
+ options: z.ZodObject<{
1066
+ cacheRetention: z.ZodEnum<{
1067
+ long: "long";
1068
+ none: "none";
1069
+ short: "short";
1070
+ }>;
1071
+ maxTokens: z.ZodNumber;
1072
+ temperature: z.ZodOptional<z.ZodNumber>;
1073
+ toolChoice: z.ZodOptional<z.ZodEnum<{
1074
+ auto: "auto";
1075
+ none: "none";
1076
+ }>>;
1077
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
1078
+ high: "high";
1079
+ low: "low";
1080
+ max: "max";
1081
+ medium: "medium";
1082
+ minimal: "minimal";
1083
+ xhigh: "xhigh";
1084
+ }>>;
1085
+ }, z.core.$strict>;
1086
+ }, z.core.$strict>;
1087
+ deadlineAt: z.ZodISODateTime;
1088
+ context: z.ZodUnion<readonly [z.ZodObject<{
1089
+ inline: z.ZodString;
1090
+ }, z.core.$strict>, z.ZodObject<{
1091
+ blobRef: z.ZodObject<{
1092
+ blobId: z.ZodString;
1093
+ contentHash: z.ZodString;
1094
+ size: z.ZodNumber;
1095
+ contentType: z.ZodString;
1096
+ url: z.ZodOptional<z.ZodString>;
1097
+ }, z.core.$strip>;
1098
+ contentHash: z.ZodString;
1099
+ }, z.core.$strict>]>;
1100
+ requiredToolsets: z.ZodArray<z.ZodString>;
1101
+ permissionMode: z.ZodEnum<{
1102
+ auto: "auto";
1103
+ confirm: "confirm";
1104
+ plan: "plan";
1105
+ readonly: "readonly";
1106
+ }>;
1107
+ accountingPolicyRef: z.ZodOptional<z.ZodObject<{
1108
+ revision: z.ZodString;
1109
+ ruledRuntime: z.ZodString;
1110
+ ruledTarget: z.ZodObject<{
1111
+ endpoint: z.ZodString;
1112
+ modelId: z.ZodString;
1113
+ }, z.core.$strict>;
1114
+ ruledResidualKeys: z.ZodArray<z.ZodString>;
1115
+ }, z.core.$strict>>;
1116
+ }, z.core.$strict>;
1117
+ export type AgentInputPreparationPayload = z.infer<typeof AgentInputPreparationPayloadSchema>;
883
1118
  /**
884
1119
  * server -> daemon: approve a pending `task.await_approval` request.
885
1120
  *
@@ -1274,6 +1509,34 @@ export declare const TerminalInferenceUsageSchema: z.ZodObject<{
1274
1509
  reportedAt: z.ZodISODateTime;
1275
1510
  }, z.core.$strip>;
1276
1511
  export type TerminalInferenceUsage = z.infer<typeof TerminalInferenceUsageSchema>;
1512
+ /**
1513
+ * The prepared-only terminal observation: what the runtime reported about the
1514
+ * provider calls of ONE prepared Execution, bound to the frozen request it
1515
+ * launched.
1516
+ *
1517
+ * - `requestDigest` — the frozen artifact's own request digest
1518
+ * (`InputPreparationArtifactSummarySchema.requestDigest`), so the Host
1519
+ * compares these numbers against exactly the D whose `requestBytes` it
1520
+ * ruled on.
1521
+ * - `initialPromptTokens` — the prompt tokens of the FIRST provider call. It
1522
+ * is the only call whose request is D; every later call is an ordinary tool
1523
+ * continuation. Prompt tokens are the provider's whole prompt, cache reads
1524
+ * and writes included.
1525
+ * - `maxPromptTokens` — the largest prompt of any provider call of the
1526
+ * Execution, so `maxPromptTokens >= initialPromptTokens`.
1527
+ *
1528
+ * A separate field, deliberately NOT {@link TerminalInferenceUsageSchema}:
1529
+ * that one is telemetry and never task-state authority, while this one is the
1530
+ * evidence a Host checks its own budget ruling against. The device performs no
1531
+ * budget arithmetic over it. Strict, like every other control shape: an
1532
+ * unrecognized field is rejected, not stripped.
1533
+ */
1534
+ export declare const TerminalPreparedObservationSchema: z.ZodObject<{
1535
+ requestDigest: z.ZodString;
1536
+ initialPromptTokens: z.ZodNumber;
1537
+ maxPromptTokens: z.ZodNumber;
1538
+ }, z.core.$strict>;
1539
+ export type TerminalPreparedObservation = z.infer<typeof TerminalPreparedObservationSchema>;
1277
1540
  /**
1278
1541
  * daemon -> server: task finished successfully.
1279
1542
  *
@@ -1326,6 +1589,11 @@ export declare const TaskCompletePayloadSchema: z.ZodObject<{
1326
1589
  clientVersion: z.ZodString;
1327
1590
  reportedAt: z.ZodISODateTime;
1328
1591
  }, z.core.$strip>>;
1592
+ preparedObservation: z.ZodOptional<z.ZodObject<{
1593
+ requestDigest: z.ZodString;
1594
+ initialPromptTokens: z.ZodNumber;
1595
+ maxPromptTokens: z.ZodNumber;
1596
+ }, z.core.$strict>>;
1329
1597
  agentRef: z.ZodOptional<z.ZodObject<{
1330
1598
  agentId: z.ZodString;
1331
1599
  profileRevision: z.ZodString;
@@ -1355,6 +1623,11 @@ export declare const TaskFailPayloadSchema: z.ZodObject<{
1355
1623
  clientVersion: z.ZodString;
1356
1624
  reportedAt: z.ZodISODateTime;
1357
1625
  }, z.core.$strip>>;
1626
+ preparedObservation: z.ZodOptional<z.ZodObject<{
1627
+ requestDigest: z.ZodString;
1628
+ initialPromptTokens: z.ZodNumber;
1629
+ maxPromptTokens: z.ZodNumber;
1630
+ }, z.core.$strict>>;
1358
1631
  agentRef: z.ZodOptional<z.ZodObject<{
1359
1632
  agentId: z.ZodString;
1360
1633
  profileRevision: z.ZodString;
@@ -1868,6 +2141,72 @@ declare const TASK_OFFER_PAYLOAD_SCHEMAS: {
1868
2141
  maxBytes: z.ZodNumber;
1869
2142
  }, z.core.$strict>>;
1870
2143
  }, z.core.$strict>;
2144
+ readonly 'task.offer_prepared': z.ZodObject<{
2145
+ policy: z.ZodObject<{
2146
+ mode: z.ZodEnum<{
2147
+ auto: "auto";
2148
+ confirm: "confirm";
2149
+ plan: "plan";
2150
+ readonly: "readonly";
2151
+ }>;
2152
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2153
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2154
+ workspaceRoot: z.ZodOptional<z.ZodString>;
2155
+ network: z.ZodOptional<z.ZodBoolean>;
2156
+ }, z.core.$strict>;
2157
+ agentRef: z.ZodObject<{
2158
+ agentId: z.ZodString;
2159
+ profileRevision: z.ZodString;
2160
+ }, z.core.$strict>;
2161
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
2162
+ runtime: z.ZodOptional<z.ZodEnum<{
2163
+ claude: "claude";
2164
+ codex: "codex";
2165
+ pi: "pi";
2166
+ }>>;
2167
+ harnessId: z.ZodOptional<z.ZodString>;
2168
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2169
+ lane: z.ZodLiteral<"subscription">;
2170
+ runtimeId: z.ZodEnum<{
2171
+ claude: "claude";
2172
+ codex: "codex";
2173
+ }>;
2174
+ providerId: z.ZodNull;
2175
+ modelId: z.ZodString;
2176
+ }, z.core.$strict>, z.ZodObject<{
2177
+ lane: z.ZodLiteral<"byok">;
2178
+ runtimeId: z.ZodLiteral<"pi">;
2179
+ providerId: z.ZodString;
2180
+ modelId: z.ZodString;
2181
+ }, z.core.$strict>, z.ZodObject<{
2182
+ lane: z.ZodLiteral<"byok-profile">;
2183
+ runtimeId: z.ZodLiteral<"pi">;
2184
+ providerProfile: z.ZodObject<{
2185
+ profileRef: z.ZodString;
2186
+ profileRevision: z.ZodString;
2187
+ profileHash: z.ZodString;
2188
+ modelId: z.ZodString;
2189
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
2190
+ "image-input": "image-input";
2191
+ }>>;
2192
+ }, z.core.$strict>;
2193
+ }, z.core.$strict>], "lane">>;
2194
+ terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2195
+ mode: z.ZodLiteral<"none">;
2196
+ }, z.core.$strict>, z.ZodObject<{
2197
+ mode: z.ZodLiteral<"result-document">;
2198
+ contract: z.ZodString;
2199
+ }, z.core.$strict>], "mode">>;
2200
+ limits: z.ZodOptional<z.ZodObject<{
2201
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
2202
+ maxTokens: z.ZodOptional<z.ZodNumber>;
2203
+ }, z.core.$strip>>;
2204
+ preparation: z.ZodObject<{
2205
+ reference: z.ZodString;
2206
+ requestDigest: z.ZodString;
2207
+ artifactDigest: z.ZodOptional<z.ZodString>;
2208
+ }, z.core.$strict>;
2209
+ }, z.core.$strict>;
1871
2210
  };
1872
2211
  export type TaskOfferType = keyof typeof TASK_OFFER_PAYLOAD_SCHEMAS;
1873
2212
  export declare const TASK_OFFER_TYPES: readonly TaskOfferType[];
@@ -2289,6 +2628,72 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2289
2628
  maxBytes: z.ZodNumber;
2290
2629
  }, z.core.$strict>>;
2291
2630
  }, z.core.$strict>;
2631
+ readonly 'task.offer_prepared': z.ZodObject<{
2632
+ policy: z.ZodObject<{
2633
+ mode: z.ZodEnum<{
2634
+ auto: "auto";
2635
+ confirm: "confirm";
2636
+ plan: "plan";
2637
+ readonly: "readonly";
2638
+ }>;
2639
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2640
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2641
+ workspaceRoot: z.ZodOptional<z.ZodString>;
2642
+ network: z.ZodOptional<z.ZodBoolean>;
2643
+ }, z.core.$strict>;
2644
+ agentRef: z.ZodObject<{
2645
+ agentId: z.ZodString;
2646
+ profileRevision: z.ZodString;
2647
+ }, z.core.$strict>;
2648
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
2649
+ runtime: z.ZodOptional<z.ZodEnum<{
2650
+ claude: "claude";
2651
+ codex: "codex";
2652
+ pi: "pi";
2653
+ }>>;
2654
+ harnessId: z.ZodOptional<z.ZodString>;
2655
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2656
+ lane: z.ZodLiteral<"subscription">;
2657
+ runtimeId: z.ZodEnum<{
2658
+ claude: "claude";
2659
+ codex: "codex";
2660
+ }>;
2661
+ providerId: z.ZodNull;
2662
+ modelId: z.ZodString;
2663
+ }, z.core.$strict>, z.ZodObject<{
2664
+ lane: z.ZodLiteral<"byok">;
2665
+ runtimeId: z.ZodLiteral<"pi">;
2666
+ providerId: z.ZodString;
2667
+ modelId: z.ZodString;
2668
+ }, z.core.$strict>, z.ZodObject<{
2669
+ lane: z.ZodLiteral<"byok-profile">;
2670
+ runtimeId: z.ZodLiteral<"pi">;
2671
+ providerProfile: z.ZodObject<{
2672
+ profileRef: z.ZodString;
2673
+ profileRevision: z.ZodString;
2674
+ profileHash: z.ZodString;
2675
+ modelId: z.ZodString;
2676
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
2677
+ "image-input": "image-input";
2678
+ }>>;
2679
+ }, z.core.$strict>;
2680
+ }, z.core.$strict>], "lane">>;
2681
+ terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2682
+ mode: z.ZodLiteral<"none">;
2683
+ }, z.core.$strict>, z.ZodObject<{
2684
+ mode: z.ZodLiteral<"result-document">;
2685
+ contract: z.ZodString;
2686
+ }, z.core.$strict>], "mode">>;
2687
+ limits: z.ZodOptional<z.ZodObject<{
2688
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
2689
+ maxTokens: z.ZodOptional<z.ZodNumber>;
2690
+ }, z.core.$strip>>;
2691
+ preparation: z.ZodObject<{
2692
+ reference: z.ZodString;
2693
+ requestDigest: z.ZodString;
2694
+ artifactDigest: z.ZodOptional<z.ZodString>;
2695
+ }, z.core.$strict>;
2696
+ }, z.core.$strict>;
2292
2697
  readonly 'conn.hello': z.ZodObject<{
2293
2698
  protocolVersions: z.ZodArray<z.ZodNumber>;
2294
2699
  capabilities: z.ZodArray<z.ZodString>;
@@ -2540,6 +2945,124 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2540
2945
  projectionHash: z.ZodString;
2541
2946
  projection: z.ZodType<import("./agent-home-projection").AgentHomeProjectionValue, unknown, z.core.$ZodTypeInternals<import("./agent-home-projection").AgentHomeProjectionValue, unknown>>;
2542
2947
  }, z.core.$strict>;
2948
+ readonly 'agent.input.preparation': z.ZodObject<{
2949
+ requestId: z.ZodUUID;
2950
+ agentRef: z.ZodObject<{
2951
+ agentId: z.ZodString;
2952
+ profileRevision: z.ZodString;
2953
+ }, z.core.$strict>;
2954
+ profileId: z.ZodString;
2955
+ policyRevision: z.ZodString;
2956
+ source: z.ZodObject<{
2957
+ revision: z.ZodString;
2958
+ digest: z.ZodString;
2959
+ }, z.core.$strict>;
2960
+ selection: z.ZodObject<{
2961
+ model: z.ZodObject<{
2962
+ id: z.ZodString;
2963
+ name: z.ZodString;
2964
+ api: z.ZodLiteral<"openai-completions">;
2965
+ provider: z.ZodString;
2966
+ baseUrl: z.ZodString;
2967
+ reasoning: z.ZodBoolean;
2968
+ input: z.ZodArray<z.ZodEnum<{
2969
+ image: "image";
2970
+ text: "text";
2971
+ }>>;
2972
+ cost: z.ZodObject<{
2973
+ input: z.ZodNumber;
2974
+ output: z.ZodNumber;
2975
+ cacheRead: z.ZodNumber;
2976
+ cacheWrite: z.ZodNumber;
2977
+ }, z.core.$strict>;
2978
+ contextWindow: z.ZodNumber;
2979
+ maxTokens: z.ZodNumber;
2980
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
2981
+ off: z.ZodNullable<z.ZodString>;
2982
+ minimal: z.ZodNullable<z.ZodString>;
2983
+ low: z.ZodNullable<z.ZodString>;
2984
+ medium: z.ZodNullable<z.ZodString>;
2985
+ high: z.ZodNullable<z.ZodString>;
2986
+ xhigh: z.ZodNullable<z.ZodString>;
2987
+ max: z.ZodNullable<z.ZodString>;
2988
+ }, z.core.$strict>>;
2989
+ compat: z.ZodOptional<z.ZodObject<{
2990
+ supportsStore: z.ZodOptional<z.ZodBoolean>;
2991
+ supportsDeveloperRole: z.ZodOptional<z.ZodBoolean>;
2992
+ supportsReasoningEffort: z.ZodOptional<z.ZodBoolean>;
2993
+ supportsUsageInStreaming: z.ZodOptional<z.ZodBoolean>;
2994
+ maxTokensField: z.ZodOptional<z.ZodEnum<{
2995
+ max_completion_tokens: "max_completion_tokens";
2996
+ max_tokens: "max_tokens";
2997
+ }>>;
2998
+ thinkingFormat: z.ZodOptional<z.ZodEnum<{
2999
+ "ant-ling": "ant-ling";
3000
+ baseten: "baseten";
3001
+ "chat-template": "chat-template";
3002
+ deepseek: "deepseek";
3003
+ openai: "openai";
3004
+ openrouter: "openrouter";
3005
+ qwen: "qwen";
3006
+ "qwen-chat-template": "qwen-chat-template";
3007
+ "string-thinking": "string-thinking";
3008
+ together: "together";
3009
+ zai: "zai";
3010
+ }>>;
3011
+ zaiToolStream: z.ZodOptional<z.ZodBoolean>;
3012
+ }, z.core.$strict>>;
3013
+ }, z.core.$strict>;
3014
+ options: z.ZodObject<{
3015
+ cacheRetention: z.ZodEnum<{
3016
+ long: "long";
3017
+ none: "none";
3018
+ short: "short";
3019
+ }>;
3020
+ maxTokens: z.ZodNumber;
3021
+ temperature: z.ZodOptional<z.ZodNumber>;
3022
+ toolChoice: z.ZodOptional<z.ZodEnum<{
3023
+ auto: "auto";
3024
+ none: "none";
3025
+ }>>;
3026
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
3027
+ high: "high";
3028
+ low: "low";
3029
+ max: "max";
3030
+ medium: "medium";
3031
+ minimal: "minimal";
3032
+ xhigh: "xhigh";
3033
+ }>>;
3034
+ }, z.core.$strict>;
3035
+ }, z.core.$strict>;
3036
+ deadlineAt: z.ZodISODateTime;
3037
+ context: z.ZodUnion<readonly [z.ZodObject<{
3038
+ inline: z.ZodString;
3039
+ }, z.core.$strict>, z.ZodObject<{
3040
+ blobRef: z.ZodObject<{
3041
+ blobId: z.ZodString;
3042
+ contentHash: z.ZodString;
3043
+ size: z.ZodNumber;
3044
+ contentType: z.ZodString;
3045
+ url: z.ZodOptional<z.ZodString>;
3046
+ }, z.core.$strip>;
3047
+ contentHash: z.ZodString;
3048
+ }, z.core.$strict>]>;
3049
+ requiredToolsets: z.ZodArray<z.ZodString>;
3050
+ permissionMode: z.ZodEnum<{
3051
+ auto: "auto";
3052
+ confirm: "confirm";
3053
+ plan: "plan";
3054
+ readonly: "readonly";
3055
+ }>;
3056
+ accountingPolicyRef: z.ZodOptional<z.ZodObject<{
3057
+ revision: z.ZodString;
3058
+ ruledRuntime: z.ZodString;
3059
+ ruledTarget: z.ZodObject<{
3060
+ endpoint: z.ZodString;
3061
+ modelId: z.ZodString;
3062
+ }, z.core.$strict>;
3063
+ ruledResidualKeys: z.ZodArray<z.ZodString>;
3064
+ }, z.core.$strict>>;
3065
+ }, z.core.$strict>;
2543
3066
  readonly 'task.approve': z.ZodObject<{
2544
3067
  approvalId: z.ZodOptional<z.ZodString>;
2545
3068
  }, z.core.$strip>;
@@ -2698,6 +3221,11 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2698
3221
  clientVersion: z.ZodString;
2699
3222
  reportedAt: z.ZodISODateTime;
2700
3223
  }, z.core.$strip>>;
3224
+ preparedObservation: z.ZodOptional<z.ZodObject<{
3225
+ requestDigest: z.ZodString;
3226
+ initialPromptTokens: z.ZodNumber;
3227
+ maxPromptTokens: z.ZodNumber;
3228
+ }, z.core.$strict>>;
2701
3229
  agentRef: z.ZodOptional<z.ZodObject<{
2702
3230
  agentId: z.ZodString;
2703
3231
  profileRevision: z.ZodString;
@@ -2725,6 +3253,11 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2725
3253
  clientVersion: z.ZodString;
2726
3254
  reportedAt: z.ZodISODateTime;
2727
3255
  }, z.core.$strip>>;
3256
+ preparedObservation: z.ZodOptional<z.ZodObject<{
3257
+ requestDigest: z.ZodString;
3258
+ initialPromptTokens: z.ZodNumber;
3259
+ maxPromptTokens: z.ZodNumber;
3260
+ }, z.core.$strict>>;
2728
3261
  agentRef: z.ZodOptional<z.ZodObject<{
2729
3262
  agentId: z.ZodString;
2730
3263
  profileRevision: z.ZodString;
@@ -2771,7 +3304,7 @@ export declare const MESSAGE_TYPES: MessageType[];
2771
3304
  * (`envelope.ts`) to decide which branches require envelope `seq` (M1
2772
3305
  * redelivery cursor).
2773
3306
  */
2774
- export declare const SERVER_TO_DAEMON_TYPES: readonly ["conn.ack", "task.offer", "task.offer_with_toolsets", "task.offer_for_agent", "task.offer_for_agent_with_egress", "task.offer_for_agent_with_egress_fresh", "agent.egress.ack", "agent.message.disposition", "agent.content.read", "agent.home.projection", "task.approve", "task.reject", "task.cancel", "task.steer"];
3307
+ export declare const SERVER_TO_DAEMON_TYPES: readonly ["conn.ack", "task.offer", "task.offer_with_toolsets", "task.offer_for_agent", "task.offer_for_agent_with_egress", "task.offer_for_agent_with_egress_fresh", "task.offer_prepared", "agent.egress.ack", "agent.message.disposition", "agent.content.read", "agent.home.projection", "agent.input.preparation", "task.approve", "task.reject", "task.cancel", "task.steer"];
2775
3308
  /**
2776
3309
  * Message types the daemon sends to the server — the flip side of
2777
3310
  * {@link SERVER_TO_DAEMON_TYPES}. `conn.hello` is deliberately excluded: it's
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The device-level half of the task lane's capability gate (contract §8.1).
3
+ *
4
+ * Contract §8.1 fixes ONE name, `host-mcp-task-context`, carried on two
5
+ * independent channels that must both be in place before a host may route a
6
+ * tool invocation through the task lane:
7
+ *
8
+ * 1. **Deployment level** — the ADR-010 `CapabilityDeclarationSchema` a
9
+ * deployment serves (`@byok-sdk/cloud`'s `CLOUD_CAPABILITIES`). §8.2(1)
10
+ * governs it: a deployment declares the capability only once it is
11
+ * completely implemented.
12
+ * 2. **Device level** — this constant: a `conn.hello` capability string a host
13
+ * consumes through `declaresCapabilities`. §8.3 governs it: a device whose
14
+ * build cannot serve the lane simply does not advertise it, and the host
15
+ * answers `unavailable` rather than reaching for the device assertion the
16
+ * task lane does not accept.
17
+ *
18
+ * It lives in `@byok-sdk/protocol` for the same reason every other daemon
19
+ * capability flag does: this package is the wire vocabulary both sides compile
20
+ * against, and a name spelled twice is a name that can drift. It is registered
21
+ * in `CAPABILITY_FLAGS` (`./version`), which is what makes it a value a daemon
22
+ * can actually send.
23
+ *
24
+ * The spelling satisfies `@byok-sdk/core`'s `CAPABILITY_NAME_PATTERN`
25
+ * (`/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/`) on purpose: the deployment-level channel
26
+ * carries this exact literal, so a name legal in only one of the two channels
27
+ * would leave them naming different things.
28
+ */
29
+ /** Contract §8.1's capability gate for `byok-task-assertion-v1` tool authority. */
30
+ export declare const HOST_MCP_TASK_CONTEXT_CAPABILITY: 'host-mcp-task-context';
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", "terminal-projection-selection", "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-v5", "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.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "BYOK SDK wire protocol: envelope schema, message types, and codec helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",