@wenathlan/saddle 1.8.14 → 1.8.16
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 +2 -2
- package/dist/apps/registry.d.ts +1 -1
- package/dist/binary/archive.d.ts +27 -0
- package/dist/binary/archive.d.ts.map +1 -0
- package/dist/binary/archive.js +46 -0
- package/dist/binary/archive.js.map +1 -0
- package/dist/binary/transform.d.ts +70 -0
- package/dist/binary/transform.d.ts.map +1 -0
- package/dist/binary/transform.js +105 -0
- package/dist/binary/transform.js.map +1 -0
- package/dist/delivery/manifest.d.ts +35 -0
- package/dist/delivery/manifest.d.ts.map +1 -0
- package/dist/delivery/manifest.js +68 -0
- package/dist/delivery/manifest.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +3 -3
- package/dist/memory/engine.d.ts +1 -1
- package/dist/memory/planner.d.ts +66 -0
- package/dist/memory/planner.d.ts.map +1 -0
- package/dist/memory/planner.js +108 -0
- package/dist/memory/planner.js.map +1 -0
- package/dist/release/evidence.d.ts +92 -0
- package/dist/release/evidence.d.ts.map +1 -0
- package/dist/release/evidence.js +148 -0
- package/dist/release/evidence.js.map +1 -0
- package/dist/runners/chain.d.ts +125 -0
- package/dist/runners/chain.d.ts.map +1 -0
- package/dist/runners/chain.js +95 -0
- package/dist/runners/chain.js.map +1 -0
- package/dist/scrape/robots.js +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/memory.js +2 -2
- package/dist/storage/memory.js.map +1 -1
- package/dist/storage/pool.d.ts +95 -0
- package/dist/storage/pool.d.ts.map +1 -0
- package/dist/storage/pool.js +202 -0
- package/dist/storage/pool.js.map +1 -0
- package/dist/surfaces/requirements.d.ts +29 -0
- package/dist/surfaces/requirements.d.ts.map +1 -0
- package/dist/surfaces/requirements.js +50 -0
- package/dist/surfaces/requirements.js.map +1 -0
- package/docs/artifactavailability.md +13 -1
- package/docs/ecosystemplan.md +1 -1
- package/docs/enginearchitecture.md +30 -0
- package/docs/libraryapi.md +5 -1
- package/docs/plans/00.index.md +2 -2
- package/docs/plans/06.dependencies.md +1 -1
- package/docs/plans/18.research.content.extraction.md +3 -3
- package/docs/plans/22.research.universal.runtime.md +10 -10
- package/docs/plans/28.action.plan.md +1 -1
- package/docs/plans/35.comparativo.concorrencia.md +10 -10
- package/docs/plans/40.npm.publish.md +6 -6
- package/docs/plans/41.o.que.falta.md +2 -2
- package/docs/plans/42.pesquisa.concorrencia.md +2 -2
- package/docs/plans/43.plan.universal.architecture.md +2 -2
- package/docs/plans/44.reference.md +1 -1
- package/docs/plans/45.robotarchitecture.md +3 -3
- package/docs/plans/46.scdnintegration.md +1 -1
- package/docs/plans/README.md +2 -2
- package/docs/plans/missing-facts.md +1 -1
- package/docs/registryresearch.md +3 -3
- package/docs/release17notes.md +1 -1
- package/docs/releasenotes-1.8.14.md +24 -9
- package/docs/releasenotes-1.8.15.md +41 -0
- package/docs/releasenotes-1.8.16.md +40 -0
- package/docs/repo-research-1.8.16.md +439 -0
- package/docs/repo-synthesis-1.8.16.md +56 -0
- package/docs/talks9/README (2).md +2 -2
- package/docs/talks9/README.md +4 -4
- package/docs/talks9/Viabilidade do Saddle_ Uma An/303/241lise T/303/251cnica da Transforma/303/247/303/243o de Armazenamento Remoto em Mem/303/263ria Computacional.md" +4 -4
- package/docs/talks9/conversa.txt +4 -4
- package/docs/todo-1.8.15.md +483 -0
- package/docs/todo-1.8.16.md +651 -0
- package/docs/todo.md +708 -0
- package/extension/manifest.json +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* working-set planning keeps host memory operations declarative and caller-executed.
|
|
3
|
+
*/
|
|
4
|
+
/** Validates a serializable working-set capacity budget. */
|
|
5
|
+
export declare function workingbudget(input?: {}): Readonly<{
|
|
6
|
+
maxbytes: number;
|
|
7
|
+
maxentries: number;
|
|
8
|
+
maxage: number;
|
|
9
|
+
}>;
|
|
10
|
+
/** Selects bounded working-set candidates without materializing data or probing a host. */
|
|
11
|
+
export declare function workingadmission(items: any, options?: {}): Readonly<{
|
|
12
|
+
version: 1;
|
|
13
|
+
policy: any;
|
|
14
|
+
budget: Readonly<{
|
|
15
|
+
maxbytes: number;
|
|
16
|
+
maxentries: number;
|
|
17
|
+
maxage: number;
|
|
18
|
+
}>;
|
|
19
|
+
usedbytes: number;
|
|
20
|
+
admitted: readonly any[];
|
|
21
|
+
deferred: readonly any[];
|
|
22
|
+
}>;
|
|
23
|
+
/** Produces a host bridge plan that an explicit privileged adapter may execute. */
|
|
24
|
+
export declare function bridgeplan(input?: {}): Readonly<{
|
|
25
|
+
version: 1;
|
|
26
|
+
operation: string;
|
|
27
|
+
sizebytes: number;
|
|
28
|
+
state: "caller-executes" | "unsupported";
|
|
29
|
+
preconditions: readonly string[];
|
|
30
|
+
cleanup: Readonly<{
|
|
31
|
+
required: boolean;
|
|
32
|
+
owner: "caller";
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
/** Validates a materialized object record without reading storage or the local filesystem. */
|
|
36
|
+
export declare function materializationrecord(input?: {}): Readonly<{
|
|
37
|
+
version: 1;
|
|
38
|
+
id: string;
|
|
39
|
+
sha256: string;
|
|
40
|
+
sizebytes: number;
|
|
41
|
+
tier: any;
|
|
42
|
+
state: any;
|
|
43
|
+
createdat: number;
|
|
44
|
+
}>;
|
|
45
|
+
/** Tracks materialization transitions and emits caller-owned cleanup plans without deleting resources. */
|
|
46
|
+
export declare function materializationledger(input?: {}): Readonly<{
|
|
47
|
+
add: (record: any) => Readonly<{
|
|
48
|
+
version: 1;
|
|
49
|
+
id: string;
|
|
50
|
+
sha256: string;
|
|
51
|
+
sizebytes: number;
|
|
52
|
+
tier: any;
|
|
53
|
+
state: any;
|
|
54
|
+
createdat: number;
|
|
55
|
+
}>;
|
|
56
|
+
transition: (id: any, state: any) => any;
|
|
57
|
+
cleanupplan: (id: any) => Readonly<{
|
|
58
|
+
version: 1;
|
|
59
|
+
id: any;
|
|
60
|
+
sha256: any;
|
|
61
|
+
state: "caller-cleans";
|
|
62
|
+
reason: "already-cleaned" | "release-working-set";
|
|
63
|
+
}>;
|
|
64
|
+
list: () => readonly any[];
|
|
65
|
+
}>;
|
|
66
|
+
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../memory/planner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,KAAK,KAAK;;;;GAEvC;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,EAAE,OAAO,KAAK;;;;;;;;;;;GAkBnD;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,KAAK,KAAK;;;;;;;;;;GAOpC;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,KAAK,KAAK;;;;;;;;GAM/C;AAED,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,KAAK,KAAK;;;;;;;;;;;;;;;;;;;GAO/C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* working-set planning keeps host memory operations declarative and caller-executed.
|
|
3
|
+
*/
|
|
4
|
+
/** Validates a serializable working-set capacity budget. */
|
|
5
|
+
export function workingbudget(input = {}) {
|
|
6
|
+
return Object.freeze({ maxbytes: limit(input.maxbytes, "working-set maxbytes"), maxentries: limit(input.maxentries, "working-set maxentries"), maxage: optionalnonnegative(input.maxage, "working-set maxage") });
|
|
7
|
+
}
|
|
8
|
+
/** Selects bounded working-set candidates without materializing data or probing a host. */
|
|
9
|
+
export function workingadmission(items, options = {}) {
|
|
10
|
+
if (!Array.isArray(items))
|
|
11
|
+
throw new TypeError("working-set items must be an array");
|
|
12
|
+
const budget = workingbudget(options.budget);
|
|
13
|
+
const now = Number(options.now ?? Date.now());
|
|
14
|
+
if (!Number.isFinite(now) || now < 0)
|
|
15
|
+
throw new TypeError("working-set now is invalid");
|
|
16
|
+
const policy = validpolicy(options.policy ?? "lru");
|
|
17
|
+
const normalized = normalizeitems(items);
|
|
18
|
+
const admitted = [];
|
|
19
|
+
const deferred = [];
|
|
20
|
+
let usedbytes = 0;
|
|
21
|
+
for (const item of rank(normalized, policy)) {
|
|
22
|
+
const expired = item.expiresat !== null && item.expiresat <= now;
|
|
23
|
+
const overbytes = usedbytes + item.sizebytes > budget.maxbytes;
|
|
24
|
+
const overentries = admitted.length >= budget.maxentries;
|
|
25
|
+
if (expired || overbytes || overentries)
|
|
26
|
+
deferred.push(Object.freeze({ ...item, reason: expired ? "expired" : overbytes ? "bytebudget" : "entrybudget" }));
|
|
27
|
+
else {
|
|
28
|
+
admitted.push(item);
|
|
29
|
+
usedbytes += item.sizebytes;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return Object.freeze({ version: 1, policy, budget, usedbytes, admitted: Object.freeze(admitted), deferred: Object.freeze(deferred) });
|
|
33
|
+
}
|
|
34
|
+
/** Produces a host bridge plan that an explicit privileged adapter may execute. */
|
|
35
|
+
export function bridgeplan(input = {}) {
|
|
36
|
+
const operation = String(input.operation ?? "");
|
|
37
|
+
if (!bridgeoperations.includes(operation))
|
|
38
|
+
throw new TypeError("working-set bridge operation is invalid");
|
|
39
|
+
const sizebytes = positive(input.sizebytes, "working-set bridge sizebytes");
|
|
40
|
+
const capabilities = new Set(Array.isArray(input.capabilities) ? input.capabilities.map((value) => String(value)) : []);
|
|
41
|
+
const supported = capabilities.has(operation);
|
|
42
|
+
return Object.freeze({ version: 1, operation, sizebytes, state: supported ? "caller-executes" : "unsupported", preconditions: Object.freeze(supported ? ["explicit-consent", "host-adapter", "rollback-plan", "capacity-check"] : []), cleanup: Object.freeze({ required: supported, owner: "caller" }) });
|
|
43
|
+
}
|
|
44
|
+
/** Validates a materialized object record without reading storage or the local filesystem. */
|
|
45
|
+
export function materializationrecord(input = {}) {
|
|
46
|
+
const id = String(input.id ?? "");
|
|
47
|
+
const sha256 = String(input.sha256 ?? "").toLowerCase();
|
|
48
|
+
if (!id)
|
|
49
|
+
throw new TypeError("working-set materialization id is required");
|
|
50
|
+
if (!/^[a-f0-9]{64}$/.test(sha256))
|
|
51
|
+
throw new TypeError("working-set materialization sha256 is invalid");
|
|
52
|
+
return Object.freeze({ version: 1, id, sha256, sizebytes: positive(input.sizebytes, "working-set materialization sizebytes"), tier: validtier(input.tier ?? "l3"), state: validstate(input.state ?? "planned"), createdat: nonnegative(input.createdat ?? Date.now(), "working-set materialization createdat") });
|
|
53
|
+
}
|
|
54
|
+
/** Tracks materialization transitions and emits caller-owned cleanup plans without deleting resources. */
|
|
55
|
+
export function materializationledger(input = {}) {
|
|
56
|
+
const records = new Map();
|
|
57
|
+
const clock = typeof input.clock === "function" ? input.clock : () => Date.now();
|
|
58
|
+
function add(record) { const normalized = materializationrecord(record); if (records.has(normalized.id))
|
|
59
|
+
throw new TypeError(`working-set materialization id is duplicated: ${normalized.id}`); records.set(normalized.id, normalized); return normalized; }
|
|
60
|
+
function transition(id, state) { const current = records.get(String(id)); if (!current)
|
|
61
|
+
throw new TypeError("working-set materialization is unknown"); const next = validstate(state); if (!allowedtransition(current.state, next))
|
|
62
|
+
throw new TypeError(`working-set materialization transition is invalid: ${current.state} to ${next}`); const output = Object.freeze({ ...current, state: next, updatedat: nonnegative(clock(), "working-set materialization updatedat") }); records.set(output.id, output); return output; }
|
|
63
|
+
function cleanupplan(id) { const current = records.get(String(id)); if (!current)
|
|
64
|
+
throw new TypeError("working-set materialization is unknown"); return Object.freeze({ version: 1, id: current.id, sha256: current.sha256, state: "caller-cleans", reason: current.state === "cleaned" ? "already-cleaned" : "release-working-set" }); }
|
|
65
|
+
return Object.freeze({ add, transition, cleanupplan, list: () => Object.freeze([...records.values()]) });
|
|
66
|
+
}
|
|
67
|
+
const bridgeoperations = Object.freeze(["temporaryfile", "mmap", "tmpfs", "zram", "swap"]);
|
|
68
|
+
const policies = new Set(["lru", "sizeaware", "ttlfirst"]);
|
|
69
|
+
const tiers = new Set(["l1", "l2", "l3", "l4"]);
|
|
70
|
+
const states = new Set(["planned", "prepared", "verified", "released", "cleaned", "failed"]);
|
|
71
|
+
function normalizeitems(input) {
|
|
72
|
+
const ids = new Set();
|
|
73
|
+
return input.map((value, index) => {
|
|
74
|
+
const id = String(value?.id ?? "");
|
|
75
|
+
if (!id || ids.has(id))
|
|
76
|
+
throw new TypeError("working-set item id must be unique");
|
|
77
|
+
ids.add(id);
|
|
78
|
+
return Object.freeze({ id, sizebytes: positive(value.sizebytes, "working-set item sizebytes"), priority: Number(value.priority ?? 0), lastusedat: nonnegative(value.lastusedat ?? 0, "working-set item lastusedat"), expiresat: value.expiresat === undefined ? null : nonnegative(value.expiresat, "working-set item expiresat"), index });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function rank(items, policy) {
|
|
82
|
+
return [...items].sort((left, right) => {
|
|
83
|
+
if (right.priority !== left.priority)
|
|
84
|
+
return right.priority - left.priority;
|
|
85
|
+
if (policy === "lru" && right.lastusedat !== left.lastusedat)
|
|
86
|
+
return right.lastusedat - left.lastusedat;
|
|
87
|
+
if (policy === "sizeaware" && left.sizebytes !== right.sizebytes)
|
|
88
|
+
return left.sizebytes - right.sizebytes;
|
|
89
|
+
if (policy === "ttlfirst" && (left.expiresat ?? Infinity) !== (right.expiresat ?? Infinity))
|
|
90
|
+
return (left.expiresat ?? Infinity) - (right.expiresat ?? Infinity);
|
|
91
|
+
return left.index - right.index;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function limit(value, name) { return value === undefined ? Infinity : nonnegative(value, name); }
|
|
95
|
+
function positive(value, name) { const numeric = nonnegative(value, name); if (numeric < 1)
|
|
96
|
+
throw new TypeError(`${name} must be positive`); return numeric; }
|
|
97
|
+
function nonnegative(value, name) { const numeric = Number(value); if (!Number.isSafeInteger(numeric) || numeric < 0)
|
|
98
|
+
throw new TypeError(`${name} must be a non-negative safe integer`); return numeric; }
|
|
99
|
+
function optionalnonnegative(value, name) { return value === undefined ? null : nonnegative(value, name); }
|
|
100
|
+
function validpolicy(value) { if (!policies.has(value))
|
|
101
|
+
throw new TypeError("working-set policy is invalid"); return value; }
|
|
102
|
+
function validtier(value) { if (!tiers.has(value))
|
|
103
|
+
throw new TypeError("working-set tier is invalid"); return value; }
|
|
104
|
+
function validstate(value) { if (!states.has(value))
|
|
105
|
+
throw new TypeError("working-set materialization state is invalid"); return value; }
|
|
106
|
+
function allowedtransition(current, next) { if (next === "failed")
|
|
107
|
+
return current !== "cleaned"; return new Set(["planned:prepared", "prepared:verified", "verified:released", "released:cleaned"]).has(`${current}:${next}`); }
|
|
108
|
+
//# sourceMappingURL=planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../../memory/planner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4DAA4D;AAC5D,MAAM,UAAU,aAAa,CAAC,KAAK,GAAG,EAAE;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,sBAAsB,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,wBAAwB,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC;AACpN,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,EAAE;IAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;I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AK,CAAC,CAAC,CAAC;AAC7H,SAAS,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;AACtH,SAAS,UAAU,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;AACzI,SAAS,iBAAiB,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,IAAI,KAAK,QAAQ;IAAE,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Release evidence evaluates caller-supplied metadata without fetching, signing,
|
|
3
|
+
* scanning, publishing or claiming an artifact has more assurance than proven.
|
|
4
|
+
*/
|
|
5
|
+
/** Normalizes an immutable, caller-supplied artifact evidence record. */
|
|
6
|
+
export declare function releaseevidence(input?: Record<string, unknown>): {
|
|
7
|
+
version: number;
|
|
8
|
+
kind: string;
|
|
9
|
+
status: string;
|
|
10
|
+
subjectdigest: string;
|
|
11
|
+
producer: string;
|
|
12
|
+
workflow: string;
|
|
13
|
+
verificationmethod: string;
|
|
14
|
+
verifiedat: number;
|
|
15
|
+
metadata: {
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** Evaluates evidence against a caller-owned policy and returns reason codes, never a trust claim. */
|
|
20
|
+
export declare function evaluateevidence(input?: Record<string, unknown>): {
|
|
21
|
+
version: number;
|
|
22
|
+
decision: string;
|
|
23
|
+
reasons: string[];
|
|
24
|
+
subjectdigest: string;
|
|
25
|
+
requiredkinds: string[];
|
|
26
|
+
evidence: {
|
|
27
|
+
version: number;
|
|
28
|
+
kind: string;
|
|
29
|
+
status: string;
|
|
30
|
+
subjectdigest: string;
|
|
31
|
+
producer: string;
|
|
32
|
+
workflow: string;
|
|
33
|
+
verificationmethod: string;
|
|
34
|
+
verifiedat: number;
|
|
35
|
+
metadata: {
|
|
36
|
+
[x: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
/** Builds a data-only readiness receipt for a release that a caller may later execute. */
|
|
41
|
+
export declare function releasereadiness(input?: Record<string, unknown>): {
|
|
42
|
+
version: number;
|
|
43
|
+
sourcetag: string;
|
|
44
|
+
manifestversions: Record<string, string>;
|
|
45
|
+
requiredgates: Record<string, string>;
|
|
46
|
+
artifactplandigest: string;
|
|
47
|
+
targets: string[];
|
|
48
|
+
signingstatus: string;
|
|
49
|
+
evaluation: {
|
|
50
|
+
version: number;
|
|
51
|
+
decision: string;
|
|
52
|
+
reasons: string[];
|
|
53
|
+
subjectdigest: string;
|
|
54
|
+
requiredkinds: string[];
|
|
55
|
+
evidence: {
|
|
56
|
+
version: number;
|
|
57
|
+
kind: string;
|
|
58
|
+
status: string;
|
|
59
|
+
subjectdigest: string;
|
|
60
|
+
producer: string;
|
|
61
|
+
workflow: string;
|
|
62
|
+
verificationmethod: string;
|
|
63
|
+
verifiedat: number;
|
|
64
|
+
metadata: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
decision: string;
|
|
70
|
+
ready: boolean;
|
|
71
|
+
reasons: string[];
|
|
72
|
+
};
|
|
73
|
+
/** Maps an already-completed local checksum verification result to evidence records. */
|
|
74
|
+
export declare function evidencefromverification(input?: Record<string, unknown>): {
|
|
75
|
+
version: number;
|
|
76
|
+
releaseversion: string;
|
|
77
|
+
signingstatus: string;
|
|
78
|
+
evidence: {
|
|
79
|
+
version: number;
|
|
80
|
+
kind: string;
|
|
81
|
+
status: string;
|
|
82
|
+
subjectdigest: string;
|
|
83
|
+
producer: string;
|
|
84
|
+
workflow: string;
|
|
85
|
+
verificationmethod: string;
|
|
86
|
+
verifiedat: number;
|
|
87
|
+
metadata: {
|
|
88
|
+
[x: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../release/evidence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;EAalE;AAED,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;EAqBnE;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnE;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;EAoB3E"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Release evidence evaluates caller-supplied metadata without fetching, signing,
|
|
3
|
+
* scanning, publishing or claiming an artifact has more assurance than proven.
|
|
4
|
+
*/
|
|
5
|
+
const evidencestatuses = new Set(["notProvided", "declared", "parsed", "checked", "verified", "rejected", "unknown"]);
|
|
6
|
+
const verifiedstatuses = new Set(["checked", "verified"]);
|
|
7
|
+
/** Normalizes an immutable, caller-supplied artifact evidence record. */
|
|
8
|
+
export function releaseevidence(input = {}) {
|
|
9
|
+
const status = normalizestatus(input.status ?? "notProvided");
|
|
10
|
+
const kind = requiredtext(input.kind, "evidence kind");
|
|
11
|
+
const subjectdigest = optionaldigest(input.subjectdigest, "subject digest");
|
|
12
|
+
const producer = optionaltext(input.producer);
|
|
13
|
+
const workflow = optionaltext(input.workflow);
|
|
14
|
+
const method = optionaltext(input.verificationmethod);
|
|
15
|
+
const verifiedat = optionaltime(input.verifiedat, "verification time");
|
|
16
|
+
if (verifiedstatuses.has(status) && !subjectdigest)
|
|
17
|
+
throw new TypeError("checked evidence requires a subject digest");
|
|
18
|
+
if (verifiedstatuses.has(status) && !method)
|
|
19
|
+
throw new TypeError("checked evidence requires a verification method");
|
|
20
|
+
if (status === "verified" && !producer)
|
|
21
|
+
throw new TypeError("verified evidence requires a producer");
|
|
22
|
+
if (status === "verified" && !verifiedat)
|
|
23
|
+
throw new TypeError("verified evidence requires a verification time");
|
|
24
|
+
return { version: 1, kind, status, subjectdigest, producer, workflow, verificationmethod: method, verifiedat, metadata: objectcopy(input.metadata) };
|
|
25
|
+
}
|
|
26
|
+
/** Evaluates evidence against a caller-owned policy and returns reason codes, never a trust claim. */
|
|
27
|
+
export function evaluateevidence(input = {}) {
|
|
28
|
+
const evidence = Array.isArray(input.evidence) ? input.evidence.map((entry) => releaseevidence(objectvalue(entry, "evidence entry"))) : [];
|
|
29
|
+
const policy = objectcopy(input.policy);
|
|
30
|
+
const requiredkinds = stringlist(policy.requiredkinds, "required kinds");
|
|
31
|
+
const allowedstatuses = new Set(stringlist(policy.allowedstatuses ?? ["verified"], "allowed statuses"));
|
|
32
|
+
const expectedproducer = textmap(policy.expectedproducer, "expected producer");
|
|
33
|
+
const expectedworkflow = textmap(policy.expectedworkflow, "expected workflow");
|
|
34
|
+
const subjectdigest = optionaldigest(input.subjectdigest, "subject digest");
|
|
35
|
+
const reasons = new Set();
|
|
36
|
+
for (const kind of requiredkinds) {
|
|
37
|
+
const matches = evidence.filter((entry) => entry.kind === kind);
|
|
38
|
+
if (matches.length === 0) {
|
|
39
|
+
reasons.add(`required-evidence-missing:${kind}`);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const accepted = matches.some((entry) => evidenceaccepted(entry, { allowedstatuses, expectedproducer, expectedworkflow, subjectdigest }, reasons));
|
|
43
|
+
if (!accepted)
|
|
44
|
+
reasons.add(`required-evidence-unsatisfied:${kind}`);
|
|
45
|
+
}
|
|
46
|
+
const evaluated = requiredkinds.length === 0 ? evidence : evidence.filter((entry) => requiredkinds.includes(entry.kind));
|
|
47
|
+
for (const entry of evaluated)
|
|
48
|
+
evidenceaccepted(entry, { allowedstatuses, expectedproducer, expectedworkflow, subjectdigest }, reasons);
|
|
49
|
+
const ordered = [...reasons].sort();
|
|
50
|
+
const rejected = ordered.some((reason) => reason.startsWith("evidence-rejected:") || reason.startsWith("producer-mismatch:") || reason.startsWith("workflow-mismatch:") || reason.startsWith("subject-mismatch:"));
|
|
51
|
+
const decision = rejected ? "rejected" : ordered.length > 0 ? "insufficient" : "accepted";
|
|
52
|
+
return { version: 1, decision, reasons: ordered, subjectdigest, requiredkinds, evidence };
|
|
53
|
+
}
|
|
54
|
+
/** Builds a data-only readiness receipt for a release that a caller may later execute. */
|
|
55
|
+
export function releasereadiness(input = {}) {
|
|
56
|
+
const sourcetag = requiredtext(input.sourcetag, "source tag");
|
|
57
|
+
const manifestversions = textmap(input.manifestversions, "manifest versions");
|
|
58
|
+
const requiredgates = textmap(input.requiredgates, "required gates");
|
|
59
|
+
const artifactplandigest = optionaldigest(input.artifactplandigest, "artifact plan digest");
|
|
60
|
+
const targets = stringlist(input.targets, "publication targets");
|
|
61
|
+
const signingstatus = optionaltext(input.signingstatus) ?? "unknown";
|
|
62
|
+
const evaluation = evaluateevidence(objectvalue(input.evaluation, "evidence evaluation"));
|
|
63
|
+
const reasons = new Set(evaluation.reasons);
|
|
64
|
+
if (Object.values(manifestversions).some((value) => value !== sourcetag.replace(/^v/, "")))
|
|
65
|
+
reasons.add("manifest-version-mismatch");
|
|
66
|
+
for (const [gate, status] of Object.entries(requiredgates))
|
|
67
|
+
if (status !== "passed")
|
|
68
|
+
reasons.add(`required-gate-not-passed:${gate}`);
|
|
69
|
+
if (!artifactplandigest)
|
|
70
|
+
reasons.add("artifact-plan-digest-missing");
|
|
71
|
+
if (targets.length === 0)
|
|
72
|
+
reasons.add("publication-targets-missing");
|
|
73
|
+
if (signingstatus === "unknown")
|
|
74
|
+
reasons.add("signing-status-unknown");
|
|
75
|
+
const ordered = [...reasons].sort();
|
|
76
|
+
const decision = evaluation.decision === "rejected" ? "rejected" : ordered.length > 0 ? "insufficient" : "accepted";
|
|
77
|
+
return { version: 1, sourcetag, manifestversions, requiredgates, artifactplandigest, targets, signingstatus, evaluation, decision, ready: decision === "accepted", reasons: ordered };
|
|
78
|
+
}
|
|
79
|
+
/** Maps an already-completed local checksum verification result to evidence records. */
|
|
80
|
+
export function evidencefromverification(input = {}) {
|
|
81
|
+
const verification = objectvalue(input.verification, "verification result");
|
|
82
|
+
if (verification.valid !== true)
|
|
83
|
+
throw new TypeError("verification result must be valid");
|
|
84
|
+
const releaseversion = requiredtext(verification.version, "release version");
|
|
85
|
+
const signingstatus = requiredtext(verification.signing, "signing status");
|
|
86
|
+
const files = requiredarray(verification.files, "verification files");
|
|
87
|
+
if (files.length === 0)
|
|
88
|
+
throw new TypeError("verification files must not be empty");
|
|
89
|
+
const names = new Set();
|
|
90
|
+
const producer = optionaltext(input.producer);
|
|
91
|
+
const workflow = optionaltext(input.workflow);
|
|
92
|
+
const verificationmethod = optionaltext(input.verificationmethod) ?? "checksum-manifest";
|
|
93
|
+
const verifiedat = optionaltime(input.verifiedat, "verification time");
|
|
94
|
+
const evidence = files.map((file) => {
|
|
95
|
+
const entry = objectvalue(file, "verification file");
|
|
96
|
+
const name = requiredtext(entry.name, "artifact name");
|
|
97
|
+
if (names.has(name))
|
|
98
|
+
throw new TypeError(`duplicate verification artifact: ${name}`);
|
|
99
|
+
names.add(name);
|
|
100
|
+
return releaseevidence({ kind: "checksum", status: "checked", subjectdigest: entry.digest, producer, workflow, verificationmethod, verifiedat, metadata: { artifact: name, releaseversion, signingstatus } });
|
|
101
|
+
});
|
|
102
|
+
return { version: 1, releaseversion, signingstatus, evidence };
|
|
103
|
+
}
|
|
104
|
+
function evidenceaccepted(entry, policy, reasons) {
|
|
105
|
+
let accepted = true;
|
|
106
|
+
if (entry.status === "rejected") {
|
|
107
|
+
reasons.add(`evidence-rejected:${entry.kind}`);
|
|
108
|
+
accepted = false;
|
|
109
|
+
}
|
|
110
|
+
if (!policy.allowedstatuses.has(entry.status)) {
|
|
111
|
+
reasons.add(`evidence-status-not-allowed:${entry.kind}:${entry.status}`);
|
|
112
|
+
accepted = false;
|
|
113
|
+
}
|
|
114
|
+
if (policy.subjectdigest && entry.subjectdigest !== policy.subjectdigest) {
|
|
115
|
+
reasons.add(`subject-mismatch:${entry.kind}`);
|
|
116
|
+
accepted = false;
|
|
117
|
+
}
|
|
118
|
+
if (policy.expectedproducer[entry.kind] && entry.producer !== policy.expectedproducer[entry.kind]) {
|
|
119
|
+
reasons.add(`producer-mismatch:${entry.kind}`);
|
|
120
|
+
accepted = false;
|
|
121
|
+
}
|
|
122
|
+
if (policy.expectedworkflow[entry.kind] && entry.workflow !== policy.expectedworkflow[entry.kind]) {
|
|
123
|
+
reasons.add(`workflow-mismatch:${entry.kind}`);
|
|
124
|
+
accepted = false;
|
|
125
|
+
}
|
|
126
|
+
return accepted;
|
|
127
|
+
}
|
|
128
|
+
function normalizestatus(value) { const status = requiredtext(value, "evidence status"); if (!evidencestatuses.has(status))
|
|
129
|
+
throw new TypeError(`unknown evidence status: ${status}`); return status; }
|
|
130
|
+
function requiredtext(value, label) { const text = optionaltext(value); if (!text)
|
|
131
|
+
throw new TypeError(`${label} is required`); return text; }
|
|
132
|
+
function optionaltext(value) { const text = value === undefined || value === null ? undefined : String(value).trim(); return text || undefined; }
|
|
133
|
+
function optionaldigest(value, label) { const digest = optionaltext(value)?.toLowerCase(); if (digest && !/^[a-f0-9]{64}$/.test(digest))
|
|
134
|
+
throw new TypeError(`${label} must be a sha256 hex digest`); return digest; }
|
|
135
|
+
function optionaltime(value, label) { if (value === undefined || value === null)
|
|
136
|
+
return undefined; const time = Number(value); if (!Number.isFinite(time) || time < 0)
|
|
137
|
+
throw new TypeError(`${label} must be a non-negative finite number`); return time; }
|
|
138
|
+
function requiredarray(value, label) { if (!Array.isArray(value))
|
|
139
|
+
throw new TypeError(`${label} must be an array`); return value; }
|
|
140
|
+
function stringlist(value, label) { if (value === undefined || value === null)
|
|
141
|
+
return []; if (!Array.isArray(value))
|
|
142
|
+
throw new TypeError(`${label} must be an array`); return [...new Set(value.map((item) => requiredtext(item, label)))].sort(); }
|
|
143
|
+
function textmap(value, label) { if (value === undefined || value === null)
|
|
144
|
+
return {}; const source = objectvalue(value, label); return Object.fromEntries(Object.entries(source).map(([key, item]) => [requiredtext(key, label), requiredtext(item, label)])); }
|
|
145
|
+
function objectcopy(value) { return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {}; }
|
|
146
|
+
function objectvalue(value, label) { if (!value || typeof value !== "object" || Array.isArray(value))
|
|
147
|
+
throw new TypeError(`${label} must be an object`); return value; }
|
|
148
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../release/evidence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AACtH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAE1D,yEAAyE;AACzE,MAAM,UAAU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O,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAI,KAAiC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5J,SAAS,WAAW,CAAC,KAAc,EAAE,KAAa,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC,CAAC,OAAO,KAAgC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* provider chains rank caller-authorized execution candidates without dispatching remote work.
|
|
3
|
+
*/
|
|
4
|
+
/** Creates a stable provider chain over declarative capability reports. */
|
|
5
|
+
export declare function providerchain(input?: {}): Readonly<{
|
|
6
|
+
select(request?: {}): Readonly<{
|
|
7
|
+
version: 1;
|
|
8
|
+
selected: Readonly<{
|
|
9
|
+
id: any;
|
|
10
|
+
priority: any;
|
|
11
|
+
capabilities: readonly any[];
|
|
12
|
+
architecture: any;
|
|
13
|
+
operatingSystem: any;
|
|
14
|
+
networkpolicy: any;
|
|
15
|
+
storagepolicy: any;
|
|
16
|
+
cpu: any;
|
|
17
|
+
memorybytes: any;
|
|
18
|
+
maxmilliseconds: any;
|
|
19
|
+
}>;
|
|
20
|
+
rejected: readonly any[];
|
|
21
|
+
request: Readonly<{
|
|
22
|
+
capabilities: readonly string[];
|
|
23
|
+
preferredids: readonly string[];
|
|
24
|
+
architecture: string;
|
|
25
|
+
operatingSystem: string;
|
|
26
|
+
networkpolicy: string;
|
|
27
|
+
storagepolicy: string;
|
|
28
|
+
mincpu: number;
|
|
29
|
+
minmemorybytes: number;
|
|
30
|
+
minmilliseconds: number;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
dispatchplan(request?: {}): Readonly<{
|
|
34
|
+
version: 1;
|
|
35
|
+
state: "caller-dispatches";
|
|
36
|
+
provider: Readonly<{
|
|
37
|
+
id: any;
|
|
38
|
+
priority: any;
|
|
39
|
+
capabilities: readonly any[];
|
|
40
|
+
architecture: any;
|
|
41
|
+
operatingSystem: any;
|
|
42
|
+
networkpolicy: any;
|
|
43
|
+
storagepolicy: any;
|
|
44
|
+
cpu: any;
|
|
45
|
+
memorybytes: any;
|
|
46
|
+
maxmilliseconds: any;
|
|
47
|
+
}>;
|
|
48
|
+
request: Readonly<{
|
|
49
|
+
capabilities: readonly string[];
|
|
50
|
+
preferredids: readonly string[];
|
|
51
|
+
architecture: string;
|
|
52
|
+
operatingSystem: string;
|
|
53
|
+
networkpolicy: string;
|
|
54
|
+
storagepolicy: string;
|
|
55
|
+
mincpu: number;
|
|
56
|
+
minmemorybytes: number;
|
|
57
|
+
minmilliseconds: number;
|
|
58
|
+
}>;
|
|
59
|
+
rejected: readonly any[];
|
|
60
|
+
}>;
|
|
61
|
+
providers: () => {
|
|
62
|
+
capabilities: string[];
|
|
63
|
+
id: string;
|
|
64
|
+
priority: number;
|
|
65
|
+
status: string;
|
|
66
|
+
architecture: string;
|
|
67
|
+
operatingSystem: string;
|
|
68
|
+
networkpolicy: string;
|
|
69
|
+
storagepolicy: string;
|
|
70
|
+
cpu: number;
|
|
71
|
+
memorybytes: number;
|
|
72
|
+
maxmilliseconds: number;
|
|
73
|
+
}[];
|
|
74
|
+
}>;
|
|
75
|
+
/** Selects the first eligible provider under stable priority and returns every exclusion reason. */
|
|
76
|
+
export declare function selectprovider(providers: any, request?: {}): Readonly<{
|
|
77
|
+
version: 1;
|
|
78
|
+
selected: Readonly<{
|
|
79
|
+
id: any;
|
|
80
|
+
priority: any;
|
|
81
|
+
capabilities: readonly any[];
|
|
82
|
+
architecture: any;
|
|
83
|
+
operatingSystem: any;
|
|
84
|
+
networkpolicy: any;
|
|
85
|
+
storagepolicy: any;
|
|
86
|
+
cpu: any;
|
|
87
|
+
memorybytes: any;
|
|
88
|
+
maxmilliseconds: any;
|
|
89
|
+
}>;
|
|
90
|
+
rejected: readonly any[];
|
|
91
|
+
request: Readonly<{
|
|
92
|
+
capabilities: readonly string[];
|
|
93
|
+
preferredids: readonly string[];
|
|
94
|
+
architecture: string;
|
|
95
|
+
operatingSystem: string;
|
|
96
|
+
networkpolicy: string;
|
|
97
|
+
storagepolicy: string;
|
|
98
|
+
mincpu: number;
|
|
99
|
+
minmemorybytes: number;
|
|
100
|
+
minmilliseconds: number;
|
|
101
|
+
}>;
|
|
102
|
+
}>;
|
|
103
|
+
/** Produces a verified runner-to-storage handoff record without writing an artifact. */
|
|
104
|
+
export declare function artifacthandoff(input?: {}): Readonly<{
|
|
105
|
+
version: 1;
|
|
106
|
+
key: string;
|
|
107
|
+
sha256: string;
|
|
108
|
+
sizebytes: number;
|
|
109
|
+
providerid: string;
|
|
110
|
+
retention: string;
|
|
111
|
+
state: "caller-transfers";
|
|
112
|
+
}>;
|
|
113
|
+
/** Creates a cancellation intent without claiming that a remote runner has stopped or cleaned up. */
|
|
114
|
+
export declare function cancellationplan(input?: {}): Readonly<{
|
|
115
|
+
version: 1;
|
|
116
|
+
runid: string;
|
|
117
|
+
providerid: string;
|
|
118
|
+
reason: string;
|
|
119
|
+
state: "caller-cancels";
|
|
120
|
+
remotestate: "unknown";
|
|
121
|
+
compensation: "caller-evaluates" | "not-requested";
|
|
122
|
+
}>;
|
|
123
|
+
/** Renders a caller-dispatches plan through an injected forge adapter without sending it. */
|
|
124
|
+
export declare function renderdispatch(plan: any, adapter: any): Promise<any>;
|
|
125
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../runners/chain.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,KAAK,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGvC;AAED,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,SAAS,KAAA,EAAE,OAAO,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;GAcrD;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,KAAK,KAAK;;;;;;;;GAMzC;AAED,qGAAqG;AACrG,wBAAgB,gBAAgB,CAAC,KAAK,KAAK;;;;;;;;GAK1C;AAED,6FAA6F;AAC7F,wBAAsB,cAAc,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,gBAIjD"}
|