@akagilnc/pi-workflow-roles 0.1.2203 → 0.1.2207

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.
@@ -110,15 +110,25 @@ export function isEngineDetourFailure(result) {
110
110
  return result.code !== 0 || result.stdout.trim() === "";
111
111
  }
112
112
  /**
113
- * Diagnostic string for shared settlement / Terminal Error Artifact.
114
- * Prefer engine stderr 原样; whitespace-only/empty stderr is absent stable fallback.
113
+ * Diagnostic string for shared settlement / Terminal Error Artifact (#395).
114
+ * Prefer engine stderr 原样; whitespace-only/empty stderr with stdout body must
115
+ * carry the child's last result/error row verbatim (e.g. a 529 API Error row) —
116
+ * never swallow the cause behind an exit code. Fully-empty output → stable fallback.
115
117
  */
116
118
  export function engineDetourFailureDiagnostic(result) {
117
119
  if (result.stderr.trim().length > 0)
118
120
  return result.stderr;
119
121
  if (result.stdout.trim() === "")
120
122
  return ENGINE_DETOUR_EMPTY_STDOUT_DIAGNOSTIC;
121
- return `engine detour exited with code ${result.code}`;
123
+ const rows = result.stdout.split("\n");
124
+ let lastRow = "";
125
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
126
+ if (rows[index].trim() !== "") {
127
+ lastRow = rows[index];
128
+ break;
129
+ }
130
+ }
131
+ return `engine detour exited with code ${result.code}: ${lastRow}`;
122
132
  }
123
133
  /** Non-empty trimmed engine name from process.env, else undefined. */
124
134
  export function engineNameFromEnv() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.2203",
3
+ "version": "0.1.2207",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -136,8 +136,10 @@ export function isEngineDetourFailure(result: {
136
136
  }
137
137
 
138
138
  /**
139
- * Diagnostic string for shared settlement / Terminal Error Artifact.
140
- * Prefer engine stderr 原样; whitespace-only/empty stderr is absent stable fallback.
139
+ * Diagnostic string for shared settlement / Terminal Error Artifact (#395).
140
+ * Prefer engine stderr 原样; whitespace-only/empty stderr with stdout body must
141
+ * carry the child's last result/error row verbatim (e.g. a 529 API Error row) —
142
+ * never swallow the cause behind an exit code. Fully-empty output → stable fallback.
141
143
  */
142
144
  export function engineDetourFailureDiagnostic(result: {
143
145
  stderr: string;
@@ -146,7 +148,15 @@ export function engineDetourFailureDiagnostic(result: {
146
148
  }): string {
147
149
  if (result.stderr.trim().length > 0) return result.stderr;
148
150
  if (result.stdout.trim() === "") return ENGINE_DETOUR_EMPTY_STDOUT_DIAGNOSTIC;
149
- return `engine detour exited with code ${result.code}`;
151
+ const rows = result.stdout.split("\n");
152
+ let lastRow = "";
153
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
154
+ if (rows[index]!.trim() !== "") {
155
+ lastRow = rows[index]!;
156
+ break;
157
+ }
158
+ }
159
+ return `engine detour exited with code ${result.code}: ${lastRow}`;
150
160
  }
151
161
 
152
162
  /** Non-empty trimmed engine name from process.env, else undefined. */