@riddledc/riddle-proof 0.7.5 → 0.7.7

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.
@@ -62,6 +62,8 @@ var BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES = [
62
62
  "selector_text_matches",
63
63
  "number_increases",
64
64
  "number_decreases",
65
+ "number_at_least",
66
+ "number_gte",
65
67
  "number_unchanged",
66
68
  "number_stays_equal",
67
69
  "number_equals",
@@ -142,15 +144,21 @@ function assessBasicGameplayRoute(route, options = {}) {
142
144
  const initial = route.initial || {};
143
145
  const timed = route.timed || {};
144
146
  const afterAction = route.after_action || route.afterAction || {};
147
+ const afterContinue = route.after_continue || route.afterContinue || {};
145
148
  const mobile = route.mobile || {};
146
149
  const timedChange = changed(initial, timed);
147
150
  const actionChange = changed(timed, afterAction);
151
+ const continuedActionChange = changed(afterAction, afterContinue);
148
152
  const surfaceVisible = numberValue(initial.visible_canvas_count) > 0 || numberValue(initial.enabled_clickable_count) > 0 || numberValue(initial.visible_large_node_count) >= minSurfaceLargeNodes;
149
153
  const actionResults = listValue(route.action_results || route.actionResults);
150
- const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
151
- const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
152
- const stateChangeObserved = actionChange.changed || timedChange.changed;
153
- const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0;
154
+ const continuedActionResults = listValue(route.continued_action_results || route.continuedActionResults);
155
+ const restartActionResults = listValue(route.restart_action_results || route.restartActionResults);
156
+ const primaryActionResults = [...actionResults, ...continuedActionResults];
157
+ const actionAttempted = primaryActionResults.some((result) => result.ok === true && result.action !== "wait");
158
+ const actionFailed = primaryActionResults.some((result) => result.ok === false && result.action !== "wait");
159
+ const restartActionAttempted = restartActionResults.some((result) => result.ok === true && result.action !== "wait");
160
+ const stateChangeObserved = actionChange.changed || continuedActionChange.changed || timedChange.changed;
161
+ const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0 || restartActionAttempted;
154
162
  const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
155
163
  const pageErrorCount = numberValue(route.page_error_count);
156
164
  const consoleErrorCount = numberValue(route.console_error_count);
@@ -184,7 +192,7 @@ function assessBasicGameplayRoute(route, options = {}) {
184
192
  surface_visible: surfaceVisible,
185
193
  action_attempted: actionAttempted,
186
194
  timed_progression_observed: timedChange.changed,
187
- first_interaction_observed: actionChange.changed,
195
+ first_interaction_observed: actionChange.changed || continuedActionChange.changed,
188
196
  state_change_observed: stateChangeObserved,
189
197
  mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
190
198
  reset_path_present: resetPathPresent,
@@ -192,7 +200,8 @@ function assessBasicGameplayRoute(route, options = {}) {
192
200
  },
193
201
  diffs: {
194
202
  timed: timedChange,
195
- after_action: actionChange
203
+ after_action: actionChange,
204
+ after_continue: continuedActionChange
196
205
  }
197
206
  };
198
207
  }
@@ -245,6 +254,11 @@ function assessBasicGameplayProgressionCheck(check) {
245
254
  } else if (type === "number_decreases") {
246
255
  ok = numericValue(before?.number) !== null && numericValue(after?.number) !== null && numberValue(after?.number) < numberValue(before?.number);
247
256
  reason = ok ? null : "number_did_not_decrease";
257
+ } else if (type === "number_at_least" || type === "number_gte") {
258
+ const min = numericValue(check.min ?? check.expected ?? check.value);
259
+ if (min === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
260
+ ok = numericValue(after?.number) !== null && min !== null && numberValue(after?.number) >= min;
261
+ reason = ok ? null : "number_below_minimum";
248
262
  } else if (type === "number_unchanged" || type === "number_stays_equal") {
249
263
  ok = numericValue(before?.number) !== null && numericValue(after?.number) !== null && numberValue(after?.number) === numberValue(before?.number);
250
264
  reason = ok ? null : "number_changed";
@@ -37,7 +37,7 @@ interface BasicGameplayActionResult {
37
37
  [key: string]: unknown;
38
38
  }
39
39
  declare const BASIC_GAMEPLAY_ACTION_TYPES: readonly ["wait", "key", "key-down", "key-up", "hold-key", "repeat", "click", "click-by-text", "wait-for-text", "window-call", "evaluate"];
40
- declare const BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES: readonly ["selector_count_increases", "selector_count_at_least", "selector_absent", "selector_text_matches", "number_increases", "number_decreases", "number_unchanged", "number_stays_equal", "number_equals", "canvas_hash_changes", "screenshot_hash_changes", "visual_hash_changes", "state_changes"];
40
+ declare const BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES: readonly ["selector_count_increases", "selector_count_at_least", "selector_absent", "selector_text_matches", "number_increases", "number_decreases", "number_at_least", "number_gte", "number_unchanged", "number_stays_equal", "number_equals", "canvas_hash_changes", "screenshot_hash_changes", "visual_hash_changes", "state_changes"];
41
41
  type BasicGameplayActionType = typeof BASIC_GAMEPLAY_ACTION_TYPES[number] | (string & {});
42
42
  type BasicGameplayProgressCheckType = typeof BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES[number] | (string & {});
43
43
  interface BasicGameplayMetric {
@@ -118,11 +118,15 @@ interface RiddleProofBasicGameplayRouteEvidence {
118
118
  timed?: BasicGameplaySnapshot;
119
119
  after_action?: BasicGameplaySnapshot;
120
120
  afterAction?: BasicGameplaySnapshot;
121
+ after_continue?: BasicGameplaySnapshot;
122
+ afterContinue?: BasicGameplaySnapshot;
121
123
  mobile?: BasicGameplayMobileEvidence;
122
124
  action_results?: BasicGameplayActionResult[];
123
125
  actionResults?: BasicGameplayActionResult[];
124
126
  continued_action_results?: BasicGameplayActionResult[];
127
+ continuedActionResults?: BasicGameplayActionResult[];
125
128
  restart_action_results?: BasicGameplayActionResult[];
129
+ restartActionResults?: BasicGameplayActionResult[];
126
130
  progression_checks?: BasicGameplayProgressionCheck[];
127
131
  progressionChecks?: BasicGameplayProgressionCheck[];
128
132
  requires_reset?: boolean;
@@ -171,6 +175,7 @@ interface RiddleProofBasicGameplayRouteAssessment {
171
175
  diffs: {
172
176
  timed: BasicGameplayChangeSummary;
173
177
  after_action: BasicGameplayChangeSummary;
178
+ after_continue?: BasicGameplayChangeSummary;
174
179
  };
175
180
  }
176
181
  interface RiddleProofBasicGameplayAssessment {
@@ -37,7 +37,7 @@ interface BasicGameplayActionResult {
37
37
  [key: string]: unknown;
38
38
  }
39
39
  declare const BASIC_GAMEPLAY_ACTION_TYPES: readonly ["wait", "key", "key-down", "key-up", "hold-key", "repeat", "click", "click-by-text", "wait-for-text", "window-call", "evaluate"];
40
- declare const BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES: readonly ["selector_count_increases", "selector_count_at_least", "selector_absent", "selector_text_matches", "number_increases", "number_decreases", "number_unchanged", "number_stays_equal", "number_equals", "canvas_hash_changes", "screenshot_hash_changes", "visual_hash_changes", "state_changes"];
40
+ declare const BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES: readonly ["selector_count_increases", "selector_count_at_least", "selector_absent", "selector_text_matches", "number_increases", "number_decreases", "number_at_least", "number_gte", "number_unchanged", "number_stays_equal", "number_equals", "canvas_hash_changes", "screenshot_hash_changes", "visual_hash_changes", "state_changes"];
41
41
  type BasicGameplayActionType = typeof BASIC_GAMEPLAY_ACTION_TYPES[number] | (string & {});
42
42
  type BasicGameplayProgressCheckType = typeof BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES[number] | (string & {});
43
43
  interface BasicGameplayMetric {
@@ -118,11 +118,15 @@ interface RiddleProofBasicGameplayRouteEvidence {
118
118
  timed?: BasicGameplaySnapshot;
119
119
  after_action?: BasicGameplaySnapshot;
120
120
  afterAction?: BasicGameplaySnapshot;
121
+ after_continue?: BasicGameplaySnapshot;
122
+ afterContinue?: BasicGameplaySnapshot;
121
123
  mobile?: BasicGameplayMobileEvidence;
122
124
  action_results?: BasicGameplayActionResult[];
123
125
  actionResults?: BasicGameplayActionResult[];
124
126
  continued_action_results?: BasicGameplayActionResult[];
127
+ continuedActionResults?: BasicGameplayActionResult[];
125
128
  restart_action_results?: BasicGameplayActionResult[];
129
+ restartActionResults?: BasicGameplayActionResult[];
126
130
  progression_checks?: BasicGameplayProgressionCheck[];
127
131
  progressionChecks?: BasicGameplayProgressionCheck[];
128
132
  requires_reset?: boolean;
@@ -171,6 +175,7 @@ interface RiddleProofBasicGameplayRouteAssessment {
171
175
  diffs: {
172
176
  timed: BasicGameplayChangeSummary;
173
177
  after_action: BasicGameplayChangeSummary;
178
+ after_continue?: BasicGameplayChangeSummary;
174
179
  };
175
180
  }
176
181
  interface RiddleProofBasicGameplayAssessment {
@@ -16,7 +16,7 @@ import {
16
16
  extractBasicGameplayEvidence,
17
17
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
18
18
  sanitizeBasicGameplayJsonString
19
- } from "./chunk-AAIASO2C.js";
19
+ } from "./chunk-AHW7SL3W.js";
20
20
  export {
21
21
  BASIC_GAMEPLAY_ACTION_TYPES,
22
22
  BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES,
@@ -22,6 +22,8 @@ var BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES = [
22
22
  "selector_text_matches",
23
23
  "number_increases",
24
24
  "number_decreases",
25
+ "number_at_least",
26
+ "number_gte",
25
27
  "number_unchanged",
26
28
  "number_stays_equal",
27
29
  "number_equals",
@@ -102,15 +104,21 @@ function assessBasicGameplayRoute(route, options = {}) {
102
104
  const initial = route.initial || {};
103
105
  const timed = route.timed || {};
104
106
  const afterAction = route.after_action || route.afterAction || {};
107
+ const afterContinue = route.after_continue || route.afterContinue || {};
105
108
  const mobile = route.mobile || {};
106
109
  const timedChange = changed(initial, timed);
107
110
  const actionChange = changed(timed, afterAction);
111
+ const continuedActionChange = changed(afterAction, afterContinue);
108
112
  const surfaceVisible = numberValue(initial.visible_canvas_count) > 0 || numberValue(initial.enabled_clickable_count) > 0 || numberValue(initial.visible_large_node_count) >= minSurfaceLargeNodes;
109
113
  const actionResults = listValue(route.action_results || route.actionResults);
110
- const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
111
- const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
112
- const stateChangeObserved = actionChange.changed || timedChange.changed;
113
- const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0;
114
+ const continuedActionResults = listValue(route.continued_action_results || route.continuedActionResults);
115
+ const restartActionResults = listValue(route.restart_action_results || route.restartActionResults);
116
+ const primaryActionResults = [...actionResults, ...continuedActionResults];
117
+ const actionAttempted = primaryActionResults.some((result) => result.ok === true && result.action !== "wait");
118
+ const actionFailed = primaryActionResults.some((result) => result.ok === false && result.action !== "wait");
119
+ const restartActionAttempted = restartActionResults.some((result) => result.ok === true && result.action !== "wait");
120
+ const stateChangeObserved = actionChange.changed || continuedActionChange.changed || timedChange.changed;
121
+ const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0 || restartActionAttempted;
114
122
  const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
115
123
  const pageErrorCount = numberValue(route.page_error_count);
116
124
  const consoleErrorCount = numberValue(route.console_error_count);
@@ -144,7 +152,7 @@ function assessBasicGameplayRoute(route, options = {}) {
144
152
  surface_visible: surfaceVisible,
145
153
  action_attempted: actionAttempted,
146
154
  timed_progression_observed: timedChange.changed,
147
- first_interaction_observed: actionChange.changed,
155
+ first_interaction_observed: actionChange.changed || continuedActionChange.changed,
148
156
  state_change_observed: stateChangeObserved,
149
157
  mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
150
158
  reset_path_present: resetPathPresent,
@@ -152,7 +160,8 @@ function assessBasicGameplayRoute(route, options = {}) {
152
160
  },
153
161
  diffs: {
154
162
  timed: timedChange,
155
- after_action: actionChange
163
+ after_action: actionChange,
164
+ after_continue: continuedActionChange
156
165
  }
157
166
  };
158
167
  }
@@ -205,6 +214,11 @@ function assessBasicGameplayProgressionCheck(check) {
205
214
  } else if (type === "number_decreases") {
206
215
  ok = numericValue(before?.number) !== null && numericValue(after?.number) !== null && numberValue(after?.number) < numberValue(before?.number);
207
216
  reason = ok ? null : "number_did_not_decrease";
217
+ } else if (type === "number_at_least" || type === "number_gte") {
218
+ const min = numericValue(check.min ?? check.expected ?? check.value);
219
+ if (min === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
220
+ ok = numericValue(after?.number) !== null && min !== null && numberValue(after?.number) >= min;
221
+ reason = ok ? null : "number_below_minimum";
208
222
  } else if (type === "number_unchanged" || type === "number_stays_equal") {
209
223
  ok = numericValue(before?.number) !== null && numericValue(after?.number) !== null && numberValue(after?.number) === numberValue(before?.number);
210
224
  reason = ok ? null : "number_changed";
package/dist/index.cjs CHANGED
@@ -7829,6 +7829,8 @@ var BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES = [
7829
7829
  "selector_text_matches",
7830
7830
  "number_increases",
7831
7831
  "number_decreases",
7832
+ "number_at_least",
7833
+ "number_gte",
7832
7834
  "number_unchanged",
7833
7835
  "number_stays_equal",
7834
7836
  "number_equals",
@@ -7909,15 +7911,21 @@ function assessBasicGameplayRoute(route, options = {}) {
7909
7911
  const initial = route.initial || {};
7910
7912
  const timed = route.timed || {};
7911
7913
  const afterAction = route.after_action || route.afterAction || {};
7914
+ const afterContinue = route.after_continue || route.afterContinue || {};
7912
7915
  const mobile = route.mobile || {};
7913
7916
  const timedChange = changed(initial, timed);
7914
7917
  const actionChange = changed(timed, afterAction);
7918
+ const continuedActionChange = changed(afterAction, afterContinue);
7915
7919
  const surfaceVisible = numberValue2(initial.visible_canvas_count) > 0 || numberValue2(initial.enabled_clickable_count) > 0 || numberValue2(initial.visible_large_node_count) >= minSurfaceLargeNodes;
7916
7920
  const actionResults = listValue2(route.action_results || route.actionResults);
7917
- const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
7918
- const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
7919
- const stateChangeObserved = actionChange.changed || timedChange.changed;
7920
- const resetPathPresent = numberValue2(initial.reset_control_count) > 0 || numberValue2(timed.reset_control_count) > 0 || numberValue2(afterAction.reset_control_count) > 0;
7921
+ const continuedActionResults = listValue2(route.continued_action_results || route.continuedActionResults);
7922
+ const restartActionResults = listValue2(route.restart_action_results || route.restartActionResults);
7923
+ const primaryActionResults = [...actionResults, ...continuedActionResults];
7924
+ const actionAttempted = primaryActionResults.some((result) => result.ok === true && result.action !== "wait");
7925
+ const actionFailed = primaryActionResults.some((result) => result.ok === false && result.action !== "wait");
7926
+ const restartActionAttempted = restartActionResults.some((result) => result.ok === true && result.action !== "wait");
7927
+ const stateChangeObserved = actionChange.changed || continuedActionChange.changed || timedChange.changed;
7928
+ const resetPathPresent = numberValue2(initial.reset_control_count) > 0 || numberValue2(timed.reset_control_count) > 0 || numberValue2(afterAction.reset_control_count) > 0 || restartActionAttempted;
7921
7929
  const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
7922
7930
  const pageErrorCount = numberValue2(route.page_error_count);
7923
7931
  const consoleErrorCount = numberValue2(route.console_error_count);
@@ -7951,7 +7959,7 @@ function assessBasicGameplayRoute(route, options = {}) {
7951
7959
  surface_visible: surfaceVisible,
7952
7960
  action_attempted: actionAttempted,
7953
7961
  timed_progression_observed: timedChange.changed,
7954
- first_interaction_observed: actionChange.changed,
7962
+ first_interaction_observed: actionChange.changed || continuedActionChange.changed,
7955
7963
  state_change_observed: stateChangeObserved,
7956
7964
  mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
7957
7965
  reset_path_present: resetPathPresent,
@@ -7959,7 +7967,8 @@ function assessBasicGameplayRoute(route, options = {}) {
7959
7967
  },
7960
7968
  diffs: {
7961
7969
  timed: timedChange,
7962
- after_action: actionChange
7970
+ after_action: actionChange,
7971
+ after_continue: continuedActionChange
7963
7972
  }
7964
7973
  };
7965
7974
  }
@@ -8012,6 +8021,11 @@ function assessBasicGameplayProgressionCheck(check) {
8012
8021
  } else if (type === "number_decreases") {
8013
8022
  ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null && numberValue2(after?.number) < numberValue2(before?.number);
8014
8023
  reason = ok ? null : "number_did_not_decrease";
8024
+ } else if (type === "number_at_least" || type === "number_gte") {
8025
+ const min = numericValue3(check.min ?? check.expected ?? check.value);
8026
+ if (min === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
8027
+ ok = numericValue3(after?.number) !== null && min !== null && numberValue2(after?.number) >= min;
8028
+ reason = ok ? null : "number_below_minimum";
8015
8029
  } else if (type === "number_unchanged" || type === "number_stays_equal") {
8016
8030
  ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null && numberValue2(after?.number) === numberValue2(before?.number);
8017
8031
  reason = ok ? null : "number_changed";
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  extractBasicGameplayEvidence,
37
37
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
38
38
  sanitizeBasicGameplayJsonString
39
- } from "./chunk-AAIASO2C.js";
39
+ } from "./chunk-AHW7SL3W.js";
40
40
  import {
41
41
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
42
42
  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.5",
3
+ "version": "0.7.7",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",