@riddledc/riddle-proof 0.7.156 → 0.7.158
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/cli.cjs +70 -40
- package/dist/cli.js +70 -40
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -15948,45 +15948,55 @@ function riddleArtifactsPayloadStatus(payload) {
|
|
|
15948
15948
|
}
|
|
15949
15949
|
async function recoverProfileResultFromRiddleArtifacts(profile, input) {
|
|
15950
15950
|
if (input.poll.poll?.timed_out !== true) return void 0;
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15951
|
+
const attempts = Math.max(1, Math.floor(input.attempts ?? 3));
|
|
15952
|
+
const intervalMs = Math.max(0, Math.floor(input.intervalMs ?? 0));
|
|
15953
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
15954
|
+
let artifactPayload;
|
|
15955
|
+
try {
|
|
15956
|
+
artifactPayload = await input.client.requestJson(`/v1/jobs/${input.jobId}/artifacts`);
|
|
15957
|
+
} catch {
|
|
15958
|
+
artifactPayload = {};
|
|
15959
|
+
}
|
|
15960
|
+
const artifacts = collectRiddleProfileArtifactRefs(artifactPayload);
|
|
15961
|
+
if (artifacts.length) {
|
|
15962
|
+
const artifactStatus = riddleArtifactsPayloadStatus(artifactPayload);
|
|
15963
|
+
const terminal = artifactStatus ? isTerminalRiddleJobStatus(artifactStatus) : true;
|
|
15964
|
+
const recoveredPoll = input.poll.poll ? {
|
|
15965
|
+
...input.poll.poll,
|
|
15966
|
+
status: artifactStatus ?? input.poll.poll.status,
|
|
15967
|
+
terminal
|
|
15968
|
+
} : void 0;
|
|
15969
|
+
const artifactResult = await profileResultFromRiddleArtifacts(profile, artifacts, [artifactPayload, input.poll.job]);
|
|
15970
|
+
if (artifactResult) {
|
|
15971
|
+
return withRiddleMetadata(artifactResult, {
|
|
15972
|
+
job_id: input.jobId,
|
|
15973
|
+
status: artifactStatus ?? input.poll.status,
|
|
15974
|
+
terminal,
|
|
15975
|
+
poll: recoveredPoll,
|
|
15976
|
+
artifacts,
|
|
15977
|
+
artifactRecovery: true
|
|
15978
|
+
});
|
|
15979
|
+
}
|
|
15980
|
+
if (terminal) {
|
|
15981
|
+
return createRiddleProofProfileInsufficientResult({
|
|
15982
|
+
profile,
|
|
15983
|
+
runner: input.runner,
|
|
15984
|
+
error: `Riddle job ${input.jobId} timed out in status ${input.poll.status || "unknown"}, but artifacts were recovered without a proof result.`,
|
|
15985
|
+
riddle: {
|
|
15986
|
+
...riddleMetadataFromPoll(input.jobId, input.poll),
|
|
15987
|
+
status: artifactStatus ?? input.poll.status,
|
|
15988
|
+
terminal,
|
|
15989
|
+
artifact_recovery: true
|
|
15990
|
+
},
|
|
15991
|
+
artifacts
|
|
15992
|
+
});
|
|
15993
|
+
}
|
|
15994
|
+
}
|
|
15995
|
+
if (attempt + 1 < attempts && intervalMs > 0) {
|
|
15996
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
15997
|
+
}
|
|
15976
15998
|
}
|
|
15977
|
-
|
|
15978
|
-
return createRiddleProofProfileInsufficientResult({
|
|
15979
|
-
profile,
|
|
15980
|
-
runner: input.runner,
|
|
15981
|
-
error: `Riddle job ${input.jobId} timed out in status ${input.poll.status || "unknown"}, but artifacts were recovered without a proof result.`,
|
|
15982
|
-
riddle: {
|
|
15983
|
-
...riddleMetadataFromPoll(input.jobId, input.poll),
|
|
15984
|
-
status: artifactStatus ?? input.poll.status,
|
|
15985
|
-
terminal,
|
|
15986
|
-
artifact_recovery: true
|
|
15987
|
-
},
|
|
15988
|
-
artifacts
|
|
15989
|
-
});
|
|
15999
|
+
return void 0;
|
|
15990
16000
|
}
|
|
15991
16001
|
function riddleMetadataFromPoll(jobId, poll) {
|
|
15992
16002
|
return {
|
|
@@ -16038,13 +16048,20 @@ function riddlePollOptionsForProfile(options) {
|
|
|
16038
16048
|
} : void 0
|
|
16039
16049
|
};
|
|
16040
16050
|
}
|
|
16051
|
+
function profileItemAppliesToSplitViewport(item, viewport) {
|
|
16052
|
+
if (!item.viewports?.length) return true;
|
|
16053
|
+
return Boolean(viewport.name && item.viewports.includes(viewport.name));
|
|
16054
|
+
}
|
|
16041
16055
|
function profileForSplitViewport(profile, viewport) {
|
|
16056
|
+
const setupActions = profile.target.setup_actions?.filter((action) => profileItemAppliesToSplitViewport(action, viewport));
|
|
16042
16057
|
return {
|
|
16043
16058
|
...profile,
|
|
16044
16059
|
name: `${profile.name}-${viewport.name || `${viewport.width}x${viewport.height}`}`,
|
|
16060
|
+
checks: profile.checks.filter((check) => profileItemAppliesToSplitViewport(check, viewport)),
|
|
16045
16061
|
target: {
|
|
16046
16062
|
...profile.target,
|
|
16047
|
-
viewports: [viewport]
|
|
16063
|
+
viewports: [viewport],
|
|
16064
|
+
...setupActions ? { setup_actions: setupActions } : {}
|
|
16048
16065
|
},
|
|
16049
16066
|
metadata: {
|
|
16050
16067
|
...profile.metadata || {},
|
|
@@ -16215,6 +16232,17 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
|
16215
16232
|
}
|
|
16216
16233
|
poll = await client.pollJob(jobId, pollOptions);
|
|
16217
16234
|
if (attempt < retryLimit && shouldRetryUnsubmittedRiddleJob(poll)) {
|
|
16235
|
+
const recoveredResult = await recoverProfileResultFromRiddleArtifacts(profile, {
|
|
16236
|
+
client,
|
|
16237
|
+
runner,
|
|
16238
|
+
jobId,
|
|
16239
|
+
poll,
|
|
16240
|
+
attempts: 3,
|
|
16241
|
+
intervalMs: Math.min(2e3, Math.max(0, poll.poll?.interval_ms ?? 0))
|
|
16242
|
+
});
|
|
16243
|
+
if (recoveredResult) {
|
|
16244
|
+
return recoveredResult;
|
|
16245
|
+
}
|
|
16218
16246
|
staleJobIds.push(jobId);
|
|
16219
16247
|
if (options.quiet !== true) {
|
|
16220
16248
|
process.stderr.write(`[riddle-poll] ${jobId} stayed unsubmitted for ${formatPollDuration(poll.poll?.pre_submission_elapsed_ms)}; retrying hosted run ${attempt + 1}/${retryLimit}
|
|
@@ -16234,7 +16262,9 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
|
16234
16262
|
client,
|
|
16235
16263
|
runner,
|
|
16236
16264
|
jobId,
|
|
16237
|
-
poll
|
|
16265
|
+
poll,
|
|
16266
|
+
attempts: 3,
|
|
16267
|
+
intervalMs: Math.min(2e3, Math.max(0, poll.poll?.interval_ms ?? 0))
|
|
16238
16268
|
});
|
|
16239
16269
|
if (recoveredResult) {
|
|
16240
16270
|
return withRiddleMetadata(recoveredResult, { retryCount, staleJobIds });
|
package/dist/cli.js
CHANGED
|
@@ -1199,45 +1199,55 @@ function riddleArtifactsPayloadStatus(payload) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
async function recoverProfileResultFromRiddleArtifacts(profile, input) {
|
|
1201
1201
|
if (input.poll.poll?.timed_out !== true) return void 0;
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1202
|
+
const attempts = Math.max(1, Math.floor(input.attempts ?? 3));
|
|
1203
|
+
const intervalMs = Math.max(0, Math.floor(input.intervalMs ?? 0));
|
|
1204
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
1205
|
+
let artifactPayload;
|
|
1206
|
+
try {
|
|
1207
|
+
artifactPayload = await input.client.requestJson(`/v1/jobs/${input.jobId}/artifacts`);
|
|
1208
|
+
} catch {
|
|
1209
|
+
artifactPayload = {};
|
|
1210
|
+
}
|
|
1211
|
+
const artifacts = collectRiddleProfileArtifactRefs(artifactPayload);
|
|
1212
|
+
if (artifacts.length) {
|
|
1213
|
+
const artifactStatus = riddleArtifactsPayloadStatus(artifactPayload);
|
|
1214
|
+
const terminal = artifactStatus ? isTerminalRiddleJobStatus(artifactStatus) : true;
|
|
1215
|
+
const recoveredPoll = input.poll.poll ? {
|
|
1216
|
+
...input.poll.poll,
|
|
1217
|
+
status: artifactStatus ?? input.poll.poll.status,
|
|
1218
|
+
terminal
|
|
1219
|
+
} : void 0;
|
|
1220
|
+
const artifactResult = await profileResultFromRiddleArtifacts(profile, artifacts, [artifactPayload, input.poll.job]);
|
|
1221
|
+
if (artifactResult) {
|
|
1222
|
+
return withRiddleMetadata(artifactResult, {
|
|
1223
|
+
job_id: input.jobId,
|
|
1224
|
+
status: artifactStatus ?? input.poll.status,
|
|
1225
|
+
terminal,
|
|
1226
|
+
poll: recoveredPoll,
|
|
1227
|
+
artifacts,
|
|
1228
|
+
artifactRecovery: true
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
if (terminal) {
|
|
1232
|
+
return createRiddleProofProfileInsufficientResult({
|
|
1233
|
+
profile,
|
|
1234
|
+
runner: input.runner,
|
|
1235
|
+
error: `Riddle job ${input.jobId} timed out in status ${input.poll.status || "unknown"}, but artifacts were recovered without a proof result.`,
|
|
1236
|
+
riddle: {
|
|
1237
|
+
...riddleMetadataFromPoll(input.jobId, input.poll),
|
|
1238
|
+
status: artifactStatus ?? input.poll.status,
|
|
1239
|
+
terminal,
|
|
1240
|
+
artifact_recovery: true
|
|
1241
|
+
},
|
|
1242
|
+
artifacts
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
if (attempt + 1 < attempts && intervalMs > 0) {
|
|
1247
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
1248
|
+
}
|
|
1227
1249
|
}
|
|
1228
|
-
|
|
1229
|
-
return createRiddleProofProfileInsufficientResult({
|
|
1230
|
-
profile,
|
|
1231
|
-
runner: input.runner,
|
|
1232
|
-
error: `Riddle job ${input.jobId} timed out in status ${input.poll.status || "unknown"}, but artifacts were recovered without a proof result.`,
|
|
1233
|
-
riddle: {
|
|
1234
|
-
...riddleMetadataFromPoll(input.jobId, input.poll),
|
|
1235
|
-
status: artifactStatus ?? input.poll.status,
|
|
1236
|
-
terminal,
|
|
1237
|
-
artifact_recovery: true
|
|
1238
|
-
},
|
|
1239
|
-
artifacts
|
|
1240
|
-
});
|
|
1250
|
+
return void 0;
|
|
1241
1251
|
}
|
|
1242
1252
|
function riddleMetadataFromPoll(jobId, poll) {
|
|
1243
1253
|
return {
|
|
@@ -1289,13 +1299,20 @@ function riddlePollOptionsForProfile(options) {
|
|
|
1289
1299
|
} : void 0
|
|
1290
1300
|
};
|
|
1291
1301
|
}
|
|
1302
|
+
function profileItemAppliesToSplitViewport(item, viewport) {
|
|
1303
|
+
if (!item.viewports?.length) return true;
|
|
1304
|
+
return Boolean(viewport.name && item.viewports.includes(viewport.name));
|
|
1305
|
+
}
|
|
1292
1306
|
function profileForSplitViewport(profile, viewport) {
|
|
1307
|
+
const setupActions = profile.target.setup_actions?.filter((action) => profileItemAppliesToSplitViewport(action, viewport));
|
|
1293
1308
|
return {
|
|
1294
1309
|
...profile,
|
|
1295
1310
|
name: `${profile.name}-${viewport.name || `${viewport.width}x${viewport.height}`}`,
|
|
1311
|
+
checks: profile.checks.filter((check) => profileItemAppliesToSplitViewport(check, viewport)),
|
|
1296
1312
|
target: {
|
|
1297
1313
|
...profile.target,
|
|
1298
|
-
viewports: [viewport]
|
|
1314
|
+
viewports: [viewport],
|
|
1315
|
+
...setupActions ? { setup_actions: setupActions } : {}
|
|
1299
1316
|
},
|
|
1300
1317
|
metadata: {
|
|
1301
1318
|
...profile.metadata || {},
|
|
@@ -1466,6 +1483,17 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
|
1466
1483
|
}
|
|
1467
1484
|
poll = await client.pollJob(jobId, pollOptions);
|
|
1468
1485
|
if (attempt < retryLimit && shouldRetryUnsubmittedRiddleJob(poll)) {
|
|
1486
|
+
const recoveredResult = await recoverProfileResultFromRiddleArtifacts(profile, {
|
|
1487
|
+
client,
|
|
1488
|
+
runner,
|
|
1489
|
+
jobId,
|
|
1490
|
+
poll,
|
|
1491
|
+
attempts: 3,
|
|
1492
|
+
intervalMs: Math.min(2e3, Math.max(0, poll.poll?.interval_ms ?? 0))
|
|
1493
|
+
});
|
|
1494
|
+
if (recoveredResult) {
|
|
1495
|
+
return recoveredResult;
|
|
1496
|
+
}
|
|
1469
1497
|
staleJobIds.push(jobId);
|
|
1470
1498
|
if (options.quiet !== true) {
|
|
1471
1499
|
process.stderr.write(`[riddle-poll] ${jobId} stayed unsubmitted for ${formatPollDuration(poll.poll?.pre_submission_elapsed_ms)}; retrying hosted run ${attempt + 1}/${retryLimit}
|
|
@@ -1485,7 +1513,9 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
|
1485
1513
|
client,
|
|
1486
1514
|
runner,
|
|
1487
1515
|
jobId,
|
|
1488
|
-
poll
|
|
1516
|
+
poll,
|
|
1517
|
+
attempts: 3,
|
|
1518
|
+
intervalMs: Math.min(2e3, Math.max(0, poll.poll?.interval_ms ?? 0))
|
|
1489
1519
|
});
|
|
1490
1520
|
if (recoveredResult) {
|
|
1491
1521
|
return withRiddleMetadata(recoveredResult, { retryCount, staleJobIds });
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|