@crewhaus/event-log 0.2.3 → 0.3.0

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/index.d.ts +73 -1
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,5 +1,40 @@
1
1
  export declare const DEFAULT_ROOT_DIR = ".crewhaus/sessions";
2
- export type EventKind = "user_message" | "assistant_message" | "tool_use" | "tool_result" | "error" | "compaction" | "sub_agent_start" | "sub_agent_end" | "role_start" | "role_end" | "handoff" | "a2a_message" | "a2a_turn_start" | "a2a_turn_end" | "crew_done" | "cost_accrual" | "user_feedback" | "recovery" | "tool_stats" | "permission" | "model_meta" | "mcp_stats" | "model_route";
2
+ export type EventKind = "user_message" | "assistant_message" | "tool_use" | "tool_result" | "error" | "run_failed" | "context_evicted" | "compaction" | "sub_agent_start" | "sub_agent_end" | "role_start" | "role_end" | "handoff" | "a2a_message" | "a2a_turn_start" | "a2a_turn_end" | "crew_done" | "cost_accrual" | "user_feedback" | "recovery" | "tool_stats" | "permission" | "model_meta" | "mcp_stats" | "model_route" | "wiki_write" | "plan_update" | "goal_update" | "action_proof" | "dream_run";
3
+ /**
4
+ * Payload for the `wiki_write` event kind (0.3.0 design §9): which article
5
+ * was mutated, at what version, and how. `action` distinguishes a body
6
+ * upsert (`"write"`), a reflection-pass signals change (`"set_signals"`),
7
+ * and the standalone `log_knowledge_gap` fallback (`"gap"`).
8
+ */
9
+ export type WikiWriteEventPayload = {
10
+ readonly slug: string;
11
+ readonly version: number;
12
+ readonly action: "write" | "set_signals" | "gap";
13
+ /** thredz-parity `editMessage`, when the model supplied one. */
14
+ readonly editMessage?: string;
15
+ };
16
+ /**
17
+ * Payload for the `dream_run` event kind (0.3.0 design §6): proof one
18
+ * scheduled-consolidation run happened, with what outcome, and — when the
19
+ * model phase ran — which tool calls it left behind as evidence. The counts
20
+ * object mirrors dream-engine's `DreamPhase1Counts` (kept structural here so
21
+ * event-log stays dependency-free).
22
+ */
23
+ export type DreamRunEventPayload = {
24
+ readonly specName: string;
25
+ /** What fired the run: `cli` verb, `boot` catch-up, or a daemon `janitor` tick. */
26
+ readonly trigger: string;
27
+ /** `deterministic` | `full` | `model_refused_unpriced` | `model_failed`. */
28
+ readonly outcome: string;
29
+ /** The idempotency window this run consumed (`dream:<spec>:<windowIndex>`). */
30
+ readonly windowKey: string;
31
+ readonly phase1Counts: Readonly<Record<string, number>>;
32
+ /** The dream model session, when the model phase ran. */
33
+ readonly sessionId?: string;
34
+ readonly spentUsd?: number;
35
+ /** Successful toolUseIds from the model phase — the §6.2 evidence trail. */
36
+ readonly evidence?: readonly string[];
37
+ };
3
38
  export type Event = {
4
39
  readonly ts: number;
5
40
  readonly version: 1;
@@ -26,3 +61,40 @@ export interface EventLog {
26
61
  * sees a consistent snapshot of the bytes already on disk.
27
62
  */
28
63
  export declare function openEventLog(sessionId: string, opts?: OpenEventLogOptions): Promise<EventLog>;
64
+ /** Payload of a `plan_update` event — one plan mutation (creation, a new
65
+ * step, a ladder-status move up to `claimed`, the active-plan pointer, or
66
+ * the machine-checked `prove_step` transition recorded alongside its
67
+ * `action_proof` events). */
68
+ export type PlanUpdateEventPayload = {
69
+ readonly planId: string;
70
+ readonly action: "create" | "add_step" | "set_step_status" | "set_active" | "prove_step";
71
+ readonly step?: number;
72
+ readonly status?: string;
73
+ readonly title?: string;
74
+ /** v0.3.0 §7.1 — `formatAgentIdentity` of the acting run context when one
75
+ * is set (e.g. `subagent=researcher` for a plan mutation made from inside
76
+ * a sub-agent). Absent for top-level runs. */
77
+ readonly agentIdentity?: string;
78
+ };
79
+ /** Payload of a `goal_update` event — one goal creation or mutation. */
80
+ export type GoalUpdateEventPayload = {
81
+ readonly goalId: string;
82
+ readonly action: "create" | "update";
83
+ readonly status?: string;
84
+ readonly title?: string;
85
+ /** See `PlanUpdateEventPayload.agentIdentity`. */
86
+ readonly agentIdentity?: string;
87
+ };
88
+ /** Payload of an `action_proof` event — one evidence reference checked
89
+ * during a `proven` transition. `verified` means the cited `tool_use` /
90
+ * `tool_result` pair resolved in a session log (parent or child) with
91
+ * `isError` false; `missing` and `error_result` record rejected attempts so
92
+ * the audit trail shows proof pressure, not just successes. */
93
+ export type ActionProofEventPayload = {
94
+ readonly planId: string;
95
+ readonly step: number;
96
+ readonly toolUseId: string;
97
+ readonly verdict: "verified" | "missing" | "error_result";
98
+ /** See `PlanUpdateEventPayload.agentIdentity`. */
99
+ readonly agentIdentity?: string;
100
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/event-log",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Append-only JSONL transcript log per session",
6
6
  "main": "dist/index.js",
@@ -15,8 +15,8 @@
15
15
  "test": "bun test src"
16
16
  },
17
17
  "dependencies": {
18
- "@crewhaus/errors": "0.2.3",
19
- "@crewhaus/tenancy": "0.2.3"
18
+ "@crewhaus/errors": "0.3.0",
19
+ "@crewhaus/tenancy": "0.3.0"
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "author": {