@bitfab/sdk 0.40.0 → 0.42.0
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-5NT4YDCQ.js → chunk-BC5OYWAM.js} +42 -13
- package/dist/chunk-BC5OYWAM.js.map +1 -0
- package/dist/{chunk-EXT5FK54.js → chunk-BG3A5HNC.js} +42 -12
- package/dist/chunk-BG3A5HNC.js.map +1 -0
- package/dist/{chunk-E2V4HFSM.js → chunk-QJ6IFPGU.js} +15 -6
- package/dist/chunk-QJ6IFPGU.js.map +1 -0
- package/dist/{chunk-A22EYRSY.js → chunk-UGFTBSGS.js} +15 -6
- package/dist/chunk-UGFTBSGS.js.map +1 -0
- package/dist/{http-2OFIGQOK.js → http-F5L466DI.js} +2 -2
- package/dist/{http-OZODCFFA.js → http-NZHGC5YF.js} +2 -2
- package/dist/index.cjs +93 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +3 -3
- package/dist/node.cjs +93 -25
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-352POXG3.js → replay-PLACY77M.js} +3 -3
- package/dist/replayCli.js +18 -4
- package/dist/replayCli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5NT4YDCQ.js.map +0 -1
- package/dist/chunk-A22EYRSY.js.map +0 -1
- package/dist/chunk-E2V4HFSM.js.map +0 -1
- package/dist/chunk-EXT5FK54.js.map +0 -1
- /package/dist/{http-2OFIGQOK.js.map → http-F5L466DI.js.map} +0 -0
- /package/dist/{http-OZODCFFA.js.map → http-NZHGC5YF.js.map} +0 -0
- /package/dist/{replay-352POXG3.js.map → replay-PLACY77M.js.map} +0 -0
package/dist/node.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace,
|
|
17
17
|
seedFromRegistry
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BC5OYWAM.js";
|
|
19
19
|
import "./chunk-ZUD7OFYB.js";
|
|
20
20
|
import {
|
|
21
21
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
ReplayError,
|
|
25
25
|
reportReplayProgress,
|
|
26
26
|
serializeReplayResult
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BG3A5HNC.js";
|
|
28
28
|
import {
|
|
29
29
|
BitfabError,
|
|
30
30
|
DEFAULT_SERVICE_URL,
|
|
31
31
|
HttpClient,
|
|
32
32
|
__version__,
|
|
33
33
|
flushTraces
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-UGFTBSGS.js";
|
|
35
35
|
import {
|
|
36
36
|
assertAsyncStorageRegistered,
|
|
37
37
|
registerAsyncLocalStorageClass
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
serializeReplayResult,
|
|
8
8
|
sleepForReplayPersistence,
|
|
9
9
|
waitForReplayPersistence
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-BG3A5HNC.js";
|
|
11
|
+
import "./chunk-UGFTBSGS.js";
|
|
12
12
|
import "./chunk-H6LZRFMN.js";
|
|
13
13
|
export {
|
|
14
14
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
sleepForReplayPersistence,
|
|
21
21
|
waitForReplayPersistence
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=replay-
|
|
23
|
+
//# sourceMappingURL=replay-PLACY77M.js.map
|
package/dist/replayCli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BitfabError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QJ6IFPGU.js";
|
|
5
5
|
|
|
6
6
|
// src/replayCli.ts
|
|
7
7
|
import { tsImport } from "tsx/esm/api";
|
|
@@ -71,6 +71,7 @@ function serializeReplayResult(result) {
|
|
|
71
71
|
// src/replayRegistry.ts
|
|
72
72
|
var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
73
73
|
"--limit",
|
|
74
|
+
"--attempts",
|
|
74
75
|
"--trace-ids",
|
|
75
76
|
"--name",
|
|
76
77
|
"--concurrency",
|
|
@@ -90,11 +91,13 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
90
91
|
"--dry-run"
|
|
91
92
|
]);
|
|
92
93
|
var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
|
|
94
|
+
var MAX_ATTEMPTS = 100;
|
|
93
95
|
function usage(registry) {
|
|
94
96
|
return `Usage: bitfab-replay --registry <path> <${Object.keys(registry).join("|")}> [options]
|
|
95
97
|
|
|
96
98
|
Options:
|
|
97
99
|
--limit N
|
|
100
|
+
--attempts N (replay each trace N times in this run, max ${MAX_ATTEMPTS})
|
|
98
101
|
--trace-ids id1,id2
|
|
99
102
|
--name NAME
|
|
100
103
|
--concurrency N, --max-concurrency N
|
|
@@ -149,7 +152,7 @@ async function seedFromRegistry(registry, pipeline, cases) {
|
|
|
149
152
|
sessionId: seedCase.sessionId
|
|
150
153
|
})
|
|
151
154
|
);
|
|
152
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
155
|
+
const { flushTraces: flushTraces2 } = await import("./http-NZHGC5YF.js");
|
|
153
156
|
await flushTraces2(3e4);
|
|
154
157
|
return { pipeline, traceFunctionKey, traceIds };
|
|
155
158
|
}
|
|
@@ -179,13 +182,16 @@ async function runSeedCli(registry, argv, io = {}) {
|
|
|
179
182
|
stdout(JSON.stringify(result, null, 2));
|
|
180
183
|
return result;
|
|
181
184
|
}
|
|
182
|
-
function requirePositiveInteger(flag, raw) {
|
|
185
|
+
function requirePositiveInteger(flag, raw, max) {
|
|
183
186
|
const value = Number(raw);
|
|
184
187
|
if (!Number.isInteger(value) || value < 1) {
|
|
185
188
|
throw new BitfabError(
|
|
186
189
|
`${flag} must be a positive integer (received '${raw}').`
|
|
187
190
|
);
|
|
188
191
|
}
|
|
192
|
+
if (max !== void 0 && value > max) {
|
|
193
|
+
throw new BitfabError(`${flag} must be at most ${max} (received '${raw}').`);
|
|
194
|
+
}
|
|
189
195
|
return value;
|
|
190
196
|
}
|
|
191
197
|
function commaSeparated(flag, raw) {
|
|
@@ -248,6 +254,9 @@ ${usage(registry)}`
|
|
|
248
254
|
case "--limit":
|
|
249
255
|
parsed.limit = requirePositiveInteger(flag, raw);
|
|
250
256
|
break;
|
|
257
|
+
case "--attempts":
|
|
258
|
+
parsed.attempts = requirePositiveInteger(flag, raw, MAX_ATTEMPTS);
|
|
259
|
+
break;
|
|
251
260
|
case "--trace-ids":
|
|
252
261
|
parsed.traceIds = commaSeparated(flag, raw);
|
|
253
262
|
break;
|
|
@@ -395,6 +404,9 @@ function renderSummary(pipeline, result, stderr) {
|
|
|
395
404
|
stderr("\n\u2500\u2500\u2500 Summary \u2500\u2500\u2500");
|
|
396
405
|
stderr(` Pipeline: ${pipeline}`);
|
|
397
406
|
stderr(` Replayed: ${result.items.length}`);
|
|
407
|
+
if (result.attempts > 1) {
|
|
408
|
+
stderr(` Attempts: ${result.attempts}`);
|
|
409
|
+
}
|
|
398
410
|
if (same > 0 || changed > 0 || matched + missed === 0) {
|
|
399
411
|
stderr(` Same: ${same}`);
|
|
400
412
|
stderr(` Changed: ${changed}`);
|
|
@@ -457,6 +469,7 @@ async function runReplayCli(registry, argv = typeof process === "undefined" ? []
|
|
|
457
469
|
const options = {
|
|
458
470
|
...registrationOptions,
|
|
459
471
|
...args.name === void 0 ? {} : { name: args.name },
|
|
472
|
+
...args.attempts === void 0 ? {} : { attempts: args.attempts },
|
|
460
473
|
...args.maxConcurrency === void 0 ? {} : { maxConcurrency: args.maxConcurrency },
|
|
461
474
|
...args.experimentGroupId === void 0 ? {} : { experimentGroupId: args.experimentGroupId },
|
|
462
475
|
...args.datasetId === void 0 ? {} : { datasetId: args.datasetId },
|
|
@@ -490,8 +503,9 @@ async function runReplayCli(registry, argv = typeof process === "undefined" ? []
|
|
|
490
503
|
} else {
|
|
491
504
|
options.limit = registrationOptions.limit ?? 10;
|
|
492
505
|
}
|
|
506
|
+
const attemptsSuffix = options.attempts !== void 0 && options.attempts > 1 ? ` (${options.attempts} attempts each)` : "";
|
|
493
507
|
stderr(
|
|
494
|
-
`[replay] ${args.dryRun === true ? "Resolving inputs for" : "Replaying"} ${options.traceIds?.length ?? options.limit ?? "dataset"} traces from "${traceFunctionKey}"...`
|
|
508
|
+
`[replay] ${args.dryRun === true ? "Resolving inputs for" : "Replaying"} ${options.traceIds?.length ?? options.limit ?? "dataset"} traces from "${traceFunctionKey}"${attemptsSuffix}...`
|
|
495
509
|
);
|
|
496
510
|
try {
|
|
497
511
|
const result = await registration.client.replay(
|