@akagilnc/pi-workflow-roles 0.1.5365 → 0.1.5375

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 (170) hide show
  1. package/dist/acp-host/production-host.js +5585 -5655
  2. package/dist/activation-ledger-git.js +2 -2
  3. package/dist/activation-ledger-topology.js +1 -7
  4. package/dist/analyst-entry.js +4 -8
  5. package/dist/analyst-gate-cycles-read.js +3 -11
  6. package/dist/analyst-index.js +3 -9
  7. package/dist/analyst-ledger.js +1 -11
  8. package/dist/analyst-metric-families/acceptance-success-rework.js +1 -3
  9. package/dist/analyst-metric-families/round-timeline.js +1 -3
  10. package/dist/analyst-page.js +2 -2
  11. package/dist/archivist-record-topology.js +2 -2
  12. package/dist/audit-escalation.js +2 -1
  13. package/dist/auditor-soul.js +2 -1
  14. package/dist/collector-config.js +6 -8
  15. package/dist/compliance-transport.js +2 -1
  16. package/dist/countersign-contracts.js +2 -1
  17. package/dist/diarist-contracts.js +3 -2
  18. package/dist/doctor-contracts.js +1 -3
  19. package/dist/doctor-evidence.js +7 -8
  20. package/dist/dossier-resolution.js +1 -3
  21. package/dist/engine-detour-usage.js +1 -3
  22. package/dist/gatekeeper-role.js +2 -9
  23. package/dist/gleaner-left-contracts.js +2 -1
  24. package/dist/headless-host/description.js +14 -17
  25. package/dist/headless-host/production-host.js +1665 -1737
  26. package/dist/host-session-record.js +3 -2
  27. package/dist/inspector-contracts.js +2 -1
  28. package/dist/ledger-session-read.js +1 -3
  29. package/dist/merger-contracts.js +9 -9
  30. package/dist/migrate-book-topology.js +348 -314
  31. package/dist/navigator-attendance.js +9 -11
  32. package/dist/navigator-invocation-identity.js +3 -2
  33. package/dist/navigator-public-session.js +3 -5
  34. package/dist/navigator-session-contracts.js +8 -10
  35. package/dist/navigator-work-base.js +5 -8
  36. package/dist/notary-contracts.js +3 -5
  37. package/dist/package-contracts/auditor-output.js +1 -3
  38. package/dist/package-contracts/fixer-packet.js +3 -6
  39. package/dist/package-contracts/gatekeeper-output.js +1 -3
  40. package/dist/package-contracts/navigator-output.js +8 -8
  41. package/dist/package-contracts/terminating-infrastructure.js +5 -9
  42. package/dist/package-contracts/terminating-tools.js +4 -3
  43. package/dist/public-cli/analyst-run.js +3 -2
  44. package/dist/public-cli/auto-resume.js +4 -9
  45. package/dist/public-cli/cli.js +66 -64
  46. package/dist/public-cli/config.js +12 -11
  47. package/dist/public-cli/countersign-run.js +1 -3
  48. package/dist/public-cli/host-providers.js +7 -14
  49. package/dist/public-cli/instruction-seat-run.js +69 -43
  50. package/dist/public-cli/invocation.js +141 -136
  51. package/dist/public-cli/main.js +1919 -1968
  52. package/dist/public-cli/post-admission.js +89 -89
  53. package/dist/public-cli/role-seat-runtime.js +29 -0
  54. package/dist/public-cli/run-lifecycle.js +20 -32
  55. package/dist/public-cli/settlement.js +10 -26
  56. package/dist/public-cli/turn-request.js +14 -0
  57. package/dist/public-role-summons.js +23 -35
  58. package/dist/receipt-delivery-policy.js +1 -3
  59. package/dist/role-run-placement.js +7 -5
  60. package/dist/role-run-relocation.js +12 -19
  61. package/dist/run-terminal-artifacts.js +1 -11
  62. package/dist/run-ticket-number.js +2 -4
  63. package/dist/session-assistant-usage.js +2 -1
  64. package/dist/session-dialogue.js +1 -14
  65. package/dist/sitian-reader.js +2 -4
  66. package/dist/submission-correctable-error.js +2 -1
  67. package/dist/submission-errors.js +2 -1
  68. package/dist/submission-gate.js +2 -1
  69. package/dist/submission-ledger.js +4 -5
  70. package/dist/ticket-provenance-contracts.js +1 -3
  71. package/dist/ticket-provenance.js +2 -1
  72. package/dist/typed-provider-http.js +4 -7
  73. package/dist/unknown-value.js +28 -0
  74. package/dist/user-dialogue-stdin.js +2 -1
  75. package/package.json +1 -1
  76. package/src/acp-host/role-turn-host.ts +4 -2
  77. package/src/activation-ledger-git.ts +3 -2
  78. package/src/activation-ledger-topology.ts +4 -12
  79. package/src/analyst-entry.ts +3 -11
  80. package/src/analyst-gate-cycles-read.ts +3 -15
  81. package/src/analyst-index.ts +3 -13
  82. package/src/analyst-ledger.ts +2 -16
  83. package/src/analyst-metric-families/acceptance-success-rework.ts +2 -4
  84. package/src/analyst-metric-families/round-timeline.ts +2 -4
  85. package/src/analyst-page.ts +2 -2
  86. package/src/archivist-record-topology.ts +2 -2
  87. package/src/audit-escalation.ts +2 -1
  88. package/src/auditor-soul.ts +3 -1
  89. package/src/book-topology-migration-placement.ts +8 -21
  90. package/src/book-topology-migrators-t11.ts +16 -15
  91. package/src/book-topology-mixed-volume-migrators.ts +3 -6
  92. package/src/book-topology-record-class-migrators.ts +7 -10
  93. package/src/book-topology-runs-migrator.ts +4 -3
  94. package/src/collector-config.ts +7 -9
  95. package/src/compliance-transport.ts +2 -1
  96. package/src/countersign-contracts.ts +2 -1
  97. package/src/diarist-contracts.ts +3 -2
  98. package/src/doctor-contracts.ts +3 -1
  99. package/src/doctor-evidence.ts +8 -7
  100. package/src/doctor-role.ts +4 -2
  101. package/src/dossier-resolution.ts +2 -4
  102. package/src/engine-detour-tool.ts +0 -2
  103. package/src/engine-detour-usage.ts +2 -4
  104. package/src/external-host-turn-loop.ts +3 -1
  105. package/src/factory-board.ts +1 -8
  106. package/src/gatekeeper-role.ts +2 -10
  107. package/src/gleaner-left-contracts.ts +3 -1
  108. package/src/headless-host/description.ts +15 -18
  109. package/src/headless-host/role-turn-host.ts +10 -9
  110. package/src/host-session-record.ts +4 -2
  111. package/src/inspector-contracts.ts +2 -1
  112. package/src/ledger-session-read.ts +2 -5
  113. package/src/merger-contracts.ts +10 -9
  114. package/src/navigator-attendance.ts +10 -12
  115. package/src/navigator-invocation-identity.ts +3 -2
  116. package/src/navigator-public-session.ts +4 -6
  117. package/src/navigator-session-contracts.ts +8 -11
  118. package/src/navigator-work-base.ts +5 -8
  119. package/src/navigator-work-context.ts +2 -1
  120. package/src/notary-contracts.ts +4 -6
  121. package/src/oauth-keepalive.ts +5 -18
  122. package/src/package-contracts/auditor-output.ts +2 -4
  123. package/src/package-contracts/fixer-packet.ts +4 -6
  124. package/src/package-contracts/gatekeeper-output.ts +2 -4
  125. package/src/package-contracts/judge-output.ts +0 -1
  126. package/src/package-contracts/navigator-output.ts +8 -8
  127. package/src/package-contracts/terminating-infrastructure.ts +6 -20
  128. package/src/package-contracts/terminating-tools.ts +8 -12
  129. package/src/pi/adapter.ts +0 -1
  130. package/src/pi/role-turn-host.ts +0 -1
  131. package/src/public-cli/analyst-run.ts +4 -2
  132. package/src/public-cli/auto-resume.ts +5 -12
  133. package/src/public-cli/cli.ts +77 -83
  134. package/src/public-cli/config.ts +16 -27
  135. package/src/public-cli/countersign-run.ts +2 -4
  136. package/src/public-cli/host-providers.ts +10 -27
  137. package/src/public-cli/instruction-seat-run.ts +87 -58
  138. package/src/public-cli/invocation.ts +159 -172
  139. package/src/public-cli/post-admission.ts +115 -103
  140. package/src/public-cli/role-seat-runtime.ts +72 -0
  141. package/src/public-cli/run-lifecycle.ts +27 -67
  142. package/src/public-cli/settlement.ts +11 -33
  143. package/src/public-cli/terminal.ts +2 -17
  144. package/src/public-cli/turn-request.ts +26 -0
  145. package/src/public-role-summons.ts +24 -48
  146. package/src/receipt-delivery-policy.ts +1 -4
  147. package/src/reviewer-role.ts +0 -1
  148. package/src/role-envelope.ts +5 -3
  149. package/src/role-run-placement.ts +9 -10
  150. package/src/role-run-relocation.ts +13 -23
  151. package/src/role-runtime.ts +9 -15
  152. package/src/run-terminal-artifacts.ts +2 -16
  153. package/src/run-ticket-number.ts +4 -10
  154. package/src/session-assistant-usage.ts +3 -1
  155. package/src/session-dialogue.ts +1 -4
  156. package/src/session-identity.ts +0 -1
  157. package/src/sitian-reader.ts +2 -4
  158. package/src/submission-correctable-error.ts +3 -1
  159. package/src/submission-errors.ts +2 -1
  160. package/src/submission-gate.ts +3 -1
  161. package/src/submission-ledger.ts +5 -6
  162. package/src/ticket-provenance-contracts.ts +1 -4
  163. package/src/ticket-provenance.ts +3 -1
  164. package/src/ticket-snapshot.ts +2 -4
  165. package/src/ticket-trajectory.ts +1 -8
  166. package/src/typed-provider-http.ts +5 -15
  167. package/src/unknown-value.ts +34 -0
  168. package/src/user-dialogue-stdin.ts +3 -1
  169. package/src/worker-role.ts +2 -5
  170. package/src/worker-submission-gates.ts +5 -7
@@ -50,224 +50,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
50
50
  mod
51
51
  ));
52
52
 
53
- // src/activation-ledger-topology.ts
54
- import {
55
- lstatSync,
56
- mkdirSync,
57
- realpathSync,
58
- statSync
59
- } from "node:fs";
60
- import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
61
- function activationBookDirectory(ledgerHome, bookKey) {
62
- return join(ledgerHome, "books", bookKey);
63
- }
64
- function pathContainedIn(root, candidate) {
65
- const rel = relative(root, candidate);
66
- return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
67
- }
68
- function physicalPathIdentity(path8) {
69
- const absolute = resolve(path8);
70
- const missing = [];
71
- let cursor = absolute;
72
- while (true) {
73
- try {
74
- const real = realpathSync(cursor);
75
- return missing.length === 0 ? real : join(real, ...missing);
76
- } catch (error) {
77
- if (errnoCode(error) !== "ENOENT") {
78
- return absolute;
79
- }
80
- const parent = dirname(cursor);
81
- if (parent === cursor) return absolute;
82
- missing.unshift(basename(cursor));
83
- cursor = parent;
84
- }
85
- }
86
- }
87
- function physicallyContainedIn(root, candidate) {
88
- return pathContainedIn(physicalPathIdentity(root), physicalPathIdentity(candidate));
89
- }
90
- function errnoCode(error) {
91
- return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : void 0;
92
- }
93
- var init_activation_ledger_topology = __esm({
94
- "src/activation-ledger-topology.ts"() {
95
- "use strict";
96
- }
97
- });
98
-
99
- // src/run-ticket-number.ts
100
- import { readFile } from "node:fs/promises";
101
- import { join as join2 } from "node:path";
102
- function isEnoent(error) {
103
- return error instanceof Error && "code" in error && error.code === "ENOENT";
104
- }
105
- function isSafePositiveTicketNumber(value2) {
106
- return typeof value2 === "number" && Number.isSafeInteger(value2) && value2 >= 1;
107
- }
108
- function requireSafePositiveTicketNumber(ticketNumber, context = "ticketNumber") {
109
- if (!isSafePositiveTicketNumber(ticketNumber)) {
110
- throw new Error(
111
- `${context} requires a safe positive integer, got ${String(ticketNumber)}`
112
- );
113
- }
114
- return ticketNumber;
115
- }
116
- function ticketFromRecord(record) {
117
- return isSafePositiveTicketNumber(record.ticketNumber) ? record.ticketNumber : void 0;
118
- }
119
- async function readJsonObject(path8) {
120
- try {
121
- const raw = JSON.parse(await readFile(path8, "utf8"));
122
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
123
- return void 0;
124
- }
125
- return raw;
126
- } catch (error) {
127
- if (isEnoent(error)) return void 0;
128
- throw error;
129
- }
130
- }
131
- async function readBoardPageTicketNumber(runDirectory, page) {
132
- const record = await readJsonObject(join2(runDirectory, page));
133
- if (record === void 0) return void 0;
134
- return ticketFromRecord(record);
135
- }
136
- async function readBoardTicketNumber(runDirectory) {
137
- return await readBoardPageTicketNumber(runDirectory, "admitted-request.json") ?? await readBoardPageTicketNumber(runDirectory, "invocation.json");
138
- }
139
- async function readMigrationDerivedTicketNumber(runDirectory) {
140
- const record = await readJsonObject(
141
- join2(runDirectory, MIGRATION_TICKET_DERIVATION_PAGE)
142
- );
143
- if (record === void 0) return void 0;
144
- if (record.derivation !== "worktree-path-basename") return void 0;
145
- return ticketFromRecord(record);
146
- }
147
- var MIGRATION_TICKET_DERIVATION_PAGE;
148
- var init_run_ticket_number = __esm({
149
- "src/run-ticket-number.ts"() {
150
- "use strict";
151
- MIGRATION_TICKET_DERIVATION_PAGE = "migration-ticket-derivation.json";
152
- }
153
- });
154
-
155
- // src/role-run-placement.ts
156
- import { readdir } from "node:fs/promises";
157
- import { join as join3 } from "node:path";
158
- function isMissingPathError(error) {
159
- return error instanceof Error && "code" in error && error.code === "ENOENT";
160
- }
161
- async function listBookRunDirectories(bookDir) {
162
- const out = [];
163
- const seen = /* @__PURE__ */ new Set();
164
- const collect = async (runsDir) => {
165
- let entries;
166
- try {
167
- entries = await readdir(runsDir, { withFileTypes: true });
168
- } catch (error) {
169
- if (isMissingPathError(error)) return;
170
- throw error;
171
- }
172
- for (const entry of entries) {
173
- if (!entry.isDirectory()) continue;
174
- const runDir = join3(runsDir, entry.name);
175
- if (seen.has(runDir)) continue;
176
- seen.add(runDir);
177
- out.push(runDir);
178
- }
179
- };
180
- await collect(join3(bookDir, "runs"));
181
- let subjects;
182
- try {
183
- subjects = await readdir(bookDir, { withFileTypes: true });
184
- } catch (error) {
185
- if (isMissingPathError(error)) return out.sort();
186
- throw error;
187
- }
188
- for (const subject of subjects) {
189
- if (!subject.isDirectory() || subject.name === "runs") continue;
190
- await collect(join3(bookDir, subject.name, "runs"));
191
- }
192
- return out.sort();
193
- }
194
- function roleRunPlacement(ledgerHome, input) {
195
- const subjectDirectory = "ticketNumber" in input.subject ? String(requireSafePositiveTicketNumber(
196
- input.subject.ticketNumber,
197
- "roleRunPlacement subject.ticketNumber"
198
- )) : "unbound";
199
- const runDirectory = join3(
200
- activationBookDirectory(ledgerHome, input.bookKey),
201
- subjectDirectory,
202
- "runs",
203
- `${input.runId}@${input.role}`
204
- );
205
- const sessionDirectory = join3(runDirectory, "session");
206
- return {
207
- runDirectory,
208
- sessionDirectory,
209
- sessionFile: join3(sessionDirectory, "session.jsonl"),
210
- artifactsDirectory: roleRunArtifactsDirectory(runDirectory),
211
- attachmentsDirectory: join3(runDirectory, "attachments")
212
- };
213
- }
214
- function roleRunArtifactsDirectory(runDirectory) {
215
- return join3(runDirectory, "artifacts");
216
- }
217
- var init_role_run_placement = __esm({
218
- "src/role-run-placement.ts"() {
219
- "use strict";
220
- init_activation_ledger_topology();
221
- init_run_ticket_number();
222
- }
223
- });
224
-
225
- // src/public-cli/cli-errors.ts
226
- var init_cli_errors = __esm({
227
- "src/public-cli/cli-errors.ts"() {
228
- "use strict";
229
- }
230
- });
231
-
232
- // src/typed-provider-http.ts
233
- var init_typed_provider_http = __esm({
234
- "src/typed-provider-http.ts"() {
235
- "use strict";
236
- }
237
- });
238
-
239
- // src/collector-config.ts
240
- var init_collector_config = __esm({
241
- "src/collector-config.ts"() {
242
- "use strict";
243
- }
244
- });
245
-
246
- // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs
247
- var Metrics;
248
- var init_metrics = __esm({
249
- "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs"() {
250
- Metrics = {
251
- assign: 0,
252
- create: 0,
253
- clone: 0,
254
- discard: 0,
255
- update: 0
256
- };
257
- }
258
- });
259
-
260
- // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs
261
- function Assign(left, right) {
262
- Metrics.assign += 1;
263
- return { ...left, ...right };
264
- }
265
- var init_assign = __esm({
266
- "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs"() {
267
- init_metrics();
268
- }
269
- });
270
-
271
53
  // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/guard/string.mjs
272
54
  function IsBetween(value2, min, max) {
273
55
  return value2 >= min && value2 <= max;
@@ -704,6 +486,255 @@ var init_guard2 = __esm({
704
486
  }
705
487
  });
706
488
 
489
+ // src/unknown-value.ts
490
+ function isRecord(value2) {
491
+ return guard_exports.IsObjectNotArray(value2);
492
+ }
493
+ function errnoCode(error) {
494
+ return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : void 0;
495
+ }
496
+ function errorText(error) {
497
+ return error instanceof Error ? error.message : String(error);
498
+ }
499
+ function isEnoent(error) {
500
+ return error instanceof Error && errnoCode(error) === "ENOENT";
501
+ }
502
+ var init_unknown_value = __esm({
503
+ "src/unknown-value.ts"() {
504
+ "use strict";
505
+ init_guard2();
506
+ }
507
+ });
508
+
509
+ // src/activation-ledger-topology.ts
510
+ import {
511
+ lstatSync,
512
+ mkdirSync,
513
+ realpathSync,
514
+ statSync
515
+ } from "node:fs";
516
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
517
+ function activationBookDirectory(ledgerHome, bookKey) {
518
+ return join(ledgerHome, "books", bookKey);
519
+ }
520
+ function pathContainedIn(root, candidate) {
521
+ const rel = relative(root, candidate);
522
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
523
+ }
524
+ function physicalPathIdentity(path8) {
525
+ const absolute = resolve(path8);
526
+ const missing = [];
527
+ let cursor = absolute;
528
+ while (true) {
529
+ try {
530
+ const real = realpathSync(cursor);
531
+ return missing.length === 0 ? real : join(real, ...missing);
532
+ } catch (error) {
533
+ if (errnoCode(error) !== "ENOENT") {
534
+ return absolute;
535
+ }
536
+ const parent = dirname(cursor);
537
+ if (parent === cursor) return absolute;
538
+ missing.unshift(basename(cursor));
539
+ cursor = parent;
540
+ }
541
+ }
542
+ }
543
+ function physicallyContainedIn(root, candidate) {
544
+ return pathContainedIn(physicalPathIdentity(root), physicalPathIdentity(candidate));
545
+ }
546
+ var init_activation_ledger_topology = __esm({
547
+ "src/activation-ledger-topology.ts"() {
548
+ "use strict";
549
+ init_unknown_value();
550
+ }
551
+ });
552
+
553
+ // src/run-ticket-number.ts
554
+ import { readFile } from "node:fs/promises";
555
+ import { join as join2 } from "node:path";
556
+ function isSafePositiveTicketNumber(value2) {
557
+ return typeof value2 === "number" && Number.isSafeInteger(value2) && value2 >= 1;
558
+ }
559
+ function requireSafePositiveTicketNumber(ticketNumber, context = "ticketNumber") {
560
+ if (!isSafePositiveTicketNumber(ticketNumber)) {
561
+ throw new Error(
562
+ `${context} requires a safe positive integer, got ${String(ticketNumber)}`
563
+ );
564
+ }
565
+ return ticketNumber;
566
+ }
567
+ function ticketFromRecord(record) {
568
+ return isSafePositiveTicketNumber(record.ticketNumber) ? record.ticketNumber : void 0;
569
+ }
570
+ async function readJsonObject(path8) {
571
+ try {
572
+ const raw = JSON.parse(await readFile(path8, "utf8"));
573
+ if (!isRecord(raw)) {
574
+ return void 0;
575
+ }
576
+ return raw;
577
+ } catch (error) {
578
+ if (isEnoent(error)) return void 0;
579
+ throw error;
580
+ }
581
+ }
582
+ async function readBoardPageTicketNumber(runDirectory, page) {
583
+ const record = await readJsonObject(join2(runDirectory, page));
584
+ if (record === void 0) return void 0;
585
+ return ticketFromRecord(record);
586
+ }
587
+ async function readBoardTicketNumber(runDirectory) {
588
+ return await readBoardPageTicketNumber(runDirectory, "admitted-request.json") ?? await readBoardPageTicketNumber(runDirectory, "invocation.json");
589
+ }
590
+ async function readMigrationDerivedTicketNumber(runDirectory) {
591
+ const record = await readJsonObject(
592
+ join2(runDirectory, MIGRATION_TICKET_DERIVATION_PAGE)
593
+ );
594
+ if (record === void 0) return void 0;
595
+ if (record.derivation !== "worktree-path-basename") return void 0;
596
+ return ticketFromRecord(record);
597
+ }
598
+ var MIGRATION_TICKET_DERIVATION_PAGE;
599
+ var init_run_ticket_number = __esm({
600
+ "src/run-ticket-number.ts"() {
601
+ "use strict";
602
+ init_unknown_value();
603
+ MIGRATION_TICKET_DERIVATION_PAGE = "migration-ticket-derivation.json";
604
+ }
605
+ });
606
+
607
+ // src/role-run-placement.ts
608
+ import { readdir } from "node:fs/promises";
609
+ import { join as join3 } from "node:path";
610
+ async function listBookRunDirectories(bookDir) {
611
+ const out = [];
612
+ const seen = /* @__PURE__ */ new Set();
613
+ const collect = async (runsDir) => {
614
+ let entries;
615
+ try {
616
+ entries = await readdir(runsDir, { withFileTypes: true });
617
+ } catch (error) {
618
+ if (isEnoent(error)) return;
619
+ throw error;
620
+ }
621
+ for (const entry of entries) {
622
+ if (!entry.isDirectory()) continue;
623
+ const runDir = join3(runsDir, entry.name);
624
+ if (seen.has(runDir)) continue;
625
+ seen.add(runDir);
626
+ out.push(runDir);
627
+ }
628
+ };
629
+ await collect(join3(bookDir, "runs"));
630
+ let subjects;
631
+ try {
632
+ subjects = await readdir(bookDir, { withFileTypes: true });
633
+ } catch (error) {
634
+ if (isEnoent(error)) return out.sort();
635
+ throw error;
636
+ }
637
+ for (const subject of subjects) {
638
+ if (!subject.isDirectory() || subject.name === "runs") continue;
639
+ await collect(join3(bookDir, subject.name, "runs"));
640
+ }
641
+ return out.sort();
642
+ }
643
+ function roleRunPlacement(ledgerHome, input) {
644
+ const subjectDirectory = "ticketNumber" in input.subject ? String(requireSafePositiveTicketNumber(
645
+ input.subject.ticketNumber,
646
+ "roleRunPlacement subject.ticketNumber"
647
+ )) : "unbound";
648
+ const runDirectory = join3(
649
+ activationBookDirectory(ledgerHome, input.bookKey),
650
+ subjectDirectory,
651
+ "runs",
652
+ `${input.runId}@${input.role}`
653
+ );
654
+ const sessionDirectory = join3(runDirectory, "session");
655
+ return {
656
+ runDirectory,
657
+ sessionDirectory,
658
+ sessionFile: join3(sessionDirectory, "session.jsonl"),
659
+ artifactsDirectory: roleRunArtifactsDirectory(runDirectory),
660
+ attachmentsDirectory: join3(runDirectory, "attachments")
661
+ };
662
+ }
663
+ function roleRunArtifactsDirectory(runDirectory) {
664
+ return join3(runDirectory, "artifacts");
665
+ }
666
+ function isUnboundRunDirectory(runDirectory) {
667
+ return runDirectory.replaceAll("\\", "/").includes("/unbound/runs/");
668
+ }
669
+ var init_role_run_placement = __esm({
670
+ "src/role-run-placement.ts"() {
671
+ "use strict";
672
+ init_activation_ledger_topology();
673
+ init_run_ticket_number();
674
+ init_unknown_value();
675
+ }
676
+ });
677
+
678
+ // src/public-cli/cli-errors.ts
679
+ var init_cli_errors = __esm({
680
+ "src/public-cli/cli-errors.ts"() {
681
+ "use strict";
682
+ }
683
+ });
684
+
685
+ // src/typed-provider-http.ts
686
+ var init_typed_provider_http = __esm({
687
+ "src/typed-provider-http.ts"() {
688
+ "use strict";
689
+ init_unknown_value();
690
+ }
691
+ });
692
+
693
+ // src/sha256.ts
694
+ import { createHash } from "node:crypto";
695
+ function sha256Hex(bytes) {
696
+ return createHash("sha256").update(bytes).digest("hex");
697
+ }
698
+ var init_sha256 = __esm({
699
+ "src/sha256.ts"() {
700
+ "use strict";
701
+ }
702
+ });
703
+
704
+ // src/collector-config.ts
705
+ var init_collector_config = __esm({
706
+ "src/collector-config.ts"() {
707
+ "use strict";
708
+ init_sha256();
709
+ init_unknown_value();
710
+ }
711
+ });
712
+
713
+ // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs
714
+ var Metrics;
715
+ var init_metrics = __esm({
716
+ "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs"() {
717
+ Metrics = {
718
+ assign: 0,
719
+ create: 0,
720
+ clone: 0,
721
+ discard: 0,
722
+ update: 0
723
+ };
724
+ }
725
+ });
726
+
727
+ // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs
728
+ function Assign(left, right) {
729
+ Metrics.assign += 1;
730
+ return { ...left, ...right };
731
+ }
732
+ var init_assign = __esm({
733
+ "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs"() {
734
+ init_metrics();
735
+ }
736
+ });
737
+
707
738
  // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/clone.mjs
708
739
  function FromClassInstance(value2) {
709
740
  return value2;
@@ -8051,6 +8082,7 @@ var init_terminating_infrastructure = __esm({
8051
8082
  "src/package-contracts/terminating-infrastructure.ts"() {
8052
8083
  "use strict";
8053
8084
  init_build();
8085
+ init_unknown_value();
8054
8086
  INFRASTRUCTURE_FAILURE_DECLARATION_KEY = "infrastructureFailure";
8055
8087
  INFRASTRUCTURE_FAILURE_DIAGNOSTIC_KEY = "diagnostic";
8056
8088
  infrastructureFailureNested = typebox_exports.Object(
@@ -8082,6 +8114,7 @@ var init_gatekeeper_output = __esm({
8082
8114
  init_build();
8083
8115
  init_open_tool_schema();
8084
8116
  init_terminating_infrastructure();
8117
+ init_unknown_value();
8085
8118
  GATEKEEPER_OUTPUT_TOOL_NAME = "ak_gatekeeper_output";
8086
8119
  gatekeeperDecisionSchema = openToolObject(
8087
8120
  typebox_exports.Object({
@@ -8108,6 +8141,7 @@ var init_navigator_output = __esm({
8108
8141
  "src/package-contracts/navigator-output.ts"() {
8109
8142
  "use strict";
8110
8143
  init_build();
8144
+ init_unknown_value();
8111
8145
  init_open_tool_schema();
8112
8146
  init_terminating_infrastructure();
8113
8147
  NAVIGATOR_OUTPUT_TOOL_NAME = "ak_navigator_output";
@@ -13599,11 +13633,12 @@ var init_fixer_packet = __esm({
13599
13633
  "use strict";
13600
13634
  init_build();
13601
13635
  init_value2();
13636
+ init_unknown_value();
13602
13637
  FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
13603
13638
  fixerPrerequisiteSchema = typebox_exports.Object({
13604
13639
  id: typebox_exports.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
13605
13640
  requirement: typebox_exports.String({ pattern: "\\S" })
13606
- }, { additionalProperties: false });
13641
+ });
13607
13642
  fixerPrerequisitesSchema = typebox_exports.Array(fixerPrerequisiteSchema);
13608
13643
  }
13609
13644
  });
@@ -13636,6 +13671,7 @@ var init_doctor_contracts = __esm({
13636
13671
  init_canonical_json();
13637
13672
  init_open_tool_schema();
13638
13673
  init_terminating_infrastructure();
13674
+ init_unknown_value();
13639
13675
  DOCTOR_OUTPUT_TOOL_NAME = "ak_doctor_output";
13640
13676
  DOCTOR_AUDIT_TOOL_NAME = "ak_doctor_audit_decision";
13641
13677
  DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
@@ -13685,17 +13721,18 @@ var init_merger_contracts = __esm({
13685
13721
  init_exact_utf8();
13686
13722
  init_open_tool_schema();
13687
13723
  init_terminating_infrastructure();
13688
- materialSchema = typebox_exports.Object({ bytesBase64: typebox_exports.String(), sha256: typebox_exports.String() }, { additionalProperties: false });
13689
- checkSchema = typebox_exports.Object({ name: typebox_exports.String({ minLength: 1 }), argv: typebox_exports.Array(typebox_exports.String({ minLength: 1 }), { minItems: 1 }) }, { additionalProperties: false });
13724
+ init_unknown_value();
13725
+ materialSchema = typebox_exports.Object({ bytesBase64: typebox_exports.String(), sha256: typebox_exports.String() });
13726
+ checkSchema = typebox_exports.Object({ name: typebox_exports.String({ minLength: 1 }), argv: typebox_exports.Array(typebox_exports.String({ minLength: 1 }), { minItems: 1 }) });
13690
13727
  mergerInputSchema = typebox_exports.Object({
13691
13728
  attemptId: typebox_exports.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
13692
13729
  targetObjectId: typebox_exports.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
13693
13730
  sourceObjectId: typebox_exports.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
13694
- materials: typebox_exports.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }, { additionalProperties: false }),
13731
+ materials: typebox_exports.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }),
13695
13732
  expectedConflictPaths: typebox_exports.Array(typebox_exports.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
13696
13733
  resolutionScope: typebox_exports.Array(typebox_exports.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
13697
13734
  authorizedChecks: typebox_exports.Array(checkSchema)
13698
- }, { additionalProperties: false });
13735
+ });
13699
13736
  MERGER_STATUS_DESCRIPTION = "completed | escalate";
13700
13737
  mergerOutputObject = typebox_exports.Object({
13701
13738
  status: typebox_exports.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
@@ -13717,6 +13754,7 @@ var init_notary_contracts = __esm({
13717
13754
  "src/notary-contracts.ts"() {
13718
13755
  "use strict";
13719
13756
  init_review_submission();
13757
+ init_unknown_value();
13720
13758
  NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13721
13759
  }
13722
13760
  });
@@ -13727,6 +13765,7 @@ var init_countersign_contracts = __esm({
13727
13765
  "src/countersign-contracts.ts"() {
13728
13766
  "use strict";
13729
13767
  init_review_submission();
13768
+ init_unknown_value();
13730
13769
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13731
13770
  }
13732
13771
  });
@@ -13736,6 +13775,7 @@ var GLEANER_LEFT_OUTPUT_TOOL_NAME;
13736
13775
  var init_gleaner_left_contracts = __esm({
13737
13776
  "src/gleaner-left-contracts.ts"() {
13738
13777
  "use strict";
13778
+ init_unknown_value();
13739
13779
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
13740
13780
  }
13741
13781
  });
@@ -13746,6 +13786,7 @@ var init_inspector_contracts = __esm({
13746
13786
  "src/inspector-contracts.ts"() {
13747
13787
  "use strict";
13748
13788
  init_review_submission();
13789
+ init_unknown_value();
13749
13790
  INSPECTOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13750
13791
  }
13751
13792
  });
@@ -13756,14 +13797,12 @@ var init_auditor_output = __esm({
13756
13797
  "src/package-contracts/auditor-output.ts"() {
13757
13798
  "use strict";
13758
13799
  init_review_submission();
13800
+ init_unknown_value();
13759
13801
  AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13760
13802
  }
13761
13803
  });
13762
13804
 
13763
13805
  // src/ticket-provenance-contracts.ts
13764
- function isRecord(value2) {
13765
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
13766
- }
13767
13806
  function positiveInteger(value2) {
13768
13807
  if (typeof value2 === "number" && Number.isSafeInteger(value2) && value2 >= 1) return value2;
13769
13808
  if (typeof value2 === "string" && /^[1-9][0-9]*$/.test(value2)) {
@@ -13821,6 +13860,7 @@ function projectTicketProvenanceHeader(value2) {
13821
13860
  var init_ticket_provenance_contracts = __esm({
13822
13861
  "src/ticket-provenance-contracts.ts"() {
13823
13862
  "use strict";
13863
+ init_unknown_value();
13824
13864
  }
13825
13865
  });
13826
13866
 
@@ -13831,6 +13871,7 @@ var init_diarist_contracts = __esm({
13831
13871
  "use strict";
13832
13872
  init_ticket_provenance_contracts();
13833
13873
  init_run_ticket_number();
13874
+ init_unknown_value();
13834
13875
  DIARIST_OUTPUT_TOOL_NAME = "ak_diarist_output";
13835
13876
  }
13836
13877
  });
@@ -14393,6 +14434,7 @@ var init_submission_errors = __esm({
14393
14434
  "src/submission-errors.ts"() {
14394
14435
  "use strict";
14395
14436
  init_readable_gate_item();
14437
+ init_unknown_value();
14396
14438
  }
14397
14439
  });
14398
14440
 
@@ -14401,6 +14443,7 @@ var init_run_terminal_artifacts = __esm({
14401
14443
  "src/run-terminal-artifacts.ts"() {
14402
14444
  "use strict";
14403
14445
  init_role_run_placement();
14446
+ init_unknown_value();
14404
14447
  }
14405
14448
  });
14406
14449
 
@@ -14415,6 +14458,7 @@ var init_gatekeeper_role = __esm({
14415
14458
  init_review_submission();
14416
14459
  init_gatekeeper_output();
14417
14460
  init_run_terminal_artifacts();
14461
+ init_unknown_value();
14418
14462
  init_submission_errors();
14419
14463
  }
14420
14464
  });
@@ -14436,6 +14480,7 @@ var init_compliance_transport = __esm({
14436
14480
  init_submission_errors();
14437
14481
  init_terminal();
14438
14482
  init_readable_gate_item();
14483
+ init_unknown_value();
14439
14484
  AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
14440
14485
  }
14441
14486
  });
@@ -14444,9 +14489,6 @@ var init_compliance_transport = __esm({
14444
14489
  import { existsSync } from "node:fs";
14445
14490
  import { readdir as readdir2, readFile as readFile2, writeFile } from "node:fs/promises";
14446
14491
  import { join as join4, sep as sep2 } from "node:path";
14447
- function isEnoent2(error) {
14448
- return error instanceof Error && "code" in error && error.code === "ENOENT";
14449
- }
14450
14492
  function rewriteRunDirectoryPathValue(value2, oldRunDirectory, newRunDirectory) {
14451
14493
  if (typeof value2 !== "string") return value2;
14452
14494
  if (value2 === oldRunDirectory) return newRunDirectory;
@@ -14500,11 +14542,8 @@ function collectRewrites(input) {
14500
14542
  }
14501
14543
  return out;
14502
14544
  }
14503
- function isPlainObject(value2) {
14504
- return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
14505
- }
14506
14545
  function rewriteSourceRunLocator(value2, rewrites) {
14507
- if (!isPlainObject(value2)) return;
14546
+ if (!isRecord(value2)) return;
14508
14547
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14509
14548
  value2,
14510
14549
  SOURCE_RUN_LOCATOR_FIELDS,
@@ -14512,7 +14551,7 @@ function rewriteSourceRunLocator(value2, rewrites) {
14512
14551
  );
14513
14552
  }
14514
14553
  function rewriteSummonsMaterials(value2, rewrites) {
14515
- if (!isPlainObject(value2)) return;
14554
+ if (!isRecord(value2)) return;
14516
14555
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14517
14556
  value2,
14518
14557
  SUMMONS_PATH_FIELDS,
@@ -14530,12 +14569,12 @@ function rewriteAdmittedRoleRunPage(page, rewrites) {
14530
14569
  rewriteSourceRunLocator(page.sourceRun, rewrites);
14531
14570
  if (Array.isArray(page.attachments)) {
14532
14571
  for (const attachment of page.attachments) {
14533
- if (isPlainObject(attachment)) {
14572
+ if (isRecord(attachment)) {
14534
14573
  rewriteRunDirectoryPathFieldsAgainstRewrites(attachment, ["frozenPath"], rewrites);
14535
14574
  }
14536
14575
  }
14537
14576
  }
14538
- if (isPlainObject(page.principal)) {
14577
+ if (isRecord(page.principal)) {
14539
14578
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14540
14579
  page.principal,
14541
14580
  ["sessionDirectory", "sessionFile"],
@@ -14546,7 +14585,7 @@ function rewriteAdmittedRoleRunPage(page, rewrites) {
14546
14585
  async function rewriteOfficerPointerFile(path8, rewrites) {
14547
14586
  if (!existsSync(path8)) return;
14548
14587
  const page = JSON.parse(await readFile2(path8, "utf8"));
14549
- if (!isPlainObject(page)) return;
14588
+ if (!isRecord(page)) return;
14550
14589
  if (page.kind !== "direct-officer-run-pointer") return;
14551
14590
  const before = JSON.stringify(page);
14552
14591
  rewriteRunDirectoryPathFieldsAgainstRewrites(
@@ -14584,7 +14623,7 @@ async function rewriteSitianRecordsJsonl(path8, rewrites) {
14584
14623
  out.push(line);
14585
14624
  continue;
14586
14625
  }
14587
- if (!isPlainObject(parsed2)) {
14626
+ if (!isRecord(parsed2)) {
14588
14627
  out.push(line);
14589
14628
  continue;
14590
14629
  }
@@ -14635,7 +14674,7 @@ async function rewriteSessionTranscriptBindings(path8, rewrites) {
14635
14674
  out.push(line);
14636
14675
  continue;
14637
14676
  }
14638
- if (!isPlainObject(parsed2)) {
14677
+ if (!isRecord(parsed2)) {
14639
14678
  out.push(line);
14640
14679
  continue;
14641
14680
  }
@@ -14648,7 +14687,7 @@ async function rewriteSessionTranscriptBindings(path8, rewrites) {
14648
14687
  rewrites
14649
14688
  );
14650
14689
  if (parsed2.parentSession !== before) lineChanged = true;
14651
- } else if (parsed2.type === "custom" && parsed2.customType === AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE && isPlainObject(parsed2.data) && isPlainObject(parsed2.data.parent)) {
14690
+ } else if (parsed2.type === "custom" && parsed2.customType === AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE && isRecord(parsed2.data) && isRecord(parsed2.data.parent)) {
14652
14691
  const parent = parsed2.data.parent;
14653
14692
  const before = parent.sessionFile;
14654
14693
  rewriteRunDirectoryPathFieldsAgainstRewrites(
@@ -14677,7 +14716,7 @@ async function rewriteNestedMachinePathPages(pagesDirectory, rewrites) {
14677
14716
  try {
14678
14717
  entries = await readdir2(directory, { withFileTypes: true });
14679
14718
  } catch (error) {
14680
- if (isEnoent2(error)) return;
14719
+ if (isEnoent(error)) return;
14681
14720
  throw error;
14682
14721
  }
14683
14722
  for (const entry of entries) {
@@ -14730,14 +14769,14 @@ async function rewriteRoleRunDurablePages(input) {
14730
14769
  RUN_STATE_PAGE_FIELDS,
14731
14770
  rewrites
14732
14771
  );
14733
- if (isPlainObject(page.principal)) {
14772
+ if (isRecord(page.principal)) {
14734
14773
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14735
14774
  page.principal,
14736
14775
  ["sessionDirectory", "sessionFile"],
14737
14776
  rewrites
14738
14777
  );
14739
14778
  }
14740
- if (isPlainObject(page.currentCourt)) {
14779
+ if (isRecord(page.currentCourt)) {
14741
14780
  rewriteSummonsMaterials(page.currentCourt.summons, rewrites);
14742
14781
  }
14743
14782
  if (JSON.stringify(page) !== before) {
@@ -14752,6 +14791,7 @@ var init_role_run_relocation = __esm({
14752
14791
  "src/role-run-relocation.ts"() {
14753
14792
  "use strict";
14754
14793
  init_compliance_transport();
14794
+ init_unknown_value();
14755
14795
  ADMITTED_PAGE_FIELDS = [
14756
14796
  "runDirectory",
14757
14797
  "admittedRequestPath",
@@ -14795,13 +14835,7 @@ var init_engine_material = __esm({
14795
14835
  var init_activation_ledger_git = __esm({
14796
14836
  "src/activation-ledger-git.ts"() {
14797
14837
  "use strict";
14798
- }
14799
- });
14800
-
14801
- // src/sha256.ts
14802
- var init_sha256 = __esm({
14803
- "src/sha256.ts"() {
14804
- "use strict";
14838
+ init_unknown_value();
14805
14839
  }
14806
14840
  });
14807
14841
 
@@ -14811,6 +14845,7 @@ var init_submission_correctable_error = __esm({
14811
14845
  "src/submission-correctable-error.ts"() {
14812
14846
  "use strict";
14813
14847
  init_submission_errors();
14848
+ init_unknown_value();
14814
14849
  correctableSubmissionErrorBrand = /* @__PURE__ */ Symbol("ak-roles.correctable-submission-error");
14815
14850
  CorrectableSubmissionError = class extends Error {
14816
14851
  [correctableSubmissionErrorBrand] = true;
@@ -14840,6 +14875,7 @@ var init_terminating_tools = __esm({
14840
14875
  init_diarist_contracts();
14841
14876
  init_secretariat_contracts();
14842
14877
  init_worker_output();
14878
+ init_unknown_value();
14843
14879
  TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
14844
14880
  ...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
14845
14881
  ...LEGACY_REVIEW_OUTPUT_ROLES.keys()
@@ -14853,6 +14889,7 @@ var init_doctor_evidence = __esm({
14853
14889
  "use strict";
14854
14890
  init_sha256();
14855
14891
  init_terminating_tools();
14892
+ init_unknown_value();
14856
14893
  }
14857
14894
  });
14858
14895
 
@@ -14887,6 +14924,7 @@ var init_merger_git_state = __esm({
14887
14924
  var init_ledger_session_read = __esm({
14888
14925
  "src/ledger-session-read.ts"() {
14889
14926
  "use strict";
14927
+ init_unknown_value();
14890
14928
  }
14891
14929
  });
14892
14930
 
@@ -14894,6 +14932,7 @@ var init_ledger_session_read = __esm({
14894
14932
  var init_session_dialogue = __esm({
14895
14933
  "src/session-dialogue.ts"() {
14896
14934
  "use strict";
14935
+ init_unknown_value();
14897
14936
  }
14898
14937
  });
14899
14938
 
@@ -14926,6 +14965,7 @@ var init_sitian_appender = __esm({
14926
14965
  var init_sitian_reader = __esm({
14927
14966
  "src/sitian-reader.ts"() {
14928
14967
  "use strict";
14968
+ init_unknown_value();
14929
14969
  }
14930
14970
  });
14931
14971
 
@@ -14950,6 +14990,7 @@ var init_ticket_provenance = __esm({
14950
14990
  init_session_dialogue();
14951
14991
  init_sitian_facade();
14952
14992
  init_ticket_provenance_contracts();
14993
+ init_unknown_value();
14953
14994
  }
14954
14995
  });
14955
14996
 
@@ -15760,6 +15801,7 @@ var init_invocation = __esm({
15760
15801
  init_engine_material();
15761
15802
  init_cli_errors();
15762
15803
  init_option_definitions();
15804
+ init_unknown_value();
15763
15805
  }
15764
15806
  });
15765
15807
 
@@ -15815,6 +15857,7 @@ var init_run_lifecycle = __esm({
15815
15857
  init_engine_material();
15816
15858
  init_packaged_role_registry();
15817
15859
  init_invocation();
15860
+ init_unknown_value();
15818
15861
  }
15819
15862
  });
15820
15863
 
@@ -82455,7 +82498,7 @@ var require_extend = __commonJS({
82455
82498
  }
82456
82499
  return toStr.call(arr) === "[object Array]";
82457
82500
  };
82458
- var isPlainObject3 = function isPlainObject4(obj) {
82501
+ var isPlainObject2 = function isPlainObject3(obj) {
82459
82502
  if (!obj || toStr.call(obj) !== "[object Object]") {
82460
82503
  return false;
82461
82504
  }
@@ -82512,12 +82555,12 @@ var require_extend = __commonJS({
82512
82555
  src = getProperty(target, name);
82513
82556
  copy = getProperty(options, name);
82514
82557
  if (target !== copy) {
82515
- if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray3(copy)))) {
82558
+ if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray3(copy)))) {
82516
82559
  if (copyIsArray) {
82517
82560
  copyIsArray = false;
82518
82561
  clone2 = src && isArray3(src) ? src : [];
82519
82562
  } else {
82520
- clone2 = src && isPlainObject3(src) ? src : {};
82563
+ clone2 = src && isPlainObject2(src) ? src : {};
82521
82564
  }
82522
82565
  setProperty(target, { name, newValue: extend(deep, clone2, copy) });
82523
82566
  } else if (typeof copy !== "undefined") {
@@ -117305,12 +117348,12 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
117305
117348
  }
117306
117349
  const _e2 = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e2, rest = __rest(_e2, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
117307
117350
  const nextOptions = Object.assign({}, rest);
117308
- if (isPlainObject2(query)) {
117351
+ if (isPlainObject(query)) {
117309
117352
  nextOptions.extra_query = query;
117310
117353
  } else {
117311
117354
  warnIgnoredOption("query", query);
117312
117355
  }
117313
- if (isPlainObject2(body)) {
117356
+ if (isPlainObject(body)) {
117314
117357
  nextOptions.extra_body = body;
117315
117358
  } else {
117316
117359
  warnIgnoredOption("body", body);
@@ -117407,7 +117450,7 @@ function wrapStreamErrors(stream12) {
117407
117450
  });
117408
117451
  }
117409
117452
  function attachSdkHttpResponse(value2, call) {
117410
- if (!isPlainObject2(value2) || call.status !== "complete") {
117453
+ if (!isPlainObject(value2) || call.status !== "complete") {
117411
117454
  return value2;
117412
117455
  }
117413
117456
  return Object.assign(Object.assign({}, value2), { sdkHttpResponse: createSdkHttpResponse(call.response, value2) });
@@ -117431,7 +117474,7 @@ function addOutputPropertiesIfInteraction(value2) {
117431
117474
  return addOutputProperties(interaction);
117432
117475
  }
117433
117476
  function normalizeInteractionShape(value2) {
117434
- if (!isPlainObject2(value2)) {
117477
+ if (!isPlainObject(value2)) {
117435
117478
  return void 0;
117436
117479
  }
117437
117480
  if (Array.isArray(value2["steps"])) {
@@ -117450,7 +117493,7 @@ function isLegacyLyriaInteraction(value2) {
117450
117493
  const model = value2["model"];
117451
117494
  return typeof model === "string" && LEGACY_LYRIA_MODELS.has(model);
117452
117495
  }
117453
- function isPlainObject2(value2) {
117496
+ function isPlainObject(value2) {
117454
117497
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
117455
117498
  }
117456
117499
  function addOutputProperties(interaction) {
@@ -190502,7 +190545,7 @@ var init_dist7 = __esm({
190502
190545
  });
190503
190546
 
190504
190547
  // node_modules/.pnpm/@earendil-works+pi-coding-agent@0.99.1_@aws-sdk+credential-provider-node@3.972.83_@smit_1f563b9fb7db4619e2913cc40d230799/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js
190505
- import { createHash, randomBytes as randomBytes2 } from "node:crypto";
190548
+ import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
190506
190549
  import { writeFile as writeFile5 } from "node:fs/promises";
190507
190550
  import { tmpdir as tmpdir2 } from "node:os";
190508
190551
  import { join as join13 } from "node:path";
@@ -190518,7 +190561,7 @@ function createMcpToolName(server, tool, isTaken = () => false) {
190518
190561
  const name = `mcp__${server}__${tool}`.replace(/[^A-Za-z0-9_-]/g, "_");
190519
190562
  if (name.length <= MAX_TOOL_NAME_LENGTH && !isTaken(name))
190520
190563
  return name;
190521
- const hash = createHash("sha256").update(`${server}\0${tool}`).digest("hex").slice(0, 8);
190564
+ const hash = createHash2("sha256").update(`${server}\0${tool}`).digest("hex").slice(0, 8);
190522
190565
  return `${name.slice(0, MAX_TOOL_NAME_LENGTH - hash.length - 1)}_${hash}`;
190523
190566
  }
190524
190567
  function textOf2(content) {
@@ -191808,7 +191851,7 @@ var init_oauth_page = __esm({
191808
191851
  });
191809
191852
 
191810
191853
  // node_modules/.pnpm/@earendil-works+pi-coding-agent@0.99.1_@aws-sdk+credential-provider-node@3.972.83_@smit_1f563b9fb7db4619e2913cc40d230799/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js
191811
- import { createHash as createHash2 } from "node:crypto";
191854
+ import { createHash as createHash3 } from "node:crypto";
191812
191855
  import { mkdirSync as mkdirSync4 } from "node:fs";
191813
191856
  import { join as join14 } from "node:path";
191814
191857
  function callbackSettings(settings3) {
@@ -192037,7 +192080,7 @@ var init_oauth2 = __esm({
192037
192080
  if (!this.lockDir)
192038
192081
  return fn();
192039
192082
  mkdirSync4(this.lockDir, { recursive: true, mode: 448 });
192040
- const hash = createHash2("sha256").update(key).digest("hex").slice(0, 16);
192083
+ const hash = createHash3("sha256").update(key).digest("hex").slice(0, 16);
192041
192084
  const release = await import_proper_lockfile4.default.lock(join14(this.lockDir, `mcp-auth-refresh-${hash}`), {
192042
192085
  realpath: false,
192043
192086
  stale: REFRESH_LOCK_STALE_MS,
@@ -195030,6 +195073,7 @@ import { dirname as dirname10, join as join18, relative as relative4, resolve as
195030
195073
  init_activation_ledger_topology();
195031
195074
 
195032
195075
  // src/archivist-record-topology.ts
195076
+ init_sha256();
195033
195077
  init_activation_ledger_git();
195034
195078
  init_activation_ledger_topology();
195035
195079
 
@@ -195045,22 +195089,17 @@ var WORKER_SUBMISSION_GATE_KIND = "worker-submission-gate";
195045
195089
  init_activation_ledger_topology();
195046
195090
  init_role_run_placement();
195047
195091
  init_run_ticket_number();
195092
+ init_unknown_value();
195048
195093
  import { readdir as readdir6, readFile as readFile6 } from "node:fs/promises";
195049
195094
  import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute5, join as join17, relative as relative3, resolve as resolve8, sep as sep6 } from "node:path";
195050
195095
  var TICKET_NUMBER_RE = /^[1-9][0-9]*$/;
195051
195096
  var RUN_DIR_NAME_RE = /^([^@]+)@([^@]+)$/;
195052
- function isRecord6(value2) {
195053
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
195054
- }
195055
- function isMigrationEnoent(error) {
195056
- return error instanceof Error && "code" in error && error.code === "ENOENT";
195057
- }
195058
195097
  async function listMigrationBookKeys(booksDirectory) {
195059
195098
  try {
195060
195099
  const entries = await readdir6(booksDirectory, { withFileTypes: true });
195061
195100
  return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((a, b2) => a.localeCompare(b2));
195062
195101
  } catch (error) {
195063
- if (isMigrationEnoent(error)) return [];
195102
+ if (isEnoent(error)) return [];
195064
195103
  throw error;
195065
195104
  }
195066
195105
  }
@@ -195069,7 +195108,7 @@ async function listMigrationDirents(directory) {
195069
195108
  const entries = await readdir6(directory, { withFileTypes: true });
195070
195109
  return [...entries].sort((a, b2) => a.name.localeCompare(b2.name));
195071
195110
  } catch (error) {
195072
- if (isMigrationEnoent(error)) return [];
195111
+ if (isEnoent(error)) return [];
195073
195112
  throw error;
195074
195113
  }
195075
195114
  }
@@ -195095,13 +195134,13 @@ async function readProjectRootFromRun(runDirectory) {
195095
195134
  const path8 = join17(runDirectory, page);
195096
195135
  try {
195097
195136
  const raw = JSON.parse(await readFile6(path8, "utf8"));
195098
- if (!isRecord6(raw)) continue;
195137
+ if (!isRecord(raw)) continue;
195099
195138
  const projectRoot = raw.projectRoot;
195100
195139
  if (typeof projectRoot === "string" && projectRoot.length > 0) {
195101
195140
  return { projectRoot, sourcePage: page };
195102
195141
  }
195103
195142
  } catch (error) {
195104
- if (isMigrationEnoent(error)) continue;
195143
+ if (isEnoent(error)) continue;
195105
195144
  throw error;
195106
195145
  }
195107
195146
  }
@@ -195140,9 +195179,6 @@ async function resolveMigratingRunTicket(runDirectory) {
195140
195179
  }
195141
195180
  };
195142
195181
  }
195143
- function isUnboundRunDirectory(runDirectory) {
195144
- return runDirectory.replaceAll("\\", "/").includes("/unbound/runs/");
195145
- }
195146
195182
  function bookHistoricalRoots(booksDirectory, backupBooksDirectory, bookKey) {
195147
195183
  return [join17(booksDirectory, bookKey), join17(backupBooksDirectory, bookKey)];
195148
195184
  }
@@ -195333,7 +195369,7 @@ function runCoordsFromSessionParent(sessionParent) {
195333
195369
  }
195334
195370
  function runIdFromSubject(subject) {
195335
195371
  if (typeof subject === "string" && subject.length > 0) return subject;
195336
- if (isRecord6(subject) && typeof subject.runId === "string" && subject.runId.length > 0) {
195372
+ if (isRecord(subject) && typeof subject.runId === "string" && subject.runId.length > 0) {
195337
195373
  return subject.runId;
195338
195374
  }
195339
195375
  return void 0;
@@ -195342,11 +195378,12 @@ function ticketNumberFromSubject(subject) {
195342
195378
  if (typeof subject === "string" || typeof subject === "number") {
195343
195379
  return ticketNumberFromUnknown(subject);
195344
195380
  }
195345
- if (isRecord6(subject)) return ticketNumberFromUnknown(subject.ticketNumber);
195381
+ if (isRecord(subject)) return ticketNumberFromUnknown(subject.ticketNumber);
195346
195382
  return void 0;
195347
195383
  }
195348
195384
 
195349
195385
  // src/book-topology-mixed-volume-migrators.ts
195386
+ init_unknown_value();
195350
195387
  var SITIAN_MIXED_VOLUME_PARTITIONS = [
195351
195388
  "attendance",
195352
195389
  "auditor",
@@ -195354,9 +195391,6 @@ var SITIAN_MIXED_VOLUME_PARTITIONS = [
195354
195391
  "gate"
195355
195392
  ];
195356
195393
  var CURRENT_SESSION_LEDGER = "current-session.json";
195357
- function isRecord7(value2) {
195358
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
195359
- }
195360
195394
  function posixRelative(from, to) {
195361
195395
  return relative4(from, to).split(sep7).join("/");
195362
195396
  }
@@ -195370,17 +195404,17 @@ function pathCandidatesFromRecord(record) {
195370
195404
  const seen = /* @__PURE__ */ new Set();
195371
195405
  addPathCandidate(paths, seen, record.sessionParent);
195372
195406
  addPathCandidate(paths, seen, record.parentSession);
195373
- if (!isRecord7(record.payload)) return paths;
195407
+ if (!isRecord(record.payload)) return paths;
195374
195408
  const payload = record.payload;
195375
195409
  addPathCandidate(paths, seen, payload.sessionParent);
195376
195410
  addPathCandidate(paths, seen, payload.parentSession);
195377
195411
  addPathCandidate(paths, seen, payload.sessionFile);
195378
- if (isRecord7(payload.parent)) {
195412
+ if (isRecord(payload.parent)) {
195379
195413
  addPathCandidate(paths, seen, payload.parent.sessionFile);
195380
195414
  addPathCandidate(paths, seen, payload.parent.sessionParent);
195381
195415
  addPathCandidate(paths, seen, payload.parent.parentSession);
195382
195416
  }
195383
- if (isRecord7(payload.data)) {
195417
+ if (isRecord(payload.data)) {
195384
195418
  addPathCandidate(paths, seen, payload.data.sessionParent);
195385
195419
  addPathCandidate(paths, seen, payload.data.parentSession);
195386
195420
  addPathCandidate(paths, seen, payload.data.sessionFile);
@@ -195410,7 +195444,7 @@ async function readRegularBackupFile(path8) {
195410
195444
  try {
195411
195445
  info = await lstat2(path8);
195412
195446
  } catch (error) {
195413
- if (isMigrationEnoent(error)) return void 0;
195447
+ if (isEnoent(error)) return void 0;
195414
195448
  throw error;
195415
195449
  }
195416
195450
  if (!info.isFile()) {
@@ -195435,7 +195469,7 @@ function inspectWorkerSubmissionGateVolume(text, bookRoots) {
195435
195469
  malformedRows.push({ lineNumber: row.lineNumber, raw: row.raw });
195436
195470
  continue;
195437
195471
  }
195438
- if (!isRecord7(parsed2)) {
195472
+ if (!isRecord(parsed2)) {
195439
195473
  malformedRows.push({ lineNumber: row.lineNumber, raw: row.raw });
195440
195474
  continue;
195441
195475
  }
@@ -195488,7 +195522,7 @@ async function migrateCurrentSessionPointer(input) {
195488
195522
  let sessionFile;
195489
195523
  try {
195490
195524
  const parsed2 = JSON.parse(raw);
195491
- if (isRecord7(parsed2) && typeof parsed2.sessionFile === "string" && parsed2.sessionFile.length > 0) {
195525
+ if (isRecord(parsed2) && typeof parsed2.sessionFile === "string" && parsed2.sessionFile.length > 0) {
195492
195526
  sessionFile = parsed2.sessionFile;
195493
195527
  }
195494
195528
  } catch {
@@ -195566,7 +195600,7 @@ async function migrateSitianMixedVolume(partition3, context) {
195566
195600
  });
195567
195601
  continue;
195568
195602
  }
195569
- if (!isRecord7(parsed2)) {
195603
+ if (!isRecord(parsed2)) {
195570
195604
  const dest2 = volumeDestinationFile(
195571
195605
  booksDirectory,
195572
195606
  bookKey,
@@ -195700,6 +195734,7 @@ init_activation_ledger_topology();
195700
195734
  import { cp as cp3, lstat as lstat3, mkdir as mkdir4, readFile as readFile8, stat as stat4, unlink as unlink2, utimes, writeFile as writeFile7 } from "node:fs/promises";
195701
195735
  import { basename as basename9, dirname as dirname11, join as join19, relative as relative5, resolve as resolve10, sep as sep8 } from "node:path";
195702
195736
  init_role_run_relocation();
195737
+ init_unknown_value();
195703
195738
  var AUDITOR_ROLES_PARTITION = "auditor-roles";
195704
195739
  var ISSUES_PARTITION = "issues";
195705
195740
  var DEPRECATED_KINDS_PARTITION = "deprecated-kinds";
@@ -195743,7 +195778,7 @@ async function directoryExists(path8) {
195743
195778
  const info = await stat4(path8);
195744
195779
  return info.isDirectory();
195745
195780
  } catch (error) {
195746
- if (isMigrationEnoent(error)) return false;
195781
+ if (isEnoent(error)) return false;
195747
195782
  throw error;
195748
195783
  }
195749
195784
  }
@@ -195819,7 +195854,7 @@ async function readJsonlParentSession(path8) {
195819
195854
  try {
195820
195855
  raw = await readFile8(path8, "utf8");
195821
195856
  } catch (error) {
195822
- if (isMigrationEnoent(error)) return void 0;
195857
+ if (isEnoent(error)) return void 0;
195823
195858
  throw error;
195824
195859
  }
195825
195860
  const newline = raw.indexOf("\n");
@@ -195827,7 +195862,7 @@ async function readJsonlParentSession(path8) {
195827
195862
  if (line.length === 0) return void 0;
195828
195863
  try {
195829
195864
  const header = JSON.parse(line);
195830
- if (header === null || typeof header !== "object" || Array.isArray(header)) {
195865
+ if (!isRecord(header)) {
195831
195866
  return void 0;
195832
195867
  }
195833
195868
  const parentSession = header.parentSession;
@@ -195847,13 +195882,13 @@ async function findTrueVolumeParent(backupBooksDirectory, booksDirectory, volume
195847
195882
  try {
195848
195883
  ledgerRaw = await readFile8(join19(volumeDirectory, CURRENT_SESSION_LEDGER2), "utf8");
195849
195884
  } catch (error) {
195850
- if (isMigrationEnoent(error)) return void 0;
195885
+ if (isEnoent(error)) return void 0;
195851
195886
  throw error;
195852
195887
  }
195853
195888
  let sessionFileField;
195854
195889
  try {
195855
195890
  const ledger = JSON.parse(ledgerRaw);
195856
- if (ledger === null || typeof ledger !== "object" || Array.isArray(ledger)) {
195891
+ if (!isRecord(ledger)) {
195857
195892
  return void 0;
195858
195893
  }
195859
195894
  const sessionFile = ledger.sessionFile;
@@ -195873,7 +195908,7 @@ async function findTrueVolumeParent(backupBooksDirectory, booksDirectory, volume
195873
195908
  const info = await lstat3(liveSession);
195874
195909
  if (!info.isFile()) return void 0;
195875
195910
  } catch (error) {
195876
- if (isMigrationEnoent(error)) return void 0;
195911
+ if (isEnoent(error)) return void 0;
195877
195912
  throw error;
195878
195913
  }
195879
195914
  const parentSession = await readJsonlParentSession(liveSession);
@@ -195954,7 +195989,7 @@ async function readSessionFileField(path8) {
195954
195989
  try {
195955
195990
  raw = await readFile8(path8, "utf8");
195956
195991
  } catch (error) {
195957
- if (isMigrationEnoent(error)) return void 0;
195992
+ if (isEnoent(error)) return void 0;
195958
195993
  throw error;
195959
195994
  }
195960
195995
  let parsed2;
@@ -195962,11 +195997,11 @@ async function readSessionFileField(path8) {
195962
195997
  parsed2 = JSON.parse(raw);
195963
195998
  } catch (error) {
195964
195999
  throw new Error(
195965
- `book topology migration cannot read current-session pointer at ${path8}: invalid JSON (${error instanceof Error ? error.message : String(error)})`,
196000
+ `book topology migration cannot read current-session pointer at ${path8}: invalid JSON (${errorText(error)})`,
195966
196001
  { cause: error }
195967
196002
  );
195968
196003
  }
195969
- if (parsed2 === null || typeof parsed2 !== "object" || Array.isArray(parsed2)) {
196004
+ if (!isRecord(parsed2)) {
195970
196005
  throw new Error(
195971
196006
  `book topology migration cannot read current-session pointer at ${path8}: expected a JSON object`
195972
196007
  );
@@ -196005,7 +196040,7 @@ async function mergeRewrittenCurrentSession(volumeDirectory, historicalVolume, d
196005
196040
  srcStat = await stat4(srcPath);
196006
196041
  srcRaw = await readFile8(srcPath, "utf8");
196007
196042
  } catch (error) {
196008
- if (isMigrationEnoent(error)) return;
196043
+ if (isEnoent(error)) return;
196009
196044
  throw error;
196010
196045
  }
196011
196046
  let nextRaw = srcRaw.endsWith("\n") ? srcRaw : `${srcRaw}
@@ -196013,7 +196048,7 @@ async function mergeRewrittenCurrentSession(volumeDirectory, historicalVolume, d
196013
196048
  let nextSessionFile;
196014
196049
  try {
196015
196050
  const parsed2 = JSON.parse(srcRaw);
196016
- if (parsed2 !== null && typeof parsed2 === "object" && !Array.isArray(parsed2)) {
196051
+ if (isRecord(parsed2)) {
196017
196052
  const record = parsed2;
196018
196053
  if (typeof record.sessionFile === "string") {
196019
196054
  const rewritten = rewritePathIntoDestination(
@@ -196035,7 +196070,7 @@ async function mergeRewrittenCurrentSession(volumeDirectory, historicalVolume, d
196035
196070
  try {
196036
196071
  destStat = await stat4(destPath);
196037
196072
  } catch (error) {
196038
- if (!isMigrationEnoent(error)) throw error;
196073
+ if (!isEnoent(error)) throw error;
196039
196074
  }
196040
196075
  await writeWinningCurrentSession(
196041
196076
  destPath,
@@ -196160,7 +196195,7 @@ async function copyIssuesNonRunTree(source, destination) {
196160
196195
  `book topology migration refuses to overwrite ${to} with ${from}`
196161
196196
  );
196162
196197
  } catch (error) {
196163
- if (!isMigrationEnoent(error)) throw error;
196198
+ if (!isEnoent(error)) throw error;
196164
196199
  }
196165
196200
  await cp3(from, to, { preserveTimestamps: true });
196166
196201
  }
@@ -196213,7 +196248,7 @@ async function unlinkIfPresent(path8) {
196213
196248
  try {
196214
196249
  await unlink2(path8);
196215
196250
  } catch (error) {
196216
- if (!isMigrationEnoent(error)) throw error;
196251
+ if (!isEnoent(error)) throw error;
196217
196252
  }
196218
196253
  }
196219
196254
  async function discardDeprecatedPagesFromRunSource(input) {
@@ -196319,22 +196354,20 @@ var BOOK_TOPOLOGY_T11_MIGRATORS = [
196319
196354
  ];
196320
196355
 
196321
196356
  // src/book-topology-record-class-migrators.ts
196322
- import { createHash as createHash3 } from "node:crypto";
196323
196357
  import { appendFile as appendFile2, mkdir as mkdir5, readFile as readFile9, stat as stat5, writeFile as writeFile8 } from "node:fs/promises";
196324
196358
  import { dirname as dirname12, join as join20, relative as relative6, sep as sep9 } from "node:path";
196325
196359
  init_sitian_appender();
196326
196360
  init_ticket_provenance_contracts();
196361
+ init_sha256();
196362
+ init_unknown_value();
196327
196363
  var TICKET_PROVENANCE = "ticket-provenance";
196328
196364
  var SUBMISSION_LEDGER = "submission-ledger";
196329
196365
  var ATTEMPT_HISTORY = "attempt-history";
196330
196366
  var MISPLACED = "misplaced-record-class";
196331
- function isRecord8(value2) {
196332
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
196333
- }
196334
196367
  function parseJsonlLine(raw) {
196335
196368
  try {
196336
196369
  const value2 = JSON.parse(raw);
196337
- if (!isRecord8(value2)) return { ok: false, raw };
196370
+ if (!isRecord(value2)) return { ok: false, raw };
196338
196371
  return { ok: true, value: value2, raw };
196339
196372
  } catch {
196340
196373
  return { ok: false, raw };
@@ -196347,14 +196380,14 @@ function lineSource(backupBooksDirectory, filePath, index3) {
196347
196380
  return `${sourceRelative(backupBooksDirectory, filePath)}#${index3 + 1}`;
196348
196381
  }
196349
196382
  function stableKey(material) {
196350
- return createHash3("sha256").update(material).digest("hex").slice(0, 32);
196383
+ return sha256Hex(material).slice(0, 32);
196351
196384
  }
196352
196385
  async function readJsonlLines(filePath) {
196353
196386
  let text;
196354
196387
  try {
196355
196388
  text = await readFile9(filePath, "utf8");
196356
196389
  } catch (error) {
196357
- if (isMigrationEnoent(error)) return [];
196390
+ if (isEnoent(error)) return [];
196358
196391
  throw error;
196359
196392
  }
196360
196393
  if (text.length === 0) return [];
@@ -196446,13 +196479,13 @@ var RecordWriteCache = class {
196446
196479
  }
196447
196480
  };
196448
196481
  function roleFromPayload(payload) {
196449
- if (isRecord8(payload) && typeof payload.role === "string" && payload.role.length > 0) {
196482
+ if (isRecord(payload) && typeof payload.role === "string" && payload.role.length > 0) {
196450
196483
  return payload.role;
196451
196484
  }
196452
196485
  return void 0;
196453
196486
  }
196454
196487
  function runIdFromPayload(payload) {
196455
- return isRecord8(payload) && typeof payload.runId === "string" && payload.runId.length > 0 ? payload.runId : void 0;
196488
+ return isRecord(payload) && typeof payload.runId === "string" && payload.runId.length > 0 ? payload.runId : void 0;
196456
196489
  }
196457
196490
  function recordClassOfKind(kind) {
196458
196491
  if (kind === TICKET_PROVENANCE) return TICKET_PROVENANCE;
@@ -196742,7 +196775,7 @@ async function mergeOfferedIdentities(destDir, volumeDir, writes) {
196742
196775
  await stat5(from);
196743
196776
  lines = await readJsonlLines(from);
196744
196777
  } catch (error) {
196745
- if (isMigrationEnoent(error)) return;
196778
+ if (isEnoent(error)) return;
196746
196779
  throw error;
196747
196780
  }
196748
196781
  const destFile = join20(destDir, OFFERED_IDENTITIES);
@@ -196797,7 +196830,7 @@ async function migrateHomePartitionBook(context, bookKey, writes, category, outc
196797
196830
  try {
196798
196831
  await stat5(recordsFile);
196799
196832
  } catch (error) {
196800
- if (isMigrationEnoent(error)) continue;
196833
+ if (isEnoent(error)) continue;
196801
196834
  throw error;
196802
196835
  }
196803
196836
  await migrateJsonlFileByKind(context, bookKey, writes, recordsFile, TICKET_PROVENANCE, outcomes);
@@ -196936,6 +196969,7 @@ import { basename as basename10, dirname as dirname13, join as join21, relative
196936
196969
  init_role_run_placement();
196937
196970
  init_role_run_relocation();
196938
196971
  init_run_ticket_number();
196972
+ init_unknown_value();
196939
196973
  var RUNS_PARTITION = "runs";
196940
196974
  var RUN_LEAF2 = /^([A-Za-z0-9][A-Za-z0-9._-]*)@([A-Za-z][A-Za-z0-9_-]*)$/;
196941
196975
  function parseRunLeaf2(name) {
@@ -196948,7 +196982,7 @@ async function pathExists2(path8) {
196948
196982
  await stat6(path8);
196949
196983
  return true;
196950
196984
  } catch (error) {
196951
- if (isMigrationEnoent(error)) return false;
196985
+ if (isEnoent(error)) return false;
196952
196986
  throw error;
196953
196987
  }
196954
196988
  }
@@ -197129,7 +197163,7 @@ async function relocateBoardBoundUnboundRunsInBook(bookDirectory) {
197129
197163
  try {
197130
197164
  entries = await readdir7(unboundRuns, { withFileTypes: true });
197131
197165
  } catch (error) {
197132
- if (isMigrationEnoent(error)) return [];
197166
+ if (isEnoent(error)) return [];
197133
197167
  throw error;
197134
197168
  }
197135
197169
  const planned = [];