@raindrop-ai/ai-sdk 0.3.2 → 0.3.4

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.
@@ -1,3 +1,99 @@
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
+ /** 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
+
1
97
  type FeatureFlagValue = string | number | boolean;
2
98
  type FeatureFlags = string[] | Record<string, FeatureFlagValue>;
3
99
  /**
@@ -198,44 +294,6 @@ declare function fromHeaders(headers: CarrierHeaders): TraceCarrier | null;
198
294
  * pass purely because an earlier case consumed the one warning.
199
295
  */
200
296
  declare function resetUnresolvedCarrierWarning(): void;
201
-
202
- type OtlpAnyValue = {
203
- stringValue?: string;
204
- intValue?: string;
205
- doubleValue?: number;
206
- boolValue?: boolean;
207
- arrayValue?: {
208
- values: OtlpAnyValue[];
209
- };
210
- };
211
- type OtlpKeyValue = {
212
- key: string;
213
- value: OtlpAnyValue;
214
- };
215
- declare const SpanStatusCode: {
216
- readonly UNSET: 0;
217
- readonly OK: 1;
218
- readonly ERROR: 2;
219
- };
220
- type OtlpSpanStatus = {
221
- code: (typeof SpanStatusCode)[keyof typeof SpanStatusCode] | number;
222
- message?: string;
223
- };
224
- type OtlpSpan = {
225
- traceId: string;
226
- spanId: string;
227
- parentSpanId?: string;
228
- name: string;
229
- startTimeUnixNano: string;
230
- endTimeUnixNano: string;
231
- attributes?: OtlpKeyValue[];
232
- status?: OtlpSpanStatus;
233
- };
234
- type SpanIds = {
235
- traceIdB64: string;
236
- spanIdB64: string;
237
- parentSpanIdB64?: string;
238
- };
239
297
  type Attachment$1 = {
240
298
  type: string;
241
299
  role: string;
@@ -277,6 +335,9 @@ type SignalInput = {
277
335
  after?: string;
278
336
  };
279
337
  type EventShipperOptions = {
338
+ appGit?: AppGitOptions | false;
339
+ /** Share with the trace shipper so one operation uses one source snapshot. */
340
+ appGitContext?: AppGitContext;
280
341
  writeKey?: string;
281
342
  endpoint?: string;
282
343
  enabled?: boolean;
@@ -308,6 +369,9 @@ type EventShipperOptions = {
308
369
  maxTextFieldChars?: number;
309
370
  };
310
371
  declare class EventShipper$1 {
372
+ private appGitContext;
373
+ private ownsAppGitContext;
374
+ private readonly appGitOwner;
311
375
  private baseUrl;
312
376
  private writeKey?;
313
377
  private enabled;
@@ -338,6 +402,7 @@ declare class EventShipper$1 {
338
402
  /** URL of the local debugger / Workshop daemon, when one is reachable. */
339
403
  private localDebuggerUrl;
340
404
  constructor(opts: EventShipperOptions);
405
+ protected ownAppGitContextForShutdown(): void;
341
406
  isDebugEnabled(): boolean;
342
407
  private authHeaders;
343
408
  private requestHeaders;
@@ -450,6 +515,8 @@ type InternalSpan = {
450
515
  attributes: Array<OtlpKeyValue | undefined>;
451
516
  };
452
517
  type TraceShipperOptions = {
518
+ appGit?: AppGitOptions | false;
519
+ appGitContext?: AppGitContext;
453
520
  writeKey?: string;
454
521
  endpoint?: string;
455
522
  enabled?: boolean;
@@ -518,6 +585,13 @@ type TraceShipperOptions = {
518
585
  maxTextFieldChars?: number;
519
586
  };
520
587
  declare class TraceShipper$1 {
588
+ private appGitContext;
589
+ protected ownsAppGitContext: boolean;
590
+ private readonly appGitOwner;
591
+ private appGitEventIds;
592
+ private appGitActiveSpans;
593
+ private appGitCaptured;
594
+ private appGitAdded;
521
595
  private baseUrl;
522
596
  private writeKey?;
523
597
  private enabled;
@@ -691,6 +765,46 @@ declare function getContextManager(): ContextManager;
691
765
  declare function currentSpan(): ContextSpan;
692
766
  declare function withCurrent<R>(span: ContextSpan, callback: () => R): R;
693
767
 
768
+ /**
769
+ * `ai.prompt.tools`: the tool catalog a model call was given, one JSON
770
+ * document per tool, in the shape the Vercel AI SDK records on its
771
+ * `doGenerate` / `doStream` spans. Every integration emits this attribute on
772
+ * its model-call spans so downstream consumers (agent replay, world builder)
773
+ * can read what the model could call instead of guessing from the calls it
774
+ * happened to make.
775
+ *
776
+ * An absent attribute means the integration could not observe the tool list;
777
+ * an empty array means the model had no tools. Callers who know better than
778
+ * the integration pass a `tools` override, which replaces the inferred list.
779
+ */
780
+ declare const PROMPT_TOOLS_ATTRIBUTE = "ai.prompt.tools";
781
+ type JsonSchema = Record<string, unknown>;
782
+ type FunctionToolDeclaration = {
783
+ type: "function";
784
+ name: string;
785
+ description?: string;
786
+ inputSchema?: JsonSchema;
787
+ };
788
+ type ProviderDefinedToolDeclaration = {
789
+ type: "provider-defined";
790
+ id?: string;
791
+ name: string;
792
+ args?: Record<string, unknown>;
793
+ };
794
+ type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
795
+ /**
796
+ * What callers hand to a `tools` override. The canonical `ToolDeclaration`
797
+ * shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
798
+ * recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
799
+ */
800
+ type ToolDeclarationInput = ToolDeclaration | {
801
+ name: string;
802
+ description?: string;
803
+ inputSchema?: JsonSchema;
804
+ parameters?: JsonSchema;
805
+ };
806
+ type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
807
+
694
808
  declare class EventShipper extends EventShipper$1 {
695
809
  constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
696
810
  }
@@ -1044,6 +1158,11 @@ type RaindropTelemetryIntegrationOptions = {
1044
1158
  debug?: boolean;
1045
1159
  /** See {@link SubagentApiOptions.settledEventIds}. */
1046
1160
  settledEventIds?: Set<string>;
1161
+ /**
1162
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
1163
+ * span (replaces the step's tools; `[]` records an empty catalog).
1164
+ */
1165
+ tools?: PromptToolsOverride;
1047
1166
  context?: {
1048
1167
  userId?: string;
1049
1168
  eventId?: string;
@@ -1061,6 +1180,7 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
1061
1180
  private readonly subagentWrapping;
1062
1181
  private readonly debug;
1063
1182
  private readonly defaultContext;
1183
+ private readonly promptTools;
1064
1184
  private readonly callStates;
1065
1185
  /**
1066
1186
  * Per-tool-call snapshot of the parent-tool ALS context taken right
@@ -1523,6 +1643,17 @@ type RaindropAISDKOptions = {
1523
1643
  * resolves to `default` server-side; byte-identical to prior behavior).
1524
1644
  */
1525
1645
  projectId?: string;
1646
+ /** Application Git identity. Auto-detects commit SHA by default; pass `false` to disable. */
1647
+ appGit?: AppGitOptions | false;
1648
+ /**
1649
+ * Share an application Git context with another telemetry feed owned by the
1650
+ * same logical client. When provided, it takes precedence over `appGit`.
1651
+ *
1652
+ * Integration coordinators must stop every feed using the context before
1653
+ * calling this client's `shutdown()`, which disposes the context. Disposal
1654
+ * is idempotent.
1655
+ */
1656
+ appGitContext?: AppGitContext;
1526
1657
  /**
1527
1658
  * Force-enable (or opt out of) Workshop / local-debugger mirroring.
1528
1659
  *
@@ -1719,6 +1850,12 @@ type WrapAISDKOptions = {
1719
1850
  * Default: false (uses Proxy wrapping for backward compatibility).
1720
1851
  */
1721
1852
  nativeTelemetry?: boolean;
1853
+ /**
1854
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
1855
+ * span, replacing the tools the AI SDK hands the model. `[]` records an
1856
+ * explicitly empty catalog.
1857
+ */
1858
+ tools?: PromptToolsOverride;
1722
1859
  };
1723
1860
  /**
1724
1861
  * Opaque handle for a trace span. Pass as `parent` when creating child spans.
@@ -1815,6 +1952,7 @@ type RaindropAISDKClient = {
1815
1952
  createTelemetryIntegration(contextOrOptions?: RaindropTelemetryIntegrationOptions["context"] | {
1816
1953
  context?: RaindropTelemetryIntegrationOptions["context"];
1817
1954
  subagentWrapping?: boolean;
1955
+ tools?: PromptToolsOverride;
1818
1956
  }): RaindropTelemetryIntegration;
1819
1957
  /**
1820
1958
  * Detached sub-agent hand-offs: record a sub-agent that runs in another
@@ -1928,6 +2066,11 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
1928
2066
  * spans nest correctly. Enabled by default.
1929
2067
  */
1930
2068
  subagentWrapping?: boolean;
2069
+ /**
2070
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
2071
+ * span. Use when the integration cannot see the tools the model was given.
2072
+ */
2073
+ tools?: PromptToolsOverride;
1931
2074
  };
1932
2075
  /**
1933
2076
  * One-line factory for the AI SDK v7 `registerTelemetry` DX.
@@ -1962,4 +2105,4 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
1962
2105
  */
1963
2106
  declare function raindrop(options?: RaindropTelemetryOptions): RaindropTelemetryIntegration;
1964
2107
 
1965
- export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, type CarrierHeaders, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, DETACHED_MODE, type DetachedChildLink, type DetachedDispatch, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type FeatureFlagValue, type FeatureFlags, HANDOFF_ATTRIBUTE_PREFIXES, HANDOFF_ATTRIBUTE_SUFFIXES, HANDOFF_TERMINAL_CANCELLED, HANDOFF_TERMINAL_PROPERTY_KEY, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type RaindropTelemetryOptions, SUBAGENT_ABORTED_OUTPUT, SUBAGENT_AGENT_ROLE, SUBAGENT_CANCELLED_OUTPUT, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, SubagentApi, type SubagentDispatch, type SubagentDispatchOptions, type SubagentResumeOptions, type SubagentRun, type SubagentRunMetadata, TOOL_EVENTS_ALLOW, TRUNCATION_MARKER, type TraceCarrier, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, fromHeaders, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, resetUnresolvedCarrierWarning, runWithParentToolContext, runWithRaindropCallMetadata, toHeaders, toLangSmithHeaders, withCurrent };
2108
+ export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, type CarrierHeaders, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, DETACHED_MODE, type DetachedChildLink, type DetachedDispatch, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type FeatureFlagValue, type FeatureFlags, HANDOFF_ATTRIBUTE_PREFIXES, HANDOFF_ATTRIBUTE_SUFFIXES, HANDOFF_TERMINAL_CANCELLED, HANDOFF_TERMINAL_PROPERTY_KEY, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, PROMPT_TOOLS_ATTRIBUTE, type ParentToolContext, type PromptToolsOverride, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type RaindropTelemetryOptions, SUBAGENT_ABORTED_OUTPUT, SUBAGENT_AGENT_ROLE, SUBAGENT_CANCELLED_OUTPUT, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, SubagentApi, type SubagentDispatch, type SubagentDispatchOptions, type SubagentResumeOptions, type SubagentRun, type SubagentRunMetadata, TOOL_EVENTS_ALLOW, TRUNCATION_MARKER, type ToolDeclaration, type TraceCarrier, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, fromHeaders, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, resetUnresolvedCarrierWarning, runWithParentToolContext, runWithRaindropCallMetadata, toHeaders, toLangSmithHeaders, withCurrent };
@@ -1,3 +1,99 @@
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
+ /** 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
+
1
97
  type FeatureFlagValue = string | number | boolean;
2
98
  type FeatureFlags = string[] | Record<string, FeatureFlagValue>;
3
99
  /**
@@ -198,44 +294,6 @@ declare function fromHeaders(headers: CarrierHeaders): TraceCarrier | null;
198
294
  * pass purely because an earlier case consumed the one warning.
199
295
  */
200
296
  declare function resetUnresolvedCarrierWarning(): void;
201
-
202
- type OtlpAnyValue = {
203
- stringValue?: string;
204
- intValue?: string;
205
- doubleValue?: number;
206
- boolValue?: boolean;
207
- arrayValue?: {
208
- values: OtlpAnyValue[];
209
- };
210
- };
211
- type OtlpKeyValue = {
212
- key: string;
213
- value: OtlpAnyValue;
214
- };
215
- declare const SpanStatusCode: {
216
- readonly UNSET: 0;
217
- readonly OK: 1;
218
- readonly ERROR: 2;
219
- };
220
- type OtlpSpanStatus = {
221
- code: (typeof SpanStatusCode)[keyof typeof SpanStatusCode] | number;
222
- message?: string;
223
- };
224
- type OtlpSpan = {
225
- traceId: string;
226
- spanId: string;
227
- parentSpanId?: string;
228
- name: string;
229
- startTimeUnixNano: string;
230
- endTimeUnixNano: string;
231
- attributes?: OtlpKeyValue[];
232
- status?: OtlpSpanStatus;
233
- };
234
- type SpanIds = {
235
- traceIdB64: string;
236
- spanIdB64: string;
237
- parentSpanIdB64?: string;
238
- };
239
297
  type Attachment$1 = {
240
298
  type: string;
241
299
  role: string;
@@ -277,6 +335,9 @@ type SignalInput = {
277
335
  after?: string;
278
336
  };
279
337
  type EventShipperOptions = {
338
+ appGit?: AppGitOptions | false;
339
+ /** Share with the trace shipper so one operation uses one source snapshot. */
340
+ appGitContext?: AppGitContext;
280
341
  writeKey?: string;
281
342
  endpoint?: string;
282
343
  enabled?: boolean;
@@ -308,6 +369,9 @@ type EventShipperOptions = {
308
369
  maxTextFieldChars?: number;
309
370
  };
310
371
  declare class EventShipper$1 {
372
+ private appGitContext;
373
+ private ownsAppGitContext;
374
+ private readonly appGitOwner;
311
375
  private baseUrl;
312
376
  private writeKey?;
313
377
  private enabled;
@@ -338,6 +402,7 @@ declare class EventShipper$1 {
338
402
  /** URL of the local debugger / Workshop daemon, when one is reachable. */
339
403
  private localDebuggerUrl;
340
404
  constructor(opts: EventShipperOptions);
405
+ protected ownAppGitContextForShutdown(): void;
341
406
  isDebugEnabled(): boolean;
342
407
  private authHeaders;
343
408
  private requestHeaders;
@@ -450,6 +515,8 @@ type InternalSpan = {
450
515
  attributes: Array<OtlpKeyValue | undefined>;
451
516
  };
452
517
  type TraceShipperOptions = {
518
+ appGit?: AppGitOptions | false;
519
+ appGitContext?: AppGitContext;
453
520
  writeKey?: string;
454
521
  endpoint?: string;
455
522
  enabled?: boolean;
@@ -518,6 +585,13 @@ type TraceShipperOptions = {
518
585
  maxTextFieldChars?: number;
519
586
  };
520
587
  declare class TraceShipper$1 {
588
+ private appGitContext;
589
+ protected ownsAppGitContext: boolean;
590
+ private readonly appGitOwner;
591
+ private appGitEventIds;
592
+ private appGitActiveSpans;
593
+ private appGitCaptured;
594
+ private appGitAdded;
521
595
  private baseUrl;
522
596
  private writeKey?;
523
597
  private enabled;
@@ -691,6 +765,46 @@ declare function getContextManager(): ContextManager;
691
765
  declare function currentSpan(): ContextSpan;
692
766
  declare function withCurrent<R>(span: ContextSpan, callback: () => R): R;
693
767
 
768
+ /**
769
+ * `ai.prompt.tools`: the tool catalog a model call was given, one JSON
770
+ * document per tool, in the shape the Vercel AI SDK records on its
771
+ * `doGenerate` / `doStream` spans. Every integration emits this attribute on
772
+ * its model-call spans so downstream consumers (agent replay, world builder)
773
+ * can read what the model could call instead of guessing from the calls it
774
+ * happened to make.
775
+ *
776
+ * An absent attribute means the integration could not observe the tool list;
777
+ * an empty array means the model had no tools. Callers who know better than
778
+ * the integration pass a `tools` override, which replaces the inferred list.
779
+ */
780
+ declare const PROMPT_TOOLS_ATTRIBUTE = "ai.prompt.tools";
781
+ type JsonSchema = Record<string, unknown>;
782
+ type FunctionToolDeclaration = {
783
+ type: "function";
784
+ name: string;
785
+ description?: string;
786
+ inputSchema?: JsonSchema;
787
+ };
788
+ type ProviderDefinedToolDeclaration = {
789
+ type: "provider-defined";
790
+ id?: string;
791
+ name: string;
792
+ args?: Record<string, unknown>;
793
+ };
794
+ type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
795
+ /**
796
+ * What callers hand to a `tools` override. The canonical `ToolDeclaration`
797
+ * shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
798
+ * recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
799
+ */
800
+ type ToolDeclarationInput = ToolDeclaration | {
801
+ name: string;
802
+ description?: string;
803
+ inputSchema?: JsonSchema;
804
+ parameters?: JsonSchema;
805
+ };
806
+ type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
807
+
694
808
  declare class EventShipper extends EventShipper$1 {
695
809
  constructor(opts: ConstructorParameters<typeof EventShipper$1>[0]);
696
810
  }
@@ -1044,6 +1158,11 @@ type RaindropTelemetryIntegrationOptions = {
1044
1158
  debug?: boolean;
1045
1159
  /** See {@link SubagentApiOptions.settledEventIds}. */
1046
1160
  settledEventIds?: Set<string>;
1161
+ /**
1162
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
1163
+ * span (replaces the step's tools; `[]` records an empty catalog).
1164
+ */
1165
+ tools?: PromptToolsOverride;
1047
1166
  context?: {
1048
1167
  userId?: string;
1049
1168
  eventId?: string;
@@ -1061,6 +1180,7 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
1061
1180
  private readonly subagentWrapping;
1062
1181
  private readonly debug;
1063
1182
  private readonly defaultContext;
1183
+ private readonly promptTools;
1064
1184
  private readonly callStates;
1065
1185
  /**
1066
1186
  * Per-tool-call snapshot of the parent-tool ALS context taken right
@@ -1523,6 +1643,17 @@ type RaindropAISDKOptions = {
1523
1643
  * resolves to `default` server-side; byte-identical to prior behavior).
1524
1644
  */
1525
1645
  projectId?: string;
1646
+ /** Application Git identity. Auto-detects commit SHA by default; pass `false` to disable. */
1647
+ appGit?: AppGitOptions | false;
1648
+ /**
1649
+ * Share an application Git context with another telemetry feed owned by the
1650
+ * same logical client. When provided, it takes precedence over `appGit`.
1651
+ *
1652
+ * Integration coordinators must stop every feed using the context before
1653
+ * calling this client's `shutdown()`, which disposes the context. Disposal
1654
+ * is idempotent.
1655
+ */
1656
+ appGitContext?: AppGitContext;
1526
1657
  /**
1527
1658
  * Force-enable (or opt out of) Workshop / local-debugger mirroring.
1528
1659
  *
@@ -1719,6 +1850,12 @@ type WrapAISDKOptions = {
1719
1850
  * Default: false (uses Proxy wrapping for backward compatibility).
1720
1851
  */
1721
1852
  nativeTelemetry?: boolean;
1853
+ /**
1854
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
1855
+ * span, replacing the tools the AI SDK hands the model. `[]` records an
1856
+ * explicitly empty catalog.
1857
+ */
1858
+ tools?: PromptToolsOverride;
1722
1859
  };
1723
1860
  /**
1724
1861
  * Opaque handle for a trace span. Pass as `parent` when creating child spans.
@@ -1815,6 +1952,7 @@ type RaindropAISDKClient = {
1815
1952
  createTelemetryIntegration(contextOrOptions?: RaindropTelemetryIntegrationOptions["context"] | {
1816
1953
  context?: RaindropTelemetryIntegrationOptions["context"];
1817
1954
  subagentWrapping?: boolean;
1955
+ tools?: PromptToolsOverride;
1818
1956
  }): RaindropTelemetryIntegration;
1819
1957
  /**
1820
1958
  * Detached sub-agent hand-offs: record a sub-agent that runs in another
@@ -1928,6 +2066,11 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
1928
2066
  * spans nest correctly. Enabled by default.
1929
2067
  */
1930
2068
  subagentWrapping?: boolean;
2069
+ /**
2070
+ * Overrides the tool catalog recorded as `ai.prompt.tools` on every model
2071
+ * span. Use when the integration cannot see the tools the model was given.
2072
+ */
2073
+ tools?: PromptToolsOverride;
1931
2074
  };
1932
2075
  /**
1933
2076
  * One-line factory for the AI SDK v7 `registerTelemetry` DX.
@@ -1962,4 +2105,4 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
1962
2105
  */
1963
2106
  declare function raindrop(options?: RaindropTelemetryOptions): RaindropTelemetryIntegration;
1964
2107
 
1965
- export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, type CarrierHeaders, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, DETACHED_MODE, type DetachedChildLink, type DetachedDispatch, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type FeatureFlagValue, type FeatureFlags, HANDOFF_ATTRIBUTE_PREFIXES, HANDOFF_ATTRIBUTE_SUFFIXES, HANDOFF_TERMINAL_CANCELLED, HANDOFF_TERMINAL_PROPERTY_KEY, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type RaindropTelemetryOptions, SUBAGENT_ABORTED_OUTPUT, SUBAGENT_AGENT_ROLE, SUBAGENT_CANCELLED_OUTPUT, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, SubagentApi, type SubagentDispatch, type SubagentDispatchOptions, type SubagentResumeOptions, type SubagentRun, type SubagentRunMetadata, TOOL_EVENTS_ALLOW, TRUNCATION_MARKER, type TraceCarrier, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, fromHeaders, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, resetUnresolvedCarrierWarning, runWithParentToolContext, runWithRaindropCallMetadata, toHeaders, toLangSmithHeaders, withCurrent };
2108
+ export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, type CarrierHeaders, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, DETACHED_MODE, type DetachedChildLink, type DetachedDispatch, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type FeatureFlagValue, type FeatureFlags, HANDOFF_ATTRIBUTE_PREFIXES, HANDOFF_ATTRIBUTE_SUFFIXES, HANDOFF_TERMINAL_CANCELLED, HANDOFF_TERMINAL_PROPERTY_KEY, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, PROMPT_TOOLS_ATTRIBUTE, type ParentToolContext, type PromptToolsOverride, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type RaindropTelemetryOptions, SUBAGENT_ABORTED_OUTPUT, SUBAGENT_AGENT_ROLE, SUBAGENT_CANCELLED_OUTPUT, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, SubagentApi, type SubagentDispatch, type SubagentDispatchOptions, type SubagentResumeOptions, type SubagentRun, type SubagentRunMetadata, TOOL_EVENTS_ALLOW, TRUNCATION_MARKER, type ToolDeclaration, type TraceCarrier, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, fromHeaders, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, resetUnresolvedCarrierWarning, runWithParentToolContext, runWithRaindropCallMetadata, toHeaders, toLangSmithHeaders, withCurrent };