@onlooker-community/schema 0.1.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.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @onlooker-community/schema
2
+
3
+ Canonical event schema for the Onlooker ecosystem. Every plugin, adapter, and the daemon itself depends on this package to agree on the shape of telemetry.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @onlooker-community/schema
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import {
15
+ createEvent,
16
+ validate,
17
+ isEventOfType,
18
+ TRIBUNAL_VERDICT,
19
+ } from "@onlooker-community/schema";
20
+
21
+ const event = createEvent({
22
+ runtime: "claude-code",
23
+ plugin: "tribunal",
24
+ machine_id: "11111111-2222-3333-4444-555555555555",
25
+ session_id: "session-abc",
26
+ event_type: TRIBUNAL_VERDICT,
27
+ payload: {
28
+ task_id: "task-1",
29
+ score: 0.92,
30
+ passed: true,
31
+ judge_type: "standard",
32
+ },
33
+ });
34
+
35
+ const result = validate(event);
36
+ if (!result.valid) {
37
+ for (const err of result.errors) console.error(`${err.path}: ${err.message}`);
38
+ process.exit(1);
39
+ }
40
+
41
+ if (isEventOfType(result.event, TRIBUNAL_VERDICT)) {
42
+ // result.event.payload is narrowed to TribunalVerdictPayload
43
+ console.log(result.event.payload.judge_type);
44
+ }
45
+ ```
46
+
47
+ ## Event envelope
48
+
49
+ ```ts
50
+ interface OnlookerEvent<T extends EventType = EventType> {
51
+ id: string; // UUID
52
+ schema_version: "1.0";
53
+ runtime: RuntimeId; // "claude-code" | "cursor" | "copilot" | "gemini" | "custom"
54
+ adapter_id?: string;
55
+ plugin: string;
56
+ machine_id: string; // UUID
57
+ timestamp: string; // ISO 8601 UTC
58
+ session_id: string;
59
+ sequence: number; // monotonic, ≥ 0
60
+ event_type: T;
61
+ payload: PayloadFor<T>;
62
+ cost_usd?: number;
63
+ token_count?: number;
64
+ redacted?: boolean;
65
+ }
66
+ ```
67
+
68
+ ## Namespaces
69
+
70
+ | Namespace | Events |
71
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------- |
72
+ | `session` | `start`, `end`, `compact`, `prompt` |
73
+ | `task` | `start`, `complete`, `fail` |
74
+ | `tool` | `file.read`, `file.write`, `file.edit`, `shell.exec`, `web.fetch`, `agent.spawn`, `agent.complete` |
75
+ | `sentinel` | `blocked`, `allowed`, `reviewed` |
76
+ | `tribunal` | `verdict`, `actor.complete`, `meta.complete` |
77
+ | `warden` | `threat.detected`, `threat.cleared`, `gate.blocked` |
78
+ | `oracle` | `calibration.requested`, `calibration.complete` |
79
+ | `archivist` | `extract.complete`, `inject.complete` |
80
+ | `relay` | `handoff.captured`, `handoff.injected` |
81
+ | `scribe` | `capture.complete`, `distill.complete` |
82
+ | `cues` | `matched`, `applied` |
83
+ | `cartographer` | `audit.complete`, `issue.found` |
84
+ | `ledger` | `budget.warning`, `budget.exceeded`, `session.complete` |
85
+ | `echo` | `suite.started`, `suite.complete`, `regression.detected` |
86
+ | `counsel` | `brief.generated` |
87
+ | `onlooker` | `session.summary` |
88
+ | `meridian` | `hint.generated`, `hint.delivered`, `outcome.recorded`, `reliance.measured`, `lesson.curated`, `playbook.updated` |
89
+
90
+ ## API surface
91
+
92
+ ### Values
93
+
94
+ - `createEvent(params)` — factory that fills in `id`, `timestamp`, `sequence`, `schema_version`, and `redacted: false`.
95
+ - `validate(raw)` — returns `{ valid: true, event } | { valid: false, errors }`.
96
+ - `validateOrThrow(raw)` — returns the typed event or throws with field paths in the message.
97
+ - `isEventOfType(event, type)` — type guard that narrows `payload` to the matching interface.
98
+ - `isEventType(value)` — runtime check that a string is a known event type.
99
+ - `ALL_EVENT_TYPES` — `readonly EventType[]` of every known type.
100
+ - One typed string constant per event (e.g. `SENTINEL_BLOCKED`, `MERIDIAN_HINT_GENERATED`).
101
+ - `_resetSequence()` — resets the module-level sequence counter. Tests only.
102
+
103
+ ### Types
104
+
105
+ - `OnlookerEvent<T>`, `PayloadFor<T>`, `EventType`, `RuntimeId`.
106
+ - One payload interface per event type (`SentinelBlockedPayload`, `TribunalVerdictPayload`, …).
107
+ - `ValidationResult`, `ValidationErrorDetail`, `CreateEventParams<T>`.
108
+
109
+ ## JSON Schema files
110
+
111
+ The raw JSON Schema (draft 2020-12) files are shipped alongside the JS for non-TypeScript consumers (Go, Python, Rust, …):
112
+
113
+ ```ts
114
+ import envelope from "@onlooker-community/schema/schemas/event.v1.json" with { type: "json" };
115
+ import sessionPayloads from "@onlooker-community/schema/schemas/payload/session.json" with { type: "json" };
116
+ ```
117
+
118
+ Or resolve paths with `node`'s package resolution:
119
+
120
+ ```bash
121
+ node -p "require.resolve('@onlooker-community/schema/schemas/event.v1.json')"
122
+ ```
123
+
124
+ ## Versioning policy
125
+
126
+ - The `schema_version` field is locked at `"1.0"` for the entire `1.x` line of this package.
127
+ - Adding a new event type, adding an optional payload field, or relaxing an enum is a **minor** release.
128
+ - Removing an event type, making an optional field required, tightening an enum, or changing `additionalProperties` is a **major** release and bumps `schema_version`.
129
+ - Payload schemas for `task.start`, `task.complete`, and `task.fail` are intentionally minimal in `1.0.0` and will be filled in during the `1.x` line.
130
+
131
+ ## Development
132
+
133
+ ```bash
134
+ npm install
135
+ npm run typecheck
136
+ npm test
137
+ npm run validate-schemas
138
+ npm run build
139
+ ```
140
+
141
+ `npm run prepublishOnly` runs `build`, `validate-schemas`, and `test` and is enforced before publishing.
@@ -0,0 +1,53 @@
1
+ export declare const SESSION_START: "session.start";
2
+ export declare const SESSION_END: "session.end";
3
+ export declare const SESSION_COMPACT: "session.compact";
4
+ export declare const SESSION_PROMPT: "session.prompt";
5
+ export declare const TASK_START: "task.start";
6
+ export declare const TASK_COMPLETE: "task.complete";
7
+ export declare const TASK_FAIL: "task.fail";
8
+ export declare const TOOL_FILE_READ: "tool.file.read";
9
+ export declare const TOOL_FILE_WRITE: "tool.file.write";
10
+ export declare const TOOL_FILE_EDIT: "tool.file.edit";
11
+ export declare const TOOL_SHELL_EXEC: "tool.shell.exec";
12
+ export declare const TOOL_WEB_FETCH: "tool.web.fetch";
13
+ export declare const TOOL_AGENT_SPAWN: "tool.agent.spawn";
14
+ export declare const TOOL_AGENT_COMPLETE: "tool.agent.complete";
15
+ export declare const SENTINEL_BLOCKED: "sentinel.blocked";
16
+ export declare const SENTINEL_ALLOWED: "sentinel.allowed";
17
+ export declare const SENTINEL_REVIEWED: "sentinel.reviewed";
18
+ export declare const TRIBUNAL_VERDICT: "tribunal.verdict";
19
+ export declare const TRIBUNAL_ACTOR_COMPLETE: "tribunal.actor.complete";
20
+ export declare const TRIBUNAL_META_COMPLETE: "tribunal.meta.complete";
21
+ export declare const WARDEN_THREAT_DETECTED: "warden.threat.detected";
22
+ export declare const WARDEN_THREAT_CLEARED: "warden.threat.cleared";
23
+ export declare const WARDEN_GATE_BLOCKED: "warden.gate.blocked";
24
+ export declare const ORACLE_CALIBRATION_REQUESTED: "oracle.calibration.requested";
25
+ export declare const ORACLE_CALIBRATION_COMPLETE: "oracle.calibration.complete";
26
+ export declare const ARCHIVIST_EXTRACT_COMPLETE: "archivist.extract.complete";
27
+ export declare const ARCHIVIST_INJECT_COMPLETE: "archivist.inject.complete";
28
+ export declare const RELAY_HANDOFF_CAPTURED: "relay.handoff.captured";
29
+ export declare const RELAY_HANDOFF_INJECTED: "relay.handoff.injected";
30
+ export declare const SCRIBE_CAPTURE_COMPLETE: "scribe.capture.complete";
31
+ export declare const SCRIBE_DISTILL_COMPLETE: "scribe.distill.complete";
32
+ export declare const CUES_MATCHED: "cues.matched";
33
+ export declare const CUES_APPLIED: "cues.applied";
34
+ export declare const LEDGER_BUDGET_WARNING: "ledger.budget.warning";
35
+ export declare const LEDGER_BUDGET_EXCEEDED: "ledger.budget.exceeded";
36
+ export declare const LEDGER_SESSION_COMPLETE: "ledger.session.complete";
37
+ export declare const ECHO_SUITE_STARTED: "echo.suite.started";
38
+ export declare const ECHO_SUITE_COMPLETE: "echo.suite.complete";
39
+ export declare const ECHO_REGRESSION_DETECTED: "echo.regression.detected";
40
+ export declare const CARTOGRAPHER_AUDIT_COMPLETE: "cartographer.audit.complete";
41
+ export declare const CARTOGRAPHER_ISSUE_FOUND: "cartographer.issue.found";
42
+ export declare const COUNSEL_BRIEF_GENERATED: "counsel.brief.generated";
43
+ export declare const ONLOOKER_SESSION_SUMMARY: "onlooker.session.summary";
44
+ export declare const MERIDIAN_HINT_GENERATED: "meridian.hint.generated";
45
+ export declare const MERIDIAN_HINT_DELIVERED: "meridian.hint.delivered";
46
+ export declare const MERIDIAN_OUTCOME_RECORDED: "meridian.outcome.recorded";
47
+ export declare const MERIDIAN_RELIANCE_MEASURED: "meridian.reliance.measured";
48
+ export declare const MERIDIAN_LESSON_CURATED: "meridian.lesson.curated";
49
+ export declare const MERIDIAN_PLAYBOOK_UPDATED: "meridian.playbook.updated";
50
+ export declare const ALL_EVENT_TYPES: readonly ["session.start", "session.end", "session.compact", "session.prompt", "task.start", "task.complete", "task.fail", "tool.file.read", "tool.file.write", "tool.file.edit", "tool.shell.exec", "tool.web.fetch", "tool.agent.spawn", "tool.agent.complete", "sentinel.blocked", "sentinel.allowed", "sentinel.reviewed", "tribunal.verdict", "tribunal.actor.complete", "tribunal.meta.complete", "warden.threat.detected", "warden.threat.cleared", "warden.gate.blocked", "oracle.calibration.requested", "oracle.calibration.complete", "archivist.extract.complete", "archivist.inject.complete", "relay.handoff.captured", "relay.handoff.injected", "scribe.capture.complete", "scribe.distill.complete", "cues.matched", "cues.applied", "ledger.budget.warning", "ledger.budget.exceeded", "ledger.session.complete", "echo.suite.started", "echo.suite.complete", "echo.regression.detected", "cartographer.audit.complete", "cartographer.issue.found", "counsel.brief.generated", "onlooker.session.summary", "meridian.hint.generated", "meridian.hint.delivered", "meridian.outcome.recorded", "meridian.reliance.measured", "meridian.lesson.curated", "meridian.playbook.updated"];
51
+ export type EventType = (typeof ALL_EVENT_TYPES)[number];
52
+ export declare function isEventType(value: string): value is EventType;
53
+ //# sourceMappingURL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OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE7D"}
@@ -0,0 +1,105 @@
1
+ export const SESSION_START = "session.start";
2
+ export const SESSION_END = "session.end";
3
+ export const SESSION_COMPACT = "session.compact";
4
+ export const SESSION_PROMPT = "session.prompt";
5
+ export const TASK_START = "task.start";
6
+ export const TASK_COMPLETE = "task.complete";
7
+ export const TASK_FAIL = "task.fail";
8
+ export const TOOL_FILE_READ = "tool.file.read";
9
+ export const TOOL_FILE_WRITE = "tool.file.write";
10
+ export const TOOL_FILE_EDIT = "tool.file.edit";
11
+ export const TOOL_SHELL_EXEC = "tool.shell.exec";
12
+ export const TOOL_WEB_FETCH = "tool.web.fetch";
13
+ export const TOOL_AGENT_SPAWN = "tool.agent.spawn";
14
+ export const TOOL_AGENT_COMPLETE = "tool.agent.complete";
15
+ export const SENTINEL_BLOCKED = "sentinel.blocked";
16
+ export const SENTINEL_ALLOWED = "sentinel.allowed";
17
+ export const SENTINEL_REVIEWED = "sentinel.reviewed";
18
+ export const TRIBUNAL_VERDICT = "tribunal.verdict";
19
+ export const TRIBUNAL_ACTOR_COMPLETE = "tribunal.actor.complete";
20
+ export const TRIBUNAL_META_COMPLETE = "tribunal.meta.complete";
21
+ export const WARDEN_THREAT_DETECTED = "warden.threat.detected";
22
+ export const WARDEN_THREAT_CLEARED = "warden.threat.cleared";
23
+ export const WARDEN_GATE_BLOCKED = "warden.gate.blocked";
24
+ export const ORACLE_CALIBRATION_REQUESTED = "oracle.calibration.requested";
25
+ export const ORACLE_CALIBRATION_COMPLETE = "oracle.calibration.complete";
26
+ export const ARCHIVIST_EXTRACT_COMPLETE = "archivist.extract.complete";
27
+ export const ARCHIVIST_INJECT_COMPLETE = "archivist.inject.complete";
28
+ export const RELAY_HANDOFF_CAPTURED = "relay.handoff.captured";
29
+ export const RELAY_HANDOFF_INJECTED = "relay.handoff.injected";
30
+ export const SCRIBE_CAPTURE_COMPLETE = "scribe.capture.complete";
31
+ export const SCRIBE_DISTILL_COMPLETE = "scribe.distill.complete";
32
+ export const CUES_MATCHED = "cues.matched";
33
+ export const CUES_APPLIED = "cues.applied";
34
+ export const LEDGER_BUDGET_WARNING = "ledger.budget.warning";
35
+ export const LEDGER_BUDGET_EXCEEDED = "ledger.budget.exceeded";
36
+ export const LEDGER_SESSION_COMPLETE = "ledger.session.complete";
37
+ export const ECHO_SUITE_STARTED = "echo.suite.started";
38
+ export const ECHO_SUITE_COMPLETE = "echo.suite.complete";
39
+ export const ECHO_REGRESSION_DETECTED = "echo.regression.detected";
40
+ export const CARTOGRAPHER_AUDIT_COMPLETE = "cartographer.audit.complete";
41
+ export const CARTOGRAPHER_ISSUE_FOUND = "cartographer.issue.found";
42
+ export const COUNSEL_BRIEF_GENERATED = "counsel.brief.generated";
43
+ export const ONLOOKER_SESSION_SUMMARY = "onlooker.session.summary";
44
+ export const MERIDIAN_HINT_GENERATED = "meridian.hint.generated";
45
+ export const MERIDIAN_HINT_DELIVERED = "meridian.hint.delivered";
46
+ export const MERIDIAN_OUTCOME_RECORDED = "meridian.outcome.recorded";
47
+ export const MERIDIAN_RELIANCE_MEASURED = "meridian.reliance.measured";
48
+ export const MERIDIAN_LESSON_CURATED = "meridian.lesson.curated";
49
+ export const MERIDIAN_PLAYBOOK_UPDATED = "meridian.playbook.updated";
50
+ export const ALL_EVENT_TYPES = [
51
+ SESSION_START,
52
+ SESSION_END,
53
+ SESSION_COMPACT,
54
+ SESSION_PROMPT,
55
+ TASK_START,
56
+ TASK_COMPLETE,
57
+ TASK_FAIL,
58
+ TOOL_FILE_READ,
59
+ TOOL_FILE_WRITE,
60
+ TOOL_FILE_EDIT,
61
+ TOOL_SHELL_EXEC,
62
+ TOOL_WEB_FETCH,
63
+ TOOL_AGENT_SPAWN,
64
+ TOOL_AGENT_COMPLETE,
65
+ SENTINEL_BLOCKED,
66
+ SENTINEL_ALLOWED,
67
+ SENTINEL_REVIEWED,
68
+ TRIBUNAL_VERDICT,
69
+ TRIBUNAL_ACTOR_COMPLETE,
70
+ TRIBUNAL_META_COMPLETE,
71
+ WARDEN_THREAT_DETECTED,
72
+ WARDEN_THREAT_CLEARED,
73
+ WARDEN_GATE_BLOCKED,
74
+ ORACLE_CALIBRATION_REQUESTED,
75
+ ORACLE_CALIBRATION_COMPLETE,
76
+ ARCHIVIST_EXTRACT_COMPLETE,
77
+ ARCHIVIST_INJECT_COMPLETE,
78
+ RELAY_HANDOFF_CAPTURED,
79
+ RELAY_HANDOFF_INJECTED,
80
+ SCRIBE_CAPTURE_COMPLETE,
81
+ SCRIBE_DISTILL_COMPLETE,
82
+ CUES_MATCHED,
83
+ CUES_APPLIED,
84
+ LEDGER_BUDGET_WARNING,
85
+ LEDGER_BUDGET_EXCEEDED,
86
+ LEDGER_SESSION_COMPLETE,
87
+ ECHO_SUITE_STARTED,
88
+ ECHO_SUITE_COMPLETE,
89
+ ECHO_REGRESSION_DETECTED,
90
+ CARTOGRAPHER_AUDIT_COMPLETE,
91
+ CARTOGRAPHER_ISSUE_FOUND,
92
+ COUNSEL_BRIEF_GENERATED,
93
+ ONLOOKER_SESSION_SUMMARY,
94
+ MERIDIAN_HINT_GENERATED,
95
+ MERIDIAN_HINT_DELIVERED,
96
+ MERIDIAN_OUTCOME_RECORDED,
97
+ MERIDIAN_RELIANCE_MEASURED,
98
+ MERIDIAN_LESSON_CURATED,
99
+ MERIDIAN_PLAYBOOK_UPDATED,
100
+ ];
101
+ const EVENT_TYPE_SET = new Set(ALL_EVENT_TYPES);
102
+ export function isEventType(value) {
103
+ return EVENT_TYPE_SET.has(value);
104
+ }
105
+ //# sourceMappingURL=event-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-types.js","sourceRoot":"","sources":["../src/event-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,eAAwB,CAAC;AACtD,MAAM,CAAC,MAAM,WAAW,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,MAAM,yBAAyB,GAAG,2BAAoC,CAAC;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,WAAW;IACX,eAAe;IACf,cAAc;IACd,UAAU;IACV,aAAa;IACb,SAAS;IACT,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,uBAAuB;IACvB,sBAAsB;IACtB,sBAAsB;IACtB,qBAAqB;IACrB,mBAAmB;IACnB,4BAA4B;IAC5B,2BAA2B;IAC3B,0BAA0B;IAC1B,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,YAAY;IACZ,YAAY;IACZ,qBAAqB;IACrB,sBAAsB;IACtB,uBAAuB;IACvB,kBAAkB;IAClB,mBAAmB;IACnB,wBAAwB;IACxB,2BAA2B;IAC3B,wBAAwB;IACxB,uBAAuB;IACvB,wBAAwB;IACxB,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,0BAA0B;IAC1B,uBAAuB;IACvB,yBAAyB;CACjB,CAAC;AAIX,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAErE,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { ALL_EVENT_TYPES, isEventType, SESSION_START, SESSION_END, SESSION_COMPACT, SESSION_PROMPT, TASK_START, TASK_COMPLETE, TASK_FAIL, TOOL_FILE_READ, TOOL_FILE_WRITE, TOOL_FILE_EDIT, TOOL_SHELL_EXEC, TOOL_WEB_FETCH, TOOL_AGENT_SPAWN, TOOL_AGENT_COMPLETE, SENTINEL_BLOCKED, SENTINEL_ALLOWED, SENTINEL_REVIEWED, TRIBUNAL_VERDICT, TRIBUNAL_ACTOR_COMPLETE, TRIBUNAL_META_COMPLETE, WARDEN_THREAT_DETECTED, WARDEN_THREAT_CLEARED, WARDEN_GATE_BLOCKED, ORACLE_CALIBRATION_REQUESTED, ORACLE_CALIBRATION_COMPLETE, ARCHIVIST_EXTRACT_COMPLETE, ARCHIVIST_INJECT_COMPLETE, RELAY_HANDOFF_CAPTURED, RELAY_HANDOFF_INJECTED, SCRIBE_CAPTURE_COMPLETE, SCRIBE_DISTILL_COMPLETE, CUES_MATCHED, CUES_APPLIED, LEDGER_BUDGET_WARNING, LEDGER_BUDGET_EXCEEDED, LEDGER_SESSION_COMPLETE, ECHO_SUITE_STARTED, ECHO_SUITE_COMPLETE, ECHO_REGRESSION_DETECTED, CARTOGRAPHER_AUDIT_COMPLETE, CARTOGRAPHER_ISSUE_FOUND, COUNSEL_BRIEF_GENERATED, ONLOOKER_SESSION_SUMMARY, MERIDIAN_HINT_GENERATED, MERIDIAN_HINT_DELIVERED, MERIDIAN_OUTCOME_RECORDED, MERIDIAN_RELIANCE_MEASURED, MERIDIAN_LESSON_CURATED, MERIDIAN_PLAYBOOK_UPDATED, } from "./event-types.js";
2
+ export type { EventType } from "./event-types.js";
3
+ export type { OnlookerEvent, PayloadFor, RuntimeId, SessionStartPayload, SessionEndPayload, SessionCompactPayload, SessionPromptPayload, ToolFileReadPayload, ToolFileWritePayload, ToolFileEditPayload, ToolShellExecPayload, ToolWebFetchPayload, ToolAgentSpawnPayload, ToolAgentCompletePayload, SentinelBlockedPayload, SentinelAllowedPayload, SentinelReviewedPayload, TribunalVerdictPayload, TribunalActorCompletePayload, TribunalMetaCompletePayload, WardenThreatDetectedPayload, WardenThreatClearedPayload, WardenGateBlockedPayload, OracleCalibrationRequestedPayload, OracleCalibrationCompletePayload, ArchivistExtractCompletePayload, ArchivistInjectCompletePayload, RelayHandoffCapturedPayload, RelayHandoffInjectedPayload, ScribeCaptureCompletePayload, ScribeDistillCompletePayload, CuesMatchedPayload, CuesAppliedPayload, CartographerAuditCompletePayload, CartographerIssueCategories, CartographerIssueFoundPayload, LedgerBudgetWarningPayload, LedgerBudgetExceededPayload, LedgerSessionCompletePayload, EchoSuiteStartedPayload, EchoSuiteCompletePayload, EchoRegressionDetectedPayload, CounselBriefGeneratedPayload, CounselSource, OnlookerSessionSummaryPayload, OnlookerToolCounts, MeridianHintGeneratedPayload, MeridianHintDeliveredPayload, MeridianOutcomeRecordedPayload, MeridianRelianceMeasuredPayload, MeridianLessonCuratedPayload, MeridianPlaybookUpdatedPayload, MeridianTaskType, } from "./types.js";
4
+ export { validate, validateOrThrow, createEvent, isEventOfType, _resetSequence, } from "./validate.js";
5
+ export type { ValidationResult, ValidationErrorDetail, CreateEventParams, } from "./validate.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,8BAA8B,EAC9B,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,EAClB,gCAAgC,EAChC,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,4BAA4B,EAC5B,aAAa,EACb,6BAA6B,EAC7B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,4BAA4B,EAC5B,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ALL_EVENT_TYPES, isEventType, SESSION_START, SESSION_END, SESSION_COMPACT, SESSION_PROMPT, TASK_START, TASK_COMPLETE, TASK_FAIL, TOOL_FILE_READ, TOOL_FILE_WRITE, TOOL_FILE_EDIT, TOOL_SHELL_EXEC, TOOL_WEB_FETCH, TOOL_AGENT_SPAWN, TOOL_AGENT_COMPLETE, SENTINEL_BLOCKED, SENTINEL_ALLOWED, SENTINEL_REVIEWED, TRIBUNAL_VERDICT, TRIBUNAL_ACTOR_COMPLETE, TRIBUNAL_META_COMPLETE, WARDEN_THREAT_DETECTED, WARDEN_THREAT_CLEARED, WARDEN_GATE_BLOCKED, ORACLE_CALIBRATION_REQUESTED, ORACLE_CALIBRATION_COMPLETE, ARCHIVIST_EXTRACT_COMPLETE, ARCHIVIST_INJECT_COMPLETE, RELAY_HANDOFF_CAPTURED, RELAY_HANDOFF_INJECTED, SCRIBE_CAPTURE_COMPLETE, SCRIBE_DISTILL_COMPLETE, CUES_MATCHED, CUES_APPLIED, LEDGER_BUDGET_WARNING, LEDGER_BUDGET_EXCEEDED, LEDGER_SESSION_COMPLETE, ECHO_SUITE_STARTED, ECHO_SUITE_COMPLETE, ECHO_REGRESSION_DETECTED, CARTOGRAPHER_AUDIT_COMPLETE, CARTOGRAPHER_ISSUE_FOUND, COUNSEL_BRIEF_GENERATED, ONLOOKER_SESSION_SUMMARY, MERIDIAN_HINT_GENERATED, MERIDIAN_HINT_DELIVERED, MERIDIAN_OUTCOME_RECORDED, MERIDIAN_RELIANCE_MEASURED, MERIDIAN_LESSON_CURATED, MERIDIAN_PLAYBOOK_UPDATED, } from "./event-types.js";
2
+ export { validate, validateOrThrow, createEvent, isEventOfType, _resetSequence, } from "./validate.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AA4D1B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC"}
@@ -0,0 +1,320 @@
1
+ import type { EventType } from "./event-types.js";
2
+ export type RuntimeId = "claude-code" | "cursor" | "copilot" | "gemini" | "custom";
3
+ export interface SessionStartPayload {
4
+ working_directory: string;
5
+ git_branch?: string;
6
+ git_commit?: string;
7
+ resume_of_session_id?: string;
8
+ }
9
+ export interface SessionEndPayload {
10
+ duration_ms: number;
11
+ turn_count: number;
12
+ total_cost_usd?: number;
13
+ total_tokens?: number;
14
+ end_reason?: "user_exit" | "timeout" | "error" | "task_complete" | "unknown";
15
+ }
16
+ export interface SessionCompactPayload {
17
+ tokens_before: number;
18
+ tokens_after: number;
19
+ compression_ratio?: number;
20
+ }
21
+ export interface SessionPromptPayload {
22
+ turn_number: number;
23
+ input_summary?: string;
24
+ context_tokens?: number;
25
+ }
26
+ export interface ToolFileReadPayload {
27
+ path: string;
28
+ lines_read?: number;
29
+ file_size_bytes?: number;
30
+ }
31
+ export interface ToolFileWritePayload {
32
+ path: string;
33
+ operation: "create" | "overwrite";
34
+ bytes_written?: number;
35
+ lines_written?: number;
36
+ }
37
+ export interface ToolFileEditPayload {
38
+ path: string;
39
+ lines_changed?: number;
40
+ }
41
+ export interface ToolShellExecPayload {
42
+ command: string;
43
+ exit_code?: number;
44
+ duration_ms?: number;
45
+ working_directory?: string;
46
+ blocked?: boolean;
47
+ }
48
+ export interface ToolWebFetchPayload {
49
+ url: string;
50
+ status_code?: number;
51
+ response_bytes?: number;
52
+ blocked?: boolean;
53
+ }
54
+ export interface ToolAgentSpawnPayload {
55
+ subagent_id: string;
56
+ agent_name?: string;
57
+ task_summary?: string;
58
+ blocked?: boolean;
59
+ }
60
+ export interface ToolAgentCompletePayload {
61
+ subagent_id: string;
62
+ success: boolean;
63
+ agent_name?: string;
64
+ duration_ms?: number;
65
+ cost_usd?: number;
66
+ output_summary?: string;
67
+ }
68
+ export interface SentinelBlockedPayload {
69
+ command: string;
70
+ risk_level: "critical" | "high" | "medium";
71
+ matched_pattern: string;
72
+ reason?: string;
73
+ }
74
+ export interface SentinelAllowedPayload {
75
+ command: string;
76
+ risk_level: "low" | "none";
77
+ review_required?: boolean;
78
+ }
79
+ export interface SentinelReviewedPayload {
80
+ command: string;
81
+ decision: "approved" | "rejected";
82
+ review_duration_ms?: number;
83
+ }
84
+ export interface TribunalVerdictPayload {
85
+ task_id: string;
86
+ score: number;
87
+ passed: boolean;
88
+ judge_type: "standard" | "security" | "maintainability" | "adversarial" | "domain" | "meta";
89
+ feedback_summary?: string;
90
+ file_path?: string;
91
+ }
92
+ export interface TribunalActorCompletePayload {
93
+ task_id: string;
94
+ success: boolean;
95
+ duration_ms?: number;
96
+ skepticism_rounds?: number;
97
+ }
98
+ export interface TribunalMetaCompletePayload {
99
+ task_id: string;
100
+ verdict_quality: "sound" | "questionable" | "biased";
101
+ bias_detected: boolean;
102
+ override_recommendation?: "accept" | "reject" | "re-evaluate";
103
+ }
104
+ export interface WardenThreatDetectedPayload {
105
+ source_type: "web_fetch" | "file_read";
106
+ threat_type: "prompt_injection" | "instruction_override" | "credential_exfiltration" | "command_injection" | "social_engineering";
107
+ confidence: number;
108
+ source_url?: string;
109
+ source_path?: string;
110
+ snippet?: string;
111
+ }
112
+ export interface WardenThreatClearedPayload {
113
+ source_type: "web_fetch" | "file_read";
114
+ cleared_by?: "timeout" | "user_override" | "subsequent_scan_clean";
115
+ }
116
+ export interface WardenGateBlockedPayload {
117
+ blocked_operation: "tool.file.write" | "tool.file.edit" | "tool.shell.exec";
118
+ threat_source_type: "web_fetch" | "file_read";
119
+ }
120
+ export interface OracleCalibrationRequestedPayload {
121
+ trigger: "user_prompt" | "pre_write" | "pre_bash";
122
+ task_summary?: string;
123
+ }
124
+ export interface OracleCalibrationCompletePayload {
125
+ trigger: "user_prompt" | "pre_write" | "pre_bash";
126
+ confidence_score: number;
127
+ intervened: boolean;
128
+ misalignment_detected?: boolean;
129
+ }
130
+ export interface ArchivistExtractCompletePayload {
131
+ session_id: string;
132
+ item_count: number;
133
+ decision_count?: number;
134
+ dead_end_count?: number;
135
+ open_question_count?: number;
136
+ file_count?: number;
137
+ trigger?: "pre_compact" | "session_end" | "manual";
138
+ }
139
+ export interface ArchivistInjectCompletePayload {
140
+ source_session_id: string;
141
+ items_injected: number;
142
+ items_available?: number;
143
+ }
144
+ export interface RelayHandoffCapturedPayload {
145
+ session_id: string;
146
+ tasks_in_progress?: number;
147
+ blocking_questions?: number;
148
+ files_in_flight?: number;
149
+ }
150
+ export interface RelayHandoffInjectedPayload {
151
+ source_session_id: string;
152
+ age_ms?: number;
153
+ }
154
+ export interface ScribeCaptureCompletePayload {
155
+ file_path: string;
156
+ operation: "write" | "edit";
157
+ intent_summary?: string;
158
+ }
159
+ export interface ScribeDistillCompletePayload {
160
+ session_id: string;
161
+ captures_processed: number;
162
+ artifacts_produced: number;
163
+ }
164
+ export interface CuesMatchedPayload {
165
+ cue_id: string;
166
+ match_type: "regex" | "vocabulary" | "semantic";
167
+ trigger_source: "prompt" | "command" | "file_path";
168
+ cue_name?: string;
169
+ }
170
+ export interface CuesAppliedPayload {
171
+ cue_id: string;
172
+ cue_name?: string;
173
+ guidance_length?: number;
174
+ }
175
+ export interface CartographerIssueCategories {
176
+ contradictions?: number;
177
+ stale_references?: number;
178
+ orphaned_plugins?: number;
179
+ dead_tools?: number;
180
+ duplicates?: number;
181
+ hierarchy_conflicts?: number;
182
+ }
183
+ export interface CartographerAuditCompletePayload {
184
+ files_audited: number;
185
+ issues_found: number;
186
+ trigger?: "instructions_loaded" | "config_change" | "manual";
187
+ issue_categories?: CartographerIssueCategories;
188
+ }
189
+ export interface CartographerIssueFoundPayload {
190
+ issue_type: "contradiction" | "stale_reference" | "orphaned_plugin" | "dead_tool" | "duplicate" | "hierarchy_conflict";
191
+ file_path: string;
192
+ severity: "error" | "warning" | "info";
193
+ description?: string;
194
+ }
195
+ export interface LedgerBudgetWarningPayload {
196
+ budget_usd: number;
197
+ spent_usd: number;
198
+ threshold_pct: number;
199
+ remaining_usd?: number;
200
+ }
201
+ export interface LedgerBudgetExceededPayload {
202
+ budget_usd: number;
203
+ spent_usd: number;
204
+ blocked_operation: string;
205
+ }
206
+ export interface LedgerSessionCompletePayload {
207
+ total_cost_usd: number;
208
+ budget_usd: number;
209
+ under_budget: boolean;
210
+ cost_by_plugin?: Record<string, number>;
211
+ }
212
+ export interface EchoSuiteStartedPayload {
213
+ suite_id: string;
214
+ test_count: number;
215
+ suite_name?: string;
216
+ trigger?: "config_change" | "manual";
217
+ changed_file?: string;
218
+ }
219
+ export interface EchoSuiteCompletePayload {
220
+ suite_id: string;
221
+ test_count: number;
222
+ improved: number;
223
+ degraded: number;
224
+ neutral: number;
225
+ merge_recommended?: boolean;
226
+ duration_ms?: number;
227
+ }
228
+ export interface EchoRegressionDetectedPayload {
229
+ suite_id: string;
230
+ test_id: string;
231
+ score_before: number;
232
+ score_after: number;
233
+ test_name?: string;
234
+ delta?: number;
235
+ }
236
+ export type CounselSource = "onlooker_events" | "tribunal_verdicts" | "echo_regressions" | "sentinel_audit" | "warden_audit" | "oracle_calibrations" | "meridian_reliance";
237
+ export interface CounselBriefGeneratedPayload {
238
+ period_start: string;
239
+ period_end: string;
240
+ recommendation_count: number;
241
+ sources_consulted?: CounselSource[];
242
+ }
243
+ export interface OnlookerToolCounts {
244
+ file_reads?: number;
245
+ file_writes?: number;
246
+ file_edits?: number;
247
+ shell_execs?: number;
248
+ web_fetches?: number;
249
+ agent_spawns?: number;
250
+ }
251
+ export interface OnlookerSessionSummaryPayload {
252
+ session_id: string;
253
+ duration_ms: number;
254
+ event_count: number;
255
+ tool_counts?: OnlookerToolCounts;
256
+ }
257
+ export type MeridianTaskType = "code" | "reasoning" | "writing" | "general";
258
+ export interface MeridianHintGeneratedPayload {
259
+ hint_id: string;
260
+ case_id: string;
261
+ task_type: MeridianTaskType;
262
+ failure_type: "wrong_approach" | "missing_concept" | "implementation_error" | "misunderstood_task" | "out_of_scope";
263
+ hint_direction: "reframe" | "missing_tool" | "intermediate_goal" | "alternative_representation" | "constraint_reminder";
264
+ target_concept?: string;
265
+ signal_creation?: number;
266
+ signal_transfer?: number;
267
+ playbook_bullets_injected?: number;
268
+ }
269
+ export interface MeridianHintDeliveredPayload {
270
+ hint_id: string;
271
+ case_id: string;
272
+ delivery_mode: "append" | "comment" | "inline" | "aside";
273
+ }
274
+ export interface MeridianOutcomeRecordedPayload {
275
+ hint_id: string;
276
+ case_id: string;
277
+ succeeded: boolean;
278
+ attempts_after_hint: number;
279
+ hint_referenced?: boolean;
280
+ time_to_success_ms?: number;
281
+ }
282
+ export interface MeridianRelianceMeasuredPayload {
283
+ hint_id: string;
284
+ case_id: string;
285
+ score: number;
286
+ assessment: "low" | "medium" | "high";
287
+ method: "logprob" | "judge";
288
+ }
289
+ export interface MeridianLessonCuratedPayload {
290
+ bullet_id: string;
291
+ case_id: string;
292
+ category: "failure_pattern" | "successful_hint" | "task_strategy" | "tool_usage";
293
+ task_type: MeridianTaskType;
294
+ target_concept: string;
295
+ origin?: "agent_failure" | "human_session" | "manual";
296
+ }
297
+ export interface MeridianPlaybookUpdatedPayload {
298
+ scope_id: string;
299
+ operation: "append" | "update" | "deduplicate" | "promote" | "retire";
300
+ bullet_count_after: number;
301
+ bullets_removed?: number;
302
+ }
303
+ export type PayloadFor<T extends EventType> = T extends "session.start" ? SessionStartPayload : T extends "session.end" ? SessionEndPayload : T extends "session.compact" ? SessionCompactPayload : T extends "session.prompt" ? SessionPromptPayload : T extends "tool.file.read" ? ToolFileReadPayload : T extends "tool.file.write" ? ToolFileWritePayload : T extends "tool.file.edit" ? ToolFileEditPayload : T extends "tool.shell.exec" ? ToolShellExecPayload : T extends "tool.web.fetch" ? ToolWebFetchPayload : T extends "tool.agent.spawn" ? ToolAgentSpawnPayload : T extends "tool.agent.complete" ? ToolAgentCompletePayload : T extends "sentinel.blocked" ? SentinelBlockedPayload : T extends "sentinel.allowed" ? SentinelAllowedPayload : T extends "sentinel.reviewed" ? SentinelReviewedPayload : T extends "tribunal.verdict" ? TribunalVerdictPayload : T extends "tribunal.actor.complete" ? TribunalActorCompletePayload : T extends "tribunal.meta.complete" ? TribunalMetaCompletePayload : T extends "warden.threat.detected" ? WardenThreatDetectedPayload : T extends "warden.threat.cleared" ? WardenThreatClearedPayload : T extends "warden.gate.blocked" ? WardenGateBlockedPayload : T extends "oracle.calibration.requested" ? OracleCalibrationRequestedPayload : T extends "oracle.calibration.complete" ? OracleCalibrationCompletePayload : T extends "archivist.extract.complete" ? ArchivistExtractCompletePayload : T extends "archivist.inject.complete" ? ArchivistInjectCompletePayload : T extends "relay.handoff.captured" ? RelayHandoffCapturedPayload : T extends "relay.handoff.injected" ? RelayHandoffInjectedPayload : T extends "scribe.capture.complete" ? ScribeCaptureCompletePayload : T extends "scribe.distill.complete" ? ScribeDistillCompletePayload : T extends "cues.matched" ? CuesMatchedPayload : T extends "cues.applied" ? CuesAppliedPayload : T extends "ledger.budget.warning" ? LedgerBudgetWarningPayload : T extends "ledger.budget.exceeded" ? LedgerBudgetExceededPayload : T extends "ledger.session.complete" ? LedgerSessionCompletePayload : T extends "echo.suite.started" ? EchoSuiteStartedPayload : T extends "echo.suite.complete" ? EchoSuiteCompletePayload : T extends "echo.regression.detected" ? EchoRegressionDetectedPayload : T extends "cartographer.audit.complete" ? CartographerAuditCompletePayload : T extends "cartographer.issue.found" ? CartographerIssueFoundPayload : T extends "counsel.brief.generated" ? CounselBriefGeneratedPayload : T extends "onlooker.session.summary" ? OnlookerSessionSummaryPayload : T extends "meridian.hint.generated" ? MeridianHintGeneratedPayload : T extends "meridian.hint.delivered" ? MeridianHintDeliveredPayload : T extends "meridian.outcome.recorded" ? MeridianOutcomeRecordedPayload : T extends "meridian.reliance.measured" ? MeridianRelianceMeasuredPayload : T extends "meridian.lesson.curated" ? MeridianLessonCuratedPayload : T extends "meridian.playbook.updated" ? MeridianPlaybookUpdatedPayload : Record<string, unknown>;
304
+ export interface OnlookerEvent<T extends EventType = EventType> {
305
+ id: string;
306
+ schema_version: "1.0";
307
+ runtime: RuntimeId;
308
+ adapter_id?: string;
309
+ plugin: string;
310
+ machine_id: string;
311
+ timestamp: string;
312
+ session_id: string;
313
+ sequence: number;
314
+ event_type: T;
315
+ payload: PayloadFor<T>;
316
+ cost_usd?: number;
317
+ token_count?: number;
318
+ redacted?: boolean;
319
+ }
320
+ //# sourceMappingURL=types.d.ts.map