@bitfab/sdk 0.38.7 → 0.38.9
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-7E6KCBTH.js → chunk-2I5TFNGK.js} +2 -2
- package/dist/{chunk-7E6KCBTH.js.map → chunk-2I5TFNGK.js.map} +1 -1
- package/dist/{chunk-RZ3P6ICN.js → chunk-B4XXAK74.js} +22 -12
- package/dist/chunk-B4XXAK74.js.map +1 -0
- package/dist/index.cjs +22 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -2
- package/dist/node.cjs +22 -10
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-DIRRDWI2.js → replay-EC7CQOO3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-RZ3P6ICN.js.map +0 -1
- /package/dist/{replay-DIRRDWI2.js.map → replay-EC7CQOO3.js.map} +0 -0
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
toJsonSafe,
|
|
20
20
|
toJsonSafeReport,
|
|
21
21
|
warnOnce
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2I5TFNGK.js";
|
|
23
23
|
import {
|
|
24
24
|
__privateAdd,
|
|
25
25
|
__privateGet,
|
|
@@ -83,9 +83,19 @@ function finalizeTracePayload(payload) {
|
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// src/timestamp.ts
|
|
87
|
+
var lastTimestampMicros = 0;
|
|
88
|
+
function nowIsoTimestamp() {
|
|
89
|
+
const wallClockMicros = Date.now() * 1e3;
|
|
90
|
+
lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
|
|
91
|
+
const milliseconds = Math.floor(lastTimestampMicros / 1e3);
|
|
92
|
+
const remainingMicros = lastTimestampMicros % 1e3;
|
|
93
|
+
return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
|
|
94
|
+
}
|
|
95
|
+
|
|
86
96
|
// src/claudeAgentSdk.ts
|
|
87
97
|
function nowIso() {
|
|
88
|
-
return (
|
|
98
|
+
return nowIsoTimestamp();
|
|
89
99
|
}
|
|
90
100
|
var safeSerialize = toJsonSafe;
|
|
91
101
|
function extractContentBlocks(content) {
|
|
@@ -964,7 +974,7 @@ var LANGGRAPH_METADATA_KEYS = [
|
|
|
964
974
|
"langgraph_checkpoint_ns"
|
|
965
975
|
];
|
|
966
976
|
function nowIso2() {
|
|
967
|
-
return (
|
|
977
|
+
return nowIsoTimestamp();
|
|
968
978
|
}
|
|
969
979
|
function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
|
|
970
980
|
if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
|
|
@@ -1991,16 +2001,16 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
1991
2001
|
delete this.activeTraces[trace.traceId];
|
|
1992
2002
|
}
|
|
1993
2003
|
/**
|
|
1994
|
-
* Called when a span is started.
|
|
2004
|
+
* Called when a span is started. Span payloads are authoritative completed
|
|
2005
|
+
* snapshots, so start notifications do not cross the transport boundary.
|
|
1995
2006
|
*/
|
|
1996
2007
|
// biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
|
|
1997
|
-
async onSpanStart(
|
|
1998
|
-
this.sendSpan(span);
|
|
2008
|
+
async onSpanStart(_span) {
|
|
1999
2009
|
}
|
|
2000
2010
|
/**
|
|
2001
2011
|
* Called when a span is ended.
|
|
2002
2012
|
*
|
|
2003
|
-
* Send
|
|
2013
|
+
* Send the finalized span snapshot to Bitfab for complete trace capture.
|
|
2004
2014
|
*/
|
|
2005
2015
|
// biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
|
|
2006
2016
|
async onSpanEnd(span) {
|
|
@@ -2559,7 +2569,7 @@ function getCurrentTrace() {
|
|
|
2559
2569
|
if (!traceState) {
|
|
2560
2570
|
traceState = {
|
|
2561
2571
|
traceId,
|
|
2562
|
-
startedAt: (
|
|
2572
|
+
startedAt: nowIsoTimestamp(),
|
|
2563
2573
|
contexts: []
|
|
2564
2574
|
};
|
|
2565
2575
|
activeTraceStates.set(traceId, traceState);
|
|
@@ -3493,7 +3503,7 @@ var Bitfab = class {
|
|
|
3493
3503
|
const newContext = { traceId, spanId, contexts: [] };
|
|
3494
3504
|
newStack = [...currentStack, newContext];
|
|
3495
3505
|
const inputs = args;
|
|
3496
|
-
const startedAt = (
|
|
3506
|
+
const startedAt = nowIsoTimestamp();
|
|
3497
3507
|
const replayCtxAtStart = getReplayContext();
|
|
3498
3508
|
const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
|
|
3499
3509
|
if (isRootSpan && !activeTraceStates.has(traceId)) {
|
|
@@ -3528,7 +3538,7 @@ var Bitfab = class {
|
|
|
3528
3538
|
const sendSpan = async (params) => {
|
|
3529
3539
|
const replayCtx = getReplayContext();
|
|
3530
3540
|
try {
|
|
3531
|
-
const endedAt = (
|
|
3541
|
+
const endedAt = nowIsoTimestamp();
|
|
3532
3542
|
const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
|
|
3533
3543
|
if (!traceDropped) {
|
|
3534
3544
|
self.sendWrapperSpan({
|
|
@@ -4102,7 +4112,7 @@ var Bitfab = class {
|
|
|
4102
4112
|
`Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
|
|
4103
4113
|
);
|
|
4104
4114
|
}
|
|
4105
|
-
const { replay: doReplay } = await import("./replay-
|
|
4115
|
+
const { replay: doReplay } = await import("./replay-EC7CQOO3.js");
|
|
4106
4116
|
return doReplay(
|
|
4107
4117
|
this.httpClient,
|
|
4108
4118
|
this.serviceUrl,
|
|
@@ -4355,4 +4365,4 @@ export {
|
|
|
4355
4365
|
finalizers,
|
|
4356
4366
|
defineReplayRegistry
|
|
4357
4367
|
};
|
|
4358
|
-
//# sourceMappingURL=chunk-
|
|
4368
|
+
//# sourceMappingURL=chunk-B4XXAK74.js.map
|