@riddledc/riddle-proof 0.7.225 → 0.7.227

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.
Files changed (139) hide show
  1. package/dist/adapters/codex-exec-agent.cjs +893 -0
  2. package/dist/adapters/codex-exec-agent.d.cts +3 -0
  3. package/dist/adapters/codex-exec-agent.d.ts +3 -0
  4. package/dist/adapters/codex-exec-agent.js +13 -0
  5. package/dist/adapters/codex.cjs +893 -0
  6. package/dist/adapters/codex.d.cts +3 -0
  7. package/dist/adapters/codex.d.ts +3 -0
  8. package/dist/adapters/codex.js +13 -0
  9. package/dist/adapters/local-agent.cjs +893 -0
  10. package/dist/adapters/local-agent.d.cts +3 -0
  11. package/dist/adapters/local-agent.d.ts +3 -0
  12. package/dist/adapters/local-agent.js +13 -0
  13. package/dist/adapters/openclaw.cjs +213 -0
  14. package/dist/adapters/openclaw.d.cts +2 -0
  15. package/dist/adapters/openclaw.d.ts +2 -0
  16. package/dist/adapters/openclaw.js +17 -0
  17. package/dist/advanced/engine-harness.cjs +5701 -0
  18. package/dist/advanced/engine-harness.d.cts +2 -0
  19. package/dist/advanced/engine-harness.d.ts +2 -0
  20. package/dist/advanced/engine-harness.js +16 -0
  21. package/dist/advanced/index.cjs +6242 -0
  22. package/dist/advanced/index.d.cts +5 -0
  23. package/dist/advanced/index.d.ts +5 -0
  24. package/dist/advanced/index.js +23 -0
  25. package/dist/advanced/proof-run-core.cjs +1085 -0
  26. package/dist/advanced/proof-run-core.d.cts +1 -0
  27. package/dist/advanced/proof-run-core.d.ts +1 -0
  28. package/dist/advanced/proof-run-core.js +59 -0
  29. package/dist/advanced/proof-run-engine.cjs +2905 -0
  30. package/dist/advanced/proof-run-engine.d.cts +2 -0
  31. package/dist/advanced/proof-run-engine.d.ts +2 -0
  32. package/dist/advanced/proof-run-engine.js +10 -0
  33. package/dist/advanced/runner.cjs +833 -0
  34. package/dist/advanced/runner.d.cts +2 -0
  35. package/dist/advanced/runner.d.ts +2 -0
  36. package/dist/advanced/runner.js +12 -0
  37. package/dist/app-contract/index.cjs +24 -0
  38. package/dist/app-contract/index.d.cts +1 -0
  39. package/dist/app-contract/index.d.ts +1 -0
  40. package/dist/app-contract/index.js +2 -0
  41. package/dist/basic-gameplay.js +1 -0
  42. package/dist/checkpoint.js +1 -0
  43. package/dist/chunk-BHL4JSGM.js +1900 -0
  44. package/dist/chunk-BTN76IGW.js +115 -0
  45. package/dist/{chunk-TGHTM66Z.js → chunk-COERZX63.js} +10 -2
  46. package/dist/{chunk-4DRRIJDX.js → chunk-IWLQQ5S5.js} +27 -4
  47. package/dist/chunk-MLKGABMK.js +9 -0
  48. package/dist/chunk-OFSECTSC.js +0 -0
  49. package/dist/{chunk-GBVEQQIM.js → chunk-TJ63IE65.js} +36 -1
  50. package/dist/chunk-VZD5LH7U.js +4138 -0
  51. package/dist/cli/index.cjs +18 -0
  52. package/dist/cli/index.d.cts +2 -0
  53. package/dist/cli/index.d.ts +2 -0
  54. package/dist/cli/index.js +12 -0
  55. package/dist/cli.cjs +19 -2
  56. package/dist/cli.d.cts +1 -0
  57. package/dist/cli.d.ts +1 -0
  58. package/dist/cli.js +8 -4139
  59. package/dist/codex-exec-agent.d.cts +1 -1
  60. package/dist/codex-exec-agent.d.ts +1 -1
  61. package/dist/codex-exec-agent.js +1 -0
  62. package/dist/diagnostics.js +1 -0
  63. package/dist/engine-harness-CMACHP6A.d.ts +96 -0
  64. package/dist/engine-harness-LBfqbFSe.d.cts +96 -0
  65. package/dist/engine-harness.cjs +19 -2
  66. package/dist/engine-harness.d.cts +2 -79
  67. package/dist/engine-harness.d.ts +2 -79
  68. package/dist/engine-harness.js +3 -2
  69. package/dist/index.cjs +19 -2
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.js +4 -3
  73. package/dist/local-agent.d.cts +1 -1
  74. package/dist/local-agent.d.ts +1 -1
  75. package/dist/local-agent.js +1 -0
  76. package/dist/openclaw.js +8 -107
  77. package/dist/playability.js +1 -0
  78. package/dist/profile/index.cjs +9403 -0
  79. package/dist/profile/index.d.cts +2 -0
  80. package/dist/profile/index.d.ts +2 -0
  81. package/dist/profile/index.js +53 -0
  82. package/dist/profile.js +1 -0
  83. package/dist/proof-run-core-CE0jx7wL.d.cts +359 -0
  84. package/dist/proof-run-core-CE0jx7wL.d.ts +359 -0
  85. package/dist/proof-run-core.d.cts +1 -322
  86. package/dist/proof-run-core.d.ts +1 -322
  87. package/dist/proof-run-core.js +2 -1
  88. package/dist/proof-run-engine-CSSc0mNn.d.ts +764 -0
  89. package/dist/proof-run-engine-HSRpUeBi.d.cts +764 -0
  90. package/dist/proof-run-engine.cjs +4 -0
  91. package/dist/proof-run-engine.d.cts +2 -757
  92. package/dist/proof-run-engine.d.ts +2 -757
  93. package/dist/proof-run-engine.js +5 -1881
  94. package/dist/proof-session.js +1 -0
  95. package/dist/result.js +1 -0
  96. package/dist/riddle-client.js +1 -0
  97. package/dist/run-card.js +1 -0
  98. package/dist/runner-4LJ5z0D-.d.cts +29 -0
  99. package/dist/runner-BdQpOkZD.d.ts +29 -0
  100. package/dist/runner.d.cts +2 -22
  101. package/dist/runner.d.ts +2 -22
  102. package/dist/runner.js +3 -2
  103. package/dist/runtime/index.cjs +528 -0
  104. package/dist/runtime/index.d.cts +1 -0
  105. package/dist/runtime/index.d.ts +1 -0
  106. package/dist/runtime/index.js +37 -0
  107. package/dist/runtime/riddle-client.cjs +528 -0
  108. package/dist/runtime/riddle-client.d.cts +1 -0
  109. package/dist/runtime/riddle-client.d.ts +1 -0
  110. package/dist/runtime/riddle-client.js +37 -0
  111. package/dist/spec/checkpoint.cjs +807 -0
  112. package/dist/spec/checkpoint.d.cts +2 -0
  113. package/dist/spec/checkpoint.d.ts +2 -0
  114. package/dist/spec/checkpoint.js +34 -0
  115. package/dist/spec/index.cjs +1510 -0
  116. package/dist/spec/index.d.cts +5 -0
  117. package/dist/spec/index.d.ts +5 -0
  118. package/dist/spec/index.js +80 -0
  119. package/dist/spec/result.cjs +259 -0
  120. package/dist/spec/result.d.cts +2 -0
  121. package/dist/spec/result.d.ts +2 -0
  122. package/dist/spec/result.js +21 -0
  123. package/dist/spec/run-card.cjs +287 -0
  124. package/dist/spec/run-card.d.cts +2 -0
  125. package/dist/spec/run-card.d.ts +2 -0
  126. package/dist/spec/run-card.js +11 -0
  127. package/dist/spec/state.cjs +541 -0
  128. package/dist/spec/state.d.cts +2 -0
  129. package/dist/spec/state.d.ts +2 -0
  130. package/dist/spec/state.js +28 -0
  131. package/dist/spec/types.cjs +18 -0
  132. package/dist/spec/types.d.cts +1 -0
  133. package/dist/spec/types.d.ts +1 -0
  134. package/dist/spec/types.js +1 -0
  135. package/dist/state.js +1 -0
  136. package/package.json +95 -2
  137. package/runtime/lib/verify.py +53 -3
  138. package/runtime/pipelines/riddle-proof-setup.lobster +45 -41
  139. package/runtime/tests/recon_verify_smoke.py +41 -0
@@ -0,0 +1,5 @@
1
+ export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.cjs';
2
+ export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.cjs';
3
+ export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.cjs';
4
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.cjs';
5
+ export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.cjs';
@@ -0,0 +1,5 @@
1
+ export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.js';
2
+ export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.js';
3
+ export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.js';
4
+ export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.js';
5
+ export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.js';
@@ -0,0 +1,80 @@
1
+ import "../chunk-6F4PWJZI.js";
2
+ import {
3
+ RIDDLE_PROOF_RUN_STATE_VERSION,
4
+ appendRunEvent,
5
+ appendStageHeartbeat,
6
+ applyPrLifecycleState,
7
+ createRunState,
8
+ createRunStatusSnapshot,
9
+ normalizeIntegrationContext,
10
+ normalizePrLifecycleState,
11
+ normalizeRunParams,
12
+ setRunStatus
13
+ } from "../chunk-OHJQRDST.js";
14
+ import {
15
+ RIDDLE_PROOF_RUN_CARD_VERSION,
16
+ createRiddleProofRunCard
17
+ } from "../chunk-Y2KTBACQ.js";
18
+ import {
19
+ RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
20
+ RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
21
+ authorPacketPayloadFromCheckpointResponse,
22
+ buildAuthorCheckpointPacket,
23
+ buildCheckpointPacketForEngineResult,
24
+ buildProofAssessmentCheckpointPacket,
25
+ buildStageCheckpointPacket,
26
+ checkpointResponseIdentity,
27
+ checkpointSummaryFromState,
28
+ createCheckpointResponseTemplate,
29
+ isDuplicateCheckpointResponse,
30
+ normalizeCheckpointResponse,
31
+ proofContractFromAuthorCheckpointResponse,
32
+ statePathsForRunState
33
+ } from "../chunk-2CFVREFI.js";
34
+ import {
35
+ applyTerminalMetadata,
36
+ compactRecord,
37
+ createRunResult,
38
+ isSuccessfulStatus,
39
+ isTerminalStatus,
40
+ nonEmptyString,
41
+ normalizeTerminalMetadata,
42
+ recordValue
43
+ } from "../chunk-VY4Y5U57.js";
44
+ import "../chunk-MLKGABMK.js";
45
+ export {
46
+ RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
47
+ RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
48
+ RIDDLE_PROOF_RUN_CARD_VERSION,
49
+ RIDDLE_PROOF_RUN_STATE_VERSION,
50
+ appendRunEvent,
51
+ appendStageHeartbeat,
52
+ applyPrLifecycleState,
53
+ applyTerminalMetadata,
54
+ authorPacketPayloadFromCheckpointResponse,
55
+ buildAuthorCheckpointPacket,
56
+ buildCheckpointPacketForEngineResult,
57
+ buildProofAssessmentCheckpointPacket,
58
+ buildStageCheckpointPacket,
59
+ checkpointResponseIdentity,
60
+ checkpointSummaryFromState,
61
+ compactRecord,
62
+ createCheckpointResponseTemplate,
63
+ createRiddleProofRunCard,
64
+ createRunResult,
65
+ createRunState,
66
+ createRunStatusSnapshot,
67
+ isDuplicateCheckpointResponse,
68
+ isSuccessfulStatus,
69
+ isTerminalStatus,
70
+ nonEmptyString,
71
+ normalizeCheckpointResponse,
72
+ normalizeIntegrationContext,
73
+ normalizePrLifecycleState,
74
+ normalizeRunParams,
75
+ normalizeTerminalMetadata,
76
+ proofContractFromAuthorCheckpointResponse,
77
+ recordValue,
78
+ setRunStatus,
79
+ statePathsForRunState
80
+ };
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/spec/result.ts
21
+ var result_exports = {};
22
+ __export(result_exports, {
23
+ applyTerminalMetadata: () => applyTerminalMetadata,
24
+ compactRecord: () => compactRecord,
25
+ createRunResult: () => createRunResult,
26
+ isSuccessfulStatus: () => isSuccessfulStatus,
27
+ isTerminalStatus: () => isTerminalStatus,
28
+ nonEmptyString: () => nonEmptyString,
29
+ normalizeTerminalMetadata: () => normalizeTerminalMetadata,
30
+ recordValue: () => recordValue
31
+ });
32
+ module.exports = __toCommonJS(result_exports);
33
+
34
+ // src/result.ts
35
+ function isTerminalStatus(status) {
36
+ return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
37
+ }
38
+ function isSuccessfulStatus(status) {
39
+ return status !== "blocked" && status !== "failed";
40
+ }
41
+ function compactRecord(input) {
42
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
43
+ }
44
+ function nonEmptyString(value) {
45
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
46
+ }
47
+ function recordValue(value) {
48
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
49
+ }
50
+ function firstNonEmptyString(...values) {
51
+ for (const value of values) {
52
+ const normalized = nonEmptyString(value);
53
+ if (normalized) return normalized;
54
+ }
55
+ return void 0;
56
+ }
57
+ function firstBoolean(...values) {
58
+ for (const value of values) {
59
+ if (typeof value === "boolean") return value;
60
+ }
61
+ return void 0;
62
+ }
63
+ function normalizePrStatus(value) {
64
+ const status = nonEmptyString(value)?.toLowerCase();
65
+ if (status === "merged") return "merged";
66
+ if (status === "open") return "open";
67
+ if (status === "closed") return "closed";
68
+ if (status === "not_found" || status === "not-found") return "not_found";
69
+ if (status === "unavailable") return "unavailable";
70
+ return status || "unknown";
71
+ }
72
+ function normalizePrLifecycleStateInput(input) {
73
+ if (!input) return void 0;
74
+ const cleanup = recordValue(input.cleanup);
75
+ const mergeCommit = nonEmptyString(input.merge_commit) || nonEmptyString(input.mergeCommit) || nonEmptyString(recordValue(input.mergeCommit)?.oid);
76
+ return compactRecord({
77
+ status: normalizePrStatus(input.status || input.state),
78
+ pr_url: nonEmptyString(input.pr_url) || nonEmptyString(input.prUrl) || nonEmptyString(input.url),
79
+ pr_number: nonEmptyString(input.pr_number) || nonEmptyString(input.prNumber) || (typeof input.number === "number" ? String(input.number) : void 0),
80
+ repo: nonEmptyString(input.repo) || nonEmptyString(input.repository),
81
+ head_branch: nonEmptyString(input.head_branch) || nonEmptyString(input.headBranch) || nonEmptyString(input.headRefName),
82
+ base_branch: nonEmptyString(input.base_branch) || nonEmptyString(input.baseBranch) || nonEmptyString(input.baseRefName),
83
+ merge_commit: mergeCommit,
84
+ merged_at: nonEmptyString(input.merged_at) || nonEmptyString(input.mergedAt),
85
+ closed_at: nonEmptyString(input.closed_at) || nonEmptyString(input.closedAt),
86
+ checked_at: nonEmptyString(input.checked_at) || nonEmptyString(input.checkedAt),
87
+ source: nonEmptyString(input.source),
88
+ next_action: nonEmptyString(input.next_action) || nonEmptyString(input.nextAction),
89
+ cleanup: cleanup && Object.keys(cleanup).length ? cleanup : void 0
90
+ });
91
+ }
92
+ function normalizeTerminalMetadata(input) {
93
+ const riddleState = recordValue(input.riddleState) || {};
94
+ const result = recordValue(input.engineResult) || {};
95
+ const contract = recordValue(result.checkpointContract) || {};
96
+ const details = recordValue(input.checkpointDetails) || recordValue(contract.details) || {};
97
+ const shipReport = recordValue(riddleState.ship_report) || recordValue(result.ship_report) || recordValue(result.shipReport) || recordValue(details.ship_report) || recordValue(details.shipReport) || {};
98
+ const markedReady = firstBoolean(
99
+ riddleState.marked_ready,
100
+ result.marked_ready,
101
+ result.markedReady,
102
+ details.marked_ready,
103
+ details.markedReady,
104
+ shipReport.marked_ready
105
+ );
106
+ const leftDraft = firstBoolean(
107
+ riddleState.left_draft,
108
+ result.left_draft,
109
+ result.leftDraft,
110
+ details.left_draft,
111
+ details.leftDraft,
112
+ shipReport.left_draft
113
+ );
114
+ const finalized = firstBoolean(riddleState.finalized, result.finalized, details.finalized);
115
+ const prState = normalizePrLifecycleStateInput(
116
+ recordValue(riddleState.pr_state) || recordValue(riddleState.prState) || recordValue(result.pr_state) || recordValue(result.prState) || recordValue(details.pr_state) || recordValue(details.prState) || recordValue(shipReport.pr_state) || recordValue(shipReport.prState)
117
+ );
118
+ const cleanupReport = recordValue(riddleState.cleanup_report) || recordValue(riddleState.cleanupReport) || recordValue(result.cleanup_report) || recordValue(result.cleanupReport) || recordValue(details.cleanup_report) || recordValue(details.cleanupReport) || recordValue(prState?.cleanup);
119
+ return compactRecord({
120
+ pr_url: firstNonEmptyString(riddleState.pr_url, result.pr_url, result.prUrl, details.pr_url, details.prUrl, shipReport.pr_url),
121
+ pr_branch: firstNonEmptyString(
122
+ riddleState.pr_branch,
123
+ riddleState.target_branch,
124
+ result.pr_branch,
125
+ result.prBranch,
126
+ details.pr_branch,
127
+ details.prBranch,
128
+ shipReport.pr_branch,
129
+ shipReport.branch,
130
+ prState?.head_branch
131
+ ),
132
+ pr_state: prState,
133
+ marked_ready: markedReady,
134
+ left_draft: leftDraft,
135
+ ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
136
+ ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
137
+ ship_remote_head: firstNonEmptyString(riddleState.ship_remote_head, result.ship_remote_head, result.shipRemoteHead, details.ship_remote_head, details.shipRemoteHead, shipReport.ship_remote_head),
138
+ merge_commit: firstNonEmptyString(riddleState.merge_commit, riddleState.mergeCommit, result.merge_commit, result.mergeCommit, details.merge_commit, details.mergeCommit, prState?.merge_commit),
139
+ merged_at: firstNonEmptyString(riddleState.merged_at, riddleState.mergedAt, result.merged_at, result.mergedAt, details.merged_at, details.mergedAt, prState?.merged_at),
140
+ proof_comment_url: firstNonEmptyString(riddleState.proof_comment_url, result.proof_comment_url, result.proofCommentUrl, details.proof_comment_url, details.proofCommentUrl, shipReport.proof_comment_url),
141
+ before_artifact_url: firstNonEmptyString(riddleState.before_artifact_url, riddleState.before_cdn, result.before_artifact_url, result.beforeArtifactUrl, details.before_artifact_url, details.beforeArtifactUrl, shipReport.before_artifact_url),
142
+ prod_artifact_url: firstNonEmptyString(riddleState.prod_artifact_url, riddleState.prod_cdn, result.prod_artifact_url, result.prodArtifactUrl, details.prod_artifact_url, details.prodArtifactUrl, shipReport.prod_artifact_url),
143
+ after_artifact_url: firstNonEmptyString(riddleState.after_artifact_url, riddleState.after_cdn, result.after_artifact_url, result.afterArtifactUrl, details.after_artifact_url, details.afterArtifactUrl, shipReport.after_artifact_url),
144
+ ship_report: Object.keys(shipReport).length ? shipReport : void 0,
145
+ cleanup_report: cleanupReport,
146
+ notification: recordValue(riddleState.notification) || recordValue(riddleState.discord_notification) || recordValue(result.notification) || recordValue(result.discord_notification),
147
+ proof_decision: nonEmptyString(riddleState.proof_decision) || nonEmptyString(result.proof_decision),
148
+ merge_recommendation: nonEmptyString(riddleState.merge_recommendation) || nonEmptyString(result.merge_recommendation),
149
+ finalized: typeof finalized === "boolean" ? finalized : void 0
150
+ });
151
+ }
152
+ function applyTerminalMetadata(state, metadata) {
153
+ if (metadata.pr_state) {
154
+ state.pr_state = metadata.pr_state;
155
+ if (metadata.pr_state.pr_url) state.pr_url = metadata.pr_state.pr_url;
156
+ if (metadata.pr_state.head_branch) state.pr_branch = metadata.pr_state.head_branch;
157
+ if (metadata.pr_state.merge_commit) state.merge_commit = metadata.pr_state.merge_commit;
158
+ if (metadata.pr_state.merged_at) state.merged_at = metadata.pr_state.merged_at;
159
+ if (metadata.pr_state.cleanup) state.cleanup_report = metadata.pr_state.cleanup;
160
+ if (metadata.pr_state.status === "merged") state.finalized = true;
161
+ }
162
+ const prUrl = nonEmptyString(metadata.pr_url);
163
+ if (prUrl) state.pr_url = prUrl;
164
+ const prBranch = nonEmptyString(metadata.pr_branch);
165
+ if (prBranch) state.pr_branch = prBranch;
166
+ if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
167
+ if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
168
+ const ciStatus = nonEmptyString(metadata.ci_status);
169
+ if (ciStatus) state.ci_status = ciStatus;
170
+ const shipCommit = nonEmptyString(metadata.ship_commit);
171
+ if (shipCommit) state.ship_commit = shipCommit;
172
+ const shipRemoteHead = nonEmptyString(metadata.ship_remote_head);
173
+ if (shipRemoteHead) state.ship_remote_head = shipRemoteHead;
174
+ const mergeCommit = nonEmptyString(metadata.merge_commit);
175
+ if (mergeCommit) state.merge_commit = mergeCommit;
176
+ const mergedAt = nonEmptyString(metadata.merged_at);
177
+ if (mergedAt) state.merged_at = mergedAt;
178
+ const proofCommentUrl = nonEmptyString(metadata.proof_comment_url);
179
+ if (proofCommentUrl) state.proof_comment_url = proofCommentUrl;
180
+ const beforeArtifactUrl = nonEmptyString(metadata.before_artifact_url);
181
+ if (beforeArtifactUrl) state.before_artifact_url = beforeArtifactUrl;
182
+ const prodArtifactUrl = nonEmptyString(metadata.prod_artifact_url);
183
+ if (prodArtifactUrl) state.prod_artifact_url = prodArtifactUrl;
184
+ const afterArtifactUrl = nonEmptyString(metadata.after_artifact_url);
185
+ if (afterArtifactUrl) state.after_artifact_url = afterArtifactUrl;
186
+ const shipReport = recordValue(metadata.ship_report);
187
+ if (shipReport) state.ship_report = shipReport;
188
+ const cleanupReport = recordValue(metadata.cleanup_report);
189
+ if (cleanupReport) state.cleanup_report = cleanupReport;
190
+ const notification = recordValue(metadata.notification);
191
+ if (notification) state.notification = notification;
192
+ const proofDecision = nonEmptyString(metadata.proof_decision);
193
+ if (proofDecision) state.proof_decision = proofDecision;
194
+ const mergeRecommendation = nonEmptyString(metadata.merge_recommendation);
195
+ if (mergeRecommendation) state.merge_recommendation = mergeRecommendation;
196
+ if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
197
+ return state;
198
+ }
199
+ function createRunResult(input) {
200
+ const status = input.status || input.state.status;
201
+ const ok = isSuccessfulStatus(status);
202
+ const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
203
+ state.status = status;
204
+ state.ok = ok;
205
+ return compactRecord({
206
+ ok,
207
+ status,
208
+ run_id: state.run_id,
209
+ state_path: input.state_path ?? state.state_path ?? null,
210
+ worktree_path: state.worktree_path ?? null,
211
+ branch: state.branch ?? null,
212
+ current_stage: state.current_stage ?? null,
213
+ iterations: state.iterations,
214
+ last_checkpoint: state.last_checkpoint ?? null,
215
+ last_summary: input.last_summary ?? null,
216
+ event_count: state.events.length,
217
+ pr_url: state.pr_url,
218
+ pr_branch: state.pr_branch,
219
+ pr_state: state.pr_state,
220
+ marked_ready: state.marked_ready,
221
+ left_draft: state.left_draft,
222
+ ci_status: state.ci_status,
223
+ ship_commit: state.ship_commit,
224
+ ship_remote_head: state.ship_remote_head,
225
+ merge_commit: state.merge_commit,
226
+ merged_at: state.merged_at,
227
+ proof_comment_url: state.proof_comment_url,
228
+ before_artifact_url: state.before_artifact_url,
229
+ prod_artifact_url: state.prod_artifact_url,
230
+ after_artifact_url: state.after_artifact_url,
231
+ ship_report: state.ship_report,
232
+ cleanup_report: state.cleanup_report,
233
+ notification: state.notification,
234
+ proof_decision: state.proof_decision,
235
+ merge_recommendation: state.merge_recommendation,
236
+ finalized: state.finalized,
237
+ blocker: state.blocker,
238
+ checkpoint_packet: state.checkpoint_packet,
239
+ checkpoint_summary: state.checkpoint_summary,
240
+ state_paths: state.state_paths,
241
+ proof_contract: state.proof_contract,
242
+ run_card: state.run_card,
243
+ proof_session: state.proof_session,
244
+ viewport_matrix_status: state.viewport_matrix_status,
245
+ evidence_bundle: input.evidence_bundle,
246
+ raw: input.raw
247
+ });
248
+ }
249
+ // Annotate the CommonJS export names for ESM import in node:
250
+ 0 && (module.exports = {
251
+ applyTerminalMetadata,
252
+ compactRecord,
253
+ createRunResult,
254
+ isSuccessfulStatus,
255
+ isTerminalStatus,
256
+ nonEmptyString,
257
+ normalizeTerminalMetadata,
258
+ recordValue
259
+ });
@@ -0,0 +1,2 @@
1
+ export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.cjs';
2
+ import '../types.cjs';
@@ -0,0 +1,2 @@
1
+ export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.js';
2
+ import '../types.js';
@@ -0,0 +1,21 @@
1
+ import {
2
+ applyTerminalMetadata,
3
+ compactRecord,
4
+ createRunResult,
5
+ isSuccessfulStatus,
6
+ isTerminalStatus,
7
+ nonEmptyString,
8
+ normalizeTerminalMetadata,
9
+ recordValue
10
+ } from "../chunk-VY4Y5U57.js";
11
+ import "../chunk-MLKGABMK.js";
12
+ export {
13
+ applyTerminalMetadata,
14
+ compactRecord,
15
+ createRunResult,
16
+ isSuccessfulStatus,
17
+ isTerminalStatus,
18
+ nonEmptyString,
19
+ normalizeTerminalMetadata,
20
+ recordValue
21
+ };