@akagilnc/pi-workflow-roles 0.1.5316 → 0.1.5321

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.
@@ -14016,12 +14016,6 @@ function latestPayloadEscalated(roleOutcome) {
14016
14016
  const payloads = roleOutcome.payloads ?? [];
14017
14017
  return isEscalatePayload(payloads[payloads.length - 1]);
14018
14018
  }
14019
- function courtDiaristEscalated(roleOutcome) {
14020
- if (roleOutcome === void 0) return false;
14021
- if (roleOutcome.kind === "audit_escalation") return true;
14022
- if (roleOutcome.kind !== "accepted") return false;
14023
- return (roleOutcome.payloads ?? []).some(isEscalatePayload);
14024
- }
14025
14019
  async function invokeCourtDiarist(input, env, io) {
14026
14020
  const quietIo = {
14027
14021
  stdout() {
@@ -14054,7 +14048,7 @@ async function invokeCourtDiarist(input, env, io) {
14054
14048
  });
14055
14049
  const roleOutcome = result.terminal?.roleOutcome;
14056
14050
  const submissions = result.terminal?.submissions;
14057
- if (courtDiaristEscalated(roleOutcome)) {
14051
+ if (latestPayloadEscalated(roleOutcome)) {
14058
14052
  return {
14059
14053
  identity: {
14060
14054
  kind: "escalate",
@@ -14617,7 +14611,6 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14617
14611
  }
14618
14612
  if (outcome.identity.kind === "escalate" && outcome.terminal !== void 0) {
14619
14613
  io.stdout(formatTerminalResult(outcome.terminal));
14620
- return { exitCode: 0, admitted, terminal: outcome.terminal };
14621
14614
  }
14622
14615
  }
14623
14616
  return dispatchAdmitted(admitted, env, io);
@@ -23757,8 +23750,9 @@ function createDiaristRoleRuntime(roleHost, dependencies) {
23757
23750
  await bindTicketNumberOnRunDirectory(coords.runDirectory, ticketNumber);
23758
23751
  }
23759
23752
  }
23760
- const singleSessions = submitted && !Object.hasOwn(submitted, "ticketSessions") ? projectDiaristSessions(parameters) : void 0;
23761
- const ticketSessions = submitted && Object.hasOwn(submitted, "ticketSessions") ? projectDiaristTicketSessions(submitted) : singleSessions === void 0 ? void 0 : [{ ticketNumber: ticketNumber ?? null, sessions: singleSessions }];
23753
+ const multiTicket = submitted?.ticketSessions != null;
23754
+ const singleSessions = submitted && !multiTicket ? projectDiaristSessions(parameters) : void 0;
23755
+ const ticketSessions = submitted && multiTicket ? projectDiaristTicketSessions(submitted) : singleSessions === void 0 ? void 0 : [{ ticketNumber: ticketNumber ?? null, sessions: singleSessions }];
23762
23756
  if (ticketSessions === void 0) {
23763
23757
  throw new ParentQueueReaskError(DIARIST_BOUNDS_REASK);
23764
23758
  }
@@ -14436,12 +14436,6 @@ function latestPayloadEscalated(roleOutcome) {
14436
14436
  const payloads = roleOutcome.payloads ?? [];
14437
14437
  return isEscalatePayload(payloads[payloads.length - 1]);
14438
14438
  }
14439
- function courtDiaristEscalated(roleOutcome) {
14440
- if (roleOutcome === void 0) return false;
14441
- if (roleOutcome.kind === "audit_escalation") return true;
14442
- if (roleOutcome.kind !== "accepted") return false;
14443
- return (roleOutcome.payloads ?? []).some(isEscalatePayload);
14444
- }
14445
14439
  async function invokeCourtDiarist(input, env, io) {
14446
14440
  const quietIo = {
14447
14441
  stdout() {
@@ -14474,7 +14468,7 @@ async function invokeCourtDiarist(input, env, io) {
14474
14468
  });
14475
14469
  const roleOutcome = result.terminal?.roleOutcome;
14476
14470
  const submissions = result.terminal?.submissions;
14477
- if (courtDiaristEscalated(roleOutcome)) {
14471
+ if (latestPayloadEscalated(roleOutcome)) {
14478
14472
  return {
14479
14473
  identity: {
14480
14474
  kind: "escalate",
@@ -15037,7 +15031,6 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
15037
15031
  }
15038
15032
  if (outcome.identity.kind === "escalate" && outcome.terminal !== void 0) {
15039
15033
  io.stdout(formatTerminalResult(outcome.terminal));
15040
- return { exitCode: 0, admitted, terminal: outcome.terminal };
15041
15034
  }
15042
15035
  }
15043
15036
  return dispatchAdmitted(admitted, env, io);
@@ -23850,8 +23843,9 @@ function createDiaristRoleRuntime(roleHost, dependencies) {
23850
23843
  await bindTicketNumberOnRunDirectory(coords.runDirectory, ticketNumber);
23851
23844
  }
23852
23845
  }
23853
- const singleSessions = submitted && !Object.hasOwn(submitted, "ticketSessions") ? projectDiaristSessions(parameters) : void 0;
23854
- const ticketSessions = submitted && Object.hasOwn(submitted, "ticketSessions") ? projectDiaristTicketSessions(submitted) : singleSessions === void 0 ? void 0 : [{ ticketNumber: ticketNumber ?? null, sessions: singleSessions }];
23846
+ const multiTicket = submitted?.ticketSessions != null;
23847
+ const singleSessions = submitted && !multiTicket ? projectDiaristSessions(parameters) : void 0;
23848
+ const ticketSessions = submitted && multiTicket ? projectDiaristTicketSessions(submitted) : singleSessions === void 0 ? void 0 : [{ ticketNumber: ticketNumber ?? null, sessions: singleSessions }];
23855
23849
  if (ticketSessions === void 0) {
23856
23850
  throw new ParentQueueReaskError(DIARIST_BOUNDS_REASK);
23857
23851
  }
@@ -60,16 +60,6 @@ export function latestPayloadEscalated(roleOutcome) {
60
60
  const payloads = roleOutcome.payloads ?? [];
61
61
  return isEscalatePayload(payloads[payloads.length - 1]);
62
62
  }
63
- /** Routing boolean over the child's own typed sequence — does not pick or rewrite a sole row. */
64
- export function courtDiaristEscalated(roleOutcome) {
65
- if (roleOutcome === undefined)
66
- return false;
67
- if (roleOutcome.kind === "audit_escalation")
68
- return true;
69
- if (roleOutcome.kind !== "accepted")
70
- return false;
71
- return (roleOutcome.payloads ?? []).some(isEscalatePayload);
72
- }
73
63
  /**
74
64
  * Invoke public 起居郎 under the court-pipeline quiet face.
75
65
  * Returns escalate or unbound; the secretariat needs no ticket handoff.
@@ -115,7 +105,7 @@ export async function invokeCourtDiarist(input, env, io) {
115
105
  const submissions = result.terminal?.submissions;
116
106
  // Escalate routing is a boolean over the preserved sequence (#881). Reasons and
117
107
  // payload bodies stay on roleOutcome — never rewritten into a sole identity reason.
118
- if (courtDiaristEscalated(roleOutcome)) {
108
+ if (latestPayloadEscalated(roleOutcome)) {
119
109
  return {
120
110
  identity: {
121
111
  kind: "escalate",
@@ -598,9 +598,10 @@ export async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
598
598
  thrown: new Error(outcome.failedWithoutEscalate.diagnostic),
599
599
  }, seatAdapters(admitted, env), env.principalAuthority, io);
600
600
  }
601
+ // The diarist's escalation pauses only the diarist's own run; call order
602
+ // belongs to the caller, so the Secretariat still takes its own turn.
601
603
  if (outcome.identity.kind === "escalate" && outcome.terminal !== undefined) {
602
604
  io.stdout(formatTerminalResult(outcome.terminal));
603
- return { exitCode: 0, admitted, terminal: outcome.terminal };
604
605
  }
605
606
  }
606
607
  return dispatchAdmitted(admitted, env, io);
@@ -25077,12 +25077,6 @@ function latestPayloadEscalated(roleOutcome) {
25077
25077
  const payloads = roleOutcome.payloads ?? [];
25078
25078
  return isEscalatePayload(payloads[payloads.length - 1]);
25079
25079
  }
25080
- function courtDiaristEscalated(roleOutcome) {
25081
- if (roleOutcome === void 0) return false;
25082
- if (roleOutcome.kind === "audit_escalation") return true;
25083
- if (roleOutcome.kind !== "accepted") return false;
25084
- return (roleOutcome.payloads ?? []).some(isEscalatePayload);
25085
- }
25086
25080
  async function invokeCourtDiarist(input, env, io) {
25087
25081
  const quietIo = {
25088
25082
  stdout() {
@@ -25115,7 +25109,7 @@ async function invokeCourtDiarist(input, env, io) {
25115
25109
  });
25116
25110
  const roleOutcome = result.terminal?.roleOutcome;
25117
25111
  const submissions = result.terminal?.submissions;
25118
- if (courtDiaristEscalated(roleOutcome)) {
25112
+ if (latestPayloadEscalated(roleOutcome)) {
25119
25113
  return {
25120
25114
  identity: {
25121
25115
  kind: "escalate",
@@ -25678,7 +25672,6 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
25678
25672
  }
25679
25673
  if (outcome.identity.kind === "escalate" && outcome.terminal !== void 0) {
25680
25674
  io.stdout(formatTerminalResult(outcome.terminal));
25681
- return { exitCode: 0, admitted, terminal: outcome.terminal };
25682
25675
  }
25683
25676
  }
25684
25677
  return dispatchAdmitted(admitted, env, io);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.5316",
3
+ "version": "0.1.5321",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -131,16 +131,6 @@ export function latestPayloadEscalated(
131
131
  return isEscalatePayload(payloads[payloads.length - 1]);
132
132
  }
133
133
 
134
- /** Routing boolean over the child's own typed sequence — does not pick or rewrite a sole row. */
135
- export function courtDiaristEscalated(
136
- roleOutcome: TerminalRoleOutcome | undefined,
137
- ): boolean {
138
- if (roleOutcome === undefined) return false;
139
- if (roleOutcome.kind === "audit_escalation") return true;
140
- if (roleOutcome.kind !== "accepted") return false;
141
- return (roleOutcome.payloads ?? []).some(isEscalatePayload);
142
- }
143
-
144
134
  /**
145
135
  * Invoke public 起居郎 under the court-pipeline quiet face.
146
136
  * Returns escalate or unbound; the secretariat needs no ticket handoff.
@@ -198,7 +188,7 @@ export async function invokeCourtDiarist(
198
188
  const submissions = result.terminal?.submissions;
199
189
  // Escalate routing is a boolean over the preserved sequence (#881). Reasons and
200
190
  // payload bodies stay on roleOutcome — never rewritten into a sole identity reason.
201
- if (courtDiaristEscalated(roleOutcome)) {
191
+ if (latestPayloadEscalated(roleOutcome)) {
202
192
  return {
203
193
  identity: {
204
194
  kind: "escalate",
@@ -773,9 +773,10 @@ export async function runPublicInstructionSeat(
773
773
  thrown: new Error(outcome.failedWithoutEscalate.diagnostic),
774
774
  }, seatAdapters(admitted, env), env.principalAuthority, io) as SeatRunResult;
775
775
  }
776
+ // The diarist's escalation pauses only the diarist's own run; call order
777
+ // belongs to the caller, so the Secretariat still takes its own turn.
776
778
  if (outcome.identity.kind === "escalate" && outcome.terminal !== undefined) {
777
779
  io.stdout(formatTerminalResult(outcome.terminal));
778
- return { exitCode: 0, admitted, terminal: outcome.terminal };
779
780
  }
780
781
  }
781
782
  return dispatchAdmitted(admitted, env, io);
@@ -871,10 +871,12 @@ export function createDiaristRoleRuntime(
871
871
  await bindTicketNumberOnRunDirectory(coords.runDirectory, ticketNumber);
872
872
  }
873
873
  }
874
- const singleSessions = submitted && !Object.hasOwn(submitted, "ticketSessions")
874
+ // Strict-schema hosts emit ticketSessions: null for a single ticket.
875
+ const multiTicket = submitted?.ticketSessions != null;
876
+ const singleSessions = submitted && !multiTicket
875
877
  ? projectDiaristSessions(parameters)
876
878
  : undefined;
877
- const ticketSessions = submitted && Object.hasOwn(submitted, "ticketSessions")
879
+ const ticketSessions = submitted && multiTicket
878
880
  ? projectDiaristTicketSessions(submitted)
879
881
  : singleSessions === undefined
880
882
  ? undefined