@raindrop-ai/claude-code 0.0.19 → 0.0.21

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.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;
@@ -76,6 +139,9 @@ type SignalInput = {
76
139
  after?: string;
77
140
  };
78
141
  type EventShipperOptions = {
142
+ appGit?: AppGitOptions | false;
143
+ /** Share with the trace shipper so one operation uses one source snapshot. */
144
+ appGitContext?: AppGitContext;
79
145
  writeKey?: string;
80
146
  endpoint?: string;
81
147
  enabled?: boolean;
@@ -107,6 +173,9 @@ type EventShipperOptions = {
107
173
  maxTextFieldChars?: number;
108
174
  };
109
175
  declare class EventShipper$1 {
176
+ private appGitContext;
177
+ private ownsAppGitContext;
178
+ private readonly appGitOwner;
110
179
  private baseUrl;
111
180
  private writeKey?;
112
181
  private enabled;
@@ -137,6 +206,7 @@ declare class EventShipper$1 {
137
206
  /** URL of the local debugger / Workshop daemon, when one is reachable. */
138
207
  private localDebuggerUrl;
139
208
  constructor(opts: EventShipperOptions);
209
+ protected ownAppGitContextForShutdown(): void;
140
210
  isDebugEnabled(): boolean;
141
211
  private authHeaders;
142
212
  private requestHeaders;
@@ -190,6 +260,8 @@ type InternalSpan = {
190
260
  attributes: Array<OtlpKeyValue | undefined>;
191
261
  };
192
262
  type TraceShipperOptions = {
263
+ appGit?: AppGitOptions | false;
264
+ appGitContext?: AppGitContext;
193
265
  writeKey?: string;
194
266
  endpoint?: string;
195
267
  enabled?: boolean;
@@ -258,6 +330,13 @@ type TraceShipperOptions = {
258
330
  maxTextFieldChars?: number;
259
331
  };
260
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;
261
340
  private baseUrl;
262
341
  private writeKey?;
263
342
  private enabled;
@@ -427,6 +506,32 @@ declare global {
427
506
  var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
428
507
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
429
508
  }
509
+ type JsonSchema = Record<string, unknown>;
510
+ type FunctionToolDeclaration = {
511
+ type: "function";
512
+ name: string;
513
+ description?: string;
514
+ inputSchema?: JsonSchema;
515
+ };
516
+ type ProviderDefinedToolDeclaration = {
517
+ type: "provider-defined";
518
+ id?: string;
519
+ name: string;
520
+ args?: Record<string, unknown>;
521
+ };
522
+ type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
523
+ /**
524
+ * What callers hand to a `tools` override. The canonical `ToolDeclaration`
525
+ * shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
526
+ * recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
527
+ */
528
+ type ToolDeclarationInput = ToolDeclaration | {
529
+ name: string;
530
+ description?: string;
531
+ inputSchema?: JsonSchema;
532
+ parameters?: JsonSchema;
533
+ };
534
+ type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
430
535
 
431
536
  declare class EventShipper extends EventShipper$1 {
432
537
  constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
@@ -436,6 +541,14 @@ declare class TraceShipper extends TraceShipper$1 {
436
541
  enqueue(span: OtlpSpan): void;
437
542
  }
438
543
 
544
+ type AppGitFileOptions = {
545
+ commit_sha?: string | null;
546
+ commit_dirty?: boolean | null;
547
+ branch?: string | null;
548
+ detect_branch?: boolean;
549
+ source_directory?: string;
550
+ auto_detect?: boolean;
551
+ };
439
552
  interface SelfDiagnosticsSignalDef {
440
553
  description: string;
441
554
  sentiment?: "POSITIVE" | "NEGATIVE";
@@ -455,6 +568,8 @@ interface ConfigFile {
455
568
  event_name?: string;
456
569
  custom_properties?: Record<string, unknown>;
457
570
  self_diagnostics?: SelfDiagnosticsConfig;
571
+ app_git?: AppGitFileOptions | false;
572
+ tools?: unknown[];
458
573
  }
459
574
  interface RaindropConfig {
460
575
  writeKey: string;
@@ -473,6 +588,13 @@ interface RaindropConfig {
473
588
  eventName: string;
474
589
  customProperties: Record<string, unknown>;
475
590
  selfDiagnostics?: SelfDiagnosticsConfig;
591
+ /** Application Git identity override. false disables enrichment. */
592
+ appGit?: AppGitOptions | false;
593
+ /**
594
+ * Tool catalog recorded as `ai.prompt.tools` on every LLM span. Hooks never
595
+ * see the model request, so this is the only way to record it.
596
+ */
597
+ tools?: PromptToolsOverride;
476
598
  }
477
599
  /**
478
600
  * Load config with precedence (low -> high):
@@ -520,6 +642,7 @@ interface MapperConfig {
520
642
  debug: boolean;
521
643
  eventName: string;
522
644
  customProperties: Record<string, unknown>;
645
+ tools?: PromptToolsOverride;
523
646
  }
524
647
  declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
525
648
  /**
@@ -687,4 +810,4 @@ declare const TOOL_SCHEMA: {
687
810
  };
688
811
  declare function startMcpServer(): Promise<void>;
689
812
 
690
- 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 };
813
+ 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;
@@ -76,6 +139,9 @@ type SignalInput = {
76
139
  after?: string;
77
140
  };
78
141
  type EventShipperOptions = {
142
+ appGit?: AppGitOptions | false;
143
+ /** Share with the trace shipper so one operation uses one source snapshot. */
144
+ appGitContext?: AppGitContext;
79
145
  writeKey?: string;
80
146
  endpoint?: string;
81
147
  enabled?: boolean;
@@ -107,6 +173,9 @@ type EventShipperOptions = {
107
173
  maxTextFieldChars?: number;
108
174
  };
109
175
  declare class EventShipper$1 {
176
+ private appGitContext;
177
+ private ownsAppGitContext;
178
+ private readonly appGitOwner;
110
179
  private baseUrl;
111
180
  private writeKey?;
112
181
  private enabled;
@@ -137,6 +206,7 @@ declare class EventShipper$1 {
137
206
  /** URL of the local debugger / Workshop daemon, when one is reachable. */
138
207
  private localDebuggerUrl;
139
208
  constructor(opts: EventShipperOptions);
209
+ protected ownAppGitContextForShutdown(): void;
140
210
  isDebugEnabled(): boolean;
141
211
  private authHeaders;
142
212
  private requestHeaders;
@@ -190,6 +260,8 @@ type InternalSpan = {
190
260
  attributes: Array<OtlpKeyValue | undefined>;
191
261
  };
192
262
  type TraceShipperOptions = {
263
+ appGit?: AppGitOptions | false;
264
+ appGitContext?: AppGitContext;
193
265
  writeKey?: string;
194
266
  endpoint?: string;
195
267
  enabled?: boolean;
@@ -258,6 +330,13 @@ type TraceShipperOptions = {
258
330
  maxTextFieldChars?: number;
259
331
  };
260
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;
261
340
  private baseUrl;
262
341
  private writeKey?;
263
342
  private enabled;
@@ -427,6 +506,32 @@ declare global {
427
506
  var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
428
507
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
429
508
  }
509
+ type JsonSchema = Record<string, unknown>;
510
+ type FunctionToolDeclaration = {
511
+ type: "function";
512
+ name: string;
513
+ description?: string;
514
+ inputSchema?: JsonSchema;
515
+ };
516
+ type ProviderDefinedToolDeclaration = {
517
+ type: "provider-defined";
518
+ id?: string;
519
+ name: string;
520
+ args?: Record<string, unknown>;
521
+ };
522
+ type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
523
+ /**
524
+ * What callers hand to a `tools` override. The canonical `ToolDeclaration`
525
+ * shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
526
+ * recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
527
+ */
528
+ type ToolDeclarationInput = ToolDeclaration | {
529
+ name: string;
530
+ description?: string;
531
+ inputSchema?: JsonSchema;
532
+ parameters?: JsonSchema;
533
+ };
534
+ type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
430
535
 
431
536
  declare class EventShipper extends EventShipper$1 {
432
537
  constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
@@ -436,6 +541,14 @@ declare class TraceShipper extends TraceShipper$1 {
436
541
  enqueue(span: OtlpSpan): void;
437
542
  }
438
543
 
544
+ type AppGitFileOptions = {
545
+ commit_sha?: string | null;
546
+ commit_dirty?: boolean | null;
547
+ branch?: string | null;
548
+ detect_branch?: boolean;
549
+ source_directory?: string;
550
+ auto_detect?: boolean;
551
+ };
439
552
  interface SelfDiagnosticsSignalDef {
440
553
  description: string;
441
554
  sentiment?: "POSITIVE" | "NEGATIVE";
@@ -455,6 +568,8 @@ interface ConfigFile {
455
568
  event_name?: string;
456
569
  custom_properties?: Record<string, unknown>;
457
570
  self_diagnostics?: SelfDiagnosticsConfig;
571
+ app_git?: AppGitFileOptions | false;
572
+ tools?: unknown[];
458
573
  }
459
574
  interface RaindropConfig {
460
575
  writeKey: string;
@@ -473,6 +588,13 @@ interface RaindropConfig {
473
588
  eventName: string;
474
589
  customProperties: Record<string, unknown>;
475
590
  selfDiagnostics?: SelfDiagnosticsConfig;
591
+ /** Application Git identity override. false disables enrichment. */
592
+ appGit?: AppGitOptions | false;
593
+ /**
594
+ * Tool catalog recorded as `ai.prompt.tools` on every LLM span. Hooks never
595
+ * see the model request, so this is the only way to record it.
596
+ */
597
+ tools?: PromptToolsOverride;
476
598
  }
477
599
  /**
478
600
  * Load config with precedence (low -> high):
@@ -520,6 +642,7 @@ interface MapperConfig {
520
642
  debug: boolean;
521
643
  eventName: string;
522
644
  customProperties: Record<string, unknown>;
645
+ tools?: PromptToolsOverride;
523
646
  }
524
647
  declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
525
648
  /**
@@ -687,4 +810,4 @@ declare const TOOL_SCHEMA: {
687
810
  };
688
811
  declare function startMcpServer(): Promise<void>;
689
812
 
690
- 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 };
813
+ 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 };