effect-cursor-sdk 0.2.0 → 0.3.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.
@@ -0,0 +1,88 @@
1
+ # Deprecations
2
+
3
+ This document lists deprecated `effect-cursor-sdk` APIs, what to use instead today, and how names are expected to change in the **next major** release. Deprecated APIs remain available until that major; follow [CHANGELOG.md](./CHANGELOG.md) and release notes when upgrading.
4
+
5
+ ## Status definitions
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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # effect-cursor-sdk
2
2
 
3
- ![npm](https://img.shields.io/npm/v/effect-cursor-sdk) ![License MIT](https://img.shields.io/github/license/benjamin-kraatz/effect-cursor-sdk) ![CI](https://img.shields.io/github/actions/workflow/status/benjamin-kraatz/effect-cursor-sdk/ci.yml) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/benjamin-kraatz/effect-cursor-sdk?utm_source=oss&utm_medium=github&utm_campaign=benjamin-kraatz%2Feffect-cursor-sdk&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)
3
+ [![npm](https://img.shields.io/npm/v/effect-cursor-sdk)](https://www.npmjs.com/package/effect-cursor-sdk) ![License MIT](https://img.shields.io/github/license/benjamin-kraatz/effect-cursor-sdk) ![CI](https://img.shields.io/github/actions/workflow/status/benjamin-kraatz/effect-cursor-sdk/ci.yml) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/benjamin-kraatz/effect-cursor-sdk?utm_source=oss&utm_medium=github&utm_campaign=benjamin-kraatz%2Feffect-cursor-sdk&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)
4
4
 
5
5
  Effect-native access to the new [Cursor SDK](https://cursor.com/docs/sdk/typescript).
6
6
 
@@ -18,18 +18,25 @@ Effect-native access to the new [Cursor SDK](https://cursor.com/docs/sdk/typescr
18
18
  - Observable: SDK calls are wrapped in spans and metrics with secret redaction utilities.
19
19
  - Testable: mock layers and fixtures let applications test Cursor workflows without network calls.
20
20
 
21
+ ## Documentation
22
+
23
+ - [SDK coverage & compatibility](./docs/SDK_COVERAGE.md) — wrapper checklist, audit script, release alignment
24
+ - [Recipes](./docs/RECIPES.md) — short patterns (config-first agent, streaming, pagination, lifecycle, tests)
25
+ - [Release checklist](./docs/RELEASE_CHECKLIST.md) — gates, SDK bumps, Changesets
26
+ - [Next major migration (planned)](./docs/MIGRATION_NEXT_MAJOR.md) — config-first renames after deprecations are removed
27
+
21
28
  ## Feature Coverage
22
29
 
23
30
  | SDK capability | Effect wrapper |
24
31
  | -------------------------------------------------------------------------------- | ---------------------------------------------- |
25
32
  | `Agent.create`, `Agent.resume`, `Agent.prompt` | `CursorAgentService` |
26
33
  | `agent.send`, `reload`, `close`, async dispose | `CursorAgentService` |
27
- | `run.wait`, `stream`, `conversation`, `cancel`, status listeners, support checks | `CursorRunService` |
34
+ | `run.wait`, `stream`, `conversation`, `cancel`, status listeners / streams, support checks | `CursorRunService` |
28
35
  | `agent.listArtifacts`, `downloadArtifact` | `CursorArtifactService` |
29
36
  | `Agent.list`, `get`, `listRuns`, `getRun`, messages | `CursorInspectionService` |
30
37
  | `Agent.archive`, `unarchive`, `delete` | `CursorInspectionService` |
31
38
  | `Cursor.me`, models, repositories | `CursorInspectionService` |
32
- | MCP servers, sub-agents, local/cloud options, model options | Defaults via `CursorConfig` / `loadCursorConfig`; merged SDK `AgentOptions` (deprecated at agent entry) |
39
+ | MCP servers, sub-agents, local/cloud options, model options | Defaults via `CursorConfig` / `loadCursorConfig`; merged SDK `AgentOptions` ([deprecated](./DEPRECATIONS.md) at agent entry) |
33
40
  | Local run event helpers and platform helpers | Re-exported from `@cursor/sdk` |
34
41
 
35
42
  ## Install
@@ -310,11 +317,13 @@ const testProgram = Effect.gen(function* () {
310
317
 
311
318
  The main exports are:
312
319
 
313
- - `CursorAgentService` (prefer `createFromConfig`, `scopedFromConfig`, `promptFromConfig`, `resumeFromConfig` with `loadCursorConfig`)
320
+ - **Recipes** — common compositions (prompt text, send + collect, pagination, lifecycle guards, artifacts) in [RECIPES.md](./docs/RECIPES.md)
321
+ - **Observability helpers** (`streamEventsTracked`, `collectTextTracked`, catalog retry/timeout presets, log summaries)
322
+ - `CursorAgentService` (prefer `createFromConfig`, `scopedFromConfig`, `promptFromConfig`, `resumeFromConfig` with `loadCursorConfig`; plain `AgentOptions` at the agent boundary is [deprecated](./DEPRECATIONS.md))
314
323
  - `CursorRunService`
315
324
  - `CursorArtifactService`
316
325
  - `CursorInspectionService`
317
- - `CursorSdkFactory`
326
+ - `CursorSdkFactory` ([deprecated for application code](./DEPRECATIONS.md#other-deprecations); low-level tests and overrides)
318
327
  - `liveLayer`, `mockLayer`, `liveRuntime`, `makeMockRuntime`
319
328
  - `CursorConfig`, `cursorConfig`, `agentOptionsFromConfig`, `loadCursorConfig`
320
329
  - tagged Cursor error classes and `mapCursorError`
@@ -326,6 +335,7 @@ Use generated TypeScript declarations for exact signatures.
326
335
 
327
336
  ```bash
328
337
  bun run typecheck
338
+ bun run sdk-audit
329
339
  bun run lint
330
340
  bun run format:check
331
341
  bun run test
@@ -334,8 +344,14 @@ bun run build
334
344
  bun run lint:package
335
345
  ```
336
346
 
347
+ After a `@cursor/sdk` bump, if `sdk-audit` fails, review [docs/SDK_COVERAGE.md](./docs/SDK_COVERAGE.md) and refresh the baseline only when drift is intentional: `bun run sdk-audit:refresh`.
348
+
337
349
  Coverage is measured with Vitest v8 coverage. The suite focuses on deterministic wrapper behavior; live SDK network paths should be validated separately with credentials and a disposable repository.
338
350
 
351
+ ## Deprecations
352
+
353
+ Whenever you need a single place for what is deprecated, what to use instead, how to migrate, and what may change in the next major (when that is already decided), read **[DEPRECATIONS.md](./DEPRECATIONS.md)**. Pair it with **[CHANGELOG.md](./CHANGELOG.md)** for release-by-release notes; `@deprecated` tags on exported symbols mirror the same intent for day-to-day coding.
354
+
339
355
  ## Versioning and Publishing
340
356
 
341
357
  Use conventional commits for readable history and changelog context:
@@ -361,4 +377,4 @@ bun run version
361
377
  bun run release
362
378
  ```
363
379
 
364
- `bun run release` runs `typecheck`, `lint`, `test`, `build`, and `publint` before publishing to NPM.
380
+ `bun run release` runs `verify:publish` (including `sdk-audit`) before publishing to NPM.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { Config, Context, Effect, Layer, ManagedRuntime, Metric, Option, Redacted, Schema, Scope, Stream } from "effect";
1
+ import { Config, Context, Effect, Layer, ManagedRuntime, Metric, Option, Redacted, Schedule, Schema, Scope, Stream } from "effect";
2
2
  import { AgentDefinition, AgentMessage, AgentOperationOptions, AgentOptions, AuthenticationError, ConfigurationError, CursorAgentError, CursorAgentPlatform, CursorRequestOptions, GetAgentMessagesOptions, GetAgentOptions, GetRunOptions, IntegrationNotConnectedError, ListAgentsOptions, ListResult, ListRunsOptions, McpServerConfig, ModelListItem, ModelParameterDefinition, ModelParameterValue, ModelSelection, ModelVariant, NetworkError, RateLimitError, Run, RunOperation, RunResult, RunResultStatus, RunStatus, SDKAgent, SDKAgentInfo, SDKArtifact, SDKAssistantMessage, SDKImage, SDKImageDimension, SDKMessage, SDKModel, SDKRepository, SDKStatusMessage, SDKSystemMessage, SDKTaskMessage, SDKThinkingMessage, SDKToolUseMessage, SDKUser, SDKUserMessage, SDKUserMessageEvent, SendOptions, SettingSource, TextBlock, ToolUseBlock, UnknownAgentError, UnsupportedRunOperationError, createAgentPlatform, createInMemoryRunEventNotifier, createLocalRunEventNotifier, createSdkMessageRunStreamEvent, decodeLocalRunStreamEvent, decodeSdkMessageRunStreamEvent, getTurnType, isTerminalLocalRunStreamEvent, localRunStreamEventToSdkMessage, startLocalRunEventNotifierServer } from "@cursor/sdk";
3
3
  import * as _$effect_Types0 from "effect/Types";
4
4
  import * as _$effect_Cause0 from "effect/Cause";
5
+ import * as _$effect_Duration0 from "effect/Duration";
5
6
 
6
7
  //#region src/cursor-error.d.ts
7
8
  /**
@@ -275,6 +276,14 @@ declare const agentOptionsFromConfig: (config: CursorConfig, overrides?: AgentOp
275
276
  * It uses ConfigProvider to load the environment variables
276
277
  * with their default names (`CURSOR_API_KEY`, `CURSOR_MODEL`, `CURSOR_LOCAL_CWD`)
277
278
  * from {@link cursorConfig}.
279
+ * Omitting `CURSOR_API_KEY` only means no default API-key-based auth will be
280
+ * set; callers can still provide credentials via {@link agentOptionsFromConfig}
281
+ * overrides or the `*FromConfig` service helpers.
282
+ *
283
+ * If the API key is not set, it will log a warning message.
284
+ *
285
+ * **NOTE**: omitting the API key will cause an unauthenticated error
286
+ * in subsequent calls to the Cursor SDK API.
278
287
  *
279
288
  * @example
280
289
  * ```ts
@@ -419,41 +428,51 @@ declare class CursorSdkFactory extends CursorSdkFactory_base {
419
428
  * {@link CursorAgentServiceShape.scopedFromConfig}
420
429
  * so secrets stay in `Redacted` form until {@link agentOptionsFromConfig}
421
430
  * merges into SDK {@link AgentOptions}. Plain {@link AgentOptions} entry points
422
- * are deprecated; see the package README.
431
+ * are deprecated; see `DEPRECATIONS.md` and the README at the package root.
423
432
  */
424
433
  interface CursorAgentServiceShape {
425
434
  /**
426
- * @deprecated Use {@link CursorAgentServiceShape.createFromConfig} with {@link loadCursorConfig} instead
427
- * of passing raw {@link AgentOptions} (including a plain `apiKey` string).
435
+ * @deprecated Prefer {@link CursorAgentServiceShape.createFromConfig} with {@link loadCursorConfig}
436
+ * instead of raw {@link AgentOptions} (including a plain `apiKey` string). Next major: `createFromConfig`
437
+ * is planned to become `create` with the same parameters.
428
438
  */
429
439
  readonly create: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
430
440
  /**
431
441
  * Create an agent from {@link CursorConfig} and optional SDK overrides.
432
442
  *
443
+ * @remarks
444
+ * Next major: planned rename to `create` with the same signature once plain-`AgentOptions` entry points are removed.
445
+ *
433
446
  * @see {@link loadCursorConfig}
434
447
  * @see {@link agentOptionsFromConfig}
435
448
  */
436
449
  readonly createFromConfig: (config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
437
450
  /**
438
- * @deprecated Use {@link CursorAgentServiceShape.resumeFromConfig} with {@link loadCursorConfig} instead
439
- * of passing raw {@link AgentOptions}.
451
+ * @deprecated Prefer {@link CursorAgentServiceShape.resumeFromConfig} with {@link loadCursorConfig}
452
+ * instead of raw {@link AgentOptions}. Next major: `resumeFromConfig` is planned to become `resume` with the same parameters.
440
453
  */
441
454
  readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
442
455
  /**
443
456
  * Resume an agent from {@link CursorConfig} and optional SDK overrides.
444
457
  *
458
+ * @remarks
459
+ * Next major: planned rename to `resume` with the same signature once plain-`AgentOptions` entry points are removed.
460
+ *
445
461
  * @see {@link loadCursorConfig}
446
462
  * @see {@link agentOptionsFromConfig}
447
463
  */
448
464
  readonly resumeFromConfig: (agentId: string, config: CursorConfig, overrides?: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
449
465
  /**
450
- * @deprecated Use {@link CursorAgentServiceShape.promptFromConfig} with {@link loadCursorConfig} instead
451
- * of passing raw {@link AgentOptions}.
466
+ * @deprecated Prefer {@link CursorAgentServiceShape.promptFromConfig} with {@link loadCursorConfig}
467
+ * instead of raw {@link AgentOptions}. Next major: `promptFromConfig` is planned to become `prompt` with the same parameters.
452
468
  */
453
469
  readonly prompt: (message: string, options?: AgentOptions) => Effect.Effect<RunResult, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
454
470
  /**
455
471
  * One-shot prompt from {@link CursorConfig} and optional SDK overrides.
456
472
  *
473
+ * @remarks
474
+ * Next major: planned rename to `prompt` with the same signature once plain-`AgentOptions` entry points are removed.
475
+ *
457
476
  * @see {@link loadCursorConfig}
458
477
  * @see {@link agentOptionsFromConfig}
459
478
  */
@@ -463,13 +482,16 @@ interface CursorAgentServiceShape {
463
482
  readonly close: (agent: SDKAgent) => Effect.Effect<void>;
464
483
  readonly dispose: (agent: SDKAgent) => Effect.Effect<void, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError>;
465
484
  /**
466
- * @deprecated Use {@link CursorAgentServiceShape.scopedFromConfig} with {@link loadCursorConfig} instead
467
- * of passing raw {@link AgentOptions}.
485
+ * @deprecated Prefer {@link CursorAgentServiceShape.scopedFromConfig} with {@link loadCursorConfig}
486
+ * instead of raw {@link AgentOptions}. Next major: `scopedFromConfig` is planned to become `scoped` with the same parameters.
468
487
  */
469
488
  readonly scoped: (options: AgentOptions) => Effect.Effect<SDKAgent, CursorAuthenticationError | CursorRateLimitError | CursorIntegrationNotConnectedError | CursorConfigurationError | CursorNetworkError | CursorUnknownError, Scope.Scope>;
470
489
  /**
471
490
  * Acquire an agent in a scope from {@link CursorConfig} and optional SDK overrides.
472
491
  *
492
+ * @remarks
493
+ * Next major: planned rename to `scoped` with the same signature once plain-`AgentOptions` entry points are removed.
494
+ *
473
495
  * @see {@link loadCursorConfig}
474
496
  * @see {@link agentOptionsFromConfig}
475
497
  */
@@ -506,6 +528,8 @@ declare const CursorAgentService_base: Context.ServiceClass<CursorAgentService,
506
528
  * Prefer {@link CursorAgentServiceShape.createFromConfig} and related methods
507
529
  * with {@link loadCursorConfig}; raw {@link AgentOptions} on
508
530
  * {@link CursorAgentServiceShape.create} and siblings are deprecated.
531
+ * See `DEPRECATIONS.md` at the package root for migration and planned next-major renames
532
+ * (`createFromConfig` → `create`, etc.).
509
533
  *
510
534
  * @category services
511
535
  */
@@ -587,6 +611,7 @@ declare class CursorInspectionService extends CursorInspectionService_base {
587
611
  * @see {@link makeMockSdkFactoryLayer}
588
612
  * @category testing
589
613
  */
614
+ type CursorMockFactoryMethod = "create" | "resume" | "prompt" | "listAgents" | "listRuns" | "getRun" | "getAgent" | "archiveAgent" | "unarchiveAgent" | "deleteAgent" | "listMessages" | "me" | "listModels" | "listRepositories";
590
615
  interface CursorMockFixtures {
591
616
  readonly agentId?: string;
592
617
  readonly runId?: string;
@@ -599,6 +624,19 @@ interface CursorMockFixtures {
599
624
  readonly models?: ReadonlyArray<SDKModel>;
600
625
  readonly repositories?: ReadonlyArray<SDKRepository>;
601
626
  readonly user?: SDKUser;
627
+ /**
628
+ * Per-`send` merged fixtures. Each `MockCursorAgent.send` increments the index;
629
+ * when exhausted, further sends reuse the last entry merged with the base fixtures.
630
+ */
631
+ readonly sendSequence?: ReadonlyArray<Partial<CursorMockFixtures>>;
632
+ /**
633
+ * Reject a factory method with this error (Promise rejection).
634
+ */
635
+ readonly factoryErrors?: Partial<Record<CursorMockFactoryMethod, unknown>>;
636
+ /** Override {@link Run.supports} per operation. */
637
+ readonly runSupports?: Partial<Record<RunOperation, boolean>>;
638
+ /** Override unsupported reasons for operations marked false in {@link runSupports}. */
639
+ readonly runUnsupportedReason?: Partial<Record<RunOperation, string>>;
602
640
  }
603
641
  /**
604
642
  * Deterministic SDK `Run` implementation for tests.
@@ -622,17 +660,24 @@ declare class MockCursorRun implements Run {
622
660
  #private;
623
661
  readonly streamEvents: ReadonlyArray<SDKMessage>;
624
662
  readonly waitResult: RunResult;
663
+ readonly behavior?: {
664
+ readonly supports?: Partial<Record<RunOperation, boolean>>;
665
+ readonly unsupportedReason?: Partial<Record<RunOperation, string>>;
666
+ } | undefined;
625
667
  readonly id: string;
626
668
  readonly agentId: string;
627
669
  readonly createdAt: number;
628
- constructor(streamEvents: ReadonlyArray<SDKMessage>, waitResult: RunResult);
670
+ constructor(streamEvents: ReadonlyArray<SDKMessage>, waitResult: RunResult, behavior?: {
671
+ readonly supports?: Partial<Record<RunOperation, boolean>>;
672
+ readonly unsupportedReason?: Partial<Record<RunOperation, string>>;
673
+ } | undefined);
629
674
  get status(): RunStatus;
630
675
  get result(): string | undefined;
631
676
  get model(): RunResult["model"];
632
677
  get durationMs(): number | undefined;
633
678
  get git(): RunResult["git"];
634
- supports(_operation: RunOperation): boolean;
635
- unsupportedReason(_operation: RunOperation): string | undefined;
679
+ supports(operation: RunOperation): boolean;
680
+ unsupportedReason(operation: RunOperation): string | undefined;
636
681
  stream(): AsyncGenerator<SDKMessage, void>;
637
682
  conversation(): Promise<[]>;
638
683
  wait(): Promise<RunResult>;
@@ -655,6 +700,7 @@ declare class MockCursorRun implements Run {
655
700
  * @category testing
656
701
  */
657
702
  declare class MockCursorAgent implements SDKAgent {
703
+ #private;
658
704
  readonly fixtures: CursorMockFixtures;
659
705
  readonly agentId: string;
660
706
  readonly runs: Run[];
@@ -686,6 +732,15 @@ declare const makeMockRun: (fixtures?: CursorMockFixtures) => MockCursorRun;
686
732
  * @category testing
687
733
  */
688
734
  declare const makeMockAgent: (fixtures?: CursorMockFixtures) => MockCursorAgent;
735
+ /**
736
+ * Minimal assistant {@link SDKMessage} for streaming tests.
737
+ *
738
+ * @category testing
739
+ */
740
+ declare const makeMockAssistantSdkMessage: (text: string, ids?: {
741
+ readonly agentId?: string;
742
+ readonly runId?: string;
743
+ }) => SDKMessage;
689
744
  /**
690
745
  * Layer replacing the SDK factory with deterministic mock behavior.
691
746
  *
@@ -707,6 +762,146 @@ declare const makeMockAgent: (fixtures?: CursorMockFixtures) => MockCursorAgent;
707
762
  */
708
763
  declare const makeMockSdkFactoryLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorSdkFactory, never, never>;
709
764
  //#endregion
765
+ //#region src/cursor-observability.d.ts
766
+ /**
767
+ * Default exponential retry for Cursor catalog-style calls (list agents, models, repos).
768
+ *
769
+ * Matches the pattern used in the advanced ops dashboard example: 150ms base, 3 attempts.
770
+ *
771
+ * @example
772
+ * ```ts
773
+ * import { CursorInspectionService, cursorCatalogRetrySchedule, liveLayer } from "effect-cursor-sdk";
774
+ * import { Effect } from "effect";
775
+ *
776
+ * const program = Effect.gen(function* () {
777
+ * const inspection = yield* CursorInspectionService;
778
+ * return yield* inspection.listModels().pipe(Effect.retry(cursorCatalogRetrySchedule));
779
+ * }).pipe(Effect.provide(liveLayer));
780
+ * ```
781
+ *
782
+ * @category observability
783
+ */
784
+ declare const cursorCatalogRetrySchedule: Schedule.Schedule<[_$effect_Duration0.Duration, number], unknown, never, never>;
785
+ /**
786
+ * Default timeout for parallel catalog loads.
787
+ *
788
+ * @example
789
+ * ```ts
790
+ * import { CursorInspectionService, cursorCatalogLoadTimeout, liveLayer } from "effect-cursor-sdk";
791
+ * import { Effect } from "effect";
792
+ *
793
+ * const program = Effect.gen(function* () {
794
+ * const inspection = yield* CursorInspectionService;
795
+ * return yield* Effect.all(
796
+ * { user: inspection.me(), models: inspection.listModels() },
797
+ * { concurrency: "unbounded" },
798
+ * ).pipe(Effect.timeout(cursorCatalogLoadTimeout));
799
+ * }).pipe(Effect.provide(liveLayer));
800
+ * ```
801
+ *
802
+ * @category observability
803
+ */
804
+ declare const cursorCatalogLoadTimeout: "45 seconds";
805
+ /**
806
+ * Append assistant-visible text from a streamed {@link SDKMessage} (same rules as {@link CursorRunService.collectText}).
807
+ *
808
+ * @example
809
+ * ```ts
810
+ * import { appendAssistantSdkMessageText } from "effect-cursor-sdk";
811
+ * import type { SDKMessage } from "effect-cursor-sdk";
812
+ *
813
+ * const events: SDKMessage[] = []; // from run.stream()
814
+ * const text = events.reduce(appendAssistantSdkMessageText, "");
815
+ * ```
816
+ *
817
+ * @category observability
818
+ */
819
+ declare const appendAssistantSdkMessageText: (text: string, event: SDKMessage) => string;
820
+ /**
821
+ * Wraps a run event stream and increments {@link cursorStreamEvents} per emitted event.
822
+ *
823
+ * @example
824
+ * ```ts
825
+ * import { CursorRunService, streamEventsTracked, liveLayer } from "effect-cursor-sdk";
826
+ * import { Effect, Stream } from "effect";
827
+ * import type { Run } from "effect-cursor-sdk";
828
+ *
829
+ * declare const run: Run;
830
+ *
831
+ * const program = Effect.gen(function* () {
832
+ * const runs = yield* CursorRunService;
833
+ * yield* streamEventsTracked(runs.streamEvents(run)).pipe(Stream.runDrain);
834
+ * }).pipe(Effect.provide(liveLayer));
835
+ * ```
836
+ *
837
+ * @category observability
838
+ */
839
+ declare const streamEventsTracked: <E>(stream: Stream.Stream<E, CursorStreamError>) => Stream.Stream<E, CursorStreamError>;
840
+ /**
841
+ * Like {@link CursorRunService.collectText}, but increments {@link cursorStreamEvents} per stream chunk.
842
+ *
843
+ * @param run - SDK run handle.
844
+ * @param streamEvents - Typically `runs.streamEvents` from {@link CursorRunService}.
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * import { collectTextTracked, CursorRunService, liveLayer } from "effect-cursor-sdk";
849
+ * import { Effect } from "effect";
850
+ * import type { Run } from "effect-cursor-sdk";
851
+ *
852
+ * declare const run: Run;
853
+ *
854
+ * const text = Effect.gen(function* () {
855
+ * const runs = yield* CursorRunService;
856
+ * return yield* collectTextTracked(run, (r) => runs.streamEvents(r));
857
+ * }).pipe(Effect.provide(liveLayer));
858
+ * ```
859
+ *
860
+ * @category observability
861
+ */
862
+ declare const collectTextTracked: (run: Run, streamEvents: (r: Run) => Stream.Stream<SDKMessage, CursorStreamError>) => Effect.Effect<string, CursorStreamError>;
863
+ /**
864
+ * Build a redacted, log-safe summary of {@link AgentOptions} **without** an API key value.
865
+ *
866
+ * @remarks
867
+ * Nested structures are passed through {@link redact}. Never log raw `apiKey`.
868
+ *
869
+ * @example
870
+ * ```ts
871
+ * import { summarizeAgentOptionsForLog } from "effect-cursor-sdk";
872
+ * import { Effect } from "effect";
873
+ *
874
+ * const program = Effect.gen(function* () {
875
+ * const options = { model: { id: "composer-2" }, apiKey: "secret" };
876
+ * yield* Effect.logInfo("cursor run", summarizeAgentOptionsForLog(options));
877
+ * });
878
+ * ```
879
+ *
880
+ * @category observability
881
+ */
882
+ declare const summarizeAgentOptionsForLog: (options: AgentOptions) => Record<string, unknown>;
883
+ /**
884
+ * Attach minimal run identifiers for structured logs or span attributes.
885
+ *
886
+ * @example
887
+ * ```ts
888
+ * import { summarizeRunForLog } from "effect-cursor-sdk";
889
+ * import { Effect } from "effect";
890
+ *
891
+ * const program = Effect.gen(function* () {
892
+ * const run = { id: "run_1", agentId: "agt_1", status: "finished" as const };
893
+ * yield* Effect.logDebug("run done", summarizeRunForLog(run));
894
+ * });
895
+ * ```
896
+ *
897
+ * @category observability
898
+ */
899
+ declare const summarizeRunForLog: (run: {
900
+ readonly id: string;
901
+ readonly agentId: string;
902
+ readonly status?: string;
903
+ }) => Record<string, unknown>;
904
+ //#endregion
710
905
  //#region src/cursor-run.d.ts
711
906
  interface CursorRunServiceShape {
712
907
  readonly supports: (run: Run, operation: RunOperation) => boolean;
@@ -717,6 +912,15 @@ interface CursorRunServiceShape {
717
912
  readonly streamEvents: (run: Run) => Stream.Stream<SDKMessage, CursorStreamError>;
718
913
  readonly collectText: (run: Run) => Effect.Effect<string, CursorStreamError>;
719
914
  readonly onDidChangeStatus: (run: Run, listener: (status: RunStatus) => void) => Effect.Effect<() => void>;
915
+ /**
916
+ * Status updates as a stream (backed by {@link Run.onDidChangeStatus}).
917
+ *
918
+ * @example
919
+ * ```ts
920
+ *
921
+ * ```
922
+ */
923
+ readonly streamStatusChanges: (run: Run) => Stream.Stream<RunStatus, never, never>;
720
924
  }
721
925
  declare const CursorRunService_base: Context.ServiceClass<CursorRunService, "effect-cursor-sdk/cursor-run/CursorRunService", CursorRunServiceShape>;
722
926
  /**
@@ -724,8 +928,13 @@ declare const CursorRunService_base: Context.ServiceClass<CursorRunService, "eff
724
928
  *
725
929
  * @example
726
930
  * ```ts
931
+ * const runService = yield* CursorRunService;
932
+ *
933
+ * // Create a run with the agent service
727
934
  * const run = yield* agents.send(agent, "Refactor auth")
728
- * const text = yield* runs.collectText(run)
935
+ *
936
+ * // Use the run service with the created run
937
+ * const conversation = yield* runService.conversation(run);
729
938
  * ```
730
939
  *
731
940
  * @see {@link CursorAgentService} for creating and sending runs.
@@ -755,7 +964,7 @@ declare class CursorRunService extends CursorRunService_base {
755
964
  *
756
965
  * @category layers
757
966
  */
758
- declare const liveLayer: Layer.Layer<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never, never>;
967
+ declare const liveLayer: Layer.Layer<CursorAgentService | CursorSdkFactory | CursorArtifactService | CursorInspectionService | CursorRunService, never, never>;
759
968
  /**
760
969
  * Deterministic mock layer for tests and examples.
761
970
  *
@@ -773,7 +982,7 @@ declare const liveLayer: Layer.Layer<CursorArtifactService | CursorAgentService
773
982
  *
774
983
  * @category layers
775
984
  */
776
- declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never, never>;
985
+ declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorAgentService | CursorSdkFactory | CursorArtifactService | CursorInspectionService | CursorRunService, never, never>;
777
986
  /**
778
987
  * Ready-made live runtime.
779
988
  *
@@ -789,7 +998,7 @@ declare const mockLayer: (fixtures?: CursorMockFixtures) => Layer.Layer<CursorAr
789
998
  *
790
999
  * @category runtimes
791
1000
  */
792
- declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never>;
1001
+ declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorAgentService | CursorSdkFactory | CursorArtifactService | CursorInspectionService | CursorRunService, never>;
793
1002
  /**
794
1003
  * Ready-made mock runtime.
795
1004
  *
@@ -806,7 +1015,7 @@ declare const liveRuntime: ManagedRuntime.ManagedRuntime<CursorArtifactService |
806
1015
  *
807
1016
  * @category runtimes
808
1017
  */
809
- declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<CursorArtifactService | CursorAgentService | CursorSdkFactory | CursorRunService | CursorInspectionService, never>;
1018
+ declare const makeMockRuntime: (fixtures?: CursorMockFixtures) => ManagedRuntime.ManagedRuntime<CursorAgentService | CursorSdkFactory | CursorArtifactService | CursorInspectionService | CursorRunService, never>;
810
1019
  //#endregion
811
1020
  //#region src/cursor-telemetry.d.ts
812
1021
  /**
@@ -880,7 +1089,7 @@ declare const cursorStreamEvents: Metric.Counter<number>;
880
1089
  */
881
1090
  declare const redact: (value: unknown) => unknown;
882
1091
  /**
883
- * Wraps an SDK-backed {@link Effect.Effect | Effect} with consistent
1092
+ * Wraps an SDK-backed {@link Effect} with consistent
884
1093
  * observability: increments {@link cursorOperationsStarted} at execution start,
885
1094
  * increments {@link cursorOperationsFailed} on the error channel, and attaches
886
1095
  * a span named `cursor.<operation>` (for example `cursor.agent.list`).
@@ -926,5 +1135,5 @@ declare const instrument: <A, E, R>(operation: CursorOperation, effect: Effect.E
926
1135
  */
927
1136
  declare const packageName = "effect-cursor-sdk";
928
1137
  //#endregion
929
- export { type AgentDefinition, type AgentMessage, type AgentOperationOptions, type AgentOptions, AuthenticationError, ConfigurationError, CursorAgentError, CursorAgentPlatform, CursorAgentService, CursorAgentServiceShape, CursorApiKey, CursorArtifactService, CursorArtifactServiceShape, CursorAuthenticationError, CursorConfig, CursorConfigurationError, CursorErrorContext, CursorInspectionService, CursorInspectionServiceShape, CursorIntegrationNotConnectedError, CursorLocalCwd, CursorMockFixtures, CursorModelId, CursorNetworkError, CursorOperation, CursorRateLimitError, type CursorRequestOptions, CursorRunFailedError, CursorRunService, CursorRunServiceShape, CursorSdkFactory, CursorSdkFactoryShape, CursorStreamError, CursorUnknownError, CursorUnsupportedOperationError, type GetAgentMessagesOptions, type GetAgentOptions, type GetRunOptions, IntegrationNotConnectedError, type ListAgentsOptions, type ListResult, type ListRunsOptions, type McpServerConfig, MockCursorAgent, MockCursorRun, type ModelListItem, type ModelParameterDefinition, type ModelParameterValue, type ModelSelection, type ModelVariant, NetworkError, RateLimitError, type Run, type RunOperation, type RunResult, type RunResultStatus, type RunStatus, type SDKAgent, type SDKAgentInfo, type SDKArtifact, type SDKAssistantMessage, type SDKImage, type SDKImageDimension, type SDKMessage, type SDKModel, type SDKRepository, type SDKStatusMessage, type SDKSystemMessage, type SDKTaskMessage, type SDKThinkingMessage, type SDKToolUseMessage, type SDKUser, type SDKUserMessage, type SDKUserMessageEvent, type SendOptions, type SettingSource, type TextBlock, type ToolUseBlock, UnknownAgentError, UnsupportedRunOperationError, agentOptionsFromConfig, createAgentPlatform, createInMemoryRunEventNotifier, createLocalRunEventNotifier, createSdkMessageRunStreamEvent, cursorConfig, cursorOperationsFailed, cursorOperationsStarted, cursorStreamEvents, decodeLocalRunStreamEvent, decodeSdkMessageRunStreamEvent, getTurnType, instrument, isTerminalLocalRunStreamEvent, liveLayer, liveRuntime, loadCursorConfig, localRunStreamEventToSdkMessage, makeMockAgent, makeMockRun, makeMockRuntime, makeMockSdkFactoryLayer, mapCursorError, mockLayer, packageName, redact, startLocalRunEventNotifierServer };
1138
+ export { type AgentDefinition, type AgentMessage, type AgentOperationOptions, type AgentOptions, AuthenticationError, ConfigurationError, CursorAgentError, CursorAgentPlatform, CursorAgentService, CursorAgentServiceShape, CursorApiKey, CursorArtifactService, CursorArtifactServiceShape, CursorAuthenticationError, CursorConfig, CursorConfigurationError, CursorErrorContext, CursorInspectionService, CursorInspectionServiceShape, CursorIntegrationNotConnectedError, CursorLocalCwd, CursorMockFactoryMethod, CursorMockFixtures, CursorModelId, CursorNetworkError, CursorOperation, CursorRateLimitError, type CursorRequestOptions, CursorRunFailedError, CursorRunService, CursorRunServiceShape, CursorSdkFactory, CursorSdkFactoryShape, CursorStreamError, CursorUnknownError, CursorUnsupportedOperationError, type GetAgentMessagesOptions, type GetAgentOptions, type GetRunOptions, IntegrationNotConnectedError, type ListAgentsOptions, type ListResult, type ListRunsOptions, type McpServerConfig, MockCursorAgent, MockCursorRun, type ModelListItem, type ModelParameterDefinition, type ModelParameterValue, type ModelSelection, type ModelVariant, NetworkError, RateLimitError, type Run, type RunOperation, type RunResult, type RunResultStatus, type RunStatus, type SDKAgent, type SDKAgentInfo, type SDKArtifact, type SDKAssistantMessage, type SDKImage, type SDKImageDimension, type SDKMessage, type SDKModel, type SDKRepository, type SDKStatusMessage, type SDKSystemMessage, type SDKTaskMessage, type SDKThinkingMessage, type SDKToolUseMessage, type SDKUser, type SDKUserMessage, type SDKUserMessageEvent, type SendOptions, type SettingSource, type TextBlock, type ToolUseBlock, UnknownAgentError, UnsupportedRunOperationError, agentOptionsFromConfig, appendAssistantSdkMessageText, collectTextTracked, createAgentPlatform, createInMemoryRunEventNotifier, createLocalRunEventNotifier, createSdkMessageRunStreamEvent, cursorCatalogLoadTimeout, cursorCatalogRetrySchedule, cursorConfig, cursorOperationsFailed, cursorOperationsStarted, cursorStreamEvents, decodeLocalRunStreamEvent, decodeSdkMessageRunStreamEvent, getTurnType, instrument, isTerminalLocalRunStreamEvent, liveLayer, liveRuntime, loadCursorConfig, localRunStreamEventToSdkMessage, makeMockAgent, makeMockAssistantSdkMessage, makeMockRun, makeMockRuntime, makeMockSdkFactoryLayer, mapCursorError, mockLayer, packageName, redact, startLocalRunEventNotifierServer, streamEventsTracked, summarizeAgentOptionsForLog, summarizeRunForLog };
930
1139
  //# sourceMappingURL=index.d.ts.map