@akagilnc/pi-workflow-roles 0.1.5949 → 0.1.6011

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 (50) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/acp-host/production-host.js +16 -61
  4. package/dist/countersign-contracts.js +2 -22
  5. package/dist/countersign-role.js +0 -8
  6. package/dist/doctor-contracts.js +0 -1
  7. package/dist/gleaner-left-contracts.js +1 -18
  8. package/dist/gleaner-left-role.js +1 -2
  9. package/dist/headless-host/production-host.js +19 -64
  10. package/dist/inspector-role.js +0 -2
  11. package/dist/judge-role.js +1 -7
  12. package/dist/migrate-book-topology.js +0 -16
  13. package/dist/navigator-route-table.js +0 -1
  14. package/dist/notary-contracts.js +1 -16
  15. package/dist/package-contracts/auditor-output.js +1 -2
  16. package/dist/package-contracts/gatekeeper-output.js +0 -4
  17. package/dist/package-contracts/terminating-tools.js +1 -3
  18. package/dist/package-resources/engine-material.js +1 -8
  19. package/dist/pi/role-turn-host.js +0 -3
  20. package/dist/public-cli/cli.js +1 -23
  21. package/dist/public-cli/config.js +0 -4
  22. package/dist/public-cli/invocation.js +0 -4
  23. package/dist/public-cli/main.js +12 -55
  24. package/dist/public-cli/option-definitions.js +0 -8
  25. package/dist/session-dialogue.js +26 -30
  26. package/package.json +1 -1
  27. package/scripts/build-package.mjs +0 -1
  28. package/src/countersign-contracts.ts +1 -21
  29. package/src/countersign-role.ts +1 -8
  30. package/src/doctor-contracts.ts +0 -1
  31. package/src/gleaner-left-contracts.ts +0 -17
  32. package/src/gleaner-left-role.ts +0 -2
  33. package/src/inspector-role.ts +1 -3
  34. package/src/judge-role.ts +1 -3
  35. package/src/navigator-route-table.ts +0 -2
  36. package/src/notary-contracts.ts +1 -26
  37. package/src/package-contracts/auditor-output.ts +1 -3
  38. package/src/package-contracts/gatekeeper-output.ts +0 -10
  39. package/src/package-contracts/terminating-tools.ts +2 -4
  40. package/src/package-resources/engine-material.ts +1 -16
  41. package/src/pi/role-turn-host.ts +0 -3
  42. package/src/public-cli/cli.ts +0 -24
  43. package/src/public-cli/config.ts +2 -8
  44. package/src/public-cli/invocation.ts +0 -28
  45. package/src/public-cli/option-definitions.ts +1 -10
  46. package/src/session-dialogue.ts +22 -31
  47. package/dist/canonical-json.js +0 -75
  48. package/dist/judge-recording-anti-forge.js +0 -39
  49. package/src/canonical-json.ts +0 -74
  50. package/src/judge-recording-anti-forge.ts +0 -53
package/CLAUDE.md CHANGED
@@ -57,7 +57,7 @@
57
57
 
58
58
  ## 起居录位置(#1092)
59
59
 
60
- 本票记录在 `~/.ak-roles/books/<簿>/<票号>/`,没有票号的在 `~/.ak-roles/books/<簿>/unbound/`。各腿的记录在其下 `runs/<runId>@<席>/`。角色凭已知票号自行定位与读取;代码不计算、不冻结、不向提示或附件递送本票指针。
60
+ 本票记录在 `~/.ak-roles/books/<簿>/<票号>/`,没有票号的在 `~/.ak-roles/books/<簿>/unbound/`。各腿的记录在其下 `runs/<runId>@<席>/`。角色凭已知票号自行定位与读取;代码不计算、不冻结、不向提示或附件递送本票指针。要读会话卷里谁说了什么,可以用 `ak-role dialogue <会话卷>`(用法见 `ak-role help dialogue`)。
61
61
 
62
62
  ## 锚定宪法
63
63
 
package/README.md CHANGED
@@ -145,7 +145,7 @@ Tests run on Vitest ([ADR 0090](docs/adr/0090-tests-run-on-vitest-fixtures-and-h
145
145
  ```bash
146
146
  pnpm exec vitest run --project unit-contract
147
147
  pnpm exec vitest run --project integration test/integration/public-cli-bin-startup.test.ts
148
- pnpm exec vitest run --project package test/package/published-dist-import-closure.test.ts
148
+ pnpm exec vitest run --project package test/package/npm-identity-metadata.test.ts
149
149
  ```
150
150
 
151
151
  Progress uses the dot reporter; the full structured report is `.vitest/results.json`.
@@ -1897,13 +1897,6 @@ var init_worker_output = __esm({
1897
1897
  }
1898
1898
  });
1899
1899
 
1900
- // src/canonical-json.ts
1901
- var init_canonical_json = __esm({
1902
- "src/canonical-json.ts"() {
1903
- "use strict";
1904
- }
1905
- });
1906
-
1907
1900
  // src/doctor-contracts.ts
1908
1901
  import { Type as Type10 } from "typebox";
1909
1902
  function validateDoctorSubmissionShape(value) {
@@ -1916,7 +1909,6 @@ var DOCTOR_EVIDENCE_TOOL_NAME, DOCTOR_OUTPUT_TOOL_NAME, DOCTOR_AUDIT_TOOL_NAME,
1916
1909
  var init_doctor_contracts = __esm({
1917
1910
  "src/doctor-contracts.ts"() {
1918
1911
  "use strict";
1919
- init_canonical_json();
1920
1912
  init_open_tool_schema();
1921
1913
  init_terminating_infrastructure();
1922
1914
  init_unknown_value();
@@ -2119,7 +2111,6 @@ var init_countersign_contracts = __esm({
2119
2111
  "src/countersign-contracts.ts"() {
2120
2112
  "use strict";
2121
2113
  init_review_submission();
2122
- init_unknown_value();
2123
2114
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
2124
2115
  }
2125
2116
  });
@@ -2132,7 +2123,6 @@ var init_gleaner_left_contracts = __esm({
2132
2123
  "use strict";
2133
2124
  init_open_tool_schema();
2134
2125
  init_terminating_infrastructure();
2135
- init_unknown_value();
2136
2126
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
2137
2127
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
2138
2128
  openToolObject(
@@ -4458,8 +4448,6 @@ var init_terminating_tools = __esm({
4458
4448
  init_auditor_output();
4459
4449
  init_merger_contracts();
4460
4450
  init_notary_contracts();
4461
- init_countersign_contracts();
4462
- init_gleaner_left_contracts();
4463
4451
  init_inspector_contracts();
4464
4452
  init_diarist_contracts();
4465
4453
  init_secretariat_contracts();
@@ -5081,20 +5069,20 @@ function isCodexOwnerResponseItemUser(message) {
5081
5069
  if (kinds === void 0) return false;
5082
5070
  return kinds.some((kind) => kind.startsWith("user."));
5083
5071
  }
5084
- function fromQueueEvent(row) {
5085
- if (row.type !== "queue-operation" || row.operation !== "enqueue") return [];
5086
- const content = row.content;
5087
- if (typeof content !== "string" || content === "") return [];
5088
- const id = nativeEventId(row);
5089
- return [{ speaker: "owner", text: content, ...id === void 0 ? {} : { id } }];
5090
- }
5091
5072
  function hasFixedOpenTagPrefix(content, tag) {
5092
5073
  if (!content.startsWith(tag)) return false;
5093
5074
  const next = content.charAt(tag.length);
5094
5075
  return next === "" || next === ">" || next === " " || next === " " || next === "\n" || next === "\r";
5095
5076
  }
5096
- function isFixedNonOwnerEnqueueShape(content) {
5097
- return hasFixedOpenTagPrefix(content, TASK_NOTIFICATION_OPEN_TAG);
5077
+ function fromQueuedCommandAttachment(row) {
5078
+ if (!isRecord(row.attachment) || row.attachment.type !== "queued_command") return [];
5079
+ const kind = materializationOriginKind(row.attachment);
5080
+ if (isNonOwnerOriginKind(kind)) return [];
5081
+ const text = textParts(row.attachment.prompt).join("");
5082
+ if (text === "") return [];
5083
+ if (kind === void 0 && hasFixedOpenTagPrefix(text, TASK_NOTIFICATION_OPEN_TAG)) return [];
5084
+ const id = nativeEventId(row);
5085
+ return [{ speaker: "owner", text, ...id === void 0 ? {} : { id } }];
5098
5086
  }
5099
5087
  function materializationOriginKind(row) {
5100
5088
  if (!isRecord(row.origin)) return void 0;
@@ -5124,13 +5112,10 @@ function fromMessageEvent(row) {
5124
5112
  function adaptSessionDialogue(rows) {
5125
5113
  return rows.map((row) => {
5126
5114
  if (row === void 0) return [];
5115
+ if (row.type === "queue-operation" || row.type === "api-request-blob") return [];
5116
+ if (row.type === "attachment") return fromQueuedCommandAttachment(row);
5127
5117
  const originKind = materializationOriginKind(row);
5128
5118
  if (isNonOwnerOriginKind(originKind)) return [];
5129
- if (row.type === "queue-operation" && row.operation === "enqueue" && typeof row.content === "string" && isFixedNonOwnerEnqueueShape(row.content)) {
5130
- return [];
5131
- }
5132
- const queued = fromQueueEvent(row);
5133
- if (queued.length > 0) return queued;
5134
5119
  return fromMessageEvent(row);
5135
5120
  });
5136
5121
  }
@@ -10734,7 +10719,6 @@ function createPiRoleTurnHost(config) {
10734
10719
  else env.AK_ROLE_INVOCATION_SCOPE = request.invocationScopeId;
10735
10720
  if (request.host === void 0 || request.host.trim() === "") delete env.AK_ROLE_HOST;
10736
10721
  else env.AK_ROLE_HOST = request.host.trim();
10737
- delete env.AK_ROLE_SUMMONS_INSTRUCTION;
10738
10722
  if (request.deliveryRequestLimit === void 0) delete env[RECEIPT_DELIVERY_LIMIT_ENV];
10739
10723
  else env[RECEIPT_DELIVERY_LIMIT_ENV] = String(request.deliveryRequestLimit);
10740
10724
  applyEngineChildEnv(env, request.engine);
@@ -10867,7 +10851,7 @@ var init_role_turn_host = __esm({
10867
10851
  });
10868
10852
 
10869
10853
  // src/package-resources/engine-material.ts
10870
- import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync3 } from "node:fs";
10854
+ import { existsSync as existsSync8, readFileSync as readFileSync3 } from "node:fs";
10871
10855
  import { join as join14 } from "node:path";
10872
10856
  function pickEngineAxis(source) {
10873
10857
  return {
@@ -11054,7 +11038,6 @@ var init_institutional_resolution = __esm({
11054
11038
  // src/public-cli/config.ts
11055
11039
  var config_exports = {};
11056
11040
  __export(config_exports, {
11057
- GATE_OFFICER_SEATS: () => GATE_OFFICER_SEATS,
11058
11041
  buildSeatModelCliArgs: () => buildSeatModelCliArgs2,
11059
11042
  clearPersistentSeatConfig: () => clearPersistentSeatConfig,
11060
11043
  credentialProvidersFromAuthData: () => credentialProvidersFromAuthData,
@@ -11561,7 +11544,6 @@ async function loadCredentialProviders(agentDir) {
11561
11544
  throw error;
11562
11545
  }
11563
11546
  }
11564
- var GATE_OFFICER_SEATS;
11565
11547
  var init_config = __esm({
11566
11548
  "src/public-cli/config.ts"() {
11567
11549
  "use strict";
@@ -11571,9 +11553,6 @@ var init_config = __esm({
11571
11553
  init_packaged_role_registry();
11572
11554
  init_registry();
11573
11555
  init_unknown_value();
11574
- GATE_OFFICER_SEATS = PUBLIC_ROLE_RECORDS.flatMap(
11575
- (record) => "provinceConfig" in record && record.provinceConfig === true ? [record.role] : []
11576
- );
11577
11556
  }
11578
11557
  });
11579
11558
 
@@ -18311,7 +18290,6 @@ __export(cli_exports, {
18311
18290
  buildExplicitInternalActivationArgs: () => buildExplicitInternalActivationArgs,
18312
18291
  commandNeedsProcessCancel: () => commandNeedsProcessCancel,
18313
18292
  helpDocument: () => helpDocument,
18314
- helpDocumentForCommand: () => helpDocumentForCommand,
18315
18293
  projectConfigDisplaySeats: () => projectConfigDisplaySeats,
18316
18294
  projectConfigSeatDisplay: () => projectConfigSeatDisplay,
18317
18295
  resolveInternalRoleEntrypoint: () => resolveInternalRoleEntrypoint,
@@ -18592,31 +18570,10 @@ function loadAndValidateConfig(home, packageRoot) {
18592
18570
  }
18593
18571
  function helpDocument() {
18594
18572
  return {
18595
- executable: "ak-role",
18596
18573
  capabilities: listHelpCapabilities(),
18597
- internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE,
18598
- /** #342 structured global options from the sole option table. */
18599
- globalOptions: projectOwnerOptions("global")
18574
+ internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE
18600
18575
  };
18601
18576
  }
18602
- function helpDocumentForCommand(command) {
18603
- if (command === "global") {
18604
- return {
18605
- command: "global",
18606
- kind: "global",
18607
- options: projectOwnerOptions("global")
18608
- };
18609
- }
18610
- if (command in PUBLIC_ROLE_ARGV) {
18611
- const owner = command;
18612
- return {
18613
- command: owner,
18614
- kind: owner === "analyst" ? "deterministic" : "role",
18615
- options: projectOwnerOptions(owner)
18616
- };
18617
- }
18618
- return void 0;
18619
- }
18620
18577
  function appendUsageAndExamples(lines, topic) {
18621
18578
  const facts = projectCommandHelp(topic);
18622
18579
  if (facts === void 0) return;
@@ -21718,10 +21675,8 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
21718
21675
  init_notary_contracts();
21719
21676
 
21720
21677
  // src/countersign-role.ts
21721
- init_review_submission();
21722
21678
  init_role_submission_declarations();
21723
21679
  init_countersign_contracts();
21724
- init_countersign_contracts();
21725
21680
  var COUNTERSIGN_TOOL_SPEC = roleSubmissionDeclaration("countersign");
21726
21681
 
21727
21682
  // src/gleaner-left-role.ts
@@ -22006,7 +21961,7 @@ init_unknown_value();
22006
21961
  init_submission_errors();
22007
21962
  init_worker_submission_contracts();
22008
21963
  import { execFileSync as execFileSync3 } from "node:child_process";
22009
- import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync4 } from "node:fs";
21964
+ import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync3, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync4 } from "node:fs";
22010
21965
  import { resolve as resolve15 } from "node:path";
22011
21966
  var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
22012
21967
  var WORKER_COMMIT_REMINDER_BOUNCE_ENTRY_TYPE = "commit-reminder-bounce";
@@ -22073,12 +22028,12 @@ function rmOwnedDir(dir) {
22073
22028
  const hookPath = resolve15(dir, HOOK_FILE);
22074
22029
  if (!ownedHook(hookPath)) return;
22075
22030
  rmSync4(hookPath, { force: true });
22076
- if (existsSync14(dir) && readdirSync4(dir).length === 0) rmdirSync(dir);
22031
+ if (existsSync14(dir) && readdirSync3(dir).length === 0) rmdirSync(dir);
22077
22032
  }
22078
22033
  function linkedGitDirs(commonDir) {
22079
22034
  const root = resolve15(commonDir, "worktrees");
22080
22035
  if (!existsSync14(root)) return [];
22081
- return readdirSync4(root).map((name) => resolve15(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22036
+ return readdirSync3(root).map((name) => resolve15(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22082
22037
  }
22083
22038
  function uninstallPackageWorkerHooks(cwd) {
22084
22039
  let inside;
@@ -1,25 +1,5 @@
1
- import { REVIEW_QUEUE_STATUSES, REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.js";
2
- import { isRecord } from "./unknown-value.js";
1
+ import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.js";
3
2
  const COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
4
- function validateRecordedCountersignOutput(verdict) {
5
- if (!isRecord(verdict)) {
6
- throw new Error("Countersign verdict has no execution discriminator");
7
- }
8
- let status;
9
- try {
10
- status = verdict.status;
11
- } catch {
12
- throw new Error("Countersign verdict has no execution discriminator");
13
- }
14
- if (typeof status !== "string") {
15
- throw new Error("Countersign verdict has no execution discriminator");
16
- }
17
- if (REVIEW_QUEUE_STATUSES.has(status)) {
18
- return verdict;
19
- }
20
- throw new Error("Countersign verdict has no execution discriminator");
21
- }
22
3
  export {
23
- COUNTERSIGN_OUTPUT_TOOL_NAME,
24
- validateRecordedCountersignOutput
4
+ COUNTERSIGN_OUTPUT_TOOL_NAME
25
5
  };
@@ -1,13 +1,5 @@
1
- import { reviewSubmissionSchema } from "./review-submission.js";
2
1
  import { roleSubmissionDeclaration } from "./role-submission-declarations.js";
3
- import { COUNTERSIGN_OUTPUT_TOOL_NAME, validateRecordedCountersignOutput, } from "./countersign-contracts.js";
4
2
  export { COUNTERSIGN_OUTPUT_TOOL_NAME } from "./countersign-contracts.js";
5
- // #836 r16 class 1: fix/note/decisionGate are LLM/human-read narrative content —
6
- // no code branches on their length or nested presence. `status` alone is the
7
- // machine discriminator the queue reads.
8
- // #1055: the three-state field is an enum+required host generation constraint.
9
- /** 给事中票庭审读五问的交卷形状(ADR 0074);形状指引,非 schema 闸。 */
10
- export const countersignVerdictSchema = reviewSubmissionSchema;
11
3
  /**
12
4
  * 决定工具规格。生命周期装配(注册、activate、prompt 注入、singleton 检查、
13
5
  * terminate)归注册信封 owner——src/role-runtime.ts(ADR 0018 / #572 R2 判词)。
@@ -1,5 +1,4 @@
1
1
  import { Type } from "typebox";
2
- import { canonicalJson } from "./canonical-json.js";
3
2
  import { openToolObject } from "./open-tool-schema.js";
4
3
  import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.js";
5
4
  import { isRecord } from "./unknown-value.js";
@@ -1,7 +1,6 @@
1
1
  import { Type } from "typebox";
2
2
  import { openToolObject } from "./open-tool-schema.js";
3
3
  import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.js";
4
- import { isRecord } from "./unknown-value.js";
5
4
  const GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
6
5
  const gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
7
6
  openToolObject(
@@ -22,24 +21,8 @@ const GLEANER_LEFT_BASE_FLAG = {
22
21
  type: "string"
23
22
  }
24
23
  };
25
- function validateRecordedGleanerLeftOutput(value) {
26
- if (!isRecord(value)) {
27
- throw new Error("Gleaner-left output has no execution discriminator");
28
- }
29
- let status;
30
- try {
31
- status = value.status;
32
- } catch {
33
- throw new Error("Gleaner-left output has no execution discriminator");
34
- }
35
- if (status === "completed") {
36
- return value;
37
- }
38
- throw new Error("Gleaner-left output has no execution discriminator");
39
- }
40
24
  export {
41
25
  GLEANER_LEFT_BASE_FLAG,
42
26
  GLEANER_LEFT_OUTPUT_TOOL_NAME,
43
- gleanerLeftOutputSchema,
44
- validateRecordedGleanerLeftOutput
27
+ gleanerLeftOutputSchema
45
28
  };
@@ -1,7 +1,6 @@
1
- import { GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, validateRecordedGleanerLeftOutput, } from "./gleaner-left-contracts.js";
1
+ import { GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, } from "./gleaner-left-contracts.js";
2
2
  import { roleSubmissionDeclaration } from "./role-submission-declarations.js";
3
3
  export { GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, } from "./gleaner-left-contracts.js";
4
- export { validateRecordedGleanerLeftOutput };
5
4
  /**
6
5
  * 决定工具规格。生命周期装配归注册信封 owner——src/role-runtime.ts(ADR 0018)。
7
6
  */
@@ -853,13 +853,6 @@ var init_worker_output = __esm({
853
853
  }
854
854
  });
855
855
 
856
- // src/canonical-json.ts
857
- var init_canonical_json = __esm({
858
- "src/canonical-json.ts"() {
859
- "use strict";
860
- }
861
- });
862
-
863
856
  // src/doctor-contracts.ts
864
857
  import { Type as Type10 } from "typebox";
865
858
  function validateDoctorSubmissionShape(value) {
@@ -872,7 +865,6 @@ var DOCTOR_EVIDENCE_TOOL_NAME, DOCTOR_OUTPUT_TOOL_NAME, DOCTOR_AUDIT_TOOL_NAME,
872
865
  var init_doctor_contracts = __esm({
873
866
  "src/doctor-contracts.ts"() {
874
867
  "use strict";
875
- init_canonical_json();
876
868
  init_open_tool_schema();
877
869
  init_terminating_infrastructure();
878
870
  init_unknown_value();
@@ -1075,7 +1067,6 @@ var init_countersign_contracts = __esm({
1075
1067
  "src/countersign-contracts.ts"() {
1076
1068
  "use strict";
1077
1069
  init_review_submission();
1078
- init_unknown_value();
1079
1070
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
1080
1071
  }
1081
1072
  });
@@ -1088,7 +1079,6 @@ var init_gleaner_left_contracts = __esm({
1088
1079
  "use strict";
1089
1080
  init_open_tool_schema();
1090
1081
  init_terminating_infrastructure();
1091
- init_unknown_value();
1092
1082
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
1093
1083
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
1094
1084
  openToolObject(
@@ -2975,8 +2965,6 @@ var init_terminating_tools = __esm({
2975
2965
  init_auditor_output();
2976
2966
  init_merger_contracts();
2977
2967
  init_notary_contracts();
2978
- init_countersign_contracts();
2979
- init_gleaner_left_contracts();
2980
2968
  init_inspector_contracts();
2981
2969
  init_diarist_contracts();
2982
2970
  init_secretariat_contracts();
@@ -4791,7 +4779,7 @@ var init_gatekeeper_role = __esm({
4791
4779
  });
4792
4780
 
4793
4781
  // src/package-resources/engine-material.ts
4794
- import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
4782
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
4795
4783
  import { join as join8 } from "node:path";
4796
4784
  function pickEngineAxis(source) {
4797
4785
  return {
@@ -4953,7 +4941,6 @@ var init_institutional_resolution = __esm({
4953
4941
  // src/public-cli/config.ts
4954
4942
  var config_exports = {};
4955
4943
  __export(config_exports, {
4956
- GATE_OFFICER_SEATS: () => GATE_OFFICER_SEATS,
4957
4944
  buildSeatModelCliArgs: () => buildSeatModelCliArgs,
4958
4945
  clearPersistentSeatConfig: () => clearPersistentSeatConfig,
4959
4946
  credentialProvidersFromAuthData: () => credentialProvidersFromAuthData,
@@ -5460,7 +5447,6 @@ async function loadCredentialProviders(agentDir) {
5460
5447
  throw error;
5461
5448
  }
5462
5449
  }
5463
- var GATE_OFFICER_SEATS;
5464
5450
  var init_config = __esm({
5465
5451
  "src/public-cli/config.ts"() {
5466
5452
  "use strict";
@@ -5470,9 +5456,6 @@ var init_config = __esm({
5470
5456
  init_packaged_role_registry();
5471
5457
  init_registry();
5472
5458
  init_unknown_value();
5473
- GATE_OFFICER_SEATS = PUBLIC_ROLE_RECORDS.flatMap(
5474
- (record) => "provinceConfig" in record && record.provinceConfig === true ? [record.role] : []
5475
- );
5476
5459
  }
5477
5460
  });
5478
5461
 
@@ -5962,7 +5945,7 @@ import {
5962
5945
  existsSync as existsSync3,
5963
5946
  mkdirSync as mkdirSync3,
5964
5947
  readFileSync as readFileSync3,
5965
- readdirSync as readdirSync3,
5948
+ readdirSync as readdirSync2,
5966
5949
  rmSync as rmSync3,
5967
5950
  writeFileSync as writeFileSync2
5968
5951
  } from "node:fs";
@@ -5994,7 +5977,7 @@ function readTicketProgressLines(subjectDirectory) {
5994
5977
  const runsDir = join11(subjectDirectory, "runs");
5995
5978
  if (!existsSync3(runsDir)) return [];
5996
5979
  const out = [];
5997
- for (const name of readdirSync3(runsDir).sort()) {
5980
+ for (const name of readdirSync2(runsDir).sort()) {
5998
5981
  out.push(...readProgressFile(join11(runsDir, name, LEG_PROGRESS_FILENAME)));
5999
5982
  }
6000
5983
  return out;
@@ -6025,7 +6008,7 @@ function nextLegReceiptIndex(runDirectory) {
6025
6008
  const dir = join11(runDirectory, RECEIPTS_DIRNAME);
6026
6009
  if (!existsSync3(dir)) return 1;
6027
6010
  let max = 0;
6028
- for (const name of readdirSync3(dir)) {
6011
+ for (const name of readdirSync2(dir)) {
6029
6012
  const match = /^(\d+)\.json$/.exec(name);
6030
6013
  if (match === null) continue;
6031
6014
  const n = Number(match[1]);
@@ -6402,20 +6385,20 @@ function isCodexOwnerResponseItemUser(message) {
6402
6385
  if (kinds === void 0) return false;
6403
6386
  return kinds.some((kind) => kind.startsWith("user."));
6404
6387
  }
6405
- function fromQueueEvent(row) {
6406
- if (row.type !== "queue-operation" || row.operation !== "enqueue") return [];
6407
- const content = row.content;
6408
- if (typeof content !== "string" || content === "") return [];
6409
- const id = nativeEventId(row);
6410
- return [{ speaker: "owner", text: content, ...id === void 0 ? {} : { id } }];
6411
- }
6412
6388
  function hasFixedOpenTagPrefix(content, tag) {
6413
6389
  if (!content.startsWith(tag)) return false;
6414
6390
  const next = content.charAt(tag.length);
6415
6391
  return next === "" || next === ">" || next === " " || next === " " || next === "\n" || next === "\r";
6416
6392
  }
6417
- function isFixedNonOwnerEnqueueShape(content) {
6418
- return hasFixedOpenTagPrefix(content, TASK_NOTIFICATION_OPEN_TAG);
6393
+ function fromQueuedCommandAttachment(row) {
6394
+ if (!isRecord(row.attachment) || row.attachment.type !== "queued_command") return [];
6395
+ const kind = materializationOriginKind(row.attachment);
6396
+ if (isNonOwnerOriginKind(kind)) return [];
6397
+ const text = textParts(row.attachment.prompt).join("");
6398
+ if (text === "") return [];
6399
+ if (kind === void 0 && hasFixedOpenTagPrefix(text, TASK_NOTIFICATION_OPEN_TAG)) return [];
6400
+ const id = nativeEventId(row);
6401
+ return [{ speaker: "owner", text, ...id === void 0 ? {} : { id } }];
6419
6402
  }
6420
6403
  function materializationOriginKind(row) {
6421
6404
  if (!isRecord(row.origin)) return void 0;
@@ -6445,13 +6428,10 @@ function fromMessageEvent(row) {
6445
6428
  function adaptSessionDialogue(rows) {
6446
6429
  return rows.map((row) => {
6447
6430
  if (row === void 0) return [];
6431
+ if (row.type === "queue-operation" || row.type === "api-request-blob") return [];
6432
+ if (row.type === "attachment") return fromQueuedCommandAttachment(row);
6448
6433
  const originKind = materializationOriginKind(row);
6449
6434
  if (isNonOwnerOriginKind(originKind)) return [];
6450
- if (row.type === "queue-operation" && row.operation === "enqueue" && typeof row.content === "string" && isFixedNonOwnerEnqueueShape(row.content)) {
6451
- return [];
6452
- }
6453
- const queued = fromQueueEvent(row);
6454
- if (queued.length > 0) return queued;
6455
6435
  return fromMessageEvent(row);
6456
6436
  });
6457
6437
  }
@@ -12706,7 +12686,6 @@ function createPiRoleTurnHost(config) {
12706
12686
  else env.AK_ROLE_INVOCATION_SCOPE = request.invocationScopeId;
12707
12687
  if (request.host === void 0 || request.host.trim() === "") delete env.AK_ROLE_HOST;
12708
12688
  else env.AK_ROLE_HOST = request.host.trim();
12709
- delete env.AK_ROLE_SUMMONS_INSTRUCTION;
12710
12689
  if (request.deliveryRequestLimit === void 0) delete env[RECEIPT_DELIVERY_LIMIT_ENV];
12711
12690
  else env[RECEIPT_DELIVERY_LIMIT_ENV] = String(request.deliveryRequestLimit);
12712
12691
  applyEngineChildEnv(env, request.engine);
@@ -19659,7 +19638,6 @@ __export(cli_exports, {
19659
19638
  buildExplicitInternalActivationArgs: () => buildExplicitInternalActivationArgs,
19660
19639
  commandNeedsProcessCancel: () => commandNeedsProcessCancel,
19661
19640
  helpDocument: () => helpDocument,
19662
- helpDocumentForCommand: () => helpDocumentForCommand,
19663
19641
  projectConfigDisplaySeats: () => projectConfigDisplaySeats,
19664
19642
  projectConfigSeatDisplay: () => projectConfigSeatDisplay,
19665
19643
  resolveInternalRoleEntrypoint: () => resolveInternalRoleEntrypoint,
@@ -19940,31 +19918,10 @@ function loadAndValidateConfig(home, packageRoot) {
19940
19918
  }
19941
19919
  function helpDocument() {
19942
19920
  return {
19943
- executable: "ak-role",
19944
19921
  capabilities: listHelpCapabilities(),
19945
- internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE,
19946
- /** #342 structured global options from the sole option table. */
19947
- globalOptions: projectOwnerOptions("global")
19922
+ internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE
19948
19923
  };
19949
19924
  }
19950
- function helpDocumentForCommand(command) {
19951
- if (command === "global") {
19952
- return {
19953
- command: "global",
19954
- kind: "global",
19955
- options: projectOwnerOptions("global")
19956
- };
19957
- }
19958
- if (command in PUBLIC_ROLE_ARGV) {
19959
- const owner = command;
19960
- return {
19961
- command: owner,
19962
- kind: owner === "analyst" ? "deterministic" : "role",
19963
- options: projectOwnerOptions(owner)
19964
- };
19965
- }
19966
- return void 0;
19967
- }
19968
19925
  function appendUsageAndExamples(lines, topic) {
19969
19926
  const facts = projectCommandHelp(topic);
19970
19927
  if (facts === void 0) return;
@@ -21864,10 +21821,8 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
21864
21821
  init_notary_contracts();
21865
21822
 
21866
21823
  // src/countersign-role.ts
21867
- init_review_submission();
21868
21824
  init_role_submission_declarations();
21869
21825
  init_countersign_contracts();
21870
- init_countersign_contracts();
21871
21826
  var COUNTERSIGN_TOOL_SPEC = roleSubmissionDeclaration("countersign");
21872
21827
 
21873
21828
  // src/gleaner-left-role.ts
@@ -21973,7 +21928,7 @@ init_unknown_value();
21973
21928
  init_submission_errors();
21974
21929
  init_worker_submission_contracts();
21975
21930
  import { execFileSync as execFileSync3 } from "node:child_process";
21976
- import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync4 } from "node:fs";
21931
+ import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync3, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync4 } from "node:fs";
21977
21932
  import { resolve as resolve15 } from "node:path";
21978
21933
  var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
21979
21934
  var WORKER_COMMIT_REMINDER_BOUNCE_ENTRY_TYPE = "commit-reminder-bounce";
@@ -22040,12 +21995,12 @@ function rmOwnedDir(dir) {
22040
21995
  const hookPath = resolve15(dir, HOOK_FILE);
22041
21996
  if (!ownedHook(hookPath)) return;
22042
21997
  rmSync4(hookPath, { force: true });
22043
- if (existsSync14(dir) && readdirSync4(dir).length === 0) rmdirSync(dir);
21998
+ if (existsSync14(dir) && readdirSync3(dir).length === 0) rmdirSync(dir);
22044
21999
  }
22045
22000
  function linkedGitDirs(commonDir) {
22046
22001
  const root = resolve15(commonDir, "worktrees");
22047
22002
  if (!existsSync14(root)) return [];
22048
- return readdirSync4(root).map((name) => resolve15(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22003
+ return readdirSync3(root).map((name) => resolve15(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22049
22004
  }
22050
22005
  function uninstallPackageWorkerHooks(cwd) {
22051
22006
  let inside;
@@ -4,8 +4,6 @@ import { INSPECTOR_OUTPUT_TOOL_NAME, validateRecordedInspectorOutput, } from "./
4
4
  export { INSPECTOR_OUTPUT_TOOL_NAME, };
5
5
  export { INSPECTOR_OUTPUT_TOOL_NAME as INSPECTOR_OUTPUT_TOOL };
6
6
  export { validateRecordedInspectorOutput };
7
- /** 台院事后察举交卷形状。 */
8
- export const inspectorOutputSchema = inspectorSubmissionSchema;
9
7
  /**
10
8
  * 决定工具规格。生命周期装配归注册信封 owner——src/role-runtime.ts(ADR 0018)。
11
9
  */
@@ -1,5 +1,5 @@
1
1
  import {} from "./host-contracts.js";
2
- import { REVIEW_QUEUE_STATUSES, reviewSubmissionSchema } from "./review-submission.js";
2
+ import { REVIEW_QUEUE_STATUSES } from "./review-submission.js";
3
3
  import { registerFiledSubmissionTool } from "./filed-submission.js";
4
4
  import { roleSubmissionDeclaration } from "./role-submission-declarations.js";
5
5
  import {} from "./gatekeeper-role.js";
@@ -64,12 +64,6 @@ export async function runJudgeGates(input) {
64
64
  }
65
65
  return { status: "converged", passes };
66
66
  }
67
- // #836 r16 class 1: fix/classes/note/decisionGate are LLM/human-read narrative
68
- // content — 符宝郎/审刑院 read the raw receipt, no code branches on their length
69
- // or nested presence. `status` alone is the machine discriminator the
70
- // queue reads to pick converged/continue/escalate (below).
71
- // The shared open schema preserves role-specific prose without adding another contract.
72
- export const judgeVerdictSchema = reviewSubmissionSchema;
73
67
  export function createJudgeRoleRuntime(pi, dependencies) {
74
68
  let soul;
75
69
  let lifecycleRegistered = false;
@@ -8914,20 +8914,12 @@ var init_worker_output = __esm({
8914
8914
  }
8915
8915
  });
8916
8916
 
8917
- // src/canonical-json.ts
8918
- var init_canonical_json = __esm({
8919
- "src/canonical-json.ts"() {
8920
- "use strict";
8921
- }
8922
- });
8923
-
8924
8917
  // src/doctor-contracts.ts
8925
8918
  var DOCTOR_OUTPUT_TOOL_NAME, DOCTOR_AUDIT_TOOL_NAME, DOCTOR_OUTPUT_TOOL_DESCRIPTION, DOCTOR_TARGET_KINDS, DOCTOR_DISPOSITIONS, DOCTOR_PRESCRIPTION_KINDS, biteActual, biteNone, DOCTOR_BITE_KINDS, DOCTOR_STATUS_DESCRIPTION, doctorSubmissionObject, doctorSubmissionSchema, doctorEvidenceReadSchema;
8926
8919
  var init_doctor_contracts = __esm({
8927
8920
  "src/doctor-contracts.ts"() {
8928
8921
  "use strict";
8929
8922
  init_build();
8930
- init_canonical_json();
8931
8923
  init_open_tool_schema();
8932
8924
  init_terminating_infrastructure();
8933
8925
  init_unknown_value();
@@ -9026,7 +9018,6 @@ var init_countersign_contracts = __esm({
9026
9018
  "src/countersign-contracts.ts"() {
9027
9019
  "use strict";
9028
9020
  init_review_submission();
9029
- init_unknown_value();
9030
9021
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
9031
9022
  }
9032
9023
  });
@@ -9039,7 +9030,6 @@ var init_gleaner_left_contracts = __esm({
9039
9030
  init_build();
9040
9031
  init_open_tool_schema();
9041
9032
  init_terminating_infrastructure();
9042
- init_unknown_value();
9043
9033
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
9044
9034
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
9045
9035
  openToolObject(
@@ -10020,7 +10010,6 @@ var init_institutional_resolution = __esm({
10020
10010
  });
10021
10011
 
10022
10012
  // src/public-cli/config.ts
10023
- var GATE_OFFICER_SEATS;
10024
10013
  var init_config2 = __esm({
10025
10014
  "src/public-cli/config.ts"() {
10026
10015
  "use strict";
@@ -10030,9 +10019,6 @@ var init_config2 = __esm({
10030
10019
  init_packaged_role_registry();
10031
10020
  init_registry();
10032
10021
  init_unknown_value();
10033
- GATE_OFFICER_SEATS = PUBLIC_ROLE_RECORDS.flatMap(
10034
- (record) => "provinceConfig" in record && record.provinceConfig === true ? [record.role] : []
10035
- );
10036
10022
  }
10037
10023
  });
10038
10024
 
@@ -10367,8 +10353,6 @@ var init_terminating_tools = __esm({
10367
10353
  init_auditor_output();
10368
10354
  init_merger_contracts();
10369
10355
  init_notary_contracts();
10370
- init_countersign_contracts();
10371
- init_gleaner_left_contracts();
10372
10356
  init_inspector_contracts();
10373
10357
  init_diarist_contracts();
10374
10358
  init_secretariat_contracts();
@@ -1,4 +1,3 @@
1
- export const NAVIGATOR_ADVICE_MAX_CHARS = 20;
2
1
  const DISPOSE_BY_VERDICT = "按判词处置";
3
2
  const ESCALATE_TO_OWNER = "呈陛下裁决";
4
3
  const DISPATCH_WORKER = "派将作监开工";