harn-modules 0.7.56

Cross-file module graph and import resolution utilities for Harn
Documentation
/*
 * std/corrections - Replay-for-teaching correction records.
 *
 * Import with: `import "std/corrections"`.
 */
import "std/triggers"

type CorrectionId = string

type CorrectionScope = "this_run" | "this_persona" | "all"

type CorrectionRecord = {
  schema: string,
  correction_id: string,
  from_decision: any,
  to_decision: any,
  reason: string,
  applied_by: string,
  scope: CorrectionScope,
  timestamp: string,
  actor_id: string?,
  action: string?,
  trace_id: string?,
  step: string?,
  evidence_refs: list<dict>,
  metadata: dict,
}

type CorrectionQueryFilters = {
  actor: string?,
  actor_id: string?,
  agent: string?,
  action: string?,
  scope: CorrectionScope?,
  since: string?,
  until: string?,
  limit: int?,
}

/** record appends a typed replay correction and returns its CorrectionId. */
pub fn record(correction) -> CorrectionId {
  return corrections.record(correction)
}

/** query returns recorded replay corrections. */
pub fn query(filters = {}) -> list<CorrectionRecord> {
  return corrections.query(filters)
}