raindrop-ai 1.0.5 → 1.0.6

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.
@@ -82,6 +82,80 @@ type HeaderLookup = {
82
82
  get(name: string): string | null | undefined;
83
83
  };
84
84
  type CarrierHeaders = Readonly<Record<string, string | string[] | undefined>> | HeaderLookup;
85
+
86
+ /**
87
+ * What `flush()` / `shutdown()` resolve to (CONTRACT 1.2.1). Safe to ignore:
88
+ * they never reject, and ignoring the result changes nothing.
89
+ *
90
+ * `delivered` is true when everything enqueued before the call was handed to
91
+ * ingest. A payload ingest rejected permanently (a non-429, non-408 4xx)
92
+ * counts as delivered: ingest saw it and refused it.
93
+ */
94
+ type FlushResult = {
95
+ delivered: boolean;
96
+ /** The call returned at its deadline with work outstanding. */
97
+ timedOut: boolean;
98
+ /** Payloads given up on: cut off mid-flight at the deadline, retries ran out, or left at shutdown. */
99
+ dropped: number;
100
+ /** Payloads still queued for a later send (never sent, or waiting on a retry or Retry-After pause). */
101
+ queued: number;
102
+ /**
103
+ * Sends started before the call and still running at its deadline. They are
104
+ * cut off then: a request in flight is dropped (not resent), and one waiting
105
+ * to retry goes back to its queue.
106
+ */
107
+ inFlight: number;
108
+ };
109
+ /**
110
+ * `FlushResult` as the declared return of public `flush()`/`shutdown()`
111
+ * methods. The `void &` keeps `Promise<FlushResultCompat>` assignable to
112
+ * `Promise<void>`, so code that typed these methods as returning
113
+ * `Promise<void>` (interfaces, callbacks) keeps compiling, while callers can
114
+ * still read the result's fields.
115
+ */
116
+ type FlushResultCompat = void & FlushResult;
117
+
118
+ /** Payload kinds a field map can name: event items on `events/track` and
119
+ * `events/track_partial`, `signals/track` items and `users/identify` items. */
120
+ type PiiPayloadKind = "event" | "signal" | "identify";
121
+ /** Extra fields to redact, per payload kind (CONTRACT 11.2). */
122
+ type PiiFieldMap = {
123
+ [K in PiiPayloadKind]?: readonly string[];
124
+ };
125
+ type Attachment$1 = {
126
+ type: string;
127
+ role: string;
128
+ name?: string;
129
+ value: string;
130
+ };
131
+ type EventUsage = {
132
+ promptTokens?: number;
133
+ completionTokens?: number;
134
+ };
135
+ type Patch = {
136
+ eventName?: string;
137
+ userId?: string;
138
+ convoId?: string;
139
+ input?: string;
140
+ output?: string;
141
+ model?: string;
142
+ usage?: EventUsage;
143
+ error?: unknown;
144
+ properties?: Record<string, unknown>;
145
+ /**
146
+ * Properties the integrator supplied (setup defaults, per-call context, the
147
+ * manual events API), as opposed to keys an integration derives itself. On a
148
+ * key clash these win over `properties` and over the keys derived from
149
+ * `usage` / `error`, whatever order the updates are sent in (wrapper profile
150
+ * W6). Sent inside the event's `properties`; this is not a wire field.
151
+ */
152
+ callerProperties?: Record<string, unknown>;
153
+ featureFlags?: Record<string, string>;
154
+ attachments?: Attachment$1[];
155
+ isPending?: boolean;
156
+ timestamp?: string;
157
+ };
158
+ type ResumeOptions = Pick<Patch, "userId" | "convoId" | "eventName">;
85
159
  type LocalDebuggerLiveEventType = "text_delta" | "reasoning_delta" | "tool_start" | "tool_result" | "status";
86
160
  type LocalDebuggerLiveEventInput$1 = {
87
161
  traceId: string;
@@ -456,7 +530,8 @@ type BeginParams = PartialAiTrackEvent & {
456
530
  tools?: PromptToolsOverride;
457
531
  };
458
532
  type FinishInteractionOptions = Omit<PartialAiTrackEvent, "eventId"> & {
459
- output: string;
533
+ /** Optional: an interaction may finish without an output (CONTRACT §10.2). */
534
+ output?: string;
460
535
  eventId?: string;
461
536
  };
462
537
  /**
@@ -528,8 +603,8 @@ interface ToolParams {
528
603
  * @property startTime - Optional start time of the tool execution
529
604
  * @property error - Optional error if the tool failed
530
605
  * @property properties - Optional key-value pairs for additional metadata
531
- * @property traceId - Optional W3C trace ID override for bypassOtelForTools mode
532
- * @property parentSpanId - Optional W3C parent span ID override for bypassOtelForTools mode
606
+ * @property traceId - Optional saved parent: W3C trace ID (hex), used with `parentSpanId`
607
+ * @property parentSpanId - Optional saved parent: W3C span ID (hex) the tool span is parented to
533
608
  */
534
609
  interface TrackToolParams {
535
610
  name: string;
@@ -537,6 +612,8 @@ interface TrackToolParams {
537
612
  output?: unknown;
538
613
  durationMs?: number;
539
614
  startTime?: Date | number;
615
+ /** When the tool finished; an alternative to `durationMs` (wins when both are given). */
616
+ endTime?: Date | number;
540
617
  error?: Error | string;
541
618
  properties?: Record<string, string>;
542
619
  traceId?: string;
@@ -20365,6 +20442,7 @@ declare const EvalContextSchema: z$1.ZodObject<{
20365
20442
  }>>;
20366
20443
  rowMetadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodString>;
20367
20444
  }, "strip", z$1.ZodTypeAny, {
20445
+ rowMetadata: Record<string, string>;
20368
20446
  trace: {
20369
20447
  event: {
20370
20448
  properties: Record<string, unknown> | null;
@@ -20999,7 +21077,6 @@ declare const EvalContextSchema: z$1.ZodObject<{
20999
21077
  } | undefined;
21000
21078
  } | undefined;
21001
21079
  };
21002
- rowMetadata: Record<string, string>;
21003
21080
  referenceTrace?: {
21004
21081
  event: {
21005
21082
  properties: Record<string, unknown> | null;
@@ -21636,6 +21713,7 @@ declare const EvalContextSchema: z$1.ZodObject<{
21636
21713
  } | undefined;
21637
21714
  expectedOutput?: JsonValue | undefined;
21638
21715
  }, {
21716
+ rowMetadata: Record<string, string>;
21639
21717
  trace: {
21640
21718
  event: {
21641
21719
  properties: Record<string, unknown> | null;
@@ -22270,7 +22348,6 @@ declare const EvalContextSchema: z$1.ZodObject<{
22270
22348
  } | undefined;
22271
22349
  } | undefined;
22272
22350
  };
22273
- rowMetadata: Record<string, string>;
22274
22351
  referenceTrace?: {
22275
22352
  event: {
22276
22353
  properties: Record<string, unknown> | null;
@@ -27390,6 +27467,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
27390
27467
  name: string;
27391
27468
  id: string;
27392
27469
  output?: JsonValue | undefined;
27470
+ expectation?: {
27471
+ description: string;
27472
+ reference?: string | undefined;
27473
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
27474
+ } | undefined;
27393
27475
  referenceTrace?: {
27394
27476
  event: {
27395
27477
  properties: Record<string, unknown> | null;
@@ -27793,11 +27875,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
27793
27875
  sourceEventId: string;
27794
27876
  sourceEventTimestamp?: string | undefined;
27795
27877
  } | undefined;
27796
- expectation?: {
27797
- description: string;
27798
- reference?: string | undefined;
27799
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
27800
- } | undefined;
27801
27878
  expectedVerdict?: {
27802
27879
  pass: boolean;
27803
27880
  } | {
@@ -27811,6 +27888,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
27811
27888
  name: string;
27812
27889
  id: string;
27813
27890
  output?: JsonValue | undefined;
27891
+ expectation?: {
27892
+ description: string;
27893
+ reference?: string | undefined;
27894
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
27895
+ } | undefined;
27814
27896
  referenceTrace?: {
27815
27897
  event: {
27816
27898
  properties: Record<string, unknown> | null;
@@ -28214,11 +28296,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
28214
28296
  sourceEventId: string;
28215
28297
  sourceEventTimestamp?: string | undefined;
28216
28298
  } | undefined;
28217
- expectation?: {
28218
- description: string;
28219
- reference?: string | undefined;
28220
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
28221
- } | undefined;
28222
28299
  expectedVerdict?: {
28223
28300
  pass: boolean;
28224
28301
  } | {
@@ -28232,6 +28309,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
28232
28309
  name: string;
28233
28310
  id: string;
28234
28311
  output?: JsonValue | undefined;
28312
+ expectation?: {
28313
+ description: string;
28314
+ reference?: string | undefined;
28315
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
28316
+ } | undefined;
28235
28317
  referenceTrace?: {
28236
28318
  event: {
28237
28319
  properties: Record<string, unknown> | null;
@@ -28635,11 +28717,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
28635
28717
  sourceEventId: string;
28636
28718
  sourceEventTimestamp?: string | undefined;
28637
28719
  } | undefined;
28638
- expectation?: {
28639
- description: string;
28640
- reference?: string | undefined;
28641
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
28642
- } | undefined;
28643
28720
  expectedVerdict?: {
28644
28721
  pass: boolean;
28645
28722
  } | {
@@ -28653,6 +28730,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
28653
28730
  name: string;
28654
28731
  id: string;
28655
28732
  output?: JsonValue | undefined;
28733
+ expectation?: {
28734
+ description: string;
28735
+ reference?: string | undefined;
28736
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
28737
+ } | undefined;
28656
28738
  referenceTrace?: {
28657
28739
  event: {
28658
28740
  properties: Record<string, unknown> | null;
@@ -29056,11 +29138,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
29056
29138
  sourceEventId: string;
29057
29139
  sourceEventTimestamp?: string | undefined;
29058
29140
  } | undefined;
29059
- expectation?: {
29060
- description: string;
29061
- reference?: string | undefined;
29062
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
29063
- } | undefined;
29064
29141
  expectedVerdict?: {
29065
29142
  pass: boolean;
29066
29143
  } | {
@@ -29080,6 +29157,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
29080
29157
  name: string;
29081
29158
  id: string;
29082
29159
  output?: JsonValue | undefined;
29160
+ expectation?: {
29161
+ description: string;
29162
+ reference?: string | undefined;
29163
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
29164
+ } | undefined;
29083
29165
  referenceTrace?: {
29084
29166
  event: {
29085
29167
  properties: Record<string, unknown> | null;
@@ -29483,11 +29565,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
29483
29565
  sourceEventId: string;
29484
29566
  sourceEventTimestamp?: string | undefined;
29485
29567
  } | undefined;
29486
- expectation?: {
29487
- description: string;
29488
- reference?: string | undefined;
29489
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
29490
- } | undefined;
29491
29568
  expectedVerdict?: {
29492
29569
  pass: boolean;
29493
29570
  } | {
@@ -29507,6 +29584,11 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
29507
29584
  name: string;
29508
29585
  id: string;
29509
29586
  output?: JsonValue | undefined;
29587
+ expectation?: {
29588
+ description: string;
29589
+ reference?: string | undefined;
29590
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
29591
+ } | undefined;
29510
29592
  referenceTrace?: {
29511
29593
  event: {
29512
29594
  properties: Record<string, unknown> | null;
@@ -29910,11 +29992,6 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
29910
29992
  sourceEventId: string;
29911
29993
  sourceEventTimestamp?: string | undefined;
29912
29994
  } | undefined;
29913
- expectation?: {
29914
- description: string;
29915
- reference?: string | undefined;
29916
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
29917
- } | undefined;
29918
29995
  expectedVerdict?: {
29919
29996
  pass: boolean;
29920
29997
  } | {
@@ -34396,6 +34473,11 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
34396
34473
  name: string;
34397
34474
  id: string;
34398
34475
  output?: JsonValue | undefined;
34476
+ expectation?: {
34477
+ description: string;
34478
+ reference?: string | undefined;
34479
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
34480
+ } | undefined;
34399
34481
  referenceTrace?: {
34400
34482
  event: {
34401
34483
  properties: Record<string, unknown> | null;
@@ -34799,11 +34881,6 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
34799
34881
  sourceEventId: string;
34800
34882
  sourceEventTimestamp?: string | undefined;
34801
34883
  } | undefined;
34802
- expectation?: {
34803
- description: string;
34804
- reference?: string | undefined;
34805
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
34806
- } | undefined;
34807
34884
  expectedVerdict?: {
34808
34885
  pass: boolean;
34809
34886
  } | {
@@ -34818,6 +34895,11 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
34818
34895
  name: string;
34819
34896
  id: string;
34820
34897
  output?: JsonValue | undefined;
34898
+ expectation?: {
34899
+ description: string;
34900
+ reference?: string | undefined;
34901
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
34902
+ } | undefined;
34821
34903
  referenceTrace?: {
34822
34904
  event: {
34823
34905
  properties: Record<string, unknown> | null;
@@ -35221,11 +35303,6 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
35221
35303
  sourceEventId: string;
35222
35304
  sourceEventTimestamp?: string | undefined;
35223
35305
  } | undefined;
35224
- expectation?: {
35225
- description: string;
35226
- reference?: string | undefined;
35227
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
35228
- } | undefined;
35229
35306
  expectedVerdict?: {
35230
35307
  pass: boolean;
35231
35308
  } | {
@@ -39746,16 +39823,16 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
39746
39823
  name: string;
39747
39824
  id: string;
39748
39825
  output?: JsonValue | undefined;
39749
- referenceCapture?: {
39750
- id: string;
39751
- sourceEventId: string;
39752
- sourceEventTimestamp?: string | undefined;
39753
- } | undefined;
39754
39826
  expectation?: {
39755
39827
  description: string;
39756
39828
  reference?: string | undefined;
39757
39829
  basis?: "code" | "human" | "policy" | "inferred" | undefined;
39758
39830
  } | undefined;
39831
+ referenceCapture?: {
39832
+ id: string;
39833
+ sourceEventId: string;
39834
+ sourceEventTimestamp?: string | undefined;
39835
+ } | undefined;
39759
39836
  expectedVerdict?: {
39760
39837
  pass: boolean;
39761
39838
  } | {
@@ -39770,16 +39847,16 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
39770
39847
  name: string;
39771
39848
  id: string;
39772
39849
  output?: JsonValue | undefined;
39773
- referenceCapture?: {
39774
- id: string;
39775
- sourceEventId: string;
39776
- sourceEventTimestamp?: string | undefined;
39777
- } | undefined;
39778
39850
  expectation?: {
39779
39851
  description: string;
39780
39852
  reference?: string | undefined;
39781
39853
  basis?: "code" | "human" | "policy" | "inferred" | undefined;
39782
39854
  } | undefined;
39855
+ referenceCapture?: {
39856
+ id: string;
39857
+ sourceEventId: string;
39858
+ sourceEventTimestamp?: string | undefined;
39859
+ } | undefined;
39783
39860
  expectedVerdict?: {
39784
39861
  pass: boolean;
39785
39862
  } | {
@@ -39802,16 +39879,16 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
39802
39879
  name: string;
39803
39880
  id: string;
39804
39881
  output?: JsonValue | undefined;
39805
- referenceCapture?: {
39806
- id: string;
39807
- sourceEventId: string;
39808
- sourceEventTimestamp?: string | undefined;
39809
- } | undefined;
39810
39882
  expectation?: {
39811
39883
  description: string;
39812
39884
  reference?: string | undefined;
39813
39885
  basis?: "code" | "human" | "policy" | "inferred" | undefined;
39814
39886
  } | undefined;
39887
+ referenceCapture?: {
39888
+ id: string;
39889
+ sourceEventId: string;
39890
+ sourceEventTimestamp?: string | undefined;
39891
+ } | undefined;
39815
39892
  expectedVerdict?: {
39816
39893
  pass: boolean;
39817
39894
  } | {
@@ -39841,16 +39918,16 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
39841
39918
  name: string;
39842
39919
  id: string;
39843
39920
  output?: JsonValue | undefined;
39844
- referenceCapture?: {
39845
- id: string;
39846
- sourceEventId: string;
39847
- sourceEventTimestamp?: string | undefined;
39848
- } | undefined;
39849
39921
  expectation?: {
39850
39922
  description: string;
39851
39923
  reference?: string | undefined;
39852
39924
  basis?: "code" | "human" | "policy" | "inferred" | undefined;
39853
39925
  } | undefined;
39926
+ referenceCapture?: {
39927
+ id: string;
39928
+ sourceEventId: string;
39929
+ sourceEventTimestamp?: string | undefined;
39930
+ } | undefined;
39854
39931
  expectedVerdict?: {
39855
39932
  pass: boolean;
39856
39933
  } | {
@@ -64096,6 +64173,7 @@ declare const EvalCaseTracePairSchema: z.ZodObject<{
64096
64173
  };
64097
64174
  };
64098
64175
  output?: JsonValue | undefined;
64176
+ rowMetadata?: Record<string, string> | undefined;
64099
64177
  reference?: {
64100
64178
  trace: {
64101
64179
  event: {
@@ -65130,7 +65208,6 @@ declare const EvalCaseTracePairSchema: z.ZodObject<{
65130
65208
  }[];
65131
65209
  } | undefined;
65132
65210
  } | undefined;
65133
- rowMetadata?: Record<string, string> | undefined;
65134
65211
  }, {
65135
65212
  caseId: string;
65136
65213
  candidate: {
@@ -66168,6 +66245,7 @@ declare const EvalCaseTracePairSchema: z.ZodObject<{
66168
66245
  };
66169
66246
  };
66170
66247
  output?: JsonValue | undefined;
66248
+ rowMetadata?: Record<string, string> | undefined;
66171
66249
  reference?: {
66172
66250
  trace: {
66173
66251
  event: {
@@ -67202,7 +67280,6 @@ declare const EvalCaseTracePairSchema: z.ZodObject<{
67202
67280
  }[];
67203
67281
  } | undefined;
67204
67282
  } | undefined;
67205
- rowMetadata?: Record<string, string> | undefined;
67206
67283
  }>;
67207
67284
  type EvalCaseTracePair = z.infer<typeof EvalCaseTracePairSchema>;
67208
67285
 
@@ -73018,6 +73095,11 @@ declare const EvalDatasetRowInputSchema: z.ZodObject<{
73018
73095
  name: string;
73019
73096
  id: string;
73020
73097
  output?: JsonValue | undefined;
73098
+ expectation?: {
73099
+ description: string;
73100
+ reference?: string | undefined;
73101
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
73102
+ } | undefined;
73021
73103
  referenceTrace?: {
73022
73104
  event: {
73023
73105
  properties: Record<string, unknown> | null;
@@ -73421,11 +73503,6 @@ declare const EvalDatasetRowInputSchema: z.ZodObject<{
73421
73503
  sourceEventId: string;
73422
73504
  sourceEventTimestamp?: string | undefined;
73423
73505
  } | undefined;
73424
- expectation?: {
73425
- description: string;
73426
- reference?: string | undefined;
73427
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
73428
- } | undefined;
73429
73506
  expectedVerdict?: {
73430
73507
  pass: boolean;
73431
73508
  } | {
@@ -73439,6 +73516,11 @@ declare const EvalDatasetRowInputSchema: z.ZodObject<{
73439
73516
  name: string;
73440
73517
  id: string;
73441
73518
  output?: JsonValue | undefined;
73519
+ expectation?: {
73520
+ description: string;
73521
+ reference?: string | undefined;
73522
+ basis?: "code" | "human" | "policy" | "inferred" | undefined;
73523
+ } | undefined;
73442
73524
  referenceTrace?: {
73443
73525
  event: {
73444
73526
  properties: Record<string, unknown> | null;
@@ -73842,11 +73924,6 @@ declare const EvalDatasetRowInputSchema: z.ZodObject<{
73842
73924
  sourceEventId: string;
73843
73925
  sourceEventTimestamp?: string | undefined;
73844
73926
  } | undefined;
73845
- expectation?: {
73846
- description: string;
73847
- reference?: string | undefined;
73848
- basis?: "code" | "human" | "policy" | "inferred" | undefined;
73849
- } | undefined;
73850
73927
  expectedVerdict?: {
73851
73928
  pass: boolean;
73852
73929
  } | {
@@ -74541,9 +74618,24 @@ interface AnalyticsConfig {
74541
74618
  apiKey?: string;
74542
74619
  bufferSize?: number;
74543
74620
  bufferTimeout?: number;
74621
+ /**
74622
+ * Deadline in ms for `forceFlush()` and `close()`, retries and Retry-After
74623
+ * waits included (default 10,000; CONTRACT 1.2.1). At the deadline
74624
+ * `forceFlush()` returns: payloads not yet sent stay queued for later, and a
74625
+ * request cut off mid-flight is not resent. `close()` drops what is left.
74626
+ */
74627
+ flushTimeoutMs?: number;
74544
74628
  debugLogs?: boolean;
74545
74629
  endpoint?: string;
74546
74630
  redactPii?: boolean;
74631
+ /**
74632
+ * More fields to redact when `redactPii` is on, per payload kind, as wire
74633
+ * field paths: `{ event: ["properties.customer.email", "attachments[].value"],
74634
+ * signal: ["comment"], identify: ["traits.email"] }`. Adds to the default
74635
+ * `ai_data.input` and `ai_data.output` and never removes them; applied when a
74636
+ * payload is sent (CONTRACT 11.2).
74637
+ */
74638
+ redactPiiFields?: PiiFieldMap;
74547
74639
  /**
74548
74640
  * Per-field character cap applied to ai input/output and serialized
74549
74641
  * tool/span content BEFORE buffering or serialization, so oversized
@@ -74690,6 +74782,11 @@ interface AnalyticsConfig {
74690
74782
  mcp?: unknown;
74691
74783
  } & Record<string, unknown>;
74692
74784
  }
74785
+ /**
74786
+ * @deprecated No longer used: the SDK imposes no client-side payload cap and
74787
+ * leaves size limits to the server (harness CONTRACT §15.1). Kept so existing
74788
+ * imports keep compiling.
74789
+ */
74693
74790
  declare const MAX_INGEST_SIZE_BYTES: number;
74694
74791
  /**
74695
74792
  * Resolve the effective `disableBatching` flag that decides whether tracing
@@ -74725,16 +74822,18 @@ declare class Raindrop {
74725
74822
  private bufferSize;
74726
74823
  private bufferTimeout;
74727
74824
  private flushTimer;
74825
+ private inFlightBatches;
74826
+ /** Cuts off batch sends still running at a forceFlush or close deadline. */
74827
+ private readonly cutOff;
74828
+ private flushTimeoutMs;
74728
74829
  private redactPii;
74830
+ private piiFields;
74729
74831
  private disabled;
74730
74832
  private context;
74731
74833
  private _tracing;
74732
74834
  private localDebuggerUrlOpt;
74733
74835
  private awaitSpanFlushOpt;
74734
- private partialEventBuffer;
74735
- private partialEventTimeouts;
74736
- private inFlightRequests;
74737
- private inFlightByEvent;
74836
+ private eventShipper;
74738
74837
  private maxTextFieldChars;
74739
74838
  private projectId;
74740
74839
  private authHint;
@@ -74837,7 +74936,7 @@ declare class Raindrop {
74837
74936
  * @param eventId - The ID of the interaction to resume.
74838
74937
  * @returns The interaction object.
74839
74938
  */
74840
- resumeInteraction(eventId: string): Interaction;
74939
+ resumeInteraction(eventId: string, options?: ResumeOptions): Interaction;
74841
74940
  /**
74842
74941
  * Opens the child's own event for a launched detached sub-agent.
74843
74942
  *
@@ -74944,55 +75043,51 @@ declare class Raindrop {
74944
75043
  */
74945
75044
  selfDiagnose(options: SelfDiagnoseOptions): void;
74946
75045
  trackSignal(signal: SignalEvent | SignalEvent[]): void | void[];
74947
- private getSize;
74948
75046
  private saveToBuffer;
75047
+ /**
75048
+ * Send the buffered track/identify/signal batches. With a deadline (a
75049
+ * forceFlush or close), a batch not sent before it is put back at the front
75050
+ * of the buffer for a later send (outside close).
75051
+ */
74949
75052
  private flush;
75053
+ /** Put a batch a deadline deferred back at the front of the buffer and send it later. */
75054
+ private requeueBatch;
74950
75055
  private mirrorBatchToLocalDebugger;
74951
75056
  /**
74952
- * Attempts/timeout budget for one POST, honoring the close() deadline.
74953
- * Returns `null` when the shutdown budget is exhausted — the caller must
74954
- * drop the payload instead of issuing a request that could outlive
74955
- * process exit. Checked fresh on every send so a deadline that expires
74956
- * mid-drain takes effect immediately.
75057
+ * Retry/timeout options for one POST. During close(), sends retry within its
75058
+ * window; a forceFlush passes its own deadline. `null` once the close()
75059
+ * window is spent (the caller drops the payload). After close() returns,
75060
+ * stragglers get a single short attempt.
74957
75061
  */
74958
- private requestBudget;
75062
+ private requestOpts;
75063
+ private scheduleFor;
74959
75064
  private warnShutdownDrop;
74960
75065
  private sendBatchToApi;
74961
75066
  private getContext;
74962
75067
  private formatZodError;
74963
- /**
74964
- * Deeply merges properties of the source object into the target object.
74965
- * Modifies the target object in place. Handles nested plain objects.
74966
- */
74967
- private deepMergeObjects;
74968
75068
  /**
74969
75069
  * Internal method for tracking partial AI events. use .begin() to start an interaction instead.
74970
75070
  *
75071
+ * Partial events are buffered, merged and sent by the shared core
75072
+ * `EventShipper` (one implementation for every JS SDK): updates for an event
75073
+ * are merged for up to 2 s, sent in order, and the event's start time is
75074
+ * sent as its timestamp. Usage is not sent here; it goes out as a model span.
75075
+ *
74971
75076
  * @param event - The PartialAiTrackEvent, requires eventId.
74972
75077
  */
74973
75078
  _trackAiPartial(event: PartialAiTrackEvent): Promise<void>;
74974
- /**
74975
- * Flushes a single accumulated partial event by its ID.
74976
- * This is called internally by the timeout or by the close method.
74977
- * @param eventId - The ID of the partial event to flush.
74978
- */
74979
- private flushPartialEvent;
74980
- /**
74981
- * Internal implementation of flushPartialEvent without request tracking.
74982
- * @param eventId - The ID of the partial event to flush.
74983
- */
74984
- private _flushPartialEventInternal;
74985
- /**
74986
- * Sends a single prepared event object to the 'events/track_partial' endpoint.
74987
- * @param event - The event data conforming to ClientAiTrack schema.
74988
- */
74989
- private sendPartialEvent;
74990
75079
  /**
74991
75080
  * Best-effort flush of in-flight OTel spans and pending partial-event POSTs.
74992
75081
  * Safe to call multiple times; never throws.
74993
75082
  */
74994
- forceFlush(): Promise<void>;
74995
- close(): Promise<void>;
75083
+ forceFlush(): Promise<FlushResultCompat>;
75084
+ /**
75085
+ * Flush everything within `flushTimeoutMs` and stop. Resolves, never
75086
+ * rejects, to the combined delivery result of batches, spans and partial
75087
+ * events (CONTRACT 1.2.1); leftovers at the deadline are dropped with a
75088
+ * warning. Ignoring the result is fine.
75089
+ */
75090
+ close(): Promise<FlushResultCompat>;
74996
75091
  private closeWithinDeadline;
74997
75092
  }
74998
75093
 
@@ -75004,5 +75099,5 @@ declare const EVAL_CORRELATION_ID_ATTRIBUTE: "raindrop.eval_correlation_id";
75004
75099
  declare const currentEvalScope: () => EvalScope | undefined;
75005
75100
  declare const withEvalScope: <Result>(scope: EvalScope, callback: () => Result) => Result;
75006
75101
 
75007
- export { DEFAULT_EVAL_POLL_INTERVAL_MS as D, EVAL_CORRELATION_ID_ATTRIBUTE as E, EvalDatasetPublishConflictError as H, EvalDatasetRowInputSchema as K, EvalParameterError as Q, Raindrop as R, EvalPublishError as Y, ReplayResultRowSchema as a$, EvalSuiteManifestSchema as a4, ReplayCountsSchema as aN, ReplayEvaluatorCountsSchema as aQ, ReplayEvaluatorStatsSchema as aS, ReplayEvaluatorSummarySchema as aU, LocalBooleanVerdictSchema as ad, LocalNumberVerdictSchema as ai, LocalPreferenceVerdictSchema as ak, LocalScoreVerdictSchema as am, LocalVerdictSchema as ao, MAX_EVAL_STATUS_RETRIES as ap, MAX_INGEST_SIZE_BYTES as aq, NumericThresholdSchema as as, withEvalScope as b$, ReplayVerdictSchema as b3, defineLocalEvaluator as bA, evaluateEvalRun as bB, evaluatePortableEvaluator as bC, evaluateReplay as bD, formatTrace as bE, importPortableEvaluator as bF, isEvalDataset as bG, isEvalSuiteDefinition as bH, isPublishedEvalSuite as bI, loadEvalSnapshot as bJ, projectWorkshopTrace as bK, publishEvalDataset as bL, publishEvalSuite as bM, pullEval as bN, readEvalDataset as bO, readEvalManifest as bP, readEvalRun as bQ, readEvaluator as bR, readReplay as bS, replay as bT, resolveDisableBatching as bU, runEvalSuite as bV, runReplay as bW, traceOutput as bX, traceToolCalls as bY, traceTools as bZ, verifyPortableEvalArtifact as b_, TraceSchema as bn, claimReplay as bq, compareEvalRuns as br, createEvalHandler as bs, createEvalSuiteRun as bt, createReplay as bu, currentEvalScope as bv, defineAgent as bw, defineDataset as bx, defineEvalSuite as by, defineEvaluatorProgram as bz, BooleanThresholdSchema as m, DEFAULT_EVAL_WAIT_MS as p, DEFAULT_QUERY_URL as q, DEFAULT_TRACE_WAIT_MS as r, EvalContextSchema as y };
75008
- export type { EvalRunReading as $, AiTrackUsage as A, BeginParams as B, CarrierHeaders as C, EvalDatasetInput as F, EvalDatasetManifest as G, InitializeOptions as I, EvalDatasetRowInput as J, EvalDestination as L, EvalEvaluator as M, EvalHandlerOptions as N, EvalLocalEvaluator as O, EvalManifest as P, SpanProcessorOptions as S, TraceCarrier as T, EvalParameterField as U, EvalParameterFields as V, EvalParameters as W, EvalProgram as X, EvalRowResult as Z, EvalRowTracePair as _, RaindropSpanProcessor as a, EvalScope as a0, EvalSuiteDefinition as a1, EvalSuiteDefinitionInput as a2, EvalSuiteManifest as a3, EvalSuiteResult as a5, EvalSuiteRunSession as a6, EvalVerdictAssessment as a7, EvaluateReplayOptions as a8, FinishInteractionOptions as a9, PortableJudgeVerdict as aA, PublishEvalDatasetOptions as aB, PublishEvalSuiteOptions as aC, PullEvalOptions as aD, PulledEvalSnapshot as aE, RaindropConnection as aF, RaindropFeatureFlagValue as aG, RaindropFeatureFlags as aH, RaindropProperties as aI, RaindropPropertyLeaf as aJ, RaindropPropertyValue as aK, ReplayClient as aL, ReplayCounts as aM, ReplayEvaluator as aO, ReplayEvaluatorCounts as aP, ReplayEvaluatorStats as aR, ReplayEvaluatorSummary as aT, ReplayHandle as aV, LocalEvaluatorContext$1 as aW, ReplayOptions as aX, ReplayReading as aY, ReplayResult as aZ, ReplayResultRow as a_, HostedEvaluatorPin as aa, IdentifyEvent as ab, LocalBooleanVerdict as ac, LocalDebuggerLiveEventInput as ae, LocalEvaluator as af, LocalEvaluatorContext as ag, LocalNumberVerdict as ah, LocalPreferenceVerdict as aj, LocalScoreVerdict as al, LocalVerdict as an, NumericThreshold as ar, PartialAiTrackEvent as at, PortableEvalArtifact as au, PortableEvalLimits as av, PortableEvalOutcome as aw, PortableEvalResult as ax, PortableEvaluator as ay, PortableJudgeRequest as az, Interaction as b, ReplayRow as b0, ReplayRowOutcome as b1, ReplayVerdict as b2, RunEvalSuiteOptions as b4, RunReplayOptions as b5, SelfDiagnoseOptions as b6, SelfDiagnosticsExecuteContext as b7, SelfDiagnosticsExecuteResult as b8, SelfDiagnosticsSignalDefinition as b9, SelfDiagnosticsSignalDefinitions as ba, SelfDiagnosticsTool as bb, SelfDiagnosticsToolInputSchema as bc, SelfDiagnosticsToolOptions as bd, SignalEvent as be, SpanParams as bf, SubagentDispatch as bg, SubagentDispatchOptions as bh, SubagentFinishOptions as bi, ToolParams as bj, ToolSpan as bk, Trace as bl, TraceContext as bm, TrackToolParams as bo, WorkflowParams as bp, AppGitSnapshot as c, SubagentResumeOptions as d, SubagentRun as e, Tracer as f, AiTrackEvent as g, AppGitOptions as h, Attachment as i, AttachmentType as j, BeginInteractionOptions as k, BooleanThreshold as l, CreateEvalSuiteRunOptions as n, CreateReplayOptions as o, DefinedEvalAgent as s, DefinedEvalDataset as t, EvalAgentDefinition as u, EvalAgentExecution as v, EvalClient as w, EvalContext as x, EvalDataset as z };
75102
+ export { DEFAULT_EVAL_POLL_INTERVAL_MS as D, EVAL_CORRELATION_ID_ATTRIBUTE as E, EvalDatasetPublishConflictError as K, EvalDatasetRowInputSchema as M, Raindrop as R, EvalParameterError as V, EvalPublishError as _, EvalSuiteManifestSchema as a6, ReplayCountsSchema as aP, ReplayEvaluatorCountsSchema as aS, ReplayEvaluatorStatsSchema as aU, ReplayEvaluatorSummarySchema as aW, LocalBooleanVerdictSchema as af, LocalNumberVerdictSchema as ak, LocalPreferenceVerdictSchema as am, LocalScoreVerdictSchema as ao, LocalVerdictSchema as aq, MAX_EVAL_STATUS_RETRIES as ar, MAX_INGEST_SIZE_BYTES as as, NumericThresholdSchema as au, traceTools as b$, ReplayResultRowSchema as b1, ReplayVerdictSchema as b5, defineEvalSuite as bA, defineEvaluatorProgram as bB, defineLocalEvaluator as bC, evaluateEvalRun as bD, evaluatePortableEvaluator as bE, evaluateReplay as bF, formatTrace as bG, importPortableEvaluator as bH, isEvalDataset as bI, isEvalSuiteDefinition as bJ, isPublishedEvalSuite as bK, loadEvalSnapshot as bL, projectWorkshopTrace as bM, publishEvalDataset as bN, publishEvalSuite as bO, pullEval as bP, readEvalDataset as bQ, readEvalManifest as bR, readEvalRun as bS, readEvaluator as bT, readReplay as bU, replay as bV, resolveDisableBatching as bW, runEvalSuite as bX, runReplay as bY, traceOutput as bZ, traceToolCalls as b_, TraceSchema as bp, claimReplay as bs, compareEvalRuns as bt, createEvalHandler as bu, createEvalSuiteRun as bv, createReplay as bw, currentEvalScope as bx, defineAgent as by, defineDataset as bz, verifyPortableEvalArtifact as c0, withEvalScope as c1, BooleanThresholdSchema as n, DEFAULT_EVAL_WAIT_MS as q, DEFAULT_QUERY_URL as r, DEFAULT_TRACE_WAIT_MS as s, EvalContextSchema as z };
75103
+ export type { EvalRowResult as $, AiTrackUsage as A, BeginParams as B, CarrierHeaders as C, FlushResultCompat as F, EvalDataset as G, EvalDatasetInput as H, InitializeOptions as I, EvalDatasetManifest as J, EvalDatasetRowInput as L, EvalDestination as N, EvalEvaluator as O, EvalHandlerOptions as P, EvalLocalEvaluator as Q, SpanProcessorOptions as S, TraceCarrier as T, EvalManifest as U, EvalParameterField as W, EvalParameterFields as X, EvalParameters as Y, EvalProgram as Z, RaindropSpanProcessor as a, ReplayResult as a$, EvalRowTracePair as a0, EvalRunReading as a1, EvalScope as a2, EvalSuiteDefinition as a3, EvalSuiteDefinitionInput as a4, EvalSuiteManifest as a5, EvalSuiteResult as a7, EvalSuiteRunSession as a8, EvalVerdictAssessment as a9, PortableEvaluator as aA, PortableJudgeRequest as aB, PortableJudgeVerdict as aC, PublishEvalDatasetOptions as aD, PublishEvalSuiteOptions as aE, PullEvalOptions as aF, PulledEvalSnapshot as aG, RaindropConnection as aH, RaindropFeatureFlagValue as aI, RaindropFeatureFlags as aJ, RaindropProperties as aK, RaindropPropertyLeaf as aL, RaindropPropertyValue as aM, ReplayClient as aN, ReplayCounts as aO, ReplayEvaluator as aQ, ReplayEvaluatorCounts as aR, ReplayEvaluatorStats as aT, ReplayEvaluatorSummary as aV, ReplayHandle as aX, LocalEvaluatorContext$1 as aY, ReplayOptions as aZ, ReplayReading as a_, EvaluateReplayOptions as aa, FinishInteractionOptions as ab, HostedEvaluatorPin as ac, IdentifyEvent as ad, LocalBooleanVerdict as ae, LocalDebuggerLiveEventInput as ag, LocalEvaluator as ah, LocalEvaluatorContext as ai, LocalNumberVerdict as aj, LocalPreferenceVerdict as al, LocalScoreVerdict as an, LocalVerdict as ap, NumericThreshold as at, PartialAiTrackEvent as av, PortableEvalArtifact as aw, PortableEvalLimits as ax, PortableEvalOutcome as ay, PortableEvalResult as az, Interaction as b, ReplayResultRow as b0, ReplayRow as b2, ReplayRowOutcome as b3, ReplayVerdict as b4, RunEvalSuiteOptions as b6, RunReplayOptions as b7, SelfDiagnoseOptions as b8, SelfDiagnosticsExecuteContext as b9, SelfDiagnosticsExecuteResult as ba, SelfDiagnosticsSignalDefinition as bb, SelfDiagnosticsSignalDefinitions as bc, SelfDiagnosticsTool as bd, SelfDiagnosticsToolInputSchema as be, SelfDiagnosticsToolOptions as bf, SignalEvent as bg, SpanParams as bh, SubagentDispatch as bi, SubagentDispatchOptions as bj, SubagentFinishOptions as bk, ToolParams as bl, ToolSpan as bm, Trace as bn, TraceContext as bo, TrackToolParams as bq, WorkflowParams as br, AppGitSnapshot as c, SubagentResumeOptions as d, SubagentRun as e, Tracer as f, FlushResult as g, AiTrackEvent as h, AppGitOptions as i, Attachment as j, AttachmentType as k, BeginInteractionOptions as l, BooleanThreshold as m, CreateEvalSuiteRunOptions as o, CreateReplayOptions as p, DefinedEvalAgent as t, DefinedEvalDataset as u, EvalAgentDefinition as v, EvalAgentExecution as w, EvalClient as x, EvalContext as y };