import { z } from 'zod'; import { type JsonObject } from '../depot/shape.js'; /** * `GetJob`, `GetAttempt` and `GetWorkflow` all open with the same flattened parent context * (`runStatus`, `workflowName`, `jobErrorMessage`, ...) before the object itself. Verified live * 2026-09-06; the field names below are the ones Depot returned, with unprefixed and nested * spellings accepted as fallbacks because depot.ci.v1 publishes no schema. */ /** Workflow and job names come from YAML; keep them short when echoed into prose. */ export declare const CI_NAME_CHAR_LIMIT = 120; export declare const runContextSchema: z.ZodObject<{ runId: z.ZodOptional; repo: z.ZodOptional; ref: z.ZodOptional; sha: z.ZodOptional; headSha: z.ZodOptional; trigger: z.ZodOptional; status: z.ZodOptional; createdAt: z.ZodOptional; startedAt: z.ZodOptional; finishedAt: z.ZodOptional; durationSeconds: z.ZodOptional; }, z.core.$strip>; export declare const workflowContextSchema: z.ZodObject<{ workflowId: z.ZodOptional; name: z.ZodOptional; status: z.ZodOptional; createdAt: z.ZodOptional; startedAt: z.ZodOptional; finishedAt: z.ZodOptional; durationSeconds: z.ZodOptional; }, z.core.$strip>; export declare const attemptDetailSchema: z.ZodObject<{ attemptId: z.ZodOptional; attempt: z.ZodOptional; status: z.ZodOptional; conclusion: z.ZodOptional; errorMessage: z.ZodOptional; errorMessageTruncated: z.ZodOptional; sandboxId: z.ZodOptional; sessionId: z.ZodOptional; createdAt: z.ZodOptional; dispatchedAt: z.ZodOptional; startedAt: z.ZodOptional; finishedAt: z.ZodOptional; durationSeconds: z.ZodOptional; isCurrent: z.ZodOptional; }, z.core.$strip>; export declare const jobDetailSchema: z.ZodObject<{ jobId: z.ZodOptional; jobKey: z.ZodOptional; jobDisplayName: z.ZodOptional; status: z.ZodOptional; conclusion: z.ZodOptional; errorMessage: z.ZodOptional; errorMessageTruncated: z.ZodOptional; createdAt: z.ZodOptional; dispatchedAt: z.ZodOptional; startedAt: z.ZodOptional; finishedAt: z.ZodOptional; durationSeconds: z.ZodOptional; currentAttemptId: z.ZodOptional; currentAttempt: z.ZodOptional; runsOn: z.ZodArray; strategy: z.ZodObject<{ jobTotal: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export type RunContext = z.infer; export type WorkflowContext = z.infer; export type AttemptDetail = z.infer; export type JobDetail = z.infer; export declare function parseRunContext(source: JsonObject): RunContext; export declare function parseWorkflowContext(source: JsonObject): WorkflowContext; export declare function parseAttemptDetail(source: JsonObject): AttemptDetail; /** * Reads the job fields from either a `GetJob`/`GetAttempt` document (where they carry a `job` * prefix beside the run and workflow fields) or a job entry inside `GetWorkflow` (bare names). */ export declare function parseJobDetail(source: JsonObject): JobDetail; export declare function parseAttempts(source: JsonObject): AttemptDetail[]; /** Highest attempt number first; Depot lists them oldest first. Stable for equal numbers. */ export declare function newestFirst(attempts: readonly T[]): T[]; export declare function isFailed(node: { status?: string | undefined; conclusion?: string | undefined; }): boolean; /** "failed (conclusion failure)" when Depot reports both and they differ; one word otherwise. */ export declare function formatState(node: { status?: string | undefined; conclusion?: string | undefined; }): string; /** Names from workflow YAML are untrusted: quote them and keep them short. */ export declare function quoteName(name: string | undefined, fallback: string): string; /** Error text is CI output: one line, JSON-quoted so embedded newlines and quotes stay visible. */ export declare function quoteError(message: string): string; export declare function describeRun(run: RunContext): string; export declare function describeWorkflow(workflow: WorkflowContext): string; /** One line per attempt, as rendered under a job in every tool that lists attempts. */ export declare function describeAttempt(attempt: AttemptDetail): string; //# sourceMappingURL=ci-detail.d.ts.map