@riddledc/riddle-proof 0.7.52 → 0.7.53

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 CHANGED
@@ -256,7 +256,11 @@ proof state must expose a terminal flag. `assert_selector_count` accepts
256
256
  `local_storage` and `session_storage` accept a `key` plus string `value` or
257
257
  JSON `json` / `value_json`, and can reload the page with `reload: true`.
258
258
  `clear_storage` clears `local`, `session`, or `both` browser storage scopes,
259
- defaults to `both`, and can also reload with `reload: true`.
259
+ defaults to `both`, and can also reload with `reload: true`. Any setup action
260
+ can include `repeat` / `repeat_count` / `times` from 1 to 100; each repetition
261
+ is recorded with `repeat_index` and `repeat_count`, and `after_ms` runs after
262
+ each repetition. Use it for bounded game proof helpers, retry controls, or other
263
+ workflows where one declarative action needs to advance the app several times.
260
264
 
261
265
  `target.timeout_sec` is optional. Use it for known-heavy profile targets so the
262
266
  profile carries its own hosted Riddle worker budget; an explicit CLI `--timeout`
@@ -220,6 +220,14 @@ function normalizeSetupActionArgs(input, index) {
220
220
  }
221
221
  return argsInput.map(toJsonValue);
222
222
  }
223
+ function normalizeSetupActionRepeat(input, index) {
224
+ const repeat = numberValue(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
225
+ if (repeat === void 0) return void 0;
226
+ if (!Number.isInteger(repeat) || repeat < 1 || repeat > 100) {
227
+ throw new Error(`target.setup_actions[${index}].repeat must be an integer from 1 to 100.`);
228
+ }
229
+ return repeat;
230
+ }
223
231
  function normalizeSetupAction(input, index) {
224
232
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
225
233
  const type = normalizeSetupActionType(stringValue(input.type), index);
@@ -278,6 +286,7 @@ function normalizeSetupAction(input, index) {
278
286
  ms: numberValue(input.ms) ?? numberValue(input.wait_ms) ?? numberValue(input.waitMs),
279
287
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
280
288
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
289
+ repeat: normalizeSetupActionRepeat(input, index),
281
290
  reload: input.reload === true,
282
291
  storage: normalizeSetupActionStorage(input.storage, index),
283
292
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
@@ -2426,11 +2435,22 @@ async function executeSetupActions(actions) {
2426
2435
  const results = [];
2427
2436
  for (let index = 0; index < (actions || []).length; index += 1) {
2428
2437
  const action = actions[index] || {};
2429
- const result = await executeSetupAction(action, index);
2430
- results.push(result);
2431
- const afterMs = setupNumber(action.after_ms, 0);
2432
- if (afterMs) await page.waitForTimeout(afterMs);
2433
- if (result.ok === false && action.continue_on_failure !== true) break;
2438
+ const requestedRepeat = setupNumber(action.repeat, 1);
2439
+ const repeatCount = Math.min(100, Math.max(1, Math.floor(requestedRepeat || 1)));
2440
+ let shouldStop = false;
2441
+ for (let repeatIndex = 0; repeatIndex < repeatCount; repeatIndex += 1) {
2442
+ const result = await executeSetupAction(action, index);
2443
+ results.push(repeatCount > 1
2444
+ ? { ...result, repeat_index: repeatIndex, repeat_count: repeatCount }
2445
+ : result);
2446
+ const afterMs = setupNumber(action.after_ms, 0);
2447
+ if (afterMs) await page.waitForTimeout(afterMs);
2448
+ if (result.ok === false && action.continue_on_failure !== true) {
2449
+ shouldStop = true;
2450
+ break;
2451
+ }
2452
+ }
2453
+ if (shouldStop) break;
2434
2454
  }
2435
2455
  return results;
2436
2456
  }
package/dist/cli.cjs CHANGED
@@ -7093,6 +7093,14 @@ function normalizeSetupActionArgs(input, index) {
7093
7093
  }
7094
7094
  return argsInput.map(toJsonValue);
7095
7095
  }
7096
+ function normalizeSetupActionRepeat(input, index) {
7097
+ const repeat = numberValue(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
7098
+ if (repeat === void 0) return void 0;
7099
+ if (!Number.isInteger(repeat) || repeat < 1 || repeat > 100) {
7100
+ throw new Error(`target.setup_actions[${index}].repeat must be an integer from 1 to 100.`);
7101
+ }
7102
+ return repeat;
7103
+ }
7096
7104
  function normalizeSetupAction(input, index) {
7097
7105
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
7098
7106
  const type = normalizeSetupActionType(stringValue2(input.type), index);
@@ -7151,6 +7159,7 @@ function normalizeSetupAction(input, index) {
7151
7159
  ms: numberValue(input.ms) ?? numberValue(input.wait_ms) ?? numberValue(input.waitMs),
7152
7160
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
7153
7161
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
7162
+ repeat: normalizeSetupActionRepeat(input, index),
7154
7163
  reload: input.reload === true,
7155
7164
  storage: normalizeSetupActionStorage(input.storage, index),
7156
7165
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
@@ -9283,11 +9292,22 @@ async function executeSetupActions(actions) {
9283
9292
  const results = [];
9284
9293
  for (let index = 0; index < (actions || []).length; index += 1) {
9285
9294
  const action = actions[index] || {};
9286
- const result = await executeSetupAction(action, index);
9287
- results.push(result);
9288
- const afterMs = setupNumber(action.after_ms, 0);
9289
- if (afterMs) await page.waitForTimeout(afterMs);
9290
- if (result.ok === false && action.continue_on_failure !== true) break;
9295
+ const requestedRepeat = setupNumber(action.repeat, 1);
9296
+ const repeatCount = Math.min(100, Math.max(1, Math.floor(requestedRepeat || 1)));
9297
+ let shouldStop = false;
9298
+ for (let repeatIndex = 0; repeatIndex < repeatCount; repeatIndex += 1) {
9299
+ const result = await executeSetupAction(action, index);
9300
+ results.push(repeatCount > 1
9301
+ ? { ...result, repeat_index: repeatIndex, repeat_count: repeatCount }
9302
+ : result);
9303
+ const afterMs = setupNumber(action.after_ms, 0);
9304
+ if (afterMs) await page.waitForTimeout(afterMs);
9305
+ if (result.ok === false && action.continue_on_failure !== true) {
9306
+ shouldStop = true;
9307
+ break;
9308
+ }
9309
+ }
9310
+ if (shouldStop) break;
9291
9311
  }
9292
9312
  return results;
9293
9313
  }
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  profileStatusExitCode,
11
11
  resolveRiddleProofProfileTargetUrl,
12
12
  resolveRiddleProofProfileTimeoutSec
13
- } from "./chunk-4S6RC5IJ.js";
13
+ } from "./chunk-IKT7AKZN.js";
14
14
  import {
15
15
  createRiddleApiClient,
16
16
  parseRiddleViewport
package/dist/index.cjs CHANGED
@@ -8934,6 +8934,14 @@ function normalizeSetupActionArgs(input, index) {
8934
8934
  }
8935
8935
  return argsInput.map(toJsonValue);
8936
8936
  }
8937
+ function normalizeSetupActionRepeat(input, index) {
8938
+ const repeat = numberValue3(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
8939
+ if (repeat === void 0) return void 0;
8940
+ if (!Number.isInteger(repeat) || repeat < 1 || repeat > 100) {
8941
+ throw new Error(`target.setup_actions[${index}].repeat must be an integer from 1 to 100.`);
8942
+ }
8943
+ return repeat;
8944
+ }
8937
8945
  function normalizeSetupAction(input, index) {
8938
8946
  if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
8939
8947
  const type = normalizeSetupActionType(stringValue5(input.type), index);
@@ -8992,6 +9000,7 @@ function normalizeSetupAction(input, index) {
8992
9000
  ms: numberValue3(input.ms) ?? numberValue3(input.wait_ms) ?? numberValue3(input.waitMs),
8993
9001
  timeout_ms: numberValue3(input.timeout_ms) ?? numberValue3(input.timeoutMs),
8994
9002
  after_ms: numberValue3(input.after_ms) ?? numberValue3(input.afterMs),
9003
+ repeat: normalizeSetupActionRepeat(input, index),
8995
9004
  reload: input.reload === true,
8996
9005
  storage: normalizeSetupActionStorage(input.storage, index),
8997
9006
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
@@ -11140,11 +11149,22 @@ async function executeSetupActions(actions) {
11140
11149
  const results = [];
11141
11150
  for (let index = 0; index < (actions || []).length; index += 1) {
11142
11151
  const action = actions[index] || {};
11143
- const result = await executeSetupAction(action, index);
11144
- results.push(result);
11145
- const afterMs = setupNumber(action.after_ms, 0);
11146
- if (afterMs) await page.waitForTimeout(afterMs);
11147
- if (result.ok === false && action.continue_on_failure !== true) break;
11152
+ const requestedRepeat = setupNumber(action.repeat, 1);
11153
+ const repeatCount = Math.min(100, Math.max(1, Math.floor(requestedRepeat || 1)));
11154
+ let shouldStop = false;
11155
+ for (let repeatIndex = 0; repeatIndex < repeatCount; repeatIndex += 1) {
11156
+ const result = await executeSetupAction(action, index);
11157
+ results.push(repeatCount > 1
11158
+ ? { ...result, repeat_index: repeatIndex, repeat_count: repeatCount }
11159
+ : result);
11160
+ const afterMs = setupNumber(action.after_ms, 0);
11161
+ if (afterMs) await page.waitForTimeout(afterMs);
11162
+ if (result.ok === false && action.continue_on_failure !== true) {
11163
+ shouldStop = true;
11164
+ break;
11165
+ }
11166
+ }
11167
+ if (shouldStop) break;
11148
11168
  }
11149
11169
  return results;
11150
11170
  }
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  resolveRiddleProofProfileTimeoutSec,
59
59
  slugifyRiddleProofProfileName,
60
60
  summarizeRiddleProofProfileResult
61
- } from "./chunk-4S6RC5IJ.js";
61
+ } from "./chunk-IKT7AKZN.js";
62
62
  import {
63
63
  DEFAULT_RIDDLE_API_BASE_URL,
64
64
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -263,6 +263,14 @@ function normalizeSetupActionArgs(input, index) {
263
263
  }
264
264
  return argsInput.map(toJsonValue);
265
265
  }
266
+ function normalizeSetupActionRepeat(input, index) {
267
+ const repeat = numberValue(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
268
+ if (repeat === void 0) return void 0;
269
+ if (!Number.isInteger(repeat) || repeat < 1 || repeat > 100) {
270
+ throw new Error(`target.setup_actions[${index}].repeat must be an integer from 1 to 100.`);
271
+ }
272
+ return repeat;
273
+ }
266
274
  function normalizeSetupAction(input, index) {
267
275
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
268
276
  const type = normalizeSetupActionType(stringValue(input.type), index);
@@ -321,6 +329,7 @@ function normalizeSetupAction(input, index) {
321
329
  ms: numberValue(input.ms) ?? numberValue(input.wait_ms) ?? numberValue(input.waitMs),
322
330
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
323
331
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
332
+ repeat: normalizeSetupActionRepeat(input, index),
324
333
  reload: input.reload === true,
325
334
  storage: normalizeSetupActionStorage(input.storage, index),
326
335
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
@@ -2469,11 +2478,22 @@ async function executeSetupActions(actions) {
2469
2478
  const results = [];
2470
2479
  for (let index = 0; index < (actions || []).length; index += 1) {
2471
2480
  const action = actions[index] || {};
2472
- const result = await executeSetupAction(action, index);
2473
- results.push(result);
2474
- const afterMs = setupNumber(action.after_ms, 0);
2475
- if (afterMs) await page.waitForTimeout(afterMs);
2476
- if (result.ok === false && action.continue_on_failure !== true) break;
2481
+ const requestedRepeat = setupNumber(action.repeat, 1);
2482
+ const repeatCount = Math.min(100, Math.max(1, Math.floor(requestedRepeat || 1)));
2483
+ let shouldStop = false;
2484
+ for (let repeatIndex = 0; repeatIndex < repeatCount; repeatIndex += 1) {
2485
+ const result = await executeSetupAction(action, index);
2486
+ results.push(repeatCount > 1
2487
+ ? { ...result, repeat_index: repeatIndex, repeat_count: repeatCount }
2488
+ : result);
2489
+ const afterMs = setupNumber(action.after_ms, 0);
2490
+ if (afterMs) await page.waitForTimeout(afterMs);
2491
+ if (result.ok === false && action.continue_on_failure !== true) {
2492
+ shouldStop = true;
2493
+ break;
2494
+ }
2495
+ }
2496
+ if (shouldStop) break;
2477
2497
  }
2478
2498
  return results;
2479
2499
  }
@@ -36,6 +36,7 @@ interface RiddleProofProfileSetupAction {
36
36
  ms?: number;
37
37
  timeout_ms?: number;
38
38
  after_ms?: number;
39
+ repeat?: number;
39
40
  reload?: boolean;
40
41
  storage?: "local" | "session" | "both";
41
42
  continue_on_failure?: boolean;
package/dist/profile.d.ts CHANGED
@@ -36,6 +36,7 @@ interface RiddleProofProfileSetupAction {
36
36
  ms?: number;
37
37
  timeout_ms?: number;
38
38
  after_ms?: number;
39
+ repeat?: number;
39
40
  reload?: boolean;
40
41
  storage?: "local" | "session" | "both";
41
42
  continue_on_failure?: boolean;
package/dist/profile.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  resolveRiddleProofProfileTimeoutSec,
20
20
  slugifyRiddleProofProfileName,
21
21
  summarizeRiddleProofProfileResult
22
- } from "./chunk-4S6RC5IJ.js";
22
+ } from "./chunk-IKT7AKZN.js";
23
23
  export {
24
24
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
25
25
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.52",
3
+ "version": "0.7.53",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",