/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface ArtifactBytes {
  dataBase64: string
  sizeBytes: number
}

export interface CheckSessionInput {
  traceparent?: string
  /**
   * The isolation target for this session; omit (null) for the process-default
   * engine. The Dagger address is built in the backend from this.
   */
  environment?: EnvironmentTarget
}

export interface CommandExecution {
  stdout: string
  stderr: string
  exitCode: number
  durationMs: number
  timedOut: boolean
  truncated: boolean
}

/**
 * JS input identifying a per-environment isolation target. Omitting it (null)
 * runs on the process-default engine. The Dagger transport address (`kube-pod://…`)
 * is constructed inside the Dagger backend from this — it is never carried
 * across the public API.
 */
export interface EnvironmentTarget {
  environmentId: string
  namespace: string
}

export interface Limits {
  outputBytesLimit: number
  fileSizeLimitBytes: number
  cpuSeconds: number
  memoryBytes: number
}

export interface ReadArtifactInput {
  traceparent?: string
  replayEntries: Array<ReplayEntry>
  limits: Limits
  path: string
  /**
   * the cwd a replayed entry with `cwd: None` should default to. matches
   * the sandbox's stored `defaultCwd`, so artifact extraction replays in
   * the same directory as the original commands.
   */
  defaultCwd: string
  /**
   * The isolation target the artifact must be read from — the same engine the
   * sandbox ran on; omit (null) for the process-default engine.
   */
  environment?: EnvironmentTarget
}

export interface ReplayCommand {
  command: string
  cwd?: string
  timeoutSeconds: number
}

/**
 * a single ordered replay step crossing the NAPI boundary. exactly one of
 * `command` / `file` / `skill_mount` is populated, keyed by `kind`
 * (`"command"` | `"file"` | `"skill_mount"`); the core converts it into the
 * internal [`ReplayStep`] enum at the entry point, where invalid combinations
 * are rejected.
 */
export interface ReplayEntry {
  kind: string
  command?: ReplayCommand
  file?: ReplayInputFile
  skillMount?: ReplaySkillMount
}

/**
 * a file written into the sandbox during replay. unlike [`SnapshotFile`]
 * (relative to a skill root), `path` is absolute and bounded to the sandbox
 * roots — uploads can target the home dir as well as a skill root.
 */
export interface ReplayInputFile {
  path: string
  encoding: string
  content: string
}

/**
 * a skill mounted into the sandbox at its replay sequence point. `files` are
 * the skill's snapshotted files (`path` relative to the skill root); the
 * materialize layer writes them under `/skills/<skill_name>` and extends
 * PYTHONPATH at this point. mounts are append-only, so a mount never changes a
 * prior layer's parent chain (the Dagger layer cache stays warm).
 */
export interface ReplaySkillMount {
  skillName: string
  files: Array<SnapshotFile>
}

export interface RunSandboxInput {
  traceparent?: string
  replayEntries: Array<ReplayEntry>
  limits: Limits
  command: string
  cwd: string
  timeoutSeconds: number
  /**
   * The isolation target for this run; omit (null) for the process-default
   * engine. The Dagger address is built in the backend from this.
   */
  environment?: EnvironmentTarget
}

export interface SnapshotFile {
  skillName: string
  path: string
  encoding: string
  content: string
}
export declare function checkSession(input?: CheckSessionInput | undefined | null): Promise<void>

/**
 * force-flush pending OTLP traces/logs. the backend calls this on graceful
 * shutdown so the final batch isn't lost. intentionally sync: the blocking
 * flush runs on the JS thread while the batch-export tasks drain on the tokio
 * runtime — calling it from inside the runtime (an async fn) would deadlock.
 */
export declare function flushTelemetry(): void

export declare function readArtifact(input: ReadArtifactInput): Promise<ArtifactBytes>

export declare function runSandbox(input: RunSandboxInput): Promise<CommandExecution>
