Read and cancel execution records, filter project history, and wait for terminal state.

ExecutionsClient

Read and poll the executor's project-scoped execution records.

cancel

Cancels a pending or running execution.

Cancellation is deterministic before provider dispatch. After dispatch may have begun, Eyeball aborts process-local work where possible, but upstream work or external side effects can still complete.

ts
cancel(executionId: string): Promise<ExecutionBase & { userId: string; createdAt: string; startedAt?: string; completedAt?: string; readonly replayed?: true; readonly source?: ExecutionSource; readonly attachments?: ExecutionAttachmentSummary; } & { status: "cancelled"; output?: never; error: ExecutionCancelledError; latencyMs: number; cancellation: ExecutionCancellation; }>
ParameterTypeRequiredDescription
executionIdstringYesExecution identifier returned by tools.execute.

Returns: Promise<ExecutionBase & { userId: string; createdAt: string; startedAt?: string; completedAt?: string; readonly replayed?: true; readonly source?: ExecutionSource; readonly attachments?: ExecutionAttachmentSummary; } & { status: "cancelled"; output?: never; error: ExecutionCancelledError; latencyMs: number; cancellation: ExecutionCancellation; }>

Throws

  • EyeballError when the execution is unavailable, unauthorized, already succeeded or failed, or reconciliation fails.

Example

ts
import { Eyeball } from "@eyeball/sdk";

const eyeball = new Eyeball({
  apiKey: process.env.EYEBALL_API_KEY!,
  baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});

const cancelled = await eyeball.executions.cancel(
  "exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8",
);
if (cancelled.cancellation.dispatchMayHaveBegun) {
  console.warn("Cancellation is best effort; upstream work may complete.");
} else {
  console.log("Provider dispatch was fenced.");
}

get

Retrieves one execution record by identifier.

The public record may include bounded replay, verified voice-session source, and staged-file ID/count provenance. It never includes canonical input, raw or derived idempotency identity, or staged-file bytes.

ts
get(executionId: string): Promise<ExecutionRecord>
ParameterTypeRequiredDescription
executionIdstringYesExecution identifier returned by tools.execute.

Returns: Promise<ExecutionRecord>

Throws

  • EyeballError when the execution is unavailable or the request fails.

Example

ts
import { Eyeball } from "@eyeball/sdk";

const eyeball = new Eyeball({
  apiKey: process.env.EYEBALL_API_KEY!,
  baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});

const execution = await eyeball.executions.get(
  "exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8",
);
if (execution.replayed === true) console.log("Accepted replay observed");
if (execution.source?.kind === "voice_session") {
  console.log(execution.source.sessionId);
}
for (const fileId of execution.attachments?.fileIds ?? []) {
  console.log(fileId);
}

list

Lists execution history with optional status, tool, user, and cursor filters. Items preserve the same optional bounded provenance as get; canonical input, idempotency identity, and file bytes remain private.

ts
list(options?: ListExecutionsOptions): Promise<ExecutionPage>
ParameterTypeRequiredDescription
optionsListExecutionsOptionsNoFilters and pagination for the project execution history.

Returns: Promise<ExecutionPage>

Throws

  • EyeballError when a filter is invalid or the executor request fails.

wait

Polls an execution until it succeeds, fails, or is cancelled, bounded by a local deadline. The terminal record preserves optional replay, verified source, and staged-file summary fields without exposing canonical input, idempotency identity, or bytes.

ts
wait(executionId: string, options?: WaitForExecutionOptions): Promise<TerminalExecutionRecord>
ParameterTypeRequiredDescription
executionIdstringYesExecution identifier returned by tools.execute.
optionsWaitForExecutionOptionsNoPoll interval and total timeout in milliseconds.

Returns: Promise<TerminalExecutionRecord>

Throws

  • EyeballError with timeout when the deadline expires, or the executor's normalized error for a failed request.
  • Error When an injected polling clock returns a non-finite timestamp.

Example

ts
import { Eyeball } from "@eyeball/sdk";

const eyeball = new Eyeball({
  apiKey: process.env.EYEBALL_API_KEY!,
  baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});

const execution = { executionId: "exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8" };

const terminal = await eyeball.executions.wait(execution.executionId, {
  pollMs: 500,
  timeoutMs: 60_000,
});

Types

ListExecutionsOptions

Project execution-history filters and cursor controls.

ts
export interface ListExecutionsOptions {
  status?: ExecutionStatus;
  /** Canonical dotted or restricted wire name. */
  tool?: string;
  /** Uses the client-level userId when omitted. */
  userId?: string;
  cursor?: string;
  limit?: number;
}
PropertyTypeRequiredReadonlyDescription
cursorstringNoNo
limitnumberNoNo
statusExecutionStatusNoNo
toolstringNoNoCanonical dotted or restricted wire name.
userIdstringNoNoUses the client-level userId when omitted.

WaitForExecutionOptions

Local polling cadence and deadline for terminal execution state.

ts
export interface WaitForExecutionOptions {
  /** Milliseconds between polls. Defaults to 500. */
  pollMs?: number;
  /** Total milliseconds before a timeout error. Defaults to 60,000. */
  timeoutMs?: number;
}
PropertyTypeRequiredReadonlyDescription
pollMsnumberNoNoMilliseconds between polls. Defaults to 500.
timeoutMsnumberNoNoTotal milliseconds before a timeout error. Defaults to 60,000.

ExecutionPage

One cursor page of public execution records.

ts
export interface ExecutionPage {
  executions: readonly ExecutionRecord[];
  nextCursor?: string;
}
PropertyTypeRequiredReadonlyDescription
executionsreadonly ExecutionRecord[]YesNo
nextCursorstringNoNo

AsyncExecuteResponse

ts
export type AsyncExecuteResponse = ExecutionBase & { status: "pending" };

ExecutionId

ts
export type ExecutionId = `exe_${string}`;

ExecutionAttachmentSummary

Historical metadata-only summary of staged Eyeball files referenced by an execution's validated canonical input.

count is always the number of distinct IDs in fileIds. The summary does not include names, MIME types, sizes, expiry timestamps, input paths, inline content, decoded content, or file bytes, and it can outlive the staged files.

ts
export interface ExecutionAttachmentSummary {
  readonly count: number;
  readonly fileIds: readonly FileId[];
}
PropertyTypeRequiredReadonlyDescription
countnumberYesYes
fileIdsreadonly file_$&#123;string&#125;[]YesYes

ExecutionCancellation

ts
export interface ExecutionCancellation {
  readonly dispatchMayHaveBegun: boolean;
}
PropertyTypeRequiredReadonlyDescription
dispatchMayHaveBegunbooleanYesYes

CancelledExecutionRecord

ts
export type CancelledExecutionRecord = Extract<
  ExecutionRecord,
  { status: "cancelled" }
>;

ExecutionMode

ts
export type ExecutionMode = "sync" | "async";

ExecutionRecord

ts
export type ExecutionRecord = ExecutionBase & {
  userId: string;
  createdAt: string;
  startedAt?: string;
  completedAt?: string;
  /**
   * Present as literal `true` after at least one accepted idempotent replay has
   * been observed for this execution.
   *
   * A replay reuses this record's execution ID. Absence does not show whether
   * the original request carried an idempotency key. No raw idempotency key,
   * prefix, hash, scope, or other derivative is included.
   */
  readonly replayed?: true;
  /** Verified bounded origin metadata, when the execution has one. */
  readonly source?: ExecutionSource;
  /** Distinct staged-file IDs referenced by the validated execution input. */
  readonly attachments?: ExecutionAttachmentSummary;
} & (
    | {
        status: "pending" | "running";
        output?: never;
        error?: never;
        latencyMs?: never;
      }
    | {
        status: "succeeded";
        output: JsonValue;
        error?: never;
        latencyMs: number;
      }
    | {
        status: "failed";
        output?: never;
        error: NormalizedToolError;
        latencyMs: number;
      }
    | {
        status: "cancelled";
        output?: never;
        error: ExecutionCancelledError;
        latencyMs: number;
        cancellation: ExecutionCancellation;
      }
  );

ExecutionResult

The immediate result of POST /v1/execute in either execution mode.

ts
export type ExecutionResult = SyncExecuteResponse | AsyncExecuteResponse;

ExecutionSource

Verified public origin metadata for an execution.

A voice-session source is recorded only when the executor has verified the session identity and its cryptographic binding to the reserved child execution ID. Session grants, control tokens, and private worker headers are never included.

ts
export type ExecutionSource = {
  readonly kind: "voice_session";
  readonly sessionId: string;
};

ExecutionStatus

ts
export type ExecutionStatus =
  | "pending"
  | "running"
  | "succeeded"
  | "failed"
  | "cancelled";

TerminalExecutionRecord

ts
export type TerminalExecutionRecord =
  | SucceededExecutionRecord
  | FailedExecutionRecord
  | CancelledExecutionRecord;