@riddledc/riddle-proof 0.8.37 → 0.8.39
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 +21 -0
- package/dist/chunk-6KYXX4OE.js +209 -0
- package/dist/{chunk-F4HKK2YH.js → chunk-MVJBPCZ4.js} +137 -5
- package/dist/cli/index.js +3 -2
- package/dist/cli.cjs +331 -0
- package/dist/cli.js +3 -2
- package/dist/index.cjs +210 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -18
- package/dist/pr-comment.cjs +235 -0
- package/dist/pr-comment.d.cts +41 -0
- package/dist/pr-comment.d.ts +41 -0
- package/dist/pr-comment.js +11 -0
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
|
|
|
12
12
|
export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
|
|
13
13
|
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
|
|
14
14
|
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployProgressSnapshot, RiddlePreviewDeployResult, RiddlePreviewDeployStage, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
|
|
15
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.js';
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,29 @@ import {
|
|
|
37
37
|
resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
|
|
38
38
|
sanitizeBasicGameplayJsonString
|
|
39
39
|
} from "./chunk-ELZSPOWV.js";
|
|
40
|
+
import {
|
|
41
|
+
DEFAULT_RIDDLE_API_BASE_URL,
|
|
42
|
+
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
43
|
+
RiddleApiError,
|
|
44
|
+
collectRiddlePreviewDeployWarnings,
|
|
45
|
+
createRiddleApiClient,
|
|
46
|
+
deployRiddlePreview,
|
|
47
|
+
deployRiddleStaticPreview,
|
|
48
|
+
getRiddleBalance,
|
|
49
|
+
isTerminalRiddleJobStatus,
|
|
50
|
+
parseRiddleViewport,
|
|
51
|
+
pollRiddleJob,
|
|
52
|
+
resolveRiddleApiKey,
|
|
53
|
+
resolveRiddleApiKeySource,
|
|
54
|
+
riddleRequestJson,
|
|
55
|
+
runRiddleScript,
|
|
56
|
+
runRiddleServerPreview
|
|
57
|
+
} from "./chunk-DI2XNGEZ.js";
|
|
58
|
+
import {
|
|
59
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
60
|
+
buildRiddleProofPrCommentMarkdown,
|
|
61
|
+
summarizeRiddleProofPrComment
|
|
62
|
+
} from "./chunk-6KYXX4OE.js";
|
|
40
63
|
import {
|
|
41
64
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
42
65
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -63,24 +86,6 @@ import {
|
|
|
63
86
|
slugifyRiddleProofProfileName,
|
|
64
87
|
summarizeRiddleProofProfileResult
|
|
65
88
|
} from "./chunk-Z2LCVROU.js";
|
|
66
|
-
import {
|
|
67
|
-
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
|
-
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
69
|
-
RiddleApiError,
|
|
70
|
-
collectRiddlePreviewDeployWarnings,
|
|
71
|
-
createRiddleApiClient,
|
|
72
|
-
deployRiddlePreview,
|
|
73
|
-
deployRiddleStaticPreview,
|
|
74
|
-
getRiddleBalance,
|
|
75
|
-
isTerminalRiddleJobStatus,
|
|
76
|
-
parseRiddleViewport,
|
|
77
|
-
pollRiddleJob,
|
|
78
|
-
resolveRiddleApiKey,
|
|
79
|
-
resolveRiddleApiKeySource,
|
|
80
|
-
riddleRequestJson,
|
|
81
|
-
runRiddleScript,
|
|
82
|
-
runRiddleServerPreview
|
|
83
|
-
} from "./chunk-DI2XNGEZ.js";
|
|
84
89
|
import {
|
|
85
90
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
86
91
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
|
@@ -169,6 +174,7 @@ export {
|
|
|
169
174
|
RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
|
|
170
175
|
RIDDLE_PROOF_PROFILE_STATUSES,
|
|
171
176
|
RIDDLE_PROOF_PROFILE_VERSION,
|
|
177
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
172
178
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
173
179
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
174
180
|
RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
|
|
@@ -191,6 +197,7 @@ export {
|
|
|
191
197
|
buildAuthorCheckpointPacket,
|
|
192
198
|
buildCheckpointPacketForEngineResult,
|
|
193
199
|
buildProofAssessmentCheckpointPacket,
|
|
200
|
+
buildRiddleProofPrCommentMarkdown,
|
|
194
201
|
buildRiddleProofProfileScript,
|
|
195
202
|
buildStageCheckpointPacket,
|
|
196
203
|
buildVisualProofSession,
|
|
@@ -265,6 +272,7 @@ export {
|
|
|
265
272
|
slugifyRiddleProofProfileName,
|
|
266
273
|
statePathsForRunState,
|
|
267
274
|
summarizeCaptureArtifacts,
|
|
275
|
+
summarizeRiddleProofPrComment,
|
|
268
276
|
summarizeRiddleProofProfileResult,
|
|
269
277
|
visualSessionFingerprint,
|
|
270
278
|
visualSessionFingerprintBasis
|
|
@@ -0,0 +1,235 @@
|
|
|
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/pr-comment.ts
|
|
21
|
+
var pr_comment_exports = {};
|
|
22
|
+
__export(pr_comment_exports, {
|
|
23
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER: () => RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
24
|
+
buildRiddleProofPrCommentMarkdown: () => buildRiddleProofPrCommentMarkdown,
|
|
25
|
+
summarizeRiddleProofPrComment: () => summarizeRiddleProofPrComment
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(pr_comment_exports);
|
|
28
|
+
var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
|
|
29
|
+
function asRecord(value) {
|
|
30
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
31
|
+
}
|
|
32
|
+
function asArray(value) {
|
|
33
|
+
return Array.isArray(value) ? value : [];
|
|
34
|
+
}
|
|
35
|
+
function stringValue(value) {
|
|
36
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
37
|
+
}
|
|
38
|
+
function numberValue(value) {
|
|
39
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
40
|
+
}
|
|
41
|
+
function booleanValue(value) {
|
|
42
|
+
return typeof value === "boolean" ? value : void 0;
|
|
43
|
+
}
|
|
44
|
+
function artifactKind(name, url) {
|
|
45
|
+
const target = `${name} ${url}`.toLowerCase();
|
|
46
|
+
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
47
|
+
if (/\.(json|har|txt|md|html|log)(\?|#|$)/.test(target)) return "data";
|
|
48
|
+
return "artifact";
|
|
49
|
+
}
|
|
50
|
+
function artifactDisplayName(value, fallback) {
|
|
51
|
+
const raw = stringValue(value);
|
|
52
|
+
if (raw) return raw;
|
|
53
|
+
return fallback;
|
|
54
|
+
}
|
|
55
|
+
function collectArtifacts(runResponse) {
|
|
56
|
+
const proofResult = asRecord(runResponse.proofResult);
|
|
57
|
+
const outputs = asArray(proofResult.outputs);
|
|
58
|
+
const artifacts = [];
|
|
59
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const [index, item] of outputs.entries()) {
|
|
61
|
+
const artifact = asRecord(item);
|
|
62
|
+
const url = stringValue(artifact.url);
|
|
63
|
+
if (!url || seen.has(url)) continue;
|
|
64
|
+
seen.add(url);
|
|
65
|
+
const name = artifactDisplayName(artifact.name, `artifact-${index + 1}`);
|
|
66
|
+
artifacts.push({
|
|
67
|
+
name,
|
|
68
|
+
url,
|
|
69
|
+
kind: artifactKind(name, url),
|
|
70
|
+
size_bytes: numberValue(artifact.size)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return artifacts;
|
|
74
|
+
}
|
|
75
|
+
function pageSummaries(result) {
|
|
76
|
+
const pages = [];
|
|
77
|
+
for (const page of asArray(result.pages)) {
|
|
78
|
+
const record = asRecord(page);
|
|
79
|
+
const route = stringValue(record.route) || stringValue(record.url) || "page";
|
|
80
|
+
const checks = asRecord(record.checks);
|
|
81
|
+
let passed = 0;
|
|
82
|
+
let failed = 0;
|
|
83
|
+
for (const value of Object.values(checks)) {
|
|
84
|
+
if (value === true) passed += 1;
|
|
85
|
+
if (value === false) failed += 1;
|
|
86
|
+
}
|
|
87
|
+
pages.push({ route, passed, failed });
|
|
88
|
+
}
|
|
89
|
+
return pages;
|
|
90
|
+
}
|
|
91
|
+
function summarizeExplicitChecks(value) {
|
|
92
|
+
let passed = 0;
|
|
93
|
+
let failed = 0;
|
|
94
|
+
const visit = (current, inChecks = false) => {
|
|
95
|
+
if (current === true && inChecks) {
|
|
96
|
+
passed += 1;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (current === false && inChecks) {
|
|
100
|
+
failed += 1;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (Array.isArray(current)) {
|
|
104
|
+
for (const item of current) visit(item, inChecks);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (current && typeof current === "object") {
|
|
108
|
+
for (const [key, item] of Object.entries(current)) {
|
|
109
|
+
visit(item, inChecks || key === "checks");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
visit(value);
|
|
114
|
+
return { passed, failed };
|
|
115
|
+
}
|
|
116
|
+
function selectPrimaryImage(artifacts) {
|
|
117
|
+
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
118
|
+
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
119
|
+
}
|
|
120
|
+
function summarizeRiddleProofPrComment(input) {
|
|
121
|
+
const runResponse = asRecord(input.runResponse);
|
|
122
|
+
const result = asRecord(input.result);
|
|
123
|
+
const proofResult = asRecord(runResponse.proofResult);
|
|
124
|
+
const preview = asRecord(runResponse.preview);
|
|
125
|
+
const artifacts = collectArtifacts(runResponse);
|
|
126
|
+
const pages = pageSummaries(result);
|
|
127
|
+
const checkSource = { ...result };
|
|
128
|
+
delete checkSource.ok;
|
|
129
|
+
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
130
|
+
const ok = booleanValue(result.ok) ?? booleanValue(runResponse.ok) ?? null;
|
|
131
|
+
return {
|
|
132
|
+
ok,
|
|
133
|
+
status: stringValue(proofResult.status),
|
|
134
|
+
job_id: stringValue(proofResult.job_id),
|
|
135
|
+
duration_ms: numberValue(proofResult.duration_ms),
|
|
136
|
+
proof_url: stringValue(runResponse.proofUrl),
|
|
137
|
+
preview_id: stringValue(preview.id),
|
|
138
|
+
preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
|
|
139
|
+
preview_publish_recovered: booleanValue(preview.publish_recovered),
|
|
140
|
+
preview_publish_error: stringValue(preview.publish_error),
|
|
141
|
+
passed_checks: nestedChecks.passed,
|
|
142
|
+
failed_checks: nestedChecks.failed,
|
|
143
|
+
pages,
|
|
144
|
+
artifacts,
|
|
145
|
+
primary_image: selectPrimaryImage(artifacts)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function formatDuration(ms) {
|
|
149
|
+
if (typeof ms !== "number" || !Number.isFinite(ms)) return "";
|
|
150
|
+
const seconds = Math.max(0, Math.round(ms / 1e3));
|
|
151
|
+
const minutes = Math.floor(seconds / 60);
|
|
152
|
+
const remainder = seconds % 60;
|
|
153
|
+
return minutes > 0 ? `${minutes}m${String(remainder).padStart(2, "0")}s` : `${seconds}s`;
|
|
154
|
+
}
|
|
155
|
+
function markdownLink(label, url) {
|
|
156
|
+
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
157
|
+
}
|
|
158
|
+
function resultLabel(summary) {
|
|
159
|
+
if (summary.ok === true) return "passed";
|
|
160
|
+
if (summary.ok === false) return "failed";
|
|
161
|
+
return summary.status || "recorded";
|
|
162
|
+
}
|
|
163
|
+
function artifactRank(artifact) {
|
|
164
|
+
const name = artifact.name.toLowerCase();
|
|
165
|
+
if (name === "proof.json") return 0;
|
|
166
|
+
if (name === "result.json") return 1;
|
|
167
|
+
if (name.includes("proof") && name.endsWith(".json") && !name.includes("layout")) return 2;
|
|
168
|
+
if (name === "console.json") return 3;
|
|
169
|
+
if (artifact.kind === "data") return 10;
|
|
170
|
+
if (artifact.kind === "image") return 20;
|
|
171
|
+
return 30;
|
|
172
|
+
}
|
|
173
|
+
function buildRiddleProofPrCommentMarkdown(input) {
|
|
174
|
+
const summary = summarizeRiddleProofPrComment(input);
|
|
175
|
+
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
176
|
+
const lines = [
|
|
177
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
178
|
+
`## ${title}`,
|
|
179
|
+
"",
|
|
180
|
+
`**Result:** ${resultLabel(summary)}`
|
|
181
|
+
];
|
|
182
|
+
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
183
|
+
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
184
|
+
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
185
|
+
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
186
|
+
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
187
|
+
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
188
|
+
if (summary.preview_id || summary.preview_url) {
|
|
189
|
+
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
|
190
|
+
lines.push(`**Preview:** ${summary.preview_url ? markdownLink(previewLabel, summary.preview_url) : previewLabel}`);
|
|
191
|
+
}
|
|
192
|
+
if (summary.preview_publish_recovered) {
|
|
193
|
+
const detail = summary.preview_publish_error ? `: ${summary.preview_publish_error}` : "";
|
|
194
|
+
lines.push(`**Preview publish recovery:** recovered after publish error${detail}`);
|
|
195
|
+
}
|
|
196
|
+
lines.push(`**Checks:** ${summary.passed_checks} passed / ${summary.failed_checks} failed`);
|
|
197
|
+
lines.push("");
|
|
198
|
+
if (summary.primary_image) {
|
|
199
|
+
lines.push("### Screenshot");
|
|
200
|
+
lines.push(``);
|
|
201
|
+
lines.push("");
|
|
202
|
+
}
|
|
203
|
+
if (summary.pages.length) {
|
|
204
|
+
lines.push("### Page Checks");
|
|
205
|
+
for (const page of summary.pages.slice(0, 12)) {
|
|
206
|
+
lines.push(`- \`${page.route}\`: ${page.passed} passed / ${page.failed} failed`);
|
|
207
|
+
}
|
|
208
|
+
if (summary.pages.length > 12) lines.push(`- ${summary.pages.length - 12} more page(s) omitted`);
|
|
209
|
+
lines.push("");
|
|
210
|
+
}
|
|
211
|
+
const linkedArtifacts = summary.artifacts.filter((artifact) => artifact.url !== summary.primary_image?.url).sort((left, right) => artifactRank(left) - artifactRank(right) || left.name.localeCompare(right.name)).slice(0, 20);
|
|
212
|
+
if (linkedArtifacts.length) {
|
|
213
|
+
lines.push("### Artifacts");
|
|
214
|
+
for (const artifact of linkedArtifacts) {
|
|
215
|
+
lines.push(`- ${markdownLink(artifact.name, artifact.url)}`);
|
|
216
|
+
}
|
|
217
|
+
if (summary.artifacts.length - (summary.primary_image ? 1 : 0) > linkedArtifacts.length) {
|
|
218
|
+
lines.push(`- ${summary.artifacts.length - (summary.primary_image ? 1 : 0) - linkedArtifacts.length} more artifact(s) omitted`);
|
|
219
|
+
}
|
|
220
|
+
lines.push("");
|
|
221
|
+
}
|
|
222
|
+
if (input.source?.trim()) {
|
|
223
|
+
lines.push(`_Source: ${input.source.trim()}_`);
|
|
224
|
+
} else {
|
|
225
|
+
lines.push("_Updated by `riddle-proof-loop pr-comment`._");
|
|
226
|
+
}
|
|
227
|
+
return `${lines.join("\n").trim()}
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
231
|
+
0 && (module.exports = {
|
|
232
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
233
|
+
buildRiddleProofPrCommentMarkdown,
|
|
234
|
+
summarizeRiddleProofPrComment
|
|
235
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
|
|
2
|
+
type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
|
|
3
|
+
interface RiddleProofPrCommentArtifact {
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
kind: RiddleProofPrCommentArtifactKind;
|
|
7
|
+
size_bytes?: number;
|
|
8
|
+
}
|
|
9
|
+
interface RiddleProofPrCommentPageSummary {
|
|
10
|
+
route: string;
|
|
11
|
+
passed: number;
|
|
12
|
+
failed: number;
|
|
13
|
+
}
|
|
14
|
+
interface RiddleProofPrCommentSummary {
|
|
15
|
+
ok: boolean | null;
|
|
16
|
+
status?: string;
|
|
17
|
+
job_id?: string;
|
|
18
|
+
duration_ms?: number;
|
|
19
|
+
proof_url?: string;
|
|
20
|
+
preview_id?: string;
|
|
21
|
+
preview_url?: string;
|
|
22
|
+
preview_publish_recovered?: boolean;
|
|
23
|
+
preview_publish_error?: string;
|
|
24
|
+
passed_checks: number;
|
|
25
|
+
failed_checks: number;
|
|
26
|
+
pages: RiddleProofPrCommentPageSummary[];
|
|
27
|
+
artifacts: RiddleProofPrCommentArtifact[];
|
|
28
|
+
primary_image?: RiddleProofPrCommentArtifact;
|
|
29
|
+
}
|
|
30
|
+
interface RiddleProofPrCommentInput {
|
|
31
|
+
title?: string;
|
|
32
|
+
goal?: string;
|
|
33
|
+
successCriteria?: string;
|
|
34
|
+
runResponse?: unknown;
|
|
35
|
+
result?: unknown;
|
|
36
|
+
source?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
|
|
39
|
+
declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
|
|
40
|
+
|
|
41
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
|
|
2
|
+
type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
|
|
3
|
+
interface RiddleProofPrCommentArtifact {
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
kind: RiddleProofPrCommentArtifactKind;
|
|
7
|
+
size_bytes?: number;
|
|
8
|
+
}
|
|
9
|
+
interface RiddleProofPrCommentPageSummary {
|
|
10
|
+
route: string;
|
|
11
|
+
passed: number;
|
|
12
|
+
failed: number;
|
|
13
|
+
}
|
|
14
|
+
interface RiddleProofPrCommentSummary {
|
|
15
|
+
ok: boolean | null;
|
|
16
|
+
status?: string;
|
|
17
|
+
job_id?: string;
|
|
18
|
+
duration_ms?: number;
|
|
19
|
+
proof_url?: string;
|
|
20
|
+
preview_id?: string;
|
|
21
|
+
preview_url?: string;
|
|
22
|
+
preview_publish_recovered?: boolean;
|
|
23
|
+
preview_publish_error?: string;
|
|
24
|
+
passed_checks: number;
|
|
25
|
+
failed_checks: number;
|
|
26
|
+
pages: RiddleProofPrCommentPageSummary[];
|
|
27
|
+
artifacts: RiddleProofPrCommentArtifact[];
|
|
28
|
+
primary_image?: RiddleProofPrCommentArtifact;
|
|
29
|
+
}
|
|
30
|
+
interface RiddleProofPrCommentInput {
|
|
31
|
+
title?: string;
|
|
32
|
+
goal?: string;
|
|
33
|
+
successCriteria?: string;
|
|
34
|
+
runResponse?: unknown;
|
|
35
|
+
result?: unknown;
|
|
36
|
+
source?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
|
|
39
|
+
declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
|
|
40
|
+
|
|
41
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
3
|
+
buildRiddleProofPrCommentMarkdown,
|
|
4
|
+
summarizeRiddleProofPrComment
|
|
5
|
+
} from "./chunk-6KYXX4OE.js";
|
|
6
|
+
import "./chunk-MLKGABMK.js";
|
|
7
|
+
export {
|
|
8
|
+
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
9
|
+
buildRiddleProofPrCommentMarkdown,
|
|
10
|
+
summarizeRiddleProofPrComment
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riddledc/riddle-proof",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.39",
|
|
4
4
|
"description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "RiddleDC",
|
|
@@ -119,6 +119,11 @@
|
|
|
119
119
|
"import": "./dist/profile.js",
|
|
120
120
|
"require": "./dist/profile.cjs"
|
|
121
121
|
},
|
|
122
|
+
"./pr-comment": {
|
|
123
|
+
"types": "./dist/pr-comment.d.ts",
|
|
124
|
+
"import": "./dist/pr-comment.js",
|
|
125
|
+
"require": "./dist/pr-comment.cjs"
|
|
126
|
+
},
|
|
122
127
|
"./openclaw": {
|
|
123
128
|
"types": "./dist/openclaw.d.ts",
|
|
124
129
|
"import": "./dist/openclaw.js",
|
|
@@ -224,7 +229,7 @@
|
|
|
224
229
|
"typescript": "^5.4.5"
|
|
225
230
|
},
|
|
226
231
|
"scripts": {
|
|
227
|
-
"build": "npm --workspace @riddledc/riddle-proof-app-contract run build --if-present && 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/cli/index.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/basic-gameplay.ts src/profile.ts src/profile/index.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts src/runtime/riddle-client.ts src/spec/index.ts src/spec/types.ts src/spec/result.ts src/spec/state.ts src/spec/checkpoint.ts src/spec/run-card.ts src/runtime/index.ts src/app-contract/index.ts src/advanced/index.ts src/advanced/runner.ts src/advanced/engine-harness.ts src/advanced/proof-run-core.ts src/advanced/proof-run-engine.ts src/adapters/openclaw.ts src/adapters/local-agent.ts src/adapters/codex-exec-agent.ts src/adapters/codex.ts --format cjs,esm --dts --out-dir dist --clean",
|
|
232
|
+
"build": "npm --workspace @riddledc/riddle-proof-app-contract run build --if-present && 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/cli/index.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/basic-gameplay.ts src/profile.ts src/profile/index.ts src/pr-comment.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts src/runtime/riddle-client.ts src/spec/index.ts src/spec/types.ts src/spec/result.ts src/spec/state.ts src/spec/checkpoint.ts src/spec/run-card.ts src/runtime/index.ts src/app-contract/index.ts src/advanced/index.ts src/advanced/runner.ts src/advanced/engine-harness.ts src/advanced/proof-run-core.ts src/advanced/proof-run-engine.ts src/adapters/openclaw.ts src/adapters/local-agent.ts src/adapters/codex-exec-agent.ts src/adapters/codex.ts --format cjs,esm --dts --out-dir dist --clean",
|
|
228
233
|
"clean": "rm -rf dist",
|
|
229
234
|
"lint": "echo 'lint: (not configured)'",
|
|
230
235
|
"test": "npm run build && node test.js && node proof-run.test.js && node trust-boundary.test.js && node regression-packs.test.js && python3 runtime/tests/trust_boundary_regression.py && python3 runtime/tests/ship_artifact_publication.py && (python3 runtime/tests/recon_verify_smoke.py >/tmp/riddle-proof-recon-verify-smoke.json || (tail -120 /tmp/riddle-proof-recon-verify-smoke.json; exit 1))"
|