@riddledc/riddle-proof 0.5.47 → 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-ALP5KOS2.js → chunk-722PW3X3.js} +185 -23
- 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 +369 -35
- 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 +269 -25
- package/dist/engine-harness.js +3 -3
- package/dist/index.cjs +371 -37
- 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.cjs +23 -4
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/dist/proof-run-engine.js +23 -4
- 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