@byok-sdk/protocol 0.24.0 → 0.25.0-rc.2
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/dist/agent-egress.d.ts +13 -16
- package/dist/agent-event.d.ts +1 -1
- package/dist/envelope.d.ts +6 -99
- package/dist/http-api.d.ts +14 -218
- package/dist/index.d.ts +2 -4
- package/dist/index.js +14 -60
- package/dist/index.js.map +1 -1
- package/dist/input-preparation-version.d.ts +12 -0
- package/dist/input-preparation-version.js +6 -0
- package/dist/input-preparation-version.js.map +1 -0
- package/dist/input-preparation.d.ts +14 -100
- package/dist/messages.d.ts +20 -313
- package/dist/version.d.ts +20 -11
- package/package.json +6 -2
- package/dist/permission.d.ts +0 -39
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE version of the input-preparation contract, shared by this relay wire
|
|
3
|
+
* (the `agent.input.preparation` payload and the completion receipt summary)
|
|
4
|
+
* and by the device-local request, receipt and artifact
|
|
5
|
+
* (`@byok-sdk/client`'s `INPUT_PREPARATION_VERSION`, which is this value).
|
|
6
|
+
*
|
|
7
|
+
* The relay wire carries no version field of its own, so a version change is
|
|
8
|
+
* made visible where admission actually happens: in the capability token
|
|
9
|
+
* below. See `INPUT_PREPARATION_VERSION` in the client for what each version
|
|
10
|
+
* changed.
|
|
11
|
+
*/
|
|
12
|
+
export declare const INPUT_PREPARATION_WIRE_VERSION: 9;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/input-preparation-version.ts"],"names":[],"mappings":";AAWO,IAAM,8BAAA,GAAiC","file":"input-preparation-version.js","sourcesContent":["/**\n * The ONE version of the input-preparation contract, shared by this relay wire\n * (the `agent.input.preparation` payload and the completion receipt summary)\n * and by the device-local request, receipt and artifact\n * (`@byok-sdk/client`'s `INPUT_PREPARATION_VERSION`, which is this value).\n *\n * The relay wire carries no version field of its own, so a version change is\n * made visible where admission actually happens: in the capability token\n * below. See `INPUT_PREPARATION_VERSION` in the client for what each version\n * changed.\n */\nexport const INPUT_PREPARATION_WIRE_VERSION = 9 as const;\n"]}
|
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
* Remote authenticated runtime input preparation — the wire half of
|
|
4
|
-
* `docs/researches/runtime-input-preparation-contract.md` §19 (channel shape)
|
|
5
|
-
* and the C07 G4 design decision §17 B.
|
|
6
|
-
*
|
|
7
|
-
* This module owns ONLY the leaf shapes. The server -> device payload lives in
|
|
8
|
-
* `messages.ts` beside every other message payload (so the one inline byte
|
|
9
|
-
* bound `MAX_INLINE_BYTES` stays a single module-local authority), and the two
|
|
10
|
-
* authenticated HTTP bodies live in `http-api.ts`.
|
|
11
|
-
*
|
|
12
|
-
* Three structural rules this surface exists to hold:
|
|
13
|
-
*
|
|
14
|
-
* 1. The request carries NO tools, NO tool executors and NO runtime identity.
|
|
15
|
-
* Those are LOCAL observations: only the device can honestly say which MCP
|
|
16
|
-
* toolsets it has, what schemas their servers publish, and which native
|
|
17
|
-
* package closure is installed. A Host that could state them would be
|
|
18
|
-
* stating an identity it cannot verify.
|
|
19
|
-
* 2. The receipt summary discloses identities, digests, sizes, counter
|
|
20
|
-
* evidence and readiness — never D, never P(D), never the snapshot. A
|
|
21
|
-
* digest proves content identity; it is not a disclosure channel and not a
|
|
22
|
-
* bearer token (§10.3.4).
|
|
23
|
-
* 3. Every shape here is `.strict()`. This is control data: an unrecognized
|
|
24
|
-
* field must be REJECTED, not silently stripped, per docs/protocol.md's
|
|
25
|
-
* freeze-rule asymmetry. Adding a field post-freeze is therefore a
|
|
26
|
-
* breaking change, exactly like `PermissionPolicySchema`.
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* The ONE version of the input-preparation contract, shared by this relay wire
|
|
30
|
-
* (the `agent.input.preparation` payload and the completion receipt summary)
|
|
31
|
-
* and by the device-local request, receipt and artifact
|
|
32
|
-
* (`@byok-sdk/client`'s `INPUT_PREPARATION_VERSION`, which is this value).
|
|
33
|
-
*
|
|
34
|
-
* The relay wire carries no version field of its own, so a version change is
|
|
35
|
-
* made visible where admission actually happens: in the capability token
|
|
36
|
-
* below. See `INPUT_PREPARATION_VERSION` in the client for what each version
|
|
37
|
-
* changed.
|
|
38
|
-
*/
|
|
39
|
-
export declare const INPUT_PREPARATION_WIRE_VERSION: 8;
|
|
2
|
+
export { INPUT_PREPARATION_WIRE_VERSION } from './input-preparation-version';
|
|
40
3
|
/**
|
|
41
4
|
* Capability required before a task-free remote input preparation — or a
|
|
42
5
|
* prepared Execution — is admitted: `agent-input-preparation-v<N>`, where
|
|
@@ -59,7 +22,7 @@ export declare const INPUT_PREPARATION_WIRE_VERSION: 8;
|
|
|
59
22
|
* devices as a pair is the operator precondition for the cut (`docs/spec.md`,
|
|
60
23
|
* bounded admission); nothing here parses an older receipt.
|
|
61
24
|
*/
|
|
62
|
-
export declare const AGENT_INPUT_PREPARATION_CAPABILITY: "agent-input-preparation-
|
|
25
|
+
export declare const AGENT_INPUT_PREPARATION_CAPABILITY: "agent-input-preparation-v9";
|
|
63
26
|
/** The preparation surface uses the package-wide lowercase `sha256:<hex>` transport form. */
|
|
64
27
|
export declare const InputPreparationContentHashSchema: z.ZodString;
|
|
65
28
|
/**
|
|
@@ -78,26 +41,6 @@ export declare const InputPreparationPolicyRevisionSchema: z.ZodString;
|
|
|
78
41
|
* anything is compiled.
|
|
79
42
|
*/
|
|
80
43
|
export declare const InputPreparationProfileIdSchema: z.ZodString;
|
|
81
|
-
/**
|
|
82
|
-
* The permission mode a preparation is compiled FOR.
|
|
83
|
-
*
|
|
84
|
-
* It is the same closed set every task policy uses (`permission.ts`'s
|
|
85
|
-
* `PERMISSION_MODES`), spelled here as its own schema because a preparation
|
|
86
|
-
* carries a mode without carrying a policy: there is no task, no grant and no
|
|
87
|
-
* approval seam on this wire. The mode selects which tools the device's own
|
|
88
|
-
* observation projects into the counted manifest, and nothing else.
|
|
89
|
-
*
|
|
90
|
-
* Declared by the requester rather than inferred by the device: a device that
|
|
91
|
-
* guessed would be counting a manifest the requester never asked for, and a
|
|
92
|
-
* device that defaulted would silently count the widest one.
|
|
93
|
-
*/
|
|
94
|
-
export declare const InputPreparationPermissionModeSchema: z.ZodEnum<{
|
|
95
|
-
auto: "auto";
|
|
96
|
-
confirm: "confirm";
|
|
97
|
-
plan: "plan";
|
|
98
|
-
readonly: "readonly";
|
|
99
|
-
}>;
|
|
100
|
-
export type InputPreparationPermissionMode = z.infer<typeof InputPreparationPermissionModeSchema>;
|
|
101
44
|
/** Explicit prepared SDK memory selection; never defaulted. */
|
|
102
45
|
export declare const PreparedAgentMemoryModeSchema: z.ZodEnum<{
|
|
103
46
|
none: "none";
|
|
@@ -400,7 +343,7 @@ export type InputPreparationState = z.infer<typeof InputPreparationStateSchema>;
|
|
|
400
343
|
* `ready` means the preparation CAN BE CONSUMED — the artifact is intact and
|
|
401
344
|
* unexpired, the native compiler's projection is content-complete, every
|
|
402
345
|
* residual key is ruled by an applicable Host accounting policy, D is text
|
|
403
|
-
* only,
|
|
346
|
+
* only, and — only when the device has an
|
|
404
347
|
* optional counter configured — that count is provider-authoritative and
|
|
405
348
|
* covered. No count is required: the size evidence is
|
|
406
349
|
* `artifact.requestBytes`, the exact byte length of the frozen D. It is
|
|
@@ -416,7 +359,6 @@ export declare const InputPreparationReadinessReasonSchema: z.ZodEnum<{
|
|
|
416
359
|
counter_authority_not_production: "counter_authority_not_production";
|
|
417
360
|
counter_coverage_incomplete: "counter_coverage_incomplete";
|
|
418
361
|
counter_interrupted: "counter_interrupted";
|
|
419
|
-
executor_identity_unproven: "executor_identity_unproven";
|
|
420
362
|
failed: "failed";
|
|
421
363
|
not_prepared: "not_prepared";
|
|
422
364
|
projection_unknown: "projection_unknown";
|
|
@@ -529,16 +471,6 @@ export declare const InputPreparationCounterEvidenceSchema: z.ZodObject<{
|
|
|
529
471
|
calledAt: z.ZodISODateTime;
|
|
530
472
|
completedAt: z.ZodISODateTime;
|
|
531
473
|
}, z.core.$strict>;
|
|
532
|
-
/**
|
|
533
|
-
* What the device established about the implementation behind ONE
|
|
534
|
-
* model-visible tool: `attested`, or `unavailable:<reason>` naming which of
|
|
535
|
-
* the SDK's closed unavailable reasons applies.
|
|
536
|
-
*
|
|
537
|
-
* A kind, never the identity itself: an install path, a closure digest or a
|
|
538
|
-
* stat tuple is device-local filesystem detail, and a receipt discloses
|
|
539
|
-
* identity facts, not the machine's layout.
|
|
540
|
-
*/
|
|
541
|
-
export declare const InputPreparationToolImplementationKindSchema: z.ZodString;
|
|
542
474
|
/**
|
|
543
475
|
* What the native compiler proved about ONE top-level key of D that lies
|
|
544
476
|
* outside P(D).
|
|
@@ -601,19 +533,16 @@ export declare const InputPreparationProjectionSchema: z.ZodObject<{
|
|
|
601
533
|
* launch checkable rather than assumed:
|
|
602
534
|
*
|
|
603
535
|
* - `observationDigest` binds everything the device OBSERVED — the projected
|
|
604
|
-
* tools
|
|
605
|
-
*
|
|
606
|
-
* a different manifest, whatever the schemas say.
|
|
536
|
+
* tools and their executor fingerprints — so a launch whose live
|
|
537
|
+
* observation differs is a different manifest, whatever the schemas say.
|
|
607
538
|
* - `toolBindingDigest` binds only the facts that can be re-derived WITHOUT
|
|
608
|
-
* spawning a server: the
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
* `executor_identity_unproven`, so a reader does not have to take that
|
|
616
|
-
* readiness reason on trust.
|
|
539
|
+
* spawning a server: the toolset definition revisions and the configured
|
|
540
|
+
* argv. It is what a replay of an already-recorded requestId compares
|
|
541
|
+
* against, because re-probing to detect drift would be the second executor
|
|
542
|
+
* fact the idempotency key exists to prevent.
|
|
543
|
+
* - `toolNames` lists the counted model-visible tool names, sorted. A launch
|
|
544
|
+
* that registers a different set can name the tool that appeared or
|
|
545
|
+
* vanished.
|
|
617
546
|
*/
|
|
618
547
|
export declare const InputPreparationArtifactSummarySchema: z.ZodObject<{
|
|
619
548
|
requestDigest: z.ZodString;
|
|
@@ -644,7 +573,7 @@ export declare const InputPreparationArtifactSummarySchema: z.ZodObject<{
|
|
|
644
573
|
}, z.core.$strict>>;
|
|
645
574
|
observationDigest: z.ZodString;
|
|
646
575
|
toolBindingDigest: z.ZodString;
|
|
647
|
-
|
|
576
|
+
toolNames: z.ZodArray<z.ZodString>;
|
|
648
577
|
}, z.core.$strict>;
|
|
649
578
|
/** The immutable binding a receipt carries and a later consumer must re-present. */
|
|
650
579
|
export declare const InputPreparationBindingSchema: z.ZodObject<{
|
|
@@ -667,12 +596,6 @@ export declare const InputPreparationBindingSchema: z.ZodObject<{
|
|
|
667
596
|
modelId: z.ZodString;
|
|
668
597
|
}, z.core.$strict>;
|
|
669
598
|
policyRevision: z.ZodString;
|
|
670
|
-
permissionMode: z.ZodEnum<{
|
|
671
|
-
auto: "auto";
|
|
672
|
-
confirm: "confirm";
|
|
673
|
-
plan: "plan";
|
|
674
|
-
readonly: "readonly";
|
|
675
|
-
}>;
|
|
676
599
|
runtime: z.ZodObject<{
|
|
677
600
|
packageName: z.ZodString;
|
|
678
601
|
packageVersion: z.ZodString;
|
|
@@ -732,12 +655,6 @@ export declare const InputPreparationReceiptSummarySchema: z.ZodObject<{
|
|
|
732
655
|
modelId: z.ZodString;
|
|
733
656
|
}, z.core.$strict>;
|
|
734
657
|
policyRevision: z.ZodString;
|
|
735
|
-
permissionMode: z.ZodEnum<{
|
|
736
|
-
auto: "auto";
|
|
737
|
-
confirm: "confirm";
|
|
738
|
-
plan: "plan";
|
|
739
|
-
readonly: "readonly";
|
|
740
|
-
}>;
|
|
741
658
|
runtime: z.ZodObject<{
|
|
742
659
|
packageName: z.ZodString;
|
|
743
660
|
packageVersion: z.ZodString;
|
|
@@ -789,7 +706,7 @@ export declare const InputPreparationReceiptSummarySchema: z.ZodObject<{
|
|
|
789
706
|
}, z.core.$strict>>;
|
|
790
707
|
observationDigest: z.ZodString;
|
|
791
708
|
toolBindingDigest: z.ZodString;
|
|
792
|
-
|
|
709
|
+
toolNames: z.ZodArray<z.ZodString>;
|
|
793
710
|
}, z.core.$strict>>;
|
|
794
711
|
counter: z.ZodOptional<z.ZodObject<{
|
|
795
712
|
method: z.ZodString;
|
|
@@ -829,7 +746,6 @@ export declare const InputPreparationReceiptSummarySchema: z.ZodObject<{
|
|
|
829
746
|
counter_authority_not_production: "counter_authority_not_production";
|
|
830
747
|
counter_coverage_incomplete: "counter_coverage_incomplete";
|
|
831
748
|
counter_interrupted: "counter_interrupted";
|
|
832
|
-
executor_identity_unproven: "executor_identity_unproven";
|
|
833
749
|
failed: "failed";
|
|
834
750
|
not_prepared: "not_prepared";
|
|
835
751
|
projection_unknown: "projection_unknown";
|
|
@@ -893,11 +809,9 @@ export declare const InputPreparationRejectionReasonSchema: z.ZodEnum<{
|
|
|
893
809
|
durable_write_failed: "durable_write_failed";
|
|
894
810
|
input_preparation_record_log_unsupported: "input_preparation_record_log_unsupported";
|
|
895
811
|
input_preparation_unconfigured: "input_preparation_unconfigured";
|
|
896
|
-
launch_boundary_unavailable: "launch_boundary_unavailable";
|
|
897
812
|
limit_exceeded: "limit_exceeded";
|
|
898
813
|
not_found: "not_found";
|
|
899
814
|
observation_drift: "observation_drift";
|
|
900
|
-
permission_mode_denied: "permission_mode_denied";
|
|
901
815
|
policy_revision_mismatch: "policy_revision_mismatch";
|
|
902
816
|
request_conflict: "request_conflict";
|
|
903
817
|
rpc_frame_too_large: "rpc_frame_too_large";
|