@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.
Files changed (61) hide show
  1. package/dist/archivist-record-entry.js +21 -12
  2. package/dist/archivist-record-topology.js +20 -0
  3. package/dist/auditor-dossier-tool.js +67 -76
  4. package/dist/canonical-json.js +66 -69
  5. package/dist/compliance-transport.js +99 -86
  6. package/dist/countersign-contracts.js +23 -25
  7. package/dist/doctor-contracts.js +169 -145
  8. package/dist/engine-detour-tool.js +83 -87
  9. package/dist/engine-detour.js +148 -183
  10. package/dist/evidence-child-executor.js +10 -1
  11. package/dist/exact-utf8.js +11 -10
  12. package/dist/git-object-id.js +10 -5
  13. package/dist/gleaner-left-contracts.js +33 -35
  14. package/dist/grok/production-host.js +229 -118
  15. package/dist/inspector-contracts.js +28 -31
  16. package/dist/institutional-resolution.js +101 -104
  17. package/dist/ledger-session-read.js +241 -0
  18. package/dist/merger-contracts.js +66 -56
  19. package/dist/notary-contracts.js +91 -100
  20. package/dist/open-tool-schema.js +32 -31
  21. package/dist/package-contracts/collector-output.js +56 -43
  22. package/dist/package-contracts/fixer-output.js +52 -50
  23. package/dist/package-contracts/fixer-packet.js +67 -64
  24. package/dist/package-contracts/gatekeeper-output.js +48 -56
  25. package/dist/package-contracts/judge-output.js +23 -20
  26. package/dist/package-contracts/navigator-output.js +35 -40
  27. package/dist/package-contracts/reviewer-output.js +94 -110
  28. package/dist/package-contracts/terminating-infrastructure.js +62 -90
  29. package/dist/package-contracts/worker-output.js +30 -11
  30. package/dist/package-resources/engine-material.js +58 -94
  31. package/dist/public-cli/config.js +420 -484
  32. package/dist/public-cli/main.js +1219 -524
  33. package/dist/public-cli/registry.js +107 -114
  34. package/dist/receipt-delivery-policy.js +74 -76
  35. package/dist/session-opening-materials.js +44 -47
  36. package/dist/sha256.js +5 -3
  37. package/dist/sitian-appender.js +204 -210
  38. package/dist/sitian-contracts.js +15 -19
  39. package/dist/sitian-facade.js +5 -10
  40. package/dist/sitian-reader.js +37 -46
  41. package/dist/stream-idle-guard.js +63 -71
  42. package/dist/ticket-seat-memory.js +244 -0
  43. package/package.json +1 -1
  44. package/scripts/build-package.mjs +41 -0
  45. package/src/analyst-gate-cycles-read.ts +152 -83
  46. package/src/analyst-ledger.ts +170 -43
  47. package/src/archivist-record-entry.ts +32 -11
  48. package/src/archivist-record-topology.ts +39 -0
  49. package/src/evidence-child-executor.ts +14 -1
  50. package/src/grok/production-host.ts +44 -9
  51. package/src/host-contracts.ts +18 -0
  52. package/src/host-transition-prior-native.ts +8 -1
  53. package/src/ledger-session-read.ts +56 -0
  54. package/src/pi/durable-principal.ts +6 -0
  55. package/src/public-cli/inspector-run.ts +21 -10
  56. package/src/public-cli/invocation.ts +4 -20
  57. package/src/public-cli/notary-run.ts +21 -4
  58. package/src/public-cli/post-admission.ts +333 -42
  59. package/src/public-cli/settlement.ts +266 -81
  60. package/src/session-opening-materials.ts +4 -2
  61. package/src/ticket-seat-memory.ts +454 -0
@@ -1,124 +1,117 @@
1
- /**
2
- * Typed public CLI registry — sole source for discoverable commands, seats,
3
- * and startup model candidates (ADR 0052 / #105).
4
- */
5
- import { PACKAGED_ROLE_REGISTRY, } from "../packaged-role-registry.js";
6
- /** Package-relative path of the Internal role entrypoint (explicit load only). */
7
- export const INTERNAL_ROLE_ENTRYPOINT_RELATIVE = "extensions/role-runtime.ts";
8
- export const PUBLIC_CALLABLE_ROLES = PACKAGED_ROLE_REGISTRY.map((entry) => entry.role);
9
- export const PUBLIC_CONFIGURABLE_SEATS = [
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
- export const PUBLIC_CLI_SUPPORT_COMMANDS = [
13
- "roles",
14
- "config",
15
- "help",
16
- "resume",
11
+ const PUBLIC_CLI_SUPPORT_COMMANDS = [
12
+ "roles",
13
+ "config",
14
+ "help",
15
+ "resume"
17
16
  ];
18
- /**
19
- * Model-axis projection: incomplete seat row → undefined; else provider/model[/thinking].
20
- * Single implementation for config, institutional resolution, and display (#620).
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
- judge: [
35
- { provider: "openai-codex", model: "gpt-5.6-sol", thinking: "high" },
36
- { provider: "xai", model: "grok-4.5", thinking: "high" },
37
- ],
38
- countersign: [
39
- { provider: "openai-codex", model: "gpt-5.6-sol", thinking: "high" },
40
- { provider: "xai", model: "grok-4.5", thinking: "high" },
41
- ],
42
- "gleaner-left": [
43
- { provider: "openai-codex", model: "gpt-5.6-sol", thinking: "medium" },
44
- { provider: "xai", model: "grok-4.5", thinking: "high" },
45
- ],
46
- reviewer: [
47
- { provider: "openai-codex", model: "gpt-5.6-sol", thinking: "medium" },
48
- { provider: "xai", model: "grok-4.5", thinking: "high" },
49
- ],
50
- coder: [
51
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
52
- { provider: "xai", model: "grok-4.5", thinking: "high" },
53
- ],
54
- fixer: [
55
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
56
- { provider: "xai", model: "grok-4.5", thinking: "high" },
57
- ],
58
- collector: [
59
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
60
- { provider: "xai", model: "grok-4.5", thinking: "high" },
61
- ],
62
- doctor: [
63
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
64
- { provider: "xai", model: "grok-4.5", thinking: "high" },
65
- ],
66
- merger: [
67
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
68
- { provider: "xai", model: "grok-4.5", thinking: "high" },
69
- ],
70
- // #620: subordinate officers inherit gatekeeper; no package startup model.
71
- notary: [],
72
- // #453/#620/#639: gatekeeper callable but no package startup model — caller
73
- // configures it or the institutional resolution applies on the province path.
74
- gatekeeper: [],
75
- inspector: [],
76
- navigator: [
77
- { provider: "openai-codex", model: "gpt-5.6-luna", thinking: "medium" },
78
- { provider: "xai", model: "grok-4.5", thinking: "high" },
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
- export function publicStartupCandidates(seat) {
82
- return STARTUP_CANDIDATES[seat];
69
+ function publicStartupCandidates(seat) {
70
+ return STARTUP_CANDIDATES[seat];
83
71
  }
84
- /** Deterministic public commands — discoverable, never LLM-configurable seats. */
85
- export const PUBLIC_DETERMINISTIC_COMMANDS = ["analyst"];
86
- /**
87
- * Typed help surface. Presentation formats these facts; tests must not assert
88
- * exact help prose or layout (锚定宪法 / ADR 0016 / #105 AC).
89
- * analyst is a deterministic analysis command on the public CLI — not an LLM seat.
90
- */
91
- export function listHelpCapabilities() {
92
- const support = PUBLIC_CLI_SUPPORT_COMMANDS.map((name) => ({
93
- kind: "support",
94
- name,
95
- }));
96
- const roles = PACKAGED_ROLE_REGISTRY.map((entry) => {
97
- const phases = entry.phases;
98
- const defaultPhase = phases.length === 1 && phases[0] === null
99
- ? null
100
- : phases.includes("apply")
101
- ? "apply"
102
- : (phases[0] ?? null);
103
- return {
104
- kind: "role",
105
- name: entry.role,
106
- phases,
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
- export function isPublicCallableRole(value) {
117
- return PUBLIC_CALLABLE_ROLES.includes(value);
96
+ function isPublicCallableRole(value) {
97
+ return PUBLIC_CALLABLE_ROLES.includes(value);
118
98
  }
119
- export function isPublicConfigurableSeat(value) {
120
- return PUBLIC_CONFIGURABLE_SEATS.includes(value);
99
+ function isPublicConfigurableSeat(value) {
100
+ return PUBLIC_CONFIGURABLE_SEATS.includes(value);
121
101
  }
122
- export function isPublicCliSupportCommand(value) {
123
- return PUBLIC_CLI_SUPPORT_COMMANDS.includes(value);
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
- /** Shared accepted-receipt delivery budget for role, auditor, and Navigator sessions (#288). */
2
- export const RECEIPT_DELIVERY_TURN_LIMIT = 2;
3
- export const RECEIPT_DELIVERY_PROMPT = "本会话尚无已接受的 typed 回执。";
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
- return typeof value === "object" && value !== null && !Array.isArray(value);
5
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7
6
  }
8
- /** Read only the facts required by Terminal consumers; persisted extensions are ignored. */
9
- export function parseNoReceiptLifecycleFacts(input) {
10
- if (!isRecord(input)
11
- || typeof input.terminalToolCalled !== "boolean"
12
- || input.deliveryTurns !== RECEIPT_DELIVERY_TURN_LIMIT
13
- || input.sessionCompletion !== "settled-without-accepted-receipt"
14
- || input.acceptedReceipt !== false
15
- || typeof input.runPointer !== "string" || input.runPointer.trim() === ""
16
- || typeof input.attemptPointer !== "string" || input.attemptPointer.trim() === ""
17
- || !Array.isArray(input.rejectedReceipts)
18
- || !input.rejectedReceipts.every((item) => isRecord(item)
19
- && typeof item.reason === "string")) {
20
- throw new TypeError("malformed no-receipt lifecycle facts");
21
- }
22
- return {
23
- terminalToolCalled: input.terminalToolCalled,
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
- export function noReceiptLifecycleFacts(input) {
36
- if (input.deliveryTurns !== RECEIPT_DELIVERY_TURN_LIMIT) {
37
- throw new TypeError("no-receipt lifecycle requires an exhausted delivery budget");
38
- }
39
- return {
40
- terminalToolCalled: input.terminalToolCalled,
41
- rejectedReceipts: input.rejectedReceipts.map(({ reason }) => ({
42
- reason,
43
- diagnosticAvailable: reason.trim() !== "",
44
- })),
45
- deliveryTurns: RECEIPT_DELIVERY_TURN_LIMIT,
46
- sessionCompletion: "settled-without-accepted-receipt",
47
- runPointer: input.runPointer,
48
- attemptPointer: input.attemptPointer,
49
- acceptedReceipt: false,
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
- export function createReceiptDeliveryPolicy() {
53
- let accepted = false;
54
- let terminalToolCalled = false;
55
- let deliveryTurns = 0;
56
- const rejectedReceipts = [];
57
- return {
58
- recordAccepted() {
59
- accepted = true;
60
- terminalToolCalled = true;
61
- },
62
- /** Infrastructure owns terminality and must never trigger receipt催交. */
63
- stopForInfrastructure() { accepted = true; },
64
- recordRejected(reason) {
65
- terminalToolCalled = true;
66
- rejectedReceipts.push({ reason, diagnosticAvailable: reason.trim() !== "" });
67
- deliveryTurns = Math.min(RECEIPT_DELIVERY_TURN_LIMIT, deliveryTurns + 1);
68
- },
69
- recordDeliveryRequest() {
70
- deliveryTurns = Math.min(RECEIPT_DELIVERY_TURN_LIMIT, deliveryTurns + 1);
71
- },
72
- nextAction() {
73
- if (accepted)
74
- return "accepted";
75
- return deliveryTurns < RECEIPT_DELIVERY_TURN_LIMIT ? "request-delivery" : "no-receipt";
76
- },
77
- facts(binding) {
78
- return noReceiptLifecycleFacts({ terminalToolCalled, rejectedReceipts: [...rejectedReceipts], deliveryTurns, ...binding });
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 { INSPECTOR_SESSION_MATERIALS, NOTARY_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, } from "./packaged-role-registry.js";
13
- /**
14
- * Resolve the install package root from this module's location.
15
- * Works for src/ layout and for bundled artifacts under dist/ (walk up until
16
- * package.json + souls/ — the shipped material tree).
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
- let dir = dirname(fileURLToPath(moduleUrl));
20
- for (let i = 0; i < 8; i += 1) {
21
- if (existsSync(join(dir, "package.json")) && existsSync(join(dir, "souls"))) {
22
- return dir;
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
- // Legacy fallback: module lived directly under src/.
30
- return fileURLToPath(new URL("..", moduleUrl));
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
- /** Self-locate one package-relative material. Native I/O errors propagate. */
34
- export async function readPackageMaterial(relativePath) {
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
- /** Read materials in order and join with a blank line. */
38
- export async function joinPackageMaterials(relativePaths) {
39
- const chunks = [];
40
- for (const relativePath of relativePaths) {
41
- chunks.push(await readPackageMaterial(relativePath));
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
- /** Derived projection: public records (#639 includes navigator/gatekeeper). */
46
- export const MAIN_ROLE_SESSION_MATERIALS = {
47
- ...Object.fromEntries(PUBLIC_ROLE_RECORDS.map((record) => [record.role, record.sessionMaterials])),
33
+ const MAIN_ROLE_SESSION_MATERIALS = {
34
+ ...Object.fromEntries(
35
+ PUBLIC_ROLE_RECORDS.map((record) => [record.role, record.sessionMaterials])
36
+ )
48
37
  };
49
- export function loadMainRoleSessionMaterials(role) {
50
- return joinPackageMaterials(MAIN_ROLE_SESSION_MATERIALS[role]);
38
+ function loadMainRoleSessionMaterials(role) {
39
+ return joinPackageMaterials(MAIN_ROLE_SESSION_MATERIALS[role]);
51
40
  }
52
- /** Gatekeeper province; notary reuses the public notary materials definition. */
53
- export const GATEKEEPER_SESSION_MATERIALS = {
54
- // #639: single authority — the public gatekeeper record owns the province list.
55
- gatekeeper: PUBLIC_ROLE_RECORDS.find((entry) => entry.role === "gatekeeper").sessionMaterials,
56
- inspector: INSPECTOR_SESSION_MATERIALS,
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
- export function loadGatekeeperSessionMaterials(role) {
60
- return joinPackageMaterials(GATEKEEPER_SESSION_MATERIALS[role]);
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
- /** Canonical lowercase SHA-256 encoding shared by reviewer identity seams. */
3
- export function sha256Hex(bytes) {
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
+ };