{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"title": "Amber Harness Event (v1)",
	"description": "ADR-0102 (F065 H0): one append-only, run-scoped, typed fact of the harness event ledger. This schema validates the event BODY as submitted; the governed-ledger core adds the chain fields (prevHash/hash) at append time. Events are never edited or deleted; the type enum is closed and grows only by additive schema change.",
	"type": "object",
	"required": ["kind", "schemaVersion", "at"],
	"additionalProperties": false,
	"properties": {
		"kind": {
			"enum": [
				"run.created",
				"run.admitted",
				"run.started",
				"run.resumed",
				"run.paused",
				"run.blocked",
				"run.settling",
				"run.failed",
				"run.completed",
				"run.cancelled",
				"run.expired",
				"policy.evaluated",
				"approval.requested",
				"approval.granted",
				"execution.started",
				"execution.completed",
				"execution.failed",
				"execution.cancel.requested",
				"execution.cancelled",
				"validation.completed",
				"context.granted",
				"context.denied",
				"context.revoked",
				"runtime.schedule.registered",
				"runtime.schedule.revoked",
				"runtime.daemon.started",
				"runtime.daemon.stopped",
				"runtime.daemon.recovered",
				"runtime.wake.started",
				"runtime.wake.skipped",
				"runtime.job.completed",
				"runtime.job.failed",
				"runtime.budget.stopped",
				"runtime.no-progress.stopped"
			]
		},
		"schemaVersion": {
			"const": 1
		},
		"at": {
			"type": "string",
			"format": "date-time"
		},
		"runId": {
			"type": "string",
			"minLength": 1,
			"maxLength": 128,
			"description": "Required for run-scoped kinds (run.*/execution.*/policy.*/validation.*/approval.*); context.* events carry actor/action instead (ADR-0102 amendment, F069)."
		},
		"actor": {
			"type": "string",
			"maxLength": 128
		},
		"action": {
			"type": "object",
			"additionalProperties": false,
			"properties": {
				"tool": {
					"type": "string",
					"maxLength": 128
				},
				"resource": {
					"type": "string",
					"maxLength": 256
				}
			}
		},
		"decision": {
			"type": "object",
			"additionalProperties": false,
			"properties": {
				"result": {
					"enum": ["allow", "deny", "ask"]
				},
				"policy": {
					"type": "string",
					"maxLength": 256
				},
				"policyVersion": {
					"type": "string",
					"maxLength": 32
				}
			}
		},
		"inputHash": {
			"type": "string",
			"pattern": "^sha256:[0-9a-f]{64}$"
		},
		"outputHash": {
			"type": "string",
			"pattern": "^sha256:[0-9a-f]{64}$"
		},
		"reason": {
			"type": "string",
			"maxLength": 2000
		},
		"pointers": {
			"description": "F066: optional additive field — the governed-artifact pointers this event witnessed (e.g. the six AdmissionReceipt pointers on run.admitted). Additive, never required.",
			"type": "array",
			"items": {
				"type": "string",
				"minLength": 1,
				"maxLength": 256
			},
			"maxItems": 16
		},
		"cancelled": {
			"description": "F081 §4.3: true when the natural settle attributed this attempt's signalled exit to a recorded cancellation, so a cancelled attempt is never readable as an ordinary failure. Absent on every other event.",
			"type": "boolean"
		},
		"signal": {
			"description": "F081 §4.3: the signal the cancellation used to stop the attempt (the observed mechanism is named, never assumed from the exit code alone).",
			"type": "string",
			"maxLength": 32
		}
	}
}
