@akagilnc/pi-workflow-roles 0.1.4528 → 0.1.4620

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 (55) hide show
  1. package/README.md +5 -4
  2. package/README.zh-CN.md +6 -5
  3. package/dist/acp-host/production-host.js +1834 -637
  4. package/dist/archivist-record-topology.js +27 -35
  5. package/dist/headless-host/description.js +7 -4
  6. package/dist/headless-host/production-host.js +1652 -519
  7. package/dist/migrate-book-topology.js +8 -11
  8. package/dist/navigator-attendance.js +146 -241
  9. package/dist/navigator-public-session.js +81 -15
  10. package/dist/package-contracts/navigator-output.js +30 -12
  11. package/dist/public-cli/invocation.js +10 -4
  12. package/dist/public-cli/judge-run.js +2 -2
  13. package/dist/public-cli/main.js +879 -410
  14. package/dist/public-cli/option-definitions.js +6 -6
  15. package/dist/public-cli/post-admission.js +25 -10
  16. package/dist/public-cli/reviewer-run.js +339 -0
  17. package/dist/public-cli/run-lifecycle.js +29 -7
  18. package/dist/public-cli/settlement.js +46 -32
  19. package/dist/public-cli/terminal.js +17 -27
  20. package/dist/public-cli/turn-request.js +1 -1
  21. package/dist/public-role-summons.js +370 -20
  22. package/dist/submission-ledger.js +56 -23
  23. package/package.json +1 -1
  24. package/resources/836-deleted-machine-instruction-inventory.md +2 -0
  25. package/resources/navigator-route-playbook.md +9 -0
  26. package/scripts/build-package.mjs +6 -1
  27. package/src/acp-host/role-turn-host.ts +129 -13
  28. package/src/headless-host/description.ts +17 -7
  29. package/src/headless-host/role-turn-host.ts +42 -11
  30. package/src/host-contracts.ts +0 -1
  31. package/src/navigator-attendance.ts +290 -425
  32. package/src/navigator-public-session.ts +126 -25
  33. package/src/navigator-role.ts +2 -2
  34. package/src/package-contracts/navigator-output.ts +41 -25
  35. package/src/public-cli/coder-run.ts +2 -2
  36. package/src/public-cli/fixer-run.ts +2 -2
  37. package/src/public-cli/invocation.ts +19 -9
  38. package/src/public-cli/judge-run.ts +2 -2
  39. package/src/public-cli/merger-run.ts +2 -2
  40. package/src/public-cli/option-definitions.ts +6 -6
  41. package/src/public-cli/post-admission.ts +41 -10
  42. package/src/public-cli/reviewer-run.ts +238 -53
  43. package/src/public-cli/run-lifecycle.ts +37 -7
  44. package/src/public-cli/settlement.ts +42 -34
  45. package/src/public-cli/terminal.ts +39 -37
  46. package/src/public-cli/turn-request.ts +7 -1
  47. package/src/public-role-summons.ts +544 -22
  48. package/src/reviewer-role.ts +1 -2
  49. package/src/role-envelope.ts +89 -4
  50. package/src/role-runtime.ts +76 -16
  51. package/src/submission-ledger.ts +63 -21
  52. package/dist/public-cli/command-renderer.js +0 -5
  53. package/dist/public-command-renderer.js +0 -29
  54. package/src/public-cli/command-renderer.ts +0 -9
  55. package/src/public-command-renderer.ts +0 -55
@@ -5,11 +5,6 @@
5
5
  * Free-text cells are JSON-string encoded so legitimate newlines/tabs cannot forge
6
6
  * extra rows or shift column boundaries (note / fix.summary / decision question / reason).
7
7
  */
8
- import {
9
- isPublicCallableRole,
10
- renderPublicAkRoleCommand,
11
- } from "./command-renderer.ts";
12
- import type { NavigatorPhase } from "../navigator-attendance.ts";
13
8
  import type { NoReceiptLifecycleFacts } from "../receipt-delivery-policy.ts";
14
9
  import type { ControlledFailureCause } from "../host-contracts.ts";
15
10
 
@@ -102,12 +97,9 @@ export function exitCodeForTerminalOutcome(
102
97
 
103
98
  export type TerminalNavigatorFact =
104
99
  | {
105
- disposition: "recommendation";
106
- next: { role: string; phase: NavigatorPhase };
107
- reason: string;
108
- /** Present only when role/phase is sufficient for a truthful public command. */
109
- command?: string;
110
- route?: ReadonlyArray<{ role: string; phase: NavigatorPhase }>;
100
+ /** #959: navigator speaks prose; code does not parse or rank the advice. */
101
+ disposition: "advice";
102
+ prose: string;
111
103
  advisoryDiagnostic?: string;
112
104
  }
113
105
  | {
@@ -182,6 +174,16 @@ export function roleResultPayloads(outcome: TerminalRoleOutcome): readonly unkno
182
174
 
183
175
  export type TerminalResult = {
184
176
  roleOutcome: TerminalRoleOutcome;
177
+ /** Default Reviewer parent: original child Terminals, keyed by frozen axis. */
178
+ reviewerChildren?: Readonly<{
179
+ completeness?: TerminalResult;
180
+ correctness?: TerminalResult;
181
+ }>;
182
+ /** Per-axis summons facts retained even when no child Terminal exists. */
183
+ reviewerChildOutcomes?: Readonly<{
184
+ completeness: { exitCode: number; stderr?: string };
185
+ correctness: { exitCode: number; stderr?: string };
186
+ }>;
185
187
  navigator: TerminalNavigatorFact;
186
188
  artifacts: readonly TerminalArtifactRef[];
187
189
  /**
@@ -201,36 +203,32 @@ export type TerminalResult = {
201
203
  /** Resumable failure: run ID appears only inside resume.command. */
202
204
  resume: TerminalResume;
203
205
  runId?: undefined;
206
+ batch?: undefined;
204
207
  }
205
208
  | {
206
209
  runId: string;
207
210
  resume?: undefined;
211
+ batch?: undefined;
212
+ }
213
+ | {
214
+ /** Deterministic public batch projection; no parent Role run exists. */
215
+ batch: "reviewer";
216
+ runId?: undefined;
217
+ resume?: undefined;
208
218
  }
209
219
  );
210
220
 
211
221
  /**
212
- * Build a recommendation navigator fact. Model command is kept when present;
213
- * registry render is fallback only. Unknown seats stay recommendations (#836 B4.1).
222
+ * Build an advice navigator fact (#959). Prose is presented as submitted;
223
+ * code does not parse route/next or judge usability.
214
224
  */
215
- export function recommendationNavigatorFact(input: {
216
- next: { role: string; phase: NavigatorPhase };
217
- reason: string;
218
- route?: ReadonlyArray<{ role: string; phase: NavigatorPhase }>;
225
+ export function adviceNavigatorFact(input: {
226
+ prose: string;
219
227
  advisoryDiagnostic?: string;
220
- modelCommand?: string;
221
228
  }): TerminalNavigatorFact {
222
- const command =
223
- typeof input.modelCommand === "string" && input.modelCommand.trim() !== ""
224
- ? input.modelCommand
225
- : isPublicCallableRole(input.next.role)
226
- ? renderPublicAkRoleCommand(input.next)
227
- : undefined;
228
229
  return {
229
- disposition: "recommendation",
230
- next: input.next,
231
- reason: input.reason,
232
- ...(command === undefined ? {} : { command }),
233
- ...(input.route === undefined ? {} : { route: input.route }),
230
+ disposition: "advice",
231
+ prose: input.prose,
234
232
  ...(input.advisoryDiagnostic === undefined ? {} : { advisoryDiagnostic: input.advisoryDiagnostic }),
235
233
  };
236
234
  }
@@ -270,14 +268,9 @@ export function formatTerminalResult(result: TerminalResult): string {
270
268
  if (result.navigator.advisoryDiagnostic !== undefined) {
271
269
  lines.push(`navigator-advisory\t${encodeTerminalField(result.navigator.advisoryDiagnostic)}`);
272
270
  }
273
- if (result.navigator.disposition === "recommendation") {
274
- lines.push(
275
- `next\t${result.navigator.next.role}\t${result.navigator.next.phase ?? "none"}`,
276
- );
277
- lines.push(`reason\t${encodeTerminalField(result.navigator.reason)}`);
278
- if (result.navigator.command !== undefined) {
279
- lines.push(`command\t${encodeTerminalField(result.navigator.command)}`);
280
- }
271
+ if (result.navigator.disposition === "advice") {
272
+ // #959: present navigator prose as-is — no next/reason/command parsing.
273
+ lines.push(`prose\t${encodeTerminalField(result.navigator.prose)}`);
281
274
  } else if (result.navigator.disposition === "unavailable") {
282
275
  lines.push(
283
276
  `unavailable\t${result.navigator.source}\t${encodeTerminalField(result.navigator.reason)}`,
@@ -303,6 +296,15 @@ export function formatTerminalResult(result: TerminalResult): string {
303
296
  );
304
297
  }
305
298
  }
299
+ if (result.reviewerChildOutcomes !== undefined) {
300
+ for (const axis of ["completeness", "correctness"] as const) {
301
+ const child = result.reviewerChildOutcomes[axis];
302
+ lines.push(`reviewer-child\t${axis}\t${child.exitCode}`);
303
+ if (child.stderr !== undefined && child.stderr !== "") {
304
+ lines.push(`reviewer-child-diagnostic\t${axis}\t${encodeTerminalField(child.stderr)}`);
305
+ }
306
+ }
307
+ }
306
308
  if (result.resume !== undefined) {
307
309
  // Resumable failure: run ID is revealed only inside the complete resume command.
308
310
  lines.push(`resume\t${encodeTerminalField(result.resume.command)}`);
@@ -38,6 +38,12 @@ export type RoleTurnRequestProjectionOptions = {
38
38
  invocationScopeId?: string;
39
39
  /** Station child role run (#840): omit automatic navigator attendance. */
40
40
  stationChild?: boolean;
41
+ /**
42
+ * Optional host-turn cwd override. Durable admitted projectRoot stays the
43
+ * identity source; Reviewer fresh-copy sandboxes (explicit --lens, dual-lens
44
+ * legs, resume) inject the ephemeral worktree here (#946 统一新副本).
45
+ */
46
+ cwd?: string;
41
47
  };
42
48
 
43
49
  export type AdmittedTurnInvocation = {
@@ -58,7 +64,7 @@ export function projectRoleTurnRequest(
58
64
  },
59
65
  options: RoleTurnRequestProjectionOptions,
60
66
  ): RoleTurnRequest {
61
- const cwd = admitted.projectRoot ?? admitted.repoRoot ?? admitted.cwd;
67
+ const cwd = options.cwd ?? admitted.projectRoot ?? admitted.repoRoot ?? admitted.cwd;
62
68
  if (cwd === undefined) throw new Error("admitted invocation missing working directory");
63
69
  if (admitted.principal === undefined) throw new Error("admitted invocation missing principal");
64
70
  // #617 DK-3: turn model is the live seat/env model only — never the admitted