@riddledc/riddle-proof 0.8.6 → 0.8.8
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/adapters/codex-exec-agent.cjs +30 -10
- package/dist/adapters/codex-exec-agent.js +1 -1
- package/dist/adapters/codex.cjs +30 -10
- package/dist/adapters/codex.js +1 -1
- package/dist/adapters/local-agent.cjs +30 -10
- package/dist/adapters/local-agent.js +1 -1
- package/dist/advanced/engine-harness.cjs +64 -7
- package/dist/advanced/engine-harness.js +2 -2
- package/dist/advanced/index.cjs +64 -7
- package/dist/advanced/index.d.cts +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.js +4 -4
- package/dist/advanced/proof-run-core.cjs +63 -6
- package/dist/advanced/proof-run-core.js +1 -1
- package/dist/advanced/proof-run-engine.cjs +63 -6
- package/dist/advanced/proof-run-engine.d.cts +1 -1
- package/dist/advanced/proof-run-engine.d.ts +1 -1
- package/dist/advanced/proof-run-engine.js +2 -2
- package/dist/advanced/runner.js +2 -2
- package/dist/{chunk-GMZ57RRY.js → chunk-46DDSZJR.js} +1 -1
- package/dist/{chunk-RV6LK7HU.js → chunk-5N5QFI2S.js} +63 -6
- package/dist/{chunk-UIJ7X63P.js → chunk-5N6MQCLC.js} +1 -1
- package/dist/{chunk-BDFSMWTI.js → chunk-E7ATYSYS.js} +1 -1
- package/dist/{chunk-5MILMRQY.js → chunk-PYCQNK66.js} +30 -10
- package/dist/{chunk-NAFJ4KSF.js → chunk-V6VZ3CAI.js} +2 -2
- package/dist/cli/index.js +4 -4
- package/dist/cli.cjs +99 -22
- package/dist/cli.js +4 -4
- package/dist/codex-exec-agent.cjs +30 -10
- package/dist/codex-exec-agent.js +1 -1
- package/dist/engine-harness.cjs +64 -7
- package/dist/engine-harness.js +2 -2
- package/dist/index.cjs +99 -22
- package/dist/index.js +4 -4
- package/dist/local-agent.cjs +30 -10
- package/dist/local-agent.js +1 -1
- package/dist/proof-run-core.cjs +63 -6
- package/dist/proof-run-core.js +1 -1
- package/dist/{proof-run-engine-BO1h0Bmy.d.cts → proof-run-engine-BlocjMni.d.cts} +3 -3
- package/dist/{proof-run-engine-CIdpWNh6.d.ts → proof-run-engine-C_m8WJmX.d.ts} +3 -3
- package/dist/proof-run-engine.cjs +63 -6
- package/dist/proof-run-engine.d.cts +1 -1
- package/dist/proof-run-engine.d.ts +1 -1
- package/dist/proof-run-engine.js +2 -2
- package/dist/runner.js +2 -2
- package/package.json +1 -1
- package/runtime/lib/author.py +39 -1
- package/runtime/lib/verify.py +241 -6
- package/runtime/tests/recon_verify_smoke.py +89 -20
|
@@ -197,6 +197,56 @@ function writeState(statePath, state) {
|
|
|
197
197
|
function normalizeOptionalString(value) {
|
|
198
198
|
return typeof value === "string" ? value.trim() : void 0;
|
|
199
199
|
}
|
|
200
|
+
var INTERACTION_VERIFICATION_MODES = /* @__PURE__ */ new Set(["interaction", "interactive", "user_flow", "user-flow", "workflow"]);
|
|
201
|
+
function normalizeRoutePath(value) {
|
|
202
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
203
|
+
if (!raw) return "";
|
|
204
|
+
try {
|
|
205
|
+
const url = /^https?:\/\//i.test(raw) ? new URL(raw) : new URL(raw.startsWith("/") || raw.startsWith("?") || raw.startsWith("#") ? raw : `/${raw}`, "https://riddle-proof.local");
|
|
206
|
+
const pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
207
|
+
return `${pathname}${url.search}${url.hash}`;
|
|
208
|
+
} catch {
|
|
209
|
+
const hashSplit = raw.split("#");
|
|
210
|
+
const beforeHash = hashSplit.shift() || "";
|
|
211
|
+
const hash = hashSplit.length ? `#${hashSplit.join("#")}` : "";
|
|
212
|
+
const querySplit = beforeHash.split("?");
|
|
213
|
+
const rawPath = querySplit.shift() || "";
|
|
214
|
+
const query = querySplit.length ? `?${querySplit.join("?")}` : "";
|
|
215
|
+
const pathname = `/${rawPath}`.replace(/\/+/g, "/").replace(/\/+$/, "") || "/";
|
|
216
|
+
return `${pathname}${query}${hash}`;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function isInteractionVerificationMode(value) {
|
|
220
|
+
return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
|
|
221
|
+
}
|
|
222
|
+
function stringRecordValue(record, key) {
|
|
223
|
+
if (!record || typeof record !== "object") return "";
|
|
224
|
+
const value = record[key];
|
|
225
|
+
return typeof value === "string" ? value.trim() : "";
|
|
226
|
+
}
|
|
227
|
+
function appendStateWarning(state, key, warning) {
|
|
228
|
+
const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
|
|
229
|
+
if (!existing.includes(warning)) state[key] = [...existing, warning];
|
|
230
|
+
}
|
|
231
|
+
function interactionStartPathForAuthorPacket(state, parsed, refined) {
|
|
232
|
+
return normalizeRoutePath(
|
|
233
|
+
stringRecordValue(state, "expected_start_path") || stringRecordValue(refined, "expected_start_path") || stringRecordValue(parsed.interaction_contract, "start_path") || stringRecordValue(parsed.proof_contract, "start_path") || stringRecordValue(state, "server_path") || "/"
|
|
234
|
+
) || "/";
|
|
235
|
+
}
|
|
236
|
+
function authorPacketServerPath(state, parsed, refined, serverPath, expectedTerminalPath) {
|
|
237
|
+
if (!isInteractionVerificationMode(state.verification_mode)) return serverPath;
|
|
238
|
+
const startPath = interactionStartPathForAuthorPacket(state, parsed, refined);
|
|
239
|
+
state.expected_start_path = startPath;
|
|
240
|
+
if (expectedTerminalPath && normalizeRoutePath(serverPath) === normalizeRoutePath(expectedTerminalPath) && normalizeRoutePath(serverPath) !== startPath) {
|
|
241
|
+
appendStateWarning(
|
|
242
|
+
state,
|
|
243
|
+
"author_warnings",
|
|
244
|
+
"Supervisor packet refined_inputs.server_path matched the terminal interaction route; kept the recon start route for capture."
|
|
245
|
+
);
|
|
246
|
+
return startPath;
|
|
247
|
+
}
|
|
248
|
+
return serverPath;
|
|
249
|
+
}
|
|
200
250
|
function knownEnvironmentIssuesFromNotes(notes) {
|
|
201
251
|
const text = notes.toLowerCase();
|
|
202
252
|
const issues = [];
|
|
@@ -855,17 +905,24 @@ function mergeStateFromParams(statePath, params) {
|
|
|
855
905
|
state.proof_contract = parsed.proof_contract;
|
|
856
906
|
}
|
|
857
907
|
const refined = parsed?.refined_inputs || {};
|
|
908
|
+
const expectedTerminalPath = normalizeOptionalString(
|
|
909
|
+
typeof refined?.expected_terminal_path === "string" ? refined.expected_terminal_path : typeof parsed?.expected_terminal_path === "string" ? parsed.expected_terminal_path : ""
|
|
910
|
+
) || "";
|
|
858
911
|
if (typeof refined?.server_path === "string") {
|
|
859
|
-
|
|
912
|
+
const refinedServerPath = normalizeOptionalString(refined.server_path) || "";
|
|
913
|
+
state.server_path = authorPacketServerPath(
|
|
914
|
+
state,
|
|
915
|
+
parsed,
|
|
916
|
+
refined,
|
|
917
|
+
refinedServerPath,
|
|
918
|
+
expectedTerminalPath
|
|
919
|
+
);
|
|
860
920
|
state.server_path_source = "supervising_agent";
|
|
861
921
|
}
|
|
862
922
|
if (typeof refined?.wait_for_selector === "string") state.wait_for_selector = normalizeOptionalString(refined.wait_for_selector) || "";
|
|
863
923
|
if (typeof refined?.reference === "string" && refined.reference.trim()) state.reference = refined.reference.trim();
|
|
864
|
-
if (
|
|
865
|
-
state.expected_terminal_path =
|
|
866
|
-
}
|
|
867
|
-
if (typeof parsed?.expected_terminal_path === "string") {
|
|
868
|
-
state.expected_terminal_path = normalizeOptionalString(parsed.expected_terminal_path) || "";
|
|
924
|
+
if (expectedTerminalPath) {
|
|
925
|
+
state.expected_terminal_path = expectedTerminalPath;
|
|
869
926
|
}
|
|
870
927
|
if (typeof parsed?.confidence === "string") state.supervisor_author_confidence = normalizeOptionalString(parsed.confidence) || null;
|
|
871
928
|
if (parsed?.rationale !== void 0) state.supervisor_author_rationale = parsed.rationale;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-
|
|
1
|
+
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-BlocjMni.cjs';
|
|
2
2
|
import '../proof-run-core-CE0jx7wL.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-
|
|
1
|
+
export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-C_m8WJmX.js';
|
|
2
2
|
import '../proof-run-core-CE0jx7wL.js';
|
package/dist/advanced/runner.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-5N6MQCLC.js";
|
|
4
4
|
import "../chunk-YZUVEJ5B.js";
|
|
5
5
|
import "../chunk-FMOYUYH2.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-5N5QFI2S.js";
|
|
7
7
|
import "../chunk-4FOHZ7JG.js";
|
|
8
8
|
import "../chunk-VY4Y5U57.js";
|
|
9
9
|
import "../chunk-MLKGABMK.js";
|
|
@@ -188,6 +188,56 @@ function writeState(statePath, state) {
|
|
|
188
188
|
function normalizeOptionalString(value) {
|
|
189
189
|
return typeof value === "string" ? value.trim() : void 0;
|
|
190
190
|
}
|
|
191
|
+
var INTERACTION_VERIFICATION_MODES = /* @__PURE__ */ new Set(["interaction", "interactive", "user_flow", "user-flow", "workflow"]);
|
|
192
|
+
function normalizeRoutePath(value) {
|
|
193
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
194
|
+
if (!raw) return "";
|
|
195
|
+
try {
|
|
196
|
+
const url = /^https?:\/\//i.test(raw) ? new URL(raw) : new URL(raw.startsWith("/") || raw.startsWith("?") || raw.startsWith("#") ? raw : `/${raw}`, "https://riddle-proof.local");
|
|
197
|
+
const pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
198
|
+
return `${pathname}${url.search}${url.hash}`;
|
|
199
|
+
} catch {
|
|
200
|
+
const hashSplit = raw.split("#");
|
|
201
|
+
const beforeHash = hashSplit.shift() || "";
|
|
202
|
+
const hash = hashSplit.length ? `#${hashSplit.join("#")}` : "";
|
|
203
|
+
const querySplit = beforeHash.split("?");
|
|
204
|
+
const rawPath = querySplit.shift() || "";
|
|
205
|
+
const query = querySplit.length ? `?${querySplit.join("?")}` : "";
|
|
206
|
+
const pathname = `/${rawPath}`.replace(/\/+/g, "/").replace(/\/+$/, "") || "/";
|
|
207
|
+
return `${pathname}${query}${hash}`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function isInteractionVerificationMode(value) {
|
|
211
|
+
return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
|
|
212
|
+
}
|
|
213
|
+
function stringRecordValue(record, key) {
|
|
214
|
+
if (!record || typeof record !== "object") return "";
|
|
215
|
+
const value = record[key];
|
|
216
|
+
return typeof value === "string" ? value.trim() : "";
|
|
217
|
+
}
|
|
218
|
+
function appendStateWarning(state, key, warning) {
|
|
219
|
+
const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
|
|
220
|
+
if (!existing.includes(warning)) state[key] = [...existing, warning];
|
|
221
|
+
}
|
|
222
|
+
function interactionStartPathForAuthorPacket(state, parsed, refined) {
|
|
223
|
+
return normalizeRoutePath(
|
|
224
|
+
stringRecordValue(state, "expected_start_path") || stringRecordValue(refined, "expected_start_path") || stringRecordValue(parsed.interaction_contract, "start_path") || stringRecordValue(parsed.proof_contract, "start_path") || stringRecordValue(state, "server_path") || "/"
|
|
225
|
+
) || "/";
|
|
226
|
+
}
|
|
227
|
+
function authorPacketServerPath(state, parsed, refined, serverPath, expectedTerminalPath) {
|
|
228
|
+
if (!isInteractionVerificationMode(state.verification_mode)) return serverPath;
|
|
229
|
+
const startPath = interactionStartPathForAuthorPacket(state, parsed, refined);
|
|
230
|
+
state.expected_start_path = startPath;
|
|
231
|
+
if (expectedTerminalPath && normalizeRoutePath(serverPath) === normalizeRoutePath(expectedTerminalPath) && normalizeRoutePath(serverPath) !== startPath) {
|
|
232
|
+
appendStateWarning(
|
|
233
|
+
state,
|
|
234
|
+
"author_warnings",
|
|
235
|
+
"Supervisor packet refined_inputs.server_path matched the terminal interaction route; kept the recon start route for capture."
|
|
236
|
+
);
|
|
237
|
+
return startPath;
|
|
238
|
+
}
|
|
239
|
+
return serverPath;
|
|
240
|
+
}
|
|
191
241
|
function knownEnvironmentIssuesFromNotes(notes) {
|
|
192
242
|
const text = notes.toLowerCase();
|
|
193
243
|
const issues = [];
|
|
@@ -846,17 +896,24 @@ function mergeStateFromParams(statePath, params) {
|
|
|
846
896
|
state.proof_contract = parsed.proof_contract;
|
|
847
897
|
}
|
|
848
898
|
const refined = parsed?.refined_inputs || {};
|
|
899
|
+
const expectedTerminalPath = normalizeOptionalString(
|
|
900
|
+
typeof refined?.expected_terminal_path === "string" ? refined.expected_terminal_path : typeof parsed?.expected_terminal_path === "string" ? parsed.expected_terminal_path : ""
|
|
901
|
+
) || "";
|
|
849
902
|
if (typeof refined?.server_path === "string") {
|
|
850
|
-
|
|
903
|
+
const refinedServerPath = normalizeOptionalString(refined.server_path) || "";
|
|
904
|
+
state.server_path = authorPacketServerPath(
|
|
905
|
+
state,
|
|
906
|
+
parsed,
|
|
907
|
+
refined,
|
|
908
|
+
refinedServerPath,
|
|
909
|
+
expectedTerminalPath
|
|
910
|
+
);
|
|
851
911
|
state.server_path_source = "supervising_agent";
|
|
852
912
|
}
|
|
853
913
|
if (typeof refined?.wait_for_selector === "string") state.wait_for_selector = normalizeOptionalString(refined.wait_for_selector) || "";
|
|
854
914
|
if (typeof refined?.reference === "string" && refined.reference.trim()) state.reference = refined.reference.trim();
|
|
855
|
-
if (
|
|
856
|
-
state.expected_terminal_path =
|
|
857
|
-
}
|
|
858
|
-
if (typeof parsed?.expected_terminal_path === "string") {
|
|
859
|
-
state.expected_terminal_path = normalizeOptionalString(parsed.expected_terminal_path) || "";
|
|
915
|
+
if (expectedTerminalPath) {
|
|
916
|
+
state.expected_terminal_path = expectedTerminalPath;
|
|
860
917
|
}
|
|
861
918
|
if (typeof parsed?.confidence === "string") state.supervisor_author_confidence = normalizeOptionalString(parsed.confidence) || null;
|
|
862
919
|
if (parsed?.rationale !== void 0) state.supervisor_author_rationale = parsed.rationale;
|
|
@@ -338,6 +338,18 @@ function parseJsonObject(raw, schema) {
|
|
|
338
338
|
}
|
|
339
339
|
return null;
|
|
340
340
|
}
|
|
341
|
+
function parseJsonFromRunnerOutputs(outputs, schema) {
|
|
342
|
+
const seen = /* @__PURE__ */ new Set();
|
|
343
|
+
for (const output of outputs) {
|
|
344
|
+
if (!output.text.trim() || seen.has(output.text)) continue;
|
|
345
|
+
seen.add(output.text);
|
|
346
|
+
const parsed = parseJsonObject(output.text, schema);
|
|
347
|
+
if (parsed) return { parsed, source: output.source };
|
|
348
|
+
}
|
|
349
|
+
const combined = outputs.map((output) => output.text).filter((text) => text.trim()).join("\n");
|
|
350
|
+
if (!combined.trim() || seen.has(combined)) return { parsed: null, source: "" };
|
|
351
|
+
return { parsed: parseJsonObject(combined, schema), source: "combined_output" };
|
|
352
|
+
}
|
|
341
353
|
function isHarnessVerificationOnlyBlocker(blocker) {
|
|
342
354
|
const text = blocker.toLowerCase();
|
|
343
355
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
@@ -357,6 +369,7 @@ function runnerMetrics(input) {
|
|
|
357
369
|
stdout_chars: (input.stdout || "").length,
|
|
358
370
|
stderr_chars: (input.stderr || "").length,
|
|
359
371
|
final_message_chars: (input.finalText || "").length,
|
|
372
|
+
parsed_json_source: input.parsedJsonSource,
|
|
360
373
|
exit_status: input.status ?? null,
|
|
361
374
|
timed_out: input.timedOut || false,
|
|
362
375
|
error_code: input.errorCode,
|
|
@@ -460,19 +473,25 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
460
473
|
};
|
|
461
474
|
}
|
|
462
475
|
const finalText = existsSync(lastMessagePath) ? readFileSync(lastMessagePath, "utf-8") : String(proc.stdout || "");
|
|
463
|
-
const
|
|
476
|
+
const stdoutText = String(proc.stdout || "");
|
|
477
|
+
const stderrText = String(proc.stderr || "");
|
|
478
|
+
const { parsed, source: parsedJsonSource } = parseJsonFromRunnerOutputs([
|
|
479
|
+
{ source: existsSync(lastMessagePath) ? "last_message" : "stdout", text: finalText },
|
|
480
|
+
{ source: "stdout", text: stdoutText },
|
|
481
|
+
{ source: "stderr", text: stderrText }
|
|
482
|
+
], request.schema);
|
|
464
483
|
if (!parsed) {
|
|
465
484
|
return {
|
|
466
485
|
ok: false,
|
|
467
|
-
stdout:
|
|
468
|
-
stderr:
|
|
486
|
+
stdout: stdoutText,
|
|
487
|
+
stderr: stderrText,
|
|
469
488
|
metrics: runnerMetrics({
|
|
470
489
|
request,
|
|
471
490
|
config,
|
|
472
491
|
startedAt,
|
|
473
492
|
startedMs,
|
|
474
|
-
stdout:
|
|
475
|
-
stderr:
|
|
493
|
+
stdout: stdoutText,
|
|
494
|
+
stderr: stderrText,
|
|
476
495
|
finalText,
|
|
477
496
|
status: proc.status,
|
|
478
497
|
errorCode: "invalid_json"
|
|
@@ -480,23 +499,24 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
480
499
|
blocker: {
|
|
481
500
|
code: "codex_invalid_json",
|
|
482
501
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
483
|
-
details: { finalText, stdout:
|
|
502
|
+
details: { finalText, stdout: stdoutText, stderr: stderrText }
|
|
484
503
|
}
|
|
485
504
|
};
|
|
486
505
|
}
|
|
487
506
|
return {
|
|
488
507
|
ok: true,
|
|
489
508
|
json: parsed,
|
|
490
|
-
stdout:
|
|
491
|
-
stderr:
|
|
509
|
+
stdout: stdoutText,
|
|
510
|
+
stderr: stderrText,
|
|
492
511
|
metrics: runnerMetrics({
|
|
493
512
|
request,
|
|
494
513
|
config,
|
|
495
514
|
startedAt,
|
|
496
515
|
startedMs,
|
|
497
|
-
stdout:
|
|
498
|
-
stderr:
|
|
516
|
+
stdout: stdoutText,
|
|
517
|
+
stderr: stderrText,
|
|
499
518
|
finalText,
|
|
519
|
+
parsedJsonSource,
|
|
500
520
|
status: proc.status
|
|
501
521
|
})
|
|
502
522
|
};
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
createDisabledRiddleProofAgentAdapter,
|
|
23
23
|
readRiddleProofRunStatus,
|
|
24
24
|
runRiddleProofEngineHarness
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-E7ATYSYS.js";
|
|
26
26
|
import {
|
|
27
27
|
createCheckpointResponseTemplate
|
|
28
28
|
} from "./chunk-4FOHZ7JG.js";
|
|
29
29
|
import {
|
|
30
30
|
createCodexExecAgentAdapter,
|
|
31
31
|
runCodexExecAgentDoctor
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PYCQNK66.js";
|
|
33
33
|
|
|
34
34
|
// src/cli.ts
|
|
35
35
|
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-V6VZ3CAI.js";
|
|
2
2
|
import "../chunk-PEWAIEER.js";
|
|
3
3
|
import "../chunk-TWTEUS7R.js";
|
|
4
|
-
import "../chunk-
|
|
4
|
+
import "../chunk-E7ATYSYS.js";
|
|
5
5
|
import "../chunk-YZUVEJ5B.js";
|
|
6
6
|
import "../chunk-FMOYUYH2.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-5N5QFI2S.js";
|
|
8
8
|
import "../chunk-4FOHZ7JG.js";
|
|
9
9
|
import "../chunk-JFQXAJH2.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-PYCQNK66.js";
|
|
11
11
|
import "../chunk-VY4Y5U57.js";
|
|
12
12
|
import "../chunk-MLKGABMK.js";
|
package/dist/cli.cjs
CHANGED
|
@@ -172,6 +172,55 @@ function writeState(statePath, state) {
|
|
|
172
172
|
function normalizeOptionalString(value) {
|
|
173
173
|
return typeof value === "string" ? value.trim() : void 0;
|
|
174
174
|
}
|
|
175
|
+
function normalizeRoutePath(value) {
|
|
176
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
177
|
+
if (!raw) return "";
|
|
178
|
+
try {
|
|
179
|
+
const url = /^https?:\/\//i.test(raw) ? new URL(raw) : new URL(raw.startsWith("/") || raw.startsWith("?") || raw.startsWith("#") ? raw : `/${raw}`, "https://riddle-proof.local");
|
|
180
|
+
const pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
181
|
+
return `${pathname}${url.search}${url.hash}`;
|
|
182
|
+
} catch {
|
|
183
|
+
const hashSplit = raw.split("#");
|
|
184
|
+
const beforeHash = hashSplit.shift() || "";
|
|
185
|
+
const hash = hashSplit.length ? `#${hashSplit.join("#")}` : "";
|
|
186
|
+
const querySplit = beforeHash.split("?");
|
|
187
|
+
const rawPath = querySplit.shift() || "";
|
|
188
|
+
const query = querySplit.length ? `?${querySplit.join("?")}` : "";
|
|
189
|
+
const pathname = `/${rawPath}`.replace(/\/+/g, "/").replace(/\/+$/, "") || "/";
|
|
190
|
+
return `${pathname}${query}${hash}`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function isInteractionVerificationMode(value) {
|
|
194
|
+
return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
|
|
195
|
+
}
|
|
196
|
+
function stringRecordValue(record, key) {
|
|
197
|
+
if (!record || typeof record !== "object") return "";
|
|
198
|
+
const value = record[key];
|
|
199
|
+
return typeof value === "string" ? value.trim() : "";
|
|
200
|
+
}
|
|
201
|
+
function appendStateWarning(state, key, warning) {
|
|
202
|
+
const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
|
|
203
|
+
if (!existing.includes(warning)) state[key] = [...existing, warning];
|
|
204
|
+
}
|
|
205
|
+
function interactionStartPathForAuthorPacket(state, parsed, refined) {
|
|
206
|
+
return normalizeRoutePath(
|
|
207
|
+
stringRecordValue(state, "expected_start_path") || stringRecordValue(refined, "expected_start_path") || stringRecordValue(parsed.interaction_contract, "start_path") || stringRecordValue(parsed.proof_contract, "start_path") || stringRecordValue(state, "server_path") || "/"
|
|
208
|
+
) || "/";
|
|
209
|
+
}
|
|
210
|
+
function authorPacketServerPath(state, parsed, refined, serverPath, expectedTerminalPath) {
|
|
211
|
+
if (!isInteractionVerificationMode(state.verification_mode)) return serverPath;
|
|
212
|
+
const startPath = interactionStartPathForAuthorPacket(state, parsed, refined);
|
|
213
|
+
state.expected_start_path = startPath;
|
|
214
|
+
if (expectedTerminalPath && normalizeRoutePath(serverPath) === normalizeRoutePath(expectedTerminalPath) && normalizeRoutePath(serverPath) !== startPath) {
|
|
215
|
+
appendStateWarning(
|
|
216
|
+
state,
|
|
217
|
+
"author_warnings",
|
|
218
|
+
"Supervisor packet refined_inputs.server_path matched the terminal interaction route; kept the recon start route for capture."
|
|
219
|
+
);
|
|
220
|
+
return startPath;
|
|
221
|
+
}
|
|
222
|
+
return serverPath;
|
|
223
|
+
}
|
|
175
224
|
function knownEnvironmentIssuesFromNotes(notes) {
|
|
176
225
|
const text = notes.toLowerCase();
|
|
177
226
|
const issues = [];
|
|
@@ -652,17 +701,24 @@ function mergeStateFromParams(statePath, params) {
|
|
|
652
701
|
state.proof_contract = parsed.proof_contract;
|
|
653
702
|
}
|
|
654
703
|
const refined = parsed?.refined_inputs || {};
|
|
704
|
+
const expectedTerminalPath = normalizeOptionalString(
|
|
705
|
+
typeof refined?.expected_terminal_path === "string" ? refined.expected_terminal_path : typeof parsed?.expected_terminal_path === "string" ? parsed.expected_terminal_path : ""
|
|
706
|
+
) || "";
|
|
655
707
|
if (typeof refined?.server_path === "string") {
|
|
656
|
-
|
|
708
|
+
const refinedServerPath = normalizeOptionalString(refined.server_path) || "";
|
|
709
|
+
state.server_path = authorPacketServerPath(
|
|
710
|
+
state,
|
|
711
|
+
parsed,
|
|
712
|
+
refined,
|
|
713
|
+
refinedServerPath,
|
|
714
|
+
expectedTerminalPath
|
|
715
|
+
);
|
|
657
716
|
state.server_path_source = "supervising_agent";
|
|
658
717
|
}
|
|
659
718
|
if (typeof refined?.wait_for_selector === "string") state.wait_for_selector = normalizeOptionalString(refined.wait_for_selector) || "";
|
|
660
719
|
if (typeof refined?.reference === "string" && refined.reference.trim()) state.reference = refined.reference.trim();
|
|
661
|
-
if (
|
|
662
|
-
state.expected_terminal_path =
|
|
663
|
-
}
|
|
664
|
-
if (typeof parsed?.expected_terminal_path === "string") {
|
|
665
|
-
state.expected_terminal_path = normalizeOptionalString(parsed.expected_terminal_path) || "";
|
|
720
|
+
if (expectedTerminalPath) {
|
|
721
|
+
state.expected_terminal_path = expectedTerminalPath;
|
|
666
722
|
}
|
|
667
723
|
if (typeof parsed?.confidence === "string") state.supervisor_author_confidence = normalizeOptionalString(parsed.confidence) || null;
|
|
668
724
|
if (parsed?.rationale !== void 0) state.supervisor_author_rationale = parsed.rationale;
|
|
@@ -842,7 +898,7 @@ function summarizeState(state) {
|
|
|
842
898
|
state: selected
|
|
843
899
|
};
|
|
844
900
|
}
|
|
845
|
-
var import_node_fs, import_node_crypto2, import_node_path, import_node_url, import_meta, WORKFLOW_STAGE_ORDER, CHECKPOINT_CONTRACT_VERSION, BUNDLED_RIDDLE_PROOF_DIR, RIDDLE_PROOF_DIR_CANDIDATES, VISUAL_FIRST_MODES, CHECKPOINT_CONTRACT_SPECS;
|
|
901
|
+
var import_node_fs, import_node_crypto2, import_node_path, import_node_url, import_meta, WORKFLOW_STAGE_ORDER, CHECKPOINT_CONTRACT_VERSION, BUNDLED_RIDDLE_PROOF_DIR, RIDDLE_PROOF_DIR_CANDIDATES, INTERACTION_VERIFICATION_MODES, VISUAL_FIRST_MODES, CHECKPOINT_CONTRACT_SPECS;
|
|
846
902
|
var init_proof_run_core = __esm({
|
|
847
903
|
"src/proof-run-core.ts"() {
|
|
848
904
|
"use strict";
|
|
@@ -861,6 +917,7 @@ var init_proof_run_core = __esm({
|
|
|
861
917
|
RIDDLE_PROOF_DIR_CANDIDATES = [
|
|
862
918
|
BUNDLED_RIDDLE_PROOF_DIR
|
|
863
919
|
];
|
|
920
|
+
INTERACTION_VERIFICATION_MODES = /* @__PURE__ */ new Set(["interaction", "interactive", "user_flow", "user-flow", "workflow"]);
|
|
864
921
|
VISUAL_FIRST_MODES = /* @__PURE__ */ new Set([
|
|
865
922
|
"visual",
|
|
866
923
|
"render",
|
|
@@ -6142,6 +6199,18 @@ function parseJsonObject(raw, schema) {
|
|
|
6142
6199
|
}
|
|
6143
6200
|
return null;
|
|
6144
6201
|
}
|
|
6202
|
+
function parseJsonFromRunnerOutputs(outputs, schema) {
|
|
6203
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6204
|
+
for (const output of outputs) {
|
|
6205
|
+
if (!output.text.trim() || seen.has(output.text)) continue;
|
|
6206
|
+
seen.add(output.text);
|
|
6207
|
+
const parsed = parseJsonObject(output.text, schema);
|
|
6208
|
+
if (parsed) return { parsed, source: output.source };
|
|
6209
|
+
}
|
|
6210
|
+
const combined = outputs.map((output) => output.text).filter((text) => text.trim()).join("\n");
|
|
6211
|
+
if (!combined.trim() || seen.has(combined)) return { parsed: null, source: "" };
|
|
6212
|
+
return { parsed: parseJsonObject(combined, schema), source: "combined_output" };
|
|
6213
|
+
}
|
|
6145
6214
|
function isHarnessVerificationOnlyBlocker(blocker) {
|
|
6146
6215
|
const text = blocker.toLowerCase();
|
|
6147
6216
|
return (text.includes("erofs") || text.includes("read-only file system")) && text.includes("node_modules") && (text.includes(".vite-temp") || text.includes("vite.config"));
|
|
@@ -6161,6 +6230,7 @@ function runnerMetrics(input) {
|
|
|
6161
6230
|
stdout_chars: (input.stdout || "").length,
|
|
6162
6231
|
stderr_chars: (input.stderr || "").length,
|
|
6163
6232
|
final_message_chars: (input.finalText || "").length,
|
|
6233
|
+
parsed_json_source: input.parsedJsonSource,
|
|
6164
6234
|
exit_status: input.status ?? null,
|
|
6165
6235
|
timed_out: input.timedOut || false,
|
|
6166
6236
|
error_code: input.errorCode,
|
|
@@ -6264,19 +6334,25 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6264
6334
|
};
|
|
6265
6335
|
}
|
|
6266
6336
|
const finalText = (0, import_node_fs4.existsSync)(lastMessagePath) ? (0, import_node_fs4.readFileSync)(lastMessagePath, "utf-8") : String(proc.stdout || "");
|
|
6267
|
-
const
|
|
6337
|
+
const stdoutText = String(proc.stdout || "");
|
|
6338
|
+
const stderrText = String(proc.stderr || "");
|
|
6339
|
+
const { parsed, source: parsedJsonSource } = parseJsonFromRunnerOutputs([
|
|
6340
|
+
{ source: (0, import_node_fs4.existsSync)(lastMessagePath) ? "last_message" : "stdout", text: finalText },
|
|
6341
|
+
{ source: "stdout", text: stdoutText },
|
|
6342
|
+
{ source: "stderr", text: stderrText }
|
|
6343
|
+
], request.schema);
|
|
6268
6344
|
if (!parsed) {
|
|
6269
6345
|
return {
|
|
6270
6346
|
ok: false,
|
|
6271
|
-
stdout:
|
|
6272
|
-
stderr:
|
|
6347
|
+
stdout: stdoutText,
|
|
6348
|
+
stderr: stderrText,
|
|
6273
6349
|
metrics: runnerMetrics({
|
|
6274
6350
|
request,
|
|
6275
6351
|
config,
|
|
6276
6352
|
startedAt,
|
|
6277
6353
|
startedMs,
|
|
6278
|
-
stdout:
|
|
6279
|
-
stderr:
|
|
6354
|
+
stdout: stdoutText,
|
|
6355
|
+
stderr: stderrText,
|
|
6280
6356
|
finalText,
|
|
6281
6357
|
status: proc.status,
|
|
6282
6358
|
errorCode: "invalid_json"
|
|
@@ -6284,23 +6360,24 @@ function createCodexExecJsonRunner(config = {}) {
|
|
|
6284
6360
|
blocker: {
|
|
6285
6361
|
code: "codex_invalid_json",
|
|
6286
6362
|
message: `Codex completed ${request.purpose}, but did not return valid JSON.`,
|
|
6287
|
-
details: { finalText, stdout:
|
|
6363
|
+
details: { finalText, stdout: stdoutText, stderr: stderrText }
|
|
6288
6364
|
}
|
|
6289
6365
|
};
|
|
6290
6366
|
}
|
|
6291
6367
|
return {
|
|
6292
6368
|
ok: true,
|
|
6293
6369
|
json: parsed,
|
|
6294
|
-
stdout:
|
|
6295
|
-
stderr:
|
|
6370
|
+
stdout: stdoutText,
|
|
6371
|
+
stderr: stderrText,
|
|
6296
6372
|
metrics: runnerMetrics({
|
|
6297
6373
|
request,
|
|
6298
6374
|
config,
|
|
6299
6375
|
startedAt,
|
|
6300
6376
|
startedMs,
|
|
6301
|
-
stdout:
|
|
6302
|
-
stderr:
|
|
6377
|
+
stdout: stdoutText,
|
|
6378
|
+
stderr: stderrText,
|
|
6303
6379
|
finalText,
|
|
6380
|
+
parsedJsonSource,
|
|
6304
6381
|
status: proc.status
|
|
6305
6382
|
})
|
|
6306
6383
|
};
|
|
@@ -8759,7 +8836,7 @@ function normalizeRouteInventoryPath(value, label) {
|
|
|
8759
8836
|
const path7 = stringValue2(value);
|
|
8760
8837
|
if (!path7) throw new Error(`${label} requires path.`);
|
|
8761
8838
|
if (!path7.startsWith("/")) throw new Error(`${label}.path must start with /.`);
|
|
8762
|
-
return
|
|
8839
|
+
return normalizeRoutePath2(path7);
|
|
8763
8840
|
}
|
|
8764
8841
|
function normalizeRouteInventoryRoute(input, index) {
|
|
8765
8842
|
if (typeof input === "string") return { path: normalizeRouteInventoryPath(input, `checks route_inventory expected_routes[${index}]`) };
|
|
@@ -9776,7 +9853,7 @@ function expectedFailedNetworkMockConsoleEventSummary(event, evidence) {
|
|
|
9776
9853
|
text: isRecord(event) && typeof event.text === "string" ? event.text.slice(0, 300) : sample.slice(0, 300)
|
|
9777
9854
|
};
|
|
9778
9855
|
}
|
|
9779
|
-
function
|
|
9856
|
+
function normalizeRoutePath2(path7) {
|
|
9780
9857
|
const value = path7 || "/";
|
|
9781
9858
|
if (value === "/") return "/";
|
|
9782
9859
|
return value.replace(/\/+$/, "") || "/";
|
|
@@ -9816,10 +9893,10 @@ function mountedExpectedRoutePath(targetUrl, expected) {
|
|
|
9816
9893
|
return mountPrefix ? joinMountedRoutePath(mountPrefix, expected) : expected;
|
|
9817
9894
|
}
|
|
9818
9895
|
function routePathMatches(observed, expected, targetUrl) {
|
|
9819
|
-
const normalizedObserved =
|
|
9820
|
-
const normalizedExpected =
|
|
9896
|
+
const normalizedObserved = normalizeRoutePath2(observed);
|
|
9897
|
+
const normalizedExpected = normalizeRoutePath2(expected);
|
|
9821
9898
|
if (normalizedObserved === normalizedExpected) return true;
|
|
9822
|
-
return normalizedObserved ===
|
|
9899
|
+
return normalizedObserved === normalizeRoutePath2(mountedExpectedRoutePath(targetUrl, expected));
|
|
9823
9900
|
}
|
|
9824
9901
|
function successfulRoute(route, targetUrl) {
|
|
9825
9902
|
const matched = route.matched || routePathMatches(route.observed, route.expected_path, targetUrl);
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-V6VZ3CAI.js";
|
|
3
3
|
import "./chunk-PEWAIEER.js";
|
|
4
4
|
import "./chunk-TWTEUS7R.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-E7ATYSYS.js";
|
|
6
6
|
import "./chunk-YZUVEJ5B.js";
|
|
7
7
|
import "./chunk-FMOYUYH2.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-5N5QFI2S.js";
|
|
9
9
|
import "./chunk-4FOHZ7JG.js";
|
|
10
10
|
import "./chunk-JFQXAJH2.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-PYCQNK66.js";
|
|
12
12
|
import "./chunk-VY4Y5U57.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|