@akagilnc/pi-workflow-roles 0.1.6111 → 0.1.6123

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 (47) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/dist/acp-host/production-host.js +442 -279
  4. package/dist/engine-detour-usage.js +2 -1
  5. package/dist/gatekeeper-role.js +3 -15
  6. package/dist/headless-host/production-host.js +427 -264
  7. package/dist/migrate-book-topology.js +42 -22
  8. package/dist/notary-source-run.js +8 -8
  9. package/dist/package-contracts/fixer-output.js +3 -0
  10. package/dist/public-cli/auto-resume.js +3 -3
  11. package/dist/public-cli/cli.js +38 -32
  12. package/dist/public-cli/instruction-seat-run.js +52 -13
  13. package/dist/public-cli/invocation.js +22 -12
  14. package/dist/public-cli/main.js +398 -237
  15. package/dist/public-cli/option-definitions.js +22 -21
  16. package/dist/public-cli/run-lifecycle.js +27 -26
  17. package/dist/public-cli/seat-ticket-binding.js +2 -1
  18. package/dist/public-cli/settlement.js +33 -8
  19. package/dist/public-cli/terminal.js +13 -3
  20. package/dist/public-role-summons.js +1 -7
  21. package/dist/role-run-placement.js +1 -1
  22. package/dist/run-dossier-files.js +4 -2
  23. package/dist/submission-gate.js +3 -3
  24. package/dist/submission-ledger.js +29 -3
  25. package/dist/ticket-address.js +77 -0
  26. package/dist/ticket-progress.js +90 -14
  27. package/package.json +1 -1
  28. package/src/engine-detour-usage.ts +2 -1
  29. package/src/gatekeeper-role.ts +5 -18
  30. package/src/notary-source-run.ts +8 -8
  31. package/src/package-contracts/fixer-output.ts +4 -0
  32. package/src/public-cli/auto-resume.ts +4 -3
  33. package/src/public-cli/cli.ts +53 -32
  34. package/src/public-cli/instruction-seat-run.ts +55 -11
  35. package/src/public-cli/invocation.ts +31 -16
  36. package/src/public-cli/option-definitions.ts +22 -21
  37. package/src/public-cli/run-lifecycle.ts +31 -31
  38. package/src/public-cli/seat-ticket-binding.ts +2 -1
  39. package/src/public-cli/settlement.ts +43 -7
  40. package/src/public-cli/terminal.ts +33 -14
  41. package/src/public-role-summons.ts +3 -15
  42. package/src/role-run-placement.ts +1 -1
  43. package/src/run-dossier-files.ts +5 -2
  44. package/src/submission-gate.ts +3 -2
  45. package/src/submission-ledger.ts +32 -2
  46. package/src/ticket-address.ts +91 -0
  47. package/src/ticket-progress.ts +113 -15
@@ -832,7 +832,8 @@ var init_run_dossier_files = __esm({
832
832
  "post-seal-anomaly",
833
833
  "attempt-history",
834
834
  "turn-delivery",
835
- "officer-pointer"
835
+ "officer-pointer",
836
+ "progress"
836
837
  ]);
837
838
  RUN_STATE_KINDS = /* @__PURE__ */ new Set([
838
839
  "invocation",
@@ -9114,6 +9115,9 @@ var init_fixer_output = __esm({
9114
9115
  classResults: typebox_exports.Unknown({
9115
9116
  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"
9116
9117
  }),
9118
+ for: typebox_exports.Unknown({
9119
+ 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"
9120
+ }),
9117
9121
  diffItems: diffItemsField,
9118
9122
  testEvidence: typebox_exports.Unknown({
9119
9123
  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"
@@ -10614,6 +10618,9 @@ var init_ticket_progress = __esm({
10614
10618
  init_packaged_role_registry();
10615
10619
  init_role_run_placement();
10616
10620
  init_run_dossier();
10621
+ init_run_dossier_files();
10622
+ init_run_terminal_artifacts();
10623
+ init_sitian_facade();
10617
10624
  init_sitian_reader();
10618
10625
  init_unknown_value();
10619
10626
  }
@@ -10743,6 +10750,17 @@ var init_uuidv7 = __esm({
10743
10750
  }
10744
10751
  });
10745
10752
 
10753
+ // src/ticket-address.ts
10754
+ var init_ticket_address = __esm({
10755
+ "src/ticket-address.ts"() {
10756
+ "use strict";
10757
+ init_cli_errors();
10758
+ init_role_run_placement();
10759
+ init_run_ticket_number();
10760
+ init_ticket_progress();
10761
+ }
10762
+ });
10763
+
10746
10764
  // src/notary-source-run.ts
10747
10765
  var init_notary_source_run = __esm({
10748
10766
  "src/notary-source-run.ts"() {
@@ -10751,6 +10769,7 @@ var init_notary_source_run = __esm({
10751
10769
  init_activation_ledger_topology();
10752
10770
  init_run_lifecycle();
10753
10771
  init_role_run_placement();
10772
+ init_ticket_address();
10754
10773
  }
10755
10774
  });
10756
10775
 
@@ -10932,7 +10951,7 @@ var init_option_definitions = __esm({
10932
10951
  owner: "auditor",
10933
10952
  canonical: "--source-run",
10934
10953
  aliases: [],
10935
- valueMetavar: "runId@role|path",
10954
+ valueMetavar: "ticket:seat#round|path",
10936
10955
  required: true,
10937
10956
  repeatable: false,
10938
10957
  form: "option",
@@ -11110,13 +11129,13 @@ var init_option_definitions = __esm({
11110
11129
  owner: "notary",
11111
11130
  canonical: "--source-run",
11112
11131
  aliases: [],
11113
- valueMetavar: "runId@role|path",
11132
+ valueMetavar: "ticket:seat#round|path",
11114
11133
  required: true,
11115
11134
  repeatable: false,
11116
11135
  form: "option",
11117
11136
  description: {
11118
- en: "Required source run locator (runId@role under the book home, or path to that run directory). Binds the audited identity; review dialogue is the fixed Notary dispatch (verdict stays in the ledger). Missing-ticket and unreadable-status reasks keep their existing diagnostic text.",
11119
- zh: "\u5FC5\u586B\u6E90 run \u5B9A\u4F4D\u7B26\uFF08\u7C3F\u5185 runId@role\uFF0C\u6216\u8BE5 run \u76EE\u5F55\u8DEF\u5F84\uFF09\u3002\u7ED1\u5B9A\u53D7\u5BA1\u8EAB\u4EFD\uFF1B\u5BA1\u7A3F\u5BF9\u8BDD\u4E3A\u7B26\u5B9D\u90CE\u56FA\u5B9A\u6D3E\u5355\u6587\uFF08\u5224\u8BCD\u7559\u5728\u5377\u5B97\u81EA\u884C\u8BFB\u53D6\uFF09\u3002\u7F3A\u7968\u53F7\u4E0E\u8BFB\u4E0D\u51FA status \u7684\u91CD\u4EA4\u4ECD\u9012\u65E2\u6709\u8BCA\u65AD\u539F\u6587\u3002"
11137
+ en: "Required source run locator (<ticket>:<seat>#<round> as written on the ticket's progress row, or path to that run directory). Binds the audited identity; review dialogue is the fixed Notary dispatch (verdict stays in the ledger). Missing-ticket and unreadable-status reasks keep their existing diagnostic text.",
11138
+ zh: "\u5FC5\u586B\u6E90 run \u5B9A\u4F4D\u7B26\uFF08<\u7968\u53F7>:<\u5E2D>#<\u8F6E>\uFF0C\u8F6E\u7167\u8FDB\u5EA6\u884C\u4E0A\u7684\u5199\u6CD5\uFF1B\u6216\u8BE5 run \u76EE\u5F55\u8DEF\u5F84\uFF09\u3002\u7ED1\u5B9A\u53D7\u5BA1\u8EAB\u4EFD\uFF1B\u5BA1\u7A3F\u5BF9\u8BDD\u4E3A\u7B26\u5B9D\u90CE\u56FA\u5B9A\u6D3E\u5355\u6587\uFF08\u5224\u8BCD\u7559\u5728\u5377\u5B97\u81EA\u884C\u8BFB\u53D6\uFF09\u3002\u7F3A\u7968\u53F7\u4E0E\u8BFB\u4E0D\u51FA status \u7684\u91CD\u4EA4\u4ECD\u9012\u65E2\u6709\u8BCA\u65AD\u539F\u6587\u3002"
11120
11139
  }
11121
11140
  }
11122
11141
  ];
@@ -11127,13 +11146,13 @@ var init_option_definitions = __esm({
11127
11146
  owner: "inspector",
11128
11147
  canonical: "--source-run",
11129
11148
  aliases: [],
11130
- valueMetavar: "runId@role|path",
11149
+ valueMetavar: "ticket:seat#round|path",
11131
11150
  required: false,
11132
11151
  repeatable: false,
11133
11152
  form: "option",
11134
11153
  description: {
11135
- en: "Optional audited source-run locator (runId@role or path). Gate summons always supply it; identity rides startup materials.",
11136
- zh: "\u53EF\u9009\u88AB\u5BA1\u817F\u5B9A\u4F4D\u7B26\uFF08runId@role \u6216\u8DEF\u5F84\uFF09\u3002\u95F8\u4F20\u53EC\u5FC5\u5E26\uFF1B\u8EAB\u4EFD\u5728\u542F\u52A8\u6750\u6599\u91CC\u3002"
11154
+ en: "Optional audited source-run locator (<ticket>:<seat>#<round> or path). Gate summons always supply it; identity rides startup materials.",
11155
+ zh: "\u53EF\u9009\u88AB\u5BA1\u817F\u5B9A\u4F4D\u7B26\uFF08<\u7968\u53F7>:<\u5E2D>#<\u8F6E> \u6216\u8DEF\u5F84\uFF09\u3002\u95F8\u4F20\u53EC\u5FC5\u5E26\uFF1B\u8EAB\u4EFD\u5728\u542F\u52A8\u6750\u6599\u91CC\u3002"
11137
11156
  }
11138
11157
  }
11139
11158
  ];
@@ -11427,10 +11446,10 @@ var init_option_definitions = __esm({
11427
11446
  auditor: {
11428
11447
  command: "auditor",
11429
11448
  summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: converged, continue, or escalate.",
11430
- usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
11449
+ usage: ["ak-role auditor --subject <judge|doctor> --source-run <ticket:seat#round|path> [options] [instruction]"],
11431
11450
  examples: [
11432
- 'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
11433
- 'ak-role auditor --subject doctor --source-run 01abc\u2026@doctor "\u5BA1\uFF1A\u592A\u533B\u5019\u9009\u662F\u5426\u5408\u89C4\u3002"'
11451
+ 'ak-role auditor --subject judge --source-run 1201:judge#2 --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
11452
+ 'ak-role auditor --subject doctor --source-run 1201:doctor#1 "\u5BA1\uFF1A\u592A\u533B\u5019\u9009\u662F\u5426\u5408\u89C4\u3002"'
11434
11453
  ]
11435
11454
  },
11436
11455
  diarist: {
@@ -11453,10 +11472,10 @@ var init_option_definitions = __esm({
11453
11472
  notary: {
11454
11473
  command: "notary",
11455
11474
  summary: "Direct Notary summons; duties: souls/notary.md. Review uses fixed dispatch \u2014 binds --source-run identity; does not accept caller review prompt; verdict stays in the ledger. Missing-ticket (#1171) and unreadable-status reasks deliver their existing diagnostic text on the same seat, not the review sentence.",
11456
- usage: ["ak-role notary --source-run <runId@role|path> [options]"],
11475
+ usage: ["ak-role notary --source-run <ticket:seat#round|path> [options]"],
11457
11476
  examples: [
11458
- "ak-role notary --source-run 01a034f1-75bf-71a6-bcf5-d1299145b1a5@judge",
11459
- "ak-role notary --source-run 01a034f1-75bf-71a6-bcf5-d1299145b1a5@countersign"
11477
+ "ak-role notary --source-run 1201:judge#2",
11478
+ "ak-role notary --source-run 1201:countersign#1"
11460
11479
  ]
11461
11480
  },
11462
11481
  analyst: {
@@ -11513,14 +11532,15 @@ var init_option_definitions = __esm({
11513
11532
  },
11514
11533
  resume: {
11515
11534
  command: "resume",
11516
- summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat accepts the optional caller message and passes it through unchanged as the continuation prompt. Notary new/direct review calls use only --source-run plus the fixed review dispatch (no caller review prompt); public manual resume still passes the caller message. Global --model/--thinking/--host/--engine must be placed before <runId> (either before `resume` or between `resume` and <runId>); the one argv after <runId> is the opaque message, not a flag position (#471).",
11517
- usage: ["ak-role resume <runId> [message]"],
11535
+ summary: "Resume one leg of a ticket under the live seat table (model/host/engine); session principal must still exist. The address is the ticket number and the seat: by default the seat's most recently active leg under that ticket; <seat>#<round> (round as written on the ticket's progress row, reviewer rounds carry the lens suffix) names the leg that filed that round. A leg that has reported no ticket is not in this address. Every callable seat accepts the optional caller message and passes it through unchanged as the continuation prompt. Notary new/direct review calls use only --source-run plus the fixed review dispatch (no caller review prompt); public manual resume still passes the caller message. Global --model/--thinking/--host/--engine must be placed before <ticket> (either before `resume` or between `resume` and <ticket>); the one argv after <seat> is the opaque message, not a flag position (#471).",
11536
+ usage: ["ak-role resume <ticket> <seat>[#<round>] [message]"],
11518
11537
  examples: [
11519
- "ak-role resume 01abc\u2026",
11520
- 'ak-role resume 01abc\u2026 "owner ruling"',
11521
- "ak-role --host grok-build resume 01abc\u2026",
11522
- "ak-role --engine agy resume 01abc\u2026",
11523
- 'ak-role resume --model xai/grok-4.5 01abc\u2026 "owner ruling"'
11538
+ "ak-role resume 1201 judge",
11539
+ 'ak-role resume 1201 judge "owner ruling"',
11540
+ "ak-role resume 1201 'reviewer#2.correctness'",
11541
+ "ak-role --host grok-build resume 1201 fixer",
11542
+ "ak-role --engine agy resume 1201 fixer",
11543
+ 'ak-role resume --model xai/grok-4.5 1201 notary "owner ruling"'
11524
11544
  ]
11525
11545
  },
11526
11546
  new: {
@@ -11529,7 +11549,7 @@ var init_option_definitions = __esm({
11529
11549
  usage: ["ak-role new <role> [options] \u2026"],
11530
11550
  examples: [
11531
11551
  'ak-role new countersign --attach ./ticket.md "\u88C1\uFF1A\u672C\u7968 #708 \u662F\u5426\u8DB3\u4EE5\u5F00\u5DE5\u3002"',
11532
- "ak-role new notary --source-run 01abc\u2026@countersign",
11552
+ "ak-role new notary --source-run 1201:countersign#1",
11533
11553
  "ak-role --host grok-build new inspector --attach ./change.patch"
11534
11554
  ]
11535
11555
  },
@@ -7,8 +7,9 @@ import { dirname, isAbsolute, join, resolve, basename } from "node:path";
7
7
  import { lstat, realpath } from "node:fs/promises";
8
8
  import { resolveBookKeyFromGit } from "./activation-ledger-git.js";
9
9
  import { activationBookDirectory, physicalPathIdentity, resolveActivationLedgerHome, } from "./activation-ledger-topology.js";
10
- import { findRunDirectoryById, resolveLiveRunDirectoryPath, readRoleRunIdentity } from "./public-cli/run-lifecycle.js";
11
- import { formatRunLeaf, parseRunLeaf } from "./role-run-placement.js";
10
+ import { resolveLiveRunDirectoryPath, readRoleRunIdentity } from "./public-cli/run-lifecycle.js";
11
+ import { parseRunLeaf } from "./role-run-placement.js";
12
+ import { locateTicketLeg, parseTicketLegLocator } from "./ticket-address.js";
12
13
  async function readRetainedIdentity(runDirectory) {
13
14
  try {
14
15
  return await readRoleRunIdentity(runDirectory);
@@ -54,8 +55,8 @@ async function requireRunDirectory(candidate, display) {
54
55
  /**
55
56
  * Resolve `--source-run` to a machine-ledger retained run directory and typed identity.
56
57
  * Accepts:
57
- * - bare `<runId>@<role>` under the project's book runs home
58
- * - absolute/relative path that realpath's to that same book runs slot
58
+ * - `<ticket>:<seat>#<round>` — the leg that sealed that progress row (#1201)
59
+ * - absolute/relative path that realpath's to a run under the project's book
59
60
  *
60
61
  * Rejects project-tree projections and any path outside the project's ledger book runs.
61
62
  * Retained state.jsonl run-state must match basename identity and book binding.
@@ -70,10 +71,9 @@ export async function resolveNotarySourceRunLocator(options) {
70
71
  const bookDirectory = activationBookDirectory(ledgerHome, bookKey);
71
72
  const bookRunsRoot = join(bookDirectory, "runs");
72
73
  let candidate;
73
- const bare = parseRunLeaf(raw);
74
- if (bare !== undefined && !raw.includes("/") && !raw.includes("\\")) {
75
- candidate = (await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role))
76
- ?? join(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
74
+ const address = parseTicketLegLocator(raw);
75
+ if (address !== undefined) {
76
+ candidate = locateTicketLeg(bookDirectory, address);
77
77
  }
78
78
  else {
79
79
  candidate = isAbsolute(raw) ? raw : resolve(options.projectRoot, raw);
@@ -20,6 +20,9 @@ const fixerOutputObject = Type.Object({
20
20
  classResults: Type.Unknown({
21
21
  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"
22
22
  }),
23
+ for: Type.Unknown({
24
+ 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"
25
+ }),
23
26
  diffItems: diffItemsField,
24
27
  testEvidence: Type.Unknown({
25
28
  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"
@@ -2,7 +2,7 @@ import { AUTO_RESUME_LIMIT, describeErrorIdentity, acquireRunWriterLease, markRu
2
2
  import { parseAutoResumeLimit } from "./config.js";
3
3
  import { processCancelSignalName } from "./process-cancel.js";
4
4
  import { isLawfulTypedTerminalOutcome, formatTerminalResult } from "./terminal.js";
5
- import { attachRecordedSubmissions, presentFailureTerminal, retainPackageFault, } from "./settlement.js";
5
+ import { attachRecordedSubmissions, filedIdentity, presentFailureTerminal, retainPackageFault, } from "./settlement.js";
6
6
  import { serializeThrownValue } from "../serialize-thrown-value.js";
7
7
  import { reportRunRecord } from "../sitian-facade.js";
8
8
  import { errorText } from "../unknown-value.js";
@@ -199,7 +199,7 @@ function dispatchExceptionFailureTerminal(input) {
199
199
  },
200
200
  navigator: { disposition: "no-advice" },
201
201
  artifacts,
202
- runId: input.runId,
202
+ ...filedIdentity(input.runDirectory),
203
203
  autoResumeCount: input.autoResumeAttempts,
204
204
  };
205
205
  }
@@ -317,7 +317,7 @@ export async function runWithAutoResumeLoop(options) {
317
317
  const terminal = stoppedResult === undefined
318
318
  ? await attachDispatchExceptionTerminal(options.admitted, dispatchExceptionFailureTerminal({
319
319
  role: options.admitted.role,
320
- runId: options.admitted.runId,
320
+ runDirectory: options.admitted.runDirectory,
321
321
  causeError: lastThrownError,
322
322
  errorFiles: retainedErrorFiles,
323
323
  autoResumeAttempts,
@@ -23,7 +23,11 @@ import { readSessionDialogue, renderSessionDialogue } from "./dialogue-command.j
23
23
  import { continueParentAfterChild, presentAuditedOriginalOfUnsettledOfficer, runPublicInstructionSeat, runPublicInstructionSeatResume, } from "./instruction-seat-run.js";
24
24
  import { latestPayloadEscalated } from "./countersign-run.js";
25
25
  import { runPublicAnalyst } from "./analyst-run.js";
26
- import { AUTO_RESUME_LIMIT, findRunDirectoryById, peekRoleRunRole, } from "./run-lifecycle.js";
26
+ import { resolveBookKeyFromGit } from "../activation-ledger-git.js";
27
+ import { activationBookDirectory, resolveActivationLedgerHome, } from "../activation-ledger-topology.js";
28
+ import { runIdFromRunDirectory } from "../run-terminal-artifacts.js";
29
+ import { locateTicketLeg, parseAddressTicket, parseSeatRound, } from "../ticket-address.js";
30
+ import { AUTO_RESUME_LIMIT, peekRoleRunRole, } from "./run-lifecycle.js";
27
31
  import { INTERNAL_ROLE_ENTRYPOINT_RELATIVE, PUBLIC_CALLABLE_ROLES, isPublicCallableRole, isPublicCliSupportCommand, isPublicConfigurableSeat, listHelpCapabilities, } from "./registry.js";
28
32
  import { formatCliDiagnostic, formatErrorCauseDetail, presentStructuralRejection, } from "./settlement.js";
29
33
  import { errorText } from "../unknown-value.js";
@@ -205,9 +209,9 @@ function parseArgv(argv) {
205
209
  // Global flags may appear before or after the subcommand
206
210
  // (`ak-role --model x roles` and `ak-role roles --model x`).
207
211
  // Grammar authority: shared typed consumer over PUBLIC_OPTION_TABLE.global.
208
- // #471: after `resume <runId>`, remaining argv is the opaque message segment
209
- // and must not re-enter the global-option consumer — including bare `--`,
210
- // which is a legal opaque message token, not an argv delimiter here.
212
+ // #471 / #1201: after `resume <ticket>`, remaining argv is the seat and the
213
+ // opaque message and must not re-enter the global-option consumer — including
214
+ // bare `--`, which is a legal opaque message token, not an argv delimiter here.
211
215
  while (args.length > 0) {
212
216
  if (positional[0] === "resume" && positional.length >= 2) {
213
217
  positional.push(...args);
@@ -271,22 +275,26 @@ function parseArgv(argv) {
271
275
  };
272
276
  }
273
277
  /**
274
- * Unique public resume request parser (#471).
275
- * One optional argv after runId is the opaque message; no further positionals.
278
+ * Unique public resume address parser (#471 / #1201): ticket, seat (optionally
279
+ * `#<round>`), then one optional opaque message argv; no further positionals.
276
280
  */
277
- const RESUME_USAGE_ERROR = "usage: ak-role resume <runId> [message] (put --model/--thinking/--host/--engine before <runId>; the one argv after <runId> is the opaque message, #471)";
278
- function parseResumeRequest(args) {
279
- const runId = args[0];
280
- if (runId === undefined || runId.trim() === "" || runId.startsWith("-")) {
281
+ const RESUME_USAGE_ERROR = "usage: ak-role resume <ticket> <seat>[#<round>] [message] (ticket is the bare number; put --model/--thinking/--host/--engine before <ticket>; the one argv after <seat> is the opaque message)";
282
+ function parseResumeAddress(args) {
283
+ const [ticketToken, seatToken, ...rest] = args;
284
+ const ticketNumber = ticketToken === undefined ? undefined : parseAddressTicket(ticketToken);
285
+ if (ticketNumber === undefined || seatToken === undefined || rest.length > 1) {
281
286
  throw new CliUsageError(RESUME_USAGE_ERROR);
282
287
  }
283
- if (args.length > 2) {
284
- throw new CliUsageError(RESUME_USAGE_ERROR);
285
- }
286
- if (args.length === 2) {
287
- return { runId, message: args[1] };
288
+ const { seat, round } = parseSeatRound(seatToken);
289
+ if (!isPublicCallableRole(seat) || round === "") {
290
+ throw new CliUsageError(`${RESUME_USAGE_ERROR}; not a callable seat: ${seatToken}`);
288
291
  }
289
- return { runId };
292
+ return {
293
+ ticketNumber,
294
+ seat,
295
+ ...(round === undefined ? {} : { round }),
296
+ ...(rest.length === 0 ? {} : { message: rest[0] }),
297
+ };
290
298
  }
291
299
  function invocationFromParsed(parsed) {
292
300
  if (parsed.model === undefined &&
@@ -391,7 +399,7 @@ function renderHelp() {
391
399
  }
392
400
  lines.push("", "OPTIONS");
393
401
  lines.push(...renderHumanOwnerOptionLines("global"));
394
- lines.push("", "Role options: ak-role help <command>", "Persistent config: ak-role config set <seat> <provider/model[:thinking]> | unset <gatekeeper|inspector|notary>", "Persistent engine (callable roles): ak-role config set-engine <seat> <name> [model] | unset-engine <seat> | set-engine-model <seat> <model> | unset-engine-model <seat>", "Persistent host (callable roles): ak-role config set-host <seat> <name> | unset-host <seat>", "Host providers: ~/.ak-roles/host-providers.json (owner-edited; table > unique host directory > fail)", "Model resolution: --model → persistent seat → officer inherit (#620); still none → error (#178)", "Host resolution: --host → persistent seat host → pi (resume uses the same order; #617)", "Resume flag position: --model/--thinking/--host/--engine go before <runId> (before `resume` or between `resume` and <runId>); the one argv after <runId> is always the opaque message, never a flag (#471)", "Effective seats: ak-role roles");
402
+ lines.push("", "Role options: ak-role help <command>", "Persistent config: ak-role config set <seat> <provider/model[:thinking]> | unset <gatekeeper|inspector|notary>", "Persistent engine (callable roles): ak-role config set-engine <seat> <name> [model] | unset-engine <seat> | set-engine-model <seat> <model> | unset-engine-model <seat>", "Persistent host (callable roles): ak-role config set-host <seat> <name> | unset-host <seat>", "Host providers: ~/.ak-roles/host-providers.json (owner-edited; table > unique host directory > fail)", "Model resolution: --model → persistent seat → officer inherit (#620); still none → error (#178)", "Host resolution: --host → persistent seat host → pi (resume uses the same order; #617)", "Resume address: ak-role resume <ticket> <seat>[#<round>] [message]; --model/--thinking/--host/--engine go before <ticket> (before `resume` or between `resume` and <ticket>); the one argv after <seat> is always the opaque message, never a flag (#471)", "Effective seats: ak-role roles");
395
403
  return `${lines.join("\n")}\n`;
396
404
  }
397
405
  function renderCommandHelp(command) {
@@ -803,29 +811,27 @@ export async function runAkRole(argv, env) {
803
811
  };
804
812
  env = { ...env, freshSummons: true };
805
813
  }
806
- // Resume reopens an exact Role run (#416): caller decides; session principal
807
- // must still exist. Seat and dispatch follow the durable admitted role.
808
- // #471: unique parser owns {runId, message?}; five role paths only consume it.
814
+ // Resume reopens one leg of a ticket (#416 / #1201): caller decides; session
815
+ // principal must still exist. The address is ticket + seat (+ round); only
816
+ // legs filed under the ticket are in it.
809
817
  if (parsed.command === "resume") {
810
- let resumeRequest = parseResumeRequest(parsed.args);
818
+ const address = parseResumeAddress(parsed.args);
819
+ const runDirectory = locateTicketLeg(activationBookDirectory(resolveActivationLedgerHome(home), resolveBookKeyFromGit(env.cwd ?? process.cwd())), address);
820
+ const resumeRequest = {
821
+ runId: runIdFromRunDirectory(runDirectory),
822
+ runDirectory,
823
+ ...(address.message === undefined ? {} : { message: address.message }),
824
+ };
811
825
  resumeFailureContext = {
812
826
  home,
813
827
  runId: resumeRequest.runId,
828
+ runDirectory,
814
829
  authority: env.principalAuthority ?? piDurablePrincipalAuthority,
815
830
  };
816
- const runDirectory = await findRunDirectoryById(home, resumeRequest.runId);
817
- if (runDirectory !== undefined) {
818
- resumeRequest = { ...resumeRequest, runDirectory };
819
- resumeFailureContext = { ...resumeFailureContext, runDirectory };
820
- }
821
831
  const parts = await loadPublicRoleDispatchParts(env, home);
822
- const resumeRole = await peekRoleRunRole(home, resumeRequest.runId, resumeRequest);
823
- // Missing durable role keeps the judge seat table. The resume entry
824
- // itself is one function; it reads the stored run.
825
- const seatRole = resumeRole ?? "judge";
826
- const seat = resolveEffectiveSeat(parts.config, seatRole, parts.credentials, invocationFromParsed(parsed));
832
+ const seat = resolveEffectiveSeat(parts.config, address.seat, parts.credentials, invocationFromParsed(parsed));
827
833
  const resumeEnv = createRoleEnvironment(env, {
828
- role: seatRole,
834
+ role: address.seat,
829
835
  home,
830
836
  agentDir: parts.agentDir,
831
837
  cwd: parts.cwd,
@@ -22,16 +22,17 @@ import { NotarySourceRunError, resolveNotarySourceRunLocator } from "../notary-s
22
22
  import { packagedAdmitsCountersign, isNavigatorSeat, packagedBindsBoardTicket, packagedRebindSourceOnResume, packagedRoleMetadata, receiptStatus, } from "../packaged-role-registry.js";
23
23
  import { readAuditorResumeBinding } from "../auditor-soul.js";
24
24
  import { CliUsageError } from "./cli-errors.js";
25
- import { admitPublicRole, admittedSourceRunPath, bindAdmittedTicketNumber, appendCallerFileFlagPaths, buildInstructionTransportPrompt, materializeCountersignInvocation, persistAdmittedAuditedSubmissionToolCallId, persistAdmittedSourceRunPath, readAdmittedAuditedSubmissionToolCallId, recordAdmittedCorrelation, recordChildDiaristRun, relocateAdmittedRunToTicket, } from "./invocation.js";
25
+ import { admitPublicRole, admittedSourceRunPath, bindAdmittedTicketNumber, appendCallerFileFlagPaths, buildInstructionTransportPrompt, materializeCountersignInvocation, persistAdmittedAuditedLeg, persistAdmittedAuditedSubmissionToolCallId, readAdmittedAuditedSubmissionToolCallId, recordAdmittedCorrelation, recordChildDiaristRun, relocateAdmittedRunToTicket, } from "./invocation.js";
26
26
  import { bindDiaristAssertedTicketNumber, presentControlledFailure, packageFaultNoteFor, prepareSummonsResumeMaterials, roleTurnOptions, runPostAdmissionOneShot, runPostAdmissionResumable, runPostAdmissionSeatResume, showResumeErrorPointer, resumeTurnRequestProjectionOptions, } from "./post-admission.js";
27
27
  import { presentTerminal } from "./auto-resume.js";
28
28
  import { loadResumablePublicRole, markRunAdmitted, readCurrentCourt, } from "./run-lifecycle.js";
29
29
  import { tryResumeSameTicketSeatRun } from "./seat-ticket-binding.js";
30
- import { ledgerReadScope, presentStructuralRejection, readBoundSessionEntries, trySettlePublicSeat, } from "./settlement.js";
30
+ import { ledgerReadScope, presentStructuralRejection, readBoundSessionEntries, retainPackageFault, trySettlePublicSeat, } from "./settlement.js";
31
31
  import { warnMissingMethodSkills } from "./machine-method-skills.js";
32
32
  import { formatTerminalResult, isLawfulTypedTerminalOutcome, } from "./terminal.js";
33
33
  import { admittedSeatTurnDetails, projectRoleTurnRequest, requiredMethodSkills, } from "./turn-request.js";
34
34
  import { invokeCourtDiarist, latestPayloadEscalated, } from "./countersign-run.js";
35
+ import { readAuditedRound } from "../ticket-progress.js";
35
36
  import { errorText } from "../unknown-value.js";
36
37
  const AUDITED_ROLES = new Set(["judge", "fixer", "coder", "secretariat", "countersign", "doctor"]);
37
38
  const SECRETARIAT_STATUS_REASK = "status 不是 converged、escalate 之一。请重新交卷,status 写明其一。";
@@ -568,6 +569,25 @@ async function runOmittedLensBatch(argv, parsed, env, io) {
568
569
  io.stdout(formatTerminalResult(terminal));
569
570
  return { exitCode: failed ? 1 : 0, terminal };
570
571
  }
572
+ /**
573
+ * #1200: every officer admission that names an audited leg — gate summons and
574
+ * a caller's own `--source-run`, first mint and re-summons alike — pins
575
+ *「审 谁#轮」before the officer runs, in the same page write as the source
576
+ * path when this admission is the one that records it. A row that cannot be
577
+ * read keeps its cause on the officer run; the officer still runs and its rows
578
+ * carry no `for`.
579
+ */
580
+ async function pinAuditedLegAtAdmission(officerRunDirectory, auditedRunDirectory, io, source) {
581
+ const { for: auditedRound, fault } = readAuditedRound(auditedRunDirectory);
582
+ persistAdmittedAuditedLeg(officerRunDirectory, { for: auditedRound, ...source });
583
+ if (fault === undefined)
584
+ return;
585
+ await retainPackageFault({
586
+ runDirectory: officerRunDirectory,
587
+ diagnostic: fault,
588
+ stderr: (text) => io.stderr(text),
589
+ });
590
+ }
571
591
  /**
572
592
  * One same-parent lookup. Seat branches still build their own summons.
573
593
  * A found child resumes that child. No prior run, explicit new, or a typed
@@ -592,7 +612,7 @@ function resumeSameParentInstructionSeat(input) {
592
612
  runDirectory,
593
613
  ...(reask === undefined ? {} : { message: reask }),
594
614
  ...(materials === undefined ? {} : { summons: materials }),
595
- }, input.env, input.io);
615
+ }, input.env, input.io, input.parentRunPath);
596
616
  },
597
617
  });
598
618
  }
@@ -677,7 +697,9 @@ async function runCountersignBody(parsed, env, io) {
677
697
  await materializeAdmission(isSafePositiveTicketNumber(env.boundTicketNumber) ? env.boundTicketNumber : undefined);
678
698
  await markRunAdmitted(admitted, env.principalAuthority);
679
699
  if (gateParentRunPath !== undefined) {
680
- await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
700
+ await pinAuditedLegAtAdmission(admitted.runDirectory, gateParentRunPath, io, {
701
+ sourceRunPath: gateParentRunPath,
702
+ });
681
703
  admitted = { ...admitted, sourceRunPath: gateParentRunPath };
682
704
  }
683
705
  // #1208 C1 / #1166 J11: one shared initial-prompt seam (incl. file flags).
@@ -879,13 +901,25 @@ export async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
879
901
  throw error;
880
902
  }
881
903
  if (instructionSourceRunPath !== undefined) {
882
- await persistAdmittedSourceRunPath(admitted, instructionSourceRunPath);
904
+ await pinAuditedLegAtAdmission(admitted.runDirectory, instructionSourceRunPath, io, {
905
+ sourceRunPath: instructionSourceRunPath,
906
+ });
883
907
  admitted = { ...admitted, sourceRunPath: instructionSourceRunPath };
884
908
  }
885
- if (record.sameParent === "subject-source" && auditorSource !== undefined) {
886
- await persistAdmittedSourceRunPath(admitted, auditorSource, auditorSubject);
909
+ else if (record.sameParent === "subject-source" && auditorSource !== undefined) {
910
+ await pinAuditedLegAtAdmission(admitted.runDirectory, auditorSource, io, {
911
+ sourceRunPath: auditorSource,
912
+ auditorSubject,
913
+ });
887
914
  admitted = { ...admitted, sourceRunPath: auditorSource };
888
915
  }
916
+ else {
917
+ // The admission itself already recorded the source (source-locator seats).
918
+ const auditedRunDirectory = admittedSourceRunPath(admitted);
919
+ if (auditedRunDirectory !== undefined) {
920
+ await pinAuditedLegAtAdmission(admitted.runDirectory, auditedRunDirectory, io);
921
+ }
922
+ }
889
923
  // #1208 C2: same helper as resume — inherit the audited source's known ticket.
890
924
  admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
891
925
  const runAdmitted = async () => {
@@ -950,7 +984,9 @@ async function inheritKnownTicketFromSource(admitted, authority) {
950
984
  await relocateAdmittedRunToTicket(admitted, authority);
951
985
  return admitted;
952
986
  }
953
- export async function runPublicInstructionSeatResume(request, env, io) {
987
+ export async function runPublicInstructionSeatResume(request, env, io,
988
+ /** #1200: the audited leg a same-parent re-summons names; absent on every other resume. */
989
+ resummonedFor) {
954
990
  let selectedRequest = request;
955
991
  const resume = async () => {
956
992
  const held = [];
@@ -979,6 +1015,12 @@ export async function runPublicInstructionSeatResume(request, env, io) {
979
1015
  return { ...loaded, admitted };
980
1016
  },
981
1017
  buildTurnRequest: async (admitted, effective) => {
1018
+ // #1200: the turn is built once this leg has taken the summons — inside
1019
+ // its writer lease wherever the resume holds one — and before the host
1020
+ // turn. A summons the lease refuses never gets here and pins nothing.
1021
+ if (resummonedFor !== undefined) {
1022
+ await pinAuditedLegAtAdmission(admitted.runDirectory, resummonedFor, io);
1023
+ }
982
1024
  const summonsPrepared = await prepareSummonsResumeMaterials(admitted.runDirectory, effective.summons);
983
1025
  const projection = resumeTurnRequestProjectionOptions(admitted, effective, env, summonsPrepared);
984
1026
  // #1208: internal summons only — shared resolver owns review dialogue.
@@ -1409,8 +1451,7 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
1409
1451
  const pass = chain.passes.at(-1);
1410
1452
  const officerTerminal = pass?.terminal;
1411
1453
  const officerRunDirectory = pass?.runDirectory;
1412
- const officerRunId = pass?.runId
1413
- ?? (officerRunDirectory === undefined ? undefined : runIdFromRunDirectory(officerRunDirectory));
1454
+ const officerRunId = pass?.runId;
1414
1455
  if (officerTerminal !== undefined && officerRunId !== undefined) {
1415
1456
  // #1214 F1: present audited original and officer scene separately.
1416
1457
  await presentAuditedOriginalVolume(turn, io);
@@ -1441,9 +1482,7 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
1441
1482
  if (chain.status === "escalate") {
1442
1483
  const escalation = chain.passes.at(-1);
1443
1484
  const escalatedRunDirectory = escalation?.runDirectory;
1444
- const escalatedRunId = escalation?.runId
1445
- ?? (escalatedRunDirectory === undefined
1446
- ? undefined : runIdFromRunDirectory(escalatedRunDirectory));
1485
+ const escalatedRunId = escalation?.runId;
1447
1486
  if (escalatedRunId === undefined) {
1448
1487
  return incompleteAuditWithoutOfficerVolume(turn, admitted, io, "escalated audit has no resumable run identity");
1449
1488
  }
@@ -162,24 +162,34 @@ async function mergeInvocationIdentityPage(runDirectory, fields) {
162
162
  }));
163
163
  }
164
164
  /**
165
- * Persist parent --source-run path onto the admitted section for officer resume lookup (#747).
166
- * Reuses the existing notary sourceRunPath key; does not invent a new field name.
165
+ * What this officer audits, on its admitted section in one page write.
166
+ * `for` (#1200) is the audited leg's「席#轮」at this admission: a new value
167
+ * replaces the old one, none clears it. `sourceRunPath` (#747) is the parent
168
+ * --source-run path kept for officer resume lookup, given only by the admission
169
+ * that first records it; it reuses the existing notary key and is never replaced.
167
170
  */
168
- export async function persistAdmittedSourceRunPath(admitted, sourceRunPath, auditorSubject) {
169
- if (sourceRunPath.trim() === "") {
170
- throw new Error("persistAdmittedSourceRunPath requires a non-empty sourceRunPath");
171
+ export function persistAdmittedAuditedLeg(runDirectory, audited) {
172
+ const { sourceRunPath, auditorSubject } = audited;
173
+ if (sourceRunPath !== undefined && sourceRunPath.trim() === "") {
174
+ throw new Error("persistAdmittedAuditedLeg requires a non-empty sourceRunPath");
171
175
  }
172
- updateSectionSync(admitted.runDirectory, "admitted", (current) => {
173
- if (typeof current.sourceRunPath === "string" && current.sourceRunPath !== sourceRunPath) {
174
- throw new Error(`persistAdmittedSourceRunPath refuses to replace ${current.sourceRunPath} with ${sourceRunPath}`);
176
+ updateSectionSync(runDirectory, "admitted", (current) => {
177
+ if (sourceRunPath !== undefined
178
+ && typeof current.sourceRunPath === "string"
179
+ && current.sourceRunPath !== sourceRunPath) {
180
+ throw new Error(`persistAdmittedAuditedLeg refuses to replace ${current.sourceRunPath} with ${sourceRunPath}`);
175
181
  }
176
- const sameSubject = auditorSubject === undefined || current.auditorSubject === auditorSubject;
177
- if (current.sourceRunPath === sourceRunPath && sameSubject)
182
+ const unchanged = current.for === audited.for
183
+ && (sourceRunPath === undefined || current.sourceRunPath === sourceRunPath)
184
+ && (auditorSubject === undefined || current.auditorSubject === auditorSubject);
185
+ if (unchanged)
178
186
  return undefined;
187
+ const { for: _replaced, ...rest } = current;
179
188
  return {
180
- ...current,
181
- sourceRunPath,
189
+ ...rest,
190
+ ...(sourceRunPath === undefined ? {} : { sourceRunPath }),
182
191
  ...(auditorSubject === undefined ? {} : { auditorSubject }),
192
+ ...(audited.for === undefined ? {} : { for: audited.for }),
183
193
  };
184
194
  });
185
195
  }