@akagilnc/pi-workflow-roles 0.1.3353 → 0.1.3356

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.
@@ -17301,10 +17301,6 @@ async function readTypedHttp429Observation(runDirectory) {
17301
17301
  if (!isV1ResumableProvider(observation.provider)) return void 0;
17302
17302
  return { httpStatus: 429, provider: observation.provider };
17303
17303
  }
17304
- function isV1ResumableFailure(input) {
17305
- if (input.hasLawfulTerminalResult) return false;
17306
- return input.typedHttp429 !== void 0;
17307
- }
17308
17304
  function renderResumeCommand(runId) {
17309
17305
  return `ak-role resume ${runId}`;
17310
17306
  }
@@ -24930,14 +24926,6 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
24930
24926
  }
24931
24927
  return auditEscalationLedgerOutcome(admitted, "judge", authority);
24932
24928
  }
24933
- async function hasLawfulJudgeTerminalResult(admitted, authority) {
24934
- try {
24935
- const outcome = await readLawfulJudgeRoleOutcome(admitted, authority);
24936
- return outcome !== void 0 && isLawfulTypedTerminalOutcome(outcome);
24937
- } catch {
24938
- return false;
24939
- }
24940
- }
24941
24929
  async function settleLawfulJudgeTerminalResult(admitted, authority) {
24942
24930
  const roleOutcome = await readLawfulJudgeRoleOutcome(admitted, authority);
24943
24931
  if (roleOutcome === void 0) return void 0;
@@ -25563,25 +25551,9 @@ async function trySettleNavigatorTerminalResult(admitted, authority) {
25563
25551
  async function trySettleCoderTerminalResult(admitted, authority, options = {}) {
25564
25552
  return settleLawfulCoderTerminalResult(admitted, authority, options);
25565
25553
  }
25566
- async function hasLawfulCoderTerminalResult(admitted, authority) {
25567
- try {
25568
- const outcome = await sealedLedgerOutcome(admitted);
25569
- return outcome?.role === "coder";
25570
- } catch {
25571
- return false;
25572
- }
25573
- }
25574
25554
  async function trySettleFixerTerminalResult(admitted, authority, options) {
25575
25555
  return settleLawfulFixerTerminalResult(admitted, authority, options);
25576
25556
  }
25577
- async function hasLawfulFixerTerminalResult(admitted, authority) {
25578
- try {
25579
- const outcome = await sealedLedgerOutcome(admitted);
25580
- return outcome?.role === "fixer";
25581
- } catch {
25582
- return false;
25583
- }
25584
- }
25585
25557
  function extractReviewerMethodInvocations(entries, options) {
25586
25558
  const observed = [];
25587
25559
  for (const entry of entries) {
@@ -25697,14 +25669,6 @@ async function settleLawfulReviewerTerminalResult(admitted, authority, options)
25697
25669
  async function trySettleReviewerTerminalResult(admitted, authority, options) {
25698
25670
  return settleLawfulReviewerTerminalResult(admitted, authority, options);
25699
25671
  }
25700
- async function hasLawfulReviewerTerminalResult(admitted, authority) {
25701
- try {
25702
- const outcome = await sealedLedgerOutcome(admitted);
25703
- return outcome?.role === "reviewer";
25704
- } catch {
25705
- return false;
25706
- }
25707
- }
25708
25672
  function mergerDecisiveFacts(output) {
25709
25673
  const candidate = output;
25710
25674
  const facts = {};
@@ -25862,14 +25826,6 @@ async function settleLawfulMergerTerminalResult(admitted, authority, options) {
25862
25826
  async function trySettleMergerTerminalResult(admitted, authority, options) {
25863
25827
  return settleLawfulMergerTerminalResult(admitted, authority, options);
25864
25828
  }
25865
- async function hasLawfulMergerTerminalResult(admitted, authority) {
25866
- try {
25867
- const outcome = await sealedLedgerOutcome(admitted);
25868
- return outcome?.role === "merger";
25869
- } catch {
25870
- return false;
25871
- }
25872
- }
25873
25829
  function publicationAttemptFromError(path, error) {
25874
25830
  if (error instanceof Error) {
25875
25831
  const identity = {
@@ -26764,13 +26720,9 @@ async function presentControlledFailure2(admitted, failureInput, adapters, autho
26764
26720
  });
26765
26721
  let resumable = false;
26766
26722
  const typedHttp429 = resumeObservation.typedHttp429;
26767
- if (adapters.isResumableRole === true && admitted.principal !== void 0) {
26723
+ if (admitted.principal !== void 0) {
26768
26724
  const sessionPrincipalAvailable = await authority.isAvailable(admitted.principal);
26769
- const hasLawful = adapters.hasLawfulTerminalResult !== void 0 ? await adapters.hasLawfulTerminalResult(admitted, authority) : false;
26770
- resumable = sessionPrincipalAvailable && isV1ResumableFailure({
26771
- hasLawfulTerminalResult: hasLawful,
26772
- ...typedHttp429 === void 0 ? {} : { typedHttp429 }
26773
- });
26725
+ resumable = sessionPrincipalAvailable && typedHttp429 !== void 0;
26774
26726
  }
26775
26727
  if (resumable && typedHttp429 !== void 0) {
26776
26728
  await markRunResumable(admitted.runDirectory, typedHttp429);
@@ -27138,9 +27090,7 @@ function coderAdapters(methodProvenance) {
27138
27090
  return {
27139
27091
  trySettle: (admitted, authority) => trySettleCoderTerminalResult(admitted, authority, {
27140
27092
  ...methodProvenance === void 0 ? {} : { methodProvenance }
27141
- }),
27142
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulCoderTerminalResult(admitted, authority),
27143
- isResumableRole: true
27093
+ })
27144
27094
  };
27145
27095
  }
27146
27096
  async function runPublicCoder(argv, env, io, parseCoderArgv2) {
@@ -29368,9 +29318,7 @@ function fixerAdapters(packageRoot2, methodMaterial) {
29368
29318
  packageRoot2,
29369
29319
  "diagnosing-bugs"
29370
29320
  )
29371
- }),
29372
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulFixerTerminalResult(admitted, authority),
29373
- isResumableRole: true
29321
+ })
29374
29322
  };
29375
29323
  }
29376
29324
  async function loadFixerMethodMaterial(packageRoot2) {
@@ -29728,8 +29676,6 @@ function buildJudgeTurnRequest(admitted, options) {
29728
29676
  function judgeAdapters() {
29729
29677
  return {
29730
29678
  trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
29731
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulJudgeTerminalResult(admitted, authority),
29732
- isResumableRole: true,
29733
29679
  resolveRunnerKnownFailure: async ({ result: result2, sessionFile }) => {
29734
29680
  const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
29735
29681
  return result2.knownFailure ?? (infrastructureFailure === void 0 ? void 0 : {
@@ -29866,9 +29812,7 @@ function mergerAdapters(packageRoot2, methodMaterial) {
29866
29812
  "resolving-merge-conflicts"
29867
29813
  )
29868
29814
  }),
29869
- shouldPresentSettled: (t) => isLawfulTypedTerminalOutcome(t.roleOutcome) || t.roleOutcome.kind === "incomplete",
29870
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulMergerTerminalResult(admitted, authority),
29871
- isResumableRole: true
29815
+ shouldPresentSettled: (t) => isLawfulTypedTerminalOutcome(t.roleOutcome) || t.roleOutcome.kind === "incomplete"
29872
29816
  };
29873
29817
  }
29874
29818
  async function loadMergerMethodMaterial(packageRoot2) {
@@ -30152,8 +30096,6 @@ function reviewerAdapters(packageRoot2, methodMaterial) {
30152
30096
  "code-review"
30153
30097
  )
30154
30098
  }),
30155
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulReviewerTerminalResult(admitted, authority),
30156
- isResumableRole: true,
30157
30099
  resolveRunnerKnownFailure: async ({ result: result2, sessionFile }) => {
30158
30100
  const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
30159
30101
  return infrastructureFailure === void 0 ? result2.knownFailure : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.3353",
3
+ "version": "0.1.3356",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,6 @@ import {
28
28
  type PublicResumeRequest,
29
29
  } from "./run-lifecycle.ts";
30
30
  import {
31
- hasLawfulCoderTerminalResult,
32
31
  presentStructuralRejection,
33
32
  trySettleCoderTerminalResult,
34
33
  } from "./settlement.ts";
@@ -87,8 +86,6 @@ function coderAdapters(
87
86
  trySettleCoderTerminalResult(admitted, authority, {
88
87
  ...(methodProvenance === undefined ? {} : { methodProvenance }),
89
88
  }),
90
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulCoderTerminalResult(admitted, authority),
91
- isResumableRole: true,
92
89
  };
93
90
  }
94
91
 
@@ -31,7 +31,6 @@ import {
31
31
  type PublicResumeRequest,
32
32
  } from "./run-lifecycle.ts";
33
33
  import {
34
- hasLawfulFixerTerminalResult,
35
34
  presentStructuralRejection,
36
35
  trySettleFixerTerminalResult,
37
36
  } from "./settlement.ts";
@@ -99,8 +98,6 @@ function fixerAdapters(
99
98
  "diagnosing-bugs",
100
99
  ),
101
100
  }),
102
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulFixerTerminalResult(admitted, authority),
103
- isResumableRole: true,
104
101
  };
105
102
  }
106
103
 
@@ -22,7 +22,6 @@ import {
22
22
  type PublicResumeRequest,
23
23
  } from "./run-lifecycle.ts";
24
24
  import {
25
- hasLawfulJudgeTerminalResult,
26
25
  presentStructuralRejection,
27
26
  readEngineDetourInfrastructureFailure,
28
27
  trySettleJudgeTerminalResult,
@@ -56,8 +55,6 @@ export function buildJudgeTurnRequest(
56
55
  function judgeAdapters(): PostAdmissionAdapters<AdmittedJudgeInvocation> {
57
56
  return {
58
57
  trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
59
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulJudgeTerminalResult(admitted, authority),
60
- isResumableRole: true,
61
58
  resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
62
59
  const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
63
60
  return (
@@ -36,7 +36,6 @@ import {
36
36
  type PublicResumeRequest,
37
37
  } from "./run-lifecycle.ts";
38
38
  import {
39
- hasLawfulMergerTerminalResult,
40
39
  isLawfulTypedTerminalOutcome,
41
40
  presentStructuralRejection,
42
41
  trySettleMergerTerminalResult,
@@ -105,8 +104,6 @@ function mergerAdapters(
105
104
  }),
106
105
  shouldPresentSettled: (t) =>
107
106
  isLawfulTypedTerminalOutcome(t.roleOutcome) || t.roleOutcome.kind === "incomplete",
108
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulMergerTerminalResult(admitted, authority),
109
- isResumableRole: true,
110
107
  };
111
108
  }
112
109
 
@@ -34,7 +34,6 @@ import {
34
34
  import {
35
35
  acquireRunWriterLease,
36
36
  clearTypedProviderHttpObservation,
37
- isV1ResumableFailure,
38
37
  markRunResumable,
39
38
  markRunRunning,
40
39
  markRunTerminal,
@@ -115,8 +114,6 @@ export type PostAdmissionAdapters<
115
114
  result: RoleTurnResult;
116
115
  sessionFile: string;
117
116
  }) => Promise<RoleTurnKnownFailure | undefined>;
118
- hasLawfulTerminalResult?: (admitted: A, authority: DurablePrincipalAuthority) => Promise<boolean>;
119
- isResumableRole?: boolean;
120
117
  beforeDispatch?: (admitted: A) => Promise<void> | void;
121
118
  };
122
119
 
@@ -190,19 +187,13 @@ export async function presentControlledFailure<
190
187
  ...(session === undefined ? {} : { session }),
191
188
  });
192
189
 
190
+ // #665 / #416: resume hint is seat-uniform — principal available && typed 429 → show.
191
+ // Do not fork the public terminal face on per-seat hasLawful / isResumableRole (ADR 0040).
193
192
  let resumable = false;
194
193
  const typedHttp429 = resumeObservation.typedHttp429;
195
- if (adapters.isResumableRole === true && admitted.principal !== undefined) {
194
+ if (admitted.principal !== undefined) {
196
195
  const sessionPrincipalAvailable = await authority.isAvailable(admitted.principal);
197
- const hasLawful = adapters.hasLawfulTerminalResult !== undefined
198
- ? await adapters.hasLawfulTerminalResult(admitted, authority)
199
- : false;
200
- resumable =
201
- sessionPrincipalAvailable &&
202
- isV1ResumableFailure({
203
- hasLawfulTerminalResult: hasLawful,
204
- ...(typedHttp429 === undefined ? {} : { typedHttp429 }),
205
- });
196
+ resumable = sessionPrincipalAvailable && typedHttp429 !== undefined;
206
197
  }
207
198
 
208
199
  if (resumable && typedHttp429 !== undefined) {
@@ -31,7 +31,6 @@ import {
31
31
  } from "./run-lifecycle.ts";
32
32
  import { clearReviewerDispatchRejection } from "./reviewer-dispatch-rejection.ts";
33
33
  import {
34
- hasLawfulReviewerTerminalResult,
35
34
  presentStructuralRejection,
36
35
  readEngineDetourInfrastructureFailure,
37
36
  trySettleReviewerTerminalResult,
@@ -96,8 +95,6 @@ function reviewerAdapters(
96
95
  "code-review",
97
96
  ),
98
97
  }),
99
- hasLawfulTerminalResult: (admitted, authority) => hasLawfulReviewerTerminalResult(admitted, authority),
100
- isResumableRole: true,
101
98
  resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
102
99
  const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
103
100
  return infrastructureFailure === undefined
@@ -175,19 +175,6 @@ export async function readTypedHttp429Observation(
175
175
  return { httpStatus: 429, provider: observation.provider };
176
176
  }
177
177
 
178
- /**
179
- * @deprecated #416: 429-only resumability predicate removed from gating. Kept for compatibility.
180
- * True only when a typed HTTP 429 was observed and no lawful terminal exists.
181
- * Callers must pass the lawful-terminal fact from settlement, not re-infer it.
182
- */
183
- export function isV1ResumableFailure(input: {
184
- readonly hasLawfulTerminalResult: boolean;
185
- readonly typedHttp429?: TypedHttp429Observation;
186
- }): boolean {
187
- if (input.hasLawfulTerminalResult) return false;
188
- return input.typedHttp429 !== undefined;
189
- }
190
-
191
178
  /** Complete public resume command. Run ID is revealed only through this command text. */
192
179
  export function renderResumeCommand(runId: string): string {
193
180
  return `ak-role resume ${runId}`;
@@ -2513,23 +2513,6 @@ export async function readLawfulJudgeRoleOutcome(
2513
2513
  return auditEscalationLedgerOutcome(admitted, "judge", authority);
2514
2514
  }
2515
2515
 
2516
- /**
2517
- * Independent confirmation that a lawful Judge terminal result is present in session.
2518
- * Used for resume qualification — must not depend on artifact publication success.
2519
- * Unreadable sessions are not a confirmed lawful result (returns false).
2520
- */
2521
- export async function hasLawfulJudgeTerminalResult(
2522
- admitted: AdmittedJudgeInvocation,
2523
- authority: DurablePrincipalAuthority,
2524
- ): Promise<boolean> {
2525
- try {
2526
- const outcome = await readLawfulJudgeRoleOutcome(admitted, authority);
2527
- return outcome !== undefined && isLawfulTypedTerminalOutcome(outcome);
2528
- } catch {
2529
- return false;
2530
- }
2531
- }
2532
-
2533
2516
  /**
2534
2517
  * Single lawful-settlement implementation (session → outcome/Navigator/artifacts).
2535
2518
  *
@@ -3581,18 +3564,6 @@ export async function trySettleCoderTerminalResult(
3581
3564
  return settleLawfulCoderTerminalResult(admitted, authority, options);
3582
3565
  }
3583
3566
 
3584
- export async function hasLawfulCoderTerminalResult(
3585
- admitted: AdmittedCoderInvocation,
3586
- authority: DurablePrincipalAuthority,
3587
- ): Promise<boolean> {
3588
- try {
3589
- const outcome = await sealedLedgerOutcome(admitted);
3590
- return outcome?.role === "coder";
3591
- } catch {
3592
- return false;
3593
- }
3594
- }
3595
-
3596
3567
  /** Try to settle a lawful Fixer Terminal; undefined only for genuine absence. */
3597
3568
  export async function trySettleFixerTerminalResult(
3598
3569
  admitted: AdmittedFixerInvocation,
@@ -3606,18 +3577,6 @@ export async function trySettleFixerTerminalResult(
3606
3577
  return settleLawfulFixerTerminalResult(admitted, authority, options);
3607
3578
  }
3608
3579
 
3609
- export async function hasLawfulFixerTerminalResult(
3610
- admitted: AdmittedFixerInvocation,
3611
- authority: DurablePrincipalAuthority,
3612
- ): Promise<boolean> {
3613
- try {
3614
- const outcome = await sealedLedgerOutcome(admitted);
3615
- return outcome?.role === "fixer";
3616
- } catch {
3617
- return false;
3618
- }
3619
- }
3620
-
3621
3580
  /**
3622
3581
  * Observe forced Reviewer code-review Skill expansions from the session.
3623
3582
  * Expansion evidence is package-path only; ambient home locations never count.
@@ -3807,18 +3766,6 @@ export async function trySettleReviewerTerminalResult(
3807
3766
  return settleLawfulReviewerTerminalResult(admitted, authority, options);
3808
3767
  }
3809
3768
 
3810
- export async function hasLawfulReviewerTerminalResult(
3811
- admitted: AdmittedReviewerInvocation,
3812
- authority: DurablePrincipalAuthority,
3813
- ): Promise<boolean> {
3814
- try {
3815
- const outcome = await sealedLedgerOutcome(admitted);
3816
- return outcome?.role === "reviewer";
3817
- } catch {
3818
- return false;
3819
- }
3820
- }
3821
-
3822
3769
  function mergerDecisiveFacts(output: MergerOutput): Record<string, unknown> {
3823
3770
  const candidate = output as unknown as object;
3824
3771
  const facts: Record<string, unknown> = {};
@@ -4057,18 +4004,6 @@ export async function trySettleMergerTerminalResult(
4057
4004
  return settleLawfulMergerTerminalResult(admitted, authority, options);
4058
4005
  }
4059
4006
 
4060
- export async function hasLawfulMergerTerminalResult(
4061
- admitted: AdmittedMergerInvocation,
4062
- authority: DurablePrincipalAuthority,
4063
- ): Promise<boolean> {
4064
- try {
4065
- const outcome = await sealedLedgerOutcome(admitted);
4066
- return outcome?.role === "merger";
4067
- } catch {
4068
- return false;
4069
- }
4070
- }
4071
-
4072
4007
  /** One failed attempt to place a durable failure artifact (path is private layout). */
4073
4008
  type PublicationAttempt = {
4074
4009
  readonly path: string;