@vectorize-io/hindsight-coding-agents 0.3.3 → 0.3.4

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.
@@ -349,6 +349,20 @@ var log = {
349
349
  warn: (scope, msg, extra) => write("warn", scope, msg, extra),
350
350
  error: (scope, msg, extra) => write("error", scope, msg, extra)
351
351
  };
352
+ function describeError(value, maxChars = 200) {
353
+ const parts = [];
354
+ const seen = /* @__PURE__ */ new Set();
355
+ let current2 = value;
356
+ while (current2 && !seen.has(current2)) {
357
+ seen.add(current2);
358
+ const error = current2;
359
+ const text = typeof error.message === "string" ? error.message : String(current2);
360
+ const withCode = error.code ? `${text} (${String(error.code)})` : text;
361
+ if (withCode && parts.at(-1) !== withCode) parts.push(withCode);
362
+ current2 = error.cause;
363
+ }
364
+ return (parts.join(": ") || String(value)).slice(0, maxChars);
365
+ }
352
366
 
353
367
  // src/core/diag.ts
354
368
  function diagFilePath() {
@@ -1525,11 +1539,11 @@ async function buildRetain(args) {
1525
1539
  diag(harness, "retain_ok", { ms: Date.now() - t0, turns: turns.length, session: sessionId });
1526
1540
  } catch (e) {
1527
1541
  log.warn(harness, "session write-back failed", {
1528
- error: String(e?.message || e).slice(0, 200)
1542
+ error: describeError(e)
1529
1543
  });
1530
1544
  diag(harness, "retain_failed", {
1531
1545
  ms: Date.now() - t0,
1532
- error: String(e?.message || e).slice(0, 200),
1546
+ error: describeError(e),
1533
1547
  session: sessionId
1534
1548
  });
1535
1549
  }