@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
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var __version__, __packageName__;
|
|
|
42
42
|
var init_version_generated = __esm({
|
|
43
43
|
"src/version.generated.ts"() {
|
|
44
44
|
"use strict";
|
|
45
|
-
__version__ = "0.38.
|
|
45
|
+
__version__ = "0.38.9";
|
|
46
46
|
__packageName__ = "@bitfab/sdk";
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -3217,8 +3217,20 @@ function finalizeTracePayload(payload) {
|
|
|
3217
3217
|
// src/claudeAgentSdk.ts
|
|
3218
3218
|
init_randomUuid();
|
|
3219
3219
|
init_serialize();
|
|
3220
|
+
|
|
3221
|
+
// src/timestamp.ts
|
|
3222
|
+
var lastTimestampMicros = 0;
|
|
3223
|
+
function nowIsoTimestamp() {
|
|
3224
|
+
const wallClockMicros = Date.now() * 1e3;
|
|
3225
|
+
lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
|
|
3226
|
+
const milliseconds = Math.floor(lastTimestampMicros / 1e3);
|
|
3227
|
+
const remainingMicros = lastTimestampMicros % 1e3;
|
|
3228
|
+
return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
// src/claudeAgentSdk.ts
|
|
3220
3232
|
function nowIso() {
|
|
3221
|
-
return (
|
|
3233
|
+
return nowIsoTimestamp();
|
|
3222
3234
|
}
|
|
3223
3235
|
var safeSerialize = toJsonSafe;
|
|
3224
3236
|
function extractContentBlocks(content) {
|
|
@@ -4238,7 +4250,7 @@ var LANGGRAPH_METADATA_KEYS = [
|
|
|
4238
4250
|
"langgraph_checkpoint_ns"
|
|
4239
4251
|
];
|
|
4240
4252
|
function nowIso2() {
|
|
4241
|
-
return (
|
|
4253
|
+
return nowIsoTimestamp();
|
|
4242
4254
|
}
|
|
4243
4255
|
function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
|
|
4244
4256
|
if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
|
|
@@ -5280,16 +5292,16 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
5280
5292
|
delete this.activeTraces[trace.traceId];
|
|
5281
5293
|
}
|
|
5282
5294
|
/**
|
|
5283
|
-
* Called when a span is started.
|
|
5295
|
+
* Called when a span is started. Span payloads are authoritative completed
|
|
5296
|
+
* snapshots, so start notifications do not cross the transport boundary.
|
|
5284
5297
|
*/
|
|
5285
5298
|
// biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
|
|
5286
|
-
async onSpanStart(
|
|
5287
|
-
this.sendSpan(span);
|
|
5299
|
+
async onSpanStart(_span) {
|
|
5288
5300
|
}
|
|
5289
5301
|
/**
|
|
5290
5302
|
* Called when a span is ended.
|
|
5291
5303
|
*
|
|
5292
|
-
* Send
|
|
5304
|
+
* Send the finalized span snapshot to Bitfab for complete trace capture.
|
|
5293
5305
|
*/
|
|
5294
5306
|
// biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
|
|
5295
5307
|
async onSpanEnd(span) {
|
|
@@ -5849,7 +5861,7 @@ function getCurrentTrace() {
|
|
|
5849
5861
|
if (!traceState) {
|
|
5850
5862
|
traceState = {
|
|
5851
5863
|
traceId,
|
|
5852
|
-
startedAt: (
|
|
5864
|
+
startedAt: nowIsoTimestamp(),
|
|
5853
5865
|
contexts: []
|
|
5854
5866
|
};
|
|
5855
5867
|
activeTraceStates.set(traceId, traceState);
|
|
@@ -6783,7 +6795,7 @@ var Bitfab = class {
|
|
|
6783
6795
|
const newContext = { traceId, spanId, contexts: [] };
|
|
6784
6796
|
newStack = [...currentStack, newContext];
|
|
6785
6797
|
const inputs = args;
|
|
6786
|
-
const startedAt = (
|
|
6798
|
+
const startedAt = nowIsoTimestamp();
|
|
6787
6799
|
const replayCtxAtStart = getReplayContext();
|
|
6788
6800
|
const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
|
|
6789
6801
|
if (isRootSpan && !activeTraceStates.has(traceId)) {
|
|
@@ -6818,7 +6830,7 @@ var Bitfab = class {
|
|
|
6818
6830
|
const sendSpan = async (params) => {
|
|
6819
6831
|
const replayCtx = getReplayContext();
|
|
6820
6832
|
try {
|
|
6821
|
-
const endedAt = (
|
|
6833
|
+
const endedAt = nowIsoTimestamp();
|
|
6822
6834
|
const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
|
|
6823
6835
|
if (!traceDropped) {
|
|
6824
6836
|
self.sendWrapperSpan({
|