bitfab 0.64.0 → 0.64.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/cloudReplay.py +5 -24
- package/dist/{chunk-ANMDH7EL.js → chunk-ENORQO5K.js} +50 -16
- package/dist/chunk-ENORQO5K.js.map +1 -0
- package/dist/{chunk-LQ3IEVZK.js → chunk-FX4X7LOW.js} +52 -4
- package/dist/{chunk-LQ3IEVZK.js.map → chunk-FX4X7LOW.js.map} +1 -1
- package/dist/{chunk-IYZRISE3.js → chunk-GLWAET3G.js} +2 -2
- package/dist/{chunk-U5RNB7LF.js → chunk-O632VPWV.js} +3 -2
- package/dist/{chunk-U5RNB7LF.js.map → chunk-O632VPWV.js.map} +1 -1
- package/dist/{chunk-ZKP65VBL.js → chunk-XHUW3NY6.js} +2 -2
- package/dist/{chunk-ZKP65VBL.js.map → chunk-XHUW3NY6.js.map} +1 -1
- package/dist/{http-EACAYPVT.js → http-IOT2GDD2.js} +2 -2
- package/dist/{http-LGRICPE6.js → http-MFXRJ6RS.js} +2 -2
- package/dist/index.cjs +46 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/node.cjs +46 -11
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-4XNNKZ6T.js → replay-QZQYRTAO.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-ANMDH7EL.js.map +0 -1
- /package/dist/{chunk-IYZRISE3.js.map → chunk-GLWAET3G.js.map} +0 -0
- /package/dist/{http-EACAYPVT.js.map → http-IOT2GDD2.js.map} +0 -0
- /package/dist/{http-LGRICPE6.js.map → http-MFXRJ6RS.js.map} +0 -0
- /package/dist/{replay-4XNNKZ6T.js.map → replay-QZQYRTAO.js.map} +0 -0
package/cloudReplay.py
CHANGED
|
@@ -413,7 +413,7 @@ def configure_secrets(argv):
|
|
|
413
413
|
*(["--env", environment] if environment else []),
|
|
414
414
|
],
|
|
415
415
|
input=values.get(name, values.get(targets[name])),
|
|
416
|
-
env=
|
|
416
|
+
env={**os.environ, "GH_TOKEN": token},
|
|
417
417
|
)
|
|
418
418
|
result["set"] = [targets[name] for name in found]
|
|
419
419
|
if missing or empty:
|
|
@@ -425,8 +425,9 @@ def configure_secrets(argv):
|
|
|
425
425
|
def github_access():
|
|
426
426
|
if shutil.which("gh") is not None:
|
|
427
427
|
with contextlib.suppress(RuntimeError, OSError, subprocess.SubprocessError):
|
|
428
|
-
command(["gh", "auth", "
|
|
429
|
-
|
|
428
|
+
token = command(["gh", "auth", "token", "--hostname", "github.com"])
|
|
429
|
+
if token:
|
|
430
|
+
return {"source": "the GitHub CLI", "token": token}
|
|
430
431
|
for name in ("GH_TOKEN", "GITHUB_TOKEN"):
|
|
431
432
|
if os.environ.get(name):
|
|
432
433
|
return {"source": name, "token": os.environ[name]}
|
|
@@ -467,26 +468,6 @@ def api(repo, suffix, *, method="GET", payload=None, raw=False):
|
|
|
467
468
|
path = f"repos/{repo}" + (f"/{suffix}" if suffix else "")
|
|
468
469
|
access = github_access()
|
|
469
470
|
data = None if payload is None else json.dumps(payload)
|
|
470
|
-
if access["token"] is None:
|
|
471
|
-
result = command(
|
|
472
|
-
[
|
|
473
|
-
"gh",
|
|
474
|
-
"api",
|
|
475
|
-
"--hostname",
|
|
476
|
-
"github.com",
|
|
477
|
-
"-H",
|
|
478
|
-
f"X-GitHub-Api-Version: {API_VERSION}",
|
|
479
|
-
*([] if raw else ["--jq", "tojson"]),
|
|
480
|
-
path,
|
|
481
|
-
"--method",
|
|
482
|
-
method,
|
|
483
|
-
*(["--input", "-"] if data is not None else []),
|
|
484
|
-
],
|
|
485
|
-
input=data,
|
|
486
|
-
)
|
|
487
|
-
if raw:
|
|
488
|
-
return result
|
|
489
|
-
return json.loads(result) if result else None
|
|
490
471
|
request = urllib.request.Request(
|
|
491
472
|
f"https://api.github.com/{path}",
|
|
492
473
|
method=method,
|
|
@@ -512,7 +493,7 @@ def api(repo, suffix, *, method="GET", payload=None, raw=False):
|
|
|
512
493
|
raise CommandError(
|
|
513
494
|
"Python cannot verify GitHub's certificate because it has no certificate store. "
|
|
514
495
|
"On a python.org install, run Install Certificates.command from its Applications folder, "
|
|
515
|
-
"set SSL_CERT_FILE to a certificate bundle
|
|
496
|
+
"or set SSL_CERT_FILE to a certificate bundle"
|
|
516
497
|
) from None
|
|
517
498
|
raise CommandError(f"Could not reach api.github.com: {reason}") from None
|
|
518
499
|
if raw:
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
serializeValue,
|
|
18
18
|
toJsonSafe,
|
|
19
19
|
toJsonSafeReport
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GLWAET3G.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
CONTENT_OFF_KEY,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
readEnv,
|
|
37
37
|
recordCallerTraceMetadata,
|
|
38
38
|
retireTraceMetadata
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-XHUW3NY6.js";
|
|
40
40
|
import {
|
|
41
41
|
__privateAdd,
|
|
42
42
|
__privateGet,
|
|
@@ -3906,6 +3906,22 @@ var BitfabVercelAiHandler = class {
|
|
|
3906
3906
|
};
|
|
3907
3907
|
|
|
3908
3908
|
// src/client.ts
|
|
3909
|
+
function markTracedFunction(target, traceFunctionKey, original) {
|
|
3910
|
+
Object.defineProperty(target, "_bitfabTraceFunctionKey", {
|
|
3911
|
+
value: traceFunctionKey
|
|
3912
|
+
});
|
|
3913
|
+
Object.defineProperty(target, "_bitfabWrappedFn", { value: original });
|
|
3914
|
+
Object.defineProperty(target, "bind", {
|
|
3915
|
+
value(thisArg, ...boundArgs) {
|
|
3916
|
+
return markTracedFunction(
|
|
3917
|
+
Function.prototype.bind.call(this, thisArg, ...boundArgs),
|
|
3918
|
+
traceFunctionKey,
|
|
3919
|
+
original
|
|
3920
|
+
);
|
|
3921
|
+
}
|
|
3922
|
+
});
|
|
3923
|
+
return target;
|
|
3924
|
+
}
|
|
3909
3925
|
function resolveSpanExperimentId(options) {
|
|
3910
3926
|
const { experimentId, testRunId } = options;
|
|
3911
3927
|
if (experimentId !== void 0 && testRunId !== void 0 && experimentId !== testRunId) {
|
|
@@ -4756,11 +4772,7 @@ var Bitfab = class {
|
|
|
4756
4772
|
}
|
|
4757
4773
|
);
|
|
4758
4774
|
};
|
|
4759
|
-
|
|
4760
|
-
value: traceFunctionKey
|
|
4761
|
-
});
|
|
4762
|
-
Object.defineProperty(autoTraceRoot, "_bitfabWrappedFn", { value: fn });
|
|
4763
|
-
return autoTraceRoot;
|
|
4775
|
+
return markTracedFunction(autoTraceRoot, traceFunctionKey, fn);
|
|
4764
4776
|
}
|
|
4765
4777
|
applySimulationPlan(payload, submit, drop) {
|
|
4766
4778
|
this.simulationPlan.send(
|
|
@@ -5775,11 +5787,7 @@ var Bitfab = class {
|
|
|
5775
5787
|
}
|
|
5776
5788
|
return runWithSpanStack(newStack, executeWithContext);
|
|
5777
5789
|
};
|
|
5778
|
-
|
|
5779
|
-
value: traceFunctionKey
|
|
5780
|
-
});
|
|
5781
|
-
Object.defineProperty(wrappedFn, "_bitfabWrappedFn", { value: fn });
|
|
5782
|
-
return wrappedFn;
|
|
5790
|
+
return markTracedFunction(wrappedFn, traceFunctionKey, fn);
|
|
5783
5791
|
}
|
|
5784
5792
|
/**
|
|
5785
5793
|
* Create a standard ECMAScript method decorator that records each invocation
|
|
@@ -6245,7 +6253,7 @@ var Bitfab = class {
|
|
|
6245
6253
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6246
6254
|
} finally {
|
|
6247
6255
|
try {
|
|
6248
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6256
|
+
const { flushTraces: flushTraces2 } = await import("./http-MFXRJ6RS.js");
|
|
6249
6257
|
await flushTraces2(3e4);
|
|
6250
6258
|
} finally {
|
|
6251
6259
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6304,7 +6312,7 @@ var Bitfab = class {
|
|
|
6304
6312
|
`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.`
|
|
6305
6313
|
);
|
|
6306
6314
|
}
|
|
6307
|
-
const { replay: doReplay } = await import("./replay-
|
|
6315
|
+
const { replay: doReplay } = await import("./replay-QZQYRTAO.js");
|
|
6308
6316
|
return doReplay(
|
|
6309
6317
|
this.httpClient,
|
|
6310
6318
|
this.serviceUrl,
|
|
@@ -6574,8 +6582,34 @@ var finalizers = {
|
|
|
6574
6582
|
|
|
6575
6583
|
// src/replayRegistry.ts
|
|
6576
6584
|
function defineReplayRegistry(registry) {
|
|
6585
|
+
validateReplayRegistry(registry);
|
|
6577
6586
|
return registry;
|
|
6578
6587
|
}
|
|
6588
|
+
var REGISTRATION_FIELDS = /* @__PURE__ */ new Set([
|
|
6589
|
+
"client",
|
|
6590
|
+
"fn",
|
|
6591
|
+
"traceFunctionKey",
|
|
6592
|
+
"options",
|
|
6593
|
+
"optionsFactory"
|
|
6594
|
+
]);
|
|
6595
|
+
function validateReplayRegistry(registry) {
|
|
6596
|
+
for (const [pipeline, registration] of Object.entries(registry)) {
|
|
6597
|
+
if (typeof registration !== "object" || registration === null) {
|
|
6598
|
+
throw new BitfabError(
|
|
6599
|
+
`Replay registry entry '${pipeline}' must be an object with client and fn.`
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
6602
|
+
const unknownFields = Object.keys(registration).filter(
|
|
6603
|
+
(field) => !REGISTRATION_FIELDS.has(field)
|
|
6604
|
+
);
|
|
6605
|
+
if (unknownFields.length > 0) {
|
|
6606
|
+
warnOnce(
|
|
6607
|
+
`replay-registry-unknown-fields:${pipeline}:${unknownFields.join(",")}`,
|
|
6608
|
+
`Replay registry entry '${pipeline}' has unknown field(s): ${unknownFields.join(", ")}. They are ignored. An entry takes client, fn, traceFunctionKey, options, and optionsFactory. Put replay options such as adaptInputs, mock, and mockOverride inside options. A later SDK release will reject unknown fields.`
|
|
6609
|
+
);
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6579
6613
|
async function reseedFromRegistry(registry, pipeline, traceIds) {
|
|
6580
6614
|
const registration = registry[pipeline];
|
|
6581
6615
|
if (registration === void 0) {
|
|
@@ -6624,7 +6658,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6624
6658
|
sessionId: seedCase.sessionId
|
|
6625
6659
|
})
|
|
6626
6660
|
);
|
|
6627
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6661
|
+
const { flushTraces: flushTraces2 } = await import("./http-MFXRJ6RS.js");
|
|
6628
6662
|
await flushTraces2(3e4);
|
|
6629
6663
|
return { pipeline, traceFunctionKey, traceIds };
|
|
6630
6664
|
}
|
|
@@ -6669,4 +6703,4 @@ export {
|
|
|
6669
6703
|
reseedFromRegistry,
|
|
6670
6704
|
seedFromRegistry
|
|
6671
6705
|
};
|
|
6672
|
-
//# sourceMappingURL=chunk-
|
|
6706
|
+
//# sourceMappingURL=chunk-ENORQO5K.js.map
|