@riddledc/riddle-proof 0.8.77 → 0.8.79

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 (48) hide show
  1. package/README.md +65 -3
  2. package/dist/change-proof.cjs +744 -85
  3. package/dist/change-proof.d.cts +100 -8
  4. package/dist/change-proof.d.ts +100 -8
  5. package/dist/change-proof.js +15 -1
  6. package/dist/{chunk-B2DP2LET.js → chunk-5IFZSUPF.js} +52 -13
  7. package/dist/chunk-6VFS2JFR.js +886 -0
  8. package/dist/{chunk-IY4W6STC.js → chunk-7N6X54WG.js} +116 -17
  9. package/dist/{chunk-GG2D3MFZ.js → chunk-FCSJZBC5.js} +26 -1
  10. package/dist/chunk-MEVVL4TI.js +258 -0
  11. package/dist/{chunk-H25IDX76.js → chunk-NEXWITV4.js} +221 -35
  12. package/dist/{chunk-UE4I7RTI.js → chunk-RQPCKRKT.js} +1 -1
  13. package/dist/cli/index.js +7 -6
  14. package/dist/cli.cjs +2026 -1060
  15. package/dist/cli.js +7 -6
  16. package/dist/index.cjs +932 -122
  17. package/dist/index.d.cts +4 -3
  18. package/dist/index.d.ts +4 -3
  19. package/dist/index.js +42 -14
  20. package/dist/pr-comment.cjs +416 -17
  21. package/dist/pr-comment.d.cts +6 -1
  22. package/dist/pr-comment.d.ts +6 -1
  23. package/dist/pr-comment.js +6 -1
  24. package/dist/profile/index.cjs +26 -1
  25. package/dist/profile/index.js +1 -1
  26. package/dist/profile-suggestions.js +2 -2
  27. package/dist/profile.cjs +26 -1
  28. package/dist/profile.d.cts +7 -0
  29. package/dist/profile.d.ts +7 -0
  30. package/dist/profile.js +1 -1
  31. package/dist/receipts.cjs +286 -0
  32. package/dist/receipts.d.cts +115 -0
  33. package/dist/receipts.d.ts +115 -0
  34. package/dist/receipts.js +15 -0
  35. package/dist/riddle-client.cjs +98 -13
  36. package/dist/riddle-client.d.cts +18 -5
  37. package/dist/riddle-client.d.ts +18 -5
  38. package/dist/riddle-client.js +4 -1
  39. package/dist/runtime/index.cjs +98 -13
  40. package/dist/runtime/index.d.cts +5 -1
  41. package/dist/runtime/index.d.ts +5 -1
  42. package/dist/runtime/index.js +4 -1
  43. package/dist/runtime/riddle-client.cjs +98 -13
  44. package/dist/runtime/riddle-client.d.cts +5 -1
  45. package/dist/runtime/riddle-client.d.ts +5 -1
  46. package/dist/runtime/riddle-client.js +4 -1
  47. package/package.json +7 -2
  48. package/dist/chunk-BILL3UC2.js +0 -488
@@ -1,10 +1,13 @@
1
1
  import { RiddleProofProfileResult, RiddleProofProfileStatus, RiddleProofProfileCheckResult } from './profile.cjs';
2
+ import { RiddleProofObservationReceipt, RiddleProofSourceIdentity, RiddleProofObservationArtifact } from './receipts.cjs';
2
3
  import { JsonValue } from './types.cjs';
3
4
  import './public-state.cjs';
4
5
 
5
6
  declare const RIDDLE_PROOF_CHANGE_CONTRACT_VERSION: "riddle-proof.change-contract.v1";
6
7
  declare const RIDDLE_PROOF_CHANGE_RESULT_VERSION: "riddle-proof.change-result.v1";
7
- declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v1";
8
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION: "riddle-proof.change-receipt.v1";
9
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v2";
10
+ declare const RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION: "riddle-proof.handoff-receipt.v1";
8
11
  type RiddleProofChangeSide = "before" | "after";
9
12
  type RiddleProofChangeStatus = RiddleProofProfileStatus;
10
13
  type RiddleProofChangeDeltaStatus = "passed" | "failed" | "proof_insufficient" | "configuration_error";
@@ -13,6 +16,16 @@ interface RiddleProofChangeGroupContract {
13
16
  label?: string;
14
17
  required_status?: RiddleProofProfileStatus | RiddleProofProfileStatus[];
15
18
  }
19
+ interface RiddleProofChangeSourceBindingRequirement {
20
+ preview_receipt_required?: boolean;
21
+ expected_git_revision?: string;
22
+ require_clean_source?: boolean;
23
+ require_content_digest?: boolean;
24
+ }
25
+ interface RiddleProofChangeSourceBindingContract {
26
+ before?: RiddleProofChangeSourceBindingRequirement;
27
+ after?: RiddleProofChangeSourceBindingRequirement;
28
+ }
16
29
  interface RiddleProofProfileStatusTransitionDelta {
17
30
  type: "profile_status_transition";
18
31
  label?: string;
@@ -33,6 +46,7 @@ interface RiddleProofChangeContract {
33
46
  name: string;
34
47
  before?: RiddleProofChangeGroupContract;
35
48
  after?: RiddleProofChangeGroupContract;
49
+ source_binding?: RiddleProofChangeSourceBindingContract;
36
50
  deltas: RiddleProofChangeDelta[];
37
51
  metadata?: Record<string, JsonValue>;
38
52
  }
@@ -54,6 +68,21 @@ interface RiddleProofChangeDeltaResult {
54
68
  after_observed?: JsonValue;
55
69
  message?: string;
56
70
  }
71
+ type RiddleProofChangeSourceBindingStatus = "not_required" | "matched" | "missing" | "mismatched" | "stale";
72
+ interface RiddleProofChangeSourceBindingResult {
73
+ side: RiddleProofChangeSide;
74
+ required: boolean;
75
+ ok: boolean;
76
+ status: RiddleProofChangeSourceBindingStatus;
77
+ expected_git_revision?: string;
78
+ observed_git_revision?: string;
79
+ content_digest?: string;
80
+ preview_id?: string;
81
+ preview_url?: string;
82
+ target_url?: string;
83
+ expires_at?: string;
84
+ message?: string;
85
+ }
57
86
  interface RiddleProofChangeResult {
58
87
  version: typeof RIDDLE_PROOF_CHANGE_RESULT_VERSION;
59
88
  contract_name: string;
@@ -63,12 +92,20 @@ interface RiddleProofChangeResult {
63
92
  after: RiddleProofChangeGroupResult;
64
93
  };
65
94
  deltas: RiddleProofChangeDeltaResult[];
95
+ source_bindings: {
96
+ before: RiddleProofChangeSourceBindingResult;
97
+ after: RiddleProofChangeSourceBindingResult;
98
+ };
66
99
  summary: string;
67
100
  metadata?: Record<string, JsonValue>;
68
101
  }
69
102
  interface AssessRiddleProofChangeInput {
70
103
  before_result?: RiddleProofProfileResult;
71
104
  after_result?: RiddleProofProfileResult;
105
+ before_observation?: RiddleProofObservationReceipt;
106
+ after_observation?: RiddleProofObservationReceipt;
107
+ expected_source_revisions?: Partial<Record<RiddleProofChangeSide, string>>;
108
+ evaluated_at?: string;
72
109
  }
73
110
  type RiddleProofChangeReceiptVerdict = "mergeable" | "not_mergeable" | "environment_blocked" | "needs_human_review" | "configuration_error" | "proof_insufficient";
74
111
  type RiddleProofChangeReceiptArtifactKind = "image" | "data" | "artifact";
@@ -107,8 +144,8 @@ interface RiddleProofChangeReceiptDelta {
107
144
  after_observed?: JsonValue;
108
145
  message?: string;
109
146
  }
110
- interface RiddleProofChangeReceipt {
111
- version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
147
+ interface RiddleProofLegacyChangeReceipt {
148
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION;
112
149
  contract_name: string;
113
150
  profile_name?: string;
114
151
  status: RiddleProofChangeStatus;
@@ -121,18 +158,73 @@ interface RiddleProofChangeReceipt {
121
158
  does_not_prove: string[];
122
159
  metadata?: Record<string, JsonValue>;
123
160
  }
161
+ interface RiddleProofChangeRecommendation {
162
+ merge_recommended: boolean;
163
+ verdict: RiddleProofChangeReceiptVerdict;
164
+ label: string;
165
+ reason: string;
166
+ }
167
+ interface RiddleProofShippingAuthorization {
168
+ status: "not_granted" | "granted";
169
+ authorized: boolean;
170
+ source: "none" | "human" | "automation";
171
+ actor?: string;
172
+ at?: string;
173
+ }
174
+ interface RiddleProofChangeReceipt {
175
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
176
+ contract_name: string;
177
+ profile_name?: string;
178
+ status: RiddleProofChangeStatus;
179
+ verdict: RiddleProofChangeReceiptVerdict;
180
+ summary: string;
181
+ before: RiddleProofObservationReceipt;
182
+ after: RiddleProofObservationReceipt;
183
+ groups: RiddleProofChangeResult["groups"];
184
+ source_bindings: RiddleProofChangeResult["source_bindings"];
185
+ deltas: RiddleProofChangeReceiptDelta[];
186
+ recommendation: RiddleProofChangeRecommendation;
187
+ shipping_authorization: RiddleProofShippingAuthorization;
188
+ proves: string[];
189
+ does_not_prove: string[];
190
+ metadata?: Record<string, JsonValue>;
191
+ }
192
+ interface RiddleProofHandoffReceipt {
193
+ version: typeof RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION;
194
+ change: RiddleProofChangeReceipt;
195
+ verdict: RiddleProofChangeReceiptVerdict;
196
+ recommendation: RiddleProofChangeRecommendation;
197
+ shipping_authorization: RiddleProofShippingAuthorization;
198
+ canonical_pair: {
199
+ before?: RiddleProofObservationArtifact;
200
+ after?: RiddleProofObservationArtifact;
201
+ };
202
+ created_at: string;
203
+ }
124
204
  interface CreateRiddleProofChangeReceiptInput {
125
205
  contract: RiddleProofChangeContract;
126
206
  result: RiddleProofChangeResult;
127
- before_result: RiddleProofProfileResult;
128
- after_result: RiddleProofProfileResult;
129
- before_source: string;
130
- after_source: string;
207
+ before_result?: RiddleProofProfileResult;
208
+ after_result?: RiddleProofProfileResult;
209
+ before_source?: string;
210
+ after_source?: string;
211
+ before_observation?: RiddleProofObservationReceipt;
212
+ after_observation?: RiddleProofObservationReceipt;
213
+ before_source_identity?: RiddleProofSourceIdentity;
214
+ after_source_identity?: RiddleProofSourceIdentity;
215
+ shipping_authorization?: RiddleProofShippingAuthorization;
131
216
  profile_name?: string;
132
217
  }
133
218
  declare function assessRiddleProofChange(contract: RiddleProofChangeContract, input: AssessRiddleProofChangeInput): RiddleProofChangeResult;
134
219
  declare function createRiddleProofChangeReceipt(input: CreateRiddleProofChangeReceiptInput): RiddleProofChangeReceipt;
220
+ declare function migrateRiddleProofChangeReceipt(legacy: RiddleProofLegacyChangeReceipt): RiddleProofChangeReceipt;
221
+ declare function parseRiddleProofChangeReceipt(value: unknown): RiddleProofChangeReceipt;
222
+ declare function createRiddleProofHandoffReceipt(changeReceipt: RiddleProofChangeReceipt, options?: {
223
+ created_at?: string;
224
+ shipping_authorization?: RiddleProofShippingAuthorization;
225
+ }): RiddleProofHandoffReceipt;
226
+ declare function parseRiddleProofHandoffReceipt(value: unknown): RiddleProofHandoffReceipt;
135
227
  declare function riddleProofChangeReceiptMarkdown(receipt: RiddleProofChangeReceipt): string;
136
228
  declare function riddleProofChangeReceiptHtml(receipt: RiddleProofChangeReceipt): string;
137
229
 
138
- export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange, createRiddleProofChangeReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
230
+ export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeRecommendation, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeSourceBindingContract, type RiddleProofChangeSourceBindingRequirement, type RiddleProofChangeSourceBindingResult, type RiddleProofChangeSourceBindingStatus, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofHandoffReceipt, type RiddleProofLegacyChangeReceipt, type RiddleProofProfileStatusTransitionDelta, type RiddleProofShippingAuthorization, assessRiddleProofChange, createRiddleProofChangeReceipt, createRiddleProofHandoffReceipt, migrateRiddleProofChangeReceipt, parseRiddleProofChangeReceipt, parseRiddleProofHandoffReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
@@ -1,10 +1,13 @@
1
1
  import { RiddleProofProfileResult, RiddleProofProfileStatus, RiddleProofProfileCheckResult } from './profile.js';
2
+ import { RiddleProofObservationReceipt, RiddleProofSourceIdentity, RiddleProofObservationArtifact } from './receipts.js';
2
3
  import { JsonValue } from './types.js';
3
4
  import './public-state.js';
4
5
 
5
6
  declare const RIDDLE_PROOF_CHANGE_CONTRACT_VERSION: "riddle-proof.change-contract.v1";
6
7
  declare const RIDDLE_PROOF_CHANGE_RESULT_VERSION: "riddle-proof.change-result.v1";
7
- declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v1";
8
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION: "riddle-proof.change-receipt.v1";
9
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v2";
10
+ declare const RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION: "riddle-proof.handoff-receipt.v1";
8
11
  type RiddleProofChangeSide = "before" | "after";
9
12
  type RiddleProofChangeStatus = RiddleProofProfileStatus;
10
13
  type RiddleProofChangeDeltaStatus = "passed" | "failed" | "proof_insufficient" | "configuration_error";
@@ -13,6 +16,16 @@ interface RiddleProofChangeGroupContract {
13
16
  label?: string;
14
17
  required_status?: RiddleProofProfileStatus | RiddleProofProfileStatus[];
15
18
  }
19
+ interface RiddleProofChangeSourceBindingRequirement {
20
+ preview_receipt_required?: boolean;
21
+ expected_git_revision?: string;
22
+ require_clean_source?: boolean;
23
+ require_content_digest?: boolean;
24
+ }
25
+ interface RiddleProofChangeSourceBindingContract {
26
+ before?: RiddleProofChangeSourceBindingRequirement;
27
+ after?: RiddleProofChangeSourceBindingRequirement;
28
+ }
16
29
  interface RiddleProofProfileStatusTransitionDelta {
17
30
  type: "profile_status_transition";
18
31
  label?: string;
@@ -33,6 +46,7 @@ interface RiddleProofChangeContract {
33
46
  name: string;
34
47
  before?: RiddleProofChangeGroupContract;
35
48
  after?: RiddleProofChangeGroupContract;
49
+ source_binding?: RiddleProofChangeSourceBindingContract;
36
50
  deltas: RiddleProofChangeDelta[];
37
51
  metadata?: Record<string, JsonValue>;
38
52
  }
@@ -54,6 +68,21 @@ interface RiddleProofChangeDeltaResult {
54
68
  after_observed?: JsonValue;
55
69
  message?: string;
56
70
  }
71
+ type RiddleProofChangeSourceBindingStatus = "not_required" | "matched" | "missing" | "mismatched" | "stale";
72
+ interface RiddleProofChangeSourceBindingResult {
73
+ side: RiddleProofChangeSide;
74
+ required: boolean;
75
+ ok: boolean;
76
+ status: RiddleProofChangeSourceBindingStatus;
77
+ expected_git_revision?: string;
78
+ observed_git_revision?: string;
79
+ content_digest?: string;
80
+ preview_id?: string;
81
+ preview_url?: string;
82
+ target_url?: string;
83
+ expires_at?: string;
84
+ message?: string;
85
+ }
57
86
  interface RiddleProofChangeResult {
58
87
  version: typeof RIDDLE_PROOF_CHANGE_RESULT_VERSION;
59
88
  contract_name: string;
@@ -63,12 +92,20 @@ interface RiddleProofChangeResult {
63
92
  after: RiddleProofChangeGroupResult;
64
93
  };
65
94
  deltas: RiddleProofChangeDeltaResult[];
95
+ source_bindings: {
96
+ before: RiddleProofChangeSourceBindingResult;
97
+ after: RiddleProofChangeSourceBindingResult;
98
+ };
66
99
  summary: string;
67
100
  metadata?: Record<string, JsonValue>;
68
101
  }
69
102
  interface AssessRiddleProofChangeInput {
70
103
  before_result?: RiddleProofProfileResult;
71
104
  after_result?: RiddleProofProfileResult;
105
+ before_observation?: RiddleProofObservationReceipt;
106
+ after_observation?: RiddleProofObservationReceipt;
107
+ expected_source_revisions?: Partial<Record<RiddleProofChangeSide, string>>;
108
+ evaluated_at?: string;
72
109
  }
73
110
  type RiddleProofChangeReceiptVerdict = "mergeable" | "not_mergeable" | "environment_blocked" | "needs_human_review" | "configuration_error" | "proof_insufficient";
74
111
  type RiddleProofChangeReceiptArtifactKind = "image" | "data" | "artifact";
@@ -107,8 +144,8 @@ interface RiddleProofChangeReceiptDelta {
107
144
  after_observed?: JsonValue;
108
145
  message?: string;
109
146
  }
110
- interface RiddleProofChangeReceipt {
111
- version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
147
+ interface RiddleProofLegacyChangeReceipt {
148
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION;
112
149
  contract_name: string;
113
150
  profile_name?: string;
114
151
  status: RiddleProofChangeStatus;
@@ -121,18 +158,73 @@ interface RiddleProofChangeReceipt {
121
158
  does_not_prove: string[];
122
159
  metadata?: Record<string, JsonValue>;
123
160
  }
161
+ interface RiddleProofChangeRecommendation {
162
+ merge_recommended: boolean;
163
+ verdict: RiddleProofChangeReceiptVerdict;
164
+ label: string;
165
+ reason: string;
166
+ }
167
+ interface RiddleProofShippingAuthorization {
168
+ status: "not_granted" | "granted";
169
+ authorized: boolean;
170
+ source: "none" | "human" | "automation";
171
+ actor?: string;
172
+ at?: string;
173
+ }
174
+ interface RiddleProofChangeReceipt {
175
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
176
+ contract_name: string;
177
+ profile_name?: string;
178
+ status: RiddleProofChangeStatus;
179
+ verdict: RiddleProofChangeReceiptVerdict;
180
+ summary: string;
181
+ before: RiddleProofObservationReceipt;
182
+ after: RiddleProofObservationReceipt;
183
+ groups: RiddleProofChangeResult["groups"];
184
+ source_bindings: RiddleProofChangeResult["source_bindings"];
185
+ deltas: RiddleProofChangeReceiptDelta[];
186
+ recommendation: RiddleProofChangeRecommendation;
187
+ shipping_authorization: RiddleProofShippingAuthorization;
188
+ proves: string[];
189
+ does_not_prove: string[];
190
+ metadata?: Record<string, JsonValue>;
191
+ }
192
+ interface RiddleProofHandoffReceipt {
193
+ version: typeof RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION;
194
+ change: RiddleProofChangeReceipt;
195
+ verdict: RiddleProofChangeReceiptVerdict;
196
+ recommendation: RiddleProofChangeRecommendation;
197
+ shipping_authorization: RiddleProofShippingAuthorization;
198
+ canonical_pair: {
199
+ before?: RiddleProofObservationArtifact;
200
+ after?: RiddleProofObservationArtifact;
201
+ };
202
+ created_at: string;
203
+ }
124
204
  interface CreateRiddleProofChangeReceiptInput {
125
205
  contract: RiddleProofChangeContract;
126
206
  result: RiddleProofChangeResult;
127
- before_result: RiddleProofProfileResult;
128
- after_result: RiddleProofProfileResult;
129
- before_source: string;
130
- after_source: string;
207
+ before_result?: RiddleProofProfileResult;
208
+ after_result?: RiddleProofProfileResult;
209
+ before_source?: string;
210
+ after_source?: string;
211
+ before_observation?: RiddleProofObservationReceipt;
212
+ after_observation?: RiddleProofObservationReceipt;
213
+ before_source_identity?: RiddleProofSourceIdentity;
214
+ after_source_identity?: RiddleProofSourceIdentity;
215
+ shipping_authorization?: RiddleProofShippingAuthorization;
131
216
  profile_name?: string;
132
217
  }
133
218
  declare function assessRiddleProofChange(contract: RiddleProofChangeContract, input: AssessRiddleProofChangeInput): RiddleProofChangeResult;
134
219
  declare function createRiddleProofChangeReceipt(input: CreateRiddleProofChangeReceiptInput): RiddleProofChangeReceipt;
220
+ declare function migrateRiddleProofChangeReceipt(legacy: RiddleProofLegacyChangeReceipt): RiddleProofChangeReceipt;
221
+ declare function parseRiddleProofChangeReceipt(value: unknown): RiddleProofChangeReceipt;
222
+ declare function createRiddleProofHandoffReceipt(changeReceipt: RiddleProofChangeReceipt, options?: {
223
+ created_at?: string;
224
+ shipping_authorization?: RiddleProofShippingAuthorization;
225
+ }): RiddleProofHandoffReceipt;
226
+ declare function parseRiddleProofHandoffReceipt(value: unknown): RiddleProofHandoffReceipt;
135
227
  declare function riddleProofChangeReceiptMarkdown(receipt: RiddleProofChangeReceipt): string;
136
228
  declare function riddleProofChangeReceiptHtml(receipt: RiddleProofChangeReceipt): string;
137
229
 
138
- export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange, createRiddleProofChangeReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
230
+ export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeRecommendation, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeSourceBindingContract, type RiddleProofChangeSourceBindingRequirement, type RiddleProofChangeSourceBindingResult, type RiddleProofChangeSourceBindingStatus, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofHandoffReceipt, type RiddleProofLegacyChangeReceipt, type RiddleProofProfileStatusTransitionDelta, type RiddleProofShippingAuthorization, assessRiddleProofChange, createRiddleProofChangeReceipt, createRiddleProofHandoffReceipt, migrateRiddleProofChangeReceipt, parseRiddleProofChangeReceipt, parseRiddleProofHandoffReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
@@ -1,19 +1,33 @@
1
1
  import {
2
2
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
3
+ RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION,
3
4
  RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
4
5
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
6
+ RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION,
5
7
  assessRiddleProofChange,
6
8
  createRiddleProofChangeReceipt,
9
+ createRiddleProofHandoffReceipt,
10
+ migrateRiddleProofChangeReceipt,
11
+ parseRiddleProofChangeReceipt,
12
+ parseRiddleProofHandoffReceipt,
7
13
  riddleProofChangeReceiptHtml,
8
14
  riddleProofChangeReceiptMarkdown
9
- } from "./chunk-BILL3UC2.js";
15
+ } from "./chunk-6VFS2JFR.js";
16
+ import "./chunk-MEVVL4TI.js";
17
+ import "./chunk-FCSJZBC5.js";
10
18
  import "./chunk-MLKGABMK.js";
11
19
  export {
12
20
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
21
+ RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION,
13
22
  RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
14
23
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
24
+ RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION,
15
25
  assessRiddleProofChange,
16
26
  createRiddleProofChangeReceipt,
27
+ createRiddleProofHandoffReceipt,
28
+ migrateRiddleProofChangeReceipt,
29
+ parseRiddleProofChangeReceipt,
30
+ parseRiddleProofHandoffReceipt,
17
31
  riddleProofChangeReceiptHtml,
18
32
  riddleProofChangeReceiptMarkdown
19
33
  };
@@ -1,3 +1,7 @@
1
+ import {
2
+ parseRiddlePreviewReceipt
3
+ } from "./chunk-MEVVL4TI.js";
4
+
1
5
  // src/riddle-client.ts
2
6
  import { execFileSync } from "child_process";
3
7
  import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync } from "fs";
@@ -64,6 +68,7 @@ async function getRiddleBalance(config = {}) {
64
68
  }
65
69
  function previewDeployResultFromRecord(input) {
66
70
  const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
71
+ const receipt = record.receipt && typeof record.receipt === "object" ? parseRiddlePreviewReceipt(record.receipt) : void 0;
67
72
  return {
68
73
  ok: true,
69
74
  id: String(record.id || record.preview_id || id),
@@ -72,13 +77,32 @@ function previewDeployResultFromRecord(input) {
72
77
  preview_url: String(record.preview_url || ""),
73
78
  file_count: typeof record.file_count === "number" ? record.file_count : void 0,
74
79
  total_bytes: typeof record.total_bytes === "number" ? record.total_bytes : void 0,
75
- expires_at: expiresAt,
80
+ expires_at: receipt?.expires_at || expiresAt,
81
+ receipt,
76
82
  publish_recovered: publishRecovered || void 0,
77
83
  publish_error: publishError,
78
84
  warnings: input.warnings?.length ? input.warnings : void 0,
79
85
  raw: record
80
86
  };
81
87
  }
88
+ function gitOutput(directory, args) {
89
+ try {
90
+ return execFileSync("git", ["-C", directory, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
91
+ } catch {
92
+ return "";
93
+ }
94
+ }
95
+ function detectRiddlePreviewSource(directory) {
96
+ const gitRevision = gitOutput(directory, ["rev-parse", "HEAD"]);
97
+ if (!gitRevision) return {};
98
+ const repository = gitOutput(directory, ["config", "--get", "remote.origin.url"]);
99
+ const status = gitOutput(directory, ["status", "--porcelain", "--untracked-files=normal"]);
100
+ return {
101
+ git_revision: gitRevision,
102
+ repository: repository || void 0,
103
+ dirty: Boolean(status)
104
+ };
105
+ }
82
106
  function canRecoverPreviewPublish(error) {
83
107
  return error instanceof RiddleApiError && PREVIEW_PUBLISH_RECOVERY_STATUSES.has(error.status);
84
108
  }
@@ -161,12 +185,13 @@ async function waitForPublishedPreview(config, input) {
161
185
  }
162
186
  throw input.publishError;
163
187
  }
164
- async function deployRiddlePreview(config, directory, label, framework = "static") {
188
+ async function deployRiddlePreview(config, directory, label, framework = "static", options = {}) {
165
189
  if (!directory?.trim()) throw new Error("directory is required");
166
190
  if (!label?.trim()) throw new Error("label is required");
167
191
  if (framework !== "spa" && framework !== "static") throw new Error("framework must be spa or static");
168
192
  const startedAt = Date.now();
169
193
  const warnings = collectRiddlePreviewDeployWarnings(directory, framework);
194
+ const source = options.source || detectRiddlePreviewSource(directory);
170
195
  const emitProgress = previewProgressEmitter(config, { label, framework, directory, startedAt, warnings });
171
196
  await emitProgress({ stage: "validating", message: "checking preview input directory" });
172
197
  const localSummary = summarizePreviewDirectory(directory);
@@ -178,7 +203,7 @@ async function deployRiddlePreview(config, directory, label, framework = "static
178
203
  });
179
204
  const created = await riddleRequestJson(config, "/v1/preview", {
180
205
  method: "POST",
181
- body: JSON.stringify({ framework, label })
206
+ body: JSON.stringify({ framework, label, source })
182
207
  });
183
208
  const id = String(created.id || "");
184
209
  const uploadUrl = String(created.upload_url || "");
@@ -320,8 +345,8 @@ function collectRiddlePreviewDeployWarnings(directory, framework = "static") {
320
345
  return [];
321
346
  }
322
347
  }
323
- async function deployRiddleStaticPreview(config, directory, label) {
324
- return deployRiddlePreview(config, directory, label, "static");
348
+ async function deployRiddleStaticPreview(config, directory, label, options = {}) {
349
+ return deployRiddlePreview(config, directory, label, "static", options);
325
350
  }
326
351
  function createTarball(directory, label, exclude = []) {
327
352
  const scratch = mkdtempSync(path.join(tmpdir(), "riddle-upload-"));
@@ -443,21 +468,31 @@ function parseTimestampMs(value) {
443
468
  }
444
469
  function buildPollSnapshot(jobId, job, input) {
445
470
  const status = job?.status ? String(job.status) : null;
471
+ const phase = job?.phase ? String(job.phase) : null;
446
472
  const terminal = isTerminalRiddleJobStatus(status);
447
473
  const createdAt = stringField(job, "created_at");
448
474
  const submittedAt = stringField(job, "submitted_at");
449
475
  const completedAt = stringField(job, "completed_at");
450
476
  const createdMs = parseTimestampMs(createdAt);
451
477
  const submittedMs = parseTimestampMs(submittedAt);
478
+ const rawExecution = job?.execution && typeof job.execution === "object" && !Array.isArray(job.execution) ? job.execution : null;
479
+ const enqueuedAt = rawExecution ? stringField(rawExecution, "enqueued_at") : null;
480
+ const enqueuedMs = parseTimestampMs(enqueuedAt);
481
+ const queueStartedMs = enqueuedMs ?? createdMs;
482
+ const claimedAt = rawExecution ? stringField(rawExecution, "claimed_at") : null;
483
+ const claimedMs = parseTimestampMs(claimedAt);
452
484
  let queueElapsedMs = null;
453
- if (createdMs !== null && submittedMs !== null) {
454
- queueElapsedMs = Math.max(0, submittedMs - createdMs);
455
- } else if (createdMs !== null && !submittedAt && !terminal) {
456
- queueElapsedMs = Math.max(0, input.observedAt - createdMs);
485
+ if (queueStartedMs !== null && claimedMs !== null) {
486
+ queueElapsedMs = Math.max(0, claimedMs - queueStartedMs);
487
+ } else if (queueStartedMs !== null && submittedMs !== null) {
488
+ queueElapsedMs = Math.max(0, submittedMs - queueStartedMs);
489
+ } else if (queueStartedMs !== null && !submittedAt && !terminal) {
490
+ queueElapsedMs = Math.max(0, input.observedAt - queueStartedMs);
457
491
  }
458
492
  return {
459
493
  job_id: jobId,
460
494
  status,
495
+ phase,
461
496
  terminal,
462
497
  attempt: input.attempt,
463
498
  attempts: input.attempts,
@@ -467,7 +502,9 @@ function buildPollSnapshot(jobId, job, input) {
467
502
  completed_at: completedAt,
468
503
  queue_elapsed_ms: queueElapsedMs,
469
504
  pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
470
- running_without_submission: Boolean(status && !terminal && !submittedAt)
505
+ running_without_submission: Boolean(status && !terminal && !submittedAt),
506
+ active_execution: Boolean(status === "running" && phase && phase !== "queued"),
507
+ execution: rawExecution ? rawExecution : void 0
471
508
  };
472
509
  }
473
510
  function pollMessage(snapshot, timedOut) {
@@ -476,7 +513,7 @@ function pollMessage(snapshot, timedOut) {
476
513
  const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
477
514
  const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
478
515
  const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
479
- return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${wakeHint}${queue}${preSubmit}`;
516
+ return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} phase=${snapshot.phase || "unknown"} submitted_at=${submitted}.${wakeHint}${queue}${preSubmit}`;
480
517
  }
481
518
  async function pollRiddleJob(config, jobId, options = {}) {
482
519
  if (!jobId?.trim()) throw new Error("jobId is required");
@@ -510,6 +547,7 @@ async function pollRiddleJob(config, jobId, options = {}) {
510
547
  };
511
548
  const progressKey = [
512
549
  lastSnapshot.status || "unknown",
550
+ lastSnapshot.phase || "unknown",
513
551
  lastSnapshot.terminal ? "terminal" : "nonterminal",
514
552
  lastSnapshot.submitted_at ? "submitted" : "unsubmitted"
515
553
  ].join(":");
@@ -576,8 +614,8 @@ function createRiddleApiClient(config = {}) {
576
614
  apiKeySource: () => resolveRiddleApiKeySource(config),
577
615
  requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
578
616
  getBalance: () => getRiddleBalance(config),
579
- deployPreview: (directory, label, framework = "static") => deployRiddlePreview(config, directory, label, framework),
580
- deployStaticPreview: (directory, label) => deployRiddleStaticPreview(config, directory, label),
617
+ deployPreview: (directory, label, framework = "static", options) => deployRiddlePreview(config, directory, label, framework, options),
618
+ deployStaticPreview: (directory, label, options) => deployRiddleStaticPreview(config, directory, label, options),
581
619
  runScript: (input) => runRiddleScript(config, input),
582
620
  runServerPreview: (input) => runRiddleServerPreview(config, input),
583
621
  pollJob: (jobId, options) => pollRiddleJob(config, jobId, options)
@@ -593,6 +631,7 @@ export {
593
631
  resolveRiddleApiKey,
594
632
  riddleRequestJson,
595
633
  getRiddleBalance,
634
+ detectRiddlePreviewSource,
596
635
  deployRiddlePreview,
597
636
  collectRiddlePreviewDeployWarnings,
598
637
  deployRiddleStaticPreview,