/** * ATIF (Agent Trajectory Interchange Format) TypeScript types. * * Mirrors the ATIF JSON schema (v1.6 and v1.7) with only the fields needed * for converting ATIF documents to the internal Trajectory format. Both schema * versions are accepted; the two differ in content-part and subagent shapes * (see {@link AtifContentPart} and {@link AtifSubagentTrajectory}). */ /** * Fields common to a root trajectory and an inlined subagent trajectory. The * two differ only in which identifier is required: a root requires * {@link AtifTrajectory.session_id}; an inlined subagent requires * {@link AtifSubagentTrajectory.trajectory_id} (its link key) and, per ATIF * v1.7, may omit `session_id`. */ export interface AtifTrajectoryBase { schema_version: string; session_id?: string | null; /** * Stable id used to reference this trajectory from a parent's * {@link AtifSubagentTrajectoryRef}. Present on inlined subagent trajectories. */ trajectory_id?: string | null; agent: AtifAgent; steps: AtifStep[]; notes?: string | null; final_metrics?: AtifFinalMetrics | null; continued_trajectory_ref?: string | null; /** * Subagent trajectories inlined into this document, each identified by its * {@link AtifSubagentTrajectory.trajectory_id}. */ subagent_trajectories?: AtifSubagentTrajectory[] | null; extra?: Record | null; } /** A root ATIF trajectory document. `session_id` is required at the root. */ export interface AtifTrajectory extends AtifTrajectoryBase { session_id: string; } /** * An inlined subagent trajectory (an entry in a parent's * `subagent_trajectories`). It must carry a {@link trajectory_id} so a * launching call's {@link AtifSubagentTrajectoryRef} can link to it; per ATIF * v1.7 it may omit `session_id`. */ export interface AtifSubagentTrajectory extends AtifTrajectoryBase { trajectory_id: string; } export interface AtifAgent { name: string; version: string; model_name?: string | null; tool_definitions?: AtifToolDefinition[] | null; extra?: Record | null; } export interface AtifToolDefinition { type: string; function: { name: string; description?: string; parameters?: Record; }; } export type AtifStepSource = "system" | "user" | "agent"; /** * ContentPart for multimodal messages. Modeled as a discriminated union per * spec: a "text" part carries `text`; ATIF v1.6 image parts carry `source`, * while ATIF v1.7 image parts use `{ type: "image_url", image_url: { url } }`. * Each variant forbids the others' payload fields. * * During conversion, a text part contributes its literal text and an image * part is flattened to a short `[image:]` placeholder so the image's * presence survives without embedding raw payloads. */ export type AtifContentPart = AtifTextPart | AtifImagePart | AtifImageUrlPart; export interface AtifTextPart { type: "text"; text: string; } export interface AtifImagePart { type: "image"; source: AtifImageSource; } /** ATIF v1.7 image content part. */ export interface AtifImageUrlPart { type: "image_url"; image_url: { url: string; }; } export interface AtifImageSource { media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; path: string; } export interface AtifStep { step_id: number; timestamp?: string | null; source: AtifStepSource; model_name?: string | null; reasoning_effort?: string | number | null; message: string | AtifContentPart[]; reasoning_content?: string | null; tool_calls?: AtifToolCall[] | null; observation?: AtifObservation | null; metrics?: AtifMetrics | null; extra?: Record | null; } export interface AtifToolCall { tool_call_id: string; function_name: string; arguments: Record; } export interface AtifObservation { results: AtifObservationResult[]; } export interface AtifObservationResult { source_call_id?: string | null; content?: string | AtifContentPart[] | null; subagent_trajectory_ref?: AtifSubagentTrajectoryRef[] | null; } export interface AtifSubagentTrajectoryRef { /** * Id of the inlined {@link AtifTrajectory} (in the parent's * `subagent_trajectories`) that this call launched. Preferred link for * inlined subagents. Either this or {@link session_id} must be present. */ trajectory_id?: string | null; /** Session id of an externally-stored subagent trajectory (not inlined). */ session_id?: string | null; trajectory_path?: string | null; extra?: Record | null; } export interface AtifMetrics { prompt_tokens?: number | null; completion_tokens?: number | null; cached_tokens?: number | null; cache_write_tokens?: number | null; cost_usd?: number | null; prompt_token_ids?: number[] | null; completion_token_ids?: number[] | null; logprobs?: number[] | null; extra?: Record | null; } export interface AtifFinalMetrics { total_prompt_tokens?: number | null; total_completion_tokens?: number | null; total_cached_tokens?: number | null; total_cache_write_tokens?: number | null; total_cost_usd?: number | null; total_steps?: number | null; extra?: Record | null; } //# sourceMappingURL=atif-types.d.ts.map