@ryanfw/prompt-orchestration-pipeline 1.0.4 → 1.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanfw/prompt-orchestration-pipeline",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A Prompt-orchestration pipeline (POP) is a framework for building, running, and experimenting with complex chains of LLM tasks.",
5
5
  "type": "module",
6
6
  "main": "src/ui/server/index.ts",
@@ -258,7 +258,16 @@ export function normalizeError(err: unknown): Omit<NormalizedError, "debug"> {
258
258
  if (err instanceof Error) {
259
259
  const e = err as Error & { status?: unknown; code?: unknown; error?: unknown };
260
260
  const result: Omit<NormalizedError, "debug"> = { name: e.name, message: e.message };
261
- if (e.stack !== undefined) result.stack = e.stack;
261
+ if (typeof e.stack === "string" && e.stack.trim().length > 0) {
262
+ result.stack = e.stack;
263
+ } else {
264
+ // Some runtime errors (e.g., TimeoutError/DOMException) may carry an empty stack.
265
+ // Synthesize one so downstream logs and UIs retain a traceback.
266
+ const synthesized = new Error(`${e.name}: ${e.message}`).stack;
267
+ if (typeof synthesized === "string" && synthesized.trim().length > 0) {
268
+ result.stack = synthesized;
269
+ }
270
+ }
262
271
  if (e.status !== undefined) result.status = e.status;
263
272
  if (e.code !== undefined) result.code = e.code;
264
273
  if (e.error !== undefined) {
@@ -740,7 +749,7 @@ export async function runPipeline(
740
749
  },
741
750
  };
742
751
 
743
- const errorEntry: AuditLogEntry = { stage: stageName, ok: false, ms: 0, error: err };
752
+ const errorEntry: AuditLogEntry = { stage: stageName, ok: false, ms: 0, error: normalized };
744
753
  context.logs.push(errorEntry);
745
754
  returnedLogs.push(errorEntry);
746
755