@raindrop-ai/ai-sdk 0.3.1 → 0.3.3
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/README.md +26 -0
- package/dist/{chunk-SGSAYTKI.mjs → chunk-MCRACPKM.mjs} +1274 -422
- package/dist/{index-BqXHiknB.d.mts → index-B_mpeckV.d.mts} +123 -38
- package/dist/{index-BqXHiknB.d.ts → index-B_mpeckV.d.ts} +123 -38
- package/dist/index.browser.d.mts +123 -38
- package/dist/index.browser.d.ts +123 -38
- package/dist/index.browser.js +1131 -424
- package/dist/index.browser.mjs +1131 -424
- package/dist/index.node.d.mts +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +1274 -422
- package/dist/index.node.mjs +1 -1
- package/dist/index.workers.d.mts +1 -1
- package/dist/index.workers.d.ts +1 -1
- package/dist/index.workers.js +1274 -422
- package/dist/index.workers.mjs +1 -1
- package/package.json +2 -2
package/dist/index.browser.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1523,6 +1597,17 @@ type RaindropAISDKOptions = {
|
|
|
1523
1597
|
* resolves to `default` server-side; byte-identical to prior behavior).
|
|
1524
1598
|
*/
|
|
1525
1599
|
projectId?: string;
|
|
1600
|
+
/** Application Git identity. Auto-detects commit SHA by default; pass `false` to disable. */
|
|
1601
|
+
appGit?: AppGitOptions | false;
|
|
1602
|
+
/**
|
|
1603
|
+
* Share an application Git context with another telemetry feed owned by the
|
|
1604
|
+
* same logical client. When provided, it takes precedence over `appGit`.
|
|
1605
|
+
*
|
|
1606
|
+
* Integration coordinators must stop every feed using the context before
|
|
1607
|
+
* calling this client's `shutdown()`, which disposes the context. Disposal
|
|
1608
|
+
* is idempotent.
|
|
1609
|
+
*/
|
|
1610
|
+
appGitContext?: AppGitContext;
|
|
1526
1611
|
/**
|
|
1527
1612
|
* Force-enable (or opt out of) Workshop / local-debugger mirroring.
|
|
1528
1613
|
*
|