effect-cursor-sdk 0.1.1 → 0.2.0
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/README.md +148 -59
- package/dist/index.d.ts +244 -154
- package/dist/index.js +209 -158
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,164 @@ declare function mapCursorError(cause: unknown, context: CursorErrorContext & {
|
|
|
156
156
|
}): CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnsupportedOperationError | CursorUnknownError;
|
|
157
157
|
declare function mapCursorError(cause: unknown, context: CursorErrorContext): CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError;
|
|
158
158
|
//#endregion
|
|
159
|
+
//#region src/cursor-config.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* Branded secret material for the Cursor API key.
|
|
162
|
+
*
|
|
163
|
+
* Values are held inside {@link Redacted} on {@link CursorConfig}; this schema
|
|
164
|
+
* only brands the decoded plaintext type so it cannot be confused with other
|
|
165
|
+
* strings at the type level.
|
|
166
|
+
*/
|
|
167
|
+
declare const CursorApiKey: Schema.brand<Schema.Redacted<Schema.String>, "CursorApiKey">;
|
|
168
|
+
type CursorApiKey = typeof CursorApiKey.Type;
|
|
169
|
+
/**
|
|
170
|
+
* Branded model identifier from wrapper config.
|
|
171
|
+
*
|
|
172
|
+
* Populated from the `CURSOR_MODEL` environment variable when using
|
|
173
|
+
* {@link loadCursorConfig}.
|
|
174
|
+
*/
|
|
175
|
+
declare const CursorModelId: Schema.brand<Schema.String, "CursorModelId">;
|
|
176
|
+
type CursorModelId = typeof CursorModelId.Type;
|
|
177
|
+
/**
|
|
178
|
+
* Branded local working directory for agent runs.
|
|
179
|
+
*
|
|
180
|
+
* Populated from `CURSOR_LOCAL_CWD` when using {@link loadCursorConfig}.
|
|
181
|
+
*/
|
|
182
|
+
declare const CursorLocalCwd: Schema.brand<Schema.String, "CursorLocalCwd">;
|
|
183
|
+
type CursorLocalCwd = typeof CursorLocalCwd.Type;
|
|
184
|
+
declare const CursorConfig_base: Schema.Class<CursorConfig, Schema.Struct<{
|
|
185
|
+
readonly apiKey: Schema.optional<Schema.brand<Schema.Redacted<Schema.String>, "CursorApiKey">>;
|
|
186
|
+
readonly modelId: Schema.optional<Schema.brand<Schema.String, "CursorModelId">>;
|
|
187
|
+
readonly cwd: Schema.optional<Schema.brand<Schema.String, "CursorLocalCwd">>;
|
|
188
|
+
}>, {}>;
|
|
189
|
+
/**
|
|
190
|
+
* Minimal configuration owned by this wrapper.
|
|
191
|
+
*
|
|
192
|
+
* The SDK's `AgentOptions` type remains the source of truth for complete
|
|
193
|
+
* runtime options. This schema models environment-derived defaults only.
|
|
194
|
+
* Use {@link agentOptionsFromConfig} to merge those defaults into SDK-owned
|
|
195
|
+
* {@link AgentOptions} at the SDK boundary.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* **Preferred path:** Load defaults with {@link loadCursorConfig}, then call
|
|
199
|
+
* `CursorAgentService` methods such as `createFromConfig` (and related helpers)
|
|
200
|
+
* or merge manually with {@link agentOptionsFromConfig}. Passing plain
|
|
201
|
+
* {@link AgentOptions} directly to deprecated `create` / `resume` / `prompt` /
|
|
202
|
+
* `scoped` overloads may be removed in a future major version.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const config = new CursorConfig({
|
|
207
|
+
* apiKey: Redacted.make(CursorApiKey.make(process.env.CURSOR_API_KEY!)),
|
|
208
|
+
* modelId: CursorModelId.make("composer-2"),
|
|
209
|
+
* cwd: CursorLocalCwd.make(process.cwd())
|
|
210
|
+
* })
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @see {@link cursorConfig}
|
|
214
|
+
* @see {@link loadCursorConfig}
|
|
215
|
+
*
|
|
216
|
+
* @category config
|
|
217
|
+
*/
|
|
218
|
+
declare class CursorConfig extends CursorConfig_base {}
|
|
219
|
+
/**
|
|
220
|
+
* Effect Config descriptors for common Cursor environment variables.
|
|
221
|
+
*
|
|
222
|
+
* Reads `CURSOR_API_KEY`, `CURSOR_MODEL`, and `CURSOR_LOCAL_CWD` from the active
|
|
223
|
+
* Effect {@link ConfigProvider.ConfigProvider}. All fields are optional so
|
|
224
|
+
* callers can merge with explicit overrides via {@link agentOptionsFromConfig}.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* const config = yield* loadCursorConfig
|
|
229
|
+
* const options = agentOptionsFromConfig(config)
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @see {@link Config}
|
|
233
|
+
* @see {@link loadCursorConfig}
|
|
234
|
+
*
|
|
235
|
+
* @category config
|
|
236
|
+
*/
|
|
237
|
+
declare const cursorConfig: Config.Config<{
|
|
238
|
+
apiKey: Option.Option<Redacted.Redacted<string>>;
|
|
239
|
+
modelId: Option.Option<string>;
|
|
240
|
+
cwd: Option.Option<string>;
|
|
241
|
+
}>;
|
|
242
|
+
/**
|
|
243
|
+
* Build SDK `AgentOptions` from wrapper config and optional overrides.
|
|
244
|
+
*
|
|
245
|
+
* This is the adapter from typed, redacted {@link CursorConfig} to the SDK's
|
|
246
|
+
* plain-string `apiKey` boundary. Prefer `CursorAgentService.createFromConfig`
|
|
247
|
+
* (and related methods) over building {@link AgentOptions} by hand.
|
|
248
|
+
*
|
|
249
|
+
* @param config - Wrapper-owned environment defaults.
|
|
250
|
+
* @param overrides - Complete or partial SDK-owned options to merge over the defaults.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* const options = agentOptionsFromConfig(config, {
|
|
255
|
+
* cloud: {
|
|
256
|
+
* repos: [{ url: "https://github.com/acme/app" }],
|
|
257
|
+
* autoCreatePR: true
|
|
258
|
+
* }
|
|
259
|
+
* })
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @see {@link CursorConfig}
|
|
263
|
+
* @see {@link AgentOptions}
|
|
264
|
+
*
|
|
265
|
+
* @remarks
|
|
266
|
+
* Explicit override values always win over environment-derived defaults.
|
|
267
|
+
* For application code, prefer service methods that take {@link CursorConfig}
|
|
268
|
+
* instead of calling this helper and then the deprecated `create` overload.
|
|
269
|
+
*
|
|
270
|
+
* @category config
|
|
271
|
+
*/
|
|
272
|
+
declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOptions) => AgentOptions;
|
|
273
|
+
/**
|
|
274
|
+
* Load environment-derived defaults as a schema-backed value.
|
|
275
|
+
* It uses ConfigProvider to load the environment variables
|
|
276
|
+
* with their default names (`CURSOR_API_KEY`, `CURSOR_MODEL`, `CURSOR_LOCAL_CWD`)
|
|
277
|
+
* from {@link cursorConfig}.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* const config = yield* loadCursorConfig
|
|
282
|
+
* const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })
|
|
283
|
+
* // Or use CursorAgentService.createFromConfig(config, { local: { cwd: process.cwd() } })
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* To change the way that the environment variables are loaded,
|
|
287
|
+
* you can do it with Effect by providing a custom ConfigProvider.
|
|
288
|
+
*
|
|
289
|
+
* ```ts
|
|
290
|
+
* // For example: load via custom environment object
|
|
291
|
+
* const config = yield* loadCursorConfig.pipe(
|
|
292
|
+
* Effect.provideService(
|
|
293
|
+
* ConfigProvider.ConfigProvider,
|
|
294
|
+
* ConfigProvider.fromEnv({
|
|
295
|
+
* env: {
|
|
296
|
+
* CURSOR_API_KEY: "crsr_******",
|
|
297
|
+
* CURSOR_MODEL: "composer-2",
|
|
298
|
+
* CURSOR_LOCAL_CWD: "/workspace",
|
|
299
|
+
* },
|
|
300
|
+
* }),
|
|
301
|
+
* ),
|
|
302
|
+
* )
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* @see {@link cursorConfig}
|
|
306
|
+
* @see {@link agentOptionsFromConfig}
|
|
307
|
+
*
|
|
308
|
+
* @remarks
|
|
309
|
+
* This effect is the preferred entry for redacted environment defaults.
|
|
310
|
+
* Pair it with {@link agentOptionsFromConfig} or `CursorAgentService` helpers
|
|
311
|
+
* such as `createFromConfig`.
|
|
312
|
+
*
|
|
313
|
+
* @category config
|
|
314
|
+
*/
|
|
315
|
+
declare const loadCursorConfig: Effect.Effect<CursorConfig, Config.ConfigError, never>;
|
|
316
|
+
//#endregion
|
|
159
317
|
//#region src/cursor-sdk-factory.d.ts
|
|
160
318
|
/**
|
|
161
319
|
* Thin boundary around the static `@cursor/sdk` APIs.
|
|
@@ -187,17 +345,29 @@ declare function mapCursorError(cause: unknown, context: CursorErrorContext): Cu
|
|
|
187
345
|
* @see {@link CursorArtifactService} for artifact APIs on an SDK agent.
|
|
188
346
|
*
|
|
189
347
|
* @remarks
|
|
190
|
-
* **
|
|
191
|
-
* {@link AgentOptions}
|
|
192
|
-
* {@link
|
|
193
|
-
*
|
|
194
|
-
*
|
|
348
|
+
* **Deprecated for application code:** `create`, `resume`, and `prompt` accept
|
|
349
|
+
* raw {@link AgentOptions} (including a plain `apiKey` string). Prefer
|
|
350
|
+
* {@link CursorAgentService} with `loadCursorConfig` and `createFromConfig` /
|
|
351
|
+
* `resumeFromConfig` / `promptFromConfig` from this package instead.
|
|
352
|
+
* This factory remains the low-level adapter for tests and advanced overrides.
|
|
195
353
|
*
|
|
196
354
|
* @category services
|
|
197
355
|
*/
|
|
198
356
|
interface CursorSdkFactoryShape {
|
|
357
|
+
/**
|
|
358
|
+
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
359
|
+
* Low-level adapter to `Agent.create`.
|
|
360
|
+
*/
|
|
199
361
|
readonly create: (options: AgentOptions) => Promise<SDKAgent>;
|
|
362
|
+
/**
|
|
363
|
+
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
364
|
+
* Low-level adapter to `Agent.resume`.
|
|
365
|
+
*/
|
|
200
366
|
readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Promise<SDKAgent>;
|
|
367
|
+
/**
|
|
368
|
+
* @deprecated Prefer {@link CursorAgentService} with config-based helpers.
|
|
369
|
+
* Low-level adapter to `Agent.prompt`.
|
|
370
|
+
*/
|
|
201
371
|
readonly prompt: (message: string, options?: AgentOptions) => Promise<RunResult>;
|
|
202
372
|
readonly listAgents: (options?: ListAgentsOptions) => Promise<ListResult<SDKAgentInfo>>;
|
|
203
373
|
readonly listRuns: (agentId: string, options?: ListRunsOptions) => Promise<ListResult<Run>>;
|
|
@@ -220,9 +390,13 @@ declare const CursorSdkFactory_base: Context.ServiceClass<CursorSdkFactory, "eff
|
|
|
220
390
|
*
|
|
221
391
|
* @example
|
|
222
392
|
* ```ts
|
|
393
|
+
* import { CursorSdkFactory, agentOptionsFromConfig, loadCursorConfig } from "effect-cursor-sdk"
|
|
394
|
+
* import { Effect } from "effect"
|
|
395
|
+
*
|
|
223
396
|
* const program = Effect.gen(function*() {
|
|
224
397
|
* const sdk = yield* CursorSdkFactory
|
|
225
|
-
*
|
|
398
|
+
* const config = yield* loadCursorConfig
|
|
399
|
+
* return sdk.create(agentOptionsFromConfig(config, { model: { id: "composer-2" } }))
|
|
226
400
|
* })
|
|
227
401
|
* ```
|
|
228
402
|
*
|
|
@@ -239,22 +413,67 @@ declare class CursorSdkFactory extends CursorSdkFactory_base {
|
|
|
239
413
|
* Agent lifecycle surface backed by the Cursor SDK.
|
|
240
414
|
*
|
|
241
415
|
* @remarks
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
416
|
+
* Prefer {@link loadCursorConfig} with {@link CursorAgentServiceShape.createFromConfig},
|
|
417
|
+
* {@link CursorAgentServiceShape.resumeFromConfig},
|
|
418
|
+
* {@link CursorAgentServiceShape.promptFromConfig}, and
|
|
419
|
+
* {@link CursorAgentServiceShape.scopedFromConfig}
|
|
420
|
+
* so secrets stay in `Redacted` form until {@link agentOptionsFromConfig}
|
|
421
|
+
* merges into SDK {@link AgentOptions}. Plain {@link AgentOptions} entry points
|
|
422
|
+
* are deprecated; see the package README.
|
|
248
423
|
*/
|
|
249
424
|
interface CursorAgentServiceShape {
|
|
425
|
+
/**
|
|
426
|
+
* @deprecated Use {@link CursorAgentServiceShape.createFromConfig} with {@link loadCursorConfig} instead
|
|
427
|
+
* of passing raw {@link AgentOptions} (including a plain `apiKey` string).
|
|
428
|
+
*/
|
|
250
429
|
readonly create: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
430
|
+
/**
|
|
431
|
+
* Create an agent from {@link CursorConfig} and optional SDK overrides.
|
|
432
|
+
*
|
|
433
|
+
* @see {@link loadCursorConfig}
|
|
434
|
+
* @see {@link agentOptionsFromConfig}
|
|
435
|
+
*/
|
|
436
|
+
readonly createFromConfig: (config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated Use {@link CursorAgentServiceShape.resumeFromConfig} with {@link loadCursorConfig} instead
|
|
439
|
+
* of passing raw {@link AgentOptions}.
|
|
440
|
+
*/
|
|
251
441
|
readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
442
|
+
/**
|
|
443
|
+
* Resume an agent from {@link CursorConfig} and optional SDK overrides.
|
|
444
|
+
*
|
|
445
|
+
* @see {@link loadCursorConfig}
|
|
446
|
+
* @see {@link agentOptionsFromConfig}
|
|
447
|
+
*/
|
|
448
|
+
readonly resumeFromConfig: (agentId: string, config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
449
|
+
/**
|
|
450
|
+
* @deprecated Use {@link CursorAgentServiceShape.promptFromConfig} with {@link loadCursorConfig} instead
|
|
451
|
+
* of passing raw {@link AgentOptions}.
|
|
452
|
+
*/
|
|
252
453
|
readonly prompt: (message: string, options?: AgentOptions) => Effect.Effect<RunResult, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
454
|
+
/**
|
|
455
|
+
* One-shot prompt from {@link CursorConfig} and optional SDK overrides.
|
|
456
|
+
*
|
|
457
|
+
* @see {@link loadCursorConfig}
|
|
458
|
+
* @see {@link agentOptionsFromConfig}
|
|
459
|
+
*/
|
|
460
|
+
readonly promptFromConfig: (message: string, config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<RunResult, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
253
461
|
readonly send: (agent: SDKAgent, message: string | SDKUserMessage, options?: SendOptions) => Effect.Effect<Run, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
254
462
|
readonly reload: (agent: SDKAgent) => Effect.Effect<void, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
255
463
|
readonly close: (agent: SDKAgent) => Effect.Effect<void>;
|
|
256
464
|
readonly dispose: (agent: SDKAgent) => Effect.Effect<void, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
465
|
+
/**
|
|
466
|
+
* @deprecated Use {@link CursorAgentServiceShape.scopedFromConfig} with {@link loadCursorConfig} instead
|
|
467
|
+
* of passing raw {@link AgentOptions}.
|
|
468
|
+
*/
|
|
257
469
|
readonly scoped: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError, Scope.Scope>;
|
|
470
|
+
/**
|
|
471
|
+
* Acquire an agent in a scope from {@link CursorConfig} and optional SDK overrides.
|
|
472
|
+
*
|
|
473
|
+
* @see {@link loadCursorConfig}
|
|
474
|
+
* @see {@link agentOptionsFromConfig}
|
|
475
|
+
*/
|
|
476
|
+
readonly scopedFromConfig: (config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError, Scope.Scope>;
|
|
258
477
|
}
|
|
259
478
|
declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService, "effect-cursor-sdk/cursor-agent/CursorAgentService", CursorAgentServiceShape>;
|
|
260
479
|
/**
|
|
@@ -266,12 +485,16 @@ declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService,
|
|
|
266
485
|
*
|
|
267
486
|
* @example
|
|
268
487
|
* ```ts
|
|
269
|
-
* import { CursorAgentService, liveLayer } from "effect-cursor-sdk"
|
|
488
|
+
* import { CursorAgentService, liveLayer, loadCursorConfig } from "effect-cursor-sdk"
|
|
270
489
|
* import { Effect } from "effect"
|
|
271
490
|
*
|
|
272
491
|
* const program = Effect.gen(function*() {
|
|
273
492
|
* const agents = yield* CursorAgentService
|
|
274
|
-
* const
|
|
493
|
+
* const config = yield* loadCursorConfig
|
|
494
|
+
* const agent = yield* agents.createFromConfig(config, {
|
|
495
|
+
* model: { id: "composer-2" },
|
|
496
|
+
* local: { cwd: process.cwd() },
|
|
497
|
+
* })
|
|
275
498
|
* return yield* agents.send(agent, "Summarize this repository")
|
|
276
499
|
* }).pipe(Effect.provide(liveLayer))
|
|
277
500
|
* ```
|
|
@@ -280,9 +503,9 @@ declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService,
|
|
|
280
503
|
* @see {@link CursorSdkFactory} for replacing SDK construction in tests.
|
|
281
504
|
*
|
|
282
505
|
* @remarks
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* {@link
|
|
506
|
+
* Prefer {@link CursorAgentServiceShape.createFromConfig} and related methods
|
|
507
|
+
* with {@link loadCursorConfig}; raw {@link AgentOptions} on
|
|
508
|
+
* {@link CursorAgentServiceShape.create} and siblings are deprecated.
|
|
286
509
|
*
|
|
287
510
|
* @category services
|
|
288
511
|
*/
|
|
@@ -314,139 +537,6 @@ declare class CursorArtifactService extends CursorArtifactService_base {
|
|
|
314
537
|
static readonly Live: Layer.Layer<CursorArtifactService, never, never>;
|
|
315
538
|
}
|
|
316
539
|
//#endregion
|
|
317
|
-
//#region src/cursor-config.d.ts
|
|
318
|
-
/**
|
|
319
|
-
* Branded secret material for the Cursor API key.
|
|
320
|
-
*
|
|
321
|
-
* Values are held inside {@link Redacted} on {@link CursorConfig}; this schema
|
|
322
|
-
* only brands the decoded plaintext type so it cannot be confused with other
|
|
323
|
-
* strings at the type level.
|
|
324
|
-
*/
|
|
325
|
-
declare const CursorApiKey: Schema.brand<Schema.Redacted<Schema.String>, "CursorApiKey">;
|
|
326
|
-
type CursorApiKey = typeof CursorApiKey.Type;
|
|
327
|
-
/**
|
|
328
|
-
* Branded model identifier from wrapper config.
|
|
329
|
-
*
|
|
330
|
-
* Populated from the `CURSOR_MODEL` environment variable when using
|
|
331
|
-
* {@link loadCursorConfig}.
|
|
332
|
-
*/
|
|
333
|
-
declare const CursorModelId: Schema.brand<Schema.String, "CursorModelId">;
|
|
334
|
-
type CursorModelId = typeof CursorModelId.Type;
|
|
335
|
-
/**
|
|
336
|
-
* Branded local working directory for agent runs.
|
|
337
|
-
*
|
|
338
|
-
* Populated from `CURSOR_LOCAL_CWD` when using {@link loadCursorConfig}.
|
|
339
|
-
*/
|
|
340
|
-
declare const CursorLocalCwd: Schema.brand<Schema.String, "CursorLocalCwd">;
|
|
341
|
-
type CursorLocalCwd = typeof CursorLocalCwd.Type;
|
|
342
|
-
declare const CursorConfig_base: Schema.Class<CursorConfig, Schema.Struct<{
|
|
343
|
-
readonly apiKey: Schema.optional<Schema.brand<Schema.Redacted<Schema.String>, "CursorApiKey">>;
|
|
344
|
-
readonly modelId: Schema.optional<Schema.brand<Schema.String, "CursorModelId">>;
|
|
345
|
-
readonly cwd: Schema.optional<Schema.brand<Schema.String, "CursorLocalCwd">>;
|
|
346
|
-
}>, {}>;
|
|
347
|
-
/**
|
|
348
|
-
* Minimal configuration owned by this wrapper.
|
|
349
|
-
*
|
|
350
|
-
* The SDK's `AgentOptions` type remains the source of truth for complete
|
|
351
|
-
* runtime options. This schema only models environment-derived defaults.
|
|
352
|
-
* Use {@link agentOptionsFromConfig} to merge those defaults into SDK-owned
|
|
353
|
-
* {@link AgentOptions}.
|
|
354
|
-
*
|
|
355
|
-
* @remarks
|
|
356
|
-
* **Forward path:** A future major version of this package may require all
|
|
357
|
-
* agent-related options to be supplied through this module (for example
|
|
358
|
-
* {@link loadCursorConfig} plus {@link agentOptionsFromConfig}) instead of raw
|
|
359
|
-
* {@link AgentOptions} on {@link CursorAgentService}.
|
|
360
|
-
* Prefer this path for new code.
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
* ```ts
|
|
364
|
-
* const config = new CursorConfig({
|
|
365
|
-
* apiKey: Redacted.make(CursorApiKey.make(process.env.CURSOR_API_KEY!)),
|
|
366
|
-
* modelId: CursorModelId.make("composer-2"),
|
|
367
|
-
* cwd: CursorLocalCwd.make(process.cwd())
|
|
368
|
-
* })
|
|
369
|
-
* ```
|
|
370
|
-
*
|
|
371
|
-
* @see {@link cursorConfig}
|
|
372
|
-
* @see {@link loadCursorConfig}
|
|
373
|
-
*
|
|
374
|
-
* @category config
|
|
375
|
-
*/
|
|
376
|
-
declare class CursorConfig extends CursorConfig_base {}
|
|
377
|
-
/**
|
|
378
|
-
* Effect Config descriptors for common Cursor environment variables.
|
|
379
|
-
*
|
|
380
|
-
* Reads `CURSOR_API_KEY`, `CURSOR_MODEL`, and `CURSOR_LOCAL_CWD` from the active
|
|
381
|
-
* Effect {@link ConfigProvider.ConfigProvider}. All fields are optional so
|
|
382
|
-
* callers can still pass complete SDK options explicitly.
|
|
383
|
-
*
|
|
384
|
-
* @example
|
|
385
|
-
* ```ts
|
|
386
|
-
* const config = yield* loadCursorConfig
|
|
387
|
-
* const options = agentOptionsFromConfig(config)
|
|
388
|
-
* ```
|
|
389
|
-
*
|
|
390
|
-
* @see {@link Config}
|
|
391
|
-
* @see {@link loadCursorConfig}
|
|
392
|
-
*
|
|
393
|
-
* @category config
|
|
394
|
-
*/
|
|
395
|
-
declare const cursorConfig: Config.Config<{
|
|
396
|
-
apiKey: Option.Option<Redacted.Redacted<string>>;
|
|
397
|
-
modelId: Option.Option<string>;
|
|
398
|
-
cwd: Option.Option<string>;
|
|
399
|
-
}>;
|
|
400
|
-
/**
|
|
401
|
-
* Build SDK `AgentOptions` from wrapper config and optional overrides.
|
|
402
|
-
*
|
|
403
|
-
* Explicit override values always win over environment-derived defaults.
|
|
404
|
-
*
|
|
405
|
-
* @param config - Wrapper-owned environment defaults.
|
|
406
|
-
* @param overrides - Complete or partial SDK-owned options to merge over the defaults.
|
|
407
|
-
*
|
|
408
|
-
* @example
|
|
409
|
-
* ```ts
|
|
410
|
-
* const options = agentOptionsFromConfig(config, {
|
|
411
|
-
* cloud: {
|
|
412
|
-
* repos: [{ url: "https://github.com/acme/app" }],
|
|
413
|
-
* autoCreatePR: true
|
|
414
|
-
* }
|
|
415
|
-
* })
|
|
416
|
-
* ```
|
|
417
|
-
*
|
|
418
|
-
* @see {@link CursorConfig}
|
|
419
|
-
* @see {@link AgentOptions}
|
|
420
|
-
*
|
|
421
|
-
* @remarks
|
|
422
|
-
* Same **forward path** notice as {@link CursorConfig}: this merge is the
|
|
423
|
-
* intended boundary for redacted keys and env defaults ahead of a possible
|
|
424
|
-
* requirement to use it for all agent entry points.
|
|
425
|
-
*
|
|
426
|
-
* @category config
|
|
427
|
-
*/
|
|
428
|
-
declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOptions) => AgentOptions;
|
|
429
|
-
/**
|
|
430
|
-
* Load environment-derived defaults as a schema-backed value.
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* ```ts
|
|
434
|
-
* const config = yield* loadCursorConfig
|
|
435
|
-
* const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })
|
|
436
|
-
* ```
|
|
437
|
-
*
|
|
438
|
-
* @see {@link cursorConfig}
|
|
439
|
-
* @see {@link agentOptionsFromConfig}
|
|
440
|
-
*
|
|
441
|
-
* @remarks
|
|
442
|
-
* Same **forward path** notice as {@link CursorConfig}: this effect is the
|
|
443
|
-
* intended entry for redacted env defaults ahead of a possible requirement to
|
|
444
|
-
* use it (with {@link agentOptionsFromConfig}) for all agent entry points.
|
|
445
|
-
*
|
|
446
|
-
* @category config
|
|
447
|
-
*/
|
|
448
|
-
declare const loadCursorConfig: Effect.Effect<CursorConfig, Config.ConfigError, never>;
|
|
449
|
-
//#endregion
|
|
450
540
|
//#region src/cursor-inspection.d.ts
|
|
451
541
|
interface CursorInspectionServiceShape {
|
|
452
542
|
readonly listAgents: (options?: ListAgentsOptions) => Effect.Effect<ListResult<SDKAgentInfo>, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
|
|
@@ -665,7 +755,7 @@ declare class CursorRunService extends CursorRunService_base {
|
|
|
665
755
|
*
|
|
666
756
|
* @category layers
|
|
667
757
|
*/
|
|
668
|
-
declare const liveLayer: Layer.Layer<
|
|
758
|
+
declare const liveLayer: Layer.Layer<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never, never>;
|
|
669
759
|
/**
|
|
670
760
|
* Deterministic mock layer for tests and examples.
|
|
671
761
|
*
|
|
@@ -683,7 +773,7 @@ declare const liveLayer: Layer.Layer<CursorAgentService | CursorSdkFactory | Cur
|
|
|
683
773
|
*
|
|
684
774
|
* @category layers
|
|
685
775
|
*/
|
|
686
|
-
declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<
|
|
776
|
+
declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never, never>;
|
|
687
777
|
/**
|
|
688
778
|
* Ready-made live runtime.
|
|
689
779
|
*
|
|
@@ -699,7 +789,7 @@ declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorAg
|
|
|
699
789
|
*
|
|
700
790
|
* @category runtimes
|
|
701
791
|
*/
|
|
702
|
-
declare const liveRuntime: ManagedRuntime.ManagedRuntime<
|
|
792
|
+
declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never>;
|
|
703
793
|
/**
|
|
704
794
|
* Ready-made mock runtime.
|
|
705
795
|
*
|
|
@@ -716,7 +806,7 @@ declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorAgentService | Cu
|
|
|
716
806
|
*
|
|
717
807
|
* @category runtimes
|
|
718
808
|
*/
|
|
719
|
-
declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<
|
|
809
|
+
declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never>;
|
|
720
810
|
//#endregion
|
|
721
811
|
//#region src/cursor-telemetry.d.ts
|
|
722
812
|
/**
|