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/dist/index.js CHANGED
@@ -149,11 +149,10 @@ const CursorLocalCwd = Schema.String.pipe(Schema.brand("CursorLocalCwd"));
149
149
  * {@link AgentOptions} at the SDK boundary.
150
150
  *
151
151
  * @remarks
152
- * **Preferred path:** Load defaults with {@link loadCursorConfig}, then call
153
- * `CursorAgentService` methods such as `createFromConfig` (and related helpers)
154
- * or merge manually with {@link agentOptionsFromConfig}. Passing plain
155
- * {@link AgentOptions} directly to deprecated `create` / `resume` / `prompt` /
156
- * `scoped` overloads may be removed in a future major version.
152
+ * Load defaults with {@link loadCursorConfig}, then call
153
+ * `CursorAgentService` methods such as `create`, `resume`, `prompt`, and
154
+ * `scoped`, or merge manually with {@link agentOptionsFromConfig} for advanced
155
+ * SDK-factory wiring.
157
156
  *
158
157
  * @example
159
158
  * ```ts
@@ -201,7 +200,7 @@ const cursorConfig = Config.all({
201
200
  * Build SDK `AgentOptions` from wrapper config and optional overrides.
202
201
  *
203
202
  * This is the adapter from typed, redacted {@link CursorConfig} to the SDK's
204
- * plain-string `apiKey` boundary. Prefer `CursorAgentService.createFromConfig`
203
+ * plain-string `apiKey` boundary. Prefer `CursorAgentService.create`
205
204
  * (and related methods) over building {@link AgentOptions} by hand.
206
205
  *
207
206
  * @param config - Wrapper-owned environment defaults.
@@ -223,7 +222,7 @@ const cursorConfig = Config.all({
223
222
  * @remarks
224
223
  * Explicit override values always win over environment-derived defaults.
225
224
  * For application code, prefer service methods that take {@link CursorConfig}
226
- * instead of calling this helper and then the deprecated `create` overload.
225
+ * instead of calling this helper directly.
227
226
  *
228
227
  * @category config
229
228
  */
@@ -248,7 +247,7 @@ const agentOptionsFromConfig = (config, overrides = {}) => {
248
247
  * from {@link cursorConfig}.
249
248
  * Omitting `CURSOR_API_KEY` only means no default API-key-based auth will be
250
249
  * set; callers can still provide credentials via {@link agentOptionsFromConfig}
251
- * overrides or the `*FromConfig` service helpers.
250
+ * overrides or the config-first service helpers on {@link CursorAgentService}.
252
251
  *
253
252
  * If the API key is not set, it will log a warning message.
254
253
  *
@@ -259,7 +258,7 @@ const agentOptionsFromConfig = (config, overrides = {}) => {
259
258
  * ```ts
260
259
  * const config = yield* loadCursorConfig
261
260
  * const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })
262
- * // Or use CursorAgentService.createFromConfig(config, { local: { cwd: process.cwd() } })
261
+ * // Or use CursorAgentService.create(config, { local: { cwd: process.cwd() } })
263
262
  * ```
264
263
  *
265
264
  * To change the way that the environment variables are loaded,
@@ -287,7 +286,7 @@ const agentOptionsFromConfig = (config, overrides = {}) => {
287
286
  * @remarks
288
287
  * This effect is the preferred entry for redacted environment defaults.
289
288
  * Pair it with {@link agentOptionsFromConfig} or `CursorAgentService` helpers
290
- * such as `createFromConfig`.
289
+ * such as `create`, `resume`, `prompt`, and `scoped`.
291
290
  *
292
291
  * @category config
293
292
  */
@@ -569,7 +568,7 @@ const instrument = (operation, effect) => {
569
568
  * const program = Effect.gen(function*() {
570
569
  * const agents = yield* CursorAgentService
571
570
  * const config = yield* loadCursorConfig
572
- * const agent = yield* agents.createFromConfig(config, {
571
+ * const agent = yield* agents.create(config, {
573
572
  * model: { id: "composer-2" },
574
573
  * local: { cwd: process.cwd() },
575
574
  * })
@@ -581,18 +580,16 @@ const instrument = (operation, effect) => {
581
580
  * @see {@link CursorSdkFactory} for replacing SDK construction in tests.
582
581
  *
583
582
  * @remarks
584
- * Prefer {@link CursorAgentServiceShape.createFromConfig} and related methods
585
- * with {@link loadCursorConfig}; raw {@link AgentOptions} on
586
- * {@link CursorAgentServiceShape.create} and siblings are deprecated.
587
- * See `DEPRECATIONS.md` at the package root for migration and planned next-major renames
588
- * (`createFromConfig` → `create`, etc.).
583
+ * Load defaults with {@link loadCursorConfig}, then call {@link CursorAgentServiceShape.create},
584
+ * {@link CursorAgentServiceShape.resume}, {@link CursorAgentServiceShape.prompt}, or
585
+ * {@link CursorAgentServiceShape.scoped} with optional SDK overrides.
589
586
  *
590
587
  * @category services
591
588
  */
592
589
  var CursorAgentService = class CursorAgentService extends Context.Service()("effect-cursor-sdk/cursor-agent/CursorAgentService") {
593
590
  static Live = Layer.effect(CursorAgentService)(Effect.gen(function* () {
594
591
  const sdk = yield* CursorSdkFactory;
595
- const create = (options) => {
592
+ const createWithOptions = (options) => {
596
593
  return instrument("agent.create", Effect.tryPromise({
597
594
  try: () => sdk.create(options),
598
595
  catch: (cause) => {
@@ -600,7 +597,7 @@ var CursorAgentService = class CursorAgentService extends Context.Service()("eff
600
597
  }
601
598
  }));
602
599
  };
603
- const resume = (agentId, options) => {
600
+ const resumeWithOptions = (agentId, options) => {
604
601
  return instrument("agent.resume", Effect.tryPromise({
605
602
  try: () => sdk.resume(agentId, options),
606
603
  catch: (cause) => {
@@ -611,7 +608,7 @@ var CursorAgentService = class CursorAgentService extends Context.Service()("eff
611
608
  }
612
609
  }));
613
610
  };
614
- const prompt = (message, options) => {
611
+ const promptWithOptions = (message, options) => {
615
612
  return instrument("agent.prompt", Effect.tryPromise({
616
613
  try: () => sdk.prompt(message, options),
617
614
  catch: (cause) => {
@@ -655,36 +652,29 @@ var CursorAgentService = class CursorAgentService extends Context.Service()("eff
655
652
  }
656
653
  }));
657
654
  };
658
- const scoped = (options) => {
659
- return Effect.acquireRelease(create(options), (agent) => {
660
- return Effect.ignore(dispose(agent));
661
- });
662
- };
663
- const createFromConfig = (config, overrides = {}) => {
664
- return create(agentOptionsFromConfig(config, overrides));
655
+ const create = (config, overrides = {}) => {
656
+ return createWithOptions(agentOptionsFromConfig(config, overrides));
665
657
  };
666
- const resumeFromConfig = (agentId, config, overrides = {}) => {
667
- return resume(agentId, agentOptionsFromConfig(config, overrides));
658
+ const resume = (agentId, config, overrides = {}) => {
659
+ return resumeWithOptions(agentId, agentOptionsFromConfig(config, overrides));
668
660
  };
669
- const promptFromConfig = (message, config, overrides = {}) => {
670
- return prompt(message, agentOptionsFromConfig(config, overrides));
661
+ const prompt = (message, config, overrides = {}) => {
662
+ return promptWithOptions(message, agentOptionsFromConfig(config, overrides));
671
663
  };
672
- const scopedFromConfig = (config, overrides = {}) => {
673
- return scoped(agentOptionsFromConfig(config, overrides));
664
+ const scoped = (config, overrides = {}) => {
665
+ return Effect.acquireRelease(createWithOptions(agentOptionsFromConfig(config, overrides)), (agent) => {
666
+ return Effect.ignore(dispose(agent));
667
+ });
674
668
  };
675
669
  return {
676
670
  create,
677
- createFromConfig,
678
671
  resume,
679
- resumeFromConfig,
680
672
  prompt,
681
- promptFromConfig,
682
673
  send,
683
674
  reload,
684
675
  close,
685
676
  dispose,
686
- scoped,
687
- scopedFromConfig
677
+ scoped
688
678
  };
689
679
  }));
690
680
  };