@riddledc/riddle-proof 0.8.56 → 0.8.57
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/dist/{chunk-6KYXX4OE.js → chunk-JR7GFTLS.js} +89 -2
- package/dist/{chunk-54DIEDR3.js → chunk-LUFT7AGY.js} +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli.cjs +89 -2
- package/dist/cli.js +2 -2
- package/dist/index.cjs +89 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pr-comment.cjs +89 -2
- package/dist/pr-comment.d.cts +18 -1
- package/dist/pr-comment.d.ts +18 -1
- package/dist/pr-comment.js +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,20 @@ function numberValue(value) {
|
|
|
15
15
|
function booleanValue(value) {
|
|
16
16
|
return typeof value === "boolean" ? value : void 0;
|
|
17
17
|
}
|
|
18
|
+
function firstStringValue(...values) {
|
|
19
|
+
for (const value of values) {
|
|
20
|
+
const text = stringValue(value);
|
|
21
|
+
if (text) return text;
|
|
22
|
+
}
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
function firstBooleanValue(...values) {
|
|
26
|
+
for (const value of values) {
|
|
27
|
+
const bool = booleanValue(value);
|
|
28
|
+
if (typeof bool === "boolean") return bool;
|
|
29
|
+
}
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
18
32
|
function artifactKind(name, url) {
|
|
19
33
|
const target = `${name} ${url}`.toLowerCase();
|
|
20
34
|
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
@@ -91,20 +105,55 @@ function selectPrimaryImage(artifacts) {
|
|
|
91
105
|
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
92
106
|
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
93
107
|
}
|
|
108
|
+
function firstRecordValue(...values) {
|
|
109
|
+
for (const value of values) {
|
|
110
|
+
const record = asRecord(value);
|
|
111
|
+
if (Object.keys(record).length) return record;
|
|
112
|
+
}
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
function checkpointSummaryFrom(...values) {
|
|
116
|
+
const record = firstRecordValue(...values);
|
|
117
|
+
if (!record) return void 0;
|
|
118
|
+
const summary = {
|
|
119
|
+
pending: booleanValue(record.pending),
|
|
120
|
+
response_count: numberValue(record.response_count),
|
|
121
|
+
rejected_response_count: numberValue(record.rejected_response_count),
|
|
122
|
+
ignored_response_count: numberValue(record.ignored_response_count),
|
|
123
|
+
duplicate_response_count: numberValue(record.duplicate_response_count),
|
|
124
|
+
latest_decision: stringValue(record.latest_decision),
|
|
125
|
+
latest_packet_id: stringValue(record.latest_packet_id),
|
|
126
|
+
latest_resume_token: stringValue(record.latest_resume_token)
|
|
127
|
+
};
|
|
128
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
129
|
+
}
|
|
94
130
|
function summarizeRiddleProofPrComment(input) {
|
|
95
131
|
const runResponse = asRecord(input.runResponse);
|
|
96
132
|
const result = asRecord(input.result);
|
|
97
133
|
const proofResult = asRecord(runResponse.proofResult);
|
|
98
134
|
const preview = asRecord(runResponse.preview);
|
|
135
|
+
const resultRunCard = asRecord(result.run_card);
|
|
136
|
+
const stopCondition = asRecord(resultRunCard.stop_condition);
|
|
137
|
+
const resultDetails = asRecord(result.details);
|
|
138
|
+
const resultRaw = asRecord(result.raw);
|
|
139
|
+
const rawDetails = asRecord(resultRaw.details);
|
|
99
140
|
const artifacts = collectArtifacts(runResponse);
|
|
100
141
|
const pages = pageSummaries(result);
|
|
101
142
|
const checkSource = { ...result };
|
|
102
143
|
delete checkSource.ok;
|
|
103
144
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
104
145
|
const ok = booleanValue(result.ok) ?? booleanValue(runResponse.ok) ?? null;
|
|
146
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
147
|
+
result.checkpoint_summary,
|
|
148
|
+
stopCondition.checkpoint_summary,
|
|
149
|
+
resultDetails.checkpoint_summary,
|
|
150
|
+
rawDetails.checkpoint_summary,
|
|
151
|
+
proofResult.checkpoint_summary
|
|
152
|
+
);
|
|
105
153
|
return {
|
|
106
154
|
ok,
|
|
107
155
|
status: stringValue(proofResult.status),
|
|
156
|
+
result_status: firstStringValue(result.status, stopCondition.status),
|
|
108
157
|
job_id: stringValue(proofResult.job_id),
|
|
109
158
|
duration_ms: numberValue(proofResult.duration_ms),
|
|
110
159
|
proof_url: stringValue(runResponse.proofUrl),
|
|
@@ -112,6 +161,12 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
112
161
|
preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
|
|
113
162
|
preview_publish_recovered: booleanValue(preview.publish_recovered),
|
|
114
163
|
preview_publish_error: stringValue(preview.publish_error),
|
|
164
|
+
ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
|
|
165
|
+
shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
|
|
166
|
+
ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
|
|
167
|
+
proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
168
|
+
merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
169
|
+
checkpoint_summary: checkpointSummary,
|
|
115
170
|
passed_checks: nestedChecks.passed,
|
|
116
171
|
failed_checks: nestedChecks.failed,
|
|
117
172
|
pages,
|
|
@@ -130,9 +185,15 @@ function markdownLink(label, url) {
|
|
|
130
185
|
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
131
186
|
}
|
|
132
187
|
function resultLabel(summary) {
|
|
133
|
-
if (summary.ok === true)
|
|
188
|
+
if (summary.ok === true) {
|
|
189
|
+
if (summary.result_status === "shipped") return "shipped";
|
|
190
|
+
if (summary.result_status === "completed") return "completed";
|
|
191
|
+
if (summary.ship_held === true) return "proof passed; ship held";
|
|
192
|
+
if (summary.ship_authorized === true) return "passed; ship authorized";
|
|
193
|
+
return "passed";
|
|
194
|
+
}
|
|
134
195
|
if (summary.ok === false) return "failed";
|
|
135
|
-
return summary.status || "recorded";
|
|
196
|
+
return summary.result_status || summary.status || "recorded";
|
|
136
197
|
}
|
|
137
198
|
function artifactRank(artifact) {
|
|
138
199
|
const name = artifact.name.toLowerCase();
|
|
@@ -144,6 +205,25 @@ function artifactRank(artifact) {
|
|
|
144
205
|
if (artifact.kind === "image") return 20;
|
|
145
206
|
return 30;
|
|
146
207
|
}
|
|
208
|
+
function formatBool(value) {
|
|
209
|
+
return typeof value === "boolean" ? String(value) : "unknown";
|
|
210
|
+
}
|
|
211
|
+
function hasShipControl(summary) {
|
|
212
|
+
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
213
|
+
}
|
|
214
|
+
function checkpointSummaryLine(summary) {
|
|
215
|
+
const accepted = summary.response_count ?? 0;
|
|
216
|
+
const rejected = summary.rejected_response_count ?? 0;
|
|
217
|
+
const ignored = summary.ignored_response_count ?? 0;
|
|
218
|
+
const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
|
|
219
|
+
if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
|
|
220
|
+
const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
|
|
221
|
+
return [
|
|
222
|
+
parts.join(" / "),
|
|
223
|
+
state,
|
|
224
|
+
summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
|
|
225
|
+
].filter(Boolean).join("; ");
|
|
226
|
+
}
|
|
147
227
|
function buildRiddleProofPrCommentMarkdown(input) {
|
|
148
228
|
const summary = summarizeRiddleProofPrComment(input);
|
|
149
229
|
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
@@ -155,9 +235,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
155
235
|
];
|
|
156
236
|
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
157
237
|
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
238
|
+
if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
|
|
158
239
|
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
159
240
|
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
160
241
|
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
242
|
+
if (hasShipControl(summary)) {
|
|
243
|
+
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
244
|
+
}
|
|
245
|
+
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
246
|
+
if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
247
|
+
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
161
248
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
162
249
|
if (summary.preview_id || summary.preview_url) {
|
|
163
250
|
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
8
8
|
buildRiddleProofPrCommentMarkdown,
|
|
9
9
|
summarizeRiddleProofPrComment
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JR7GFTLS.js";
|
|
11
11
|
import {
|
|
12
12
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
13
13
|
applyRiddleProofProfileArtifactCompleteness,
|
package/dist/cli/index.js
CHANGED
package/dist/cli.cjs
CHANGED
|
@@ -17738,6 +17738,20 @@ function numberValue2(value) {
|
|
|
17738
17738
|
function booleanValue2(value) {
|
|
17739
17739
|
return typeof value === "boolean" ? value : void 0;
|
|
17740
17740
|
}
|
|
17741
|
+
function firstStringValue(...values) {
|
|
17742
|
+
for (const value of values) {
|
|
17743
|
+
const text = stringValue3(value);
|
|
17744
|
+
if (text) return text;
|
|
17745
|
+
}
|
|
17746
|
+
return void 0;
|
|
17747
|
+
}
|
|
17748
|
+
function firstBooleanValue(...values) {
|
|
17749
|
+
for (const value of values) {
|
|
17750
|
+
const bool = booleanValue2(value);
|
|
17751
|
+
if (typeof bool === "boolean") return bool;
|
|
17752
|
+
}
|
|
17753
|
+
return void 0;
|
|
17754
|
+
}
|
|
17741
17755
|
function artifactKind(name, url) {
|
|
17742
17756
|
const target = `${name} ${url}`.toLowerCase();
|
|
17743
17757
|
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
@@ -17814,20 +17828,55 @@ function selectPrimaryImage(artifacts) {
|
|
|
17814
17828
|
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
17815
17829
|
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
17816
17830
|
}
|
|
17831
|
+
function firstRecordValue(...values) {
|
|
17832
|
+
for (const value of values) {
|
|
17833
|
+
const record = asRecord(value);
|
|
17834
|
+
if (Object.keys(record).length) return record;
|
|
17835
|
+
}
|
|
17836
|
+
return void 0;
|
|
17837
|
+
}
|
|
17838
|
+
function checkpointSummaryFrom(...values) {
|
|
17839
|
+
const record = firstRecordValue(...values);
|
|
17840
|
+
if (!record) return void 0;
|
|
17841
|
+
const summary = {
|
|
17842
|
+
pending: booleanValue2(record.pending),
|
|
17843
|
+
response_count: numberValue2(record.response_count),
|
|
17844
|
+
rejected_response_count: numberValue2(record.rejected_response_count),
|
|
17845
|
+
ignored_response_count: numberValue2(record.ignored_response_count),
|
|
17846
|
+
duplicate_response_count: numberValue2(record.duplicate_response_count),
|
|
17847
|
+
latest_decision: stringValue3(record.latest_decision),
|
|
17848
|
+
latest_packet_id: stringValue3(record.latest_packet_id),
|
|
17849
|
+
latest_resume_token: stringValue3(record.latest_resume_token)
|
|
17850
|
+
};
|
|
17851
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
17852
|
+
}
|
|
17817
17853
|
function summarizeRiddleProofPrComment(input) {
|
|
17818
17854
|
const runResponse = asRecord(input.runResponse);
|
|
17819
17855
|
const result = asRecord(input.result);
|
|
17820
17856
|
const proofResult = asRecord(runResponse.proofResult);
|
|
17821
17857
|
const preview = asRecord(runResponse.preview);
|
|
17858
|
+
const resultRunCard = asRecord(result.run_card);
|
|
17859
|
+
const stopCondition = asRecord(resultRunCard.stop_condition);
|
|
17860
|
+
const resultDetails = asRecord(result.details);
|
|
17861
|
+
const resultRaw = asRecord(result.raw);
|
|
17862
|
+
const rawDetails = asRecord(resultRaw.details);
|
|
17822
17863
|
const artifacts = collectArtifacts(runResponse);
|
|
17823
17864
|
const pages = pageSummaries(result);
|
|
17824
17865
|
const checkSource = { ...result };
|
|
17825
17866
|
delete checkSource.ok;
|
|
17826
17867
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
17827
17868
|
const ok = booleanValue2(result.ok) ?? booleanValue2(runResponse.ok) ?? null;
|
|
17869
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
17870
|
+
result.checkpoint_summary,
|
|
17871
|
+
stopCondition.checkpoint_summary,
|
|
17872
|
+
resultDetails.checkpoint_summary,
|
|
17873
|
+
rawDetails.checkpoint_summary,
|
|
17874
|
+
proofResult.checkpoint_summary
|
|
17875
|
+
);
|
|
17828
17876
|
return {
|
|
17829
17877
|
ok,
|
|
17830
17878
|
status: stringValue3(proofResult.status),
|
|
17879
|
+
result_status: firstStringValue(result.status, stopCondition.status),
|
|
17831
17880
|
job_id: stringValue3(proofResult.job_id),
|
|
17832
17881
|
duration_ms: numberValue2(proofResult.duration_ms),
|
|
17833
17882
|
proof_url: stringValue3(runResponse.proofUrl),
|
|
@@ -17835,6 +17884,12 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
17835
17884
|
preview_url: stringValue3(preview.preview_url) || stringValue3(preview.url),
|
|
17836
17885
|
preview_publish_recovered: booleanValue2(preview.publish_recovered),
|
|
17837
17886
|
preview_publish_error: stringValue3(preview.publish_error),
|
|
17887
|
+
ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
|
|
17888
|
+
shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
|
|
17889
|
+
ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
|
|
17890
|
+
proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
17891
|
+
merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
17892
|
+
checkpoint_summary: checkpointSummary,
|
|
17838
17893
|
passed_checks: nestedChecks.passed,
|
|
17839
17894
|
failed_checks: nestedChecks.failed,
|
|
17840
17895
|
pages,
|
|
@@ -17853,9 +17908,15 @@ function markdownLink(label, url) {
|
|
|
17853
17908
|
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
17854
17909
|
}
|
|
17855
17910
|
function resultLabel(summary) {
|
|
17856
|
-
if (summary.ok === true)
|
|
17911
|
+
if (summary.ok === true) {
|
|
17912
|
+
if (summary.result_status === "shipped") return "shipped";
|
|
17913
|
+
if (summary.result_status === "completed") return "completed";
|
|
17914
|
+
if (summary.ship_held === true) return "proof passed; ship held";
|
|
17915
|
+
if (summary.ship_authorized === true) return "passed; ship authorized";
|
|
17916
|
+
return "passed";
|
|
17917
|
+
}
|
|
17857
17918
|
if (summary.ok === false) return "failed";
|
|
17858
|
-
return summary.status || "recorded";
|
|
17919
|
+
return summary.result_status || summary.status || "recorded";
|
|
17859
17920
|
}
|
|
17860
17921
|
function artifactRank(artifact) {
|
|
17861
17922
|
const name = artifact.name.toLowerCase();
|
|
@@ -17867,6 +17928,25 @@ function artifactRank(artifact) {
|
|
|
17867
17928
|
if (artifact.kind === "image") return 20;
|
|
17868
17929
|
return 30;
|
|
17869
17930
|
}
|
|
17931
|
+
function formatBool(value) {
|
|
17932
|
+
return typeof value === "boolean" ? String(value) : "unknown";
|
|
17933
|
+
}
|
|
17934
|
+
function hasShipControl(summary) {
|
|
17935
|
+
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
17936
|
+
}
|
|
17937
|
+
function checkpointSummaryLine(summary) {
|
|
17938
|
+
const accepted = summary.response_count ?? 0;
|
|
17939
|
+
const rejected = summary.rejected_response_count ?? 0;
|
|
17940
|
+
const ignored = summary.ignored_response_count ?? 0;
|
|
17941
|
+
const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
|
|
17942
|
+
if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
|
|
17943
|
+
const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
|
|
17944
|
+
return [
|
|
17945
|
+
parts.join(" / "),
|
|
17946
|
+
state,
|
|
17947
|
+
summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
|
|
17948
|
+
].filter(Boolean).join("; ");
|
|
17949
|
+
}
|
|
17870
17950
|
function buildRiddleProofPrCommentMarkdown(input) {
|
|
17871
17951
|
const summary = summarizeRiddleProofPrComment(input);
|
|
17872
17952
|
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
@@ -17878,9 +17958,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
17878
17958
|
];
|
|
17879
17959
|
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
17880
17960
|
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
17961
|
+
if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
|
|
17881
17962
|
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
17882
17963
|
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
17883
17964
|
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
17965
|
+
if (hasShipControl(summary)) {
|
|
17966
|
+
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
17967
|
+
}
|
|
17968
|
+
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
17969
|
+
if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
17970
|
+
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
17884
17971
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
17885
17972
|
if (summary.preview_id || summary.preview_url) {
|
|
17886
17973
|
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-LUFT7AGY.js";
|
|
3
3
|
import "./chunk-DI2XNGEZ.js";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-JR7GFTLS.js";
|
|
5
5
|
import "./chunk-EX7TO4I5.js";
|
|
6
6
|
import "./chunk-GHBNDHG7.js";
|
|
7
7
|
import "./chunk-UZIX7M7D.js";
|
package/dist/index.cjs
CHANGED
|
@@ -19937,6 +19937,20 @@ function numberValue4(value) {
|
|
|
19937
19937
|
function booleanValue2(value) {
|
|
19938
19938
|
return typeof value === "boolean" ? value : void 0;
|
|
19939
19939
|
}
|
|
19940
|
+
function firstStringValue(...values) {
|
|
19941
|
+
for (const value of values) {
|
|
19942
|
+
const text = stringValue6(value);
|
|
19943
|
+
if (text) return text;
|
|
19944
|
+
}
|
|
19945
|
+
return void 0;
|
|
19946
|
+
}
|
|
19947
|
+
function firstBooleanValue(...values) {
|
|
19948
|
+
for (const value of values) {
|
|
19949
|
+
const bool = booleanValue2(value);
|
|
19950
|
+
if (typeof bool === "boolean") return bool;
|
|
19951
|
+
}
|
|
19952
|
+
return void 0;
|
|
19953
|
+
}
|
|
19940
19954
|
function artifactKind(name, url) {
|
|
19941
19955
|
const target = `${name} ${url}`.toLowerCase();
|
|
19942
19956
|
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
@@ -20013,20 +20027,55 @@ function selectPrimaryImage(artifacts) {
|
|
|
20013
20027
|
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
20014
20028
|
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
20015
20029
|
}
|
|
20030
|
+
function firstRecordValue(...values) {
|
|
20031
|
+
for (const value of values) {
|
|
20032
|
+
const record = asRecord(value);
|
|
20033
|
+
if (Object.keys(record).length) return record;
|
|
20034
|
+
}
|
|
20035
|
+
return void 0;
|
|
20036
|
+
}
|
|
20037
|
+
function checkpointSummaryFrom(...values) {
|
|
20038
|
+
const record = firstRecordValue(...values);
|
|
20039
|
+
if (!record) return void 0;
|
|
20040
|
+
const summary = {
|
|
20041
|
+
pending: booleanValue2(record.pending),
|
|
20042
|
+
response_count: numberValue4(record.response_count),
|
|
20043
|
+
rejected_response_count: numberValue4(record.rejected_response_count),
|
|
20044
|
+
ignored_response_count: numberValue4(record.ignored_response_count),
|
|
20045
|
+
duplicate_response_count: numberValue4(record.duplicate_response_count),
|
|
20046
|
+
latest_decision: stringValue6(record.latest_decision),
|
|
20047
|
+
latest_packet_id: stringValue6(record.latest_packet_id),
|
|
20048
|
+
latest_resume_token: stringValue6(record.latest_resume_token)
|
|
20049
|
+
};
|
|
20050
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
20051
|
+
}
|
|
20016
20052
|
function summarizeRiddleProofPrComment(input) {
|
|
20017
20053
|
const runResponse = asRecord(input.runResponse);
|
|
20018
20054
|
const result = asRecord(input.result);
|
|
20019
20055
|
const proofResult = asRecord(runResponse.proofResult);
|
|
20020
20056
|
const preview = asRecord(runResponse.preview);
|
|
20057
|
+
const resultRunCard = asRecord(result.run_card);
|
|
20058
|
+
const stopCondition = asRecord(resultRunCard.stop_condition);
|
|
20059
|
+
const resultDetails = asRecord(result.details);
|
|
20060
|
+
const resultRaw = asRecord(result.raw);
|
|
20061
|
+
const rawDetails = asRecord(resultRaw.details);
|
|
20021
20062
|
const artifacts = collectArtifacts(runResponse);
|
|
20022
20063
|
const pages = pageSummaries(result);
|
|
20023
20064
|
const checkSource = { ...result };
|
|
20024
20065
|
delete checkSource.ok;
|
|
20025
20066
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
20026
20067
|
const ok = booleanValue2(result.ok) ?? booleanValue2(runResponse.ok) ?? null;
|
|
20068
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
20069
|
+
result.checkpoint_summary,
|
|
20070
|
+
stopCondition.checkpoint_summary,
|
|
20071
|
+
resultDetails.checkpoint_summary,
|
|
20072
|
+
rawDetails.checkpoint_summary,
|
|
20073
|
+
proofResult.checkpoint_summary
|
|
20074
|
+
);
|
|
20027
20075
|
return {
|
|
20028
20076
|
ok,
|
|
20029
20077
|
status: stringValue6(proofResult.status),
|
|
20078
|
+
result_status: firstStringValue(result.status, stopCondition.status),
|
|
20030
20079
|
job_id: stringValue6(proofResult.job_id),
|
|
20031
20080
|
duration_ms: numberValue4(proofResult.duration_ms),
|
|
20032
20081
|
proof_url: stringValue6(runResponse.proofUrl),
|
|
@@ -20034,6 +20083,12 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
20034
20083
|
preview_url: stringValue6(preview.preview_url) || stringValue6(preview.url),
|
|
20035
20084
|
preview_publish_recovered: booleanValue2(preview.publish_recovered),
|
|
20036
20085
|
preview_publish_error: stringValue6(preview.publish_error),
|
|
20086
|
+
ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
|
|
20087
|
+
shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
|
|
20088
|
+
ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
|
|
20089
|
+
proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
20090
|
+
merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
20091
|
+
checkpoint_summary: checkpointSummary,
|
|
20037
20092
|
passed_checks: nestedChecks.passed,
|
|
20038
20093
|
failed_checks: nestedChecks.failed,
|
|
20039
20094
|
pages,
|
|
@@ -20052,9 +20107,15 @@ function markdownLink(label, url) {
|
|
|
20052
20107
|
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
20053
20108
|
}
|
|
20054
20109
|
function resultLabel(summary) {
|
|
20055
|
-
if (summary.ok === true)
|
|
20110
|
+
if (summary.ok === true) {
|
|
20111
|
+
if (summary.result_status === "shipped") return "shipped";
|
|
20112
|
+
if (summary.result_status === "completed") return "completed";
|
|
20113
|
+
if (summary.ship_held === true) return "proof passed; ship held";
|
|
20114
|
+
if (summary.ship_authorized === true) return "passed; ship authorized";
|
|
20115
|
+
return "passed";
|
|
20116
|
+
}
|
|
20056
20117
|
if (summary.ok === false) return "failed";
|
|
20057
|
-
return summary.status || "recorded";
|
|
20118
|
+
return summary.result_status || summary.status || "recorded";
|
|
20058
20119
|
}
|
|
20059
20120
|
function artifactRank(artifact) {
|
|
20060
20121
|
const name = artifact.name.toLowerCase();
|
|
@@ -20066,6 +20127,25 @@ function artifactRank(artifact) {
|
|
|
20066
20127
|
if (artifact.kind === "image") return 20;
|
|
20067
20128
|
return 30;
|
|
20068
20129
|
}
|
|
20130
|
+
function formatBool(value) {
|
|
20131
|
+
return typeof value === "boolean" ? String(value) : "unknown";
|
|
20132
|
+
}
|
|
20133
|
+
function hasShipControl(summary) {
|
|
20134
|
+
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
20135
|
+
}
|
|
20136
|
+
function checkpointSummaryLine(summary) {
|
|
20137
|
+
const accepted = summary.response_count ?? 0;
|
|
20138
|
+
const rejected = summary.rejected_response_count ?? 0;
|
|
20139
|
+
const ignored = summary.ignored_response_count ?? 0;
|
|
20140
|
+
const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
|
|
20141
|
+
if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
|
|
20142
|
+
const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
|
|
20143
|
+
return [
|
|
20144
|
+
parts.join(" / "),
|
|
20145
|
+
state,
|
|
20146
|
+
summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
|
|
20147
|
+
].filter(Boolean).join("; ");
|
|
20148
|
+
}
|
|
20069
20149
|
function buildRiddleProofPrCommentMarkdown(input) {
|
|
20070
20150
|
const summary = summarizeRiddleProofPrComment(input);
|
|
20071
20151
|
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
@@ -20077,9 +20157,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
20077
20157
|
];
|
|
20078
20158
|
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
20079
20159
|
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
20160
|
+
if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
|
|
20080
20161
|
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
20081
20162
|
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
20082
20163
|
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
20164
|
+
if (hasShipControl(summary)) {
|
|
20165
|
+
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
20166
|
+
}
|
|
20167
|
+
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
20168
|
+
if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
20169
|
+
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
20083
20170
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
20084
20171
|
if (summary.preview_id || summary.preview_url) {
|
|
20085
20172
|
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
package/dist/index.d.cts
CHANGED
|
@@ -12,4 +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.cjs';
|
|
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, RiddleProofProfileArtifactCompleteness, 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, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
|
|
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.cjs';
|
|
15
|
-
export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.cjs';
|
|
15
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentCheckpointSummary, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +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, RiddleProofProfileArtifactCompleteness, 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, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, 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';
|
|
15
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentCheckpointSummary, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.js';
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
60
60
|
buildRiddleProofPrCommentMarkdown,
|
|
61
61
|
summarizeRiddleProofPrComment
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-JR7GFTLS.js";
|
|
63
63
|
import {
|
|
64
64
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
65
65
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
package/dist/pr-comment.cjs
CHANGED
|
@@ -41,6 +41,20 @@ function numberValue(value) {
|
|
|
41
41
|
function booleanValue(value) {
|
|
42
42
|
return typeof value === "boolean" ? value : void 0;
|
|
43
43
|
}
|
|
44
|
+
function firstStringValue(...values) {
|
|
45
|
+
for (const value of values) {
|
|
46
|
+
const text = stringValue(value);
|
|
47
|
+
if (text) return text;
|
|
48
|
+
}
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
function firstBooleanValue(...values) {
|
|
52
|
+
for (const value of values) {
|
|
53
|
+
const bool = booleanValue(value);
|
|
54
|
+
if (typeof bool === "boolean") return bool;
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
44
58
|
function artifactKind(name, url) {
|
|
45
59
|
const target = `${name} ${url}`.toLowerCase();
|
|
46
60
|
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
@@ -117,20 +131,55 @@ function selectPrimaryImage(artifacts) {
|
|
|
117
131
|
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
118
132
|
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
119
133
|
}
|
|
134
|
+
function firstRecordValue(...values) {
|
|
135
|
+
for (const value of values) {
|
|
136
|
+
const record = asRecord(value);
|
|
137
|
+
if (Object.keys(record).length) return record;
|
|
138
|
+
}
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
function checkpointSummaryFrom(...values) {
|
|
142
|
+
const record = firstRecordValue(...values);
|
|
143
|
+
if (!record) return void 0;
|
|
144
|
+
const summary = {
|
|
145
|
+
pending: booleanValue(record.pending),
|
|
146
|
+
response_count: numberValue(record.response_count),
|
|
147
|
+
rejected_response_count: numberValue(record.rejected_response_count),
|
|
148
|
+
ignored_response_count: numberValue(record.ignored_response_count),
|
|
149
|
+
duplicate_response_count: numberValue(record.duplicate_response_count),
|
|
150
|
+
latest_decision: stringValue(record.latest_decision),
|
|
151
|
+
latest_packet_id: stringValue(record.latest_packet_id),
|
|
152
|
+
latest_resume_token: stringValue(record.latest_resume_token)
|
|
153
|
+
};
|
|
154
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
155
|
+
}
|
|
120
156
|
function summarizeRiddleProofPrComment(input) {
|
|
121
157
|
const runResponse = asRecord(input.runResponse);
|
|
122
158
|
const result = asRecord(input.result);
|
|
123
159
|
const proofResult = asRecord(runResponse.proofResult);
|
|
124
160
|
const preview = asRecord(runResponse.preview);
|
|
161
|
+
const resultRunCard = asRecord(result.run_card);
|
|
162
|
+
const stopCondition = asRecord(resultRunCard.stop_condition);
|
|
163
|
+
const resultDetails = asRecord(result.details);
|
|
164
|
+
const resultRaw = asRecord(result.raw);
|
|
165
|
+
const rawDetails = asRecord(resultRaw.details);
|
|
125
166
|
const artifacts = collectArtifacts(runResponse);
|
|
126
167
|
const pages = pageSummaries(result);
|
|
127
168
|
const checkSource = { ...result };
|
|
128
169
|
delete checkSource.ok;
|
|
129
170
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
130
171
|
const ok = booleanValue(result.ok) ?? booleanValue(runResponse.ok) ?? null;
|
|
172
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
173
|
+
result.checkpoint_summary,
|
|
174
|
+
stopCondition.checkpoint_summary,
|
|
175
|
+
resultDetails.checkpoint_summary,
|
|
176
|
+
rawDetails.checkpoint_summary,
|
|
177
|
+
proofResult.checkpoint_summary
|
|
178
|
+
);
|
|
131
179
|
return {
|
|
132
180
|
ok,
|
|
133
181
|
status: stringValue(proofResult.status),
|
|
182
|
+
result_status: firstStringValue(result.status, stopCondition.status),
|
|
134
183
|
job_id: stringValue(proofResult.job_id),
|
|
135
184
|
duration_ms: numberValue(proofResult.duration_ms),
|
|
136
185
|
proof_url: stringValue(runResponse.proofUrl),
|
|
@@ -138,6 +187,12 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
138
187
|
preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
|
|
139
188
|
preview_publish_recovered: booleanValue(preview.publish_recovered),
|
|
140
189
|
preview_publish_error: stringValue(preview.publish_error),
|
|
190
|
+
ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
|
|
191
|
+
shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
|
|
192
|
+
ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
|
|
193
|
+
proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
194
|
+
merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
195
|
+
checkpoint_summary: checkpointSummary,
|
|
141
196
|
passed_checks: nestedChecks.passed,
|
|
142
197
|
failed_checks: nestedChecks.failed,
|
|
143
198
|
pages,
|
|
@@ -156,9 +211,15 @@ function markdownLink(label, url) {
|
|
|
156
211
|
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
157
212
|
}
|
|
158
213
|
function resultLabel(summary) {
|
|
159
|
-
if (summary.ok === true)
|
|
214
|
+
if (summary.ok === true) {
|
|
215
|
+
if (summary.result_status === "shipped") return "shipped";
|
|
216
|
+
if (summary.result_status === "completed") return "completed";
|
|
217
|
+
if (summary.ship_held === true) return "proof passed; ship held";
|
|
218
|
+
if (summary.ship_authorized === true) return "passed; ship authorized";
|
|
219
|
+
return "passed";
|
|
220
|
+
}
|
|
160
221
|
if (summary.ok === false) return "failed";
|
|
161
|
-
return summary.status || "recorded";
|
|
222
|
+
return summary.result_status || summary.status || "recorded";
|
|
162
223
|
}
|
|
163
224
|
function artifactRank(artifact) {
|
|
164
225
|
const name = artifact.name.toLowerCase();
|
|
@@ -170,6 +231,25 @@ function artifactRank(artifact) {
|
|
|
170
231
|
if (artifact.kind === "image") return 20;
|
|
171
232
|
return 30;
|
|
172
233
|
}
|
|
234
|
+
function formatBool(value) {
|
|
235
|
+
return typeof value === "boolean" ? String(value) : "unknown";
|
|
236
|
+
}
|
|
237
|
+
function hasShipControl(summary) {
|
|
238
|
+
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
239
|
+
}
|
|
240
|
+
function checkpointSummaryLine(summary) {
|
|
241
|
+
const accepted = summary.response_count ?? 0;
|
|
242
|
+
const rejected = summary.rejected_response_count ?? 0;
|
|
243
|
+
const ignored = summary.ignored_response_count ?? 0;
|
|
244
|
+
const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
|
|
245
|
+
if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
|
|
246
|
+
const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
|
|
247
|
+
return [
|
|
248
|
+
parts.join(" / "),
|
|
249
|
+
state,
|
|
250
|
+
summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
|
|
251
|
+
].filter(Boolean).join("; ");
|
|
252
|
+
}
|
|
173
253
|
function buildRiddleProofPrCommentMarkdown(input) {
|
|
174
254
|
const summary = summarizeRiddleProofPrComment(input);
|
|
175
255
|
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
@@ -181,9 +261,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
181
261
|
];
|
|
182
262
|
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
183
263
|
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
264
|
+
if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
|
|
184
265
|
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
185
266
|
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
186
267
|
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
268
|
+
if (hasShipControl(summary)) {
|
|
269
|
+
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
270
|
+
}
|
|
271
|
+
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
272
|
+
if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
273
|
+
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
187
274
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
188
275
|
if (summary.preview_id || summary.preview_url) {
|
|
189
276
|
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
package/dist/pr-comment.d.cts
CHANGED
|
@@ -11,9 +11,20 @@ interface RiddleProofPrCommentPageSummary {
|
|
|
11
11
|
passed: number;
|
|
12
12
|
failed: number;
|
|
13
13
|
}
|
|
14
|
+
interface RiddleProofPrCommentCheckpointSummary {
|
|
15
|
+
pending?: boolean;
|
|
16
|
+
response_count?: number;
|
|
17
|
+
rejected_response_count?: number;
|
|
18
|
+
ignored_response_count?: number;
|
|
19
|
+
duplicate_response_count?: number;
|
|
20
|
+
latest_decision?: string;
|
|
21
|
+
latest_packet_id?: string;
|
|
22
|
+
latest_resume_token?: string;
|
|
23
|
+
}
|
|
14
24
|
interface RiddleProofPrCommentSummary {
|
|
15
25
|
ok: boolean | null;
|
|
16
26
|
status?: string;
|
|
27
|
+
result_status?: string;
|
|
17
28
|
job_id?: string;
|
|
18
29
|
duration_ms?: number;
|
|
19
30
|
proof_url?: string;
|
|
@@ -21,6 +32,12 @@ interface RiddleProofPrCommentSummary {
|
|
|
21
32
|
preview_url?: string;
|
|
22
33
|
preview_publish_recovered?: boolean;
|
|
23
34
|
preview_publish_error?: string;
|
|
35
|
+
ship_held?: boolean;
|
|
36
|
+
shipping_disabled?: boolean;
|
|
37
|
+
ship_authorized?: boolean;
|
|
38
|
+
proof_decision?: string;
|
|
39
|
+
merge_recommendation?: string;
|
|
40
|
+
checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
|
|
24
41
|
passed_checks: number;
|
|
25
42
|
failed_checks: number;
|
|
26
43
|
pages: RiddleProofPrCommentPageSummary[];
|
|
@@ -38,4 +55,4 @@ interface RiddleProofPrCommentInput {
|
|
|
38
55
|
declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
|
|
39
56
|
declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
|
|
40
57
|
|
|
41
|
-
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
|
58
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
package/dist/pr-comment.d.ts
CHANGED
|
@@ -11,9 +11,20 @@ interface RiddleProofPrCommentPageSummary {
|
|
|
11
11
|
passed: number;
|
|
12
12
|
failed: number;
|
|
13
13
|
}
|
|
14
|
+
interface RiddleProofPrCommentCheckpointSummary {
|
|
15
|
+
pending?: boolean;
|
|
16
|
+
response_count?: number;
|
|
17
|
+
rejected_response_count?: number;
|
|
18
|
+
ignored_response_count?: number;
|
|
19
|
+
duplicate_response_count?: number;
|
|
20
|
+
latest_decision?: string;
|
|
21
|
+
latest_packet_id?: string;
|
|
22
|
+
latest_resume_token?: string;
|
|
23
|
+
}
|
|
14
24
|
interface RiddleProofPrCommentSummary {
|
|
15
25
|
ok: boolean | null;
|
|
16
26
|
status?: string;
|
|
27
|
+
result_status?: string;
|
|
17
28
|
job_id?: string;
|
|
18
29
|
duration_ms?: number;
|
|
19
30
|
proof_url?: string;
|
|
@@ -21,6 +32,12 @@ interface RiddleProofPrCommentSummary {
|
|
|
21
32
|
preview_url?: string;
|
|
22
33
|
preview_publish_recovered?: boolean;
|
|
23
34
|
preview_publish_error?: string;
|
|
35
|
+
ship_held?: boolean;
|
|
36
|
+
shipping_disabled?: boolean;
|
|
37
|
+
ship_authorized?: boolean;
|
|
38
|
+
proof_decision?: string;
|
|
39
|
+
merge_recommendation?: string;
|
|
40
|
+
checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
|
|
24
41
|
passed_checks: number;
|
|
25
42
|
failed_checks: number;
|
|
26
43
|
pages: RiddleProofPrCommentPageSummary[];
|
|
@@ -38,4 +55,4 @@ interface RiddleProofPrCommentInput {
|
|
|
38
55
|
declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
|
|
39
56
|
declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
|
|
40
57
|
|
|
41
|
-
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
|
58
|
+
export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
|
package/dist/pr-comment.js
CHANGED