@riddledc/riddle-proof 0.8.56 → 0.8.58

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/index.d.cts CHANGED
@@ -3,6 +3,7 @@ export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlSta
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.cjs';
4
4
  export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.cjs';
5
5
  export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from './run-card.cjs';
6
+ export { RiddleProofPublicCheckpointSummary, RiddleProofPublicPolicyState, RiddleProofPublicStateSummary, summarizeRiddleProofPublicState } from './public-state.cjs';
6
7
  export { R as RiddleProofRunnerAdapters, a as RunRiddleProofInput, r as runRiddleProof } from './runner-4LJ5z0D-.cjs';
7
8
  export { R as RiddleProofAgentAdapter, a as RiddleProofAgentPayload, b as RiddleProofCheckpointMode, c as RiddleProofEngine, d as RiddleProofEngineHarnessConfig, e as RiddleProofEngineHarnessContext, f as RiddleProofEngineResult, g as RiddleProofShipMode, h as RiddleProofWorkflowParams, i as RunRiddleProofEngineHarnessInput, j as createDisabledRiddleProofAgentAdapter, r as readRiddleProofRunStatus, k as runRiddleProofEngineHarness } from './engine-harness-LBfqbFSe.cjs';
8
9
  export { CodexExecAgentConfig, CodexJsonRequest, CodexJsonResult, CodexJsonRunner, CodexExecAgentConfig as LocalAgentConfig, CodexJsonRequest as LocalAgentJsonRequest, CodexJsonResult as LocalAgentJsonResult, CodexJsonRunner as LocalAgentJsonRunner, createCodexExecAgentAdapter, createCodexExecJsonRunner, createCodexExecAgentAdapter as createLocalAgentAdapter, createCodexExecJsonRunner as createLocalAgentJsonRunner, runCodexExecAgentDoctor, runCodexExecAgentDoctor as runLocalAgentDoctor } from './codex-exec-agent.cjs';
@@ -12,4 +13,4 @@ export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
12
13
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.cjs';
13
14
  export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
14
15
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployProgressSnapshot, RiddlePreviewDeployResult, RiddlePreviewDeployStage, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
15
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.cjs';
16
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentCheckpointSummary, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.cjs';
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlSta
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.js';
4
4
  export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.js';
5
5
  export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from './run-card.js';
6
+ export { RiddleProofPublicCheckpointSummary, RiddleProofPublicPolicyState, RiddleProofPublicStateSummary, summarizeRiddleProofPublicState } from './public-state.js';
6
7
  export { R as RiddleProofRunnerAdapters, a as RunRiddleProofInput, r as runRiddleProof } from './runner-BdQpOkZD.js';
7
8
  export { R as RiddleProofAgentAdapter, a as RiddleProofAgentPayload, b as RiddleProofCheckpointMode, c as RiddleProofEngine, d as RiddleProofEngineHarnessConfig, e as RiddleProofEngineHarnessContext, f as RiddleProofEngineResult, g as RiddleProofShipMode, h as RiddleProofWorkflowParams, i as RunRiddleProofEngineHarnessInput, j as createDisabledRiddleProofAgentAdapter, r as readRiddleProofRunStatus, k as runRiddleProofEngineHarness } from './engine-harness-CMACHP6A.js';
8
9
  export { CodexExecAgentConfig, CodexJsonRequest, CodexJsonResult, CodexJsonRunner, CodexExecAgentConfig as LocalAgentConfig, CodexJsonRequest as LocalAgentJsonRequest, CodexJsonResult as LocalAgentJsonResult, CodexJsonRunner as LocalAgentJsonRunner, createCodexExecAgentAdapter, createCodexExecJsonRunner, createCodexExecAgentAdapter as createLocalAgentAdapter, createCodexExecJsonRunner as createLocalAgentJsonRunner, runCodexExecAgentDoctor, runCodexExecAgentDoctor as runLocalAgentDoctor } from './codex-exec-agent.js';
@@ -12,4 +13,4 @@ export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
12
13
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
13
14
  export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
14
15
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployProgressSnapshot, RiddlePreviewDeployResult, RiddlePreviewDeployStage, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
15
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.js';
16
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentCheckpointSummary, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.js';
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ import {
59
59
  RIDDLE_PROOF_PR_COMMENT_MARKER,
60
60
  buildRiddleProofPrCommentMarkdown,
61
61
  summarizeRiddleProofPrComment
62
- } from "./chunk-6KYXX4OE.js";
62
+ } from "./chunk-62XLYPMS.js";
63
63
  import {
64
64
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
65
65
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
@@ -88,6 +88,9 @@ import {
88
88
  slugifyRiddleProofProfileName,
89
89
  summarizeRiddleProofProfileResult
90
90
  } from "./chunk-EX7TO4I5.js";
91
+ import {
92
+ summarizeRiddleProofPublicState
93
+ } from "./chunk-KG64Y5MC.js";
91
94
  import {
92
95
  DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
93
96
  DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
@@ -286,6 +289,7 @@ export {
286
289
  summarizeCaptureArtifacts,
287
290
  summarizeRiddleProofPrComment,
288
291
  summarizeRiddleProofProfileResult,
292
+ summarizeRiddleProofPublicState,
289
293
  visualSessionFingerprint,
290
294
  visualSessionFingerprintBasis
291
295
  };
@@ -25,22 +25,183 @@ __export(pr_comment_exports, {
25
25
  summarizeRiddleProofPrComment: () => summarizeRiddleProofPrComment
26
26
  });
27
27
  module.exports = __toCommonJS(pr_comment_exports);
28
- var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
28
+
29
+ // src/public-state.ts
29
30
  function asRecord(value) {
30
31
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
31
32
  }
33
+ function stringValue(value) {
34
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
35
+ }
36
+ function booleanValue(value) {
37
+ return typeof value === "boolean" ? value : void 0;
38
+ }
39
+ function numberValue(value) {
40
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
41
+ }
42
+ function firstStringValue(...values) {
43
+ for (const value of values) {
44
+ const text = stringValue(value);
45
+ if (text) return text;
46
+ }
47
+ return void 0;
48
+ }
49
+ function firstBooleanValue(...values) {
50
+ for (const value of values) {
51
+ const bool = booleanValue(value);
52
+ if (typeof bool === "boolean") return bool;
53
+ }
54
+ return void 0;
55
+ }
56
+ function firstRecordValue(...values) {
57
+ for (const value of values) {
58
+ const record = asRecord(value);
59
+ if (Object.keys(record).length) return record;
60
+ }
61
+ return void 0;
62
+ }
63
+ function countValue(value) {
64
+ const number = numberValue(value);
65
+ return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
66
+ }
67
+ function checkpointSummaryFrom(...values) {
68
+ const record = firstRecordValue(...values);
69
+ if (!record) return void 0;
70
+ const accepted = countValue(record.response_count);
71
+ const rejected = countValue(record.rejected_response_count);
72
+ const ignored = countValue(record.ignored_response_count);
73
+ const duplicate = countValue(record.duplicate_response_count);
74
+ const summary = {
75
+ pending: booleanValue(record.pending),
76
+ accepted_response_count: accepted,
77
+ rejected_response_count: rejected,
78
+ ignored_response_count: ignored,
79
+ duplicate_response_count: duplicate,
80
+ latest_decision: stringValue(record.latest_decision),
81
+ audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
82
+ };
83
+ return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
84
+ }
85
+ function uniqueStrings(values) {
86
+ return [...new Set(values.filter(Boolean))];
87
+ }
88
+ function summarizeRiddleProofPublicState(input) {
89
+ const record = asRecord(input);
90
+ const runCard = asRecord(record.run_card);
91
+ const stopCondition = asRecord(runCard.stop_condition);
92
+ const raw = asRecord(record.raw);
93
+ const request = asRecord(record.request);
94
+ const requestMetadata = asRecord(record.request_metadata);
95
+ const prState = asRecord(record.pr_state);
96
+ const handoff = asRecord(record.pr_handoff_policy);
97
+ const handoffState = stringValue(handoff.state);
98
+ const status = firstStringValue(record.status, stopCondition.status);
99
+ const ok = booleanValue(record.ok) ?? null;
100
+ const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
101
+ const explicitShippingDisabled = firstBooleanValue(
102
+ record.shipping_disabled,
103
+ stopCondition.shipping_disabled,
104
+ raw.shipping_disabled,
105
+ handoff.shipping_disabled
106
+ );
107
+ const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
108
+ const explicitShipAuthorized = firstBooleanValue(
109
+ record.ship_authorized,
110
+ stopCondition.ship_authorized,
111
+ raw.ship_authorized
112
+ );
113
+ const authorizationEvidence = Boolean(
114
+ status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
115
+ );
116
+ const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
117
+ const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
118
+ const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
119
+ const shipHeld = explicitShipHeld === true || inferredHeld;
120
+ const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
121
+ const proofComplete = Boolean(
122
+ status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
123
+ );
124
+ const checkpointSummary = checkpointSummaryFrom(
125
+ record.checkpoint_summary,
126
+ stopCondition.checkpoint_summary,
127
+ asRecord(record.details).checkpoint_summary,
128
+ asRecord(raw.details).checkpoint_summary
129
+ );
130
+ const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
131
+ const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
132
+ const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
133
+ const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
134
+ const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
135
+ const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
136
+ const syncAllowed = mergeReady;
137
+ let policyState = "unknown";
138
+ if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
139
+ else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
140
+ else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
141
+ else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
142
+ else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
143
+ else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
144
+ else if (shipAuthorized) policyState = "ship_authorized";
145
+ else if (proofPassed) policyState = "proof_passed";
146
+ else if (status === "running") policyState = "proof_in_progress";
147
+ const requiredDisclosures = [];
148
+ if (shipHeld) requiredDisclosures.push("ship_held");
149
+ if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
150
+ if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
151
+ if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
152
+ const prohibitedClaims = [];
153
+ if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
154
+ if (!mergeReady) prohibitedClaims.push("merge_ready");
155
+ if (!syncAllowed) prohibitedClaims.push("sync_allowed");
156
+ if (blockedOrWaiting) {
157
+ prohibitedClaims.push("proof_passed", "ready_to_ship");
158
+ }
159
+ if (checkpointSummary?.audit_disclosure_required) {
160
+ prohibitedClaims.push("all_checkpoint_responses_accepted");
161
+ }
162
+ const resultLabel2 = 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";
163
+ return {
164
+ status,
165
+ ok,
166
+ policy_state: policyState,
167
+ result_label: resultLabel2,
168
+ proof_complete: proofComplete,
169
+ proof_passed: proofPassed,
170
+ ship_held: shipHeld,
171
+ shipping_disabled: shippingDisabled,
172
+ ship_authorized: shipAuthorized,
173
+ merge_ready: mergeReady,
174
+ sync_allowed: syncAllowed,
175
+ checkpoint_summary: checkpointSummary,
176
+ required_disclosures: uniqueStrings(requiredDisclosures),
177
+ prohibited_claims: uniqueStrings(prohibitedClaims)
178
+ };
179
+ }
180
+
181
+ // src/pr-comment.ts
182
+ var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
183
+ function asRecord2(value) {
184
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
185
+ }
32
186
  function asArray(value) {
33
187
  return Array.isArray(value) ? value : [];
34
188
  }
35
- function stringValue(value) {
189
+ function stringValue2(value) {
36
190
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
37
191
  }
38
- function numberValue(value) {
192
+ function numberValue2(value) {
39
193
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
40
194
  }
41
- function booleanValue(value) {
195
+ function booleanValue2(value) {
42
196
  return typeof value === "boolean" ? value : void 0;
43
197
  }
198
+ function firstStringValue2(...values) {
199
+ for (const value of values) {
200
+ const text = stringValue2(value);
201
+ if (text) return text;
202
+ }
203
+ return void 0;
204
+ }
44
205
  function artifactKind(name, url) {
45
206
  const target = `${name} ${url}`.toLowerCase();
46
207
  if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
@@ -48,18 +209,18 @@ function artifactKind(name, url) {
48
209
  return "artifact";
49
210
  }
50
211
  function artifactDisplayName(value, fallback) {
51
- const raw = stringValue(value);
212
+ const raw = stringValue2(value);
52
213
  if (raw) return raw;
53
214
  return fallback;
54
215
  }
55
216
  function collectArtifacts(runResponse) {
56
- const proofResult = asRecord(runResponse.proofResult);
217
+ const proofResult = asRecord2(runResponse.proofResult);
57
218
  const outputs = asArray(proofResult.outputs);
58
219
  const artifacts = [];
59
220
  const seen = /* @__PURE__ */ new Set();
60
221
  for (const [index, item] of outputs.entries()) {
61
- const artifact = asRecord(item);
62
- const url = stringValue(artifact.url);
222
+ const artifact = asRecord2(item);
223
+ const url = stringValue2(artifact.url);
63
224
  if (!url || seen.has(url)) continue;
64
225
  seen.add(url);
65
226
  const name = artifactDisplayName(artifact.name, `artifact-${index + 1}`);
@@ -67,7 +228,7 @@ function collectArtifacts(runResponse) {
67
228
  name,
68
229
  url,
69
230
  kind: artifactKind(name, url),
70
- size_bytes: numberValue(artifact.size)
231
+ size_bytes: numberValue2(artifact.size)
71
232
  });
72
233
  }
73
234
  return artifacts;
@@ -75,9 +236,9 @@ function collectArtifacts(runResponse) {
75
236
  function pageSummaries(result) {
76
237
  const pages = [];
77
238
  for (const page of asArray(result.pages)) {
78
- const record = asRecord(page);
79
- const route = stringValue(record.route) || stringValue(record.url) || "page";
80
- const checks = asRecord(record.checks);
239
+ const record = asRecord2(page);
240
+ const route = stringValue2(record.route) || stringValue2(record.url) || "page";
241
+ const checks = asRecord2(record.checks);
81
242
  let passed = 0;
82
243
  let failed = 0;
83
244
  for (const value of Object.values(checks)) {
@@ -117,27 +278,74 @@ function selectPrimaryImage(artifacts) {
117
278
  const images = artifacts.filter((artifact) => artifact.kind === "image");
118
279
  return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
119
280
  }
281
+ function firstRecordValue2(...values) {
282
+ for (const value of values) {
283
+ const record = asRecord2(value);
284
+ if (Object.keys(record).length) return record;
285
+ }
286
+ return void 0;
287
+ }
288
+ function checkpointSummaryFrom2(...values) {
289
+ const record = firstRecordValue2(...values);
290
+ if (!record) return void 0;
291
+ const summary = {
292
+ pending: booleanValue2(record.pending),
293
+ response_count: numberValue2(record.response_count),
294
+ rejected_response_count: numberValue2(record.rejected_response_count),
295
+ ignored_response_count: numberValue2(record.ignored_response_count),
296
+ duplicate_response_count: numberValue2(record.duplicate_response_count),
297
+ latest_decision: stringValue2(record.latest_decision),
298
+ latest_packet_id: stringValue2(record.latest_packet_id),
299
+ latest_resume_token: stringValue2(record.latest_resume_token)
300
+ };
301
+ return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
302
+ }
120
303
  function summarizeRiddleProofPrComment(input) {
121
- const runResponse = asRecord(input.runResponse);
122
- const result = asRecord(input.result);
123
- const proofResult = asRecord(runResponse.proofResult);
124
- const preview = asRecord(runResponse.preview);
304
+ const runResponse = asRecord2(input.runResponse);
305
+ const result = asRecord2(input.result);
306
+ const proofResult = asRecord2(runResponse.proofResult);
307
+ const preview = asRecord2(runResponse.preview);
308
+ const resultRunCard = asRecord2(result.run_card);
309
+ const stopCondition = asRecord2(resultRunCard.stop_condition);
310
+ const resultDetails = asRecord2(result.details);
311
+ const resultRaw = asRecord2(result.raw);
312
+ const rawDetails = asRecord2(resultRaw.details);
125
313
  const artifacts = collectArtifacts(runResponse);
126
314
  const pages = pageSummaries(result);
127
315
  const checkSource = { ...result };
128
316
  delete checkSource.ok;
129
317
  const nestedChecks = summarizeExplicitChecks(checkSource);
130
- const ok = booleanValue(result.ok) ?? booleanValue(runResponse.ok) ?? null;
318
+ const ok = booleanValue2(result.ok) ?? booleanValue2(runResponse.ok) ?? null;
319
+ const checkpointSummary = checkpointSummaryFrom2(
320
+ result.checkpoint_summary,
321
+ stopCondition.checkpoint_summary,
322
+ resultDetails.checkpoint_summary,
323
+ rawDetails.checkpoint_summary,
324
+ proofResult.checkpoint_summary
325
+ );
326
+ const publicState = summarizeRiddleProofPublicState({
327
+ ...result,
328
+ status: firstStringValue2(result.status, stopCondition.status),
329
+ checkpoint_summary: checkpointSummary || result.checkpoint_summary
330
+ });
131
331
  return {
132
332
  ok,
133
- status: stringValue(proofResult.status),
134
- job_id: stringValue(proofResult.job_id),
135
- duration_ms: numberValue(proofResult.duration_ms),
136
- proof_url: stringValue(runResponse.proofUrl),
137
- preview_id: stringValue(preview.id),
138
- preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
139
- preview_publish_recovered: booleanValue(preview.publish_recovered),
140
- preview_publish_error: stringValue(preview.publish_error),
333
+ status: stringValue2(proofResult.status),
334
+ result_status: publicState.status,
335
+ job_id: stringValue2(proofResult.job_id),
336
+ duration_ms: numberValue2(proofResult.duration_ms),
337
+ proof_url: stringValue2(runResponse.proofUrl),
338
+ preview_id: stringValue2(preview.id),
339
+ preview_url: stringValue2(preview.preview_url) || stringValue2(preview.url),
340
+ preview_publish_recovered: booleanValue2(preview.publish_recovered),
341
+ preview_publish_error: stringValue2(preview.publish_error),
342
+ ship_held: publicState.ship_held,
343
+ shipping_disabled: publicState.shipping_disabled,
344
+ ship_authorized: publicState.ship_authorized,
345
+ proof_decision: firstStringValue2(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
346
+ merge_recommendation: firstStringValue2(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
347
+ checkpoint_summary: checkpointSummary,
348
+ public_state: publicState,
141
349
  passed_checks: nestedChecks.passed,
142
350
  failed_checks: nestedChecks.failed,
143
351
  pages,
@@ -156,9 +364,16 @@ function markdownLink(label, url) {
156
364
  return `[${label.replace(/\]/g, "\\]")}](${url})`;
157
365
  }
158
366
  function resultLabel(summary) {
159
- if (summary.ok === true) return "passed";
367
+ if (summary.public_state?.result_label) return summary.public_state.result_label;
368
+ if (summary.ok === true) {
369
+ if (summary.result_status === "shipped") return "shipped";
370
+ if (summary.result_status === "completed") return "completed";
371
+ if (summary.ship_held === true) return "proof passed; ship held";
372
+ if (summary.ship_authorized === true) return "passed; ship authorized";
373
+ return "passed";
374
+ }
160
375
  if (summary.ok === false) return "failed";
161
- return summary.status || "recorded";
376
+ return summary.result_status || summary.status || "recorded";
162
377
  }
163
378
  function artifactRank(artifact) {
164
379
  const name = artifact.name.toLowerCase();
@@ -170,6 +385,25 @@ function artifactRank(artifact) {
170
385
  if (artifact.kind === "image") return 20;
171
386
  return 30;
172
387
  }
388
+ function formatBool(value) {
389
+ return typeof value === "boolean" ? String(value) : "unknown";
390
+ }
391
+ function hasShipControl(summary) {
392
+ return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
393
+ }
394
+ function checkpointSummaryLine(summary) {
395
+ const accepted = summary.response_count ?? 0;
396
+ const rejected = summary.rejected_response_count ?? 0;
397
+ const ignored = summary.ignored_response_count ?? 0;
398
+ const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
399
+ if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
400
+ const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
401
+ return [
402
+ parts.join(" / "),
403
+ state,
404
+ summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
405
+ ].filter(Boolean).join("; ");
406
+ }
173
407
  function buildRiddleProofPrCommentMarkdown(input) {
174
408
  const summary = summarizeRiddleProofPrComment(input);
175
409
  const title = input.title?.trim() || "Riddle Proof Evidence";
@@ -181,9 +415,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
181
415
  ];
182
416
  if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
183
417
  if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
418
+ if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
184
419
  if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
185
420
  if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
186
421
  if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
422
+ if (hasShipControl(summary)) {
423
+ lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
424
+ }
425
+ if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
426
+ if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
427
+ if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
187
428
  if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
188
429
  if (summary.preview_id || summary.preview_url) {
189
430
  const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
@@ -1,3 +1,5 @@
1
+ import { RiddleProofPublicStateSummary } from './public-state.cjs';
2
+
1
3
  declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
2
4
  type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
3
5
  interface RiddleProofPrCommentArtifact {
@@ -11,9 +13,20 @@ interface RiddleProofPrCommentPageSummary {
11
13
  passed: number;
12
14
  failed: number;
13
15
  }
16
+ interface RiddleProofPrCommentCheckpointSummary {
17
+ pending?: boolean;
18
+ response_count?: number;
19
+ rejected_response_count?: number;
20
+ ignored_response_count?: number;
21
+ duplicate_response_count?: number;
22
+ latest_decision?: string;
23
+ latest_packet_id?: string;
24
+ latest_resume_token?: string;
25
+ }
14
26
  interface RiddleProofPrCommentSummary {
15
27
  ok: boolean | null;
16
28
  status?: string;
29
+ result_status?: string;
17
30
  job_id?: string;
18
31
  duration_ms?: number;
19
32
  proof_url?: string;
@@ -21,6 +34,13 @@ interface RiddleProofPrCommentSummary {
21
34
  preview_url?: string;
22
35
  preview_publish_recovered?: boolean;
23
36
  preview_publish_error?: string;
37
+ ship_held?: boolean;
38
+ shipping_disabled?: boolean;
39
+ ship_authorized?: boolean;
40
+ proof_decision?: string;
41
+ merge_recommendation?: string;
42
+ checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
43
+ public_state?: RiddleProofPublicStateSummary;
24
44
  passed_checks: number;
25
45
  failed_checks: number;
26
46
  pages: RiddleProofPrCommentPageSummary[];
@@ -38,4 +58,4 @@ interface RiddleProofPrCommentInput {
38
58
  declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
39
59
  declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
40
60
 
41
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
61
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
@@ -1,3 +1,5 @@
1
+ import { RiddleProofPublicStateSummary } from './public-state.js';
2
+
1
3
  declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
2
4
  type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
3
5
  interface RiddleProofPrCommentArtifact {
@@ -11,9 +13,20 @@ interface RiddleProofPrCommentPageSummary {
11
13
  passed: number;
12
14
  failed: number;
13
15
  }
16
+ interface RiddleProofPrCommentCheckpointSummary {
17
+ pending?: boolean;
18
+ response_count?: number;
19
+ rejected_response_count?: number;
20
+ ignored_response_count?: number;
21
+ duplicate_response_count?: number;
22
+ latest_decision?: string;
23
+ latest_packet_id?: string;
24
+ latest_resume_token?: string;
25
+ }
14
26
  interface RiddleProofPrCommentSummary {
15
27
  ok: boolean | null;
16
28
  status?: string;
29
+ result_status?: string;
17
30
  job_id?: string;
18
31
  duration_ms?: number;
19
32
  proof_url?: string;
@@ -21,6 +34,13 @@ interface RiddleProofPrCommentSummary {
21
34
  preview_url?: string;
22
35
  preview_publish_recovered?: boolean;
23
36
  preview_publish_error?: string;
37
+ ship_held?: boolean;
38
+ shipping_disabled?: boolean;
39
+ ship_authorized?: boolean;
40
+ proof_decision?: string;
41
+ merge_recommendation?: string;
42
+ checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
43
+ public_state?: RiddleProofPublicStateSummary;
24
44
  passed_checks: number;
25
45
  failed_checks: number;
26
46
  pages: RiddleProofPrCommentPageSummary[];
@@ -38,4 +58,4 @@ interface RiddleProofPrCommentInput {
38
58
  declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
39
59
  declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
40
60
 
41
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
61
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
@@ -2,7 +2,8 @@ import {
2
2
  RIDDLE_PROOF_PR_COMMENT_MARKER,
3
3
  buildRiddleProofPrCommentMarkdown,
4
4
  summarizeRiddleProofPrComment
5
- } from "./chunk-6KYXX4OE.js";
5
+ } from "./chunk-62XLYPMS.js";
6
+ import "./chunk-KG64Y5MC.js";
6
7
  import "./chunk-MLKGABMK.js";
7
8
  export {
8
9
  RIDDLE_PROOF_PR_COMMENT_MARKER,