@workbench-ai/workbench 0.0.61 → 0.0.63
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/index.d.ts.map +1 -1
- package/dist/index.js +57 -16
- package/package.json +4 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6IA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AA4BD,UAAU,iBAAiB;CAAG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6IA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AA4BD,UAAU,iBAAiB;CAAG;AA8K9B,wBAAsB,MAAM,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,KAIH,EACD,cAAc,GAAE,iBAAsB,GACrC,OAAO,CAAC,MAAM,CAAC,CAmHjB"}
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ class WorkbenchApiRequestError extends Error {
|
|
|
32
32
|
this.body = body;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
const API_REQUEST_MAX_ATTEMPTS = 3;
|
|
35
36
|
const DEFAULT_BASE_URL = "https://v2.workbench.ai";
|
|
36
37
|
export async function runCli(argv, io = {
|
|
37
38
|
stdin: process.stdin,
|
|
@@ -3016,7 +3017,7 @@ async function pushBenchmark(argv, io) {
|
|
|
3016
3017
|
baseUrl,
|
|
3017
3018
|
benchmarkId: projectId,
|
|
3018
3019
|
remote: origin.remote,
|
|
3019
|
-
benchmark: remoteProject,
|
|
3020
|
+
benchmark: hostedProjectSummaryForOutput(remoteProject),
|
|
3020
3021
|
benchmarkName: source.spec.name,
|
|
3021
3022
|
visibility: visibility ?? "unchanged",
|
|
3022
3023
|
sourceFileCount: sourceFileCount(source),
|
|
@@ -3078,6 +3079,16 @@ async function verifyLinkedPushDryRunTarget(args) {
|
|
|
3078
3079
|
}
|
|
3079
3080
|
return response.benchmark;
|
|
3080
3081
|
}
|
|
3082
|
+
function hostedProjectSummaryForOutput(project) {
|
|
3083
|
+
return {
|
|
3084
|
+
...(project.id ? { id: project.id } : {}),
|
|
3085
|
+
...(project.ownerUsername ? { ownerUsername: project.ownerUsername } : {}),
|
|
3086
|
+
...(project.name ? { name: project.name } : {}),
|
|
3087
|
+
...(project.visibility ? { visibility: project.visibility } : {}),
|
|
3088
|
+
...(project.activeCandidateId !== undefined ? { activeCandidateId: project.activeCandidateId } : {}),
|
|
3089
|
+
...(typeof project.starCount === "number" ? { starCount: project.starCount } : {}),
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3081
3092
|
async function createHostedBenchmarkFromState(args) {
|
|
3082
3093
|
const result = await apiRequest("/api/workbench/benchmarks/state", {
|
|
3083
3094
|
method: "POST",
|
|
@@ -4320,22 +4331,52 @@ async function apiRequest(apiPath, options = {}, baseUrlOverride) {
|
|
|
4320
4331
|
process.env.WORKBENCH_API_URL ??
|
|
4321
4332
|
config.baseUrl ??
|
|
4322
4333
|
DEFAULT_BASE_URL);
|
|
4323
|
-
const
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4334
|
+
const method = options.method ?? "GET";
|
|
4335
|
+
const canRetry = method === "GET";
|
|
4336
|
+
let lastError = null;
|
|
4337
|
+
for (let attempt = 1; attempt <= API_REQUEST_MAX_ATTEMPTS; attempt += 1) {
|
|
4338
|
+
let response;
|
|
4339
|
+
try {
|
|
4340
|
+
response = await fetch(`${baseUrl}${apiPath}`, {
|
|
4341
|
+
method,
|
|
4342
|
+
headers: {
|
|
4343
|
+
"content-type": "application/json",
|
|
4344
|
+
...(config.accessToken
|
|
4345
|
+
? { authorization: `Bearer ${config.accessToken}` }
|
|
4346
|
+
: {}),
|
|
4347
|
+
},
|
|
4348
|
+
body: options.body == null ? undefined : JSON.stringify(options.body),
|
|
4349
|
+
});
|
|
4350
|
+
}
|
|
4351
|
+
catch (error) {
|
|
4352
|
+
lastError = error;
|
|
4353
|
+
if (canRetry && attempt < API_REQUEST_MAX_ATTEMPTS && isTransientFetchError(error)) {
|
|
4354
|
+
await sleep(apiRequestRetryDelayMs(attempt));
|
|
4355
|
+
continue;
|
|
4356
|
+
}
|
|
4357
|
+
throw error;
|
|
4358
|
+
}
|
|
4359
|
+
if (!response.ok) {
|
|
4360
|
+
const text = await response.text();
|
|
4361
|
+
const requestError = new WorkbenchApiRequestError(response.status, readResponseError(text) ||
|
|
4362
|
+
`Request failed with status ${response.status}${response.statusText ? ` ${response.statusText}` : ""}.`, text);
|
|
4363
|
+
lastError = requestError;
|
|
4364
|
+
if (canRetry && attempt < API_REQUEST_MAX_ATTEMPTS && isTransientApiRequestError(requestError)) {
|
|
4365
|
+
await sleep(apiRequestRetryDelayMs(attempt));
|
|
4366
|
+
continue;
|
|
4367
|
+
}
|
|
4368
|
+
throw requestError;
|
|
4369
|
+
}
|
|
4370
|
+
return (await response.json());
|
|
4337
4371
|
}
|
|
4338
|
-
|
|
4372
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError ?? "Workbench API request failed."));
|
|
4373
|
+
}
|
|
4374
|
+
function apiRequestRetryDelayMs(attempt) {
|
|
4375
|
+
return 250 * attempt;
|
|
4376
|
+
}
|
|
4377
|
+
function isTransientFetchError(error) {
|
|
4378
|
+
const message = errorMessage(error);
|
|
4379
|
+
return /(?:fetch failed|socket hang up|ECONNRESET|EPIPE|UND_ERR_SOCKET|terminated)/iu.test(message);
|
|
4339
4380
|
}
|
|
4340
4381
|
async function uploadAdapterConnection(bundle) {
|
|
4341
4382
|
const config = await loadConfig();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-ai/workbench",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"yaml": "^2.8.2",
|
|
19
|
-
"@workbench-ai/workbench-built-in-adapters": "0.0.
|
|
20
|
-
"@workbench-ai/workbench-core": "0.0.
|
|
21
|
-
"@workbench-ai/workbench-protocol": "0.0.
|
|
19
|
+
"@workbench-ai/workbench-built-in-adapters": "0.0.63",
|
|
20
|
+
"@workbench-ai/workbench-core": "0.0.63",
|
|
21
|
+
"@workbench-ai/workbench-protocol": "0.0.63"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@tailwindcss/postcss": "^4.2.2",
|