Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ partial void ProcessCancelRunResponseContent(
h => h.Value),
};
}
// Resource state conflict (`agent_busy`, `agent_archived`, or `run_not_cancellable`).
// Resource state conflict (`agent_busy`, `agent_archived`, `agent_id_conflict`, or `run_not_cancellable`).
if ((int)__response.StatusCode == 409)
{
string? __content_409 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,44 @@ partial void ProcessCreateAgentResponseContent(
h => h.Value),
};
}
// Resource state conflict (`agent_busy`, `agent_archived`, `agent_id_conflict`, or `run_not_cancellable`).
if ((int)__response.StatusCode == 409)
{
string? __content_409 = null;
global::System.Exception? __exception_409 = null;
global::CursorAgents.Error? __value_409 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_409 = global::CursorAgents.Error.FromJson(__content_409, JsonSerializerContext);
}
else
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_409 = global::CursorAgents.Error.FromJson(__content_409, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_409 = __ex;
}

throw new global::CursorAgents.ApiException<global::CursorAgents.Error>(
message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_409,
statusCode: __response.StatusCode)
{
ResponseBody = __content_409,
ResponseObject = __value_409,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Rate limit exceeded. Response includes `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers.
if ((int)__response.StatusCode == 429)
{
Expand Down Expand Up @@ -639,17 +677,27 @@ partial void ProcessCreateAgentResponseContent(
/// </summary>
/// <param name="prompt"></param>
/// <param name="model"></param>
/// <param name="name">
/// Display name for the agent. Auto-derived from the prompt when omitted.<br/>
/// Example: Add README with setup instructions
/// </param>
/// <param name="agentId">
/// Optional client-supplied agent identifier in `bc-&lt;uuid&gt;` form. Re-POSTing the same `agentId` returns `409 agent_id_conflict` instead of creating a duplicate. Cannot be combined with `envVars`; omit `agentId` so the server mints one when you need session secrets.<br/>
/// Example: bc-00000000-0000-0000-0000-000000000001
/// </param>
/// <param name="env"></param>
/// <param name="repos">
/// Repository configuration. Mutually exclusive with a named cloud environment. Omit both `repos` and `env` to start a no-repo agent.
/// Repository configuration. Mutually exclusive with a named cloud environment. Omit both `repos` and `env` (or pass `repos: []`) to start a no-repo agent.
/// </param>
/// <param name="branchName">
/// Custom branch name for the agent to create.<br/>
/// Example: feature/add-readme
/// </param>
/// <param name="autoGenerateBranch">
/// Whether to create a new branch (true) or push to an existing head branch (false). Only applies when `repos[0].prUrl` is provided.<br/>
/// Default Value: true
/// <param name="workOnCurrentBranch">
/// When `false` (the default), Cursor pushes commits to a new<br/>
/// auto-generated branch (`cursor/...`) based on<br/>
/// `repos[0].startingRef` (or the PR base ref when `prUrl`<br/>
/// is set). When `true`, Cursor pushes directly to that<br/>
/// starting ref — for a non-PR create, that's the branch you<br/>
/// passed in `startingRef`; for a `prUrl` create, that's the<br/>
/// PR's head branch.<br/>
/// Default Value: false
/// </param>
/// <param name="autoCreatePR">
/// Whether Cursor should open a pull request when the run completes.<br/>
Expand All @@ -660,11 +708,24 @@ partial void ProcessCreateAgentResponseContent(
/// Default Value: false
/// </param>
/// <param name="envVars">
/// Session-scoped environment variables for the cloud agent. Values are encrypted at rest, injected into the agent's shell, and deleted with the agent. Names must be non-empty, 1024 bytes or less, and cannot start with `CURSOR_`. Values must be non-empty and 4096 bytes or less.
/// Session-scoped environment variables for the cloud agent.<br/>
/// Values are encrypted at rest, injected into the agent's<br/>
/// shell, and deleted with the agent. Names must be non-empty,<br/>
/// 255 bytes or less, and cannot start with `CURSOR_`. Values<br/>
/// must be non-empty and 4096 bytes or less. Cannot be<br/>
/// combined with a client-supplied `agentId`.<br/>
/// Beta: `envVars` is rolling out. If it isn't enabled for<br/>
/// your account yet, the field is silently ignored on create<br/>
/// rather than failing the request — verify the values are<br/>
/// present on a first run before relying on them in<br/>
/// production.
/// </param>
/// <param name="mcpServers">
/// Inline MCP server definitions available to the initial run. Remote servers support `headers` or OAuth `auth`; stdio servers run inside the cloud agent VM and can receive `env`. Server names must be unique.
/// </param>
/// <param name="customSubagents">
/// Custom subagents the main agent can delegate to. Names must be unique and not collide with built-ins.
/// </param>
/// <param name="mode">
/// Initial conversation mode for the agent's first run.<br/>
/// Default Value: agent
Expand All @@ -675,14 +736,16 @@ partial void ProcessCreateAgentResponseContent(
public async global::System.Threading.Tasks.Task<global::CursorAgents.CreateAgentResponse> CreateAgentAsync(
global::CursorAgents.CreateAgentRequestPrompt prompt,
global::CursorAgents.ModelRef? model = default,
string? name = default,
string? agentId = default,
global::CursorAgents.AgentEnv? env = default,
global::System.Collections.Generic.IList<global::CursorAgents.RepoConfig>? repos = default,
string? branchName = default,
bool? autoGenerateBranch = default,
bool? workOnCurrentBranch = default,
bool? autoCreatePR = default,
bool? skipReviewerRequest = default,
global::System.Collections.Generic.Dictionary<string, string>? envVars = default,
global::System.Collections.Generic.IList<global::CursorAgents.McpServer>? mcpServers = default,
global::System.Collections.Generic.IList<global::CursorAgents.CustomSubagent>? customSubagents = default,
global::CursorAgents.AgentMode? mode = default,
global::CursorAgents.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand All @@ -691,14 +754,16 @@ partial void ProcessCreateAgentResponseContent(
{
Prompt = prompt,
Model = model,
Name = name,
AgentId = agentId,
Env = env,
Repos = repos,
BranchName = branchName,
AutoGenerateBranch = autoGenerateBranch,
WorkOnCurrentBranch = workOnCurrentBranch,
AutoCreatePR = autoCreatePR,
SkipReviewerRequest = skipReviewerRequest,
EnvVars = envVars,
McpServers = mcpServers,
CustomSubagents = customSubagents,
Mode = mode,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ partial void ProcessCreateRunResponseContent(
h => h.Value),
};
}
// Resource state conflict (`agent_busy`, `agent_archived`, or `run_not_cancellable`).
// Resource state conflict (`agent_busy`, `agent_archived`, `agent_id_conflict`, or `run_not_cancellable`).
if ((int)__response.StatusCode == 409)
{
string? __content_409 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,27 @@ partial void ProcessStreamRunResponse(

/// <summary>
/// Stream a run<br/>
/// Stream Server-Sent Events for one run. Event types include<br/>
/// `status`, `assistant`, `thinking`, `tool_call`, `heartbeat`,<br/>
/// `result`, `error`, and `done`. Reconnect with the<br/>
/// `Last-Event-ID` header to resume after a disconnect; the event<br/>
/// ID must belong to the requested run. Responses include the<br/>
/// `X-Cursor-Stream-Retention-Seconds` header. After the<br/>
/// retention window the endpoint may return `410 stream_expired`.<br/>
/// `tool_call` event data uses the `RunStreamToolCallData` schema.
/// Stream Server-Sent Events for one run. Event types are<br/>
/// `status`, `assistant`, `thinking`, `tool_call`,<br/>
/// `interaction_update`, `heartbeat`, `result`, `error`, and<br/>
/// `done`.<br/>
/// - `status` carries `{ runId, status }`. It has no `id` line<br/>
/// and is replayed at the top of every reconnect.<br/>
/// - `result` carries `{ runId, status, text?, durationMs?,<br/>
/// git? }`; `text` is the final assistant reply, `durationMs`<br/>
/// the wall-clock duration, and `git` mirrors `Run.git`.<br/>
/// - `interaction_update` carries the richer SDK-shape update<br/>
/// used by the TypeScript SDK and is emitted alongside the<br/>
/// simplified events that share the same event id. Use this if<br/>
/// you want the full SDK stream; otherwise handle the simplified<br/>
/// events and ignore it.<br/>
/// Reconnect with the `Last-Event-ID` header to resume after a<br/>
/// disconnect; the event ID must belong to the requested run<br/>
/// otherwise the endpoint returns `400 invalid_last_event_id`.<br/>
/// Responses include the `X-Cursor-Stream-Retention-Seconds`<br/>
/// header; after the retention window the endpoint may return<br/>
/// `410 stream_expired`. `tool_call` event data uses the<br/>
/// `RunStreamToolCallData` schema.
/// </summary>
/// <param name="id">
/// Example: bc-00000000-0000-0000-0000-000000000001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,27 @@ public partial interface ICursorAgentsClient
/// </summary>
/// <param name="prompt"></param>
/// <param name="model"></param>
/// <param name="name">
/// Display name for the agent. Auto-derived from the prompt when omitted.<br/>
/// Example: Add README with setup instructions
/// </param>
/// <param name="agentId">
/// Optional client-supplied agent identifier in `bc-&lt;uuid&gt;` form. Re-POSTing the same `agentId` returns `409 agent_id_conflict` instead of creating a duplicate. Cannot be combined with `envVars`; omit `agentId` so the server mints one when you need session secrets.<br/>
/// Example: bc-00000000-0000-0000-0000-000000000001
/// </param>
/// <param name="env"></param>
/// <param name="repos">
/// Repository configuration. Mutually exclusive with a named cloud environment. Omit both `repos` and `env` to start a no-repo agent.
/// </param>
/// <param name="branchName">
/// Custom branch name for the agent to create.<br/>
/// Example: feature/add-readme
/// Repository configuration. Mutually exclusive with a named cloud environment. Omit both `repos` and `env` (or pass `repos: []`) to start a no-repo agent.
/// </param>
/// <param name="autoGenerateBranch">
/// Whether to create a new branch (true) or push to an existing head branch (false). Only applies when `repos[0].prUrl` is provided.<br/>
/// Default Value: true
/// <param name="workOnCurrentBranch">
/// When `false` (the default), Cursor pushes commits to a new<br/>
/// auto-generated branch (`cursor/...`) based on<br/>
/// `repos[0].startingRef` (or the PR base ref when `prUrl`<br/>
/// is set). When `true`, Cursor pushes directly to that<br/>
/// starting ref — for a non-PR create, that's the branch you<br/>
/// passed in `startingRef`; for a `prUrl` create, that's the<br/>
/// PR's head branch.<br/>
/// Default Value: false
/// </param>
/// <param name="autoCreatePR">
/// Whether Cursor should open a pull request when the run completes.<br/>
Expand All @@ -63,11 +73,24 @@ public partial interface ICursorAgentsClient
/// Default Value: false
/// </param>
/// <param name="envVars">
/// Session-scoped environment variables for the cloud agent. Values are encrypted at rest, injected into the agent's shell, and deleted with the agent. Names must be non-empty, 1024 bytes or less, and cannot start with `CURSOR_`. Values must be non-empty and 4096 bytes or less.
/// Session-scoped environment variables for the cloud agent.<br/>
/// Values are encrypted at rest, injected into the agent's<br/>
/// shell, and deleted with the agent. Names must be non-empty,<br/>
/// 255 bytes or less, and cannot start with `CURSOR_`. Values<br/>
/// must be non-empty and 4096 bytes or less. Cannot be<br/>
/// combined with a client-supplied `agentId`.<br/>
/// Beta: `envVars` is rolling out. If it isn't enabled for<br/>
/// your account yet, the field is silently ignored on create<br/>
/// rather than failing the request — verify the values are<br/>
/// present on a first run before relying on them in<br/>
/// production.
/// </param>
/// <param name="mcpServers">
/// Inline MCP server definitions available to the initial run. Remote servers support `headers` or OAuth `auth`; stdio servers run inside the cloud agent VM and can receive `env`. Server names must be unique.
/// </param>
/// <param name="customSubagents">
/// Custom subagents the main agent can delegate to. Names must be unique and not collide with built-ins.
/// </param>
/// <param name="mode">
/// Initial conversation mode for the agent's first run.<br/>
/// Default Value: agent
Expand All @@ -78,14 +101,16 @@ public partial interface ICursorAgentsClient
global::System.Threading.Tasks.Task<global::CursorAgents.CreateAgentResponse> CreateAgentAsync(
global::CursorAgents.CreateAgentRequestPrompt prompt,
global::CursorAgents.ModelRef? model = default,
string? name = default,
string? agentId = default,
global::CursorAgents.AgentEnv? env = default,
global::System.Collections.Generic.IList<global::CursorAgents.RepoConfig>? repos = default,
string? branchName = default,
bool? autoGenerateBranch = default,
bool? workOnCurrentBranch = default,
bool? autoCreatePR = default,
bool? skipReviewerRequest = default,
global::System.Collections.Generic.Dictionary<string, string>? envVars = default,
global::System.Collections.Generic.IList<global::CursorAgents.McpServer>? mcpServers = default,
global::System.Collections.Generic.IList<global::CursorAgents.CustomSubagent>? customSubagents = default,
global::CursorAgents.AgentMode? mode = default,
global::CursorAgents.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ public partial interface ICursorAgentsClient
{
/// <summary>
/// Stream a run<br/>
/// Stream Server-Sent Events for one run. Event types include<br/>
/// `status`, `assistant`, `thinking`, `tool_call`, `heartbeat`,<br/>
/// `result`, `error`, and `done`. Reconnect with the<br/>
/// `Last-Event-ID` header to resume after a disconnect; the event<br/>
/// ID must belong to the requested run. Responses include the<br/>
/// `X-Cursor-Stream-Retention-Seconds` header. After the<br/>
/// retention window the endpoint may return `410 stream_expired`.<br/>
/// `tool_call` event data uses the `RunStreamToolCallData` schema.
/// Stream Server-Sent Events for one run. Event types are<br/>
/// `status`, `assistant`, `thinking`, `tool_call`,<br/>
/// `interaction_update`, `heartbeat`, `result`, `error`, and<br/>
/// `done`.<br/>
/// - `status` carries `{ runId, status }`. It has no `id` line<br/>
/// and is replayed at the top of every reconnect.<br/>
/// - `result` carries `{ runId, status, text?, durationMs?,<br/>
/// git? }`; `text` is the final assistant reply, `durationMs`<br/>
/// the wall-clock duration, and `git` mirrors `Run.git`.<br/>
/// - `interaction_update` carries the richer SDK-shape update<br/>
/// used by the TypeScript SDK and is emitted alongside the<br/>
/// simplified events that share the same event id. Use this if<br/>
/// you want the full SDK stream; otherwise handle the simplified<br/>
/// events and ignore it.<br/>
/// Reconnect with the `Last-Event-ID` header to resume after a<br/>
/// disconnect; the event ID must belong to the requested run<br/>
/// otherwise the endpoint returns `400 invalid_last_event_id`.<br/>
/// Responses include the `X-Cursor-Stream-Retention-Seconds`<br/>
/// header; after the retention window the endpoint may return<br/>
/// `410 stream_expired`. `tool_call` event data uses the<br/>
/// `RunStreamToolCallData` schema.
/// </summary>
/// <param name="id">
/// Example: bc-00000000-0000-0000-0000-000000000001
Expand Down
Loading
Loading