@akagilnc/pi-workflow-roles 0.1.5955 → 0.1.6014
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 +1 -1
- package/dist/acp-host/production-host.js +5 -47
- package/dist/countersign-contracts.js +2 -22
- package/dist/countersign-role.js +0 -8
- package/dist/doctor-contracts.js +0 -1
- package/dist/gleaner-left-contracts.js +1 -18
- package/dist/gleaner-left-role.js +1 -2
- package/dist/headless-host/production-host.js +8 -50
- package/dist/inspector-role.js +0 -2
- package/dist/judge-role.js +1 -7
- package/dist/migrate-book-topology.js +0 -16
- package/dist/navigator-route-table.js +0 -1
- package/dist/notary-contracts.js +1 -16
- package/dist/package-contracts/auditor-output.js +1 -2
- package/dist/package-contracts/gatekeeper-output.js +0 -4
- package/dist/package-contracts/terminating-tools.js +1 -3
- package/dist/package-resources/engine-material.js +1 -8
- package/dist/pi/role-turn-host.js +0 -3
- package/dist/public-cli/cli.js +1 -23
- package/dist/public-cli/config.js +0 -4
- package/dist/public-cli/invocation.js +0 -4
- package/dist/public-cli/main.js +1 -41
- package/dist/public-cli/option-definitions.js +0 -8
- package/package.json +1 -1
- package/scripts/build-package.mjs +0 -1
- package/souls/design-law.md +1 -0
- package/souls/quality-law.md +2 -1
- package/src/countersign-contracts.ts +1 -21
- package/src/countersign-role.ts +1 -8
- package/src/doctor-contracts.ts +0 -1
- package/src/gleaner-left-contracts.ts +0 -17
- package/src/gleaner-left-role.ts +0 -2
- package/src/inspector-role.ts +1 -3
- package/src/judge-role.ts +1 -3
- package/src/navigator-route-table.ts +0 -2
- package/src/notary-contracts.ts +1 -26
- package/src/package-contracts/auditor-output.ts +1 -3
- package/src/package-contracts/gatekeeper-output.ts +0 -10
- package/src/package-contracts/terminating-tools.ts +2 -4
- package/src/package-resources/engine-material.ts +1 -16
- package/src/pi/role-turn-host.ts +0 -3
- package/src/public-cli/cli.ts +0 -24
- package/src/public-cli/config.ts +2 -8
- package/src/public-cli/invocation.ts +0 -28
- package/src/public-cli/option-definitions.ts +1 -10
- package/dist/canonical-json.js +0 -75
- package/dist/judge-recording-anti-forge.js +0 -39
- package/src/canonical-json.ts +0 -74
- package/src/judge-recording-anti-forge.ts +0 -53
|
@@ -1042,7 +1042,7 @@ export function createTypedOptionConsumer(
|
|
|
1042
1042
|
};
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
|
-
/** Structured option projection used by help
|
|
1045
|
+
/** Structured option projection used by help. */
|
|
1046
1046
|
export type StructuredOptionProjection = {
|
|
1047
1047
|
readonly id: string;
|
|
1048
1048
|
readonly owner: OptionOwner;
|
|
@@ -1091,15 +1091,6 @@ export function projectOwnerOptions(
|
|
|
1091
1091
|
}));
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
/** All rejected spelling tokens flattened (for leakage scans). */
|
|
1095
|
-
export function allRejectedSpellingTokens(): readonly string[] {
|
|
1096
|
-
const out: string[] = [];
|
|
1097
|
-
for (const entry of REJECTED_PUBLIC_SPELLINGS) {
|
|
1098
|
-
out.push(...entry.spellings);
|
|
1099
|
-
}
|
|
1100
|
-
return out;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
1094
|
/**
|
|
1104
1095
|
* #125 — public command help facts on the sole option-owner module.
|
|
1105
1096
|
* Presentation inputs only (USAGE synopsis + public `ak-role` examples).
|
package/dist/canonical-json.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
const CANONICAL_JSON_VALIDATION_ERROR_CODE = "canonical-json-invalid";
|
|
2
|
-
class CanonicalJsonValidationError extends Error {
|
|
3
|
-
constructor(path, reason) {
|
|
4
|
-
super(`Canonical JSON validation failed at ${path}: ${reason}`);
|
|
5
|
-
this.path = path;
|
|
6
|
-
this.reason = reason;
|
|
7
|
-
this.name = "CanonicalJsonValidationError";
|
|
8
|
-
}
|
|
9
|
-
path;
|
|
10
|
-
reason;
|
|
11
|
-
code = CANONICAL_JSON_VALIDATION_ERROR_CODE;
|
|
12
|
-
}
|
|
13
|
-
function childPath(path, segment) {
|
|
14
|
-
return `${path}/${String(segment).replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
15
|
-
}
|
|
16
|
-
function ownStringKeys(value, path) {
|
|
17
|
-
const keys = Reflect.ownKeys(value);
|
|
18
|
-
if (keys.some((key) => typeof key === "symbol")) {
|
|
19
|
-
throw new CanonicalJsonValidationError(childPath(path, "<symbol>"), "symbol-keyed member is not a JSON member");
|
|
20
|
-
}
|
|
21
|
-
return keys;
|
|
22
|
-
}
|
|
23
|
-
function canonicalJson(value) {
|
|
24
|
-
const ancestors = /* @__PURE__ */ new WeakSet();
|
|
25
|
-
const serialize = (item, path) => {
|
|
26
|
-
if (item === null) return "null";
|
|
27
|
-
switch (typeof item) {
|
|
28
|
-
case "boolean":
|
|
29
|
-
case "string":
|
|
30
|
-
return JSON.stringify(item);
|
|
31
|
-
case "number":
|
|
32
|
-
if (!Number.isFinite(item)) throw new CanonicalJsonValidationError(path, "number must be finite");
|
|
33
|
-
return JSON.stringify(item);
|
|
34
|
-
case "undefined":
|
|
35
|
-
case "function":
|
|
36
|
-
case "symbol":
|
|
37
|
-
case "bigint":
|
|
38
|
-
throw new CanonicalJsonValidationError(path, `${typeof item} is not a JSON value`);
|
|
39
|
-
case "object": {
|
|
40
|
-
if (ancestors.has(item)) throw new CanonicalJsonValidationError(path, "cycle is not a JSON value");
|
|
41
|
-
ancestors.add(item);
|
|
42
|
-
try {
|
|
43
|
-
if (Array.isArray(item)) {
|
|
44
|
-
if (Object.getPrototypeOf(item) !== Array.prototype) throw new CanonicalJsonValidationError(path, "array must not be a custom object");
|
|
45
|
-
const keys = ownStringKeys(item, path);
|
|
46
|
-
const extraKey = keys.find((key) => key !== "length" && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= item.length));
|
|
47
|
-
if (extraKey !== void 0) throw new CanonicalJsonValidationError(childPath(path, extraKey), "non-index array member is not a JSON member");
|
|
48
|
-
const values = [];
|
|
49
|
-
for (let index = 0; index < item.length; index += 1) {
|
|
50
|
-
if (!Object.hasOwn(item, index)) throw new CanonicalJsonValidationError(childPath(path, index), "sparse array slot is not a JSON value");
|
|
51
|
-
values.push(serialize(item[index], childPath(path, index)));
|
|
52
|
-
}
|
|
53
|
-
return `[${values.join(",")}]`;
|
|
54
|
-
}
|
|
55
|
-
const prototype = Object.getPrototypeOf(item);
|
|
56
|
-
if (prototype !== Object.prototype && prototype !== null) throw new CanonicalJsonValidationError(path, "object must be a plain record");
|
|
57
|
-
return `{${ownStringKeys(item, path).sort().map((key) => `${JSON.stringify(key)}:${serialize(item[key], childPath(path, key))}`).join(",")}}`;
|
|
58
|
-
} finally {
|
|
59
|
-
ancestors.delete(item);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
throw new Error("Unreachable canonical JSON value type");
|
|
64
|
-
};
|
|
65
|
-
return serialize(value, "$");
|
|
66
|
-
}
|
|
67
|
-
function canonicalJsonBytes(value) {
|
|
68
|
-
return new TextEncoder().encode(canonicalJson(value));
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
CANONICAL_JSON_VALIDATION_ERROR_CODE,
|
|
72
|
-
CanonicalJsonValidationError,
|
|
73
|
-
canonicalJson,
|
|
74
|
-
canonicalJsonBytes
|
|
75
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { sha256Hex } from "./sha256.js";
|
|
2
|
-
/**
|
|
3
|
-
* On-demand anti-forge for judge recordings.
|
|
4
|
-
*
|
|
5
|
-
* Standing CI must not byte-pin soul free text. Call these only when a
|
|
6
|
-
* concrete recording is being consumed as evidence and must be checked
|
|
7
|
-
* against the soul body supplied at that moment (current or packaged).
|
|
8
|
-
*/
|
|
9
|
-
export function soulTextDigest(soulText) {
|
|
10
|
-
return sha256Hex(soulText);
|
|
11
|
-
}
|
|
12
|
-
export function assertRecordingSoulDigest(options) {
|
|
13
|
-
if (typeof options.claimedDigest !== "string") {
|
|
14
|
-
throw new Error(`${options.label} metadata soulDigest must be a string`);
|
|
15
|
-
}
|
|
16
|
-
const actual = soulTextDigest(options.soulText);
|
|
17
|
-
if (actual !== options.claimedDigest) {
|
|
18
|
-
throw new Error(`${options.label} metadata soulDigest must match the soul supplied at consumption`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Construct-at-consumption check: resolve the packaged soul via the injected
|
|
23
|
-
* reader, then verify meta.soulDigest. Reader is injected so callers control
|
|
24
|
-
* git/fs access and tests stay synthetic.
|
|
25
|
-
*/
|
|
26
|
-
export function assertPackagedSoulMatchesMeta(meta, label, readPackagedSoul) {
|
|
27
|
-
if (typeof meta.packageSha !== "string") {
|
|
28
|
-
throw new Error(`${label} metadata packageSha must be a string`);
|
|
29
|
-
}
|
|
30
|
-
if (typeof meta.soulDigest !== "string") {
|
|
31
|
-
throw new Error(`${label} metadata soulDigest must be a string`);
|
|
32
|
-
}
|
|
33
|
-
const packagedSoul = readPackagedSoul(meta.packageSha, label);
|
|
34
|
-
assertRecordingSoulDigest({
|
|
35
|
-
claimedDigest: meta.soulDigest,
|
|
36
|
-
soulText: packagedSoul,
|
|
37
|
-
label,
|
|
38
|
-
});
|
|
39
|
-
}
|
package/src/canonical-json.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export const CANONICAL_JSON_VALIDATION_ERROR_CODE = "canonical-json-invalid" as const;
|
|
2
|
-
|
|
3
|
-
export class CanonicalJsonValidationError extends Error {
|
|
4
|
-
readonly code = CANONICAL_JSON_VALIDATION_ERROR_CODE;
|
|
5
|
-
|
|
6
|
-
constructor(readonly path: string, readonly reason: string) {
|
|
7
|
-
super(`Canonical JSON validation failed at ${path}: ${reason}`);
|
|
8
|
-
this.name = "CanonicalJsonValidationError";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function childPath(path: string, segment: string | number): string {
|
|
13
|
-
return `${path}/${String(segment).replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function ownStringKeys(value: object, path: string): string[] {
|
|
17
|
-
const keys = Reflect.ownKeys(value);
|
|
18
|
-
if (keys.some((key) => typeof key === "symbol")) {
|
|
19
|
-
throw new CanonicalJsonValidationError(childPath(path, "<symbol>"), "symbol-keyed member is not a JSON member");
|
|
20
|
-
}
|
|
21
|
-
return keys as string[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** Deterministic serialization of the closed JSON value domain. */
|
|
25
|
-
export function canonicalJson(value: unknown): string {
|
|
26
|
-
const ancestors = new WeakSet<object>();
|
|
27
|
-
|
|
28
|
-
const serialize = (item: unknown, path: string): string => {
|
|
29
|
-
if (item === null) return "null";
|
|
30
|
-
switch (typeof item) {
|
|
31
|
-
case "boolean":
|
|
32
|
-
case "string":
|
|
33
|
-
return JSON.stringify(item);
|
|
34
|
-
case "number":
|
|
35
|
-
if (!Number.isFinite(item)) throw new CanonicalJsonValidationError(path, "number must be finite");
|
|
36
|
-
return JSON.stringify(item);
|
|
37
|
-
case "undefined":
|
|
38
|
-
case "function":
|
|
39
|
-
case "symbol":
|
|
40
|
-
case "bigint":
|
|
41
|
-
throw new CanonicalJsonValidationError(path, `${typeof item} is not a JSON value`);
|
|
42
|
-
case "object": {
|
|
43
|
-
if (ancestors.has(item)) throw new CanonicalJsonValidationError(path, "cycle is not a JSON value");
|
|
44
|
-
ancestors.add(item);
|
|
45
|
-
try {
|
|
46
|
-
if (Array.isArray(item)) {
|
|
47
|
-
if (Object.getPrototypeOf(item) !== Array.prototype) throw new CanonicalJsonValidationError(path, "array must not be a custom object");
|
|
48
|
-
const keys = ownStringKeys(item, path);
|
|
49
|
-
const extraKey = keys.find((key) => key !== "length" && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= item.length));
|
|
50
|
-
if (extraKey !== undefined) throw new CanonicalJsonValidationError(childPath(path, extraKey), "non-index array member is not a JSON member");
|
|
51
|
-
const values: string[] = [];
|
|
52
|
-
for (let index = 0; index < item.length; index += 1) {
|
|
53
|
-
if (!Object.hasOwn(item, index)) throw new CanonicalJsonValidationError(childPath(path, index), "sparse array slot is not a JSON value");
|
|
54
|
-
values.push(serialize(item[index], childPath(path, index)));
|
|
55
|
-
}
|
|
56
|
-
return `[${values.join(",")}]`;
|
|
57
|
-
}
|
|
58
|
-
const prototype = Object.getPrototypeOf(item);
|
|
59
|
-
if (prototype !== Object.prototype && prototype !== null) throw new CanonicalJsonValidationError(path, "object must be a plain record");
|
|
60
|
-
return `{${ownStringKeys(item, path).sort().map((key) => `${JSON.stringify(key)}:${serialize((item as Record<string, unknown>)[key], childPath(path, key))}`).join(",")}}`;
|
|
61
|
-
} finally {
|
|
62
|
-
ancestors.delete(item);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
throw new Error("Unreachable canonical JSON value type");
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return serialize(value, "$");
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function canonicalJsonBytes(value: unknown): Uint8Array {
|
|
73
|
-
return new TextEncoder().encode(canonicalJson(value));
|
|
74
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { sha256Hex } from "./sha256.ts";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* On-demand anti-forge for judge recordings.
|
|
5
|
-
*
|
|
6
|
-
* Standing CI must not byte-pin soul free text. Call these only when a
|
|
7
|
-
* concrete recording is being consumed as evidence and must be checked
|
|
8
|
-
* against the soul body supplied at that moment (current or packaged).
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export function soulTextDigest(soulText: string): string {
|
|
12
|
-
return sha256Hex(soulText);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function assertRecordingSoulDigest(options: {
|
|
16
|
-
claimedDigest: unknown;
|
|
17
|
-
soulText: string;
|
|
18
|
-
label: string;
|
|
19
|
-
}): void {
|
|
20
|
-
if (typeof options.claimedDigest !== "string") {
|
|
21
|
-
throw new Error(`${options.label} metadata soulDigest must be a string`);
|
|
22
|
-
}
|
|
23
|
-
const actual = soulTextDigest(options.soulText);
|
|
24
|
-
if (actual !== options.claimedDigest) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
`${options.label} metadata soulDigest must match the soul supplied at consumption`,
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Construct-at-consumption check: resolve the packaged soul via the injected
|
|
33
|
-
* reader, then verify meta.soulDigest. Reader is injected so callers control
|
|
34
|
-
* git/fs access and tests stay synthetic.
|
|
35
|
-
*/
|
|
36
|
-
export function assertPackagedSoulMatchesMeta(
|
|
37
|
-
meta: Record<string, unknown>,
|
|
38
|
-
label: string,
|
|
39
|
-
readPackagedSoul: (packageSha: string, label: string) => string,
|
|
40
|
-
): void {
|
|
41
|
-
if (typeof meta.packageSha !== "string") {
|
|
42
|
-
throw new Error(`${label} metadata packageSha must be a string`);
|
|
43
|
-
}
|
|
44
|
-
if (typeof meta.soulDigest !== "string") {
|
|
45
|
-
throw new Error(`${label} metadata soulDigest must be a string`);
|
|
46
|
-
}
|
|
47
|
-
const packagedSoul = readPackagedSoul(meta.packageSha, label);
|
|
48
|
-
assertRecordingSoulDigest({
|
|
49
|
-
claimedDigest: meta.soulDigest,
|
|
50
|
-
soulText: packagedSoul,
|
|
51
|
-
label,
|
|
52
|
-
});
|
|
53
|
-
}
|