@svatah/yam-runtime
Runner-agnostic executor core: scope, guards, checkpoints, policies, results, audit
- Source:
packages/runtime· README:packages/runtime/README.md - Install:
npm install @svatah/yam-runtime - Version 0.1.0 · Apache-2.0
Exports
| Export | Kind | Signature | |
|---|---|---|---|
abortedByPolicy | function | export function abortedByPolicy(results: readonly StepResult[]): boolean | Did a policy abort the flow these results belong to (LLD §8.3, Draft 2.7)? |
ApiRunner | typealias | export type ApiRunner = ( | Runs an api step. Injected for the same reason. |
AuditContext | interface | export interface AuditContext | |
Auditor | class | export class Auditor | |
AuditSink | interface | export interface AuditSink | |
checkpointFor | function | export function checkpointFor(parts: Omit<Checkpoint, "schemaVersion">): Checkpoint | A checkpoint for a step (REQ-AUTO-2). |
classify | function | export function classify(error: unknown): FailureClass | The class LLD §8.4 assigns to an error. |
clearTracer | function | export function clearTracer(): void | |
currentTracer | function | export function currentTracer(): Tracer | |
CustomStepRunner | typealias | export type CustomStepRunner = ( | Runs a Tier 0 custom step. |
DataError | class | export class DataError extends Error | |
EXIT | variable | EXIT | Non-zero on failed, healed or aborted (REQ-RUN-9, LLD §15). |
expandRuns | function | export function expandRuns( | Which stories run, in which order (REQ-LANG-10, LLD §8.1). |
GuardError | class | export class GuardError extends Error | Thrown when a guard could not be evaluated (LLD §8.3). |
JsonLinesLogger | class | export class JsonLinesLogger implements Logger | Writes one JSON object per line to a stream. The default. |
Logger | interface | export interface Logger | |
LogLine | interface | export interface LogLine | JSON-lines logging, and the OpenTelemetry hook (REQ-NFR-5). |
MemoryAuditSink | class | export class MemoryAuditSink implements AuditSink | Collects lines in memory. The runner writes them to audit.jsonl. |
messageOf | function | export function messageOf(error: unknown): string | |
newRunId | function | export function newRunId(now = new Date(), random = Math.random): string | A lexicographically sortable id, which is what a run directory wants. |
NO_TRACER | variable | NO_TRACER: Tracer = { startSpan: () => NO_SPAN } | The tracer that does nothing, which is the default. |
openRunDirectory | function | export function openRunDirectory(outputDir: string, runId: string): RunDirectory | Open (creating) a run directory. |
planResume | function | export function planResume(options: | Find the checkpoint a --from step resumes out of. |
readCheckpoint | function | export function readCheckpoint(runDir: string, stepId: string): Checkpoint | undefined | Read one step's checkpoint out of a run directory (REQ-AUTO-3, T5.1). |
REDACTED | variable | REDACTED = "«redacted»" | What a secret becomes wherever it would otherwise be written. |
Resolver | typealias | export type Resolver = ( | Resolves a target to a live reference. Supplied by the runner (LLD §6.3). |
Resume | interface | export interface Resume | Where a resumed run picks up. |
ResumeMismatchError | class | export class ResumeMismatchError extends Error | The plan or the bindings moved under a checkpoint (LLD §15, exit 12). |
ResumeUnavailableError | class | export class ResumeUnavailableError extends Error | --resume was asked for and the run directory cannot support it. |
run | function | export async function run(options: RunOptions): Promise<RunOutcome> | |
RunDirectory | interface | export interface RunDirectory | |
RunOptions | interface | export interface RunOptions | |
RunOutcome | interface | export interface RunOutcome | |
runStep | function | export async function runStep(step: Step, context: StepContext): Promise<StepOutcome> | |
runStory | function | export async function runStory( | |
Scope | class | export class Scope | |
ScopeOptions | interface | export interface ScopeOptions | |
setTracer | function | export function setTracer(next: Tracer): void | Register a tracer (REQ-NFR-5, "optional OpenTelemetry"). |
signatureOf | function | export function signatureOf(story: Story): Signature | undefined | A story's signature, for the runner's own validation. |
SILENT | variable | SILENT: Logger = { log: () => undefined } | Discards everything. What a library-mode caller wants. |
Span | interface | export interface Span | A span, as much of OpenTelemetry as the runtime needs to know about. |
stackOf | function | export function stackOf(error: unknown): string | undefined | |
StepContext | interface | export interface StepContext | |
StepOutcome | interface | export interface StepOutcome | |
StoryContext | interface | export interface StoryContext extends Omit<StepContext, "scope"> | |
StoryOutcome | interface | export interface StoryOutcome | |
StoryRunner | typealias | export type StoryRunner = ( | Runs another story as a function (invoke, REQ-AUTO-5). |
summarise | function | export function summarise( | The totals and the exit code a summary carries (REQ-RUN-9). |
Tracer | interface | export interface Tracer | |
verifyResumeHashes | function | export function verifyResumeHashes( | Refuse a resume whose artifacts have moved (REQ-AUTO-3, LLD §15). |