@hmharness/observability 0.23.27 → 0.23.28

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.
@@ -3,7 +3,12 @@ import { type EventActor, type RunEventType, type RunMetrics, type RunOutcome }
3
3
  export interface TrajectoryRecorder {
4
4
  readonly runId: string;
5
5
  emit(type: RunEventType | string, actor: EventActor, payload: unknown, parentEventId?: string): void;
6
- finish(outcome: RunOutcome, metrics?: RunMetrics): void;
6
+ /** resolves once every queued append AND the summary write are durable.
7
+ * Fire-and-forget callers may ignore the promise (ADR-0001 unchanged);
8
+ * awaiting it is the DETERMINISTIC contract that a finished run is fully
9
+ * persisted - a fixed sleep can never guarantee that on a slow disk
10
+ * (the CI-only flake this replaces). */
11
+ finish(outcome: RunOutcome, metrics?: RunMetrics): Promise<void>;
7
12
  }
8
13
  export declare function newRunId(now?: Date): string;
9
14
  /** Fire-and-forget queue: appends happen serially so JSONL lines never interleave. */
package/dist/recorder.js CHANGED
@@ -35,7 +35,7 @@ export function createTrajectoryRecorder(home, meta, store = jsonlTrajectoryStor
35
35
  emit,
36
36
  finish(outcome, metrics) {
37
37
  if (finished)
38
- return;
38
+ return Promise.resolve();
39
39
  finished = true;
40
40
  emit(outcome.success ? 'run.completed' : 'run.failed', 'system', { ...outcome, ...metrics });
41
41
  push(async () => {
@@ -44,6 +44,7 @@ export function createTrajectoryRecorder(home, meta, store = jsonlTrajectoryStor
44
44
  startedAt, finishedAt: new Date().toISOString(), outcome, metrics,
45
45
  }, seq);
46
46
  });
47
+ return chain; // the tail includes the summary write - awaiting = durable
47
48
  },
48
49
  };
49
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/observability",
3
- "version": "0.23.27",
3
+ "version": "0.23.28",
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",