harn-stdlib 0.10.39

Embedded Harn standard library source catalog
Documentation
pub import { agent_unheeded_recurring_diagnostic } from "std/agent/recurring_diagnostic"
pub import { agent_stall_initial_state } from "std/agent/stall_config"
pub import {
  detector_action_of,
  detector_spec_to_stall,
  detector_spec_token_runaway,
  token_runaway_decision,
  token_runaway_made_progress,
  token_runaway_post_turn,
  token_runaway_resolve_cap,
  unified_detectors_post_turn,
} from "std/agent/stall_detectors"
pub import {
  agent_stall_inject_feedback,
  agent_stall_observe_tool_calls,
} from "std/agent/stall_observation"
pub import {
  AgentStallConfig,
  AgentStallObservation,
  AgentStallState,
  AgentStallWarning,
} from "std/agent/stall_types"
pub import {
  agent_stall_apply_result,
  agent_stall_clear_current_failure,
  agent_stall_current_failure,
  agent_stall_done_judge_due,
  agent_stall_no_net_progress,
  agent_stall_repair_config,
  agent_stall_repeated_verified_pass,
  agent_stall_verified_write_satisfied,
} from "std/agent/stall_verification"

// Keep this public alias on the facade: runtime `pub import` re-exports carry
// type schemas, but the type checker currently resolves consumer annotations
// only from aliases declared directly in the imported module.
pub type DetectorSpec = {
  enabled?: bool,
  hard_stop_after_trips?: int,
  loop?: {ping_pong_cycles?: int, repeat?: int},
  no_progress?: {messages?: int},
  stuck?: {same_diagnostic?: int, same_error?: int},
  token_runaway?: {
    fallback?: float,
    hard_multiple?: float,
    median?: float,
    sigma?: float,
    stddev?: float,
  },
}

pub type RecurringDiagnosticCategory = "syntax" | "resolution" | "type" | "semantic" | "unknown"

pub type DiagnosticCategoryPattern = {pattern: string, category: RecurringDiagnosticCategory}

pub type DiagnosticCategories = {
  codes?: dict<string, RecurringDiagnosticCategory>,
  patterns?: list<DiagnosticCategoryPattern>,
}

pub type UnheededRecurringDiagnostic = {
  signature: string,
  category: RecurringDiagnosticCategory,
  streak: int,
  first_attempt: int,
  last_attempt: int,
  location: string?,
  message: string,
}

pub type RecurringDiagnosticState = {
  signatures: list<string>,
  diagnostic_count: int,
  signature: string,
  category: RecurringDiagnosticCategory,
  streak: int,
  first_attempt: int,
  last_attempt: int,
  location: string?,
  message: string,
}

pub type RecurringDiagnosticObservation = {
  state: RecurringDiagnosticState?,
  signal: UnheededRecurringDiagnostic?,
}