effect-cursor-sdk 0.1.1 → 0.2.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.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CursorAgentError","AuthenticationError","RateLimitError","IntegrationNotConnectedError","UnsupportedRunOperationError","ConfigurationError","NetworkError","UnknownAgentError","#status","#listeners"],"sources":["../src/cursor-error.ts","../src/cursor-sdk-factory.ts","../src/cursor-telemetry.ts","../src/cursor-agent.ts","../src/cursor-artifacts.ts","../src/cursor-config.ts","../src/cursor-inspection.ts","../src/cursor-mock.ts","../src/cursor-run.ts","../src/cursor-runtime.ts","../src/index.ts"],"sourcesContent":["import {\n AuthenticationError,\n ConfigurationError,\n CursorAgentError,\n IntegrationNotConnectedError,\n NetworkError,\n RateLimitError,\n UnknownAgentError,\n UnsupportedRunOperationError,\n} from \"@cursor/sdk\";\nimport { Data, Match } from \"effect\";\n\nimport type { RunOperation } from \"./cursor-types\";\n\n/**\n * The operation being executed when an SDK error crossed into Effect.\n *\n * @category errors\n */\nexport type CursorOperation =\n | \"agent.create\"\n | \"agent.resume\"\n | \"agent.prompt\"\n | \"agent.send\"\n | \"agent.close\"\n | \"agent.reload\"\n | \"agent.dispose\"\n | \"agent.list\"\n | \"agent.get\"\n | \"agent.archive\"\n | \"agent.unarchive\"\n | \"agent.delete\"\n | \"messages.list\"\n | \"run.list\"\n | \"run.get\"\n | \"run.wait\"\n | \"run.stream\"\n | \"run.conversation\"\n | \"run.cancel\"\n | \"artifacts.list\"\n | \"artifacts.download\"\n | \"cursor.me\"\n | \"cursor.models.list\"\n | \"cursor.repositories.list\";\n\n/**\n * Safe metadata attached to wrapper errors.\n *\n * @category errors\n */\nexport interface CursorErrorContext {\n readonly operation: CursorOperation;\n readonly agentId?: string;\n readonly runId?: string;\n readonly runtime?: \"local\" | \"cloud\";\n readonly status?: string;\n}\n\ninterface CursorErrorFields extends CursorErrorContext {\n readonly message: string;\n readonly cause: unknown;\n readonly isRetryable: boolean;\n}\n\n/**\n * Authentication or permission failure reported by the Cursor SDK.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorAuthenticationError extends Data.TaggedError(\n \"CursorAuthenticationError\",\n)<CursorErrorFields> {}\n\n/**\n * Cursor rate limit or usage-limit failure.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorRateLimitError extends Data.TaggedError(\n \"CursorRateLimitError\",\n)<CursorErrorFields> {}\n\n/**\n * Invalid configuration, model, prompt, repository, or request options.\n *\n * @see {@link AgentOptions}\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorConfigurationError extends Data.TaggedError(\n \"CursorConfigurationError\",\n)<CursorErrorFields> {}\n\n/**\n * SCM integration is not connected for a requested cloud repository.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorIntegrationNotConnectedError extends Data.TaggedError(\n \"CursorIntegrationNotConnectedError\",\n)<CursorErrorFields & { readonly provider?: string; readonly helpUrl?: string }> {}\n\n/**\n * Network, service availability, timeout, or backend failure.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorNetworkError extends Data.TaggedError(\"CursorNetworkError\")<CursorErrorFields> {}\n\n/**\n * A run operation is unavailable for the current runtime or run state.\n *\n * @see {@link RunOperation}\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorUnsupportedOperationError extends Data.TaggedError(\n \"CursorUnsupportedOperationError\",\n)<CursorErrorFields & { readonly sdkOperation?: RunOperation }> {}\n\n/**\n * A run reached an error terminal state or failed to produce a usable result.\n *\n * @see {@link RunResult}\n * @category errors\n */\nexport class CursorRunFailedError extends Data.TaggedError(\n \"CursorRunFailedError\",\n)<CursorErrorFields> {}\n\n/**\n * Stream creation or iteration failed.\n *\n * @see {@link CursorRunService}\n * @see {@link SDKMessage}\n * @category errors\n */\nexport class CursorStreamError extends Data.TaggedError(\"CursorStreamError\")<CursorErrorFields> {}\n\n/**\n * Fallback for unknown SDK or JavaScript failures.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorUnknownError extends Data.TaggedError(\"CursorUnknownError\")<CursorErrorFields> {}\n\nconst messageFrom = (cause: unknown): string => {\n return cause instanceof Error ? cause.message : String(cause);\n};\n\nconst retryableFrom = (cause: unknown): boolean => {\n return cause instanceof CursorAgentError ? cause.isRetryable : false;\n};\n\n/**\n * Convert any SDK failure into a tagged Effect error.\n *\n * @param cause - Unknown value thrown by `@cursor/sdk` or JavaScript runtime code.\n * @param context - Safe operation metadata to attach to the tagged error.\n *\n * @example\n * ```ts\n * import { Effect } from \"effect\"\n * import { mapCursorError } from \"effect-cursor-sdk\"\n *\n * const effect = Effect.tryPromise({\n * try: () => run.wait(),\n * catch: (cause) => mapCursorError(cause, { operation: \"run.wait\", runId: run.id })\n * })\n * ```\n *\n * @see {@link CursorAuthenticationError}\n * @see {@link CursorUnsupportedOperationError}\n * @see {@link CursorStreamError}\n *\n * @category errors\n */\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext & { readonly operation: \"run.stream\" },\n): CursorStreamError;\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext & { readonly operation: \"run.cancel\" | \"run.conversation\" },\n):\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError;\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext,\n):\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError;\nexport function mapCursorError(cause: unknown, context: CursorErrorContext) {\n const fields = {\n ...context,\n message: messageFrom(cause),\n cause,\n isRetryable: retryableFrom(cause),\n };\n\n if (context.operation === \"run.stream\") {\n return new CursorStreamError(fields);\n }\n\n return Match.value(cause).pipe(\n Match.when(Match.instanceOf(AuthenticationError), () => {\n return new CursorAuthenticationError(fields);\n }),\n Match.when(Match.instanceOf(RateLimitError), () => {\n return new CursorRateLimitError(fields);\n }),\n Match.when(Match.instanceOf(IntegrationNotConnectedError), (error) => {\n return new CursorIntegrationNotConnectedError({\n ...fields,\n provider: error.provider,\n helpUrl: error.helpUrl,\n });\n }),\n Match.when(Match.instanceOf(UnsupportedRunOperationError), (error) => {\n return new CursorUnsupportedOperationError({\n ...fields,\n sdkOperation: error.operation as RunOperation | undefined,\n });\n }),\n Match.when(Match.instanceOf(ConfigurationError), () => {\n return new CursorConfigurationError(fields);\n }),\n Match.when(Match.instanceOf(NetworkError), () => {\n return new CursorNetworkError(fields);\n }),\n Match.when(Match.instanceOf(UnknownAgentError), () => {\n return new CursorUnknownError(fields);\n }),\n Match.when(Match.instanceOf(CursorAgentError), () => {\n return new CursorUnknownError(fields);\n }),\n Match.orElse(() => {\n return new CursorUnknownError(fields);\n }),\n );\n}\n","import { Agent, Cursor } from \"@cursor/sdk\";\nimport { Context, Layer } from \"effect\";\n\nimport type {\n AgentMessage,\n AgentOperationOptions,\n AgentOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n RunResult,\n SDKAgent,\n SDKAgentInfo,\n SDKModel,\n SDKRepository,\n SDKUser,\n} from \"./cursor-types\";\n\n/* oxlint-disable eslint/no-unused-vars -- type-only imports anchor TSDoc `{@link …}`; not referenced in code */\nimport type { CursorAgentService } from \"./cursor-agent\";\nimport type { CursorArtifactService } from \"./cursor-artifacts\";\nimport type { CursorInspectionService } from \"./cursor-inspection\";\nimport type { CursorRunService } from \"./cursor-run\";\n/* oxlint-enable eslint/no-unused-vars */\n\n/**\n * Thin boundary around the static `@cursor/sdk` APIs.\n *\n * Most application code should use {@link CursorAgentService},\n * {@link CursorRunService}, {@link CursorArtifactService}, and\n * {@link CursorInspectionService}. This factory exists so live code, tests, and\n * user applications can replace SDK construction and static calls without\n * monkey-patching imports.\n *\n * So in one line: you probably won't need this.\n *\n * @example\n * ```ts\n * import { CursorSdkFactory, CursorAgentService } from \"effect-cursor-sdk\"\n * import { Layer } from \"effect\"\n *\n * const TestSdk = Layer.succeed(CursorSdkFactory)(\n * CursorSdkFactory.of({\n * create: () => mockAgent,\n * // implement the remaining factory methods for your test\n * })\n * )\n * ```\n *\n * @see {@link CursorAgentService} for creating, resuming, sending, and disposing agents.\n * @see {@link CursorRunService} for wrapping `Run` handles.\n * @see {@link CursorInspectionService} for static agent and account APIs.\n * @see {@link CursorArtifactService} for artifact APIs on an SDK agent.\n *\n * @remarks\n * **API boundary notice:** `create`, `resume`, and `prompt` take raw\n * {@link AgentOptions} today; the same possible future change described on\n * {@link CursorAgentServiceShape} may apply here. Prefer\n * {@link loadCursorConfig} with {@link agentOptionsFromConfig} before calling\n * these methods when wiring production code.\n *\n * @category services\n */\nexport interface CursorSdkFactoryShape {\n readonly create: (options: AgentOptions) => Promise<SDKAgent>;\n readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Promise<SDKAgent>;\n readonly prompt: (message: string, options?: AgentOptions) => Promise<RunResult>;\n readonly listAgents: (options?: ListAgentsOptions) => Promise<ListResult<SDKAgentInfo>>;\n readonly listRuns: (agentId: string, options?: ListRunsOptions) => Promise<ListResult<Run>>;\n readonly getRun: (runId: string, options?: GetRunOptions) => Promise<Run>;\n readonly getAgent: (agentId: string, options?: GetAgentOptions) => Promise<SDKAgentInfo>;\n readonly archiveAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly unarchiveAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly deleteAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly listMessages: (\n agentId: string,\n options?: GetAgentMessagesOptions,\n ) => Promise<AgentMessage[]>;\n readonly me: (options?: CursorRequestOptions) => Promise<SDKUser>;\n readonly listModels: (options?: CursorRequestOptions) => Promise<SDKModel[]>;\n readonly listRepositories: (options?: CursorRequestOptions) => Promise<SDKRepository[]>;\n}\n\n/**\n * Context service that provides the live `@cursor/sdk` static API boundary.\n *\n * Use {@link CursorSdkFactory.Live} in production layers and override the\n * service in tests with {@link makeMockSdkFactoryLayer} or a custom layer.\n *\n * @example\n * ```ts\n * const program = Effect.gen(function*() {\n * const sdk = yield* CursorSdkFactory\n * return sdk.create({ model: { id: \"composer-2\" }, local: { cwd: process.cwd() } })\n * })\n * ```\n *\n * @see {@link CursorSdkFactoryShape}\n * @see {@link liveLayer}\n * @category services\n */\nexport class CursorSdkFactory extends Context.Service<CursorSdkFactory, CursorSdkFactoryShape>()(\n \"effect-cursor-sdk/cursor-sdk-factory/CursorSdkFactory\",\n) {\n static readonly Live = Layer.succeed(CursorSdkFactory)(\n CursorSdkFactory.of({\n create: (options: AgentOptions): Promise<SDKAgent> => {\n return Agent.create(options);\n },\n resume: (agentId: string, options?: Partial<AgentOptions>): Promise<SDKAgent> => {\n return Agent.resume(agentId, options);\n },\n prompt: (message: string, options?: AgentOptions): Promise<RunResult> => {\n return Agent.prompt(message, options);\n },\n listAgents: (options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>> => {\n return Agent.list(options);\n },\n listRuns: (agentId: string, options?: ListRunsOptions): Promise<ListResult<Run>> => {\n return Agent.listRuns(agentId, options);\n },\n getRun: (runId: string, options?: GetRunOptions): Promise<Run> => {\n return Agent.getRun(runId, options);\n },\n getAgent: (agentId: string, options?: GetAgentOptions): Promise<SDKAgentInfo> => {\n return Agent.get(agentId, options);\n },\n archiveAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.archive(agentId, options);\n },\n unarchiveAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.unarchive(agentId, options);\n },\n deleteAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.delete(agentId, options);\n },\n listMessages: (agentId: string, options?: GetAgentMessagesOptions) => {\n return Agent.messages.list(agentId, options);\n },\n me: (options?: CursorRequestOptions): Promise<SDKUser> => {\n return Cursor.me(options);\n },\n listModels: (options?: CursorRequestOptions): Promise<SDKModel[]> => {\n return Cursor.models.list(options);\n },\n listRepositories: (options?: CursorRequestOptions): Promise<SDKRepository[]> => {\n return Cursor.repositories.list(options);\n },\n }),\n );\n}\n","/**\n * Telemetry helpers for the Effect Cursor SDK boundary.\n *\n * Services wrap SDK calls with {@link instrument}, which records Effect metrics\n * and opens an OpenTelemetry-style span per {@link CursorOperation}. Named\n * `Metric.counter` values are exported so applications can wire them into a\n * metrics backend via Effect's metrics layer.\n *\n * {@link redact} is a small helper for scrubbing structured metadata before it\n * leaves a trust boundary (for example log attributes or debug payloads).\n *\n * @see {@link CursorOperation}\n * @see {@link CursorAgentService}\n * @see {@link CursorRunService}\n * @see {@link CursorInspectionService}\n * @see {@link CursorArtifactService}\n *\n * @module\n */\n\nimport { Effect, Metric } from \"effect\";\n\nimport type { CursorOperation } from \"./cursor-error\";\n\n/**\n * Increments once when an instrumented SDK effect **starts** execution.\n *\n * Bound to the metric key `cursor_operations_started`. Used by\n * {@link instrument} on every wrapped call; pair with\n * {@link cursorOperationsFailed} to compute failure rates per operation when\n * both counters are exported to your metrics stack.\n *\n * @see {@link instrument}\n * @see {@link cursorOperationsFailed}\n *\n * @category telemetry\n */\nexport const cursorOperationsStarted = Metric.counter(\"cursor_operations_started\");\n\n/**\n * Increments once when an instrumented SDK effect **fails** (any error channel\n * value), after {@link cursorOperationsStarted} has already been recorded for\n * that run.\n *\n * Bound to the metric key `cursor_operations_failed`. Failures are tracked in\n * `Effect.tapError` so the effect still fails with the original error; this\n * counter is observability-only.\n *\n * @see {@link instrument}\n * @see {@link cursorOperationsStarted}\n *\n * @category telemetry\n */\nexport const cursorOperationsFailed = Metric.counter(\"cursor_operations_failed\");\n\n/**\n * Counter reserved for **per-message** or **per-chunk** stream throughput.\n *\n * Bound to the metric key `cursor_stream_events`. The service wrappers do not\n * attach this metric automatically to {@link CursorRunService.streamEvents};\n * export it from your app if you want to `Metric.track` inside a\n * `Stream.tapEffect` (or similar) when consuming SDK stream payloads.\n *\n * @see {@link CursorRunService}\n *\n * @category telemetry\n */\nexport const cursorStreamEvents = Metric.counter(\"cursor_stream_events\");\n\n/** String substituted for values under sensitive-looking keys. */\nconst REDACTED_MARKER = \"[redacted]\";\n\n/** Replaces non-plain objects (for example `Date`, `Map`) so they are not mistaken for empty `{}`. */\nconst OPAQUE_MARKER = \"[opaque]\";\n\n/** Replaces a value when the same object appears on the recursion stack (true cycles only). */\nconst CIRCULAR_MARKER = \"[circular]\";\n\n/** Replaces nested values when recursion depth exceeds this limit (prevents stack overflow). */\nconst MAX_REDACT_DEPTH = 64;\n\nconst isPlainObject = (value: object): boolean => {\n const proto = Object.getPrototypeOf(value);\n return proto === null || proto === Object.prototype;\n};\n\n/**\n * Lower-cased key substring / equality checks. Substrings such as `key` also\n * match `apiKey` (and unfortunately unrelated keys like `monkey`); that is an\n * intentional tradeoff for simple log scrubbing.\n */\nconst isSensitiveKeyName = (normalized: string): boolean => {\n if (normalized === \"authorization\" || normalized === \"data\") return true;\n return (\n normalized.includes(\"key\") ||\n normalized.includes(\"token\") ||\n normalized.includes(\"secret\") ||\n normalized.includes(\"password\") ||\n normalized.includes(\"passwd\") ||\n normalized.includes(\"credential\") ||\n normalized.includes(\"cookie\") ||\n normalized.includes(\"jwt\") ||\n normalized.includes(\"bearer\")\n );\n};\n\nconst redactInner = (value: unknown, path: Set<object>, depth: number): unknown => {\n if (depth > MAX_REDACT_DEPTH) {\n return OPAQUE_MARKER;\n }\n\n if (Array.isArray(value)) {\n if (path.has(value)) {\n return CIRCULAR_MARKER;\n }\n path.add(value);\n const out = value.map((item) => {\n return redactInner(item, path, depth + 1);\n });\n path.delete(value);\n return out;\n }\n\n if (value === null || typeof value !== \"object\") {\n return value;\n }\n\n if (!isPlainObject(value)) {\n return OPAQUE_MARKER;\n }\n\n if (path.has(value)) {\n return CIRCULAR_MARKER;\n }\n\n path.add(value);\n const out = Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, item]) => {\n const normalized = key.toLowerCase();\n if (isSensitiveKeyName(normalized)) {\n return [key, REDACTED_MARKER];\n }\n return [key, redactInner(item, path, depth + 1)];\n }),\n );\n path.delete(value);\n return out;\n};\n\n/**\n * Deep-clones **plain** objects and arrays while replacing values under keys that\n * often carry secrets, bearer material, or large opaque blobs (for example API\n * keys, tokens, passwords, cookies, `Authorization`, or a generic `data` field).\n *\n * Matching is **substring-based on the lower-cased key name** (for example\n * `apiKey`, `CURSOR_API_TOKEN`, `client_secret`, `setCookie` all match). Primitives\n * and `null` pass through unchanged. Non-plain objects (for example `Date`, `Map`,\n * class instances) are replaced by `\"[opaque]\"` so they are not serialized as empty\n * objects. True circular references in the input are replaced by `\"[circular]\"`.\n * Recursion deeper than 64 levels falls back to `\"[opaque]\"` for the overflow branch.\n *\n * This is a best-effort redactor for logs and attributes—not a cryptographic\n * guarantee; do not rely on it for compliance redaction without review.\n *\n * @param value - Arbitrary JSON-like value to sanitize.\n * @returns A structure of the same shape with sensitive-looking entries replaced\n * by the string `\"[redacted]\"`.\n *\n * @example\n * ```ts\n * redact({ apiKey: \"secret\", nested: { token: \"x\" }, safe: 1 })\n * // => { apiKey: \"[redacted]\", nested: { token: \"[redacted]\" }, safe: 1 }\n * ```\n *\n * @category telemetry\n */\nexport const redact = (value: unknown): unknown => {\n return redactInner(value, new Set(), 0);\n};\n\n/**\n * Wraps an SDK-backed {@link Effect.Effect | Effect} with consistent\n * observability: increments {@link cursorOperationsStarted} at execution start,\n * increments {@link cursorOperationsFailed} on the error channel, and attaches\n * a span named `cursor.<operation>` (for example `cursor.agent.list`).\n *\n * The span name is stable and includes the {@link CursorOperation} tag space\n * so traces can be filtered consistently across agent, run, artifact, and\n * inspection APIs.\n *\n * @param operation - Logical SDK operation; must match {@link CursorOperation}\n * for typed error mapping and trace taxonomy.\n * @param effect - The effect produced by `Effect.tryPromise` (or similar)\n * around a single SDK call.\n * @returns The same effect type `Effect<A, E, R>` with metrics and span\n * attached; success and failure values are unchanged.\n *\n * @example\n * ```ts\n * import { Effect } from \"effect\"\n * import { instrument } from \"./cursor-telemetry\"\n *\n * const eff = instrument(\n * \"agent.get\",\n * Effect.tryPromise({\n * try: () => sdk.getAgent(id),\n * catch: (e) => e,\n * }),\n * )\n * ```\n *\n * @see {@link cursorOperationsStarted}\n * @see {@link cursorOperationsFailed}\n * @see {@link CursorOperation}\n *\n * @category telemetry\n */\nexport const instrument = <A, E, R>(\n operation: CursorOperation,\n effect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, E, R> => {\n return effect.pipe(\n Effect.track(cursorOperationsStarted.pipe(Metric.withConstantInput(1))),\n Effect.tapError(() => {\n return Effect.track(Effect.void, cursorOperationsFailed.pipe(Metric.withConstantInput(1)));\n }),\n Effect.withSpan(`cursor.${operation}`),\n );\n};\n","import { Context, Effect, Layer, type Scope } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type {\n AgentOptions,\n Run,\n RunResult,\n SDKAgent,\n SDKUserMessage,\n SendOptions,\n} from \"./cursor-types\";\n\n/**\n * Agent lifecycle surface backed by the Cursor SDK.\n *\n * @remarks\n * **API boundary notice:** `create`, `resume`, `prompt`, and `scoped` currently\n * accept raw {@link AgentOptions} (including a plain `apiKey` string). A future\n * major version may require options to flow through Effectful {@link CursorConfig}\n * with {@link loadCursorConfig} and {@link agentOptionsFromConfig} instead of\n * passing `AgentOptions` at this boundary. Prefer the config path for new code;\n * see the package README.\n */\nexport interface CursorAgentServiceShape {\n readonly create: (\n options: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly resume: (\n agentId: string,\n options?: Partial<AgentOptions>,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly prompt: (\n message: string,\n options?: AgentOptions,\n ) => Effect.Effect<\n RunResult,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly send: (\n agent: SDKAgent,\n message: string | SDKUserMessage,\n options?: SendOptions,\n ) => Effect.Effect<\n Run,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly reload: (\n agent: SDKAgent,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly close: (agent: SDKAgent) => Effect.Effect<void>;\n readonly dispose: (\n agent: SDKAgent,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly scoped: (\n options: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError,\n Scope.Scope\n >;\n}\n\n/**\n * Effect-native agent lifecycle and prompt service.\n *\n * The service wraps `Agent.create`, `Agent.resume`, `Agent.prompt`, and\n * instance lifecycle methods while preserving SDK-owned option and result\n * types.\n *\n * @example\n * ```ts\n * import { CursorAgentService, liveLayer } from \"effect-cursor-sdk\"\n * import { Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const agents = yield* CursorAgentService\n * const agent = yield* agents.create({ model: { id: \"composer-2\" }, local: { cwd: process.cwd() } })\n * return yield* agents.send(agent, \"Summarize this repository\")\n * }).pipe(Effect.provide(liveLayer))\n * ```\n *\n * @see {@link CursorRunService} for operations on returned `Run` handles.\n * @see {@link CursorSdkFactory} for replacing SDK construction in tests.\n *\n * @remarks\n * Inherits the **API boundary notice** on {@link CursorAgentServiceShape} about\n * a possible future switch from raw {@link AgentOptions} to\n * {@link loadCursorConfig} / {@link agentOptionsFromConfig}.\n *\n * @category services\n */\nexport class CursorAgentService extends Context.Service<\n CursorAgentService,\n CursorAgentServiceShape\n>()(\"effect-cursor-sdk/cursor-agent/CursorAgentService\") {\n static readonly Live = Layer.effect(CursorAgentService)(\n Effect.gen(function* () {\n const sdk = yield* CursorSdkFactory;\n\n const create = (options: AgentOptions) => {\n return instrument(\n \"agent.create\",\n Effect.tryPromise({\n try: () => sdk.create(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.create\" });\n },\n }),\n );\n };\n\n const resume = (agentId: string, options?: Partial<AgentOptions>) => {\n return instrument(\n \"agent.resume\",\n Effect.tryPromise({\n try: () => sdk.resume(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.resume\", agentId });\n },\n }),\n );\n };\n\n const prompt = (message: string, options?: AgentOptions) => {\n return instrument(\n \"agent.prompt\",\n Effect.tryPromise({\n try: () => sdk.prompt(message, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.prompt\" });\n },\n }),\n );\n };\n\n const send = (agent: SDKAgent, message: string | SDKUserMessage, options?: SendOptions) => {\n return instrument(\n \"agent.send\",\n Effect.tryPromise({\n try: () => agent.send(message, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.send\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const reload = (agent: SDKAgent) => {\n return instrument(\n \"agent.reload\",\n Effect.tryPromise({\n try: () => agent.reload(),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.reload\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const close = (agent: SDKAgent): Effect.Effect<void> => {\n return instrument(\n \"agent.close\",\n Effect.sync(() => agent.close()),\n );\n };\n\n const dispose = (agent: SDKAgent) => {\n return instrument(\n \"agent.dispose\",\n Effect.tryPromise({\n try: () => agent[Symbol.asyncDispose](),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.dispose\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const scoped = (options: AgentOptions) => {\n return Effect.acquireRelease(create(options), (agent) => {\n return Effect.ignore(dispose(agent));\n });\n };\n\n return { create, resume, prompt, send, reload, close, dispose, scoped } as const;\n }),\n );\n}\n","import { Context, Effect, Layer } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type { SDKAgent, SDKArtifact } from \"./cursor-types\";\n\nexport interface CursorArtifactServiceShape {\n readonly listArtifacts: (\n agent: SDKAgent,\n ) => Effect.Effect<\n SDKArtifact[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly downloadArtifact: (\n agent: SDKAgent,\n path: string,\n ) => Effect.Effect<\n Buffer,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n}\n\n/**\n * Effect-native wrappers for agent artifacts.\n *\n * @example\n * ```ts\n * const artifacts = yield* CursorArtifactService\n * const items = yield* artifacts.listArtifacts(agent)\n * const bytes = yield* artifacts.downloadArtifact(agent, items[0]!.path)\n * ```\n *\n * @see {@link SDKArtifact}\n *\n * @category services\n */\nexport class CursorArtifactService extends Context.Service<\n CursorArtifactService,\n CursorArtifactServiceShape\n>()(\"effect-cursor-sdk/cursor-artifacts/CursorArtifactService\") {\n static readonly Live = Layer.succeed(CursorArtifactService)(\n CursorArtifactService.of({\n listArtifacts: (agent: SDKAgent) => {\n return instrument(\n \"artifacts.list\",\n Effect.tryPromise({\n try: () => agent.listArtifacts(),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"artifacts.list\", agentId: agent.agentId });\n },\n }),\n );\n },\n downloadArtifact: (agent: SDKAgent, path: string) => {\n return instrument(\n \"artifacts.download\",\n Effect.tryPromise({\n try: () => agent.downloadArtifact(path),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"artifacts.download\",\n agentId: agent.agentId,\n });\n },\n }),\n );\n },\n }),\n );\n}\n","import { Config, ConfigProvider, Effect, Option, Redacted, Schema } from \"effect\";\n\nimport type { AgentOptions, ModelSelection } from \"./cursor-types\";\n\n/**\n * Branded secret material for the Cursor API key.\n *\n * Values are held inside {@link Redacted} on {@link CursorConfig}; this schema\n * only brands the decoded plaintext type so it cannot be confused with other\n * strings at the type level.\n */\nexport const CursorApiKey = Schema.Redacted(Schema.String).pipe(Schema.brand(\"CursorApiKey\"));\nexport type CursorApiKey = typeof CursorApiKey.Type;\n\n/**\n * Branded model identifier from wrapper config.\n *\n * Populated from the `CURSOR_MODEL` environment variable when using\n * {@link loadCursorConfig}.\n */\nexport const CursorModelId = Schema.String.pipe(Schema.brand(\"CursorModelId\"));\nexport type CursorModelId = typeof CursorModelId.Type;\n\n/**\n * Branded local working directory for agent runs.\n *\n * Populated from `CURSOR_LOCAL_CWD` when using {@link loadCursorConfig}.\n */\nexport const CursorLocalCwd = Schema.String.pipe(Schema.brand(\"CursorLocalCwd\"));\nexport type CursorLocalCwd = typeof CursorLocalCwd.Type;\n\n/**\n * Minimal configuration owned by this wrapper.\n *\n * The SDK's `AgentOptions` type remains the source of truth for complete\n * runtime options. This schema only models environment-derived defaults.\n * Use {@link agentOptionsFromConfig} to merge those defaults into SDK-owned\n * {@link AgentOptions}.\n *\n * @remarks\n * **Forward path:** A future major version of this package may require all\n * agent-related options to be supplied through this module (for example\n * {@link loadCursorConfig} plus {@link agentOptionsFromConfig}) instead of raw\n * {@link AgentOptions} on {@link CursorAgentService}.\n * Prefer this path for new code.\n *\n * @example\n * ```ts\n * const config = new CursorConfig({\n * apiKey: Redacted.make(CursorApiKey.make(process.env.CURSOR_API_KEY!)),\n * modelId: CursorModelId.make(\"composer-2\"),\n * cwd: CursorLocalCwd.make(process.cwd())\n * })\n * ```\n *\n * @see {@link cursorConfig}\n * @see {@link loadCursorConfig}\n *\n * @category config\n */\nexport class CursorConfig extends Schema.Class<CursorConfig>(\"CursorConfig\")({\n apiKey: Schema.optional(CursorApiKey),\n modelId: Schema.optional(CursorModelId),\n cwd: Schema.optional(CursorLocalCwd),\n}) {}\n\n/**\n * Effect Config descriptors for common Cursor environment variables.\n *\n * Reads `CURSOR_API_KEY`, `CURSOR_MODEL`, and `CURSOR_LOCAL_CWD` from the active\n * Effect {@link ConfigProvider.ConfigProvider}. All fields are optional so\n * callers can still pass complete SDK options explicitly.\n *\n * @example\n * ```ts\n * const config = yield* loadCursorConfig\n * const options = agentOptionsFromConfig(config)\n * ```\n *\n * @see {@link Config}\n * @see {@link loadCursorConfig}\n *\n * @category config\n */\nexport const cursorConfig = Config.all({\n apiKey: Config.redacted(\"CURSOR_API_KEY\").pipe(Config.option),\n modelId: Config.string(\"CURSOR_MODEL\").pipe(Config.option),\n cwd: Config.string(\"CURSOR_LOCAL_CWD\").pipe(Config.option),\n});\n\n/**\n * Build SDK `AgentOptions` from wrapper config and optional overrides.\n *\n * Explicit override values always win over environment-derived defaults.\n *\n * @param config - Wrapper-owned environment defaults.\n * @param overrides - Complete or partial SDK-owned options to merge over the defaults.\n *\n * @example\n * ```ts\n * const options = agentOptionsFromConfig(config, {\n * cloud: {\n * repos: [{ url: \"https://github.com/acme/app\" }],\n * autoCreatePR: true\n * }\n * })\n * ```\n *\n * @see {@link CursorConfig}\n * @see {@link AgentOptions}\n *\n * @remarks\n * Same **forward path** notice as {@link CursorConfig}: this merge is the\n * intended boundary for redacted keys and env defaults ahead of a possible\n * requirement to use it for all agent entry points.\n *\n * @category config\n */\nexport const agentOptionsFromConfig = (\n config: CursorConfig,\n overrides: AgentOptions = {},\n): AgentOptions => {\n const model: ModelSelection | undefined =\n overrides.model ?? (config.modelId ? { id: config.modelId } : undefined);\n return {\n ...overrides,\n apiKey: overrides.apiKey ?? (config.apiKey ? Redacted.value(config.apiKey) : undefined),\n model,\n local:\n (overrides.local ?? config.cwd)\n ? {\n cwd: config.cwd,\n ...overrides.local,\n }\n : undefined,\n };\n};\n\n/**\n * Load environment-derived defaults as a schema-backed value.\n *\n * @example\n * ```ts\n * const config = yield* loadCursorConfig\n * const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })\n * ```\n *\n * @see {@link cursorConfig}\n * @see {@link agentOptionsFromConfig}\n *\n * @remarks\n * Same **forward path** notice as {@link CursorConfig}: this effect is the\n * intended entry for redacted env defaults ahead of a possible requirement to\n * use it (with {@link agentOptionsFromConfig}) for all agent entry points.\n *\n * @category config\n */\nexport const loadCursorConfig = Effect.gen(function* () {\n const provider = yield* ConfigProvider.ConfigProvider;\n const raw = yield* cursorConfig.parse(provider);\n const apiKey = Option.getOrUndefined(raw.apiKey);\n const modelId = Option.getOrUndefined(raw.modelId);\n const cwd = Option.getOrUndefined(raw.cwd);\n return new CursorConfig({\n apiKey: apiKey ? CursorApiKey.make(apiKey) : undefined,\n modelId: modelId !== undefined ? CursorModelId.make(modelId) : undefined,\n cwd: cwd !== undefined ? CursorLocalCwd.make(cwd) : undefined,\n });\n});\n","import { Context, Effect, Layer } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type {\n AgentMessage,\n AgentOperationOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n SDKAgentInfo,\n SDKModel,\n SDKRepository,\n SDKUser,\n} from \"./cursor-types\";\n\nexport interface CursorInspectionServiceShape {\n readonly listAgents: (\n options?: ListAgentsOptions,\n ) => Effect.Effect<\n ListResult<SDKAgentInfo>,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly getAgent: (\n agentId: string,\n options?: GetAgentOptions,\n ) => Effect.Effect<\n SDKAgentInfo,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly archiveAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly unarchiveAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly deleteAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listRuns: (\n agentId: string,\n options?: ListRunsOptions,\n ) => Effect.Effect<\n ListResult<Run>,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly getRun: (\n runId: string,\n options?: GetRunOptions,\n ) => Effect.Effect<\n Run,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listMessages: (\n agentId: string,\n options?: GetAgentMessagesOptions,\n ) => Effect.Effect<\n AgentMessage[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly me: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKUser,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listModels: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKModel[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listRepositories: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKRepository[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n}\n\n/**\n * Effect-native wrappers for SDK inspection, lifecycle, and account catalog APIs.\n *\n * @example\n * ```ts\n * const inspection = yield* CursorInspectionService\n * const agents = yield* inspection.listAgents({ runtime: \"cloud\", includeArchived: true })\n * const models = yield* inspection.listModels()\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link SDKAgentInfo}\n *\n * @category services\n */\nexport class CursorInspectionService extends Context.Service<\n CursorInspectionService,\n CursorInspectionServiceShape\n>()(\"effect-cursor-sdk/cursor-inspection/CursorInspectionService\") {\n static readonly Live = Layer.effect(CursorInspectionService)(\n Effect.gen(function* () {\n const sdk = yield* CursorSdkFactory;\n return {\n listAgents: (options?: ListAgentsOptions) => {\n return instrument(\n \"agent.list\",\n Effect.tryPromise({\n try: () => sdk.listAgents(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.list\" });\n },\n }),\n );\n },\n getAgent: (agentId: string, options?: GetAgentOptions) => {\n return instrument(\n \"agent.get\",\n Effect.tryPromise({\n try: () => sdk.getAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.get\", agentId });\n },\n }),\n );\n },\n archiveAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.archive\",\n Effect.tryPromise({\n try: () => sdk.archiveAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.archive\", agentId });\n },\n }),\n );\n },\n unarchiveAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.unarchive\",\n Effect.tryPromise({\n try: () => sdk.unarchiveAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.unarchive\", agentId });\n },\n }),\n );\n },\n deleteAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.delete\",\n Effect.tryPromise({\n try: () => sdk.deleteAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.delete\", agentId });\n },\n }),\n );\n },\n listRuns: (agentId: string, options?: ListRunsOptions) => {\n return instrument(\n \"run.list\",\n Effect.tryPromise({\n try: () => sdk.listRuns(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"run.list\", agentId });\n },\n }),\n );\n },\n getRun: (runId: string, options?: GetRunOptions) => {\n return instrument(\n \"run.get\",\n Effect.tryPromise({\n try: () => sdk.getRun(runId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"run.get\", runId });\n },\n }),\n );\n },\n listMessages: (agentId: string, options?: GetAgentMessagesOptions) => {\n return instrument(\n \"messages.list\",\n Effect.tryPromise({\n try: () => sdk.listMessages(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"messages.list\", agentId });\n },\n }),\n );\n },\n me: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.me\",\n Effect.tryPromise({\n try: () => sdk.me(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.me\" });\n },\n }),\n );\n },\n listModels: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.models.list\",\n Effect.tryPromise({\n try: () => sdk.listModels(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.models.list\" });\n },\n }),\n );\n },\n listRepositories: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.repositories.list\",\n Effect.tryPromise({\n try: () => sdk.listRepositories(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.repositories.list\" });\n },\n }),\n );\n },\n } as const;\n }),\n );\n}\n","import { Layer } from \"effect\";\n\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport type {\n AgentMessage,\n AgentOperationOptions,\n AgentOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n RunOperation,\n RunResult,\n RunStatus,\n SDKAgent,\n SDKAgentInfo,\n SDKArtifact,\n SDKMessage,\n SDKModel,\n SDKRepository,\n SDKUser,\n SDKUserMessage,\n SendOptions,\n} from \"./cursor-types\";\n\n/**\n * Fixture data used by the deterministic mock SDK layer.\n *\n * @example\n * ```ts\n * const fixtures: CursorMockFixtures = {\n * stream: [assistantEvent],\n * result: { id: \"run-1\", status: \"finished\", result: \"Done\" }\n * }\n * ```\n *\n * @see {@link mockLayer}\n * @see {@link makeMockSdkFactoryLayer}\n * @category testing\n */\nexport interface CursorMockFixtures {\n readonly agentId?: string;\n readonly runId?: string;\n readonly stream?: ReadonlyArray<SDKMessage>;\n readonly result?: RunResult;\n readonly artifacts?: ReadonlyArray<SDKArtifact>;\n readonly artifactData?: Buffer;\n readonly agents?: ReadonlyArray<SDKAgentInfo>;\n readonly messages?: ReadonlyArray<AgentMessage>;\n readonly models?: ReadonlyArray<SDKModel>;\n readonly repositories?: ReadonlyArray<SDKRepository>;\n readonly user?: SDKUser;\n}\n\n/**\n * Deterministic SDK `Run` implementation for tests.\n *\n * @param streamEvents - Events yielded by {@link MockCursorRun.stream}.\n * @param waitResult - Result returned by {@link MockCursorRun.wait}.\n *\n * @example\n * ```ts\n * const run = new MockCursorRun([assistantEvent], {\n * id: \"run-1\",\n * status: \"finished\",\n * result: \"Done\"\n * })\n * ```\n *\n * @see {@link makeMockRun}\n * @category testing\n */\nexport class MockCursorRun implements Run {\n readonly id: string;\n readonly agentId: string;\n readonly createdAt = Date.now();\n #status: RunStatus;\n #listeners = new Set<(status: RunStatus) => void>();\n\n constructor(\n readonly streamEvents: ReadonlyArray<SDKMessage>,\n readonly waitResult: RunResult,\n ) {\n this.id = waitResult.id;\n this.agentId = streamEvents[0]?.agent_id ?? \"mock-agent\";\n this.#status = waitResult.status;\n }\n\n get status(): RunStatus {\n return this.#status;\n }\n get result(): string | undefined {\n return this.waitResult.result;\n }\n get model(): RunResult[\"model\"] {\n return this.waitResult.model;\n }\n get durationMs(): number | undefined {\n return this.waitResult.durationMs;\n }\n get git(): RunResult[\"git\"] {\n return this.waitResult.git;\n }\n supports(_operation: RunOperation): boolean {\n return true;\n }\n unsupportedReason(_operation: RunOperation): string | undefined {\n return undefined;\n }\n async *stream(): AsyncGenerator<SDKMessage, void> {\n yield* this.streamEvents;\n }\n async conversation(): Promise<[]> {\n return [];\n }\n async wait(): Promise<RunResult> {\n return this.waitResult;\n }\n async cancel(): Promise<void> {\n this.#status = \"cancelled\";\n for (const listener of this.#listeners) listener(this.#status);\n }\n onDidChangeStatus(listener: (status: RunStatus) => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n}\n\n/**\n * Deterministic SDK `Agent` implementation for tests.\n *\n * @param fixtures - Static data used by `send`, artifact methods, and metadata methods.\n *\n * @example\n * ```ts\n * const agent = new MockCursorAgent({ result: { id: \"run-1\", status: \"finished\" } })\n * const run = await agent.send(\"hello\")\n * ```\n *\n * @see {@link makeMockAgent}\n * @see {@link CursorMockFixtures}\n * @category testing\n */\nexport class MockCursorAgent implements SDKAgent {\n readonly agentId: string;\n readonly runs: Run[] = [];\n closed = false;\n\n constructor(readonly fixtures: CursorMockFixtures = {}) {\n this.agentId = fixtures.agentId ?? \"mock-agent\";\n }\n\n get model(): AgentOptions[\"model\"] | undefined {\n return this.fixtures.result?.model;\n }\n\n async send(_message: string | SDKUserMessage, _options?: SendOptions): Promise<Run> {\n const run = makeMockRun(this.fixtures);\n this.runs.push(run);\n return run;\n }\n close(): void {\n this.closed = true;\n }\n async reload(): Promise<void> {}\n async [Symbol.asyncDispose](): Promise<void> {\n this.closed = true;\n }\n async listArtifacts(): Promise<SDKArtifact[]> {\n return [...(this.fixtures.artifacts ?? [])];\n }\n async downloadArtifact(_path: string): Promise<Buffer> {\n return this.fixtures.artifactData ?? Buffer.from(\"\");\n }\n}\n\n/**\n * Create a mock run from fixtures.\n *\n * @param fixtures - Optional mock run and stream data.\n *\n * @see {@link MockCursorRun}\n * @category testing\n */\nexport const makeMockRun = (fixtures: CursorMockFixtures = {}): MockCursorRun => {\n const runId = fixtures.runId ?? \"mock-run\";\n return new MockCursorRun(\n fixtures.stream ?? [],\n fixtures.result ?? { id: runId, status: \"finished\", result: \"\" },\n );\n};\n\n/**\n * Create a mock agent from fixtures.\n *\n * @param fixtures - Optional mock agent, run, artifact, and metadata data.\n *\n * @see {@link MockCursorAgent}\n * @category testing\n */\nexport const makeMockAgent = (fixtures: CursorMockFixtures = {}): MockCursorAgent => {\n return new MockCursorAgent(fixtures);\n};\n\n/**\n * Layer replacing the SDK factory with deterministic mock behavior.\n *\n * This is the lowest-level mock entry point. Prefer {@link mockLayer} when you\n * want all higher-level services wired together for tests.\n *\n * @param fixtures - Static SDK responses returned by the factory methods.\n *\n * @example\n * ```ts\n * const layer = makeMockSdkFactoryLayer({\n * agents: [{ agentId: \"mock-agent\", name: \"Mock\", summary: \"Test\", lastModified: 0 }]\n * })\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link mockLayer}\n * @category testing\n */\nexport const makeMockSdkFactoryLayer = (fixtures: CursorMockFixtures = {}) => {\n return Layer.succeed(\n CursorSdkFactory,\n CursorSdkFactory.of({\n create: (_options: AgentOptions): Promise<SDKAgent> => {\n return Promise.resolve(makeMockAgent(fixtures));\n },\n resume: (_agentId: string, _options?: Partial<AgentOptions>): Promise<SDKAgent> => {\n return Promise.resolve(makeMockAgent(fixtures));\n },\n prompt: async (_message: string, _options?: AgentOptions): Promise<RunResult> => {\n return (\n fixtures.result ?? { id: fixtures.runId ?? \"mock-run\", status: \"finished\", result: \"\" }\n );\n },\n listAgents: async (_options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>> => {\n return { items: [...(fixtures.agents ?? [])] };\n },\n listRuns: async (_agentId: string, _options?: ListRunsOptions): Promise<ListResult<Run>> => {\n return { items: [makeMockRun(fixtures)] };\n },\n getRun: async (_runId: string, _options?: GetRunOptions): Promise<Run> => {\n return makeMockRun(fixtures);\n },\n getAgent: async (_agentId: string, _options?: GetAgentOptions): Promise<SDKAgentInfo> => {\n return (\n fixtures.agents?.[0] ?? {\n agentId: fixtures.agentId ?? \"mock-agent\",\n name: \"Mock Agent\",\n summary: \"Deterministic mock agent\",\n lastModified: 0,\n }\n );\n },\n archiveAgent: async (_agentId: string, _options?: AgentOperationOptions): Promise<void> => {},\n unarchiveAgent: async (\n _agentId: string,\n _options?: AgentOperationOptions,\n ): Promise<void> => {},\n deleteAgent: async (_agentId: string, _options?: AgentOperationOptions): Promise<void> => {},\n listMessages: async (\n _agentId: string,\n _options?: GetAgentMessagesOptions,\n ): Promise<AgentMessage[]> => {\n return [...(fixtures.messages ?? [])];\n },\n me: async (_options?: CursorRequestOptions): Promise<SDKUser> => {\n return fixtures.user ?? { apiKeyName: \"mock\", createdAt: \"1970-01-01T00:00:00.000Z\" };\n },\n listModels: async (_options?: CursorRequestOptions): Promise<SDKModel[]> => {\n return [...(fixtures.models ?? [])];\n },\n listRepositories: async (_options?: CursorRequestOptions): Promise<SDKRepository[]> => {\n return [...(fixtures.repositories ?? [])];\n },\n }),\n );\n};\n","import { Context, Effect, Layer, Stream } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorStreamError,\n CursorUnknownError,\n CursorUnsupportedOperationError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type { Run, RunOperation, RunResult, RunStatus, SDKMessage } from \"./cursor-types\";\n\nexport interface CursorRunServiceShape {\n readonly supports: (run: Run, operation: RunOperation) => boolean;\n readonly unsupportedReason: (run: Run, operation: RunOperation) => string | undefined;\n readonly wait: (\n run: Run,\n ) => Effect.Effect<\n RunResult,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly cancel: (\n run: Run,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError\n >;\n readonly conversation: (\n run: Run,\n ) => ReturnType<Run[\"conversation\"]> extends Promise<infer A>\n ? Effect.Effect<\n A,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError\n >\n : never;\n readonly streamEvents: (run: Run) => Stream.Stream<SDKMessage, CursorStreamError>;\n readonly collectText: (run: Run) => Effect.Effect<string, CursorStreamError>;\n readonly onDidChangeStatus: (\n run: Run,\n listener: (status: RunStatus) => void,\n ) => Effect.Effect<() => void>;\n}\n\n/**\n * Effect-native helpers for SDK run handles.\n *\n * @example\n * ```ts\n * const run = yield* agents.send(agent, \"Refactor auth\")\n * const text = yield* runs.collectText(run)\n * ```\n *\n * @see {@link CursorAgentService} for creating and sending runs.\n * @see {@link SDKMessage} for the SDK-owned stream event shape.\n *\n * @category services\n */\nexport class CursorRunService extends Context.Service<CursorRunService, CursorRunServiceShape>()(\n \"effect-cursor-sdk/cursor-run/CursorRunService\",\n) {\n static readonly Live = Layer.succeed(CursorRunService)(\n CursorRunService.of({\n supports: (run: Run, operation: RunOperation): boolean => {\n return run.supports(operation);\n },\n unsupportedReason: (run: Run, operation: RunOperation): string | undefined => {\n return run.unsupportedReason(operation);\n },\n wait: (run: Run) => {\n return instrument(\n \"run.wait\",\n Effect.tryPromise({\n try: () => run.wait(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.wait\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n cancel: (run: Run) => {\n return instrument(\n \"run.cancel\",\n Effect.tryPromise({\n try: () => run.cancel(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.cancel\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n conversation: (run: Run) => {\n return instrument(\n \"run.conversation\",\n Effect.tryPromise({\n try: () => run.conversation(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.conversation\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n streamEvents: (run: Run): Stream.Stream<SDKMessage, CursorStreamError> => {\n return Stream.fromAsyncIterable(run.stream(), (cause) => {\n return mapCursorError(cause, {\n operation: \"run.stream\",\n agentId: run.agentId,\n runId: run.id,\n }) as CursorStreamError;\n });\n },\n onDidChangeStatus: (\n run: Run,\n listener: (status: RunStatus) => void,\n ): Effect.Effect<() => void> => {\n return Effect.sync(() => run.onDidChangeStatus(listener));\n },\n collectText: (run: Run): Effect.Effect<string, CursorStreamError> => {\n return Stream.fromAsyncIterable(run.stream(), (cause) => {\n return mapCursorError(cause, {\n operation: \"run.stream\",\n agentId: run.agentId,\n runId: run.id,\n }) as CursorStreamError;\n }).pipe(\n Stream.runFold(\n () => \"\",\n (text, event) => {\n if (event.type !== \"assistant\") return text;\n return (\n text +\n event.message.content\n .filter((block) => {\n return block.type === \"text\";\n })\n .map((block) => {\n return block.text;\n })\n .join(\"\")\n );\n },\n ),\n );\n },\n }),\n );\n}\n","import { Layer, ManagedRuntime } from \"effect\";\n\nimport { CursorAgentService } from \"./cursor-agent\";\nimport { CursorArtifactService } from \"./cursor-artifacts\";\nimport { CursorInspectionService } from \"./cursor-inspection\";\nimport { makeMockSdkFactoryLayer, type CursorMockFixtures } from \"./cursor-mock\";\nimport { CursorRunService } from \"./cursor-run\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\n\n/**\n * Live service layer for the SDK-backed Effect wrapper.\n *\n * Provides {@link CursorAgentService}, {@link CursorRunService},\n * {@link CursorArtifactService}, and {@link CursorInspectionService} using\n * {@link CursorSdkFactory.Live}.\n *\n * @example\n * ```ts\n * const result = yield* program.pipe(Effect.provide(liveLayer))\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link liveRuntime}\n *\n * @category layers\n */\nexport const liveLayer = Layer.mergeAll(\n CursorAgentService.Live,\n CursorRunService.Live,\n CursorArtifactService.Live,\n CursorInspectionService.Live,\n).pipe(Layer.provideMerge(CursorSdkFactory.Live));\n\n/**\n * Deterministic mock layer for tests and examples.\n *\n * @param fixtures - Static SDK responses returned by the mock factory.\n *\n * @example\n * ```ts\n * const layer = mockLayer({\n * result: { id: \"run-1\", status: \"finished\", result: \"ok\" }\n * })\n * ```\n *\n * @see {@link CursorMockFixtures}\n * @see {@link makeMockSdkFactoryLayer}\n *\n * @category layers\n */\nexport const mockLayer = (fixtures: CursorMockFixtures = {}) => {\n return Layer.mergeAll(\n CursorAgentService.Live,\n CursorRunService.Live,\n CursorArtifactService.Live,\n CursorInspectionService.Live,\n ).pipe(Layer.provideMerge(makeMockSdkFactoryLayer(fixtures)));\n};\n\n/**\n * Ready-made live runtime.\n *\n * Use this for small scripts that prefer `ManagedRuntime.runPromise` over\n * manually providing {@link liveLayer}.\n *\n * @example\n * ```ts\n * const value = await liveRuntime.runPromise(program)\n * ```\n *\n * @see {@link liveLayer}\n *\n * @category runtimes\n */\nexport const liveRuntime = ManagedRuntime.make(liveLayer);\n\n/**\n * Ready-made mock runtime.\n *\n * @param fixtures - Static SDK responses returned by the mock services.\n *\n * @example\n * ```ts\n * const runtime = makeMockRuntime({ result: { id: \"run-1\", status: \"finished\" } })\n * const value = await runtime.runPromise(program)\n * ```\n *\n * @see {@link mockLayer}\n * @see {@link CursorMockFixtures}\n *\n * @category runtimes\n */\nexport const makeMockRuntime = (fixtures: CursorMockFixtures = {}) => {\n return ManagedRuntime.make(mockLayer(fixtures));\n};\n","/**\n * Public package name.\n *\n * @category metadata\n */\nexport const packageName = \"effect-cursor-sdk\";\n\nexport * from \"./cursor-agent\";\nexport * from \"./cursor-artifacts\";\nexport * from \"./cursor-config\";\nexport * from \"./cursor-error\";\nexport * from \"./cursor-inspection\";\nexport * from \"./cursor-mock\";\nexport * from \"./cursor-run\";\nexport * from \"./cursor-runtime\";\nexport * from \"./cursor-sdk-factory\";\nexport * from \"./cursor-telemetry\";\nexport * from \"./cursor-types\";\n"],"mappings":";;;;;;;;;AAsEA,IAAa,4BAAb,cAA+C,KAAK,YAClD,4BACD,CAAoB;;;;;;;AAQrB,IAAa,uBAAb,cAA0C,KAAK,YAC7C,uBACD,CAAoB;;;;;;;;AASrB,IAAa,2BAAb,cAA8C,KAAK,YACjD,2BACD,CAAoB;;;;;;;AAQrB,IAAa,qCAAb,cAAwD,KAAK,YAC3D,qCACD,CAAgF;;;;;;;AAQjF,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAAoB;;;;;;;;AASlG,IAAa,kCAAb,cAAqD,KAAK,YACxD,kCACD,CAA+D;;;;;;;AAQhE,IAAa,uBAAb,cAA0C,KAAK,YAC7C,uBACD,CAAoB;;;;;;;;AASrB,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAA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D,QAAO,MAAM,SACX,mBAAmB,MACnB,iBAAiB,MACjB,sBAAsB,MACtB,wBAAwB,KACzB,CAAC,KAAK,MAAM,aAAa,wBAAwB,SAAS,CAAC,CAAC;;;;;;;;;;;;;;;;;AAkB/D,MAAa,cAAc,eAAe,KAAK,UAAU;;;;;;;;;;;;;;;;;AAkBzD,MAAa,mBAAmB,WAA+B,EAAE,KAAK;AACpE,QAAO,eAAe,KAAK,UAAU,SAAS,CAAC;;;;;;;;;ACxFjD,MAAa,cAAc"}
1
+ {"version":3,"file":"index.js","names":["CursorAgentError","AuthenticationError","RateLimitError","IntegrationNotConnectedError","UnsupportedRunOperationError","ConfigurationError","NetworkError","UnknownAgentError","#status","#listeners"],"sources":["../src/cursor-error.ts","../src/cursor-config.ts","../src/cursor-sdk-factory.ts","../src/cursor-telemetry.ts","../src/cursor-agent.ts","../src/cursor-artifacts.ts","../src/cursor-inspection.ts","../src/cursor-mock.ts","../src/cursor-run.ts","../src/cursor-runtime.ts","../src/index.ts"],"sourcesContent":["import {\n AuthenticationError,\n ConfigurationError,\n CursorAgentError,\n IntegrationNotConnectedError,\n NetworkError,\n RateLimitError,\n UnknownAgentError,\n UnsupportedRunOperationError,\n} from \"@cursor/sdk\";\nimport { Data, Match } from \"effect\";\n\nimport type { RunOperation } from \"./cursor-types\";\n\n/**\n * The operation being executed when an SDK error crossed into Effect.\n *\n * @category errors\n */\nexport type CursorOperation =\n | \"agent.create\"\n | \"agent.resume\"\n | \"agent.prompt\"\n | \"agent.send\"\n | \"agent.close\"\n | \"agent.reload\"\n | \"agent.dispose\"\n | \"agent.list\"\n | \"agent.get\"\n | \"agent.archive\"\n | \"agent.unarchive\"\n | \"agent.delete\"\n | \"messages.list\"\n | \"run.list\"\n | \"run.get\"\n | \"run.wait\"\n | \"run.stream\"\n | \"run.conversation\"\n | \"run.cancel\"\n | \"artifacts.list\"\n | \"artifacts.download\"\n | \"cursor.me\"\n | \"cursor.models.list\"\n | \"cursor.repositories.list\";\n\n/**\n * Safe metadata attached to wrapper errors.\n *\n * @category errors\n */\nexport interface CursorErrorContext {\n readonly operation: CursorOperation;\n readonly agentId?: string;\n readonly runId?: string;\n readonly runtime?: \"local\" | \"cloud\";\n readonly status?: string;\n}\n\ninterface CursorErrorFields extends CursorErrorContext {\n readonly message: string;\n readonly cause: unknown;\n readonly isRetryable: boolean;\n}\n\n/**\n * Authentication or permission failure reported by the Cursor SDK.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorAuthenticationError extends Data.TaggedError(\n \"CursorAuthenticationError\",\n)<CursorErrorFields> {}\n\n/**\n * Cursor rate limit or usage-limit failure.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorRateLimitError extends Data.TaggedError(\n \"CursorRateLimitError\",\n)<CursorErrorFields> {}\n\n/**\n * Invalid configuration, model, prompt, repository, or request options.\n *\n * @see {@link AgentOptions}\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorConfigurationError extends Data.TaggedError(\n \"CursorConfigurationError\",\n)<CursorErrorFields> {}\n\n/**\n * SCM integration is not connected for a requested cloud repository.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorIntegrationNotConnectedError extends Data.TaggedError(\n \"CursorIntegrationNotConnectedError\",\n)<CursorErrorFields & { readonly provider?: string; readonly helpUrl?: string }> {}\n\n/**\n * Network, service availability, timeout, or backend failure.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorNetworkError extends Data.TaggedError(\"CursorNetworkError\")<CursorErrorFields> {}\n\n/**\n * A run operation is unavailable for the current runtime or run state.\n *\n * @see {@link RunOperation}\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorUnsupportedOperationError extends Data.TaggedError(\n \"CursorUnsupportedOperationError\",\n)<CursorErrorFields & { readonly sdkOperation?: RunOperation }> {}\n\n/**\n * A run reached an error terminal state or failed to produce a usable result.\n *\n * @see {@link RunResult}\n * @category errors\n */\nexport class CursorRunFailedError extends Data.TaggedError(\n \"CursorRunFailedError\",\n)<CursorErrorFields> {}\n\n/**\n * Stream creation or iteration failed.\n *\n * @see {@link CursorRunService}\n * @see {@link SDKMessage}\n * @category errors\n */\nexport class CursorStreamError extends Data.TaggedError(\"CursorStreamError\")<CursorErrorFields> {}\n\n/**\n * Fallback for unknown SDK or JavaScript failures.\n *\n * @see {@link mapCursorError}\n * @category errors\n */\nexport class CursorUnknownError extends Data.TaggedError(\"CursorUnknownError\")<CursorErrorFields> {}\n\nconst messageFrom = (cause: unknown): string => {\n return cause instanceof Error ? cause.message : String(cause);\n};\n\nconst retryableFrom = (cause: unknown): boolean => {\n return cause instanceof CursorAgentError ? cause.isRetryable : false;\n};\n\n/**\n * Convert any SDK failure into a tagged Effect error.\n *\n * @param cause - Unknown value thrown by `@cursor/sdk` or JavaScript runtime code.\n * @param context - Safe operation metadata to attach to the tagged error.\n *\n * @example\n * ```ts\n * import { Effect } from \"effect\"\n * import { mapCursorError } from \"effect-cursor-sdk\"\n *\n * const effect = Effect.tryPromise({\n * try: () => run.wait(),\n * catch: (cause) => mapCursorError(cause, { operation: \"run.wait\", runId: run.id })\n * })\n * ```\n *\n * @see {@link CursorAuthenticationError}\n * @see {@link CursorUnsupportedOperationError}\n * @see {@link CursorStreamError}\n *\n * @category errors\n */\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext & { readonly operation: \"run.stream\" },\n): CursorStreamError;\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext & { readonly operation: \"run.cancel\" | \"run.conversation\" },\n):\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError;\nexport function mapCursorError(\n cause: unknown,\n context: CursorErrorContext,\n):\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError;\nexport function mapCursorError(cause: unknown, context: CursorErrorContext) {\n const fields = {\n ...context,\n message: messageFrom(cause),\n cause,\n isRetryable: retryableFrom(cause),\n };\n\n if (context.operation === \"run.stream\") {\n return new CursorStreamError(fields);\n }\n\n return Match.value(cause).pipe(\n Match.when(Match.instanceOf(AuthenticationError), () => {\n return new CursorAuthenticationError(fields);\n }),\n Match.when(Match.instanceOf(RateLimitError), () => {\n return new CursorRateLimitError(fields);\n }),\n Match.when(Match.instanceOf(IntegrationNotConnectedError), (error) => {\n return new CursorIntegrationNotConnectedError({\n ...fields,\n provider: error.provider,\n helpUrl: error.helpUrl,\n });\n }),\n Match.when(Match.instanceOf(UnsupportedRunOperationError), (error) => {\n return new CursorUnsupportedOperationError({\n ...fields,\n sdkOperation: error.operation as RunOperation | undefined,\n });\n }),\n Match.when(Match.instanceOf(ConfigurationError), () => {\n return new CursorConfigurationError(fields);\n }),\n Match.when(Match.instanceOf(NetworkError), () => {\n return new CursorNetworkError(fields);\n }),\n Match.when(Match.instanceOf(UnknownAgentError), () => {\n return new CursorUnknownError(fields);\n }),\n Match.when(Match.instanceOf(CursorAgentError), () => {\n return new CursorUnknownError(fields);\n }),\n Match.orElse(() => {\n return new CursorUnknownError(fields);\n }),\n );\n}\n","import { Config, ConfigProvider, Effect, Option, Redacted, Schema } from \"effect\";\n\nimport type { AgentOptions, ModelSelection } from \"./cursor-types\";\n\n/**\n * Branded secret material for the Cursor API key.\n *\n * Values are held inside {@link Redacted} on {@link CursorConfig}; this schema\n * only brands the decoded plaintext type so it cannot be confused with other\n * strings at the type level.\n */\nexport const CursorApiKey = Schema.Redacted(Schema.String).pipe(Schema.brand(\"CursorApiKey\"));\nexport type CursorApiKey = typeof CursorApiKey.Type;\n\n/**\n * Branded model identifier from wrapper config.\n *\n * Populated from the `CURSOR_MODEL` environment variable when using\n * {@link loadCursorConfig}.\n */\nexport const CursorModelId = Schema.String.pipe(Schema.brand(\"CursorModelId\"));\nexport type CursorModelId = typeof CursorModelId.Type;\n\n/**\n * Branded local working directory for agent runs.\n *\n * Populated from `CURSOR_LOCAL_CWD` when using {@link loadCursorConfig}.\n */\nexport const CursorLocalCwd = Schema.String.pipe(Schema.brand(\"CursorLocalCwd\"));\nexport type CursorLocalCwd = typeof CursorLocalCwd.Type;\n\n/**\n * Minimal configuration owned by this wrapper.\n *\n * The SDK's `AgentOptions` type remains the source of truth for complete\n * runtime options. This schema models environment-derived defaults only.\n * Use {@link agentOptionsFromConfig} to merge those defaults into SDK-owned\n * {@link AgentOptions} at the SDK boundary.\n *\n * @remarks\n * **Preferred path:** Load defaults with {@link loadCursorConfig}, then call\n * `CursorAgentService` methods such as `createFromConfig` (and related helpers)\n * or merge manually with {@link agentOptionsFromConfig}. Passing plain\n * {@link AgentOptions} directly to deprecated `create` / `resume` / `prompt` /\n * `scoped` overloads may be removed in a future major version.\n *\n * @example\n * ```ts\n * const config = new CursorConfig({\n * apiKey: Redacted.make(CursorApiKey.make(process.env.CURSOR_API_KEY!)),\n * modelId: CursorModelId.make(\"composer-2\"),\n * cwd: CursorLocalCwd.make(process.cwd())\n * })\n * ```\n *\n * @see {@link cursorConfig}\n * @see {@link loadCursorConfig}\n *\n * @category config\n */\nexport class CursorConfig extends Schema.Class<CursorConfig>(\"CursorConfig\")({\n apiKey: Schema.optional(CursorApiKey),\n modelId: Schema.optional(CursorModelId),\n cwd: Schema.optional(CursorLocalCwd),\n}) {}\n\n/**\n * Effect Config descriptors for common Cursor environment variables.\n *\n * Reads `CURSOR_API_KEY`, `CURSOR_MODEL`, and `CURSOR_LOCAL_CWD` from the active\n * Effect {@link ConfigProvider.ConfigProvider}. All fields are optional so\n * callers can merge with explicit overrides via {@link agentOptionsFromConfig}.\n *\n * @example\n * ```ts\n * const config = yield* loadCursorConfig\n * const options = agentOptionsFromConfig(config)\n * ```\n *\n * @see {@link Config}\n * @see {@link loadCursorConfig}\n *\n * @category config\n */\nexport const cursorConfig = Config.all({\n apiKey: Config.redacted(\"CURSOR_API_KEY\").pipe(Config.option),\n modelId: Config.string(\"CURSOR_MODEL\").pipe(Config.option),\n cwd: Config.string(\"CURSOR_LOCAL_CWD\").pipe(Config.option),\n});\n\n/**\n * Build SDK `AgentOptions` from wrapper config and optional overrides.\n *\n * This is the adapter from typed, redacted {@link CursorConfig} to the SDK's\n * plain-string `apiKey` boundary. Prefer `CursorAgentService.createFromConfig`\n * (and related methods) over building {@link AgentOptions} by hand.\n *\n * @param config - Wrapper-owned environment defaults.\n * @param overrides - Complete or partial SDK-owned options to merge over the defaults.\n *\n * @example\n * ```ts\n * const options = agentOptionsFromConfig(config, {\n * cloud: {\n * repos: [{ url: \"https://github.com/acme/app\" }],\n * autoCreatePR: true\n * }\n * })\n * ```\n *\n * @see {@link CursorConfig}\n * @see {@link AgentOptions}\n *\n * @remarks\n * Explicit override values always win over environment-derived defaults.\n * For application code, prefer service methods that take {@link CursorConfig}\n * instead of calling this helper and then the deprecated `create` overload.\n *\n * @category config\n */\nexport const agentOptionsFromConfig = (\n config: CursorConfig,\n overrides: AgentOptions = {},\n): AgentOptions => {\n const model: ModelSelection | undefined =\n overrides.model ?? (config.modelId ? { id: config.modelId } : undefined);\n const hasNonEmptyLocalOverride =\n overrides.local !== undefined && Object.keys(overrides.local).length > 0;\n const local =\n config.cwd || hasNonEmptyLocalOverride\n ? {\n cwd: config.cwd,\n ...overrides.local,\n }\n : undefined;\n return {\n ...overrides,\n apiKey: overrides.apiKey ?? (config.apiKey ? Redacted.value(config.apiKey) : undefined),\n model,\n local,\n };\n};\n\n/**\n * Load environment-derived defaults as a schema-backed value.\n * It uses ConfigProvider to load the environment variables\n * with their default names (`CURSOR_API_KEY`, `CURSOR_MODEL`, `CURSOR_LOCAL_CWD`)\n * from {@link cursorConfig}.\n *\n * @example\n * ```ts\n * const config = yield* loadCursorConfig\n * const options = agentOptionsFromConfig(config, { local: { cwd: process.cwd() } })\n * // Or use CursorAgentService.createFromConfig(config, { local: { cwd: process.cwd() } })\n * ```\n *\n * To change the way that the environment variables are loaded,\n * you can do it with Effect by providing a custom ConfigProvider.\n *\n * ```ts\n * // For example: load via custom environment object\n * const config = yield* loadCursorConfig.pipe(\n * Effect.provideService(\n * ConfigProvider.ConfigProvider,\n * ConfigProvider.fromEnv({\n * env: {\n * CURSOR_API_KEY: \"crsr_******\",\n * CURSOR_MODEL: \"composer-2\",\n * CURSOR_LOCAL_CWD: \"/workspace\",\n * },\n * }),\n * ),\n * )\n * ```\n *\n * @see {@link cursorConfig}\n * @see {@link agentOptionsFromConfig}\n *\n * @remarks\n * This effect is the preferred entry for redacted environment defaults.\n * Pair it with {@link agentOptionsFromConfig} or `CursorAgentService` helpers\n * such as `createFromConfig`.\n *\n * @category config\n */\nexport const loadCursorConfig = Effect.gen(function* () {\n const provider = yield* ConfigProvider.ConfigProvider;\n const raw = yield* cursorConfig.parse(provider);\n const apiKey = Option.getOrUndefined(raw.apiKey);\n const modelId = Option.getOrUndefined(raw.modelId);\n const cwd = Option.getOrUndefined(raw.cwd);\n return new CursorConfig({\n apiKey: apiKey ? CursorApiKey.make(apiKey) : undefined,\n modelId: modelId !== undefined ? CursorModelId.make(modelId) : undefined,\n cwd: cwd !== undefined ? CursorLocalCwd.make(cwd) : undefined,\n });\n});\n","import { Agent, Cursor } from \"@cursor/sdk\";\nimport { Context, Layer } from \"effect\";\n\nimport type {\n AgentMessage,\n AgentOperationOptions,\n AgentOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n RunResult,\n SDKAgent,\n SDKAgentInfo,\n SDKModel,\n SDKRepository,\n SDKUser,\n} from \"./cursor-types\";\n\n/* oxlint-disable eslint/no-unused-vars -- type-only imports anchor TSDoc `{@link …}`; not referenced in code */\nimport type { CursorAgentService } from \"./cursor-agent\";\nimport type { CursorArtifactService } from \"./cursor-artifacts\";\nimport type { CursorInspectionService } from \"./cursor-inspection\";\nimport type { CursorRunService } from \"./cursor-run\";\n/* oxlint-enable eslint/no-unused-vars */\n\n/**\n * Thin boundary around the static `@cursor/sdk` APIs.\n *\n * Most application code should use {@link CursorAgentService},\n * {@link CursorRunService}, {@link CursorArtifactService}, and\n * {@link CursorInspectionService}. This factory exists so live code, tests, and\n * user applications can replace SDK construction and static calls without\n * monkey-patching imports.\n *\n * So in one line: you probably won't need this.\n *\n * @example\n * ```ts\n * import { CursorSdkFactory, CursorAgentService } from \"effect-cursor-sdk\"\n * import { Layer } from \"effect\"\n *\n * const TestSdk = Layer.succeed(CursorSdkFactory)(\n * CursorSdkFactory.of({\n * create: () => mockAgent,\n * // implement the remaining factory methods for your test\n * })\n * )\n * ```\n *\n * @see {@link CursorAgentService} for creating, resuming, sending, and disposing agents.\n * @see {@link CursorRunService} for wrapping `Run` handles.\n * @see {@link CursorInspectionService} for static agent and account APIs.\n * @see {@link CursorArtifactService} for artifact APIs on an SDK agent.\n *\n * @remarks\n * **Deprecated for application code:** `create`, `resume`, and `prompt` accept\n * raw {@link AgentOptions} (including a plain `apiKey` string). Prefer\n * {@link CursorAgentService} with `loadCursorConfig` and `createFromConfig` /\n * `resumeFromConfig` / `promptFromConfig` from this package instead.\n * This factory remains the low-level adapter for tests and advanced overrides.\n *\n * @category services\n */\nexport interface CursorSdkFactoryShape {\n /**\n * @deprecated Prefer {@link CursorAgentService} with config-based helpers.\n * Low-level adapter to `Agent.create`.\n */\n readonly create: (options: AgentOptions) => Promise<SDKAgent>;\n /**\n * @deprecated Prefer {@link CursorAgentService} with config-based helpers.\n * Low-level adapter to `Agent.resume`.\n */\n readonly resume: (agentId: string, options?: Partial<AgentOptions>) => Promise<SDKAgent>;\n /**\n * @deprecated Prefer {@link CursorAgentService} with config-based helpers.\n * Low-level adapter to `Agent.prompt`.\n */\n readonly prompt: (message: string, options?: AgentOptions) => Promise<RunResult>;\n readonly listAgents: (options?: ListAgentsOptions) => Promise<ListResult<SDKAgentInfo>>;\n readonly listRuns: (agentId: string, options?: ListRunsOptions) => Promise<ListResult<Run>>;\n readonly getRun: (runId: string, options?: GetRunOptions) => Promise<Run>;\n readonly getAgent: (agentId: string, options?: GetAgentOptions) => Promise<SDKAgentInfo>;\n readonly archiveAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly unarchiveAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly deleteAgent: (agentId: string, options?: AgentOperationOptions) => Promise<void>;\n readonly listMessages: (\n agentId: string,\n options?: GetAgentMessagesOptions,\n ) => Promise<AgentMessage[]>;\n readonly me: (options?: CursorRequestOptions) => Promise<SDKUser>;\n readonly listModels: (options?: CursorRequestOptions) => Promise<SDKModel[]>;\n readonly listRepositories: (options?: CursorRequestOptions) => Promise<SDKRepository[]>;\n}\n\n/**\n * Context service that provides the live `@cursor/sdk` static API boundary.\n *\n * Use {@link CursorSdkFactory.Live} in production layers and override the\n * service in tests with {@link makeMockSdkFactoryLayer} or a custom layer.\n *\n * @example\n * ```ts\n * import { CursorSdkFactory, agentOptionsFromConfig, loadCursorConfig } from \"effect-cursor-sdk\"\n * import { Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const sdk = yield* CursorSdkFactory\n * const config = yield* loadCursorConfig\n * return sdk.create(agentOptionsFromConfig(config, { model: { id: \"composer-2\" } }))\n * })\n * ```\n *\n * @see {@link CursorSdkFactoryShape}\n * @see {@link liveLayer}\n * @category services\n */\nexport class CursorSdkFactory extends Context.Service<CursorSdkFactory, CursorSdkFactoryShape>()(\n \"effect-cursor-sdk/cursor-sdk-factory/CursorSdkFactory\",\n) {\n static readonly Live = Layer.succeed(CursorSdkFactory)(\n CursorSdkFactory.of({\n create: (options: AgentOptions): Promise<SDKAgent> => {\n return Agent.create(options);\n },\n resume: (agentId: string, options?: Partial<AgentOptions>): Promise<SDKAgent> => {\n return Agent.resume(agentId, options);\n },\n prompt: (message: string, options?: AgentOptions): Promise<RunResult> => {\n return Agent.prompt(message, options);\n },\n listAgents: (options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>> => {\n return Agent.list(options);\n },\n listRuns: (agentId: string, options?: ListRunsOptions): Promise<ListResult<Run>> => {\n return Agent.listRuns(agentId, options);\n },\n getRun: (runId: string, options?: GetRunOptions): Promise<Run> => {\n return Agent.getRun(runId, options);\n },\n getAgent: (agentId: string, options?: GetAgentOptions): Promise<SDKAgentInfo> => {\n return Agent.get(agentId, options);\n },\n archiveAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.archive(agentId, options);\n },\n unarchiveAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.unarchive(agentId, options);\n },\n deleteAgent: (agentId: string, options?: AgentOperationOptions): Promise<void> => {\n return Agent.delete(agentId, options);\n },\n listMessages: (agentId: string, options?: GetAgentMessagesOptions) => {\n return Agent.messages.list(agentId, options);\n },\n me: (options?: CursorRequestOptions): Promise<SDKUser> => {\n return Cursor.me(options);\n },\n listModels: (options?: CursorRequestOptions): Promise<SDKModel[]> => {\n return Cursor.models.list(options);\n },\n listRepositories: (options?: CursorRequestOptions): Promise<SDKRepository[]> => {\n return Cursor.repositories.list(options);\n },\n }),\n );\n}\n","/**\n * Telemetry helpers for the Effect Cursor SDK boundary.\n *\n * Services wrap SDK calls with {@link instrument}, which records Effect metrics\n * and opens an OpenTelemetry-style span per {@link CursorOperation}. Named\n * `Metric.counter` values are exported so applications can wire them into a\n * metrics backend via Effect's metrics layer.\n *\n * {@link redact} is a small helper for scrubbing structured metadata before it\n * leaves a trust boundary (for example log attributes or debug payloads).\n *\n * @see {@link CursorOperation}\n * @see {@link CursorAgentService}\n * @see {@link CursorRunService}\n * @see {@link CursorInspectionService}\n * @see {@link CursorArtifactService}\n *\n * @module\n */\n\nimport { Effect, Metric } from \"effect\";\n\nimport type { CursorOperation } from \"./cursor-error\";\n\n/**\n * Increments once when an instrumented SDK effect **starts** execution.\n *\n * Bound to the metric key `cursor_operations_started`. Used by\n * {@link instrument} on every wrapped call; pair with\n * {@link cursorOperationsFailed} to compute failure rates per operation when\n * both counters are exported to your metrics stack.\n *\n * @see {@link instrument}\n * @see {@link cursorOperationsFailed}\n *\n * @category telemetry\n */\nexport const cursorOperationsStarted = Metric.counter(\"cursor_operations_started\");\n\n/**\n * Increments once when an instrumented SDK effect **fails** (any error channel\n * value), after {@link cursorOperationsStarted} has already been recorded for\n * that run.\n *\n * Bound to the metric key `cursor_operations_failed`. Failures are tracked in\n * `Effect.tapError` so the effect still fails with the original error; this\n * counter is observability-only.\n *\n * @see {@link instrument}\n * @see {@link cursorOperationsStarted}\n *\n * @category telemetry\n */\nexport const cursorOperationsFailed = Metric.counter(\"cursor_operations_failed\");\n\n/**\n * Counter reserved for **per-message** or **per-chunk** stream throughput.\n *\n * Bound to the metric key `cursor_stream_events`. The service wrappers do not\n * attach this metric automatically to {@link CursorRunService.streamEvents};\n * export it from your app if you want to `Metric.track` inside a\n * `Stream.tapEffect` (or similar) when consuming SDK stream payloads.\n *\n * @see {@link CursorRunService}\n *\n * @category telemetry\n */\nexport const cursorStreamEvents = Metric.counter(\"cursor_stream_events\");\n\n/** String substituted for values under sensitive-looking keys. */\nconst REDACTED_MARKER = \"[redacted]\";\n\n/** Replaces non-plain objects (for example `Date`, `Map`) so they are not mistaken for empty `{}`. */\nconst OPAQUE_MARKER = \"[opaque]\";\n\n/** Replaces a value when the same object appears on the recursion stack (true cycles only). */\nconst CIRCULAR_MARKER = \"[circular]\";\n\n/** Replaces nested values when recursion depth exceeds this limit (prevents stack overflow). */\nconst MAX_REDACT_DEPTH = 64;\n\nconst isPlainObject = (value: object): boolean => {\n const proto = Object.getPrototypeOf(value);\n return proto === null || proto === Object.prototype;\n};\n\n/**\n * Lower-cased key substring / equality checks. Substrings such as `key` also\n * match `apiKey` (and unfortunately unrelated keys like `monkey`); that is an\n * intentional tradeoff for simple log scrubbing.\n */\nconst isSensitiveKeyName = (normalized: string): boolean => {\n if (normalized === \"authorization\" || normalized === \"data\") return true;\n return (\n normalized.includes(\"key\") ||\n normalized.includes(\"token\") ||\n normalized.includes(\"secret\") ||\n normalized.includes(\"password\") ||\n normalized.includes(\"passwd\") ||\n normalized.includes(\"credential\") ||\n normalized.includes(\"cookie\") ||\n normalized.includes(\"jwt\") ||\n normalized.includes(\"bearer\")\n );\n};\n\nconst redactInner = (value: unknown, path: Set<object>, depth: number): unknown => {\n if (depth > MAX_REDACT_DEPTH) {\n return OPAQUE_MARKER;\n }\n\n if (Array.isArray(value)) {\n if (path.has(value)) {\n return CIRCULAR_MARKER;\n }\n path.add(value);\n const out = value.map((item) => {\n return redactInner(item, path, depth + 1);\n });\n path.delete(value);\n return out;\n }\n\n if (value === null || typeof value !== \"object\") {\n return value;\n }\n\n if (!isPlainObject(value)) {\n return OPAQUE_MARKER;\n }\n\n if (path.has(value)) {\n return CIRCULAR_MARKER;\n }\n\n path.add(value);\n const out = Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, item]) => {\n const normalized = key.toLowerCase();\n if (isSensitiveKeyName(normalized)) {\n return [key, REDACTED_MARKER];\n }\n return [key, redactInner(item, path, depth + 1)];\n }),\n );\n path.delete(value);\n return out;\n};\n\n/**\n * Deep-clones **plain** objects and arrays while replacing values under keys that\n * often carry secrets, bearer material, or large opaque blobs (for example API\n * keys, tokens, passwords, cookies, `Authorization`, or a generic `data` field).\n *\n * Matching is **substring-based on the lower-cased key name** (for example\n * `apiKey`, `CURSOR_API_TOKEN`, `client_secret`, `setCookie` all match). Primitives\n * and `null` pass through unchanged. Non-plain objects (for example `Date`, `Map`,\n * class instances) are replaced by `\"[opaque]\"` so they are not serialized as empty\n * objects. True circular references in the input are replaced by `\"[circular]\"`.\n * Recursion deeper than 64 levels falls back to `\"[opaque]\"` for the overflow branch.\n *\n * This is a best-effort redactor for logs and attributes—not a cryptographic\n * guarantee; do not rely on it for compliance redaction without review.\n *\n * @param value - Arbitrary JSON-like value to sanitize.\n * @returns A structure of the same shape with sensitive-looking entries replaced\n * by the string `\"[redacted]\"`.\n *\n * @example\n * ```ts\n * redact({ apiKey: \"secret\", nested: { token: \"x\" }, safe: 1 })\n * // => { apiKey: \"[redacted]\", nested: { token: \"[redacted]\" }, safe: 1 }\n * ```\n *\n * @category telemetry\n */\nexport const redact = (value: unknown): unknown => {\n return redactInner(value, new Set(), 0);\n};\n\n/**\n * Wraps an SDK-backed {@link Effect.Effect | Effect} with consistent\n * observability: increments {@link cursorOperationsStarted} at execution start,\n * increments {@link cursorOperationsFailed} on the error channel, and attaches\n * a span named `cursor.<operation>` (for example `cursor.agent.list`).\n *\n * The span name is stable and includes the {@link CursorOperation} tag space\n * so traces can be filtered consistently across agent, run, artifact, and\n * inspection APIs.\n *\n * @param operation - Logical SDK operation; must match {@link CursorOperation}\n * for typed error mapping and trace taxonomy.\n * @param effect - The effect produced by `Effect.tryPromise` (or similar)\n * around a single SDK call.\n * @returns The same effect type `Effect<A, E, R>` with metrics and span\n * attached; success and failure values are unchanged.\n *\n * @example\n * ```ts\n * import { Effect } from \"effect\"\n * import { instrument } from \"./cursor-telemetry\"\n *\n * const eff = instrument(\n * \"agent.get\",\n * Effect.tryPromise({\n * try: () => sdk.getAgent(id),\n * catch: (e) => e,\n * }),\n * )\n * ```\n *\n * @see {@link cursorOperationsStarted}\n * @see {@link cursorOperationsFailed}\n * @see {@link CursorOperation}\n *\n * @category telemetry\n */\nexport const instrument = <A, E, R>(\n operation: CursorOperation,\n effect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, E, R> => {\n return effect.pipe(\n Effect.track(cursorOperationsStarted.pipe(Metric.withConstantInput(1))),\n Effect.tapError(() => {\n return Effect.track(Effect.void, cursorOperationsFailed.pipe(Metric.withConstantInput(1)));\n }),\n Effect.withSpan(`cursor.${operation}`),\n );\n};\n","import { Context, Effect, Layer, type Scope } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { agentOptionsFromConfig, type CursorConfig } from \"./cursor-config\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type {\n AgentOptions,\n Run,\n RunResult,\n SDKAgent,\n SDKUserMessage,\n SendOptions,\n} from \"./cursor-types\";\n\n/**\n * Agent lifecycle surface backed by the Cursor SDK.\n *\n * @remarks\n * Prefer {@link loadCursorConfig} with {@link CursorAgentServiceShape.createFromConfig},\n * {@link CursorAgentServiceShape.resumeFromConfig},\n * {@link CursorAgentServiceShape.promptFromConfig}, and\n * {@link CursorAgentServiceShape.scopedFromConfig}\n * so secrets stay in `Redacted` form until {@link agentOptionsFromConfig}\n * merges into SDK {@link AgentOptions}. Plain {@link AgentOptions} entry points\n * are deprecated; see `DEPRECATIONS.md` and the README at the package root.\n */\nexport interface CursorAgentServiceShape {\n /**\n * @deprecated Prefer {@link CursorAgentServiceShape.createFromConfig} with {@link loadCursorConfig}\n * instead of raw {@link AgentOptions} (including a plain `apiKey` string). Next major: `createFromConfig`\n * is planned to become `create` with the same parameters.\n */\n readonly create: (\n options: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * Create an agent from {@link CursorConfig} and optional SDK overrides.\n *\n * @remarks\n * Next major: planned rename to `create` with the same signature once plain-`AgentOptions` entry points are removed.\n *\n * @see {@link loadCursorConfig}\n * @see {@link agentOptionsFromConfig}\n */\n readonly createFromConfig: (\n config: CursorConfig,\n overrides?: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * @deprecated Prefer {@link CursorAgentServiceShape.resumeFromConfig} with {@link loadCursorConfig}\n * instead of raw {@link AgentOptions}. Next major: `resumeFromConfig` is planned to become `resume` with the same parameters.\n */\n readonly resume: (\n agentId: string,\n options?: Partial<AgentOptions>,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * Resume an agent from {@link CursorConfig} and optional SDK overrides.\n *\n * @remarks\n * Next major: planned rename to `resume` with the same signature once plain-`AgentOptions` entry points are removed.\n *\n * @see {@link loadCursorConfig}\n * @see {@link agentOptionsFromConfig}\n */\n readonly resumeFromConfig: (\n agentId: string,\n config: CursorConfig,\n overrides?: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * @deprecated Prefer {@link CursorAgentServiceShape.promptFromConfig} with {@link loadCursorConfig}\n * instead of raw {@link AgentOptions}. Next major: `promptFromConfig` is planned to become `prompt` with the same parameters.\n */\n readonly prompt: (\n message: string,\n options?: AgentOptions,\n ) => Effect.Effect<\n RunResult,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * One-shot prompt from {@link CursorConfig} and optional SDK overrides.\n *\n * @remarks\n * Next major: planned rename to `prompt` with the same signature once plain-`AgentOptions` entry points are removed.\n *\n * @see {@link loadCursorConfig}\n * @see {@link agentOptionsFromConfig}\n */\n readonly promptFromConfig: (\n message: string,\n config: CursorConfig,\n overrides?: AgentOptions,\n ) => Effect.Effect<\n RunResult,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly send: (\n agent: SDKAgent,\n message: string | SDKUserMessage,\n options?: SendOptions,\n ) => Effect.Effect<\n Run,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly reload: (\n agent: SDKAgent,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly close: (agent: SDKAgent) => Effect.Effect<void>;\n readonly dispose: (\n agent: SDKAgent,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n /**\n * @deprecated Prefer {@link CursorAgentServiceShape.scopedFromConfig} with {@link loadCursorConfig}\n * instead of raw {@link AgentOptions}. Next major: `scopedFromConfig` is planned to become `scoped` with the same parameters.\n */\n readonly scoped: (\n options: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError,\n Scope.Scope\n >;\n /**\n * Acquire an agent in a scope from {@link CursorConfig} and optional SDK overrides.\n *\n * @remarks\n * Next major: planned rename to `scoped` with the same signature once plain-`AgentOptions` entry points are removed.\n *\n * @see {@link loadCursorConfig}\n * @see {@link agentOptionsFromConfig}\n */\n readonly scopedFromConfig: (\n config: CursorConfig,\n overrides?: AgentOptions,\n ) => Effect.Effect<\n SDKAgent,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError,\n Scope.Scope\n >;\n}\n\n/**\n * Effect-native agent lifecycle and prompt service.\n *\n * The service wraps `Agent.create`, `Agent.resume`, `Agent.prompt`, and\n * instance lifecycle methods while preserving SDK-owned option and result\n * types.\n *\n * @example\n * ```ts\n * import { CursorAgentService, liveLayer, loadCursorConfig } from \"effect-cursor-sdk\"\n * import { Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const agents = yield* CursorAgentService\n * const config = yield* loadCursorConfig\n * const agent = yield* agents.createFromConfig(config, {\n * model: { id: \"composer-2\" },\n * local: { cwd: process.cwd() },\n * })\n * return yield* agents.send(agent, \"Summarize this repository\")\n * }).pipe(Effect.provide(liveLayer))\n * ```\n *\n * @see {@link CursorRunService} for operations on returned `Run` handles.\n * @see {@link CursorSdkFactory} for replacing SDK construction in tests.\n *\n * @remarks\n * Prefer {@link CursorAgentServiceShape.createFromConfig} and related methods\n * with {@link loadCursorConfig}; raw {@link AgentOptions} on\n * {@link CursorAgentServiceShape.create} and siblings are deprecated.\n * See `DEPRECATIONS.md` at the package root for migration and planned next-major renames\n * (`createFromConfig` → `create`, etc.).\n *\n * @category services\n */\nexport class CursorAgentService extends Context.Service<\n CursorAgentService,\n CursorAgentServiceShape\n>()(\"effect-cursor-sdk/cursor-agent/CursorAgentService\") {\n static readonly Live = Layer.effect(CursorAgentService)(\n Effect.gen(function* () {\n const sdk = yield* CursorSdkFactory;\n\n const create = (options: AgentOptions) => {\n return instrument(\n \"agent.create\",\n Effect.tryPromise({\n try: () => sdk.create(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.create\" });\n },\n }),\n );\n };\n\n const resume = (agentId: string, options?: Partial<AgentOptions>) => {\n return instrument(\n \"agent.resume\",\n Effect.tryPromise({\n try: () => sdk.resume(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.resume\", agentId });\n },\n }),\n );\n };\n\n const prompt = (message: string, options?: AgentOptions) => {\n return instrument(\n \"agent.prompt\",\n Effect.tryPromise({\n try: () => sdk.prompt(message, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.prompt\" });\n },\n }),\n );\n };\n\n const send = (agent: SDKAgent, message: string | SDKUserMessage, options?: SendOptions) => {\n return instrument(\n \"agent.send\",\n Effect.tryPromise({\n try: () => agent.send(message, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.send\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const reload = (agent: SDKAgent) => {\n return instrument(\n \"agent.reload\",\n Effect.tryPromise({\n try: () => agent.reload(),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.reload\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const close = (agent: SDKAgent): Effect.Effect<void> => {\n return instrument(\n \"agent.close\",\n Effect.sync(() => agent.close()),\n );\n };\n\n const dispose = (agent: SDKAgent) => {\n return instrument(\n \"agent.dispose\",\n Effect.tryPromise({\n try: () => agent[Symbol.asyncDispose](),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.dispose\", agentId: agent.agentId });\n },\n }),\n );\n };\n\n const scoped = (options: AgentOptions) => {\n return Effect.acquireRelease(create(options), (agent) => {\n return Effect.ignore(dispose(agent));\n });\n };\n\n const createFromConfig = (config: CursorConfig, overrides: AgentOptions = {}) => {\n return create(agentOptionsFromConfig(config, overrides));\n };\n\n const resumeFromConfig = (\n agentId: string,\n config: CursorConfig,\n overrides: AgentOptions = {},\n ) => {\n return resume(agentId, agentOptionsFromConfig(config, overrides));\n };\n\n const promptFromConfig = (\n message: string,\n config: CursorConfig,\n overrides: AgentOptions = {},\n ) => {\n return prompt(message, agentOptionsFromConfig(config, overrides));\n };\n\n const scopedFromConfig = (config: CursorConfig, overrides: AgentOptions = {}) => {\n return scoped(agentOptionsFromConfig(config, overrides));\n };\n\n return {\n create,\n createFromConfig,\n resume,\n resumeFromConfig,\n prompt,\n promptFromConfig,\n send,\n reload,\n close,\n dispose,\n scoped,\n scopedFromConfig,\n } as const;\n }),\n );\n}\n","import { Context, Effect, Layer } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type { SDKAgent, SDKArtifact } from \"./cursor-types\";\n\nexport interface CursorArtifactServiceShape {\n readonly listArtifacts: (\n agent: SDKAgent,\n ) => Effect.Effect<\n SDKArtifact[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly downloadArtifact: (\n agent: SDKAgent,\n path: string,\n ) => Effect.Effect<\n Buffer,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n}\n\n/**\n * Effect-native wrappers for agent artifacts.\n *\n * @example\n * ```ts\n * const artifacts = yield* CursorArtifactService\n * const items = yield* artifacts.listArtifacts(agent)\n * const bytes = yield* artifacts.downloadArtifact(agent, items[0]!.path)\n * ```\n *\n * @see {@link SDKArtifact}\n *\n * @category services\n */\nexport class CursorArtifactService extends Context.Service<\n CursorArtifactService,\n CursorArtifactServiceShape\n>()(\"effect-cursor-sdk/cursor-artifacts/CursorArtifactService\") {\n static readonly Live = Layer.succeed(CursorArtifactService)(\n CursorArtifactService.of({\n listArtifacts: (agent: SDKAgent) => {\n return instrument(\n \"artifacts.list\",\n Effect.tryPromise({\n try: () => agent.listArtifacts(),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"artifacts.list\", agentId: agent.agentId });\n },\n }),\n );\n },\n downloadArtifact: (agent: SDKAgent, path: string) => {\n return instrument(\n \"artifacts.download\",\n Effect.tryPromise({\n try: () => agent.downloadArtifact(path),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"artifacts.download\",\n agentId: agent.agentId,\n });\n },\n }),\n );\n },\n }),\n );\n}\n","import { Context, Effect, Layer } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorUnknownError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type {\n AgentMessage,\n AgentOperationOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n SDKAgentInfo,\n SDKModel,\n SDKRepository,\n SDKUser,\n} from \"./cursor-types\";\n\nexport interface CursorInspectionServiceShape {\n readonly listAgents: (\n options?: ListAgentsOptions,\n ) => Effect.Effect<\n ListResult<SDKAgentInfo>,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly getAgent: (\n agentId: string,\n options?: GetAgentOptions,\n ) => Effect.Effect<\n SDKAgentInfo,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly archiveAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly unarchiveAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly deleteAgent: (\n agentId: string,\n options?: AgentOperationOptions,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listRuns: (\n agentId: string,\n options?: ListRunsOptions,\n ) => Effect.Effect<\n ListResult<Run>,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly getRun: (\n runId: string,\n options?: GetRunOptions,\n ) => Effect.Effect<\n Run,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listMessages: (\n agentId: string,\n options?: GetAgentMessagesOptions,\n ) => Effect.Effect<\n AgentMessage[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly me: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKUser,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listModels: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKModel[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly listRepositories: (\n options?: CursorRequestOptions,\n ) => Effect.Effect<\n SDKRepository[],\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n}\n\n/**\n * Effect-native wrappers for SDK inspection, lifecycle, and account catalog APIs.\n *\n * @example\n * ```ts\n * const inspection = yield* CursorInspectionService\n * const agents = yield* inspection.listAgents({ runtime: \"cloud\", includeArchived: true })\n * const models = yield* inspection.listModels()\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link SDKAgentInfo}\n *\n * @category services\n */\nexport class CursorInspectionService extends Context.Service<\n CursorInspectionService,\n CursorInspectionServiceShape\n>()(\"effect-cursor-sdk/cursor-inspection/CursorInspectionService\") {\n static readonly Live = Layer.effect(CursorInspectionService)(\n Effect.gen(function* () {\n const sdk = yield* CursorSdkFactory;\n return {\n listAgents: (options?: ListAgentsOptions) => {\n return instrument(\n \"agent.list\",\n Effect.tryPromise({\n try: () => sdk.listAgents(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.list\" });\n },\n }),\n );\n },\n getAgent: (agentId: string, options?: GetAgentOptions) => {\n return instrument(\n \"agent.get\",\n Effect.tryPromise({\n try: () => sdk.getAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.get\", agentId });\n },\n }),\n );\n },\n archiveAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.archive\",\n Effect.tryPromise({\n try: () => sdk.archiveAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.archive\", agentId });\n },\n }),\n );\n },\n unarchiveAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.unarchive\",\n Effect.tryPromise({\n try: () => sdk.unarchiveAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.unarchive\", agentId });\n },\n }),\n );\n },\n deleteAgent: (agentId: string, options?: AgentOperationOptions) => {\n return instrument(\n \"agent.delete\",\n Effect.tryPromise({\n try: () => sdk.deleteAgent(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"agent.delete\", agentId });\n },\n }),\n );\n },\n listRuns: (agentId: string, options?: ListRunsOptions) => {\n return instrument(\n \"run.list\",\n Effect.tryPromise({\n try: () => sdk.listRuns(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"run.list\", agentId });\n },\n }),\n );\n },\n getRun: (runId: string, options?: GetRunOptions) => {\n return instrument(\n \"run.get\",\n Effect.tryPromise({\n try: () => sdk.getRun(runId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"run.get\", runId });\n },\n }),\n );\n },\n listMessages: (agentId: string, options?: GetAgentMessagesOptions) => {\n return instrument(\n \"messages.list\",\n Effect.tryPromise({\n try: () => sdk.listMessages(agentId, options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"messages.list\", agentId });\n },\n }),\n );\n },\n me: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.me\",\n Effect.tryPromise({\n try: () => sdk.me(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.me\" });\n },\n }),\n );\n },\n listModels: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.models.list\",\n Effect.tryPromise({\n try: () => sdk.listModels(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.models.list\" });\n },\n }),\n );\n },\n listRepositories: (options?: CursorRequestOptions) => {\n return instrument(\n \"cursor.repositories.list\",\n Effect.tryPromise({\n try: () => sdk.listRepositories(options),\n catch: (cause) => {\n return mapCursorError(cause, { operation: \"cursor.repositories.list\" });\n },\n }),\n );\n },\n } as const;\n }),\n );\n}\n","import { Layer } from \"effect\";\n\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\nimport type {\n AgentMessage,\n AgentOperationOptions,\n AgentOptions,\n CursorRequestOptions,\n GetAgentMessagesOptions,\n GetAgentOptions,\n GetRunOptions,\n ListAgentsOptions,\n ListResult,\n ListRunsOptions,\n Run,\n RunOperation,\n RunResult,\n RunStatus,\n SDKAgent,\n SDKAgentInfo,\n SDKArtifact,\n SDKMessage,\n SDKModel,\n SDKRepository,\n SDKUser,\n SDKUserMessage,\n SendOptions,\n} from \"./cursor-types\";\n\n/**\n * Fixture data used by the deterministic mock SDK layer.\n *\n * @example\n * ```ts\n * const fixtures: CursorMockFixtures = {\n * stream: [assistantEvent],\n * result: { id: \"run-1\", status: \"finished\", result: \"Done\" }\n * }\n * ```\n *\n * @see {@link mockLayer}\n * @see {@link makeMockSdkFactoryLayer}\n * @category testing\n */\nexport interface CursorMockFixtures {\n readonly agentId?: string;\n readonly runId?: string;\n readonly stream?: ReadonlyArray<SDKMessage>;\n readonly result?: RunResult;\n readonly artifacts?: ReadonlyArray<SDKArtifact>;\n readonly artifactData?: Buffer;\n readonly agents?: ReadonlyArray<SDKAgentInfo>;\n readonly messages?: ReadonlyArray<AgentMessage>;\n readonly models?: ReadonlyArray<SDKModel>;\n readonly repositories?: ReadonlyArray<SDKRepository>;\n readonly user?: SDKUser;\n}\n\n/**\n * Deterministic SDK `Run` implementation for tests.\n *\n * @param streamEvents - Events yielded by {@link MockCursorRun.stream}.\n * @param waitResult - Result returned by {@link MockCursorRun.wait}.\n *\n * @example\n * ```ts\n * const run = new MockCursorRun([assistantEvent], {\n * id: \"run-1\",\n * status: \"finished\",\n * result: \"Done\"\n * })\n * ```\n *\n * @see {@link makeMockRun}\n * @category testing\n */\nexport class MockCursorRun implements Run {\n readonly id: string;\n readonly agentId: string;\n readonly createdAt = Date.now();\n #status: RunStatus;\n #listeners = new Set<(status: RunStatus) => void>();\n\n constructor(\n readonly streamEvents: ReadonlyArray<SDKMessage>,\n readonly waitResult: RunResult,\n ) {\n this.id = waitResult.id;\n this.agentId = streamEvents[0]?.agent_id ?? \"mock-agent\";\n this.#status = waitResult.status;\n }\n\n get status(): RunStatus {\n return this.#status;\n }\n get result(): string | undefined {\n return this.waitResult.result;\n }\n get model(): RunResult[\"model\"] {\n return this.waitResult.model;\n }\n get durationMs(): number | undefined {\n return this.waitResult.durationMs;\n }\n get git(): RunResult[\"git\"] {\n return this.waitResult.git;\n }\n supports(_operation: RunOperation): boolean {\n return true;\n }\n unsupportedReason(_operation: RunOperation): string | undefined {\n return undefined;\n }\n async *stream(): AsyncGenerator<SDKMessage, void> {\n yield* this.streamEvents;\n }\n async conversation(): Promise<[]> {\n return [];\n }\n async wait(): Promise<RunResult> {\n return this.waitResult;\n }\n async cancel(): Promise<void> {\n this.#status = \"cancelled\";\n for (const listener of this.#listeners) listener(this.#status);\n }\n onDidChangeStatus(listener: (status: RunStatus) => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n}\n\n/**\n * Deterministic SDK `Agent` implementation for tests.\n *\n * @param fixtures - Static data used by `send`, artifact methods, and metadata methods.\n *\n * @example\n * ```ts\n * const agent = new MockCursorAgent({ result: { id: \"run-1\", status: \"finished\" } })\n * const run = await agent.send(\"hello\")\n * ```\n *\n * @see {@link makeMockAgent}\n * @see {@link CursorMockFixtures}\n * @category testing\n */\nexport class MockCursorAgent implements SDKAgent {\n readonly agentId: string;\n readonly runs: Run[] = [];\n closed = false;\n\n constructor(readonly fixtures: CursorMockFixtures = {}) {\n this.agentId = fixtures.agentId ?? \"mock-agent\";\n }\n\n get model(): AgentOptions[\"model\"] | undefined {\n return this.fixtures.result?.model;\n }\n\n async send(_message: string | SDKUserMessage, _options?: SendOptions): Promise<Run> {\n const run = makeMockRun(this.fixtures);\n this.runs.push(run);\n return run;\n }\n close(): void {\n this.closed = true;\n }\n async reload(): Promise<void> {}\n async [Symbol.asyncDispose](): Promise<void> {\n this.closed = true;\n }\n async listArtifacts(): Promise<SDKArtifact[]> {\n return [...(this.fixtures.artifacts ?? [])];\n }\n async downloadArtifact(_path: string): Promise<Buffer> {\n return this.fixtures.artifactData ?? Buffer.from(\"\");\n }\n}\n\n/**\n * Create a mock run from fixtures.\n *\n * @param fixtures - Optional mock run and stream data.\n *\n * @see {@link MockCursorRun}\n * @category testing\n */\nexport const makeMockRun = (fixtures: CursorMockFixtures = {}): MockCursorRun => {\n const runId = fixtures.runId ?? \"mock-run\";\n return new MockCursorRun(\n fixtures.stream ?? [],\n fixtures.result ?? { id: runId, status: \"finished\", result: \"\" },\n );\n};\n\n/**\n * Create a mock agent from fixtures.\n *\n * @param fixtures - Optional mock agent, run, artifact, and metadata data.\n *\n * @see {@link MockCursorAgent}\n * @category testing\n */\nexport const makeMockAgent = (fixtures: CursorMockFixtures = {}): MockCursorAgent => {\n return new MockCursorAgent(fixtures);\n};\n\n/**\n * Layer replacing the SDK factory with deterministic mock behavior.\n *\n * This is the lowest-level mock entry point. Prefer {@link mockLayer} when you\n * want all higher-level services wired together for tests.\n *\n * @param fixtures - Static SDK responses returned by the factory methods.\n *\n * @example\n * ```ts\n * const layer = makeMockSdkFactoryLayer({\n * agents: [{ agentId: \"mock-agent\", name: \"Mock\", summary: \"Test\", lastModified: 0 }]\n * })\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link mockLayer}\n * @category testing\n */\nexport const makeMockSdkFactoryLayer = (fixtures: CursorMockFixtures = {}) => {\n return Layer.succeed(\n CursorSdkFactory,\n CursorSdkFactory.of({\n create: (_options: AgentOptions): Promise<SDKAgent> => {\n return Promise.resolve(makeMockAgent(fixtures));\n },\n resume: (_agentId: string, _options?: Partial<AgentOptions>): Promise<SDKAgent> => {\n return Promise.resolve(makeMockAgent(fixtures));\n },\n prompt: async (_message: string, _options?: AgentOptions): Promise<RunResult> => {\n return (\n fixtures.result ?? { id: fixtures.runId ?? \"mock-run\", status: \"finished\", result: \"\" }\n );\n },\n listAgents: async (_options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>> => {\n return { items: [...(fixtures.agents ?? [])] };\n },\n listRuns: async (_agentId: string, _options?: ListRunsOptions): Promise<ListResult<Run>> => {\n return { items: [makeMockRun(fixtures)] };\n },\n getRun: async (_runId: string, _options?: GetRunOptions): Promise<Run> => {\n return makeMockRun(fixtures);\n },\n getAgent: async (_agentId: string, _options?: GetAgentOptions): Promise<SDKAgentInfo> => {\n return (\n fixtures.agents?.[0] ?? {\n agentId: fixtures.agentId ?? \"mock-agent\",\n name: \"Mock Agent\",\n summary: \"Deterministic mock agent\",\n lastModified: 0,\n }\n );\n },\n archiveAgent: async (_agentId: string, _options?: AgentOperationOptions): Promise<void> => {},\n unarchiveAgent: async (\n _agentId: string,\n _options?: AgentOperationOptions,\n ): Promise<void> => {},\n deleteAgent: async (_agentId: string, _options?: AgentOperationOptions): Promise<void> => {},\n listMessages: async (\n _agentId: string,\n _options?: GetAgentMessagesOptions,\n ): Promise<AgentMessage[]> => {\n return [...(fixtures.messages ?? [])];\n },\n me: async (_options?: CursorRequestOptions): Promise<SDKUser> => {\n return fixtures.user ?? { apiKeyName: \"mock\", createdAt: \"1970-01-01T00:00:00.000Z\" };\n },\n listModels: async (_options?: CursorRequestOptions): Promise<SDKModel[]> => {\n return [...(fixtures.models ?? [])];\n },\n listRepositories: async (_options?: CursorRequestOptions): Promise<SDKRepository[]> => {\n return [...(fixtures.repositories ?? [])];\n },\n }),\n );\n};\n","import { Context, Effect, Layer, Stream } from \"effect\";\n\nimport {\n CursorAuthenticationError,\n CursorConfigurationError,\n CursorIntegrationNotConnectedError,\n CursorNetworkError,\n CursorRateLimitError,\n CursorStreamError,\n CursorUnknownError,\n CursorUnsupportedOperationError,\n mapCursorError,\n} from \"./cursor-error\";\nimport { instrument } from \"./cursor-telemetry\";\nimport type { Run, RunOperation, RunResult, RunStatus, SDKMessage } from \"./cursor-types\";\n\nexport interface CursorRunServiceShape {\n readonly supports: (run: Run, operation: RunOperation) => boolean;\n readonly unsupportedReason: (run: Run, operation: RunOperation) => string | undefined;\n readonly wait: (\n run: Run,\n ) => Effect.Effect<\n RunResult,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnknownError\n >;\n readonly cancel: (\n run: Run,\n ) => Effect.Effect<\n void,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError\n >;\n readonly conversation: (\n run: Run,\n ) => ReturnType<Run[\"conversation\"]> extends Promise<infer A>\n ? Effect.Effect<\n A,\n | CursorAuthenticationError\n | CursorRateLimitError\n | CursorIntegrationNotConnectedError\n | CursorConfigurationError\n | CursorNetworkError\n | CursorUnsupportedOperationError\n | CursorUnknownError\n >\n : never;\n readonly streamEvents: (run: Run) => Stream.Stream<SDKMessage, CursorStreamError>;\n readonly collectText: (run: Run) => Effect.Effect<string, CursorStreamError>;\n readonly onDidChangeStatus: (\n run: Run,\n listener: (status: RunStatus) => void,\n ) => Effect.Effect<() => void>;\n}\n\n/**\n * Effect-native helpers for SDK run handles.\n *\n * @example\n * ```ts\n * const run = yield* agents.send(agent, \"Refactor auth\")\n * const text = yield* runs.collectText(run)\n * ```\n *\n * @see {@link CursorAgentService} for creating and sending runs.\n * @see {@link SDKMessage} for the SDK-owned stream event shape.\n *\n * @category services\n */\nexport class CursorRunService extends Context.Service<CursorRunService, CursorRunServiceShape>()(\n \"effect-cursor-sdk/cursor-run/CursorRunService\",\n) {\n static readonly Live = Layer.succeed(CursorRunService)(\n CursorRunService.of({\n supports: (run: Run, operation: RunOperation): boolean => {\n return run.supports(operation);\n },\n unsupportedReason: (run: Run, operation: RunOperation): string | undefined => {\n return run.unsupportedReason(operation);\n },\n wait: (run: Run) => {\n return instrument(\n \"run.wait\",\n Effect.tryPromise({\n try: () => run.wait(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.wait\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n cancel: (run: Run) => {\n return instrument(\n \"run.cancel\",\n Effect.tryPromise({\n try: () => run.cancel(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.cancel\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n conversation: (run: Run) => {\n return instrument(\n \"run.conversation\",\n Effect.tryPromise({\n try: () => run.conversation(),\n catch: (cause) => {\n return mapCursorError(cause, {\n operation: \"run.conversation\",\n agentId: run.agentId,\n runId: run.id,\n });\n },\n }),\n );\n },\n streamEvents: (run: Run): Stream.Stream<SDKMessage, CursorStreamError> => {\n return Stream.fromAsyncIterable(run.stream(), (cause) => {\n return mapCursorError(cause, {\n operation: \"run.stream\",\n agentId: run.agentId,\n runId: run.id,\n }) as CursorStreamError;\n });\n },\n onDidChangeStatus: (\n run: Run,\n listener: (status: RunStatus) => void,\n ): Effect.Effect<() => void> => {\n return Effect.sync(() => run.onDidChangeStatus(listener));\n },\n collectText: (run: Run): Effect.Effect<string, CursorStreamError> => {\n return Stream.fromAsyncIterable(run.stream(), (cause) => {\n return mapCursorError(cause, {\n operation: \"run.stream\",\n agentId: run.agentId,\n runId: run.id,\n }) as CursorStreamError;\n }).pipe(\n Stream.runFold(\n () => \"\",\n (text, event) => {\n if (event.type !== \"assistant\") return text;\n return (\n text +\n event.message.content\n .filter((block) => {\n return block.type === \"text\";\n })\n .map((block) => {\n return block.text;\n })\n .join(\"\")\n );\n },\n ),\n );\n },\n }),\n );\n}\n","import { Layer, ManagedRuntime } from \"effect\";\n\nimport { CursorAgentService } from \"./cursor-agent\";\nimport { CursorArtifactService } from \"./cursor-artifacts\";\nimport { CursorInspectionService } from \"./cursor-inspection\";\nimport { makeMockSdkFactoryLayer, type CursorMockFixtures } from \"./cursor-mock\";\nimport { CursorRunService } from \"./cursor-run\";\nimport { CursorSdkFactory } from \"./cursor-sdk-factory\";\n\n/**\n * Live service layer for the SDK-backed Effect wrapper.\n *\n * Provides {@link CursorAgentService}, {@link CursorRunService},\n * {@link CursorArtifactService}, and {@link CursorInspectionService} using\n * {@link CursorSdkFactory.Live}.\n *\n * @example\n * ```ts\n * const result = yield* program.pipe(Effect.provide(liveLayer))\n * ```\n *\n * @see {@link CursorSdkFactory}\n * @see {@link liveRuntime}\n *\n * @category layers\n */\nexport const liveLayer = Layer.mergeAll(\n CursorAgentService.Live,\n CursorRunService.Live,\n CursorArtifactService.Live,\n CursorInspectionService.Live,\n).pipe(Layer.provideMerge(CursorSdkFactory.Live));\n\n/**\n * Deterministic mock layer for tests and examples.\n *\n * @param fixtures - Static SDK responses returned by the mock factory.\n *\n * @example\n * ```ts\n * const layer = mockLayer({\n * result: { id: \"run-1\", status: \"finished\", result: \"ok\" }\n * })\n * ```\n *\n * @see {@link CursorMockFixtures}\n * @see {@link makeMockSdkFactoryLayer}\n *\n * @category layers\n */\nexport const mockLayer = (fixtures: CursorMockFixtures = {}) => {\n return Layer.mergeAll(\n CursorAgentService.Live,\n CursorRunService.Live,\n CursorArtifactService.Live,\n CursorInspectionService.Live,\n ).pipe(Layer.provideMerge(makeMockSdkFactoryLayer(fixtures)));\n};\n\n/**\n * Ready-made live runtime.\n *\n * Use this for small scripts that prefer `ManagedRuntime.runPromise` over\n * manually providing {@link liveLayer}.\n *\n * @example\n * ```ts\n * const value = await liveRuntime.runPromise(program)\n * ```\n *\n * @see {@link liveLayer}\n *\n * @category runtimes\n */\nexport const liveRuntime = ManagedRuntime.make(liveLayer);\n\n/**\n * Ready-made mock runtime.\n *\n * @param fixtures - Static SDK responses returned by the mock services.\n *\n * @example\n * ```ts\n * const runtime = makeMockRuntime({ result: { id: \"run-1\", status: \"finished\" } })\n * const value = await runtime.runPromise(program)\n * ```\n *\n * @see {@link mockLayer}\n * @see {@link CursorMockFixtures}\n *\n * @category runtimes\n */\nexport const makeMockRuntime = (fixtures: CursorMockFixtures = {}) => {\n return ManagedRuntime.make(mockLayer(fixtures));\n};\n","/**\n * Public package name.\n *\n * @category metadata\n */\nexport const packageName = \"effect-cursor-sdk\";\n\nexport * from \"./cursor-agent\";\nexport * from \"./cursor-artifacts\";\nexport * from \"./cursor-config\";\nexport * from \"./cursor-error\";\nexport * from \"./cursor-inspection\";\nexport * from \"./cursor-mock\";\nexport * from \"./cursor-run\";\nexport * from \"./cursor-runtime\";\nexport * from \"./cursor-sdk-factory\";\nexport * from \"./cursor-telemetry\";\nexport * from \"./cursor-types\";\n"],"mappings":";;;;;;;;;AAsEA,IAAa,4BAAb,cAA+C,KAAK,YAClD,4BACD,CAAoB;;;;;;;AAQrB,IAAa,uBAAb,cAA0C,KAAK,YAC7C,uBACD,CAAoB;;;;;;;;AASrB,IAAa,2BAAb,cAA8C,KAAK,YACjD,2BACD,CAAoB;;;;;;;AAQrB,IAAa,qCAAb,cAAwD,KAAK,YAC3D,qCACD,CAAgF;;;;;;;AAQjF,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAAoB;;;;;;;;AASlG,IAAa,kCAAb,cAAqD,KAAK,YACxD,kCACD,CAA+D;;;;;;;AAQhE,IAAa,uBAAb,cAA0C,KAAK,YAC7C,uBACD,CAAoB;;;;;;;;AASrB,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAAoB;;;;;;;AAQh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,SAAS,IAAI;KACb,OAAO,IAAI;KACZ,CAAC;KACF,CAAC,KACD,OAAO,cACC,KACL,MAAM,UAAU;AACf,QAAI,MAAM,SAAS,YAAa,QAAO;AACvC,WACE,OACA,MAAM,QAAQ,QACX,QAAQ,UAAU;AACjB,YAAO,MAAM,SAAS;MACtB,CACD,KAAK,UAAU;AACd,YAAO,MAAM;MACb,CACD,KAAK,GAAG;KAGhB,CACF;;EAEJ,CAAC,CACH;;;;;;;;;;;;;;;;;;;;;ACvJH,MAAa,YAAY,MAAM,SAC7B,mBAAmB,MACnB,iBAAiB,MACjB,sBAAsB,MACtB,wBAAwB,KACzB,CAAC,KAAK,MAAM,aAAa,iBAAiB,KAAK,CAAC;;;;;;;;;;;;;;;;;;AAmBjD,MAAa,aAAa,WAA+B,EAAE,KAAK;AAC9D,QAAO,MAAM,SACX,mBAAmB,MACnB,iBAAiB,MACjB,sBAAsB,MACtB,wBAAwB,KACzB,CAAC,KAAK,MAAM,aAAa,wBAAwB,SAAS,CAAC,CAAC;;;;;;;;;;;;;;;;;AAkB/D,MAAa,cAAc,eAAe,KAAK,UAAU;;;;;;;;;;;;;;;;;AAkBzD,MAAa,mBAAmB,WAA+B,EAAE,KAAK;AACpE,QAAO,eAAe,KAAK,UAAU,SAAS,CAAC;;;;;;;;;ACxFjD,MAAa,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-cursor-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Effect-based wrapper around the Cursor SDK",
5
5
  "keywords": [
6
6
  "cursor",
@@ -20,6 +20,7 @@
20
20
  "files": [
21
21
  "dist",
22
22
  "README.md",
23
+ "DEPRECATIONS.md",
23
24
  "LICENSE"
24
25
  ],
25
26
  "type": "module",
@@ -33,6 +34,9 @@
33
34
  "default": "./dist/index.js"
34
35
  }
35
36
  },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
36
40
  "scripts": {
37
41
  "build": "tsdown",
38
42
  "changeset": "changeset",
@@ -45,6 +49,9 @@
45
49
  "lint:fix": "oxlint --fix .",
46
50
  "format": "oxfmt .",
47
51
  "format:check": "oxfmt --check .",
52
+ "examples:typecheck": "bun run --cwd examples/quickstart typecheck && bun run --cwd examples/cli typecheck && bun run --cwd examples/basic-agent-workflow typecheck && bun run --cwd examples/advanced-ops-dashboard typecheck",
53
+ "examples:cli:mock": "bun run --cwd examples/cli dev -- --mock \"Summarize the mock response\"",
54
+ "examples:advanced:mock": "bun run --cwd examples/advanced-ops-dashboard dev -- --mock --triage",
48
55
  "lint:package": "publint",
49
56
  "test": "vitest run",
50
57
  "test:coverage": "vitest run --coverage",
@@ -52,11 +59,9 @@
52
59
  "version": "changeset version",
53
60
  "verify:publish": "bun run typecheck && bun run lint && bun run test && bun run build && bun run lint:package"
54
61
  },
55
- "publishConfig": {
56
- "access": "public"
57
- },
58
62
  "dependencies": {
59
- "@cursor/sdk": "^1.0.9"
63
+ "@cursor/sdk": "^1.0.10",
64
+ "effect-cursor-sdk": "."
60
65
  },
61
66
  "devDependencies": {
62
67
  "@changesets/changelog-github": "^0.6.0",
@@ -66,7 +71,7 @@
66
71
  "@types/bun": "latest",
67
72
  "@vitest/coverage-v8": "^4.1.5",
68
73
  "effect": "^4.0.0-beta.57",
69
- "oxfmt": "^0.46.0",
74
+ "oxfmt": "^0.47.0",
70
75
  "oxlint": "^1.61.0",
71
76
  "publint": "^0.3.12",
72
77
  "tsdown": "^0.21.10",