@riddledc/riddle-proof 0.7.152 → 0.7.154
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-M3ZTY6PQ.js → chunk-PPZ5A5MC.js} +8 -0
- package/dist/{chunk-QJJ3ISMK.js → chunk-YB3LNLZB.js} +108 -0
- package/dist/cli.cjs +234 -33
- package/dist/cli.js +120 -35
- package/dist/index.cjs +116 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/profile.cjs +108 -0
- package/dist/profile.d.cts +10 -1
- package/dist/profile.d.ts +10 -1
- package/dist/profile.js +1 -1
- package/dist/riddle-client.cjs +8 -0
- package/dist/riddle-client.d.cts +3 -0
- package/dist/riddle-client.d.ts +3 -0
- package/dist/riddle-client.js +1 -1
- package/package.json +1 -1
|
@@ -295,12 +295,14 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
295
295
|
const attempts = Math.max(1, Math.floor(options.attempts ?? (options.wait ? 300 : 1)));
|
|
296
296
|
const intervalMs = Math.max(0, Math.floor(options.intervalMs ?? 2e3));
|
|
297
297
|
const progressEveryMs = Math.max(0, Math.floor(options.progressEveryMs ?? 1e4));
|
|
298
|
+
const unsubmittedTimeoutMs = Math.max(0, Math.floor(options.unsubmittedTimeoutMs ?? 0));
|
|
298
299
|
const startedAt = Date.now();
|
|
299
300
|
let job = null;
|
|
300
301
|
let lastSnapshot = null;
|
|
301
302
|
let lastProgressAt = 0;
|
|
302
303
|
let lastProgressKey = "";
|
|
303
304
|
let preSubmissionElapsedMs = 0;
|
|
305
|
+
let unsubmittedTimedOut = false;
|
|
304
306
|
for (let index = 0; index < attempts; index += 1) {
|
|
305
307
|
job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
|
|
306
308
|
const observedAt = Date.now();
|
|
@@ -331,7 +333,11 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
331
333
|
await options.onProgress(lastSnapshot);
|
|
332
334
|
}
|
|
333
335
|
}
|
|
336
|
+
unsubmittedTimedOut = Boolean(
|
|
337
|
+
options.wait && unsubmittedTimeoutMs > 0 && lastSnapshot.running_without_submission && !lastSnapshot.created_at && !lastSnapshot.submitted_at && preSubmissionElapsedMs >= unsubmittedTimeoutMs
|
|
338
|
+
);
|
|
334
339
|
if (lastSnapshot.terminal) break;
|
|
340
|
+
if (unsubmittedTimedOut) break;
|
|
335
341
|
if (index + 1 < attempts) {
|
|
336
342
|
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
337
343
|
}
|
|
@@ -356,6 +362,8 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
356
362
|
...snapshot,
|
|
357
363
|
timed_out: timedOut,
|
|
358
364
|
interval_ms: intervalMs,
|
|
365
|
+
unsubmitted_timeout: unsubmittedTimedOut || void 0,
|
|
366
|
+
unsubmitted_timeout_ms: unsubmittedTimedOut ? unsubmittedTimeoutMs : void 0,
|
|
359
367
|
message: pollMessage(snapshot, timedOut)
|
|
360
368
|
}
|
|
361
369
|
};
|
|
@@ -480,6 +480,8 @@ function profileSetupWindowCallReceipts(results) {
|
|
|
480
480
|
};
|
|
481
481
|
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
482
482
|
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
483
|
+
const returnSummary = profileSetupReturnSummary(result);
|
|
484
|
+
if (returnSummary.length) receipt.return_summary = returnSummary;
|
|
483
485
|
return receipt;
|
|
484
486
|
});
|
|
485
487
|
}
|
|
@@ -495,6 +497,40 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
495
497
|
};
|
|
496
498
|
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
497
499
|
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
500
|
+
const returnSummary = profileSetupReturnSummary(result);
|
|
501
|
+
if (returnSummary.length) receipt.return_summary = returnSummary;
|
|
502
|
+
return receipt;
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
function profileSetupReturnSummaryFields(result) {
|
|
506
|
+
const input = result.return_summary_fields;
|
|
507
|
+
if (!Array.isArray(input)) return [];
|
|
508
|
+
const fields = [];
|
|
509
|
+
for (const item of input) {
|
|
510
|
+
if (typeof item === "string") {
|
|
511
|
+
const path2 = item.trim();
|
|
512
|
+
if (path2) fields.push({ path: path2 });
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
if (!isRecord(item)) continue;
|
|
516
|
+
const path = stringValue(item.path) ?? stringValue(item.key) ?? stringValue(item.json_path) ?? stringValue(item.jsonPath);
|
|
517
|
+
if (!path) continue;
|
|
518
|
+
const label = stringValue(item.label) ?? stringValue(item.name) ?? stringValue(item.title);
|
|
519
|
+
fields.push(label ? { path, label } : { path });
|
|
520
|
+
}
|
|
521
|
+
return fields;
|
|
522
|
+
}
|
|
523
|
+
function profileSetupReturnSummary(result) {
|
|
524
|
+
if (result.returned === void 0) return [];
|
|
525
|
+
return profileSetupReturnSummaryFields(result).map((field) => {
|
|
526
|
+
const resolved = resolveJsonPath(result.returned, field.path);
|
|
527
|
+
const receipt = {
|
|
528
|
+
label: field.label || field.path,
|
|
529
|
+
path: field.path,
|
|
530
|
+
exists: resolved.exists
|
|
531
|
+
};
|
|
532
|
+
if (resolved.exists) receipt.value = toJsonValue(resolved.value);
|
|
533
|
+
if (resolved.error) receipt.reason = resolved.error;
|
|
498
534
|
return receipt;
|
|
499
535
|
});
|
|
500
536
|
}
|
|
@@ -683,6 +719,37 @@ function normalizeSetupActionArgs(input, index) {
|
|
|
683
719
|
}
|
|
684
720
|
return argsInput.map(toJsonValue);
|
|
685
721
|
}
|
|
722
|
+
function normalizeReturnSummaryFields(input, index) {
|
|
723
|
+
const fieldsInput = valueFromOwn(
|
|
724
|
+
input,
|
|
725
|
+
"return_summary_fields",
|
|
726
|
+
"returnSummaryFields",
|
|
727
|
+
"summary_fields",
|
|
728
|
+
"summaryFields",
|
|
729
|
+
"receipt_fields",
|
|
730
|
+
"receiptFields",
|
|
731
|
+
"return_receipt_fields",
|
|
732
|
+
"returnReceiptFields"
|
|
733
|
+
);
|
|
734
|
+
if (fieldsInput === void 0) return void 0;
|
|
735
|
+
if (!Array.isArray(fieldsInput)) {
|
|
736
|
+
throw new Error(`target.setup_actions[${index}].return_summary_fields must be an array.`);
|
|
737
|
+
}
|
|
738
|
+
return fieldsInput.map((field, fieldIndex) => {
|
|
739
|
+
if (typeof field === "string") {
|
|
740
|
+
const path2 = field.trim();
|
|
741
|
+
if (!path2) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
|
|
742
|
+
return { path: path2 };
|
|
743
|
+
}
|
|
744
|
+
if (!isRecord(field)) {
|
|
745
|
+
throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] must be a string path or object.`);
|
|
746
|
+
}
|
|
747
|
+
const path = stringFromOwn(field, "path", "key", "json_path", "jsonPath");
|
|
748
|
+
if (!path) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
|
|
749
|
+
const label = stringFromOwn(field, "label", "name", "title");
|
|
750
|
+
return label ? { path, label } : { path };
|
|
751
|
+
});
|
|
752
|
+
}
|
|
686
753
|
function normalizeSetupActionRepeat(input, index) {
|
|
687
754
|
const repeat = numberValue(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
|
|
688
755
|
if (repeat === void 0) return void 0;
|
|
@@ -904,6 +971,7 @@ function normalizeSetupAction(input, index) {
|
|
|
904
971
|
expect_return: hasExpectedReturn ? toJsonValue(valueFromOwn(input, "expect_return", "expectReturn", "expected_return", "expectedReturn")) : void 0,
|
|
905
972
|
store_return_to: storeReturnTo,
|
|
906
973
|
capture_return: captureReturn,
|
|
974
|
+
return_summary_fields: normalizeReturnSummaryFields(input, index),
|
|
907
975
|
until_path: untilPath,
|
|
908
976
|
until_expected_value: hasUntilExpectedValue ? toJsonValue(valueFromOwn(input, "until_expected_value", "untilExpectedValue", "until_expected", "untilExpected", "until_value", "untilValue", "expected_value", "expectedValue", "expected")) : void 0,
|
|
909
977
|
max_calls: maxCalls,
|
|
@@ -3942,6 +4010,8 @@ function profileSetupWindowCallReceipts(results) {
|
|
|
3942
4010
|
};
|
|
3943
4011
|
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
3944
4012
|
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
4013
|
+
const returnSummary = profileSetupReturnSummary(result);
|
|
4014
|
+
if (returnSummary.length) receipt.return_summary = returnSummary;
|
|
3945
4015
|
return receipt;
|
|
3946
4016
|
});
|
|
3947
4017
|
}
|
|
@@ -3959,9 +4029,43 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
3959
4029
|
};
|
|
3960
4030
|
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
3961
4031
|
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
4032
|
+
const returnSummary = profileSetupReturnSummary(result);
|
|
4033
|
+
if (returnSummary.length) receipt.return_summary = returnSummary;
|
|
3962
4034
|
return receipt;
|
|
3963
4035
|
});
|
|
3964
4036
|
}
|
|
4037
|
+
function profileSetupReturnSummaryFields(result) {
|
|
4038
|
+
const input = result && result.return_summary_fields;
|
|
4039
|
+
if (!Array.isArray(input)) return [];
|
|
4040
|
+
const fields = [];
|
|
4041
|
+
for (const item of input) {
|
|
4042
|
+
if (typeof item === "string") {
|
|
4043
|
+
const path = item.trim();
|
|
4044
|
+
if (path) fields.push({ path });
|
|
4045
|
+
continue;
|
|
4046
|
+
}
|
|
4047
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
4048
|
+
const path = String(item.path || item.key || item.json_path || item.jsonPath || "").trim();
|
|
4049
|
+
if (!path) continue;
|
|
4050
|
+
const label = String(item.label || item.name || item.title || "").trim();
|
|
4051
|
+
fields.push(label ? { path, label } : { path });
|
|
4052
|
+
}
|
|
4053
|
+
return fields;
|
|
4054
|
+
}
|
|
4055
|
+
function profileSetupReturnSummary(result) {
|
|
4056
|
+
if (!result || result.returned === undefined) return [];
|
|
4057
|
+
return profileSetupReturnSummaryFields(result).map((field) => {
|
|
4058
|
+
const resolved = resolveJsonProbePath(result.returned, field.path);
|
|
4059
|
+
const receipt = {
|
|
4060
|
+
label: field.label || field.path,
|
|
4061
|
+
path: field.path,
|
|
4062
|
+
exists: Boolean(resolved.exists),
|
|
4063
|
+
};
|
|
4064
|
+
if (resolved.exists) receipt.value = setupJsonValue(resolved.value);
|
|
4065
|
+
if (resolved.error) receipt.reason = resolved.error;
|
|
4066
|
+
return receipt;
|
|
4067
|
+
});
|
|
4068
|
+
}
|
|
3965
4069
|
function profileSetupRangeValueReceipts(results) {
|
|
3966
4070
|
return (results || [])
|
|
3967
4071
|
.filter((result) => result && profileSetupResultAction(result) === "set_range_value")
|
|
@@ -5696,6 +5800,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5696
5800
|
const script = String(action.script || action.code || action.source || action.body || "");
|
|
5697
5801
|
const args = Array.isArray(action.args) ? action.args : [];
|
|
5698
5802
|
const storeReturnTo = String(action.store_return_to || action.storeReturnTo || action.save_return_to || action.saveReturnTo || action.assign_return_to || action.assignReturnTo || action.return_state_path || action.returnStatePath || "").trim();
|
|
5803
|
+
const returnSummaryFields = Array.isArray(action.return_summary_fields) ? action.return_summary_fields : [];
|
|
5699
5804
|
if (!script.trim()) return { ...base, reason: "missing_script" };
|
|
5700
5805
|
const scope = await setupActionScope(action, timeout);
|
|
5701
5806
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
@@ -5725,6 +5830,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5725
5830
|
return_captured: captureReturn,
|
|
5726
5831
|
expected_return: hasExpectation ? setupJsonValue(expected) : undefined,
|
|
5727
5832
|
return_stored_to: result.return_stored_to || storeReturnTo || undefined,
|
|
5833
|
+
return_summary_fields: returnSummaryFields.length ? setupJsonValue(returnSummaryFields) : undefined,
|
|
5728
5834
|
reason: result.ok ? (expectationMet ? undefined : "unexpected_return_value") : result.reason,
|
|
5729
5835
|
store_reason: result.store_reason || undefined,
|
|
5730
5836
|
error: result.error || undefined,
|
|
@@ -5734,6 +5840,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5734
5840
|
const path = String(action.path || action.function_path || action.functionPath || "");
|
|
5735
5841
|
const args = Array.isArray(action.args) ? action.args : [];
|
|
5736
5842
|
const storeReturnTo = String(action.store_return_to || action.storeReturnTo || action.save_return_to || action.saveReturnTo || action.assign_return_to || action.assignReturnTo || action.return_state_path || action.returnStatePath || "").trim();
|
|
5843
|
+
const returnSummaryFields = Array.isArray(action.return_summary_fields) ? action.return_summary_fields : [];
|
|
5737
5844
|
if (!path) return { ...base, path, reason: "missing_path" };
|
|
5738
5845
|
const scope = await setupActionScope(action, timeout);
|
|
5739
5846
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
@@ -5763,6 +5870,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5763
5870
|
return_captured: captureReturn,
|
|
5764
5871
|
expected_return: hasExpectation ? setupJsonValue(expected) : undefined,
|
|
5765
5872
|
return_stored_to: result.return_stored_to || storeReturnTo || undefined,
|
|
5873
|
+
return_summary_fields: returnSummaryFields.length ? setupJsonValue(returnSummaryFields) : undefined,
|
|
5766
5874
|
reason: result.ok ? (expectationMet ? undefined : "unexpected_return_value") : result.reason,
|
|
5767
5875
|
store_reason: result.store_reason || undefined,
|
|
5768
5876
|
error: result.error || undefined,
|