effect-cursor-sdk 0.3.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEPRECATIONS.md +2 -85
- package/README.md +51 -45
- package/dist/index.d.ts +33 -80
- package/dist/index.js +27 -37
- package/dist/index.js.map +1 -1
- package/docs/RECIPES.md +7 -15
- package/docs/SDK_COVERAGE.md +3 -3
- package/docs/changeset-agent.md +1 -1
- package/package.json +2 -2
- package/docs/MIGRATION_NEXT_MAJOR.md +0 -22
package/DEPRECATIONS.md
CHANGED
|
@@ -1,88 +1,5 @@
|
|
|
1
1
|
# Deprecations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
There are currently **no deprecations** in this version of `effect-cursor-sdk`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
| Status | Meaning |
|
|
8
|
-
| ---------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
9
|
-
| **Deprecated** | Still supported; avoid in new code. May show IDE warnings via TSDoc `@deprecated`. |
|
|
10
|
-
| **Preferred now** | Current recommended API; use with [`loadCursorConfig`](./README.md#quick-start) and related helpers. |
|
|
11
|
-
| **Planned next major** | Intended replacement names after deprecated overloads and `*FromConfig` suffixes are removed. |
|
|
12
|
-
|
|
13
|
-
## Agent entry: plain `AgentOptions` vs config-first
|
|
14
|
-
|
|
15
|
-
Passing raw [`AgentOptions`](https://cursor.com/docs/sdk/typescript) (including a plain `apiKey` string) directly to `CursorAgentService` agent entry points is **deprecated**. Prefer loading `CursorConfig` with `loadCursorConfig` (exported from this package) and using the `*FromConfig` methods so secrets stay [`Redacted`](https://effect.website/docs/schema/redacted/) until merged for the SDK boundary.
|
|
16
|
-
|
|
17
|
-
### API mapping
|
|
18
|
-
|
|
19
|
-
| Deprecated (`CursorAgentService`) | Preferred now | Planned next major (same signatures as “Preferred now”) |
|
|
20
|
-
| --------------------------------- | ----------------------------------------------- | ------------------------------------------------------- |
|
|
21
|
-
| `create(options)` | `createFromConfig(config, overrides?)` | `create(config, overrides?)` |
|
|
22
|
-
| `resume(agentId, options?)` | `resumeFromConfig(agentId, config, overrides?)` | `resume(agentId, config, overrides?)` |
|
|
23
|
-
| `prompt(message, options?)` | `promptFromConfig(message, config, overrides?)` | `prompt(message, config, overrides?)` |
|
|
24
|
-
| `scoped(options)` | `scopedFromConfig(config, overrides?)` | `scoped(config, overrides?)` |
|
|
25
|
-
|
|
26
|
-
The `*FromConfig` suffixes exist today to keep deprecated plain-`AgentOptions` entry points without breaking callers. After removal of the legacy forms, the shorter names above are the intended stable surface.
|
|
27
|
-
|
|
28
|
-
### Migrate `create`
|
|
29
|
-
|
|
30
|
-
**Before (deprecated):**
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
const agent =
|
|
34
|
-
yield *
|
|
35
|
-
agents.create({
|
|
36
|
-
apiKey: process.env.CURSOR_API_KEY,
|
|
37
|
-
model: { id: "composer-2" },
|
|
38
|
-
local: { cwd: process.cwd() },
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**After (preferred):**
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
const config = yield * loadCursorConfig;
|
|
46
|
-
const agent =
|
|
47
|
-
yield *
|
|
48
|
-
agents.createFromConfig(config, {
|
|
49
|
-
model: { id: "composer-2" },
|
|
50
|
-
local: { cwd: process.cwd() },
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
If you need full control over merging into SDK options, call `agentOptionsFromConfig(config, overrides)` and pass the result only through internal or transitional code paths; application code should still prefer `createFromConfig`.
|
|
55
|
-
|
|
56
|
-
### Migrate `prompt`
|
|
57
|
-
|
|
58
|
-
**Before (deprecated):**
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
const result =
|
|
62
|
-
yield *
|
|
63
|
-
agents.prompt("Summarize the README", {
|
|
64
|
-
apiKey: process.env.CURSOR_API_KEY,
|
|
65
|
-
model: { id: "composer-2" },
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**After (preferred):**
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
const config = yield * loadCursorConfig;
|
|
73
|
-
const result =
|
|
74
|
-
yield *
|
|
75
|
-
agents.promptFromConfig("Summarize the README", config, {
|
|
76
|
-
model: { id: "composer-2" },
|
|
77
|
-
});
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Other deprecations
|
|
81
|
-
|
|
82
|
-
`CursorSdkFactory` exposes raw SDK-style `create` / `resume` / `prompt` helpers for tests and advanced wiring; those are **deprecated for application code** in favor of `CursorAgentService` with the config-first flow above. See TSDoc on `CursorSdkFactory` in the published types.
|
|
83
|
-
|
|
84
|
-
## Where else this is documented
|
|
85
|
-
|
|
86
|
-
- [README.md](./README.md) — quick summary and link here.
|
|
87
|
-
- Package root ships this file next to `README.md` on npm (see `package.json` `files`).
|
|
88
|
-
- Per-symbol `@deprecated` tags on `CursorAgentService` and related exports in the TypeScript declarations.
|
|
5
|
+
For historical breaking changes and release notes, see [CHANGELOG.md](./CHANGELOG.md).
|
package/README.md
CHANGED
|
@@ -8,9 +8,6 @@ Effect-native access to the new [Cursor SDK](https://cursor.com/docs/sdk/typescr
|
|
|
8
8
|
|
|
9
9
|
If you want to build with Cursor agents, and you are using Effect, this package is for you.
|
|
10
10
|
|
|
11
|
-
> [!WARNING]
|
|
12
|
-
> This project is in early development. While all functionality is available, there is still much room for improvement. Contributions are welcome!
|
|
13
|
-
|
|
14
11
|
## Philosophy
|
|
15
12
|
|
|
16
13
|
- SDK-first: every public `@cursor/sdk` capability should be usable through this package.
|
|
@@ -25,7 +22,6 @@ If you want to build with Cursor agents, and you are using Effect, this package
|
|
|
25
22
|
- [SDK coverage & compatibility](./docs/SDK_COVERAGE.md) — wrapper checklist, audit script, release alignment
|
|
26
23
|
- [Recipes](./docs/RECIPES.md) — short patterns (config-first agent, streaming, pagination, lifecycle, tests)
|
|
27
24
|
- [Release checklist](./docs/RELEASE_CHECKLIST.md) — gates, SDK bumps, Changesets
|
|
28
|
-
- [Next major migration (planned)](./docs/MIGRATION_NEXT_MAJOR.md) — config-first renames after deprecations are removed
|
|
29
25
|
|
|
30
26
|
## Feature Coverage
|
|
31
27
|
|
|
@@ -38,7 +34,7 @@ If you want to build with Cursor agents, and you are using Effect, this package
|
|
|
38
34
|
| `Agent.list`, `get`, `listRuns`, `getRun`, messages | `CursorInspectionService` |
|
|
39
35
|
| `Agent.archive`, `unarchive`, `delete` | `CursorInspectionService` |
|
|
40
36
|
| `Cursor.me`, models, repositories | `CursorInspectionService` |
|
|
41
|
-
| MCP servers, sub-agents, local/cloud options, model options | Defaults via `CursorConfig` / `loadCursorConfig`; merged SDK `AgentOptions`
|
|
37
|
+
| MCP servers, sub-agents, local/cloud options, model options | Defaults via `CursorConfig` / `loadCursorConfig`; merged into SDK `AgentOptions` at the boundary |
|
|
42
38
|
| Local run event helpers and platform helpers | Re-exported from `@cursor/sdk` |
|
|
43
39
|
|
|
44
40
|
## Use cases
|
|
@@ -53,6 +49,28 @@ If you are new to the Cursor SDK, take a look at the [Cursor SDK Cookbook](https
|
|
|
53
49
|
bun add effect-cursor-sdk effect @cursor/sdk
|
|
54
50
|
```
|
|
55
51
|
|
|
52
|
+
`effect` is a **peer dependency** (Effect v4). `@cursor/sdk` is bundled with this package, but installing it in your app keeps SDK-owned types and versions explicit when you import from `@cursor/sdk` alongside the wrapper.
|
|
53
|
+
|
|
54
|
+
### Requirements
|
|
55
|
+
|
|
56
|
+
- **Runtime:** Bun or Node.js (examples and CI use Bun; Node works for library consumers).
|
|
57
|
+
- **Effect:** `^4.0.0-beta` (see [Effect v4](https://effect.website/docs/introduction/overview) — still pre-release on the Effect side).
|
|
58
|
+
- **Cursor SDK:** `@cursor/sdk` `^1.0.x` (pinned in this repo; see [SDK coverage](./docs/SDK_COVERAGE.md) when upgrading).
|
|
59
|
+
|
|
60
|
+
### Configuration
|
|
61
|
+
|
|
62
|
+
`loadCursorConfig` reads optional environment variables through Effect’s `ConfigProvider` (by default, `process.env`):
|
|
63
|
+
|
|
64
|
+
| Variable | Purpose |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `CURSOR_API_KEY` | API key for Cursor (stored as `Redacted` until merged into SDK options). |
|
|
67
|
+
| `CURSOR_MODEL` | Default model id (for example `composer-2`). |
|
|
68
|
+
| `CURSOR_LOCAL_CWD` | Default working directory for local agents. |
|
|
69
|
+
|
|
70
|
+
All fields are optional at load time; missing `CURSOR_API_KEY` logs a warning and later SDK calls fail with authentication errors unless you pass overrides. Per-call overrides still win when using `create`, `scoped`, `prompt`, and `resume`.
|
|
71
|
+
|
|
72
|
+
For offline tests and CI, use [`mockLayer`](#mocks-and-tests) or `makeMockRuntime` — no API key required.
|
|
73
|
+
|
|
56
74
|
For development in this repo:
|
|
57
75
|
|
|
58
76
|
```bash
|
|
@@ -68,7 +86,7 @@ minimal first script to production-style Effect composition:
|
|
|
68
86
|
|
|
69
87
|
| Example | What it demonstrates |
|
|
70
88
|
| --- | --- |
|
|
71
|
-
| [`quickstart`](./examples/quickstart) | First config-first local agent call with `loadCursorConfig`, `
|
|
89
|
+
| [`quickstart`](./examples/quickstart) | First config-first local agent call with `loadCursorConfig`, `scoped`, and `collectText`. |
|
|
72
90
|
| [`cli`](./examples/cli) | A small terminal app with `liveRuntime`, offline `makeMockRuntime`, CLI overrides, and tagged error handling. |
|
|
73
91
|
| [`basic-agent-workflow`](./examples/basic-agent-workflow) | Scoped agents, run status listeners, streaming, capability checks, and artifact listing/downloads. |
|
|
74
92
|
| [`advanced-ops-dashboard`](./examples/advanced-ops-dashboard) | Inspection APIs, confirmation-gated lifecycle operations, parallel Effect composition, retries/timeouts, telemetry, redaction, and rich mocks. |
|
|
@@ -81,7 +99,7 @@ bun run examples:typecheck
|
|
|
81
99
|
|
|
82
100
|
## Quick Start
|
|
83
101
|
|
|
84
|
-
Load environment defaults with `loadCursorConfig`, then create agents with `
|
|
102
|
+
Load environment defaults with `loadCursorConfig`, then create agents with `create` (and `scoped`, `prompt`, `resume` as needed). The API key stays in `Redacted` form until the merge step; `AgentOptions.apiKey` remains a plain string at the SDK boundary.
|
|
85
103
|
|
|
86
104
|
```ts
|
|
87
105
|
import {
|
|
@@ -97,7 +115,7 @@ const program = Effect.gen(function* () {
|
|
|
97
115
|
const runs = yield* CursorRunService;
|
|
98
116
|
|
|
99
117
|
const config = yield* loadCursorConfig;
|
|
100
|
-
const agent = yield* agents.
|
|
118
|
+
const agent = yield* agents.create(config, {
|
|
101
119
|
// Override the given config optionally with custom values
|
|
102
120
|
model: { id: "composer-2" },
|
|
103
121
|
local: { cwd: process.cwd() },
|
|
@@ -113,38 +131,11 @@ const program = Effect.gen(function* () {
|
|
|
113
131
|
|
|
114
132
|
Effect’s default `ConfigProvider` reads `process.env`, so you usually do not need to install a custom provider for this.
|
|
115
133
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Plain `AgentOptions` at the agent boundary (deprecated)
|
|
119
|
-
|
|
120
|
-
Passing raw `AgentOptions` (for example `apiKey: process.env.CURSOR_API_KEY`) to `create`, `resume`, `prompt`, or `scoped` is **deprecated**. It still works for compatibility, but prefer the config flow above.
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
import { CursorAgentService, CursorRunService, liveLayer } from "effect-cursor-sdk";
|
|
124
|
-
import { Effect } from "effect";
|
|
125
|
-
|
|
126
|
-
const legacyProgram = Effect.gen(function* () {
|
|
127
|
-
const agents = yield* CursorAgentService;
|
|
128
|
-
const runs = yield* CursorRunService;
|
|
129
|
-
|
|
130
|
-
const agent = yield* agents.create({
|
|
131
|
-
apiKey: process.env.CURSOR_API_KEY,
|
|
132
|
-
model: { id: "composer-2" },
|
|
133
|
-
local: { cwd: process.cwd() },
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const run = yield* agents.send(agent, "Explain this repository");
|
|
137
|
-
const text = yield* runs.collectText(run);
|
|
138
|
-
yield* agents.dispose(agent);
|
|
139
|
-
return text;
|
|
140
|
-
}).pipe(Effect.provide(liveLayer));
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Migrate by replacing `agents.create({ ... })` with `const config = yield* loadCursorConfig` and `agents.createFromConfig(config, { ... })` (or the other `*FromConfig` helpers).
|
|
134
|
+
For advanced SDK-factory wiring in tests, you can still call `agentOptionsFromConfig` to merge config into plain `AgentOptions` before passing them to `CursorSdkFactory`.
|
|
144
135
|
|
|
145
136
|
## Scoped Agents
|
|
146
137
|
|
|
147
|
-
Prefer `
|
|
138
|
+
Prefer `scoped` when an agent should be disposed automatically:
|
|
148
139
|
|
|
149
140
|
```ts
|
|
150
141
|
import { CursorAgentService, loadCursorConfig, liveLayer } from "effect-cursor-sdk";
|
|
@@ -154,7 +145,7 @@ const program = Effect.scoped(
|
|
|
154
145
|
Effect.gen(function* () {
|
|
155
146
|
const agents = yield* CursorAgentService;
|
|
156
147
|
const config = yield* loadCursorConfig;
|
|
157
|
-
const agent = yield* agents.
|
|
148
|
+
const agent = yield* agents.scoped(config, {
|
|
158
149
|
model: { id: "composer-2" },
|
|
159
150
|
local: { cwd: process.cwd() },
|
|
160
151
|
});
|
|
@@ -164,13 +155,24 @@ const program = Effect.scoped(
|
|
|
164
155
|
).pipe(Effect.provide(liveLayer));
|
|
165
156
|
```
|
|
166
157
|
|
|
158
|
+
## Resume an existing agent
|
|
159
|
+
|
|
160
|
+
Use `resume` with the agent id from a prior run or from `CursorInspectionService.listAgents`:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const config = yield* loadCursorConfig;
|
|
164
|
+
const agent = yield* agents.resume("bc_abc123", config, {
|
|
165
|
+
local: { cwd: process.cwd() },
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
167
169
|
## Cloud Agents
|
|
168
170
|
|
|
169
171
|
Cloud options are merged as SDK overrides on top of loaded config:
|
|
170
172
|
|
|
171
173
|
```ts
|
|
172
174
|
const config = yield* loadCursorConfig;
|
|
173
|
-
const agent = yield* agents.
|
|
175
|
+
const agent = yield* agents.create(config, {
|
|
174
176
|
model: { id: "composer-2" },
|
|
175
177
|
cloud: {
|
|
176
178
|
repos: [
|
|
@@ -206,6 +208,10 @@ yield* runs.streamEvents(run).pipe(
|
|
|
206
208
|
);
|
|
207
209
|
```
|
|
208
210
|
|
|
211
|
+
## Artifacts
|
|
212
|
+
|
|
213
|
+
List and download run outputs with `CursorArtifactService` after `send` completes. See the [Artifacts recipe](./docs/RECIPES.md#artifacts) for path resolution and download patterns.
|
|
214
|
+
|
|
209
215
|
## Inspection And Metadata
|
|
210
216
|
|
|
211
217
|
Use `CursorInspectionService` for agent/run listings, messages, lifecycle operations, account metadata, model discovery, and connected repositories.
|
|
@@ -222,7 +228,7 @@ const repos = yield* inspection.listRepositories();
|
|
|
222
228
|
|
|
223
229
|
Because every Cursor call is an `Effect`, you compose it like the rest of your program: parallel requests, timeouts, retries, logging, and layers all work the same way.
|
|
224
230
|
|
|
225
|
-
This agent garden snapshot loads your catalog in parallel, adds a resilient boundary around the batch, logs a safe summary (counts and IDs only — never log API keys), then asks Cursor for a one-shot triage opinion via `
|
|
231
|
+
This agent garden snapshot loads your catalog in parallel, adds a resilient boundary around the batch, logs a safe summary (counts and IDs only — never log API keys), then asks Cursor for a one-shot triage opinion via `prompt`:
|
|
226
232
|
|
|
227
233
|
```ts
|
|
228
234
|
import {
|
|
@@ -258,7 +264,7 @@ const agentGardenSnapshot = Effect.gen(function* () {
|
|
|
258
264
|
repos: catalog.repos.length,
|
|
259
265
|
});
|
|
260
266
|
|
|
261
|
-
const triage = yield* agents.
|
|
267
|
+
const triage = yield* agents.prompt(
|
|
262
268
|
[
|
|
263
269
|
"You are helping on-call. Here is non-secret inventory:",
|
|
264
270
|
`- Cloud agents (ids): ${catalog.cloud.items.map((a) => a.agentId).join(", ") || "(none)"}`,
|
|
@@ -310,7 +316,7 @@ import { Effect } from "effect";
|
|
|
310
316
|
const testProgram = Effect.gen(function* () {
|
|
311
317
|
const agents = yield* CursorAgentService;
|
|
312
318
|
const config = yield* loadCursorConfig;
|
|
313
|
-
const agent = yield* agents.
|
|
319
|
+
const agent = yield* agents.create(config, { model: { id: "composer-2" } });
|
|
314
320
|
return yield* agents.send(agent, "Hello");
|
|
315
321
|
}).pipe(
|
|
316
322
|
Effect.provide(
|
|
@@ -327,11 +333,11 @@ The main exports are:
|
|
|
327
333
|
|
|
328
334
|
- **Recipes** — common compositions (prompt text, send + collect, pagination, lifecycle guards, artifacts) in [RECIPES.md](./docs/RECIPES.md)
|
|
329
335
|
- **Observability helpers** (`streamEventsTracked`, `collectTextTracked`, catalog retry/timeout presets, log summaries)
|
|
330
|
-
- `CursorAgentService` (
|
|
336
|
+
- `CursorAgentService` (`create`, `scoped`, `prompt`, `resume` with `loadCursorConfig`)
|
|
331
337
|
- `CursorRunService`
|
|
332
338
|
- `CursorArtifactService`
|
|
333
339
|
- `CursorInspectionService`
|
|
334
|
-
- `CursorSdkFactory` (
|
|
340
|
+
- `CursorSdkFactory` (low-level SDK adapter for tests and advanced overrides)
|
|
335
341
|
- `liveLayer`, `mockLayer`, `liveRuntime`, `makeMockRuntime`
|
|
336
342
|
- `CursorConfig`, `cursorConfig`, `agentOptionsFromConfig`, `loadCursorConfig`
|
|
337
343
|
- tagged Cursor error classes and `mapCursorError`
|
|
@@ -358,7 +364,7 @@ Coverage is measured with Vitest v8 coverage. The suite focuses on deterministic
|
|
|
358
364
|
|
|
359
365
|
## Deprecations
|
|
360
366
|
|
|
361
|
-
|
|
367
|
+
See **[DEPRECATIONS.md](./DEPRECATIONS.md)** for the canonical list of deprecated APIs. Pair it with **[CHANGELOG.md](./CHANGELOG.md)** for release-by-release notes.
|
|
362
368
|
|
|
363
369
|
## Versioning and Publishing
|
|
364
370
|
|
package/dist/index.d.ts
CHANGED
|
@@ -206,11 +206,10 @@ declare const CursorConfig_base: Schema.Class<CursorConfig, Schema.Struct<{
|
|
|
206
206
|
* {@link AgentOptions} at the SDK boundary.
|
|
207
207
|
*
|
|
208
208
|
* @remarks
|
|
209
|
-
*
|
|
210
|
-
* `CursorAgentService` methods such as `
|
|
211
|
-
* or merge manually with {@link agentOptionsFromConfig}
|
|
212
|
-
*
|
|
213
|
-
* `scoped` overloads may be removed in a future major version.
|
|
209
|
+
* Load defaults with {@link loadCursorConfig}, then call
|
|
210
|
+
* `CursorAgentService` methods such as `create`, `resume`, `prompt`, and
|
|
211
|
+
* `scoped`, or merge manually with {@link agentOptionsFromConfig} for advanced
|
|
212
|
+
* SDK-factory wiring.
|
|
214
213
|
*
|
|
215
214
|
* @example
|
|
216
215
|
* ```ts
|
|
@@ -254,7 +253,7 @@ declare const cursorConfig: Config.Config<{
|
|
|
254
253
|
* Build SDK `AgentOptions` from wrapper config and optional overrides.
|
|
255
254
|
*
|
|
256
255
|
* This is the adapter from typed, redacted {@link CursorConfig} to the SDK's
|
|
257
|
-
* plain-string `apiKey` boundary. Prefer `CursorAgentService.
|
|
256
|
+
* plain-string `apiKey` boundary. Prefer `CursorAgentService.create`
|
|
258
257
|
* (and related methods) over building {@link AgentOptions} by hand.
|
|
259
258
|
*
|
|
260
259
|
* @param config - Wrapper-owned environment defaults.
|
|
@@ -276,7 +275,7 @@ declare const cursorConfig: Config.Config<{
|
|
|
276
275
|
* @remarks
|
|
277
276
|
* Explicit override values always win over environment-derived defaults.
|
|
278
277
|
* For application code, prefer service methods that take {@link CursorConfig}
|
|
279
|
-
* instead of calling this helper
|
|
278
|
+
* instead of calling this helper directly.
|
|
280
279
|
*
|
|
281
280
|
* @category config
|
|
282
281
|
*/
|
|
@@ -288,7 +287,7 @@ declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOp
|
|
|
288
287
|
* from {@link cursorConfig}.
|
|
289
288
|
* Omitting `CURSOR_API_KEY` only means no default API-key-based auth will be
|
|
290
289
|
* set; callers can still provide credentials via {@link agentOptionsFromConfig}
|
|
291
|
-
* overrides or the
|
|
290
|
+
* overrides or the config-first service helpers on {@link CursorAgentService}.
|
|
292
291
|
*
|
|
293
292
|
* If the API key is not set, it will log a warning message.
|
|
294
293
|
*
|
|
@@ -299,7 +298,7 @@ declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOp
|
|
|
299
298
|
* ```ts
|
|
300
299
|
* const config = yield* loadCursorConfig
|
|
301
300
|
* const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })
|
|
302
|
-
* // Or use CursorAgentService.
|
|
301
|
+
* // Or use CursorAgentService.create(config, { local: { cwd: process.cwd() } })
|
|
303
302
|
* ```
|
|
304
303
|
*
|
|
305
304
|
* To change the way that the environment variables are loaded,
|
|
@@ -327,7 +326,7 @@ declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOp
|
|
|
327
326
|
* @remarks
|
|
328
327
|
* This effect is the preferred entry for redacted environment defaults.
|
|
329
328
|
* Pair it with {@link agentOptionsFromConfig} or `CursorAgentService` helpers
|
|
330
|
-
* such as `
|
|
329
|
+
* such as `create`, `resume`, `prompt`, and `scoped`.
|
|
331
330
|
*
|
|
332
331
|
* @category config
|
|
333
332
|
*/
|
|
@@ -364,29 +363,19 @@ declare const loadCursorConfig: Effect.Effect<CursorConfig, Config.ConfigError,
|
|
|
364
363
|
* @see {@link CursorArtifactService} for artifact APIs on an SDK agent.
|
|
365
364
|
*
|
|
366
365
|
* @remarks
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* This factory remains the low-level adapter for tests and advanced overrides.
|
|
366
|
+
* Application code should use {@link CursorAgentService} with
|
|
367
|
+
* {@link loadCursorConfig} and config-first `create` / `resume` / `prompt` /
|
|
368
|
+
* `scoped` helpers. This factory remains the low-level adapter for tests and
|
|
369
|
+
* advanced overrides.
|
|
372
370
|
*
|
|
373
371
|
* @category services
|
|
374
372
|
*/
|
|
375
373
|
interface CursorSdkFactoryShape {
|
|
376
|
-
/**
|
|
377
|
-
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
378
|
-
* Low-level adapter to `Agent.create`.
|
|
379
|
-
*/
|
|
374
|
+
/** Low-level adapter to `Agent.create`. */
|
|
380
375
|
readonly create: (options: AgentOptions) => Promise<SDKAgent>;
|
|
381
|
-
/**
|
|
382
|
-
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
383
|
-
* Low-level adapter to `Agent.resume`.
|
|
384
|
-
*/
|
|
376
|
+
/** Low-level adapter to `Agent.resume`. */
|
|
385
377
|
readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Promise<SDKAgent>;
|
|
386
|
-
/**
|
|
387
|
-
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
388
|
-
* Low-level adapter to `Agent.prompt`.
|
|
389
|
-
*/
|
|
378
|
+
/** Low-level adapter to `Agent.prompt`. */
|
|
390
379
|
readonly prompt: (message: string, options?: AgentOptions) => Promise<RunResult>;
|
|
391
380
|
readonly listAgents: (options?: ListAgentsOptions) => Promise<ListResult<SDKAgentInfo>>;
|
|
392
381
|
readonly listRuns: (agentId: string, options?: ListRunsOptions) => Promise<ListResult<Run>>;
|
|
@@ -432,80 +421,46 @@ declare class CursorSdkFactory extends CursorSdkFactory_base {
|
|
|
432
421
|
* Agent lifecycle surface backed by the Cursor SDK.
|
|
433
422
|
*
|
|
434
423
|
* @remarks
|
|
435
|
-
*
|
|
436
|
-
* {@link CursorAgentServiceShape.
|
|
437
|
-
* {@link CursorAgentServiceShape.
|
|
438
|
-
* {@link CursorAgentServiceShape.
|
|
424
|
+
* Use {@link loadCursorConfig} with {@link CursorAgentServiceShape.create},
|
|
425
|
+
* {@link CursorAgentServiceShape.resume},
|
|
426
|
+
* {@link CursorAgentServiceShape.prompt}, and
|
|
427
|
+
* {@link CursorAgentServiceShape.scoped}
|
|
439
428
|
* so secrets stay in `Redacted` form until {@link agentOptionsFromConfig}
|
|
440
|
-
* merges into SDK {@link AgentOptions}
|
|
441
|
-
* are deprecated; see `DEPRECATIONS.md` and the README at the package root.
|
|
429
|
+
* merges into SDK {@link AgentOptions} at the SDK boundary.
|
|
442
430
|
*/
|
|
443
431
|
interface CursorAgentServiceShape {
|
|
444
|
-
/**
|
|
445
|
-
* @deprecated Prefer {@link CursorAgentServiceShape.createFromConfig} with {@link loadCursorConfig}
|
|
446
|
-
* instead of raw {@link AgentOptions} (including a plain `apiKey` string). Next major: `createFromConfig`
|
|
447
|
-
* is planned to become `create` with the same parameters.
|
|
448
|
-
*/
|
|
449
|
-
readonly create: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
450
432
|
/**
|
|
451
433
|
* Create an agent from {@link CursorConfig} and optional SDK overrides.
|
|
452
434
|
*
|
|
453
|
-
* @remarks
|
|
454
|
-
* Next major: planned rename to `create` with the same signature once plain-`AgentOptions` entry points are removed.
|
|
455
|
-
*
|
|
456
435
|
* @see {@link loadCursorConfig}
|
|
457
436
|
* @see {@link agentOptionsFromConfig}
|
|
458
437
|
*/
|
|
459
|
-
readonly
|
|
460
|
-
/**
|
|
461
|
-
* @deprecated Prefer {@link CursorAgentServiceShape.resumeFromConfig} with {@link loadCursorConfig}
|
|
462
|
-
* instead of raw {@link AgentOptions}. Next major: `resumeFromConfig` is planned to become `resume` with the same parameters.
|
|
463
|
-
*/
|
|
464
|
-
readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
438
|
+
readonly create: (config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
465
439
|
/**
|
|
466
440
|
* Resume an agent from {@link CursorConfig} and optional SDK overrides.
|
|
467
441
|
*
|
|
468
|
-
* @remarks
|
|
469
|
-
* Next major: planned rename to `resume` with the same signature once plain-`AgentOptions` entry points are removed.
|
|
470
|
-
*
|
|
471
442
|
* @see {@link loadCursorConfig}
|
|
472
443
|
* @see {@link agentOptionsFromConfig}
|
|
473
444
|
*/
|
|
474
|
-
readonly
|
|
475
|
-
/**
|
|
476
|
-
* @deprecated Prefer {@link CursorAgentServiceShape.promptFromConfig} with {@link loadCursorConfig}
|
|
477
|
-
* instead of raw {@link AgentOptions}. Next major: `promptFromConfig` is planned to become `prompt` with the same parameters.
|
|
478
|
-
*/
|
|
479
|
-
readonly prompt: (message: string, options?: AgentOptions) => Effect.Effect<RunResult, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
445
|
+
readonly resume: (agentId: string, config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
480
446
|
/**
|
|
481
447
|
* One-shot prompt from {@link CursorConfig} and optional SDK overrides.
|
|
482
448
|
*
|
|
483
|
-
* @remarks
|
|
484
|
-
* Next major: planned rename to `prompt` with the same signature once plain-`AgentOptions` entry points are removed.
|
|
485
|
-
*
|
|
486
449
|
* @see {@link loadCursorConfig}
|
|
487
450
|
* @see {@link agentOptionsFromConfig}
|
|
488
451
|
*/
|
|
489
|
-
readonly
|
|
452
|
+
readonly prompt: (message: string, config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<RunResult, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
490
453
|
readonly send: (agent: SDKAgent, message: string | SDKUserMessage, options?: SendOptions) => Effect.Effect<Run, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
491
454
|
readonly reload: (agent: SDKAgent) => Effect.Effect<void, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
492
455
|
readonly close: (agent: SDKAgent) => Effect.Effect<void>;
|
|
493
456
|
readonly dispose: (agent: SDKAgent) => Effect.Effect<void, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError>;
|
|
494
|
-
/**
|
|
495
|
-
* @deprecated Prefer {@link CursorAgentServiceShape.scopedFromConfig} with {@link loadCursorConfig}
|
|
496
|
-
* instead of raw {@link AgentOptions}. Next major: `scopedFromConfig` is planned to become `scoped` with the same parameters.
|
|
497
|
-
*/
|
|
498
|
-
readonly scoped: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError, Scope.Scope>;
|
|
499
457
|
/**
|
|
500
458
|
* Acquire an agent in a scope from {@link CursorConfig} and optional SDK overrides.
|
|
501
459
|
*
|
|
502
|
-
* @remarks
|
|
503
|
-
* Next major: planned rename to `scoped` with the same signature once plain-`AgentOptions` entry points are removed.
|
|
504
|
-
*
|
|
505
460
|
* @see {@link loadCursorConfig}
|
|
506
461
|
* @see {@link agentOptionsFromConfig}
|
|
507
462
|
*/
|
|
508
|
-
readonly
|
|
463
|
+
readonly scoped: (config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorAgentBusyError | CursorNetworkError | CursorUnknownError, Scope.Scope>;
|
|
509
464
|
}
|
|
510
465
|
declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService, "effect-cursor-sdk/cursor-agent/CursorAgentService", CursorAgentServiceShape>;
|
|
511
466
|
/**
|
|
@@ -523,7 +478,7 @@ declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService,
|
|
|
523
478
|
* const program = Effect.gen(function*() {
|
|
524
479
|
* const agents = yield* CursorAgentService
|
|
525
480
|
* const config = yield* loadCursorConfig
|
|
526
|
-
* const agent = yield* agents.
|
|
481
|
+
* const agent = yield* agents.create(config, {
|
|
527
482
|
* model: { id: "composer-2" },
|
|
528
483
|
* local: { cwd: process.cwd() },
|
|
529
484
|
* })
|
|
@@ -535,11 +490,9 @@ declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService,
|
|
|
535
490
|
* @see {@link CursorSdkFactory} for replacing SDK construction in tests.
|
|
536
491
|
*
|
|
537
492
|
* @remarks
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* {@link CursorAgentServiceShape.
|
|
541
|
-
* See `DEPRECATIONS.md` at the package root for migration and planned next-major renames
|
|
542
|
-
* (`createFromConfig` → `create`, etc.).
|
|
493
|
+
* Load defaults with {@link loadCursorConfig}, then call {@link CursorAgentServiceShape.create},
|
|
494
|
+
* {@link CursorAgentServiceShape.resume}, {@link CursorAgentServiceShape.prompt}, or
|
|
495
|
+
* {@link CursorAgentServiceShape.scoped} with optional SDK overrides.
|
|
543
496
|
*
|
|
544
497
|
* @category services
|
|
545
498
|
*/
|
|
@@ -974,7 +927,7 @@ declare class CursorRunService extends CursorRunService_base {
|
|
|
974
927
|
*
|
|
975
928
|
* @category layers
|
|
976
929
|
*/
|
|
977
|
-
declare const liveLayer: Layer.Layer<
|
|
930
|
+
declare const liveLayer: Layer.Layer<CursorSdkFactory | CursorInspectionService | CursorAgentService | CursorRunService | CursorArtifactService, never, never>;
|
|
978
931
|
/**
|
|
979
932
|
* Deterministic mock layer for tests and examples.
|
|
980
933
|
*
|
|
@@ -992,7 +945,7 @@ declare const liveLayer: Layer.Layer<CursorAgentService | CursorSdkFactory | Cur
|
|
|
992
945
|
*
|
|
993
946
|
* @category layers
|
|
994
947
|
*/
|
|
995
|
-
declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<
|
|
948
|
+
declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorSdkFactory | CursorInspectionService | CursorAgentService | CursorRunService | CursorArtifactService, never, never>;
|
|
996
949
|
/**
|
|
997
950
|
* Ready-made live runtime.
|
|
998
951
|
*
|
|
@@ -1008,7 +961,7 @@ declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorAg
|
|
|
1008
961
|
*
|
|
1009
962
|
* @category runtimes
|
|
1010
963
|
*/
|
|
1011
|
-
declare const liveRuntime: ManagedRuntime.ManagedRuntime<
|
|
964
|
+
declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorSdkFactory | CursorInspectionService | CursorAgentService | CursorRunService | CursorArtifactService, never>;
|
|
1012
965
|
/**
|
|
1013
966
|
* Ready-made mock runtime.
|
|
1014
967
|
*
|
|
@@ -1025,7 +978,7 @@ declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorAgentService | Cu
|
|
|
1025
978
|
*
|
|
1026
979
|
* @category runtimes
|
|
1027
980
|
*/
|
|
1028
|
-
declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<
|
|
981
|
+
declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<CursorSdkFactory | CursorInspectionService | CursorAgentService | CursorRunService | CursorArtifactService, never>;
|
|
1029
982
|
//#endregion
|
|
1030
983
|
//#region src/cursor-telemetry.d.ts
|
|
1031
984
|
/**
|