@akagilnc/pi-workflow-roles 0.1.6108 → 0.1.6115

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 (65) hide show
  1. package/dist/acp-host/production-host.js +209 -177
  2. package/dist/compliance-transport.js +3 -3
  3. package/dist/diarist-contracts.js +0 -16
  4. package/dist/diarist-role.js +1 -2
  5. package/dist/doctor-contracts.js +1 -5
  6. package/dist/gatekeeper-role.js +6 -9
  7. package/dist/headless-host/production-host.js +162 -130
  8. package/dist/inspector-contracts.js +2 -22
  9. package/dist/inspector-role.js +1 -2
  10. package/dist/merger-contracts.js +1 -5
  11. package/dist/migrate-book-topology.js +32 -45
  12. package/dist/navigator-invocation-identity.js +8 -10
  13. package/dist/notary-contracts.js +1 -9
  14. package/dist/package-contracts/auditor-output.js +0 -10
  15. package/dist/package-contracts/fixer-output.js +3 -0
  16. package/dist/package-contracts/gatekeeper-output.js +1 -7
  17. package/dist/package-contracts/navigator-output.js +1 -25
  18. package/dist/package-contracts/reviewer-output.js +1 -5
  19. package/dist/package-contracts/terminating-tools.js +10 -24
  20. package/dist/packaged-role-registry.js +20 -4
  21. package/dist/public-cli/countersign-run.js +2 -4
  22. package/dist/public-cli/instruction-seat-run.js +55 -16
  23. package/dist/public-cli/invocation.js +22 -12
  24. package/dist/public-cli/main.js +192 -143
  25. package/dist/public-cli/post-admission.js +2 -2
  26. package/dist/review-submission.js +1 -1
  27. package/dist/role-runtime.js +15 -32
  28. package/dist/secretariat-contracts.js +1 -1
  29. package/dist/submission-errors.js +0 -9
  30. package/dist/submission-gate.js +3 -7
  31. package/dist/submission-ledger.js +4 -12
  32. package/dist/ticket-progress.js +64 -28
  33. package/dist/ticket-trajectory.js +6 -17
  34. package/dist/worker-role.js +3 -4
  35. package/package.json +1 -1
  36. package/src/compliance-transport.ts +3 -3
  37. package/src/diarist-contracts.ts +0 -16
  38. package/src/diarist-role.ts +0 -2
  39. package/src/doctor-contracts.ts +0 -4
  40. package/src/gatekeeper-role.ts +6 -9
  41. package/src/inspector-contracts.ts +1 -21
  42. package/src/inspector-role.ts +0 -2
  43. package/src/merger-contracts.ts +0 -4
  44. package/src/navigator-invocation-identity.ts +9 -16
  45. package/src/notary-contracts.ts +0 -13
  46. package/src/package-contracts/auditor-output.ts +0 -12
  47. package/src/package-contracts/fixer-output.ts +4 -0
  48. package/src/package-contracts/gatekeeper-output.ts +0 -9
  49. package/src/package-contracts/navigator-output.ts +0 -34
  50. package/src/package-contracts/reviewer-output.ts +0 -4
  51. package/src/package-contracts/terminating-tools.ts +21 -37
  52. package/src/packaged-role-registry.ts +33 -3
  53. package/src/public-cli/countersign-run.ts +2 -5
  54. package/src/public-cli/instruction-seat-run.ts +58 -13
  55. package/src/public-cli/invocation.ts +31 -16
  56. package/src/public-cli/post-admission.ts +2 -2
  57. package/src/review-submission.ts +1 -1
  58. package/src/role-runtime.ts +16 -29
  59. package/src/secretariat-contracts.ts +2 -3
  60. package/src/submission-errors.ts +0 -8
  61. package/src/submission-gate.ts +3 -7
  62. package/src/submission-ledger.ts +3 -11
  63. package/src/ticket-progress.ts +76 -33
  64. package/src/ticket-trajectory.ts +5 -18
  65. package/src/worker-role.ts +3 -4
@@ -9149,7 +9149,6 @@ var init_gatekeeper_output = __esm({
9149
9149
  init_build();
9150
9150
  init_open_tool_schema();
9151
9151
  init_terminating_infrastructure();
9152
- init_unknown_value();
9153
9152
  GATEKEEPER_OUTPUT_TOOL_NAME = "ak_gatekeeper_output";
9154
9153
  gatekeeperDecisionSchema = openToolObject(
9155
9154
  typebox_exports.Object({
@@ -9445,7 +9444,7 @@ var init_review_submission = __esm({
9445
9444
  );
9446
9445
  ARCH_TABLE_COMMON = "\u67B6\u6784\u5F52\u4F4D\u8868\uFF1A\u5148\u76D8\u65E2\u6709\u67B6\u6784\u2014\u2014docs/adr \u4E0E\u7968\u9762\u70B9\u540D\u6CD5\u6E90\u91CC\u7684\u5C42\u8868\u4E0E\u89C4\u77E9\uFF0C\u518D\u6253\u5F00\u5206\u5C42\u914D\u7F6E\u4E0E\u4EE3\u7801\u770B\u6BCF\u5C42\u73B0\u5728\u88C5\u7740\u4EC0\u4E48\u3001\u6709\u6CA1\u6709\u6CD5\u6E90\u91CC\u6CA1\u6709\u7684\u5C42\u3002\u9075\u5FAA\u884C\uFF1A\u7A3F\u91CC\u6BCF\u6837\u8FDB\u4EE3\u7801\u7684\u4E1C\u897F\u5404\u4E00\u884C\uFF0C\u5F52\u5230\u6CD5\u6E90\u7684\u5C42\u91CC\uFF1B\u6838\u67B6\u6784\u884C\uFF1A\u65E2\u6709\u67B6\u6784\u6BCF\u6761\u6761\u6B3E\u5404\u4E00\u884C\uFF0C\u8054\u7F51\u627E\u6240\u9009\u6846\u67B6\u5B98\u65B9\u6587\u6863\u4E0E\u516C\u8BA4\u8D44\u6599\u91CC\u627F\u62C5\u540C\u4E00\u5173\u5207\u7684\u505A\u6CD5\uFF0C\u9644\u94FE\u63A5\u4E0E\u539F\u53E5\u3002\u6CD5\u6E90\u91CC\u65E2\u6CA1\u6709\u5C42\u8868\u4E5F\u6CA1\u6709\u67B6\u6784\u89C4\u77E9\u65F6\u624D\u4E3A\u7A7A\u6570\u7EC4\uFF0C\u5E76\u5728 note \u5199\u660E\uFF1B\u53EA\u6709\u89C4\u77E9\u6CA1\u6709\u5C42\u8868\u7684\uFF0C\u9075\u5FAA\u884C\u7684 layer \u5199\u88AB\u6838\u7684\u90A3\u6761\u89C4\u77E9\u539F\u53E5\uFF0C\u6838\u67B6\u6784\u884C\u6309\u89C4\u77E9\u9010\u6761\u5217\u3002";
9447
9446
  secretariatArchitectureField = typebox_exports.Array(architectureRowSchema, {
9448
- description: `${ARCH_TABLE_COMMON}\u6709\u300C\u4E0D\u5408\u300D\u6216\u300C\u53EF\u6539\u8FDB\u300D\u884C\uFF0CsecretariatStatus \u53EA\u80FD\u662F escalate\uFF1A\u4E0D\u5408\u884C\u7684\u539F\u6587\u4E0E\u4E24\u8FB9\uFF08\u6539\u7A3F\u5F52\u4F4D\uFF0F\u6539\u67B6\u6784\uFF09\u3001\u53EF\u6539\u8FDB\u7684\u5EFA\u8BAE\uFF0C\u90FD\u5217\u8FDB decisionGate \u7531\u965B\u4E0B\u62CD\uFF0C\u4E0D\u51FA\u7ED9\u5BB0\u76F8\u7B54\u3002`
9447
+ description: `${ARCH_TABLE_COMMON}\u6709\u300C\u4E0D\u5408\u300D\u6216\u300C\u53EF\u6539\u8FDB\u300D\u884C\uFF0Cstatus \u53EA\u80FD\u662F escalate\uFF1A\u4E0D\u5408\u884C\u7684\u539F\u6587\u4E0E\u4E24\u8FB9\uFF08\u6539\u7A3F\u5F52\u4F4D\uFF0F\u6539\u67B6\u6784\uFF09\u3001\u53EF\u6539\u8FDB\u7684\u5EFA\u8BAE\uFF0C\u90FD\u5217\u8FDB decisionGate \u7531\u965B\u4E0B\u62CD\uFF0C\u4E0D\u51FA\u7ED9\u5BB0\u76F8\u7B54\u3002`
9449
9448
  });
9450
9449
  countersignArchitectureField = typebox_exports.Array(architectureRowSchema, {
9451
9450
  description: `${ARCH_TABLE_COMMON}\u6709\u300C\u4E0D\u5408\u300D\u884C\u4E0D\u5F97\u7F72\uFF1A\u7968\u9762\u610F\u5728\u6539\u67B6\u6784\u7684\u4E0A\u5448\uFF0C\u5426\u5219\u5C01\u9A73\u9000\u7B7E\u53D1\u65B9\u5F52\u4F4D\uFF1B\u6709\u300C\u53EF\u6539\u8FDB\u300D\u884C\u4E0A\u5448\uFF0C\u5EFA\u8BAE\u9644\u539F\u6587\u3002`
@@ -9605,6 +9604,9 @@ var init_fixer_output = __esm({
9605
9604
  classResults: typebox_exports.Unknown({
9606
9605
  description: "\u5404\u7C7B class \u7ED3\u7B97\uFF0C\u539F\u6837\u7559\u5B58\u3002\u6BCF\u7C7B\u5199 name\u3001shape\uFF08\u9519\u8BEF\u5F62\u72B6\u4E00\u53E5\uFF09\u3002\u6309\u4EE3\u7801\u5F62\u72B6\u8BA4\u7684\u7C7B\u5199 search\uFF08\u5B9E\u9645\u8DD1\u7684\u641C\u7D22\u547D\u4EE4\uFF0C\u539F\u6837\uFF09\u3001hits\uFF08\u547D\u4EE4\u8F93\u51FA\u7684\u6BCF\u4E2A\u547D\u4E2D\u4E00\u884C { where: path:line, outcome: \u5DF2\u4FEE | \u4E0D\u540C\u7C7B\uFF1A\u7406\u7531 }\uFF09\uFF1B\u6309\u60C5\u5F62\u8BA4\u7684\u7C7B\u5199 cases\uFF08\u6BCF\u79CD\u524D\u5E8F\u7ECF\u5386\u4E00\u884C { case: \u5BF9\u8C61\u5148\u7ECF\u5386\u4E86\u4EC0\u4E48, entry: \u4ECE\u771F\u5B9E\u5165\u53E3\u600E\u4E48\u8D70\u5230\u5B83, before: \u4FEE\u524D\u7ED3\u679C, after: \u4FEE\u540E\u7ED3\u679C }\uFF09\u3002\u5220\u5E76\u7C7B\u5199 files\uFF08\u672C\u7968\u8D77\u70B9\u5230 HEAD \u7684 git diff --name-status \u91CC\u6BCF\u4E2A\u6587\u4EF6\u4E00\u884C { file, hits: \u8BE5\u7C7B\u5728\u6B64\u6587\u4EF6\u7684\u547D\u4E2D path:line \u5217\u8868\uFF0C\u6CA1\u6709\u4E3A\u7A7A, outcome: \u5DF2\u4FEE | \u65E0\uFF1A\u6BD4\u5BF9\u4E86\u54EA\u51E0\u5904\u3001\u4E3A\u4EC0\u4E48\u4E0D\u7B97 | \u672A\u4FEE\uFF1A\u7406\u7531 }\uFF09\u3002\u5B8C\u6210\u9879\u7684 disposition \u4E3A completed\uFF0C\u53EF\u5199 commitSha\u3002\u62D2\u7EDD\u9879\u7684 disposition \u4E3A refused\uFF0C\u53EF\u5199 remainingScope\u3001blocker\u3002"
9607
9606
  }),
9607
+ for: typebox_exports.Unknown({
9608
+ description: "\u4FEE\u7684\u662F\u54EA\u4EFD\u5224\u8BCD\uFF1A<\u5E2D>#<\u8F6E>\uFF0C\u5982 judge#5\uFF0C\u539F\u6837\u843D\u5230\u8FDB\u5EA6\u884C\uFF1B\u6CA1\u6709\u5C31\u586B null\u3002"
9609
+ }),
9608
9610
  diffItems: diffItemsField,
9609
9611
  testEvidence: typebox_exports.Unknown({
9610
9612
  description: "\u4EC5 diff \u542B\u6D4B\u8BD5\u6539\u52A8\u65F6\u586B\u6D4B\u8BD5\u8BC1\u636E\u6761\uFF1B\u6CA1\u6709\u5C31\u586B null\u3002\u673A\u5668\u4E0D\u6838\u9A8C\u3002\u53EF\u5199 contract\uFF08\u6D4B\u8BD5\u6539\u52A8\u6240\u8BC1\u660E\u7684\u5951\u7EA6\uFF09\u3001minimumNecessaryCost\uFF08\u6D4B\u8BD5\u6539\u52A8\u7684\u4E00\u884C\u6700\u5C0F\u5FC5\u8981\u6210\u672C\uFF09\u3001measuredDuration\uFF08\u805A\u7126\u9A8C\u8BC1\u5B9E\u6D4B\u65F6\u957F\uFF09\u3002"
@@ -9779,7 +9781,6 @@ var init_notary_contracts = __esm({
9779
9781
  "src/notary-contracts.ts"() {
9780
9782
  "use strict";
9781
9783
  init_review_submission();
9782
- init_unknown_value();
9783
9784
  NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
9784
9785
  }
9785
9786
  });
@@ -9824,7 +9825,6 @@ var init_inspector_contracts = __esm({
9824
9825
  "src/inspector-contracts.ts"() {
9825
9826
  "use strict";
9826
9827
  init_review_submission();
9827
- init_unknown_value();
9828
9828
  INSPECTOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
9829
9829
  }
9830
9830
  });
@@ -9835,7 +9835,6 @@ var init_auditor_output = __esm({
9835
9835
  "src/package-contracts/auditor-output.ts"() {
9836
9836
  "use strict";
9837
9837
  init_review_submission();
9838
- init_unknown_value();
9839
9838
  AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
9840
9839
  }
9841
9840
  });
@@ -9949,7 +9948,7 @@ var init_secretariat_contracts = __esm({
9949
9948
  secretariatVerdictSchema = withTerminatingOutputDeclarations(
9950
9949
  typebox_exports.Object(
9951
9950
  {
9952
- secretariatStatus: typebox_exports.Unknown({
9951
+ status: typebox_exports.Unknown({
9953
9952
  description: "converged | escalate"
9954
9953
  }),
9955
9954
  ticketNumber: typebox_exports.Optional(
@@ -10019,8 +10018,25 @@ __export(packaged_role_registry_exports, {
10019
10018
  packagedRolePhaseFlag: () => packagedRolePhaseFlag,
10020
10019
  packagedRoleSessionMaterials: () => packagedRoleSessionMaterials,
10021
10020
  packagedStoresSourceRunRaw: () => packagedStoresSourceRunRaw,
10022
- packagedSubjectChoices: () => packagedSubjectChoices
10021
+ packagedSubjectChoices: () => packagedSubjectChoices,
10022
+ receiptSeat: () => receiptSeat,
10023
+ receiptStatus: () => receiptStatus
10023
10024
  });
10025
+ function receiptStatus(receipt) {
10026
+ if (!isRecord(receipt)) return void 0;
10027
+ for (const key of RECEIPT_STATUS_KEYS) {
10028
+ if (Object.hasOwn(receipt, key)) return receipt[key];
10029
+ }
10030
+ return void 0;
10031
+ }
10032
+ function receiptSeat(toolName, runSeat) {
10033
+ const legacy = LEGACY_REVIEW_OUTPUT_ROLES.get(toolName);
10034
+ if (legacy !== void 0) return { seat: legacy, source: "tool" };
10035
+ const owners = PACKAGED_ROLE_REGISTRY.filter((entry) => entry.outputTool === toolName);
10036
+ if (owners.length === 1) return { seat: owners[0].role, source: "tool" };
10037
+ const seat = owners.length === 0 ? void 0 : runSeat();
10038
+ return seat === void 0 ? void 0 : { seat, source: "invocation" };
10039
+ }
10024
10040
  function packagedRoleMetadata(role) {
10025
10041
  return PACKAGED_ROLE_REGISTRY.find((entry) => entry.role === role);
10026
10042
  }
@@ -10150,7 +10166,7 @@ function packagedGateSummon(role) {
10150
10166
  if (record !== void 0 && "gateSummon" in record) return record.gateSummon;
10151
10167
  return "pointer";
10152
10168
  }
10153
- var LEGACY_REVIEW_OUTPUT_ROLES, NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
10169
+ var LEGACY_REVIEW_OUTPUT_ROLES, RECEIPT_STATUS_KEYS, NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
10154
10170
  var init_packaged_role_registry = __esm({
10155
10171
  "src/packaged-role-registry.ts"() {
10156
10172
  "use strict";
@@ -10170,6 +10186,7 @@ var init_packaged_role_registry = __esm({
10170
10186
  init_diarist_contracts();
10171
10187
  init_secretariat_contracts();
10172
10188
  init_judge_auditor();
10189
+ init_unknown_value();
10173
10190
  LEGACY_REVIEW_OUTPUT_ROLES = /* @__PURE__ */ new Map([
10174
10191
  ["ak_judge_output", "judge"],
10175
10192
  ["ak_notary_output", "notary"],
@@ -10177,6 +10194,7 @@ var init_packaged_role_registry = __esm({
10177
10194
  ["ak_inspector_output", "inspector"],
10178
10195
  ["ak_auditor_output", "auditor"]
10179
10196
  ]);
10197
+ RECEIPT_STATUS_KEYS = ["status", "secretariatStatus", "judgeStatus", "countersignStatus"];
10180
10198
  NOTARY_SESSION_MATERIALS = [
10181
10199
  "CLAUDE.md",
10182
10200
  "souls/notary.md",
@@ -10220,7 +10238,6 @@ var init_packaged_role_registry = __esm({
10220
10238
  /** Factory board: court until another station has started, then marshal. */
10221
10239
  boardPlacement: "judge-history",
10222
10240
  activationStage: "load-and-install",
10223
- receiptStatusKey: "status",
10224
10241
  sessionMaterials: [
10225
10242
  "CLAUDE.md",
10226
10243
  "souls/judge.md",
@@ -10448,7 +10465,6 @@ var init_packaged_role_registry = __esm({
10448
10465
  { field: "ticketNumber" }
10449
10466
  ],
10450
10467
  activationStage: "load-and-install",
10451
- receiptStatusKey: "status",
10452
10468
  // #924: 公用《票面法》三席同装
10453
10469
  sessionMaterials: ["CLAUDE.md", "souls/countersign.md", "souls/ticket-law.md", "souls/design-law.md", "souls/audit-law.md", "souls/quality-law.md", "resources/countersign-ticket-issue.md", "docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"]
10454
10470
  },
@@ -10466,7 +10482,6 @@ var init_packaged_role_registry = __esm({
10466
10482
  { field: "ticketNumber" }
10467
10483
  ],
10468
10484
  activationStage: "load-and-install",
10469
- receiptStatusKey: "secretariatStatus",
10470
10485
  // #924: owner-finalized Soul + 票面法 + 给事中/符宝郎行为指南
10471
10486
  sessionMaterials: [
10472
10487
  "CLAUDE.md",
@@ -11716,16 +11731,10 @@ function unreadableDiscriminatorNotice(field, received) {
11716
11731
  if (received === void 0) return `\u8BFB\u4E0D\u51FA ${field}`;
11717
11732
  return `\u8BFB\u4E0D\u51FA ${field}\uFF1A${readableGateItem(received)}`;
11718
11733
  }
11719
- function receivedDiscriminator(receipt, field) {
11720
- if (!isRecord(receipt)) return void 0;
11721
- if (!Object.hasOwn(receipt, field)) return void 0;
11722
- return receipt[field];
11723
- }
11724
11734
  var init_submission_errors = __esm({
11725
11735
  "src/submission-errors.ts"() {
11726
11736
  "use strict";
11727
11737
  init_readable_gate_item();
11728
- init_unknown_value();
11729
11738
  }
11730
11739
  });
11731
11740
 
@@ -12084,8 +12093,8 @@ function reviewQueueStatus(status) {
12084
12093
  }
12085
12094
  function projectOfficerDecision(officer, decision, fallbackStatus) {
12086
12095
  const receipt = retainedReceipt(decision);
12087
- const record = isRecord(decision) ? decision : void 0;
12088
- const status = record !== void 0 && Object.hasOwn(record, "status") ? receivedDiscriminator(record, "status") : fallbackStatus;
12096
+ const received = receiptStatus(decision);
12097
+ const status = received === void 0 ? fallbackStatus : received;
12089
12098
  const queueStatus = typeof status === "string" ? reviewQueueStatus(status) : void 0;
12090
12099
  if (queueStatus === "converged") {
12091
12100
  return { status: "converged", officer, receipt };
@@ -12174,7 +12183,7 @@ function projectOfficerTerminal(officer, summoned) {
12174
12183
  status: "needs_reask",
12175
12184
  officer,
12176
12185
  receipt: receipt2,
12177
- receivedStatus: receivedDiscriminator(receipt2, "status")
12186
+ receivedStatus: receiptStatus(receipt2)
12178
12187
  },
12179
12188
  summoned
12180
12189
  );
@@ -12191,7 +12200,7 @@ function projectOfficerTerminal(officer, summoned) {
12191
12200
  officer,
12192
12201
  // This-court receipt only (#879).
12193
12202
  receipt,
12194
- receivedStatus: receivedDiscriminator(receipt, "status")
12203
+ receivedStatus: receiptStatus(receipt)
12195
12204
  },
12196
12205
  summoned
12197
12206
  );
@@ -12246,7 +12255,6 @@ var init_gatekeeper_role = __esm({
12246
12255
  init_role_submission_declarations();
12247
12256
  init_terminal();
12248
12257
  init_run_terminal_artifacts();
12249
- init_unknown_value();
12250
12258
  init_serialize_thrown_value();
12251
12259
  GATE_OFFICER_BY_SUBJECT = {
12252
12260
  worker_completion: "inspector",
@@ -13213,64 +13221,6 @@ var init_submission_correctable_error = __esm({
13213
13221
  }
13214
13222
  });
13215
13223
 
13216
- // src/package-contracts/terminating-tools.ts
13217
- function isTerminatingToolName(name) {
13218
- return TERMINATING_TOOL_NAMES.includes(name);
13219
- }
13220
- function validateAcceptedDetails(_toolName, details) {
13221
- if (isRecord(details)) {
13222
- return details;
13223
- }
13224
- return {};
13225
- }
13226
- function acceptedFacts(toolName, details) {
13227
- const record = details;
13228
- const entry = PACKAGED_ROLE_REGISTRY.find((candidate) => candidate.outputTool === toolName);
13229
- const legacyRole = LEGACY_REVIEW_OUTPUT_ROLES.get(toolName);
13230
- const statusKey = legacyRole === "judge" || legacyRole === "countersign" ? `${legacyRole}Status` : entry !== void 0 && "receiptStatusKey" in entry ? entry.receiptStatusKey : "status";
13231
- const status = typeof record[statusKey] === "string" ? record[statusKey] : void 0;
13232
- const commitKey = entry !== void 0 && "receiptCommitKey" in entry ? entry.receiptCommitKey : void 0;
13233
- const commitWhen = entry !== void 0 && "receiptCommitWhen" in entry ? entry.receiptCommitWhen : void 0;
13234
- const commit = commitKey !== void 0 && status === commitWhen && typeof record[commitKey] === "string" ? record[commitKey] : void 0;
13235
- return {
13236
- ...status === void 0 ? {} : { status },
13237
- ...commit === void 0 ? {} : { commit }
13238
- };
13239
- }
13240
- var TERMINATING_TOOL_NAMES, AcceptedDetailsContractError;
13241
- var init_terminating_tools = __esm({
13242
- "src/package-contracts/terminating-tools.ts"() {
13243
- "use strict";
13244
- init_collector_output();
13245
- init_judge_output();
13246
- init_reviewer_output();
13247
- init_packaged_role_registry();
13248
- init_submission_correctable_error();
13249
- init_doctor_contracts();
13250
- init_gatekeeper_output();
13251
- init_navigator_output();
13252
- init_auditor_output();
13253
- init_merger_contracts();
13254
- init_notary_contracts();
13255
- init_inspector_contracts();
13256
- init_diarist_contracts();
13257
- init_secretariat_contracts();
13258
- init_worker_output();
13259
- init_unknown_value();
13260
- TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
13261
- ...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
13262
- ...LEGACY_REVIEW_OUTPUT_ROLES.keys()
13263
- ])];
13264
- AcceptedDetailsContractError = class extends CorrectableSubmissionError {
13265
- code = "accepted_details_contract";
13266
- constructor(message, options) {
13267
- super(message, options);
13268
- this.name = "AcceptedDetailsContractError";
13269
- }
13270
- };
13271
- }
13272
- });
13273
-
13274
13224
  // src/ticket-progress.ts
13275
13225
  import { spawnSync as spawnSync3 } from "node:child_process";
13276
13226
  import {
@@ -13283,15 +13233,11 @@ import {
13283
13233
  writeFileSync as writeFileSync2
13284
13234
  } from "node:fs";
13285
13235
  import { basename as basename7, dirname as dirname8, join as join12, relative as relative2, sep as sep3 } from "node:path";
13286
- function parseProgressText(text, pathForDiagnostic) {
13287
- if (text.trim() === "") return [];
13236
+ function decodeProgressFile(path) {
13237
+ if (!existsSync3(path)) return { lines: [], malformed: [] };
13238
+ const text = readFileSync3(path, "utf8");
13239
+ if (text.trim() === "") return { lines: [], malformed: [] };
13288
13240
  const { records, diagnostics } = parseSitianRecordText(text);
13289
- for (const diagnostic of diagnostics) {
13290
- process.stderr.write(
13291
- `[ticket-progress] ${pathForDiagnostic} has malformed row(s); keeps reachable rows and retains the diagnostic: line ${diagnostic.line}: ${diagnostic.error}
13292
- `
13293
- );
13294
- }
13295
13241
  const lines = [];
13296
13242
  for (const record of records) {
13297
13243
  const parsed = record;
@@ -13299,11 +13245,20 @@ function parseProgressText(text, pathForDiagnostic) {
13299
13245
  if (typeof parsed.seat !== "string" || typeof parsed.round !== "string") continue;
13300
13246
  lines.push(parsed);
13301
13247
  }
13302
- return lines;
13248
+ return {
13249
+ lines,
13250
+ malformed: diagnostics.map((diagnostic) => `line ${diagnostic.line}: ${diagnostic.error}`)
13251
+ };
13303
13252
  }
13304
13253
  function readProgressFile(path) {
13305
- if (!existsSync3(path)) return [];
13306
- return parseProgressText(readFileSync3(path, "utf8"), path);
13254
+ const { lines, malformed } = decodeProgressFile(path);
13255
+ for (const diagnostic of malformed) {
13256
+ process.stderr.write(
13257
+ `[ticket-progress] ${path} has malformed row(s); keeps reachable rows and retains the diagnostic: ${diagnostic}
13258
+ `
13259
+ );
13260
+ }
13261
+ return lines;
13307
13262
  }
13308
13263
  function readTicketProgressLines(subjectDirectory) {
13309
13264
  if (basename7(subjectDirectory) === "unbound") {
@@ -13349,16 +13304,36 @@ function nextLegReceiptIndex(runDirectory) {
13349
13304
  }
13350
13305
  return max + 1;
13351
13306
  }
13352
- function statusAndSummaryFromPayload(seat, payload) {
13307
+ function statusAndSummaryFromPayload(payload) {
13353
13308
  if (!isRecord(payload)) return {};
13354
- const toolName = packagedRoleOutputTool(seat);
13355
- const status = toolName !== void 0 && isTerminatingToolName(toolName) ? acceptedFacts(toolName, payload).status : void 0;
13309
+ const received = receiptStatus(payload);
13310
+ const status = typeof received === "string" ? received : void 0;
13356
13311
  const summary = typeof payload.summary === "string" ? payload.summary : void 0;
13357
13312
  return {
13358
13313
  ...status === void 0 ? {} : { status },
13359
13314
  ...summary === void 0 ? {} : { summary }
13360
13315
  };
13361
13316
  }
13317
+ function readAuditedRound(auditedRunDirectory) {
13318
+ try {
13319
+ const subjectDirectory = subjectDirectoryOfRun(auditedRunDirectory);
13320
+ if (subjectDirectory === void 0) return {};
13321
+ const path = join12(subjectDirectory, CURRENT_FILENAME);
13322
+ const { lines, malformed } = decodeProgressFile(path);
13323
+ if (malformed.length > 0) {
13324
+ throw new Error(`${path} has malformed row(s): ${malformed.join("; ")}`);
13325
+ }
13326
+ const receipts = `runs/${basename7(auditedRunDirectory)}/`;
13327
+ const latest = lines.filter((line2) => line2.receipt.startsWith(receipts)).at(-1);
13328
+ return latest === void 0 ? {} : { for: `${latest.seat}#${latest.round}` };
13329
+ } catch (error) {
13330
+ return { fault: `audited round unavailable for ${auditedRunDirectory}: ${errorText(error)}` };
13331
+ }
13332
+ }
13333
+ function forOfSealedRow(runDirectory, seat, payload) {
13334
+ const reported = packagedGateStageLabel(seat) !== void 0 ? readPageSync(runDirectory, "admitted")?.for : seat === "fixer" && isRecord(payload) ? payload.for : void 0;
13335
+ return typeof reported === "string" ? reported : void 0;
13336
+ }
13362
13337
  function captureWorktreeHead(projectRoot) {
13363
13338
  try {
13364
13339
  const result = spawnSync3("git", ["rev-parse", "HEAD"], {
@@ -13411,12 +13386,14 @@ function landTicketProgress(input) {
13411
13386
  const existing = unbound ? readProgressFile(progressPath) : readTicketProgressLines(subjectDirectory);
13412
13387
  const round = unbound ? "" : nextRoundFromLines(existing, input.role, lens);
13413
13388
  const sessionRelative = input.sessionFile === void 0 ? "" : relative2(subjectDirectory, input.sessionFile).split(sep3).join("/");
13414
- const { status, summary } = statusAndSummaryFromPayload(input.role, input.accepted);
13389
+ const { status, summary } = statusAndSummaryFromPayload(input.accepted);
13390
+ const reviewed = forOfSealedRow(runDirectory, input.role, input.accepted);
13415
13391
  const instruction = input.instruction;
13416
13392
  const line2 = {
13417
13393
  at: (/* @__PURE__ */ new Date()).toISOString(),
13418
13394
  seat: input.role,
13419
13395
  round,
13396
+ ...reviewed === void 0 ? {} : { for: reviewed },
13420
13397
  instruction,
13421
13398
  head: input.sealHead.head,
13422
13399
  ...status === void 0 ? {} : { status },
@@ -13481,7 +13458,6 @@ var init_ticket_progress = __esm({
13481
13458
  "use strict";
13482
13459
  init_host_session_record();
13483
13460
  init_host_contracts();
13484
- init_terminating_tools();
13485
13461
  init_packaged_role_registry();
13486
13462
  init_role_run_placement();
13487
13463
  init_run_dossier();
@@ -13504,6 +13480,57 @@ var init_sha256 = __esm({
13504
13480
  }
13505
13481
  });
13506
13482
 
13483
+ // src/package-contracts/terminating-tools.ts
13484
+ function isTerminatingToolName(name) {
13485
+ return TERMINATING_TOOL_NAMES.includes(name);
13486
+ }
13487
+ function validateAcceptedDetails(_toolName, details) {
13488
+ if (isRecord(details)) {
13489
+ return details;
13490
+ }
13491
+ return {};
13492
+ }
13493
+ function acceptedFacts(toolName, details) {
13494
+ const record = details;
13495
+ const received = receiptStatus(details);
13496
+ const status = typeof received === "string" ? received : void 0;
13497
+ const seat = receiptSeat(toolName, () => void 0)?.seat;
13498
+ const entry = seat === void 0 ? void 0 : packagedRoleMetadata(seat);
13499
+ const commitKey = entry !== void 0 && "receiptCommitKey" in entry ? entry.receiptCommitKey : void 0;
13500
+ const commitWhen = entry !== void 0 && "receiptCommitWhen" in entry ? entry.receiptCommitWhen : void 0;
13501
+ const commit = commitKey !== void 0 && status === commitWhen && typeof record[commitKey] === "string" ? record[commitKey] : void 0;
13502
+ return {
13503
+ ...status === void 0 ? {} : { status },
13504
+ ...commit === void 0 ? {} : { commit }
13505
+ };
13506
+ }
13507
+ var TERMINATING_TOOL_NAMES, AcceptedDetailsContractError;
13508
+ var init_terminating_tools = __esm({
13509
+ "src/package-contracts/terminating-tools.ts"() {
13510
+ "use strict";
13511
+ init_collector_output();
13512
+ init_judge_output();
13513
+ init_reviewer_output();
13514
+ init_packaged_role_registry();
13515
+ init_submission_correctable_error();
13516
+ init_doctor_contracts();
13517
+ init_merger_contracts();
13518
+ init_worker_output();
13519
+ init_unknown_value();
13520
+ TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
13521
+ ...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
13522
+ ...LEGACY_REVIEW_OUTPUT_ROLES.keys()
13523
+ ])];
13524
+ AcceptedDetailsContractError = class extends CorrectableSubmissionError {
13525
+ code = "accepted_details_contract";
13526
+ constructor(message, options) {
13527
+ super(message, options);
13528
+ this.name = "AcceptedDetailsContractError";
13529
+ }
13530
+ };
13531
+ }
13532
+ });
13533
+
13507
13534
  // src/doctor-evidence.ts
13508
13535
  import { readdir as readdir2, readFile as readFile6, realpath, stat } from "node:fs/promises";
13509
13536
  import { dirname as dirname9, relative as relative3, resolve as resolve4, sep as sep4 } from "node:path";
@@ -15330,22 +15357,25 @@ async function mergeInvocationIdentityPage(runDirectory, fields) {
15330
15357
  ...fields
15331
15358
  }));
15332
15359
  }
15333
- async function persistAdmittedSourceRunPath(admitted, sourceRunPath, auditorSubject) {
15334
- if (sourceRunPath.trim() === "") {
15335
- throw new Error("persistAdmittedSourceRunPath requires a non-empty sourceRunPath");
15360
+ function persistAdmittedAuditedLeg(runDirectory, audited) {
15361
+ const { sourceRunPath, auditorSubject } = audited;
15362
+ if (sourceRunPath !== void 0 && sourceRunPath.trim() === "") {
15363
+ throw new Error("persistAdmittedAuditedLeg requires a non-empty sourceRunPath");
15336
15364
  }
15337
- updateSectionSync(admitted.runDirectory, "admitted", (current) => {
15338
- if (typeof current.sourceRunPath === "string" && current.sourceRunPath !== sourceRunPath) {
15365
+ updateSectionSync(runDirectory, "admitted", (current) => {
15366
+ if (sourceRunPath !== void 0 && typeof current.sourceRunPath === "string" && current.sourceRunPath !== sourceRunPath) {
15339
15367
  throw new Error(
15340
- `persistAdmittedSourceRunPath refuses to replace ${current.sourceRunPath} with ${sourceRunPath}`
15368
+ `persistAdmittedAuditedLeg refuses to replace ${current.sourceRunPath} with ${sourceRunPath}`
15341
15369
  );
15342
15370
  }
15343
- const sameSubject = auditorSubject === void 0 || current.auditorSubject === auditorSubject;
15344
- if (current.sourceRunPath === sourceRunPath && sameSubject) return void 0;
15371
+ const unchanged = current.for === audited.for && (sourceRunPath === void 0 || current.sourceRunPath === sourceRunPath) && (auditorSubject === void 0 || current.auditorSubject === auditorSubject);
15372
+ if (unchanged) return void 0;
15373
+ const { for: _replaced, ...rest } = current;
15345
15374
  return {
15346
- ...current,
15347
- sourceRunPath,
15348
- ...auditorSubject === void 0 ? {} : { auditorSubject }
15375
+ ...rest,
15376
+ ...sourceRunPath === void 0 ? {} : { sourceRunPath },
15377
+ ...auditorSubject === void 0 ? {} : { auditorSubject },
15378
+ ...audited.for === void 0 ? {} : { for: audited.for }
15349
15379
  };
15350
15380
  });
15351
15381
  }
@@ -17176,7 +17206,7 @@ function parseInvocationMarkerIdentity(data) {
17176
17206
  }
17177
17207
  function classifyPackagedRoleTerminalResult(message) {
17178
17208
  if (typeof message.toolName !== "string") return { kind: "nonterminal" };
17179
- if (!PACKAGED_ROLE_OUTPUT_TOOLS.has(message.toolName) && message.toolName !== "ak_submission_output") return { kind: "nonterminal" };
17209
+ if (!isTerminatingToolName(message.toolName)) return { kind: "nonterminal" };
17180
17210
  const hasInfraBase = hasNavigatorInfrastructureFailureBase(message.details);
17181
17211
  const infraFact = hasInfraBase ? buildNavigatorInfrastructureFailureFact() : void 0;
17182
17212
  if (message.isError === true) {
@@ -17193,8 +17223,10 @@ function durableTerminalAt(entries, index) {
17193
17223
  const entry = entries[index];
17194
17224
  const message = entry?.type === "custom" && entry.customType === "ak-role-submission-closure" ? typeof entry.data === "object" && entry.data !== null ? entry.data : void 0 : entry?.type === "message" && entry.message?.role === "toolResult" ? entry.message : void 0;
17195
17225
  if (typeof message?.toolName !== "string") return void 0;
17196
- const marker = message.toolName === "ak_submission_output" ? entries.slice(0, index).reverse().find(isInvocationMarkerEntry) : void 0;
17197
- const role = message.toolName === "ak_submission_output" ? parseInvocationMarkerIdentity(marker?.data)?.role ?? "unknown" : PACKAGED_ROLE_OUTPUT_TOOLS.get(message.toolName);
17226
+ const role = receiptSeat(message.toolName, () => {
17227
+ const marker = entries.slice(0, index).reverse().find(isInvocationMarkerEntry);
17228
+ return parseInvocationMarkerIdentity(marker?.data)?.role ?? "unknown";
17229
+ })?.seat;
17198
17230
  if (role === void 0) return void 0;
17199
17231
  const classification = classifyPackagedRoleTerminalResult(message);
17200
17232
  if (classification.kind !== "accepted" && classification.kind !== "infrastructure") {
@@ -17219,10 +17251,11 @@ function findLatestDurablePackagedRoleTerminal(entries) {
17219
17251
  }
17220
17252
  return void 0;
17221
17253
  }
17222
- var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
17254
+ var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS;
17223
17255
  var init_navigator_invocation_identity = __esm({
17224
17256
  "src/navigator-invocation-identity.ts"() {
17225
17257
  "use strict";
17258
+ init_terminating_tools();
17226
17259
  init_packaged_role_registry();
17227
17260
  init_uuidv7();
17228
17261
  init_unknown_value();
@@ -17234,9 +17267,6 @@ var init_navigator_invocation_identity = __esm({
17234
17267
  "source",
17235
17268
  "reasonCode"
17236
17269
  ];
17237
- PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
17238
- [...PACKAGED_ROLE_REGISTRY.filter((entry) => entry.outputTool !== "ak_submission_output").map((entry) => [entry.outputTool, entry.role]), ...LEGACY_REVIEW_OUTPUT_ROLES]
17239
- );
17240
17270
  }
17241
17271
  });
17242
17272
 
@@ -19232,11 +19262,8 @@ function latestQueueStatus(terminal) {
19232
19262
  if (outcome === void 0) return void 0;
19233
19263
  if (outcome.kind === "audit_escalation") return "escalate";
19234
19264
  if (outcome.kind !== "accepted") return void 0;
19235
- const latest = outcome.payloads?.[outcome.payloads.length - 1];
19236
- if (isRecord(latest) && Object.hasOwn(latest, "status")) {
19237
- return receivedDiscriminator(latest, "status");
19238
- }
19239
- return outcome.status;
19265
+ const received = receiptStatus(outcome.payloads?.[outcome.payloads.length - 1]);
19266
+ return received === void 0 ? outcome.status : received;
19240
19267
  }
19241
19268
  function latestQueuePayload(terminal) {
19242
19269
  const outcome = terminal?.roleOutcome;
@@ -19373,9 +19400,8 @@ var init_submission_gate = __esm({
19373
19400
  init_invocation();
19374
19401
  init_run_lifecycle();
19375
19402
  init_gatekeeper_role();
19376
- init_submission_errors();
19403
+ init_packaged_role_registry();
19377
19404
  init_receipt_delivery_policy();
19378
- init_unknown_value();
19379
19405
  }
19380
19406
  });
19381
19407
 
@@ -19897,8 +19923,7 @@ var init_turn_request = __esm({
19897
19923
 
19898
19924
  // src/public-cli/countersign-run.ts
19899
19925
  function isEscalatePayload(payload) {
19900
- if (!isRecord(payload)) return false;
19901
- return payload.status === "escalate";
19926
+ return receiptStatus(payload) === "escalate";
19902
19927
  }
19903
19928
  function courtDiaristEscalateDiagnostic(terminal) {
19904
19929
  const payloads = currentReplyRows(terminal);
@@ -19983,7 +20008,7 @@ var init_countersign_run = __esm({
19983
20008
  "use strict";
19984
20009
  init_readable_gate_item();
19985
20010
  init_terminal();
19986
- init_unknown_value();
20011
+ init_packaged_role_registry();
19987
20012
  }
19988
20013
  });
19989
20014
 
@@ -20004,7 +20029,7 @@ function unreadablePostSubmissionStatus(admitted, terminal) {
20004
20029
  const route = POST_SUBMISSION_ROUTING[admitted.role];
20005
20030
  if (route === void 0) return void 0;
20006
20031
  const payload = terminal.roleOutcome.payloads?.at(-1);
20007
- const status = receivedDiscriminator(payload, "status");
20032
+ const status = receiptStatus(payload);
20008
20033
  return typeof status === "string" && route.statuses.has(status) ? void 0 : route.reask ?? officerConclusionReask(status);
20009
20034
  }
20010
20035
  function withUnreadableReask(env) {
@@ -20404,6 +20429,16 @@ async function runOmittedLensBatch(argv2, parsed, env, io) {
20404
20429
  else io.stdout(formatTerminalResult(terminal));
20405
20430
  return { exitCode: failed ? 1 : 0, terminal };
20406
20431
  }
20432
+ async function pinAuditedLegAtAdmission(officerRunDirectory, auditedRunDirectory, io, source) {
20433
+ const { for: auditedRound, fault } = readAuditedRound(auditedRunDirectory);
20434
+ persistAdmittedAuditedLeg(officerRunDirectory, { for: auditedRound, ...source });
20435
+ if (fault === void 0) return;
20436
+ await retainPackageFault({
20437
+ runDirectory: officerRunDirectory,
20438
+ diagnostic: fault,
20439
+ stderr: (text) => io.stderr(text)
20440
+ });
20441
+ }
20407
20442
  function resumeSameParentInstructionSeat(input) {
20408
20443
  return tryResumeSameTicketSeatRun({
20409
20444
  home: input.env.home,
@@ -20423,7 +20458,8 @@ function resumeSameParentInstructionSeat(input) {
20423
20458
  ...materials === void 0 ? {} : { summons: materials }
20424
20459
  },
20425
20460
  input.env,
20426
- input.io
20461
+ input.io,
20462
+ input.parentRunPath
20427
20463
  );
20428
20464
  }
20429
20465
  });
@@ -20499,7 +20535,9 @@ async function runCountersignBody(parsed, env, io) {
20499
20535
  );
20500
20536
  await markRunAdmitted(admitted, env.principalAuthority);
20501
20537
  if (gateParentRunPath !== void 0) {
20502
- await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
20538
+ await pinAuditedLegAtAdmission(admitted.runDirectory, gateParentRunPath, io, {
20539
+ sourceRunPath: gateParentRunPath
20540
+ });
20503
20541
  admitted = { ...admitted, sourceRunPath: gateParentRunPath };
20504
20542
  }
20505
20543
  const turnProjection = roleTurnOptions(env, admitted, {
@@ -20708,12 +20746,21 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
20708
20746
  throw error;
20709
20747
  }
20710
20748
  if (instructionSourceRunPath !== void 0) {
20711
- await persistAdmittedSourceRunPath(admitted, instructionSourceRunPath);
20749
+ await pinAuditedLegAtAdmission(admitted.runDirectory, instructionSourceRunPath, io, {
20750
+ sourceRunPath: instructionSourceRunPath
20751
+ });
20712
20752
  admitted = { ...admitted, sourceRunPath: instructionSourceRunPath };
20713
- }
20714
- if (record.sameParent === "subject-source" && auditorSource !== void 0) {
20715
- await persistAdmittedSourceRunPath(admitted, auditorSource, auditorSubject);
20753
+ } else if (record.sameParent === "subject-source" && auditorSource !== void 0) {
20754
+ await pinAuditedLegAtAdmission(admitted.runDirectory, auditorSource, io, {
20755
+ sourceRunPath: auditorSource,
20756
+ auditorSubject
20757
+ });
20716
20758
  admitted = { ...admitted, sourceRunPath: auditorSource };
20759
+ } else {
20760
+ const auditedRunDirectory = admittedSourceRunPath(admitted);
20761
+ if (auditedRunDirectory !== void 0) {
20762
+ await pinAuditedLegAtAdmission(admitted.runDirectory, auditedRunDirectory, io);
20763
+ }
20717
20764
  }
20718
20765
  admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
20719
20766
  const runAdmitted = async () => {
@@ -20788,7 +20835,7 @@ async function inheritKnownTicketFromSource(admitted, authority) {
20788
20835
  await relocateAdmittedRunToTicket(admitted, authority);
20789
20836
  return admitted;
20790
20837
  }
20791
- async function runPublicInstructionSeatResume(request, env, io) {
20838
+ async function runPublicInstructionSeatResume(request, env, io, resummonedFor) {
20792
20839
  let selectedRequest = request;
20793
20840
  const resume = async () => {
20794
20841
  const held = [];
@@ -20819,6 +20866,9 @@ async function runPublicInstructionSeatResume(request, env, io) {
20819
20866
  return { ...loaded, admitted };
20820
20867
  },
20821
20868
  buildTurnRequest: async (admitted, effective) => {
20869
+ if (resummonedFor !== void 0) {
20870
+ await pinAuditedLegAtAdmission(admitted.runDirectory, resummonedFor, io);
20871
+ }
20822
20872
  const summonsPrepared = await prepareSummonsResumeMaterials(admitted.runDirectory, effective.summons);
20823
20873
  const projection = resumeTurnRequestProjectionOptions(
20824
20874
  admitted,
@@ -21028,8 +21078,7 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
21028
21078
  if (admitted === void 0 || !AUDITED_ROLES.has(admitted.role) || turn.terminal?.roleOutcome.kind !== "accepted") return turn;
21029
21079
  const accepted = turn.terminal.roleOutcome.payloads?.at(-1);
21030
21080
  if (accepted === void 0) throw new Error("accepted submission has no payload");
21031
- const record = isRecord(accepted) ? accepted : void 0;
21032
- const status = admitted.role === "secretariat" ? record?.secretariatStatus : record?.status;
21081
+ const status = receiptStatus(accepted);
21033
21082
  const gateOwnsStatusReask = typeof env.parentRunPath === "string" && env.parentRunPath.trim() !== "";
21034
21083
  if (admitted.role === "secretariat" && status !== "converged" && status !== "escalate") {
21035
21084
  if (gateOwnsStatusReask) return turn;
@@ -21313,7 +21362,6 @@ var init_instruction_seat_run = __esm({
21313
21362
  init_role_run_placement();
21314
21363
  init_doctor_auditor();
21315
21364
  init_gatekeeper_role();
21316
- init_submission_errors();
21317
21365
  init_review_submission();
21318
21366
  init_judge_role();
21319
21367
  init_worker_submission_contracts();
@@ -21339,9 +21387,10 @@ var init_instruction_seat_run = __esm({
21339
21387
  init_terminal();
21340
21388
  init_turn_request();
21341
21389
  init_countersign_run();
21390
+ init_ticket_progress();
21342
21391
  init_unknown_value();
21343
21392
  AUDITED_ROLES = /* @__PURE__ */ new Set(["judge", "fixer", "coder", "secretariat", "countersign", "doctor"]);
21344
- SECRETARIAT_STATUS_REASK = "secretariatStatus \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0CsecretariatStatus \u5199\u660E\u5176\u4E00\u3002";
21393
+ SECRETARIAT_STATUS_REASK = "status \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
21345
21394
  WORKER_ROUTING_STATUSES = /* @__PURE__ */ new Set([
21346
21395
  "planned",
21347
21396
  "completed",
@@ -21848,7 +21897,7 @@ function tryReadComplianceCandidate(arguments_, usage) {
21848
21897
  return void 0;
21849
21898
  }
21850
21899
  const args = arguments_;
21851
- const status = args.status;
21900
+ const status = receiptStatus(arguments_);
21852
21901
  if (status === "converged") return { status, receipt: arguments_, ...usage === void 0 ? {} : { usage } };
21853
21902
  if (status === "continue") return { status, violations: readListField(args.violations), receipt: arguments_, ...usage === void 0 ? {} : { usage } };
21854
21903
  if (status === "escalate") {
@@ -21952,7 +22001,7 @@ async function runComplianceAudit(options) {
21952
22001
  if (decision.status === "received") {
21953
22002
  if (reasksSpent >= reaskLimit) return decision;
21954
22003
  reasksSpent += 1;
21955
- reask = officerConclusionReask(receivedDiscriminator(decision.reply, "status"));
22004
+ reask = officerConclusionReask(receiptStatus(decision.reply));
21956
22005
  continue;
21957
22006
  }
21958
22007
  return decision;
@@ -21964,7 +22013,7 @@ var init_compliance_transport = __esm({
21964
22013
  "use strict";
21965
22014
  init_role_run_placement();
21966
22015
  init_gatekeeper_role();
21967
- init_submission_errors();
22016
+ init_packaged_role_registry();
21968
22017
  init_terminal();
21969
22018
  init_readable_gate_item();
21970
22019
  init_receipt_delivery_policy();
@@ -23451,7 +23500,7 @@ async function bindDiaristAssertedTicketNumber(admitted) {
23451
23500
  );
23452
23501
  for (const row of rows) {
23453
23502
  if (row.role !== admitted.role || !isRecord(row.accepted)) continue;
23454
- if (row.accepted.status !== "completed" || !("ticketNumber" in row.accepted)) continue;
23503
+ if (receiptStatus(row.accepted) !== "completed" || !("ticketNumber" in row.accepted)) continue;
23455
23504
  const ticketNumber = parseTicketNumber(row.accepted.ticketNumber);
23456
23505
  if (ticketNumber !== void 0) {
23457
23506
  await bindAdmittedTicketNumber(admitted, ticketNumber);
@@ -31885,11 +31934,11 @@ function projectTerminal(facts) {
31885
31934
  }
31886
31935
  const status = extractStatus(facts.terminal.body);
31887
31936
  const classCount = readClassCount(facts.terminal.body);
31888
- const receiptStatus = status ?? "unparsed";
31937
+ const receiptStatus2 = status ?? "unparsed";
31889
31938
  if (classCount === void 0) {
31890
- return { kind: "receipt", status: receiptStatus };
31939
+ return { kind: "receipt", status: receiptStatus2 };
31891
31940
  }
31892
- return { kind: "receipt", status: receiptStatus, classCount };
31941
+ return { kind: "receipt", status: receiptStatus2, classCount };
31893
31942
  }
31894
31943
  function projectRunRow(facts) {
31895
31944
  const { startedAt, endedAt } = facts.frameSpan;