@tiangong-lca/cli 0.1.0 → 0.1.2

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 (159) hide show
  1. package/README.md +58 -6
  2. package/dist/src/batch.d.ts +6 -0
  3. package/dist/src/batch.js +6 -0
  4. package/dist/src/batch.js.map +1 -0
  5. package/dist/src/cli.d.ts +161 -0
  6. package/dist/src/cli.js +130 -0
  7. package/dist/src/cli.js.map +1 -1
  8. package/dist/src/command-spec.d.ts +90 -0
  9. package/dist/src/command-spec.js +400 -0
  10. package/dist/src/command-spec.js.map +1 -0
  11. package/dist/src/lib/artifacts.d.ts +9 -0
  12. package/dist/src/lib/auth-identity-receipt.d.ts +160 -0
  13. package/dist/src/lib/auth-identity-receipt.js +634 -0
  14. package/dist/src/lib/auth-identity-receipt.js.map +1 -0
  15. package/dist/src/lib/batch/attempt-recovery.d.ts +12 -0
  16. package/dist/src/lib/batch/attempt-recovery.js +183 -0
  17. package/dist/src/lib/batch/attempt-recovery.js.map +1 -0
  18. package/dist/src/lib/batch/canonical-contracts.d.ts +21 -0
  19. package/dist/src/lib/batch/canonical-contracts.js +180 -0
  20. package/dist/src/lib/batch/canonical-contracts.js.map +1 -0
  21. package/dist/src/lib/batch/engine.d.ts +2 -0
  22. package/dist/src/lib/batch/engine.js +294 -0
  23. package/dist/src/lib/batch/engine.js.map +1 -0
  24. package/dist/src/lib/batch/errors.d.ts +51 -0
  25. package/dist/src/lib/batch/errors.js +81 -0
  26. package/dist/src/lib/batch/errors.js.map +1 -0
  27. package/dist/src/lib/batch/item-projection.d.ts +10 -0
  28. package/dist/src/lib/batch/item-projection.js +118 -0
  29. package/dist/src/lib/batch/item-projection.js.map +1 -0
  30. package/dist/src/lib/batch/run-lock.d.ts +4 -0
  31. package/dist/src/lib/batch/run-lock.js +155 -0
  32. package/dist/src/lib/batch/run-lock.js.map +1 -0
  33. package/dist/src/lib/batch/scheduler-runtime.d.ts +29 -0
  34. package/dist/src/lib/batch/scheduler-runtime.js +114 -0
  35. package/dist/src/lib/batch/scheduler-runtime.js.map +1 -0
  36. package/dist/src/lib/batch/types.d.ts +183 -0
  37. package/dist/src/lib/batch/types.js +2 -0
  38. package/dist/src/lib/batch/types.js.map +1 -0
  39. package/dist/src/lib/dataset-author.d.ts +39 -0
  40. package/dist/src/lib/dataset-bilingual.d.ts +165 -0
  41. package/dist/src/lib/dataset-classification.d.ts +279 -0
  42. package/dist/src/lib/dataset-command.d.ts +53 -0
  43. package/dist/src/lib/dataset-contract.d.ts +82 -0
  44. package/dist/src/lib/dataset-curation-queue.d.ts +219 -0
  45. package/dist/src/lib/dataset-evidence-search.d.ts +134 -0
  46. package/dist/src/lib/dataset-import-lca.d.ts +136 -0
  47. package/dist/src/lib/dataset-local.d.ts +23 -0
  48. package/dist/src/lib/dataset-maintenance-alias-request.d.ts +12 -0
  49. package/dist/src/lib/dataset-maintenance-alias-rewrite.d.ts +111 -0
  50. package/dist/src/lib/dataset-maintenance-apply.d.ts +458 -0
  51. package/dist/src/lib/dataset-maintenance-clear-account.d.ts +161 -0
  52. package/dist/src/lib/dataset-maintenance-contract.d.ts +317 -0
  53. package/dist/src/lib/dataset-maintenance-derivatives.d.ts +48 -0
  54. package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.d.ts +50 -0
  55. package/dist/src/lib/dataset-maintenance-flow-identity-capture.d.ts +110 -0
  56. package/dist/src/lib/dataset-maintenance-flow-identity-command.d.ts +15 -0
  57. package/dist/src/lib/dataset-maintenance-flow-identity-contract.d.ts +387 -0
  58. package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.d.ts +456 -0
  59. package/dist/src/lib/dataset-maintenance-flow-identity-freeze.d.ts +99 -0
  60. package/dist/src/lib/dataset-maintenance-flow-identity-plan.d.ts +85 -0
  61. package/dist/src/lib/dataset-maintenance-flow-identity-recovery.d.ts +268 -0
  62. package/dist/src/lib/dataset-maintenance-flow-identity-run.d.ts +123 -0
  63. package/dist/src/lib/dataset-maintenance-flow-identity-seal.d.ts +50 -0
  64. package/dist/src/lib/dataset-maintenance-flow-identity-verify.d.ts +85 -0
  65. package/dist/src/lib/dataset-maintenance-flow-identity-wire.d.ts +32 -0
  66. package/dist/src/lib/dataset-maintenance-pagination.d.ts +58 -0
  67. package/dist/src/lib/dataset-maintenance-plan.d.ts +40 -0
  68. package/dist/src/lib/dataset-maintenance-protected-artifacts.d.ts +16 -0
  69. package/dist/src/lib/dataset-maintenance-protected-before.d.ts +71 -0
  70. package/dist/src/lib/dataset-maintenance-protected-contract.d.ts +385 -0
  71. package/dist/src/lib/dataset-maintenance-protected-freeze.d.ts +148 -0
  72. package/dist/src/lib/dataset-maintenance-protected-preparation.d.ts +76 -0
  73. package/dist/src/lib/dataset-maintenance-protected-run.d.ts +252 -0
  74. package/dist/src/lib/dataset-maintenance-protected-seal.d.ts +93 -0
  75. package/dist/src/lib/dataset-maintenance-protected-toolchain.d.ts +31 -0
  76. package/dist/src/lib/dataset-maintenance-protected-verify.d.ts +99 -0
  77. package/dist/src/lib/dataset-maintenance-remote.d.ts +212 -0
  78. package/dist/src/lib/dataset-maintenance-support-validation.d.ts +18 -0
  79. package/dist/src/lib/dataset-maintenance-verify.d.ts +102 -0
  80. package/dist/src/lib/dataset-patch.d.ts +193 -0
  81. package/dist/src/lib/dataset-references-rewrite.d.ts +77 -0
  82. package/dist/src/lib/dataset-remote-refresh.d.ts +64 -0
  83. package/dist/src/lib/dataset-remote-verify.d.ts +168 -0
  84. package/dist/src/lib/dataset-save-draft-run.d.ts +283 -0
  85. package/dist/src/lib/dataset-save-draft-run.js +54 -21
  86. package/dist/src/lib/dataset-save-draft-run.js.map +1 -1
  87. package/dist/src/lib/dataset-source-upload-attachments.d.ts +109 -0
  88. package/dist/src/lib/dataset-validate.d.ts +62 -0
  89. package/dist/src/lib/dotenv.d.ts +6 -0
  90. package/dist/src/lib/env.d.ts +59 -0
  91. package/dist/src/lib/errors.d.ts +18 -0
  92. package/dist/src/lib/flow-build-alias-map.d.ts +80 -0
  93. package/dist/src/lib/flow-fetch-rows.d.ts +70 -0
  94. package/dist/src/lib/flow-get.d.ts +35 -0
  95. package/dist/src/lib/flow-governance.d.ts +22 -0
  96. package/dist/src/lib/flow-list.d.ts +57 -0
  97. package/dist/src/lib/flow-materialize-decisions.d.ts +67 -0
  98. package/dist/src/lib/flow-payload-validation.d.ts +32 -0
  99. package/dist/src/lib/flow-publish-reviewed-data.d.ts +262 -0
  100. package/dist/src/lib/flow-publish-version.d.ts +193 -0
  101. package/dist/src/lib/flow-qa.d.ts +289 -0
  102. package/dist/src/lib/flow-read.d.ts +70 -0
  103. package/dist/src/lib/flow-regen-product.d.ts +431 -0
  104. package/dist/src/lib/flow-remediate.d.ts +133 -0
  105. package/dist/src/lib/http.d.ts +25 -0
  106. package/dist/src/lib/http.js.map +1 -1
  107. package/dist/src/lib/identity-preflight.d.ts +235 -0
  108. package/dist/src/lib/io.d.ts +2 -0
  109. package/dist/src/lib/kb-search.d.ts +23 -0
  110. package/dist/src/lib/lca-release.d.ts +105 -0
  111. package/dist/src/lib/lifecyclemodel-auto-build.d.ts +223 -0
  112. package/dist/src/lib/lifecyclemodel-bundle-save.d.ts +71 -0
  113. package/dist/src/lib/lifecyclemodel-graph.d.ts +91 -0
  114. package/dist/src/lib/lifecyclemodel-orchestrate.d.ts +349 -0
  115. package/dist/src/lib/lifecyclemodel-publish-build.d.ts +77 -0
  116. package/dist/src/lib/lifecyclemodel-publish-resulting-process.d.ts +27 -0
  117. package/dist/src/lib/lifecyclemodel-qa.d.ts +206 -0
  118. package/dist/src/lib/lifecyclemodel-resulting-process.d.ts +204 -0
  119. package/dist/src/lib/lifecyclemodel-save-draft-run.d.ts +96 -0
  120. package/dist/src/lib/lifecyclemodel-validate-build.d.ts +78 -0
  121. package/dist/src/lib/llm.d.ts +51 -0
  122. package/dist/src/lib/package-version.d.ts +3 -0
  123. package/dist/src/lib/process-auto-build.d.ts +168 -0
  124. package/dist/src/lib/process-batch-build.d.ts +97 -0
  125. package/dist/src/lib/process-dedup-review.d.ts +253 -0
  126. package/dist/src/lib/process-flow-build-plan.d.ts +108 -0
  127. package/dist/src/lib/process-get.d.ts +26 -0
  128. package/dist/src/lib/process-list.d.ts +87 -0
  129. package/dist/src/lib/process-payload-validation.d.ts +27 -0
  130. package/dist/src/lib/process-publish-build.d.ts +148 -0
  131. package/dist/src/lib/process-qa.d.ts +243 -0
  132. package/dist/src/lib/process-refresh-references.d.ts +179 -0
  133. package/dist/src/lib/process-required-fields.d.ts +142 -0
  134. package/dist/src/lib/process-resume-build.d.ts +77 -0
  135. package/dist/src/lib/process-save-draft-run.d.ts +72 -0
  136. package/dist/src/lib/process-save-draft.d.ts +53 -0
  137. package/dist/src/lib/process-scope-statistics.d.ts +210 -0
  138. package/dist/src/lib/process-verify-rows.d.ts +71 -0
  139. package/dist/src/lib/publish.d.ts +219 -0
  140. package/dist/src/lib/remote.d.ts +19 -0
  141. package/dist/src/lib/run.d.ts +60 -0
  142. package/dist/src/lib/runtime-rulesets.d.ts +29 -0
  143. package/dist/src/lib/state-lock.d.ts +25 -0
  144. package/dist/src/lib/state-lock.js +23 -1
  145. package/dist/src/lib/state-lock.js.map +1 -1
  146. package/dist/src/lib/supabase-client.d.ts +47 -0
  147. package/dist/src/lib/supabase-data-api-contract.d.ts +304 -0
  148. package/dist/src/lib/supabase-data-api-replay.d.ts +74 -0
  149. package/dist/src/lib/supabase-json-ordered-write.d.ts +65 -0
  150. package/dist/src/lib/supabase-rest.d.ts +26 -0
  151. package/dist/src/lib/supabase-session.d.ts +115 -0
  152. package/dist/src/lib/tidas-languages.d.ts +3 -0
  153. package/dist/src/lib/tidas-sdk-package-validator.d.ts +111 -0
  154. package/dist/src/lib/tidas-sdk-validation.d.ts +42 -0
  155. package/dist/src/lib/unstructured.d.ts +32 -0
  156. package/dist/src/lib/user-api-key.d.ts +16 -0
  157. package/dist/src/lib/validation.d.ts +82 -0
  158. package/dist/src/main.d.ts +4 -0
  159. package/package.json +17 -3
@@ -0,0 +1,456 @@
1
+ import { type FlowIdentityPlan, type FlowIdentityProcessManifest } from './dataset-maintenance-flow-identity-contract.js';
2
+ import { type JsonObject } from './dataset-maintenance-contract.js';
3
+ export type FlowIdentityFreeze = {
4
+ schema_version: 'dataset-flow-identity-freeze.v2';
5
+ generated_at_utc: string;
6
+ environment: 'production';
7
+ project_ref: string;
8
+ actor: {
9
+ user_id: string;
10
+ email: string;
11
+ };
12
+ plan_sha256: string;
13
+ operation_id: string;
14
+ capture_artifact_sha256: string;
15
+ receipt_id: string;
16
+ receipt_proof_sha256: string;
17
+ capture_request_sha256: string;
18
+ source_guard_set_sha256: string;
19
+ support_guard_set_sha256: string;
20
+ target_guard_set_sha256: string;
21
+ mapping_guard_set_sha256: string;
22
+ process_intent_set_sha256: string;
23
+ receipt_protected_closure_sha256: string;
24
+ capture_whole_scope_proof_sha256: string;
25
+ source_universe_artifact_sha256: string;
26
+ support_snapshot_artifact_sha256: string;
27
+ mapping_artifact_sha256: string;
28
+ process_manifest_artifact_sha256: string;
29
+ protected_closure_artifact_sha256: string;
30
+ policy_approval_text_sha256: string;
31
+ toolchain_evidence_sha256: string;
32
+ freeze_sha256: string;
33
+ };
34
+ export type FlowIdentityApproval = {
35
+ schema_version: 'dataset-flow-identity-execution-approval.v2';
36
+ approved_at_utc: string;
37
+ actor: {
38
+ user_id: string;
39
+ email: string;
40
+ };
41
+ plan_sha256: string;
42
+ freeze_sha256: string;
43
+ toolchain_evidence_sha256: string;
44
+ policy_approval_text_sha256: string;
45
+ execution_approval_request_sha256: string;
46
+ execution_approval_text_sha256: string;
47
+ execution_approval_identity_sha256: string;
48
+ };
49
+ export type FlowIdentityExecutionIdentity = {
50
+ request_id: string;
51
+ identity_sha256: string;
52
+ environment: 'production';
53
+ project_ref: string;
54
+ actor: {
55
+ user_id: string;
56
+ email: string;
57
+ };
58
+ target_visibility: 'owner_draft';
59
+ operation_id: string;
60
+ plan_sha256: string;
61
+ freeze_sha256: string;
62
+ receipt_id: string;
63
+ receipt_proof_sha256: string;
64
+ policy_approval_text_sha256: string;
65
+ execution_approval_request_sha256: string;
66
+ execution_approval_text_sha256: string;
67
+ execution_approval_identity_sha256: string;
68
+ toolchain_evidence_sha256: string;
69
+ };
70
+ /**
71
+ * A database-minted bearer capability for exactly one live CLI wrapper.
72
+ *
73
+ * The token is deliberately absent from every durable artifact type in this
74
+ * module. Callers must keep this value in memory, rotate it after each
75
+ * successful write response, and discard it when the wrapper exits.
76
+ */
77
+ export type FlowIdentityExecutionPermit = {
78
+ schema_version: 'dataset-flow-identity-execution-permit.v1';
79
+ invocation_id: string;
80
+ generation: number;
81
+ token: string;
82
+ };
83
+ export type FlowIdentityPermitResponse<T> = {
84
+ proof: T;
85
+ executionPermit: FlowIdentityExecutionPermit | null;
86
+ };
87
+ export type FlowIdentityScopePreflightProof = {
88
+ ok: true;
89
+ command: 'cmd_dataset_flow_identity_scope_preflight_guarded';
90
+ schema_version: 'dataset-flow-identity-scope-preflight-result.v2';
91
+ receipt_id: string;
92
+ receipt_proof_sha256: string;
93
+ scope_id: string;
94
+ operation_id: string;
95
+ plan_sha256: string;
96
+ scope_proof_sha256: string;
97
+ status: 'sealed' | 'running' | 'primary_complete' | 'derivatives_pending' | 'completed';
98
+ process_count: number;
99
+ mapping_count: number;
100
+ mapping_guard_set_sha256: string;
101
+ process_intent_set_sha256: string;
102
+ support_snapshot_count: number;
103
+ source_universe_count: 305;
104
+ rewrite_count: number;
105
+ next_ordinal: number;
106
+ audit_id: string;
107
+ replay: boolean;
108
+ };
109
+ export type FlowIdentityScopeLookupProof = {
110
+ ok: true;
111
+ command: 'cmd_dataset_flow_identity_scope_lookup';
112
+ schema_version: 'dataset-flow-identity-scope-lookup-result.v1';
113
+ read_only: true;
114
+ scope_id: string;
115
+ receipt_id: string;
116
+ receipt_proof_sha256: string;
117
+ mapping_guard_set_sha256: string;
118
+ process_intent_set_sha256: string;
119
+ operation_id: string;
120
+ plan_sha256: string;
121
+ scope_proof_sha256: string;
122
+ status: 'sealed' | 'running' | 'primary_complete' | 'derivatives_pending' | 'completed';
123
+ process_count: number;
124
+ mapping_count: number;
125
+ support_snapshot_count: number;
126
+ source_universe_count: 305;
127
+ rewrite_count: number;
128
+ next_ordinal: number;
129
+ audit_id: string;
130
+ whole_scope_proof_sha256: string;
131
+ execution_permit: null;
132
+ };
133
+ export type FlowIdentityScopeProof = FlowIdentityScopePreflightProof | FlowIdentityScopeLookupProof;
134
+ export type FlowIdentityProcessProof = {
135
+ ok: true;
136
+ command: 'cmd_dataset_flow_identity_process_rewrite_guarded';
137
+ schema_version: 'dataset-flow-identity-process-rewrite-result.v2';
138
+ scope_id: string;
139
+ receipt_id: string;
140
+ receipt_proof_sha256: string;
141
+ mapping_guard_set_sha256: string;
142
+ process_intent_set_sha256: string;
143
+ invocation_id: string;
144
+ permit_generation_before: number;
145
+ ordinal: number;
146
+ process_id: string;
147
+ process_version: string;
148
+ process_request_sha256: string;
149
+ process_intent_proof_sha256: string;
150
+ desired_payload_sha256: string;
151
+ desired_exchange_set_sha256: string;
152
+ completed_process_count: number;
153
+ next_ordinal: number | null;
154
+ primary_complete: boolean;
155
+ before_payload_sha256: string;
156
+ before_exchange_set_sha256: string;
157
+ after_payload_sha256: string;
158
+ after_exchange_set_sha256: string;
159
+ rewrite_count: number;
160
+ audit_id: string;
161
+ derivative_batch_id: string;
162
+ status: 'completed';
163
+ replay: boolean;
164
+ };
165
+ export type FlowIdentityScopeProcessStatus = {
166
+ ordinal: number;
167
+ id: string;
168
+ version: string;
169
+ status: 'pending' | 'completed' | 'failed';
170
+ process_request_sha256: string | null;
171
+ process_intent_proof_sha256: string;
172
+ desired_payload_sha256: string;
173
+ desired_exchange_set_sha256: string;
174
+ rewrite_count: number;
175
+ audit_id: string | null;
176
+ before_payload_sha256: string;
177
+ before_exchange_set_sha256: string;
178
+ after_payload_sha256: string | null;
179
+ after_exchange_set_sha256: string | null;
180
+ derivative_batch_id: string | null;
181
+ derivative_request_id: string | null;
182
+ derivative_status: string | null;
183
+ causal_terminal_proof: unknown;
184
+ completed_at: string | null;
185
+ last_error: unknown;
186
+ };
187
+ export type FlowIdentityDerivativeResidue = {
188
+ http_requests: number;
189
+ embedding_jobs: number;
190
+ pending_jobs: number;
191
+ failure_rows: number;
192
+ other_active_fences: number;
193
+ };
194
+ export type FlowIdentityDerivativeTargetProof = {
195
+ ordinal: number;
196
+ id: string;
197
+ version: string;
198
+ original_batch_id: string;
199
+ effective_reference_id: string | null;
200
+ effective_reference_kind: 'protected_batch' | 'separate_compensation';
201
+ status: 'completed' | 'pending' | 'failed';
202
+ request_status: 'queued' | 'dispatching' | 'markdown_pending' | 'embedding_pending' | 'completed' | 'stale' | 'failed' | 'missing';
203
+ phase: string;
204
+ lineage_ok: boolean;
205
+ proposals_committed: boolean;
206
+ terminal_audit_present: boolean;
207
+ residue: FlowIdentityDerivativeResidue;
208
+ current_snapshot_sha256: string;
209
+ current_json_ordered_sha256: string;
210
+ causal_terminal_proof: boolean;
211
+ };
212
+ export type FlowIdentityDerivativeSetProof = {
213
+ ok: boolean;
214
+ schema_version: 'dataset-flow-identity-derivative-set-proof.v1';
215
+ scope_id: string;
216
+ status: 'failed' | 'compensation_required' | 'pending' | 'completed';
217
+ target_count: number;
218
+ completed_count: number;
219
+ pending_count: number;
220
+ failed_count: number;
221
+ causal_terminal_proof: boolean;
222
+ targets: FlowIdentityDerivativeTargetProof[];
223
+ compensation_targets: FlowIdentityCompensationTarget[];
224
+ proof_sha256: string;
225
+ };
226
+ export type FlowIdentityCompensationTarget = {
227
+ ordinal: number;
228
+ table: 'processes';
229
+ id: string;
230
+ version: string;
231
+ original_batch_id: string;
232
+ original_request_id?: string | null;
233
+ original_status: 'failed' | 'stale' | 'missing';
234
+ original_error?: unknown;
235
+ original_code?: string;
236
+ desired_payload_sha256: string;
237
+ current_json_ordered_sha256: string;
238
+ current_snapshot_sha256: string;
239
+ current_modified_at: string;
240
+ components: ['extracted_md', 'embedding_ft'];
241
+ reason_code: string;
242
+ operation_id_prefix: string;
243
+ latest_compensation_request_id: string | null;
244
+ latest_compensation_status: string | null;
245
+ latest_compensation_plan_sha256: string | null;
246
+ requires_new_plan_freeze_approval: true;
247
+ automatic_retry: false;
248
+ };
249
+ export type FlowIdentityWholeScopeProof = {
250
+ schema_version: 'dataset-flow-identity-whole-scope-proof.v2';
251
+ scope_id: string;
252
+ receipt_id: string;
253
+ primary_current: boolean;
254
+ audit_current: boolean;
255
+ source_guards_current: boolean;
256
+ support_guards_current: boolean;
257
+ target_guards_current: boolean;
258
+ approved_reference_residue_count: number;
259
+ protected_closure_current: boolean;
260
+ occurrence_closure_current: boolean;
261
+ derivatives_current: boolean;
262
+ primary_closure_sha256: string;
263
+ source_guard_set_sha256: string;
264
+ support_guard_set_sha256: string;
265
+ target_guard_set_sha256: string;
266
+ protected_closure_sha256: string;
267
+ derivative_proof_set_sha256: string;
268
+ causal_terminal_proof: boolean;
269
+ proof_sha256: string;
270
+ };
271
+ export type FlowIdentityScopeStatus = {
272
+ ok: boolean;
273
+ command: 'cmd_dataset_flow_identity_scope_read';
274
+ schema_version: 'dataset-flow-identity-scope-status.v2';
275
+ scope_id: string;
276
+ receipt_id: string;
277
+ receipt_proof_sha256: string;
278
+ mapping_guard_set_sha256: string;
279
+ process_intent_set_sha256: string;
280
+ operation_id: string;
281
+ plan_sha256: string;
282
+ scope_proof_sha256: string;
283
+ status: 'sealed' | 'running' | 'primary_complete' | 'derivatives_pending' | 'completed' | 'live_drift' | 'failed';
284
+ process_count: number;
285
+ rewrite_count: number;
286
+ completed_process_count: number;
287
+ pending_process_count: number;
288
+ failed_process_count: number;
289
+ completed_rewrite_count: number;
290
+ next_ordinal: number;
291
+ primary_complete: boolean;
292
+ primary_current: boolean;
293
+ live_guard_current: boolean;
294
+ derivatives_current: boolean;
295
+ derivative_pending_count: number;
296
+ derivative_failed_count: number;
297
+ derivative_set_proof: FlowIdentityDerivativeSetProof;
298
+ derivative_proof_set_sha256: string;
299
+ protected_closure_current: boolean;
300
+ protected_closure_proof: JsonObject;
301
+ processes: FlowIdentityScopeProcessStatus[];
302
+ terminal_proof_sha256: string | null;
303
+ completed_at: string | null;
304
+ cancellable: boolean;
305
+ strict_continuation_required: boolean;
306
+ whole_scope_proof: FlowIdentityWholeScopeProof;
307
+ whole_scope_proof_sha256: string;
308
+ code?: string;
309
+ compensation_required?: boolean;
310
+ automatic_retry?: false;
311
+ compensation_targets?: FlowIdentityCompensationTarget[];
312
+ };
313
+ export type FlowIdentityFinalizeProof = {
314
+ ok: boolean;
315
+ command: 'cmd_dataset_flow_identity_scope_finalize_guarded';
316
+ schema_version: 'dataset-flow-identity-scope-finalize-result.v2';
317
+ scope_id: string;
318
+ receipt_id: string;
319
+ receipt_proof_sha256: string;
320
+ mapping_guard_set_sha256: string;
321
+ process_intent_set_sha256: string;
322
+ operation_id: string;
323
+ plan_sha256: string;
324
+ scope_proof_sha256: string;
325
+ invocation_id: string;
326
+ permit_generation_before: number;
327
+ status: 'derivatives_pending' | 'completed' | 'live_drift' | 'failed';
328
+ process_count: number;
329
+ rewrite_count: number;
330
+ completed_process_count: number;
331
+ primary_closure_sha256: string;
332
+ protected_closure_sha256: string;
333
+ derivative_target_set_sha256: string;
334
+ derivative_proof_set_sha256: string;
335
+ primary_current: boolean;
336
+ live_guard_current: boolean;
337
+ derivatives_current: boolean;
338
+ terminal_proof_sha256: string | null;
339
+ whole_scope_proof: FlowIdentityWholeScopeProof;
340
+ whole_scope_proof_sha256: string;
341
+ audit_id: string | null;
342
+ replay: boolean;
343
+ code?: string;
344
+ compensation_required?: boolean;
345
+ automatic_retry?: false;
346
+ compensation_targets?: FlowIdentityCompensationTarget[];
347
+ };
348
+ declare function token(value: unknown, label: string): string;
349
+ declare function hash(value: unknown, label: string): string;
350
+ declare function uuid(value: unknown, label: string): string;
351
+ declare function instant(value: unknown, label: string): string;
352
+ declare function integer(value: unknown, label: string, minimum?: number): number;
353
+ declare function deterministicUuidFromSha256(digest: string): string;
354
+ export declare function computeFlowIdentityFreezeSha256(freeze: FlowIdentityFreeze): string;
355
+ export declare function computeFlowIdentityApprovalIdentitySha256(approval: FlowIdentityApproval): string;
356
+ export declare function parseFlowIdentityFreeze(value: unknown, plan: FlowIdentityPlan): FlowIdentityFreeze;
357
+ export declare function parseFlowIdentityApproval(value: unknown, plan: FlowIdentityPlan, freeze: FlowIdentityFreeze): FlowIdentityApproval;
358
+ export declare function buildFlowIdentityExecutionIdentity(options: {
359
+ plan: FlowIdentityPlan;
360
+ freeze: FlowIdentityFreeze;
361
+ approval: FlowIdentityApproval;
362
+ }): FlowIdentityExecutionIdentity;
363
+ export declare function buildFlowIdentityScopePreflightRequest(options: {
364
+ plan: FlowIdentityPlan;
365
+ identity: FlowIdentityExecutionIdentity;
366
+ }): JsonObject;
367
+ export declare function buildFlowIdentityScopeLookupRequest(options: {
368
+ identity: FlowIdentityExecutionIdentity;
369
+ }): JsonObject;
370
+ /**
371
+ * Removes the memory-only permit before a response enters a proof parser or
372
+ * durable artifact writer. Exact proof parsers therefore cannot accidentally
373
+ * accept or persist the bearer token.
374
+ */
375
+ export declare function splitFlowIdentityPermitResponse(options: {
376
+ value: unknown;
377
+ expectedGeneration: number;
378
+ expectedInvocationId?: string;
379
+ permitRequired: boolean;
380
+ permitForbidden?: boolean;
381
+ label: string;
382
+ }): FlowIdentityPermitResponse<JsonObject>;
383
+ export declare function computeFlowIdentityProcessRequestSha256(request: JsonObject): string;
384
+ export declare function buildFlowIdentityProcessRequest(options: {
385
+ scopeProofSha256: string;
386
+ ordinal: number;
387
+ processIntentProofSha256: string;
388
+ }): JsonObject;
389
+ export declare function buildFlowIdentityFinalizeRequest(options: {
390
+ scopeProofSha256: string;
391
+ plan: FlowIdentityPlan;
392
+ status: FlowIdentityScopeStatus;
393
+ }): JsonObject;
394
+ export declare function parseFlowIdentityScopePreflightProof(value: unknown, plan: FlowIdentityPlan): FlowIdentityScopePreflightProof;
395
+ export declare function parseFlowIdentityScopeLookupProof(value: unknown, plan: FlowIdentityPlan, identity: FlowIdentityExecutionIdentity): FlowIdentityScopeLookupProof;
396
+ export declare function parseFlowIdentityProcessProof(options: {
397
+ value: unknown;
398
+ scopeId: string;
399
+ process: FlowIdentityProcessManifest;
400
+ requestSha256: string;
401
+ receiptId: string;
402
+ receiptProofSha256: string;
403
+ mappingGuardSetSha256: string;
404
+ processIntentSetSha256: string;
405
+ processIntentProofSha256: string;
406
+ processCount: number;
407
+ expectedInvocationId?: string;
408
+ expectedPermitGenerationBefore?: number;
409
+ }): FlowIdentityProcessProof;
410
+ declare function parseScopeProcess(value: unknown, expected: FlowIdentityProcessManifest): FlowIdentityScopeProcessStatus;
411
+ declare function parseCompensationEnvelope(value: JsonObject, plan: FlowIdentityPlan, scopeId: string, source: 'scope_read' | 'finalize'): FlowIdentityCompensationTarget[];
412
+ export declare function parseFlowIdentityDerivativeSetProof(options: {
413
+ value: unknown;
414
+ plan: FlowIdentityPlan;
415
+ scopeId: string;
416
+ processes: FlowIdentityScopeProcessStatus[];
417
+ }): FlowIdentityDerivativeSetProof;
418
+ export declare function parseFlowIdentityWholeScopeProof(options: {
419
+ value: unknown;
420
+ scopeId: string;
421
+ receiptId: string;
422
+ }): FlowIdentityWholeScopeProof;
423
+ export declare function parseFlowIdentityScopeStatus(value: unknown, plan: FlowIdentityPlan, scopeId: string, scopeProofSha256: string): FlowIdentityScopeStatus;
424
+ export declare function flowIdentityScopeHasCurrentDerivativeClosure(status: FlowIdentityScopeStatus): boolean;
425
+ export declare function flowIdentityScopeIsReadyToFinalize(status: FlowIdentityScopeStatus): boolean;
426
+ export declare function parseFlowIdentityFinalizeProof(options: {
427
+ value: unknown;
428
+ plan: FlowIdentityPlan;
429
+ scopeId: string;
430
+ scopeProofSha256: string;
431
+ request: JsonObject;
432
+ expectedInvocationId?: string;
433
+ expectedPermitGenerationBefore?: number;
434
+ }): FlowIdentityFinalizeProof;
435
+ export declare function prepareFlowIdentityExecution(options: {
436
+ plan: unknown;
437
+ freeze: unknown;
438
+ approval: unknown;
439
+ }): {
440
+ plan: FlowIdentityPlan;
441
+ freeze: FlowIdentityFreeze;
442
+ approval: FlowIdentityApproval;
443
+ identity: FlowIdentityExecutionIdentity;
444
+ preflightRequest: JsonObject;
445
+ };
446
+ export declare const __testInternals: {
447
+ deterministicUuidFromSha256: typeof deterministicUuidFromSha256;
448
+ hash: typeof hash;
449
+ instant: typeof instant;
450
+ integer: typeof integer;
451
+ parseScopeProcess: typeof parseScopeProcess;
452
+ parseCompensationEnvelope: typeof parseCompensationEnvelope;
453
+ token: typeof token;
454
+ uuid: typeof uuid;
455
+ };
456
+ export {};
@@ -0,0 +1,99 @@
1
+ export type FlowIdentityExecutionApprovalRequestCore = {
2
+ schema_version: 'dataset-flow-identity-execution-approval-request.v3';
3
+ approved_at_utc: string;
4
+ environment: 'production';
5
+ project_ref: string;
6
+ actor: {
7
+ user_id: string;
8
+ email: string;
9
+ };
10
+ target_visibility: 'owner_draft';
11
+ plan_sha256: string;
12
+ operation_id: string;
13
+ plan_file_sha256: string;
14
+ freeze_file_sha256: string;
15
+ freeze_sha256: string;
16
+ receipt_id: string;
17
+ receipt_proof_sha256: string;
18
+ capture_request_sha256: string;
19
+ source_guard_set_sha256: string;
20
+ support_guard_set_sha256: string;
21
+ target_guard_set_sha256: string;
22
+ mapping_guard_set_sha256: string;
23
+ process_intent_set_sha256: string;
24
+ receipt_protected_closure_sha256: string;
25
+ capture_whole_scope_proof_sha256: string;
26
+ capture_artifact_sha256: string;
27
+ toolchain_evidence_sha256: string;
28
+ policy_approval_text_sha256: string;
29
+ semantic_source_count: 305;
30
+ mapping_count: number;
31
+ pending_count: number;
32
+ blocker_count: number;
33
+ orphan_count: number;
34
+ process_count: number;
35
+ rewrite_count: number;
36
+ state_code_changes: 0;
37
+ deletes: 0;
38
+ source_mutations: 0;
39
+ public_target_mutations: 0;
40
+ user_state_claim: 'authenticated_actor_state_100_plus_own_state_0';
41
+ approval_reusable: false;
42
+ maximum_wrapper_invocations: 1;
43
+ maximum_cli_apply_spawns: 1;
44
+ maximum_process_posts: number;
45
+ maximum_finalize_posts: 1;
46
+ max_process_concurrency: 1;
47
+ automatic_retry: false;
48
+ };
49
+ export type FlowIdentityApprovalRequest = FlowIdentityExecutionApprovalRequestCore & {
50
+ request_sha256: string;
51
+ };
52
+ export type FreezeFlowIdentityOptions = {
53
+ planPath: string;
54
+ toolchainEvidencePath: string;
55
+ expectedProjectRef: string;
56
+ confirm: string;
57
+ approvedAtUtc: string;
58
+ cliVersion: string;
59
+ outDir: string;
60
+ now?: Date;
61
+ };
62
+ export type FlowIdentityFreezeReport = {
63
+ schema_version: 'dataset-flow-identity-freeze-report.v2';
64
+ generated_at_utc: string;
65
+ status: 'frozen';
66
+ execution_submitted: false;
67
+ network_calls: 0;
68
+ database_calls: 0;
69
+ plan_sha256: string;
70
+ operation_id: string;
71
+ freeze_sha256: string;
72
+ freeze_file_sha256: string;
73
+ execution_approval_request_sha256: string;
74
+ execution_approval_text_sha256: string;
75
+ policy_approval_text_sha256: string;
76
+ artifacts: {
77
+ freeze: string;
78
+ approval_request: string;
79
+ approval_text: string;
80
+ report: string;
81
+ };
82
+ };
83
+ export declare const FLOW_IDENTITY_FREEZE_ARTIFACTS: {
84
+ readonly freeze: 'flow-identity-freeze.json';
85
+ readonly approval_request: 'flow-identity-execution-approval-request.json';
86
+ readonly approval_text: 'flow-identity-execution-approval-request.txt';
87
+ readonly report: 'flow-identity-freeze-report.json';
88
+ };
89
+ declare function canonicalTimestamp(value: string, label: string): string;
90
+ declare function requestCore(value: FlowIdentityApprovalRequest): FlowIdentityExecutionApprovalRequestCore;
91
+ export declare function computeFlowIdentityApprovalRequestSha256(request: FlowIdentityApprovalRequest): string;
92
+ export declare function renderFlowIdentityExecutionApprovalText(core: FlowIdentityExecutionApprovalRequestCore, requestSha256: string): string;
93
+ export declare function parseFlowIdentityApprovalRequest(value: unknown): FlowIdentityApprovalRequest;
94
+ export declare function freezeFlowIdentity(options: FreezeFlowIdentityOptions): FlowIdentityFreezeReport;
95
+ export declare const __testInternals: {
96
+ canonicalTimestamp: typeof canonicalTimestamp;
97
+ requestCore: typeof requestCore;
98
+ };
99
+ export {};
@@ -0,0 +1,85 @@
1
+ import { type FlowIdentityCollisionLedger, type FlowIdentityCompatibilityPolicy, type FlowIdentityCaptureRequest, type FlowIdentityDirection, type FlowIdentityLiveCapture, type FlowIdentityMapping, type FlowIdentityMappingEndpoint, type FlowIdentityOccurrence, type FlowIdentityPlan, type FlowIdentityPlanBundle, type FlowIdentityProcessTemplate, type FlowIdentityProtectedClosure, type FlowIdentityReference, type FlowIdentityReviewLedger, type FlowIdentityRewrite, type FlowIdentitySupportSnapshot } from './dataset-maintenance-flow-identity-contract.js';
2
+ import { type DatasetMaintenanceRowSnapshot, type JsonObject } from './dataset-maintenance-contract.js';
3
+ import { type FlowPayloadValidationResult } from './flow-payload-validation.js';
4
+ import { type ProcessPayloadValidationResult } from './process-payload-validation.js';
5
+ export type ValidationDeps = {
6
+ validateFlow: (payload: JsonObject) => FlowPayloadValidationResult;
7
+ validateProcess: (payload: JsonObject) => ProcessPayloadValidationResult;
8
+ };
9
+ export type BuildFlowIdentityPlanOptions = {
10
+ policy: unknown;
11
+ reviewLedger: unknown;
12
+ liveCapture: unknown;
13
+ now?: Date;
14
+ validation?: Partial<ValidationDeps>;
15
+ };
16
+ export type RunFlowIdentityPlanOptions = BuildFlowIdentityPlanOptions & {
17
+ outDir: string;
18
+ };
19
+ declare function rowKey(id: string, version: string): string;
20
+ declare function indexRows(rows: DatasetMaintenanceRowSnapshot[], table: DatasetMaintenanceRowSnapshot['table']): Map<string, DatasetMaintenanceRowSnapshot>;
21
+ declare function arrayOfObjects(value: unknown): JsonObject[] | null;
22
+ declare function flowIdentity(payload: JsonObject): {
23
+ id: string;
24
+ version: string;
25
+ } | null;
26
+ export declare function flowType(payload: JsonObject): string | null;
27
+ declare function flowClassificationInformation(payload: JsonObject): unknown;
28
+ declare function flowSupportFacts(row: DatasetMaintenanceRowSnapshot, supportRows: DatasetMaintenanceRowSnapshot[], actorUserId: string): Omit<FlowIdentityMappingEndpoint, 'user_id' | 'state_code' | 'modified_at' | 'payload_sha256' | 'row_sha256'> | null;
29
+ declare function flowGuardRowSha256(row: DatasetMaintenanceRowSnapshot): string | null;
30
+ declare function processGuardRowSha256(row: DatasetMaintenanceRowSnapshot): string | null;
31
+ declare function endpoint(row: DatasetMaintenanceRowSnapshot, supportRows: DatasetMaintenanceRowSnapshot[], actorUserId: string): FlowIdentityMappingEndpoint | null;
32
+ declare function processExchanges(payload: JsonObject): JsonObject[] | null;
33
+ declare function exchangeReference(exchange: JsonObject): FlowIdentityReference | null;
34
+ declare function exchangeDirection(exchange: JsonObject): FlowIdentityDirection | null;
35
+ declare function exchangeInternalId(exchange: JsonObject): string | null;
36
+ declare function patchReference(reference: JsonObject, target: FlowIdentityReference): void;
37
+ declare function collectOccurrences(processes: DatasetMaintenanceRowSnapshot[]): Map<string, FlowIdentityOccurrence[]>;
38
+ declare function buildProtectedClosure(review: FlowIdentityReviewLedger, occurrenceIndex: Map<string, FlowIdentityOccurrence[]>): FlowIdentityProtectedClosure;
39
+ declare function collisionLedger(options: {
40
+ desiredExchanges: JsonObject[];
41
+ rewrites: FlowIdentityRewrite[];
42
+ }): FlowIdentityCollisionLedger;
43
+ export declare function buildFlowIdentityCaptureRequest(options: {
44
+ requestId: string;
45
+ operationId: string;
46
+ policy: FlowIdentityCompatibilityPolicy;
47
+ capture: FlowIdentityLiveCapture;
48
+ mappings: FlowIdentityMapping[];
49
+ processTemplates: FlowIdentityProcessTemplate[];
50
+ protectedClosure: FlowIdentityProtectedClosure;
51
+ }): FlowIdentityCaptureRequest;
52
+ export declare function buildFlowIdentitySemantics(options: {
53
+ policy: FlowIdentityCompatibilityPolicy;
54
+ review: FlowIdentityReviewLedger;
55
+ capture: FlowIdentityLiveCapture;
56
+ validation: ValidationDeps;
57
+ }): {
58
+ protectedClosure: FlowIdentityProtectedClosure;
59
+ mappings: FlowIdentityMapping[];
60
+ supportSnapshots: FlowIdentitySupportSnapshot[];
61
+ processTemplates: FlowIdentityProcessTemplate[];
62
+ };
63
+ export declare function buildFlowIdentityPlan(options: BuildFlowIdentityPlanOptions): FlowIdentityPlanBundle;
64
+ export declare function runFlowIdentityPlan(options: RunFlowIdentityPlanOptions): FlowIdentityPlan;
65
+ export declare const __testInternals: {
66
+ arrayOfObjects: typeof arrayOfObjects;
67
+ buildProtectedClosure: typeof buildProtectedClosure;
68
+ collectOccurrences: typeof collectOccurrences;
69
+ collisionLedger: typeof collisionLedger;
70
+ endpoint: typeof endpoint;
71
+ exchangeDirection: typeof exchangeDirection;
72
+ exchangeInternalId: typeof exchangeInternalId;
73
+ exchangeReference: typeof exchangeReference;
74
+ flowClassificationInformation: typeof flowClassificationInformation;
75
+ flowIdentity: typeof flowIdentity;
76
+ flowGuardRowSha256: typeof flowGuardRowSha256;
77
+ flowSupportFacts: typeof flowSupportFacts;
78
+ flowType: typeof flowType;
79
+ indexRows: typeof indexRows;
80
+ patchReference: typeof patchReference;
81
+ processGuardRowSha256: typeof processGuardRowSha256;
82
+ processExchanges: typeof processExchanges;
83
+ rowKey: typeof rowKey;
84
+ };
85
+ export {};