@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
package/dist/index.cjs
CHANGED
|
@@ -3710,6 +3710,68 @@ function compactText2(value, limit = 600) {
|
|
|
3710
3710
|
if (!text) return void 0;
|
|
3711
3711
|
return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
|
|
3712
3712
|
}
|
|
3713
|
+
function numericValue(value) {
|
|
3714
|
+
const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
3715
|
+
return Number.isFinite(number) ? number : void 0;
|
|
3716
|
+
}
|
|
3717
|
+
function eventDetails(event) {
|
|
3718
|
+
return recordValue(recordValue(event)?.details) || {};
|
|
3719
|
+
}
|
|
3720
|
+
function collectRunnerMetrics(details) {
|
|
3721
|
+
const metrics = [];
|
|
3722
|
+
const adapterDetails = recordValue(details.adapter_details);
|
|
3723
|
+
const direct = recordValue(adapterDetails?.runner_metrics);
|
|
3724
|
+
if (direct) metrics.push(direct);
|
|
3725
|
+
const attempts = Array.isArray(adapterDetails?.attempt_summaries) ? adapterDetails.attempt_summaries : [];
|
|
3726
|
+
for (const attempt of attempts) {
|
|
3727
|
+
const attemptMetrics = recordValue(recordValue(attempt)?.runner_metrics);
|
|
3728
|
+
if (attemptMetrics) metrics.push(attemptMetrics);
|
|
3729
|
+
}
|
|
3730
|
+
return metrics;
|
|
3731
|
+
}
|
|
3732
|
+
function observabilityFrom(state) {
|
|
3733
|
+
const engineEvents = state.events.filter((event) => event.kind === "engine.result").map((event) => ({ event, details: eventDetails(event) }));
|
|
3734
|
+
const agentEvents = state.events.filter((event) => event.kind.startsWith("agent.")).map((event) => ({ event, details: eventDetails(event) })).filter(({ details }) => numericValue(details.duration_ms) !== void 0);
|
|
3735
|
+
const retryEvents = state.events.filter((event) => /retry|recovery/i.test(event.kind) || /retry|recovery/i.test(event.summary || "")).slice(-8);
|
|
3736
|
+
const runnerMetrics2 = agentEvents.flatMap(({ details }) => collectRunnerMetrics(details));
|
|
3737
|
+
const promptChars = runnerMetrics2.map((metrics) => numericValue(metrics.prompt_chars)).filter((value) => value !== void 0);
|
|
3738
|
+
const sum = (values) => values.reduce((total, value) => total + (value ?? 0), 0);
|
|
3739
|
+
const recentEngineTimings = engineEvents.slice(-8).map(({ event, details }) => compactRecord({
|
|
3740
|
+
checkpoint: event.checkpoint || null,
|
|
3741
|
+
stage: event.stage || null,
|
|
3742
|
+
duration_ms: numericValue(details.duration_ms),
|
|
3743
|
+
ok: details.ok ?? null
|
|
3744
|
+
}));
|
|
3745
|
+
const recentAgentTimings = agentEvents.slice(-8).map(({ event, details }) => {
|
|
3746
|
+
const metrics = collectRunnerMetrics(details);
|
|
3747
|
+
const localPromptChars = metrics.map((item) => numericValue(item.prompt_chars)).filter((value) => value !== void 0);
|
|
3748
|
+
return compactRecord({
|
|
3749
|
+
kind: event.kind,
|
|
3750
|
+
checkpoint: event.checkpoint || null,
|
|
3751
|
+
stage: event.stage || null,
|
|
3752
|
+
duration_ms: numericValue(details.duration_ms),
|
|
3753
|
+
prompt_chars: localPromptChars.length ? Math.max(...localPromptChars) : void 0,
|
|
3754
|
+
attempt_count: numericValue(recordValue(details.adapter_details)?.attempt_count)
|
|
3755
|
+
});
|
|
3756
|
+
});
|
|
3757
|
+
return compactRecord({
|
|
3758
|
+
engine_call_count: engineEvents.length,
|
|
3759
|
+
agent_call_count: agentEvents.length,
|
|
3760
|
+
engine_total_ms: sum(engineEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
3761
|
+
agent_total_ms: sum(agentEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
3762
|
+
max_agent_prompt_chars: promptChars.length ? Math.max(...promptChars) : void 0,
|
|
3763
|
+
total_agent_prompt_chars: promptChars.length ? sum(promptChars) : void 0,
|
|
3764
|
+
recent_engine_timings: recentEngineTimings.length ? recentEngineTimings : void 0,
|
|
3765
|
+
recent_agent_timings: recentAgentTimings.length ? recentAgentTimings : void 0,
|
|
3766
|
+
retry_event_count: retryEvents.length,
|
|
3767
|
+
recent_retry_reasons: retryEvents.length ? retryEvents.map((event) => compactRecord({
|
|
3768
|
+
kind: event.kind,
|
|
3769
|
+
checkpoint: event.checkpoint || null,
|
|
3770
|
+
stage: event.stage || null,
|
|
3771
|
+
summary: compactText2(event.summary, 240)
|
|
3772
|
+
})) : void 0
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3713
3775
|
function visualDeltaFrom(input) {
|
|
3714
3776
|
const fullState = input.fullRiddleState || {};
|
|
3715
3777
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -3822,6 +3884,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
3822
3884
|
proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
|
|
3823
3885
|
artifacts
|
|
3824
3886
|
}),
|
|
3887
|
+
observability: observabilityFrom(state),
|
|
3825
3888
|
stop_condition: compactRecord({
|
|
3826
3889
|
status: state.status,
|
|
3827
3890
|
terminal: isTerminalStatus(state.status),
|
|
@@ -5409,7 +5472,10 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
5409
5472
|
worktree_path: workdir || null
|
|
5410
5473
|
}
|
|
5411
5474
|
});
|
|
5475
|
+
const implementationStartedAt = timestamp3();
|
|
5476
|
+
const implementationStartedMs = Date.now();
|
|
5412
5477
|
const implementation = await agent.implementChange({ ...context, workdir });
|
|
5478
|
+
const implementationDurationMs = Date.now() - implementationStartedMs;
|
|
5413
5479
|
if (implementation.blocker || implementation.ok === false) {
|
|
5414
5480
|
recordEvent(state, {
|
|
5415
5481
|
kind: "agent.implementation.blocked",
|
|
@@ -5418,6 +5484,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
5418
5484
|
summary: implementation.summary || implementation.blocker?.message || "Implementation adapter reported a blocker.",
|
|
5419
5485
|
details: compactRecord({
|
|
5420
5486
|
worktree_path: workdir || null,
|
|
5487
|
+
started_at: implementationStartedAt,
|
|
5488
|
+
duration_ms: implementationDurationMs,
|
|
5421
5489
|
changed_files: implementation.changedFiles || [],
|
|
5422
5490
|
tests_run: implementation.testsRun || [],
|
|
5423
5491
|
implementation_notes: implementation.implementationNotes || null,
|
|
@@ -5443,6 +5511,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
5443
5511
|
summary: implementation.summary || "Implementation adapter returned without leaving a detectable git diff.",
|
|
5444
5512
|
details: compactRecord({
|
|
5445
5513
|
worktree_path: workdir || null,
|
|
5514
|
+
started_at: implementationStartedAt,
|
|
5515
|
+
duration_ms: implementationDurationMs,
|
|
5446
5516
|
changed_files: implementation.changedFiles || [],
|
|
5447
5517
|
tests_run: implementation.testsRun || [],
|
|
5448
5518
|
implementation_notes: implementation.implementationNotes || null,
|
|
@@ -5457,7 +5527,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
5457
5527
|
details: compactRecord({
|
|
5458
5528
|
worktree_path: workdir || null,
|
|
5459
5529
|
checkpoint: result.checkpoint || null,
|
|
5460
|
-
next_stage: "implement"
|
|
5530
|
+
next_stage: "implement",
|
|
5531
|
+
previous_duration_ms: implementationDurationMs
|
|
5461
5532
|
})
|
|
5462
5533
|
});
|
|
5463
5534
|
return {
|
|
@@ -5476,6 +5547,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
5476
5547
|
summary: implementation.summary || "Implementation adapter reported code changes.",
|
|
5477
5548
|
details: {
|
|
5478
5549
|
worktree_path: workdir || null,
|
|
5550
|
+
started_at: implementationStartedAt,
|
|
5551
|
+
duration_ms: implementationDurationMs,
|
|
5479
5552
|
diffDetected,
|
|
5480
5553
|
changed_files: implementation.changedFiles || [],
|
|
5481
5554
|
tests_run: implementation.testsRun || [],
|
|
@@ -5592,15 +5665,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5592
5665
|
if (input.checkpoint_mode === "yield") {
|
|
5593
5666
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5594
5667
|
}
|
|
5668
|
+
const startedAt = timestamp3();
|
|
5669
|
+
const startedMs = Date.now();
|
|
5670
|
+
recordEvent(state, {
|
|
5671
|
+
kind: "agent.recon_assessment.started",
|
|
5672
|
+
checkpoint,
|
|
5673
|
+
stage: "recon",
|
|
5674
|
+
summary: "Recon assessment agent started.",
|
|
5675
|
+
details: { started_at: startedAt }
|
|
5676
|
+
});
|
|
5595
5677
|
const assessment = await agent.assessRecon(context);
|
|
5678
|
+
const durationMs = Date.now() - startedMs;
|
|
5596
5679
|
const blocker = requirePayload("recon_assessment", assessment, state, result);
|
|
5597
|
-
if (blocker)
|
|
5680
|
+
if (blocker) {
|
|
5681
|
+
recordEvent(state, {
|
|
5682
|
+
kind: "agent.recon_assessment.blocked",
|
|
5683
|
+
checkpoint,
|
|
5684
|
+
stage: "recon",
|
|
5685
|
+
summary: blocker.message,
|
|
5686
|
+
details: compactRecord({
|
|
5687
|
+
started_at: startedAt,
|
|
5688
|
+
duration_ms: durationMs,
|
|
5689
|
+
blocker,
|
|
5690
|
+
adapter_details: assessment.details || null
|
|
5691
|
+
})
|
|
5692
|
+
});
|
|
5693
|
+
return { blocker };
|
|
5694
|
+
}
|
|
5598
5695
|
recordEvent(state, {
|
|
5599
5696
|
kind: "agent.recon_assessment.completed",
|
|
5600
5697
|
checkpoint,
|
|
5601
5698
|
stage: "recon",
|
|
5602
5699
|
summary: assessment.summary,
|
|
5603
|
-
details: {
|
|
5700
|
+
details: compactRecord({
|
|
5701
|
+
payload: assessment.payload,
|
|
5702
|
+
started_at: startedAt,
|
|
5703
|
+
duration_ms: durationMs,
|
|
5704
|
+
adapter_details: assessment.details || null
|
|
5705
|
+
})
|
|
5604
5706
|
});
|
|
5605
5707
|
return {
|
|
5606
5708
|
next: { ...baseContinuation(result), recon_assessment_json: jsonParam(assessment.payload) }
|
|
@@ -5612,15 +5714,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5612
5714
|
if (input.checkpoint_mode === "yield") {
|
|
5613
5715
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5614
5716
|
}
|
|
5717
|
+
const startedAt = timestamp3();
|
|
5718
|
+
const startedMs = Date.now();
|
|
5719
|
+
recordEvent(state, {
|
|
5720
|
+
kind: "agent.author_packet.started",
|
|
5721
|
+
checkpoint,
|
|
5722
|
+
stage: "author",
|
|
5723
|
+
summary: "Proof authoring agent started.",
|
|
5724
|
+
details: { started_at: startedAt }
|
|
5725
|
+
});
|
|
5615
5726
|
const packet = await agent.authorProofPacket(context);
|
|
5727
|
+
const durationMs = Date.now() - startedMs;
|
|
5616
5728
|
const blocker = requirePayload("author_packet", packet, state, result);
|
|
5617
|
-
if (blocker)
|
|
5729
|
+
if (blocker) {
|
|
5730
|
+
recordEvent(state, {
|
|
5731
|
+
kind: "agent.author_packet.blocked",
|
|
5732
|
+
checkpoint,
|
|
5733
|
+
stage: "author",
|
|
5734
|
+
summary: blocker.message,
|
|
5735
|
+
details: compactRecord({
|
|
5736
|
+
started_at: startedAt,
|
|
5737
|
+
duration_ms: durationMs,
|
|
5738
|
+
blocker,
|
|
5739
|
+
adapter_details: packet.details || null
|
|
5740
|
+
})
|
|
5741
|
+
});
|
|
5742
|
+
return { blocker };
|
|
5743
|
+
}
|
|
5618
5744
|
recordEvent(state, {
|
|
5619
5745
|
kind: "agent.author_packet.completed",
|
|
5620
5746
|
checkpoint,
|
|
5621
5747
|
stage: "author",
|
|
5622
5748
|
summary: packet.summary,
|
|
5623
|
-
details: {
|
|
5749
|
+
details: compactRecord({
|
|
5750
|
+
payload: packet.payload,
|
|
5751
|
+
started_at: startedAt,
|
|
5752
|
+
duration_ms: durationMs,
|
|
5753
|
+
adapter_details: packet.details || null
|
|
5754
|
+
})
|
|
5624
5755
|
});
|
|
5625
5756
|
return {
|
|
5626
5757
|
next: { ...baseContinuation(result), author_packet_json: jsonParam(packet.payload) }
|
|
@@ -5643,9 +5774,31 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5643
5774
|
if (input.checkpoint_mode === "yield") {
|
|
5644
5775
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5645
5776
|
}
|
|
5777
|
+
const startedAt = timestamp3();
|
|
5778
|
+
const startedMs = Date.now();
|
|
5779
|
+
recordEvent(state, {
|
|
5780
|
+
kind: "agent.proof_assessment.started",
|
|
5781
|
+
checkpoint,
|
|
5782
|
+
stage: "verify",
|
|
5783
|
+
summary: "Proof assessment agent started.",
|
|
5784
|
+
details: { started_at: startedAt }
|
|
5785
|
+
});
|
|
5646
5786
|
const assessment = await agent.assessProof(context);
|
|
5787
|
+
const durationMs = Date.now() - startedMs;
|
|
5647
5788
|
const blocker = requirePayload("proof_assessment", assessment, state, result);
|
|
5648
5789
|
if (blocker) {
|
|
5790
|
+
recordEvent(state, {
|
|
5791
|
+
kind: "agent.proof_assessment.blocked",
|
|
5792
|
+
checkpoint,
|
|
5793
|
+
stage: "verify",
|
|
5794
|
+
summary: blocker.message,
|
|
5795
|
+
details: compactRecord({
|
|
5796
|
+
started_at: startedAt,
|
|
5797
|
+
duration_ms: durationMs,
|
|
5798
|
+
blocker,
|
|
5799
|
+
adapter_details: assessment.details || null
|
|
5800
|
+
})
|
|
5801
|
+
});
|
|
5649
5802
|
if (blocker.code === "main_agent_proof_review_required") {
|
|
5650
5803
|
recordEvent(state, {
|
|
5651
5804
|
kind: "checkpoint.packet.requested",
|
|
@@ -5664,7 +5817,12 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5664
5817
|
checkpoint,
|
|
5665
5818
|
stage: "verify",
|
|
5666
5819
|
summary: assessment.summary,
|
|
5667
|
-
details: {
|
|
5820
|
+
details: compactRecord({
|
|
5821
|
+
payload,
|
|
5822
|
+
started_at: startedAt,
|
|
5823
|
+
duration_ms: durationMs,
|
|
5824
|
+
adapter_details: assessment.details || null
|
|
5825
|
+
})
|
|
5668
5826
|
});
|
|
5669
5827
|
const visualBlocker = proofAssessmentVisualBlocker({
|
|
5670
5828
|
...context.fullRiddleState || {},
|
|
@@ -5685,7 +5843,8 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5685
5843
|
recovery_stage: "verify",
|
|
5686
5844
|
evidence_issue_code: recoveryAssessment.evidence_issue_code || null,
|
|
5687
5845
|
visual_delta: recoveryAssessment.visual_delta || null,
|
|
5688
|
-
proof_assessment: recoveryAssessment
|
|
5846
|
+
proof_assessment: recoveryAssessment,
|
|
5847
|
+
agent_duration_ms: durationMs
|
|
5689
5848
|
})
|
|
5690
5849
|
});
|
|
5691
5850
|
return { next: proofAssessmentContinuation(result, recoveryAssessment) };
|
|
@@ -6043,10 +6202,10 @@ var PROOF_SCHEMA = {
|
|
|
6043
6202
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
6044
6203
|
}
|
|
6045
6204
|
};
|
|
6046
|
-
var PROMPT_STRING_LIMIT =
|
|
6047
|
-
var PROMPT_ARRAY_LIMIT =
|
|
6048
|
-
var PROMPT_OBJECT_KEY_LIMIT =
|
|
6049
|
-
var PROMPT_BLOCK_LIMIT =
|
|
6205
|
+
var PROMPT_STRING_LIMIT = 1400;
|
|
6206
|
+
var PROMPT_ARRAY_LIMIT = 8;
|
|
6207
|
+
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
6208
|
+
var PROMPT_BLOCK_LIMIT = 7e4;
|
|
6050
6209
|
var PROMPT_KEY_PRIORITY = [
|
|
6051
6210
|
"ok",
|
|
6052
6211
|
"status",
|
|
@@ -6068,6 +6227,16 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
6068
6227
|
"after_cdn",
|
|
6069
6228
|
"before_baseline",
|
|
6070
6229
|
"prod_baseline",
|
|
6230
|
+
"route_hints",
|
|
6231
|
+
"route_candidates",
|
|
6232
|
+
"keyword_hits",
|
|
6233
|
+
"observations",
|
|
6234
|
+
"latest_attempt",
|
|
6235
|
+
"attempt_history",
|
|
6236
|
+
"current_plan",
|
|
6237
|
+
"plan_history",
|
|
6238
|
+
"decision_history",
|
|
6239
|
+
"refined_inputs",
|
|
6071
6240
|
"recon_assessment",
|
|
6072
6241
|
"baseline_understanding",
|
|
6073
6242
|
"supervisor_author_packet",
|
|
@@ -6091,6 +6260,7 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
6091
6260
|
"shipGate",
|
|
6092
6261
|
"last_error",
|
|
6093
6262
|
"errors",
|
|
6263
|
+
"runtime_events",
|
|
6094
6264
|
"events"
|
|
6095
6265
|
];
|
|
6096
6266
|
var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
|
|
@@ -6107,7 +6277,7 @@ function compactPromptValue(value, depth = 0, key = "") {
|
|
|
6107
6277
|
if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
|
|
6108
6278
|
return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
|
|
6109
6279
|
}
|
|
6110
|
-
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT :
|
|
6280
|
+
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
|
|
6111
6281
|
return truncatePromptString(value, limit);
|
|
6112
6282
|
}
|
|
6113
6283
|
if (Array.isArray(value)) {
|
|
@@ -6238,11 +6408,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
|
|
|
6238
6408
|
const text = blocker.toLowerCase();
|
|
6239
6409
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
6240
6410
|
}
|
|
6411
|
+
function runnerMetrics(input) {
|
|
6412
|
+
const schemaText = JSON.stringify(input.request.schema);
|
|
6413
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6414
|
+
return compactRecord({
|
|
6415
|
+
purpose: input.request.purpose,
|
|
6416
|
+
workdir: input.request.workdir,
|
|
6417
|
+
started_at: input.startedAt,
|
|
6418
|
+
finished_at: finishedAt,
|
|
6419
|
+
duration_ms: Date.now() - input.startedMs,
|
|
6420
|
+
prompt_chars: input.request.prompt.length,
|
|
6421
|
+
prompt_lines: input.request.prompt.split(/\r?\n/).length,
|
|
6422
|
+
schema_chars: schemaText.length,
|
|
6423
|
+
stdout_chars: (input.stdout || "").length,
|
|
6424
|
+
stderr_chars: (input.stderr || "").length,
|
|
6425
|
+
final_message_chars: (input.finalText || "").length,
|
|
6426
|
+
exit_status: input.status ?? null,
|
|
6427
|
+
timed_out: input.timedOut || false,
|
|
6428
|
+
error_code: input.errorCode,
|
|
6429
|
+
codex_command: input.config.codexCommand || "codex",
|
|
6430
|
+
codex_model: input.config.codexModel,
|
|
6431
|
+
codex_sandbox: input.config.codexSandbox || "workspace-write",
|
|
6432
|
+
codex_full_auto: input.config.codexFullAuto !== false,
|
|
6433
|
+
timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
|
|
6434
|
+
});
|
|
6435
|
+
}
|
|
6241
6436
|
function createCodexExecJsonRunner(config = {}) {
|
|
6242
6437
|
return (request) => {
|
|
6438
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6439
|
+
const startedMs = Date.now();
|
|
6243
6440
|
if (!request.workdir || !(0, import_node_fs4.existsSync)(request.workdir)) {
|
|
6244
6441
|
return {
|
|
6245
6442
|
ok: false,
|
|
6443
|
+
metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
|
|
6246
6444
|
blocker: {
|
|
6247
6445
|
code: "codex_workdir_missing",
|
|
6248
6446
|
message: `Codex workdir does not exist for ${request.purpose}.`,
|
|
@@ -6287,6 +6485,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6287
6485
|
ok: false,
|
|
6288
6486
|
stdout: proc.stdout || "",
|
|
6289
6487
|
stderr: proc.stderr || "",
|
|
6488
|
+
metrics: runnerMetrics({
|
|
6489
|
+
request,
|
|
6490
|
+
config,
|
|
6491
|
+
startedAt,
|
|
6492
|
+
startedMs,
|
|
6493
|
+
stdout: proc.stdout || "",
|
|
6494
|
+
stderr: proc.stderr || "",
|
|
6495
|
+
status: proc.status,
|
|
6496
|
+
timedOut,
|
|
6497
|
+
errorCode: proc.error.code || "spawn_error"
|
|
6498
|
+
}),
|
|
6290
6499
|
blocker: {
|
|
6291
6500
|
code: timedOut ? "codex_timeout" : "codex_exec_error",
|
|
6292
6501
|
message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
|
|
@@ -6299,6 +6508,16 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6299
6508
|
ok: false,
|
|
6300
6509
|
stdout: proc.stdout || "",
|
|
6301
6510
|
stderr: proc.stderr || "",
|
|
6511
|
+
metrics: runnerMetrics({
|
|
6512
|
+
request,
|
|
6513
|
+
config,
|
|
6514
|
+
startedAt,
|
|
6515
|
+
startedMs,
|
|
6516
|
+
stdout: proc.stdout || "",
|
|
6517
|
+
stderr: proc.stderr || "",
|
|
6518
|
+
status: proc.status,
|
|
6519
|
+
errorCode: "nonzero_exit"
|
|
6520
|
+
}),
|
|
6302
6521
|
blocker: {
|
|
6303
6522
|
code: "codex_nonzero_exit",
|
|
6304
6523
|
message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
|
|
@@ -6313,6 +6532,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6313
6532
|
ok: false,
|
|
6314
6533
|
stdout: proc.stdout || "",
|
|
6315
6534
|
stderr: proc.stderr || "",
|
|
6535
|
+
metrics: runnerMetrics({
|
|
6536
|
+
request,
|
|
6537
|
+
config,
|
|
6538
|
+
startedAt,
|
|
6539
|
+
startedMs,
|
|
6540
|
+
stdout: proc.stdout || "",
|
|
6541
|
+
stderr: proc.stderr || "",
|
|
6542
|
+
finalText,
|
|
6543
|
+
status: proc.status,
|
|
6544
|
+
errorCode: "invalid_json"
|
|
6545
|
+
}),
|
|
6316
6546
|
blocker: {
|
|
6317
6547
|
code: "codex_invalid_json",
|
|
6318
6548
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
@@ -6324,7 +6554,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6324
6554
|
ok: true,
|
|
6325
6555
|
json: parsed,
|
|
6326
6556
|
stdout: proc.stdout || "",
|
|
6327
|
-
stderr: proc.stderr || ""
|
|
6557
|
+
stderr: proc.stderr || "",
|
|
6558
|
+
metrics: runnerMetrics({
|
|
6559
|
+
request,
|
|
6560
|
+
config,
|
|
6561
|
+
startedAt,
|
|
6562
|
+
startedMs,
|
|
6563
|
+
stdout: proc.stdout || "",
|
|
6564
|
+
stderr: proc.stderr || "",
|
|
6565
|
+
finalText,
|
|
6566
|
+
status: proc.status
|
|
6567
|
+
})
|
|
6328
6568
|
};
|
|
6329
6569
|
} finally {
|
|
6330
6570
|
(0, import_node_fs4.rmSync)(tmpDir, { recursive: true, force: true });
|
|
@@ -6345,14 +6585,21 @@ function payloadOrBlocker(raw, checkpoint) {
|
|
|
6345
6585
|
ok: false,
|
|
6346
6586
|
blocker: {
|
|
6347
6587
|
...blocker,
|
|
6348
|
-
checkpoint
|
|
6588
|
+
checkpoint,
|
|
6589
|
+
details: {
|
|
6590
|
+
...blocker.details || {},
|
|
6591
|
+
runner_metrics: raw.metrics || null
|
|
6592
|
+
}
|
|
6349
6593
|
}
|
|
6350
6594
|
};
|
|
6351
6595
|
}
|
|
6352
6596
|
return {
|
|
6353
6597
|
ok: true,
|
|
6354
6598
|
payload: raw.json,
|
|
6355
|
-
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
|
|
6599
|
+
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
|
|
6600
|
+
details: compactRecord({
|
|
6601
|
+
runner_metrics: raw.metrics || null
|
|
6602
|
+
})
|
|
6356
6603
|
};
|
|
6357
6604
|
}
|
|
6358
6605
|
function stringArray(value) {
|
|
@@ -6488,14 +6735,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
6488
6735
|
agent_summary: summary,
|
|
6489
6736
|
agent_changed_files: changedFiles,
|
|
6490
6737
|
agent_tests_run: testsRun,
|
|
6491
|
-
agent_blockers: blockers
|
|
6738
|
+
agent_blockers: blockers,
|
|
6739
|
+
runner_metrics: raw.metrics || null
|
|
6492
6740
|
};
|
|
6493
6741
|
attemptSummaries.push({
|
|
6494
6742
|
purpose,
|
|
6495
6743
|
summary,
|
|
6496
6744
|
changed_files: changedFiles,
|
|
6497
6745
|
tests_run: testsRun,
|
|
6498
|
-
blockers
|
|
6746
|
+
blockers,
|
|
6747
|
+
runner_metrics: raw.metrics || null
|
|
6499
6748
|
});
|
|
6500
6749
|
if (hardBlockers.length) {
|
|
6501
6750
|
return {
|
|
@@ -7238,7 +7487,7 @@ function percentFrom(record) {
|
|
|
7238
7487
|
}
|
|
7239
7488
|
function numericFromAnyKey(record, keys) {
|
|
7240
7489
|
for (const key of keys) {
|
|
7241
|
-
const value =
|
|
7490
|
+
const value = numericValue2(record[key]);
|
|
7242
7491
|
if (value !== null) return value;
|
|
7243
7492
|
}
|
|
7244
7493
|
return null;
|
|
@@ -7249,7 +7498,7 @@ function recordValue2(value) {
|
|
|
7249
7498
|
function listValue(value) {
|
|
7250
7499
|
return Array.isArray(value) ? value : [];
|
|
7251
7500
|
}
|
|
7252
|
-
function
|
|
7501
|
+
function numericValue2(value) {
|
|
7253
7502
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
7254
7503
|
if (typeof value === "string" && value.trim()) {
|
|
7255
7504
|
const parsed = Number(value);
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-ODORKNSO.js";
|
|
18
18
|
import {
|
|
19
19
|
runRiddleProof
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YJPQOAZG.js";
|
|
21
21
|
import {
|
|
22
22
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
23
23
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
createDisabledRiddleProofAgentAdapter,
|
|
33
33
|
readRiddleProofRunStatus,
|
|
34
34
|
runRiddleProofEngineHarness
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-722PW3X3.js";
|
|
36
36
|
import "./chunk-4ASMX4R6.js";
|
|
37
37
|
import "./chunk-JFQXAJH2.js";
|
|
38
38
|
import {
|
|
39
39
|
createCodexExecAgentAdapter,
|
|
40
40
|
createCodexExecJsonRunner,
|
|
41
41
|
runCodexExecAgentDoctor
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-YW77WDTR.js";
|
|
43
43
|
import {
|
|
44
44
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
45
45
|
appendRunEvent,
|
|
@@ -51,11 +51,11 @@ import {
|
|
|
51
51
|
normalizePrLifecycleState,
|
|
52
52
|
normalizeRunParams,
|
|
53
53
|
setRunStatus
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-U7Q3RB5D.js";
|
|
55
55
|
import {
|
|
56
56
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
57
57
|
createRiddleProofRunCard
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-CI2F66EE.js";
|
|
59
59
|
import {
|
|
60
60
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
61
61
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|