@riddledc/riddle-proof 0.5.54 → 0.5.55

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.
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/basic-gameplay.ts
21
+ var basic_gameplay_exports = {};
22
+ __export(basic_gameplay_exports, {
23
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
24
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
25
+ assessBasicGameplayEvidence: () => assessBasicGameplayEvidence,
26
+ assessBasicGameplayRoute: () => assessBasicGameplayRoute,
27
+ extractBasicGameplayEvidence: () => extractBasicGameplayEvidence
28
+ });
29
+ module.exports = __toCommonJS(basic_gameplay_exports);
30
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION = "riddle-proof.basic-gameplay.v1";
31
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION = "riddle-proof.basic-gameplay.assessment.v1";
32
+ var BASIC_GAMEPLAY_CONTAINER_KEYS = [
33
+ "basic_gameplay",
34
+ "basicGameplay",
35
+ "basic_gameplay_evidence",
36
+ "basicGameplayEvidence",
37
+ "gameplay_proof",
38
+ "gameplayProof"
39
+ ];
40
+ function assessBasicGameplayEvidence(evidence, options = {}) {
41
+ const run = extractBasicGameplayEvidence(evidence);
42
+ if (!run) {
43
+ return {
44
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
45
+ evidence_present: false,
46
+ passed: false,
47
+ checked_routes: 0,
48
+ passing_routes: 0,
49
+ failing_routes: [],
50
+ failure_counts: {},
51
+ warning_counts: {},
52
+ route_results: []
53
+ };
54
+ }
55
+ const routeResults = (run.results || []).map((route) => assessBasicGameplayRoute(route, options));
56
+ const failingRoutes = routeResults.filter((result) => !result.ok).map((result) => ({
57
+ name: result.name,
58
+ path: result.path,
59
+ failures: result.failures,
60
+ warnings: result.warnings
61
+ }));
62
+ return {
63
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
64
+ evidence_present: true,
65
+ passed: failingRoutes.length === 0,
66
+ checked_routes: routeResults.length,
67
+ passing_routes: routeResults.filter((result) => result.ok).length,
68
+ failing_routes: failingRoutes,
69
+ failure_counts: countCodes(routeResults.flatMap((result) => result.failures)),
70
+ warning_counts: countCodes(routeResults.flatMap((result) => result.warnings)),
71
+ route_results: routeResults
72
+ };
73
+ }
74
+ function assessBasicGameplayRoute(route, options = {}) {
75
+ const maxMobileOverflowPx = options.maxMobileOverflowPx ?? 4;
76
+ const minBodyTextLength = options.minBodyTextLength ?? 20;
77
+ const minVisibleLargeNodes = options.minVisibleLargeNodes ?? 3;
78
+ const minSurfaceLargeNodes = options.minSurfaceLargeNodes ?? 8;
79
+ const warnOnMissingResetPath = options.warnOnMissingResetPath ?? true;
80
+ const warnOnConsoleError = options.warnOnConsoleError ?? true;
81
+ const failOnConsoleError = options.failOnConsoleError ?? false;
82
+ const failures = [];
83
+ const warnings = [];
84
+ const initial = route.initial || {};
85
+ const timed = route.timed || {};
86
+ const afterAction = route.after_action || route.afterAction || {};
87
+ const mobile = route.mobile || {};
88
+ const timedChange = changed(initial, timed);
89
+ const actionChange = changed(timed, afterAction);
90
+ const surfaceVisible = numberValue(initial.visible_canvas_count) > 0 || numberValue(initial.enabled_clickable_count) > 0 || numberValue(initial.visible_large_node_count) >= minSurfaceLargeNodes;
91
+ const actionResults = listValue(route.action_results || route.actionResults);
92
+ const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
93
+ const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
94
+ const stateChangeObserved = actionChange.changed || timedChange.changed;
95
+ const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0;
96
+ const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
97
+ const pageErrorCount = numberValue(route.page_error_count);
98
+ const consoleErrorCount = numberValue(route.console_error_count);
99
+ const mobileOverflowPx = numberValue(mobile.overflow_px);
100
+ if (responseStatus !== null && responseStatus >= 400) failures.push("route_http_error");
101
+ if (pageErrorCount > 0) failures.push("fatal_page_error");
102
+ if (numberValue(initial.body_text_length) < minBodyTextLength && numberValue(initial.visible_large_node_count) < minVisibleLargeNodes) {
103
+ failures.push("route_blank_or_thin");
104
+ }
105
+ if (!surfaceVisible) failures.push("no_game_surface");
106
+ if (mobileOverflowPx > maxMobileOverflowPx) failures.push("mobile_horizontal_overflow");
107
+ if (!actionAttempted && !timedChange.changed) failures.push("primary_control_missing");
108
+ if (actionAttempted && !stateChangeObserved) failures.push("primary_control_inert");
109
+ if (failOnConsoleError && consoleErrorCount > 0) failures.push("fatal_page_error");
110
+ if (numberValue(initial.visible_canvas_count) > 0 && actionAttempted && !timedChange.canvas_changed && !actionChange.canvas_changed && !actionChange.screenshot_changed) {
111
+ warnings.push("canvas_inert");
112
+ }
113
+ if (actionFailed) warnings.push("some_actions_failed");
114
+ if (warnOnMissingResetPath && !resetPathPresent && route.requires_reset !== false && actionAttempted && stateChangeObserved) {
115
+ warnings.push("missing_reset_path");
116
+ }
117
+ if (warnOnConsoleError && consoleErrorCount > 0) warnings.push("critical_console_error");
118
+ return {
119
+ name: route.name,
120
+ path: route.path,
121
+ ok: failures.length === 0,
122
+ failures,
123
+ warnings,
124
+ signals: {
125
+ route_loaded: !failures.includes("route_http_error") && !failures.includes("route_blank_or_thin"),
126
+ surface_visible: surfaceVisible,
127
+ action_attempted: actionAttempted,
128
+ timed_progression_observed: timedChange.changed,
129
+ first_interaction_observed: actionChange.changed,
130
+ state_change_observed: stateChangeObserved,
131
+ mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
132
+ reset_path_present: resetPathPresent,
133
+ fatal_errors_absent: pageErrorCount === 0
134
+ },
135
+ diffs: {
136
+ timed: timedChange,
137
+ after_action: actionChange
138
+ }
139
+ };
140
+ }
141
+ function extractBasicGameplayEvidence(...sources) {
142
+ const seen = /* @__PURE__ */ new Set();
143
+ for (const source of sources) {
144
+ const found = findBasicGameplayEvidence(source, seen);
145
+ if (found) return found;
146
+ }
147
+ return null;
148
+ }
149
+ function findBasicGameplayEvidence(value, seen, depth = 0) {
150
+ if (depth > 6 || value === null || value === void 0) return null;
151
+ if (typeof value === "string") {
152
+ const parsed = parseJson(value);
153
+ return parsed === null ? null : findBasicGameplayEvidence(parsed, seen, depth + 1);
154
+ }
155
+ if (Array.isArray(value)) {
156
+ if (seen.has(value)) return null;
157
+ seen.add(value);
158
+ if (value.some((item) => hasRouteShape(recordValue(item)))) {
159
+ return { results: value.filter((item) => hasRouteShape(recordValue(item))) };
160
+ }
161
+ for (const item of value) {
162
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
163
+ if (found) return found;
164
+ }
165
+ return null;
166
+ }
167
+ const record = recordValue(value);
168
+ if (!record || seen.has(record)) return null;
169
+ seen.add(record);
170
+ if (record.version === RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION || Array.isArray(record.results)) {
171
+ return {
172
+ ...record,
173
+ results: listValue(record.results).filter((item) => Boolean(recordValue(item)))
174
+ };
175
+ }
176
+ if (hasRouteShape(record)) {
177
+ return { results: [record] };
178
+ }
179
+ for (const key of BASIC_GAMEPLAY_CONTAINER_KEYS) {
180
+ if (Object.prototype.hasOwnProperty.call(record, key)) {
181
+ const nested = findBasicGameplayEvidence(record[key], seen, depth + 1);
182
+ if (nested) return nested;
183
+ }
184
+ }
185
+ for (const item of Object.values(record)) {
186
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
187
+ if (found) return found;
188
+ }
189
+ return null;
190
+ }
191
+ function hasRouteShape(record) {
192
+ return Boolean(record && (record.initial || record.after_action || record.afterAction || record.action_results || record.actionResults) && (record.path || record.name));
193
+ }
194
+ function changed(before, after) {
195
+ const bodyTextChanged = Boolean(before.body_text_hash && after.body_text_hash && before.body_text_hash !== after.body_text_hash);
196
+ const screenshotChanged = Boolean(before.screenshot_hash && after.screenshot_hash && before.screenshot_hash !== after.screenshot_hash);
197
+ const beforeCanvasHashes = canvasHashes(before.canvases);
198
+ const afterCanvasHashes = canvasHashes(after.canvases);
199
+ const canvasChanged = Boolean(beforeCanvasHashes && afterCanvasHashes && beforeCanvasHashes !== afterCanvasHashes);
200
+ return {
201
+ body_text_changed: bodyTextChanged,
202
+ screenshot_changed: screenshotChanged,
203
+ canvas_changed: canvasChanged,
204
+ changed: bodyTextChanged || screenshotChanged || canvasChanged
205
+ };
206
+ }
207
+ function canvasHashes(canvases) {
208
+ return (canvases || []).map((canvas) => canvas.hash).filter(Boolean).join("|");
209
+ }
210
+ function countCodes(codes) {
211
+ const counts = {};
212
+ for (const code of codes) counts[code] = (counts[code] || 0) + 1;
213
+ return counts;
214
+ }
215
+ function firstNumber(...values) {
216
+ for (const value of values) {
217
+ const number = numericValue(value);
218
+ if (number !== null) return number;
219
+ }
220
+ return null;
221
+ }
222
+ function numberValue(value) {
223
+ return numericValue(value) ?? 0;
224
+ }
225
+ function numericValue(value) {
226
+ if (typeof value === "number" && Number.isFinite(value)) return value;
227
+ if (typeof value === "string" && value.trim()) {
228
+ const parsed = Number(value);
229
+ return Number.isFinite(parsed) ? parsed : null;
230
+ }
231
+ return null;
232
+ }
233
+ function recordValue(value) {
234
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
235
+ }
236
+ function listValue(value) {
237
+ return Array.isArray(value) ? value : [];
238
+ }
239
+ function parseJson(value) {
240
+ const trimmed = value.trim();
241
+ if (!trimmed || !/^[{[]/.test(trimmed)) return null;
242
+ try {
243
+ return JSON.parse(trimmed);
244
+ } catch {
245
+ return null;
246
+ }
247
+ }
248
+ // Annotate the CommonJS export names for ESM import in node:
249
+ 0 && (module.exports = {
250
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
251
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
252
+ assessBasicGameplayEvidence,
253
+ assessBasicGameplayRoute,
254
+ extractBasicGameplayEvidence
255
+ });
@@ -0,0 +1,117 @@
1
+ declare const RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION = "riddle-proof.basic-gameplay.v1";
2
+ declare const RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION = "riddle-proof.basic-gameplay.assessment.v1";
3
+ type BasicGameplayFailureCode = "route_http_error" | "fatal_page_error" | "route_blank_or_thin" | "no_game_surface" | "mobile_horizontal_overflow" | "primary_control_missing" | "primary_control_inert";
4
+ type BasicGameplayWarningCode = "canvas_inert" | "some_actions_failed" | "missing_reset_path" | "critical_console_error";
5
+ interface BasicGameplayCanvasState {
6
+ index?: number;
7
+ width?: number;
8
+ height?: number;
9
+ css_width?: number;
10
+ css_height?: number;
11
+ visible?: boolean;
12
+ readable?: boolean;
13
+ hash?: string | null;
14
+ }
15
+ interface BasicGameplaySnapshot {
16
+ screenshot_hash?: string | null;
17
+ body_text_hash?: string | null;
18
+ body_text_length?: number;
19
+ visible_large_node_count?: number;
20
+ enabled_clickable_count?: number;
21
+ reset_control_count?: number;
22
+ visible_canvas_count?: number;
23
+ canvases?: BasicGameplayCanvasState[];
24
+ [key: string]: unknown;
25
+ }
26
+ interface BasicGameplayActionResult {
27
+ ok?: boolean;
28
+ action?: string;
29
+ [key: string]: unknown;
30
+ }
31
+ interface BasicGameplayMobileEvidence {
32
+ overflow_px?: number;
33
+ [key: string]: unknown;
34
+ }
35
+ interface RiddleProofBasicGameplayRouteEvidence {
36
+ name?: string;
37
+ path?: string;
38
+ http_status?: number | null;
39
+ response_status?: number | null;
40
+ status?: number | null;
41
+ console_error_count?: number;
42
+ page_error_count?: number;
43
+ initial?: BasicGameplaySnapshot;
44
+ timed?: BasicGameplaySnapshot;
45
+ after_action?: BasicGameplaySnapshot;
46
+ afterAction?: BasicGameplaySnapshot;
47
+ mobile?: BasicGameplayMobileEvidence;
48
+ action_results?: BasicGameplayActionResult[];
49
+ actionResults?: BasicGameplayActionResult[];
50
+ requires_reset?: boolean;
51
+ [key: string]: unknown;
52
+ }
53
+ interface RiddleProofBasicGameplayEvidence {
54
+ version?: typeof RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION | string;
55
+ site?: string | null;
56
+ base_url?: string;
57
+ results?: RiddleProofBasicGameplayRouteEvidence[];
58
+ [key: string]: unknown;
59
+ }
60
+ interface AssessBasicGameplayOptions {
61
+ maxMobileOverflowPx?: number;
62
+ minBodyTextLength?: number;
63
+ minVisibleLargeNodes?: number;
64
+ minSurfaceLargeNodes?: number;
65
+ warnOnMissingResetPath?: boolean;
66
+ warnOnConsoleError?: boolean;
67
+ failOnConsoleError?: boolean;
68
+ }
69
+ interface BasicGameplayChangeSummary {
70
+ body_text_changed: boolean;
71
+ screenshot_changed: boolean;
72
+ canvas_changed: boolean;
73
+ changed: boolean;
74
+ }
75
+ interface RiddleProofBasicGameplayRouteAssessment {
76
+ name?: string;
77
+ path?: string;
78
+ ok: boolean;
79
+ failures: BasicGameplayFailureCode[];
80
+ warnings: BasicGameplayWarningCode[];
81
+ signals: {
82
+ route_loaded: boolean;
83
+ surface_visible: boolean;
84
+ action_attempted: boolean;
85
+ timed_progression_observed: boolean;
86
+ first_interaction_observed: boolean;
87
+ state_change_observed: boolean;
88
+ mobile_overflow_absent: boolean;
89
+ reset_path_present: boolean;
90
+ fatal_errors_absent: boolean;
91
+ };
92
+ diffs: {
93
+ timed: BasicGameplayChangeSummary;
94
+ after_action: BasicGameplayChangeSummary;
95
+ };
96
+ }
97
+ interface RiddleProofBasicGameplayAssessment {
98
+ version: typeof RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION;
99
+ evidence_present: boolean;
100
+ passed: boolean;
101
+ checked_routes: number;
102
+ passing_routes: number;
103
+ failing_routes: Array<{
104
+ name?: string;
105
+ path?: string;
106
+ failures: BasicGameplayFailureCode[];
107
+ warnings: BasicGameplayWarningCode[];
108
+ }>;
109
+ failure_counts: Record<string, number>;
110
+ warning_counts: Record<string, number>;
111
+ route_results: RiddleProofBasicGameplayRouteAssessment[];
112
+ }
113
+ declare function assessBasicGameplayEvidence(evidence: unknown, options?: AssessBasicGameplayOptions): RiddleProofBasicGameplayAssessment;
114
+ declare function assessBasicGameplayRoute(route: RiddleProofBasicGameplayRouteEvidence, options?: AssessBasicGameplayOptions): RiddleProofBasicGameplayRouteAssessment;
115
+ declare function extractBasicGameplayEvidence(...sources: unknown[]): RiddleProofBasicGameplayEvidence | null;
116
+
117
+ export { type AssessBasicGameplayOptions, type BasicGameplayActionResult, type BasicGameplayCanvasState, type BasicGameplayChangeSummary, type BasicGameplayFailureCode, type BasicGameplayMobileEvidence, type BasicGameplaySnapshot, type BasicGameplayWarningCode, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, type RiddleProofBasicGameplayAssessment, type RiddleProofBasicGameplayEvidence, type RiddleProofBasicGameplayRouteAssessment, type RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayRoute, extractBasicGameplayEvidence };
@@ -0,0 +1,117 @@
1
+ declare const RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION = "riddle-proof.basic-gameplay.v1";
2
+ declare const RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION = "riddle-proof.basic-gameplay.assessment.v1";
3
+ type BasicGameplayFailureCode = "route_http_error" | "fatal_page_error" | "route_blank_or_thin" | "no_game_surface" | "mobile_horizontal_overflow" | "primary_control_missing" | "primary_control_inert";
4
+ type BasicGameplayWarningCode = "canvas_inert" | "some_actions_failed" | "missing_reset_path" | "critical_console_error";
5
+ interface BasicGameplayCanvasState {
6
+ index?: number;
7
+ width?: number;
8
+ height?: number;
9
+ css_width?: number;
10
+ css_height?: number;
11
+ visible?: boolean;
12
+ readable?: boolean;
13
+ hash?: string | null;
14
+ }
15
+ interface BasicGameplaySnapshot {
16
+ screenshot_hash?: string | null;
17
+ body_text_hash?: string | null;
18
+ body_text_length?: number;
19
+ visible_large_node_count?: number;
20
+ enabled_clickable_count?: number;
21
+ reset_control_count?: number;
22
+ visible_canvas_count?: number;
23
+ canvases?: BasicGameplayCanvasState[];
24
+ [key: string]: unknown;
25
+ }
26
+ interface BasicGameplayActionResult {
27
+ ok?: boolean;
28
+ action?: string;
29
+ [key: string]: unknown;
30
+ }
31
+ interface BasicGameplayMobileEvidence {
32
+ overflow_px?: number;
33
+ [key: string]: unknown;
34
+ }
35
+ interface RiddleProofBasicGameplayRouteEvidence {
36
+ name?: string;
37
+ path?: string;
38
+ http_status?: number | null;
39
+ response_status?: number | null;
40
+ status?: number | null;
41
+ console_error_count?: number;
42
+ page_error_count?: number;
43
+ initial?: BasicGameplaySnapshot;
44
+ timed?: BasicGameplaySnapshot;
45
+ after_action?: BasicGameplaySnapshot;
46
+ afterAction?: BasicGameplaySnapshot;
47
+ mobile?: BasicGameplayMobileEvidence;
48
+ action_results?: BasicGameplayActionResult[];
49
+ actionResults?: BasicGameplayActionResult[];
50
+ requires_reset?: boolean;
51
+ [key: string]: unknown;
52
+ }
53
+ interface RiddleProofBasicGameplayEvidence {
54
+ version?: typeof RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION | string;
55
+ site?: string | null;
56
+ base_url?: string;
57
+ results?: RiddleProofBasicGameplayRouteEvidence[];
58
+ [key: string]: unknown;
59
+ }
60
+ interface AssessBasicGameplayOptions {
61
+ maxMobileOverflowPx?: number;
62
+ minBodyTextLength?: number;
63
+ minVisibleLargeNodes?: number;
64
+ minSurfaceLargeNodes?: number;
65
+ warnOnMissingResetPath?: boolean;
66
+ warnOnConsoleError?: boolean;
67
+ failOnConsoleError?: boolean;
68
+ }
69
+ interface BasicGameplayChangeSummary {
70
+ body_text_changed: boolean;
71
+ screenshot_changed: boolean;
72
+ canvas_changed: boolean;
73
+ changed: boolean;
74
+ }
75
+ interface RiddleProofBasicGameplayRouteAssessment {
76
+ name?: string;
77
+ path?: string;
78
+ ok: boolean;
79
+ failures: BasicGameplayFailureCode[];
80
+ warnings: BasicGameplayWarningCode[];
81
+ signals: {
82
+ route_loaded: boolean;
83
+ surface_visible: boolean;
84
+ action_attempted: boolean;
85
+ timed_progression_observed: boolean;
86
+ first_interaction_observed: boolean;
87
+ state_change_observed: boolean;
88
+ mobile_overflow_absent: boolean;
89
+ reset_path_present: boolean;
90
+ fatal_errors_absent: boolean;
91
+ };
92
+ diffs: {
93
+ timed: BasicGameplayChangeSummary;
94
+ after_action: BasicGameplayChangeSummary;
95
+ };
96
+ }
97
+ interface RiddleProofBasicGameplayAssessment {
98
+ version: typeof RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION;
99
+ evidence_present: boolean;
100
+ passed: boolean;
101
+ checked_routes: number;
102
+ passing_routes: number;
103
+ failing_routes: Array<{
104
+ name?: string;
105
+ path?: string;
106
+ failures: BasicGameplayFailureCode[];
107
+ warnings: BasicGameplayWarningCode[];
108
+ }>;
109
+ failure_counts: Record<string, number>;
110
+ warning_counts: Record<string, number>;
111
+ route_results: RiddleProofBasicGameplayRouteAssessment[];
112
+ }
113
+ declare function assessBasicGameplayEvidence(evidence: unknown, options?: AssessBasicGameplayOptions): RiddleProofBasicGameplayAssessment;
114
+ declare function assessBasicGameplayRoute(route: RiddleProofBasicGameplayRouteEvidence, options?: AssessBasicGameplayOptions): RiddleProofBasicGameplayRouteAssessment;
115
+ declare function extractBasicGameplayEvidence(...sources: unknown[]): RiddleProofBasicGameplayEvidence | null;
116
+
117
+ export { type AssessBasicGameplayOptions, type BasicGameplayActionResult, type BasicGameplayCanvasState, type BasicGameplayChangeSummary, type BasicGameplayFailureCode, type BasicGameplayMobileEvidence, type BasicGameplaySnapshot, type BasicGameplayWarningCode, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, type RiddleProofBasicGameplayAssessment, type RiddleProofBasicGameplayEvidence, type RiddleProofBasicGameplayRouteAssessment, type RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayRoute, extractBasicGameplayEvidence };
@@ -0,0 +1,14 @@
1
+ import {
2
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
3
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
4
+ assessBasicGameplayEvidence,
5
+ assessBasicGameplayRoute,
6
+ extractBasicGameplayEvidence
7
+ } from "./chunk-RNGJX62B.js";
8
+ export {
9
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
10
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
11
+ assessBasicGameplayEvidence,
12
+ assessBasicGameplayRoute,
13
+ extractBasicGameplayEvidence
14
+ };
@@ -0,0 +1,227 @@
1
+ // src/basic-gameplay.ts
2
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION = "riddle-proof.basic-gameplay.v1";
3
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION = "riddle-proof.basic-gameplay.assessment.v1";
4
+ var BASIC_GAMEPLAY_CONTAINER_KEYS = [
5
+ "basic_gameplay",
6
+ "basicGameplay",
7
+ "basic_gameplay_evidence",
8
+ "basicGameplayEvidence",
9
+ "gameplay_proof",
10
+ "gameplayProof"
11
+ ];
12
+ function assessBasicGameplayEvidence(evidence, options = {}) {
13
+ const run = extractBasicGameplayEvidence(evidence);
14
+ if (!run) {
15
+ return {
16
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
17
+ evidence_present: false,
18
+ passed: false,
19
+ checked_routes: 0,
20
+ passing_routes: 0,
21
+ failing_routes: [],
22
+ failure_counts: {},
23
+ warning_counts: {},
24
+ route_results: []
25
+ };
26
+ }
27
+ const routeResults = (run.results || []).map((route) => assessBasicGameplayRoute(route, options));
28
+ const failingRoutes = routeResults.filter((result) => !result.ok).map((result) => ({
29
+ name: result.name,
30
+ path: result.path,
31
+ failures: result.failures,
32
+ warnings: result.warnings
33
+ }));
34
+ return {
35
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
36
+ evidence_present: true,
37
+ passed: failingRoutes.length === 0,
38
+ checked_routes: routeResults.length,
39
+ passing_routes: routeResults.filter((result) => result.ok).length,
40
+ failing_routes: failingRoutes,
41
+ failure_counts: countCodes(routeResults.flatMap((result) => result.failures)),
42
+ warning_counts: countCodes(routeResults.flatMap((result) => result.warnings)),
43
+ route_results: routeResults
44
+ };
45
+ }
46
+ function assessBasicGameplayRoute(route, options = {}) {
47
+ const maxMobileOverflowPx = options.maxMobileOverflowPx ?? 4;
48
+ const minBodyTextLength = options.minBodyTextLength ?? 20;
49
+ const minVisibleLargeNodes = options.minVisibleLargeNodes ?? 3;
50
+ const minSurfaceLargeNodes = options.minSurfaceLargeNodes ?? 8;
51
+ const warnOnMissingResetPath = options.warnOnMissingResetPath ?? true;
52
+ const warnOnConsoleError = options.warnOnConsoleError ?? true;
53
+ const failOnConsoleError = options.failOnConsoleError ?? false;
54
+ const failures = [];
55
+ const warnings = [];
56
+ const initial = route.initial || {};
57
+ const timed = route.timed || {};
58
+ const afterAction = route.after_action || route.afterAction || {};
59
+ const mobile = route.mobile || {};
60
+ const timedChange = changed(initial, timed);
61
+ const actionChange = changed(timed, afterAction);
62
+ const surfaceVisible = numberValue(initial.visible_canvas_count) > 0 || numberValue(initial.enabled_clickable_count) > 0 || numberValue(initial.visible_large_node_count) >= minSurfaceLargeNodes;
63
+ const actionResults = listValue(route.action_results || route.actionResults);
64
+ const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
65
+ const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
66
+ const stateChangeObserved = actionChange.changed || timedChange.changed;
67
+ const resetPathPresent = numberValue(initial.reset_control_count) > 0 || numberValue(timed.reset_control_count) > 0 || numberValue(afterAction.reset_control_count) > 0;
68
+ const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
69
+ const pageErrorCount = numberValue(route.page_error_count);
70
+ const consoleErrorCount = numberValue(route.console_error_count);
71
+ const mobileOverflowPx = numberValue(mobile.overflow_px);
72
+ if (responseStatus !== null && responseStatus >= 400) failures.push("route_http_error");
73
+ if (pageErrorCount > 0) failures.push("fatal_page_error");
74
+ if (numberValue(initial.body_text_length) < minBodyTextLength && numberValue(initial.visible_large_node_count) < minVisibleLargeNodes) {
75
+ failures.push("route_blank_or_thin");
76
+ }
77
+ if (!surfaceVisible) failures.push("no_game_surface");
78
+ if (mobileOverflowPx > maxMobileOverflowPx) failures.push("mobile_horizontal_overflow");
79
+ if (!actionAttempted && !timedChange.changed) failures.push("primary_control_missing");
80
+ if (actionAttempted && !stateChangeObserved) failures.push("primary_control_inert");
81
+ if (failOnConsoleError && consoleErrorCount > 0) failures.push("fatal_page_error");
82
+ if (numberValue(initial.visible_canvas_count) > 0 && actionAttempted && !timedChange.canvas_changed && !actionChange.canvas_changed && !actionChange.screenshot_changed) {
83
+ warnings.push("canvas_inert");
84
+ }
85
+ if (actionFailed) warnings.push("some_actions_failed");
86
+ if (warnOnMissingResetPath && !resetPathPresent && route.requires_reset !== false && actionAttempted && stateChangeObserved) {
87
+ warnings.push("missing_reset_path");
88
+ }
89
+ if (warnOnConsoleError && consoleErrorCount > 0) warnings.push("critical_console_error");
90
+ return {
91
+ name: route.name,
92
+ path: route.path,
93
+ ok: failures.length === 0,
94
+ failures,
95
+ warnings,
96
+ signals: {
97
+ route_loaded: !failures.includes("route_http_error") && !failures.includes("route_blank_or_thin"),
98
+ surface_visible: surfaceVisible,
99
+ action_attempted: actionAttempted,
100
+ timed_progression_observed: timedChange.changed,
101
+ first_interaction_observed: actionChange.changed,
102
+ state_change_observed: stateChangeObserved,
103
+ mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
104
+ reset_path_present: resetPathPresent,
105
+ fatal_errors_absent: pageErrorCount === 0
106
+ },
107
+ diffs: {
108
+ timed: timedChange,
109
+ after_action: actionChange
110
+ }
111
+ };
112
+ }
113
+ function extractBasicGameplayEvidence(...sources) {
114
+ const seen = /* @__PURE__ */ new Set();
115
+ for (const source of sources) {
116
+ const found = findBasicGameplayEvidence(source, seen);
117
+ if (found) return found;
118
+ }
119
+ return null;
120
+ }
121
+ function findBasicGameplayEvidence(value, seen, depth = 0) {
122
+ if (depth > 6 || value === null || value === void 0) return null;
123
+ if (typeof value === "string") {
124
+ const parsed = parseJson(value);
125
+ return parsed === null ? null : findBasicGameplayEvidence(parsed, seen, depth + 1);
126
+ }
127
+ if (Array.isArray(value)) {
128
+ if (seen.has(value)) return null;
129
+ seen.add(value);
130
+ if (value.some((item) => hasRouteShape(recordValue(item)))) {
131
+ return { results: value.filter((item) => hasRouteShape(recordValue(item))) };
132
+ }
133
+ for (const item of value) {
134
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
135
+ if (found) return found;
136
+ }
137
+ return null;
138
+ }
139
+ const record = recordValue(value);
140
+ if (!record || seen.has(record)) return null;
141
+ seen.add(record);
142
+ if (record.version === RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION || Array.isArray(record.results)) {
143
+ return {
144
+ ...record,
145
+ results: listValue(record.results).filter((item) => Boolean(recordValue(item)))
146
+ };
147
+ }
148
+ if (hasRouteShape(record)) {
149
+ return { results: [record] };
150
+ }
151
+ for (const key of BASIC_GAMEPLAY_CONTAINER_KEYS) {
152
+ if (Object.prototype.hasOwnProperty.call(record, key)) {
153
+ const nested = findBasicGameplayEvidence(record[key], seen, depth + 1);
154
+ if (nested) return nested;
155
+ }
156
+ }
157
+ for (const item of Object.values(record)) {
158
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
159
+ if (found) return found;
160
+ }
161
+ return null;
162
+ }
163
+ function hasRouteShape(record) {
164
+ return Boolean(record && (record.initial || record.after_action || record.afterAction || record.action_results || record.actionResults) && (record.path || record.name));
165
+ }
166
+ function changed(before, after) {
167
+ const bodyTextChanged = Boolean(before.body_text_hash && after.body_text_hash && before.body_text_hash !== after.body_text_hash);
168
+ const screenshotChanged = Boolean(before.screenshot_hash && after.screenshot_hash && before.screenshot_hash !== after.screenshot_hash);
169
+ const beforeCanvasHashes = canvasHashes(before.canvases);
170
+ const afterCanvasHashes = canvasHashes(after.canvases);
171
+ const canvasChanged = Boolean(beforeCanvasHashes && afterCanvasHashes && beforeCanvasHashes !== afterCanvasHashes);
172
+ return {
173
+ body_text_changed: bodyTextChanged,
174
+ screenshot_changed: screenshotChanged,
175
+ canvas_changed: canvasChanged,
176
+ changed: bodyTextChanged || screenshotChanged || canvasChanged
177
+ };
178
+ }
179
+ function canvasHashes(canvases) {
180
+ return (canvases || []).map((canvas) => canvas.hash).filter(Boolean).join("|");
181
+ }
182
+ function countCodes(codes) {
183
+ const counts = {};
184
+ for (const code of codes) counts[code] = (counts[code] || 0) + 1;
185
+ return counts;
186
+ }
187
+ function firstNumber(...values) {
188
+ for (const value of values) {
189
+ const number = numericValue(value);
190
+ if (number !== null) return number;
191
+ }
192
+ return null;
193
+ }
194
+ function numberValue(value) {
195
+ return numericValue(value) ?? 0;
196
+ }
197
+ function numericValue(value) {
198
+ if (typeof value === "number" && Number.isFinite(value)) return value;
199
+ if (typeof value === "string" && value.trim()) {
200
+ const parsed = Number(value);
201
+ return Number.isFinite(parsed) ? parsed : null;
202
+ }
203
+ return null;
204
+ }
205
+ function recordValue(value) {
206
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
207
+ }
208
+ function listValue(value) {
209
+ return Array.isArray(value) ? value : [];
210
+ }
211
+ function parseJson(value) {
212
+ const trimmed = value.trim();
213
+ if (!trimmed || !/^[{[]/.test(trimmed)) return null;
214
+ try {
215
+ return JSON.parse(trimmed);
216
+ } catch {
217
+ return null;
218
+ }
219
+ }
220
+
221
+ export {
222
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
223
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
224
+ assessBasicGameplayEvidence,
225
+ assessBasicGameplayRoute,
226
+ extractBasicGameplayEvidence
227
+ };
package/dist/cli.js CHANGED
@@ -7,18 +7,18 @@ import {
7
7
  createDisabledRiddleProofAgentAdapter,
8
8
  readRiddleProofRunStatus,
9
9
  runRiddleProofEngineHarness
10
- } from "./chunk-A2AWRZ5B.js";
10
+ } from "./chunk-2FBF2UDZ.js";
11
+ import "./chunk-MO24D3PY.js";
11
12
  import "./chunk-RFJ5BQF6.js";
13
+ import "./chunk-3UHWI3FO.js";
14
+ import {
15
+ createCheckpointResponseTemplate
16
+ } from "./chunk-33XO42CY.js";
12
17
  import "./chunk-JFQXAJH2.js";
13
18
  import {
14
19
  createCodexExecAgentAdapter,
15
20
  runCodexExecAgentDoctor
16
21
  } from "./chunk-3266V3MO.js";
17
- import "./chunk-MO24D3PY.js";
18
- import "./chunk-3UHWI3FO.js";
19
- import {
20
- createCheckpointResponseTemplate
21
- } from "./chunk-33XO42CY.js";
22
22
  import "./chunk-DUFDZJOF.js";
23
23
 
24
24
  // src/cli.ts
@@ -2,9 +2,9 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-A2AWRZ5B.js";
6
- import "./chunk-RFJ5BQF6.js";
5
+ } from "./chunk-2FBF2UDZ.js";
7
6
  import "./chunk-MO24D3PY.js";
7
+ import "./chunk-RFJ5BQF6.js";
8
8
  import "./chunk-3UHWI3FO.js";
9
9
  import "./chunk-33XO42CY.js";
10
10
  import "./chunk-DUFDZJOF.js";
package/dist/index.cjs CHANGED
@@ -2778,6 +2778,8 @@ __export(index_exports, {
2778
2778
  DEFAULT_DIAGNOSTIC_STRING_LIMIT: () => DEFAULT_DIAGNOSTIC_STRING_LIMIT,
2779
2779
  DEFAULT_RIDDLE_API_BASE_URL: () => DEFAULT_RIDDLE_API_BASE_URL,
2780
2780
  DEFAULT_RIDDLE_API_KEY_FILE: () => DEFAULT_RIDDLE_API_KEY_FILE,
2781
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
2782
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
2781
2783
  RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION: () => RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION,
2782
2784
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: () => RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
2783
2785
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: () => RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -2793,6 +2795,8 @@ __export(index_exports, {
2793
2795
  appendStageHeartbeat: () => appendStageHeartbeat,
2794
2796
  applyPrLifecycleState: () => applyPrLifecycleState,
2795
2797
  applyTerminalMetadata: () => applyTerminalMetadata,
2798
+ assessBasicGameplayEvidence: () => assessBasicGameplayEvidence,
2799
+ assessBasicGameplayRoute: () => assessBasicGameplayRoute,
2796
2800
  assessPlayabilityEvidence: () => assessPlayabilityEvidence,
2797
2801
  authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
2798
2802
  buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
@@ -2817,6 +2821,7 @@ __export(index_exports, {
2817
2821
  createRunState: () => createRunState,
2818
2822
  createRunStatusSnapshot: () => createRunStatusSnapshot,
2819
2823
  deployRiddleStaticPreview: () => deployRiddleStaticPreview,
2824
+ extractBasicGameplayEvidence: () => extractBasicGameplayEvidence,
2820
2825
  extractPlayabilityEvidence: () => extractPlayabilityEvidence,
2821
2826
  isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
2822
2827
  isRiddleProofPlayabilityMode: () => isRiddleProofPlayabilityMode,
@@ -7611,6 +7616,226 @@ function parseJson(value) {
7611
7616
  }
7612
7617
  }
7613
7618
 
7619
+ // src/basic-gameplay.ts
7620
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION = "riddle-proof.basic-gameplay.v1";
7621
+ var RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION = "riddle-proof.basic-gameplay.assessment.v1";
7622
+ var BASIC_GAMEPLAY_CONTAINER_KEYS = [
7623
+ "basic_gameplay",
7624
+ "basicGameplay",
7625
+ "basic_gameplay_evidence",
7626
+ "basicGameplayEvidence",
7627
+ "gameplay_proof",
7628
+ "gameplayProof"
7629
+ ];
7630
+ function assessBasicGameplayEvidence(evidence, options = {}) {
7631
+ const run = extractBasicGameplayEvidence(evidence);
7632
+ if (!run) {
7633
+ return {
7634
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
7635
+ evidence_present: false,
7636
+ passed: false,
7637
+ checked_routes: 0,
7638
+ passing_routes: 0,
7639
+ failing_routes: [],
7640
+ failure_counts: {},
7641
+ warning_counts: {},
7642
+ route_results: []
7643
+ };
7644
+ }
7645
+ const routeResults = (run.results || []).map((route) => assessBasicGameplayRoute(route, options));
7646
+ const failingRoutes = routeResults.filter((result) => !result.ok).map((result) => ({
7647
+ name: result.name,
7648
+ path: result.path,
7649
+ failures: result.failures,
7650
+ warnings: result.warnings
7651
+ }));
7652
+ return {
7653
+ version: RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
7654
+ evidence_present: true,
7655
+ passed: failingRoutes.length === 0,
7656
+ checked_routes: routeResults.length,
7657
+ passing_routes: routeResults.filter((result) => result.ok).length,
7658
+ failing_routes: failingRoutes,
7659
+ failure_counts: countCodes(routeResults.flatMap((result) => result.failures)),
7660
+ warning_counts: countCodes(routeResults.flatMap((result) => result.warnings)),
7661
+ route_results: routeResults
7662
+ };
7663
+ }
7664
+ function assessBasicGameplayRoute(route, options = {}) {
7665
+ const maxMobileOverflowPx = options.maxMobileOverflowPx ?? 4;
7666
+ const minBodyTextLength = options.minBodyTextLength ?? 20;
7667
+ const minVisibleLargeNodes = options.minVisibleLargeNodes ?? 3;
7668
+ const minSurfaceLargeNodes = options.minSurfaceLargeNodes ?? 8;
7669
+ const warnOnMissingResetPath = options.warnOnMissingResetPath ?? true;
7670
+ const warnOnConsoleError = options.warnOnConsoleError ?? true;
7671
+ const failOnConsoleError = options.failOnConsoleError ?? false;
7672
+ const failures = [];
7673
+ const warnings = [];
7674
+ const initial = route.initial || {};
7675
+ const timed = route.timed || {};
7676
+ const afterAction = route.after_action || route.afterAction || {};
7677
+ const mobile = route.mobile || {};
7678
+ const timedChange = changed(initial, timed);
7679
+ const actionChange = changed(timed, afterAction);
7680
+ const surfaceVisible = numberValue2(initial.visible_canvas_count) > 0 || numberValue2(initial.enabled_clickable_count) > 0 || numberValue2(initial.visible_large_node_count) >= minSurfaceLargeNodes;
7681
+ const actionResults = listValue2(route.action_results || route.actionResults);
7682
+ const actionAttempted = actionResults.some((result) => result.ok === true && result.action !== "wait");
7683
+ const actionFailed = actionResults.some((result) => result.ok === false && result.action !== "wait");
7684
+ const stateChangeObserved = actionChange.changed || timedChange.changed;
7685
+ const resetPathPresent = numberValue2(initial.reset_control_count) > 0 || numberValue2(timed.reset_control_count) > 0 || numberValue2(afterAction.reset_control_count) > 0;
7686
+ const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
7687
+ const pageErrorCount = numberValue2(route.page_error_count);
7688
+ const consoleErrorCount = numberValue2(route.console_error_count);
7689
+ const mobileOverflowPx = numberValue2(mobile.overflow_px);
7690
+ if (responseStatus !== null && responseStatus >= 400) failures.push("route_http_error");
7691
+ if (pageErrorCount > 0) failures.push("fatal_page_error");
7692
+ if (numberValue2(initial.body_text_length) < minBodyTextLength && numberValue2(initial.visible_large_node_count) < minVisibleLargeNodes) {
7693
+ failures.push("route_blank_or_thin");
7694
+ }
7695
+ if (!surfaceVisible) failures.push("no_game_surface");
7696
+ if (mobileOverflowPx > maxMobileOverflowPx) failures.push("mobile_horizontal_overflow");
7697
+ if (!actionAttempted && !timedChange.changed) failures.push("primary_control_missing");
7698
+ if (actionAttempted && !stateChangeObserved) failures.push("primary_control_inert");
7699
+ if (failOnConsoleError && consoleErrorCount > 0) failures.push("fatal_page_error");
7700
+ if (numberValue2(initial.visible_canvas_count) > 0 && actionAttempted && !timedChange.canvas_changed && !actionChange.canvas_changed && !actionChange.screenshot_changed) {
7701
+ warnings.push("canvas_inert");
7702
+ }
7703
+ if (actionFailed) warnings.push("some_actions_failed");
7704
+ if (warnOnMissingResetPath && !resetPathPresent && route.requires_reset !== false && actionAttempted && stateChangeObserved) {
7705
+ warnings.push("missing_reset_path");
7706
+ }
7707
+ if (warnOnConsoleError && consoleErrorCount > 0) warnings.push("critical_console_error");
7708
+ return {
7709
+ name: route.name,
7710
+ path: route.path,
7711
+ ok: failures.length === 0,
7712
+ failures,
7713
+ warnings,
7714
+ signals: {
7715
+ route_loaded: !failures.includes("route_http_error") && !failures.includes("route_blank_or_thin"),
7716
+ surface_visible: surfaceVisible,
7717
+ action_attempted: actionAttempted,
7718
+ timed_progression_observed: timedChange.changed,
7719
+ first_interaction_observed: actionChange.changed,
7720
+ state_change_observed: stateChangeObserved,
7721
+ mobile_overflow_absent: mobileOverflowPx <= maxMobileOverflowPx,
7722
+ reset_path_present: resetPathPresent,
7723
+ fatal_errors_absent: pageErrorCount === 0
7724
+ },
7725
+ diffs: {
7726
+ timed: timedChange,
7727
+ after_action: actionChange
7728
+ }
7729
+ };
7730
+ }
7731
+ function extractBasicGameplayEvidence(...sources) {
7732
+ const seen = /* @__PURE__ */ new Set();
7733
+ for (const source of sources) {
7734
+ const found = findBasicGameplayEvidence(source, seen);
7735
+ if (found) return found;
7736
+ }
7737
+ return null;
7738
+ }
7739
+ function findBasicGameplayEvidence(value, seen, depth = 0) {
7740
+ if (depth > 6 || value === null || value === void 0) return null;
7741
+ if (typeof value === "string") {
7742
+ const parsed = parseJson2(value);
7743
+ return parsed === null ? null : findBasicGameplayEvidence(parsed, seen, depth + 1);
7744
+ }
7745
+ if (Array.isArray(value)) {
7746
+ if (seen.has(value)) return null;
7747
+ seen.add(value);
7748
+ if (value.some((item) => hasRouteShape(recordValue3(item)))) {
7749
+ return { results: value.filter((item) => hasRouteShape(recordValue3(item))) };
7750
+ }
7751
+ for (const item of value) {
7752
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
7753
+ if (found) return found;
7754
+ }
7755
+ return null;
7756
+ }
7757
+ const record = recordValue3(value);
7758
+ if (!record || seen.has(record)) return null;
7759
+ seen.add(record);
7760
+ if (record.version === RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION || Array.isArray(record.results)) {
7761
+ return {
7762
+ ...record,
7763
+ results: listValue2(record.results).filter((item) => Boolean(recordValue3(item)))
7764
+ };
7765
+ }
7766
+ if (hasRouteShape(record)) {
7767
+ return { results: [record] };
7768
+ }
7769
+ for (const key of BASIC_GAMEPLAY_CONTAINER_KEYS) {
7770
+ if (Object.prototype.hasOwnProperty.call(record, key)) {
7771
+ const nested = findBasicGameplayEvidence(record[key], seen, depth + 1);
7772
+ if (nested) return nested;
7773
+ }
7774
+ }
7775
+ for (const item of Object.values(record)) {
7776
+ const found = findBasicGameplayEvidence(item, seen, depth + 1);
7777
+ if (found) return found;
7778
+ }
7779
+ return null;
7780
+ }
7781
+ function hasRouteShape(record) {
7782
+ return Boolean(record && (record.initial || record.after_action || record.afterAction || record.action_results || record.actionResults) && (record.path || record.name));
7783
+ }
7784
+ function changed(before, after) {
7785
+ const bodyTextChanged = Boolean(before.body_text_hash && after.body_text_hash && before.body_text_hash !== after.body_text_hash);
7786
+ const screenshotChanged = Boolean(before.screenshot_hash && after.screenshot_hash && before.screenshot_hash !== after.screenshot_hash);
7787
+ const beforeCanvasHashes = canvasHashes(before.canvases);
7788
+ const afterCanvasHashes = canvasHashes(after.canvases);
7789
+ const canvasChanged = Boolean(beforeCanvasHashes && afterCanvasHashes && beforeCanvasHashes !== afterCanvasHashes);
7790
+ return {
7791
+ body_text_changed: bodyTextChanged,
7792
+ screenshot_changed: screenshotChanged,
7793
+ canvas_changed: canvasChanged,
7794
+ changed: bodyTextChanged || screenshotChanged || canvasChanged
7795
+ };
7796
+ }
7797
+ function canvasHashes(canvases) {
7798
+ return (canvases || []).map((canvas) => canvas.hash).filter(Boolean).join("|");
7799
+ }
7800
+ function countCodes(codes) {
7801
+ const counts = {};
7802
+ for (const code of codes) counts[code] = (counts[code] || 0) + 1;
7803
+ return counts;
7804
+ }
7805
+ function firstNumber(...values) {
7806
+ for (const value of values) {
7807
+ const number = numericValue3(value);
7808
+ if (number !== null) return number;
7809
+ }
7810
+ return null;
7811
+ }
7812
+ function numberValue2(value) {
7813
+ return numericValue3(value) ?? 0;
7814
+ }
7815
+ function numericValue3(value) {
7816
+ if (typeof value === "number" && Number.isFinite(value)) return value;
7817
+ if (typeof value === "string" && value.trim()) {
7818
+ const parsed = Number(value);
7819
+ return Number.isFinite(parsed) ? parsed : null;
7820
+ }
7821
+ return null;
7822
+ }
7823
+ function recordValue3(value) {
7824
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
7825
+ }
7826
+ function listValue2(value) {
7827
+ return Array.isArray(value) ? value : [];
7828
+ }
7829
+ function parseJson2(value) {
7830
+ const trimmed = value.trim();
7831
+ if (!trimmed || !/^[{[]/.test(trimmed)) return null;
7832
+ try {
7833
+ return JSON.parse(trimmed);
7834
+ } catch {
7835
+ return null;
7836
+ }
7837
+ }
7838
+
7614
7839
  // src/riddle-client.ts
7615
7840
  var import_node_child_process4 = require("child_process");
7616
7841
  var import_node_fs5 = require("fs");
@@ -7767,6 +7992,8 @@ function createRiddleApiClient(config = {}) {
7767
7992
  DEFAULT_DIAGNOSTIC_STRING_LIMIT,
7768
7993
  DEFAULT_RIDDLE_API_BASE_URL,
7769
7994
  DEFAULT_RIDDLE_API_KEY_FILE,
7995
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
7996
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
7770
7997
  RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION,
7771
7998
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
7772
7999
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -7782,6 +8009,8 @@ function createRiddleApiClient(config = {}) {
7782
8009
  appendStageHeartbeat,
7783
8010
  applyPrLifecycleState,
7784
8011
  applyTerminalMetadata,
8012
+ assessBasicGameplayEvidence,
8013
+ assessBasicGameplayRoute,
7785
8014
  assessPlayabilityEvidence,
7786
8015
  authorPacketPayloadFromCheckpointResponse,
7787
8016
  buildAuthorCheckpointPacket,
@@ -7806,6 +8035,7 @@ function createRiddleApiClient(config = {}) {
7806
8035
  createRunState,
7807
8036
  createRunStatusSnapshot,
7808
8037
  deployRiddleStaticPreview,
8038
+ extractBasicGameplayEvidence,
7809
8039
  extractPlayabilityEvidence,
7810
8040
  isDuplicateCheckpointResponse,
7811
8041
  isRiddleProofPlayabilityMode,
package/dist/index.d.cts CHANGED
@@ -9,4 +9,5 @@ export { CodexExecAgentConfig, CodexJsonRequest, CodexJsonResult, CodexJsonRunne
9
9
  export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_DIAGNOSTIC_HISTORY_LIMIT, DEFAULT_DIAGNOSTIC_STRING_LIMIT, RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION, RiddleProofArtifactSummary, RiddleProofCaptureArtifactSummary, RiddleProofCaptureDiagnostic, RiddleProofDiagnosticRedactionOptions, appendCaptureDiagnostic, createCaptureDiagnostic, redactForProofDiagnostics, summarizeCaptureArtifacts } from './diagnostics.cjs';
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.cjs';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.cjs';
12
+ export { AssessBasicGameplayOptions, BasicGameplayActionResult, BasicGameplayCanvasState, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayMobileEvidence, BasicGameplaySnapshot, BasicGameplayWarningCode, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayRoute, extractBasicGameplayEvidence } from './basic-gameplay.cjs';
12
13
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobResult, RiddlePreviewDeployResult, RiddleRunScriptInput, createRiddleApiClient, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript } from './riddle-client.cjs';
package/dist/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export { CodexExecAgentConfig, CodexJsonRequest, CodexJsonResult, CodexJsonRunne
9
9
  export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_DIAGNOSTIC_HISTORY_LIMIT, DEFAULT_DIAGNOSTIC_STRING_LIMIT, RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION, RiddleProofArtifactSummary, RiddleProofCaptureArtifactSummary, RiddleProofCaptureDiagnostic, RiddleProofDiagnosticRedactionOptions, appendCaptureDiagnostic, createCaptureDiagnostic, redactForProofDiagnostics, summarizeCaptureArtifacts } from './diagnostics.js';
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.js';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.js';
12
+ export { AssessBasicGameplayOptions, BasicGameplayActionResult, BasicGameplayCanvasState, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayMobileEvidence, BasicGameplaySnapshot, BasicGameplayWarningCode, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayRoute, extractBasicGameplayEvidence } from './basic-gameplay.js';
12
13
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobResult, RiddlePreviewDeployResult, RiddleRunScriptInput, createRiddleApiClient, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript } from './riddle-client.js';
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ runRiddleProof
3
+ } from "./chunk-RXFKKYWA.js";
1
4
  import "./chunk-6F4PWJZI.js";
2
5
  import {
3
6
  RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
@@ -16,8 +19,12 @@ import {
16
19
  visualSessionFingerprintBasis
17
20
  } from "./chunk-ODORKNSO.js";
18
21
  import {
19
- runRiddleProof
20
- } from "./chunk-RXFKKYWA.js";
22
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
23
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
24
+ assessBasicGameplayEvidence,
25
+ assessBasicGameplayRoute,
26
+ extractBasicGameplayEvidence
27
+ } from "./chunk-RNGJX62B.js";
21
28
  import {
22
29
  DEFAULT_RIDDLE_API_BASE_URL,
23
30
  DEFAULT_RIDDLE_API_KEY_FILE,
@@ -45,14 +52,7 @@ import {
45
52
  createDisabledRiddleProofAgentAdapter,
46
53
  readRiddleProofRunStatus,
47
54
  runRiddleProofEngineHarness
48
- } from "./chunk-A2AWRZ5B.js";
49
- import "./chunk-RFJ5BQF6.js";
50
- import "./chunk-JFQXAJH2.js";
51
- import {
52
- createCodexExecAgentAdapter,
53
- createCodexExecJsonRunner,
54
- runCodexExecAgentDoctor
55
- } from "./chunk-3266V3MO.js";
55
+ } from "./chunk-2FBF2UDZ.js";
56
56
  import {
57
57
  RIDDLE_PROOF_RUN_STATE_VERSION,
58
58
  appendRunEvent,
@@ -65,6 +65,7 @@ import {
65
65
  normalizeRunParams,
66
66
  setRunStatus
67
67
  } from "./chunk-MO24D3PY.js";
68
+ import "./chunk-RFJ5BQF6.js";
68
69
  import {
69
70
  RIDDLE_PROOF_RUN_CARD_VERSION,
70
71
  createRiddleProofRunCard
@@ -85,6 +86,12 @@ import {
85
86
  proofContractFromAuthorCheckpointResponse,
86
87
  statePathsForRunState
87
88
  } from "./chunk-33XO42CY.js";
89
+ import "./chunk-JFQXAJH2.js";
90
+ import {
91
+ createCodexExecAgentAdapter,
92
+ createCodexExecJsonRunner,
93
+ runCodexExecAgentDoctor
94
+ } from "./chunk-3266V3MO.js";
88
95
  import {
89
96
  applyTerminalMetadata,
90
97
  compactRecord,
@@ -101,6 +108,8 @@ export {
101
108
  DEFAULT_DIAGNOSTIC_STRING_LIMIT,
102
109
  DEFAULT_RIDDLE_API_BASE_URL,
103
110
  DEFAULT_RIDDLE_API_KEY_FILE,
111
+ RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
112
+ RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
104
113
  RIDDLE_PROOF_CAPTURE_DIAGNOSTIC_VERSION,
105
114
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
106
115
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -116,6 +125,8 @@ export {
116
125
  appendStageHeartbeat,
117
126
  applyPrLifecycleState,
118
127
  applyTerminalMetadata,
128
+ assessBasicGameplayEvidence,
129
+ assessBasicGameplayRoute,
119
130
  assessPlayabilityEvidence,
120
131
  authorPacketPayloadFromCheckpointResponse,
121
132
  buildAuthorCheckpointPacket,
@@ -140,6 +151,7 @@ export {
140
151
  createRunState,
141
152
  createRunStatusSnapshot,
142
153
  deployRiddleStaticPreview,
154
+ extractBasicGameplayEvidence,
143
155
  extractPlayabilityEvidence,
144
156
  isDuplicateCheckpointResponse,
145
157
  isRiddleProofPlayabilityMode,
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
277
277
  blocking?: boolean;
278
278
  details?: Record<string, unknown>;
279
279
  ok: boolean;
280
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
280
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
281
281
  state_path: string;
282
282
  stage: any;
283
283
  summary: string;
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
362
362
  continueWithStage?: WorkflowStage | null;
363
363
  blocking?: boolean;
364
364
  details?: Record<string, unknown>;
365
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
365
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
366
366
  state_path: string;
367
367
  stage: any;
368
368
  checkpoint: string;
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
624
624
  error?: undefined;
625
625
  } | {
626
626
  ok: boolean;
627
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
627
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
628
628
  state_path: string;
629
629
  stage: any;
630
630
  summary: string;
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
277
277
  blocking?: boolean;
278
278
  details?: Record<string, unknown>;
279
279
  ok: boolean;
280
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
280
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
281
281
  state_path: string;
282
282
  stage: any;
283
283
  summary: string;
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
362
362
  continueWithStage?: WorkflowStage | null;
363
363
  blocking?: boolean;
364
364
  details?: Record<string, unknown>;
365
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
365
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
366
366
  state_path: string;
367
367
  stage: any;
368
368
  checkpoint: string;
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
624
624
  error?: undefined;
625
625
  } | {
626
626
  ok: boolean;
627
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
627
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
628
628
  state_path: string;
629
629
  stage: any;
630
630
  summary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.5.54",
3
+ "version": "0.5.55",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -79,6 +79,11 @@
79
79
  "import": "./dist/playability.js",
80
80
  "require": "./dist/playability.cjs"
81
81
  },
82
+ "./basic-gameplay": {
83
+ "types": "./dist/basic-gameplay.d.ts",
84
+ "import": "./dist/basic-gameplay.js",
85
+ "require": "./dist/basic-gameplay.cjs"
86
+ },
82
87
  "./openclaw": {
83
88
  "types": "./dist/openclaw.d.ts",
84
89
  "import": "./dist/openclaw.js",
@@ -120,7 +125,7 @@
120
125
  "typescript": "^5.4.5"
121
126
  },
122
127
  "scripts": {
123
- "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/checkpoint.ts src/run-card.ts src/runner.ts src/engine-harness.ts src/codex-exec-agent.ts src/local-agent.ts src/cli.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts --format cjs,esm --dts --out-dir dist --clean",
128
+ "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/checkpoint.ts src/run-card.ts src/runner.ts src/engine-harness.ts src/codex-exec-agent.ts src/local-agent.ts src/cli.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/basic-gameplay.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts --format cjs,esm --dts --out-dir dist --clean",
124
129
  "clean": "rm -rf dist",
125
130
  "lint": "echo 'lint: (not configured)'",
126
131
  "test": "npm run build && node test.js && node proof-run.test.js"
@@ -1,8 +1,3 @@
1
- import {
2
- visualDeltaForState,
3
- visualDeltaRequiredForState,
4
- visualDeltaShipGateReason
5
- } from "./chunk-RFJ5BQF6.js";
6
1
  import {
7
2
  appendRunEvent,
8
3
  appendStageHeartbeat,
@@ -11,6 +6,11 @@ import {
11
6
  normalizeRunParams,
12
7
  setRunStatus
13
8
  } from "./chunk-MO24D3PY.js";
9
+ import {
10
+ visualDeltaForState,
11
+ visualDeltaRequiredForState,
12
+ visualDeltaShipGateReason
13
+ } from "./chunk-RFJ5BQF6.js";
14
14
  import {
15
15
  createRiddleProofRunCard
16
16
  } from "./chunk-3UHWI3FO.js";