@byollm/protocol 0.1.0-alpha.99 → 0.1.1
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 +15 -120
- package/dist/index.d.ts +233 -55
- package/dist/index.js +91 -14
- package/dist/index.js.map +1 -1
- package/dist/portable.d.ts +1 -1
- package/dist/portable.js +6 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21,6 +21,34 @@ import {
|
|
|
21
21
|
toBase64Url
|
|
22
22
|
} from "./chunk-J3HTAGMX.js";
|
|
23
23
|
|
|
24
|
+
// src/hub-fence.ts
|
|
25
|
+
var HUB_FENCE = "byollm.cloud sees only what routing and metering need: which devices and sites are connected, each job's kind, size, and outcome, and timestamps. Never prompts, never answers, never credentials.";
|
|
26
|
+
var HUB_FENCE_CLAUSES = Object.freeze([
|
|
27
|
+
{
|
|
28
|
+
says: "which devices and sites are connected",
|
|
29
|
+
covers: Object.freeze(["owner_id", "site_id", "member_id"])
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
says: "each job's kind, size, and outcome",
|
|
33
|
+
covers: Object.freeze(["kind", "size_class", "disposition", "bytes"])
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
says: "and timestamps",
|
|
37
|
+
covers: Object.freeze(["at", "month", "updated_at"])
|
|
38
|
+
},
|
|
39
|
+
/*
|
|
40
|
+
* Ruled plumbing, not a new fact about a person — Todd, 2026-09-04.
|
|
41
|
+
*
|
|
42
|
+
* Named here rather than silently tolerated. A column exempted by a ruling
|
|
43
|
+
* and a column nobody noticed look identical to a check that just skips
|
|
44
|
+
* them, and only one of those is a decision.
|
|
45
|
+
*/
|
|
46
|
+
{
|
|
47
|
+
says: "(metering plumbing, ruled unenumerated)",
|
|
48
|
+
covers: Object.freeze(["id", "job_id", "price_version"])
|
|
49
|
+
}
|
|
50
|
+
]);
|
|
51
|
+
|
|
24
52
|
// src/wire.ts
|
|
25
53
|
import { z as z9 } from "zod";
|
|
26
54
|
|
|
@@ -888,6 +916,12 @@ var ClaimedJob = z7.object({
|
|
|
888
916
|
deadlineAt: z7.number().int().positive().optional(),
|
|
889
917
|
lease: Lease
|
|
890
918
|
}).strict();
|
|
919
|
+
var StopReasonSchema = z7.enum([
|
|
920
|
+
"end",
|
|
921
|
+
"length",
|
|
922
|
+
"stop-sequence",
|
|
923
|
+
"unknown"
|
|
924
|
+
]);
|
|
891
925
|
var ResultProvenance = z7.object({
|
|
892
926
|
/** The audience the job ran under. */
|
|
893
927
|
audience: Audience,
|
|
@@ -900,10 +934,33 @@ var ResultProvenance = z7.object({
|
|
|
900
934
|
/** The model the runner reports having used. */
|
|
901
935
|
model: z7.string().min(1),
|
|
902
936
|
/**
|
|
903
|
-
* False only for `
|
|
937
|
+
* False only for `private` jobs. When true the app MUST treat `text` as
|
|
904
938
|
* untrusted third-party content.
|
|
905
939
|
*/
|
|
906
|
-
untrusted: z7.boolean()
|
|
940
|
+
untrusted: z7.boolean(),
|
|
941
|
+
/**
|
|
942
|
+
* Why generation stopped, carried from the sealed `ran` — B260.
|
|
943
|
+
*
|
|
944
|
+
* It was sealed by the device, opened at the site, used to build this
|
|
945
|
+
* object, and **dropped**: `provenanceFor` took five fields and `stop` was
|
|
946
|
+
* not one of them, on either lane. So no site could ever see it, and a
|
|
947
|
+
* `length` result — an answer cut off mid-thought — arrived
|
|
948
|
+
* indistinguishable from a complete one. Kevin's team found it on a
|
|
949
|
+
* book-translation pipeline, which is the difference between shipping a
|
|
950
|
+
* chapter and shipping half of one without knowing.
|
|
951
|
+
*
|
|
952
|
+
* Optional here because it is optional there, and for the same reason:
|
|
953
|
+
* absent exactly where it would be a fact about nothing.
|
|
954
|
+
*/
|
|
955
|
+
stop: StopReasonSchema.optional(),
|
|
956
|
+
/**
|
|
957
|
+
* Whether the adapter could report a stop signal at all — carried for the
|
|
958
|
+
* reason {@link RunMetadata.stopReported} gives: `unknown` is two facts,
|
|
959
|
+
* and a site told only `unknown` says "we do not know why this stopped"
|
|
960
|
+
* for a `claude-cli` job forever, which is true, and for a
|
|
961
|
+
* `content_filter` result, which is not the same thing at all.
|
|
962
|
+
*/
|
|
963
|
+
stopReported: z7.boolean().optional()
|
|
907
964
|
}).strict();
|
|
908
965
|
function provenanceFor(input) {
|
|
909
966
|
return {
|
|
@@ -912,15 +969,14 @@ function provenanceFor(input) {
|
|
|
912
969
|
runnerOwner: input.runnerOwner,
|
|
913
970
|
backendClass: input.backendClass,
|
|
914
971
|
model: input.model,
|
|
915
|
-
untrusted: input.audience !== "private"
|
|
972
|
+
untrusted: input.audience !== "private",
|
|
973
|
+
/* Spread rather than assigned: `exactOptionalPropertyTypes` makes an
|
|
974
|
+
explicit `undefined` a different thing from an absent key, and this
|
|
975
|
+
object is `.strict()`. */
|
|
976
|
+
...input.stop === void 0 ? {} : { stop: input.stop },
|
|
977
|
+
...input.stopReported === void 0 ? {} : { stopReported: input.stopReported }
|
|
916
978
|
};
|
|
917
979
|
}
|
|
918
|
-
var StopReasonSchema = z7.enum([
|
|
919
|
-
"end",
|
|
920
|
-
"length",
|
|
921
|
-
"stop-sequence",
|
|
922
|
-
"unknown"
|
|
923
|
-
]);
|
|
924
980
|
var RunMetadata = z7.object({
|
|
925
981
|
/** Which model actually served it. */
|
|
926
982
|
model: z7.string().min(1),
|
|
@@ -1273,7 +1329,7 @@ async function open(input) {
|
|
|
1273
1329
|
}
|
|
1274
1330
|
|
|
1275
1331
|
// src/wire.ts
|
|
1276
|
-
var PROTOCOL_VERSION = "
|
|
1332
|
+
var PROTOCOL_VERSION = "2";
|
|
1277
1333
|
var SUPPORTED_PROTOCOL_VERSIONS = Object.freeze([
|
|
1278
1334
|
PROTOCOL_VERSION
|
|
1279
1335
|
]);
|
|
@@ -1510,9 +1566,7 @@ var HeartbeatRequest = z9.object({
|
|
|
1510
1566
|
* Lease ids rather than job ids, so a replayed heartbeat cannot renew a
|
|
1511
1567
|
* grant the runner no longer holds — see {@link Lease.id}.
|
|
1512
1568
|
*/
|
|
1513
|
-
activeLeases: z9.array(GrantRef)
|
|
1514
|
-
/** True while the owner has the daemon paused; the server stops offering work. */
|
|
1515
|
-
paused: z9.boolean()
|
|
1569
|
+
activeLeases: z9.array(GrantRef)
|
|
1516
1570
|
}).strict();
|
|
1517
1571
|
var HeartbeatResponse = z9.object({
|
|
1518
1572
|
/**
|
|
@@ -2181,6 +2235,15 @@ var PurposeKey = z11.string().regex(
|
|
|
2181
2235
|
/^[a-z0-9][a-z0-9-]*$/,
|
|
2182
2236
|
"a purpose key is a lowercase slug \u2014 letters, digits and hyphens"
|
|
2183
2237
|
).max(64);
|
|
2238
|
+
var PurposeRouting = z11.enum([
|
|
2239
|
+
"user-choice",
|
|
2240
|
+
"site-fixed",
|
|
2241
|
+
"user-first-with-fallback"
|
|
2242
|
+
]);
|
|
2243
|
+
var DEFAULT_ROUTING = "user-choice";
|
|
2244
|
+
function routingOf(purpose) {
|
|
2245
|
+
return purpose.routing ?? DEFAULT_ROUTING;
|
|
2246
|
+
}
|
|
2184
2247
|
var Purpose = z11.object({
|
|
2185
2248
|
/**
|
|
2186
2249
|
* What a person reads on the consent screen. The only rendered field.
|
|
@@ -2201,7 +2264,16 @@ var Purpose = z11.object({
|
|
|
2201
2264
|
*/
|
|
2202
2265
|
kinds: z11.array(JobKind).min(1).max(JOB_KINDS.length).refine((kinds) => new Set(kinds).size === kinds.length, {
|
|
2203
2266
|
message: "a purpose lists each kind once"
|
|
2204
|
-
})
|
|
2267
|
+
}),
|
|
2268
|
+
/**
|
|
2269
|
+
* How this purpose is routed — RESERVED, validated, not acted on (B236).
|
|
2270
|
+
*
|
|
2271
|
+
* Optional rather than defaulted, so that a manifest without it parses to
|
|
2272
|
+
* a manifest without it. See {@link PurposeRouting} for why a key nothing
|
|
2273
|
+
* reads is worth adding before launch, and {@link routingOf} for the one
|
|
2274
|
+
* place "not stated" is answered.
|
|
2275
|
+
*/
|
|
2276
|
+
routing: PurposeRouting.optional()
|
|
2205
2277
|
}).strict();
|
|
2206
2278
|
var MAX_PURPOSES = 32;
|
|
2207
2279
|
var Manifest = z11.record(PurposeKey, Purpose).refine((manifest) => Object.keys(manifest).length > 0, {
|
|
@@ -2683,6 +2755,7 @@ export {
|
|
|
2683
2755
|
ConsoleResize,
|
|
2684
2756
|
ConsoleStdin,
|
|
2685
2757
|
ConsoleStdout,
|
|
2758
|
+
DEFAULT_ROUTING,
|
|
2686
2759
|
DeliveredResult,
|
|
2687
2760
|
ENCRYPTION_KEY_CONTEXT,
|
|
2688
2761
|
ENDPOINTS,
|
|
@@ -2697,6 +2770,8 @@ export {
|
|
|
2697
2770
|
GRANT_SIGNED_FIELDS,
|
|
2698
2771
|
GeneratePayload,
|
|
2699
2772
|
GrantRef,
|
|
2773
|
+
HUB_FENCE,
|
|
2774
|
+
HUB_FENCE_CLAUSES,
|
|
2700
2775
|
HeartbeatRequest,
|
|
2701
2776
|
HeartbeatResponse,
|
|
2702
2777
|
JOB_KINDS,
|
|
@@ -2732,6 +2807,7 @@ export {
|
|
|
2732
2807
|
PairStartResponse,
|
|
2733
2808
|
PublicIdentity,
|
|
2734
2809
|
Purpose,
|
|
2810
|
+
PurposeRouting,
|
|
2735
2811
|
REFUSAL_MESSAGES,
|
|
2736
2812
|
REFUSAL_TEXT,
|
|
2737
2813
|
RESERVED_PURPOSE,
|
|
@@ -2803,6 +2879,7 @@ export {
|
|
|
2803
2879
|
provenanceFor,
|
|
2804
2880
|
publicIdentityOf,
|
|
2805
2881
|
resolveCost,
|
|
2882
|
+
routingOf,
|
|
2806
2883
|
seal,
|
|
2807
2884
|
signGrant,
|
|
2808
2885
|
signRequest,
|