@bitfab/sdk 0.53.5 → 0.54.1
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-PAL7VIWM.js → chunk-62QECZTW.js} +3 -103
- package/dist/chunk-62QECZTW.js.map +1 -0
- package/dist/{chunk-IDQBDBNS.js → chunk-MPDLQZKN.js} +3 -3
- package/dist/{chunk-Q7IB5VFZ.js → chunk-N7XDJ4JB.js} +39 -7
- package/dist/chunk-N7XDJ4JB.js.map +1 -0
- package/dist/{chunk-RMATODGT.js → chunk-RHTBP65M.js} +193 -2
- package/dist/chunk-RHTBP65M.js.map +1 -0
- package/dist/{chunk-BOXLWX73.js → chunk-Y3KWBCPW.js} +194 -2
- package/dist/chunk-Y3KWBCPW.js.map +1 -0
- package/dist/{http-3WOABXYN.js → http-AEBCU2LL.js} +2 -2
- package/dist/{http-6F3OLGWX.js → http-HOR6ODCZ.js} +2 -2
- package/dist/index.cjs +258 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -4
- package/dist/index.d.ts +38 -4
- package/dist/index.js +5 -3
- package/dist/node.cjs +258 -126
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-HVLPMPVQ.js → replay-RSLDR75H.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-BOXLWX73.js.map +0 -1
- package/dist/chunk-PAL7VIWM.js.map +0 -1
- package/dist/chunk-Q7IB5VFZ.js.map +0 -1
- package/dist/chunk-RMATODGT.js.map +0 -1
- /package/dist/{chunk-IDQBDBNS.js.map → chunk-MPDLQZKN.js.map} +0 -0
- /package/dist/{http-3WOABXYN.js.map → http-AEBCU2LL.js.map} +0 -0
- /package/dist/{http-6F3OLGWX.js.map → http-HOR6ODCZ.js.map} +0 -0
- /package/dist/{replay-HVLPMPVQ.js.map → replay-RSLDR75H.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.
|
|
45
|
+
__version__ = "0.54.1";
|
|
46
46
|
__packageName__ = "@bitfab/sdk";
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -186,6 +186,206 @@ var init_errors = __esm({
|
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
+
// src/gitCommand.ts
|
|
190
|
+
function isUnrefable(value) {
|
|
191
|
+
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
192
|
+
}
|
|
193
|
+
function unrefStream(stream) {
|
|
194
|
+
if (isUnrefable(stream)) {
|
|
195
|
+
stream.unref();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function terminate(child) {
|
|
199
|
+
if (child.pid && process.platform !== "win32") {
|
|
200
|
+
try {
|
|
201
|
+
process.kill(-child.pid, "SIGTERM");
|
|
202
|
+
return;
|
|
203
|
+
} catch {
|
|
204
|
+
child.kill("SIGTERM");
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
child.kill("SIGTERM");
|
|
209
|
+
}
|
|
210
|
+
async function gitRunner(options) {
|
|
211
|
+
let spawn;
|
|
212
|
+
try {
|
|
213
|
+
;
|
|
214
|
+
({ spawn } = await import("child_process"));
|
|
215
|
+
} catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
return (dir, args, env) => new Promise((resolve) => {
|
|
219
|
+
let child;
|
|
220
|
+
try {
|
|
221
|
+
child = spawn("git", args, {
|
|
222
|
+
cwd: dir,
|
|
223
|
+
detached: process.platform !== "win32",
|
|
224
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
225
|
+
...env ? { env: { ...process.env, ...env } } : {}
|
|
226
|
+
});
|
|
227
|
+
} catch {
|
|
228
|
+
resolve(null);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const chunks = [];
|
|
232
|
+
let size = 0;
|
|
233
|
+
let overflow = false;
|
|
234
|
+
let exitCode = null;
|
|
235
|
+
let done = false;
|
|
236
|
+
const timers = [];
|
|
237
|
+
const schedule = (callback, ms) => {
|
|
238
|
+
const timer = setTimeout(callback, ms);
|
|
239
|
+
if (!options.keepProcessAlive) {
|
|
240
|
+
timer.unref();
|
|
241
|
+
}
|
|
242
|
+
timers.push(timer);
|
|
243
|
+
};
|
|
244
|
+
const finish = () => {
|
|
245
|
+
if (done) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
done = true;
|
|
249
|
+
for (const timer of timers) {
|
|
250
|
+
clearTimeout(timer);
|
|
251
|
+
}
|
|
252
|
+
child.stdout?.destroy();
|
|
253
|
+
child.stderr?.destroy();
|
|
254
|
+
resolve(
|
|
255
|
+
exitCode === 0 && !overflow ? Buffer.concat(chunks).toString("utf8") : null
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
child.stdout?.on("data", (chunk) => {
|
|
259
|
+
size += chunk.length;
|
|
260
|
+
if (size > options.maxBuffer) {
|
|
261
|
+
overflow = true;
|
|
262
|
+
terminate(child);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
chunks.push(chunk);
|
|
266
|
+
});
|
|
267
|
+
child.stderr?.resume();
|
|
268
|
+
child.on("error", () => {
|
|
269
|
+
exitCode = null;
|
|
270
|
+
finish();
|
|
271
|
+
});
|
|
272
|
+
child.on("exit", (code) => {
|
|
273
|
+
exitCode = code;
|
|
274
|
+
schedule(finish, EXIT_GRACE_MS);
|
|
275
|
+
});
|
|
276
|
+
child.on("close", (code) => {
|
|
277
|
+
exitCode = code ?? exitCode;
|
|
278
|
+
finish();
|
|
279
|
+
});
|
|
280
|
+
schedule(() => terminate(child), options.timeoutMs);
|
|
281
|
+
if (!options.keepProcessAlive) {
|
|
282
|
+
child.unref();
|
|
283
|
+
unrefStream(child.stdout);
|
|
284
|
+
unrefStream(child.stderr);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
var EXIT_GRACE_MS;
|
|
289
|
+
var init_gitCommand = __esm({
|
|
290
|
+
"src/gitCommand.ts"() {
|
|
291
|
+
"use strict";
|
|
292
|
+
EXIT_GRACE_MS = 500;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// src/gitState.ts
|
|
297
|
+
function sha(value) {
|
|
298
|
+
const trimmed = value?.trim();
|
|
299
|
+
return trimmed && SHA_PATTERN.test(trimmed) ? trimmed : null;
|
|
300
|
+
}
|
|
301
|
+
function text(value) {
|
|
302
|
+
const trimmed = value?.trim();
|
|
303
|
+
return trimmed ? trimmed : null;
|
|
304
|
+
}
|
|
305
|
+
function isEmptyGitState(state) {
|
|
306
|
+
return Object.values(state).every((value) => value === null);
|
|
307
|
+
}
|
|
308
|
+
async function resolveGitState(cwd) {
|
|
309
|
+
const git = await gitRunner({
|
|
310
|
+
timeoutMs: GIT_TIMEOUT_MS,
|
|
311
|
+
maxBuffer: GIT_MAX_BUFFER,
|
|
312
|
+
keepProcessAlive: true
|
|
313
|
+
});
|
|
314
|
+
if (!git) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const run = async (args, env) => (await git(cwd, args, env))?.trim() ?? null;
|
|
318
|
+
const [refs, email, branch] = await Promise.all([
|
|
319
|
+
run(["rev-parse", "--show-toplevel", "HEAD", "HEAD^{tree}"]),
|
|
320
|
+
run(["config", "user.email"]),
|
|
321
|
+
run(["symbolic-ref", "--short", "-q", "HEAD"])
|
|
322
|
+
]);
|
|
323
|
+
const [root, commitSha, baseSha] = (refs ?? "").split("\n");
|
|
324
|
+
if (!root) {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
const state = {
|
|
328
|
+
githubEmail: text(email),
|
|
329
|
+
branch: text(branch),
|
|
330
|
+
commitSha: sha(commitSha),
|
|
331
|
+
baseSha: sha(baseSha),
|
|
332
|
+
experimentSha: await resolveWorkingTreeSha(run, root.trim())
|
|
333
|
+
};
|
|
334
|
+
return isEmptyGitState(state) ? null : state;
|
|
335
|
+
}
|
|
336
|
+
async function resolveWorkingTreeSha(run, root) {
|
|
337
|
+
let indexPath;
|
|
338
|
+
let cleanup;
|
|
339
|
+
try {
|
|
340
|
+
const { mkdtemp, rm } = await import("fs/promises");
|
|
341
|
+
const { join } = await import("path");
|
|
342
|
+
const { tmpdir } = await import("os");
|
|
343
|
+
const dir = await mkdtemp(join(tmpdir(), "bitfab-git-"));
|
|
344
|
+
indexPath = join(dir, "index");
|
|
345
|
+
cleanup = () => rm(dir, { recursive: true, force: true });
|
|
346
|
+
} catch {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
const env = { GIT_INDEX_FILE: indexPath };
|
|
351
|
+
if (await run(["read-tree", "HEAD"], env) === null) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
if (await run(["add", "-A", "--", root], env) === null) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
return sha(await run(["write-tree"], env));
|
|
358
|
+
} catch {
|
|
359
|
+
return null;
|
|
360
|
+
} finally {
|
|
361
|
+
await cleanup().catch(() => {
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function resolvedGitState() {
|
|
366
|
+
if (typeof process === "undefined" || process.env?.[DISABLE_ENV]) {
|
|
367
|
+
return Promise.resolve(null);
|
|
368
|
+
}
|
|
369
|
+
let cwd;
|
|
370
|
+
try {
|
|
371
|
+
cwd = process.cwd?.() ?? ".";
|
|
372
|
+
} catch {
|
|
373
|
+
return Promise.resolve(null);
|
|
374
|
+
}
|
|
375
|
+
return resolveGitState(cwd).catch(() => null);
|
|
376
|
+
}
|
|
377
|
+
var GIT_TIMEOUT_MS, GIT_MAX_BUFFER, DISABLE_ENV, SHA_PATTERN;
|
|
378
|
+
var init_gitState = __esm({
|
|
379
|
+
"src/gitState.ts"() {
|
|
380
|
+
"use strict";
|
|
381
|
+
init_gitCommand();
|
|
382
|
+
GIT_TIMEOUT_MS = 3e4;
|
|
383
|
+
GIT_MAX_BUFFER = 1024 * 1024;
|
|
384
|
+
DISABLE_ENV = "BITFAB_DISABLE_GIT_STATE";
|
|
385
|
+
SHA_PATTERN = /^[0-9a-f]{40}$/;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
189
389
|
// src/asyncStorage.ts
|
|
190
390
|
function registerAsyncLocalStorageClass(cls) {
|
|
191
391
|
if (!AsyncLocalStorageClass) {
|
|
@@ -1946,6 +2146,7 @@ var init_http = __esm({
|
|
|
1946
2146
|
init_compress();
|
|
1947
2147
|
init_constants();
|
|
1948
2148
|
init_errors();
|
|
2149
|
+
init_gitState();
|
|
1949
2150
|
init_replayContext();
|
|
1950
2151
|
init_serializePayload();
|
|
1951
2152
|
init_simulationPlan();
|
|
@@ -2557,6 +2758,10 @@ var init_http = __esm({
|
|
|
2557
2758
|
if (onlyWithAssertions) {
|
|
2558
2759
|
payload.onlyWithAssertions = true;
|
|
2559
2760
|
}
|
|
2761
|
+
const git = await resolvedGitState();
|
|
2762
|
+
if (git && !isEmptyGitState(git)) {
|
|
2763
|
+
payload.git = git;
|
|
2764
|
+
}
|
|
2560
2765
|
const timeout = includeDbBranchLease ? REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS : 3e4;
|
|
2561
2766
|
return this.request("/api/sdk/replay/start", payload, {
|
|
2562
2767
|
timeout
|
|
@@ -2904,112 +3109,6 @@ var init_randomUuid = __esm({
|
|
|
2904
3109
|
}
|
|
2905
3110
|
});
|
|
2906
3111
|
|
|
2907
|
-
// src/gitCommand.ts
|
|
2908
|
-
function isUnrefable(value) {
|
|
2909
|
-
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
2910
|
-
}
|
|
2911
|
-
function unrefStream(stream) {
|
|
2912
|
-
if (isUnrefable(stream)) {
|
|
2913
|
-
stream.unref();
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
function terminate(child) {
|
|
2917
|
-
if (child.pid && process.platform !== "win32") {
|
|
2918
|
-
try {
|
|
2919
|
-
process.kill(-child.pid, "SIGTERM");
|
|
2920
|
-
return;
|
|
2921
|
-
} catch {
|
|
2922
|
-
child.kill("SIGTERM");
|
|
2923
|
-
return;
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
child.kill("SIGTERM");
|
|
2927
|
-
}
|
|
2928
|
-
async function gitRunner(options) {
|
|
2929
|
-
let spawn;
|
|
2930
|
-
try {
|
|
2931
|
-
;
|
|
2932
|
-
({ spawn } = await import("child_process"));
|
|
2933
|
-
} catch {
|
|
2934
|
-
return null;
|
|
2935
|
-
}
|
|
2936
|
-
return (dir, args) => new Promise((resolve) => {
|
|
2937
|
-
let child;
|
|
2938
|
-
try {
|
|
2939
|
-
child = spawn("git", args, {
|
|
2940
|
-
cwd: dir,
|
|
2941
|
-
detached: process.platform !== "win32",
|
|
2942
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
2943
|
-
});
|
|
2944
|
-
} catch {
|
|
2945
|
-
resolve(null);
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
const chunks = [];
|
|
2949
|
-
let size = 0;
|
|
2950
|
-
let overflow = false;
|
|
2951
|
-
let exitCode = null;
|
|
2952
|
-
let done = false;
|
|
2953
|
-
const timers = [];
|
|
2954
|
-
const schedule = (callback, ms) => {
|
|
2955
|
-
const timer = setTimeout(callback, ms);
|
|
2956
|
-
if (!options.keepProcessAlive) {
|
|
2957
|
-
timer.unref();
|
|
2958
|
-
}
|
|
2959
|
-
timers.push(timer);
|
|
2960
|
-
};
|
|
2961
|
-
const finish = () => {
|
|
2962
|
-
if (done) {
|
|
2963
|
-
return;
|
|
2964
|
-
}
|
|
2965
|
-
done = true;
|
|
2966
|
-
for (const timer of timers) {
|
|
2967
|
-
clearTimeout(timer);
|
|
2968
|
-
}
|
|
2969
|
-
child.stdout?.destroy();
|
|
2970
|
-
child.stderr?.destroy();
|
|
2971
|
-
resolve(
|
|
2972
|
-
exitCode === 0 && !overflow ? Buffer.concat(chunks).toString("utf8") : null
|
|
2973
|
-
);
|
|
2974
|
-
};
|
|
2975
|
-
child.stdout?.on("data", (chunk) => {
|
|
2976
|
-
size += chunk.length;
|
|
2977
|
-
if (size > options.maxBuffer) {
|
|
2978
|
-
overflow = true;
|
|
2979
|
-
terminate(child);
|
|
2980
|
-
return;
|
|
2981
|
-
}
|
|
2982
|
-
chunks.push(chunk);
|
|
2983
|
-
});
|
|
2984
|
-
child.stderr?.resume();
|
|
2985
|
-
child.on("error", () => {
|
|
2986
|
-
exitCode = null;
|
|
2987
|
-
finish();
|
|
2988
|
-
});
|
|
2989
|
-
child.on("exit", (code) => {
|
|
2990
|
-
exitCode = code;
|
|
2991
|
-
schedule(finish, EXIT_GRACE_MS);
|
|
2992
|
-
});
|
|
2993
|
-
child.on("close", (code) => {
|
|
2994
|
-
exitCode = code ?? exitCode;
|
|
2995
|
-
finish();
|
|
2996
|
-
});
|
|
2997
|
-
schedule(() => terminate(child), options.timeoutMs);
|
|
2998
|
-
if (!options.keepProcessAlive) {
|
|
2999
|
-
child.unref();
|
|
3000
|
-
unrefStream(child.stdout);
|
|
3001
|
-
unrefStream(child.stderr);
|
|
3002
|
-
}
|
|
3003
|
-
});
|
|
3004
|
-
}
|
|
3005
|
-
var EXIT_GRACE_MS;
|
|
3006
|
-
var init_gitCommand = __esm({
|
|
3007
|
-
"src/gitCommand.ts"() {
|
|
3008
|
-
"use strict";
|
|
3009
|
-
EXIT_GRACE_MS = 500;
|
|
3010
|
-
}
|
|
3011
|
-
});
|
|
3012
|
-
|
|
3013
3112
|
// src/mockOverride.ts
|
|
3014
3113
|
function resolveMockValue(value, ctx) {
|
|
3015
3114
|
return typeof value === "function" ? value(ctx) : value;
|
|
@@ -4062,6 +4161,7 @@ var init_replay = __esm({
|
|
|
4062
4161
|
// src/index.ts
|
|
4063
4162
|
var index_exports = {};
|
|
4064
4163
|
__export(index_exports, {
|
|
4164
|
+
AssertionCategoriesClient: () => AssertionCategoriesClient,
|
|
4065
4165
|
BITFAB_PROGRESS_PREFIX: () => BITFAB_PROGRESS_PREFIX,
|
|
4066
4166
|
Bitfab: () => Bitfab,
|
|
4067
4167
|
BitfabClaudeAgentHandler: () => BitfabClaudeAgentHandler,
|
|
@@ -4098,6 +4198,36 @@ __export(index_exports, {
|
|
|
4098
4198
|
});
|
|
4099
4199
|
module.exports = __toCommonJS(index_exports);
|
|
4100
4200
|
|
|
4201
|
+
// src/assertionCategories.ts
|
|
4202
|
+
var CATEGORIES_PATH = "/api/sdk/assertionCategories";
|
|
4203
|
+
var AssertionCategoriesClient = class {
|
|
4204
|
+
constructor(httpClient) {
|
|
4205
|
+
this.httpClient = httpClient;
|
|
4206
|
+
}
|
|
4207
|
+
/** Create a category, or update it by ID. Omitted descriptions are preserved. */
|
|
4208
|
+
async save(params) {
|
|
4209
|
+
const response = await this.httpClient.request(CATEGORIES_PATH, params);
|
|
4210
|
+
return response.category;
|
|
4211
|
+
}
|
|
4212
|
+
/** Read one category in the API key's organization. */
|
|
4213
|
+
async get(id) {
|
|
4214
|
+
const response = await this.httpClient.get(
|
|
4215
|
+
`${CATEGORIES_PATH}/${encodeURIComponent(id)}`
|
|
4216
|
+
);
|
|
4217
|
+
return response.category;
|
|
4218
|
+
}
|
|
4219
|
+
/** List the organization's categories ordered by title. */
|
|
4220
|
+
async list() {
|
|
4221
|
+
const response = await this.httpClient.get(CATEGORIES_PATH);
|
|
4222
|
+
return response.categories;
|
|
4223
|
+
}
|
|
4224
|
+
/** Delete a category and clear its assignments, preserving assertions and verdicts. */
|
|
4225
|
+
async delete(id) {
|
|
4226
|
+
const response = await this.httpClient.request(`${CATEGORIES_PATH}/${encodeURIComponent(id)}`, {}, { method: "DELETE" });
|
|
4227
|
+
return response.category;
|
|
4228
|
+
}
|
|
4229
|
+
};
|
|
4230
|
+
|
|
4101
4231
|
// src/assertions.ts
|
|
4102
4232
|
var ASSERTIONS_PATH = "/api/sdk/traces/assertions";
|
|
4103
4233
|
function traceAssertionsPath(traceId, suffix = "") {
|
|
@@ -5280,9 +5410,9 @@ function assertSurfacesCompatible(requested, resolved2, parentSurface, traceFunc
|
|
|
5280
5410
|
init_gitCommand();
|
|
5281
5411
|
init_readEnv();
|
|
5282
5412
|
var EXPLICIT_SHA_ENV = "BITFAB_COMMIT_SHA";
|
|
5283
|
-
var
|
|
5284
|
-
var
|
|
5285
|
-
var
|
|
5413
|
+
var DISABLE_ENV2 = "BITFAB_DISABLE_COMMIT_REF";
|
|
5414
|
+
var GIT_TIMEOUT_MS2 = 2e3;
|
|
5415
|
+
var GIT_MAX_BUFFER2 = 1024 * 1024;
|
|
5286
5416
|
var VERCEL_PROVIDER_HOSTS = {
|
|
5287
5417
|
github: "github.com",
|
|
5288
5418
|
gitlab: "gitlab.com",
|
|
@@ -5338,9 +5468,9 @@ var PLATFORM_ENVS = [
|
|
|
5338
5468
|
];
|
|
5339
5469
|
var COMMIT_REF_ENV_NAMES = [
|
|
5340
5470
|
EXPLICIT_SHA_ENV,
|
|
5341
|
-
|
|
5471
|
+
DISABLE_ENV2,
|
|
5342
5472
|
...PLATFORM_ENVS.flatMap(
|
|
5343
|
-
([
|
|
5473
|
+
([sha2, branch]) => branch === null ? [sha2] : [sha2, branch]
|
|
5344
5474
|
),
|
|
5345
5475
|
"GITHUB_SERVER_URL",
|
|
5346
5476
|
"GITHUB_REPOSITORY",
|
|
@@ -5385,7 +5515,7 @@ function normalizeRemote(raw) {
|
|
|
5385
5515
|
}
|
|
5386
5516
|
function resolveCommitRefFromEnv(env) {
|
|
5387
5517
|
const explicit = read(env, EXPLICIT_SHA_ENV);
|
|
5388
|
-
const platform = PLATFORM_ENVS.find(([
|
|
5518
|
+
const platform = PLATFORM_ENVS.find(([sha2]) => read(env, sha2) !== null);
|
|
5389
5519
|
if (!platform) {
|
|
5390
5520
|
if (explicit === null) {
|
|
5391
5521
|
return null;
|
|
@@ -5409,16 +5539,16 @@ function resolveCommitRefFromEnv(env) {
|
|
|
5409
5539
|
}
|
|
5410
5540
|
async function resolveCommitRefFromGit(cwd) {
|
|
5411
5541
|
const git = await gitRunner({
|
|
5412
|
-
timeoutMs:
|
|
5413
|
-
maxBuffer:
|
|
5542
|
+
timeoutMs: GIT_TIMEOUT_MS2,
|
|
5543
|
+
maxBuffer: GIT_MAX_BUFFER2,
|
|
5414
5544
|
keepProcessAlive: false
|
|
5415
5545
|
});
|
|
5416
5546
|
if (!git) {
|
|
5417
5547
|
return null;
|
|
5418
5548
|
}
|
|
5419
5549
|
const run = async (args) => (await git(cwd, args))?.trim() ?? null;
|
|
5420
|
-
const
|
|
5421
|
-
if (!
|
|
5550
|
+
const sha2 = await run(["rev-parse", "HEAD"]);
|
|
5551
|
+
if (!sha2) {
|
|
5422
5552
|
return null;
|
|
5423
5553
|
}
|
|
5424
5554
|
const [branch, status, remote, roots] = await Promise.all([
|
|
@@ -5428,7 +5558,7 @@ async function resolveCommitRefFromGit(cwd) {
|
|
|
5428
5558
|
run(["rev-list", "--max-parents=0", "HEAD"])
|
|
5429
5559
|
]);
|
|
5430
5560
|
return {
|
|
5431
|
-
sha,
|
|
5561
|
+
sha: sha2,
|
|
5432
5562
|
branch: branch || null,
|
|
5433
5563
|
dirty: status === null ? null : status.length > 0,
|
|
5434
5564
|
remote: normalizeRemote(remote),
|
|
@@ -5452,7 +5582,7 @@ function startCommitRefResolution() {
|
|
|
5452
5582
|
if (resolved || gitStarted) {
|
|
5453
5583
|
return;
|
|
5454
5584
|
}
|
|
5455
|
-
if (read(readEnv,
|
|
5585
|
+
if (read(readEnv, DISABLE_ENV2) !== null) {
|
|
5456
5586
|
resolved = true;
|
|
5457
5587
|
return;
|
|
5458
5588
|
}
|
|
@@ -7033,14 +7163,14 @@ function modelLabel(model) {
|
|
|
7033
7163
|
}
|
|
7034
7164
|
function summarizeGenerate(result, model) {
|
|
7035
7165
|
const content = Array.isArray(result.content) ? result.content : [];
|
|
7036
|
-
const
|
|
7166
|
+
const text2 = typeof result.text === "string" ? result.text : content.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => p.text).join("");
|
|
7037
7167
|
const toolCalls = content.filter((p) => p.type === "tool-call").map((p) => ({
|
|
7038
7168
|
toolCallId: p.toolCallId,
|
|
7039
7169
|
toolName: p.toolName,
|
|
7040
7170
|
input: p.input ?? p.args
|
|
7041
7171
|
}));
|
|
7042
7172
|
const summary = {
|
|
7043
|
-
text,
|
|
7173
|
+
text: text2,
|
|
7044
7174
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
7045
7175
|
usage: result.usage,
|
|
7046
7176
|
finishReason: result.finishReason
|
|
@@ -7052,7 +7182,7 @@ function summarizeGenerate(result, model) {
|
|
|
7052
7182
|
}
|
|
7053
7183
|
function accumulateStream(source, onComplete, model) {
|
|
7054
7184
|
const reader = source.getReader();
|
|
7055
|
-
let
|
|
7185
|
+
let text2 = "";
|
|
7056
7186
|
const toolCalls = [];
|
|
7057
7187
|
let usage;
|
|
7058
7188
|
let finishReason;
|
|
@@ -7074,7 +7204,7 @@ function accumulateStream(source, onComplete, model) {
|
|
|
7074
7204
|
}
|
|
7075
7205
|
}
|
|
7076
7206
|
onComplete({
|
|
7077
|
-
text,
|
|
7207
|
+
text: text2,
|
|
7078
7208
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
7079
7209
|
usage,
|
|
7080
7210
|
finishReason,
|
|
@@ -7119,7 +7249,7 @@ function accumulateStream(source, onComplete, model) {
|
|
|
7119
7249
|
}
|
|
7120
7250
|
try {
|
|
7121
7251
|
if (part?.type === "text-delta") {
|
|
7122
|
-
|
|
7252
|
+
text2 += part.delta ?? part.textDelta ?? "";
|
|
7123
7253
|
} else if (part?.type === "tool-call") {
|
|
7124
7254
|
toolCalls.push({
|
|
7125
7255
|
toolCallId: part.toolCallId,
|
|
@@ -7649,6 +7779,7 @@ var Bitfab = class {
|
|
|
7649
7779
|
this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
|
|
7650
7780
|
this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
|
|
7651
7781
|
this.datasets = new DatasetsClient(this.httpClient);
|
|
7782
|
+
this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
|
|
7652
7783
|
this.traces = new TracesClient(this.httpClient);
|
|
7653
7784
|
this.labels = new LabelsClient(this.httpClient);
|
|
7654
7785
|
this.graders = new GradersClient(this.httpClient);
|
|
@@ -9607,7 +9738,7 @@ async function settle(value) {
|
|
|
9607
9738
|
}
|
|
9608
9739
|
async function aiSdk(result) {
|
|
9609
9740
|
const r = result ?? {};
|
|
9610
|
-
const [
|
|
9741
|
+
const [text2, usage, totalUsage, finishReason, toolCalls, toolResults] = await Promise.all([
|
|
9611
9742
|
settle(r.text),
|
|
9612
9743
|
settle(r.usage),
|
|
9613
9744
|
settle(r.totalUsage),
|
|
@@ -9616,7 +9747,7 @@ async function aiSdk(result) {
|
|
|
9616
9747
|
settle(r.toolResults)
|
|
9617
9748
|
]);
|
|
9618
9749
|
return {
|
|
9619
|
-
text,
|
|
9750
|
+
text: text2,
|
|
9620
9751
|
usage: totalUsage ?? usage,
|
|
9621
9752
|
finishReason,
|
|
9622
9753
|
toolCalls,
|
|
@@ -9720,6 +9851,7 @@ function resolveTraceFunctionKey(registration) {
|
|
|
9720
9851
|
}
|
|
9721
9852
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9722
9853
|
0 && (module.exports = {
|
|
9854
|
+
AssertionCategoriesClient,
|
|
9723
9855
|
BITFAB_PROGRESS_PREFIX,
|
|
9724
9856
|
Bitfab,
|
|
9725
9857
|
BitfabClaudeAgentHandler,
|