@raindrop-ai/cursor 0.0.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.
@@ -0,0 +1,613 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const signalSchema: z.ZodObject<{
4
+ description: z.ZodString;
5
+ sentiment: z.ZodOptional<z.ZodEnum<{
6
+ POSITIVE: "POSITIVE";
7
+ NEGATIVE: "NEGATIVE";
8
+ }>>;
9
+ }, z.core.$strip>;
10
+ declare const diagnosticsSchema: z.ZodObject<{
11
+ signals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
12
+ description: z.ZodString;
13
+ sentiment: z.ZodOptional<z.ZodEnum<{
14
+ POSITIVE: "POSITIVE";
15
+ NEGATIVE: "NEGATIVE";
16
+ }>>;
17
+ }, z.core.$strip>>>;
18
+ guidance: z.ZodOptional<z.ZodString>;
19
+ toolName: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ declare const configFileSchema: z.ZodObject<{
22
+ write_key: z.ZodCatch<z.ZodOptional<z.ZodString>>;
23
+ api_url: z.ZodCatch<z.ZodOptional<z.ZodString>>;
24
+ project_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
25
+ user_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
26
+ debug: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
27
+ enabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
28
+ event_name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
29
+ custom_properties: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
30
+ self_diagnostics: z.ZodCatch<z.ZodOptional<z.ZodObject<{
31
+ signals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
32
+ description: z.ZodString;
33
+ sentiment: z.ZodOptional<z.ZodEnum<{
34
+ POSITIVE: "POSITIVE";
35
+ NEGATIVE: "NEGATIVE";
36
+ }>>;
37
+ }, z.core.$strip>>>;
38
+ guidance: z.ZodOptional<z.ZodString>;
39
+ toolName: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>>>;
41
+ }, z.core.$strip>;
42
+ declare const mapperConfigSchema: z.ZodObject<{
43
+ userId: z.ZodString;
44
+ convoId: z.ZodOptional<z.ZodString>;
45
+ debug: z.ZodBoolean;
46
+ eventName: z.ZodString;
47
+ customProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
48
+ }, z.core.$strip>;
49
+ declare const configSchema: z.ZodObject<{
50
+ userId: z.ZodString;
51
+ convoId: z.ZodOptional<z.ZodString>;
52
+ debug: z.ZodBoolean;
53
+ eventName: z.ZodString;
54
+ customProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
55
+ writeKey: z.ZodString;
56
+ endpoint: z.ZodString;
57
+ projectId: z.ZodOptional<z.ZodString>;
58
+ enabled: z.ZodBoolean;
59
+ selfDiagnostics: z.ZodOptional<z.ZodObject<{
60
+ signals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
61
+ description: z.ZodString;
62
+ sentiment: z.ZodOptional<z.ZodEnum<{
63
+ POSITIVE: "POSITIVE";
64
+ NEGATIVE: "NEGATIVE";
65
+ }>>;
66
+ }, z.core.$strip>>>;
67
+ guidance: z.ZodOptional<z.ZodString>;
68
+ toolName: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>;
71
+ type SelfDiagnosticsSignalDef = z.infer<typeof signalSchema>;
72
+ type SelfDiagnosticsConfig = z.infer<typeof diagnosticsSchema>;
73
+ type RaindropConfig = z.infer<typeof configSchema>;
74
+ declare function getConfigPath(): string;
75
+ declare function loadConfig(): RaindropConfig;
76
+ declare function updateConfig(patch: Partial<z.infer<typeof configFileSchema>>): void;
77
+
78
+ type OtlpAnyValue = {
79
+ stringValue?: string;
80
+ intValue?: string;
81
+ doubleValue?: number;
82
+ boolValue?: boolean;
83
+ arrayValue?: {
84
+ values: OtlpAnyValue[];
85
+ };
86
+ };
87
+ type OtlpKeyValue = {
88
+ key: string;
89
+ value: OtlpAnyValue;
90
+ };
91
+ declare const SpanStatusCode: {
92
+ readonly UNSET: 0;
93
+ readonly OK: 1;
94
+ readonly ERROR: 2;
95
+ };
96
+ type OtlpSpanStatus = {
97
+ code: (typeof SpanStatusCode)[keyof typeof SpanStatusCode] | number;
98
+ message?: string;
99
+ };
100
+ type OtlpSpan = {
101
+ traceId: string;
102
+ spanId: string;
103
+ parentSpanId?: string;
104
+ name: string;
105
+ startTimeUnixNano: string;
106
+ endTimeUnixNano: string;
107
+ attributes?: OtlpKeyValue[];
108
+ status?: OtlpSpanStatus;
109
+ };
110
+ type SpanIds = {
111
+ traceIdB64: string;
112
+ spanIdB64: string;
113
+ parentSpanIdB64?: string;
114
+ };
115
+ type Attachment = {
116
+ type: string;
117
+ role: string;
118
+ name?: string;
119
+ value: string;
120
+ };
121
+ type IdentifyInput = {
122
+ userId: string;
123
+ traits?: Record<string, unknown>;
124
+ };
125
+ type EventUsage = {
126
+ promptTokens?: number;
127
+ completionTokens?: number;
128
+ };
129
+ type Patch = {
130
+ eventName?: string;
131
+ userId?: string;
132
+ convoId?: string;
133
+ input?: string;
134
+ output?: string;
135
+ model?: string;
136
+ usage?: EventUsage;
137
+ error?: unknown;
138
+ properties?: Record<string, unknown>;
139
+ featureFlags?: Record<string, string>;
140
+ attachments?: Attachment[];
141
+ isPending?: boolean;
142
+ timestamp?: string;
143
+ };
144
+ type SignalInput = {
145
+ eventId: string;
146
+ name: string;
147
+ type?: "default" | "feedback" | "edit" | "standard" | "agent" | "agent_internal";
148
+ sentiment?: "POSITIVE" | "NEGATIVE";
149
+ timestamp?: string;
150
+ properties?: Record<string, unknown>;
151
+ attachmentId?: string;
152
+ comment?: string;
153
+ after?: string;
154
+ };
155
+ type EventShipperOptions = {
156
+ writeKey?: string;
157
+ endpoint?: string;
158
+ enabled?: boolean;
159
+ debug: boolean;
160
+ partialFlushMs?: number;
161
+ sdkName?: string;
162
+ libraryName?: string;
163
+ libraryVersion?: string;
164
+ defaultEventName?: string;
165
+ /**
166
+ * Explicit Workshop / local debugger URL. Wins over env vars + auto-detect.
167
+ * Pass `null` to opt out of all mirroring (including auto-detect).
168
+ */
169
+ localDebuggerUrl?: string | null;
170
+ /**
171
+ * Optional project slug. When set, every outbound cloud request includes an
172
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
173
+ * values are ignored. Slug format is validated on construction but never
174
+ * throws — the backend returns 400 on invalid values.
175
+ */
176
+ projectId?: string;
177
+ /**
178
+ * Per-field character cap applied to event input/output BEFORE buffering
179
+ * or serialization, so oversized payloads cost the cap — not the payload —
180
+ * on the calling code path. Truncated fields end with
181
+ * `...[truncated by raindrop]` and never exceed the cap, marker included.
182
+ * Defaults to 1,000,000 (matching the Python SDK).
183
+ */
184
+ maxTextFieldChars?: number;
185
+ };
186
+ declare class EventShipper$1 {
187
+ private baseUrl;
188
+ private writeKey?;
189
+ private enabled;
190
+ private debug;
191
+ private partialFlushMs;
192
+ private sdkName;
193
+ private prefix;
194
+ private defaultEventName;
195
+ private projectId;
196
+ private context;
197
+ private buffers;
198
+ private sticky;
199
+ private timers;
200
+ private inFlight;
201
+ private maxTextFieldCharsOpt;
202
+ /**
203
+ * Epoch ms deadline while `shutdown()` is draining; undefined otherwise.
204
+ * Checked before every POST issued during the final flush.
205
+ */
206
+ private shutdownDeadlineAt;
207
+ /**
208
+ * Set once `shutdown()` begins and never cleared. Sends issued after the
209
+ * drain window (stragglers, or flush work the deadline abandoned
210
+ * mid-drain) run as a single short attempt instead of regaining the full
211
+ * retry schedule.
212
+ */
213
+ private hasShutdown;
214
+ /** URL of the local debugger / Workshop daemon, when one is reachable. */
215
+ private localDebuggerUrl;
216
+ constructor(opts: EventShipperOptions);
217
+ isDebugEnabled(): boolean;
218
+ private authHeaders;
219
+ private requestHeaders;
220
+ /**
221
+ * Build the retry/timeout options for one POST, honoring the shutdown
222
+ * deadline. Returns `null` when the shutdown drain window is exhausted —
223
+ * the caller must drop the payload (with a rate-limited warning) instead
224
+ * of issuing a request that could outlive process exit.
225
+ *
226
+ * Checked fresh on EVERY send, so a shutdown that begins while the flush
227
+ * path is mid-drain takes effect immediately: no further retries, and the
228
+ * per-attempt timeout is clamped to the remaining window. After
229
+ * `shutdown()` returns (deadline cleared, `hasShutdown` still set),
230
+ * sends — late callers, or flush work the deadline abandoned mid-drain —
231
+ * run as a single short attempt rather than regaining the full retry
232
+ * schedule.
233
+ */
234
+ private requestOpts;
235
+ patch(eventId: string, patch: Patch): Promise<void>;
236
+ finish(eventId: string, patch: Pick<Patch, "output" | "model" | "usage" | "error" | "properties" | "featureFlags" | "userId">): Promise<void>;
237
+ flush(): Promise<void>;
238
+ shutdown(): Promise<void>;
239
+ trackSignal(signal: SignalInput): Promise<void>;
240
+ identify(users: IdentifyInput | IdentifyInput[]): Promise<void>;
241
+ private warnShutdownDrop;
242
+ private flushOne;
243
+ }
244
+ /**
245
+ * Hook fired per OTLP span right before the span is shipped (to the Raindrop
246
+ * API and to a local debugger). Lets callers inspect, rewrite, or drop the
247
+ * entire span — not just individual attributes — which is more flexible than
248
+ * an attribute-level hook (you can rename attributes, add new ones, drop the
249
+ * span outright, etc.).
250
+ *
251
+ * Return values:
252
+ * - `undefined` or the same span: ship the span unchanged.
253
+ * - a new `OtlpSpan`: ship the returned span in place of the original.
254
+ * - `null`: drop the span entirely from every ship path.
255
+ *
256
+ * The hook runs on the hot path — keep it synchronous and side-effect-free.
257
+ * If the hook throws, the span is dropped (fail-closed) so a buggy hook can
258
+ * never accidentally ship raw, un-redacted spans.
259
+ */
260
+ type TransformSpanHook = (span: OtlpSpan) => OtlpSpan | null | undefined;
261
+
262
+ type InternalSpan = {
263
+ ids: SpanIds;
264
+ name: string;
265
+ startTimeUnixNano: string;
266
+ endTimeUnixNano?: string;
267
+ attributes: Array<OtlpKeyValue | undefined>;
268
+ };
269
+ type TraceShipperOptions = {
270
+ writeKey?: string;
271
+ endpoint?: string;
272
+ enabled?: boolean;
273
+ debug: boolean;
274
+ debugSpans?: boolean;
275
+ flushIntervalMs?: number;
276
+ maxBatchSize?: number;
277
+ maxQueueSize?: number;
278
+ sdkName?: string;
279
+ serviceName?: string;
280
+ serviceVersion?: string;
281
+ /**
282
+ * Explicit Workshop / local debugger URL. Wins over env vars + auto-detect.
283
+ * Pass `null` to opt out of all mirroring (including auto-detect).
284
+ */
285
+ localDebuggerUrl?: string | null;
286
+ /**
287
+ * Optional project slug. When set, every OTLP trace export includes an
288
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
289
+ * values are ignored. Slug format is validated on construction but never
290
+ * throws — the backend returns 400 on invalid values.
291
+ */
292
+ projectId?: string;
293
+ /**
294
+ * Per-span hook that fires for every OTLP span right before the span is
295
+ * shipped (both to the Raindrop API and to a local debugger). Lets callers
296
+ * inspect, rewrite, or drop entire spans — rename attributes, add new ones,
297
+ * scrub additional secret-shaped values inside `ai.prompt.messages` /
298
+ * `ai.toolCall.args`, etc.
299
+ *
300
+ * Return values:
301
+ * - `undefined` or the same span reference: ship the span unchanged.
302
+ * - a new `OtlpSpan`: ship the returned span in place of the original.
303
+ * - `null`: drop the span entirely from every ship path.
304
+ *
305
+ * The hook runs BEFORE the default redactor (which is the always-on floor
306
+ * for documented BYOK secrets). The default redactor still runs on the
307
+ * post-transform span unless `disableDefaultRedaction` is set, so even if
308
+ * a custom transform overlooks a secret-shaped attribute, the floor catches
309
+ * it.
310
+ *
311
+ * The hook runs on the hot path — keep it synchronous and side-effect-free.
312
+ * If the hook itself throws, the span is dropped (fail-closed) so a buggy
313
+ * hook can never accidentally ship raw, un-redacted spans.
314
+ */
315
+ transformSpan?: TransformSpanHook;
316
+ /**
317
+ * Disable the built-in default span transformer (which scrubs documented
318
+ * secret-shaped properties — `apiKey`, `secretAccessKey`, `privateKey`,
319
+ * etc. — inside `ai.request.providerOptions` and
320
+ * `ai.response.providerMetadata`).
321
+ *
322
+ * Default: `false` (i.e. default redaction is on). Setting this to `true`
323
+ * disables the floor entirely; provide a custom `transformSpan` if you
324
+ * still want some redaction in that case.
325
+ */
326
+ disableDefaultRedaction?: boolean;
327
+ /**
328
+ * Per-attribute character cap applied to every span attribute string value
329
+ * right before the span enters a ship path, so a multi-MB prompt/tool
330
+ * payload can never make the batch `JSON.stringify` (which runs on the
331
+ * event loop) cost seconds. Truncated values end with
332
+ * `...[truncated by raindrop]` and never exceed the cap, marker included.
333
+ * Defaults to 1,000,000 (matching the Python SDK).
334
+ */
335
+ maxTextFieldChars?: number;
336
+ };
337
+ declare class TraceShipper$1 {
338
+ private baseUrl;
339
+ private writeKey?;
340
+ private enabled;
341
+ private debug;
342
+ private debugSpans;
343
+ private sdkName;
344
+ private prefix;
345
+ private serviceName;
346
+ private serviceVersion;
347
+ private flushIntervalMs;
348
+ private maxBatchSize;
349
+ private maxQueueSize;
350
+ private projectId;
351
+ private queue;
352
+ private timer;
353
+ private inFlight;
354
+ /** URL of the local debugger / Workshop daemon, when one is reachable. */
355
+ private localDebuggerUrl;
356
+ private transformSpanHook;
357
+ private disableDefaultRedaction;
358
+ private maxTextFieldCharsOpt;
359
+ /**
360
+ * Epoch ms deadline while `shutdown()` is draining; undefined otherwise.
361
+ * Checked before every batch POST issued during the final flush.
362
+ */
363
+ private shutdownDeadlineAt;
364
+ /**
365
+ * Set once `shutdown()` begins and never cleared. Sends issued after the
366
+ * drain window (stragglers, or flush work the deadline abandoned
367
+ * mid-drain) run as a single short attempt instead of regaining the full
368
+ * retry schedule.
369
+ */
370
+ private hasShutdown;
371
+ constructor(opts: TraceShipperOptions);
372
+ /**
373
+ * Cap every string attribute value on the span. O(#attributes) length
374
+ * checks; only oversized values pay a slice. Runs AFTER the redaction
375
+ * pipeline so the default secret-scrub still sees parseable JSON in
376
+ * `ai.request.providerOptions` / `ai.response.providerMetadata` (capping
377
+ * first could cut a JSON blob mid-way, fail the parse, and ship secrets
378
+ * in the surviving prefix).
379
+ *
380
+ * A stricter `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` env var is honored
381
+ * for span content, matching the Python SDK and the OTel SDK convention.
382
+ */
383
+ private capSpanAttributes;
384
+ /**
385
+ * Apply the user `transformSpan` hook (if any) followed by the default
386
+ * redactor (unless disabled). Returns either the (possibly new) span to
387
+ * ship, or `null` to drop the span entirely.
388
+ *
389
+ * Ordering: user hook runs first so callers can rewrite the span freely
390
+ * (rename attrs, add new ones, scrub things the default doesn't know
391
+ * about). The default redactor then runs on whatever the user produced,
392
+ * acting as the always-on floor for documented BYOK secrets. If the user
393
+ * sets `disableDefaultRedaction: true`, the floor is skipped.
394
+ *
395
+ * Fail-closed: if the user hook throws, the span is dropped — a buggy
396
+ * hook can never accidentally ship raw, un-redacted spans.
397
+ */
398
+ private redactSpan;
399
+ isDebugEnabled(): boolean;
400
+ private authHeaders;
401
+ private requestHeaders;
402
+ startSpan(args: {
403
+ name: string;
404
+ parent?: {
405
+ traceIdB64: string;
406
+ spanIdB64: string;
407
+ };
408
+ eventId: string;
409
+ userId?: string;
410
+ convoId?: string;
411
+ eventName?: string;
412
+ operationId?: string;
413
+ attributes?: Array<OtlpKeyValue | undefined>;
414
+ startTimeUnixNano?: string;
415
+ }): InternalSpan;
416
+ private mirrorToLocalDebugger;
417
+ endSpan(span: InternalSpan, extra?: {
418
+ attributes?: InternalSpan["attributes"];
419
+ error?: unknown;
420
+ status?: OtlpSpanStatus;
421
+ endTimeUnixNano?: string;
422
+ }): void;
423
+ createSpan(args: {
424
+ name: string;
425
+ parent?: {
426
+ traceIdB64: string;
427
+ spanIdB64: string;
428
+ };
429
+ eventId: string;
430
+ userId?: string;
431
+ convoId?: string;
432
+ eventName?: string;
433
+ startTimeUnixNano: string;
434
+ endTimeUnixNano: string;
435
+ attributes?: Array<OtlpKeyValue | undefined>;
436
+ status?: OtlpSpanStatus;
437
+ }): void;
438
+ enqueue(span: OtlpSpan): void;
439
+ flush(): Promise<void>;
440
+ /** See EventShipper.requestOpts — same shutdown-budget semantics. */
441
+ private requestOpts;
442
+ shutdown(): Promise<void>;
443
+ }
444
+
445
+ /**
446
+ * Run telemetry egress with OpenTelemetry tracing suppressed.
447
+ *
448
+ * Why this exists
449
+ * ---------------
450
+ * Raindrop integrations ship spans/events over HTTP with the global `fetch`
451
+ * (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
452
+ * fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
453
+ * every Eve agent installs — that instrumentation wraps *our own* telemetry
454
+ * POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
455
+ * very exporter that issued the request, so they get shipped right back to
456
+ * Raindrop and Workshop as standalone "runs" (and, because each export issues
457
+ * another fetch, they feed back on themselves). The result is a run list
458
+ * flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
459
+ * `.../live` entries that drown out the real agent turns — especially with
460
+ * sub-agents, where every sandbox runs its own instrumentation.
461
+ *
462
+ * The OTel-blessed fix is to mark the active context as "tracing suppressed"
463
+ * around the request; instrumentations check `isTracingSuppressed` and return
464
+ * a no-op span instead of recording one. We do this through a hook stashed on
465
+ * `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
466
+ * - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
467
+ * hard-depends on them, and the hook is simply absent when they (and thus
468
+ * any instrumentation to suppress) are not installed; and
469
+ * - the browser bundle never pulls in `node:module`, mirroring how core
470
+ * injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
471
+ *
472
+ * When no hook is present the callback runs unchanged, so suppression is a
473
+ * best-effort no-op rather than a hard requirement.
474
+ */
475
+ /** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
476
+ type SuppressTracingHook = <T>(fn: () => T) => T;
477
+ declare global {
478
+ var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
479
+ }
480
+
481
+ type ParentSpanContext = {
482
+ traceIdB64: string;
483
+ spanIdB64: string;
484
+ eventId: string;
485
+ };
486
+ interface ContextSpan {
487
+ readonly traceIdB64: string;
488
+ readonly spanIdB64: string;
489
+ readonly eventId: string;
490
+ log?(data: Record<string, unknown>): void;
491
+ }
492
+ interface AsyncLocalStorageLike<T> {
493
+ getStore(): T | undefined;
494
+ run<R>(store: T, callback: () => R): R;
495
+ enterWith?(store: T): void;
496
+ }
497
+ declare abstract class ContextManager {
498
+ abstract getParentSpanIds(): ParentSpanContext | undefined;
499
+ abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
500
+ abstract getCurrentSpan(): ContextSpan | undefined;
501
+ abstract isReady(): boolean;
502
+ }
503
+ declare global {
504
+ var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
505
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
506
+ }
507
+
508
+ declare class EventShipper extends EventShipper$1 {
509
+ constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
510
+ }
511
+ declare class TraceShipper extends TraceShipper$1 {
512
+ constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
513
+ enqueue(span: OtlpSpan): void;
514
+ }
515
+
516
+ declare const hookPayloadSchema: z.ZodObject<{
517
+ hook_event_name: z.ZodEnum<{
518
+ sessionStart: "sessionStart";
519
+ beforeSubmitPrompt: "beforeSubmitPrompt";
520
+ postToolUse: "postToolUse";
521
+ postToolUseFailure: "postToolUseFailure";
522
+ afterAgentResponse: "afterAgentResponse";
523
+ afterAgentThought: "afterAgentThought";
524
+ stop: "stop";
525
+ preCompact: "preCompact";
526
+ sessionEnd: "sessionEnd";
527
+ }>;
528
+ conversation_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
529
+ session_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
530
+ generation_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
531
+ model: z.ZodCatch<z.ZodOptional<z.ZodString>>;
532
+ model_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
533
+ model_params: z.ZodOptional<z.ZodUnknown>;
534
+ cursor_version: z.ZodCatch<z.ZodOptional<z.ZodString>>;
535
+ workspace_roots: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString>>>;
536
+ user_email: z.ZodCatch<z.ZodOptional<z.ZodString>>;
537
+ is_background_agent: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
538
+ composer_mode: z.ZodCatch<z.ZodOptional<z.ZodString>>;
539
+ prompt: z.ZodCatch<z.ZodOptional<z.ZodString>>;
540
+ attachments: z.ZodOptional<z.ZodUnknown>;
541
+ tool_name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
542
+ tool_input: z.ZodOptional<z.ZodUnknown>;
543
+ tool_output: z.ZodOptional<z.ZodUnknown>;
544
+ tool_use_id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
545
+ cwd: z.ZodCatch<z.ZodOptional<z.ZodString>>;
546
+ agent_message: z.ZodCatch<z.ZodOptional<z.ZodString>>;
547
+ duration: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
548
+ error_message: z.ZodCatch<z.ZodOptional<z.ZodString>>;
549
+ failure_type: z.ZodCatch<z.ZodOptional<z.ZodString>>;
550
+ is_interrupt: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
551
+ status: z.ZodCatch<z.ZodOptional<z.ZodString>>;
552
+ duration_ms: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
553
+ message_count: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
554
+ text: z.ZodCatch<z.ZodOptional<z.ZodString>>;
555
+ input_tokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
556
+ output_tokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
557
+ cache_read_tokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
558
+ cache_write_tokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
559
+ loop_count: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
560
+ trigger: z.ZodCatch<z.ZodOptional<z.ZodString>>;
561
+ context_usage_percent: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
562
+ context_tokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
563
+ context_window_size: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
564
+ is_first_compaction: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
565
+ reason: z.ZodCatch<z.ZodOptional<z.ZodString>>;
566
+ final_status: z.ZodCatch<z.ZodOptional<z.ZodString>>;
567
+ }, z.core.$strip>;
568
+ type HookPayload = z.infer<typeof hookPayloadSchema>;
569
+ type MapperConfig = z.infer<typeof mapperConfigSchema>;
570
+ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
571
+
572
+ declare const HOOK_EVENTS: readonly ["sessionStart", "beforeSubmitPrompt", "postToolUse", "postToolUseFailure", "afterAgentResponse", "afterAgentThought", "stop", "preCompact", "sessionEnd"];
573
+ declare const scopeSchema: z.ZodEnum<{
574
+ user: "user";
575
+ project: "project";
576
+ }>;
577
+ type SetupScope = z.infer<typeof scopeSchema>;
578
+ declare const setupSchema: z.ZodObject<{
579
+ scope: z.ZodOptional<z.ZodEnum<{
580
+ user: "user";
581
+ project: "project";
582
+ }>>;
583
+ writeKey: z.ZodOptional<z.ZodString>;
584
+ userId: z.ZodOptional<z.ZodString>;
585
+ projectId: z.ZodOptional<z.ZodString>;
586
+ localOnly: z.ZodOptional<z.ZodBoolean>;
587
+ }, z.core.$strip>;
588
+ declare function getCursorHooksPath(scope: SetupScope, cwd?: string): string;
589
+ declare function runSetup(args?: z.infer<typeof setupSchema>): Promise<void>;
590
+ declare function runUninstall(scope?: SetupScope): void;
591
+
592
+ declare const PACKAGE_NAME = "@raindrop-ai/cursor";
593
+ declare const PACKAGE_VERSION: string;
594
+
595
+ declare const _debuggerResultSchema: z.ZodObject<{
596
+ url: z.ZodNullable<z.ZodString>;
597
+ autoDetected: z.ZodBoolean;
598
+ }, z.core.$strip>;
599
+ type LocalDebuggerResult = z.infer<typeof _debuggerResultSchema>;
600
+ /**
601
+ * Detect whether the local debugger is available.
602
+ *
603
+ * Resolution order:
604
+ * 1. RAINDROP_LOCAL_DEBUGGER env var. use directly (no health check, trust the user)
605
+ * 2. Skip cache and localhost probe when CI is set or skipAutoDetect is true
606
+ * 3. Cached probe result (within TTL)
607
+ * 4. Probe http://localhost:5899/health with a short timeout
608
+ */
609
+ declare function detectLocalDebugger(debug: boolean, skipAutoDetect?: boolean): Promise<LocalDebuggerResult>;
610
+
611
+ declare function startMcpServer(): Promise<void>;
612
+
613
+ export { EventShipper, HOOK_EVENTS, type HookPayload, type LocalDebuggerResult, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SelfDiagnosticsConfig, type SelfDiagnosticsSignalDef, type SetupScope, TraceShipper, detectLocalDebugger, getConfigPath, getCursorHooksPath, hookPayloadSchema, loadConfig, mapHookToRaindrop, runSetup, runUninstall, startMcpServer, updateConfig };