contracts

package
v0.0.0-...-24a6455 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

README

HELM AI Kernel Contracts Package Source Owner

Audience

Use this file when changing shared request, verdict, receipt, evidence, replay, approval, role, effect, or execution-boundary contract types.

Responsibility

core/pkg/contracts owns the Go contract model that the CLI, server, SDK examples, schemas, conformance fixtures, receipt verifier, and public reference docs depend on. Public docs may explain the supported fields and flows, but this package is the source-owner for in-process contract semantics.

Public Status

Classification: public-hub.

Public docs should link here from:

  • helm-ai-kernel/reference/execution-boundary
  • helm-ai-kernel/reference/http-api
  • helm-ai-kernel/reference/json-schemas
  • helm-ai-kernel/reference/protocols-and-schemas
  • helm-ai-kernel/verification
  • helm-ai-kernel/conformance

Source Map

  • Decision and verdict contracts: decision.go, decision_request.go, verdict.go, risk_summary.go.
  • Receipt and evidence contracts: receipt.go, receipt_hash.go, evidence.go, evidence_contract.go, replay.go.
  • Boundary and effect contracts: execution_boundary.go, effect_types.go, effect_catalog.go, taint.go.
  • Approval and role contracts: approval.go, approval_binding.go, role.go, delegation_proof.go.
  • Wire-format anchors: *.proto, schemas/, and schema_validation_test.go.

Documentation Rules

  • Do not document a public field unless it is backed by this package, JSON schema, OpenAPI, SDK examples, or conformance fixtures.
  • Changes to receipt hashing, replay material, verdict naming, or boundary effects require public reference updates before release.
  • Experimental fields must stay source-only until schemas and conformance coverage are added.

Validation

Run:

cd core
go test ./pkg/contracts -count=1
cd ..
make docs-coverage docs-truth

Documentation

Overview

quantum_posture: approval assertions use classical Ed25519 signatures; this contract does not claim hybrid or post-quantum approval authority.

Receipts and Audit Types

Package contracts defines the Autonomy Envelope — the signed, versioned runtime boundary contract that bounds every autonomous run.

quantum_posture: this file declares wire shapes only. The signature algorithm names it carries (ED25519, ECDSA-P256, RSA-PSS-2048) are classical string values; no cryptography is implemented here and no hybrid or post-quantum claim is made.

Per HELM 2030 Spec Section 2 — Autonomy Envelope:

  • Signed, versioned, and attached to every autonomous run
  • Declares jurisdiction scope, data handling, allowed effects, budgets, required evidence, and escalation policy
  • "Autonomy default" means: envelope pre-approved, continuously monitored, and continuously enforced; anything outside becomes an exception

Package contracts — autonomy_state.go defines the GlobalAutonomyState projection.

GlobalAutonomyState is a DERIVED projection, never a source of truth. It is computed from: posture config + active runs + pending decisions + budget consumption. It MUST be re-derivable at any point from authoritative stores (ledger, proofgraph, receipts).

Package contracts — capability_diff.go provides deterministic mapping from raw node operations to human-readable capability/control/workflow diffs.

This mapping table is the canonical source for translating low-level OpsEvent payloads into user-facing change descriptions. It eliminates the need for users to interpret raw ops and replaces them with structured, categorized diff summaries.

Package contracts — CompensationRecipe.

Per HELM 2030 Spec §1.3 / §3A:

Every EvidencePack includes a rollback/compensation recipe.
Compensation is structured, not ad-hoc.

quantum_posture: connector release authority is signed and verified with classical Ed25519; this contract makes no hybrid or post-quantum claim.

quantum_posture: execution-intent signature metadata is algorithm-neutral; protection depends on the configured classical, ML-DSA, or hybrid verifier.

Package contracts — decision_request.go defines the DecisionRequest protocol.

A DecisionRequest is a first-class queued blocker that represents any point where HELM needs human input. It replaces open-ended AI back-and-forth with constrained, structured choices.

Key invariants:

  • Every DecisionRequest has 2–7 options (+ optional "Something else" and "Skip")
  • Options are constrained and each carries an impact preview
  • Resolving a DecisionRequest deterministically unblocks the associated run
  • "Untitled" resources MUST trigger a DecisionRequest before creation
  • All DecisionRequests produce receipts regardless of outcome

Package contracts — DelegationProof evidence structure.

Per HELM 2030 Spec §5.3:

Every delegation of authority MUST produce a typed, signed evidence
structure that is attributable and replayable.

Resolves: GAP-A3.

Package contracts — Design constitution primitives.

Per HELM 2030 Spec §6.1.15:

HELM AI Kernel MUST include operator-console primitives, information
architecture rules, anti-pattern registry, visualization grammar,
and agent-facing UI generation constraints.

Resolves: GAP-A26.

Package contracts defines the Escalation Intent Protocol — the structured mechanism for requesting human judgment with full context.

Per HELM 2030 Spec — Governed Judgment Calls:

  • Escalation carries plan, diff, risks, and rollback
  • Approvers see structured context, not raw data
  • Every escalation produces a receipt regardless of outcome

Package contracts defines the EvidenceContract — per-action-class evidence requirements enforced at the PDP.

Per HELM 2030 Spec — Proof-carrying operations:

  • Every action class has defined evidence requirements
  • Evidence is verified before or after execution depending on contract
  • Evidence contracts are versioned and auditable

quantum_posture: GeneratedSpec approval assertions and grants use classical Ed25519 signatures only. This contract makes no hybrid or post-quantum claim.

Package contracts — Task Lineage, Spawn Boundary, Phenotype Binding, Idempotency, Retention, Dispute.

Resolves: GAP-8, GAP-12, GAP-13, GAP-19, GAP-20, GAP-23.

Package contracts defines the Judgment Taxonomy — the runtime classification system that formally separates autonomous acts from judgment-required ones.

Per HELM 2030 Spec — Governed Judgment Calls:

  • Every act is classified as autonomous or judgment-required
  • The taxonomy is versioned, auditable, and drives PDP routing
  • Classification can depend on effect type, blast radius, cost, and context

Package contracts — lane.go defines execution lanes for concurrent run organization.

A Lane is a categorical grouping of autonomous runs. Each run belongs to exactly one lane, enabling the UI to show progress across functional domains.

quantum_posture: launch authorization uses classical Ed25519 signatures and makes no hybrid or post-quantum protection claim.

quantum_posture: launch receipts use classical Ed25519 signatures and make no hybrid or post-quantum protection claim.

quantum_posture: provider certification uses classical Ed25519 signatures; this preview contract makes no hybrid or post-quantum certification claim.

quantum_posture: route validation verifies classical Ed25519 provider certification records and makes no hybrid or post-quantum protection claim.

Package contracts — Schema migration and forward migration rules.

Per HELM 2030 Spec §5.1:

HELM MUST include forward migration rules for schema versioning.

Resolves: GAP-A2.

Package contracts provides model routing example metadata.

The OSS repository keeps provider-neutral examples here so public code does not drift with commercial provider release cycles. Deployments that need a live provider catalog should generate one from verified source metadata.

Package contracts — Model routing contracts.

Per HELM 2030 Spec §6.1.3:

OSS MUST include model routing contracts for provider abstraction,
fallback chains, and third-party model attestation.

Resolves: GAP-A22.

Package contracts — Phenotype contract format.

Per HELM 2030 Spec §6.1.7:

HELM AI Kernel MUST include inspectable operational phenotype definitions,
phenotype contract format, test fixtures, and execution constraints.

Resolves: GAP-A24.

Package contracts — reflex.go provides the Reflex Engine contracts.

Reflexes are autonomous corrective actions that fire WITHOUT user input when specific conditions are detected. They produce deterministic ControlIntents and ReflexReceipts that are visible in Ops.

Reflexes are projections — they evaluate the current GlobalAutonomyState and emit actions. They do NOT mutate state directly; the caller applies the returned actions.

Package contracts — Risk taxonomy.

Per HELM 2030 Spec §5.1:

A unified risk-class taxonomy spans all effect types, enabling
consistent governance decisions across heterogeneous actuators.

Package contracts — Role schema.

Per HELM 2030 Spec §5.1:

Roles are first-class governance objects with typed taxonomies.
Every actor in a HELM-governed org has a canonical role binding.

Package contracts — threat_signal.go defines canonical threat-signal types.

These types form the canonical contract between the threat scanning subsystem and the HELM enforcement kernel (Guardian/PDP). Findings are informational signals — they do NOT carry final verdicts. The Guardian and PDP remain the sole policy authorities.

Per HELM Standard v1.2: all typed contracts live in this package to prevent dual-truth registries.

Package contracts — Truth Discipline primitives.

Per the HELM Governed Autonomous Execution Plane spec, every plan, analysis, or action proposal must carry epistemic metadata: what is known, what is assumed, what is uncertain, and what evidence supports it.

These types embed HitCC's truth discipline into HELM's contract layer.

Package contracts — Canonical Verdict and Reason Code Registry.

Per HELM Standard v1.2 §1.2 — every governance decision MUST use these canonical verdict values. No other verdict strings are valid.

This file is the SINGLE SOURCE OF TRUTH for verdict vocabulary. All kernel components (Guardian, Executor, PDP, SDK) import from here.

Package contracts — Isolated worker and phenotype-worker binding.

Per HELM 2030 Spec §6.1.3 / §5.5:

HELM AI Kernel MUST include isolated worker execution and
phenotype-bound worker semantics.

Resolves: GAP-A23, GAP-A9.

Index

Constants

View Source
const (
	AgentRunReceiptVersion = "agent_run_receipt.v1"

	PolicyProfileWorkstationObserveDraftV1 = "workstation.observe_draft.v1"

	WorkstationEffectModeObserve = "observe"
	WorkstationEffectModeDraft   = "draft"
	WorkstationEffectModeOperate = "operate"

	EffectTypeWorkstationFileDraft       = "WORKSTATION_FILE_DRAFT"
	EffectTypeWorkstationFileWrite       = "WORKSTATION_FILE_WRITE"
	EffectTypeWorkstationShellCommand    = "WORKSTATION_SHELL_COMMAND"
	EffectTypeWorkstationNetworkEgress   = "WORKSTATION_NETWORK_EGRESS"
	EffectTypeWorkstationMCPToolCall     = "WORKSTATION_MCP_TOOL_CALL"
	EffectTypeWorkstationMemoryWrite     = "WORKSTATION_MEMORY_WRITE"
	EffectTypeWorkstationRecurringLoop   = "WORKSTATION_RECURRING_LOOP"
	EffectTypeWorkstationDeployPublish   = "WORKSTATION_DEPLOY_PUBLISH"
	EffectTypeWorkstationSecretRead      = "WORKSTATION_SECRET_READ"
	EffectTypeWorkstationPaymentInitiate = "WORKSTATION_PAYMENT_INITIATE"
	EffectTypeWorkstationValidationRun   = "WORKSTATION_VALIDATION_RUN"
	EffectTypeWorkstationTaintedContext  = "WORKSTATION_TAINTED_CONTEXT"

	WorkstationPermissionNetworkEgress   = "network.egress"
	WorkstationPermissionFileWrite       = "file.write"
	WorkstationPermissionMCPMutate       = "mcp.mutate"
	WorkstationPermissionMemoryWrite     = "memory.write"
	WorkstationPermissionLoopRegister    = "loop.register"
	WorkstationPermissionShellOperate    = "shell.operate"
	WorkstationPermissionDeployPublish   = "deploy.publish"
	WorkstationPermissionSecretRead      = "secret.read"
	WorkstationPermissionPaymentInitiate = "payment.initiate"

	WorkstationVerdictAllow = "ALLOW"
	WorkstationVerdictDeny  = "DENY"

	// ClientObservationBasis records HOW HELM knows the client ran, which bounds
	// what the receipt is allowed to claim. The distinction is load-bearing: a
	// hook reports what the agent discloses; a parented process constrains what
	// the agent can do. Only the latter earns ClientLoadObserved.
	ClientObservationBasisParentedProcess = "parented_process"
	ClientObservationBasisHookReported    = "hook_reported"
	ClientObservationBasisUnobserved      = "unobserved"
)
View Source
const (
	ApprovalChallengeDomainV1   = "HELM/ApprovalChallenge/v1"
	ApprovalChallengeSchemaV1   = "approval-challenge.v1"
	ApprovalChallengeContractV1 = "2026-07-17"

	ApprovalAssertionDomainV1   = "HELM/ApprovalAssertion/v1"
	ApprovalAssertionSchemaV1   = "approval-assertion.v1"
	ApprovalAssertionContractV1 = "2026-07-15"
	ApprovalAssertionEd25519    = "ed25519"
)
View Source
const (
	ApprovalConnectorAuthoritySchemaV1   = "approval-connector-authority.v1"
	ApprovalConnectorAuthorityContractV1 = "2026-07-17.1"
	ApprovalConnectorAuthorityStateV1    = "certified"
)
View Source
const (
	ApprovalDispatchAdmissionSchemaV1   = "approval-dispatch-admission.v1"
	ApprovalDispatchAdmissionContractV1 = "2026-07-17.1"
	ApprovalDispatchAdmissionCoverageV1 = "new_governed_dispatches_only"
	ApprovalDispatchAdmissionStateV1    = "NOT_STARTED"
	ApprovalDispatchAdmissionMaxTTL     = time.Minute
)
View Source
const (
	ApprovalGrantSchemaV1   = "approval-grant.v1"
	ApprovalGrantContractV1 = "2026-07-17"

	ApprovalGrantDecisionAllow = "ALLOW"

	ApprovalGrantActionInstall   = "install"
	ApprovalGrantActionUpgrade   = "upgrade"
	ApprovalGrantActionUninstall = "uninstall"
	ApprovalGrantActionRollback  = "rollback"
)
View Source
const (
	ApprovalGrantConsumptionSchemaV1   = "approval-grant-consumption.v1"
	ApprovalGrantConsumptionContractV1 = "2026-07-17"
)
View Source
const (
	RegulatoryModeStrict     = "strict"
	RegulatoryModePermissive = "permissive"
	RegulatoryModeAuditOnly  = "audit_only"
)

Regulatory mode constants.

View Source
const (
	DataClassPublic       = "public"
	DataClassInternal     = "internal"
	DataClassConfidential = "confidential"
	DataClassRestricted   = "restricted"
)

Data classification constants.

View Source
const (
	EscalationModeAutonomous = "autonomous"
	EscalationModeSupervised = "supervised"
	EscalationModeManual     = "manual"
)

Escalation default mode constants.

View Source
const (
	EscalationActionRequireApproval = "require_approval"
	EscalationActionPauseAndNotify  = "pause_and_notify"
	EscalationActionAbort           = "abort"
)

Escalation action constants.

View Source
const (
	JudgmentAutonomous = "autonomous"
	JudgmentRequired   = "judgment_required"
)

Judgment classification constants.

View Source
const (
	EvidenceTypeReceipt              = "receipt"
	EvidenceTypeHashProof            = "hash_proof"
	EvidenceTypeDualAttestation      = "dual_attestation"
	EvidenceTypeExternalVerification = "external_verification"
	EvidenceTypeReplayProof          = "replay_proof"
)

Evidence type constants.

View Source
const (
	BlastRadiusSingleRecord = "single_record"
	BlastRadiusDataset      = "dataset"
	BlastRadiusSystemWide   = "system_wide"
)

Blast radius constants.

View Source
const (
	ConnectorReleaseAuthoritySchemaV1       = "connector-release-authority.v1"
	ConnectorReleaseAuthorityContractV1     = "2026-07-17"
	ConnectorReleaseAuthorityAlgorithmV1    = "ed25519"
	ConnectorReleaseAuthorityScopeGlobal    = "global"
	ConnectorReleaseAuthorityScopeWorkspace = "tenant_workspace"
	ConnectorReleaseAuthorityStateCertified = "certified"
	ConnectorReleaseAuthorityStateRevoked   = "revoked"
	ConnectorReleaseAuthorityMaxRevision    = uint64(1<<53 - 1)
)
View Source
const (
	ConnectorEffectAcknowledgementSchemaV1   = "connector-effect-acknowledgement.v1"
	ConnectorEffectAcknowledgementContractV1 = "2026-07-18"
	ConnectorEffectAcknowledgementAlgorithm  = "ed25519"
	ConnectorEffectOutcomeApplied            = "APPLIED"
	ConnectorEffectOutcomeNotApplied         = "NOT_APPLIED"

	EffectCloseReceiptSchemaV1     = "effect-close-receipt.v1"
	EffectCloseReceiptContractV1   = "2026-07-18"
	EffectCloseReceiptStateClosed  = "COMPLETED"
	EffectClosePriorStateStarted   = "STARTED"
	EffectClosePriorStateUncertain = "UNCERTAIN"
	EffectCloseMaxClockSkew        = 5 * time.Minute
)
View Source
const (
	EffectDispositionCommandSchemaV1   = "effect-disposition-command.v1"
	EffectDispositionCommandContractV1 = "2026-07-18"
	EffectDispositionAlgorithmV1       = "ed25519"

	EffectDispositionActionHold              = "HOLD"
	EffectDispositionActionReconcileSource   = "RECONCILE_SOURCE"
	EffectDispositionActionRequestCancel     = "REQUEST_CANCEL"
	EffectDispositionActionRequestCompensate = "REQUEST_COMPENSATE"

	EffectDispositionReceiptSchemaV1           = "effect-disposition-receipt.v1"
	EffectDispositionReceiptContractV1         = "2026-07-18"
	EffectDispositionReceiptStateAccepted      = "ACCEPTED"
	EffectDispositionExecutionAuthorityNone    = "NONE"
	EffectDispositionMaxCommandLifetime        = 10 * time.Minute
	EffectDispositionMaxCommandFutureClockSkew = time.Minute
)
View Source
const (
	EffectReconciliationCandidatesSchemaV1   = "effect-reconciliation-candidates.v1"
	EffectReconciliationCandidatesContractV1 = "2026-07-23"
)
View Source
const (
	// Infrastructure effects
	EffectTypeInfraDestroy        = "INFRA_DESTROY"             // Destroy infrastructure (e.g., terraform destroy)
	EffectTypeEnvRecreate         = "ENV_RECREATE"              // Recreate/replace an execution environment
	EffectTypeProtectedInfraWrite = "PROTECTED_INFRA_STRUCTURE" // Mutate protected infrastructure (e.g., production DB schema)

	// CI/CD and supply-chain effects
	EffectTypeCICredentialAccess = "CI_CREDENTIAL_ACCESS" // Access CI/CD credentials or secrets
	EffectTypeSoftwarePublish    = "SOFTWARE_PUBLISH"     // Publish software artifact (npm, Docker, etc.)

	// Agent and identity effects
	EffectTypeAgentInvokePrivileged  = "AGENT_INVOKE_PRIVILEGED"  // Agent invoking privileged operation
	EffectTypeAgentIdentityIsolation = "AGENT_IDENTITY_ISOLATION" // Agent credential/identity boundary check

	// Network and data effects
	EffectTypeDataEgress  = "DATA_EGRESS"  // Transmit data to external endpoint
	EffectTypeTunnelStart = "TUNNEL_START" // Establish network tunnel (SSH, VPN, etc.)

	// Resource effects
	EffectTypeCloudComputeBudget = "CLOUD_COMPUTE_BUDGET" // Consume cloud compute resources against budget

	// Governed company launch effect identifiers are reserved by the
	// provider-neutral route and preview effect contracts. They remain
	// intentionally absent from DefaultEffectCatalog until the authority,
	// connector, and conformance layers are promoted together. Route validation
	// explicitly rejects them whenever dispatch authority is requested.
	EffectTypeProviderProvision        = "PROVIDER_PROVISION"         // Create one exact provider resource set under an approved launch plan
	EffectTypeDeployProductionActivate = "DEPLOY_PRODUCTION_ACTIVATE" // Activate one exact verified deployment without standing authority
	EffectTypeSpendAuthorize           = "SPEND_AUTHORIZE"            // Authorize bounded monthly exposure without moving or holding funds
	EffectTypeProviderRollback         = "PROVIDER_ROLLBACK"          // Restore an exact previously verified provider deployment
	EffectTypeProviderTeardown         = "PROVIDER_TEARDOWN"          // Delete the exact provider resource set owned by a mission
	EffectTypeCompanyArtifactUpdate    = "COMPANY_ARTIFACT_UPDATE"    // Promote a receipt-backed company artifact revision

	// Business communication effects
	EffectTypeSendEmail       = "SEND_EMAIL"        // Send email through governed connector
	EffectTypeSendChatMessage = "SEND_CHAT_MESSAGE" // Send chat message (Slack, Teams, etc.)
	EffectTypeCreateCalEvent  = "CREATE_CAL_EVENT"  // Create calendar event

	// Document/collaboration effects
	EffectTypeUpdateDoc     = "UPDATE_DOC"     // Update document in connected store
	EffectTypeCreateTask    = "CREATE_TASK"    // Create task/issue in project management
	EffectTypeCommentTicket = "COMMENT_TICKET" // Comment on ticket/issue

	// HR/Recruiting effects
	EffectTypeScreenCandidate = "SCREEN_CANDIDATE" // Screen recruiting candidate

	// Financial effects
	EffectTypeRequestPurchase = "REQUEST_PURCHASE" // Generate purchase/spend request
	EffectTypeExecutePayment  = "EXECUTE_PAYMENT"  // Execute financial payment

	// Integration effects
	EffectTypeCallWebhook      = "CALL_WEBHOOK"       // Call external webhook
	EffectTypeRunSandboxedCode = "RUN_SANDBOXED_CODE" // Run code in governed sandbox
)

Canonical threat-surface effect type IDs. These are the stable identifiers for effects that require specific enforcement behavior, risk classification, and approval semantics.

Per the HELM Canonical Implementation Plan: every executable high-risk effect MUST be named, classified, and registered in DefaultEffectCatalog(). Reserved preview identifiers must remain rejected at dispatch until registration.

View Source
const (
	// ExternalDecisionReceiptVersion is the schema version for a single
	// normalized external decision receipt imported into HELM.
	ExternalDecisionReceiptVersion = "external_decision_receipt.v1"
	// ExternalDecisionReceiptBundleVersion is the on-disk chain envelope version.
	ExternalDecisionReceiptBundleVersion = "external_decision_receipt_bundle.v1"
)
View Source
const (
	GeneratedSpecApprovalChallengeDomainV1   = "HELM/GeneratedSpecApprovalChallenge/v1"
	GeneratedSpecApprovalChallengeSchemaV1   = "generated-spec-approval-challenge.v1"
	GeneratedSpecApprovalChallengeContractV1 = "2026-07-22"

	GeneratedSpecApprovalAssertionDomainV1   = "HELM/GeneratedSpecApprovalAssertion/v1"
	GeneratedSpecApprovalAssertionSchemaV1   = "generated-spec-approval-assertion.v1"
	GeneratedSpecApprovalAssertionContractV1 = "2026-07-22"
	GeneratedSpecApprovalAssertionEd25519    = "ed25519"

	GeneratedSpecApprovalGrantDomainV1   = "HELM/GeneratedSpecApprovalGrant/v1"
	GeneratedSpecApprovalGrantSchemaV1   = "generated-spec-approval-grant.v1"
	GeneratedSpecApprovalGrantContractV1 = "2026-07-22"

	GeneratedSpecApprovalConsumptionDomainV1   = "HELM/GeneratedSpecApprovalConsumption/v1"
	GeneratedSpecApprovalConsumptionSchemaV1   = "generated-spec-approval-consumption.v1"
	GeneratedSpecApprovalConsumptionContractV1 = "2026-07-22"

	GeneratedSpecApprovalAudienceV1 = "generated-spec.approval"
	GeneratedSpecApprovalActionV1   = "approve_generated_spec"
)
View Source
const (
	ExternalHostReceiptVersion      = "external_host_receipt.v1"
	ExternalReceiptChainVersion     = "external_receipt_chain.v1"
	HostCorrelationResultVersion    = "host_correlation_result.v1"
	BoundaryDriftReceiptVersion     = "boundary_drift_receipt.v1"
	ReceiptTypeNetworkEgressAttempt = "NETWORK_EGRESS_ATTEMPT"
	ReceiptTypeNetworkEgressAllowed = "NETWORK_EGRESS_ALLOWED"
	ReceiptTypeNetworkEgressDenied  = "NETWORK_EGRESS_DENIED"
	ReceiptTypeNetworkEgressUncorr  = "NETWORK_EGRESS_UNCORRELATED"
	ReceiptTypeBoundaryDrift        = "BOUNDARY_DRIFT"

	EventKindNetworkEgress = "network_egress"
	EventKindActionEffect  = "action_effect"

	HostCorrelationCorrelated             = "CORRELATED"
	HostCorrelationPartiallyCorrelated    = "PARTIALLY_CORRELATED"
	HostCorrelationUncorrelatedHostEgress = "UNCORRELATED_HOST_EGRESS"
	HostCorrelationMissingHostReceipt     = "MISSING_HOST_RECEIPT"
	HostCorrelationMissingHELMIntent      = "MISSING_HELM_INTENT"
	HostCorrelationPolicyAllowedHostBlock = "POLICY_ALLOWED_BUT_HOST_BLOCKED"
	HostCorrelationPolicyDeniedHostEgress = "POLICY_DENIED_BUT_HOST_OBSERVED_EGRESS"
)
View Source
const (
	LaunchCommercialEvidenceSchemaVersion = "launch_commercial_evidence.v1"
	LaunchFXSnapshotSchemaVersion         = "launch_fx_snapshot.v1"
	LaunchTaxSnapshotSchemaVersion        = "launch_tax_snapshot.v1"

	LaunchTaxProviderEstimate    = "PROVIDER_ESTIMATE"
	LaunchTaxConservativeMaximum = "CONSERVATIVE_MAXIMUM"
)
View Source
const (
	LaunchEffectReceiptSchemaVersion = "launch_effect_receipt.v1"
	LaunchEffectReceiptVersion       = "1.0"
	LaunchEffectReceiptProfile       = "launch_effect_receipt.v1"
)
View Source
const (
	// LaunchEffectCatalogVersion is intentionally a prerelease. Launch effects
	// are not admitted by DefaultEffectCatalog or the Kernel policy boundary
	// until their consumer schemas, policies, connector certification, and
	// conformance vectors are promoted atomically.
	LaunchEffectCatalogVersion     = "1.1.0-alpha.1"
	LaunchEffectInputSchemaVersion = "launch_effect_input.v1"
	LaunchEffectStatusPreview      = "preview"

	LaunchActionProviderProvision        = "urn:helm:provider-route:provision"
	LaunchActionDeployProductionActivate = "urn:helm:provider-route:activate"
	LaunchActionSpendAuthorize           = "urn:helm:spend:authorize"
	LaunchActionProviderRollback         = "urn:helm:provider-route:rollback"
	LaunchActionProviderTeardown         = "urn:helm:provider-route:teardown"
	LaunchActionCompanyArtifactUpdate    = "urn:helm:company-artifact:update"

	// LaunchConnectorProviderRoute is the only provider-effect entry point at
	// the Kernel boundary. The exact provider connector and action are bound
	// inside the approved RouteBinding and canonical effect input. This keeps
	// provider-specific vocabulary out of the Kernel taxonomy without granting
	// a wildcard connector capability.
	LaunchConnectorProviderRoute  = "helm-provider-route"
	LaunchConnectorSpendAuthority = "helm-spend-authority"
	LaunchConnectorCompanyState   = "helm-company-state"

	// DigitalOcean remains the first provider profile and conformance fixture;
	// these identifiers are deliberately not used as Kernel catalog bounds.
	LaunchConnectorDigitalOcean               = "digitalocean-app-platform"
	LaunchProviderActionDigitalOceanProvision = "urn:helm:connector:digitalocean:apps:create"
	LaunchProviderActionDigitalOceanActivate  = "urn:helm:connector:digitalocean:apps:activate"
	LaunchProviderActionDigitalOceanRollback  = "urn:helm:connector:digitalocean:deployments:rollback"
	LaunchProviderActionDigitalOceanTeardown  = "urn:helm:connector:digitalocean:apps:delete"
)
View Source
const (
	LaunchProviderCertificationSchemaVersion = "launch_provider_certification.v1"

	LaunchProviderCertificationActive  = "ACTIVE"
	LaunchProviderCertificationRevoked = "REVOKED"
)
View Source
const (
	LaunchConstraintSetSchemaVersion      = "launch_constraint_set.v1"
	LaunchRouteQuoteSchemaVersion         = "launch_route_quote.v1"
	LaunchResourceGraphSchemaVersion      = "launch_resource_graph.v1"
	LaunchProviderPayloadSetSchemaVersion = "launch_provider_payload_set.v1"
	LaunchBlueprintSchemaVersion          = "launch_blueprint.v1"
	LaunchPortableVocabularyVersion       = "launch_portable_vocabulary.v1"
	LaunchCreditVerified                  = "ACTIVE_CREDIT_VERIFIED"
	LaunchCreditAdvisory                  = "MAY_QUALIFY"
	LaunchCreditNone                      = "NONE"
	LaunchCreditUnknown                   = "UNKNOWN"
)
View Source
const (
	LaunchRepositoryAnalysisSchemaVersion = "launch_repository_analysis.v1"
	LaunchWorkloadGraphSchemaVersion      = "launch_workload_graph.v1"
	LaunchProviderProfileSchemaVersion    = "launch_provider_capability_profile.v1"
	LaunchRouteBindingSchemaVersion       = "launch_route_binding.v1"

	LaunchAnalysisSupported   = "SUPPORTED"
	LaunchAnalysisNeedsInput  = "NEEDS_INPUT"
	LaunchAnalysisUnsupported = "UNSUPPORTED"
	LaunchAnalysisUnknown     = "UNKNOWN"

	LaunchProviderProfileCandidate = "CANDIDATE"
	LaunchProviderProfilePublished = "PUBLISHED"
	LaunchProviderProfileRetired   = "RETIRED"

	LaunchLifecycleEphemeral        = "EPHEMERAL"
	LaunchLifecycleStatefulData     = "STATEFUL_DATA"
	LaunchLifecycleStatefulResource = "STATEFUL_RESOURCE"
	LaunchLifecycleComposite        = "COMPOSITE"

	LaunchTransitionReleaseCutover = "RELEASE_CUTOVER"
	LaunchTransitionResourceState  = "RESOURCE_STATE_TRANSITION"
	LaunchTransitionDataRestore    = "DATA_RESTORE"
	LaunchTransitionInfraReconcile = "INFRA_RECONCILE"
	LaunchTransitionComposite      = "COMPOSITE"

	LaunchCompensationReleaseRollback = "RELEASE_ROLLBACK"
	LaunchCompensationResourceRestore = "RESOURCE_STATE_RESTORE"
	LaunchCompensationDataRestore     = "DATA_RESTORE"
	LaunchCompensationInfraReconcile  = "INFRA_RECONCILE"
	LaunchCompensationComposite       = "COMPOSITE"
)
View Source
const (
	TaintPII        = "pii"
	TaintCredential = "credential"
	TaintSecret     = "secret"
	TaintToolOutput = "tool_output"
	TaintUserInput  = "user_input"
	TaintExternal   = "external"
)
View Source
const (
	StepTypeEffect       = "EFFECT"
	StepTypeDecision     = "DECISION"
	StepTypeWait         = "WAIT"
	StepTypeVerification = "VERIFY"

	EffectTypeCallTool             = "CALL_TOOL"
	EffectTypeGeneric              = "GENERIC"
	EffectTypeCreateObligation     = "CREATE_OBLIGATION"
	EffectTypeRequestClarification = "REQUEST_CLARIFICATION"
)

Step type constants.

View Source
const AuthorizedExecutionIntentSignatureV2 = "authorized_execution_intent.v2"

AuthorizedExecutionIntentSignatureV2 binds the full authority window and portable effect semantics. Unversioned legacy intents are never executable.

View Source
const DecisionRecordSignatureV2 = "decision_record.v2"

DecisionRecordSignatureV2 marks the HELM-303 decision preimage: ReasonCode replaces free-text Reason in the signed payload.

View Source
const DecisionRecordSignatureV3 = "decision_record.v3"

DecisionRecordSignatureV3 binds Guardian-owned typed threat evidence when a decision contains it. Records without threat evidence remain on V2 so historical and ordinary decisions preserve their established preimage.

View Source
const DecisionRecordSignatureV4 = "decision_record.v4"

DecisionRecordSignatureV4 is the current decision preimage. It retains the V2 reason digest and the V3 typed threat-evidence digest, then binds the evaluated authorization tuple and selected signature algorithm before any signature is created.

View Source
const EnforcementModeShadow = "shadow"

EnforcementModeShadow labels boundary records produced under an explicit, time-boxed observe grant. The verdict is computed and sealed exactly as in enforce mode; only the dispatch disposition differs, and the label makes that visible to every downstream verifier. The empty string means enforce (fail-closed default). Shadow mode is never set implicitly.

View Source
const LaunchEffectEnvelopeSchemaVersion = "launch_effect_envelope.v1"
View Source
const LaunchOfferSnapshotSchemaVersion = "launch_offer_snapshot.v1"
View Source
const RateLimitResourceAny = "*"

RateLimitResourceAny is the reserved rate-limit resource that matches every effect, used to express a ceiling over a run as a whole rather than over one named resource.

View Source
const ReceiptSignatureV5 = "receipt.v5"

ReceiptSignatureV5 marks the HELM-303 signing preimage: the legacy V4 fields plus verdict, reason_code, policy_hash and session_id. The emergency/safe_dep tail stays deliberately outside the receipt preimage — emergency authority is already signature-bound via the V2 AuthorizedExecutionIntent preimage, and double-binding it here would force a receipt re-sign on every intent-side evolution. Revisit in V6 only with a concrete threat that the intent binding does not already cover.

View Source
const VerdictPending = "PENDING"

VerdictPending is a transient verdict state with no canonical constant equivalent.

Variables

View Source
var (
	ErrApprovalChallengeInvalid   = errors.New("approval challenge invalid")
	ErrApprovalChallengeInactive  = errors.New("approval challenge inactive")
	ErrApprovalChallengeIntegrity = errors.New("approval challenge integrity failure")
	ErrApprovalAssertionInvalid   = errors.New("approval assertion invalid")
)
View Source
var (
	ErrApprovalGrantInvalid   = errors.New("approval grant invalid")
	ErrApprovalGrantInactive  = errors.New("approval grant inactive")
	ErrApprovalGrantIntegrity = errors.New("approval grant integrity failure")
)
View Source
var (
	ErrConnectorReleaseAuthorityInvalid  = errors.New("connector release authority invalid")
	ErrConnectorReleaseAuthorityInactive = errors.New("connector release authority inactive")
)
View Source
var (
	ErrConnectorEffectAcknowledgementInvalid = errors.New("connector effect acknowledgement invalid")
	ErrEffectCloseReceiptInvalid             = errors.New("effect close receipt invalid")
)
View Source
var (
	ErrEffectDispositionCommandInvalid = errors.New("effect disposition command invalid")
	ErrEffectDispositionReceiptInvalid = errors.New("effect disposition receipt invalid")
)
View Source
var (
	ErrGeneratedSpecApprovalChallengeInvalid   = errors.New("generated spec approval challenge invalid")
	ErrGeneratedSpecApprovalChallengeInactive  = errors.New("generated spec approval challenge inactive")
	ErrGeneratedSpecApprovalChallengeIntegrity = errors.New("generated spec approval challenge integrity failure")
	ErrGeneratedSpecApprovalAssertionInvalid   = errors.New("generated spec approval assertion invalid")
	ErrGeneratedSpecApprovalGrantInvalid       = errors.New("generated spec approval grant invalid")
	ErrGeneratedSpecApprovalGrantInactive      = errors.New("generated spec approval grant inactive")
	ErrGeneratedSpecApprovalGrantIntegrity     = errors.New("generated spec approval grant integrity failure")
)
View Source
var DefaultOpMappings = []OpMapping{

	{
		OpKind:              "posture.change",
		Category:            DiffCategoryPosture,
		DefaultSeverity:     DiffSeverityCritical,
		TitleTemplate:       "Autonomy level changed: {{.Before}} → {{.After}}",
		DescriptionTemplate: "The system autonomy level has been updated. This affects what actions can be taken without approval.",
	},

	{
		OpKind:              "budget.update",
		Category:            DiffCategoryBudget,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "Budget updated: {{.After}}",
		DescriptionTemplate: "Resource allocation has been modified.",
	},
	{
		OpKind:              "budget.exhausted",
		Category:            DiffCategoryBudget,
		DefaultSeverity:     DiffSeverityCritical,
		TitleTemplate:       "Budget exhausted",
		DescriptionTemplate: "The allocated budget has been fully consumed. Further operations require budget extension.",
	},

	{
		OpKind:              "capability.add",
		Category:            DiffCategoryCapability,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "New capability: {{.After}}",
		DescriptionTemplate: "A new capability has been granted to the system.",
	},
	{
		OpKind:              "capability.remove",
		Category:            DiffCategoryCapability,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Capability removed: {{.Before}}",
		DescriptionTemplate: "A capability has been revoked from the system.",
	},
	{
		OpKind:              "capability.modify",
		Category:            DiffCategoryCapability,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "Capability changed: {{.Before}} → {{.After}}",
		DescriptionTemplate: "An existing capability's parameters have been modified.",
	},

	{
		OpKind:              "policy.update",
		Category:            DiffCategoryControl,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Policy updated: {{.After}}",
		DescriptionTemplate: "A governance policy has been modified. This may affect approval requirements.",
	},
	{
		OpKind:              "corridor.update",
		Category:            DiffCategoryControl,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Network corridor updated",
		DescriptionTemplate: "Network access boundaries have been modified.",
	},
	{
		OpKind:              "approval.rule.change",
		Category:            DiffCategoryControl,
		DefaultSeverity:     DiffSeverityCritical,
		TitleTemplate:       "Approval rule changed: {{.After}}",
		DescriptionTemplate: "Approval requirements have been modified. This affects which operations need human authorization.",
	},

	{
		OpKind:              "workflow.add",
		Category:            DiffCategoryWorkflow,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "New workflow: {{.After}}",
		DescriptionTemplate: "A new workflow has been registered.",
	},
	{
		OpKind:              "workflow.modify",
		Category:            DiffCategoryWorkflow,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "Workflow modified: {{.After}}",
		DescriptionTemplate: "An existing workflow's steps have been changed.",
	},
	{
		OpKind:              "workflow.remove",
		Category:            DiffCategoryWorkflow,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Workflow removed: {{.Before}}",
		DescriptionTemplate: "A workflow has been deregistered.",
	},

	{
		OpKind:              "data.access.grant",
		Category:            DiffCategoryData,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Data access granted: {{.After}}",
		DescriptionTemplate: "New data access permissions have been granted.",
	},
	{
		OpKind:              "data.access.revoke",
		Category:            DiffCategoryData,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "Data access revoked: {{.Before}}",
		DescriptionTemplate: "Data access permissions have been revoked.",
	},
	{
		OpKind:              "connector.add",
		Category:            DiffCategoryData,
		DefaultSeverity:     DiffSeverityNotice,
		TitleTemplate:       "Connector added: {{.After}}",
		DescriptionTemplate: "A new external connector has been registered.",
	},
	{
		OpKind:              "connector.remove",
		Category:            DiffCategoryData,
		DefaultSeverity:     DiffSeverityWarning,
		TitleTemplate:       "Connector removed: {{.Before}}",
		DescriptionTemplate: "An external connector has been deregistered.",
	},
}

DefaultOpMappings is the canonical mapping table from ops → diffs. This is the single source of truth for all capability diff translations.

View Source
var ErrApprovalDispatchAdmissionInactive = errors.New("approval dispatch admission inactive")
View Source
var ErrEffectReconciliationCandidatesInvalid = errors.New("effect reconciliation candidates invalid")

Functions

func AggregateLaunchWorkloadGraphStatus

func AggregateLaunchWorkloadGraphStatus(graph LaunchWorkloadGraph) string

func CanonicalEffectDigest

func CanonicalEffectDigest(effect *Effect) (string, error)

CanonicalEffectDigest binds executable semantics, excluding display identity.

func CanonicalEffectDigestFromBinding

func CanonicalEffectDigestFromBinding(binding *EffectDigestBinding) (string, error)

CanonicalEffectDigestFromBinding verifies and hashes a portable binding using the same JCS contract as CanonicalEffectDigest.

func ComputeLaunchEvidenceNodeHash

func ComputeLaunchEvidenceNodeHash(node LaunchEffectEvidenceNode) (string, error)

ComputeLaunchEvidenceNodeHash derives the content address of one evidence node from its canonical projection content (node_hash excluded), mirroring the ProofGraph JCS+SHA-256 derivation so a claimed hash cannot be detached from the content it commits to. Source-owned evidence DAG resolvers MUST address nodes with this exact derivation: verification recomputes it and rejects any node whose claimed node_hash does not match.

func DeriveLaunchBlueprintHash

func DeriveLaunchBlueprintHash(value LaunchBlueprint) (string, error)

func DeriveLaunchBlueprintID

func DeriveLaunchBlueprintID(value LaunchBlueprint) (string, error)

DeriveLaunchBlueprintID returns the clean-room identity bound to sanitized blueprint content. The identifier field itself is excluded from the digest.

func DeriveLaunchCommercialEvidenceHash

func DeriveLaunchCommercialEvidenceHash(value LaunchCommercialEvidence) (string, error)

func DeriveLaunchConstraintSetHash

func DeriveLaunchConstraintSetHash(value LaunchConstraintSet) (string, error)

func DeriveLaunchEffectIdempotencyKey

func DeriveLaunchEffectIdempotencyKey(typeID string, input map[string]any) (string, error)

DeriveLaunchEffectIdempotencyKey hashes the entire schema-validated input using RFC 8785 JCS. The effect ID and schema version are part of every input, so a contract-version or payload change necessarily produces a new key. Callers MUST validate the input schema before deriving the key.

func DeriveLaunchEffectReceiptChainID

func DeriveLaunchEffectReceiptChainID(receipt LaunchEffectReceipt) (string, error)

DeriveLaunchEffectReceiptChainID binds every revision to the exact immutable dispatch identity while allowing reconciliation material to evolve.

func DeriveLaunchFXSnapshotHash

func DeriveLaunchFXSnapshotHash(value LaunchFXSnapshot) (string, error)

func DeriveLaunchFXSnapshotSetHash

func DeriveLaunchFXSnapshotSetHash(costs []LaunchCommercialPlacementEvidence) (string, error)

func DeriveLaunchOfferSnapshotHash

func DeriveLaunchOfferSnapshotHash(value LaunchOfferSnapshot) (string, error)

func DeriveLaunchOfferSnapshotSetHash

func DeriveLaunchOfferSnapshotSetHash(costs []LaunchPlacementCost) (string, error)

func DeriveLaunchProviderCapabilityProfileHash

func DeriveLaunchProviderCapabilityProfileHash(value LaunchProviderCapabilityProfile) (string, error)

func DeriveLaunchProviderPayloadSetHash

func DeriveLaunchProviderPayloadSetHash(value LaunchProviderPayloadSet) (string, error)

func DeriveLaunchProviderPayloadSubsetHash

func DeriveLaunchProviderPayloadSubsetHash(payloads LaunchProviderPayloadSet, placementID string) (string, error)

DeriveLaunchProviderPayloadSubsetHash binds one placement to its exact set of connector requests without embedding provider payloads in the route plan.

func DeriveLaunchRepositoryAnalysisHash

func DeriveLaunchRepositoryAnalysisHash(value LaunchRepositoryAnalysis) (string, error)

func DeriveLaunchResourceGraphHash

func DeriveLaunchResourceGraphHash(value LaunchResourceGraph) (string, error)

func DeriveLaunchResourceSubsetHash

func DeriveLaunchResourceSubsetHash(graph LaunchResourceGraph, placementID string) (string, error)

DeriveLaunchResourceSubsetHash binds one placement to only the resources it owns. Route producers use the same canonical projection as the verifier.

func DeriveLaunchRouteBindingHash

func DeriveLaunchRouteBindingHash(value LaunchRouteBinding) (string, error)

func DeriveLaunchRouteQuoteHash

func DeriveLaunchRouteQuoteHash(value LaunchRouteQuote) (string, error)

func DeriveLaunchTaxSnapshotHash

func DeriveLaunchTaxSnapshotHash(value LaunchTaxSnapshot) (string, error)

func DeriveLaunchTaxSnapshotSetHash

func DeriveLaunchTaxSnapshotSetHash(costs []LaunchCommercialPlacementEvidence) (string, error)

func DeriveLaunchWorkloadEdgeHash

func DeriveLaunchWorkloadEdgeHash(value LaunchWorkloadEdge) (string, error)

func DeriveLaunchWorkloadGraphHash

func DeriveLaunchWorkloadGraphHash(value LaunchWorkloadGraph) (string, error)

func EffectRiskClass

func EffectRiskClass(effectTypeID string) string

EffectRiskClass maps a canonical effect type ID to its E-class risk level. This bridges the named effect taxonomy to the governance engine's E0-E4 system.

  • E0: Informational (read-only, no side effects)
  • E1: Low Risk / Reversible
  • E2: Medium Risk / State Mutation
  • E3: High Risk / Sensitive Data
  • E4: Critical / Irreversible

func EncodeDecisionRecord

func EncodeDecisionRecord(d *DecisionRecord) (string, error)

EncodeDecisionRecord serializes the decision to a string (token).

func HashPlan

func HashPlan(plan interface{}) (string, error)

HashPlan computes a deterministic SHA-256 hash of any plan-like struct. DRIFT-4 FIX: Uses RFC 8785 JCS for deterministic canonical serialization.

func IsCanonicalEnforcement

func IsCanonicalEnforcement(e string) bool

IsCanonicalEnforcement reports whether e is one of the two canonical enforcement labels.

func IsCanonicalReasonCode

func IsCanonicalReasonCode(code string) bool

IsCanonicalReasonCode reports whether code is part of the core registry.

func IsCanonicalVerdict

func IsCanonicalVerdict(v string) bool

IsCanonicalVerdict reports whether v is a normative verdict string.

func IsLaunchMissionEffectPreview

func IsLaunchMissionEffectPreview(typeID string) bool

IsLaunchMissionEffectPreview reports whether an identifier is reserved by the non-executable Launch Mission preview catalog.

func IsWorkstationPermission

func IsWorkstationPermission(name string) bool

IsWorkstationPermission reports whether name belongs to the fixed public permission vocabulary that a denial counterfactual may disclose.

func KnownModelProvidersByID

func KnownModelProvidersByID() map[string]ModelProvider

KnownModelProvidersByID returns the catalog indexed by ProviderID.

func LaunchEffectReceiptSigningBytes

func LaunchEffectReceiptSigningBytes(receipt LaunchEffectReceipt) ([]byte, error)

LaunchEffectReceiptSigningBytes returns the RFC 8785 content-addressing preimage. ReceiptID and Signature are cleared to break the required signing cycle: the signature is subsequently computed over the derived ReceiptID.

func LaunchEffectVerdictSigningBytes

func LaunchEffectVerdictSigningBytes(envelope LaunchEffectAuthorizationEnvelope) ([]byte, error)

LaunchEffectVerdictSigningBytes returns the RFC 8785 payload signed by the Kernel. The hash and signature fields are cleared to avoid self-reference.

func LaunchProviderCertificationSigningBytes

func LaunchProviderCertificationSigningBytes(record LaunchProviderCertificationRecord) ([]byte, error)

LaunchProviderCertificationSigningBytes is the RFC 8785 payload signed by the certification authority. RecordHash and Signature are excluded from the payload to avoid self-reference.

func NormalizeSurfaceLimit

func NormalizeSurfaceLimit(limit int) int

func NormalizeTaintLabels

func NormalizeTaintLabels(labels []string) []string

NormalizeTaintLabels returns stable, lowercase, deduplicated taint labels.

func OpMappingIndex

func OpMappingIndex() map[string]*OpMapping

OpMappingIndex builds a lookup index from OpKind → OpMapping.

func PreflightLaunchEffectAuthorizationEnvelope

func PreflightLaunchEffectAuthorizationEnvelope(envelope LaunchEffectAuthorizationEnvelope, ctx LaunchEffectEnvelopeVerificationContext) error

PreflightLaunchEffectAuthorizationEnvelope validates signed, source-owned launch evidence without consuming a permit or crossing a connector seam. It is safe for reading or replaying legacy v1 artifacts, but it grants no execution authority.

func ReceiptChainHash

func ReceiptChainHash(receipt *Receipt) (string, error)

ReceiptChainHash returns the canonical SHA-256 digest used for receipt causal links. It hashes the persisted receipt envelope, including its signature, so any mutation to the previous receipt breaks the next link.

Transparency-log anchoring metadata (Transparency, LogID, LeafIndex) is excluded from the digest. Those fields are assigned AFTER the leaf hash is computed (see anchorReceiptTransparency), and the assigned leaf hash IS this chain hash; if anchoring metadata entered the digest, the persisted receipt's recomputed chain hash would no longer match the leaf that was anchored, and the prev_hash of the next causal receipt would shift depending on whether the previous receipt was anchored. Excluding them keeps the chain hash stable.

func SeverityAtLeast

func SeverityAtLeast(severity, threshold ThreatSeverity) bool

SeverityAtLeast returns true if severity is >= threshold.

func StartLaunchEffectAuthorizationEnvelope

func StartLaunchEffectAuthorizationEnvelope(envelope LaunchEffectAuthorizationEnvelope, ctx LaunchEffectEnvelopeVerificationContext) error

StartLaunchEffectAuthorizationEnvelope is an explicit alias for the v1 authorizing gate. It never returns a reusable dispatch grant.

func SurfaceID

func SurfaceID(prefix, value string) string

func TaintContains

func TaintContains(labels []string, label string) bool

func TaintContainsAny

func TaintContainsAny(labels []string, candidates ...string) bool

func TaintLabelsFromContext

func TaintLabelsFromContext(ctx map[string]interface{}) []string

TaintLabelsFromContext reads taint labels from common context keys.

func ValidateDecisionAuthorityForUse

func ValidateDecisionAuthorityForUse(decision *DecisionRecord) error

ValidateDecisionAuthorityForUse restricts execution authority to the V4 decision contract. Historical V2/V3 records remain verifiable as evidence, but lack the request and signer bindings needed to grant a new effect.

func ValidateEUAIActEvidenceProfile

func ValidateEUAIActEvidenceProfile(profile *EUAIActEvidenceProfile) []string

ValidateEUAIActEvidenceProfile returns evidence-profile defects. A nil profile is valid for legacy packs; once present, the profile must be internally complete enough for offline verification of high-risk evidence posture.

func ValidateLaunchBlueprint

func ValidateLaunchBlueprint(value LaunchBlueprint) error

func ValidateLaunchCommercialEvidence

func ValidateLaunchCommercialEvidence(value LaunchCommercialEvidence) error

func ValidateLaunchConstraintSet

func ValidateLaunchConstraintSet(value LaunchConstraintSet) error

func ValidateLaunchEffectIdempotencyKey

func ValidateLaunchEffectIdempotencyKey(typeID string, input map[string]any, provided string) error

ValidateLaunchEffectIdempotencyKey rejects arbitrary caller-provided keys.

func ValidateLaunchEffectInputSemantics

func ValidateLaunchEffectInputSemantics(typeID string, input map[string]any) error

ValidateLaunchEffectInputSemantics applies cross-field fail-closed checks that JSON Schema Draft 2020-12 cannot express portably. Schema validation remains a mandatory predecessor.

func ValidateLaunchEffectReceiptSemantics

func ValidateLaunchEffectReceiptSemantics(receipt LaunchEffectReceipt) error

ValidateLaunchEffectReceiptSemantics validates both unsigned signing inputs and sealed receipts. Cryptographic verification remains separate.

func ValidateLaunchFXSnapshot

func ValidateLaunchFXSnapshot(value LaunchFXSnapshot) error

func ValidateLaunchOfferSnapshot

func ValidateLaunchOfferSnapshot(value LaunchOfferSnapshot) error

func ValidateLaunchProviderCapabilityProfile

func ValidateLaunchProviderCapabilityProfile(profile LaunchProviderCapabilityProfile) error

func ValidateLaunchProviderPayloadSet

func ValidateLaunchProviderPayloadSet(value LaunchProviderPayloadSet) error

func ValidateLaunchRepositoryAnalysis

func ValidateLaunchRepositoryAnalysis(analysis LaunchRepositoryAnalysis) error

func ValidateLaunchRepositoryAnalysisGraph

func ValidateLaunchRepositoryAnalysisGraph(analysis LaunchRepositoryAnalysis, graph LaunchWorkloadGraph) error

func ValidateLaunchResourceGraph

func ValidateLaunchResourceGraph(value LaunchResourceGraph) error

func ValidateLaunchRouteBinding

func ValidateLaunchRouteBinding(route LaunchRouteBinding, resolver LaunchRouteArtifactResolver, now time.Time, requireDispatchAuthority bool) error

ValidateLaunchRouteBinding resolves and verifies every approval-bound artifact. requireDispatchAuthority additionally requires every effect to be registered in the canonical dispatch catalog and every placement to carry a signed, current, non-revoked connector certification. Preview-only effects therefore remain non-executable until their atomic promotion release.

func ValidateLaunchRouteQuote

func ValidateLaunchRouteQuote(value LaunchRouteQuote) error

func ValidateLaunchTaxSnapshot

func ValidateLaunchTaxSnapshot(value LaunchTaxSnapshot) error

func ValidateLaunchWorkloadGraph

func ValidateLaunchWorkloadGraph(graph LaunchWorkloadGraph) error

func ValidatePhenotype

func ValidatePhenotype(p PhenotypeContract) error

ValidatePhenotype checks that a contract is structurally complete.

func VerifyLaunchEffectAuthorizationEnvelope

func VerifyLaunchEffectAuthorizationEnvelope(envelope LaunchEffectAuthorizationEnvelope, ctx LaunchEffectEnvelopeVerificationContext) error

VerifyLaunchEffectAuthorizationEnvelope is the v1 authorizing final gate. A successful return proves a source-owned atomic permit consumption and durable STARTED reservation immediately before the bounded connector seam.

func VerifyLaunchEffectReceipt

func VerifyLaunchEffectReceipt(receipt LaunchEffectReceipt, ctx LaunchEffectReceiptVerificationContext) error

VerifyLaunchEffectReceipt verifies content addressing, trust-root key resolution, the Ed25519 signature, the source-owned dispatch reservation, pre-receipt evidence DAG, and non-circular EvidencePack closure.

func VerifyLaunchEffectReceiptRevision

func VerifyLaunchEffectReceiptRevision(current, previous LaunchEffectReceipt, ctx LaunchEffectReceiptVerificationContext) error

VerifyLaunchEffectReceiptRevision verifies one append-only reconciliation transition against the exact signed predecessor.

func VerifyLaunchProviderCertificationRecord

func VerifyLaunchProviderCertificationRecord(record LaunchProviderCertificationRecord, publicKey ed25519.PublicKey, now time.Time) error

VerifyLaunchProviderCertificationRecord proves content integrity, trust-root signature, active status, and the certification validity window. Callers must additionally prove this is the current non-revoked registry record.

func WorkflowLayers

func WorkflowLayers(workflow WorkflowDef) ([][]WorkflowStep, error)

WorkflowLayers returns topological execution layers in declaration order. Legacy workflows without explicit dependencies remain sequential.

Types

type AccessRequest

type AccessRequest struct {
	PrincipalID string                 `json:"principal_id"`
	Action      string                 `json:"action"`
	ResourceID  string                 `json:"resource_id"`
	Context     map[string]interface{} `json:"context,omitempty"`
}

AccessRequest models a standard authorization check.

type AccessReviewItem

type AccessReviewItem struct {
	SubjectID     string `json:"subject_id"`
	Resource      string `json:"resource"`
	Permission    string `json:"permission"`
	Decision      string `json:"decision"` // APPROVED, REVOKED, FLAGGED
	Justification string `json:"justification,omitempty"`
	ReceiptRef    string `json:"receipt_ref,omitempty"`
}

type AccessReviewPack

type AccessReviewPack struct {
	PackID      string                      `json:"pack_id"`
	PackType    string                      `json:"pack_type"` // "ACCESS_REVIEW_PACK"
	Scope       string                      `json:"scope"`
	ReviewedAt  time.Time                   `json:"reviewed_at"`
	ReviewerID  string                      `json:"reviewer_id,omitempty"`
	Reviews     []AccessReviewItem          `json:"reviews"`
	Attestation AccessReviewPackAttestation `json:"attestation"`
}

AccessReviewPack represents a proof of access review.

type AccessReviewPackAttestation

type AccessReviewPackAttestation struct {
	PackHash    string    `json:"pack_hash"`
	Signature   string    `json:"signature,omitempty"`
	SignerID    string    `json:"signer_id,omitempty"`
	GeneratedAt time.Time `json:"generated_at"`
}

type Action

type Action struct {
	Type    ActionType     `json:"type"`
	Payload map[string]any `json:"payload"`
}

Action represents a request to perform an operation.

type ActionEffectEvent

type ActionEffectEvent struct {
	ActionID        string    `json:"action_id"`
	ToolName        string    `json:"tool_name"`
	TargetRef       string    `json:"target_ref,omitempty"`
	Transport       string    `json:"transport,omitempty"`
	ParamsHash      string    `json:"params_hash,omitempty"`
	OutputHash      string    `json:"output_hash,omitempty"`
	ResultCount     int64     `json:"result_count,omitempty"`
	SideEffectClass string    `json:"side_effect_class,omitempty"`
	Reversibility   string    `json:"reversibility,omitempty"`
	Decision        string    `json:"decision,omitempty"`
	Timestamp       time.Time `json:"timestamp"`
}

ActionEffectEvent is a host/mediator-observed agent tool/action effect — the vendor-neutral analogue of a competitor "action receipt" (Signet, AGT, Pipelock/AAR). Used when ExternalHostReceipt.EventKind == "action_effect".

type ActionPlan

type ActionPlan struct {
	Steps []WorkflowStep `json:"steps"`
}

ActionPlan represents a sequence of steps to achieve a goal.

type ActionPlanRef

type ActionPlanRef struct {
	PlanHash    string `json:"plan_hash"`
	PlanVersion string `json:"plan_version"`
	URI         string `json:"uri,omitempty"`
}

ActionPlanRef points to the execution plan.

type ActionStep

type ActionStep struct {
	StepID           string   `json:"step_id"`
	Description      string   `json:"description"`
	Action           Action   `json:"action"`
	RequiredEvidence []string `json:"required_evidence"`
}

ActionStep represents a single step in an action plan.

type ActionType

type ActionType string

ActionType represents the type of action.

const (
	ActionRefundRequest ActionType = "REFUND_REQUEST"
	ActionRefundExecute ActionType = "REFUND_EXECUTE"
	ActionVendorPayment ActionType = "VENDOR_PAYMENT"
	ActionDiscover      ActionType = "DISCOVER"
)

Action type constants.

type ActivationReceipt

type ActivationReceipt struct {
	ActivationID        string                    `json:"activation_id"`
	CapsuleID           string                    `json:"capsule_id"`
	ApertureID          string                    `json:"aperture_id"`
	State               SafeDepState              `json:"state"`
	HazardCode          SafeDepHazardCode         `json:"hazard_code"`
	ContinuityHash      string                    `json:"continuity_hash"`
	CeremonyHash        string                    `json:"ceremony_hash"`
	DelegationSessionID string                    `json:"delegation_session_id"`
	PolicyEpoch         uint64                    `json:"policy_epoch"`
	ActivatedAt         time.Time                 `json:"activated_at"`
	ExpiresAt           time.Time                 `json:"expires_at"`
	ReasonCode          ReasonCode                `json:"reason_code"`
	ProofGraphRef       string                    `json:"proof_graph_ref,omitempty"`
	EvidencePackRef     string                    `json:"evidence_pack_ref,omitempty"`
	Transparency        TransparencyAnchor        `json:"transparency,omitempty"`
	Attestation         AttestationResultEnvelope `json:"attestation"`
	Signature           string                    `json:"signature,omitempty"`
}

type Actor

type Actor struct {
	ID    string            `json:"id"`
	Role  string            `json:"role"` // e.g. "user", "system", "agent"
	Props map[string]string `json:"props,omitempty"`
}

Actor represents the entity initiating an action.

type AgentActionPlan

type AgentActionPlan struct {
	GoalID      string       `json:"goal_id"`
	Steps       []ActionStep `json:"steps"`
	GeneratedAt time.Time    `json:"generated_at"`
}

AgentActionPlan represents a plan generated by an agent.

type AgentChangedFile

type AgentChangedFile struct {
	Path      string `json:"path"`
	Status    string `json:"status"`
	Additions int    `json:"additions,omitempty"`
	Deletions int    `json:"deletions,omitempty"`
}

type AgentDeniedEffect

type AgentDeniedEffect struct {
	EffectID   string    `json:"effect_id"`
	EffectType string    `json:"effect_type"`
	ToolID     string    `json:"tool_id,omitempty"`
	Action     string    `json:"action,omitempty"`
	ReasonCode string    `json:"reason_code"`
	Reason     string    `json:"reason,omitempty"`
	OccurredAt time.Time `json:"occurred_at"`

	// Finality and Counterfactual are opt-in per policy profile and absent
	// (not empty) when disabled: their presence is itself a policy statement.
	Finality       DenialFinality        `json:"finality,omitempty"`
	Counterfactual *DenialCounterfactual `json:"counterfactual,omitempty"`
}

type AgentIdentityProfile

type AgentIdentityProfile struct {
	AgentID      string    `json:"agent_id"`
	DisplayName  string    `json:"display_name,omitempty"`
	IdentityType string    `json:"identity_type"`
	Issuer       string    `json:"issuer,omitempty"`
	Subject      string    `json:"subject,omitempty"`
	Audience     []string  `json:"audience,omitempty"`
	SPIFFEID     string    `json:"spiffe_id,omitempty"`
	KeyID        string    `json:"key_id,omitempty"`
	AnonymousDev bool      `json:"anonymous_dev,omitempty"`
	LastVerified time.Time `json:"last_verified,omitempty"`
	IdentityHash string    `json:"identity_hash,omitempty"`
}

type AgentMemoryEffect

type AgentMemoryEffect struct {
	EffectID     string   `json:"effect_id"`
	MemoryClass  string   `json:"memory_class"`
	DataClass    string   `json:"data_class"`
	Sensitivity  string   `json:"sensitivity"`
	TTLDays      uint32   `json:"ttl_days"`
	ContentHash  string   `json:"content_hash"`
	ContentRef   string   `json:"content_ref,omitempty"`
	Purpose      string   `json:"purpose,omitempty"`
	ReviewState  string   `json:"review_state,omitempty"`
	Verdict      string   `json:"verdict"`
	ReasonCode   string   `json:"reason_code,omitempty"`
	TaintLabels  []string `json:"taint_labels,omitempty"`
	ObservedOnly bool     `json:"observed_only"`
}

AgentMemoryEffect models durable memory as an effect with retention and sensitivity, rather than treating memory as implicit conversation state.

type AgentRecurringLoopEffect

type AgentRecurringLoopEffect struct {
	EffectID     string    `json:"effect_id"`
	Schedule     string    `json:"schedule"`
	MaxRuntime   string    `json:"max_runtime"`
	ToolScope    []string  `json:"tool_scope"`
	ExpiresAt    time.Time `json:"expires_at"`
	Verdict      string    `json:"verdict"`
	ReasonCode   string    `json:"reason_code,omitempty"`
	ObservedOnly bool      `json:"observed_only"`
}

AgentRecurringLoopEffect is the public receipt shape for a scheduled agent loop. M2 imports and records these; M3+ decides whether to enforce them.

type AgentRunActor

type AgentRunActor struct {
	ActorID   string `json:"actor_id"`
	ActorType string `json:"actor_type"`
}

type AgentRunReceipt

type AgentRunReceipt struct {
	ReceiptVersion       string                     `json:"receipt_version"`
	ReceiptID            string                     `json:"receipt_id"`
	RunID                string                     `json:"run_id"`
	Goal                 string                     `json:"goal"`
	Actor                AgentRunActor              `json:"actor"`
	Workspace            AgentRunWorkspace          `json:"workspace"`
	AgentSurface         string                     `json:"agent_surface"`
	ClientObservation    *ClientObservation         `json:"client_observation,omitempty"`
	PolicyProfile        string                     `json:"policy_profile"`
	ArtifactHashes       map[string]string          `json:"artifact_hashes"`
	ToolActions          []AgentToolAction          `json:"tool_actions"`
	ChangedFiles         []AgentChangedFile         `json:"changed_files"`
	ValidationResults    []AgentValidationResult    `json:"validation_results"`
	MemoryEffects        []AgentMemoryEffect        `json:"memory_effects"`
	RecurringLoopEffects []AgentRecurringLoopEffect `json:"recurring_loop_effects"`
	DeniedEffects        []AgentDeniedEffect        `json:"denied_effects"`
	ProofGraphRefs       []string                   `json:"proofgraph_refs"`
	EvidencePackRefs     []string                   `json:"evidence_pack_refs"`
	CreatedAt            time.Time                  `json:"created_at"`
	CompletedAt          *time.Time                 `json:"completed_at,omitempty"`
	ReceiptHash          string                     `json:"receipt_hash"`
	Signature            string                     `json:"signature"`
	SignerKeyID          string                     `json:"signer_key_id"`
}

AgentRunReceipt is the public, manifest-first receipt for local workstation agent runs. It is observe-only until a downstream enforcement bridge exists.

type AgentRunWorkspace

type AgentRunWorkspace struct {
	WorkspaceID string `json:"workspace_id"`
	Path        string `json:"path,omitempty"`
	Repository  string `json:"repository,omitempty"`
}

type AgentToolAction

type AgentToolAction struct {
	ActionID    string            `json:"action_id"`
	ToolID      string            `json:"tool_id"`
	Action      string            `json:"action"`
	EffectType  string            `json:"effect_type"`
	EffectMode  string            `json:"effect_mode"`
	Status      string            `json:"status"`
	Verdict     string            `json:"verdict"`
	ReasonCode  string            `json:"reason_code,omitempty"`
	Target      string            `json:"target,omitempty"`
	OccurredAt  time.Time         `json:"occurred_at"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	TaintLabels []string          `json:"taint_labels,omitempty"`
}

AgentToolAction is a normalized workstation tool event. Actions may be imported from Codex/Claude Code event streams, hooks, OTel logs, or a manifest-first tool-events.ndjson file.

type AgentUIConstraint

type AgentUIConstraint struct {
	ConstraintID string   `json:"constraint_id"`
	Category     string   `json:"category"` // "NO_PARALLEL_TRUTH", "NO_BYPASS", "NO_HIDDEN_STATE"
	Description  string   `json:"description"`
	Enforcement  string   `json:"enforcement"` // "HARD", "SOFT"
	AppliesTo    []string `json:"applies_to"`  // surface types: "CANVAS", "CONSOLE", "REPORT"
}

AgentUIConstraint restricts what agents can generate for UI surfaces.

type AgentValidationResult

type AgentValidationResult struct {
	Command     string     `json:"command"`
	ExitCode    int        `json:"exit_code"`
	Status      string     `json:"status"`
	StdoutHash  string     `json:"stdout_hash,omitempty"`
	StderrHash  string     `json:"stderr_hash,omitempty"`
	StartedAt   *time.Time `json:"started_at,omitempty"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
}

AgentValidationResult records command output by hash so receipt consumers do not need raw stdout/stderr or chat history to verify the run summary.

type Anomaly

type Anomaly struct {
	ID          string    `json:"id"`
	Type        string    `json:"type"`        // velocity, cost, error_rate, drift
	Severity    string    `json:"severity"`    // low, medium, high, critical
	Description string    `json:"description"` // Human-readable
	DetectedAt  time.Time `json:"detected_at"`
}

Anomaly represents a detected operational anomaly.

type AntiPattern

type AntiPattern struct {
	PatternID   string              `json:"pattern_id"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Severity    AntiPatternSeverity `json:"severity"`
	Detection   string              `json:"detection"` // CEL expression or rule
	Remediation string              `json:"remediation"`
	Category    string              `json:"category"` // "PARALLEL_TRUTH", "BYPASS", "DARK_PATTERN", "ACCESSIBILITY"
}

AntiPattern describes a known bad UI/UX pattern that MUST be avoided.

type AntiPatternRegistry

type AntiPatternRegistry interface {
	Register(pattern AntiPattern) error
	Check(surfaceType string, props map[string]any) ([]AntiPattern, error)
	List() ([]AntiPattern, error)
}

AntiPatternRegistry stores known anti-patterns for validation.

type AntiPatternSeverity

type AntiPatternSeverity string

AntiPatternSeverity classifies how harmful a UI anti-pattern is.

const (
	APSevWarning  AntiPatternSeverity = "WARNING"
	APSevError    AntiPatternSeverity = "ERROR"
	APSevCritical AntiPatternSeverity = "CRITICAL"
)

type ApprovalAssertion

type ApprovalAssertion struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`
	ChallengeID     string `json:"challenge_id"`
	ChallengeHash   string `json:"challenge_hash"`
	KeyID           string `json:"key_id"`
	Algorithm       string `json:"algorithm"`
	Signature       string `json:"signature"`
}

ApprovalAssertion carries only the credential key reference and signature. Principal, tenant, device, role, and action authority MUST come from a trusted registry; client-submitted actor or public-key claims are excluded.

func (ApprovalAssertion) SignatureBytes

func (a ApprovalAssertion) SignatureBytes() ([]byte, error)

func (ApprovalAssertion) SigningDigest

func (a ApprovalAssertion) SigningDigest() ([]byte, error)

SigningDigest returns the domain-separated JCS digest signed by the assertion key. It binds the assertion contract, challenge, key selection, and algorithm; Signature itself is deliberately excluded.

func (ApprovalAssertion) Validate

func (a ApprovalAssertion) Validate() error

type ApprovalBinding

type ApprovalBinding struct {
	// BindingID uniquely identifies this binding.
	BindingID string `json:"binding_id"`

	// PlanHash is the SHA-256 of the serialized execution plan (PlanIR).
	PlanHash string `json:"plan_hash"`

	// ApprovalID references the approval that authorized this plan.
	ApprovalID string `json:"approval_id"`

	// BoundAt is when the binding was created.
	BoundAt time.Time `json:"bound_at"`

	// ValidUntil is the binding expiry. Plans must execute before this time.
	ValidUntil time.Time `json:"valid_until"`

	// Drifted is set to true if the plan has been modified after binding.
	Drifted bool `json:"drifted"`

	// DriftReason records why the binding was invalidated.
	DriftReason string `json:"drift_reason,omitempty"`
}

ApprovalBinding ties a human approval to a specific plan version via content-addressed hashing. If the plan changes after approval, the binding becomes invalid (drift detection).

Security invariant: the approval is ONLY valid for the exact PlanHash it was bound to. Any mutation to the plan invalidates the binding.

func NewApprovalBinding

func NewApprovalBinding(bindingID, planHash, approvalID string, validFor time.Duration) *ApprovalBinding

NewApprovalBinding creates a binding between a plan hash and an approval.

func (*ApprovalBinding) CheckDrift

func (ab *ApprovalBinding) CheckDrift(currentPlanHash string) bool

CheckDrift verifies that the current plan hash matches the bound hash. If it doesn't match, the binding is marked as drifted and invalidated.

func (*ApprovalBinding) IsValid

func (ab *ApprovalBinding) IsValid(now time.Time) bool

IsValid returns true if the binding is not drifted and not expired.

type ApprovalCeremony

type ApprovalCeremony struct {
	ApprovalID       string                `json:"approval_id"`
	Subject          string                `json:"subject"`
	Action           string                `json:"action"`
	State            ApprovalCeremonyState `json:"state"`
	RequestedBy      string                `json:"requested_by"`
	Approvers        []string              `json:"approvers,omitempty"`
	Quorum           int                   `json:"quorum,omitempty"`
	TimelockUntil    time.Time             `json:"timelock_until,omitempty"`
	ExpiresAt        time.Time             `json:"expires_at,omitempty"`
	BreakGlass       bool                  `json:"break_glass,omitempty"`
	AuthMethod       string                `json:"auth_method,omitempty"`
	ChallengeID      string                `json:"challenge_id,omitempty"`
	ChallengeHash    string                `json:"challenge_hash,omitempty"`
	AssertionHash    string                `json:"assertion_hash,omitempty"`
	Reason           string                `json:"reason,omitempty"`
	ReceiptID        string                `json:"receipt_id,omitempty"`
	BoundaryRecordID string                `json:"boundary_record_id,omitempty"`
	CreatedAt        time.Time             `json:"created_at"`
	UpdatedAt        time.Time             `json:"updated_at"`
	CeremonyHash     string                `json:"ceremony_hash,omitempty"`
}

func (ApprovalCeremony) Seal

func (ApprovalCeremony) Validate

func (a ApprovalCeremony) Validate() error

type ApprovalCeremonyState

type ApprovalCeremonyState string
const (
	ApprovalCeremonyPending ApprovalCeremonyState = "pending"
	ApprovalCeremonyAllowed ApprovalCeremonyState = "approved"
	ApprovalCeremonyDenied  ApprovalCeremonyState = "denied"
	ApprovalCeremonyRevoked ApprovalCeremonyState = "revoked"
	ApprovalCeremonyExpired ApprovalCeremonyState = "expired"
)

type ApprovalChallenge

type ApprovalChallenge struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	ChallengeID string `json:"challenge_id"`
	ApprovalID  string `json:"approval_id"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	PackID             string                     `json:"pack_id"`
	PackVersion        string                     `json:"pack_version"`
	PackManifestHash   string                     `json:"pack_manifest_hash"`
	Action             string                     `json:"action"`
	ConnectorAuthority ApprovalConnectorAuthority `json:"connector_authority"`

	IntentHash string `json:"intent_hash"`
	EffectHash string `json:"effect_hash"`
	PlanHash   string `json:"plan_hash"`
	Decision   string `json:"decision"`

	PolicyVersion string `json:"policy_version"`
	PolicyEpoch   string `json:"policy_epoch"`
	PolicyHash    string `json:"policy_hash"`

	AuthoritySource       string `json:"authority_source"`
	AuthorityVersion      string `json:"authority_version"`
	AuthoritySnapshotHash string `json:"authority_snapshot_hash"`

	RequiredRole string `json:"required_role"`
	Quorum       int    `json:"quorum"`

	ServerIdentity string    `json:"server_identity"`
	HoldStartedAt  time.Time `json:"hold_started_at"`
	EligibleAt     time.Time `json:"eligible_at"`
	IssuedAt       time.Time `json:"issued_at"`
	ExpiresAt      time.Time `json:"expires_at"`
	Nonce          string    `json:"nonce"`

	ChallengeHash string `json:"challenge_hash,omitempty"`
}

ApprovalChallenge is the canonical server-issued payload an approver signs. Server timestamps and ChallengeHash are authoritative only when this record is loaded from the owning durable ceremony store; a client-submitted copy is not proof of elapsed hold time or policy authority.

func (ApprovalChallenge) Seal

Seal creates the domain-separated JCS hash referenced by approval assertions. The signable challenge, including its fresh nonce, MUST be minted and released from the owning durable ceremony no earlier than IssuedAt, and IssuedAt cannot precede EligibleAt. The timestamp alone does not prove release time; callers MUST load issuance provenance from that durable store rather than accept a client-submitted challenge.

func (ApprovalChallenge) Validate

func (c ApprovalChallenge) Validate() error

func (ApprovalChallenge) ValidateAt

func (c ApprovalChallenge) ValidateAt(now time.Time) error

ValidateAt verifies the sealed challenge and its server-measured active window. It does not prove the record came from durable server state.

type ApprovalConnectorAuthority

type ApprovalConnectorAuthority struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`
	State           string `json:"state"`

	BindingRef  string `json:"binding_ref"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`

	PackID           string `json:"pack_id"`
	PackVersion      string `json:"pack_version"`
	PackManifestHash string `json:"pack_manifest_hash"`
	Action           string `json:"action"`
	ConnectorAction  string `json:"connector_action"`
	EffectHash       string `json:"effect_hash"`
	PolicyHash       string `json:"policy_hash"`

	ConnectorID             string `json:"connector_id"`
	ConnectorVersion        string `json:"connector_version"`
	ReleaseScopeKind        string `json:"release_scope_kind"`
	ReleaseAuthorityID      string `json:"release_authority_id"`
	ReleaseRegistryRevision uint64 `json:"release_registry_revision"`
	ReleaseAuthorityHash    string `json:"release_authority_hash"`
	ConnectorExecutorKind   string `json:"connector_executor_kind"`
	ConnectorBinaryHash     string `json:"connector_binary_hash"`
	ConnectorSignatureRef   string `json:"connector_signature_ref"`
	ConnectorSignatureHash  string `json:"connector_signature_hash"`
	ConnectorSignerID       string `json:"connector_signer_id"`
	ConnectorSandboxProfile string `json:"connector_sandbox_profile"`
	ConnectorDriftPolicyRef string `json:"connector_drift_policy_ref"`

	CertificationRef       string `json:"certification_ref"`
	CertificationHash      string `json:"certification_hash"`
	CertificationAuthority string `json:"certification_authority"`

	AuthorityHash string `json:"authority_hash,omitempty"`
}

ApprovalConnectorAuthority is the policy-owned connector release snapshot approved for one exact pack lifecycle effect. It is committed before the approval hold starts and is carried unchanged through challenge, quorum, grant, consumption, and dispatch admission.

This immutable snapshot prevents a dispatch workload from selecting its own connector. A near-effect boundary must additionally check the release against the current source-owned revocation registry before execution.

func (ApprovalConnectorAuthority) Seal

func (ApprovalConnectorAuthority) Validate

func (a ApprovalConnectorAuthority) Validate() error

func (ApprovalConnectorAuthority) ValidateCurrentRelease

func (a ApprovalConnectorAuthority) ValidateCurrentRelease(current ConnectorReleaseAuthority) error

ValidateCurrentRelease proves that this approval snapshot names the exact source-owned certified registry head. The caller must load that head and evaluate its validity inside the same transaction that persists the durable effect reservation; this comparison alone is not start authority.

func (ApprovalConnectorAuthority) ValidateEffectBinding

func (a ApprovalConnectorAuthority) ValidateEffectBinding(
	tenantID, workspaceID, packID, packVersion, packManifestHash, action, effectHash, policyHash string,
) error

ValidateEffectBinding proves that the connector snapshot belongs to the exact effect context carried by its enclosing approval artifact.

func (ApprovalConnectorAuthority) ValidateIntegrity

func (a ApprovalConnectorAuthority) ValidateIntegrity() error

type ApprovalDispatchAdmission

type ApprovalDispatchAdmission struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`
	Coverage        string `json:"coverage"`

	AdmissionID string `json:"admission_id"`
	AttemptID   string `json:"attempt_id"`
	State       string `json:"state"`

	ApprovalID      string `json:"approval_id"`
	GrantID         string `json:"grant_id"`
	GrantHash       string `json:"grant_hash"`
	ConsumptionHash string `json:"consumption_hash"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`
	AdmittedBy  string `json:"admitted_by"`

	IdempotencyKeyHash string                     `json:"idempotency_key_hash"`
	EffectHash         string                     `json:"effect_hash"`
	Action             string                     `json:"action"`
	ConnectorAuthority ApprovalConnectorAuthority `json:"connector_authority"`

	KernelTrustRootID string `json:"kernel_trust_root_id"`
	SigningKeyRef     string `json:"signing_key_ref"`

	IssuedAt  time.Time `json:"issued_at"`
	ExpiresAt time.Time `json:"expires_at"`

	AdmissionHash string `json:"admission_hash,omitempty"`
}

ApprovalDispatchAdmission is the Kernel-signed linearization record required immediately before a data plane may move one consumed approval grant into DISPATCHING. Admission issuance is serialized with scoped FENCE; it is not a generic connector permit and does not claim to cancel already admitted work.

func (ApprovalDispatchAdmission) Seal

func (ApprovalDispatchAdmission) Validate

func (a ApprovalDispatchAdmission) Validate() error

func (ApprovalDispatchAdmission) ValidateAt

func (a ApprovalDispatchAdmission) ValidateAt(now time.Time) error

ValidateAt checks deterministic integrity and the half-open admission lifetime [issued_at, expires_at). It does not verify the Kernel signature or prove durable attempt state; effect boundaries must perform all three gates.

func (ApprovalDispatchAdmission) ValidateConsumption

func (a ApprovalDispatchAdmission) ValidateConsumption(consumption ApprovalGrantConsumption) error

ValidateConsumption proves that an admission is bound to the exact signed consumption it advances toward a connector effect.

func (ApprovalDispatchAdmission) ValidateIntegrity

func (a ApprovalDispatchAdmission) ValidateIntegrity() error

ValidateIntegrity verifies the self-hash without requiring the separately signed consumption record. Callers that hold the consumption must use ValidateConsumption as the stronger binding check.

type ApprovalGrant

type ApprovalGrant struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	GrantID     string `json:"grant_id"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	PackID             string                     `json:"pack_id"`
	PackVersion        string                     `json:"pack_version"`
	PackManifestHash   string                     `json:"pack_manifest_hash"`
	Action             string                     `json:"action"`
	ConnectorAuthority ApprovalConnectorAuthority `json:"connector_authority"`

	IntentHash string `json:"intent_hash"`
	EffectHash string `json:"effect_hash"`
	PlanHash   string `json:"plan_hash"`
	Decision   string `json:"decision"`

	PolicyVersion string `json:"policy_version"`
	PolicyEpoch   string `json:"policy_epoch"`
	PolicyHash    string `json:"policy_hash"`

	ApprovalID    string `json:"approval_id"`
	CeremonyHash  string `json:"ceremony_hash"`
	SignerSetHash string `json:"signer_set_hash"`

	ServerIdentity    string `json:"server_identity"`
	KernelTrustRootID string `json:"kernel_trust_root_id"`
	SigningKeyRef     string `json:"signing_key_ref"`

	IssuedAt  time.Time `json:"issued_at"`
	ExpiresAt time.Time `json:"expires_at"`
	Nonce     string    `json:"nonce"`

	GrantHash string `json:"grant_hash,omitempty"`
}

ApprovalGrant is the source-owned binding for a future, server-signed, single-use approval authority. It is deliberately not an authorization on its own: callers MUST verify the server signature and atomically consume the grant in a durable store before performing a mutation.

GrantHash seals every authority-bearing field below. The approvalceremony boundary owns its signature, durable single-use transition, and the separate signed ApprovalGrantConsumption record; legacy approval metadata MUST NOT be promoted into this contract.

func (ApprovalGrant) Seal

func (g ApprovalGrant) Seal() (ApprovalGrant, error)

Seal deterministically hashes the JCS representation of every bound field. Seal does not sign or authorize the grant.

func (ApprovalGrant) Validate

func (g ApprovalGrant) Validate() error

Validate checks the immutable grant shape. It does not establish signature trust, liveness, or replay safety.

func (ApprovalGrant) ValidateAt

func (g ApprovalGrant) ValidateAt(now time.Time) error

ValidateAt checks deterministic integrity and whether the sealed grant is active at now. It still does not verify a server signature or consume replay state, so success MUST NOT be treated as mutation authority.

type ApprovalGrantConsumption

type ApprovalGrantConsumption struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	ApprovalID string `json:"approval_id"`
	GrantID    string `json:"grant_id"`
	GrantHash  string `json:"grant_hash"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`
	ConsumedBy  string `json:"consumed_by"`

	PackID             string                     `json:"pack_id"`
	PackVersion        string                     `json:"pack_version"`
	PackManifestHash   string                     `json:"pack_manifest_hash"`
	Action             string                     `json:"action"`
	ConnectorAuthority ApprovalConnectorAuthority `json:"connector_authority"`

	IntentHash string `json:"intent_hash"`
	EffectHash string `json:"effect_hash"`
	PlanHash   string `json:"plan_hash"`

	PolicyVersion string `json:"policy_version"`
	PolicyEpoch   string `json:"policy_epoch"`
	PolicyHash    string `json:"policy_hash"`

	ServerIdentity    string `json:"server_identity"`
	KernelTrustRootID string `json:"kernel_trust_root_id"`
	SigningKeyRef     string `json:"signing_key_ref"`

	GrantIssuedAt  time.Time `json:"grant_issued_at"`
	GrantExpiresAt time.Time `json:"grant_expires_at"`
	ConsumedAt     time.Time `json:"consumed_at"`

	ConsumptionHash string `json:"consumption_hash,omitempty"`
}

ApprovalGrantConsumption is the portable, Kernel-signed record that a specific workload consumed one ApprovalGrant. It is deliberately scoped to the pack lifecycle fields already sealed by ApprovalGrant; it must not be promoted into a generic connector or arbitrary agent-effect permit.

The ceremony store persists this record in the same transaction that moves the grant to CONSUMED. A dispatcher may recover the exact record after a response loss, but still needs its own durable grant_hash CAS before invoking the pack lifecycle connector.

func (ApprovalGrantConsumption) Seal

func (ApprovalGrantConsumption) Validate

func (c ApprovalGrantConsumption) Validate() error

func (ApprovalGrantConsumption) ValidateGrant

func (c ApprovalGrantConsumption) ValidateGrant(grant ApprovalGrant) error

ValidateGrant proves that the consumption record is an exact projection of one sealed ApprovalGrant. Signature trust is established separately.

type ApprovalReceipt

type ApprovalReceipt struct {
	// IntentHash is the SHA-256 of the serialized AuthorizedExecutionIntent
	IntentHash string `json:"intent_hash"`

	// PlanHash is the hash of the execution plan
	PlanHash string `json:"plan_hash"`

	// PolicyHash is the hash of the enforced policy
	PolicyHash string `json:"policy_hash"`

	// Nonce is the unique execution nonce
	Nonce string `json:"nonce"`

	// ApproverID identifies the human operator
	ApproverID string `json:"approver_id"`

	// PublicKey is the approver public key. Classical receipts use an Ed25519
	// hex key; hybrid receipts use a hybrid:<ed25519_hex>:<mldsa65_hex> envelope.
	PublicKey string `json:"public_key"`

	// Signature is the approval signature. Classical receipts use a hex
	// Ed25519 signature; hybrid receipts use hybrid:<ed25519_hex>:<mldsa65_hex>.
	Signature string `json:"signature"`

	SignatureProfile   string `json:"signature_profile,omitempty"`
	SignatureAlgorithm string `json:"signature_algorithm,omitempty"`
	KeyID              string `json:"key_id,omitempty"`

	// PublicKeySet exposes component keys for display/interoperability. The
	// public_key envelope remains authoritative for registry authorization.
	PublicKeySet       map[string]string `json:"public_key_set,omitempty"`
	VerificationPolicy string            `json:"verification_policy,omitempty"`
	DowngradeRejected  bool              `json:"downgrade_rejected,omitempty"`
	AcceptedAlgorithms []string          `json:"accepted_algorithms,omitempty"`

	// Timestamp of when the approval was signed
	Timestamp time.Time `json:"timestamp"`

	// BiometricTier indicates the authentication method used
	// Values: "passkey", "webcrypto", "totp", "none"
	BiometricTier string `json:"biometric_tier"`

	// SessionID links this approval to a specific operator session
	SessionID string `json:"session_id,omitempty"`
}

ApprovalReceipt represents a cryptographic approval signed by a human operator. This is the HITL (Human-in-the-Loop) bridge contract that binds a human's cryptographic identity to an execution intent.

Security Properties:

  • IntentHash links to the exact execution intent being approved
  • Signature is profile-aware over the approval context
  • BiometricTier indicates the authentication strength
  • Timestamp enables temporal ordering of approvals

func (*ApprovalReceipt) UnmarshalJSON

func (r *ApprovalReceipt) UnmarshalJSON(data []byte) error

UnmarshalJSON preserves v0.8.4 request compatibility by accepting the legacy *_b64 field names and canonicalizing them into the authoritative public_key/signature fields.

type ApprovalRequest

type ApprovalRequest struct {
	RequestID  string         `json:"request_id"`
	IntentHash string         `json:"intent_hash"`
	IntentID   string         `json:"intent_id"`
	ToolName   string         `json:"tool_name"`
	RiskLevel  string         `json:"risk_level"` // "LOW", "MEDIUM", "HIGH", "CRITICAL"
	Status     ApprovalStatus `json:"status"`
	CreatedAt  time.Time      `json:"created_at"`
	ExpiresAt  time.Time      `json:"expires_at"`

	// Approval receipt, populated when status is APPROVED
	Receipt *ApprovalReceipt `json:"receipt,omitempty"`
}

ApprovalRequest represents a pending approval that the HITL bridge surfaces to operators.

type ApprovalSpec

type ApprovalSpec struct {
	ApproverRoles  []string `json:"approver_roles"`
	Quorum         int      `json:"quorum"`
	TimeoutSeconds int      `json:"timeout_seconds"`
	OnTimeout      string   `json:"on_timeout"` // deny, escalate_further, abort_run
}

ApprovalSpec defines who can approve and how.

type ApprovalStatus

type ApprovalStatus string

ApprovalStatus represents the current state of an approval request.

const (
	ApprovalPending  ApprovalStatus = "PENDING"
	ApprovalApproved ApprovalStatus = "APPROVED"
	ApprovalRejected ApprovalStatus = "REJECTED"
	ApprovalExpired  ApprovalStatus = "EXPIRED"
)

type ApprovalWebAuthnAssertion

type ApprovalWebAuthnAssertion struct {
	ChallengeID string `json:"challenge_id"`
	Actor       string `json:"actor"`
	Assertion   string `json:"assertion"`
	ReceiptID   string `json:"receipt_id,omitempty"`
	Reason      string `json:"reason,omitempty"`
}

type ApprovalWebAuthnChallenge

type ApprovalWebAuthnChallenge struct {
	ChallengeID   string    `json:"challenge_id"`
	ApprovalID    string    `json:"approval_id"`
	Method        string    `json:"method"`
	Challenge     string    `json:"challenge,omitempty"`
	ChallengeHash string    `json:"challenge_hash"`
	ExpiresAt     time.Time `json:"expires_at"`
	CreatedAt     time.Time `json:"created_at"`
	Verified      bool      `json:"verified"`
	AssertionHash string    `json:"assertion_hash,omitempty"`
}

type ArtifactRef

type ArtifactRef struct {
	Name      string            `json:"name"`
	MediaType string            `json:"media_type"`
	URI       string            `json:"uri"`
	Hash      string            `json:"hash"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

ArtifactRef points to a content-addressed blob.

type Attempt

type Attempt struct {
	AttemptID string    `json:"attempt_id"`
	Timestamp time.Time `json:"timestamp"`
	Success   bool      `json:"success"`
	Error     string    `json:"error,omitempty"`
}

Attempt represents a single attempt with timestamp and status.

type AttestationResultEnvelope

type AttestationResultEnvelope struct {
	EnvelopeID      string    `json:"envelope_id"`
	ProfileID       string    `json:"profile_id"`
	Subject         string    `json:"subject"`
	Platform        string    `json:"platform"`
	MeasurementHash string    `json:"measurement_hash"`
	Nonce           string    `json:"nonce"`
	TrustTier       string    `json:"trust_tier"`
	PolicyHash      string    `json:"policy_hash"`
	Synthetic       bool      `json:"synthetic"`
	IssuedAt        time.Time `json:"issued_at"`
	ExpiresAt       time.Time `json:"expires_at"`
	Signature       string    `json:"signature"`
}

type AuditEntry

type AuditEntry struct {
	ID        string    `json:"id"`
	Action    string    `json:"action"`
	Timestamp time.Time `json:"timestamp"`
	Actor     string    `json:"actor,omitempty"`
	Details   string    `json:"details,omitempty"`
}

AuditEntry records a security or operational event.

type AuthorizedExecutionIntent

type AuthorizedExecutionIntent struct {
	ID               string               `json:"id"`                 // Derived Hash
	DecisionID       string               `json:"decision_id"`        // Link to permission
	EffectDigestHash string               `json:"effect_digest_hash"` // Bind to specific effect parameters
	EffectBinding    *EffectDigestBinding `json:"effect_binding,omitempty"`
	IdempotencyKey   string               `json:"idempotency_key"`
	IssuedAt         time.Time            `json:"issued_at"`
	ExpiresAt        time.Time            `json:"expires_at"`
	Signer           string               `json:"signer"`                      // Kernel Identity
	Signature        string               `json:"signature"`                   // Sig of the Intent
	SignatureType    string               `json:"signature_type"`              // Algorithm binding (e.g. "ed25519:key-id")
	SignatureVersion string               `json:"signature_version,omitempty"` // Signing-preimage contract
	AllowedTool      string               `json:"allowed_tool"`                // Constraint
	Taint            []string             `json:"taint,omitempty"`

	// Safe Deprecation Mode emergency authority bindings. These are populated
	// only after a prebuilt emergency capsule has passed continuity, hardware
	// quorum, attestation-result, and delegation validation.
	EmergencyActivationID        string `json:"emergency_activation_id,omitempty"`
	EmergencyDelegationSessionID string `json:"emergency_delegation_session_id,omitempty"`
	EmergencyScopeHash           string `json:"emergency_scope_hash,omitempty"`
}

AuthorizedExecutionIntent represents a derived, signed intent to execute a specific effect. It decouples the "Permission" (Decision) from "Action" (Execution). (Sequence 8)

func (*AuthorizedExecutionIntent) ValidateAt

func (i *AuthorizedExecutionIntent) ValidateAt(now time.Time) error

ValidateAt confirms that the signed execution-authority window is active.

type AuthzHealth

type AuthzHealth struct {
	Status           string    `json:"status"`
	Resolver         string    `json:"resolver"`
	ModelID          string    `json:"model_id,omitempty"`
	RelationshipHash string    `json:"relationship_hash,omitempty"`
	Stale            bool      `json:"stale,omitempty"`
	ModelMismatch    bool      `json:"model_mismatch,omitempty"`
	CheckedAt        time.Time `json:"checked_at"`
}

type AuthzSnapshot

type AuthzSnapshot struct {
	SnapshotID       string    `json:"snapshot_id"`
	Resolver         string    `json:"resolver"`
	ModelID          string    `json:"model_id"`
	RelationshipHash string    `json:"relationship_hash"`
	SnapshotToken    string    `json:"snapshot_token,omitempty"`
	Subject          string    `json:"subject"`
	Object           string    `json:"object"`
	Relation         string    `json:"relation"`
	Decision         bool      `json:"decision"`
	Stale            bool      `json:"stale,omitempty"`
	ModelMismatch    bool      `json:"model_mismatch,omitempty"`
	CheckedAt        time.Time `json:"checked_at"`
	SnapshotHash     string    `json:"snapshot_hash,omitempty"`
}

AuthzSnapshot binds a relationship-graph authorization decision to the relationship model and tuple snapshot observed by the PDP.

func (AuthzSnapshot) Seal

func (s AuthzSnapshot) Seal() (AuthzSnapshot, error)

func (AuthzSnapshot) Validate

func (s AuthzSnapshot) Validate() error

type AutonomyEnvelope

type AutonomyEnvelope struct {
	// Identity
	EnvelopeID    string `json:"envelope_id"`
	Version       string `json:"version"`        // Semantic version of this envelope definition
	FormatVersion string `json:"format_version"` // Schema format version, currently "1.0.0"

	// Validity window
	ValidFrom  time.Time `json:"valid_from,omitempty"`
	ValidUntil time.Time `json:"valid_until,omitempty"`

	// Tenant scope
	TenantID string `json:"tenant_id,omitempty"`

	// Core constraints
	JurisdictionScope JurisdictionConstraint `json:"jurisdiction_scope"`
	DataHandling      DataHandlingRules      `json:"data_handling"`
	AllowedEffects    []EffectClassAllowlist `json:"allowed_effects"`
	Budgets           EnvelopeBudgets        `json:"budgets"`
	RequiredEvidence  []EvidenceRequirement  `json:"required_evidence"`
	EscalationPolicy  EscalationRules        `json:"escalation_policy"`

	// Cryptographic attestation
	Attestation EnvelopeAttestation `json:"attestation"`
}

AutonomyEnvelope is the first-class runtime contract that bounds an autonomous run. It must be signed, versioned, and validated by the kernel before any effects execute.

type AutonomyRunStage

type AutonomyRunStage string

AutonomyRunStage is the lifecycle stage of an autonomous run. This extends the existing RunStage concept with explicit sensing/planning/verifying phases.

const (
	RunStageSensing   AutonomyRunStage = "SENSING"
	RunStagePlanning  AutonomyRunStage = "PLANNING"
	RunStageGating    AutonomyRunStage = "GATING"
	RunStageExecuting AutonomyRunStage = "EXECUTING"
	RunStageVerifying AutonomyRunStage = "VERIFYING"
	RunStageDone      AutonomyRunStage = "DONE"
	RunStageFailed    AutonomyRunStage = "FAILED"
	RunStageBlocked   AutonomyRunStage = "BLOCKED"
)

type BoundaryCapabilitySummary

type BoundaryCapabilitySummary struct {
	CapabilityID     string   `json:"capability_id"`
	Category         string   `json:"category"`
	Status           string   `json:"status"`
	Authority        string   `json:"authority"`
	PublicRoutes     []string `json:"public_routes,omitempty"`
	CLICommands      []string `json:"cli_commands,omitempty"`
	ReceiptBindings  []string `json:"receipt_bindings,omitempty"`
	ConformanceLevel string   `json:"conformance_level,omitempty"`
	Notes            string   `json:"notes,omitempty"`
}

BoundaryCapabilitySummary describes what the OSS boundary can enforce and what remains a non-authoritative export or integration surface.

type BoundaryCheckpoint

type BoundaryCheckpoint struct {
	CheckpointID      string    `json:"checkpoint_id"`
	Sequence          int64     `json:"sequence"`
	RecordCount       int       `json:"record_count"`
	ReceiptCount      int       `json:"receipt_count"`
	RecordRootHash    string    `json:"record_root_hash"`
	ReceiptRootHash   string    `json:"receipt_root_hash"`
	PreviousHash      string    `json:"previous_hash,omitempty"`
	RecordHashes      []string  `json:"record_hashes,omitempty"`
	CreatedAt         time.Time `json:"created_at"`
	CheckpointHash    string    `json:"checkpoint_hash,omitempty"`
	InclusionProofURI string    `json:"inclusion_proof_uri,omitempty"`
}

BoundaryCheckpoint is a tamper-evident checkpoint over record and receipt roots. It lets offline verifiers detect omission, reordering, or tampering.

func (BoundaryCheckpoint) Seal

func (BoundaryCheckpoint) Validate

func (c BoundaryCheckpoint) Validate() error

type BoundaryDriftReceipt

type BoundaryDriftReceipt struct {
	ReceiptVersion  string    `json:"receipt_version"`
	ReceiptID       string    `json:"receipt_id"`
	Type            string    `json:"type"`
	ReasonCode      string    `json:"reason_code"`
	Severity        string    `json:"severity,omitempty"`
	HostReceiptID   string    `json:"host_receipt_id,omitempty"`
	HostReceiptHash string    `json:"host_receipt_hash,omitempty"`
	HELMReceiptID   string    `json:"helm_receipt_id,omitempty"`
	HELMDecisionID  string    `json:"helm_decision_id,omitempty"`
	PolicyHash      string    `json:"policy_hash,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
	ReceiptHash     string    `json:"receipt_hash"`
	Signature       string    `json:"signature,omitempty"`
	SignerKeyID     string    `json:"signer_key_id,omitempty"`
}

BoundaryDriftReceipt records a mismatch between HELM authority and observed host behavior.

type BoundaryRecordVerification

type BoundaryRecordVerification struct {
	RecordID       string            `json:"record_id"`
	Verdict        string            `json:"verdict"`
	RecordHash     string            `json:"record_hash,omitempty"`
	ReceiptID      string            `json:"receipt_id,omitempty"`
	Verified       bool              `json:"verified"`
	Offline        bool              `json:"offline"`
	Checks         map[string]string `json:"checks"`
	Errors         []string          `json:"errors,omitempty"`
	VerifiedAt     time.Time         `json:"verified_at"`
	CheckpointHash string            `json:"checkpoint_hash,omitempty"`
	InclusionProof []string          `json:"inclusion_proof,omitempty"`
}

type BoundarySearchRequest

type BoundarySearchRequest struct {
	Verdict       string `json:"verdict,omitempty"`
	ReasonCode    string `json:"reason_code,omitempty"`
	ToolName      string `json:"tool_name,omitempty"`
	MCPServerID   string `json:"mcp_server_id,omitempty"`
	PolicyEpoch   string `json:"policy_epoch,omitempty"`
	ReceiptID     string `json:"receipt_id,omitempty"`
	Limit         int    `json:"limit,omitempty"`
	IncludeDenied bool   `json:"include_denied,omitempty"`
}

type BoundaryStatus

type BoundaryStatus struct {
	Status              string            `json:"status"`
	Mode                string            `json:"mode"`
	Version             string            `json:"version,omitempty"`
	ReceiptSigner       string            `json:"receipt_signer"`
	ReceiptStore        string            `json:"receipt_store"`
	PDP                 string            `json:"pdp"`
	MCPFirewall         string            `json:"mcp_firewall"`
	Sandbox             string            `json:"sandbox"`
	Authz               string            `json:"authz"`
	EvidenceVerifier    string            `json:"evidence_verifier"`
	CheckpointLog       string            `json:"checkpoint_log"`
	LastCheckpointHash  string            `json:"last_checkpoint_hash,omitempty"`
	OpenApprovalCount   int               `json:"open_approval_count"`
	QuarantinedMCPCount int               `json:"quarantined_mcp_count"`
	UpdatedAt           time.Time         `json:"updated_at"`
	Components          map[string]string `json:"components,omitempty"`
}

BoundaryStatus is the public health summary for the proof-bearing execution boundary. It is intentionally mechanism-focused and vendor-neutral.

type Budget

type Budget struct {
	// ID uniquely identifies this budget allocation.
	ID string `json:"id"`

	// MaxTokens is the LLM token ceiling for this execution.
	MaxTokens int64 `json:"max_tokens"`

	// MaxCostCents is the monetary ceiling in cents (USD).
	MaxCostCents int64 `json:"max_cost_cents"`

	// MaxEffects is the ceiling on total effects (across all classes).
	MaxEffects int64 `json:"max_effects"`

	// MaxDuration is the wall-clock time ceiling.
	MaxDuration time.Duration `json:"max_duration"`

	// PerEffectClassLimits constrains individual effect classes.
	// Key is the effect class string (E0-E4).
	PerEffectClassLimits map[string]int64 `json:"per_effect_class_limits,omitempty"`

	// ConsumedTokens tracks current usage (mutable during execution).
	ConsumedTokens int64 `json:"consumed_tokens"`

	// ConsumedCostCents tracks current cost (mutable during execution).
	ConsumedCostCents int64 `json:"consumed_cost_cents"`

	// ConsumedEffects tracks current effect count (mutable during execution).
	ConsumedEffects int64 `json:"consumed_effects"`
}

Budget is the resource/cost envelope for an execution context. Budgets are immutable once bound to an execution; overruns fail-close.

func (*Budget) Exhausted

func (b *Budget) Exhausted() bool

Exhausted returns true if any budget dimension has been exceeded.

func (*Budget) RemainingTokens

func (b *Budget) RemainingTokens() int64

RemainingTokens returns the number of tokens remaining, or 0 if exhausted.

type BudgetCeiling

type BudgetCeiling struct {
	BudgetID              string    `json:"budget_id"`
	Subject               string    `json:"subject"`
	ToolCallLimit         int       `json:"tool_call_limit,omitempty"`
	SpendLimitCents       int64     `json:"spend_limit_cents,omitempty"`
	EgressLimitBytes      int64     `json:"egress_limit_bytes,omitempty"`
	WriteOperationLimit   int       `json:"write_operation_limit,omitempty"`
	ApprovalRequiredAbove int64     `json:"approval_required_above_cents,omitempty"`
	Window                string    `json:"window"`
	PolicyEpoch           string    `json:"policy_epoch,omitempty"`
	UpdatedAt             time.Time `json:"updated_at"`
}

func (*BudgetCeiling) UnmarshalJSON

func (b *BudgetCeiling) UnmarshalJSON(data []byte) error

type BudgetSummary

type BudgetSummary struct {
	EnvelopeCents int64   `json:"envelope_cents"`
	BurnCents     int64   `json:"burn_cents"`
	BurnRate      float64 `json:"burn_rate"` // Cents per hour, trailing average
	RunwayHours   float64 `json:"runway_hours,omitempty"`
}

BudgetSummary is a projection of budget consumption vs envelope.

type BuildInfo

type BuildInfo struct {
	Timestamp string `json:"timestamp"`
	Commit    string `json:"commit"`
	GitCommit string `json:"git_commit"` // Alias
	Builder   string `json:"builder"`
	Step      string `json:"step"`
}

BuildInfo contains build metadata.

type Bundle

type Bundle struct {
	ProposalID       string          `json:"proposal_id"`
	CanonicalJSON    string          `json:"canonical_json"`
	PhenotypeHash    string          `json:"phenotype_hash"`
	PolicyProof      *DecisionRecord `json:"policy_proof"`
	DeterminismProof string          `json:"determinism_proof"`
	Receipt          *EffectReceipt  `json:"receipt"`
	GeneratedAt      time.Time       `json:"generated_at"`
}

Bundle represents a cryptographically verifiable proof of a spend event.

type CapabilityDiff

type CapabilityDiff struct {
	// ID is a stable, deterministic identifier derived from the source op.
	ID string `json:"id"`

	// Category classifies the change type.
	Category DiffCategory `json:"category"`

	// Severity indicates how much attention this needs.
	Severity DiffSeverity `json:"severity"`

	// Title is a short human-readable summary (max 80 chars).
	Title string `json:"title"`

	// Description is a longer explanation.
	Description string `json:"description,omitempty"`

	// Before/After show the state transition.
	Before string `json:"before,omitempty"`
	After  string `json:"after,omitempty"`

	// SourceOp is the raw ops event kind that triggered this diff.
	SourceOp string `json:"source_op"`

	// NodeRef is the SmartRef of the affected node (if applicable).
	NodeRef string `json:"node_ref,omitempty"`
}

CapabilityDiff represents a single human-readable change.

type ChangeContext

type ChangeContext struct {
	Repo      string `json:"repo"`
	CommitSHA string `json:"commit_sha"`
	Branch    string `json:"branch"`
	Tag       string `json:"tag,omitempty"`
	TicketID  string `json:"ticket_id,omitempty"`
}

type ChangeEvidenceRefs

type ChangeEvidenceRefs struct {
	ApprovalReceiptID     string `json:"approval_receipt_id"`
	BuildReceiptID        string `json:"build_receipt_id"`
	DeploymentReceiptID   string `json:"deployment_receipt_id,omitempty"`
	SecurityScanReceiptID string `json:"security_scan_receipt_id,omitempty"`
}

type ChangePack

type ChangePack struct {
	PackID        string                `json:"pack_id"`
	PackType      string                `json:"pack_type"` // "CHANGE_PACK"
	TargetSystem  string                `json:"target_system"`
	ChangeContext ChangeContext         `json:"change_context"`
	EvidenceRefs  ChangeEvidenceRefs    `json:"evidence_refs"`
	Attestation   ChangePackAttestation `json:"attestation"`
}

ChangePack represents a proof of authorized change.

type ChangePackAttestation

type ChangePackAttestation struct {
	PackHash    string    `json:"pack_hash"`
	Signature   string    `json:"signature,omitempty"`
	SignerID    string    `json:"signer_id,omitempty"`
	GeneratedAt time.Time `json:"generated_at"`
}

type ClarificationPayload

type ClarificationPayload struct {
	Question string   `json:"question"`
	Context  []string `json:"context,omitempty"`
}

ClarificationPayload structure for REQUEST_CLARIFICATION effects.

type Classification

type Classification struct {
	Reversibility string `json:"reversibility"` // reversible, compensatable, irreversible
	BlastRadius   string `json:"blast_radius"`  // single_record, dataset, system_wide
	Urgency       string `json:"urgency"`       // deferrable, time_sensitive, immediate
}

type ClientObservation

type ClientObservation struct {
	// ClientLoadObserved is true only when HELM has direct evidence the client
	// process ran under its control. Never true on a hook_reported or
	// unobserved basis; Validate enforces this.
	ClientLoadObserved bool `json:"client_load_observed"`
	// ObservationBasis is one of the ClientObservationBasis* constants and names
	// how HELM knows what it knows.
	ObservationBasis string `json:"observation_basis"`
	// HarnessID is the adapter that ran the client (e.g. "claude", "codex").
	HarnessID string `json:"harness_id,omitempty"`
	// ProcessOwned is true when HELM was the parent process of the client —
	// spawned it, scoped its HOME, scrubbed its env, and supervised it. This is
	// the only basis on which ClientLoadObserved may be true.
	ProcessOwned bool `json:"process_owned"`
}

ClientObservation records whether HELM actually observed the client process load, and on what basis. It is a signed fact: because the whole receipt is canonicalized into ReceiptHash and Signature, a mutated ClientObservation invalidates the signature.

Before this field existed, "ClientLoadObserved" lived only in prose across the docs. A prose assertion about evidence is not evidence. This makes the claim a typed value on the receipt that earned it, and Validate refuses the combinations that would let a weaker basis assert a stronger fact.

The field is a pointer with omitempty so a receipt that predates it — or a run that never observed the client — omits the key entirely and verifies byte-identically, exactly as CompletedAt already does.

func (*ClientObservation) Validate

func (c *ClientObservation) Validate() error

Validate rejects a ClientObservation whose claim outruns its basis. A nil receiver is valid: absence of observation is a legitimate state, distinct from a false claim of one.

type CoexistenceCapabilityManifest

type CoexistenceCapabilityManifest struct {
	ManifestID      string    `json:"manifest_id"`
	Authority       string    `json:"authority"`
	BoundaryRole    string    `json:"boundary_role"`
	SupportedInputs []string  `json:"supported_inputs"`
	ExportSurfaces  []string  `json:"export_surfaces"`
	ReceiptBindings []string  `json:"receipt_bindings"`
	GeneratedAt     time.Time `json:"generated_at"`
}

type CompensationRecipe

type CompensationRecipe struct {
	RecipeID       string             `json:"recipe_id"`
	RunID          string             `json:"run_id"`
	Steps          []CompensationStep `json:"steps"`
	AutoExecutable bool               `json:"auto_executable"` // can be run without human
	EstimatedTime  string             `json:"estimated_time,omitempty"`
	CreatedAt      time.Time          `json:"created_at"`
	ContentHash    string             `json:"content_hash"`
}

CompensationRecipe is a structured rollback/undo plan.

func NewCompensationRecipe

func NewCompensationRecipe(runID string, steps []CompensationStep, autoExecutable bool) *CompensationRecipe

NewCompensationRecipe creates a recipe with computed hash.

func (*CompensationRecipe) HasFallbacks

func (r *CompensationRecipe) HasFallbacks() bool

HasFallbacks returns true if every step has a fallback.

func (*CompensationRecipe) IsComplete

func (r *CompensationRecipe) IsComplete() bool

IsComplete returns true if all steps are defined.

type CompensationStep

type CompensationStep struct {
	StepID     string `json:"step_id"`
	Order      int    `json:"order"`
	Action     string `json:"action"` // e.g. "revert_deploy", "restore_backup", "notify_oncall"
	Target     string `json:"target"` // resource/service affected
	Idempotent bool   `json:"idempotent"`
	Timeout    string `json:"timeout,omitempty"`
	Fallback   string `json:"fallback,omitempty"` // what to do if this step fails
}

CompensationStep is one step in a compensation recipe.

type CondensationCheckpoint

type CondensationCheckpoint struct {
	// CheckpointID uniquely identifies this checkpoint.
	CheckpointID string `json:"checkpoint_id"`

	// MerkleRoot is the incremental Merkle root over accumulated receipts.
	MerkleRoot string `json:"merkle_root"`

	// ReceiptCount is the number of receipts included in this checkpoint.
	ReceiptCount int `json:"receipt_count"`

	// FirstReceiptID is the ID of the first receipt in this checkpoint window.
	FirstReceiptID string `json:"first_receipt_id"`

	// LastReceiptID is the ID of the last receipt in this checkpoint window.
	LastReceiptID string `json:"last_receipt_id"`

	// LamportClock is the Lamport clock value at checkpoint time.
	LamportClock int64 `json:"lamport_clock"`

	// CreatedAt is when this checkpoint was created.
	CreatedAt time.Time `json:"created_at"`

	// Signature is the Ed25519 signature over the checkpoint.
	Signature string `json:"signature"`
}

CondensationCheckpoint represents a periodic checkpoint in the proof condensation system. After checkpoint, low-risk receipts may be replaced by their Merkle inclusion proofs.

type CondensationInclusionProof

type CondensationInclusionProof struct {
	// LeafHash is the hash of the original receipt.
	LeafHash string `json:"leaf_hash"`

	// Siblings are the sibling hashes in the proof path.
	Siblings []string `json:"siblings"`

	// Positions indicate whether each sibling is left or right.
	Positions []string `json:"positions"`

	// Root is the Merkle root this proof verifies against.
	Root string `json:"root"`
}

CondensationInclusionProof proves a receipt was included in a checkpoint.

type CondensationTierPolicy

type CondensationTierPolicy struct {
	Tier                RiskTier `json:"tier"`
	RetainFullReceipts  bool     `json:"retain_full_receipts"`
	CondenseAfterWindow bool     `json:"condense_after_window"`
	AnchorToExternal    bool     `json:"anchor_to_external"`
}

CondensationTierPolicy defines retention behavior for a risk tier.

type CondensedReceipt

type CondensedReceipt struct {
	// ReceiptID is the original receipt ID.
	ReceiptID string `json:"receipt_id"`

	// CheckpointID references the checkpoint this receipt was condensed in.
	CheckpointID string `json:"checkpoint_id"`

	// InclusionProof is the Merkle inclusion proof for this receipt
	// against the checkpoint's MerkleRoot.
	InclusionProof CondensationInclusionProof `json:"inclusion_proof"`
}

CondensedReceipt represents a receipt that has been condensed to its Merkle inclusion proof. Sufficient for audit verification but significantly smaller than the full receipt.

type ConnectorEffectAcknowledgement

type ConnectorEffectAcknowledgement struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	AcknowledgementID string `json:"acknowledgement_id"`
	AdmissionID       string `json:"admission_id"`
	AttemptID         string `json:"attempt_id"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	ConnectorID           string `json:"connector_id"`
	ConnectorVersion      string `json:"connector_version"`
	ConnectorAction       string `json:"connector_action"`
	ConnectorExecutionRef string `json:"connector_execution_ref"`
	ProofSessionRef       string `json:"proof_session_ref,omitempty"`
	IntentRef             string `json:"intent_ref"`

	IdempotencyKeyHash     string `json:"idempotency_key_hash"`
	EffectHash             string `json:"effect_hash"`
	Outcome                string `json:"outcome"`
	ResponseHash           string `json:"response_hash"`
	EffectRef              string `json:"effect_ref,omitempty"`
	ReconciliationRef      string `json:"reconciliation_ref,omitempty"`
	DispositionReceiptHash string `json:"disposition_receipt_hash,omitempty"`

	IssuerID      string    `json:"issuer_id"`
	SigningKeyRef string    `json:"signing_key_ref"`
	Algorithm     string    `json:"algorithm"`
	ObservedAt    time.Time `json:"observed_at"`

	AcknowledgementHash string `json:"acknowledgement_hash,omitempty"`
}

ConnectorEffectAcknowledgement is the connector-runtime statement about a source-system outcome. It is not Kernel closure authority: the Kernel must verify its detached signature, bind it to an exact reservation, and issue a separate EffectCloseReceipt before the reservation is terminal.

func (ConnectorEffectAcknowledgement) Seal

func (ConnectorEffectAcknowledgement) Validate

func (ConnectorEffectAcknowledgement) ValidateIntegrity

func (a ConnectorEffectAcknowledgement) ValidateIntegrity() error

type ConnectorEffectAcknowledgementEnvelope

type ConnectorEffectAcknowledgementEnvelope struct {
	Acknowledgement ConnectorEffectAcknowledgement `json:"acknowledgement"`
	Signature       string                         `json:"signature"`
}

ConnectorEffectAcknowledgementEnvelope carries the detached connector acknowledgement signature. Trust comes from deployment-pinned issuer keys, never from key material embedded in this envelope.

func (ConnectorEffectAcknowledgementEnvelope) Validate

type ConnectorReleaseAuthority

type ConnectorReleaseAuthority struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	AuthorityID      string `json:"authority_id"`
	SigningKeyRef    string `json:"signing_key_ref"`
	Algorithm        string `json:"algorithm"`
	RegistryRevision uint64 `json:"registry_revision"`

	ScopeKind   string `json:"scope_kind"`
	TenantID    string `json:"tenant_id,omitempty"`
	WorkspaceID string `json:"workspace_id,omitempty"`

	ConnectorID      string `json:"connector_id"`
	ConnectorVersion string `json:"connector_version"`
	State            string `json:"state"`

	ConnectorExecutorKind   string `json:"connector_executor_kind"`
	ConnectorSandboxProfile string `json:"connector_sandbox_profile"`
	ConnectorDriftPolicyRef string `json:"connector_drift_policy_ref"`

	ConnectorBinaryHash    string `json:"connector_binary_hash"`
	ConnectorSignatureRef  string `json:"connector_signature_ref"`
	ConnectorSignatureHash string `json:"connector_signature_hash"`
	ConnectorSignerID      string `json:"connector_signer_id"`

	CertificationRef       string `json:"certification_ref"`
	CertificationHash      string `json:"certification_hash"`
	CertificationAuthority string `json:"certification_authority"`

	SignedAt   time.Time  `json:"signed_at"`
	ValidFrom  time.Time  `json:"valid_from"`
	ValidUntil *time.Time `json:"valid_until,omitempty"`

	PreviousAuthorityHash string `json:"previous_authority_hash,omitempty"`
	RevokesAuthorityHash  string `json:"revokes_authority_hash,omitempty"`
	AuthorityHash         string `json:"authority_hash,omitempty"`
}

ConnectorReleaseAuthority is one immutable, source-owned statement about an exact connector release. Revisions are append-only per scoped connector/version identity; a later signed revision, especially a terminal revocation, makes an older certified statement historical rather than current authority.

func (ConnectorReleaseAuthority) Seal

func (ConnectorReleaseAuthority) Validate

func (a ConnectorReleaseAuthority) Validate() error

func (ConnectorReleaseAuthority) ValidateAt

func (a ConnectorReleaseAuthority) ValidateAt(now time.Time) error

ValidateAt proves that this exact signed statement is locally live. It does not prove it is the latest registry revision; the durable current-state store must perform that anti-rollback check separately.

func (ConnectorReleaseAuthority) ValidateIntegrity

func (a ConnectorReleaseAuthority) ValidateIntegrity() error

type ConnectorReleaseAuthorityEnvelope

type ConnectorReleaseAuthorityEnvelope struct {
	Authority ConnectorReleaseAuthority `json:"authority"`
	Signature string                    `json:"signature"`
}

ConnectorReleaseAuthorityEnvelope carries the detached source-authority signature. The signed payload is domain separated and binds AuthorityHash, authority identity, key reference, revision, and algorithm.

func (ConnectorReleaseAuthorityEnvelope) Validate

type ConsoleAction

type ConsoleAction struct {
	ActionID     string `json:"action_id"`
	Label        string `json:"label"`
	Type         string `json:"type"` // "GOVERNANCE_EVENT", "NAVIGATION", "EXPORT"
	RequiresAuth bool   `json:"requires_auth"`
}

ConsoleAction is an action available from a console surface.

type ConsoleColumn

type ConsoleColumn struct {
	Key        string `json:"key"`
	Label      string `json:"label"`
	Sortable   bool   `json:"sortable"`
	Filterable bool   `json:"filterable"`
	Format     string `json:"format,omitempty"` // "DATE", "CURRENCY", "HASH", "STATUS"
}

ConsoleColumn defines a column in a console view.

type ConsoleTemplate

type ConsoleTemplate struct {
	TemplateID  string          `json:"template_id"`
	Name        string          `json:"name"`
	SurfaceType string          `json:"surface_type"` // "DASHBOARD", "DETAIL", "LIST", "GRAPH"
	DataSource  string          `json:"data_source"`  // canonical data path
	Layout      string          `json:"layout"`       // "CARD", "TABLE", "SPLIT", "FULL"
	Columns     []ConsoleColumn `json:"columns,omitempty"`
	Actions     []ConsoleAction `json:"actions,omitempty"`
}

ConsoleTemplate is an operator-console rendering primitive.

type ContinuityCheckpoint

type ContinuityCheckpoint struct {
	CheckpointID                 string    `json:"checkpoint_id"`
	OrgGenomeHash                string    `json:"org_genome_hash"`
	PolicyHash                   string    `json:"policy_hash"`
	PolicyEpoch                  uint64    `json:"policy_epoch"`
	HazardSequence               uint64    `json:"hazard_sequence"`
	LamportClock                 uint64    `json:"lamport_clock"`
	DeadManWindowID              string    `json:"dead_man_window_id"`
	DeadManActive                bool      `json:"dead_man_active"`
	LatestAcceptedCheckpointHash string    `json:"latest_accepted_checkpoint_hash"`
	PreviousCheckpointHash       string    `json:"previous_checkpoint_hash,omitempty"`
	Nonce                        string    `json:"nonce"`
	AttestedTime                 time.Time `json:"attested_time"`
	ExpiresAt                    time.Time `json:"expires_at"`
	Signature                    string    `json:"signature,omitempty"`
}

type CorridorPolicy

type CorridorPolicy struct {
	// ID uniquely identifies this corridor.
	ID string `json:"id"`

	// Name is a human-readable corridor name (e.g., "stripe-api-v1").
	Name string `json:"name"`

	// AllowedHosts is the explicit URL allowlist. Only these hosts may be contacted.
	// Wildcard subdomains (*.example.com) are NOT permitted — every host is explicit.
	AllowedHosts []string `json:"allowed_hosts"`

	// BlockedIPRanges blocks specific IP ranges (RFC 1918, link-local, loopback, metadata).
	// Default: all private ranges + cloud provider metadata endpoints.
	BlockedIPRanges []string `json:"blocked_ip_ranges"`

	// DNSResolutionPolicy controls DNS behavior.
	DNSResolutionPolicy DNSPolicy `json:"dns_resolution_policy"`

	// RedirectPolicy controls HTTP redirect following.
	RedirectPolicy RedirectPolicy `json:"redirect_policy"`

	// RequestShaping controls request-level constraints.
	RequestShaping RequestShaping `json:"request_shaping"`

	// MetadataEndpointBlock blocks cloud provider metadata endpoints
	// (169.254.169.254, fd00:ec2::254, metadata.google.internal, etc).
	MetadataEndpointBlock bool `json:"metadata_endpoint_block"`

	// RequiredPosture is the minimum posture required to use this corridor.
	RequiredPosture Posture `json:"required_posture"`
}

CorridorPolicy defines the network boundary authority for an execution. Corridors are the ONLY mechanism for external network access. SSRF protection is a property of corridor enforcement, not a separate layer.

type CounterfactualCountEntry

type CounterfactualCountEntry struct {
	Key      string `json:"key"`
	Deny     int    `json:"deny"`
	Escalate int    `json:"escalate"`
}

CounterfactualCountEntry is one (key, deny, escalate) tuple in a summary dimension. Allow is intentionally omitted from per-dimension entries: the negative-space screenshot counts blocks, not permits.

type CounterfactualReceipt

type CounterfactualReceipt struct {
	ReceiptID string `json:"receipt_id"`

	// Enforcement is always EnforcementCounterfactual for this type.
	Enforcement Enforcement `json:"enforcement"`

	// WouldHaveVerdict is the verdict the PDP would have issued (ALLOW, DENY, or
	// ESCALATE). Counterfactual receipts are emitted for every evaluated action,
	// including ALLOW, so the summary can show coverage as well as blocks.
	WouldHaveVerdict Verdict    `json:"would_have_verdict"`
	ReasonCode       ReasonCode `json:"reason_code,omitempty"`

	// Boundary linkage — what was evaluated and under which authority.
	ObserveGrantID     string `json:"observe_grant_id"`
	BoundaryRecordID   string `json:"boundary_record_id"`
	BoundaryRecordHash string `json:"boundary_record_hash"`
	PolicyEpoch        string `json:"policy_epoch"`

	// Attribution dimensions for the deterministic summary.
	ToolName    string `json:"tool_name,omitempty"`
	MCPServerID string `json:"mcp_server_id,omitempty"`
	ArgsHash    string `json:"args_hash,omitempty"`

	CreatedAt time.Time `json:"created_at"`

	// Signature over SigningPayload, populated after signing. Empty until signed.
	SignerKeyID string `json:"signer_key_id,omitempty"`
	Signature   string `json:"signature,omitempty"`

	// ReceiptHash is the JCS+SHA-256 digest of the unsigned receipt. It is the
	// content address and the basis the signature covers.
	ReceiptHash string `json:"receipt_hash,omitempty"`
}

CounterfactualReceipt is a signed, content-addressed proof of the verdict the PDP would have issued under an observe grant, carrying the full verdict and reason codes. The receipt grants no execution authority; dispatch and any resulting effect require a separate active observe grant. It is the artifact that turns the "observe → enforce" on-ramp into a business case: the weekly summary becomes "HELM would have blocked these N actions".

Despite the shared word, this is not a DenialCounterfactual. That value is the nearest-allowed-envelope field on a denial the boundary actually enforced; this receipt records a would-have verdict and confers no execution authority at all.

Invariants (enforced by Validate):

  • Enforcement is ALWAYS EnforcementCounterfactual. A counterfactual receipt that claims to be enforced is rejected — that is the P0 negative vector.
  • It binds the explicit ObserveGrantID it was produced under. No grant, no counterfactual receipt (mirrors firewall.ObserveGrant.Active).
  • It binds the sealed ExecutionBoundaryRecord hash whose verdict it mirrors, so an offline verifier can re-derive the would-have decision.

func (CounterfactualReceipt) Seal

Seal validates the receipt and computes its content-addressed ReceiptHash over the unsigned, JCS-canonicalized body (signature fields excluded). The returned receipt is the signing preimage carrier; call SigningPayload for the exact bytes a Signer covers.

func (CounterfactualReceipt) SigningPayload

func (r CounterfactualReceipt) SigningPayload() string

SigningPayload returns the deterministic bytes a Signer covers. It is the sealed ReceiptHash prefixed with the enforcement label so a signature minted over a counterfactual receipt can never be replayed as an enforced one.

func (CounterfactualReceipt) Validate

func (r CounterfactualReceipt) Validate() error

Validate enforces the counterfactual invariants. It deliberately REJECTS any receipt whose Enforcement is not EnforcementCounterfactual — coercing one into "enforced" must fail closed, never succeed silently.

type CounterfactualSummary

type CounterfactualSummary struct {
	Version        string                     `json:"version"`
	ObserveGrantID string                     `json:"observe_grant_id,omitempty"`
	TotalEvaluated int                        `json:"total_evaluated"`
	WouldAllow     int                        `json:"would_allow"`
	WouldDeny      int                        `json:"would_deny"`
	WouldEscalate  int                        `json:"would_escalate"`
	ByPolicyEpoch  []CounterfactualCountEntry `json:"by_policy_epoch"`
	ByTool         []CounterfactualCountEntry `json:"by_tool"`
	ByMCPServer    []CounterfactualCountEntry `json:"by_mcp_server"`
	ByReasonCode   []CounterfactualCountEntry `json:"by_reason_code"`
	GeneratedAt    time.Time                  `json:"generated_at"`
}

CounterfactualSummary aggregates counterfactual DENY/ESCALATE counts by policy, tool, and MCP server. Output is deterministic: maps are emitted as sorted slices so the same receipt stream always produces byte-identical JSON.

func SummarizeCounterfactuals

func SummarizeCounterfactuals(receipts []CounterfactualReceipt, generatedAt time.Time) (CounterfactualSummary, error)

SummarizeCounterfactuals folds a slice of sealed counterfactual receipts into a deterministic summary. Receipts whose Enforcement is not counterfactual are rejected — a summary must never silently fold an enforced receipt into the "would have" narrative.

type DAG

type DAG struct {
	Nodes       []PlanStep `json:"nodes"`
	Edges       []Edge     `json:"edges"`
	EntryPoints []string   `json:"entry_points,omitempty"`
	ExitPoints  []string   `json:"exit_points,omitempty"`
}

DAG represents the Directed Acyclic Graph of steps.

type DNSPolicy

type DNSPolicy struct {
	// PinResolution requires DNS results to be pinned and verified.
	PinResolution bool `json:"pin_resolution"`

	// MaxTTLSeconds is the maximum DNS cache TTL.
	MaxTTLSeconds int `json:"max_ttl_seconds"`

	// RejectPrivateIPs rejects DNS results that resolve to private IP ranges.
	RejectPrivateIPs bool `json:"reject_private_ips"`
}

DNSPolicy controls DNS resolution behavior within a corridor.

type DataHandlingRules

type DataHandlingRules struct {
	// MaxClassification is the highest data classification this run may handle autonomously.
	// Values: "public", "internal", "confidential", "restricted"
	MaxClassification string `json:"max_classification"`

	// RedactionPolicy controls redaction applied to outputs and logs.
	// Values: "none", "pii_only", "strict"
	RedactionPolicy string `json:"redaction_policy"`

	// TransferConstraints define cross-border data transfer rules.
	TransferConstraints []DataTransferConstraint `json:"transfer_constraints,omitempty"`
}

DataHandlingRules govern data classification, residency, and redaction.

type DataTransferConstraint

type DataTransferConstraint struct {
	FromRegion         string `json:"from_region"`
	ToRegion           string `json:"to_region"`
	Allowed            bool   `json:"allowed"`
	RequiresEncryption bool   `json:"requires_encryption,omitempty"`
}

DataTransferConstraint governs cross-border data movement.

type DecisionImpactPreview

type DecisionImpactPreview struct {
	// DiffSummary is a deterministic summary of what changes (e.g., "Add 3 nodes, remove 1 edge").
	DiffSummary string `json:"diff_summary"`

	// RiskDelta describes the change in risk level (e.g., "+1 ELEVATED → HIGH").
	RiskDelta string `json:"risk_delta"`

	// BudgetDeltaCents is the estimated cost impact in cents (negative = savings).
	BudgetDeltaCents int64 `json:"budget_delta_cents"`
}

DecisionImpactPreview summarizes the impact of choosing a particular option. All fields are deterministic — no model-generated prose.

type DecisionLogEvent

type DecisionLogEvent struct {
	DecisionID     string            `json:"decision_id"`
	JurisdictionID string            `json:"jurisdiction_id,omitempty"`
	EffectType     string            `json:"effect_type,omitempty"`
	Timestamp      time.Time         `json:"timestamp"`
	Labels         map[string]string `json:"labels,omitempty"`

	// Structured Decision (Guardian)
	Decision *DecisionRecord `json:"decision,omitempty"`

	// OPA/Legacy fields
	Revision string `json:"revision,omitempty"`
	Path     string `json:"path,omitempty"`
	Input    any    `json:"input,omitempty"`
	Result   any    `json:"result,omitempty"`
}

DecisionLogEvent represents an audit log entry for a decision.

type DecisionOption

type DecisionOption struct {
	// ID is the machine-readable option identifier.
	ID string `json:"id"`

	// Label is the short human-readable option text (e.g., "Approve", "Use existing template").
	Label string `json:"label"`

	// Description is an optional longer explanation.
	Description string `json:"description,omitempty"`

	// ImpactPreview shows what happens if this option is chosen.
	ImpactPreview *DecisionImpactPreview `json:"impact_preview,omitempty"`

	// IsDefault marks this as the recommended/default option.
	IsDefault bool `json:"is_default,omitempty"`

	// IsSkip marks this as a "skip this decision" option (if allowed).
	IsSkip bool `json:"is_skip,omitempty"`

	// IsSomethingElse marks this as the "Something else" escape hatch.
	IsSomethingElse bool `json:"is_something_else,omitempty"`
}

DecisionOption is a single constrained choice within a DecisionRequest.

type DecisionPriority

type DecisionPriority string

DecisionPriority determines display ordering in the blocker queue.

const (
	DecisionPriorityUrgent DecisionPriority = "URGENT"
	DecisionPriorityHigh   DecisionPriority = "HIGH"
	DecisionPriorityNormal DecisionPriority = "NORMAL"
	DecisionPriorityLow    DecisionPriority = "LOW"
)

type DecisionRecord

type DecisionRecord struct {
	ID         string `json:"id"`
	ProposalID string `json:"proposal_id"`
	// CorrelationID is the product request identity (X-Helm-Correlation-ID)
	// this decision was made for — the stable join key across lifecycle
	// events, receipts, and evidence (pilot business-telemetry contract §2).
	// NOTE: outside the decision signature until HELM-303 resolves.
	CorrelationID string `json:"correlation_id,omitempty"`
	StepID        string `json:"step_id"`
	PhenotypeHash string `json:"phenotype_hash"`
	PolicyVersion string `json:"policy_version"`

	// New Policy Engine Fields
	SubjectID string `json:"subject_id"` // Matches PrincipalID
	Action    string `json:"action"`
	Resource  string `json:"resource"`

	// V2: Cryptographic binding to effect semantics
	EffectDigest string `json:"effect_digest,omitempty"`

	// V2: Policy backend metadata for receipt binding (P0.1 competitive defense)
	PolicyBackend      string `json:"policy_backend,omitempty"`       // "helm" | "external"
	PolicyContentHash  string `json:"policy_content_hash,omitempty"`  // content-addressed policy version
	PolicyEpoch        string `json:"policy_epoch,omitempty"`         // active policy epoch bound to this decision
	PolicyDecisionHash string `json:"policy_decision_hash,omitempty"` // SHA-256 of canonical decision

	StateCursor    string         `json:"state_cursor"`
	Snapshot       string         `json:"snapshot,omitempty"` // Content-Addressed Artifact Content
	EnvFingerprint string         `json:"env_fingerprint"`
	Verdict        string         `json:"verdict"`                 // Canonical: ALLOW, DENY, ESCALATE
	Reason         string         `json:"reason"`                  // Human-readable explanation
	ReasonCode     string         `json:"reason_code,omitempty"`   // Machine-readable registry code
	InputContext   map[string]any `json:"input_context,omitempty"` // For explainability
	// ThreatScan is Guardian-owned typed threat evidence. Decisions with this
	// field use the V3 preimage, which binds the complete canonical reference
	// (including semantic model, score, and failure state).
	ThreatScan *ThreatScanRef `json:"threat_scan,omitempty"`
	// Session Risk Memory fields bind trajectory-level authorization state to the signed decision.
	TrajectoryRiskScore    float64 `json:"trajectory_risk_score,omitempty"`
	SessionCentroidHash    string  `json:"session_centroid_hash,omitempty"`
	RiskAccumulationWindow int     `json:"risk_accumulation_window,omitempty"`
	// RequirementSetHash links this decision to the specific Proof Requirement Graph rules satisfied.
	RequirementSetHash string `json:"requirement_set_hash,omitempty"`
	// GateRosterHash digests the Guardian gate roster (guardian.GateRoster)
	// that produced this verdict, so evidence states which gates ran instead
	// of leaving that to code review. An uninjected gate is skipped rather
	// than refused, so two kernels can return the same verdict from different
	// enforcement: without this the difference is invisible downstream.
	// NOTE: still outside the decision signature. DecisionRecordSignatureV2
	// (HELM-303) swapped free-text Reason for ReasonCode, and V3 binds typed
	// threat evidence; binding this roster needs a further preimage revision.
	// It remains tamper-evident via the receipt envelope chain hash.
	GateRosterHash string `json:"gate_roster_hash,omitempty"`
	Signature      string `json:"signature"`
	SignatureType  string `json:"signature_type"`
	// SignatureVersion names the signing-preimage revision. Empty = legacy
	// (free-text Reason in the preimage, ReasonCode absent).
	// DecisionRecordSignatureV2 signs the machine-readable ReasonCode instead
	// of prose: the field every downstream consumer keys on is the one the
	// signature attests. DecisionRecordSignatureV3 additionally binds typed
	// Guardian threat evidence when it is present. DecisionRecordSignatureV4
	// retains those facts and also binds the evaluated authority tuple and
	// signer metadata.
	SignatureVersion string    `json:"signature_version,omitempty"`
	Timestamp        time.Time `json:"timestamp"`

	// Intervention Metadata (Temporal Guardian)
	Intervention *InterventionMetadata `json:"intervention,omitempty"`
}

DecisionRecord captures the final judgment of the Policy Engine. It aligns with decision.proto

func DecodeDecisionRecord

func DecodeDecisionRecord(token string) (*DecisionRecord, error)

DecodeDecisionRecord parses a DecisionRecord from a token string (JSON or Base64).

type DecisionRequest

type DecisionRequest struct {
	// RequestID uniquely identifies this decision request.
	RequestID string `json:"request_id"`

	// Kind classifies the type of decision.
	Kind DecisionRequestKind `json:"kind"`

	// Title is the concise human-readable question (max 120 chars).
	Title string `json:"title"`

	// Description provides additional context if needed.
	Description string `json:"description,omitempty"`

	// Options are the constrained choices available.
	Options []DecisionOption `json:"options"`

	// ImpactPreview is the aggregate impact preview for the decision context.
	ImpactPreview *DecisionImpactPreview `json:"impact_preview,omitempty"`

	// RunID links to the run blocked by this decision (empty for global decisions).
	RunID string `json:"run_id,omitempty"`

	// Priority determines display ordering.
	Priority DecisionPriority `json:"priority"`

	// Status tracks the lifecycle.
	Status DecisionRequestStatus `json:"status"`

	// SkipAllowed indicates whether the user may skip this decision.
	SkipAllowed bool `json:"skip_allowed"`

	// CreatedAt is when the decision was created.
	CreatedAt time.Time `json:"created_at"`

	// ExpiresAt is the deadline for this decision (zero = no expiry).
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// ResolvedOptionID is the chosen option ID (populated on resolution).
	ResolvedOptionID string `json:"resolved_option_id,omitempty"`

	// ResolvedBy is the principal who resolved the decision.
	ResolvedBy string `json:"resolved_by,omitempty"`

	// ResolvedAt is when the decision was resolved.
	ResolvedAt *time.Time `json:"resolved_at,omitempty"`

	// FreeformResponse captures text when "Something else" is chosen.
	FreeformResponse string `json:"freeform_response,omitempty"`
}

DecisionRequest is a structured request for human input. It blocks the associated run until resolved, expired, or skipped.

Design invariants:

  • Exactly 2–7 concrete options (excluding meta-options like Skip/SomethingElse)
  • Resolving deterministically unblocks the run (no ambiguity)
  • Every DecisionRequest gets a receipt via the ops event stream

func (*DecisionRequest) CheckExpiry

func (dr *DecisionRequest) CheckExpiry() bool

CheckExpiry marks the decision as expired if past its deadline.

func (*DecisionRequest) IsBlocking

func (dr *DecisionRequest) IsBlocking() bool

IsBlocking returns true if this decision is currently blocking progress.

func (*DecisionRequest) Resolve

func (dr *DecisionRequest) Resolve(optionID, resolvedBy string) error

Resolve marks this decision as resolved with the given option.

func (*DecisionRequest) Skip

func (dr *DecisionRequest) Skip(skippedBy string) error

Skip marks this decision as skipped (only if allowed).

func (*DecisionRequest) Validate

func (dr *DecisionRequest) Validate() error

Validate checks that the DecisionRequest meets structural invariants.

type DecisionRequestKind

type DecisionRequestKind string

DecisionRequestKind classifies the type of decision needed.

const (
	// DecisionKindApproval requires explicit approval for a proposed action.
	DecisionKindApproval DecisionRequestKind = "APPROVAL"

	// DecisionKindPolicyChoice asks the user to choose between policy-compliant options.
	DecisionKindPolicyChoice DecisionRequestKind = "POLICY_CHOICE"

	// DecisionKindClarification asks for missing information to proceed.
	DecisionKindClarification DecisionRequestKind = "CLARIFICATION"

	// DecisionKindSpending authorizes a spend above the autonomous threshold.
	DecisionKindSpending DecisionRequestKind = "SPENDING"

	// DecisionKindIrreversible confirms an irreversible action.
	DecisionKindIrreversible DecisionRequestKind = "IRREVERSIBLE"

	// DecisionKindSensitivePolicy authorizes a sensitive policy change.
	DecisionKindSensitivePolicy DecisionRequestKind = "SENSITIVE_POLICY"

	// DecisionKindNaming requires the user to name or title a resource (prevents "Untitled").
	DecisionKindNaming DecisionRequestKind = "NAMING"
)

type DecisionRequestStatus

type DecisionRequestStatus string

DecisionRequestStatus tracks the lifecycle of a decision request.

const (
	DecisionStatusPending  DecisionRequestStatus = "PENDING"
	DecisionStatusResolved DecisionRequestStatus = "RESOLVED"
	DecisionStatusExpired  DecisionRequestStatus = "EXPIRED"
	DecisionStatusSkipped  DecisionRequestStatus = "SKIPPED"
)

type DelegationChain

type DelegationChain struct {
	ChainID string            `json:"chain_id"`
	Proofs  []DelegationProof `json:"proofs"` // ordered: root → leaf
}

DelegationChain is an ordered chain of delegation proofs from root to leaf.

func (*DelegationChain) Verify

func (c *DelegationChain) Verify() error

Verify checks the structural integrity of a delegation chain.

type DelegationProof

type DelegationProof struct {
	ProofID       string               `json:"proof_id"`
	DelegatorID   string               `json:"delegator_id"`
	DelegateeID   string               `json:"delegatee_id"`
	Scope         DelegationProofScope `json:"scope"`
	ChainDepth    int                  `json:"chain_depth"` // 0 = direct, 1+ = transitive
	ParentProofID string               `json:"parent_proof_id,omitempty"`
	IssuedAt      time.Time            `json:"issued_at"`
	ExpiresAt     time.Time            `json:"expires_at"`
	Revoked       bool                 `json:"revoked"`
	RevokedAt     *time.Time           `json:"revoked_at,omitempty"`
	RevokedBy     string               `json:"revoked_by,omitempty"`
	ContentHash   string               `json:"content_hash"`
	Signature     string               `json:"signature,omitempty"`
}

DelegationProof is the signed evidence of an authority delegation.

func (*DelegationProof) ComputeHash

func (d *DelegationProof) ComputeHash() string

ComputeHash computes the deterministic content hash of a DelegationProof.

type DelegationProofScope

type DelegationProofScope struct {
	Actions      []string `json:"actions"`
	Resources    []string `json:"resources"`
	Namespaces   []string `json:"namespaces,omitempty"`
	MaxBudget    int64    `json:"max_budget_cents,omitempty"`
	MaxDepth     int      `json:"max_chain_depth"`
	AllowRedeleg bool     `json:"allow_redelegation"`
}

DelegationProofScope defines what authority was delegated.

type DenialCounterfactual

type DenialCounterfactual struct {
	// Field is the policy field that bound the request, e.g. "ttl_days".
	Field string `json:"field"`
	// Requested and Max describe an exceeded scalar bound: Requested must be
	// greater than Max. When Capability is empty, MarshalJSON emits both values
	// — including zero — so the wire shape is never ambiguous.
	Requested uint32 `json:"requested,omitempty"`
	Max       uint32 `json:"max,omitempty"`
	// Capability names the permission the action would have needed.
	Capability string `json:"capability,omitempty"`
}

DenialCounterfactual is the nearest allowed envelope for a denial: enough for an agent to retry correctly, and no more.

It is emitted for scalar bounds and required-capability names only. Denials that turn on set membership never carry one — an egress allowlist or a set of workspace roots is a map of internal infrastructure, and disclosing it would turn every denial into a free probe. The workstation producer derives this while constructing the denied effect from the evaluator result.

Despite the shared word, this is not a CounterfactualReceipt. This value rides a denial the boundary actually enforced and describes the nearest request that would have been allowed. A CounterfactualReceipt records the verdict the PDP would have issued under an observe grant, enforces nothing, and must never be presentable as enforced.

func (DenialCounterfactual) MarshalJSON

func (c DenialCounterfactual) MarshalJSON() ([]byte, error)

func (*DenialCounterfactual) UnmarshalJSON

func (c *DenialCounterfactual) UnmarshalJSON(data []byte) error

func (DenialCounterfactual) Validate

func (c DenialCounterfactual) Validate() error

type DenialFinality

type DenialFinality string

DenialFinality tells a consumer what kind of "no" it received, so an agent can draw the right lesson from it: which bounds to record, which to erase, and which refusals were never about the attempted action at all.

It is derived from the reason code that fired, never assigned by a caller.

const (
	// DenialClassForbidden: the action itself is forbidden by policy. A
	// consumer should erase any stored bounds for it and stop probing.
	DenialClassForbidden DenialFinality = "class_forbidden"
	// DenialUngranted: no grant is configured for this action. Nothing to
	// retry and no bound to learn — the action needs an authority to say yes.
	// The kernel PDP carries this on the escalation channel with the required
	// signers; the workstation layer has no approver, so it is terminal here.
	DenialUngranted DenialFinality = "ungranted"
	// DenialInstanceParameter: a bound was exceeded. A consumer should record
	// the bound and retry within it.
	DenialInstanceParameter DenialFinality = "instance_parameter"
	// DenialInstanceContext: the surrounding context was refused (taint, for
	// example). The refusal was not about the action; a consumer should touch
	// none of its stored bounds.
	DenialInstanceContext DenialFinality = "instance_context"
	// DenialInstanceMembership: a caller-chosen target was refused against a
	// confidential set — an egress host outside the allowlist, a path outside
	// the workspace roots. That target is closed; other targets may work. The
	// set is never disclosed, so there is no bound to record and nothing to
	// erase: stop retrying this target without unlearning anything else.
	//
	// Distinct from DenialClassForbidden, where the refused thing is a
	// policy-named category of action from a fixed public vocabulary rather
	// than a probe against a set the policy keeps private.
	DenialInstanceMembership DenialFinality = "instance_membership"
)

type DeniedAttemptRecord

type DeniedAttemptRecord struct {
	AttemptID  string    `json:"attempt_id"`
	DecisionID string    `json:"decision_id"`
	Reason     string    `json:"reason"`
	OccurredAt time.Time `json:"occurred_at"`
}

DeniedAttemptRecord records a denied attempt.

type DevFallbackPosture

type DevFallbackPosture struct {
	AuditMode              bool `json:"audit_mode"`
	MockAttester           bool `json:"mock_attester"`
	SyntheticNitro         bool `json:"synthetic_nitro"`
	SoftwareHSM            bool `json:"software_hsm"`
	DevBearerAuth          bool `json:"dev_bearer_auth"`
	EnvCredentialFallback  bool `json:"env_credential_fallback"`
	UnsignedMutableOverlay bool `json:"unsigned_mutable_overlay"`
}

type DiffCategory

type DiffCategory string

DiffCategory classifies a capability change.

const (
	DiffCategoryCapability DiffCategory = "CAPABILITY" // New ability gained/lost
	DiffCategoryControl    DiffCategory = "CONTROL"    // Constraint/policy change
	DiffCategoryWorkflow   DiffCategory = "WORKFLOW"   // Process flow change
	DiffCategoryData       DiffCategory = "DATA"       // Data access/schema change
	DiffCategoryBudget     DiffCategory = "BUDGET"     // Cost/resource limit change
	DiffCategoryPosture    DiffCategory = "POSTURE"    // Autonomy level change
)

type DiffSeverity

type DiffSeverity string

DiffSeverity indicates user-attention level for a diff.

const (
	DiffSeverityInfo     DiffSeverity = "INFO"
	DiffSeverityNotice   DiffSeverity = "NOTICE"
	DiffSeverityWarning  DiffSeverity = "WARNING"
	DiffSeverityCritical DiffSeverity = "CRITICAL"
)

type Dispute

type Dispute struct {
	ID          string        `json:"id"`
	TenantID    string        `json:"tenant_id"`
	RunID       string        `json:"run_id"`
	DisputedBy  string        `json:"disputed_by"`
	Reason      string        `json:"reason"`
	EvidenceIDs []string      `json:"evidence_ids"`
	Status      DisputeStatus `json:"status"`
	Resolution  string        `json:"resolution,omitempty"`
	ResolvedBy  string        `json:"resolved_by,omitempty"`
	CreatedAt   time.Time     `json:"created_at"`
	ResolvedAt  *time.Time    `json:"resolved_at,omitempty"`
	ContentHash string        `json:"content_hash"`
}

Dispute is a canonical dispute record.

func NewDispute

func NewDispute(id, tenantID, runID, disputedBy, reason string, evidenceIDs []string) *Dispute

NewDispute creates a dispute.

type DisputeStatus

type DisputeStatus string

DisputeStatus tracks dispute lifecycle.

const (
	DisputeStatusOpen     DisputeStatus = "OPEN"
	DisputeStatusReview   DisputeStatus = "IN_REVIEW"
	DisputeStatusResolved DisputeStatus = "RESOLVED"
	DisputeStatusRejected DisputeStatus = "REJECTED"
)

type EUAIActEvidenceProfile

type EUAIActEvidenceProfile struct {
	ProfileID                           string            `json:"profile_id,omitempty"`
	RoleMap                             EUAIActRoleMap    `json:"role_map,omitempty"`
	RiskCategory                        string            `json:"risk_category,omitempty"`
	RelevantArticles                    []string          `json:"relevant_articles,omitempty"`
	HighRiskReasons                     []string          `json:"high_risk_reasons,omitempty"`
	ProviderOrDeployerRole              string            `json:"provider_or_deployer_role,omitempty"`
	TechnicalDocumentationRefs          []string          `json:"technical_documentation_refs,omitempty"`
	RiskManagementRefs                  []string          `json:"risk_management_refs,omitempty"`
	DataGovernanceRefs                  []string          `json:"data_governance_refs,omitempty"`
	LogRecordRefs                       []string          `json:"log_record_refs,omitempty"`
	TransparencyNoticeRefs              []string          `json:"transparency_notice_refs,omitempty"`
	HumanOversightRefs                  []string          `json:"human_oversight_refs,omitempty"`
	AccuracyRobustnessCybersecurityRefs []string          `json:"accuracy_robustness_cybersecurity_refs,omitempty"`
	FRIARefs                            []string          `json:"fria_refs,omitempty"`
	AffectedPersonNoticeRefs            []string          `json:"affected_person_notice_refs,omitempty"`
	RegistrationRefs                    []string          `json:"registration_refs,omitempty"`
	IncidentRefs                        []string          `json:"incident_refs,omitempty"`
	CorrectiveActionRefs                []string          `json:"corrective_action_refs,omitempty"`
	RedactionProfile                    string            `json:"redaction_profile,omitempty"`
	RetentionProfile                    string            `json:"retention_profile,omitempty"`
	TimelineStatus                      string            `json:"timeline_status,omitempty"`
	RedactionMetadata                   map[string]string `json:"redaction_metadata,omitempty"`
}

EUAIActEvidenceProfile captures the evidence refs needed to verify EU AI Act posture without making legal conclusions inside the pack.

type EUAIActRoleMap

type EUAIActRoleMap struct {
	Provider            string `json:"provider,omitempty"`
	Deployer            string `json:"deployer,omitempty"`
	Importer            string `json:"importer,omitempty"`
	Distributor         string `json:"distributor,omitempty"`
	ProductManufacturer string `json:"product_manufacturer,omitempty"`
	Operator            string `json:"operator,omitempty"`
}

EUAIActRoleMap records who acts in each regulatory role for this pack.

type Edge

type Edge struct {
	From string `json:"from"`
	To   string `json:"to"`
	Type string `json:"type"` // requires, soft_requires, blocks
}

Edge represents a dependency between steps.

type Effect

type Effect struct {
	EffectID       string         `json:"effect_id"`
	EffectType     string         `json:"type"`
	Params         map[string]any `json:"params"`
	Example        string         `json:"example,omitempty"`
	DecisionID     string         `json:"decision_id,omitempty"`
	IdempotencyKey string         `json:"idempotency_key,omitempty"`
	Compensation   *Effect        `json:"compensation,omitempty"`
	Irreversible   bool           `json:"irreversible,omitempty"`
	ArgsHash       string         `json:"args_hash,omitempty"`   // SHA-256 of JCS-canonicalized args
	OutputHash     string         `json:"output_hash,omitempty"` // SHA-256 of JCS-canonicalized output
	Taint          []string       `json:"taint,omitempty"`       // ClawGuard-style taint labels bound to this effect
}

Effect represents a side-effect to be executed.

type EffectClassAllowlist

type EffectClassAllowlist struct {
	// EffectClass is the HELM effect class: E0, E1, E2, E3, E4
	EffectClass string `json:"effect_class"`

	// Allowed indicates whether this class is permitted autonomously.
	Allowed bool `json:"allowed"`

	// AllowedTypes optionally restricts to specific effect type IDs.
	AllowedTypes []string `json:"allowed_types,omitempty"`

	// MaxPerRun caps effects of this class per run.
	MaxPerRun int `json:"max_per_run,omitempty"`

	// RequiresApprovalAbove triggers escalation when this count is exceeded.
	RequiresApprovalAbove int `json:"requires_approval_above,omitempty"`
}

EffectClassAllowlist declares which effect classes are allowed autonomously.

type EffectCloseReceipt

type EffectCloseReceipt struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	CloseID string `json:"close_id"`
	State   string `json:"state"`

	AdmissionID string `json:"admission_id"`
	AttemptID   string `json:"attempt_id"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	ConnectorID      string `json:"connector_id"`
	ConnectorVersion string `json:"connector_version"`
	ConnectorAction  string `json:"connector_action"`

	PriorState          string `json:"prior_state"`
	ReservationSequence uint64 `json:"reservation_sequence"`
	ReservationHeadHash string `json:"reservation_head_hash"`

	AcknowledgementHash string `json:"acknowledgement_hash"`
	Outcome             string `json:"outcome"`
	IdempotencyKeyHash  string `json:"idempotency_key_hash"`
	EffectHash          string `json:"effect_hash"`
	ResponseHash        string `json:"response_hash"`

	ConnectorExecutionRef  string `json:"connector_execution_ref"`
	ProofSessionRef        string `json:"proof_session_ref,omitempty"`
	IntentRef              string `json:"intent_ref"`
	EffectRef              string `json:"effect_ref,omitempty"`
	ReconciliationRef      string `json:"reconciliation_ref,omitempty"`
	DispositionReceiptHash string `json:"disposition_receipt_hash,omitempty"`
	EvidencePackRef        string `json:"evidence_pack_ref"`
	EvidencePackHash       string `json:"evidence_pack_hash"`

	KernelTrustRootID string    `json:"kernel_trust_root_id"`
	SigningKeyRef     string    `json:"signing_key_ref"`
	ClosedBy          string    `json:"closed_by"`
	ClosedAt          time.Time `json:"closed_at"`

	ReceiptHash string `json:"receipt_hash,omitempty"`
}

EffectCloseReceipt is the Kernel-signed terminal statement that binds an exact reservation head to a verified source acknowledgement and a sealed EvidencePack. COMPLETED means adjudicated and closed; Outcome says whether the external effect was actually applied.

func (EffectCloseReceipt) Seal

func (EffectCloseReceipt) Validate

func (r EffectCloseReceipt) Validate() error

func (EffectCloseReceipt) ValidateAcknowledgement

func (r EffectCloseReceipt) ValidateAcknowledgement(a ConnectorEffectAcknowledgement) error

func (EffectCloseReceipt) ValidateIntegrity

func (r EffectCloseReceipt) ValidateIntegrity() error

type EffectDigestBinding

type EffectDigestBinding struct {
	EffectType     string               `json:"effect_type"`
	Params         map[string]any       `json:"params,omitempty"`
	IdempotencyKey string               `json:"idempotency_key,omitempty"`
	Irreversible   bool                 `json:"irreversible,omitempty"`
	ArgsHash       string               `json:"args_hash,omitempty"`
	OutputHash     string               `json:"output_hash,omitempty"`
	Taint          []string             `json:"taint,omitempty"`
	Compensation   *EffectDigestBinding `json:"compensation,omitempty"`
}

EffectDigestBinding is the portable, identity-free effect projection.

func NewEffectDigestBinding

func NewEffectDigestBinding(effect *Effect) (*EffectDigestBinding, error)

NewEffectDigestBinding projects an Effect into its canonical portable semantics and rejects cyclic compensation graphs fail-closed.

func NormalizeEffectDigestBinding

func NormalizeEffectDigestBinding(binding *EffectDigestBinding) (*EffectDigestBinding, error)

NormalizeEffectDigestBinding returns a canonical projection and rejects cyclic binding graphs. It is used before signing transported bindings.

type EffectDispositionCommand

type EffectDispositionCommand struct {
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	CommandID           string `json:"command_id"`
	DispositionSequence uint64 `json:"disposition_sequence"`
	PreviousReceiptHash string `json:"previous_receipt_hash,omitempty"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	FenceCommandID   string `json:"fence_command_id"`
	FenceCommandHash string `json:"fence_command_hash"`
	FenceEpoch       uint64 `json:"fence_epoch"`
	FenceReceiptHash string `json:"fence_receipt_hash"`

	AdmissionID string `json:"admission_id"`
	AttemptID   string `json:"attempt_id"`

	ReservationSequence uint64 `json:"reservation_sequence"`
	ReservationHeadHash string `json:"reservation_head_hash"`
	ReservationState    string `json:"reservation_state"`

	ConnectorID           string `json:"connector_id"`
	ConnectorVersion      string `json:"connector_version"`
	ConnectorAction       string `json:"connector_action"`
	ConnectorExecutionRef string `json:"connector_execution_ref"`
	ProofSessionRef       string `json:"proof_session_ref,omitempty"`
	IntentRef             string `json:"intent_ref"`
	EffectRef             string `json:"effect_ref,omitempty"`

	IdempotencyKeyHash string `json:"idempotency_key_hash"`
	EffectHash         string `json:"effect_hash"`

	Action         string `json:"action"`
	DispositionRef string `json:"disposition_ref"`
	ActorID        string `json:"actor_id"`
	Reason         string `json:"reason"`

	AuthorityID   string    `json:"authority_id"`
	SigningKeyRef string    `json:"signing_key_ref"`
	Algorithm     string    `json:"algorithm"`
	IssuedAt      time.Time `json:"issued_at"`
	ExpiresAt     time.Time `json:"expires_at"`

	CommandHash string `json:"command_hash,omitempty"`
}

EffectDispositionCommand is a Control Plane instruction about already-active connector work. It never grants permission to execute cancellation, compensation, or any other external effect.

func (EffectDispositionCommand) Seal

func (EffectDispositionCommand) Validate

func (c EffectDispositionCommand) Validate() error

func (EffectDispositionCommand) ValidateIntegrity

func (c EffectDispositionCommand) ValidateIntegrity() error

type EffectDispositionCommandEnvelope

type EffectDispositionCommandEnvelope struct {
	Command   EffectDispositionCommand `json:"command"`
	Signature string                   `json:"signature"`
}

func (EffectDispositionCommandEnvelope) Validate

type EffectDispositionReceipt

type EffectDispositionReceipt struct {
	SchemaVersion      string `json:"schema_version"`
	ContractVersion    string `json:"contract_version"`
	ReceiptID          string `json:"receipt_id"`
	State              string `json:"state"`
	ExecutionAuthority string `json:"execution_authority"`

	CommandID           string `json:"command_id"`
	CommandHash         string `json:"command_hash"`
	DispositionSequence uint64 `json:"disposition_sequence"`
	PreviousReceiptHash string `json:"previous_receipt_hash,omitempty"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	FenceCommandID   string `json:"fence_command_id"`
	FenceCommandHash string `json:"fence_command_hash"`
	FenceEpoch       uint64 `json:"fence_epoch"`
	FenceReceiptHash string `json:"fence_receipt_hash"`

	AdmissionID         string `json:"admission_id"`
	ReservationSequence uint64 `json:"reservation_sequence"`
	ReservationHeadHash string `json:"reservation_head_hash"`
	ReservationState    string `json:"reservation_state"`
	Action              string `json:"action"`
	DispositionRef      string `json:"disposition_ref"`

	KernelTrustRootID string    `json:"kernel_trust_root_id"`
	SigningKeyRef     string    `json:"signing_key_ref"`
	AcceptedBy        string    `json:"accepted_by"`
	AcceptedAt        time.Time `json:"accepted_at"`

	ReceiptHash string `json:"receipt_hash,omitempty"`
}

EffectDispositionReceipt is Kernel acknowledgement that a command was durably recorded against an exact active reservation and FENCE. Its explicit NONE authority prevents an acknowledgement from being treated as an effect permit.

func (EffectDispositionReceipt) Seal

func (EffectDispositionReceipt) Validate

func (r EffectDispositionReceipt) Validate() error

func (EffectDispositionReceipt) ValidateCommand

func (EffectDispositionReceipt) ValidateIntegrity

func (r EffectDispositionReceipt) ValidateIntegrity() error

type EffectReceipt

type EffectReceipt struct {
	Success   bool           `json:"success"`
	Output    map[string]any `json:"output,omitempty"`
	Error     string         `json:"error,omitempty"`
	Duration  time.Duration  `json:"duration"`
	Timestamp time.Time      `json:"timestamp"`
}

EffectReceipt is the outcome of executing an effect. Originally 'Result' in gateway.

type EffectReconciliationCandidate

type EffectReconciliationCandidate struct {
	AdmissionID string `json:"admission_id"`
	AttemptID   string `json:"attempt_id"`

	ReservationSequence uint64 `json:"reservation_sequence"`
	ReservationHeadHash string `json:"reservation_head_hash"`
	ReservationState    string `json:"reservation_state"`

	ConnectorID           string `json:"connector_id"`
	ConnectorVersion      string `json:"connector_version"`
	ConnectorAction       string `json:"connector_action"`
	ConnectorExecutionRef string `json:"connector_execution_ref"`
	ProofSessionRef       string `json:"proof_session_ref,omitempty"`
	IntentRef             string `json:"intent_ref"`
	EffectRef             string `json:"effect_ref,omitempty"`

	IdempotencyKeyHash string `json:"idempotency_key_hash"`
	EffectHash         string `json:"effect_hash"`

	NextDispositionSequence uint64 `json:"next_disposition_sequence"`
	PreviousReceiptHash     string `json:"previous_receipt_hash,omitempty"`
}

EffectReconciliationCandidate contains only immutable command bindings and no generic reservation payload or connector-effect authority.

func (EffectReconciliationCandidate) Validate

func (c EffectReconciliationCandidate) Validate() error

type EffectReconciliationCandidates

type EffectReconciliationCandidates struct {
	SchemaVersion      string `json:"schema_version"`
	ContractVersion    string `json:"contract_version"`
	ExecutionAuthority string `json:"execution_authority"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	Fence      EffectReconciliationFence       `json:"fence"`
	Candidates []EffectReconciliationCandidate `json:"candidates"`
}

EffectReconciliationCandidates is a Kernel-owned snapshot for constructing a later RECONCILE_SOURCE command. It is deliberately not an effect permit. The command recorder must reread the current FENCE and reservation head.

func (EffectReconciliationCandidates) Validate

type EffectReconciliationFence

type EffectReconciliationFence struct {
	CommandID   string `json:"command_id"`
	CommandHash string `json:"command_hash"`
	Epoch       uint64 `json:"epoch"`
	ReceiptHash string `json:"receipt_hash"`
}

EffectReconciliationFence binds every candidate to the FENCE observed by the Kernel in one durable scope transaction.

type EffectType

type EffectType struct {
	TypeID                      string         `json:"type_id"` // E.g., DATA_WRITE, FUNDS_TRANSFER
	Name                        string         `json:"name"`
	Description                 string         `json:"description,omitempty"`
	Status                      string         `json:"status,omitempty"` // preview, normative, deprecated
	Taxon                       string         `json:"taxon,omitempty"`  // E0-E4
	BaseEffectTypes             []string       `json:"base_effect_types,omitempty"`
	Idempotency                 IdempotencyRef `json:"idempotency"`
	Classification              Classification `json:"classification"`
	DefaultApprovalLevel        string         `json:"default_approval_level,omitempty"` // Risk baseline only; Authority Court remains the sole authorization source.
	RequiresEvidence            bool           `json:"requires_evidence"`
	CompensationRequired        bool           `json:"compensation_required"`
	CompensationEffectType      string         `json:"compensation_effect_type,omitempty"`
	CompensationAuthorization   string         `json:"compensation_authorization,omitempty"`
	InputSchema                 string         `json:"input_schema,omitempty"`
	AuthorizationEnvelopeSchema string         `json:"authorization_envelope_schema,omitempty"`
	ReceiptSchema               string         `json:"receipt_schema,omitempty"`
	ConnectorID                 string         `json:"connector_id,omitempty"`
	ActionURN                   string         `json:"action_urn,omitempty"`
	PreflightRequired           bool           `json:"preflight_required,omitempty"`
	TwoPhaseCommitRequired      bool           `json:"two_phase_commit_required,omitempty"`
	MinEvidenceGrade            string         `json:"min_evidence_grade,omitempty"`
	PolicyHooks                 []string       `json:"policy_hooks,omitempty"`
}

EffectType defines a specific capability category.

func LookupEffectType

func LookupEffectType(typeID string) *EffectType

LookupEffectType returns the EffectType definition for a given type ID from the default catalog, or nil if not found.

func LookupLaunchMissionEffectPreview

func LookupLaunchMissionEffectPreview(typeID string) *EffectType

LookupLaunchMissionEffectPreview returns a preview definition without making it executable through the default runtime catalog.

type EffectTypeCatalog

type EffectTypeCatalog struct {
	CatalogVersion string       `json:"catalog_version"`
	EffectTypes    []EffectType `json:"effect_types"`
}

EffectTypeCatalog represents the canonical list of effect types.

func DefaultEffectCatalog

func DefaultEffectCatalog() *EffectTypeCatalog

DefaultEffectCatalog returns the canonical EffectTypeCatalog pre-populated with all threat-surface effect types and their classifications.

Each entry specifies:

  • Risk classification (reversibility, blast radius, urgency)
  • Default approval level (none, single_human, dual_control, quorum)
  • Whether evidence is required
  • Whether compensation/rollback is required

func LaunchMissionEffectCatalogPreview

func LaunchMissionEffectCatalogPreview() *EffectTypeCatalog

LaunchMissionEffectCatalogPreview returns the source-owned preview contract for Launch Mission effects. Catalog membership is descriptive, not authorization. Authority Court is the sole policy evaluator, and these effects deliberately remain absent from DefaultEffectCatalog until promotion.

type EmergencyCapsule

type EmergencyCapsule struct {
	CapsuleID              string                     `json:"capsule_id"`
	Version                uint64                     `json:"version"`
	ApertureID             string                     `json:"aperture_id"`
	HazardCode             SafeDepHazardCode          `json:"hazard_code"`
	State                  SafeDepState               `json:"state"`
	OrgGenomeHash          string                     `json:"org_genome_hash"`
	PolicyEpoch            uint64                     `json:"policy_epoch"`
	PolicyHash             string                     `json:"policy_hash"`
	P0CeilingsHash         string                     `json:"p0_ceilings_hash"`
	P1BundleHash           string                     `json:"p1_bundle_hash"`
	CPIHash                string                     `json:"cpi_hash"`
	ProviderRegistryHash   string                     `json:"provider_registry_hash"`
	CredentialRegistryHash string                     `json:"credential_registry_hash"`
	VerifierProfileHash    string                     `json:"verifier_profile_hash"`
	PredecessorHash        string                     `json:"predecessor_hash"`
	SubsetProofHash        string                     `json:"subset_proof_hash"`
	SubsetProofKind        string                     `json:"subset_proof_kind"`
	AllowedActions         []string                   `json:"allowed_actions,omitempty"`
	AllowedConnectors      []string                   `json:"allowed_connectors,omitempty"`
	TTLSeconds             int64                      `json:"ttl_seconds"`
	NotBefore              time.Time                  `json:"not_before"`
	ExpiresAt              time.Time                  `json:"expires_at"`
	Signatures             []ThresholdSignature       `json:"signatures,omitempty"`
	Ceremony               HardwareCeremonyTranscript `json:"ceremony"`
	Delegation             EmergencyDelegationChain   `json:"delegation"`
	Attestation            AttestationResultEnvelope  `json:"attestation"`
	Transparency           TransparencyAnchor         `json:"transparency,omitempty"`
}

type EmergencyDelegationChain

type EmergencyDelegationChain struct {
	SessionID            string                   `json:"session_id"`
	HumanSubjectID       string                   `json:"human_subject_id"`
	AuthorizedResources  []string                 `json:"authorized_resources,omitempty"`
	Scope                []string                 `json:"scope,omitempty"`
	MaxHops              int                      `json:"max_hops"`
	NotBefore            time.Time                `json:"not_before"`
	ExpiresAt            time.Time                `json:"expires_at"`
	Hops                 []EmergencyDelegationHop `json:"hops,omitempty"`
	CompletionReceiptRef string                   `json:"completion_receipt_ref,omitempty"`
}

type EmergencyDelegationHop

type EmergencyDelegationHop struct {
	IssuerID  string    `json:"issuer_id"`
	SubjectID string    `json:"subject_id"`
	ScopeHash string    `json:"scope_hash"`
	SignedAt  time.Time `json:"signed_at"`
	Signature string    `json:"signature"`
}

type Enforcement

type Enforcement string

Enforcement labels whether a receipt records authority that was actually enforced at the boundary, or a counterfactual ("would-have") verdict. A counterfactual receipt grants no execution authority; a separate active observe grant can still permit dispatch and real effects.

This distinction is proof-semantics-critical: conflating a counterfactual receipt with an enforced one would manufacture false execution authority. The two values are therefore machine-distinct, and CounterfactualReceipt below can ONLY ever carry EnforcementCounterfactual — its sealing refuses any other value (see negative vector in counterfactual_receipt_test.go).

const (
	// EnforcementEnforced marks a receipt for a verdict the boundary actually
	// enforced. This is the default proof-bearing disposition.
	EnforcementEnforced Enforcement = "enforced"

	// EnforcementCounterfactual marks a receipt for a verdict the PDP WOULD
	// have issued under an observe grant. It is signed and verifiable like any
	// receipt, but it confers NO execution authority and MUST NEVER be
	// presentable or parseable as enforced.
	EnforcementCounterfactual Enforcement = "counterfactual"
)

type EnvExposurePolicy

type EnvExposurePolicy struct {
	Mode      string   `json:"mode"` // deny-all, allowlist, redacted
	Names     []string `json:"names,omitempty"`
	NamesHash string   `json:"names_hash,omitempty"`
	Redacted  bool     `json:"redacted,omitempty"`
}

type EnvSnap

type EnvSnap struct {
	Timestamp           time.Time         `json:"timestamp"`
	Vars                map[string]string `json:"vars"`
	JurisdictionID      string            `json:"jurisdiction_id"`
	RiskThreshold       float64           `json:"risk_threshold"`
	DataClasses         []string          `json:"data_classes"`
	ActionClasses       []string          `json:"action_classes"`
	AvailableConnectors []string          `json:"available_connectors"`
}

type EnvelopeAttestation

type EnvelopeAttestation struct {
	// ContentHash is the SHA-256 hash of envelope content (excluding attestation).
	ContentHash string `json:"content_hash"`

	// Signature is the cryptographic signature of the content_hash.
	Signature string `json:"signature,omitempty"`

	// SignerID identifies who signed the envelope.
	SignerID string `json:"signer_id,omitempty"`

	// SignedAt is when the envelope was signed.
	SignedAt time.Time `json:"signed_at,omitempty"`

	// Algorithm is the signature algorithm used.
	// Values: "ED25519", "ECDSA-P256", "RSA-PSS-2048"
	Algorithm string `json:"algorithm,omitempty"`
}

EnvelopeAttestation provides cryptographic binding for the envelope.

type EnvelopeBudgets

type EnvelopeBudgets struct {
	// CostCeilingCents is the maximum monetary cost in cents.
	CostCeilingCents int64 `json:"cost_ceiling_cents"`

	// TimeCeilingSeconds is the maximum wall-clock time.
	TimeCeilingSeconds int64 `json:"time_ceiling_seconds"`

	// ToolCallCap is the maximum number of tool calls.
	ToolCallCap int64 `json:"tool_call_cap"`

	// RateLimits are per-resource rate limits.
	RateLimits []RateLimit `json:"rate_limits,omitempty"`

	// BlastRadius is the maximum allowed blast radius for any single effect.
	// Values: "single_record", "dataset", "system_wide"
	BlastRadius string `json:"blast_radius,omitempty"`

	// ComputeUnitsCap caps compute units (LLM tokens, GPU seconds, etc.).
	ComputeUnitsCap int64 `json:"compute_units_cap,omitempty"`
}

EnvelopeBudgets defines economic and operational ceilings for a run.

type EnvironmentProfile

type EnvironmentProfile struct {
	ID          string            `json:"id"`
	Fingerprint string            `json:"fingerprint"`
	Vars        map[string]string `json:"vars"`

	// Boot Compatibility
	ProfileID      string         `json:"profile_id"`
	Name           string         `json:"name"`
	JurisdictionID string         `json:"jurisdiction_id"`
	Currency       string         `json:"currency"`
	Rails          []string       `json:"rails"`
	RiskBaseline   map[string]any `json:"risk_baseline"`
}

EnvironmentProfile defines the execution context constraints.

type EscalationContext

type EscalationContext struct {
	// Plan shows what the system intends to do.
	Plan *EscalationPlan `json:"plan,omitempty"`

	// Diff shows what will change compared to current state.
	Diff *EscalationDiff `json:"diff,omitempty"`

	// Risks lists identified risks of proceeding.
	Risks []IdentifiedRisk `json:"risks,omitempty"`

	// RollbackPlan describes how to undo the effect if needed.
	RollbackPlan *RollbackPlan `json:"rollback_plan,omitempty"`

	// RunSummary provides context on the current run state.
	RunSummary *RunSummary `json:"run_summary,omitempty"`
}

EscalationContext provides all the information an approver needs.

type EscalationDiff

type EscalationDiff struct {
	Before map[string]any `json:"before,omitempty"`
	After  map[string]any `json:"after,omitempty"`
	Patch  string         `json:"patch,omitempty"` // RFC 6902 JSON Patch or human-readable diff
}

EscalationDiff shows before/after state.

type EscalationIntent

type EscalationIntent struct {
	// Identity
	IntentID   string `json:"intent_id"`
	RunID      string `json:"run_id"`
	EnvelopeID string `json:"envelope_id"`

	// What triggered this escalation
	TriggerRule string          `json:"trigger_rule"` // JudgmentRule.RuleID
	Verdict     JudgmentVerdict `json:"verdict"`

	// The effect being held for judgment
	HeldEffect HeldEffect `json:"held_effect"`

	// Context for the approver
	Context EscalationContext `json:"context"`

	// Approval requirements
	Approval ApprovalSpec `json:"approval"`

	// Timing
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`

	// Current status
	Status EscalationStatus `json:"status"`
}

EscalationIntent is a formal request for human judgment. It carries all the context an approver needs to make an informed decision.

type EscalationPlan

type EscalationPlan struct {
	Summary string   `json:"summary"`
	Steps   []string `json:"steps"`
}

EscalationPlan describes the intended actions.

type EscalationReceipt

type EscalationReceipt struct {
	ReceiptID   string           `json:"receipt_id"`
	IntentID    string           `json:"intent_id"`
	Outcome     EscalationStatus `json:"outcome"`
	ApprovedBy  []string         `json:"approved_by,omitempty"`
	DeniedBy    string           `json:"denied_by,omitempty"`
	DenyReason  string           `json:"deny_reason,omitempty"`
	ResolvedAt  time.Time        `json:"resolved_at"`
	DurationMs  int64            `json:"duration_ms"`
	ContentHash string           `json:"content_hash"` // Hash of intent + outcome for audit
}

EscalationReceipt is the immutable record of an escalation outcome.

type EscalationRule

type EscalationRule struct {
	Condition  string `json:"condition"`   // CEL expression
	EscalateTo string `json:"escalate_to"` // role or principal
	Timeout    int    `json:"timeout_seconds"`
}

EscalationRule defines when a phenotype must escalate to a human.

type EscalationRules

type EscalationRules struct {
	// DefaultMode is the default execution mode.
	// Values: "autonomous", "supervised", "manual"
	DefaultMode string `json:"default_mode"`

	// EscalationTriggers define conditions that require escalation.
	EscalationTriggers []EscalationTrigger `json:"escalation_triggers,omitempty"`

	// JudgmentTaxonomy classifies action categories.
	JudgmentTaxonomy []JudgmentClassification `json:"judgment_taxonomy,omitempty"`
}

EscalationRules define when and how judgment-required acts are escalated.

type EscalationStatus

type EscalationStatus string

EscalationStatus tracks the lifecycle of an escalation.

const (
	EscalationStatusPending  EscalationStatus = "PENDING"
	EscalationStatusApproved EscalationStatus = "APPROVED"
	EscalationStatusDenied   EscalationStatus = "DENIED"
	EscalationStatusTimedOut EscalationStatus = "TIMED_OUT"
	EscalationStatusAborted  EscalationStatus = "ABORTED"
)

type EscalationTemplate

type EscalationTemplate struct {
	// ApproverRoles lists who can approve.
	ApproverRoles []string `json:"approver_roles"`

	// Quorum is how many approvals are needed.
	Quorum int `json:"quorum"`

	// TimeoutSeconds is how long to wait before auto-denying.
	TimeoutSeconds int `json:"timeout_seconds"`

	// RequiredContext specifies what context must be shown to approvers.
	RequiredContext []string `json:"required_context,omitempty"` // e.g., "plan", "diff", "cost_estimate", "rollback_plan"

	// OnTimeout is the action if approval times out.
	// Values: "deny", "escalate_further", "abort_run"
	OnTimeout string `json:"on_timeout"`
}

EscalationTemplate defines the shape of an escalation request.

type EscalationTrigger

type EscalationTrigger struct {
	// Condition is a CEL expression for when to escalate.
	Condition string `json:"condition"`

	// Action specifies what to do when condition matches.
	// Values: "require_approval", "pause_and_notify", "abort"
	Action string `json:"action"`

	// Approvers lists required approver roles or IDs.
	Approvers []string `json:"approvers,omitempty"`

	// Quorum is the number of approvals needed.
	Quorum int `json:"quorum,omitempty"`

	// TimeoutSeconds is the escalation timeout.
	TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}

EscalationTrigger defines a condition that triggers judgment-required escalation.

type EventEnvelope

type EventEnvelope struct {
	EventID       string `json:"event_id"`
	ProposalID    string `json:"proposal_id"` // The Spine
	EventType     string `json:"event_type"`
	EventVersion  string `json:"event_version"`
	CanonicalHash string `json:"canonical_hash"`

	// Deterministic Time
	OracleTick int64     `json:"ts_oracle_tick"`
	Timestamp  time.Time `json:"timestamp"` // Wall time for human readability

	Payload        any    `json:"payload"`
	IdempotencyKey string `json:"idempotency_key"`
}

EventEnvelope is the immutable record of a system occurrence. It enforces the Spine Contract: Every event has a proposal_id.

type EvidenceBundle

type EvidenceBundle struct {
	StepID    string            `json:"step_id"`
	Items     map[string]string `json:"items"`
	RiskScore float64           `json:"risk_score"`
	Timestamp time.Time         `json:"timestamp"`
	Artifacts []string          `json:"artifacts"`
}

EvidenceBundle represents evidence collected for a step.

type EvidenceContract

type EvidenceContract struct {
	// ContractID is the unique identifier.
	ContractID string `json:"contract_id"`

	// ActionClass is the effect class or specific type this contract applies to.
	ActionClass string `json:"action_class"`

	// Requirements lists what evidence must be produced.
	Requirements []EvidenceSpec `json:"requirements"`

	// Version for auditability.
	Version   string    `json:"version"`
	UpdatedAt time.Time `json:"updated_at"`
}

EvidenceContract binds an action class to its evidence requirements.

type EvidenceContractManifest

type EvidenceContractManifest struct {
	Version     string             `json:"version"`
	ContentHash string             `json:"content_hash"`
	Contracts   []EvidenceContract `json:"contracts"`
	UpdatedAt   time.Time          `json:"updated_at"`
}

EvidenceContractManifest is the versioned collection of all evidence contracts.

type EvidenceEnvelopeManifest

type EvidenceEnvelopeManifest struct {
	ManifestID         string    `json:"manifest_id"`
	Envelope           string    `json:"envelope"`
	NativeEvidenceHash string    `json:"native_evidence_hash"`
	NativeAuthority    bool      `json:"native_authority"`
	Subject            string    `json:"subject,omitempty"`
	StatementHash      string    `json:"statement_hash,omitempty"`
	PayloadType        string    `json:"payload_type,omitempty"`
	PayloadHash        string    `json:"payload_hash,omitempty"`
	Experimental       bool      `json:"experimental,omitempty"`
	CreatedAt          time.Time `json:"created_at"`
	ManifestHash       string    `json:"manifest_hash,omitempty"`
}

EvidenceEnvelopeManifest records a non-authoritative export wrapper over a HELM-native EvidencePack root.

func (EvidenceEnvelopeManifest) Seal

func (EvidenceEnvelopeManifest) Validate

func (m EvidenceEnvelopeManifest) Validate() error

type EvidenceEnvelopePayload

type EvidenceEnvelopePayload struct {
	ManifestID    string         `json:"manifest_id"`
	Envelope      string         `json:"envelope"`
	PayloadType   string         `json:"payload_type"`
	Payload       map[string]any `json:"payload"`
	PayloadHash   string         `json:"payload_hash"`
	GeneratedAt   time.Time      `json:"generated_at"`
	Authoritative bool           `json:"authoritative"`
}

type EvidenceEnvelopeVerification

type EvidenceEnvelopeVerification struct {
	ManifestID   string            `json:"manifest_id"`
	ManifestHash string            `json:"manifest_hash,omitempty"`
	Envelope     string            `json:"envelope"`
	PayloadHash  string            `json:"payload_hash,omitempty"`
	Verified     bool              `json:"verified"`
	NativeRoot   string            `json:"native_root"`
	Checks       map[string]string `json:"checks"`
	Errors       []string          `json:"errors,omitempty"`
	VerifiedAt   time.Time         `json:"verified_at"`
}

type EvidencePack

type EvidencePack struct {
	// Core Identity
	PackID        string    `json:"pack_id"`
	FormatVersion string    `json:"format_version"`
	CreatedAt     time.Time `json:"created_at"`
	// CorrelationID is the product request identity (X-Helm-Correlation-ID)
	// joining this pack to its decision, receipts, and lifecycle events
	// (pilot business-telemetry contract §2). Unsigned until HELM-303.
	CorrelationID string `json:"correlation_id,omitempty"`

	// Identity
	Identity EvidencePackIdentity `json:"identity"`

	// Policy
	Policy EvidencePackPolicy `json:"policy"`

	// Effect
	Effect EvidencePackEffect `json:"effect"`

	// Context
	Context EvidencePackContext `json:"context"`

	// Execution
	Execution EvidencePackExecution `json:"execution"`

	// Receipts
	Receipts EvidencePackReceipts `json:"receipts"`

	// Reconciliation
	Reconciliation EvidencePackReconciliation `json:"reconciliation"`

	// Receipt-as-First-Class Enhancements
	ReplayScript     *ReplayScriptRef   `json:"replay_script,omitempty"`
	Provenance       *ReceiptProvenance `json:"provenance,omitempty"`
	BundledArtifacts []ParsedArtifact   `json:"bundled_artifacts,omitempty"`

	// Threat Scan Evidence
	ThreatScan *ThreatScanRef `json:"threat_scan,omitempty"`

	// SecurityFindings bind vulnerability lifecycle evidence to this pack.
	SecurityFindings []SecurityFindingRef `json:"security_findings,omitempty"`

	// Verification scope records what the verification did and did not cover.
	VerificationScopes []VerificationScope `json:"verification_scopes,omitempty"`

	// HarnessTraceRefs link telemetry that influenced execution or replay.
	HarnessTraceRefs []HarnessTraceRef `json:"harness_trace_refs,omitempty"`

	// EUAIActProfile binds high-risk AI system obligations to concrete evidence.
	EUAIActProfile *EUAIActEvidenceProfile `json:"eu_ai_act_profile,omitempty"`

	// Attestation
	Attestation EvidencePackAttestation `json:"attestation"`

	// V2: Execution Plane — enriched evidence
	NetworkLogs    []NetworkLogRef    `json:"network_logs,omitempty"`
	SecretEvents   []SecretEventRef   `json:"secret_events,omitempty"`
	PortExposures  []PortExposureRef  `json:"port_exposures,omitempty"`
	GitDiffs       []GitDiffRef       `json:"git_diffs,omitempty"`
	ReplayManifest *ReplayManifestRef `json:"replay_manifest,omitempty"`
}

EvidencePack represents a complete audit trail for an effect execution. Per Section 6 - EvidencePack Normative Contract.

type EvidencePackAttestation

type EvidencePackAttestation struct {
	PackHash      string `json:"pack_hash"`
	Signature     string `json:"signature,omitempty"`
	SignerID      string `json:"signer_id,omitempty"`
	KernelVersion string `json:"kernel_version,omitempty"`
}

EvidencePackAttestation provides cryptographic attestation.

type EvidencePackContext

type EvidencePackContext struct {
	ModeID             string `json:"mode_id,omitempty"`
	LoopID             string `json:"loop_id,omitempty"`
	Jurisdiction       string `json:"jurisdiction,omitempty"`
	PhenotypeHash      string `json:"phenotype_hash,omitempty"`
	OrchestrationRunID string `json:"orchestration_run_id,omitempty"`
	PhaseID            string `json:"phase_id,omitempty"`
	CheckpointRef      string `json:"checkpoint_ref,omitempty"`
	CritiqueRef        string `json:"critique_ref,omitempty"`
	HeuristicTraceID   string `json:"heuristic_trace_id,omitempty"`
}

EvidencePackContext provides execution context.

type EvidencePackEffect

type EvidencePackEffect struct {
	EffectID          string `json:"effect_id"`
	EffectType        string `json:"effect_type"`
	EffectPayloadHash string `json:"effect_payload_hash"`
	IdempotencyKey    string `json:"idempotency_key,omitempty"`
	Classification    string `json:"classification,omitempty"` // reversible, compensatable, irreversible
}

EvidencePackEffect describes the effect.

type EvidencePackExecution

type EvidencePackExecution struct {
	ExecutionID   string    `json:"execution_id"`
	Status        string    `json:"status"` // success, failure, timeout, compensated
	ResultHash    string    `json:"result_hash,omitempty"`
	RetryCount    int       `json:"retry_count"`
	StartedAt     time.Time `json:"started_at"`
	CompletedAt   time.Time `json:"completed_at,omitempty"`
	DurationMs    int64     `json:"duration_ms,omitempty"`
	FailureReason string    `json:"failure_reason,omitempty"`
}

EvidencePackExecution captures execution details.

type EvidencePackIdentity

type EvidencePackIdentity struct {
	ActorID              string   `json:"actor_id"`
	ActorType            string   `json:"actor_type"` // human, module, control_loop, external_system
	SessionID            string   `json:"session_id,omitempty"`
	DelegationChain      []string `json:"delegation_chain,omitempty"`
	DelegationSessionRef string   `json:"delegation_session_ref,omitempty"` // binds to active DelegationSession.SessionID
}

EvidencePackIdentity tracks the actor submitting the effect.

type EvidencePackPolicy

type EvidencePackPolicy struct {
	DecisionID          string   `json:"decision_id"`
	PolicyVersion       string   `json:"policy_version"`
	RulesFired          []string `json:"rules_fired"`
	EvaluationGraphHash string   `json:"evaluation_graph_hash"`
}

EvidencePackPolicy captures the policy decision.

type EvidencePackReceipts

type EvidencePackReceipts struct {
	PALReceipts      []PALReceiptRef      `json:"pal_receipts,omitempty"`
	ExternalReceipts []ExternalReceiptRef `json:"external_receipts,omitempty"`
}

EvidencePackReceipts contains receipts from PAL and external systems.

type EvidencePackReconciliation

type EvidencePackReconciliation struct {
	ReconciliationID string                `json:"reconciliation_id,omitempty"`
	OutboxID         string                `json:"outbox_id,omitempty"`
	CompensationRef  string                `json:"compensation_ref,omitempty"`
	DeniedAttempts   []DeniedAttemptRecord `json:"denied_attempts,omitempty"`
	FailedAttempts   []FailedAttemptRecord `json:"failed_attempts,omitempty"`
}

EvidencePackReconciliation tracks reconciliation events.

type EvidenceRequirement

type EvidenceRequirement struct {
	// ActionClass is the effect class or type this requirement applies to.
	ActionClass string `json:"action_class"`

	// EvidenceType is the kind of evidence required.
	// Values: "receipt", "hash_proof", "dual_attestation", "external_verification", "replay_proof"
	EvidenceType string `json:"evidence_type"`

	// When specifies timing relative to execution.
	// Values: "before", "after", "both"
	When string `json:"when"`

	// IssuerConstraint optionally constrains who may produce the evidence.
	IssuerConstraint string `json:"issuer_constraint,omitempty"`
}

EvidenceRequirement specifies what must be proven per action class.

type EvidenceSpec

type EvidenceSpec struct {
	// EvidenceType is the kind of evidence.
	// Values: receipt, hash_proof, dual_attestation, external_verification, replay_proof
	EvidenceType string `json:"evidence_type"`

	// When specifies timing relative to execution.
	// Values: "before", "after", "both"
	When string `json:"when"`

	// IssuerConstraint optionally constrains who may produce the evidence.
	IssuerConstraint string `json:"issuer_constraint,omitempty"`

	// Required indicates if this evidence is mandatory or optional.
	Required bool `json:"required"`

	// Description explains the purpose of this evidence.
	Description string `json:"description,omitempty"`
}

EvidenceSpec specifies a single evidence requirement.

type EvidenceSubmission

type EvidenceSubmission struct {
	SubmissionID string    `json:"submission_id"`
	ContractID   string    `json:"contract_id"`
	ActionClass  string    `json:"action_class"`
	EvidenceType string    `json:"evidence_type"`
	ContentHash  string    `json:"content_hash"`
	IssuerID     string    `json:"issuer_id"`
	SubmittedAt  time.Time `json:"submitted_at"`
	Verified     bool      `json:"verified"`
}

EvidenceSubmission is evidence produced for an action.

type EvidenceVerdict

type EvidenceVerdict struct {
	Satisfied  bool                 `json:"satisfied"`
	Missing    []EvidenceSpec       `json:"missing,omitempty"`
	Verified   []EvidenceSubmission `json:"verified,omitempty"`
	ContractID string               `json:"contract_id"`
	VerifiedAt time.Time            `json:"verified_at"`
}

EvidenceVerdict is the result of verifying evidence against a contract.

type ExecutionBoundaryRecord

type ExecutionBoundaryRecord struct {
	RecordID            string     `json:"record_id"`
	Verdict             Verdict    `json:"verdict"`
	ReasonCode          ReasonCode `json:"reason_code,omitempty"`
	ToolName            string     `json:"tool_name,omitempty"`
	ToolEffect          string     `json:"tool_effect,omitempty"`
	ArgsHash            string     `json:"args_hash,omitempty"`
	PolicyEpoch         string     `json:"policy_epoch"`
	MCPServerID         string     `json:"mcp_server_id,omitempty"`
	OAuthResource       string     `json:"oauth_resource,omitempty"`
	OAuthScopes         []string   `json:"oauth_scopes,omitempty"`
	SandboxGrantHash    string     `json:"sandbox_grant_hash,omitempty"`
	AuthzSnapshotHash   string     `json:"authz_snapshot_hash,omitempty"`
	ReceiptID           string     `json:"receipt_id,omitempty"`
	DecisionReceiptPath string     `json:"decision_receipt_path,omitempty"`
	ApprovalCommand     string     `json:"approval_command,omitempty"`
	ApprovalReceiptID   string     `json:"approval_receipt_id,omitempty"`
	DirectDispatchSeen  bool       `json:"direct_dispatch_seen,omitempty"`
	EnforcementMode     string     `json:"enforcement_mode,omitempty"`
	ObserveGrantID      string     `json:"observe_grant_id,omitempty"`
	CreatedAt           time.Time  `json:"created_at"`
	RecordHash          string     `json:"record_hash,omitempty"`
}

ExecutionBoundaryRecord is the compact receipt-boundary preimage that links policy, MCP auth, sandbox grants, relationship snapshots, and allow/deny decisions before an actuator can dispatch.

func (ExecutionBoundaryRecord) Seal

func (ExecutionBoundaryRecord) Validate

func (r ExecutionBoundaryRecord) Validate() error

type ExecutionReport

type ExecutionReport struct {
	PlanID      string       `json:"plan_id"`
	Status      string       `json:"status"`
	FinishedAt  time.Time    `json:"finished_at"`
	StepResults []StepResult `json:"step_results"`
}

ExecutionReport represents a complete execution report.

type ExternalDecisionReceipt

type ExternalDecisionReceipt struct {
	SchemaVersion  string                        `json:"schema_version"`
	Kind           ExternalReceiptKind           `json:"kind"`
	FormatID       string                        `json:"format_id"`
	FormatVersion  string                        `json:"format_version,omitempty"`
	Classification ExternalReceiptClassification `json:"classification,omitempty"`

	ReceiptID       string `json:"receipt_id"`
	PrevReceiptHash string `json:"prev_receipt_hash,omitempty"`
	ReceiptHash     string `json:"receipt_hash,omitempty"` // "sha256:" + hex over canonical signed bytes

	Action       string    `json:"action,omitempty"`
	Verdict      string    `json:"verdict,omitempty"`
	Subject      string    `json:"subject,omitempty"`
	ArgsHash     string    `json:"args_hash,omitempty"`
	DecisionTime time.Time `json:"decision_time,omitempty"`

	SignatureAlgorithm string `json:"signature_algorithm,omitempty"` // "Ed25519"
	Signature          string `json:"signature,omitempty"`           // hex or base64
	SigningKeyID       string `json:"signing_key_id,omitempty"`

	SourceVendor   string            `json:"source_vendor,omitempty"`
	Limitations    []string          `json:"limitations,omitempty"`
	OriginalDigest string            `json:"original_digest,omitempty"` // sha256 of verbatim source bytes
	Metadata       map[string]string `json:"metadata,omitempty"`
}

ExternalDecisionReceipt is the HELM-internal normalized representation that every external decision-receipt format (AAR, ACTA, Pipelock, …) maps into via its FormatAdapter. The Classification, ReceiptHash, OriginalDigest and Limitations fields are assigned by HELM during verification/import and are excluded from the bytes the producer signed.

type ExternalDecisionReceiptBundle

type ExternalDecisionReceiptBundle struct {
	SchemaVersion string                    `json:"schema_version"`
	FormatID      string                    `json:"format_id,omitempty"`
	SourceVendor  string                    `json:"source_vendor,omitempty"`
	PublicKeys    []ExternalVerifierKey     `json:"public_keys,omitempty"`
	Receipts      []ExternalDecisionReceipt `json:"receipts"`
}

ExternalDecisionReceiptBundle is the on-disk envelope for one or more external decision receipts. PublicKeys are local-only and never fetched over the network during verification (same invariant as ExternalVerifierKey).

type ExternalHostReceipt

type ExternalHostReceipt struct {
	SchemaVersion      string             `json:"schema_version,omitempty"`
	ReceiptID          string             `json:"receipt_id"`
	SourceVendor       string             `json:"source_vendor,omitempty"`
	SourceProfile      string             `json:"source_profile,omitempty"`
	HostID             string             `json:"host_id"`
	ProcessIdentity    string             `json:"process_identity,omitempty"`
	ProcessAncestry    []string           `json:"process_ancestry,omitempty"`
	AgentID            string             `json:"agent_id,omitempty"`
	WorkloadID         string             `json:"workload_id,omitempty"`
	SandboxLeaseID     string             `json:"sandbox_lease_id,omitempty"`
	Event              NetworkEgressEvent `json:"event"`
	EventKind          string             `json:"event_kind,omitempty"`
	ActionEvent        *ActionEffectEvent `json:"action_event,omitempty"`
	ReceiptHash        string             `json:"receipt_hash"`
	PrevReceiptHash    string             `json:"prev_receipt_hash,omitempty"`
	SigningKeyID       string             `json:"signing_key_id,omitempty"`
	SignatureAlgorithm string             `json:"signature_algorithm,omitempty"`
	Signature          string             `json:"signature,omitempty"`
	// SignedPayloadB64 is the Base64 of the vendor's EXACT original signed bytes.
	// When set, the signature is verified over these bytes (foreign receipts), not
	// over HELM's JCS re-canonicalization.
	SignedPayloadB64 string             `json:"signed_payload_b64,omitempty"`
	PublicKeyRef     string             `json:"public_key_ref,omitempty"`
	HardwareRoot     *HardwareRootClaim `json:"hardware_root,omitempty"`
	VerifierProfile  string             `json:"verifier_profile,omitempty"`
	RecordedAt       time.Time          `json:"recorded_at,omitempty"`
	Metadata         map[string]string  `json:"metadata,omitempty"`
}

ExternalHostReceipt records one host-observed event, typically a network egress attempt recorded below the application layer by an external recorder.

type ExternalReceiptChain

type ExternalReceiptChain struct {
	SchemaVersion     string                `json:"schema_version,omitempty"`
	ChainID           string                `json:"chain_id,omitempty"`
	SourceVendor      string                `json:"source_vendor,omitempty"`
	SourceProfile     string                `json:"source_profile,omitempty"`
	EventSchemaHash   string                `json:"event_schema_hash,omitempty"`
	ReceiptChainHash  string                `json:"receipt_chain_hash,omitempty"`
	VerificationHint  string                `json:"verification_hint,omitempty"`
	VerificationCmd   string                `json:"verification_command,omitempty"`
	CreatedAt         time.Time             `json:"created_at,omitempty"`
	PublicKeys        []ExternalVerifierKey `json:"public_keys,omitempty"`
	Receipts          []ExternalHostReceipt `json:"receipts"`
	VerificationNotes []string              `json:"verification_notes,omitempty"`
}

ExternalReceiptChain is the vendor-neutral envelope for host/network evidence imported into HELM EvidencePacks.

type ExternalReceiptClassification

type ExternalReceiptClassification string

ExternalReceiptClassification is the trust level the verifier assigns to an external receipt. It is never promoted to HELM-native authority: an external decision receipt lacks a verdict-bound effect permit, so the strongest level it can reach is crypto_conformant (cryptographically sound, decision-level).

const (
	// ClassCryptoConformant: signature verified against an externally trusted key
	// and (if a chain is present) the chain links. Decision-level proof.
	ClassCryptoConformant ExternalReceiptClassification = "crypto_conformant"
	// ClassCryptoCompatibleNonConformant: cryptographically well-formed and the
	// signature verifies, but only against a key disclosed inside the bundle
	// (self-consistency, not authenticity) or a HELM binding is absent.
	ClassCryptoCompatibleNonConformant ExternalReceiptClassification = "crypto_compatible_non_conformant"
	// ClassUnverified: no trusted key, invalid signature, or hash mismatch.
	ClassUnverified ExternalReceiptClassification = "unverified"
)

type ExternalReceiptKind

type ExternalReceiptKind string

ExternalReceiptKind is the top-level taxonomy discriminator for any receipt HELM is asked to reason about. It deliberately separates HELM-native receipts (which carry a fail-closed policy verdict bound to an effect permit) from external receipts (which, at best, carry a decision-level claim).

const (
	// KindHELMNative is reserved for receipts that bind a HELM policy verdict to
	// an effect permit + policy hash. No external-format adapter may emit it.
	KindHELMNative ExternalReceiptKind = "helm_native_receipt"
	// KindExternalDecision is a third-party decision receipt (e.g. AAR, ACTA):
	// decision-level proof only, not execution proof.
	KindExternalDecision ExternalReceiptKind = "external_decision_receipt"
	// KindExternalScan is a third-party scan/proxy receipt (e.g. Pipelock egress).
	KindExternalScan ExternalReceiptKind = "external_scan_receipt"
)

type ExternalReceiptRef

type ExternalReceiptRef struct {
	ReceiptID    string    `json:"receipt_id"`
	ExternalID   string    `json:"external_id,omitempty"`
	SystemName   string    `json:"system_name"`
	RequestHash  string    `json:"request_hash"`
	ResponseHash string    `json:"response_hash"`
	HTTPStatus   int       `json:"http_status,omitempty"`
	CompletedAt  time.Time `json:"completed_at"`
}

ExternalReceiptRef references an external system receipt.

type ExternalVerifierKey

type ExternalVerifierKey struct {
	KeyID        string `json:"key_id"`
	Algorithm    string `json:"algorithm"`
	PublicKeyHex string `json:"public_key_hex"`
}

ExternalVerifierKey carries local public-key material. Verifiers never fetch public keys over the network while checking an EvidencePack.

type FactRef

type FactRef struct {
	// FactID is a unique identifier for this fact.
	FactID string `json:"fact_id"`

	// Source identifies where the fact came from (e.g., "git_log", "api_response", "user_input").
	Source string `json:"source"`

	// Claim is the factual statement.
	Claim string `json:"claim"`

	// VerifiedAt is when the fact was last verified.
	VerifiedAt time.Time `json:"verified_at,omitempty"`

	// Hash is a content-addressed hash of the evidence supporting this fact.
	Hash string `json:"hash,omitempty"`
}

FactRef is a pointer to a verified fact that supports a plan step or decision.

type FailedAttemptRecord

type FailedAttemptRecord struct {
	AttemptID   string    `json:"attempt_id"`
	Reason      string    `json:"reason"`
	RetryNumber int       `json:"retry_number"`
	OccurredAt  time.Time `json:"occurred_at"`
}

FailedAttemptRecord records a failed execution attempt.

type FilesystemPreopen

type FilesystemPreopen struct {
	Path        string `json:"path"`
	Mode        string `json:"mode"` // ro or rw
	ContentHash string `json:"content_hash,omitempty"`
}

type FrameworkScaffold

type FrameworkScaffold struct {
	Framework      string   `json:"framework"`
	Language       string   `json:"language"`
	Files          []string `json:"files"`
	RequiredRoutes []string `json:"required_routes"`
	Mode           string   `json:"mode"`
	Notes          string   `json:"notes,omitempty"`
}

type GUIActionReceipt

type GUIActionReceipt struct {
	ReceiptID             string    `json:"receipt_id"`
	GroundedActionRef     string    `json:"grounded_action_ref"`
	ScreenshotHash        string    `json:"screenshot_hash"`
	DOMOrAXSnapshotHash   string    `json:"dom_or_ax_snapshot_hash"`
	TargetRef             string    `json:"target_ref"`
	BBoxOrElementID       string    `json:"bbox_or_element_id"`
	ActionType            string    `json:"action_type"`
	Precondition          string    `json:"precondition"`
	Postcondition         string    `json:"postcondition"`
	PostconditionRef      string    `json:"postcondition_ref"`
	PostconditionVerified bool      `json:"postcondition_verified"`
	ProofGraphNodeRef     string    `json:"proof_graph_node_ref"`
	VerificationScopeRef  string    `json:"verification_scope_ref"`
	PolicyHash            string    `json:"policy_hash"`
	SandboxGrantHash      string    `json:"sandbox_grant_hash,omitempty"`
	CreatedAt             time.Time `json:"created_at,omitempty"`
	ReceiptHash           string    `json:"receipt_hash,omitempty"`
}

GUIActionReceipt is the receipt shape for grounded GUI/computer-use actions.

func (GUIActionReceipt) Seal

func (GUIActionReceipt) Validate

func (r GUIActionReceipt) Validate() error

type GeneratedSpecApprovalAssertion

type GeneratedSpecApprovalAssertion struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`
	ChallengeID     string `json:"challenge_id"`
	ChallengeHash   string `json:"challenge_hash"`
	KeyID           string `json:"key_id"`
	Algorithm       string `json:"algorithm"`
	Signature       string `json:"signature"`
}

GeneratedSpecApprovalAssertion is a human signature over one exact GeneratedSpecApprovalChallenge. Principal, tenant, device, role, and action authority come exclusively from the trusted authority snapshot, never from this submitted assertion.

func (GeneratedSpecApprovalAssertion) SignatureBytes

func (a GeneratedSpecApprovalAssertion) SignatureBytes() ([]byte, error)

func (GeneratedSpecApprovalAssertion) SigningDigest

func (a GeneratedSpecApprovalAssertion) SigningDigest() ([]byte, error)

func (GeneratedSpecApprovalAssertion) Validate

type GeneratedSpecApprovalChallenge

type GeneratedSpecApprovalChallenge struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	ChallengeID string `json:"challenge_id"`
	ApprovalID  string `json:"approval_id"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	GeneratedSpecID       string `json:"generated_spec_id"`
	GeneratedSpecHash     string `json:"generated_spec_hash"`
	ExecutionPlanHash     string `json:"execution_plan_hash"`
	PlanTransactionHash   string `json:"plan_transaction_hash"`
	WriteSetHash          string `json:"write_set_hash"`
	VerificationScopeHash string `json:"verification_scope_hash"`
	PolicyEnvelopeHash    string `json:"policy_envelope_hash"`
	PolicyVersion         string `json:"policy_version"`
	PolicyEpoch           string `json:"policy_epoch"`
	Action                string `json:"action"`

	// RequestingPrincipalID is independently sourced by the owning control
	// service. A verified signer with this identity is rejected, so the
	// requester cannot approve their own GeneratedSpec under this v1 contract.
	RequestingPrincipalID string `json:"requesting_principal_id"`

	AuthoritySource       string `json:"authority_source"`
	AuthorityVersion      string `json:"authority_version"`
	AuthoritySnapshotHash string `json:"authority_snapshot_hash"`
	RequiredRole          string `json:"required_role"`
	Quorum                int    `json:"quorum"`

	ServerIdentity string    `json:"server_identity"`
	HoldStartedAt  time.Time `json:"hold_started_at"`
	EligibleAt     time.Time `json:"eligible_at"`
	IssuedAt       time.Time `json:"issued_at"`
	ExpiresAt      time.Time `json:"expires_at"`
	Nonce          string    `json:"nonce"`

	ChallengeHash string `json:"challenge_hash,omitempty"`
}

GeneratedSpecApprovalChallenge is the exact server-issued proposal a human approver signs. Its hashes bind the immutable GeneratedSpec source, the plan proposed for later execution, and the policy envelope that governed review.

A client-submitted copy is never evidence of issuance, elapsed hold time, or authority. The owning ceremony must load the durable record before accepting an assertion or issuing a grant.

func (GeneratedSpecApprovalChallenge) Seal

func (GeneratedSpecApprovalChallenge) Validate

func (GeneratedSpecApprovalChallenge) ValidateAt

func (c GeneratedSpecApprovalChallenge) ValidateAt(now time.Time) error

type GeneratedSpecApprovalConsumption

type GeneratedSpecApprovalConsumption struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	ApprovalID string `json:"approval_id"`
	GrantID    string `json:"grant_id"`
	GrantHash  string `json:"grant_hash"`

	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`
	ConsumedBy  string `json:"consumed_by"`

	GeneratedSpecID       string   `json:"generated_spec_id"`
	GeneratedSpecHash     string   `json:"generated_spec_hash"`
	ExecutionPlanHash     string   `json:"execution_plan_hash"`
	PlanTransactionHash   string   `json:"plan_transaction_hash"`
	WriteSetHash          string   `json:"write_set_hash"`
	VerificationScopeHash string   `json:"verification_scope_hash"`
	PolicyEnvelopeHash    string   `json:"policy_envelope_hash"`
	PolicyVersion         string   `json:"policy_version"`
	PolicyEpoch           string   `json:"policy_epoch"`
	Action                string   `json:"action"`
	RequestingPrincipalID string   `json:"requesting_principal_id"`
	ApproverPrincipalIDs  []string `json:"approver_principal_ids"`

	ChallengeHash         string `json:"challenge_hash"`
	CeremonyHash          string `json:"ceremony_hash"`
	SignerSetHash         string `json:"signer_set_hash"`
	AuthoritySource       string `json:"authority_source"`
	AuthorityVersion      string `json:"authority_version"`
	AuthoritySnapshotHash string `json:"authority_snapshot_hash"`
	ServerIdentity        string `json:"server_identity"`
	KernelTrustRootID     string `json:"kernel_trust_root_id"`
	SigningKeyRef         string `json:"signing_key_ref"`

	GrantIssuedAt  time.Time `json:"grant_issued_at"`
	GrantExpiresAt time.Time `json:"grant_expires_at"`
	ConsumedAt     time.Time `json:"consumed_at"`

	ConsumptionHash string `json:"consumption_hash,omitempty"`
}

GeneratedSpecApprovalConsumption is the signed record produced when the control-plane workload consumes one approval grant. The durable store must create it in the same transaction as its single-use grant state transition.

func (GeneratedSpecApprovalConsumption) Seal

func (GeneratedSpecApprovalConsumption) Validate

func (GeneratedSpecApprovalConsumption) ValidateGrant

type GeneratedSpecApprovalGrant

type GeneratedSpecApprovalGrant struct {
	Domain          string `json:"domain"`
	SchemaVersion   string `json:"schema_version"`
	ContractVersion string `json:"contract_version"`

	GrantID     string `json:"grant_id"`
	TenantID    string `json:"tenant_id"`
	WorkspaceID string `json:"workspace_id"`
	Audience    string `json:"audience"`

	GeneratedSpecID       string `json:"generated_spec_id"`
	GeneratedSpecHash     string `json:"generated_spec_hash"`
	ExecutionPlanHash     string `json:"execution_plan_hash"`
	PlanTransactionHash   string `json:"plan_transaction_hash"`
	WriteSetHash          string `json:"write_set_hash"`
	VerificationScopeHash string `json:"verification_scope_hash"`
	PolicyEnvelopeHash    string `json:"policy_envelope_hash"`
	PolicyVersion         string `json:"policy_version"`
	PolicyEpoch           string `json:"policy_epoch"`
	Action                string `json:"action"`

	RequestingPrincipalID string   `json:"requesting_principal_id"`
	ApproverPrincipalIDs  []string `json:"approver_principal_ids"`

	ApprovalID            string `json:"approval_id"`
	ChallengeHash         string `json:"challenge_hash"`
	CeremonyHash          string `json:"ceremony_hash"`
	SignerSetHash         string `json:"signer_set_hash"`
	AuthoritySource       string `json:"authority_source"`
	AuthorityVersion      string `json:"authority_version"`
	AuthoritySnapshotHash string `json:"authority_snapshot_hash"`

	ServerIdentity    string    `json:"server_identity"`
	KernelTrustRootID string    `json:"kernel_trust_root_id"`
	SigningKeyRef     string    `json:"signing_key_ref"`
	IssuedAt          time.Time `json:"issued_at"`
	ExpiresAt         time.Time `json:"expires_at"`
	Nonce             string    `json:"nonce"`

	GrantHash string `json:"grant_hash,omitempty"`
}

GeneratedSpecApprovalGrant carries a Kernel-signed, short-lived approval of one immutable GeneratedSpec. It is deliberately not execution authority: the Control Plane must verify the signature and atomically consume this grant while transitioning reviewed -> approved; execution still requires its own Kernel boundary decision and receipt chain.

func (GeneratedSpecApprovalGrant) Seal

func (GeneratedSpecApprovalGrant) Validate

func (g GeneratedSpecApprovalGrant) Validate() error

func (GeneratedSpecApprovalGrant) ValidateAt

func (g GeneratedSpecApprovalGrant) ValidateAt(now time.Time) error

type GenesisApprovalBinding

type GenesisApprovalBinding struct {
	// PolicyGenesisHash is the SHA-256 of the JCS-canonicalized proposed policy genesis state.
	PolicyGenesisHash string `json:"policy_genesis_hash"`

	// MirrorTextHash is the SHA-256 of the Deterministic Semantic Mirror
	// shown to the approver. UCS v1.2 canonical name.
	MirrorTextHash string `json:"mirror_text_hash"`

	// ImpactReportHash is the SHA-256 of the PhenotypeDiff + ConfluenceProof
	// wargaming output.
	ImpactReportHash string `json:"impact_report_hash"`

	// P0CeilingHash is the SHA-256 of the active P0 ceiling set at approval time.
	P0CeilingHash string `json:"p0_ceiling_hash"`
}

GenesisApprovalBinding represents the four-hash cryptographic binding required by the ORG_GENESIS_APPROVAL ceremony in the Verified Genesis Loop. Per ARCHITECTURE.md §3 and UCS v1.2.

type GenesisApprovalRequest

type GenesisApprovalRequest struct {
	// Binding contains the four cryptographic hashes that bind this
	// approval to a specific genome, mirror, impact report, and P0 ceiling.
	Binding GenesisApprovalBinding `json:"binding"`

	// ChallengeHash is derived from all four binding hashes.
	// The approver signs this to produce a deliberate confirmation.
	ChallengeHash string `json:"challenge_hash"`

	// Quorum is the number of approvers required. 0 = single approver.
	Quorum int `json:"quorum"`

	// TimelockDuration is the minimum time that must elapse before
	// the approval activates.
	TimelockDuration time.Duration `json:"timelock_duration"`

	// RateLimitWindow prevents rapid successive genome mutations.
	// If non-zero, no new genesis approval may be submitted within
	// this window after the previous activation.
	RateLimitWindow time.Duration `json:"rate_limit_window,omitempty"`

	// EmergencyOverride indicates this is an emergency bypass that
	// generates elevated-risk receipts and mandatory post-hoc review.
	EmergencyOverride bool `json:"emergency_override"`

	// ApproverKeyIDs is the list of Ed25519 key IDs that signed this approval.
	ApproverKeyIDs []string `json:"approver_key_ids"`

	// Signatures is the list of Ed25519 signatures from each approver,
	// each over the ChallengeHash.
	Signatures []string `json:"signatures"`

	// SubmittedAt is the time the ceremony request was submitted.
	SubmittedAt time.Time `json:"submitted_at"`
}

GenesisApprovalRequest is the canonical request structure for the GENESIS_APPROVAL ceremony. Extends v1 CeremonyRequest with the four-hash binding required by UCS v1.2 for activation gating.

type GenesisApprovalResult

type GenesisApprovalResult struct {
	Valid          bool   `json:"valid"`
	Reason         string `json:"reason,omitempty"`
	ActivatesAt    int64  `json:"activates_at,omitempty"`
	RequiresReview bool   `json:"requires_review,omitempty"`
	ElevatedRisk   bool   `json:"elevated_risk,omitempty"`
}

GenesisApprovalResult is the outcome of VGL ceremony validation.

type GenomePatchProposal

type GenomePatchProposal struct {
	PlanID       string `json:"plan_id"`
	PatchID      string `json:"patch_id"`
	Description  string `json:"description"`
	Reasoning    string `json:"reasoning"`
	NewPolicyCEL string `json:"new_policy_cel"`
	Changes      string `json:"changes"`
}

GenomePatchProposal represents a proposed patch to the genome.

type GitDiffRef

type GitDiffRef struct {
	DiffID     string    `json:"diff_id"`
	Hash       string    `json:"hash"`
	Repository string    `json:"repository,omitempty"`
	FromRef    string    `json:"from_ref,omitempty"` // Base commit
	ToRef      string    `json:"to_ref,omitempty"`   // Head commit
	CapturedAt time.Time `json:"captured_at"`
}

GitDiffRef references a git diff captured during execution.

type GlobalAutonomyState

type GlobalAutonomyState struct {
	// OrgID scopes this state to a specific organization.
	OrgID string `json:"org_id"`

	// Posture is the current execution posture for this org.
	Posture Posture `json:"posture"`

	// GlobalMode is the org-wide operational mode.
	GlobalMode GlobalMode `json:"global_mode"`

	// SchedulerState indicates scheduler status.
	SchedulerState SchedulerState `json:"scheduler_state"`

	// Summary is the derived Now/Next/NeedYou triplet.
	Summary NowNextNeed `json:"summary"`

	// ActiveInitiatives are the top N active work streams.
	ActiveInitiatives []Initiative `json:"active_initiatives"`

	// ActiveRuns are summaries of all currently active runs.
	ActiveRuns []RunSummaryProjection `json:"active_runs"`

	// BlockersQueue contains pending DecisionRequests and other blockers.
	BlockersQueue []DecisionRequest `json:"blockers_queue"`

	// Budget is the projected budget state.
	Budget BudgetSummary `json:"budget"`

	// RiskLevel is the current operational risk classification.
	RiskLevel RiskLevel `json:"risk_level"`

	// Anomalies are currently active anomalies.
	Anomalies []Anomaly `json:"anomalies"`

	// ComputedAt is when this projection was computed.
	ComputedAt time.Time `json:"computed_at"`
}

GlobalAutonomyState is the complete derived projection of the org's autonomy state. It is computed on read from authoritative stores and MUST NOT be persisted as truth.

type GlobalMode

type GlobalMode string

GlobalMode is the org-wide operational state.

const (
	// GlobalModeRunning is normal operation — autonomy runs continuously.
	GlobalModeRunning GlobalMode = "RUNNING"

	// GlobalModePaused is operator-initiated temporary halt — in-flight runs complete but no new runs start.
	GlobalModePaused GlobalMode = "PAUSED"

	// GlobalModeFrozen is a hard stop — all runs halt immediately, no effects dispatched.
	GlobalModeFrozen GlobalMode = "FROZEN"

	// GlobalModeIslanded is network-isolated operation — local-only, no external effects.
	GlobalModeIslanded GlobalMode = "ISLANDED"
)

type GoalSpec

type GoalSpec struct {
	GoalID          string            `json:"goal_id"`
	OriginalIntent  string            `json:"original_intent"`
	RoutingStrategy string            `json:"routing_strategy"`
	Constraints     map[string]any    `json:"constraints"`
	SuccessCriteria string            `json:"success_criteria"`
	InputContext    map[string]string `json:"input_context"`
}

GoalSpec represents a goal specification for agent execution.

type GroundedActionRef

type GroundedActionRef struct {
	GroundedActionID     string    `json:"grounded_action_id"`
	ReceiptRefs          []string  `json:"receipt_refs,omitempty"`
	ScreenshotHash       string    `json:"screenshot_hash"`
	DOMOrAXSnapshotHash  string    `json:"dom_or_ax_snapshot_hash"`
	TargetRef            string    `json:"target_ref"`
	BBoxOrElementID      string    `json:"bbox_or_element_id"`
	ActionType           string    `json:"action_type"`
	Precondition         string    `json:"precondition"`
	Postcondition        string    `json:"postcondition"`
	PostconditionRef     string    `json:"postcondition_ref"`
	ProofGraphNodeRef    string    `json:"proof_graph_node_ref"`
	VerificationScopeRef string    `json:"verification_scope_ref"`
	PolicyHash           string    `json:"policy_hash"`
	SandboxGrantHash     string    `json:"sandbox_grant_hash,omitempty"`
	CreatedAt            time.Time `json:"created_at,omitempty"`
	GroundingHash        string    `json:"grounding_hash,omitempty"`
}

GroundedActionRef binds a GUI/computer-use action to visual, DOM, and accessibility evidence before an actuator can perform it.

func (GroundedActionRef) Seal

func (GroundedActionRef) Validate

func (a GroundedActionRef) Validate() error

type HardwareApproval

type HardwareApproval struct {
	SignerID            string    `json:"signer_id"`
	Role                string    `json:"role"`
	DeviceID            string    `json:"device_id"`
	AuthenticatorAAGUID string    `json:"authenticator_aaguid,omitempty"`
	AssertionHash       string    `json:"assertion_hash"`
	AssertionSignature  string    `json:"assertion_signature,omitempty"`
	SignedAt            time.Time `json:"signed_at"`
	RevokedAtEpoch      uint64    `json:"revoked_at_epoch,omitempty"`
}

type HardwareCeremonyTranscript

type HardwareCeremonyTranscript struct {
	CeremonyID          string             `json:"ceremony_id"`
	RequiredQuorum      int                `json:"required_quorum"`
	EnrolledSignerCount int                `json:"enrolled_signer_count"`
	Approvals           []HardwareApproval `json:"approvals"`
	StartedAt           time.Time          `json:"started_at"`
	ExpiresAt           time.Time          `json:"expires_at"`
	VetoUntil           time.Time          `json:"veto_until,omitempty"`
	TranscriptHash      string             `json:"transcript_hash"`
}

type HardwareRootClaim

type HardwareRootClaim struct {
	KernelMeasurementSHA256 string    `json:"kernel_measurement_sha256,omitempty"`
	ExecutionProfile        string    `json:"execution_profile,omitempty"`
	HardwareRootType        string    `json:"hardware_root_type,omitempty"`
	QuoteFormat             string    `json:"quote_format,omitempty"`
	QuoteBlobB64            string    `json:"quote_blob_b64,omitempty"`
	QuoteVerifier           string    `json:"quote_verifier,omitempty"`
	SigningKeyNonExportable *bool     `json:"signing_key_nonexportable,omitempty"`
	MeasurementTime         time.Time `json:"measurement_time,omitempty"`
	BootSequenceRef         string    `json:"boot_sequence_ref,omitempty"`
	VerificationStatus      string    `json:"verification_status,omitempty"`
}

HardwareRootClaim is structural evidence only unless a local verifier checks quote_blob_b64 for the claimed hardware_root_type.

type HarnessChangeContract

type HarnessChangeContract struct {
	ChangeContractID       string          `json:"change_contract_id"`
	ComponentModified      string          `json:"component_modified"`
	FailureModeTargeted    string          `json:"failure_mode_targeted"`
	PredictedImprovement   string          `json:"predicted_improvement"`
	InvariantsPreserved    []string        `json:"invariants_preserved"`
	SafetyProperties       []string        `json:"safety_properties"`
	RegressionSuiteRefs    []string        `json:"regression_suite_refs"`
	SimulationEvidenceRefs []string        `json:"simulation_evidence_refs,omitempty"`
	CanaryScope            json.RawMessage `json:"canary_scope,omitempty"`
	RollbackPlan           json.RawMessage `json:"rollback_plan"`
	ApprovalRequired       bool            `json:"approval_required"`
	ActivationReceiptRef   string          `json:"activation_receipt_ref,omitempty"`
	CreatedAt              time.Time       `json:"created_at,omitempty"`
	ContractHash           string          `json:"contract_hash,omitempty"`
}

HarnessChangeContract controls mutation of the harness itself: connectors, tool schemas, grants, policy overlays, verifiers, evidence templates, and routing rules.

func (HarnessChangeContract) Seal

func (HarnessChangeContract) Validate

func (c HarnessChangeContract) Validate() error

type HarnessTrace

type HarnessTrace struct {
	TraceID               string    `json:"trace_id"`
	PlanHash              string    `json:"plan_hash"`
	ContextRefs           []string  `json:"context_refs,omitempty"`
	MemoryReads           []string  `json:"memory_reads,omitempty"`
	MemoryWrites          []string  `json:"memory_writes,omitempty"`
	ToolSchemaHashes      []string  `json:"tool_schema_hashes,omitempty"`
	PermissionRequests    []string  `json:"permission_requests,omitempty"`
	SandboxGrantHash      string    `json:"sandbox_grant_hash,omitempty"`
	MCPApprovalRef        string    `json:"mcp_approval_ref,omitempty"`
	ConnectorContractHash string    `json:"connector_contract_hash,omitempty"`
	PolicyHash            string    `json:"policy_hash"`
	CPIOutputHash         string    `json:"cpi_output_hash,omitempty"`
	VerifierOutputs       []string  `json:"verifier_outputs,omitempty"`
	HumanInterventions    []string  `json:"human_interventions,omitempty"`
	StateUpdates          []string  `json:"state_updates,omitempty"`
	ReceiptRefs           []string  `json:"receipt_refs"`
	CreatedAt             time.Time `json:"created_at,omitempty"`
	TraceHash             string    `json:"trace_hash,omitempty"`
}

HarnessTrace is the hash-linkable trace of context, permissions, verifier outputs, state updates, and receipt refs that influenced an execution.

func (HarnessTrace) Seal

func (t HarnessTrace) Seal() (HarnessTrace, error)

func (HarnessTrace) Validate

func (t HarnessTrace) Validate() error

type HarnessTraceRef

type HarnessTraceRef struct {
	TraceID string    `json:"trace_id"`
	Hash    string    `json:"hash"`
	URI     string    `json:"uri,omitempty"`
	Kind    string    `json:"kind,omitempty"`
	At      time.Time `json:"at,omitempty"`
}

HarnessTraceRef points to a canonical harness trace artifact.

type HazardClassification

type HazardClassification struct {
	HazardCode        SafeDepHazardCode `json:"hazard_code"`
	State             SafeDepState      `json:"state"`
	ReasonCode        ReasonCode        `json:"reason_code"`
	LaneID            string            `json:"lane_id,omitempty"`
	ConnectorID       string            `json:"connector_id,omitempty"`
	ActiveClock       bool              `json:"active_clock"`
	HighRiskLane      bool              `json:"high_risk_lane"`
	ActivationAllowed bool              `json:"activation_allowed"`
}

type HeldEffect

type HeldEffect struct {
	EffectType    string `json:"effect_type"`
	EffectClass   string `json:"effect_class"`
	PayloadHash   string `json:"payload_hash"`
	Description   string `json:"description"`    // Human-readable summary
	EstimatedCost int64  `json:"estimated_cost"` // In cents
	BlastRadius   string `json:"blast_radius"`
}

HeldEffect describes the effect waiting for judgment.

type HostCorrelationResult

type HostCorrelationResult struct {
	SchemaVersion     string                `json:"schema_version,omitempty"`
	Status            string                `json:"status"`
	ReasonCode        string                `json:"reason_code,omitempty"`
	Confidence        float64               `json:"confidence,omitempty"`
	HELMReceiptID     string                `json:"helm_receipt_id,omitempty"`
	HELMDecisionID    string                `json:"helm_decision_id,omitempty"`
	HELMSandboxLease  string                `json:"helm_sandbox_lease_id,omitempty"`
	HostReceiptID     string                `json:"host_receipt_id,omitempty"`
	HostReceiptHash   string                `json:"host_receipt_hash,omitempty"`
	ObservedEvent     *NetworkEgressEvent   `json:"observed_event,omitempty"`
	BoundaryDrift     *BoundaryDriftReceipt `json:"boundary_drift,omitempty"`
	CorrelationMethod string                `json:"correlation_method,omitempty"`
	Details           string                `json:"details,omitempty"`
	CorrelatedAt      time.Time             `json:"correlated_at,omitempty"`
}

HostCorrelationResult links HELM authority receipts to host-observed egress.

type IdempotencyKey

type IdempotencyKey struct {
	Key         string    `json:"key"`
	OperationID string    `json:"operation_id"`
	Status      string    `json:"status"` // "IN_PROGRESS", "COMPLETED", "FAILED"
	ResultHash  string    `json:"result_hash,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	ExpiresAt   time.Time `json:"expires_at"`
}

IdempotencyKey tracks an operation to prevent double-execution.

type IdempotencyRef

type IdempotencyRef struct {
	Strategy           string   `json:"strategy"` // client_provided, content_hash, effect_id, none
	KeyComposition     []string `json:"key_composition"`
	DedupWindowSeconds int      `json:"dedup_window_seconds,omitempty"`
	OnDuplicate        string   `json:"on_duplicate,omitempty"` // reject, return_existing, log_and_skip
}

func (IdempotencyRef) MarshalJSON

func (ref IdempotencyRef) MarshalJSON() ([]byte, error)

MarshalJSON keeps the schema-required key composition explicit on the wire. Strategies without component fields serialize an empty array rather than omitting the field or emitting null.

type IdempotencyStore

type IdempotencyStore interface {
	Check(key string) (*IdempotencyKey, bool)
	Acquire(key, operationID string, ttl time.Duration) (*IdempotencyKey, error)
	Complete(key, resultHash string) error
	Fail(key string) error
}

IdempotencyStore defines the interface for idempotency enforcement.

type IdentifiedRisk

type IdentifiedRisk struct {
	Category    string `json:"category"` // financial, compliance, operational, security
	Severity    string `json:"severity"` // low, medium, high, critical
	Description string `json:"description"`
	Mitigation  string `json:"mitigation,omitempty"`
}

IdentifiedRisk describes a risk of proceeding.

type IncidentEvent

type IncidentEvent struct {
	Timestamp   time.Time `json:"timestamp"`
	EventType   string    `json:"event_type"` // DETECTED, ACKNOWLEDGED, etc.
	Description string    `json:"description"`
	ReceiptRef  string    `json:"receipt_ref,omitempty"`
	ActorID     string    `json:"actor_id,omitempty"`
}

type IncidentPack

type IncidentPack struct {
	PackID              string                  `json:"pack_id"`
	PackType            string                  `json:"pack_type"` // "INCIDENT_PACK"
	IncidentID          string                  `json:"incident_id"`
	Severity            string                  `json:"severity,omitempty"`
	Summary             string                  `json:"summary,omitempty"`
	Timeline            []IncidentEvent         `json:"timeline"`
	RootCause           string                  `json:"root_cause,omitempty"`
	RemediationEvidence *IncidentRemediation    `json:"remediation_evidence,omitempty"`
	Attestation         IncidentPackAttestation `json:"attestation"`
}

IncidentPack represents a proof of incident lifecycle.

type IncidentPackAttestation

type IncidentPackAttestation struct {
	PackHash    string    `json:"pack_hash"`
	Signature   string    `json:"signature,omitempty"`
	SignerID    string    `json:"signer_id,omitempty"`
	GeneratedAt time.Time `json:"generated_at"`
}

type IncidentRemediation

type IncidentRemediation struct {
	FixCommitSHA    string `json:"fix_commit_sha,omitempty"`
	DeployReceiptID string `json:"deploy_receipt_id,omitempty"`
}

type InfoArchRule

type InfoArchRule struct {
	RuleID      string `json:"rule_id"`
	Scope       string `json:"scope"`       // "GLOBAL", "DASHBOARD", "DETAIL", "MODAL"
	Rule        string `json:"rule"`        // e.g. "canonical_data_only", "no_derived_metrics_without_provenance"
	Enforcement string `json:"enforcement"` // "HARD", "SOFT"
}

InfoArchRule defines structural rules for information layout.

type Initiative

type Initiative struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	ProgressPct int    `json:"progress_pct"`
	ActiveRuns  int    `json:"active_runs"`
}

Initiative is a named high-level work stream that may span multiple runs.

type InputTrustLevel

type InputTrustLevel string

InputTrustLevel classifies the provenance trust of an input channel.

const (
	InputTrustTrusted            InputTrustLevel = "TRUSTED"
	InputTrustInternalUnverified InputTrustLevel = "INTERNAL_UNVERIFIED"
	InputTrustExternalUntrusted  InputTrustLevel = "EXTERNAL_UNTRUSTED"
	InputTrustTainted            InputTrustLevel = "TAINTED"
)

func (InputTrustLevel) IsTainted

func (t InputTrustLevel) IsTainted() bool

IsTainted returns true if the trust level is TAINTED or EXTERNAL_UNTRUSTED.

type InstalledPack

type InstalledPack struct {
	PackID      string     `json:"pack_id"`
	Version     string     `json:"version"`
	Status      string     `json:"status"`
	InstalledAt *time.Time `json:"installed_at,omitempty"`
}

InstalledPack is the runtime state of a pack after installation.

type Intent

type Intent struct {
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Type        string         `json:"type,omitempty"`     // e.g. "escalation", "spend"
	Metadata    map[string]any `json:"metadata,omitempty"` // Context
	RequestedBy string         `json:"requested_by"`       // Principal ID
	CreatedAt   time.Time      `json:"created_at"`         // Metadata
}

Intent captures the human meaning of the change.

type InterventionMetadata

type InterventionMetadata struct {
	Type         InterventionType `json:"type"`
	ReasonCode   string           `json:"reason_code"`             // e.g., "VELOCITY_LIMIT_EXCEEDED"
	WaitDuration time.Duration    `json:"wait_duration,omitempty"` // For throttling
	TokensSaved  int64            `json:"tokens_saved,omitempty"`  // Efficiency metric
}

InterventionMetadata captures details about a temporal safety intervention.

type InterventionType

type InterventionType string

InterventionType represents the type of intervention.

const (
	InterventionNone       InterventionType = "NONE"
	InterventionThrottle   InterventionType = "THROTTLE"
	InterventionInterrupt  InterventionType = "INTERRUPT"
	InterventionQuarantine InterventionType = "QUARANTINE"
)

Intervention type constants.

type InvalidClientObservationError

type InvalidClientObservationError struct{ Reason string }

InvalidClientObservationError is returned by ClientObservation.Validate when a claim outruns its basis.

func (*InvalidClientObservationError) Error

type Invariant

type Invariant struct {
	Type        string `json:"type"`        // e.g., "MAX_AMOUNT"
	Description string `json:"description"` // e.g., "must not exceed 1000 USD"
	Param       string `json:"param"`       // e.g., "1000"
}

Invariant represents a hard constraint that must hold true.

type IsolatedWorker

type IsolatedWorker struct {
	WorkerID     string         `json:"worker_id"`
	Name         string         `json:"name"`
	Isolation    IsolationLevel `json:"isolation"`
	Spec         WorkerSpec     `json:"spec"`
	PhenotypeID  string         `json:"phenotype_id,omitempty"` // bound phenotype
	AssignedRole string         `json:"assigned_role"`
	TTL          *time.Duration `json:"ttl,omitempty"`
	Status       string         `json:"status"` // "IDLE", "RUNNING", "STOPPED", "FAILED"
}

IsolatedWorker defines a worker with enforced capability boundaries.

type IsolationLevel

type IsolationLevel string

IsolationLevel defines the degree of worker isolation.

const (
	IsolationNone      IsolationLevel = "NONE"
	IsolationProcess   IsolationLevel = "PROCESS"
	IsolationContainer IsolationLevel = "CONTAINER"
	IsolationVM        IsolationLevel = "VM"
	IsolationSandbox   IsolationLevel = "SANDBOX"
)

type JudgmentClassification

type JudgmentClassification struct {
	// Category is the action category name.
	Category string `json:"category"`

	// Classification is either "autonomous" or "judgment_required".
	Classification string `json:"classification"`
}

JudgmentClassification categorizes an action as autonomous or judgment-required.

type JudgmentContext

type JudgmentContext struct {
	EffectType        string `json:"effect_type"`
	EffectClass       string `json:"effect_class"` // E0..E4
	BlastRadius       string `json:"blast_radius"`
	EstimatedCost     int64  `json:"estimated_cost"`
	DataClass         string `json:"data_class"`
	Jurisdiction      string `json:"jurisdiction"`
	ActorType         string `json:"actor_type"` // human, operator, agent, service
	IsFirstOccurrence bool   `json:"is_first_occurrence"`
	CumulativeCost    int64  `json:"cumulative_cost"`
	EffectsInRun      int64  `json:"effects_in_run"`
}

JudgmentContext is the input to the judgment classifier. It provides all the information needed to classify an act.

type JudgmentDecision

type JudgmentDecision struct {
	Verdict            JudgmentVerdict     `json:"verdict"`
	MatchedRule        string              `json:"matched_rule"`
	TaxonomyVersion    string              `json:"taxonomy_version"`
	EscalationTemplate *EscalationTemplate `json:"escalation_template,omitempty"`
	Reasoning          string              `json:"reasoning"`
	DecidedAt          time.Time           `json:"decided_at"`
}

JudgmentDecision is the output of the judgment classifier.

type JudgmentRule

type JudgmentRule struct {
	// RuleID is the unique identifier for this rule.
	RuleID string `json:"rule_id"`

	// RuleName is a human-readable name.
	RuleName string `json:"rule_name"`

	// Priority determines evaluation order (higher = checked first).
	Priority int `json:"priority"`

	// Condition is a CEL expression that matches against JudgmentContext.
	// If empty, the rule matches all contexts.
	Condition string `json:"condition,omitempty"`

	// Verdict is the classification if this rule matches.
	Verdict JudgmentVerdict `json:"verdict"`

	// EscalationTemplate defines how to escalate if verdict is JUDGMENT_REQUIRED.
	EscalationTemplate *EscalationTemplate `json:"escalation_template,omitempty"`

	// Justification explains why this classification exists.
	Justification string `json:"justification,omitempty"`
}

JudgmentRule defines a single classification rule in the taxonomy.

type JudgmentTaxonomyManifest

type JudgmentTaxonomyManifest struct {
	Version     string         `json:"version"`
	ContentHash string         `json:"content_hash"`
	Rules       []JudgmentRule `json:"rules"`
	UpdatedAt   time.Time      `json:"updated_at"`
	UpdatedBy   string         `json:"updated_by"`
}

JudgmentTaxonomyManifest is the versioned collection of all rules.

type JudgmentVerdict

type JudgmentVerdict string

JudgmentVerdict is the outcome of classifying an act.

const (
	// VerdictAutonomous means the act can proceed without human intervention.
	VerdictAutonomous JudgmentVerdict = "AUTONOMOUS"

	// VerdictJudgmentRequired means a human must approve before proceeding.
	VerdictJudgmentRequired JudgmentVerdict = "JUDGMENT_REQUIRED"

	// VerdictProhibited means the act is not allowed under any circumstances.
	VerdictProhibited JudgmentVerdict = "PROHIBITED"
)

type JurisdictionConstraint

type JurisdictionConstraint struct {
	// AllowedJurisdictions is the set of ISO codes where this run may operate.
	AllowedJurisdictions []string `json:"allowed_jurisdictions"`

	// RegulatoryMode controls how strictly compliance rules are enforced.
	// Values: "strict", "permissive", "audit_only"
	RegulatoryMode string `json:"regulatory_mode"`

	// DataResidencyRegions constrains where data may reside.
	DataResidencyRegions []string `json:"data_residency_regions,omitempty"`

	// ProhibitedJurisdictions are explicitly denied.
	ProhibitedJurisdictions []string `json:"prohibited_jurisdictions,omitempty"`
}

JurisdictionConstraint defines where a run is legally allowed to operate.

type Kind

type Kind string

Kind defines the category of change.

const (
	KindSpend      Kind = "SPEND"
	KindDeploy     Kind = "DEPLOY"
	KindAccess     Kind = "ACCESS"
	KindLawChange  Kind = "LAW_CHANGE"
	KindAutophagy  Kind = "AUTOPHAGY"
	KindActivation Kind = "RAIL_ACTIVATION"
)

Kind constants.

type Lane

type Lane string

Lane categorizes the functional domain of an autonomous run.

const (
	// LaneResearch covers information gathering, analysis, and learning runs.
	LaneResearch Lane = "RESEARCH"

	// LaneBuild covers engineering, development, and infrastructure runs.
	LaneBuild Lane = "BUILD"

	// LaneGTM covers go-to-market, marketing, and sales runs.
	LaneGTM Lane = "GTM"

	// LaneOps covers operational, monitoring, and maintenance runs.
	LaneOps Lane = "OPS"

	// LaneCompliance covers regulatory, audit, and governance runs.
	LaneCompliance Lane = "COMPLIANCE"
)

func AllLanes

func AllLanes() []Lane

AllLanes returns all defined lanes in display order.

type LaneState

type LaneState struct {
	// Lane identifies which lane this state describes.
	Lane Lane `json:"lane"`

	// ActiveRuns is the count of currently active runs in this lane.
	ActiveRuns int `json:"active_runs"`

	// ProgressPct is the aggregate progress across all active runs (0-100).
	ProgressPct int `json:"progress_pct"`

	// NextAction describes the next scheduled or queued action in this lane.
	NextAction string `json:"next_action"`

	// LastVerification summarizes the most recent verification result.
	LastVerification string `json:"last_verification"`

	// Status is the aggregate status: "active", "idle", "blocked".
	Status string `json:"status"`

	// BlockedCount is the number of runs blocked in this lane.
	BlockedCount int `json:"blocked_count"`
}

LaneState represents the current state of all runs within a single lane.

func (*LaneState) IsIdle

func (ls *LaneState) IsIdle() bool

IsIdle returns true if the lane has no active runs and no pending actions.

type LaunchBlueprint

type LaunchBlueprint struct {
	SchemaVersion             string                    `json:"schema_version"`
	PortableVocabularyVersion string                    `json:"portable_vocabulary_version"`
	BlueprintID               string                    `json:"blueprint_id"`
	SourceReconnectRequired   bool                      `json:"source_reconnect_required"`
	ProviderSelectionRequired bool                      `json:"provider_selection_required"`
	Nodes                     []LaunchBlueprintNode     `json:"nodes"`
	Edges                     []LaunchBlueprintEdge     `json:"edges"`
	Constraints               LaunchBlueprintConstraint `json:"constraints"`
}

LaunchBlueprint is intentionally clean-room: it contains only a workload shape and portable constraints. It has no source/account/provider identity, approvals, payloads, receipts, or EvidencePack references. Provider-specific semantics remain private until an explicit portable-vocabulary mapping ships.

func ProjectLaunchBlueprint

func ProjectLaunchBlueprint(graph LaunchWorkloadGraph, constraints LaunchConstraintSet) (LaunchBlueprint, error)

ProjectLaunchBlueprint removes all source, tenancy, provider, account, approval, and evidence identities. Node IDs are replaced with deterministic ordinal IDs, arbitrary semantic tokens are rejected, and the blueprint ID is derived from the sanitized projection rather than accepted from a caller.

type LaunchBlueprintConstraint

type LaunchBlueprintConstraint struct {
	MaximumGrossCurrency      string   `json:"maximum_gross_currency"`
	MaximumGrossMinor         int64    `json:"maximum_gross_minor"`
	AllowedJurisdictions      []string `json:"allowed_jurisdictions"`
	RequiredResidencyTags     []string `json:"required_residency_tags"`
	AllowedCommitmentTerms    []string `json:"allowed_commitment_terms"`
	RequiredRouteCapabilities []string `json:"required_route_capabilities"`
}

type LaunchBlueprintEdge

type LaunchBlueprintEdge struct {
	FromNodeID   string `json:"from_node_id"`
	ToNodeID     string `json:"to_node_id"`
	Relationship string `json:"relationship"`
}

type LaunchBlueprintNode

type LaunchBlueprintNode struct {
	NodeID               string   `json:"node_id"`
	Kind                 string   `json:"kind"`
	LifecycleClass       string   `json:"lifecycle_class"`
	RequiredCapabilities []string `json:"required_capabilities"`
}

type LaunchCommercialEvidence

type LaunchCommercialEvidence struct {
	SchemaVersion  string                              `json:"schema_version"`
	EvidenceID     string                              `json:"evidence_id"`
	TenantID       string                              `json:"tenant_id"`
	WorkspaceID    string                              `json:"workspace_id"`
	MissionID      string                              `json:"mission_id"`
	QuoteCurrency  string                              `json:"quote_currency"`
	PlacementCosts []LaunchCommercialPlacementEvidence `json:"placement_costs"`
	RetrievedAt    string                              `json:"retrieved_at"`
	ExpiresAt      string                              `json:"expires_at"`
}

LaunchCommercialEvidence is the source-owned cost calculation behind one route quote. Provider prices stay in their native currencies; exact FX and tax snapshots are resolved independently before HELM accepts the converted gross exposure. The artifact carries no dispatch authority.

type LaunchCommercialPlacementEvidence

type LaunchCommercialPlacementEvidence struct {
	PlacementID           string `json:"placement_id"`
	ProviderID            string `json:"provider_id"`
	ProviderAccountRef    string `json:"provider_account_ref"`
	ProviderAccountHash   string `json:"provider_account_hash"`
	RegionID              string `json:"region_id"`
	OfferingID            string `json:"offering_id"`
	BillingCadence        string `json:"billing_cadence"`
	CommitmentTerm        string `json:"commitment_term"`
	ProviderCurrency      string `json:"provider_currency"`
	ProviderBaseCostMinor int64  `json:"provider_base_cost_minor"`
	PriceEvidenceRef      string `json:"price_evidence_ref"`
	PriceEvidenceHash     string `json:"price_evidence_hash"`
	TermsEvidenceRef      string `json:"terms_evidence_ref"`
	TermsEvidenceHash     string `json:"terms_evidence_hash"`
	FXSnapshotRef         string `json:"fx_snapshot_ref"`
	FXSnapshotHash        string `json:"fx_snapshot_hash"`
	TaxSnapshotRef        string `json:"tax_snapshot_ref"`
	TaxSnapshotHash       string `json:"tax_snapshot_hash"`
	FXReserveBPS          int64  `json:"fx_reserve_bps"`
	BaseCostMinor         int64  `json:"base_cost_minor"`
	TaxReserveMinor       int64  `json:"tax_reserve_minor"`
	FXReserveMinor        int64  `json:"fx_reserve_minor"`
	TaxFXReserveMinor     int64  `json:"tax_fx_reserve_minor"`
	GrossExposureMinor    int64  `json:"gross_exposure_minor"`
}

type LaunchConstraintSet

type LaunchConstraintSet struct {
	SchemaVersion             string   `json:"schema_version"`
	ConstraintSetID           string   `json:"constraint_set_id"`
	TenantID                  string   `json:"tenant_id"`
	WorkspaceID               string   `json:"workspace_id"`
	MissionID                 string   `json:"mission_id"`
	MaximumGrossCurrency      string   `json:"maximum_gross_currency"`
	MaximumGrossMinor         int64    `json:"maximum_gross_minor"`
	AllowedProviders          []string `json:"allowed_providers"`
	AllowedJurisdictions      []string `json:"allowed_jurisdictions"`
	RequiredResidencyTags     []string `json:"required_residency_tags"`
	AllowedCommitmentTerms    []string `json:"allowed_commitment_terms"`
	RequiredRouteCapabilities []string `json:"required_route_capabilities"`
	PolicyExpressionHash      string   `json:"policy_expression_hash"`
}

LaunchConstraintSet is the versioned, approval-bound policy input to route selection. The Kernel stays provider-neutral: individual missions can bind EU-only, a EUR 50 cap, monthly commitment, or a different policy without compiling those commercial choices into the effect taxonomy.

type LaunchEffectApprovalAuthority

type LaunchEffectApprovalAuthority struct {
	Grant                         ApprovalGrant             `json:"grant"`
	GrantSignatureAlgorithm       string                    `json:"grant_signature_algorithm"`
	GrantSignature                string                    `json:"grant_signature"`
	Consumption                   ApprovalGrantConsumption  `json:"consumption"`
	ConsumptionSignatureAlgorithm string                    `json:"consumption_signature_algorithm"`
	ConsumptionSignature          string                    `json:"consumption_signature"`
	DispatchAdmission             ApprovalDispatchAdmission `json:"dispatch_admission"`
	DispatchSignatureAlgorithm    string                    `json:"dispatch_signature_algorithm"`
	DispatchSignature             string                    `json:"dispatch_signature"`
}

LaunchEffectApprovalAuthority is independently loaded from the canonical approvalceremony boundary. Signatures are retained beside their canonical Grant and Consumption records because those portable contracts deliberately exclude transport/storage signature envelopes.

type LaunchEffectAuthorizationEnvelope

type LaunchEffectAuthorizationEnvelope struct {
	SchemaVersion           string         `json:"schema_version"`
	EffectID                string         `json:"effect_id"`
	TenantID                string         `json:"tenant_id"`
	WorkspaceID             string         `json:"workspace_id"`
	MissionID               string         `json:"mission_id"`
	Principal               string         `json:"principal"`
	Audience                string         `json:"audience"`
	KernelTrustRootID       string         `json:"kernel_trust_root_id"`
	EffectOrdinal           int            `json:"effect_ordinal"`
	InputSchemaRef          string         `json:"input_schema_ref"`
	InputSchemaHash         string         `json:"input_schema_hash"`
	Input                   map[string]any `json:"input"`
	InputHash               string         `json:"input_hash"`
	IdempotencyKey          string         `json:"idempotency_key"`
	PlanHash                string         `json:"plan_hash"`
	ApprovalArtifactRef     string         `json:"approval_artifact_ref"`
	ApprovalArtifactHash    string         `json:"approval_artifact_hash"`
	ApprovalConsumptionRef  string         `json:"approval_consumption_ref"`
	ApprovalConsumptionHash string         `json:"approval_consumption_hash"`
	DispatchAdmissionRef    string         `json:"dispatch_admission_ref"`
	DispatchAdmissionHash   string         `json:"dispatch_admission_hash"`
	DependencySetRef        string         `json:"dependency_set_ref"`
	DependencySetHash       string         `json:"dependency_set_hash"`
	PolicyEpoch             string         `json:"policy_epoch"`
	EmergencyFenceEpoch     int64          `json:"emergency_fence_epoch"`
	Verdict                 string         `json:"verdict"`
	KernelVerdictRef        string         `json:"kernel_verdict_ref"`
	KernelVerdictIssuedAt   string         `json:"kernel_verdict_issued_at"`
	KernelVerdictExpiry     string         `json:"kernel_verdict_expiry"`
	KernelVerdictSignerKey  string         `json:"kernel_verdict_signer_key_id"`
	KernelVerdictHash       string         `json:"kernel_verdict_hash"`
	KernelVerdictSignature  string         `json:"kernel_verdict_signature"`
	EffectPermitRef         string         `json:"effect_permit_ref"`
	EffectPermitHash        string         `json:"effect_permit_hash"`
	PermitNonce             string         `json:"permit_nonce"`
	PermitIssuedAt          string         `json:"permit_issued_at"`
	PermitExpiry            string         `json:"permit_expiry"`
	ProofSessionRef         string         `json:"proof_session_ref"`
	EvidenceReservationRef  string         `json:"evidence_reservation_ref"`
	ConnectorID             string         `json:"connector_id"`
	ConnectorContractHash   string         `json:"connector_contract_hash"`
	ConnectorAuthorityRef   string         `json:"connector_authority_ref"`
	ConnectorAuthorityHash  string         `json:"connector_authority_hash"`
	ActionURN               string         `json:"action_urn"`
	RequestBodyHash         string         `json:"request_body_hash"`
	ArgsC14NHash            string         `json:"args_c14n_hash"`
	DispatchDeadline        string         `json:"dispatch_deadline"`
	ReplayHint              string         `json:"replay_hint"`
}

LaunchEffectAuthorizationEnvelope is the preview dispatch contract. Merely constructing this value grants no authority: VerifyLaunchEffectAuthorizationEnvelope must resolve and bind the single-use permit immediately before dispatch.

func SignLaunchEffectAuthorizationEnvelope

func SignLaunchEffectAuthorizationEnvelope(envelope LaunchEffectAuthorizationEnvelope, privateKey ed25519.PrivateKey) (LaunchEffectAuthorizationEnvelope, error)

SignLaunchEffectAuthorizationEnvelope is a deterministic preview helper for source-owned conformance fixtures. Production signing remains Kernel-owned.

type LaunchEffectDispatchDestination

type LaunchEffectDispatchDestination struct {
	EndpointURI             string
	RouteBindingRef         string
	RouteBindingHash        string
	RoutePlacementID        string
	ProviderID              string
	ProviderAccountRef      string
	ProviderAccountHash     string
	RegionID                string
	OfferingID              string
	ProviderConnectorID     string
	ProviderConnectorHash   string
	ProviderActionURN       string
	ProviderDestinationHash string
}

LaunchEffectDispatchDestination is the exact provider route presented to the connector's last pre-effect seam. The endpoint itself is never persisted in the permit; only its approval-bound hash is.

type LaunchEffectDispatchFinalization

type LaunchEffectDispatchFinalization struct {
	Permit          LaunchEffectPermitBinding
	MustStartBefore time.Time
}

LaunchEffectDispatchFinalization is the exact single-use permit and the exclusive wall-clock bound that a source-owned finalizer must enforce in the same atomic operation as its permit CAS.

type LaunchEffectDispatchFinalizationObservation

type LaunchEffectDispatchFinalizationObservation struct {
	ObservedAt              time.Time
	ObservedAuthority       LaunchEffectPermitBinding
	RequestBodyHash         string
	ArgsC14NHash            string
	ProviderDestinationHash string
	ProviderPayloadHash     string
}

LaunchEffectDispatchFinalizationObservation is rebuilt from source-owned state while the finalizer holds the dispatch serialization fence.

type LaunchEffectDispatchRequest

type LaunchEffectDispatchRequest struct {
	RequestBody     []byte
	ArgsC14N        []byte
	ProviderPayload []byte
	Destination     LaunchEffectDispatchDestination
}

LaunchEffectDispatchRequest contains the exact immutable bytes passed to the connector seam. Provider credentials remain source-owned and are released only after the finalizer consumes the permit.

type LaunchEffectEnvelopeVerificationContext

type LaunchEffectEnvelopeVerificationContext struct {
	Now                      time.Time
	ResolveInputSchema       func(schemaRef string) ([]byte, error)
	ValidateInput            func(schemaRef, schemaHash string, input map[string]any) error
	ResolveRouteBinding      func(routeRef string) (LaunchRouteBinding, error)
	RouteArtifacts           LaunchRouteArtifactResolver
	ResolveApprovalAuthority func(grantRef, grantHash, consumptionRef, consumptionHash string) (LaunchEffectApprovalAuthority, error)
	VerifyApprovalAuthority  func(LaunchEffectApprovalAuthority) error
	VerifyDependencyState    func(dependencySetRef, dependencySetHash string) error
	// ExpectedRequestBodyHash and ExpectedArgsC14NHash are retained for v1
	// source compatibility. When supplied, preflight binds them exactly; the
	// finalizer still independently resolves the immutable dispatch bytes.
	ExpectedRequestBodyHash string
	ExpectedArgsC14NHash    string
	ExpectedPolicyEpoch     string
	MaximumPermitTTL        time.Duration
	// ResolveVerdictKey is the v1 resolver shape. New callers should prefer
	// ResolveVerdictKeyForTrustRoot so the trust root is explicit at lookup.
	ResolveVerdictKey              func(signerKeyID string) (ed25519.PublicKey, error)
	ResolveVerdictKeyForTrustRoot  func(kernelTrustRootID, signerKeyID string) (ed25519.PublicKey, error)
	ResolveEmergencyFence          func(tenantID, workspaceID string) (LaunchEmergencyFenceSnapshot, error)
	ResolveDispatchRequest         func(LaunchEffectPermitBinding) (LaunchEffectDispatchRequest, error)
	ResolveDispatchTime            func() (time.Time, error)
	ResolvePermitBinding           func(effectPermitRef, effectPermitHash string) (LaunchEffectPermitBinding, error)
	ResolvePolicyEpoch             func(tenantID, workspaceID string) (string, error)
	ResolveCurrentConnectorRelease func(ApprovalConnectorAuthority) (ConnectorReleaseAuthorityEnvelope, error)
	VerifyCurrentConnectorRelease  func(ConnectorReleaseAuthorityEnvelope, time.Time) error
	// VerifyDispatchCommit proves the finalizer consumed the exact permit and
	// persisted STARTED immediately before the network seam.
	VerifyDispatchCommit func(LaunchEffectDispatchFinalization, LaunchEffectDispatchFinalizationObservation) error
	// FinalizeAndStartDispatch must hold the source-owned serialization fence,
	// validate, consume the permit, persist STARTED, then invoke start before
	// releasing that fence. It must not consume on validation failure.
	FinalizeAndStartDispatch func(
		expected LaunchEffectDispatchFinalization,
		validate func() (LaunchEffectDispatchFinalizationObservation, error),
		start func() error,
	) error
	// StartDispatch is the bounded last pre-effect seam. It must enforce the
	// approved Destination tuple; it may not derive or substitute an endpoint.
	StartDispatch func(expected LaunchEffectPermitBinding, request LaunchEffectDispatchRequest) error
	// FinalizeDispatch is retained for v1 source compatibility only. It cannot
	// prove the durable STARTED reservation or invoke the bounded connector
	// interlock, so VerifyLaunchEffectAuthorizationEnvelope fails closed before
	// relying on this callback.
	FinalizeDispatch func(expected LaunchEffectPermitBinding) error
	Permit           LaunchEffectPermitBinding
}

LaunchEffectEnvelopeVerificationContext supplies independently resolved source truth. Values copied from the envelope are not valid inputs here.

type LaunchEffectEvidenceDAG

type LaunchEffectEvidenceDAG struct {
	Nodes []LaunchEffectEvidenceNode `json:"nodes"`
}

type LaunchEffectEvidenceNode

type LaunchEffectEvidenceNode struct {
	NodeHash               string   `json:"node_hash"`
	ParentHashes           []string `json:"parent_hashes"`
	ArtifactRefs           []string `json:"artifact_refs"`
	ProofSessionRef        string   `json:"proof_session_ref"`
	EvidenceReservationRef string   `json:"evidence_reservation_ref"`
	Lamport                uint64   `json:"lamport"`
}

LaunchEffectEvidenceNode is the minimal source-owned projection needed to verify that effect evidence precedes receipts and EvidencePacks. ArtifactRefs must never contain a receipt or EvidencePack dependency.

type LaunchEffectPermitBinding

type LaunchEffectPermitBinding struct {
	EffectPermitRef         string
	EffectPermitHash        string
	PermitNonce             string
	ProofSessionRef         string
	EvidenceReservationRef  string
	PermitIssuedAt          time.Time
	PermitExpiry            time.Time
	KernelVerdictRef        string
	KernelVerdictHash       string
	KernelVerdictIssuedAt   time.Time
	KernelVerdictExpiry     time.Time
	EffectID                string
	TenantID                string
	WorkspaceID             string
	MissionID               string
	Principal               string
	Audience                string
	KernelTrustRootID       string
	EffectOrdinal           int
	InputSchemaHash         string
	InputHash               string
	IdempotencyKey          string
	PlanHash                string
	ApprovalArtifactRef     string
	ApprovalArtifactHash    string
	ApprovalConsumptionRef  string
	ApprovalConsumptionHash string
	DispatchAdmissionRef    string
	DispatchAdmissionHash   string
	DependencySetRef        string
	DependencySetHash       string
	ConnectorID             string
	ConnectorContractHash   string
	ConnectorAuthorityRef   string
	ConnectorAuthorityHash  string
	ActionURN               string
	RequestBodyHash         string
	ArgsC14NHash            string
	PolicyEpoch             string
	EmergencyFenceEpoch     int64
	DispatchDeadline        time.Time
	RouteBindingRef         string
	RouteBindingHash        string
	RoutePlacementID        string
	ProviderID              string
	ProviderAccountRef      string
	ProviderAccountHash     string
	RegionID                string
	OfferingID              string
	ProviderConnectorID     string
	ProviderConnectorHash   string
	ProviderActionURN       string
	ProviderDestinationHash string
	ProviderPayloadHash     string
	SingleUse               bool
}

LaunchEffectPermitBinding is a data-plane dispatch CAS, not a parallel approval. It is usable only after a canonical ApprovalGrant has already been verified and consumed by the exact principal/audience below.

type LaunchEffectReceipt

type LaunchEffectReceipt struct {
	SchemaVersion                 string                      `json:"schema_version"`
	ReceiptVersion                string                      `json:"receipt_version"`
	Kind                          string                      `json:"kind"`
	ReceiptID                     string                      `json:"receipt_id"`
	ReceiptChainID                string                      `json:"receipt_chain_id"`
	ReceiptRevision               int                         `json:"receipt_revision"`
	ReconciliationRevision        int                         `json:"reconciliation_revision"`
	DecisionID                    string                      `json:"decision_id"`
	EffectID                      string                      `json:"effect_id"`
	Verdict                       string                      `json:"verdict"`
	Principal                     string                      `json:"principal"`
	Audience                      string                      `json:"audience"`
	KernelTrustRootID             string                      `json:"kernel_trust_root_id"`
	Tool                          string                      `json:"tool"`
	Action                        string                      `json:"action"`
	Timestamp                     string                      `json:"timestamp"`
	Lamport                       uint64                      `json:"lamport"`
	ProofGraphNode                string                      `json:"proofgraph_node"`
	SignerKeyID                   string                      `json:"signer_key_id"`
	PayloadHash                   string                      `json:"payload_hash"`
	Metadata                      LaunchEffectReceiptMetadata `json:"metadata"`
	TenantID                      string                      `json:"tenant_id"`
	WorkspaceID                   string                      `json:"workspace_id"`
	MissionID                     string                      `json:"mission_id"`
	EffectOrdinal                 int                         `json:"effect_ordinal"`
	InputSchemaHash               string                      `json:"input_schema_hash"`
	InputHash                     string                      `json:"input_hash"`
	IdempotencyKey                string                      `json:"idempotency_key"`
	PlanHash                      string                      `json:"plan_hash"`
	RequestHash                   string                      `json:"request_hash"`
	ArgsC14NHash                  string                      `json:"args_c14n_hash"`
	ResultHash                    string                      `json:"result_hash"`
	KernelVerdictRef              string                      `json:"kernel_verdict_ref"`
	KernelVerdictHash             string                      `json:"kernel_verdict_hash"`
	ApprovalArtifactRef           string                      `json:"approval_artifact_ref"`
	ApprovalArtifactHash          string                      `json:"approval_artifact_hash"`
	ApprovalConsumptionRef        string                      `json:"approval_consumption_ref"`
	ApprovalConsumptionHash       string                      `json:"approval_consumption_hash"`
	DispatchAdmissionRef          string                      `json:"dispatch_admission_ref"`
	DispatchAdmissionHash         string                      `json:"dispatch_admission_hash"`
	EffectReservationRef          string                      `json:"effect_reservation_ref"`
	EffectReservationHash         string                      `json:"effect_reservation_hash"`
	EffectPermitRef               string                      `json:"effect_permit_ref"`
	EffectPermitHash              string                      `json:"effect_permit_hash"`
	PermitNonce                   string                      `json:"permit_nonce"`
	PermitConsumptionRef          string                      `json:"permit_consumption_ref"`
	PermitConsumptionHash         string                      `json:"permit_consumption_hash"`
	ProofSessionRef               string                      `json:"proof_session_ref"`
	EvidenceReservationRef        string                      `json:"evidence_reservation_ref"`
	PolicyEpoch                   string                      `json:"policy_epoch"`
	EmergencyFenceEpoch           int64                       `json:"emergency_fence_epoch"`
	ConnectorContractHash         string                      `json:"connector_contract_hash"`
	ConnectorAuthorityRef         string                      `json:"connector_authority_ref"`
	ConnectorAuthorityHash        string                      `json:"connector_authority_hash"`
	ReconciliationLocator         string                      `json:"reconciliation_locator_hash"`
	ProviderOperationRef          string                      `json:"provider_operation_ref,omitempty"`
	ProviderResourceRefs          []string                    `json:"provider_resource_refs,omitempty"`
	Outcome                       string                      `json:"outcome"`
	ReconciliationStatus          string                      `json:"reconciliation_status"`
	DependencyState               string                      `json:"dependency_state"`
	DependencySetRef              string                      `json:"dependency_set_ref"`
	DependencySetHash             string                      `json:"dependency_set_hash"`
	DependencyStateHash           string                      `json:"dependency_state_hash"`
	RouteBindingRef               string                      `json:"route_binding_ref,omitempty"`
	RouteBindingHash              string                      `json:"route_binding_hash,omitempty"`
	RoutePlacementID              string                      `json:"route_placement_id,omitempty"`
	ProviderID                    string                      `json:"provider_id,omitempty"`
	ProviderAccountRef            string                      `json:"provider_account_ref,omitempty"`
	ProviderAccountHash           string                      `json:"provider_account_hash,omitempty"`
	RegionID                      string                      `json:"region_id,omitempty"`
	OfferingID                    string                      `json:"offering_id,omitempty"`
	ProviderConnectorID           string                      `json:"provider_connector_id,omitempty"`
	ProviderConnectorContractHash string                      `json:"provider_connector_contract_hash,omitempty"`
	ProviderActionURN             string                      `json:"provider_action_urn,omitempty"`
	ProviderPayloadHash           string                      `json:"provider_payload_hash,omitempty"`
	ProviderProfileRef            string                      `json:"provider_capability_profile_ref,omitempty"`
	ProviderProfileHash           string                      `json:"provider_capability_profile_hash,omitempty"`
	ProviderCertificationRef      string                      `json:"provider_certification_ref,omitempty"`
	ProviderCertificationHash     string                      `json:"provider_certification_hash,omitempty"`
	OfferSnapshotRef              string                      `json:"offer_snapshot_ref,omitempty"`
	OfferSnapshotHash             string                      `json:"offer_snapshot_hash,omitempty"`
	PriceEvidenceHash             string                      `json:"price_evidence_hash,omitempty"`
	TermsEvidenceHash             string                      `json:"terms_evidence_hash,omitempty"`
	EvidencePackRef               string                      `json:"evidence_pack_ref,omitempty"`
	EvidencePackHash              string                      `json:"evidence_pack_hash,omitempty"`
	PreviousReceiptID             string                      `json:"previous_receipt_id,omitempty"`
	Signature                     string                      `json:"signature"`
}

LaunchEffectReceipt is the Receipt Format v1 profile for one preview Launch Mission effect. ReceiptID is content-addressed, Signature is Ed25519 over the ReceiptID, and revisions form an append-only chain through PreviousReceiptID.

func SignLaunchEffectReceipt

func SignLaunchEffectReceipt(receipt LaunchEffectReceipt, privateKey ed25519.PrivateKey) (LaunchEffectReceipt, error)

SignLaunchEffectReceipt seals a non-terminal immutable receipt revision using Receipt Format v1 content addressing and an Ed25519 signature over ReceiptID. Terminal revisions must use SignLaunchEffectReceiptRevision so they cannot be created without presenting the exact sealed predecessor they close.

func SignLaunchEffectReceiptRevision

func SignLaunchEffectReceiptRevision(current, previous LaunchEffectReceipt, privateKey ed25519.PrivateKey) (LaunchEffectReceipt, error)

SignLaunchEffectReceiptRevision seals a revision only after its exact content-addressed predecessor and immutable transition have been supplied. Cryptographic predecessor verification remains mandatory at verification time because receipt signer keys may rotate between revisions.

type LaunchEffectReceiptAuthorityBinding

type LaunchEffectReceiptAuthorityBinding struct {
	EffectReservationRef          string `json:"effect_reservation_ref"`
	EffectReservationHash         string `json:"effect_reservation_hash"`
	EffectID                      string `json:"effect_id"`
	TenantID                      string `json:"tenant_id"`
	WorkspaceID                   string `json:"workspace_id"`
	MissionID                     string `json:"mission_id"`
	Principal                     string `json:"principal"`
	Audience                      string `json:"audience"`
	KernelTrustRootID             string `json:"kernel_trust_root_id"`
	EffectOrdinal                 int    `json:"effect_ordinal"`
	InputSchemaHash               string `json:"input_schema_hash"`
	InputHash                     string `json:"input_hash"`
	IdempotencyKey                string `json:"idempotency_key"`
	PlanHash                      string `json:"plan_hash"`
	RequestHash                   string `json:"request_hash"`
	ArgsC14NHash                  string `json:"args_c14n_hash"`
	KernelVerdictRef              string `json:"kernel_verdict_ref"`
	KernelVerdictHash             string `json:"kernel_verdict_hash"`
	ApprovalArtifactRef           string `json:"approval_artifact_ref"`
	ApprovalArtifactHash          string `json:"approval_artifact_hash"`
	ApprovalConsumptionRef        string `json:"approval_consumption_ref"`
	ApprovalConsumptionHash       string `json:"approval_consumption_hash"`
	DispatchAdmissionRef          string `json:"dispatch_admission_ref"`
	DispatchAdmissionHash         string `json:"dispatch_admission_hash"`
	EffectPermitRef               string `json:"effect_permit_ref"`
	EffectPermitHash              string `json:"effect_permit_hash"`
	PermitNonce                   string `json:"permit_nonce"`
	PermitConsumptionRef          string `json:"permit_consumption_ref"`
	PermitConsumptionHash         string `json:"permit_consumption_hash"`
	ProofSessionRef               string `json:"proof_session_ref"`
	EvidenceReservationRef        string `json:"evidence_reservation_ref"`
	PolicyEpoch                   string `json:"policy_epoch"`
	EmergencyFenceEpoch           int64  `json:"emergency_fence_epoch"`
	ConnectorID                   string `json:"connector_id"`
	ConnectorContractHash         string `json:"connector_contract_hash"`
	ConnectorAuthorityRef         string `json:"connector_authority_ref"`
	ConnectorAuthorityHash        string `json:"connector_authority_hash"`
	ActionURN                     string `json:"action_urn"`
	DependencySetRef              string `json:"dependency_set_ref"`
	DependencySetHash             string `json:"dependency_set_hash"`
	RouteBindingRef               string `json:"route_binding_ref,omitempty"`
	RouteBindingHash              string `json:"route_binding_hash,omitempty"`
	RoutePlacementID              string `json:"route_placement_id,omitempty"`
	ProviderID                    string `json:"provider_id,omitempty"`
	ProviderAccountRef            string `json:"provider_account_ref,omitempty"`
	ProviderAccountHash           string `json:"provider_account_hash,omitempty"`
	RegionID                      string `json:"region_id,omitempty"`
	OfferingID                    string `json:"offering_id,omitempty"`
	ProviderConnectorID           string `json:"provider_connector_id,omitempty"`
	ProviderConnectorContractHash string `json:"provider_connector_contract_hash,omitempty"`
	ProviderActionURN             string `json:"provider_action_urn,omitempty"`
	ProviderPayloadHash           string `json:"provider_payload_hash,omitempty"`
	ProviderProfileRef            string `json:"provider_capability_profile_ref,omitempty"`
	ProviderProfileHash           string `json:"provider_capability_profile_hash,omitempty"`
	ProviderCertificationRef      string `json:"provider_certification_ref,omitempty"`
	ProviderCertificationHash     string `json:"provider_certification_hash,omitempty"`
	OfferSnapshotRef              string `json:"offer_snapshot_ref,omitempty"`
	OfferSnapshotHash             string `json:"offer_snapshot_hash,omitempty"`
	PriceEvidenceHash             string `json:"price_evidence_hash,omitempty"`
	TermsEvidenceHash             string `json:"terms_evidence_hash,omitempty"`
}

LaunchEffectReceiptAuthorityBinding is source-owned dispatch truth resolved from the durable effect reservation. Receipt producers cannot satisfy this contract by reflecting fields from the receipt under verification.

type LaunchEffectReceiptMetadata

type LaunchEffectReceiptMetadata struct {
	Profile              string `json:"profile"`
	RedactionProfileHash string `json:"redaction_profile_hash"`
}

LaunchEffectReceiptMetadata is intentionally closed and secret-free. Raw provider transcripts and arbitrary metadata are not admitted into receipts.

type LaunchEffectReceiptVerificationContext

type LaunchEffectReceiptVerificationContext struct {
	MinimumLamport         uint64
	MaximumChainDepth      int
	ResolveSignerKey       func(signerKeyID string) (ed25519.PublicKey, error)
	ResolveAuthority       func(reservationRef, reservationHash string) (LaunchEffectReceiptAuthorityBinding, error)
	ResolveEvidenceDAG     func(nodeHash string) (LaunchEffectEvidenceDAG, error)
	ResolvePreviousReceipt func(previousReceiptID string) (LaunchEffectReceipt, error)
	VerifyEvidencePack     func(evidencePackRef, evidencePackHash, previousReceiptID string) error
}

LaunchEffectReceiptVerificationContext supplies trust-root, durable effect reservation, and ProofGraph source truth. None may be copied from the receipt being verified.

type LaunchEmergencyFenceSnapshot

type LaunchEmergencyFenceSnapshot struct {
	TenantID       string
	WorkspaceID    string
	EffectiveEpoch int64
	Active         bool
}

LaunchEmergencyFenceSnapshot is source-owned scoped-stop state. Its epoch must advance on both stop and clear so a pre-stop permit cannot revive.

type LaunchFXSnapshot

type LaunchFXSnapshot struct {
	SchemaVersion     string `json:"schema_version"`
	SnapshotID        string `json:"snapshot_id"`
	SourceCurrency    string `json:"source_currency"`
	QuoteCurrency     string `json:"quote_currency"`
	RateNumerator     int64  `json:"rate_numerator"`
	RateDenominator   int64  `json:"rate_denominator"`
	OfficialSourceURL string `json:"official_source_url"`
	ContentHash       string `json:"content_hash"`
	RetrievedAt       string `json:"retrieved_at"`
	ExpiresAt         string `json:"expires_at"`
}

LaunchFXSnapshot expresses an exact rational conversion from provider minor units to quote minor units. A rational rate avoids floating-point or locale ambiguity and makes the conservative ceiling deterministic.

type LaunchOfferSnapshot

type LaunchOfferSnapshot struct {
	SchemaVersion       string   `json:"schema_version"`
	SnapshotID          string   `json:"snapshot_id"`
	TenantID            string   `json:"tenant_id"`
	WorkspaceID         string   `json:"workspace_id"`
	ProviderID          string   `json:"provider_id"`
	ProviderAccountRef  string   `json:"provider_account_ref,omitempty"`
	ProviderAccountHash string   `json:"provider_account_hash,omitempty"`
	OfficialSourceURL   string   `json:"official_source_url"`
	ContentVersionHash  string   `json:"content_version_hash"`
	TermsHash           string   `json:"terms_hash"`
	ExclusionsHash      string   `json:"exclusions_hash"`
	Status              string   `json:"status"`
	Currency            string   `json:"currency"`
	VerifiedCreditMinor int64    `json:"verified_credit_minor"`
	EvidenceRefs        []string `json:"evidence_refs"`
	RetrievedAt         string   `json:"retrieved_at"`
	ExpiresAt           string   `json:"expires_at"`
}

LaunchOfferSnapshot separates official offer/credit evidence from a route quote. Only ACTIVE_CREDIT_VERIFIED may carry a non-zero balance, and that status requires an exact connected provider account. Advisory eligibility never reduces expected cash and never increases the gross authorization cap.

type LaunchPlacementCost

type LaunchPlacementCost struct {
	PlacementID         string `json:"placement_id"`
	ProviderID          string `json:"provider_id"`
	ProviderAccountRef  string `json:"provider_account_ref"`
	ProviderAccountHash string `json:"provider_account_hash"`
	RegionID            string `json:"region_id"`
	OfferingID          string `json:"offering_id"`
	BillingCadence      string `json:"billing_cadence"`
	CommitmentTerm      string `json:"commitment_term"`
	BaseCostMinor       int64  `json:"base_cost_minor"`
	TaxFXReserveMinor   int64  `json:"tax_fx_reserve_minor"`
	GrossExposureMinor  int64  `json:"gross_exposure_minor"`
	VerifiedCreditMinor int64  `json:"verified_credit_minor"`
	ExpectedCashMinor   int64  `json:"expected_cash_minor"`
	CreditStatus        string `json:"credit_status"`
	OfferSnapshotRef    string `json:"offer_snapshot_ref"`
	OfferSnapshotHash   string `json:"offer_snapshot_hash"`
	PriceEvidenceHash   string `json:"price_evidence_hash"`
	TermsEvidenceHash   string `json:"terms_evidence_hash"`
}

type LaunchProviderAction

type LaunchProviderAction struct {
	EffectID                     string   `json:"effect_id"`
	ActionURN                    string   `json:"action_urn"`
	ProviderDestinationHash      string   `json:"provider_destination_hash"`
	ReconciliationMode           string   `json:"reconciliation_mode"`
	IdempotencyMode              string   `json:"idempotency_mode"`
	SupportedTransitionClasses   []string `json:"supported_transition_classes"`
	SupportedCompensationClasses []string `json:"supported_compensation_classes"`
}

type LaunchProviderCapabilityProfile

type LaunchProviderCapabilityProfile struct {
	SchemaVersion         string                 `json:"schema_version"`
	ProfileID             string                 `json:"profile_id"`
	ProviderID            string                 `json:"provider_id"`
	ConnectorID           string                 `json:"connector_id"`
	ConnectorContractHash string                 `json:"connector_contract_hash"`
	ProfileVersion        string                 `json:"profile_version"`
	ProfileStatus         string                 `json:"profile_status"`
	Regions               []LaunchProviderRegion `json:"regions"`
	Actions               []LaunchProviderAction `json:"actions"`
	PricingEvidenceRef    string                 `json:"pricing_evidence_ref"`
	PricingEvidenceHash   string                 `json:"pricing_evidence_hash"`
	TermsEvidenceRef      string                 `json:"terms_evidence_ref"`
	TermsEvidenceHash     string                 `json:"terms_evidence_hash"`
	RetrievedAt           string                 `json:"retrieved_at"`
	ExpiresAt             string                 `json:"expires_at"`
}

LaunchProviderCapabilityProfile is provider-owned routing evidence. ProfileStatus is informational lifecycle metadata only. It grants no dispatch authority; production admission requires an independently resolved signed certification.

type LaunchProviderCertificationRecord

type LaunchProviderCertificationRecord struct {
	SchemaVersion             string `json:"schema_version"`
	CertificationID           string `json:"certification_id"`
	ProfileRef                string `json:"profile_ref"`
	ProfileHash               string `json:"profile_hash"`
	ProviderID                string `json:"provider_id"`
	ConnectorID               string `json:"connector_id"`
	ConnectorContractHash     string `json:"connector_contract_hash"`
	CertificationTier         string `json:"certification_tier"`
	CertificationSuiteHash    string `json:"certification_suite_hash"`
	CertificationEvidenceHash string `json:"certification_evidence_hash"`
	AdmissionStatus           string `json:"admission_status"`
	IssuedAt                  string `json:"issued_at"`
	ExpiresAt                 string `json:"expires_at"`
	SignerKeyID               string `json:"signer_key_id"`
	RecordHash                string `json:"record_hash"`
	Signature                 string `json:"signature"`
}

LaunchProviderCertificationRecord is source-owned certification evidence. A capability profile can reference this record, but cannot authorize itself: dispatch requires signature verification through a configured trust root and a current-record check against the owning certification registry.

type LaunchProviderOffering

type LaunchProviderOffering struct {
	OfferingID            string   `json:"offering_id"`
	SupportedWorkloads    []string `json:"supported_workload_kinds"`
	SupportedCapabilities []string `json:"supported_capabilities"`
	SupportedLifecycles   []string `json:"supported_lifecycle_classes"`
}

type LaunchProviderPayloadEntry

type LaunchProviderPayloadEntry struct {
	PlacementID       string `json:"placement_id"`
	EffectID          string `json:"effect_id"`
	ProviderActionURN string `json:"provider_action_urn"`
	DestinationHash   string `json:"provider_destination_hash"`
	PayloadHash       string `json:"payload_hash"`
}

type LaunchProviderPayloadSet

type LaunchProviderPayloadSet struct {
	SchemaVersion string                       `json:"schema_version"`
	PayloadSetID  string                       `json:"payload_set_id"`
	TenantID      string                       `json:"tenant_id"`
	WorkspaceID   string                       `json:"workspace_id"`
	MissionID     string                       `json:"mission_id"`
	Entries       []LaunchProviderPayloadEntry `json:"entries"`
}

type LaunchProviderRegion

type LaunchProviderRegion struct {
	RegionID      string                   `json:"region_id"`
	Jurisdiction  string                   `json:"jurisdiction"`
	ResidencyTags []string                 `json:"residency_tags"`
	Offerings     []LaunchProviderOffering `json:"offerings"`
}

type LaunchRepositoryAnalysis

type LaunchRepositoryAnalysis struct {
	SchemaVersion        string `json:"schema_version"`
	AnalysisID           string `json:"analysis_id"`
	TenantID             string `json:"tenant_id"`
	WorkspaceID          string `json:"workspace_id"`
	SourceConnectionRef  string `json:"source_connection_ref"`
	SourceCommitSHA      string `json:"source_commit_sha"`
	SourceTreeHash       string `json:"source_tree_hash"`
	AnalyzerContractHash string `json:"analyzer_contract_hash"`
	Status               string `json:"status"`
	WorkloadGraphRef     string `json:"workload_graph_ref,omitempty"`
	WorkloadGraphHash    string `json:"workload_graph_hash,omitempty"`
	FindingSetHash       string `json:"finding_set_hash"`
	AnalyzedAt           string `json:"analyzed_at"`
}

LaunchRepositoryAnalysis records what was actually inspected. SourceConnectionRef is an opaque server-side reference, never a credential-bearing repository URL.

type LaunchResourceEdge

type LaunchResourceEdge struct {
	FromResourceID string `json:"from_resource_id"`
	ToResourceID   string `json:"to_resource_id"`
	Relationship   string `json:"relationship"`
}

type LaunchResourceGraph

type LaunchResourceGraph struct {
	SchemaVersion   string               `json:"schema_version"`
	ResourceGraphID string               `json:"resource_graph_id"`
	TenantID        string               `json:"tenant_id"`
	WorkspaceID     string               `json:"workspace_id"`
	MissionID       string               `json:"mission_id"`
	Nodes           []LaunchResourceNode `json:"nodes"`
	Edges           []LaunchResourceEdge `json:"edges"`
}

type LaunchResourceNode

type LaunchResourceNode struct {
	ResourceID       string `json:"resource_id"`
	PlacementID      string `json:"placement_id"`
	WorkloadNodeID   string `json:"workload_node_id"`
	ResourceKind     string `json:"resource_kind"`
	LifecycleClass   string `json:"lifecycle_class"`
	DesiredStateHash string `json:"desired_state_hash"`
	OwnershipTagHash string `json:"ownership_tag_hash"`
}

type LaunchRouteActionBinding

type LaunchRouteActionBinding struct {
	EffectID                string `json:"effect_id"`
	ProviderActionURN       string `json:"provider_action_urn"`
	ProviderDestinationHash string `json:"provider_destination_hash"`
	ProviderPayloadHash     string `json:"provider_payload_hash"`
}

type LaunchRouteArtifactResolver

type LaunchRouteArtifactResolver interface {
	ResolveLaunchRepositoryAnalysis(ref string) (LaunchRepositoryAnalysis, error)
	ResolveLaunchWorkloadGraph(ref string) (LaunchWorkloadGraph, error)
	ResolveLaunchProviderProfile(ref string) (LaunchProviderCapabilityProfile, error)
	ResolveLaunchProviderCertification(ref string) (LaunchProviderCertificationRecord, error)
	ResolveLaunchConstraintSet(ref string) (LaunchConstraintSet, error)
	ResolveLaunchRouteQuote(ref string) (LaunchRouteQuote, error)
	ResolveLaunchCommercialEvidence(ref string) (LaunchCommercialEvidence, error)
	ResolveLaunchFXSnapshot(ref string) (LaunchFXSnapshot, error)
	ResolveLaunchTaxSnapshot(ref string) (LaunchTaxSnapshot, error)
	ResolveLaunchOfferSnapshot(ref string) (LaunchOfferSnapshot, error)
	ResolveLaunchResourceGraph(ref string) (LaunchResourceGraph, error)
	ResolveLaunchProviderPayloadSet(ref string) (LaunchProviderPayloadSet, error)
	ResolveLaunchGeneratedSpecHash(ref string) (string, error)
	ResolveLaunchCertificationKey(signerKeyID string) (ed25519.PublicKey, error)
	AssertLaunchCertificationCurrent(certificationID, recordHash string) error
}

LaunchRouteArtifactResolver is intentionally source-owned. Route validation receives only opaque refs and resolves each approval-bound artifact through this interface; values copied from an effect input do not satisfy it.

type LaunchRouteBinding

type LaunchRouteBinding struct {
	SchemaVersion          string                  `json:"schema_version"`
	RouteID                string                  `json:"route_id"`
	TenantID               string                  `json:"tenant_id"`
	WorkspaceID            string                  `json:"workspace_id"`
	MissionID              string                  `json:"mission_id"`
	RepositoryAnalysisRef  string                  `json:"repository_analysis_ref"`
	RepositoryAnalysisHash string                  `json:"repository_analysis_hash"`
	WorkloadGraphRef       string                  `json:"workload_graph_ref"`
	WorkloadGraphHash      string                  `json:"workload_graph_hash"`
	ConstraintSetRef       string                  `json:"constraint_set_ref"`
	ConstraintSetHash      string                  `json:"constraint_set_hash"`
	RouteQuoteRef          string                  `json:"route_quote_ref"`
	RouteQuoteHash         string                  `json:"route_quote_hash"`
	ResourceGraphRef       string                  `json:"resource_graph_ref"`
	ResourceGraphHash      string                  `json:"resource_graph_hash"`
	ProviderPayloadSetRef  string                  `json:"provider_payload_set_ref"`
	ProviderPayloadSetHash string                  `json:"provider_payload_set_hash"`
	GeneratedSpecRef       string                  `json:"generated_spec_ref"`
	GeneratedSpecHash      string                  `json:"generated_spec_hash"`
	Placements             []LaunchRoutePlacement  `json:"placements"`
	PlacementDependencies  []LaunchRouteDependency `json:"placement_dependencies"`
	ExpiresAt              string                  `json:"expires_at"`
}

LaunchRouteBinding is a multi-provider route plan. Each placement binds one subgraph to an exact account, region, offering, connector, action set, and optional certification record. Cross-placement dependencies are explicit.

type LaunchRouteDependency

type LaunchRouteDependency struct {
	FromPlacementID  string `json:"from_placement_id"`
	ToPlacementID    string `json:"to_placement_id"`
	Relationship     string `json:"relationship"`
	WorkloadEdgeHash string `json:"workload_edge_hash"`
}

type LaunchRoutePlacement

type LaunchRoutePlacement struct {
	PlacementID                   string                     `json:"placement_id"`
	WorkloadNodeIDs               []string                   `json:"workload_node_ids"`
	ProviderProfileRef            string                     `json:"provider_profile_ref"`
	ProviderProfileHash           string                     `json:"provider_profile_hash"`
	ProviderCertificationRef      string                     `json:"provider_certification_ref,omitempty"`
	ProviderCertificationHash     string                     `json:"provider_certification_hash,omitempty"`
	ProviderID                    string                     `json:"provider_id"`
	ProviderAccountRef            string                     `json:"provider_account_ref"`
	ProviderAccountHash           string                     `json:"provider_account_hash"`
	RegionID                      string                     `json:"region_id"`
	Jurisdiction                  string                     `json:"jurisdiction"`
	OfferingID                    string                     `json:"offering_id"`
	ProviderConnectorID           string                     `json:"provider_connector_id"`
	ProviderConnectorContractHash string                     `json:"provider_connector_contract_hash"`
	ActionBindings                []LaunchRouteActionBinding `json:"action_bindings"`
	ResourceSubsetHash            string                     `json:"resource_subset_hash"`
	ProviderPayloadSubsetHash     string                     `json:"provider_payload_subset_hash"`
}

type LaunchRouteQuote

type LaunchRouteQuote struct {
	SchemaVersion          string                `json:"schema_version"`
	QuoteID                string                `json:"quote_id"`
	TenantID               string                `json:"tenant_id"`
	WorkspaceID            string                `json:"workspace_id"`
	MissionID              string                `json:"mission_id"`
	WorkloadGraphHash      string                `json:"workload_graph_hash"`
	ConstraintSetHash      string                `json:"constraint_set_hash"`
	Currency               string                `json:"currency"`
	PlacementCosts         []LaunchPlacementCost `json:"placement_costs"`
	BaseProviderCostMinor  int64                 `json:"base_provider_cost_minor"`
	TaxFXReserveMinor      int64                 `json:"tax_fx_reserve_minor"`
	GrossExposureMinor     int64                 `json:"gross_exposure_minor"`
	VerifiedCreditMinor    int64                 `json:"verified_credit_minor"`
	ExpectedCashMinor      int64                 `json:"expected_cash_minor"`
	CreditStatus           string                `json:"credit_status"`
	CreditSnapshotHash     string                `json:"credit_snapshot_hash"`
	FXSnapshotHash         string                `json:"fx_snapshot_hash"`
	TaxSnapshotHash        string                `json:"tax_snapshot_hash"`
	CommercialEvidenceRef  string                `json:"commercial_evidence_ref"`
	CommercialEvidenceHash string                `json:"commercial_evidence_hash"`
	RetrievedAt            string                `json:"retrieved_at"`
	ExpiresAt              string                `json:"expires_at"`
}

type LaunchTaxSnapshot

type LaunchTaxSnapshot struct {
	SchemaVersion       string `json:"schema_version"`
	SnapshotID          string `json:"snapshot_id"`
	TenantID            string `json:"tenant_id"`
	WorkspaceID         string `json:"workspace_id"`
	ProviderID          string `json:"provider_id"`
	ProviderAccountRef  string `json:"provider_account_ref"`
	ProviderAccountHash string `json:"provider_account_hash"`
	Jurisdiction        string `json:"jurisdiction"`
	Status              string `json:"status"`
	TaxRateBPS          int64  `json:"tax_rate_bps"`
	OfficialSourceURL   string `json:"official_source_url"`
	ContentHash         string `json:"content_hash"`
	RetrievedAt         string `json:"retrieved_at"`
	ExpiresAt           string `json:"expires_at"`
}

LaunchTaxSnapshot binds the exact provider account and jurisdiction used by a tax calculation. When the provider cannot estimate tax, the cost service must use CONSERVATIVE_MAXIMUM; UNKNOWN is never allowed to imply zero tax.

type LaunchWorkloadEdge

type LaunchWorkloadEdge struct {
	FromNodeID   string `json:"from_node_id"`
	ToNodeID     string `json:"to_node_id"`
	Relationship string `json:"relationship"`
}

type LaunchWorkloadGraph

type LaunchWorkloadGraph struct {
	SchemaVersion   string               `json:"schema_version"`
	GraphID         string               `json:"graph_id"`
	TenantID        string               `json:"tenant_id"`
	WorkspaceID     string               `json:"workspace_id"`
	SourceCommitSHA string               `json:"source_commit_sha"`
	SourceTreeHash  string               `json:"source_tree_hash"`
	Nodes           []LaunchWorkloadNode `json:"nodes"`
	Edges           []LaunchWorkloadEdge `json:"edges"`
	UnknownSetHash  string               `json:"unknown_set_hash"`
}

LaunchWorkloadGraph is provider-neutral. It represents arbitrary repository shapes without silently collapsing workers, stateful data, GPUs, clusters, functions, or infrastructure into a website deployment.

type LaunchWorkloadNode

type LaunchWorkloadNode struct {
	NodeID               string   `json:"node_id"`
	Kind                 string   `json:"kind"`
	LifecycleClass       string   `json:"lifecycle_class"`
	DefinitionHash       string   `json:"definition_hash"`
	RequirementsHash     string   `json:"requirements_hash"`
	RequiredCapabilities []string `json:"required_capabilities"`
	Deployability        string   `json:"deployability"`
}

type Lineage

type Lineage struct {
	RootCause string `json:"root_cause,omitempty"`
}

Lineage tracks provenance.

type MCPAuthorizationProfile

type MCPAuthorizationProfile struct {
	ProfileID            string   `json:"profile_id"`
	Resource             string   `json:"resource"`
	AuthorizationServers []string `json:"authorization_servers,omitempty"`
	ScopesSupported      []string `json:"scopes_supported,omitempty"`
	RequiredScopes       []string `json:"required_scopes,omitempty"`
	ProtocolVersions     []string `json:"protocol_versions,omitempty"`
	ToolScopeHash        string   `json:"tool_scope_hash,omitempty"`
	ProfileHash          string   `json:"profile_hash,omitempty"`
}

MCPAuthorizationProfile records the protected-resource and scope contract enforced for an MCP server or wrapped upstream.

func (MCPAuthorizationProfile) Seal

func (*MCPAuthorizationProfile) UnmarshalJSON

func (p *MCPAuthorizationProfile) UnmarshalJSON(data []byte) error

func (MCPAuthorizationProfile) Validate

func (p MCPAuthorizationProfile) Validate() error

type MCPAuthorizeCallRequest

type MCPAuthorizeCallRequest struct {
	ServerID         string   `json:"server_id"`
	ToolName         string   `json:"tool_name"`
	ArgsHash         string   `json:"args_hash,omitempty"`
	GrantedScopes    []string `json:"granted_scopes,omitempty"`
	PinnedSchemaHash string   `json:"pinned_schema_hash,omitempty"`
	ToolSchema       any      `json:"tool_schema,omitempty"`
	OutputSchema     any      `json:"output_schema,omitempty"`
	OAuthResource    string   `json:"oauth_resource,omitempty"`
	ReceiptID        string   `json:"receipt_id,omitempty"`
}

type MCPScanRequest

type MCPScanRequest struct {
	ServerID  string   `json:"server_id"`
	Name      string   `json:"name,omitempty"`
	Transport string   `json:"transport,omitempty"`
	Endpoint  string   `json:"endpoint,omitempty"`
	ToolNames []string `json:"tool_names,omitempty"`
}

type MCPScanResult

type MCPScanResult struct {
	ServerID            string    `json:"server_id"`
	Risk                string    `json:"risk"`
	State               string    `json:"state"`
	ToolCount           int       `json:"tool_count"`
	Findings            []string  `json:"findings,omitempty"`
	RecommendedAction   string    `json:"recommended_action"`
	QuarantineRecordID  string    `json:"quarantine_record_id,omitempty"`
	RequiresApproval    bool      `json:"requires_approval"`
	SchemaPinRequired   bool      `json:"schema_pin_required"`
	AuthorizationNeeded bool      `json:"authorization_needed"`
	ScannedAt           time.Time `json:"scanned_at"`
}

type MatchedSpan

type MatchedSpan struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Text  string `json:"text"`
}

MatchedSpan records an exact byte range of matched content.

type MigrationPlan

type MigrationPlan struct {
	PlanID     string          `json:"plan_id"`
	SchemaName string          `json:"schema_name"`
	From       string          `json:"from_version"`
	To         string          `json:"to_version"`
	Steps      []MigrationRule `json:"steps"`
}

MigrationPlan is an ordered list of migration rules to apply.

type MigrationRegistry

type MigrationRegistry interface {
	Register(rule MigrationRule) error
	Lookup(schemaName, from, to string) (*MigrationPlan, error)
	ListVersions(schemaName string) ([]string, error)
}

MigrationRegistry stores available migration rules.

type MigrationRule

type MigrationRule struct {
	RuleID      string    `json:"rule_id"`
	SchemaName  string    `json:"schema_name"`
	FromVersion string    `json:"from_version"`
	ToVersion   string    `json:"to_version"`
	Description string    `json:"description"`
	Reversible  bool      `json:"reversible"`
	Transform   string    `json:"transform"`            // CEL expression or migration script path
	Validation  string    `json:"validation,omitempty"` // CEL expression to validate post-migration
	CreatedAt   time.Time `json:"created_at"`
}

MigrationRule defines a forward migration from one schema version to another.

type ModelAttestation

type ModelAttestation struct {
	AttestationID string    `json:"attestation_id"`
	ProviderID    string    `json:"provider_id"`
	ModelName     string    `json:"model_name"`
	Attester      string    `json:"attester"` // who attests
	Claims        []string  `json:"claims"`   // "SAFE", "EVALUATED", "CERTIFIED"
	ValidFrom     time.Time `json:"valid_from"`
	ValidUntil    time.Time `json:"valid_until"`
	EvidenceHash  string    `json:"evidence_hash"`
	Signature     string    `json:"signature,omitempty"`
}

ModelAttestation is a third-party attestation about a model.

type ModelProvider

type ModelProvider struct {
	ProviderID   string   `json:"provider_id"`
	Name         string   `json:"name"`
	Capabilities []string `json:"capabilities"` // "TEXT", "CODE", "VISION", "EMBEDDING"
	Regions      []string `json:"regions"`
	RiskTier     string   `json:"risk_tier"` // "LOW", "MEDIUM", "HIGH", "CRITICAL"
	MaxTokens    int      `json:"max_tokens,omitempty"`
	CostPerMTok  float64  `json:"cost_per_million_tokens,omitempty"`
	Latency95th  int      `json:"latency_p95_ms,omitempty"`
	Active       bool     `json:"active"`
}

ModelProvider describes a model provider and its capabilities.

func KnownModelProviders

func KnownModelProviders() []ModelProvider

KnownModelProviders returns provider-neutral examples for routing tests and schema demonstrations.

type ModelRouteRequest

type ModelRouteRequest struct {
	TaskType          string `json:"task_type"`
	Region            string `json:"region,omitempty"`
	MaxRiskTier       string `json:"max_risk_tier,omitempty"`
	PreferredProvider string `json:"preferred_provider,omitempty"`
}

ModelRouteRequest is a request to select a model provider.

type ModelRouteResult

type ModelRouteResult struct {
	ProviderID   string `json:"provider_id"`
	ProviderName string `json:"provider_name"`
	SelectedBy   string `json:"selected_by"` // "RULE", "FALLBACK", "DEFAULT"
	RuleID       string `json:"rule_id,omitempty"`
}

ModelRouteResult is the selected provider and routing metadata.

type ModelRouter

type ModelRouter interface {
	Route(req ModelRouteRequest) (*ModelRouteResult, error)
	ListProviders() ([]ModelProvider, error)
}

ModelRouter selects a model provider given a task context.

type NetworkEgressEvent

type NetworkEgressEvent struct {
	EventID          string            `json:"event_id,omitempty"`
	AttemptID        string            `json:"attempt_id,omitempty"`
	ActionID         string            `json:"action_id,omitempty"`
	Direction        string            `json:"direction,omitempty"`
	SourceIP         string            `json:"source_ip,omitempty"`
	DestinationIP    string            `json:"destination_ip"`
	DestinationHost  string            `json:"destination_host,omitempty"`
	DestinationPort  int               `json:"destination_port"`
	Protocol         string            `json:"protocol"`
	Timestamp        time.Time         `json:"timestamp"`
	BytesSent        int64             `json:"bytes_sent,omitempty"`
	BytesReceived    int64             `json:"bytes_received,omitempty"`
	Verdict          string            `json:"verdict,omitempty"`
	ObservedBy       string            `json:"observed_by,omitempty"`
	CorrelationHints map[string]string `json:"correlation_hints,omitempty"`
}

NetworkEgressEvent is the canonical host-observed outbound network event.

type NetworkGrant

type NetworkGrant struct {
	Mode         string   `json:"mode"` // deny-all, allowlist
	Destinations []string `json:"destinations,omitempty"`
	CIDRs        []string `json:"cidrs,omitempty"`
}

type NetworkLogRef

type NetworkLogRef struct {
	LogID         string    `json:"log_id"`
	Hash          string    `json:"hash"`
	Source        string    `json:"source,omitempty"` // "sandbox", "firewall", "proxy"
	CapturedAt    time.Time `json:"captured_at"`
	BytesCaptured int64     `json:"bytes_captured,omitempty"`
}

NetworkLogRef references a network activity log captured during execution.

type NormalizationEvidence

type NormalizationEvidence struct {
	OriginalLength    int      `json:"original_length"`
	NormalizedLength  int      `json:"normalized_length"`
	LengthDelta       int      `json:"length_delta"`
	ZeroWidthsRemoved int      `json:"zero_widths_removed"`
	HomoglyphsFound   int      `json:"homoglyphs_found"`
	NFKCApplied       bool     `json:"nfkc_applied"`
	SuspiciousChars   []string `json:"suspicious_chars,omitempty"`
}

NormalizationEvidence records how Unicode normalization transformed the input.

type NowNextNeed

type NowNextNeed struct {
	// Now describes the single most important thing happening right now.
	Now string `json:"now"`

	// Next describes the next scheduled or queued action.
	Next string `json:"next"`

	// NeedYou describes what's blocked waiting for human input (empty if nothing).
	NeedYou string `json:"need_you"`
}

NowNextNeed is a concise derived summary of the system's current state. "Now" = what is actively happening, "Next" = what's queued, "NeedYou" = what's blocked on human.

type ObservedAssumption

type ObservedAssumption struct {
	AssumptionID string `json:"assumption_id"`
	// Subject names what was observed, so an observer knows what to re-read.
	Subject string `json:"subject"`
	// ObservationType matches the schema enum.
	ObservationType string `json:"observation_type"`
	// ContentHash digests the observed state. Re-observing and getting a
	// different digest means the world moved under the plan.
	ContentHash string    `json:"content_hash"`
	CapturedAt  time.Time `json:"captured_at"`
	// TTLSeconds is how long the observation is considered valid. Zero means
	// the observation carries no validity window and is treated as expired
	// immediately — an assumption with no freshness bound is not an assumption.
	TTLSeconds int `json:"ttl_seconds"`
	// AssumptionHash is the sealed JCS digest, bound into a denial as evidence.
	AssumptionHash string `json:"assumption_hash,omitempty"`
}

ObservedAssumption is a claim about external state that an authorization depends on, in a form that can be re-checked.

PlanTransaction.AssumptionSet and VerificationScope.Assumptions are []string — prose. Prose cannot go stale in any way a machine can detect, which is why ERR_ASSUMPTION_STALE was declared, given a conformance vector, and never emitted: nothing in the tree could express an assumption that is re-checkable.

The shape here is the staleness triple already specified by protocols/specs/observations/observation_artifact.v1.schema.json — captured_at, ttl_seconds, content_hash — which is when the world was observed, how long that observation is good for, and a digest of what was seen. That schema had no Go type. This is the subset an authorization gate needs; grounded selectors and viewport geometry stay in the schema until a GUI-action path needs them.

func (ObservedAssumption) Expired

func (a ObservedAssumption) Expired(now time.Time) bool

Expired reports whether the observation's validity window has closed at now. A zero TTL expires at capture, so an assumption carrying no window is never fresh rather than always fresh.

func (ObservedAssumption) ExpiresAt

func (a ObservedAssumption) ExpiresAt() time.Time

ExpiresAt is when the observation stops being usable.

func (*ObservedAssumption) Seal

func (a *ObservedAssumption) Seal() error

Seal computes AssumptionHash over the assumption with the field itself zeroed, matching the Seal idiom used across the harness contracts.

func (ObservedAssumption) Validate

func (a ObservedAssumption) Validate() error

Validate enforces the shape a re-check depends on.

type OpMapping

type OpMapping struct {
	// OpKind is the raw event kind this mapping handles.
	OpKind string

	// Category is the diff category for this op.
	Category DiffCategory

	// DefaultSeverity is the base severity (may be elevated by context).
	DefaultSeverity DiffSeverity

	// TitleTemplate is a Go-template for generating the title.
	// Available variables: .NodeRef, .Principal, .Before, .After
	TitleTemplate string

	// DescriptionTemplate is a Go-template for the description.
	DescriptionTemplate string
}

OpMapping maps a raw operations event kind to its human-readable diff template.

type PALReceiptRef

type PALReceiptRef struct {
	ReceiptID   string    `json:"receipt_id"`
	ProviderID  string    `json:"provider_id"`
	ModelID     string    `json:"model_id,omitempty"`
	InputHash   string    `json:"input_hash"`
	OutputHash  string    `json:"output_hash"`
	TokensIn    int       `json:"tokens_in,omitempty"`
	TokensOut   int       `json:"tokens_out,omitempty"`
	CompletedAt time.Time `json:"completed_at"`
}

PALReceiptRef references a PAL receipt.

type PackChannel

type PackChannel string

PackChannel controls where an installable add-on can be surfaced.

OSS recognizes every channel below as data, so any signed manifest round-trips unchanged whatever channel it names. Recognition is not installation: the OSS install runtime (core/pkg/packs/install) installs core and community packs only. Teams and enterprise are gated by commercial entitlement logic layered above, and individual is a legacy spelling retained for round-trip compatibility, not an install target.

const (
	PackChannelCore PackChannel = "core"
	// PackChannelIndividual is a legacy add-on manifest channel, distinct from
	// hosted account plan IDs. Keep it so existing signed manifests round-trip.
	PackChannelIndividual PackChannel = "individual"
	PackChannelCommunity  PackChannel = "community"
	PackChannelTeams      PackChannel = "teams"
	PackChannelEnterprise PackChannel = "enterprise"
)

type PackCheck

type PackCheck struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Command     string `json:"command,omitempty"`
}

PackCheck declares a deterministic install, smoke, or rollback check.

type PackExtensionPoint

type PackExtensionPoint string

PackExtensionPoint is a declared integration seam for installable packs.

const (
	PackExtensionRoute     PackExtensionPoint = "route"
	PackExtensionPanel     PackExtensionPoint = "panel"
	PackExtensionConnector PackExtensionPoint = "connector"
	PackExtensionJob       PackExtensionPoint = "job"
	PackExtensionSetting   PackExtensionPoint = "setting"
	PackExtensionPolicy    PackExtensionPoint = "policy"
	PackExtensionDocs      PackExtensionPoint = "docs"
)

type PackInstallPlan

type PackInstallPlan struct {
	PackID            string   `json:"pack_id"`
	Version           string   `json:"version"`
	Action            string   `json:"action,omitempty"`
	DryRun            bool     `json:"dry_run"`
	Eligible          bool     `json:"eligible"`
	RequiresUpgrade   bool     `json:"requires_upgrade,omitempty"`
	MinimumEdition    string   `json:"minimum_edition,omitempty"`
	CurrentVersion    string   `json:"current_version,omitempty"`
	Steps             []string `json:"steps"`
	MissingSecrets    []string `json:"missing_secrets,omitempty"`
	IneligibleReasons []string `json:"ineligible_reasons,omitempty"`
}

PackInstallPlan describes the canonical install flow before activation.

The Eligible flag reflects OSS-layer checks only (secrets present, installable channel, not revoked). Commercial callers layer additional gates (edition minimums, entitlement capabilities) on top of this plan.

type PackManifestV2

type PackManifestV2 struct {
	PackID          string               `json:"pack_id"`
	Name            string               `json:"name"`
	Version         string               `json:"version"`
	Channel         PackChannel          `json:"channel"`
	Summary         string               `json:"summary,omitempty"`
	Description     string               `json:"description,omitempty"`
	MinimumEdition  string               `json:"minimum_edition,omitempty"`
	ExtensionPoints []PackExtensionPoint `json:"extension_points,omitempty"`
	Dependencies    []string             `json:"dependencies,omitempty"`
	Permissions     []PackPermission     `json:"permissions,omitempty"`
	Secrets         []PackSecret         `json:"secrets,omitempty"`
	Migrations      []PackCheck          `json:"migrations,omitempty"`
	InstallChecks   []PackCheck          `json:"install_checks,omitempty"`
	SmokeTests      []PackCheck          `json:"smoke_tests,omitempty"`
	RollbackChecks  []PackCheck          `json:"rollback_checks,omitempty"`
	Docs            []string             `json:"docs,omitempty"`
	Signatures      []PackSignature      `json:"signatures,omitempty"`
}

PackManifestV2 is the canonical manifest for one-click installable HELM add-ons.

MinimumEdition is carried as a free-form string so OSS can round-trip manifests without depending on commercial Edition types. The OSS install runtime does not enforce edition gating; that belongs in the commercial entitlement layer that wraps this package.

type PackPermission

type PackPermission struct {
	ID            string `json:"id"`
	Justification string `json:"justification"`
}

PackPermission declares a runtime capability requested by a pack.

type PackSecret

type PackSecret struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
}

PackSecret declares a secret required during install or runtime.

type PackSignature

type PackSignature struct {
	SignerID  string    `json:"signer_id"`
	KeyID     string    `json:"key_id,omitempty"`
	Algorithm string    `json:"algorithm"`
	SignedAt  time.Time `json:"signed_at"`
	Signature string    `json:"signature"`
}

PackSignature attests to the integrity of a published pack.

type Parallelism

type Parallelism struct {
	MaxConcurrent int    `json:"max_concurrent,omitempty"`
	Strategy      string `json:"strategy,omitempty"` // sequential, parallel, adaptive
}

Parallelism defines execution concurrency.

type ParsedArtifact

type ParsedArtifact struct {
	ArtifactID   string `json:"artifact_id"`
	Type         string `json:"type"` // e.g., "file", "db_record", "api_response"
	Hash         string `json:"hash"`
	URIRef       string `json:"uri_ref,omitempty"`       // Where to find it
	Inlinedigest string `json:"inline_digest,omitempty"` // Small data can be inlined
}

ParsedArtifact represents a hashable bundle of data produced or used.

type PermissionScope

type PermissionScope struct {
	Resource  string `json:"resource"`            // resource type
	Action    string `json:"action"`              // e.g. "read", "write", "execute", "approve"
	Condition string `json:"condition,omitempty"` // optional CEL expression
}

PermissionScope defines the boundary of a permission grant.

type PhenotypeBinding

type PhenotypeBinding struct {
	PhenotypeID  string            `json:"phenotype_id"`
	WorkerType   string            `json:"worker_type"` // "AGENT", "HUMAN", "SERVICE"
	WorkerID     string            `json:"worker_id"`
	Capabilities []string          `json:"capabilities"`
	Constraints  map[string]string `json:"constraints,omitempty"`
	Priority     int               `json:"priority"`
	ContentHash  string            `json:"content_hash"`
}

PhenotypeBinding maps a phenotype to a worker specification.

func NewPhenotypeBinding

func NewPhenotypeBinding(phenotypeID, workerType, workerID string, capabilities []string) *PhenotypeBinding

NewPhenotypeBinding creates a binding with hash.

type PhenotypeConstraint

type PhenotypeConstraint struct {
	ConstraintID string `json:"constraint_id"`
	Type         string `json:"type"` // "MAX_COST", "MAX_TIME", "REQUIRED_APPROVAL", "REGION_LOCK", "TOOL_LIMIT"
	Value        string `json:"value"`
	Enforcement  string `json:"enforcement"` // "HARD" (fail-closed), "SOFT" (warn + log)
}

PhenotypeConstraint is a single constraint on phenotype execution.

type PhenotypeContract

type PhenotypeContract struct {
	PhenotypeID     string                `json:"phenotype_id"`
	Name            string                `json:"name"`
	Version         string                `json:"version"`
	Description     string                `json:"description,omitempty"`
	AllowedTools    []string              `json:"allowed_tools"`
	BlockedTools    []string              `json:"blocked_tools,omitempty"`
	EffectBudget    PhenotypeEffectBudget `json:"effect_budget"`
	Constraints     []PhenotypeConstraint `json:"constraints"`
	EscalationRules []EscalationRule      `json:"escalation_rules,omitempty"`
	TTL             *time.Duration        `json:"ttl,omitempty"`
	RequiresReview  bool                  `json:"requires_review"`
}

PhenotypeContract defines the operational behavior and constraints of a phenotype — a concrete instantiation of organizational execution.

type PhenotypeEffectBudget

type PhenotypeEffectBudget struct {
	MaxTotalEffects  int   `json:"max_total_effects"`
	MaxCostCents     int64 `json:"max_cost_cents"`
	MaxExternalCalls int   `json:"max_external_calls"`
	MaxDurationSecs  int   `json:"max_duration_seconds"`
}

PhenotypeEffectBudget limits cumulative effects produced by a phenotype.

type PhenotypeFixture

type PhenotypeFixture struct {
	FixtureID     string         `json:"fixture_id"`
	PhenotypeID   string         `json:"phenotype_id"`
	Description   string         `json:"description"`
	Input         map[string]any `json:"input"`
	ExpectedTools []string       `json:"expected_tools"`
	ExpectedDeny  bool           `json:"expected_deny"`
	MaxCostCents  int64          `json:"max_cost_cents"`
	Tags          []string       `json:"tags,omitempty"`
}

PhenotypeFixture is a test case for validating phenotype behavior.

type PhenotypeWorkerBinding

type PhenotypeWorkerBinding struct {
	BindingID   string    `json:"binding_id"`
	PhenotypeID string    `json:"phenotype_id"`
	WorkerID    string    `json:"worker_id"`
	EnforcedAt  time.Time `json:"enforced_at"`
	Active      bool      `json:"active"`
}

PhenotypeWorkerBinding binds a phenotype contract to a worker execution scope.

type PlanArtifactRef

type PlanArtifactRef struct {
	Rel  string `json:"rel"`
	Hash string `json:"hash"`
	URI  string `json:"uri,omitempty"`
}

PlanArtifactRef points to external resources in a plan.

type PlanSpec

type PlanSpec struct {
	ID          string    `json:"id"`
	Version     string    `json:"version"`
	Name        string    `json:"name,omitempty"`
	GenericDesc string    `json:"description,omitempty"` // "description"
	Hash        string    `json:"hash"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	Lineage     *Lineage  `json:"lineage,omitempty"`

	// DAG Structure
	DAG *DAG `json:"dag"`

	// Legacy Support (deprecated in schema, but present)
	Steps []PlanStep `json:"steps,omitempty"`

	Parallelism       *Parallelism       `json:"parallelism,omitempty"`
	ArtifactRefs      []PlanArtifactRef  `json:"artifact_refs,omitempty"`
	PolicyConstraints *PolicyConstraints `json:"policy_constraints,omitempty"`

	// Truth Discipline — plan-level epistemic metadata.
	Truth       *TruthAnnotation `json:"truth,omitempty"`
	Transaction *PlanTransaction `json:"transaction,omitempty"`
}

PlanSpec represents an execution plan as a contract. It matches schemas/orchestration/PlanSpec.v2.json

type PlanStep

type PlanStep struct {
	ID                 string         `json:"id"`
	Description        string         `json:"description,omitempty"`
	EffectType         string         `json:"effect_type"`
	Params             map[string]any `json:"params,omitempty"`
	Dependencies       []string       `json:"dependencies,omitempty"` // Legacy
	RequiredTools      []string       `json:"required_tools,omitempty"`
	Assumptions        []string       `json:"assumptions,omitempty"`
	AcceptanceCriteria []string       `json:"acceptance_criteria"`
	CheckpointBefore   bool           `json:"checkpoint_before,omitempty"`
	CheckpointAfter    bool           `json:"checkpoint_after,omitempty"`
	RollbackOnFailure  bool           `json:"rollback_on_failure,omitempty"`

	// Truth Discipline — epistemic metadata per HitCC discipline.
	Justification     string    `json:"justification,omitempty"`
	FactSet           []FactRef `json:"fact_set,omitempty"`
	Unknowns          []Unknown `json:"unknowns,omitempty"`
	Confidence        float64   `json:"confidence,omitempty"`
	EvidenceRefs      []string  `json:"evidence_refs,omitempty"`
	BlockingQuestions []string  `json:"blocking_questions,omitempty"`

	// Execution Binding — sandbox profile assignment.
	RequestedBackend string `json:"requested_backend,omitempty"` // "docker", "wasi", "native"
	RequestedProfile string `json:"requested_profile,omitempty"` // sandbox profile name
}

PlanStep represents a single node in the execution graph.

type PlanTransaction

type PlanTransaction struct {
	PlanTransactionID string `json:"plan_transaction_id,omitempty"`
	// ReceiptRefs explicitly bind this transaction to issued receipts. They
	// remain optional so historical plans can still be loaded.
	ReceiptRefs                  []string        `json:"receipt_refs,omitempty"`
	PlanHash                     string          `json:"plan_hash,omitempty"`
	ReadSet                      []string        `json:"read_set,omitempty"`
	WriteSet                     []string        `json:"write_set,omitempty"`
	AssumptionSet                []string        `json:"assumption_set,omitempty"`
	VersionDependencies          []string        `json:"version_dependencies,omitempty"`
	VerificationObligations      []string        `json:"verification_obligations,omitempty"`
	ConflictPolicy               string          `json:"conflict_policy,omitempty"`
	RollbackPolicy               json.RawMessage `json:"rollback_policy,omitempty"`
	RollbackOrCompensationPolicy string          `json:"rollback_or_compensation_policy,omitempty"`
	ApprovalState                string          `json:"approval_state,omitempty"`
	HumanReviewState             string          `json:"human_review_state,omitempty"`
	TransactionHash              string          `json:"transaction_hash,omitempty"`
}

PlanTransaction records the read/write and verification contract for a plan.

func (PlanTransaction) Seal

func (PlanTransaction) Validate

func (t PlanTransaction) Validate() error

type PolicyBundle

type PolicyBundle struct {
	CompiledAt string   `json:"compiled_at"`
	Rules      []string `json:"rules"`
	Revision   string   `json:"revision"`
}

PolicyBundle represents a compiled set of policies.

type PolicyConstraints

type PolicyConstraints struct {
	RequiredApprovals  []string `json:"required_approvals,omitempty"`
	AllowedEffectTypes []string `json:"allowed_effect_types,omitempty"`
	MaxRetries         int      `json:"max_retries,omitempty"`
	TimeoutSeconds     int      `json:"timeout_seconds,omitempty"`
}

PolicyConstraints defines requirements for execution.

type PolicyDecision

type PolicyDecision struct {
	DecisionID string    `json:"decision_id"`
	Allowed    bool      `json:"allowed"`
	Reason     string    `json:"reason"`
	BundleRev  string    `json:"bundle_rev"`
	Timestamp  time.Time `json:"timestamp"`

	// Deprecated / Backwards Compat
	Allow         bool   `json:"allow,omitempty"`
	PhenotypeHash string `json:"phenotype_hash,omitempty"` // now top-level
	ID            string `json:"id,omitempty"`
}

PolicyDecision is a lightweight alias/compat struct.

type PolicyProof

type PolicyProof struct {
	Allowed      bool           `json:"allowed"`
	Reason       string         `json:"reason"`
	InputContext map[string]any `json:"input_context"`
	Metrics      map[string]any `json:"metrics"`
	Verdict      string         `json:"verdict"`
	Summary      string         `json:"summary"`
}

type PolicyRef

type PolicyRef struct {
	URI  string `json:"uri"`
	Hash string `json:"hash"`
}

PolicyRef is a reference to a policy artifacts.

type PortExposureEvent

type PortExposureEvent struct {
	Port         int       `json:"port"`
	Protocol     string    `json:"protocol"`                // "tcp", "udp"
	Direction    string    `json:"direction"`               // "inbound", "outbound"
	AllowedPeers []string  `json:"allowed_peers,omitempty"` // Permitted peer addresses
	StartedAt    time.Time `json:"started_at"`
	ClosedAt     time.Time `json:"closed_at,omitempty"`
}

PortExposureEvent records a port being exposed or accessed during sandbox execution.

type PortExposureRef

type PortExposureRef struct {
	EventID   string    `json:"event_id"`
	Hash      string    `json:"hash"`
	Port      int       `json:"port"`
	Source    string    `json:"source,omitempty"`
	StartedAt time.Time `json:"started_at"`
}

PortExposureRef references a port exposure event.

type Posture

type Posture string

Posture defines the execution mode for a session or workflow. Two-level model: Deployment Profile (HUDF) × Posture. Posture controls what classes of effects are permitted.

const (
	// PostureObserve is read-only. No ChangeSet commits, no secret access
	// except public configuration, connector reads only if explicitly permitted.
	PostureObserve Posture = "OBSERVE"

	// PostureDraft allows creating/editing ChangeSets, running validators
	// and simulations, requesting approvals. No external side effects.
	// Tools run only in dry-run/sandbox-only mode with egress denied.
	PostureDraft Posture = "DRAFT"

	// PostureTransact allows bounded effects (E1-E3) within budgets.
	// Requires pinned connector contracts, corridor allowlists, receipts on.
	// Approval required for escalations beyond posture caps.
	PostureTransact Posture = "TRANSACT"

	// PostureSovereign allows approving exceptions, modifying P0 ceilings,
	// irreversible effects (E4), rotating sensitive secrets, changing core
	// governance. Always produces high-grade evidence.
	PostureSovereign Posture = "SOVEREIGN"

	// PostureHighAssurance is the legacy commercial name for the highest
	// execution posture. Keep it as an alias so synced Enterprise packages
	// can consume current OSS contracts without weakening posture checks.
	PostureHighAssurance Posture = PostureSovereign
)

func AllPostures

func AllPostures() []Posture

AllPostures returns the ordered list of postures from least to most privileged.

func (Posture) CanEscalateTo

func (p Posture) CanEscalateTo(target Posture) bool

CanEscalateTo returns true if the current posture can escalate to the target.

type Projection

type Projection struct {
	Agent string `json:"agent"`
	Path  string `json:"path"`
}

type ProofCondensation

type ProofCondensation struct {
	// CheckpointInterval defines how often (in receipt count) checkpoints
	// are created. At each checkpoint, the kernel computes an incremental
	// Merkle root over accumulated receipts.
	CheckpointInterval int `json:"checkpoint_interval"`

	// RetentionPolicy maps risk tiers to retention behavior.
	RetentionPolicy []CondensationTierPolicy `json:"retention_policy"`
}

ProofCondensation represents the configuration and state of proof condensation for a session or workflow. Per ARCHITECTURE.md §5.2: Proof Condensation.

func DefaultCondensationPolicy

func DefaultCondensationPolicy() ProofCondensation

DefaultCondensationPolicy returns the default proof condensation policy with risk-tiered retention per ARCHITECTURE.md §5.2.

type ProofPack

type ProofPack struct {
	Type       ProofType      `json:"type"`
	Verdict    ProofVerdict   `json:"verdict"`
	Summary    string         `json:"summary"`
	Artifacts  []ArtifactRef  `json:"artifacts,omitempty"`
	Metrics    map[string]any `json:"metrics,omitempty"`
	InputsHash string         `json:"inputs_hash"`         // Hash of the proposal state used to generate this
	ProducedAt time.Time      `json:"produced_at"`         // Excluded from canonical hash
	Producer   string         `json:"producer"`            // Agent ID / Service Name
	Signature  string         `json:"signature,omitempty"` // Optional producer signature
}

ProofPack is a container for verifiable evidence.

type ProofType

type ProofType string

ProofType identifies the category of proof.

const (
	ProofTypeDeterminism ProofType = "DETERMINISM"
	ProofTypePolicy      ProofType = "POLICY"
	ProofTypeSim         ProofType = "SIMULATION"
	ProofTypeTest        ProofType = "TEST"
	ProofTypeVisual      ProofType = "VISUAL"
	ProofTypeHostileSim  ProofType = "HOSTILE_SIM"
	ProofTypeProvenance  ProofType = "PROVENANCE"
)

ProofType constants.

type ProofVerdict

type ProofVerdict string

ProofVerdict represents the outcome of a proof evaluation. Note: Court also has a Verdict concept, but this is specific to Evidence/Proofs.

const (
	ProofVerdictPass ProofVerdict = "PASS"
	ProofVerdictFail ProofVerdict = "FAIL"
	ProofVerdictWarn ProofVerdict = "WARN"
)

ProofVerdict constants.

type Proposal

type Proposal struct {
	ProposalID string `json:"proposal_id"`

	Kind       Kind        `json:"kind"`
	Intent     Intent      `json:"intent"`
	Scope      Scope       `json:"scope"`
	Invariants []Invariant `json:"invariants,omitempty"`

	Plan     ActionPlanRef `json:"plan"`
	Rollback string        `json:"rollback"` // Simplification: Strategy description or ref

	Proofs map[ProofType]ProofPack `json:"proofs,omitempty"`

	Provenance Provenance  `json:"provenance"`
	Signatures []Signature `json:"signatures,omitempty"`

	Status Status `json:"status"`
}

Proposal is the sovereign envelope for change.

type Provenance

type Provenance struct {
	RepoCommit      string `json:"repo_commit"`
	ToolFingerprint string `json:"tool_fingerprint"`
}

Provenance captures origin and tool context.

type RateLimit

type RateLimit struct {
	// Resource names what the limit applies to, or "*" for every effect.
	Resource string `json:"resource"`

	// MaxPerMinute caps reservations inside one UTC minute.
	MaxPerMinute int `json:"max_per_minute"`

	// MaxPerDay caps reservations inside one UTC calendar day.
	//
	// Optional and omitted when zero, so envelopes written before this field
	// existed hash and validate exactly as before.
	//
	// MaxPerDay may be lower than MaxPerMinute. That is a conservative policy,
	// not a contradiction: the minute window simply never binds first.
	MaxPerDay int `json:"max_per_day,omitempty"`

	// PerInstance gives every concrete instance of the resource its own
	// window instead of pooling them into one.
	//
	// This is what lets a fleet of like things share one declared ceiling: a
	// pool of outbound numbers is one rate limit at 125 dials per number per
	// day, not one limit per number. Rotating a number in or out of the pool
	// then changes no envelope field, so it does not invalidate a signed
	// envelope.
	//
	// An effect that names a per-instance resource without naming which
	// instance it consumes cannot be counted, and is denied rather than
	// admitted uncounted. PerInstance is meaningless on the wildcard resource
	// and is rejected there.
	PerInstance bool `json:"per_instance,omitempty"`
}

RateLimit constrains per-resource throughput inside bounded time windows.

A limit binds to a resource name. The reserved name "*" ("RateLimitResourceAny") matches every effect, which is how a single run-wide ceiling is expressed.

At least one window must be positive; a window left at zero is not "unlimited", it is "not declared". Windows are tumbling and anchored in UTC: the minute window resets on the minute, the day window resets at UTC midnight. When both are declared, MaxPerDay must be greater than or equal to MaxPerMinute — a day ceiling below the minute ceiling can never bind and is rejected as incoherent rather than silently ignored.

type ReasonCode

type ReasonCode string

ReasonCode is a typed, machine-readable reason for DENY/ESCALATE verdicts. These codes form a canonical registry analogous to HTTP status codes. Wire format: JSON string field "reason_code" in DecisionRecord.

const (
	// ── Policy Reasons ─────────────────────────────────────
	ReasonPolicyViolation    ReasonCode = "POLICY_VIOLATION"
	ReasonNoPolicy           ReasonCode = "NO_POLICY_DEFINED"
	ReasonPolicyNotReady     ReasonCode = "POLICY_NOT_READY"
	ReasonPolicyHashMismatch ReasonCode = "POLICY_HASH_MISMATCH"
	ReasonPolicySigInvalid   ReasonCode = "POLICY_SIGNATURE_INVALID"
	ReasonPolicyEpochChanged ReasonCode = "POLICY_EPOCH_CHANGED"
	ReasonPRGEvalError       ReasonCode = "PRG_EVALUATION_ERROR"
	ReasonMissingRequirement ReasonCode = "MISSING_REQUIREMENT"

	// ── PDP Reasons ────────────────────────────────────────
	ReasonPDPDeny  ReasonCode = "PDP_DENY"
	ReasonPDPError ReasonCode = "PDP_ERROR"

	// ── Resource Reasons ───────────────────────────────────
	ReasonBudgetExceeded ReasonCode = "BUDGET_EXCEEDED"
	ReasonBudgetError    ReasonCode = "BUDGET_ERROR"

	// ── Envelope / Schema Reasons ──────────────────────────
	ReasonEnvelopeInvalid ReasonCode = "ENVELOPE_INVALID"
	ReasonSchemaViolation ReasonCode = "SCHEMA_VIOLATION"

	// ── Temporal Reasons ───────────────────────────────────
	ReasonTemporalIntervene ReasonCode = "TEMPORAL_INTERVENTION"
	ReasonTemporalThrottle  ReasonCode = "TEMPORAL_THROTTLE"
	ReasonSessionRiskDeny   ReasonCode = "SESSION_RISK_MEMORY_DENY"

	// ── Security Reasons ───────────────────────────────────
	ReasonSandboxViolation ReasonCode = "SANDBOX_VIOLATION"
	ReasonProvenance       ReasonCode = "PROVENANCE_FAILURE"
	ReasonVerification     ReasonCode = "VERIFICATION_FAILURE"

	// ── Tenancy / Jurisdiction Reasons ─────────────────────
	ReasonTenantIsolation ReasonCode = "TENANT_ISOLATION"
	ReasonJurisdiction    ReasonCode = "JURISDICTION_VIOLATION"

	// ── Operations / Environment / Approval Reasons ────────
	ReasonSystemFrozen               ReasonCode = "SYSTEM_FROZEN"
	ReasonEmergencyStopFenced        ReasonCode = "EMERGENCY_STOP_FENCED"
	ReasonEmergencyStopUnverified    ReasonCode = "EMERGENCY_STOP_UNVERIFIED"
	ReasonEmergencyStopScopeRequired ReasonCode = "EMERGENCY_STOP_SCOPE_REQUIRED"
	ReasonContextMismatch            ReasonCode = "CONTEXT_MISMATCH"
	ReasonDataEgressBlocked          ReasonCode = "DATA_EGRESS_BLOCKED"
	ReasonIdentityIsolationViolation ReasonCode = "IDENTITY_ISOLATION_VIOLATION"
	ReasonApprovalRequired           ReasonCode = "APPROVAL_REQUIRED" // Maps to canonical ESCALATE workflow
	ReasonApprovalTimeout            ReasonCode = "APPROVAL_TIMEOUT"

	// ── Delegation Reasons (v1.3) ───────────────────────────
	ReasonDelegationInvalid           ReasonCode = "DELEGATION_INVALID"
	ReasonDelegationScopeViolation    ReasonCode = "DELEGATION_SCOPE_VIOLATION"
	ReasonDelegationPrincipalMismatch ReasonCode = "DELEGATION_PRINCIPAL_MISMATCH"

	// ── Privilege Tier Reasons ──────────────
	ReasonInsufficientPrivilege ReasonCode = "INSUFFICIENT_PRIVILEGE"

	// ── Agent Lifecycle Reasons ────────────────────────────
	ReasonAgentKilled ReasonCode = "AGENT_KILLED"

	// ── Threat Signal Reasons (v1.2) ───────────────────────
	ReasonTaintedInputDeny           ReasonCode = "TAINTED_INPUT_HIGH_RISK_DENY"
	ReasonPromptInjectionDetected    ReasonCode = "PROMPT_INJECTION_DETECTED"
	ReasonUnicodeObfuscationDetected ReasonCode = "UNICODE_OBFUSCATION_DETECTED"
	ReasonTaintedCredentialDeny      ReasonCode = "TAINTED_CREDENTIAL_ACCESS_DENY"
	ReasonTaintedPublishDeny         ReasonCode = "TAINTED_SOFTWARE_PUBLISH_DENY"
	ReasonTaintedInvokeDeny          ReasonCode = "TAINTED_PRIVILEGED_INVOKE_DENY"
	ReasonTaintedEgressDeny          ReasonCode = "TAINTED_DATA_EGRESS_DENY"
	ReasonTaintedEscalate            ReasonCode = "TAINTED_HIGH_RISK_ESCALATE"
	ReasonSemanticThreatEscalate     ReasonCode = "SEMANTIC_THREAT_REVIEW_REQUIRED"

	// ── TON / Acton Connector Reasons (v1.3) ──────────────────
	ReasonTONActonUnknownCommand             ReasonCode = "ERR_TON_ACTON_UNKNOWN_COMMAND"
	ReasonTONActonUnsupportedVersion         ReasonCode = "ERR_TON_ACTON_UNSUPPORTED_VERSION"
	ReasonTONTolkCompilerUnpinned            ReasonCode = "ERR_TON_TOLK_COMPILER_UNPINNED"
	ReasonTONTolkCompilerMismatch            ReasonCode = "ERR_TON_TOLK_COMPILER_MISMATCH"
	ReasonTONActonArgvRejected               ReasonCode = "ERR_TON_ACTON_ARGV_REJECTED"
	ReasonTONActonRawShellForbidden          ReasonCode = "ERR_TON_ACTON_RAW_SHELL_FORBIDDEN"
	ReasonTONActonGenericMainnetScriptDenied ReasonCode = "ERR_TON_ACTON_GENERIC_MAINNET_SCRIPT_DENIED"
	ReasonTONScriptManifestRequired          ReasonCode = "ERR_TON_SCRIPT_MANIFEST_REQUIRED"
	ReasonTONScriptManifestHashMismatch      ReasonCode = "ERR_TON_SCRIPT_MANIFEST_HASH_MISMATCH"
	ReasonTONExpectedEffectMismatch          ReasonCode = "ERR_TON_EXPECTED_EFFECT_MISMATCH"
	ReasonTONSpendCeilingExceeded            ReasonCode = "ERR_TON_SPEND_CEILING_EXCEEDED"
	ReasonTONMainnetRequiresApproval         ReasonCode = "ERR_TON_MAINNET_REQUIRES_APPROVAL"
	ReasonTONApprovalCeremonyRequired        ReasonCode = "ERR_TON_APPROVAL_CEREMONY_REQUIRED"
	ReasonTONWalletRefRequired               ReasonCode = "ERR_TON_WALLET_REF_REQUIRED"
	ReasonTONPlaintextMnemonicForbidden      ReasonCode = "ERR_TON_PLAINTEXT_MNEMONIC_FORBIDDEN"
	ReasonTONNetworkGrantRequired            ReasonCode = "ERR_TON_NETWORK_GRANT_REQUIRED"
	ReasonTONSandboxGrantRequired            ReasonCode = "ERR_TON_SANDBOX_GRANT_REQUIRED"
	ReasonTONSourceVerificationRequired      ReasonCode = "ERR_TON_SOURCE_VERIFICATION_REQUIRED"
	ReasonTONVerifyDryRunRequired            ReasonCode = "ERR_TON_VERIFY_DRY_RUN_REQUIRED"
	ReasonTONVerifyBytecodeMismatch          ReasonCode = "ERR_TON_VERIFY_BYTECODE_MISMATCH"
	ReasonTONCoverageThresholdFailed         ReasonCode = "ERR_TON_COVERAGE_THRESHOLD_FAILED"
	ReasonTONMutationThresholdFailed         ReasonCode = "ERR_TON_MUTATION_THRESHOLD_FAILED"
	ReasonTONLibraryMainnetRequiresApproval  ReasonCode = "ERR_TON_LIBRARY_MAINNET_REQUIRES_APPROVAL"
	ReasonTONLibrarySpendCeilingExceeded     ReasonCode = "ERR_TON_LIBRARY_SPEND_CEILING_EXCEEDED"
	ReasonConnectorContractDrift             ReasonCode = "ERR_CONNECTOR_CONTRACT_DRIFT"
	ReasonComputeGasExhausted                ReasonCode = "ERR_COMPUTE_GAS_EXHAUSTED"
	ReasonComputeTimeExhausted               ReasonCode = "ERR_COMPUTE_TIME_EXHAUSTED"

	// ── Harness Engineering Reasons (v1.4) ─────────────────────
	ReasonVerificationScopeRequired       ReasonCode = "ERR_VERIFICATION_SCOPE_REQUIRED"
	ReasonHarnessTraceRequired            ReasonCode = "ERR_HARNESS_TRACE_REQUIRED"
	ReasonPlanTransactionRequired         ReasonCode = "ERR_PLAN_TRANSACTION_REQUIRED"
	ReasonPlanTransactionConflict         ReasonCode = "ERR_PLAN_TRANSACTION_CONFLICT"
	ReasonAssumptionStale                 ReasonCode = "ERR_ASSUMPTION_STALE"
	ReasonHarnessMutationRequiresApproval ReasonCode = "ERR_HARNESS_MUTATION_REQUIRES_APPROVAL"
	ReasonHarnessChangeContractInvalid    ReasonCode = "ERR_HARNESS_CHANGE_CONTRACT_INVALID"
	ReasonGreenTestScopeMissing           ReasonCode = "ERR_GREEN_TEST_SCOPE_MISSING"
	ReasonGroundedActionRefRequired       ReasonCode = "ERR_GROUNDED_ACTION_REF_REQUIRED"
	ReasonGUIPostconditionUnverified      ReasonCode = "ERR_GUI_POSTCONDITION_UNVERIFIED"

	// ── Host Evidence / Boundary Drift Reasons (v1.6) ─────────────────────
	ReasonHostEgressWithoutIntent        ReasonCode = "ERR_HOST_EGRESS_WITHOUT_INTENT"
	ReasonHostEgressAfterDeny            ReasonCode = "ERR_HOST_EGRESS_AFTER_DENY"
	ReasonHostReceiptMissing             ReasonCode = "ERR_HOST_RECEIPT_MISSING"
	ReasonHostDestinationMismatch        ReasonCode = "ERR_HOST_DESTINATION_MISMATCH"
	ReasonHostVolumeExceeded             ReasonCode = "ERR_HOST_VOLUME_EXCEEDED"
	ReasonHostProcessUnbound             ReasonCode = "ERR_HOST_PROCESS_UNBOUND"
	ReasonPolicyDeniedHostObservedEgress ReasonCode = "ERR_POLICY_DENIED_BUT_HOST_OBSERVED_EGRESS"

	// ── Safe Deprecation / Emergency Release Reasons ─────────────────────
	ReasonSafeDepTerminalFreeze     ReasonCode = "SAFEDEP_TERMINAL_FREEZE"
	ReasonSafeDepDegradedNarrowing  ReasonCode = "SAFEDEP_DEGRADED_NARROWING"
	ReasonSafeDepDeprecatedReadonly ReasonCode = "SAFEDEP_DEPRECATED_READONLY"
	ReasonContinuityStale           ReasonCode = "ERR_CONTINUITY_STALE"
	ReasonEmergencyCapsuleInvalid   ReasonCode = "ERR_EMERGENCY_CAPSULE_INVALID"
	ReasonHardwareQuorumUnbound     ReasonCode = "ERR_HARDWARE_QUORUM_UNBOUND"
	ReasonAttestationResultRequired ReasonCode = "ERR_ATTESTATION_RESULT_REQUIRED"
	ReasonDevFallbackPresent        ReasonCode = "ERR_DEV_FALLBACK_PRESENT"

	// ── Capability Registry Reasons (capability-manifest/v1) ──────────────
	ReasonCapabilityUnknown             ReasonCode = "CAPABILITY_UNKNOWN"
	ReasonCapabilityManifestDrift       ReasonCode = "CAPABILITY_MANIFEST_DRIFT"
	ReasonCapabilityTokenInvalid        ReasonCode = "CAPABILITY_TOKEN_INVALID"
	ReasonCapabilityRollbackPlanInvalid ReasonCode = "CAPABILITY_ROLLBACK_PLAN_INVALID"
	ReasonCapabilityIrreversible        ReasonCode = "CAPABILITY_IRREVERSIBLE"
)

func CoreReasonCodes

func CoreReasonCodes() []ReasonCode

CoreReasonCodes returns the full normative core reason-code registry.

type Receipt

type Receipt struct {
	ReceiptID  string `json:"receipt_id"`
	DecisionID string `json:"decision_id"`
	// CorrelationID is the product request identity (X-Helm-Correlation-ID)
	// this receipt belongs to — the stable join key across lifecycle events,
	// decisions, and evidence (pilot business-telemetry contract §2).
	// NOTE: not covered by the receipt signature until HELM-303 resolves the
	// signing-scope decision; treat as a recorded claim, not signed evidence.
	CorrelationID       string            `json:"correlation_id,omitempty"`
	EffectID            string            `json:"effect_id"`
	ExternalReferenceID string            `json:"external_reference_id"`
	Status              string            `json:"status"`
	BlobHash            string            `json:"blob_hash,omitempty"`   // Link to Input Snapshot CAS
	OutputHash          string            `json:"output_hash,omitempty"` // Link to Tool Output CAS
	Timestamp           time.Time         `json:"timestamp"`
	ExecutorID          string            `json:"executor_id,omitempty"`
	Metadata            map[string]any    `json:"metadata,omitempty"`
	Signature           string            `json:"signature,omitempty"` // Cryptographic proof of execution
	SignatureProfile    string            `json:"signature_profile,omitempty"`
	SignatureAlgorithm  string            `json:"signature_algorithm,omitempty"`
	KeyID               string            `json:"key_id,omitempty"`
	PublicKeySet        map[string]string `json:"public_key_set,omitempty"`
	// V2: Tamper-Evidence
	MerkleRoot        string             `json:"merkle_root,omitempty"`
	WitnessSignatures []WitnessSignature `json:"witness_signatures,omitempty"`

	// V3: Causal chain – ProofGraph DAG
	PrevHash     string `json:"prev_hash"`           // SHA-256 of the previous canonical signed receipt envelope
	LamportClock uint64 `json:"lamport_clock"`       // Monotonic logical clock per session
	ArgsHash     string `json:"args_hash,omitempty"` // SHA-256 of JCS-canonicalized tool args bound at the PEP boundary

	// SignatureVersion names the signing-preimage revision this receipt's
	// Signature was computed over (HELM-303). Empty = the legacy V4 preimage
	// (receipt_id, decision_id, effect_id, status, output_hash, prev_hash,
	// lamport, args_hash). ReceiptSignatureV5 additionally binds verdict,
	// reason_code, policy_hash and session_id, so the governance meaning of a
	// receipt can no longer be rewritten without invalidating its signature.
	SignatureVersion string `json:"signature_version,omitempty"`

	// Receipt-as-First-Class Artifact Extensions
	ReplayScript     *ReplayScriptRef   `json:"replay_script,omitempty"`     // Link to deterministic replay script
	Provenance       *ReceiptProvenance `json:"provenance,omitempty"`        // Chain of custody
	BundledArtifacts []ParsedArtifact   `json:"bundled_artifacts,omitempty"` // Hashable bundles of related artifacts

	// V4: Inference Telemetry (Local Inference Gateway)
	GatewayID      string `json:"gateway_id,omitempty"`      // Node identity of the serving LIG
	RuntimeType    string `json:"runtime_type,omitempty"`    // e.g. "ollama", "vllm"
	RuntimeVersion string `json:"runtime_version,omitempty"` // Exact semver of the inference engine
	ModelHash      string `json:"model_hash,omitempty"`      // SHA-256 snapshot of the loaded weights

	// V5: Execution Plane — sandbox and evidence enrichment
	NetworkLogRef     string              `json:"network_log_ref,omitempty"`      // Reference to network activity log
	SecretEventsRef   string              `json:"secret_events_ref,omitempty"`    // Reference to secret access audit log
	PortExposures     []PortExposureEvent `json:"port_exposures,omitempty"`       // Port exposure events during execution
	SandboxLeaseID    string              `json:"sandbox_lease_id,omitempty"`     // Execution lease that governed this receipt
	EffectGraphNodeID string              `json:"effect_graph_node_id,omitempty"` // Which DAG node produced this receipt

	// Unified Sub-package Compatibility Fields
	Type             string            `json:"type,omitempty"`
	LaunchID         string            `json:"launch_id,omitempty"`
	DecisionHash     string            `json:"decision_hash,omitempty"`
	Verdict          string            `json:"verdict,omitempty"`
	Subject          any               `json:"subject,omitempty"`
	CreatedAt        time.Time         `json:"created_at,omitempty"`
	Hash             string            `json:"hash,omitempty"`
	PackID           string            `json:"pack_id,omitempty"`
	PackName         string            `json:"pack_name,omitempty"`
	PackVersion      string            `json:"pack_version,omitempty"`
	PackHash         string            `json:"pack_hash,omitempty"`
	Action           string            `json:"action,omitempty"`
	InstalledBy      string            `json:"installed_by,omitempty"`
	InstalledAt      time.Time         `json:"installed_at,omitempty"`
	PrevReceiptID    string            `json:"prev_receipt_id,omitempty"`
	ContentHash      string            `json:"content_hash,omitempty"`
	ID               string            `json:"id,omitempty"`
	RiskTier         RiskTier          `json:"risk_tier,omitempty"`
	EffectType       string            `json:"effect_type,omitempty"`
	ToolFingerprint  string            `json:"tool_fingerprint,omitempty"`
	Evidence         map[string]string `json:"evidence,omitempty"`
	RetryCount       int               `json:"retry_count,omitempty"`
	IdempotencyKey   string            `json:"idempotency_key,omitempty"`
	ToolName         string            `json:"tool_name,omitempty"`
	ReasonCode       string            `json:"reason_code,omitempty"`
	SkillID          string            `json:"skill_id,omitempty"`
	SkillContentHash string            `json:"skill_content_hash,omitempty"`
	PolicyHash       string            `json:"policy_hash,omitempty"`
	ProjectionPaths  []Projection      `json:"projection_paths,omitempty"`
	Direction        string            `json:"direction,omitempty"`
	Counterparty     string            `json:"counterparty,omitempty"`
	SessionID        string            `json:"session_id,omitempty"`
	ScopeHash        string            `json:"scope_hash,omitempty"`
	IssuedAt         time.Time         `json:"issued_at,omitempty"`

	// Safe Deprecation Mode emergency authority bindings.
	EmergencyActivationID        string `json:"emergency_activation_id,omitempty"`
	EmergencyDelegationSessionID string `json:"emergency_delegation_session_id,omitempty"`
	EmergencyScopeHash           string `json:"emergency_scope_hash,omitempty"`
	SafeDepState                 string `json:"safe_dep_state,omitempty"`
	SafeDepReasonCode            string `json:"safe_dep_reason_code,omitempty"`

	// Receipt Transparency Log (RFC 6962) anchoring. Populated when the
	// receipt hash is appended to the append-only transparency log during
	// issuance. LogID and LeafIndex identify the leaf; Transparency carries
	// the log backend identity for verifiers.
	Transparency *TransparencyAnchor `json:"transparency,omitempty"`
	LogID        string              `json:"log_id,omitempty"`
	LeafIndex    uint64              `json:"leaf_index,omitempty"`
}

Receipt represents a proof of effect execution, linked to a decision.

func (Receipt) MarshalJSON

func (r Receipt) MarshalJSON() ([]byte, error)

MarshalJSON preserves the legacy receipt wire format while making a declared receipt.v5 self-contained for offline verification. The V5 preimage includes the fields overridden by receiptV5JSON even when their signed value is empty.

type ReceiptProvenance

type ReceiptProvenance struct {
	GeneratedBy string    `json:"generated_by"` // Agent/Component ID
	GeneratedAt time.Time `json:"generated_at"`
	Context     string    `json:"context"`           // e.g., "production", "simulation"
	Parents     []string  `json:"parents,omitempty"` // Parent Receipt IDs used as input
}

ReceiptProvenance tracks the origin and chain of custody for the receipt.

type ReceiptSink

type ReceiptSink interface {
	SubmitReceipt(ctx context.Context, receipt Receipt) error
}

ReceiptSink defines an interface for components that accept receipts.

type ReconciliationReport

type ReconciliationReport struct {
	Healthy         bool     `json:"healthy"`
	MissingReceipts []string `json:"missing_receipts"`
	OrphanReceipts  []string `json:"orphan_receipts"`
	Mismatches      []string `json:"mismatches"`
}

ReconciliationReport contains reconciliation findings.

type RedirectPolicy

type RedirectPolicy struct {
	// MaxRedirects is the maximum number of redirects to follow (0 = none).
	MaxRedirects int `json:"max_redirects"`

	// AllowCrossOrigin allows redirects to different origins.
	AllowCrossOrigin bool `json:"allow_cross_origin"`

	// AllowHTTPDowngrade allows redirects from HTTPS to HTTP.
	AllowHTTPDowngrade bool `json:"allow_http_downgrade"`
}

RedirectPolicy controls HTTP redirect behavior within a corridor.

type ReflexAction

type ReflexAction struct {
	// Kind is the type of reflex action.
	Kind ReflexKind `json:"kind"`

	// Trigger describes why this action was emitted.
	Trigger ReflexTrigger `json:"trigger"`

	// TargetGlobalMode is the GlobalMode to transition to (for Freeze/Island).
	// Empty if the reflex does not change global mode.
	TargetGlobalMode GlobalMode `json:"target_global_mode,omitempty"`

	// TargetRunID is the specific run to act on (for Rollback/VelocityCap).
	// Empty if the reflex targets the global state.
	TargetRunID string `json:"target_run_id,omitempty"`

	// Description is a human-readable explanation of the action.
	Description string `json:"description"`
}

ReflexAction represents a deterministic corrective action emitted by the reflex evaluator.

func EvaluateReflexes

func EvaluateReflexes(state *GlobalAutonomyState, thresholds ReflexThresholds) []ReflexAction

EvaluateReflexes inspects the current GlobalAutonomyState and returns any reflex actions that should fire. This function is stateless and deterministic — the same state always produces the same actions.

The caller is responsible for applying the actions and generating receipts.

type ReflexKind

type ReflexKind string

ReflexKind classifies the type of autonomous corrective action.

const (
	// ReflexFreeze halts all new runs and pauses in-flight runs.
	ReflexFreeze ReflexKind = "FREEZE"

	// ReflexIsland disconnects from external connectors (network isolation).
	ReflexIsland ReflexKind = "ISLAND"

	// ReflexRollback reverts the last effect of a failed verification.
	ReflexRollback ReflexKind = "ROLLBACK"

	// ReflexVelocityCap limits the rate of new run creation.
	ReflexVelocityCap ReflexKind = "VELOCITY_CAP"

	// ReflexIncidentContain restricts operations to P0 incident response only.
	ReflexIncidentContain ReflexKind = "INCIDENT_CONTAIN"
)

func AllReflexKinds

func AllReflexKinds() []ReflexKind

AllReflexKinds returns all defined reflex kinds in severity order (most severe first).

type ReflexReceipt

type ReflexReceipt struct {
	// ID is a stable unique identifier for this receipt.
	ID string `json:"id"`

	// Action is the reflex action that was evaluated.
	Action ReflexAction `json:"action"`

	// Applied indicates whether the action was actually applied.
	// False if the action was suppressed by policy or posture.
	Applied bool `json:"applied"`

	// SuppressedReason explains why the action was not applied (if Applied == false).
	SuppressedReason string `json:"suppressed_reason,omitempty"`

	// EvaluatedAt is when the reflex evaluation occurred.
	EvaluatedAt time.Time `json:"evaluated_at"`

	// OrgID is the organization this receipt belongs to.
	OrgID string `json:"org_id"`
}

ReflexReceipt is an immutable record that a reflex action was evaluated and (optionally) applied. Receipts are visible in Ops and anchor to the causal chain.

type ReflexThresholds

type ReflexThresholds struct {
	// CriticalRiskAutoFreeze: if true, CRITICAL risk auto-triggers FREEZE.
	CriticalRiskAutoFreeze bool `json:"critical_risk_auto_freeze"`

	// AnomalyCountIsland: number of anomalies that triggers ISLAND.
	// 0 = disabled.
	AnomalyCountIsland int `json:"anomaly_count_island"`

	// BlockedRunVelocityCap: number of blocked runs that triggers VELOCITY_CAP.
	// 0 = disabled.
	BlockedRunVelocityCap int `json:"blocked_run_velocity_cap"`

	// FailedVerificationRollback: if true, a run in FAILED stage triggers ROLLBACK.
	FailedVerificationRollback bool `json:"failed_verification_rollback"`

	// BudgetExhaustedFreeze: if true, exhausted budget triggers FREEZE.
	BudgetExhaustedFreeze bool `json:"budget_exhausted_freeze"`
}

ReflexThresholds configures the trigger points for each reflex type.

func DefaultReflexThresholds

func DefaultReflexThresholds() ReflexThresholds

DefaultReflexThresholds returns production-grade defaults.

type ReflexTrigger

type ReflexTrigger struct {
	// Condition is a human-readable description of what triggered the reflex.
	Condition string `json:"condition"`

	// Metric is the quantitative value that exceeded the threshold (if applicable).
	Metric float64 `json:"metric,omitempty"`

	// Threshold is the configured threshold that was breached.
	Threshold float64 `json:"threshold,omitempty"`

	// SourceRunID is the run that caused the trigger (if applicable).
	SourceRunID string `json:"source_run_id,omitempty"`
}

ReflexTrigger describes the condition that caused a reflex to fire.

type ReplayBundle

type ReplayBundle struct {
	ProposalID    string       `json:"proposal_id"`
	PhenotypeHash string       `json:"phenotype_hash"`
	PolicyProof   *PolicyProof `json:"policy_proof"`
}

type ReplayManifestRef

type ReplayManifestRef struct {
	ManifestID string `json:"manifest_id"`
	Hash       string `json:"hash"`
	Mode       string `json:"mode"` // "dry", "bounded", "full"
}

ReplayManifestRef references the replay manifest for reconstructing this run.

type ReplayScriptRef

type ReplayScriptRef struct {
	ScriptID   string `json:"script_id"`
	ScriptHash string `json:"script_hash"`
	Engine     string `json:"engine"` // e.g., "governance-v1", "frontier-adapter-v1"
	Entrypoint string `json:"entrypoint"`
}

ReplayScriptRef points to the script that can reproduce this receipt's effect.

type RequestShaping

type RequestShaping struct {
	// MaxRequestBytes is the maximum request body size.
	MaxRequestBytes int64 `json:"max_request_bytes"`

	// MaxResponseBytes is the maximum response body size.
	MaxResponseBytes int64 `json:"max_response_bytes"`

	// TimeoutSeconds is the per-request timeout.
	TimeoutSeconds int `json:"timeout_seconds"`

	// MaxRetries is the maximum number of retries.
	MaxRetries int `json:"max_retries"`

	// RequiredHeaders are headers that must be present on every request.
	RequiredHeaders map[string]string `json:"required_headers,omitempty"`

	// ForbiddenHeaders are headers that must NOT be present.
	ForbiddenHeaders []string `json:"forbidden_headers,omitempty"`
}

RequestShaping controls request-level constraints within a corridor.

type ResourceCost

type ResourceCost struct {
	Compute      float64 `json:"compute"`
	ComputeUnits float64 `json:"compute_units"` // Alias
	StorageBytes int64   `json:"storage_bytes"`
	NetworkBytes int64   `json:"network_bytes"`
	Money        float64 `json:"money,omitempty"`  // Legacy field
	Amount       float64 `json:"amount,omitempty"` // Legacy wrapper
	Currency     string  `json:"currency,omitempty"`

	// Legacy
	Time     time.Duration `json:"time,omitempty"`
	APIQuota int           `json:"api_quota,omitempty"`
}

ResourceCost defines the cost of an operation.

type ResourceDef

type ResourceDef struct {
	Name   string `json:"name"`
	Schema string `json:"schema"` // JSON Schema or ref
}

ResourceDef defines a resource type.

type Result

type Result struct {
	Success bool           `json:"success"`
	Output  map[string]any `json:"output,omitempty"`
	Error   string         `json:"error,omitempty"`
}

Result represents the outcome of an effect execution.

type RetentionHook

type RetentionHook struct {
	Event        string `json:"event"` // "ARCHIVE", "DELETE", "EXTEND"
	ResourceID   string `json:"resource_id"`
	ResourceType string `json:"resource_type"`
	Reason       string `json:"reason"`
	ApprovedBy   string `json:"approved_by,omitempty"`
}

RetentionHook is a callback for retention lifecycle events.

type RetentionPolicy

type RetentionPolicy struct {
	ID            string `json:"id"`
	TenantID      string `json:"tenant_id"`
	ResourceType  string `json:"resource_type"` // "EVIDENCE_PACK", "RECEIPT", "AUDIT_LOG", "PROOF"
	RetentionDays int    `json:"retention_days"`
	ArchiveAfter  int    `json:"archive_after_days,omitempty"`
	DeleteAfter   int    `json:"delete_after_days,omitempty"`
	ComplianceRef string `json:"compliance_ref,omitempty"` // e.g. "GDPR-Art17", "SOX-802"
}

RetentionPolicy defines evidence retention rules in OSS.

type RiskClass

type RiskClass string

RiskClass is the canonical risk classification.

const (
	RiskNone     RiskClass = "NONE"
	RiskLow      RiskClass = "LOW"
	RiskMedium   RiskClass = "MEDIUM"
	RiskHigh     RiskClass = "HIGH"
	RiskCritical RiskClass = "CRITICAL"
)

func ClassifyRisk

func ClassifyRisk(score float64) RiskClass

ClassifyRisk maps a numeric score to a RiskClass.

type RiskClassification

type RiskClassification struct {
	EffectType    string     `json:"effect_type"`
	Class         RiskClass  `json:"class"`
	Domain        RiskDomain `json:"domain"`
	Score         float64    `json:"score"` // 0.0–1.0
	Reversible    bool       `json:"reversible"`
	RequiresHuman bool       `json:"requires_human_approval"`
	Justification string     `json:"justification"`
}

RiskClassification is a typed risk assessment for an effect or action.

type RiskDomain

type RiskDomain string

RiskDomain categorizes the source of risk.

const (
	RiskDomainSecurity    RiskDomain = "SECURITY"
	RiskDomainCompliance  RiskDomain = "COMPLIANCE"
	RiskDomainFinancial   RiskDomain = "FINANCIAL"
	RiskDomainOperational RiskDomain = "OPERATIONAL"
	RiskDomainReputation  RiskDomain = "REPUTATION"
	RiskDomainSafety      RiskDomain = "SAFETY"
)

type RiskLevel

type RiskLevel string

RiskLevel classifies the current operational risk.

const (
	RiskLevelNormal   RiskLevel = "NORMAL"
	RiskLevelElevated RiskLevel = "ELEVATED"
	RiskLevelHigh     RiskLevel = "HIGH"
	RiskLevelCritical RiskLevel = "CRITICAL"
)

type RiskOption

type RiskOption func(*RiskSummary)

RiskOption is a functional option for configuring risk assessment.

func WithBudgetImpact

func WithBudgetImpact() RiskOption

WithBudgetImpact marks the action as having budget implications.

func WithContextMismatch

func WithContextMismatch() RiskOption

WithContextMismatch marks a context fingerprint mismatch.

func WithEgressRisk

func WithEgressRisk() RiskOption

WithEgressRisk marks the action as involving data egress.

func WithFrozen

func WithFrozen() RiskOption

WithFrozen marks the system as being in freeze state.

func WithIdentityRisk

func WithIdentityRisk() RiskOption

WithIdentityRisk marks the action as having identity concerns.

type RiskSummary

type RiskSummary struct {
	EffectTypeID     string `json:"effect_type_id"`
	EffectClass      string `json:"effect_class"` // E0-E4
	OverallRisk      string `json:"overall_risk"` // LOW, MEDIUM, HIGH, CRITICAL
	ApprovalRequired bool   `json:"approval_required"`
	BudgetImpact     bool   `json:"budget_impact"`
	EgressRisk       bool   `json:"egress_risk"`
	IdentityRisk     bool   `json:"identity_risk"`
	ContextMatch     bool   `json:"context_match"`
	Frozen           bool   `json:"frozen"`
}

RiskSummary is the machine-readable risk assessment attached to every enforcement decision. Operators and downstream systems parse this to understand the risk profile of a proposed action without interpreting policy details.

func ComputeRiskSummary

func ComputeRiskSummary(effectTypeID string, opts ...RiskOption) *RiskSummary

ComputeRiskSummary generates a RiskSummary from effect type and enforcement state.

type RiskThreshold

type RiskThreshold struct {
	Class              RiskClass `json:"class"`
	MinScore           float64   `json:"min_score"`
	RequiresApproval   bool      `json:"requires_approval"`
	RequiresEscalation bool      `json:"requires_escalation"`
	AutoDeny           bool      `json:"auto_deny"`
}

RiskThreshold defines when a risk level triggers governance actions.

func DefaultThresholds

func DefaultThresholds() []RiskThreshold

DefaultThresholds returns the canonical risk thresholds.

type RiskTier

type RiskTier string

RiskTier classifies the risk level of a receipt for condensation purposes.

const (
	// RiskTierLow covers T0-T1 effects (informational, low-impact).
	// Condensed to Merkle inclusion proofs after checkpoint.
	RiskTierLow RiskTier = "LOW"

	// RiskTierMedium covers T2 effects (moderate impact).
	// Full receipts retained, periodic Merkle checkpoints.
	RiskTierMedium RiskTier = "MEDIUM"

	// RiskTierHigh covers T3+ effects (high impact, irreversible).
	// Full receipt chain, no condensation, anchored to transparency log.
	RiskTierHigh RiskTier = "HIGH"
)

type Role

type Role struct {
	ID          string            `json:"id"`
	TenantID    string            `json:"tenant_id"`
	Name        string            `json:"name"`
	Taxonomy    RoleTaxonomy      `json:"taxonomy"`
	Namespace   RoleNamespace     `json:"namespace"`
	Description string            `json:"description"`
	Permissions []PermissionScope `json:"permissions"`
	MaxActors   int               `json:"max_actors,omitempty"` // 0 = unlimited
	Inherits    []string          `json:"inherits,omitempty"`   // parent role IDs
	Metadata    map[string]string `json:"metadata,omitempty"`
	CreatedAt   time.Time         `json:"created_at"`
	ContentHash string            `json:"content_hash"`
}

Role is the canonical role schema for HELM governance.

func NewRole

func NewRole(id, tenantID, name string, taxonomy RoleTaxonomy, namespace RoleNamespace, permissions []PermissionScope) *Role

NewRole creates a canonical role.

func (*Role) HasPermission

func (r *Role) HasPermission(resource, action string) bool

HasPermission checks if this role grants a specific permission.

func (*Role) Validate

func (r *Role) Validate() error

Validate ensures the role is well-formed.

type RoleNamespace

type RoleNamespace string

RoleNamespace groups roles by domain.

const (
	RoleNSGlobal     RoleNamespace = "global"
	RoleNSGovernance RoleNamespace = "governance"
	RoleNSExecution  RoleNamespace = "execution"
	RoleNSEconomic   RoleNamespace = "economic"
	RoleNSSecurity   RoleNamespace = "security"
)

type RoleTaxonomy

type RoleTaxonomy string

RoleTaxonomy classifies roles in the governance hierarchy.

const (
	RoleOwner    RoleTaxonomy = "OWNER"
	RoleAdmin    RoleTaxonomy = "ADMIN"
	RoleOperator RoleTaxonomy = "OPERATOR"
	RoleAuditor  RoleTaxonomy = "AUDITOR"
	RoleAgent    RoleTaxonomy = "AGENT"
	RoleService  RoleTaxonomy = "SERVICE"
	RoleObserver RoleTaxonomy = "OBSERVER"
	RoleCustom   RoleTaxonomy = "CUSTOM"
)

type RollbackPlan

type RollbackPlan struct {
	Strategy    string `json:"strategy"` // automatic, manual, impossible
	Description string `json:"description"`
	TimeWindow  int    `json:"time_window_seconds,omitempty"` // How long rollback is available
}

RollbackPlan describes how to undo the effect.

type RoutingPolicy

type RoutingPolicy struct {
	PolicyID        string        `json:"policy_id"`
	Rules           []RoutingRule `json:"rules"`
	DefaultProvider string        `json:"default_provider"`
	FallbackChain   []string      `json:"fallback_chain"` // provider IDs in order
}

RoutingPolicy defines how models are selected for tasks.

type RoutingRule

type RoutingRule struct {
	TaskType         string   `json:"task_type"` // "REASONING", "CODE_GEN", "CLASSIFICATION", etc.
	AllowedProviders []string `json:"allowed_providers"`
	MaxRiskTier      string   `json:"max_risk_tier"`
	RequiredRegions  []string `json:"required_regions,omitempty"`
	MaxCostPerMTok   float64  `json:"max_cost_per_million_tokens,omitempty"`
}

RoutingRule maps a task type or context to allowed providers.

type RunSummary

type RunSummary struct {
	TotalEffects   int64  `json:"total_effects"`
	TotalCost      int64  `json:"total_cost"`
	ElapsedSeconds int64  `json:"elapsed_seconds"`
	EnvelopeID     string `json:"envelope_id"`
}

RunSummary summarizes the current run state for context.

type RunSummaryProjection

type RunSummaryProjection struct {
	RunID            string           `json:"run_id"`
	Status           string           `json:"status"`
	CurrentStage     AutonomyRunStage `json:"current_stage"`
	Lane             Lane             `json:"lane"`
	ProgressPct      int              `json:"progress_pct"`      // 0-100
	NextAction       string           `json:"next_action"`       // Human-readable
	LastVerification string           `json:"last_verification"` // Summary of last verification result
	StartedAt        time.Time        `json:"started_at"`
	UpdatedAt        time.Time        `json:"updated_at"`
	BlockedBy        string           `json:"blocked_by,omitempty"` // DecisionRequest ID if blocked
}

RunSummaryProjection is a lightweight projection of a run's state for UI display. It is NOT the canonical Run — it is a computed summary.

type SafeDepHazardCode

type SafeDepHazardCode string

SafeDepHazardCode identifies the condition that forced emergency appraisal.

const (
	HazardDeadManExpired        SafeDepHazardCode = "DEAD_MAN_EXPIRED"
	HazardContinuityMissing     SafeDepHazardCode = "CONTINUITY_MISSING"
	HazardEnginePinMismatch     SafeDepHazardCode = "ENGINE_PIN_MISMATCH"
	HazardAttestationFailure    SafeDepHazardCode = "ATTESTATION_FAILURE"
	HazardVerifierProfileDrift  SafeDepHazardCode = "VERIFIER_PROFILE_DRIFT"
	HazardCredentialExpired     SafeDepHazardCode = "CREDENTIAL_EXPIRED"
	HazardAPIRot                SafeDepHazardCode = "API_ROT"
	HazardNetworkPartition      SafeDepHazardCode = "NETWORK_PARTITION"
	HazardTransparencyLogOutage SafeDepHazardCode = "TRANSPARENCY_LOG_OUTAGE"
	HazardStalePolicyFeed       SafeDepHazardCode = "STALE_POLICY_FEED"
)

type SafeDepState

type SafeDepState string

SafeDepState is the kernel-visible emergency posture after hazard appraisal.

const (
	SafeDepTerminalFreeze     SafeDepState = "terminal_freeze"
	SafeDepDegradedNarrowing  SafeDepState = "degraded_narrowing"
	SafeDepDeprecatedReadonly SafeDepState = "deprecated_readonly"
)

type SandboxGrant

type SandboxGrant struct {
	GrantID            string              `json:"grant_id"`
	Runtime            string              `json:"runtime"`
	RuntimeVersion     string              `json:"runtime_version,omitempty"`
	Profile            string              `json:"profile"`
	ImageDigest        string              `json:"image_digest,omitempty"`
	TemplateDigest     string              `json:"template_digest,omitempty"`
	FilesystemPreopens []FilesystemPreopen `json:"filesystem_preopens,omitempty"`
	Env                EnvExposurePolicy   `json:"env"`
	Network            NetworkGrant        `json:"network"`
	Limits             SandboxGrantLimits  `json:"limits,omitempty"`
	DeclaredAt         time.Time           `json:"declared_at"`
	PolicyEpoch        string              `json:"policy_epoch,omitempty"`
	GrantHash          string              `json:"grant_hash,omitempty"`
}

SandboxGrant binds the authority HELM gave a sandbox before execution. Hosted sandboxes are executors only; this record remains the HELM-native policy authority that offline verifiers can inspect.

func (SandboxGrant) Seal

func (g SandboxGrant) Seal() (SandboxGrant, error)

func (SandboxGrant) Validate

func (g SandboxGrant) Validate() error

type SandboxGrantLimits

type SandboxGrantLimits struct {
	MemoryBytes int64         `json:"memory_bytes,omitempty"`
	CPUTime     time.Duration `json:"cpu_time,omitempty"`
	OutputBytes int64         `json:"output_bytes,omitempty"`
	OpenFiles   int           `json:"open_files,omitempty"`
}

type SandboxPreflightRequest

type SandboxPreflightRequest struct {
	Runtime           string       `json:"runtime"`
	Profile           string       `json:"profile"`
	ImageDigest       string       `json:"image_digest,omitempty"`
	RequestedGrant    SandboxGrant `json:"requested_grant,omitempty"`
	PolicyEpoch       string       `json:"policy_epoch,omitempty"`
	ExpectedGrantHash string       `json:"expected_grant_hash,omitempty"`
}

type SandboxPreflightResult

type SandboxPreflightResult struct {
	Verdict       Verdict    `json:"verdict"`
	ReasonCode    ReasonCode `json:"reason_code,omitempty"`
	GrantID       string     `json:"grant_id,omitempty"`
	GrantHash     string     `json:"grant_hash,omitempty"`
	DispatchReady bool       `json:"dispatch_ready"`
	Findings      []string   `json:"findings,omitempty"`
	CheckedAt     time.Time  `json:"checked_at"`
}

type SchedulerState

type SchedulerState string

SchedulerState indicates whether the autonomy scheduler is active.

const (
	// SchedulerAwake means the scheduler is processing and dispatching.
	SchedulerAwake SchedulerState = "AWAKE"

	// SchedulerSleeping means the scheduler is idle until next scheduled action.
	SchedulerSleeping SchedulerState = "SLEEPING"
)

type Scope

type Scope struct {
	Domains     []string `json:"domains,omitempty"`
	Systems     []string `json:"systems,omitempty"`
	BlastRadius string   `json:"blast_radius"` // LOW, MEDIUM, HIGH
}

Scope defines the impact radius.

type SecretEventRef

type SecretEventRef struct {
	EventID    string    `json:"event_id"`
	Hash       string    `json:"hash"`
	SecretRef  string    `json:"secret_ref"` // Identifier (never the secret value)
	Action     string    `json:"action"`     // "issue", "access", "revoke"
	OccurredAt time.Time `json:"occurred_at"`
}

SecretEventRef references a secret access audit log.

type SecurityFindingRef

type SecurityFindingRef struct {
	FindingID          string   `json:"finding_id"`
	State              string   `json:"state"`
	EventHash          string   `json:"event_hash"`
	ThreatModelRef     string   `json:"threat_model_ref,omitempty"`
	SandboxReceiptRef  string   `json:"sandbox_receipt_ref,omitempty"`
	VerifierRef        string   `json:"verifier_ref,omitempty"`
	PatchRef           string   `json:"patch_ref,omitempty"`
	RegressionTestRef  string   `json:"regression_test_ref,omitempty"`
	VariantScanRef     string   `json:"variant_scan_ref,omitempty"`
	LifecycleEventRefs []string `json:"lifecycle_event_refs,omitempty"`
}

SecurityFindingRef links a HELM-owned vulnerability lifecycle record to an EvidencePack without making scanner output the source of truth.

type SemanticThreatAssessment

type SemanticThreatAssessment struct {
	Available         bool   `json:"available"`
	ModelVersion      string `json:"model_version,omitempty"`
	ModelHash         string `json:"model_hash,omitempty"`
	ExpectedModelHash string `json:"expected_model_hash,omitempty"`
	FailureReason     string `json:"failure_reason,omitempty"`
	ThresholdBP       int    `json:"threshold_bp"`
	MaxBP             int    `json:"max_bp"`
	NearestClass      string `json:"nearest_class,omitempty"`
	Flagged           bool   `json:"flagged"`
	InputTruncated    bool   `json:"input_truncated,omitempty"`
}

SemanticThreatAssessment binds deterministic advisory similarity evidence. Scores are integer cosine similarity in basis points (0..10000).

type Signature

type Signature struct {
	SignerID  string    `json:"signer_id"`
	Role      string    `json:"role"` // PROPOSER, NOTARY, REVIEWER
	Signature string    `json:"signature"`
	SignedAt  time.Time `json:"signed_at"`
}

Signature binds an entity to the proposal.

type SourceChannel

type SourceChannel string

SourceChannel identifies the origin system of untrusted input.

const (
	SourceChannelGitHubIssue   SourceChannel = "GITHUB_ISSUE"
	SourceChannelGitHubPR      SourceChannel = "GITHUB_PR_COMMENT"
	SourceChannelGitHubWebhook SourceChannel = "GITHUB_WEBHOOK"
	SourceChannelToolOutput    SourceChannel = "TOOL_OUTPUT"
	SourceChannelChatUser      SourceChannel = "CHAT_USER"
	SourceChannelMCPClient     SourceChannel = "MCP_CLIENT"
	SourceChannelAPIRequest    SourceChannel = "API_REQUEST"
	SourceChannelExternalAgent SourceChannel = "EXTERNAL_AGENT"
	SourceChannelUnknown       SourceChannel = "UNKNOWN"
)

type SpawnBoundary

type SpawnBoundary struct {
	ParentID         string   `json:"parent_id"`
	MaxChildren      int      `json:"max_children"`
	AllowedEffects   []string `json:"allowed_effects"`
	InheritBudget    bool     `json:"inherit_budget"`
	BudgetCapCents   int64    `json:"budget_cap_cents,omitempty"`
	MaxDepth         int      `json:"max_depth"`
	RequiresApproval bool     `json:"requires_approval"`
	TimeoutSeconds   int      `json:"timeout_seconds"`
}

SpawnBoundary defines the constraints for subagent creation.

type Status

type Status string

Status defines the lifecycle of a proposal.

const (
	StatusDraft       Status = "DRAFT"
	StatusSubmitted   Status = "SUBMITTED"
	StatusUnderReview Status = "UNDER_REVIEW"
	StatusVerdicted   Status = "VERDICTED"
	StatusApplied     Status = "APPLIED"
	StatusVerified    Status = "VERIFIED"
	StatusClosed      Status = "CLOSED"
	StatusRejected    Status = "REJECTED"
	StatusExpired     Status = "EXPIRED"
)

Status constants.

type StepResult

type StepResult struct {
	StepID  string         `json:"step_id"`
	Success bool           `json:"success"`
	Output  map[string]any `json:"output,omitempty"`
	Error   string         `json:"error,omitempty"`
}

StepResult represents the result of a single step execution.

type TaskLineageNode

type TaskLineageNode struct {
	TaskID      string     `json:"task_id"`
	ParentID    string     `json:"parent_id,omitempty"`
	ActorID     string     `json:"actor_id"`
	ActionType  string     `json:"action_type"`
	Status      string     `json:"status"` // "PENDING", "RUNNING", "COMPLETED", "FAILED"
	CreatedAt   time.Time  `json:"created_at"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
	Children    []string   `json:"children,omitempty"`
	ProofRef    string     `json:"proof_ref,omitempty"` // link to ProofGraph node
}

TaskLineageNode is a node in the first-class task lineage graph.

type TelemetryExportRequest

type TelemetryExportRequest struct {
	Format     string            `json:"format"`
	ReceiptID  string            `json:"receipt_id,omitempty"`
	RecordHash string            `json:"record_hash,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

type TelemetryExportResult

type TelemetryExportResult struct {
	ExportID      string            `json:"export_id"`
	Format        string            `json:"format"`
	Authoritative bool              `json:"authoritative"`
	Attributes    map[string]string `json:"attributes"`
	ExportedAt    time.Time         `json:"exported_at"`
}

type TelemetryOTelConfig

type TelemetryOTelConfig struct {
	ServiceName     string            `json:"service_name"`
	SignalType      string            `json:"signal_type"`
	Authoritative   bool              `json:"authoritative"`
	SpanAttributes  map[string]string `json:"span_attributes"`
	ExportedSignals []string          `json:"exported_signals"`
}

type ThreatClass

type ThreatClass string

ThreatClass categorizes the family of a detected threat signal.

const (
	ThreatClassPromptInjection    ThreatClass = "PROMPT_INJECTION_PATTERN"
	ThreatClassCommandExecution   ThreatClass = "COMMAND_EXECUTION_PATTERN"
	ThreatClassUnicodeObfuscation ThreatClass = "UNICODE_OBFUSCATION_PATTERN"
	ThreatClassSocialEngineering  ThreatClass = "SOCIAL_ENGINEERING_PATTERN"
	ThreatClassEncodingEvasion    ThreatClass = "ENCODING_EVASION_PATTERN"
	ThreatClassSuspiciousFetch    ThreatClass = "SUSPICIOUS_EXTERNAL_FETCH_PATTERN"
	ThreatClassCredentialExposure ThreatClass = "CREDENTIAL_EXPOSURE_PATTERN"
	ThreatClassSoftwarePublish    ThreatClass = "SOFTWARE_PUBLISH_PATTERN"

	// Phase G: expanded detection vectors for prompt defense hardening
	ThreatClassPrivilegeEscalation ThreatClass = "PRIVILEGE_ESCALATION_PATTERN"
	ThreatClassDataExfiltration    ThreatClass = "DATA_EXFILTRATION_PATTERN"
	ThreatClassModelManipulation   ThreatClass = "MODEL_MANIPULATION_PATTERN"
	ThreatClassContextAbuse        ThreatClass = "CONTEXT_ABUSE_PATTERN"
	ThreatClassIndirectInjection   ThreatClass = "INDIRECT_INJECTION_PATTERN"

	// ThreatClassSemanticSimilarity is an advisory similarity signal. It is
	// intentionally INFO-only and must never be treated as direct DENY authority.
	ThreatClassSemanticSimilarity ThreatClass = "SEMANTIC_SIMILARITY_PATTERN"
)

type ThreatFinding

type ThreatFinding struct {
	Class         ThreatClass    `json:"class"`
	Severity      ThreatSeverity `json:"severity"`
	RuleID        string         `json:"rule_id"`
	SourceChannel SourceChannel  `json:"source_channel"`
	SourceRef     string         `json:"source_ref,omitempty"`

	// Matched content evidence
	MatchedSpans  []MatchedSpan `json:"matched_spans,omitempty"`
	MatchedTokens []string      `json:"matched_tokens,omitempty"`

	// Hash evidence
	NormalizedInputHash string `json:"normalized_input_hash"`
	RawInputHash        string `json:"raw_input_hash"`

	// Metadata
	Notes    string         `json:"notes,omitempty"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

ThreatFinding represents a single detected signal within scanned input. Findings are informational — they do not carry allow/deny semantics.

type ThreatScanRef

type ThreatScanRef struct {
	ScanID       string                    `json:"scan_id"`
	MaxSeverity  ThreatSeverity            `json:"max_severity"`
	FindingCount int                       `json:"finding_count"`
	TrustLevel   InputTrustLevel           `json:"trust_level"`
	InputHash    string                    `json:"input_hash"`
	Semantic     *SemanticThreatAssessment `json:"semantic,omitempty"`
}

ThreatScanRef is a lightweight reference to a ThreatScanResult for embedding in EvidencePacks and Receipts without duplicating the full result.

func (ThreatScanRef) PolicyContext

func (r ThreatScanRef) PolicyContext() map[string]any

PolicyContext returns a CEL-compatible representation of trusted scan evidence. Semantic fields are flattened under threat_scan so policy authors can use stable expressions such as threat_scan.semantic_max_bp >= 7000.

type ThreatScanResult

type ThreatScanResult struct {
	// Scan metadata
	ScanID    string    `json:"scan_id"`
	Timestamp time.Time `json:"timestamp"`

	// Input provenance
	SourceChannel SourceChannel   `json:"source_channel"`
	TrustLevel    InputTrustLevel `json:"trust_level"`

	// Aggregate assessment (informational, not a verdict)
	MaxSeverity  ThreatSeverity `json:"max_severity"`
	FindingCount int            `json:"finding_count"`

	// All findings
	Findings []ThreatFinding `json:"findings"`

	// Normalization evidence
	Normalization *NormalizationEvidence `json:"normalization,omitempty"`

	// Content hashes for evidence/replay binding
	RawInputHash        string `json:"raw_input_hash"`
	NormalizedInputHash string `json:"normalized_input_hash"`

	// Semantic is the deterministic advisory classifier assessment. It is
	// present even when the classifier is unavailable so evidence never turns
	// a missing or mismatched model into silent success.
	Semantic *SemanticThreatAssessment `json:"semantic,omitempty"`
}

ThreatScanResult is the complete output of a deterministic threat scan. It aggregates all findings and normalization evidence for a single input.

func (*ThreatScanResult) Ref

Ref produces a ThreatScanRef from a ThreatScanResult.

type ThreatSeverity

type ThreatSeverity string

ThreatSeverity grades the confidence/impact of a finding.

const (
	ThreatSeverityInfo     ThreatSeverity = "INFO"
	ThreatSeverityLow      ThreatSeverity = "LOW"
	ThreatSeverityMedium   ThreatSeverity = "MEDIUM"
	ThreatSeverityHigh     ThreatSeverity = "HIGH"
	ThreatSeverityCritical ThreatSeverity = "CRITICAL"
)

func MaxSeverityOf

func MaxSeverityOf(findings []ThreatFinding) ThreatSeverity

MaxSeverityOf returns the highest severity from a list of findings.

type ThresholdSignature

type ThresholdSignature struct {
	SignerID       string `json:"signer_id"`
	Role           string `json:"role"`
	DeviceID       string `json:"device_id"`
	KeyID          string `json:"key_id"`
	PublicKey      string `json:"public_key,omitempty"`
	Scheme         string `json:"scheme,omitempty"`
	Signature      string `json:"signature"`
	RevokedAtEpoch uint64 `json:"revoked_at_epoch,omitempty"`
}

type TransparencyAnchor

type TransparencyAnchor struct {
	Backend            string    `json:"backend,omitempty"`
	LogID              string    `json:"log_id,omitempty"`
	InclusionProofHash string    `json:"inclusion_proof_hash,omitempty"`
	CheckpointHash     string    `json:"checkpoint_hash,omitempty"`
	Deferred           bool      `json:"deferred,omitempty"`
	DeferredUntil      time.Time `json:"deferred_until,omitempty"`
}

type TruthAnnotation

type TruthAnnotation struct {
	// FactSet lists verified facts supporting this element.
	FactSet []FactRef `json:"fact_set,omitempty"`

	// Assumptions lists unverified beliefs that the element depends on.
	Assumptions []string `json:"assumptions,omitempty"`

	// Unknowns lists unresolved questions.
	Unknowns []Unknown `json:"unknowns,omitempty"`

	// Confidence is a 0.0–1.0 score indicating overall epistemic confidence.
	Confidence float64 `json:"confidence,omitempty"`

	// EvidenceRefs lists content-addressed hashes of supporting evidence.
	EvidenceRefs []string `json:"evidence_refs,omitempty"`

	// BlockingQuestions lists questions that must be answered before proceeding.
	BlockingQuestions []string `json:"blocking_questions,omitempty"`
}

TruthAnnotation is a reusable epistemic metadata bundle that can be attached to any contract type (plans, intents, decisions, receipts).

func (*TruthAnnotation) BlockingUnknownIDs

func (ta *TruthAnnotation) BlockingUnknownIDs() []string

BlockingUnknownIDs returns the IDs of all blocking unknowns.

func (*TruthAnnotation) HasBlockingUnknowns

func (ta *TruthAnnotation) HasBlockingUnknowns() bool

HasBlockingUnknowns returns true if any unknowns have blocking impact.

func (*TruthAnnotation) Merge

func (ta *TruthAnnotation) Merge(other *TruthAnnotation) *TruthAnnotation

Merge combines two TruthAnnotations, taking the lower confidence and unioning all other fields.

type Unknown

type Unknown struct {
	// ID is a unique identifier for this unknown.
	ID string `json:"id"`

	// Description explains what is not yet known.
	Description string `json:"description"`

	// Impact classifies how this unknown affects execution.
	Impact UnknownImpact `json:"impact"`

	// ResolutionStrategy describes how this unknown might be resolved.
	ResolutionStrategy string `json:"resolution_strategy,omitempty"`

	// BlockingStepIDs lists which plan steps are blocked by this unknown.
	BlockingStepIDs []string `json:"blocking_step_ids,omitempty"`
}

Unknown represents an unresolved question that may affect runtime, policy, or replay fidelity.

type UnknownImpact

type UnknownImpact string

UnknownImpact classifies how an unknown affects execution.

const (
	// UnknownImpactBlocking means execution cannot proceed until resolved.
	UnknownImpactBlocking UnknownImpact = "blocking"

	// UnknownImpactDegrading means execution can proceed but with reduced confidence.
	UnknownImpactDegrading UnknownImpact = "degrading"

	// UnknownImpactInformational means the unknown is noted but does not affect execution.
	UnknownImpactInformational UnknownImpact = "informational"
)

type VGLStage

type VGLStage string

VGLStage represents a stage in the Verified Genesis Loop. Per ARCHITECTURE.md §3: law formation protocol.

const (
	// VGLStageCompile is the policy compilation stage.
	VGLStageCompile VGLStage = "COMPILE"
	// VGLStageVariantSelect is the context-dependent variant selection stage.
	VGLStageVariantSelect VGLStage = "VARIANT_SELECT"
	// VGLStageMirror is the deterministic semantic mirror generation stage.
	VGLStageMirror VGLStage = "MIRROR"
	// VGLStageWargame is the blast-radius wargaming stage.
	VGLStageWargame VGLStage = "WARGAME"
	// VGLStageApproval is the ORG_GENESIS_APPROVAL ceremony stage.
	VGLStageApproval VGLStage = "APPROVAL"
	// VGLStageActivate is the runtime activation stage.
	VGLStageActivate VGLStage = "ACTIVATE"
)

type VPLPhase

type VPLPhase string

VPLPhase represents a phase in the Verified Planning Loop.

const (
	// VPLPhasePropose is the initial phase where a request enters the system.
	VPLPhasePropose VPLPhase = "PROPOSE"
	// VPLPhaseValidate is the policy evaluation phase (Guardian/PEP).
	VPLPhaseValidate VPLPhase = "VALIDATE"
	// VPLPhaseVerdict is the phase where a policy decision is rendered.
	VPLPhaseVerdict VPLPhase = "VERDICT"
	// VPLPhaseExecute is the gated execution phase (SafeExecutor).
	VPLPhaseExecute VPLPhase = "EXECUTE"
	// VPLPhaseReceipt is the phase where cryptographic proof is generated.
	VPLPhaseReceipt VPLPhase = "RECEIPT"
	// VPLPhaseCheckpoint is the proof condensation evaluation phase.
	VPLPhaseCheckpoint VPLPhase = "CHECKPOINT"
)

type VendorComplianceCheck

type VendorComplianceCheck struct {
	Standard       string `json:"standard"` // SOC2, ISO27001, etc.
	Status         string `json:"status"`   // COMPLIANT, NON_COMPLIANT, etc.
	EvidenceURL    string `json:"evidence_url,omitempty"`
	ExpirationDate string `json:"expiration_date,omitempty"` // YYYY-MM-DD
	ReceiptRef     string `json:"receipt_ref,omitempty"`
}

type VendorDueDiligencePack

type VendorDueDiligencePack struct {
	PackID           string                            `json:"pack_id"`
	PackType         string                            `json:"pack_type"` // "VENDOR_DUE_DILIGENCE_PACK"
	VendorName       string                            `json:"vendor_name"`
	VendorDomain     string                            `json:"vendor_domain,omitempty"`
	AssessmentDate   time.Time                         `json:"assessment_date"`
	AssessorID       string                            `json:"assessor_id,omitempty"`
	ComplianceChecks []VendorComplianceCheck           `json:"compliance_checks"`
	RiskScore        int                               `json:"risk_score,omitempty"`
	Decision         string                            `json:"decision,omitempty"` // APPROVED, REJECTED, CONDITIONAL
	Attestation      VendorDueDiligencePackAttestation `json:"attestation"`
}

VendorDueDiligencePack represents a proof of vendor compliance.

type VendorDueDiligencePackAttestation

type VendorDueDiligencePackAttestation struct {
	PackHash    string    `json:"pack_hash"`
	Signature   string    `json:"signature,omitempty"`
	GeneratedAt time.Time `json:"generated_at"`
}

type Verdict

type Verdict string

Verdict is the canonical verdict type for all HELM governance decisions. Wire format: JSON string field "verdict" in DecisionRecord and Receipt.

const (
	// VerdictAllow indicates the effect is permitted. Decision is signed, Intent is issued.
	VerdictAllow Verdict = "ALLOW"

	// VerdictDeny indicates the effect is refused. A DenialReceipt is emitted.
	VerdictDeny Verdict = "DENY"

	// VerdictEscalate indicates the effect requires human/ceremony approval.
	VerdictEscalate Verdict = "ESCALATE"
)

func CanonicalVerdicts

func CanonicalVerdicts() []Verdict

CanonicalVerdicts returns the full normative verdict vocabulary.

func (Verdict) IsTerminal

func (v Verdict) IsTerminal() bool

IsTerminal returns true if the verdict is a final state (not pending escalation).

type Verification

type Verification struct {
	Type      string  `json:"type"`
	Effect    *Effect `json:"effect,omitempty"`
	Assertion string  `json:"assertion,omitempty"`
}

Verification represents verification requirements for a step.

type VerificationResult

type VerificationResult struct {
	Success         bool      `json:"success"`
	Details         string    `json:"details"`
	ObligationID    string    `json:"obligation_id"`
	Status          string    `json:"status"`
	VerifiedAt      time.Time `json:"verified_at"`
	CapturedAt      time.Time `json:"captured_at"`
	Healthy         bool      `json:"healthy"`
	ExternalStatus  string    `json:"external_status,omitempty"` // Added
	MissingReceipts []string  `json:"missing_receipts"`
	OrphanReceipts  []string  `json:"orphan_receipts"`
}

VerificationResult contains the result of a verification.

type VerificationScope

type VerificationScope struct {
	VerificationScopeID string `json:"verification_scope_id"`
	// ReceiptRefs explicitly bind this scope to issued receipts. They are
	// optional for compatibility, but when present are sealed into ScopeHash.
	ReceiptRefs      []string  `json:"receipt_refs,omitempty"`
	SubjectHash      string    `json:"subject_hash"`
	RiskClass        string    `json:"risk_class,omitempty"`
	ChecksPerformed  []string  `json:"checks_performed"`
	Assumptions      []string  `json:"assumptions,omitempty"`
	UntestedRegions  []string  `json:"untested_regions,omitempty"`
	KnownLimits      []string  `json:"known_limits,omitempty"`
	RemainingRisks   []string  `json:"remaining_risks,omitempty"`
	RequiredFollowup []string  `json:"required_followup,omitempty"`
	VerifierHash     string    `json:"verifier_hash"`
	PolicyHash       string    `json:"policy_hash"`
	CreatedAt        time.Time `json:"created_at,omitempty"`
	ScopeHash        string    `json:"scope_hash,omitempty"`
}

VerificationScope records verification coverage and residual risk.

func (VerificationScope) Seal

func (VerificationScope) Validate

func (s VerificationScope) Validate() error

type VerifierProfile

type VerifierProfile struct {
	ProfileID           string            `json:"profile_id"`
	Platform            string            `json:"platform"`
	RootSetHash         string            `json:"root_set_hash"`
	VerifierKeyID       string            `json:"verifier_key_id"`
	AppraisalPolicyHash string            `json:"appraisal_policy_hash"`
	RequiredPCRs        map[string]string `json:"required_pcrs,omitempty"`
	MeasurementHash     string            `json:"measurement_hash,omitempty"`
	AllowSynthetic      bool              `json:"allow_synthetic"`
	ExpiresAt           time.Time         `json:"expires_at"`
}

type VisualizationRule

type VisualizationRule struct {
	RuleID      string `json:"rule_id"`
	DataType    string `json:"data_type"`             // "PROOFGRAPH", "BUDGET", "DELEGATION", "TIMELINE"
	Rendering   string `json:"rendering"`             // "GRAPH", "TABLE", "TIMELINE", "HEATMAP", "TREE"
	Required    bool   `json:"required"`              // MUST be present in conformant UIs
	Constraints string `json:"constraints,omitempty"` // e.g. "no animation on critical data"
}

VisualizationRule defines how canonical truth should be rendered.

type WitnessSignature

type WitnessSignature struct {
	WitnessID string `json:"witness_id"`
	Signature string `json:"signature"`
}

type WorkerSpec

type WorkerSpec struct {
	MaxMemoryMB    int      `json:"max_memory_mb"`
	MaxCPUCores    float64  `json:"max_cpu_cores"`
	MaxDiskMB      int      `json:"max_disk_mb,omitempty"`
	NetworkPolicy  string   `json:"network_policy"` // "NONE", "EGRESS_ONLY", "FULL"
	AllowedPaths   []string `json:"allowed_paths,omitempty"`
	BlockedPaths   []string `json:"blocked_paths,omitempty"`
	AllowedTools   []string `json:"allowed_tools,omitempty"`
	MaxBudgetCents int64    `json:"max_budget_cents,omitempty"`
}

WorkerSpec defines resource and capability limits for a worker.

type WorkflowDef

type WorkflowDef struct {
	ID         string         `json:"id"`
	WorkflowID string         `json:"workflow_id,omitempty"` // Optional correlation ID
	Steps      []WorkflowStep `json:"steps"`
}

WorkflowDef defines a process.

func (WorkflowDef) Validate

func (workflow WorkflowDef) Validate() error

Validate checks that the workflow is executable as a deterministic DAG.

type WorkflowDefinition

type WorkflowDefinition = WorkflowDef

WorkflowDefinition is a type alias retained for schema/doc compatibility. New code should use WorkflowDef directly.

type WorkflowStep

type WorkflowStep struct {
	StepID          string            `json:"step_id"`
	Name            string            `json:"name"`
	Action          string            `json:"action"`
	Type            string            `json:"type"` // "EFFECT", "DECISION", "WAIT", "VERIFY"
	DependsOn       []string          `json:"depends_on,omitempty"`
	InputBindings   map[string]string `json:"input_bindings,omitempty"`
	Effect          *Effect           `json:"effect,omitempty"`
	Verification    *Verification     `json:"verification,omitempty"`
	Timeout         time.Duration     `json:"timeout,omitempty"`
	Condition       string            `json:"condition,omitempty"`
	HasCompensation bool              `json:"has_compensation"`
}

WorkflowStep represents a step in a workflow.

type WorkstationDecisionRequest

type WorkstationDecisionRequest struct {
	RequestID    string            `json:"request_id"`
	RunID        string            `json:"run_id,omitempty"`
	ActorID      string            `json:"actor_id,omitempty"`
	WorkspaceID  string            `json:"workspace_id,omitempty"`
	AgentSurface string            `json:"agent_surface,omitempty"`
	ToolID       string            `json:"tool_id"`
	Action       string            `json:"action"`
	EffectType   string            `json:"effect_type"`
	EffectMode   string            `json:"effect_mode"`
	Target       string            `json:"target,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
	OccurredAt   time.Time         `json:"occurred_at"`
}

type WorkstationDraftPolicy

type WorkstationDraftPolicy struct {
	WorkspaceRoots          []string `json:"workspace_roots"`
	AllowGeneratedArtifacts bool     `json:"allow_generated_artifacts"`
}

type WorkstationEgressDestination

type WorkstationEgressDestination struct {
	Host     string `json:"host"`
	Protocol string `json:"protocol"`
}

type WorkstationEgressPolicy

type WorkstationEgressPolicy struct {
	Allowlist []WorkstationEgressDestination `json:"allowlist"`
}

type WorkstationLearningPolicy

type WorkstationLearningPolicy struct {
	EmitFinality       bool `json:"emit_finality,omitempty"`
	EmitCounterfactual bool `json:"emit_counterfactual,omitempty"`
}

WorkstationLearningPolicy opts a profile into the denial fields an agent can learn from. Both default off. They are separate switches because they disclose different things: finality is a taxonomy, a counterfactual is a policy value.

type WorkstationMemoryPolicy

type WorkstationMemoryPolicy struct {
	DefaultTTLDays uint32   `json:"default_ttl_days"`
	MaxTTLDays     uint32   `json:"max_ttl_days,omitempty"`
	AllowedClasses []string `json:"allowed_classes"`
}

type WorkstationObservePolicy

type WorkstationObservePolicy struct {
	AllowedActions []string `json:"allowed_actions"`
}

type WorkstationOperatePolicy

type WorkstationOperatePolicy struct {
	Permissions []string `json:"permissions"`
}

type WorkstationPolicyDecisionReceipt

type WorkstationPolicyDecisionReceipt struct {
	ReceiptVersion string                     `json:"receipt_version"`
	DecisionID     string                     `json:"decision_id"`
	Request        WorkstationDecisionRequest `json:"request"`
	PolicyProfile  string                     `json:"policy_profile"`
	Verdict        string                     `json:"verdict"`
	ReasonCode     string                     `json:"reason_code,omitempty"`
	Reason         string                     `json:"reason,omitempty"`
	ObservedOnly   bool                       `json:"observed_only"`
	CreatedAt      time.Time                  `json:"created_at"`
	ReceiptHash    string                     `json:"receipt_hash"`
	Signature      string                     `json:"signature"`
	SignerKeyID    string                     `json:"signer_key_id"`
}

WorkstationPolicyDecisionReceipt is the selected-effect enforcement bridge receipt. It records the decision that a CLI wrapper or local hook must obey.

M3 covers selected workstation effect classes only. A DENY receipt means HELM refused to authorize the wrapper/hook execution path; it does not claim full desktop or proprietary-hosted-agent control.

type WorkstationPolicyProfile

type WorkstationPolicyProfile struct {
	ID      string                     `json:"id"`
	Mode    string                     `json:"mode"`
	Observe WorkstationObservePolicy   `json:"observe"`
	Draft   WorkstationDraftPolicy     `json:"draft"`
	Operate WorkstationOperatePolicy   `json:"operate"`
	Egress  WorkstationEgressPolicy    `json:"egress"`
	Memory  WorkstationMemoryPolicy    `json:"memory"`
	Loops   WorkstationRecurringPolicy `json:"recurring_loops"`
	// Learning is nil unless a profile opts in, which keeps the receipts of
	// every existing profile byte-identical.
	Learning *WorkstationLearningPolicy `json:"learning,omitempty"`
}

type WorkstationRecurringPolicy

type WorkstationRecurringPolicy struct {
	RequireSchedule   bool `json:"require_schedule"`
	RequireMaxRuntime bool `json:"require_max_runtime"`
	RequireToolScope  bool `json:"require_tool_scope"`
	RequireExpiration bool `json:"require_expiration"`
}

Directories

Path Synopsis
Package actuators — Wallet, Message, FileMovement, Physical actuator contracts.
Package actuators — Wallet, Message, FileMovement, Physical actuator contracts.
Package economic — Extended economic primitives.
Package economic — Extended economic primitives.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL