@riddledc/riddle-proof 0.7.212 → 0.7.214
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/README.md +6 -0
- package/dist/{chunk-PPZ5A5MC.js → chunk-33XO7WFI.js} +18 -4
- package/dist/{chunk-VCTXNE67.js → chunk-PEWAIEER.js} +55 -2
- package/dist/cli.cjs +182 -7
- package/dist/cli.js +113 -3
- package/dist/index.cjs +75 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/profile.cjs +55 -2
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +1 -1
- package/dist/riddle-client.cjs +20 -4
- package/dist/riddle-client.d.cts +22 -1
- package/dist/riddle-client.d.ts +22 -1
- package/dist/riddle-client.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,6 +202,12 @@ generic inline-script warning threshold. Use `--strict=true` when you
|
|
|
202
202
|
deliberately want Riddle's non-critical script-safety warnings to block the run.
|
|
203
203
|
Critical script-safety violations remain blocked by Riddle either way.
|
|
204
204
|
|
|
205
|
+
Hosted `run-profile` checks `/v1/balance` before submitting Riddle jobs. For a
|
|
206
|
+
split viewport matrix, the preflight estimates the 30-second hosted minimum per
|
|
207
|
+
viewport and returns an `environment_blocked` result without starting partial
|
|
208
|
+
jobs when the account balance cannot cover the intended sweep. Use
|
|
209
|
+
`--balance-preflight=false` to bypass this check.
|
|
210
|
+
|
|
205
211
|
Use `--viewport-name <name>` to run only one named viewport from a
|
|
206
212
|
multi-viewport profile while preserving viewport-scoped setup actions and
|
|
207
213
|
checks:
|
|
@@ -23,16 +23,23 @@ function normalizeBaseUrl(value) {
|
|
|
23
23
|
function fetchFor(config = {}) {
|
|
24
24
|
return config.fetchImpl || fetch;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
if (config.apiKey?.trim()) return config.apiKey.trim();
|
|
28
|
-
if (process.env.RIDDLE_API_KEY?.trim()) return process.env.RIDDLE_API_KEY.trim();
|
|
26
|
+
function resolveRiddleApiKeyWithSource(config = {}) {
|
|
27
|
+
if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
|
|
28
|
+
if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
|
|
29
29
|
const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
|
|
30
30
|
if (existsSync(keyFile)) {
|
|
31
31
|
const key = readFileSync(keyFile, "utf8").trim();
|
|
32
|
-
if (key) return key;
|
|
32
|
+
if (key) return { apiKey: key, source: "file", file: keyFile };
|
|
33
33
|
}
|
|
34
34
|
throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
|
|
35
35
|
}
|
|
36
|
+
function resolveRiddleApiKeySource(config = {}) {
|
|
37
|
+
const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
|
|
38
|
+
return source;
|
|
39
|
+
}
|
|
40
|
+
function resolveRiddleApiKey(config = {}) {
|
|
41
|
+
return resolveRiddleApiKeyWithSource(config).apiKey;
|
|
42
|
+
}
|
|
36
43
|
async function riddleRequestJson(config, pathname, init = {}) {
|
|
37
44
|
const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
|
|
38
45
|
...init,
|
|
@@ -51,6 +58,9 @@ async function riddleRequestJson(config, pathname, init = {}) {
|
|
|
51
58
|
if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
|
|
52
59
|
return json ?? text;
|
|
53
60
|
}
|
|
61
|
+
async function getRiddleBalance(config = {}) {
|
|
62
|
+
return riddleRequestJson(config, "/v1/balance", { method: "GET" });
|
|
63
|
+
}
|
|
54
64
|
function previewDeployResultFromRecord(input) {
|
|
55
65
|
const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
|
|
56
66
|
return {
|
|
@@ -385,7 +395,9 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
385
395
|
}
|
|
386
396
|
function createRiddleApiClient(config = {}) {
|
|
387
397
|
return {
|
|
398
|
+
apiKeySource: () => resolveRiddleApiKeySource(config),
|
|
388
399
|
requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
|
|
400
|
+
getBalance: () => getRiddleBalance(config),
|
|
389
401
|
deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
|
|
390
402
|
deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
|
|
391
403
|
runScript: (input) => runRiddleScript(config, input),
|
|
@@ -398,8 +410,10 @@ export {
|
|
|
398
410
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
399
411
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
400
412
|
RiddleApiError,
|
|
413
|
+
resolveRiddleApiKeySource,
|
|
401
414
|
resolveRiddleApiKey,
|
|
402
415
|
riddleRequestJson,
|
|
416
|
+
getRiddleBalance,
|
|
403
417
|
deployRiddlePreview,
|
|
404
418
|
deployRiddleStaticPreview,
|
|
405
419
|
parseRiddleViewport,
|
|
@@ -3561,7 +3561,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
3561
3561
|
}
|
|
3562
3562
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
3563
3563
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
3564
|
-
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
3564
|
+
const environmentBlocker = input.environmentBlocker || extractRiddleRunnerBlocker(message);
|
|
3565
3565
|
const warnings = collectRiddleProofProfileEnvironmentBlockedWarnings(input.profile, environmentBlocker);
|
|
3566
3566
|
return {
|
|
3567
3567
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
@@ -5797,6 +5797,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
|
|
|
5797
5797
|
if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
|
|
5798
5798
|
return compactSetupResultText(normalizedSample);
|
|
5799
5799
|
}
|
|
5800
|
+
async function selectorVisibilityDiagnostic(context, selector) {
|
|
5801
|
+
return await context.locator(selector).evaluateAll((elements) => {
|
|
5802
|
+
const isVisible = (element) => {
|
|
5803
|
+
const style = window.getComputedStyle(element);
|
|
5804
|
+
const rect = element.getBoundingClientRect();
|
|
5805
|
+
return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
|
|
5806
|
+
};
|
|
5807
|
+
const describeElement = (element) => {
|
|
5808
|
+
const tag = String(element.tagName || "element").toLowerCase();
|
|
5809
|
+
const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
|
|
5810
|
+
const classes = String(element.getAttribute("class") || "")
|
|
5811
|
+
.split(/\s+/)
|
|
5812
|
+
.filter(Boolean)
|
|
5813
|
+
.slice(0, 3)
|
|
5814
|
+
.map((name) => "." + name.slice(0, 32))
|
|
5815
|
+
.join("");
|
|
5816
|
+
return (tag + id + classes).slice(0, 120);
|
|
5817
|
+
};
|
|
5818
|
+
const describeBox = (element) => {
|
|
5819
|
+
const rect = element.getBoundingClientRect();
|
|
5820
|
+
const style = window.getComputedStyle(element);
|
|
5821
|
+
const width = Math.round(rect.width * 10) / 10;
|
|
5822
|
+
const height = Math.round(rect.height * 10) / 10;
|
|
5823
|
+
return describeElement(element)
|
|
5824
|
+
+ " " + width + "x" + height
|
|
5825
|
+
+ " display=" + (style ? style.display : "unknown")
|
|
5826
|
+
+ " visibility=" + (style ? style.visibility : "unknown");
|
|
5827
|
+
};
|
|
5828
|
+
if (!elements.length) return "selector_not_found";
|
|
5829
|
+
const visibleCount = elements.filter(isVisible).length;
|
|
5830
|
+
let visibleDescendant = null;
|
|
5831
|
+
for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
|
|
5832
|
+
const descendants = Array.from(elements[index].querySelectorAll("*"));
|
|
5833
|
+
const match = descendants.find(isVisible);
|
|
5834
|
+
if (match) {
|
|
5835
|
+
visibleDescendant = {
|
|
5836
|
+
parent_index: index,
|
|
5837
|
+
label: describeElement(match),
|
|
5838
|
+
box: describeBox(match),
|
|
5839
|
+
text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
|
|
5840
|
+
};
|
|
5841
|
+
}
|
|
5842
|
+
}
|
|
5843
|
+
const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
|
|
5844
|
+
if (visibleDescendant) {
|
|
5845
|
+
parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
|
|
5846
|
+
parts.push("visible_descendant_box " + visibleDescendant.box);
|
|
5847
|
+
if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
|
|
5848
|
+
}
|
|
5849
|
+
parts.push("first " + describeBox(elements[0]));
|
|
5850
|
+
return parts.join("; ").slice(0, 500);
|
|
5851
|
+
}).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
|
|
5852
|
+
}
|
|
5800
5853
|
async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
5801
5854
|
const deadline = Date.now() + setupNumber(timeout, 15000);
|
|
5802
5855
|
let lastReason = "selector_not_found";
|
|
@@ -5807,7 +5860,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
|
5807
5860
|
if (!count) {
|
|
5808
5861
|
lastReason = "selector_not_found";
|
|
5809
5862
|
} else {
|
|
5810
|
-
lastReason =
|
|
5863
|
+
lastReason = await selectorVisibilityDiagnostic(context, selector);
|
|
5811
5864
|
for (let index = 0; index < count; index += 1) {
|
|
5812
5865
|
if (await locator.nth(index).isVisible().catch(() => false)) {
|
|
5813
5866
|
return { ok: true, count, index };
|
package/dist/cli.cjs
CHANGED
|
@@ -6584,16 +6584,23 @@ function normalizeBaseUrl(value) {
|
|
|
6584
6584
|
function fetchFor(config = {}) {
|
|
6585
6585
|
return config.fetchImpl || fetch;
|
|
6586
6586
|
}
|
|
6587
|
-
function
|
|
6588
|
-
if (config.apiKey?.trim()) return config.apiKey.trim();
|
|
6589
|
-
if (process.env.RIDDLE_API_KEY?.trim()) return process.env.RIDDLE_API_KEY.trim();
|
|
6587
|
+
function resolveRiddleApiKeyWithSource(config = {}) {
|
|
6588
|
+
if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
|
|
6589
|
+
if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
|
|
6590
6590
|
const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
|
|
6591
6591
|
if ((0, import_node_fs5.existsSync)(keyFile)) {
|
|
6592
6592
|
const key = (0, import_node_fs5.readFileSync)(keyFile, "utf8").trim();
|
|
6593
|
-
if (key) return key;
|
|
6593
|
+
if (key) return { apiKey: key, source: "file", file: keyFile };
|
|
6594
6594
|
}
|
|
6595
6595
|
throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
|
|
6596
6596
|
}
|
|
6597
|
+
function resolveRiddleApiKeySource(config = {}) {
|
|
6598
|
+
const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
|
|
6599
|
+
return source;
|
|
6600
|
+
}
|
|
6601
|
+
function resolveRiddleApiKey(config = {}) {
|
|
6602
|
+
return resolveRiddleApiKeyWithSource(config).apiKey;
|
|
6603
|
+
}
|
|
6597
6604
|
async function riddleRequestJson(config, pathname, init = {}) {
|
|
6598
6605
|
const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
|
|
6599
6606
|
...init,
|
|
@@ -6612,6 +6619,9 @@ async function riddleRequestJson(config, pathname, init = {}) {
|
|
|
6612
6619
|
if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
|
|
6613
6620
|
return json ?? text;
|
|
6614
6621
|
}
|
|
6622
|
+
async function getRiddleBalance(config = {}) {
|
|
6623
|
+
return riddleRequestJson(config, "/v1/balance", { method: "GET" });
|
|
6624
|
+
}
|
|
6615
6625
|
function previewDeployResultFromRecord(input) {
|
|
6616
6626
|
const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
|
|
6617
6627
|
return {
|
|
@@ -6946,7 +6956,9 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
6946
6956
|
}
|
|
6947
6957
|
function createRiddleApiClient(config = {}) {
|
|
6948
6958
|
return {
|
|
6959
|
+
apiKeySource: () => resolveRiddleApiKeySource(config),
|
|
6949
6960
|
requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
|
|
6961
|
+
getBalance: () => getRiddleBalance(config),
|
|
6950
6962
|
deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
|
|
6951
6963
|
deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
|
|
6952
6964
|
runScript: (input) => runRiddleScript(config, input),
|
|
@@ -10502,7 +10514,7 @@ function profileStatusExitCode(profile, status) {
|
|
|
10502
10514
|
}
|
|
10503
10515
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
10504
10516
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
10505
|
-
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
10517
|
+
const environmentBlocker = input.environmentBlocker || extractRiddleRunnerBlocker(message);
|
|
10506
10518
|
const warnings = collectRiddleProofProfileEnvironmentBlockedWarnings(input.profile, environmentBlocker);
|
|
10507
10519
|
return {
|
|
10508
10520
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
@@ -12738,6 +12750,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
|
|
|
12738
12750
|
if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
|
|
12739
12751
|
return compactSetupResultText(normalizedSample);
|
|
12740
12752
|
}
|
|
12753
|
+
async function selectorVisibilityDiagnostic(context, selector) {
|
|
12754
|
+
return await context.locator(selector).evaluateAll((elements) => {
|
|
12755
|
+
const isVisible = (element) => {
|
|
12756
|
+
const style = window.getComputedStyle(element);
|
|
12757
|
+
const rect = element.getBoundingClientRect();
|
|
12758
|
+
return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
|
|
12759
|
+
};
|
|
12760
|
+
const describeElement = (element) => {
|
|
12761
|
+
const tag = String(element.tagName || "element").toLowerCase();
|
|
12762
|
+
const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
|
|
12763
|
+
const classes = String(element.getAttribute("class") || "")
|
|
12764
|
+
.split(/\s+/)
|
|
12765
|
+
.filter(Boolean)
|
|
12766
|
+
.slice(0, 3)
|
|
12767
|
+
.map((name) => "." + name.slice(0, 32))
|
|
12768
|
+
.join("");
|
|
12769
|
+
return (tag + id + classes).slice(0, 120);
|
|
12770
|
+
};
|
|
12771
|
+
const describeBox = (element) => {
|
|
12772
|
+
const rect = element.getBoundingClientRect();
|
|
12773
|
+
const style = window.getComputedStyle(element);
|
|
12774
|
+
const width = Math.round(rect.width * 10) / 10;
|
|
12775
|
+
const height = Math.round(rect.height * 10) / 10;
|
|
12776
|
+
return describeElement(element)
|
|
12777
|
+
+ " " + width + "x" + height
|
|
12778
|
+
+ " display=" + (style ? style.display : "unknown")
|
|
12779
|
+
+ " visibility=" + (style ? style.visibility : "unknown");
|
|
12780
|
+
};
|
|
12781
|
+
if (!elements.length) return "selector_not_found";
|
|
12782
|
+
const visibleCount = elements.filter(isVisible).length;
|
|
12783
|
+
let visibleDescendant = null;
|
|
12784
|
+
for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
|
|
12785
|
+
const descendants = Array.from(elements[index].querySelectorAll("*"));
|
|
12786
|
+
const match = descendants.find(isVisible);
|
|
12787
|
+
if (match) {
|
|
12788
|
+
visibleDescendant = {
|
|
12789
|
+
parent_index: index,
|
|
12790
|
+
label: describeElement(match),
|
|
12791
|
+
box: describeBox(match),
|
|
12792
|
+
text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
|
|
12793
|
+
};
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
|
|
12797
|
+
if (visibleDescendant) {
|
|
12798
|
+
parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
|
|
12799
|
+
parts.push("visible_descendant_box " + visibleDescendant.box);
|
|
12800
|
+
if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
|
|
12801
|
+
}
|
|
12802
|
+
parts.push("first " + describeBox(elements[0]));
|
|
12803
|
+
return parts.join("; ").slice(0, 500);
|
|
12804
|
+
}).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
|
|
12805
|
+
}
|
|
12741
12806
|
async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
12742
12807
|
const deadline = Date.now() + setupNumber(timeout, 15000);
|
|
12743
12808
|
let lastReason = "selector_not_found";
|
|
@@ -12748,7 +12813,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
|
12748
12813
|
if (!count) {
|
|
12749
12814
|
lastReason = "selector_not_found";
|
|
12750
12815
|
} else {
|
|
12751
|
-
lastReason =
|
|
12816
|
+
lastReason = await selectorVisibilityDiagnostic(context, selector);
|
|
12752
12817
|
for (let index = 0; index < count; index += 1) {
|
|
12753
12818
|
if (await locator.nth(index).isVisible().catch(() => false)) {
|
|
12754
12819
|
return { ok: true, count, index };
|
|
@@ -16215,6 +16280,7 @@ function extractRiddleProofProfileResult(input) {
|
|
|
16215
16280
|
}
|
|
16216
16281
|
|
|
16217
16282
|
// src/cli.ts
|
|
16283
|
+
var RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB = 30;
|
|
16218
16284
|
function usage() {
|
|
16219
16285
|
return [
|
|
16220
16286
|
"Usage:",
|
|
@@ -16223,7 +16289,7 @@ function usage() {
|
|
|
16223
16289
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
16224
16290
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
16225
16291
|
" riddle-proof-loop status --state-path <path>",
|
|
16226
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--viewport-name <name[,name...]>] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
16292
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--viewport-name <name[,name...]>] [--strict true|false; default false] [--split-viewports true|false; default false] [--balance-preflight true|false; default true] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
16227
16293
|
" riddle-proof-loop run-profile aggregate --profile <file|json|-> --url <base-url> --input-dir <dir>|--inputs <path[,path...]> [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
16228
16294
|
" riddle-proof-loop run-profile recover --profile <file|json|-> --url <base-url> --job <job-id> [--viewport-name <name[,name...]>] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
16229
16295
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
@@ -16282,6 +16348,9 @@ function optionBoolean(options, key) {
|
|
|
16282
16348
|
function runProfileStrictOption(options) {
|
|
16283
16349
|
return optionBoolean(options, "strict") ?? false;
|
|
16284
16350
|
}
|
|
16351
|
+
function runProfileBalancePreflightOption(options) {
|
|
16352
|
+
return optionBoolean(options, "balancePreflight") ?? true;
|
|
16353
|
+
}
|
|
16285
16354
|
function runProfileSplitViewportsOption(options) {
|
|
16286
16355
|
return optionBoolean(options, "splitViewports") ?? false;
|
|
16287
16356
|
}
|
|
@@ -18204,15 +18273,25 @@ function profileEnvironmentBlockerMarkdown(result) {
|
|
|
18204
18273
|
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
18205
18274
|
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
18206
18275
|
const minimumPurchaseDollars = cliFiniteNumber(blocker.minimum_purchase_dollars);
|
|
18276
|
+
const balancePreflight = blocker.balance_preflight === true;
|
|
18277
|
+
const jobCount = cliFiniteNumber(blocker.job_count);
|
|
18278
|
+
const secondsPerJob = cliFiniteNumber(blocker.seconds_per_job);
|
|
18279
|
+
const apiKeySource = cliString(blocker.api_key_source);
|
|
18280
|
+
const apiKeyFile = cliString(blocker.api_key_file);
|
|
18207
18281
|
if (reason) lines.push(`- reason: ${reason}`);
|
|
18208
18282
|
if (source || endpoint || httpStatus !== void 0) {
|
|
18209
18283
|
lines.push(`- source: ${source || "runner"}${endpoint ? ` ${endpoint}` : ""}${httpStatus === void 0 ? "" : ` HTTP ${httpStatus}`}`);
|
|
18210
18284
|
}
|
|
18285
|
+
if (balancePreflight) lines.push("- preflight: balance");
|
|
18211
18286
|
if (error) lines.push(`- error: ${error}`);
|
|
18287
|
+
if (jobCount !== void 0 || secondsPerJob !== void 0) {
|
|
18288
|
+
lines.push(`- job estimate: ${jobCount ?? "unknown"} job(s), ${secondsPerJob ?? "unknown"}s minimum per job`);
|
|
18289
|
+
}
|
|
18212
18290
|
if (requiredSeconds !== void 0 || availableSeconds !== void 0 || deficitSeconds !== void 0) {
|
|
18213
18291
|
lines.push(`- seconds: required ${requiredSeconds ?? "unknown"}, available ${availableSeconds ?? "unknown"}, deficit ${deficitSeconds ?? "unknown"}`);
|
|
18214
18292
|
}
|
|
18215
18293
|
if (minimumPurchaseDollars !== void 0) lines.push(`- minimum purchase: $${minimumPurchaseDollars}`);
|
|
18294
|
+
if (apiKeySource) lines.push(`- auth: ${apiKeySource}${apiKeyFile ? ` ${apiKeyFile}` : ""}`);
|
|
18216
18295
|
return lines;
|
|
18217
18296
|
}
|
|
18218
18297
|
function profileCliDiagnosticLine(result) {
|
|
@@ -19349,6 +19428,100 @@ function withSplitViewportChildStatusCheck(profile, result, childRuns) {
|
|
|
19349
19428
|
const summary = status === "product_regression" ? `${profile.name} failed ${failedChecks} product invariant(s) across ${viewportCount} viewport(s).` : `${profile.name} collected split viewport artifacts but needs human review.`;
|
|
19350
19429
|
return { ...result, status, checks, summary };
|
|
19351
19430
|
}
|
|
19431
|
+
function profileRiddleJobCountForCli(profile, options) {
|
|
19432
|
+
return runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1 ? profile.target.viewports.length : 1;
|
|
19433
|
+
}
|
|
19434
|
+
function riddleBalanceAvailableSeconds(balance) {
|
|
19435
|
+
const availableSeconds = cliFiniteNumber(balance.available_seconds);
|
|
19436
|
+
if (availableSeconds !== void 0) return availableSeconds;
|
|
19437
|
+
const totalSeconds = cliFiniteNumber(balance.total_seconds);
|
|
19438
|
+
const reservedSeconds = cliFiniteNumber(balance.reserved_seconds) ?? 0;
|
|
19439
|
+
return totalSeconds === void 0 ? void 0 : totalSeconds - reservedSeconds;
|
|
19440
|
+
}
|
|
19441
|
+
function riddleBalancePreflightMetadata(profile, options) {
|
|
19442
|
+
const split = runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1;
|
|
19443
|
+
if (!split) return { status: "balance_preflight_blocked", terminal: false };
|
|
19444
|
+
return {
|
|
19445
|
+
mode: "split-viewports",
|
|
19446
|
+
job_count: profile.target.viewports.length,
|
|
19447
|
+
status: "balance_preflight_blocked",
|
|
19448
|
+
terminal: false,
|
|
19449
|
+
split_jobs: profile.target.viewports.map((viewport) => ({ viewport: viewport.name }))
|
|
19450
|
+
};
|
|
19451
|
+
}
|
|
19452
|
+
function apiKeySourceBlockerMetadata(client) {
|
|
19453
|
+
try {
|
|
19454
|
+
const source = client.apiKeySource();
|
|
19455
|
+
return {
|
|
19456
|
+
api_key_source: source.source,
|
|
19457
|
+
...source.file ? { api_key_file: source.file } : {}
|
|
19458
|
+
};
|
|
19459
|
+
} catch {
|
|
19460
|
+
return {};
|
|
19461
|
+
}
|
|
19462
|
+
}
|
|
19463
|
+
function riddleApiErrorBlockerMetadata(error) {
|
|
19464
|
+
const record = error && typeof error === "object" ? error : void 0;
|
|
19465
|
+
const status = cliFiniteNumber(record?.status);
|
|
19466
|
+
const pathValue = cliString(record?.path);
|
|
19467
|
+
const body = cliString(record?.body);
|
|
19468
|
+
return {
|
|
19469
|
+
...pathValue ? { endpoint: pathValue } : {},
|
|
19470
|
+
...status === void 0 ? {} : { http_status: status },
|
|
19471
|
+
...body ? { error: body } : {}
|
|
19472
|
+
};
|
|
19473
|
+
}
|
|
19474
|
+
async function preflightRiddleProfileBalanceForCli(profile, options, input) {
|
|
19475
|
+
if (!runProfileBalancePreflightOption(options)) return void 0;
|
|
19476
|
+
let balance;
|
|
19477
|
+
try {
|
|
19478
|
+
balance = await input.client.getBalance();
|
|
19479
|
+
} catch (error) {
|
|
19480
|
+
return createRiddleProofProfileEnvironmentBlockedResult({
|
|
19481
|
+
profile,
|
|
19482
|
+
runner: input.runner,
|
|
19483
|
+
error,
|
|
19484
|
+
environmentBlocker: {
|
|
19485
|
+
source: "riddle_api",
|
|
19486
|
+
endpoint: "/v1/balance",
|
|
19487
|
+
reason: "balance_preflight_failed",
|
|
19488
|
+
balance_preflight: true,
|
|
19489
|
+
...riddleApiErrorBlockerMetadata(error),
|
|
19490
|
+
...apiKeySourceBlockerMetadata(input.client)
|
|
19491
|
+
},
|
|
19492
|
+
riddle: riddleBalancePreflightMetadata(profile, options)
|
|
19493
|
+
});
|
|
19494
|
+
}
|
|
19495
|
+
const jobCount = profileRiddleJobCountForCli(profile, options);
|
|
19496
|
+
const requiredSeconds = jobCount * RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB;
|
|
19497
|
+
const availableSeconds = riddleBalanceAvailableSeconds(balance);
|
|
19498
|
+
if (availableSeconds === void 0 || availableSeconds >= requiredSeconds) return void 0;
|
|
19499
|
+
const reservedSeconds = cliFiniteNumber(balance.reserved_seconds);
|
|
19500
|
+
const totalSeconds = cliFiniteNumber(balance.total_seconds);
|
|
19501
|
+
const holdsCount = cliFiniteNumber(balance.holds_count);
|
|
19502
|
+
return createRiddleProofProfileEnvironmentBlockedResult({
|
|
19503
|
+
profile,
|
|
19504
|
+
runner: input.runner,
|
|
19505
|
+
error: `Riddle balance preflight failed: ${availableSeconds}s available for ${jobCount} intended hosted job(s), minimum ${requiredSeconds}s required.`,
|
|
19506
|
+
environmentBlocker: {
|
|
19507
|
+
source: "riddle_api",
|
|
19508
|
+
endpoint: "/v1/balance",
|
|
19509
|
+
reason: "insufficient_balance",
|
|
19510
|
+
error: "Insufficient available balance",
|
|
19511
|
+
balance_preflight: true,
|
|
19512
|
+
job_count: jobCount,
|
|
19513
|
+
seconds_per_job: RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB,
|
|
19514
|
+
required_seconds: requiredSeconds,
|
|
19515
|
+
available_seconds: availableSeconds,
|
|
19516
|
+
deficit_seconds: requiredSeconds - availableSeconds,
|
|
19517
|
+
...reservedSeconds === void 0 ? {} : { reserved_seconds: reservedSeconds },
|
|
19518
|
+
...totalSeconds === void 0 ? {} : { total_seconds: totalSeconds },
|
|
19519
|
+
...holdsCount === void 0 ? {} : { holds_count: holdsCount },
|
|
19520
|
+
...apiKeySourceBlockerMetadata(input.client)
|
|
19521
|
+
},
|
|
19522
|
+
riddle: riddleBalancePreflightMetadata(profile, options)
|
|
19523
|
+
});
|
|
19524
|
+
}
|
|
19352
19525
|
async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
19353
19526
|
const { client, runner } = input;
|
|
19354
19527
|
const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
|
|
@@ -19571,6 +19744,8 @@ async function runProfileForCli(profile, options) {
|
|
|
19571
19744
|
throw new Error(`Unsupported --runner ${runner}. The current CLI supports --runner riddle.`);
|
|
19572
19745
|
}
|
|
19573
19746
|
const client = createRiddleApiClient(riddleClientConfig(options));
|
|
19747
|
+
const balanceBlocked = await preflightRiddleProfileBalanceForCli(profile, options, { client, runner });
|
|
19748
|
+
if (balanceBlocked) return balanceBlocked;
|
|
19574
19749
|
if (runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1) {
|
|
19575
19750
|
return runSplitViewportProfileForCli(profile, options, { client, runner });
|
|
19576
19751
|
}
|
package/dist/cli.js
CHANGED
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PEWAIEER.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
isTerminalRiddleJobStatus,
|
|
20
20
|
parseRiddleViewport
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-33XO7WFI.js";
|
|
22
22
|
import {
|
|
23
23
|
createDisabledRiddleProofAgentAdapter,
|
|
24
24
|
readRiddleProofRunStatus,
|
|
@@ -40,6 +40,7 @@ import "./chunk-VY4Y5U57.js";
|
|
|
40
40
|
// src/cli.ts
|
|
41
41
|
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
42
42
|
import path from "path";
|
|
43
|
+
var RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB = 30;
|
|
43
44
|
function usage() {
|
|
44
45
|
return [
|
|
45
46
|
"Usage:",
|
|
@@ -48,7 +49,7 @@ function usage() {
|
|
|
48
49
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
49
50
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
50
51
|
" riddle-proof-loop status --state-path <path>",
|
|
51
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--viewport-name <name[,name...]>] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
52
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--viewport-name <name[,name...]>] [--strict true|false; default false] [--split-viewports true|false; default false] [--balance-preflight true|false; default true] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
52
53
|
" riddle-proof-loop run-profile aggregate --profile <file|json|-> --url <base-url> --input-dir <dir>|--inputs <path[,path...]> [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
53
54
|
" riddle-proof-loop run-profile recover --profile <file|json|-> --url <base-url> --job <job-id> [--viewport-name <name[,name...]>] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
54
55
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
@@ -107,6 +108,9 @@ function optionBoolean(options, key) {
|
|
|
107
108
|
function runProfileStrictOption(options) {
|
|
108
109
|
return optionBoolean(options, "strict") ?? false;
|
|
109
110
|
}
|
|
111
|
+
function runProfileBalancePreflightOption(options) {
|
|
112
|
+
return optionBoolean(options, "balancePreflight") ?? true;
|
|
113
|
+
}
|
|
110
114
|
function runProfileSplitViewportsOption(options) {
|
|
111
115
|
return optionBoolean(options, "splitViewports") ?? false;
|
|
112
116
|
}
|
|
@@ -2029,15 +2033,25 @@ function profileEnvironmentBlockerMarkdown(result) {
|
|
|
2029
2033
|
const availableSeconds = cliFiniteNumber(blocker.available_seconds);
|
|
2030
2034
|
const deficitSeconds = cliFiniteNumber(blocker.deficit_seconds);
|
|
2031
2035
|
const minimumPurchaseDollars = cliFiniteNumber(blocker.minimum_purchase_dollars);
|
|
2036
|
+
const balancePreflight = blocker.balance_preflight === true;
|
|
2037
|
+
const jobCount = cliFiniteNumber(blocker.job_count);
|
|
2038
|
+
const secondsPerJob = cliFiniteNumber(blocker.seconds_per_job);
|
|
2039
|
+
const apiKeySource = cliString(blocker.api_key_source);
|
|
2040
|
+
const apiKeyFile = cliString(blocker.api_key_file);
|
|
2032
2041
|
if (reason) lines.push(`- reason: ${reason}`);
|
|
2033
2042
|
if (source || endpoint || httpStatus !== void 0) {
|
|
2034
2043
|
lines.push(`- source: ${source || "runner"}${endpoint ? ` ${endpoint}` : ""}${httpStatus === void 0 ? "" : ` HTTP ${httpStatus}`}`);
|
|
2035
2044
|
}
|
|
2045
|
+
if (balancePreflight) lines.push("- preflight: balance");
|
|
2036
2046
|
if (error) lines.push(`- error: ${error}`);
|
|
2047
|
+
if (jobCount !== void 0 || secondsPerJob !== void 0) {
|
|
2048
|
+
lines.push(`- job estimate: ${jobCount ?? "unknown"} job(s), ${secondsPerJob ?? "unknown"}s minimum per job`);
|
|
2049
|
+
}
|
|
2037
2050
|
if (requiredSeconds !== void 0 || availableSeconds !== void 0 || deficitSeconds !== void 0) {
|
|
2038
2051
|
lines.push(`- seconds: required ${requiredSeconds ?? "unknown"}, available ${availableSeconds ?? "unknown"}, deficit ${deficitSeconds ?? "unknown"}`);
|
|
2039
2052
|
}
|
|
2040
2053
|
if (minimumPurchaseDollars !== void 0) lines.push(`- minimum purchase: $${minimumPurchaseDollars}`);
|
|
2054
|
+
if (apiKeySource) lines.push(`- auth: ${apiKeySource}${apiKeyFile ? ` ${apiKeyFile}` : ""}`);
|
|
2041
2055
|
return lines;
|
|
2042
2056
|
}
|
|
2043
2057
|
function profileCliDiagnosticLine(result) {
|
|
@@ -3174,6 +3188,100 @@ function withSplitViewportChildStatusCheck(profile, result, childRuns) {
|
|
|
3174
3188
|
const summary = status === "product_regression" ? `${profile.name} failed ${failedChecks} product invariant(s) across ${viewportCount} viewport(s).` : `${profile.name} collected split viewport artifacts but needs human review.`;
|
|
3175
3189
|
return { ...result, status, checks, summary };
|
|
3176
3190
|
}
|
|
3191
|
+
function profileRiddleJobCountForCli(profile, options) {
|
|
3192
|
+
return runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1 ? profile.target.viewports.length : 1;
|
|
3193
|
+
}
|
|
3194
|
+
function riddleBalanceAvailableSeconds(balance) {
|
|
3195
|
+
const availableSeconds = cliFiniteNumber(balance.available_seconds);
|
|
3196
|
+
if (availableSeconds !== void 0) return availableSeconds;
|
|
3197
|
+
const totalSeconds = cliFiniteNumber(balance.total_seconds);
|
|
3198
|
+
const reservedSeconds = cliFiniteNumber(balance.reserved_seconds) ?? 0;
|
|
3199
|
+
return totalSeconds === void 0 ? void 0 : totalSeconds - reservedSeconds;
|
|
3200
|
+
}
|
|
3201
|
+
function riddleBalancePreflightMetadata(profile, options) {
|
|
3202
|
+
const split = runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1;
|
|
3203
|
+
if (!split) return { status: "balance_preflight_blocked", terminal: false };
|
|
3204
|
+
return {
|
|
3205
|
+
mode: "split-viewports",
|
|
3206
|
+
job_count: profile.target.viewports.length,
|
|
3207
|
+
status: "balance_preflight_blocked",
|
|
3208
|
+
terminal: false,
|
|
3209
|
+
split_jobs: profile.target.viewports.map((viewport) => ({ viewport: viewport.name }))
|
|
3210
|
+
};
|
|
3211
|
+
}
|
|
3212
|
+
function apiKeySourceBlockerMetadata(client) {
|
|
3213
|
+
try {
|
|
3214
|
+
const source = client.apiKeySource();
|
|
3215
|
+
return {
|
|
3216
|
+
api_key_source: source.source,
|
|
3217
|
+
...source.file ? { api_key_file: source.file } : {}
|
|
3218
|
+
};
|
|
3219
|
+
} catch {
|
|
3220
|
+
return {};
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
function riddleApiErrorBlockerMetadata(error) {
|
|
3224
|
+
const record = error && typeof error === "object" ? error : void 0;
|
|
3225
|
+
const status = cliFiniteNumber(record?.status);
|
|
3226
|
+
const pathValue = cliString(record?.path);
|
|
3227
|
+
const body = cliString(record?.body);
|
|
3228
|
+
return {
|
|
3229
|
+
...pathValue ? { endpoint: pathValue } : {},
|
|
3230
|
+
...status === void 0 ? {} : { http_status: status },
|
|
3231
|
+
...body ? { error: body } : {}
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
async function preflightRiddleProfileBalanceForCli(profile, options, input) {
|
|
3235
|
+
if (!runProfileBalancePreflightOption(options)) return void 0;
|
|
3236
|
+
let balance;
|
|
3237
|
+
try {
|
|
3238
|
+
balance = await input.client.getBalance();
|
|
3239
|
+
} catch (error) {
|
|
3240
|
+
return createRiddleProofProfileEnvironmentBlockedResult({
|
|
3241
|
+
profile,
|
|
3242
|
+
runner: input.runner,
|
|
3243
|
+
error,
|
|
3244
|
+
environmentBlocker: {
|
|
3245
|
+
source: "riddle_api",
|
|
3246
|
+
endpoint: "/v1/balance",
|
|
3247
|
+
reason: "balance_preflight_failed",
|
|
3248
|
+
balance_preflight: true,
|
|
3249
|
+
...riddleApiErrorBlockerMetadata(error),
|
|
3250
|
+
...apiKeySourceBlockerMetadata(input.client)
|
|
3251
|
+
},
|
|
3252
|
+
riddle: riddleBalancePreflightMetadata(profile, options)
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3255
|
+
const jobCount = profileRiddleJobCountForCli(profile, options);
|
|
3256
|
+
const requiredSeconds = jobCount * RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB;
|
|
3257
|
+
const availableSeconds = riddleBalanceAvailableSeconds(balance);
|
|
3258
|
+
if (availableSeconds === void 0 || availableSeconds >= requiredSeconds) return void 0;
|
|
3259
|
+
const reservedSeconds = cliFiniteNumber(balance.reserved_seconds);
|
|
3260
|
+
const totalSeconds = cliFiniteNumber(balance.total_seconds);
|
|
3261
|
+
const holdsCount = cliFiniteNumber(balance.holds_count);
|
|
3262
|
+
return createRiddleProofProfileEnvironmentBlockedResult({
|
|
3263
|
+
profile,
|
|
3264
|
+
runner: input.runner,
|
|
3265
|
+
error: `Riddle balance preflight failed: ${availableSeconds}s available for ${jobCount} intended hosted job(s), minimum ${requiredSeconds}s required.`,
|
|
3266
|
+
environmentBlocker: {
|
|
3267
|
+
source: "riddle_api",
|
|
3268
|
+
endpoint: "/v1/balance",
|
|
3269
|
+
reason: "insufficient_balance",
|
|
3270
|
+
error: "Insufficient available balance",
|
|
3271
|
+
balance_preflight: true,
|
|
3272
|
+
job_count: jobCount,
|
|
3273
|
+
seconds_per_job: RIDDLE_PROFILE_BALANCE_PREFLIGHT_MIN_SECONDS_PER_JOB,
|
|
3274
|
+
required_seconds: requiredSeconds,
|
|
3275
|
+
available_seconds: availableSeconds,
|
|
3276
|
+
deficit_seconds: requiredSeconds - availableSeconds,
|
|
3277
|
+
...reservedSeconds === void 0 ? {} : { reserved_seconds: reservedSeconds },
|
|
3278
|
+
...totalSeconds === void 0 ? {} : { total_seconds: totalSeconds },
|
|
3279
|
+
...holdsCount === void 0 ? {} : { holds_count: holdsCount },
|
|
3280
|
+
...apiKeySourceBlockerMetadata(input.client)
|
|
3281
|
+
},
|
|
3282
|
+
riddle: riddleBalancePreflightMetadata(profile, options)
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3177
3285
|
async function runSingleRiddleProfileForCli(profile, options, input) {
|
|
3178
3286
|
const { client, runner } = input;
|
|
3179
3287
|
const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
|
|
@@ -3396,6 +3504,8 @@ async function runProfileForCli(profile, options) {
|
|
|
3396
3504
|
throw new Error(`Unsupported --runner ${runner}. The current CLI supports --runner riddle.`);
|
|
3397
3505
|
}
|
|
3398
3506
|
const client = createRiddleApiClient(riddleClientConfig(options));
|
|
3507
|
+
const balanceBlocked = await preflightRiddleProfileBalanceForCli(profile, options, { client, runner });
|
|
3508
|
+
if (balanceBlocked) return balanceBlocked;
|
|
3399
3509
|
if (runProfileSplitViewportsOption(options) && profile.target.viewports.length > 1) {
|
|
3400
3510
|
return runSplitViewportProfileForCli(profile, options, { client, runner });
|
|
3401
3511
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2976,6 +2976,7 @@ __export(index_exports, {
|
|
|
2976
2976
|
extractBasicGameplayEvidence: () => extractBasicGameplayEvidence,
|
|
2977
2977
|
extractPlayabilityEvidence: () => extractPlayabilityEvidence,
|
|
2978
2978
|
extractRiddleProofProfileResult: () => extractRiddleProofProfileResult,
|
|
2979
|
+
getRiddleBalance: () => getRiddleBalance,
|
|
2979
2980
|
isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
|
|
2980
2981
|
isRiddleProofPlayabilityMode: () => isRiddleProofPlayabilityMode,
|
|
2981
2982
|
isSuccessfulStatus: () => isSuccessfulStatus,
|
|
@@ -2999,6 +3000,7 @@ __export(index_exports, {
|
|
|
2999
3000
|
redactForProofDiagnostics: () => redactForProofDiagnostics,
|
|
3000
3001
|
resolveBasicGameplayProgressionCheckWithArtifactScreenshots: () => resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
|
|
3001
3002
|
resolveRiddleApiKey: () => resolveRiddleApiKey,
|
|
3003
|
+
resolveRiddleApiKeySource: () => resolveRiddleApiKeySource,
|
|
3002
3004
|
resolveRiddleProofProfileRouteUrl: () => resolveRiddleProofProfileRouteUrl,
|
|
3003
3005
|
resolveRiddleProofProfileTargetUrl: () => resolveRiddleProofProfileTargetUrl,
|
|
3004
3006
|
resolveRiddleProofProfileTimeoutSec: () => resolveRiddleProofProfileTimeoutSec,
|
|
@@ -12294,7 +12296,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
12294
12296
|
}
|
|
12295
12297
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
12296
12298
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
12297
|
-
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
12299
|
+
const environmentBlocker = input.environmentBlocker || extractRiddleRunnerBlocker(message);
|
|
12298
12300
|
const warnings = collectRiddleProofProfileEnvironmentBlockedWarnings(input.profile, environmentBlocker);
|
|
12299
12301
|
return {
|
|
12300
12302
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
@@ -14530,6 +14532,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
|
|
|
14530
14532
|
if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
|
|
14531
14533
|
return compactSetupResultText(normalizedSample);
|
|
14532
14534
|
}
|
|
14535
|
+
async function selectorVisibilityDiagnostic(context, selector) {
|
|
14536
|
+
return await context.locator(selector).evaluateAll((elements) => {
|
|
14537
|
+
const isVisible = (element) => {
|
|
14538
|
+
const style = window.getComputedStyle(element);
|
|
14539
|
+
const rect = element.getBoundingClientRect();
|
|
14540
|
+
return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
|
|
14541
|
+
};
|
|
14542
|
+
const describeElement = (element) => {
|
|
14543
|
+
const tag = String(element.tagName || "element").toLowerCase();
|
|
14544
|
+
const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
|
|
14545
|
+
const classes = String(element.getAttribute("class") || "")
|
|
14546
|
+
.split(/\s+/)
|
|
14547
|
+
.filter(Boolean)
|
|
14548
|
+
.slice(0, 3)
|
|
14549
|
+
.map((name) => "." + name.slice(0, 32))
|
|
14550
|
+
.join("");
|
|
14551
|
+
return (tag + id + classes).slice(0, 120);
|
|
14552
|
+
};
|
|
14553
|
+
const describeBox = (element) => {
|
|
14554
|
+
const rect = element.getBoundingClientRect();
|
|
14555
|
+
const style = window.getComputedStyle(element);
|
|
14556
|
+
const width = Math.round(rect.width * 10) / 10;
|
|
14557
|
+
const height = Math.round(rect.height * 10) / 10;
|
|
14558
|
+
return describeElement(element)
|
|
14559
|
+
+ " " + width + "x" + height
|
|
14560
|
+
+ " display=" + (style ? style.display : "unknown")
|
|
14561
|
+
+ " visibility=" + (style ? style.visibility : "unknown");
|
|
14562
|
+
};
|
|
14563
|
+
if (!elements.length) return "selector_not_found";
|
|
14564
|
+
const visibleCount = elements.filter(isVisible).length;
|
|
14565
|
+
let visibleDescendant = null;
|
|
14566
|
+
for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
|
|
14567
|
+
const descendants = Array.from(elements[index].querySelectorAll("*"));
|
|
14568
|
+
const match = descendants.find(isVisible);
|
|
14569
|
+
if (match) {
|
|
14570
|
+
visibleDescendant = {
|
|
14571
|
+
parent_index: index,
|
|
14572
|
+
label: describeElement(match),
|
|
14573
|
+
box: describeBox(match),
|
|
14574
|
+
text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
|
|
14575
|
+
};
|
|
14576
|
+
}
|
|
14577
|
+
}
|
|
14578
|
+
const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
|
|
14579
|
+
if (visibleDescendant) {
|
|
14580
|
+
parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
|
|
14581
|
+
parts.push("visible_descendant_box " + visibleDescendant.box);
|
|
14582
|
+
if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
|
|
14583
|
+
}
|
|
14584
|
+
parts.push("first " + describeBox(elements[0]));
|
|
14585
|
+
return parts.join("; ").slice(0, 500);
|
|
14586
|
+
}).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
|
|
14587
|
+
}
|
|
14533
14588
|
async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
14534
14589
|
const deadline = Date.now() + setupNumber(timeout, 15000);
|
|
14535
14590
|
let lastReason = "selector_not_found";
|
|
@@ -14540,7 +14595,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
|
14540
14595
|
if (!count) {
|
|
14541
14596
|
lastReason = "selector_not_found";
|
|
14542
14597
|
} else {
|
|
14543
|
-
lastReason =
|
|
14598
|
+
lastReason = await selectorVisibilityDiagnostic(context, selector);
|
|
14544
14599
|
for (let index = 0; index < count; index += 1) {
|
|
14545
14600
|
if (await locator.nth(index).isVisible().catch(() => false)) {
|
|
14546
14601
|
return { ok: true, count, index };
|
|
@@ -18031,16 +18086,23 @@ function normalizeBaseUrl(value) {
|
|
|
18031
18086
|
function fetchFor(config = {}) {
|
|
18032
18087
|
return config.fetchImpl || fetch;
|
|
18033
18088
|
}
|
|
18034
|
-
function
|
|
18035
|
-
if (config.apiKey?.trim()) return config.apiKey.trim();
|
|
18036
|
-
if (process.env.RIDDLE_API_KEY?.trim()) return process.env.RIDDLE_API_KEY.trim();
|
|
18089
|
+
function resolveRiddleApiKeyWithSource(config = {}) {
|
|
18090
|
+
if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
|
|
18091
|
+
if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
|
|
18037
18092
|
const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
|
|
18038
18093
|
if ((0, import_node_fs5.existsSync)(keyFile)) {
|
|
18039
18094
|
const key = (0, import_node_fs5.readFileSync)(keyFile, "utf8").trim();
|
|
18040
|
-
if (key) return key;
|
|
18095
|
+
if (key) return { apiKey: key, source: "file", file: keyFile };
|
|
18041
18096
|
}
|
|
18042
18097
|
throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
|
|
18043
18098
|
}
|
|
18099
|
+
function resolveRiddleApiKeySource(config = {}) {
|
|
18100
|
+
const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
|
|
18101
|
+
return source;
|
|
18102
|
+
}
|
|
18103
|
+
function resolveRiddleApiKey(config = {}) {
|
|
18104
|
+
return resolveRiddleApiKeyWithSource(config).apiKey;
|
|
18105
|
+
}
|
|
18044
18106
|
async function riddleRequestJson(config, pathname, init = {}) {
|
|
18045
18107
|
const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
|
|
18046
18108
|
...init,
|
|
@@ -18059,6 +18121,9 @@ async function riddleRequestJson(config, pathname, init = {}) {
|
|
|
18059
18121
|
if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
|
|
18060
18122
|
return json ?? text;
|
|
18061
18123
|
}
|
|
18124
|
+
async function getRiddleBalance(config = {}) {
|
|
18125
|
+
return riddleRequestJson(config, "/v1/balance", { method: "GET" });
|
|
18126
|
+
}
|
|
18062
18127
|
function previewDeployResultFromRecord(input) {
|
|
18063
18128
|
const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
|
|
18064
18129
|
return {
|
|
@@ -18393,7 +18458,9 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
18393
18458
|
}
|
|
18394
18459
|
function createRiddleApiClient(config = {}) {
|
|
18395
18460
|
return {
|
|
18461
|
+
apiKeySource: () => resolveRiddleApiKeySource(config),
|
|
18396
18462
|
requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
|
|
18463
|
+
getBalance: () => getRiddleBalance(config),
|
|
18397
18464
|
deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
|
|
18398
18465
|
deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
|
|
18399
18466
|
runScript: (input) => runRiddleScript(config, input),
|
|
@@ -18480,6 +18547,7 @@ function createRiddleApiClient(config = {}) {
|
|
|
18480
18547
|
extractBasicGameplayEvidence,
|
|
18481
18548
|
extractPlayabilityEvidence,
|
|
18482
18549
|
extractRiddleProofProfileResult,
|
|
18550
|
+
getRiddleBalance,
|
|
18483
18551
|
isDuplicateCheckpointResponse,
|
|
18484
18552
|
isRiddleProofPlayabilityMode,
|
|
18485
18553
|
isSuccessfulStatus,
|
|
@@ -18503,6 +18571,7 @@ function createRiddleApiClient(config = {}) {
|
|
|
18503
18571
|
redactForProofDiagnostics,
|
|
18504
18572
|
resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
|
|
18505
18573
|
resolveRiddleApiKey,
|
|
18574
|
+
resolveRiddleApiKeySource,
|
|
18506
18575
|
resolveRiddleProofProfileRouteUrl,
|
|
18507
18576
|
resolveRiddleProofProfileTargetUrl,
|
|
18508
18577
|
resolveRiddleProofProfileTimeoutSec,
|
package/dist/index.d.cts
CHANGED
|
@@ -11,4 +11,4 @@ export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_V
|
|
|
11
11
|
export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.cjs';
|
|
12
12
|
export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.cjs';
|
|
13
13
|
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
|
|
14
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
|
|
14
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_V
|
|
|
11
11
|
export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.js';
|
|
12
12
|
export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
|
|
13
13
|
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
|
|
14
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
|
|
14
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-PEWAIEER.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
@@ -70,14 +70,16 @@ import {
|
|
|
70
70
|
createRiddleApiClient,
|
|
71
71
|
deployRiddlePreview,
|
|
72
72
|
deployRiddleStaticPreview,
|
|
73
|
+
getRiddleBalance,
|
|
73
74
|
isTerminalRiddleJobStatus,
|
|
74
75
|
parseRiddleViewport,
|
|
75
76
|
pollRiddleJob,
|
|
76
77
|
resolveRiddleApiKey,
|
|
78
|
+
resolveRiddleApiKeySource,
|
|
77
79
|
riddleRequestJson,
|
|
78
80
|
runRiddleScript,
|
|
79
81
|
runRiddleServerPreview
|
|
80
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-33XO7WFI.js";
|
|
81
83
|
import {
|
|
82
84
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
83
85
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
|
@@ -220,6 +222,7 @@ export {
|
|
|
220
222
|
extractBasicGameplayEvidence,
|
|
221
223
|
extractPlayabilityEvidence,
|
|
222
224
|
extractRiddleProofProfileResult,
|
|
225
|
+
getRiddleBalance,
|
|
223
226
|
isDuplicateCheckpointResponse,
|
|
224
227
|
isRiddleProofPlayabilityMode,
|
|
225
228
|
isSuccessfulStatus,
|
|
@@ -243,6 +246,7 @@ export {
|
|
|
243
246
|
redactForProofDiagnostics,
|
|
244
247
|
resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
|
|
245
248
|
resolveRiddleApiKey,
|
|
249
|
+
resolveRiddleApiKeySource,
|
|
246
250
|
resolveRiddleProofProfileRouteUrl,
|
|
247
251
|
resolveRiddleProofProfileTargetUrl,
|
|
248
252
|
resolveRiddleProofProfileTimeoutSec,
|
package/dist/profile.cjs
CHANGED
|
@@ -3608,7 +3608,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
|
|
|
3608
3608
|
}
|
|
3609
3609
|
function createRiddleProofProfileEnvironmentBlockedResult(input) {
|
|
3610
3610
|
const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
|
|
3611
|
-
const environmentBlocker = extractRiddleRunnerBlocker(message);
|
|
3611
|
+
const environmentBlocker = input.environmentBlocker || extractRiddleRunnerBlocker(message);
|
|
3612
3612
|
const warnings = collectRiddleProofProfileEnvironmentBlockedWarnings(input.profile, environmentBlocker);
|
|
3613
3613
|
return {
|
|
3614
3614
|
version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
@@ -5844,6 +5844,59 @@ function setupCaseInsensitiveTextSample(sample, action) {
|
|
|
5844
5844
|
if (!normalizedSample.toLowerCase().includes(normalizedExpected.toLowerCase())) return "";
|
|
5845
5845
|
return compactSetupResultText(normalizedSample);
|
|
5846
5846
|
}
|
|
5847
|
+
async function selectorVisibilityDiagnostic(context, selector) {
|
|
5848
|
+
return await context.locator(selector).evaluateAll((elements) => {
|
|
5849
|
+
const isVisible = (element) => {
|
|
5850
|
+
const style = window.getComputedStyle(element);
|
|
5851
|
+
const rect = element.getBoundingClientRect();
|
|
5852
|
+
return style && style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
|
|
5853
|
+
};
|
|
5854
|
+
const describeElement = (element) => {
|
|
5855
|
+
const tag = String(element.tagName || "element").toLowerCase();
|
|
5856
|
+
const id = element.id ? "#" + String(element.id).slice(0, 40) : "";
|
|
5857
|
+
const classes = String(element.getAttribute("class") || "")
|
|
5858
|
+
.split(/\s+/)
|
|
5859
|
+
.filter(Boolean)
|
|
5860
|
+
.slice(0, 3)
|
|
5861
|
+
.map((name) => "." + name.slice(0, 32))
|
|
5862
|
+
.join("");
|
|
5863
|
+
return (tag + id + classes).slice(0, 120);
|
|
5864
|
+
};
|
|
5865
|
+
const describeBox = (element) => {
|
|
5866
|
+
const rect = element.getBoundingClientRect();
|
|
5867
|
+
const style = window.getComputedStyle(element);
|
|
5868
|
+
const width = Math.round(rect.width * 10) / 10;
|
|
5869
|
+
const height = Math.round(rect.height * 10) / 10;
|
|
5870
|
+
return describeElement(element)
|
|
5871
|
+
+ " " + width + "x" + height
|
|
5872
|
+
+ " display=" + (style ? style.display : "unknown")
|
|
5873
|
+
+ " visibility=" + (style ? style.visibility : "unknown");
|
|
5874
|
+
};
|
|
5875
|
+
if (!elements.length) return "selector_not_found";
|
|
5876
|
+
const visibleCount = elements.filter(isVisible).length;
|
|
5877
|
+
let visibleDescendant = null;
|
|
5878
|
+
for (let index = 0; index < elements.length && !visibleDescendant; index += 1) {
|
|
5879
|
+
const descendants = Array.from(elements[index].querySelectorAll("*"));
|
|
5880
|
+
const match = descendants.find(isVisible);
|
|
5881
|
+
if (match) {
|
|
5882
|
+
visibleDescendant = {
|
|
5883
|
+
parent_index: index,
|
|
5884
|
+
label: describeElement(match),
|
|
5885
|
+
box: describeBox(match),
|
|
5886
|
+
text: String(match.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
|
|
5887
|
+
};
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
const parts = ["no_visible_match", "matched " + elements.length, "visible " + visibleCount];
|
|
5891
|
+
if (visibleDescendant) {
|
|
5892
|
+
parts.push("visible_descendant " + visibleDescendant.label + " parent_index=" + visibleDescendant.parent_index);
|
|
5893
|
+
parts.push("visible_descendant_box " + visibleDescendant.box);
|
|
5894
|
+
if (visibleDescendant.text) parts.push("visible_descendant_text " + JSON.stringify(visibleDescendant.text));
|
|
5895
|
+
}
|
|
5896
|
+
parts.push("first " + describeBox(elements[0]));
|
|
5897
|
+
return parts.join("; ").slice(0, 500);
|
|
5898
|
+
}).catch((error) => "no_visible_match; diagnostic_error " + String(error && error.message ? error.message : error).slice(0, 240));
|
|
5899
|
+
}
|
|
5847
5900
|
async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
5848
5901
|
const deadline = Date.now() + setupNumber(timeout, 15000);
|
|
5849
5902
|
let lastReason = "selector_not_found";
|
|
@@ -5854,7 +5907,7 @@ async function waitForAnyVisibleSelector(context, selector, timeout) {
|
|
|
5854
5907
|
if (!count) {
|
|
5855
5908
|
lastReason = "selector_not_found";
|
|
5856
5909
|
} else {
|
|
5857
|
-
lastReason =
|
|
5910
|
+
lastReason = await selectorVisibilityDiagnostic(context, selector);
|
|
5858
5911
|
for (let index = 0; index < count; index += 1) {
|
|
5859
5912
|
if (await locator.nth(index).isVisible().catch(() => false)) {
|
|
5860
5913
|
return { ok: true, count, index };
|
package/dist/profile.d.cts
CHANGED
|
@@ -467,6 +467,7 @@ declare function createRiddleProofProfileEnvironmentBlockedResult(input: {
|
|
|
467
467
|
profile: RiddleProofProfile;
|
|
468
468
|
runner?: RiddleProofProfileRunner;
|
|
469
469
|
error?: unknown;
|
|
470
|
+
environmentBlocker?: Record<string, JsonValue>;
|
|
470
471
|
riddle?: RiddleProofProfileResult["riddle"];
|
|
471
472
|
artifacts?: RiddleProofProfileArtifactRef[];
|
|
472
473
|
}): RiddleProofProfileResult;
|
package/dist/profile.d.ts
CHANGED
|
@@ -467,6 +467,7 @@ declare function createRiddleProofProfileEnvironmentBlockedResult(input: {
|
|
|
467
467
|
profile: RiddleProofProfile;
|
|
468
468
|
runner?: RiddleProofProfileRunner;
|
|
469
469
|
error?: unknown;
|
|
470
|
+
environmentBlocker?: Record<string, JsonValue>;
|
|
470
471
|
riddle?: RiddleProofProfileResult["riddle"];
|
|
471
472
|
artifacts?: RiddleProofProfileArtifactRef[];
|
|
472
473
|
}): RiddleProofProfileResult;
|
package/dist/profile.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveRiddleProofProfileTimeoutSec,
|
|
24
24
|
slugifyRiddleProofProfileName,
|
|
25
25
|
summarizeRiddleProofProfileResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-PEWAIEER.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
package/dist/riddle-client.cjs
CHANGED
|
@@ -36,10 +36,12 @@ __export(riddle_client_exports, {
|
|
|
36
36
|
createRiddleApiClient: () => createRiddleApiClient,
|
|
37
37
|
deployRiddlePreview: () => deployRiddlePreview,
|
|
38
38
|
deployRiddleStaticPreview: () => deployRiddleStaticPreview,
|
|
39
|
+
getRiddleBalance: () => getRiddleBalance,
|
|
39
40
|
isTerminalRiddleJobStatus: () => isTerminalRiddleJobStatus,
|
|
40
41
|
parseRiddleViewport: () => parseRiddleViewport,
|
|
41
42
|
pollRiddleJob: () => pollRiddleJob,
|
|
42
43
|
resolveRiddleApiKey: () => resolveRiddleApiKey,
|
|
44
|
+
resolveRiddleApiKeySource: () => resolveRiddleApiKeySource,
|
|
43
45
|
riddleRequestJson: () => riddleRequestJson,
|
|
44
46
|
runRiddleScript: () => runRiddleScript,
|
|
45
47
|
runRiddleServerPreview: () => runRiddleServerPreview
|
|
@@ -69,16 +71,23 @@ function normalizeBaseUrl(value) {
|
|
|
69
71
|
function fetchFor(config = {}) {
|
|
70
72
|
return config.fetchImpl || fetch;
|
|
71
73
|
}
|
|
72
|
-
function
|
|
73
|
-
if (config.apiKey?.trim()) return config.apiKey.trim();
|
|
74
|
-
if (process.env.RIDDLE_API_KEY?.trim()) return process.env.RIDDLE_API_KEY.trim();
|
|
74
|
+
function resolveRiddleApiKeyWithSource(config = {}) {
|
|
75
|
+
if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
|
|
76
|
+
if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
|
|
75
77
|
const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
|
|
76
78
|
if ((0, import_node_fs.existsSync)(keyFile)) {
|
|
77
79
|
const key = (0, import_node_fs.readFileSync)(keyFile, "utf8").trim();
|
|
78
|
-
if (key) return key;
|
|
80
|
+
if (key) return { apiKey: key, source: "file", file: keyFile };
|
|
79
81
|
}
|
|
80
82
|
throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
|
|
81
83
|
}
|
|
84
|
+
function resolveRiddleApiKeySource(config = {}) {
|
|
85
|
+
const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
|
|
86
|
+
return source;
|
|
87
|
+
}
|
|
88
|
+
function resolveRiddleApiKey(config = {}) {
|
|
89
|
+
return resolveRiddleApiKeyWithSource(config).apiKey;
|
|
90
|
+
}
|
|
82
91
|
async function riddleRequestJson(config, pathname, init = {}) {
|
|
83
92
|
const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
|
|
84
93
|
...init,
|
|
@@ -97,6 +106,9 @@ async function riddleRequestJson(config, pathname, init = {}) {
|
|
|
97
106
|
if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
|
|
98
107
|
return json ?? text;
|
|
99
108
|
}
|
|
109
|
+
async function getRiddleBalance(config = {}) {
|
|
110
|
+
return riddleRequestJson(config, "/v1/balance", { method: "GET" });
|
|
111
|
+
}
|
|
100
112
|
function previewDeployResultFromRecord(input) {
|
|
101
113
|
const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
|
|
102
114
|
return {
|
|
@@ -431,7 +443,9 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
431
443
|
}
|
|
432
444
|
function createRiddleApiClient(config = {}) {
|
|
433
445
|
return {
|
|
446
|
+
apiKeySource: () => resolveRiddleApiKeySource(config),
|
|
434
447
|
requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
|
|
448
|
+
getBalance: () => getRiddleBalance(config),
|
|
435
449
|
deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
|
|
436
450
|
deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
|
|
437
451
|
runScript: (input) => runRiddleScript(config, input),
|
|
@@ -447,10 +461,12 @@ function createRiddleApiClient(config = {}) {
|
|
|
447
461
|
createRiddleApiClient,
|
|
448
462
|
deployRiddlePreview,
|
|
449
463
|
deployRiddleStaticPreview,
|
|
464
|
+
getRiddleBalance,
|
|
450
465
|
isTerminalRiddleJobStatus,
|
|
451
466
|
parseRiddleViewport,
|
|
452
467
|
pollRiddleJob,
|
|
453
468
|
resolveRiddleApiKey,
|
|
469
|
+
resolveRiddleApiKeySource,
|
|
454
470
|
riddleRequestJson,
|
|
455
471
|
runRiddleScript,
|
|
456
472
|
runRiddleServerPreview
|
package/dist/riddle-client.d.cts
CHANGED
|
@@ -7,6 +7,23 @@ interface RiddleClientConfig {
|
|
|
7
7
|
apiBaseUrl?: string;
|
|
8
8
|
fetchImpl?: RiddleFetch;
|
|
9
9
|
}
|
|
10
|
+
interface RiddleApiKeySource {
|
|
11
|
+
source: "option" | "env" | "file";
|
|
12
|
+
file?: string;
|
|
13
|
+
}
|
|
14
|
+
interface RiddleBalanceResult {
|
|
15
|
+
available_seconds?: number;
|
|
16
|
+
reserved_seconds?: number;
|
|
17
|
+
total_seconds?: number;
|
|
18
|
+
available_time?: string;
|
|
19
|
+
total_time?: string;
|
|
20
|
+
available_dollars?: number;
|
|
21
|
+
reserved_dollars?: number;
|
|
22
|
+
total_dollars?: number;
|
|
23
|
+
currency?: string;
|
|
24
|
+
holds_count?: number;
|
|
25
|
+
rate?: Record<string, unknown>;
|
|
26
|
+
}
|
|
10
27
|
interface RiddlePollProgressSnapshot {
|
|
11
28
|
job_id: string;
|
|
12
29
|
status: string | null;
|
|
@@ -107,8 +124,10 @@ declare class RiddleApiError extends Error {
|
|
|
107
124
|
readonly path: string;
|
|
108
125
|
constructor(pathname: string, status: number, body: string);
|
|
109
126
|
}
|
|
127
|
+
declare function resolveRiddleApiKeySource(config?: RiddleClientConfig): RiddleApiKeySource;
|
|
110
128
|
declare function resolveRiddleApiKey(config?: RiddleClientConfig): string;
|
|
111
129
|
declare function riddleRequestJson<T = unknown>(config: RiddleClientConfig, pathname: string, init?: RequestInit): Promise<T>;
|
|
130
|
+
declare function getRiddleBalance(config?: RiddleClientConfig): Promise<RiddleBalanceResult>;
|
|
112
131
|
declare function deployRiddlePreview(config: RiddleClientConfig, directory: string, label: string, framework?: RiddlePreviewFramework): Promise<RiddlePreviewDeployResult>;
|
|
113
132
|
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string): Promise<RiddlePreviewDeployResult>;
|
|
114
133
|
declare function parseRiddleViewport(value?: string): {
|
|
@@ -120,7 +139,9 @@ declare function runRiddleScript(config: RiddleClientConfig, input: RiddleRunScr
|
|
|
120
139
|
declare function isTerminalRiddleJobStatus(status: unknown): boolean;
|
|
121
140
|
declare function pollRiddleJob(config: RiddleClientConfig, jobId: string, options?: RiddlePollJobOptions): Promise<RiddlePollJobResult>;
|
|
122
141
|
declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
142
|
+
apiKeySource: () => RiddleApiKeySource;
|
|
123
143
|
requestJson: <T = unknown>(pathname: string, init?: RequestInit) => Promise<T>;
|
|
144
|
+
getBalance: () => Promise<RiddleBalanceResult>;
|
|
124
145
|
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework) => Promise<RiddlePreviewDeployResult>;
|
|
125
146
|
deployStaticPreview: (directory: string, label: string) => Promise<RiddlePreviewDeployResult>;
|
|
126
147
|
runScript: (input: RiddleRunScriptInput) => Promise<Record<string, unknown>>;
|
|
@@ -128,4 +149,4 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
|
128
149
|
pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
|
|
129
150
|
};
|
|
130
151
|
|
|
131
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployResult, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
|
152
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployResult, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
package/dist/riddle-client.d.ts
CHANGED
|
@@ -7,6 +7,23 @@ interface RiddleClientConfig {
|
|
|
7
7
|
apiBaseUrl?: string;
|
|
8
8
|
fetchImpl?: RiddleFetch;
|
|
9
9
|
}
|
|
10
|
+
interface RiddleApiKeySource {
|
|
11
|
+
source: "option" | "env" | "file";
|
|
12
|
+
file?: string;
|
|
13
|
+
}
|
|
14
|
+
interface RiddleBalanceResult {
|
|
15
|
+
available_seconds?: number;
|
|
16
|
+
reserved_seconds?: number;
|
|
17
|
+
total_seconds?: number;
|
|
18
|
+
available_time?: string;
|
|
19
|
+
total_time?: string;
|
|
20
|
+
available_dollars?: number;
|
|
21
|
+
reserved_dollars?: number;
|
|
22
|
+
total_dollars?: number;
|
|
23
|
+
currency?: string;
|
|
24
|
+
holds_count?: number;
|
|
25
|
+
rate?: Record<string, unknown>;
|
|
26
|
+
}
|
|
10
27
|
interface RiddlePollProgressSnapshot {
|
|
11
28
|
job_id: string;
|
|
12
29
|
status: string | null;
|
|
@@ -107,8 +124,10 @@ declare class RiddleApiError extends Error {
|
|
|
107
124
|
readonly path: string;
|
|
108
125
|
constructor(pathname: string, status: number, body: string);
|
|
109
126
|
}
|
|
127
|
+
declare function resolveRiddleApiKeySource(config?: RiddleClientConfig): RiddleApiKeySource;
|
|
110
128
|
declare function resolveRiddleApiKey(config?: RiddleClientConfig): string;
|
|
111
129
|
declare function riddleRequestJson<T = unknown>(config: RiddleClientConfig, pathname: string, init?: RequestInit): Promise<T>;
|
|
130
|
+
declare function getRiddleBalance(config?: RiddleClientConfig): Promise<RiddleBalanceResult>;
|
|
112
131
|
declare function deployRiddlePreview(config: RiddleClientConfig, directory: string, label: string, framework?: RiddlePreviewFramework): Promise<RiddlePreviewDeployResult>;
|
|
113
132
|
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string): Promise<RiddlePreviewDeployResult>;
|
|
114
133
|
declare function parseRiddleViewport(value?: string): {
|
|
@@ -120,7 +139,9 @@ declare function runRiddleScript(config: RiddleClientConfig, input: RiddleRunScr
|
|
|
120
139
|
declare function isTerminalRiddleJobStatus(status: unknown): boolean;
|
|
121
140
|
declare function pollRiddleJob(config: RiddleClientConfig, jobId: string, options?: RiddlePollJobOptions): Promise<RiddlePollJobResult>;
|
|
122
141
|
declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
142
|
+
apiKeySource: () => RiddleApiKeySource;
|
|
123
143
|
requestJson: <T = unknown>(pathname: string, init?: RequestInit) => Promise<T>;
|
|
144
|
+
getBalance: () => Promise<RiddleBalanceResult>;
|
|
124
145
|
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework) => Promise<RiddlePreviewDeployResult>;
|
|
125
146
|
deployStaticPreview: (directory: string, label: string) => Promise<RiddlePreviewDeployResult>;
|
|
126
147
|
runScript: (input: RiddleRunScriptInput) => Promise<Record<string, unknown>>;
|
|
@@ -128,4 +149,4 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
|
128
149
|
pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
|
|
129
150
|
};
|
|
130
151
|
|
|
131
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployResult, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
|
152
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployResult, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
package/dist/riddle-client.js
CHANGED
|
@@ -5,14 +5,16 @@ import {
|
|
|
5
5
|
createRiddleApiClient,
|
|
6
6
|
deployRiddlePreview,
|
|
7
7
|
deployRiddleStaticPreview,
|
|
8
|
+
getRiddleBalance,
|
|
8
9
|
isTerminalRiddleJobStatus,
|
|
9
10
|
parseRiddleViewport,
|
|
10
11
|
pollRiddleJob,
|
|
11
12
|
resolveRiddleApiKey,
|
|
13
|
+
resolveRiddleApiKeySource,
|
|
12
14
|
riddleRequestJson,
|
|
13
15
|
runRiddleScript,
|
|
14
16
|
runRiddleServerPreview
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-33XO7WFI.js";
|
|
16
18
|
export {
|
|
17
19
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
18
20
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
@@ -20,10 +22,12 @@ export {
|
|
|
20
22
|
createRiddleApiClient,
|
|
21
23
|
deployRiddlePreview,
|
|
22
24
|
deployRiddleStaticPreview,
|
|
25
|
+
getRiddleBalance,
|
|
23
26
|
isTerminalRiddleJobStatus,
|
|
24
27
|
parseRiddleViewport,
|
|
25
28
|
pollRiddleJob,
|
|
26
29
|
resolveRiddleApiKey,
|
|
30
|
+
resolveRiddleApiKeySource,
|
|
27
31
|
riddleRequestJson,
|
|
28
32
|
runRiddleScript,
|
|
29
33
|
runRiddleServerPreview
|