@riddledc/riddle-proof 0.8.64 → 0.8.66

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/index.js CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  import {
41
41
  DEFAULT_RIDDLE_API_BASE_URL,
42
42
  DEFAULT_RIDDLE_API_KEY_FILE,
43
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
43
44
  RiddleApiError,
44
45
  collectRiddlePreviewDeployWarnings,
45
46
  createRiddleApiClient,
@@ -54,12 +55,16 @@ import {
54
55
  riddleRequestJson,
55
56
  runRiddleScript,
56
57
  runRiddleServerPreview
57
- } from "./chunk-DI2XNGEZ.js";
58
+ } from "./chunk-B2DP2LET.js";
58
59
  import {
59
60
  RIDDLE_PROOF_PR_COMMENT_MARKER,
60
61
  buildRiddleProofPrCommentMarkdown,
61
62
  summarizeRiddleProofPrComment
62
63
  } from "./chunk-RZ3GXSXQ.js";
64
+ import {
65
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
66
+ suggestRiddleProofProfileChecks
67
+ } from "./chunk-5Y4V2IXI.js";
63
68
  import {
64
69
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
65
70
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
@@ -190,12 +195,14 @@ export {
190
195
  RIDDLE_PROOF_PROFILE_RESULT_VERSION,
191
196
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
192
197
  RIDDLE_PROOF_PROFILE_STATUSES,
198
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
193
199
  RIDDLE_PROOF_PROFILE_VERSION,
194
200
  RIDDLE_PROOF_PR_COMMENT_MARKER,
195
201
  RIDDLE_PROOF_RUN_CARD_VERSION,
196
202
  RIDDLE_PROOF_RUN_STATE_VERSION,
197
203
  RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
198
204
  RIDDLE_PROOF_VISUAL_SESSION_VERSION,
205
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
199
206
  RiddleApiError,
200
207
  appendCaptureDiagnostic,
201
208
  appendRunEvent,
@@ -299,6 +306,7 @@ export {
299
306
  shipControlStateFor,
300
307
  slugifyRiddleProofProfileName,
301
308
  statePathsForRunState,
309
+ suggestRiddleProofProfileChecks,
302
310
  summarizeCaptureArtifacts,
303
311
  summarizeRiddleProofAgentSummarySurface,
304
312
  summarizeRiddleProofHostedProofViewSurface,
@@ -0,0 +1,204 @@
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/profile-suggestions.ts
21
+ var profile_suggestions_exports = {};
22
+ __export(profile_suggestions_exports, {
23
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION: () => RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
24
+ suggestRiddleProofProfileChecks: () => suggestRiddleProofProfileChecks
25
+ });
26
+ module.exports = __toCommonJS(profile_suggestions_exports);
27
+
28
+ // src/profile.ts
29
+ var RIDDLE_PROOF_PROFILE_VERSION = "riddle-proof.profile.v1";
30
+
31
+ // src/profile-suggestions.ts
32
+ var RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION = "riddle-proof.profile-suggestions.v1";
33
+ var UI_FILE_PATTERN = /\.(css|html?|jsx?|tsx?|vue|svelte|mdx)$/i;
34
+ var VISUAL_ASSET_PATTERN = /\.(avif|gif|jpe?g|png|svg|webp)$/i;
35
+ function nonEmptyStrings(values) {
36
+ return Array.from(new Set(
37
+ (values || []).filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean)
38
+ ));
39
+ }
40
+ function normalizeRoute(value) {
41
+ if (!value?.trim()) return void 0;
42
+ const trimmed = value.trim();
43
+ if (/^https?:\/\//i.test(trimmed)) return void 0;
44
+ return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
45
+ }
46
+ function routeFromUrl(value) {
47
+ if (!value?.trim()) return void 0;
48
+ try {
49
+ const url = new URL(value);
50
+ return normalizeRoute(`${url.pathname}${url.search || ""}`);
51
+ } catch {
52
+ return void 0;
53
+ }
54
+ }
55
+ function slugify(value) {
56
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "suggested-profile";
57
+ }
58
+ function inferRouteFromFile(file) {
59
+ const normalized = file.replace(/\\/g, "/");
60
+ const routeMatch = normalized.match(/(?:^|\/)(?:pages|routes|app)\/(.+?)(?:\.[^.\/]+)?$/);
61
+ if (!routeMatch) return void 0;
62
+ const route = routeMatch[1].replace(/\/index$/i, "").replace(/\/page$/i, "").replace(/\[[^/\]]+\]/g, ":param");
63
+ return normalizeRoute(route || "/");
64
+ }
65
+ function inferRouteFromFiles(files) {
66
+ for (const file of files) {
67
+ const route = inferRouteFromFile(file);
68
+ if (route) return route;
69
+ }
70
+ return void 0;
71
+ }
72
+ function uniqueChecks(checks) {
73
+ const seen = /* @__PURE__ */ new Set();
74
+ return checks.filter((check) => {
75
+ const key = JSON.stringify(check);
76
+ if (seen.has(key)) return false;
77
+ seen.add(key);
78
+ return true;
79
+ });
80
+ }
81
+ function changedTextEntryText(entry) {
82
+ return typeof entry === "string" ? entry.trim() : (entry.expected_text || entry.text || "").trim();
83
+ }
84
+ function changedTextEntrySelector(entry) {
85
+ return typeof entry === "string" ? void 0 : entry.selector?.trim() || void 0;
86
+ }
87
+ function changedTextEntryLabel(entry) {
88
+ return typeof entry === "string" ? void 0 : entry.label?.trim() || void 0;
89
+ }
90
+ function suggestionProfileName(input, route, files) {
91
+ if (input.name?.trim()) return input.name.trim();
92
+ return `suggested-${slugify(route || files[0] || "profile")}`;
93
+ }
94
+ function defaultViewports(includeMobile) {
95
+ const viewports = [
96
+ { name: "desktop", width: 1280, height: 800 }
97
+ ];
98
+ if (includeMobile !== false) {
99
+ viewports.push({ name: "mobile", width: 390, height: 844 });
100
+ }
101
+ return viewports;
102
+ }
103
+ function suggestRiddleProofProfileChecks(input) {
104
+ const changedFiles = nonEmptyStrings(input.changed_files);
105
+ const selectors = nonEmptyStrings(input.selectors);
106
+ const changedText = input.changed_text || [];
107
+ const route = normalizeRoute(input.route) || inferRouteFromFiles(changedFiles) || routeFromUrl(input.url);
108
+ const uiFiles = changedFiles.filter((file) => UI_FILE_PATTERN.test(file));
109
+ const visualAssets = changedFiles.filter((file) => VISUAL_ASSET_PATTERN.test(file));
110
+ const warnings = [];
111
+ const suggestions = [];
112
+ const setupActions = [];
113
+ if (!route && !input.url?.trim()) {
114
+ warnings.push("No route or URL was supplied; the draft profile defaults to route /.");
115
+ }
116
+ if ((uiFiles.length || visualAssets.length) && !changedText.length && !selectors.length) {
117
+ warnings.push("UI or visual files changed, but no changed text or selectors were supplied; add focused checks before trusting this profile.");
118
+ }
119
+ const routeOrDefault = route || "/";
120
+ const routeChecks = [
121
+ { type: "route_loaded", expected_path: routeOrDefault }
122
+ ];
123
+ suggestions.push({
124
+ id: "route-loaded",
125
+ reason: "Every browser proof should first prove that the intended route loaded.",
126
+ checks: routeChecks
127
+ });
128
+ const hygieneChecks = [
129
+ { type: "no_fatal_console_errors" },
130
+ { type: "no_mobile_horizontal_overflow" }
131
+ ];
132
+ suggestions.push({
133
+ id: "runtime-hygiene",
134
+ reason: "UI changes should not introduce fatal console errors or mobile overflow.",
135
+ checks: hygieneChecks
136
+ });
137
+ for (const selector of selectors) {
138
+ suggestions.push({
139
+ id: `selector-${slugify(selector)}`,
140
+ reason: `Changed selector ${selector} should remain visible.`,
141
+ checks: [{ type: "selector_visible", selector }]
142
+ });
143
+ }
144
+ for (const entry of changedText) {
145
+ const text = changedTextEntryText(entry);
146
+ if (!text) continue;
147
+ const selector = changedTextEntrySelector(entry);
148
+ const label = changedTextEntryLabel(entry);
149
+ const check = selector ? { type: "selector_text_visible", selector, text, label } : { type: "text_visible", text, label };
150
+ suggestions.push({
151
+ id: `text-${slugify(`${selector || "page"}-${text}`)}`,
152
+ reason: selector ? `Expected text should be visible inside ${selector}.` : "Expected text should be visible on the route.",
153
+ checks: [check]
154
+ });
155
+ }
156
+ if (input.include_screenshot !== false && (uiFiles.length || visualAssets.length || selectors.length || changedText.length)) {
157
+ setupActions.push({ type: "screenshot", label: "suggested-proof-screenshot", full_page: true });
158
+ suggestions.push({
159
+ id: "screenshot-artifact",
160
+ reason: "A screenshot artifact keeps the proof packet inspectable by humans and hosted renderers.",
161
+ checks: [],
162
+ setup_actions: setupActions
163
+ });
164
+ }
165
+ const checks = uniqueChecks(suggestions.flatMap((suggestion) => suggestion.checks));
166
+ const target = {
167
+ ...input.url?.trim() ? { url: input.url.trim() } : { route: routeOrDefault },
168
+ viewports: defaultViewports(input.include_mobile),
169
+ setup_actions: setupActions.length ? setupActions : void 0
170
+ };
171
+ const profile = {
172
+ version: RIDDLE_PROOF_PROFILE_VERSION,
173
+ name: suggestionProfileName(input, routeOrDefault, changedFiles),
174
+ target,
175
+ checks,
176
+ artifacts: ["screenshot", "console", "proof_json"],
177
+ baseline_policy: "invariant_only",
178
+ failure_policy: {
179
+ product_regression: "fail",
180
+ proof_insufficient: "review",
181
+ environment_blocked: "neutral",
182
+ configuration_error: "fail",
183
+ needs_human_review: "review"
184
+ },
185
+ metadata: {
186
+ suggestion_input: {
187
+ changed_files: changedFiles,
188
+ selectors,
189
+ changed_text_count: changedText.length
190
+ }
191
+ }
192
+ };
193
+ return {
194
+ version: RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
195
+ profile,
196
+ suggestions,
197
+ warnings
198
+ };
199
+ }
200
+ // Annotate the CommonJS export names for ESM import in node:
201
+ 0 && (module.exports = {
202
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
203
+ suggestRiddleProofProfileChecks
204
+ });
@@ -0,0 +1,36 @@
1
+ import { RiddleProofProfileCheck, RiddleProofProfileSetupAction, RiddleProofProfile } from './profile.cjs';
2
+ import './types.cjs';
3
+ import './public-state.cjs';
4
+
5
+ declare const RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION: "riddle-proof.profile-suggestions.v1";
6
+ interface RiddleProofProfileChangedTextInput {
7
+ text?: string;
8
+ expected_text?: string;
9
+ selector?: string;
10
+ label?: string;
11
+ }
12
+ interface RiddleProofProfileSuggestionInput {
13
+ name?: string;
14
+ route?: string;
15
+ url?: string;
16
+ changed_files?: string[];
17
+ selectors?: string[];
18
+ changed_text?: Array<string | RiddleProofProfileChangedTextInput>;
19
+ include_mobile?: boolean;
20
+ include_screenshot?: boolean;
21
+ }
22
+ interface RiddleProofProfileSuggestion {
23
+ id: string;
24
+ reason: string;
25
+ checks: RiddleProofProfileCheck[];
26
+ setup_actions?: RiddleProofProfileSetupAction[];
27
+ }
28
+ interface RiddleProofProfileSuggestionsResult {
29
+ version: typeof RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION;
30
+ profile: RiddleProofProfile;
31
+ suggestions: RiddleProofProfileSuggestion[];
32
+ warnings: string[];
33
+ }
34
+ declare function suggestRiddleProofProfileChecks(input: RiddleProofProfileSuggestionInput): RiddleProofProfileSuggestionsResult;
35
+
36
+ export { RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION, type RiddleProofProfileChangedTextInput, type RiddleProofProfileSuggestion, type RiddleProofProfileSuggestionInput, type RiddleProofProfileSuggestionsResult, suggestRiddleProofProfileChecks };
@@ -0,0 +1,36 @@
1
+ import { RiddleProofProfileCheck, RiddleProofProfileSetupAction, RiddleProofProfile } from './profile.js';
2
+ import './types.js';
3
+ import './public-state.js';
4
+
5
+ declare const RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION: "riddle-proof.profile-suggestions.v1";
6
+ interface RiddleProofProfileChangedTextInput {
7
+ text?: string;
8
+ expected_text?: string;
9
+ selector?: string;
10
+ label?: string;
11
+ }
12
+ interface RiddleProofProfileSuggestionInput {
13
+ name?: string;
14
+ route?: string;
15
+ url?: string;
16
+ changed_files?: string[];
17
+ selectors?: string[];
18
+ changed_text?: Array<string | RiddleProofProfileChangedTextInput>;
19
+ include_mobile?: boolean;
20
+ include_screenshot?: boolean;
21
+ }
22
+ interface RiddleProofProfileSuggestion {
23
+ id: string;
24
+ reason: string;
25
+ checks: RiddleProofProfileCheck[];
26
+ setup_actions?: RiddleProofProfileSetupAction[];
27
+ }
28
+ interface RiddleProofProfileSuggestionsResult {
29
+ version: typeof RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION;
30
+ profile: RiddleProofProfile;
31
+ suggestions: RiddleProofProfileSuggestion[];
32
+ warnings: string[];
33
+ }
34
+ declare function suggestRiddleProofProfileChecks(input: RiddleProofProfileSuggestionInput): RiddleProofProfileSuggestionsResult;
35
+
36
+ export { RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION, type RiddleProofProfileChangedTextInput, type RiddleProofProfileSuggestion, type RiddleProofProfileSuggestionInput, type RiddleProofProfileSuggestionsResult, suggestRiddleProofProfileChecks };
@@ -0,0 +1,10 @@
1
+ import {
2
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
3
+ suggestRiddleProofProfileChecks
4
+ } from "./chunk-5Y4V2IXI.js";
5
+ import "./chunk-EX7TO4I5.js";
6
+ import "./chunk-MLKGABMK.js";
7
+ export {
8
+ RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
9
+ suggestRiddleProofProfileChecks
10
+ };
@@ -32,6 +32,7 @@ var riddle_client_exports = {};
32
32
  __export(riddle_client_exports, {
33
33
  DEFAULT_RIDDLE_API_BASE_URL: () => DEFAULT_RIDDLE_API_BASE_URL,
34
34
  DEFAULT_RIDDLE_API_KEY_FILE: () => DEFAULT_RIDDLE_API_KEY_FILE,
35
+ RIDDLE_UNSUBMITTED_WAKE_HINT: () => RIDDLE_UNSUBMITTED_WAKE_HINT,
35
36
  RiddleApiError: () => RiddleApiError,
36
37
  collectRiddlePreviewDeployWarnings: () => collectRiddlePreviewDeployWarnings,
37
38
  createRiddleApiClient: () => createRiddleApiClient,
@@ -54,6 +55,7 @@ var import_node_os = require("os");
54
55
  var import_node_path = __toESM(require("path"), 1);
55
56
  var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
56
57
  var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
58
+ var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
57
59
  var RiddleApiError = class extends Error {
58
60
  constructor(pathname, status, body) {
59
61
  super(`Riddle API ${pathname} failed HTTP ${status}: ${body}`);
@@ -521,9 +523,10 @@ function buildPollSnapshot(jobId, job, input) {
521
523
  function pollMessage(snapshot, timedOut) {
522
524
  if (!timedOut) return void 0;
523
525
  const submitted = snapshot.submitted_at || "not submitted";
526
+ const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
524
527
  const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
525
528
  const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
526
- return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
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}`;
527
530
  }
528
531
  async function pollRiddleJob(config, jobId, options = {}) {
529
532
  if (!jobId?.trim()) throw new Error("jobId is required");
@@ -634,6 +637,7 @@ function createRiddleApiClient(config = {}) {
634
637
  0 && (module.exports = {
635
638
  DEFAULT_RIDDLE_API_BASE_URL,
636
639
  DEFAULT_RIDDLE_API_KEY_FILE,
640
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
637
641
  RiddleApiError,
638
642
  collectRiddlePreviewDeployWarnings,
639
643
  createRiddleApiClient,
@@ -1,5 +1,6 @@
1
1
  declare const DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
2
2
  declare const DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
3
+ declare const RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
3
4
  type RiddleFetch = typeof fetch;
4
5
  interface RiddleClientConfig {
5
6
  apiKey?: string;
@@ -171,4 +172,4 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
171
172
  pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
172
173
  };
173
174
 
174
- export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, 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 };
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 };
@@ -1,5 +1,6 @@
1
1
  declare const DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
2
2
  declare const DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
3
+ declare const RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
3
4
  type RiddleFetch = typeof fetch;
4
5
  interface RiddleClientConfig {
5
6
  apiKey?: string;
@@ -171,4 +172,4 @@ declare function createRiddleApiClient(config?: RiddleClientConfig): {
171
172
  pollJob: (jobId: string, options?: RiddlePollJobOptions) => Promise<RiddlePollJobResult>;
172
173
  };
173
174
 
174
- export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, 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 };
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 };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DEFAULT_RIDDLE_API_BASE_URL,
3
3
  DEFAULT_RIDDLE_API_KEY_FILE,
4
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
4
5
  RiddleApiError,
5
6
  collectRiddlePreviewDeployWarnings,
6
7
  createRiddleApiClient,
@@ -15,11 +16,12 @@ import {
15
16
  riddleRequestJson,
16
17
  runRiddleScript,
17
18
  runRiddleServerPreview
18
- } from "./chunk-DI2XNGEZ.js";
19
+ } from "./chunk-B2DP2LET.js";
19
20
  import "./chunk-MLKGABMK.js";
20
21
  export {
21
22
  DEFAULT_RIDDLE_API_BASE_URL,
22
23
  DEFAULT_RIDDLE_API_KEY_FILE,
24
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
23
25
  RiddleApiError,
24
26
  collectRiddlePreviewDeployWarnings,
25
27
  createRiddleApiClient,
@@ -32,6 +32,7 @@ var runtime_exports = {};
32
32
  __export(runtime_exports, {
33
33
  DEFAULT_RIDDLE_API_BASE_URL: () => DEFAULT_RIDDLE_API_BASE_URL,
34
34
  DEFAULT_RIDDLE_API_KEY_FILE: () => DEFAULT_RIDDLE_API_KEY_FILE,
35
+ RIDDLE_UNSUBMITTED_WAKE_HINT: () => RIDDLE_UNSUBMITTED_WAKE_HINT,
35
36
  RiddleApiError: () => RiddleApiError,
36
37
  collectRiddlePreviewDeployWarnings: () => collectRiddlePreviewDeployWarnings,
37
38
  createRiddleApiClient: () => createRiddleApiClient,
@@ -56,6 +57,7 @@ var import_node_os = require("os");
56
57
  var import_node_path = __toESM(require("path"), 1);
57
58
  var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
58
59
  var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
60
+ var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
59
61
  var RiddleApiError = class extends Error {
60
62
  constructor(pathname, status, body) {
61
63
  super(`Riddle API ${pathname} failed HTTP ${status}: ${body}`);
@@ -523,9 +525,10 @@ function buildPollSnapshot(jobId, job, input) {
523
525
  function pollMessage(snapshot, timedOut) {
524
526
  if (!timedOut) return void 0;
525
527
  const submitted = snapshot.submitted_at || "not submitted";
528
+ const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
526
529
  const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
527
530
  const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
528
- return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
531
+ 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}`;
529
532
  }
530
533
  async function pollRiddleJob(config, jobId, options = {}) {
531
534
  if (!jobId?.trim()) throw new Error("jobId is required");
@@ -636,6 +639,7 @@ function createRiddleApiClient(config = {}) {
636
639
  0 && (module.exports = {
637
640
  DEFAULT_RIDDLE_API_BASE_URL,
638
641
  DEFAULT_RIDDLE_API_KEY_FILE,
642
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
639
643
  RiddleApiError,
640
644
  collectRiddlePreviewDeployWarnings,
641
645
  createRiddleApiClient,
@@ -1 +1 @@
1
- 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';
1
+ export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, 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';
@@ -1 +1 @@
1
- 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';
1
+ export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, 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';
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DEFAULT_RIDDLE_API_BASE_URL,
3
3
  DEFAULT_RIDDLE_API_KEY_FILE,
4
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
4
5
  RiddleApiError,
5
6
  collectRiddlePreviewDeployWarnings,
6
7
  createRiddleApiClient,
@@ -15,11 +16,12 @@ import {
15
16
  riddleRequestJson,
16
17
  runRiddleScript,
17
18
  runRiddleServerPreview
18
- } from "../chunk-DI2XNGEZ.js";
19
+ } from "../chunk-B2DP2LET.js";
19
20
  import "../chunk-MLKGABMK.js";
20
21
  export {
21
22
  DEFAULT_RIDDLE_API_BASE_URL,
22
23
  DEFAULT_RIDDLE_API_KEY_FILE,
24
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
23
25
  RiddleApiError,
24
26
  collectRiddlePreviewDeployWarnings,
25
27
  createRiddleApiClient,
@@ -32,6 +32,7 @@ var riddle_client_exports = {};
32
32
  __export(riddle_client_exports, {
33
33
  DEFAULT_RIDDLE_API_BASE_URL: () => DEFAULT_RIDDLE_API_BASE_URL,
34
34
  DEFAULT_RIDDLE_API_KEY_FILE: () => DEFAULT_RIDDLE_API_KEY_FILE,
35
+ RIDDLE_UNSUBMITTED_WAKE_HINT: () => RIDDLE_UNSUBMITTED_WAKE_HINT,
35
36
  RiddleApiError: () => RiddleApiError,
36
37
  collectRiddlePreviewDeployWarnings: () => collectRiddlePreviewDeployWarnings,
37
38
  createRiddleApiClient: () => createRiddleApiClient,
@@ -56,6 +57,7 @@ var import_node_os = require("os");
56
57
  var import_node_path = __toESM(require("path"), 1);
57
58
  var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
58
59
  var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
60
+ var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
59
61
  var RiddleApiError = class extends Error {
60
62
  constructor(pathname, status, body) {
61
63
  super(`Riddle API ${pathname} failed HTTP ${status}: ${body}`);
@@ -523,9 +525,10 @@ function buildPollSnapshot(jobId, job, input) {
523
525
  function pollMessage(snapshot, timedOut) {
524
526
  if (!timedOut) return void 0;
525
527
  const submitted = snapshot.submitted_at || "not submitted";
528
+ const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
526
529
  const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
527
530
  const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
528
- return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
531
+ 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}`;
529
532
  }
530
533
  async function pollRiddleJob(config, jobId, options = {}) {
531
534
  if (!jobId?.trim()) throw new Error("jobId is required");
@@ -636,6 +639,7 @@ function createRiddleApiClient(config = {}) {
636
639
  0 && (module.exports = {
637
640
  DEFAULT_RIDDLE_API_BASE_URL,
638
641
  DEFAULT_RIDDLE_API_KEY_FILE,
642
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
639
643
  RiddleApiError,
640
644
  collectRiddlePreviewDeployWarnings,
641
645
  createRiddleApiClient,
@@ -1 +1 @@
1
- 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';
1
+ export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, 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';
@@ -1 +1 @@
1
- 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';
1
+ export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RIDDLE_UNSUBMITTED_WAKE_HINT, 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';
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DEFAULT_RIDDLE_API_BASE_URL,
3
3
  DEFAULT_RIDDLE_API_KEY_FILE,
4
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
4
5
  RiddleApiError,
5
6
  collectRiddlePreviewDeployWarnings,
6
7
  createRiddleApiClient,
@@ -15,11 +16,12 @@ import {
15
16
  riddleRequestJson,
16
17
  runRiddleScript,
17
18
  runRiddleServerPreview
18
- } from "../chunk-DI2XNGEZ.js";
19
+ } from "../chunk-B2DP2LET.js";
19
20
  import "../chunk-MLKGABMK.js";
20
21
  export {
21
22
  DEFAULT_RIDDLE_API_BASE_URL,
22
23
  DEFAULT_RIDDLE_API_KEY_FILE,
24
+ RIDDLE_UNSUBMITTED_WAKE_HINT,
23
25
  RiddleApiError,
24
26
  collectRiddlePreviewDeployWarnings,
25
27
  createRiddleApiClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.64",
3
+ "version": "0.8.66",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -129,6 +129,11 @@
129
129
  "import": "./dist/profile.js",
130
130
  "require": "./dist/profile.cjs"
131
131
  },
132
+ "./profile-suggestions": {
133
+ "types": "./dist/profile-suggestions.d.ts",
134
+ "import": "./dist/profile-suggestions.js",
135
+ "require": "./dist/profile-suggestions.cjs"
136
+ },
132
137
  "./pr-comment": {
133
138
  "types": "./dist/pr-comment.d.ts",
134
139
  "import": "./dist/pr-comment.js",
@@ -239,7 +244,7 @@
239
244
  "typescript": "^5.4.5"
240
245
  },
241
246
  "scripts": {
242
- "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/public-state.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/spec/public-state.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",
247
+ "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/public-state.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/profile-suggestions.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/spec/public-state.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",
243
248
  "clean": "rm -rf dist",
244
249
  "lint": "echo 'lint: (not configured)'",
245
250
  "test": "npm run build && node test.js && node proof-run.test.js && node formal-conformance.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))"