@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
@@ -1,4 +1,4 @@
1
- import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, notaryReviewSubmissionSchema } from "./review-submission.js";
1
+ import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.js";
2
2
  import { isRecord } from "./unknown-value.js";
3
3
  const NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
4
4
  const NOTARY_SOURCE_RUN_FLAG = {
@@ -15,18 +15,6 @@ const NOTARY_TICKET_FLAG = {
15
15
  type: "string"
16
16
  }
17
17
  };
18
- const notaryOutputSchema = notaryReviewSubmissionSchema;
19
- function projectLawfulNotaryOutput(value) {
20
- return isRecord(value) ? value : void 0;
21
- }
22
- function retainNotarySubmission(value) {
23
- if (value === void 0) return { missing: "arguments" };
24
- try {
25
- return structuredClone(value);
26
- } catch {
27
- return value;
28
- }
29
- }
30
18
  function validateRecordedNotaryOutput(value) {
31
19
  if (!isRecord(value)) {
32
20
  throw new Error("Notary output is not an object");
@@ -37,8 +25,5 @@ export {
37
25
  NOTARY_OUTPUT_TOOL_NAME,
38
26
  NOTARY_SOURCE_RUN_FLAG,
39
27
  NOTARY_TICKET_FLAG,
40
- notaryOutputSchema,
41
- projectLawfulNotaryOutput,
42
- retainNotarySubmission,
43
28
  validateRecordedNotaryOutput
44
29
  };
@@ -2,10 +2,9 @@
2
2
  * Public Auditor (审刑院) terminating receipt contracts (#675 / #754).
3
3
  * Lawful explicit releases: converged | continue | escalate.
4
4
  */
5
- import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, reviewSubmissionSchema } from "../review-submission.js";
5
+ import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "../review-submission.js";
6
6
  import { isRecord } from "../unknown-value.js";
7
7
  export const AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
8
- export const auditorOutputSchema = reviewSubmissionSchema;
9
8
  /** #836: no field drop — original object is the receipt. */
10
9
  export function projectLawfulAuditorOutput(value) {
11
10
  return isRecord(value) ? value : undefined;
@@ -23,9 +23,6 @@ function asStringArray(value) {
23
23
  if (!Array.isArray(value)) return [];
24
24
  return value.filter((item) => typeof item === "string");
25
25
  }
26
- function projectLawfulGatekeeperOutput(value) {
27
- return isRecord(value) ? value : void 0;
28
- }
29
26
  function validateRecordedGatekeeperOutput(value) {
30
27
  if (!isRecord(value)) throw new Error("Gatekeeper output is not an object");
31
28
  return value;
@@ -34,6 +31,5 @@ export {
34
31
  GATEKEEPER_OUTPUT_TOOL_NAME,
35
32
  gatekeeperDecisionSchema,
36
33
  gatekeeperOutputSchema,
37
- projectLawfulGatekeeperOutput,
38
34
  validateRecordedGatekeeperOutput
39
35
  };
@@ -13,14 +13,12 @@ import { NAVIGATOR_OUTPUT_TOOL_NAME, validateRecordedNavigatorOutput } from "./n
13
13
  import { AUDITOR_OUTPUT_TOOL_NAME, validateRecordedAuditorOutput } from "./auditor-output.js";
14
14
  import { MERGER_OUTPUT_TOOL_NAME, validateMergerOutput } from "../merger-contracts.js";
15
15
  import { NOTARY_OUTPUT_TOOL_NAME, validateRecordedNotaryOutput } from "../notary-contracts.js";
16
- import { COUNTERSIGN_OUTPUT_TOOL_NAME, validateRecordedCountersignOutput } from "../countersign-contracts.js";
17
- import { GLEANER_LEFT_OUTPUT_TOOL_NAME, validateRecordedGleanerLeftOutput } from "../gleaner-left-contracts.js";
18
16
  import { INSPECTOR_OUTPUT_TOOL_NAME, validateRecordedInspectorOutput } from "../inspector-contracts.js";
19
17
  import { DIARIST_OUTPUT_TOOL_NAME, validateRecordedDiaristOutput } from "../diarist-contracts.js";
20
18
  import { SECRETARIAT_OUTPUT_TOOL_NAME } from "../secretariat-contracts.js";
21
19
  import { CODER_OUTPUT_TOOL_NAME, FIXER_OUTPUT_TOOL_NAME, validateAcceptedWorkerDetails, } from "./worker-output.js";
22
20
  import { isRecord } from "../unknown-value.js";
23
- export { CODER_OUTPUT_TOOL_NAME, COLLECTOR_OUTPUT_TOOL, FIXER_OUTPUT_TOOL_NAME, JUDGE_OUTPUT_TOOL_NAME, REVIEWER_OUTPUT_TOOL_NAME, MERGER_OUTPUT_TOOL_NAME, validateReviewerIntent, validateAcceptedWorkerDetails, validateDoctorSubmissionShape, validateRecordedDoctorOutput, validateMergerOutput, validateRecordedNotaryOutput, validateRecordedCountersignOutput, validateRecordedGleanerLeftOutput, validateRecordedInspectorOutput, validateRecordedGatekeeperOutput, validateRecordedNavigatorOutput, validateRecordedAuditorOutput, validateRecordedDiaristOutput, };
21
+ export { CODER_OUTPUT_TOOL_NAME, COLLECTOR_OUTPUT_TOOL, FIXER_OUTPUT_TOOL_NAME, JUDGE_OUTPUT_TOOL_NAME, REVIEWER_OUTPUT_TOOL_NAME, MERGER_OUTPUT_TOOL_NAME, validateReviewerIntent, validateAcceptedWorkerDetails, validateDoctorSubmissionShape, validateRecordedDoctorOutput, validateMergerOutput, validateRecordedNotaryOutput, validateRecordedInspectorOutput, validateRecordedGatekeeperOutput, validateRecordedNavigatorOutput, validateRecordedAuditorOutput, validateRecordedDiaristOutput, };
24
22
  export const TERMINATING_TOOL_NAMES = [...new Set([
25
23
  ...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
26
24
  ...LEGACY_REVIEW_OUTPUT_ROLES.keys(),
@@ -1,4 +1,4 @@
1
- import { existsSync, readdirSync, readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  const ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
4
4
  const ENGINE_DISPATCH_RELATIVE_PATH = "resources/engine-dispatch.md";
@@ -30,12 +30,6 @@ function resolveEngineMaterialDirectory(packageRoot) {
30
30
  function resolveEngineDispatchMaterialPath(packageRoot) {
31
31
  return join(packageRoot, ENGINE_DISPATCH_RELATIVE_PATH);
32
32
  }
33
- function listEngineMaterialNames(packageRoot) {
34
- const dir = resolveEngineMaterialDirectory(packageRoot);
35
- if (!existsSync(dir)) return Object.freeze([]);
36
- const names = readdirSync(dir).filter((entry) => entry.endsWith(".md")).map((entry) => entry.slice(0, -".md".length)).filter((stem) => isEngineNameSyntax(stem)).sort();
37
- return Object.freeze([...names]);
38
- }
39
33
  function resolveEngineMaterialPath(packageRoot, name) {
40
34
  const legal = assertLegalEngineName(name);
41
35
  return join(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
@@ -80,7 +74,6 @@ export {
80
74
  engineSessionMaterialFromOptions,
81
75
  engineSessionReadingMaterial,
82
76
  isEngineNameSyntax,
83
- listEngineMaterialNames,
84
77
  pickEngineAxis,
85
78
  resolveEngineDispatchMaterialPath,
86
79
  resolveEngineMaterialDirectory,
@@ -364,9 +364,6 @@ export function createPiRoleTurnHost(config) {
364
364
  delete env.AK_ROLE_HOST;
365
365
  else
366
366
  env.AK_ROLE_HOST = request.host.trim();
367
- // #1199: 传召词 is unknown-length body — never argv/env (execve ARG_MAX / E2BIG).
368
- // Typed stdin envelope carries dialogue + optional progress 传召词.
369
- delete env.AK_ROLE_SUMMONS_INSTRUCTION;
370
367
  // #1132: the one effective delivery-request ceiling travels to the child
371
368
  // on its own env so the in-child role runtime and the worker submission
372
369
  // gate count with the same configured number the AK seam resolved. Omit
@@ -17,7 +17,7 @@ import { appendPiSessionCustomEntry } from "../pi/role-turn-host.js";
17
17
  import { openRoleSeatRuntime } from "./role-seat-runtime.js";
18
18
  import { formatHostSelectionFailure, HostSelectionError, } from "./role-turn-host-resolution.js";
19
19
  import { admittedSourceRunPath, parseAnalystArgv, parsePublicSeatArgv, } from "./invocation.js";
20
- import { createTypedOptionConsumer, optionsForOwner, projectCommandHelp, projectOwnerOptions, PUBLIC_NAVIGATOR_HELP_NOTE, PUBLIC_ROLE_OPTION_OWNERS, renderHumanOwnerOptionLines, } from "./option-definitions.js";
20
+ import { createTypedOptionConsumer, optionsForOwner, projectCommandHelp, PUBLIC_NAVIGATOR_HELP_NOTE, PUBLIC_ROLE_OPTION_OWNERS, renderHumanOwnerOptionLines, } from "./option-definitions.js";
21
21
  import { TurnDispatchedFailure } from "./auto-resume.js";
22
22
  import { readSessionDialogue, renderSessionDialogue } from "./dialogue-command.js";
23
23
  import { continueParentAfterChild, presentAuditedOriginalOfUnsettledOfficer, runPublicInstructionSeat, runPublicInstructionSeatResume, } from "./instruction-seat-run.js";
@@ -338,32 +338,10 @@ function loadAndValidateConfig(home, packageRoot) {
338
338
  /** Typed facts used by help presentation — not layout. */
339
339
  export function helpDocument() {
340
340
  return {
341
- executable: "ak-role",
342
341
  capabilities: listHelpCapabilities(),
343
342
  internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE,
344
- /** #342 structured global options from the sole option table. */
345
- globalOptions: projectOwnerOptions("global"),
346
343
  };
347
344
  }
348
- /** Structured help facts for one public command/role (#342). */
349
- export function helpDocumentForCommand(command) {
350
- if (command === "global") {
351
- return {
352
- command: "global",
353
- kind: "global",
354
- options: projectOwnerOptions("global"),
355
- };
356
- }
357
- if (command in PUBLIC_ROLE_ARGV) {
358
- const owner = command;
359
- return {
360
- command: owner,
361
- kind: owner === "analyst" ? "deterministic" : "role",
362
- options: projectOwnerOptions(owner),
363
- };
364
- }
365
- return undefined;
366
- }
367
345
  /** Append USAGE + EXAMPLES blocks from the sole public help-copy owner. */
368
346
  function appendUsageAndExamples(lines, topic) {
369
347
  const facts = projectCommandHelp(topic);
@@ -20,9 +20,6 @@ import {
20
20
  seatModelOnly
21
21
  } from "./registry.js";
22
22
  import { isEnoent, isRecord } from "../unknown-value.js";
23
- const GATE_OFFICER_SEATS = PUBLIC_ROLE_RECORDS.flatMap(
24
- (record) => "provinceConfig" in record && record.provinceConfig === true ? [record.role] : []
25
- );
26
23
  function isGateOfficerSeat(value) {
27
24
  return packagedProvinceConfig(value);
28
25
  }
@@ -502,7 +499,6 @@ async function loadCredentialProviders(agentDir) {
502
499
  }
503
500
  }
504
501
  export {
505
- GATE_OFFICER_SEATS,
506
502
  buildSeatModelCliArgs,
507
503
  clearPersistentSeatConfig,
508
504
  credentialProvidersFromAuthData,
@@ -433,10 +433,6 @@ function rejectUnlessTicketNumber(raw, message) {
433
433
  throw new CliUsageError(message);
434
434
  return parsed;
435
435
  }
436
- /** Positive ticket number for analyst query-scope face (and shared integer parse). */
437
- export function parsePositiveTicketNumber(raw, flag) {
438
- return rejectUnlessTicketNumber(raw, `${flag} must be a positive integer, got ${raw}`);
439
- }
440
436
  /**
441
437
  * One token scan for public argv.
442
438
  * Callers assign values; `--` still ends flag parsing.
@@ -9404,20 +9404,12 @@ var init_worker_output = __esm({
9404
9404
  }
9405
9405
  });
9406
9406
 
9407
- // src/canonical-json.ts
9408
- var init_canonical_json = __esm({
9409
- "src/canonical-json.ts"() {
9410
- "use strict";
9411
- }
9412
- });
9413
-
9414
9407
  // src/doctor-contracts.ts
9415
9408
  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;
9416
9409
  var init_doctor_contracts = __esm({
9417
9410
  "src/doctor-contracts.ts"() {
9418
9411
  "use strict";
9419
9412
  init_build();
9420
- init_canonical_json();
9421
9413
  init_open_tool_schema();
9422
9414
  init_terminating_infrastructure();
9423
9415
  init_unknown_value();
@@ -9559,7 +9551,6 @@ var init_countersign_contracts = __esm({
9559
9551
  "src/countersign-contracts.ts"() {
9560
9552
  "use strict";
9561
9553
  init_review_submission();
9562
- init_unknown_value();
9563
9554
  COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
9564
9555
  }
9565
9556
  });
@@ -9572,7 +9563,6 @@ var init_gleaner_left_contracts = __esm({
9572
9563
  init_build();
9573
9564
  init_open_tool_schema();
9574
9565
  init_terminating_infrastructure();
9575
- init_unknown_value();
9576
9566
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
9577
9567
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
9578
9568
  openToolObject(
@@ -10532,7 +10522,6 @@ var init_host_descriptions = __esm({
10532
10522
  // src/public-cli/config.ts
10533
10523
  var config_exports = {};
10534
10524
  __export(config_exports, {
10535
- GATE_OFFICER_SEATS: () => GATE_OFFICER_SEATS,
10536
10525
  buildSeatModelCliArgs: () => buildSeatModelCliArgs,
10537
10526
  clearPersistentSeatConfig: () => clearPersistentSeatConfig,
10538
10527
  credentialProvidersFromAuthData: () => credentialProvidersFromAuthData,
@@ -11039,7 +11028,6 @@ async function loadCredentialProviders(agentDir) {
11039
11028
  throw error;
11040
11029
  }
11041
11030
  }
11042
- var GATE_OFFICER_SEATS;
11043
11031
  var init_config2 = __esm({
11044
11032
  "src/public-cli/config.ts"() {
11045
11033
  "use strict";
@@ -11049,9 +11037,6 @@ var init_config2 = __esm({
11049
11037
  init_packaged_role_registry();
11050
11038
  init_registry();
11051
11039
  init_unknown_value();
11052
- GATE_OFFICER_SEATS = PUBLIC_ROLE_RECORDS.flatMap(
11053
- (record) => "provinceConfig" in record && record.provinceConfig === true ? [record.role] : []
11054
- );
11055
11040
  }
11056
11041
  });
11057
11042
 
@@ -12932,8 +12917,6 @@ var init_terminating_tools = __esm({
12932
12917
  init_auditor_output();
12933
12918
  init_merger_contracts();
12934
12919
  init_notary_contracts();
12935
- init_countersign_contracts();
12936
- init_gleaner_left_contracts();
12937
12920
  init_inspector_contracts();
12938
12921
  init_diarist_contracts();
12939
12922
  init_secretariat_contracts();
@@ -13530,20 +13513,20 @@ function isCodexOwnerResponseItemUser(message) {
13530
13513
  if (kinds === void 0) return false;
13531
13514
  return kinds.some((kind) => kind.startsWith("user."));
13532
13515
  }
13533
- function fromQueueEvent(row) {
13534
- if (row.type !== "queue-operation" || row.operation !== "enqueue") return [];
13535
- const content = row.content;
13536
- if (typeof content !== "string" || content === "") return [];
13537
- const id = nativeEventId(row);
13538
- return [{ speaker: "owner", text: content, ...id === void 0 ? {} : { id } }];
13539
- }
13540
13516
  function hasFixedOpenTagPrefix(content, tag) {
13541
13517
  if (!content.startsWith(tag)) return false;
13542
13518
  const next = content.charAt(tag.length);
13543
13519
  return next === "" || next === ">" || next === " " || next === " " || next === "\n" || next === "\r";
13544
13520
  }
13545
- function isFixedNonOwnerEnqueueShape(content) {
13546
- return hasFixedOpenTagPrefix(content, TASK_NOTIFICATION_OPEN_TAG);
13521
+ function fromQueuedCommandAttachment(row) {
13522
+ if (!isRecord(row.attachment) || row.attachment.type !== "queued_command") return [];
13523
+ const kind = materializationOriginKind(row.attachment);
13524
+ if (isNonOwnerOriginKind(kind)) return [];
13525
+ const text = textParts(row.attachment.prompt).join("");
13526
+ if (text === "") return [];
13527
+ if (kind === void 0 && hasFixedOpenTagPrefix(text, TASK_NOTIFICATION_OPEN_TAG)) return [];
13528
+ const id = nativeEventId(row);
13529
+ return [{ speaker: "owner", text, ...id === void 0 ? {} : { id } }];
13547
13530
  }
13548
13531
  function materializationOriginKind(row) {
13549
13532
  if (!isRecord(row.origin)) return void 0;
@@ -13573,13 +13556,10 @@ function fromMessageEvent(row) {
13573
13556
  function adaptSessionDialogue(rows) {
13574
13557
  return rows.map((row) => {
13575
13558
  if (row === void 0) return [];
13559
+ if (row.type === "queue-operation" || row.type === "api-request-blob") return [];
13560
+ if (row.type === "attachment") return fromQueuedCommandAttachment(row);
13576
13561
  const originKind = materializationOriginKind(row);
13577
13562
  if (isNonOwnerOriginKind(originKind)) return [];
13578
- if (row.type === "queue-operation" && row.operation === "enqueue" && typeof row.content === "string" && isFixedNonOwnerEnqueueShape(row.content)) {
13579
- return [];
13580
- }
13581
- const queued = fromQueueEvent(row);
13582
- if (queued.length > 0) return queued;
13583
13563
  return fromMessageEvent(row);
13584
13564
  });
13585
13565
  }
@@ -18356,7 +18336,6 @@ function createPiRoleTurnHost(config) {
18356
18336
  else env.AK_ROLE_INVOCATION_SCOPE = request.invocationScopeId;
18357
18337
  if (request.host === void 0 || request.host.trim() === "") delete env.AK_ROLE_HOST;
18358
18338
  else env.AK_ROLE_HOST = request.host.trim();
18359
- delete env.AK_ROLE_SUMMONS_INSTRUCTION;
18360
18339
  if (request.deliveryRequestLimit === void 0) delete env[RECEIPT_DELIVERY_LIMIT_ENV];
18361
18340
  else env[RECEIPT_DELIVERY_LIMIT_ENV] = String(request.deliveryRequestLimit);
18362
18341
  applyEngineChildEnv(env, request.engine);
@@ -32471,7 +32450,6 @@ __export(cli_exports, {
32471
32450
  buildExplicitInternalActivationArgs: () => buildExplicitInternalActivationArgs,
32472
32451
  commandNeedsProcessCancel: () => commandNeedsProcessCancel,
32473
32452
  helpDocument: () => helpDocument,
32474
- helpDocumentForCommand: () => helpDocumentForCommand,
32475
32453
  projectConfigDisplaySeats: () => projectConfigDisplaySeats,
32476
32454
  projectConfigSeatDisplay: () => projectConfigSeatDisplay,
32477
32455
  resolveInternalRoleEntrypoint: () => resolveInternalRoleEntrypoint,
@@ -32752,31 +32730,10 @@ function loadAndValidateConfig(home, packageRoot2) {
32752
32730
  }
32753
32731
  function helpDocument() {
32754
32732
  return {
32755
- executable: "ak-role",
32756
32733
  capabilities: listHelpCapabilities(),
32757
- internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE,
32758
- /** #342 structured global options from the sole option table. */
32759
- globalOptions: projectOwnerOptions("global")
32734
+ internalEntrypoint: INTERNAL_ROLE_ENTRYPOINT_RELATIVE
32760
32735
  };
32761
32736
  }
32762
- function helpDocumentForCommand(command) {
32763
- if (command === "global") {
32764
- return {
32765
- command: "global",
32766
- kind: "global",
32767
- options: projectOwnerOptions("global")
32768
- };
32769
- }
32770
- if (command in PUBLIC_ROLE_ARGV) {
32771
- const owner = command;
32772
- return {
32773
- command: owner,
32774
- kind: owner === "analyst" ? "deterministic" : "role",
32775
- options: projectOwnerOptions(owner)
32776
- };
32777
- }
32778
- return void 0;
32779
- }
32780
32737
  function appendUsageAndExamples(lines, topic) {
32781
32738
  const facts = projectCommandHelp(topic);
32782
32739
  if (facts === void 0) return;
@@ -898,14 +898,6 @@ export function projectOwnerOptions(owner) {
898
898
  description: def.description,
899
899
  }));
900
900
  }
901
- /** All rejected spelling tokens flattened (for leakage scans). */
902
- export function allRejectedSpellingTokens() {
903
- const out = [];
904
- for (const entry of REJECTED_PUBLIC_SPELLINGS) {
905
- out.push(...entry.spellings);
906
- }
907
- return out;
908
- }
909
901
  /**
910
902
  * Top-level public help short note for Navigator automatic attendance (#639:
911
903
  * attendance is orthogonal to callability — the direct command face lives on
@@ -89,26 +89,12 @@ function isCodexOwnerResponseItemUser(message) {
89
89
  return false;
90
90
  return kinds.some((kind) => kind.startsWith("user."));
91
91
  }
92
- /**
93
- * 入队事件适配:人类这次输入经队列的来源。
94
- * 被吸收的插话靠入队事件入录(无独立消息记录,#901 用户故事 11)。
95
- * 机器入队由整卷适配层排除(#918);本函数不读正文、不自判机器。
96
- */
97
- function fromQueueEvent(row) {
98
- if (row.type !== "queue-operation" || row.operation !== "enqueue")
99
- return [];
100
- const content = row.content;
101
- if (typeof content !== "string" || content === "")
102
- return [];
103
- const id = nativeEventId(row);
104
- return [{ speaker: "owner", text: content, ...(id === undefined ? {} : { id }) }];
105
- }
106
92
  /**
107
93
  * 票面 #918 准许的唯一固定起始形状:`<task-notification`。
108
94
  * 其它标签不在御裁射程内——不得扩表,不得伪造 decision key / 「陛下拍定」。
109
95
  * 开标签后可直接 `>`(无属性)、EOF 或空白再接属性;其它字符不成立。
110
96
  *
111
- * 机器 enqueue 的完整判据=结构化来源(origin.kind)/本固定形状/真实因果与位置;
97
+ * 无 origin 的 `queued_command` 只靠本固定形状排除;不得扩表。
112
98
  * 用可变载荷正文(全等或子串)做 identity join 仍为锚定宪法所禁。
113
99
  */
114
100
  const TASK_NOTIFICATION_OPEN_TAG = "<task-notification";
@@ -123,9 +109,24 @@ function hasFixedOpenTagPrefix(content, tag) {
123
109
  next === "\n" ||
124
110
  next === "\r");
125
111
  }
126
- /** enqueue.content 是否以票面准许的 `<task-notification` 固定开标签起头。 */
127
- function isFixedNonOwnerEnqueueShape(content) {
128
- return hasFixedOpenTagPrefix(content, TASK_NOTIFICATION_OPEN_TAG);
112
+ /**
113
+ * 被吸收的中途插话取 `queued_command` 附件原文(#1260)。
114
+ * 来源按附件 `origin.kind` 判;缺 origin 就当真人,只排除固定开头。
115
+ * 入队行不再是来源,本函数不读入队行、不做正文比对。
116
+ */
117
+ function fromQueuedCommandAttachment(row) {
118
+ if (!isRecord(row.attachment) || row.attachment.type !== "queued_command")
119
+ return [];
120
+ const kind = materializationOriginKind(row.attachment);
121
+ if (isNonOwnerOriginKind(kind))
122
+ return [];
123
+ const text = textParts(row.attachment.prompt).join("");
124
+ if (text === "")
125
+ return [];
126
+ if (kind === undefined && hasFixedOpenTagPrefix(text, TASK_NOTIFICATION_OPEN_TAG))
127
+ return [];
128
+ const id = nativeEventId(row);
129
+ return [{ speaker: "owner", text, ...(id === undefined ? {} : { id }) }];
129
130
  }
130
131
  /**
131
132
  * 物化 user 行上的结构化来源 kind(CC top-level `origin.kind`)。不读正文。
@@ -149,7 +150,7 @@ function isNonOwnerOriginKind(kind) {
149
150
  return kind !== "human";
150
151
  }
151
152
  /**
152
- * 消息事件适配:助手回话,以及未经入队事件记录的人类输入。
153
+ * 消息事件适配:助手回话,以及 `type=user` 的人类输入。
153
154
  * 思考块、工具调用块、工具结果块按块排除;同消息的说话人 text 保留
154
155
  * (#901 排除按来源不按正文;混合块不得整条丢弃)。
155
156
  * Codex response_item user:仅 `content_item_kinds` 含 `user.*` 时入录。
@@ -181,26 +182,21 @@ function fromMessageEvent(row) {
181
182
  /**
182
183
  * 整卷适配:返回与入参行等长的对话事实数组(该行不是对话则为空数组)。
183
184
  *
185
+ * 说话来源只取 `type=user` 行与 `queued_command` 附件。入队行与 `api-request-blob`
186
+ * 不投。有原生 id 则带上,不另编。不做正文比对或 id 去重。
184
187
  * 物化 user 只消费自身的 typed `origin.kind`:human 保留,具名非 human 排除。
185
- * enqueue 没有与物化 user 的 typed 关联,故不得以位置把某个 user 来源反扣给它;
186
- * 仅票面准许的 `<task-notification` 固定形状可直接排除,其余维持既有投影。
187
188
  */
188
189
  export function adaptSessionDialogue(rows) {
189
190
  return rows.map((row) => {
190
191
  if (row === undefined)
191
192
  return [];
193
+ if (row.type === "queue-operation" || row.type === "api-request-blob")
194
+ return [];
195
+ if (row.type === "attachment")
196
+ return fromQueuedCommandAttachment(row);
192
197
  const originKind = materializationOriginKind(row);
193
198
  if (isNonOwnerOriginKind(originKind))
194
199
  return [];
195
- if (row.type === "queue-operation" &&
196
- row.operation === "enqueue" &&
197
- typeof row.content === "string" &&
198
- isFixedNonOwnerEnqueueShape(row.content)) {
199
- return [];
200
- }
201
- const queued = fromQueueEvent(row);
202
- if (queued.length > 0)
203
- return queued;
204
200
  return fromMessageEvent(row);
205
201
  });
206
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.5949",
3
+ "version": "0.1.6011",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,6 @@ const entries = [
30
30
  "role-run-placement",
31
31
  // Static import of role-run-placement (safe-positive ticket invariant).
32
32
  "run-ticket-number",
33
- "canonical-json",
34
33
  "compliance-transport",
35
34
  "countersign-contracts",
36
35
  "secretariat-contracts",
@@ -5,8 +5,7 @@
5
5
  * is defaulted, rewritten, or dropped (ADR 0055).
6
6
  */
7
7
 
8
- import { REVIEW_QUEUE_STATUSES, REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.ts";
9
- import { isRecord } from "./unknown-value.ts";
8
+ import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.ts";
10
9
 
11
10
  export const COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
12
11
 
@@ -24,22 +23,3 @@ export type CountersignVerdict =
24
23
  note?: string;
25
24
  evidence?: unknown;
26
25
  };
27
-
28
- export function validateRecordedCountersignOutput(verdict: unknown): CountersignVerdict {
29
- if (!isRecord(verdict)) {
30
- throw new Error("Countersign verdict has no execution discriminator");
31
- }
32
- let status: unknown;
33
- try {
34
- status = (verdict as Record<string, unknown>).status;
35
- } catch {
36
- throw new Error("Countersign verdict has no execution discriminator");
37
- }
38
- if (typeof status !== "string") {
39
- throw new Error("Countersign verdict has no execution discriminator");
40
- }
41
- if (REVIEW_QUEUE_STATUSES.has(status)) {
42
- return verdict as CountersignVerdict;
43
- }
44
- throw new Error("Countersign verdict has no execution discriminator");
45
- }
@@ -1,10 +1,5 @@
1
- import { reviewSubmissionSchema } from "./review-submission.ts";
2
1
  import { roleSubmissionDeclaration } from "./role-submission-declarations.ts";
3
- import {
4
- COUNTERSIGN_OUTPUT_TOOL_NAME,
5
- validateRecordedCountersignOutput,
6
- type CountersignVerdict,
7
- } from "./countersign-contracts.ts";
2
+ import type { CountersignVerdict } from "./countersign-contracts.ts";
8
3
 
9
4
  export { COUNTERSIGN_OUTPUT_TOOL_NAME } from "./countersign-contracts.ts";
10
5
  export type { CountersignVerdict };
@@ -13,8 +8,6 @@ export type { CountersignVerdict };
13
8
  // no code branches on their length or nested presence. `status` alone is the
14
9
  // machine discriminator the queue reads.
15
10
  // #1055: the three-state field is an enum+required host generation constraint.
16
- /** 给事中票庭审读五问的交卷形状(ADR 0074);形状指引,非 schema 闸。 */
17
- export const countersignVerdictSchema = reviewSubmissionSchema;
18
11
  export type CountersignVerdictParameters = import("./review-submission.ts").ReviewSubmission;
19
12
 
20
13
  export type CountersignRuntimeDependencies = {
@@ -1,5 +1,4 @@
1
1
  import { Type } from "typebox";
2
- import { canonicalJson } from "./canonical-json.ts";
3
2
  import { openToolObject } from "./open-tool-schema.ts";
4
3
  import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.ts";
5
4
 
@@ -8,7 +8,6 @@ import { Type } from "typebox";
8
8
 
9
9
  import { openToolObject } from "./open-tool-schema.ts";
10
10
  import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.ts";
11
- import { isRecord } from "./unknown-value.ts";
12
11
 
13
12
  export const GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
14
13
 
@@ -52,19 +51,3 @@ export type GleanerLeftOutput = {
52
51
  readonly status: "completed";
53
52
  readonly findings: readonly GleanerLeftFinding[];
54
53
  };
55
-
56
- export function validateRecordedGleanerLeftOutput(value: unknown): GleanerLeftOutput {
57
- if (!isRecord(value)) {
58
- throw new Error("Gleaner-left output has no execution discriminator");
59
- }
60
- let status: unknown;
61
- try {
62
- status = (value as Record<string, unknown>).status;
63
- } catch {
64
- throw new Error("Gleaner-left output has no execution discriminator");
65
- }
66
- if (status === "completed") {
67
- return value as GleanerLeftOutput;
68
- }
69
- throw new Error("Gleaner-left output has no execution discriminator");
70
- }
@@ -3,7 +3,6 @@ import type { Static } from "typebox";
3
3
  import {
4
4
  GLEANER_LEFT_OUTPUT_TOOL_NAME,
5
5
  gleanerLeftOutputSchema,
6
- validateRecordedGleanerLeftOutput,
7
6
  type GleanerLeftOutput,
8
7
  } from "./gleaner-left-contracts.ts";
9
8
  import { roleSubmissionDeclaration } from "./role-submission-declarations.ts";
@@ -13,7 +12,6 @@ export {
13
12
  gleanerLeftOutputSchema,
14
13
  } from "./gleaner-left-contracts.ts";
15
14
  export type { GleanerLeftOutput };
16
- export { validateRecordedGleanerLeftOutput };
17
15
 
18
16
  export type GleanerLeftOutputParameters = Static<typeof gleanerLeftOutputSchema>;
19
17
 
@@ -15,9 +15,7 @@ export type { InspectorOutput };
15
15
  export { validateRecordedInspectorOutput };
16
16
 
17
17
  /** 台院事后察举交卷形状。 */
18
- export const inspectorOutputSchema = inspectorSubmissionSchema;
19
-
20
- export type InspectorOutputParameters = Static<typeof inspectorOutputSchema>;
18
+ export type InspectorOutputParameters = Static<typeof inspectorSubmissionSchema>;
21
19
 
22
20
  export type InspectorRuntimeDependencies = {
23
21
  loadSoul(): Promise<string>;
package/src/judge-role.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type RoleHost } from "./host-contracts.ts";
2
- import { REVIEW_QUEUE_STATUSES, reviewSubmissionSchema, type ReviewQueueWord } from "./review-submission.ts";
2
+ import { REVIEW_QUEUE_STATUSES, type ReviewQueueWord } from "./review-submission.ts";
3
3
  import { registerFiledSubmissionTool } from "./filed-submission.ts";
4
4
  import { roleSubmissionDeclaration } from "./role-submission-declarations.ts";
5
5
  import { type GatekeeperSubject } from "./gatekeeper-role.ts";
@@ -110,8 +110,6 @@ export async function runJudgeGates(input: {
110
110
  // content — 符宝郎/审刑院 read the raw receipt, no code branches on their length
111
111
  // or nested presence. `status` alone is the machine discriminator the
112
112
  // queue reads to pick converged/continue/escalate (below).
113
- // The shared open schema preserves role-specific prose without adding another contract.
114
- export const judgeVerdictSchema = reviewSubmissionSchema;
115
113
 
116
114
  export type JudgeRoleDependencies = {
117
115
  loadSoul(): Promise<string>;
@@ -17,8 +17,6 @@ import type { ReviewerIntent } from "./package-contracts/reviewer-output.ts";
17
17
  import type { CoderOutput } from "./package-contracts/worker-output.ts";
18
18
  import type { ReviewQueueWord } from "./review-submission.ts";
19
19
 
20
- export const NAVIGATOR_ADVICE_MAX_CHARS = 20;
21
-
22
20
  const DISPOSE_BY_VERDICT = "按判词处置";
23
21
  const ESCALATE_TO_OWNER = "呈陛下裁决";
24
22
  const DISPATCH_WORKER = "派将作监开工";