@hmharness/observability 0.23.19 → 0.23.21

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.
Files changed (2) hide show
  1. package/dist/store.js +14 -4
  2. package/package.json +1 -1
package/dist/store.js CHANGED
@@ -29,12 +29,22 @@ export function jsonlTrajectoryStore(home) {
29
29
  head = JSON.parse(await readFile(join(dir, 'summary.json'), 'utf8'));
30
30
  }
31
31
  catch {
32
- // unfinished run: synthesize a head from the first event
33
- const lines = (await readFile(join(dir, 'trajectory.jsonl'), 'utf8')).trim();
34
- const first = lines ? JSON.parse(lines.split('\n')[0]) : null;
32
+ // unfinished run: synthesize a head from the first event. The
33
+ // recorder's opening event is run.created (NOT run.started — that
34
+ // mismatch made this fallback return an empty task forever, which
35
+ // surfaced as the CI flake whenever summary.json hadn't drained).
36
+ // A brand-new run may have NO files flushed yet — that is an empty
37
+ // head, not an error.
38
+ let first = null;
39
+ try {
40
+ const lines = (await readFile(join(dir, 'trajectory.jsonl'), 'utf8')).trim();
41
+ if (lines)
42
+ first = JSON.parse(lines.split('\n')[0]);
43
+ }
44
+ catch { /* nothing flushed yet */ }
35
45
  head = {
36
46
  runId,
37
- task: first?.type === 'run.started' ? String(first.payload?.task ?? '') : '',
47
+ task: first?.type === 'run.created' ? String(first.payload?.task ?? '') : '',
38
48
  startedAt: first?.ts ?? new Date().toISOString(),
39
49
  events: [],
40
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/observability",
3
- "version": "0.23.19",
3
+ "version": "0.23.21",
4
4
  "description": "hmharness observability: typed RunEvent schema + append-only TrajectoryStore. Every agent run becomes a reproducible, comparable, exportable experiment sample (V2 blueprint M1 - flight recorder). Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",