raindrop-ai 0.2.3 → 0.2.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.
- package/dist/{chunk-7UHYFSYI.mjs → chunk-XLEPN7ZO.mjs} +47 -18
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +39 -10
- package/dist/index.mjs +1 -1
- package/dist/tracing/index.js +39 -10
- package/dist/tracing/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -597,7 +597,7 @@ installTracingSuppressionHook();
|
|
|
597
597
|
// package.json
|
|
598
598
|
var package_default = {
|
|
599
599
|
name: "raindrop-ai",
|
|
600
|
-
version: "0.2.
|
|
600
|
+
version: "0.2.4",
|
|
601
601
|
main: "dist/index.js",
|
|
602
602
|
module: "dist/index.mjs",
|
|
603
603
|
types: "dist/index.d.ts",
|
|
@@ -1110,7 +1110,7 @@ function buildExportTraceServiceRequest2(spans) {
|
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
1112
1112
|
// src/tracing/direct/context.ts
|
|
1113
|
-
import { context, trace } from "@opentelemetry/api";
|
|
1113
|
+
import { context, isValidSpanId, isValidTraceId, trace } from "@opentelemetry/api";
|
|
1114
1114
|
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
1115
1115
|
var INVALID_SPAN_ID = "0000000000000000";
|
|
1116
1116
|
function hexToBase64(hex) {
|
|
@@ -1120,6 +1120,15 @@ function hexToBase64(hex) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
return base64Encode2(bytes);
|
|
1122
1122
|
}
|
|
1123
|
+
function getExplicitTraceContext(traceId, parentSpanId) {
|
|
1124
|
+
if (!traceId || !parentSpanId || !isValidTraceId(traceId) || !isValidSpanId(parentSpanId)) {
|
|
1125
|
+
return void 0;
|
|
1126
|
+
}
|
|
1127
|
+
return {
|
|
1128
|
+
traceIdB64: hexToBase64(traceId),
|
|
1129
|
+
parentSpanIdB64: hexToBase64(parentSpanId)
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1123
1132
|
function getActiveTraceContext() {
|
|
1124
1133
|
const activeSpan = trace.getSpan(context.active());
|
|
1125
1134
|
if (!activeSpan) return {};
|
|
@@ -1359,7 +1368,7 @@ var DirectTraceShipper = class {
|
|
|
1359
1368
|
// src/tracing/liveInteraction.ts
|
|
1360
1369
|
import {
|
|
1361
1370
|
context as context2,
|
|
1362
|
-
isValidSpanId,
|
|
1371
|
+
isValidSpanId as isValidSpanId2,
|
|
1363
1372
|
SpanStatusCode as SpanStatusCode2,
|
|
1364
1373
|
TraceFlags,
|
|
1365
1374
|
trace as trace2
|
|
@@ -1411,7 +1420,7 @@ var LiveToolSpan = class {
|
|
|
1411
1420
|
}
|
|
1412
1421
|
spanIdHex() {
|
|
1413
1422
|
const ctx = this.span.spanContext();
|
|
1414
|
-
return
|
|
1423
|
+
return isValidSpanId2(ctx.spanId) ? ctx.spanId : void 0;
|
|
1415
1424
|
}
|
|
1416
1425
|
setInput(input) {
|
|
1417
1426
|
this.span.setAttribute("traceloop.entity.input", serializeSpanValue(input));
|
|
@@ -1755,7 +1764,7 @@ var LiveInteraction = class {
|
|
|
1755
1764
|
const wrapped = async (...wrappedArgs) => {
|
|
1756
1765
|
const activeSpan = trace2.getSpan(context2.active());
|
|
1757
1766
|
const ctx = activeSpan == null ? void 0 : activeSpan.spanContext();
|
|
1758
|
-
const liveSpanId = ctx &&
|
|
1767
|
+
const liveSpanId = ctx && isValidSpanId2(ctx.spanId) ? ctx.spanId : void 0;
|
|
1759
1768
|
if (activeSpan) {
|
|
1760
1769
|
this.stampRouting(activeSpan);
|
|
1761
1770
|
}
|
|
@@ -1863,7 +1872,7 @@ var LiveInteraction = class {
|
|
|
1863
1872
|
console.log(`[raindrop] startToolSpan: started tool span "${name}"`);
|
|
1864
1873
|
}
|
|
1865
1874
|
const startSpanCtx = span.spanContext();
|
|
1866
|
-
const startSpanIdHex =
|
|
1875
|
+
const startSpanIdHex = isValidSpanId2(startSpanCtx.spanId) ? startSpanCtx.spanId : void 0;
|
|
1867
1876
|
this.emitLiveEvent({
|
|
1868
1877
|
type: "tool_start",
|
|
1869
1878
|
spanId: startSpanIdHex,
|
|
@@ -1991,12 +2000,22 @@ var LiveInteraction = class {
|
|
|
1991
2000
|
}));
|
|
1992
2001
|
}
|
|
1993
2002
|
trackTool(params) {
|
|
1994
|
-
var _a, _b;
|
|
1995
|
-
const {
|
|
2003
|
+
var _a, _b, _c;
|
|
2004
|
+
const {
|
|
2005
|
+
name,
|
|
2006
|
+
input,
|
|
2007
|
+
output,
|
|
2008
|
+
durationMs,
|
|
2009
|
+
startTime,
|
|
2010
|
+
error,
|
|
2011
|
+
properties = {},
|
|
2012
|
+
traceId: explicitTraceId,
|
|
2013
|
+
parentSpanId: explicitParentSpanId
|
|
2014
|
+
} = params;
|
|
1996
2015
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
1997
2016
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
1998
2017
|
if (this.directShipper) {
|
|
1999
|
-
const activeContext = getActiveTraceContext();
|
|
2018
|
+
const activeContext = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
2000
2019
|
const traceIdB64 = this.ensureTraceId(activeContext.traceIdB64);
|
|
2001
2020
|
const { parentSpanIdB64 } = activeContext;
|
|
2002
2021
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
@@ -2018,7 +2037,7 @@ var LiveInteraction = class {
|
|
|
2018
2037
|
traceId: traceIdB64,
|
|
2019
2038
|
parentSpanId: parentSpanIdB64
|
|
2020
2039
|
});
|
|
2021
|
-
if ((
|
|
2040
|
+
if ((_b = this.analytics) == null ? void 0 : _b.debugLogs) {
|
|
2022
2041
|
console.log(`[raindrop] trackTool (direct): logged tool span "${name}"`, {
|
|
2023
2042
|
input,
|
|
2024
2043
|
output,
|
|
@@ -2065,7 +2084,7 @@ var LiveInteraction = class {
|
|
|
2065
2084
|
span.setStatus({ code: SpanStatusCode2.OK });
|
|
2066
2085
|
}
|
|
2067
2086
|
span.end(endTimeMs);
|
|
2068
|
-
if ((
|
|
2087
|
+
if ((_c = this.analytics) == null ? void 0 : _c.debugLogs) {
|
|
2069
2088
|
console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
|
|
2070
2089
|
input,
|
|
2071
2090
|
output,
|
|
@@ -2074,7 +2093,7 @@ var LiveInteraction = class {
|
|
|
2074
2093
|
});
|
|
2075
2094
|
}
|
|
2076
2095
|
const trackToolCtx = span.spanContext();
|
|
2077
|
-
const trackToolSpanIdHex =
|
|
2096
|
+
const trackToolSpanIdHex = isValidSpanId2(trackToolCtx.spanId) ? trackToolCtx.spanId : void 0;
|
|
2078
2097
|
this.emitLiveEvent({
|
|
2079
2098
|
type: "tool_result",
|
|
2080
2099
|
spanId: trackToolSpanIdHex,
|
|
@@ -2090,7 +2109,7 @@ var LiveInteraction = class {
|
|
|
2090
2109
|
};
|
|
2091
2110
|
|
|
2092
2111
|
// src/tracing/liveTracer.ts
|
|
2093
|
-
import { context as context3, isValidSpanId as
|
|
2112
|
+
import { context as context3, isValidSpanId as isValidSpanId3, SpanStatusCode as SpanStatusCode3, trace as trace3 } from "@opentelemetry/api";
|
|
2094
2113
|
import * as traceloop2 from "@traceloop/node-server-sdk";
|
|
2095
2114
|
var LiveTracer = class {
|
|
2096
2115
|
constructor(globalProperties, directShipper, routing) {
|
|
@@ -2148,12 +2167,22 @@ var LiveTracer = class {
|
|
|
2148
2167
|
);
|
|
2149
2168
|
}
|
|
2150
2169
|
trackTool(params) {
|
|
2151
|
-
var _a;
|
|
2152
|
-
const {
|
|
2170
|
+
var _a, _b;
|
|
2171
|
+
const {
|
|
2172
|
+
name,
|
|
2173
|
+
input,
|
|
2174
|
+
output,
|
|
2175
|
+
durationMs,
|
|
2176
|
+
startTime,
|
|
2177
|
+
error,
|
|
2178
|
+
properties = {},
|
|
2179
|
+
traceId: explicitTraceId,
|
|
2180
|
+
parentSpanId: explicitParentSpanId
|
|
2181
|
+
} = params;
|
|
2153
2182
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
2154
2183
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
2155
2184
|
if (this.directShipper) {
|
|
2156
|
-
const { traceIdB64, parentSpanIdB64 } = getActiveTraceContext();
|
|
2185
|
+
const { traceIdB64, parentSpanIdB64 } = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
2157
2186
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
2158
2187
|
const inputStr = input !== void 0 ? stringifyBounded(input) : void 0;
|
|
2159
2188
|
const outputStr = output !== void 0 ? stringifyBounded(output) : void 0;
|
|
@@ -2218,8 +2247,8 @@ var LiveTracer = class {
|
|
|
2218
2247
|
}
|
|
2219
2248
|
span.end(endTimeMs);
|
|
2220
2249
|
const ctx = span.spanContext();
|
|
2221
|
-
const traceId = ctx.traceId || ((
|
|
2222
|
-
const spanIdHex =
|
|
2250
|
+
const traceId = ctx.traceId || ((_b = trace3.getSpan(context3.active())) == null ? void 0 : _b.spanContext().traceId);
|
|
2251
|
+
const spanIdHex = isValidSpanId3(ctx.spanId) ? ctx.spanId : void 0;
|
|
2223
2252
|
if (traceId) {
|
|
2224
2253
|
this.emitLiveEvent({
|
|
2225
2254
|
traceId,
|
package/dist/index.d.mts
CHANGED
|
@@ -383,6 +383,8 @@ interface ToolParams {
|
|
|
383
383
|
* @property startTime - Optional start time of the tool execution
|
|
384
384
|
* @property error - Optional error if the tool failed
|
|
385
385
|
* @property properties - Optional key-value pairs for additional metadata
|
|
386
|
+
* @property traceId - Optional W3C trace ID override for bypassOtelForTools mode
|
|
387
|
+
* @property parentSpanId - Optional W3C parent span ID override for bypassOtelForTools mode
|
|
386
388
|
*/
|
|
387
389
|
interface TrackToolParams {
|
|
388
390
|
name: string;
|
|
@@ -392,6 +394,8 @@ interface TrackToolParams {
|
|
|
392
394
|
startTime?: Date | number;
|
|
393
395
|
error?: Error | string;
|
|
394
396
|
properties?: Record<string, string>;
|
|
397
|
+
traceId?: string;
|
|
398
|
+
parentSpanId?: string;
|
|
395
399
|
}
|
|
396
400
|
type LocalDebuggerLiveEventInput = Omit<LocalDebuggerLiveEventInput$1, "traceId"> & {
|
|
397
401
|
traceId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -383,6 +383,8 @@ interface ToolParams {
|
|
|
383
383
|
* @property startTime - Optional start time of the tool execution
|
|
384
384
|
* @property error - Optional error if the tool failed
|
|
385
385
|
* @property properties - Optional key-value pairs for additional metadata
|
|
386
|
+
* @property traceId - Optional W3C trace ID override for bypassOtelForTools mode
|
|
387
|
+
* @property parentSpanId - Optional W3C parent span ID override for bypassOtelForTools mode
|
|
386
388
|
*/
|
|
387
389
|
interface TrackToolParams {
|
|
388
390
|
name: string;
|
|
@@ -392,6 +394,8 @@ interface TrackToolParams {
|
|
|
392
394
|
startTime?: Date | number;
|
|
393
395
|
error?: Error | string;
|
|
394
396
|
properties?: Record<string, string>;
|
|
397
|
+
traceId?: string;
|
|
398
|
+
parentSpanId?: string;
|
|
395
399
|
}
|
|
396
400
|
type LocalDebuggerLiveEventInput = Omit<LocalDebuggerLiveEventInput$1, "traceId"> & {
|
|
397
401
|
traceId?: string;
|
package/dist/index.js
CHANGED
|
@@ -10477,7 +10477,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
10477
10477
|
// package.json
|
|
10478
10478
|
var package_default = {
|
|
10479
10479
|
name: "raindrop-ai",
|
|
10480
|
-
version: "0.2.
|
|
10480
|
+
version: "0.2.4",
|
|
10481
10481
|
main: "dist/index.js",
|
|
10482
10482
|
module: "dist/index.mjs",
|
|
10483
10483
|
types: "dist/index.d.ts",
|
|
@@ -10902,6 +10902,15 @@ function hexToBase64(hex) {
|
|
|
10902
10902
|
}
|
|
10903
10903
|
return base64Encode2(bytes);
|
|
10904
10904
|
}
|
|
10905
|
+
function getExplicitTraceContext(traceId, parentSpanId) {
|
|
10906
|
+
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
10907
|
+
return void 0;
|
|
10908
|
+
}
|
|
10909
|
+
return {
|
|
10910
|
+
traceIdB64: hexToBase64(traceId),
|
|
10911
|
+
parentSpanIdB64: hexToBase64(parentSpanId)
|
|
10912
|
+
};
|
|
10913
|
+
}
|
|
10905
10914
|
function getActiveTraceContext() {
|
|
10906
10915
|
const activeSpan = import_api.trace.getSpan(import_api.context.active());
|
|
10907
10916
|
if (!activeSpan) return {};
|
|
@@ -11951,12 +11960,22 @@ var LiveInteraction = class {
|
|
|
11951
11960
|
}));
|
|
11952
11961
|
}
|
|
11953
11962
|
trackTool(params) {
|
|
11954
|
-
var _a, _b;
|
|
11955
|
-
const {
|
|
11963
|
+
var _a, _b, _c;
|
|
11964
|
+
const {
|
|
11965
|
+
name,
|
|
11966
|
+
input,
|
|
11967
|
+
output,
|
|
11968
|
+
durationMs,
|
|
11969
|
+
startTime,
|
|
11970
|
+
error,
|
|
11971
|
+
properties = {},
|
|
11972
|
+
traceId: explicitTraceId,
|
|
11973
|
+
parentSpanId: explicitParentSpanId
|
|
11974
|
+
} = params;
|
|
11956
11975
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
11957
11976
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
11958
11977
|
if (this.directShipper) {
|
|
11959
|
-
const activeContext = getActiveTraceContext();
|
|
11978
|
+
const activeContext = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
11960
11979
|
const traceIdB64 = this.ensureTraceId(activeContext.traceIdB64);
|
|
11961
11980
|
const { parentSpanIdB64 } = activeContext;
|
|
11962
11981
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
@@ -11978,7 +11997,7 @@ var LiveInteraction = class {
|
|
|
11978
11997
|
traceId: traceIdB64,
|
|
11979
11998
|
parentSpanId: parentSpanIdB64
|
|
11980
11999
|
});
|
|
11981
|
-
if ((
|
|
12000
|
+
if ((_b = this.analytics) == null ? void 0 : _b.debugLogs) {
|
|
11982
12001
|
console.log(`[raindrop] trackTool (direct): logged tool span "${name}"`, {
|
|
11983
12002
|
input,
|
|
11984
12003
|
output,
|
|
@@ -12025,7 +12044,7 @@ var LiveInteraction = class {
|
|
|
12025
12044
|
span.setStatus({ code: import_api2.SpanStatusCode.OK });
|
|
12026
12045
|
}
|
|
12027
12046
|
span.end(endTimeMs);
|
|
12028
|
-
if ((
|
|
12047
|
+
if ((_c = this.analytics) == null ? void 0 : _c.debugLogs) {
|
|
12029
12048
|
console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
|
|
12030
12049
|
input,
|
|
12031
12050
|
output,
|
|
@@ -12108,12 +12127,22 @@ var LiveTracer = class {
|
|
|
12108
12127
|
);
|
|
12109
12128
|
}
|
|
12110
12129
|
trackTool(params) {
|
|
12111
|
-
var _a;
|
|
12112
|
-
const {
|
|
12130
|
+
var _a, _b;
|
|
12131
|
+
const {
|
|
12132
|
+
name,
|
|
12133
|
+
input,
|
|
12134
|
+
output,
|
|
12135
|
+
durationMs,
|
|
12136
|
+
startTime,
|
|
12137
|
+
error,
|
|
12138
|
+
properties = {},
|
|
12139
|
+
traceId: explicitTraceId,
|
|
12140
|
+
parentSpanId: explicitParentSpanId
|
|
12141
|
+
} = params;
|
|
12113
12142
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
12114
12143
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
12115
12144
|
if (this.directShipper) {
|
|
12116
|
-
const { traceIdB64, parentSpanIdB64 } = getActiveTraceContext();
|
|
12145
|
+
const { traceIdB64, parentSpanIdB64 } = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
12117
12146
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
12118
12147
|
const inputStr = input !== void 0 ? stringifyBounded(input) : void 0;
|
|
12119
12148
|
const outputStr = output !== void 0 ? stringifyBounded(output) : void 0;
|
|
@@ -12178,7 +12207,7 @@ var LiveTracer = class {
|
|
|
12178
12207
|
}
|
|
12179
12208
|
span.end(endTimeMs);
|
|
12180
12209
|
const ctx = span.spanContext();
|
|
12181
|
-
const traceId = ctx.traceId || ((
|
|
12210
|
+
const traceId = ctx.traceId || ((_b = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _b.spanContext().traceId);
|
|
12182
12211
|
const spanIdHex = (0, import_api3.isValidSpanId)(ctx.spanId) ? ctx.spanId : void 0;
|
|
12183
12212
|
if (traceId) {
|
|
12184
12213
|
this.emitLiveEvent({
|
package/dist/index.mjs
CHANGED
package/dist/tracing/index.js
CHANGED
|
@@ -764,7 +764,7 @@ function base64ToHex(base64) {
|
|
|
764
764
|
// package.json
|
|
765
765
|
var package_default = {
|
|
766
766
|
name: "raindrop-ai",
|
|
767
|
-
version: "0.2.
|
|
767
|
+
version: "0.2.4",
|
|
768
768
|
main: "dist/index.js",
|
|
769
769
|
module: "dist/index.mjs",
|
|
770
770
|
types: "dist/index.d.ts",
|
|
@@ -932,6 +932,15 @@ function hexToBase64(hex) {
|
|
|
932
932
|
}
|
|
933
933
|
return base64Encode2(bytes);
|
|
934
934
|
}
|
|
935
|
+
function getExplicitTraceContext(traceId, parentSpanId) {
|
|
936
|
+
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
937
|
+
return void 0;
|
|
938
|
+
}
|
|
939
|
+
return {
|
|
940
|
+
traceIdB64: hexToBase64(traceId),
|
|
941
|
+
parentSpanIdB64: hexToBase64(parentSpanId)
|
|
942
|
+
};
|
|
943
|
+
}
|
|
935
944
|
function getActiveTraceContext() {
|
|
936
945
|
const activeSpan = import_api.trace.getSpan(import_api.context.active());
|
|
937
946
|
if (!activeSpan) return {};
|
|
@@ -1981,12 +1990,22 @@ var LiveInteraction = class {
|
|
|
1981
1990
|
}));
|
|
1982
1991
|
}
|
|
1983
1992
|
trackTool(params) {
|
|
1984
|
-
var _a, _b;
|
|
1985
|
-
const {
|
|
1993
|
+
var _a, _b, _c;
|
|
1994
|
+
const {
|
|
1995
|
+
name,
|
|
1996
|
+
input,
|
|
1997
|
+
output,
|
|
1998
|
+
durationMs,
|
|
1999
|
+
startTime,
|
|
2000
|
+
error,
|
|
2001
|
+
properties = {},
|
|
2002
|
+
traceId: explicitTraceId,
|
|
2003
|
+
parentSpanId: explicitParentSpanId
|
|
2004
|
+
} = params;
|
|
1986
2005
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
1987
2006
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
1988
2007
|
if (this.directShipper) {
|
|
1989
|
-
const activeContext = getActiveTraceContext();
|
|
2008
|
+
const activeContext = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
1990
2009
|
const traceIdB64 = this.ensureTraceId(activeContext.traceIdB64);
|
|
1991
2010
|
const { parentSpanIdB64 } = activeContext;
|
|
1992
2011
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
@@ -2008,7 +2027,7 @@ var LiveInteraction = class {
|
|
|
2008
2027
|
traceId: traceIdB64,
|
|
2009
2028
|
parentSpanId: parentSpanIdB64
|
|
2010
2029
|
});
|
|
2011
|
-
if ((
|
|
2030
|
+
if ((_b = this.analytics) == null ? void 0 : _b.debugLogs) {
|
|
2012
2031
|
console.log(`[raindrop] trackTool (direct): logged tool span "${name}"`, {
|
|
2013
2032
|
input,
|
|
2014
2033
|
output,
|
|
@@ -2055,7 +2074,7 @@ var LiveInteraction = class {
|
|
|
2055
2074
|
span.setStatus({ code: import_api2.SpanStatusCode.OK });
|
|
2056
2075
|
}
|
|
2057
2076
|
span.end(endTimeMs);
|
|
2058
|
-
if ((
|
|
2077
|
+
if ((_c = this.analytics) == null ? void 0 : _c.debugLogs) {
|
|
2059
2078
|
console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
|
|
2060
2079
|
input,
|
|
2061
2080
|
output,
|
|
@@ -2138,12 +2157,22 @@ var LiveTracer = class {
|
|
|
2138
2157
|
);
|
|
2139
2158
|
}
|
|
2140
2159
|
trackTool(params) {
|
|
2141
|
-
var _a;
|
|
2142
|
-
const {
|
|
2160
|
+
var _a, _b;
|
|
2161
|
+
const {
|
|
2162
|
+
name,
|
|
2163
|
+
input,
|
|
2164
|
+
output,
|
|
2165
|
+
durationMs,
|
|
2166
|
+
startTime,
|
|
2167
|
+
error,
|
|
2168
|
+
properties = {},
|
|
2169
|
+
traceId: explicitTraceId,
|
|
2170
|
+
parentSpanId: explicitParentSpanId
|
|
2171
|
+
} = params;
|
|
2143
2172
|
const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
|
|
2144
2173
|
const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
|
|
2145
2174
|
if (this.directShipper) {
|
|
2146
|
-
const { traceIdB64, parentSpanIdB64 } = getActiveTraceContext();
|
|
2175
|
+
const { traceIdB64, parentSpanIdB64 } = (_a = getExplicitTraceContext(explicitTraceId, explicitParentSpanId)) != null ? _a : getActiveTraceContext();
|
|
2147
2176
|
const spanIdB64 = base64Encode2(randomBytes2(8));
|
|
2148
2177
|
const inputStr = input !== void 0 ? stringifyBounded(input) : void 0;
|
|
2149
2178
|
const outputStr = output !== void 0 ? stringifyBounded(output) : void 0;
|
|
@@ -2208,7 +2237,7 @@ var LiveTracer = class {
|
|
|
2208
2237
|
}
|
|
2209
2238
|
span.end(endTimeMs);
|
|
2210
2239
|
const ctx = span.spanContext();
|
|
2211
|
-
const traceId = ctx.traceId || ((
|
|
2240
|
+
const traceId = ctx.traceId || ((_b = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _b.spanContext().traceId);
|
|
2212
2241
|
const spanIdHex = (0, import_api3.isValidSpanId)(ctx.spanId) ? ctx.spanId : void 0;
|
|
2213
2242
|
if (traceId) {
|
|
2214
2243
|
this.emitLiveEvent({
|
package/dist/tracing/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raindrop-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"vite": "^7.3.2",
|
|
43
43
|
"vitest": "^4.0.10",
|
|
44
44
|
"@raindrop-ai/core": "0.1.3",
|
|
45
|
-
"@raindrop-ai/
|
|
46
|
-
"@raindrop-ai/
|
|
45
|
+
"@raindrop-ai/redact-pii": "0.1.2",
|
|
46
|
+
"@raindrop-ai/schemas": "0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@opentelemetry/api": "^1.9.0",
|