@riddledc/riddle-proof 0.5.48 → 0.5.50

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.
@@ -39,6 +39,13 @@ var import_node_child_process = require("child_process");
39
39
  var import_node_fs = require("fs");
40
40
  var import_node_os = __toESM(require("os"), 1);
41
41
  var import_node_path = __toESM(require("path"), 1);
42
+
43
+ // src/result.ts
44
+ function compactRecord(input) {
45
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
46
+ }
47
+
48
+ // src/codex-exec-agent.ts
42
49
  var REFINED_INPUTS_SCHEMA = {
43
50
  type: "object",
44
51
  additionalProperties: false,
@@ -164,10 +171,11 @@ var PROOF_SCHEMA = {
164
171
  source: { type: "string", enum: ["supervising_agent"] }
165
172
  }
166
173
  };
167
- var PROMPT_STRING_LIMIT = 2e3;
168
- var PROMPT_ARRAY_LIMIT = 12;
169
- var PROMPT_OBJECT_KEY_LIMIT = 70;
170
- var PROMPT_BLOCK_LIMIT = 12e4;
174
+ var PROMPT_STRING_LIMIT = 1e3;
175
+ var PROMPT_ARRAY_LIMIT = 8;
176
+ var PROMPT_OBJECT_KEY_LIMIT = 50;
177
+ var PROMPT_BLOCK_LIMIT = 16e3;
178
+ var PROMPT_TOTAL_LIMIT = 58e3;
171
179
  var PROMPT_KEY_PRIORITY = [
172
180
  "ok",
173
181
  "status",
@@ -189,6 +197,16 @@ var PROMPT_KEY_PRIORITY = [
189
197
  "after_cdn",
190
198
  "before_baseline",
191
199
  "prod_baseline",
200
+ "route_hints",
201
+ "route_candidates",
202
+ "keyword_hits",
203
+ "observations",
204
+ "latest_attempt",
205
+ "attempt_history",
206
+ "current_plan",
207
+ "plan_history",
208
+ "decision_history",
209
+ "refined_inputs",
192
210
  "recon_assessment",
193
211
  "baseline_understanding",
194
212
  "supervisor_author_packet",
@@ -212,6 +230,7 @@ var PROMPT_KEY_PRIORITY = [
212
230
  "shipGate",
213
231
  "last_error",
214
232
  "errors",
233
+ "runtime_events",
215
234
  "events"
216
235
  ];
217
236
  var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
@@ -228,7 +247,7 @@ function compactPromptValue(value, depth = 0, key = "") {
228
247
  if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
229
248
  return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
230
249
  }
231
- const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 1200;
250
+ const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
232
251
  return truncatePromptString(value, limit);
233
252
  }
234
253
  if (Array.isArray(value)) {
@@ -271,7 +290,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
271
290
  return after || fallback;
272
291
  }
273
292
  function basePrompt(context, role) {
274
- return [
293
+ const prompt = [
275
294
  role,
276
295
  "",
277
296
  "You are the supervising Codex worker inside the Riddle Proof harness.",
@@ -283,6 +302,9 @@ function basePrompt(context, role) {
283
302
  jsonBlock("Riddle checkpoint result", context.engineResult),
284
303
  jsonBlock("Full riddle state", context.fullRiddleState || {})
285
304
  ].join("\n");
305
+ if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
306
+ return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
307
+ ...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
286
308
  }
287
309
  function schemaRequiredKeys(schema) {
288
310
  const required = schema?.required;
@@ -359,11 +381,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
359
381
  const text = blocker.toLowerCase();
360
382
  return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
361
383
  }
384
+ function runnerMetrics(input) {
385
+ const schemaText = JSON.stringify(input.request.schema);
386
+ const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
387
+ return compactRecord({
388
+ purpose: input.request.purpose,
389
+ workdir: input.request.workdir,
390
+ started_at: input.startedAt,
391
+ finished_at: finishedAt,
392
+ duration_ms: Date.now() - input.startedMs,
393
+ prompt_chars: input.request.prompt.length,
394
+ prompt_lines: input.request.prompt.split(/\r?\n/).length,
395
+ schema_chars: schemaText.length,
396
+ stdout_chars: (input.stdout || "").length,
397
+ stderr_chars: (input.stderr || "").length,
398
+ final_message_chars: (input.finalText || "").length,
399
+ exit_status: input.status ?? null,
400
+ timed_out: input.timedOut || false,
401
+ error_code: input.errorCode,
402
+ codex_command: input.config.codexCommand || "codex",
403
+ codex_model: input.config.codexModel,
404
+ codex_sandbox: input.config.codexSandbox || "workspace-write",
405
+ codex_full_auto: input.config.codexFullAuto !== false,
406
+ timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
407
+ });
408
+ }
362
409
  function createCodexExecJsonRunner(config = {}) {
363
410
  return (request) => {
411
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
412
+ const startedMs = Date.now();
364
413
  if (!request.workdir || !(0, import_node_fs.existsSync)(request.workdir)) {
365
414
  return {
366
415
  ok: false,
416
+ metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
367
417
  blocker: {
368
418
  code: "codex_workdir_missing",
369
419
  message: `Codex workdir does not exist for ${request.purpose}.`,
@@ -408,6 +458,17 @@ function createCodexExecJsonRunner(config = {}) {
408
458
  ok: false,
409
459
  stdout: proc.stdout || "",
410
460
  stderr: proc.stderr || "",
461
+ metrics: runnerMetrics({
462
+ request,
463
+ config,
464
+ startedAt,
465
+ startedMs,
466
+ stdout: proc.stdout || "",
467
+ stderr: proc.stderr || "",
468
+ status: proc.status,
469
+ timedOut,
470
+ errorCode: proc.error.code || "spawn_error"
471
+ }),
411
472
  blocker: {
412
473
  code: timedOut ? "codex_timeout" : "codex_exec_error",
413
474
  message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
@@ -420,6 +481,16 @@ function createCodexExecJsonRunner(config = {}) {
420
481
  ok: false,
421
482
  stdout: proc.stdout || "",
422
483
  stderr: proc.stderr || "",
484
+ metrics: runnerMetrics({
485
+ request,
486
+ config,
487
+ startedAt,
488
+ startedMs,
489
+ stdout: proc.stdout || "",
490
+ stderr: proc.stderr || "",
491
+ status: proc.status,
492
+ errorCode: "nonzero_exit"
493
+ }),
423
494
  blocker: {
424
495
  code: "codex_nonzero_exit",
425
496
  message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
@@ -434,6 +505,17 @@ function createCodexExecJsonRunner(config = {}) {
434
505
  ok: false,
435
506
  stdout: proc.stdout || "",
436
507
  stderr: proc.stderr || "",
508
+ metrics: runnerMetrics({
509
+ request,
510
+ config,
511
+ startedAt,
512
+ startedMs,
513
+ stdout: proc.stdout || "",
514
+ stderr: proc.stderr || "",
515
+ finalText,
516
+ status: proc.status,
517
+ errorCode: "invalid_json"
518
+ }),
437
519
  blocker: {
438
520
  code: "codex_invalid_json",
439
521
  message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
@@ -445,7 +527,17 @@ function createCodexExecJsonRunner(config = {}) {
445
527
  ok: true,
446
528
  json: parsed,
447
529
  stdout: proc.stdout || "",
448
- stderr: proc.stderr || ""
530
+ stderr: proc.stderr || "",
531
+ metrics: runnerMetrics({
532
+ request,
533
+ config,
534
+ startedAt,
535
+ startedMs,
536
+ stdout: proc.stdout || "",
537
+ stderr: proc.stderr || "",
538
+ finalText,
539
+ status: proc.status
540
+ })
449
541
  };
450
542
  } finally {
451
543
  (0, import_node_fs.rmSync)(tmpDir, { recursive: true, force: true });
@@ -466,14 +558,21 @@ function payloadOrBlocker(raw, checkpoint) {
466
558
  ok: false,
467
559
  blocker: {
468
560
  ...blocker,
469
- checkpoint
561
+ checkpoint,
562
+ details: {
563
+ ...blocker.details || {},
564
+ runner_metrics: raw.metrics || null
565
+ }
470
566
  }
471
567
  };
472
568
  }
473
569
  return {
474
570
  ok: true,
475
571
  payload: raw.json,
476
- summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
572
+ summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
573
+ details: compactRecord({
574
+ runner_metrics: raw.metrics || null
575
+ })
477
576
  };
478
577
  }
479
578
  function stringArray(value) {
@@ -609,14 +708,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
609
708
  agent_summary: summary,
610
709
  agent_changed_files: changedFiles,
611
710
  agent_tests_run: testsRun,
612
- agent_blockers: blockers
711
+ agent_blockers: blockers,
712
+ runner_metrics: raw.metrics || null
613
713
  };
614
714
  attemptSummaries.push({
615
715
  purpose,
616
716
  summary,
617
717
  changed_files: changedFiles,
618
718
  tests_run: testsRun,
619
- blockers
719
+ blockers,
720
+ runner_metrics: raw.metrics || null
620
721
  });
621
722
  if (hardBlockers.length) {
622
723
  return {
@@ -21,6 +21,7 @@ interface CodexJsonResult {
21
21
  stdout?: string;
22
22
  stderr?: string;
23
23
  blocker?: RiddleProofBlocker;
24
+ metrics?: Record<string, unknown>;
24
25
  }
25
26
  type CodexJsonRunner = (request: CodexJsonRequest) => Promise<CodexJsonResult> | CodexJsonResult;
26
27
  declare function createCodexExecJsonRunner(config?: CodexExecAgentConfig): CodexJsonRunner;
@@ -21,6 +21,7 @@ interface CodexJsonResult {
21
21
  stdout?: string;
22
22
  stderr?: string;
23
23
  blocker?: RiddleProofBlocker;
24
+ metrics?: Record<string, unknown>;
24
25
  }
25
26
  type CodexJsonRunner = (request: CodexJsonRequest) => Promise<CodexJsonResult> | CodexJsonResult;
26
27
  declare function createCodexExecJsonRunner(config?: CodexExecAgentConfig): CodexJsonRunner;
@@ -2,7 +2,8 @@ import {
2
2
  createCodexExecAgentAdapter,
3
3
  createCodexExecJsonRunner,
4
4
  runCodexExecAgentDoctor
5
- } from "./chunk-NOBFZDZG.js";
5
+ } from "./chunk-3266V3MO.js";
6
+ import "./chunk-DUFDZJOF.js";
6
7
  export {
7
8
  createCodexExecAgentAdapter,
8
9
  createCodexExecJsonRunner,
@@ -3654,6 +3654,68 @@ function compactText2(value, limit = 600) {
3654
3654
  if (!text) return void 0;
3655
3655
  return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
3656
3656
  }
3657
+ function numericValue(value) {
3658
+ const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
3659
+ return Number.isFinite(number) ? number : void 0;
3660
+ }
3661
+ function eventDetails(event) {
3662
+ return recordValue(recordValue(event)?.details) || {};
3663
+ }
3664
+ function collectRunnerMetrics(details) {
3665
+ const metrics = [];
3666
+ const adapterDetails = recordValue(details.adapter_details);
3667
+ const direct = recordValue(adapterDetails?.runner_metrics);
3668
+ if (direct) metrics.push(direct);
3669
+ const attempts = Array.isArray(adapterDetails?.attempt_summaries) ? adapterDetails.attempt_summaries : [];
3670
+ for (const attempt of attempts) {
3671
+ const attemptMetrics = recordValue(recordValue(attempt)?.runner_metrics);
3672
+ if (attemptMetrics) metrics.push(attemptMetrics);
3673
+ }
3674
+ return metrics;
3675
+ }
3676
+ function observabilityFrom(state) {
3677
+ const engineEvents = state.events.filter((event) => event.kind === "engine.result").map((event) => ({ event, details: eventDetails(event) }));
3678
+ const agentEvents = state.events.filter((event) => event.kind.startsWith("agent.")).map((event) => ({ event, details: eventDetails(event) })).filter(({ details }) => numericValue(details.duration_ms) !== void 0);
3679
+ const retryEvents = state.events.filter((event) => /retry|recovery/i.test(event.kind) || /retry|recovery/i.test(event.summary || "")).slice(-8);
3680
+ const runnerMetrics = agentEvents.flatMap(({ details }) => collectRunnerMetrics(details));
3681
+ const promptChars = runnerMetrics.map((metrics) => numericValue(metrics.prompt_chars)).filter((value) => value !== void 0);
3682
+ const sum = (values) => values.reduce((total, value) => total + (value ?? 0), 0);
3683
+ const recentEngineTimings = engineEvents.slice(-8).map(({ event, details }) => compactRecord({
3684
+ checkpoint: event.checkpoint || null,
3685
+ stage: event.stage || null,
3686
+ duration_ms: numericValue(details.duration_ms),
3687
+ ok: details.ok ?? null
3688
+ }));
3689
+ const recentAgentTimings = agentEvents.slice(-8).map(({ event, details }) => {
3690
+ const metrics = collectRunnerMetrics(details);
3691
+ const localPromptChars = metrics.map((item) => numericValue(item.prompt_chars)).filter((value) => value !== void 0);
3692
+ return compactRecord({
3693
+ kind: event.kind,
3694
+ checkpoint: event.checkpoint || null,
3695
+ stage: event.stage || null,
3696
+ duration_ms: numericValue(details.duration_ms),
3697
+ prompt_chars: localPromptChars.length ? Math.max(...localPromptChars) : void 0,
3698
+ attempt_count: numericValue(recordValue(details.adapter_details)?.attempt_count)
3699
+ });
3700
+ });
3701
+ return compactRecord({
3702
+ engine_call_count: engineEvents.length,
3703
+ agent_call_count: agentEvents.length,
3704
+ engine_total_ms: sum(engineEvents.map(({ details }) => numericValue(details.duration_ms))),
3705
+ agent_total_ms: sum(agentEvents.map(({ details }) => numericValue(details.duration_ms))),
3706
+ max_agent_prompt_chars: promptChars.length ? Math.max(...promptChars) : void 0,
3707
+ total_agent_prompt_chars: promptChars.length ? sum(promptChars) : void 0,
3708
+ recent_engine_timings: recentEngineTimings.length ? recentEngineTimings : void 0,
3709
+ recent_agent_timings: recentAgentTimings.length ? recentAgentTimings : void 0,
3710
+ retry_event_count: retryEvents.length,
3711
+ recent_retry_reasons: retryEvents.length ? retryEvents.map((event) => compactRecord({
3712
+ kind: event.kind,
3713
+ checkpoint: event.checkpoint || null,
3714
+ stage: event.stage || null,
3715
+ summary: compactText2(event.summary, 240)
3716
+ })) : void 0
3717
+ });
3718
+ }
3657
3719
  function visualDeltaFrom(input) {
3658
3720
  const fullState = input.fullRiddleState || {};
3659
3721
  const bundle = recordValue(fullState.evidence_bundle);
@@ -3766,6 +3828,7 @@ function createRiddleProofRunCard(state, input = {}) {
3766
3828
  proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
3767
3829
  artifacts
3768
3830
  }),
3831
+ observability: observabilityFrom(state),
3769
3832
  stop_condition: compactRecord({
3770
3833
  status: state.status,
3771
3834
  terminal: isTerminalStatus(state.status),
@@ -4820,7 +4883,10 @@ async function handleImplementation(request, state, result, agent) {
4820
4883
  worktree_path: workdir || null
4821
4884
  }
4822
4885
  });
4886
+ const implementationStartedAt = timestamp3();
4887
+ const implementationStartedMs = Date.now();
4823
4888
  const implementation = await agent.implementChange({ ...context, workdir });
4889
+ const implementationDurationMs = Date.now() - implementationStartedMs;
4824
4890
  if (implementation.blocker || implementation.ok === false) {
4825
4891
  recordEvent(state, {
4826
4892
  kind: "agent.implementation.blocked",
@@ -4829,6 +4895,8 @@ async function handleImplementation(request, state, result, agent) {
4829
4895
  summary: implementation.summary || implementation.blocker?.message || "Implementation adapter reported a blocker.",
4830
4896
  details: compactRecord({
4831
4897
  worktree_path: workdir || null,
4898
+ started_at: implementationStartedAt,
4899
+ duration_ms: implementationDurationMs,
4832
4900
  changed_files: implementation.changedFiles || [],
4833
4901
  tests_run: implementation.testsRun || [],
4834
4902
  implementation_notes: implementation.implementationNotes || null,
@@ -4854,6 +4922,8 @@ async function handleImplementation(request, state, result, agent) {
4854
4922
  summary: implementation.summary || "Implementation adapter returned without leaving a detectable git diff.",
4855
4923
  details: compactRecord({
4856
4924
  worktree_path: workdir || null,
4925
+ started_at: implementationStartedAt,
4926
+ duration_ms: implementationDurationMs,
4857
4927
  changed_files: implementation.changedFiles || [],
4858
4928
  tests_run: implementation.testsRun || [],
4859
4929
  implementation_notes: implementation.implementationNotes || null,
@@ -4868,7 +4938,8 @@ async function handleImplementation(request, state, result, agent) {
4868
4938
  details: compactRecord({
4869
4939
  worktree_path: workdir || null,
4870
4940
  checkpoint: result.checkpoint || null,
4871
- next_stage: "implement"
4941
+ next_stage: "implement",
4942
+ previous_duration_ms: implementationDurationMs
4872
4943
  })
4873
4944
  });
4874
4945
  return {
@@ -4887,6 +4958,8 @@ async function handleImplementation(request, state, result, agent) {
4887
4958
  summary: implementation.summary || "Implementation adapter reported code changes.",
4888
4959
  details: {
4889
4960
  worktree_path: workdir || null,
4961
+ started_at: implementationStartedAt,
4962
+ duration_ms: implementationDurationMs,
4890
4963
  diffDetected,
4891
4964
  changed_files: implementation.changedFiles || [],
4892
4965
  tests_run: implementation.testsRun || [],
@@ -5003,15 +5076,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
5003
5076
  if (input.checkpoint_mode === "yield") {
5004
5077
  return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
5005
5078
  }
5079
+ const startedAt = timestamp3();
5080
+ const startedMs = Date.now();
5081
+ recordEvent(state, {
5082
+ kind: "agent.recon_assessment.started",
5083
+ checkpoint,
5084
+ stage: "recon",
5085
+ summary: "Recon assessment agent started.",
5086
+ details: { started_at: startedAt }
5087
+ });
5006
5088
  const assessment = await agent.assessRecon(context);
5089
+ const durationMs = Date.now() - startedMs;
5007
5090
  const blocker = requirePayload("recon_assessment", assessment, state, result);
5008
- if (blocker) return { blocker };
5091
+ if (blocker) {
5092
+ recordEvent(state, {
5093
+ kind: "agent.recon_assessment.blocked",
5094
+ checkpoint,
5095
+ stage: "recon",
5096
+ summary: blocker.message,
5097
+ details: compactRecord({
5098
+ started_at: startedAt,
5099
+ duration_ms: durationMs,
5100
+ blocker,
5101
+ adapter_details: assessment.details || null
5102
+ })
5103
+ });
5104
+ return { blocker };
5105
+ }
5009
5106
  recordEvent(state, {
5010
5107
  kind: "agent.recon_assessment.completed",
5011
5108
  checkpoint,
5012
5109
  stage: "recon",
5013
5110
  summary: assessment.summary,
5014
- details: { payload: assessment.payload }
5111
+ details: compactRecord({
5112
+ payload: assessment.payload,
5113
+ started_at: startedAt,
5114
+ duration_ms: durationMs,
5115
+ adapter_details: assessment.details || null
5116
+ })
5015
5117
  });
5016
5118
  return {
5017
5119
  next: { ...baseContinuation(result), recon_assessment_json: jsonParam(assessment.payload) }
@@ -5023,15 +5125,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
5023
5125
  if (input.checkpoint_mode === "yield") {
5024
5126
  return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
5025
5127
  }
5128
+ const startedAt = timestamp3();
5129
+ const startedMs = Date.now();
5130
+ recordEvent(state, {
5131
+ kind: "agent.author_packet.started",
5132
+ checkpoint,
5133
+ stage: "author",
5134
+ summary: "Proof authoring agent started.",
5135
+ details: { started_at: startedAt }
5136
+ });
5026
5137
  const packet = await agent.authorProofPacket(context);
5138
+ const durationMs = Date.now() - startedMs;
5027
5139
  const blocker = requirePayload("author_packet", packet, state, result);
5028
- if (blocker) return { blocker };
5140
+ if (blocker) {
5141
+ recordEvent(state, {
5142
+ kind: "agent.author_packet.blocked",
5143
+ checkpoint,
5144
+ stage: "author",
5145
+ summary: blocker.message,
5146
+ details: compactRecord({
5147
+ started_at: startedAt,
5148
+ duration_ms: durationMs,
5149
+ blocker,
5150
+ adapter_details: packet.details || null
5151
+ })
5152
+ });
5153
+ return { blocker };
5154
+ }
5029
5155
  recordEvent(state, {
5030
5156
  kind: "agent.author_packet.completed",
5031
5157
  checkpoint,
5032
5158
  stage: "author",
5033
5159
  summary: packet.summary,
5034
- details: { payload: packet.payload }
5160
+ details: compactRecord({
5161
+ payload: packet.payload,
5162
+ started_at: startedAt,
5163
+ duration_ms: durationMs,
5164
+ adapter_details: packet.details || null
5165
+ })
5035
5166
  });
5036
5167
  return {
5037
5168
  next: { ...baseContinuation(result), author_packet_json: jsonParam(packet.payload) }
@@ -5054,9 +5185,31 @@ async function routeCheckpoint(request, state, result, agent, input) {
5054
5185
  if (input.checkpoint_mode === "yield") {
5055
5186
  return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
5056
5187
  }
5188
+ const startedAt = timestamp3();
5189
+ const startedMs = Date.now();
5190
+ recordEvent(state, {
5191
+ kind: "agent.proof_assessment.started",
5192
+ checkpoint,
5193
+ stage: "verify",
5194
+ summary: "Proof assessment agent started.",
5195
+ details: { started_at: startedAt }
5196
+ });
5057
5197
  const assessment = await agent.assessProof(context);
5198
+ const durationMs = Date.now() - startedMs;
5058
5199
  const blocker = requirePayload("proof_assessment", assessment, state, result);
5059
5200
  if (blocker) {
5201
+ recordEvent(state, {
5202
+ kind: "agent.proof_assessment.blocked",
5203
+ checkpoint,
5204
+ stage: "verify",
5205
+ summary: blocker.message,
5206
+ details: compactRecord({
5207
+ started_at: startedAt,
5208
+ duration_ms: durationMs,
5209
+ blocker,
5210
+ adapter_details: assessment.details || null
5211
+ })
5212
+ });
5060
5213
  if (blocker.code === "main_agent_proof_review_required") {
5061
5214
  recordEvent(state, {
5062
5215
  kind: "checkpoint.packet.requested",
@@ -5075,7 +5228,12 @@ async function routeCheckpoint(request, state, result, agent, input) {
5075
5228
  checkpoint,
5076
5229
  stage: "verify",
5077
5230
  summary: assessment.summary,
5078
- details: { payload }
5231
+ details: compactRecord({
5232
+ payload,
5233
+ started_at: startedAt,
5234
+ duration_ms: durationMs,
5235
+ adapter_details: assessment.details || null
5236
+ })
5079
5237
  });
5080
5238
  const visualBlocker = proofAssessmentVisualBlocker({
5081
5239
  ...context.fullRiddleState || {},
@@ -5096,7 +5254,8 @@ async function routeCheckpoint(request, state, result, agent, input) {
5096
5254
  recovery_stage: "verify",
5097
5255
  evidence_issue_code: recoveryAssessment.evidence_issue_code || null,
5098
5256
  visual_delta: recoveryAssessment.visual_delta || null,
5099
- proof_assessment: recoveryAssessment
5257
+ proof_assessment: recoveryAssessment,
5258
+ agent_duration_ms: durationMs
5100
5259
  })
5101
5260
  });
5102
5261
  return { next: proofAssessmentContinuation(result, recoveryAssessment) };
@@ -2,10 +2,10 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-2RS4PBYK.js";
5
+ } from "./chunk-722PW3X3.js";
6
6
  import "./chunk-4ASMX4R6.js";
7
- import "./chunk-JOXTKWX6.js";
8
- import "./chunk-PLSGW2GI.js";
7
+ import "./chunk-U7Q3RB5D.js";
8
+ import "./chunk-CI2F66EE.js";
9
9
  import "./chunk-R6SCWJCI.js";
10
10
  import "./chunk-DUFDZJOF.js";
11
11
  export {