@riddledc/riddle-proof 0.8.59 → 0.8.60
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.d.cts +1 -0
- package/dist/adapters/codex-exec-agent.d.ts +1 -0
- package/dist/adapters/codex-exec-agent.js +3 -2
- package/dist/adapters/codex.d.cts +1 -0
- package/dist/adapters/codex.d.ts +1 -0
- package/dist/adapters/codex.js +3 -2
- package/dist/adapters/local-agent.d.cts +1 -0
- package/dist/adapters/local-agent.d.ts +1 -0
- package/dist/adapters/local-agent.js +3 -2
- package/dist/adapters/openclaw.d.cts +1 -0
- package/dist/adapters/openclaw.d.ts +1 -0
- package/dist/adapters/openclaw.js +6 -5
- package/dist/advanced/engine-harness.cjs +253 -43
- package/dist/advanced/engine-harness.d.cts +1 -0
- package/dist/advanced/engine-harness.d.ts +1 -0
- package/dist/advanced/engine-harness.js +6 -5
- package/dist/advanced/index.cjs +253 -43
- package/dist/advanced/index.d.cts +1 -0
- package/dist/advanced/index.d.ts +1 -0
- package/dist/advanced/index.js +7 -6
- package/dist/advanced/runner.cjs +202 -4
- package/dist/advanced/runner.d.cts +1 -0
- package/dist/advanced/runner.d.ts +1 -0
- package/dist/advanced/runner.js +6 -5
- package/dist/checkpoint.d.cts +1 -0
- package/dist/checkpoint.d.ts +1 -0
- package/dist/checkpoint.js +3 -2
- package/dist/{chunk-TTB3ZAVX.js → chunk-3FK5HZHK.js} +2 -2
- package/dist/{chunk-XSNMMAPJ.js → chunk-AWRBSVNW.js} +4 -4
- package/dist/{chunk-MOTQNIZX.js → chunk-FX2CB4MG.js} +1 -1
- package/dist/{chunk-2PKBTYOA.js → chunk-HZOILEGF.js} +3 -3
- package/dist/{chunk-KNPCWWF3.js → chunk-NXEAFQYZ.js} +16 -10
- package/dist/{chunk-GHBNDHG7.js → chunk-PCEDAQPG.js} +4 -4
- package/dist/{chunk-CUBYSWZT.js → chunk-QGMSN34W.js} +51 -4
- package/dist/{chunk-RS4HJLJQ.js → chunk-QPKY767W.js} +1 -1
- package/dist/{chunk-UZIX7M7D.js → chunk-UEY5SJG5.js} +13 -9
- package/dist/{chunk-KG64Y5MC.js → chunk-WKIIJX3O.js} +12 -0
- package/dist/{chunk-JLOZTVXU.js → chunk-XKNJ5OE4.js} +2 -2
- package/dist/cli/index.js +9 -9
- package/dist/cli.cjs +461 -404
- package/dist/cli.js +9 -9
- package/dist/codex-exec-agent.d.cts +1 -0
- package/dist/codex-exec-agent.d.ts +1 -0
- package/dist/codex-exec-agent.js +3 -2
- package/dist/diagnostics.d.cts +1 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/engine-harness.cjs +253 -43
- package/dist/engine-harness.d.cts +1 -0
- package/dist/engine-harness.d.ts +1 -0
- package/dist/engine-harness.js +6 -5
- package/dist/index.cjs +236 -169
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -11
- package/dist/local-agent.d.cts +1 -0
- package/dist/local-agent.d.ts +1 -0
- package/dist/local-agent.js +3 -2
- package/dist/openclaw.d.cts +1 -0
- package/dist/openclaw.d.ts +1 -0
- package/dist/openclaw.js +6 -5
- package/dist/pr-comment.cjs +7 -2
- package/dist/pr-comment.js +2 -2
- package/dist/profile/index.d.cts +1 -0
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/proof-session.d.cts +1 -0
- package/dist/proof-session.d.ts +1 -0
- package/dist/public-state.cjs +15 -0
- package/dist/public-state.d.cts +4 -1
- package/dist/public-state.d.ts +4 -1
- package/dist/public-state.js +7 -1
- package/dist/result.cjs +211 -4
- package/dist/result.d.cts +12 -1
- package/dist/result.d.ts +12 -1
- package/dist/result.js +6 -1
- package/dist/run-card.cjs +198 -40
- package/dist/run-card.d.cts +1 -0
- package/dist/run-card.d.ts +1 -0
- package/dist/run-card.js +4 -3
- package/dist/runner.cjs +202 -4
- package/dist/runner.d.cts +1 -0
- package/dist/runner.d.ts +1 -0
- package/dist/runner.js +6 -5
- package/dist/spec/checkpoint.d.cts +1 -0
- package/dist/spec/checkpoint.d.ts +1 -0
- package/dist/spec/checkpoint.js +3 -2
- package/dist/spec/index.cjs +235 -167
- package/dist/spec/index.d.cts +2 -2
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +17 -7
- package/dist/spec/public-state.cjs +15 -0
- package/dist/spec/public-state.d.cts +1 -1
- package/dist/spec/public-state.d.ts +1 -1
- package/dist/spec/public-state.js +7 -1
- package/dist/spec/result.cjs +209 -4
- package/dist/spec/result.d.cts +2 -1
- package/dist/spec/result.d.ts +2 -1
- package/dist/spec/result.js +6 -1
- package/dist/spec/run-card.cjs +198 -40
- package/dist/spec/run-card.d.cts +1 -0
- package/dist/spec/run-card.d.ts +1 -0
- package/dist/spec/run-card.js +4 -3
- package/dist/spec/state.cjs +207 -45
- package/dist/spec/state.d.cts +1 -0
- package/dist/spec/state.d.ts +1 -0
- package/dist/spec/state.js +5 -4
- package/dist/spec/types.d.cts +1 -0
- package/dist/spec/types.d.ts +1 -0
- package/dist/state.cjs +207 -45
- package/dist/state.d.cts +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.js +5 -4
- package/dist/types.d.cts +14 -0
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/advanced/index.cjs
CHANGED
|
@@ -1642,7 +1642,7 @@ function normalizeStageRequest(state, requestedAdvanceStage) {
|
|
|
1642
1642
|
if (!state?.recon_results || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) return "recon";
|
|
1643
1643
|
return null;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function stringValue2(value) {
|
|
1646
1646
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
1647
1647
|
}
|
|
1648
1648
|
function commandResult(command, args, cwd, timeout = 6e4) {
|
|
@@ -1665,7 +1665,7 @@ function repoDirForSync(state) {
|
|
|
1665
1665
|
state?.repo_dir,
|
|
1666
1666
|
state?.after_worktree,
|
|
1667
1667
|
state?.before_worktree
|
|
1668
|
-
].map(
|
|
1668
|
+
].map(stringValue2).filter(Boolean);
|
|
1669
1669
|
return candidates.find((candidate) => (0, import_node_fs2.existsSync)(import_node_path2.default.join(candidate, ".git"))) || "";
|
|
1670
1670
|
}
|
|
1671
1671
|
function parseWorktreeList(output) {
|
|
@@ -1785,32 +1785,32 @@ function baseCheckoutReport(repoDir, baseBranch, updateRequested, updateAllowed)
|
|
|
1785
1785
|
return report;
|
|
1786
1786
|
}
|
|
1787
1787
|
function normalizeGhPrStatus(value) {
|
|
1788
|
-
const status =
|
|
1788
|
+
const status = stringValue2(value).toLowerCase();
|
|
1789
1789
|
if (status === "merged") return "merged";
|
|
1790
1790
|
if (status === "open") return "open";
|
|
1791
1791
|
if (status === "closed") return "closed";
|
|
1792
1792
|
return status || "unknown";
|
|
1793
1793
|
}
|
|
1794
1794
|
function prRefFromState(state) {
|
|
1795
|
-
return
|
|
1795
|
+
return stringValue2(state?.pr_number) || stringValue2(state?.pr_url);
|
|
1796
1796
|
}
|
|
1797
1797
|
function prNumberFromUrl(url) {
|
|
1798
1798
|
const match = url.match(/\/pull\/(\d+)(?:$|[?#])/);
|
|
1799
1799
|
return match?.[1] || "";
|
|
1800
1800
|
}
|
|
1801
1801
|
function normalizePrState(raw, state, checkedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
1802
|
-
const mergeCommit = typeof raw?.mergeCommit === "object" && raw.mergeCommit ?
|
|
1803
|
-
const url =
|
|
1802
|
+
const mergeCommit = typeof raw?.mergeCommit === "object" && raw.mergeCommit ? stringValue2(raw.mergeCommit.oid) : stringValue2(raw?.mergeCommit);
|
|
1803
|
+
const url = stringValue2(raw?.url) || stringValue2(state?.pr_url);
|
|
1804
1804
|
return {
|
|
1805
1805
|
status: normalizeGhPrStatus(raw?.state),
|
|
1806
1806
|
pr_url: url || null,
|
|
1807
1807
|
pr_number: String(raw?.number || state?.pr_number || prNumberFromUrl(url) || ""),
|
|
1808
|
-
repo:
|
|
1809
|
-
head_branch:
|
|
1810
|
-
base_branch:
|
|
1808
|
+
repo: stringValue2(state?.repo) || null,
|
|
1809
|
+
head_branch: stringValue2(raw?.headRefName) || stringValue2(state?.target_branch) || stringValue2(state?.branch) || null,
|
|
1810
|
+
base_branch: stringValue2(raw?.baseRefName) || stringValue2(state?.base_branch) || "main",
|
|
1811
1811
|
merge_commit: mergeCommit || null,
|
|
1812
|
-
merged_at:
|
|
1813
|
-
closed_at:
|
|
1812
|
+
merged_at: stringValue2(raw?.mergedAt) || null,
|
|
1813
|
+
closed_at: stringValue2(raw?.closedAt) || null,
|
|
1814
1814
|
checked_at: checkedAt,
|
|
1815
1815
|
source: "gh"
|
|
1816
1816
|
};
|
|
@@ -1827,7 +1827,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1827
1827
|
branch_delete_errors: [],
|
|
1828
1828
|
pruned: false
|
|
1829
1829
|
};
|
|
1830
|
-
const baseBranch =
|
|
1830
|
+
const baseBranch = stringValue2(prState.base_branch) || stringValue2(state?.base_branch) || "main";
|
|
1831
1831
|
let fetchedBase = params.fetch_base === false;
|
|
1832
1832
|
if (params.fetch_base !== false && baseBranch) {
|
|
1833
1833
|
const fetch = commandResult("git", ["fetch", "origin", baseBranch], repoDir, 12e4);
|
|
@@ -1845,7 +1845,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
const removed = [];
|
|
1847
1847
|
const removeErrors = [];
|
|
1848
|
-
for (const candidate of [state?.before_worktree, state?.after_worktree].map(
|
|
1848
|
+
for (const candidate of [state?.before_worktree, state?.after_worktree].map(stringValue2).filter(Boolean)) {
|
|
1849
1849
|
if (!(0, import_node_fs2.existsSync)(candidate) || import_node_path2.default.resolve(candidate) === import_node_path2.default.resolve(repoDir)) continue;
|
|
1850
1850
|
const remove = commandResult("git", ["worktree", "remove", "--force", candidate], repoDir, 12e4);
|
|
1851
1851
|
if (remove.ok) {
|
|
@@ -1856,7 +1856,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
cleanup.worktrees_removed = removed;
|
|
1858
1858
|
cleanup.worktree_remove_errors = removeErrors;
|
|
1859
|
-
const afterBranch =
|
|
1859
|
+
const afterBranch = stringValue2(state?.after_worktree_branch);
|
|
1860
1860
|
if (afterBranch.startsWith("riddle-proof/")) {
|
|
1861
1861
|
const deleted = commandResult("git", ["branch", "-D", afterBranch], repoDir, 6e4);
|
|
1862
1862
|
if (deleted.ok) {
|
|
@@ -1892,7 +1892,7 @@ function syncPrLifecycle(statePath, params) {
|
|
|
1892
1892
|
const prState2 = {
|
|
1893
1893
|
status: missingPr ? "orphaned" : "unavailable",
|
|
1894
1894
|
pr_url: state.pr_url || null,
|
|
1895
|
-
pr_number: String(state.pr_number || prNumberFromUrl(
|
|
1895
|
+
pr_number: String(state.pr_number || prNumberFromUrl(stringValue2(state.pr_url)) || ""),
|
|
1896
1896
|
repo: state.repo || null,
|
|
1897
1897
|
head_branch: state.target_branch || state.branch || null,
|
|
1898
1898
|
base_branch: state.base_branch || "main",
|
|
@@ -1921,7 +1921,7 @@ function syncPrLifecycle(statePath, params) {
|
|
|
1921
1921
|
const prState2 = {
|
|
1922
1922
|
status: "unavailable",
|
|
1923
1923
|
pr_url: state.pr_url || null,
|
|
1924
|
-
pr_number: String(state.pr_number || prNumberFromUrl(
|
|
1924
|
+
pr_number: String(state.pr_number || prNumberFromUrl(stringValue2(state.pr_url)) || ""),
|
|
1925
1925
|
repo: state.repo || null,
|
|
1926
1926
|
head_branch: state.target_branch || state.branch || null,
|
|
1927
1927
|
base_branch: state.base_branch || "main",
|
|
@@ -2702,8 +2702,8 @@ ${implementRes.stdout || ""}
|
|
|
2702
2702
|
${implementRes.stderr || ""}`;
|
|
2703
2703
|
if (implementError.includes("No implementation detected")) {
|
|
2704
2704
|
const implementationState = readState(config.statePath) || {};
|
|
2705
|
-
const implementationSummary =
|
|
2706
|
-
const implementationDetectionSummary =
|
|
2705
|
+
const implementationSummary = stringValue2(implementationState?.implementation_summary) || null;
|
|
2706
|
+
const implementationDetectionSummary = stringValue2(implementationState?.implementation_detection_summary) || null;
|
|
2707
2707
|
const implementationDetection = implementationState?.implementation_detection && typeof implementationState.implementation_detection === "object" && !Array.isArray(implementationState.implementation_detection) ? implementationState.implementation_detection : null;
|
|
2708
2708
|
recordAttempt("implement", "checkpoint", "Implementation checkpoint found no material code changes yet.", {
|
|
2709
2709
|
checkpoint: "implement_changes_missing",
|
|
@@ -2821,14 +2821,14 @@ ${implementRes.stderr || ""}`;
|
|
|
2821
2821
|
const captureQuality = verifyDecisionRequest2?.capture_quality || {};
|
|
2822
2822
|
const conclusiveVerifyBlockers2 = proofAssessmentHardBlockersForState({
|
|
2823
2823
|
...failedVerifyState,
|
|
2824
|
-
structured_interaction_capture_failure_summary:
|
|
2825
|
-
structured_interaction_failure_summary:
|
|
2824
|
+
structured_interaction_capture_failure_summary: stringValue2(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_capture_failure_summary) || void 0,
|
|
2825
|
+
structured_interaction_failure_summary: stringValue2(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_failure_summary) || void 0
|
|
2826
2826
|
});
|
|
2827
|
-
const structuredInteractionFailureSummary2 =
|
|
2827
|
+
const structuredInteractionFailureSummary2 = stringValue2(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue2(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_capture_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_failure_summary) || stringValue2(conclusiveVerifyBlockers2[0]);
|
|
2828
2828
|
const captureTerminalBlocker = failedVerifyStatus === "capture_error" || conclusiveVerifyBlockers2.length > 0 || Boolean(structuredInteractionFailureSummary2) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
|
|
2829
|
-
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ?
|
|
2829
|
+
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue2(captureQuality?.summary) : "";
|
|
2830
2830
|
const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
|
|
2831
|
-
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 ||
|
|
2831
|
+
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 || stringValue2(verifyDecisionRequest2?.summary) || stringValue2(failedVerifyState?.verify_summary) || stringValue2(failedVerifyState?.proof_summary) || stringValue2(verifyRes.error) || "Verify capture failed before the evidence could be judged.";
|
|
2832
2832
|
const failedVerifyDetails = {
|
|
2833
2833
|
executed,
|
|
2834
2834
|
verifyStatus: failedVerifyStatus,
|
|
@@ -2906,10 +2906,10 @@ ${implementRes.stderr || ""}`;
|
|
|
2906
2906
|
};
|
|
2907
2907
|
const conclusiveVerifyBlockers = proofAssessmentHardBlockersForState({
|
|
2908
2908
|
...state,
|
|
2909
|
-
structured_interaction_capture_failure_summary:
|
|
2910
|
-
structured_interaction_failure_summary:
|
|
2909
|
+
structured_interaction_capture_failure_summary: stringValue2(verifyDecisionRequest?.structured_interaction_capture_failure_summary) || stringValue2(state?.structured_interaction_capture_failure_summary) || void 0,
|
|
2910
|
+
structured_interaction_failure_summary: stringValue2(verifyDecisionRequest?.structured_interaction_failure_summary) || stringValue2(state?.structured_interaction_failure_summary) || void 0
|
|
2911
2911
|
});
|
|
2912
|
-
const structuredInteractionFailureSummary =
|
|
2912
|
+
const structuredInteractionFailureSummary = stringValue2(verifyDecisionRequest?.structured_interaction_capture_failure_summary) || stringValue2(verifyDecisionRequest?.structured_interaction_failure_summary) || stringValue2(state?.structured_interaction_capture_failure_summary) || stringValue2(state?.structured_interaction_failure_summary) || stringValue2(conclusiveVerifyBlockers[0]);
|
|
2913
2913
|
if (verifyStatus !== "evidence_captured") {
|
|
2914
2914
|
const captureQuality = verifyDecisionRequest?.capture_quality || {};
|
|
2915
2915
|
const captureTerminalBlocker = conclusiveVerifyBlockers.length > 0 || Boolean(structuredInteractionFailureSummary) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
|
|
@@ -2921,9 +2921,9 @@ ${implementRes.stderr || ""}`;
|
|
|
2921
2921
|
});
|
|
2922
2922
|
state = readState(config.statePath);
|
|
2923
2923
|
}
|
|
2924
|
-
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ?
|
|
2924
|
+
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue2(captureQuality?.summary) : "";
|
|
2925
2925
|
const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
|
|
2926
|
-
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary ||
|
|
2926
|
+
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary || stringValue2(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
|
|
2927
2927
|
recordAttempt("verify", "checkpoint", summary, {
|
|
2928
2928
|
autoApproved: verifyRes.autoApproved || false,
|
|
2929
2929
|
checkpoint: checkpointName,
|
|
@@ -3453,6 +3453,167 @@ __export(runner_exports, {
|
|
|
3453
3453
|
runRiddleProof: () => runRiddleProof
|
|
3454
3454
|
});
|
|
3455
3455
|
|
|
3456
|
+
// src/public-state.ts
|
|
3457
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
3458
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
3459
|
+
}
|
|
3460
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
3461
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
3462
|
+
}
|
|
3463
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
3464
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
3465
|
+
}
|
|
3466
|
+
function asRecord(value) {
|
|
3467
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
3468
|
+
}
|
|
3469
|
+
function stringValue(value) {
|
|
3470
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
3471
|
+
}
|
|
3472
|
+
function booleanValue(value) {
|
|
3473
|
+
return typeof value === "boolean" ? value : void 0;
|
|
3474
|
+
}
|
|
3475
|
+
function numberValue(value) {
|
|
3476
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
3477
|
+
}
|
|
3478
|
+
function firstStringValue(...values) {
|
|
3479
|
+
for (const value of values) {
|
|
3480
|
+
const text = stringValue(value);
|
|
3481
|
+
if (text) return text;
|
|
3482
|
+
}
|
|
3483
|
+
return void 0;
|
|
3484
|
+
}
|
|
3485
|
+
function firstBooleanValue(...values) {
|
|
3486
|
+
for (const value of values) {
|
|
3487
|
+
const bool = booleanValue(value);
|
|
3488
|
+
if (typeof bool === "boolean") return bool;
|
|
3489
|
+
}
|
|
3490
|
+
return void 0;
|
|
3491
|
+
}
|
|
3492
|
+
function firstRecordValue(...values) {
|
|
3493
|
+
for (const value of values) {
|
|
3494
|
+
const record = asRecord(value);
|
|
3495
|
+
if (Object.keys(record).length) return record;
|
|
3496
|
+
}
|
|
3497
|
+
return void 0;
|
|
3498
|
+
}
|
|
3499
|
+
function countValue(value) {
|
|
3500
|
+
const number = numberValue(value);
|
|
3501
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
3502
|
+
}
|
|
3503
|
+
function checkpointSummaryFrom(...values) {
|
|
3504
|
+
const record = firstRecordValue(...values);
|
|
3505
|
+
if (!record) return void 0;
|
|
3506
|
+
const accepted = countValue(record.response_count);
|
|
3507
|
+
const rejected = countValue(record.rejected_response_count);
|
|
3508
|
+
const ignored = countValue(record.ignored_response_count);
|
|
3509
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
3510
|
+
const summary = {
|
|
3511
|
+
pending: booleanValue(record.pending),
|
|
3512
|
+
accepted_response_count: accepted,
|
|
3513
|
+
rejected_response_count: rejected,
|
|
3514
|
+
ignored_response_count: ignored,
|
|
3515
|
+
duplicate_response_count: duplicate,
|
|
3516
|
+
latest_decision: stringValue(record.latest_decision),
|
|
3517
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
3518
|
+
};
|
|
3519
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
3520
|
+
}
|
|
3521
|
+
function uniqueStrings(values) {
|
|
3522
|
+
return [...new Set(values.filter(Boolean))];
|
|
3523
|
+
}
|
|
3524
|
+
function summarizeRiddleProofPublicState(input) {
|
|
3525
|
+
const record = asRecord(input);
|
|
3526
|
+
const runCard = asRecord(record.run_card);
|
|
3527
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
3528
|
+
const raw = asRecord(record.raw);
|
|
3529
|
+
const request = asRecord(record.request);
|
|
3530
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
3531
|
+
const prState = asRecord(record.pr_state);
|
|
3532
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
3533
|
+
const handoffState = stringValue(handoff.state);
|
|
3534
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
3535
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
3536
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
3537
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
3538
|
+
record.shipping_disabled,
|
|
3539
|
+
stopCondition.shipping_disabled,
|
|
3540
|
+
raw.shipping_disabled,
|
|
3541
|
+
handoff.shipping_disabled
|
|
3542
|
+
);
|
|
3543
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
3544
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
3545
|
+
record.ship_authorized,
|
|
3546
|
+
stopCondition.ship_authorized,
|
|
3547
|
+
raw.ship_authorized
|
|
3548
|
+
);
|
|
3549
|
+
const authorizationEvidence = Boolean(
|
|
3550
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
3551
|
+
);
|
|
3552
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
3553
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
3554
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
3555
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
3556
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
3557
|
+
const proofComplete = Boolean(
|
|
3558
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
3559
|
+
);
|
|
3560
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
3561
|
+
record.checkpoint_summary,
|
|
3562
|
+
stopCondition.checkpoint_summary,
|
|
3563
|
+
asRecord(record.details).checkpoint_summary,
|
|
3564
|
+
asRecord(raw.details).checkpoint_summary
|
|
3565
|
+
);
|
|
3566
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
3567
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
3568
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
3569
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
3570
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
3571
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
3572
|
+
const syncAllowed = mergeReady;
|
|
3573
|
+
let policyState = "unknown";
|
|
3574
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
3575
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
3576
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
3577
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
3578
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
3579
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
3580
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
3581
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
3582
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
3583
|
+
const requiredDisclosures = [];
|
|
3584
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
3585
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
3586
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
3587
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
3588
|
+
const prohibitedClaims = [];
|
|
3589
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
3590
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
3591
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
3592
|
+
if (blockedOrWaiting) {
|
|
3593
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
3594
|
+
}
|
|
3595
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
3596
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
3597
|
+
}
|
|
3598
|
+
const resultLabel = policyState === "awaiting_checkpoint" ? "checkpoint required" : policyState === "proof_blocked" ? "blocked" : policyState === "proof_failed" ? "failed" : policyState === "proof_complete_ship_disabled" ? "proof complete; shipping disabled" : policyState === "proof_passed_ship_held" ? "proof passed; ship held" : policyState === "ship_authorized" ? status === "shipped" ? "shipped" : "ship authorized" : policyState === "proof_passed" ? "passed" : policyState === "proof_in_progress" ? "running" : status || "recorded";
|
|
3599
|
+
return {
|
|
3600
|
+
status,
|
|
3601
|
+
ok,
|
|
3602
|
+
policy_state: policyState,
|
|
3603
|
+
result_label: resultLabel,
|
|
3604
|
+
proof_complete: proofComplete,
|
|
3605
|
+
proof_passed: proofPassed,
|
|
3606
|
+
ship_held: shipHeld,
|
|
3607
|
+
shipping_disabled: shippingDisabled,
|
|
3608
|
+
ship_authorized: shipAuthorized,
|
|
3609
|
+
merge_ready: mergeReady,
|
|
3610
|
+
sync_allowed: syncAllowed,
|
|
3611
|
+
checkpoint_summary: checkpointSummary,
|
|
3612
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
3613
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3456
3617
|
// src/result.ts
|
|
3457
3618
|
function isTerminalStatus(status) {
|
|
3458
3619
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
@@ -3627,6 +3788,37 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
3627
3788
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
3628
3789
|
return state;
|
|
3629
3790
|
}
|
|
3791
|
+
function publicStateForRunState(input) {
|
|
3792
|
+
const state = input.state;
|
|
3793
|
+
const status = input.status || state.status;
|
|
3794
|
+
const raw = recordValue(input.raw) || {};
|
|
3795
|
+
const extendedState = state;
|
|
3796
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
3797
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
3798
|
+
status,
|
|
3799
|
+
ok: terminalOk,
|
|
3800
|
+
request: state.request,
|
|
3801
|
+
pr_state: state.pr_state,
|
|
3802
|
+
marked_ready: state.marked_ready,
|
|
3803
|
+
ship_held: state.ship_held,
|
|
3804
|
+
shipping_disabled: state.shipping_disabled,
|
|
3805
|
+
ship_authorized: state.ship_authorized,
|
|
3806
|
+
ship_mode: state.request?.ship_mode,
|
|
3807
|
+
merge_commit: state.merge_commit,
|
|
3808
|
+
merged_at: state.merged_at,
|
|
3809
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
3810
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
3811
|
+
merge_ready: extendedState.merge_ready,
|
|
3812
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
3813
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
3814
|
+
}));
|
|
3815
|
+
}
|
|
3816
|
+
function publicMergeRecommendationForRunState(input) {
|
|
3817
|
+
return riddleProofPublicStateMergeRecommendation(
|
|
3818
|
+
publicStateForRunState(input),
|
|
3819
|
+
input.state.merge_recommendation
|
|
3820
|
+
);
|
|
3821
|
+
}
|
|
3630
3822
|
function shipControlStateFor(input) {
|
|
3631
3823
|
const state = input.state;
|
|
3632
3824
|
const status = input.status || state.status;
|
|
@@ -3675,6 +3867,11 @@ function createRunResult(input) {
|
|
|
3675
3867
|
state.ok = ok;
|
|
3676
3868
|
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
3677
3869
|
applyShipControlState(state, { status, raw: input.raw });
|
|
3870
|
+
const publicState = publicStateForRunState({ state, status, raw: input.raw });
|
|
3871
|
+
const publicMergeRecommendation = riddleProofPublicStateMergeRecommendation(
|
|
3872
|
+
publicState,
|
|
3873
|
+
state.merge_recommendation
|
|
3874
|
+
);
|
|
3678
3875
|
return compactRecord({
|
|
3679
3876
|
ok,
|
|
3680
3877
|
status,
|
|
@@ -3692,9 +3889,12 @@ function createRunResult(input) {
|
|
|
3692
3889
|
pr_state: state.pr_state,
|
|
3693
3890
|
marked_ready: state.marked_ready,
|
|
3694
3891
|
left_draft: state.left_draft,
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3892
|
+
result_label: publicState.result_label,
|
|
3893
|
+
ship_held: publicState.ship_held,
|
|
3894
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
3895
|
+
ship_authorized: publicState.ship_authorized,
|
|
3896
|
+
merge_ready: publicState.merge_ready,
|
|
3897
|
+
sync_allowed: publicState.sync_allowed,
|
|
3698
3898
|
ci_status: state.ci_status,
|
|
3699
3899
|
ship_commit: state.ship_commit,
|
|
3700
3900
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -3708,7 +3908,8 @@ function createRunResult(input) {
|
|
|
3708
3908
|
cleanup_report: state.cleanup_report,
|
|
3709
3909
|
notification: state.notification,
|
|
3710
3910
|
proof_decision: state.proof_decision,
|
|
3711
|
-
merge_recommendation:
|
|
3911
|
+
merge_recommendation: publicMergeRecommendation,
|
|
3912
|
+
public_state: publicState,
|
|
3712
3913
|
finalized: state.finalized,
|
|
3713
3914
|
blocker: state.blocker,
|
|
3714
3915
|
checkpoint_packet: state.checkpoint_packet,
|
|
@@ -4588,7 +4789,8 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
4588
4789
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
4589
4790
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
4590
4791
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
4591
|
-
const
|
|
4792
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
4793
|
+
const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
|
|
4592
4794
|
return {
|
|
4593
4795
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
4594
4796
|
run_id: state.run_id || "unknown",
|
|
@@ -4642,14 +4844,18 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
4642
4844
|
stop_condition: compactRecord({
|
|
4643
4845
|
status: state.status,
|
|
4644
4846
|
terminal: isTerminalStatus(state.status),
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4847
|
+
result_label: publicState.result_label,
|
|
4848
|
+
ship_held: publicState.ship_held,
|
|
4849
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
4850
|
+
ship_authorized: publicState.ship_authorized,
|
|
4851
|
+
merge_ready: publicState.merge_ready,
|
|
4852
|
+
sync_allowed: publicState.sync_allowed,
|
|
4648
4853
|
blocker_code: state.blocker?.code || null,
|
|
4649
4854
|
blocker_message: state.blocker?.message || null,
|
|
4650
4855
|
proof_decision: state.proof_decision,
|
|
4651
|
-
merge_recommendation:
|
|
4652
|
-
monitor_should_continue: !isTerminalStatus(state.status)
|
|
4856
|
+
merge_recommendation: publicMergeRecommendation,
|
|
4857
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
4858
|
+
public_state: publicState
|
|
4653
4859
|
}),
|
|
4654
4860
|
updated_at: state.updated_at
|
|
4655
4861
|
};
|
|
@@ -4805,8 +5011,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
4805
5011
|
function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
4806
5012
|
const latestEvent = state.events[state.events.length - 1];
|
|
4807
5013
|
const runId = state.run_id || "unknown";
|
|
4808
|
-
const
|
|
4809
|
-
const existingRunCardCurrent = state.run_card?.status === state.status && state.run_card.stop_condition?.status === state.status && state.run_card.stop_condition?.terminal === isTerminalStatus(state.status) && state.run_card.stop_condition?.monitor_should_continue === !isTerminalStatus(state.status) && state.run_card.stop_condition?.ship_held ===
|
|
5014
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
5015
|
+
const existingRunCardCurrent = state.run_card?.status === state.status && state.run_card.stop_condition?.status === state.status && state.run_card.stop_condition?.terminal === isTerminalStatus(state.status) && state.run_card.stop_condition?.monitor_should_continue === !isTerminalStatus(state.status) && state.run_card.stop_condition?.ship_held === publicState.ship_held && state.run_card.stop_condition?.shipping_disabled === publicState.shipping_disabled && state.run_card.stop_condition?.ship_authorized === publicState.ship_authorized && state.run_card.stop_condition?.merge_ready === publicState.merge_ready && state.run_card.stop_condition?.sync_allowed === publicState.sync_allowed && state.run_card.stop_condition?.result_label === publicState.result_label;
|
|
4810
5016
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
4811
5017
|
return compactRecord({
|
|
4812
5018
|
run_id: runId,
|
|
@@ -4820,9 +5026,13 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
|
4820
5026
|
pr_url: state.pr_url ?? null,
|
|
4821
5027
|
pr_branch: state.pr_branch ?? null,
|
|
4822
5028
|
pr_state: state.pr_state,
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
5029
|
+
result_label: publicState.result_label,
|
|
5030
|
+
ship_held: publicState.ship_held,
|
|
5031
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
5032
|
+
ship_authorized: publicState.ship_authorized,
|
|
5033
|
+
merge_ready: publicState.merge_ready,
|
|
5034
|
+
sync_allowed: publicState.sync_allowed,
|
|
5035
|
+
public_state: publicState,
|
|
4826
5036
|
ci_status: state.ci_status,
|
|
4827
5037
|
ship_commit: state.ship_commit,
|
|
4828
5038
|
ship_remote_head: state.ship_remote_head,
|
package/dist/advanced/index.d.ts
CHANGED
package/dist/advanced/index.js
CHANGED
|
@@ -3,17 +3,18 @@ import {
|
|
|
3
3
|
} from "../chunk-VYJD6XYF.js";
|
|
4
4
|
import {
|
|
5
5
|
runner_exports
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-XKNJ5OE4.js";
|
|
7
7
|
import {
|
|
8
8
|
engine_harness_exports
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-PCEDAQPG.js";
|
|
10
|
+
import "../chunk-UEY5SJG5.js";
|
|
11
|
+
import "../chunk-NXEAFQYZ.js";
|
|
12
12
|
import {
|
|
13
13
|
proof_run_core_exports
|
|
14
14
|
} from "../chunk-EKZXU6MU.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-FX2CB4MG.js";
|
|
16
|
+
import "../chunk-QGMSN34W.js";
|
|
17
|
+
import "../chunk-WKIIJX3O.js";
|
|
17
18
|
import "../chunk-MLKGABMK.js";
|
|
18
19
|
export {
|
|
19
20
|
engine_harness_exports as engineHarness,
|