@raindrop-ai/claude-code 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,273 @@
1
+ type OtlpAnyValue = {
2
+ stringValue?: string;
3
+ intValue?: string;
4
+ doubleValue?: number;
5
+ boolValue?: boolean;
6
+ arrayValue?: {
7
+ values: OtlpAnyValue[];
8
+ };
9
+ };
10
+ type OtlpKeyValue = {
11
+ key: string;
12
+ value: OtlpAnyValue;
13
+ };
14
+ declare const SpanStatusCode: {
15
+ readonly UNSET: 0;
16
+ readonly OK: 1;
17
+ readonly ERROR: 2;
18
+ };
19
+ type OtlpSpanStatus = {
20
+ code: (typeof SpanStatusCode)[keyof typeof SpanStatusCode] | number;
21
+ message?: string;
22
+ };
23
+ type OtlpSpan = {
24
+ traceId: string;
25
+ spanId: string;
26
+ parentSpanId?: string;
27
+ name: string;
28
+ startTimeUnixNano: string;
29
+ endTimeUnixNano: string;
30
+ attributes?: OtlpKeyValue[];
31
+ status?: OtlpSpanStatus;
32
+ };
33
+ type SpanIds = {
34
+ traceIdB64: string;
35
+ spanIdB64: string;
36
+ parentSpanIdB64?: string;
37
+ };
38
+
39
+ type Attachment = {
40
+ type: string;
41
+ role: string;
42
+ name?: string;
43
+ value: string;
44
+ };
45
+ type IdentifyInput = {
46
+ userId: string;
47
+ traits?: Record<string, unknown>;
48
+ };
49
+ type Patch = {
50
+ eventName?: string;
51
+ userId?: string;
52
+ convoId?: string;
53
+ input?: string;
54
+ output?: string;
55
+ model?: string;
56
+ properties?: Record<string, unknown>;
57
+ attachments?: Attachment[];
58
+ isPending?: boolean;
59
+ timestamp?: string;
60
+ };
61
+ type SignalInput = {
62
+ eventId: string;
63
+ name: string;
64
+ type?: "default" | "feedback" | "edit" | "standard" | "agent" | "agent_internal";
65
+ sentiment?: "POSITIVE" | "NEGATIVE";
66
+ timestamp?: string;
67
+ properties?: Record<string, unknown>;
68
+ attachmentId?: string;
69
+ comment?: string;
70
+ after?: string;
71
+ };
72
+ type EventShipperOptions = {
73
+ writeKey?: string;
74
+ endpoint?: string;
75
+ enabled?: boolean;
76
+ debug: boolean;
77
+ partialFlushMs?: number;
78
+ sdkName?: string;
79
+ libraryName?: string;
80
+ libraryVersion?: string;
81
+ defaultEventName?: string;
82
+ };
83
+ declare class EventShipper$1 {
84
+ private baseUrl;
85
+ private writeKey?;
86
+ private enabled;
87
+ private debug;
88
+ private partialFlushMs;
89
+ private sdkName;
90
+ private prefix;
91
+ private defaultEventName;
92
+ private context;
93
+ private buffers;
94
+ private sticky;
95
+ private timers;
96
+ private inFlight;
97
+ constructor(opts: EventShipperOptions);
98
+ isDebugEnabled(): boolean;
99
+ private authHeaders;
100
+ patch(eventId: string, patch: Patch): Promise<void>;
101
+ finish(eventId: string, patch: {
102
+ output?: string;
103
+ model?: string;
104
+ properties?: Record<string, unknown>;
105
+ userId?: string;
106
+ }): Promise<void>;
107
+ flush(): Promise<void>;
108
+ shutdown(): Promise<void>;
109
+ trackSignal(signal: SignalInput): Promise<void>;
110
+ identify(users: IdentifyInput | IdentifyInput[]): Promise<void>;
111
+ private flushOne;
112
+ }
113
+
114
+ type InternalSpan = {
115
+ ids: SpanIds;
116
+ name: string;
117
+ startTimeUnixNano: string;
118
+ endTimeUnixNano?: string;
119
+ attributes: Array<OtlpKeyValue | undefined>;
120
+ };
121
+ type TraceShipperOptions = {
122
+ writeKey?: string;
123
+ endpoint?: string;
124
+ enabled?: boolean;
125
+ debug: boolean;
126
+ debugSpans?: boolean;
127
+ flushIntervalMs?: number;
128
+ maxBatchSize?: number;
129
+ maxQueueSize?: number;
130
+ sdkName?: string;
131
+ serviceName?: string;
132
+ serviceVersion?: string;
133
+ };
134
+ declare class TraceShipper$1 {
135
+ private baseUrl;
136
+ private writeKey?;
137
+ private enabled;
138
+ private debug;
139
+ private debugSpans;
140
+ private sdkName;
141
+ private prefix;
142
+ private serviceName;
143
+ private serviceVersion;
144
+ private flushIntervalMs;
145
+ private maxBatchSize;
146
+ private maxQueueSize;
147
+ private queue;
148
+ private timer;
149
+ private inFlight;
150
+ constructor(opts: TraceShipperOptions);
151
+ isDebugEnabled(): boolean;
152
+ private authHeaders;
153
+ startSpan(args: {
154
+ name: string;
155
+ parent?: {
156
+ traceIdB64: string;
157
+ spanIdB64: string;
158
+ };
159
+ eventId: string;
160
+ operationId?: string;
161
+ attributes?: Array<OtlpKeyValue | undefined>;
162
+ startTimeUnixNano?: string;
163
+ }): InternalSpan;
164
+ endSpan(span: InternalSpan, extra?: {
165
+ attributes?: InternalSpan["attributes"];
166
+ error?: unknown;
167
+ status?: OtlpSpanStatus;
168
+ endTimeUnixNano?: string;
169
+ }): void;
170
+ createSpan(args: {
171
+ name: string;
172
+ parent?: {
173
+ traceIdB64: string;
174
+ spanIdB64: string;
175
+ };
176
+ eventId: string;
177
+ startTimeUnixNano: string;
178
+ endTimeUnixNano: string;
179
+ attributes?: Array<OtlpKeyValue | undefined>;
180
+ status?: OtlpSpanStatus;
181
+ }): void;
182
+ enqueue(span: OtlpSpan): void;
183
+ flush(): Promise<void>;
184
+ shutdown(): Promise<void>;
185
+ }
186
+
187
+ type ParentSpanContext = {
188
+ traceIdB64: string;
189
+ spanIdB64: string;
190
+ eventId: string;
191
+ };
192
+ interface ContextSpan {
193
+ readonly traceIdB64: string;
194
+ readonly spanIdB64: string;
195
+ readonly eventId: string;
196
+ log?(data: Record<string, unknown>): void;
197
+ }
198
+ interface AsyncLocalStorageLike<T> {
199
+ getStore(): T | undefined;
200
+ run<R>(store: T, callback: () => R): R;
201
+ enterWith?(store: T): void;
202
+ }
203
+ declare abstract class ContextManager {
204
+ abstract getParentSpanIds(): ParentSpanContext | undefined;
205
+ abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
206
+ abstract getCurrentSpan(): ContextSpan | undefined;
207
+ abstract isReady(): boolean;
208
+ }
209
+ declare global {
210
+ var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
211
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
212
+ }
213
+
214
+ declare class EventShipper extends EventShipper$1 {
215
+ constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
216
+ }
217
+ declare class TraceShipper extends TraceShipper$1 {
218
+ constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
219
+ enqueue(span: OtlpSpan): void;
220
+ }
221
+
222
+ interface RaindropConfig {
223
+ writeKey: string;
224
+ endpoint: string;
225
+ userId: string;
226
+ debug: boolean;
227
+ }
228
+ /**
229
+ * Load config with precedence (low -> high):
230
+ * 1. Defaults
231
+ * 2. ~/.config/raindrop/config.json
232
+ * 3. Environment variables
233
+ */
234
+ declare function loadConfig(): RaindropConfig;
235
+ declare function getConfigPath(): string;
236
+
237
+ type SetupScope = "user" | "project";
238
+
239
+ interface HookPayload {
240
+ session_id: string;
241
+ hook_event_name: string;
242
+ cwd: string;
243
+ permission_mode: string;
244
+ transcript_path?: string;
245
+ source?: string;
246
+ model?: string;
247
+ prompt?: string;
248
+ tool_name?: string;
249
+ tool_input?: Record<string, unknown>;
250
+ tool_response?: unknown;
251
+ tool_use_id?: string;
252
+ error?: string;
253
+ is_interrupt?: boolean;
254
+ stop_hook_active?: boolean;
255
+ last_assistant_message?: string;
256
+ error_details?: string;
257
+ reason?: string;
258
+ agent_id?: string;
259
+ agent_type?: string;
260
+ agent_transcript_path?: string;
261
+ trigger?: string;
262
+ compact_summary?: string;
263
+ }
264
+ interface MapperConfig {
265
+ userId: string;
266
+ debug: boolean;
267
+ }
268
+ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
269
+
270
+ declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
271
+ declare const PACKAGE_VERSION = "0.0.1";
272
+
273
+ export { EventShipper, type HookPayload, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SetupScope, TraceShipper, getConfigPath, loadConfig, mapHookToRaindrop };
@@ -0,0 +1,273 @@
1
+ type OtlpAnyValue = {
2
+ stringValue?: string;
3
+ intValue?: string;
4
+ doubleValue?: number;
5
+ boolValue?: boolean;
6
+ arrayValue?: {
7
+ values: OtlpAnyValue[];
8
+ };
9
+ };
10
+ type OtlpKeyValue = {
11
+ key: string;
12
+ value: OtlpAnyValue;
13
+ };
14
+ declare const SpanStatusCode: {
15
+ readonly UNSET: 0;
16
+ readonly OK: 1;
17
+ readonly ERROR: 2;
18
+ };
19
+ type OtlpSpanStatus = {
20
+ code: (typeof SpanStatusCode)[keyof typeof SpanStatusCode] | number;
21
+ message?: string;
22
+ };
23
+ type OtlpSpan = {
24
+ traceId: string;
25
+ spanId: string;
26
+ parentSpanId?: string;
27
+ name: string;
28
+ startTimeUnixNano: string;
29
+ endTimeUnixNano: string;
30
+ attributes?: OtlpKeyValue[];
31
+ status?: OtlpSpanStatus;
32
+ };
33
+ type SpanIds = {
34
+ traceIdB64: string;
35
+ spanIdB64: string;
36
+ parentSpanIdB64?: string;
37
+ };
38
+
39
+ type Attachment = {
40
+ type: string;
41
+ role: string;
42
+ name?: string;
43
+ value: string;
44
+ };
45
+ type IdentifyInput = {
46
+ userId: string;
47
+ traits?: Record<string, unknown>;
48
+ };
49
+ type Patch = {
50
+ eventName?: string;
51
+ userId?: string;
52
+ convoId?: string;
53
+ input?: string;
54
+ output?: string;
55
+ model?: string;
56
+ properties?: Record<string, unknown>;
57
+ attachments?: Attachment[];
58
+ isPending?: boolean;
59
+ timestamp?: string;
60
+ };
61
+ type SignalInput = {
62
+ eventId: string;
63
+ name: string;
64
+ type?: "default" | "feedback" | "edit" | "standard" | "agent" | "agent_internal";
65
+ sentiment?: "POSITIVE" | "NEGATIVE";
66
+ timestamp?: string;
67
+ properties?: Record<string, unknown>;
68
+ attachmentId?: string;
69
+ comment?: string;
70
+ after?: string;
71
+ };
72
+ type EventShipperOptions = {
73
+ writeKey?: string;
74
+ endpoint?: string;
75
+ enabled?: boolean;
76
+ debug: boolean;
77
+ partialFlushMs?: number;
78
+ sdkName?: string;
79
+ libraryName?: string;
80
+ libraryVersion?: string;
81
+ defaultEventName?: string;
82
+ };
83
+ declare class EventShipper$1 {
84
+ private baseUrl;
85
+ private writeKey?;
86
+ private enabled;
87
+ private debug;
88
+ private partialFlushMs;
89
+ private sdkName;
90
+ private prefix;
91
+ private defaultEventName;
92
+ private context;
93
+ private buffers;
94
+ private sticky;
95
+ private timers;
96
+ private inFlight;
97
+ constructor(opts: EventShipperOptions);
98
+ isDebugEnabled(): boolean;
99
+ private authHeaders;
100
+ patch(eventId: string, patch: Patch): Promise<void>;
101
+ finish(eventId: string, patch: {
102
+ output?: string;
103
+ model?: string;
104
+ properties?: Record<string, unknown>;
105
+ userId?: string;
106
+ }): Promise<void>;
107
+ flush(): Promise<void>;
108
+ shutdown(): Promise<void>;
109
+ trackSignal(signal: SignalInput): Promise<void>;
110
+ identify(users: IdentifyInput | IdentifyInput[]): Promise<void>;
111
+ private flushOne;
112
+ }
113
+
114
+ type InternalSpan = {
115
+ ids: SpanIds;
116
+ name: string;
117
+ startTimeUnixNano: string;
118
+ endTimeUnixNano?: string;
119
+ attributes: Array<OtlpKeyValue | undefined>;
120
+ };
121
+ type TraceShipperOptions = {
122
+ writeKey?: string;
123
+ endpoint?: string;
124
+ enabled?: boolean;
125
+ debug: boolean;
126
+ debugSpans?: boolean;
127
+ flushIntervalMs?: number;
128
+ maxBatchSize?: number;
129
+ maxQueueSize?: number;
130
+ sdkName?: string;
131
+ serviceName?: string;
132
+ serviceVersion?: string;
133
+ };
134
+ declare class TraceShipper$1 {
135
+ private baseUrl;
136
+ private writeKey?;
137
+ private enabled;
138
+ private debug;
139
+ private debugSpans;
140
+ private sdkName;
141
+ private prefix;
142
+ private serviceName;
143
+ private serviceVersion;
144
+ private flushIntervalMs;
145
+ private maxBatchSize;
146
+ private maxQueueSize;
147
+ private queue;
148
+ private timer;
149
+ private inFlight;
150
+ constructor(opts: TraceShipperOptions);
151
+ isDebugEnabled(): boolean;
152
+ private authHeaders;
153
+ startSpan(args: {
154
+ name: string;
155
+ parent?: {
156
+ traceIdB64: string;
157
+ spanIdB64: string;
158
+ };
159
+ eventId: string;
160
+ operationId?: string;
161
+ attributes?: Array<OtlpKeyValue | undefined>;
162
+ startTimeUnixNano?: string;
163
+ }): InternalSpan;
164
+ endSpan(span: InternalSpan, extra?: {
165
+ attributes?: InternalSpan["attributes"];
166
+ error?: unknown;
167
+ status?: OtlpSpanStatus;
168
+ endTimeUnixNano?: string;
169
+ }): void;
170
+ createSpan(args: {
171
+ name: string;
172
+ parent?: {
173
+ traceIdB64: string;
174
+ spanIdB64: string;
175
+ };
176
+ eventId: string;
177
+ startTimeUnixNano: string;
178
+ endTimeUnixNano: string;
179
+ attributes?: Array<OtlpKeyValue | undefined>;
180
+ status?: OtlpSpanStatus;
181
+ }): void;
182
+ enqueue(span: OtlpSpan): void;
183
+ flush(): Promise<void>;
184
+ shutdown(): Promise<void>;
185
+ }
186
+
187
+ type ParentSpanContext = {
188
+ traceIdB64: string;
189
+ spanIdB64: string;
190
+ eventId: string;
191
+ };
192
+ interface ContextSpan {
193
+ readonly traceIdB64: string;
194
+ readonly spanIdB64: string;
195
+ readonly eventId: string;
196
+ log?(data: Record<string, unknown>): void;
197
+ }
198
+ interface AsyncLocalStorageLike<T> {
199
+ getStore(): T | undefined;
200
+ run<R>(store: T, callback: () => R): R;
201
+ enterWith?(store: T): void;
202
+ }
203
+ declare abstract class ContextManager {
204
+ abstract getParentSpanIds(): ParentSpanContext | undefined;
205
+ abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
206
+ abstract getCurrentSpan(): ContextSpan | undefined;
207
+ abstract isReady(): boolean;
208
+ }
209
+ declare global {
210
+ var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
211
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
212
+ }
213
+
214
+ declare class EventShipper extends EventShipper$1 {
215
+ constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
216
+ }
217
+ declare class TraceShipper extends TraceShipper$1 {
218
+ constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
219
+ enqueue(span: OtlpSpan): void;
220
+ }
221
+
222
+ interface RaindropConfig {
223
+ writeKey: string;
224
+ endpoint: string;
225
+ userId: string;
226
+ debug: boolean;
227
+ }
228
+ /**
229
+ * Load config with precedence (low -> high):
230
+ * 1. Defaults
231
+ * 2. ~/.config/raindrop/config.json
232
+ * 3. Environment variables
233
+ */
234
+ declare function loadConfig(): RaindropConfig;
235
+ declare function getConfigPath(): string;
236
+
237
+ type SetupScope = "user" | "project";
238
+
239
+ interface HookPayload {
240
+ session_id: string;
241
+ hook_event_name: string;
242
+ cwd: string;
243
+ permission_mode: string;
244
+ transcript_path?: string;
245
+ source?: string;
246
+ model?: string;
247
+ prompt?: string;
248
+ tool_name?: string;
249
+ tool_input?: Record<string, unknown>;
250
+ tool_response?: unknown;
251
+ tool_use_id?: string;
252
+ error?: string;
253
+ is_interrupt?: boolean;
254
+ stop_hook_active?: boolean;
255
+ last_assistant_message?: string;
256
+ error_details?: string;
257
+ reason?: string;
258
+ agent_id?: string;
259
+ agent_type?: string;
260
+ agent_transcript_path?: string;
261
+ trigger?: string;
262
+ compact_summary?: string;
263
+ }
264
+ interface MapperConfig {
265
+ userId: string;
266
+ debug: boolean;
267
+ }
268
+ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
269
+
270
+ declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
271
+ declare const PACKAGE_VERSION = "0.0.1";
272
+
273
+ export { EventShipper, type HookPayload, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SetupScope, TraceShipper, getConfigPath, loadConfig, mapHookToRaindrop };