@akagilnc/pi-workflow-roles 0.1.5068 → 0.1.5079

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.
@@ -20,7 +20,8 @@ import type { SitianRecord } from "./sitian-contracts.ts";
20
20
  import { findRunDirectoryById } from "./public-cli/run-lifecycle.ts";
21
21
  import type { TerminalRoleName } from "./public-cli/terminal.ts";
22
22
  import { isCorrectableExecuteError } from "./submission-correctable-error.ts";
23
- import { failOnInfrastructureFailureDeclaration } from "./package-contracts/terminating-infrastructure.ts";
23
+ import { failOnInfrastructureFailureDeclaration, infrastructureFailureDiagnostic } from "./package-contracts/terminating-infrastructure.ts";
24
+ import { REVIEW_SUBMISSION_OUTPUT_TOOL_NAME } from "./review-submission.ts";
24
25
 
25
26
  export type SubmissionCall = { readonly id: string; readonly name: string };
26
27
  export type SubmissionOutcomeKind = "correctable-rejection" | "audit-escalation" | "infrastructure";
@@ -678,17 +679,28 @@ export function createSubmissionLedgerHost(
678
679
  });
679
680
  let result: HostToolResult<unknown>;
680
681
  try {
681
- failOnInfrastructureFailureDeclaration(
682
- params,
683
- {
684
- failInfrastructure(error, ctx) {
685
- failInfrastructure(error, ctx);
682
+ // A review escalate that carries the failure declaration is the
683
+ // seat's own submission. Every other declaration stays on the
684
+ // host-failure seam. Tool identity comes from the registry map.
685
+ const reviewEscalate = tool.name === REVIEW_SUBMISSION_OUTPUT_TOOL_NAME
686
+ && infrastructureFailureDiagnostic(params) !== undefined
687
+ && params !== null
688
+ && typeof params === "object"
689
+ && !Array.isArray(params)
690
+ && (params as Record<string, unknown>).status === "escalate";
691
+ if (!reviewEscalate) {
692
+ failOnInfrastructureFailureDeclaration(
693
+ params,
694
+ {
695
+ failInfrastructure(error, ctx) {
696
+ failInfrastructure(error, ctx);
697
+ },
686
698
  },
687
- },
688
- context,
689
- toolCallId,
690
- tool.bounceInfrastructureDeclaration,
691
- );
699
+ context,
700
+ toolCallId,
701
+ tool.bounceInfrastructureDeclaration,
702
+ );
703
+ }
692
704
  result = await tool.execute(toolCallId, params, signal, update, context);
693
705
  } catch (error) {
694
706
  if (isCorrectableExecuteError(error)) {
@@ -5,7 +5,7 @@ import { withTerminatingOutputDeclarations } from "./package-contracts/terminati
5
5
 
6
6
  import { readableGateItem } from "./readable-gate-item.ts";
7
7
  import { projectGatekeeperEscalation } from "./audit-escalation.ts";
8
- import { GatekeeperDecisionError, ParentQueueReaskError } from "./submission-errors.ts";
8
+ import { GatekeeperDecisionError, ParentQueueReaskError, unreadableDiscriminatorNotice } from "./submission-errors.ts";
9
9
  import {
10
10
  CODER_OUTPUT_TOOL_NAME,
11
11
  FIXER_OUTPUT_TOOL_NAME,
@@ -44,8 +44,8 @@ export type { WorkerOutput };
44
44
  // no code branches on their length. `reason` alone keeps minLength: the worker
45
45
  // gate reads `reason.trim().length > 0` to pick typed-reminder-bounce vs accept
46
46
  // (src/worker-submission-gates.ts:159-163,297-302).
47
- // #836 (ADR 0003 Amendment): status kept open like countersignStatus
48
- // (src/countersign-role.ts) — one shared description across every variant
47
+ // Worker status is not the review three-state field (#1055): schema stays open.
48
+ // One shared description across every variant
49
49
  // so openToolObjectFromUnion's identical-declaration collapse drops none of it.
50
50
  const CODER_STATUS_DESCRIPTION =
51
51
  "planned | completed | refused | partially_completed | unfinished — 形状指引,非 schema 闸;completed 回执含 TDD、同模式、引入回归、行为事实四项证据;unfinished 缺前置或违宪约束致本局未完成时可用,缺待决 owner 决定或答复属缺前置。" as const;
@@ -135,8 +135,6 @@ const WORKER_ROUTING_STATUSES = new Set([
135
135
  "partially_completed",
136
136
  "unfinished",
137
137
  ]);
138
- const WORKER_STATUS_REASK =
139
- "status 不是 planned、completed、refused、partially_completed、unfinished 之一。请重新交卷,status 写明其一。" as const;
140
138
 
141
139
  /** Read only the field that selects the worker's next package-owned path. */
142
140
  function workerStatusOf(output: WorkerOutput): string | undefined {
@@ -148,7 +146,7 @@ function workerStatusOf(output: WorkerOutput): string | undefined {
148
146
  function requireReadableWorkerStatus(output: WorkerOutput): string {
149
147
  const status = workerStatusOf(output);
150
148
  if (status === undefined || !WORKER_ROUTING_STATUSES.has(status)) {
151
- throw new ParentQueueReaskError(WORKER_STATUS_REASK);
149
+ throw new ParentQueueReaskError(unreadableDiscriminatorNotice("status", isRecord(output) ? output.status : undefined));
152
150
  }
153
151
  return status;
154
152
  }