@bitfab/sdk 0.74.5 → 0.74.7
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/{http-C_t7m9b_.js → http-CDFhg9aQ.js} +78 -44
- package/dist/http-CDFhg9aQ.js.map +1 -0
- package/dist/{http-DNmzk2gf.cjs → http-sX8XbCY8.cjs} +78 -44
- package/dist/http-sX8XbCY8.cjs.map +1 -0
- package/dist/{index-PwbvfBty.d.cts → index-Dg04DT0z.d.cts} +55 -26
- package/dist/{index-PwbvfBty.d.ts → index-Dg04DT0z.d.ts} +55 -26
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{registryCommand-Bm2-Peq8.js → registryCommand-DdE8cNOX.js} +8 -7
- package/dist/registryCommand-DdE8cNOX.js.map +1 -0
- package/dist/replayCli.js +1 -1
- package/dist/seedCli.js +1 -1
- package/dist/{src-B7Xv4aR2.cjs → src-CmcfwC6Z.cjs} +174 -44
- package/dist/src-CmcfwC6Z.cjs.map +1 -0
- package/dist/{src-Ch86hs9i.js → src-DXFs6T8_.js} +174 -44
- package/dist/src-DXFs6T8_.js.map +1 -0
- package/package.json +1 -1
- package/dist/http-C_t7m9b_.js.map +0 -1
- package/dist/http-DNmzk2gf.cjs.map +0 -1
- package/dist/registryCommand-Bm2-Peq8.js.map +0 -1
- package/dist/src-B7Xv4aR2.cjs.map +0 -1
- package/dist/src-Ch86hs9i.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-
|
|
2
|
+
import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-CDFhg9aQ.js";
|
|
3
3
|
import { A as unmapOpenAiAgentsTrace, B as asyncStorageReady, C as recordAutoTracedClientCall, D as mapOpenAiAgentsTrace, E as endOpenAiAgentsSpan, F as warnOnce, H as isAsyncStorageInitDone, I as writeOnce, L as isCaptureSuppressed, M as installLangChainRunScopes, N as markLangChainRunRecorded, O as openAiAgentsParentSpanId, R as runWithCaptureSuppressed, S as frameworkRecordsClientCall, T as watchClientCall, V as createAsyncLocalStorage, _ as runWithAutoTraceRootContext, b as OPENROUTER, f as invokeThroughAutoTraceEntries, g as runWithAutoTraceNodeConfiguration, h as runWithAutoTraceFramesAt, j as forgetLangChainRun, k as openAiAgentsSpanChain, l as clearAutoTraceNodeConfiguration, m as runWithAutoTraceEntry, o as __bitfabAutoTraceActive, p as runAsAutoTraceRootFunction, u as currentAutoTraceEntries, v as ANTHROPIC, w as recordWatchedClientCall, x as clientCallProvider, y as OPENAI_RESPONSES } from "./autoTrace-kHOBg49M.js";
|
|
4
4
|
import { t as importOptionalPeer } from "./optionalPeer-CczrzrXx.js";
|
|
5
5
|
import { t as loadBamlModule } from "./bamlPeer-Dyeb3e5o.js";
|
|
@@ -51,7 +51,135 @@ function unserializableStub(value, reason) {
|
|
|
51
51
|
function serializeValue(value) {
|
|
52
52
|
return runWithCaptureSuppressed(() => serializeWithSuperjson(value));
|
|
53
53
|
}
|
|
54
|
+
function exceedsSerializedBudget(value, budget, frameworkWalk = false, dropped) {
|
|
55
|
+
let total = 0;
|
|
56
|
+
let steps = 0;
|
|
57
|
+
const maxSteps = 4 * budget + 1024;
|
|
58
|
+
const giveUp = /* @__PURE__ */ new Error("size walk step limit");
|
|
59
|
+
const step = () => {
|
|
60
|
+
steps += 1;
|
|
61
|
+
if (steps > maxSteps) throw giveUp;
|
|
62
|
+
};
|
|
63
|
+
const found = [];
|
|
64
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
65
|
+
const visit = (node, depth, jsonRules) => {
|
|
66
|
+
if (total > budget) return;
|
|
67
|
+
step();
|
|
68
|
+
if (node === null) {
|
|
69
|
+
total += 4;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
switch (typeof node) {
|
|
73
|
+
case "string":
|
|
74
|
+
total += node.length + 2;
|
|
75
|
+
return;
|
|
76
|
+
case "number":
|
|
77
|
+
total += 1;
|
|
78
|
+
return;
|
|
79
|
+
case "boolean":
|
|
80
|
+
total += 4;
|
|
81
|
+
return;
|
|
82
|
+
case "undefined": return;
|
|
83
|
+
}
|
|
84
|
+
if (frameworkWalk && depth > MAX_SAFE_DEPTH) {
|
|
85
|
+
found.push(describeValue(node));
|
|
86
|
+
total += 2;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (typeof node === "bigint") {
|
|
90
|
+
total += 1;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (typeof node !== "object") {
|
|
94
|
+
found.push(describeValue(node));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (ancestors.has(node)) {
|
|
98
|
+
found.push(describeValue(node));
|
|
99
|
+
total += 4;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!jsonRules && registeredOnSuperjson(node)) {
|
|
103
|
+
total += 1;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (ArrayBuffer.isView(node)) {
|
|
107
|
+
total += node instanceof DataView ? 2 : Math.max(2, 2 * node.length);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (typeof node.toJSON === "function") {
|
|
111
|
+
total += 2;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!jsonRules && node instanceof Error) {
|
|
115
|
+
total += node.name.length + node.message.length + 4;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
total += 2;
|
|
119
|
+
const childRules = jsonRules || !walkedBySuperjson(node);
|
|
120
|
+
ancestors.add(node);
|
|
121
|
+
let written = 0;
|
|
122
|
+
const separate = () => {
|
|
123
|
+
if (written > 0) total += 1;
|
|
124
|
+
written += 1;
|
|
125
|
+
};
|
|
126
|
+
if (Array.isArray(node)) for (let index = 0; index < node.length && total <= budget; index += 1) {
|
|
127
|
+
if (!jsonRules && !(index in node)) {
|
|
128
|
+
step();
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
separate();
|
|
132
|
+
visit(node[index], depth + 1, childRules);
|
|
133
|
+
}
|
|
134
|
+
else if (jsonRules && (node instanceof Map || node instanceof Set)) {} else if (node instanceof Map) for (const [key, entry] of node) {
|
|
135
|
+
if (total > budget) break;
|
|
136
|
+
separate();
|
|
137
|
+
total += 3;
|
|
138
|
+
visit(key, depth + 1, childRules);
|
|
139
|
+
visit(entry, depth + 1, childRules);
|
|
140
|
+
}
|
|
141
|
+
else if (node instanceof Set) for (const entry of node) {
|
|
142
|
+
if (total > budget) break;
|
|
143
|
+
separate();
|
|
144
|
+
visit(entry, depth + 1, childRules);
|
|
145
|
+
}
|
|
146
|
+
else for (const key of Object.keys(node)) {
|
|
147
|
+
if (total > budget) break;
|
|
148
|
+
if (frameworkWalk && key.startsWith("_")) continue;
|
|
149
|
+
const entry = node[key];
|
|
150
|
+
if (entry !== void 0 && typeof entry !== "function" && typeof entry !== "symbol") {
|
|
151
|
+
separate();
|
|
152
|
+
total += key.length + 3;
|
|
153
|
+
}
|
|
154
|
+
visit(entry, depth + 1, childRules);
|
|
155
|
+
}
|
|
156
|
+
ancestors.delete(node);
|
|
157
|
+
};
|
|
158
|
+
try {
|
|
159
|
+
visit(value, 0, frameworkWalk);
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
if (total <= budget) return false;
|
|
164
|
+
dropped?.push(...found);
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
const superjsonDefault = superjson.defaultInstance;
|
|
168
|
+
function registeredOnSuperjson(node) {
|
|
169
|
+
if (superjsonDefault === void 0) return false;
|
|
170
|
+
const ownConstructor = node.constructor;
|
|
171
|
+
return superjsonDefault.customTransformerRegistry.findApplicable(node) !== void 0 || typeof ownConstructor === "function" && superjsonDefault.classRegistry.getIdentifier(ownConstructor) !== void 0;
|
|
172
|
+
}
|
|
173
|
+
function walkedBySuperjson(node) {
|
|
174
|
+
if (Array.isArray(node) || node instanceof Map || node instanceof Set) return true;
|
|
175
|
+
const prototype = Object.getPrototypeOf(node);
|
|
176
|
+
return prototype === null || prototype === Object.prototype;
|
|
177
|
+
}
|
|
178
|
+
function tooLargeReason(budget) {
|
|
179
|
+
return `too_large_over_${budget}_bytes`;
|
|
180
|
+
}
|
|
54
181
|
function serializeWithSuperjson(value) {
|
|
182
|
+
if (exceedsSerializedBudget(value, MAX_SERIALIZED_BYTES)) return unserializableStub(value, tooLargeReason(MAX_SERIALIZED_BYTES));
|
|
55
183
|
try {
|
|
56
184
|
const { json, meta } = superjson.serialize(value);
|
|
57
185
|
let size;
|
|
@@ -89,22 +217,24 @@ function toJsonSafeReport(value) {
|
|
|
89
217
|
}
|
|
90
218
|
function jsonSafeReport(value) {
|
|
91
219
|
const dropped = [];
|
|
220
|
+
if (exceedsSerializedBudget(value, MAX_FRAMEWORK_SERIALIZED_BYTES, true, dropped)) return frameworkTooLarge(tooLargeReason(MAX_FRAMEWORK_SERIALIZED_BYTES), dropped);
|
|
92
221
|
const safe = toJsonSafeInner(value, 0, /* @__PURE__ */ new WeakSet(), dropped);
|
|
93
222
|
try {
|
|
94
223
|
const size = JSON.stringify(safe)?.length ?? 0;
|
|
95
|
-
if (size > MAX_FRAMEWORK_SERIALIZED_BYTES) {
|
|
96
|
-
warnOnce("toJsonSafe:too_large", `a framework payload exceeded ${MAX_FRAMEWORK_SERIALIZED_BYTES} bytes and was replaced with a placeholder so the span still ships. The captured state for this span is incomplete.`);
|
|
97
|
-
return {
|
|
98
|
-
safe: `<unserializable: too_large_${size}_bytes>`,
|
|
99
|
-
dropped: [...dropped, `too_large_${size}_bytes`]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
224
|
+
if (size > MAX_FRAMEWORK_SERIALIZED_BYTES) return frameworkTooLarge(`too_large_${size}_bytes`, dropped);
|
|
102
225
|
} catch {}
|
|
103
226
|
return {
|
|
104
227
|
safe,
|
|
105
228
|
dropped
|
|
106
229
|
};
|
|
107
230
|
}
|
|
231
|
+
function frameworkTooLarge(reason, dropped) {
|
|
232
|
+
warnOnce("toJsonSafe:too_large", `a framework payload exceeded ${MAX_FRAMEWORK_SERIALIZED_BYTES} bytes and was replaced with a placeholder so the span still ships. The captured state for this span is incomplete.`);
|
|
233
|
+
return {
|
|
234
|
+
safe: `<unserializable: ${reason}>`,
|
|
235
|
+
dropped: [...dropped, "too_large"]
|
|
236
|
+
};
|
|
237
|
+
}
|
|
108
238
|
function toJsonSafeInner(value, depth, seen, dropped) {
|
|
109
239
|
if (value === null || value === void 0) return value;
|
|
110
240
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
@@ -185,7 +315,7 @@ function finalizeSpanPayload(payload, extraDropped) {
|
|
|
185
315
|
function finalizeTracePayload(payload) {
|
|
186
316
|
const { safe, dropped } = toJsonSafeReport(payload);
|
|
187
317
|
const collapsed = safe === null || typeof safe !== "object" || Array.isArray(safe);
|
|
188
|
-
const result = collapsed ? rebuildEnvelope(payload, "
|
|
318
|
+
const result = collapsed ? rebuildEnvelope(payload, "rawTrace", safe) : safe;
|
|
189
319
|
if (dropped.length > 0 || collapsed) {
|
|
190
320
|
const names = dropped.length > 0 ? [...new Set(dropped)].sort().join(", ") : "trace";
|
|
191
321
|
warnOnce(`finalizeTrace:${names.replace(/\d+/g, "N")}`, `a trace held non-serializable value(s) (${names}); they were captured as placeholders, so the trace may not be replayable.`);
|
|
@@ -371,7 +501,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
371
501
|
rawSpan
|
|
372
502
|
}, spanInfo.dropped);
|
|
373
503
|
try {
|
|
374
|
-
this.httpClient.
|
|
504
|
+
this.httpClient.sendSpanPayload(finalized);
|
|
375
505
|
} catch {}
|
|
376
506
|
}
|
|
377
507
|
sendTraceCompletion(endedAt, metadata) {
|
|
@@ -380,22 +510,22 @@ var BitfabClaudeAgentHandler = class {
|
|
|
380
510
|
const completed = this.activeContext === null;
|
|
381
511
|
const traceId = this.traceId;
|
|
382
512
|
this.traceId = null;
|
|
383
|
-
const
|
|
513
|
+
const rawTrace = {
|
|
384
514
|
id: traceId,
|
|
385
515
|
started_at: this.traceStartedAt ?? nowIso$1(),
|
|
386
516
|
ended_at: endedAt ?? nowIso$1()
|
|
387
517
|
};
|
|
388
|
-
if (metadata)
|
|
518
|
+
if (metadata) rawTrace.metadata = metadata;
|
|
389
519
|
const finalized = finalizeTracePayload({
|
|
390
520
|
id: traceId,
|
|
391
521
|
type: "sdk-function",
|
|
392
522
|
source: "typescript-sdk-claude-agent-sdk",
|
|
393
523
|
traceFunctionKey: this.traceFunctionKey,
|
|
394
|
-
|
|
524
|
+
rawTrace,
|
|
395
525
|
completed
|
|
396
526
|
});
|
|
397
527
|
try {
|
|
398
|
-
this.httpClient.
|
|
528
|
+
this.httpClient.sendTracePayload(finalized);
|
|
399
529
|
} catch {}
|
|
400
530
|
}
|
|
401
531
|
async preToolUseHook(inputData, toolUseId, _context) {
|
|
@@ -1838,7 +1968,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1838
1968
|
rawSpan
|
|
1839
1969
|
}, spanInfo.dropped);
|
|
1840
1970
|
try {
|
|
1841
|
-
this.httpClient.
|
|
1971
|
+
this.httpClient.sendSpanPayload(finalized);
|
|
1842
1972
|
} catch {}
|
|
1843
1973
|
}
|
|
1844
1974
|
sendTraceCompletion(rootSpan, activeContext) {
|
|
@@ -1849,7 +1979,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1849
1979
|
type: "sdk-function",
|
|
1850
1980
|
source: "typescript-sdk-langgraph",
|
|
1851
1981
|
traceFunctionKey: this.traceFunctionKey,
|
|
1852
|
-
|
|
1982
|
+
rawTrace: {
|
|
1853
1983
|
id: rootSpan.traceId,
|
|
1854
1984
|
started_at: rootSpan.startedAt,
|
|
1855
1985
|
ended_at: rootSpan.endedAt ?? nowIso()
|
|
@@ -1857,7 +1987,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1857
1987
|
completed
|
|
1858
1988
|
});
|
|
1859
1989
|
try {
|
|
1860
|
-
this.httpClient.
|
|
1990
|
+
this.httpClient.sendTracePayload(finalized);
|
|
1861
1991
|
} catch {}
|
|
1862
1992
|
}
|
|
1863
1993
|
sendTraceStart(rootSpan) {
|
|
@@ -1867,14 +1997,14 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1867
1997
|
type: "sdk-function",
|
|
1868
1998
|
source: "typescript-sdk-langgraph",
|
|
1869
1999
|
traceFunctionKey: this.traceFunctionKey,
|
|
1870
|
-
|
|
2000
|
+
rawTrace: {
|
|
1871
2001
|
id: rootSpan.traceId,
|
|
1872
2002
|
started_at: rootSpan.startedAt
|
|
1873
2003
|
},
|
|
1874
2004
|
completed: false
|
|
1875
2005
|
});
|
|
1876
2006
|
try {
|
|
1877
|
-
this.httpClient.
|
|
2007
|
+
this.httpClient.sendTracePayload(finalized);
|
|
1878
2008
|
} catch {}
|
|
1879
2009
|
}
|
|
1880
2010
|
async handleChainStart(chain, inputs, runId, parentRunIdOrRunType, tags, metadata, runTypeOrRunName, runNameOrParentRunId) {
|
|
@@ -3964,7 +4094,7 @@ function buildMockTree(rootNode) {
|
|
|
3964
4094
|
counters.set(counterKey, index + 1);
|
|
3965
4095
|
spans.set(`${counterKey}:${index}`, {
|
|
3966
4096
|
sourceSpanId: node.sourceSpanId,
|
|
3967
|
-
|
|
4097
|
+
spanId: node.spanId ?? node.externalSpanId,
|
|
3968
4098
|
output: node.output,
|
|
3969
4099
|
outputMeta: node.outputMeta
|
|
3970
4100
|
});
|
|
@@ -4008,7 +4138,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
|
|
|
4008
4138
|
if (serverItem.selectiveReplayPlan === void 0) throw new BitfabError("Server did not return a selective replay plan. Update the server or disable experimentalSelectiveReplay.");
|
|
4009
4139
|
selectiveReplay = new SelectiveReplayRuntime(serverItem.selectiveReplayPlan, selectiveOptions);
|
|
4010
4140
|
}
|
|
4011
|
-
const span = await httpClient.
|
|
4141
|
+
const span = await httpClient.getSpanRaw(originalSpanId, { view: "replay" });
|
|
4012
4142
|
const spanData = span.rawData?.span_data ?? {};
|
|
4013
4143
|
inputs = deserializeInputs(spanData);
|
|
4014
4144
|
originalOutput = deserializeOutput(spanData);
|
|
@@ -4039,11 +4169,11 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
|
|
|
4039
4169
|
mockTree = { spans: /* @__PURE__ */ new Map() };
|
|
4040
4170
|
}
|
|
4041
4171
|
const outputCache = /* @__PURE__ */ new Map();
|
|
4042
|
-
const fetchSpanOutput = mockTree && !includeOutputs ? (
|
|
4043
|
-
let pending = outputCache.get(
|
|
4172
|
+
const fetchSpanOutput = mockTree && !includeOutputs ? (spanId) => {
|
|
4173
|
+
let pending = outputCache.get(spanId);
|
|
4044
4174
|
if (!pending) {
|
|
4045
|
-
pending = httpClient.
|
|
4046
|
-
outputCache.set(
|
|
4175
|
+
pending = httpClient.getSpanRaw(spanId, { view: "replay" }).then((s) => deserializeOutput(s.rawData?.span_data ?? {}));
|
|
4176
|
+
outputCache.set(spanId, pending);
|
|
4047
4177
|
}
|
|
4048
4178
|
return pending;
|
|
4049
4179
|
} : void 0;
|
|
@@ -4076,7 +4206,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
|
|
|
4076
4206
|
experimentId,
|
|
4077
4207
|
traceId: replayedTraceId,
|
|
4078
4208
|
inputSourceSpanId: span.id,
|
|
4079
|
-
inputSourceTraceId: span.externalTraceId,
|
|
4209
|
+
inputSourceTraceId: span.traceId ?? span.externalTraceId,
|
|
4080
4210
|
sourceBitfabTraceId: originalTraceId,
|
|
4081
4211
|
replayAttempt: attempt,
|
|
4082
4212
|
mockTree,
|
|
@@ -5189,11 +5319,11 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
5189
5319
|
try {
|
|
5190
5320
|
const traceData = trace.toJSON();
|
|
5191
5321
|
if (options.sourceTraceId) traceData.id = options.sourceTraceId;
|
|
5192
|
-
this.httpClient.
|
|
5322
|
+
this.httpClient.sendTracePayload({
|
|
5193
5323
|
...options.id && { id: options.id },
|
|
5194
5324
|
type: "openai",
|
|
5195
5325
|
source: "typescript-sdk-openai-tracing",
|
|
5196
|
-
|
|
5326
|
+
rawTrace: traceData,
|
|
5197
5327
|
completed: options.completed ?? false
|
|
5198
5328
|
});
|
|
5199
5329
|
} catch {}
|
|
@@ -5275,7 +5405,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
5275
5405
|
const payload = this.buildSpanPayload(serializedSpan, errors);
|
|
5276
5406
|
const canonicalTraceId = span.traceId ? this.getCanonicalTraceId(span.traceId) : void 0;
|
|
5277
5407
|
if (canonicalTraceId) payload.traceId = canonicalTraceId;
|
|
5278
|
-
this.httpClient.
|
|
5408
|
+
this.httpClient.sendSpanPayload(payload);
|
|
5279
5409
|
}
|
|
5280
5410
|
};
|
|
5281
5411
|
//#endregion
|
|
@@ -5895,9 +6025,9 @@ var Bitfab = class {
|
|
|
5895
6025
|
getSimulationPlan: () => this.httpClient.getSimulationPlan(),
|
|
5896
6026
|
canRead: () => this.canReadSimulationPlan()
|
|
5897
6027
|
}, config.simulationPlan ?? true);
|
|
5898
|
-
this.httpClient.
|
|
5899
|
-
this.httpClient.
|
|
5900
|
-
this.httpClient.
|
|
6028
|
+
this.httpClient.spanPayloadTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
|
|
6029
|
+
this.httpClient.tracePayloadTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
|
|
6030
|
+
this.httpClient.releaseHeldSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
|
|
5901
6031
|
this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
|
|
5902
6032
|
if (this.findApiKey(false) !== void 0) this.simulationPlan.refresh();
|
|
5903
6033
|
this.datasets = new DatasetsClient(this.httpClient);
|
|
@@ -6711,7 +6841,7 @@ var Bitfab = class {
|
|
|
6711
6841
|
})();
|
|
6712
6842
|
};
|
|
6713
6843
|
const resolveRecordedOutput = () => {
|
|
6714
|
-
if (!(mockSpan?.output !== void 0 || mockSpan?.outputMeta !== void 0) && replayCtxForMock.fetchSpanOutput && mockSpan?.
|
|
6844
|
+
if (!(mockSpan?.output !== void 0 || mockSpan?.outputMeta !== void 0) && replayCtxForMock.fetchSpanOutput && mockSpan?.spanId) return replayCtxForMock.fetchSpanOutput(mockSpan.spanId);
|
|
6715
6845
|
if (!mockSpan) return Promise.reject(new BitfabError(`No recorded span to source output for "${traceFunctionKey}".`));
|
|
6716
6846
|
let output = mockSpan.output;
|
|
6717
6847
|
if (mockSpan.outputMeta !== void 0 && mockSpan.outputMeta !== null) output = deserializeValue({
|
|
@@ -6877,12 +7007,12 @@ var Bitfab = class {
|
|
|
6877
7007
|
accessed: params.dbSnapshotUsage.accessed,
|
|
6878
7008
|
...params.dbSnapshotUsage.timings && { timings: params.dbSnapshotUsage.timings }
|
|
6879
7009
|
};
|
|
6880
|
-
this.httpClient.
|
|
7010
|
+
this.httpClient.sendTracePayload({
|
|
6881
7011
|
id: params.traceId,
|
|
6882
7012
|
type: "sdk-function",
|
|
6883
7013
|
source: "typescript-sdk-function",
|
|
6884
7014
|
traceFunctionKey: params.traceFunctionKey,
|
|
6885
|
-
|
|
7015
|
+
rawTrace,
|
|
6886
7016
|
completed: true,
|
|
6887
7017
|
...params.dropped && { dropped: true },
|
|
6888
7018
|
...params.sessionId && { sessionId: params.sessionId },
|
|
@@ -6908,7 +7038,7 @@ var Bitfab = class {
|
|
|
6908
7038
|
const buildsContent = params.captureContent && !contentOff;
|
|
6909
7039
|
const serializedInputs = buildsContent ? serializeValue(params.inputs) : void 0;
|
|
6910
7040
|
const serializedResult = buildsContent ? serializeValue(params.result) : void 0;
|
|
6911
|
-
const
|
|
7041
|
+
const rawSpan = {
|
|
6912
7042
|
id: params.spanId,
|
|
6913
7043
|
trace_id: params.traceId,
|
|
6914
7044
|
started_at: params.startedAt,
|
|
@@ -6955,10 +7085,10 @@ var Bitfab = class {
|
|
|
6955
7085
|
...contentOff && { ["content_off_by_simulation_plan"]: true }
|
|
6956
7086
|
}
|
|
6957
7087
|
};
|
|
6958
|
-
if (params.parentSpanId)
|
|
6959
|
-
if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId)
|
|
6960
|
-
if (params.inputSourceSpanId)
|
|
6961
|
-
this.httpClient.
|
|
7088
|
+
if (params.parentSpanId) rawSpan.parent_id = params.parentSpanId;
|
|
7089
|
+
if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId) rawSpan.nearest_captured_ancestor_id = params.nearestCapturedAncestorSpanId;
|
|
7090
|
+
if (params.inputSourceSpanId) rawSpan.input_source_span_id = params.inputSourceSpanId;
|
|
7091
|
+
this.httpClient.sendSpanPayload({
|
|
6962
7092
|
id: params.spanId,
|
|
6963
7093
|
traceId: params.traceId,
|
|
6964
7094
|
type: "sdk-function",
|
|
@@ -6967,7 +7097,7 @@ var Bitfab = class {
|
|
|
6967
7097
|
traceFunctionKey: params.traceFunctionKey,
|
|
6968
7098
|
...params.rootTraceFunctionKey !== void 0 && { ["rootTraceFunctionKey"]: params.rootTraceFunctionKey },
|
|
6969
7099
|
...params.declaredNode === true && { ["declaredNode"]: true },
|
|
6970
|
-
rawSpan
|
|
7100
|
+
rawSpan,
|
|
6971
7101
|
...params.experimentId !== void 0 && experimentIdWireFields(params.experimentId),
|
|
6972
7102
|
...params.mocked && { mocked: true },
|
|
6973
7103
|
...params.mockTarget && { mockTarget: params.mockTarget },
|
|
@@ -7084,7 +7214,7 @@ var Bitfab = class {
|
|
|
7084
7214
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
7085
7215
|
} finally {
|
|
7086
7216
|
try {
|
|
7087
|
-
const { flushTraces } = await import("./http-
|
|
7217
|
+
const { flushTraces } = await import("./http-CDFhg9aQ.js").then((n) => n.a);
|
|
7088
7218
|
await flushTraces(3e4);
|
|
7089
7219
|
} finally {
|
|
7090
7220
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -7290,7 +7420,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
7290
7420
|
metadata: seedCase.metadata,
|
|
7291
7421
|
sessionId: seedCase.sessionId
|
|
7292
7422
|
}));
|
|
7293
|
-
const { flushTraces } = await import("./http-
|
|
7423
|
+
const { flushTraces } = await import("./http-CDFhg9aQ.js").then((n) => n.a);
|
|
7294
7424
|
await flushTraces(3e4);
|
|
7295
7425
|
return {
|
|
7296
7426
|
pipeline,
|
|
@@ -7307,4 +7437,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
7307
7437
|
//#endregion
|
|
7308
7438
|
export { VerdictsClient as A, OrganizationMembersClient as C, BitfabLangGraphCallbackHandler as D, BitfabLangGraphIntegration as E, GraderRerunTimeoutError as F, BitfabClaudeAgentHandler as I, DEFAULT_SERVICE_URL as L, SUPPORTED_PROVIDERS as M, DatasetsClient as N, GradersClient as O, GraderRerunError as P, AssertionCategoriesClient as R, BitfabPiIntegration as S, NO_MOCK_OVERRIDE as T, BITFAB_PROGRESS_PREFIX as _, Bitfab as a, reportReplayProgress as b, getCurrentSpan as c, BitfabOpenAITracingProcessor as d, AssertionGenerationError as f, BitfabRivetIntegration as g, SpansClient as h, finalizers as i, ExperimentsClient as j, LabelsClient as k, getCurrentTrace as l, TracesClient as m, reseedFromRegistry as n, BitfabFunction as o, AssertionGenerationTimeoutError as p, seedFromRegistry as r, getCurrentReplayBranch as s, defineReplayRegistry as t, BitfabVercelAiHandler as u, DbBranchReplayError as v, BitfabOpenAIAgentHandler as w, serializeReplayResult as x, ReplayError as y, CategoriesClient as z };
|
|
7309
7439
|
|
|
7310
|
-
//# sourceMappingURL=src-
|
|
7440
|
+
//# sourceMappingURL=src-DXFs6T8_.js.map
|