@riddledc/riddle-proof 0.7.28 → 0.7.30

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
@@ -109,7 +109,35 @@ or as a stronger proof base before a change loop.
109
109
  { "name": "desktop", "width": 1440, "height": 1000 }
110
110
  ],
111
111
  "auth": "none",
112
+ "network_mocks": [
113
+ {
114
+ "label": "plans-api",
115
+ "url": "**/api/plans",
116
+ "method": "GET",
117
+ "status": 200,
118
+ "content_type": "application/json",
119
+ "json": {
120
+ "plans": [{ "name": "Builder", "price": "$20" }]
121
+ }
122
+ }
123
+ ],
112
124
  "setup_actions": [
125
+ {
126
+ "type": "clear_storage",
127
+ "storage": "both",
128
+ "reload": true
129
+ },
130
+ {
131
+ "type": "local_storage",
132
+ "key": "demo-auth",
133
+ "json": { "role": "tester" },
134
+ "reload": true
135
+ },
136
+ {
137
+ "type": "fill",
138
+ "selector": "[data-testid='email']",
139
+ "value": "builder@example.com"
140
+ },
113
141
  { "type": "click", "selector": "[data-testid='show-plans']" },
114
142
  { "type": "wait_for_text", "selector": "body", "text": "Start building" }
115
143
  ]
@@ -145,14 +173,26 @@ The package includes a generic starter profile at
145
173
  profile directory and replace the selector/text checks with app-specific
146
174
  invariants.
147
175
 
176
+ `target.network_mocks` is optional. The Riddle runner registers these mocks
177
+ before navigation, records each hit, and adds an implicit
178
+ `network_mocks_succeeded` check when mocks are present. A mock supports
179
+ `url`/`glob`/`pattern`, optional `method`, `status`, `content_type`, `headers`,
180
+ string `body`, JSON `json` / `body_json`, and `required: false` for
181
+ best-effort mocks.
182
+
148
183
  `target.setup_actions` is optional. Use it when the meaningful proof surface
149
- appears only after a picker, tab, login stub, transport control, or other
150
- bounded interaction. Supported setup actions are `click`, `wait`,
151
- `wait_for_selector`, and `wait_for_text`; a failed setup action is recorded as
152
- a failed `setup_actions_succeeded` check so the profile cannot pass without
153
- reaching the intended state. Text-matched `click` actions prefer visible
154
- matching elements, which keeps responsive layouts from selecting hidden desktop
155
- or mobile-only links.
184
+ appears only after a picker, tab, login stub, storage seed, form fill,
185
+ transport control, or other bounded interaction. Supported setup actions are
186
+ `click`, `fill`, `set_input_value`, `local_storage`, `session_storage`,
187
+ `clear_storage`, `wait`, `wait_for_selector`, and `wait_for_text`; a failed
188
+ setup action is recorded as a failed `setup_actions_succeeded` check so the
189
+ profile cannot pass without reaching the intended state. Text-matched `click`
190
+ actions prefer visible matching elements, which keeps responsive layouts from
191
+ selecting hidden desktop or mobile-only links. `local_storage` and
192
+ `session_storage` accept a `key` plus string `value` or JSON `json` /
193
+ `value_json`, and can reload the page with `reload: true`. `clear_storage`
194
+ clears `local`, `session`, or `both` browser storage scopes, defaults to
195
+ `both`, and can also reload with `reload: true`.
156
196
 
157
197
  `target.timeout_sec` is optional. Use it for known-heavy profile targets so the
158
198
  profile carries its own hosted Riddle worker budget; an explicit CLI `--timeout`
@@ -25,6 +25,8 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
25
25
  "fill",
26
26
  "set_input_value",
27
27
  "local_storage",
28
+ "session_storage",
29
+ "clear_storage",
28
30
  "wait",
29
31
  "wait_for_selector",
30
32
  "wait_for_text"
@@ -176,12 +178,21 @@ function isSupportedCheckType(value) {
176
178
  return RIDDLE_PROOF_PROFILE_CHECK_TYPES.includes(value);
177
179
  }
178
180
  function normalizeSetupActionType(value, index) {
179
- const normalized = String(value || "").trim().replace(/-/g, "_");
181
+ const normalizedInput = String(value || "").trim().replace(/-/g, "_");
182
+ const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput;
180
183
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
181
184
  return normalized;
182
185
  }
183
186
  throw new Error(`target.setup_actions[${index}].type ${value || "(missing)"} is not supported. Supported actions: ${RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.join(", ")}`);
184
187
  }
188
+ function normalizeSetupActionStorage(value, index) {
189
+ if (value === void 0 || value === null || value === "") return void 0;
190
+ const normalized = String(value).trim().replace(/-/g, "_");
191
+ if (normalized === "local" || normalized === "local_storage") return "local";
192
+ if (normalized === "session" || normalized === "session_storage") return "session";
193
+ if (normalized === "both" || normalized === "all") return "both";
194
+ throw new Error(`target.setup_actions[${index}].storage ${String(value)} is not supported. Supported storage values: local, session, both.`);
195
+ }
185
196
  function normalizeSetupAction(input, index) {
186
197
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
187
198
  const type = normalizeSetupActionType(stringValue(input.type), index);
@@ -198,11 +209,11 @@ function normalizeSetupAction(input, index) {
198
209
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
199
210
  }
200
211
  const key = stringValue(input.key);
201
- if (type === "local_storage" && !key) {
202
- throw new Error(`target.setup_actions[${index}] local_storage requires key.`);
212
+ if ((type === "local_storage" || type === "session_storage") && !key) {
213
+ throw new Error(`target.setup_actions[${index}] ${type} requires key.`);
203
214
  }
204
- if (type === "local_storage" && value === void 0 && !hasJsonValue) {
205
- throw new Error(`target.setup_actions[${index}] local_storage requires value.`);
215
+ if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
216
+ throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
206
217
  }
207
218
  return {
208
219
  type,
@@ -218,6 +229,7 @@ function normalizeSetupAction(input, index) {
218
229
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
219
230
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
220
231
  reload: input.reload === true,
232
+ storage: normalizeSetupActionStorage(input.storage, index),
221
233
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
222
234
  };
223
235
  }
@@ -1214,16 +1226,28 @@ async function executeSetupAction(action, ordinal) {
1214
1226
  await page.waitForSelector(action.selector, { state: "visible", timeout });
1215
1227
  return { ...base, ok: true, timeout_ms: timeout };
1216
1228
  }
1217
- if (type === "local_storage") {
1229
+ if (type === "local_storage" || type === "session_storage") {
1218
1230
  const value = setupActionValue(action);
1219
- await page.evaluate(({ key, value }) => {
1220
- window.localStorage.setItem(key, value);
1221
- }, { key: action.key, value });
1231
+ await page.evaluate(({ type, key, value }) => {
1232
+ const storage = type === "session_storage" ? window.sessionStorage : window.localStorage;
1233
+ storage.setItem(key, value);
1234
+ }, { type, key: action.key, value });
1222
1235
  if (action.reload === true) {
1223
1236
  await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
1224
1237
  }
1225
1238
  return { ...base, ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
1226
1239
  }
1240
+ if (type === "clear_storage") {
1241
+ const storage = action.storage || "both";
1242
+ await page.evaluate(({ storage }) => {
1243
+ if (storage === "local" || storage === "both") window.localStorage.clear();
1244
+ if (storage === "session" || storage === "both") window.sessionStorage.clear();
1245
+ }, { storage });
1246
+ if (action.reload === true) {
1247
+ await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
1248
+ }
1249
+ return { ...base, ok: true, storage, reload: action.reload === true };
1250
+ }
1227
1251
  if (type === "click") {
1228
1252
  const locator = page.locator(action.selector);
1229
1253
  const count = await locator.count();
package/dist/cli.cjs CHANGED
@@ -6898,6 +6898,8 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
6898
6898
  "fill",
6899
6899
  "set_input_value",
6900
6900
  "local_storage",
6901
+ "session_storage",
6902
+ "clear_storage",
6901
6903
  "wait",
6902
6904
  "wait_for_selector",
6903
6905
  "wait_for_text"
@@ -7049,12 +7051,21 @@ function isSupportedCheckType(value) {
7049
7051
  return RIDDLE_PROOF_PROFILE_CHECK_TYPES.includes(value);
7050
7052
  }
7051
7053
  function normalizeSetupActionType(value, index) {
7052
- const normalized = String(value || "").trim().replace(/-/g, "_");
7054
+ const normalizedInput = String(value || "").trim().replace(/-/g, "_");
7055
+ const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput;
7053
7056
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
7054
7057
  return normalized;
7055
7058
  }
7056
7059
  throw new Error(`target.setup_actions[${index}].type ${value || "(missing)"} is not supported. Supported actions: ${RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.join(", ")}`);
7057
7060
  }
7061
+ function normalizeSetupActionStorage(value, index) {
7062
+ if (value === void 0 || value === null || value === "") return void 0;
7063
+ const normalized = String(value).trim().replace(/-/g, "_");
7064
+ if (normalized === "local" || normalized === "local_storage") return "local";
7065
+ if (normalized === "session" || normalized === "session_storage") return "session";
7066
+ if (normalized === "both" || normalized === "all") return "both";
7067
+ throw new Error(`target.setup_actions[${index}].storage ${String(value)} is not supported. Supported storage values: local, session, both.`);
7068
+ }
7058
7069
  function normalizeSetupAction(input, index) {
7059
7070
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
7060
7071
  const type = normalizeSetupActionType(stringValue2(input.type), index);
@@ -7071,11 +7082,11 @@ function normalizeSetupAction(input, index) {
7071
7082
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
7072
7083
  }
7073
7084
  const key = stringValue2(input.key);
7074
- if (type === "local_storage" && !key) {
7075
- throw new Error(`target.setup_actions[${index}] local_storage requires key.`);
7085
+ if ((type === "local_storage" || type === "session_storage") && !key) {
7086
+ throw new Error(`target.setup_actions[${index}] ${type} requires key.`);
7076
7087
  }
7077
- if (type === "local_storage" && value === void 0 && !hasJsonValue) {
7078
- throw new Error(`target.setup_actions[${index}] local_storage requires value.`);
7088
+ if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
7089
+ throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
7079
7090
  }
7080
7091
  return {
7081
7092
  type,
@@ -7091,6 +7102,7 @@ function normalizeSetupAction(input, index) {
7091
7102
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
7092
7103
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
7093
7104
  reload: input.reload === true,
7105
+ storage: normalizeSetupActionStorage(input.storage, index),
7094
7106
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
7095
7107
  };
7096
7108
  }
@@ -8071,16 +8083,28 @@ async function executeSetupAction(action, ordinal) {
8071
8083
  await page.waitForSelector(action.selector, { state: "visible", timeout });
8072
8084
  return { ...base, ok: true, timeout_ms: timeout };
8073
8085
  }
8074
- if (type === "local_storage") {
8086
+ if (type === "local_storage" || type === "session_storage") {
8075
8087
  const value = setupActionValue(action);
8076
- await page.evaluate(({ key, value }) => {
8077
- window.localStorage.setItem(key, value);
8078
- }, { key: action.key, value });
8088
+ await page.evaluate(({ type, key, value }) => {
8089
+ const storage = type === "session_storage" ? window.sessionStorage : window.localStorage;
8090
+ storage.setItem(key, value);
8091
+ }, { type, key: action.key, value });
8079
8092
  if (action.reload === true) {
8080
8093
  await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
8081
8094
  }
8082
8095
  return { ...base, ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
8083
8096
  }
8097
+ if (type === "clear_storage") {
8098
+ const storage = action.storage || "both";
8099
+ await page.evaluate(({ storage }) => {
8100
+ if (storage === "local" || storage === "both") window.localStorage.clear();
8101
+ if (storage === "session" || storage === "both") window.sessionStorage.clear();
8102
+ }, { storage });
8103
+ if (action.reload === true) {
8104
+ await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
8105
+ }
8106
+ return { ...base, ok: true, storage, reload: action.reload === true };
8107
+ }
8084
8108
  if (type === "click") {
8085
8109
  const locator = page.locator(action.selector);
8086
8110
  const count = await locator.count();
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  profileStatusExitCode,
11
11
  resolveRiddleProofProfileTargetUrl,
12
12
  resolveRiddleProofProfileTimeoutSec
13
- } from "./chunk-NUGGW7NX.js";
13
+ } from "./chunk-FDNIOGQD.js";
14
14
  import {
15
15
  createRiddleApiClient,
16
16
  parseRiddleViewport
package/dist/index.cjs CHANGED
@@ -8739,6 +8739,8 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
8739
8739
  "fill",
8740
8740
  "set_input_value",
8741
8741
  "local_storage",
8742
+ "session_storage",
8743
+ "clear_storage",
8742
8744
  "wait",
8743
8745
  "wait_for_selector",
8744
8746
  "wait_for_text"
@@ -8890,12 +8892,21 @@ function isSupportedCheckType(value) {
8890
8892
  return RIDDLE_PROOF_PROFILE_CHECK_TYPES.includes(value);
8891
8893
  }
8892
8894
  function normalizeSetupActionType(value, index) {
8893
- const normalized = String(value || "").trim().replace(/-/g, "_");
8895
+ const normalizedInput = String(value || "").trim().replace(/-/g, "_");
8896
+ const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput;
8894
8897
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
8895
8898
  return normalized;
8896
8899
  }
8897
8900
  throw new Error(`target.setup_actions[${index}].type ${value || "(missing)"} is not supported. Supported actions: ${RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.join(", ")}`);
8898
8901
  }
8902
+ function normalizeSetupActionStorage(value, index) {
8903
+ if (value === void 0 || value === null || value === "") return void 0;
8904
+ const normalized = String(value).trim().replace(/-/g, "_");
8905
+ if (normalized === "local" || normalized === "local_storage") return "local";
8906
+ if (normalized === "session" || normalized === "session_storage") return "session";
8907
+ if (normalized === "both" || normalized === "all") return "both";
8908
+ throw new Error(`target.setup_actions[${index}].storage ${String(value)} is not supported. Supported storage values: local, session, both.`);
8909
+ }
8899
8910
  function normalizeSetupAction(input, index) {
8900
8911
  if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
8901
8912
  const type = normalizeSetupActionType(stringValue5(input.type), index);
@@ -8912,11 +8923,11 @@ function normalizeSetupAction(input, index) {
8912
8923
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
8913
8924
  }
8914
8925
  const key = stringValue5(input.key);
8915
- if (type === "local_storage" && !key) {
8916
- throw new Error(`target.setup_actions[${index}] local_storage requires key.`);
8926
+ if ((type === "local_storage" || type === "session_storage") && !key) {
8927
+ throw new Error(`target.setup_actions[${index}] ${type} requires key.`);
8917
8928
  }
8918
- if (type === "local_storage" && value === void 0 && !hasJsonValue) {
8919
- throw new Error(`target.setup_actions[${index}] local_storage requires value.`);
8929
+ if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
8930
+ throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
8920
8931
  }
8921
8932
  return {
8922
8933
  type,
@@ -8932,6 +8943,7 @@ function normalizeSetupAction(input, index) {
8932
8943
  timeout_ms: numberValue3(input.timeout_ms) ?? numberValue3(input.timeoutMs),
8933
8944
  after_ms: numberValue3(input.after_ms) ?? numberValue3(input.afterMs),
8934
8945
  reload: input.reload === true,
8946
+ storage: normalizeSetupActionStorage(input.storage, index),
8935
8947
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
8936
8948
  };
8937
8949
  }
@@ -9928,16 +9940,28 @@ async function executeSetupAction(action, ordinal) {
9928
9940
  await page.waitForSelector(action.selector, { state: "visible", timeout });
9929
9941
  return { ...base, ok: true, timeout_ms: timeout };
9930
9942
  }
9931
- if (type === "local_storage") {
9943
+ if (type === "local_storage" || type === "session_storage") {
9932
9944
  const value = setupActionValue(action);
9933
- await page.evaluate(({ key, value }) => {
9934
- window.localStorage.setItem(key, value);
9935
- }, { key: action.key, value });
9945
+ await page.evaluate(({ type, key, value }) => {
9946
+ const storage = type === "session_storage" ? window.sessionStorage : window.localStorage;
9947
+ storage.setItem(key, value);
9948
+ }, { type, key: action.key, value });
9936
9949
  if (action.reload === true) {
9937
9950
  await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
9938
9951
  }
9939
9952
  return { ...base, ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
9940
9953
  }
9954
+ if (type === "clear_storage") {
9955
+ const storage = action.storage || "both";
9956
+ await page.evaluate(({ storage }) => {
9957
+ if (storage === "local" || storage === "both") window.localStorage.clear();
9958
+ if (storage === "session" || storage === "both") window.sessionStorage.clear();
9959
+ }, { storage });
9960
+ if (action.reload === true) {
9961
+ await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
9962
+ }
9963
+ return { ...base, ok: true, storage, reload: action.reload === true };
9964
+ }
9941
9965
  if (type === "click") {
9942
9966
  const locator = page.locator(action.selector);
9943
9967
  const count = await locator.count();
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  resolveRiddleProofProfileTimeoutSec,
59
59
  slugifyRiddleProofProfileName,
60
60
  summarizeRiddleProofProfileResult
61
- } from "./chunk-NUGGW7NX.js";
61
+ } from "./chunk-FDNIOGQD.js";
62
62
  import {
63
63
  DEFAULT_RIDDLE_API_BASE_URL,
64
64
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -68,6 +68,8 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
68
68
  "fill",
69
69
  "set_input_value",
70
70
  "local_storage",
71
+ "session_storage",
72
+ "clear_storage",
71
73
  "wait",
72
74
  "wait_for_selector",
73
75
  "wait_for_text"
@@ -219,12 +221,21 @@ function isSupportedCheckType(value) {
219
221
  return RIDDLE_PROOF_PROFILE_CHECK_TYPES.includes(value);
220
222
  }
221
223
  function normalizeSetupActionType(value, index) {
222
- const normalized = String(value || "").trim().replace(/-/g, "_");
224
+ const normalizedInput = String(value || "").trim().replace(/-/g, "_");
225
+ const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput;
223
226
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
224
227
  return normalized;
225
228
  }
226
229
  throw new Error(`target.setup_actions[${index}].type ${value || "(missing)"} is not supported. Supported actions: ${RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.join(", ")}`);
227
230
  }
231
+ function normalizeSetupActionStorage(value, index) {
232
+ if (value === void 0 || value === null || value === "") return void 0;
233
+ const normalized = String(value).trim().replace(/-/g, "_");
234
+ if (normalized === "local" || normalized === "local_storage") return "local";
235
+ if (normalized === "session" || normalized === "session_storage") return "session";
236
+ if (normalized === "both" || normalized === "all") return "both";
237
+ throw new Error(`target.setup_actions[${index}].storage ${String(value)} is not supported. Supported storage values: local, session, both.`);
238
+ }
228
239
  function normalizeSetupAction(input, index) {
229
240
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
230
241
  const type = normalizeSetupActionType(stringValue(input.type), index);
@@ -241,11 +252,11 @@ function normalizeSetupAction(input, index) {
241
252
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
242
253
  }
243
254
  const key = stringValue(input.key);
244
- if (type === "local_storage" && !key) {
245
- throw new Error(`target.setup_actions[${index}] local_storage requires key.`);
255
+ if ((type === "local_storage" || type === "session_storage") && !key) {
256
+ throw new Error(`target.setup_actions[${index}] ${type} requires key.`);
246
257
  }
247
- if (type === "local_storage" && value === void 0 && !hasJsonValue) {
248
- throw new Error(`target.setup_actions[${index}] local_storage requires value.`);
258
+ if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
259
+ throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
249
260
  }
250
261
  return {
251
262
  type,
@@ -261,6 +272,7 @@ function normalizeSetupAction(input, index) {
261
272
  timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
262
273
  after_ms: numberValue(input.after_ms) ?? numberValue(input.afterMs),
263
274
  reload: input.reload === true,
275
+ storage: normalizeSetupActionStorage(input.storage, index),
264
276
  continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
265
277
  };
266
278
  }
@@ -1257,16 +1269,28 @@ async function executeSetupAction(action, ordinal) {
1257
1269
  await page.waitForSelector(action.selector, { state: "visible", timeout });
1258
1270
  return { ...base, ok: true, timeout_ms: timeout };
1259
1271
  }
1260
- if (type === "local_storage") {
1272
+ if (type === "local_storage" || type === "session_storage") {
1261
1273
  const value = setupActionValue(action);
1262
- await page.evaluate(({ key, value }) => {
1263
- window.localStorage.setItem(key, value);
1264
- }, { key: action.key, value });
1274
+ await page.evaluate(({ type, key, value }) => {
1275
+ const storage = type === "session_storage" ? window.sessionStorage : window.localStorage;
1276
+ storage.setItem(key, value);
1277
+ }, { type, key: action.key, value });
1265
1278
  if (action.reload === true) {
1266
1279
  await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
1267
1280
  }
1268
1281
  return { ...base, ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
1269
1282
  }
1283
+ if (type === "clear_storage") {
1284
+ const storage = action.storage || "both";
1285
+ await page.evaluate(({ storage }) => {
1286
+ if (storage === "local" || storage === "both") window.localStorage.clear();
1287
+ if (storage === "session" || storage === "both") window.sessionStorage.clear();
1288
+ }, { storage });
1289
+ if (action.reload === true) {
1290
+ await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
1291
+ }
1292
+ return { ...base, ok: true, storage, reload: action.reload === true };
1293
+ }
1270
1294
  if (type === "click") {
1271
1295
  const locator = page.locator(action.selector);
1272
1296
  const count = await locator.count();
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
5
5
  declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
6
6
  declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
7
7
  declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "selector_visible", "selector_count_at_least", "text_visible", "text_absent", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors"];
8
- declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "fill", "set_input_value", "local_storage", "wait", "wait_for_selector", "wait_for_text"];
8
+ declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "fill", "set_input_value", "local_storage", "session_storage", "clear_storage", "wait", "wait_for_selector", "wait_for_text"];
9
9
  type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
10
10
  type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
11
11
  type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
@@ -31,6 +31,7 @@ interface RiddleProofProfileSetupAction {
31
31
  timeout_ms?: number;
32
32
  after_ms?: number;
33
33
  reload?: boolean;
34
+ storage?: "local" | "session" | "both";
34
35
  continue_on_failure?: boolean;
35
36
  }
36
37
  interface RiddleProofProfileNetworkMock {
package/dist/profile.d.ts CHANGED
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
5
5
  declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
6
6
  declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
7
7
  declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "selector_visible", "selector_count_at_least", "text_visible", "text_absent", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors"];
8
- declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "fill", "set_input_value", "local_storage", "wait", "wait_for_selector", "wait_for_text"];
8
+ declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "fill", "set_input_value", "local_storage", "session_storage", "clear_storage", "wait", "wait_for_selector", "wait_for_text"];
9
9
  type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
10
10
  type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
11
11
  type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
@@ -31,6 +31,7 @@ interface RiddleProofProfileSetupAction {
31
31
  timeout_ms?: number;
32
32
  after_ms?: number;
33
33
  reload?: boolean;
34
+ storage?: "local" | "session" | "both";
34
35
  continue_on_failure?: boolean;
35
36
  }
36
37
  interface RiddleProofProfileNetworkMock {
package/dist/profile.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  resolveRiddleProofProfileTimeoutSec,
20
20
  slugifyRiddleProofProfileName,
21
21
  summarizeRiddleProofProfileResult
22
- } from "./chunk-NUGGW7NX.js";
22
+ } from "./chunk-FDNIOGQD.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.28",
3
+ "version": "0.7.30",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",