import type { ModelListItem, ModelSelection, SDKUserMessage } from "./options.js"; import type { Run } from "./run.js"; import type { ConversationStep } from "./types/conversation-types.js"; import type { InteractionUpdate } from "./types/delta-types.js"; export interface SDKAgent { readonly agentId: string; send(message: string | SDKUserMessage, options?: SendOptions): Promise; close(): void; reload(): Promise; [Symbol.asyncDispose](): Promise; listArtifacts(): Promise; downloadArtifact(path: string): Promise; } export interface SendOptions { model?: ModelSelection; onStep?: (args: { step: ConversationStep; }) => void | Promise; onDelta?: (args: { update: InteractionUpdate; }) => void | Promise; /** * Per-send options that only apply to local agents. Nested to make the * local-only scope explicit at the type level — cloud callers cannot * pass these fields. */ local?: { /** * Expire the currently active persisted run, if any, before starting * this message as a new follow-up run. Recovery path for local agents * left wedged after a crashed CLI process. Cloud enforces a busy-run * check server-side (`409 agent_busy`), so no equivalent is needed. */ force?: boolean; }; } export type ListAgentsOptions = { limit?: number; cursor?: string; } & ({ runtime?: undefined; } | { runtime: "local"; cwd?: string; } | { runtime: "cloud"; prUrl?: string; includeArchived?: boolean; apiKey?: string; }); export interface ListResult { items: T[]; nextCursor?: string; } export type SDKAgentInfo = { agentId: string; name: string; summary: string; lastModified: number; status?: "running" | "finished" | "error"; createdAt?: number; /** * True when the agent has been archived via `Agent.archive(...)`. Distinct * from `status` (which reflects the most recent run's execution state). * Backwards-compatible optional field; undefined on older shapes. */ archived?: boolean; } & ({ runtime?: undefined; } | { runtime: "local"; cwd?: string; } | { runtime: "cloud"; env?: { type: "cloud" | "pool" | "machine"; name?: string; }; repos?: string[]; }); export type ListRunsOptions = { limit?: number; cursor?: string; } & ({ runtime?: "local"; cwd?: string; } | { runtime: "cloud"; apiKey?: string; }); export interface GetAgentMessagesOptions { limit?: number; offset?: number; runtime?: "local"; cwd?: string; } export type GetRunOptions = { runtime?: "local"; cwd?: string; } | { runtime: "cloud"; agentId: string; apiKey?: string; }; export interface AgentMessage { type: "user" | "assistant"; uuid: string; agent_id: string; message: unknown; } /** * Options for `Agent.get` / `Agent.archive` / `Agent.unarchive` / * `Agent.delete`. * * Runtime is auto-detected from the agent ID: IDs that start with `"bc-"` * route to the Cursor cloud API, everything else routes to the local store. * * - `cwd` is used when routing to the local store (defaults to `process.cwd()`). * - `apiKey` is used when routing to the cloud API (falls back to * `process.env.CURSOR_API_KEY`). */ export interface GetAgentOptions { cwd?: string; apiKey?: string; } export interface AgentOperationOptions { cwd?: string; apiKey?: string; } /** * Options for cloud-only account/catalog operations (Cursor.me, Cursor.models.list, * Cursor.repositories.list). If `apiKey` is omitted, falls back to * `process.env.CURSOR_API_KEY`. */ export interface CursorRequestOptions { apiKey?: string; } export interface SDKUser { apiKeyName: string; userEmail?: string; createdAt: string; } export interface SDKRepository { owner: string; name: string; repository: string; } /** * An entry returned by `Cursor.models.list()`. The `model` field is a * canonical `{ id, params }` that can be passed straight to `createAgent`. */ export type SDKModel = ModelListItem; //# sourceMappingURL=agent.d.ts.map