@orcareplay/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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Runtime constants mirroring the normative JSON Schema in `schema/`.
3
+ *
4
+ * The TypeScript types in `types.ts` are derived from these arrays, and
5
+ * `test/schema-parity.test.ts` proves the arrays equal the schema enums. That gives the
6
+ * same drift protection as codegen without a build step that can silently break.
7
+ */
8
+ export declare const SCHEMA_VERSION = "0.1.0";
9
+ export declare const EVENT_TYPES: readonly ["run.start", "run.end", "model.request", "model.response", "tool.call", "tool.result", "mcp.request", "mcp.response", "shell.exec", "shell.result", "fs.snapshot", "fs.change", "net.request", "net.response", "error", "divergence", "checkpoint", "fork", "route.decision", "session.snapshot", "note"];
10
+ export declare const ACTORS: readonly ["agent", "harness", "model", "orca", "gateway", "tool", "user"];
11
+ export declare const DIVERGENCE_LEVELS: readonly ["minor", "major"];
12
+ /** Match rungs from spec §4. Rung 1 is an exact canonical-hash match. */
13
+ export declare const MATCH_RUNGS: readonly [1, 2, 3, 4];
14
+ /** Payloads larger than this (serialized bytes) MUST spill to a blob. Spec §2.2. */
15
+ export declare const INLINE_PAYLOAD_LIMIT = 4096;
16
+ export declare const RUN_ID_PATTERN: RegExp;
17
+ export declare const BLOB_REF_PATTERN: RegExp;
18
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW,qTAsBd,CAAC;AAEX,eAAO,MAAM,MAAM,2EAA4E,CAAC;AAEhG,eAAO,MAAM,iBAAiB,6BAA8B,CAAC;AAE7D,yEAAyE;AACzE,eAAO,MAAM,WAAW,uBAAwB,CAAC;AAEjD,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,eAAO,MAAM,cAAc,QAAyB,CAAC;AACrD,eAAO,MAAM,gBAAgB,QAA0B,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Runtime constants mirroring the normative JSON Schema in `schema/`.
3
+ *
4
+ * The TypeScript types in `types.ts` are derived from these arrays, and
5
+ * `test/schema-parity.test.ts` proves the arrays equal the schema enums. That gives the
6
+ * same drift protection as codegen without a build step that can silently break.
7
+ */
8
+ export const SCHEMA_VERSION = '0.1.0';
9
+ export const EVENT_TYPES = [
10
+ 'run.start',
11
+ 'run.end',
12
+ 'model.request',
13
+ 'model.response',
14
+ 'tool.call',
15
+ 'tool.result',
16
+ 'mcp.request',
17
+ 'mcp.response',
18
+ 'shell.exec',
19
+ 'shell.result',
20
+ 'fs.snapshot',
21
+ 'fs.change',
22
+ 'net.request',
23
+ 'net.response',
24
+ 'error',
25
+ 'divergence',
26
+ 'checkpoint',
27
+ 'fork',
28
+ 'route.decision',
29
+ 'session.snapshot',
30
+ 'note',
31
+ ];
32
+ export const ACTORS = ['agent', 'harness', 'model', 'orca', 'gateway', 'tool', 'user'];
33
+ export const DIVERGENCE_LEVELS = ['minor', 'major'];
34
+ /** Match rungs from spec §4. Rung 1 is an exact canonical-hash match. */
35
+ export const MATCH_RUNGS = [1, 2, 3, 4];
36
+ /** Payloads larger than this (serialized bytes) MUST spill to a blob. Spec §2.2. */
37
+ export const INLINE_PAYLOAD_LIMIT = 4096;
38
+ export const RUN_ID_PATTERN = /^run_[0-9a-f]{6,32}$/;
39
+ export const BLOB_REF_PATTERN = /^sha256:[0-9a-f]{64}$/;
40
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW;IACX,SAAS;IACT,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,aAAa;IACb,cAAc;IACd,YAAY;IACZ,cAAc;IACd,aAAa;IACb,WAAW;IACX,aAAa;IACb,cAAc;IACd,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,MAAM;IACN,gBAAgB;IAChB,kBAAkB;IAClB,MAAM;CACE,CAAC;AAEX,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEhG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAE7D,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAC;AAEjD,oFAAoF;AACpF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './constants.js';
2
+ export * from './types.js';
3
+ export * from './validate.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './constants.js';
2
+ export * from './types.js';
3
+ export * from './validate.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { ACTORS, DIVERGENCE_LEVELS, EVENT_TYPES } from './constants.js';
2
+ export type EventType = (typeof EVENT_TYPES)[number];
3
+ export type Actor = (typeof ACTORS)[number];
4
+ export type DivergenceLevel = (typeof DIVERGENCE_LEVELS)[number];
5
+ /** A reference to a content-addressed payload. Spec §2.2. */
6
+ export interface BlobRef {
7
+ $blob: string;
8
+ bytes: number;
9
+ media_type?: string;
10
+ }
11
+ export type Payload = BlobRef | Record<string, unknown> | unknown[] | string | number | boolean;
12
+ /** One line of events.jsonl. Spec §2.1. */
13
+ export interface TraceEvent {
14
+ seq: number;
15
+ ts: string;
16
+ mono_us: number;
17
+ turn: number;
18
+ type: EventType;
19
+ actor: Actor;
20
+ causes?: number[];
21
+ attrs?: Record<string, unknown>;
22
+ payload?: Payload;
23
+ redacted?: string[];
24
+ }
25
+ export interface AdapterInfo {
26
+ id: string;
27
+ version?: string;
28
+ harness_version?: string;
29
+ }
30
+ export interface GitInfo {
31
+ head?: string;
32
+ branch?: string;
33
+ dirty?: boolean;
34
+ }
35
+ export interface Manifest {
36
+ schema_version: string;
37
+ run_id: string;
38
+ created_at: string;
39
+ ended_at?: string;
40
+ orca_version: string;
41
+ adapter: AdapterInfo;
42
+ argv: string[];
43
+ cwd: string;
44
+ env_allowlisted?: Record<string, string>;
45
+ git?: GitInfo;
46
+ platform?: {
47
+ os: string;
48
+ arch: string;
49
+ node: string;
50
+ };
51
+ counts?: {
52
+ events: number;
53
+ blobs: number;
54
+ };
55
+ redaction?: {
56
+ policy_version: number;
57
+ rules_fired?: Record<string, number>;
58
+ };
59
+ /** Set on forked runs. */
60
+ parent_run?: string;
61
+ fork_point?: number;
62
+ fork_model?: string;
63
+ exit_code?: number;
64
+ integrity?: {
65
+ events_sha256: string;
66
+ blob_count: number;
67
+ };
68
+ }
69
+ export interface RedactionRecord {
70
+ rule: string;
71
+ identifier: string;
72
+ placeholder: string;
73
+ count: number;
74
+ }
75
+ export interface RedactionsFile {
76
+ policy_version: number;
77
+ records: RedactionRecord[];
78
+ }
79
+ export declare function isBlobRef(value: unknown): value is BlobRef;
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7E,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,6DAA6D;AAC7D,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhG,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM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CAAA;KAAE,CAAC;CAC3D;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAO1D"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ export function isBlobRef(value) {
2
+ return (typeof value === 'object' &&
3
+ value !== null &&
4
+ typeof value.$blob === 'string' &&
5
+ typeof value.bytes === 'number');
6
+ }
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2EA,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAAiB,CAAC,KAAK,KAAK,QAAQ;QAC5C,OAAQ,KAAiB,CAAC,KAAK,KAAK,QAAQ,CAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Manifest, TraceEvent } from './types.js';
2
+ declare const eventSchema: Record<string, unknown>;
3
+ declare const manifestSchema: Record<string, unknown>;
4
+ export { eventSchema, manifestSchema };
5
+ export interface ValidationResult {
6
+ valid: boolean;
7
+ errors: string[];
8
+ }
9
+ export declare function validateEvent(value: unknown): ValidationResult;
10
+ export declare function validateManifest(value: unknown): ValidationResult;
11
+ export declare function assertEvent(value: unknown): asserts value is TraceEvent;
12
+ export declare function assertManifest(value: unknown): asserts value is Manifest;
13
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKvD,QAAA,MAAM,WAAW,EAA6C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACtF,QAAA,MAAM,cAAc,EAAgD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAQvC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAWD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAE9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAGvE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,QAAQ,CAGxE"}
@@ -0,0 +1,38 @@
1
+ import { createRequire } from 'node:module';
2
+ import { Ajv2020 } from 'ajv/dist/2020.js';
3
+ import addFormats from 'ajv-formats';
4
+ const require = createRequire(import.meta.url);
5
+ /* eslint-disable @typescript-eslint/no-var-requires */
6
+ const eventSchema = require('../schema/event.schema.json');
7
+ const manifestSchema = require('../schema/manifest.schema.json');
8
+ export { eventSchema, manifestSchema };
9
+ const ajv = new Ajv2020({ allErrors: true, strict: false });
10
+ addFormats.default(ajv);
11
+ const validateEventFn = ajv.compile(eventSchema);
12
+ const validateManifestFn = ajv.compile(manifestSchema);
13
+ function toResult(ok, errors) {
14
+ if (ok)
15
+ return { valid: true, errors: [] };
16
+ const list = errors ?? [];
17
+ return {
18
+ valid: false,
19
+ errors: list.map((e) => `${e.instancePath || '/'} ${e.message ?? 'invalid'}`.trim()),
20
+ };
21
+ }
22
+ export function validateEvent(value) {
23
+ return toResult(validateEventFn(value), validateEventFn.errors);
24
+ }
25
+ export function validateManifest(value) {
26
+ return toResult(validateManifestFn(value), validateManifestFn.errors);
27
+ }
28
+ export function assertEvent(value) {
29
+ const r = validateEvent(value);
30
+ if (!r.valid)
31
+ throw new Error(`invalid trace event: ${r.errors.join('; ')}`);
32
+ }
33
+ export function assertManifest(value) {
34
+ const r = validateManifest(value);
35
+ if (!r.valid)
36
+ throw new Error(`invalid manifest: ${r.errors.join('; ')}`);
37
+ }
38
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,uDAAuD;AACvD,MAAM,WAAW,GAAG,OAAO,CAAC,6BAA6B,CAA4B,CAAC;AACtF,MAAM,cAAc,GAAG,OAAO,CAAC,gCAAgC,CAA4B,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAEvC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5D,UAAU,CAAC,OAAO,CAAC,GAAY,CAAC,CAAC;AAEjC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACjD,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AAOvD,SAAS,QAAQ,CAAC,EAAW,EAAE,MAAe;IAC5C,IAAI,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,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 "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./schema/*": "./schema/*"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "schema"
15
+ ],
16
+ "dependencies": {
17
+ "ajv": "^8.17.1",
18
+ "ajv-formats": "^3.0.1"
19
+ }
20
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://orcareplay.dev/schema/v0/event.schema.json",
4
+ "title": "Orca Trace Event",
5
+ "type": "object",
6
+ "required": ["seq", "ts", "mono_us", "turn", "type", "actor"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "seq": { "type": "integer", "minimum": 0 },
10
+ "ts": { "type": "string", "format": "date-time" },
11
+ "mono_us": { "type": "integer", "minimum": 0 },
12
+ "turn": { "type": "integer", "minimum": 0 },
13
+ "type": {
14
+ "type": "string",
15
+ "enum": [
16
+ "run.start",
17
+ "run.end",
18
+ "model.request",
19
+ "model.response",
20
+ "tool.call",
21
+ "tool.result",
22
+ "mcp.request",
23
+ "mcp.response",
24
+ "shell.exec",
25
+ "shell.result",
26
+ "fs.snapshot",
27
+ "fs.change",
28
+ "net.request",
29
+ "net.response",
30
+ "error",
31
+ "divergence",
32
+ "checkpoint",
33
+ "fork",
34
+ "route.decision",
35
+ "session.snapshot",
36
+ "note"
37
+ ]
38
+ },
39
+ "actor": {
40
+ "type": "string",
41
+ "enum": ["agent", "harness", "model", "orca", "gateway", "tool", "user"]
42
+ },
43
+ "causes": { "type": "array", "items": { "type": "integer", "minimum": 0 } },
44
+ "attrs": { "type": "object" },
45
+ "payload": {
46
+ "oneOf": [
47
+ { "$ref": "#/$defs/blobRef" },
48
+ { "not": { "type": "object", "required": ["$blob"] } }
49
+ ]
50
+ },
51
+ "redacted": { "type": "array", "items": { "type": "string" } }
52
+ },
53
+ "$defs": {
54
+ "blobRef": {
55
+ "type": "object",
56
+ "required": ["$blob", "bytes"],
57
+ "additionalProperties": false,
58
+ "properties": {
59
+ "$blob": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
60
+ "bytes": { "type": "integer", "minimum": 0 },
61
+ "media_type": { "type": "string" }
62
+ }
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://orcareplay.dev/schema/v0/manifest.schema.json",
4
+ "title": "Orca Trace Manifest",
5
+ "type": "object",
6
+ "required": ["schema_version", "run_id", "created_at", "orca_version", "adapter", "argv", "cwd"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema_version": { "type": "string" },
10
+ "run_id": { "type": "string", "pattern": "^run_[0-9a-f]{6,32}$" },
11
+ "created_at": { "type": "string", "format": "date-time" },
12
+ "ended_at": { "type": "string", "format": "date-time" },
13
+ "orca_version": { "type": "string" },
14
+ "adapter": {
15
+ "type": "object",
16
+ "required": ["id"],
17
+ "additionalProperties": false,
18
+ "properties": {
19
+ "id": { "type": "string" },
20
+ "version": { "type": "string" },
21
+ "harness_version": { "type": "string" }
22
+ }
23
+ },
24
+ "argv": { "type": "array", "items": { "type": "string" } },
25
+ "cwd": { "type": "string" },
26
+ "env_allowlisted": { "type": "object", "additionalProperties": { "type": "string" } },
27
+ "git": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "head": { "type": "string" },
32
+ "branch": { "type": "string" },
33
+ "dirty": { "type": "boolean" }
34
+ }
35
+ },
36
+ "platform": {
37
+ "type": "object",
38
+ "required": ["os", "arch", "node"],
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "os": { "type": "string" },
42
+ "arch": { "type": "string" },
43
+ "node": { "type": "string" }
44
+ }
45
+ },
46
+ "counts": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "properties": { "events": { "type": "integer" }, "blobs": { "type": "integer" } }
50
+ },
51
+ "redaction": {
52
+ "type": "object",
53
+ "required": ["policy_version"],
54
+ "additionalProperties": false,
55
+ "properties": {
56
+ "policy_version": { "type": "integer" },
57
+ "rules_fired": { "type": "object", "additionalProperties": { "type": "integer" } }
58
+ }
59
+ },
60
+ "parent_run": { "type": "string", "pattern": "^run_[0-9a-f]{6,32}$" },
61
+ "fork_point": { "type": "integer", "minimum": 0 },
62
+ "fork_model": { "type": "string" },
63
+ "exit_code": { "type": "integer" },
64
+ "integrity": {
65
+ "type": "object",
66
+ "required": ["events_sha256", "blob_count"],
67
+ "additionalProperties": false,
68
+ "properties": {
69
+ "events_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
70
+ "blob_count": { "type": "integer", "minimum": 0 }
71
+ }
72
+ }
73
+ }
74
+ }