@riddledc/riddle-proof 0.7.86 → 0.7.88
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-3Y35UIZO.js → chunk-CEBHV23V.js} +54 -1
- package/dist/cli.cjs +109 -1
- package/dist/cli.js +56 -1
- package/dist/index.cjs +54 -1
- package/dist/index.js +1 -1
- package/dist/profile.cjs +54 -1
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1703,6 +1703,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
1703
1703
|
}
|
|
1704
1704
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
1705
1705
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
1706
|
+
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
1706
1707
|
return {
|
|
1707
1708
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
1708
1709
|
profile_name: input.profile.name,
|
|
@@ -1712,12 +1713,64 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
|
1712
1713
|
route: { requested: resolveRiddleProofProfileTargetUrl(input.profile), observed: "", matched: false, error: message },
|
|
1713
1714
|
artifacts: { screenshots: [], proof_json: "proof.json", riddle_artifacts: input.artifacts },
|
|
1714
1715
|
checks: [],
|
|
1715
|
-
summary:
|
|
1716
|
+
summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
|
|
1716
1717
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1717
1718
|
riddle: input.riddle,
|
|
1719
|
+
environment_blocker: environmentBlocker,
|
|
1718
1720
|
error: message
|
|
1719
1721
|
};
|
|
1720
1722
|
}
|
|
1723
|
+
function extractRiddleRunnerBlocker(message) {
|
|
1724
|
+
const apiError = message.match(/^Riddle API\s+(\S+)\s+failed HTTP\s+(\d+):\s+(\{[\s\S]*\})$/);
|
|
1725
|
+
if (!apiError) return void 0;
|
|
1726
|
+
const details = {
|
|
1727
|
+
source: "riddle_api",
|
|
1728
|
+
endpoint: apiError[1],
|
|
1729
|
+
http_status: Number(apiError[2])
|
|
1730
|
+
};
|
|
1731
|
+
let payload;
|
|
1732
|
+
try {
|
|
1733
|
+
const parsed = JSON.parse(apiError[3]);
|
|
1734
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1735
|
+
payload = parsed;
|
|
1736
|
+
}
|
|
1737
|
+
} catch {
|
|
1738
|
+
payload = void 0;
|
|
1739
|
+
}
|
|
1740
|
+
const copyScalar = (key) => {
|
|
1741
|
+
const value = payload?.[key];
|
|
1742
|
+
if (typeof value === "string" || typeof value === "boolean") details[key] = value;
|
|
1743
|
+
if (typeof value === "number" && Number.isFinite(value)) details[key] = value;
|
|
1744
|
+
};
|
|
1745
|
+
for (const key of ["error", "required_seconds", "available_seconds", "deficit_seconds", "minimum_purchase_dollars"]) {
|
|
1746
|
+
copyScalar(key);
|
|
1747
|
+
}
|
|
1748
|
+
const httpStatus = typeof details.http_status === "number" ? details.http_status : void 0;
|
|
1749
|
+
const errorText = typeof details.error === "string" ? details.error.toLowerCase() : "";
|
|
1750
|
+
if (httpStatus === 402 && errorText.includes("balance")) {
|
|
1751
|
+
details.reason = "insufficient_balance";
|
|
1752
|
+
}
|
|
1753
|
+
return details;
|
|
1754
|
+
}
|
|
1755
|
+
function summarizeEnvironmentBlockedRunner(profileName, blocker) {
|
|
1756
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
1757
|
+
const required = typeof blocker.required_seconds === "number" ? blocker.required_seconds : void 0;
|
|
1758
|
+
const available = typeof blocker.available_seconds === "number" ? blocker.available_seconds : void 0;
|
|
1759
|
+
const deficit = typeof blocker.deficit_seconds === "number" ? blocker.deficit_seconds : void 0;
|
|
1760
|
+
const parts = [
|
|
1761
|
+
required === void 0 ? "" : `required ${required}s`,
|
|
1762
|
+
available === void 0 ? "" : `available ${available}s`,
|
|
1763
|
+
deficit === void 0 ? "" : `deficit ${deficit}s`
|
|
1764
|
+
].filter(Boolean);
|
|
1765
|
+
return `${profileName} could not start because Riddle balance was insufficient${parts.length ? ` (${parts.join(", ")})` : ""}.`;
|
|
1766
|
+
}
|
|
1767
|
+
if (blocker?.source === "riddle_api") {
|
|
1768
|
+
const endpoint = typeof blocker.endpoint === "string" ? blocker.endpoint : "Riddle API";
|
|
1769
|
+
const status = typeof blocker.http_status === "number" ? blocker.http_status : void 0;
|
|
1770
|
+
return `${profileName} could not start because ${endpoint} returned${status === void 0 ? "" : ` HTTP ${status}`}.`;
|
|
1771
|
+
}
|
|
1772
|
+
return `${profileName} could not collect reliable evidence because the runner was blocked.`;
|
|
1773
|
+
}
|
|
1721
1774
|
function createRiddleProofProfileInsufficientResult(input) {
|
|
1722
1775
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
|
|
1723
1776
|
return {
|
package/dist/cli.cjs
CHANGED
|
@@ -8574,6 +8574,7 @@ function profileStatusExitCode(profile, status) {
|
|
|
8574
8574
|
}
|
|
8575
8575
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
8576
8576
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
8577
|
+
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
8577
8578
|
return {
|
|
8578
8579
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
8579
8580
|
profile_name: input.profile.name,
|
|
@@ -8583,12 +8584,64 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
|
8583
8584
|
route: { requested: resolveRiddleProofProfileTargetUrl(input.profile), observed: "", matched: false, error: message },
|
|
8584
8585
|
artifacts: { screenshots: [], proof_json: "proof.json", riddle_artifacts: input.artifacts },
|
|
8585
8586
|
checks: [],
|
|
8586
|
-
summary:
|
|
8587
|
+
summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
|
|
8587
8588
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8588
8589
|
riddle: input.riddle,
|
|
8590
|
+
environment_blocker: environmentBlocker,
|
|
8589
8591
|
error: message
|
|
8590
8592
|
};
|
|
8591
8593
|
}
|
|
8594
|
+
function extractRiddleRunnerBlocker(message) {
|
|
8595
|
+
const apiError = message.match(/^Riddle API\s+(\S+)\s+failed HTTP\s+(\d+):\s+(\{[\s\S]*\})$/);
|
|
8596
|
+
if (!apiError) return void 0;
|
|
8597
|
+
const details = {
|
|
8598
|
+
source: "riddle_api",
|
|
8599
|
+
endpoint: apiError[1],
|
|
8600
|
+
http_status: Number(apiError[2])
|
|
8601
|
+
};
|
|
8602
|
+
let payload;
|
|
8603
|
+
try {
|
|
8604
|
+
const parsed = JSON.parse(apiError[3]);
|
|
8605
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
8606
|
+
payload = parsed;
|
|
8607
|
+
}
|
|
8608
|
+
} catch {
|
|
8609
|
+
payload = void 0;
|
|
8610
|
+
}
|
|
8611
|
+
const copyScalar = (key) => {
|
|
8612
|
+
const value = payload?.[key];
|
|
8613
|
+
if (typeof value === "string" || typeof value === "boolean") details[key] = value;
|
|
8614
|
+
if (typeof value === "number" && Number.isFinite(value)) details[key] = value;
|
|
8615
|
+
};
|
|
8616
|
+
for (const key of ["error", "required_seconds", "available_seconds", "deficit_seconds", "minimum_purchase_dollars"]) {
|
|
8617
|
+
copyScalar(key);
|
|
8618
|
+
}
|
|
8619
|
+
const httpStatus = typeof details.http_status === "number" ? details.http_status : void 0;
|
|
8620
|
+
const errorText = typeof details.error === "string" ? details.error.toLowerCase() : "";
|
|
8621
|
+
if (httpStatus === 402 && errorText.includes("balance")) {
|
|
8622
|
+
details.reason = "insufficient_balance";
|
|
8623
|
+
}
|
|
8624
|
+
return details;
|
|
8625
|
+
}
|
|
8626
|
+
function summarizeEnvironmentBlockedRunner(profileName, blocker) {
|
|
8627
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
8628
|
+
const required = typeof blocker.required_seconds === "number" ? blocker.required_seconds : void 0;
|
|
8629
|
+
const available = typeof blocker.available_seconds === "number" ? blocker.available_seconds : void 0;
|
|
8630
|
+
const deficit = typeof blocker.deficit_seconds === "number" ? blocker.deficit_seconds : void 0;
|
|
8631
|
+
const parts = [
|
|
8632
|
+
required === void 0 ? "" : `required ${required}s`,
|
|
8633
|
+
available === void 0 ? "" : `available ${available}s`,
|
|
8634
|
+
deficit === void 0 ? "" : `deficit ${deficit}s`
|
|
8635
|
+
].filter(Boolean);
|
|
8636
|
+
return `${profileName} could not start because Riddle balance was insufficient${parts.length ? ` (${parts.join(", ")})` : ""}.`;
|
|
8637
|
+
}
|
|
8638
|
+
if (blocker?.source === "riddle_api") {
|
|
8639
|
+
const endpoint = typeof blocker.endpoint === "string" ? blocker.endpoint : "Riddle API";
|
|
8640
|
+
const status = typeof blocker.http_status === "number" ? blocker.http_status : void 0;
|
|
8641
|
+
return `${profileName} could not start because ${endpoint} returned${status === void 0 ? "" : ` HTTP ${status}`}.`;
|
|
8642
|
+
}
|
|
8643
|
+
return `${profileName} could not collect reliable evidence because the runner was blocked.`;
|
|
8644
|
+
}
|
|
8592
8645
|
function createRiddleProofProfileInsufficientResult(input) {
|
|
8593
8646
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
|
|
8594
8647
|
return {
|
|
@@ -11549,6 +11602,10 @@ function profileResultMarkdown(result) {
|
|
|
11549
11602
|
if (routeInventorySummaryLines.length) {
|
|
11550
11603
|
lines.push("", "## Route Inventory", "", ...routeInventorySummaryLines);
|
|
11551
11604
|
}
|
|
11605
|
+
const environmentBlockerLines = profileEnvironmentBlockerMarkdown(result);
|
|
11606
|
+
if (environmentBlockerLines.length) {
|
|
11607
|
+
lines.push("", "## Environment Blocker", "", ...environmentBlockerLines);
|
|
11608
|
+
}
|
|
11552
11609
|
if (result.artifacts.riddle_artifacts?.length) {
|
|
11553
11610
|
lines.push("", "## Riddle Artifacts", "");
|
|
11554
11611
|
for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
|
|
@@ -11640,6 +11697,52 @@ function cliString(value) {
|
|
|
11640
11697
|
function cliStringArray(value) {
|
|
11641
11698
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && Boolean(entry.trim())) : [];
|
|
11642
11699
|
}
|
|
11700
|
+
function profileEnvironmentBlockerMarkdown(result) {
|
|
11701
|
+
const blocker = cliRecord(result.environment_blocker);
|
|
11702
|
+
if (!blocker) return [];
|
|
11703
|
+
const lines = [];
|
|
11704
|
+
const reason = cliString(blocker.reason);
|
|
11705
|
+
const source = cliString(blocker.source);
|
|
11706
|
+
const endpoint = cliString(blocker.endpoint);
|
|
11707
|
+
const httpStatus = cliFiniteNumber(blocker.http_status);
|
|
11708
|
+
const error = cliString(blocker.error);
|
|
11709
|
+
const requiredSeconds = cliFiniteNumber(blocker.required_seconds);
|
|
11710
|
+
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
11711
|
+
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
11712
|
+
const minimumPurchaseDollars = cliFiniteNumber(blocker.minimum_purchase_dollars);
|
|
11713
|
+
if (reason) lines.push(`- reason: ${reason}`);
|
|
11714
|
+
if (source || endpoint || httpStatus !== void 0) {
|
|
11715
|
+
lines.push(`- source: ${source || "runner"}${endpoint ? ` ${endpoint}` : ""}${httpStatus === void 0 ? "" : ` HTTP ${httpStatus}`}`);
|
|
11716
|
+
}
|
|
11717
|
+
if (error) lines.push(`- error: ${error}`);
|
|
11718
|
+
if (requiredSeconds !== void 0 || availableSeconds !== void 0 || deficitSeconds !== void 0) {
|
|
11719
|
+
lines.push(`- seconds: required ${requiredSeconds ?? "unknown"}, available ${availableSeconds ?? "unknown"}, deficit ${deficitSeconds ?? "unknown"}`);
|
|
11720
|
+
}
|
|
11721
|
+
if (minimumPurchaseDollars !== void 0) lines.push(`- minimum purchase: $${minimumPurchaseDollars}`);
|
|
11722
|
+
return lines;
|
|
11723
|
+
}
|
|
11724
|
+
function profileCliDiagnosticLine(result) {
|
|
11725
|
+
if (result.status !== "environment_blocked") return void 0;
|
|
11726
|
+
const blocker = cliRecord(result.environment_blocker);
|
|
11727
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
11728
|
+
const requiredSeconds = cliFiniteNumber(blocker.required_seconds);
|
|
11729
|
+
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
11730
|
+
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
11731
|
+
const parts = [
|
|
11732
|
+
requiredSeconds === void 0 ? "" : `required=${requiredSeconds}s`,
|
|
11733
|
+
availableSeconds === void 0 ? "" : `available=${availableSeconds}s`,
|
|
11734
|
+
deficitSeconds === void 0 ? "" : `deficit=${deficitSeconds}s`
|
|
11735
|
+
].filter(Boolean);
|
|
11736
|
+
return `[riddle-profile] environment_blocked insufficient_balance${parts.length ? ` ${parts.join(" ")}` : ""}`;
|
|
11737
|
+
}
|
|
11738
|
+
const source = cliString(blocker?.source);
|
|
11739
|
+
const endpoint = cliString(blocker?.endpoint);
|
|
11740
|
+
const httpStatus = cliFiniteNumber(blocker?.http_status);
|
|
11741
|
+
if (source || endpoint || httpStatus !== void 0) {
|
|
11742
|
+
return `[riddle-profile] environment_blocked${source ? ` source=${source}` : ""}${endpoint ? ` endpoint=${endpoint}` : ""}${httpStatus === void 0 ? "" : ` http_status=${httpStatus}`}`;
|
|
11743
|
+
}
|
|
11744
|
+
return `[riddle-profile] environment_blocked ${result.summary}`;
|
|
11745
|
+
}
|
|
11643
11746
|
function profileSetupSummaryMarkdown(result) {
|
|
11644
11747
|
const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
|
|
11645
11748
|
const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
|
|
@@ -11939,6 +12042,11 @@ async function main() {
|
|
|
11939
12042
|
const profile = normalizeProfileForCli(options);
|
|
11940
12043
|
const result = await runProfileForCli(profile, options);
|
|
11941
12044
|
writeProfileOutput(profileOutputDirOption(options), result);
|
|
12045
|
+
const diagnosticLine = profileCliDiagnosticLine(result);
|
|
12046
|
+
if (diagnosticLine && optionBoolean(options, "quiet") !== true) {
|
|
12047
|
+
process.stderr.write(`${diagnosticLine}
|
|
12048
|
+
`);
|
|
12049
|
+
}
|
|
11942
12050
|
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
11943
12051
|
`);
|
|
11944
12052
|
process.exitCode = profileStatusExitCode(profile, result.status);
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
profileStatusExitCode,
|
|
11
11
|
resolveRiddleProofProfileTargetUrl,
|
|
12
12
|
resolveRiddleProofProfileTimeoutSec
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CEBHV23V.js";
|
|
14
14
|
import {
|
|
15
15
|
createRiddleApiClient,
|
|
16
16
|
parseRiddleViewport
|
|
@@ -337,6 +337,10 @@ function profileResultMarkdown(result) {
|
|
|
337
337
|
if (routeInventorySummaryLines.length) {
|
|
338
338
|
lines.push("", "## Route Inventory", "", ...routeInventorySummaryLines);
|
|
339
339
|
}
|
|
340
|
+
const environmentBlockerLines = profileEnvironmentBlockerMarkdown(result);
|
|
341
|
+
if (environmentBlockerLines.length) {
|
|
342
|
+
lines.push("", "## Environment Blocker", "", ...environmentBlockerLines);
|
|
343
|
+
}
|
|
340
344
|
if (result.artifacts.riddle_artifacts?.length) {
|
|
341
345
|
lines.push("", "## Riddle Artifacts", "");
|
|
342
346
|
for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
|
|
@@ -428,6 +432,52 @@ function cliString(value) {
|
|
|
428
432
|
function cliStringArray(value) {
|
|
429
433
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && Boolean(entry.trim())) : [];
|
|
430
434
|
}
|
|
435
|
+
function profileEnvironmentBlockerMarkdown(result) {
|
|
436
|
+
const blocker = cliRecord(result.environment_blocker);
|
|
437
|
+
if (!blocker) return [];
|
|
438
|
+
const lines = [];
|
|
439
|
+
const reason = cliString(blocker.reason);
|
|
440
|
+
const source = cliString(blocker.source);
|
|
441
|
+
const endpoint = cliString(blocker.endpoint);
|
|
442
|
+
const httpStatus = cliFiniteNumber(blocker.http_status);
|
|
443
|
+
const error = cliString(blocker.error);
|
|
444
|
+
const requiredSeconds = cliFiniteNumber(blocker.required_seconds);
|
|
445
|
+
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
446
|
+
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
447
|
+
const minimumPurchaseDollars = cliFiniteNumber(blocker.minimum_purchase_dollars);
|
|
448
|
+
if (reason) lines.push(`- reason: ${reason}`);
|
|
449
|
+
if (source || endpoint || httpStatus !== void 0) {
|
|
450
|
+
lines.push(`- source: ${source || "runner"}${endpoint ? ` ${endpoint}` : ""}${httpStatus === void 0 ? "" : ` HTTP ${httpStatus}`}`);
|
|
451
|
+
}
|
|
452
|
+
if (error) lines.push(`- error: ${error}`);
|
|
453
|
+
if (requiredSeconds !== void 0 || availableSeconds !== void 0 || deficitSeconds !== void 0) {
|
|
454
|
+
lines.push(`- seconds: required ${requiredSeconds ?? "unknown"}, available ${availableSeconds ?? "unknown"}, deficit ${deficitSeconds ?? "unknown"}`);
|
|
455
|
+
}
|
|
456
|
+
if (minimumPurchaseDollars !== void 0) lines.push(`- minimum purchase: $${minimumPurchaseDollars}`);
|
|
457
|
+
return lines;
|
|
458
|
+
}
|
|
459
|
+
function profileCliDiagnosticLine(result) {
|
|
460
|
+
if (result.status !== "environment_blocked") return void 0;
|
|
461
|
+
const blocker = cliRecord(result.environment_blocker);
|
|
462
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
463
|
+
const requiredSeconds = cliFiniteNumber(blocker.required_seconds);
|
|
464
|
+
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
465
|
+
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
466
|
+
const parts = [
|
|
467
|
+
requiredSeconds === void 0 ? "" : `required=${requiredSeconds}s`,
|
|
468
|
+
availableSeconds === void 0 ? "" : `available=${availableSeconds}s`,
|
|
469
|
+
deficitSeconds === void 0 ? "" : `deficit=${deficitSeconds}s`
|
|
470
|
+
].filter(Boolean);
|
|
471
|
+
return `[riddle-profile] environment_blocked insufficient_balance${parts.length ? ` ${parts.join(" ")}` : ""}`;
|
|
472
|
+
}
|
|
473
|
+
const source = cliString(blocker?.source);
|
|
474
|
+
const endpoint = cliString(blocker?.endpoint);
|
|
475
|
+
const httpStatus = cliFiniteNumber(blocker?.http_status);
|
|
476
|
+
if (source || endpoint || httpStatus !== void 0) {
|
|
477
|
+
return `[riddle-profile] environment_blocked${source ? ` source=${source}` : ""}${endpoint ? ` endpoint=${endpoint}` : ""}${httpStatus === void 0 ? "" : ` http_status=${httpStatus}`}`;
|
|
478
|
+
}
|
|
479
|
+
return `[riddle-profile] environment_blocked ${result.summary}`;
|
|
480
|
+
}
|
|
431
481
|
function profileSetupSummaryMarkdown(result) {
|
|
432
482
|
const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
|
|
433
483
|
const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
|
|
@@ -727,6 +777,11 @@ async function main() {
|
|
|
727
777
|
const profile = normalizeProfileForCli(options);
|
|
728
778
|
const result = await runProfileForCli(profile, options);
|
|
729
779
|
writeProfileOutput(profileOutputDirOption(options), result);
|
|
780
|
+
const diagnosticLine = profileCliDiagnosticLine(result);
|
|
781
|
+
if (diagnosticLine && optionBoolean(options, "quiet") !== true) {
|
|
782
|
+
process.stderr.write(`${diagnosticLine}
|
|
783
|
+
`);
|
|
784
|
+
}
|
|
730
785
|
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
731
786
|
`);
|
|
732
787
|
process.exitCode = profileStatusExitCode(profile, result.status);
|
package/dist/index.cjs
CHANGED
|
@@ -10431,6 +10431,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
10431
10431
|
}
|
|
10432
10432
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
10433
10433
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
10434
|
+
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
10434
10435
|
return {
|
|
10435
10436
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
10436
10437
|
profile_name: input.profile.name,
|
|
@@ -10440,12 +10441,64 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
|
10440
10441
|
route: { requested: resolveRiddleProofProfileTargetUrl(input.profile), observed: "", matched: false, error: message },
|
|
10441
10442
|
artifacts: { screenshots: [], proof_json: "proof.json", riddle_artifacts: input.artifacts },
|
|
10442
10443
|
checks: [],
|
|
10443
|
-
summary:
|
|
10444
|
+
summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
|
|
10444
10445
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10445
10446
|
riddle: input.riddle,
|
|
10447
|
+
environment_blocker: environmentBlocker,
|
|
10446
10448
|
error: message
|
|
10447
10449
|
};
|
|
10448
10450
|
}
|
|
10451
|
+
function extractRiddleRunnerBlocker(message) {
|
|
10452
|
+
const apiError = message.match(/^Riddle API\s+(\S+)\s+failed HTTP\s+(\d+):\s+(\{[\s\S]*\})$/);
|
|
10453
|
+
if (!apiError) return void 0;
|
|
10454
|
+
const details = {
|
|
10455
|
+
source: "riddle_api",
|
|
10456
|
+
endpoint: apiError[1],
|
|
10457
|
+
http_status: Number(apiError[2])
|
|
10458
|
+
};
|
|
10459
|
+
let payload;
|
|
10460
|
+
try {
|
|
10461
|
+
const parsed = JSON.parse(apiError[3]);
|
|
10462
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
10463
|
+
payload = parsed;
|
|
10464
|
+
}
|
|
10465
|
+
} catch {
|
|
10466
|
+
payload = void 0;
|
|
10467
|
+
}
|
|
10468
|
+
const copyScalar = (key) => {
|
|
10469
|
+
const value = payload?.[key];
|
|
10470
|
+
if (typeof value === "string" || typeof value === "boolean") details[key] = value;
|
|
10471
|
+
if (typeof value === "number" && Number.isFinite(value)) details[key] = value;
|
|
10472
|
+
};
|
|
10473
|
+
for (const key of ["error", "required_seconds", "available_seconds", "deficit_seconds", "minimum_purchase_dollars"]) {
|
|
10474
|
+
copyScalar(key);
|
|
10475
|
+
}
|
|
10476
|
+
const httpStatus = typeof details.http_status === "number" ? details.http_status : void 0;
|
|
10477
|
+
const errorText = typeof details.error === "string" ? details.error.toLowerCase() : "";
|
|
10478
|
+
if (httpStatus === 402 && errorText.includes("balance")) {
|
|
10479
|
+
details.reason = "insufficient_balance";
|
|
10480
|
+
}
|
|
10481
|
+
return details;
|
|
10482
|
+
}
|
|
10483
|
+
function summarizeEnvironmentBlockedRunner(profileName, blocker) {
|
|
10484
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
10485
|
+
const required = typeof blocker.required_seconds === "number" ? blocker.required_seconds : void 0;
|
|
10486
|
+
const available = typeof blocker.available_seconds === "number" ? blocker.available_seconds : void 0;
|
|
10487
|
+
const deficit = typeof blocker.deficit_seconds === "number" ? blocker.deficit_seconds : void 0;
|
|
10488
|
+
const parts = [
|
|
10489
|
+
required === void 0 ? "" : `required ${required}s`,
|
|
10490
|
+
available === void 0 ? "" : `available ${available}s`,
|
|
10491
|
+
deficit === void 0 ? "" : `deficit ${deficit}s`
|
|
10492
|
+
].filter(Boolean);
|
|
10493
|
+
return `${profileName} could not start because Riddle balance was insufficient${parts.length ? ` (${parts.join(", ")})` : ""}.`;
|
|
10494
|
+
}
|
|
10495
|
+
if (blocker?.source === "riddle_api") {
|
|
10496
|
+
const endpoint = typeof blocker.endpoint === "string" ? blocker.endpoint : "Riddle API";
|
|
10497
|
+
const status = typeof blocker.http_status === "number" ? blocker.http_status : void 0;
|
|
10498
|
+
return `${profileName} could not start because ${endpoint} returned${status === void 0 ? "" : ` HTTP ${status}`}.`;
|
|
10499
|
+
}
|
|
10500
|
+
return `${profileName} could not collect reliable evidence because the runner was blocked.`;
|
|
10501
|
+
}
|
|
10449
10502
|
function createRiddleProofProfileInsufficientResult(input) {
|
|
10450
10503
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
|
|
10451
10504
|
return {
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
resolveRiddleProofProfileTimeoutSec,
|
|
59
59
|
slugifyRiddleProofProfileName,
|
|
60
60
|
summarizeRiddleProofProfileResult
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-CEBHV23V.js";
|
|
62
62
|
import {
|
|
63
63
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
64
64
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -1746,6 +1746,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
1746
1746
|
}
|
|
1747
1747
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
1748
1748
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
1749
|
+
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
1749
1750
|
return {
|
|
1750
1751
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
1751
1752
|
profile_name: input.profile.name,
|
|
@@ -1755,12 +1756,64 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
|
1755
1756
|
route: { requested: resolveRiddleProofProfileTargetUrl(input.profile), observed: "", matched: false, error: message },
|
|
1756
1757
|
artifacts: { screenshots: [], proof_json: "proof.json", riddle_artifacts: input.artifacts },
|
|
1757
1758
|
checks: [],
|
|
1758
|
-
summary:
|
|
1759
|
+
summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
|
|
1759
1760
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1760
1761
|
riddle: input.riddle,
|
|
1762
|
+
environment_blocker: environmentBlocker,
|
|
1761
1763
|
error: message
|
|
1762
1764
|
};
|
|
1763
1765
|
}
|
|
1766
|
+
function extractRiddleRunnerBlocker(message) {
|
|
1767
|
+
const apiError = message.match(/^Riddle API\s+(\S+)\s+failed HTTP\s+(\d+):\s+(\{[\s\S]*\})$/);
|
|
1768
|
+
if (!apiError) return void 0;
|
|
1769
|
+
const details = {
|
|
1770
|
+
source: "riddle_api",
|
|
1771
|
+
endpoint: apiError[1],
|
|
1772
|
+
http_status: Number(apiError[2])
|
|
1773
|
+
};
|
|
1774
|
+
let payload;
|
|
1775
|
+
try {
|
|
1776
|
+
const parsed = JSON.parse(apiError[3]);
|
|
1777
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1778
|
+
payload = parsed;
|
|
1779
|
+
}
|
|
1780
|
+
} catch {
|
|
1781
|
+
payload = void 0;
|
|
1782
|
+
}
|
|
1783
|
+
const copyScalar = (key) => {
|
|
1784
|
+
const value = payload?.[key];
|
|
1785
|
+
if (typeof value === "string" || typeof value === "boolean") details[key] = value;
|
|
1786
|
+
if (typeof value === "number" && Number.isFinite(value)) details[key] = value;
|
|
1787
|
+
};
|
|
1788
|
+
for (const key of ["error", "required_seconds", "available_seconds", "deficit_seconds", "minimum_purchase_dollars"]) {
|
|
1789
|
+
copyScalar(key);
|
|
1790
|
+
}
|
|
1791
|
+
const httpStatus = typeof details.http_status === "number" ? details.http_status : void 0;
|
|
1792
|
+
const errorText = typeof details.error === "string" ? details.error.toLowerCase() : "";
|
|
1793
|
+
if (httpStatus === 402 && errorText.includes("balance")) {
|
|
1794
|
+
details.reason = "insufficient_balance";
|
|
1795
|
+
}
|
|
1796
|
+
return details;
|
|
1797
|
+
}
|
|
1798
|
+
function summarizeEnvironmentBlockedRunner(profileName, blocker) {
|
|
1799
|
+
if (blocker?.reason === "insufficient_balance") {
|
|
1800
|
+
const required = typeof blocker.required_seconds === "number" ? blocker.required_seconds : void 0;
|
|
1801
|
+
const available = typeof blocker.available_seconds === "number" ? blocker.available_seconds : void 0;
|
|
1802
|
+
const deficit = typeof blocker.deficit_seconds === "number" ? blocker.deficit_seconds : void 0;
|
|
1803
|
+
const parts = [
|
|
1804
|
+
required === void 0 ? "" : `required ${required}s`,
|
|
1805
|
+
available === void 0 ? "" : `available ${available}s`,
|
|
1806
|
+
deficit === void 0 ? "" : `deficit ${deficit}s`
|
|
1807
|
+
].filter(Boolean);
|
|
1808
|
+
return `${profileName} could not start because Riddle balance was insufficient${parts.length ? ` (${parts.join(", ")})` : ""}.`;
|
|
1809
|
+
}
|
|
1810
|
+
if (blocker?.source === "riddle_api") {
|
|
1811
|
+
const endpoint = typeof blocker.endpoint === "string" ? blocker.endpoint : "Riddle API";
|
|
1812
|
+
const status = typeof blocker.http_status === "number" ? blocker.http_status : void 0;
|
|
1813
|
+
return `${profileName} could not start because ${endpoint} returned${status === void 0 ? "" : ` HTTP ${status}`}.`;
|
|
1814
|
+
}
|
|
1815
|
+
return `${profileName} could not collect reliable evidence because the runner was blocked.`;
|
|
1816
|
+
}
|
|
1764
1817
|
function createRiddleProofProfileInsufficientResult(input) {
|
|
1765
1818
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
|
|
1766
1819
|
return {
|
package/dist/profile.d.cts
CHANGED
package/dist/profile.d.ts
CHANGED
package/dist/profile.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
resolveRiddleProofProfileTimeoutSec,
|
|
20
20
|
slugifyRiddleProofProfileName,
|
|
21
21
|
summarizeRiddleProofProfileResult
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CEBHV23V.js";
|
|
23
23
|
export {
|
|
24
24
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
25
25
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "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: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|