@akagilnc/pi-workflow-roles 0.1.3414 → 0.1.3439
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/archivist-record-entry.js +21 -12
- package/dist/archivist-record-topology.js +20 -0
- package/dist/auditor-dossier-tool.js +67 -76
- package/dist/canonical-json.js +66 -69
- package/dist/compliance-transport.js +99 -86
- package/dist/countersign-contracts.js +23 -25
- package/dist/doctor-contracts.js +169 -145
- package/dist/engine-detour-tool.js +83 -87
- package/dist/engine-detour.js +148 -183
- package/dist/evidence-child-executor.js +10 -1
- package/dist/exact-utf8.js +11 -10
- package/dist/git-object-id.js +10 -5
- package/dist/gleaner-left-contracts.js +33 -35
- package/dist/grok/production-host.js +229 -118
- package/dist/inspector-contracts.js +28 -31
- package/dist/institutional-resolution.js +101 -104
- package/dist/ledger-session-read.js +241 -0
- package/dist/merger-contracts.js +66 -56
- package/dist/notary-contracts.js +91 -100
- package/dist/open-tool-schema.js +32 -31
- package/dist/package-contracts/collector-output.js +56 -43
- package/dist/package-contracts/fixer-output.js +52 -50
- package/dist/package-contracts/fixer-packet.js +67 -64
- package/dist/package-contracts/gatekeeper-output.js +48 -56
- package/dist/package-contracts/judge-output.js +23 -20
- package/dist/package-contracts/navigator-output.js +35 -40
- package/dist/package-contracts/reviewer-output.js +94 -110
- package/dist/package-contracts/terminating-infrastructure.js +62 -90
- package/dist/package-contracts/worker-output.js +30 -11
- package/dist/package-resources/engine-material.js +58 -94
- package/dist/public-cli/config.js +420 -484
- package/dist/public-cli/main.js +1219 -524
- package/dist/public-cli/registry.js +107 -114
- package/dist/receipt-delivery-policy.js +74 -76
- package/dist/session-opening-materials.js +44 -47
- package/dist/sha256.js +5 -3
- package/dist/sitian-appender.js +204 -210
- package/dist/sitian-contracts.js +15 -19
- package/dist/sitian-facade.js +5 -10
- package/dist/sitian-reader.js +37 -46
- package/dist/stream-idle-guard.js +63 -71
- package/dist/ticket-seat-memory.js +244 -0
- package/package.json +1 -1
- package/scripts/build-package.mjs +41 -0
- package/src/analyst-gate-cycles-read.ts +152 -83
- package/src/analyst-ledger.ts +170 -43
- package/src/archivist-record-entry.ts +32 -11
- package/src/archivist-record-topology.ts +39 -0
- package/src/evidence-child-executor.ts +14 -1
- package/src/grok/production-host.ts +44 -9
- package/src/host-contracts.ts +18 -0
- package/src/host-transition-prior-native.ts +8 -1
- package/src/ledger-session-read.ts +56 -0
- package/src/pi/durable-principal.ts +6 -0
- package/src/public-cli/inspector-run.ts +21 -10
- package/src/public-cli/invocation.ts +4 -20
- package/src/public-cli/notary-run.ts +21 -4
- package/src/public-cli/post-admission.ts +333 -42
- package/src/public-cli/settlement.ts +266 -81
- package/src/session-opening-materials.ts +4 -2
- package/src/ticket-seat-memory.ts +454 -0
|
@@ -1,124 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
...PUBLIC_CALLABLE_ROLES,
|
|
1
|
+
import {
|
|
2
|
+
PACKAGED_ROLE_REGISTRY
|
|
3
|
+
} from "../packaged-role-registry.js";
|
|
4
|
+
const INTERNAL_ROLE_ENTRYPOINT_RELATIVE = "extensions/role-runtime.ts";
|
|
5
|
+
const PUBLIC_CALLABLE_ROLES = PACKAGED_ROLE_REGISTRY.map(
|
|
6
|
+
(entry) => entry.role
|
|
7
|
+
);
|
|
8
|
+
const PUBLIC_CONFIGURABLE_SEATS = [
|
|
9
|
+
...PUBLIC_CALLABLE_ROLES
|
|
11
10
|
];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const PUBLIC_CLI_SUPPORT_COMMANDS = [
|
|
12
|
+
"roles",
|
|
13
|
+
"config",
|
|
14
|
+
"help",
|
|
15
|
+
"resume"
|
|
17
16
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
export function seatModelOnly(seat) {
|
|
23
|
-
if (seat?.provider === undefined || seat.model === undefined)
|
|
24
|
-
return undefined;
|
|
25
|
-
return seat.thinking === undefined
|
|
26
|
-
? { provider: seat.provider, model: seat.model }
|
|
27
|
-
: { provider: seat.provider, model: seat.model, thinking: seat.thinking };
|
|
17
|
+
function seatModelOnly(seat) {
|
|
18
|
+
if (seat?.provider === void 0 || seat.model === void 0) return void 0;
|
|
19
|
+
return seat.thinking === void 0 ? { provider: seat.provider, model: seat.model } : { provider: seat.provider, model: seat.model, thinking: seat.thinking };
|
|
28
20
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Package startup candidates (#11): Codex family first, then Grok 4.5.
|
|
31
|
-
* Selection among candidates is credential-driven at resolve time.
|
|
32
|
-
*/
|
|
33
21
|
const STARTUP_CANDIDATES = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
22
|
+
judge: [
|
|
23
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "high" },
|
|
24
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
25
|
+
],
|
|
26
|
+
countersign: [
|
|
27
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "high" },
|
|
28
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
29
|
+
],
|
|
30
|
+
"gleaner-left": [
|
|
31
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "medium" },
|
|
32
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
33
|
+
],
|
|
34
|
+
reviewer: [
|
|
35
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "medium" },
|
|
36
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
37
|
+
],
|
|
38
|
+
coder: [
|
|
39
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
40
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
41
|
+
],
|
|
42
|
+
fixer: [
|
|
43
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
44
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
45
|
+
],
|
|
46
|
+
collector: [
|
|
47
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
48
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
49
|
+
],
|
|
50
|
+
doctor: [
|
|
51
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
52
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
53
|
+
],
|
|
54
|
+
merger: [
|
|
55
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
56
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
57
|
+
],
|
|
58
|
+
// #620: subordinate officers inherit gatekeeper; no package startup model.
|
|
59
|
+
notary: [],
|
|
60
|
+
// #453/#620/#639: gatekeeper callable but no package startup model — caller
|
|
61
|
+
// configures it or the institutional resolution applies on the province path.
|
|
62
|
+
gatekeeper: [],
|
|
63
|
+
inspector: [],
|
|
64
|
+
navigator: [
|
|
65
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "medium" },
|
|
66
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
67
|
+
]
|
|
80
68
|
};
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
function publicStartupCandidates(seat) {
|
|
70
|
+
return STARTUP_CANDIDATES[seat];
|
|
83
71
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
defaultPhase,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
const deterministic = PUBLIC_DETERMINISTIC_COMMANDS.map((name) => ({
|
|
111
|
-
kind: "deterministic",
|
|
112
|
-
name,
|
|
113
|
-
}));
|
|
114
|
-
return [...support, ...roles, ...deterministic];
|
|
72
|
+
const PUBLIC_DETERMINISTIC_COMMANDS = ["analyst"];
|
|
73
|
+
function listHelpCapabilities() {
|
|
74
|
+
const support = PUBLIC_CLI_SUPPORT_COMMANDS.map((name) => ({
|
|
75
|
+
kind: "support",
|
|
76
|
+
name
|
|
77
|
+
}));
|
|
78
|
+
const roles = PACKAGED_ROLE_REGISTRY.map((entry) => {
|
|
79
|
+
const phases = entry.phases;
|
|
80
|
+
const defaultPhase = phases.length === 1 && phases[0] === null ? null : phases.includes("apply") ? "apply" : phases[0] ?? null;
|
|
81
|
+
return {
|
|
82
|
+
kind: "role",
|
|
83
|
+
name: entry.role,
|
|
84
|
+
phases,
|
|
85
|
+
defaultPhase
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const deterministic = PUBLIC_DETERMINISTIC_COMMANDS.map(
|
|
89
|
+
(name) => ({
|
|
90
|
+
kind: "deterministic",
|
|
91
|
+
name
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
return [...support, ...roles, ...deterministic];
|
|
115
95
|
}
|
|
116
|
-
|
|
117
|
-
|
|
96
|
+
function isPublicCallableRole(value) {
|
|
97
|
+
return PUBLIC_CALLABLE_ROLES.includes(value);
|
|
118
98
|
}
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
function isPublicConfigurableSeat(value) {
|
|
100
|
+
return PUBLIC_CONFIGURABLE_SEATS.includes(value);
|
|
121
101
|
}
|
|
122
|
-
|
|
123
|
-
|
|
102
|
+
function isPublicCliSupportCommand(value) {
|
|
103
|
+
return PUBLIC_CLI_SUPPORT_COMMANDS.includes(value);
|
|
124
104
|
}
|
|
105
|
+
export {
|
|
106
|
+
INTERNAL_ROLE_ENTRYPOINT_RELATIVE,
|
|
107
|
+
PUBLIC_CALLABLE_ROLES,
|
|
108
|
+
PUBLIC_CLI_SUPPORT_COMMANDS,
|
|
109
|
+
PUBLIC_CONFIGURABLE_SEATS,
|
|
110
|
+
PUBLIC_DETERMINISTIC_COMMANDS,
|
|
111
|
+
isPublicCallableRole,
|
|
112
|
+
isPublicCliSupportCommand,
|
|
113
|
+
isPublicConfigurableSeat,
|
|
114
|
+
listHelpCapabilities,
|
|
115
|
+
publicStartupCandidates,
|
|
116
|
+
seatModelOnly
|
|
117
|
+
};
|
|
@@ -1,81 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const NO_RECEIPT_LIFECYCLE_ENTRY_TYPE = "ak-no-receipt-lifecycle";
|
|
1
|
+
const RECEIPT_DELIVERY_TURN_LIMIT = 2;
|
|
2
|
+
const RECEIPT_DELIVERY_PROMPT = "\u672C\u4F1A\u8BDD\u5C1A\u65E0\u5DF2\u63A5\u53D7\u7684 typed \u56DE\u6267\u3002";
|
|
3
|
+
const NO_RECEIPT_LIFECYCLE_ENTRY_TYPE = "ak-no-receipt-lifecycle";
|
|
5
4
|
function isRecord(value) {
|
|
6
|
-
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rejectedReceipts: input.rejectedReceipts.map((item) => ({
|
|
25
|
-
reason: item.reason,
|
|
26
|
-
diagnosticAvailable: item.reason.trim() !== "",
|
|
27
|
-
})),
|
|
28
|
-
deliveryTurns: RECEIPT_DELIVERY_TURN_LIMIT,
|
|
29
|
-
sessionCompletion: "settled-without-accepted-receipt",
|
|
30
|
-
runPointer: input.runPointer,
|
|
31
|
-
attemptPointer: input.attemptPointer,
|
|
32
|
-
acceptedReceipt: false,
|
|
33
|
-
};
|
|
7
|
+
function parseNoReceiptLifecycleFacts(input) {
|
|
8
|
+
if (!isRecord(input) || typeof input.terminalToolCalled !== "boolean" || input.deliveryTurns !== RECEIPT_DELIVERY_TURN_LIMIT || input.sessionCompletion !== "settled-without-accepted-receipt" || input.acceptedReceipt !== false || typeof input.runPointer !== "string" || input.runPointer.trim() === "" || typeof input.attemptPointer !== "string" || input.attemptPointer.trim() === "" || !Array.isArray(input.rejectedReceipts) || !input.rejectedReceipts.every((item) => isRecord(item) && typeof item.reason === "string")) {
|
|
9
|
+
throw new TypeError("malformed no-receipt lifecycle facts");
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
terminalToolCalled: input.terminalToolCalled,
|
|
13
|
+
rejectedReceipts: input.rejectedReceipts.map((item) => ({
|
|
14
|
+
reason: item.reason,
|
|
15
|
+
diagnosticAvailable: item.reason.trim() !== ""
|
|
16
|
+
})),
|
|
17
|
+
deliveryTurns: RECEIPT_DELIVERY_TURN_LIMIT,
|
|
18
|
+
sessionCompletion: "settled-without-accepted-receipt",
|
|
19
|
+
runPointer: input.runPointer,
|
|
20
|
+
attemptPointer: input.attemptPointer,
|
|
21
|
+
acceptedReceipt: false
|
|
22
|
+
};
|
|
34
23
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
function noReceiptLifecycleFacts(input) {
|
|
25
|
+
if (input.deliveryTurns !== RECEIPT_DELIVERY_TURN_LIMIT) {
|
|
26
|
+
throw new TypeError("no-receipt lifecycle requires an exhausted delivery budget");
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
terminalToolCalled: input.terminalToolCalled,
|
|
30
|
+
rejectedReceipts: input.rejectedReceipts.map(({ reason }) => ({
|
|
31
|
+
reason,
|
|
32
|
+
diagnosticAvailable: reason.trim() !== ""
|
|
33
|
+
})),
|
|
34
|
+
deliveryTurns: RECEIPT_DELIVERY_TURN_LIMIT,
|
|
35
|
+
sessionCompletion: "settled-without-accepted-receipt",
|
|
36
|
+
runPointer: input.runPointer,
|
|
37
|
+
attemptPointer: input.attemptPointer,
|
|
38
|
+
acceptedReceipt: false
|
|
39
|
+
};
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
41
|
+
function createReceiptDeliveryPolicy() {
|
|
42
|
+
let accepted = false;
|
|
43
|
+
let terminalToolCalled = false;
|
|
44
|
+
let deliveryTurns = 0;
|
|
45
|
+
const rejectedReceipts = [];
|
|
46
|
+
return {
|
|
47
|
+
recordAccepted() {
|
|
48
|
+
accepted = true;
|
|
49
|
+
terminalToolCalled = true;
|
|
50
|
+
},
|
|
51
|
+
/** Infrastructure owns terminality and must never trigger receipt催交. */
|
|
52
|
+
stopForInfrastructure() {
|
|
53
|
+
accepted = true;
|
|
54
|
+
},
|
|
55
|
+
recordRejected(reason) {
|
|
56
|
+
terminalToolCalled = true;
|
|
57
|
+
rejectedReceipts.push({ reason, diagnosticAvailable: reason.trim() !== "" });
|
|
58
|
+
deliveryTurns = Math.min(RECEIPT_DELIVERY_TURN_LIMIT, deliveryTurns + 1);
|
|
59
|
+
},
|
|
60
|
+
recordDeliveryRequest() {
|
|
61
|
+
deliveryTurns = Math.min(RECEIPT_DELIVERY_TURN_LIMIT, deliveryTurns + 1);
|
|
62
|
+
},
|
|
63
|
+
nextAction() {
|
|
64
|
+
if (accepted) return "accepted";
|
|
65
|
+
return deliveryTurns < RECEIPT_DELIVERY_TURN_LIMIT ? "request-delivery" : "no-receipt";
|
|
66
|
+
},
|
|
67
|
+
facts(binding) {
|
|
68
|
+
return noReceiptLifecycleFacts({ terminalToolCalled, rejectedReceipts: [...rejectedReceipts], deliveryTurns, ...binding });
|
|
69
|
+
}
|
|
70
|
+
};
|
|
81
71
|
}
|
|
72
|
+
export {
|
|
73
|
+
NO_RECEIPT_LIFECYCLE_ENTRY_TYPE,
|
|
74
|
+
RECEIPT_DELIVERY_PROMPT,
|
|
75
|
+
RECEIPT_DELIVERY_TURN_LIMIT,
|
|
76
|
+
createReceiptDeliveryPolicy,
|
|
77
|
+
noReceiptLifecycleFacts,
|
|
78
|
+
parseNoReceiptLifecycleFacts
|
|
79
|
+
};
|
|
@@ -1,61 +1,58 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session opening materials (#443 / #524). Missing files fail as native readFile
|
|
3
|
-
* errors. Main-role materials derive from PUBLIC_ROLE_RECORDS (including
|
|
4
|
-
* gatekeeper and navigator). Province map reuses that public gatekeeper record
|
|
5
|
-
* plus officer material constants (notary shared). Auditor composition stays in
|
|
6
|
-
* loadAuditorSoul; loaders share joinPackageMaterials.
|
|
7
|
-
*/
|
|
8
1
|
import { existsSync } from "node:fs";
|
|
9
2
|
import { readFile } from "node:fs/promises";
|
|
10
3
|
import { dirname, join } from "node:path";
|
|
11
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
5
|
+
import {
|
|
6
|
+
INSPECTOR_SESSION_MATERIALS,
|
|
7
|
+
NOTARY_SESSION_MATERIALS,
|
|
8
|
+
PUBLIC_ROLE_RECORDS
|
|
9
|
+
} from "./packaged-role-registry.js";
|
|
18
10
|
function resolvePackageRootDir(moduleUrl = import.meta.url) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
const parent = dirname(dir);
|
|
25
|
-
if (parent === dir)
|
|
26
|
-
break;
|
|
27
|
-
dir = parent;
|
|
11
|
+
let dir = dirname(fileURLToPath(moduleUrl));
|
|
12
|
+
for (let i = 0; i < 8; i += 1) {
|
|
13
|
+
if (existsSync(join(dir, "package.json")) && existsSync(join(dir, "souls"))) {
|
|
14
|
+
return dir;
|
|
28
15
|
}
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
const parent = dirname(dir);
|
|
17
|
+
if (parent === dir) break;
|
|
18
|
+
dir = parent;
|
|
19
|
+
}
|
|
20
|
+
return fileURLToPath(new URL("..", moduleUrl));
|
|
31
21
|
}
|
|
32
22
|
const packageRootUrl = pathToFileURL(resolvePackageRootDir() + "/").href;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return readFile(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
|
|
23
|
+
async function readPackageMaterial(relativePath) {
|
|
24
|
+
return readFile(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
|
|
36
25
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return chunks.join("\n\n");
|
|
26
|
+
async function joinPackageMaterials(relativePaths) {
|
|
27
|
+
const chunks = [];
|
|
28
|
+
for (const relativePath of relativePaths) {
|
|
29
|
+
chunks.push(await readPackageMaterial(relativePath));
|
|
30
|
+
}
|
|
31
|
+
return chunks.join("\n\n");
|
|
44
32
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
const MAIN_ROLE_SESSION_MATERIALS = {
|
|
34
|
+
...Object.fromEntries(
|
|
35
|
+
PUBLIC_ROLE_RECORDS.map((record) => [record.role, record.sessionMaterials])
|
|
36
|
+
)
|
|
48
37
|
};
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
function loadMainRoleSessionMaterials(role) {
|
|
39
|
+
return joinPackageMaterials(MAIN_ROLE_SESSION_MATERIALS[role]);
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
notary: NOTARY_SESSION_MATERIALS,
|
|
41
|
+
const GATEKEEPER_SESSION_MATERIALS = {
|
|
42
|
+
// #639: single authority — the public gatekeeper record owns the province list.
|
|
43
|
+
gatekeeper: PUBLIC_ROLE_RECORDS.find((entry) => entry.role === "gatekeeper").sessionMaterials,
|
|
44
|
+
inspector: INSPECTOR_SESSION_MATERIALS,
|
|
45
|
+
notary: NOTARY_SESSION_MATERIALS
|
|
58
46
|
};
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
function loadGatekeeperSessionMaterials(role) {
|
|
48
|
+
return joinPackageMaterials(GATEKEEPER_SESSION_MATERIALS[role]);
|
|
61
49
|
}
|
|
50
|
+
export {
|
|
51
|
+
GATEKEEPER_SESSION_MATERIALS,
|
|
52
|
+
MAIN_ROLE_SESSION_MATERIALS,
|
|
53
|
+
joinPackageMaterials,
|
|
54
|
+
loadGatekeeperSessionMaterials,
|
|
55
|
+
loadMainRoleSessionMaterials,
|
|
56
|
+
readPackageMaterial,
|
|
57
|
+
resolvePackageRootDir
|
|
58
|
+
};
|
package/dist/sha256.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return createHash("sha256").update(bytes).digest("hex");
|
|
2
|
+
function sha256Hex(bytes) {
|
|
3
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
5
4
|
}
|
|
5
|
+
export {
|
|
6
|
+
sha256Hex
|
|
7
|
+
};
|