import { z } from "zod"; import { StepMetadata, WorkflowMetadata } from "workflow"; //#region src/workflow/runtime/resources.d.ts /** * A durable thing that a run created or otherwise owns a reference to. * * @group Runtime and resources */ interface RunResource { /** The resource category, such as `worktree` or `run-directory`. */ kind: string; /** The stable name that distinguishes this resource from others of the same kind. */ identity: string; /** An absolute URL where a human can inspect the resource. */ url: string; } /** * Where a recorded resource stands: `live` until release decides, then `kept` by policy or a * safety check, `released`, or `failed` when the release attempt errored and will be retried. * * @group Runtime and resources */ type ResourceState = "live" | "kept" | "released" | "failed"; /** * One recorded resource and what has happened to it. Records stay after release as history. * * @group Runtime and resources */ interface ResourceRecord extends RunResource { /** The run that owns the resource. */ runId: string; state: ResourceState; /** Why the resource is in its state, or null while it is live and untouched. */ reason: string | null; /** When the state last changed, as an ISO timestamp. */ updatedAt: string; } //#endregion //#region src/workflow/runtime/release.d.ts declare const releaseAction: z.ZodEnum<{ keep: "keep"; release: "release"; }>; /** * What release does with a finished run's resources. * * @group Runtime and resources */ type ReleaseAction = z.infer; /** Whether a run completed (`success`), or failed or was cancelled (`failure`). */ type RunOutcome = "success" | "failure"; declare const releaseSchema: z.ZodObject<{ onSuccess: z.ZodEnum<{ keep: "keep"; release: "release"; }>; onFailure: z.ZodEnum<{ keep: "keep"; release: "release"; }>; }, z.core.$strict>; /** * Selects whether eligible run resources are released for each terminal outcome. * * @group Runtime and resources */ type ReleasePolicy = z.input; /** * The result of applying a release policy to one run's resources. * * @group Runtime and resources */ interface ReleaseReport { /** The policy applied by this release attempt. */ policy: ReleasePolicy; /** Every resource the run recorded, with its state and reason after this attempt. */ resources: ResourceRecord[]; } //#endregion //#region src/steps/runtime/run-context.d.ts /** * The run a step belongs to: `getWorkflowMetadata()` inside the step. * * @group Runtime metadata */ type RunMetadata = Pick; type NamedRunMetadata = Pick; /** * The run and the step a posting belongs to: `{ ...getWorkflowMetadata(), stepId: getStepMetadata().stepId }` * inside the step. The step id is the same on every retry of that step. * * @group Runtime metadata */ type StepRunMetadata = NamedRunMetadata & Pick; /** * The run's page on the dashboard this service hosts, or undefined when the * service was started without one. Never a standalone `workflow web` URL: run * against a live World it opens a second queue worker and steals the jobs the * run is waiting on. * * @group Advanced run context */ declare function dashboardRunUrl(runId: string): string | undefined; //#endregion //#region src/steps/runtime/resources.d.ts /** * Register one resource on the active run so `jigs status` shows it. * * Repeating kind + identity is idempotent; a new URL for that identity replaces the old one. * The record is observation only: it stays `live` as the run's history and jigs never deletes * what it names. The kinds jigs records itself (`worktree`, `run-directory`, `branch`, * `codex-home`, `pi-home`, `claude-plugins`) are reserved. * * @group Recorded resources */ declare function registerResource(resource: RunResource): Promise; //#endregion export { dashboardRunUrl as a, ReleaseReport as c, ResourceState as d, RunResource as f, StepRunMetadata as i, RunOutcome as l, NamedRunMetadata as n, ReleaseAction as o, RunMetadata as r, ReleasePolicy as s, registerResource as t, ResourceRecord as u };