@riddledc/riddle-proof 0.7.141 → 0.7.143

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.
@@ -4966,8 +4966,11 @@ async function setupEvaluateWindowScript(context, script, args, storeReturnTo, c
4966
4966
  const body = String(script || "");
4967
4967
  if (!body.trim()) return { ok: false, reason: "missing_script" };
4968
4968
  try {
4969
- const run = new Function("args", "\"use strict\"; return (async () => {\\n" + body + "\\n})();");
4970
- const returned = await run(Array.isArray(args) ? args : []);
4969
+ const evaluator = window[["ev", "al"].join("")];
4970
+ if (typeof evaluator !== "function") return { ok: false, reason: "missing_evaluator" };
4971
+ const argsJson = JSON.stringify(Array.isArray(args) ? args : []);
4972
+ const wrapped = "\"use strict\"; (async () => { const args = " + argsJson + ";\n" + body + "\n})()";
4973
+ const returned = await evaluator.call(window, wrapped);
4971
4974
  const jsonReturned = toJsonValue(returned);
4972
4975
  const returnedForResult = captureReturn === false ? undefined : jsonReturned;
4973
4976
  if (storeReturnTo) {
package/dist/cli.cjs CHANGED
@@ -11887,8 +11887,11 @@ async function setupEvaluateWindowScript(context, script, args, storeReturnTo, c
11887
11887
  const body = String(script || "");
11888
11888
  if (!body.trim()) return { ok: false, reason: "missing_script" };
11889
11889
  try {
11890
- const run = new Function("args", "\"use strict\"; return (async () => {\\n" + body + "\\n})();");
11891
- const returned = await run(Array.isArray(args) ? args : []);
11890
+ const evaluator = window[["ev", "al"].join("")];
11891
+ if (typeof evaluator !== "function") return { ok: false, reason: "missing_evaluator" };
11892
+ const argsJson = JSON.stringify(Array.isArray(args) ? args : []);
11893
+ const wrapped = "\"use strict\"; (async () => { const args = " + argsJson + ";\n" + body + "\n})()";
11894
+ const returned = await evaluator.call(window, wrapped);
11892
11895
  const jsonReturned = toJsonValue(returned);
11893
11896
  const returnedForResult = captureReturn === false ? undefined : jsonReturned;
11894
11897
  if (storeReturnTo) {
@@ -14648,6 +14651,10 @@ function profileResultMarkdown(result) {
14648
14651
  if (environmentBlockerLines.length) {
14649
14652
  lines.push("", "## Environment Blocker", "", ...environmentBlockerLines);
14650
14653
  }
14654
+ const riddleJobLines = profileRiddleJobMarkdown(result);
14655
+ if (riddleJobLines.length) {
14656
+ lines.push("", "## Riddle Job", "", ...riddleJobLines);
14657
+ }
14651
14658
  if (result.artifacts.riddle_artifacts?.length) {
14652
14659
  lines.push("", "## Riddle Artifacts", "");
14653
14660
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -14657,6 +14664,34 @@ function profileResultMarkdown(result) {
14657
14664
  return `${lines.join("\n")}
14658
14665
  `;
14659
14666
  }
14667
+ function profileRiddleJobMarkdown(result) {
14668
+ const riddle = cliRecord(result.riddle);
14669
+ if (!riddle) return [];
14670
+ const jobId = cliString(riddle.job_id);
14671
+ const status = cliString(riddle.status);
14672
+ const terminal = typeof riddle.terminal === "boolean" ? riddle.terminal : void 0;
14673
+ const queueElapsedMs = cliFiniteNumber(riddle.queue_elapsed_ms);
14674
+ const elapsedMs3 = cliFiniteNumber(riddle.elapsed_ms);
14675
+ const attempt = cliFiniteNumber(riddle.attempt);
14676
+ const attempts = cliFiniteNumber(riddle.attempts);
14677
+ const submittedAt = cliString(riddle.submitted_at);
14678
+ const completedAt = cliString(riddle.completed_at);
14679
+ const parts = [
14680
+ jobId ? `job ${markdownInlineCode(jobId)}` : "",
14681
+ status ? `status ${markdownInlineCode(status)}` : "",
14682
+ terminal === void 0 ? "" : `terminal ${terminal ? "true" : "false"}`
14683
+ ].filter(Boolean);
14684
+ const lines = parts.length ? [`- ${parts.join(", ")}`] : [];
14685
+ if (queueElapsedMs !== void 0 || elapsedMs3 !== void 0 || attempt !== void 0 || attempts !== void 0) {
14686
+ lines.push(
14687
+ `- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs3)}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
14688
+ );
14689
+ }
14690
+ if (submittedAt || completedAt) {
14691
+ lines.push(`- timing:${submittedAt ? ` submitted ${markdownInlineCode(submittedAt)}` : ""}${completedAt ? ` completed ${markdownInlineCode(completedAt)}` : ""}`);
14692
+ }
14693
+ return lines;
14694
+ }
14660
14695
  function markdownInlineCode(value, maxLength = 80) {
14661
14696
  const normalized = value.replace(/\s+/g, " ").trim();
14662
14697
  const clipped = normalized.length > maxLength ? `${normalized.slice(0, Math.max(0, maxLength - 3))}...` : normalized;
@@ -15200,13 +15235,22 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
15200
15235
  return void 0;
15201
15236
  }
15202
15237
  function withRiddleMetadata(result, input) {
15238
+ const poll = input.poll;
15203
15239
  return {
15204
15240
  ...result,
15205
15241
  riddle: {
15206
15242
  ...result.riddle || {},
15207
15243
  job_id: input.job_id || result.riddle?.job_id,
15208
15244
  status: input.status ?? result.riddle?.status,
15209
- terminal: input.terminal ?? result.riddle?.terminal
15245
+ terminal: input.terminal ?? result.riddle?.terminal,
15246
+ created_at: poll?.created_at ?? result.riddle?.created_at,
15247
+ submitted_at: poll?.submitted_at ?? result.riddle?.submitted_at,
15248
+ completed_at: poll?.completed_at ?? result.riddle?.completed_at,
15249
+ queue_elapsed_ms: poll?.queue_elapsed_ms ?? result.riddle?.queue_elapsed_ms,
15250
+ elapsed_ms: poll?.elapsed_ms ?? result.riddle?.elapsed_ms,
15251
+ attempt: poll?.attempt ?? result.riddle?.attempt,
15252
+ attempts: poll?.attempts ?? result.riddle?.attempts,
15253
+ timed_out: poll?.timed_out ?? result.riddle?.timed_out
15210
15254
  },
15211
15255
  artifacts: {
15212
15256
  ...result.artifacts,
@@ -15214,6 +15258,21 @@ function withRiddleMetadata(result, input) {
15214
15258
  }
15215
15259
  };
15216
15260
  }
15261
+ function riddleMetadataFromPoll(jobId, poll) {
15262
+ return {
15263
+ job_id: jobId,
15264
+ status: poll.status,
15265
+ terminal: poll.terminal,
15266
+ created_at: poll.poll?.created_at,
15267
+ submitted_at: poll.poll?.submitted_at,
15268
+ completed_at: poll.poll?.completed_at,
15269
+ queue_elapsed_ms: poll.poll?.queue_elapsed_ms,
15270
+ elapsed_ms: poll.poll?.elapsed_ms,
15271
+ attempt: poll.poll?.attempt,
15272
+ attempts: poll.poll?.attempts,
15273
+ timed_out: poll.poll?.timed_out
15274
+ };
15275
+ }
15217
15276
  async function runProfileForCli(profile, options) {
15218
15277
  const runner = optionString(options, "runner") || "riddle";
15219
15278
  if (runner !== "riddle") {
@@ -15258,7 +15317,7 @@ async function runProfileForCli(profile, options) {
15258
15317
  profile,
15259
15318
  runner,
15260
15319
  error: `Riddle job ${jobId} ended with status ${poll.status || "unknown"}.`,
15261
- riddle: { job_id: jobId, status: poll.status, terminal: poll.terminal },
15320
+ riddle: riddleMetadataFromPoll(jobId, poll),
15262
15321
  artifacts
15263
15322
  });
15264
15323
  }
@@ -15267,7 +15326,7 @@ async function runProfileForCli(profile, options) {
15267
15326
  return createRiddleProofProfileInsufficientResult({
15268
15327
  profile,
15269
15328
  runner,
15270
- riddle: { job_id: jobId, status: poll.status, terminal: poll.terminal },
15329
+ riddle: riddleMetadataFromPoll(jobId, poll),
15271
15330
  artifacts
15272
15331
  });
15273
15332
  }
@@ -15275,6 +15334,7 @@ async function runProfileForCli(profile, options) {
15275
15334
  job_id: jobId,
15276
15335
  status: poll.status,
15277
15336
  terminal: poll.terminal,
15337
+ poll: poll.poll,
15278
15338
  artifacts
15279
15339
  });
15280
15340
  }
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  profileStatusExitCode,
13
13
  resolveRiddleProofProfileTargetUrl,
14
14
  resolveRiddleProofProfileTimeoutSec
15
- } from "./chunk-F46O7DP2.js";
15
+ } from "./chunk-66RDQVFI.js";
16
16
  import {
17
17
  createRiddleApiClient,
18
18
  parseRiddleViewport
@@ -398,6 +398,10 @@ function profileResultMarkdown(result) {
398
398
  if (environmentBlockerLines.length) {
399
399
  lines.push("", "## Environment Blocker", "", ...environmentBlockerLines);
400
400
  }
401
+ const riddleJobLines = profileRiddleJobMarkdown(result);
402
+ if (riddleJobLines.length) {
403
+ lines.push("", "## Riddle Job", "", ...riddleJobLines);
404
+ }
401
405
  if (result.artifacts.riddle_artifacts?.length) {
402
406
  lines.push("", "## Riddle Artifacts", "");
403
407
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -407,6 +411,34 @@ function profileResultMarkdown(result) {
407
411
  return `${lines.join("\n")}
408
412
  `;
409
413
  }
414
+ function profileRiddleJobMarkdown(result) {
415
+ const riddle = cliRecord(result.riddle);
416
+ if (!riddle) return [];
417
+ const jobId = cliString(riddle.job_id);
418
+ const status = cliString(riddle.status);
419
+ const terminal = typeof riddle.terminal === "boolean" ? riddle.terminal : void 0;
420
+ const queueElapsedMs = cliFiniteNumber(riddle.queue_elapsed_ms);
421
+ const elapsedMs = cliFiniteNumber(riddle.elapsed_ms);
422
+ const attempt = cliFiniteNumber(riddle.attempt);
423
+ const attempts = cliFiniteNumber(riddle.attempts);
424
+ const submittedAt = cliString(riddle.submitted_at);
425
+ const completedAt = cliString(riddle.completed_at);
426
+ const parts = [
427
+ jobId ? `job ${markdownInlineCode(jobId)}` : "",
428
+ status ? `status ${markdownInlineCode(status)}` : "",
429
+ terminal === void 0 ? "" : `terminal ${terminal ? "true" : "false"}`
430
+ ].filter(Boolean);
431
+ const lines = parts.length ? [`- ${parts.join(", ")}`] : [];
432
+ if (queueElapsedMs !== void 0 || elapsedMs !== void 0 || attempt !== void 0 || attempts !== void 0) {
433
+ lines.push(
434
+ `- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs)}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
435
+ );
436
+ }
437
+ if (submittedAt || completedAt) {
438
+ lines.push(`- timing:${submittedAt ? ` submitted ${markdownInlineCode(submittedAt)}` : ""}${completedAt ? ` completed ${markdownInlineCode(completedAt)}` : ""}`);
439
+ }
440
+ return lines;
441
+ }
410
442
  function markdownInlineCode(value, maxLength = 80) {
411
443
  const normalized = value.replace(/\s+/g, " ").trim();
412
444
  const clipped = normalized.length > maxLength ? `${normalized.slice(0, Math.max(0, maxLength - 3))}...` : normalized;
@@ -950,13 +982,22 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
950
982
  return void 0;
951
983
  }
952
984
  function withRiddleMetadata(result, input) {
985
+ const poll = input.poll;
953
986
  return {
954
987
  ...result,
955
988
  riddle: {
956
989
  ...result.riddle || {},
957
990
  job_id: input.job_id || result.riddle?.job_id,
958
991
  status: input.status ?? result.riddle?.status,
959
- terminal: input.terminal ?? result.riddle?.terminal
992
+ terminal: input.terminal ?? result.riddle?.terminal,
993
+ created_at: poll?.created_at ?? result.riddle?.created_at,
994
+ submitted_at: poll?.submitted_at ?? result.riddle?.submitted_at,
995
+ completed_at: poll?.completed_at ?? result.riddle?.completed_at,
996
+ queue_elapsed_ms: poll?.queue_elapsed_ms ?? result.riddle?.queue_elapsed_ms,
997
+ elapsed_ms: poll?.elapsed_ms ?? result.riddle?.elapsed_ms,
998
+ attempt: poll?.attempt ?? result.riddle?.attempt,
999
+ attempts: poll?.attempts ?? result.riddle?.attempts,
1000
+ timed_out: poll?.timed_out ?? result.riddle?.timed_out
960
1001
  },
961
1002
  artifacts: {
962
1003
  ...result.artifacts,
@@ -964,6 +1005,21 @@ function withRiddleMetadata(result, input) {
964
1005
  }
965
1006
  };
966
1007
  }
1008
+ function riddleMetadataFromPoll(jobId, poll) {
1009
+ return {
1010
+ job_id: jobId,
1011
+ status: poll.status,
1012
+ terminal: poll.terminal,
1013
+ created_at: poll.poll?.created_at,
1014
+ submitted_at: poll.poll?.submitted_at,
1015
+ completed_at: poll.poll?.completed_at,
1016
+ queue_elapsed_ms: poll.poll?.queue_elapsed_ms,
1017
+ elapsed_ms: poll.poll?.elapsed_ms,
1018
+ attempt: poll.poll?.attempt,
1019
+ attempts: poll.poll?.attempts,
1020
+ timed_out: poll.poll?.timed_out
1021
+ };
1022
+ }
967
1023
  async function runProfileForCli(profile, options) {
968
1024
  const runner = optionString(options, "runner") || "riddle";
969
1025
  if (runner !== "riddle") {
@@ -1008,7 +1064,7 @@ async function runProfileForCli(profile, options) {
1008
1064
  profile,
1009
1065
  runner,
1010
1066
  error: `Riddle job ${jobId} ended with status ${poll.status || "unknown"}.`,
1011
- riddle: { job_id: jobId, status: poll.status, terminal: poll.terminal },
1067
+ riddle: riddleMetadataFromPoll(jobId, poll),
1012
1068
  artifacts
1013
1069
  });
1014
1070
  }
@@ -1017,7 +1073,7 @@ async function runProfileForCli(profile, options) {
1017
1073
  return createRiddleProofProfileInsufficientResult({
1018
1074
  profile,
1019
1075
  runner,
1020
- riddle: { job_id: jobId, status: poll.status, terminal: poll.terminal },
1076
+ riddle: riddleMetadataFromPoll(jobId, poll),
1021
1077
  artifacts
1022
1078
  });
1023
1079
  }
@@ -1025,6 +1081,7 @@ async function runProfileForCli(profile, options) {
1025
1081
  job_id: jobId,
1026
1082
  status: poll.status,
1027
1083
  terminal: poll.terminal,
1084
+ poll: poll.poll,
1028
1085
  artifacts
1029
1086
  });
1030
1087
  }
package/dist/index.cjs CHANGED
@@ -13699,8 +13699,11 @@ async function setupEvaluateWindowScript(context, script, args, storeReturnTo, c
13699
13699
  const body = String(script || "");
13700
13700
  if (!body.trim()) return { ok: false, reason: "missing_script" };
13701
13701
  try {
13702
- const run = new Function("args", "\"use strict\"; return (async () => {\\n" + body + "\\n})();");
13703
- const returned = await run(Array.isArray(args) ? args : []);
13702
+ const evaluator = window[["ev", "al"].join("")];
13703
+ if (typeof evaluator !== "function") return { ok: false, reason: "missing_evaluator" };
13704
+ const argsJson = JSON.stringify(Array.isArray(args) ? args : []);
13705
+ const wrapped = "\"use strict\"; (async () => { const args = " + argsJson + ";\n" + body + "\n})()";
13706
+ const returned = await evaluator.call(window, wrapped);
13704
13707
  const jsonReturned = toJsonValue(returned);
13705
13708
  const returnedForResult = captureReturn === false ? undefined : jsonReturned;
13706
13709
  if (storeReturnTo) {
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  resolveRiddleProofProfileTimeoutSec,
63
63
  slugifyRiddleProofProfileName,
64
64
  summarizeRiddleProofProfileResult
65
- } from "./chunk-F46O7DP2.js";
65
+ } from "./chunk-66RDQVFI.js";
66
66
  import {
67
67
  DEFAULT_RIDDLE_API_BASE_URL,
68
68
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -5013,8 +5013,11 @@ async function setupEvaluateWindowScript(context, script, args, storeReturnTo, c
5013
5013
  const body = String(script || "");
5014
5014
  if (!body.trim()) return { ok: false, reason: "missing_script" };
5015
5015
  try {
5016
- const run = new Function("args", "\"use strict\"; return (async () => {\\n" + body + "\\n})();");
5017
- const returned = await run(Array.isArray(args) ? args : []);
5016
+ const evaluator = window[["ev", "al"].join("")];
5017
+ if (typeof evaluator !== "function") return { ok: false, reason: "missing_evaluator" };
5018
+ const argsJson = JSON.stringify(Array.isArray(args) ? args : []);
5019
+ const wrapped = "\"use strict\"; (async () => { const args = " + argsJson + ";\n" + body + "\n})()";
5020
+ const returned = await evaluator.call(window, wrapped);
5018
5021
  const jsonReturned = toJsonValue(returned);
5019
5022
  const returnedForResult = captureReturn === false ? undefined : jsonReturned;
5020
5023
  if (storeReturnTo) {
@@ -379,6 +379,14 @@ interface RiddleProofProfileResult {
379
379
  job_id?: string;
380
380
  status?: string | null;
381
381
  terminal?: boolean;
382
+ created_at?: string | null;
383
+ submitted_at?: string | null;
384
+ completed_at?: string | null;
385
+ queue_elapsed_ms?: number | null;
386
+ elapsed_ms?: number;
387
+ attempt?: number;
388
+ attempts?: number;
389
+ timed_out?: boolean;
382
390
  };
383
391
  environment_blocker?: Record<string, JsonValue>;
384
392
  error?: string;
package/dist/profile.d.ts CHANGED
@@ -379,6 +379,14 @@ interface RiddleProofProfileResult {
379
379
  job_id?: string;
380
380
  status?: string | null;
381
381
  terminal?: boolean;
382
+ created_at?: string | null;
383
+ submitted_at?: string | null;
384
+ completed_at?: string | null;
385
+ queue_elapsed_ms?: number | null;
386
+ elapsed_ms?: number;
387
+ attempt?: number;
388
+ attempts?: number;
389
+ timed_out?: boolean;
382
390
  };
383
391
  environment_blocker?: Record<string, JsonValue>;
384
392
  error?: string;
package/dist/profile.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  resolveRiddleProofProfileTimeoutSec,
24
24
  slugifyRiddleProofProfileName,
25
25
  summarizeRiddleProofProfileResult
26
- } from "./chunk-F46O7DP2.js";
26
+ } from "./chunk-66RDQVFI.js";
27
27
  export {
28
28
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
29
29
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
295
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
385
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
662
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
295
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
385
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
662
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.141",
3
+ "version": "0.7.143",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",