@bitfab/sdk 0.76.0 → 0.76.2

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/replayCli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-D1VgfJjC.js";
2
+ import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-M1u4H9PI.js";
3
3
  //#region src/cloudReplayCli.ts
4
4
  const CLOUD_REPLAY_HINT = "Add --cloud to run the same replay on GitHub Actions; bitfab-replay --cloud --help explains it.";
5
5
  function isCloudReplayCommand(argv) {
package/dist/seedCli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-D1VgfJjC.js";
2
+ import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-M1u4H9PI.js";
3
3
  //#region src/seedCli.ts
4
4
  const USAGE = "Usage: bitfab-seed --registry <path> <pipeline> --from-trace <id>[,<id>...]\n bitfab-seed --registry <path> <pipeline> --cases <cases.jsonl> [--run]\nRun bitfab-seed --registry <path> <pipeline> --help for details.";
5
5
  async function runSeedCommand(argv, io = {}, importer = importRegistry) {
@@ -1,5 +1,5 @@
1
1
  const require_bamlPeer = require("./bamlPeer-5Ohpq8q9.cjs");
2
- const require_http = require("./http-CWOvmnGL.cjs");
2
+ const require_http = require("./http-DscPFMlr.cjs");
3
3
  const require_autoTrace = require("./autoTrace-pZKu5Nk2.cjs");
4
4
  const require_optionalPeer = require("./optionalPeer-CUH756lt.cjs");
5
5
  let superjson = require("superjson");
@@ -4022,22 +4022,10 @@ function errorMessage(error) {
4022
4022
  }
4023
4023
  function replayItemErrorMessage(error) {
4024
4024
  if (error instanceof DbBranchReplayError) return `Replay requested a database branch for trace ${error.originalTraceId} but it could not be resolved (${error.code}): ${error.message}. The function was not run, because replaying it against the live database would produce a result that looks valid but did not use the historical data you asked for.`;
4025
- return errorMessage(error);
4025
+ return require_http.describeError(error);
4026
4026
  }
4027
4027
  function replayJsonReplacer(_key, value) {
4028
- if (value instanceof Error) {
4029
- const serialized = {
4030
- name: value.name,
4031
- message: value.message,
4032
- stack: value.stack
4033
- };
4034
- if (value instanceof DbBranchReplayError) {
4035
- serialized.code = value.code;
4036
- serialized.originalTraceId = value.originalTraceId;
4037
- if (value.cause !== void 0) serialized.cause = value.cause;
4038
- }
4039
- return serialized;
4040
- }
4028
+ if (value instanceof Error) return require_http.serializeError(value, (error) => error instanceof DbBranchReplayError ? { originalTraceId: error.originalTraceId } : {});
4041
4029
  return value;
4042
4030
  }
4043
4031
  function serializeReplayResult(result) {
@@ -4216,7 +4204,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4216
4204
  } catch (e) {
4217
4205
  if (replayStarted !== null) replayDurationMs = Math.round(performance.now() - replayStarted);
4218
4206
  traceError = e;
4219
- error = errorMessage(e);
4207
+ error = require_http.describeError(e);
4220
4208
  }
4221
4209
  } catch (e) {
4222
4210
  if (replayStarted !== null) replayDurationMs = Math.round(performance.now() - replayStarted);
@@ -5700,7 +5688,7 @@ function wrapAsyncGenerator(source, spanStack, sendSpan, recordYielded) {
5700
5688
  } else yielded.push(result.value);
5701
5689
  return result;
5702
5690
  } catch (error) {
5703
- finalize(error instanceof Error ? error.message : String(error));
5691
+ finalize(require_http.describeError(error));
5704
5692
  throw error;
5705
5693
  }
5706
5694
  };
@@ -5863,10 +5851,12 @@ function isSpanType(value) {
5863
5851
  const noOpSpan = {
5864
5852
  id: "",
5865
5853
  traceId: "",
5854
+ traceFunctionKeys: [],
5866
5855
  addContext() {},
5867
5856
  setPrompt() {}
5868
5857
  };
5869
5858
  const noOpTrace = {
5859
+ traceFunctionKey: "",
5870
5860
  setSessionId() {},
5871
5861
  setName() {},
5872
5862
  setMetadata() {},
@@ -5881,6 +5871,9 @@ function currentTraceRootSpan() {
5881
5871
  if (context?.isRoot && context.traceId === traceId) return context;
5882
5872
  }
5883
5873
  }
5874
+ function activeTraceFunctionKeys(stack) {
5875
+ return [.../* @__PURE__ */ new Set([...require_autoTrace.currentAutoTraceEntries().map((entry) => entry.context.traceFunctionKey), ...stack.map((context) => context.traceFunctionKey)])];
5876
+ }
5884
5877
  function getCurrentSpan() {
5885
5878
  const stack = getSpanStack();
5886
5879
  const current = stack[stack.length - 1];
@@ -5888,6 +5881,7 @@ function getCurrentSpan() {
5888
5881
  return {
5889
5882
  id: current.spanId,
5890
5883
  traceId: current.traceId,
5884
+ traceFunctionKeys: activeTraceFunctionKeys(stack),
5891
5885
  addContext(context) {
5892
5886
  try {
5893
5887
  if (typeof context !== "object" || context === null) return;
@@ -5927,6 +5921,7 @@ function getCurrentTrace() {
5927
5921
  return traceState;
5928
5922
  };
5929
5923
  return {
5924
+ traceFunctionKey: current.rootTraceFunctionKey,
5930
5925
  setSessionId(sessionId) {
5931
5926
  try {
5932
5927
  const traceState = getOrCreateTraceState();
@@ -6663,6 +6658,7 @@ var Bitfab = class {
6663
6658
  spanId,
6664
6659
  details: options.spanDetails ?? { contexts: [] },
6665
6660
  spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
6661
+ traceFunctionKey,
6666
6662
  rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(traceId, traceFunctionKey),
6667
6663
  instrumentation: options.instrumentation ?? "span",
6668
6664
  declaredNode: options.declaredNode === true,
@@ -6788,7 +6784,7 @@ var Bitfab = class {
6788
6784
  } catch (error) {
6789
6785
  sendSpan({
6790
6786
  result: void 0,
6791
- error: error instanceof Error ? error.message : String(error)
6787
+ error: require_http.describeError(error)
6792
6788
  });
6793
6789
  throw error;
6794
6790
  }
@@ -6798,7 +6794,7 @@ var Bitfab = class {
6798
6794
  }).catch((error) => {
6799
6795
  sendSpan({
6800
6796
  result: void 0,
6801
- error: error instanceof Error ? error.message : String(error)
6797
+ error: require_http.describeError(error)
6802
6798
  });
6803
6799
  throw error;
6804
6800
  });
@@ -7232,7 +7228,7 @@ var Bitfab = class {
7232
7228
  await runWithSeedContext({ traceId }, async () => target(...args));
7233
7229
  } finally {
7234
7230
  try {
7235
- const { flushTraces } = await Promise.resolve().then(() => require("./http-CWOvmnGL.cjs")).then((n) => n.http_exports);
7231
+ const { flushTraces } = await Promise.resolve().then(() => require("./http-DscPFMlr.cjs")).then((n) => n.http_exports);
7236
7232
  await flushTraces(3e4);
7237
7233
  } finally {
7238
7234
  unrecorded = activeTraceStates.delete(traceId);
@@ -7450,7 +7446,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
7450
7446
  metadata: seedCase.metadata,
7451
7447
  sessionId: seedCase.sessionId
7452
7448
  }));
7453
- const { flushTraces } = await Promise.resolve().then(() => require("./http-CWOvmnGL.cjs")).then((n) => n.http_exports);
7449
+ const { flushTraces } = await Promise.resolve().then(() => require("./http-DscPFMlr.cjs")).then((n) => n.http_exports);
7454
7450
  await flushTraces(3e4);
7455
7451
  return {
7456
7452
  pipeline,
@@ -7700,4 +7696,4 @@ Object.defineProperty(exports, "serializeReplayResult", {
7700
7696
  }
7701
7697
  });
7702
7698
 
7703
- //# sourceMappingURL=src-CxsswRYd.cjs.map
7699
+ //# sourceMappingURL=src-B6zSnPpb.cjs.map