@akagilnc/pi-workflow-roles 0.1.5368 → 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 (165) hide show
  1. package/dist/acp-host/production-host.js +719 -776
  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 +721 -780
  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 +3 -8
  45. package/dist/public-cli/cli.js +9 -8
  46. package/dist/public-cli/config.js +8 -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 +4 -3
  50. package/dist/public-cli/invocation.js +9 -8
  51. package/dist/public-cli/main.js +1531 -1567
  52. package/dist/public-cli/post-admission.js +4 -3
  53. package/dist/public-cli/run-lifecycle.js +14 -26
  54. package/dist/public-cli/settlement.js +10 -26
  55. package/dist/public-role-summons.js +3 -2
  56. package/dist/receipt-delivery-policy.js +1 -3
  57. package/dist/role-run-placement.js +3 -5
  58. package/dist/role-run-relocation.js +12 -19
  59. package/dist/run-terminal-artifacts.js +1 -11
  60. package/dist/run-ticket-number.js +2 -4
  61. package/dist/session-assistant-usage.js +2 -1
  62. package/dist/session-dialogue.js +1 -14
  63. package/dist/sitian-reader.js +2 -4
  64. package/dist/submission-correctable-error.js +2 -1
  65. package/dist/submission-errors.js +2 -1
  66. package/dist/submission-gate.js +2 -1
  67. package/dist/submission-ledger.js +4 -5
  68. package/dist/ticket-provenance-contracts.js +1 -3
  69. package/dist/ticket-provenance.js +2 -1
  70. package/dist/typed-provider-http.js +4 -7
  71. package/dist/unknown-value.js +28 -0
  72. package/dist/user-dialogue-stdin.js +2 -1
  73. package/package.json +1 -1
  74. package/src/acp-host/role-turn-host.ts +4 -2
  75. package/src/activation-ledger-git.ts +3 -2
  76. package/src/activation-ledger-topology.ts +4 -12
  77. package/src/analyst-entry.ts +3 -11
  78. package/src/analyst-gate-cycles-read.ts +3 -15
  79. package/src/analyst-index.ts +3 -13
  80. package/src/analyst-ledger.ts +2 -16
  81. package/src/analyst-metric-families/acceptance-success-rework.ts +2 -4
  82. package/src/analyst-metric-families/round-timeline.ts +2 -4
  83. package/src/analyst-page.ts +2 -2
  84. package/src/archivist-record-topology.ts +2 -2
  85. package/src/audit-escalation.ts +2 -1
  86. package/src/auditor-soul.ts +3 -1
  87. package/src/book-topology-migration-placement.ts +5 -16
  88. package/src/book-topology-migrators-t11.ts +16 -15
  89. package/src/book-topology-mixed-volume-migrators.ts +3 -6
  90. package/src/book-topology-record-class-migrators.ts +7 -10
  91. package/src/book-topology-runs-migrator.ts +4 -3
  92. package/src/collector-config.ts +7 -9
  93. package/src/compliance-transport.ts +2 -1
  94. package/src/countersign-contracts.ts +2 -1
  95. package/src/diarist-contracts.ts +3 -2
  96. package/src/doctor-contracts.ts +3 -1
  97. package/src/doctor-evidence.ts +8 -7
  98. package/src/doctor-role.ts +4 -2
  99. package/src/dossier-resolution.ts +2 -4
  100. package/src/engine-detour-tool.ts +0 -2
  101. package/src/engine-detour-usage.ts +2 -4
  102. package/src/external-host-turn-loop.ts +3 -1
  103. package/src/factory-board.ts +1 -8
  104. package/src/gatekeeper-role.ts +2 -10
  105. package/src/gleaner-left-contracts.ts +3 -1
  106. package/src/headless-host/description.ts +15 -18
  107. package/src/headless-host/role-turn-host.ts +10 -9
  108. package/src/host-session-record.ts +4 -2
  109. package/src/inspector-contracts.ts +2 -1
  110. package/src/ledger-session-read.ts +2 -5
  111. package/src/merger-contracts.ts +10 -9
  112. package/src/navigator-attendance.ts +10 -12
  113. package/src/navigator-invocation-identity.ts +3 -2
  114. package/src/navigator-public-session.ts +4 -6
  115. package/src/navigator-session-contracts.ts +8 -11
  116. package/src/navigator-work-base.ts +5 -8
  117. package/src/navigator-work-context.ts +2 -1
  118. package/src/notary-contracts.ts +4 -6
  119. package/src/oauth-keepalive.ts +5 -18
  120. package/src/package-contracts/auditor-output.ts +2 -4
  121. package/src/package-contracts/fixer-packet.ts +4 -6
  122. package/src/package-contracts/gatekeeper-output.ts +2 -4
  123. package/src/package-contracts/judge-output.ts +0 -1
  124. package/src/package-contracts/navigator-output.ts +8 -8
  125. package/src/package-contracts/terminating-infrastructure.ts +6 -20
  126. package/src/package-contracts/terminating-tools.ts +8 -12
  127. package/src/pi/adapter.ts +0 -1
  128. package/src/pi/role-turn-host.ts +0 -1
  129. package/src/public-cli/analyst-run.ts +4 -2
  130. package/src/public-cli/auto-resume.ts +4 -11
  131. package/src/public-cli/cli.ts +10 -10
  132. package/src/public-cli/config.ts +8 -27
  133. package/src/public-cli/countersign-run.ts +2 -4
  134. package/src/public-cli/host-providers.ts +10 -27
  135. package/src/public-cli/instruction-seat-run.ts +5 -3
  136. package/src/public-cli/invocation.ts +11 -10
  137. package/src/public-cli/post-admission.ts +5 -3
  138. package/src/public-cli/run-lifecycle.ts +20 -41
  139. package/src/public-cli/settlement.ts +11 -33
  140. package/src/public-role-summons.ts +4 -3
  141. package/src/receipt-delivery-policy.ts +1 -4
  142. package/src/reviewer-role.ts +0 -1
  143. package/src/role-envelope.ts +5 -3
  144. package/src/role-run-placement.ts +4 -10
  145. package/src/role-run-relocation.ts +13 -23
  146. package/src/role-runtime.ts +9 -15
  147. package/src/run-terminal-artifacts.ts +2 -16
  148. package/src/run-ticket-number.ts +4 -10
  149. package/src/session-assistant-usage.ts +3 -1
  150. package/src/session-dialogue.ts +1 -4
  151. package/src/session-identity.ts +0 -1
  152. package/src/sitian-reader.ts +2 -4
  153. package/src/submission-correctable-error.ts +3 -1
  154. package/src/submission-errors.ts +2 -1
  155. package/src/submission-gate.ts +3 -1
  156. package/src/submission-ledger.ts +5 -6
  157. package/src/ticket-provenance-contracts.ts +1 -4
  158. package/src/ticket-provenance.ts +3 -1
  159. package/src/ticket-snapshot.ts +2 -4
  160. package/src/ticket-trajectory.ts +1 -8
  161. package/src/typed-provider-http.ts +5 -15
  162. package/src/unknown-value.ts +34 -0
  163. package/src/user-dialogue-stdin.ts +3 -1
  164. package/src/worker-role.ts +2 -5
  165. package/src/worker-submission-gates.ts +5 -7
@@ -50,227 +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
- function isUnboundRunDirectory(runDirectory) {
218
- return runDirectory.replaceAll("\\", "/").includes("/unbound/runs/");
219
- }
220
- var init_role_run_placement = __esm({
221
- "src/role-run-placement.ts"() {
222
- "use strict";
223
- init_activation_ledger_topology();
224
- init_run_ticket_number();
225
- }
226
- });
227
-
228
- // src/public-cli/cli-errors.ts
229
- var init_cli_errors = __esm({
230
- "src/public-cli/cli-errors.ts"() {
231
- "use strict";
232
- }
233
- });
234
-
235
- // src/typed-provider-http.ts
236
- var init_typed_provider_http = __esm({
237
- "src/typed-provider-http.ts"() {
238
- "use strict";
239
- }
240
- });
241
-
242
- // src/collector-config.ts
243
- var init_collector_config = __esm({
244
- "src/collector-config.ts"() {
245
- "use strict";
246
- }
247
- });
248
-
249
- // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs
250
- var Metrics;
251
- var init_metrics = __esm({
252
- "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/metrics.mjs"() {
253
- Metrics = {
254
- assign: 0,
255
- create: 0,
256
- clone: 0,
257
- discard: 0,
258
- update: 0
259
- };
260
- }
261
- });
262
-
263
- // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs
264
- function Assign(left, right) {
265
- Metrics.assign += 1;
266
- return { ...left, ...right };
267
- }
268
- var init_assign = __esm({
269
- "node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/assign.mjs"() {
270
- init_metrics();
271
- }
272
- });
273
-
274
53
  // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/guard/string.mjs
275
54
  function IsBetween(value2, min, max) {
276
55
  return value2 >= min && value2 <= max;
@@ -707,6 +486,255 @@ var init_guard2 = __esm({
707
486
  }
708
487
  });
709
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
+
710
738
  // node_modules/.pnpm/typebox@1.3.8/node_modules/typebox/build/system/memory/clone.mjs
711
739
  function FromClassInstance(value2) {
712
740
  return value2;
@@ -8054,6 +8082,7 @@ var init_terminating_infrastructure = __esm({
8054
8082
  "src/package-contracts/terminating-infrastructure.ts"() {
8055
8083
  "use strict";
8056
8084
  init_build();
8085
+ init_unknown_value();
8057
8086
  INFRASTRUCTURE_FAILURE_DECLARATION_KEY = "infrastructureFailure";
8058
8087
  INFRASTRUCTURE_FAILURE_DIAGNOSTIC_KEY = "diagnostic";
8059
8088
  infrastructureFailureNested = typebox_exports.Object(
@@ -8085,6 +8114,7 @@ var init_gatekeeper_output = __esm({
8085
8114
  init_build();
8086
8115
  init_open_tool_schema();
8087
8116
  init_terminating_infrastructure();
8117
+ init_unknown_value();
8088
8118
  GATEKEEPER_OUTPUT_TOOL_NAME = "ak_gatekeeper_output";
8089
8119
  gatekeeperDecisionSchema = openToolObject(
8090
8120
  typebox_exports.Object({
@@ -8111,6 +8141,7 @@ var init_navigator_output = __esm({
8111
8141
  "src/package-contracts/navigator-output.ts"() {
8112
8142
  "use strict";
8113
8143
  init_build();
8144
+ init_unknown_value();
8114
8145
  init_open_tool_schema();
8115
8146
  init_terminating_infrastructure();
8116
8147
  NAVIGATOR_OUTPUT_TOOL_NAME = "ak_navigator_output";
@@ -13602,11 +13633,12 @@ var init_fixer_packet = __esm({
13602
13633
  "use strict";
13603
13634
  init_build();
13604
13635
  init_value2();
13636
+ init_unknown_value();
13605
13637
  FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
13606
13638
  fixerPrerequisiteSchema = typebox_exports.Object({
13607
13639
  id: typebox_exports.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
13608
13640
  requirement: typebox_exports.String({ pattern: "\\S" })
13609
- }, { additionalProperties: false });
13641
+ });
13610
13642
  fixerPrerequisitesSchema = typebox_exports.Array(fixerPrerequisiteSchema);
13611
13643
  }
13612
13644
  });
@@ -13639,6 +13671,7 @@ var init_doctor_contracts = __esm({
13639
13671
  init_canonical_json();
13640
13672
  init_open_tool_schema();
13641
13673
  init_terminating_infrastructure();
13674
+ init_unknown_value();
13642
13675
  DOCTOR_OUTPUT_TOOL_NAME = "ak_doctor_output";
13643
13676
  DOCTOR_AUDIT_TOOL_NAME = "ak_doctor_audit_decision";
13644
13677
  DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
@@ -13688,17 +13721,18 @@ var init_merger_contracts = __esm({
13688
13721
  init_exact_utf8();
13689
13722
  init_open_tool_schema();
13690
13723
  init_terminating_infrastructure();
13691
- materialSchema = typebox_exports.Object({ bytesBase64: typebox_exports.String(), sha256: typebox_exports.String() }, { additionalProperties: false });
13692
- 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 }) });
13693
13727
  mergerInputSchema = typebox_exports.Object({
13694
13728
  attemptId: typebox_exports.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
13695
13729
  targetObjectId: typebox_exports.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
13696
13730
  sourceObjectId: typebox_exports.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
13697
- 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 }),
13698
13732
  expectedConflictPaths: typebox_exports.Array(typebox_exports.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
13699
13733
  resolutionScope: typebox_exports.Array(typebox_exports.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
13700
13734
  authorizedChecks: typebox_exports.Array(checkSchema)
13701
- }, { additionalProperties: false });
13735
+ });
13702
13736
  MERGER_STATUS_DESCRIPTION = "completed | escalate";
13703
13737
  mergerOutputObject = typebox_exports.Object({
13704
13738
  status: typebox_exports.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
@@ -13720,6 +13754,7 @@ var init_notary_contracts = __esm({
13720
13754
  "src/notary-contracts.ts"() {
13721
13755
  "use strict";
13722
13756
  init_review_submission();
13757
+ init_unknown_value();
13723
13758
  NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13724
13759
  }
13725
13760
  });
@@ -13730,6 +13765,7 @@ var init_countersign_contracts = __esm({
13730
13765
  "src/countersign-contracts.ts"() {
13731
13766
  "use strict";
13732
13767
  init_review_submission();
13768
+ init_unknown_value();
13733
13769
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13734
13770
  }
13735
13771
  });
@@ -13739,6 +13775,7 @@ var GLEANER_LEFT_OUTPUT_TOOL_NAME;
13739
13775
  var init_gleaner_left_contracts = __esm({
13740
13776
  "src/gleaner-left-contracts.ts"() {
13741
13777
  "use strict";
13778
+ init_unknown_value();
13742
13779
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
13743
13780
  }
13744
13781
  });
@@ -13749,6 +13786,7 @@ var init_inspector_contracts = __esm({
13749
13786
  "src/inspector-contracts.ts"() {
13750
13787
  "use strict";
13751
13788
  init_review_submission();
13789
+ init_unknown_value();
13752
13790
  INSPECTOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13753
13791
  }
13754
13792
  });
@@ -13759,14 +13797,12 @@ var init_auditor_output = __esm({
13759
13797
  "src/package-contracts/auditor-output.ts"() {
13760
13798
  "use strict";
13761
13799
  init_review_submission();
13800
+ init_unknown_value();
13762
13801
  AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
13763
13802
  }
13764
13803
  });
13765
13804
 
13766
13805
  // src/ticket-provenance-contracts.ts
13767
- function isRecord(value2) {
13768
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
13769
- }
13770
13806
  function positiveInteger(value2) {
13771
13807
  if (typeof value2 === "number" && Number.isSafeInteger(value2) && value2 >= 1) return value2;
13772
13808
  if (typeof value2 === "string" && /^[1-9][0-9]*$/.test(value2)) {
@@ -13824,6 +13860,7 @@ function projectTicketProvenanceHeader(value2) {
13824
13860
  var init_ticket_provenance_contracts = __esm({
13825
13861
  "src/ticket-provenance-contracts.ts"() {
13826
13862
  "use strict";
13863
+ init_unknown_value();
13827
13864
  }
13828
13865
  });
13829
13866
 
@@ -13834,6 +13871,7 @@ var init_diarist_contracts = __esm({
13834
13871
  "use strict";
13835
13872
  init_ticket_provenance_contracts();
13836
13873
  init_run_ticket_number();
13874
+ init_unknown_value();
13837
13875
  DIARIST_OUTPUT_TOOL_NAME = "ak_diarist_output";
13838
13876
  }
13839
13877
  });
@@ -14396,6 +14434,7 @@ var init_submission_errors = __esm({
14396
14434
  "src/submission-errors.ts"() {
14397
14435
  "use strict";
14398
14436
  init_readable_gate_item();
14437
+ init_unknown_value();
14399
14438
  }
14400
14439
  });
14401
14440
 
@@ -14404,6 +14443,7 @@ var init_run_terminal_artifacts = __esm({
14404
14443
  "src/run-terminal-artifacts.ts"() {
14405
14444
  "use strict";
14406
14445
  init_role_run_placement();
14446
+ init_unknown_value();
14407
14447
  }
14408
14448
  });
14409
14449
 
@@ -14418,6 +14458,7 @@ var init_gatekeeper_role = __esm({
14418
14458
  init_review_submission();
14419
14459
  init_gatekeeper_output();
14420
14460
  init_run_terminal_artifacts();
14461
+ init_unknown_value();
14421
14462
  init_submission_errors();
14422
14463
  }
14423
14464
  });
@@ -14439,6 +14480,7 @@ var init_compliance_transport = __esm({
14439
14480
  init_submission_errors();
14440
14481
  init_terminal();
14441
14482
  init_readable_gate_item();
14483
+ init_unknown_value();
14442
14484
  AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
14443
14485
  }
14444
14486
  });
@@ -14447,9 +14489,6 @@ var init_compliance_transport = __esm({
14447
14489
  import { existsSync } from "node:fs";
14448
14490
  import { readdir as readdir2, readFile as readFile2, writeFile } from "node:fs/promises";
14449
14491
  import { join as join4, sep as sep2 } from "node:path";
14450
- function isEnoent2(error) {
14451
- return error instanceof Error && "code" in error && error.code === "ENOENT";
14452
- }
14453
14492
  function rewriteRunDirectoryPathValue(value2, oldRunDirectory, newRunDirectory) {
14454
14493
  if (typeof value2 !== "string") return value2;
14455
14494
  if (value2 === oldRunDirectory) return newRunDirectory;
@@ -14503,11 +14542,8 @@ function collectRewrites(input) {
14503
14542
  }
14504
14543
  return out;
14505
14544
  }
14506
- function isPlainObject(value2) {
14507
- return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
14508
- }
14509
14545
  function rewriteSourceRunLocator(value2, rewrites) {
14510
- if (!isPlainObject(value2)) return;
14546
+ if (!isRecord(value2)) return;
14511
14547
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14512
14548
  value2,
14513
14549
  SOURCE_RUN_LOCATOR_FIELDS,
@@ -14515,7 +14551,7 @@ function rewriteSourceRunLocator(value2, rewrites) {
14515
14551
  );
14516
14552
  }
14517
14553
  function rewriteSummonsMaterials(value2, rewrites) {
14518
- if (!isPlainObject(value2)) return;
14554
+ if (!isRecord(value2)) return;
14519
14555
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14520
14556
  value2,
14521
14557
  SUMMONS_PATH_FIELDS,
@@ -14533,12 +14569,12 @@ function rewriteAdmittedRoleRunPage(page, rewrites) {
14533
14569
  rewriteSourceRunLocator(page.sourceRun, rewrites);
14534
14570
  if (Array.isArray(page.attachments)) {
14535
14571
  for (const attachment of page.attachments) {
14536
- if (isPlainObject(attachment)) {
14572
+ if (isRecord(attachment)) {
14537
14573
  rewriteRunDirectoryPathFieldsAgainstRewrites(attachment, ["frozenPath"], rewrites);
14538
14574
  }
14539
14575
  }
14540
14576
  }
14541
- if (isPlainObject(page.principal)) {
14577
+ if (isRecord(page.principal)) {
14542
14578
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14543
14579
  page.principal,
14544
14580
  ["sessionDirectory", "sessionFile"],
@@ -14549,7 +14585,7 @@ function rewriteAdmittedRoleRunPage(page, rewrites) {
14549
14585
  async function rewriteOfficerPointerFile(path8, rewrites) {
14550
14586
  if (!existsSync(path8)) return;
14551
14587
  const page = JSON.parse(await readFile2(path8, "utf8"));
14552
- if (!isPlainObject(page)) return;
14588
+ if (!isRecord(page)) return;
14553
14589
  if (page.kind !== "direct-officer-run-pointer") return;
14554
14590
  const before = JSON.stringify(page);
14555
14591
  rewriteRunDirectoryPathFieldsAgainstRewrites(
@@ -14587,7 +14623,7 @@ async function rewriteSitianRecordsJsonl(path8, rewrites) {
14587
14623
  out.push(line);
14588
14624
  continue;
14589
14625
  }
14590
- if (!isPlainObject(parsed2)) {
14626
+ if (!isRecord(parsed2)) {
14591
14627
  out.push(line);
14592
14628
  continue;
14593
14629
  }
@@ -14638,7 +14674,7 @@ async function rewriteSessionTranscriptBindings(path8, rewrites) {
14638
14674
  out.push(line);
14639
14675
  continue;
14640
14676
  }
14641
- if (!isPlainObject(parsed2)) {
14677
+ if (!isRecord(parsed2)) {
14642
14678
  out.push(line);
14643
14679
  continue;
14644
14680
  }
@@ -14651,7 +14687,7 @@ async function rewriteSessionTranscriptBindings(path8, rewrites) {
14651
14687
  rewrites
14652
14688
  );
14653
14689
  if (parsed2.parentSession !== before) lineChanged = true;
14654
- } 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)) {
14655
14691
  const parent = parsed2.data.parent;
14656
14692
  const before = parent.sessionFile;
14657
14693
  rewriteRunDirectoryPathFieldsAgainstRewrites(
@@ -14680,7 +14716,7 @@ async function rewriteNestedMachinePathPages(pagesDirectory, rewrites) {
14680
14716
  try {
14681
14717
  entries = await readdir2(directory, { withFileTypes: true });
14682
14718
  } catch (error) {
14683
- if (isEnoent2(error)) return;
14719
+ if (isEnoent(error)) return;
14684
14720
  throw error;
14685
14721
  }
14686
14722
  for (const entry of entries) {
@@ -14733,14 +14769,14 @@ async function rewriteRoleRunDurablePages(input) {
14733
14769
  RUN_STATE_PAGE_FIELDS,
14734
14770
  rewrites
14735
14771
  );
14736
- if (isPlainObject(page.principal)) {
14772
+ if (isRecord(page.principal)) {
14737
14773
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14738
14774
  page.principal,
14739
14775
  ["sessionDirectory", "sessionFile"],
14740
14776
  rewrites
14741
14777
  );
14742
14778
  }
14743
- if (isPlainObject(page.currentCourt)) {
14779
+ if (isRecord(page.currentCourt)) {
14744
14780
  rewriteSummonsMaterials(page.currentCourt.summons, rewrites);
14745
14781
  }
14746
14782
  if (JSON.stringify(page) !== before) {
@@ -14755,6 +14791,7 @@ var init_role_run_relocation = __esm({
14755
14791
  "src/role-run-relocation.ts"() {
14756
14792
  "use strict";
14757
14793
  init_compliance_transport();
14794
+ init_unknown_value();
14758
14795
  ADMITTED_PAGE_FIELDS = [
14759
14796
  "runDirectory",
14760
14797
  "admittedRequestPath",
@@ -14798,13 +14835,7 @@ var init_engine_material = __esm({
14798
14835
  var init_activation_ledger_git = __esm({
14799
14836
  "src/activation-ledger-git.ts"() {
14800
14837
  "use strict";
14801
- }
14802
- });
14803
-
14804
- // src/sha256.ts
14805
- var init_sha256 = __esm({
14806
- "src/sha256.ts"() {
14807
- "use strict";
14838
+ init_unknown_value();
14808
14839
  }
14809
14840
  });
14810
14841
 
@@ -14814,6 +14845,7 @@ var init_submission_correctable_error = __esm({
14814
14845
  "src/submission-correctable-error.ts"() {
14815
14846
  "use strict";
14816
14847
  init_submission_errors();
14848
+ init_unknown_value();
14817
14849
  correctableSubmissionErrorBrand = /* @__PURE__ */ Symbol("ak-roles.correctable-submission-error");
14818
14850
  CorrectableSubmissionError = class extends Error {
14819
14851
  [correctableSubmissionErrorBrand] = true;
@@ -14843,6 +14875,7 @@ var init_terminating_tools = __esm({
14843
14875
  init_diarist_contracts();
14844
14876
  init_secretariat_contracts();
14845
14877
  init_worker_output();
14878
+ init_unknown_value();
14846
14879
  TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
14847
14880
  ...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
14848
14881
  ...LEGACY_REVIEW_OUTPUT_ROLES.keys()
@@ -14856,6 +14889,7 @@ var init_doctor_evidence = __esm({
14856
14889
  "use strict";
14857
14890
  init_sha256();
14858
14891
  init_terminating_tools();
14892
+ init_unknown_value();
14859
14893
  }
14860
14894
  });
14861
14895
 
@@ -14890,6 +14924,7 @@ var init_merger_git_state = __esm({
14890
14924
  var init_ledger_session_read = __esm({
14891
14925
  "src/ledger-session-read.ts"() {
14892
14926
  "use strict";
14927
+ init_unknown_value();
14893
14928
  }
14894
14929
  });
14895
14930
 
@@ -14897,6 +14932,7 @@ var init_ledger_session_read = __esm({
14897
14932
  var init_session_dialogue = __esm({
14898
14933
  "src/session-dialogue.ts"() {
14899
14934
  "use strict";
14935
+ init_unknown_value();
14900
14936
  }
14901
14937
  });
14902
14938
 
@@ -14929,6 +14965,7 @@ var init_sitian_appender = __esm({
14929
14965
  var init_sitian_reader = __esm({
14930
14966
  "src/sitian-reader.ts"() {
14931
14967
  "use strict";
14968
+ init_unknown_value();
14932
14969
  }
14933
14970
  });
14934
14971
 
@@ -14953,6 +14990,7 @@ var init_ticket_provenance = __esm({
14953
14990
  init_session_dialogue();
14954
14991
  init_sitian_facade();
14955
14992
  init_ticket_provenance_contracts();
14993
+ init_unknown_value();
14956
14994
  }
14957
14995
  });
14958
14996
 
@@ -15763,6 +15801,7 @@ var init_invocation = __esm({
15763
15801
  init_engine_material();
15764
15802
  init_cli_errors();
15765
15803
  init_option_definitions();
15804
+ init_unknown_value();
15766
15805
  }
15767
15806
  });
15768
15807
 
@@ -15818,6 +15857,7 @@ var init_run_lifecycle = __esm({
15818
15857
  init_engine_material();
15819
15858
  init_packaged_role_registry();
15820
15859
  init_invocation();
15860
+ init_unknown_value();
15821
15861
  }
15822
15862
  });
15823
15863
 
@@ -82458,7 +82498,7 @@ var require_extend = __commonJS({
82458
82498
  }
82459
82499
  return toStr.call(arr) === "[object Array]";
82460
82500
  };
82461
- var isPlainObject3 = function isPlainObject4(obj) {
82501
+ var isPlainObject2 = function isPlainObject3(obj) {
82462
82502
  if (!obj || toStr.call(obj) !== "[object Object]") {
82463
82503
  return false;
82464
82504
  }
@@ -82515,12 +82555,12 @@ var require_extend = __commonJS({
82515
82555
  src = getProperty(target, name);
82516
82556
  copy = getProperty(options, name);
82517
82557
  if (target !== copy) {
82518
- if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray3(copy)))) {
82558
+ if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray3(copy)))) {
82519
82559
  if (copyIsArray) {
82520
82560
  copyIsArray = false;
82521
82561
  clone2 = src && isArray3(src) ? src : [];
82522
82562
  } else {
82523
- clone2 = src && isPlainObject3(src) ? src : {};
82563
+ clone2 = src && isPlainObject2(src) ? src : {};
82524
82564
  }
82525
82565
  setProperty(target, { name, newValue: extend(deep, clone2, copy) });
82526
82566
  } else if (typeof copy !== "undefined") {
@@ -117308,12 +117348,12 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
117308
117348
  }
117309
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"]);
117310
117350
  const nextOptions = Object.assign({}, rest);
117311
- if (isPlainObject2(query)) {
117351
+ if (isPlainObject(query)) {
117312
117352
  nextOptions.extra_query = query;
117313
117353
  } else {
117314
117354
  warnIgnoredOption("query", query);
117315
117355
  }
117316
- if (isPlainObject2(body)) {
117356
+ if (isPlainObject(body)) {
117317
117357
  nextOptions.extra_body = body;
117318
117358
  } else {
117319
117359
  warnIgnoredOption("body", body);
@@ -117410,7 +117450,7 @@ function wrapStreamErrors(stream12) {
117410
117450
  });
117411
117451
  }
117412
117452
  function attachSdkHttpResponse(value2, call) {
117413
- if (!isPlainObject2(value2) || call.status !== "complete") {
117453
+ if (!isPlainObject(value2) || call.status !== "complete") {
117414
117454
  return value2;
117415
117455
  }
117416
117456
  return Object.assign(Object.assign({}, value2), { sdkHttpResponse: createSdkHttpResponse(call.response, value2) });
@@ -117434,7 +117474,7 @@ function addOutputPropertiesIfInteraction(value2) {
117434
117474
  return addOutputProperties(interaction);
117435
117475
  }
117436
117476
  function normalizeInteractionShape(value2) {
117437
- if (!isPlainObject2(value2)) {
117477
+ if (!isPlainObject(value2)) {
117438
117478
  return void 0;
117439
117479
  }
117440
117480
  if (Array.isArray(value2["steps"])) {
@@ -117453,7 +117493,7 @@ function isLegacyLyriaInteraction(value2) {
117453
117493
  const model = value2["model"];
117454
117494
  return typeof model === "string" && LEGACY_LYRIA_MODELS.has(model);
117455
117495
  }
117456
- function isPlainObject2(value2) {
117496
+ function isPlainObject(value2) {
117457
117497
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
117458
117498
  }
117459
117499
  function addOutputProperties(interaction) {
@@ -190505,7 +190545,7 @@ var init_dist7 = __esm({
190505
190545
  });
190506
190546
 
190507
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
190508
- import { createHash, randomBytes as randomBytes2 } from "node:crypto";
190548
+ import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
190509
190549
  import { writeFile as writeFile5 } from "node:fs/promises";
190510
190550
  import { tmpdir as tmpdir2 } from "node:os";
190511
190551
  import { join as join13 } from "node:path";
@@ -190521,7 +190561,7 @@ function createMcpToolName(server, tool, isTaken = () => false) {
190521
190561
  const name = `mcp__${server}__${tool}`.replace(/[^A-Za-z0-9_-]/g, "_");
190522
190562
  if (name.length <= MAX_TOOL_NAME_LENGTH && !isTaken(name))
190523
190563
  return name;
190524
- 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);
190525
190565
  return `${name.slice(0, MAX_TOOL_NAME_LENGTH - hash.length - 1)}_${hash}`;
190526
190566
  }
190527
190567
  function textOf2(content) {
@@ -191811,7 +191851,7 @@ var init_oauth_page = __esm({
191811
191851
  });
191812
191852
 
191813
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
191814
- import { createHash as createHash2 } from "node:crypto";
191854
+ import { createHash as createHash3 } from "node:crypto";
191815
191855
  import { mkdirSync as mkdirSync4 } from "node:fs";
191816
191856
  import { join as join14 } from "node:path";
191817
191857
  function callbackSettings(settings3) {
@@ -192040,7 +192080,7 @@ var init_oauth2 = __esm({
192040
192080
  if (!this.lockDir)
192041
192081
  return fn();
192042
192082
  mkdirSync4(this.lockDir, { recursive: true, mode: 448 });
192043
- const hash = createHash2("sha256").update(key).digest("hex").slice(0, 16);
192083
+ const hash = createHash3("sha256").update(key).digest("hex").slice(0, 16);
192044
192084
  const release = await import_proper_lockfile4.default.lock(join14(this.lockDir, `mcp-auth-refresh-${hash}`), {
192045
192085
  realpath: false,
192046
192086
  stale: REFRESH_LOCK_STALE_MS,
@@ -195033,6 +195073,7 @@ import { dirname as dirname10, join as join18, relative as relative4, resolve as
195033
195073
  init_activation_ledger_topology();
195034
195074
 
195035
195075
  // src/archivist-record-topology.ts
195076
+ init_sha256();
195036
195077
  init_activation_ledger_git();
195037
195078
  init_activation_ledger_topology();
195038
195079
 
@@ -195048,22 +195089,17 @@ var WORKER_SUBMISSION_GATE_KIND = "worker-submission-gate";
195048
195089
  init_activation_ledger_topology();
195049
195090
  init_role_run_placement();
195050
195091
  init_run_ticket_number();
195092
+ init_unknown_value();
195051
195093
  import { readdir as readdir6, readFile as readFile6 } from "node:fs/promises";
195052
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";
195053
195095
  var TICKET_NUMBER_RE = /^[1-9][0-9]*$/;
195054
195096
  var RUN_DIR_NAME_RE = /^([^@]+)@([^@]+)$/;
195055
- function isRecord6(value2) {
195056
- return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
195057
- }
195058
- function isMigrationEnoent(error) {
195059
- return error instanceof Error && "code" in error && error.code === "ENOENT";
195060
- }
195061
195097
  async function listMigrationBookKeys(booksDirectory) {
195062
195098
  try {
195063
195099
  const entries = await readdir6(booksDirectory, { withFileTypes: true });
195064
195100
  return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((a, b2) => a.localeCompare(b2));
195065
195101
  } catch (error) {
195066
- if (isMigrationEnoent(error)) return [];
195102
+ if (isEnoent(error)) return [];
195067
195103
  throw error;
195068
195104
  }
195069
195105
  }
@@ -195072,7 +195108,7 @@ async function listMigrationDirents(directory) {
195072
195108
  const entries = await readdir6(directory, { withFileTypes: true });
195073
195109
  return [...entries].sort((a, b2) => a.name.localeCompare(b2.name));
195074
195110
  } catch (error) {
195075
- if (isMigrationEnoent(error)) return [];
195111
+ if (isEnoent(error)) return [];
195076
195112
  throw error;
195077
195113
  }
195078
195114
  }
@@ -195098,13 +195134,13 @@ async function readProjectRootFromRun(runDirectory) {
195098
195134
  const path8 = join17(runDirectory, page);
195099
195135
  try {
195100
195136
  const raw = JSON.parse(await readFile6(path8, "utf8"));
195101
- if (!isRecord6(raw)) continue;
195137
+ if (!isRecord(raw)) continue;
195102
195138
  const projectRoot = raw.projectRoot;
195103
195139
  if (typeof projectRoot === "string" && projectRoot.length > 0) {
195104
195140
  return { projectRoot, sourcePage: page };
195105
195141
  }
195106
195142
  } catch (error) {
195107
- if (isMigrationEnoent(error)) continue;
195143
+ if (isEnoent(error)) continue;
195108
195144
  throw error;
195109
195145
  }
195110
195146
  }
@@ -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 = [];