/** * vigiles — Skill runtime: the deterministic gate ladder. * * Parses the `vigiles:gate` / `vigiles:result` markers a compiled SKILL.md * carries (emitted by compileSkill) and *executes* them: run each step's gate * in document order, short-circuit on the first failure (Railway error track), * then run the terminal result gate. This is the deterministic spine of the * skill driver — the part that turns the markers from documentation into * enforcement. * * Scope (v0): this runs the GATES only. It does not drive the LLM through the * prose steps one at a time — that needs a live harness and is a later phase. * `retry:N` is parsed and surfaced but executed once here: re-running a * deterministic gate without a model in the loop to fix the step yields the * same result. Retry is meaningful only once the model re-does the step * between attempts. * * Safety: this executes the gate commands the skill author declared (e.g. * `npm test`, `validate.py`) via an explicit, user-invoked command * (`vigiles hook-runtime run-skill`). It is not a silent hook and runs nothing the spec * didn't declare as a gate. */ import type { PurityLevel } from "../../core/effects.js"; export type RuntimeGate = { readonly kind: "cmd"; readonly command: string; readonly retry: number; } | { readonly kind: "file"; readonly path: string; readonly retry: number; } | { readonly kind: "role"; readonly role: string; readonly retry: number; }; export interface SkillGates { /** Per-step gates, in document order. */ readonly steps: readonly { readonly step: number; readonly gate: RuntimeGate; }[]; /** Terminal postcondition gate, if any. */ readonly result?: RuntimeGate; } /** Extract the step gates and result gate from a compiled SKILL.md. */ export declare function parseSkillGates(markdown: string): SkillGates; export interface GateOutcome { readonly ok: boolean; readonly output: string; } /** * Resolve a project role (test/build/lint) to the host project's real command, * detected from its ecosystem. Returns null when no command can be found — * which the caller surfaces as a failed gate rather than a silent pass. */ export declare function detectProjectCommand(role: string, cwd: string): string | null; /** * Run one gate against `cwd`: a command (exit 0 = pass), a file existence, or * a project role resolved to the host project's command. */ export declare function runGate(gate: RuntimeGate, cwd: string): GateOutcome; /** Human-readable label for a gate (for reports and hook messages). */ export declare function gateLabel(gate: RuntimeGate): string; export interface GateRunResult { /** Step number, or "result" for the terminal gate. */ readonly at: number | "result"; readonly gate: RuntimeGate; readonly ok: boolean; readonly output: string; } export interface SkillRunReport { readonly results: readonly GateRunResult[]; /** Where the ladder short-circuited, or null when every gate passed. */ readonly blockedAt: number | "result" | null; readonly ok: boolean; } /** * Run the gate ladder: step gates in order (short-circuiting on the first * failure), then the result gate. Mirrors a Sequence behavior tree — * ordered AND with short-circuit on FAILURE. */ export declare function runSkillGates(gates: SkillGates, cwd: string): SkillRunReport; /** Record the skill the agent is currently executing. */ export declare function setActiveSkill(cwd: string, skillPath: string): void; /** Clear the active-skill marker (the skill finished). */ export declare function clearActiveSkill(cwd: string): void; /** The path of the active skill, or null when none is in progress. */ export declare function readActiveSkill(cwd: string): string | null; /** * Parse the declared purity floor from a compiled SKILL.md — the * `` marker `compileSkill` emits (see * `purityMarker` in compile.ts). Returns null when no marker is present (the * skill declared no floor, so the purity gate imposes no constraint). Mirrors * `parseAgentPurity` in agent-runtime.ts. */ export declare function parseSkillPurity(markdown: string): PurityLevel | null; /** A runtime allow/deny decision (mirrors PreToolDecision in agent-runtime.ts). */ export interface SkillPreToolDecision { /** Whether the tool call is allowed (true) or blocked (false). */ readonly allow: boolean; /** Message fed back to the model on a block; empty on allow. */ readonly message: string; } /** * PreToolUse purity gate for skills. Mirrors `evaluatePreToolUse` in * agent-runtime.ts, but enforces ONLY the purity floor — skills have no * tools-allowlist rail (that's a separate, future concern). If a skill is * active and declares a `vigiles:purity:` marker, `decidePurityGate` checks * the live call (refining `Bash` by the concrete command via `isReadOnlyBash`). * With no active skill, a missing `.md`, or no purity marker, always allows. */ export declare function evaluateSkillPreToolUse(cwd: string, tool: string, command?: string): SkillPreToolDecision; export interface StopDecision { /** Whether the agent may stop (true) or must keep working (false). */ readonly allow: boolean; /** Message for the user (allow) or fed back to the model (block). */ readonly message: string; } /** * Stop-hook decision. If a skill is active and declares a result gate, run it: * allow the stop only when the gate passes; otherwise block and tell the model * what to fix. With no active skill (or no result gate), always allow. */ export declare function evaluateStopHook(cwd: string): StopDecision; //# sourceMappingURL=skill-runtime.d.ts.map