@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/cli.cjs
CHANGED
|
@@ -3650,6 +3650,68 @@ function compactText2(value, limit = 600) {
|
|
|
3650
3650
|
if (!text) return void 0;
|
|
3651
3651
|
return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
|
|
3652
3652
|
}
|
|
3653
|
+
function numericValue(value) {
|
|
3654
|
+
const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
3655
|
+
return Number.isFinite(number) ? number : void 0;
|
|
3656
|
+
}
|
|
3657
|
+
function eventDetails(event) {
|
|
3658
|
+
return recordValue(recordValue(event)?.details) || {};
|
|
3659
|
+
}
|
|
3660
|
+
function collectRunnerMetrics(details) {
|
|
3661
|
+
const metrics = [];
|
|
3662
|
+
const adapterDetails = recordValue(details.adapter_details);
|
|
3663
|
+
const direct = recordValue(adapterDetails?.runner_metrics);
|
|
3664
|
+
if (direct) metrics.push(direct);
|
|
3665
|
+
const attempts = Array.isArray(adapterDetails?.attempt_summaries) ? adapterDetails.attempt_summaries : [];
|
|
3666
|
+
for (const attempt of attempts) {
|
|
3667
|
+
const attemptMetrics = recordValue(recordValue(attempt)?.runner_metrics);
|
|
3668
|
+
if (attemptMetrics) metrics.push(attemptMetrics);
|
|
3669
|
+
}
|
|
3670
|
+
return metrics;
|
|
3671
|
+
}
|
|
3672
|
+
function observabilityFrom(state) {
|
|
3673
|
+
const engineEvents = state.events.filter((event) => event.kind === "engine.result").map((event) => ({ event, details: eventDetails(event) }));
|
|
3674
|
+
const agentEvents = state.events.filter((event) => event.kind.startsWith("agent.")).map((event) => ({ event, details: eventDetails(event) })).filter(({ details }) => numericValue(details.duration_ms) !== void 0);
|
|
3675
|
+
const retryEvents = state.events.filter((event) => /retry|recovery/i.test(event.kind) || /retry|recovery/i.test(event.summary || "")).slice(-8);
|
|
3676
|
+
const runnerMetrics2 = agentEvents.flatMap(({ details }) => collectRunnerMetrics(details));
|
|
3677
|
+
const promptChars = runnerMetrics2.map((metrics) => numericValue(metrics.prompt_chars)).filter((value) => value !== void 0);
|
|
3678
|
+
const sum = (values) => values.reduce((total, value) => total + (value ?? 0), 0);
|
|
3679
|
+
const recentEngineTimings = engineEvents.slice(-8).map(({ event, details }) => compactRecord({
|
|
3680
|
+
checkpoint: event.checkpoint || null,
|
|
3681
|
+
stage: event.stage || null,
|
|
3682
|
+
duration_ms: numericValue(details.duration_ms),
|
|
3683
|
+
ok: details.ok ?? null
|
|
3684
|
+
}));
|
|
3685
|
+
const recentAgentTimings = agentEvents.slice(-8).map(({ event, details }) => {
|
|
3686
|
+
const metrics = collectRunnerMetrics(details);
|
|
3687
|
+
const localPromptChars = metrics.map((item) => numericValue(item.prompt_chars)).filter((value) => value !== void 0);
|
|
3688
|
+
return compactRecord({
|
|
3689
|
+
kind: event.kind,
|
|
3690
|
+
checkpoint: event.checkpoint || null,
|
|
3691
|
+
stage: event.stage || null,
|
|
3692
|
+
duration_ms: numericValue(details.duration_ms),
|
|
3693
|
+
prompt_chars: localPromptChars.length ? Math.max(...localPromptChars) : void 0,
|
|
3694
|
+
attempt_count: numericValue(recordValue(details.adapter_details)?.attempt_count)
|
|
3695
|
+
});
|
|
3696
|
+
});
|
|
3697
|
+
return compactRecord({
|
|
3698
|
+
engine_call_count: engineEvents.length,
|
|
3699
|
+
agent_call_count: agentEvents.length,
|
|
3700
|
+
engine_total_ms: sum(engineEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
3701
|
+
agent_total_ms: sum(agentEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
3702
|
+
max_agent_prompt_chars: promptChars.length ? Math.max(...promptChars) : void 0,
|
|
3703
|
+
total_agent_prompt_chars: promptChars.length ? sum(promptChars) : void 0,
|
|
3704
|
+
recent_engine_timings: recentEngineTimings.length ? recentEngineTimings : void 0,
|
|
3705
|
+
recent_agent_timings: recentAgentTimings.length ? recentAgentTimings : void 0,
|
|
3706
|
+
retry_event_count: retryEvents.length,
|
|
3707
|
+
recent_retry_reasons: retryEvents.length ? retryEvents.map((event) => compactRecord({
|
|
3708
|
+
kind: event.kind,
|
|
3709
|
+
checkpoint: event.checkpoint || null,
|
|
3710
|
+
stage: event.stage || null,
|
|
3711
|
+
summary: compactText2(event.summary, 240)
|
|
3712
|
+
})) : void 0
|
|
3713
|
+
});
|
|
3714
|
+
}
|
|
3653
3715
|
function visualDeltaFrom(input) {
|
|
3654
3716
|
const fullState = input.fullRiddleState || {};
|
|
3655
3717
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -3762,6 +3824,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
3762
3824
|
proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
|
|
3763
3825
|
artifacts
|
|
3764
3826
|
}),
|
|
3827
|
+
observability: observabilityFrom(state),
|
|
3765
3828
|
stop_condition: compactRecord({
|
|
3766
3829
|
status: state.status,
|
|
3767
3830
|
terminal: isTerminalStatus(state.status),
|
|
@@ -4816,7 +4879,10 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
4816
4879
|
worktree_path: workdir || null
|
|
4817
4880
|
}
|
|
4818
4881
|
});
|
|
4882
|
+
const implementationStartedAt = timestamp3();
|
|
4883
|
+
const implementationStartedMs = Date.now();
|
|
4819
4884
|
const implementation = await agent.implementChange({ ...context, workdir });
|
|
4885
|
+
const implementationDurationMs = Date.now() - implementationStartedMs;
|
|
4820
4886
|
if (implementation.blocker || implementation.ok === false) {
|
|
4821
4887
|
recordEvent(state, {
|
|
4822
4888
|
kind: "agent.implementation.blocked",
|
|
@@ -4825,6 +4891,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
4825
4891
|
summary: implementation.summary || implementation.blocker?.message || "Implementation adapter reported a blocker.",
|
|
4826
4892
|
details: compactRecord({
|
|
4827
4893
|
worktree_path: workdir || null,
|
|
4894
|
+
started_at: implementationStartedAt,
|
|
4895
|
+
duration_ms: implementationDurationMs,
|
|
4828
4896
|
changed_files: implementation.changedFiles || [],
|
|
4829
4897
|
tests_run: implementation.testsRun || [],
|
|
4830
4898
|
implementation_notes: implementation.implementationNotes || null,
|
|
@@ -4850,6 +4918,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
4850
4918
|
summary: implementation.summary || "Implementation adapter returned without leaving a detectable git diff.",
|
|
4851
4919
|
details: compactRecord({
|
|
4852
4920
|
worktree_path: workdir || null,
|
|
4921
|
+
started_at: implementationStartedAt,
|
|
4922
|
+
duration_ms: implementationDurationMs,
|
|
4853
4923
|
changed_files: implementation.changedFiles || [],
|
|
4854
4924
|
tests_run: implementation.testsRun || [],
|
|
4855
4925
|
implementation_notes: implementation.implementationNotes || null,
|
|
@@ -4864,7 +4934,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
4864
4934
|
details: compactRecord({
|
|
4865
4935
|
worktree_path: workdir || null,
|
|
4866
4936
|
checkpoint: result.checkpoint || null,
|
|
4867
|
-
next_stage: "implement"
|
|
4937
|
+
next_stage: "implement",
|
|
4938
|
+
previous_duration_ms: implementationDurationMs
|
|
4868
4939
|
})
|
|
4869
4940
|
});
|
|
4870
4941
|
return {
|
|
@@ -4883,6 +4954,8 @@ async function handleImplementation(request, state, result, agent) {
|
|
|
4883
4954
|
summary: implementation.summary || "Implementation adapter reported code changes.",
|
|
4884
4955
|
details: {
|
|
4885
4956
|
worktree_path: workdir || null,
|
|
4957
|
+
started_at: implementationStartedAt,
|
|
4958
|
+
duration_ms: implementationDurationMs,
|
|
4886
4959
|
diffDetected,
|
|
4887
4960
|
changed_files: implementation.changedFiles || [],
|
|
4888
4961
|
tests_run: implementation.testsRun || [],
|
|
@@ -4999,15 +5072,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
4999
5072
|
if (input.checkpoint_mode === "yield") {
|
|
5000
5073
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5001
5074
|
}
|
|
5075
|
+
const startedAt = timestamp3();
|
|
5076
|
+
const startedMs = Date.now();
|
|
5077
|
+
recordEvent(state, {
|
|
5078
|
+
kind: "agent.recon_assessment.started",
|
|
5079
|
+
checkpoint,
|
|
5080
|
+
stage: "recon",
|
|
5081
|
+
summary: "Recon assessment agent started.",
|
|
5082
|
+
details: { started_at: startedAt }
|
|
5083
|
+
});
|
|
5002
5084
|
const assessment = await agent.assessRecon(context);
|
|
5085
|
+
const durationMs = Date.now() - startedMs;
|
|
5003
5086
|
const blocker = requirePayload("recon_assessment", assessment, state, result);
|
|
5004
|
-
if (blocker)
|
|
5087
|
+
if (blocker) {
|
|
5088
|
+
recordEvent(state, {
|
|
5089
|
+
kind: "agent.recon_assessment.blocked",
|
|
5090
|
+
checkpoint,
|
|
5091
|
+
stage: "recon",
|
|
5092
|
+
summary: blocker.message,
|
|
5093
|
+
details: compactRecord({
|
|
5094
|
+
started_at: startedAt,
|
|
5095
|
+
duration_ms: durationMs,
|
|
5096
|
+
blocker,
|
|
5097
|
+
adapter_details: assessment.details || null
|
|
5098
|
+
})
|
|
5099
|
+
});
|
|
5100
|
+
return { blocker };
|
|
5101
|
+
}
|
|
5005
5102
|
recordEvent(state, {
|
|
5006
5103
|
kind: "agent.recon_assessment.completed",
|
|
5007
5104
|
checkpoint,
|
|
5008
5105
|
stage: "recon",
|
|
5009
5106
|
summary: assessment.summary,
|
|
5010
|
-
details: {
|
|
5107
|
+
details: compactRecord({
|
|
5108
|
+
payload: assessment.payload,
|
|
5109
|
+
started_at: startedAt,
|
|
5110
|
+
duration_ms: durationMs,
|
|
5111
|
+
adapter_details: assessment.details || null
|
|
5112
|
+
})
|
|
5011
5113
|
});
|
|
5012
5114
|
return {
|
|
5013
5115
|
next: { ...baseContinuation(result), recon_assessment_json: jsonParam(assessment.payload) }
|
|
@@ -5019,15 +5121,44 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5019
5121
|
if (input.checkpoint_mode === "yield") {
|
|
5020
5122
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5021
5123
|
}
|
|
5124
|
+
const startedAt = timestamp3();
|
|
5125
|
+
const startedMs = Date.now();
|
|
5126
|
+
recordEvent(state, {
|
|
5127
|
+
kind: "agent.author_packet.started",
|
|
5128
|
+
checkpoint,
|
|
5129
|
+
stage: "author",
|
|
5130
|
+
summary: "Proof authoring agent started.",
|
|
5131
|
+
details: { started_at: startedAt }
|
|
5132
|
+
});
|
|
5022
5133
|
const packet = await agent.authorProofPacket(context);
|
|
5134
|
+
const durationMs = Date.now() - startedMs;
|
|
5023
5135
|
const blocker = requirePayload("author_packet", packet, state, result);
|
|
5024
|
-
if (blocker)
|
|
5136
|
+
if (blocker) {
|
|
5137
|
+
recordEvent(state, {
|
|
5138
|
+
kind: "agent.author_packet.blocked",
|
|
5139
|
+
checkpoint,
|
|
5140
|
+
stage: "author",
|
|
5141
|
+
summary: blocker.message,
|
|
5142
|
+
details: compactRecord({
|
|
5143
|
+
started_at: startedAt,
|
|
5144
|
+
duration_ms: durationMs,
|
|
5145
|
+
blocker,
|
|
5146
|
+
adapter_details: packet.details || null
|
|
5147
|
+
})
|
|
5148
|
+
});
|
|
5149
|
+
return { blocker };
|
|
5150
|
+
}
|
|
5025
5151
|
recordEvent(state, {
|
|
5026
5152
|
kind: "agent.author_packet.completed",
|
|
5027
5153
|
checkpoint,
|
|
5028
5154
|
stage: "author",
|
|
5029
5155
|
summary: packet.summary,
|
|
5030
|
-
details: {
|
|
5156
|
+
details: compactRecord({
|
|
5157
|
+
payload: packet.payload,
|
|
5158
|
+
started_at: startedAt,
|
|
5159
|
+
duration_ms: durationMs,
|
|
5160
|
+
adapter_details: packet.details || null
|
|
5161
|
+
})
|
|
5031
5162
|
});
|
|
5032
5163
|
return {
|
|
5033
5164
|
next: { ...baseContinuation(result), author_packet_json: jsonParam(packet.payload) }
|
|
@@ -5050,9 +5181,31 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5050
5181
|
if (input.checkpoint_mode === "yield") {
|
|
5051
5182
|
return { terminal: checkpointAwaitingResult(state, result, input.checkpoint_visibility) };
|
|
5052
5183
|
}
|
|
5184
|
+
const startedAt = timestamp3();
|
|
5185
|
+
const startedMs = Date.now();
|
|
5186
|
+
recordEvent(state, {
|
|
5187
|
+
kind: "agent.proof_assessment.started",
|
|
5188
|
+
checkpoint,
|
|
5189
|
+
stage: "verify",
|
|
5190
|
+
summary: "Proof assessment agent started.",
|
|
5191
|
+
details: { started_at: startedAt }
|
|
5192
|
+
});
|
|
5053
5193
|
const assessment = await agent.assessProof(context);
|
|
5194
|
+
const durationMs = Date.now() - startedMs;
|
|
5054
5195
|
const blocker = requirePayload("proof_assessment", assessment, state, result);
|
|
5055
5196
|
if (blocker) {
|
|
5197
|
+
recordEvent(state, {
|
|
5198
|
+
kind: "agent.proof_assessment.blocked",
|
|
5199
|
+
checkpoint,
|
|
5200
|
+
stage: "verify",
|
|
5201
|
+
summary: blocker.message,
|
|
5202
|
+
details: compactRecord({
|
|
5203
|
+
started_at: startedAt,
|
|
5204
|
+
duration_ms: durationMs,
|
|
5205
|
+
blocker,
|
|
5206
|
+
adapter_details: assessment.details || null
|
|
5207
|
+
})
|
|
5208
|
+
});
|
|
5056
5209
|
if (blocker.code === "main_agent_proof_review_required") {
|
|
5057
5210
|
recordEvent(state, {
|
|
5058
5211
|
kind: "checkpoint.packet.requested",
|
|
@@ -5071,7 +5224,12 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5071
5224
|
checkpoint,
|
|
5072
5225
|
stage: "verify",
|
|
5073
5226
|
summary: assessment.summary,
|
|
5074
|
-
details: {
|
|
5227
|
+
details: compactRecord({
|
|
5228
|
+
payload,
|
|
5229
|
+
started_at: startedAt,
|
|
5230
|
+
duration_ms: durationMs,
|
|
5231
|
+
adapter_details: assessment.details || null
|
|
5232
|
+
})
|
|
5075
5233
|
});
|
|
5076
5234
|
const visualBlocker = proofAssessmentVisualBlocker({
|
|
5077
5235
|
...context.fullRiddleState || {},
|
|
@@ -5092,7 +5250,8 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
5092
5250
|
recovery_stage: "verify",
|
|
5093
5251
|
evidence_issue_code: recoveryAssessment.evidence_issue_code || null,
|
|
5094
5252
|
visual_delta: recoveryAssessment.visual_delta || null,
|
|
5095
|
-
proof_assessment: recoveryAssessment
|
|
5253
|
+
proof_assessment: recoveryAssessment,
|
|
5254
|
+
agent_duration_ms: durationMs
|
|
5096
5255
|
})
|
|
5097
5256
|
});
|
|
5098
5257
|
return { next: proofAssessmentContinuation(result, recoveryAssessment) };
|
|
@@ -5450,10 +5609,11 @@ var PROOF_SCHEMA = {
|
|
|
5450
5609
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
5451
5610
|
}
|
|
5452
5611
|
};
|
|
5453
|
-
var PROMPT_STRING_LIMIT =
|
|
5454
|
-
var PROMPT_ARRAY_LIMIT =
|
|
5455
|
-
var PROMPT_OBJECT_KEY_LIMIT =
|
|
5456
|
-
var PROMPT_BLOCK_LIMIT =
|
|
5612
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
5613
|
+
var PROMPT_ARRAY_LIMIT = 8;
|
|
5614
|
+
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
5615
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
5616
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
5457
5617
|
var PROMPT_KEY_PRIORITY = [
|
|
5458
5618
|
"ok",
|
|
5459
5619
|
"status",
|
|
@@ -5475,6 +5635,16 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
5475
5635
|
"after_cdn",
|
|
5476
5636
|
"before_baseline",
|
|
5477
5637
|
"prod_baseline",
|
|
5638
|
+
"route_hints",
|
|
5639
|
+
"route_candidates",
|
|
5640
|
+
"keyword_hits",
|
|
5641
|
+
"observations",
|
|
5642
|
+
"latest_attempt",
|
|
5643
|
+
"attempt_history",
|
|
5644
|
+
"current_plan",
|
|
5645
|
+
"plan_history",
|
|
5646
|
+
"decision_history",
|
|
5647
|
+
"refined_inputs",
|
|
5478
5648
|
"recon_assessment",
|
|
5479
5649
|
"baseline_understanding",
|
|
5480
5650
|
"supervisor_author_packet",
|
|
@@ -5498,6 +5668,7 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
5498
5668
|
"shipGate",
|
|
5499
5669
|
"last_error",
|
|
5500
5670
|
"errors",
|
|
5671
|
+
"runtime_events",
|
|
5501
5672
|
"events"
|
|
5502
5673
|
];
|
|
5503
5674
|
var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
|
|
@@ -5514,7 +5685,7 @@ function compactPromptValue(value, depth = 0, key = "") {
|
|
|
5514
5685
|
if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
|
|
5515
5686
|
return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
|
|
5516
5687
|
}
|
|
5517
|
-
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT :
|
|
5688
|
+
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
|
|
5518
5689
|
return truncatePromptString(value, limit);
|
|
5519
5690
|
}
|
|
5520
5691
|
if (Array.isArray(value)) {
|
|
@@ -5557,7 +5728,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
5557
5728
|
return after || fallback;
|
|
5558
5729
|
}
|
|
5559
5730
|
function basePrompt(context, role) {
|
|
5560
|
-
|
|
5731
|
+
const prompt = [
|
|
5561
5732
|
role,
|
|
5562
5733
|
"",
|
|
5563
5734
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -5569,6 +5740,9 @@ function basePrompt(context, role) {
|
|
|
5569
5740
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
5570
5741
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
5571
5742
|
].join("\n");
|
|
5743
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
5744
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
5745
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
5572
5746
|
}
|
|
5573
5747
|
function schemaRequiredKeys(schema) {
|
|
5574
5748
|
const required = schema?.required;
|
|
@@ -5645,11 +5819,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
|
|
|
5645
5819
|
const text = blocker.toLowerCase();
|
|
5646
5820
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
5647
5821
|
}
|
|
5822
|
+
function runnerMetrics(input) {
|
|
5823
|
+
const schemaText = JSON.stringify(input.request.schema);
|
|
5824
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5825
|
+
return compactRecord({
|
|
5826
|
+
purpose: input.request.purpose,
|
|
5827
|
+
workdir: input.request.workdir,
|
|
5828
|
+
started_at: input.startedAt,
|
|
5829
|
+
finished_at: finishedAt,
|
|
5830
|
+
duration_ms: Date.now() - input.startedMs,
|
|
5831
|
+
prompt_chars: input.request.prompt.length,
|
|
5832
|
+
prompt_lines: input.request.prompt.split(/\r?\n/).length,
|
|
5833
|
+
schema_chars: schemaText.length,
|
|
5834
|
+
stdout_chars: (input.stdout || "").length,
|
|
5835
|
+
stderr_chars: (input.stderr || "").length,
|
|
5836
|
+
final_message_chars: (input.finalText || "").length,
|
|
5837
|
+
exit_status: input.status ?? null,
|
|
5838
|
+
timed_out: input.timedOut || false,
|
|
5839
|
+
error_code: input.errorCode,
|
|
5840
|
+
codex_command: input.config.codexCommand || "codex",
|
|
5841
|
+
codex_model: input.config.codexModel,
|
|
5842
|
+
codex_sandbox: input.config.codexSandbox || "workspace-write",
|
|
5843
|
+
codex_full_auto: input.config.codexFullAuto !== false,
|
|
5844
|
+
timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
|
|
5845
|
+
});
|
|
5846
|
+
}
|
|
5648
5847
|
function createCodexExecJsonRunner(config = {}) {
|
|
5649
5848
|
return (request) => {
|
|
5849
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5850
|
+
const startedMs = Date.now();
|
|
5650
5851
|
if (!request.workdir || !(0, import_node_fs4.existsSync)(request.workdir)) {
|
|
5651
5852
|
return {
|
|
5652
5853
|
ok: false,
|
|
5854
|
+
metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
|
|
5653
5855
|
blocker: {
|
|
5654
5856
|
code: "codex_workdir_missing",
|
|
5655
5857
|
message: `Codex workdir does not exist for ${request.purpose}.`,
|
|
@@ -5694,6 +5896,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
5694
5896
|
ok: false,
|
|
5695
5897
|
stdout: proc.stdout || "",
|
|
5696
5898
|
stderr: proc.stderr || "",
|
|
5899
|
+
metrics: runnerMetrics({
|
|
5900
|
+
request,
|
|
5901
|
+
config,
|
|
5902
|
+
startedAt,
|
|
5903
|
+
startedMs,
|
|
5904
|
+
stdout: proc.stdout || "",
|
|
5905
|
+
stderr: proc.stderr || "",
|
|
5906
|
+
status: proc.status,
|
|
5907
|
+
timedOut,
|
|
5908
|
+
errorCode: proc.error.code || "spawn_error"
|
|
5909
|
+
}),
|
|
5697
5910
|
blocker: {
|
|
5698
5911
|
code: timedOut ? "codex_timeout" : "codex_exec_error",
|
|
5699
5912
|
message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
|
|
@@ -5706,6 +5919,16 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
5706
5919
|
ok: false,
|
|
5707
5920
|
stdout: proc.stdout || "",
|
|
5708
5921
|
stderr: proc.stderr || "",
|
|
5922
|
+
metrics: runnerMetrics({
|
|
5923
|
+
request,
|
|
5924
|
+
config,
|
|
5925
|
+
startedAt,
|
|
5926
|
+
startedMs,
|
|
5927
|
+
stdout: proc.stdout || "",
|
|
5928
|
+
stderr: proc.stderr || "",
|
|
5929
|
+
status: proc.status,
|
|
5930
|
+
errorCode: "nonzero_exit"
|
|
5931
|
+
}),
|
|
5709
5932
|
blocker: {
|
|
5710
5933
|
code: "codex_nonzero_exit",
|
|
5711
5934
|
message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
|
|
@@ -5720,6 +5943,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
5720
5943
|
ok: false,
|
|
5721
5944
|
stdout: proc.stdout || "",
|
|
5722
5945
|
stderr: proc.stderr || "",
|
|
5946
|
+
metrics: runnerMetrics({
|
|
5947
|
+
request,
|
|
5948
|
+
config,
|
|
5949
|
+
startedAt,
|
|
5950
|
+
startedMs,
|
|
5951
|
+
stdout: proc.stdout || "",
|
|
5952
|
+
stderr: proc.stderr || "",
|
|
5953
|
+
finalText,
|
|
5954
|
+
status: proc.status,
|
|
5955
|
+
errorCode: "invalid_json"
|
|
5956
|
+
}),
|
|
5723
5957
|
blocker: {
|
|
5724
5958
|
code: "codex_invalid_json",
|
|
5725
5959
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
@@ -5731,7 +5965,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
5731
5965
|
ok: true,
|
|
5732
5966
|
json: parsed,
|
|
5733
5967
|
stdout: proc.stdout || "",
|
|
5734
|
-
stderr: proc.stderr || ""
|
|
5968
|
+
stderr: proc.stderr || "",
|
|
5969
|
+
metrics: runnerMetrics({
|
|
5970
|
+
request,
|
|
5971
|
+
config,
|
|
5972
|
+
startedAt,
|
|
5973
|
+
startedMs,
|
|
5974
|
+
stdout: proc.stdout || "",
|
|
5975
|
+
stderr: proc.stderr || "",
|
|
5976
|
+
finalText,
|
|
5977
|
+
status: proc.status
|
|
5978
|
+
})
|
|
5735
5979
|
};
|
|
5736
5980
|
} finally {
|
|
5737
5981
|
(0, import_node_fs4.rmSync)(tmpDir, { recursive: true, force: true });
|
|
@@ -5752,14 +5996,21 @@ function payloadOrBlocker(raw, checkpoint) {
|
|
|
5752
5996
|
ok: false,
|
|
5753
5997
|
blocker: {
|
|
5754
5998
|
...blocker,
|
|
5755
|
-
checkpoint
|
|
5999
|
+
checkpoint,
|
|
6000
|
+
details: {
|
|
6001
|
+
...blocker.details || {},
|
|
6002
|
+
runner_metrics: raw.metrics || null
|
|
6003
|
+
}
|
|
5756
6004
|
}
|
|
5757
6005
|
};
|
|
5758
6006
|
}
|
|
5759
6007
|
return {
|
|
5760
6008
|
ok: true,
|
|
5761
6009
|
payload: raw.json,
|
|
5762
|
-
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
|
|
6010
|
+
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
|
|
6011
|
+
details: compactRecord({
|
|
6012
|
+
runner_metrics: raw.metrics || null
|
|
6013
|
+
})
|
|
5763
6014
|
};
|
|
5764
6015
|
}
|
|
5765
6016
|
function stringArray(value) {
|
|
@@ -5895,14 +6146,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
5895
6146
|
agent_summary: summary,
|
|
5896
6147
|
agent_changed_files: changedFiles,
|
|
5897
6148
|
agent_tests_run: testsRun,
|
|
5898
|
-
agent_blockers: blockers
|
|
6149
|
+
agent_blockers: blockers,
|
|
6150
|
+
runner_metrics: raw.metrics || null
|
|
5899
6151
|
};
|
|
5900
6152
|
attemptSummaries.push({
|
|
5901
6153
|
purpose,
|
|
5902
6154
|
summary,
|
|
5903
6155
|
changed_files: changedFiles,
|
|
5904
6156
|
tests_run: testsRun,
|
|
5905
|
-
blockers
|
|
6157
|
+
blockers,
|
|
6158
|
+
runner_metrics: raw.metrics || null
|
|
5906
6159
|
});
|
|
5907
6160
|
if (hardBlockers.length) {
|
|
5908
6161
|
return {
|
package/dist/cli.js
CHANGED
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
createDisabledRiddleProofAgentAdapter,
|
|
4
4
|
readRiddleProofRunStatus,
|
|
5
5
|
runRiddleProofEngineHarness
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-722PW3X3.js";
|
|
7
7
|
import "./chunk-4ASMX4R6.js";
|
|
8
8
|
import "./chunk-JFQXAJH2.js";
|
|
9
9
|
import {
|
|
10
10
|
createCodexExecAgentAdapter,
|
|
11
11
|
runCodexExecAgentDoctor
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-3266V3MO.js";
|
|
13
|
+
import "./chunk-U7Q3RB5D.js";
|
|
14
|
+
import "./chunk-CI2F66EE.js";
|
|
15
15
|
import "./chunk-R6SCWJCI.js";
|
|
16
16
|
import "./chunk-DUFDZJOF.js";
|
|
17
17
|
|