@riddledc/riddle-proof 0.8.77 → 0.8.79
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 +65 -3
- package/dist/change-proof.cjs +744 -85
- package/dist/change-proof.d.cts +100 -8
- package/dist/change-proof.d.ts +100 -8
- package/dist/change-proof.js +15 -1
- package/dist/{chunk-B2DP2LET.js → chunk-5IFZSUPF.js} +52 -13
- package/dist/chunk-6VFS2JFR.js +886 -0
- package/dist/{chunk-IY4W6STC.js → chunk-7N6X54WG.js} +116 -17
- package/dist/{chunk-GG2D3MFZ.js → chunk-FCSJZBC5.js} +26 -1
- package/dist/chunk-MEVVL4TI.js +258 -0
- package/dist/{chunk-H25IDX76.js → chunk-NEXWITV4.js} +221 -35
- package/dist/{chunk-UE4I7RTI.js → chunk-RQPCKRKT.js} +1 -1
- package/dist/cli/index.js +7 -6
- package/dist/cli.cjs +2026 -1060
- package/dist/cli.js +7 -6
- package/dist/index.cjs +932 -122
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +42 -14
- package/dist/pr-comment.cjs +416 -17
- package/dist/pr-comment.d.cts +6 -1
- package/dist/pr-comment.d.ts +6 -1
- package/dist/pr-comment.js +6 -1
- package/dist/profile/index.cjs +26 -1
- package/dist/profile/index.js +1 -1
- package/dist/profile-suggestions.js +2 -2
- package/dist/profile.cjs +26 -1
- package/dist/profile.d.cts +7 -0
- package/dist/profile.d.ts +7 -0
- package/dist/profile.js +1 -1
- package/dist/receipts.cjs +286 -0
- package/dist/receipts.d.cts +115 -0
- package/dist/receipts.d.ts +115 -0
- package/dist/receipts.js +15 -0
- package/dist/riddle-client.cjs +98 -13
- package/dist/riddle-client.d.cts +18 -5
- package/dist/riddle-client.d.ts +18 -5
- package/dist/riddle-client.js +4 -1
- package/dist/runtime/index.cjs +98 -13
- package/dist/runtime/index.d.cts +5 -1
- package/dist/runtime/index.d.ts +5 -1
- package/dist/runtime/index.js +4 -1
- package/dist/runtime/riddle-client.cjs +98 -13
- package/dist/runtime/riddle-client.d.cts +5 -1
- package/dist/runtime/riddle-client.d.ts +5 -1
- package/dist/runtime/riddle-client.js +4 -1
- package/package.json +7 -2
- package/dist/chunk-BILL3UC2.js +0 -488
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { RiddleProofProfileResult } from './profile.js';
|
|
2
|
+
import { JsonValue } from './types.js';
|
|
3
|
+
import './public-state.js';
|
|
4
|
+
|
|
5
|
+
declare const RIDDLE_PREVIEW_RECEIPT_VERSION: "riddle.preview-receipt.v1";
|
|
6
|
+
declare const RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION: "riddle-proof.observation-receipt.v1";
|
|
7
|
+
type RiddleProofComparisonRole = "before" | "after" | "standalone";
|
|
8
|
+
interface RiddleProofSourceIdentity {
|
|
9
|
+
git_revision?: string;
|
|
10
|
+
repository?: string;
|
|
11
|
+
dirty?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
interface RiddlePreviewReceipt {
|
|
15
|
+
version: typeof RIDDLE_PREVIEW_RECEIPT_VERSION;
|
|
16
|
+
preview_id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
expires_at: string;
|
|
19
|
+
content_digest: string;
|
|
20
|
+
source: RiddleProofSourceIdentity;
|
|
21
|
+
published_at: string;
|
|
22
|
+
}
|
|
23
|
+
type RiddleProofObservationExecutorKind = "local_playwright" | "riddle_hosted" | "browser_api" | "other";
|
|
24
|
+
interface RiddleProofObservationExecutor {
|
|
25
|
+
kind: RiddleProofObservationExecutorKind;
|
|
26
|
+
runner?: string;
|
|
27
|
+
job_id?: string;
|
|
28
|
+
worker_id?: string;
|
|
29
|
+
}
|
|
30
|
+
interface RiddleProofExecutionPhase {
|
|
31
|
+
phase: string;
|
|
32
|
+
at: string;
|
|
33
|
+
}
|
|
34
|
+
interface RiddleProofExecutionTelemetry {
|
|
35
|
+
enqueued_at?: string;
|
|
36
|
+
wake_requested_at?: string;
|
|
37
|
+
claimed_at?: string;
|
|
38
|
+
browser_started_at?: string;
|
|
39
|
+
artifacts_ready_at?: string;
|
|
40
|
+
completed_at?: string;
|
|
41
|
+
worker_id?: string;
|
|
42
|
+
cold_start?: boolean;
|
|
43
|
+
phases?: RiddleProofExecutionPhase[];
|
|
44
|
+
metadata?: Record<string, JsonValue>;
|
|
45
|
+
}
|
|
46
|
+
interface RiddleProofObservationTarget {
|
|
47
|
+
kind: "url" | "preview";
|
|
48
|
+
url: string;
|
|
49
|
+
preview?: RiddlePreviewReceipt;
|
|
50
|
+
}
|
|
51
|
+
type RiddleProofObservationArtifactRole = "canonical_screenshot" | "setup_screenshot" | "data" | "diagnostic" | "artifact";
|
|
52
|
+
interface RiddleProofObservationArtifact {
|
|
53
|
+
name: string;
|
|
54
|
+
role: RiddleProofObservationArtifactRole;
|
|
55
|
+
url?: string;
|
|
56
|
+
path?: string;
|
|
57
|
+
kind?: string;
|
|
58
|
+
content_type?: string;
|
|
59
|
+
source?: string;
|
|
60
|
+
}
|
|
61
|
+
interface RiddleProofObservationPublication {
|
|
62
|
+
kind: "local" | "riddle_cdn" | "github" | "other";
|
|
63
|
+
url?: string;
|
|
64
|
+
path?: string;
|
|
65
|
+
}
|
|
66
|
+
interface RiddleProofObservationReceipt {
|
|
67
|
+
version: typeof RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION;
|
|
68
|
+
observation_id: string;
|
|
69
|
+
comparison_role: RiddleProofComparisonRole;
|
|
70
|
+
executor: RiddleProofObservationExecutor;
|
|
71
|
+
target: RiddleProofObservationTarget;
|
|
72
|
+
source: RiddleProofSourceIdentity;
|
|
73
|
+
captured_at: string;
|
|
74
|
+
artifacts: RiddleProofObservationArtifact[];
|
|
75
|
+
canonical_screenshot?: RiddleProofObservationArtifact;
|
|
76
|
+
profile_summary?: {
|
|
77
|
+
profile_name: string;
|
|
78
|
+
status: string;
|
|
79
|
+
summary: string;
|
|
80
|
+
route?: JsonValue;
|
|
81
|
+
checks: {
|
|
82
|
+
total: number;
|
|
83
|
+
passed: number;
|
|
84
|
+
failed: number;
|
|
85
|
+
skipped: number;
|
|
86
|
+
needs_human_review: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
proof?: {
|
|
90
|
+
profile_name: string;
|
|
91
|
+
result: RiddleProofProfileResult;
|
|
92
|
+
};
|
|
93
|
+
publication?: RiddleProofObservationPublication;
|
|
94
|
+
execution?: RiddleProofExecutionTelemetry;
|
|
95
|
+
metadata?: Record<string, JsonValue>;
|
|
96
|
+
}
|
|
97
|
+
interface CreateRiddleProofObservationReceiptInput {
|
|
98
|
+
observation_id?: string;
|
|
99
|
+
comparison_role: RiddleProofComparisonRole;
|
|
100
|
+
executor: RiddleProofObservationExecutor;
|
|
101
|
+
target: RiddleProofObservationTarget;
|
|
102
|
+
source?: RiddleProofSourceIdentity;
|
|
103
|
+
profile_result?: RiddleProofProfileResult;
|
|
104
|
+
artifacts?: RiddleProofObservationArtifact[];
|
|
105
|
+
canonical_screenshot?: RiddleProofObservationArtifact;
|
|
106
|
+
publication?: RiddleProofObservationPublication;
|
|
107
|
+
execution?: RiddleProofExecutionTelemetry;
|
|
108
|
+
captured_at?: string;
|
|
109
|
+
metadata?: Record<string, JsonValue>;
|
|
110
|
+
}
|
|
111
|
+
declare function parseRiddlePreviewReceipt(value: unknown): RiddlePreviewReceipt;
|
|
112
|
+
declare function createRiddleProofObservationReceipt(input: CreateRiddleProofObservationReceiptInput): RiddleProofObservationReceipt;
|
|
113
|
+
declare function parseRiddleProofObservationReceipt(value: unknown): RiddleProofObservationReceipt;
|
|
114
|
+
|
|
115
|
+
export { type CreateRiddleProofObservationReceiptInput, RIDDLE_PREVIEW_RECEIPT_VERSION, RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION, type RiddlePreviewReceipt, type RiddleProofComparisonRole, type RiddleProofExecutionPhase, type RiddleProofExecutionTelemetry, type RiddleProofObservationArtifact, type RiddleProofObservationArtifactRole, type RiddleProofObservationExecutor, type RiddleProofObservationExecutorKind, type RiddleProofObservationPublication, type RiddleProofObservationReceipt, type RiddleProofObservationTarget, type RiddleProofSourceIdentity, createRiddleProofObservationReceipt, parseRiddlePreviewReceipt, parseRiddleProofObservationReceipt };
|
package/dist/receipts.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RIDDLE_PREVIEW_RECEIPT_VERSION,
|
|
3
|
+
RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
|
|
4
|
+
createRiddleProofObservationReceipt,
|
|
5
|
+
parseRiddlePreviewReceipt,
|
|
6
|
+
parseRiddleProofObservationReceipt
|
|
7
|
+
} from "./chunk-MEVVL4TI.js";
|
|
8
|
+
import "./chunk-MLKGABMK.js";
|
|
9
|
+
export {
|
|
10
|
+
RIDDLE_PREVIEW_RECEIPT_VERSION,
|
|
11
|
+
RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
|
|
12
|
+
createRiddleProofObservationReceipt,
|
|
13
|
+
parseRiddlePreviewReceipt,
|
|
14
|
+
parseRiddleProofObservationReceipt
|
|
15
|
+
};
|
package/dist/riddle-client.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(riddle_client_exports, {
|
|
|
38
38
|
createRiddleApiClient: () => createRiddleApiClient,
|
|
39
39
|
deployRiddlePreview: () => deployRiddlePreview,
|
|
40
40
|
deployRiddleStaticPreview: () => deployRiddleStaticPreview,
|
|
41
|
+
detectRiddlePreviewSource: () => detectRiddlePreviewSource,
|
|
41
42
|
getRiddleBalance: () => getRiddleBalance,
|
|
42
43
|
isTerminalRiddleJobStatus: () => isTerminalRiddleJobStatus,
|
|
43
44
|
parseRiddleViewport: () => parseRiddleViewport,
|
|
@@ -53,6 +54,55 @@ var import_node_child_process = require("child_process");
|
|
|
53
54
|
var import_node_fs = require("fs");
|
|
54
55
|
var import_node_os = require("os");
|
|
55
56
|
var import_node_path = __toESM(require("path"), 1);
|
|
57
|
+
|
|
58
|
+
// src/receipts.ts
|
|
59
|
+
var RIDDLE_PREVIEW_RECEIPT_VERSION = "riddle.preview-receipt.v1";
|
|
60
|
+
function isRecord(value) {
|
|
61
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
62
|
+
}
|
|
63
|
+
function requiredString(record, key, context) {
|
|
64
|
+
const value = record[key];
|
|
65
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
66
|
+
throw new Error(`${context}.${key} must be a non-empty string.`);
|
|
67
|
+
}
|
|
68
|
+
return value.trim();
|
|
69
|
+
}
|
|
70
|
+
function normalizedSourceIdentity(value) {
|
|
71
|
+
if (!isRecord(value)) return {};
|
|
72
|
+
return {
|
|
73
|
+
git_revision: typeof value.git_revision === "string" && value.git_revision.trim() ? value.git_revision.trim() : void 0,
|
|
74
|
+
repository: typeof value.repository === "string" && value.repository.trim() ? value.repository.trim() : void 0,
|
|
75
|
+
dirty: typeof value.dirty === "boolean" ? value.dirty : void 0,
|
|
76
|
+
label: typeof value.label === "string" && value.label.trim() ? value.label.trim() : void 0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function parseRiddlePreviewReceipt(value) {
|
|
80
|
+
if (!isRecord(value)) throw new Error("Preview receipt must be an object.");
|
|
81
|
+
if (value.version !== RIDDLE_PREVIEW_RECEIPT_VERSION) {
|
|
82
|
+
throw new Error(`Unsupported Preview receipt version ${String(value.version || "missing")}.`);
|
|
83
|
+
}
|
|
84
|
+
if (!isRecord(value.source)) throw new Error("Preview receipt source must be an object.");
|
|
85
|
+
const expiresAt = requiredString(value, "expires_at", "preview receipt");
|
|
86
|
+
const publishedAt = requiredString(value, "published_at", "preview receipt");
|
|
87
|
+
const contentDigest = requiredString(value, "content_digest", "preview receipt");
|
|
88
|
+
if (!contentDigest.startsWith("sha256:") || contentDigest.length <= "sha256:".length) {
|
|
89
|
+
throw new Error("preview receipt.content_digest must be a sha256 digest.");
|
|
90
|
+
}
|
|
91
|
+
if (!Number.isFinite(Date.parse(expiresAt)) || !Number.isFinite(Date.parse(publishedAt))) {
|
|
92
|
+
throw new Error("Preview receipt timestamps must be valid ISO date strings.");
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
version: RIDDLE_PREVIEW_RECEIPT_VERSION,
|
|
96
|
+
preview_id: requiredString(value, "preview_id", "preview receipt"),
|
|
97
|
+
url: requiredString(value, "url", "preview receipt"),
|
|
98
|
+
expires_at: expiresAt,
|
|
99
|
+
content_digest: contentDigest,
|
|
100
|
+
source: normalizedSourceIdentity(value.source),
|
|
101
|
+
published_at: publishedAt
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/riddle-client.ts
|
|
56
106
|
var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
|
|
57
107
|
var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
|
|
58
108
|
var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
|
|
@@ -114,6 +164,7 @@ async function getRiddleBalance(config = {}) {
|
|
|
114
164
|
}
|
|
115
165
|
function previewDeployResultFromRecord(input) {
|
|
116
166
|
const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
|
|
167
|
+
const receipt = record.receipt && typeof record.receipt === "object" ? parseRiddlePreviewReceipt(record.receipt) : void 0;
|
|
117
168
|
return {
|
|
118
169
|
ok: true,
|
|
119
170
|
id: String(record.id || record.preview_id || id),
|
|
@@ -122,13 +173,32 @@ function previewDeployResultFromRecord(input) {
|
|
|
122
173
|
preview_url: String(record.preview_url || ""),
|
|
123
174
|
file_count: typeof record.file_count === "number" ? record.file_count : void 0,
|
|
124
175
|
total_bytes: typeof record.total_bytes === "number" ? record.total_bytes : void 0,
|
|
125
|
-
expires_at: expiresAt,
|
|
176
|
+
expires_at: receipt?.expires_at || expiresAt,
|
|
177
|
+
receipt,
|
|
126
178
|
publish_recovered: publishRecovered || void 0,
|
|
127
179
|
publish_error: publishError,
|
|
128
180
|
warnings: input.warnings?.length ? input.warnings : void 0,
|
|
129
181
|
raw: record
|
|
130
182
|
};
|
|
131
183
|
}
|
|
184
|
+
function gitOutput(directory, args) {
|
|
185
|
+
try {
|
|
186
|
+
return (0, import_node_child_process.execFileSync)("git", ["-C", directory, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
187
|
+
} catch {
|
|
188
|
+
return "";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function detectRiddlePreviewSource(directory) {
|
|
192
|
+
const gitRevision = gitOutput(directory, ["rev-parse", "HEAD"]);
|
|
193
|
+
if (!gitRevision) return {};
|
|
194
|
+
const repository = gitOutput(directory, ["config", "--get", "remote.origin.url"]);
|
|
195
|
+
const status = gitOutput(directory, ["status", "--porcelain", "--untracked-files=normal"]);
|
|
196
|
+
return {
|
|
197
|
+
git_revision: gitRevision,
|
|
198
|
+
repository: repository || void 0,
|
|
199
|
+
dirty: Boolean(status)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
132
202
|
function canRecoverPreviewPublish(error) {
|
|
133
203
|
return error instanceof RiddleApiError && PREVIEW_PUBLISH_RECOVERY_STATUSES.has(error.status);
|
|
134
204
|
}
|
|
@@ -211,12 +281,13 @@ async function waitForPublishedPreview(config, input) {
|
|
|
211
281
|
}
|
|
212
282
|
throw input.publishError;
|
|
213
283
|
}
|
|
214
|
-
async function deployRiddlePreview(config, directory, label, framework = "static") {
|
|
284
|
+
async function deployRiddlePreview(config, directory, label, framework = "static", options = {}) {
|
|
215
285
|
if (!directory?.trim()) throw new Error("directory is required");
|
|
216
286
|
if (!label?.trim()) throw new Error("label is required");
|
|
217
287
|
if (framework !== "spa" && framework !== "static") throw new Error("framework must be spa or static");
|
|
218
288
|
const startedAt = Date.now();
|
|
219
289
|
const warnings = collectRiddlePreviewDeployWarnings(directory, framework);
|
|
290
|
+
const source = options.source || detectRiddlePreviewSource(directory);
|
|
220
291
|
const emitProgress = previewProgressEmitter(config, { label, framework, directory, startedAt, warnings });
|
|
221
292
|
await emitProgress({ stage: "validating", message: "checking preview input directory" });
|
|
222
293
|
const localSummary = summarizePreviewDirectory(directory);
|
|
@@ -228,7 +299,7 @@ async function deployRiddlePreview(config, directory, label, framework = "static
|
|
|
228
299
|
});
|
|
229
300
|
const created = await riddleRequestJson(config, "/v1/preview", {
|
|
230
301
|
method: "POST",
|
|
231
|
-
body: JSON.stringify({ framework, label })
|
|
302
|
+
body: JSON.stringify({ framework, label, source })
|
|
232
303
|
});
|
|
233
304
|
const id = String(created.id || "");
|
|
234
305
|
const uploadUrl = String(created.upload_url || "");
|
|
@@ -370,8 +441,8 @@ function collectRiddlePreviewDeployWarnings(directory, framework = "static") {
|
|
|
370
441
|
return [];
|
|
371
442
|
}
|
|
372
443
|
}
|
|
373
|
-
async function deployRiddleStaticPreview(config, directory, label) {
|
|
374
|
-
return deployRiddlePreview(config, directory, label, "static");
|
|
444
|
+
async function deployRiddleStaticPreview(config, directory, label, options = {}) {
|
|
445
|
+
return deployRiddlePreview(config, directory, label, "static", options);
|
|
375
446
|
}
|
|
376
447
|
function createTarball(directory, label, exclude = []) {
|
|
377
448
|
const scratch = (0, import_node_fs.mkdtempSync)(import_node_path.default.join((0, import_node_os.tmpdir)(), "riddle-upload-"));
|
|
@@ -493,21 +564,31 @@ function parseTimestampMs(value) {
|
|
|
493
564
|
}
|
|
494
565
|
function buildPollSnapshot(jobId, job, input) {
|
|
495
566
|
const status = job?.status ? String(job.status) : null;
|
|
567
|
+
const phase = job?.phase ? String(job.phase) : null;
|
|
496
568
|
const terminal = isTerminalRiddleJobStatus(status);
|
|
497
569
|
const createdAt = stringField(job, "created_at");
|
|
498
570
|
const submittedAt = stringField(job, "submitted_at");
|
|
499
571
|
const completedAt = stringField(job, "completed_at");
|
|
500
572
|
const createdMs = parseTimestampMs(createdAt);
|
|
501
573
|
const submittedMs = parseTimestampMs(submittedAt);
|
|
574
|
+
const rawExecution = job?.execution && typeof job.execution === "object" && !Array.isArray(job.execution) ? job.execution : null;
|
|
575
|
+
const enqueuedAt = rawExecution ? stringField(rawExecution, "enqueued_at") : null;
|
|
576
|
+
const enqueuedMs = parseTimestampMs(enqueuedAt);
|
|
577
|
+
const queueStartedMs = enqueuedMs ?? createdMs;
|
|
578
|
+
const claimedAt = rawExecution ? stringField(rawExecution, "claimed_at") : null;
|
|
579
|
+
const claimedMs = parseTimestampMs(claimedAt);
|
|
502
580
|
let queueElapsedMs = null;
|
|
503
|
-
if (
|
|
504
|
-
queueElapsedMs = Math.max(0,
|
|
505
|
-
} else if (
|
|
506
|
-
queueElapsedMs = Math.max(0,
|
|
581
|
+
if (queueStartedMs !== null && claimedMs !== null) {
|
|
582
|
+
queueElapsedMs = Math.max(0, claimedMs - queueStartedMs);
|
|
583
|
+
} else if (queueStartedMs !== null && submittedMs !== null) {
|
|
584
|
+
queueElapsedMs = Math.max(0, submittedMs - queueStartedMs);
|
|
585
|
+
} else if (queueStartedMs !== null && !submittedAt && !terminal) {
|
|
586
|
+
queueElapsedMs = Math.max(0, input.observedAt - queueStartedMs);
|
|
507
587
|
}
|
|
508
588
|
return {
|
|
509
589
|
job_id: jobId,
|
|
510
590
|
status,
|
|
591
|
+
phase,
|
|
511
592
|
terminal,
|
|
512
593
|
attempt: input.attempt,
|
|
513
594
|
attempts: input.attempts,
|
|
@@ -517,7 +598,9 @@ function buildPollSnapshot(jobId, job, input) {
|
|
|
517
598
|
completed_at: completedAt,
|
|
518
599
|
queue_elapsed_ms: queueElapsedMs,
|
|
519
600
|
pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
|
|
520
|
-
running_without_submission: Boolean(status && !terminal && !submittedAt)
|
|
601
|
+
running_without_submission: Boolean(status && !terminal && !submittedAt),
|
|
602
|
+
active_execution: Boolean(status === "running" && phase && phase !== "queued"),
|
|
603
|
+
execution: rawExecution ? rawExecution : void 0
|
|
521
604
|
};
|
|
522
605
|
}
|
|
523
606
|
function pollMessage(snapshot, timedOut) {
|
|
@@ -526,7 +609,7 @@ function pollMessage(snapshot, timedOut) {
|
|
|
526
609
|
const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
|
|
527
610
|
const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
|
|
528
611
|
const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
|
|
529
|
-
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${wakeHint}${queue}${preSubmit}`;
|
|
612
|
+
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} phase=${snapshot.phase || "unknown"} submitted_at=${submitted}.${wakeHint}${queue}${preSubmit}`;
|
|
530
613
|
}
|
|
531
614
|
async function pollRiddleJob(config, jobId, options = {}) {
|
|
532
615
|
if (!jobId?.trim()) throw new Error("jobId is required");
|
|
@@ -560,6 +643,7 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
560
643
|
};
|
|
561
644
|
const progressKey = [
|
|
562
645
|
lastSnapshot.status || "unknown",
|
|
646
|
+
lastSnapshot.phase || "unknown",
|
|
563
647
|
lastSnapshot.terminal ? "terminal" : "nonterminal",
|
|
564
648
|
lastSnapshot.submitted_at ? "submitted" : "unsubmitted"
|
|
565
649
|
].join(":");
|
|
@@ -626,8 +710,8 @@ function createRiddleApiClient(config = {}) {
|
|
|
626
710
|
apiKeySource: () => resolveRiddleApiKeySource(config),
|
|
627
711
|
requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
|
|
628
712
|
getBalance: () => getRiddleBalance(config),
|
|
629
|
-
deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
|
|
630
|
-
deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
|
|
713
|
+
deployPreview: (directory, label, framework = "static", options) => deployRiddlePreview(config, directory, label, framework, options),
|
|
714
|
+
deployStaticPreview: (directory, label, options) => deployRiddleStaticPreview(config, directory, label, options),
|
|
631
715
|
runScript: (input) => runRiddleScript(config, input),
|
|
632
716
|
runServerPreview: (input) => runRiddleServerPreview(config, input),
|
|
633
717
|
pollJob: (jobId, options) => pollRiddleJob(config, jobId, options)
|
|
@@ -643,6 +727,7 @@ function createRiddleApiClient(config = {}) {
|
|
|
643
727
|
createRiddleApiClient,
|
|
644
728
|
deployRiddlePreview,
|
|
645
729
|
deployRiddleStaticPreview,
|
|
730
|
+
detectRiddlePreviewSource,
|
|
646
731
|
getRiddleBalance,
|
|
647
732
|
isTerminalRiddleJobStatus,
|
|
648
733
|
parseRiddleViewport,
|
package/dist/riddle-client.d.cts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { RiddleProofExecutionTelemetry, RiddleProofSourceIdentity, RiddlePreviewReceipt } from './receipts.cjs';
|
|
2
|
+
import './profile.cjs';
|
|
3
|
+
import './types.cjs';
|
|
4
|
+
import './public-state.cjs';
|
|
5
|
+
|
|
1
6
|
declare const DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
|
|
2
7
|
declare const DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
|
|
3
8
|
declare const RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
|
|
@@ -29,6 +34,7 @@ interface RiddleBalanceResult {
|
|
|
29
34
|
interface RiddlePollProgressSnapshot {
|
|
30
35
|
job_id: string;
|
|
31
36
|
status: string | null;
|
|
37
|
+
phase: string | null;
|
|
32
38
|
terminal: boolean;
|
|
33
39
|
attempt: number;
|
|
34
40
|
attempts: number;
|
|
@@ -39,6 +45,8 @@ interface RiddlePollProgressSnapshot {
|
|
|
39
45
|
queue_elapsed_ms: number | null;
|
|
40
46
|
pre_submission_elapsed_ms: number;
|
|
41
47
|
running_without_submission: boolean;
|
|
48
|
+
active_execution: boolean;
|
|
49
|
+
execution?: RiddleProofExecutionTelemetry;
|
|
42
50
|
}
|
|
43
51
|
interface RiddlePollSummary extends RiddlePollProgressSnapshot {
|
|
44
52
|
timed_out: boolean;
|
|
@@ -84,11 +92,15 @@ interface RiddlePreviewDeployResult {
|
|
|
84
92
|
file_count?: number;
|
|
85
93
|
total_bytes?: number;
|
|
86
94
|
expires_at?: string;
|
|
95
|
+
receipt?: RiddlePreviewReceipt;
|
|
87
96
|
publish_recovered?: boolean;
|
|
88
97
|
publish_error?: string;
|
|
89
98
|
warnings?: string[];
|
|
90
99
|
raw?: Record<string, unknown>;
|
|
91
100
|
}
|
|
101
|
+
interface RiddlePreviewDeployOptions {
|
|
102
|
+
source?: RiddleProofSourceIdentity;
|
|
103
|
+
}
|
|
92
104
|
interface RiddleRunScriptInput {
|
|
93
105
|
url: string;
|
|
94
106
|
script: string;
|
|
@@ -150,9 +162,10 @@ declare function resolveRiddleApiKeySource(config?: RiddleClientConfig): RiddleA
|
|
|
150
162
|
declare function resolveRiddleApiKey(config?: RiddleClientConfig): string;
|
|
151
163
|
declare function riddleRequestJson<T = unknown>(config: RiddleClientConfig, pathname: string, init?: RequestInit): Promise<T>;
|
|
152
164
|
declare function getRiddleBalance(config?: RiddleClientConfig): Promise<RiddleBalanceResult>;
|
|
153
|
-
declare function
|
|
165
|
+
declare function detectRiddlePreviewSource(directory: string): RiddleProofSourceIdentity;
|
|
166
|
+
declare function deployRiddlePreview(config: RiddleClientConfig, directory: string, label: string, framework?: RiddlePreviewFramework, options?: RiddlePreviewDeployOptions): Promise<RiddlePreviewDeployResult>;
|
|
154
167
|
declare function collectRiddlePreviewDeployWarnings(directory: string, framework?: RiddlePreviewFramework): string[];
|
|
155
|
-
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string): Promise<RiddlePreviewDeployResult>;
|
|
168
|
+
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string, options?: RiddlePreviewDeployOptions): Promise<RiddlePreviewDeployResult>;
|
|
156
169
|
declare function parseRiddleViewport(value?: string): {
|
|
157
170
|
width: number;
|
|
158
171
|
height: number;
|
|
@@ -165,11 +178,11 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
|
165
178
|
apiKeySource: () => RiddleApiKeySource;
|
|
166
179
|
requestJson: <T = unknown>(pathname: string, init?: RequestInit) => Promise<T>;
|
|
167
180
|
getBalance: () => Promise<RiddleBalanceResult>;
|
|
168
|
-
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework) => Promise<RiddlePreviewDeployResult>;
|
|
169
|
-
deployStaticPreview: (directory: string, label: string) => Promise<RiddlePreviewDeployResult>;
|
|
181
|
+
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework, options?: RiddlePreviewDeployOptions) => Promise<RiddlePreviewDeployResult>;
|
|
182
|
+
deployStaticPreview: (directory: string, label: string, options?: RiddlePreviewDeployOptions) => Promise<RiddlePreviewDeployResult>;
|
|
170
183
|
runScript: (input: RiddleRunScriptInput) => Promise<Record<string, unknown>>;
|
|
171
184
|
runServerPreview: (input: RiddleServerPreviewInput) => Promise<RiddleServerPreviewResult>;
|
|
172
185
|
pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
|
|
173
186
|
};
|
|
174
187
|
|
|
175
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployProgressSnapshot, type RiddlePreviewDeployResult, type RiddlePreviewDeployStage, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
|
188
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployOptions, type RiddlePreviewDeployProgressSnapshot, type RiddlePreviewDeployResult, type RiddlePreviewDeployStage, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, detectRiddlePreviewSource, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
package/dist/riddle-client.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { RiddleProofExecutionTelemetry, RiddleProofSourceIdentity, RiddlePreviewReceipt } from './receipts.js';
|
|
2
|
+
import './profile.js';
|
|
3
|
+
import './types.js';
|
|
4
|
+
import './public-state.js';
|
|
5
|
+
|
|
1
6
|
declare const DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
|
|
2
7
|
declare const DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
|
|
3
8
|
declare const RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
|
|
@@ -29,6 +34,7 @@ interface RiddleBalanceResult {
|
|
|
29
34
|
interface RiddlePollProgressSnapshot {
|
|
30
35
|
job_id: string;
|
|
31
36
|
status: string | null;
|
|
37
|
+
phase: string | null;
|
|
32
38
|
terminal: boolean;
|
|
33
39
|
attempt: number;
|
|
34
40
|
attempts: number;
|
|
@@ -39,6 +45,8 @@ interface RiddlePollProgressSnapshot {
|
|
|
39
45
|
queue_elapsed_ms: number | null;
|
|
40
46
|
pre_submission_elapsed_ms: number;
|
|
41
47
|
running_without_submission: boolean;
|
|
48
|
+
active_execution: boolean;
|
|
49
|
+
execution?: RiddleProofExecutionTelemetry;
|
|
42
50
|
}
|
|
43
51
|
interface RiddlePollSummary extends RiddlePollProgressSnapshot {
|
|
44
52
|
timed_out: boolean;
|
|
@@ -84,11 +92,15 @@ interface RiddlePreviewDeployResult {
|
|
|
84
92
|
file_count?: number;
|
|
85
93
|
total_bytes?: number;
|
|
86
94
|
expires_at?: string;
|
|
95
|
+
receipt?: RiddlePreviewReceipt;
|
|
87
96
|
publish_recovered?: boolean;
|
|
88
97
|
publish_error?: string;
|
|
89
98
|
warnings?: string[];
|
|
90
99
|
raw?: Record<string, unknown>;
|
|
91
100
|
}
|
|
101
|
+
interface RiddlePreviewDeployOptions {
|
|
102
|
+
source?: RiddleProofSourceIdentity;
|
|
103
|
+
}
|
|
92
104
|
interface RiddleRunScriptInput {
|
|
93
105
|
url: string;
|
|
94
106
|
script: string;
|
|
@@ -150,9 +162,10 @@ declare function resolveRiddleApiKeySource(config?: RiddleClientConfig): RiddleA
|
|
|
150
162
|
declare function resolveRiddleApiKey(config?: RiddleClientConfig): string;
|
|
151
163
|
declare function riddleRequestJson<T = unknown>(config: RiddleClientConfig, pathname: string, init?: RequestInit): Promise<T>;
|
|
152
164
|
declare function getRiddleBalance(config?: RiddleClientConfig): Promise<RiddleBalanceResult>;
|
|
153
|
-
declare function
|
|
165
|
+
declare function detectRiddlePreviewSource(directory: string): RiddleProofSourceIdentity;
|
|
166
|
+
declare function deployRiddlePreview(config: RiddleClientConfig, directory: string, label: string, framework?: RiddlePreviewFramework, options?: RiddlePreviewDeployOptions): Promise<RiddlePreviewDeployResult>;
|
|
154
167
|
declare function collectRiddlePreviewDeployWarnings(directory: string, framework?: RiddlePreviewFramework): string[];
|
|
155
|
-
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string): Promise<RiddlePreviewDeployResult>;
|
|
168
|
+
declare function deployRiddleStaticPreview(config: RiddleClientConfig, directory: string, label: string, options?: RiddlePreviewDeployOptions): Promise<RiddlePreviewDeployResult>;
|
|
156
169
|
declare function parseRiddleViewport(value?: string): {
|
|
157
170
|
width: number;
|
|
158
171
|
height: number;
|
|
@@ -165,11 +178,11 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
|
|
|
165
178
|
apiKeySource: () => RiddleApiKeySource;
|
|
166
179
|
requestJson: <T = unknown>(pathname: string, init?: RequestInit) => Promise<T>;
|
|
167
180
|
getBalance: () => Promise<RiddleBalanceResult>;
|
|
168
|
-
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework) => Promise<RiddlePreviewDeployResult>;
|
|
169
|
-
deployStaticPreview: (directory: string, label: string) => Promise<RiddlePreviewDeployResult>;
|
|
181
|
+
deployPreview: (directory: string, label: string, framework?: RiddlePreviewFramework, options?: RiddlePreviewDeployOptions) => Promise<RiddlePreviewDeployResult>;
|
|
182
|
+
deployStaticPreview: (directory: string, label: string, options?: RiddlePreviewDeployOptions) => Promise<RiddlePreviewDeployResult>;
|
|
170
183
|
runScript: (input: RiddleRunScriptInput) => Promise<Record<string, unknown>>;
|
|
171
184
|
runServerPreview: (input: RiddleServerPreviewInput) => Promise<RiddleServerPreviewResult>;
|
|
172
185
|
pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
|
|
173
186
|
};
|
|
174
187
|
|
|
175
|
-
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployProgressSnapshot, type RiddlePreviewDeployResult, type RiddlePreviewDeployStage, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
|
188
|
+
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, RiddleApiError, type RiddleApiKeySource, type RiddleBalanceResult, type RiddleClientConfig, type RiddleFetch, type RiddlePollJobOptions, type RiddlePollJobResult, type RiddlePollProgressSnapshot, type RiddlePollSummary, type RiddlePreviewDeployOptions, type RiddlePreviewDeployProgressSnapshot, type RiddlePreviewDeployResult, type RiddlePreviewDeployStage, type RiddlePreviewFramework, type RiddleRunScriptInput, type RiddleServerPreviewInput, type RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, detectRiddlePreviewSource, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview };
|
package/dist/riddle-client.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
createRiddleApiClient,
|
|
8
8
|
deployRiddlePreview,
|
|
9
9
|
deployRiddleStaticPreview,
|
|
10
|
+
detectRiddlePreviewSource,
|
|
10
11
|
getRiddleBalance,
|
|
11
12
|
isTerminalRiddleJobStatus,
|
|
12
13
|
parseRiddleViewport,
|
|
@@ -16,7 +17,8 @@ import {
|
|
|
16
17
|
riddleRequestJson,
|
|
17
18
|
runRiddleScript,
|
|
18
19
|
runRiddleServerPreview
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5IFZSUPF.js";
|
|
21
|
+
import "./chunk-MEVVL4TI.js";
|
|
20
22
|
import "./chunk-MLKGABMK.js";
|
|
21
23
|
export {
|
|
22
24
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
@@ -27,6 +29,7 @@ export {
|
|
|
27
29
|
createRiddleApiClient,
|
|
28
30
|
deployRiddlePreview,
|
|
29
31
|
deployRiddleStaticPreview,
|
|
32
|
+
detectRiddlePreviewSource,
|
|
30
33
|
getRiddleBalance,
|
|
31
34
|
isTerminalRiddleJobStatus,
|
|
32
35
|
parseRiddleViewport,
|