@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.
- package/dist/{chunk-NOBFZDZG.js → chunk-3266V3MO.js} +109 -11
- 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/cli.cjs +271 -18
- package/dist/cli.js +4 -4
- package/dist/codex-exec-agent.cjs +112 -11
- 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 +273 -20
- package/dist/index.js +5 -5
- package/dist/local-agent.cjs +112 -11
- 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,11 @@ 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 = 1e3;
|
|
6206
|
+
var PROMPT_ARRAY_LIMIT = 8;
|
|
6207
|
+
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
6208
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
6209
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
6050
6210
|
var PROMPT_KEY_PRIORITY = [
|
|
6051
6211
|
"ok",
|
|
6052
6212
|
"status",
|
|
@@ -6068,6 +6228,16 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
6068
6228
|
"after_cdn",
|
|
6069
6229
|
"before_baseline",
|
|
6070
6230
|
"prod_baseline",
|
|
6231
|
+
"route_hints",
|
|
6232
|
+
"route_candidates",
|
|
6233
|
+
"keyword_hits",
|
|
6234
|
+
"observations",
|
|
6235
|
+
"latest_attempt",
|
|
6236
|
+
"attempt_history",
|
|
6237
|
+
"current_plan",
|
|
6238
|
+
"plan_history",
|
|
6239
|
+
"decision_history",
|
|
6240
|
+
"refined_inputs",
|
|
6071
6241
|
"recon_assessment",
|
|
6072
6242
|
"baseline_understanding",
|
|
6073
6243
|
"supervisor_author_packet",
|
|
@@ -6091,6 +6261,7 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
6091
6261
|
"shipGate",
|
|
6092
6262
|
"last_error",
|
|
6093
6263
|
"errors",
|
|
6264
|
+
"runtime_events",
|
|
6094
6265
|
"events"
|
|
6095
6266
|
];
|
|
6096
6267
|
var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
|
|
@@ -6107,7 +6278,7 @@ function compactPromptValue(value, depth = 0, key = "") {
|
|
|
6107
6278
|
if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
|
|
6108
6279
|
return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
|
|
6109
6280
|
}
|
|
6110
|
-
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT :
|
|
6281
|
+
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
|
|
6111
6282
|
return truncatePromptString(value, limit);
|
|
6112
6283
|
}
|
|
6113
6284
|
if (Array.isArray(value)) {
|
|
@@ -6150,7 +6321,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
6150
6321
|
return after || fallback;
|
|
6151
6322
|
}
|
|
6152
6323
|
function basePrompt(context, role) {
|
|
6153
|
-
|
|
6324
|
+
const prompt = [
|
|
6154
6325
|
role,
|
|
6155
6326
|
"",
|
|
6156
6327
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -6162,6 +6333,9 @@ function basePrompt(context, role) {
|
|
|
6162
6333
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
6163
6334
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
6164
6335
|
].join("\n");
|
|
6336
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
6337
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
6338
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
6165
6339
|
}
|
|
6166
6340
|
function schemaRequiredKeys(schema) {
|
|
6167
6341
|
const required = schema?.required;
|
|
@@ -6238,11 +6412,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
|
|
|
6238
6412
|
const text = blocker.toLowerCase();
|
|
6239
6413
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
6240
6414
|
}
|
|
6415
|
+
function runnerMetrics(input) {
|
|
6416
|
+
const schemaText = JSON.stringify(input.request.schema);
|
|
6417
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6418
|
+
return compactRecord({
|
|
6419
|
+
purpose: input.request.purpose,
|
|
6420
|
+
workdir: input.request.workdir,
|
|
6421
|
+
started_at: input.startedAt,
|
|
6422
|
+
finished_at: finishedAt,
|
|
6423
|
+
duration_ms: Date.now() - input.startedMs,
|
|
6424
|
+
prompt_chars: input.request.prompt.length,
|
|
6425
|
+
prompt_lines: input.request.prompt.split(/\r?\n/).length,
|
|
6426
|
+
schema_chars: schemaText.length,
|
|
6427
|
+
stdout_chars: (input.stdout || "").length,
|
|
6428
|
+
stderr_chars: (input.stderr || "").length,
|
|
6429
|
+
final_message_chars: (input.finalText || "").length,
|
|
6430
|
+
exit_status: input.status ?? null,
|
|
6431
|
+
timed_out: input.timedOut || false,
|
|
6432
|
+
error_code: input.errorCode,
|
|
6433
|
+
codex_command: input.config.codexCommand || "codex",
|
|
6434
|
+
codex_model: input.config.codexModel,
|
|
6435
|
+
codex_sandbox: input.config.codexSandbox || "workspace-write",
|
|
6436
|
+
codex_full_auto: input.config.codexFullAuto !== false,
|
|
6437
|
+
timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
|
|
6438
|
+
});
|
|
6439
|
+
}
|
|
6241
6440
|
function createCodexExecJsonRunner(config = {}) {
|
|
6242
6441
|
return (request) => {
|
|
6442
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6443
|
+
const startedMs = Date.now();
|
|
6243
6444
|
if (!request.workdir || !(0, import_node_fs4.existsSync)(request.workdir)) {
|
|
6244
6445
|
return {
|
|
6245
6446
|
ok: false,
|
|
6447
|
+
metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
|
|
6246
6448
|
blocker: {
|
|
6247
6449
|
code: "codex_workdir_missing",
|
|
6248
6450
|
message: `Codex workdir does not exist for ${request.purpose}.`,
|
|
@@ -6287,6 +6489,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6287
6489
|
ok: false,
|
|
6288
6490
|
stdout: proc.stdout || "",
|
|
6289
6491
|
stderr: proc.stderr || "",
|
|
6492
|
+
metrics: runnerMetrics({
|
|
6493
|
+
request,
|
|
6494
|
+
config,
|
|
6495
|
+
startedAt,
|
|
6496
|
+
startedMs,
|
|
6497
|
+
stdout: proc.stdout || "",
|
|
6498
|
+
stderr: proc.stderr || "",
|
|
6499
|
+
status: proc.status,
|
|
6500
|
+
timedOut,
|
|
6501
|
+
errorCode: proc.error.code || "spawn_error"
|
|
6502
|
+
}),
|
|
6290
6503
|
blocker: {
|
|
6291
6504
|
code: timedOut ? "codex_timeout" : "codex_exec_error",
|
|
6292
6505
|
message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
|
|
@@ -6299,6 +6512,16 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6299
6512
|
ok: false,
|
|
6300
6513
|
stdout: proc.stdout || "",
|
|
6301
6514
|
stderr: proc.stderr || "",
|
|
6515
|
+
metrics: runnerMetrics({
|
|
6516
|
+
request,
|
|
6517
|
+
config,
|
|
6518
|
+
startedAt,
|
|
6519
|
+
startedMs,
|
|
6520
|
+
stdout: proc.stdout || "",
|
|
6521
|
+
stderr: proc.stderr || "",
|
|
6522
|
+
status: proc.status,
|
|
6523
|
+
errorCode: "nonzero_exit"
|
|
6524
|
+
}),
|
|
6302
6525
|
blocker: {
|
|
6303
6526
|
code: "codex_nonzero_exit",
|
|
6304
6527
|
message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
|
|
@@ -6313,6 +6536,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6313
6536
|
ok: false,
|
|
6314
6537
|
stdout: proc.stdout || "",
|
|
6315
6538
|
stderr: proc.stderr || "",
|
|
6539
|
+
metrics: runnerMetrics({
|
|
6540
|
+
request,
|
|
6541
|
+
config,
|
|
6542
|
+
startedAt,
|
|
6543
|
+
startedMs,
|
|
6544
|
+
stdout: proc.stdout || "",
|
|
6545
|
+
stderr: proc.stderr || "",
|
|
6546
|
+
finalText,
|
|
6547
|
+
status: proc.status,
|
|
6548
|
+
errorCode: "invalid_json"
|
|
6549
|
+
}),
|
|
6316
6550
|
blocker: {
|
|
6317
6551
|
code: "codex_invalid_json",
|
|
6318
6552
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
@@ -6324,7 +6558,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6324
6558
|
ok: true,
|
|
6325
6559
|
json: parsed,
|
|
6326
6560
|
stdout: proc.stdout || "",
|
|
6327
|
-
stderr: proc.stderr || ""
|
|
6561
|
+
stderr: proc.stderr || "",
|
|
6562
|
+
metrics: runnerMetrics({
|
|
6563
|
+
request,
|
|
6564
|
+
config,
|
|
6565
|
+
startedAt,
|
|
6566
|
+
startedMs,
|
|
6567
|
+
stdout: proc.stdout || "",
|
|
6568
|
+
stderr: proc.stderr || "",
|
|
6569
|
+
finalText,
|
|
6570
|
+
status: proc.status
|
|
6571
|
+
})
|
|
6328
6572
|
};
|
|
6329
6573
|
} finally {
|
|
6330
6574
|
(0, import_node_fs4.rmSync)(tmpDir, { recursive: true, force: true });
|
|
@@ -6345,14 +6589,21 @@ function payloadOrBlocker(raw, checkpoint) {
|
|
|
6345
6589
|
ok: false,
|
|
6346
6590
|
blocker: {
|
|
6347
6591
|
...blocker,
|
|
6348
|
-
checkpoint
|
|
6592
|
+
checkpoint,
|
|
6593
|
+
details: {
|
|
6594
|
+
...blocker.details || {},
|
|
6595
|
+
runner_metrics: raw.metrics || null
|
|
6596
|
+
}
|
|
6349
6597
|
}
|
|
6350
6598
|
};
|
|
6351
6599
|
}
|
|
6352
6600
|
return {
|
|
6353
6601
|
ok: true,
|
|
6354
6602
|
payload: raw.json,
|
|
6355
|
-
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
|
|
6603
|
+
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
|
|
6604
|
+
details: compactRecord({
|
|
6605
|
+
runner_metrics: raw.metrics || null
|
|
6606
|
+
})
|
|
6356
6607
|
};
|
|
6357
6608
|
}
|
|
6358
6609
|
function stringArray(value) {
|
|
@@ -6488,14 +6739,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
6488
6739
|
agent_summary: summary,
|
|
6489
6740
|
agent_changed_files: changedFiles,
|
|
6490
6741
|
agent_tests_run: testsRun,
|
|
6491
|
-
agent_blockers: blockers
|
|
6742
|
+
agent_blockers: blockers,
|
|
6743
|
+
runner_metrics: raw.metrics || null
|
|
6492
6744
|
};
|
|
6493
6745
|
attemptSummaries.push({
|
|
6494
6746
|
purpose,
|
|
6495
6747
|
summary,
|
|
6496
6748
|
changed_files: changedFiles,
|
|
6497
6749
|
tests_run: testsRun,
|
|
6498
|
-
blockers
|
|
6750
|
+
blockers,
|
|
6751
|
+
runner_metrics: raw.metrics || null
|
|
6499
6752
|
});
|
|
6500
6753
|
if (hardBlockers.length) {
|
|
6501
6754
|
return {
|
|
@@ -7238,7 +7491,7 @@ function percentFrom(record) {
|
|
|
7238
7491
|
}
|
|
7239
7492
|
function numericFromAnyKey(record, keys) {
|
|
7240
7493
|
for (const key of keys) {
|
|
7241
|
-
const value =
|
|
7494
|
+
const value = numericValue2(record[key]);
|
|
7242
7495
|
if (value !== null) return value;
|
|
7243
7496
|
}
|
|
7244
7497
|
return null;
|
|
@@ -7249,7 +7502,7 @@ function recordValue2(value) {
|
|
|
7249
7502
|
function listValue(value) {
|
|
7250
7503
|
return Array.isArray(value) ? value : [];
|
|
7251
7504
|
}
|
|
7252
|
-
function
|
|
7505
|
+
function numericValue2(value) {
|
|
7253
7506
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
7254
7507
|
if (typeof value === "string" && value.trim()) {
|
|
7255
7508
|
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-3266V3MO.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,
|