@riddledc/riddle-proof 0.5.48 → 0.5.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2RS4PBYK.js → chunk-722PW3X3.js} +105 -9
- package/dist/{chunk-PLSGW2GI.js → chunk-CI2F66EE.js} +63 -0
- package/dist/{chunk-JOXTKWX6.js → chunk-U7Q3RB5D.js} +1 -1
- package/dist/{chunk-N3ZNBRIG.js → chunk-YJPQOAZG.js} +1 -1
- package/dist/{chunk-NOBFZDZG.js → chunk-YW77WDTR.js} +104 -10
- package/dist/cli.cjs +266 -17
- package/dist/cli.js +4 -4
- package/dist/codex-exec-agent.cjs +107 -10
- package/dist/codex-exec-agent.d.cts +1 -0
- package/dist/codex-exec-agent.d.ts +1 -0
- package/dist/codex-exec-agent.js +2 -1
- package/dist/engine-harness.cjs +166 -7
- package/dist/engine-harness.js +3 -3
- package/dist/index.cjs +268 -19
- package/dist/index.js +5 -5
- package/dist/local-agent.cjs +107 -10
- package/dist/local-agent.js +2 -1
- package/dist/openclaw.js +2 -2
- package/dist/proof-run-core.d.cts +1 -1
- package/dist/proof-run-core.d.ts +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/dist/run-card.cjs +63 -0
- package/dist/run-card.js +1 -1
- package/dist/runner.js +3 -3
- package/dist/state.cjs +63 -0
- package/dist/state.js +2 -2
- package/dist/types.d.cts +12 -0
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
|
@@ -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,10 @@ var PROOF_SCHEMA = {
|
|
|
164
171
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
165
172
|
}
|
|
166
173
|
};
|
|
167
|
-
var PROMPT_STRING_LIMIT =
|
|
168
|
-
var PROMPT_ARRAY_LIMIT =
|
|
169
|
-
var PROMPT_OBJECT_KEY_LIMIT =
|
|
170
|
-
var PROMPT_BLOCK_LIMIT =
|
|
174
|
+
var PROMPT_STRING_LIMIT = 1400;
|
|
175
|
+
var PROMPT_ARRAY_LIMIT = 8;
|
|
176
|
+
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
177
|
+
var PROMPT_BLOCK_LIMIT = 7e4;
|
|
171
178
|
var PROMPT_KEY_PRIORITY = [
|
|
172
179
|
"ok",
|
|
173
180
|
"status",
|
|
@@ -189,6 +196,16 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
189
196
|
"after_cdn",
|
|
190
197
|
"before_baseline",
|
|
191
198
|
"prod_baseline",
|
|
199
|
+
"route_hints",
|
|
200
|
+
"route_candidates",
|
|
201
|
+
"keyword_hits",
|
|
202
|
+
"observations",
|
|
203
|
+
"latest_attempt",
|
|
204
|
+
"attempt_history",
|
|
205
|
+
"current_plan",
|
|
206
|
+
"plan_history",
|
|
207
|
+
"decision_history",
|
|
208
|
+
"refined_inputs",
|
|
192
209
|
"recon_assessment",
|
|
193
210
|
"baseline_understanding",
|
|
194
211
|
"supervisor_author_packet",
|
|
@@ -212,6 +229,7 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
212
229
|
"shipGate",
|
|
213
230
|
"last_error",
|
|
214
231
|
"errors",
|
|
232
|
+
"runtime_events",
|
|
215
233
|
"events"
|
|
216
234
|
];
|
|
217
235
|
var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
|
|
@@ -228,7 +246,7 @@ function compactPromptValue(value, depth = 0, key = "") {
|
|
|
228
246
|
if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
|
|
229
247
|
return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
|
|
230
248
|
}
|
|
231
|
-
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT :
|
|
249
|
+
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
|
|
232
250
|
return truncatePromptString(value, limit);
|
|
233
251
|
}
|
|
234
252
|
if (Array.isArray(value)) {
|
|
@@ -359,11 +377,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
|
|
|
359
377
|
const text = blocker.toLowerCase();
|
|
360
378
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
361
379
|
}
|
|
380
|
+
function runnerMetrics(input) {
|
|
381
|
+
const schemaText = JSON.stringify(input.request.schema);
|
|
382
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
383
|
+
return compactRecord({
|
|
384
|
+
purpose: input.request.purpose,
|
|
385
|
+
workdir: input.request.workdir,
|
|
386
|
+
started_at: input.startedAt,
|
|
387
|
+
finished_at: finishedAt,
|
|
388
|
+
duration_ms: Date.now() - input.startedMs,
|
|
389
|
+
prompt_chars: input.request.prompt.length,
|
|
390
|
+
prompt_lines: input.request.prompt.split(/\r?\n/).length,
|
|
391
|
+
schema_chars: schemaText.length,
|
|
392
|
+
stdout_chars: (input.stdout || "").length,
|
|
393
|
+
stderr_chars: (input.stderr || "").length,
|
|
394
|
+
final_message_chars: (input.finalText || "").length,
|
|
395
|
+
exit_status: input.status ?? null,
|
|
396
|
+
timed_out: input.timedOut || false,
|
|
397
|
+
error_code: input.errorCode,
|
|
398
|
+
codex_command: input.config.codexCommand || "codex",
|
|
399
|
+
codex_model: input.config.codexModel,
|
|
400
|
+
codex_sandbox: input.config.codexSandbox || "workspace-write",
|
|
401
|
+
codex_full_auto: input.config.codexFullAuto !== false,
|
|
402
|
+
timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
|
|
403
|
+
});
|
|
404
|
+
}
|
|
362
405
|
function createCodexExecJsonRunner(config = {}) {
|
|
363
406
|
return (request) => {
|
|
407
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
408
|
+
const startedMs = Date.now();
|
|
364
409
|
if (!request.workdir || !(0, import_node_fs.existsSync)(request.workdir)) {
|
|
365
410
|
return {
|
|
366
411
|
ok: false,
|
|
412
|
+
metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
|
|
367
413
|
blocker: {
|
|
368
414
|
code: "codex_workdir_missing",
|
|
369
415
|
message: `Codex workdir does not exist for ${request.purpose}.`,
|
|
@@ -408,6 +454,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
408
454
|
ok: false,
|
|
409
455
|
stdout: proc.stdout || "",
|
|
410
456
|
stderr: proc.stderr || "",
|
|
457
|
+
metrics: runnerMetrics({
|
|
458
|
+
request,
|
|
459
|
+
config,
|
|
460
|
+
startedAt,
|
|
461
|
+
startedMs,
|
|
462
|
+
stdout: proc.stdout || "",
|
|
463
|
+
stderr: proc.stderr || "",
|
|
464
|
+
status: proc.status,
|
|
465
|
+
timedOut,
|
|
466
|
+
errorCode: proc.error.code || "spawn_error"
|
|
467
|
+
}),
|
|
411
468
|
blocker: {
|
|
412
469
|
code: timedOut ? "codex_timeout" : "codex_exec_error",
|
|
413
470
|
message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
|
|
@@ -420,6 +477,16 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
420
477
|
ok: false,
|
|
421
478
|
stdout: proc.stdout || "",
|
|
422
479
|
stderr: proc.stderr || "",
|
|
480
|
+
metrics: runnerMetrics({
|
|
481
|
+
request,
|
|
482
|
+
config,
|
|
483
|
+
startedAt,
|
|
484
|
+
startedMs,
|
|
485
|
+
stdout: proc.stdout || "",
|
|
486
|
+
stderr: proc.stderr || "",
|
|
487
|
+
status: proc.status,
|
|
488
|
+
errorCode: "nonzero_exit"
|
|
489
|
+
}),
|
|
423
490
|
blocker: {
|
|
424
491
|
code: "codex_nonzero_exit",
|
|
425
492
|
message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
|
|
@@ -434,6 +501,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
434
501
|
ok: false,
|
|
435
502
|
stdout: proc.stdout || "",
|
|
436
503
|
stderr: proc.stderr || "",
|
|
504
|
+
metrics: runnerMetrics({
|
|
505
|
+
request,
|
|
506
|
+
config,
|
|
507
|
+
startedAt,
|
|
508
|
+
startedMs,
|
|
509
|
+
stdout: proc.stdout || "",
|
|
510
|
+
stderr: proc.stderr || "",
|
|
511
|
+
finalText,
|
|
512
|
+
status: proc.status,
|
|
513
|
+
errorCode: "invalid_json"
|
|
514
|
+
}),
|
|
437
515
|
blocker: {
|
|
438
516
|
code: "codex_invalid_json",
|
|
439
517
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
@@ -445,7 +523,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
445
523
|
ok: true,
|
|
446
524
|
json: parsed,
|
|
447
525
|
stdout: proc.stdout || "",
|
|
448
|
-
stderr: proc.stderr || ""
|
|
526
|
+
stderr: proc.stderr || "",
|
|
527
|
+
metrics: runnerMetrics({
|
|
528
|
+
request,
|
|
529
|
+
config,
|
|
530
|
+
startedAt,
|
|
531
|
+
startedMs,
|
|
532
|
+
stdout: proc.stdout || "",
|
|
533
|
+
stderr: proc.stderr || "",
|
|
534
|
+
finalText,
|
|
535
|
+
status: proc.status
|
|
536
|
+
})
|
|
449
537
|
};
|
|
450
538
|
} finally {
|
|
451
539
|
(0, import_node_fs.rmSync)(tmpDir, { recursive: true, force: true });
|
|
@@ -466,14 +554,21 @@ function payloadOrBlocker(raw, checkpoint) {
|
|
|
466
554
|
ok: false,
|
|
467
555
|
blocker: {
|
|
468
556
|
...blocker,
|
|
469
|
-
checkpoint
|
|
557
|
+
checkpoint,
|
|
558
|
+
details: {
|
|
559
|
+
...blocker.details || {},
|
|
560
|
+
runner_metrics: raw.metrics || null
|
|
561
|
+
}
|
|
470
562
|
}
|
|
471
563
|
};
|
|
472
564
|
}
|
|
473
565
|
return {
|
|
474
566
|
ok: true,
|
|
475
567
|
payload: raw.json,
|
|
476
|
-
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
|
|
568
|
+
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
|
|
569
|
+
details: compactRecord({
|
|
570
|
+
runner_metrics: raw.metrics || null
|
|
571
|
+
})
|
|
477
572
|
};
|
|
478
573
|
}
|
|
479
574
|
function stringArray(value) {
|
|
@@ -609,14 +704,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
609
704
|
agent_summary: summary,
|
|
610
705
|
agent_changed_files: changedFiles,
|
|
611
706
|
agent_tests_run: testsRun,
|
|
612
|
-
agent_blockers: blockers
|
|
707
|
+
agent_blockers: blockers,
|
|
708
|
+
runner_metrics: raw.metrics || null
|
|
613
709
|
};
|
|
614
710
|
attemptSummaries.push({
|
|
615
711
|
purpose,
|
|
616
712
|
summary,
|
|
617
713
|
changed_files: changedFiles,
|
|
618
714
|
tests_run: testsRun,
|
|
619
|
-
blockers
|
|
715
|
+
blockers,
|
|
716
|
+
runner_metrics: raw.metrics || null
|
|
620
717
|
});
|
|
621
718
|
if (hardBlockers.length) {
|
|
622
719
|
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;
|
package/dist/codex-exec-agent.js
CHANGED
package/dist/engine-harness.cjs
CHANGED
|
@@ -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)
|
|
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: {
|
|
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)
|
|
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: {
|
|
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: {
|
|
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) };
|
package/dist/engine-harness.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-722PW3X3.js";
|
|
6
6
|
import "./chunk-4ASMX4R6.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
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 {
|