@raindrop-ai/claude-code 0.0.18 → 0.0.20
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/.claude-plugin/plugin.json +1 -1
- package/README.md +4 -0
- package/dist/cli.js +1354 -164
- package/dist/index.cjs +1296 -125
- package/dist/index.d.cts +110 -10
- package/dist/index.d.ts +110 -10
- package/dist/index.js +1295 -125
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -35,6 +35,69 @@ type SpanIds = {
|
|
|
35
35
|
spanIdB64: string;
|
|
36
36
|
parentSpanIdB64?: string;
|
|
37
37
|
};
|
|
38
|
+
/** Kept structural so public integration declarations do not depend on private schemas. */
|
|
39
|
+
type AppGitOptions = {
|
|
40
|
+
commitSha?: string | null;
|
|
41
|
+
commitDirty?: boolean | null;
|
|
42
|
+
branch?: string | null;
|
|
43
|
+
detectBranch?: boolean;
|
|
44
|
+
sourceDirectory?: string;
|
|
45
|
+
autoDetect?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type AppGitSnapshot = Readonly<Record<string, unknown>>;
|
|
48
|
+
type AppGitEnvironment = Readonly<Record<string, string | undefined>>;
|
|
49
|
+
type AppGitLocalResult = {
|
|
50
|
+
commitSha?: string;
|
|
51
|
+
commitDirty?: boolean;
|
|
52
|
+
branch?: string;
|
|
53
|
+
};
|
|
54
|
+
type AppGitOperationOwner = string;
|
|
55
|
+
type AppGitLocalResolver = (sourceDirectory: string | undefined, detectBranch: boolean, completed: (result: AppGitLocalResult) => void) => () => void;
|
|
56
|
+
/** One client owns its defaults; operation snapshots never wait for discovery. */
|
|
57
|
+
declare class AppGitContextImpl {
|
|
58
|
+
private defaults;
|
|
59
|
+
private explicit;
|
|
60
|
+
private explicitKeys;
|
|
61
|
+
private cancel;
|
|
62
|
+
private disposed;
|
|
63
|
+
private operations;
|
|
64
|
+
private operationOverflow;
|
|
65
|
+
private detectBranch;
|
|
66
|
+
private replayBranch;
|
|
67
|
+
private disabled;
|
|
68
|
+
constructor(options: AppGitOptions | false | undefined, runtime?: {
|
|
69
|
+
allowLocalGit?: boolean;
|
|
70
|
+
resolveLocal?: AppGitLocalResolver;
|
|
71
|
+
env?: AppGitEnvironment;
|
|
72
|
+
captureLegacyReplayBranch?: boolean;
|
|
73
|
+
allowDiscovery?: boolean;
|
|
74
|
+
});
|
|
75
|
+
private accept;
|
|
76
|
+
snapshot(properties?: Readonly<Record<string, unknown>>): AppGitSnapshot;
|
|
77
|
+
/** Safe defaults when no operation/span start was observed; never infer identity. */
|
|
78
|
+
snapshotExplicit(properties?: Readonly<Record<string, unknown>>, eventId?: string): AppGitSnapshot;
|
|
79
|
+
/** Existing replay branch reporting stays separate from opt-in event properties. */
|
|
80
|
+
snapshotForReplay(): AppGitSnapshot;
|
|
81
|
+
/** Merge a frozen span snapshot without losing client-authored provenance. */
|
|
82
|
+
mergeSnapshot(base: AppGitSnapshot, properties?: Readonly<Record<string, unknown>>, explicitKeys?: ReadonlySet<string>): AppGitSnapshot;
|
|
83
|
+
/** Shippers belonging to one client share this bounded operation registry. */
|
|
84
|
+
forOperation(eventId: string | undefined, properties?: Readonly<Record<string, unknown>>, owner?: AppGitOperationOwner): AppGitSnapshot;
|
|
85
|
+
releaseOperation(eventId: string, owner: AppGitOperationOwner): void;
|
|
86
|
+
finishOperation(eventId: string): void;
|
|
87
|
+
dispose(): void;
|
|
88
|
+
}
|
|
89
|
+
/** Structural at package boundaries: public SDK bundles contain independent copies of core. */
|
|
90
|
+
type AppGitContext = Pick<AppGitContextImpl, "snapshot" | "snapshotForReplay" | "forOperation" | "finishOperation" | "dispose"> & {
|
|
91
|
+
snapshotExplicit?: AppGitContextImpl["snapshotExplicit"];
|
|
92
|
+
mergeSnapshot?: AppGitContextImpl["mergeSnapshot"];
|
|
93
|
+
releaseOperation?: (eventId: string, owner: AppGitOperationOwner) => void;
|
|
94
|
+
};
|
|
95
|
+
declare const AppGitContext: typeof AppGitContextImpl;
|
|
96
|
+
declare function createAppGitContext(options?: AppGitOptions | false, runtime?: {
|
|
97
|
+
allowLocalGit?: boolean;
|
|
98
|
+
captureLegacyReplayBranch?: boolean;
|
|
99
|
+
allowDiscovery?: boolean;
|
|
100
|
+
}): AppGitContext;
|
|
38
101
|
type Attachment = {
|
|
39
102
|
type: string;
|
|
40
103
|
role: string;
|
|
@@ -45,6 +108,10 @@ type IdentifyInput = {
|
|
|
45
108
|
userId: string;
|
|
46
109
|
traits?: Record<string, unknown>;
|
|
47
110
|
};
|
|
111
|
+
type EventUsage = {
|
|
112
|
+
promptTokens?: number;
|
|
113
|
+
completionTokens?: number;
|
|
114
|
+
};
|
|
48
115
|
type Patch = {
|
|
49
116
|
eventName?: string;
|
|
50
117
|
userId?: string;
|
|
@@ -52,7 +119,10 @@ type Patch = {
|
|
|
52
119
|
input?: string;
|
|
53
120
|
output?: string;
|
|
54
121
|
model?: string;
|
|
122
|
+
usage?: EventUsage;
|
|
123
|
+
error?: unknown;
|
|
55
124
|
properties?: Record<string, unknown>;
|
|
125
|
+
featureFlags?: Record<string, string>;
|
|
56
126
|
attachments?: Attachment[];
|
|
57
127
|
isPending?: boolean;
|
|
58
128
|
timestamp?: string;
|
|
@@ -69,6 +139,9 @@ type SignalInput = {
|
|
|
69
139
|
after?: string;
|
|
70
140
|
};
|
|
71
141
|
type EventShipperOptions = {
|
|
142
|
+
appGit?: AppGitOptions | false;
|
|
143
|
+
/** Share with the trace shipper so one operation uses one source snapshot. */
|
|
144
|
+
appGitContext?: AppGitContext;
|
|
72
145
|
writeKey?: string;
|
|
73
146
|
endpoint?: string;
|
|
74
147
|
enabled?: boolean;
|
|
@@ -100,6 +173,9 @@ type EventShipperOptions = {
|
|
|
100
173
|
maxTextFieldChars?: number;
|
|
101
174
|
};
|
|
102
175
|
declare class EventShipper$1 {
|
|
176
|
+
private appGitContext;
|
|
177
|
+
private ownsAppGitContext;
|
|
178
|
+
private readonly appGitOwner;
|
|
103
179
|
private baseUrl;
|
|
104
180
|
private writeKey?;
|
|
105
181
|
private enabled;
|
|
@@ -130,6 +206,7 @@ declare class EventShipper$1 {
|
|
|
130
206
|
/** URL of the local debugger / Workshop daemon, when one is reachable. */
|
|
131
207
|
private localDebuggerUrl;
|
|
132
208
|
constructor(opts: EventShipperOptions);
|
|
209
|
+
protected ownAppGitContextForShutdown(): void;
|
|
133
210
|
isDebugEnabled(): boolean;
|
|
134
211
|
private authHeaders;
|
|
135
212
|
private requestHeaders;
|
|
@@ -149,12 +226,7 @@ declare class EventShipper$1 {
|
|
|
149
226
|
*/
|
|
150
227
|
private requestOpts;
|
|
151
228
|
patch(eventId: string, patch: Patch): Promise<void>;
|
|
152
|
-
finish(eventId: string, patch:
|
|
153
|
-
output?: string;
|
|
154
|
-
model?: string;
|
|
155
|
-
properties?: Record<string, unknown>;
|
|
156
|
-
userId?: string;
|
|
157
|
-
}): Promise<void>;
|
|
229
|
+
finish(eventId: string, patch: Pick<Patch, "output" | "model" | "usage" | "error" | "properties" | "featureFlags" | "userId">): Promise<void>;
|
|
158
230
|
flush(): Promise<void>;
|
|
159
231
|
shutdown(): Promise<void>;
|
|
160
232
|
trackSignal(signal: SignalInput): Promise<void>;
|
|
@@ -188,6 +260,8 @@ type InternalSpan = {
|
|
|
188
260
|
attributes: Array<OtlpKeyValue | undefined>;
|
|
189
261
|
};
|
|
190
262
|
type TraceShipperOptions = {
|
|
263
|
+
appGit?: AppGitOptions | false;
|
|
264
|
+
appGitContext?: AppGitContext;
|
|
191
265
|
writeKey?: string;
|
|
192
266
|
endpoint?: string;
|
|
193
267
|
enabled?: boolean;
|
|
@@ -256,6 +330,13 @@ type TraceShipperOptions = {
|
|
|
256
330
|
maxTextFieldChars?: number;
|
|
257
331
|
};
|
|
258
332
|
declare class TraceShipper$1 {
|
|
333
|
+
private appGitContext;
|
|
334
|
+
protected ownsAppGitContext: boolean;
|
|
335
|
+
private readonly appGitOwner;
|
|
336
|
+
private appGitEventIds;
|
|
337
|
+
private appGitActiveSpans;
|
|
338
|
+
private appGitCaptured;
|
|
339
|
+
private appGitAdded;
|
|
259
340
|
private baseUrl;
|
|
260
341
|
private writeKey?;
|
|
261
342
|
private enabled;
|
|
@@ -327,6 +408,9 @@ declare class TraceShipper$1 {
|
|
|
327
408
|
spanIdB64: string;
|
|
328
409
|
};
|
|
329
410
|
eventId: string;
|
|
411
|
+
userId?: string;
|
|
412
|
+
convoId?: string;
|
|
413
|
+
eventName?: string;
|
|
330
414
|
operationId?: string;
|
|
331
415
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
332
416
|
startTimeUnixNano?: string;
|
|
@@ -345,6 +429,9 @@ declare class TraceShipper$1 {
|
|
|
345
429
|
spanIdB64: string;
|
|
346
430
|
};
|
|
347
431
|
eventId: string;
|
|
432
|
+
userId?: string;
|
|
433
|
+
convoId?: string;
|
|
434
|
+
eventName?: string;
|
|
348
435
|
startTimeUnixNano: string;
|
|
349
436
|
endTimeUnixNano: string;
|
|
350
437
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
@@ -428,6 +515,14 @@ declare class TraceShipper extends TraceShipper$1 {
|
|
|
428
515
|
enqueue(span: OtlpSpan): void;
|
|
429
516
|
}
|
|
430
517
|
|
|
518
|
+
type AppGitFileOptions = {
|
|
519
|
+
commit_sha?: string | null;
|
|
520
|
+
commit_dirty?: boolean | null;
|
|
521
|
+
branch?: string | null;
|
|
522
|
+
detect_branch?: boolean;
|
|
523
|
+
source_directory?: string;
|
|
524
|
+
auto_detect?: boolean;
|
|
525
|
+
};
|
|
431
526
|
interface SelfDiagnosticsSignalDef {
|
|
432
527
|
description: string;
|
|
433
528
|
sentiment?: "POSITIVE" | "NEGATIVE";
|
|
@@ -447,6 +542,7 @@ interface ConfigFile {
|
|
|
447
542
|
event_name?: string;
|
|
448
543
|
custom_properties?: Record<string, unknown>;
|
|
449
544
|
self_diagnostics?: SelfDiagnosticsConfig;
|
|
545
|
+
app_git?: AppGitFileOptions | false;
|
|
450
546
|
}
|
|
451
547
|
interface RaindropConfig {
|
|
452
548
|
writeKey: string;
|
|
@@ -465,6 +561,8 @@ interface RaindropConfig {
|
|
|
465
561
|
eventName: string;
|
|
466
562
|
customProperties: Record<string, unknown>;
|
|
467
563
|
selfDiagnostics?: SelfDiagnosticsConfig;
|
|
564
|
+
/** Application Git identity override. false disables enrichment. */
|
|
565
|
+
appGit?: AppGitOptions | false;
|
|
468
566
|
}
|
|
469
567
|
/**
|
|
470
568
|
* Load config with precedence (low -> high):
|
|
@@ -525,7 +623,7 @@ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, e
|
|
|
525
623
|
declare function extractAppendSystemPrompt(args: string[]): string | undefined;
|
|
526
624
|
|
|
527
625
|
declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
|
|
528
|
-
declare const PACKAGE_VERSION
|
|
626
|
+
declare const PACKAGE_VERSION: string;
|
|
529
627
|
|
|
530
628
|
/** A tool call extracted from an assistant message content block. */
|
|
531
629
|
interface LLMToolCall {
|
|
@@ -619,9 +717,11 @@ interface LocalDebuggerResult {
|
|
|
619
717
|
declare function detectLocalDebugger(debug: boolean): Promise<LocalDebuggerResult>;
|
|
620
718
|
/**
|
|
621
719
|
* Mirror an event payload to the local debugger's track_partial endpoint.
|
|
622
|
-
*
|
|
720
|
+
* Must be awaited: Claude Code hooks call process.exit as soon as handleHook
|
|
721
|
+
* returns, so a fire-and-forget fetch is killed before it leaves the socket.
|
|
722
|
+
* Errors are swallowed — observability must never fail the hook.
|
|
623
723
|
*/
|
|
624
|
-
declare function mirrorEventToLocalDebugger(baseUrl: string, payload: Record<string, unknown>, debug: boolean): void
|
|
724
|
+
declare function mirrorEventToLocalDebugger(baseUrl: string, payload: Record<string, unknown>, debug: boolean): Promise<void>;
|
|
625
725
|
|
|
626
726
|
interface ResolvedSignal {
|
|
627
727
|
description: string;
|
|
@@ -677,4 +777,4 @@ declare const TOOL_SCHEMA: {
|
|
|
677
777
|
};
|
|
678
778
|
declare function startMcpServer(): Promise<void>;
|
|
679
779
|
|
|
680
|
-
export { DEFAULT_CATEGORY_KEYS, EventShipper, type HookPayload, type LLMCallPhase, type LLMToolCall, type LocalDebuggerResult, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SelfDiagnosticsConfig, type SelfDiagnosticsSignalDef, type SetupScope, TOOL_SCHEMA, TraceShipper, type TranscriptSummary, detectLocalDebugger, executeTool, extractAppendSystemPrompt, getConfigPath, loadConfig, mapHookToRaindrop, mirrorEventToLocalDebugger, normalizeSignals, parseTranscript, resolveCurrentEventId, resolveToolConfig, startMcpServer, transcriptToProperties, updateConfig };
|
|
780
|
+
export { type AppGitOptions, DEFAULT_CATEGORY_KEYS, EventShipper, type HookPayload, type LLMCallPhase, type LLMToolCall, type LocalDebuggerResult, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SelfDiagnosticsConfig, type SelfDiagnosticsSignalDef, type SetupScope, TOOL_SCHEMA, TraceShipper, type TranscriptSummary, createAppGitContext, detectLocalDebugger, executeTool, extractAppendSystemPrompt, getConfigPath, loadConfig, mapHookToRaindrop, mirrorEventToLocalDebugger, normalizeSignals, parseTranscript, resolveCurrentEventId, resolveToolConfig, startMcpServer, transcriptToProperties, updateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,69 @@ type SpanIds = {
|
|
|
35
35
|
spanIdB64: string;
|
|
36
36
|
parentSpanIdB64?: string;
|
|
37
37
|
};
|
|
38
|
+
/** Kept structural so public integration declarations do not depend on private schemas. */
|
|
39
|
+
type AppGitOptions = {
|
|
40
|
+
commitSha?: string | null;
|
|
41
|
+
commitDirty?: boolean | null;
|
|
42
|
+
branch?: string | null;
|
|
43
|
+
detectBranch?: boolean;
|
|
44
|
+
sourceDirectory?: string;
|
|
45
|
+
autoDetect?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type AppGitSnapshot = Readonly<Record<string, unknown>>;
|
|
48
|
+
type AppGitEnvironment = Readonly<Record<string, string | undefined>>;
|
|
49
|
+
type AppGitLocalResult = {
|
|
50
|
+
commitSha?: string;
|
|
51
|
+
commitDirty?: boolean;
|
|
52
|
+
branch?: string;
|
|
53
|
+
};
|
|
54
|
+
type AppGitOperationOwner = string;
|
|
55
|
+
type AppGitLocalResolver = (sourceDirectory: string | undefined, detectBranch: boolean, completed: (result: AppGitLocalResult) => void) => () => void;
|
|
56
|
+
/** One client owns its defaults; operation snapshots never wait for discovery. */
|
|
57
|
+
declare class AppGitContextImpl {
|
|
58
|
+
private defaults;
|
|
59
|
+
private explicit;
|
|
60
|
+
private explicitKeys;
|
|
61
|
+
private cancel;
|
|
62
|
+
private disposed;
|
|
63
|
+
private operations;
|
|
64
|
+
private operationOverflow;
|
|
65
|
+
private detectBranch;
|
|
66
|
+
private replayBranch;
|
|
67
|
+
private disabled;
|
|
68
|
+
constructor(options: AppGitOptions | false | undefined, runtime?: {
|
|
69
|
+
allowLocalGit?: boolean;
|
|
70
|
+
resolveLocal?: AppGitLocalResolver;
|
|
71
|
+
env?: AppGitEnvironment;
|
|
72
|
+
captureLegacyReplayBranch?: boolean;
|
|
73
|
+
allowDiscovery?: boolean;
|
|
74
|
+
});
|
|
75
|
+
private accept;
|
|
76
|
+
snapshot(properties?: Readonly<Record<string, unknown>>): AppGitSnapshot;
|
|
77
|
+
/** Safe defaults when no operation/span start was observed; never infer identity. */
|
|
78
|
+
snapshotExplicit(properties?: Readonly<Record<string, unknown>>, eventId?: string): AppGitSnapshot;
|
|
79
|
+
/** Existing replay branch reporting stays separate from opt-in event properties. */
|
|
80
|
+
snapshotForReplay(): AppGitSnapshot;
|
|
81
|
+
/** Merge a frozen span snapshot without losing client-authored provenance. */
|
|
82
|
+
mergeSnapshot(base: AppGitSnapshot, properties?: Readonly<Record<string, unknown>>, explicitKeys?: ReadonlySet<string>): AppGitSnapshot;
|
|
83
|
+
/** Shippers belonging to one client share this bounded operation registry. */
|
|
84
|
+
forOperation(eventId: string | undefined, properties?: Readonly<Record<string, unknown>>, owner?: AppGitOperationOwner): AppGitSnapshot;
|
|
85
|
+
releaseOperation(eventId: string, owner: AppGitOperationOwner): void;
|
|
86
|
+
finishOperation(eventId: string): void;
|
|
87
|
+
dispose(): void;
|
|
88
|
+
}
|
|
89
|
+
/** Structural at package boundaries: public SDK bundles contain independent copies of core. */
|
|
90
|
+
type AppGitContext = Pick<AppGitContextImpl, "snapshot" | "snapshotForReplay" | "forOperation" | "finishOperation" | "dispose"> & {
|
|
91
|
+
snapshotExplicit?: AppGitContextImpl["snapshotExplicit"];
|
|
92
|
+
mergeSnapshot?: AppGitContextImpl["mergeSnapshot"];
|
|
93
|
+
releaseOperation?: (eventId: string, owner: AppGitOperationOwner) => void;
|
|
94
|
+
};
|
|
95
|
+
declare const AppGitContext: typeof AppGitContextImpl;
|
|
96
|
+
declare function createAppGitContext(options?: AppGitOptions | false, runtime?: {
|
|
97
|
+
allowLocalGit?: boolean;
|
|
98
|
+
captureLegacyReplayBranch?: boolean;
|
|
99
|
+
allowDiscovery?: boolean;
|
|
100
|
+
}): AppGitContext;
|
|
38
101
|
type Attachment = {
|
|
39
102
|
type: string;
|
|
40
103
|
role: string;
|
|
@@ -45,6 +108,10 @@ type IdentifyInput = {
|
|
|
45
108
|
userId: string;
|
|
46
109
|
traits?: Record<string, unknown>;
|
|
47
110
|
};
|
|
111
|
+
type EventUsage = {
|
|
112
|
+
promptTokens?: number;
|
|
113
|
+
completionTokens?: number;
|
|
114
|
+
};
|
|
48
115
|
type Patch = {
|
|
49
116
|
eventName?: string;
|
|
50
117
|
userId?: string;
|
|
@@ -52,7 +119,10 @@ type Patch = {
|
|
|
52
119
|
input?: string;
|
|
53
120
|
output?: string;
|
|
54
121
|
model?: string;
|
|
122
|
+
usage?: EventUsage;
|
|
123
|
+
error?: unknown;
|
|
55
124
|
properties?: Record<string, unknown>;
|
|
125
|
+
featureFlags?: Record<string, string>;
|
|
56
126
|
attachments?: Attachment[];
|
|
57
127
|
isPending?: boolean;
|
|
58
128
|
timestamp?: string;
|
|
@@ -69,6 +139,9 @@ type SignalInput = {
|
|
|
69
139
|
after?: string;
|
|
70
140
|
};
|
|
71
141
|
type EventShipperOptions = {
|
|
142
|
+
appGit?: AppGitOptions | false;
|
|
143
|
+
/** Share with the trace shipper so one operation uses one source snapshot. */
|
|
144
|
+
appGitContext?: AppGitContext;
|
|
72
145
|
writeKey?: string;
|
|
73
146
|
endpoint?: string;
|
|
74
147
|
enabled?: boolean;
|
|
@@ -100,6 +173,9 @@ type EventShipperOptions = {
|
|
|
100
173
|
maxTextFieldChars?: number;
|
|
101
174
|
};
|
|
102
175
|
declare class EventShipper$1 {
|
|
176
|
+
private appGitContext;
|
|
177
|
+
private ownsAppGitContext;
|
|
178
|
+
private readonly appGitOwner;
|
|
103
179
|
private baseUrl;
|
|
104
180
|
private writeKey?;
|
|
105
181
|
private enabled;
|
|
@@ -130,6 +206,7 @@ declare class EventShipper$1 {
|
|
|
130
206
|
/** URL of the local debugger / Workshop daemon, when one is reachable. */
|
|
131
207
|
private localDebuggerUrl;
|
|
132
208
|
constructor(opts: EventShipperOptions);
|
|
209
|
+
protected ownAppGitContextForShutdown(): void;
|
|
133
210
|
isDebugEnabled(): boolean;
|
|
134
211
|
private authHeaders;
|
|
135
212
|
private requestHeaders;
|
|
@@ -149,12 +226,7 @@ declare class EventShipper$1 {
|
|
|
149
226
|
*/
|
|
150
227
|
private requestOpts;
|
|
151
228
|
patch(eventId: string, patch: Patch): Promise<void>;
|
|
152
|
-
finish(eventId: string, patch:
|
|
153
|
-
output?: string;
|
|
154
|
-
model?: string;
|
|
155
|
-
properties?: Record<string, unknown>;
|
|
156
|
-
userId?: string;
|
|
157
|
-
}): Promise<void>;
|
|
229
|
+
finish(eventId: string, patch: Pick<Patch, "output" | "model" | "usage" | "error" | "properties" | "featureFlags" | "userId">): Promise<void>;
|
|
158
230
|
flush(): Promise<void>;
|
|
159
231
|
shutdown(): Promise<void>;
|
|
160
232
|
trackSignal(signal: SignalInput): Promise<void>;
|
|
@@ -188,6 +260,8 @@ type InternalSpan = {
|
|
|
188
260
|
attributes: Array<OtlpKeyValue | undefined>;
|
|
189
261
|
};
|
|
190
262
|
type TraceShipperOptions = {
|
|
263
|
+
appGit?: AppGitOptions | false;
|
|
264
|
+
appGitContext?: AppGitContext;
|
|
191
265
|
writeKey?: string;
|
|
192
266
|
endpoint?: string;
|
|
193
267
|
enabled?: boolean;
|
|
@@ -256,6 +330,13 @@ type TraceShipperOptions = {
|
|
|
256
330
|
maxTextFieldChars?: number;
|
|
257
331
|
};
|
|
258
332
|
declare class TraceShipper$1 {
|
|
333
|
+
private appGitContext;
|
|
334
|
+
protected ownsAppGitContext: boolean;
|
|
335
|
+
private readonly appGitOwner;
|
|
336
|
+
private appGitEventIds;
|
|
337
|
+
private appGitActiveSpans;
|
|
338
|
+
private appGitCaptured;
|
|
339
|
+
private appGitAdded;
|
|
259
340
|
private baseUrl;
|
|
260
341
|
private writeKey?;
|
|
261
342
|
private enabled;
|
|
@@ -327,6 +408,9 @@ declare class TraceShipper$1 {
|
|
|
327
408
|
spanIdB64: string;
|
|
328
409
|
};
|
|
329
410
|
eventId: string;
|
|
411
|
+
userId?: string;
|
|
412
|
+
convoId?: string;
|
|
413
|
+
eventName?: string;
|
|
330
414
|
operationId?: string;
|
|
331
415
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
332
416
|
startTimeUnixNano?: string;
|
|
@@ -345,6 +429,9 @@ declare class TraceShipper$1 {
|
|
|
345
429
|
spanIdB64: string;
|
|
346
430
|
};
|
|
347
431
|
eventId: string;
|
|
432
|
+
userId?: string;
|
|
433
|
+
convoId?: string;
|
|
434
|
+
eventName?: string;
|
|
348
435
|
startTimeUnixNano: string;
|
|
349
436
|
endTimeUnixNano: string;
|
|
350
437
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
@@ -428,6 +515,14 @@ declare class TraceShipper extends TraceShipper$1 {
|
|
|
428
515
|
enqueue(span: OtlpSpan): void;
|
|
429
516
|
}
|
|
430
517
|
|
|
518
|
+
type AppGitFileOptions = {
|
|
519
|
+
commit_sha?: string | null;
|
|
520
|
+
commit_dirty?: boolean | null;
|
|
521
|
+
branch?: string | null;
|
|
522
|
+
detect_branch?: boolean;
|
|
523
|
+
source_directory?: string;
|
|
524
|
+
auto_detect?: boolean;
|
|
525
|
+
};
|
|
431
526
|
interface SelfDiagnosticsSignalDef {
|
|
432
527
|
description: string;
|
|
433
528
|
sentiment?: "POSITIVE" | "NEGATIVE";
|
|
@@ -447,6 +542,7 @@ interface ConfigFile {
|
|
|
447
542
|
event_name?: string;
|
|
448
543
|
custom_properties?: Record<string, unknown>;
|
|
449
544
|
self_diagnostics?: SelfDiagnosticsConfig;
|
|
545
|
+
app_git?: AppGitFileOptions | false;
|
|
450
546
|
}
|
|
451
547
|
interface RaindropConfig {
|
|
452
548
|
writeKey: string;
|
|
@@ -465,6 +561,8 @@ interface RaindropConfig {
|
|
|
465
561
|
eventName: string;
|
|
466
562
|
customProperties: Record<string, unknown>;
|
|
467
563
|
selfDiagnostics?: SelfDiagnosticsConfig;
|
|
564
|
+
/** Application Git identity override. false disables enrichment. */
|
|
565
|
+
appGit?: AppGitOptions | false;
|
|
468
566
|
}
|
|
469
567
|
/**
|
|
470
568
|
* Load config with precedence (low -> high):
|
|
@@ -525,7 +623,7 @@ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, e
|
|
|
525
623
|
declare function extractAppendSystemPrompt(args: string[]): string | undefined;
|
|
526
624
|
|
|
527
625
|
declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
|
|
528
|
-
declare const PACKAGE_VERSION
|
|
626
|
+
declare const PACKAGE_VERSION: string;
|
|
529
627
|
|
|
530
628
|
/** A tool call extracted from an assistant message content block. */
|
|
531
629
|
interface LLMToolCall {
|
|
@@ -619,9 +717,11 @@ interface LocalDebuggerResult {
|
|
|
619
717
|
declare function detectLocalDebugger(debug: boolean): Promise<LocalDebuggerResult>;
|
|
620
718
|
/**
|
|
621
719
|
* Mirror an event payload to the local debugger's track_partial endpoint.
|
|
622
|
-
*
|
|
720
|
+
* Must be awaited: Claude Code hooks call process.exit as soon as handleHook
|
|
721
|
+
* returns, so a fire-and-forget fetch is killed before it leaves the socket.
|
|
722
|
+
* Errors are swallowed — observability must never fail the hook.
|
|
623
723
|
*/
|
|
624
|
-
declare function mirrorEventToLocalDebugger(baseUrl: string, payload: Record<string, unknown>, debug: boolean): void
|
|
724
|
+
declare function mirrorEventToLocalDebugger(baseUrl: string, payload: Record<string, unknown>, debug: boolean): Promise<void>;
|
|
625
725
|
|
|
626
726
|
interface ResolvedSignal {
|
|
627
727
|
description: string;
|
|
@@ -677,4 +777,4 @@ declare const TOOL_SCHEMA: {
|
|
|
677
777
|
};
|
|
678
778
|
declare function startMcpServer(): Promise<void>;
|
|
679
779
|
|
|
680
|
-
export { DEFAULT_CATEGORY_KEYS, EventShipper, type HookPayload, type LLMCallPhase, type LLMToolCall, type LocalDebuggerResult, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SelfDiagnosticsConfig, type SelfDiagnosticsSignalDef, type SetupScope, TOOL_SCHEMA, TraceShipper, type TranscriptSummary, detectLocalDebugger, executeTool, extractAppendSystemPrompt, getConfigPath, loadConfig, mapHookToRaindrop, mirrorEventToLocalDebugger, normalizeSignals, parseTranscript, resolveCurrentEventId, resolveToolConfig, startMcpServer, transcriptToProperties, updateConfig };
|
|
780
|
+
export { type AppGitOptions, DEFAULT_CATEGORY_KEYS, EventShipper, type HookPayload, type LLMCallPhase, type LLMToolCall, type LocalDebuggerResult, type MapperConfig, PACKAGE_NAME, PACKAGE_VERSION, type RaindropConfig, type SelfDiagnosticsConfig, type SelfDiagnosticsSignalDef, type SetupScope, TOOL_SCHEMA, TraceShipper, type TranscriptSummary, createAppGitContext, detectLocalDebugger, executeTool, extractAppendSystemPrompt, getConfigPath, loadConfig, mapHookToRaindrop, mirrorEventToLocalDebugger, normalizeSignals, parseTranscript, resolveCurrentEventId, resolveToolConfig, startMcpServer, transcriptToProperties, updateConfig };
|