@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/local-agent.cjs
CHANGED
|
@@ -41,6 +41,13 @@ var import_node_child_process = require("child_process");
|
|
|
41
41
|
var import_node_fs = require("fs");
|
|
42
42
|
var import_node_os = __toESM(require("os"), 1);
|
|
43
43
|
var import_node_path = __toESM(require("path"), 1);
|
|
44
|
+
|
|
45
|
+
// src/result.ts
|
|
46
|
+
function compactRecord(input) {
|
|
47
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/codex-exec-agent.ts
|
|
44
51
|
var REFINED_INPUTS_SCHEMA = {
|
|
45
52
|
type: "object",
|
|
46
53
|
additionalProperties: false,
|
|
@@ -166,10 +173,11 @@ var PROOF_SCHEMA = {
|
|
|
166
173
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
167
174
|
}
|
|
168
175
|
};
|
|
169
|
-
var PROMPT_STRING_LIMIT =
|
|
170
|
-
var PROMPT_ARRAY_LIMIT =
|
|
171
|
-
var PROMPT_OBJECT_KEY_LIMIT =
|
|
172
|
-
var PROMPT_BLOCK_LIMIT =
|
|
176
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
177
|
+
var PROMPT_ARRAY_LIMIT = 8;
|
|
178
|
+
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
179
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
180
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
173
181
|
var PROMPT_KEY_PRIORITY = [
|
|
174
182
|
"ok",
|
|
175
183
|
"status",
|
|
@@ -191,6 +199,16 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
191
199
|
"after_cdn",
|
|
192
200
|
"before_baseline",
|
|
193
201
|
"prod_baseline",
|
|
202
|
+
"route_hints",
|
|
203
|
+
"route_candidates",
|
|
204
|
+
"keyword_hits",
|
|
205
|
+
"observations",
|
|
206
|
+
"latest_attempt",
|
|
207
|
+
"attempt_history",
|
|
208
|
+
"current_plan",
|
|
209
|
+
"plan_history",
|
|
210
|
+
"decision_history",
|
|
211
|
+
"refined_inputs",
|
|
194
212
|
"recon_assessment",
|
|
195
213
|
"baseline_understanding",
|
|
196
214
|
"supervisor_author_packet",
|
|
@@ -214,6 +232,7 @@ var PROMPT_KEY_PRIORITY = [
|
|
|
214
232
|
"shipGate",
|
|
215
233
|
"last_error",
|
|
216
234
|
"errors",
|
|
235
|
+
"runtime_events",
|
|
217
236
|
"events"
|
|
218
237
|
];
|
|
219
238
|
var PROMPT_PRIORITY_INDEX = new Map(PROMPT_KEY_PRIORITY.map((key, index) => [key, index]));
|
|
@@ -230,7 +249,7 @@ function compactPromptValue(value, depth = 0, key = "") {
|
|
|
230
249
|
if (!looksLikeUrl && (lowerKey.includes("base64") || lowerKey.includes("data_url") || lowerKey.includes("screenshot_blob"))) {
|
|
231
250
|
return `[omitted ${value.length} chars from ${key || "large artifact"}]`;
|
|
232
251
|
}
|
|
233
|
-
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT :
|
|
252
|
+
const limit = looksLikeUrl ? 1e3 : depth <= 1 ? PROMPT_STRING_LIMIT : 900;
|
|
234
253
|
return truncatePromptString(value, limit);
|
|
235
254
|
}
|
|
236
255
|
if (Array.isArray(value)) {
|
|
@@ -273,7 +292,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
273
292
|
return after || fallback;
|
|
274
293
|
}
|
|
275
294
|
function basePrompt(context, role) {
|
|
276
|
-
|
|
295
|
+
const prompt = [
|
|
277
296
|
role,
|
|
278
297
|
"",
|
|
279
298
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -285,6 +304,9 @@ function basePrompt(context, role) {
|
|
|
285
304
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
286
305
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
287
306
|
].join("\n");
|
|
307
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
308
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
309
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
288
310
|
}
|
|
289
311
|
function schemaRequiredKeys(schema) {
|
|
290
312
|
const required = schema?.required;
|
|
@@ -361,11 +383,39 @@ function isHarnessVerificationOnlyBlocker(blocker) {
|
|
|
361
383
|
const text = blocker.toLowerCase();
|
|
362
384
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
363
385
|
}
|
|
386
|
+
function runnerMetrics(input) {
|
|
387
|
+
const schemaText = JSON.stringify(input.request.schema);
|
|
388
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
389
|
+
return compactRecord({
|
|
390
|
+
purpose: input.request.purpose,
|
|
391
|
+
workdir: input.request.workdir,
|
|
392
|
+
started_at: input.startedAt,
|
|
393
|
+
finished_at: finishedAt,
|
|
394
|
+
duration_ms: Date.now() - input.startedMs,
|
|
395
|
+
prompt_chars: input.request.prompt.length,
|
|
396
|
+
prompt_lines: input.request.prompt.split(/\r?\n/).length,
|
|
397
|
+
schema_chars: schemaText.length,
|
|
398
|
+
stdout_chars: (input.stdout || "").length,
|
|
399
|
+
stderr_chars: (input.stderr || "").length,
|
|
400
|
+
final_message_chars: (input.finalText || "").length,
|
|
401
|
+
exit_status: input.status ?? null,
|
|
402
|
+
timed_out: input.timedOut || false,
|
|
403
|
+
error_code: input.errorCode,
|
|
404
|
+
codex_command: input.config.codexCommand || "codex",
|
|
405
|
+
codex_model: input.config.codexModel,
|
|
406
|
+
codex_sandbox: input.config.codexSandbox || "workspace-write",
|
|
407
|
+
codex_full_auto: input.config.codexFullAuto !== false,
|
|
408
|
+
timeout_ms: Number(input.config.codexTimeoutMs || 6e5)
|
|
409
|
+
});
|
|
410
|
+
}
|
|
364
411
|
function createCodexExecJsonRunner(config = {}) {
|
|
365
412
|
return (request) => {
|
|
413
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
414
|
+
const startedMs = Date.now();
|
|
366
415
|
if (!request.workdir || !(0, import_node_fs.existsSync)(request.workdir)) {
|
|
367
416
|
return {
|
|
368
417
|
ok: false,
|
|
418
|
+
metrics: runnerMetrics({ request, config, startedAt, startedMs, errorCode: "workdir_missing" }),
|
|
369
419
|
blocker: {
|
|
370
420
|
code: "codex_workdir_missing",
|
|
371
421
|
message: `Codex workdir does not exist for ${request.purpose}.`,
|
|
@@ -410,6 +460,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
410
460
|
ok: false,
|
|
411
461
|
stdout: proc.stdout || "",
|
|
412
462
|
stderr: proc.stderr || "",
|
|
463
|
+
metrics: runnerMetrics({
|
|
464
|
+
request,
|
|
465
|
+
config,
|
|
466
|
+
startedAt,
|
|
467
|
+
startedMs,
|
|
468
|
+
stdout: proc.stdout || "",
|
|
469
|
+
stderr: proc.stderr || "",
|
|
470
|
+
status: proc.status,
|
|
471
|
+
timedOut,
|
|
472
|
+
errorCode: proc.error.code || "spawn_error"
|
|
473
|
+
}),
|
|
413
474
|
blocker: {
|
|
414
475
|
code: timedOut ? "codex_timeout" : "codex_exec_error",
|
|
415
476
|
message: timedOut ? `Codex timed out during ${request.purpose}.` : `Codex failed to start or complete ${request.purpose}.`,
|
|
@@ -422,6 +483,16 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
422
483
|
ok: false,
|
|
423
484
|
stdout: proc.stdout || "",
|
|
424
485
|
stderr: proc.stderr || "",
|
|
486
|
+
metrics: runnerMetrics({
|
|
487
|
+
request,
|
|
488
|
+
config,
|
|
489
|
+
startedAt,
|
|
490
|
+
startedMs,
|
|
491
|
+
stdout: proc.stdout || "",
|
|
492
|
+
stderr: proc.stderr || "",
|
|
493
|
+
status: proc.status,
|
|
494
|
+
errorCode: "nonzero_exit"
|
|
495
|
+
}),
|
|
425
496
|
blocker: {
|
|
426
497
|
code: "codex_nonzero_exit",
|
|
427
498
|
message: `Codex exited with status ${proc.status} during ${request.purpose}.`,
|
|
@@ -436,6 +507,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
436
507
|
ok: false,
|
|
437
508
|
stdout: proc.stdout || "",
|
|
438
509
|
stderr: proc.stderr || "",
|
|
510
|
+
metrics: runnerMetrics({
|
|
511
|
+
request,
|
|
512
|
+
config,
|
|
513
|
+
startedAt,
|
|
514
|
+
startedMs,
|
|
515
|
+
stdout: proc.stdout || "",
|
|
516
|
+
stderr: proc.stderr || "",
|
|
517
|
+
finalText,
|
|
518
|
+
status: proc.status,
|
|
519
|
+
errorCode: "invalid_json"
|
|
520
|
+
}),
|
|
439
521
|
blocker: {
|
|
440
522
|
code: "codex_invalid_json",
|
|
441
523
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
@@ -447,7 +529,17 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
447
529
|
ok: true,
|
|
448
530
|
json: parsed,
|
|
449
531
|
stdout: proc.stdout || "",
|
|
450
|
-
stderr: proc.stderr || ""
|
|
532
|
+
stderr: proc.stderr || "",
|
|
533
|
+
metrics: runnerMetrics({
|
|
534
|
+
request,
|
|
535
|
+
config,
|
|
536
|
+
startedAt,
|
|
537
|
+
startedMs,
|
|
538
|
+
stdout: proc.stdout || "",
|
|
539
|
+
stderr: proc.stderr || "",
|
|
540
|
+
finalText,
|
|
541
|
+
status: proc.status
|
|
542
|
+
})
|
|
451
543
|
};
|
|
452
544
|
} finally {
|
|
453
545
|
(0, import_node_fs.rmSync)(tmpDir, { recursive: true, force: true });
|
|
@@ -468,14 +560,21 @@ function payloadOrBlocker(raw, checkpoint) {
|
|
|
468
560
|
ok: false,
|
|
469
561
|
blocker: {
|
|
470
562
|
...blocker,
|
|
471
|
-
checkpoint
|
|
563
|
+
checkpoint,
|
|
564
|
+
details: {
|
|
565
|
+
...blocker.details || {},
|
|
566
|
+
runner_metrics: raw.metrics || null
|
|
567
|
+
}
|
|
472
568
|
}
|
|
473
569
|
};
|
|
474
570
|
}
|
|
475
571
|
return {
|
|
476
572
|
ok: true,
|
|
477
573
|
payload: raw.json,
|
|
478
|
-
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0
|
|
574
|
+
summary: typeof raw.json.summary === "string" ? raw.json.summary : void 0,
|
|
575
|
+
details: compactRecord({
|
|
576
|
+
runner_metrics: raw.metrics || null
|
|
577
|
+
})
|
|
479
578
|
};
|
|
480
579
|
}
|
|
481
580
|
function stringArray(value) {
|
|
@@ -611,14 +710,16 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
611
710
|
agent_summary: summary,
|
|
612
711
|
agent_changed_files: changedFiles,
|
|
613
712
|
agent_tests_run: testsRun,
|
|
614
|
-
agent_blockers: blockers
|
|
713
|
+
agent_blockers: blockers,
|
|
714
|
+
runner_metrics: raw.metrics || null
|
|
615
715
|
};
|
|
616
716
|
attemptSummaries.push({
|
|
617
717
|
purpose,
|
|
618
718
|
summary,
|
|
619
719
|
changed_files: changedFiles,
|
|
620
720
|
tests_run: testsRun,
|
|
621
|
-
blockers
|
|
721
|
+
blockers,
|
|
722
|
+
runner_metrics: raw.metrics || null
|
|
622
723
|
});
|
|
623
724
|
if (hardBlockers.length) {
|
|
624
725
|
return {
|
package/dist/local-agent.js
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
createCodexExecAgentAdapter,
|
|
4
4
|
createCodexExecJsonRunner,
|
|
5
5
|
runCodexExecAgentDoctor
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3266V3MO.js";
|
|
7
|
+
import "./chunk-DUFDZJOF.js";
|
|
7
8
|
export {
|
|
8
9
|
createCodexExecAgentAdapter as createLocalAgentAdapter,
|
|
9
10
|
createCodexExecJsonRunner as createLocalAgentJsonRunner,
|
package/dist/openclaw.js
CHANGED
|
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
|
|
|
115
115
|
target_image_hash: string;
|
|
116
116
|
viewport_matrix_json: string;
|
|
117
117
|
deterministic_setup_json: string;
|
|
118
|
-
reference: "
|
|
118
|
+
reference: "before" | "prod" | "both";
|
|
119
119
|
base_branch: string;
|
|
120
120
|
before_ref: string;
|
|
121
121
|
allow_static_preview_fallback: string;
|
package/dist/proof-run-core.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
|
|
|
115
115
|
target_image_hash: string;
|
|
116
116
|
viewport_matrix_json: string;
|
|
117
117
|
deterministic_setup_json: string;
|
|
118
|
-
reference: "
|
|
118
|
+
reference: "before" | "prod" | "both";
|
|
119
119
|
base_branch: string;
|
|
120
120
|
before_ref: string;
|
|
121
121
|
allow_static_preview_fallback: string;
|
|
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
277
277
|
blocking?: boolean;
|
|
278
278
|
details?: Record<string, unknown>;
|
|
279
279
|
ok: boolean;
|
|
280
|
-
action: "
|
|
280
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
281
281
|
state_path: string;
|
|
282
282
|
stage: any;
|
|
283
283
|
summary: string;
|
|
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
362
362
|
continueWithStage?: WorkflowStage | null;
|
|
363
363
|
blocking?: boolean;
|
|
364
364
|
details?: Record<string, unknown>;
|
|
365
|
-
action: "
|
|
365
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
366
366
|
state_path: string;
|
|
367
367
|
stage: any;
|
|
368
368
|
checkpoint: string;
|
|
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
624
624
|
error?: undefined;
|
|
625
625
|
} | {
|
|
626
626
|
ok: boolean;
|
|
627
|
-
action: "
|
|
627
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
628
628
|
state_path: string;
|
|
629
629
|
stage: any;
|
|
630
630
|
summary: string;
|
|
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
277
277
|
blocking?: boolean;
|
|
278
278
|
details?: Record<string, unknown>;
|
|
279
279
|
ok: boolean;
|
|
280
|
-
action: "
|
|
280
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
281
281
|
state_path: string;
|
|
282
282
|
stage: any;
|
|
283
283
|
summary: string;
|
|
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
362
362
|
continueWithStage?: WorkflowStage | null;
|
|
363
363
|
blocking?: boolean;
|
|
364
364
|
details?: Record<string, unknown>;
|
|
365
|
-
action: "
|
|
365
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
366
366
|
state_path: string;
|
|
367
367
|
stage: any;
|
|
368
368
|
checkpoint: string;
|
|
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
624
624
|
error?: undefined;
|
|
625
625
|
} | {
|
|
626
626
|
ok: boolean;
|
|
627
|
-
action: "
|
|
627
|
+
action: "recon" | "author" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
628
628
|
state_path: string;
|
|
629
629
|
stage: any;
|
|
630
630
|
summary: string;
|
package/dist/run-card.cjs
CHANGED
|
@@ -81,6 +81,68 @@ function compactText(value, limit = 600) {
|
|
|
81
81
|
if (!text) return void 0;
|
|
82
82
|
return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
|
|
83
83
|
}
|
|
84
|
+
function numericValue(value) {
|
|
85
|
+
const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
86
|
+
return Number.isFinite(number) ? number : void 0;
|
|
87
|
+
}
|
|
88
|
+
function eventDetails(event) {
|
|
89
|
+
return recordValue(recordValue(event)?.details) || {};
|
|
90
|
+
}
|
|
91
|
+
function collectRunnerMetrics(details) {
|
|
92
|
+
const metrics = [];
|
|
93
|
+
const adapterDetails = recordValue(details.adapter_details);
|
|
94
|
+
const direct = recordValue(adapterDetails?.runner_metrics);
|
|
95
|
+
if (direct) metrics.push(direct);
|
|
96
|
+
const attempts = Array.isArray(adapterDetails?.attempt_summaries) ? adapterDetails.attempt_summaries : [];
|
|
97
|
+
for (const attempt of attempts) {
|
|
98
|
+
const attemptMetrics = recordValue(recordValue(attempt)?.runner_metrics);
|
|
99
|
+
if (attemptMetrics) metrics.push(attemptMetrics);
|
|
100
|
+
}
|
|
101
|
+
return metrics;
|
|
102
|
+
}
|
|
103
|
+
function observabilityFrom(state) {
|
|
104
|
+
const engineEvents = state.events.filter((event) => event.kind === "engine.result").map((event) => ({ event, details: eventDetails(event) }));
|
|
105
|
+
const agentEvents = state.events.filter((event) => event.kind.startsWith("agent.")).map((event) => ({ event, details: eventDetails(event) })).filter(({ details }) => numericValue(details.duration_ms) !== void 0);
|
|
106
|
+
const retryEvents = state.events.filter((event) => /retry|recovery/i.test(event.kind) || /retry|recovery/i.test(event.summary || "")).slice(-8);
|
|
107
|
+
const runnerMetrics = agentEvents.flatMap(({ details }) => collectRunnerMetrics(details));
|
|
108
|
+
const promptChars = runnerMetrics.map((metrics) => numericValue(metrics.prompt_chars)).filter((value) => value !== void 0);
|
|
109
|
+
const sum = (values) => values.reduce((total, value) => total + (value ?? 0), 0);
|
|
110
|
+
const recentEngineTimings = engineEvents.slice(-8).map(({ event, details }) => compactRecord({
|
|
111
|
+
checkpoint: event.checkpoint || null,
|
|
112
|
+
stage: event.stage || null,
|
|
113
|
+
duration_ms: numericValue(details.duration_ms),
|
|
114
|
+
ok: details.ok ?? null
|
|
115
|
+
}));
|
|
116
|
+
const recentAgentTimings = agentEvents.slice(-8).map(({ event, details }) => {
|
|
117
|
+
const metrics = collectRunnerMetrics(details);
|
|
118
|
+
const localPromptChars = metrics.map((item) => numericValue(item.prompt_chars)).filter((value) => value !== void 0);
|
|
119
|
+
return compactRecord({
|
|
120
|
+
kind: event.kind,
|
|
121
|
+
checkpoint: event.checkpoint || null,
|
|
122
|
+
stage: event.stage || null,
|
|
123
|
+
duration_ms: numericValue(details.duration_ms),
|
|
124
|
+
prompt_chars: localPromptChars.length ? Math.max(...localPromptChars) : void 0,
|
|
125
|
+
attempt_count: numericValue(recordValue(details.adapter_details)?.attempt_count)
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
return compactRecord({
|
|
129
|
+
engine_call_count: engineEvents.length,
|
|
130
|
+
agent_call_count: agentEvents.length,
|
|
131
|
+
engine_total_ms: sum(engineEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
132
|
+
agent_total_ms: sum(agentEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
133
|
+
max_agent_prompt_chars: promptChars.length ? Math.max(...promptChars) : void 0,
|
|
134
|
+
total_agent_prompt_chars: promptChars.length ? sum(promptChars) : void 0,
|
|
135
|
+
recent_engine_timings: recentEngineTimings.length ? recentEngineTimings : void 0,
|
|
136
|
+
recent_agent_timings: recentAgentTimings.length ? recentAgentTimings : void 0,
|
|
137
|
+
retry_event_count: retryEvents.length,
|
|
138
|
+
recent_retry_reasons: retryEvents.length ? retryEvents.map((event) => compactRecord({
|
|
139
|
+
kind: event.kind,
|
|
140
|
+
checkpoint: event.checkpoint || null,
|
|
141
|
+
stage: event.stage || null,
|
|
142
|
+
summary: compactText(event.summary, 240)
|
|
143
|
+
})) : void 0
|
|
144
|
+
});
|
|
145
|
+
}
|
|
84
146
|
function visualDeltaFrom(input) {
|
|
85
147
|
const fullState = input.fullRiddleState || {};
|
|
86
148
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -193,6 +255,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
193
255
|
proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
|
|
194
256
|
artifacts
|
|
195
257
|
}),
|
|
258
|
+
observability: observabilityFrom(state),
|
|
196
259
|
stop_condition: compactRecord({
|
|
197
260
|
status: state.status,
|
|
198
261
|
terminal: isTerminalStatus(state.status),
|
package/dist/run-card.js
CHANGED
package/dist/runner.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-YJPQOAZG.js";
|
|
4
|
+
import "./chunk-U7Q3RB5D.js";
|
|
5
|
+
import "./chunk-CI2F66EE.js";
|
|
6
6
|
import "./chunk-R6SCWJCI.js";
|
|
7
7
|
import "./chunk-DUFDZJOF.js";
|
|
8
8
|
export {
|
package/dist/state.cjs
CHANGED
|
@@ -89,6 +89,68 @@ function compactText(value, limit = 600) {
|
|
|
89
89
|
if (!text) return void 0;
|
|
90
90
|
return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
|
|
91
91
|
}
|
|
92
|
+
function numericValue(value) {
|
|
93
|
+
const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
94
|
+
return Number.isFinite(number) ? number : void 0;
|
|
95
|
+
}
|
|
96
|
+
function eventDetails(event) {
|
|
97
|
+
return recordValue(recordValue(event)?.details) || {};
|
|
98
|
+
}
|
|
99
|
+
function collectRunnerMetrics(details) {
|
|
100
|
+
const metrics = [];
|
|
101
|
+
const adapterDetails = recordValue(details.adapter_details);
|
|
102
|
+
const direct = recordValue(adapterDetails?.runner_metrics);
|
|
103
|
+
if (direct) metrics.push(direct);
|
|
104
|
+
const attempts = Array.isArray(adapterDetails?.attempt_summaries) ? adapterDetails.attempt_summaries : [];
|
|
105
|
+
for (const attempt of attempts) {
|
|
106
|
+
const attemptMetrics = recordValue(recordValue(attempt)?.runner_metrics);
|
|
107
|
+
if (attemptMetrics) metrics.push(attemptMetrics);
|
|
108
|
+
}
|
|
109
|
+
return metrics;
|
|
110
|
+
}
|
|
111
|
+
function observabilityFrom(state) {
|
|
112
|
+
const engineEvents = state.events.filter((event) => event.kind === "engine.result").map((event) => ({ event, details: eventDetails(event) }));
|
|
113
|
+
const agentEvents = state.events.filter((event) => event.kind.startsWith("agent.")).map((event) => ({ event, details: eventDetails(event) })).filter(({ details }) => numericValue(details.duration_ms) !== void 0);
|
|
114
|
+
const retryEvents = state.events.filter((event) => /retry|recovery/i.test(event.kind) || /retry|recovery/i.test(event.summary || "")).slice(-8);
|
|
115
|
+
const runnerMetrics = agentEvents.flatMap(({ details }) => collectRunnerMetrics(details));
|
|
116
|
+
const promptChars = runnerMetrics.map((metrics) => numericValue(metrics.prompt_chars)).filter((value) => value !== void 0);
|
|
117
|
+
const sum = (values) => values.reduce((total, value) => total + (value ?? 0), 0);
|
|
118
|
+
const recentEngineTimings = engineEvents.slice(-8).map(({ event, details }) => compactRecord({
|
|
119
|
+
checkpoint: event.checkpoint || null,
|
|
120
|
+
stage: event.stage || null,
|
|
121
|
+
duration_ms: numericValue(details.duration_ms),
|
|
122
|
+
ok: details.ok ?? null
|
|
123
|
+
}));
|
|
124
|
+
const recentAgentTimings = agentEvents.slice(-8).map(({ event, details }) => {
|
|
125
|
+
const metrics = collectRunnerMetrics(details);
|
|
126
|
+
const localPromptChars = metrics.map((item) => numericValue(item.prompt_chars)).filter((value) => value !== void 0);
|
|
127
|
+
return compactRecord({
|
|
128
|
+
kind: event.kind,
|
|
129
|
+
checkpoint: event.checkpoint || null,
|
|
130
|
+
stage: event.stage || null,
|
|
131
|
+
duration_ms: numericValue(details.duration_ms),
|
|
132
|
+
prompt_chars: localPromptChars.length ? Math.max(...localPromptChars) : void 0,
|
|
133
|
+
attempt_count: numericValue(recordValue(details.adapter_details)?.attempt_count)
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
return compactRecord({
|
|
137
|
+
engine_call_count: engineEvents.length,
|
|
138
|
+
agent_call_count: agentEvents.length,
|
|
139
|
+
engine_total_ms: sum(engineEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
140
|
+
agent_total_ms: sum(agentEvents.map(({ details }) => numericValue(details.duration_ms))),
|
|
141
|
+
max_agent_prompt_chars: promptChars.length ? Math.max(...promptChars) : void 0,
|
|
142
|
+
total_agent_prompt_chars: promptChars.length ? sum(promptChars) : void 0,
|
|
143
|
+
recent_engine_timings: recentEngineTimings.length ? recentEngineTimings : void 0,
|
|
144
|
+
recent_agent_timings: recentAgentTimings.length ? recentAgentTimings : void 0,
|
|
145
|
+
retry_event_count: retryEvents.length,
|
|
146
|
+
recent_retry_reasons: retryEvents.length ? retryEvents.map((event) => compactRecord({
|
|
147
|
+
kind: event.kind,
|
|
148
|
+
checkpoint: event.checkpoint || null,
|
|
149
|
+
stage: event.stage || null,
|
|
150
|
+
summary: compactText(event.summary, 240)
|
|
151
|
+
})) : void 0
|
|
152
|
+
});
|
|
153
|
+
}
|
|
92
154
|
function visualDeltaFrom(input) {
|
|
93
155
|
const fullState = input.fullRiddleState || {};
|
|
94
156
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -201,6 +263,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
201
263
|
proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
|
|
202
264
|
artifacts
|
|
203
265
|
}),
|
|
266
|
+
observability: observabilityFrom(state),
|
|
204
267
|
stop_condition: compactRecord({
|
|
205
268
|
status: state.status,
|
|
206
269
|
terminal: isTerminalStatus(state.status),
|
package/dist/state.js
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
normalizePrLifecycleState,
|
|
10
10
|
normalizeRunParams,
|
|
11
11
|
setRunStatus
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-U7Q3RB5D.js";
|
|
13
|
+
import "./chunk-CI2F66EE.js";
|
|
14
14
|
import "./chunk-R6SCWJCI.js";
|
|
15
15
|
import "./chunk-DUFDZJOF.js";
|
|
16
16
|
export {
|
package/dist/types.d.cts
CHANGED
|
@@ -199,6 +199,18 @@ interface RiddleProofRunCard {
|
|
|
199
199
|
proof_evidence_present?: boolean;
|
|
200
200
|
artifacts?: RiddleProofCheckpointArtifact[];
|
|
201
201
|
};
|
|
202
|
+
observability?: {
|
|
203
|
+
engine_call_count?: number;
|
|
204
|
+
agent_call_count?: number;
|
|
205
|
+
engine_total_ms?: number;
|
|
206
|
+
agent_total_ms?: number;
|
|
207
|
+
max_agent_prompt_chars?: number;
|
|
208
|
+
total_agent_prompt_chars?: number;
|
|
209
|
+
recent_engine_timings?: Array<Record<string, unknown>>;
|
|
210
|
+
recent_agent_timings?: Array<Record<string, unknown>>;
|
|
211
|
+
retry_event_count?: number;
|
|
212
|
+
recent_retry_reasons?: Array<Record<string, unknown>>;
|
|
213
|
+
};
|
|
202
214
|
stop_condition: {
|
|
203
215
|
status: RiddleProofStatus;
|
|
204
216
|
terminal?: boolean;
|
package/dist/types.d.ts
CHANGED
|
@@ -199,6 +199,18 @@ interface RiddleProofRunCard {
|
|
|
199
199
|
proof_evidence_present?: boolean;
|
|
200
200
|
artifacts?: RiddleProofCheckpointArtifact[];
|
|
201
201
|
};
|
|
202
|
+
observability?: {
|
|
203
|
+
engine_call_count?: number;
|
|
204
|
+
agent_call_count?: number;
|
|
205
|
+
engine_total_ms?: number;
|
|
206
|
+
agent_total_ms?: number;
|
|
207
|
+
max_agent_prompt_chars?: number;
|
|
208
|
+
total_agent_prompt_chars?: number;
|
|
209
|
+
recent_engine_timings?: Array<Record<string, unknown>>;
|
|
210
|
+
recent_agent_timings?: Array<Record<string, unknown>>;
|
|
211
|
+
retry_event_count?: number;
|
|
212
|
+
recent_retry_reasons?: Array<Record<string, unknown>>;
|
|
213
|
+
};
|
|
202
214
|
stop_condition: {
|
|
203
215
|
status: RiddleProofStatus;
|
|
204
216
|
terminal?: boolean;
|