@akagilnc/pi-workflow-roles 0.1.5756 → 0.1.5775

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.
@@ -86,15 +86,6 @@ export type RoleRunRecord = {
86
86
  readonly phase?: CoderPhase | FixerPhase;
87
87
  };
88
88
 
89
- /**
90
- * Package-owned non-empty Chinese neutral resume transport (#959 / ADR 0073).
91
- * Used by:
92
- * - auto-resume (all seats via buildAutoResumeContinuationPrompt) — required so
93
- * hosts that reject empty stdin (codex) still receive a prompt.
94
- * Public manual resume forwards only the caller's bytes (#987).
95
- */
96
- export const RESUME_TRANSPORT_ENVELOPE = "继续。" as const;
97
-
98
89
  /** Public manual resume request after the unique CLI parser owns runId + optional message. */
99
90
  export type PublicResumeRequest = {
100
91
  readonly runId: string;
@@ -139,16 +130,6 @@ export type SameTicketSummonsMaterials = {
139
130
  readonly sourceRun?: NotarySourceRunLocator;
140
131
  };
141
132
 
142
- /**
143
- * Auto-resume continuation only (#959 / ADR 0080).
144
- * Always non-empty Chinese neutral envelope. Engine / outsourcing material
145
- * rides startup readingMaterial (#1167), never this continuation.
146
- * Never call this from manual `ak-role resume`.
147
- */
148
- export function buildAutoResumeContinuationPrompt(): string {
149
- return RESUME_TRANSPORT_ENVELOPE;
150
- }
151
-
152
133
  const WRITER_LOCK_FILE = "writer.lock";
153
134
 
154
135
  export async function writeRoleRunState(
@@ -723,21 +723,19 @@ export async function summonGateOfficer(options: {
723
723
  }
724
724
  // Officer host is seat-owned only (#821), not a parent override channel.
725
725
  // #879: binding pointer = parent run directory; dialogue content = submission body.
726
- // Conclusion re-ask keeps sole ownership of reviewReask when present.
727
- // #1195 ticket-court notary (countersign source): do not preload the parent body.
728
- // Identity binds via --source-run; the notary reads the ticket and verdict itself
729
- // and its dispatch comes from resolveReviewSeatDialogueBody.
730
- // Other officers / non-countersign sources still receive the parent submission body.
726
+ // Conclusion re-ask owns reviewReask when present (no parallel gate body).
727
+ // #1208: notary never preloads parent body; review dialogue is the fixed
728
+ // dispatch from resolveReviewSeatDialogueBody. Named operational reasks
729
+ // ride reviewReask here (or the resume message seam elsewhere). Other
730
+ // officers still receive the parent submission body when reask is absent.
731
731
  let gateReviewInstruction: string | undefined;
732
- if (options.reask === undefined && options.submission !== undefined) {
733
- const { isTicketCourtCountersignSource } = await import("./run-terminal-artifacts.ts");
734
- const blindTicketCourt =
735
- options.officer === "notary"
736
- && isTicketCourtCountersignSource(options.sourceRunDirectory);
737
- if (!blindTicketCourt) {
738
- const { readableGateItem } = await import("./readable-gate-item.ts");
739
- gateReviewInstruction = readableGateItem(options.submission);
740
- }
732
+ if (
733
+ options.reask === undefined
734
+ && options.submission !== undefined
735
+ && options.officer !== "notary"
736
+ ) {
737
+ const { readableGateItem } = await import("./readable-gate-item.ts");
738
+ gateReviewInstruction = readableGateItem(options.submission);
741
739
  }
742
740
  const { runIdFromRunDirectory } = await import("./run-terminal-artifacts.ts");
743
741
  const parentRunId = runIdFromRunDirectory(options.sourceRunDirectory);
@@ -805,8 +803,21 @@ export async function summonGateOfficer(options: {
805
803
  ? (options.submission as { ticketNumber?: unknown }).ticketNumber
806
804
  : undefined;
807
805
  const courtTicket = isSafePositiveTicketNumber(submittedTicket) ? submittedTicket : parentTicket;
808
- // Argv instruction = reask or parent payload bytes only (never a fabricated line).
809
- const instruction = options.reask ?? gateReviewInstruction ?? "";
806
+ // #1208 C1: argv dialogue from the same shared resolver as every other seat
807
+ // (never a parallel reask/gate/empty choice here). Request-field wiring of
808
+ // reviewReask / gateReviewInstruction onto env stays field assembly only.
809
+ // Terminal "" only when the resolver itself has no body — not a third source.
810
+ const { resolveReviewSeatDialogueBody } = await import("./public-cli/instruction-seat-run.ts");
811
+ const instruction =
812
+ (await resolveReviewSeatDialogueBody({
813
+ role: options.officer,
814
+ ...(options.reask === undefined ? {} : { reviewReask: options.reask }),
815
+ ...(gateReviewInstruction === undefined
816
+ ? {}
817
+ : { gateReviewInstruction }),
818
+ projectRoot: options.cwd,
819
+ home,
820
+ })) ?? "";
810
821
  return summonPublicRole({
811
822
  role: options.officer,
812
823
  argv: ["--project", options.cwd, "--", instruction],
@@ -1078,6 +1078,8 @@ export function createRoleRuntimeExtension(
1078
1078
  // #1132: one ceiling for this turn, closed over from the execution seam.
1079
1079
  let receiptDelivery = createReceiptDeliveryPolicy(deliveryLimit);
1080
1080
  let noReceiptRecorded = false;
1081
+ /** #1208: this-turn dialogue bytes from before_agent_start for receipt催交 resend. */
1082
+ let turnDialoguePrompt: string | undefined;
1081
1083
  /** Envelope-owned: abort/teardown attendance without re-blocking the parent court (#959). */
1082
1084
  const disposeNavigatorAttendanceNonBlocking = (
1083
1085
  attendance: NavigatorAttendanceDependency | undefined,
@@ -1182,6 +1184,8 @@ export function createRoleRuntimeExtension(
1182
1184
  roleHost.on("before_agent_start", async (event, ctx) => {
1183
1185
  const role = roleHost.getFlag(ROLE_FLAG.name);
1184
1186
  const prompt = event.prompt;
1187
+ // #1208: each before_agent_start carries this turn's actual prompt (incl. empty).
1188
+ if (typeof prompt === "string") turnDialoguePrompt = prompt;
1185
1189
  if (role === undefined) return;
1186
1190
  if (!admitted || selectedRole !== role) {
1187
1191
  failInfrastructure(new ActivationBarrierError(role), ctx);
@@ -1373,6 +1377,7 @@ export function createRoleRuntimeExtension(
1373
1377
  receiptDelivery.recordDeliveryRequest();
1374
1378
  // Keep the package-owned continuation off the public input lifecycle:
1375
1379
  // receipt delivery must not be mistaken for later caller input.
1380
+ // #1208: resend this turn's actual dialogue; stats stay on policy/lifecycle.
1376
1381
  const scopeId = ctx.invocationScopeId?.trim() ?? "";
1377
1382
  envelopeHost.appendEntry(
1378
1383
  RECEIPT_DELIVERY_REQUEST_ENTRY,
@@ -1388,7 +1393,7 @@ export function createRoleRuntimeExtension(
1388
1393
  });
1389
1394
  envelopeHost.sendMessage({
1390
1395
  customType: "ak-receipt-delivery-prompt",
1391
- content: JSON.stringify(receiptDelivery.deliveryState()),
1396
+ content: turnDialoguePrompt ?? "",
1392
1397
  display: false,
1393
1398
  }, { triggerTurn: true, deliverAs: "followUp" });
1394
1399
  } else if (receiptDelivery.nextAction() === "no-receipt" && !noReceiptRecorded) {
@@ -1644,6 +1649,7 @@ export function createRoleRuntimeExtension(
1644
1649
  activeCollector = undefined;
1645
1650
  receiptDelivery = createReceiptDeliveryPolicy(deliveryLimit);
1646
1651
  noReceiptRecorded = false;
1652
+ turnDialoguePrompt = undefined;
1647
1653
  pendingNavigatorPresentation = undefined;
1648
1654
  navigatorActivation += 1;
1649
1655
  navigatorDeliveryClosed = false;
@@ -125,10 +125,3 @@ export function roleFromRunDirectory(runDirectory: string): string | undefined {
125
125
  return parseRunLeaf(basename(runDirectory))?.role;
126
126
  }
127
127
 
128
- /**
129
- * #1195 ticket-court blind review: notary source is a countersign run.
130
- * Identity still binds; countersign body is not preloaded into dialogue.
131
- */
132
- export function isTicketCourtCountersignSource(runDirectory: string): boolean {
133
- return roleFromRunDirectory(runDirectory) === "countersign";
134
- }